summaryrefslogtreecommitdiffstats
path: root/gfx/angle
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/angle
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--gfx/angle/MERGE_BASE1
-rw-r--r--gfx/angle/checkout/include/EGL/egl.h361
-rw-r--r--gfx/angle/checkout/include/EGL/eglext.h1321
-rw-r--r--gfx/angle/checkout/include/EGL/eglext_angle.h241
-rw-r--r--gfx/angle/checkout/include/EGL/eglplatform.h176
-rw-r--r--gfx/angle/checkout/include/GLES/gl.h743
-rw-r--r--gfx/angle/checkout/include/GLES/glext.h965
-rw-r--r--gfx/angle/checkout/include/GLES/glext_angle.h23
-rw-r--r--gfx/angle/checkout/include/GLES/glext_explicit_context_autogen.inc260
-rw-r--r--gfx/angle/checkout/include/GLES/glplatform.h38
-rw-r--r--gfx/angle/checkout/include/GLES2/gl2.h675
-rw-r--r--gfx/angle/checkout/include/GLES2/gl2ext.h3622
-rw-r--r--gfx/angle/checkout/include/GLES2/gl2ext_angle.h685
-rw-r--r--gfx/angle/checkout/include/GLES2/gl2ext_explicit_context_autogen.inc728
-rw-r--r--gfx/angle/checkout/include/GLES2/gl2platform.h30
-rw-r--r--gfx/angle/checkout/include/GLES3/gl3.h1211
-rw-r--r--gfx/angle/checkout/include/GLES3/gl31.h1528
-rw-r--r--gfx/angle/checkout/include/GLES3/gl31ext_explicit_context_autogen.inc148
-rw-r--r--gfx/angle/checkout/include/GLES3/gl32.h1829
-rw-r--r--gfx/angle/checkout/include/GLES3/gl3ext_explicit_context_autogen.inc220
-rw-r--r--gfx/angle/checkout/include/GLES3/gl3platform.h30
-rw-r--r--gfx/angle/checkout/include/GLSLANG/ShaderLang.h685
-rw-r--r--gfx/angle/checkout/include/GLSLANG/ShaderVars.h336
-rw-r--r--gfx/angle/checkout/include/KHR/khrplatform.h282
-rw-r--r--gfx/angle/checkout/include/WGL/wgl.h946
-rw-r--r--gfx/angle/checkout/include/angle_gl.h21
-rw-r--r--gfx/angle/checkout/include/export.h32
-rw-r--r--gfx/angle/checkout/include/platform/Feature.h171
-rw-r--r--gfx/angle/checkout/include/platform/FeaturesD3D.h238
-rw-r--r--gfx/angle/checkout/include/platform/FeaturesGL.h341
-rw-r--r--gfx/angle/checkout/include/platform/FeaturesVk.h194
-rw-r--r--gfx/angle/checkout/include/platform/FrontendFeatures.h59
-rw-r--r--gfx/angle/checkout/include/platform/Platform.h324
-rw-r--r--gfx/angle/checkout/out/gen/angle/id/commit.h3
-rw-r--r--gfx/angle/checkout/src/common/Color.h104
-rw-r--r--gfx/angle/checkout/src/common/Color.inc69
-rw-r--r--gfx/angle/checkout/src/common/FastVector.h434
-rw-r--r--gfx/angle/checkout/src/common/FixedVector.h341
-rw-r--r--gfx/angle/checkout/src/common/Float16ToFloat32.cpp300
-rw-r--r--gfx/angle/checkout/src/common/MemoryBuffer.cpp147
-rw-r--r--gfx/angle/checkout/src/common/MemoryBuffer.h89
-rw-r--r--gfx/angle/checkout/src/common/Optional.h68
-rw-r--r--gfx/angle/checkout/src/common/PackedEGLEnums_autogen.cpp355
-rw-r--r--gfx/angle/checkout/src/common/PackedEGLEnums_autogen.h116
-rw-r--r--gfx/angle/checkout/src/common/PackedEnums.cpp367
-rw-r--r--gfx/angle/checkout/src/common/PackedEnums.h390
-rw-r--r--gfx/angle/checkout/src/common/PackedGLEnums_autogen.cpp2285
-rw-r--r--gfx/angle/checkout/src/common/PackedGLEnums_autogen.h581
-rw-r--r--gfx/angle/checkout/src/common/PoolAlloc.cpp334
-rw-r--r--gfx/angle/checkout/src/common/PoolAlloc.h276
-rw-r--r--gfx/angle/checkout/src/common/aligned_memory.cpp64
-rw-r--r--gfx/angle/checkout/src/common/aligned_memory.h23
-rw-r--r--gfx/angle/checkout/src/common/android_util.cpp268
-rw-r--r--gfx/angle/checkout/src/common/android_util.h39
-rw-r--r--gfx/angle/checkout/src/common/angleutils.cpp74
-rw-r--r--gfx/angle/checkout/src/common/angleutils.h333
-rw-r--r--gfx/angle/checkout/src/common/bitset_utils.h564
-rw-r--r--gfx/angle/checkout/src/common/debug.cpp285
-rw-r--r--gfx/angle/checkout/src/common/debug.h366
-rw-r--r--gfx/angle/checkout/src/common/event_tracer.cpp53
-rw-r--r--gfx/angle/checkout/src/common/event_tracer.h26
-rw-r--r--gfx/angle/checkout/src/common/hash_utils.h39
-rw-r--r--gfx/angle/checkout/src/common/mathutil.cpp93
-rw-r--r--gfx/angle/checkout/src/common/mathutil.h1305
-rw-r--r--gfx/angle/checkout/src/common/matrix_utils.cpp285
-rw-r--r--gfx/angle/checkout/src/common/matrix_utils.h423
-rw-r--r--gfx/angle/checkout/src/common/platform.h111
-rw-r--r--gfx/angle/checkout/src/common/string_utils.cpp212
-rw-r--r--gfx/angle/checkout/src/common/string_utils.h86
-rw-r--r--gfx/angle/checkout/src/common/system_utils.cpp31
-rw-r--r--gfx/angle/checkout/src/common/system_utils.h71
-rw-r--r--gfx/angle/checkout/src/common/system_utils_linux.cpp47
-rw-r--r--gfx/angle/checkout/src/common/system_utils_mac.cpp52
-rw-r--r--gfx/angle/checkout/src/common/system_utils_posix.cpp276
-rw-r--r--gfx/angle/checkout/src/common/system_utils_win.cpp318
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/base_export.h13
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/containers/mru_cache.h275
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/logging.h26
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/macros.h17
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions.h177
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h273
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math.h334
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math_impl.h570
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.cc245
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.h36
-rw-r--r--gfx/angle/checkout/src/common/third_party/base/anglebase/sys_byteorder.h49
-rw-r--r--gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp339
-rw-r--r--gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.h57
-rw-r--r--gfx/angle/checkout/src/common/third_party/xxhash/xxhash.c1030
-rw-r--r--gfx/angle/checkout/src/common/third_party/xxhash/xxhash.h341
-rw-r--r--gfx/angle/checkout/src/common/tls.cpp157
-rw-r--r--gfx/angle/checkout/src/common/tls.h46
-rw-r--r--gfx/angle/checkout/src/common/uniform_type_info_autogen.cpp318
-rw-r--r--gfx/angle/checkout/src/common/utilities.cpp1110
-rw-r--r--gfx/angle/checkout/src/common/utilities.h253
-rw-r--r--gfx/angle/checkout/src/common/vector_utils.h523
-rw-r--r--gfx/angle/checkout/src/common/version.h27
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.cpp146
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.h95
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.cpp19
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.h49
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.cpp969
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.h88
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.cpp1906
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.h48
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Input.cpp130
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Input.h59
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Lexer.cpp19
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Lexer.h32
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Macro.cpp45
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Macro.h55
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.cpp531
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.h91
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.cpp107
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.h72
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/SourceLocation.h44
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Token.cpp79
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Token.h115
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp2613
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.h63
-rw-r--r--gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h54
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp461
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.h62
-rw-r--r--gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.cpp112
-rw-r--r--gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.h50
-rw-r--r--gfx/angle/checkout/src/compiler/translator/BaseTypes.h1086
-rw-r--r--gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp162
-rw-r--r--gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h80
-rw-r--r--gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp284
-rw-r--r--gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h40
-rw-r--r--gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp173
-rw-r--r--gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h27
-rw-r--r--gfx/angle/checkout/src/compiler/translator/CallDAG.cpp316
-rw-r--r--gfx/angle/checkout/src/compiler/translator/CallDAG.h77
-rw-r--r--gfx/angle/checkout/src/compiler/translator/CodeGen.cpp75
-rw-r--r--gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp970
-rw-r--r--gfx/angle/checkout/src/compiler/translator/CollectVariables.h36
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Common.h151
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Compiler.cpp1478
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Compiler.h304
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ConstantUnion.cpp772
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ConstantUnion.h119
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Declarator.cpp33
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Declarator.h49
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Diagnostics.cpp106
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Diagnostics.h67
-rw-r--r--gfx/angle/checkout/src/compiler/translator/DirectiveHandler.cpp204
-rw-r--r--gfx/angle/checkout/src/compiler/translator/DirectiveHandler.h59
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.cpp101
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.h65
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.cpp104
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h44
-rw-r--r--gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp76
-rw-r--r--gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.h30
-rw-r--r--gfx/angle/checkout/src/compiler/translator/FunctionLookup.cpp179
-rw-r--r--gfx/angle/checkout/src/compiler/translator/FunctionLookup.h60
-rw-r--r--gfx/angle/checkout/src/compiler/translator/HashNames.cpp94
-rw-r--r--gfx/angle/checkout/src/compiler/translator/HashNames.h33
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.cpp371
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.h96
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp69
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ImmutableString.h144
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.cpp63
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h80
-rw-r--r--gfx/angle/checkout/src/compiler/translator/InfoSink.cpp82
-rw-r--r--gfx/angle/checkout/src/compiler/translator/InfoSink.h129
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Initialize.cpp117
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Initialize.h28
-rw-r--r--gfx/angle/checkout/src/compiler/translator/InitializeDll.cpp33
-rw-r--r--gfx/angle/checkout/src/compiler/translator/InitializeDll.h15
-rw-r--r--gfx/angle/checkout/src/compiler/translator/InitializeGlobals.h13
-rw-r--r--gfx/angle/checkout/src/compiler/translator/IntermNode.cpp3787
-rw-r--r--gfx/angle/checkout/src/compiler/translator/IntermNode.h936
-rw-r--r--gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp37
-rw-r--r--gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.h20
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Operator.cpp420
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Operator.h268
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputESSL.cpp46
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputESSL.h37
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp118
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputGLSL.h36
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp1433
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h125
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp3568
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputHLSL.h279
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputTree.cpp699
-rw-r--r--gfx/angle/checkout/src/compiler/translator/OutputTree.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ParseContext.cpp6100
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ParseContext.h667
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ParseContext_autogen.h66
-rw-r--r--gfx/angle/checkout/src/compiler/translator/PoolAlloc.cpp40
-rw-r--r--gfx/angle/checkout/src/compiler/translator/PoolAlloc.h102
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Pragma.h31
-rw-r--r--gfx/angle/checkout/src/compiler/translator/QualifierTypes.cpp829
-rw-r--r--gfx/angle/checkout/src/compiler/translator/QualifierTypes.h200
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.cpp790
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.h139
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Severity.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ShaderLang.cpp675
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.cpp435
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.h94
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.cpp762
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.h92
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp582
-rw-r--r--gfx/angle/checkout/src/compiler/translator/StaticType.h202
-rw-r--r--gfx/angle/checkout/src/compiler/translator/StructureHLSL.cpp591
-rw-r--r--gfx/angle/checkout/src/compiler/translator/StructureHLSL.h98
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Symbol.cpp238
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Symbol.h277
-rw-r--r--gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp417
-rw-r--r--gfx/angle/checkout/src/compiler/translator/SymbolTable.h201
-rw-r--r--gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp20959
-rw-r--r--gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.h78
-rw-r--r--gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp27
-rw-r--r--gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h58
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.cpp1554
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.h77
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp184
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TranslatorESSL.h35
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp334
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.h38
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp204
-rw-r--r--gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.h51
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Types.cpp970
-rw-r--r--gfx/angle/checkout/src/compiler/translator/Types.h464
-rw-r--r--gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp1108
-rw-r--r--gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h135
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateAST.cpp251
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateAST.h58
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp141
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.h20
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp442
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateLimitations.h26
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp30
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.h21
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp184
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateOutputs.h30
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp315
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h27
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp179
-rw-r--r--gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.h25
-rw-r--r--gfx/angle/checkout/src/compiler/translator/VariablePacker.cpp413
-rw-r--r--gfx/angle/checkout/src/compiler/translator/VariablePacker.h32
-rw-r--r--gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp149
-rw-r--r--gfx/angle/checkout/src/compiler/translator/VersionGLSL.h76
-rw-r--r--gfx/angle/checkout/src/compiler/translator/blocklayout.cpp606
-rw-r--r--gfx/angle/checkout/src/compiler/translator/blocklayout.h302
-rw-r--r--gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.cpp167
-rw-r--r--gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.h68
-rw-r--r--gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp881
-rw-r--r--gfx/angle/checkout/src/compiler/translator/glslang.h24
-rw-r--r--gfx/angle/checkout/src/compiler/translator/glslang_lex.cpp4108
-rw-r--r--gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp5201
-rw-r--r--gfx/angle/checkout/src/compiler/translator/glslang_tab.h284
-rw-r--r--gfx/angle/checkout/src/compiler/translator/length_limits.h26
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp58
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.h20
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp58
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp228
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp107
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h23
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp54
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.h24
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp48
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp186
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h48
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp167
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.h33
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp131
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h31
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.cpp213
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h47
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp776
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.h85
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp145
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.h29
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp115
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.h24
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp311
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.h56
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.cpp101
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.h25
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp127
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.h19
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp166
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.h25
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp167
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.h28
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp87
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.h40
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp83
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.h34
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp543
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.h28
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp43
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.h18
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.cpp101
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp270
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.h27
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp371
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h24
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.cpp462
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.h21
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.cpp182
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.h38
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.cpp89
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.h30
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp144
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.h23
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp120
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.cpp411
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h32
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.cpp92
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h28
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.cpp699
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.h31
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp154
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.h28
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp92
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h19
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp110
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h20
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp226
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h27
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp84
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp90
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.h29
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp78
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.h26
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp129
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h23
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp299
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.h24
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp163
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.h25
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp74
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp193
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.h25
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp104
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.h30
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp287
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h25
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp126
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/BuiltIn_autogen.h1373
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.cpp32
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.h21
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.cpp54
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.h24
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp53
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.h23
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp204
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.h80
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.cpp291
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.h76
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp638
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.h322
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/NodeSearch.h56
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.cpp136
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.h21
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp64
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.h27
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp116
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.h23
-rw-r--r--gfx/angle/checkout/src/compiler/translator/tree_util/Visit.h22
-rw-r--r--gfx/angle/checkout/src/compiler/translator/util.cpp936
-rw-r--r--gfx/angle/checkout/src/compiler/translator/util.h92
-rw-r--r--gfx/angle/checkout/src/gpu_info_util/SystemInfo.cpp312
-rw-r--r--gfx/angle/checkout/src/gpu_info_util/SystemInfo.h115
-rw-r--r--gfx/angle/checkout/src/gpu_info_util/SystemInfo_internal.h38
-rw-r--r--gfx/angle/checkout/src/gpu_info_util/SystemInfo_win.cpp105
-rw-r--r--gfx/angle/checkout/src/image_util/copyimage.cpp22
-rw-r--r--gfx/angle/checkout/src/image_util/copyimage.h39
-rw-r--r--gfx/angle/checkout/src/image_util/copyimage.inc38
-rw-r--r--gfx/angle/checkout/src/image_util/generatemip.h34
-rw-r--r--gfx/angle/checkout/src/image_util/generatemip.inc268
-rw-r--r--gfx/angle/checkout/src/image_util/imageformats.cpp1835
-rw-r--r--gfx/angle/checkout/src/image_util/imageformats.h772
-rw-r--r--gfx/angle/checkout/src/image_util/loadimage.cpp1437
-rw-r--r--gfx/angle/checkout/src/image_util/loadimage.h738
-rw-r--r--gfx/angle/checkout/src/image_util/loadimage.inc164
-rw-r--r--gfx/angle/checkout/src/image_util/loadimage_etc.cpp1912
-rw-r--r--gfx/angle/checkout/src/libANGLE/AttributeMap.cpp108
-rw-r--r--gfx/angle/checkout/src/libANGLE/AttributeMap.h66
-rw-r--r--gfx/angle/checkout/src/libANGLE/BinaryStream.h255
-rw-r--r--gfx/angle/checkout/src/libANGLE/BlobCache.cpp168
-rw-r--r--gfx/angle/checkout/src/libANGLE/BlobCache.h153
-rw-r--r--gfx/angle/checkout/src/libANGLE/Buffer.cpp284
-rw-r--r--gfx/angle/checkout/src/libANGLE/Buffer.h155
-rw-r--r--gfx/angle/checkout/src/libANGLE/Caps.cpp1243
-rw-r--r--gfx/angle/checkout/src/libANGLE/Caps.h994
-rw-r--r--gfx/angle/checkout/src/libANGLE/Compiler.cpp294
-rw-r--r--gfx/angle/checkout/src/libANGLE/Compiler.h73
-rw-r--r--gfx/angle/checkout/src/libANGLE/Config.cpp394
-rw-r--r--gfx/angle/checkout/src/libANGLE/Config.h107
-rw-r--r--gfx/angle/checkout/src/libANGLE/Constants.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context.cpp8927
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context.h703
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context.inl.h135
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl.cpp3860
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_1_0_autogen.h254
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_1_1_autogen.h31
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_1_2_autogen.h15
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_1_3_autogen.h55
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_1_4_autogen.h55
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_1_5_autogen.h16
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_2_0_autogen.h44
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_2_1_autogen.h15
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_3_0_autogen.h40
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_3_1_autogen.h19
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_3_2_autogen.h30
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_3_3_autogen.h53
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_4_0_autogen.h66
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_4_1_autogen.h63
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_4_2_autogen.h28
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_4_3_autogen.h41
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_4_4_autogen.h28
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_4_5_autogen.h189
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gl_4_6_autogen.h23
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gles_1_0.cpp725
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gles_1_0_autogen.h109
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gles_2_0_autogen.h183
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gles_3_0_autogen.h159
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gles_3_1_autogen.h107
-rw-r--r--gfx/angle/checkout/src/libANGLE/Context_gles_ext_autogen.h412
-rw-r--r--gfx/angle/checkout/src/libANGLE/Debug.cpp473
-rw-r--r--gfx/angle/checkout/src/libANGLE/Debug.h165
-rw-r--r--gfx/angle/checkout/src/libANGLE/Device.cpp131
-rw-r--r--gfx/angle/checkout/src/libANGLE/Device.h60
-rw-r--r--gfx/angle/checkout/src/libANGLE/Display.cpp1580
-rw-r--r--gfx/angle/checkout/src/libANGLE/Display.h280
-rw-r--r--gfx/angle/checkout/src/libANGLE/EGLSync.cpp76
-rw-r--r--gfx/angle/checkout/src/libANGLE/EGLSync.h70
-rw-r--r--gfx/angle/checkout/src/libANGLE/Error.cpp67
-rw-r--r--gfx/angle/checkout/src/libANGLE/Error.h190
-rw-r--r--gfx/angle/checkout/src/libANGLE/Error.inc91
-rw-r--r--gfx/angle/checkout/src/libANGLE/ErrorStrings.h499
-rw-r--r--gfx/angle/checkout/src/libANGLE/Fence.cpp117
-rw-r--r--gfx/angle/checkout/src/libANGLE/Fence.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/FrameCapture.h166
-rw-r--r--gfx/angle/checkout/src/libANGLE/Framebuffer.cpp2383
-rw-r--r--gfx/angle/checkout/src/libANGLE/Framebuffer.h445
-rw-r--r--gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp317
-rw-r--r--gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h260
-rw-r--r--gfx/angle/checkout/src/libANGLE/GLES1Renderer.cpp884
-rw-r--r--gfx/angle/checkout/src/libANGLE/GLES1Renderer.h259
-rw-r--r--gfx/angle/checkout/src/libANGLE/GLES1Shaders.inc1110
-rw-r--r--gfx/angle/checkout/src/libANGLE/GLES1State.cpp576
-rw-r--r--gfx/angle/checkout/src/libANGLE/GLES1State.h331
-rw-r--r--gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp167
-rw-r--r--gfx/angle/checkout/src/libANGLE/HandleAllocator.h67
-rw-r--r--gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.cpp227
-rw-r--r--gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.h60
-rw-r--r--gfx/angle/checkout/src/libANGLE/Image.cpp443
-rw-r--r--gfx/angle/checkout/src/libANGLE/Image.h189
-rw-r--r--gfx/angle/checkout/src/libANGLE/ImageIndex.cpp365
-rw-r--r--gfx/angle/checkout/src/libANGLE/ImageIndex.h126
-rw-r--r--gfx/angle/checkout/src/libANGLE/IndexRangeCache.cpp116
-rw-r--r--gfx/angle/checkout/src/libANGLE/IndexRangeCache.h63
-rw-r--r--gfx/angle/checkout/src/libANGLE/LoggingAnnotator.cpp63
-rw-r--r--gfx/angle/checkout/src/libANGLE/LoggingAnnotator.h31
-rw-r--r--gfx/angle/checkout/src/libANGLE/MemoryObject.cpp36
-rw-r--r--gfx/angle/checkout/src/libANGLE/MemoryObject.h45
-rw-r--r--gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp256
-rw-r--r--gfx/angle/checkout/src/libANGLE/MemoryProgramCache.h91
-rw-r--r--gfx/angle/checkout/src/libANGLE/Observer.cpp101
-rw-r--r--gfx/angle/checkout/src/libANGLE/Observer.h138
-rw-r--r--gfx/angle/checkout/src/libANGLE/Path.cpp77
-rw-r--r--gfx/angle/checkout/src/libANGLE/Path.h71
-rw-r--r--gfx/angle/checkout/src/libANGLE/Platform.cpp65
-rw-r--r--gfx/angle/checkout/src/libANGLE/Program.cpp4966
-rw-r--r--gfx/angle/checkout/src/libANGLE/Program.h1070
-rw-r--r--gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp1331
-rw-r--r--gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h247
-rw-r--r--gfx/angle/checkout/src/libANGLE/ProgramPipeline.cpp57
-rw-r--r--gfx/angle/checkout/src/libANGLE/ProgramPipeline.h65
-rw-r--r--gfx/angle/checkout/src/libANGLE/Query.cpp86
-rw-r--r--gfx/angle/checkout/src/libANGLE/Query.h59
-rw-r--r--gfx/angle/checkout/src/libANGLE/RefCountObject.h262
-rw-r--r--gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp283
-rw-r--r--gfx/angle/checkout/src/libANGLE/Renderbuffer.h127
-rw-r--r--gfx/angle/checkout/src/libANGLE/ResourceManager.cpp579
-rw-r--r--gfx/angle/checkout/src/libANGLE/ResourceManager.h347
-rw-r--r--gfx/angle/checkout/src/libANGLE/ResourceMap.h319
-rw-r--r--gfx/angle/checkout/src/libANGLE/Sampler.cpp187
-rw-r--r--gfx/angle/checkout/src/libANGLE/Sampler.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/Semaphore.cpp47
-rw-r--r--gfx/angle/checkout/src/libANGLE/Semaphore.h56
-rw-r--r--gfx/angle/checkout/src/libANGLE/Shader.cpp682
-rw-r--r--gfx/angle/checkout/src/libANGLE/Shader.h227
-rw-r--r--gfx/angle/checkout/src/libANGLE/SizedMRUCache.h159
-rw-r--r--gfx/angle/checkout/src/libANGLE/State.cpp2870
-rw-r--r--gfx/angle/checkout/src/libANGLE/State.h906
-rw-r--r--gfx/angle/checkout/src/libANGLE/Stream.cpp282
-rw-r--r--gfx/angle/checkout/src/libANGLE/Stream.h149
-rw-r--r--gfx/angle/checkout/src/libANGLE/Surface.cpp584
-rw-r--r--gfx/angle/checkout/src/libANGLE/Surface.h289
-rw-r--r--gfx/angle/checkout/src/libANGLE/Texture.cpp1852
-rw-r--r--gfx/angle/checkout/src/libANGLE/Texture.h559
-rw-r--r--gfx/angle/checkout/src/libANGLE/Thread.cpp120
-rw-r--r--gfx/angle/checkout/src/libANGLE/Thread.h62
-rw-r--r--gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp322
-rw-r--r--gfx/angle/checkout/src/libANGLE/TransformFeedback.h119
-rw-r--r--gfx/angle/checkout/src/libANGLE/Uniform.cpp201
-rw-r--r--gfx/angle/checkout/src/libANGLE/Uniform.h133
-rw-r--r--gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp434
-rw-r--r--gfx/angle/checkout/src/libANGLE/VaryingPacking.h205
-rw-r--r--gfx/angle/checkout/src/libANGLE/Version.h34
-rw-r--r--gfx/angle/checkout/src/libANGLE/Version.inc59
-rw-r--r--gfx/angle/checkout/src/libANGLE/VertexArray.cpp686
-rw-r--r--gfx/angle/checkout/src/libANGLE/VertexArray.h383
-rw-r--r--gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp170
-rw-r--r--gfx/angle/checkout/src/libANGLE/VertexAttribute.h139
-rw-r--r--gfx/angle/checkout/src/libANGLE/VertexAttribute.inc58
-rw-r--r--gfx/angle/checkout/src/libANGLE/WorkerThread.cpp242
-rw-r--r--gfx/angle/checkout/src/libANGLE/WorkerThread.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/angletypes.cpp389
-rw-r--r--gfx/angle/checkout/src/libANGLE/angletypes.h692
-rw-r--r--gfx/angle/checkout/src/libANGLE/angletypes.inc35
-rw-r--r--gfx/angle/checkout/src/libANGLE/capture_gles_1_0_autogen.h603
-rw-r--r--gfx/angle/checkout/src/libANGLE/capture_gles_2_0_autogen.h1168
-rw-r--r--gfx/angle/checkout/src/libANGLE/capture_gles_3_0_autogen.h1058
-rw-r--r--gfx/angle/checkout/src/libANGLE/capture_gles_3_1_autogen.h725
-rw-r--r--gfx/angle/checkout/src/libANGLE/capture_gles_ext_autogen.h3681
-rw-r--r--gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h1366
-rw-r--r--gfx/angle/checkout/src/libANGLE/entry_points_utils.h95
-rw-r--r--gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp171
-rw-r--r--gfx/angle/checkout/src/libANGLE/features.h60
-rw-r--r--gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp1610
-rw-r--r--gfx/angle/checkout/src/libANGLE/formatutils.cpp2294
-rw-r--r--gfx/angle/checkout/src/libANGLE/formatutils.h303
-rw-r--r--gfx/angle/checkout/src/libANGLE/frame_capture_utils_autogen.h953
-rw-r--r--gfx/angle/checkout/src/libANGLE/histogram_macros.h110
-rw-r--r--gfx/angle/checkout/src/libANGLE/queryconversions.cpp300
-rw-r--r--gfx/angle/checkout/src/libANGLE/queryconversions.h138
-rw-r--r--gfx/angle/checkout/src/libANGLE/queryutils.cpp3070
-rw-r--r--gfx/angle/checkout/src/libANGLE/queryutils.h248
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h82
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/CompilerImpl.h32
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.cpp138
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.h207
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.cpp18
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.h38
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.cpp66
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.h123
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/EGLImplFactory.h99
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/EGLSyncImpl.h55
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/FenceNVImpl.h37
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/Format.h214
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/FormatID_autogen.h223
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp639
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h61
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/GLImplFactory.h103
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/ImageImpl.h62
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/MemoryObjectImpl.h40
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/PathImpl.h36
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h180
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/ProgramPipelineImpl.h32
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.cpp16
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.h47
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/RenderTargetCache.h162
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/RenderbufferImpl.h63
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/SamplerImpl.h39
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/SemaphoreImpl.h46
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.cpp94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.h75
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/StreamProducerImpl.h40
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.cpp96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.h105
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/SyncImpl.h45
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp111
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h197
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/TransformFeedbackImpl.h39
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h62
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/copyvertex.h57
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/copyvertex.inc.h479
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp191
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.cpp24
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.h32
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ContextD3D.h24
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.cpp82
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.h37
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.cpp414
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.h110
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp1435
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h205
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp920
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.h39
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.h55
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp433
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h139
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.cpp389
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.h74
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp56
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.cpp183
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.h125
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp318
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h112
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp19
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.h38
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp3206
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h580
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp31
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h44
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp117
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.h60
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp250
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h440
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/SamplerD3D.h25
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp351
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.h111
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp67
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h57
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.cpp488
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.h139
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.cpp34
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.h83
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp4213
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h909
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp293
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h186
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp674
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h160
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp1944
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.h300
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11Helper_autogen.inc1575
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp1677
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h200
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp804
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.h102
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp684
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h190
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h40
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp151
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.h59
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp234
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.h75
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp424
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp674
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h127
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp160
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h58
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp313
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h123
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.cpp119
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h63
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h38
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp270
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.cpp34
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.h28
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp21
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h27
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.cpp357
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.h71
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp284
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h123
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp394
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h127
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp3987
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h626
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp552
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h381
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp116
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h64
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp3940
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h640
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.cpp162
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.h44
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp1085
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h133
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp3680
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h827
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp131
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h61
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp103
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.h43
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp364
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp167
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h65
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp437
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h115
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp516
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h43
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table_autogen.cpp3042
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp1021
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.h72
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp2612
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h455
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h85
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h115
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h69
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h69
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h150
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11_fl9vs.h75
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewgs.h88
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewvs.h85
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11vs.h72
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/cleardepth11ps.h79
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h133
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps1.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps2.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps3.h102
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps4.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps5.h114
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps6.h120
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps7.h127
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps8.h133
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps1.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps2.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps3.h102
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps4.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps5.h114
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps6.h120
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps7.h127
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps8.h133
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps1.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps2.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps3.h102
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps4.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps5.h114
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps6.h120
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps7.h127
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps8.h133
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2d_ps.h81
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2darray_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_3d_ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2d_ps.h81
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2darray_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_3d_ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2d_ps.h81
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2darray_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_3d_ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2d_ps.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2darray_ps.h99
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_3d_ps.h93
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2d_ps.h81
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2darray_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_3d_ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2d_ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2darray_ps.h97
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_3d_ps.h91
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2d_ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2darray_ps.h97
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_3d_ps.h91
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2d_ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2darray_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_3d_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2d_ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2darray_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_3d_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2d_ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2darray_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_3d_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2d_ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2darray_ps.h104
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_3d_ps.h98
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2d_ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2darray_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_3d_ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2d_ps.h92
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2darray_ps.h102
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_3d_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2d_ps.h92
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2darray_ps.h102
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_3d_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_2darray_ps.h98
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_3d_ps.h92
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_2darray_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_3d_ps.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_2darray_ps.h95
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_3d_ps.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_2darray_ps.h93
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_3d_ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_2darray_ps.h103
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_3d_ps.h97
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_2darray_ps.h101
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_3d_ps.h95
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2d_ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2darray_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_3d_ps.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2d_ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2darray_ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_3d_ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2d_ps.h83
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2darray_ps.h93
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_3d_ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2d_ps.h81
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2darray_ps.h91
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_3d_ps.h85
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2d_ps.h91
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2darray_ps.h101
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_3d_ps.h95
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2d_ps.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2darray_ps.h99
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_3d_ps.h93
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h95
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h79
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrougha2d11ps.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h78
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h107
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2darray11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h103
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2darray11ps.h88
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h82
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darray11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayi11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayui11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darray11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayi11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayui11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h107
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d_565_11ps.h123
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray_565_11ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayi11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayui11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h87
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d_565_11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h98
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_4444_11ps.h117
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_5551_11ps.h117
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray11ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_4444_11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_5551_11ps.h94
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayi11ps.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayui11ps.h89
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h83
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h80
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h83
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h78
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_4444_11ps.h88
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_5551_11ps.h88
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvecolor2dps.h107
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepth11_ps.h86
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_ps.h96
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_vs.h88
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvestencil11_ps.h88
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h140
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h130
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h134
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h144
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h137
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h140
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h144
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h137
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h140
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp35
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h108
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp2448
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h90
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp218
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h53
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp760
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h166
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp141
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.h63
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp369
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.h177
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp43
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h33
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp73
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.h38
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp408
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h85
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp792
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h112
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp161
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h57
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp37
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h35
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.cpp176
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.h50
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp160
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h98
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp3239
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h580
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h110
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp51
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h35
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp938
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.h209
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp472
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h80
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp523
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h164
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h57
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp153
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h56
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp262
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h68
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp872
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.h93
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp826
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h105
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h50
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h48
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h54
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h50
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h53
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h54
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h37
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h46
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h197
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/d3d/formatutilsD3D.h24
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/driver_utils.cpp209
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/driver_utils.h162
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/load_functions_table.h20
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp4118
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp803
-rw-r--r--gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h406
-rw-r--r--gfx/angle/checkout/src/libANGLE/trace.h24
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationEGL.cpp3933
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationEGL.h356
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES.cpp6600
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES.h956
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES1.cpp1631
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES1.h20
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES1_autogen.h214
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES2.cpp7187
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES2.h176
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES2_autogen.h356
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES3.cpp4330
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES3.h36
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES31.cpp1935
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES31.h20
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES31_autogen.h298
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationES3_autogen.h355
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationESEXT.h20
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationESEXT_autogen.h1271
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL1.cpp1279
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL11.cpp105
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL11_autogen.h64
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL12.cpp12
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL12_autogen.h22
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL13.cpp228
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL13_autogen.h84
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL14.cpp237
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL14_autogen.h77
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL15.cpp33
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL15_autogen.h29
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL1_autogen.h348
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL2.cpp174
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL21.cpp12
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL21_autogen.h22
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL2_autogen.h66
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL3.cpp194
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL31.cpp34
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL31_autogen.h30
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL32.cpp95
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL32_autogen.h71
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL33.cpp288
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL33_autogen.h126
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL3_autogen.h83
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL4.cpp287
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL41.cpp295
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL41_autogen.h155
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL42.cpp82
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL42_autogen.h62
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL43.cpp263
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL43_autogen.h167
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL44.cpp97
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL44_autogen.h69
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL45.cpp1032
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL45_autogen.h562
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL46.cpp50
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL46_autogen.h42
-rw-r--r--gfx/angle/checkout/src/libANGLE/validationGL4_autogen.h143
-rw-r--r--gfx/angle/checkout/src/libEGL/egl_loader_autogen.cpp261
-rw-r--r--gfx/angle/checkout/src/libEGL/egl_loader_autogen.h118
-rw-r--r--gfx/angle/checkout/src/libEGL/libEGL.cpp709
-rw-r--r--gfx/angle/checkout/src/libEGL/libEGL.def88
-rw-r--r--gfx/angle/checkout/src/libEGL/libEGL.rc103
-rw-r--r--gfx/angle/checkout/src/libEGL/resource.h14
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp1096
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_egl.h136
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.cpp1480
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.h222
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp1429
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h122
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp2503
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h297
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp2005
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.h284
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp1380
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.h227
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp19759
-rw-r--r--gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h3874
-rw-r--r--gfx/angle/checkout/src/libGLESv2/global_state.cpp225
-rw-r--r--gfx/angle/checkout/src/libGLESv2/global_state.h61
-rw-r--r--gfx/angle/checkout/src/libGLESv2/libGLESv2.rc103
-rw-r--r--gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.cpp9775
-rw-r--r--gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.def1572
-rw-r--r--gfx/angle/checkout/src/libGLESv2/proc_table_egl.h25
-rw-r--r--gfx/angle/checkout/src/libGLESv2/proc_table_egl_autogen.cpp1495
-rw-r--r--gfx/angle/checkout/src/libGLESv2/resource.h14
-rw-r--r--gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp112
-rw-r--r--gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.h63
-rw-r--r--gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.cpp67
-rw-r--r--gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.h36
-rw-r--r--gfx/angle/checkout/src/third_party/trace_event/trace_event.h775
-rw-r--r--gfx/angle/cherry_picks.txt210
-rw-r--r--gfx/angle/moz.build16
-rw-r--r--gfx/angle/moz.build.common13
-rw-r--r--gfx/angle/targets/angle_common/moz.build206
-rw-r--r--gfx/angle/targets/angle_gpu_info_util/moz.build186
-rw-r--r--gfx/angle/targets/angle_image_util/moz.build177
-rw-r--r--gfx/angle/targets/libEGL/moz.build222
-rw-r--r--gfx/angle/targets/libGLESv2/moz.build413
-rw-r--r--gfx/angle/targets/preprocessor/moz.build184
-rw-r--r--gfx/angle/targets/translator/moz.build303
-rwxr-xr-xgfx/angle/update-angle.py648
-rw-r--r--gfx/angle/vendor_from_git.py67
1048 files changed, 407124 insertions, 0 deletions
diff --git a/gfx/angle/MERGE_BASE b/gfx/angle/MERGE_BASE
new file mode 100644
index 0000000000..f24d87dca0
--- /dev/null
+++ b/gfx/angle/MERGE_BASE
@@ -0,0 +1 @@
+chromium/3865
diff --git a/gfx/angle/checkout/include/EGL/egl.h b/gfx/angle/checkout/include/EGL/egl.h
new file mode 100644
index 0000000000..6a196616f5
--- /dev/null
+++ b/gfx/angle/checkout/include/EGL/egl.h
@@ -0,0 +1,361 @@
+#ifndef __egl_h_
+#define __egl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 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.
+*/
+/*
+** This header is generated from the Khronos EGL XML API Registry.
+** The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.khronos.org/registry/egl
+**
+** Khronos $Git commit SHA1: d738c39fe2 $ on $Git commit date: 2019-06-14 16:17:31 -0600 $
+*/
+
+#include <EGL/eglplatform.h>
+
+#ifndef EGL_EGL_PROTOTYPES
+#define EGL_EGL_PROTOTYPES 1
+#endif
+
+/* Generated on date 20190716 */
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
+typedef unsigned int EGLBoolean;
+typedef void *EGLDisplay;
+#include <EGL/eglplatform.h>
+#include <KHR/khrplatform.h>
+typedef void *EGLConfig;
+typedef void *EGLSurface;
+typedef void *EGLContext;
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
+#define EGL_DRAW 0x3059
+#define EGL_EXTENSIONS 0x3055
+#define EGL_FALSE 0
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_HEIGHT 0x3056
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_NONE 0x3038
+#define EGL_NON_CONFORMANT_CONFIG 0x3051
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
+#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
+#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
+#define EGL_PBUFFER_BIT 0x0001
+#define EGL_PIXMAP_BIT 0x0002
+#define EGL_READ 0x305A
+#define EGL_RED_SIZE 0x3024
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SLOW_CONFIG 0x3050
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_SUCCESS 0x3000
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_TRANSPARENT_RGB 0x3052
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRUE 1
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_WIDTH 0x3057
+#define EGL_WINDOW_BIT 0x0004
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+typedef EGLContext (EGLAPIENTRYP PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERSURFACEPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGSPROC) (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETCURRENTDISPLAYPROC) (void);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLGETCURRENTSURFACEPROC) (EGLint readdraw);
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDISPLAYPROC) (EGLNativeDisplayType display_id);
+typedef EGLint (EGLAPIENTRYP PFNEGLGETERRORPROC) (void);
+typedef __eglMustCastToProperFunctionPointerType (EGLAPIENTRYP PFNEGLGETPROCADDRESSPROC) (const char *procname);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLTERMINATEPROC) (EGLDisplay dpy);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITGLPROC) (void);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITNATIVEPROC) (EGLint engine);
+#if EGL_EGL_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
+EGLAPI EGLint EGLAPIENTRY eglGetError (void);
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
+#endif
+#endif /* EGL_VERSION_1_0 */
+
+#ifndef EGL_VERSION_1_1
+#define EGL_VERSION_1_1 1
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_CONTEXT_LOST 0x300E
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_2D 0x305F
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_TARGET 0x3081
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDTEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSURFACEATTRIBPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval);
+#if EGL_EGL_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
+#endif
+#endif /* EGL_VERSION_1_1 */
+
+#ifndef EGL_VERSION_1_2
+#define EGL_VERSION_1_2 1
+typedef unsigned int EGLenum;
+typedef void *EGLClientBuffer;
+#define EGL_ALPHA_FORMAT 0x3088
+#define EGL_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_ALPHA_FORMAT_PRE 0x308C
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_BUFFER_PRESERVED 0x3094
+#define EGL_BUFFER_DESTROYED 0x3095
+#define EGL_CLIENT_APIS 0x308D
+#define EGL_COLORSPACE 0x3087
+#define EGL_COLORSPACE_sRGB 0x3089
+#define EGL_COLORSPACE_LINEAR 0x308A
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+#define EGL_DISPLAY_SCALING 10000
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_LUMINANCE_BUFFER 0x308F
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_OPENGL_ES_BIT 0x0001
+#define EGL_OPENVG_BIT 0x0002
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENVG_IMAGE 0x3096
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_RGB_BUFFER 0x308E
+#define EGL_SINGLE_BUFFER 0x3085
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
+#define EGL_VERTICAL_RESOLUTION 0x3091
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDAPIPROC) (EGLenum api);
+typedef EGLenum (EGLAPIENTRYP PFNEGLQUERYAPIPROC) (void);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETHREADPROC) (void);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITCLIENTPROC) (void);
+#if EGL_EGL_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
+#endif
+#endif /* EGL_VERSION_1_2 */
+
+#ifndef EGL_VERSION_1_3
+#define EGL_VERSION_1_3 1
+#define EGL_CONFORMANT 0x3042
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041
+#define EGL_OPENGL_ES2_BIT 0x0004
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_COLORSPACE_sRGB 0x3089
+#define EGL_VG_COLORSPACE_LINEAR 0x308A
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
+#endif /* EGL_VERSION_1_3 */
+
+#ifndef EGL_VERSION_1_4
+#define EGL_VERSION_1_4 1
+#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
+#define EGL_OPENGL_API 0x30A2
+#define EGL_OPENGL_BIT 0x0008
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
+typedef EGLContext (EGLAPIENTRYP PFNEGLGETCURRENTCONTEXTPROC) (void);
+#if EGL_EGL_PROTOTYPES
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
+#endif
+#endif /* EGL_VERSION_1_4 */
+
+#ifndef EGL_VERSION_1_5
+#define EGL_VERSION_1_5 1
+typedef void *EGLSync;
+typedef intptr_t EGLAttrib;
+typedef khronos_utime_nanoseconds_t EGLTime;
+typedef void *EGLImage;
+#define EGL_CONTEXT_MAJOR_VERSION 0x3098
+#define EGL_CONTEXT_MINOR_VERSION 0x30FB
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
+#define EGL_NO_RESET_NOTIFICATION 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
+#define EGL_OPENGL_ES3_BIT 0x00000040
+#define EGL_CL_EVENT_HANDLE 0x309C
+#define EGL_SYNC_CL_EVENT 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
+#define EGL_SYNC_TYPE 0x30F7
+#define EGL_SYNC_STATUS 0x30F1
+#define EGL_SYNC_CONDITION 0x30F8
+#define EGL_SIGNALED 0x30F2
+#define EGL_UNSIGNALED 0x30F3
+#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
+#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
+#define EGL_TIMEOUT_EXPIRED 0x30F5
+#define EGL_CONDITION_SATISFIED 0x30F6
+#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
+#define EGL_SYNC_FENCE 0x30F9
+#define EGL_GL_COLORSPACE 0x309D
+#define EGL_GL_COLORSPACE_SRGB 0x3089
+#define EGL_GL_COLORSPACE_LINEAR 0x308A
+#define EGL_GL_RENDERBUFFER 0x30B9
+#define EGL_GL_TEXTURE_2D 0x30B1
+#define EGL_GL_TEXTURE_LEVEL 0x30BC
+#define EGL_GL_TEXTURE_3D 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
+#define EGL_IMAGE_PRESERVED 0x30D2
+#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
+typedef EGLSync (EGLAPIENTRYP PFNEGLCREATESYNCPROC) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCPROC) (EGLDisplay dpy, EGLSync sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBPROC) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+typedef EGLImage (EGLAPIENTRYP PFNEGLCREATEIMAGEPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC) (EGLDisplay dpy, EGLImage image);
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags);
+#if EGL_EGL_PROTOTYPES
+EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
+#endif
+#endif /* EGL_VERSION_1_5 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/EGL/eglext.h b/gfx/angle/checkout/include/EGL/eglext.h
new file mode 100644
index 0000000000..87e9d90ca3
--- /dev/null
+++ b/gfx/angle/checkout/include/EGL/eglext.h
@@ -0,0 +1,1321 @@
+#ifndef __eglext_h_
+#define __eglext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.khronos.org/registry/egl
+**
+** Khronos $Git commit SHA1: bae3518c48 $ on $Git commit date: 2018-05-17 10:56:57 -0700 $
+*/
+
+#include <EGL/eglplatform.h>
+
+#define EGL_EGLEXT_VERSION 20180517
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: egl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_KHR_cl_event
+#define EGL_KHR_cl_event 1
+#define EGL_CL_EVENT_HANDLE_KHR 0x309C
+#define EGL_SYNC_CL_EVENT_KHR 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
+#endif /* EGL_KHR_cl_event */
+
+#ifndef EGL_KHR_cl_event2
+#define EGL_KHR_cl_event2 1
+typedef void *EGLSyncKHR;
+typedef intptr_t EGLAttribKHR;
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#endif
+#endif /* EGL_KHR_cl_event2 */
+
+#ifndef EGL_KHR_client_get_all_proc_addresses
+#define EGL_KHR_client_get_all_proc_addresses 1
+#endif /* EGL_KHR_client_get_all_proc_addresses */
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
+#endif /* EGL_KHR_config_attribs */
+
+#ifndef EGL_KHR_context_flush_control
+#define EGL_KHR_context_flush_control 1
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
+#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
+#endif /* EGL_KHR_context_flush_control */
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#endif /* EGL_KHR_create_context */
+
+#ifndef EGL_KHR_create_context_no_error
+#define EGL_KHR_create_context_no_error 1
+#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
+#endif /* EGL_KHR_create_context_no_error */
+
+#ifndef EGL_KHR_debug
+#define EGL_KHR_debug 1
+typedef void *EGLLabelKHR;
+typedef void *EGLObjectKHR;
+typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
+#define EGL_OBJECT_THREAD_KHR 0x33B0
+#define EGL_OBJECT_DISPLAY_KHR 0x33B1
+#define EGL_OBJECT_CONTEXT_KHR 0x33B2
+#define EGL_OBJECT_SURFACE_KHR 0x33B3
+#define EGL_OBJECT_IMAGE_KHR 0x33B4
+#define EGL_OBJECT_SYNC_KHR 0x33B5
+#define EGL_OBJECT_STREAM_KHR 0x33B6
+#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9
+#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA
+#define EGL_DEBUG_MSG_WARN_KHR 0x33BB
+#define EGL_DEBUG_MSG_INFO_KHR 0x33BC
+#define EGL_DEBUG_CALLBACK_KHR 0x33B8
+typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value);
+typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value);
+EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
+#endif
+#endif /* EGL_KHR_debug */
+
+#ifndef EGL_KHR_display_reference
+#define EGL_KHR_display_reference 1
+#define EGL_TRACK_REFERENCES_KHR 0x3352
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value);
+#endif
+#endif /* EGL_KHR_display_reference */
+
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SYNC_FENCE_KHR 0x30F9
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_fence_sync */
+
+#ifndef EGL_KHR_get_all_proc_addresses
+#define EGL_KHR_get_all_proc_addresses 1
+#endif /* EGL_KHR_get_all_proc_addresses */
+
+#ifndef EGL_KHR_gl_colorspace
+#define EGL_KHR_gl_colorspace 1
+#define EGL_GL_COLORSPACE_KHR 0x309D
+#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
+#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
+#endif /* EGL_KHR_gl_colorspace */
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9
+#endif /* EGL_KHR_gl_renderbuffer_image */
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
+#endif /* EGL_KHR_gl_texture_2D_image */
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
+#endif /* EGL_KHR_gl_texture_3D_image */
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#endif /* EGL_KHR_gl_texture_cubemap_image */
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+typedef void *EGLImageKHR;
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0)
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif
+#endif /* EGL_KHR_image */
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#endif /* EGL_KHR_image_base */
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+#endif /* EGL_KHR_image_pixmap */
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
+#define EGL_MATCH_FORMAT_KHR 0x3043
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
+#define EGL_FORMAT_RGB_565_KHR 0x30C1
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
+#define EGL_BITMAP_POINTER_KHR 0x30C6
+#define EGL_BITMAP_PITCH_KHR 0x30C7
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
+#define EGL_LOWER_LEFT_KHR 0x30CE
+#define EGL_UPPER_LEFT_KHR 0x30CF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
+#endif
+#endif /* EGL_KHR_lock_surface */
+
+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
+#endif /* EGL_KHR_lock_surface2 */
+
+#ifndef EGL_KHR_lock_surface3
+#define EGL_KHR_lock_surface3 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#endif
+#endif /* EGL_KHR_lock_surface3 */
+
+#ifndef EGL_KHR_mutable_render_buffer
+#define EGL_KHR_mutable_render_buffer 1
+#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000
+#endif /* EGL_KHR_mutable_render_buffer */
+
+#ifndef EGL_KHR_no_config_context
+#define EGL_KHR_no_config_context 1
+#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0)
+#endif /* EGL_KHR_no_config_context */
+
+#ifndef EGL_KHR_partial_update
+#define EGL_KHR_partial_update 1
+#define EGL_BUFFER_AGE_KHR 0x313D
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_partial_update */
+
+#ifndef EGL_KHR_platform_android
+#define EGL_KHR_platform_android 1
+#define EGL_PLATFORM_ANDROID_KHR 0x3141
+#endif /* EGL_KHR_platform_android */
+
+#ifndef EGL_KHR_platform_gbm
+#define EGL_KHR_platform_gbm 1
+#define EGL_PLATFORM_GBM_KHR 0x31D7
+#endif /* EGL_KHR_platform_gbm */
+
+#ifndef EGL_KHR_platform_wayland
+#define EGL_KHR_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
+#endif /* EGL_KHR_platform_wayland */
+
+#ifndef EGL_KHR_platform_x11
+#define EGL_KHR_platform_x11 1
+#define EGL_PLATFORM_X11_KHR 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
+#endif /* EGL_KHR_platform_x11 */
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0)
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_reusable_sync */
+
+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void *EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
+#define EGL_PRODUCER_FRAME_KHR 0x3212
+#define EGL_CONSUMER_FRAME_KHR 0x3213
+#define EGL_STREAM_STATE_KHR 0x3214
+#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR 0x321B
+#define EGL_BAD_STATE_KHR 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream */
+
+#ifndef EGL_KHR_stream_attrib
+#define EGL_KHR_stream_attrib 1
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream_attrib */
+
+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#ifdef EGL_KHR_stream
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_consumer_gltexture */
+
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#ifdef EGL_KHR_stream
+#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1)
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_cross_process_fd */
+
+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#define EGL_STREAM_TIME_NOW_KHR 0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_fifo */
+
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#ifdef EGL_KHR_stream
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_aldatalocator */
+
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_BIT_KHR 0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_eglsurface */
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+#endif /* EGL_KHR_surfaceless_context */
+
+#ifndef EGL_KHR_swap_buffers_with_damage
+#define EGL_KHR_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_swap_buffers_with_damage */
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
+#endif /* EGL_KHR_vg_parent_image */
+
+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+#endif /* EGL_KHR_wait_sync */
+
+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+#endif /* EGL_ANDROID_blob_cache */
+
+#ifndef EGL_ANDROID_create_native_client_buffer
+#define EGL_ANDROID_create_native_client_buffer 1
+#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143
+#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001
+#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002
+#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004
+typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list);
+#endif
+#endif /* EGL_ANDROID_create_native_client_buffer */
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+#endif /* EGL_ANDROID_framebuffer_target */
+
+#ifndef EGL_ANDROID_front_buffer_auto_refresh
+#define EGL_ANDROID_front_buffer_auto_refresh 1
+#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C
+#endif /* EGL_ANDROID_front_buffer_auto_refresh */
+
+#ifndef EGL_ANDROID_get_frame_timestamps
+#define EGL_ANDROID_get_frame_timestamps 1
+typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
+#define EGL_TIMESTAMP_PENDING_ANDROID EGL_CAST(EGLnsecsANDROID,-2)
+#define EGL_TIMESTAMP_INVALID_ANDROID EGL_CAST(EGLnsecsANDROID,-1)
+#define EGL_TIMESTAMPS_ANDROID 0x3430
+#define EGL_COMPOSITE_DEADLINE_ANDROID 0x3431
+#define EGL_COMPOSITE_INTERVAL_ANDROID 0x3432
+#define EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID 0x3433
+#define EGL_REQUESTED_PRESENT_TIME_ANDROID 0x3434
+#define EGL_RENDERING_COMPLETE_TIME_ANDROID 0x3435
+#define EGL_COMPOSITION_LATCH_TIME_ANDROID 0x3436
+#define EGL_FIRST_COMPOSITION_START_TIME_ANDROID 0x3437
+#define EGL_LAST_COMPOSITION_START_TIME_ANDROID 0x3438
+#define EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID 0x3439
+#define EGL_DISPLAY_PRESENT_TIME_ANDROID 0x343A
+#define EGL_DEQUEUE_READY_TIME_ANDROID 0x343B
+#define EGL_READS_DONE_TIME_ANDROID 0x343C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCOMPOSITORTIMINGANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint *names, EGLnsecsANDROID *values);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETNEXTFRAMEIDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *frameId);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint timestamp);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETFRAMETIMESTAMPSANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, EGLint numTimestamps, const EGLint *timestamps, EGLnsecsANDROID *values);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglGetCompositorTimingSupportedANDROID (EGLDisplay dpy, EGLSurface surface, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetCompositorTimingANDROID (EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint *names, EGLnsecsANDROID *values);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetNextFrameIdANDROID (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *frameId);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetFrameTimestampSupportedANDROID (EGLDisplay dpy, EGLSurface surface, EGLint timestamp);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetFrameTimestampsANDROID (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, EGLint numTimestamps, const EGLint *timestamps, EGLnsecsANDROID *values);
+#endif
+#endif /* EGL_ANDROID_get_frame_timestamps */
+
+#ifndef EGL_ANDROID_get_native_client_buffer
+#define EGL_ANDROID_get_native_client_buffer 1
+struct AHardwareBuffer;
+typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC) (const struct AHardwareBuffer *buffer);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLClientBuffer EGLAPIENTRY eglGetNativeClientBufferANDROID (const struct AHardwareBuffer *buffer);
+#endif
+#endif /* EGL_ANDROID_get_native_client_buffer */
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#endif /* EGL_ANDROID_image_native_buffer */
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
+#endif
+#endif /* EGL_ANDROID_native_fence_sync */
+
+#ifndef EGL_ANDROID_presentation_time
+#define EGL_ANDROID_presentation_time 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
+#endif
+#endif /* EGL_ANDROID_presentation_time */
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID 0x3142
+#endif /* EGL_ANDROID_recordable */
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
+
+#ifndef EGL_ANGLE_device_d3d
+#define EGL_ANGLE_device_d3d 1
+#define EGL_D3D9_DEVICE_ANGLE 0x33A0
+#define EGL_D3D11_DEVICE_ANGLE 0x33A1
+#endif /* EGL_ANGLE_device_d3d */
+
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+#endif /* EGL_ANGLE_query_surface_pointer */
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
+
+#ifndef EGL_ANGLE_window_fixed_size
+#define EGL_ANGLE_window_fixed_size 1
+#define EGL_FIXED_SIZE_ANGLE 0x3201
+#endif /* EGL_ANGLE_window_fixed_size */
+
+#ifndef EGL_ARM_implicit_external_sync
+#define EGL_ARM_implicit_external_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A
+#endif /* EGL_ARM_implicit_external_sync */
+
+#ifndef EGL_ARM_pixmap_multisample_discard
+#define EGL_ARM_pixmap_multisample_discard 1
+#define EGL_DISCARD_SAMPLES_ARM 0x3286
+#endif /* EGL_ARM_pixmap_multisample_discard */
+
+#ifndef EGL_EXT_bind_to_front
+#define EGL_EXT_bind_to_front 1
+#define EGL_FRONT_BUFFER_EXT 0x3464
+#endif /* EGL_EXT_bind_to_front */
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif /* EGL_EXT_buffer_age */
+
+#ifndef EGL_EXT_client_extensions
+#define EGL_EXT_client_extensions 1
+#endif /* EGL_EXT_client_extensions */
+
+#ifndef EGL_EXT_client_sync
+#define EGL_EXT_client_sync 1
+#define EGL_SYNC_CLIENT_EXT 0x3364
+#define EGL_SYNC_CLIENT_SIGNAL_EXT 0x3365
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCLIENTSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglClientSignalSyncEXT (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
+#endif
+#endif /* EGL_EXT_client_sync */
+
+#ifndef EGL_EXT_compositor
+#define EGL_EXT_compositor 1
+#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460
+#define EGL_EXTERNAL_REF_ID_EXT 0x3461
+#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462
+#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height);
+EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy);
+#endif
+#endif /* EGL_EXT_compositor */
+
+#ifndef EGL_EXT_create_context_robustness
+#define EGL_EXT_create_context_robustness 1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
+#endif /* EGL_EXT_create_context_robustness */
+
+#ifndef EGL_EXT_device_base
+#define EGL_EXT_device_base 1
+typedef void *EGLDeviceEXT;
+#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0)
+#define EGL_BAD_DEVICE_EXT 0x322B
+#define EGL_DEVICE_EXT 0x322C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#endif
+#endif /* EGL_EXT_device_base */
+
+#ifndef EGL_EXT_device_drm
+#define EGL_EXT_device_drm 1
+#define EGL_DRM_DEVICE_FILE_EXT 0x3233
+#endif /* EGL_EXT_device_drm */
+
+#ifndef EGL_EXT_device_enumeration
+#define EGL_EXT_device_enumeration 1
+#endif /* EGL_EXT_device_enumeration */
+
+#ifndef EGL_EXT_device_openwf
+#define EGL_EXT_device_openwf 1
+#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
+#endif /* EGL_EXT_device_openwf */
+
+#ifndef EGL_EXT_device_query
+#define EGL_EXT_device_query 1
+#endif /* EGL_EXT_device_query */
+
+#ifndef EGL_EXT_gl_colorspace_bt2020_linear
+#define EGL_EXT_gl_colorspace_bt2020_linear 1
+#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F
+#endif /* EGL_EXT_gl_colorspace_bt2020_linear */
+
+#ifndef EGL_EXT_gl_colorspace_bt2020_pq
+#define EGL_EXT_gl_colorspace_bt2020_pq 1
+#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340
+#endif /* EGL_EXT_gl_colorspace_bt2020_pq */
+
+#ifndef EGL_EXT_gl_colorspace_display_p3
+#define EGL_EXT_gl_colorspace_display_p3 1
+#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363
+#endif /* EGL_EXT_gl_colorspace_display_p3 */
+
+#ifndef EGL_EXT_gl_colorspace_display_p3_linear
+#define EGL_EXT_gl_colorspace_display_p3_linear 1
+#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362
+#endif /* EGL_EXT_gl_colorspace_display_p3_linear */
+
+#ifndef EGL_EXT_gl_colorspace_scrgb
+#define EGL_EXT_gl_colorspace_scrgb 1
+#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351
+#endif /* EGL_EXT_gl_colorspace_scrgb */
+
+#ifndef EGL_EXT_gl_colorspace_scrgb_linear
+#define EGL_EXT_gl_colorspace_scrgb_linear 1
+#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350
+#endif /* EGL_EXT_gl_colorspace_scrgb_linear */
+
+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT 0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT 0x327F
+#define EGL_ITU_REC709_EXT 0x3280
+#define EGL_ITU_REC2020_EXT 0x3281
+#define EGL_YUV_FULL_RANGE_EXT 0x3282
+#define EGL_YUV_NARROW_RANGE_EXT 0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
+#endif /* EGL_EXT_image_dma_buf_import */
+
+#ifndef EGL_EXT_image_dma_buf_import_modifiers
+#define EGL_EXT_image_dma_buf_import_modifiers 1
+#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
+#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
+#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442
+#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
+#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
+#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
+#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
+#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
+#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
+#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
+#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
+#endif
+#endif /* EGL_EXT_image_dma_buf_import_modifiers */
+
+#ifndef EGL_EXT_image_gl_colorspace
+#define EGL_EXT_image_gl_colorspace 1
+#define EGL_GL_COLORSPACE_DEFAULT_EXT 0x314D
+#endif /* EGL_EXT_image_gl_colorspace */
+
+#ifndef EGL_EXT_image_implicit_sync_control
+#define EGL_EXT_image_implicit_sync_control 1
+#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470
+#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471
+#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472
+#endif /* EGL_EXT_image_implicit_sync_control */
+
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
+#endif /* EGL_EXT_multiview_window */
+
+#ifndef EGL_EXT_output_base
+#define EGL_EXT_output_base 1
+typedef void *EGLOutputLayerEXT;
+typedef void *EGLOutputPortEXT;
+#define EGL_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0)
+#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0)
+#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
+#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
+#define EGL_SWAP_INTERVAL_EXT 0x322F
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#endif
+#endif /* EGL_EXT_output_base */
+
+#ifndef EGL_EXT_output_drm
+#define EGL_EXT_output_drm 1
+#define EGL_DRM_CRTC_EXT 0x3234
+#define EGL_DRM_PLANE_EXT 0x3235
+#define EGL_DRM_CONNECTOR_EXT 0x3236
+#endif /* EGL_EXT_output_drm */
+
+#ifndef EGL_EXT_output_openwf
+#define EGL_EXT_output_openwf 1
+#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
+#define EGL_OPENWF_PORT_ID_EXT 0x3239
+#endif /* EGL_EXT_output_openwf */
+
+#ifndef EGL_EXT_pixel_format_float
+#define EGL_EXT_pixel_format_float 1
+#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339
+#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A
+#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B
+#endif /* EGL_EXT_pixel_format_float */
+
+#ifndef EGL_EXT_platform_base
+#define EGL_EXT_platform_base 1
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#endif
+#endif /* EGL_EXT_platform_base */
+
+#ifndef EGL_EXT_platform_device
+#define EGL_EXT_platform_device 1
+#define EGL_PLATFORM_DEVICE_EXT 0x313F
+#endif /* EGL_EXT_platform_device */
+
+#ifndef EGL_EXT_platform_wayland
+#define EGL_EXT_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
+#endif /* EGL_EXT_platform_wayland */
+
+#ifndef EGL_EXT_platform_x11
+#define EGL_EXT_platform_x11 1
+#define EGL_PLATFORM_X11_EXT 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
+#endif /* EGL_EXT_platform_x11 */
+
+#ifndef EGL_EXT_protected_content
+#define EGL_EXT_protected_content 1
+#define EGL_PROTECTED_CONTENT_EXT 0x32C0
+#endif /* EGL_EXT_protected_content */
+
+#ifndef EGL_EXT_protected_surface
+#define EGL_EXT_protected_surface 1
+#endif /* EGL_EXT_protected_surface */
+
+#ifndef EGL_EXT_stream_consumer_egloutput
+#define EGL_EXT_stream_consumer_egloutput 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#endif
+#endif /* EGL_EXT_stream_consumer_egloutput */
+
+#ifndef EGL_EXT_surface_CTA861_3_metadata
+#define EGL_EXT_surface_CTA861_3_metadata 1
+#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360
+#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361
+#endif /* EGL_EXT_surface_CTA861_3_metadata */
+
+#ifndef EGL_EXT_surface_SMPTE2086_metadata
+#define EGL_EXT_surface_SMPTE2086_metadata 1
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345
+#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346
+#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347
+#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348
+#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349
+#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A
+#define EGL_METADATA_SCALING_EXT 50000
+#endif /* EGL_EXT_surface_SMPTE2086_metadata */
+
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_EXT_swap_buffers_with_damage */
+
+#ifndef EGL_EXT_sync_reuse
+#define EGL_EXT_sync_reuse 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglUnsignalSyncEXT (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
+#endif
+#endif /* EGL_EXT_sync_reuse */
+
+#ifndef EGL_EXT_yuv_surface
+#define EGL_EXT_yuv_surface 1
+#define EGL_YUV_ORDER_EXT 0x3301
+#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
+#define EGL_YUV_SUBSAMPLE_EXT 0x3312
+#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
+#define EGL_YUV_CSC_STANDARD_EXT 0x330A
+#define EGL_YUV_PLANE_BPP_EXT 0x331A
+#define EGL_YUV_BUFFER_EXT 0x3300
+#define EGL_YUV_ORDER_YUV_EXT 0x3302
+#define EGL_YUV_ORDER_YVU_EXT 0x3303
+#define EGL_YUV_ORDER_YUYV_EXT 0x3304
+#define EGL_YUV_ORDER_UYVY_EXT 0x3305
+#define EGL_YUV_ORDER_YVYU_EXT 0x3306
+#define EGL_YUV_ORDER_VYUY_EXT 0x3307
+#define EGL_YUV_ORDER_AYUV_EXT 0x3308
+#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
+#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
+#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
+#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
+#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
+#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
+#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
+#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
+#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
+#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
+#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
+#endif /* EGL_EXT_yuv_surface */
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+struct EGLClientPixmapHI {
+ void *pData;
+ EGLint iWidth;
+ EGLint iHeight;
+ EGLint iStride;
+};
+#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#endif
+#endif /* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+#define EGL_COLOR_FORMAT_HI 0x8F70
+#define EGL_COLOR_RGB_HI 0x8F71
+#define EGL_COLOR_RGBA_HI 0x8F72
+#define EGL_COLOR_ARGB_HI 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif /* EGL_IMG_context_priority */
+
+#ifndef EGL_IMG_image_plane_attribs
+#define EGL_IMG_image_plane_attribs 1
+#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105
+#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106
+#endif /* EGL_IMG_image_plane_attribs */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
+#define EGL_DRM_BUFFER_USE_MESA 0x31D1
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
+#define EGL_DRM_BUFFER_MESA 0x31D3
+#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
+#define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x00000004
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+#endif /* EGL_MESA_drm_image */
+
+#ifndef EGL_MESA_image_dma_buf_export
+#define EGL_MESA_image_dma_buf_export 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+#endif
+#endif /* EGL_MESA_image_dma_buf_export */
+
+#ifndef EGL_MESA_platform_gbm
+#define EGL_MESA_platform_gbm 1
+#define EGL_PLATFORM_GBM_MESA 0x31D7
+#endif /* EGL_MESA_platform_gbm */
+
+#ifndef EGL_MESA_platform_surfaceless
+#define EGL_MESA_platform_surfaceless 1
+#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
+#endif /* EGL_MESA_platform_surfaceless */
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region */
+
+#ifndef EGL_NOK_swap_region2
+#define EGL_NOK_swap_region2 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region2 */
+
+#ifndef EGL_NOK_texture_from_pixmap
+#define EGL_NOK_texture_from_pixmap 1
+#define EGL_Y_INVERTED_NOK 0x307F
+#endif /* EGL_NOK_texture_from_pixmap */
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV 0x3136
+#endif /* EGL_NV_3dvision_surface */
+
+#ifndef EGL_NV_context_priority_realtime
+#define EGL_NV_context_priority_realtime 1
+#define EGL_CONTEXT_PRIORITY_REALTIME_NV 0x3357
+#endif /* EGL_NV_context_priority_realtime */
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif /* EGL_NV_coverage_sample */
+
+#ifndef EGL_NV_coverage_sample_resolve
+#define EGL_NV_coverage_sample_resolve 1
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
+#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+#endif /* EGL_NV_coverage_sample_resolve */
+
+#ifndef EGL_NV_cuda_event
+#define EGL_NV_cuda_event 1
+#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
+#define EGL_SYNC_CUDA_EVENT_NV 0x323C
+#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
+#endif /* EGL_NV_cuda_event */
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif /* EGL_NV_depth_nonlinear */
+
+#ifndef EGL_NV_device_cuda
+#define EGL_NV_device_cuda 1
+#define EGL_CUDA_DEVICE_NV 0x323A
+#endif /* EGL_NV_device_cuda */
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#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
+#endif /* EGL_NV_native_query */
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+#endif /* EGL_NV_post_convert_rounding */
+
+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif
+#endif /* EGL_NV_post_sub_buffer */
+
+#ifndef EGL_NV_robustness_video_memory_purge
+#define EGL_NV_robustness_video_memory_purge 1
+#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C
+#endif /* EGL_NV_robustness_video_memory_purge */
+
+#ifndef EGL_NV_stream_consumer_gltexture_yuv
+#define EGL_NV_stream_consumer_gltexture_yuv 1
+#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C
+#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D
+#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#endif
+#endif /* EGL_NV_stream_consumer_gltexture_yuv */
+
+#ifndef EGL_NV_stream_cross_display
+#define EGL_NV_stream_cross_display 1
+#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E
+#endif /* EGL_NV_stream_cross_display */
+
+#ifndef EGL_NV_stream_cross_object
+#define EGL_NV_stream_cross_object 1
+#define EGL_STREAM_CROSS_OBJECT_NV 0x334D
+#endif /* EGL_NV_stream_cross_object */
+
+#ifndef EGL_NV_stream_cross_partition
+#define EGL_NV_stream_cross_partition 1
+#define EGL_STREAM_CROSS_PARTITION_NV 0x323F
+#endif /* EGL_NV_stream_cross_partition */
+
+#ifndef EGL_NV_stream_cross_process
+#define EGL_NV_stream_cross_process 1
+#define EGL_STREAM_CROSS_PROCESS_NV 0x3245
+#endif /* EGL_NV_stream_cross_process */
+
+#ifndef EGL_NV_stream_cross_system
+#define EGL_NV_stream_cross_system 1
+#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F
+#endif /* EGL_NV_stream_cross_system */
+
+#ifndef EGL_NV_stream_fifo_next
+#define EGL_NV_stream_fifo_next 1
+#define EGL_PENDING_FRAME_NV 0x3329
+#define EGL_STREAM_TIME_PENDING_NV 0x332A
+#endif /* EGL_NV_stream_fifo_next */
+
+#ifndef EGL_NV_stream_fifo_synchronous
+#define EGL_NV_stream_fifo_synchronous 1
+#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336
+#endif /* EGL_NV_stream_fifo_synchronous */
+
+#ifndef EGL_NV_stream_flush
+#define EGL_NV_stream_flush 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMFLUSHNVPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamFlushNV (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_NV_stream_flush */
+
+#ifndef EGL_NV_stream_frame_limits
+#define EGL_NV_stream_frame_limits 1
+#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337
+#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338
+#endif /* EGL_NV_stream_frame_limits */
+
+#ifndef EGL_NV_stream_metadata
+#define EGL_NV_stream_metadata 1
+#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250
+#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251
+#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252
+#define EGL_PRODUCER_METADATA_NV 0x3253
+#define EGL_CONSUMER_METADATA_NV 0x3254
+#define EGL_PENDING_METADATA_NV 0x3328
+#define EGL_METADATA0_SIZE_NV 0x3255
+#define EGL_METADATA1_SIZE_NV 0x3256
+#define EGL_METADATA2_SIZE_NV 0x3257
+#define EGL_METADATA3_SIZE_NV 0x3258
+#define EGL_METADATA0_TYPE_NV 0x3259
+#define EGL_METADATA1_TYPE_NV 0x325A
+#define EGL_METADATA2_TYPE_NV 0x325B
+#define EGL_METADATA3_TYPE_NV 0x325C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
+#endif
+#endif /* EGL_NV_stream_metadata */
+
+#ifndef EGL_NV_stream_remote
+#define EGL_NV_stream_remote 1
+#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240
+#define EGL_STREAM_TYPE_NV 0x3241
+#define EGL_STREAM_PROTOCOL_NV 0x3242
+#define EGL_STREAM_ENDPOINT_NV 0x3243
+#define EGL_STREAM_LOCAL_NV 0x3244
+#define EGL_STREAM_PRODUCER_NV 0x3247
+#define EGL_STREAM_CONSUMER_NV 0x3248
+#define EGL_STREAM_PROTOCOL_FD_NV 0x3246
+#endif /* EGL_NV_stream_remote */
+
+#ifndef EGL_NV_stream_reset
+#define EGL_NV_stream_reset 1
+#define EGL_SUPPORT_RESET_NV 0x3334
+#define EGL_SUPPORT_REUSE_NV 0x3335
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_NV_stream_reset */
+
+#ifndef EGL_NV_stream_socket
+#define EGL_NV_stream_socket 1
+#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B
+#define EGL_SOCKET_HANDLE_NV 0x324C
+#define EGL_SOCKET_TYPE_NV 0x324D
+#endif /* EGL_NV_stream_socket */
+
+#ifndef EGL_NV_stream_socket_inet
+#define EGL_NV_stream_socket_inet 1
+#define EGL_SOCKET_TYPE_INET_NV 0x324F
+#endif /* EGL_NV_stream_socket_inet */
+
+#ifndef EGL_NV_stream_socket_unix
+#define EGL_NV_stream_socket_unix 1
+#define EGL_SOCKET_TYPE_UNIX_NV 0x324E
+#endif /* EGL_NV_stream_socket_unix */
+
+#ifndef EGL_NV_stream_sync
+#define EGL_NV_stream_sync 1
+#define EGL_SYNC_NEW_FRAME_NV 0x321F
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#endif
+#endif /* EGL_NV_stream_sync */
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+typedef void *EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0)
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_sync */
+
+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_system_time */
+
+#ifndef EGL_TIZEN_image_native_buffer
+#define EGL_TIZEN_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
+#endif /* EGL_TIZEN_image_native_buffer */
+
+#ifndef EGL_TIZEN_image_native_surface
+#define EGL_TIZEN_image_native_surface 1
+#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
+#endif /* EGL_TIZEN_image_native_surface */
+
+/* ANGLE EGL extensions */
+#include "eglext_angle.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/EGL/eglext_angle.h b/gfx/angle/checkout/include/EGL/eglext_angle.h
new file mode 100644
index 0000000000..382a3598ba
--- /dev/null
+++ b/gfx/angle/checkout/include/EGL/eglext_angle.h
@@ -0,0 +1,241 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// eglext_angle.h: ANGLE modifications to the eglext.h header file.
+// Currently we don't include this file directly, we patch eglext.h
+// to include it implicitly so it is visible throughout our code.
+
+#ifndef INCLUDE_EGL_EGLEXT_ANGLE_
+#define INCLUDE_EGL_EGLEXT_ANGLE_
+
+// clang-format off
+
+#ifndef EGL_ANGLE_robust_resource_initialization
+#define EGL_ANGLE_robust_resource_initialization 1
+#define EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE 0x3453
+#endif /* EGL_ANGLE_robust_resource_initialization */
+
+#ifndef EGL_ANGLE_keyed_mutex
+#define EGL_ANGLE_keyed_mutex 1
+#define EGL_DXGI_KEYED_MUTEX_ANGLE 0x33A2
+#endif /* EGL_ANGLE_keyed_mutex */
+
+#ifndef EGL_ANGLE_d3d_texture_client_buffer
+#define EGL_ANGLE_d3d_texture_client_buffer 1
+#define EGL_D3D_TEXTURE_ANGLE 0x33A3
+#endif /* EGL_ANGLE_d3d_texture_client_buffer */
+
+#ifndef EGL_ANGLE_software_display
+#define EGL_ANGLE_software_display 1
+#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
+#endif /* EGL_ANGLE_software_display */
+
+#ifndef EGL_ANGLE_direct3d_display
+#define EGL_ANGLE_direct3d_display 1
+#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2)
+#define EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3)
+#endif /* EGL_ANGLE_direct3d_display */
+
+#ifndef EGL_ANGLE_direct_composition
+#define EGL_ANGLE_direct_composition 1
+#define EGL_DIRECT_COMPOSITION_ANGLE 0x33A5
+#endif /* EGL_ANGLE_direct_composition */
+
+#ifndef EGL_ANGLE_platform_angle
+#define EGL_ANGLE_platform_angle 1
+#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
+#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
+#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
+#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
+#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
+#define EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE 0x3451
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x345E
+#endif /* EGL_ANGLE_platform_angle */
+
+#ifndef EGL_ANGLE_platform_angle_d3d
+#define EGL_ANGLE_platform_angle_d3d 1
+#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
+#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE 0x320B
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE 0x320C
+#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
+#endif /* EGL_ANGLE_platform_angle_d3d */
+
+#ifndef EGL_ANGLE_platform_angle_opengl
+#define EGL_ANGLE_platform_angle_opengl 1
+#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
+#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
+#define EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE 0x3480
+#endif /* EGL_ANGLE_platform_angle_opengl */
+
+#ifndef EGL_ANGLE_platform_angle_null
+#define EGL_ANGLE_platform_angle_null 1
+#define EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE 0x33AE
+#endif /* EGL_ANGLE_platform_angle_null */
+
+#ifndef EGL_ANGLE_platform_angle_vulkan
+#define EGL_ANGLE_platform_angle_vulkan 1
+#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
+#endif /* EGL_ANGLE_platform_angle_vulkan */
+
+#ifndef EGL_ANGLE_platform_angle_context_virtualization
+#define EGL_ANGLE_platform_angle_context_virtualization 1
+#define EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE 0x3481
+#endif /* EGL_ANGLE_platform_angle_context_virtualization */
+
+#ifndef EGL_ANGLE_x11_visual
+#define EGL_ANGLE_x11_visual
+#define EGL_X11_VISUAL_ID_ANGLE 0x33A3
+#endif /* EGL_ANGLE_x11_visual */
+
+#ifndef EGL_ANGLE_flexible_surface_compatibility
+#define EGL_ANGLE_flexible_surface_compatibility 1
+#define EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE 0x33A6
+#endif /* EGL_ANGLE_flexible_surface_compatibility */
+
+#ifndef EGL_ANGLE_surface_orientation
+#define EGL_ANGLE_surface_orientation
+#define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7
+#define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8
+#define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001
+#define EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE 0x0002
+#endif /* EGL_ANGLE_surface_orientation */
+
+#ifndef EGL_ANGLE_experimental_present_path
+#define EGL_ANGLE_experimental_present_path
+#define EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE 0x33A4
+#define EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE 0x33A9
+#define EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE 0x33AA
+#endif /* EGL_ANGLE_experimental_present_path */
+
+#ifndef EGL_ANGLE_stream_producer_d3d_texture
+#define EGL_ANGLE_stream_producer_d3d_texture
+#define EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE 0x33AB
+typedef EGLBoolean(EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+typedef EGLBoolean(EGLAPIENTRYP PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglCreateStreamProducerD3DTextureANGLE(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamPostD3DTextureANGLE(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
+#endif
+#endif /* EGL_ANGLE_stream_producer_d3d_texture */
+
+#ifndef EGL_ANGLE_create_context_webgl_compatibility
+#define EGL_ANGLE_create_context_webgl_compatibility 1
+#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x33AC
+#endif /* EGL_ANGLE_create_context_webgl_compatibility */
+
+#ifndef EGL_ANGLE_display_texture_share_group
+#define EGL_ANGLE_display_texture_share_group 1
+#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x33AF
+#endif /* EGL_ANGLE_display_texture_share_group */
+
+#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
+#define EGL_CHROMIUM_create_context_bind_generates_resource 1
+#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x33AD
+#endif /* EGL_CHROMIUM_create_context_bind_generates_resource */
+
+#ifndef EGL_ANGLE_create_context_client_arrays
+#define EGL_ANGLE_create_context_client_arrays 1
+#define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452
+#endif /* EGL_ANGLE_create_context_client_arrays */
+
+#ifndef EGL_ANGLE_device_creation
+#define EGL_ANGLE_device_creation 1
+typedef EGLDeviceEXT(EGLAPIENTRYP PFNEGLCREATEDEVICEANGLEPROC) (EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
+typedef EGLBoolean(EGLAPIENTRYP PFNEGLRELEASEDEVICEANGLEPROC) (EGLDeviceEXT device);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDeviceEXT EGLAPIENTRY eglCreateDeviceANGLE(EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE(EGLDeviceEXT device);
+#endif
+#endif /* EGL_ANGLE_device_creation */
+
+#ifndef EGL_ANGLE_program_cache_control
+#define EGL_ANGLE_program_cache_control 1
+#define EGL_PROGRAM_CACHE_SIZE_ANGLE 0x3455
+#define EGL_PROGRAM_CACHE_KEY_LENGTH_ANGLE 0x3456
+#define EGL_PROGRAM_CACHE_RESIZE_ANGLE 0x3457
+#define EGL_PROGRAM_CACHE_TRIM_ANGLE 0x3458
+#define EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE 0x3459
+typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHEGETATTRIBANGLEPROC) (EGLDisplay dpy, EGLenum attrib);
+typedef void (EGLAPIENTRYP PFNEGLPROGRAMCACHEQUERYANGLEPROC) (EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
+typedef void (EGLAPIENTRYP PFNEGLPROGRAMCACHEPOPULATEANGLEPROC) (EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
+typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHERESIZEANGLEPROC) (EGLDisplay dpy, EGLint limit, EGLenum mode);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib);
+EGLAPI void EGLAPIENTRY eglProgramCacheQueryANGLE(EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
+EGLAPI void EGLAPIENTRY eglProgramCachePopulateANGLE(EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
+EGLAPI EGLint EGLAPIENTRY eglProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLenum mode);
+#endif
+#endif /* EGL_ANGLE_program_cache_control */
+
+#ifndef EGL_ANGLE_iosurface_client_buffer
+#define EGL_ANGLE_iosurface_client_buffer 1
+#define EGL_IOSURFACE_ANGLE 0x3454
+#define EGL_IOSURFACE_PLANE_ANGLE 0x345A
+#define EGL_TEXTURE_RECTANGLE_ANGLE 0x345B
+#define EGL_TEXTURE_TYPE_ANGLE 0x345C
+#define EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D
+#endif /* EGL_ANGLE_iosurface_client_buffer */
+
+#ifndef EGL_ANGLE_create_context_extensions_enabled
+#define EGL_ANGLE_create_context_extensions_enabled 1
+#define EGL_EXTENSIONS_ENABLED_ANGLE 0x345F
+#endif /* EGL_ANGLE_create_context_extensions_enabled */
+
+#ifndef EGL_CHROMIUM_get_sync_values
+#define EGL_CHROMIUM_get_sync_values 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCVALUESCHROMIUMPROC) (EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *ust,
+ EGLuint64KHR *msc,
+ EGLuint64KHR *sbc);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *ust,
+ EGLuint64KHR *msc,
+ EGLuint64KHR *sbc);
+#endif
+#endif /* EGL_CHROMIUM_get_sync_values */
+
+#ifndef EGL_ANGLE_power_preference
+#define EGL_ANGLE_power_preference 1
+#define EGL_POWER_PREFERENCE_ANGLE 0x3482
+#define EGL_LOW_POWER_ANGLE 0x0001
+#define EGL_HIGH_POWER_ANGLE 0x0002
+#endif /* EGL_ANGLE_power_preference */
+
+#ifndef EGL_ANGLE_feature_control
+#define EGL_ANGLE_feature_control 1
+#define EGL_FEATURE_NAME_ANGLE 0x3460
+#define EGL_FEATURE_CATEGORY_ANGLE 0x3461
+#define EGL_FEATURE_DESCRIPTION_ANGLE 0x3462
+#define EGL_FEATURE_BUG_ANGLE 0x3463
+#define EGL_FEATURE_STATUS_ANGLE 0x3464
+#define EGL_FEATURE_COUNT_ANGLE 0x3465
+#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
+#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribANGLE(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#endif
+#endif /* EGL_ANGLE_feature_control */
+
+#ifndef EGL_ANGLE_image_d3d11_texture
+#define EGL_D3D11_TEXTURE_ANGLE 0x3484
+#endif /* EGL_ANGLE_image_d3d11_texture */
+
+#ifndef EGL_ANGLE_create_context_backwards_compatible
+#define EGL_ANGLE_create_context_backwards_compatible 1
+#define EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE 0x3483
+#endif /* EGL_ANGLE_create_context_backwards_compatible */
+
+// clang-format on
+
+#endif // INCLUDE_EGL_EGLEXT_ANGLE_
diff --git a/gfx/angle/checkout/include/EGL/eglplatform.h b/gfx/angle/checkout/include/EGL/eglplatform.h
new file mode 100644
index 0000000000..543f8e5cbf
--- /dev/null
+++ b/gfx/angle/checkout/include/EGL/eglplatform.h
@@ -0,0 +1,176 @@
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2016 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.
+*/
+
+/* Platform-specific types and definitions for egl.h
+ * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
+ *
+ * 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 "EGL" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+/* Macros used in EGL function prototype declarations.
+ *
+ * EGL functions should be prototyped as:
+ *
+ * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
+ * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
+ *
+ * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
+ */
+
+#ifndef EGLAPI
+#define EGLAPI KHRONOS_APICALL
+#endif
+
+#ifndef EGLAPIENTRY
+#define EGLAPIENTRY KHRONOS_APIENTRY
+#endif
+#define EGLAPIENTRYP EGLAPIENTRY*
+
+/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
+ * are aliases of window-system-dependent types, such as X Display * or
+ * Windows Device Context. They must be defined in platform-specific
+ * code below. The EGL-prefixed versions of Native*Type are the same
+ * types, renamed in EGL 1.3 so all types in the API start with "EGL".
+ *
+ * Khronos STRONGLY RECOMMENDS that you use the default definitions
+ * provided below, since these changes affect both binary and source
+ * portability of applications using EGL running on different EGL
+ * implementations.
+ */
+
+#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+
+typedef HDC EGLNativeDisplayType;
+typedef HBITMAP EGLNativePixmapType;
+
+#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) /* Windows Desktop */
+typedef HWND EGLNativeWindowType;
+#else /* Windows Store */
+#include <inspectable.h>
+typedef IInspectable* EGLNativeWindowType;
+#endif
+
+#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativePixmapType;
+typedef void *EGLNativeWindowType;
+
+#elif defined(WL_EGL_PLATFORM)
+
+typedef struct wl_display *EGLNativeDisplayType;
+typedef struct wl_egl_pixmap *EGLNativePixmapType;
+typedef struct wl_egl_window *EGLNativeWindowType;
+
+#elif defined(__GBM__)
+
+typedef struct gbm_device *EGLNativeDisplayType;
+typedef struct gbm_bo *EGLNativePixmapType;
+typedef void *EGLNativeWindowType;
+
+#elif defined(__ANDROID__) || defined(ANDROID)
+
+struct ANativeWindow;
+struct egl_native_pixmap_t;
+
+typedef void* EGLNativeDisplayType;
+typedef struct egl_native_pixmap_t* EGLNativePixmapType;
+typedef struct ANativeWindow* EGLNativeWindowType;
+
+#elif defined(USE_OZONE)
+
+typedef intptr_t EGLNativeDisplayType;
+typedef intptr_t EGLNativePixmapType;
+typedef intptr_t EGLNativeWindowType;
+
+#elif defined(__unix__) || defined(USE_X11)
+
+/* X11 (tentative) */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#elif defined(__APPLE__)
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativePixmapType;
+typedef void *EGLNativeWindowType;
+
+#elif defined(__HAIKU__)
+
+#include <kernel/image.h>
+
+typedef void *EGLNativeDisplayType;
+typedef khronos_uintptr_t EGLNativePixmapType;
+typedef khronos_uintptr_t EGLNativeWindowType;
+
+#elif defined(__Fuchsia__)
+
+typedef int EGLNativeDisplayType;
+typedef void *EGLNativePixmapType;
+typedef void *EGLNativeWindowType
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+ * all legal attribute names and values passed into and out of EGL, whether
+ * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+ * handle, or other. While in general a 32-bit integer will suffice, if
+ * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+ * integer type.
+ */
+typedef khronos_int32_t EGLint;
+
+
+/* C++ / C typecast macros for special EGL handle values */
+#if defined(__cplusplus)
+#define EGL_CAST(type, value) (static_cast<type>(value))
+#else
+#define EGL_CAST(type, value) ((type) (value))
+#endif
+
+#endif /* __eglplatform_h */
diff --git a/gfx/angle/checkout/include/GLES/gl.h b/gfx/angle/checkout/include/GLES/gl.h
new file mode 100644
index 0000000000..9f3ed3438a
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES/gl.h
@@ -0,0 +1,743 @@
+#ifndef __gles1_gl_h_
+#define __gles1_gl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2018 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#include <GLES/glplatform.h>
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/* Generated on date 20181204 */
+
+/* Generated C header for:
+ * API: gles1
+ * Profile: common
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: ^(GL_OES_read_format|GL_OES_compressed_paletted_texture|GL_OES_point_size_array|GL_OES_point_sprite)$
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_VERSION_ES_CM_1_0
+#define GL_VERSION_ES_CM_1_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int16_t GLshort;
+typedef khronos_uint16_t GLushort;
+typedef void GLvoid;
+typedef unsigned int GLenum;
+typedef khronos_float_t GLfloat;
+typedef khronos_int32_t GLfixed;
+typedef unsigned int GLuint;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef khronos_uint8_t GLubyte;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_int32_t GLclampx;
+#define GL_VERSION_ES_CL_1_0 1
+#define GL_VERSION_ES_CM_1_1 1
+#define GL_VERSION_ES_CL_1_1 1
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#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
+#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
+#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
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_CLIP_PLANE0 0x3000
+#define GL_CLIP_PLANE1 0x3001
+#define GL_CLIP_PLANE2 0x3002
+#define GL_CLIP_PLANE3 0x3003
+#define GL_CLIP_PLANE4 0x3004
+#define GL_CLIP_PLANE5 0x3005
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_FOG 0x0B60
+#define GL_LIGHTING 0x0B50
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_ALPHA_TEST 0x0BC0
+#define GL_BLEND 0x0BE2
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_POINT_SMOOTH 0x0B10
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_COLOR_MATERIAL 0x0B57
+#define GL_NORMALIZE 0x0BA1
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#define GL_OUT_OF_MEMORY 0x0505
+#define GL_EXP 0x0800
+#define GL_EXP2 0x0801
+#define GL_FOG_DENSITY 0x0B62
+#define GL_FOG_START 0x0B63
+#define GL_FOG_END 0x0B64
+#define GL_FOG_MODE 0x0B65
+#define GL_FOG_COLOR 0x0B66
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#define GL_CURRENT_COLOR 0x0B00
+#define GL_CURRENT_NORMAL 0x0B02
+#define GL_CURRENT_TEXTURE_COORDS 0x0B03
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_MIN 0x8126
+#define GL_POINT_SIZE_MAX 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
+#define GL_POINT_DISTANCE_ATTENUATION 0x8129
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_LINE_WIDTH 0x0B21
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#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_SHADE_MODEL 0x0B54
+#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_VALUE_MASK 0x0B93
+#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_WRITEMASK 0x0B98
+#define GL_MATRIX_MODE 0x0BA0
+#define GL_VIEWPORT 0x0BA2
+#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
+#define GL_PROJECTION_STACK_DEPTH 0x0BA4
+#define GL_TEXTURE_STACK_DEPTH 0x0BA5
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#define GL_PROJECTION_MATRIX 0x0BA7
+#define GL_TEXTURE_MATRIX 0x0BA8
+#define GL_ALPHA_TEST_FUNC 0x0BC1
+#define GL_ALPHA_TEST_REF 0x0BC2
+#define GL_BLEND_DST 0x0BE0
+#define GL_BLEND_SRC 0x0BE1
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_MAX_LIGHTS 0x0D31
+#define GL_MAX_CLIP_PLANES 0x0D32
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
+#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
+#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+#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
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_VERTEX_ARRAY_SIZE 0x807A
+#define GL_VERTEX_ARRAY_TYPE 0x807B
+#define GL_VERTEX_ARRAY_STRIDE 0x807C
+#define GL_NORMAL_ARRAY_TYPE 0x807E
+#define GL_NORMAL_ARRAY_STRIDE 0x807F
+#define GL_COLOR_ARRAY_SIZE 0x8081
+#define GL_COLOR_ARRAY_TYPE 0x8082
+#define GL_COLOR_ARRAY_STRIDE 0x8083
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
+#define GL_POINT_SMOOTH_HINT 0x0C51
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_FOG_HINT 0x0C54
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_LIGHT_MODEL_AMBIENT 0x0B53
+#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
+#define GL_AMBIENT 0x1200
+#define GL_DIFFUSE 0x1201
+#define GL_SPECULAR 0x1202
+#define GL_POSITION 0x1203
+#define GL_SPOT_DIRECTION 0x1204
+#define GL_SPOT_EXPONENT 0x1205
+#define GL_SPOT_CUTOFF 0x1206
+#define GL_CONSTANT_ATTENUATION 0x1207
+#define GL_LINEAR_ATTENUATION 0x1208
+#define GL_QUADRATIC_ATTENUATION 0x1209
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+#define GL_CLEAR 0x1500
+#define GL_AND 0x1501
+#define GL_AND_REVERSE 0x1502
+#define GL_COPY 0x1503
+#define GL_AND_INVERTED 0x1504
+#define GL_NOOP 0x1505
+#define GL_XOR 0x1506
+#define GL_OR 0x1507
+#define GL_NOR 0x1508
+#define GL_EQUIV 0x1509
+#define GL_INVERT 0x150A
+#define GL_OR_REVERSE 0x150B
+#define GL_COPY_INVERTED 0x150C
+#define GL_OR_INVERTED 0x150D
+#define GL_NAND 0x150E
+#define GL_SET 0x150F
+#define GL_EMISSION 0x1600
+#define GL_SHININESS 0x1601
+#define GL_AMBIENT_AND_DIFFUSE 0x1602
+#define GL_MODELVIEW 0x1700
+#define GL_PROJECTION 0x1701
+#define GL_TEXTURE 0x1702
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#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
+#define GL_FLAT 0x1D00
+#define GL_SMOOTH 0x1D01
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_MODULATE 0x2100
+#define GL_DECAL 0x2101
+#define GL_ADD 0x0104
+#define GL_TEXTURE_ENV_MODE 0x2200
+#define GL_TEXTURE_ENV_COLOR 0x2201
+#define GL_TEXTURE_ENV 0x2300
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_GENERATE_MIPMAP 0x8191
+#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
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_LIGHT0 0x4000
+#define GL_LIGHT1 0x4001
+#define GL_LIGHT2 0x4002
+#define GL_LIGHT3 0x4003
+#define GL_LIGHT4 0x4004
+#define GL_LIGHT5 0x4005
+#define GL_LIGHT6 0x4006
+#define GL_LIGHT7 0x4007
+#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_VERTEX_ARRAY_BUFFER_BINDING 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_SUBTRACT 0x84E7
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+#define GL_OPERAND0_RGB 0x8590
+#define GL_OPERAND1_RGB 0x8591
+#define GL_OPERAND2_RGB 0x8592
+#define GL_OPERAND0_ALPHA 0x8598
+#define GL_OPERAND1_ALPHA 0x8599
+#define GL_OPERAND2_ALPHA 0x859A
+#define GL_ALPHA_SCALE 0x0D1C
+#define GL_SRC0_RGB 0x8580
+#define GL_SRC1_RGB 0x8581
+#define GL_SRC2_RGB 0x8582
+#define GL_SRC0_ALPHA 0x8588
+#define GL_SRC1_ALPHA 0x8589
+#define GL_SRC2_ALPHA 0x858A
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCPROC) (GLenum func, GLfloat ref);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEFPROC) (GLenum p, const GLfloat *eqn);
+typedef void (GL_APIENTRYP PFNGLCOLOR4FPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLFOGFPROC) (GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLFOGFVPROC) (GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMFPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFPROC) (GLenum plane, GLfloat *equation);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETLIGHTFVPROC) (GLenum light, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETMATERIALFVPROC) (GLenum face, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELFPROC) (GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELFVPROC) (GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTFPROC) (GLenum light, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLLIGHTFVPROC) (GLenum light, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
+typedef void (GL_APIENTRYP PFNGLLOADMATRIXFPROC) (const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATERIALFPROC) (GLenum face, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLMATERIALFVPROC) (GLenum face, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLMULTMATRIXFPROC) (const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (GL_APIENTRYP PFNGLNORMAL3FPROC) (GLfloat nx, GLfloat ny, GLfloat nz);
+typedef void (GL_APIENTRYP PFNGLORTHOFPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLROTATEFPROC) (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLSCALEFPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLTEXENVFPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXENVFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTRANSLATEFPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCXPROC) (GLenum func, GLfixed ref);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORXPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXPROC) (GLfixed depth);
+typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
+typedef void (GL_APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEXPROC) (GLenum plane, const GLfixed *equation);
+typedef void (GL_APIENTRYP PFNGLCOLOR4UBPROC) (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+typedef void (GL_APIENTRYP PFNGLCOLOR4XPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GL_APIENTRYP PFNGLCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXPROC) (GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLDISABLECLIENTSTATEPROC) (GLenum array);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLENABLECLIENTSTATEPROC) (GLenum array);
+typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFOGXPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLFOGXVPROC) (GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMXPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXPROC) (GLenum plane, GLfixed *equation);
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
+typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETFIXEDVPROC) (GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETLIGHTXVPROC) (GLenum light, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETMATERIALXVPROC) (GLenum face, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVXVPROC) (GLenum target, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVPROC) (GLenum target, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
+typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVPROC) (GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLLIGHTXPROC) (GLenum light, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTXVPROC) (GLenum light, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHXPROC) (GLfixed width);
+typedef void (GL_APIENTRYP PFNGLLOADIDENTITYPROC) (void);
+typedef void (GL_APIENTRYP PFNGLLOADMATRIXXPROC) (const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLLOGICOPPROC) (GLenum opcode);
+typedef void (GL_APIENTRYP PFNGLMATERIALXPROC) (GLenum face, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLMATERIALXVPROC) (GLenum face, GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLMATRIXMODEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLMULTMATRIXXPROC) (const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+typedef void (GL_APIENTRYP PFNGLNORMAL3XPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
+typedef void (GL_APIENTRYP PFNGLNORMALPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLORTHOXPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVPROC) (GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLPOINTSIZEXPROC) (GLfixed size);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXPROC) (GLfixed factor, GLfixed units);
+typedef void (GL_APIENTRYP PFNGLPOPMATRIXPROC) (void);
+typedef void (GL_APIENTRYP PFNGLPUSHMATRIXPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+typedef void (GL_APIENTRYP PFNGLROTATEXPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXPROC) (GLclampx value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCALEXPROC) (GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSHADEMODELPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GL_APIENTRYP PFNGLTEXCOORDPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLTEXENVIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXENVXPROC) (GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXENVIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXENVXVPROC) (GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXPROC) (GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVPROC) (GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTRANSLATEXPROC) (GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLVERTEXPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+#if GL_GLES_PROTOTYPES
+GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLfloat ref);
+GL_API void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_API void GL_APIENTRY glClearDepthf (GLfloat d);
+GL_API void GL_APIENTRY glClipPlanef (GLenum p, const GLfloat *eqn);
+GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_API void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
+GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glFrustumf (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+GL_API void GL_APIENTRY glGetClipPlanef (GLenum plane, GLfloat *equation);
+GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
+GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glLineWidth (GLfloat width);
+GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
+GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
+GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
+GL_API void GL_APIENTRY glOrthof (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glPointSize (GLfloat size);
+GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLfixed ref);
+GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+GL_API void GL_APIENTRY glClear (GLbitfield mask);
+GL_API void GL_APIENTRY glClearColorx (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glClearDepthx (GLfixed depth);
+GL_API void GL_APIENTRY glClearStencil (GLint s);
+GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
+GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
+GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glCullFace (GLenum mode);
+GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
+GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
+GL_API void GL_APIENTRY glDepthFunc (GLenum func);
+GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_API void GL_APIENTRY glDepthRangex (GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glDisable (GLenum cap);
+GL_API void GL_APIENTRY glDisableClientState (GLenum array);
+GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
+GL_API void GL_APIENTRY glEnable (GLenum cap);
+GL_API void GL_APIENTRY glEnableClientState (GLenum array);
+GL_API void GL_APIENTRY glFinish (void);
+GL_API void GL_APIENTRY glFlush (void);
+GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glFrontFace (GLenum mode);
+GL_API void GL_APIENTRY glFrustumx (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
+GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetClipPlanex (GLenum plane, GLfixed *equation);
+GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
+GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
+GL_API GLenum GL_APIENTRY glGetError (void);
+GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
+GL_API const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_API void GL_APIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexEnvxv (GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
+GL_API void GL_APIENTRY glLoadIdentity (void);
+GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
+GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
+GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
+GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
+GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
+GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glOrthox (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glPointSizex (GLfixed size);
+GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
+GL_API void GL_APIENTRY glPopMatrix (void);
+GL_API void GL_APIENTRY glPushMatrix (void);
+GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
+GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
+GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glShadeModel (GLenum mode);
+GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_API void GL_APIENTRY glStencilMask (GLuint mask);
+GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_VERSION_ES_CM_1_0 */
+
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif /* GL_OES_compressed_paletted_texture */
+
+#ifndef GL_OES_point_size_array
+#define GL_OES_point_size_array 1
+#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
+#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
+#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
+#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
+#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
+typedef void (GL_APIENTRYP PFNGLPOINTSIZEPOINTEROESPROC) (GLenum type, GLsizei stride, const void *pointer);
+#if GL_GLES_PROTOTYPES
+GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const void *pointer);
+#endif
+#endif /* GL_OES_point_size_array */
+
+#ifndef GL_OES_point_sprite
+#define GL_OES_point_sprite 1
+#define GL_POINT_SPRITE_OES 0x8861
+#define GL_COORD_REPLACE_OES 0x8862
+#endif /* GL_OES_point_sprite */
+
+#ifndef GL_OES_read_format
+#define GL_OES_read_format 1
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
+#endif /* GL_OES_read_format */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/GLES/glext.h b/gfx/angle/checkout/include/GLES/glext.h
new file mode 100644
index 0000000000..ddd4078166
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES/glext.h
@@ -0,0 +1,965 @@
+#ifndef __glext_h_
+#define __glext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/* Generated on date 20171212 */
+
+/* Generated C header for:
+ * API: gles1
+ * Profile: common
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: gles1
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: ^(GL_OES_read_format|GL_OES_compressed_paletted_texture|GL_OES_point_size_array|GL_OES_point_sprite)$
+ */
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+typedef void *GLeglImageOES;
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+#endif /* GL_OES_EGL_image */
+
+#ifndef GL_OES_blend_equation_separate
+#define GL_OES_blend_equation_separate 1
+#define GL_BLEND_EQUATION_RGB_OES 0x8009
+#define GL_BLEND_EQUATION_ALPHA_OES 0x883D
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha);
+#endif
+#endif /* GL_OES_blend_equation_separate */
+
+#ifndef GL_OES_blend_func_separate
+#define GL_OES_blend_func_separate 1
+#define GL_BLEND_DST_RGB_OES 0x80C8
+#define GL_BLEND_SRC_RGB_OES 0x80C9
+#define GL_BLEND_DST_ALPHA_OES 0x80CA
+#define GL_BLEND_SRC_ALPHA_OES 0x80CB
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+#endif /* GL_OES_blend_func_separate */
+
+#ifndef GL_OES_blend_subtract
+#define GL_OES_blend_subtract 1
+#define GL_BLEND_EQUATION_OES 0x8009
+#define GL_FUNC_ADD_OES 0x8006
+#define GL_FUNC_SUBTRACT_OES 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode);
+#endif
+#endif /* GL_OES_blend_subtract */
+
+#ifndef GL_OES_byte_coordinates
+#define GL_OES_byte_coordinates 1
+#endif /* GL_OES_byte_coordinates */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
+#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
+#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif /* GL_OES_compressed_ETC1_RGB8_texture */
+
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif /* GL_OES_depth24 */
+
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif /* GL_OES_depth32 */
+
+#ifndef GL_OES_draw_texture
+#define GL_OES_draw_texture 1
+#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
+GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
+GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
+GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
+GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
+#endif
+#endif /* GL_OES_draw_texture */
+
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#define GL_UNSIGNED_INT 0x1405
+#endif /* GL_OES_element_index_uint */
+
+#ifndef GL_OES_extended_matrix_palette
+#define GL_OES_extended_matrix_palette 1
+#endif /* GL_OES_extended_matrix_palette */
+
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif /* GL_OES_fbo_render_mipmap */
+
+#ifndef GL_OES_fixed_point
+#define GL_OES_fixed_point 1
+#define GL_FIXED_OES 0x140C
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
+typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation);
+typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
+typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
+typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
+typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref);
+GL_API void GL_APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glClearDepthxOES (GLfixed depth);
+GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
+GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glDepthRangexOES (GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation);
+GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width);
+GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m);
+GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m);
+GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
+GL_API void GL_APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glPointSizexOES (GLfixed size);
+GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
+GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert);
+GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
+#endif
+#endif /* GL_OES_fixed_point */
+
+#ifndef GL_OES_framebuffer_object
+#define GL_OES_framebuffer_object 1
+#define GL_NONE_OES 0
+#define GL_FRAMEBUFFER_OES 0x8D40
+#define GL_RENDERBUFFER_OES 0x8D41
+#define GL_RGBA4_OES 0x8056
+#define GL_RGB5_A1_OES 0x8057
+#define GL_RGB565_OES 0x8D62
+#define GL_DEPTH_COMPONENT16_OES 0x81A5
+#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
+#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
+#define GL_COLOR_ATTACHMENT0_OES 0x8CE0
+#define GL_DEPTH_ATTACHMENT_OES 0x8D00
+#define GL_STENCIL_ATTACHMENT_OES 0x8D20
+#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
+#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
+#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
+#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
+#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint *framebuffers);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer);
+GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer);
+GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint *renderbuffers);
+GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint *renderbuffers);
+GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint *params);
+GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer);
+GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer);
+GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint *framebuffers);
+GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint *framebuffers);
+GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target);
+GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target);
+#endif
+#endif /* GL_OES_framebuffer_object */
+
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
+#endif
+#endif /* GL_OES_mapbuffer */
+
+#ifndef GL_OES_matrix_get
+#define GL_OES_matrix_get 1
+#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
+#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
+#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
+#endif /* GL_OES_matrix_get */
+
+#ifndef GL_OES_matrix_palette
+#define GL_OES_matrix_palette 1
+#define GL_MAX_VERTEX_UNITS_OES 0x86A4
+#define GL_MAX_PALETTE_MATRICES_OES 0x8842
+#define GL_MATRIX_PALETTE_OES 0x8840
+#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
+#define GL_WEIGHT_ARRAY_OES 0x86AD
+#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843
+#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
+#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
+#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
+#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
+#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
+#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
+#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
+#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
+#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
+#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
+typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
+typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
+typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
+GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
+GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const void *pointer);
+#endif
+#endif /* GL_OES_matrix_palette */
+
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif /* GL_OES_packed_depth_stencil */
+
+#ifndef GL_OES_query_matrix
+#define GL_OES_query_matrix 1
+typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent);
+#endif
+#endif /* GL_OES_query_matrix */
+
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#define GL_ALPHA8_OES 0x803C
+#define GL_LUMINANCE4_ALPHA4_OES 0x8043
+#define GL_LUMINANCE8_ALPHA8_OES 0x8045
+#define GL_LUMINANCE8_OES 0x8040
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#define GL_RGB10_EXT 0x8052
+#define GL_RGB10_A2_EXT 0x8059
+#endif /* GL_OES_required_internalformat */
+
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif /* GL_OES_rgb8_rgba8 */
+
+#ifndef GL_OES_single_precision
+#define GL_OES_single_precision 1
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation);
+typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
+GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
+GL_API void GL_APIENTRY glDepthRangefOES (GLclampf n, GLclampf f);
+GL_API void GL_APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation);
+GL_API void GL_APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+#endif
+#endif /* GL_OES_single_precision */
+
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif /* GL_OES_stencil1 */
+
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif /* GL_OES_stencil4 */
+
+#ifndef GL_OES_stencil8
+#define GL_OES_stencil8 1
+#define GL_STENCIL_INDEX8_OES 0x8D48
+#endif /* GL_OES_stencil8 */
+
+#ifndef GL_OES_stencil_wrap
+#define GL_OES_stencil_wrap 1
+#define GL_INCR_WRAP_OES 0x8507
+#define GL_DECR_WRAP_OES 0x8508
+#endif /* GL_OES_stencil_wrap */
+
+#ifndef GL_OES_surfaceless_context
+#define GL_OES_surfaceless_context 1
+#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
+#endif /* GL_OES_surfaceless_context */
+
+#ifndef GL_OES_texture_cube_map
+#define GL_OES_texture_cube_map 1
+#define GL_NORMAL_MAP_OES 0x8511
+#define GL_REFLECTION_MAP_OES 0x8512
+#define GL_TEXTURE_CUBE_MAP_OES 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
+#define GL_TEXTURE_GEN_MODE_OES 0x2500
+#define GL_TEXTURE_GEN_STR_OES 0x8D60
+typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params);
+#endif
+#endif /* GL_OES_texture_cube_map */
+
+#ifndef GL_OES_texture_env_crossbar
+#define GL_OES_texture_env_crossbar 1
+#endif /* GL_OES_texture_env_crossbar */
+
+#ifndef GL_OES_texture_mirrored_repeat
+#define GL_OES_texture_mirrored_repeat 1
+#define GL_MIRRORED_REPEAT_OES 0x8370
+#endif /* GL_OES_texture_mirrored_repeat */
+
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif /* GL_OES_texture_npot */
+
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_API GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+#endif /* GL_OES_vertex_array_object */
+
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif /* GL_AMD_compressed_3DC_texture */
+
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif /* GL_AMD_compressed_ATC_texture */
+
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+#endif /* GL_APPLE_copy_texture_levels */
+
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_APPLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+#define GL_MAX_SAMPLES_APPLE 0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+#endif
+#endif /* GL_APPLE_framebuffer_multisample */
+
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+typedef struct __GLsync *GLsync;
+typedef khronos_uint64_t GLuint64;
+typedef khronos_int64_t GLint64;
+#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
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+GL_API GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+GL_API void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+GL_API GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_API void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_API void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+GL_API void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+#endif /* GL_APPLE_sync */
+
+#ifndef GL_APPLE_texture_2D_limited_npot
+#define GL_APPLE_texture_2D_limited_npot 1
+#endif /* GL_APPLE_texture_2D_limited_npot */
+
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_APPLE_texture_format_BGRA8888 1
+#define GL_BGRA_EXT 0x80E1
+#define GL_BGRA8_EXT 0x93A1
+#endif /* GL_APPLE_texture_format_BGRA8888 */
+
+#ifndef GL_APPLE_texture_max_level
+#define GL_APPLE_texture_max_level 1
+#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
+#endif /* GL_APPLE_texture_max_level */
+
+#ifndef GL_ARM_rgba8
+#define GL_ARM_rgba8 1
+#endif /* GL_ARM_rgba8 */
+
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#endif /* GL_EXT_blend_minmax */
+
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+typedef char GLchar;
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+GL_API void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+GL_API void GL_APIENTRY glPopGroupMarkerEXT (void);
+#endif
+#endif /* GL_EXT_debug_marker */
+
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#define GL_COLOR_EXT 0x1800
+#define GL_DEPTH_EXT 0x1801
+#define GL_STENCIL_EXT 0x1802
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+#endif /* GL_EXT_discard_framebuffer */
+
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#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
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_API void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+#endif /* GL_EXT_map_buffer_range */
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_multi_draw_arrays */
+
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_EXT_multisampled_render_to_texture */
+
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif /* GL_EXT_read_format_bgra */
+
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_API void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_API void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_API void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+#endif /* GL_EXT_robustness */
+
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
+#endif /* GL_EXT_sRGB */
+
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif /* GL_EXT_texture_compression_dxt1 */
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif /* GL_EXT_texture_filter_anisotropic */
+
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif /* GL_EXT_texture_format_BGRA8888 */
+
+#ifndef GL_EXT_texture_lod_bias
+#define GL_EXT_texture_lod_bias 1
+#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
+#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
+#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
+#endif /* GL_EXT_texture_lod_bias */
+
+#ifndef GL_EXT_texture_storage
+#define GL_EXT_texture_storage 1
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
+#define GL_ALPHA8_EXT 0x803C
+#define GL_LUMINANCE8_EXT 0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
+#define GL_RGBA32F_EXT 0x8814
+#define GL_RGB32F_EXT 0x8815
+#define GL_ALPHA32F_EXT 0x8816
+#define GL_LUMINANCE32F_EXT 0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
+#define GL_RGBA16F_EXT 0x881A
+#define GL_RGB16F_EXT 0x881B
+#define GL_ALPHA16F_EXT 0x881C
+#define GL_LUMINANCE16F_EXT 0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
+#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
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_API void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_API void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_API void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+#endif /* GL_EXT_texture_storage */
+
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+#define GL_MAX_SAMPLES_IMG 0x9135
+#define GL_TEXTURE_SAMPLES_IMG 0x9136
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_IMG_multisampled_render_to_texture */
+
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif /* GL_IMG_read_format */
+
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif /* GL_IMG_texture_compression_pvrtc */
+
+#ifndef GL_IMG_texture_env_enhanced_fixed_function
+#define GL_IMG_texture_env_enhanced_fixed_function 1
+#define GL_MODULATE_COLOR_IMG 0x8C04
+#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05
+#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06
+#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07
+#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08
+#define GL_ADD_BLEND_IMG 0x8C09
+#define GL_DOT3_RGBA_IMG 0x86AF
+#endif /* GL_IMG_texture_env_enhanced_fixed_function */
+
+#ifndef GL_IMG_user_clip_plane
+#define GL_IMG_user_clip_plane 1
+#define GL_CLIP_PLANE0_IMG 0x3000
+#define GL_CLIP_PLANE1_IMG 0x3001
+#define GL_CLIP_PLANE2_IMG 0x3002
+#define GL_CLIP_PLANE3_IMG 0x3003
+#define GL_CLIP_PLANE4_IMG 0x3004
+#define GL_CLIP_PLANE5_IMG 0x3005
+#define GL_MAX_CLIP_PLANES_IMG 0x0D32
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glClipPlanefIMG (GLenum p, const GLfloat *eqn);
+GL_API void GL_APIENTRY glClipPlanexIMG (GLenum p, const GLfixed *eqn);
+#endif
+#endif /* GL_IMG_user_clip_plane */
+
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GL_API void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
+GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
+GL_API void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glFinishFenceNV (GLuint fence);
+GL_API void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
+#endif
+#endif /* GL_NV_fence */
+
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_API void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+#endif /* GL_QCOM_driver_control */
+
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+#define GL_STATE_RESTORE 0x8BDC
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+GL_API void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
+#endif
+#endif /* GL_QCOM_extended_get */
+
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_API void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+#endif /* GL_QCOM_extended_get2 */
+
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+#endif /* GL_QCOM_perfmon_global_mode */
+
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_API void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+#endif /* GL_QCOM_tiled_rendering */
+
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+#endif /* GL_QCOM_writeonly_rendering */
+
+/* ANGLE GLES1 extensions */
+#include "glext_angle.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/GLES/glext_angle.h b/gfx/angle/checkout/include/GLES/glext_angle.h
new file mode 100644
index 0000000000..2f8ae9208d
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES/glext_angle.h
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// glext_angle.h: ANGLE modifications to the glext.h header file.
+// Currently we don't include this file directly, we patch glext.h
+// to include it implicitly so it is visible throughout our code.
+
+#ifndef INCLUDE_GLES_GLEXT_ANGLE_H_
+#define INCLUDE_GLES_GLEXT_ANGLE_H_
+
+// clang-format off
+
+#ifndef GL_ANGLE_explicit_context_gles1
+#define GL_ANGLE_explicit_context_gles1
+typedef void *GLeglContext;
+#include "glext_explicit_context_autogen.inc"
+#endif /* GL_ANGLE_explicit_context_gles1 */
+
+// clang-format on
+
+#endif // INCLUDE_GLES_GLEXT_ANGLE_H_
diff --git a/gfx/angle/checkout/include/GLES/glext_explicit_context_autogen.inc b/gfx/angle/checkout/include/GLES/glext_explicit_context_autogen.inc
new file mode 100644
index 0000000000..c1f0c21d40
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES/glext_explicit_context_autogen.inc
@@ -0,0 +1,260 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// glext_explicit_context_autogen.inc:
+// Function declarations for the EGL_ANGLE_explicit_context extension
+
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func, GLfloat ref);
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func, GLfixed ref);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed depth);
+typedef void (GL_APIENTRYP PFNGLCLIENTACTIVETEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLenum texture);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum p, const GLfloat *eqn);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum plane, const GLfixed *equation);
+typedef void (GL_APIENTRYP PFNGLCOLOR4FCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCOLOR4UBCONTEXTANGLEPROC)(GLeglContext ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+typedef void (GL_APIENTRYP PFNGLCOLOR4XCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+typedef void (GL_APIENTRYP PFNGLCOLORPOINTERCONTEXTANGLEPROC)(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLDISABLECLIENTSTATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum array);
+typedef void (GL_APIENTRYP PFNGLENABLECLIENTSTATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum array);
+typedef void (GL_APIENTRYP PFNGLFOGFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLFOGFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLFOGXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLFOGXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum plane, GLfloat *equation);
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum plane, GLfixed *equation);
+typedef void (GL_APIENTRYP PFNGLGETFIXEDVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETLIGHTFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum light, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETLIGHTXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum light, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETMATERIALFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETMATERIALXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, void **params);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLLIGHTFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum light, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLLIGHTFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum light, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum light, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum light, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed width);
+typedef void (GL_APIENTRYP PFNGLLOADIDENTITYCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLLOADMATRIXFCONTEXTANGLEPROC)(GLeglContext ctx, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLLOADMATRIXXCONTEXTANGLEPROC)(GLeglContext ctx, const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLLOGICOPCONTEXTANGLEPROC)(GLeglContext ctx, GLenum opcode);
+typedef void (GL_APIENTRYP PFNGLMATERIALFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLMATERIALFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLMATERIALXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLMATERIALXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum pname, const GLfixed *param);
+typedef void (GL_APIENTRYP PFNGLMATRIXMODECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLMULTMATRIXFCONTEXTANGLEPROC)(GLeglContext ctx, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMULTMATRIXXCONTEXTANGLEPROC)(GLeglContext ctx, const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4FCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XCONTEXTANGLEPROC)(GLeglContext ctx, GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+typedef void (GL_APIENTRYP PFNGLNORMAL3FCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat nx, GLfloat ny, GLfloat nz);
+typedef void (GL_APIENTRYP PFNGLNORMAL3XCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed nx, GLfixed ny, GLfixed nz);
+typedef void (GL_APIENTRYP PFNGLNORMALPOINTERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLORTHOFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLORTHOXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLPOINTSIZECONTEXTANGLEPROC)(GLeglContext ctx, GLfloat size);
+typedef void (GL_APIENTRYP PFNGLPOINTSIZEXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed size);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed factor, GLfixed units);
+typedef void (GL_APIENTRYP PFNGLPOPMATRIXCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLPUSHMATRIXCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLROTATEFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLROTATEXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXCONTEXTANGLEPROC)(GLeglContext ctx, GLclampx value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCALEFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLSCALEXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLSHADEMODELCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLTEXCOORDPOINTERCONTEXTANGLEPROC)(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLTEXENVFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXENVFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXENVICONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXENVIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXENVXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXENVXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTRANSLATEFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLTRANSLATEXCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLVERTEXPOINTERCONTEXTANGLEPROC)(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint renderbuffer);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint matrixpaletteindex);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESCONTEXTANGLEPROC)(GLeglContext ctx, const GLfloat *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLint z, GLint width, GLint height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESCONTEXTANGLEPROC)(GLeglContext ctx, const GLint *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESCONTEXTANGLEPROC)(GLeglContext ctx, const GLshort *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESCONTEXTANGLEPROC)(GLeglContext ctx, const GLfixed *coords);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, GLfixed *params);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint framebuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLPOINTSIZEPOINTEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum type, GLsizei stride, const void *pointer);
+typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESCONTEXTANGLEPROC)(GLeglContext ctx, GLfixed *mantissa, GLint *exponent);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXGENFOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXGENFVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXGENIOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXGENIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXGENXOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXGENXVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum coord, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glAlphaFuncContextANGLE(GLeglContext ctx, GLenum func, GLfloat ref);
+GL_API void GL_APIENTRY glAlphaFuncxContextANGLE(GLeglContext ctx, GLenum func, GLfixed ref);
+GL_API void GL_APIENTRY glClearColorxContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glClearDepthxContextANGLE(GLeglContext ctx, GLfixed depth);
+GL_API void GL_APIENTRY glClientActiveTextureContextANGLE(GLeglContext ctx, GLenum texture);
+GL_API void GL_APIENTRY glClipPlanefContextANGLE(GLeglContext ctx, GLenum p, const GLfloat *eqn);
+GL_API void GL_APIENTRY glClipPlanexContextANGLE(GLeglContext ctx, GLenum plane, const GLfixed *equation);
+GL_API void GL_APIENTRY glColor4fContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_API void GL_APIENTRY glColor4ubContextANGLE(GLeglContext ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+GL_API void GL_APIENTRY glColor4xContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glColorPointerContextANGLE(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glDepthRangexContextANGLE(GLeglContext ctx, GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glDisableClientStateContextANGLE(GLeglContext ctx, GLenum array);
+GL_API void GL_APIENTRY glEnableClientStateContextANGLE(GLeglContext ctx, GLenum array);
+GL_API void GL_APIENTRY glFogfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glFogfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glFogxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glFogxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glFrustumfContextANGLE(GLeglContext ctx, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+GL_API void GL_APIENTRY glFrustumxContextANGLE(GLeglContext ctx, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glGetClipPlanefContextANGLE(GLeglContext ctx, GLenum plane, GLfloat *equation);
+GL_API void GL_APIENTRY glGetClipPlanexContextANGLE(GLeglContext ctx, GLenum plane, GLfixed *equation);
+GL_API void GL_APIENTRY glGetFixedvContextANGLE(GLeglContext ctx, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetLightfvContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetLightxvContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetMaterialfvContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetMaterialxvContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetPointervContextANGLE(GLeglContext ctx, GLenum pname, void **params);
+GL_API void GL_APIENTRY glGetTexEnvfvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexEnvivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexEnvxvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetTexParameterxvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glLightModelfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glLightModelfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glLightModelxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightModelxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glLightfContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glLightfvContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glLightxContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightxvContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glLineWidthxContextANGLE(GLeglContext ctx, GLfixed width);
+GL_API void GL_APIENTRY glLoadIdentityContextANGLE(GLeglContext ctx);
+GL_API void GL_APIENTRY glLoadMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m);
+GL_API void GL_APIENTRY glLoadMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m);
+GL_API void GL_APIENTRY glLogicOpContextANGLE(GLeglContext ctx, GLenum opcode);
+GL_API void GL_APIENTRY glMaterialfContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glMaterialfvContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glMaterialxContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glMaterialxvContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, const GLfixed *param);
+GL_API void GL_APIENTRY glMatrixModeContextANGLE(GLeglContext ctx, GLenum mode);
+GL_API void GL_APIENTRY glMultMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m);
+GL_API void GL_APIENTRY glMultMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m);
+GL_API void GL_APIENTRY glMultiTexCoord4fContextANGLE(GLeglContext ctx, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GL_API void GL_APIENTRY glMultiTexCoord4xContextANGLE(GLeglContext ctx, GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+GL_API void GL_APIENTRY glNormal3fContextANGLE(GLeglContext ctx, GLfloat nx, GLfloat ny, GLfloat nz);
+GL_API void GL_APIENTRY glNormal3xContextANGLE(GLeglContext ctx, GLfixed nx, GLfixed ny, GLfixed nz);
+GL_API void GL_APIENTRY glNormalPointerContextANGLE(GLeglContext ctx, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glOrthofContextANGLE(GLeglContext ctx, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+GL_API void GL_APIENTRY glOrthoxContextANGLE(GLeglContext ctx, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+GL_API void GL_APIENTRY glPointParameterfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glPointParameterfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glPointParameterxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glPointParameterxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glPointSizeContextANGLE(GLeglContext ctx, GLfloat size);
+GL_API void GL_APIENTRY glPointSizexContextANGLE(GLeglContext ctx, GLfixed size);
+GL_API void GL_APIENTRY glPolygonOffsetxContextANGLE(GLeglContext ctx, GLfixed factor, GLfixed units);
+GL_API void GL_APIENTRY glPopMatrixContextANGLE(GLeglContext ctx);
+GL_API void GL_APIENTRY glPushMatrixContextANGLE(GLeglContext ctx);
+GL_API void GL_APIENTRY glRotatefContextANGLE(GLeglContext ctx, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glRotatexContextANGLE(GLeglContext ctx, GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glSampleCoveragexContextANGLE(GLeglContext ctx, GLclampx value, GLboolean invert);
+GL_API void GL_APIENTRY glScalefContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glScalexContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glShadeModelContextANGLE(GLeglContext ctx, GLenum mode);
+GL_API void GL_APIENTRY glTexCoordPointerContextANGLE(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glTexEnvfContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexEnvfvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTexEnviContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexEnvivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glTexEnvxContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexEnvxvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTexParameterxContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexParameterxvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTranslatefContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glTranslatexContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glVertexPointerContextANGLE(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glBindFramebufferOESContextANGLE(GLeglContext ctx, GLenum target, GLuint framebuffer);
+GL_API void GL_APIENTRY glBindRenderbufferOESContextANGLE(GLeglContext ctx, GLenum target, GLuint renderbuffer);
+GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOESContextANGLE(GLeglContext ctx, GLenum target);
+GL_API void GL_APIENTRY glCurrentPaletteMatrixOESContextANGLE(GLeglContext ctx, GLuint matrixpaletteindex);
+GL_API void GL_APIENTRY glDeleteFramebuffersOESContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *framebuffers);
+GL_API void GL_APIENTRY glDeleteRenderbuffersOESContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *renderbuffers);
+GL_API void GL_APIENTRY glDrawTexfOESContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+GL_API void GL_APIENTRY glDrawTexfvOESContextANGLE(GLeglContext ctx, const GLfloat *coords);
+GL_API void GL_APIENTRY glDrawTexiOESContextANGLE(GLeglContext ctx, GLint x, GLint y, GLint z, GLint width, GLint height);
+GL_API void GL_APIENTRY glDrawTexivOESContextANGLE(GLeglContext ctx, const GLint *coords);
+GL_API void GL_APIENTRY glDrawTexsOESContextANGLE(GLeglContext ctx, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+GL_API void GL_APIENTRY glDrawTexsvOESContextANGLE(GLeglContext ctx, const GLshort *coords);
+GL_API void GL_APIENTRY glDrawTexxOESContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+GL_API void GL_APIENTRY glDrawTexxvOESContextANGLE(GLeglContext ctx, const GLfixed *coords);
+GL_API void GL_APIENTRY glFramebufferRenderbufferOESContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_API void GL_APIENTRY glFramebufferTexture2DOESContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_API void GL_APIENTRY glGenFramebuffersOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *framebuffers);
+GL_API void GL_APIENTRY glGenRenderbuffersOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *renderbuffers);
+GL_API void GL_APIENTRY glGenerateMipmapOESContextANGLE(GLeglContext ctx, GLenum target);
+GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetRenderbufferParameterivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexGenfvOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexGenivOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexGenxvOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfixed *params);
+GL_API GLboolean GL_APIENTRY glIsFramebufferOESContextANGLE(GLeglContext ctx, GLuint framebuffer);
+GL_API GLboolean GL_APIENTRY glIsRenderbufferOESContextANGLE(GLeglContext ctx, GLuint renderbuffer);
+GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOESContextANGLE(GLeglContext ctx);
+GL_API void GL_APIENTRY glMatrixIndexPointerOESContextANGLE(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_API void GL_APIENTRY glPointSizePointerOESContextANGLE(GLeglContext ctx, GLenum type, GLsizei stride, const void *pointer);
+GL_API GLbitfield GL_APIENTRY glQueryMatrixxOESContextANGLE(GLeglContext ctx, GLfixed *mantissa, GLint *exponent);
+GL_API void GL_APIENTRY glRenderbufferStorageOESContextANGLE(GLeglContext ctx, GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glTexGenfOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexGenfvOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTexGeniOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexGenivOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glTexGenxOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexGenxvOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glWeightPointerOESContextANGLE(GLeglContext ctx, GLint size, GLenum type, GLsizei stride, const void *pointer);
+#endif
diff --git a/gfx/angle/checkout/include/GLES/glplatform.h b/gfx/angle/checkout/include/GLES/glplatform.h
new file mode 100644
index 0000000000..16060a9a73
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES/glplatform.h
@@ -0,0 +1,38 @@
+#ifndef __glplatform_h_
+#define __glplatform_h_
+
+/*
+** Copyright (c) 2017 The Khronos Group Inc.
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * Please contribute modifications back to Khronos as pull requests on the
+ * public github repository:
+ * https://github.com/KhronosGroup/OpenGL-Registry
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_API
+#define GL_API KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __glplatform_h_ */
diff --git a/gfx/angle/checkout/include/GLES2/gl2.h b/gfx/angle/checkout/include/GLES2/gl2.h
new file mode 100644
index 0000000000..975c3dc495
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES2/gl2.h
@@ -0,0 +1,675 @@
+#ifndef __gl2_h_
+#define __gl2_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2017 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#include <GLES2/gl2platform.h>
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+#ifndef GL_GLES_PROTOTYPES
+#define GL_GLES_PROTOTYPES 1
+#endif
+
+/* Generated on date 20170325 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#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
+#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
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#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
+#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
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#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
+#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
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#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
+#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
+#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
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#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
+#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
+#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
+#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
+#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
+#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
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#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
+#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
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+#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
+#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
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#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
+#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
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
+typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
+typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
+typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
+typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+#if GL_GLES_PROTOTYPES
+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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *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 d);
+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 void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *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 void *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 *data);
+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 *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+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, void **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, void *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 count, const GLuint *shaders, GLenum binaryformat, const void *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 sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *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 void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+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 index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/GLES2/gl2ext.h b/gfx/angle/checkout/include/GLES2/gl2ext.h
new file mode 100644
index 0000000000..0ee082a3d0
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES2/gl2ext.h
@@ -0,0 +1,3622 @@
+#ifndef __gles2_gl2ext_h_
+#define __gles2_gl2ext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2018 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/* Generated on date 20180525 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: _nomatch_^
+ * Default extensions included: gles2
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_KHR_blend_equation_advanced
+#define GL_KHR_blend_equation_advanced 1
+#define GL_MULTIPLY_KHR 0x9294
+#define GL_SCREEN_KHR 0x9295
+#define GL_OVERLAY_KHR 0x9296
+#define GL_DARKEN_KHR 0x9297
+#define GL_LIGHTEN_KHR 0x9298
+#define GL_COLORDODGE_KHR 0x9299
+#define GL_COLORBURN_KHR 0x929A
+#define GL_HARDLIGHT_KHR 0x929B
+#define GL_SOFTLIGHT_KHR 0x929C
+#define GL_DIFFERENCE_KHR 0x929E
+#define GL_EXCLUSION_KHR 0x92A0
+#define GL_HSL_HUE_KHR 0x92AD
+#define GL_HSL_SATURATION_KHR 0x92AE
+#define GL_HSL_COLOR_KHR 0x92AF
+#define GL_HSL_LUMINOSITY_KHR 0x92B0
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
+#endif
+#endif /* GL_KHR_blend_equation_advanced */
+
+#ifndef GL_KHR_blend_equation_advanced_coherent
+#define GL_KHR_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
+#endif /* GL_KHR_blend_equation_advanced_coherent */
+
+#ifndef GL_KHR_context_flush_control
+#define GL_KHR_context_flush_control 1
+#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
+#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC
+#endif /* GL_KHR_context_flush_control */
+
+#ifndef GL_KHR_debug
+#define GL_KHR_debug 1
+typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+#define GL_SAMPLER 0x82E6
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245
+#define GL_DEBUG_SOURCE_API_KHR 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A
+#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B
+#define GL_DEBUG_TYPE_ERROR_KHR 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250
+#define GL_DEBUG_TYPE_OTHER_KHR 0x8251
+#define GL_DEBUG_TYPE_MARKER_KHR 0x8268
+#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269
+#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A
+#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
+#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D
+#define GL_BUFFER_KHR 0x82E0
+#define GL_SHADER_KHR 0x82E1
+#define GL_PROGRAM_KHR 0x82E2
+#define GL_VERTEX_ARRAY_KHR 0x8074
+#define GL_QUERY_KHR 0x82E3
+#define GL_PROGRAM_PIPELINE_KHR 0x82E4
+#define GL_SAMPLER_KHR 0x82E6
+#define GL_MAX_LABEL_LENGTH_KHR 0x82E8
+#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145
+#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147
+#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148
+#define GL_DEBUG_OUTPUT_KHR 0x92E0
+#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
+#define GL_STACK_OVERFLOW_KHR 0x0503
+#define GL_STACK_UNDERFLOW_KHR 0x0504
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
+typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
+GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
+GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
+#endif
+#endif /* GL_KHR_debug */
+
+#ifndef GL_KHR_no_error
+#define GL_KHR_no_error 1
+#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
+#endif /* GL_KHR_no_error */
+
+#ifndef GL_KHR_parallel_shader_compile
+#define GL_KHR_parallel_shader_compile 1
+#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0
+#define GL_COMPLETION_STATUS_KHR 0x91B1
+typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count);
+#endif
+#endif /* GL_KHR_parallel_shader_compile */
+
+#ifndef GL_KHR_robust_buffer_access_behavior
+#define GL_KHR_robust_buffer_access_behavior 1
+#endif /* GL_KHR_robust_buffer_access_behavior */
+
+#ifndef GL_KHR_robustness
+#define GL_KHR_robustness 1
+#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
+#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
+#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
+#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
+#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
+#define GL_CONTEXT_LOST_KHR 0x0507
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#endif
+#endif /* GL_KHR_robustness */
+
+#ifndef GL_KHR_texture_compression_astc_hdr
+#define GL_KHR_texture_compression_astc_hdr 1
+#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 /* GL_KHR_texture_compression_astc_hdr */
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_KHR_texture_compression_astc_ldr 1
+#endif /* GL_KHR_texture_compression_astc_ldr */
+
+#ifndef GL_KHR_texture_compression_astc_sliced_3d
+#define GL_KHR_texture_compression_astc_sliced_3d 1
+#endif /* GL_KHR_texture_compression_astc_sliced_3d */
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+typedef void *GLeglImageOES;
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+#endif /* GL_OES_EGL_image */
+
+#ifndef GL_OES_EGL_image_external
+#define GL_OES_EGL_image_external 1
+#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
+#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
+#define GL_SAMPLER_EXTERNAL_OES 0x8D66
+#endif /* GL_OES_EGL_image_external */
+
+#ifndef GL_OES_EGL_image_external_essl3
+#define GL_OES_EGL_image_external_essl3 1
+#endif /* GL_OES_EGL_image_external_essl3 */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
+#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
+#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif /* GL_OES_compressed_ETC1_RGB8_texture */
+
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif /* GL_OES_compressed_paletted_texture */
+
+#ifndef GL_OES_copy_image
+#define GL_OES_copy_image 1
+typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyImageSubDataOES (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif
+#endif /* GL_OES_copy_image */
+
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif /* GL_OES_depth24 */
+
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif /* GL_OES_depth32 */
+
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif /* GL_OES_depth_texture */
+
+#ifndef GL_OES_draw_buffers_indexed
+#define GL_OES_draw_buffers_indexed 1
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+typedef void (GL_APIENTRYP PFNGLENABLEIOESPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEIOESPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEnableiOES (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiOES (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glBlendEquationiOES (GLuint buf, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparateiOES (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunciOES (GLuint buf, GLenum src, GLenum dst);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparateiOES (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glColorMaskiOES (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index);
+#endif
+#endif /* GL_OES_draw_buffers_indexed */
+
+#ifndef GL_OES_draw_elements_base_vertex
+#define GL_OES_draw_elements_base_vertex 1
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
+#endif
+#endif /* GL_OES_draw_elements_base_vertex */
+
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif /* GL_OES_element_index_uint */
+
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif /* GL_OES_fbo_render_mipmap */
+
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif /* GL_OES_fragment_precision_high */
+
+#ifndef GL_OES_geometry_point_size
+#define GL_OES_geometry_point_size 1
+#endif /* GL_OES_geometry_point_size */
+
+#ifndef GL_OES_geometry_shader
+#define GL_OES_geometry_shader 1
+#define GL_GEOMETRY_SHADER_OES 0x8DD9
+#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004
+#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916
+#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917
+#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918
+#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F
+#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E
+#define GL_LINES_ADJACENCY_OES 0x000A
+#define GL_LINE_STRIP_ADJACENCY_OES 0x000B
+#define GL_TRIANGLES_ADJACENCY_OES 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7
+#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E
+#define GL_UNDEFINED_VERTEX_OES 0x8260
+#define GL_PRIMITIVES_GENERATED_OES 0x8C87
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312
+#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7
+#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureOES (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+#endif /* GL_OES_geometry_shader */
+
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#endif
+#endif /* GL_OES_get_program_binary */
+
+#ifndef GL_OES_gpu_shader5
+#define GL_OES_gpu_shader5 1
+#endif /* GL_OES_gpu_shader5 */
+
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
+#endif
+#endif /* GL_OES_mapbuffer */
+
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif /* GL_OES_packed_depth_stencil */
+
+#ifndef GL_OES_primitive_bounding_box
+#define GL_OES_primitive_bounding_box 1
+#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE
+typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxOES (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#endif
+#endif /* GL_OES_primitive_bounding_box */
+
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#define GL_ALPHA8_OES 0x803C
+#define GL_DEPTH_COMPONENT16_OES 0x81A5
+#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
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#define GL_RGB10_EXT 0x8052
+#define GL_RGB10_A2_EXT 0x8059
+#endif /* GL_OES_required_internalformat */
+
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif /* GL_OES_rgb8_rgba8 */
+
+#ifndef GL_OES_sample_shading
+#define GL_OES_sample_shading 1
+#define GL_SAMPLE_SHADING_OES 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37
+typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
+#endif
+#endif /* GL_OES_sample_shading */
+
+#ifndef GL_OES_sample_variables
+#define GL_OES_sample_variables 1
+#endif /* GL_OES_sample_variables */
+
+#ifndef GL_OES_shader_image_atomic
+#define GL_OES_shader_image_atomic 1
+#endif /* GL_OES_shader_image_atomic */
+
+#ifndef GL_OES_shader_io_blocks
+#define GL_OES_shader_io_blocks 1
+#endif /* GL_OES_shader_io_blocks */
+
+#ifndef GL_OES_shader_multisample_interpolation
+#define GL_OES_shader_multisample_interpolation 1
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
+#endif /* GL_OES_shader_multisample_interpolation */
+
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+#endif /* GL_OES_standard_derivatives */
+
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif /* GL_OES_stencil1 */
+
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif /* GL_OES_stencil4 */
+
+#ifndef GL_OES_surfaceless_context
+#define GL_OES_surfaceless_context 1
+#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
+#endif /* GL_OES_surfaceless_context */
+
+#ifndef GL_OES_tessellation_point_size
+#define GL_OES_tessellation_point_size 1
+#endif /* GL_OES_tessellation_point_size */
+
+#ifndef GL_OES_tessellation_shader
+#define GL_OES_tessellation_shader 1
+#define GL_PATCHES_OES 0x000E
+#define GL_PATCH_VERTICES_OES 0x8E72
+#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75
+#define GL_TESS_GEN_MODE_OES 0x8E76
+#define GL_TESS_GEN_SPACING_OES 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78
+#define GL_TESS_GEN_POINT_MODE_OES 0x8E79
+#define GL_ISOLINES_OES 0x8E7A
+#define GL_QUADS_OES 0x0007
+#define GL_FRACTIONAL_ODD_OES 0x8E7B
+#define GL_FRACTIONAL_EVEN_OES 0x8E7C
+#define GL_MAX_PATCH_VERTICES_OES 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221
+#define GL_IS_PER_PATCH_OES 0x92E7
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308
+#define GL_TESS_CONTROL_SHADER_OES 0x8E88
+#define GL_TESS_EVALUATION_SHADER_OES 0x8E87
+#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010
+typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPatchParameteriOES (GLenum pname, GLint value);
+#endif
+#endif /* GL_OES_tessellation_shader */
+
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#define GL_TEXTURE_WRAP_R_OES 0x8072
+#define GL_TEXTURE_3D_OES 0x806F
+#define GL_TEXTURE_BINDING_3D_OES 0x806A
+#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
+#define GL_SAMPLER_3D_OES 0x8B5F
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+#endif /* GL_OES_texture_3D */
+
+#ifndef GL_OES_texture_border_clamp
+#define GL_OES_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_OES 0x1004
+#define GL_CLAMP_TO_BORDER_OES 0x812D
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexParameterIivOES (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivOES (GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivOES (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivOES (GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivOES (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivOES (GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOES (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOES (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+#endif /* GL_OES_texture_border_clamp */
+
+#ifndef GL_OES_texture_buffer
+#define GL_OES_texture_buffer 1
+#define GL_TEXTURE_BUFFER_OES 0x8C2A
+#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F
+#define GL_SAMPLER_BUFFER_OES 0x8DC2
+#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8
+#define GL_IMAGE_BUFFER_OES 0x9051
+#define GL_INT_IMAGE_BUFFER_OES 0x905C
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067
+#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D
+#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E
+typedef void (GL_APIENTRYP PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexBufferOES (GLenum target, GLenum internalformat, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTexBufferRangeOES (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif
+#endif /* GL_OES_texture_buffer */
+
+#ifndef GL_OES_texture_compression_astc
+#define GL_OES_texture_compression_astc 1
+#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0
+#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1
+#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2
+#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3
+#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4
+#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5
+#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6
+#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7
+#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8
+#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9
+#endif /* GL_OES_texture_compression_astc */
+
+#ifndef GL_OES_texture_cube_map_array
+#define GL_OES_texture_cube_map_array 1
+#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A
+#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F
+#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A
+#endif /* GL_OES_texture_cube_map_array */
+
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif /* GL_OES_texture_float */
+
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif /* GL_OES_texture_float_linear */
+
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif /* GL_OES_texture_half_float */
+
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif /* GL_OES_texture_half_float_linear */
+
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif /* GL_OES_texture_npot */
+
+#ifndef GL_OES_texture_stencil8
+#define GL_OES_texture_stencil8 1
+#define GL_STENCIL_INDEX_OES 0x1901
+#define GL_STENCIL_INDEX8_OES 0x8D48
+#endif /* GL_OES_texture_stencil8 */
+
+#ifndef GL_OES_texture_storage_multisample_2d_array
+#define GL_OES_texture_storage_multisample_2d_array 1
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_OES_texture_storage_multisample_2d_array */
+
+#ifndef GL_OES_texture_view
+#define GL_OES_texture_view 1
+#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB
+#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC
+#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD
+#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTextureViewOES (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif
+#endif /* GL_OES_texture_view */
+
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+#endif /* GL_OES_vertex_array_object */
+
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif /* GL_OES_vertex_half_float */
+
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
+#define GL_INT_10_10_10_2_OES 0x8DF7
+#endif /* GL_OES_vertex_type_10_10_10_2 */
+
+#ifndef GL_OES_viewport_array
+#define GL_OES_viewport_array 1
+#define GL_MAX_VIEWPORTS_OES 0x825B
+#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C
+#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D
+#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F
+typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v);
+GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data);
+#endif
+#endif /* GL_OES_viewport_array */
+
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif /* GL_AMD_compressed_3DC_texture */
+
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif /* GL_AMD_compressed_ATC_texture */
+
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
+typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
+GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+#endif /* GL_AMD_performance_monitor */
+
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#define GL_Z400_BINARY_AMD 0x8740
+#endif /* GL_AMD_program_binary_Z400 */
+
+#ifndef GL_ANDROID_extension_pack_es31a
+#define GL_ANDROID_extension_pack_es31a 1
+#endif /* GL_ANDROID_extension_pack_es31a */
+
+#ifndef GL_ANGLE_depth_texture
+#define GL_ANGLE_depth_texture 1
+#endif /* GL_ANGLE_depth_texture */
+
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_ANGLE_framebuffer_blit 1
+#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_ANGLE_framebuffer_blit */
+
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_ANGLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
+#define GL_MAX_SAMPLES_ANGLE 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ANGLE_framebuffer_multisample */
+
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_ANGLE_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+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);
+#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
+#endif /* GL_ANGLE_instanced_arrays */
+
+#ifndef GL_ANGLE_pack_reverse_row_order
+#define GL_ANGLE_pack_reverse_row_order 1
+#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
+#endif /* GL_ANGLE_pack_reverse_row_order */
+
+#ifndef GL_ANGLE_program_binary
+#define GL_ANGLE_program_binary 1
+#define GL_PROGRAM_BINARY_ANGLE 0x93A6
+#endif /* GL_ANGLE_program_binary */
+
+#ifndef GL_ANGLE_texture_compression_dxt3
+#define GL_ANGLE_texture_compression_dxt3 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
+#endif /* GL_ANGLE_texture_compression_dxt3 */
+
+#ifndef GL_ANGLE_texture_compression_dxt5
+#define GL_ANGLE_texture_compression_dxt5 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
+#endif /* GL_ANGLE_texture_compression_dxt5 */
+
+#ifndef GL_ANGLE_texture_usage
+#define GL_ANGLE_texture_usage 1
+#define GL_TEXTURE_USAGE_ANGLE 0x93A2
+#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
+#endif /* GL_ANGLE_texture_usage */
+
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_ANGLE_translated_shader_source 1
+#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
+typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#endif
+#endif /* GL_ANGLE_translated_shader_source */
+
+#ifndef GL_APPLE_clip_distance
+#define GL_APPLE_clip_distance 1
+#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32
+#define GL_CLIP_DISTANCE0_APPLE 0x3000
+#define GL_CLIP_DISTANCE1_APPLE 0x3001
+#define GL_CLIP_DISTANCE2_APPLE 0x3002
+#define GL_CLIP_DISTANCE3_APPLE 0x3003
+#define GL_CLIP_DISTANCE4_APPLE 0x3004
+#define GL_CLIP_DISTANCE5_APPLE 0x3005
+#define GL_CLIP_DISTANCE6_APPLE 0x3006
+#define GL_CLIP_DISTANCE7_APPLE 0x3007
+#endif /* GL_APPLE_clip_distance */
+
+#ifndef GL_APPLE_color_buffer_packed_float
+#define GL_APPLE_color_buffer_packed_float 1
+#endif /* GL_APPLE_color_buffer_packed_float */
+
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+#endif /* GL_APPLE_copy_texture_levels */
+
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_APPLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+#define GL_MAX_SAMPLES_APPLE 0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+#endif
+#endif /* GL_APPLE_framebuffer_multisample */
+
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#define GL_RGB_422_APPLE 0x8A1F
+#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+#define GL_RGB_RAW_422_APPLE 0x8A51
+#endif /* GL_APPLE_rgb_422 */
+
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+#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
+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);
+#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
+#endif /* GL_APPLE_sync */
+
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_APPLE_texture_format_BGRA8888 1
+#define GL_BGRA_EXT 0x80E1
+#define GL_BGRA8_EXT 0x93A1
+#endif /* GL_APPLE_texture_format_BGRA8888 */
+
+#ifndef GL_APPLE_texture_max_level
+#define GL_APPLE_texture_max_level 1
+#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
+#endif /* GL_APPLE_texture_max_level */
+
+#ifndef GL_APPLE_texture_packed_float
+#define GL_APPLE_texture_packed_float 1
+#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B
+#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E
+#define GL_R11F_G11F_B10F_APPLE 0x8C3A
+#define GL_RGB9_E5_APPLE 0x8C3D
+#endif /* GL_APPLE_texture_packed_float */
+
+#ifndef GL_ARM_mali_program_binary
+#define GL_ARM_mali_program_binary 1
+#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
+#endif /* GL_ARM_mali_program_binary */
+
+#ifndef GL_ARM_mali_shader_binary
+#define GL_ARM_mali_shader_binary 1
+#define GL_MALI_SHADER_BINARY_ARM 0x8F60
+#endif /* GL_ARM_mali_shader_binary */
+
+#ifndef GL_ARM_rgba8
+#define GL_ARM_rgba8 1
+#endif /* GL_ARM_rgba8 */
+
+#ifndef GL_ARM_shader_framebuffer_fetch
+#define GL_ARM_shader_framebuffer_fetch 1
+#define GL_FETCH_PER_SAMPLE_ARM 0x8F65
+#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
+#endif /* GL_ARM_shader_framebuffer_fetch */
+
+#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
+#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
+#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
+
+#ifndef GL_DMP_program_binary
+#define GL_DMP_program_binary 1
+#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251
+#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252
+#define GL_DMP_PROGRAM_BINARY_DMP 0x9253
+#endif /* GL_DMP_program_binary */
+
+#ifndef GL_DMP_shader_binary
+#define GL_DMP_shader_binary 1
+#define GL_SHADER_BINARY_DMP 0x9250
+#endif /* GL_DMP_shader_binary */
+
+#ifndef GL_EXT_EGL_image_array
+#define GL_EXT_EGL_image_array 1
+#endif /* GL_EXT_EGL_image_array */
+
+#ifndef GL_EXT_EGL_image_storage
+#define GL_EXT_EGL_image_storage 1
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC) (GLenum target, GLeglImageOES image, const GLint* attrib_list);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC) (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexStorageEXT (GLenum target, GLeglImageOES image, const GLint* attrib_list);
+GL_APICALL void GL_APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
+#endif
+#endif /* GL_EXT_EGL_image_storage */
+
+#ifndef GL_EXT_YUV_target
+#define GL_EXT_YUV_target 1
+#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7
+#endif /* GL_EXT_YUV_target */
+
+#ifndef GL_EXT_base_instance
+#define GL_EXT_base_instance 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceEXT (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
+#endif
+#endif /* GL_EXT_base_instance */
+
+#ifndef GL_EXT_blend_func_extended
+#define GL_EXT_blend_func_extended 1
+#define GL_SRC1_COLOR_EXT 0x88F9
+#define GL_SRC1_ALPHA_EXT 0x8589
+#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA
+#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB
+#define GL_SRC_ALPHA_SATURATE_EXT 0x0308
+#define GL_LOCATION_INDEX_EXT 0x930F
+#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC
+typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
+typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLuint program, const GLchar *name);
+#endif
+#endif /* GL_EXT_blend_func_extended */
+
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#endif /* GL_EXT_blend_minmax */
+
+#ifndef GL_EXT_buffer_storage
+#define GL_EXT_buffer_storage 1
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_PERSISTENT_BIT_EXT 0x0040
+#define GL_MAP_COHERENT_BIT_EXT 0x0080
+#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100
+#define GL_CLIENT_STORAGE_BIT_EXT 0x0200
+#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000
+#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F
+#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220
+typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
+#endif
+#endif /* GL_EXT_buffer_storage */
+
+#ifndef GL_EXT_clear_texture
+#define GL_EXT_clear_texture 1
+typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
+typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
+GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
+#endif
+#endif /* GL_EXT_clear_texture */
+
+#ifndef GL_EXT_clip_control
+#define GL_EXT_clip_control 1
+#define GL_LOWER_LEFT_EXT 0x8CA1
+#define GL_UPPER_LEFT_EXT 0x8CA2
+#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E
+#define GL_ZERO_TO_ONE_EXT 0x935F
+#define GL_CLIP_ORIGIN_EXT 0x935C
+#define GL_CLIP_DEPTH_MODE_EXT 0x935D
+typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth);
+#endif
+#endif /* GL_EXT_clip_control */
+
+#ifndef GL_EXT_clip_cull_distance
+#define GL_EXT_clip_cull_distance 1
+#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32
+#define GL_MAX_CULL_DISTANCES_EXT 0x82F9
+#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA
+#define GL_CLIP_DISTANCE0_EXT 0x3000
+#define GL_CLIP_DISTANCE1_EXT 0x3001
+#define GL_CLIP_DISTANCE2_EXT 0x3002
+#define GL_CLIP_DISTANCE3_EXT 0x3003
+#define GL_CLIP_DISTANCE4_EXT 0x3004
+#define GL_CLIP_DISTANCE5_EXT 0x3005
+#define GL_CLIP_DISTANCE6_EXT 0x3006
+#define GL_CLIP_DISTANCE7_EXT 0x3007
+#endif /* GL_EXT_clip_cull_distance */
+
+#ifndef GL_EXT_color_buffer_float
+#define GL_EXT_color_buffer_float 1
+#endif /* GL_EXT_color_buffer_float */
+
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_EXT_color_buffer_half_float 1
+#define GL_RGBA16F_EXT 0x881A
+#define GL_RGB16F_EXT 0x881B
+#define GL_RG16F_EXT 0x822F
+#define GL_R16F_EXT 0x822D
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
+#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
+#endif /* GL_EXT_color_buffer_half_float */
+
+#ifndef GL_EXT_conservative_depth
+#define GL_EXT_conservative_depth 1
+#endif /* GL_EXT_conservative_depth */
+
+#ifndef GL_EXT_copy_image
+#define GL_EXT_copy_image 1
+typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif
+#endif /* GL_EXT_copy_image */
+
+#ifndef GL_EXT_debug_label
+#define GL_EXT_debug_label 1
+#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
+#define GL_PROGRAM_OBJECT_EXT 0x8B40
+#define GL_SHADER_OBJECT_EXT 0x8B48
+#define GL_BUFFER_OBJECT_EXT 0x9151
+#define GL_QUERY_OBJECT_EXT 0x9153
+#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+#endif /* GL_EXT_debug_label */
+
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
+#endif
+#endif /* GL_EXT_debug_marker */
+
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#define GL_COLOR_EXT 0x1800
+#define GL_DEPTH_EXT 0x1801
+#define GL_STENCIL_EXT 0x1802
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+#endif /* GL_EXT_discard_framebuffer */
+
+#ifndef GL_EXT_disjoint_timer_query
+#define GL_EXT_disjoint_timer_query 1
+#define GL_QUERY_COUNTER_BITS_EXT 0x8864
+#define GL_CURRENT_QUERY_EXT 0x8865
+#define GL_QUERY_RESULT_EXT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
+#define GL_TIME_ELAPSED_EXT 0x88BF
+#define GL_TIMESTAMP_EXT 0x8E28
+#define GL_GPU_DISJOINT_EXT 0x8FBB
+typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
+#endif
+#endif /* GL_EXT_disjoint_timer_query */
+
+#ifndef GL_EXT_draw_buffers
+#define GL_EXT_draw_buffers 1
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
+#define GL_DRAW_BUFFER0_EXT 0x8825
+#define GL_DRAW_BUFFER1_EXT 0x8826
+#define GL_DRAW_BUFFER2_EXT 0x8827
+#define GL_DRAW_BUFFER3_EXT 0x8828
+#define GL_DRAW_BUFFER4_EXT 0x8829
+#define GL_DRAW_BUFFER5_EXT 0x882A
+#define GL_DRAW_BUFFER6_EXT 0x882B
+#define GL_DRAW_BUFFER7_EXT 0x882C
+#define GL_DRAW_BUFFER8_EXT 0x882D
+#define GL_DRAW_BUFFER9_EXT 0x882E
+#define GL_DRAW_BUFFER10_EXT 0x882F
+#define GL_DRAW_BUFFER11_EXT 0x8830
+#define GL_DRAW_BUFFER12_EXT 0x8831
+#define GL_DRAW_BUFFER13_EXT 0x8832
+#define GL_DRAW_BUFFER14_EXT 0x8833
+#define GL_DRAW_BUFFER15_EXT 0x8834
+#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_EXT_draw_buffers */
+
+#ifndef GL_EXT_draw_buffers_indexed
+#define GL_EXT_draw_buffers_indexed 1
+typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index);
+#endif
+#endif /* GL_EXT_draw_buffers_indexed */
+
+#ifndef GL_EXT_draw_elements_base_vertex
+#define GL_EXT_draw_elements_base_vertex 1
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+#endif
+#endif /* GL_EXT_draw_elements_base_vertex */
+
+#ifndef GL_EXT_draw_instanced
+#define GL_EXT_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_draw_instanced */
+
+#ifndef GL_EXT_draw_transform_feedback
+#define GL_EXT_draw_transform_feedback 1
+typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id);
+typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id);
+GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount);
+#endif
+#endif /* GL_EXT_draw_transform_feedback */
+
+#ifndef GL_EXT_external_buffer
+#define GL_EXT_external_buffer 1
+typedef void *GLeglClientBufferEXT;
+typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
+#endif
+#endif /* GL_EXT_external_buffer */
+
+#ifndef GL_EXT_float_blend
+#define GL_EXT_float_blend 1
+#endif /* GL_EXT_float_blend */
+
+#ifndef GL_EXT_geometry_point_size
+#define GL_EXT_geometry_point_size 1
+#endif /* GL_EXT_geometry_point_size */
+
+#ifndef GL_EXT_geometry_shader
+#define GL_EXT_geometry_shader 1
+#define GL_GEOMETRY_SHADER_EXT 0x8DD9
+#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004
+#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916
+#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917
+#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918
+#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F
+#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E
+#define GL_LINES_ADJACENCY_EXT 0x000A
+#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
+#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7
+#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
+#define GL_UNDEFINED_VERTEX_EXT 0x8260
+#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312
+#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
+#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+#endif /* GL_EXT_geometry_shader */
+
+#ifndef GL_EXT_gpu_shader5
+#define GL_EXT_gpu_shader5 1
+#endif /* GL_EXT_gpu_shader5 */
+
+#ifndef GL_EXT_instanced_arrays
+#define GL_EXT_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_EXT_instanced_arrays */
+
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#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
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#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
+#endif /* GL_EXT_map_buffer_range */
+
+#ifndef GL_EXT_memory_object
+#define GL_EXT_memory_object 1
+#define GL_TEXTURE_TILING_EXT 0x9580
+#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581
+#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B
+#define GL_NUM_TILING_TYPES_EXT 0x9582
+#define GL_TILING_TYPES_EXT 0x9583
+#define GL_OPTIMAL_TILING_EXT 0x9584
+#define GL_LINEAR_TILING_EXT 0x9585
+#define GL_NUM_DEVICE_UUIDS_EXT 0x9596
+#define GL_DEVICE_UUID_EXT 0x9597
+#define GL_DRIVER_UUID_EXT 0x9598
+#define GL_UUID_SIZE_EXT 16
+typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data);
+typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data);
+typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects);
+typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject);
+typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects);
+typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data);
+GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data);
+GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects);
+GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject);
+GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects);
+GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
+#endif
+#endif /* GL_EXT_memory_object */
+
+#ifndef GL_EXT_memory_object_fd
+#define GL_EXT_memory_object_fd 1
+#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586
+typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
+#endif
+#endif /* GL_EXT_memory_object_fd */
+
+#ifndef GL_EXT_memory_object_win32
+#define GL_EXT_memory_object_win32 1
+#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587
+#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588
+#define GL_DEVICE_LUID_EXT 0x9599
+#define GL_DEVICE_NODE_MASK_EXT 0x959A
+#define GL_LUID_SIZE_EXT 8
+#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589
+#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A
+#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B
+#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C
+typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
+typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
+GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
+#endif
+#endif /* GL_EXT_memory_object_win32 */
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_multi_draw_arrays */
+
+#ifndef GL_EXT_multi_draw_indirect
+#define GL_EXT_multi_draw_indirect 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysIndirectEXT (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsIndirectEXT (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
+#endif
+#endif /* GL_EXT_multi_draw_indirect */
+
+#ifndef GL_EXT_multisampled_compatibility
+#define GL_EXT_multisampled_compatibility 1
+#define GL_MULTISAMPLE_EXT 0x809D
+#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
+#endif /* GL_EXT_multisampled_compatibility */
+
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_EXT_multisampled_render_to_texture */
+
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_EXT_multiview_draw_buffers 1
+#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
+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);
+#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
+#endif /* GL_EXT_multiview_draw_buffers */
+
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_EXT_occlusion_query_boolean 1
+#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
+#endif /* GL_EXT_occlusion_query_boolean */
+
+#ifndef GL_EXT_polygon_offset_clamp
+#define GL_EXT_polygon_offset_clamp 1
+#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp);
+#endif
+#endif /* GL_EXT_polygon_offset_clamp */
+
+#ifndef GL_EXT_post_depth_coverage
+#define GL_EXT_post_depth_coverage 1
+#endif /* GL_EXT_post_depth_coverage */
+
+#ifndef GL_EXT_primitive_bounding_box
+#define GL_EXT_primitive_bounding_box 1
+#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE
+typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#endif
+#endif /* GL_EXT_primitive_bounding_box */
+
+#ifndef GL_EXT_protected_textures
+#define GL_EXT_protected_textures 1
+#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010
+#define GL_TEXTURE_PROTECTED_EXT 0x8BFA
+#endif /* GL_EXT_protected_textures */
+
+#ifndef GL_EXT_pvrtc_sRGB
+#define GL_EXT_pvrtc_sRGB 1
+#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
+#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1
+#endif /* GL_EXT_pvrtc_sRGB */
+
+#ifndef GL_EXT_raster_multisample
+#define GL_EXT_raster_multisample 1
+#define GL_RASTER_MULTISAMPLE_EXT 0x9327
+#define GL_RASTER_SAMPLES_EXT 0x9328
+#define GL_MAX_RASTER_SAMPLES_EXT 0x9329
+#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A
+#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B
+#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C
+typedef void (GL_APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_EXT_raster_multisample */
+
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif /* GL_EXT_read_format_bgra */
+
+#ifndef GL_EXT_render_snorm
+#define GL_EXT_render_snorm 1
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_R16_SNORM_EXT 0x8F98
+#define GL_RG16_SNORM_EXT 0x8F99
+#define GL_RGBA16_SNORM_EXT 0x8F9B
+#endif /* GL_EXT_render_snorm */
+
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+#endif /* GL_EXT_robustness */
+
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
+#endif /* GL_EXT_sRGB */
+
+#ifndef GL_EXT_sRGB_write_control
+#define GL_EXT_sRGB_write_control 1
+#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
+#endif /* GL_EXT_sRGB_write_control */
+
+#ifndef GL_EXT_semaphore
+#define GL_EXT_semaphore 1
+#define GL_LAYOUT_GENERAL_EXT 0x958D
+#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E
+#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F
+#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590
+#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591
+#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592
+#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593
+#define GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT 0x9530
+#define GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT 0x9531
+typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores);
+typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores);
+typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore);
+typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params);
+typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
+typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores);
+GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores);
+GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore);
+GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params);
+GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params);
+GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
+GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
+#endif
+#endif /* GL_EXT_semaphore */
+
+#ifndef GL_EXT_semaphore_fd
+#define GL_EXT_semaphore_fd 1
+typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd);
+#endif
+#endif /* GL_EXT_semaphore_fd */
+
+#ifndef GL_EXT_semaphore_win32
+#define GL_EXT_semaphore_win32 1
+#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594
+#define GL_D3D12_FENCE_VALUE_EXT 0x9595
+typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle);
+typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle);
+GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name);
+#endif
+#endif /* GL_EXT_semaphore_win32 */
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#define GL_ACTIVE_PROGRAM_EXT 0x8259
+#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
+#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE_EXT 0x8258
+#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
+GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_EXT_separate_shader_objects */
+
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_EXT_shader_framebuffer_fetch 1
+#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
+#endif /* GL_EXT_shader_framebuffer_fetch */
+
+#ifndef GL_EXT_shader_framebuffer_fetch_non_coherent
+#define GL_EXT_shader_framebuffer_fetch_non_coherent 1
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierEXT (void);
+#endif
+#endif /* GL_EXT_shader_framebuffer_fetch_non_coherent */
+
+#ifndef GL_EXT_shader_group_vote
+#define GL_EXT_shader_group_vote 1
+#endif /* GL_EXT_shader_group_vote */
+
+#ifndef GL_EXT_shader_implicit_conversions
+#define GL_EXT_shader_implicit_conversions 1
+#endif /* GL_EXT_shader_implicit_conversions */
+
+#ifndef GL_EXT_shader_integer_mix
+#define GL_EXT_shader_integer_mix 1
+#endif /* GL_EXT_shader_integer_mix */
+
+#ifndef GL_EXT_shader_io_blocks
+#define GL_EXT_shader_io_blocks 1
+#endif /* GL_EXT_shader_io_blocks */
+
+#ifndef GL_EXT_shader_non_constant_global_initializers
+#define GL_EXT_shader_non_constant_global_initializers 1
+#endif /* GL_EXT_shader_non_constant_global_initializers */
+
+#ifndef GL_EXT_shader_pixel_local_storage
+#define GL_EXT_shader_pixel_local_storage 1
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
+#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
+#endif /* GL_EXT_shader_pixel_local_storage */
+
+#ifndef GL_EXT_shader_pixel_local_storage2
+#define GL_EXT_shader_pixel_local_storage2 1
+#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650
+#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651
+#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size);
+typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target);
+typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size);
+GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target);
+GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values);
+#endif
+#endif /* GL_EXT_shader_pixel_local_storage2 */
+
+#ifndef GL_EXT_shader_texture_lod
+#define GL_EXT_shader_texture_lod 1
+#endif /* GL_EXT_shader_texture_lod */
+
+#ifndef GL_EXT_shadow_samplers
+#define GL_EXT_shadow_samplers 1
+#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
+#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
+#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
+#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
+#endif /* GL_EXT_shadow_samplers */
+
+#ifndef GL_EXT_sparse_texture
+#define GL_EXT_sparse_texture 1
+#define GL_TEXTURE_SPARSE_EXT 0x91A6
+#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7
+#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA
+#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8
+#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195
+#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196
+#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_3D 0x806F
+#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198
+#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199
+#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A
+#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9
+typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
+#endif
+#endif /* GL_EXT_sparse_texture */
+
+#ifndef GL_EXT_sparse_texture2
+#define GL_EXT_sparse_texture2 1
+#endif /* GL_EXT_sparse_texture2 */
+
+#ifndef GL_EXT_tessellation_point_size
+#define GL_EXT_tessellation_point_size 1
+#endif /* GL_EXT_tessellation_point_size */
+
+#ifndef GL_EXT_tessellation_shader
+#define GL_EXT_tessellation_shader 1
+#define GL_PATCHES_EXT 0x000E
+#define GL_PATCH_VERTICES_EXT 0x8E72
+#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75
+#define GL_TESS_GEN_MODE_EXT 0x8E76
+#define GL_TESS_GEN_SPACING_EXT 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78
+#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79
+#define GL_ISOLINES_EXT 0x8E7A
+#define GL_QUADS_EXT 0x0007
+#define GL_FRACTIONAL_ODD_EXT 0x8E7B
+#define GL_FRACTIONAL_EVEN_EXT 0x8E7C
+#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
+#define GL_IS_PER_PATCH_EXT 0x92E7
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308
+#define GL_TESS_CONTROL_SHADER_EXT 0x8E88
+#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87
+#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010
+typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value);
+#endif
+#endif /* GL_EXT_tessellation_shader */
+
+#ifndef GL_EXT_texture_border_clamp
+#define GL_EXT_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004
+#define GL_CLAMP_TO_BORDER_EXT 0x812D
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+#endif /* GL_EXT_texture_border_clamp */
+
+#ifndef GL_EXT_texture_buffer
+#define GL_EXT_texture_buffer 1
+#define GL_TEXTURE_BUFFER_EXT 0x8C2A
+#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F
+#define GL_SAMPLER_BUFFER_EXT 0x8DC2
+#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
+#define GL_IMAGE_BUFFER_EXT 0x9051
+#define GL_INT_IMAGE_BUFFER_EXT 0x905C
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
+#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D
+#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E
+typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif
+#endif /* GL_EXT_texture_buffer */
+
+#ifndef GL_EXT_texture_compression_astc_decode_mode
+#define GL_EXT_texture_compression_astc_decode_mode 1
+#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69
+#endif /* GL_EXT_texture_compression_astc_decode_mode */
+
+#ifndef GL_EXT_texture_compression_bptc
+#define GL_EXT_texture_compression_bptc 1
+#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C
+#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D
+#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E
+#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F
+#endif /* GL_EXT_texture_compression_bptc */
+
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif /* GL_EXT_texture_compression_dxt1 */
+
+#ifndef GL_EXT_texture_compression_rgtc
+#define GL_EXT_texture_compression_rgtc 1
+#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
+#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
+#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
+#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
+#endif /* GL_EXT_texture_compression_rgtc */
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+#endif /* GL_EXT_texture_compression_s3tc */
+
+#ifndef GL_EXT_texture_compression_s3tc_srgb
+#define GL_EXT_texture_compression_s3tc_srgb 1
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif /* GL_EXT_texture_compression_s3tc_srgb */
+
+#ifndef GL_EXT_texture_cube_map_array
+#define GL_EXT_texture_cube_map_array 1
+#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A
+#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F
+#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
+#endif /* GL_EXT_texture_cube_map_array */
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif /* GL_EXT_texture_filter_anisotropic */
+
+#ifndef GL_EXT_texture_filter_minmax
+#define GL_EXT_texture_filter_minmax 1
+#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366
+#define GL_WEIGHTED_AVERAGE_EXT 0x9367
+#endif /* GL_EXT_texture_filter_minmax */
+
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif /* GL_EXT_texture_format_BGRA8888 */
+
+#ifndef GL_EXT_texture_format_sRGB_override
+#define GL_EXT_texture_format_sRGB_override 1
+#define GL_TEXTURE_FORMAT_SRGB_OVERRIDE_EXT 0x8FBF
+#endif /* GL_EXT_texture_format_sRGB_override */
+
+#ifndef GL_EXT_texture_mirror_clamp_to_edge
+#define GL_EXT_texture_mirror_clamp_to_edge 1
+#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
+#endif /* GL_EXT_texture_mirror_clamp_to_edge */
+
+#ifndef GL_EXT_texture_norm16
+#define GL_EXT_texture_norm16 1
+#define GL_R16_EXT 0x822A
+#define GL_RG16_EXT 0x822C
+#define GL_RGBA16_EXT 0x805B
+#define GL_RGB16_EXT 0x8054
+#define GL_RGB16_SNORM_EXT 0x8F9A
+#endif /* GL_EXT_texture_norm16 */
+
+#ifndef GL_EXT_texture_rg
+#define GL_EXT_texture_rg 1
+#define GL_RED_EXT 0x1903
+#define GL_RG_EXT 0x8227
+#define GL_R8_EXT 0x8229
+#define GL_RG8_EXT 0x822B
+#endif /* GL_EXT_texture_rg */
+
+#ifndef GL_EXT_texture_sRGB_R8
+#define GL_EXT_texture_sRGB_R8 1
+#define GL_SR8_EXT 0x8FBD
+#endif /* GL_EXT_texture_sRGB_R8 */
+
+#ifndef GL_EXT_texture_sRGB_RG8
+#define GL_EXT_texture_sRGB_RG8 1
+#define GL_SRG8_EXT 0x8FBE
+#endif /* GL_EXT_texture_sRGB_RG8 */
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_EXT_texture_sRGB_decode 1
+#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
+#define GL_DECODE_EXT 0x8A49
+#define GL_SKIP_DECODE_EXT 0x8A4A
+#endif /* GL_EXT_texture_sRGB_decode */
+
+#ifndef GL_EXT_texture_storage
+#define GL_EXT_texture_storage 1
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
+#define GL_ALPHA8_EXT 0x803C
+#define GL_LUMINANCE8_EXT 0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
+#define GL_RGBA32F_EXT 0x8814
+#define GL_RGB32F_EXT 0x8815
+#define GL_ALPHA32F_EXT 0x8816
+#define GL_LUMINANCE32F_EXT 0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
+#define GL_ALPHA16F_EXT 0x881C
+#define GL_LUMINANCE16F_EXT 0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
+#define GL_R32F_EXT 0x822E
+#define GL_RG32F_EXT 0x8230
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+#endif /* GL_EXT_texture_storage */
+
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+#endif /* GL_EXT_texture_type_2_10_10_10_REV */
+
+#ifndef GL_EXT_texture_view
+#define GL_EXT_texture_view 1
+#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB
+#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC
+#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD
+#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE
+typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif
+#endif /* GL_EXT_texture_view */
+
+#ifndef GL_EXT_unpack_subimage
+#define GL_EXT_unpack_subimage 1
+#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
+#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
+#endif /* GL_EXT_unpack_subimage */
+
+#ifndef GL_EXT_win32_keyed_mutex
+#define GL_EXT_win32_keyed_mutex 1
+typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout);
+typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout);
+GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key);
+#endif
+#endif /* GL_EXT_win32_keyed_mutex */
+
+#ifndef GL_EXT_window_rectangles
+#define GL_EXT_window_rectangles 1
+#define GL_INCLUSIVE_EXT 0x8F10
+#define GL_EXCLUSIVE_EXT 0x8F11
+#define GL_WINDOW_RECTANGLE_EXT 0x8F12
+#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
+#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
+#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
+typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
+#endif
+#endif /* GL_EXT_window_rectangles */
+
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_FJ_shader_binary_GCCSO 1
+#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
+#endif /* GL_FJ_shader_binary_GCCSO */
+
+#ifndef GL_IMG_bindless_texture
+#define GL_IMG_bindless_texture 1
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture);
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture);
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler);
+GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+#endif
+#endif /* GL_IMG_bindless_texture */
+
+#ifndef GL_IMG_framebuffer_downsample
+#define GL_IMG_framebuffer_downsample 1
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C
+#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D
+#define GL_DOWNSAMPLE_SCALES_IMG 0x913E
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
+#endif
+#endif /* GL_IMG_framebuffer_downsample */
+
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+#define GL_MAX_SAMPLES_IMG 0x9135
+#define GL_TEXTURE_SAMPLES_IMG 0x9136
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_IMG_multisampled_render_to_texture */
+
+#ifndef GL_IMG_program_binary
+#define GL_IMG_program_binary 1
+#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
+#endif /* GL_IMG_program_binary */
+
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif /* GL_IMG_read_format */
+
+#ifndef GL_IMG_shader_binary
+#define GL_IMG_shader_binary 1
+#define GL_SGX_BINARY_IMG 0x8C0A
+#endif /* GL_IMG_shader_binary */
+
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif /* GL_IMG_texture_compression_pvrtc */
+
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_IMG_texture_compression_pvrtc2 1
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
+#endif /* GL_IMG_texture_compression_pvrtc2 */
+
+#ifndef GL_IMG_texture_filter_cubic
+#define GL_IMG_texture_filter_cubic 1
+#define GL_CUBIC_IMG 0x9139
+#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A
+#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B
+#endif /* GL_IMG_texture_filter_cubic */
+
+#ifndef GL_INTEL_blackhole_render
+#define GL_INTEL_blackhole_render 1
+#define GL_BLACKHOLE_RENDER_INTEL 0x83FC
+#endif /* GL_INTEL_blackhole_render */
+
+#ifndef GL_INTEL_conservative_rasterization
+#define GL_INTEL_conservative_rasterization 1
+#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
+#endif /* GL_INTEL_conservative_rasterization */
+
+#ifndef GL_INTEL_framebuffer_CMAA
+#define GL_INTEL_framebuffer_CMAA 1
+typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void);
+#endif
+#endif /* GL_INTEL_framebuffer_CMAA */
+
+#ifndef GL_INTEL_performance_query
+#define GL_INTEL_performance_query 1
+#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
+#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
+#define GL_PERFQUERY_WAIT_INTEL 0x83FB
+#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
+#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
+#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
+#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
+#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
+#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
+#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
+#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
+#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
+#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
+#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
+#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
+#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
+#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
+#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
+#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
+#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
+typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
+GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
+GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
+GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#endif
+#endif /* GL_INTEL_performance_query */
+
+#ifndef GL_MESA_program_binary_formats
+#define GL_MESA_program_binary_formats 1
+#define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
+#endif /* GL_MESA_program_binary_formats */
+
+#ifndef GL_MESA_shader_integer_functions
+#define GL_MESA_shader_integer_functions 1
+#endif /* GL_MESA_shader_integer_functions */
+
+#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers
+#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1
+#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */
+
+#ifndef GL_NV_bindless_texture
+#define GL_NV_bindless_texture 1
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
+typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
+typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
+typedef GLuint64 (GL_APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
+typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
+typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
+typedef GLboolean (GL_APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleNV (GLuint texture);
+GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);
+GL_APICALL void GL_APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);
+GL_APICALL void GL_APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);
+GL_APICALL GLuint64 GL_APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
+GL_APICALL void GL_APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);
+GL_APICALL void GL_APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);
+GL_APICALL void GL_APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);
+GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+GL_APICALL GLboolean GL_APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);
+GL_APICALL GLboolean GL_APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
+#endif
+#endif /* GL_NV_bindless_texture */
+
+#ifndef GL_NV_blend_equation_advanced
+#define GL_NV_blend_equation_advanced 1
+#define GL_BLEND_OVERLAP_NV 0x9281
+#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
+#define GL_BLUE_NV 0x1905
+#define GL_COLORBURN_NV 0x929A
+#define GL_COLORDODGE_NV 0x9299
+#define GL_CONJOINT_NV 0x9284
+#define GL_CONTRAST_NV 0x92A1
+#define GL_DARKEN_NV 0x9297
+#define GL_DIFFERENCE_NV 0x929E
+#define GL_DISJOINT_NV 0x9283
+#define GL_DST_ATOP_NV 0x928F
+#define GL_DST_IN_NV 0x928B
+#define GL_DST_NV 0x9287
+#define GL_DST_OUT_NV 0x928D
+#define GL_DST_OVER_NV 0x9289
+#define GL_EXCLUSION_NV 0x92A0
+#define GL_GREEN_NV 0x1904
+#define GL_HARDLIGHT_NV 0x929B
+#define GL_HARDMIX_NV 0x92A9
+#define GL_HSL_COLOR_NV 0x92AF
+#define GL_HSL_HUE_NV 0x92AD
+#define GL_HSL_LUMINOSITY_NV 0x92B0
+#define GL_HSL_SATURATION_NV 0x92AE
+#define GL_INVERT_OVG_NV 0x92B4
+#define GL_INVERT_RGB_NV 0x92A3
+#define GL_LIGHTEN_NV 0x9298
+#define GL_LINEARBURN_NV 0x92A5
+#define GL_LINEARDODGE_NV 0x92A4
+#define GL_LINEARLIGHT_NV 0x92A7
+#define GL_MINUS_CLAMPED_NV 0x92B3
+#define GL_MINUS_NV 0x929F
+#define GL_MULTIPLY_NV 0x9294
+#define GL_OVERLAY_NV 0x9296
+#define GL_PINLIGHT_NV 0x92A8
+#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
+#define GL_PLUS_CLAMPED_NV 0x92B1
+#define GL_PLUS_DARKER_NV 0x9292
+#define GL_PLUS_NV 0x9291
+#define GL_RED_NV 0x1903
+#define GL_SCREEN_NV 0x9295
+#define GL_SOFTLIGHT_NV 0x929C
+#define GL_SRC_ATOP_NV 0x928E
+#define GL_SRC_IN_NV 0x928A
+#define GL_SRC_NV 0x9286
+#define GL_SRC_OUT_NV 0x928C
+#define GL_SRC_OVER_NV 0x9288
+#define GL_UNCORRELATED_NV 0x9282
+#define GL_VIVIDLIGHT_NV 0x92A6
+#define GL_XOR_NV 0x1506
+typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glBlendBarrierNV (void);
+#endif
+#endif /* GL_NV_blend_equation_advanced */
+
+#ifndef GL_NV_blend_equation_advanced_coherent
+#define GL_NV_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
+#endif /* GL_NV_blend_equation_advanced_coherent */
+
+#ifndef GL_NV_blend_minmax_factor
+#define GL_NV_blend_minmax_factor 1
+#define GL_FACTOR_MIN_AMD 0x901C
+#define GL_FACTOR_MAX_AMD 0x901D
+#endif /* GL_NV_blend_minmax_factor */
+
+#ifndef GL_NV_clip_space_w_scaling
+#define GL_NV_clip_space_w_scaling 1
+#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C
+#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D
+#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E
+typedef void (GL_APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
+#endif
+#endif /* GL_NV_clip_space_w_scaling */
+
+#ifndef GL_NV_conditional_render
+#define GL_NV_conditional_render 1
+#define GL_QUERY_WAIT_NV 0x8E13
+#define GL_QUERY_NO_WAIT_NV 0x8E14
+#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
+#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
+typedef void (GL_APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
+GL_APICALL void GL_APIENTRY glEndConditionalRenderNV (void);
+#endif
+#endif /* GL_NV_conditional_render */
+
+#ifndef GL_NV_conservative_raster
+#define GL_NV_conservative_raster 1
+#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
+#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347
+#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348
+#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349
+typedef void (GL_APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits);
+#endif
+#endif /* GL_NV_conservative_raster */
+
+#ifndef GL_NV_conservative_raster_pre_snap
+#define GL_NV_conservative_raster_pre_snap 1
+#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV 0x9550
+#endif /* GL_NV_conservative_raster_pre_snap */
+
+#ifndef GL_NV_conservative_raster_pre_snap_triangles
+#define GL_NV_conservative_raster_pre_snap_triangles 1
+#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
+#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
+#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
+typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
+#endif
+#endif /* GL_NV_conservative_raster_pre_snap_triangles */
+
+#ifndef GL_NV_copy_buffer
+#define GL_NV_copy_buffer 1
+#define GL_COPY_READ_BUFFER_NV 0x8F36
+#define GL_COPY_WRITE_BUFFER_NV 0x8F37
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+#endif /* GL_NV_copy_buffer */
+
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#define GL_COVERAGE_COMPONENT_NV 0x8ED0
+#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
+#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
+#define GL_COVERAGE_BUFFERS_NV 0x8ED3
+#define GL_COVERAGE_SAMPLES_NV 0x8ED4
+#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
+#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
+#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+#endif /* GL_NV_coverage_sample */
+
+#ifndef GL_NV_depth_nonlinear
+#define GL_NV_depth_nonlinear 1
+#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+#endif /* GL_NV_depth_nonlinear */
+
+#ifndef GL_NV_draw_buffers
+#define GL_NV_draw_buffers 1
+#define GL_MAX_DRAW_BUFFERS_NV 0x8824
+#define GL_DRAW_BUFFER0_NV 0x8825
+#define GL_DRAW_BUFFER1_NV 0x8826
+#define GL_DRAW_BUFFER2_NV 0x8827
+#define GL_DRAW_BUFFER3_NV 0x8828
+#define GL_DRAW_BUFFER4_NV 0x8829
+#define GL_DRAW_BUFFER5_NV 0x882A
+#define GL_DRAW_BUFFER6_NV 0x882B
+#define GL_DRAW_BUFFER7_NV 0x882C
+#define GL_DRAW_BUFFER8_NV 0x882D
+#define GL_DRAW_BUFFER9_NV 0x882E
+#define GL_DRAW_BUFFER10_NV 0x882F
+#define GL_DRAW_BUFFER11_NV 0x8830
+#define GL_DRAW_BUFFER12_NV 0x8831
+#define GL_DRAW_BUFFER13_NV 0x8832
+#define GL_DRAW_BUFFER14_NV 0x8833
+#define GL_DRAW_BUFFER15_NV 0x8834
+#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
+#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
+#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
+#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
+#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
+#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
+#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
+#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
+#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
+#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
+#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
+#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
+#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
+#define GL_COLOR_ATTACHMENT13_NV 0x8CED
+#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
+#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_NV_draw_buffers */
+
+#ifndef GL_NV_draw_instanced
+#define GL_NV_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#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 void *indices, GLsizei primcount);
+#endif
+#endif /* GL_NV_draw_instanced */
+
+#ifndef GL_NV_draw_vulkan_image
+#define GL_NV_draw_vulkan_image 1
+typedef void (GL_APIENTRY *GLVULKANPROCNV)(void);
+typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
+typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
+typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
+typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
+GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name);
+GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore);
+GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore);
+GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence);
+#endif
+#endif /* GL_NV_draw_vulkan_image */
+
+#ifndef GL_NV_explicit_attrib_location
+#define GL_NV_explicit_attrib_location 1
+#endif /* GL_NV_explicit_attrib_location */
+
+#ifndef GL_NV_fbo_color_attachments
+#define GL_NV_fbo_color_attachments 1
+#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
+#endif /* GL_NV_fbo_color_attachments */
+
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
+#endif
+#endif /* GL_NV_fence */
+
+#ifndef GL_NV_fill_rectangle
+#define GL_NV_fill_rectangle 1
+#define GL_FILL_RECTANGLE_NV 0x933C
+#endif /* GL_NV_fill_rectangle */
+
+#ifndef GL_NV_fragment_coverage_to_color
+#define GL_NV_fragment_coverage_to_color 1
+#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD
+#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE
+typedef void (GL_APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color);
+#endif
+#endif /* GL_NV_fragment_coverage_to_color */
+
+#ifndef GL_NV_fragment_shader_interlock
+#define GL_NV_fragment_shader_interlock 1
+#endif /* GL_NV_fragment_shader_interlock */
+
+#ifndef GL_NV_framebuffer_blit
+#define GL_NV_framebuffer_blit 1
+#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
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_NV_framebuffer_blit */
+
+#ifndef GL_NV_framebuffer_mixed_samples
+#define GL_NV_framebuffer_mixed_samples 1
+#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331
+#define GL_COLOR_SAMPLES_NV 0x8E20
+#define GL_DEPTH_SAMPLES_NV 0x932D
+#define GL_STENCIL_SAMPLES_NV 0x932E
+#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F
+#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330
+#define GL_COVERAGE_MODULATION_NV 0x9332
+#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v);
+GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components);
+#endif
+#endif /* GL_NV_framebuffer_mixed_samples */
+
+#ifndef GL_NV_framebuffer_multisample
+#define GL_NV_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
+#define GL_MAX_SAMPLES_NV 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_NV_framebuffer_multisample */
+
+#ifndef GL_NV_generate_mipmap_sRGB
+#define GL_NV_generate_mipmap_sRGB 1
+#endif /* GL_NV_generate_mipmap_sRGB */
+
+#ifndef GL_NV_geometry_shader_passthrough
+#define GL_NV_geometry_shader_passthrough 1
+#endif /* GL_NV_geometry_shader_passthrough */
+
+#ifndef GL_NV_gpu_shader5
+#define GL_NV_gpu_shader5 1
+typedef khronos_int64_t GLint64EXT;
+typedef khronos_uint64_t GLuint64EXT;
+#define GL_INT64_NV 0x140E
+#define GL_UNSIGNED_INT64_NV 0x140F
+#define GL_INT8_NV 0x8FE0
+#define GL_INT8_VEC2_NV 0x8FE1
+#define GL_INT8_VEC3_NV 0x8FE2
+#define GL_INT8_VEC4_NV 0x8FE3
+#define GL_INT16_NV 0x8FE4
+#define GL_INT16_VEC2_NV 0x8FE5
+#define GL_INT16_VEC3_NV 0x8FE6
+#define GL_INT16_VEC4_NV 0x8FE7
+#define GL_INT64_VEC2_NV 0x8FE9
+#define GL_INT64_VEC3_NV 0x8FEA
+#define GL_INT64_VEC4_NV 0x8FEB
+#define GL_UNSIGNED_INT8_NV 0x8FEC
+#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
+#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
+#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
+#define GL_UNSIGNED_INT16_NV 0x8FF0
+#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
+#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
+#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
+#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
+#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
+#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
+#define GL_FLOAT16_NV 0x8FF8
+#define GL_FLOAT16_VEC2_NV 0x8FF9
+#define GL_FLOAT16_VEC3_NV 0x8FFA
+#define GL_FLOAT16_VEC4_NV 0x8FFB
+#define GL_PATCHES 0x000E
+typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
+GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
+GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
+GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
+GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
+GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif
+#endif /* GL_NV_gpu_shader5 */
+
+#ifndef GL_NV_image_formats
+#define GL_NV_image_formats 1
+#endif /* GL_NV_image_formats */
+
+#ifndef GL_NV_instanced_arrays
+#define GL_NV_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_NV_instanced_arrays */
+
+#ifndef GL_NV_internalformat_sample_query
+#define GL_NV_internalformat_sample_query 1
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_MULTISAMPLES_NV 0x9371
+#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372
+#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373
+#define GL_CONFORMANT_NV 0x9374
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
+#endif
+#endif /* GL_NV_internalformat_sample_query */
+
+#ifndef GL_NV_non_square_matrices
+#define GL_NV_non_square_matrices 1
+#define GL_FLOAT_MAT2x3_NV 0x8B65
+#define GL_FLOAT_MAT2x4_NV 0x8B66
+#define GL_FLOAT_MAT3x2_NV 0x8B67
+#define GL_FLOAT_MAT3x4_NV 0x8B68
+#define GL_FLOAT_MAT4x2_NV 0x8B69
+#define GL_FLOAT_MAT4x3_NV 0x8B6A
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_NV_non_square_matrices */
+
+#ifndef GL_NV_path_rendering
+#define GL_NV_path_rendering 1
+typedef double GLdouble;
+#define GL_PATH_FORMAT_SVG_NV 0x9070
+#define GL_PATH_FORMAT_PS_NV 0x9071
+#define GL_STANDARD_FONT_NAME_NV 0x9072
+#define GL_SYSTEM_FONT_NAME_NV 0x9073
+#define GL_FILE_NAME_NV 0x9074
+#define GL_PATH_STROKE_WIDTH_NV 0x9075
+#define GL_PATH_END_CAPS_NV 0x9076
+#define GL_PATH_INITIAL_END_CAP_NV 0x9077
+#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
+#define GL_PATH_JOIN_STYLE_NV 0x9079
+#define GL_PATH_MITER_LIMIT_NV 0x907A
+#define GL_PATH_DASH_CAPS_NV 0x907B
+#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
+#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
+#define GL_PATH_DASH_OFFSET_NV 0x907E
+#define GL_PATH_CLIENT_LENGTH_NV 0x907F
+#define GL_PATH_FILL_MODE_NV 0x9080
+#define GL_PATH_FILL_MASK_NV 0x9081
+#define GL_PATH_FILL_COVER_MODE_NV 0x9082
+#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
+#define GL_PATH_STROKE_MASK_NV 0x9084
+#define GL_COUNT_UP_NV 0x9088
+#define GL_COUNT_DOWN_NV 0x9089
+#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
+#define GL_CONVEX_HULL_NV 0x908B
+#define GL_BOUNDING_BOX_NV 0x908D
+#define GL_TRANSLATE_X_NV 0x908E
+#define GL_TRANSLATE_Y_NV 0x908F
+#define GL_TRANSLATE_2D_NV 0x9090
+#define GL_TRANSLATE_3D_NV 0x9091
+#define GL_AFFINE_2D_NV 0x9092
+#define GL_AFFINE_3D_NV 0x9094
+#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
+#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
+#define GL_UTF8_NV 0x909A
+#define GL_UTF16_NV 0x909B
+#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
+#define GL_PATH_COMMAND_COUNT_NV 0x909D
+#define GL_PATH_COORD_COUNT_NV 0x909E
+#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
+#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
+#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
+#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
+#define GL_SQUARE_NV 0x90A3
+#define GL_ROUND_NV 0x90A4
+#define GL_TRIANGULAR_NV 0x90A5
+#define GL_BEVEL_NV 0x90A6
+#define GL_MITER_REVERT_NV 0x90A7
+#define GL_MITER_TRUNCATE_NV 0x90A8
+#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
+#define GL_USE_MISSING_GLYPH_NV 0x90AA
+#define GL_PATH_ERROR_POSITION_NV 0x90AB
+#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
+#define GL_ADJACENT_PAIRS_NV 0x90AE
+#define GL_FIRST_TO_REST_NV 0x90AF
+#define GL_PATH_GEN_MODE_NV 0x90B0
+#define GL_PATH_GEN_COEFF_NV 0x90B1
+#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
+#define GL_PATH_STENCIL_FUNC_NV 0x90B7
+#define GL_PATH_STENCIL_REF_NV 0x90B8
+#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
+#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
+#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
+#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
+#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
+#define GL_MOVE_TO_RESETS_NV 0x90B5
+#define GL_MOVE_TO_CONTINUES_NV 0x90B6
+#define GL_CLOSE_PATH_NV 0x00
+#define GL_MOVE_TO_NV 0x02
+#define GL_RELATIVE_MOVE_TO_NV 0x03
+#define GL_LINE_TO_NV 0x04
+#define GL_RELATIVE_LINE_TO_NV 0x05
+#define GL_HORIZONTAL_LINE_TO_NV 0x06
+#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
+#define GL_VERTICAL_LINE_TO_NV 0x08
+#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
+#define GL_QUADRATIC_CURVE_TO_NV 0x0A
+#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
+#define GL_CUBIC_CURVE_TO_NV 0x0C
+#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
+#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
+#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
+#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
+#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
+#define GL_SMALL_CCW_ARC_TO_NV 0x12
+#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
+#define GL_SMALL_CW_ARC_TO_NV 0x14
+#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
+#define GL_LARGE_CCW_ARC_TO_NV 0x16
+#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
+#define GL_LARGE_CW_ARC_TO_NV 0x18
+#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
+#define GL_RESTART_PATH_NV 0xF0
+#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
+#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
+#define GL_RECT_NV 0xF6
+#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
+#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
+#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
+#define GL_ARC_TO_NV 0xFE
+#define GL_RELATIVE_ARC_TO_NV 0xFF
+#define GL_BOLD_BIT_NV 0x01
+#define GL_ITALIC_BIT_NV 0x02
+#define GL_GLYPH_WIDTH_BIT_NV 0x01
+#define GL_GLYPH_HEIGHT_BIT_NV 0x02
+#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
+#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
+#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
+#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
+#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
+#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
+#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100
+#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000
+#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000
+#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000
+#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000
+#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000
+#define GL_FONT_ASCENDER_BIT_NV 0x00200000
+#define GL_FONT_DESCENDER_BIT_NV 0x00400000
+#define GL_FONT_HEIGHT_BIT_NV 0x00800000
+#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000
+#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
+#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
+#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
+#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000
+#define GL_ROUNDED_RECT_NV 0xE8
+#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9
+#define GL_ROUNDED_RECT2_NV 0xEA
+#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB
+#define GL_ROUNDED_RECT4_NV 0xEC
+#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED
+#define GL_ROUNDED_RECT8_NV 0xEE
+#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF
+#define GL_RELATIVE_RECT_NV 0xF7
+#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368
+#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369
+#define GL_FONT_UNAVAILABLE_NV 0x936A
+#define GL_FONT_UNINTELLIGIBLE_NV 0x936B
+#define GL_CONIC_CURVE_TO_NV 0x1A
+#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B
+#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000
+#define GL_STANDARD_FONT_FORMAT_NV 0x936C
+#define GL_PATH_PROJECTION_NV 0x1701
+#define GL_PATH_MODELVIEW_NV 0x1700
+#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3
+#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6
+#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36
+#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3
+#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4
+#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7
+#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38
+#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4
+#define GL_FRAGMENT_INPUT_NV 0x936D
+typedef GLuint (GL_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
+typedef void (GL_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
+typedef GLboolean (GL_APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
+typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
+typedef void (GL_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
+typedef void (GL_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (GL_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (GL_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
+typedef void (GL_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
+typedef void (GL_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
+typedef void (GL_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
+typedef void (GL_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
+typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
+typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
+typedef void (GL_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
+typedef void (GL_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
+typedef void (GL_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
+typedef void (GL_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
+typedef void (GL_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
+typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
+typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
+typedef GLfloat (GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
+typedef GLboolean (GL_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
+typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (GL_APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (GL_APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+typedef void (GL_APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+typedef void (GL_APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint GL_APIENTRY glGenPathsNV (GLsizei range);
+GL_APICALL void GL_APIENTRY glDeletePathsNV (GLuint path, GLsizei range);
+GL_APICALL GLboolean GL_APIENTRY glIsPathNV (GLuint path);
+GL_APICALL void GL_APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
+GL_APICALL void GL_APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString);
+GL_APICALL void GL_APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL void GL_APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL void GL_APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
+GL_APICALL void GL_APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);
+GL_APICALL void GL_APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
+GL_APICALL void GL_APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);
+GL_APICALL void GL_APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);
+GL_APICALL void GL_APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
+GL_APICALL void GL_APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glPathCoverDepthFuncNV (GLenum func);
+GL_APICALL void GL_APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);
+GL_APICALL void GL_APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);
+GL_APICALL void GL_APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);
+GL_APICALL void GL_APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);
+GL_APICALL void GL_APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);
+GL_APICALL void GL_APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
+GL_APICALL void GL_APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
+GL_APICALL void GL_APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
+GL_APICALL GLboolean GL_APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);
+GL_APICALL GLboolean GL_APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);
+GL_APICALL GLfloat GL_APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);
+GL_APICALL GLboolean GL_APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
+GL_APICALL void GL_APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
+GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
+GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
+GL_APICALL void GL_APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+GL_APICALL void GL_APIENTRY glMatrixLoadIdentityEXT (GLenum mode);
+GL_APICALL void GL_APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);
+GL_APICALL void GL_APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);
+GL_APICALL void GL_APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);
+GL_APICALL void GL_APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);
+GL_APICALL void GL_APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+GL_APICALL void GL_APIENTRY glMatrixPopEXT (GLenum mode);
+GL_APICALL void GL_APIENTRY glMatrixPushEXT (GLenum mode);
+GL_APICALL void GL_APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+GL_APICALL void GL_APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+GL_APICALL void GL_APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+#endif
+#endif /* GL_NV_path_rendering */
+
+#ifndef GL_NV_path_rendering_shared_edge
+#define GL_NV_path_rendering_shared_edge 1
+#define GL_SHARED_EDGE_NV 0xC0
+#endif /* GL_NV_path_rendering_shared_edge */
+
+#ifndef GL_NV_pixel_buffer_object
+#define GL_NV_pixel_buffer_object 1
+#define GL_PIXEL_PACK_BUFFER_NV 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF
+#endif /* GL_NV_pixel_buffer_object */
+
+#ifndef GL_NV_polygon_mode
+#define GL_NV_polygon_mode 1
+#define GL_POLYGON_MODE_NV 0x0B40
+#define GL_POLYGON_OFFSET_POINT_NV 0x2A01
+#define GL_POLYGON_OFFSET_LINE_NV 0x2A02
+#define GL_POINT_NV 0x1B00
+#define GL_LINE_NV 0x1B01
+#define GL_FILL_NV 0x1B02
+typedef void (GL_APIENTRYP PFNGLPOLYGONMODENVPROC) (GLenum face, GLenum mode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode);
+#endif
+#endif /* GL_NV_polygon_mode */
+
+#ifndef GL_NV_read_buffer
+#define GL_NV_read_buffer 1
+#define GL_READ_BUFFER_NV 0x0C02
+typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
+#endif
+#endif /* GL_NV_read_buffer */
+
+#ifndef GL_NV_read_buffer_front
+#define GL_NV_read_buffer_front 1
+#endif /* GL_NV_read_buffer_front */
+
+#ifndef GL_NV_read_depth
+#define GL_NV_read_depth 1
+#endif /* GL_NV_read_depth */
+
+#ifndef GL_NV_read_depth_stencil
+#define GL_NV_read_depth_stencil 1
+#endif /* GL_NV_read_depth_stencil */
+
+#ifndef GL_NV_read_stencil
+#define GL_NV_read_stencil 1
+#endif /* GL_NV_read_stencil */
+
+#ifndef GL_NV_sRGB_formats
+#define GL_NV_sRGB_formats 1
+#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_sRGB_formats */
+
+#ifndef GL_NV_sample_locations
+#define GL_NV_sample_locations 1
+#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
+#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E
+#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F
+#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340
+#define GL_SAMPLE_LOCATION_NV 0x8E50
+#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341
+#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342
+#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void);
+#endif
+#endif /* GL_NV_sample_locations */
+
+#ifndef GL_NV_sample_mask_override_coverage
+#define GL_NV_sample_mask_override_coverage 1
+#endif /* GL_NV_sample_mask_override_coverage */
+
+#ifndef GL_NV_shader_atomic_fp16_vector
+#define GL_NV_shader_atomic_fp16_vector 1
+#endif /* GL_NV_shader_atomic_fp16_vector */
+
+#ifndef GL_NV_shader_noperspective_interpolation
+#define GL_NV_shader_noperspective_interpolation 1
+#endif /* GL_NV_shader_noperspective_interpolation */
+
+#ifndef GL_NV_shadow_samplers_array
+#define GL_NV_shadow_samplers_array 1
+#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
+#endif /* GL_NV_shadow_samplers_array */
+
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_NV_shadow_samplers_cube 1
+#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
+#endif /* GL_NV_shadow_samplers_cube */
+
+#ifndef GL_NV_stereo_view_rendering
+#define GL_NV_stereo_view_rendering 1
+#endif /* GL_NV_stereo_view_rendering */
+
+#ifndef GL_NV_texture_border_clamp
+#define GL_NV_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
+#define GL_CLAMP_TO_BORDER_NV 0x812D
+#endif /* GL_NV_texture_border_clamp */
+
+#ifndef GL_NV_texture_compression_s3tc_update
+#define GL_NV_texture_compression_s3tc_update 1
+#endif /* GL_NV_texture_compression_s3tc_update */
+
+#ifndef GL_NV_texture_npot_2D_mipmap
+#define GL_NV_texture_npot_2D_mipmap 1
+#endif /* GL_NV_texture_npot_2D_mipmap */
+
+#ifndef GL_NV_viewport_array
+#define GL_NV_viewport_array 1
+#define GL_MAX_VIEWPORTS_NV 0x825B
+#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C
+#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D
+#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F
+typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVNVPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDNVPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVNVPROC) (GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVNVPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFNVPROC) (GLuint index, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLGETFLOATI_VNVPROC) (GLenum target, GLuint index, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLENABLEINVPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEINVPROC) (GLenum target, GLuint index);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDINVPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glViewportArrayvNV (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glViewportIndexedfNV (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+GL_APICALL void GL_APIENTRY glViewportIndexedfvNV (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glScissorArrayvNV (GLuint first, GLsizei count, const GLint *v);
+GL_APICALL void GL_APIENTRY glScissorIndexedNV (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glScissorIndexedvNV (GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glDepthRangeArrayfvNV (GLuint first, GLsizei count, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glDepthRangeIndexedfNV (GLuint index, GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glGetFloati_vNV (GLenum target, GLuint index, GLfloat *data);
+GL_APICALL void GL_APIENTRY glEnableiNV (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiNV (GLenum target, GLuint index);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index);
+#endif
+#endif /* GL_NV_viewport_array */
+
+#ifndef GL_NV_viewport_array2
+#define GL_NV_viewport_array2 1
+#endif /* GL_NV_viewport_array2 */
+
+#ifndef GL_NV_viewport_swizzle
+#define GL_NV_viewport_swizzle 1
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
+#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
+#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
+#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
+#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
+#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
+#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
+typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
+#endif
+#endif /* GL_NV_viewport_swizzle */
+
+#ifndef GL_OVR_multiview
+#define GL_OVR_multiview 1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632
+#define GL_MAX_VIEWS_OVR 0x9631
+#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+#endif
+#endif /* GL_OVR_multiview */
+
+#ifndef GL_OVR_multiview2
+#define GL_OVR_multiview2 1
+#endif /* GL_OVR_multiview2 */
+
+#ifndef GL_OVR_multiview_multisampled_render_to_texture
+#define GL_OVR_multiview_multisampled_render_to_texture 1
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
+#endif
+#endif /* GL_OVR_multiview_multisampled_render_to_texture */
+
+#ifndef GL_QCOM_alpha_test
+#define GL_QCOM_alpha_test 1
+#define GL_ALPHA_TEST_QCOM 0x0BC0
+#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
+#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
+#endif
+#endif /* GL_QCOM_alpha_test */
+
+#ifndef GL_QCOM_binning_control
+#define GL_QCOM_binning_control 1
+#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 /* GL_QCOM_binning_control */
+
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+#endif /* GL_QCOM_driver_control */
+
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+#define GL_STATE_RESTORE 0x8BDC
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
+#endif
+#endif /* GL_QCOM_extended_get */
+
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+#endif /* GL_QCOM_extended_get2 */
+
+#ifndef GL_QCOM_framebuffer_foveated
+#define GL_QCOM_framebuffer_foveated 1
+#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001
+#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
+GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
+#endif
+#endif /* GL_QCOM_framebuffer_foveated */
+
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+#endif /* GL_QCOM_perfmon_global_mode */
+
+#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent
+#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1
+#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void);
+#endif
+#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */
+
+#ifndef GL_QCOM_texture_foveated
+#define GL_QCOM_texture_foveated 1
+#define GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM 0x8BFB
+#define GL_TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM 0x8BFC
+#define GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM 0x8BFD
+#define GL_TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM 0x8BFE
+#define GL_FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM 0x8BFF
+typedef void (GL_APIENTRYP PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC) (GLuint texture, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTextureFoveationParametersQCOM (GLuint texture, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
+#endif
+#endif /* GL_QCOM_texture_foveated */
+
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+#endif /* GL_QCOM_tiled_rendering */
+
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+#endif /* GL_QCOM_writeonly_rendering */
+
+#ifndef GL_VIV_shader_binary
+#define GL_VIV_shader_binary 1
+#define GL_SHADER_BINARY_VIV 0x8FC4
+#endif /* GL_VIV_shader_binary */
+
+/* ANGLE GLES2 extensions */
+#include "gl2ext_angle.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/GLES2/gl2ext_angle.h b/gfx/angle/checkout/include/GLES2/gl2ext_angle.h
new file mode 100644
index 0000000000..038b60e4f7
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES2/gl2ext_angle.h
@@ -0,0 +1,685 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// gl2ext_angle.h: ANGLE modifications to the gl2ext.h header file.
+// Currently we don't include this file directly, we patch gl2ext.h
+// to include it implicitly so it is visible throughout our code.
+
+#ifndef INCLUDE_GLES2_GL2EXT_ANGLE_H_
+#define INCLUDE_GLES2_GL2EXT_ANGLE_H_
+
+// clang-format off
+
+#ifndef GL_ANGLE_client_arrays
+#define GL_ANGLE_client_arrays 1
+#define GL_CLIENT_ARRAYS_ANGLE 0x93AA
+#endif /* GL_ANGLE_client_arrays */
+
+#ifndef GL_ANGLE_request_extension
+#define GL_ANGLE_request_extension 1
+#define GL_REQUESTABLE_EXTENSIONS_ANGLE 0x93A8
+#define GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE 0x93A8
+typedef void (GL_APIENTRYP PFNGLREQUESTEXTENSIONANGLEPROC) (const GLchar *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRequestExtensionANGLE (const GLchar *name);
+#endif
+#endif /* GL_ANGLE_webgl_compatibility */
+
+#ifndef GL_ANGLE_robust_resource_initialization
+#define GL_ANGLE_robust_resource_initialization 1
+#define GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE 0x93AB
+#endif /* GL_ANGLE_robust_resource_initialization */
+
+#ifndef GL_ANGLE_provoking_vertex
+#define GL_ANGLE_provoking_vertex 1
+#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION 0x8E4E
+#define GL_PROVOKING_VERTEX 0x8E4F
+typedef void (GL_APIENTRYP PFNGLPROVOKINGVERTEXANGLEPROC) (GLenum);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glProvokingVertexANGLE(GLenum mode);
+#endif
+#endif /* GL_ANGLE_provoking_vertex */
+
+#ifndef GL_CHROMIUM_framebuffer_mixed_samples
+#define GL_CHROMIUM_frambuffer_mixed_samples 1
+#define GL_COVERAGE_MODULATION_CHROMIUM 0x9332
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONCHROMIUMPROC) (GLenum components);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageModulationCHROMIUM(GLenum components);
+#endif
+#endif /* GL_CHROMIUM_framebuffer_mixed_samples */
+
+#ifndef GL_CHROMIUM_bind_generates_resource
+#define GL_CHROMIUM_bind_generates_resource 1
+#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
+#endif /* GL_CHROMIUM_bind_generates_resource */
+
+#ifndef GL_ANGLE_memory_size
+#define GL_ANGLE_memory_size
+#define GL_MEMORY_SIZE_ANGLE 0x93AD
+#endif /* GL_ANGLE_memory_size */
+
+// needed by NV_path_rendering (and thus CHROMIUM_path_rendering)
+// but CHROMIUM_path_rendering only needs MatrixLoadfEXT, MatrixLoadIdentityEXT
+#ifndef GL_EXT_direct_state_access
+#define GL_EXT_direct_state_access 1
+typedef void(GL_APIENTRYP PFNGLMATRIXLOADFEXTPROC)(GLenum matrixMode, const GLfloat *m);
+typedef void(GL_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC)(GLenum matrixMode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMatrixLoadfEXT(GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoadIdentityEXT(GLenum matrixMode);
+#endif
+#endif /* GL_EXT_direct_state_access */
+
+#ifndef GL_CHROMIUM_path_rendering
+#define GL_CHROMIUM_path_rendering 1
+#define GL_PATH_MODELVIEW_CHROMIUM 0x1700
+#define GL_PATH_PROJECTION_CHROMIUM 0x1701
+#define GL_CLOSE_PATH_CHROMIUM 0x00
+#define GL_MOVE_TO_CHROMIUM 0x02
+#define GL_LINE_TO_CHROMIUM 0x04
+#define GL_QUADRATIC_CURVE_TO_CHROMIUM 0x0A
+#define GL_CUBIC_CURVE_TO_CHROMIUM 0x0C
+#define GL_CONIC_CURVE_TO_CHROMIUM 0x1A
+#define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6
+#define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7
+#define GL_PATH_STROKE_WIDTH_CHROMIUM 0x9075
+#define GL_PATH_END_CAPS_CHROMIUM 0x9076
+#define GL_PATH_JOIN_STYLE_CHROMIUM 0x9079
+#define GL_PATH_MITER_LIMIT_CHROMIUM 0x907a
+#define GL_PATH_STROKE_BOUND_CHROMIUM 0x9086
+#define GL_FLAT_CHROMIUM 0x1D00
+#define GL_SQUARE_CHROMIUM 0x90a3
+#define GL_ROUND_CHROMIUM 0x90a4
+#define GL_BEVEL_CHROMIUM 0x90A6
+#define GL_MITER_REVERT_CHROMIUM 0x90A7
+#define GL_COUNT_UP_CHROMIUM 0x9088
+#define GL_COUNT_DOWN_CHROMIUM 0x9089
+#define GL_CONVEX_HULL_CHROMIUM 0x908B
+#define GL_BOUNDING_BOX_CHROMIUM 0x908D
+#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM 0x909C
+#define GL_EYE_LINEAR_CHROMIUM 0x2400
+#define GL_OBJECT_LINEAR_CHROMIUM 0x2401
+#define GL_CONSTANT_CHROMIUM 0x8576
+#define GL_TRANSLATE_X_CHROMIUM 0x908E
+#define GL_TRANSLATE_Y_CHROMIUM 0x908F
+#define GL_TRANSLATE_2D_CHROMIUM 0x9090
+#define GL_TRANSLATE_3D_CHROMIUM 0x9091
+#define GL_AFFINE_2D_CHROMIUM 0x9092
+#define GL_AFFINE_3D_CHROMIUM 0x9094
+#define GL_TRANSPOSE_AFFINE_2D_CHROMIUM 0x9096
+#define GL_TRANSPOSE_AFFINE_3D_CHROMIUM 0x9098
+typedef void(GL_APIENTRYP PFNGLMATRIXLOADFCHROMIUMPROC)(GLenum matrixMode, const GLfloat *m);
+typedef void(GL_APIENTRYP PFNGLMATRIXLOADIDENTITYCHROMIUMPROC)(GLenum matrixMode);
+typedef GLuint(GL_APIENTRYP PFNGLGENPATHSCHROMIUMPROC)(GLsizei range);
+typedef void(GL_APIENTRYP PFNGLDELETEPATHSCHROMIUMPROC)(GLuint path, GLsizei range);
+typedef GLboolean(GL_APIENTRYP PFNGLISPATHCHROMIUMPROC)(GLuint path);
+typedef void(GL_APIENTRYP PFNGLPATHCOMMANDSCHROMIUMPROC)(GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords);
+typedef void(GL_APIENTRYP PFNGLPATHPARAMETERICHROMIUMPROC)(GLuint path, GLenum pname, GLint value);
+typedef void(GL_APIENTRYP PFNGLPATHPARAMETERFCHROMIUMPROC)(GLuint path,
+ GLenum pname,
+ GLfloat value);
+typedef void(GL_APIENTRYP PFNGLGETPATHPARAMETERIVCHROMIUMPROC)(GLuint path,
+ GLenum pname,
+ GLint *value);
+typedef void(GL_APIENTRYP PFNGLGETPATHPARAMETERFVCHROMIUMPROC)(GLuint path,
+ GLenum pname,
+ GLfloat *value);
+typedef void(GL_APIENTRYP PFNGLPATHSTENCILFUNCCHROMIUMPROC)(GLenum func, GLint ref, GLuint mask);
+typedef void(GL_APIENTRYP PFNGLSTENCILFILLPATHCHROMIUMPROC)(GLuint path,
+ GLenum fillMode,
+ GLuint mask);
+typedef void(GL_APIENTRYP PFNGLSTENCILSTROKEPATHCHROMIUMPROC)(GLuint path,
+ GLint reference,
+ GLuint mask);
+typedef void(GL_APIENTRYP PFNGLCOVERFILLPATHCHROMIUMPROC)(GLuint path, GLenum coverMode);
+typedef void(GL_APIENTRYP PFNGLCOVERSTROKEPATHCHROMIUMPROC)(GLuint path, GLenum coverMode);
+typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHCHROMIUMPROC)(GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode);
+typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHCHROMIUMPROC)(GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode);
+typedef void(GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDCHROMIUMPROC)(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+typedef void(GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDCHROMIUMPROC)(
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+typedef void(GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDCHROMIUMPROC)(
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+typedef void(GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDCHROMIUMPROC)(
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDCHROMIUMPROC)(
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDCHROMIUMPROC)(
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+
+typedef void(GL_APIENTRYP PFNGLBINDFRAGMENTINPUTLOCATIONCHROMIUMPROC)(GLuint program,
+ GLint location,
+ const GLchar *name);
+typedef void(GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENCHROMIUMPROC)(GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *m);
+GL_APICALL void GL_APIENTRY glMatrixLoadIdentityCHROMIUM(GLenum matrixMode);
+GL_APICALL GLuint GL_APIENTRY glGenPathsCHROMIUM(GLsizei range);
+GL_APICALL void GL_APIENTRY glDeletePathsCHROMIUM(GLuint path, GLsizei range);
+GL_APICALL GLboolean GL_APIENTRY glIsPathCHROMIUM(GLuint path);
+GL_APICALL void GL_APIENTRY glPathCommandsCHROMIUM(GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords);
+GL_APICALL void GL_APIENTRY glPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value);
+GL_APICALL void GL_APIENTRY glGetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value);
+GL_APICALL void GL_APIENTRY glGetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value);
+GL_APICALL void GL_APIENTRY glPathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask);
+GL_APICALL void GL_APIENTRY glCoverFillPathCHROMIUM(GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverStrokePathCHROMIUM(GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathCHROMIUM(GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUM(GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glStencilFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+GL_APICALL void GL_APIENTRY
+glStencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+
+GL_APICALL void GL_APIENTRY
+glStencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+
+GL_APICALL void GL_APIENTRY glBindFragmentInputLocationCHROMIUM(GLuint program,
+ GLint location,
+ const GLchar *name);
+GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUM(GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs);
+
+#endif
+#endif /* GL_CHROMIUM_path_rendering */
+
+#ifndef GL_CHROMIUM_copy_texture
+#define GL_CHROMIUM_copy_texture 1
+typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+#endif
+#endif /* GL_CHROMIUM_copy_texture */
+
+#ifndef GL_CHROMIUM_compressed_copy_texture
+#define GL_CHROMIUM_compressed_copy_texture 1
+typedef void(GL_APIENTRYP PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMPROC)(GLuint sourceId, GLuint destId);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
+#endif
+#endif /* GL_CHROMIUM_compressed_copy_texture */
+
+
+#ifndef GL_ANGLE_copy_texture_3d
+#define GL_ANGLE_copy_texture_3d 1
+typedef void(GL_APIENTRYP PFNGLCOPYTEXTURE3DANGLEPROC)(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURE3DANGLEPROC)(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+GL_APICALL void GL_APIENTRY glCopySubTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+#endif
+#endif /* GL_ANGLE_copy_texture_3d */
+
+#ifndef GL_CHROMIUM_sync_query
+#define GL_CHROMIUM_sync_query 1
+#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
+#endif /* GL_CHROMIUM_sync_query */
+
+#ifndef GL_EXT_texture_compression_s3tc_srgb
+#define GL_EXT_texture_compression_s3tc_srgb 1
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif /* GL_EXT_texture_compression_s3tc_srgb */
+
+#ifndef GL_ANGLE_lossy_etc_decode
+#define GL_ANGLE_lossy_etc_decode 1
+#define GL_ETC1_RGB8_LOSSY_DECODE_ANGLE 0x9690
+#define GL_COMPRESSED_R11_LOSSY_DECODE_EAC_ANGLE 0x9691
+#define GL_COMPRESSED_SIGNED_R11_LOSSY_DECODE_EAC_ANGLE 0x9692
+#define GL_COMPRESSED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9693
+#define GL_COMPRESSED_SIGNED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9694
+#define GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE 0x9695
+#define GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE 0x9696
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9697
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9698
+#define GL_COMPRESSED_RGBA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x9699
+#define GL_COMPRESSED_SRGB8_ALPHA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x969A
+#endif /* GL_ANGLE_lossy_etc_decode */
+
+#ifndef GL_ANGLE_robust_client_memory
+#define GL_ANGLE_robust_client_memory 1
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVROBUSTANGLEPROC) (GLuint program, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVROBUSTANGLEPROC) (GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, void **pointer);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSROBUSTANGLEPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVROBUSTANGLEPROC) (GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VROBUSTANGLEPROC) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVROBUSTANGLEPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVROBUSTANGLEPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VROBUSTANGLEPROC) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVROBUSTANGLEPROC) (GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VROBUSTANGLEPROC) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVROBUSTANGLEPROC) (GLenum pname, GLuint index, GLsizei bufSize, GLsizei *length, GLfloat *val);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVROBUSTANGLEPROC) (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVROBUSTANGLEROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSROBUSTANGLEPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVROBUSTANGLEPROC)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VROBUSTANGLEPROC)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VROBUSTANGLEPROC)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint64 *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetBooleanvRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetFloatvRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivRobustANGLE (GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegervRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramivRobustANGLE (GLuint program, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderivRobustANGLE (GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterfvRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfvRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfvRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointervRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, void **pointer);
+GL_APICALL void GL_APIENTRY glReadPixelsRobustANGLE (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *pixels);
+GL_APICALL void GL_APIENTRY glTexImage2DRobustANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexParameterfvRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLfloat *params);
+GL_APICALL void GL_APIENTRY glTexParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexSubImage2DRobustANGLE (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexImage3DRobustANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DRobustANGLE (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2DRobustANGLE(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2DRobustANGLE(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DRobustANGLE(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DRobustANGLE(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
+GL_APICALL void GL_APIENTRY glGetQueryivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivRobustANGLE (GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetBufferPointervRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data);
+GL_APICALL void GL_APIENTRY glGetInternalformativRobustANGLE (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetUniformuivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockivRobustANGLE (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetInteger64vRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetInteger64i_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64vRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfvRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfvRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetFramebufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInterfaceivRobustANGLE (GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetBooleani_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLboolean *data);
+GL_APICALL void GL_APIENTRY glGetMultisamplefvRobustANGLE (GLenum pname, GLuint index, GLsizei bufSize, GLsizei *length, GLfloat *val);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterivRobustANGLE (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvRobustANGLE (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetPointervRobustANGLERobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
+GL_APICALL void GL_APIENTRY glReadnPixelsRobustANGLE (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetnUniformuivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectivRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjecti64vRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectui64vRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint64 *params);
+#endif
+#endif /* GL_ANGLE_robust_client_memory */
+
+#ifndef GL_ANGLE_program_cache_control
+#define GL_ANGLE_program_cache_control 1
+#define GL_PROGRAM_CACHE_ENABLED_ANGLE 0x93AC
+#endif /* GL_ANGLE_program_cache_control */
+
+#ifndef GL_ANGLE_texture_rectangle
+#define GL_ANGLE_texture_rectangle 1
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE 0x84F8
+#define GL_TEXTURE_RECTANGLE_ANGLE 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE_ANGLE 0x84F6
+#define GL_SAMPLER_2D_RECT_ANGLE 0x8B63
+#endif /* GL_ANGLE_texture_rectangle */
+
+#ifndef GL_ANGLE_texture_multisample
+#define GL_ANGLE_texture_multisample 1
+#define GL_SAMPLE_POSITION_ANGLE 0x8E50
+#define GL_SAMPLE_MASK_ANGLE 0x8E51
+#define GL_SAMPLE_MASK_VALUE_ANGLE 0x8E52
+#define GL_TEXTURE_2D_MULTISAMPLE_ANGLE 0x9100
+#define GL_MAX_SAMPLE_MASK_WORDS_ANGLE 0x8E59
+#define GL_MAX_COLOR_TEXTURE_SAMPLES_ANGLE 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES_ANGLE 0x910F
+#define GL_MAX_INTEGER_SAMPLES_ANGLE 0x9110
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ANGLE 0x9104
+#define GL_TEXTURE_SAMPLES_ANGLE 0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS_ANGLE 0x9107
+typedef void(GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEANGLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void(GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVANGLEPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void(GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVANGLEPROC)(GLenum target, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVANGLEPROC)(GLenum pname, GLuint index, GLfloat *val);
+typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIANGLEPROC)(GLuint maskNumber, GLbitfield mask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage2DMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvANGLE(GLenum target, GLint level, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterivANGLE(GLenum target, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetMultisamplefvANGLE(GLenum pname, GLuint index, GLfloat *val);
+GL_APICALL void GL_APIENTRY glSampleMaskiANGLE(GLuint maskNumber, GLbitfield mask);
+#endif
+#endif // !GL_ANGLE_texture_multisample
+
+#ifndef GL_ANGLE_explicit_context
+#define GL_ANGLE_explicit_context
+typedef void *GLeglContext;
+#include "gl2ext_explicit_context_autogen.inc"
+#include "../GLES3/gl3ext_explicit_context_autogen.inc"
+#include "../GLES3/gl31ext_explicit_context_autogen.inc"
+#endif /* GL_ANGLE_explicit_context */
+
+#ifndef GL_ANGLE_multi_draw
+#define GL_ANGLE_multi_draw 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSANGLEPROC) (GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSANGLEPROC) (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, const GLsizei *instanceCounts, GLsizei drawcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysANGLE (GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
+GL_APICALL void GL_APIENTRY glMultiDrawArraysInstancedANGLE (GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsANGLE (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsInstancedANGLE (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, const GLsizei *instanceCounts, GLsizei drawcount);
+#endif
+#endif /* GL_ANGLE_multi_draw */
+
+#ifndef GL_CHROMIUM_bind_uniform_location
+#define GL_CHROMIUM_bind_uniform_location 1
+typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMPROC)(GLuint program, GLint location, const GLchar *name);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name);
+#endif
+#endif /* GL_CHROMIUM_bind_uniform_location */
+
+/* GL_CHROMIUM_lose_context */
+#ifndef GL_CHROMIUM_lose_context
+#define GL_CHROMIUM_lose_context 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLoseContextCHROMIUM(GLenum current, GLenum other);
+#endif
+typedef void (GL_APIENTRYP PFNGLLOSECONTEXTCHROMIUMPROC) (GLenum current, GLenum other);
+#endif /* GL_CHROMIUM_lose_context */
+
+#ifndef GL_ANGLE_texture_external_update
+#define GL_ANGLE_texture_external_update 1
+#define GL_TEXTURE_NATIVE_ID_ANGLE 0x3481
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DEXTERNALANGLEPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
+typedef void (GL_APIENTRYP PFNGLINVALIDATETEXTUREANGLEPROC) (GLenum target);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage2DExternalANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
+GL_APICALL void GL_APIENTRY glInvalidateTextureANGLE (GLenum target);
+#endif
+#endif /* GL_ANGLE_texture_external_update */
+
+// clang-format on
+
+#endif // INCLUDE_GLES2_GL2EXT_ANGLE_H_
diff --git a/gfx/angle/checkout/include/GLES2/gl2ext_explicit_context_autogen.inc b/gfx/angle/checkout/include/GLES2/gl2ext_explicit_context_autogen.inc
new file mode 100644
index 0000000000..8cb185acb5
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES2/gl2ext_explicit_context_autogen.inc
@@ -0,0 +1,728 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// gl2ext_explicit_context_autogen.inc:
+// Function declarations for the EGL_ANGLE_explicit_context extension
+
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLenum texture);
+typedef void (GL_APIENTRYP PFNGLATTACHSHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDTEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLBLENDCOLORCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum sfactor, GLenum dfactor);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATACONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATACONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLCLEARCONTEXTANGLEPROC)(GLeglContext ctx, GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat d);
+typedef void (GL_APIENTRYP PFNGLCLEARSTENCILCONTEXTANGLEPROC)(GLeglContext ctx, GLint s);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKCONTEXTANGLEPROC)(GLeglContext ctx, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GL_APIENTRYP PFNGLCOMPILESHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum type);
+typedef void (GL_APIENTRYP PFNGLCULLFACECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLDELETESHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDELETETEXTURESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLDEPTHFUNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func);
+typedef void (GL_APIENTRYP PFNGLDEPTHMASKCONTEXTANGLEPROC)(GLeglContext ctx, GLboolean flag);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLDETACHSHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDISABLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum cap);
+typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint first, GLsizei count);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENABLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum cap);
+typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index);
+typedef void (GL_APIENTRYP PFNGLFINISHCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLFLUSHCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLFRONTFACECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENTEXTURESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef GLenum (GL_APIENTRYP PFNGLGETERRORCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATCONTEXTANGLEPROC)(GLeglContext ctx, GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLenum pname, GLint *params);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGCONTEXTANGLEPROC)(GLeglContext ctx, GLenum name);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, void **pointer);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLHINTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum mode);
+typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint buffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDCONTEXTANGLEPROC)(GLeglContext ctx, GLenum cap);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint framebuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint renderbuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISSHADERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat width);
+typedef void (GL_APIENTRYP PFNGLLINKPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
+typedef void (GL_APIENTRYP PFNGLPIXELSTOREICONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCONTEXTANGLEPROC)(GLeglContext ctx, GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGECONTEXTANGLEPROC)(GLeglContext ctx, GLfloat value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCISSORCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSHADERBINARYCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLSHADERSOURCECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKCONTEXTANGLEPROC)(GLeglContext ctx, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPCONTEXTANGLEPROC)(GLeglContext ctx, GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATECONTEXTANGLEPROC)(GLeglContext ctx, GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERICONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4ICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint color, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *memoryObjects);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLDEBUGPROCKHR callback, const void *userParam);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *memoryObjects);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *semaphores);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLenum *bufs);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLENDQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *semaphores);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, void **params);
+typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence, GLenum pname, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memoryObject, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, void **params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLuint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLenum pname, GLuint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLubyte *data);
+typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLubyte *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
+typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLenum handleType, GLint fd);
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei length, const GLchar *marker);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memoryObject);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id);
+typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum access);
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLuint count);
+typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint memoryObject, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRCONTEXTANGLEPROC)(GLeglContext ctx, const void *ptr, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRCONTEXTANGLEPROC)(GLeglContext ctx, GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum target);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLenum pname, const GLuint64 *params);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence, GLenum condition);
+typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint fence);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
+typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTCONTEXTANGLEPROC)(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
+typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum components);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADFCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);
+typedef void (GL_APIENTRYP PFNGLMATRIXLOADIDENTITYCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum matrixMode);
+typedef GLuint (GL_APIENTRYP PFNGLGENPATHSCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei range);
+typedef void (GL_APIENTRYP PFNGLDELETEPATHSCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint first, GLsizei range);
+typedef GLboolean (GL_APIENTRYP PFNGLISPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path);
+typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLsizei numCommands, const GLubyte * commands, GLsizei numCoords, GLenum coordType, const void* coords);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLfloat value);
+typedef void (GL_APIENTRYP PFNGLPATHPARAMETERICHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLfloat * value);
+typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum pname, GLint * value);
+typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLint reference, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint path, GLint reference, GLuint mask, GLenum coverMode);
+typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat * transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat * transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+typedef void (GL_APIENTRYP PFNGLBINDFRAGMENTINPUTLOCATIONCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint programs, GLint location, const GLchar * name);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat * coeffs);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+typedef void (GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint x, GLint y, GLint width, GLint height, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLuint destId);
+typedef void (GL_APIENTRYP PFNGLREQUESTEXTENSIONANGLECONTEXTANGLEPROC)(GLeglContext ctx, const GLchar * name);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLboolean * params);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint shader, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, void ** pointer);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * pixels);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLsizei xoffset, GLsizei yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint * data);
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * data);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint64 * data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLuint pname, GLsizei bufSize, const GLint * param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat * param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLboolean * data);
+typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLuint index, GLsizei bufSize, GLsizei * length, GLfloat * val);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVROBUSTANGLEROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLuint * params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLint * param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint * param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VROBUSTANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint64 * params);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURE3DANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+typedef void (GL_APIENTRYP PFNGLCOPYSUBTEXTURE3DANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLint z, GLint width, GLint height, GLint depth, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLint * params);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLfloat * params);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, GLsizei drawcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINSTANCEDANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, const GLsizei*instanceCounts, GLsizei drawcount);
+typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLuint index, GLfloat * val);
+typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLPROVOKINGVERTEXANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLLOSECONTEXTCHROMIUMCONTEXTANGLEPROC)(GLeglContext ctx, GLenum current, GLenum other);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DEXTERNALANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
+typedef void (GL_APIENTRYP PFNGLINVALIDATETEXTUREANGLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glActiveTextureContextANGLE(GLeglContext ctx, GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocationContextANGLE(GLeglContext ctx, GLuint program, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindBufferContextANGLE(GLeglContext ctx, GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebufferContextANGLE(GLeglContext ctx, GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbufferContextANGLE(GLeglContext ctx, GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTextureContextANGLE(GLeglContext ctx, GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glBlendEquationContextANGLE(GLeglContext ctx, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparateContextANGLE(GLeglContext ctx, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFuncContextANGLE(GLeglContext ctx, GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparateContextANGLE(GLeglContext ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferDataContextANGLE(GLeglContext ctx, GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubDataContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatusContextANGLE(GLeglContext ctx, GLenum target);
+GL_APICALL void GL_APIENTRY glClearContextANGLE(GLeglContext ctx, GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthfContextANGLE(GLeglContext ctx, GLfloat d);
+GL_APICALL void GL_APIENTRY glClearStencilContextANGLE(GLeglContext ctx, GLint s);
+GL_APICALL void GL_APIENTRY glColorMaskContextANGLE(GLeglContext ctx, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShaderContextANGLE(GLeglContext ctx, GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgramContextANGLE(GLeglContext ctx);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderContextANGLE(GLeglContext ctx, GLenum type);
+GL_APICALL void GL_APIENTRY glCullFaceContextANGLE(GLeglContext ctx, GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgramContextANGLE(GLeglContext ctx, GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShaderContextANGLE(GLeglContext ctx, GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTexturesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *textures);
+GL_APICALL void GL_APIENTRY glDepthFuncContextANGLE(GLeglContext ctx, GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMaskContextANGLE(GLeglContext ctx, GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangefContextANGLE(GLeglContext ctx, GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glDetachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisableContextANGLE(GLeglContext ctx, GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArraysContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElementsContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glEnableContextANGLE(GLeglContext ctx, GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index);
+GL_APICALL void GL_APIENTRY glFinishContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glFlushContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbufferContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFaceContextANGLE(GLeglContext ctx, GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *buffers);
+GL_APICALL void GL_APIENTRY glGenFramebuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTexturesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *textures);
+GL_APICALL void GL_APIENTRY glGenerateMipmapContextANGLE(GLeglContext ctx, GLenum target);
+GL_APICALL void GL_APIENTRY glGetActiveAttribContextANGLE(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetActiveUniformContextANGLE(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetAttachedShadersContextANGLE(GLeglContext ctx, GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocationContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetBooleanvContextANGLE(GLeglContext ctx, GLenum pname, GLboolean *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_APICALL GLenum GL_APIENTRY glGetErrorContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glGetFloatvContextANGLE(GLeglContext ctx, GLenum pname, GLfloat *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegervContextANGLE(GLeglContext ctx, GLenum pname, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLogContextANGLE(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetProgramivContextANGLE(GLeglContext ctx, GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLogContextANGLE(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormatContextANGLE(GLeglContext ctx, GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSourceContextANGLE(GLeglContext ctx, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL void GL_APIENTRY glGetShaderivContextANGLE(GLeglContext ctx, GLuint shader, GLenum pname, GLint *params);
+GL_APICALL const GLubyte *GL_APIENTRY glGetStringContextANGLE(GLeglContext ctx, GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocationContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetUniformfvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointervContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, void **pointer);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfvContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribivContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glHintContextANGLE(GLeglContext ctx, GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBufferContextANGLE(GLeglContext ctx, GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabledContextANGLE(GLeglContext ctx, GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebufferContextANGLE(GLeglContext ctx, GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramContextANGLE(GLeglContext ctx, GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbufferContextANGLE(GLeglContext ctx, GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShaderContextANGLE(GLeglContext ctx, GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTextureContextANGLE(GLeglContext ctx, GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidthContextANGLE(GLeglContext ctx, GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgramContextANGLE(GLeglContext ctx, GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStoreiContextANGLE(GLeglContext ctx, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffsetContextANGLE(GLeglContext ctx, GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixelsContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompilerContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageContextANGLE(GLeglContext ctx, GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverageContextANGLE(GLeglContext ctx, GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissorContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinaryContextANGLE(GLeglContext ctx, GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSourceContextANGLE(GLeglContext ctx, GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+GL_APICALL void GL_APIENTRY glStencilFuncContextANGLE(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparateContextANGLE(GLeglContext ctx, GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskContextANGLE(GLeglContext ctx, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparateContextANGLE(GLeglContext ctx, GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOpContextANGLE(GLeglContext ctx, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparateContextANGLE(GLeglContext ctx, GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexParameterfContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfvContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLfloat *params);
+GL_APICALL void GL_APIENTRY glTexParameteriContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexSubImage2DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1iContextANGLE(GLeglContext ctx, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4ivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgramContextANGLE(GLeglContext ctx, GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgramContextANGLE(GLeglContext ctx, GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointerContextANGLE(GLeglContext ctx, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewportContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glBeginQueryEXTContextANGLE(GLeglContext ctx, GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glBindFragDataLocationEXTContextANGLE(GLeglContext ctx, GLuint program, GLuint color, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXTContextANGLE(GLeglContext ctx, GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
+GL_APICALL void GL_APIENTRY glBlitFramebufferANGLEContextANGLE(GLeglContext ctx, 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 glBufferStorageMemEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *memoryObjects);
+GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHRContextANGLE(GLeglContext ctx, GLDEBUGPROCKHR callback, const void *userParam);
+GL_APICALL void GL_APIENTRY glDebugMessageControlKHRContextANGLE(GLeglContext ctx, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GL_APICALL void GL_APIENTRY glDebugMessageInsertKHRContextANGLE(GLeglContext ctx, GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GL_APICALL void GL_APIENTRY glDeleteFencesNVContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *fences);
+GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *memoryObjects);
+GL_APICALL void GL_APIENTRY glDeleteQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *semaphores);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXTContextANGLE(GLeglContext ctx, GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawBuffersEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXTContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOESContextANGLE(GLeglContext ctx, GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOESContextANGLE(GLeglContext ctx, GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEndQueryEXTContextANGLE(GLeglContext ctx, GLenum target);
+GL_APICALL void GL_APIENTRY glFinishFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXTContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOESContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GL_APICALL void GL_APIENTRY glFramebufferTextureEXTContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVRContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+GL_APICALL void GL_APIENTRY glGenFencesNVContextANGLE(GLeglContext ctx, GLsizei n, GLuint *fences);
+GL_APICALL void GL_APIENTRY glGenQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glGenSemaphoresEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *semaphores);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, void **params);
+GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHRContextANGLE(GLeglContext ctx, GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GL_APICALL void GL_APIENTRY glGetFenceivNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum pname, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXTContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXTContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx, GLuint memoryObject, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetObjectLabelKHRContextANGLE(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHRContextANGLE(GLeglContext ctx, const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetPointervKHRContextANGLE(GLeglContext ctx, GLenum pname, void **params);
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOESContextANGLE(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXTContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectivEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLuint64 *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetQueryivEXTContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLenum pname, GLuint64 *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLEContextANGLE(GLeglContext ctx, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXTContextANGLE(GLeglContext ctx, GLenum pname, GLubyte *data);
+GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXTContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLubyte *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvEXTContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivEXTContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GL_APICALL void GL_APIENTRY glImportMemoryFdEXTContextANGLE(GLeglContext ctx, GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
+GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLenum handleType, GLint fd);
+GL_APICALL void GL_APIENTRY glInsertEventMarkerEXTContextANGLE(GLeglContext ctx, GLsizei length, const GLchar *marker);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
+GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXTContextANGLE(GLeglContext ctx, GLuint memoryObject);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryEXTContextANGLE(GLeglContext ctx, GLuint id);
+GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
+GL_APICALL void *GL_APIENTRY glMapBufferOESContextANGLE(GLeglContext ctx, GLenum target, GLenum access);
+GL_APICALL void *GL_APIENTRY glMapBufferRangeEXTContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHRContextANGLE(GLeglContext ctx, GLuint count);
+GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx, GLuint memoryObject, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glObjectLabelKHRContextANGLE(GLeglContext ctx, GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glObjectPtrLabelKHRContextANGLE(GLeglContext ctx, const void *ptr, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glPopDebugGroupKHRContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glPopGroupMarkerEXTContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glProgramBinaryOESContextANGLE(GLeglContext ctx, GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+GL_APICALL void GL_APIENTRY glPushDebugGroupKHRContextANGLE(GLeglContext ctx, GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GL_APICALL void GL_APIENTRY glPushGroupMarkerEXTContextANGLE(GLeglContext ctx, GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glQueryCounterEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum target);
+GL_APICALL void GL_APIENTRY glReadnPixelsEXTContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLEContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivOESContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLenum pname, const GLuint64 *params);
+GL_APICALL void GL_APIENTRY glSetFenceNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum condition);
+GL_APICALL void GL_APIENTRY glSignalSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
+GL_APICALL void GL_APIENTRY glTexImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexParameterIivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivOESContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glTexStorage1DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTexStorage2DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOESContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glTexStorageMem2DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem3DEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXTContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOESContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOESContextANGLE(GLeglContext ctx, GLenum target);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLEContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXTContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glWaitSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
+GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUMContextANGLE(GLeglContext ctx, GLuint program, GLint location, const GLchar* name);
+GL_APICALL void GL_APIENTRY glCoverageModulationCHROMIUMContextANGLE(GLeglContext ctx, GLenum components);
+GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode, const GLfloat * matrix);
+GL_APICALL void GL_APIENTRY glMatrixLoadIdentityCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode);
+GL_APICALL GLuint GL_APIENTRY glGenPathsCHROMIUMContextANGLE(GLeglContext ctx, GLsizei range);
+GL_APICALL void GL_APIENTRY glDeletePathsCHROMIUMContextANGLE(GLeglContext ctx, GLuint first, GLsizei range);
+GL_APICALL GLboolean GL_APIENTRY glIsPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path);
+GL_APICALL void GL_APIENTRY glPathCommandsCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLsizei numCommands, const GLubyte * commands, GLsizei numCoords, GLenum coordType, const void* coords);
+GL_APICALL void GL_APIENTRY glPathParameterfCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLfloat value);
+GL_APICALL void GL_APIENTRY glPathParameteriCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glGetPathParameterfvCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLfloat * value);
+GL_APICALL void GL_APIENTRY glGetPathParameterivCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum pname, GLint * value);
+GL_APICALL void GL_APIENTRY glPathStencilFuncCHROMIUMContextANGLE(GLeglContext ctx, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFillPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilStrokePathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLint reference, GLuint mask);
+GL_APICALL void GL_APIENTRY glCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLint reference, GLuint mask, GLenum coverMode);
+GL_APICALL void GL_APIENTRY glCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPath, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat * transformValues);
+GL_APICALL void GL_APIENTRY glStencilFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat * transformValues);
+GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx, GLsizei numPaths, GLenum pathNameType, const void * paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat * transformValues);
+GL_APICALL void GL_APIENTRY glBindFragmentInputLocationCHROMIUMContextANGLE(GLeglContext ctx, GLuint programs, GLint location, const GLchar * name);
+GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUMContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat * coeffs);
+GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUMContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUMContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint x, GLint y, GLint width, GLint height, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUMContextANGLE(GLeglContext ctx, GLuint sourceId, GLuint destId);
+GL_APICALL void GL_APIENTRY glRequestExtensionANGLEContextANGLE(GLeglContext ctx, const GLchar * name);
+GL_APICALL void GL_APIENTRY glGetBooleanvRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLboolean * params);
+GL_APICALL void GL_APIENTRY glGetBufferParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetFloatvRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetIntegervRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * data);
+GL_APICALL void GL_APIENTRY glGetProgramivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetShaderivRobustANGLEContextANGLE(GLeglContext ctx, GLuint shader, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+GL_APICALL void GL_APIENTRY glGetTexParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetUniformfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
+GL_APICALL void GL_APIENTRY glGetUniformivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribivRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointervRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, void ** pointer);
+GL_APICALL void GL_APIENTRY glReadPixelsRobustANGLEContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * pixels);
+GL_APICALL void GL_APIENTRY glTexImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+GL_APICALL void GL_APIENTRY glTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLfloat * params);
+GL_APICALL void GL_APIENTRY glTexParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
+GL_APICALL void GL_APIENTRY glTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+GL_APICALL void GL_APIENTRY glTexImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void * pixels);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLsizei xoffset, GLsizei yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid * data);
+GL_APICALL void GL_APIENTRY glGetQueryivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+GL_APICALL void GL_APIENTRY glGetBufferPointervRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint * data);
+GL_APICALL void GL_APIENTRY glGetInternalformativRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIivRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+GL_APICALL void GL_APIENTRY glGetUniformuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetInteger64vRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * data);
+GL_APICALL void GL_APIENTRY glGetInteger64i_vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLint64 * data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
+GL_APICALL void GL_APIENTRY glSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLuint pname, GLsizei bufSize, const GLint * param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat * param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+GL_APICALL void GL_APIENTRY glGetFramebufferParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetProgramInterfaceivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetBooleani_vRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLsizei bufSize, GLsizei * length, GLboolean * data);
+GL_APICALL void GL_APIENTRY glGetMultisamplefvRobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLuint index, GLsizei bufSize, GLsizei * length, GLfloat * val);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei * length, GLfloat * params);
+GL_APICALL void GL_APIENTRY glGetPointervRobustANGLERobustANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLsizei bufSize, GLsizei * length, void ** params);
+GL_APICALL void GL_APIENTRY glReadnPixelsRobustANGLEContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei * length, GLsizei * columns, GLsizei * rows, void * data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLfloat * params);
+GL_APICALL void GL_APIENTRY glGetnUniformivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetnUniformuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei bufSize, GLsizei * length, GLuint * params);
+GL_APICALL void GL_APIENTRY glTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLint * params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, const GLuint * params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLint * param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint * param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint * params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectivRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * params);
+GL_APICALL void GL_APIENTRY glGetQueryObjecti64vRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLint64 * params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectui64vRobustANGLEContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLsizei bufSize, GLsizei * length, GLuint64 * params);
+GL_APICALL void GL_APIENTRY glCopyTexture3DANGLEContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+GL_APICALL void GL_APIENTRY glCopySubTexture3DANGLEContextANGLE(GLeglContext ctx, GLuint sourceId, GLint sourceLevel, GLenum destTarget, GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLint z, GLint width, GLint height, GLint depth, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha);
+GL_APICALL void GL_APIENTRY glTexStorage2DMultisampleANGLEContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterivANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLint * params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLfloat * params);
+GL_APICALL void GL_APIENTRY glMultiDrawArraysANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
+GL_APICALL void GL_APIENTRY glMultiDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, GLsizei drawcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx, GLenum mode, const GLsizei *counts, GLenum type, const GLvoid *const*indices, const GLsizei*instanceCounts, GLsizei drawcount);
+GL_APICALL void GL_APIENTRY glGetMultisamplefvANGLEContextANGLE(GLeglContext ctx, GLenum pname, GLuint index, GLfloat * val);
+GL_APICALL void GL_APIENTRY glSampleMaskiANGLEContextANGLE(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
+GL_APICALL void GL_APIENTRY glProvokingVertexANGLEContextANGLE(GLeglContext ctx, GLenum mode);
+GL_APICALL void GL_APIENTRY glLoseContextCHROMIUMContextANGLE(GLeglContext ctx, GLenum current, GLenum other);
+GL_APICALL void GL_APIENTRY glTexImage2DExternalANGLEContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
+GL_APICALL void GL_APIENTRY glInvalidateTextureANGLEContextANGLE(GLeglContext ctx, GLenum target);
+#endif
diff --git a/gfx/angle/checkout/include/GLES2/gl2platform.h b/gfx/angle/checkout/include/GLES2/gl2platform.h
new file mode 100644
index 0000000000..89d4d44dc1
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES2/gl2platform.h
@@ -0,0 +1,30 @@
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -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 2.X gl2.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 /* __gl2platform_h_ */
diff --git a/gfx/angle/checkout/include/GLES3/gl3.h b/gfx/angle/checkout/include/GLES3/gl3.h
new file mode 100644
index 0000000000..45707856d2
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES3/gl3.h
@@ -0,0 +1,1211 @@
+#ifndef __gles2_gl3_h_
+#define __gles2_gl3_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2018 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#include <GLES3/gl3platform.h>
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+#ifndef GL_GLES_PROTOTYPES
+#define GL_GLES_PROTOTYPES 1
+#endif
+
+/* Generated on date 20181130 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]|3\.0
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef khronos_int16_t GLshort;
+typedef khronos_uint16_t GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#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
+#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
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#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
+#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
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#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
+#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
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#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
+#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
+#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
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#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
+#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
+#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
+#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
+#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
+#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
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#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
+#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
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+#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
+#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
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#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
+#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
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
+typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
+typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
+typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
+typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+#if GL_GLES_PROTOTYPES
+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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *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 d);
+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 void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *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 void *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 *data);
+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 *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+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, void **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, void *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 count, const GLuint *shaders, GLenum binaryformat, const void *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 sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *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 void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+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 index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifndef GL_ES_VERSION_3_0
+#define GL_ES_VERSION_3_0 1
+typedef khronos_uint16_t GLhalf;
+#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 0x8CA6
+#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_COLOR_ATTACHMENT16 0x8CF0
+#define GL_COLOR_ATTACHMENT17 0x8CF1
+#define GL_COLOR_ATTACHMENT18 0x8CF2
+#define GL_COLOR_ATTACHMENT19 0x8CF3
+#define GL_COLOR_ATTACHMENT20 0x8CF4
+#define GL_COLOR_ATTACHMENT21 0x8CF5
+#define GL_COLOR_ATTACHMENT22 0x8CF6
+#define GL_COLOR_ATTACHMENT23 0x8CF7
+#define GL_COLOR_ATTACHMENT24 0x8CF8
+#define GL_COLOR_ATTACHMENT25 0x8CF9
+#define GL_COLOR_ATTACHMENT26 0x8CFA
+#define GL_COLOR_ATTACHMENT27 0x8CFB
+#define GL_COLOR_ATTACHMENT28 0x8CFC
+#define GL_COLOR_ATTACHMENT29 0x8CFD
+#define GL_COLOR_ATTACHMENT30 0x8CFE
+#define GL_COLOR_ATTACHMENT31 0x8CFF
+#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 0x8F36
+#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
+#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
+typedef void (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum src);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
+typedef void (GL_APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
+typedef void (GL_APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+typedef void (GL_APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef GLuint (GL_APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
+typedef void (GL_APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
+typedef GLboolean (GL_APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
+typedef void (GL_APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+typedef void (GL_APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#if GL_GLES_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum src);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *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 void *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 void *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 void *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 void *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, void **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 void *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 void *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 void *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 *data);
+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, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *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);
+#endif
+#endif /* GL_ES_VERSION_3_0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/GLES3/gl31.h b/gfx/angle/checkout/include/GLES3/gl31.h
new file mode 100644
index 0000000000..4806181e04
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES3/gl31.h
@@ -0,0 +1,1528 @@
+#ifndef __gl31_h_
+#define __gl31_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2016 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision$ on $Date$
+*/
+
+#include <GLES3/gl3platform.h>
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+#ifndef GL_GLES_PROTOTYPES
+#define GL_GLES_PROTOTYPES 1
+#endif
+
+/* Generated on date 20161024 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]|3\.[01]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#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
+#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
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#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
+#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
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#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
+#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
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#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
+#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
+#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
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#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
+#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
+#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
+#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
+#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
+#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
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#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
+#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
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+#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
+#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
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#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
+#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
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
+typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
+typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
+typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
+typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+#if GL_GLES_PROTOTYPES
+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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *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 d);
+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 void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *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 void *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 *data);
+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 *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+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, void **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, void *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 count, const GLuint *shaders, GLenum binaryformat, const void *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 sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *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 void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+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 index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifndef GL_ES_VERSION_3_0
+#define GL_ES_VERSION_3_0 1
+typedef unsigned short GLhalf;
+#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 0x8CA6
+#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_COLOR_ATTACHMENT16 0x8CF0
+#define GL_COLOR_ATTACHMENT17 0x8CF1
+#define GL_COLOR_ATTACHMENT18 0x8CF2
+#define GL_COLOR_ATTACHMENT19 0x8CF3
+#define GL_COLOR_ATTACHMENT20 0x8CF4
+#define GL_COLOR_ATTACHMENT21 0x8CF5
+#define GL_COLOR_ATTACHMENT22 0x8CF6
+#define GL_COLOR_ATTACHMENT23 0x8CF7
+#define GL_COLOR_ATTACHMENT24 0x8CF8
+#define GL_COLOR_ATTACHMENT25 0x8CF9
+#define GL_COLOR_ATTACHMENT26 0x8CFA
+#define GL_COLOR_ATTACHMENT27 0x8CFB
+#define GL_COLOR_ATTACHMENT28 0x8CFC
+#define GL_COLOR_ATTACHMENT29 0x8CFD
+#define GL_COLOR_ATTACHMENT30 0x8CFE
+#define GL_COLOR_ATTACHMENT31 0x8CFF
+#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 0x8F36
+#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
+#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
+typedef void (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum src);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
+typedef void (GL_APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
+typedef void (GL_APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+typedef void (GL_APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef GLuint (GL_APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
+typedef void (GL_APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
+typedef GLboolean (GL_APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
+typedef void (GL_APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+typedef void (GL_APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#if GL_GLES_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum src);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *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 void *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 void *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 void *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 void *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, void **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 void *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 void *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 void *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 *data);
+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, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *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);
+#endif
+#endif /* GL_ES_VERSION_3_0 */
+
+#ifndef GL_ES_VERSION_3_1
+#define GL_ES_VERSION_3_1 1
+#define GL_COMPUTE_SHADER 0x91B9
+#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
+#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
+#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
+#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
+#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
+#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
+#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
+#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
+#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
+#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
+#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
+#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
+#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
+#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
+#define GL_COMPUTE_SHADER_BIT 0x00000020
+#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
+#define GL_MAX_UNIFORM_LOCATIONS 0x826E
+#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
+#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
+#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
+#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
+#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
+#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
+#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
+#define GL_UNIFORM 0x92E1
+#define GL_UNIFORM_BLOCK 0x92E2
+#define GL_PROGRAM_INPUT 0x92E3
+#define GL_PROGRAM_OUTPUT 0x92E4
+#define GL_BUFFER_VARIABLE 0x92E5
+#define GL_SHADER_STORAGE_BLOCK 0x92E6
+#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
+#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
+#define GL_ACTIVE_RESOURCES 0x92F5
+#define GL_MAX_NAME_LENGTH 0x92F6
+#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
+#define GL_NAME_LENGTH 0x92F9
+#define GL_TYPE 0x92FA
+#define GL_ARRAY_SIZE 0x92FB
+#define GL_OFFSET 0x92FC
+#define GL_BLOCK_INDEX 0x92FD
+#define GL_ARRAY_STRIDE 0x92FE
+#define GL_MATRIX_STRIDE 0x92FF
+#define GL_IS_ROW_MAJOR 0x9300
+#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
+#define GL_BUFFER_BINDING 0x9302
+#define GL_BUFFER_DATA_SIZE 0x9303
+#define GL_NUM_ACTIVE_VARIABLES 0x9304
+#define GL_ACTIVE_VARIABLES 0x9305
+#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
+#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
+#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
+#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
+#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
+#define GL_LOCATION 0x930E
+#define GL_VERTEX_SHADER_BIT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT 0x00000002
+#define GL_ALL_SHADER_BITS 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE 0x8258
+#define GL_ACTIVE_PROGRAM 0x8259
+#define GL_PROGRAM_PIPELINE_BINDING 0x825A
+#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
+#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
+#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
+#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
+#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
+#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
+#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
+#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
+#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
+#define GL_MAX_IMAGE_UNITS 0x8F38
+#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
+#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
+#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
+#define GL_IMAGE_BINDING_NAME 0x8F3A
+#define GL_IMAGE_BINDING_LEVEL 0x8F3B
+#define GL_IMAGE_BINDING_LAYERED 0x8F3C
+#define GL_IMAGE_BINDING_LAYER 0x8F3D
+#define GL_IMAGE_BINDING_ACCESS 0x8F3E
+#define GL_IMAGE_BINDING_FORMAT 0x906E
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
+#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
+#define GL_UNIFORM_BARRIER_BIT 0x00000004
+#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
+#define GL_COMMAND_BARRIER_BIT 0x00000040
+#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
+#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
+#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
+#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
+#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
+#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
+#define GL_IMAGE_2D 0x904D
+#define GL_IMAGE_3D 0x904E
+#define GL_IMAGE_CUBE 0x9050
+#define GL_IMAGE_2D_ARRAY 0x9053
+#define GL_INT_IMAGE_2D 0x9058
+#define GL_INT_IMAGE_3D 0x9059
+#define GL_INT_IMAGE_CUBE 0x905B
+#define GL_INT_IMAGE_2D_ARRAY 0x905E
+#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
+#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
+#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
+#define GL_READ_ONLY 0x88B8
+#define GL_WRITE_ONLY 0x88B9
+#define GL_READ_WRITE 0x88BA
+#define GL_SHADER_STORAGE_BUFFER 0x90D2
+#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
+#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
+#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
+#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
+#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
+#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
+#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
+#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
+#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
+#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
+#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
+#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
+#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
+#define GL_STENCIL_INDEX 0x1901
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#define GL_TEXTURE_SHARED_SIZE 0x8C3F
+#define GL_TEXTURE_RED_TYPE 0x8C10
+#define GL_TEXTURE_GREEN_TYPE 0x8C11
+#define GL_TEXTURE_BLUE_TYPE 0x8C12
+#define GL_TEXTURE_ALPHA_TYPE 0x8C13
+#define GL_TEXTURE_DEPTH_TYPE 0x8C16
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_VERTEX_ATTRIB_BINDING 0x82D4
+#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
+#define GL_VERTEX_BINDING_DIVISOR 0x82D6
+#define GL_VERTEX_BINDING_OFFSET 0x82D7
+#define GL_VERTEX_BINDING_STRIDE 0x82D8
+#define GL_VERTEX_BINDING_BUFFER 0x8F4F
+#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
+#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
+#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
+typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+typedef GLuint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
+typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
+typedef void (GL_APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
+#if GL_GLES_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect);
+GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
+GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
+GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
+GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
+GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
+GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
+GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
+#endif
+#endif /* GL_ES_VERSION_3_1 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/GLES3/gl31ext_explicit_context_autogen.inc b/gfx/angle/checkout/include/GLES3/gl31ext_explicit_context_autogen.inc
new file mode 100644
index 0000000000..62db01b3f8
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES3/gl31ext_explicit_context_autogen.inc
@@ -0,0 +1,148 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// gl31ext_explicit_context_autogen.inc:
+// Function declarations for the EGL_ANGLE_explicit_context extension
+
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMCONTEXTANGLEPROC)(GLeglContext ctx, GLuint pipeline, GLuint program);
+typedef void (GL_APIENTRYP PFNGLBINDIMAGETEXTURECONTEXTANGLEPROC)(GLeglContext ctx, GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINECONTEXTANGLEPROC)(GLeglContext ctx, GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum type, GLsizei count, const GLchar *const*strings);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTECONTEXTANGLEPROC)(GLeglContext ctx, GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTCONTEXTANGLEPROC)(GLeglContext ctx, GLintptr indirect);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINDIRECTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, const void *indirect);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINDIRECTCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLenum type, const void *indirect);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPARAMETERICONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLuint index, GLfloat *val);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint pipeline, GLenum pname, GLint *params);
+typedef GLuint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
+typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCENAMECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINECONTEXTANGLEPROC)(GLeglContext ctx, GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERCONTEXTANGLEPROC)(GLeglContext ctx, GLbitfield barriers);
+typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERBYREGIONCONTEXTANGLEPROC)(GLeglContext ctx, GLbitfield barriers);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1ICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2ICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3ICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4ICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLSAMPLEMASKICONTEXTANGLEPROC)(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINECONTEXTANGLEPROC)(GLeglContext ctx, GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBBINDINGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint attribindex, GLuint bindingindex);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBFORMATCONTEXTANGLEPROC)(GLeglContext ctx, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIFORMATCONTEXTANGLEPROC)(GLeglContext ctx, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+typedef void (GL_APIENTRYP PFNGLVERTEXBINDINGDIVISORCONTEXTANGLEPROC)(GLeglContext ctx, GLuint bindingindex, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glActiveShaderProgramContextANGLE(GLeglContext ctx, GLuint pipeline, GLuint program);
+GL_APICALL void GL_APIENTRY glBindImageTextureContextANGLE(GLeglContext ctx, GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+GL_APICALL void GL_APIENTRY glBindProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline);
+GL_APICALL void GL_APIENTRY glBindVertexBufferContextANGLE(GLeglContext ctx, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvContextANGLE(GLeglContext ctx, GLenum type, GLsizei count, const GLchar *const*strings);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glDispatchComputeContextANGLE(GLeglContext ctx, GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+GL_APICALL void GL_APIENTRY glDispatchComputeIndirectContextANGLE(GLeglContext ctx, GLintptr indirect);
+GL_APICALL void GL_APIENTRY glDrawArraysIndirectContextANGLE(GLeglContext ctx, GLenum mode, const void *indirect);
+GL_APICALL void GL_APIENTRY glDrawElementsIndirectContextANGLE(GLeglContext ctx, GLenum mode, GLenum type, const void *indirect);
+GL_APICALL void GL_APIENTRY glFramebufferParameteriContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glGenProgramPipelinesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGetBooleani_vContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLboolean *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferParameterivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetMultisamplefvContextANGLE(GLeglContext ctx, GLenum pname, GLuint index, GLfloat *val);
+GL_APICALL void GL_APIENTRY glGetProgramInterfaceivContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogContextANGLE(GLeglContext ctx, GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineivContextANGLE(GLeglContext ctx, GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndexContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceNameContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceivContextANGLE(GLeglContext ctx, GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterivContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum pname, GLint *params);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline);
+GL_APICALL void GL_APIENTRY glMemoryBarrierContextANGLE(GLeglContext ctx, GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glMemoryBarrierByRegionContextANGLE(GLeglContext ctx, GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glProgramUniform1fContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1iContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1ivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1uivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2ivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2uivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3ivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3uivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4ivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4uivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glSampleMaskiContextANGLE(GLeglContext ctx, GLuint maskNumber, GLbitfield mask);
+GL_APICALL void GL_APIENTRY glTexStorage2DMultisampleContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glUseProgramStagesContextANGLE(GLeglContext ctx, GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline);
+GL_APICALL void GL_APIENTRY glVertexAttribBindingContextANGLE(GLeglContext ctx, GLuint attribindex, GLuint bindingindex);
+GL_APICALL void GL_APIENTRY glVertexAttribFormatContextANGLE(GLeglContext ctx, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribIFormatContextANGLE(GLeglContext ctx, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexBindingDivisorContextANGLE(GLeglContext ctx, GLuint bindingindex, GLuint divisor);
+#endif
diff --git a/gfx/angle/checkout/include/GLES3/gl32.h b/gfx/angle/checkout/include/GLES3/gl32.h
new file mode 100644
index 0000000000..a1af7c6970
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES3/gl32.h
@@ -0,0 +1,1829 @@
+#ifndef __gl32_h_
+#define __gl32_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2016 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision$ on $Date$
+*/
+
+#include <GLES3/gl3platform.h>
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+#ifndef GL_GLES_PROTOTYPES
+#define GL_GLES_PROTOTYPES 1
+#endif
+
+/* Generated on date 20161024 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]|3\.[012]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#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
+#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
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#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
+#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
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#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
+#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
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#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
+#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
+#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
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#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
+#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
+#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
+#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
+#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
+#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
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#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
+#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
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+#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
+#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
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#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
+#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
+typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
+typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
+typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
+typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
+typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
+typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
+typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
+typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
+typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
+typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
+typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
+typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
+typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
+#if GL_GLES_PROTOTYPES
+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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *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 d);
+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 void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *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 void *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 *data);
+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 *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+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, void **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, void *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 count, const GLuint *shaders, GLenum binaryformat, const void *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 sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *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 void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+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 index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifndef GL_ES_VERSION_3_0
+#define GL_ES_VERSION_3_0 1
+typedef unsigned short GLhalf;
+#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 0x8CA6
+#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_COLOR_ATTACHMENT16 0x8CF0
+#define GL_COLOR_ATTACHMENT17 0x8CF1
+#define GL_COLOR_ATTACHMENT18 0x8CF2
+#define GL_COLOR_ATTACHMENT19 0x8CF3
+#define GL_COLOR_ATTACHMENT20 0x8CF4
+#define GL_COLOR_ATTACHMENT21 0x8CF5
+#define GL_COLOR_ATTACHMENT22 0x8CF6
+#define GL_COLOR_ATTACHMENT23 0x8CF7
+#define GL_COLOR_ATTACHMENT24 0x8CF8
+#define GL_COLOR_ATTACHMENT25 0x8CF9
+#define GL_COLOR_ATTACHMENT26 0x8CFA
+#define GL_COLOR_ATTACHMENT27 0x8CFB
+#define GL_COLOR_ATTACHMENT28 0x8CFC
+#define GL_COLOR_ATTACHMENT29 0x8CFD
+#define GL_COLOR_ATTACHMENT30 0x8CFE
+#define GL_COLOR_ATTACHMENT31 0x8CFF
+#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 0x8F36
+#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
+#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
+typedef void (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum src);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
+typedef void (GL_APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
+typedef void (GL_APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+typedef void (GL_APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef GLuint (GL_APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
+typedef void (GL_APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
+typedef GLboolean (GL_APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
+typedef void (GL_APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+typedef void (GL_APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#if GL_GLES_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum src);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *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 void *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 void *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 void *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 void *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, void **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 void *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 void *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 void *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 *data);
+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, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *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);
+#endif
+#endif /* GL_ES_VERSION_3_0 */
+
+#ifndef GL_ES_VERSION_3_1
+#define GL_ES_VERSION_3_1 1
+#define GL_COMPUTE_SHADER 0x91B9
+#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
+#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
+#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
+#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
+#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
+#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
+#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
+#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
+#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
+#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
+#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
+#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
+#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
+#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
+#define GL_COMPUTE_SHADER_BIT 0x00000020
+#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
+#define GL_MAX_UNIFORM_LOCATIONS 0x826E
+#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
+#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
+#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
+#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
+#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
+#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
+#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
+#define GL_UNIFORM 0x92E1
+#define GL_UNIFORM_BLOCK 0x92E2
+#define GL_PROGRAM_INPUT 0x92E3
+#define GL_PROGRAM_OUTPUT 0x92E4
+#define GL_BUFFER_VARIABLE 0x92E5
+#define GL_SHADER_STORAGE_BLOCK 0x92E6
+#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
+#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
+#define GL_ACTIVE_RESOURCES 0x92F5
+#define GL_MAX_NAME_LENGTH 0x92F6
+#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
+#define GL_NAME_LENGTH 0x92F9
+#define GL_TYPE 0x92FA
+#define GL_ARRAY_SIZE 0x92FB
+#define GL_OFFSET 0x92FC
+#define GL_BLOCK_INDEX 0x92FD
+#define GL_ARRAY_STRIDE 0x92FE
+#define GL_MATRIX_STRIDE 0x92FF
+#define GL_IS_ROW_MAJOR 0x9300
+#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
+#define GL_BUFFER_BINDING 0x9302
+#define GL_BUFFER_DATA_SIZE 0x9303
+#define GL_NUM_ACTIVE_VARIABLES 0x9304
+#define GL_ACTIVE_VARIABLES 0x9305
+#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
+#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
+#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
+#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
+#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
+#define GL_LOCATION 0x930E
+#define GL_VERTEX_SHADER_BIT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT 0x00000002
+#define GL_ALL_SHADER_BITS 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE 0x8258
+#define GL_ACTIVE_PROGRAM 0x8259
+#define GL_PROGRAM_PIPELINE_BINDING 0x825A
+#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
+#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
+#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
+#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
+#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
+#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
+#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
+#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
+#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
+#define GL_MAX_IMAGE_UNITS 0x8F38
+#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
+#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
+#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
+#define GL_IMAGE_BINDING_NAME 0x8F3A
+#define GL_IMAGE_BINDING_LEVEL 0x8F3B
+#define GL_IMAGE_BINDING_LAYERED 0x8F3C
+#define GL_IMAGE_BINDING_LAYER 0x8F3D
+#define GL_IMAGE_BINDING_ACCESS 0x8F3E
+#define GL_IMAGE_BINDING_FORMAT 0x906E
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
+#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
+#define GL_UNIFORM_BARRIER_BIT 0x00000004
+#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
+#define GL_COMMAND_BARRIER_BIT 0x00000040
+#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
+#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
+#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
+#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
+#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
+#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
+#define GL_IMAGE_2D 0x904D
+#define GL_IMAGE_3D 0x904E
+#define GL_IMAGE_CUBE 0x9050
+#define GL_IMAGE_2D_ARRAY 0x9053
+#define GL_INT_IMAGE_2D 0x9058
+#define GL_INT_IMAGE_3D 0x9059
+#define GL_INT_IMAGE_CUBE 0x905B
+#define GL_INT_IMAGE_2D_ARRAY 0x905E
+#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
+#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
+#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
+#define GL_READ_ONLY 0x88B8
+#define GL_WRITE_ONLY 0x88B9
+#define GL_READ_WRITE 0x88BA
+#define GL_SHADER_STORAGE_BUFFER 0x90D2
+#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
+#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
+#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
+#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
+#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
+#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
+#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
+#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
+#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
+#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
+#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
+#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
+#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
+#define GL_STENCIL_INDEX 0x1901
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#define GL_TEXTURE_SHARED_SIZE 0x8C3F
+#define GL_TEXTURE_RED_TYPE 0x8C10
+#define GL_TEXTURE_GREEN_TYPE 0x8C11
+#define GL_TEXTURE_BLUE_TYPE 0x8C12
+#define GL_TEXTURE_ALPHA_TYPE 0x8C13
+#define GL_TEXTURE_DEPTH_TYPE 0x8C16
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_VERTEX_ATTRIB_BINDING 0x82D4
+#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
+#define GL_VERTEX_BINDING_DIVISOR 0x82D6
+#define GL_VERTEX_BINDING_OFFSET 0x82D7
+#define GL_VERTEX_BINDING_STRIDE 0x82D8
+#define GL_VERTEX_BINDING_BUFFER 0x8F4F
+#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
+#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
+#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
+typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+typedef void (GL_APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+typedef GLuint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
+typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
+typedef void (GL_APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
+typedef void (GL_APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
+#if GL_GLES_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect);
+GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
+GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
+GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
+GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
+GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
+GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
+GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
+#endif
+#endif /* GL_ES_VERSION_3_1 */
+
+#ifndef GL_ES_VERSION_3_2
+#define GL_ES_VERSION_3_2 1
+typedef void (GL_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+#define GL_MULTISAMPLE_LINE_WIDTH_RANGE 0x9381
+#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY 0x9382
+#define GL_MULTIPLY 0x9294
+#define GL_SCREEN 0x9295
+#define GL_OVERLAY 0x9296
+#define GL_DARKEN 0x9297
+#define GL_LIGHTEN 0x9298
+#define GL_COLORDODGE 0x9299
+#define GL_COLORBURN 0x929A
+#define GL_HARDLIGHT 0x929B
+#define GL_SOFTLIGHT 0x929C
+#define GL_DIFFERENCE 0x929E
+#define GL_EXCLUSION 0x92A0
+#define GL_HSL_HUE 0x92AD
+#define GL_HSL_SATURATION 0x92AE
+#define GL_HSL_COLOR 0x92AF
+#define GL_HSL_LUMINOSITY 0x92B0
+#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_VERTEX_ARRAY 0x8074
+#define GL_QUERY 0x82E3
+#define GL_PROGRAM_PIPELINE 0x82E4
+#define GL_SAMPLER 0x82E6
+#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
+#define GL_GEOMETRY_SHADER 0x8DD9
+#define GL_GEOMETRY_SHADER_BIT 0x00000004
+#define GL_GEOMETRY_VERTICES_OUT 0x8916
+#define GL_GEOMETRY_INPUT_TYPE 0x8917
+#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
+#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
+#define GL_LAYER_PROVOKING_VERTEX 0x825E
+#define GL_LINES_ADJACENCY 0x000A
+#define GL_LINE_STRIP_ADJACENCY 0x000B
+#define GL_TRIANGLES_ADJACENCY 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
+#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION 0x8E4E
+#define GL_UNDEFINED_VERTEX 0x8260
+#define GL_PRIMITIVES_GENERATED 0x8C87
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312
+#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
+#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309
+#define GL_PRIMITIVE_BOUNDING_BOX 0x92BE
+#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004
+#define GL_CONTEXT_FLAGS 0x821E
+#define GL_LOSE_CONTEXT_ON_RESET 0x8252
+#define GL_GUILTY_CONTEXT_RESET 0x8253
+#define GL_INNOCENT_CONTEXT_RESET 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET 0x8255
+#define GL_RESET_NOTIFICATION_STRATEGY 0x8256
+#define GL_NO_RESET_NOTIFICATION 0x8261
+#define GL_CONTEXT_LOST 0x0507
+#define GL_SAMPLE_SHADING 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
+#define GL_PATCHES 0x000E
+#define GL_PATCH_VERTICES 0x8E72
+#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
+#define GL_TESS_GEN_MODE 0x8E76
+#define GL_TESS_GEN_SPACING 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
+#define GL_TESS_GEN_POINT_MODE 0x8E79
+#define GL_ISOLINES 0x8E7A
+#define GL_QUADS 0x0007
+#define GL_FRACTIONAL_ODD 0x8E7B
+#define GL_FRACTIONAL_EVEN 0x8E7C
+#define GL_MAX_PATCH_VERTICES 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
+#define GL_IS_PER_PATCH 0x92E7
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
+#define GL_TESS_CONTROL_SHADER 0x8E88
+#define GL_TESS_EVALUATION_SHADER 0x8E87
+#define GL_TESS_CONTROL_SHADER_BIT 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#define GL_CLAMP_TO_BORDER 0x812D
+#define GL_TEXTURE_BUFFER 0x8C2A
+#define GL_TEXTURE_BUFFER_BINDING 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
+#define GL_SAMPLER_BUFFER 0x8DC2
+#define GL_INT_SAMPLER_BUFFER 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
+#define GL_IMAGE_BUFFER 0x9051
+#define GL_INT_IMAGE_BUFFER 0x905C
+#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
+#define GL_TEXTURE_BUFFER_OFFSET 0x919D
+#define GL_TEXTURE_BUFFER_SIZE 0x919E
+#define GL_COMPRESSED_RGBA_ASTC_4x4 0x93B0
+#define GL_COMPRESSED_RGBA_ASTC_5x4 0x93B1
+#define GL_COMPRESSED_RGBA_ASTC_5x5 0x93B2
+#define GL_COMPRESSED_RGBA_ASTC_6x5 0x93B3
+#define GL_COMPRESSED_RGBA_ASTC_6x6 0x93B4
+#define GL_COMPRESSED_RGBA_ASTC_8x5 0x93B5
+#define GL_COMPRESSED_RGBA_ASTC_8x6 0x93B6
+#define GL_COMPRESSED_RGBA_ASTC_8x8 0x93B7
+#define GL_COMPRESSED_RGBA_ASTC_10x5 0x93B8
+#define GL_COMPRESSED_RGBA_ASTC_10x6 0x93B9
+#define GL_COMPRESSED_RGBA_ASTC_10x8 0x93BA
+#define GL_COMPRESSED_RGBA_ASTC_10x10 0x93BB
+#define GL_COMPRESSED_RGBA_ASTC_12x10 0x93BC
+#define GL_COMPRESSED_RGBA_ASTC_12x12 0x93BD
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4 0x93D0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4 0x93D1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5 0x93D2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5 0x93D3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6 0x93D4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5 0x93D5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6 0x93D6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8 0x93D7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5 0x93D8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6 0x93D9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8 0x93DA
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10 0x93DB
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10 0x93DC
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12 0x93DD
+#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
+#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
+#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERPROC) (void);
+typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+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);
+typedef void (GL_APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value);
+typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#if GL_GLES_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendBarrier (void);
+GL_APICALL void GL_APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+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);
+GL_APICALL void GL_APIENTRY glEnablei (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisablei (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glBlendEquationi (GLuint buf, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabledi (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
+GL_APICALL void GL_APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glPrimitiveBoundingBox (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatus (void);
+GL_APICALL void GL_APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GL_APICALL void GL_APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+GL_APICALL void GL_APIENTRY glMinSampleShading (GLfloat value);
+GL_APICALL void GL_APIENTRY glPatchParameteri (GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_ES_VERSION_3_2 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/GLES3/gl3ext_explicit_context_autogen.inc b/gfx/angle/checkout/include/GLES3/gl3ext_explicit_context_autogen.inc
new file mode 100644
index 0000000000..1e76579271
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES3/gl3ext_explicit_context_autogen.inc
@@ -0,0 +1,220 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// gl3ext_explicit_context_autogen.inc:
+// Function declarations for the EGL_ANGLE_explicit_context extension
+
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKCONTEXTANGLEPROC)(GLeglContext ctx, GLenum primitiveMode);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERBASECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLBINDBUFFERRANGECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLBINDSAMPLERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint unit, GLuint sampler);
+typedef void (GL_APIENTRYP PFNGLBINDTRANSFORMFEEDBACKCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFICONTEXTANGLEPROC)(GLeglContext ctx, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum buffer, GLint drawbuffer, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum buffer, GLint drawbuffer, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLCLEARBUFFERUIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum buffer, GLint drawbuffer, const GLuint *value);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCCONTEXTANGLEPROC)(GLeglContext ctx, GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATACONTEXTANGLEPROC)(GLeglContext ctx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETESAMPLERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei count, const GLuint *samplers);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCCONTEXTANGLEPROC)(GLeglContext ctx, GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, const GLenum *bufs);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSCONTEXTANGLEPROC)(GLeglContext ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+typedef void (GL_APIENTRYP PFNGLENDQUERYCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLENDTRANSFORMFEEDBACKCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCCONTEXTANGLEPROC)(GLeglContext ctx, GLenum condition, GLbitfield flags);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (GL_APIENTRYP PFNGLGENQUERIESCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLGENSAMPLERSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei count, GLuint *samplers);
+typedef void (GL_APIENTRYP PFNGLGENTRANSFORMFEEDBACKSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSCONTEXTANGLEPROC)(GLeglContext ctx, GLsizei n, GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMECONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMSIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, void **params);
+typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATALOCATIONCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *name);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VCONTEXTANGLEPROC)(GLeglContext ctx, GLenum pname, GLint64 *data);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLuint index, GLint *data);
+typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGICONTEXTANGLEPROC)(GLeglContext ctx, GLenum name, GLuint index);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVCONTEXTANGLEPROC)(GLeglContext ctx, GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+typedef void (GL_APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef GLuint (GL_APIENTRYP PFNGLGETUNIFORMBLOCKINDEXCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, const GLchar *uniformBlockName);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMINDICESCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLint location, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
+typedef void (GL_APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id);
+typedef GLboolean (GL_APIENTRYP PFNGLISSAMPLERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCCONTEXTANGLEPROC)(GLeglContext ctx, GLsync sync);
+typedef GLboolean (GL_APIENTRYP PFNGLISTRANSFORMFEEDBACKCONTEXTANGLEPROC)(GLeglContext ctx, GLuint id);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint array);
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERICONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLREADBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum src);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKCONTEXTANGLEPROC)(GLeglContext ctx);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLfloat *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERICONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLUNIFORM1UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLUNIFORM2UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLUNIFORM3UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UICONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLUNIFORM4UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMBLOCKBINDINGCONTEXTANGLEPROC)(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVCONTEXTANGLEPROC)(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFERCONTEXTANGLEPROC)(GLeglContext ctx, GLenum target);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint divisor);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4ICONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLint *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UICONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIVCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, const GLuint *v);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIPOINTERCONTEXTANGLEPROC)(GLeglContext ctx, GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCCONTEXTANGLEPROC)(GLeglContext ctx, GLsync sync, GLbitfield flags, GLuint64 timeout);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBeginQueryContextANGLE(GLeglContext ctx, GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glBeginTransformFeedbackContextANGLE(GLeglContext ctx, GLenum primitiveMode);
+GL_APICALL void GL_APIENTRY glBindBufferBaseContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindBufferRangeContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glBindSamplerContextANGLE(GLeglContext ctx, GLuint unit, GLuint sampler);
+GL_APICALL void GL_APIENTRY glBindTransformFeedbackContextANGLE(GLeglContext ctx, GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glBindVertexArrayContextANGLE(GLeglContext ctx, GLuint array);
+GL_APICALL void GL_APIENTRY glBlitFramebufferContextANGLE(GLeglContext ctx, 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 glClearBufferfiContextANGLE(GLeglContext ctx, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL void GL_APIENTRY glClearBufferfvContextANGLE(GLeglContext ctx, GLenum buffer, GLint drawbuffer, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glClearBufferivContextANGLE(GLeglContext ctx, GLenum buffer, GLint drawbuffer, const GLint *value);
+GL_APICALL void GL_APIENTRY glClearBufferuivContextANGLE(GLeglContext ctx, GLenum buffer, GLint drawbuffer, const GLuint *value);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSyncContextANGLE(GLeglContext ctx, GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCopyBufferSubDataContextANGLE(GLeglContext ctx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glDeleteQueriesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteSamplersContextANGLE(GLeglContext ctx, GLsizei count, const GLuint *samplers);
+GL_APICALL void GL_APIENTRY glDeleteSyncContextANGLE(GLeglContext ctx, GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacksContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+GL_APICALL void GL_APIENTRY glDrawBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedContextANGLE(GLeglContext ctx, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+GL_APICALL void GL_APIENTRY glDrawRangeElementsContextANGLE(GLeglContext ctx, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glEndQueryContextANGLE(GLeglContext ctx, GLenum target);
+GL_APICALL void GL_APIENTRY glEndTransformFeedbackContextANGLE(GLeglContext ctx);
+GL_APICALL GLsync GL_APIENTRY glFenceSyncContextANGLE(GLeglContext ctx, GLenum condition, GLbitfield flags);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayerContextANGLE(GLeglContext ctx, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL void GL_APIENTRY glGenQueriesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glGenSamplersContextANGLE(GLeglContext ctx, GLsizei count, GLuint *samplers);
+GL_APICALL void GL_APIENTRY glGenTransformFeedbacksContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glGenVertexArraysContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockNameContextANGLE(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockivContextANGLE(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformsivContextANGLE(GLeglContext ctx, GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64vContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetBufferPointervContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, void **params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataLocationContextANGLE(GLeglContext ctx, GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetInteger64i_vContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetInteger64vContextANGLE(GLeglContext ctx, GLenum pname, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vContextANGLE(GLeglContext ctx, GLenum target, GLuint index, GLint *data);
+GL_APICALL void GL_APIENTRY glGetInternalformativContextANGLE(GLeglContext ctx, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramBinaryContextANGLE(GLeglContext ctx, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivContextANGLE(GLeglContext ctx, GLuint id, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetQueryivContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfvContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterivContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL const GLubyte *GL_APIENTRY glGetStringiContextANGLE(GLeglContext ctx, GLenum name, GLuint index);
+GL_APICALL void GL_APIENTRY glGetSyncivContextANGLE(GLeglContext ctx, GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+GL_APICALL void GL_APIENTRY glGetTransformFeedbackVaryingContextANGLE(GLeglContext ctx, GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndexContextANGLE(GLeglContext ctx, GLuint program, const GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetUniformIndicesContextANGLE(GLeglContext ctx, GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+GL_APICALL void GL_APIENTRY glGetUniformuivContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIivContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuivContextANGLE(GLeglContext ctx, GLuint index, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glInvalidateFramebufferContextANGLE(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments);
+GL_APICALL void GL_APIENTRY glInvalidateSubFramebufferContextANGLE(GLeglContext ctx, GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryContextANGLE(GLeglContext ctx, GLuint id);
+GL_APICALL GLboolean GL_APIENTRY glIsSamplerContextANGLE(GLeglContext ctx, GLuint sampler);
+GL_APICALL GLboolean GL_APIENTRY glIsSyncContextANGLE(GLeglContext ctx, GLsync sync);
+GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedbackContextANGLE(GLeglContext ctx, GLuint id);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayContextANGLE(GLeglContext ctx, GLuint array);
+GL_APICALL void *GL_APIENTRY glMapBufferRangeContextANGLE(GLeglContext ctx, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glPauseTransformFeedbackContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glProgramBinaryContextANGLE(GLeglContext ctx, GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glProgramParameteriContextANGLE(GLeglContext ctx, GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glReadBufferContextANGLE(GLeglContext ctx, GLenum src);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleContextANGLE(GLeglContext ctx, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glResumeTransformFeedbackContextANGLE(GLeglContext ctx);
+GL_APICALL void GL_APIENTRY glSamplerParameterfContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfvContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLfloat *param);
+GL_APICALL void GL_APIENTRY glSamplerParameteriContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glSamplerParameterivContextANGLE(GLeglContext ctx, GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glTexImage3DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexStorage2DContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DContextANGLE(GLeglContext ctx, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTexSubImage3DContextANGLE(GLeglContext ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTransformFeedbackVaryingsContextANGLE(GLeglContext ctx, GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+GL_APICALL void GL_APIENTRY glUniform1uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glUniform1uivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform2uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glUniform2uivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform3uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glUniform3uivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform4uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glUniform4uivContextANGLE(GLeglContext ctx, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniformBlockBindingContextANGLE(GLeglContext ctx, GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvContextANGLE(GLeglContext ctx, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferContextANGLE(GLeglContext ctx, GLenum target);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glVertexAttribI4iContextANGLE(GLeglContext ctx, GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4ivContextANGLE(GLeglContext ctx, GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uiContextANGLE(GLeglContext ctx, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uivContextANGLE(GLeglContext ctx, GLuint index, const GLuint *v);
+GL_APICALL void GL_APIENTRY glVertexAttribIPointerContextANGLE(GLeglContext ctx, GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glWaitSyncContextANGLE(GLeglContext ctx, GLsync sync, GLbitfield flags, GLuint64 timeout);
+#endif
diff --git a/gfx/angle/checkout/include/GLES3/gl3platform.h b/gfx/angle/checkout/include/GLES3/gl3platform.h
new file mode 100644
index 0000000000..b1e869dd11
--- /dev/null
+++ b/gfx/angle/checkout/include/GLES3/gl3platform.h
@@ -0,0 +1,30 @@
+#ifndef __gl3platform_h_
+#define __gl3platform_h_
+
+/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -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_ */
diff --git a/gfx/angle/checkout/include/GLSLANG/ShaderLang.h b/gfx/angle/checkout/include/GLSLANG/ShaderLang.h
new file mode 100644
index 0000000000..64e6a87675
--- /dev/null
+++ b/gfx/angle/checkout/include/GLSLANG/ShaderLang.h
@@ -0,0 +1,685 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+#ifndef GLSLANG_SHADERLANG_H_
+#define GLSLANG_SHADERLANG_H_
+
+#include <stddef.h>
+
+#include "KHR/khrplatform.h"
+
+#include <array>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+//
+// This is the platform independent interface between an OGL driver
+// and the shading language compiler.
+//
+
+// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
+#include "ShaderVars.h"
+
+// Version number for shader translation API.
+// It is incremented every time the API changes.
+#define ANGLE_SH_VERSION 209
+
+enum ShShaderSpec
+{
+ SH_GLES2_SPEC,
+ SH_WEBGL_SPEC,
+
+ SH_GLES3_SPEC,
+ SH_WEBGL2_SPEC,
+
+ SH_GLES3_1_SPEC,
+ SH_WEBGL3_SPEC,
+
+ SH_GL3_3_SPEC,
+};
+
+enum ShShaderOutput
+{
+ // ESSL output only supported in some configurations.
+ SH_ESSL_OUTPUT = 0x8B45,
+
+ // GLSL output only supported in some configurations.
+ SH_GLSL_COMPATIBILITY_OUTPUT = 0x8B46,
+ // Note: GL introduced core profiles in 1.5.
+ SH_GLSL_130_OUTPUT = 0x8B47,
+ SH_GLSL_140_OUTPUT = 0x8B80,
+ SH_GLSL_150_CORE_OUTPUT = 0x8B81,
+ SH_GLSL_330_CORE_OUTPUT = 0x8B82,
+ SH_GLSL_400_CORE_OUTPUT = 0x8B83,
+ SH_GLSL_410_CORE_OUTPUT = 0x8B84,
+ SH_GLSL_420_CORE_OUTPUT = 0x8B85,
+ SH_GLSL_430_CORE_OUTPUT = 0x8B86,
+ SH_GLSL_440_CORE_OUTPUT = 0x8B87,
+ SH_GLSL_450_CORE_OUTPUT = 0x8B88,
+
+ // Prefer using these to specify HLSL output type:
+ SH_HLSL_3_0_OUTPUT = 0x8B48, // D3D 9
+ SH_HLSL_4_1_OUTPUT = 0x8B49, // D3D 11
+ SH_HLSL_4_0_FL9_3_OUTPUT = 0x8B4A, // D3D 11 feature level 9_3
+
+ // Output specialized GLSL to be fed to glslang for Vulkan SPIR.
+ SH_GLSL_VULKAN_OUTPUT = 0x8B4B,
+};
+
+// Compile options.
+// The Compile options type is defined in ShaderVars.h, to allow ANGLE to import the ShaderVars
+// header without needing the ShaderLang header. This avoids some conflicts with glslang.
+
+const ShCompileOptions SH_VALIDATE = 0;
+const ShCompileOptions SH_VALIDATE_LOOP_INDEXING = UINT64_C(1) << 0;
+const ShCompileOptions SH_INTERMEDIATE_TREE = UINT64_C(1) << 1;
+const ShCompileOptions SH_OBJECT_CODE = UINT64_C(1) << 2;
+const ShCompileOptions SH_VARIABLES = UINT64_C(1) << 3;
+const ShCompileOptions SH_LINE_DIRECTIVES = UINT64_C(1) << 4;
+const ShCompileOptions SH_SOURCE_PATH = UINT64_C(1) << 5;
+
+// This flag will keep invariant declaration for input in fragment shader for GLSL >=4.20 on AMD.
+// From GLSL >= 4.20, it's optional to add invariant for fragment input, but GPU vendors have
+// different implementations about this. Some drivers forbid invariant in fragment for GLSL>= 4.20,
+// e.g. Linux Mesa, some drivers treat that as optional, e.g. NVIDIA, some drivers require invariant
+// must match between vertex and fragment shader, e.g. AMD. The behavior on AMD is obviously wrong.
+// Remove invariant for input in fragment shader to workaround the restriction on Intel Mesa.
+// But don't remove on AMD Linux to avoid triggering the bug on AMD.
+const ShCompileOptions SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT = UINT64_C(1) << 6;
+
+// Due to spec difference between GLSL 4.1 or lower and ESSL3, some platforms (for example, Mac OSX
+// core profile) require a variable's "invariant"/"centroid" qualifiers to match between vertex and
+// fragment shader. A simple solution to allow such shaders to link is to omit the two qualifiers.
+// AMD driver in Linux requires invariant qualifier to match between vertex and fragment shaders,
+// while ESSL3 disallows invariant qualifier in fragment shader and GLSL >= 4.2 doesn't require
+// invariant qualifier to match between shaders. Remove invariant qualifier from vertex shader to
+// workaround AMD driver bug.
+// Note that the two flags take effect on ESSL3 input shaders translated to GLSL 4.1 or lower and to
+// GLSL 4.2 or newer on Linux AMD.
+// TODO(zmo): This is not a good long-term solution. Simply dropping these qualifiers may break some
+// developers' content. A more complex workaround of dynamically generating, compiling, and
+// re-linking shaders that use these qualifiers should be implemented.
+const ShCompileOptions SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3 = UINT64_C(1) << 7;
+
+// This flag works around bug in Intel Mac drivers related to abs(i) where
+// i is an integer.
+const ShCompileOptions SH_EMULATE_ABS_INT_FUNCTION = UINT64_C(1) << 8;
+
+// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
+// This flag only enforces (and can only enforce) the packing
+// restrictions for uniform variables in both vertex and fragment
+// shaders. ShCheckVariablesWithinPackingLimits() lets embedders
+// enforce the packing restrictions for varying variables during
+// program link time.
+const ShCompileOptions SH_ENFORCE_PACKING_RESTRICTIONS = UINT64_C(1) << 9;
+
+// This flag ensures all indirect (expression-based) array indexing
+// is clamped to the bounds of the array. This ensures, for example,
+// that you cannot read off the end of a uniform, whether an array
+// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
+// specified in the ShBuiltInResources when constructing the
+// compiler, selects the strategy for the clamping implementation.
+const ShCompileOptions SH_CLAMP_INDIRECT_ARRAY_BOUNDS = UINT64_C(1) << 10;
+
+// This flag limits the complexity of an expression.
+const ShCompileOptions SH_LIMIT_EXPRESSION_COMPLEXITY = UINT64_C(1) << 11;
+
+// This flag limits the depth of the call stack.
+const ShCompileOptions SH_LIMIT_CALL_STACK_DEPTH = UINT64_C(1) << 12;
+
+// This flag initializes gl_Position to vec4(0,0,0,0) at the
+// beginning of the vertex shader's main(), and has no effect in the
+// fragment shader. It is intended as a workaround for drivers which
+// incorrectly fail to link programs if gl_Position is not written.
+const ShCompileOptions SH_INIT_GL_POSITION = UINT64_C(1) << 13;
+
+// This flag replaces
+// "a && b" with "a ? b : false",
+// "a || b" with "a ? true : b".
+// This is to work around a MacOSX driver bug that |b| is executed
+// independent of |a|'s value.
+const ShCompileOptions SH_UNFOLD_SHORT_CIRCUIT = UINT64_C(1) << 14;
+
+// This flag initializes output variables to 0 at the beginning of main().
+// It is to avoid undefined behaviors.
+const ShCompileOptions SH_INIT_OUTPUT_VARIABLES = UINT64_C(1) << 15;
+
+// This flag scalarizes vec/ivec/bvec/mat constructor args.
+// It is intended as a workaround for Linux/Mac driver bugs.
+const ShCompileOptions SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = UINT64_C(1) << 16;
+
+// This flag overwrites a struct name with a unique prefix.
+// It is intended as a workaround for drivers that do not handle
+// struct scopes correctly, including all Mac drivers and Linux AMD.
+const ShCompileOptions SH_REGENERATE_STRUCT_NAMES = UINT64_C(1) << 17;
+
+// This flag makes the compiler not prune unused function early in the
+// compilation process. Pruning coupled with SH_LIMIT_CALL_STACK_DEPTH
+// helps avoid bad shaders causing stack overflows.
+const ShCompileOptions SH_DONT_PRUNE_UNUSED_FUNCTIONS = UINT64_C(1) << 18;
+
+// This flag works around a bug in NVIDIA 331 series drivers related
+// to pow(x, y) where y is a constant vector.
+const ShCompileOptions SH_REMOVE_POW_WITH_CONSTANT_EXPONENT = UINT64_C(1) << 19;
+
+// This flag works around bugs in Mac drivers related to do-while by
+// transforming them into an other construct.
+const ShCompileOptions SH_REWRITE_DO_WHILE_LOOPS = UINT64_C(1) << 20;
+
+// This flag works around a bug in the HLSL compiler optimizer that folds certain
+// constant pow expressions incorrectly. Only applies to the HLSL back-end. It works
+// by expanding the integer pow expressions into a series of multiplies.
+const ShCompileOptions SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS = UINT64_C(1) << 21;
+
+// Flatten "#pragma STDGL invariant(all)" into the declarations of
+// varying variables and built-in GLSL variables. This compiler
+// option is enabled automatically when needed.
+const ShCompileOptions SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL = UINT64_C(1) << 22;
+
+// Some drivers do not take into account the base level of the texture in the results of the
+// HLSL GetDimensions builtin. This flag instructs the compiler to manually add the base level
+// offsetting.
+const ShCompileOptions SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL = UINT64_C(1) << 23;
+
+// This flag works around an issue in translating GLSL function texelFetchOffset on
+// INTEL drivers. It works by translating texelFetchOffset into texelFetch.
+const ShCompileOptions SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH = UINT64_C(1) << 24;
+
+// This flag works around condition bug of for and while loops in Intel Mac OSX drivers.
+// Condition calculation is not correct. Rewrite it from "CONDITION" to "CONDITION && true".
+const ShCompileOptions SH_ADD_AND_TRUE_TO_LOOP_CONDITION = UINT64_C(1) << 25;
+
+// This flag works around a bug in evaluating unary minus operator on integer on some INTEL
+// drivers. It works by translating -(int) into ~(int) + 1.
+const ShCompileOptions SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR = UINT64_C(1) << 26;
+
+// This flag works around a bug in evaluating isnan() on some INTEL D3D and Mac OSX drivers.
+// It works by using an expression to emulate this function.
+const ShCompileOptions SH_EMULATE_ISNAN_FLOAT_FUNCTION = UINT64_C(1) << 27;
+
+// This flag will use all uniforms of unused std140 and shared uniform blocks at the
+// beginning of the vertex/fragment shader's main(). It is intended as a workaround for Mac
+// drivers with shader version 4.10. In those drivers, they will treat unused
+// std140 and shared uniform blocks' members as inactive. However, WebGL2.0 based on
+// OpenGL ES3.0.4 requires all members of a named uniform block declared with a shared or std140
+// layout qualifier to be considered active. The uniform block itself is also considered active.
+const ShCompileOptions SH_USE_UNUSED_STANDARD_SHARED_BLOCKS = UINT64_C(1) << 28;
+
+// This flag works around a bug in unary minus operator on float numbers on Intel
+// Mac OSX 10.11 drivers. It works by translating -float into 0.0 - float.
+const ShCompileOptions SH_REWRITE_FLOAT_UNARY_MINUS_OPERATOR = UINT64_C(1) << 29;
+
+// This flag works around a bug in evaluating atan(y, x) on some NVIDIA OpenGL drivers.
+// It works by using an expression to emulate this function.
+const ShCompileOptions SH_EMULATE_ATAN2_FLOAT_FUNCTION = UINT64_C(1) << 30;
+
+// Set to initialize uninitialized local and global temporary variables. Should only be used with
+// GLSL output. In HLSL output variables are initialized regardless of if this flag is set.
+const ShCompileOptions SH_INITIALIZE_UNINITIALIZED_LOCALS = UINT64_C(1) << 31;
+
+// The flag modifies the shader in the following way:
+// Every occurrence of gl_InstanceID is replaced by the global temporary variable InstanceID.
+// Every occurrence of gl_ViewID_OVR is replaced by the varying variable ViewID_OVR.
+// At the beginning of the body of main() in a vertex shader the following initializers are added:
+// ViewID_OVR = uint(gl_InstanceID) % num_views;
+// InstanceID = gl_InstanceID / num_views;
+// ViewID_OVR is added as a varying variable to both the vertex and fragment shaders.
+const ShCompileOptions SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW = UINT64_C(1) << 32;
+
+// With the flag enabled the GLSL/ESSL vertex shader is modified to include code for viewport
+// selection in the following way:
+// - Code to enable the extension ARB_shader_viewport_layer_array/NV_viewport_array2 is included.
+// - Code to select the viewport index or layer is inserted at the beginning of main after
+// ViewID_OVR's initialization.
+// - A declaration of the uniform multiviewBaseViewLayerIndex.
+// Note: The SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW flag also has to be enabled to have the
+// temporary variable ViewID_OVR declared and initialized.
+const ShCompileOptions SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER = UINT64_C(1) << 33;
+
+// If the flag is enabled, gl_PointSize is clamped to the maximum point size specified in
+// ShBuiltInResources in vertex shaders.
+const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 34;
+
+// Turn some arithmetic operations that operate on a float vector-scalar pair into vector-vector
+// operations. This is done recursively. Some scalar binary operations inside vector constructors
+// are also turned into vector operations.
+//
+// This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA
+// driver version 387.92. It works around the most common occurrences of the bug.
+const ShCompileOptions SH_REWRITE_VECTOR_SCALAR_ARITHMETIC = UINT64_C(1) << 35;
+
+// Don't use loops to initialize uninitialized variables. Only has an effect if some kind of
+// variable initialization is turned on.
+const ShCompileOptions SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES = UINT64_C(1) << 36;
+
+// Don't use D3D constant register zero when allocating space for uniforms. This is targeted to work
+// around a bug in NVIDIA D3D driver version 388.59 where in very specific cases the driver would
+// not handle constant register zero correctly. Only has an effect on HLSL translation.
+const ShCompileOptions SH_SKIP_D3D_CONSTANT_REGISTER_ZERO = UINT64_C(1) << 37;
+
+// Clamp gl_FragDepth to the range [0.0, 1.0] in case it is statically used.
+const ShCompileOptions SH_CLAMP_FRAG_DEPTH = UINT64_C(1) << 38;
+
+// Rewrite expressions like "v.x = z = expression;". Works around a bug in NVIDIA OpenGL drivers
+// prior to version 397.31.
+const ShCompileOptions SH_REWRITE_REPEATED_ASSIGN_TO_SWIZZLED = UINT64_C(1) << 39;
+
+// Rewrite gl_DrawID as a uniform int
+const ShCompileOptions SH_EMULATE_GL_DRAW_ID = UINT64_C(1) << 40;
+
+// This flag initializes shared variables to 0.
+// It is to avoid ompute shaders being able to read undefined values that could be coming from
+// another webpage/application.
+const ShCompileOptions SH_INIT_SHARED_VARIABLES = UINT64_C(1) << 41;
+
+// Forces the value returned from an atomic operations to be always be resolved. This is targeted to
+// workaround a bug in NVIDIA D3D driver where the return value from
+// RWByteAddressBuffer.InterlockedAdd does not get resolved when used in the .yzw components of a
+// RWByteAddressBuffer.Store operation. Only has an effect on HLSL translation.
+// http://anglebug.com/3246
+const ShCompileOptions SH_FORCE_ATOMIC_VALUE_RESOLUTION = UINT64_C(1) << 42;
+
+// Rewrite gl_BaseVertex and gl_BaseInstance as uniform int
+const ShCompileOptions SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE = UINT64_C(1) << 43;
+
+// Defines alternate strategies for implementing array index clamping.
+enum ShArrayIndexClampingStrategy
+{
+ // Use the clamp intrinsic for array index clamping.
+ SH_CLAMP_WITH_CLAMP_INTRINSIC = 1,
+
+ // Use a user-defined function for array index clamping.
+ SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION
+};
+
+// The 64 bits hash function. The first parameter is the input string; the
+// second parameter is the string length.
+using ShHashFunction64 = khronos_uint64_t (*)(const char *, size_t);
+
+//
+// Implementation dependent built-in resources (constants and extensions).
+// The names for these resources has been obtained by stripping gl_/GL_.
+//
+struct ShBuiltInResources
+{
+ // Constants.
+ int MaxVertexAttribs;
+ int MaxVertexUniformVectors;
+ int MaxVaryingVectors;
+ int MaxVertexTextureImageUnits;
+ int MaxCombinedTextureImageUnits;
+ int MaxTextureImageUnits;
+ int MaxFragmentUniformVectors;
+ int MaxDrawBuffers;
+
+ // Extensions.
+ // Set to 1 to enable the extension, else 0.
+ int OES_standard_derivatives;
+ int OES_EGL_image_external;
+ int OES_EGL_image_external_essl3;
+ int NV_EGL_stream_consumer_external;
+ int ARB_texture_rectangle;
+ int EXT_blend_func_extended;
+ int EXT_draw_buffers;
+ int EXT_frag_depth;
+ int EXT_shader_texture_lod;
+ int WEBGL_debug_shader_precision;
+ int EXT_shader_framebuffer_fetch;
+ int NV_shader_framebuffer_fetch;
+ int ARM_shader_framebuffer_fetch;
+ int OVR_multiview;
+ int OVR_multiview2;
+ int EXT_YUV_target;
+ int EXT_geometry_shader;
+ int OES_texture_storage_multisample_2d_array;
+ int OES_texture_3D;
+ int ANGLE_texture_multisample;
+ int ANGLE_multi_draw;
+ int ANGLE_base_vertex_base_instance;
+
+ // Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives
+ // with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate
+ // EXT_draw_buffers by using it in combination with GLES3.0 glDrawBuffers
+ // function. This applies to Tegra K1 devices.
+ int NV_draw_buffers;
+
+ // Set to 1 if highp precision is supported in the ESSL 1.00 version of the
+ // fragment language. Does not affect versions of the language where highp
+ // support is mandatory.
+ // Default is 0.
+ int FragmentPrecisionHigh;
+
+ // GLSL ES 3.0 constants.
+ int MaxVertexOutputVectors;
+ int MaxFragmentInputVectors;
+ int MinProgramTexelOffset;
+ int MaxProgramTexelOffset;
+
+ // Extension constants.
+
+ // Value of GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT for OpenGL ES output context.
+ // Value of GL_MAX_DUAL_SOURCE_DRAW_BUFFERS for OpenGL output context.
+ // GLES SL version 100 gl_MaxDualSourceDrawBuffersEXT value for EXT_blend_func_extended.
+ int MaxDualSourceDrawBuffers;
+
+ // Value of GL_MAX_VIEWS_OVR.
+ int MaxViewsOVR;
+
+ // Name Hashing.
+ // Set a 64 bit hash function to enable user-defined name hashing.
+ // Default is NULL.
+ ShHashFunction64 HashFunction;
+
+ // Selects a strategy to use when implementing array index clamping.
+ // Default is SH_CLAMP_WITH_CLAMP_INTRINSIC.
+ ShArrayIndexClampingStrategy ArrayIndexClampingStrategy;
+
+ // The maximum complexity an expression can be when SH_LIMIT_EXPRESSION_COMPLEXITY is turned on.
+ int MaxExpressionComplexity;
+
+ // The maximum depth a call stack can be.
+ int MaxCallStackDepth;
+
+ // The maximum number of parameters a function can have when SH_LIMIT_EXPRESSION_COMPLEXITY is
+ // turned on.
+ int MaxFunctionParameters;
+
+ // GLES 3.1 constants
+
+ // texture gather offset constraints.
+ int MinProgramTextureGatherOffset;
+ int MaxProgramTextureGatherOffset;
+
+ // maximum number of available image units
+ int MaxImageUnits;
+
+ // maximum number of image uniforms in a vertex shader
+ int MaxVertexImageUniforms;
+
+ // maximum number of image uniforms in a fragment shader
+ int MaxFragmentImageUniforms;
+
+ // maximum number of image uniforms in a compute shader
+ int MaxComputeImageUniforms;
+
+ // maximum total number of image uniforms in a program
+ int MaxCombinedImageUniforms;
+
+ // maximum number of uniform locations
+ int MaxUniformLocations;
+
+ // maximum number of ssbos and images in a shader
+ int MaxCombinedShaderOutputResources;
+
+ // maximum number of groups in each dimension
+ std::array<int, 3> MaxComputeWorkGroupCount;
+ // maximum number of threads per work group in each dimension
+ std::array<int, 3> MaxComputeWorkGroupSize;
+
+ // maximum number of total uniform components
+ int MaxComputeUniformComponents;
+
+ // maximum number of texture image units in a compute shader
+ int MaxComputeTextureImageUnits;
+
+ // maximum number of atomic counters in a compute shader
+ int MaxComputeAtomicCounters;
+
+ // maximum number of atomic counter buffers in a compute shader
+ int MaxComputeAtomicCounterBuffers;
+
+ // maximum number of atomic counters in a vertex shader
+ int MaxVertexAtomicCounters;
+
+ // maximum number of atomic counters in a fragment shader
+ int MaxFragmentAtomicCounters;
+
+ // maximum number of atomic counters in a program
+ int MaxCombinedAtomicCounters;
+
+ // maximum binding for an atomic counter
+ int MaxAtomicCounterBindings;
+
+ // maximum number of atomic counter buffers in a vertex shader
+ int MaxVertexAtomicCounterBuffers;
+
+ // maximum number of atomic counter buffers in a fragment shader
+ int MaxFragmentAtomicCounterBuffers;
+
+ // maximum number of atomic counter buffers in a program
+ int MaxCombinedAtomicCounterBuffers;
+
+ // maximum number of buffer object storage in machine units
+ int MaxAtomicCounterBufferSize;
+
+ // maximum number of uniform block bindings
+ int MaxUniformBufferBindings;
+
+ // maximum number of shader storage buffer bindings
+ int MaxShaderStorageBufferBindings;
+
+ // maximum point size (higher limit from ALIASED_POINT_SIZE_RANGE)
+ float MaxPointSize;
+
+ // EXT_geometry_shader constants
+ int MaxGeometryUniformComponents;
+ int MaxGeometryUniformBlocks;
+ int MaxGeometryInputComponents;
+ int MaxGeometryOutputComponents;
+ int MaxGeometryOutputVertices;
+ int MaxGeometryTotalOutputComponents;
+ int MaxGeometryTextureImageUnits;
+ int MaxGeometryAtomicCounterBuffers;
+ int MaxGeometryAtomicCounters;
+ int MaxGeometryShaderStorageBlocks;
+ int MaxGeometryShaderInvocations;
+ int MaxGeometryImageUniforms;
+};
+
+//
+// ShHandle held by but opaque to the driver. It is allocated,
+// managed, and de-allocated by the compiler. Its contents
+// are defined by and used by the compiler.
+//
+// If handle creation fails, 0 will be returned.
+//
+using ShHandle = void *;
+
+namespace sh
+{
+
+//
+// Driver must call this first, once, before doing any other compiler operations.
+// If the function succeeds, the return value is true, else false.
+//
+bool Initialize();
+//
+// Driver should call this at shutdown.
+// If the function succeeds, the return value is true, else false.
+//
+bool Finalize();
+
+//
+// Initialize built-in resources with minimum expected values.
+// Parameters:
+// resources: The object to initialize. Will be comparable with memcmp.
+//
+void InitBuiltInResources(ShBuiltInResources *resources);
+
+//
+// Returns the a concatenated list of the items in ShBuiltInResources as a null-terminated string.
+// This function must be updated whenever ShBuiltInResources is changed.
+// Parameters:
+// handle: Specifies the handle of the compiler to be used.
+const std::string &GetBuiltInResourcesString(const ShHandle handle);
+
+//
+// Driver calls these to create and destroy compiler objects.
+//
+// Returns the handle of constructed compiler, null if the requested compiler is not supported.
+// Parameters:
+// type: Specifies the type of shader - GL_FRAGMENT_SHADER or GL_VERTEX_SHADER.
+// spec: Specifies the language spec the compiler must conform to - SH_GLES2_SPEC or SH_WEBGL_SPEC.
+// output: Specifies the output code type - for example SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
+// SH_HLSL_3_0_OUTPUT or SH_HLSL_4_1_OUTPUT. Note: Each output type may only
+// be supported in some configurations.
+// resources: Specifies the built-in resources.
+ShHandle ConstructCompiler(sh::GLenum type,
+ ShShaderSpec spec,
+ ShShaderOutput output,
+ const ShBuiltInResources *resources);
+void Destruct(ShHandle handle);
+
+//
+// Compiles the given shader source.
+// If the function succeeds, the return value is true, else false.
+// Parameters:
+// handle: Specifies the handle of compiler to be used.
+// shaderStrings: Specifies an array of pointers to null-terminated strings containing the shader
+// source code.
+// numStrings: Specifies the number of elements in shaderStrings array.
+// compileOptions: A mask containing the following parameters:
+// SH_VALIDATE: Validates shader to ensure that it conforms to the spec
+// specified during compiler construction.
+// SH_VALIDATE_LOOP_INDEXING: Validates loop and indexing in the shader to
+// ensure that they do not exceed the minimum
+// functionality mandated in GLSL 1.0 spec,
+// Appendix A, Section 4 and 5.
+// There is no need to specify this parameter when
+// compiling for WebGL - it is implied.
+// SH_INTERMEDIATE_TREE: Writes intermediate tree to info log.
+// Can be queried by calling sh::GetInfoLog().
+// SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader.
+// Can be queried by calling sh::GetObjectCode().
+// SH_VARIABLES: Extracts attributes, uniforms, and varyings.
+// Can be queried by calling ShGetVariableInfo().
+//
+bool Compile(const ShHandle handle,
+ const char *const shaderStrings[],
+ size_t numStrings,
+ ShCompileOptions compileOptions);
+
+// Clears the results from the previous compilation.
+void ClearResults(const ShHandle handle);
+
+// Return the version of the shader language.
+int GetShaderVersion(const ShHandle handle);
+
+// Return the currently set language output type.
+ShShaderOutput GetShaderOutputType(const ShHandle handle);
+
+// Returns null-terminated information log for a compiled shader.
+// Parameters:
+// handle: Specifies the compiler
+const std::string &GetInfoLog(const ShHandle handle);
+
+// Returns null-terminated object code for a compiled shader.
+// Parameters:
+// handle: Specifies the compiler
+const std::string &GetObjectCode(const ShHandle handle);
+
+// Returns a (original_name, hash) map containing all the user defined names in the shader,
+// including variable names, function names, struct names, and struct field names.
+// Parameters:
+// handle: Specifies the compiler
+const std::map<std::string, std::string> *GetNameHashingMap(const ShHandle handle);
+
+// Shader variable inspection.
+// Returns a pointer to a list of variables of the designated type.
+// (See ShaderVars.h for type definitions, included above)
+// Returns NULL on failure.
+// Parameters:
+// handle: Specifies the compiler
+const std::vector<sh::Uniform> *GetUniforms(const ShHandle handle);
+const std::vector<sh::Varying> *GetVaryings(const ShHandle handle);
+const std::vector<sh::Varying> *GetInputVaryings(const ShHandle handle);
+const std::vector<sh::Varying> *GetOutputVaryings(const ShHandle handle);
+const std::vector<sh::Attribute> *GetAttributes(const ShHandle handle);
+const std::vector<sh::OutputVariable> *GetOutputVariables(const ShHandle handle);
+const std::vector<sh::InterfaceBlock> *GetInterfaceBlocks(const ShHandle handle);
+const std::vector<sh::InterfaceBlock> *GetUniformBlocks(const ShHandle handle);
+const std::vector<sh::InterfaceBlock> *GetShaderStorageBlocks(const ShHandle handle);
+sh::WorkGroupSize GetComputeShaderLocalGroupSize(const ShHandle handle);
+// Returns the number of views specified through the num_views layout qualifier. If num_views is
+// not set, the function returns -1.
+int GetVertexShaderNumViews(const ShHandle handle);
+
+// Returns true if the passed in variables pack in maxVectors followingthe packing rules from the
+// GLSL 1.017 spec, Appendix A, section 7.
+// Returns false otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS
+// flag above.
+// Parameters:
+// maxVectors: the available rows of registers.
+// variables: an array of variables.
+bool CheckVariablesWithinPackingLimits(int maxVectors,
+ const std::vector<sh::ShaderVariable> &variables);
+
+// Gives the compiler-assigned register for a shader storage block.
+// The method writes the value to the output variable "indexOut".
+// Returns true if it found a valid shader storage block, false otherwise.
+// Parameters:
+// handle: Specifies the compiler
+// shaderStorageBlockName: Specifies the shader storage block
+// indexOut: output variable that stores the assigned register
+bool GetShaderStorageBlockRegister(const ShHandle handle,
+ const std::string &shaderStorageBlockName,
+ unsigned int *indexOut);
+
+// Gives the compiler-assigned register for a uniform block.
+// The method writes the value to the output variable "indexOut".
+// Returns true if it found a valid uniform block, false otherwise.
+// Parameters:
+// handle: Specifies the compiler
+// uniformBlockName: Specifies the uniform block
+// indexOut: output variable that stores the assigned register
+bool GetUniformBlockRegister(const ShHandle handle,
+ const std::string &uniformBlockName,
+ unsigned int *indexOut);
+
+// Gives a map from uniform names to compiler-assigned registers in the default uniform block.
+// Note that the map contains also registers of samplers that have been extracted from structs.
+const std::map<std::string, unsigned int> *GetUniformRegisterMap(const ShHandle handle);
+
+// Sampler, image and atomic counters share registers(t type and u type),
+// GetReadonlyImage2DRegisterIndex and GetImage2DRegisterIndex return the first index into
+// a range of reserved registers for image2D/iimage2D/uimage2D variables.
+// Parameters: handle: Specifies the compiler
+unsigned int GetReadonlyImage2DRegisterIndex(const ShHandle handle);
+unsigned int GetImage2DRegisterIndex(const ShHandle handle);
+
+// The method records these used function names related with image2D/iimage2D/uimage2D, these
+// functions will be dynamically generated.
+// Parameters:
+// handle: Specifies the compiler
+const std::set<std::string> *GetUsedImage2DFunctionNames(const ShHandle handle);
+
+bool HasValidGeometryShaderInputPrimitiveType(const ShHandle handle);
+bool HasValidGeometryShaderOutputPrimitiveType(const ShHandle handle);
+bool HasValidGeometryShaderMaxVertices(const ShHandle handle);
+GLenum GetGeometryShaderInputPrimitiveType(const ShHandle handle);
+GLenum GetGeometryShaderOutputPrimitiveType(const ShHandle handle);
+int GetGeometryShaderInvocations(const ShHandle handle);
+int GetGeometryShaderMaxVertices(const ShHandle handle);
+
+//
+// Helper function to identify specs that are based on the WebGL spec.
+//
+inline bool IsWebGLBasedSpec(ShShaderSpec spec)
+{
+ return (spec == SH_WEBGL_SPEC || spec == SH_WEBGL2_SPEC || spec == SH_WEBGL3_SPEC);
+}
+
+//
+// Helper function to identify DesktopGL specs
+//
+inline bool IsDesktopGLSpec(ShShaderSpec spec)
+{
+ return spec == SH_GL3_3_SPEC;
+}
+} // namespace sh
+
+#endif // GLSLANG_SHADERLANG_H_
diff --git a/gfx/angle/checkout/include/GLSLANG/ShaderVars.h b/gfx/angle/checkout/include/GLSLANG/ShaderVars.h
new file mode 100644
index 0000000000..2bb267e93f
--- /dev/null
+++ b/gfx/angle/checkout/include/GLSLANG/ShaderVars.h
@@ -0,0 +1,336 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderVars.h:
+// Types to represent GL variables (varyings, uniforms, etc)
+//
+
+#ifndef GLSLANG_SHADERVARS_H_
+#define GLSLANG_SHADERVARS_H_
+
+#include <algorithm>
+#include <array>
+#include <string>
+#include <vector>
+
+// This type is defined here to simplify ANGLE's integration with glslang for SPIRv.
+using ShCompileOptions = uint64_t;
+
+namespace sh
+{
+// GLenum alias
+typedef unsigned int GLenum;
+
+// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
+enum InterpolationType
+{
+ INTERPOLATION_SMOOTH,
+ INTERPOLATION_CENTROID,
+ INTERPOLATION_FLAT
+};
+
+// Validate link & SSO consistency of interpolation qualifiers
+bool InterpolationTypesMatch(InterpolationType a, InterpolationType b);
+
+// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
+enum BlockLayoutType
+{
+ BLOCKLAYOUT_STANDARD,
+ BLOCKLAYOUT_STD140 = BLOCKLAYOUT_STANDARD,
+ BLOCKLAYOUT_STD430, // Shader storage block layout qualifier
+ BLOCKLAYOUT_PACKED,
+ BLOCKLAYOUT_SHARED
+};
+
+// Interface Blocks, see section 4.3.9 of the ESSL 3.10 spec
+enum class BlockType
+{
+ BLOCK_UNIFORM,
+ BLOCK_BUFFER,
+
+ // Required in OpenGL ES 3.1 extension GL_OES_shader_io_blocks.
+ // TODO(jiawei.shao@intel.com): add BLOCK_OUT.
+ BLOCK_IN
+};
+
+// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
+// Note: we must override the copy constructor and assignment operator so we can
+// work around excessive GCC binary bloating:
+// See https://code.google.com/p/angleproject/issues/detail?id=697
+struct ShaderVariable
+{
+ ShaderVariable();
+ ShaderVariable(GLenum typeIn);
+ ShaderVariable(GLenum typeIn, unsigned int arraySizeIn);
+ ~ShaderVariable();
+ ShaderVariable(const ShaderVariable &other);
+ ShaderVariable &operator=(const ShaderVariable &other);
+
+ bool isArrayOfArrays() const { return arraySizes.size() >= 2u; }
+ bool isArray() const { return !arraySizes.empty(); }
+ unsigned int getArraySizeProduct() const;
+ // Return the inner array size product.
+ // For example, if there's a variable declared as size 3 array of size 4 array of size 5 array
+ // of int:
+ // int a[3][4][5];
+ // then getInnerArraySizeProduct of a would be 4*5.
+ unsigned int getInnerArraySizeProduct() const;
+
+ // Array size 0 means not an array when passed to or returned from these functions.
+ // Note that setArraySize() is deprecated and should not be used inside ANGLE.
+ unsigned int getOutermostArraySize() const { return isArray() ? arraySizes.back() : 0; }
+ void setArraySize(unsigned int size);
+
+ // Turn this ShaderVariable from an array into a specific element in that array. Will update
+ // flattenedOffsetInParentArrays.
+ void indexIntoArray(unsigned int arrayIndex);
+
+ // Get the nth nested array size from the top. Caller is responsible for range checking
+ // arrayNestingIndex.
+ unsigned int getNestedArraySize(unsigned int arrayNestingIndex) const;
+
+ // This function should only be used with variables that are of a basic type or an array of a
+ // basic type. Shader interface variables that are enumerated according to rules in GLES 3.1
+ // spec section 7.3.1.1 page 77 are fine. For those variables the return value should match the
+ // ARRAY_SIZE value that can be queried through the API.
+ unsigned int getBasicTypeElementCount() const;
+
+ bool isStruct() const { return !fields.empty(); }
+
+ // All of the shader's variables are described using nested data
+ // structures. This is needed in order to disambiguate similar looking
+ // types, such as two structs containing the same fields, but in
+ // different orders. "findInfoByMappedName" provides an easy query for
+ // users to dive into the data structure and fetch the unique variable
+ // instance corresponding to a dereferencing chain of the top-level
+ // variable.
+ // Given a mapped name like 'a[0].b.c[0]', return the ShaderVariable
+ // that defines 'c' in |leafVar|, and the original name 'A[0].B.C[0]'
+ // in |originalName|, based on the assumption that |this| defines 'a'.
+ // If no match is found, return false.
+ bool findInfoByMappedName(const std::string &mappedFullName,
+ const ShaderVariable **leafVar,
+ std::string *originalFullName) const;
+
+ bool isBuiltIn() const;
+ bool isEmulatedBuiltIn() const;
+
+ GLenum type;
+ GLenum precision;
+ std::string name;
+ std::string mappedName;
+
+ // Used to make an array type. Outermost array size is stored at the end of the vector.
+ std::vector<unsigned int> arraySizes;
+
+ // Offset of this variable in parent arrays. In case the parent is an array of arrays, the
+ // offset is outerArrayElement * innerArraySize + innerArrayElement.
+ // For example, if there's a variable declared as size 3 array of size 4 array of int:
+ // int a[3][4];
+ // then the flattenedOffsetInParentArrays of a[2] would be 2.
+ // and flattenedOffsetInParentArrays of a[2][1] would be 2*4 + 1 = 9.
+ int parentArrayIndex() const
+ {
+ return hasParentArrayIndex() ? flattenedOffsetInParentArrays : 0;
+ }
+
+ void setParentArrayIndex(int index) { flattenedOffsetInParentArrays = index; }
+
+ bool hasParentArrayIndex() const { return flattenedOffsetInParentArrays != -1; }
+
+ // Static use means that the variable is accessed somewhere in the shader source.
+ bool staticUse;
+ // A variable is active unless the compiler determined that it is not accessed by the shader.
+ // All active variables are statically used, but not all statically used variables are
+ // necessarily active. GLES 3.0.5 section 2.12.6. GLES 3.1 section 7.3.1.
+ bool active;
+ std::vector<ShaderVariable> fields;
+ std::string structName;
+
+ // Only applies to interface block fields. Kept here for simplicity.
+ bool isRowMajorLayout;
+
+ protected:
+ bool isSameVariableAtLinkTime(const ShaderVariable &other,
+ bool matchPrecision,
+ bool matchName) const;
+
+ bool operator==(const ShaderVariable &other) const;
+ bool operator!=(const ShaderVariable &other) const { return !operator==(other); }
+
+ int flattenedOffsetInParentArrays;
+};
+
+// A variable with an integer location to pass back to the GL API: either uniform (can have location
+// in GLES3.1+), vertex shader input or fragment shader output.
+struct VariableWithLocation : public ShaderVariable
+{
+ VariableWithLocation();
+ ~VariableWithLocation();
+ VariableWithLocation(const VariableWithLocation &other);
+ VariableWithLocation &operator=(const VariableWithLocation &other);
+ bool operator==(const VariableWithLocation &other) const;
+ bool operator!=(const VariableWithLocation &other) const { return !operator==(other); }
+
+ int location;
+};
+
+struct Uniform : public VariableWithLocation
+{
+ Uniform();
+ ~Uniform();
+ Uniform(const Uniform &other);
+ Uniform &operator=(const Uniform &other);
+ bool operator==(const Uniform &other) const;
+ bool operator!=(const Uniform &other) const { return !operator==(other); }
+
+ int binding;
+ GLenum imageUnitFormat;
+ int offset;
+ bool readonly;
+ bool writeonly;
+
+ // Decide whether two uniforms are the same at shader link time,
+ // assuming one from vertex shader and the other from fragment shader.
+ // GLSL ES Spec 3.00.3, section 4.3.5.
+ // GLSL ES Spec 3.10.4, section 4.4.5
+ bool isSameUniformAtLinkTime(const Uniform &other) const;
+};
+
+struct Attribute : public VariableWithLocation
+{
+ Attribute();
+ ~Attribute();
+ Attribute(const Attribute &other);
+ Attribute &operator=(const Attribute &other);
+ bool operator==(const Attribute &other) const;
+ bool operator!=(const Attribute &other) const { return !operator==(other); }
+};
+
+struct OutputVariable : public VariableWithLocation
+{
+ OutputVariable();
+ ~OutputVariable();
+ OutputVariable(const OutputVariable &other);
+ OutputVariable &operator=(const OutputVariable &other);
+ bool operator==(const OutputVariable &other) const;
+ bool operator!=(const OutputVariable &other) const { return !operator==(other); }
+
+ // From EXT_blend_func_extended.
+ int index;
+};
+
+struct InterfaceBlockField : public ShaderVariable
+{
+ InterfaceBlockField();
+ ~InterfaceBlockField();
+ InterfaceBlockField(const InterfaceBlockField &other);
+ InterfaceBlockField &operator=(const InterfaceBlockField &other);
+ bool operator==(const InterfaceBlockField &other) const;
+ bool operator!=(const InterfaceBlockField &other) const { return !operator==(other); }
+
+ // Decide whether two InterfaceBlock fields are the same at shader
+ // link time, assuming one from vertex shader and the other from
+ // fragment shader.
+ // See GLSL ES Spec 3.00.3, sec 4.3.7.
+ bool isSameInterfaceBlockFieldAtLinkTime(const InterfaceBlockField &other) const;
+};
+
+struct Varying : public VariableWithLocation
+{
+ Varying();
+ ~Varying();
+ Varying(const Varying &other);
+ Varying &operator=(const Varying &other);
+ bool operator==(const Varying &other) const;
+ bool operator!=(const Varying &other) const { return !operator==(other); }
+
+ // Decide whether two varyings are the same at shader link time,
+ // assuming one from vertex shader and the other from fragment shader.
+ // Invariance needs to match only in ESSL1. Relevant spec sections:
+ // GLSL ES 3.00.4, sections 4.6.1 and 4.3.9.
+ // GLSL ES 1.00.17, section 4.6.4.
+ bool isSameVaryingAtLinkTime(const Varying &other, int shaderVersion) const;
+
+ // Deprecated version of isSameVaryingAtLinkTime, which assumes ESSL1.
+ bool isSameVaryingAtLinkTime(const Varying &other) const;
+
+ InterpolationType interpolation;
+ bool isInvariant;
+};
+
+struct InterfaceBlock
+{
+ InterfaceBlock();
+ ~InterfaceBlock();
+ InterfaceBlock(const InterfaceBlock &other);
+ InterfaceBlock &operator=(const InterfaceBlock &other);
+
+ // Fields from blocks with non-empty instance names are prefixed with the block name.
+ std::string fieldPrefix() const;
+ std::string fieldMappedPrefix() const;
+
+ // Decide whether two interface blocks are the same at shader link time.
+ bool isSameInterfaceBlockAtLinkTime(const InterfaceBlock &other) const;
+
+ bool isBuiltIn() const;
+
+ bool isArray() const { return arraySize > 0; }
+ unsigned int elementCount() const { return std::max(1u, arraySize); }
+
+ std::string name;
+ std::string mappedName;
+ std::string instanceName;
+ unsigned int arraySize;
+ BlockLayoutType layout;
+
+ // Deprecated. Matrix packing should only be queried from individual fields of the block.
+ // TODO(oetuaho): Remove this once it is no longer used in Chromium.
+ bool isRowMajorLayout;
+
+ int binding;
+ bool staticUse;
+ bool active;
+ BlockType blockType;
+ std::vector<InterfaceBlockField> fields;
+};
+
+struct WorkGroupSize
+{
+ // Must have a trivial default constructor since it is used in YYSTYPE.
+ inline WorkGroupSize() = default;
+ inline explicit constexpr WorkGroupSize(int initialSize);
+
+ void fill(int fillValue);
+ void setLocalSize(int localSizeX, int localSizeY, int localSizeZ);
+
+ int &operator[](size_t index);
+ int operator[](size_t index) const;
+ size_t size() const;
+
+ // Checks whether two work group size declarations match.
+ // Two work group size declarations are the same if the explicitly specified elements are the
+ // same or if one of them is specified as one and the other one is not specified
+ bool isWorkGroupSizeMatching(const WorkGroupSize &right) const;
+
+ // Checks whether any of the values are set.
+ bool isAnyValueSet() const;
+
+ // Checks whether all of the values are set.
+ bool isDeclared() const;
+
+ // Checks whether either all of the values are set, or none of them are.
+ bool isLocalSizeValid() const;
+
+ int localSizeQualifiers[3];
+};
+
+inline constexpr WorkGroupSize::WorkGroupSize(int initialSize)
+ : localSizeQualifiers{initialSize, initialSize, initialSize}
+{}
+
+} // namespace sh
+
+#endif // GLSLANG_SHADERVARS_H_
diff --git a/gfx/angle/checkout/include/KHR/khrplatform.h b/gfx/angle/checkout/include/KHR/khrplatform.h
new file mode 100644
index 0000000000..975bbffed6
--- /dev/null
+++ b/gfx/angle/checkout/include/KHR/khrplatform.h
@@ -0,0 +1,282 @@
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2018 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.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * The master copy of khrplatform.h is maintained in the Khronos EGL
+ * Registry repository at https://github.com/KhronosGroup/EGL-Registry
+ * The last semantic modification to khrplatform.h was at commit ID:
+ * 67a3e0864c2d75ea5287b9f3d2eb74a745936692
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by filing pull requests or issues on
+ * the EGL Registry repository linked above.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ * http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ * #include <KHR/khrplatform.h>
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ * khronos_int8_t signed 8 bit
+ * khronos_uint8_t unsigned 8 bit
+ * khronos_int16_t signed 16 bit
+ * khronos_uint16_t unsigned 16 bit
+ * khronos_int32_t signed 32 bit
+ * khronos_uint32_t unsigned 32 bit
+ * khronos_int64_t signed 64 bit
+ * khronos_uint64_t unsigned 64 bit
+ * khronos_intptr_t signed same number of bits as a pointer
+ * khronos_uintptr_t unsigned same number of bits as a pointer
+ * khronos_ssize_t signed size
+ * khronos_usize_t unsigned size
+ * khronos_float_t signed 32 bit floating point
+ * khronos_time_ns_t unsigned 64 bit time in nanoseconds
+ * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ * nanoseconds
+ * khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ * khronos_boolean_enum_t enumerated boolean type. This should
+ * only be used as a base type when a client API's boolean type is
+ * an enum. Client APIs which use an integer or other type for
+ * booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ * KHRONOS_APICALL
+ * KHRONOS_APIENTRY
+ * KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+ * int arg1,
+ * int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#elif defined(__ANDROID__)
+# define KHRONOS_APICALL __attribute__((visibility("default")))
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIENTRY
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+ /* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using <stdint.h>
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using <inttypes.h>
+ */
+#include <inttypes.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef _WIN64
+typedef signed long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time. Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted). The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years. Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true. Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
diff --git a/gfx/angle/checkout/include/WGL/wgl.h b/gfx/angle/checkout/include/WGL/wgl.h
new file mode 100644
index 0000000000..0bae52bdda
--- /dev/null
+++ b/gfx/angle/checkout/include/WGL/wgl.h
@@ -0,0 +1,946 @@
+#ifndef __wgl_wgl_h_
+#define __wgl_wgl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2018 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** https://github.com/KhronosGroup/OpenGL-Registry
+*/
+
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+/* Generated on date 20181206 */
+
+/* Generated C header for:
+ * API: wgl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: wgl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef WGL_VERSION_1_0
+#define WGL_VERSION_1_0 1
+#define WGL_FONT_LINES 0
+#define WGL_FONT_POLYGONS 1
+#define WGL_SWAP_MAIN_PLANE 0x00000001
+#define WGL_SWAP_OVERLAY1 0x00000002
+#define WGL_SWAP_OVERLAY2 0x00000004
+#define WGL_SWAP_OVERLAY3 0x00000008
+#define WGL_SWAP_OVERLAY4 0x00000010
+#define WGL_SWAP_OVERLAY5 0x00000020
+#define WGL_SWAP_OVERLAY6 0x00000040
+#define WGL_SWAP_OVERLAY7 0x00000080
+#define WGL_SWAP_OVERLAY8 0x00000100
+#define WGL_SWAP_OVERLAY9 0x00000200
+#define WGL_SWAP_OVERLAY10 0x00000400
+#define WGL_SWAP_OVERLAY11 0x00000800
+#define WGL_SWAP_OVERLAY12 0x00001000
+#define WGL_SWAP_OVERLAY13 0x00002000
+#define WGL_SWAP_OVERLAY14 0x00004000
+#define WGL_SWAP_OVERLAY15 0x00008000
+#define WGL_SWAP_UNDERLAY1 0x00010000
+#define WGL_SWAP_UNDERLAY2 0x00020000
+#define WGL_SWAP_UNDERLAY3 0x00040000
+#define WGL_SWAP_UNDERLAY4 0x00080000
+#define WGL_SWAP_UNDERLAY5 0x00100000
+#define WGL_SWAP_UNDERLAY6 0x00200000
+#define WGL_SWAP_UNDERLAY7 0x00400000
+#define WGL_SWAP_UNDERLAY8 0x00800000
+#define WGL_SWAP_UNDERLAY9 0x01000000
+#define WGL_SWAP_UNDERLAY10 0x02000000
+#define WGL_SWAP_UNDERLAY11 0x04000000
+#define WGL_SWAP_UNDERLAY12 0x08000000
+#define WGL_SWAP_UNDERLAY13 0x10000000
+#define WGL_SWAP_UNDERLAY14 0x20000000
+#define WGL_SWAP_UNDERLAY15 0x40000000
+typedef int (WINAPI * PFNCHOOSEPIXELFORMATPROC) (HDC hDc, const PIXELFORMATDESCRIPTOR *pPfd);
+typedef int (WINAPI * PFNDESCRIBEPIXELFORMATPROC) (HDC hdc, int ipfd, UINT cjpfd, const PIXELFORMATDESCRIPTOR *ppfd);
+typedef UINT (WINAPI * PFNGETENHMETAFILEPIXELFORMATPROC) (HENHMETAFILE hemf, const PIXELFORMATDESCRIPTOR *ppfd);
+typedef int (WINAPI * PFNGETPIXELFORMATPROC) (HDC hdc);
+typedef BOOL (WINAPI * PFNSETPIXELFORMATPROC) (HDC hdc, int ipfd, const PIXELFORMATDESCRIPTOR *ppfd);
+typedef BOOL (WINAPI * PFNSWAPBUFFERSPROC) (HDC hdc);
+typedef BOOL (WINAPI * PFNWGLCOPYCONTEXTPROC) (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
+typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTPROC) (HDC hDc);
+typedef HGLRC (WINAPI * PFNWGLCREATELAYERCONTEXTPROC) (HDC hDc, int level);
+typedef BOOL (WINAPI * PFNWGLDELETECONTEXTPROC) (HGLRC oldContext);
+typedef BOOL (WINAPI * PFNWGLDESCRIBELAYERPLANEPROC) (HDC hDc, int pixelFormat, int layerPlane, UINT nBytes, const LAYERPLANEDESCRIPTOR *plpd);
+typedef HGLRC (WINAPI * PFNWGLGETCURRENTCONTEXTPROC) (void);
+typedef HDC (WINAPI * PFNWGLGETCURRENTDCPROC) (void);
+typedef int (WINAPI * PFNWGLGETLAYERPALETTEENTRIESPROC) (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
+typedef PROC (WINAPI * PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc);
+typedef BOOL (WINAPI * PFNWGLMAKECURRENTPROC) (HDC hDc, HGLRC newContext);
+typedef BOOL (WINAPI * PFNWGLREALIZELAYERPALETTEPROC) (HDC hdc, int iLayerPlane, BOOL bRealize);
+typedef int (WINAPI * PFNWGLSETLAYERPALETTEENTRIESPROC) (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
+typedef BOOL (WINAPI * PFNWGLSHARELISTSPROC) (HGLRC hrcSrvShare, HGLRC hrcSrvSource);
+typedef BOOL (WINAPI * PFNWGLSWAPLAYERBUFFERSPROC) (HDC hdc, UINT fuFlags);
+typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase);
+typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSAPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase);
+typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSWPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase);
+typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
+typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESAPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
+typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESWPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
+#ifdef WGL_WGLEXT_PROTOTYPES
+int WINAPI ChoosePixelFormat (HDC hDc, const PIXELFORMATDESCRIPTOR *pPfd);
+int WINAPI DescribePixelFormat (HDC hdc, int ipfd, UINT cjpfd, const PIXELFORMATDESCRIPTOR *ppfd);
+UINT WINAPI GetEnhMetaFilePixelFormat (HENHMETAFILE hemf, const PIXELFORMATDESCRIPTOR *ppfd);
+int WINAPI GetPixelFormat (HDC hdc);
+BOOL WINAPI SetPixelFormat (HDC hdc, int ipfd, const PIXELFORMATDESCRIPTOR *ppfd);
+BOOL WINAPI SwapBuffers (HDC hdc);
+BOOL WINAPI wglCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
+HGLRC WINAPI wglCreateContext (HDC hDc);
+HGLRC WINAPI wglCreateLayerContext (HDC hDc, int level);
+BOOL WINAPI wglDeleteContext (HGLRC oldContext);
+BOOL WINAPI wglDescribeLayerPlane (HDC hDc, int pixelFormat, int layerPlane, UINT nBytes, const LAYERPLANEDESCRIPTOR *plpd);
+HGLRC WINAPI wglGetCurrentContext (void);
+HDC WINAPI wglGetCurrentDC (void);
+int WINAPI wglGetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
+PROC WINAPI wglGetProcAddress (LPCSTR lpszProc);
+BOOL WINAPI wglMakeCurrent (HDC hDc, HGLRC newContext);
+BOOL WINAPI wglRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize);
+int WINAPI wglSetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
+BOOL WINAPI wglShareLists (HGLRC hrcSrvShare, HGLRC hrcSrvSource);
+BOOL WINAPI wglSwapLayerBuffers (HDC hdc, UINT fuFlags);
+BOOL WINAPI wglUseFontBitmaps (HDC hDC, DWORD first, DWORD count, DWORD listBase);
+BOOL WINAPI wglUseFontBitmapsA (HDC hDC, DWORD first, DWORD count, DWORD listBase);
+BOOL WINAPI wglUseFontBitmapsW (HDC hDC, DWORD first, DWORD count, DWORD listBase);
+BOOL WINAPI wglUseFontOutlines (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
+BOOL WINAPI wglUseFontOutlinesA (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
+BOOL WINAPI wglUseFontOutlinesW (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
+#endif
+#endif /* WGL_VERSION_1_0 */
+
+#ifndef WGL_ARB_buffer_region
+#define WGL_ARB_buffer_region 1
+#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
+#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
+#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
+#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
+typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
+typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
+typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
+typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
+VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
+BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
+BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+#endif
+#endif /* WGL_ARB_buffer_region */
+
+#ifndef WGL_ARB_context_flush_control
+#define WGL_ARB_context_flush_control 1
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+#endif /* WGL_ARB_context_flush_control */
+
+#ifndef WGL_ARB_create_context
+#define WGL_ARB_create_context 1
+#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
+#define WGL_CONTEXT_FLAGS_ARB 0x2094
+#define ERROR_INVALID_VERSION_ARB 0x2095
+typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
+#endif
+#endif /* WGL_ARB_create_context */
+
+#ifndef WGL_ARB_create_context_no_error
+#define WGL_ARB_create_context_no_error 1
+#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
+#endif /* WGL_ARB_create_context_no_error */
+
+#ifndef WGL_ARB_create_context_profile
+#define WGL_ARB_create_context_profile 1
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define ERROR_INVALID_PROFILE_ARB 0x2096
+#endif /* WGL_ARB_create_context_profile */
+
+#ifndef WGL_ARB_create_context_robustness
+#define WGL_ARB_create_context_robustness 1
+#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
+#endif /* WGL_ARB_create_context_robustness */
+
+#ifndef WGL_ARB_extensions_string
+#define WGL_ARB_extensions_string 1
+typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
+#endif
+#endif /* WGL_ARB_extensions_string */
+
+#ifndef WGL_ARB_framebuffer_sRGB
+#define WGL_ARB_framebuffer_sRGB 1
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
+#endif /* WGL_ARB_framebuffer_sRGB */
+
+#ifndef WGL_ARB_make_current_read
+#define WGL_ARB_make_current_read 1
+#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
+#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+HDC WINAPI wglGetCurrentReadDCARB (void);
+#endif
+#endif /* WGL_ARB_make_current_read */
+
+#ifndef WGL_ARB_multisample
+#define WGL_ARB_multisample 1
+#define WGL_SAMPLE_BUFFERS_ARB 0x2041
+#define WGL_SAMPLES_ARB 0x2042
+#endif /* WGL_ARB_multisample */
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_ARB_pbuffer 1
+DECLARE_HANDLE(HPBUFFERARB);
+#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
+#define WGL_PBUFFER_LARGEST_ARB 0x2033
+#define WGL_PBUFFER_WIDTH_ARB 0x2034
+#define WGL_PBUFFER_HEIGHT_ARB 0x2035
+#define WGL_PBUFFER_LOST_ARB 0x2036
+typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
+int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
+BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
+BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+#endif
+#endif /* WGL_ARB_pbuffer */
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_ARB_pixel_format 1
+#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#define WGL_DRAW_TO_BITMAP_ARB 0x2002
+#define WGL_ACCELERATION_ARB 0x2003
+#define WGL_NEED_PALETTE_ARB 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
+#define WGL_SWAP_METHOD_ARB 0x2007
+#define WGL_NUMBER_OVERLAYS_ARB 0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
+#define WGL_TRANSPARENT_ARB 0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB 0x200C
+#define WGL_SHARE_STENCIL_ARB 0x200D
+#define WGL_SHARE_ACCUM_ARB 0x200E
+#define WGL_SUPPORT_GDI_ARB 0x200F
+#define WGL_SUPPORT_OPENGL_ARB 0x2010
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#define WGL_STEREO_ARB 0x2012
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#define WGL_COLOR_BITS_ARB 0x2014
+#define WGL_RED_BITS_ARB 0x2015
+#define WGL_RED_SHIFT_ARB 0x2016
+#define WGL_GREEN_BITS_ARB 0x2017
+#define WGL_GREEN_SHIFT_ARB 0x2018
+#define WGL_BLUE_BITS_ARB 0x2019
+#define WGL_BLUE_SHIFT_ARB 0x201A
+#define WGL_ALPHA_BITS_ARB 0x201B
+#define WGL_ALPHA_SHIFT_ARB 0x201C
+#define WGL_ACCUM_BITS_ARB 0x201D
+#define WGL_ACCUM_RED_BITS_ARB 0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+#define WGL_DEPTH_BITS_ARB 0x2022
+#define WGL_STENCIL_BITS_ARB 0x2023
+#define WGL_AUX_BUFFERS_ARB 0x2024
+#define WGL_NO_ACCELERATION_ARB 0x2025
+#define WGL_GENERIC_ACCELERATION_ARB 0x2026
+#define WGL_FULL_ACCELERATION_ARB 0x2027
+#define WGL_SWAP_EXCHANGE_ARB 0x2028
+#define WGL_SWAP_COPY_ARB 0x2029
+#define WGL_SWAP_UNDEFINED_ARB 0x202A
+#define WGL_TYPE_RGBA_ARB 0x202B
+#define WGL_TYPE_COLORINDEX_ARB 0x202C
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+#endif /* WGL_ARB_pixel_format */
+
+#ifndef WGL_ARB_pixel_format_float
+#define WGL_ARB_pixel_format_float 1
+#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
+#endif /* WGL_ARB_pixel_format_float */
+
+#ifndef WGL_ARB_render_texture
+#define WGL_ARB_render_texture 1
+#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
+#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
+#define WGL_TEXTURE_FORMAT_ARB 0x2072
+#define WGL_TEXTURE_TARGET_ARB 0x2073
+#define WGL_MIPMAP_TEXTURE_ARB 0x2074
+#define WGL_TEXTURE_RGB_ARB 0x2075
+#define WGL_TEXTURE_RGBA_ARB 0x2076
+#define WGL_NO_TEXTURE_ARB 0x2077
+#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
+#define WGL_TEXTURE_1D_ARB 0x2079
+#define WGL_TEXTURE_2D_ARB 0x207A
+#define WGL_MIPMAP_LEVEL_ARB 0x207B
+#define WGL_CUBE_MAP_FACE_ARB 0x207C
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
+#define WGL_FRONT_LEFT_ARB 0x2083
+#define WGL_FRONT_RIGHT_ARB 0x2084
+#define WGL_BACK_LEFT_ARB 0x2085
+#define WGL_BACK_RIGHT_ARB 0x2086
+#define WGL_AUX0_ARB 0x2087
+#define WGL_AUX1_ARB 0x2088
+#define WGL_AUX2_ARB 0x2089
+#define WGL_AUX3_ARB 0x208A
+#define WGL_AUX4_ARB 0x208B
+#define WGL_AUX5_ARB 0x208C
+#define WGL_AUX6_ARB 0x208D
+#define WGL_AUX7_ARB 0x208E
+#define WGL_AUX8_ARB 0x208F
+#define WGL_AUX9_ARB 0x2090
+typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
+BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
+BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
+#endif
+#endif /* WGL_ARB_render_texture */
+
+#ifndef WGL_ARB_robustness_application_isolation
+#define WGL_ARB_robustness_application_isolation 1
+#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
+#endif /* WGL_ARB_robustness_application_isolation */
+
+#ifndef WGL_ARB_robustness_share_group_isolation
+#define WGL_ARB_robustness_share_group_isolation 1
+#endif /* WGL_ARB_robustness_share_group_isolation */
+
+#ifndef WGL_3DFX_multisample
+#define WGL_3DFX_multisample 1
+#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
+#define WGL_SAMPLES_3DFX 0x2061
+#endif /* WGL_3DFX_multisample */
+
+#ifndef WGL_3DL_stereo_control
+#define WGL_3DL_stereo_control 1
+#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
+#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
+#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
+#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
+typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
+#endif
+#endif /* WGL_3DL_stereo_control */
+
+#ifndef WGL_AMD_gpu_association
+#define WGL_AMD_gpu_association 1
+#define WGL_GPU_VENDOR_AMD 0x1F00
+#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
+#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
+#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
+#define WGL_GPU_RAM_AMD 0x21A3
+#define WGL_GPU_CLOCK_AMD 0x21A4
+#define WGL_GPU_NUM_PIPES_AMD 0x21A5
+#define WGL_GPU_NUM_SIMD_AMD 0x21A6
+#define WGL_GPU_NUM_RB_AMD 0x21A7
+#define WGL_GPU_NUM_SPI_AMD 0x21A8
+typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
+typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
+typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
+typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
+typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
+typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef WGL_WGLEXT_PROTOTYPES
+UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
+INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
+UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
+HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
+HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
+BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
+BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
+HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
+VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* WGL_AMD_gpu_association */
+
+#ifndef WGL_ATI_pixel_format_float
+#define WGL_ATI_pixel_format_float 1
+#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
+#endif /* WGL_ATI_pixel_format_float */
+
+#ifndef WGL_ATI_render_texture_rectangle
+#define WGL_ATI_render_texture_rectangle 1
+#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5
+#endif /* WGL_ATI_render_texture_rectangle */
+
+#ifndef WGL_EXT_colorspace
+#define WGL_EXT_colorspace 1
+#define WGL_COLORSPACE_EXT 0x309D
+#define WGL_COLORSPACE_SRGB_EXT 0x3089
+#define WGL_COLORSPACE_LINEAR_EXT 0x308A
+#endif /* WGL_EXT_colorspace */
+
+#ifndef WGL_EXT_create_context_es2_profile
+#define WGL_EXT_create_context_es2_profile 1
+#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+#endif /* WGL_EXT_create_context_es2_profile */
+
+#ifndef WGL_EXT_create_context_es_profile
+#define WGL_EXT_create_context_es_profile 1
+#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
+#endif /* WGL_EXT_create_context_es_profile */
+
+#ifndef WGL_EXT_depth_float
+#define WGL_EXT_depth_float 1
+#define WGL_DEPTH_FLOAT_EXT 0x2040
+#endif /* WGL_EXT_depth_float */
+
+#ifndef WGL_EXT_display_color_table
+#define WGL_EXT_display_color_table 1
+typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
+typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+#ifdef WGL_WGLEXT_PROTOTYPES
+GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
+GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
+GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
+VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
+#endif
+#endif /* WGL_EXT_display_color_table */
+
+#ifndef WGL_EXT_extensions_string
+#define WGL_EXT_extensions_string 1
+typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+const char *WINAPI wglGetExtensionsStringEXT (void);
+#endif
+#endif /* WGL_EXT_extensions_string */
+
+#ifndef WGL_EXT_framebuffer_sRGB
+#define WGL_EXT_framebuffer_sRGB 1
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
+#endif /* WGL_EXT_framebuffer_sRGB */
+
+#ifndef WGL_EXT_make_current_read
+#define WGL_EXT_make_current_read 1
+#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+HDC WINAPI wglGetCurrentReadDCEXT (void);
+#endif
+#endif /* WGL_EXT_make_current_read */
+
+#ifndef WGL_EXT_multisample
+#define WGL_EXT_multisample 1
+#define WGL_SAMPLE_BUFFERS_EXT 0x2041
+#define WGL_SAMPLES_EXT 0x2042
+#endif /* WGL_EXT_multisample */
+
+#ifndef WGL_EXT_pbuffer
+#define WGL_EXT_pbuffer 1
+DECLARE_HANDLE(HPBUFFEREXT);
+#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
+#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
+#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
+#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
+#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
+#define WGL_PBUFFER_LARGEST_EXT 0x2033
+#define WGL_PBUFFER_WIDTH_EXT 0x2034
+#define WGL_PBUFFER_HEIGHT_EXT 0x2035
+typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
+int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
+BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
+BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
+#endif
+#endif /* WGL_EXT_pbuffer */
+
+#ifndef WGL_EXT_pixel_format
+#define WGL_EXT_pixel_format 1
+#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
+#define WGL_DRAW_TO_WINDOW_EXT 0x2001
+#define WGL_DRAW_TO_BITMAP_EXT 0x2002
+#define WGL_ACCELERATION_EXT 0x2003
+#define WGL_NEED_PALETTE_EXT 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
+#define WGL_SWAP_METHOD_EXT 0x2007
+#define WGL_NUMBER_OVERLAYS_EXT 0x2008
+#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
+#define WGL_TRANSPARENT_EXT 0x200A
+#define WGL_TRANSPARENT_VALUE_EXT 0x200B
+#define WGL_SHARE_DEPTH_EXT 0x200C
+#define WGL_SHARE_STENCIL_EXT 0x200D
+#define WGL_SHARE_ACCUM_EXT 0x200E
+#define WGL_SUPPORT_GDI_EXT 0x200F
+#define WGL_SUPPORT_OPENGL_EXT 0x2010
+#define WGL_DOUBLE_BUFFER_EXT 0x2011
+#define WGL_STEREO_EXT 0x2012
+#define WGL_PIXEL_TYPE_EXT 0x2013
+#define WGL_COLOR_BITS_EXT 0x2014
+#define WGL_RED_BITS_EXT 0x2015
+#define WGL_RED_SHIFT_EXT 0x2016
+#define WGL_GREEN_BITS_EXT 0x2017
+#define WGL_GREEN_SHIFT_EXT 0x2018
+#define WGL_BLUE_BITS_EXT 0x2019
+#define WGL_BLUE_SHIFT_EXT 0x201A
+#define WGL_ALPHA_BITS_EXT 0x201B
+#define WGL_ALPHA_SHIFT_EXT 0x201C
+#define WGL_ACCUM_BITS_EXT 0x201D
+#define WGL_ACCUM_RED_BITS_EXT 0x201E
+#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
+#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
+#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
+#define WGL_DEPTH_BITS_EXT 0x2022
+#define WGL_STENCIL_BITS_EXT 0x2023
+#define WGL_AUX_BUFFERS_EXT 0x2024
+#define WGL_NO_ACCELERATION_EXT 0x2025
+#define WGL_GENERIC_ACCELERATION_EXT 0x2026
+#define WGL_FULL_ACCELERATION_EXT 0x2027
+#define WGL_SWAP_EXCHANGE_EXT 0x2028
+#define WGL_SWAP_COPY_EXT 0x2029
+#define WGL_SWAP_UNDEFINED_EXT 0x202A
+#define WGL_TYPE_RGBA_EXT 0x202B
+#define WGL_TYPE_COLORINDEX_EXT 0x202C
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
+BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
+BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+#endif /* WGL_EXT_pixel_format */
+
+#ifndef WGL_EXT_pixel_format_packed_float
+#define WGL_EXT_pixel_format_packed_float 1
+#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
+#endif /* WGL_EXT_pixel_format_packed_float */
+
+#ifndef WGL_EXT_swap_control
+#define WGL_EXT_swap_control 1
+typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
+typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglSwapIntervalEXT (int interval);
+int WINAPI wglGetSwapIntervalEXT (void);
+#endif
+#endif /* WGL_EXT_swap_control */
+
+#ifndef WGL_EXT_swap_control_tear
+#define WGL_EXT_swap_control_tear 1
+#endif /* WGL_EXT_swap_control_tear */
+
+#ifndef WGL_I3D_digital_video_control
+#define WGL_I3D_digital_video_control 1
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
+#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
+#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
+typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
+BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
+#endif
+#endif /* WGL_I3D_digital_video_control */
+
+#ifndef WGL_I3D_gamma
+#define WGL_I3D_gamma 1
+#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
+#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
+BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
+BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
+BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
+#endif
+#endif /* WGL_I3D_gamma */
+
+#ifndef WGL_I3D_genlock
+#define WGL_I3D_genlock 1
+#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
+#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
+#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
+#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
+#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
+#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
+#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
+#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
+#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
+typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
+typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
+BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
+BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
+BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
+BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
+BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
+BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
+BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
+BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
+BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
+BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
+BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
+#endif
+#endif /* WGL_I3D_genlock */
+
+#ifndef WGL_I3D_image_buffer
+#define WGL_I3D_image_buffer 1
+#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
+#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
+typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
+typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
+typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
+typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
+#ifdef WGL_WGLEXT_PROTOTYPES
+LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
+BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
+BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
+BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
+#endif
+#endif /* WGL_I3D_image_buffer */
+
+#ifndef WGL_I3D_swap_frame_lock
+#define WGL_I3D_swap_frame_lock 1
+typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglEnableFrameLockI3D (void);
+BOOL WINAPI wglDisableFrameLockI3D (void);
+BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
+BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
+#endif
+#endif /* WGL_I3D_swap_frame_lock */
+
+#ifndef WGL_I3D_swap_frame_usage
+#define WGL_I3D_swap_frame_usage 1
+typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
+typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
+BOOL WINAPI wglBeginFrameTrackingI3D (void);
+BOOL WINAPI wglEndFrameTrackingI3D (void);
+BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
+#endif
+#endif /* WGL_I3D_swap_frame_usage */
+
+#ifndef WGL_NV_DX_interop
+#define WGL_NV_DX_interop 1
+#define WGL_ACCESS_READ_ONLY_NV 0x00000000
+#define WGL_ACCESS_READ_WRITE_NV 0x00000001
+#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
+typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
+typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
+typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
+typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
+typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
+typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
+typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
+typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
+HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
+BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
+HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
+BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
+BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
+BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
+BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
+#endif
+#endif /* WGL_NV_DX_interop */
+
+#ifndef WGL_NV_DX_interop2
+#define WGL_NV_DX_interop2 1
+#endif /* WGL_NV_DX_interop2 */
+
+#ifndef WGL_NV_copy_image
+#define WGL_NV_copy_image 1
+typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+#endif /* WGL_NV_copy_image */
+
+#ifndef WGL_NV_delay_before_swap
+#define WGL_NV_delay_before_swap 1
+typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
+#endif
+#endif /* WGL_NV_delay_before_swap */
+
+#ifndef WGL_NV_float_buffer
+#define WGL_NV_float_buffer 1
+#define WGL_FLOAT_COMPONENTS_NV 0x20B0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
+#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
+#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
+#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
+#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
+#endif /* WGL_NV_float_buffer */
+
+#ifndef WGL_NV_gpu_affinity
+#define WGL_NV_gpu_affinity 1
+DECLARE_HANDLE(HGPUNV);
+struct _GPU_DEVICE {
+ DWORD cb;
+ CHAR DeviceName[32];
+ CHAR DeviceString[128];
+ DWORD Flags;
+ RECT rcVirtualScreen;
+};
+typedef struct _GPU_DEVICE *PGPU_DEVICE;
+#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
+#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
+typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
+typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
+typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
+typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
+typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
+BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
+HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
+BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
+BOOL WINAPI wglDeleteDCNV (HDC hdc);
+#endif
+#endif /* WGL_NV_gpu_affinity */
+
+#ifndef WGL_NV_multisample_coverage
+#define WGL_NV_multisample_coverage 1
+#define WGL_COVERAGE_SAMPLES_NV 0x2042
+#define WGL_COLOR_SAMPLES_NV 0x20B9
+#endif /* WGL_NV_multisample_coverage */
+
+#ifndef WGL_NV_present_video
+#define WGL_NV_present_video 1
+DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
+#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
+typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
+typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
+BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
+BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
+#endif
+#endif /* WGL_NV_present_video */
+
+#ifndef WGL_NV_render_depth_texture
+#define WGL_NV_render_depth_texture 1
+#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
+#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
+#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
+#define WGL_DEPTH_COMPONENT_NV 0x20A7
+#endif /* WGL_NV_render_depth_texture */
+
+#ifndef WGL_NV_render_texture_rectangle
+#define WGL_NV_render_texture_rectangle 1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
+#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
+#endif /* WGL_NV_render_texture_rectangle */
+
+#ifndef WGL_NV_swap_group
+#define WGL_NV_swap_group 1
+typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
+typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
+typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
+BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
+BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
+BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
+BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
+BOOL WINAPI wglResetFrameCountNV (HDC hDC);
+#endif
+#endif /* WGL_NV_swap_group */
+
+#ifndef WGL_NV_vertex_array_range
+#define WGL_NV_vertex_array_range 1
+typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
+#ifdef WGL_WGLEXT_PROTOTYPES
+void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+void WINAPI wglFreeMemoryNV (void *pointer);
+#endif
+#endif /* WGL_NV_vertex_array_range */
+
+#ifndef WGL_NV_video_capture
+#define WGL_NV_video_capture 1
+DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
+#define WGL_UNIQUE_ID_NV 0x20CE
+#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
+typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
+typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
+typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
+UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
+BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
+BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+#endif
+#endif /* WGL_NV_video_capture */
+
+#ifndef WGL_NV_video_output
+#define WGL_NV_video_output 1
+DECLARE_HANDLE(HPVIDEODEV);
+#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
+#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
+#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
+#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
+#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
+#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
+#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
+#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
+#define WGL_VIDEO_OUT_FRAME 0x20C8
+#define WGL_VIDEO_OUT_FIELD_1 0x20C9
+#define WGL_VIDEO_OUT_FIELD_2 0x20CA
+#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
+#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
+typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
+typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
+BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
+BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
+BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
+BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
+BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#endif
+#endif /* WGL_NV_video_output */
+
+#ifndef WGL_OML_sync_control
+#define WGL_OML_sync_control 1
+typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
+typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
+BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
+INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
+INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
+BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
+BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
+#endif
+#endif /* WGL_OML_sync_control */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gfx/angle/checkout/include/angle_gl.h b/gfx/angle/checkout/include/angle_gl.h
new file mode 100644
index 0000000000..d2ec0a3607
--- /dev/null
+++ b/gfx/angle/checkout/include/angle_gl.h
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// angle_gl.h:
+// Includes all necessary GL headers and definitions for ANGLE.
+//
+
+#ifndef ANGLEGL_H_
+#define ANGLEGL_H_
+
+#include "GLES/gl.h"
+#include "GLES/glext.h"
+#include "GLES2/gl2.h"
+#include "GLES2/gl2ext.h"
+#include "GLES3/gl3.h"
+#include "GLES3/gl31.h"
+#include "GLES3/gl32.h"
+
+#endif // ANGLEGL_H_
diff --git a/gfx/angle/checkout/include/export.h b/gfx/angle/checkout/include/export.h
new file mode 100644
index 0000000000..8ddffd9647
--- /dev/null
+++ b/gfx/angle/checkout/include/export.h
@@ -0,0 +1,32 @@
+//
+// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// export.h : Defines ANGLE_EXPORT, a macro for exporting functions from the DLL
+
+#ifndef LIBGLESV2_EXPORT_H_
+#define LIBGLESV2_EXPORT_H_
+
+#if !defined(ANGLE_EXPORT)
+# if defined(_WIN32)
+# if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
+ defined(LIBFEATURE_SUPPORT_IMPLEMENTATION)
+# define ANGLE_EXPORT __declspec(dllexport)
+# else
+# define ANGLE_EXPORT __declspec(dllimport)
+# endif
+# elif defined(__GNUC__)
+# if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION) || \
+ defined(LIBFEATURE_SUPPORT_IMPLEMENTATION)
+# define ANGLE_EXPORT __attribute__((visibility("default")))
+# else
+# define ANGLE_EXPORT
+# endif
+# else
+# define ANGLE_EXPORT
+# endif
+#endif // !defined(ANGLE_EXPORT)
+
+#endif // LIBGLESV2_EXPORT_H_
diff --git a/gfx/angle/checkout/include/platform/Feature.h b/gfx/angle/checkout/include/platform/Feature.h
new file mode 100644
index 0000000000..657e07be5f
--- /dev/null
+++ b/gfx/angle/checkout/include/platform/Feature.h
@@ -0,0 +1,171 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Feature.h: Definition of structs to hold feature/workaround information.
+//
+
+#ifndef ANGLE_PLATFORM_FEATURE_H_
+#define ANGLE_PLATFORM_FEATURE_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace angle
+{
+
+enum class FeatureCategory
+{
+ FrontendWorkarounds,
+ OpenGLWorkarounds,
+ D3DWorkarounds,
+ D3DCompilerWorkarounds,
+ VulkanWorkarounds,
+ VulkanFeatures,
+};
+
+constexpr char kFeatureCategoryFrontendWorkarounds[] = "Frontend workarounds";
+constexpr char kFeatureCategoryOpenGLWorkarounds[] = "OpenGL workarounds";
+constexpr char kFeatureCategoryD3DWorkarounds[] = "D3D workarounds";
+constexpr char kFeatureCategoryD3DCompilerWorkarounds[] = "D3D compiler workarounds";
+constexpr char kFeatureCategoryVulkanWorkarounds[] = "Vulkan workarounds";
+constexpr char kFeatureCategoryVulkanFeatures[] = "Vulkan features";
+constexpr char kFeatureCategoryUnknown[] = "Unknown";
+
+inline const char *FeatureCategoryToString(const FeatureCategory &fc)
+{
+ switch (fc)
+ {
+ case FeatureCategory::FrontendWorkarounds:
+ return kFeatureCategoryFrontendWorkarounds;
+ break;
+
+ case FeatureCategory::OpenGLWorkarounds:
+ return kFeatureCategoryOpenGLWorkarounds;
+ break;
+
+ case FeatureCategory::D3DWorkarounds:
+ return kFeatureCategoryD3DWorkarounds;
+ break;
+
+ case FeatureCategory::D3DCompilerWorkarounds:
+ return kFeatureCategoryD3DCompilerWorkarounds;
+ break;
+
+ case FeatureCategory::VulkanWorkarounds:
+ return kFeatureCategoryVulkanWorkarounds;
+ break;
+
+ case FeatureCategory::VulkanFeatures:
+ return kFeatureCategoryVulkanFeatures;
+ break;
+
+ default:
+ return kFeatureCategoryUnknown;
+ break;
+ }
+}
+
+constexpr char kFeatureStatusEnabled[] = "enabled";
+constexpr char kFeatureStatusDisabled[] = "disabled";
+
+inline const char *FeatureStatusToString(const bool &status)
+{
+ if (status)
+ {
+ return kFeatureStatusEnabled;
+ }
+ return kFeatureStatusDisabled;
+}
+
+struct Feature;
+
+using FeatureMap = std::map<std::string, Feature *>;
+using FeatureList = std::vector<const Feature *>;
+
+struct Feature
+{
+ Feature(const Feature &other);
+ Feature(const char *name,
+ const FeatureCategory &category,
+ const char *description,
+ FeatureMap *const mapPtr,
+ const char *bug);
+ ~Feature();
+
+ // The name of the workaround, lowercase, camel_case
+ const char *const name;
+
+ // The category that the workaround belongs to. Eg. "Vulkan workarounds"
+ const FeatureCategory category;
+
+ // A short description to be read by the user.
+ const char *const description;
+
+ // A link to the bug, if any
+ const char *const bug;
+
+ // Whether the workaround is enabled or not. Determined by heuristics like vendor ID and
+ // version, but may be overriden to any value.
+ bool enabled = false;
+};
+
+inline Feature::Feature(const Feature &other) = default;
+inline Feature::Feature(const char *name,
+ const FeatureCategory &category,
+ const char *description,
+ FeatureMap *const mapPtr,
+ const char *bug = "")
+ : name(name), category(category), description(description), bug(bug), enabled(false)
+{
+ if (mapPtr != nullptr)
+ {
+ (*mapPtr)[std::string(name)] = this;
+ }
+}
+
+inline Feature::~Feature() = default;
+
+struct FeatureSetBase
+{
+ public:
+ FeatureSetBase();
+ ~FeatureSetBase();
+
+ private:
+ // Non-copyable
+ FeatureSetBase(const FeatureSetBase &other) = delete;
+ FeatureSetBase &operator=(const FeatureSetBase &other) = delete;
+
+ protected:
+ FeatureMap members = FeatureMap();
+
+ public:
+ void overrideFeatures(const std::vector<std::string> &feature_names, const bool enabled)
+ {
+ for (const std::string &name : feature_names)
+ {
+ if (members.find(name) != members.end())
+ {
+ members[name]->enabled = enabled;
+ }
+ }
+ }
+
+ void populateFeatureList(FeatureList *features) const
+ {
+ for (FeatureMap::const_iterator it = members.begin(); it != members.end(); it++)
+ {
+ features->push_back(it->second);
+ }
+ }
+};
+
+inline FeatureSetBase::FeatureSetBase() = default;
+inline FeatureSetBase::~FeatureSetBase() = default;
+
+} // namespace angle
+
+#endif // ANGLE_PLATFORM_WORKAROUND_H_
diff --git a/gfx/angle/checkout/include/platform/FeaturesD3D.h b/gfx/angle/checkout/include/platform/FeaturesD3D.h
new file mode 100644
index 0000000000..0d231f2660
--- /dev/null
+++ b/gfx/angle/checkout/include/platform/FeaturesD3D.h
@@ -0,0 +1,238 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FeaturesD3D.h: Features and workarounds for D3D driver bugs and other issues.
+
+#ifndef ANGLE_PLATFORM_FEATURESD3D_H_
+#define ANGLE_PLATFORM_FEATURESD3D_H_
+
+#include "platform/Feature.h"
+
+namespace angle
+{
+
+// Workarounds attached to each shader. Do not need to expose information about these workarounds so
+// a simple bool struct suffices.
+struct CompilerWorkaroundsD3D
+{
+ bool skipOptimization = false;
+
+ bool useMaxOptimization = false;
+
+ // IEEE strictness needs to be enabled for NANs to work.
+ bool enableIEEEStrictness = false;
+};
+
+struct FeaturesD3D : FeatureSetBase
+{
+ FeaturesD3D();
+ ~FeaturesD3D();
+
+ // On some systems, having extra rendertargets than necessary slows down the shader.
+ // We can fix this by optimizing those out of the shader. At the same time, we can
+ // work around a bug on some nVidia drivers that they ignore "null" render targets
+ // in D3D11, by compacting the active color attachments list to omit null entries.
+ Feature mrtPerfWorkaround = {
+ "mrt_perf_workaround", FeatureCategory::D3DWorkarounds,
+ "Some NVIDIA D3D11 drivers have a bug where they ignore null render targets", &members};
+
+ Feature setDataFasterThanImageUpload = {"set_data_faster_than_image_upload",
+ FeatureCategory::D3DWorkarounds,
+ "Set data faster than image upload", &members};
+
+ Feature setDataFasterThanImageUploadOn128bitFormats = {
+ "set_data_faster_than_image_upload_on_128bit_formats", FeatureCategory::D3DWorkarounds,
+ "Set data faster than image upload on 128bit formats", &members};
+
+ // Some renderers can't disable mipmaps on a mipmapped texture (i.e. solely sample from level
+ // zero, and ignore the other levels). D3D11 Feature Level 10+ does this by setting MaxLOD to
+ // 0.0f in the Sampler state. D3D9 sets D3DSAMP_MIPFILTER to D3DTEXF_NONE. There is no
+ // equivalent to this in D3D11 Feature Level 9_3. This causes problems when (for example) an
+ // application creates a mipmapped texture2D, but sets GL_TEXTURE_MIN_FILTER to GL_NEAREST
+ // (i.e disables mipmaps). To work around this, D3D11 FL9_3 has to create two copies of the
+ // texture. The textures' level zeros are identical, but only one texture has mips.
+ Feature zeroMaxLodWorkaround = {
+ "zero_max_lod", FeatureCategory::D3DWorkarounds,
+ "D3D11 is missing an option to disable mipmaps on a mipmapped texture", &members};
+
+ // Some renderers do not support Geometry Shaders so the Geometry Shader-based PointSprite
+ // emulation will not work. To work around this, D3D11 FL9_3 has to use a different pointsprite
+ // emulation that is implemented using instanced quads.
+ Feature useInstancedPointSpriteEmulation = {
+ "use_instanced_point_sprite_emulation", FeatureCategory::D3DWorkarounds,
+ "Some D3D11 renderers do not support geometry shaders for pointsprite emulation", &members};
+
+ // A bug fixed in NVIDIA driver version 347.88 < x <= 368.81 triggers a TDR when using
+ // CopySubresourceRegion from a staging texture to a depth/stencil in D3D11. The workaround
+ // is to use UpdateSubresource to trigger an extra copy. We disable this workaround on newer
+ // NVIDIA driver versions because of a second driver bug present with the workaround enabled.
+ // (See: http://anglebug.com/1452)
+ Feature depthStencilBlitExtraCopy = {
+ "depth_stencil_blit_extra_copy", FeatureCategory::D3DWorkarounds,
+ "Bug in NVIDIA D3D11 Driver version <=347.88 and >368.81 triggers a TDR when using "
+ "CopySubresourceRegion from a staging texture to a depth/stencil",
+ &members, "http://anglebug.com/1452"};
+
+ // The HLSL optimizer has a bug with optimizing "pow" in certain integer-valued expressions.
+ // We can work around this by expanding the pow into a series of multiplies if we're running
+ // under the affected compiler.
+ Feature expandIntegerPowExpressions = {
+ "expand_integer_pow_expressions", FeatureCategory::D3DWorkarounds,
+ "The HLSL optimizer has a bug with optimizing 'pow' in certain integer-valued expressions",
+ &members};
+
+ // NVIDIA drivers sometimes write out-of-order results to StreamOut buffers when transform
+ // feedback is used to repeatedly write to the same buffer positions.
+ Feature flushAfterEndingTransformFeedback = {
+ "flush_after_ending_transform_feedback", FeatureCategory::D3DWorkarounds,
+ "NVIDIA drivers sometimes write out-of-order results to StreamOut buffers when transform "
+ "feedback is used to repeatedly write to the same buffer positions",
+ &members};
+
+ // Some drivers (NVIDIA) do not take into account the base level of the texture in the results
+ // of the HLSL GetDimensions builtin.
+ Feature getDimensionsIgnoresBaseLevel = {
+ "get_dimensions_ignores_base_level", FeatureCategory::D3DWorkarounds,
+ "Some NVIDIA drivers do not take into account the base level of the "
+ "texture in the results of the HLSL GetDimensions builtin",
+ &members};
+
+ // On some Intel drivers, HLSL's function texture.Load returns 0 when the parameter Location
+ // is negative, even if the sum of Offset and Location is in range. This may cause errors when
+ // translating GLSL's function texelFetchOffset into texture.Load, as it is valid for
+ // texelFetchOffset to use negative texture coordinates as its parameter P when the sum of P
+ // and Offset is in range. To work around this, we translate texelFetchOffset into texelFetch
+ // by adding Offset directly to Location before reading the texture.
+ Feature preAddTexelFetchOffsets = {
+ "pre_add_texel_fetch_offsets", FeatureCategory::D3DWorkarounds,
+ "On some Intel drivers, HLSL's function texture.Load returns 0 when the parameter Location "
+ "is negative, even if the sum of Offset and Location is in range",
+ &members};
+
+ // On some AMD drivers, 1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly.
+ // We can work around this bug by doing an internal blit to a temporary single-channel texture
+ // before we sample.
+ Feature emulateTinyStencilTextures = {
+ "emulate_tiny_stencil_textures", FeatureCategory::D3DWorkarounds,
+ "On some AMD drivers, 1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly",
+ &members};
+
+ // In Intel driver, the data with format DXGI_FORMAT_B5G6R5_UNORM will be parsed incorrectly.
+ // This workaroud will disable B5G6R5 support when it's Intel driver. By default, it will use
+ // R8G8B8A8 format. This bug is fixed in version 4539 on Intel drivers.
+ // On older AMD drivers, the data in DXGI_FORMAT_B5G6R5_UNORM becomes corrupted for unknown
+ // reasons.
+ Feature disableB5G6R5Support = {"disable_b5g6r5_support", FeatureCategory::D3DWorkarounds,
+ "On Intel and AMD drivers, textures with the format "
+ "DXGI_FORMAT_B5G6R5_UNORM have incorrect data",
+ &members};
+
+ // On some Intel drivers, evaluating unary minus operator on integer may get wrong answer in
+ // vertex shaders. To work around this bug, we translate -(int) into ~(int)+1.
+ // This driver bug is fixed in 20.19.15.4624.
+ Feature rewriteUnaryMinusOperator = {
+ "rewrite_unary_minus_operator", FeatureCategory::D3DWorkarounds,
+ "On some Intel drivers, evaluating unary minus operator on integer may "
+ "get wrong answer in vertex shaders",
+ &members};
+
+ // On some Intel drivers, using isnan() on highp float will get wrong answer. To work around
+ // this bug, we use an expression to emulate function isnan().
+ // Tracking bug: https://crbug.com/650547
+ // This driver bug is fixed in 21.20.16.4542.
+ Feature emulateIsnanFloat = {
+ "emulate_isnan_float", FeatureCategory::D3DWorkarounds,
+ "On some Intel drivers, using isnan() on highp float will get wrong answer", &members,
+ "https://crbug.com/650547"};
+
+ // On some Intel drivers, using clear() may not take effect. To work around this bug, we call
+ // clear() twice on these platforms.
+ // Tracking bug: https://crbug.com/655534
+ Feature callClearTwice = {"call_clear_twice", FeatureCategory::D3DWorkarounds,
+ "On some Intel drivers, using clear() may not take effect", &members,
+ "https://crbug.com/655534"};
+
+ // On Sandybridge, calling ClearView after using dual source blending causes the hardware to hang.
+ // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1633628
+ Feature emulateClearViewAfterDualSourceBlending = {"emulate_clear_view_after_dual_source_blending",
+ FeatureCategory::D3DWorkarounds,
+ "On Sandybridge, calling ClearView after using dual source blending causes "
+ "the hardware to hang", &members,
+ "https://bugzilla.mozilla.org/show_bug.cgi?id=1633628"};
+
+ // On some Intel drivers, copying from staging storage to constant buffer storage does not
+ // seem to work. Work around this by keeping system memory storage as a canonical reference
+ // for buffer data.
+ // D3D11-only workaround. See http://crbug.com/593024.
+ Feature useSystemMemoryForConstantBuffers = {
+ "use_system_memory_for_constant_buffers", FeatureCategory::D3DWorkarounds,
+ "On some Intel drivers, copying from staging storage to constant buffer "
+ "storage does not work",
+ &members, "https://crbug.com/593024"};
+
+ // This workaround is for the ANGLE_multiview extension. If enabled the viewport or render
+ // target slice will be selected in the geometry shader stage. The workaround flag is added to
+ // make it possible to select the code path in end2end and performance tests.
+ Feature selectViewInGeometryShader = {
+ "select_view_in_geometry_shader", FeatureCategory::D3DWorkarounds,
+ "The viewport or render target slice will be selected in the geometry shader stage for "
+ "the ANGLE_multiview extension",
+ &members};
+
+ // When rendering with no render target on D3D, two bugs lead to incorrect behavior on Intel
+ // drivers < 4815. The rendering samples always pass neglecting discard statements in pixel
+ // shader.
+ // 1. If rendertarget is not set, the pixel shader will be recompiled to drop 'SV_TARGET'.
+ // When using a pixel shader with no 'SV_TARGET' in a draw, the pixels are always generated even
+ // if they should be discard by 'discard' statements.
+ // 2. If ID3D11BlendState.RenderTarget[].RenderTargetWriteMask is 0 and rendertarget is not set,
+ // then rendering samples also pass neglecting discard statements in pixel shader.
+ // So we add a dummy texture as render target in such case. See http://anglebug.com/2152
+ Feature addDummyTextureNoRenderTarget = {
+ "add_dummy_texture_no_render_target", FeatureCategory::D3DWorkarounds,
+ "On D3D ntel drivers <4815 when rendering with no render target, two "
+ "bugs lead to incorrect behavior",
+ &members, "http://anglebug.com/2152"};
+
+ // Don't use D3D constant register zero when allocating space for uniforms in the vertex shader.
+ // This is targeted to work around a bug in NVIDIA D3D driver version 388.59 where in very
+ // specific cases the driver would not handle constant register zero correctly.
+ Feature skipVSConstantRegisterZero = {
+ "skip_vs_constant_register_zero", FeatureCategory::D3DWorkarounds,
+ "On NVIDIA D3D driver v388.59 in specific cases the driver doesn't "
+ "handle constant register zero correctly",
+ &members};
+
+ // Forces the value returned from an atomic operations to be always be resolved. This is
+ // targeted to workaround a bug in NVIDIA D3D driver where the return value from
+ // RWByteAddressBuffer.InterlockedAdd does not get resolved when used in the .yzw components of
+ // a RWByteAddressBuffer.Store operation. Only has an effect on HLSL translation.
+ // http://anglebug.com/3246
+ Feature forceAtomicValueResolution = {
+ "force_atomic_value_resolution", FeatureCategory::D3DWorkarounds,
+ "On an NVIDIA D3D driver, the return value from RWByteAddressBuffer.InterlockedAdd does "
+ "not resolve when used in the .yzw components of a RWByteAddressBuffer.Store operation",
+ &members, "http://anglebug.com/3246"};
+
+ // Match chromium's robust resource init behaviour by always prefering to upload texture data
+ // instead of clearing. Clear calls have been observed to cause texture corruption for some
+ // formats.
+ Feature allowClearForRobustResourceInit = {
+ "allow_clear_for_robust_resource_init", FeatureCategory::D3DWorkarounds,
+ "Some drivers corrupt texture data when clearing for robust resource initialization.",
+ &members, "http://crbug.com/941620"};
+
+ Feature allowES3OnFL10_0 = {
+ "allowES3OnFL10_0", FeatureCategory::D3DWorkarounds,
+ "Allow ES3 on 10.0 devices", &members};
+};
+
+inline FeaturesD3D::FeaturesD3D() = default;
+inline FeaturesD3D::~FeaturesD3D() = default;
+
+} // namespace angle
+
+#endif // ANGLE_PLATFORM_FEATURESD3D_H_
diff --git a/gfx/angle/checkout/include/platform/FeaturesGL.h b/gfx/angle/checkout/include/platform/FeaturesGL.h
new file mode 100644
index 0000000000..8c9ecf7a0f
--- /dev/null
+++ b/gfx/angle/checkout/include/platform/FeaturesGL.h
@@ -0,0 +1,341 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FeaturesGL.h: Features and workarounds for GL driver bugs and other issues.
+
+#ifndef ANGLE_PLATFORM_FEATURESGL_H_
+#define ANGLE_PLATFORM_FEATURESGL_H_
+
+#include "platform/Feature.h"
+
+namespace angle
+{
+
+struct FeaturesGL : FeatureSetBase
+{
+ FeaturesGL();
+ ~FeaturesGL();
+
+ // When writing a float to a normalized integer framebuffer, desktop OpenGL is allowed to write
+ // one of the two closest normalized integer representations (although round to nearest is
+ // preferred) (see section 2.3.5.2 of the GL 4.5 core specification). OpenGL ES requires that
+ // round-to-nearest is used (see "Conversion from Floating-Point to Framebuffer Fixed-Point" in
+ // section 2.1.2 of the OpenGL ES 2.0.25 spec). This issue only shows up on Intel and AMD
+ // drivers on framebuffer formats that have 1-bit alpha, work around this by using higher
+ // precision formats instead.
+ Feature avoid1BitAlphaTextureFormats = {
+ "avoid_1_bit_alpha_texture_formats", FeatureCategory::OpenGLWorkarounds,
+ "Issue on Intel and AMD drivers with 1-bit alpha framebuffer formats", &members};
+
+ // On some older Intel drivers, GL_RGBA4 is not color renderable, glCheckFramebufferStatus
+ // returns GL_FRAMEBUFFER_UNSUPPORTED. Work around this by using a known color-renderable
+ // format.
+ Feature rgba4IsNotSupportedForColorRendering = {
+ "rgba4_is_not_supported_for_color_rendering", FeatureCategory::OpenGLWorkarounds,
+ "Issue on older Intel drivers, GL_RGBA4 is not color renderable", &members};
+
+ // When clearing a framebuffer on Intel or AMD drivers, when GL_FRAMEBUFFER_SRGB is enabled, the
+ // driver clears to the linearized clear color despite the framebuffer not supporting SRGB
+ // blending. It only seems to do this when the framebuffer has only linear attachments, mixed
+ // attachments appear to get the correct clear color.
+ Feature doesSRGBClearsOnLinearFramebufferAttachments = {
+ "does_srgb_clears_on_linear_framebuffer_attachments", FeatureCategory::OpenGLWorkarounds,
+ "Issue clearing framebuffers with linear attachments on Intel or AMD "
+ "drivers when GL_FRAMEBUFFER_SRGB is enabled",
+ &members};
+
+ // On Mac some GLSL constructs involving do-while loops cause GPU hangs, such as the following:
+ // int i = 1;
+ // do {
+ // i --;
+ // continue;
+ // } while (i > 0)
+ // Work around this by rewriting the do-while to use another GLSL construct (block + while)
+ Feature doWhileGLSLCausesGPUHang = {
+ "do_while_glsl_causes_gpu_hang", FeatureCategory::OpenGLWorkarounds,
+ "On Mac, some GLSL constructs involving do-while loops cause GPU hangs", &members};
+
+ // Calling glFinish doesn't cause all queries to report that the result is available on some
+ // (NVIDIA) drivers. It was found that enabling GL_DEBUG_OUTPUT_SYNCHRONOUS before the finish
+ // causes it to fully finish.
+ Feature finishDoesNotCauseQueriesToBeAvailable = {
+ "finish_does_not_cause_queries_to_be_available", FeatureCategory::OpenGLWorkarounds,
+ "On some NVIDIA drivers, glFinish doesn't cause all queries to report available result",
+ &members};
+
+ // Always call useProgram after a successful link to avoid a driver bug.
+ // This workaround is meant to reproduce the use_current_program_after_successful_link
+ // workaround in Chromium (http://crbug.com/110263). It has been shown that this workaround is
+ // not necessary for MacOSX 10.9 and higher (http://crrev.com/39eb535b).
+ Feature alwaysCallUseProgramAfterLink = {
+ "always_call_use_program_after_link", FeatureCategory::OpenGLWorkarounds,
+ "Always call useProgram after a successful link to avoid a driver bug", &members};
+
+ // In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row.
+ Feature unpackOverlappingRowsSeparatelyUnpackBuffer = {
+ "unpack_overlapping_rows_separately_unpack_buffer", FeatureCategory::OpenGLWorkarounds,
+ "In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row",
+ &members};
+
+ // In the case of packing to a pixel pack buffer, pack overlapping rows row by row.
+ Feature packOverlappingRowsSeparatelyPackBuffer = {
+ "pack_overlapping_rows_separately_pack_buffer", FeatureCategory::OpenGLWorkarounds,
+ "In the case of packing to a pixel pack buffer, pack overlapping rows row by row",
+ &members};
+
+ // During initialization, assign the current vertex attributes to the spec-mandated defaults.
+ Feature initializeCurrentVertexAttributes = {
+ "initialize_current_vertex_attributes", FeatureCategory::OpenGLWorkarounds,
+ "During initialization, assign the current vertex attributes to the spec-mandated defaults",
+ &members};
+
+ // abs(i) where i is an integer returns unexpected result on Intel Mac.
+ // Emulate abs(i) with i * sign(i).
+ Feature emulateAbsIntFunction = {
+ "emulate_abs_int_function", FeatureCategory::OpenGLWorkarounds,
+ "On Intel Mac, abs(i) where i is an integer returns unexpected result", &members};
+
+ // On Intel Mac, calculation of loop conditions in for and while loop has bug.
+ // Add "&& true" to the end of the condition expression to work around the bug.
+ Feature addAndTrueToLoopCondition = {
+ "add_and_true_to_loop_condition", FeatureCategory::OpenGLWorkarounds,
+ "On Intel Mac, calculation of loop conditions in for and while loop has bug", &members};
+
+ // When uploading textures from an unpack buffer, some drivers count an extra row padding when
+ // checking if the pixel unpack buffer is big enough. Tracking bug: http://anglebug.com/1512
+ // For example considering the pixel buffer below where in memory, each row data (D) of the
+ // texture is followed by some unused data (the dots):
+ // +-------+--+
+ // |DDDDDDD|..|
+ // |DDDDDDD|..|
+ // |DDDDDDD|..|
+ // |DDDDDDD|..|
+ // +-------A--B
+ // The last pixel read will be A, but the driver will think it is B, causing it to generate an
+ // error when the pixel buffer is just big enough.
+ Feature unpackLastRowSeparatelyForPaddingInclusion = {
+ "unpack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds,
+ "When uploading textures from an unpack buffer, some drivers count an extra row padding",
+ &members};
+
+ // Equivalent workaround when uploading data from a pixel pack buffer.
+ Feature packLastRowSeparatelyForPaddingInclusion = {
+ "pack_last_row_separately_for_padding_inclusion", FeatureCategory::OpenGLWorkarounds,
+ "When uploading textures from an pack buffer, some drivers count an extra row padding",
+ &members};
+
+ // On some Intel drivers, using isnan() on highp float will get wrong answer. To work around
+ // this bug, we use an expression to emulate function isnan().
+ // Tracking bug: http://crbug.com/650547
+ Feature emulateIsnanFloat = {
+ "emulate_isnan_float", FeatureCategory::OpenGLWorkarounds,
+ "On some Intel drivers, using isnan() on highp float will get wrong answer", &members};
+
+ // On Mac with OpenGL version 4.1, unused std140 or shared uniform blocks will be
+ // treated as inactive which is not consistent with WebGL2.0 spec. Reference all members in a
+ // unused std140 or shared uniform block at the beginning of main to work around it.
+ // Also used on Linux AMD.
+ Feature useUnusedBlocksWithStandardOrSharedLayout = {
+ "use_unused_blocks_with_standard_or_shared_layout", FeatureCategory::OpenGLWorkarounds,
+ "On Mac with OpenGL version 4.1 and Linux AMD, unused std140 or shared uniform blocks "
+ "will be treated as inactive",
+ &members};
+
+ // This flag is used to fix spec difference between GLSL 4.1 or lower and ESSL3.
+ Feature removeInvariantAndCentroidForESSL3 = {
+ "remove_invarient_and_centroid_for_essl3", FeatureCategory::OpenGLWorkarounds,
+ "Fix spec difference between GLSL 4.1 or lower and ESSL3", &members};
+
+ // On Intel Mac OSX 10.11 driver, using "-float" will get wrong answer. Use "0.0 - float" to
+ // replace "-float".
+ // Tracking bug: http://crbug.com/308366
+ Feature rewriteFloatUnaryMinusOperator = {
+ "rewrite_float_unary_minus_operator", FeatureCategory::OpenGLWorkarounds,
+ "On Intel Mac OSX 10.11 driver, using '-<float>' will get wrong answer", &members,
+ "http://crbug.com/308366"};
+
+ // On NVIDIA drivers, atan(y, x) may return a wrong answer.
+ // Tracking bug: http://crbug.com/672380
+ Feature emulateAtan2Float = {"emulate_atan_2_float", FeatureCategory::OpenGLWorkarounds,
+ "On NVIDIA drivers, atan(y, x) may return a wrong answer",
+ &members, "http://crbug.com/672380"};
+
+ // Some drivers seem to forget about UBO bindings when using program binaries. Work around
+ // this by re-applying the bindings after the program binary is loaded or saved.
+ // This only seems to affect AMD OpenGL drivers, and some Android devices.
+ // http://anglebug.com/1637
+ Feature reapplyUBOBindingsAfterUsingBinaryProgram = {
+ "reapply_ubo_bindings_after_using_binary_program", FeatureCategory::OpenGLWorkarounds,
+ "Some AMD OpenGL drivers and Android devices forget about UBO bindings "
+ "when using program binaries",
+ &members, "http://anglebug.com/1637"};
+
+ // Some OpenGL drivers return 0 when we query MAX_VERTEX_ATTRIB_STRIDE in an OpenGL 4.4 or
+ // higher context.
+ // This only seems to affect AMD OpenGL drivers.
+ // Tracking bug: http://anglebug.com/1936
+ Feature emulateMaxVertexAttribStride = {
+ "emulate_max_vertex_attrib_stride", FeatureCategory::OpenGLWorkarounds,
+ "Some AMD OpenGL >= 4.4 drivers return 0 when MAX_VERTEX_ATTRIB_STRIED queried", &members,
+ "http://anglebug.com/1936"};
+
+ // Initializing uninitialized locals caused odd behavior on Mac in a few WebGL 2 tests.
+ // Tracking bug: http://anglebug/2041
+ Feature dontInitializeUninitializedLocals = {
+ "dont_initialize_uninitialized_locals", FeatureCategory::OpenGLWorkarounds,
+ "On Mac initializing uninitialized locals caused odd behavior in a few WebGL 2 tests",
+ &members, "http://anglebug.com/2041"};
+
+ // On some NVIDIA drivers the point size range reported from the API is inconsistent with the
+ // actual behavior. Clamp the point size to the value from the API to fix this.
+ Feature clampPointSize = {
+ "clamp_point_size", FeatureCategory::OpenGLWorkarounds,
+ "On some NVIDIA drivers the point size range reported from the API is "
+ "inconsistent with the actual behavior",
+ &members};
+
+ // On some NVIDIA drivers certain types of GLSL arithmetic ops mixing vectors and scalars may be
+ // executed incorrectly. Change them in the shader translator. Tracking bug:
+ // http://crbug.com/772651
+ Feature rewriteVectorScalarArithmetic = {
+ "rewrite_vector_scalar_arithmetic", FeatureCategory::OpenGLWorkarounds,
+ "On some NVIDIA drivers certain types of GLSL arithmetic ops mixing "
+ "vectors and scalars may be executed incorrectly",
+ &members, "http://crbug.com/772651"};
+
+ // On some Android devices for loops used to initialize variables hit native GLSL compiler bugs.
+ Feature dontUseLoopsToInitializeVariables = {
+ "dont_use_loops_to_initialize_variables", FeatureCategory::OpenGLWorkarounds,
+ "On some Android devices for loops used to initialize variables hit "
+ "native GLSL compiler bugs",
+ &members};
+
+ // On some NVIDIA drivers gl_FragDepth is not clamped correctly when rendering to a floating
+ // point depth buffer. Clamp it in the translated shader to fix this.
+ Feature clampFragDepth = {"clamp_frag_depth", FeatureCategory::OpenGLWorkarounds,
+ "On some NVIDIA drivers gl_FragDepth is not clamped correctly when "
+ "rendering to a floating point depth buffer",
+ &members};
+
+ // On some NVIDIA drivers before version 397.31 repeated assignment to swizzled values inside a
+ // GLSL user-defined function have incorrect results. Rewrite this type of statements to fix
+ // this.
+ Feature rewriteRepeatedAssignToSwizzled = {
+ "rewrite_repeated_assign_to_swizzled", FeatureCategory::OpenGLWorkarounds,
+ "On some NVIDIA drivers < v397.31, repeated assignment to swizzled "
+ "values inside a GLSL user-defined function have incorrect results",
+ &members};
+ // On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests.
+ // It might be possible to work around the Intel bug by rewriting *FragData to *FragColor
+ // instead of disabling the functionality entirely. The AMD bug looked like incorrect blending,
+ // not sure if a workaround is feasible. http://anglebug.com/1085
+ Feature disableBlendFuncExtended = {
+ "disable_blend_func_extended", FeatureCategory::OpenGLWorkarounds,
+ "On some AMD and Intel GL drivers ARB_blend_func_extended does not pass the tests",
+ &members, "http://anglebug.com/1085"};
+
+ // Qualcomm drivers returns raw sRGB values instead of linearized values when calling
+ // glReadPixels on unsized sRGB texture formats. http://crbug.com/550292 and
+ // http://crbug.com/565179
+ Feature unsizedsRGBReadPixelsDoesntTransform = {
+ "unsized_srgb_read_pixels_doesnt_transform", FeatureCategory::OpenGLWorkarounds,
+ "Qualcomm drivers returns raw sRGB values instead of linearized values "
+ "when calling glReadPixels on unsized sRGB texture formats",
+ &members, "http://crbug.com/565179"};
+
+ // Older Qualcomm drivers generate errors when querying the number of bits in timer queries, ex:
+ // GetQueryivEXT(GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS). http://anglebug.com/3027
+ Feature queryCounterBitsGeneratesErrors = {
+ "query_counter_bits_generates_errors", FeatureCategory::OpenGLWorkarounds,
+ "Older Qualcomm drivers generate errors when querying the number of bits in timer queries",
+ &members, "http://anglebug.com/3027"};
+
+ // Re-linking a program in parallel is buggy on some Intel Windows OpenGL drivers and Android
+ // platforms.
+ // http://anglebug.com/3045
+ Feature dontRelinkProgramsInParallel = {
+ "dont_relink_programs_in_parallel", FeatureCategory::OpenGLWorkarounds,
+ "On some Intel Windows OpenGL drivers and Android, relinking a program "
+ "in parallel is buggy",
+ &members, "http://anglebug.com/3045"};
+
+ // Some tests have been seen to fail using worker contexts, this switch allows worker contexts
+ // to be disabled for some platforms. http://crbug.com/849576
+ Feature disableWorkerContexts = {"disable_worker_contexts", FeatureCategory::OpenGLWorkarounds,
+ "Some tests have been seen to fail using worker contexts",
+ &members, "http://crbug.com/849576"};
+
+ // Most Android devices fail to allocate a texture that is larger than 4096. Limit the caps
+ // instead of generating GL_OUT_OF_MEMORY errors. Also causes system to hang on some older
+ // intel mesa drivers on Linux.
+ Feature limitMaxTextureSizeTo4096 = {"max_texture_size_limit_4096",
+ FeatureCategory::OpenGLWorkarounds,
+ "Limit max texture size to 4096 to avoid frequent "
+ "out-of-memory errors on Android or Intel Linux",
+ &members, "http://crbug.com/927470"};
+
+ // Prevent excessive MSAA allocations on Android devices, various rendering bugs have been
+ // observed and they tend to be high DPI anyways. http://crbug.com/797243
+ Feature limitMaxMSAASamplesTo4 = {
+ "max_msaa_sample_count_4", FeatureCategory::OpenGLWorkarounds,
+ "Various rendering bugs have been observed when using higher MSAA counts on Android",
+ &members, "http://crbug.com/797243"};
+
+ // Prefer to do the robust resource init clear using a glClear. Calls to TexSubImage2D on large
+ // textures can take hundreds of milliseconds because of slow uploads on macOS. Do this only on
+ // macOS because clears are buggy on other drivers.
+ // https://crbug.com/848952 (slow uploads on macOS)
+ // https://crbug.com/883276 (buggy clears on Android)
+ Feature allowClearForRobustResourceInit = {
+ "allow_clear_for_robust_resource_init", FeatureCategory::OpenGLWorkarounds,
+ "Using glClear for robust resource initialization is buggy on some drivers and leads to "
+ "texture corruption. Default to data uploads except on MacOS where it is very slow.",
+ &members, "http://crbug.com/883276"};
+
+ // Some drivers automatically handle out-of-bounds uniform array access but others need manual
+ // clamping to satisfy the WebGL requirements.
+ Feature clampArrayAccess = {"clamp_array_access", FeatureCategory::OpenGLWorkarounds,
+ "Clamp uniform array access to avoid reading invalid memory.",
+ &members, "http://anglebug.com/2978"};
+
+ // Reset glTexImage2D base level to workaround pixel comparison failure above Mac OS 10.12.4 on
+ // Intel Mac.
+ Feature resetTexImage2DBaseLevel = {"reset_teximage2d_base_level",
+ FeatureCategory::OpenGLWorkarounds,
+ "Reset texture base level before calling glTexImage2D to "
+ "work around pixel comparison failure.",
+ &members, "https://crbug.com/705865"};
+
+ // glClearColor does not always work on Intel 6xxx Mac drivers when the clear color made up of
+ // all zeros and ones.
+ Feature clearToZeroOrOneBroken = {
+ "clear_to_zero_or_one_broken", FeatureCategory::OpenGLWorkarounds,
+ "Clears when the clear color is all zeros or ones do not work.", &members,
+ "https://crbug.com/710443"};
+
+ // Some older Linux Intel mesa drivers will hang the system when allocating large textures. Fix
+ // this by capping the max texture size.
+ Feature limitMax3dArrayTextureSizeTo1024 = {
+ "max_3d_array_texture_size_1024", FeatureCategory::OpenGLWorkarounds,
+ "Limit max 3d texture size and max array texture layers to 1024 to avoid system hang on "
+ "older Intel Linux",
+ &members, "http://crbug.com/927470"};
+
+ // BlitFramebuffer has issues on some platforms with large source/dest texture sizes. This
+ // workaround adjusts the destination rectangle source and dest rectangle to fit within maximum
+ // twice the size of the framebuffer.
+ Feature adjustSrcDstRegionBlitFramebuffer = {
+ "adjust_src_dst_region_for_blitframebuffer", FeatureCategory::OpenGLWorkarounds,
+ "Many platforms have issues with blitFramebuffer when the parameters are large.", &members,
+ "http://crbug.com/830046"};
+};
+
+inline FeaturesGL::FeaturesGL() = default;
+inline FeaturesGL::~FeaturesGL() = default;
+
+} // namespace angle
+
+#endif // ANGLE_PLATFORM_FEATURESGL_H_
diff --git a/gfx/angle/checkout/include/platform/FeaturesVk.h b/gfx/angle/checkout/include/platform/FeaturesVk.h
new file mode 100644
index 0000000000..a8df06e3e3
--- /dev/null
+++ b/gfx/angle/checkout/include/platform/FeaturesVk.h
@@ -0,0 +1,194 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FeaturesVk.h: Optional features for the Vulkan renderer.
+//
+
+#ifndef ANGLE_PLATFORM_FEATURESVK_H_
+#define ANGLE_PLATFORM_FEATURESVK_H_
+
+#include "platform/Feature.h"
+
+namespace angle
+{
+
+struct FeaturesVk : FeatureSetBase
+{
+ FeaturesVk();
+ ~FeaturesVk();
+
+ // Line segment rasterization must follow OpenGL rules. This means using an algorithm similar
+ // to Bresenham's. Vulkan uses a different algorithm. This feature enables the use of pixel
+ // shader patching to implement OpenGL basic line rasterization rules. This feature will
+ // normally always be enabled. Exposing it as an option enables performance testing.
+ Feature basicGLLineRasterization = {
+ "basic_gl_line_rasterization", FeatureCategory::VulkanFeatures,
+ "Enable the use of pixel shader patching to implement OpenGL basic line "
+ "rasterization rules",
+ &members};
+
+ // Flips the viewport to render upside-down. This has the effect to render the same way as
+ // OpenGL. If this feature gets enabled, we enable the KHR_MAINTENANCE_1 extension to allow
+ // negative viewports. We inverse rendering to the backbuffer by reversing the height of the
+ // viewport and increasing Y by the height. So if the viewport was (0,0,width,height), it
+ // becomes (0, height, width, -height). Unfortunately, when we start doing this, we also need
+ // to adjust a lot of places since the rendering now happens upside-down. Affected places so
+ // far:
+ // -readPixels
+ // -copyTexImage
+ // -framebuffer blit
+ // -generating mipmaps
+ // -Point sprites tests
+ // -texStorage
+ Feature flipViewportY = {"flip_viewport_y", FeatureCategory::VulkanFeatures,
+ "Flips the viewport to render upside-down", &members};
+
+ // Add an extra copy region when using vkCmdCopyBuffer as the Windows Intel driver seems
+ // to have a bug where the last region is ignored.
+ Feature extraCopyBufferRegion = {
+ "extra_copy_buffer_region", FeatureCategory::VulkanWorkarounds,
+ "Windows Intel driver seems to have a bug where the last copy region in "
+ "vkCmdCopyBuffer is ignored",
+ &members};
+
+ // This flag is added for the sole purpose of end2end tests, to test the correctness
+ // of various algorithms when a fallback format is used, such as using a packed format to
+ // emulate a depth- or stencil-only format.
+ Feature forceFallbackFormat = {"force_fallback_format", FeatureCategory::VulkanWorkarounds,
+ "Force a fallback format for angle_end2end_tests", &members};
+
+ // On some NVIDIA drivers the point size range reported from the API is inconsistent with the
+ // actual behavior. Clamp the point size to the value from the API to fix this.
+ // Tracked in http://anglebug.com/2970.
+ Feature clampPointSize = {
+ "clamp_point_size", FeatureCategory::VulkanWorkarounds,
+ "On some NVIDIA drivers, the point size range reported from the API is "
+ "inconsistent with the actual behavior",
+ &members, "http://anglebug.com/2970"};
+
+ // On some android devices, the memory barrier between the compute shader that converts vertex
+ // attributes and the vertex shader that reads from it is ineffective. Only known workaround is
+ // to perform a flush after the conversion. http://anglebug.com/3016
+ Feature flushAfterVertexConversion = {
+ "flush_after_vertex_conversion", FeatureCategory::VulkanWorkarounds,
+ "On some android devices, the memory barrier between the compute shader that converts "
+ "vertex attributes and the vertex shader that reads from it is ineffective",
+ &members, "http://anglebug.com/3016"};
+
+ // Whether the VkDevice supports the VK_KHR_incremental_present extension, on which the
+ // EGL_KHR_swap_buffers_with_damage extension can be layered.
+ Feature supportsIncrementalPresent = {
+ "supports_incremental_present", FeatureCategory::VulkanFeatures,
+ "VkDevice supports the VK_KHR_incremental_present extension", &members};
+
+ // Whether texture copies on cube map targets should be done on GPU. This is a workaround for
+ // Intel drivers on windows that have an issue with creating single-layer views on cube map
+ // textures.
+ Feature forceCpuPathForCubeMapCopy = {
+ "force_cpu_path_for_cube_map_copy", FeatureCategory::VulkanWorkarounds,
+ "Some Intel Windows drivers have an issue with creating single-layer "
+ "views on cube map textures",
+ &members};
+
+ // Whether the VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer
+ // extension, on which the EGL_ANDROID_image_native_buffer extension can be layered.
+ Feature supportsAndroidHardwareBuffer = {
+ "supports_android_hardware_buffer", FeatureCategory::VulkanFeatures,
+ "VkDevice supports the VK_ANDROID_external_memory_android_hardware_buffer extension",
+ &members};
+
+ // Whether the VkDevice supports the VK_KHR_external_memory_fd extension, on which the
+ // GL_EXT_memory_object_fd extension can be layered.
+ Feature supportsExternalMemoryFd = {
+ "supports_external_memory_fd", FeatureCategory::VulkanFeatures,
+ "VkDevice supports the VK_KHR_external_memory_fd extension", &members};
+
+ // Whether the VkDevice supports the VK_KHR_external_semaphore_fd extension, on which the
+ // GL_EXT_semaphore_fd extension can be layered.
+ Feature supportsExternalSemaphoreFd = {
+ "supports_external_semaphore_fd", FeatureCategory::VulkanFeatures,
+ "VkDevice supports the VK_KHR_external_semaphore_fd extension", &members};
+
+ // Whether the VkDevice supports the VK_EXT_shader_stencil_export extension, which is used to
+ // perform multisampled resolve of stencil buffer. A multi-step workaround is used instead if
+ // this extension is not available.
+ Feature supportsShaderStencilExport = {
+ "supports_shader_stencil_export", FeatureCategory::VulkanFeatures,
+ "VkDevice supports the VK_EXT_shader_stencil_export extension", &members};
+
+ // Where VK_EXT_transform_feedback is not support, an emulation path is used.
+ // http://anglebug.com/3205
+ Feature emulateTransformFeedback = {
+ "emulate_transform_feedback", FeatureCategory::VulkanFeatures,
+ "Emulate transform feedback as the VK_EXT_transform_feedback is not present.", &members,
+ "http://anglebug.com/3205"};
+
+ // VK_PRESENT_MODE_FIFO_KHR causes random timeouts on Linux Intel. http://anglebug.com/3153
+ Feature disableFifoPresentMode = {
+ "disable_fifo_present_mode", FeatureCategory::VulkanWorkarounds,
+ "On Linux Intel, VK_PRESENT_MODE_FIFO_KHR causes random timeouts", &members,
+ "http://anglebug.com/3153"};
+
+ // On Qualcomm, a bug is preventing us from using loadOp=Clear with inline commands in the
+ // render pass. http://anglebug.com/2361
+ Feature restartRenderPassAfterLoadOpClear = {
+ "restart_render_pass_after_load_op_clear", FeatureCategory::VulkanWorkarounds,
+ "On Qualcomm, a bug is preventing us from using loadOp=Clear with inline "
+ "commands in the render pass",
+ &members, "http://anglebug.com/2361"};
+
+ // On Qualcomm, gaps in bound descriptor set indices causes the post-gap sets to misbehave.
+ // For example, binding only descriptor set 3 results in zero being read from a uniform buffer
+ // object within that set. This flag results in empty descriptor sets being bound for any
+ // unused descriptor set to work around this issue. http://anglebug.com/2727
+ Feature bindEmptyForUnusedDescriptorSets = {
+ "bind_empty_for_unused_descriptor_sets", FeatureCategory::VulkanWorkarounds,
+ "On Qualcomm, gaps in bound descriptor set indices causes the post-gap sets to misbehave",
+ &members, "http://anglebug.com/2727"};
+
+ // When the scissor is (0,0,0,0) on Windows Intel, the driver acts as if the scissor was
+ // disabled. Work-around this by setting the scissor to just outside of the render area
+ // (e.g. (renderArea.x, renderArea.y, 1, 1)). http://anglebug.com/3407
+ Feature forceNonZeroScissor = {
+ "force_non_zero_scissor", FeatureCategory::VulkanWorkarounds,
+ "On Windows Intel, when the scissor is (0,0,0,0), the driver acts as if the "
+ "scissor was disabled",
+ &members, "http://anglebug.com/3407"};
+
+ // OES_depth_texture is a commonly expected feature on Android. However it
+ // requires that D16_UNORM support texture filtering
+ // (e.g. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT) and some devices
+ // do not. Work-around this by setting saying D16_UNORM supports filtering
+ // anyway.
+ Feature forceD16TexFilter = {"force_D16_texture_filter", FeatureCategory::VulkanWorkarounds,
+ "On some Android devices, VK_FORMAT_D16_UNORM does not support "
+ "VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT, "
+ "which prevents OES_depth_texture from being supported.",
+ &members, "http://anglebug.com/3452"};
+
+ // On some android devices, vkCmdBlitImage with flipped coordinates blits incorrectly. This
+ // workaround makes sure this path is avoided. http://anglebug.com/3498
+ Feature disableFlippingBlitWithCommand = {
+ "disable_flipping_blit_with_command", FeatureCategory::VulkanWorkarounds,
+ "On some android devices, vkCmdBlitImage with flipped coordinates blits incorrectly.",
+ &members, "http://anglebug.com/3498"};
+
+ // On platform with Intel or AMD GPU, a window resizing would not trigger the vulkan driver to
+ // return VK_ERROR_OUT_OF_DATE on swapchain present. Work-around by query current window extent
+ // every frame to detect a window resizing.
+ // http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625
+ Feature perFrameWindowSizeQuery = {
+ "per_frame_window_size_query", FeatureCategory::VulkanWorkarounds,
+ "On platform with Intel or AMD gpu, vulkan swapchain is not returning VK_ERROR_OUT_OF_DATE"
+ "when window resizing",
+ &members, "http://anglebug.com/3623, http://anglebug.com/3624, http://anglebug.com/3625"};
+};
+
+inline FeaturesVk::FeaturesVk() = default;
+inline FeaturesVk::~FeaturesVk() = default;
+
+} // namespace angle
+
+#endif // ANGLE_PLATFORM_FEATURESVK_H_
diff --git a/gfx/angle/checkout/include/platform/FrontendFeatures.h b/gfx/angle/checkout/include/platform/FrontendFeatures.h
new file mode 100644
index 0000000000..2c0ad33816
--- /dev/null
+++ b/gfx/angle/checkout/include/platform/FrontendFeatures.h
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FrontendFeatures.h: Features/workarounds for driver bugs and other behaviors seen
+// on all platforms.
+
+#ifndef ANGLE_PLATFORM_FRONTENDFEATURES_H_
+#define ANGLE_PLATFORM_FRONTENDFEATURES_H_
+
+#include "platform/Feature.h"
+
+namespace angle
+{
+
+struct FrontendFeatures : angle::FeatureSetBase
+{
+ FrontendFeatures();
+ ~FrontendFeatures();
+
+ // Force the context to be lost (via KHR_robustness) if a GL_OUT_OF_MEMORY error occurs. The
+ // driver may be in an inconsistent state if this happens, and some users of ANGLE rely on this
+ // notification to prevent further execution.
+ angle::Feature loseContextOnOutOfMemory = {
+ "lose_context_on_out_of_memory", angle::FeatureCategory::FrontendWorkarounds,
+ "Some users rely on a lost context notification if a GL_OUT_OF_MEMORY "
+ "error occurs",
+ &members};
+
+ // Program binaries don't contain transform feedback varyings on Qualcomm GPUs.
+ // Work around this by disabling the program cache for programs with transform feedback.
+ angle::Feature disableProgramCachingForTransformFeedback = {
+ "disable_program_caching_for_transform_feedback",
+ angle::FeatureCategory::FrontendWorkarounds,
+ "On Qualcomm GPUs, program binaries don't contain transform feedback varyings", &members};
+
+ // On Windows Intel OpenGL drivers TexImage sometimes seems to interact with the Framebuffer.
+ // Flaky crashes can occur unless we sync the Framebuffer bindings. The workaround is to add
+ // Framebuffer binding dirty bits to TexImage updates. See http://anglebug.com/2906
+ angle::Feature syncFramebufferBindingsOnTexImage = {
+ "sync_framebuffer_bindings_on_tex_image", angle::FeatureCategory::FrontendWorkarounds,
+ "On Windows Intel OpenGL drivers TexImage sometimes seems to interact "
+ "with the Framebuffer",
+ &members};
+
+ angle::Feature scalarizeVecAndMatConstructorArgs = {
+ "scalarize_vec_and_mat_constructor_args", angle::FeatureCategory::FrontendWorkarounds,
+ "Always rewrite vec/mat constructors to be consistent", &members,
+ "http://crbug.com/398694"};
+};
+
+inline FrontendFeatures::FrontendFeatures() = default;
+inline FrontendFeatures::~FrontendFeatures() = default;
+
+} // namespace angle
+
+#endif // ANGLE_PLATFORM_FRONTENDFEATURES_H_
diff --git a/gfx/angle/checkout/include/platform/Platform.h b/gfx/angle/checkout/include/platform/Platform.h
new file mode 100644
index 0000000000..b8c5e9d221
--- /dev/null
+++ b/gfx/angle/checkout/include/platform/Platform.h
@@ -0,0 +1,324 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Platform.h: The public interface ANGLE exposes to the API layer, for
+// doing platform-specific tasks like gathering data, or for tracing.
+
+#ifndef ANGLE_PLATFORM_H
+#define ANGLE_PLATFORM_H
+
+#include <stdint.h>
+#include <array>
+
+#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x3482
+
+#if defined(_WIN32)
+# if !defined(LIBANGLE_IMPLEMENTATION)
+# define ANGLE_PLATFORM_EXPORT __declspec(dllimport)
+# else
+# define ANGLE_PLATFORM_EXPORT __declspec(dllexport)
+# endif
+#elif defined(__GNUC__) || defined(__clang__)
+// (miko): This visibility setting conflicts with the Firefox build system.
+// # define ANGLE_PLATFORM_EXPORT __attribute__((visibility("default")))
+#endif
+#if !defined(ANGLE_PLATFORM_EXPORT)
+# define ANGLE_PLATFORM_EXPORT
+#endif
+
+#if defined(_WIN32)
+# define ANGLE_APIENTRY __stdcall
+#else
+# define ANGLE_APIENTRY
+#endif
+
+namespace angle
+{
+struct FeaturesD3D;
+struct FeaturesVk;
+using TraceEventHandle = uint64_t;
+using EGLDisplayType = void *;
+struct PlatformMethods;
+
+// Use a C-like API to not trigger undefined calling behaviour.
+// Avoid using decltype here to work around sanitizer limitations.
+// TODO(jmadill): Use decltype here if/when UBSAN is fixed.
+
+// System --------------------------------------------------------------
+
+// Wall clock time in seconds since the epoch.
+// TODO(jmadill): investigate using an ANGLE internal time library
+using CurrentTimeFunc = double (*)(PlatformMethods *platform);
+inline double DefaultCurrentTime(PlatformMethods *platform)
+{
+ return 0.0;
+}
+
+// Monotonically increasing time in seconds from an arbitrary fixed point in the past.
+// This function is expected to return at least millisecond-precision values. For this reason,
+// it is recommended that the fixed point be no further in the past than the epoch.
+using MonotonicallyIncreasingTimeFunc = double (*)(PlatformMethods *platform);
+inline double DefaultMonotonicallyIncreasingTime(PlatformMethods *platform)
+{
+ return 0.0;
+}
+
+// Logging ------------------------------------------------------------
+
+// Log an error message within the platform implementation.
+using LogErrorFunc = void (*)(PlatformMethods *platform, const char *errorMessage);
+inline void DefaultLogError(PlatformMethods *platform, const char *errorMessage) {}
+
+// Log a warning message within the platform implementation.
+using LogWarningFunc = void (*)(PlatformMethods *platform, const char *warningMessage);
+inline void DefaultLogWarning(PlatformMethods *platform, const char *warningMessage) {}
+
+// Log an info message within the platform implementation.
+using LogInfoFunc = void (*)(PlatformMethods *platform, const char *infoMessage);
+inline void DefaultLogInfo(PlatformMethods *platform, const char *infoMessage) {}
+
+// Tracing --------
+
+// Get a pointer to the enabled state of the given trace category. The
+// embedder can dynamically change the enabled state as trace event
+// recording is started and stopped by the application. Only long-lived
+// literal strings should be given as the category name. The implementation
+// expects the returned pointer to be held permanently in a local static. If
+// the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
+// addTraceEvent is expected to be called by the trace event macros.
+using GetTraceCategoryEnabledFlagFunc = const unsigned char *(*)(PlatformMethods *platform,
+ const char *categoryName);
+inline const unsigned char *DefaultGetTraceCategoryEnabledFlag(PlatformMethods *platform,
+ const char *categoryName)
+{
+ return nullptr;
+}
+
+//
+// Add a trace event to the platform tracing system. Depending on the actual
+// enabled state, this event may be recorded or dropped.
+// - phase specifies the type of event:
+// - BEGIN ('B'): Marks the beginning of a scoped event.
+// - END ('E'): Marks the end of a scoped event.
+// - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't
+// need a matching END event. Instead, at the end of the scope,
+// updateTraceEventDuration() must be called with the TraceEventHandle
+// returned from addTraceEvent().
+// - INSTANT ('I'): Standalone, instantaneous event.
+// - START ('S'): Marks the beginning of an asynchronous event (the end
+// event can occur in a different scope or thread). The id parameter is
+// used to match START/FINISH pairs.
+// - FINISH ('F'): Marks the end of an asynchronous event.
+// - COUNTER ('C'): Used to trace integer quantities that change over
+// time. The argument values are expected to be of type int.
+// - METADATA ('M'): Reserved for internal use.
+// - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
+// - name is the name of the event. Also used to match BEGIN/END and
+// START/FINISH pairs.
+// - id optionally allows events of the same name to be distinguished from
+// each other. For example, to trace the construction and destruction of
+// objects, specify the pointer as the id parameter.
+// - timestamp should be a time value returned from monotonicallyIncreasingTime.
+// - numArgs specifies the number of elements in argNames, argTypes, and
+// argValues.
+// - argNames is the array of argument names. Use long-lived literal strings
+// or specify the COPY flag.
+// - argTypes is the array of argument types:
+// - BOOL (1): bool
+// - UINT (2): unsigned long long
+// - INT (3): long long
+// - DOUBLE (4): double
+// - POINTER (5): void*
+// - STRING (6): char* (long-lived null-terminated char* string)
+// - COPY_STRING (7): char* (temporary null-terminated char* string)
+// - CONVERTABLE (8): WebConvertableToTraceFormat
+// - argValues is the array of argument values. Each value is the unsigned
+// long long member of a union of all supported types.
+// - flags can be 0 or one or more of the following, ORed together:
+// - COPY (0x1): treat all strings (name, argNames and argValues of type
+// string) as temporary so that they will be copied by addTraceEvent.
+// - HAS_ID (0x2): use the id argument to uniquely identify the event for
+// matching with other events of the same name.
+// - MANGLE_ID (0x4): specify this flag if the id parameter is the value
+// of a pointer.
+using AddTraceEventFunc = angle::TraceEventHandle (*)(PlatformMethods *platform,
+ char phase,
+ const unsigned char *categoryEnabledFlag,
+ const char *name,
+ unsigned long long id,
+ double timestamp,
+ int numArgs,
+ const char **argNames,
+ const unsigned char *argTypes,
+ const unsigned long long *argValues,
+ unsigned char flags);
+inline angle::TraceEventHandle DefaultAddTraceEvent(PlatformMethods *platform,
+ char phase,
+ const unsigned char *categoryEnabledFlag,
+ const char *name,
+ unsigned long long id,
+ double timestamp,
+ int numArgs,
+ const char **argNames,
+ const unsigned char *argTypes,
+ const unsigned long long *argValues,
+ unsigned char flags)
+{
+ return 0;
+}
+
+// Set the duration field of a COMPLETE trace event.
+using UpdateTraceEventDurationFunc = void (*)(PlatformMethods *platform,
+ const unsigned char *categoryEnabledFlag,
+ const char *name,
+ angle::TraceEventHandle eventHandle);
+inline void DefaultUpdateTraceEventDuration(PlatformMethods *platform,
+ const unsigned char *categoryEnabledFlag,
+ const char *name,
+ angle::TraceEventHandle eventHandle)
+{}
+
+// Callbacks for reporting histogram data.
+// CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50
+// would do.
+using HistogramCustomCountsFunc = void (*)(PlatformMethods *platform,
+ const char *name,
+ int sample,
+ int min,
+ int max,
+ int bucketCount);
+inline void DefaultHistogramCustomCounts(PlatformMethods *platform,
+ const char *name,
+ int sample,
+ int min,
+ int max,
+ int bucketCount)
+{}
+// Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample
+// value.
+using HistogramEnumerationFunc = void (*)(PlatformMethods *platform,
+ const char *name,
+ int sample,
+ int boundaryValue);
+inline void DefaultHistogramEnumeration(PlatformMethods *platform,
+ const char *name,
+ int sample,
+ int boundaryValue)
+{}
+// Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
+using HistogramSparseFunc = void (*)(PlatformMethods *platform, const char *name, int sample);
+inline void DefaultHistogramSparse(PlatformMethods *platform, const char *name, int sample) {}
+// Boolean histograms track two-state variables.
+using HistogramBooleanFunc = void (*)(PlatformMethods *platform, const char *name, bool sample);
+inline void DefaultHistogramBoolean(PlatformMethods *platform, const char *name, bool sample) {}
+
+// Allows us to programatically override ANGLE's default workarounds for testing purposes.
+using OverrideWorkaroundsD3DFunc = void (*)(PlatformMethods *platform,
+ angle::FeaturesD3D *featuresD3D);
+inline void DefaultOverrideWorkaroundsD3D(PlatformMethods *platform,
+ angle::FeaturesD3D *featuresD3D)
+{}
+
+using OverrideFeaturesVkFunc = void (*)(PlatformMethods *platform,
+ angle::FeaturesVk *featuresVulkan);
+inline void DefaultOverrideFeaturesVk(PlatformMethods *platform, angle::FeaturesVk *featuresVulkan)
+{}
+
+// Callback on a successful program link with the program binary. Can be used to store
+// shaders to disk. Keys are a 160-bit SHA-1 hash.
+using ProgramKeyType = std::array<uint8_t, 20>;
+using CacheProgramFunc = void (*)(PlatformMethods *platform,
+ const ProgramKeyType &key,
+ size_t programSize,
+ const uint8_t *programBytes);
+inline void DefaultCacheProgram(PlatformMethods *platform,
+ const ProgramKeyType &key,
+ size_t programSize,
+ const uint8_t *programBytes)
+{}
+
+// Platform methods are enumerated here once.
+#define ANGLE_PLATFORM_OP(OP) \
+ OP(currentTime, CurrentTime) \
+ OP(monotonicallyIncreasingTime, MonotonicallyIncreasingTime) \
+ OP(logError, LogError) \
+ OP(logWarning, LogWarning) \
+ OP(logInfo, LogInfo) \
+ OP(getTraceCategoryEnabledFlag, GetTraceCategoryEnabledFlag) \
+ OP(addTraceEvent, AddTraceEvent) \
+ OP(updateTraceEventDuration, UpdateTraceEventDuration) \
+ OP(histogramCustomCounts, HistogramCustomCounts) \
+ OP(histogramEnumeration, HistogramEnumeration) \
+ OP(histogramSparse, HistogramSparse) \
+ OP(histogramBoolean, HistogramBoolean) \
+ OP(overrideWorkaroundsD3D, OverrideWorkaroundsD3D) \
+ OP(overrideFeaturesVk, OverrideFeaturesVk) \
+ OP(cacheProgram, CacheProgram)
+
+#define ANGLE_PLATFORM_METHOD_DEF(Name, CapsName) CapsName##Func Name = Default##CapsName;
+
+struct ANGLE_PLATFORM_EXPORT PlatformMethods
+{
+ inline PlatformMethods();
+
+ // User data pointer for any implementation specific members. Put it at the start of the
+ // platform structure so it doesn't become overwritten if one version of the platform
+ // adds or removes new members.
+ void *context = 0;
+
+ ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_DEF)
+};
+
+inline PlatformMethods::PlatformMethods() = default;
+
+#undef ANGLE_PLATFORM_METHOD_DEF
+
+// Subtract one to account for the context pointer.
+constexpr unsigned int g_NumPlatformMethods = (sizeof(PlatformMethods) / sizeof(uintptr_t)) - 1;
+
+#define ANGLE_PLATFORM_METHOD_STRING(Name) #Name
+#define ANGLE_PLATFORM_METHOD_STRING2(Name, CapsName) ANGLE_PLATFORM_METHOD_STRING(Name),
+
+constexpr const char *const g_PlatformMethodNames[g_NumPlatformMethods] = {
+ ANGLE_PLATFORM_OP(ANGLE_PLATFORM_METHOD_STRING2)};
+
+#undef ANGLE_PLATFORM_METHOD_STRING2
+#undef ANGLE_PLATFORM_METHOD_STRING
+
+} // namespace angle
+
+extern "C" {
+
+// Gets the platform methods on the passed-in EGL display. If the method name signature does not
+// match the compiled signature for this ANGLE, false is returned. On success true is returned.
+// The application should set any platform methods it cares about on the returned pointer.
+// If display is not valid, behaviour is undefined.
+
+ANGLE_PLATFORM_EXPORT bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display,
+ const char *const methodNames[],
+ unsigned int methodNameCount,
+ void *context,
+ void *platformMethodsOut);
+
+// Sets the platform methods back to their defaults.
+// If display is not valid, behaviour is undefined.
+ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEResetDisplayPlatform(angle::EGLDisplayType display);
+
+} // extern "C"
+
+namespace angle
+{
+typedef bool(ANGLE_APIENTRY *GetDisplayPlatformFunc)(angle::EGLDisplayType,
+ const char *const *,
+ unsigned int,
+ void *,
+ void *);
+typedef void(ANGLE_APIENTRY *ResetDisplayPlatformFunc)(angle::EGLDisplayType);
+} // namespace angle
+
+// This function is not exported
+angle::PlatformMethods *ANGLEPlatformCurrent();
+
+#endif // ANGLE_PLATFORM_H
diff --git a/gfx/angle/checkout/out/gen/angle/id/commit.h b/gfx/angle/checkout/out/gen/angle/id/commit.h
new file mode 100644
index 0000000000..7d67162b15
--- /dev/null
+++ b/gfx/angle/checkout/out/gen/angle/id/commit.h
@@ -0,0 +1,3 @@
+#define ANGLE_COMMIT_HASH "fa5e0bac2b3b"
+#define ANGLE_COMMIT_HASH_SIZE 12
+#define ANGLE_COMMIT_DATE "2021-01-20 18:25:34 -0800"
diff --git a/gfx/angle/checkout/src/common/Color.h b/gfx/angle/checkout/src/common/Color.h
new file mode 100644
index 0000000000..884da078e6
--- /dev/null
+++ b/gfx/angle/checkout/src/common/Color.h
@@ -0,0 +1,104 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Color.h : Defines the Color type used throughout the ANGLE libraries
+
+#ifndef COMMON_COLOR_H_
+#define COMMON_COLOR_H_
+
+#include <cstdint>
+
+namespace angle
+{
+
+template <typename T>
+struct Color
+{
+ Color();
+ constexpr Color(T r, T g, T b, T a);
+
+ const T *data() const { return &red; }
+ T *ptr() { return &red; }
+
+ static Color fromData(const T *data) { return Color(data[0], data[1], data[2], data[3]); }
+ void writeData(T *data) const
+ {
+ data[0] = red;
+ data[1] = green;
+ data[2] = blue;
+ data[3] = alpha;
+ }
+
+ T red;
+ T green;
+ T blue;
+ T alpha;
+};
+
+template <typename T>
+bool operator==(const Color<T> &a, const Color<T> &b);
+
+template <typename T>
+bool operator!=(const Color<T> &a, const Color<T> &b);
+
+typedef Color<float> ColorF;
+typedef Color<int> ColorI;
+typedef Color<unsigned int> ColorUI;
+
+struct ColorGeneric
+{
+ inline ColorGeneric();
+ inline ColorGeneric(const ColorF &color);
+ inline ColorGeneric(const ColorI &color);
+ inline ColorGeneric(const ColorUI &color);
+
+ enum class Type : uint8_t
+ {
+ Float = 0,
+ Int = 1,
+ UInt = 2
+ };
+
+ union
+ {
+ ColorF colorF;
+ ColorI colorI;
+ ColorUI colorUI;
+ };
+
+ Type type;
+};
+
+inline bool operator==(const ColorGeneric &a, const ColorGeneric &b);
+
+inline bool operator!=(const ColorGeneric &a, const ColorGeneric &b);
+
+struct DepthStencil
+{
+ DepthStencil() : depth(0), stencil(0) {}
+
+ // Double is needed to represent the 32-bit integer range of GL_DEPTH_COMPONENT32.
+ double depth;
+ uint32_t stencil;
+};
+} // namespace angle
+
+// TODO: Move this fully into the angle namespace
+namespace gl
+{
+
+template <typename T>
+using Color = angle::Color<T>;
+using ColorF = angle::ColorF;
+using ColorI = angle::ColorI;
+using ColorUI = angle::ColorUI;
+using ColorGeneric = angle::ColorGeneric;
+
+} // namespace gl
+
+#include "Color.inc"
+
+#endif // COMMON_COLOR_H_
diff --git a/gfx/angle/checkout/src/common/Color.inc b/gfx/angle/checkout/src/common/Color.inc
new file mode 100644
index 0000000000..3dc7b192a3
--- /dev/null
+++ b/gfx/angle/checkout/src/common/Color.inc
@@ -0,0 +1,69 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Color.inc : Inline definitions of some functions from Color.h
+
+namespace angle
+{
+
+template <typename T>
+Color<T>::Color() : Color(0, 0, 0, 0)
+{
+}
+
+template <typename T>
+constexpr Color<T>::Color(T r, T g, T b, T a) : red(r), green(g), blue(b), alpha(a)
+{
+}
+
+template <typename T>
+bool operator==(const Color<T> &a, const Color<T> &b)
+{
+ return a.red == b.red &&
+ a.green == b.green &&
+ a.blue == b.blue &&
+ a.alpha == b.alpha;
+}
+
+template <typename T>
+bool operator!=(const Color<T> &a, const Color<T> &b)
+{
+ return !(a == b);
+}
+
+
+ColorGeneric::ColorGeneric() : colorF(), type(Type::Float) {}
+
+ColorGeneric::ColorGeneric(const ColorF &color) : colorF(color), type(Type::Float) {}
+
+ColorGeneric::ColorGeneric(const ColorI &color) : colorI(color), type(Type::Int) {}
+
+ColorGeneric::ColorGeneric(const ColorUI &color) : colorUI(color), type(Type::UInt) {}
+
+bool operator==(const ColorGeneric &a, const ColorGeneric &b)
+{
+ if (a.type != b.type)
+ {
+ return false;
+ }
+ switch (a.type)
+ {
+ default:
+ case ColorGeneric::Type::Float:
+ return a.colorF == b.colorF;
+ case ColorGeneric::Type::Int:
+ return a.colorI == b.colorI;
+ case ColorGeneric::Type::UInt:
+ return a.colorUI == b.colorUI;
+ }
+}
+
+bool operator!=(const ColorGeneric &a, const ColorGeneric &b)
+{
+ return !(a == b);
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/FastVector.h b/gfx/angle/checkout/src/common/FastVector.h
new file mode 100644
index 0000000000..7c86a288fc
--- /dev/null
+++ b/gfx/angle/checkout/src/common/FastVector.h
@@ -0,0 +1,434 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FastVector.h:
+// A vector class with a initial fixed size and variable growth.
+// Based on FixedVector.
+//
+
+#ifndef COMMON_FASTVECTOR_H_
+#define COMMON_FASTVECTOR_H_
+
+#include "common/debug.h"
+
+#include <algorithm>
+#include <array>
+#include <initializer_list>
+
+namespace angle
+{
+template <class T, size_t N, class Storage = std::array<T, N>>
+class FastVector final
+{
+ public:
+ using value_type = typename Storage::value_type;
+ using size_type = typename Storage::size_type;
+ using reference = typename Storage::reference;
+ using const_reference = typename Storage::const_reference;
+ using pointer = typename Storage::pointer;
+ using const_pointer = typename Storage::const_pointer;
+ using iterator = T *;
+ using const_iterator = const T *;
+
+ FastVector();
+ FastVector(size_type count, const value_type &value);
+ FastVector(size_type count);
+
+ FastVector(const FastVector<T, N, Storage> &other);
+ FastVector(FastVector<T, N, Storage> &&other);
+ FastVector(std::initializer_list<value_type> init);
+
+ FastVector<T, N, Storage> &operator=(const FastVector<T, N, Storage> &other);
+ FastVector<T, N, Storage> &operator=(FastVector<T, N, Storage> &&other);
+ FastVector<T, N, Storage> &operator=(std::initializer_list<value_type> init);
+
+ ~FastVector();
+
+ reference at(size_type pos);
+ const_reference at(size_type pos) const;
+
+ reference operator[](size_type pos);
+ const_reference operator[](size_type pos) const;
+
+ pointer data();
+ const_pointer data() const;
+
+ iterator begin();
+ const_iterator begin() const;
+
+ iterator end();
+ const_iterator end() const;
+
+ bool empty() const;
+ size_type size() const;
+
+ void clear();
+
+ void push_back(const value_type &value);
+ void push_back(value_type &&value);
+
+ void pop_back();
+
+ reference front();
+ const_reference front() const;
+
+ reference back();
+ const_reference back() const;
+
+ void swap(FastVector<T, N, Storage> &other);
+
+ void resize(size_type count);
+ void resize(size_type count, const value_type &value);
+
+ // Specialty function that removes a known element and might shuffle the list.
+ void remove_and_permute(const value_type &element);
+
+ private:
+ void assign_from_initializer_list(std::initializer_list<value_type> init);
+ void ensure_capacity(size_t capacity);
+ bool uses_fixed_storage() const;
+
+ Storage mFixedStorage;
+ pointer mData = mFixedStorage.data();
+ size_type mSize = 0;
+ size_type mReservedSize = N;
+};
+
+template <class T, size_t N, class StorageN, size_t M, class StorageM>
+bool operator==(const FastVector<T, N, StorageN> &a, const FastVector<T, M, StorageM> &b)
+{
+ return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
+}
+
+template <class T, size_t N, class StorageN, size_t M, class StorageM>
+bool operator!=(const FastVector<T, N, StorageN> &a, const FastVector<T, M, StorageM> &b)
+{
+ return !(a == b);
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE bool FastVector<T, N, Storage>::uses_fixed_storage() const
+{
+ return mData == mFixedStorage.data();
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage>::FastVector()
+{}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage>::FastVector(size_type count, const value_type &value)
+{
+ ensure_capacity(count);
+ mSize = count;
+ std::fill(begin(), end(), value);
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage>::FastVector(size_type count)
+{
+ ensure_capacity(count);
+ mSize = count;
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage>::FastVector(const FastVector<T, N, Storage> &other)
+{
+ ensure_capacity(other.mSize);
+ mSize = other.mSize;
+ std::copy(other.begin(), other.end(), begin());
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage>::FastVector(FastVector<T, N, Storage> &&other) : FastVector()
+{
+ swap(other);
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage>::FastVector(std::initializer_list<value_type> init)
+{
+ assign_from_initializer_list(init);
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage> &FastVector<T, N, Storage>::operator=(
+ const FastVector<T, N, Storage> &other)
+{
+ ensure_capacity(other.mSize);
+ mSize = other.mSize;
+ std::copy(other.begin(), other.end(), begin());
+ return *this;
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage> &FastVector<T, N, Storage>::operator=(FastVector<T, N, Storage> &&other)
+{
+ swap(*this, other);
+ return *this;
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage> &FastVector<T, N, Storage>::operator=(
+ std::initializer_list<value_type> init)
+{
+ assign_from_initializer_list(init);
+ return *this;
+}
+
+template <class T, size_t N, class Storage>
+FastVector<T, N, Storage>::~FastVector()
+{
+ clear();
+ if (!uses_fixed_storage())
+ {
+ delete[] mData;
+ }
+}
+
+template <class T, size_t N, class Storage>
+typename FastVector<T, N, Storage>::reference FastVector<T, N, Storage>::at(size_type pos)
+{
+ ASSERT(pos < mSize);
+ return mData[pos];
+}
+
+template <class T, size_t N, class Storage>
+typename FastVector<T, N, Storage>::const_reference FastVector<T, N, Storage>::at(
+ size_type pos) const
+{
+ ASSERT(pos < mSize);
+ return mData[pos];
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::reference FastVector<T, N, Storage>::operator[](
+ size_type pos)
+{
+ ASSERT(pos < mSize);
+ return mData[pos];
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE
+ typename FastVector<T, N, Storage>::const_reference FastVector<T, N, Storage>::operator[](
+ size_type pos) const
+{
+ ASSERT(pos < mSize);
+ return mData[pos];
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::const_pointer
+angle::FastVector<T, N, Storage>::data() const
+{
+ ASSERT(!empty());
+ return mData;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::pointer angle::FastVector<T, N, Storage>::data()
+{
+ ASSERT(!empty());
+ return mData;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::iterator FastVector<T, N, Storage>::begin()
+{
+ return mData;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::const_iterator FastVector<T, N, Storage>::begin()
+ const
+{
+ return mData;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::iterator FastVector<T, N, Storage>::end()
+{
+ return mData + mSize;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::const_iterator FastVector<T, N, Storage>::end()
+ const
+{
+ return mData + mSize;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE bool FastVector<T, N, Storage>::empty() const
+{
+ return mSize == 0;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::size_type FastVector<T, N, Storage>::size() const
+{
+ return mSize;
+}
+
+template <class T, size_t N, class Storage>
+void FastVector<T, N, Storage>::clear()
+{
+ resize(0);
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE void FastVector<T, N, Storage>::push_back(const value_type &value)
+{
+ if (mSize == mReservedSize)
+ ensure_capacity(mSize + 1);
+ mData[mSize++] = value;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE void FastVector<T, N, Storage>::push_back(value_type &&value)
+{
+ if (mSize == mReservedSize)
+ ensure_capacity(mSize + 1);
+ mData[mSize++] = std::move(value);
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE void FastVector<T, N, Storage>::pop_back()
+{
+ ASSERT(mSize > 0);
+ mSize--;
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::reference FastVector<T, N, Storage>::front()
+{
+ ASSERT(mSize > 0);
+ return mData[0];
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::const_reference FastVector<T, N, Storage>::front()
+ const
+{
+ ASSERT(mSize > 0);
+ return mData[0];
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::reference FastVector<T, N, Storage>::back()
+{
+ ASSERT(mSize > 0);
+ return mData[mSize - 1];
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE typename FastVector<T, N, Storage>::const_reference FastVector<T, N, Storage>::back()
+ const
+{
+ ASSERT(mSize > 0);
+ return mData[mSize - 1];
+}
+
+template <class T, size_t N, class Storage>
+void FastVector<T, N, Storage>::swap(FastVector<T, N, Storage> &other)
+{
+ std::swap(mSize, other.mSize);
+
+ pointer tempData = other.mData;
+ if (uses_fixed_storage())
+ other.mData = other.mFixedStorage.data();
+ else
+ other.mData = mData;
+ if (tempData == other.mFixedStorage.data())
+ mData = mFixedStorage.data();
+ else
+ mData = tempData;
+ std::swap(mReservedSize, other.mReservedSize);
+
+ if (uses_fixed_storage() || other.uses_fixed_storage())
+ std::swap(mFixedStorage, other.mFixedStorage);
+}
+
+template <class T, size_t N, class Storage>
+void FastVector<T, N, Storage>::resize(size_type count)
+{
+ if (count > mSize)
+ {
+ ensure_capacity(count);
+ }
+ mSize = count;
+}
+
+template <class T, size_t N, class Storage>
+void FastVector<T, N, Storage>::resize(size_type count, const value_type &value)
+{
+ if (count > mSize)
+ {
+ ensure_capacity(count);
+ std::fill(mData + mSize, mData + count, value);
+ }
+ mSize = count;
+}
+
+template <class T, size_t N, class Storage>
+void FastVector<T, N, Storage>::assign_from_initializer_list(std::initializer_list<value_type> init)
+{
+ ensure_capacity(init.size());
+ mSize = init.size();
+ size_t index = 0;
+ for (auto &value : init)
+ {
+ mData[index++] = value;
+ }
+}
+
+template <class T, size_t N, class Storage>
+ANGLE_INLINE void FastVector<T, N, Storage>::remove_and_permute(const value_type &element)
+{
+ size_t len = mSize - 1;
+ for (size_t index = 0; index < len; ++index)
+ {
+ if (mData[index] == element)
+ {
+ mData[index] = std::move(mData[len]);
+ break;
+ }
+ }
+ pop_back();
+}
+
+template <class T, size_t N, class Storage>
+void FastVector<T, N, Storage>::ensure_capacity(size_t capacity)
+{
+ // We have a minimum capacity of N.
+ if (mReservedSize < capacity)
+ {
+ ASSERT(capacity > N);
+ size_type newSize = std::max(mReservedSize, N);
+ while (newSize < capacity)
+ {
+ newSize *= 2;
+ }
+
+ pointer newData = new value_type[newSize];
+
+ if (mSize > 0)
+ {
+ std::move(begin(), end(), newData);
+ }
+
+ if (!uses_fixed_storage())
+ {
+ delete[] mData;
+ }
+
+ mData = newData;
+ mReservedSize = newSize;
+ }
+}
+} // namespace angle
+
+#endif // COMMON_FASTVECTOR_H_
diff --git a/gfx/angle/checkout/src/common/FixedVector.h b/gfx/angle/checkout/src/common/FixedVector.h
new file mode 100644
index 0000000000..f2c4748d5d
--- /dev/null
+++ b/gfx/angle/checkout/src/common/FixedVector.h
@@ -0,0 +1,341 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FixedVector.h:
+// A vector class with a maximum size and fixed storage.
+//
+
+#ifndef COMMON_FIXEDVECTOR_H_
+#define COMMON_FIXEDVECTOR_H_
+
+#include "common/debug.h"
+
+#include <algorithm>
+#include <array>
+#include <initializer_list>
+
+namespace angle
+{
+template <class T, size_t N, class Storage = std::array<T, N>>
+class FixedVector final
+{
+ public:
+ using value_type = typename Storage::value_type;
+ using size_type = typename Storage::size_type;
+ using reference = typename Storage::reference;
+ using const_reference = typename Storage::const_reference;
+ using pointer = typename Storage::pointer;
+ using const_pointer = typename Storage::const_pointer;
+ using iterator = typename Storage::iterator;
+ using const_iterator = typename Storage::const_iterator;
+ using reverse_iterator = typename Storage::reverse_iterator;
+ using const_reverse_iterator = typename Storage::const_reverse_iterator;
+
+ FixedVector();
+ FixedVector(size_type count, const value_type &value);
+ FixedVector(size_type count);
+
+ FixedVector(const FixedVector<T, N, Storage> &other);
+ FixedVector(FixedVector<T, N, Storage> &&other);
+ FixedVector(std::initializer_list<value_type> init);
+
+ FixedVector<T, N, Storage> &operator=(const FixedVector<T, N, Storage> &other);
+ FixedVector<T, N, Storage> &operator=(FixedVector<T, N, Storage> &&other);
+ FixedVector<T, N, Storage> &operator=(std::initializer_list<value_type> init);
+
+ ~FixedVector();
+
+ reference at(size_type pos);
+ const_reference at(size_type pos) const;
+
+ reference operator[](size_type pos);
+ const_reference operator[](size_type pos) const;
+
+ pointer data();
+ const_pointer data() const;
+
+ iterator begin();
+ const_iterator begin() const;
+
+ iterator end();
+ const_iterator end() const;
+
+ bool empty() const;
+ size_type size() const;
+ static constexpr size_type max_size();
+
+ void clear();
+
+ void push_back(const value_type &value);
+ void push_back(value_type &&value);
+
+ void pop_back();
+ reference back();
+ const_reference back() const;
+
+ void swap(FixedVector<T, N, Storage> &other);
+
+ void resize(size_type count);
+ void resize(size_type count, const value_type &value);
+
+ bool full() const;
+
+ private:
+ void assign_from_initializer_list(std::initializer_list<value_type> init);
+
+ Storage mStorage;
+ size_type mSize = 0;
+};
+
+template <class T, size_t N, class Storage>
+bool operator==(const FixedVector<T, N, Storage> &a, const FixedVector<T, N, Storage> &b)
+{
+ return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
+}
+
+template <class T, size_t N, class Storage>
+bool operator!=(const FixedVector<T, N, Storage> &a, const FixedVector<T, N, Storage> &b)
+{
+ return !(a == b);
+}
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage>::FixedVector() = default;
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage>::FixedVector(size_type count, const value_type &value) : mSize(count)
+{
+ ASSERT(count <= N);
+ std::fill(mStorage.begin(), mStorage.begin() + count, value);
+}
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage>::FixedVector(size_type count) : mSize(count)
+{
+ ASSERT(count <= N);
+}
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage>::FixedVector(const FixedVector<T, N, Storage> &other) = default;
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage>::FixedVector(FixedVector<T, N, Storage> &&other) = default;
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage>::FixedVector(std::initializer_list<value_type> init)
+{
+ ASSERT(init.size() <= N);
+ assign_from_initializer_list(init);
+}
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage> &FixedVector<T, N, Storage>::operator=(
+ const FixedVector<T, N, Storage> &other) = default;
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage> &FixedVector<T, N, Storage>::operator=(
+ FixedVector<T, N, Storage> &&other) = default;
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage> &FixedVector<T, N, Storage>::operator=(
+ std::initializer_list<value_type> init)
+{
+ clear();
+ ASSERT(init.size() <= N);
+ assign_from_initializer_list(init);
+ return this;
+}
+
+template <class T, size_t N, class Storage>
+FixedVector<T, N, Storage>::~FixedVector()
+{
+ clear();
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::reference FixedVector<T, N, Storage>::at(size_type pos)
+{
+ ASSERT(pos < N);
+ return mStorage.at(pos);
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::const_reference FixedVector<T, N, Storage>::at(
+ size_type pos) const
+{
+ ASSERT(pos < N);
+ return mStorage.at(pos);
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::reference FixedVector<T, N, Storage>::operator[](size_type pos)
+{
+ ASSERT(pos < N);
+ return mStorage[pos];
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::const_reference FixedVector<T, N, Storage>::operator[](
+ size_type pos) const
+{
+ ASSERT(pos < N);
+ return mStorage[pos];
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::const_pointer angle::FixedVector<T, N, Storage>::data() const
+{
+ return mStorage.data();
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::pointer angle::FixedVector<T, N, Storage>::data()
+{
+ return mStorage.data();
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::iterator FixedVector<T, N, Storage>::begin()
+{
+ return mStorage.begin();
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::const_iterator FixedVector<T, N, Storage>::begin() const
+{
+ return mStorage.begin();
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::iterator FixedVector<T, N, Storage>::end()
+{
+ return mStorage.begin() + mSize;
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::const_iterator FixedVector<T, N, Storage>::end() const
+{
+ return mStorage.begin() + mSize;
+}
+
+template <class T, size_t N, class Storage>
+bool FixedVector<T, N, Storage>::empty() const
+{
+ return mSize == 0;
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::size_type FixedVector<T, N, Storage>::size() const
+{
+ return mSize;
+}
+
+template <class T, size_t N, class Storage>
+constexpr typename FixedVector<T, N, Storage>::size_type FixedVector<T, N, Storage>::max_size()
+{
+ return N;
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::clear()
+{
+ resize(0);
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::push_back(const value_type &value)
+{
+ ASSERT(mSize < N);
+ mStorage[mSize] = value;
+ mSize++;
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::push_back(value_type &&value)
+{
+ ASSERT(mSize < N);
+ mStorage[mSize] = std::move(value);
+ mSize++;
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::pop_back()
+{
+ ASSERT(mSize > 0);
+ mSize--;
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::reference FixedVector<T, N, Storage>::back()
+{
+ ASSERT(mSize > 0);
+ return mStorage[mSize - 1];
+}
+
+template <class T, size_t N, class Storage>
+typename FixedVector<T, N, Storage>::const_reference FixedVector<T, N, Storage>::back() const
+{
+ ASSERT(mSize > 0);
+ return mStorage[mSize - 1];
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::swap(FixedVector<T, N, Storage> &other)
+{
+ std::swap(mSize, other.mSize);
+ std::swap(mStorage, other.mStorage);
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::resize(size_type count)
+{
+ ASSERT(count <= N);
+ while (mSize > count)
+ {
+ mSize--;
+ mStorage[mSize] = value_type();
+ }
+ while (mSize < count)
+ {
+ mStorage[mSize] = value_type();
+ mSize++;
+ }
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::resize(size_type count, const value_type &value)
+{
+ ASSERT(count <= N);
+ while (mSize > count)
+ {
+ mSize--;
+ mStorage[mSize] = value_type();
+ }
+ while (mSize < count)
+ {
+ mStorage[mSize] = value;
+ mSize++;
+ }
+}
+
+template <class T, size_t N, class Storage>
+void FixedVector<T, N, Storage>::assign_from_initializer_list(
+ std::initializer_list<value_type> init)
+{
+ for (auto element : init)
+ {
+ mStorage[mSize] = std::move(element);
+ mSize++;
+ }
+}
+
+template <class T, size_t N, class Storage>
+bool FixedVector<T, N, Storage>::full() const
+{
+ return (mSize == N);
+}
+} // namespace angle
+
+#endif // COMMON_FIXEDVECTOR_H_
diff --git a/gfx/angle/checkout/src/common/Float16ToFloat32.cpp b/gfx/angle/checkout/src/common/Float16ToFloat32.cpp
new file mode 100644
index 0000000000..6c21987704
--- /dev/null
+++ b/gfx/angle/checkout/src/common/Float16ToFloat32.cpp
@@ -0,0 +1,300 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is automatically generated.
+
+#include "common/mathutil.h"
+
+namespace gl
+{
+
+const static unsigned g_mantissa[2048] = {
+ 0x00000000, 0x33800000, 0x34000000, 0x34400000, 0x34800000, 0x34a00000, 0x34c00000, 0x34e00000,
+ 0x35000000, 0x35100000, 0x35200000, 0x35300000, 0x35400000, 0x35500000, 0x35600000, 0x35700000,
+ 0x35800000, 0x35880000, 0x35900000, 0x35980000, 0x35a00000, 0x35a80000, 0x35b00000, 0x35b80000,
+ 0x35c00000, 0x35c80000, 0x35d00000, 0x35d80000, 0x35e00000, 0x35e80000, 0x35f00000, 0x35f80000,
+ 0x36000000, 0x36040000, 0x36080000, 0x360c0000, 0x36100000, 0x36140000, 0x36180000, 0x361c0000,
+ 0x36200000, 0x36240000, 0x36280000, 0x362c0000, 0x36300000, 0x36340000, 0x36380000, 0x363c0000,
+ 0x36400000, 0x36440000, 0x36480000, 0x364c0000, 0x36500000, 0x36540000, 0x36580000, 0x365c0000,
+ 0x36600000, 0x36640000, 0x36680000, 0x366c0000, 0x36700000, 0x36740000, 0x36780000, 0x367c0000,
+ 0x36800000, 0x36820000, 0x36840000, 0x36860000, 0x36880000, 0x368a0000, 0x368c0000, 0x368e0000,
+ 0x36900000, 0x36920000, 0x36940000, 0x36960000, 0x36980000, 0x369a0000, 0x369c0000, 0x369e0000,
+ 0x36a00000, 0x36a20000, 0x36a40000, 0x36a60000, 0x36a80000, 0x36aa0000, 0x36ac0000, 0x36ae0000,
+ 0x36b00000, 0x36b20000, 0x36b40000, 0x36b60000, 0x36b80000, 0x36ba0000, 0x36bc0000, 0x36be0000,
+ 0x36c00000, 0x36c20000, 0x36c40000, 0x36c60000, 0x36c80000, 0x36ca0000, 0x36cc0000, 0x36ce0000,
+ 0x36d00000, 0x36d20000, 0x36d40000, 0x36d60000, 0x36d80000, 0x36da0000, 0x36dc0000, 0x36de0000,
+ 0x36e00000, 0x36e20000, 0x36e40000, 0x36e60000, 0x36e80000, 0x36ea0000, 0x36ec0000, 0x36ee0000,
+ 0x36f00000, 0x36f20000, 0x36f40000, 0x36f60000, 0x36f80000, 0x36fa0000, 0x36fc0000, 0x36fe0000,
+ 0x37000000, 0x37010000, 0x37020000, 0x37030000, 0x37040000, 0x37050000, 0x37060000, 0x37070000,
+ 0x37080000, 0x37090000, 0x370a0000, 0x370b0000, 0x370c0000, 0x370d0000, 0x370e0000, 0x370f0000,
+ 0x37100000, 0x37110000, 0x37120000, 0x37130000, 0x37140000, 0x37150000, 0x37160000, 0x37170000,
+ 0x37180000, 0x37190000, 0x371a0000, 0x371b0000, 0x371c0000, 0x371d0000, 0x371e0000, 0x371f0000,
+ 0x37200000, 0x37210000, 0x37220000, 0x37230000, 0x37240000, 0x37250000, 0x37260000, 0x37270000,
+ 0x37280000, 0x37290000, 0x372a0000, 0x372b0000, 0x372c0000, 0x372d0000, 0x372e0000, 0x372f0000,
+ 0x37300000, 0x37310000, 0x37320000, 0x37330000, 0x37340000, 0x37350000, 0x37360000, 0x37370000,
+ 0x37380000, 0x37390000, 0x373a0000, 0x373b0000, 0x373c0000, 0x373d0000, 0x373e0000, 0x373f0000,
+ 0x37400000, 0x37410000, 0x37420000, 0x37430000, 0x37440000, 0x37450000, 0x37460000, 0x37470000,
+ 0x37480000, 0x37490000, 0x374a0000, 0x374b0000, 0x374c0000, 0x374d0000, 0x374e0000, 0x374f0000,
+ 0x37500000, 0x37510000, 0x37520000, 0x37530000, 0x37540000, 0x37550000, 0x37560000, 0x37570000,
+ 0x37580000, 0x37590000, 0x375a0000, 0x375b0000, 0x375c0000, 0x375d0000, 0x375e0000, 0x375f0000,
+ 0x37600000, 0x37610000, 0x37620000, 0x37630000, 0x37640000, 0x37650000, 0x37660000, 0x37670000,
+ 0x37680000, 0x37690000, 0x376a0000, 0x376b0000, 0x376c0000, 0x376d0000, 0x376e0000, 0x376f0000,
+ 0x37700000, 0x37710000, 0x37720000, 0x37730000, 0x37740000, 0x37750000, 0x37760000, 0x37770000,
+ 0x37780000, 0x37790000, 0x377a0000, 0x377b0000, 0x377c0000, 0x377d0000, 0x377e0000, 0x377f0000,
+ 0x37800000, 0x37808000, 0x37810000, 0x37818000, 0x37820000, 0x37828000, 0x37830000, 0x37838000,
+ 0x37840000, 0x37848000, 0x37850000, 0x37858000, 0x37860000, 0x37868000, 0x37870000, 0x37878000,
+ 0x37880000, 0x37888000, 0x37890000, 0x37898000, 0x378a0000, 0x378a8000, 0x378b0000, 0x378b8000,
+ 0x378c0000, 0x378c8000, 0x378d0000, 0x378d8000, 0x378e0000, 0x378e8000, 0x378f0000, 0x378f8000,
+ 0x37900000, 0x37908000, 0x37910000, 0x37918000, 0x37920000, 0x37928000, 0x37930000, 0x37938000,
+ 0x37940000, 0x37948000, 0x37950000, 0x37958000, 0x37960000, 0x37968000, 0x37970000, 0x37978000,
+ 0x37980000, 0x37988000, 0x37990000, 0x37998000, 0x379a0000, 0x379a8000, 0x379b0000, 0x379b8000,
+ 0x379c0000, 0x379c8000, 0x379d0000, 0x379d8000, 0x379e0000, 0x379e8000, 0x379f0000, 0x379f8000,
+ 0x37a00000, 0x37a08000, 0x37a10000, 0x37a18000, 0x37a20000, 0x37a28000, 0x37a30000, 0x37a38000,
+ 0x37a40000, 0x37a48000, 0x37a50000, 0x37a58000, 0x37a60000, 0x37a68000, 0x37a70000, 0x37a78000,
+ 0x37a80000, 0x37a88000, 0x37a90000, 0x37a98000, 0x37aa0000, 0x37aa8000, 0x37ab0000, 0x37ab8000,
+ 0x37ac0000, 0x37ac8000, 0x37ad0000, 0x37ad8000, 0x37ae0000, 0x37ae8000, 0x37af0000, 0x37af8000,
+ 0x37b00000, 0x37b08000, 0x37b10000, 0x37b18000, 0x37b20000, 0x37b28000, 0x37b30000, 0x37b38000,
+ 0x37b40000, 0x37b48000, 0x37b50000, 0x37b58000, 0x37b60000, 0x37b68000, 0x37b70000, 0x37b78000,
+ 0x37b80000, 0x37b88000, 0x37b90000, 0x37b98000, 0x37ba0000, 0x37ba8000, 0x37bb0000, 0x37bb8000,
+ 0x37bc0000, 0x37bc8000, 0x37bd0000, 0x37bd8000, 0x37be0000, 0x37be8000, 0x37bf0000, 0x37bf8000,
+ 0x37c00000, 0x37c08000, 0x37c10000, 0x37c18000, 0x37c20000, 0x37c28000, 0x37c30000, 0x37c38000,
+ 0x37c40000, 0x37c48000, 0x37c50000, 0x37c58000, 0x37c60000, 0x37c68000, 0x37c70000, 0x37c78000,
+ 0x37c80000, 0x37c88000, 0x37c90000, 0x37c98000, 0x37ca0000, 0x37ca8000, 0x37cb0000, 0x37cb8000,
+ 0x37cc0000, 0x37cc8000, 0x37cd0000, 0x37cd8000, 0x37ce0000, 0x37ce8000, 0x37cf0000, 0x37cf8000,
+ 0x37d00000, 0x37d08000, 0x37d10000, 0x37d18000, 0x37d20000, 0x37d28000, 0x37d30000, 0x37d38000,
+ 0x37d40000, 0x37d48000, 0x37d50000, 0x37d58000, 0x37d60000, 0x37d68000, 0x37d70000, 0x37d78000,
+ 0x37d80000, 0x37d88000, 0x37d90000, 0x37d98000, 0x37da0000, 0x37da8000, 0x37db0000, 0x37db8000,
+ 0x37dc0000, 0x37dc8000, 0x37dd0000, 0x37dd8000, 0x37de0000, 0x37de8000, 0x37df0000, 0x37df8000,
+ 0x37e00000, 0x37e08000, 0x37e10000, 0x37e18000, 0x37e20000, 0x37e28000, 0x37e30000, 0x37e38000,
+ 0x37e40000, 0x37e48000, 0x37e50000, 0x37e58000, 0x37e60000, 0x37e68000, 0x37e70000, 0x37e78000,
+ 0x37e80000, 0x37e88000, 0x37e90000, 0x37e98000, 0x37ea0000, 0x37ea8000, 0x37eb0000, 0x37eb8000,
+ 0x37ec0000, 0x37ec8000, 0x37ed0000, 0x37ed8000, 0x37ee0000, 0x37ee8000, 0x37ef0000, 0x37ef8000,
+ 0x37f00000, 0x37f08000, 0x37f10000, 0x37f18000, 0x37f20000, 0x37f28000, 0x37f30000, 0x37f38000,
+ 0x37f40000, 0x37f48000, 0x37f50000, 0x37f58000, 0x37f60000, 0x37f68000, 0x37f70000, 0x37f78000,
+ 0x37f80000, 0x37f88000, 0x37f90000, 0x37f98000, 0x37fa0000, 0x37fa8000, 0x37fb0000, 0x37fb8000,
+ 0x37fc0000, 0x37fc8000, 0x37fd0000, 0x37fd8000, 0x37fe0000, 0x37fe8000, 0x37ff0000, 0x37ff8000,
+ 0x38000000, 0x38004000, 0x38008000, 0x3800c000, 0x38010000, 0x38014000, 0x38018000, 0x3801c000,
+ 0x38020000, 0x38024000, 0x38028000, 0x3802c000, 0x38030000, 0x38034000, 0x38038000, 0x3803c000,
+ 0x38040000, 0x38044000, 0x38048000, 0x3804c000, 0x38050000, 0x38054000, 0x38058000, 0x3805c000,
+ 0x38060000, 0x38064000, 0x38068000, 0x3806c000, 0x38070000, 0x38074000, 0x38078000, 0x3807c000,
+ 0x38080000, 0x38084000, 0x38088000, 0x3808c000, 0x38090000, 0x38094000, 0x38098000, 0x3809c000,
+ 0x380a0000, 0x380a4000, 0x380a8000, 0x380ac000, 0x380b0000, 0x380b4000, 0x380b8000, 0x380bc000,
+ 0x380c0000, 0x380c4000, 0x380c8000, 0x380cc000, 0x380d0000, 0x380d4000, 0x380d8000, 0x380dc000,
+ 0x380e0000, 0x380e4000, 0x380e8000, 0x380ec000, 0x380f0000, 0x380f4000, 0x380f8000, 0x380fc000,
+ 0x38100000, 0x38104000, 0x38108000, 0x3810c000, 0x38110000, 0x38114000, 0x38118000, 0x3811c000,
+ 0x38120000, 0x38124000, 0x38128000, 0x3812c000, 0x38130000, 0x38134000, 0x38138000, 0x3813c000,
+ 0x38140000, 0x38144000, 0x38148000, 0x3814c000, 0x38150000, 0x38154000, 0x38158000, 0x3815c000,
+ 0x38160000, 0x38164000, 0x38168000, 0x3816c000, 0x38170000, 0x38174000, 0x38178000, 0x3817c000,
+ 0x38180000, 0x38184000, 0x38188000, 0x3818c000, 0x38190000, 0x38194000, 0x38198000, 0x3819c000,
+ 0x381a0000, 0x381a4000, 0x381a8000, 0x381ac000, 0x381b0000, 0x381b4000, 0x381b8000, 0x381bc000,
+ 0x381c0000, 0x381c4000, 0x381c8000, 0x381cc000, 0x381d0000, 0x381d4000, 0x381d8000, 0x381dc000,
+ 0x381e0000, 0x381e4000, 0x381e8000, 0x381ec000, 0x381f0000, 0x381f4000, 0x381f8000, 0x381fc000,
+ 0x38200000, 0x38204000, 0x38208000, 0x3820c000, 0x38210000, 0x38214000, 0x38218000, 0x3821c000,
+ 0x38220000, 0x38224000, 0x38228000, 0x3822c000, 0x38230000, 0x38234000, 0x38238000, 0x3823c000,
+ 0x38240000, 0x38244000, 0x38248000, 0x3824c000, 0x38250000, 0x38254000, 0x38258000, 0x3825c000,
+ 0x38260000, 0x38264000, 0x38268000, 0x3826c000, 0x38270000, 0x38274000, 0x38278000, 0x3827c000,
+ 0x38280000, 0x38284000, 0x38288000, 0x3828c000, 0x38290000, 0x38294000, 0x38298000, 0x3829c000,
+ 0x382a0000, 0x382a4000, 0x382a8000, 0x382ac000, 0x382b0000, 0x382b4000, 0x382b8000, 0x382bc000,
+ 0x382c0000, 0x382c4000, 0x382c8000, 0x382cc000, 0x382d0000, 0x382d4000, 0x382d8000, 0x382dc000,
+ 0x382e0000, 0x382e4000, 0x382e8000, 0x382ec000, 0x382f0000, 0x382f4000, 0x382f8000, 0x382fc000,
+ 0x38300000, 0x38304000, 0x38308000, 0x3830c000, 0x38310000, 0x38314000, 0x38318000, 0x3831c000,
+ 0x38320000, 0x38324000, 0x38328000, 0x3832c000, 0x38330000, 0x38334000, 0x38338000, 0x3833c000,
+ 0x38340000, 0x38344000, 0x38348000, 0x3834c000, 0x38350000, 0x38354000, 0x38358000, 0x3835c000,
+ 0x38360000, 0x38364000, 0x38368000, 0x3836c000, 0x38370000, 0x38374000, 0x38378000, 0x3837c000,
+ 0x38380000, 0x38384000, 0x38388000, 0x3838c000, 0x38390000, 0x38394000, 0x38398000, 0x3839c000,
+ 0x383a0000, 0x383a4000, 0x383a8000, 0x383ac000, 0x383b0000, 0x383b4000, 0x383b8000, 0x383bc000,
+ 0x383c0000, 0x383c4000, 0x383c8000, 0x383cc000, 0x383d0000, 0x383d4000, 0x383d8000, 0x383dc000,
+ 0x383e0000, 0x383e4000, 0x383e8000, 0x383ec000, 0x383f0000, 0x383f4000, 0x383f8000, 0x383fc000,
+ 0x38400000, 0x38404000, 0x38408000, 0x3840c000, 0x38410000, 0x38414000, 0x38418000, 0x3841c000,
+ 0x38420000, 0x38424000, 0x38428000, 0x3842c000, 0x38430000, 0x38434000, 0x38438000, 0x3843c000,
+ 0x38440000, 0x38444000, 0x38448000, 0x3844c000, 0x38450000, 0x38454000, 0x38458000, 0x3845c000,
+ 0x38460000, 0x38464000, 0x38468000, 0x3846c000, 0x38470000, 0x38474000, 0x38478000, 0x3847c000,
+ 0x38480000, 0x38484000, 0x38488000, 0x3848c000, 0x38490000, 0x38494000, 0x38498000, 0x3849c000,
+ 0x384a0000, 0x384a4000, 0x384a8000, 0x384ac000, 0x384b0000, 0x384b4000, 0x384b8000, 0x384bc000,
+ 0x384c0000, 0x384c4000, 0x384c8000, 0x384cc000, 0x384d0000, 0x384d4000, 0x384d8000, 0x384dc000,
+ 0x384e0000, 0x384e4000, 0x384e8000, 0x384ec000, 0x384f0000, 0x384f4000, 0x384f8000, 0x384fc000,
+ 0x38500000, 0x38504000, 0x38508000, 0x3850c000, 0x38510000, 0x38514000, 0x38518000, 0x3851c000,
+ 0x38520000, 0x38524000, 0x38528000, 0x3852c000, 0x38530000, 0x38534000, 0x38538000, 0x3853c000,
+ 0x38540000, 0x38544000, 0x38548000, 0x3854c000, 0x38550000, 0x38554000, 0x38558000, 0x3855c000,
+ 0x38560000, 0x38564000, 0x38568000, 0x3856c000, 0x38570000, 0x38574000, 0x38578000, 0x3857c000,
+ 0x38580000, 0x38584000, 0x38588000, 0x3858c000, 0x38590000, 0x38594000, 0x38598000, 0x3859c000,
+ 0x385a0000, 0x385a4000, 0x385a8000, 0x385ac000, 0x385b0000, 0x385b4000, 0x385b8000, 0x385bc000,
+ 0x385c0000, 0x385c4000, 0x385c8000, 0x385cc000, 0x385d0000, 0x385d4000, 0x385d8000, 0x385dc000,
+ 0x385e0000, 0x385e4000, 0x385e8000, 0x385ec000, 0x385f0000, 0x385f4000, 0x385f8000, 0x385fc000,
+ 0x38600000, 0x38604000, 0x38608000, 0x3860c000, 0x38610000, 0x38614000, 0x38618000, 0x3861c000,
+ 0x38620000, 0x38624000, 0x38628000, 0x3862c000, 0x38630000, 0x38634000, 0x38638000, 0x3863c000,
+ 0x38640000, 0x38644000, 0x38648000, 0x3864c000, 0x38650000, 0x38654000, 0x38658000, 0x3865c000,
+ 0x38660000, 0x38664000, 0x38668000, 0x3866c000, 0x38670000, 0x38674000, 0x38678000, 0x3867c000,
+ 0x38680000, 0x38684000, 0x38688000, 0x3868c000, 0x38690000, 0x38694000, 0x38698000, 0x3869c000,
+ 0x386a0000, 0x386a4000, 0x386a8000, 0x386ac000, 0x386b0000, 0x386b4000, 0x386b8000, 0x386bc000,
+ 0x386c0000, 0x386c4000, 0x386c8000, 0x386cc000, 0x386d0000, 0x386d4000, 0x386d8000, 0x386dc000,
+ 0x386e0000, 0x386e4000, 0x386e8000, 0x386ec000, 0x386f0000, 0x386f4000, 0x386f8000, 0x386fc000,
+ 0x38700000, 0x38704000, 0x38708000, 0x3870c000, 0x38710000, 0x38714000, 0x38718000, 0x3871c000,
+ 0x38720000, 0x38724000, 0x38728000, 0x3872c000, 0x38730000, 0x38734000, 0x38738000, 0x3873c000,
+ 0x38740000, 0x38744000, 0x38748000, 0x3874c000, 0x38750000, 0x38754000, 0x38758000, 0x3875c000,
+ 0x38760000, 0x38764000, 0x38768000, 0x3876c000, 0x38770000, 0x38774000, 0x38778000, 0x3877c000,
+ 0x38780000, 0x38784000, 0x38788000, 0x3878c000, 0x38790000, 0x38794000, 0x38798000, 0x3879c000,
+ 0x387a0000, 0x387a4000, 0x387a8000, 0x387ac000, 0x387b0000, 0x387b4000, 0x387b8000, 0x387bc000,
+ 0x387c0000, 0x387c4000, 0x387c8000, 0x387cc000, 0x387d0000, 0x387d4000, 0x387d8000, 0x387dc000,
+ 0x387e0000, 0x387e4000, 0x387e8000, 0x387ec000, 0x387f0000, 0x387f4000, 0x387f8000, 0x387fc000,
+ 0x38000000, 0x38002000, 0x38004000, 0x38006000, 0x38008000, 0x3800a000, 0x3800c000, 0x3800e000,
+ 0x38010000, 0x38012000, 0x38014000, 0x38016000, 0x38018000, 0x3801a000, 0x3801c000, 0x3801e000,
+ 0x38020000, 0x38022000, 0x38024000, 0x38026000, 0x38028000, 0x3802a000, 0x3802c000, 0x3802e000,
+ 0x38030000, 0x38032000, 0x38034000, 0x38036000, 0x38038000, 0x3803a000, 0x3803c000, 0x3803e000,
+ 0x38040000, 0x38042000, 0x38044000, 0x38046000, 0x38048000, 0x3804a000, 0x3804c000, 0x3804e000,
+ 0x38050000, 0x38052000, 0x38054000, 0x38056000, 0x38058000, 0x3805a000, 0x3805c000, 0x3805e000,
+ 0x38060000, 0x38062000, 0x38064000, 0x38066000, 0x38068000, 0x3806a000, 0x3806c000, 0x3806e000,
+ 0x38070000, 0x38072000, 0x38074000, 0x38076000, 0x38078000, 0x3807a000, 0x3807c000, 0x3807e000,
+ 0x38080000, 0x38082000, 0x38084000, 0x38086000, 0x38088000, 0x3808a000, 0x3808c000, 0x3808e000,
+ 0x38090000, 0x38092000, 0x38094000, 0x38096000, 0x38098000, 0x3809a000, 0x3809c000, 0x3809e000,
+ 0x380a0000, 0x380a2000, 0x380a4000, 0x380a6000, 0x380a8000, 0x380aa000, 0x380ac000, 0x380ae000,
+ 0x380b0000, 0x380b2000, 0x380b4000, 0x380b6000, 0x380b8000, 0x380ba000, 0x380bc000, 0x380be000,
+ 0x380c0000, 0x380c2000, 0x380c4000, 0x380c6000, 0x380c8000, 0x380ca000, 0x380cc000, 0x380ce000,
+ 0x380d0000, 0x380d2000, 0x380d4000, 0x380d6000, 0x380d8000, 0x380da000, 0x380dc000, 0x380de000,
+ 0x380e0000, 0x380e2000, 0x380e4000, 0x380e6000, 0x380e8000, 0x380ea000, 0x380ec000, 0x380ee000,
+ 0x380f0000, 0x380f2000, 0x380f4000, 0x380f6000, 0x380f8000, 0x380fa000, 0x380fc000, 0x380fe000,
+ 0x38100000, 0x38102000, 0x38104000, 0x38106000, 0x38108000, 0x3810a000, 0x3810c000, 0x3810e000,
+ 0x38110000, 0x38112000, 0x38114000, 0x38116000, 0x38118000, 0x3811a000, 0x3811c000, 0x3811e000,
+ 0x38120000, 0x38122000, 0x38124000, 0x38126000, 0x38128000, 0x3812a000, 0x3812c000, 0x3812e000,
+ 0x38130000, 0x38132000, 0x38134000, 0x38136000, 0x38138000, 0x3813a000, 0x3813c000, 0x3813e000,
+ 0x38140000, 0x38142000, 0x38144000, 0x38146000, 0x38148000, 0x3814a000, 0x3814c000, 0x3814e000,
+ 0x38150000, 0x38152000, 0x38154000, 0x38156000, 0x38158000, 0x3815a000, 0x3815c000, 0x3815e000,
+ 0x38160000, 0x38162000, 0x38164000, 0x38166000, 0x38168000, 0x3816a000, 0x3816c000, 0x3816e000,
+ 0x38170000, 0x38172000, 0x38174000, 0x38176000, 0x38178000, 0x3817a000, 0x3817c000, 0x3817e000,
+ 0x38180000, 0x38182000, 0x38184000, 0x38186000, 0x38188000, 0x3818a000, 0x3818c000, 0x3818e000,
+ 0x38190000, 0x38192000, 0x38194000, 0x38196000, 0x38198000, 0x3819a000, 0x3819c000, 0x3819e000,
+ 0x381a0000, 0x381a2000, 0x381a4000, 0x381a6000, 0x381a8000, 0x381aa000, 0x381ac000, 0x381ae000,
+ 0x381b0000, 0x381b2000, 0x381b4000, 0x381b6000, 0x381b8000, 0x381ba000, 0x381bc000, 0x381be000,
+ 0x381c0000, 0x381c2000, 0x381c4000, 0x381c6000, 0x381c8000, 0x381ca000, 0x381cc000, 0x381ce000,
+ 0x381d0000, 0x381d2000, 0x381d4000, 0x381d6000, 0x381d8000, 0x381da000, 0x381dc000, 0x381de000,
+ 0x381e0000, 0x381e2000, 0x381e4000, 0x381e6000, 0x381e8000, 0x381ea000, 0x381ec000, 0x381ee000,
+ 0x381f0000, 0x381f2000, 0x381f4000, 0x381f6000, 0x381f8000, 0x381fa000, 0x381fc000, 0x381fe000,
+ 0x38200000, 0x38202000, 0x38204000, 0x38206000, 0x38208000, 0x3820a000, 0x3820c000, 0x3820e000,
+ 0x38210000, 0x38212000, 0x38214000, 0x38216000, 0x38218000, 0x3821a000, 0x3821c000, 0x3821e000,
+ 0x38220000, 0x38222000, 0x38224000, 0x38226000, 0x38228000, 0x3822a000, 0x3822c000, 0x3822e000,
+ 0x38230000, 0x38232000, 0x38234000, 0x38236000, 0x38238000, 0x3823a000, 0x3823c000, 0x3823e000,
+ 0x38240000, 0x38242000, 0x38244000, 0x38246000, 0x38248000, 0x3824a000, 0x3824c000, 0x3824e000,
+ 0x38250000, 0x38252000, 0x38254000, 0x38256000, 0x38258000, 0x3825a000, 0x3825c000, 0x3825e000,
+ 0x38260000, 0x38262000, 0x38264000, 0x38266000, 0x38268000, 0x3826a000, 0x3826c000, 0x3826e000,
+ 0x38270000, 0x38272000, 0x38274000, 0x38276000, 0x38278000, 0x3827a000, 0x3827c000, 0x3827e000,
+ 0x38280000, 0x38282000, 0x38284000, 0x38286000, 0x38288000, 0x3828a000, 0x3828c000, 0x3828e000,
+ 0x38290000, 0x38292000, 0x38294000, 0x38296000, 0x38298000, 0x3829a000, 0x3829c000, 0x3829e000,
+ 0x382a0000, 0x382a2000, 0x382a4000, 0x382a6000, 0x382a8000, 0x382aa000, 0x382ac000, 0x382ae000,
+ 0x382b0000, 0x382b2000, 0x382b4000, 0x382b6000, 0x382b8000, 0x382ba000, 0x382bc000, 0x382be000,
+ 0x382c0000, 0x382c2000, 0x382c4000, 0x382c6000, 0x382c8000, 0x382ca000, 0x382cc000, 0x382ce000,
+ 0x382d0000, 0x382d2000, 0x382d4000, 0x382d6000, 0x382d8000, 0x382da000, 0x382dc000, 0x382de000,
+ 0x382e0000, 0x382e2000, 0x382e4000, 0x382e6000, 0x382e8000, 0x382ea000, 0x382ec000, 0x382ee000,
+ 0x382f0000, 0x382f2000, 0x382f4000, 0x382f6000, 0x382f8000, 0x382fa000, 0x382fc000, 0x382fe000,
+ 0x38300000, 0x38302000, 0x38304000, 0x38306000, 0x38308000, 0x3830a000, 0x3830c000, 0x3830e000,
+ 0x38310000, 0x38312000, 0x38314000, 0x38316000, 0x38318000, 0x3831a000, 0x3831c000, 0x3831e000,
+ 0x38320000, 0x38322000, 0x38324000, 0x38326000, 0x38328000, 0x3832a000, 0x3832c000, 0x3832e000,
+ 0x38330000, 0x38332000, 0x38334000, 0x38336000, 0x38338000, 0x3833a000, 0x3833c000, 0x3833e000,
+ 0x38340000, 0x38342000, 0x38344000, 0x38346000, 0x38348000, 0x3834a000, 0x3834c000, 0x3834e000,
+ 0x38350000, 0x38352000, 0x38354000, 0x38356000, 0x38358000, 0x3835a000, 0x3835c000, 0x3835e000,
+ 0x38360000, 0x38362000, 0x38364000, 0x38366000, 0x38368000, 0x3836a000, 0x3836c000, 0x3836e000,
+ 0x38370000, 0x38372000, 0x38374000, 0x38376000, 0x38378000, 0x3837a000, 0x3837c000, 0x3837e000,
+ 0x38380000, 0x38382000, 0x38384000, 0x38386000, 0x38388000, 0x3838a000, 0x3838c000, 0x3838e000,
+ 0x38390000, 0x38392000, 0x38394000, 0x38396000, 0x38398000, 0x3839a000, 0x3839c000, 0x3839e000,
+ 0x383a0000, 0x383a2000, 0x383a4000, 0x383a6000, 0x383a8000, 0x383aa000, 0x383ac000, 0x383ae000,
+ 0x383b0000, 0x383b2000, 0x383b4000, 0x383b6000, 0x383b8000, 0x383ba000, 0x383bc000, 0x383be000,
+ 0x383c0000, 0x383c2000, 0x383c4000, 0x383c6000, 0x383c8000, 0x383ca000, 0x383cc000, 0x383ce000,
+ 0x383d0000, 0x383d2000, 0x383d4000, 0x383d6000, 0x383d8000, 0x383da000, 0x383dc000, 0x383de000,
+ 0x383e0000, 0x383e2000, 0x383e4000, 0x383e6000, 0x383e8000, 0x383ea000, 0x383ec000, 0x383ee000,
+ 0x383f0000, 0x383f2000, 0x383f4000, 0x383f6000, 0x383f8000, 0x383fa000, 0x383fc000, 0x383fe000,
+ 0x38400000, 0x38402000, 0x38404000, 0x38406000, 0x38408000, 0x3840a000, 0x3840c000, 0x3840e000,
+ 0x38410000, 0x38412000, 0x38414000, 0x38416000, 0x38418000, 0x3841a000, 0x3841c000, 0x3841e000,
+ 0x38420000, 0x38422000, 0x38424000, 0x38426000, 0x38428000, 0x3842a000, 0x3842c000, 0x3842e000,
+ 0x38430000, 0x38432000, 0x38434000, 0x38436000, 0x38438000, 0x3843a000, 0x3843c000, 0x3843e000,
+ 0x38440000, 0x38442000, 0x38444000, 0x38446000, 0x38448000, 0x3844a000, 0x3844c000, 0x3844e000,
+ 0x38450000, 0x38452000, 0x38454000, 0x38456000, 0x38458000, 0x3845a000, 0x3845c000, 0x3845e000,
+ 0x38460000, 0x38462000, 0x38464000, 0x38466000, 0x38468000, 0x3846a000, 0x3846c000, 0x3846e000,
+ 0x38470000, 0x38472000, 0x38474000, 0x38476000, 0x38478000, 0x3847a000, 0x3847c000, 0x3847e000,
+ 0x38480000, 0x38482000, 0x38484000, 0x38486000, 0x38488000, 0x3848a000, 0x3848c000, 0x3848e000,
+ 0x38490000, 0x38492000, 0x38494000, 0x38496000, 0x38498000, 0x3849a000, 0x3849c000, 0x3849e000,
+ 0x384a0000, 0x384a2000, 0x384a4000, 0x384a6000, 0x384a8000, 0x384aa000, 0x384ac000, 0x384ae000,
+ 0x384b0000, 0x384b2000, 0x384b4000, 0x384b6000, 0x384b8000, 0x384ba000, 0x384bc000, 0x384be000,
+ 0x384c0000, 0x384c2000, 0x384c4000, 0x384c6000, 0x384c8000, 0x384ca000, 0x384cc000, 0x384ce000,
+ 0x384d0000, 0x384d2000, 0x384d4000, 0x384d6000, 0x384d8000, 0x384da000, 0x384dc000, 0x384de000,
+ 0x384e0000, 0x384e2000, 0x384e4000, 0x384e6000, 0x384e8000, 0x384ea000, 0x384ec000, 0x384ee000,
+ 0x384f0000, 0x384f2000, 0x384f4000, 0x384f6000, 0x384f8000, 0x384fa000, 0x384fc000, 0x384fe000,
+ 0x38500000, 0x38502000, 0x38504000, 0x38506000, 0x38508000, 0x3850a000, 0x3850c000, 0x3850e000,
+ 0x38510000, 0x38512000, 0x38514000, 0x38516000, 0x38518000, 0x3851a000, 0x3851c000, 0x3851e000,
+ 0x38520000, 0x38522000, 0x38524000, 0x38526000, 0x38528000, 0x3852a000, 0x3852c000, 0x3852e000,
+ 0x38530000, 0x38532000, 0x38534000, 0x38536000, 0x38538000, 0x3853a000, 0x3853c000, 0x3853e000,
+ 0x38540000, 0x38542000, 0x38544000, 0x38546000, 0x38548000, 0x3854a000, 0x3854c000, 0x3854e000,
+ 0x38550000, 0x38552000, 0x38554000, 0x38556000, 0x38558000, 0x3855a000, 0x3855c000, 0x3855e000,
+ 0x38560000, 0x38562000, 0x38564000, 0x38566000, 0x38568000, 0x3856a000, 0x3856c000, 0x3856e000,
+ 0x38570000, 0x38572000, 0x38574000, 0x38576000, 0x38578000, 0x3857a000, 0x3857c000, 0x3857e000,
+ 0x38580000, 0x38582000, 0x38584000, 0x38586000, 0x38588000, 0x3858a000, 0x3858c000, 0x3858e000,
+ 0x38590000, 0x38592000, 0x38594000, 0x38596000, 0x38598000, 0x3859a000, 0x3859c000, 0x3859e000,
+ 0x385a0000, 0x385a2000, 0x385a4000, 0x385a6000, 0x385a8000, 0x385aa000, 0x385ac000, 0x385ae000,
+ 0x385b0000, 0x385b2000, 0x385b4000, 0x385b6000, 0x385b8000, 0x385ba000, 0x385bc000, 0x385be000,
+ 0x385c0000, 0x385c2000, 0x385c4000, 0x385c6000, 0x385c8000, 0x385ca000, 0x385cc000, 0x385ce000,
+ 0x385d0000, 0x385d2000, 0x385d4000, 0x385d6000, 0x385d8000, 0x385da000, 0x385dc000, 0x385de000,
+ 0x385e0000, 0x385e2000, 0x385e4000, 0x385e6000, 0x385e8000, 0x385ea000, 0x385ec000, 0x385ee000,
+ 0x385f0000, 0x385f2000, 0x385f4000, 0x385f6000, 0x385f8000, 0x385fa000, 0x385fc000, 0x385fe000,
+ 0x38600000, 0x38602000, 0x38604000, 0x38606000, 0x38608000, 0x3860a000, 0x3860c000, 0x3860e000,
+ 0x38610000, 0x38612000, 0x38614000, 0x38616000, 0x38618000, 0x3861a000, 0x3861c000, 0x3861e000,
+ 0x38620000, 0x38622000, 0x38624000, 0x38626000, 0x38628000, 0x3862a000, 0x3862c000, 0x3862e000,
+ 0x38630000, 0x38632000, 0x38634000, 0x38636000, 0x38638000, 0x3863a000, 0x3863c000, 0x3863e000,
+ 0x38640000, 0x38642000, 0x38644000, 0x38646000, 0x38648000, 0x3864a000, 0x3864c000, 0x3864e000,
+ 0x38650000, 0x38652000, 0x38654000, 0x38656000, 0x38658000, 0x3865a000, 0x3865c000, 0x3865e000,
+ 0x38660000, 0x38662000, 0x38664000, 0x38666000, 0x38668000, 0x3866a000, 0x3866c000, 0x3866e000,
+ 0x38670000, 0x38672000, 0x38674000, 0x38676000, 0x38678000, 0x3867a000, 0x3867c000, 0x3867e000,
+ 0x38680000, 0x38682000, 0x38684000, 0x38686000, 0x38688000, 0x3868a000, 0x3868c000, 0x3868e000,
+ 0x38690000, 0x38692000, 0x38694000, 0x38696000, 0x38698000, 0x3869a000, 0x3869c000, 0x3869e000,
+ 0x386a0000, 0x386a2000, 0x386a4000, 0x386a6000, 0x386a8000, 0x386aa000, 0x386ac000, 0x386ae000,
+ 0x386b0000, 0x386b2000, 0x386b4000, 0x386b6000, 0x386b8000, 0x386ba000, 0x386bc000, 0x386be000,
+ 0x386c0000, 0x386c2000, 0x386c4000, 0x386c6000, 0x386c8000, 0x386ca000, 0x386cc000, 0x386ce000,
+ 0x386d0000, 0x386d2000, 0x386d4000, 0x386d6000, 0x386d8000, 0x386da000, 0x386dc000, 0x386de000,
+ 0x386e0000, 0x386e2000, 0x386e4000, 0x386e6000, 0x386e8000, 0x386ea000, 0x386ec000, 0x386ee000,
+ 0x386f0000, 0x386f2000, 0x386f4000, 0x386f6000, 0x386f8000, 0x386fa000, 0x386fc000, 0x386fe000,
+ 0x38700000, 0x38702000, 0x38704000, 0x38706000, 0x38708000, 0x3870a000, 0x3870c000, 0x3870e000,
+ 0x38710000, 0x38712000, 0x38714000, 0x38716000, 0x38718000, 0x3871a000, 0x3871c000, 0x3871e000,
+ 0x38720000, 0x38722000, 0x38724000, 0x38726000, 0x38728000, 0x3872a000, 0x3872c000, 0x3872e000,
+ 0x38730000, 0x38732000, 0x38734000, 0x38736000, 0x38738000, 0x3873a000, 0x3873c000, 0x3873e000,
+ 0x38740000, 0x38742000, 0x38744000, 0x38746000, 0x38748000, 0x3874a000, 0x3874c000, 0x3874e000,
+ 0x38750000, 0x38752000, 0x38754000, 0x38756000, 0x38758000, 0x3875a000, 0x3875c000, 0x3875e000,
+ 0x38760000, 0x38762000, 0x38764000, 0x38766000, 0x38768000, 0x3876a000, 0x3876c000, 0x3876e000,
+ 0x38770000, 0x38772000, 0x38774000, 0x38776000, 0x38778000, 0x3877a000, 0x3877c000, 0x3877e000,
+ 0x38780000, 0x38782000, 0x38784000, 0x38786000, 0x38788000, 0x3878a000, 0x3878c000, 0x3878e000,
+ 0x38790000, 0x38792000, 0x38794000, 0x38796000, 0x38798000, 0x3879a000, 0x3879c000, 0x3879e000,
+ 0x387a0000, 0x387a2000, 0x387a4000, 0x387a6000, 0x387a8000, 0x387aa000, 0x387ac000, 0x387ae000,
+ 0x387b0000, 0x387b2000, 0x387b4000, 0x387b6000, 0x387b8000, 0x387ba000, 0x387bc000, 0x387be000,
+ 0x387c0000, 0x387c2000, 0x387c4000, 0x387c6000, 0x387c8000, 0x387ca000, 0x387cc000, 0x387ce000,
+ 0x387d0000, 0x387d2000, 0x387d4000, 0x387d6000, 0x387d8000, 0x387da000, 0x387dc000, 0x387de000,
+ 0x387e0000, 0x387e2000, 0x387e4000, 0x387e6000, 0x387e8000, 0x387ea000, 0x387ec000, 0x387ee000,
+ 0x387f0000, 0x387f2000, 0x387f4000, 0x387f6000, 0x387f8000, 0x387fa000, 0x387fc000, 0x387fe000,
+};
+
+const static unsigned g_exponent[64] = {
+ 0x00000000, 0x00800000, 0x01000000, 0x01800000, 0x02000000, 0x02800000, 0x03000000, 0x03800000,
+ 0x04000000, 0x04800000, 0x05000000, 0x05800000, 0x06000000, 0x06800000, 0x07000000, 0x07800000,
+ 0x08000000, 0x08800000, 0x09000000, 0x09800000, 0x0a000000, 0x0a800000, 0x0b000000, 0x0b800000,
+ 0x0c000000, 0x0c800000, 0x0d000000, 0x0d800000, 0x0e000000, 0x0e800000, 0x0f000000, 0x47800000,
+ 0x80000000, 0x80800000, 0x81000000, 0x81800000, 0x82000000, 0x82800000, 0x83000000, 0x83800000,
+ 0x84000000, 0x84800000, 0x85000000, 0x85800000, 0x86000000, 0x86800000, 0x87000000, 0x87800000,
+ 0x88000000, 0x88800000, 0x89000000, 0x89800000, 0x8a000000, 0x8a800000, 0x8b000000, 0x8b800000,
+ 0x8c000000, 0x8c800000, 0x8d000000, 0x8d800000, 0x8e000000, 0x8e800000, 0x8f000000, 0xc7800000,
+};
+
+const static unsigned g_offset[64] = {
+ 0x00000000, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000000, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+ 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400, 0x00000400,
+};
+
+float float16ToFloat32(unsigned short h)
+{
+ unsigned i32 = g_mantissa[g_offset[h >> 10] + (h & 0x3ff)] + g_exponent[h >> 10];
+ return bitCast<float>(i32);
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/common/MemoryBuffer.cpp b/gfx/angle/checkout/src/common/MemoryBuffer.cpp
new file mode 100644
index 0000000000..5e57be225d
--- /dev/null
+++ b/gfx/angle/checkout/src/common/MemoryBuffer.cpp
@@ -0,0 +1,147 @@
+//
+// 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 "common/MemoryBuffer.h"
+
+#include <algorithm>
+#include <cstdlib>
+
+#include "common/debug.h"
+
+namespace angle
+{
+
+// MemoryBuffer implementation.
+MemoryBuffer::~MemoryBuffer()
+{
+ free(mData);
+ mData = nullptr;
+}
+
+bool MemoryBuffer::resize(size_t size)
+{
+ if (size == 0)
+ {
+ free(mData);
+ mData = nullptr;
+ mSize = 0;
+ return true;
+ }
+
+ if (size == mSize)
+ {
+ return true;
+ }
+
+ // Only reallocate if the size has changed.
+ uint8_t *newMemory = static_cast<uint8_t *>(malloc(sizeof(uint8_t) * size));
+ if (newMemory == nullptr)
+ {
+ return false;
+ }
+
+ if (mData)
+ {
+ // Copy the intersection of the old data and the new data
+ std::copy(mData, mData + std::min(mSize, size), newMemory);
+ free(mData);
+ }
+
+ mData = newMemory;
+ mSize = size;
+
+ return true;
+}
+
+void MemoryBuffer::fill(uint8_t datum)
+{
+ if (!empty())
+ {
+ std::fill(mData, mData + mSize, datum);
+ }
+}
+
+MemoryBuffer::MemoryBuffer(MemoryBuffer &&other) : MemoryBuffer()
+{
+ *this = std::move(other);
+}
+
+MemoryBuffer &MemoryBuffer::operator=(MemoryBuffer &&other)
+{
+ std::swap(mSize, other.mSize);
+ std::swap(mData, other.mData);
+ return *this;
+}
+
+// ScratchBuffer implementation.
+
+ScratchBuffer::ScratchBuffer(uint32_t lifetime) : mLifetime(lifetime), mResetCounter(lifetime) {}
+
+ScratchBuffer::~ScratchBuffer() {}
+
+bool ScratchBuffer::get(size_t requestedSize, MemoryBuffer **memoryBufferOut)
+{
+ return getImpl(requestedSize, memoryBufferOut, Optional<uint8_t>::Invalid());
+}
+
+bool ScratchBuffer::getInitialized(size_t requestedSize,
+ MemoryBuffer **memoryBufferOut,
+ uint8_t initValue)
+{
+ return getImpl(requestedSize, memoryBufferOut, Optional<uint8_t>(initValue));
+}
+
+bool ScratchBuffer::getImpl(size_t requestedSize,
+ MemoryBuffer **memoryBufferOut,
+ Optional<uint8_t> initValue)
+{
+ if (mScratchMemory.size() == requestedSize)
+ {
+ mResetCounter = mLifetime;
+ *memoryBufferOut = &mScratchMemory;
+ return true;
+ }
+
+ if (mScratchMemory.size() > requestedSize)
+ {
+ tick();
+ }
+
+ if (mResetCounter == 0 || mScratchMemory.size() < requestedSize)
+ {
+ mScratchMemory.resize(0);
+ if (!mScratchMemory.resize(requestedSize))
+ {
+ return false;
+ }
+ mResetCounter = mLifetime;
+ if (initValue.valid())
+ {
+ mScratchMemory.fill(initValue.value());
+ }
+ }
+
+ ASSERT(mScratchMemory.size() >= requestedSize);
+
+ *memoryBufferOut = &mScratchMemory;
+ return true;
+}
+
+void ScratchBuffer::tick()
+{
+ if (mResetCounter > 0)
+ {
+ --mResetCounter;
+ }
+}
+
+void ScratchBuffer::clear()
+{
+ mResetCounter = mLifetime;
+ mScratchMemory.resize(0);
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/MemoryBuffer.h b/gfx/angle/checkout/src/common/MemoryBuffer.h
new file mode 100644
index 0000000000..ae6b64c8c7
--- /dev/null
+++ b/gfx/angle/checkout/src/common/MemoryBuffer.h
@@ -0,0 +1,89 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMMON_MEMORYBUFFER_H_
+#define COMMON_MEMORYBUFFER_H_
+
+#include "common/Optional.h"
+#include "common/angleutils.h"
+#include "common/debug.h"
+
+#include <stdint.h>
+#include <cstddef>
+
+namespace angle
+{
+
+class MemoryBuffer final : NonCopyable
+{
+ public:
+ MemoryBuffer() = default;
+ MemoryBuffer(size_t size) { resize(size); }
+ ~MemoryBuffer();
+
+ MemoryBuffer(MemoryBuffer &&other);
+ MemoryBuffer &operator=(MemoryBuffer &&other);
+
+ bool resize(size_t size);
+ size_t size() const { return mSize; }
+ bool empty() const { return mSize == 0; }
+
+ const uint8_t *data() const { return mData; }
+ uint8_t *data()
+ {
+ ASSERT(mData);
+ return mData;
+ }
+
+ uint8_t &operator[](size_t pos)
+ {
+ ASSERT(pos < mSize);
+ return mData[pos];
+ }
+ const uint8_t &operator[](size_t pos) const
+ {
+ ASSERT(pos < mSize);
+ return mData[pos];
+ }
+
+ void fill(uint8_t datum);
+
+ private:
+ size_t mSize = 0;
+ uint8_t *mData = nullptr;
+};
+
+class ScratchBuffer final : NonCopyable
+{
+ public:
+ // If we request a scratch buffer requesting a smaller size this many times, release and
+ // recreate the scratch buffer. This ensures we don't have a degenerate case where we are stuck
+ // hogging memory.
+ ScratchBuffer(uint32_t lifetime);
+ ~ScratchBuffer();
+
+ // Returns true with a memory buffer of the requested size, or false on failure.
+ bool get(size_t requestedSize, MemoryBuffer **memoryBufferOut);
+
+ // Same as get, but ensures new values are initialized to a fixed constant.
+ bool getInitialized(size_t requestedSize, MemoryBuffer **memoryBufferOut, uint8_t initValue);
+
+ // Ticks the release counter for the scratch buffer. Also done implicitly in get().
+ void tick();
+
+ void clear();
+
+ private:
+ bool getImpl(size_t requestedSize, MemoryBuffer **memoryBufferOut, Optional<uint8_t> initValue);
+
+ const uint32_t mLifetime;
+ uint32_t mResetCounter;
+ MemoryBuffer mScratchMemory;
+};
+
+} // namespace angle
+
+#endif // COMMON_MEMORYBUFFER_H_
diff --git a/gfx/angle/checkout/src/common/Optional.h b/gfx/angle/checkout/src/common/Optional.h
new file mode 100644
index 0000000000..822de4de51
--- /dev/null
+++ b/gfx/angle/checkout/src/common/Optional.h
@@ -0,0 +1,68 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Optional.h:
+// Represents a type that may be invalid, similar to std::optional.
+//
+
+#ifndef COMMON_OPTIONAL_H_
+#define COMMON_OPTIONAL_H_
+
+#include <utility>
+
+template <class T>
+struct Optional
+{
+ Optional() : mValid(false), mValue(T()) {}
+
+ Optional(const T &valueIn) : mValid(true), mValue(valueIn) {}
+
+ Optional(const Optional &other) : mValid(other.mValid), mValue(other.mValue) {}
+
+ Optional &operator=(const Optional &other)
+ {
+ this->mValid = other.mValid;
+ this->mValue = other.mValue;
+ return *this;
+ }
+
+ Optional &operator=(const T &value)
+ {
+ mValue = value;
+ mValid = true;
+ return *this;
+ }
+
+ Optional &operator=(T &&value)
+ {
+ mValue = std::move(value);
+ mValid = true;
+ return *this;
+ }
+
+ void reset() { mValid = false; }
+
+ static Optional Invalid() { return Optional(); }
+
+ bool valid() const { return mValid; }
+ const T &value() const { return mValue; }
+
+ bool operator==(const Optional &other) const
+ {
+ return ((mValid == other.mValid) && (!mValid || (mValue == other.mValue)));
+ }
+
+ bool operator!=(const Optional &other) const { return !(*this == other); }
+
+ bool operator==(const T &value) const { return mValid && (mValue == value); }
+
+ bool operator!=(const T &value) const { return !(*this == value); }
+
+ private:
+ bool mValid;
+ T mValue;
+};
+
+#endif // COMMON_OPTIONAL_H_
diff --git a/gfx/angle/checkout/src/common/PackedEGLEnums_autogen.cpp b/gfx/angle/checkout/src/common/PackedEGLEnums_autogen.cpp
new file mode 100644
index 0000000000..6637335b76
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PackedEGLEnums_autogen.cpp
@@ -0,0 +1,355 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_packed_gl_enums.py using data from packed_egl_enums.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PackedEGLEnums_autogen.cpp:
+// Implements ANGLE-specific enums classes for EGLenums and functions operating
+// on them.
+
+#include "common/PackedEGLEnums_autogen.h"
+#include "common/debug.h"
+
+namespace egl
+{
+
+template <>
+CompositorTiming FromEGLenum<CompositorTiming>(EGLenum from)
+{
+ switch (from)
+ {
+ case EGL_COMPOSITE_DEADLINE_ANDROID:
+ return CompositorTiming::CompositeDeadline;
+ case EGL_COMPOSITE_INTERVAL_ANDROID:
+ return CompositorTiming::CompositInterval;
+ case EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID:
+ return CompositorTiming::CompositToPresentLatency;
+ default:
+ return CompositorTiming::InvalidEnum;
+ }
+}
+
+EGLenum ToEGLenum(CompositorTiming from)
+{
+ switch (from)
+ {
+ case CompositorTiming::CompositeDeadline:
+ return EGL_COMPOSITE_DEADLINE_ANDROID;
+ case CompositorTiming::CompositInterval:
+ return EGL_COMPOSITE_INTERVAL_ANDROID;
+ case CompositorTiming::CompositToPresentLatency:
+ return EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, CompositorTiming value)
+{
+ switch (value)
+ {
+ case CompositorTiming::CompositeDeadline:
+ os << "EGL_COMPOSITE_DEADLINE_ANDROID";
+ break;
+ case CompositorTiming::CompositInterval:
+ os << "EGL_COMPOSITE_INTERVAL_ANDROID";
+ break;
+ case CompositorTiming::CompositToPresentLatency:
+ os << "EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+MessageType FromEGLenum<MessageType>(EGLenum from)
+{
+ switch (from)
+ {
+ case EGL_DEBUG_MSG_CRITICAL_KHR:
+ return MessageType::Critical;
+ case EGL_DEBUG_MSG_ERROR_KHR:
+ return MessageType::Error;
+ case EGL_DEBUG_MSG_WARN_KHR:
+ return MessageType::Warn;
+ case EGL_DEBUG_MSG_INFO_KHR:
+ return MessageType::Info;
+ default:
+ return MessageType::InvalidEnum;
+ }
+}
+
+EGLenum ToEGLenum(MessageType from)
+{
+ switch (from)
+ {
+ case MessageType::Critical:
+ return EGL_DEBUG_MSG_CRITICAL_KHR;
+ case MessageType::Error:
+ return EGL_DEBUG_MSG_ERROR_KHR;
+ case MessageType::Warn:
+ return EGL_DEBUG_MSG_WARN_KHR;
+ case MessageType::Info:
+ return EGL_DEBUG_MSG_INFO_KHR;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, MessageType value)
+{
+ switch (value)
+ {
+ case MessageType::Critical:
+ os << "EGL_DEBUG_MSG_CRITICAL_KHR";
+ break;
+ case MessageType::Error:
+ os << "EGL_DEBUG_MSG_ERROR_KHR";
+ break;
+ case MessageType::Warn:
+ os << "EGL_DEBUG_MSG_WARN_KHR";
+ break;
+ case MessageType::Info:
+ os << "EGL_DEBUG_MSG_INFO_KHR";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+ObjectType FromEGLenum<ObjectType>(EGLenum from)
+{
+ switch (from)
+ {
+ case EGL_OBJECT_THREAD_KHR:
+ return ObjectType::Thread;
+ case EGL_OBJECT_DISPLAY_KHR:
+ return ObjectType::Display;
+ case EGL_OBJECT_CONTEXT_KHR:
+ return ObjectType::Context;
+ case EGL_OBJECT_SURFACE_KHR:
+ return ObjectType::Surface;
+ case EGL_OBJECT_IMAGE_KHR:
+ return ObjectType::Image;
+ case EGL_OBJECT_SYNC_KHR:
+ return ObjectType::Sync;
+ case EGL_OBJECT_STREAM_KHR:
+ return ObjectType::Stream;
+ default:
+ return ObjectType::InvalidEnum;
+ }
+}
+
+EGLenum ToEGLenum(ObjectType from)
+{
+ switch (from)
+ {
+ case ObjectType::Thread:
+ return EGL_OBJECT_THREAD_KHR;
+ case ObjectType::Display:
+ return EGL_OBJECT_DISPLAY_KHR;
+ case ObjectType::Context:
+ return EGL_OBJECT_CONTEXT_KHR;
+ case ObjectType::Surface:
+ return EGL_OBJECT_SURFACE_KHR;
+ case ObjectType::Image:
+ return EGL_OBJECT_IMAGE_KHR;
+ case ObjectType::Sync:
+ return EGL_OBJECT_SYNC_KHR;
+ case ObjectType::Stream:
+ return EGL_OBJECT_STREAM_KHR;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, ObjectType value)
+{
+ switch (value)
+ {
+ case ObjectType::Thread:
+ os << "EGL_OBJECT_THREAD_KHR";
+ break;
+ case ObjectType::Display:
+ os << "EGL_OBJECT_DISPLAY_KHR";
+ break;
+ case ObjectType::Context:
+ os << "EGL_OBJECT_CONTEXT_KHR";
+ break;
+ case ObjectType::Surface:
+ os << "EGL_OBJECT_SURFACE_KHR";
+ break;
+ case ObjectType::Image:
+ os << "EGL_OBJECT_IMAGE_KHR";
+ break;
+ case ObjectType::Sync:
+ os << "EGL_OBJECT_SYNC_KHR";
+ break;
+ case ObjectType::Stream:
+ os << "EGL_OBJECT_STREAM_KHR";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureFormat FromEGLenum<TextureFormat>(EGLenum from)
+{
+ switch (from)
+ {
+ case EGL_NO_TEXTURE:
+ return TextureFormat::NoTexture;
+ case EGL_TEXTURE_RGB:
+ return TextureFormat::RGB;
+ case EGL_TEXTURE_RGBA:
+ return TextureFormat::RGBA;
+ default:
+ return TextureFormat::InvalidEnum;
+ }
+}
+
+EGLenum ToEGLenum(TextureFormat from)
+{
+ switch (from)
+ {
+ case TextureFormat::NoTexture:
+ return EGL_NO_TEXTURE;
+ case TextureFormat::RGB:
+ return EGL_TEXTURE_RGB;
+ case TextureFormat::RGBA:
+ return EGL_TEXTURE_RGBA;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureFormat value)
+{
+ switch (value)
+ {
+ case TextureFormat::NoTexture:
+ os << "EGL_NO_TEXTURE";
+ break;
+ case TextureFormat::RGB:
+ os << "EGL_TEXTURE_RGB";
+ break;
+ case TextureFormat::RGBA:
+ os << "EGL_TEXTURE_RGBA";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+Timestamp FromEGLenum<Timestamp>(EGLenum from)
+{
+ switch (from)
+ {
+ case EGL_REQUESTED_PRESENT_TIME_ANDROID:
+ return Timestamp::RequestedPresentTime;
+ case EGL_RENDERING_COMPLETE_TIME_ANDROID:
+ return Timestamp::RenderingCompleteTime;
+ case EGL_COMPOSITION_LATCH_TIME_ANDROID:
+ return Timestamp::CompositionLatchTime;
+ case EGL_FIRST_COMPOSITION_START_TIME_ANDROID:
+ return Timestamp::FirstCompositionStartTime;
+ case EGL_LAST_COMPOSITION_START_TIME_ANDROID:
+ return Timestamp::LastCompositionStartTime;
+ case EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID:
+ return Timestamp::FirstCompositionGPUFinishedTime;
+ case EGL_DISPLAY_PRESENT_TIME_ANDROID:
+ return Timestamp::DisplayPresentTime;
+ case EGL_DEQUEUE_READY_TIME_ANDROID:
+ return Timestamp::DequeueReadyTime;
+ case EGL_READS_DONE_TIME_ANDROID:
+ return Timestamp::ReadsDoneTime;
+ default:
+ return Timestamp::InvalidEnum;
+ }
+}
+
+EGLenum ToEGLenum(Timestamp from)
+{
+ switch (from)
+ {
+ case Timestamp::RequestedPresentTime:
+ return EGL_REQUESTED_PRESENT_TIME_ANDROID;
+ case Timestamp::RenderingCompleteTime:
+ return EGL_RENDERING_COMPLETE_TIME_ANDROID;
+ case Timestamp::CompositionLatchTime:
+ return EGL_COMPOSITION_LATCH_TIME_ANDROID;
+ case Timestamp::FirstCompositionStartTime:
+ return EGL_FIRST_COMPOSITION_START_TIME_ANDROID;
+ case Timestamp::LastCompositionStartTime:
+ return EGL_LAST_COMPOSITION_START_TIME_ANDROID;
+ case Timestamp::FirstCompositionGPUFinishedTime:
+ return EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID;
+ case Timestamp::DisplayPresentTime:
+ return EGL_DISPLAY_PRESENT_TIME_ANDROID;
+ case Timestamp::DequeueReadyTime:
+ return EGL_DEQUEUE_READY_TIME_ANDROID;
+ case Timestamp::ReadsDoneTime:
+ return EGL_READS_DONE_TIME_ANDROID;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, Timestamp value)
+{
+ switch (value)
+ {
+ case Timestamp::RequestedPresentTime:
+ os << "EGL_REQUESTED_PRESENT_TIME_ANDROID";
+ break;
+ case Timestamp::RenderingCompleteTime:
+ os << "EGL_RENDERING_COMPLETE_TIME_ANDROID";
+ break;
+ case Timestamp::CompositionLatchTime:
+ os << "EGL_COMPOSITION_LATCH_TIME_ANDROID";
+ break;
+ case Timestamp::FirstCompositionStartTime:
+ os << "EGL_FIRST_COMPOSITION_START_TIME_ANDROID";
+ break;
+ case Timestamp::LastCompositionStartTime:
+ os << "EGL_LAST_COMPOSITION_START_TIME_ANDROID";
+ break;
+ case Timestamp::FirstCompositionGPUFinishedTime:
+ os << "EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID";
+ break;
+ case Timestamp::DisplayPresentTime:
+ os << "EGL_DISPLAY_PRESENT_TIME_ANDROID";
+ break;
+ case Timestamp::DequeueReadyTime:
+ os << "EGL_DEQUEUE_READY_TIME_ANDROID";
+ break;
+ case Timestamp::ReadsDoneTime:
+ os << "EGL_READS_DONE_TIME_ANDROID";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/common/PackedEGLEnums_autogen.h b/gfx/angle/checkout/src/common/PackedEGLEnums_autogen.h
new file mode 100644
index 0000000000..fc236bfdd0
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PackedEGLEnums_autogen.h
@@ -0,0 +1,116 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_packed_gl_enums.py using data from packed_egl_enums.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PackedEGLEnums_autogen.h:
+// Declares ANGLE-specific enums classes for EGLenums and functions operating
+// on them.
+
+#ifndef COMMON_PACKEDEGLENUMS_AUTOGEN_H_
+#define COMMON_PACKEDEGLENUMS_AUTOGEN_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <angle_gl.h>
+
+#include <cstdint>
+#include <ostream>
+
+namespace egl
+{
+
+template <typename Enum>
+Enum FromEGLenum(EGLenum from);
+
+enum class CompositorTiming : uint8_t
+{
+ CompositeDeadline = 0,
+ CompositInterval = 1,
+ CompositToPresentLatency = 2,
+
+ InvalidEnum = 3,
+ EnumCount = 3,
+};
+
+template <>
+CompositorTiming FromEGLenum<CompositorTiming>(EGLenum from);
+EGLenum ToEGLenum(CompositorTiming from);
+std::ostream &operator<<(std::ostream &os, CompositorTiming value);
+
+enum class MessageType : uint8_t
+{
+ Critical = 0,
+ Error = 1,
+ Warn = 2,
+ Info = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+template <>
+MessageType FromEGLenum<MessageType>(EGLenum from);
+EGLenum ToEGLenum(MessageType from);
+std::ostream &operator<<(std::ostream &os, MessageType value);
+
+enum class ObjectType : uint8_t
+{
+ Thread = 0,
+ Display = 1,
+ Context = 2,
+ Surface = 3,
+ Image = 4,
+ Sync = 5,
+ Stream = 6,
+
+ InvalidEnum = 7,
+ EnumCount = 7,
+};
+
+template <>
+ObjectType FromEGLenum<ObjectType>(EGLenum from);
+EGLenum ToEGLenum(ObjectType from);
+std::ostream &operator<<(std::ostream &os, ObjectType value);
+
+enum class TextureFormat : uint8_t
+{
+ NoTexture = 0,
+ RGB = 1,
+ RGBA = 2,
+
+ InvalidEnum = 3,
+ EnumCount = 3,
+};
+
+template <>
+TextureFormat FromEGLenum<TextureFormat>(EGLenum from);
+EGLenum ToEGLenum(TextureFormat from);
+std::ostream &operator<<(std::ostream &os, TextureFormat value);
+
+enum class Timestamp : uint8_t
+{
+ RequestedPresentTime = 0,
+ RenderingCompleteTime = 1,
+ CompositionLatchTime = 2,
+ FirstCompositionStartTime = 3,
+ LastCompositionStartTime = 4,
+ FirstCompositionGPUFinishedTime = 5,
+ DisplayPresentTime = 6,
+ DequeueReadyTime = 7,
+ ReadsDoneTime = 8,
+
+ InvalidEnum = 9,
+ EnumCount = 9,
+};
+
+template <>
+Timestamp FromEGLenum<Timestamp>(EGLenum from);
+EGLenum ToEGLenum(Timestamp from);
+std::ostream &operator<<(std::ostream &os, Timestamp value);
+
+} // namespace egl
+
+#endif // COMMON_PACKEDEGLENUMS_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/common/PackedEnums.cpp b/gfx/angle/checkout/src/common/PackedEnums.cpp
new file mode 100644
index 0000000000..9f219b8200
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PackedEnums.cpp
@@ -0,0 +1,367 @@
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PackedGLEnums.cpp:
+// Declares ANGLE-specific enums classes for GLEnum and functions operating
+// on them.
+
+#include "common/PackedEnums.h"
+
+#include "common/utilities.h"
+
+namespace gl
+{
+
+TextureType TextureTargetToType(TextureTarget target)
+{
+ switch (target)
+ {
+ case TextureTarget::CubeMapNegativeX:
+ case TextureTarget::CubeMapNegativeY:
+ case TextureTarget::CubeMapNegativeZ:
+ case TextureTarget::CubeMapPositiveX:
+ case TextureTarget::CubeMapPositiveY:
+ case TextureTarget::CubeMapPositiveZ:
+ return TextureType::CubeMap;
+ case TextureTarget::External:
+ return TextureType::External;
+ case TextureTarget::Rectangle:
+ return TextureType::Rectangle;
+ case TextureTarget::_2D:
+ return TextureType::_2D;
+ case TextureTarget::_2DArray:
+ return TextureType::_2DArray;
+ case TextureTarget::_2DMultisample:
+ return TextureType::_2DMultisample;
+ case TextureTarget::_2DMultisampleArray:
+ return TextureType::_2DMultisampleArray;
+ case TextureTarget::_3D:
+ return TextureType::_3D;
+ case TextureTarget::InvalidEnum:
+ return TextureType::InvalidEnum;
+ default:
+ UNREACHABLE();
+ return TextureType::InvalidEnum;
+ }
+}
+
+bool IsCubeMapFaceTarget(TextureTarget target)
+{
+ return TextureTargetToType(target) == TextureType::CubeMap;
+}
+
+TextureTarget NonCubeTextureTypeToTarget(TextureType type)
+{
+ switch (type)
+ {
+ case TextureType::External:
+ return TextureTarget::External;
+ case TextureType::Rectangle:
+ return TextureTarget::Rectangle;
+ case TextureType::_2D:
+ return TextureTarget::_2D;
+ case TextureType::_2DArray:
+ return TextureTarget::_2DArray;
+ case TextureType::_2DMultisample:
+ return TextureTarget::_2DMultisample;
+ case TextureType::_2DMultisampleArray:
+ return TextureTarget::_2DMultisampleArray;
+ case TextureType::_3D:
+ return TextureTarget::_3D;
+ default:
+ UNREACHABLE();
+ return TextureTarget::InvalidEnum;
+ }
+}
+
+// Check that we can do arithmetic on TextureTarget to convert from / to cube map faces
+static_assert(static_cast<uint8_t>(TextureTarget::CubeMapNegativeX) -
+ static_cast<uint8_t>(TextureTarget::CubeMapPositiveX) ==
+ 1u,
+ "");
+static_assert(static_cast<uint8_t>(TextureTarget::CubeMapPositiveY) -
+ static_cast<uint8_t>(TextureTarget::CubeMapPositiveX) ==
+ 2u,
+ "");
+static_assert(static_cast<uint8_t>(TextureTarget::CubeMapNegativeY) -
+ static_cast<uint8_t>(TextureTarget::CubeMapPositiveX) ==
+ 3u,
+ "");
+static_assert(static_cast<uint8_t>(TextureTarget::CubeMapPositiveZ) -
+ static_cast<uint8_t>(TextureTarget::CubeMapPositiveX) ==
+ 4u,
+ "");
+static_assert(static_cast<uint8_t>(TextureTarget::CubeMapNegativeZ) -
+ static_cast<uint8_t>(TextureTarget::CubeMapPositiveX) ==
+ 5u,
+ "");
+
+TextureTarget CubeFaceIndexToTextureTarget(size_t face)
+{
+ ASSERT(face < 6u);
+ return static_cast<TextureTarget>(static_cast<uint8_t>(TextureTarget::CubeMapPositiveX) + face);
+}
+
+size_t CubeMapTextureTargetToFaceIndex(TextureTarget target)
+{
+ ASSERT(IsCubeMapFaceTarget(target));
+ return static_cast<uint8_t>(target) - static_cast<uint8_t>(TextureTarget::CubeMapPositiveX);
+}
+
+TextureType SamplerTypeToTextureType(GLenum samplerType)
+{
+ switch (samplerType)
+ {
+ case GL_SAMPLER_2D:
+ case GL_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_SAMPLER_2D_SHADOW:
+ return TextureType::_2D;
+
+ case GL_SAMPLER_EXTERNAL_OES:
+ return TextureType::External;
+
+ case GL_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_SAMPLER_CUBE_SHADOW:
+ return TextureType::CubeMap;
+
+ 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 TextureType::_2DArray;
+
+ case GL_SAMPLER_3D:
+ case GL_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ return TextureType::_3D;
+
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ return TextureType::_2DMultisample;
+
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ return TextureType::_2DMultisampleArray;
+
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ return TextureType::Rectangle;
+
+ default:
+ UNREACHABLE();
+ return TextureType::InvalidEnum;
+ }
+}
+
+bool IsMultisampled(gl::TextureType type)
+{
+ switch (type)
+ {
+ case gl::TextureType::_2DMultisample:
+ case gl::TextureType::_2DMultisampleArray:
+ return true;
+ default:
+ return false;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, PrimitiveMode value)
+{
+ switch (value)
+ {
+ case PrimitiveMode::LineLoop:
+ os << "GL_LINE_LOOP";
+ break;
+ case PrimitiveMode::Lines:
+ os << "GL_LINES";
+ break;
+ case PrimitiveMode::LinesAdjacency:
+ os << "GL_LINES_ADJACENCY";
+ break;
+ case PrimitiveMode::LineStrip:
+ os << "GL_LINE_STRIP";
+ break;
+ case PrimitiveMode::LineStripAdjacency:
+ os << "GL_LINE_STRIP_ADJANCENCY";
+ break;
+ case PrimitiveMode::Points:
+ os << "GL_POINTS";
+ break;
+ case PrimitiveMode::TriangleFan:
+ os << "GL_TRIANGLE_FAN";
+ break;
+ case PrimitiveMode::Triangles:
+ os << "GL_TRIANGLES";
+ break;
+ case PrimitiveMode::TrianglesAdjacency:
+ os << "GL_TRIANGLES_ADJANCENCY";
+ break;
+ case PrimitiveMode::TriangleStrip:
+ os << "GL_TRIANGLE_STRIP";
+ break;
+ case PrimitiveMode::TriangleStripAdjacency:
+ os << "GL_TRIANGLE_STRIP_ADJACENCY";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+std::ostream &operator<<(std::ostream &os, DrawElementsType value)
+{
+ switch (value)
+ {
+ case DrawElementsType::UnsignedByte:
+ os << "GL_UNSIGNED_BYTE";
+ break;
+ case DrawElementsType::UnsignedShort:
+ os << "GL_UNSIGNED_SHORT";
+ break;
+ case DrawElementsType::UnsignedInt:
+ os << "GL_UNSIGNED_INT";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+
+ return os;
+}
+
+std::ostream &operator<<(std::ostream &os, VertexAttribType value)
+{
+ switch (value)
+ {
+ case VertexAttribType::Byte:
+ os << "GL_UNSIGNED_BYTE";
+ break;
+ case VertexAttribType::Fixed:
+ os << "GL_FIXED";
+ break;
+ case VertexAttribType::Float:
+ os << "GL_FLOAT";
+ break;
+ case VertexAttribType::HalfFloat:
+ os << "GL_HALF_FLOAT";
+ break;
+ case VertexAttribType::Int:
+ os << "GL_INT";
+ break;
+ case VertexAttribType::Int2101010:
+ os << "GL_INT_10_10_10_2";
+ break;
+ case VertexAttribType::Short:
+ os << "GL_SHORT";
+ break;
+ case VertexAttribType::UnsignedByte:
+ os << "GL_UNSIGNED_BYTE";
+ break;
+ case VertexAttribType::UnsignedInt:
+ os << "GL_UNSIGNED_INT";
+ break;
+ case VertexAttribType::UnsignedInt2101010:
+ os << "GL_UNSIGNED_INT_10_10_10_2";
+ break;
+ case VertexAttribType::UnsignedShort:
+ os << "GL_UNSIGNED_SHORT";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+} // namespace gl
+
+namespace egl
+{
+MessageType ErrorCodeToMessageType(EGLint errorCode)
+{
+ switch (errorCode)
+ {
+ case EGL_BAD_ALLOC:
+ case EGL_CONTEXT_LOST:
+ case EGL_NOT_INITIALIZED:
+ return MessageType::Critical;
+
+ case EGL_BAD_ACCESS:
+ case EGL_BAD_ATTRIBUTE:
+ case EGL_BAD_CONFIG:
+ case EGL_BAD_CONTEXT:
+ case EGL_BAD_CURRENT_SURFACE:
+ case EGL_BAD_DISPLAY:
+ case EGL_BAD_MATCH:
+ case EGL_BAD_NATIVE_PIXMAP:
+ case EGL_BAD_NATIVE_WINDOW:
+ case EGL_BAD_PARAMETER:
+ case EGL_BAD_SURFACE:
+ case EGL_BAD_STREAM_KHR:
+ case EGL_BAD_STATE_KHR:
+ case EGL_BAD_DEVICE_EXT:
+ return MessageType::Error;
+
+ case EGL_SUCCESS:
+ default:
+ UNREACHABLE();
+ return MessageType::InvalidEnum;
+ }
+}
+} // namespace egl
+
+namespace egl_gl
+{
+
+gl::TextureTarget EGLCubeMapTargetToCubeMapTarget(EGLenum eglTarget)
+{
+ ASSERT(egl::IsCubeMapTextureTarget(eglTarget));
+ return gl::CubeFaceIndexToTextureTarget(egl::CubeMapTextureTargetToLayerIndex(eglTarget));
+}
+
+gl::TextureTarget EGLImageTargetToTextureTarget(EGLenum eglTarget)
+{
+ switch (eglTarget)
+ {
+ case EGL_GL_TEXTURE_2D_KHR:
+ return gl::TextureTarget::_2D;
+
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
+ return EGLCubeMapTargetToCubeMapTarget(eglTarget);
+
+ case EGL_GL_TEXTURE_3D_KHR:
+ return gl::TextureTarget::_3D;
+
+ default:
+ UNREACHABLE();
+ return gl::TextureTarget::InvalidEnum;
+ }
+}
+
+gl::TextureType EGLTextureTargetToTextureType(EGLenum eglTarget)
+{
+ switch (eglTarget)
+ {
+ case EGL_TEXTURE_2D:
+ return gl::TextureType::_2D;
+
+ case EGL_TEXTURE_RECTANGLE_ANGLE:
+ return gl::TextureType::Rectangle;
+
+ default:
+ UNREACHABLE();
+ return gl::TextureType::InvalidEnum;
+ }
+}
+
+} // namespace egl_gl
diff --git a/gfx/angle/checkout/src/common/PackedEnums.h b/gfx/angle/checkout/src/common/PackedEnums.h
new file mode 100644
index 0000000000..ad6a313a14
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PackedEnums.h
@@ -0,0 +1,390 @@
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PackedGLEnums_autogen.h:
+// Declares ANGLE-specific enums classes for GLEnum and functions operating
+// on them.
+
+#ifndef COMMON_PACKEDGLENUMS_H_
+#define COMMON_PACKEDGLENUMS_H_
+
+#include "common/PackedEGLEnums_autogen.h"
+#include "common/PackedGLEnums_autogen.h"
+
+#include <array>
+#include <bitset>
+#include <cstddef>
+
+#include <EGL/egl.h>
+
+#include "common/bitset_utils.h"
+
+namespace angle
+{
+
+// Return the number of elements of a packed enum, including the InvalidEnum element.
+template <typename E>
+constexpr size_t EnumSize()
+{
+ using UnderlyingType = typename std::underlying_type<E>::type;
+ return static_cast<UnderlyingType>(E::EnumCount);
+}
+
+// Implementation of AllEnums which allows iterating over all the possible values for a packed enums
+// like so:
+// for (auto value : AllEnums<MyPackedEnum>()) {
+// // Do something with the enum.
+// }
+
+template <typename E>
+class EnumIterator final
+{
+ private:
+ using UnderlyingType = typename std::underlying_type<E>::type;
+
+ public:
+ EnumIterator(E value) : mValue(static_cast<UnderlyingType>(value)) {}
+ EnumIterator &operator++()
+ {
+ mValue++;
+ return *this;
+ }
+ bool operator==(const EnumIterator &other) const { return mValue == other.mValue; }
+ bool operator!=(const EnumIterator &other) const { return mValue != other.mValue; }
+ E operator*() const { return static_cast<E>(mValue); }
+
+ private:
+ UnderlyingType mValue;
+};
+
+template <typename E>
+struct AllEnums
+{
+ EnumIterator<E> begin() const { return {static_cast<E>(0)}; }
+ EnumIterator<E> end() const { return {E::InvalidEnum}; }
+};
+
+// PackedEnumMap<E, T> is like an std::array<T, E::EnumCount> but is indexed with enum values. It
+// implements all of the std::array interface except with enum values instead of indices.
+template <typename E, typename T, size_t MaxSize = EnumSize<E>()>
+class PackedEnumMap
+{
+ using UnderlyingType = typename std::underlying_type<E>::type;
+ using Storage = std::array<T, MaxSize>;
+
+ public:
+ using InitPair = std::pair<E, T>;
+
+ constexpr PackedEnumMap() = default;
+
+ constexpr PackedEnumMap(std::initializer_list<InitPair> init) : mPrivateData{}
+ {
+ // We use a for loop instead of range-for to work around a limitation in MSVC.
+ for (const InitPair *it = init.begin(); it != init.end(); ++it)
+ {
+ // This horrible const_cast pattern is necessary to work around a constexpr limitation.
+ // See https://stackoverflow.com/q/34199774/ . Note that it should be fixed with C++17.
+ const_cast<T &>(const_cast<const Storage &>(
+ mPrivateData)[static_cast<UnderlyingType>(it->first)]) = it->second;
+ }
+ }
+
+ // types:
+ using value_type = T;
+ using pointer = T *;
+ using const_pointer = const T *;
+ using reference = T &;
+ using const_reference = const T &;
+
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+
+ using iterator = typename Storage::iterator;
+ using const_iterator = typename Storage::const_iterator;
+ using reverse_iterator = std::reverse_iterator<iterator>;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
+ // No explicit construct/copy/destroy for aggregate type
+ void fill(const T &u) { mPrivateData.fill(u); }
+ void swap(PackedEnumMap<E, T> &a) noexcept { mPrivateData.swap(a.mPrivateData); }
+
+ // iterators:
+ iterator begin() noexcept { return mPrivateData.begin(); }
+ const_iterator begin() const noexcept { return mPrivateData.begin(); }
+ iterator end() noexcept { return mPrivateData.end(); }
+ const_iterator end() const noexcept { return mPrivateData.end(); }
+
+ reverse_iterator rbegin() noexcept { return mPrivateData.rbegin(); }
+ const_reverse_iterator rbegin() const noexcept { return mPrivateData.rbegin(); }
+ reverse_iterator rend() noexcept { return mPrivateData.rend(); }
+ const_reverse_iterator rend() const noexcept { return mPrivateData.rend(); }
+
+ // capacity:
+ constexpr size_type size() const noexcept { return mPrivateData.size(); }
+ constexpr size_type max_size() const noexcept { return mPrivateData.max_size(); }
+ constexpr bool empty() const noexcept { return mPrivateData.empty(); }
+
+ // element access:
+ reference operator[](E n)
+ {
+ ASSERT(static_cast<size_t>(n) < mPrivateData.size());
+ return mPrivateData[static_cast<UnderlyingType>(n)];
+ }
+
+ constexpr const_reference operator[](E n) const
+ {
+ ASSERT(static_cast<size_t>(n) < mPrivateData.size());
+ return mPrivateData[static_cast<UnderlyingType>(n)];
+ }
+
+ const_reference at(E n) const { return mPrivateData.at(static_cast<UnderlyingType>(n)); }
+ reference at(E n) { return mPrivateData.at(static_cast<UnderlyingType>(n)); }
+
+ reference front() { return mPrivateData.front(); }
+ const_reference front() const { return mPrivateData.front(); }
+ reference back() { return mPrivateData.back(); }
+ const_reference back() const { return mPrivateData.back(); }
+
+ T *data() noexcept { return mPrivateData.data(); }
+ const T *data() const noexcept { return mPrivateData.data(); }
+
+ private:
+ Storage mPrivateData;
+};
+
+// PackedEnumBitSetE> is like an std::bitset<E::EnumCount> but is indexed with enum values. It
+// implements the std::bitset interface except with enum values instead of indices.
+template <typename E, typename DataT = uint32_t>
+using PackedEnumBitSet = BitSetT<EnumSize<E>(), DataT, E>;
+
+} // namespace angle
+
+namespace gl
+{
+
+TextureType TextureTargetToType(TextureTarget target);
+TextureTarget NonCubeTextureTypeToTarget(TextureType type);
+
+TextureTarget CubeFaceIndexToTextureTarget(size_t face);
+size_t CubeMapTextureTargetToFaceIndex(TextureTarget target);
+bool IsCubeMapFaceTarget(TextureTarget target);
+
+constexpr TextureTarget kCubeMapTextureTargetMin = TextureTarget::CubeMapPositiveX;
+constexpr TextureTarget kCubeMapTextureTargetMax = TextureTarget::CubeMapNegativeZ;
+constexpr TextureTarget kAfterCubeMapTextureTargetMax =
+ static_cast<TextureTarget>(static_cast<uint8_t>(kCubeMapTextureTargetMax) + 1);
+struct AllCubeFaceTextureTargets
+{
+ angle::EnumIterator<TextureTarget> begin() const { return kCubeMapTextureTargetMin; }
+ angle::EnumIterator<TextureTarget> end() const { return kAfterCubeMapTextureTargetMax; }
+};
+
+constexpr ShaderType kGLES2ShaderTypeMin = ShaderType::Vertex;
+constexpr ShaderType kGLES2ShaderTypeMax = ShaderType::Fragment;
+constexpr ShaderType kAfterGLES2ShaderTypeMax =
+ static_cast<ShaderType>(static_cast<uint8_t>(kGLES2ShaderTypeMax) + 1);
+struct AllGLES2ShaderTypes
+{
+ angle::EnumIterator<ShaderType> begin() const { return kGLES2ShaderTypeMin; }
+ angle::EnumIterator<ShaderType> end() const { return kAfterGLES2ShaderTypeMax; }
+};
+
+constexpr ShaderType kShaderTypeMin = ShaderType::Vertex;
+constexpr ShaderType kShaderTypeMax = ShaderType::Compute;
+constexpr ShaderType kAfterShaderTypeMax =
+ static_cast<ShaderType>(static_cast<uint8_t>(kShaderTypeMax) + 1);
+struct AllShaderTypes
+{
+ angle::EnumIterator<ShaderType> begin() const { return kShaderTypeMin; }
+ angle::EnumIterator<ShaderType> end() const { return kAfterShaderTypeMax; }
+};
+
+constexpr size_t kGraphicsShaderCount = static_cast<size_t>(ShaderType::EnumCount) - 1u;
+// Arrange the shader types in the order of rendering pipeline
+constexpr std::array<ShaderType, kGraphicsShaderCount> kAllGraphicsShaderTypes = {
+ ShaderType::Vertex, ShaderType::Geometry, ShaderType::Fragment};
+
+using ShaderBitSet = angle::PackedEnumBitSet<ShaderType, uint8_t>;
+static_assert(sizeof(ShaderBitSet) == sizeof(uint8_t), "Unexpected size");
+
+template <typename T>
+using ShaderMap = angle::PackedEnumMap<ShaderType, T>;
+
+TextureType SamplerTypeToTextureType(GLenum samplerType);
+
+bool IsMultisampled(gl::TextureType type);
+
+enum class PrimitiveMode : uint8_t
+{
+ Points = 0x0,
+ Lines = 0x1,
+ LineLoop = 0x2,
+ LineStrip = 0x3,
+ Triangles = 0x4,
+ TriangleStrip = 0x5,
+ TriangleFan = 0x6,
+ Unused1 = 0x7,
+ Unused2 = 0x8,
+ Unused3 = 0x9,
+ LinesAdjacency = 0xA,
+ LineStripAdjacency = 0xB,
+ TrianglesAdjacency = 0xC,
+ TriangleStripAdjacency = 0xD,
+
+ InvalidEnum = 0xE,
+ EnumCount = 0xE,
+};
+
+template <>
+constexpr PrimitiveMode FromGLenum<PrimitiveMode>(GLenum from)
+{
+ if (from >= static_cast<GLenum>(PrimitiveMode::EnumCount))
+ {
+ return PrimitiveMode::InvalidEnum;
+ }
+
+ return static_cast<PrimitiveMode>(from);
+}
+
+constexpr GLenum ToGLenum(PrimitiveMode from)
+{
+ return static_cast<GLenum>(from);
+}
+
+static_assert(ToGLenum(PrimitiveMode::Points) == GL_POINTS, "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::Lines) == GL_LINES, "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::LineLoop) == GL_LINE_LOOP, "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::LineStrip) == GL_LINE_STRIP, "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::Triangles) == GL_TRIANGLES, "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::TriangleStrip) == GL_TRIANGLE_STRIP,
+ "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::TriangleFan) == GL_TRIANGLE_FAN, "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::LinesAdjacency) == GL_LINES_ADJACENCY,
+ "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::LineStripAdjacency) == GL_LINE_STRIP_ADJACENCY,
+ "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::TrianglesAdjacency) == GL_TRIANGLES_ADJACENCY,
+ "PrimitiveMode violation");
+static_assert(ToGLenum(PrimitiveMode::TriangleStripAdjacency) == GL_TRIANGLE_STRIP_ADJACENCY,
+ "PrimitiveMode violation");
+
+std::ostream &operator<<(std::ostream &os, PrimitiveMode value);
+
+enum class DrawElementsType : size_t
+{
+ UnsignedByte = 0,
+ UnsignedShort = 1,
+ UnsignedInt = 2,
+ InvalidEnum = 3,
+ EnumCount = 3,
+};
+
+template <>
+constexpr DrawElementsType FromGLenum<DrawElementsType>(GLenum from)
+{
+
+ GLenum scaled = (from - GL_UNSIGNED_BYTE);
+ // This code sequence generates a ROR instruction on x86/arm. We want to check if the lowest bit
+ // of scaled is set and if (scaled >> 1) is greater than a non-pot value. If we rotate the
+ // lowest bit to the hightest bit both conditions can be checked with a single test.
+ static_assert(sizeof(GLenum) == 4, "Update (scaled << 31) to sizeof(GLenum) * 8 - 1");
+ GLenum packed = (scaled >> 1) | (scaled << 31);
+
+ // operator ? with a simple assignment usually translates to a cmov instruction and thus avoids
+ // a branch.
+ packed = (packed >= static_cast<GLenum>(DrawElementsType::EnumCount))
+ ? static_cast<GLenum>(DrawElementsType::InvalidEnum)
+ : packed;
+
+ return static_cast<DrawElementsType>(packed);
+}
+
+constexpr GLenum ToGLenum(DrawElementsType from)
+{
+ return ((static_cast<GLenum>(from) << 1) + GL_UNSIGNED_BYTE);
+}
+
+#define ANGLE_VALIDATE_PACKED_ENUM(type, packed, glenum) \
+ static_assert(ToGLenum(type::packed) == glenum, #type " violation"); \
+ static_assert(FromGLenum<type>(glenum) == type::packed, #type " violation")
+
+ANGLE_VALIDATE_PACKED_ENUM(DrawElementsType, UnsignedByte, GL_UNSIGNED_BYTE);
+ANGLE_VALIDATE_PACKED_ENUM(DrawElementsType, UnsignedShort, GL_UNSIGNED_SHORT);
+ANGLE_VALIDATE_PACKED_ENUM(DrawElementsType, UnsignedInt, GL_UNSIGNED_INT);
+
+std::ostream &operator<<(std::ostream &os, DrawElementsType value);
+
+enum class VertexAttribType
+{
+ Byte = 0, // GLenum == 0x1400
+ UnsignedByte = 1, // GLenum == 0x1401
+ Short = 2, // GLenum == 0x1402
+ UnsignedShort = 3, // GLenum == 0x1403
+ Int = 4, // GLenum == 0x1404
+ UnsignedInt = 5, // GLenum == 0x1405
+ Float = 6, // GLenum == 0x1406
+ Unused1 = 7, // GLenum == 0x1407
+ Unused2 = 8, // GLenum == 0x1408
+ Unused3 = 9, // GLenum == 0x1409
+ Unused4 = 10, // GLenum == 0x140A
+ HalfFloat = 11, // GLenum == 0x140B
+ Fixed = 12, // GLenum == 0x140C
+ MaxBasicType = 12,
+ UnsignedInt2101010 = 13, // GLenum == 0x8368
+ Int2101010 = 14, // GLenum == 0x8D9F
+ InvalidEnum = 15,
+ EnumCount = 15,
+};
+
+template <>
+constexpr VertexAttribType FromGLenum<VertexAttribType>(GLenum from)
+{
+ GLenum packed = from - GL_BYTE;
+ if (packed <= static_cast<GLenum>(VertexAttribType::MaxBasicType))
+ return static_cast<VertexAttribType>(packed);
+ if (from == GL_UNSIGNED_INT_2_10_10_10_REV)
+ return VertexAttribType::UnsignedInt2101010;
+ if (from == GL_INT_2_10_10_10_REV)
+ return VertexAttribType::Int2101010;
+ return VertexAttribType::InvalidEnum;
+}
+
+constexpr GLenum ToGLenum(VertexAttribType from)
+{
+ // This could be optimized using a constexpr table.
+ if (from == VertexAttribType::Int2101010)
+ return GL_INT_2_10_10_10_REV;
+ if (from == VertexAttribType::UnsignedInt2101010)
+ return GL_UNSIGNED_INT_2_10_10_10_REV;
+ return static_cast<GLenum>(from) + GL_BYTE;
+}
+
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Byte, GL_BYTE);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, UnsignedByte, GL_UNSIGNED_BYTE);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Short, GL_SHORT);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, UnsignedShort, GL_UNSIGNED_SHORT);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Int, GL_INT);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, UnsignedInt, GL_UNSIGNED_INT);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Float, GL_FLOAT);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, HalfFloat, GL_HALF_FLOAT);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Fixed, GL_FIXED);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, Int2101010, GL_INT_2_10_10_10_REV);
+ANGLE_VALIDATE_PACKED_ENUM(VertexAttribType, UnsignedInt2101010, GL_UNSIGNED_INT_2_10_10_10_REV);
+
+std::ostream &operator<<(std::ostream &os, VertexAttribType value);
+} // namespace gl
+
+namespace egl
+{
+MessageType ErrorCodeToMessageType(EGLint errorCode);
+} // namespace egl
+
+namespace egl_gl
+{
+gl::TextureTarget EGLCubeMapTargetToCubeMapTarget(EGLenum eglTarget);
+gl::TextureTarget EGLImageTargetToTextureTarget(EGLenum eglTarget);
+gl::TextureType EGLTextureTargetToTextureType(EGLenum eglTarget);
+} // namespace egl_gl
+
+#endif // COMMON_PACKEDGLENUMS_H_
diff --git a/gfx/angle/checkout/src/common/PackedGLEnums_autogen.cpp b/gfx/angle/checkout/src/common/PackedGLEnums_autogen.cpp
new file mode 100644
index 0000000000..12974efc6b
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PackedGLEnums_autogen.cpp
@@ -0,0 +1,2285 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_packed_gl_enums.py using data from packed_gl_enums.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PackedGLEnums_autogen.cpp:
+// Implements ANGLE-specific enums classes for GLenums and functions operating
+// on them.
+
+#include "common/PackedGLEnums_autogen.h"
+#include "common/debug.h"
+
+namespace gl
+{
+
+template <>
+AlphaTestFunc FromGLenum<AlphaTestFunc>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_ALWAYS:
+ return AlphaTestFunc::AlwaysPass;
+ case GL_EQUAL:
+ return AlphaTestFunc::Equal;
+ case GL_GEQUAL:
+ return AlphaTestFunc::Gequal;
+ case GL_GREATER:
+ return AlphaTestFunc::Greater;
+ case GL_LEQUAL:
+ return AlphaTestFunc::Lequal;
+ case GL_LESS:
+ return AlphaTestFunc::Less;
+ case GL_NEVER:
+ return AlphaTestFunc::Never;
+ case GL_NOTEQUAL:
+ return AlphaTestFunc::NotEqual;
+ default:
+ return AlphaTestFunc::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(AlphaTestFunc from)
+{
+ switch (from)
+ {
+ case AlphaTestFunc::AlwaysPass:
+ return GL_ALWAYS;
+ case AlphaTestFunc::Equal:
+ return GL_EQUAL;
+ case AlphaTestFunc::Gequal:
+ return GL_GEQUAL;
+ case AlphaTestFunc::Greater:
+ return GL_GREATER;
+ case AlphaTestFunc::Lequal:
+ return GL_LEQUAL;
+ case AlphaTestFunc::Less:
+ return GL_LESS;
+ case AlphaTestFunc::Never:
+ return GL_NEVER;
+ case AlphaTestFunc::NotEqual:
+ return GL_NOTEQUAL;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, AlphaTestFunc value)
+{
+ switch (value)
+ {
+ case AlphaTestFunc::AlwaysPass:
+ os << "GL_ALWAYS";
+ break;
+ case AlphaTestFunc::Equal:
+ os << "GL_EQUAL";
+ break;
+ case AlphaTestFunc::Gequal:
+ os << "GL_GEQUAL";
+ break;
+ case AlphaTestFunc::Greater:
+ os << "GL_GREATER";
+ break;
+ case AlphaTestFunc::Lequal:
+ os << "GL_LEQUAL";
+ break;
+ case AlphaTestFunc::Less:
+ os << "GL_LESS";
+ break;
+ case AlphaTestFunc::Never:
+ os << "GL_NEVER";
+ break;
+ case AlphaTestFunc::NotEqual:
+ os << "GL_NOTEQUAL";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+BufferBinding FromGLenum<BufferBinding>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_ARRAY_BUFFER:
+ return BufferBinding::Array;
+ case GL_ATOMIC_COUNTER_BUFFER:
+ return BufferBinding::AtomicCounter;
+ case GL_COPY_READ_BUFFER:
+ return BufferBinding::CopyRead;
+ case GL_COPY_WRITE_BUFFER:
+ return BufferBinding::CopyWrite;
+ case GL_DISPATCH_INDIRECT_BUFFER:
+ return BufferBinding::DispatchIndirect;
+ case GL_DRAW_INDIRECT_BUFFER:
+ return BufferBinding::DrawIndirect;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ return BufferBinding::ElementArray;
+ case GL_PIXEL_PACK_BUFFER:
+ return BufferBinding::PixelPack;
+ case GL_PIXEL_UNPACK_BUFFER:
+ return BufferBinding::PixelUnpack;
+ case GL_SHADER_STORAGE_BUFFER:
+ return BufferBinding::ShaderStorage;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ return BufferBinding::TransformFeedback;
+ case GL_UNIFORM_BUFFER:
+ return BufferBinding::Uniform;
+ default:
+ return BufferBinding::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(BufferBinding from)
+{
+ switch (from)
+ {
+ case BufferBinding::Array:
+ return GL_ARRAY_BUFFER;
+ case BufferBinding::AtomicCounter:
+ return GL_ATOMIC_COUNTER_BUFFER;
+ case BufferBinding::CopyRead:
+ return GL_COPY_READ_BUFFER;
+ case BufferBinding::CopyWrite:
+ return GL_COPY_WRITE_BUFFER;
+ case BufferBinding::DispatchIndirect:
+ return GL_DISPATCH_INDIRECT_BUFFER;
+ case BufferBinding::DrawIndirect:
+ return GL_DRAW_INDIRECT_BUFFER;
+ case BufferBinding::ElementArray:
+ return GL_ELEMENT_ARRAY_BUFFER;
+ case BufferBinding::PixelPack:
+ return GL_PIXEL_PACK_BUFFER;
+ case BufferBinding::PixelUnpack:
+ return GL_PIXEL_UNPACK_BUFFER;
+ case BufferBinding::ShaderStorage:
+ return GL_SHADER_STORAGE_BUFFER;
+ case BufferBinding::TransformFeedback:
+ return GL_TRANSFORM_FEEDBACK_BUFFER;
+ case BufferBinding::Uniform:
+ return GL_UNIFORM_BUFFER;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, BufferBinding value)
+{
+ switch (value)
+ {
+ case BufferBinding::Array:
+ os << "GL_ARRAY_BUFFER";
+ break;
+ case BufferBinding::AtomicCounter:
+ os << "GL_ATOMIC_COUNTER_BUFFER";
+ break;
+ case BufferBinding::CopyRead:
+ os << "GL_COPY_READ_BUFFER";
+ break;
+ case BufferBinding::CopyWrite:
+ os << "GL_COPY_WRITE_BUFFER";
+ break;
+ case BufferBinding::DispatchIndirect:
+ os << "GL_DISPATCH_INDIRECT_BUFFER";
+ break;
+ case BufferBinding::DrawIndirect:
+ os << "GL_DRAW_INDIRECT_BUFFER";
+ break;
+ case BufferBinding::ElementArray:
+ os << "GL_ELEMENT_ARRAY_BUFFER";
+ break;
+ case BufferBinding::PixelPack:
+ os << "GL_PIXEL_PACK_BUFFER";
+ break;
+ case BufferBinding::PixelUnpack:
+ os << "GL_PIXEL_UNPACK_BUFFER";
+ break;
+ case BufferBinding::ShaderStorage:
+ os << "GL_SHADER_STORAGE_BUFFER";
+ break;
+ case BufferBinding::TransformFeedback:
+ os << "GL_TRANSFORM_FEEDBACK_BUFFER";
+ break;
+ case BufferBinding::Uniform:
+ os << "GL_UNIFORM_BUFFER";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+BufferUsage FromGLenum<BufferUsage>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_DYNAMIC_COPY:
+ return BufferUsage::DynamicCopy;
+ case GL_DYNAMIC_DRAW:
+ return BufferUsage::DynamicDraw;
+ case GL_DYNAMIC_READ:
+ return BufferUsage::DynamicRead;
+ case GL_STATIC_COPY:
+ return BufferUsage::StaticCopy;
+ case GL_STATIC_DRAW:
+ return BufferUsage::StaticDraw;
+ case GL_STATIC_READ:
+ return BufferUsage::StaticRead;
+ case GL_STREAM_COPY:
+ return BufferUsage::StreamCopy;
+ case GL_STREAM_DRAW:
+ return BufferUsage::StreamDraw;
+ case GL_STREAM_READ:
+ return BufferUsage::StreamRead;
+ default:
+ return BufferUsage::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(BufferUsage from)
+{
+ switch (from)
+ {
+ case BufferUsage::DynamicCopy:
+ return GL_DYNAMIC_COPY;
+ case BufferUsage::DynamicDraw:
+ return GL_DYNAMIC_DRAW;
+ case BufferUsage::DynamicRead:
+ return GL_DYNAMIC_READ;
+ case BufferUsage::StaticCopy:
+ return GL_STATIC_COPY;
+ case BufferUsage::StaticDraw:
+ return GL_STATIC_DRAW;
+ case BufferUsage::StaticRead:
+ return GL_STATIC_READ;
+ case BufferUsage::StreamCopy:
+ return GL_STREAM_COPY;
+ case BufferUsage::StreamDraw:
+ return GL_STREAM_DRAW;
+ case BufferUsage::StreamRead:
+ return GL_STREAM_READ;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, BufferUsage value)
+{
+ switch (value)
+ {
+ case BufferUsage::DynamicCopy:
+ os << "GL_DYNAMIC_COPY";
+ break;
+ case BufferUsage::DynamicDraw:
+ os << "GL_DYNAMIC_DRAW";
+ break;
+ case BufferUsage::DynamicRead:
+ os << "GL_DYNAMIC_READ";
+ break;
+ case BufferUsage::StaticCopy:
+ os << "GL_STATIC_COPY";
+ break;
+ case BufferUsage::StaticDraw:
+ os << "GL_STATIC_DRAW";
+ break;
+ case BufferUsage::StaticRead:
+ os << "GL_STATIC_READ";
+ break;
+ case BufferUsage::StreamCopy:
+ os << "GL_STREAM_COPY";
+ break;
+ case BufferUsage::StreamDraw:
+ os << "GL_STREAM_DRAW";
+ break;
+ case BufferUsage::StreamRead:
+ os << "GL_STREAM_READ";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+ClientVertexArrayType FromGLenum<ClientVertexArrayType>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_COLOR_ARRAY:
+ return ClientVertexArrayType::Color;
+ case GL_NORMAL_ARRAY:
+ return ClientVertexArrayType::Normal;
+ case GL_POINT_SIZE_ARRAY_OES:
+ return ClientVertexArrayType::PointSize;
+ case GL_TEXTURE_COORD_ARRAY:
+ return ClientVertexArrayType::TextureCoord;
+ case GL_VERTEX_ARRAY:
+ return ClientVertexArrayType::Vertex;
+ default:
+ return ClientVertexArrayType::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(ClientVertexArrayType from)
+{
+ switch (from)
+ {
+ case ClientVertexArrayType::Color:
+ return GL_COLOR_ARRAY;
+ case ClientVertexArrayType::Normal:
+ return GL_NORMAL_ARRAY;
+ case ClientVertexArrayType::PointSize:
+ return GL_POINT_SIZE_ARRAY_OES;
+ case ClientVertexArrayType::TextureCoord:
+ return GL_TEXTURE_COORD_ARRAY;
+ case ClientVertexArrayType::Vertex:
+ return GL_VERTEX_ARRAY;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, ClientVertexArrayType value)
+{
+ switch (value)
+ {
+ case ClientVertexArrayType::Color:
+ os << "GL_COLOR_ARRAY";
+ break;
+ case ClientVertexArrayType::Normal:
+ os << "GL_NORMAL_ARRAY";
+ break;
+ case ClientVertexArrayType::PointSize:
+ os << "GL_POINT_SIZE_ARRAY_OES";
+ break;
+ case ClientVertexArrayType::TextureCoord:
+ os << "GL_TEXTURE_COORD_ARRAY";
+ break;
+ case ClientVertexArrayType::Vertex:
+ os << "GL_VERTEX_ARRAY";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+CullFaceMode FromGLenum<CullFaceMode>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_BACK:
+ return CullFaceMode::Back;
+ case GL_FRONT:
+ return CullFaceMode::Front;
+ case GL_FRONT_AND_BACK:
+ return CullFaceMode::FrontAndBack;
+ default:
+ return CullFaceMode::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(CullFaceMode from)
+{
+ switch (from)
+ {
+ case CullFaceMode::Back:
+ return GL_BACK;
+ case CullFaceMode::Front:
+ return GL_FRONT;
+ case CullFaceMode::FrontAndBack:
+ return GL_FRONT_AND_BACK;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, CullFaceMode value)
+{
+ switch (value)
+ {
+ case CullFaceMode::Back:
+ os << "GL_BACK";
+ break;
+ case CullFaceMode::Front:
+ os << "GL_FRONT";
+ break;
+ case CullFaceMode::FrontAndBack:
+ os << "GL_FRONT_AND_BACK";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+FilterMode FromGLenum<FilterMode>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_NEAREST:
+ return FilterMode::Nearest;
+ case GL_LINEAR:
+ return FilterMode::Linear;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ return FilterMode::NearestMipmapNearest;
+ case GL_NEAREST_MIPMAP_LINEAR:
+ return FilterMode::NearestMipmapLinear;
+ case GL_LINEAR_MIPMAP_LINEAR:
+ return FilterMode::LinearMipmapLinear;
+ default:
+ return FilterMode::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(FilterMode from)
+{
+ switch (from)
+ {
+ case FilterMode::Nearest:
+ return GL_NEAREST;
+ case FilterMode::Linear:
+ return GL_LINEAR;
+ case FilterMode::NearestMipmapNearest:
+ return GL_NEAREST_MIPMAP_NEAREST;
+ case FilterMode::NearestMipmapLinear:
+ return GL_NEAREST_MIPMAP_LINEAR;
+ case FilterMode::LinearMipmapLinear:
+ return GL_LINEAR_MIPMAP_LINEAR;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, FilterMode value)
+{
+ switch (value)
+ {
+ case FilterMode::Nearest:
+ os << "GL_NEAREST";
+ break;
+ case FilterMode::Linear:
+ os << "GL_LINEAR";
+ break;
+ case FilterMode::NearestMipmapNearest:
+ os << "GL_NEAREST_MIPMAP_NEAREST";
+ break;
+ case FilterMode::NearestMipmapLinear:
+ os << "GL_NEAREST_MIPMAP_LINEAR";
+ break;
+ case FilterMode::LinearMipmapLinear:
+ os << "GL_LINEAR_MIPMAP_LINEAR";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+FogMode FromGLenum<FogMode>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_EXP:
+ return FogMode::Exp;
+ case GL_EXP2:
+ return FogMode::Exp2;
+ case GL_LINEAR:
+ return FogMode::Linear;
+ default:
+ return FogMode::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(FogMode from)
+{
+ switch (from)
+ {
+ case FogMode::Exp:
+ return GL_EXP;
+ case FogMode::Exp2:
+ return GL_EXP2;
+ case FogMode::Linear:
+ return GL_LINEAR;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, FogMode value)
+{
+ switch (value)
+ {
+ case FogMode::Exp:
+ os << "GL_EXP";
+ break;
+ case FogMode::Exp2:
+ os << "GL_EXP2";
+ break;
+ case FogMode::Linear:
+ os << "GL_LINEAR";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+GraphicsResetStatus FromGLenum<GraphicsResetStatus>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_NO_ERROR:
+ return GraphicsResetStatus::NoError;
+ case GL_GUILTY_CONTEXT_RESET:
+ return GraphicsResetStatus::GuiltyContextReset;
+ case GL_INNOCENT_CONTEXT_RESET:
+ return GraphicsResetStatus::InnocentContextReset;
+ case GL_UNKNOWN_CONTEXT_RESET:
+ return GraphicsResetStatus::UnknownContextReset;
+ default:
+ return GraphicsResetStatus::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(GraphicsResetStatus from)
+{
+ switch (from)
+ {
+ case GraphicsResetStatus::NoError:
+ return GL_NO_ERROR;
+ case GraphicsResetStatus::GuiltyContextReset:
+ return GL_GUILTY_CONTEXT_RESET;
+ case GraphicsResetStatus::InnocentContextReset:
+ return GL_INNOCENT_CONTEXT_RESET;
+ case GraphicsResetStatus::UnknownContextReset:
+ return GL_UNKNOWN_CONTEXT_RESET;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, GraphicsResetStatus value)
+{
+ switch (value)
+ {
+ case GraphicsResetStatus::NoError:
+ os << "GL_NO_ERROR";
+ break;
+ case GraphicsResetStatus::GuiltyContextReset:
+ os << "GL_GUILTY_CONTEXT_RESET";
+ break;
+ case GraphicsResetStatus::InnocentContextReset:
+ os << "GL_INNOCENT_CONTEXT_RESET";
+ break;
+ case GraphicsResetStatus::UnknownContextReset:
+ os << "GL_UNKNOWN_CONTEXT_RESET";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+HandleType FromGLenum<HandleType>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_HANDLE_TYPE_OPAQUE_FD_EXT:
+ return HandleType::OpaqueFd;
+ default:
+ return HandleType::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(HandleType from)
+{
+ switch (from)
+ {
+ case HandleType::OpaqueFd:
+ return GL_HANDLE_TYPE_OPAQUE_FD_EXT;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, HandleType value)
+{
+ switch (value)
+ {
+ case HandleType::OpaqueFd:
+ os << "GL_HANDLE_TYPE_OPAQUE_FD_EXT";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+HintSetting FromGLenum<HintSetting>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_DONT_CARE:
+ return HintSetting::DontCare;
+ case GL_FASTEST:
+ return HintSetting::Fastest;
+ case GL_NICEST:
+ return HintSetting::Nicest;
+ default:
+ return HintSetting::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(HintSetting from)
+{
+ switch (from)
+ {
+ case HintSetting::DontCare:
+ return GL_DONT_CARE;
+ case HintSetting::Fastest:
+ return GL_FASTEST;
+ case HintSetting::Nicest:
+ return GL_NICEST;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, HintSetting value)
+{
+ switch (value)
+ {
+ case HintSetting::DontCare:
+ os << "GL_DONT_CARE";
+ break;
+ case HintSetting::Fastest:
+ os << "GL_FASTEST";
+ break;
+ case HintSetting::Nicest:
+ os << "GL_NICEST";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+ImageLayout FromGLenum<ImageLayout>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_NONE:
+ return ImageLayout::Undefined;
+ case GL_LAYOUT_GENERAL_EXT:
+ return ImageLayout::General;
+ case GL_LAYOUT_COLOR_ATTACHMENT_EXT:
+ return ImageLayout::ColorAttachment;
+ case GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT:
+ return ImageLayout::DepthStencilAttachment;
+ case GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT:
+ return ImageLayout::DepthStencilReadOnlyAttachment;
+ case GL_LAYOUT_SHADER_READ_ONLY_EXT:
+ return ImageLayout::ShaderReadOnly;
+ case GL_LAYOUT_TRANSFER_SRC_EXT:
+ return ImageLayout::TransferSrc;
+ case GL_LAYOUT_TRANSFER_DST_EXT:
+ return ImageLayout::TransferDst;
+ case GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT:
+ return ImageLayout::DepthReadOnlyStencilAttachment;
+ case GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT:
+ return ImageLayout::DepthAttachmentStencilReadOnly;
+ default:
+ return ImageLayout::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(ImageLayout from)
+{
+ switch (from)
+ {
+ case ImageLayout::Undefined:
+ return GL_NONE;
+ case ImageLayout::General:
+ return GL_LAYOUT_GENERAL_EXT;
+ case ImageLayout::ColorAttachment:
+ return GL_LAYOUT_COLOR_ATTACHMENT_EXT;
+ case ImageLayout::DepthStencilAttachment:
+ return GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT;
+ case ImageLayout::DepthStencilReadOnlyAttachment:
+ return GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT;
+ case ImageLayout::ShaderReadOnly:
+ return GL_LAYOUT_SHADER_READ_ONLY_EXT;
+ case ImageLayout::TransferSrc:
+ return GL_LAYOUT_TRANSFER_SRC_EXT;
+ case ImageLayout::TransferDst:
+ return GL_LAYOUT_TRANSFER_DST_EXT;
+ case ImageLayout::DepthReadOnlyStencilAttachment:
+ return GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT;
+ case ImageLayout::DepthAttachmentStencilReadOnly:
+ return GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, ImageLayout value)
+{
+ switch (value)
+ {
+ case ImageLayout::Undefined:
+ os << "GL_NONE";
+ break;
+ case ImageLayout::General:
+ os << "GL_LAYOUT_GENERAL_EXT";
+ break;
+ case ImageLayout::ColorAttachment:
+ os << "GL_LAYOUT_COLOR_ATTACHMENT_EXT";
+ break;
+ case ImageLayout::DepthStencilAttachment:
+ os << "GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT";
+ break;
+ case ImageLayout::DepthStencilReadOnlyAttachment:
+ os << "GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT";
+ break;
+ case ImageLayout::ShaderReadOnly:
+ os << "GL_LAYOUT_SHADER_READ_ONLY_EXT";
+ break;
+ case ImageLayout::TransferSrc:
+ os << "GL_LAYOUT_TRANSFER_SRC_EXT";
+ break;
+ case ImageLayout::TransferDst:
+ os << "GL_LAYOUT_TRANSFER_DST_EXT";
+ break;
+ case ImageLayout::DepthReadOnlyStencilAttachment:
+ os << "GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT";
+ break;
+ case ImageLayout::DepthAttachmentStencilReadOnly:
+ os << "GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+LightParameter FromGLenum<LightParameter>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_AMBIENT:
+ return LightParameter::Ambient;
+ case GL_AMBIENT_AND_DIFFUSE:
+ return LightParameter::AmbientAndDiffuse;
+ case GL_CONSTANT_ATTENUATION:
+ return LightParameter::ConstantAttenuation;
+ case GL_DIFFUSE:
+ return LightParameter::Diffuse;
+ case GL_LINEAR_ATTENUATION:
+ return LightParameter::LinearAttenuation;
+ case GL_POSITION:
+ return LightParameter::Position;
+ case GL_QUADRATIC_ATTENUATION:
+ return LightParameter::QuadraticAttenuation;
+ case GL_SPECULAR:
+ return LightParameter::Specular;
+ case GL_SPOT_CUTOFF:
+ return LightParameter::SpotCutoff;
+ case GL_SPOT_DIRECTION:
+ return LightParameter::SpotDirection;
+ case GL_SPOT_EXPONENT:
+ return LightParameter::SpotExponent;
+ default:
+ return LightParameter::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(LightParameter from)
+{
+ switch (from)
+ {
+ case LightParameter::Ambient:
+ return GL_AMBIENT;
+ case LightParameter::AmbientAndDiffuse:
+ return GL_AMBIENT_AND_DIFFUSE;
+ case LightParameter::ConstantAttenuation:
+ return GL_CONSTANT_ATTENUATION;
+ case LightParameter::Diffuse:
+ return GL_DIFFUSE;
+ case LightParameter::LinearAttenuation:
+ return GL_LINEAR_ATTENUATION;
+ case LightParameter::Position:
+ return GL_POSITION;
+ case LightParameter::QuadraticAttenuation:
+ return GL_QUADRATIC_ATTENUATION;
+ case LightParameter::Specular:
+ return GL_SPECULAR;
+ case LightParameter::SpotCutoff:
+ return GL_SPOT_CUTOFF;
+ case LightParameter::SpotDirection:
+ return GL_SPOT_DIRECTION;
+ case LightParameter::SpotExponent:
+ return GL_SPOT_EXPONENT;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, LightParameter value)
+{
+ switch (value)
+ {
+ case LightParameter::Ambient:
+ os << "GL_AMBIENT";
+ break;
+ case LightParameter::AmbientAndDiffuse:
+ os << "GL_AMBIENT_AND_DIFFUSE";
+ break;
+ case LightParameter::ConstantAttenuation:
+ os << "GL_CONSTANT_ATTENUATION";
+ break;
+ case LightParameter::Diffuse:
+ os << "GL_DIFFUSE";
+ break;
+ case LightParameter::LinearAttenuation:
+ os << "GL_LINEAR_ATTENUATION";
+ break;
+ case LightParameter::Position:
+ os << "GL_POSITION";
+ break;
+ case LightParameter::QuadraticAttenuation:
+ os << "GL_QUADRATIC_ATTENUATION";
+ break;
+ case LightParameter::Specular:
+ os << "GL_SPECULAR";
+ break;
+ case LightParameter::SpotCutoff:
+ os << "GL_SPOT_CUTOFF";
+ break;
+ case LightParameter::SpotDirection:
+ os << "GL_SPOT_DIRECTION";
+ break;
+ case LightParameter::SpotExponent:
+ os << "GL_SPOT_EXPONENT";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+LogicalOperation FromGLenum<LogicalOperation>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_AND:
+ return LogicalOperation::And;
+ case GL_AND_INVERTED:
+ return LogicalOperation::AndInverted;
+ case GL_AND_REVERSE:
+ return LogicalOperation::AndReverse;
+ case GL_CLEAR:
+ return LogicalOperation::Clear;
+ case GL_COPY:
+ return LogicalOperation::Copy;
+ case GL_COPY_INVERTED:
+ return LogicalOperation::CopyInverted;
+ case GL_EQUIV:
+ return LogicalOperation::Equiv;
+ case GL_INVERT:
+ return LogicalOperation::Invert;
+ case GL_NAND:
+ return LogicalOperation::Nand;
+ case GL_NOOP:
+ return LogicalOperation::Noop;
+ case GL_NOR:
+ return LogicalOperation::Nor;
+ case GL_OR:
+ return LogicalOperation::Or;
+ case GL_OR_INVERTED:
+ return LogicalOperation::OrInverted;
+ case GL_OR_REVERSE:
+ return LogicalOperation::OrReverse;
+ case GL_SET:
+ return LogicalOperation::Set;
+ case GL_XOR:
+ return LogicalOperation::Xor;
+ default:
+ return LogicalOperation::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(LogicalOperation from)
+{
+ switch (from)
+ {
+ case LogicalOperation::And:
+ return GL_AND;
+ case LogicalOperation::AndInverted:
+ return GL_AND_INVERTED;
+ case LogicalOperation::AndReverse:
+ return GL_AND_REVERSE;
+ case LogicalOperation::Clear:
+ return GL_CLEAR;
+ case LogicalOperation::Copy:
+ return GL_COPY;
+ case LogicalOperation::CopyInverted:
+ return GL_COPY_INVERTED;
+ case LogicalOperation::Equiv:
+ return GL_EQUIV;
+ case LogicalOperation::Invert:
+ return GL_INVERT;
+ case LogicalOperation::Nand:
+ return GL_NAND;
+ case LogicalOperation::Noop:
+ return GL_NOOP;
+ case LogicalOperation::Nor:
+ return GL_NOR;
+ case LogicalOperation::Or:
+ return GL_OR;
+ case LogicalOperation::OrInverted:
+ return GL_OR_INVERTED;
+ case LogicalOperation::OrReverse:
+ return GL_OR_REVERSE;
+ case LogicalOperation::Set:
+ return GL_SET;
+ case LogicalOperation::Xor:
+ return GL_XOR;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, LogicalOperation value)
+{
+ switch (value)
+ {
+ case LogicalOperation::And:
+ os << "GL_AND";
+ break;
+ case LogicalOperation::AndInverted:
+ os << "GL_AND_INVERTED";
+ break;
+ case LogicalOperation::AndReverse:
+ os << "GL_AND_REVERSE";
+ break;
+ case LogicalOperation::Clear:
+ os << "GL_CLEAR";
+ break;
+ case LogicalOperation::Copy:
+ os << "GL_COPY";
+ break;
+ case LogicalOperation::CopyInverted:
+ os << "GL_COPY_INVERTED";
+ break;
+ case LogicalOperation::Equiv:
+ os << "GL_EQUIV";
+ break;
+ case LogicalOperation::Invert:
+ os << "GL_INVERT";
+ break;
+ case LogicalOperation::Nand:
+ os << "GL_NAND";
+ break;
+ case LogicalOperation::Noop:
+ os << "GL_NOOP";
+ break;
+ case LogicalOperation::Nor:
+ os << "GL_NOR";
+ break;
+ case LogicalOperation::Or:
+ os << "GL_OR";
+ break;
+ case LogicalOperation::OrInverted:
+ os << "GL_OR_INVERTED";
+ break;
+ case LogicalOperation::OrReverse:
+ os << "GL_OR_REVERSE";
+ break;
+ case LogicalOperation::Set:
+ os << "GL_SET";
+ break;
+ case LogicalOperation::Xor:
+ os << "GL_XOR";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+MaterialParameter FromGLenum<MaterialParameter>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_AMBIENT:
+ return MaterialParameter::Ambient;
+ case GL_AMBIENT_AND_DIFFUSE:
+ return MaterialParameter::AmbientAndDiffuse;
+ case GL_DIFFUSE:
+ return MaterialParameter::Diffuse;
+ case GL_EMISSION:
+ return MaterialParameter::Emission;
+ case GL_SHININESS:
+ return MaterialParameter::Shininess;
+ case GL_SPECULAR:
+ return MaterialParameter::Specular;
+ default:
+ return MaterialParameter::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(MaterialParameter from)
+{
+ switch (from)
+ {
+ case MaterialParameter::Ambient:
+ return GL_AMBIENT;
+ case MaterialParameter::AmbientAndDiffuse:
+ return GL_AMBIENT_AND_DIFFUSE;
+ case MaterialParameter::Diffuse:
+ return GL_DIFFUSE;
+ case MaterialParameter::Emission:
+ return GL_EMISSION;
+ case MaterialParameter::Shininess:
+ return GL_SHININESS;
+ case MaterialParameter::Specular:
+ return GL_SPECULAR;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, MaterialParameter value)
+{
+ switch (value)
+ {
+ case MaterialParameter::Ambient:
+ os << "GL_AMBIENT";
+ break;
+ case MaterialParameter::AmbientAndDiffuse:
+ os << "GL_AMBIENT_AND_DIFFUSE";
+ break;
+ case MaterialParameter::Diffuse:
+ os << "GL_DIFFUSE";
+ break;
+ case MaterialParameter::Emission:
+ os << "GL_EMISSION";
+ break;
+ case MaterialParameter::Shininess:
+ os << "GL_SHININESS";
+ break;
+ case MaterialParameter::Specular:
+ os << "GL_SPECULAR";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+MatrixType FromGLenum<MatrixType>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_MODELVIEW:
+ return MatrixType::Modelview;
+ case GL_PROJECTION:
+ return MatrixType::Projection;
+ case GL_TEXTURE:
+ return MatrixType::Texture;
+ default:
+ return MatrixType::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(MatrixType from)
+{
+ switch (from)
+ {
+ case MatrixType::Modelview:
+ return GL_MODELVIEW;
+ case MatrixType::Projection:
+ return GL_PROJECTION;
+ case MatrixType::Texture:
+ return GL_TEXTURE;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, MatrixType value)
+{
+ switch (value)
+ {
+ case MatrixType::Modelview:
+ os << "GL_MODELVIEW";
+ break;
+ case MatrixType::Projection:
+ os << "GL_PROJECTION";
+ break;
+ case MatrixType::Texture:
+ os << "GL_TEXTURE";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+PointParameter FromGLenum<PointParameter>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_POINT_SIZE_MIN:
+ return PointParameter::PointSizeMin;
+ case GL_POINT_SIZE_MAX:
+ return PointParameter::PointSizeMax;
+ case GL_POINT_FADE_THRESHOLD_SIZE:
+ return PointParameter::PointFadeThresholdSize;
+ case GL_POINT_DISTANCE_ATTENUATION:
+ return PointParameter::PointDistanceAttenuation;
+ default:
+ return PointParameter::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(PointParameter from)
+{
+ switch (from)
+ {
+ case PointParameter::PointSizeMin:
+ return GL_POINT_SIZE_MIN;
+ case PointParameter::PointSizeMax:
+ return GL_POINT_SIZE_MAX;
+ case PointParameter::PointFadeThresholdSize:
+ return GL_POINT_FADE_THRESHOLD_SIZE;
+ case PointParameter::PointDistanceAttenuation:
+ return GL_POINT_DISTANCE_ATTENUATION;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, PointParameter value)
+{
+ switch (value)
+ {
+ case PointParameter::PointSizeMin:
+ os << "GL_POINT_SIZE_MIN";
+ break;
+ case PointParameter::PointSizeMax:
+ os << "GL_POINT_SIZE_MAX";
+ break;
+ case PointParameter::PointFadeThresholdSize:
+ os << "GL_POINT_FADE_THRESHOLD_SIZE";
+ break;
+ case PointParameter::PointDistanceAttenuation:
+ os << "GL_POINT_DISTANCE_ATTENUATION";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+ProvokingVertexConvention FromGLenum<ProvokingVertexConvention>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_FIRST_VERTEX_CONVENTION:
+ return ProvokingVertexConvention::FirstVertexConvention;
+ case GL_LAST_VERTEX_CONVENTION:
+ return ProvokingVertexConvention::LastVertexConvention;
+ default:
+ return ProvokingVertexConvention::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(ProvokingVertexConvention from)
+{
+ switch (from)
+ {
+ case ProvokingVertexConvention::FirstVertexConvention:
+ return GL_FIRST_VERTEX_CONVENTION;
+ case ProvokingVertexConvention::LastVertexConvention:
+ return GL_LAST_VERTEX_CONVENTION;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, ProvokingVertexConvention value)
+{
+ switch (value)
+ {
+ case ProvokingVertexConvention::FirstVertexConvention:
+ os << "GL_FIRST_VERTEX_CONVENTION";
+ break;
+ case ProvokingVertexConvention::LastVertexConvention:
+ os << "GL_LAST_VERTEX_CONVENTION";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+QueryType FromGLenum<QueryType>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_ANY_SAMPLES_PASSED:
+ return QueryType::AnySamples;
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+ return QueryType::AnySamplesConservative;
+ case GL_COMMANDS_COMPLETED_CHROMIUM:
+ return QueryType::CommandsCompleted;
+ case GL_PRIMITIVES_GENERATED_EXT:
+ return QueryType::PrimitivesGenerated;
+ case GL_TIME_ELAPSED_EXT:
+ return QueryType::TimeElapsed;
+ case GL_TIMESTAMP_EXT:
+ return QueryType::Timestamp;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ return QueryType::TransformFeedbackPrimitivesWritten;
+ default:
+ return QueryType::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(QueryType from)
+{
+ switch (from)
+ {
+ case QueryType::AnySamples:
+ return GL_ANY_SAMPLES_PASSED;
+ case QueryType::AnySamplesConservative:
+ return GL_ANY_SAMPLES_PASSED_CONSERVATIVE;
+ case QueryType::CommandsCompleted:
+ return GL_COMMANDS_COMPLETED_CHROMIUM;
+ case QueryType::PrimitivesGenerated:
+ return GL_PRIMITIVES_GENERATED_EXT;
+ case QueryType::TimeElapsed:
+ return GL_TIME_ELAPSED_EXT;
+ case QueryType::Timestamp:
+ return GL_TIMESTAMP_EXT;
+ case QueryType::TransformFeedbackPrimitivesWritten:
+ return GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, QueryType value)
+{
+ switch (value)
+ {
+ case QueryType::AnySamples:
+ os << "GL_ANY_SAMPLES_PASSED";
+ break;
+ case QueryType::AnySamplesConservative:
+ os << "GL_ANY_SAMPLES_PASSED_CONSERVATIVE";
+ break;
+ case QueryType::CommandsCompleted:
+ os << "GL_COMMANDS_COMPLETED_CHROMIUM";
+ break;
+ case QueryType::PrimitivesGenerated:
+ os << "GL_PRIMITIVES_GENERATED_EXT";
+ break;
+ case QueryType::TimeElapsed:
+ os << "GL_TIME_ELAPSED_EXT";
+ break;
+ case QueryType::Timestamp:
+ os << "GL_TIMESTAMP_EXT";
+ break;
+ case QueryType::TransformFeedbackPrimitivesWritten:
+ os << "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+ShaderType FromGLenum<ShaderType>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_VERTEX_SHADER:
+ return ShaderType::Vertex;
+ case GL_FRAGMENT_SHADER:
+ return ShaderType::Fragment;
+ case GL_GEOMETRY_SHADER_EXT:
+ return ShaderType::Geometry;
+ case GL_COMPUTE_SHADER:
+ return ShaderType::Compute;
+ default:
+ return ShaderType::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(ShaderType from)
+{
+ switch (from)
+ {
+ case ShaderType::Vertex:
+ return GL_VERTEX_SHADER;
+ case ShaderType::Fragment:
+ return GL_FRAGMENT_SHADER;
+ case ShaderType::Geometry:
+ return GL_GEOMETRY_SHADER_EXT;
+ case ShaderType::Compute:
+ return GL_COMPUTE_SHADER;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, ShaderType value)
+{
+ switch (value)
+ {
+ case ShaderType::Vertex:
+ os << "GL_VERTEX_SHADER";
+ break;
+ case ShaderType::Fragment:
+ os << "GL_FRAGMENT_SHADER";
+ break;
+ case ShaderType::Geometry:
+ os << "GL_GEOMETRY_SHADER_EXT";
+ break;
+ case ShaderType::Compute:
+ os << "GL_COMPUTE_SHADER";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+ShadingModel FromGLenum<ShadingModel>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_FLAT:
+ return ShadingModel::Flat;
+ case GL_SMOOTH:
+ return ShadingModel::Smooth;
+ default:
+ return ShadingModel::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(ShadingModel from)
+{
+ switch (from)
+ {
+ case ShadingModel::Flat:
+ return GL_FLAT;
+ case ShadingModel::Smooth:
+ return GL_SMOOTH;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, ShadingModel value)
+{
+ switch (value)
+ {
+ case ShadingModel::Flat:
+ os << "GL_FLAT";
+ break;
+ case ShadingModel::Smooth:
+ os << "GL_SMOOTH";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureCombine FromGLenum<TextureCombine>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_ADD:
+ return TextureCombine::Add;
+ case GL_ADD_SIGNED:
+ return TextureCombine::AddSigned;
+ case GL_DOT3_RGB:
+ return TextureCombine::Dot3Rgb;
+ case GL_DOT3_RGBA:
+ return TextureCombine::Dot3Rgba;
+ case GL_INTERPOLATE:
+ return TextureCombine::Interpolate;
+ case GL_MODULATE:
+ return TextureCombine::Modulate;
+ case GL_REPLACE:
+ return TextureCombine::Replace;
+ case GL_SUBTRACT:
+ return TextureCombine::Subtract;
+ default:
+ return TextureCombine::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureCombine from)
+{
+ switch (from)
+ {
+ case TextureCombine::Add:
+ return GL_ADD;
+ case TextureCombine::AddSigned:
+ return GL_ADD_SIGNED;
+ case TextureCombine::Dot3Rgb:
+ return GL_DOT3_RGB;
+ case TextureCombine::Dot3Rgba:
+ return GL_DOT3_RGBA;
+ case TextureCombine::Interpolate:
+ return GL_INTERPOLATE;
+ case TextureCombine::Modulate:
+ return GL_MODULATE;
+ case TextureCombine::Replace:
+ return GL_REPLACE;
+ case TextureCombine::Subtract:
+ return GL_SUBTRACT;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureCombine value)
+{
+ switch (value)
+ {
+ case TextureCombine::Add:
+ os << "GL_ADD";
+ break;
+ case TextureCombine::AddSigned:
+ os << "GL_ADD_SIGNED";
+ break;
+ case TextureCombine::Dot3Rgb:
+ os << "GL_DOT3_RGB";
+ break;
+ case TextureCombine::Dot3Rgba:
+ os << "GL_DOT3_RGBA";
+ break;
+ case TextureCombine::Interpolate:
+ os << "GL_INTERPOLATE";
+ break;
+ case TextureCombine::Modulate:
+ os << "GL_MODULATE";
+ break;
+ case TextureCombine::Replace:
+ os << "GL_REPLACE";
+ break;
+ case TextureCombine::Subtract:
+ os << "GL_SUBTRACT";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureEnvMode FromGLenum<TextureEnvMode>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_ADD:
+ return TextureEnvMode::Add;
+ case GL_BLEND:
+ return TextureEnvMode::Blend;
+ case GL_COMBINE:
+ return TextureEnvMode::Combine;
+ case GL_DECAL:
+ return TextureEnvMode::Decal;
+ case GL_MODULATE:
+ return TextureEnvMode::Modulate;
+ case GL_REPLACE:
+ return TextureEnvMode::Replace;
+ default:
+ return TextureEnvMode::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureEnvMode from)
+{
+ switch (from)
+ {
+ case TextureEnvMode::Add:
+ return GL_ADD;
+ case TextureEnvMode::Blend:
+ return GL_BLEND;
+ case TextureEnvMode::Combine:
+ return GL_COMBINE;
+ case TextureEnvMode::Decal:
+ return GL_DECAL;
+ case TextureEnvMode::Modulate:
+ return GL_MODULATE;
+ case TextureEnvMode::Replace:
+ return GL_REPLACE;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureEnvMode value)
+{
+ switch (value)
+ {
+ case TextureEnvMode::Add:
+ os << "GL_ADD";
+ break;
+ case TextureEnvMode::Blend:
+ os << "GL_BLEND";
+ break;
+ case TextureEnvMode::Combine:
+ os << "GL_COMBINE";
+ break;
+ case TextureEnvMode::Decal:
+ os << "GL_DECAL";
+ break;
+ case TextureEnvMode::Modulate:
+ os << "GL_MODULATE";
+ break;
+ case TextureEnvMode::Replace:
+ os << "GL_REPLACE";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureEnvParameter FromGLenum<TextureEnvParameter>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_TEXTURE_ENV_MODE:
+ return TextureEnvParameter::Mode;
+ case GL_TEXTURE_ENV_COLOR:
+ return TextureEnvParameter::Color;
+ case GL_COMBINE_RGB:
+ return TextureEnvParameter::CombineRgb;
+ case GL_COMBINE_ALPHA:
+ return TextureEnvParameter::CombineAlpha;
+ case GL_RGB_SCALE:
+ return TextureEnvParameter::RgbScale;
+ case GL_ALPHA_SCALE:
+ return TextureEnvParameter::AlphaScale;
+ case GL_SRC0_RGB:
+ return TextureEnvParameter::Src0Rgb;
+ case GL_SRC1_RGB:
+ return TextureEnvParameter::Src1Rgb;
+ case GL_SRC2_RGB:
+ return TextureEnvParameter::Src2Rgb;
+ case GL_SRC0_ALPHA:
+ return TextureEnvParameter::Src0Alpha;
+ case GL_SRC1_ALPHA:
+ return TextureEnvParameter::Src1Alpha;
+ case GL_SRC2_ALPHA:
+ return TextureEnvParameter::Src2Alpha;
+ case GL_OPERAND0_RGB:
+ return TextureEnvParameter::Op0Rgb;
+ case GL_OPERAND1_RGB:
+ return TextureEnvParameter::Op1Rgb;
+ case GL_OPERAND2_RGB:
+ return TextureEnvParameter::Op2Rgb;
+ case GL_OPERAND0_ALPHA:
+ return TextureEnvParameter::Op0Alpha;
+ case GL_OPERAND1_ALPHA:
+ return TextureEnvParameter::Op1Alpha;
+ case GL_OPERAND2_ALPHA:
+ return TextureEnvParameter::Op2Alpha;
+ case GL_COORD_REPLACE_OES:
+ return TextureEnvParameter::PointCoordReplace;
+ default:
+ return TextureEnvParameter::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureEnvParameter from)
+{
+ switch (from)
+ {
+ case TextureEnvParameter::Mode:
+ return GL_TEXTURE_ENV_MODE;
+ case TextureEnvParameter::Color:
+ return GL_TEXTURE_ENV_COLOR;
+ case TextureEnvParameter::CombineRgb:
+ return GL_COMBINE_RGB;
+ case TextureEnvParameter::CombineAlpha:
+ return GL_COMBINE_ALPHA;
+ case TextureEnvParameter::RgbScale:
+ return GL_RGB_SCALE;
+ case TextureEnvParameter::AlphaScale:
+ return GL_ALPHA_SCALE;
+ case TextureEnvParameter::Src0Rgb:
+ return GL_SRC0_RGB;
+ case TextureEnvParameter::Src1Rgb:
+ return GL_SRC1_RGB;
+ case TextureEnvParameter::Src2Rgb:
+ return GL_SRC2_RGB;
+ case TextureEnvParameter::Src0Alpha:
+ return GL_SRC0_ALPHA;
+ case TextureEnvParameter::Src1Alpha:
+ return GL_SRC1_ALPHA;
+ case TextureEnvParameter::Src2Alpha:
+ return GL_SRC2_ALPHA;
+ case TextureEnvParameter::Op0Rgb:
+ return GL_OPERAND0_RGB;
+ case TextureEnvParameter::Op1Rgb:
+ return GL_OPERAND1_RGB;
+ case TextureEnvParameter::Op2Rgb:
+ return GL_OPERAND2_RGB;
+ case TextureEnvParameter::Op0Alpha:
+ return GL_OPERAND0_ALPHA;
+ case TextureEnvParameter::Op1Alpha:
+ return GL_OPERAND1_ALPHA;
+ case TextureEnvParameter::Op2Alpha:
+ return GL_OPERAND2_ALPHA;
+ case TextureEnvParameter::PointCoordReplace:
+ return GL_COORD_REPLACE_OES;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureEnvParameter value)
+{
+ switch (value)
+ {
+ case TextureEnvParameter::Mode:
+ os << "GL_TEXTURE_ENV_MODE";
+ break;
+ case TextureEnvParameter::Color:
+ os << "GL_TEXTURE_ENV_COLOR";
+ break;
+ case TextureEnvParameter::CombineRgb:
+ os << "GL_COMBINE_RGB";
+ break;
+ case TextureEnvParameter::CombineAlpha:
+ os << "GL_COMBINE_ALPHA";
+ break;
+ case TextureEnvParameter::RgbScale:
+ os << "GL_RGB_SCALE";
+ break;
+ case TextureEnvParameter::AlphaScale:
+ os << "GL_ALPHA_SCALE";
+ break;
+ case TextureEnvParameter::Src0Rgb:
+ os << "GL_SRC0_RGB";
+ break;
+ case TextureEnvParameter::Src1Rgb:
+ os << "GL_SRC1_RGB";
+ break;
+ case TextureEnvParameter::Src2Rgb:
+ os << "GL_SRC2_RGB";
+ break;
+ case TextureEnvParameter::Src0Alpha:
+ os << "GL_SRC0_ALPHA";
+ break;
+ case TextureEnvParameter::Src1Alpha:
+ os << "GL_SRC1_ALPHA";
+ break;
+ case TextureEnvParameter::Src2Alpha:
+ os << "GL_SRC2_ALPHA";
+ break;
+ case TextureEnvParameter::Op0Rgb:
+ os << "GL_OPERAND0_RGB";
+ break;
+ case TextureEnvParameter::Op1Rgb:
+ os << "GL_OPERAND1_RGB";
+ break;
+ case TextureEnvParameter::Op2Rgb:
+ os << "GL_OPERAND2_RGB";
+ break;
+ case TextureEnvParameter::Op0Alpha:
+ os << "GL_OPERAND0_ALPHA";
+ break;
+ case TextureEnvParameter::Op1Alpha:
+ os << "GL_OPERAND1_ALPHA";
+ break;
+ case TextureEnvParameter::Op2Alpha:
+ os << "GL_OPERAND2_ALPHA";
+ break;
+ case TextureEnvParameter::PointCoordReplace:
+ os << "GL_COORD_REPLACE_OES";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureEnvTarget FromGLenum<TextureEnvTarget>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_TEXTURE_ENV:
+ return TextureEnvTarget::Env;
+ case GL_POINT_SPRITE_OES:
+ return TextureEnvTarget::PointSprite;
+ default:
+ return TextureEnvTarget::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureEnvTarget from)
+{
+ switch (from)
+ {
+ case TextureEnvTarget::Env:
+ return GL_TEXTURE_ENV;
+ case TextureEnvTarget::PointSprite:
+ return GL_POINT_SPRITE_OES;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureEnvTarget value)
+{
+ switch (value)
+ {
+ case TextureEnvTarget::Env:
+ os << "GL_TEXTURE_ENV";
+ break;
+ case TextureEnvTarget::PointSprite:
+ os << "GL_POINT_SPRITE_OES";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureOp FromGLenum<TextureOp>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_ONE_MINUS_SRC_ALPHA:
+ return TextureOp::OneMinusSrcAlpha;
+ case GL_ONE_MINUS_SRC_COLOR:
+ return TextureOp::OneMinusSrcColor;
+ case GL_SRC_ALPHA:
+ return TextureOp::SrcAlpha;
+ case GL_SRC_COLOR:
+ return TextureOp::SrcColor;
+ default:
+ return TextureOp::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureOp from)
+{
+ switch (from)
+ {
+ case TextureOp::OneMinusSrcAlpha:
+ return GL_ONE_MINUS_SRC_ALPHA;
+ case TextureOp::OneMinusSrcColor:
+ return GL_ONE_MINUS_SRC_COLOR;
+ case TextureOp::SrcAlpha:
+ return GL_SRC_ALPHA;
+ case TextureOp::SrcColor:
+ return GL_SRC_COLOR;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureOp value)
+{
+ switch (value)
+ {
+ case TextureOp::OneMinusSrcAlpha:
+ os << "GL_ONE_MINUS_SRC_ALPHA";
+ break;
+ case TextureOp::OneMinusSrcColor:
+ os << "GL_ONE_MINUS_SRC_COLOR";
+ break;
+ case TextureOp::SrcAlpha:
+ os << "GL_SRC_ALPHA";
+ break;
+ case TextureOp::SrcColor:
+ os << "GL_SRC_COLOR";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureSrc FromGLenum<TextureSrc>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_CONSTANT:
+ return TextureSrc::Constant;
+ case GL_PREVIOUS:
+ return TextureSrc::Previous;
+ case GL_PRIMARY_COLOR:
+ return TextureSrc::PrimaryColor;
+ case GL_TEXTURE:
+ return TextureSrc::Texture;
+ default:
+ return TextureSrc::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureSrc from)
+{
+ switch (from)
+ {
+ case TextureSrc::Constant:
+ return GL_CONSTANT;
+ case TextureSrc::Previous:
+ return GL_PREVIOUS;
+ case TextureSrc::PrimaryColor:
+ return GL_PRIMARY_COLOR;
+ case TextureSrc::Texture:
+ return GL_TEXTURE;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureSrc value)
+{
+ switch (value)
+ {
+ case TextureSrc::Constant:
+ os << "GL_CONSTANT";
+ break;
+ case TextureSrc::Previous:
+ os << "GL_PREVIOUS";
+ break;
+ case TextureSrc::PrimaryColor:
+ os << "GL_PRIMARY_COLOR";
+ break;
+ case TextureSrc::Texture:
+ os << "GL_TEXTURE";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureTarget FromGLenum<TextureTarget>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_TEXTURE_2D:
+ return TextureTarget::_2D;
+ case GL_TEXTURE_2D_ARRAY:
+ return TextureTarget::_2DArray;
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ return TextureTarget::_2DMultisample;
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES:
+ return TextureTarget::_2DMultisampleArray;
+ case GL_TEXTURE_3D:
+ return TextureTarget::_3D;
+ case GL_TEXTURE_EXTERNAL_OES:
+ return TextureTarget::External;
+ case GL_TEXTURE_RECTANGLE_ANGLE:
+ return TextureTarget::Rectangle;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ return TextureTarget::CubeMapPositiveX;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ return TextureTarget::CubeMapNegativeX;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ return TextureTarget::CubeMapPositiveY;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ return TextureTarget::CubeMapNegativeY;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ return TextureTarget::CubeMapPositiveZ;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ return TextureTarget::CubeMapNegativeZ;
+ default:
+ return TextureTarget::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureTarget from)
+{
+ switch (from)
+ {
+ case TextureTarget::_2D:
+ return GL_TEXTURE_2D;
+ case TextureTarget::_2DArray:
+ return GL_TEXTURE_2D_ARRAY;
+ case TextureTarget::_2DMultisample:
+ return GL_TEXTURE_2D_MULTISAMPLE;
+ case TextureTarget::_2DMultisampleArray:
+ return GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES;
+ case TextureTarget::_3D:
+ return GL_TEXTURE_3D;
+ case TextureTarget::External:
+ return GL_TEXTURE_EXTERNAL_OES;
+ case TextureTarget::Rectangle:
+ return GL_TEXTURE_RECTANGLE_ANGLE;
+ case TextureTarget::CubeMapPositiveX:
+ return GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+ case TextureTarget::CubeMapNegativeX:
+ return GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
+ case TextureTarget::CubeMapPositiveY:
+ return GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
+ case TextureTarget::CubeMapNegativeY:
+ return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
+ case TextureTarget::CubeMapPositiveZ:
+ return GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
+ case TextureTarget::CubeMapNegativeZ:
+ return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureTarget value)
+{
+ switch (value)
+ {
+ case TextureTarget::_2D:
+ os << "GL_TEXTURE_2D";
+ break;
+ case TextureTarget::_2DArray:
+ os << "GL_TEXTURE_2D_ARRAY";
+ break;
+ case TextureTarget::_2DMultisample:
+ os << "GL_TEXTURE_2D_MULTISAMPLE";
+ break;
+ case TextureTarget::_2DMultisampleArray:
+ os << "GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES";
+ break;
+ case TextureTarget::_3D:
+ os << "GL_TEXTURE_3D";
+ break;
+ case TextureTarget::External:
+ os << "GL_TEXTURE_EXTERNAL_OES";
+ break;
+ case TextureTarget::Rectangle:
+ os << "GL_TEXTURE_RECTANGLE_ANGLE";
+ break;
+ case TextureTarget::CubeMapPositiveX:
+ os << "GL_TEXTURE_CUBE_MAP_POSITIVE_X";
+ break;
+ case TextureTarget::CubeMapNegativeX:
+ os << "GL_TEXTURE_CUBE_MAP_NEGATIVE_X";
+ break;
+ case TextureTarget::CubeMapPositiveY:
+ os << "GL_TEXTURE_CUBE_MAP_POSITIVE_Y";
+ break;
+ case TextureTarget::CubeMapNegativeY:
+ os << "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y";
+ break;
+ case TextureTarget::CubeMapPositiveZ:
+ os << "GL_TEXTURE_CUBE_MAP_POSITIVE_Z";
+ break;
+ case TextureTarget::CubeMapNegativeZ:
+ os << "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+TextureType FromGLenum<TextureType>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_TEXTURE_2D:
+ return TextureType::_2D;
+ case GL_TEXTURE_2D_ARRAY:
+ return TextureType::_2DArray;
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ return TextureType::_2DMultisample;
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES:
+ return TextureType::_2DMultisampleArray;
+ case GL_TEXTURE_3D:
+ return TextureType::_3D;
+ case GL_TEXTURE_EXTERNAL_OES:
+ return TextureType::External;
+ case GL_TEXTURE_RECTANGLE_ANGLE:
+ return TextureType::Rectangle;
+ case GL_TEXTURE_CUBE_MAP:
+ return TextureType::CubeMap;
+ default:
+ return TextureType::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(TextureType from)
+{
+ switch (from)
+ {
+ case TextureType::_2D:
+ return GL_TEXTURE_2D;
+ case TextureType::_2DArray:
+ return GL_TEXTURE_2D_ARRAY;
+ case TextureType::_2DMultisample:
+ return GL_TEXTURE_2D_MULTISAMPLE;
+ case TextureType::_2DMultisampleArray:
+ return GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES;
+ case TextureType::_3D:
+ return GL_TEXTURE_3D;
+ case TextureType::External:
+ return GL_TEXTURE_EXTERNAL_OES;
+ case TextureType::Rectangle:
+ return GL_TEXTURE_RECTANGLE_ANGLE;
+ case TextureType::CubeMap:
+ return GL_TEXTURE_CUBE_MAP;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, TextureType value)
+{
+ switch (value)
+ {
+ case TextureType::_2D:
+ os << "GL_TEXTURE_2D";
+ break;
+ case TextureType::_2DArray:
+ os << "GL_TEXTURE_2D_ARRAY";
+ break;
+ case TextureType::_2DMultisample:
+ os << "GL_TEXTURE_2D_MULTISAMPLE";
+ break;
+ case TextureType::_2DMultisampleArray:
+ os << "GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES";
+ break;
+ case TextureType::_3D:
+ os << "GL_TEXTURE_3D";
+ break;
+ case TextureType::External:
+ os << "GL_TEXTURE_EXTERNAL_OES";
+ break;
+ case TextureType::Rectangle:
+ os << "GL_TEXTURE_RECTANGLE_ANGLE";
+ break;
+ case TextureType::CubeMap:
+ os << "GL_TEXTURE_CUBE_MAP";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+VertexArrayType FromGLenum<VertexArrayType>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_COLOR_ARRAY:
+ return VertexArrayType::Color;
+ case GL_NORMAL_ARRAY:
+ return VertexArrayType::Normal;
+ case GL_POINT_SIZE_ARRAY_OES:
+ return VertexArrayType::PointSize;
+ case GL_TEXTURE_COORD_ARRAY:
+ return VertexArrayType::TextureCoord;
+ case GL_VERTEX_ARRAY:
+ return VertexArrayType::Vertex;
+ default:
+ return VertexArrayType::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(VertexArrayType from)
+{
+ switch (from)
+ {
+ case VertexArrayType::Color:
+ return GL_COLOR_ARRAY;
+ case VertexArrayType::Normal:
+ return GL_NORMAL_ARRAY;
+ case VertexArrayType::PointSize:
+ return GL_POINT_SIZE_ARRAY_OES;
+ case VertexArrayType::TextureCoord:
+ return GL_TEXTURE_COORD_ARRAY;
+ case VertexArrayType::Vertex:
+ return GL_VERTEX_ARRAY;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, VertexArrayType value)
+{
+ switch (value)
+ {
+ case VertexArrayType::Color:
+ os << "GL_COLOR_ARRAY";
+ break;
+ case VertexArrayType::Normal:
+ os << "GL_NORMAL_ARRAY";
+ break;
+ case VertexArrayType::PointSize:
+ os << "GL_POINT_SIZE_ARRAY_OES";
+ break;
+ case VertexArrayType::TextureCoord:
+ os << "GL_TEXTURE_COORD_ARRAY";
+ break;
+ case VertexArrayType::Vertex:
+ os << "GL_VERTEX_ARRAY";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+template <>
+WrapMode FromGLenum<WrapMode>(GLenum from)
+{
+ switch (from)
+ {
+ case GL_CLAMP_TO_EDGE:
+ return WrapMode::ClampToEdge;
+ case GL_CLAMP_TO_BORDER:
+ return WrapMode::ClampToBorder;
+ case GL_MIRRORED_REPEAT:
+ return WrapMode::MirroredRepeat;
+ case GL_REPEAT:
+ return WrapMode::Repeat;
+ default:
+ return WrapMode::InvalidEnum;
+ }
+}
+
+GLenum ToGLenum(WrapMode from)
+{
+ switch (from)
+ {
+ case WrapMode::ClampToEdge:
+ return GL_CLAMP_TO_EDGE;
+ case WrapMode::ClampToBorder:
+ return GL_CLAMP_TO_BORDER;
+ case WrapMode::MirroredRepeat:
+ return GL_MIRRORED_REPEAT;
+ case WrapMode::Repeat:
+ return GL_REPEAT;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::ostream &operator<<(std::ostream &os, WrapMode value)
+{
+ switch (value)
+ {
+ case WrapMode::ClampToEdge:
+ os << "GL_CLAMP_TO_EDGE";
+ break;
+ case WrapMode::ClampToBorder:
+ os << "GL_CLAMP_TO_BORDER";
+ break;
+ case WrapMode::MirroredRepeat:
+ os << "GL_MIRRORED_REPEAT";
+ break;
+ case WrapMode::Repeat:
+ os << "GL_REPEAT";
+ break;
+ default:
+ os << "GL_INVALID_ENUM";
+ break;
+ }
+ return os;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/common/PackedGLEnums_autogen.h b/gfx/angle/checkout/src/common/PackedGLEnums_autogen.h
new file mode 100644
index 0000000000..7b6ae2fe54
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PackedGLEnums_autogen.h
@@ -0,0 +1,581 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_packed_gl_enums.py using data from packed_gl_enums.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PackedGLEnums_autogen.h:
+// Declares ANGLE-specific enums classes for GLenums and functions operating
+// on them.
+
+#ifndef COMMON_PACKEDGLENUMS_AUTOGEN_H_
+#define COMMON_PACKEDGLENUMS_AUTOGEN_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <angle_gl.h>
+
+#include <cstdint>
+#include <ostream>
+
+namespace gl
+{
+
+template <typename Enum>
+Enum FromGLenum(GLenum from);
+
+enum class AlphaTestFunc : uint8_t
+{
+ AlwaysPass = 0,
+ Equal = 1,
+ Gequal = 2,
+ Greater = 3,
+ Lequal = 4,
+ Less = 5,
+ Never = 6,
+ NotEqual = 7,
+
+ InvalidEnum = 8,
+ EnumCount = 8,
+};
+
+template <>
+AlphaTestFunc FromGLenum<AlphaTestFunc>(GLenum from);
+GLenum ToGLenum(AlphaTestFunc from);
+std::ostream &operator<<(std::ostream &os, AlphaTestFunc value);
+
+enum class BufferBinding : uint8_t
+{
+ Array = 0,
+ AtomicCounter = 1,
+ CopyRead = 2,
+ CopyWrite = 3,
+ DispatchIndirect = 4,
+ DrawIndirect = 5,
+ ElementArray = 6,
+ PixelPack = 7,
+ PixelUnpack = 8,
+ ShaderStorage = 9,
+ TransformFeedback = 10,
+ Uniform = 11,
+
+ InvalidEnum = 12,
+ EnumCount = 12,
+};
+
+template <>
+BufferBinding FromGLenum<BufferBinding>(GLenum from);
+GLenum ToGLenum(BufferBinding from);
+std::ostream &operator<<(std::ostream &os, BufferBinding value);
+
+enum class BufferUsage : uint8_t
+{
+ DynamicCopy = 0,
+ DynamicDraw = 1,
+ DynamicRead = 2,
+ StaticCopy = 3,
+ StaticDraw = 4,
+ StaticRead = 5,
+ StreamCopy = 6,
+ StreamDraw = 7,
+ StreamRead = 8,
+
+ InvalidEnum = 9,
+ EnumCount = 9,
+};
+
+template <>
+BufferUsage FromGLenum<BufferUsage>(GLenum from);
+GLenum ToGLenum(BufferUsage from);
+std::ostream &operator<<(std::ostream &os, BufferUsage value);
+
+enum class ClientVertexArrayType : uint8_t
+{
+ Color = 0,
+ Normal = 1,
+ PointSize = 2,
+ TextureCoord = 3,
+ Vertex = 4,
+
+ InvalidEnum = 5,
+ EnumCount = 5,
+};
+
+template <>
+ClientVertexArrayType FromGLenum<ClientVertexArrayType>(GLenum from);
+GLenum ToGLenum(ClientVertexArrayType from);
+std::ostream &operator<<(std::ostream &os, ClientVertexArrayType value);
+
+enum class CullFaceMode : uint8_t
+{
+ Back = 0,
+ Front = 1,
+ FrontAndBack = 2,
+
+ InvalidEnum = 3,
+ EnumCount = 3,
+};
+
+template <>
+CullFaceMode FromGLenum<CullFaceMode>(GLenum from);
+GLenum ToGLenum(CullFaceMode from);
+std::ostream &operator<<(std::ostream &os, CullFaceMode value);
+
+enum class FilterMode : uint8_t
+{
+ Nearest = 0,
+ Linear = 1,
+ NearestMipmapNearest = 2,
+ NearestMipmapLinear = 3,
+ LinearMipmapLinear = 4,
+
+ InvalidEnum = 5,
+ EnumCount = 5,
+};
+
+template <>
+FilterMode FromGLenum<FilterMode>(GLenum from);
+GLenum ToGLenum(FilterMode from);
+std::ostream &operator<<(std::ostream &os, FilterMode value);
+
+enum class FogMode : uint8_t
+{
+ Exp = 0,
+ Exp2 = 1,
+ Linear = 2,
+
+ InvalidEnum = 3,
+ EnumCount = 3,
+};
+
+template <>
+FogMode FromGLenum<FogMode>(GLenum from);
+GLenum ToGLenum(FogMode from);
+std::ostream &operator<<(std::ostream &os, FogMode value);
+
+enum class GraphicsResetStatus : uint8_t
+{
+ NoError = 0,
+ GuiltyContextReset = 1,
+ InnocentContextReset = 2,
+ UnknownContextReset = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+template <>
+GraphicsResetStatus FromGLenum<GraphicsResetStatus>(GLenum from);
+GLenum ToGLenum(GraphicsResetStatus from);
+std::ostream &operator<<(std::ostream &os, GraphicsResetStatus value);
+
+enum class HandleType : uint8_t
+{
+ OpaqueFd = 0,
+
+ InvalidEnum = 1,
+ EnumCount = 1,
+};
+
+template <>
+HandleType FromGLenum<HandleType>(GLenum from);
+GLenum ToGLenum(HandleType from);
+std::ostream &operator<<(std::ostream &os, HandleType value);
+
+enum class HintSetting : uint8_t
+{
+ DontCare = 0,
+ Fastest = 1,
+ Nicest = 2,
+
+ InvalidEnum = 3,
+ EnumCount = 3,
+};
+
+template <>
+HintSetting FromGLenum<HintSetting>(GLenum from);
+GLenum ToGLenum(HintSetting from);
+std::ostream &operator<<(std::ostream &os, HintSetting value);
+
+enum class ImageLayout : uint8_t
+{
+ Undefined = 0,
+ General = 1,
+ ColorAttachment = 2,
+ DepthStencilAttachment = 3,
+ DepthStencilReadOnlyAttachment = 4,
+ ShaderReadOnly = 5,
+ TransferSrc = 6,
+ TransferDst = 7,
+ DepthReadOnlyStencilAttachment = 8,
+ DepthAttachmentStencilReadOnly = 9,
+
+ InvalidEnum = 10,
+ EnumCount = 10,
+};
+
+template <>
+ImageLayout FromGLenum<ImageLayout>(GLenum from);
+GLenum ToGLenum(ImageLayout from);
+std::ostream &operator<<(std::ostream &os, ImageLayout value);
+
+enum class LightParameter : uint8_t
+{
+ Ambient = 0,
+ AmbientAndDiffuse = 1,
+ ConstantAttenuation = 2,
+ Diffuse = 3,
+ LinearAttenuation = 4,
+ Position = 5,
+ QuadraticAttenuation = 6,
+ Specular = 7,
+ SpotCutoff = 8,
+ SpotDirection = 9,
+ SpotExponent = 10,
+
+ InvalidEnum = 11,
+ EnumCount = 11,
+};
+
+template <>
+LightParameter FromGLenum<LightParameter>(GLenum from);
+GLenum ToGLenum(LightParameter from);
+std::ostream &operator<<(std::ostream &os, LightParameter value);
+
+enum class LogicalOperation : uint8_t
+{
+ And = 0,
+ AndInverted = 1,
+ AndReverse = 2,
+ Clear = 3,
+ Copy = 4,
+ CopyInverted = 5,
+ Equiv = 6,
+ Invert = 7,
+ Nand = 8,
+ Noop = 9,
+ Nor = 10,
+ Or = 11,
+ OrInverted = 12,
+ OrReverse = 13,
+ Set = 14,
+ Xor = 15,
+
+ InvalidEnum = 16,
+ EnumCount = 16,
+};
+
+template <>
+LogicalOperation FromGLenum<LogicalOperation>(GLenum from);
+GLenum ToGLenum(LogicalOperation from);
+std::ostream &operator<<(std::ostream &os, LogicalOperation value);
+
+enum class MaterialParameter : uint8_t
+{
+ Ambient = 0,
+ AmbientAndDiffuse = 1,
+ Diffuse = 2,
+ Emission = 3,
+ Shininess = 4,
+ Specular = 5,
+
+ InvalidEnum = 6,
+ EnumCount = 6,
+};
+
+template <>
+MaterialParameter FromGLenum<MaterialParameter>(GLenum from);
+GLenum ToGLenum(MaterialParameter from);
+std::ostream &operator<<(std::ostream &os, MaterialParameter value);
+
+enum class MatrixType : uint8_t
+{
+ Modelview = 0,
+ Projection = 1,
+ Texture = 2,
+
+ InvalidEnum = 3,
+ EnumCount = 3,
+};
+
+template <>
+MatrixType FromGLenum<MatrixType>(GLenum from);
+GLenum ToGLenum(MatrixType from);
+std::ostream &operator<<(std::ostream &os, MatrixType value);
+
+enum class PointParameter : uint8_t
+{
+ PointSizeMin = 0,
+ PointSizeMax = 1,
+ PointFadeThresholdSize = 2,
+ PointDistanceAttenuation = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+template <>
+PointParameter FromGLenum<PointParameter>(GLenum from);
+GLenum ToGLenum(PointParameter from);
+std::ostream &operator<<(std::ostream &os, PointParameter value);
+
+enum class ProvokingVertexConvention : uint8_t
+{
+ FirstVertexConvention = 0,
+ LastVertexConvention = 1,
+
+ InvalidEnum = 2,
+ EnumCount = 2,
+};
+
+template <>
+ProvokingVertexConvention FromGLenum<ProvokingVertexConvention>(GLenum from);
+GLenum ToGLenum(ProvokingVertexConvention from);
+std::ostream &operator<<(std::ostream &os, ProvokingVertexConvention value);
+
+enum class QueryType : uint8_t
+{
+ AnySamples = 0,
+ AnySamplesConservative = 1,
+ CommandsCompleted = 2,
+ PrimitivesGenerated = 3,
+ TimeElapsed = 4,
+ Timestamp = 5,
+ TransformFeedbackPrimitivesWritten = 6,
+
+ InvalidEnum = 7,
+ EnumCount = 7,
+};
+
+template <>
+QueryType FromGLenum<QueryType>(GLenum from);
+GLenum ToGLenum(QueryType from);
+std::ostream &operator<<(std::ostream &os, QueryType value);
+
+enum class ShaderType : uint8_t
+{
+ Vertex = 0,
+ Fragment = 1,
+ Geometry = 2,
+ Compute = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+template <>
+ShaderType FromGLenum<ShaderType>(GLenum from);
+GLenum ToGLenum(ShaderType from);
+std::ostream &operator<<(std::ostream &os, ShaderType value);
+
+enum class ShadingModel : uint8_t
+{
+ Flat = 0,
+ Smooth = 1,
+
+ InvalidEnum = 2,
+ EnumCount = 2,
+};
+
+template <>
+ShadingModel FromGLenum<ShadingModel>(GLenum from);
+GLenum ToGLenum(ShadingModel from);
+std::ostream &operator<<(std::ostream &os, ShadingModel value);
+
+enum class TextureCombine : uint8_t
+{
+ Add = 0,
+ AddSigned = 1,
+ Dot3Rgb = 2,
+ Dot3Rgba = 3,
+ Interpolate = 4,
+ Modulate = 5,
+ Replace = 6,
+ Subtract = 7,
+
+ InvalidEnum = 8,
+ EnumCount = 8,
+};
+
+template <>
+TextureCombine FromGLenum<TextureCombine>(GLenum from);
+GLenum ToGLenum(TextureCombine from);
+std::ostream &operator<<(std::ostream &os, TextureCombine value);
+
+enum class TextureEnvMode : uint8_t
+{
+ Add = 0,
+ Blend = 1,
+ Combine = 2,
+ Decal = 3,
+ Modulate = 4,
+ Replace = 5,
+
+ InvalidEnum = 6,
+ EnumCount = 6,
+};
+
+template <>
+TextureEnvMode FromGLenum<TextureEnvMode>(GLenum from);
+GLenum ToGLenum(TextureEnvMode from);
+std::ostream &operator<<(std::ostream &os, TextureEnvMode value);
+
+enum class TextureEnvParameter : uint8_t
+{
+ Mode = 0,
+ Color = 1,
+ CombineRgb = 2,
+ CombineAlpha = 3,
+ RgbScale = 4,
+ AlphaScale = 5,
+ Src0Rgb = 6,
+ Src1Rgb = 7,
+ Src2Rgb = 8,
+ Src0Alpha = 9,
+ Src1Alpha = 10,
+ Src2Alpha = 11,
+ Op0Rgb = 12,
+ Op1Rgb = 13,
+ Op2Rgb = 14,
+ Op0Alpha = 15,
+ Op1Alpha = 16,
+ Op2Alpha = 17,
+ PointCoordReplace = 18,
+
+ InvalidEnum = 19,
+ EnumCount = 19,
+};
+
+template <>
+TextureEnvParameter FromGLenum<TextureEnvParameter>(GLenum from);
+GLenum ToGLenum(TextureEnvParameter from);
+std::ostream &operator<<(std::ostream &os, TextureEnvParameter value);
+
+enum class TextureEnvTarget : uint8_t
+{
+ Env = 0,
+ PointSprite = 1,
+
+ InvalidEnum = 2,
+ EnumCount = 2,
+};
+
+template <>
+TextureEnvTarget FromGLenum<TextureEnvTarget>(GLenum from);
+GLenum ToGLenum(TextureEnvTarget from);
+std::ostream &operator<<(std::ostream &os, TextureEnvTarget value);
+
+enum class TextureOp : uint8_t
+{
+ OneMinusSrcAlpha = 0,
+ OneMinusSrcColor = 1,
+ SrcAlpha = 2,
+ SrcColor = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+template <>
+TextureOp FromGLenum<TextureOp>(GLenum from);
+GLenum ToGLenum(TextureOp from);
+std::ostream &operator<<(std::ostream &os, TextureOp value);
+
+enum class TextureSrc : uint8_t
+{
+ Constant = 0,
+ Previous = 1,
+ PrimaryColor = 2,
+ Texture = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+template <>
+TextureSrc FromGLenum<TextureSrc>(GLenum from);
+GLenum ToGLenum(TextureSrc from);
+std::ostream &operator<<(std::ostream &os, TextureSrc value);
+
+enum class TextureTarget : uint8_t
+{
+ _2D = 0,
+ _2DArray = 1,
+ _2DMultisample = 2,
+ _2DMultisampleArray = 3,
+ _3D = 4,
+ External = 5,
+ Rectangle = 6,
+ CubeMapPositiveX = 7,
+ CubeMapNegativeX = 8,
+ CubeMapPositiveY = 9,
+ CubeMapNegativeY = 10,
+ CubeMapPositiveZ = 11,
+ CubeMapNegativeZ = 12,
+
+ InvalidEnum = 13,
+ EnumCount = 13,
+};
+
+template <>
+TextureTarget FromGLenum<TextureTarget>(GLenum from);
+GLenum ToGLenum(TextureTarget from);
+std::ostream &operator<<(std::ostream &os, TextureTarget value);
+
+enum class TextureType : uint8_t
+{
+ _2D = 0,
+ _2DArray = 1,
+ _2DMultisample = 2,
+ _2DMultisampleArray = 3,
+ _3D = 4,
+ External = 5,
+ Rectangle = 6,
+ CubeMap = 7,
+
+ InvalidEnum = 8,
+ EnumCount = 8,
+};
+
+template <>
+TextureType FromGLenum<TextureType>(GLenum from);
+GLenum ToGLenum(TextureType from);
+std::ostream &operator<<(std::ostream &os, TextureType value);
+
+enum class VertexArrayType : uint8_t
+{
+ Color = 0,
+ Normal = 1,
+ PointSize = 2,
+ TextureCoord = 3,
+ Vertex = 4,
+
+ InvalidEnum = 5,
+ EnumCount = 5,
+};
+
+template <>
+VertexArrayType FromGLenum<VertexArrayType>(GLenum from);
+GLenum ToGLenum(VertexArrayType from);
+std::ostream &operator<<(std::ostream &os, VertexArrayType value);
+
+enum class WrapMode : uint8_t
+{
+ ClampToEdge = 0,
+ ClampToBorder = 1,
+ MirroredRepeat = 2,
+ Repeat = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+template <>
+WrapMode FromGLenum<WrapMode>(GLenum from);
+GLenum ToGLenum(WrapMode from);
+std::ostream &operator<<(std::ostream &os, WrapMode value);
+
+} // namespace gl
+
+#endif // COMMON_PACKEDGLENUMS_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/common/PoolAlloc.cpp b/gfx/angle/checkout/src/common/PoolAlloc.cpp
new file mode 100644
index 0000000000..b6e3702f8f
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PoolAlloc.cpp
@@ -0,0 +1,334 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PoolAlloc.cpp:
+// Implements the class methods for PoolAllocator and Allocation classes.
+//
+
+#include "common/PoolAlloc.h"
+
+#include <assert.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+#include "common/mathutil.h"
+#include "common/platform.h"
+#include "common/tls.h"
+
+namespace angle
+{
+
+//
+// Implement the functionality of the PoolAllocator class, which
+// is documented in PoolAlloc.h.
+//
+PoolAllocator::PoolAllocator(int growthIncrement, int allocationAlignment)
+ : mAlignment(allocationAlignment),
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ mPageSize(growthIncrement),
+ mFreeList(0),
+ mInUseList(0),
+ mNumCalls(0),
+ mTotalBytes(0),
+#endif
+ mLocked(false)
+{
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ if (mAlignment == 1)
+ {
+ // This is a special fast-path where fastAllocation() is enabled
+ mAlignmentMask = 0;
+ mHeaderSkip = sizeof(Header);
+ }
+ else
+ {
+#endif
+ //
+ // Adjust mAlignment to be at least pointer aligned and
+ // power of 2.
+ //
+ size_t minAlign = sizeof(void *);
+ mAlignment &= ~(minAlign - 1);
+ if (mAlignment < minAlign)
+ mAlignment = minAlign;
+ mAlignment = gl::ceilPow2(mAlignment);
+ mAlignmentMask = mAlignment - 1;
+
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ //
+ // Align header skip
+ //
+ mHeaderSkip = minAlign;
+ if (mHeaderSkip < sizeof(Header))
+ {
+ mHeaderSkip = rx::roundUp(sizeof(Header), mAlignment);
+ }
+ }
+ //
+ // Don't allow page sizes we know are smaller than all common
+ // OS page sizes.
+ //
+ if (mPageSize < 4 * 1024)
+ mPageSize = 4 * 1024;
+ //
+ // A large mCurrentPageOffset indicates a new page needs to
+ // be obtained to allocate memory.
+ //
+ mCurrentPageOffset = mPageSize;
+#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
+ mStack.push_back({});
+#endif
+}
+
+PoolAllocator::~PoolAllocator()
+{
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ while (mInUseList)
+ {
+ Header *next = mInUseList->nextPage;
+ mInUseList->~Header();
+ delete[] reinterpret_cast<char *>(mInUseList);
+ mInUseList = next;
+ }
+ // We should not check the guard blocks
+ // here, because we did it already when the block was
+ // placed into the free list.
+ //
+ while (mFreeList)
+ {
+ Header *next = mFreeList->nextPage;
+ delete[] reinterpret_cast<char *>(mFreeList);
+ mFreeList = next;
+ }
+#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
+ for (auto &allocs : mStack)
+ {
+ for (auto alloc : allocs)
+ {
+ free(alloc);
+ }
+ }
+ mStack.clear();
+#endif
+}
+
+//
+// Check a single guard block for damage
+//
+void Allocation::checkGuardBlock(unsigned char *blockMem,
+ unsigned char val,
+ const char *locText) const
+{
+#if defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ for (size_t x = 0; x < kGuardBlockSize; x++)
+ {
+ if (blockMem[x] != val)
+ {
+ char assertMsg[80];
+ // We don't print the assert message. It's here just to be helpful.
+ snprintf(assertMsg, sizeof(assertMsg),
+ "PoolAlloc: Damage %s %zu byte allocation at 0x%p\n", locText, mSize, data());
+ assert(0 && "PoolAlloc: Damage in guard block");
+ }
+ }
+#endif
+}
+
+void PoolAllocator::push()
+{
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ AllocState state = {mCurrentPageOffset, mInUseList};
+
+ mStack.push_back(state);
+
+ //
+ // Indicate there is no current page to allocate from.
+ //
+ mCurrentPageOffset = mPageSize;
+#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
+ mStack.push_back({});
+#endif
+}
+
+//
+// Do a mass-deallocation of all the individual allocations
+// that have occurred since the last push(), or since the
+// last pop(), or since the object's creation.
+//
+// The deallocated pages are saved for future allocations.
+//
+void PoolAllocator::pop()
+{
+ if (mStack.size() < 1)
+ return;
+
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ Header *page = mStack.back().page;
+ mCurrentPageOffset = mStack.back().offset;
+
+ while (mInUseList != page)
+ {
+ // invoke destructor to free allocation list
+ mInUseList->~Header();
+
+ Header *nextInUse = mInUseList->nextPage;
+ if (mInUseList->pageCount > 1)
+ delete[] reinterpret_cast<char *>(mInUseList);
+ else
+ {
+ mInUseList->nextPage = mFreeList;
+ mFreeList = mInUseList;
+ }
+ mInUseList = nextInUse;
+ }
+
+ mStack.pop_back();
+#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
+ for (auto &alloc : mStack.back())
+ {
+ free(alloc);
+ }
+ mStack.pop_back();
+#endif
+}
+
+//
+// Do a mass-deallocation of all the individual allocations
+// that have occurred.
+//
+void PoolAllocator::popAll()
+{
+ while (mStack.size() > 0)
+ pop();
+}
+
+void *PoolAllocator::allocate(size_t numBytes)
+{
+ ASSERT(!mLocked);
+
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ //
+ // Just keep some interesting statistics.
+ //
+ ++mNumCalls;
+ mTotalBytes += numBytes;
+
+ // If we are using guard blocks, all allocations are bracketed by
+ // them: [guardblock][allocation][guardblock]. numBytes is how
+ // much memory the caller asked for. allocationSize is the total
+ // size including guard blocks. In release build,
+ // kGuardBlockSize=0 and this all gets optimized away.
+ size_t allocationSize = Allocation::AllocationSize(numBytes) + mAlignment;
+ // Detect integer overflow.
+ if (allocationSize < numBytes)
+ return 0;
+
+ //
+ // Do the allocation, most likely case first, for efficiency.
+ // This step could be moved to be inline sometime.
+ //
+ if (allocationSize <= mPageSize - mCurrentPageOffset)
+ {
+ //
+ // Safe to allocate from mCurrentPageOffset.
+ //
+ unsigned char *memory = reinterpret_cast<unsigned char *>(mInUseList) + mCurrentPageOffset;
+ mCurrentPageOffset += allocationSize;
+ mCurrentPageOffset = (mCurrentPageOffset + mAlignmentMask) & ~mAlignmentMask;
+
+ return initializeAllocation(mInUseList, memory, numBytes);
+ }
+
+ if (allocationSize > mPageSize - mHeaderSkip)
+ {
+ //
+ // Do a multi-page allocation. Don't mix these with the others.
+ // The OS is efficient in allocating and freeing multiple pages.
+ //
+ size_t numBytesToAlloc = allocationSize + mHeaderSkip;
+ // Detect integer overflow.
+ if (numBytesToAlloc < allocationSize)
+ return 0;
+
+ Header *memory = reinterpret_cast<Header *>(::new char[numBytesToAlloc]);
+ if (memory == 0)
+ return 0;
+
+ // Use placement-new to initialize header
+ new (memory) Header(mInUseList, (numBytesToAlloc + mPageSize - 1) / mPageSize);
+ mInUseList = memory;
+
+ mCurrentPageOffset = mPageSize; // make next allocation come from a new page
+
+ // No guard blocks for multi-page allocations (yet)
+ void *unalignedPtr =
+ reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(memory) + mHeaderSkip);
+ return std::align(mAlignment, numBytes, unalignedPtr, allocationSize);
+ }
+ unsigned char *newPageAddr =
+ static_cast<unsigned char *>(allocateNewPage(numBytes, allocationSize));
+ return initializeAllocation(mInUseList, newPageAddr, numBytes);
+#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
+ void *alloc = malloc(numBytes + mAlignmentMask);
+ mStack.back().push_back(alloc);
+
+ intptr_t intAlloc = reinterpret_cast<intptr_t>(alloc);
+ intAlloc = (intAlloc + mAlignmentMask) & ~mAlignmentMask;
+ return reinterpret_cast<void *>(intAlloc);
+#endif
+}
+
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+void *PoolAllocator::allocateNewPage(size_t numBytes, size_t allocationSize)
+{
+ //
+ // Need a simple page to allocate from.
+ //
+ Header *memory;
+ if (mFreeList)
+ {
+ memory = mFreeList;
+ mFreeList = mFreeList->nextPage;
+ }
+ else
+ {
+ memory = reinterpret_cast<Header *>(::new char[mPageSize]);
+ if (memory == 0)
+ return 0;
+ }
+ // Use placement-new to initialize header
+ new (memory) Header(mInUseList, 1);
+ mInUseList = memory;
+
+ unsigned char *ret = reinterpret_cast<unsigned char *>(mInUseList) + mHeaderSkip;
+ mCurrentPageOffset = (mHeaderSkip + allocationSize + mAlignmentMask) & ~mAlignmentMask;
+ return ret;
+}
+#endif
+
+void PoolAllocator::lock()
+{
+ ASSERT(!mLocked);
+ mLocked = true;
+}
+
+void PoolAllocator::unlock()
+{
+ ASSERT(mLocked);
+ mLocked = false;
+}
+
+//
+// Check all allocations in a list for damage by calling check on each.
+//
+void Allocation::checkAllocList() const
+{
+ for (const Allocation *alloc = this; alloc != 0; alloc = alloc->mPrevAlloc)
+ alloc->check();
+}
+
+} // namespace angle \ No newline at end of file
diff --git a/gfx/angle/checkout/src/common/PoolAlloc.h b/gfx/angle/checkout/src/common/PoolAlloc.h
new file mode 100644
index 0000000000..1c902bfdd7
--- /dev/null
+++ b/gfx/angle/checkout/src/common/PoolAlloc.h
@@ -0,0 +1,276 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PoolAlloc.h:
+// Defines the class interface for PoolAllocator and the Allocation
+// class that it uses internally.
+//
+
+#ifndef COMMON_POOLALLOC_H_
+#define COMMON_POOLALLOC_H_
+
+#if !defined(NDEBUG)
+# define ANGLE_POOL_ALLOC_GUARD_BLOCKS // define to enable guard block sanity checking
+#endif
+
+//
+// This header defines an allocator that can be used to efficiently
+// allocate a large number of small requests for heap memory, with the
+// intention that they are not individually deallocated, but rather
+// collectively deallocated at one time.
+//
+// This simultaneously
+//
+// * Makes each individual allocation much more efficient; the
+// typical allocation is trivial.
+// * Completely avoids the cost of doing individual deallocation.
+// * Saves the trouble of tracking down and plugging a large class of leaks.
+//
+// Individual classes can use this allocator by supplying their own
+// new and delete methods.
+//
+
+#include <stddef.h>
+#include <string.h>
+#include <memory>
+#include <vector>
+
+#include "angleutils.h"
+#include "common/debug.h"
+
+namespace angle
+{
+// If we are using guard blocks, we must track each individual
+// allocation. If we aren't using guard blocks, these
+// never get instantiated, so won't have any impact.
+//
+
+class Allocation
+{
+ public:
+ Allocation(size_t size, unsigned char *mem, Allocation *prev = 0)
+ : mSize(size), mMem(mem), mPrevAlloc(prev)
+ {
+// Allocations are bracketed:
+// [allocationHeader][initialGuardBlock][userData][finalGuardBlock]
+// This would be cleaner with if (kGuardBlockSize)..., but that
+// makes the compiler print warnings about 0 length memsets,
+// even with the if() protecting them.
+#if defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ memset(preGuard(), kGuardBlockBeginVal, kGuardBlockSize);
+ memset(data(), kUserDataFill, mSize);
+ memset(postGuard(), kGuardBlockEndVal, kGuardBlockSize);
+#endif
+ }
+
+ void check() const
+ {
+ checkGuardBlock(preGuard(), kGuardBlockBeginVal, "before");
+ checkGuardBlock(postGuard(), kGuardBlockEndVal, "after");
+ }
+
+ void checkAllocList() const;
+
+ // Return total size needed to accommodate user buffer of 'size',
+ // plus our tracking data.
+ static size_t AllocationSize(size_t size) { return size + 2 * kGuardBlockSize + HeaderSize(); }
+
+ // Offset from surrounding buffer to get to user data buffer.
+ static unsigned char *OffsetAllocation(unsigned char *m)
+ {
+ return m + kGuardBlockSize + HeaderSize();
+ }
+
+ private:
+ void checkGuardBlock(unsigned char *blockMem, unsigned char val, const char *locText) const;
+
+ // Find offsets to pre and post guard blocks, and user data buffer
+ unsigned char *preGuard() const { return mMem + HeaderSize(); }
+ unsigned char *data() const { return preGuard() + kGuardBlockSize; }
+ unsigned char *postGuard() const { return data() + mSize; }
+ size_t mSize; // size of the user data area
+ unsigned char *mMem; // beginning of our allocation (pts to header)
+ Allocation *mPrevAlloc; // prior allocation in the chain
+
+ static constexpr unsigned char kGuardBlockBeginVal = 0xfb;
+ static constexpr unsigned char kGuardBlockEndVal = 0xfe;
+ static constexpr unsigned char kUserDataFill = 0xcd;
+#if defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ static constexpr size_t kGuardBlockSize = 16;
+ static constexpr size_t HeaderSize() { return sizeof(Allocation); }
+#else
+ static constexpr size_t kGuardBlockSize = 0;
+ static constexpr size_t HeaderSize() { return 0; }
+#endif
+};
+
+//
+// There are several stacks. One is to track the pushing and popping
+// of the user, and not yet implemented. The others are simply a
+// repositories of free pages or used pages.
+//
+// Page stacks are linked together with a simple header at the beginning
+// of each allocation obtained from the underlying OS. Multi-page allocations
+// are returned to the OS. Individual page allocations are kept for future
+// re-use.
+//
+// The "page size" used is not, nor must it match, the underlying OS
+// page size. But, having it be about that size or equal to a set of
+// pages is likely most optimal.
+//
+class PoolAllocator : angle::NonCopyable
+{
+ public:
+ static const int kDefaultAlignment = 16;
+ //
+ // Create PoolAllocator. If alignment is be set to 1 byte then fastAllocate()
+ // function can be used to make allocations with less overhead.
+ //
+ PoolAllocator(int growthIncrement = 8 * 1024, int allocationAlignment = kDefaultAlignment);
+
+ //
+ // Don't call the destructor just to free up the memory, call pop()
+ //
+ ~PoolAllocator();
+
+ //
+ // Call push() to establish a new place to pop memory to. Does not
+ // have to be called to get things started.
+ //
+ void push();
+
+ //
+ // Call pop() to free all memory allocated since the last call to push(),
+ // or if no last call to push, frees all memory since first allocation.
+ //
+ void pop();
+
+ //
+ // Call popAll() to free all memory allocated.
+ //
+ void popAll();
+
+ //
+ // Call allocate() to actually acquire memory. Returns 0 if no memory
+ // available, otherwise a properly aligned pointer to 'numBytes' of memory.
+ //
+ void *allocate(size_t numBytes);
+
+ //
+ // Call fastAllocate() for a faster allocate function that does minimal bookkeeping
+ // preCondition: Allocator must have been created w/ alignment of 1
+ ANGLE_INLINE uint8_t *fastAllocate(size_t numBytes)
+ {
+#if defined(ANGLE_DISABLE_POOL_ALLOC)
+ return reinterpret_cast<uint8_t *>(allocate(numBytes));
+#else
+ ASSERT(mAlignment == 1);
+ // No multi-page allocations
+ ASSERT(numBytes <= (mPageSize - mHeaderSkip));
+ //
+ // Do the allocation, most likely case inline first, for efficiency.
+ //
+ if (numBytes <= mPageSize - mCurrentPageOffset)
+ {
+ //
+ // Safe to allocate from mCurrentPageOffset.
+ //
+ uint8_t *memory = reinterpret_cast<uint8_t *>(mInUseList) + mCurrentPageOffset;
+ mCurrentPageOffset += numBytes;
+ return memory;
+ }
+ return reinterpret_cast<uint8_t *>(allocateNewPage(numBytes, numBytes));
+#endif
+ }
+
+ //
+ // There is no deallocate. The point of this class is that
+ // deallocation can be skipped by the user of it, as the model
+ // of use is to simultaneously deallocate everything at once
+ // by calling pop(), and to not have to solve memory leak problems.
+ //
+
+ // Catch unwanted allocations.
+ // TODO(jmadill): Remove this when we remove the global allocator.
+ void lock();
+ void unlock();
+
+ private:
+ size_t mAlignment; // all returned allocations will be aligned at
+ // this granularity, which will be a power of 2
+ size_t mAlignmentMask;
+#if !defined(ANGLE_DISABLE_POOL_ALLOC)
+ friend struct Header;
+
+ struct Header
+ {
+ Header(Header *nextPage, size_t pageCount)
+ : nextPage(nextPage),
+ pageCount(pageCount)
+# if defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ ,
+ lastAllocation(0)
+# endif
+ {}
+
+ ~Header()
+ {
+# if defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ if (lastAllocation)
+ lastAllocation->checkAllocList();
+# endif
+ }
+
+ Header *nextPage;
+ size_t pageCount;
+# if defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ Allocation *lastAllocation;
+# endif
+ };
+
+ struct AllocState
+ {
+ size_t offset;
+ Header *page;
+ };
+ using AllocStack = std::vector<AllocState>;
+
+ // Slow path of allocation when we have to get a new page.
+ void *allocateNewPage(size_t numBytes, size_t allocationSize);
+ // Track allocations if and only if we're using guard blocks
+ void *initializeAllocation(Header *block, unsigned char *memory, size_t numBytes)
+ {
+# if defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ new (memory) Allocation(numBytes + mAlignment, memory, block->lastAllocation);
+ block->lastAllocation = reinterpret_cast<Allocation *>(memory);
+# endif
+ // The OffsetAllocation() call is optimized away if !defined(ANGLE_POOL_ALLOC_GUARD_BLOCKS)
+ void *unalignedPtr = Allocation::OffsetAllocation(memory);
+ size_t alignedBytes = numBytes + mAlignment;
+ return std::align(mAlignment, numBytes, unalignedPtr, alignedBytes);
+ }
+
+ size_t mPageSize; // granularity of allocation from the OS
+ size_t mHeaderSkip; // amount of memory to skip to make room for the
+ // header (basically, size of header, rounded
+ // up to make it aligned
+ size_t mCurrentPageOffset; // next offset in top of inUseList to allocate from
+ Header *mFreeList; // list of popped memory
+ Header *mInUseList; // list of all memory currently being used
+ AllocStack mStack; // stack of where to allocate from, to partition pool
+
+ int mNumCalls; // just an interesting statistic
+ size_t mTotalBytes; // just an interesting statistic
+
+#else // !defined(ANGLE_DISABLE_POOL_ALLOC)
+ std::vector<std::vector<void *>> mStack;
+#endif
+
+ bool mLocked;
+};
+
+} // namespace angle
+
+#endif // COMMON_POOLALLOC_H_
diff --git a/gfx/angle/checkout/src/common/aligned_memory.cpp b/gfx/angle/checkout/src/common/aligned_memory.cpp
new file mode 100644
index 0000000000..70a730ef62
--- /dev/null
+++ b/gfx/angle/checkout/src/common/aligned_memory.cpp
@@ -0,0 +1,64 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// aligned_memory: An aligned memory allocator. Based on Chrome's base/memory/aligned_memory.
+//
+
+#include "common/aligned_memory.h"
+
+#include "common/debug.h"
+#include "common/platform.h"
+
+#if defined(COMPILER_MSVC)
+# include <malloc.h>
+#else
+# include <stdlib.h>
+#endif
+
+namespace angle
+{
+
+void *AlignedAlloc(size_t size, size_t alignment)
+{
+ ASSERT(size > 0);
+ ASSERT((alignment & (alignment - 1)) == 0);
+ ASSERT((alignment % sizeof(void *)) == 0);
+ void *ptr = nullptr;
+#if defined(ANGLE_PLATFORM_WINDOWS)
+ ptr = _aligned_malloc(size, alignment);
+// Android technically supports posix_memalign(), but does not expose it in
+// the current version of the library headers used by Chrome. Luckily,
+// memalign() on Android returns pointers which can safely be used with
+// free(), so we can use it instead. Issue filed to document this:
+// http://code.google.com/p/android/issues/detail?id=35391
+#elif defined(ANGLE_PLATFORM_ANDROID)
+ ptr = memalign(alignment, size);
+#else
+ if (posix_memalign(&ptr, alignment, size))
+ ptr = nullptr;
+#endif
+ // Since aligned allocations may fail for non-memory related reasons, force a
+ // crash if we encounter a failed allocation.
+ if (!ptr)
+ {
+ ERR() << "If you crashed here, your aligned allocation is incorrect: "
+ << "size=" << size << ", alignment=" << alignment;
+ ASSERT(false);
+ }
+ // Sanity check alignment just to be safe.
+ ASSERT((reinterpret_cast<uintptr_t>(ptr) & (alignment - 1)) == 0);
+ return ptr;
+}
+
+void AlignedFree(void *ptr)
+{
+#if defined(_MSC_VER)
+ _aligned_free(ptr);
+#else
+ free(ptr);
+#endif
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/aligned_memory.h b/gfx/angle/checkout/src/common/aligned_memory.h
new file mode 100644
index 0000000000..dcbb60d1cb
--- /dev/null
+++ b/gfx/angle/checkout/src/common/aligned_memory.h
@@ -0,0 +1,23 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// aligned_memory: An aligned memory allocator. Based on Chrome's base/memory/aligned_memory.
+//
+
+#ifndef COMMON_ALIGNED_MEMORY_H_
+#define COMMON_ALIGNED_MEMORY_H_
+
+#include <cstddef>
+
+namespace angle
+{
+
+// This can be replaced with std::aligned_malloc when we have C++17.
+void *AlignedAlloc(size_t size, size_t alignment);
+void AlignedFree(void *ptr);
+
+} // namespace angle
+
+#endif // COMMON_ALIGNED_MEMORY_H_
diff --git a/gfx/angle/checkout/src/common/android_util.cpp b/gfx/angle/checkout/src/common/android_util.cpp
new file mode 100644
index 0000000000..38e0d4fbe3
--- /dev/null
+++ b/gfx/angle/checkout/src/common/android_util.cpp
@@ -0,0 +1,268 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// android_util.cpp: Utilities for the using the Android platform
+
+#include "common/android_util.h"
+
+#include <cstdint>
+
+// Taken from cutils/native_handle.h:
+// https://android.googlesource.com/platform/system/core/+/master/libcutils/include/cutils/native_handle.h
+typedef struct native_handle
+{
+ int version; /* sizeof(native_handle_t) */
+ int numFds; /* number of file-descriptors at &data[0] */
+ int numInts; /* number of ints at &data[numFds] */
+ int data[0]; /* numFds + numInts ints */
+} native_handle_t;
+
+// Taken from nativebase/nativebase.h
+// https://android.googlesource.com/platform/frameworks/native/+/master/libs/nativebase/include/nativebase/nativebase.h
+typedef const native_handle_t *buffer_handle_t;
+
+typedef struct android_native_base_t
+{
+ /* a magic value defined by the actual EGL native type */
+ int magic;
+ /* the sizeof() of the actual EGL native type */
+ int version;
+ void *reserved[4];
+ /* reference-counting interface */
+ void (*incRef)(struct android_native_base_t *base);
+ void (*decRef)(struct android_native_base_t *base);
+} android_native_base_t;
+
+typedef struct ANativeWindowBuffer
+{
+ struct android_native_base_t common;
+ int width;
+ int height;
+ int stride;
+ int format;
+ int usage_deprecated;
+ uintptr_t layerCount;
+ void *reserved[1];
+ const native_handle_t *handle;
+ uint64_t usage;
+ // we needed extra space for storing the 64-bits usage flags
+ // the number of slots to use from reserved_proc depends on the
+ // architecture.
+ void *reserved_proc[8 - (sizeof(uint64_t) / sizeof(void *))];
+} ANativeWindowBuffer_t;
+
+// Taken from android/hardware_buffer.h
+// https://android.googlesource.com/platform/frameworks/native/+/master/libs/nativewindow/include/android/hardware_buffer.h
+
+// AHARDWAREBUFFER_FORMAT_B8G8R8A8_UNORM AHARDWAREBUFFER_FORMAT_B4G4R4A4_UNORM,
+// AHARDWAREBUFFER_FORMAT_B5G5R5A1_UNORM formats were deprecated and re-added explicitly.
+
+// clang-format off
+/**
+ * Buffer pixel formats.
+ */
+enum {
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_R8G8B8A8_UNORM
+ * OpenGL ES: GL_RGBA8
+ */
+ AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM = 1,
+
+ /**
+ * 32 bits per pixel, 8 bits per channel format where alpha values are
+ * ignored (always opaque).
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_R8G8B8A8_UNORM
+ * OpenGL ES: GL_RGB8
+ */
+ AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM = 2,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_R8G8B8_UNORM
+ * OpenGL ES: GL_RGB8
+ */
+ AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM = 3,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_R5G6B5_UNORM_PACK16
+ * OpenGL ES: GL_RGB565
+ */
+ AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM = 4,
+
+ AHARDWAREBUFFER_FORMAT_B8G8R8A8_UNORM = 5,
+ AHARDWAREBUFFER_FORMAT_B5G5R5A1_UNORM = 6,
+ AHARDWAREBUFFER_FORMAT_B4G4R4A4_UNORM = 7,
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_R16G16B16A16_SFLOAT
+ * OpenGL ES: GL_RGBA16F
+ */
+ AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT = 0x16,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_A2B10G10R10_UNORM_PACK32
+ * OpenGL ES: GL_RGB10_A2
+ */
+ AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM = 0x2b,
+
+ /**
+ * An opaque binary blob format that must have height 1, with width equal to
+ * the buffer size in bytes.
+ */
+ AHARDWAREBUFFER_FORMAT_BLOB = 0x21,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_D16_UNORM
+ * OpenGL ES: GL_DEPTH_COMPONENT16
+ */
+ AHARDWAREBUFFER_FORMAT_D16_UNORM = 0x30,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_X8_D24_UNORM_PACK32
+ * OpenGL ES: GL_DEPTH_COMPONENT24
+ */
+ AHARDWAREBUFFER_FORMAT_D24_UNORM = 0x31,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_D24_UNORM_S8_UINT
+ * OpenGL ES: GL_DEPTH24_STENCIL8
+ */
+ AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT = 0x32,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_D32_SFLOAT
+ * OpenGL ES: GL_DEPTH_COMPONENT32F
+ */
+ AHARDWAREBUFFER_FORMAT_D32_FLOAT = 0x33,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_D32_SFLOAT_S8_UINT
+ * OpenGL ES: GL_DEPTH32F_STENCIL8
+ */
+ AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT = 0x34,
+
+ /**
+ * Corresponding formats:
+ * Vulkan: VK_FORMAT_S8_UINT
+ * OpenGL ES: GL_STENCIL_INDEX8
+ */
+ AHARDWAREBUFFER_FORMAT_S8_UINT = 0x35,
+};
+// clang-format on
+
+namespace
+{
+
+// In the Android system:
+// - AHardwareBuffer is essentially a typedef of GraphicBuffer. Conversion functions simply
+// reinterpret_cast.
+// - GraphicBuffer inherits from two base classes, ANativeWindowBuffer and RefBase.
+//
+// GraphicBuffer implements a getter for ANativeWindowBuffer (getNativeBuffer) by static_casting
+// itself to its base class ANativeWindowBuffer. The offset of the ANativeWindowBuffer pointer
+// from the GraphicBuffer pointer is 16 bytes. This is likely due to two pointers: The vtable of
+// GraphicBuffer and the one pointer member of the RefBase class.
+//
+// This is not future proof at all. We need to look into getting utilities added to Android to
+// perform this cast for us.
+constexpr int kAHardwareBufferToANativeWindowBufferOffset = static_cast<int>(sizeof(void *)) * 2;
+
+template <typename T1, typename T2>
+T1 *offsetPointer(T2 *ptr, int bytes)
+{
+ return reinterpret_cast<T1 *>(reinterpret_cast<intptr_t>(ptr) + bytes);
+}
+
+} // anonymous namespace
+
+namespace angle
+{
+
+namespace android
+{
+
+ANativeWindowBuffer *ClientBufferToANativeWindowBuffer(EGLClientBuffer clientBuffer)
+{
+ return reinterpret_cast<ANativeWindowBuffer *>(clientBuffer);
+}
+
+void GetANativeWindowBufferProperties(const ANativeWindowBuffer *buffer,
+ int *width,
+ int *height,
+ int *depth,
+ int *pixelFormat)
+{
+ *width = buffer->width;
+ *height = buffer->height;
+ *depth = static_cast<int>(buffer->layerCount);
+ *height = buffer->height;
+ *pixelFormat = buffer->format;
+}
+
+GLenum NativePixelFormatToGLInternalFormat(int pixelFormat)
+{
+ switch (pixelFormat)
+ {
+ case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
+ return GL_RGBA8;
+ case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM:
+ return GL_RGB8;
+ case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
+ return GL_RGB8;
+ case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
+ return GL_RGB565;
+ case AHARDWAREBUFFER_FORMAT_B8G8R8A8_UNORM:
+ return GL_BGRA8_EXT;
+ case AHARDWAREBUFFER_FORMAT_B5G5R5A1_UNORM:
+ return GL_RGB5_A1;
+ case AHARDWAREBUFFER_FORMAT_B4G4R4A4_UNORM:
+ return GL_RGBA4;
+ case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT:
+ return GL_RGBA16F;
+ case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM:
+ return GL_RGB10_A2;
+ case AHARDWAREBUFFER_FORMAT_BLOB:
+ return GL_NONE;
+ case AHARDWAREBUFFER_FORMAT_D16_UNORM:
+ return GL_DEPTH_COMPONENT16;
+ case AHARDWAREBUFFER_FORMAT_D24_UNORM:
+ return GL_DEPTH_COMPONENT24;
+ case AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT:
+ return GL_DEPTH24_STENCIL8;
+ case AHARDWAREBUFFER_FORMAT_D32_FLOAT:
+ return GL_DEPTH_COMPONENT32F;
+ case AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT:
+ return GL_DEPTH32F_STENCIL8;
+ case AHARDWAREBUFFER_FORMAT_S8_UINT:
+ return GL_STENCIL_INDEX8;
+ default:
+ return GL_NONE;
+ }
+}
+
+AHardwareBuffer *ANativeWindowBufferToAHardwareBuffer(ANativeWindowBuffer *windowBuffer)
+{
+ return offsetPointer<AHardwareBuffer>(windowBuffer,
+ -kAHardwareBufferToANativeWindowBufferOffset);
+}
+
+EGLClientBuffer AHardwareBufferToClientBuffer(const AHardwareBuffer *hardwareBuffer)
+{
+ return offsetPointer<EGLClientBuffer>(hardwareBuffer,
+ kAHardwareBufferToANativeWindowBufferOffset);
+}
+
+} // namespace android
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/android_util.h b/gfx/angle/checkout/src/common/android_util.h
new file mode 100644
index 0000000000..9826c4ab61
--- /dev/null
+++ b/gfx/angle/checkout/src/common/android_util.h
@@ -0,0 +1,39 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// android_util.h: Utilities for the using the Android platform
+
+#ifndef COMMON_ANDROIDUTIL_H_
+#define COMMON_ANDROIDUTIL_H_
+
+#include <EGL/egl.h>
+#include "angle_gl.h"
+
+struct ANativeWindowBuffer;
+struct AHardwareBuffer;
+
+namespace angle
+{
+
+namespace android
+{
+
+ANativeWindowBuffer *ClientBufferToANativeWindowBuffer(EGLClientBuffer clientBuffer);
+EGLClientBuffer AHardwareBufferToClientBuffer(const AHardwareBuffer *hardwareBuffer);
+
+void GetANativeWindowBufferProperties(const ANativeWindowBuffer *buffer,
+ int *width,
+ int *height,
+ int *depth,
+ int *pixelFormat);
+GLenum NativePixelFormatToGLInternalFormat(int pixelFormat);
+
+AHardwareBuffer *ANativeWindowBufferToAHardwareBuffer(ANativeWindowBuffer *windowBuffer);
+
+} // namespace android
+} // namespace angle
+
+#endif // COMMON_ANDROIDUTIL_H_
diff --git a/gfx/angle/checkout/src/common/angleutils.cpp b/gfx/angle/checkout/src/common/angleutils.cpp
new file mode 100644
index 0000000000..5b7836d32d
--- /dev/null
+++ b/gfx/angle/checkout/src/common/angleutils.cpp
@@ -0,0 +1,74 @@
+//
+// 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 "common/angleutils.h"
+#include "common/debug.h"
+
+#include <stdio.h>
+
+#include <limits>
+#include <vector>
+
+namespace angle
+{
+// dirtyPointer is a special value that will make the comparison with any valid pointer fail and
+// force the renderer to re-apply the state.
+const uintptr_t DirtyPointer = std::numeric_limits<uintptr_t>::max();
+} // namespace angle
+
+std::string ArrayString(unsigned int i)
+{
+ // We assume that UINT_MAX and GL_INVALID_INDEX are equal.
+ ASSERT(i != UINT_MAX);
+
+ std::stringstream strstr;
+ strstr << "[";
+ strstr << i;
+ strstr << "]";
+ return strstr.str();
+}
+
+std::string ArrayIndexString(const std::vector<unsigned int> &indices)
+{
+ std::stringstream strstr;
+
+ for (auto indicesIt = indices.rbegin(); indicesIt != indices.rend(); ++indicesIt)
+ {
+ // We assume that UINT_MAX and GL_INVALID_INDEX are equal.
+ ASSERT(*indicesIt != UINT_MAX);
+ strstr << "[";
+ strstr << (*indicesIt);
+ strstr << "]";
+ }
+
+ return strstr.str();
+}
+
+size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char> &outBuffer)
+{
+ // The state of the va_list passed to vsnprintf is undefined after the call, do a copy in case
+ // we need to grow the buffer.
+ va_list varargCopy;
+ va_copy(varargCopy, vararg);
+
+ // Attempt to just print to the current buffer
+ int len = vsnprintf(&(outBuffer.front()), outBuffer.size(), fmt, varargCopy);
+ va_end(varargCopy);
+
+ if (len < 0 || static_cast<size_t>(len) >= outBuffer.size())
+ {
+ // Buffer was not large enough, calculate the required size and resize the buffer
+ len = vsnprintf(nullptr, 0, fmt, vararg);
+ outBuffer.resize(len + 1);
+
+ // Print again
+ va_copy(varargCopy, vararg);
+ len = vsnprintf(&(outBuffer.front()), outBuffer.size(), fmt, varargCopy);
+ va_end(varargCopy);
+ }
+ ASSERT(len >= 0);
+ return static_cast<size_t>(len);
+}
diff --git a/gfx/angle/checkout/src/common/angleutils.h b/gfx/angle/checkout/src/common/angleutils.h
new file mode 100644
index 0000000000..09adb58892
--- /dev/null
+++ b/gfx/angle/checkout/src/common/angleutils.h
@@ -0,0 +1,333 @@
+//
+// 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.
+//
+
+// angleutils.h: Common ANGLE utilities.
+
+#ifndef COMMON_ANGLEUTILS_H_
+#define COMMON_ANGLEUTILS_H_
+
+#include "common/platform.h"
+
+#include <climits>
+#include <cstdarg>
+#include <cstddef>
+#include <set>
+#include <sstream>
+#include <string>
+#include <vector>
+
+// A helper class to disallow copy and assignment operators
+namespace angle
+{
+
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+using Microsoft::WRL::ComPtr;
+#endif // defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+
+class NonCopyable
+{
+ protected:
+ constexpr NonCopyable() = default;
+ ~NonCopyable() = default;
+
+ private:
+ NonCopyable(const NonCopyable &) = delete;
+ void operator=(const NonCopyable &) = delete;
+};
+
+extern const uintptr_t DirtyPointer;
+
+} // namespace angle
+
+template <typename T, size_t N>
+constexpr inline size_t ArraySize(T (&)[N])
+{
+ return N;
+}
+
+template <typename T>
+class WrappedArray final : angle::NonCopyable
+{
+ public:
+ template <size_t N>
+ constexpr WrappedArray(const T (&data)[N]) : mArray(&data[0]), mSize(N)
+ {}
+
+ constexpr WrappedArray() : mArray(nullptr), mSize(0) {}
+ constexpr WrappedArray(const T *data, size_t size) : mArray(data), mSize(size) {}
+
+ WrappedArray(WrappedArray &&other) : WrappedArray()
+ {
+ std::swap(mArray, other.mArray);
+ std::swap(mSize, other.mSize);
+ }
+
+ ~WrappedArray() {}
+
+ constexpr const T *get() const { return mArray; }
+ constexpr size_t size() const { return mSize; }
+
+ private:
+ const T *mArray;
+ size_t mSize;
+};
+
+template <typename T, unsigned int N>
+void SafeRelease(T (&resourceBlock)[N])
+{
+ for (unsigned int i = 0; i < N; i++)
+ {
+ SafeRelease(resourceBlock[i]);
+ }
+}
+
+template <typename T>
+void SafeRelease(T &resource)
+{
+ if (resource)
+ {
+ resource->Release();
+ resource = nullptr;
+ }
+}
+
+template <typename T>
+void SafeDelete(T *&resource)
+{
+ delete resource;
+ resource = nullptr;
+}
+
+template <typename T>
+void SafeDeleteContainer(T &resource)
+{
+ for (auto &element : resource)
+ {
+ SafeDelete(element);
+ }
+ resource.clear();
+}
+
+template <typename T>
+void SafeDeleteArray(T *&resource)
+{
+ delete[] resource;
+ resource = nullptr;
+}
+
+// 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));
+}
+
+template <typename T>
+inline bool IsMaskFlagSet(T mask, T flag)
+{
+ // Handles multibit flags as well
+ return (mask & flag) == flag;
+}
+
+inline const char *MakeStaticString(const std::string &str)
+{
+ // On the heap so that no destructor runs on application exit.
+ static std::set<std::string> *strings = new std::set<std::string>;
+ std::set<std::string>::iterator it = strings->find(str);
+ if (it != strings->end())
+ {
+ return it->c_str();
+ }
+
+ return strings->insert(str).first->c_str();
+}
+
+std::string ArrayString(unsigned int i);
+
+// Indices are stored in vectors with the outermost index in the back. In the output of the function
+// the indices are reversed.
+std::string ArrayIndexString(const std::vector<unsigned int> &indices);
+
+inline std::string Str(int i)
+{
+ std::stringstream strstr;
+ strstr << i;
+ return strstr.str();
+}
+
+size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char> &buffer);
+
+template <typename T>
+std::string ToString(const T &value)
+{
+ std::ostringstream o;
+ o << value;
+ return o.str();
+}
+
+// snprintf is not defined with MSVC prior to to msvc14
+#if defined(_MSC_VER) && _MSC_VER < 1900
+# define snprintf _snprintf
+#endif
+
+#define GL_A1RGB5_ANGLEX 0x6AC5
+#define GL_BGRX8_ANGLEX 0x6ABA
+#define GL_BGR565_ANGLEX 0x6ABB
+#define GL_BGRA4_ANGLEX 0x6ABC
+#define GL_BGR5_A1_ANGLEX 0x6ABD
+#define GL_INT_64_ANGLEX 0x6ABE
+#define GL_UINT_64_ANGLEX 0x6ABF
+#define GL_BGRA8_SRGB_ANGLEX 0x6AC0
+
+// These are dummy formats used to fit typeless D3D textures that can be bound to EGL pbuffers into
+// the format system (for extension EGL_ANGLE_d3d_texture_client_buffer):
+#define GL_RGBA8_TYPELESS_ANGLEX 0x6AC1
+#define GL_RGBA8_TYPELESS_SRGB_ANGLEX 0x6AC2
+#define GL_BGRA8_TYPELESS_ANGLEX 0x6AC3
+#define GL_BGRA8_TYPELESS_SRGB_ANGLEX 0x6AC4
+
+#define GL_R8_SSCALED_ANGLEX 0x6AC6
+#define GL_RG8_SSCALED_ANGLEX 0x6AC7
+#define GL_RGB8_SSCALED_ANGLEX 0x6AC8
+#define GL_RGBA8_SSCALED_ANGLEX 0x6AC9
+#define GL_R8_USCALED_ANGLEX 0x6ACA
+#define GL_RG8_USCALED_ANGLEX 0x6ACB
+#define GL_RGB8_USCALED_ANGLEX 0x6ACC
+#define GL_RGBA8_USCALED_ANGLEX 0x6ACD
+
+#define GL_R16_SSCALED_ANGLEX 0x6ACE
+#define GL_RG16_SSCALED_ANGLEX 0x6ACF
+#define GL_RGB16_SSCALED_ANGLEX 0x6AD0
+#define GL_RGBA16_SSCALED_ANGLEX 0x6AD1
+#define GL_R16_USCALED_ANGLEX 0x6AD2
+#define GL_RG16_USCALED_ANGLEX 0x6AD3
+#define GL_RGB16_USCALED_ANGLEX 0x6AD4
+#define GL_RGBA16_USCALED_ANGLEX 0x6AD5
+
+#define GL_R32_SSCALED_ANGLEX 0x6AD6
+#define GL_RG32_SSCALED_ANGLEX 0x6AD7
+#define GL_RGB32_SSCALED_ANGLEX 0x6AD8
+#define GL_RGBA32_SSCALED_ANGLEX 0x6AD9
+#define GL_R32_USCALED_ANGLEX 0x6ADA
+#define GL_RG32_USCALED_ANGLEX 0x6ADB
+#define GL_RGB32_USCALED_ANGLEX 0x6ADC
+#define GL_RGBA32_USCALED_ANGLEX 0x6ADD
+
+#define GL_R32_SNORM_ANGLEX 0x6ADE
+#define GL_RG32_SNORM_ANGLEX 0x6ADF
+#define GL_RGB32_SNORM_ANGLEX 0x6AE0
+#define GL_RGBA32_SNORM_ANGLEX 0x6AE1
+#define GL_R32_UNORM_ANGLEX 0x6AE2
+#define GL_RG32_UNORM_ANGLEX 0x6AE3
+#define GL_RGB32_UNORM_ANGLEX 0x6AE4
+#define GL_RGBA32_UNORM_ANGLEX 0x6AE5
+
+#define GL_R32_FIXED_ANGLEX 0x6AE6
+#define GL_RG32_FIXED_ANGLEX 0x6AE7
+#define GL_RGB32_FIXED_ANGLEX 0x6AE8
+#define GL_RGBA32_FIXED_ANGLEX 0x6AE9
+
+#define GL_RGB10_A2_SINT_ANGLEX 0x6AEA
+#define GL_RGB10_A2_SNORM_ANGLEX 0x6AEB
+#define GL_RGB10_A2_SSCALED_ANGLEX 0x6AEC
+#define GL_RGB10_A2_USCALED_ANGLEX 0x6AED
+
+#define ANGLE_CHECK_GL_ALLOC(context, result) \
+ ANGLE_CHECK(context, result, "Failed to allocate host memory", GL_OUT_OF_MEMORY)
+
+#define ANGLE_CHECK_GL_MATH(context, result) \
+ ANGLE_CHECK(context, result, "Integer overflow.", GL_INVALID_OPERATION)
+
+#define ANGLE_GL_UNREACHABLE(context) \
+ UNREACHABLE(); \
+ ANGLE_CHECK(context, false, "Unreachable Code.", GL_INVALID_OPERATION)
+
+// The below inlining code lifted from V8.
+#if defined(__clang__) || (defined(__GNUC__) && defined(__has_attribute))
+# define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
+# define ANGLE_HAS___FORCEINLINE 0
+#elif defined(_MSC_VER)
+# define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE 0
+# define ANGLE_HAS___FORCEINLINE 1
+#else
+# define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE 0
+# define ANGLE_HAS___FORCEINLINE 0
+#endif
+
+#if defined(NDEBUG) && ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE
+# define ANGLE_INLINE inline __attribute__((always_inline))
+#elif defined(NDEBUG) && ANGLE_HAS___FORCEINLINE
+# define ANGLE_INLINE __forceinline
+#else
+# define ANGLE_INLINE inline
+#endif
+
+#if defined(__clang__) || (defined(__GNUC__) && defined(__has_attribute))
+# if __has_attribute(noinline)
+# define ANGLE_NOINLINE __attribute__((noinline))
+# else
+# define ANGLE_NOINLINE
+# endif
+#elif defined(_MSC_VER)
+# define ANGLE_NOINLINE __declspec(noinline)
+#else
+# define ANGLE_NOINLINE
+#endif
+
+#if defined(__clang__) || (defined(__GNUC__) && defined(__has_attribute))
+# if __has_attribute(format)
+# define ANGLE_FORMAT_PRINTF(fmt, args) __attribute__((format(__printf__, fmt, args)))
+# else
+# define ANGLE_FORMAT_PRINTF(fmt, args)
+# endif
+#else
+# define ANGLE_FORMAT_PRINTF(fmt, args)
+#endif
+
+// Format messes up the # inside the macro.
+// clang-format off
+#ifndef ANGLE_STRINGIFY
+# define ANGLE_STRINGIFY(x) #x
+#endif
+// clang-format on
+
+#ifndef ANGLE_MACRO_STRINGIFY
+# define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
+#endif
+
+// Detect support for C++17 [[nodiscard]]
+#if !defined(__has_cpp_attribute)
+# define __has_cpp_attribute(name) 0
+#endif // !defined(__has_cpp_attribute)
+
+#if __has_cpp_attribute(nodiscard)
+# define ANGLE_NO_DISCARD [[nodiscard]]
+#else
+# define ANGLE_NO_DISCARD
+#endif // __has_cpp_attribute(nodiscard)
+
+#if __has_cpp_attribute(maybe_unused)
+# define ANGLE_MAYBE_UNUSED [[maybe_unused]]
+#else
+# define ANGLE_MAYBE_UNUSED
+#endif // __has_cpp_attribute(maybe_unused)
+
+#endif // COMMON_ANGLEUTILS_H_
diff --git a/gfx/angle/checkout/src/common/bitset_utils.h b/gfx/angle/checkout/src/common/bitset_utils.h
new file mode 100644
index 0000000000..0d04a8008b
--- /dev/null
+++ b/gfx/angle/checkout/src/common/bitset_utils.h
@@ -0,0 +1,564 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// bitset_utils:
+// Bitset-related helper classes, such as a fast iterator to scan for set bits.
+//
+
+#ifndef COMMON_BITSETITERATOR_H_
+#define COMMON_BITSETITERATOR_H_
+
+#include <stdint.h>
+
+#include <bitset>
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+#include "common/mathutil.h"
+#include "common/platform.h"
+
+namespace angle
+{
+template <typename BitsT, typename ParamT>
+constexpr static BitsT Bit(ParamT x)
+{
+ return (static_cast<BitsT>(1) << static_cast<size_t>(x));
+}
+
+template <size_t N, typename BitsT, typename ParamT = std::size_t>
+class BitSetT final
+{
+ public:
+ class Reference final
+ {
+ public:
+ ~Reference() {}
+ Reference &operator=(bool x)
+ {
+ mParent->set(mBit, x);
+ return *this;
+ }
+ explicit operator bool() const { return mParent->test(mBit); }
+
+ private:
+ friend class BitSetT;
+
+ Reference(BitSetT *parent, ParamT bit) : mParent(parent), mBit(bit) {}
+
+ BitSetT *mParent;
+ ParamT mBit;
+ };
+
+ class Iterator final
+ {
+ public:
+ Iterator(const BitSetT &bits);
+ Iterator &operator++();
+
+ bool operator==(const Iterator &other) const;
+ bool operator!=(const Iterator &other) const;
+ ParamT operator*() const;
+
+ // These helper functions allow mutating an iterator in-flight.
+ // They only operate on later bits to ensure we don't iterate the same bit twice.
+ void resetLaterBit(std::size_t index)
+ {
+ ASSERT(index > mCurrentBit);
+ mBitsCopy.reset(index);
+ }
+
+ void setLaterBit(std::size_t index)
+ {
+ ASSERT(index > mCurrentBit);
+ mBitsCopy.set(index);
+ }
+
+ private:
+ std::size_t getNextBit();
+
+ BitSetT mBitsCopy;
+ std::size_t mCurrentBit;
+ };
+
+ BitSetT();
+ constexpr explicit BitSetT(BitsT value);
+
+ BitSetT(const BitSetT &other);
+ BitSetT &operator=(const BitSetT &other);
+
+ bool operator==(const BitSetT &other) const;
+ bool operator!=(const BitSetT &other) const;
+
+ constexpr bool operator[](ParamT pos) const;
+ Reference operator[](ParamT pos) { return Reference(this, pos); }
+
+ bool test(ParamT pos) const;
+
+ bool all() const;
+ bool any() const;
+ bool none() const;
+ std::size_t count() const;
+
+ constexpr std::size_t size() const { return N; }
+
+ BitSetT &operator&=(const BitSetT &other);
+ BitSetT &operator|=(const BitSetT &other);
+ BitSetT &operator^=(const BitSetT &other);
+ BitSetT operator~() const;
+
+ BitSetT &operator&=(BitsT value);
+ BitSetT &operator|=(BitsT value);
+ BitSetT &operator^=(BitsT value);
+
+ BitSetT operator<<(std::size_t pos) const;
+ BitSetT &operator<<=(std::size_t pos);
+ BitSetT operator>>(std::size_t pos) const;
+ BitSetT &operator>>=(std::size_t pos);
+
+ BitSetT &set();
+ BitSetT &set(ParamT pos, bool value = true);
+
+ BitSetT &reset();
+ BitSetT &reset(ParamT pos);
+
+ BitSetT &flip();
+ BitSetT &flip(ParamT pos);
+
+ unsigned long to_ulong() const { return static_cast<unsigned long>(mBits); }
+ BitsT bits() const { return mBits; }
+
+ Iterator begin() const { return Iterator(*this); }
+ Iterator end() const { return Iterator(BitSetT()); }
+
+ private:
+ // Produces a mask of ones up to the "x"th bit.
+ constexpr static BitsT Mask(std::size_t x)
+ {
+ return ((Bit<BitsT>(static_cast<ParamT>(x - 1)) - 1) << 1) + 1;
+ }
+
+ BitsT mBits;
+};
+
+template <size_t N>
+class IterableBitSet : public std::bitset<N>
+{
+ public:
+ IterableBitSet() {}
+ IterableBitSet(const std::bitset<N> &implicitBitSet) : std::bitset<N>(implicitBitSet) {}
+
+ class Iterator final
+ {
+ public:
+ Iterator(const std::bitset<N> &bits);
+ Iterator &operator++();
+
+ bool operator==(const Iterator &other) const;
+ bool operator!=(const Iterator &other) const;
+ unsigned long operator*() const { return mCurrentBit; }
+
+ // These helper functions allow mutating an iterator in-flight.
+ // They only operate on later bits to ensure we don't iterate the same bit twice.
+ void resetLaterBit(std::size_t index)
+ {
+ ASSERT(index > mCurrentBit);
+ mBits.reset(index - mOffset);
+ }
+
+ void setLaterBit(std::size_t index)
+ {
+ ASSERT(index > mCurrentBit);
+ mBits.set(index - mOffset);
+ }
+
+ private:
+ unsigned long getNextBit();
+
+ static constexpr size_t BitsPerWord = sizeof(uint32_t) * 8;
+ std::bitset<N> mBits;
+ unsigned long mCurrentBit;
+ unsigned long mOffset;
+ };
+
+ Iterator begin() const { return Iterator(*this); }
+ Iterator end() const { return Iterator(std::bitset<N>(0)); }
+};
+
+template <size_t N>
+IterableBitSet<N>::Iterator::Iterator(const std::bitset<N> &bitset)
+ : mBits(bitset), mCurrentBit(0), mOffset(0)
+{
+ if (mBits.any())
+ {
+ mCurrentBit = getNextBit();
+ }
+ else
+ {
+ mOffset = static_cast<unsigned long>(rx::roundUp(N, BitsPerWord));
+ }
+}
+
+template <size_t N>
+ANGLE_INLINE typename IterableBitSet<N>::Iterator &IterableBitSet<N>::Iterator::operator++()
+{
+ ASSERT(mBits.any());
+ mBits.set(mCurrentBit - mOffset, 0);
+ mCurrentBit = getNextBit();
+ return *this;
+}
+
+template <size_t N>
+bool IterableBitSet<N>::Iterator::operator==(const Iterator &other) const
+{
+ return mOffset == other.mOffset && mBits == other.mBits;
+}
+
+template <size_t N>
+bool IterableBitSet<N>::Iterator::operator!=(const Iterator &other) const
+{
+ return !(*this == other);
+}
+
+template <size_t N>
+unsigned long IterableBitSet<N>::Iterator::getNextBit()
+{
+ // TODO(jmadill): Use 64-bit scan when possible.
+ static constexpr std::bitset<N> wordMask(std::numeric_limits<uint32_t>::max());
+
+ while (mOffset < N)
+ {
+ uint32_t wordBits = static_cast<uint32_t>((mBits & wordMask).to_ulong());
+ if (wordBits != 0)
+ {
+ return gl::ScanForward(wordBits) + mOffset;
+ }
+
+ mBits >>= BitsPerWord;
+ mOffset += BitsPerWord;
+ }
+ return 0;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT>::BitSetT() : mBits(0)
+{
+ static_assert(N > 0, "Bitset type cannot support zero bits.");
+ static_assert(N <= sizeof(BitsT) * 8, "Bitset type cannot support a size this large.");
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+constexpr BitSetT<N, BitsT, ParamT>::BitSetT(BitsT value) : mBits(value & Mask(N))
+{}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT>::BitSetT(const BitSetT &other) : mBits(other.mBits)
+{}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator=(const BitSetT &other)
+{
+ mBits = other.mBits;
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::operator==(const BitSetT &other) const
+{
+ return mBits == other.mBits;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::operator!=(const BitSetT &other) const
+{
+ return mBits != other.mBits;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+constexpr bool BitSetT<N, BitsT, ParamT>::operator[](ParamT pos) const
+{
+ return test(pos);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::test(ParamT pos) const
+{
+ return (mBits & Bit<BitsT>(pos)) != 0;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::all() const
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ return mBits == Mask(N);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::any() const
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ return (mBits != 0);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::none() const
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ return (mBits == 0);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+std::size_t BitSetT<N, BitsT, ParamT>::count() const
+{
+ return gl::BitCount(mBits);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator&=(const BitSetT &other)
+{
+ mBits &= other.mBits;
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator|=(const BitSetT &other)
+{
+ mBits |= other.mBits;
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator^=(const BitSetT &other)
+{
+ mBits = mBits ^ other.mBits;
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> BitSetT<N, BitsT, ParamT>::operator~() const
+{
+ return BitSetT<N, BitsT, ParamT>(~mBits & Mask(N));
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator&=(BitsT value)
+{
+ mBits &= value;
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator|=(BitsT value)
+{
+ mBits |= value & Mask(N);
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator^=(BitsT value)
+{
+ mBits ^= value & Mask(N);
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> BitSetT<N, BitsT, ParamT>::operator<<(std::size_t pos) const
+{
+ return BitSetT<N, BitsT, ParamT>((mBits << pos) & Mask(N));
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator<<=(std::size_t pos)
+{
+ mBits = (mBits << pos & Mask(N));
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> BitSetT<N, BitsT, ParamT>::operator>>(std::size_t pos) const
+{
+ return BitSetT<N, BitsT, ParamT>(mBits >> pos);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::operator>>=(std::size_t pos)
+{
+ mBits = ((mBits >> pos) & Mask(N));
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::set()
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ mBits = Mask(N);
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::set(ParamT pos, bool value)
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ if (value)
+ {
+ mBits |= Bit<BitsT>(pos) & Mask(N);
+ }
+ else
+ {
+ reset(pos);
+ }
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::reset()
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ mBits = 0;
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::reset(ParamT pos)
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ mBits &= ~Bit<BitsT>(pos);
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::flip()
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ mBits ^= Mask(N);
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT> &BitSetT<N, BitsT, ParamT>::flip(ParamT pos)
+{
+ ASSERT(mBits == (mBits & Mask(N)));
+ mBits ^= Bit<BitsT>(pos) & Mask(N);
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+BitSetT<N, BitsT, ParamT>::Iterator::Iterator(const BitSetT &bits) : mBitsCopy(bits), mCurrentBit(0)
+{
+ if (bits.any())
+ {
+ mCurrentBit = getNextBit();
+ }
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+ANGLE_INLINE typename BitSetT<N, BitsT, ParamT>::Iterator &BitSetT<N, BitsT, ParamT>::Iterator::
+operator++()
+{
+ ASSERT(mBitsCopy.any());
+ mBitsCopy.reset(static_cast<ParamT>(mCurrentBit));
+ mCurrentBit = getNextBit();
+ return *this;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::Iterator::operator==(const Iterator &other) const
+{
+ return mBitsCopy == other.mBitsCopy;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+bool BitSetT<N, BitsT, ParamT>::Iterator::operator!=(const Iterator &other) const
+{
+ return !(*this == other);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+ParamT BitSetT<N, BitsT, ParamT>::Iterator::operator*() const
+{
+ return static_cast<ParamT>(mCurrentBit);
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+std::size_t BitSetT<N, BitsT, ParamT>::Iterator::getNextBit()
+{
+ if (mBitsCopy.none())
+ {
+ return 0;
+ }
+
+ return gl::ScanForward(mBitsCopy.mBits);
+}
+
+template <size_t N>
+using BitSet32 = BitSetT<N, uint32_t>;
+
+// ScanForward for 64-bits requires a 64-bit implementation.
+#if defined(ANGLE_IS_64_BIT_CPU)
+template <size_t N>
+using BitSet64 = BitSetT<N, uint64_t>;
+#endif // defined(ANGLE_IS_64_BIT_CPU)
+
+namespace priv
+{
+
+template <size_t N, typename T>
+using EnableIfBitsFit = typename std::enable_if<N <= sizeof(T) * 8>::type;
+
+template <size_t N, typename Enable = void>
+struct GetBitSet
+{
+ using Type = IterableBitSet<N>;
+};
+
+// Prefer 64-bit bitsets on 64-bit CPUs. They seem faster than 32-bit.
+#if defined(ANGLE_IS_64_BIT_CPU)
+template <size_t N>
+struct GetBitSet<N, EnableIfBitsFit<N, uint64_t>>
+{
+ using Type = BitSet64<N>;
+};
+#else
+template <size_t N>
+struct GetBitSet<N, EnableIfBitsFit<N, uint32_t>>
+{
+ using Type = BitSet32<N>;
+};
+#endif // defined(ANGLE_IS_64_BIT_CPU)
+
+} // namespace priv
+
+template <size_t N>
+using BitSet = typename priv::GetBitSet<N>::Type;
+
+} // namespace angle
+
+template <size_t N, typename BitsT, typename ParamT>
+inline angle::BitSetT<N, BitsT, ParamT> operator&(const angle::BitSetT<N, BitsT, ParamT> &lhs,
+ const angle::BitSetT<N, BitsT, ParamT> &rhs)
+{
+ angle::BitSetT<N, BitsT, ParamT> result(lhs);
+ result &= rhs.bits();
+ return result;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+inline angle::BitSetT<N, BitsT, ParamT> operator|(const angle::BitSetT<N, BitsT, ParamT> &lhs,
+ const angle::BitSetT<N, BitsT, ParamT> &rhs)
+{
+ angle::BitSetT<N, BitsT, ParamT> result(lhs);
+ result |= rhs.bits();
+ return result;
+}
+
+template <size_t N, typename BitsT, typename ParamT>
+inline angle::BitSetT<N, BitsT, ParamT> operator^(const angle::BitSetT<N, BitsT, ParamT> &lhs,
+ const angle::BitSetT<N, BitsT, ParamT> &rhs)
+{
+ angle::BitSetT<N, BitsT, ParamT> result(lhs);
+ result ^= rhs.bits();
+ return result;
+}
+
+#endif // COMMON_BITSETITERATOR_H_
diff --git a/gfx/angle/checkout/src/common/debug.cpp b/gfx/angle/checkout/src/common/debug.cpp
new file mode 100644
index 0000000000..9419096c3b
--- /dev/null
+++ b/gfx/angle/checkout/src/common/debug.cpp
@@ -0,0 +1,285 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.cpp: Debugging utilities.
+
+#include "common/debug.h"
+
+#include <stdarg.h>
+
+#include <array>
+#include <cstdio>
+#include <fstream>
+#include <mutex>
+#include <ostream>
+#include <vector>
+
+#if defined(ANGLE_PLATFORM_ANDROID)
+# include <android/log.h>
+#endif
+
+#include "common/Optional.h"
+#include "common/angleutils.h"
+#include "common/system_utils.h"
+
+namespace gl
+{
+
+namespace
+{
+
+DebugAnnotator *g_debugAnnotator = nullptr;
+
+std::mutex *g_debugMutex = nullptr;
+
+constexpr std::array<const char *, LOG_NUM_SEVERITIES> g_logSeverityNames = {
+ {"EVENT", "INFO", "WARN", "ERR", "FATAL"}};
+
+constexpr const char *LogSeverityName(int severity)
+{
+ return (severity >= 0 && severity < LOG_NUM_SEVERITIES) ? g_logSeverityNames[severity]
+ : "UNKNOWN";
+}
+
+bool ShouldCreateLogMessage(LogSeverity severity)
+{
+#if defined(ANGLE_TRACE_ENABLED)
+ return true;
+#elif defined(ANGLE_ENABLE_ASSERTS)
+ return severity != LOG_EVENT;
+#else
+ return false;
+#endif
+}
+
+} // namespace
+
+namespace priv
+{
+
+bool ShouldCreatePlatformLogMessage(LogSeverity severity)
+{
+#if defined(ANGLE_TRACE_ENABLED)
+ return true;
+#else
+ return severity != LOG_EVENT;
+#endif
+}
+
+// This is never instantiated, it's just used for EAT_STREAM_PARAMETERS to an object of the correct
+// type on the LHS of the unused part of the ternary operator.
+std::ostream *gSwallowStream;
+} // namespace priv
+
+bool DebugAnnotationsActive()
+{
+#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
+ return g_debugAnnotator != nullptr && g_debugAnnotator->getStatus();
+#else
+ return false;
+#endif
+}
+
+bool DebugAnnotationsInitialized()
+{
+ return g_debugAnnotator != nullptr;
+}
+
+void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator)
+{
+ UninitializeDebugAnnotations();
+ g_debugAnnotator = debugAnnotator;
+}
+
+void UninitializeDebugAnnotations()
+{
+ // Pointer is not managed.
+ g_debugAnnotator = nullptr;
+}
+
+void InitializeDebugMutexIfNeeded()
+{
+ if (g_debugMutex == nullptr)
+ {
+ g_debugMutex = new std::mutex();
+ }
+}
+
+ScopedPerfEventHelper::ScopedPerfEventHelper(const char *format, ...) : mFunctionName(nullptr)
+{
+ bool dbgTrace = DebugAnnotationsActive();
+#if !defined(ANGLE_ENABLE_DEBUG_TRACE)
+ if (!dbgTrace)
+ {
+ return;
+ }
+#endif // !ANGLE_ENABLE_DEBUG_TRACE
+
+ va_list vararg;
+ va_start(vararg, format);
+ std::vector<char> buffer(512);
+ size_t len = FormatStringIntoVector(format, vararg, buffer);
+ ANGLE_LOG(EVENT) << std::string(&buffer[0], len);
+ // Pull function name from variable args
+ mFunctionName = va_arg(vararg, const char *);
+ va_end(vararg);
+ if (dbgTrace)
+ {
+ g_debugAnnotator->beginEvent(mFunctionName, buffer.data());
+ }
+}
+
+ScopedPerfEventHelper::~ScopedPerfEventHelper()
+{
+ if (DebugAnnotationsActive())
+ {
+ g_debugAnnotator->endEvent(mFunctionName);
+ }
+}
+
+LogMessage::LogMessage(const char *function, int line, LogSeverity severity)
+ : mFunction(function), mLine(line), mSeverity(severity)
+{
+ // EVENT() does not require additional function(line) info.
+ if (mSeverity != LOG_EVENT)
+ {
+ mStream << mFunction << "(" << mLine << "): ";
+ }
+}
+
+LogMessage::~LogMessage()
+{
+ std::unique_lock<std::mutex> lock;
+ if (g_debugMutex != nullptr)
+ {
+ lock = std::unique_lock<std::mutex>(*g_debugMutex);
+ }
+
+ if (DebugAnnotationsInitialized() && (mSeverity >= LOG_INFO))
+ {
+ g_debugAnnotator->logMessage(*this);
+ }
+ else
+ {
+ Trace(getSeverity(), getMessage().c_str());
+ }
+
+ if (mSeverity == LOG_FATAL)
+ {
+ if (angle::IsDebuggerAttached())
+ {
+ angle::BreakDebugger();
+ }
+ else
+ {
+ ANGLE_CRASH();
+ }
+ }
+}
+
+void Trace(LogSeverity severity, const char *message)
+{
+ if (!ShouldCreateLogMessage(severity))
+ {
+ return;
+ }
+
+ std::string str(message);
+
+ if (DebugAnnotationsActive())
+ {
+
+ switch (severity)
+ {
+ case LOG_EVENT:
+ // Debugging logging done in ScopedPerfEventHelper
+ break;
+ default:
+ g_debugAnnotator->setMarker(message);
+ break;
+ }
+ }
+
+ if (severity == LOG_FATAL || severity == LOG_ERR || severity == LOG_WARN ||
+ severity == LOG_INFO)
+ {
+#if defined(ANGLE_PLATFORM_ANDROID)
+ android_LogPriority android_priority = ANDROID_LOG_ERROR;
+ switch (severity)
+ {
+ case LOG_INFO:
+ android_priority = ANDROID_LOG_INFO;
+ break;
+ case LOG_WARN:
+ android_priority = ANDROID_LOG_WARN;
+ break;
+ case LOG_ERR:
+ android_priority = ANDROID_LOG_ERROR;
+ break;
+ case LOG_FATAL:
+ android_priority = ANDROID_LOG_FATAL;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ __android_log_print(android_priority, "ANGLE", "%s: %s\n", LogSeverityName(severity),
+ str.c_str());
+#else
+ // Note: we use fprintf because <iostream> includes static initializers.
+ fprintf((severity >= LOG_ERR) ? stderr : stdout, "%s: %s\n", LogSeverityName(severity),
+ str.c_str());
+#endif
+ }
+
+#if defined(ANGLE_PLATFORM_WINDOWS) && \
+ (defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER) || !defined(NDEBUG))
+# if !defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
+ if (severity >= LOG_ERR)
+# endif // !defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
+ {
+ OutputDebugStringA(str.c_str());
+ }
+#endif
+
+#if defined(ANGLE_ENABLE_DEBUG_TRACE)
+# if defined(NDEBUG)
+ if (severity == LOG_EVENT || severity == LOG_WARN || severity == LOG_INFO)
+ {
+ return;
+ }
+# endif // defined(NDEBUG)
+ static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
+ if (file)
+ {
+ file << LogSeverityName(severity) << ": " << str << std::endl;
+ file.flush();
+ }
+#endif // defined(ANGLE_ENABLE_DEBUG_TRACE)
+}
+
+LogSeverity LogMessage::getSeverity() const
+{
+ return mSeverity;
+}
+
+std::string LogMessage::getMessage() const
+{
+ return mStream.str();
+}
+
+#if defined(ANGLE_PLATFORM_WINDOWS)
+priv::FmtHexHelper<HRESULT> FmtHR(HRESULT value)
+{
+ return priv::FmtHexHelper<HRESULT>("HRESULT: ", value);
+}
+
+priv::FmtHexHelper<DWORD> FmtErr(DWORD value)
+{
+ return priv::FmtHexHelper<DWORD>("error: ", value);
+}
+#endif // defined(ANGLE_PLATFORM_WINDOWS)
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/common/debug.h b/gfx/angle/checkout/src/common/debug.h
new file mode 100644
index 0000000000..fb5fda3569
--- /dev/null
+++ b/gfx/angle/checkout/src/common/debug.h
@@ -0,0 +1,366 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// debug.h: Debugging utilities. A lot of the logging code is adapted from Chromium's
+// base/logging.h.
+
+#ifndef COMMON_DEBUG_H_
+#define COMMON_DEBUG_H_
+
+#include <assert.h>
+#include <stdio.h>
+
+#include <iomanip>
+#include <ios>
+#include <sstream>
+#include <string>
+
+#include "common/angleutils.h"
+#include "common/platform.h"
+
+#if !defined(TRACE_OUTPUT_FILE)
+# define TRACE_OUTPUT_FILE "angle_debug.txt"
+#endif
+
+namespace gl
+{
+
+// Pairs a D3D begin event with an end event.
+class ScopedPerfEventHelper : angle::NonCopyable
+{
+ public:
+ ANGLE_FORMAT_PRINTF(2, 3)
+ ScopedPerfEventHelper(const char *format, ...);
+ ~ScopedPerfEventHelper();
+
+ private:
+ const char *mFunctionName;
+};
+
+using LogSeverity = int;
+// Note: the log severities are used to index into the array of names,
+// see g_logSeverityNames.
+constexpr LogSeverity LOG_EVENT = 0;
+constexpr LogSeverity LOG_INFO = 1;
+constexpr LogSeverity LOG_WARN = 2;
+constexpr LogSeverity LOG_ERR = 3;
+constexpr LogSeverity LOG_FATAL = 4;
+constexpr LogSeverity LOG_NUM_SEVERITIES = 5;
+
+void Trace(LogSeverity severity, const char *message);
+
+// This class more or less represents a particular log message. You
+// create an instance of LogMessage and then stream stuff to it.
+// When you finish streaming to it, ~LogMessage is called and the
+// full message gets streamed to the appropriate destination.
+//
+// You shouldn't actually use LogMessage's constructor to log things,
+// though. You should use the ERR() and WARN() macros.
+class LogMessage : angle::NonCopyable
+{
+ public:
+ // Used for ANGLE_LOG(severity).
+ LogMessage(const char *function, int line, LogSeverity severity);
+ ~LogMessage();
+ std::ostream &stream() { return mStream; }
+
+ LogSeverity getSeverity() const;
+ std::string getMessage() const;
+
+ private:
+ const char *mFunction;
+ const int mLine;
+ const LogSeverity mSeverity;
+
+ std::ostringstream mStream;
+};
+
+// Wraps the API/Platform-specific debug annotation functions.
+// Also handles redirecting logging destination.
+class DebugAnnotator : angle::NonCopyable
+{
+ public:
+ DebugAnnotator() {}
+ virtual ~DebugAnnotator() {}
+ virtual void beginEvent(const char *eventName, const char *eventMessage) = 0;
+ virtual void endEvent(const char *eventName) = 0;
+ virtual void setMarker(const char *markerName) = 0;
+ virtual bool getStatus() = 0;
+ // Log Message Handler that gets passed every log message,
+ // when debug annotations are initialized,
+ // replacing default handling by LogMessage.
+ virtual void logMessage(const LogMessage &msg) const = 0;
+};
+
+void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator);
+void UninitializeDebugAnnotations();
+bool DebugAnnotationsActive();
+bool DebugAnnotationsInitialized();
+
+void InitializeDebugMutexIfNeeded();
+
+namespace priv
+{
+// This class is used to explicitly ignore values in the conditional logging macros. This avoids
+// compiler warnings like "value computed is not used" and "statement has no effect".
+class LogMessageVoidify
+{
+ public:
+ LogMessageVoidify() {}
+ // This has to be an operator with a precedence lower than << but higher than ?:
+ void operator&(std::ostream &) {}
+};
+
+extern std::ostream *gSwallowStream;
+
+// Used by ANGLE_LOG_IS_ON to lazy-evaluate stream arguments.
+bool ShouldCreatePlatformLogMessage(LogSeverity severity);
+
+template <int N, typename T>
+std::ostream &FmtHex(std::ostream &os, T value)
+{
+ os << "0x";
+
+ std::ios_base::fmtflags oldFlags = os.flags();
+ std::streamsize oldWidth = os.width();
+ std::ostream::char_type oldFill = os.fill();
+
+ os << std::hex << std::uppercase << std::setw(N) << std::setfill('0') << value;
+
+ os.flags(oldFlags);
+ os.width(oldWidth);
+ os.fill(oldFill);
+
+ return os;
+}
+
+template <typename T>
+std::ostream &FmtHexAutoSized(std::ostream &os, T value)
+{
+ constexpr int N = sizeof(T) * 2;
+ return priv::FmtHex<N>(os, value);
+}
+
+template <typename T>
+class FmtHexHelper
+{
+ public:
+ FmtHexHelper(const char *prefix, T value) : mPrefix(prefix), mValue(value) {}
+ explicit FmtHexHelper(T value) : mPrefix(nullptr), mValue(value) {}
+
+ private:
+ const char *mPrefix;
+ T mValue;
+
+ friend std::ostream &operator<<(std::ostream &os, const FmtHexHelper &fmt)
+ {
+ if (fmt.mPrefix)
+ {
+ os << fmt.mPrefix;
+ }
+ return FmtHexAutoSized(os, fmt.mValue);
+ }
+};
+
+} // namespace priv
+
+template <typename T>
+priv::FmtHexHelper<T> FmtHex(T value)
+{
+ return priv::FmtHexHelper<T>(value);
+}
+
+#if defined(ANGLE_PLATFORM_WINDOWS)
+priv::FmtHexHelper<HRESULT> FmtHR(HRESULT value);
+priv::FmtHexHelper<DWORD> FmtErr(DWORD value);
+#endif // defined(ANGLE_PLATFORM_WINDOWS)
+
+template <typename T>
+std::ostream &FmtHex(std::ostream &os, T value)
+{
+ return priv::FmtHexAutoSized(os, value);
+}
+
+// A few definitions of macros that don't generate much code. These are used
+// by ANGLE_LOG(). Since these are used all over our code, it's
+// better to have compact code for these operations.
+#define COMPACT_ANGLE_LOG_EX_EVENT(ClassName, ...) \
+ ::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_EVENT, ##__VA_ARGS__)
+#define COMPACT_ANGLE_LOG_EX_INFO(ClassName, ...) \
+ ::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_INFO, ##__VA_ARGS__)
+#define COMPACT_ANGLE_LOG_EX_WARN(ClassName, ...) \
+ ::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_WARN, ##__VA_ARGS__)
+#define COMPACT_ANGLE_LOG_EX_ERR(ClassName, ...) \
+ ::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_ERR, ##__VA_ARGS__)
+#define COMPACT_ANGLE_LOG_EX_FATAL(ClassName, ...) \
+ ::gl::ClassName(__FUNCTION__, __LINE__, ::gl::LOG_FATAL, ##__VA_ARGS__)
+
+#define COMPACT_ANGLE_LOG_EVENT COMPACT_ANGLE_LOG_EX_EVENT(LogMessage)
+#define COMPACT_ANGLE_LOG_INFO COMPACT_ANGLE_LOG_EX_INFO(LogMessage)
+#define COMPACT_ANGLE_LOG_WARN COMPACT_ANGLE_LOG_EX_WARN(LogMessage)
+#define COMPACT_ANGLE_LOG_ERR COMPACT_ANGLE_LOG_EX_ERR(LogMessage)
+#define COMPACT_ANGLE_LOG_FATAL COMPACT_ANGLE_LOG_EX_FATAL(LogMessage)
+
+#define ANGLE_LOG_IS_ON(severity) (::gl::priv::ShouldCreatePlatformLogMessage(::gl::LOG_##severity))
+
+// Helper macro which avoids evaluating the arguments to a stream if the condition doesn't hold.
+// Condition is evaluated once and only once.
+#define ANGLE_LAZY_STREAM(stream, condition) \
+ !(condition) ? static_cast<void>(0) : ::gl::priv::LogMessageVoidify() & (stream)
+
+// We use the preprocessor's merging operator, "##", so that, e.g.,
+// ANGLE_LOG(EVENT) becomes the token COMPACT_ANGLE_LOG_EVENT. There's some funny
+// subtle difference between ostream member streaming functions (e.g.,
+// ostream::operator<<(int) and ostream non-member streaming functions
+// (e.g., ::operator<<(ostream&, string&): it turns out that it's
+// impossible to stream something like a string directly to an unnamed
+// ostream. We employ a neat hack by calling the stream() member
+// function of LogMessage which seems to avoid the problem.
+#define ANGLE_LOG_STREAM(severity) COMPACT_ANGLE_LOG_##severity.stream()
+
+#define ANGLE_LOG(severity) ANGLE_LAZY_STREAM(ANGLE_LOG_STREAM(severity), ANGLE_LOG_IS_ON(severity))
+
+} // namespace gl
+
+#if defined(ANGLE_ENABLE_DEBUG_TRACE) || defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
+# define ANGLE_TRACE_ENABLED
+#endif
+
+#if !defined(NDEBUG) || defined(ANGLE_ENABLE_RELEASE_ASSERTS)
+# define ANGLE_ENABLE_ASSERTS
+#endif
+
+#define INFO() ANGLE_LOG(INFO)
+#define WARN() ANGLE_LOG(WARN)
+#define ERR() ANGLE_LOG(ERR)
+#define FATAL() ANGLE_LOG(FATAL)
+
+// A macro to log a performance event around a scope.
+#if defined(ANGLE_TRACE_ENABLED)
+# if defined(_MSC_VER)
+# define EVENT(message, ...) \
+ gl::ScopedPerfEventHelper scopedPerfEventHelper##__LINE__("%s" message "\n", \
+ __FUNCTION__, __VA_ARGS__)
+# else
+# define EVENT(message, ...) \
+ gl::ScopedPerfEventHelper scopedPerfEventHelper("%s" message "\n", __FUNCTION__, \
+ ##__VA_ARGS__)
+# endif // _MSC_VER
+#else
+# define EVENT(message, ...) (void(0))
+#endif
+
+#if defined(__GNUC__)
+# define ANGLE_CRASH() __builtin_trap()
+#else
+# define ANGLE_CRASH() ((void)(*(volatile char *)0 = 0)), __assume(0)
+#endif
+
+#if !defined(NDEBUG)
+# define ANGLE_ASSERT_IMPL(expression) assert(expression)
+#else
+// TODO(jmadill): Detect if debugger is attached and break.
+# define ANGLE_ASSERT_IMPL(expression) ANGLE_CRASH()
+#endif // !defined(NDEBUG)
+
+// Note that gSwallowStream is used instead of an arbitrary LOG() stream to avoid the creation of an
+// object with a non-trivial destructor (LogMessage). On MSVC x86 (checked on 2015 Update 3), this
+// causes a few additional pointless instructions to be emitted even at full optimization level,
+// even though the : arm of the ternary operator is clearly never executed. Using a simpler object
+// to be &'d with Voidify() avoids these extra instructions. Using a simpler POD object with a
+// templated operator<< also works to avoid these instructions. However, this causes warnings on
+// statically defined implementations of operator<<(std::ostream, ...) in some .cpp files, because
+// they become defined-but-unreferenced functions. A reinterpret_cast of 0 to an ostream* also is
+// not suitable, because some compilers warn of undefined behavior.
+#define ANGLE_EAT_STREAM_PARAMETERS \
+ true ? static_cast<void>(0) : ::gl::priv::LogMessageVoidify() & (*::gl::priv::gSwallowStream)
+
+// A macro asserting a condition and outputting failures to the debug log
+#if defined(ANGLE_ENABLE_ASSERTS)
+# define ASSERT(expression) \
+ (expression ? static_cast<void>(0) \
+ : (FATAL() << "\t! Assert failed in " << __FUNCTION__ << " (" << __FILE__ \
+ << ":" << __LINE__ << "): " << #expression))
+#else
+# define ASSERT(condition) ANGLE_EAT_STREAM_PARAMETERS << !(condition)
+#endif // defined(ANGLE_ENABLE_ASSERTS)
+
+#define UNREACHABLE_IS_NORETURN 0
+
+#define ANGLE_UNUSED_VARIABLE(variable) (static_cast<void>(variable))
+
+// A macro to indicate unimplemented functionality
+#ifndef NOASSERT_UNIMPLEMENTED
+# define NOASSERT_UNIMPLEMENTED 1
+#endif
+
+#if defined(ANGLE_TRACE_ENABLED) || defined(ANGLE_ENABLE_ASSERTS)
+# define UNIMPLEMENTED() \
+ do \
+ { \
+ WARN() << "\t! Unimplemented: " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ \
+ << ")"; \
+ ASSERT(NOASSERT_UNIMPLEMENTED); \
+ } while (0)
+
+// A macro for code which is not expected to be reached under valid assumptions
+# define UNREACHABLE() \
+ do \
+ { \
+ FATAL() << "\t! Unreachable reached: " << __FUNCTION__ << "(" << __FILE__ << ":" \
+ << __LINE__ << ")"; \
+ } while (0)
+#else
+# define UNIMPLEMENTED() \
+ do \
+ { \
+ ASSERT(NOASSERT_UNIMPLEMENTED); \
+ } while (0)
+
+// A macro for code which is not expected to be reached under valid assumptions
+# define UNREACHABLE() \
+ do \
+ { \
+ ASSERT(false); \
+ } while (0)
+#endif // defined(ANGLE_TRACE_ENABLED) || defined(ANGLE_ENABLE_ASSERTS)
+
+#if defined(ANGLE_PLATFORM_WINDOWS)
+# define ANGLE_FUNCTION __FUNCTION__
+#else
+# define ANGLE_FUNCTION __func__
+#endif
+
+// Defining ANGLE_ENABLE_STRUCT_PADDING_WARNINGS will enable warnings when members are added to
+// structs to enforce packing. This is helpful for diagnosing unexpected struct sizes when making
+// fast cache variables.
+#if defined(__clang__)
+# define ANGLE_ENABLE_STRUCT_PADDING_WARNINGS \
+ _Pragma("clang diagnostic push") _Pragma("clang diagnostic error \"-Wpadded\"")
+# define ANGLE_DISABLE_STRUCT_PADDING_WARNINGS _Pragma("clang diagnostic pop")
+#elif defined(__GNUC__)
+# define ANGLE_ENABLE_STRUCT_PADDING_WARNINGS \
+ _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic error \"-Wpadded\"")
+# define ANGLE_DISABLE_STRUCT_PADDING_WARNINGS _Pragma("GCC diagnostic pop")
+#elif defined(_MSC_VER)
+# define ANGLE_ENABLE_STRUCT_PADDING_WARNINGS \
+ __pragma(warning(push)) __pragma(warning(error : 4820))
+# define ANGLE_DISABLE_STRUCT_PADDING_WARNINGS __pragma(warning(pop))
+#else
+# define ANGLE_ENABLE_STRUCT_PADDING_WARNINGS
+# define ANGLE_DISABLE_STRUCT_PADDING_WARNINGS
+#endif
+
+#if defined(__clang__)
+# define ANGLE_DISABLE_EXTRA_SEMI_WARNING \
+ _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wextra-semi\"")
+# define ANGLE_REENABLE_EXTRA_SEMI_WARNING _Pragma("clang diagnostic pop")
+#else
+# define ANGLE_DISABLE_EXTRA_SEMI_WARNING
+# define ANGLE_REENABLE_EXTRA_SEMI_WARNING
+#endif
+
+#endif // COMMON_DEBUG_H_
diff --git a/gfx/angle/checkout/src/common/event_tracer.cpp b/gfx/angle/checkout/src/common/event_tracer.cpp
new file mode 100644
index 0000000000..95d1977f5b
--- /dev/null
+++ b/gfx/angle/checkout/src/common/event_tracer.cpp
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "common/event_tracer.h"
+
+#include "common/debug.h"
+
+namespace angle
+{
+
+const unsigned char *GetTraceCategoryEnabledFlag(PlatformMethods *platform, const char *name)
+{
+ ASSERT(platform);
+
+ const unsigned char *categoryEnabledFlag =
+ platform->getTraceCategoryEnabledFlag(platform, name);
+ if (categoryEnabledFlag != nullptr)
+ {
+ return categoryEnabledFlag;
+ }
+
+ static unsigned char disabled = 0;
+ return &disabled;
+}
+
+angle::TraceEventHandle AddTraceEvent(PlatformMethods *platform,
+ char phase,
+ const unsigned char *categoryGroupEnabled,
+ const char *name,
+ unsigned long long id,
+ int numArgs,
+ const char **argNames,
+ const unsigned char *argTypes,
+ const unsigned long long *argValues,
+ unsigned char flags)
+{
+ ASSERT(platform);
+
+ double timestamp = platform->monotonicallyIncreasingTime(platform);
+
+ if (timestamp != 0)
+ {
+ angle::TraceEventHandle handle =
+ platform->addTraceEvent(platform, phase, categoryGroupEnabled, name, id, timestamp,
+ numArgs, argNames, argTypes, argValues, flags);
+ return handle;
+ }
+
+ return static_cast<angle::TraceEventHandle>(0);
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/event_tracer.h b/gfx/angle/checkout/src/common/event_tracer.h
new file mode 100644
index 0000000000..231ecfdd6d
--- /dev/null
+++ b/gfx/angle/checkout/src/common/event_tracer.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMMON_EVENT_TRACER_H_
+#define COMMON_EVENT_TRACER_H_
+
+#include "common/platform.h"
+#include "platform/Platform.h"
+
+namespace angle
+{
+const unsigned char *GetTraceCategoryEnabledFlag(PlatformMethods *platform, const char *name);
+angle::TraceEventHandle AddTraceEvent(PlatformMethods *platform,
+ char phase,
+ const unsigned char *categoryGroupEnabled,
+ const char *name,
+ unsigned long long id,
+ int numArgs,
+ const char **argNames,
+ const unsigned char *argTypes,
+ const unsigned long long *argValues,
+ unsigned char flags);
+} // namespace angle
+
+#endif // COMMON_EVENT_TRACER_H_
diff --git a/gfx/angle/checkout/src/common/hash_utils.h b/gfx/angle/checkout/src/common/hash_utils.h
new file mode 100644
index 0000000000..aec4e7f77c
--- /dev/null
+++ b/gfx/angle/checkout/src/common/hash_utils.h
@@ -0,0 +1,39 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// hash_utils.h: Hashing based helper functions.
+
+#ifndef COMMON_HASHUTILS_H_
+#define COMMON_HASHUTILS_H_
+
+#include "common/debug.h"
+#include "common/third_party/xxhash/xxhash.h"
+
+namespace angle
+{
+// Computes a hash of "key". Any data passed to this function must be multiples of
+// 4 bytes, since the PMurHash32 method can only operate increments of 4-byte words.
+inline std::size_t ComputeGenericHash(const void *key, size_t keySize)
+{
+ static constexpr unsigned int kSeed = 0xABCDEF98;
+
+ // We can't support "odd" alignments. ComputeGenericHash requires aligned types
+ ASSERT(keySize % 4 == 0);
+#if defined(ANGLE_IS_64_BIT_CPU)
+ return XXH64(key, keySize, kSeed);
+#else
+ return XXH32(key, keySize, kSeed);
+#endif // defined(ANGLE_IS_64_BIT_CPU)
+}
+
+template <typename T>
+std::size_t ComputeGenericHash(const T &key)
+{
+ static_assert(sizeof(key) % 4 == 0, "ComputeGenericHash requires aligned types");
+ return ComputeGenericHash(&key, sizeof(key));
+}
+} // namespace angle
+
+#endif // COMMON_HASHUTILS_H_
diff --git a/gfx/angle/checkout/src/common/mathutil.cpp b/gfx/angle/checkout/src/common/mathutil.cpp
new file mode 100644
index 0000000000..3e3895fcf1
--- /dev/null
+++ b/gfx/angle/checkout/src/common/mathutil.cpp
@@ -0,0 +1,93 @@
+//
+// 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 <math.h>
+#include <algorithm>
+
+namespace gl
+{
+
+namespace
+{
+
+struct RGB9E5Data
+{
+ unsigned int R : 9;
+ unsigned int G : 9;
+ unsigned int B : 9;
+ unsigned int E : 5;
+};
+
+// B is the exponent bias (15)
+constexpr int g_sharedexp_bias = 15;
+
+// N is the number of mantissa bits per component (9)
+constexpr int g_sharedexp_mantissabits = 9;
+
+// Emax is the maximum allowed biased exponent value (31)
+constexpr int g_sharedexp_maxexponent = 31;
+
+constexpr float g_sharedexp_max =
+ ((static_cast<float>(1 << g_sharedexp_mantissabits) - 1) /
+ static_cast<float>(1 << g_sharedexp_mantissabits)) *
+ static_cast<float>(1 << (g_sharedexp_maxexponent - g_sharedexp_bias));
+
+} // anonymous namespace
+
+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 = static_cast<int>(
+ floor((max_c / (pow(2.0f, exp_p - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
+ const int exp_s =
+ static_cast<int>((max_s < pow(2.0f, g_sharedexp_mantissabits)) ? exp_p : exp_p + 1);
+
+ RGB9E5Data output;
+ output.R = static_cast<unsigned int>(
+ floor((red_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
+ output.G = static_cast<unsigned int>(
+ floor((green_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
+ output.B = static_cast<unsigned int>(
+ floor((blue_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
+ output.E = exp_s;
+
+ return bitCast<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);
+}
+
+int BitCountPolyfill(uint32_t bits)
+{
+ int ones = 0;
+ while (bits)
+ {
+ ones += bool(bits & 1);
+ bits >>= 1;
+ }
+ return ones;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/common/mathutil.h b/gfx/angle/checkout/src/common/mathutil.h
new file mode 100644
index 0000000000..798ddba597
--- /dev/null
+++ b/gfx/angle/checkout/src/common/mathutil.h
@@ -0,0 +1,1305 @@
+//
+// 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 COMMON_MATHUTIL_H_
+#define COMMON_MATHUTIL_H_
+
+#include <math.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <algorithm>
+#include <limits>
+
+#include <anglebase/numerics/safe_math.h>
+
+#include "common/debug.h"
+#include "common/platform.h"
+
+namespace angle
+{
+using base::CheckedNumeric;
+using base::IsValueInRangeForNumericType;
+} // namespace angle
+
+namespace gl
+{
+
+const unsigned int Float32One = 0x3F800000;
+const unsigned short Float16One = 0x3C00;
+
+template <typename T>
+inline bool isPow2(T x)
+{
+ static_assert(std::is_integral<T>::value, "isPow2 must be called on an integer type.");
+ return (x & (x - 1)) == 0 && (x != 0);
+}
+
+inline int log2(int x)
+{
+ int r = 0;
+ while ((x >> r) > 1)
+ r++;
+ return r;
+}
+
+inline unsigned int ceilPow2(unsigned int x)
+{
+ if (x != 0)
+ x--;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ x++;
+
+ return x;
+}
+
+template <typename DestT, typename SrcT>
+inline DestT clampCast(SrcT value)
+{
+ // For floating-point types with denormalization, min returns the minimum positive normalized
+ // value. To find the value that has no values less than it, use numeric_limits::lowest.
+ constexpr const long double destLo =
+ static_cast<long double>(std::numeric_limits<DestT>::lowest());
+ constexpr const long double destHi =
+ static_cast<long double>(std::numeric_limits<DestT>::max());
+ constexpr const long double srcLo =
+ static_cast<long double>(std::numeric_limits<SrcT>::lowest());
+ constexpr long double srcHi = static_cast<long double>(std::numeric_limits<SrcT>::max());
+
+ if (destHi < srcHi)
+ {
+ DestT destMax = std::numeric_limits<DestT>::max();
+ if (value >= static_cast<SrcT>(destMax))
+ {
+ return destMax;
+ }
+ }
+
+ if (destLo > srcLo)
+ {
+ DestT destLow = std::numeric_limits<DestT>::lowest();
+ if (value <= static_cast<SrcT>(destLow))
+ {
+ return destLow;
+ }
+ }
+
+ return static_cast<DestT>(value);
+}
+
+// Specialize clampCast for bool->int conversion to avoid MSVS 2015 performance warning when the max
+// value is casted to the source type.
+template <>
+inline unsigned int clampCast(bool value)
+{
+ return static_cast<unsigned int>(value);
+}
+
+template <>
+inline int clampCast(bool value)
+{
+ return static_cast<int>(value);
+}
+
+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(ANGLE_USE_SSE)
+ static bool checked = false;
+ static bool supports = false;
+
+ if (checked)
+ {
+ return supports;
+ }
+
+# if defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
+ {
+ int info[4];
+ __cpuid(info, 0);
+
+ if (info[0] >= 1)
+ {
+ __cpuid(info, 1);
+
+ supports = (info[3] >> 26) & 1;
+ }
+ }
+# endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(_M_ARM) && !defined(_M_ARM64)
+ checked = true;
+ return supports;
+#else // defined(ANGLE_USE_SSE)
+ 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 = bitCast<unsigned int>(fp32);
+ unsigned int sign = (fp32i & 0x80000000) >> 16;
+ unsigned int abs = fp32i & 0x7FFFFFFF;
+
+ if (abs > 0x7F800000)
+ { // NaN
+ return 0x7FFF;
+ }
+ else if (abs > 0x47FFEFFF)
+ { // Infinity
+ return static_cast<uint16_t>(sign | 0x7C00);
+ }
+ 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 static_cast<unsigned short>(sign | (abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13);
+ }
+ else
+ {
+ return static_cast<unsigned short>(
+ 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 = static_cast<unsigned short>(-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 = static_cast<unsigned short>(-112);
+ }
+
+ return bitCast<float>(((exponent + 112) << 23) | (mantissa << 18));
+ }
+}
+
+// Convers to and from float and 16.16 fixed point format.
+
+inline float FixedToFloat(uint32_t fixedInput)
+{
+ return static_cast<float>(fixedInput) / 65536.0f;
+}
+
+inline uint32_t FloatToFixed(float floatInput)
+{
+ static constexpr uint32_t kHighest = 32767 * 65536 + 65535;
+ static constexpr uint32_t kLowest = static_cast<uint32_t>(-32768 * 65536 + 65535);
+
+ if (floatInput > 32767.65535)
+ {
+ return kHighest;
+ }
+ else if (floatInput < -32768.65535)
+ {
+ return kLowest;
+ }
+ else
+ {
+ return static_cast<uint32_t>(floatInput * 65536);
+ }
+}
+
+template <typename T>
+inline float normalizedToFloat(T input)
+{
+ static_assert(std::numeric_limits<T>::is_integer, "T must be an integer.");
+
+ if (sizeof(T) > 2)
+ {
+ // float has only a 23 bit mantissa, so we need to do the calculation in double precision
+ constexpr double inverseMax = 1.0 / std::numeric_limits<T>::max();
+ return static_cast<float>(input * inverseMax);
+ }
+ else
+ {
+ constexpr float inverseMax = 1.0f / std::numeric_limits<T>::max();
+ return input * inverseMax;
+ }
+}
+
+template <unsigned int inputBitCount, typename T>
+inline float normalizedToFloat(T input)
+{
+ static_assert(std::numeric_limits<T>::is_integer, "T must be an integer.");
+ static_assert(inputBitCount < (sizeof(T) * 8), "T must have more bits than inputBitCount.");
+
+ if (inputBitCount > 23)
+ {
+ // float has only a 23 bit mantissa, so we need to do the calculation in double precision
+ constexpr double inverseMax = 1.0 / ((1 << inputBitCount) - 1);
+ return static_cast<float>(input * inverseMax);
+ }
+ else
+ {
+ constexpr float inverseMax = 1.0f / ((1 << inputBitCount) - 1);
+ return input * inverseMax;
+ }
+}
+
+template <typename T>
+inline T floatToNormalized(float input)
+{
+ if (sizeof(T) > 2)
+ {
+ // float has only a 23 bit mantissa, so we need to do the calculation in double precision
+ return static_cast<T>(std::numeric_limits<T>::max() * static_cast<double>(input) + 0.5);
+ }
+ else
+ {
+ return static_cast<T>(std::numeric_limits<T>::max() * input + 0.5f);
+ }
+}
+
+template <unsigned int outputBitCount, typename T>
+inline T floatToNormalized(float input)
+{
+ static_assert(outputBitCount < (sizeof(T) * 8), "T must have more bits than outputBitCount.");
+
+ if (outputBitCount > 23)
+ {
+ // float has only a 23 bit mantissa, so we need to do the calculation in double precision
+ return static_cast<T>(((1 << outputBitCount) - 1) * static_cast<double>(input) + 0.5);
+ }
+ else
+ {
+ return static_cast<T>(((1 << outputBitCount) - 1) * input + 0.5f);
+ }
+}
+
+template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
+inline T getShiftedData(T input)
+{
+ static_assert(inputBitCount + inputBitStart <= (sizeof(T) * 8),
+ "T must have at least as many bits as inputBitCount + inputBitStart.");
+ const T mask = (1 << inputBitCount) - 1;
+ return (input >> inputBitStart) & mask;
+}
+
+template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
+inline T shiftData(T input)
+{
+ static_assert(inputBitCount + inputBitStart <= (sizeof(T) * 8),
+ "T must have at least as many bits as inputBitCount + inputBitStart.");
+ const T mask = (1 << inputBitCount) - 1;
+ return (input & mask) << inputBitStart;
+}
+
+inline unsigned int CountLeadingZeros(uint32_t x)
+{
+ // Use binary search to find the amount of leading zeros.
+ unsigned int zeros = 32u;
+ uint32_t y;
+
+ y = x >> 16u;
+ if (y != 0)
+ {
+ zeros = zeros - 16u;
+ x = y;
+ }
+ y = x >> 8u;
+ if (y != 0)
+ {
+ zeros = zeros - 8u;
+ x = y;
+ }
+ y = x >> 4u;
+ if (y != 0)
+ {
+ zeros = zeros - 4u;
+ x = y;
+ }
+ y = x >> 2u;
+ if (y != 0)
+ {
+ zeros = zeros - 2u;
+ x = y;
+ }
+ y = x >> 1u;
+ if (y != 0)
+ {
+ return zeros - 2u;
+ }
+ return zeros - x;
+}
+
+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 int average(int a, int b)
+{
+ long long average = (static_cast<long long>(a) + static_cast<long long>(b)) / 2ll;
+ return static_cast<int>(average);
+}
+
+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(static_cast<unsigned short>(a)) +
+ float11ToFloat32(static_cast<unsigned short>(b))) *
+ 0.5f);
+}
+
+inline unsigned int averageFloat10(unsigned int a, unsigned int b)
+{
+ return float32ToFloat10((float10ToFloat32(static_cast<unsigned short>(a)) +
+ float10ToFloat32(static_cast<unsigned short>(b))) *
+ 0.5f);
+}
+
+template <typename T>
+class Range
+{
+ public:
+ Range() {}
+ Range(T lo, T hi) : mLow(lo), mHigh(hi) {}
+
+ T length() const { return (empty() ? 0 : (mHigh - mLow)); }
+
+ bool intersects(Range<T> other)
+ {
+ if (mLow <= other.mLow)
+ {
+ return other.mLow < mHigh;
+ }
+ else
+ {
+ return mLow < other.mHigh;
+ }
+ }
+
+ // Assumes that end is non-inclusive.. for example, extending to 5 will make "end" 6.
+ void extend(T value)
+ {
+ mLow = value < mLow ? value : mLow;
+ mHigh = value >= mHigh ? (value + 1) : mHigh;
+ }
+
+ bool empty() const { return mHigh <= mLow; }
+
+ bool contains(T value) const { return value >= mLow && value < mHigh; }
+
+ class Iterator final
+ {
+ public:
+ Iterator(T value) : mCurrent(value) {}
+
+ Iterator &operator++()
+ {
+ mCurrent++;
+ return *this;
+ }
+ bool operator==(const Iterator &other) const { return mCurrent == other.mCurrent; }
+ bool operator!=(const Iterator &other) const { return mCurrent != other.mCurrent; }
+ T operator*() const { return mCurrent; }
+
+ private:
+ T mCurrent;
+ };
+
+ Iterator begin() const { return Iterator(mLow); }
+
+ Iterator end() const { return Iterator(mHigh); }
+
+ T low() const { return mLow; }
+ T high() const { return mHigh; }
+
+ void invalidate()
+ {
+ mLow = std::numeric_limits<T>::max();
+ mHigh = std::numeric_limits<T>::min();
+ }
+
+ private:
+ T mLow;
+ T mHigh;
+};
+
+typedef Range<int> RangeI;
+typedef Range<unsigned int> RangeUI;
+
+struct IndexRange
+{
+ struct Undefined
+ {};
+ IndexRange(Undefined) {}
+ IndexRange() : IndexRange(0, 0, 0) {}
+ IndexRange(size_t start_, size_t end_, size_t vertexIndexCount_)
+ : start(start_), end(end_), vertexIndexCount(vertexIndexCount_)
+ {
+ ASSERT(start <= end);
+ }
+
+ // Number of vertices in the range.
+ size_t vertexCount() const { return (end - start) + 1; }
+
+ // Inclusive range of indices that are not primitive restart
+ size_t start;
+ size_t end;
+
+ // Number of non-primitive restart indices
+ size_t vertexIndexCount;
+};
+
+// Combine a floating-point value representing a mantissa (x) and an integer exponent (exp) into a
+// floating-point value. As in GLSL ldexp() built-in.
+inline float Ldexp(float x, int exp)
+{
+ if (exp > 128)
+ {
+ return std::numeric_limits<float>::infinity();
+ }
+ if (exp < -126)
+ {
+ return 0.0f;
+ }
+ double result = static_cast<double>(x) * std::pow(2.0, static_cast<double>(exp));
+ return static_cast<float>(result);
+}
+
+// First, both normalized floating-point values are converted into 16-bit integer values.
+// Then, the results are packed into the returned 32-bit unsigned integer.
+// The first float value will be written to the least significant bits of the output;
+// the last float value will be written to the most significant bits.
+// The conversion of each value to fixed point is done as follows :
+// packSnorm2x16 : round(clamp(c, -1, +1) * 32767.0)
+inline uint32_t packSnorm2x16(float f1, float f2)
+{
+ int16_t leastSignificantBits = static_cast<int16_t>(roundf(clamp(f1, -1.0f, 1.0f) * 32767.0f));
+ int16_t mostSignificantBits = static_cast<int16_t>(roundf(clamp(f2, -1.0f, 1.0f) * 32767.0f));
+ return static_cast<uint32_t>(mostSignificantBits) << 16 |
+ (static_cast<uint32_t>(leastSignificantBits) & 0xFFFF);
+}
+
+// First, unpacks a single 32-bit unsigned integer u into a pair of 16-bit unsigned integers. Then,
+// each component is converted to a normalized floating-point value to generate the returned two
+// float values. The first float value will be extracted from the least significant bits of the
+// input; the last float value will be extracted from the most-significant bits. The conversion for
+// unpacked fixed-point value to floating point is done as follows: unpackSnorm2x16 : clamp(f /
+// 32767.0, -1, +1)
+inline void unpackSnorm2x16(uint32_t u, float *f1, float *f2)
+{
+ int16_t leastSignificantBits = static_cast<int16_t>(u & 0xFFFF);
+ int16_t mostSignificantBits = static_cast<int16_t>(u >> 16);
+ *f1 = clamp(static_cast<float>(leastSignificantBits) / 32767.0f, -1.0f, 1.0f);
+ *f2 = clamp(static_cast<float>(mostSignificantBits) / 32767.0f, -1.0f, 1.0f);
+}
+
+// First, both normalized floating-point values are converted into 16-bit integer values.
+// Then, the results are packed into the returned 32-bit unsigned integer.
+// The first float value will be written to the least significant bits of the output;
+// the last float value will be written to the most significant bits.
+// The conversion of each value to fixed point is done as follows:
+// packUnorm2x16 : round(clamp(c, 0, +1) * 65535.0)
+inline uint32_t packUnorm2x16(float f1, float f2)
+{
+ uint16_t leastSignificantBits = static_cast<uint16_t>(roundf(clamp(f1, 0.0f, 1.0f) * 65535.0f));
+ uint16_t mostSignificantBits = static_cast<uint16_t>(roundf(clamp(f2, 0.0f, 1.0f) * 65535.0f));
+ return static_cast<uint32_t>(mostSignificantBits) << 16 |
+ static_cast<uint32_t>(leastSignificantBits);
+}
+
+// First, unpacks a single 32-bit unsigned integer u into a pair of 16-bit unsigned integers. Then,
+// each component is converted to a normalized floating-point value to generate the returned two
+// float values. The first float value will be extracted from the least significant bits of the
+// input; the last float value will be extracted from the most-significant bits. The conversion for
+// unpacked fixed-point value to floating point is done as follows: unpackUnorm2x16 : f / 65535.0
+inline void unpackUnorm2x16(uint32_t u, float *f1, float *f2)
+{
+ uint16_t leastSignificantBits = static_cast<uint16_t>(u & 0xFFFF);
+ uint16_t mostSignificantBits = static_cast<uint16_t>(u >> 16);
+ *f1 = static_cast<float>(leastSignificantBits) / 65535.0f;
+ *f2 = static_cast<float>(mostSignificantBits) / 65535.0f;
+}
+
+// Helper functions intended to be used only here.
+namespace priv
+{
+
+inline uint8_t ToPackedUnorm8(float f)
+{
+ return static_cast<uint8_t>(roundf(clamp(f, 0.0f, 1.0f) * 255.0f));
+}
+
+inline int8_t ToPackedSnorm8(float f)
+{
+ return static_cast<int8_t>(roundf(clamp(f, -1.0f, 1.0f) * 127.0f));
+}
+
+} // namespace priv
+
+// Packs 4 normalized unsigned floating-point values to a single 32-bit unsigned integer. Works
+// similarly to packUnorm2x16. The floats are clamped to the range 0.0 to 1.0, and written to the
+// unsigned integer starting from the least significant bits.
+inline uint32_t PackUnorm4x8(float f1, float f2, float f3, float f4)
+{
+ uint8_t bits[4];
+ bits[0] = priv::ToPackedUnorm8(f1);
+ bits[1] = priv::ToPackedUnorm8(f2);
+ bits[2] = priv::ToPackedUnorm8(f3);
+ bits[3] = priv::ToPackedUnorm8(f4);
+ uint32_t result = 0u;
+ for (int i = 0; i < 4; ++i)
+ {
+ int shift = i * 8;
+ result |= (static_cast<uint32_t>(bits[i]) << shift);
+ }
+ return result;
+}
+
+// Unpacks 4 normalized unsigned floating-point values from a single 32-bit unsigned integer into f.
+// Works similarly to unpackUnorm2x16. The floats are unpacked starting from the least significant
+// bits.
+inline void UnpackUnorm4x8(uint32_t u, float *f)
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ int shift = i * 8;
+ uint8_t bits = static_cast<uint8_t>((u >> shift) & 0xFF);
+ f[i] = static_cast<float>(bits) / 255.0f;
+ }
+}
+
+// Packs 4 normalized signed floating-point values to a single 32-bit unsigned integer. The floats
+// are clamped to the range -1.0 to 1.0, and written to the unsigned integer starting from the least
+// significant bits.
+inline uint32_t PackSnorm4x8(float f1, float f2, float f3, float f4)
+{
+ int8_t bits[4];
+ bits[0] = priv::ToPackedSnorm8(f1);
+ bits[1] = priv::ToPackedSnorm8(f2);
+ bits[2] = priv::ToPackedSnorm8(f3);
+ bits[3] = priv::ToPackedSnorm8(f4);
+ uint32_t result = 0u;
+ for (int i = 0; i < 4; ++i)
+ {
+ int shift = i * 8;
+ result |= ((static_cast<uint32_t>(bits[i]) & 0xFF) << shift);
+ }
+ return result;
+}
+
+// Unpacks 4 normalized signed floating-point values from a single 32-bit unsigned integer into f.
+// Works similarly to unpackSnorm2x16. The floats are unpacked starting from the least significant
+// bits, and clamped to the range -1.0 to 1.0.
+inline void UnpackSnorm4x8(uint32_t u, float *f)
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ int shift = i * 8;
+ int8_t bits = static_cast<int8_t>((u >> shift) & 0xFF);
+ f[i] = clamp(static_cast<float>(bits) / 127.0f, -1.0f, 1.0f);
+ }
+}
+
+// Returns an unsigned integer obtained by converting the two floating-point values to the 16-bit
+// floating-point representation found in the OpenGL ES Specification, and then packing these
+// two 16-bit integers into a 32-bit unsigned integer.
+// f1: The 16 least-significant bits of the result;
+// f2: The 16 most-significant bits.
+inline uint32_t packHalf2x16(float f1, float f2)
+{
+ uint16_t leastSignificantBits = static_cast<uint16_t>(float32ToFloat16(f1));
+ uint16_t mostSignificantBits = static_cast<uint16_t>(float32ToFloat16(f2));
+ return static_cast<uint32_t>(mostSignificantBits) << 16 |
+ static_cast<uint32_t>(leastSignificantBits);
+}
+
+// Returns two floating-point values obtained by unpacking a 32-bit unsigned integer into a pair of
+// 16-bit values, interpreting those values as 16-bit floating-point numbers according to the OpenGL
+// ES Specification, and converting them to 32-bit floating-point values. The first float value is
+// obtained from the 16 least-significant bits of u; the second component is obtained from the 16
+// most-significant bits of u.
+inline void unpackHalf2x16(uint32_t u, float *f1, float *f2)
+{
+ uint16_t leastSignificantBits = static_cast<uint16_t>(u & 0xFFFF);
+ uint16_t mostSignificantBits = static_cast<uint16_t>(u >> 16);
+
+ *f1 = float16ToFloat32(leastSignificantBits);
+ *f2 = float16ToFloat32(mostSignificantBits);
+}
+
+inline uint8_t sRGBToLinear(uint8_t srgbValue)
+{
+ float value = srgbValue / 255.0f;
+ if (value <= 0.04045f)
+ {
+ value = value / 12.92f;
+ }
+ else
+ {
+ value = std::pow((value + 0.055f) / 1.055f, 2.4f);
+ }
+ return static_cast<uint8_t>(clamp(value * 255.0f + 0.5f, 0.0f, 255.0f));
+}
+
+inline uint8_t linearToSRGB(uint8_t linearValue)
+{
+ float value = linearValue / 255.0f;
+ if (value <= 0.0f)
+ {
+ value = 0.0f;
+ }
+ else if (value < 0.0031308f)
+ {
+ value = value * 12.92f;
+ }
+ else if (value < 1.0f)
+ {
+ value = std::pow(value, 0.41666f) * 1.055f - 0.055f;
+ }
+ else
+ {
+ value = 1.0f;
+ }
+ return static_cast<uint8_t>(clamp(value * 255.0f + 0.5f, 0.0f, 255.0f));
+}
+
+// Reverse the order of the bits.
+inline uint32_t BitfieldReverse(uint32_t value)
+{
+ // TODO(oetuaho@nvidia.com): Optimize this if needed. There don't seem to be compiler intrinsics
+ // for this, and right now it's not used in performance-critical paths.
+ uint32_t result = 0u;
+ for (size_t j = 0u; j < 32u; ++j)
+ {
+ result |= (((value >> j) & 1u) << (31u - j));
+ }
+ return result;
+}
+
+// Count the 1 bits.
+#if defined(_M_IX86) || defined(_M_X64)
+# define ANGLE_HAS_BITCOUNT_32
+inline int BitCount(uint32_t bits)
+{
+ return static_cast<int>(__popcnt(bits));
+}
+# if defined(_M_X64)
+# define ANGLE_HAS_BITCOUNT_64
+inline int BitCount(uint64_t bits)
+{
+ return static_cast<int>(__popcnt64(bits));
+}
+# endif // defined(_M_X64)
+#endif // defined(_M_IX86) || defined(_M_X64)
+
+#if defined(ANGLE_PLATFORM_POSIX)
+# define ANGLE_HAS_BITCOUNT_32
+inline int BitCount(uint32_t bits)
+{
+ return __builtin_popcount(bits);
+}
+
+# if defined(ANGLE_IS_64_BIT_CPU)
+# define ANGLE_HAS_BITCOUNT_64
+inline int BitCount(uint64_t bits)
+{
+ return __builtin_popcountll(bits);
+}
+# endif // defined(ANGLE_IS_64_BIT_CPU)
+#endif // defined(ANGLE_PLATFORM_POSIX)
+
+int BitCountPolyfill(uint32_t bits);
+
+#if !defined(ANGLE_HAS_BITCOUNT_32)
+inline int BitCount(const uint32_t bits)
+{
+ return BitCountPolyfill(bits);
+}
+#endif // !defined(ANGLE_HAS_BITCOUNT_32)
+
+#if !defined(ANGLE_HAS_BITCOUNT_64)
+inline int BitCount(const uint64_t bits)
+{
+ return BitCount(static_cast<uint32_t>(bits >> 32)) + BitCount(static_cast<uint32_t>(bits));
+}
+#endif // !defined(ANGLE_HAS_BITCOUNT_64)
+#undef ANGLE_HAS_BITCOUNT_32
+#undef ANGLE_HAS_BITCOUNT_64
+
+inline int BitCount(uint8_t bits)
+{
+ return BitCount(static_cast<uint32_t>(bits));
+}
+
+inline int BitCount(uint16_t bits)
+{
+ return BitCount(static_cast<uint32_t>(bits));
+}
+
+#if defined(ANGLE_PLATFORM_WINDOWS)
+// Return the index of the least significant bit set. Indexing is such that bit 0 is the least
+// significant bit. Implemented for different bit widths on different platforms.
+inline unsigned long ScanForward(uint32_t bits)
+{
+ ASSERT(bits != 0u);
+ unsigned long firstBitIndex = 0ul;
+ unsigned char ret = _BitScanForward(&firstBitIndex, bits);
+ ASSERT(ret != 0u);
+ return firstBitIndex;
+}
+
+# if defined(ANGLE_IS_64_BIT_CPU)
+inline unsigned long ScanForward(uint64_t bits)
+{
+ ASSERT(bits != 0u);
+ unsigned long firstBitIndex = 0ul;
+ unsigned char ret = _BitScanForward64(&firstBitIndex, bits);
+ ASSERT(ret != 0u);
+ return firstBitIndex;
+}
+# endif // defined(ANGLE_IS_64_BIT_CPU)
+#endif // defined(ANGLE_PLATFORM_WINDOWS)
+
+#if defined(ANGLE_PLATFORM_POSIX)
+inline unsigned long ScanForward(uint32_t bits)
+{
+ ASSERT(bits != 0u);
+ return static_cast<unsigned long>(__builtin_ctz(bits));
+}
+
+# if defined(ANGLE_IS_64_BIT_CPU)
+inline unsigned long ScanForward(uint64_t bits)
+{
+ ASSERT(bits != 0u);
+ return static_cast<unsigned long>(__builtin_ctzll(bits));
+}
+# endif // defined(ANGLE_IS_64_BIT_CPU)
+#endif // defined(ANGLE_PLATFORM_POSIX)
+
+inline unsigned long ScanForward(uint8_t bits)
+{
+ return ScanForward(static_cast<uint32_t>(bits));
+}
+
+inline unsigned long ScanForward(uint16_t bits)
+{
+ return ScanForward(static_cast<uint32_t>(bits));
+}
+
+// Return the index of the most significant bit set. Indexing is such that bit 0 is the least
+// significant bit.
+inline unsigned long ScanReverse(unsigned long bits)
+{
+ ASSERT(bits != 0u);
+#if defined(ANGLE_PLATFORM_WINDOWS)
+ unsigned long lastBitIndex = 0ul;
+ unsigned char ret = _BitScanReverse(&lastBitIndex, bits);
+ ASSERT(ret != 0u);
+ return lastBitIndex;
+#elif defined(ANGLE_PLATFORM_POSIX)
+ return static_cast<unsigned long>(sizeof(unsigned long) * CHAR_BIT - 1 - __builtin_clzl(bits));
+#else
+# error Please implement bit-scan-reverse for your platform!
+#endif
+}
+
+// Returns -1 on 0, otherwise the index of the least significant 1 bit as in GLSL.
+template <typename T>
+int FindLSB(T bits)
+{
+ static_assert(std::is_integral<T>::value, "must be integral type.");
+ if (bits == 0u)
+ {
+ return -1;
+ }
+ else
+ {
+ return static_cast<int>(ScanForward(bits));
+ }
+}
+
+// Returns -1 on 0, otherwise the index of the most significant 1 bit as in GLSL.
+template <typename T>
+int FindMSB(T bits)
+{
+ static_assert(std::is_integral<T>::value, "must be integral type.");
+ if (bits == 0u)
+ {
+ return -1;
+ }
+ else
+ {
+ return static_cast<int>(ScanReverse(bits));
+ }
+}
+
+// Returns whether the argument is Not a Number.
+// IEEE 754 single precision NaN representation: Exponent(8 bits) - 255, Mantissa(23 bits) -
+// non-zero.
+inline bool isNaN(float f)
+{
+ // Exponent mask: ((1u << 8) - 1u) << 23 = 0x7f800000u
+ // Mantissa mask: ((1u << 23) - 1u) = 0x7fffffu
+ return ((bitCast<uint32_t>(f) & 0x7f800000u) == 0x7f800000u) &&
+ (bitCast<uint32_t>(f) & 0x7fffffu);
+}
+
+// Returns whether the argument is infinity.
+// IEEE 754 single precision infinity representation: Exponent(8 bits) - 255, Mantissa(23 bits) -
+// zero.
+inline bool isInf(float f)
+{
+ // Exponent mask: ((1u << 8) - 1u) << 23 = 0x7f800000u
+ // Mantissa mask: ((1u << 23) - 1u) = 0x7fffffu
+ return ((bitCast<uint32_t>(f) & 0x7f800000u) == 0x7f800000u) &&
+ !(bitCast<uint32_t>(f) & 0x7fffffu);
+}
+
+namespace priv
+{
+template <unsigned int N, unsigned int R>
+struct iSquareRoot
+{
+ static constexpr unsigned int solve()
+ {
+ return (R * R > N)
+ ? 0
+ : ((R * R == N) ? R : static_cast<unsigned int>(iSquareRoot<N, R + 1>::value));
+ }
+ enum Result
+ {
+ value = iSquareRoot::solve()
+ };
+};
+
+template <unsigned int N>
+struct iSquareRoot<N, N>
+{
+ enum result
+ {
+ value = N
+ };
+};
+
+} // namespace priv
+
+template <unsigned int N>
+constexpr unsigned int iSquareRoot()
+{
+ return priv::iSquareRoot<N, 1>::value;
+}
+
+// Sum, difference and multiplication operations for signed ints that wrap on 32-bit overflow.
+//
+// Unsigned types are defined to do arithmetic modulo 2^n in C++. For signed types, overflow
+// behavior is undefined.
+
+template <typename T>
+inline T WrappingSum(T lhs, T rhs)
+{
+ uint32_t lhsUnsigned = static_cast<uint32_t>(lhs);
+ uint32_t rhsUnsigned = static_cast<uint32_t>(rhs);
+ return static_cast<T>(lhsUnsigned + rhsUnsigned);
+}
+
+template <typename T>
+inline T WrappingDiff(T lhs, T rhs)
+{
+ uint32_t lhsUnsigned = static_cast<uint32_t>(lhs);
+ uint32_t rhsUnsigned = static_cast<uint32_t>(rhs);
+ return static_cast<T>(lhsUnsigned - rhsUnsigned);
+}
+
+inline int32_t WrappingMul(int32_t lhs, int32_t rhs)
+{
+ int64_t lhsWide = static_cast<int64_t>(lhs);
+ int64_t rhsWide = static_cast<int64_t>(rhs);
+ // The multiplication is guaranteed not to overflow.
+ int64_t resultWide = lhsWide * rhsWide;
+ // Implement the desired wrapping behavior by masking out the high-order 32 bits.
+ resultWide = resultWide & 0xffffffffll;
+ // Casting to a narrower signed type is fine since the casted value is representable in the
+ // narrower type.
+ return static_cast<int32_t>(resultWide);
+}
+
+inline float scaleScreenDimensionToNdc(float dimensionScreen, float viewportDimension)
+{
+ return 2.0f * dimensionScreen / viewportDimension;
+}
+
+inline float scaleScreenCoordinateToNdc(float coordinateScreen, float viewportDimension)
+{
+ float halfShifted = coordinateScreen / viewportDimension;
+ return 2.0f * (halfShifted - 0.5f);
+}
+
+} // namespace gl
+
+namespace rx
+{
+
+template <typename T>
+T roundUp(const T value, const T alignment)
+{
+ auto temp = value + alignment - static_cast<T>(1);
+ return temp - temp % alignment;
+}
+
+template <typename T>
+angle::CheckedNumeric<T> CheckedRoundUp(const T value, const T alignment)
+{
+ angle::CheckedNumeric<T> checkedValue(value);
+ angle::CheckedNumeric<T> checkedAlignment(alignment);
+ return roundUp(checkedValue, checkedAlignment);
+}
+
+inline constexpr unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
+{
+ unsigned int divided = value / divisor;
+ return (divided + ((value % divisor == 0) ? 0 : 1));
+}
+
+#if defined(__has_builtin)
+# define ANGLE_HAS_BUILTIN(x) __has_builtin(x)
+#else
+# define ANGLE_HAS_BUILTIN(x) 0
+#endif
+
+#if defined(_MSC_VER)
+
+# define ANGLE_ROTL(x, y) _rotl(x, y)
+# define ANGLE_ROTL64(x, y) _rotl64(x, y)
+# define ANGLE_ROTR16(x, y) _rotr16(x, y)
+
+#elif defined(__clang__) && ANGLE_HAS_BUILTIN(__builtin_rotateleft32) && \
+ ANGLE_HAS_BUILTIN(__builtin_rotateleft64) && ANGLE_HAS_BUILTIN(__builtin_rotateright16)
+
+# define ANGLE_ROTL(x, y) __builtin_rotateleft32(x, y)
+# define ANGLE_ROTL64(x, y) __builtin_rotateleft64(x, y)
+# define ANGLE_ROTR16(x, y) __builtin_rotateright16(x, y)
+
+#else
+
+inline uint32_t RotL(uint32_t x, int8_t r)
+{
+ return (x << r) | (x >> (32 - r));
+}
+
+inline uint64_t RotL64(uint64_t x, int8_t r)
+{
+ return (x << r) | (x >> (64 - r));
+}
+
+inline uint16_t RotR16(uint16_t x, int8_t r)
+{
+ return (x >> r) | (x << (16 - r));
+}
+
+# define ANGLE_ROTL(x, y) ::rx::RotL(x, y)
+# define ANGLE_ROTL64(x, y) ::rx::RotL64(x, y)
+# define ANGLE_ROTR16(x, y) ::rx::RotR16(x, y)
+
+#endif // namespace rx
+
+constexpr unsigned int Log2(unsigned int bytes)
+{
+ return bytes == 1 ? 0 : (1 + Log2(bytes / 2));
+}
+} // namespace rx
+
+#endif // COMMON_MATHUTIL_H_
diff --git a/gfx/angle/checkout/src/common/matrix_utils.cpp b/gfx/angle/checkout/src/common/matrix_utils.cpp
new file mode 100644
index 0000000000..59ab4ca437
--- /dev/null
+++ b/gfx/angle/checkout/src/common/matrix_utils.cpp
@@ -0,0 +1,285 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// matrix_utils.cpp: Contains implementations for Mat4 methods.
+
+#include "common/matrix_utils.h"
+
+namespace angle
+{
+
+Mat4::Mat4() : Mat4(1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f)
+{}
+
+Mat4::Mat4(const Matrix<float> generalMatrix) : Matrix(std::vector<float>(16, 0), 4, 4)
+{
+ unsigned int minCols = std::min((unsigned int)4, generalMatrix.columns());
+ unsigned int minRows = std::min((unsigned int)4, generalMatrix.rows());
+ for (unsigned int i = 0; i < minCols; i++)
+ {
+ for (unsigned int j = 0; j < minRows; j++)
+ {
+ mElements[j * minCols + i] = generalMatrix.at(j, i);
+ }
+ }
+}
+
+Mat4::Mat4(const std::vector<float> &elements) : Matrix(elements, 4) {}
+
+Mat4::Mat4(const float *elements) : Matrix(elements, 4) {}
+
+Mat4::Mat4(float m00,
+ float m01,
+ float m02,
+ float m03,
+ float m10,
+ float m11,
+ float m12,
+ float m13,
+ float m20,
+ float m21,
+ float m22,
+ float m23,
+ float m30,
+ float m31,
+ float m32,
+ float m33)
+ : Matrix(std::vector<float>(16, 0), 4, 4)
+{
+ mElements[0] = m00;
+ mElements[1] = m01;
+ mElements[2] = m02;
+ mElements[3] = m03;
+ mElements[4] = m10;
+ mElements[5] = m11;
+ mElements[6] = m12;
+ mElements[7] = m13;
+ mElements[8] = m20;
+ mElements[9] = m21;
+ mElements[10] = m22;
+ mElements[11] = m23;
+ mElements[12] = m30;
+ mElements[13] = m31;
+ mElements[14] = m32;
+ mElements[15] = m33;
+}
+
+// static
+Mat4 Mat4::Rotate(float angle, const Vector3 &axis)
+{
+ auto axis_normalized = axis.normalized();
+ float angle_radians = angle * (3.14159265358979323f / 180.0f);
+ float c = cos(angle_radians);
+ float ci = 1.f - c;
+ float s = sin(angle_radians);
+
+ float x = axis_normalized.x();
+ float y = axis_normalized.y();
+ float z = axis_normalized.z();
+
+ float x2 = x * x;
+ float y2 = y * y;
+ float z2 = z * z;
+
+ float xy = x * y;
+ float yz = y * z;
+ float zx = z * x;
+
+ float r00 = c + ci * x2;
+ float r01 = ci * xy + s * z;
+ float r02 = ci * zx - s * y;
+ float r03 = 0.f;
+
+ float r10 = ci * xy - s * z;
+ float r11 = c + ci * y2;
+ float r12 = ci * yz + s * x;
+ float r13 = 0.f;
+
+ float r20 = ci * zx + s * y;
+ float r21 = ci * yz - s * x;
+ float r22 = c + ci * z2;
+ float r23 = 0.f;
+
+ float r30 = 0.f;
+ float r31 = 0.f;
+ float r32 = 0.f;
+ float r33 = 1.f;
+
+ return Mat4(r00, r01, r02, r03, r10, r11, r12, r13, r20, r21, r22, r23, r30, r31, r32, r33);
+}
+
+// static
+Mat4 Mat4::Translate(const Vector3 &t)
+{
+ float r00 = 1.f;
+ float r01 = 0.f;
+ float r02 = 0.f;
+ float r03 = 0.f;
+
+ float r10 = 0.f;
+ float r11 = 1.f;
+ float r12 = 0.f;
+ float r13 = 0.f;
+
+ float r20 = 0.f;
+ float r21 = 0.f;
+ float r22 = 1.f;
+ float r23 = 0.f;
+
+ float r30 = t.x();
+ float r31 = t.y();
+ float r32 = t.z();
+ float r33 = 1.f;
+
+ return Mat4(r00, r01, r02, r03, r10, r11, r12, r13, r20, r21, r22, r23, r30, r31, r32, r33);
+}
+
+// static
+Mat4 Mat4::Scale(const Vector3 &s)
+{
+ float r00 = s.x();
+ float r01 = 0.f;
+ float r02 = 0.f;
+ float r03 = 0.f;
+
+ float r10 = 0.f;
+ float r11 = s.y();
+ float r12 = 0.f;
+ float r13 = 0.f;
+
+ float r20 = 0.f;
+ float r21 = 0.f;
+ float r22 = s.z();
+ float r23 = 0.f;
+
+ float r30 = 0.f;
+ float r31 = 0.f;
+ float r32 = 0.f;
+ float r33 = 1.f;
+
+ return Mat4(r00, r01, r02, r03, r10, r11, r12, r13, r20, r21, r22, r23, r30, r31, r32, r33);
+}
+
+// static
+Mat4 Mat4::Frustum(float l, float r, float b, float t, float n, float f)
+{
+ float nn = 2.f * n;
+ float fpn = f + n;
+ float fmn = f - n;
+ float tpb = t + b;
+ float tmb = t - b;
+ float rpl = r + l;
+ float rml = r - l;
+
+ float r00 = nn / rml;
+ float r01 = 0.f;
+ float r02 = 0.f;
+ float r03 = 0.f;
+
+ float r10 = 0.f;
+ float r11 = nn / tmb;
+ float r12 = 0.f;
+ float r13 = 0.f;
+
+ float r20 = rpl / rml;
+ float r21 = tpb / tmb;
+ float r22 = -fpn / fmn;
+ float r23 = -1.f;
+
+ float r30 = 0.f;
+ float r31 = 0.f;
+ float r32 = -nn * f / fmn;
+ float r33 = 0.f;
+
+ return Mat4(r00, r01, r02, r03, r10, r11, r12, r13, r20, r21, r22, r23, r30, r31, r32, r33);
+}
+
+// static
+Mat4 Mat4::Perspective(float fov, float aspectRatio, float n, float f)
+{
+ const float frustumHeight = tanf(static_cast<float>(fov / 360.0f * 3.14159265358979323)) * n;
+ const float frustumWidth = frustumHeight * aspectRatio;
+ return Frustum(-frustumWidth, frustumWidth, -frustumHeight, frustumHeight, n, f);
+}
+
+// static
+Mat4 Mat4::Ortho(float l, float r, float b, float t, float n, float f)
+{
+ float fpn = f + n;
+ float fmn = f - n;
+ float tpb = t + b;
+ float tmb = t - b;
+ float rpl = r + l;
+ float rml = r - l;
+
+ float r00 = 2.f / rml;
+ float r01 = 0.f;
+ float r02 = 0.f;
+ float r03 = 0.f;
+
+ float r10 = 0.f;
+ float r11 = 2.f / tmb;
+ float r12 = 0.f;
+ float r13 = 0.f;
+
+ float r20 = 0.f;
+ float r21 = 0.f;
+ float r22 = -2.f / fmn;
+ float r23 = 0.f;
+
+ float r30 = -rpl / rml;
+ float r31 = -tpb / tmb;
+ float r32 = -fpn / fmn;
+ float r33 = 1.f;
+
+ return Mat4(r00, r01, r02, r03, r10, r11, r12, r13, r20, r21, r22, r23, r30, r31, r32, r33);
+}
+
+Mat4 Mat4::product(const Mat4 &m)
+{
+ const float *a = mElements.data();
+ const float *b = m.mElements.data();
+
+ return Mat4(a[0] * b[0] + a[4] * b[1] + a[8] * b[2] + a[12] * b[3],
+ a[1] * b[0] + a[5] * b[1] + a[9] * b[2] + a[13] * b[3],
+ a[2] * b[0] + a[6] * b[1] + a[10] * b[2] + a[14] * b[3],
+ a[3] * b[0] + a[7] * b[1] + a[11] * b[2] + a[15] * b[3],
+
+ a[0] * b[4] + a[4] * b[5] + a[8] * b[6] + a[12] * b[7],
+ a[1] * b[4] + a[5] * b[5] + a[9] * b[6] + a[13] * b[7],
+ a[2] * b[4] + a[6] * b[5] + a[10] * b[6] + a[14] * b[7],
+ a[3] * b[4] + a[7] * b[5] + a[11] * b[6] + a[15] * b[7],
+
+ a[0] * b[8] + a[4] * b[9] + a[8] * b[10] + a[12] * b[11],
+ a[1] * b[8] + a[5] * b[9] + a[9] * b[10] + a[13] * b[11],
+ a[2] * b[8] + a[6] * b[9] + a[10] * b[10] + a[14] * b[11],
+ a[3] * b[8] + a[7] * b[9] + a[11] * b[10] + a[15] * b[11],
+
+ a[0] * b[12] + a[4] * b[13] + a[8] * b[14] + a[12] * b[15],
+ a[1] * b[12] + a[5] * b[13] + a[9] * b[14] + a[13] * b[15],
+ a[2] * b[12] + a[6] * b[13] + a[10] * b[14] + a[14] * b[15],
+ a[3] * b[12] + a[7] * b[13] + a[11] * b[14] + a[15] * b[15]);
+}
+
+Vector4 Mat4::product(const Vector4 &b)
+{
+ return Vector4(
+ mElements[0] * b.x() + mElements[4] * b.y() + mElements[8] * b.z() + mElements[12] * b.w(),
+ mElements[1] * b.x() + mElements[5] * b.y() + mElements[9] * b.z() + mElements[13] * b.w(),
+ mElements[2] * b.x() + mElements[6] * b.y() + mElements[10] * b.z() + mElements[14] * b.w(),
+ mElements[3] * b.x() + mElements[7] * b.y() + mElements[11] * b.z() +
+ mElements[15] * b.w());
+}
+
+void Mat4::dump()
+{
+ printf("[ %f %f %f %f ]\n", mElements[0], mElements[4], mElements[8], mElements[12]);
+ printf("[ %f %f %f %f ]\n", mElements[1], mElements[5], mElements[9], mElements[13]);
+ printf("[ %f %f %f %f ]\n", mElements[2], mElements[6], mElements[10], mElements[14]);
+ printf("[ %f %f %f %f ]\n", mElements[3], mElements[7], mElements[11], mElements[15]);
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/matrix_utils.h b/gfx/angle/checkout/src/common/matrix_utils.h
new file mode 100644
index 0000000000..5a6b9680c2
--- /dev/null
+++ b/gfx/angle/checkout/src/common/matrix_utils.h
@@ -0,0 +1,423 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Matrix:
+// Utility class implementing various matrix operations.
+// Supports matrices with minimum 2 and maximum 4 number of rows/columns.
+//
+// TODO: Check if we can merge Matrix.h in sample_util with this and replace it with this
+// implementation.
+// TODO: Rename this file to Matrix.h once we remove Matrix.h in sample_util.
+
+#ifndef COMMON_MATRIX_UTILS_H_
+#define COMMON_MATRIX_UTILS_H_
+
+#include <vector>
+
+#include "common/debug.h"
+#include "common/mathutil.h"
+#include "common/vector_utils.h"
+
+namespace angle
+{
+
+template <typename T>
+class Matrix
+{
+ public:
+ Matrix(const std::vector<T> &elements, const unsigned int numRows, const unsigned int numCols)
+ : mElements(elements), mRows(numRows), mCols(numCols)
+ {
+ ASSERT(rows() >= 1 && rows() <= 4);
+ ASSERT(columns() >= 1 && columns() <= 4);
+ }
+
+ Matrix(const std::vector<T> &elements, const unsigned int size)
+ : mElements(elements), mRows(size), mCols(size)
+ {
+ ASSERT(rows() >= 1 && rows() <= 4);
+ ASSERT(columns() >= 1 && columns() <= 4);
+ }
+
+ Matrix(const T *elements, const unsigned int size) : mRows(size), mCols(size)
+ {
+ ASSERT(rows() >= 1 && rows() <= 4);
+ ASSERT(columns() >= 1 && columns() <= 4);
+ for (size_t i = 0; i < size * size; i++)
+ mElements.push_back(elements[i]);
+ }
+
+ const T &operator()(const unsigned int rowIndex, const unsigned int columnIndex) const
+ {
+ ASSERT(rowIndex < mRows);
+ ASSERT(columnIndex < mCols);
+ return mElements[rowIndex * columns() + columnIndex];
+ }
+
+ T &operator()(const unsigned int rowIndex, const unsigned int columnIndex)
+ {
+ ASSERT(rowIndex < mRows);
+ ASSERT(columnIndex < mCols);
+ return mElements[rowIndex * columns() + columnIndex];
+ }
+
+ const T &at(const unsigned int rowIndex, const unsigned int columnIndex) const
+ {
+ ASSERT(rowIndex < mRows);
+ ASSERT(columnIndex < mCols);
+ return operator()(rowIndex, columnIndex);
+ }
+
+ Matrix<T> operator*(const Matrix<T> &m)
+ {
+ ASSERT(columns() == m.rows());
+
+ unsigned int resultRows = rows();
+ unsigned int resultCols = m.columns();
+ Matrix<T> result(std::vector<T>(resultRows * resultCols), resultRows, resultCols);
+ for (unsigned int i = 0; i < resultRows; i++)
+ {
+ for (unsigned int j = 0; j < resultCols; j++)
+ {
+ T tmp = 0.0f;
+ for (unsigned int k = 0; k < columns(); k++)
+ tmp += at(i, k) * m(k, j);
+ result(i, j) = tmp;
+ }
+ }
+
+ return result;
+ }
+
+ void operator*=(const Matrix<T> &m)
+ {
+ ASSERT(columns() == m.rows());
+ Matrix<T> res = (*this) * m;
+ size_t numElts = res.elements().size();
+ mElements.resize(numElts);
+ memcpy(mElements.data(), res.data(), numElts * sizeof(float));
+ }
+
+ bool operator==(const Matrix<T> &m) const
+ {
+ ASSERT(columns() == m.columns());
+ ASSERT(rows() == m.rows());
+ return mElements == m.elements();
+ }
+
+ bool operator!=(const Matrix<T> &m) const { return !(mElements == m.elements()); }
+
+ bool nearlyEqual(T epsilon, const Matrix<T> &m) const
+ {
+ ASSERT(columns() == m.columns());
+ ASSERT(rows() == m.rows());
+ const auto &otherElts = m.elements();
+ for (size_t i = 0; i < otherElts.size(); i++)
+ {
+ if ((mElements[i] - otherElts[i] > epsilon) && (otherElts[i] - mElements[i] > epsilon))
+ return false;
+ }
+ return true;
+ }
+
+ unsigned int size() const
+ {
+ ASSERT(rows() == columns());
+ return rows();
+ }
+
+ unsigned int rows() const { return mRows; }
+
+ unsigned int columns() const { return mCols; }
+
+ std::vector<T> elements() const { return mElements; }
+ T *data() { return mElements.data(); }
+
+ Matrix<T> compMult(const Matrix<T> &mat1) const
+ {
+ Matrix result(std::vector<T>(mElements.size()), rows(), columns());
+ for (unsigned int i = 0; i < rows(); i++)
+ {
+ for (unsigned int j = 0; j < columns(); j++)
+ {
+ T lhs = at(i, j);
+ T rhs = mat1(i, j);
+ result(i, j) = rhs * lhs;
+ }
+ }
+
+ return result;
+ }
+
+ Matrix<T> outerProduct(const Matrix<T> &mat1) const
+ {
+ unsigned int cols = mat1.columns();
+ Matrix result(std::vector<T>(rows() * cols), rows(), cols);
+ for (unsigned int i = 0; i < rows(); i++)
+ for (unsigned int j = 0; j < cols; j++)
+ result(i, j) = at(i, 0) * mat1(0, j);
+
+ return result;
+ }
+
+ Matrix<T> transpose() const
+ {
+ Matrix result(std::vector<T>(mElements.size()), columns(), rows());
+ for (unsigned int i = 0; i < columns(); i++)
+ for (unsigned int j = 0; j < rows(); j++)
+ result(i, j) = at(j, i);
+
+ return result;
+ }
+
+ T determinant() const
+ {
+ ASSERT(rows() == columns());
+
+ switch (size())
+ {
+ case 2:
+ return at(0, 0) * at(1, 1) - at(0, 1) * at(1, 0);
+
+ case 3:
+ return at(0, 0) * at(1, 1) * at(2, 2) + at(0, 1) * at(1, 2) * at(2, 0) +
+ at(0, 2) * at(1, 0) * at(2, 1) - at(0, 2) * at(1, 1) * at(2, 0) -
+ at(0, 1) * at(1, 0) * at(2, 2) - at(0, 0) * at(1, 2) * at(2, 1);
+
+ case 4:
+ {
+ const float minorMatrices[4][3 * 3] = {{
+ at(1, 1),
+ at(2, 1),
+ at(3, 1),
+ at(1, 2),
+ at(2, 2),
+ at(3, 2),
+ at(1, 3),
+ at(2, 3),
+ at(3, 3),
+ },
+ {
+ at(1, 0),
+ at(2, 0),
+ at(3, 0),
+ at(1, 2),
+ at(2, 2),
+ at(3, 2),
+ at(1, 3),
+ at(2, 3),
+ at(3, 3),
+ },
+ {
+ at(1, 0),
+ at(2, 0),
+ at(3, 0),
+ at(1, 1),
+ at(2, 1),
+ at(3, 1),
+ at(1, 3),
+ at(2, 3),
+ at(3, 3),
+ },
+ {
+ at(1, 0),
+ at(2, 0),
+ at(3, 0),
+ at(1, 1),
+ at(2, 1),
+ at(3, 1),
+ at(1, 2),
+ at(2, 2),
+ at(3, 2),
+ }};
+ return at(0, 0) * Matrix<T>(minorMatrices[0], 3).determinant() -
+ at(0, 1) * Matrix<T>(minorMatrices[1], 3).determinant() +
+ at(0, 2) * Matrix<T>(minorMatrices[2], 3).determinant() -
+ at(0, 3) * Matrix<T>(minorMatrices[3], 3).determinant();
+ }
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return T();
+ }
+
+ Matrix<T> inverse() const
+ {
+ ASSERT(rows() == columns());
+
+ Matrix<T> cof(std::vector<T>(mElements.size()), rows(), columns());
+ switch (size())
+ {
+ case 2:
+ cof(0, 0) = at(1, 1);
+ cof(0, 1) = -at(1, 0);
+ cof(1, 0) = -at(0, 1);
+ cof(1, 1) = at(0, 0);
+ break;
+
+ case 3:
+ cof(0, 0) = at(1, 1) * at(2, 2) - at(2, 1) * at(1, 2);
+ cof(0, 1) = -(at(1, 0) * at(2, 2) - at(2, 0) * at(1, 2));
+ cof(0, 2) = at(1, 0) * at(2, 1) - at(2, 0) * at(1, 1);
+ cof(1, 0) = -(at(0, 1) * at(2, 2) - at(2, 1) * at(0, 2));
+ cof(1, 1) = at(0, 0) * at(2, 2) - at(2, 0) * at(0, 2);
+ cof(1, 2) = -(at(0, 0) * at(2, 1) - at(2, 0) * at(0, 1));
+ cof(2, 0) = at(0, 1) * at(1, 2) - at(1, 1) * at(0, 2);
+ cof(2, 1) = -(at(0, 0) * at(1, 2) - at(1, 0) * at(0, 2));
+ cof(2, 2) = at(0, 0) * at(1, 1) - at(1, 0) * at(0, 1);
+ break;
+
+ case 4:
+ cof(0, 0) = at(1, 1) * at(2, 2) * at(3, 3) + at(2, 1) * at(3, 2) * at(1, 3) +
+ at(3, 1) * at(1, 2) * at(2, 3) - at(1, 1) * at(3, 2) * at(2, 3) -
+ at(2, 1) * at(1, 2) * at(3, 3) - at(3, 1) * at(2, 2) * at(1, 3);
+ cof(0, 1) = -(at(1, 0) * at(2, 2) * at(3, 3) + at(2, 0) * at(3, 2) * at(1, 3) +
+ at(3, 0) * at(1, 2) * at(2, 3) - at(1, 0) * at(3, 2) * at(2, 3) -
+ at(2, 0) * at(1, 2) * at(3, 3) - at(3, 0) * at(2, 2) * at(1, 3));
+ cof(0, 2) = at(1, 0) * at(2, 1) * at(3, 3) + at(2, 0) * at(3, 1) * at(1, 3) +
+ at(3, 0) * at(1, 1) * at(2, 3) - at(1, 0) * at(3, 1) * at(2, 3) -
+ at(2, 0) * at(1, 1) * at(3, 3) - at(3, 0) * at(2, 1) * at(1, 3);
+ cof(0, 3) = -(at(1, 0) * at(2, 1) * at(3, 2) + at(2, 0) * at(3, 1) * at(1, 2) +
+ at(3, 0) * at(1, 1) * at(2, 2) - at(1, 0) * at(3, 1) * at(2, 2) -
+ at(2, 0) * at(1, 1) * at(3, 2) - at(3, 0) * at(2, 1) * at(1, 2));
+ cof(1, 0) = -(at(0, 1) * at(2, 2) * at(3, 3) + at(2, 1) * at(3, 2) * at(0, 3) +
+ at(3, 1) * at(0, 2) * at(2, 3) - at(0, 1) * at(3, 2) * at(2, 3) -
+ at(2, 1) * at(0, 2) * at(3, 3) - at(3, 1) * at(2, 2) * at(0, 3));
+ cof(1, 1) = at(0, 0) * at(2, 2) * at(3, 3) + at(2, 0) * at(3, 2) * at(0, 3) +
+ at(3, 0) * at(0, 2) * at(2, 3) - at(0, 0) * at(3, 2) * at(2, 3) -
+ at(2, 0) * at(0, 2) * at(3, 3) - at(3, 0) * at(2, 2) * at(0, 3);
+ cof(1, 2) = -(at(0, 0) * at(2, 1) * at(3, 3) + at(2, 0) * at(3, 1) * at(0, 3) +
+ at(3, 0) * at(0, 1) * at(2, 3) - at(0, 0) * at(3, 1) * at(2, 3) -
+ at(2, 0) * at(0, 1) * at(3, 3) - at(3, 0) * at(2, 1) * at(0, 3));
+ cof(1, 3) = at(0, 0) * at(2, 1) * at(3, 2) + at(2, 0) * at(3, 1) * at(0, 2) +
+ at(3, 0) * at(0, 1) * at(2, 2) - at(0, 0) * at(3, 1) * at(2, 2) -
+ at(2, 0) * at(0, 1) * at(3, 2) - at(3, 0) * at(2, 1) * at(0, 2);
+ cof(2, 0) = at(0, 1) * at(1, 2) * at(3, 3) + at(1, 1) * at(3, 2) * at(0, 3) +
+ at(3, 1) * at(0, 2) * at(1, 3) - at(0, 1) * at(3, 2) * at(1, 3) -
+ at(1, 1) * at(0, 2) * at(3, 3) - at(3, 1) * at(1, 2) * at(0, 3);
+ cof(2, 1) = -(at(0, 0) * at(1, 2) * at(3, 3) + at(1, 0) * at(3, 2) * at(0, 3) +
+ at(3, 0) * at(0, 2) * at(1, 3) - at(0, 0) * at(3, 2) * at(1, 3) -
+ at(1, 0) * at(0, 2) * at(3, 3) - at(3, 0) * at(1, 2) * at(0, 3));
+ cof(2, 2) = at(0, 0) * at(1, 1) * at(3, 3) + at(1, 0) * at(3, 1) * at(0, 3) +
+ at(3, 0) * at(0, 1) * at(1, 3) - at(0, 0) * at(3, 1) * at(1, 3) -
+ at(1, 0) * at(0, 1) * at(3, 3) - at(3, 0) * at(1, 1) * at(0, 3);
+ cof(2, 3) = -(at(0, 0) * at(1, 1) * at(3, 2) + at(1, 0) * at(3, 1) * at(0, 2) +
+ at(3, 0) * at(0, 1) * at(1, 2) - at(0, 0) * at(3, 1) * at(1, 2) -
+ at(1, 0) * at(0, 1) * at(3, 2) - at(3, 0) * at(1, 1) * at(0, 2));
+ cof(3, 0) = -(at(0, 1) * at(1, 2) * at(2, 3) + at(1, 1) * at(2, 2) * at(0, 3) +
+ at(2, 1) * at(0, 2) * at(1, 3) - at(0, 1) * at(2, 2) * at(1, 3) -
+ at(1, 1) * at(0, 2) * at(2, 3) - at(2, 1) * at(1, 2) * at(0, 3));
+ cof(3, 1) = at(0, 0) * at(1, 2) * at(2, 3) + at(1, 0) * at(2, 2) * at(0, 3) +
+ at(2, 0) * at(0, 2) * at(1, 3) - at(0, 0) * at(2, 2) * at(1, 3) -
+ at(1, 0) * at(0, 2) * at(2, 3) - at(2, 0) * at(1, 2) * at(0, 3);
+ cof(3, 2) = -(at(0, 0) * at(1, 1) * at(2, 3) + at(1, 0) * at(2, 1) * at(0, 3) +
+ at(2, 0) * at(0, 1) * at(1, 3) - at(0, 0) * at(2, 1) * at(1, 3) -
+ at(1, 0) * at(0, 1) * at(2, 3) - at(2, 0) * at(1, 1) * at(0, 3));
+ cof(3, 3) = at(0, 0) * at(1, 1) * at(2, 2) + at(1, 0) * at(2, 1) * at(0, 2) +
+ at(2, 0) * at(0, 1) * at(1, 2) - at(0, 0) * at(2, 1) * at(1, 2) -
+ at(1, 0) * at(0, 1) * at(2, 2) - at(2, 0) * at(1, 1) * at(0, 2);
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ // The inverse of A is the transpose of the cofactor matrix times the reciprocal of the
+ // determinant of A.
+ Matrix<T> adjugateMatrix(cof.transpose());
+ T det = determinant();
+ Matrix<T> result(std::vector<T>(mElements.size()), rows(), columns());
+ for (unsigned int i = 0; i < rows(); i++)
+ for (unsigned int j = 0; j < columns(); j++)
+ result(i, j) = det ? adjugateMatrix(i, j) / det : T();
+
+ return result;
+ }
+
+ void setToIdentity()
+ {
+ ASSERT(rows() == columns());
+
+ const auto one = T(1);
+ const auto zero = T(0);
+
+ for (auto &e : mElements)
+ e = zero;
+
+ for (unsigned int i = 0; i < rows(); ++i)
+ {
+ const auto pos = i * columns() + (i % columns());
+ mElements[pos] = one;
+ }
+ }
+
+ template <unsigned int Size>
+ static void setToIdentity(T (&matrix)[Size])
+ {
+ static_assert(gl::iSquareRoot<Size>() != 0, "Matrix is not square.");
+
+ const auto cols = gl::iSquareRoot<Size>();
+ const auto one = T(1);
+ const auto zero = T(0);
+
+ for (auto &e : matrix)
+ e = zero;
+
+ for (unsigned int i = 0; i < cols; ++i)
+ {
+ const auto pos = i * cols + (i % cols);
+ matrix[pos] = one;
+ }
+ }
+
+ protected:
+ std::vector<T> mElements;
+ unsigned int mRows;
+ unsigned int mCols;
+};
+
+class Mat4 : public Matrix<float>
+{
+ public:
+ Mat4();
+ Mat4(const Matrix<float> generalMatrix);
+ Mat4(const std::vector<float> &elements);
+ Mat4(const float *elements);
+ Mat4(float m00,
+ float m01,
+ float m02,
+ float m03,
+ float m10,
+ float m11,
+ float m12,
+ float m13,
+ float m20,
+ float m21,
+ float m22,
+ float m23,
+ float m30,
+ float m31,
+ float m32,
+ float m33);
+
+ static Mat4 Rotate(float angle, const Vector3 &axis);
+ static Mat4 Translate(const Vector3 &t);
+ static Mat4 Scale(const Vector3 &s);
+ static Mat4 Frustum(float l, float r, float b, float t, float n, float f);
+ static Mat4 Perspective(float fov, float aspectRatio, float n, float f);
+ static Mat4 Ortho(float l, float r, float b, float t, float n, float f);
+
+ Mat4 product(const Mat4 &m);
+ Vector4 product(const Vector4 &b);
+ void dump();
+};
+
+} // namespace angle
+
+#endif // COMMON_MATRIX_UTILS_H_
diff --git a/gfx/angle/checkout/src/common/platform.h b/gfx/angle/checkout/src/common/platform.h
new file mode 100644
index 0000000000..acb21575ac
--- /dev/null
+++ b/gfx/angle/checkout/src/common/platform.h
@@ -0,0 +1,111 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// platform.h: Operating system specific includes and defines.
+
+#ifndef COMMON_PLATFORM_H_
+#define COMMON_PLATFORM_H_
+
+#if defined(_WIN32)
+# define ANGLE_PLATFORM_WINDOWS 1
+#elif defined(__Fuchsia__)
+# define ANGLE_PLATFORM_FUCHSIA 1
+# define ANGLE_PLATFORM_POSIX 1
+#elif defined(__APPLE__)
+# define ANGLE_PLATFORM_APPLE 1
+# define ANGLE_PLATFORM_POSIX 1
+#elif defined(ANDROID)
+# define ANGLE_PLATFORM_ANDROID 1
+# define ANGLE_PLATFORM_POSIX 1
+#elif defined(__linux__) || defined(EMSCRIPTEN)
+# define ANGLE_PLATFORM_LINUX 1
+# define ANGLE_PLATFORM_POSIX 1
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
+ defined(__DragonFly__) || defined(__sun) || defined(__GLIBC__) || defined(__GNU__) || \
+ defined(__QNX__) || defined(__Fuchsia__) || defined(__HAIKU__)
+# define ANGLE_PLATFORM_POSIX 1
+#else
+# error Unsupported platform.
+#endif
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+# ifndef STRICT
+# define STRICT 1
+# endif
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# ifndef NOMINMAX
+# define NOMINMAX 1
+# endif
+
+# include <intrin.h>
+# include <windows.h>
+
+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+# define ANGLE_ENABLE_WINDOWS_STORE 1
+# endif
+
+# if defined(ANGLE_ENABLE_D3D9)
+# include <d3d9.h>
+# include <d3dcompiler.h>
+# endif
+
+// Include D3D11 headers when OpenGL is enabled on Windows for interop extensions.
+# if defined(ANGLE_ENABLE_D3D11) || defined(ANGLE_ENABLE_OPENGL)
+# include <d3d10_1.h>
+# include <d3d11.h>
+# include <d3d11_3.h>
+# include <d3dcompiler.h>
+# include <dxgi.h>
+# include <dxgi1_2.h>
+# endif
+
+# if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+# include <wrl.h>
+# endif
+
+# if defined(ANGLE_ENABLE_WINDOWS_STORE)
+# include <dxgi1_3.h>
+# if defined(_DEBUG)
+# include <DXProgrammableCapture.h>
+# include <dxgidebug.h>
+# endif
+# endif
+
+# undef near
+# undef far
+#endif
+
+#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
+# include <intrin.h>
+# define ANGLE_USE_SSE
+#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
+# include <x86intrin.h>
+# define ANGLE_USE_SSE
+#endif
+
+// Mips and arm devices need to include stddef for size_t.
+#if defined(__mips__) || defined(__arm__) || defined(__aarch64__)
+# include <stddef.h>
+#endif
+
+// The MemoryBarrier function name collides with a macro under Windows
+// We will undef the macro so that the function name does not get replaced
+#undef MemoryBarrier
+
+// Macro for hinting that an expression is likely to be true/false.
+#if !defined(ANGLE_LIKELY) || !defined(ANGLE_UNLIKELY)
+# if defined(__GNUC__) || defined(__clang__)
+# define ANGLE_LIKELY(x) __builtin_expect(!!(x), 1)
+# define ANGLE_UNLIKELY(x) __builtin_expect(!!(x), 0)
+# else
+# define ANGLE_LIKELY(x) (x)
+# define ANGLE_UNLIKELY(x) (x)
+# endif // defined(__GNUC__) || defined(__clang__)
+#endif // !defined(ANGLE_LIKELY) || !defined(ANGLE_UNLIKELY)
+
+#endif // COMMON_PLATFORM_H_
diff --git a/gfx/angle/checkout/src/common/string_utils.cpp b/gfx/angle/checkout/src/common/string_utils.cpp
new file mode 100644
index 0000000000..e6836bac6e
--- /dev/null
+++ b/gfx/angle/checkout/src/common/string_utils.cpp
@@ -0,0 +1,212 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// string_utils:
+// String helper functions.
+//
+
+#include "string_utils.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <algorithm>
+#include <fstream>
+#include <sstream>
+
+#include "common/platform.h"
+
+namespace angle
+{
+
+const char kWhitespaceASCII[] = " \f\n\r\t\v";
+
+std::vector<std::string> SplitString(const std::string &input,
+ const std::string &delimiters,
+ WhitespaceHandling whitespace,
+ SplitResult resultType)
+{
+ std::vector<std::string> result;
+ if (input.empty())
+ {
+ return result;
+ }
+
+ std::string::size_type start = 0;
+ while (start != std::string::npos)
+ {
+ auto end = input.find_first_of(delimiters, start);
+
+ std::string piece;
+ if (end == std::string::npos)
+ {
+ piece = input.substr(start);
+ start = std::string::npos;
+ }
+ else
+ {
+ piece = input.substr(start, end - start);
+ start = end + 1;
+ }
+
+ if (whitespace == TRIM_WHITESPACE)
+ {
+ piece = TrimString(piece, kWhitespaceASCII);
+ }
+
+ if (resultType == SPLIT_WANT_ALL || !piece.empty())
+ {
+ result.push_back(std::move(piece));
+ }
+ }
+
+ return result;
+}
+
+void SplitStringAlongWhitespace(const std::string &input, std::vector<std::string> *tokensOut)
+{
+
+ std::istringstream stream(input);
+ std::string line;
+
+ while (std::getline(stream, line))
+ {
+ size_t prev = 0, pos;
+ while ((pos = line.find_first_of(kWhitespaceASCII, prev)) != std::string::npos)
+ {
+ if (pos > prev)
+ tokensOut->push_back(line.substr(prev, pos - prev));
+ prev = pos + 1;
+ }
+ if (prev < line.length())
+ tokensOut->push_back(line.substr(prev, std::string::npos));
+ }
+}
+
+std::string TrimString(const std::string &input, const std::string &trimChars)
+{
+ auto begin = input.find_first_not_of(trimChars);
+ if (begin == std::string::npos)
+ {
+ return "";
+ }
+
+ std::string::size_type end = input.find_last_not_of(trimChars);
+ if (end == std::string::npos)
+ {
+ return input.substr(begin);
+ }
+
+ return input.substr(begin, end - begin + 1);
+}
+
+std::string GetPrefix(const std::string &input, size_t offset, const char *delimiter)
+{
+ size_t match = input.find(delimiter, offset);
+ if (match == std::string::npos)
+ {
+ return input.substr(offset);
+ }
+ return input.substr(offset, match - offset);
+}
+
+std::string GetPrefix(const std::string &input, size_t offset, char delimiter)
+{
+ size_t match = input.find(delimiter, offset);
+ if (match == std::string::npos)
+ {
+ return input.substr(offset);
+ }
+ return input.substr(offset, match - offset);
+}
+
+bool HexStringToUInt(const std::string &input, unsigned int *uintOut)
+{
+ unsigned int offset = 0;
+
+ if (input.size() >= 2 && input[0] == '0' && input[1] == 'x')
+ {
+ offset = 2u;
+ }
+
+ // Simple validity check
+ if (input.find_first_not_of("0123456789ABCDEFabcdef", offset) != std::string::npos)
+ {
+ return false;
+ }
+
+ std::stringstream inStream(input);
+ inStream >> std::hex >> *uintOut;
+ return !inStream.fail();
+}
+
+bool ReadFileToString(const std::string &path, std::string *stringOut)
+{
+ std::ifstream inFile(path.c_str());
+ if (inFile.fail())
+ {
+ return false;
+ }
+
+ inFile.seekg(0, std::ios::end);
+ stringOut->reserve(static_cast<std::string::size_type>(inFile.tellg()));
+ inFile.seekg(0, std::ios::beg);
+
+ stringOut->assign(std::istreambuf_iterator<char>(inFile), std::istreambuf_iterator<char>());
+ return !inFile.fail();
+}
+
+bool BeginsWith(const std::string &str, const std::string &prefix)
+{
+ return strncmp(str.c_str(), prefix.c_str(), prefix.length()) == 0;
+}
+
+bool BeginsWith(const std::string &str, const char *prefix)
+{
+ return strncmp(str.c_str(), prefix, strlen(prefix)) == 0;
+}
+
+bool BeginsWith(const char *str, const char *prefix)
+{
+ return strncmp(str, prefix, strlen(prefix)) == 0;
+}
+
+bool BeginsWith(const std::string &str, const std::string &prefix, const size_t prefixLength)
+{
+ return strncmp(str.c_str(), prefix.c_str(), prefixLength) == 0;
+}
+
+bool EndsWith(const std::string &str, const char *suffix)
+{
+ const auto len = strlen(suffix);
+ if (len > str.size())
+ return false;
+
+ const char *end = str.c_str() + str.size() - len;
+
+ return memcmp(end, suffix, len) == 0;
+}
+
+void ToLower(std::string *str)
+{
+ for (auto &ch : *str)
+ {
+ ch = static_cast<char>(::tolower(ch));
+ }
+}
+
+bool ReplaceSubstring(std::string *str,
+ const std::string &substring,
+ const std::string &replacement)
+{
+ size_t replacePos = str->find(substring);
+ if (replacePos == std::string::npos)
+ {
+ return false;
+ }
+ str->replace(replacePos, substring.size(), replacement);
+ return true;
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/string_utils.h b/gfx/angle/checkout/src/common/string_utils.h
new file mode 100644
index 0000000000..543ba38601
--- /dev/null
+++ b/gfx/angle/checkout/src/common/string_utils.h
@@ -0,0 +1,86 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// string_utils:
+// String helper functions.
+//
+
+#ifndef LIBANGLE_STRING_UTILS_H_
+#define LIBANGLE_STRING_UTILS_H_
+
+#include <string>
+#include <vector>
+
+#include "common/Optional.h"
+
+namespace angle
+{
+
+extern const char kWhitespaceASCII[];
+
+enum WhitespaceHandling
+{
+ KEEP_WHITESPACE,
+ TRIM_WHITESPACE,
+};
+
+enum SplitResult
+{
+ SPLIT_WANT_ALL,
+ SPLIT_WANT_NONEMPTY,
+};
+
+std::vector<std::string> SplitString(const std::string &input,
+ const std::string &delimiters,
+ WhitespaceHandling whitespace,
+ SplitResult resultType);
+
+void SplitStringAlongWhitespace(const std::string &input, std::vector<std::string> *tokensOut);
+
+std::string TrimString(const std::string &input, const std::string &trimChars);
+
+// Return the substring starting at offset and up to the first occurance of the |delimeter|.
+std::string GetPrefix(const std::string &input, size_t offset, const char *delimiter);
+std::string GetPrefix(const std::string &input, size_t offset, char delimiter);
+
+bool HexStringToUInt(const std::string &input, unsigned int *uintOut);
+
+bool ReadFileToString(const std::string &path, std::string *stringOut);
+
+// Check if the string str begins with the given prefix.
+// The comparison is case sensitive.
+bool BeginsWith(const std::string &str, const std::string &prefix);
+
+// Check if the string str begins with the given prefix.
+// Prefix may not be NULL and needs to be NULL terminated.
+// The comparison is case sensitive.
+bool BeginsWith(const std::string &str, const char *prefix);
+
+// Check if the string str begins with the given prefix.
+// str and prefix may not be NULL and need to be NULL terminated.
+// The comparison is case sensitive.
+bool BeginsWith(const char *str, const char *prefix);
+
+// Check if the string str begins with the first prefixLength characters of the given prefix.
+// The length of the prefix string should be greater than or equal to prefixLength.
+// The comparison is case sensitive.
+bool BeginsWith(const std::string &str, const std::string &prefix, const size_t prefixLength);
+
+// Check if the string str ends with the given suffix.
+// Suffix may not be NUL and needs to be NULL terminated.
+// The comparison is case sensitive.
+bool EndsWith(const std::string &str, const char *suffix);
+
+// Convert to lower-case.
+void ToLower(std::string *str);
+
+// Replaces the substring 'substring' in 'str' with 'replacement'. Returns true if successful.
+bool ReplaceSubstring(std::string *str,
+ const std::string &substring,
+ const std::string &replacement);
+
+} // namespace angle
+
+#endif // LIBANGLE_STRING_UTILS_H_
diff --git a/gfx/angle/checkout/src/common/system_utils.cpp b/gfx/angle/checkout/src/common/system_utils.cpp
new file mode 100644
index 0000000000..257fc42c2e
--- /dev/null
+++ b/gfx/angle/checkout/src/common/system_utils.cpp
@@ -0,0 +1,31 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// system_utils.cpp: Implementation of common functions
+
+#include "system_utils.h"
+
+namespace angle
+{
+bool PrependPathToEnvironmentVar(const char *variableName, const char *path)
+{
+ std::string oldValue = GetEnvironmentVar(variableName);
+ const char *newValue = nullptr;
+ std::string buf;
+ if (oldValue.empty())
+ {
+ newValue = path;
+ }
+ else
+ {
+ buf = path;
+ buf += GetPathSeparator();
+ buf += oldValue;
+ newValue = buf.c_str();
+ }
+ return SetEnvironmentVar(variableName, newValue);
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/system_utils.h b/gfx/angle/checkout/src/common/system_utils.h
new file mode 100644
index 0000000000..0ea4959d0b
--- /dev/null
+++ b/gfx/angle/checkout/src/common/system_utils.h
@@ -0,0 +1,71 @@
+//
+// 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.
+//
+
+// system_utils.h: declaration of OS-specific utility functions
+
+#ifndef COMMON_SYSTEM_UTILS_H_
+#define COMMON_SYSTEM_UTILS_H_
+
+#include "common/Optional.h"
+#include "common/angleutils.h"
+
+namespace angle
+{
+std::string GetExecutablePath();
+std::string GetExecutableDirectory();
+const char *GetSharedLibraryExtension();
+Optional<std::string> GetCWD();
+bool SetCWD(const char *dirName);
+bool SetEnvironmentVar(const char *variableName, const char *value);
+bool UnsetEnvironmentVar(const char *variableName);
+std::string GetEnvironmentVar(const char *variableName);
+const char *GetPathSeparator();
+bool PrependPathToEnvironmentVar(const char *variableName, const char *path);
+bool IsDirectory(const char *filename);
+
+// Run an application and get the output. Gets a nullptr-terminated set of args to execute the
+// application with, and returns the stdout and stderr outputs as well as the exit code.
+//
+// Pass nullptr for stdoutOut/stderrOut if you don't need to capture. exitCodeOut is required.
+//
+// Returns false if it fails to actually execute the application.
+bool RunApp(const std::vector<const char *> &args,
+ std::string *stdoutOut,
+ std::string *stderrOut,
+ int *exitCodeOut);
+
+class Library : angle::NonCopyable
+{
+ public:
+ virtual ~Library() {}
+ virtual void *getSymbol(const char *symbolName) = 0;
+ virtual void *getNative() const = 0;
+
+ template <typename FuncT>
+ void getAs(const char *symbolName, FuncT *funcOut)
+ {
+ *funcOut = reinterpret_cast<FuncT>(getSymbol(symbolName));
+ }
+};
+
+// Use SYSTEM_DIR to bypass loading ANGLE libraries with the same name as system DLLS
+// (e.g. opengl32.dll)
+enum class SearchType
+{
+ ApplicationDir,
+ SystemDir
+};
+
+Library *OpenSharedLibrary(const char *libraryName, SearchType searchType);
+
+// Returns true if the process is currently being debugged.
+bool IsDebuggerAttached();
+
+// Calls system APIs to break into the debugger.
+void BreakDebugger();
+} // namespace angle
+
+#endif // COMMON_SYSTEM_UTILS_H_
diff --git a/gfx/angle/checkout/src/common/system_utils_linux.cpp b/gfx/angle/checkout/src/common/system_utils_linux.cpp
new file mode 100644
index 0000000000..f7ea49fc4d
--- /dev/null
+++ b/gfx/angle/checkout/src/common/system_utils_linux.cpp
@@ -0,0 +1,47 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// system_utils_linux.cpp: Implementation of OS-specific functions for Linux
+
+#include "system_utils.h"
+
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <array>
+
+namespace angle
+{
+std::string GetExecutablePath()
+{
+ // We cannot use lstat to get the size of /proc/self/exe as it always returns 0
+ // so we just use a big buffer and hope the path fits in it.
+ char path[4096];
+
+ ssize_t result = readlink("/proc/self/exe", path, sizeof(path) - 1);
+ if (result < 0 || static_cast<size_t>(result) >= sizeof(path) - 1)
+ {
+ return "";
+ }
+
+ path[result] = '\0';
+ return path;
+}
+
+std::string GetExecutableDirectory()
+{
+ std::string executablePath = GetExecutablePath();
+ size_t lastPathSepLoc = executablePath.find_last_of("/");
+ return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
+}
+
+const char *GetSharedLibraryExtension()
+{
+ return "so";
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/system_utils_mac.cpp b/gfx/angle/checkout/src/common/system_utils_mac.cpp
new file mode 100644
index 0000000000..f3d9891ebb
--- /dev/null
+++ b/gfx/angle/checkout/src/common/system_utils_mac.cpp
@@ -0,0 +1,52 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// system_utils_osx.cpp: Implementation of OS-specific functions for OSX
+
+#include "system_utils.h"
+
+#include <unistd.h>
+
+#include <mach-o/dyld.h>
+#include <cstdlib>
+#include <vector>
+
+#include <array>
+
+namespace angle
+{
+std::string GetExecutablePath()
+{
+ std::string result;
+
+ uint32_t size = 0;
+ _NSGetExecutablePath(nullptr, &size);
+
+ std::vector<char> buffer;
+ buffer.resize(size + 1);
+
+ _NSGetExecutablePath(buffer.data(), &size);
+ buffer[size] = '\0';
+
+ if (!strrchr(buffer.data(), '/'))
+ {
+ return "";
+ }
+ return buffer.data();
+}
+
+std::string GetExecutableDirectory()
+{
+ std::string executablePath = GetExecutablePath();
+ size_t lastPathSepLoc = executablePath.find_last_of("/");
+ return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
+}
+
+const char *GetSharedLibraryExtension()
+{
+ return "dylib";
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/system_utils_posix.cpp b/gfx/angle/checkout/src/common/system_utils_posix.cpp
new file mode 100644
index 0000000000..26501eb2a6
--- /dev/null
+++ b/gfx/angle/checkout/src/common/system_utils_posix.cpp
@@ -0,0 +1,276 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// system_utils_posix.cpp: Implementation of POSIX OS-specific functions.
+
+#include "system_utils.h"
+
+#include <array>
+
+#include <dlfcn.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+namespace angle
+{
+
+namespace
+{
+struct ScopedPipe
+{
+ ~ScopedPipe()
+ {
+ closeEndPoint(0);
+ closeEndPoint(1);
+ }
+ void closeEndPoint(int index)
+ {
+ if (fds[index] >= 0)
+ {
+ close(fds[index]);
+ fds[index] = -1;
+ }
+ }
+ int fds[2] = {
+ -1,
+ -1,
+ };
+};
+
+void ReadEntireFile(int fd, std::string *out)
+{
+ out->clear();
+
+ while (true)
+ {
+ char buffer[256];
+ ssize_t bytesRead = read(fd, buffer, sizeof(buffer));
+
+ // If interrupted, retry.
+ if (bytesRead < 0 && errno == EINTR)
+ {
+ continue;
+ }
+
+ // If failed, or nothing to read, we are done.
+ if (bytesRead <= 0)
+ {
+ break;
+ }
+
+ out->append(buffer, bytesRead);
+ }
+}
+} // anonymous namespace
+
+Optional<std::string> GetCWD()
+{
+ std::array<char, 4096> pathBuf;
+ char *result = getcwd(pathBuf.data(), pathBuf.size());
+ if (result == nullptr)
+ {
+ return Optional<std::string>::Invalid();
+ }
+ return std::string(pathBuf.data());
+}
+
+bool SetCWD(const char *dirName)
+{
+ return (chdir(dirName) == 0);
+}
+
+bool UnsetEnvironmentVar(const char *variableName)
+{
+ return (unsetenv(variableName) == 0);
+}
+
+bool SetEnvironmentVar(const char *variableName, const char *value)
+{
+ return (setenv(variableName, value, 1) == 0);
+}
+
+std::string GetEnvironmentVar(const char *variableName)
+{
+ const char *value = getenv(variableName);
+ return (value == nullptr ? std::string() : std::string(value));
+}
+
+const char *GetPathSeparator()
+{
+ return ":";
+}
+
+bool RunApp(const std::vector<const char *> &args,
+ std::string *stdoutOut,
+ std::string *stderrOut,
+ int *exitCodeOut)
+{
+ if (args.size() == 0 || args.back() != nullptr)
+ {
+ return false;
+ }
+
+ ScopedPipe stdoutPipe;
+ ScopedPipe stderrPipe;
+
+ // Create pipes for stdout and stderr.
+ if (stdoutOut && pipe(stdoutPipe.fds) != 0)
+ {
+ return false;
+ }
+ if (stderrOut && pipe(stderrPipe.fds) != 0)
+ {
+ return false;
+ }
+
+ pid_t pid = fork();
+ if (pid < 0)
+ {
+ return false;
+ }
+
+ if (pid == 0)
+ {
+ // Child. Execute the application.
+
+ // Redirect stdout and stderr to the pipe fds.
+ if (stdoutOut)
+ {
+ if (dup2(stdoutPipe.fds[1], STDOUT_FILENO) < 0)
+ {
+ _exit(errno);
+ }
+ }
+ if (stderrOut)
+ {
+ if (dup2(stderrPipe.fds[1], STDERR_FILENO) < 0)
+ {
+ _exit(errno);
+ }
+ }
+
+ // Execute the application, which doesn't return unless failed. Note: execv takes argv as
+ // `char * const *` for historical reasons. It is safe to const_cast it:
+ //
+ // http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html
+ //
+ // > The statement about argv[] and envp[] being constants is included to make explicit to
+ // future writers of language bindings that these objects are completely constant. Due to a
+ // limitation of the ISO C standard, it is not possible to state that idea in standard C.
+ // Specifying two levels of const- qualification for the argv[] and envp[] parameters for
+ // the exec functions may seem to be the natural choice, given that these functions do not
+ // modify either the array of pointers or the characters to which the function points, but
+ // this would disallow existing correct code. Instead, only the array of pointers is noted
+ // as constant.
+ execv(args[0], const_cast<char *const *>(args.data()));
+ _exit(errno);
+ }
+
+ // Parent. Read child output from the pipes and clean it up.
+
+ // Close the write end of the pipes, so EOF can be generated when child exits.
+ stdoutPipe.closeEndPoint(1);
+ stderrPipe.closeEndPoint(1);
+
+ // Read back the output of the child.
+ if (stdoutOut)
+ {
+ ReadEntireFile(stdoutPipe.fds[0], stdoutOut);
+ }
+ if (stderrOut)
+ {
+ ReadEntireFile(stderrPipe.fds[0], stderrOut);
+ }
+
+ // Cleanup the child.
+ int status = 0;
+ do
+ {
+ pid_t changedPid = waitpid(pid, &status, 0);
+ if (changedPid < 0 && errno == EINTR)
+ {
+ continue;
+ }
+ if (changedPid < 0)
+ {
+ return false;
+ }
+ } while (!WIFEXITED(status) && !WIFSIGNALED(status));
+
+ // Retrieve the error code.
+ if (exitCodeOut)
+ {
+ *exitCodeOut = WEXITSTATUS(status);
+ }
+
+ return true;
+}
+
+class PosixLibrary : public Library
+{
+ public:
+ PosixLibrary(const char *libraryName)
+ {
+ char buffer[1000];
+ int ret = snprintf(buffer, 1000, "%s.%s", libraryName, GetSharedLibraryExtension());
+ if (ret > 0 && ret < 1000)
+ {
+ mModule = dlopen(buffer, RTLD_NOW);
+ }
+ }
+
+ ~PosixLibrary() override
+ {
+ if (mModule)
+ {
+ dlclose(mModule);
+ }
+ }
+
+ void *getSymbol(const char *symbolName) override
+ {
+ if (!mModule)
+ {
+ return nullptr;
+ }
+
+ return dlsym(mModule, symbolName);
+ }
+
+ void *getNative() const override { return mModule; }
+
+ private:
+ void *mModule = nullptr;
+};
+
+Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
+{
+ return new PosixLibrary(libraryName);
+}
+
+bool IsDirectory(const char *filename)
+{
+ struct stat st;
+ int result = stat(filename, &st);
+ return result == 0 && ((st.st_mode & S_IFDIR) == S_IFDIR);
+}
+
+bool IsDebuggerAttached()
+{
+ // This could have a fuller implementation.
+ // See https://cs.chromium.org/chromium/src/base/debug/debugger_posix.cc
+ return false;
+}
+
+void BreakDebugger()
+{
+ // This could have a fuller implementation.
+ // See https://cs.chromium.org/chromium/src/base/debug/debugger_posix.cc
+ abort();
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/system_utils_win.cpp b/gfx/angle/checkout/src/common/system_utils_win.cpp
new file mode 100644
index 0000000000..796e928192
--- /dev/null
+++ b/gfx/angle/checkout/src/common/system_utils_win.cpp
@@ -0,0 +1,318 @@
+//
+// 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.
+//
+
+// system_utils_win.cpp: Implementation of OS-specific functions for Windows
+
+#include "system_utils.h"
+
+#include <stdarg.h>
+#include <windows.h>
+#include <array>
+#include <vector>
+
+namespace angle
+{
+namespace
+{
+struct ScopedPipe
+{
+ ~ScopedPipe()
+ {
+ closeReadHandle();
+ closeWriteHandle();
+ }
+ void closeReadHandle()
+ {
+ if (readHandle)
+ {
+ CloseHandle(readHandle);
+ readHandle = nullptr;
+ }
+ }
+ void closeWriteHandle()
+ {
+ if (writeHandle)
+ {
+ CloseHandle(writeHandle);
+ writeHandle = nullptr;
+ }
+ }
+ HANDLE readHandle = nullptr;
+ HANDLE writeHandle = nullptr;
+};
+
+void ReadEntireFile(HANDLE handle, std::string *out)
+{
+ out->clear();
+
+ while (true)
+ {
+ char buffer[256];
+ DWORD bytesRead;
+
+ BOOL success = ReadFile(handle, buffer, sizeof(buffer), &bytesRead, nullptr);
+
+ if (!success || bytesRead == 0)
+ {
+ break;
+ }
+
+ out->append(buffer, bytesRead);
+ }
+}
+} // anonymous namespace
+
+std::string GetExecutablePath()
+{
+ std::array<char, MAX_PATH> executableFileBuf;
+ DWORD executablePathLen = GetModuleFileNameA(nullptr, executableFileBuf.data(),
+ static_cast<DWORD>(executableFileBuf.size()));
+ return (executablePathLen > 0 ? std::string(executableFileBuf.data()) : "");
+}
+
+std::string GetExecutableDirectory()
+{
+ std::string executablePath = GetExecutablePath();
+ size_t lastPathSepLoc = executablePath.find_last_of("\\/");
+ return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : "";
+}
+
+const char *GetSharedLibraryExtension()
+{
+ return "dll";
+}
+
+Optional<std::string> GetCWD()
+{
+ std::array<char, MAX_PATH> pathBuf;
+ DWORD result = GetCurrentDirectoryA(static_cast<DWORD>(pathBuf.size()), pathBuf.data());
+ if (result == 0)
+ {
+ return Optional<std::string>::Invalid();
+ }
+ return std::string(pathBuf.data());
+}
+
+bool SetCWD(const char *dirName)
+{
+ return (SetCurrentDirectoryA(dirName) == TRUE);
+}
+
+bool UnsetEnvironmentVar(const char *variableName)
+{
+ return (SetEnvironmentVariableA(variableName, nullptr) == TRUE);
+}
+
+bool SetEnvironmentVar(const char *variableName, const char *value)
+{
+ return (SetEnvironmentVariableA(variableName, value) == TRUE);
+}
+
+std::string GetEnvironmentVar(const char *variableName)
+{
+ std::array<char, MAX_PATH> oldValue;
+ DWORD result =
+ GetEnvironmentVariableA(variableName, oldValue.data(), static_cast<DWORD>(oldValue.size()));
+ if (result == 0)
+ {
+ return std::string();
+ }
+ else
+ {
+ return std::string(oldValue.data());
+ }
+}
+
+const char *GetPathSeparator()
+{
+ return ";";
+}
+
+bool RunApp(const std::vector<const char *> &args,
+ std::string *stdoutOut,
+ std::string *stderrOut,
+ int *exitCodeOut)
+{
+ ScopedPipe stdoutPipe;
+ ScopedPipe stderrPipe;
+
+ SECURITY_ATTRIBUTES sa_attr;
+ // Set the bInheritHandle flag so pipe handles are inherited.
+ sa_attr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sa_attr.bInheritHandle = TRUE;
+ sa_attr.lpSecurityDescriptor = nullptr;
+
+ // Create pipes for stdout and stderr. Ensure the read handles to the pipes are not inherited.
+ if (stdoutOut && !CreatePipe(&stdoutPipe.readHandle, &stdoutPipe.writeHandle, &sa_attr, 0) &&
+ !SetHandleInformation(stdoutPipe.readHandle, HANDLE_FLAG_INHERIT, 0))
+ {
+ return false;
+ }
+ if (stderrOut && !CreatePipe(&stderrPipe.readHandle, &stderrPipe.writeHandle, &sa_attr, 0) &&
+ !SetHandleInformation(stderrPipe.readHandle, HANDLE_FLAG_INHERIT, 0))
+ {
+ return false;
+ }
+
+ // Concat the nicely separated arguments into one string so the application has to reparse it.
+ // We don't support quotation and spaces in arguments currently.
+ std::vector<char> commandLineString;
+ for (const char *arg : args)
+ {
+ if (arg)
+ {
+ if (!commandLineString.empty())
+ {
+ commandLineString.push_back(' ');
+ }
+ commandLineString.insert(commandLineString.end(), arg, arg + strlen(arg));
+ }
+ }
+ commandLineString.push_back('\0');
+
+ STARTUPINFOA startInfo = {};
+
+ startInfo.cb = sizeof(STARTUPINFOA);
+ startInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
+ if (stdoutOut)
+ {
+ startInfo.hStdOutput = stdoutPipe.writeHandle;
+ }
+ else
+ {
+ startInfo.hStdError = GetStdHandle(STD_OUTPUT_HANDLE);
+ }
+ if (stderrOut)
+ {
+ startInfo.hStdError = stderrPipe.writeHandle;
+ }
+ else
+ {
+ startInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+ }
+
+ if (stderrOut || stdoutOut)
+ {
+ startInfo.dwFlags |= STARTF_USESTDHANDLES;
+ }
+
+ // Create the child process.
+ PROCESS_INFORMATION processInfo = {};
+ if (!CreateProcessA(nullptr, commandLineString.data(), nullptr, nullptr,
+ TRUE, // Handles are inherited.
+ 0, nullptr, nullptr, &startInfo, &processInfo))
+ {
+ return false;
+ }
+
+ // Close the write end of the pipes, so EOF can be generated when child exits.
+ stdoutPipe.closeWriteHandle();
+ stderrPipe.closeWriteHandle();
+
+ // Read back the output of the child.
+ if (stdoutOut)
+ {
+ ReadEntireFile(stdoutPipe.readHandle, stdoutOut);
+ }
+ if (stderrOut)
+ {
+ ReadEntireFile(stderrPipe.readHandle, stderrOut);
+ }
+
+ // Cleanup the child.
+ bool success = WaitForSingleObject(processInfo.hProcess, INFINITE) == WAIT_OBJECT_0;
+
+ if (success)
+ {
+ DWORD exitCode = 0;
+ success = GetExitCodeProcess(processInfo.hProcess, &exitCode);
+
+ if (success)
+ {
+ *exitCodeOut = static_cast<int>(exitCode);
+ }
+ }
+
+ CloseHandle(processInfo.hProcess);
+ CloseHandle(processInfo.hThread);
+
+ return success;
+}
+
+class Win32Library : public Library
+{
+ public:
+ Win32Library(const char *libraryName, SearchType searchType)
+ {
+ char buffer[MAX_PATH];
+ int ret = snprintf(buffer, MAX_PATH, "%s.%s", libraryName, GetSharedLibraryExtension());
+ if (ret > 0 && ret < MAX_PATH)
+ {
+ switch (searchType)
+ {
+ case SearchType::ApplicationDir:
+ mModule = LoadLibraryA(buffer);
+ break;
+ case SearchType::SystemDir:
+ mModule = LoadLibraryExA(buffer, nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
+ break;
+ }
+ }
+ }
+
+ ~Win32Library() override
+ {
+ if (mModule)
+ {
+ FreeLibrary(mModule);
+ }
+ }
+
+ void *getSymbol(const char *symbolName) override
+ {
+ if (!mModule)
+ {
+ return nullptr;
+ }
+
+ return reinterpret_cast<void *>(GetProcAddress(mModule, symbolName));
+ }
+
+ void *getNative() const override { return reinterpret_cast<void *>(mModule); }
+
+ private:
+ HMODULE mModule = nullptr;
+};
+
+Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
+{
+ return new Win32Library(libraryName, searchType);
+}
+
+bool IsDirectory(const char *filename)
+{
+ WIN32_FILE_ATTRIBUTE_DATA fileInformation;
+
+ BOOL result = GetFileAttributesExA(filename, GetFileExInfoStandard, &fileInformation);
+ if (result)
+ {
+ DWORD attribs = fileInformation.dwFileAttributes;
+ return (attribs != INVALID_FILE_ATTRIBUTES) && ((attribs & FILE_ATTRIBUTE_DIRECTORY) > 0);
+ }
+
+ return false;
+}
+
+bool IsDebuggerAttached()
+{
+ return !!::IsDebuggerPresent();
+}
+
+void BreakDebugger()
+{
+ __debugbreak();
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/base_export.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/base_export.h
new file mode 100644
index 0000000000..1af5485336
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/base_export.h
@@ -0,0 +1,13 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// base_export.h: Compatiblity hacks for importing Chromium's base/SHA1.
+
+#ifndef ANGLEBASE_BASE_EXPORT_H_
+#define ANGLEBASE_BASE_EXPORT_H_
+
+#define ANGLEBASE_EXPORT
+
+#endif // ANGLEBASE_BASE_EXPORT_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/containers/mru_cache.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/containers/mru_cache.h
new file mode 100644
index 0000000000..fe4fec5768
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/containers/mru_cache.h
@@ -0,0 +1,275 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains a template for a Most Recently Used cache that allows
+// constant-time access to items using a key, but easy identification of the
+// least-recently-used items for removal. Each key can only be associated with
+// one payload item at a time.
+//
+// The key object will be stored twice, so it should support efficient copying.
+//
+// NOTE: While all operations are O(1), this code is written for
+// legibility rather than optimality. If future profiling identifies this as
+// a bottleneck, there is room for smaller values of 1 in the O(1). :]
+
+#ifndef ANGLEBASE_CONTAINERS_MRU_CACHE_H_
+#define ANGLEBASE_CONTAINERS_MRU_CACHE_H_
+
+#include <stddef.h>
+
+#include <algorithm>
+#include <functional>
+#include <list>
+#include <map>
+#include <unordered_map>
+#include <utility>
+
+#include "anglebase/logging.h"
+#include "anglebase/macros.h"
+
+namespace angle
+{
+
+namespace base
+{
+
+// MRUCacheBase ----------------------------------------------------------------
+
+// This template is used to standardize map type containers that can be used
+// by MRUCacheBase. This level of indirection is necessary because of the way
+// that template template params and default template params interact.
+template <class KeyType, class ValueType, class CompareType>
+struct MRUCacheStandardMap
+{
+ typedef std::map<KeyType, ValueType, CompareType> Type;
+};
+
+// Base class for the MRU cache specializations defined below.
+template <class KeyType,
+ class PayloadType,
+ class HashOrCompareType,
+ template <typename, typename, typename> class MapType = MRUCacheStandardMap>
+class MRUCacheBase
+{
+ public:
+ // The payload of the list. This maintains a copy of the key so we can
+ // efficiently delete things given an element of the list.
+ typedef std::pair<KeyType, PayloadType> value_type;
+
+ private:
+ typedef std::list<value_type> PayloadList;
+ typedef
+ typename MapType<KeyType, typename PayloadList::iterator, HashOrCompareType>::Type KeyIndex;
+
+ public:
+ typedef typename PayloadList::size_type size_type;
+
+ typedef typename PayloadList::iterator iterator;
+ typedef typename PayloadList::const_iterator const_iterator;
+ typedef typename PayloadList::reverse_iterator reverse_iterator;
+ typedef typename PayloadList::const_reverse_iterator const_reverse_iterator;
+
+ enum
+ {
+ NO_AUTO_EVICT = 0
+ };
+
+ // The max_size is the size at which the cache will prune its members to when
+ // a new item is inserted. If the caller wants to manager this itself (for
+ // example, maybe it has special work to do when something is evicted), it
+ // can pass NO_AUTO_EVICT to not restrict the cache size.
+ explicit MRUCacheBase(size_type max_size) : max_size_(max_size) {}
+
+ virtual ~MRUCacheBase() {}
+
+ size_type max_size() const { return max_size_; }
+
+ // Inserts a payload item with the given key. If an existing item has
+ // the same key, it is removed prior to insertion. An iterator indicating the
+ // inserted item will be returned (this will always be the front of the list).
+ //
+ // The payload will be forwarded.
+ template <typename Payload>
+ iterator Put(const KeyType &key, Payload &&payload)
+ {
+ // Remove any existing payload with that key.
+ typename KeyIndex::iterator index_iter = index_.find(key);
+ if (index_iter != index_.end())
+ {
+ // Erase the reference to it. The index reference will be replaced in the
+ // code below.
+ Erase(index_iter->second);
+ }
+ else if (max_size_ != NO_AUTO_EVICT)
+ {
+ // New item is being inserted which might make it larger than the maximum
+ // size: kick the oldest thing out if necessary.
+ ShrinkToSize(max_size_ - 1);
+ }
+
+ ordering_.emplace_front(key, std::forward<Payload>(payload));
+ index_.emplace(key, ordering_.begin());
+ return ordering_.begin();
+ }
+
+ // Retrieves the contents of the given key, or end() if not found. This method
+ // has the side effect of moving the requested item to the front of the
+ // recency list.
+ iterator Get(const KeyType &key)
+ {
+ typename KeyIndex::iterator index_iter = index_.find(key);
+ if (index_iter == index_.end())
+ return end();
+ typename PayloadList::iterator iter = index_iter->second;
+
+ // Move the touched item to the front of the recency ordering.
+ ordering_.splice(ordering_.begin(), ordering_, iter);
+ return ordering_.begin();
+ }
+
+ // Retrieves the payload associated with a given key and returns it via
+ // result without affecting the ordering (unlike Get).
+ iterator Peek(const KeyType &key)
+ {
+ typename KeyIndex::const_iterator index_iter = index_.find(key);
+ if (index_iter == index_.end())
+ return end();
+ return index_iter->second;
+ }
+
+ const_iterator Peek(const KeyType &key) const
+ {
+ typename KeyIndex::const_iterator index_iter = index_.find(key);
+ if (index_iter == index_.end())
+ return end();
+ return index_iter->second;
+ }
+
+ // Exchanges the contents of |this| by the contents of the |other|.
+ void Swap(MRUCacheBase &other)
+ {
+ ordering_.swap(other.ordering_);
+ index_.swap(other.index_);
+ std::swap(max_size_, other.max_size_);
+ }
+
+ // Erases the item referenced by the given iterator. An iterator to the item
+ // following it will be returned. The iterator must be valid.
+ iterator Erase(iterator pos)
+ {
+ index_.erase(pos->first);
+ return ordering_.erase(pos);
+ }
+
+ // MRUCache entries are often processed in reverse order, so we add this
+ // convenience function (not typically defined by STL containers).
+ reverse_iterator Erase(reverse_iterator pos)
+ {
+ // We have to actually give it the incremented iterator to delete, since
+ // the forward iterator that base() returns is actually one past the item
+ // being iterated over.
+ return reverse_iterator(Erase((++pos).base()));
+ }
+
+ // Shrinks the cache so it only holds |new_size| items. If |new_size| is
+ // bigger or equal to the current number of items, this will do nothing.
+ void ShrinkToSize(size_type new_size)
+ {
+ for (size_type i = size(); i > new_size; i--)
+ Erase(rbegin());
+ }
+
+ // Deletes everything from the cache.
+ void Clear()
+ {
+ index_.clear();
+ ordering_.clear();
+ }
+
+ // Returns the number of elements in the cache.
+ size_type size() const
+ {
+ // We don't use ordering_.size() for the return value because
+ // (as a linked list) it can be O(n).
+ DCHECK(index_.size() == ordering_.size());
+ return index_.size();
+ }
+
+ // Allows iteration over the list. Forward iteration starts with the most
+ // recent item and works backwards.
+ //
+ // Note that since these iterators are actually iterators over a list, you
+ // can keep them as you insert or delete things (as long as you don't delete
+ // the one you are pointing to) and they will still be valid.
+ iterator begin() { return ordering_.begin(); }
+ const_iterator begin() const { return ordering_.begin(); }
+ iterator end() { return ordering_.end(); }
+ const_iterator end() const { return ordering_.end(); }
+
+ reverse_iterator rbegin() { return ordering_.rbegin(); }
+ const_reverse_iterator rbegin() const { return ordering_.rbegin(); }
+ reverse_iterator rend() { return ordering_.rend(); }
+ const_reverse_iterator rend() const { return ordering_.rend(); }
+
+ bool empty() const { return ordering_.empty(); }
+
+ private:
+ PayloadList ordering_;
+ KeyIndex index_;
+
+ size_type max_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(MRUCacheBase);
+};
+
+// MRUCache --------------------------------------------------------------------
+
+// A container that does not do anything to free its data. Use this when storing
+// value types (as opposed to pointers) in the list.
+template <class KeyType, class PayloadType, class CompareType = std::less<KeyType>>
+class MRUCache : public MRUCacheBase<KeyType, PayloadType, CompareType>
+{
+ private:
+ using ParentType = MRUCacheBase<KeyType, PayloadType, CompareType>;
+
+ public:
+ // See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
+ explicit MRUCache(typename ParentType::size_type max_size) : ParentType(max_size) {}
+ virtual ~MRUCache() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MRUCache);
+};
+
+// HashingMRUCache ------------------------------------------------------------
+
+template <class KeyType, class ValueType, class HashType>
+struct MRUCacheHashMap
+{
+ typedef std::unordered_map<KeyType, ValueType, HashType> Type;
+};
+
+// This class is similar to MRUCache, except that it uses std::unordered_map as
+// the map type instead of std::map. Note that your KeyType must be hashable to
+// use this cache or you need to provide a hashing class.
+template <class KeyType, class PayloadType, class HashType = std::hash<KeyType>>
+class HashingMRUCache : public MRUCacheBase<KeyType, PayloadType, HashType, MRUCacheHashMap>
+{
+ private:
+ using ParentType = MRUCacheBase<KeyType, PayloadType, HashType, MRUCacheHashMap>;
+
+ public:
+ // See MRUCacheBase, noting the possibility of using NO_AUTO_EVICT.
+ explicit HashingMRUCache(typename ParentType::size_type max_size) : ParentType(max_size) {}
+ virtual ~HashingMRUCache() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(HashingMRUCache);
+};
+
+} // namespace base
+
+} // namespace angle
+
+#endif // ANGLEBASE_CONTAINERS_MRU_CACHE_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/logging.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/logging.h
new file mode 100644
index 0000000000..73f81e87f2
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/logging.h
@@ -0,0 +1,26 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// logging.h: Compatiblity hacks for importing Chromium's base/numerics.
+
+#ifndef ANGLEBASE_LOGGING_H_
+#define ANGLEBASE_LOGGING_H_
+
+#include "common/debug.h"
+
+#ifndef DCHECK
+# define DCHECK(X) ASSERT(X)
+#endif
+
+#ifndef CHECK
+# define CHECK(X) ASSERT(X)
+#endif
+
+// Unfortunately ANGLE relies on ASSERT being an empty statement, which these libs don't respect.
+#ifndef NOTREACHED
+# define NOTREACHED() ({ UNREACHABLE(); })
+#endif
+
+#endif // ANGLEBASE_LOGGING_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/macros.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/macros.h
new file mode 100644
index 0000000000..06391784e4
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/macros.h
@@ -0,0 +1,17 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// macros.h: Compatiblity hacks for importing Chromium's MRUCache.
+
+#ifndef ANGLEBASE_MACROS_H_
+#define ANGLEBASE_MACROS_H_
+
+// A macro to disallow the copy constructor and operator= functions.
+// This should be used in the private: declarations for a class.
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName &) = delete; \
+ void operator=(const TypeName &) = delete
+
+#endif // ANGLEBASE_MACROS_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions.h
new file mode 100644
index 0000000000..b37a36cd31
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions.h
@@ -0,0 +1,177 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_H_
+#define ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_H_
+
+#include <stddef.h>
+
+#include <limits>
+#include <type_traits>
+
+#include "anglebase/logging.h"
+#include "anglebase/numerics/safe_conversions_impl.h"
+
+namespace angle
+{
+
+namespace base
+{
+
+// Convenience function that returns true if the supplied value is in range
+// for the destination type.
+template <typename Dst, typename Src>
+constexpr bool IsValueInRangeForNumericType(Src value)
+{
+ return internal::DstRangeRelationToSrcRange<Dst>(value) == internal::RANGE_VALID;
+}
+
+// Convenience function for determining if a numeric value is negative without
+// throwing compiler warnings on: unsigned(value) < 0.
+template <typename T>
+constexpr typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type IsValueNegative(
+ T value)
+{
+ static_assert(std::numeric_limits<T>::is_specialized, "Argument must be numeric.");
+ return value < 0;
+}
+
+template <typename T>
+constexpr typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type IsValueNegative(T)
+{
+ static_assert(std::numeric_limits<T>::is_specialized, "Argument must be numeric.");
+ return false;
+}
+
+// checked_cast<> is analogous to static_cast<> for numeric types,
+// except that it CHECKs that the specified numeric conversion will not
+// overflow or underflow. NaN source will always trigger a CHECK.
+template <typename Dst, typename Src>
+inline Dst checked_cast(Src value)
+{
+ CHECK(IsValueInRangeForNumericType<Dst>(value));
+ return static_cast<Dst>(value);
+}
+
+// HandleNaN will cause this class to CHECK(false).
+struct SaturatedCastNaNBehaviorCheck
+{
+ template <typename T>
+ static T HandleNaN()
+ {
+ CHECK(false);
+ return T();
+ }
+};
+
+// HandleNaN will return 0 in this case.
+struct SaturatedCastNaNBehaviorReturnZero
+{
+ template <typename T>
+ static constexpr T HandleNaN()
+ {
+ return T();
+ }
+};
+
+namespace internal
+{
+// This wrapper is used for C++11 constexpr support by avoiding the declaration
+// of local variables in the saturated_cast template function.
+template <typename Dst, class NaNHandler, typename Src>
+constexpr Dst saturated_cast_impl(const Src value, const RangeConstraint constraint)
+{
+ return constraint == RANGE_VALID
+ ? static_cast<Dst>(value)
+ : (constraint == RANGE_UNDERFLOW
+ ? std::numeric_limits<Dst>::min()
+ : (constraint == RANGE_OVERFLOW
+ ? std::numeric_limits<Dst>::max()
+ : (constraint == RANGE_INVALID
+ ? NaNHandler::template HandleNaN<Dst>()
+ : (NOTREACHED(), static_cast<Dst>(value)))));
+}
+} // namespace internal
+
+// saturated_cast<> is analogous to static_cast<> for numeric types, except
+// that the specified numeric conversion will saturate rather than overflow or
+// underflow. NaN assignment to an integral will defer the behavior to a
+// specified class. By default, it will return 0.
+template <typename Dst, class NaNHandler = SaturatedCastNaNBehaviorReturnZero, typename Src>
+constexpr Dst saturated_cast(Src value)
+{
+ return std::numeric_limits<Dst>::is_iec559
+ ? static_cast<Dst>(value) // Floating point optimization.
+ : internal::saturated_cast_impl<Dst, NaNHandler>(
+ value, internal::DstRangeRelationToSrcRange<Dst>(value));
+}
+
+// strict_cast<> is analogous to static_cast<> for numeric types, except that
+// it will cause a compile failure if the destination type is not large enough
+// to contain any value in the source type. It performs no runtime checking.
+template <typename Dst, typename Src>
+constexpr Dst strict_cast(Src value)
+{
+ static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
+ static_assert(std::numeric_limits<Dst>::is_specialized, "Result must be numeric.");
+ static_assert((internal::StaticDstRangeRelationToSrcRange<Dst, Src>::value ==
+ internal::NUMERIC_RANGE_CONTAINED),
+ "The numeric conversion is out of range for this type. You "
+ "should probably use one of the following conversion "
+ "mechanisms on the value you want to pass:\n"
+ "- base::checked_cast\n"
+ "- base::saturated_cast\n"
+ "- base::CheckedNumeric");
+
+ return static_cast<Dst>(value);
+}
+
+// StrictNumeric implements compile time range checking between numeric types by
+// wrapping assignment operations in a strict_cast. This class is intended to be
+// used for function arguments and return types, to ensure the destination type
+// can always contain the source type. This is essentially the same as enforcing
+// -Wconversion in gcc and C4302 warnings on MSVC, but it can be applied
+// incrementally at API boundaries, making it easier to convert code so that it
+// compiles cleanly with truncation warnings enabled.
+// This template should introduce no runtime overhead, but it also provides no
+// runtime checking of any of the associated mathematical operations. Use
+// CheckedNumeric for runtime range checks of the actual value being assigned.
+template <typename T>
+class StrictNumeric
+{
+ public:
+ typedef T type;
+
+ constexpr StrictNumeric() : value_(0) {}
+
+ // Copy constructor.
+ template <typename Src>
+ constexpr StrictNumeric(const StrictNumeric<Src> &rhs) : value_(strict_cast<T>(rhs.value_))
+ {}
+
+ // This is not an explicit constructor because we implicitly upgrade regular
+ // numerics to StrictNumerics to make them easier to use.
+ template <typename Src>
+ constexpr StrictNumeric(Src value) : value_(strict_cast<T>(value))
+ {}
+
+ // The numeric cast operator basically handles all the magic.
+ template <typename Dst>
+ constexpr operator Dst() const
+ {
+ return strict_cast<Dst>(value_);
+ }
+
+ private:
+ const T value_;
+};
+
+// Explicitly make a shorter size_t typedef for convenience.
+typedef StrictNumeric<size_t> SizeT;
+
+} // namespace base
+
+} // namespace angle
+
+#endif // ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h
new file mode 100644
index 0000000000..67cc4c9294
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_conversions_impl.h
@@ -0,0 +1,273 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_
+#define ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_
+
+#include <limits.h>
+#include <stdint.h>
+
+#include <climits>
+#include <limits>
+
+namespace angle
+{
+
+namespace base
+{
+namespace internal
+{
+
+// The std library doesn't provide a binary max_exponent for integers, however
+// we can compute one by adding one to the number of non-sign bits. This allows
+// for accurate range comparisons between floating point and integer types.
+template <typename NumericType>
+struct MaxExponent
+{
+ static_assert(std::is_arithmetic<NumericType>::value, "Argument must be numeric.");
+ static const int value =
+ std::numeric_limits<NumericType>::is_iec559
+ ? std::numeric_limits<NumericType>::max_exponent
+ : (sizeof(NumericType) * CHAR_BIT + 1 - std::numeric_limits<NumericType>::is_signed);
+};
+
+enum IntegerRepresentation
+{
+ INTEGER_REPRESENTATION_UNSIGNED,
+ INTEGER_REPRESENTATION_SIGNED
+};
+
+// A range for a given nunmeric Src type is contained for a given numeric Dst
+// type if both numeric_limits<Src>::max() <= numeric_limits<Dst>::max() and
+// numeric_limits<Src>::min() >= numeric_limits<Dst>::min() are true.
+// We implement this as template specializations rather than simple static
+// comparisons to ensure type correctness in our comparisons.
+enum NumericRangeRepresentation
+{
+ NUMERIC_RANGE_NOT_CONTAINED,
+ NUMERIC_RANGE_CONTAINED
+};
+
+// Helper templates to statically determine if our destination type can contain
+// maximum and minimum values represented by the source type.
+
+template <typename Dst,
+ typename Src,
+ IntegerRepresentation DstSign = std::numeric_limits<Dst>::is_signed
+ ? INTEGER_REPRESENTATION_SIGNED
+ : INTEGER_REPRESENTATION_UNSIGNED,
+ IntegerRepresentation SrcSign = std::numeric_limits<Src>::is_signed
+ ? INTEGER_REPRESENTATION_SIGNED
+ : INTEGER_REPRESENTATION_UNSIGNED>
+struct StaticDstRangeRelationToSrcRange;
+
+// Same sign: Dst is guaranteed to contain Src only if its range is equal or
+// larger.
+template <typename Dst, typename Src, IntegerRepresentation Sign>
+struct StaticDstRangeRelationToSrcRange<Dst, Src, Sign, Sign>
+{
+ static const NumericRangeRepresentation value =
+ MaxExponent<Dst>::value >= MaxExponent<Src>::value ? NUMERIC_RANGE_CONTAINED
+ : NUMERIC_RANGE_NOT_CONTAINED;
+};
+
+// Unsigned to signed: Dst is guaranteed to contain source only if its range is
+// larger.
+template <typename Dst, typename Src>
+struct StaticDstRangeRelationToSrcRange<Dst,
+ Src,
+ INTEGER_REPRESENTATION_SIGNED,
+ INTEGER_REPRESENTATION_UNSIGNED>
+{
+ static const NumericRangeRepresentation value =
+ MaxExponent<Dst>::value > MaxExponent<Src>::value ? NUMERIC_RANGE_CONTAINED
+ : NUMERIC_RANGE_NOT_CONTAINED;
+};
+
+// Signed to unsigned: Dst cannot be statically determined to contain Src.
+template <typename Dst, typename Src>
+struct StaticDstRangeRelationToSrcRange<Dst,
+ Src,
+ INTEGER_REPRESENTATION_UNSIGNED,
+ INTEGER_REPRESENTATION_SIGNED>
+{
+ static const NumericRangeRepresentation value = NUMERIC_RANGE_NOT_CONTAINED;
+};
+
+enum RangeConstraint : unsigned char
+{
+ RANGE_VALID = 0x0, // Value can be represented by the destination type.
+ RANGE_UNDERFLOW = 0x1, // Value would overflow.
+ RANGE_OVERFLOW = 0x2, // Value would underflow.
+ RANGE_INVALID = RANGE_UNDERFLOW | RANGE_OVERFLOW // Invalid (i.e. NaN).
+};
+
+// Helper function for coercing an int back to a RangeContraint.
+constexpr RangeConstraint GetRangeConstraint(int integer_range_constraint)
+{
+ // TODO(jschuh): Once we get full C++14 support we want this
+ // assert(integer_range_constraint >= RANGE_VALID &&
+ // integer_range_constraint <= RANGE_INVALID)
+ return static_cast<RangeConstraint>(integer_range_constraint);
+}
+
+// This function creates a RangeConstraint from an upper and lower bound
+// check by taking advantage of the fact that only NaN can be out of range in
+// both directions at once.
+constexpr inline RangeConstraint GetRangeConstraint(bool is_in_upper_bound, bool is_in_lower_bound)
+{
+ return GetRangeConstraint((is_in_upper_bound ? 0 : RANGE_OVERFLOW) |
+ (is_in_lower_bound ? 0 : RANGE_UNDERFLOW));
+}
+
+// The following helper template addresses a corner case in range checks for
+// conversion from a floating-point type to an integral type of smaller range
+// but larger precision (e.g. float -> unsigned). The problem is as follows:
+// 1. Integral maximum is always one less than a power of two, so it must be
+// truncated to fit the mantissa of the floating point. The direction of
+// rounding is implementation defined, but by default it's always IEEE
+// floats, which round to nearest and thus result in a value of larger
+// magnitude than the integral value.
+// Example: float f = UINT_MAX; // f is 4294967296f but UINT_MAX
+// // is 4294967295u.
+// 2. If the floating point value is equal to the promoted integral maximum
+// value, a range check will erroneously pass.
+// Example: (4294967296f <= 4294967295u) // This is true due to a precision
+// // loss in rounding up to float.
+// 3. When the floating point value is then converted to an integral, the
+// resulting value is out of range for the target integral type and
+// thus is implementation defined.
+// Example: unsigned u = (float)INT_MAX; // u will typically overflow to 0.
+// To fix this bug we manually truncate the maximum value when the destination
+// type is an integral of larger precision than the source floating-point type,
+// such that the resulting maximum is represented exactly as a floating point.
+template <typename Dst, typename Src>
+struct NarrowingRange
+{
+ typedef typename std::numeric_limits<Src> SrcLimits;
+ typedef typename std::numeric_limits<Dst> DstLimits;
+ // The following logic avoids warnings where the max function is
+ // instantiated with invalid values for a bit shift (even though
+ // such a function can never be called).
+ static const int shift =
+ (MaxExponent<Src>::value > MaxExponent<Dst>::value &&
+ SrcLimits::digits < DstLimits::digits && SrcLimits::is_iec559 && DstLimits::is_integer)
+ ? (DstLimits::digits - SrcLimits::digits)
+ : 0;
+
+ static constexpr Dst max()
+ {
+ // We use UINTMAX_C below to avoid compiler warnings about shifting floating
+ // points. Since it's a compile time calculation, it shouldn't have any
+ // performance impact.
+ return DstLimits::max() - static_cast<Dst>((UINTMAX_C(1) << shift) - 1);
+ }
+
+ static constexpr Dst min()
+ {
+ return std::numeric_limits<Dst>::is_iec559 ? -DstLimits::max() : DstLimits::min();
+ }
+};
+
+template <typename Dst,
+ typename Src,
+ IntegerRepresentation DstSign = std::numeric_limits<Dst>::is_signed
+ ? INTEGER_REPRESENTATION_SIGNED
+ : INTEGER_REPRESENTATION_UNSIGNED,
+ IntegerRepresentation SrcSign = std::numeric_limits<Src>::is_signed
+ ? INTEGER_REPRESENTATION_SIGNED
+ : INTEGER_REPRESENTATION_UNSIGNED,
+ NumericRangeRepresentation DstRange = StaticDstRangeRelationToSrcRange<Dst, Src>::value>
+struct DstRangeRelationToSrcRangeImpl;
+
+// The following templates are for ranges that must be verified at runtime. We
+// split it into checks based on signedness to avoid confusing casts and
+// compiler warnings on signed an unsigned comparisons.
+
+// Dst range is statically determined to contain Src: Nothing to check.
+template <typename Dst, typename Src, IntegerRepresentation DstSign, IntegerRepresentation SrcSign>
+struct DstRangeRelationToSrcRangeImpl<Dst, Src, DstSign, SrcSign, NUMERIC_RANGE_CONTAINED>
+{
+ static constexpr RangeConstraint Check(Src value) { return RANGE_VALID; }
+};
+
+// Signed to signed narrowing: Both the upper and lower boundaries may be
+// exceeded.
+template <typename Dst, typename Src>
+struct DstRangeRelationToSrcRangeImpl<Dst,
+ Src,
+ INTEGER_REPRESENTATION_SIGNED,
+ INTEGER_REPRESENTATION_SIGNED,
+ NUMERIC_RANGE_NOT_CONTAINED>
+{
+ static constexpr RangeConstraint Check(Src value)
+ {
+ return GetRangeConstraint((value <= NarrowingRange<Dst, Src>::max()),
+ (value >= NarrowingRange<Dst, Src>::min()));
+ }
+};
+
+// Unsigned to unsigned narrowing: Only the upper boundary can be exceeded.
+template <typename Dst, typename Src>
+struct DstRangeRelationToSrcRangeImpl<Dst,
+ Src,
+ INTEGER_REPRESENTATION_UNSIGNED,
+ INTEGER_REPRESENTATION_UNSIGNED,
+ NUMERIC_RANGE_NOT_CONTAINED>
+{
+ static constexpr RangeConstraint Check(Src value)
+ {
+ return GetRangeConstraint(value <= NarrowingRange<Dst, Src>::max(), true);
+ }
+};
+
+// Unsigned to signed: The upper boundary may be exceeded.
+template <typename Dst, typename Src>
+struct DstRangeRelationToSrcRangeImpl<Dst,
+ Src,
+ INTEGER_REPRESENTATION_SIGNED,
+ INTEGER_REPRESENTATION_UNSIGNED,
+ NUMERIC_RANGE_NOT_CONTAINED>
+{
+ static constexpr RangeConstraint Check(Src value)
+ {
+ return sizeof(Dst) > sizeof(Src)
+ ? RANGE_VALID
+ : GetRangeConstraint(value <= static_cast<Src>(NarrowingRange<Dst, Src>::max()),
+ true);
+ }
+};
+
+// Signed to unsigned: The upper boundary may be exceeded for a narrower Dst,
+// and any negative value exceeds the lower boundary.
+template <typename Dst, typename Src>
+struct DstRangeRelationToSrcRangeImpl<Dst,
+ Src,
+ INTEGER_REPRESENTATION_UNSIGNED,
+ INTEGER_REPRESENTATION_SIGNED,
+ NUMERIC_RANGE_NOT_CONTAINED>
+{
+ static constexpr RangeConstraint Check(Src value)
+ {
+ return (MaxExponent<Dst>::value >= MaxExponent<Src>::value)
+ ? GetRangeConstraint(true, value >= static_cast<Src>(0))
+ : GetRangeConstraint(value <= static_cast<Src>(NarrowingRange<Dst, Src>::max()),
+ value >= static_cast<Src>(0));
+ }
+};
+
+template <typename Dst, typename Src>
+constexpr RangeConstraint DstRangeRelationToSrcRange(Src value)
+{
+ static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
+ static_assert(std::numeric_limits<Dst>::is_specialized, "Result must be numeric.");
+ return DstRangeRelationToSrcRangeImpl<Dst, Src>::Check(value);
+}
+
+} // namespace internal
+} // namespace base
+
+} // namespace angle
+
+#endif // ANGLEBASE_NUMERICS_SAFE_CONVERSIONS_IMPL_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math.h
new file mode 100644
index 0000000000..16d9b8549f
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math.h
@@ -0,0 +1,334 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANGLEBASE_NUMERICS_SAFE_MATH_H_
+#define ANGLEBASE_NUMERICS_SAFE_MATH_H_
+
+#include <stddef.h>
+
+#include <limits>
+#include <type_traits>
+
+#include "anglebase/logging.h"
+#include "anglebase/numerics/safe_math_impl.h"
+
+namespace angle
+{
+
+namespace base
+{
+
+namespace internal
+{
+
+// CheckedNumeric implements all the logic and operators for detecting integer
+// boundary conditions such as overflow, underflow, and invalid conversions.
+// The CheckedNumeric type implicitly converts from floating point and integer
+// data types, and contains overloads for basic arithmetic operations (i.e.: +,
+// -, *, /, %).
+//
+// The following methods convert from CheckedNumeric to standard numeric values:
+// IsValid() - Returns true if the underlying numeric value is valid (i.e. has
+// has not wrapped and is not the result of an invalid conversion).
+// ValueOrDie() - Returns the underlying value. If the state is not valid this
+// call will crash on a CHECK.
+// ValueOrDefault() - Returns the current value, or the supplied default if the
+// state is not valid.
+// ValueFloating() - Returns the underlying floating point value (valid only
+// only for floating point CheckedNumeric types).
+//
+// Bitwise operations are explicitly not supported, because correct
+// handling of some cases (e.g. sign manipulation) is ambiguous. Comparison
+// operations are explicitly not supported because they could result in a crash
+// on a CHECK condition. You should use patterns like the following for these
+// operations:
+// Bitwise operation:
+// CheckedNumeric<int> checked_int = untrusted_input_value;
+// int x = checked_int.ValueOrDefault(0) | kFlagValues;
+// Comparison:
+// CheckedNumeric<size_t> checked_size = untrusted_input_value;
+// checked_size += HEADER LENGTH;
+// if (checked_size.IsValid() && checked_size.ValueOrDie() < buffer_size)
+// Do stuff...
+template <typename T>
+class CheckedNumeric
+{
+ static_assert(std::is_arithmetic<T>::value, "CheckedNumeric<T>: T must be a numeric type.");
+
+ public:
+ typedef T type;
+
+ CheckedNumeric() {}
+
+ // Copy constructor.
+ template <typename Src>
+ CheckedNumeric(const CheckedNumeric<Src> &rhs) : state_(rhs.ValueUnsafe(), rhs.validity())
+ {}
+
+ template <typename Src>
+ CheckedNumeric(Src value, RangeConstraint validity) : state_(value, validity)
+ {}
+
+ // This is not an explicit constructor because we implicitly upgrade regular
+ // numerics to CheckedNumerics to make them easier to use.
+ template <typename Src>
+ CheckedNumeric(Src value) // NOLINT(runtime/explicit)
+ : state_(value)
+ {
+ static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
+ }
+
+ // This is not an explicit constructor because we want a seamless conversion
+ // from StrictNumeric types.
+ template <typename Src>
+ CheckedNumeric(StrictNumeric<Src> value) // NOLINT(runtime/explicit)
+ : state_(static_cast<Src>(value))
+ {}
+
+ // IsValid() is the public API to test if a CheckedNumeric is currently valid.
+ bool IsValid() const { return validity() == RANGE_VALID; }
+
+ // AssignIfValid(Dst) - Assigns the underlying value if it is currently valid and is within the
+ // range supported by the destination type. Returns true if successful and false otherwise.
+ template <typename Dst>
+ constexpr bool AssignIfValid(Dst *result) const
+ {
+ return IsValid() ? ((*result = static_cast<Dst>(state_.value())), true) : false;
+ }
+
+ // ValueOrDie() The primary accessor for the underlying value. If the current
+ // state is not valid it will CHECK and crash.
+ T ValueOrDie() const
+ {
+ CHECK(IsValid());
+ return state_.value();
+ }
+
+ // ValueOrDefault(T default_value) A convenience method that returns the
+ // current value if the state is valid, and the supplied default_value for
+ // any other state.
+ T ValueOrDefault(T default_value) const { return IsValid() ? state_.value() : default_value; }
+
+ // ValueFloating() - Since floating point values include their validity state,
+ // we provide an easy method for extracting them directly, without a risk of
+ // crashing on a CHECK.
+ T ValueFloating() const
+ {
+ static_assert(std::numeric_limits<T>::is_iec559, "Argument must be float.");
+ return CheckedNumeric<T>::cast(*this).ValueUnsafe();
+ }
+
+ // validity() - DO NOT USE THIS IN EXTERNAL CODE - It is public right now for
+ // tests and to avoid a big matrix of friend operator overloads. But the
+ // values it returns are likely to change in the future.
+ // Returns: current validity state (i.e. valid, overflow, underflow, nan).
+ // TODO(jschuh): crbug.com/332611 Figure out and implement semantics for
+ // saturation/wrapping so we can expose this state consistently and implement
+ // saturated arithmetic.
+ RangeConstraint validity() const { return state_.validity(); }
+
+ // ValueUnsafe() - DO NOT USE THIS IN EXTERNAL CODE - It is public right now
+ // for tests and to avoid a big matrix of friend operator overloads. But the
+ // values it returns are likely to change in the future.
+ // Returns: the raw numeric value, regardless of the current state.
+ // TODO(jschuh): crbug.com/332611 Figure out and implement semantics for
+ // saturation/wrapping so we can expose this state consistently and implement
+ // saturated arithmetic.
+ T ValueUnsafe() const { return state_.value(); }
+
+ // Prototypes for the supported arithmetic operator overloads.
+ template <typename Src>
+ CheckedNumeric &operator+=(Src rhs);
+ template <typename Src>
+ CheckedNumeric &operator-=(Src rhs);
+ template <typename Src>
+ CheckedNumeric &operator*=(Src rhs);
+ template <typename Src>
+ CheckedNumeric &operator/=(Src rhs);
+ template <typename Src>
+ CheckedNumeric &operator%=(Src rhs);
+
+ CheckedNumeric operator-() const
+ {
+ RangeConstraint validity;
+ T value = CheckedNeg(state_.value(), &validity);
+ // Negation is always valid for floating point.
+ if (std::numeric_limits<T>::is_iec559)
+ return CheckedNumeric<T>(value);
+
+ validity = GetRangeConstraint(state_.validity() | validity);
+ return CheckedNumeric<T>(value, validity);
+ }
+
+ CheckedNumeric Abs() const
+ {
+ RangeConstraint validity;
+ T value = CheckedAbs(state_.value(), &validity);
+ // Absolute value is always valid for floating point.
+ if (std::numeric_limits<T>::is_iec559)
+ return CheckedNumeric<T>(value);
+
+ validity = GetRangeConstraint(state_.validity() | validity);
+ return CheckedNumeric<T>(value, validity);
+ }
+
+ // This function is available only for integral types. It returns an unsigned
+ // integer of the same width as the source type, containing the absolute value
+ // of the source, and properly handling signed min.
+ CheckedNumeric<typename UnsignedOrFloatForSize<T>::type> UnsignedAbs() const
+ {
+ return CheckedNumeric<typename UnsignedOrFloatForSize<T>::type>(
+ CheckedUnsignedAbs(state_.value()), state_.validity());
+ }
+
+ CheckedNumeric &operator++()
+ {
+ *this += 1;
+ return *this;
+ }
+
+ CheckedNumeric operator++(int)
+ {
+ CheckedNumeric value = *this;
+ *this += 1;
+ return value;
+ }
+
+ CheckedNumeric &operator--()
+ {
+ *this -= 1;
+ return *this;
+ }
+
+ CheckedNumeric operator--(int)
+ {
+ CheckedNumeric value = *this;
+ *this -= 1;
+ return value;
+ }
+
+ // These static methods behave like a convenience cast operator targeting
+ // the desired CheckedNumeric type. As an optimization, a reference is
+ // returned when Src is the same type as T.
+ template <typename Src>
+ static CheckedNumeric<T> cast(
+ Src u,
+ typename std::enable_if<std::numeric_limits<Src>::is_specialized, int>::type = 0)
+ {
+ return u;
+ }
+
+ template <typename Src>
+ static CheckedNumeric<T> cast(
+ const CheckedNumeric<Src> &u,
+ typename std::enable_if<!std::is_same<Src, T>::value, int>::type = 0)
+ {
+ return u;
+ }
+
+ static const CheckedNumeric<T> &cast(const CheckedNumeric<T> &u) { return u; }
+
+ private:
+ template <typename NumericType>
+ struct UnderlyingType
+ {
+ using type = NumericType;
+ };
+
+ template <typename NumericType>
+ struct UnderlyingType<CheckedNumeric<NumericType>>
+ {
+ using type = NumericType;
+ };
+
+ CheckedNumericState<T> state_;
+};
+
+// This is the boilerplate for the standard arithmetic operator overloads. A
+// macro isn't the prettiest solution, but it beats rewriting these five times.
+// Some details worth noting are:
+// * We apply the standard arithmetic promotions.
+// * We skip range checks for floating points.
+// * We skip range checks for destination integers with sufficient range.
+// TODO(jschuh): extract these out into templates.
+#define ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(NAME, OP, COMPOUND_OP) \
+ /* Binary arithmetic operator for CheckedNumerics of the same type. */ \
+ template <typename T> \
+ CheckedNumeric<typename ArithmeticPromotion<T>::type> operator OP( \
+ const CheckedNumeric<T> &lhs, const CheckedNumeric<T> &rhs) \
+ { \
+ typedef typename ArithmeticPromotion<T>::type Promotion; \
+ /* Floating point always takes the fast path */ \
+ if (std::numeric_limits<T>::is_iec559) \
+ return CheckedNumeric<T>(lhs.ValueUnsafe() OP rhs.ValueUnsafe()); \
+ if (IsIntegerArithmeticSafe<Promotion, T, T>::value) \
+ return CheckedNumeric<Promotion>(lhs.ValueUnsafe() OP rhs.ValueUnsafe(), \
+ GetRangeConstraint(rhs.validity() | lhs.validity())); \
+ RangeConstraint validity = RANGE_VALID; \
+ T result = \
+ static_cast<T>(Checked##NAME(static_cast<Promotion>(lhs.ValueUnsafe()), \
+ static_cast<Promotion>(rhs.ValueUnsafe()), &validity)); \
+ return CheckedNumeric<Promotion>( \
+ result, GetRangeConstraint(validity | lhs.validity() | rhs.validity())); \
+ } \
+ /* Assignment arithmetic operator implementation from CheckedNumeric. */ \
+ template <typename T> \
+ template <typename Src> \
+ CheckedNumeric<T> &CheckedNumeric<T>::operator COMPOUND_OP(Src rhs) \
+ { \
+ *this = CheckedNumeric<T>::cast(*this) \
+ OP CheckedNumeric<typename UnderlyingType<Src>::type>::cast(rhs); \
+ return *this; \
+ } \
+ /* Binary arithmetic operator for CheckedNumeric of different type. */ \
+ template <typename T, typename Src> \
+ CheckedNumeric<typename ArithmeticPromotion<T, Src>::type> operator OP( \
+ const CheckedNumeric<Src> &lhs, const CheckedNumeric<T> &rhs) \
+ { \
+ typedef typename ArithmeticPromotion<T, Src>::type Promotion; \
+ if (IsIntegerArithmeticSafe<Promotion, T, Src>::value) \
+ return CheckedNumeric<Promotion>(lhs.ValueUnsafe() OP rhs.ValueUnsafe(), \
+ GetRangeConstraint(rhs.validity() | lhs.validity())); \
+ return CheckedNumeric<Promotion>::cast(lhs) OP CheckedNumeric<Promotion>::cast(rhs); \
+ } \
+ /* Binary arithmetic operator for left CheckedNumeric and right numeric. */ \
+ template <typename T, typename Src, \
+ typename std::enable_if<std::is_arithmetic<Src>::value>::type * = nullptr> \
+ CheckedNumeric<typename ArithmeticPromotion<T, Src>::type> operator OP( \
+ const CheckedNumeric<T> &lhs, Src rhs) \
+ { \
+ typedef typename ArithmeticPromotion<T, Src>::type Promotion; \
+ if (IsIntegerArithmeticSafe<Promotion, T, Src>::value) \
+ return CheckedNumeric<Promotion>(lhs.ValueUnsafe() OP rhs, lhs.validity()); \
+ return CheckedNumeric<Promotion>::cast(lhs) OP CheckedNumeric<Promotion>::cast(rhs); \
+ } \
+ /* Binary arithmetic operator for left numeric and right CheckedNumeric. */ \
+ template <typename T, typename Src, \
+ typename std::enable_if<std::is_arithmetic<Src>::value>::type * = nullptr> \
+ CheckedNumeric<typename ArithmeticPromotion<T, Src>::type> operator OP( \
+ Src lhs, const CheckedNumeric<T> &rhs) \
+ { \
+ typedef typename ArithmeticPromotion<T, Src>::type Promotion; \
+ if (IsIntegerArithmeticSafe<Promotion, T, Src>::value) \
+ return CheckedNumeric<Promotion>(lhs OP rhs.ValueUnsafe(), rhs.validity()); \
+ return CheckedNumeric<Promotion>::cast(lhs) OP CheckedNumeric<Promotion>::cast(rhs); \
+ }
+
+ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Add, +, +=)
+ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Sub, -, -=)
+ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Mul, *, *=)
+ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Div, /, /=)
+ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS(Mod, %, %=)
+
+#undef ANGLEBASE_NUMERIC_ARITHMETIC_OPERATORS
+
+} // namespace internal
+
+using internal::CheckedNumeric;
+
+} // namespace base
+
+} // namespace angle
+
+#endif // ANGLEBASE_NUMERICS_SAFE_MATH_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math_impl.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math_impl.h
new file mode 100644
index 0000000000..778fb8daaa
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/numerics/safe_math_impl.h
@@ -0,0 +1,570 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANGLEBASE_NUMERICS_SAFE_MATH_IMPL_H_
+#define ANGLEBASE_NUMERICS_SAFE_MATH_IMPL_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <climits>
+#include <cmath>
+#include <cstdlib>
+#include <limits>
+#include <type_traits>
+
+#include "anglebase/numerics/safe_conversions.h"
+
+namespace angle
+{
+
+namespace base
+{
+namespace internal
+{
+
+// Everything from here up to the floating point operations is portable C++,
+// but it may not be fast. This code could be split based on
+// platform/architecture and replaced with potentially faster implementations.
+
+// Integer promotion templates used by the portable checked integer arithmetic.
+template <size_t Size, bool IsSigned>
+struct IntegerForSizeAndSign;
+template <>
+struct IntegerForSizeAndSign<1, true>
+{
+ typedef int8_t type;
+};
+template <>
+struct IntegerForSizeAndSign<1, false>
+{
+ typedef uint8_t type;
+};
+template <>
+struct IntegerForSizeAndSign<2, true>
+{
+ typedef int16_t type;
+};
+template <>
+struct IntegerForSizeAndSign<2, false>
+{
+ typedef uint16_t type;
+};
+template <>
+struct IntegerForSizeAndSign<4, true>
+{
+ typedef int32_t type;
+};
+template <>
+struct IntegerForSizeAndSign<4, false>
+{
+ typedef uint32_t type;
+};
+template <>
+struct IntegerForSizeAndSign<8, true>
+{
+ typedef int64_t type;
+};
+template <>
+struct IntegerForSizeAndSign<8, false>
+{
+ typedef uint64_t type;
+};
+
+// WARNING: We have no IntegerForSizeAndSign<16, *>. If we ever add one to
+// support 128-bit math, then the ArithmeticPromotion template below will need
+// to be updated (or more likely replaced with a decltype expression).
+
+template <typename Integer>
+struct UnsignedIntegerForSize
+{
+ typedef
+ typename std::enable_if<std::numeric_limits<Integer>::is_integer,
+ typename IntegerForSizeAndSign<sizeof(Integer), false>::type>::type
+ type;
+};
+
+template <typename Integer>
+struct SignedIntegerForSize
+{
+ typedef
+ typename std::enable_if<std::numeric_limits<Integer>::is_integer,
+ typename IntegerForSizeAndSign<sizeof(Integer), true>::type>::type
+ type;
+};
+
+template <typename Integer>
+struct TwiceWiderInteger
+{
+ typedef typename std::enable_if<
+ std::numeric_limits<Integer>::is_integer,
+ typename IntegerForSizeAndSign<sizeof(Integer) * 2,
+ std::numeric_limits<Integer>::is_signed>::type>::type type;
+};
+
+template <typename Integer>
+struct PositionOfSignBit
+{
+ static const typename std::enable_if<std::numeric_limits<Integer>::is_integer, size_t>::type
+ value = CHAR_BIT * sizeof(Integer) - 1;
+};
+
+// This is used for UnsignedAbs, where we need to support floating-point
+// template instantiations even though we don't actually support the operations.
+// However, there is no corresponding implementation of e.g. CheckedUnsignedAbs,
+// so the float versions will not compile.
+template <typename Numeric,
+ bool IsInteger = std::numeric_limits<Numeric>::is_integer,
+ bool IsFloat = std::numeric_limits<Numeric>::is_iec559>
+struct UnsignedOrFloatForSize;
+
+template <typename Numeric>
+struct UnsignedOrFloatForSize<Numeric, true, false>
+{
+ typedef typename UnsignedIntegerForSize<Numeric>::type type;
+};
+
+template <typename Numeric>
+struct UnsignedOrFloatForSize<Numeric, false, true>
+{
+ typedef Numeric type;
+};
+
+// Helper templates for integer manipulations.
+
+template <typename T>
+constexpr bool HasSignBit(T x)
+{
+ // Cast to unsigned since right shift on signed is undefined.
+ return !!(static_cast<typename UnsignedIntegerForSize<T>::type>(x) >>
+ PositionOfSignBit<T>::value);
+}
+
+// This wrapper undoes the standard integer promotions.
+template <typename T>
+constexpr T BinaryComplement(T x)
+{
+ return static_cast<T>(~x);
+}
+
+// Here are the actual portable checked integer math implementations.
+// TODO(jschuh): Break this code out from the enable_if pattern and find a clean
+// way to coalesce things into the CheckedNumericState specializations below.
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer, T>::type
+CheckedAdd(T x, T y, RangeConstraint *validity)
+{
+ // Since the value of x+y is undefined if we have a signed type, we compute
+ // it using the unsigned type of the same size.
+ typedef typename UnsignedIntegerForSize<T>::type UnsignedDst;
+ UnsignedDst ux = static_cast<UnsignedDst>(x);
+ UnsignedDst uy = static_cast<UnsignedDst>(y);
+ UnsignedDst uresult = static_cast<UnsignedDst>(ux + uy);
+ // Addition is valid if the sign of (x + y) is equal to either that of x or
+ // that of y.
+ if (std::numeric_limits<T>::is_signed)
+ {
+ if (HasSignBit(BinaryComplement(static_cast<UnsignedDst>((uresult ^ ux) & (uresult ^ uy)))))
+ {
+ *validity = RANGE_VALID;
+ }
+ else
+ { // Direction of wrap is inverse of result sign.
+ *validity = HasSignBit(uresult) ? RANGE_OVERFLOW : RANGE_UNDERFLOW;
+ }
+ }
+ else
+ { // Unsigned is either valid or overflow.
+ *validity = BinaryComplement(x) >= y ? RANGE_VALID : RANGE_OVERFLOW;
+ }
+ return static_cast<T>(uresult);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer, T>::type
+CheckedSub(T x, T y, RangeConstraint *validity)
+{
+ // Since the value of x+y is undefined if we have a signed type, we compute
+ // it using the unsigned type of the same size.
+ typedef typename UnsignedIntegerForSize<T>::type UnsignedDst;
+ UnsignedDst ux = static_cast<UnsignedDst>(x);
+ UnsignedDst uy = static_cast<UnsignedDst>(y);
+ UnsignedDst uresult = static_cast<UnsignedDst>(ux - uy);
+ // Subtraction is valid if either x and y have same sign, or (x-y) and x have
+ // the same sign.
+ if (std::numeric_limits<T>::is_signed)
+ {
+ if (HasSignBit(BinaryComplement(static_cast<UnsignedDst>((uresult ^ ux) & (ux ^ uy)))))
+ {
+ *validity = RANGE_VALID;
+ }
+ else
+ { // Direction of wrap is inverse of result sign.
+ *validity = HasSignBit(uresult) ? RANGE_OVERFLOW : RANGE_UNDERFLOW;
+ }
+ }
+ else
+ { // Unsigned is either valid or underflow.
+ *validity = x >= y ? RANGE_VALID : RANGE_UNDERFLOW;
+ }
+ return static_cast<T>(uresult);
+}
+
+// Integer multiplication is a bit complicated. In the fast case we just
+// we just promote to a twice wider type, and range check the result. In the
+// slow case we need to manually check that the result won't be truncated by
+// checking with division against the appropriate bound.
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && sizeof(T) * 2 <= sizeof(uintmax_t),
+ T>::type
+CheckedMul(T x, T y, RangeConstraint *validity)
+{
+ typedef typename TwiceWiderInteger<T>::type IntermediateType;
+ IntermediateType tmp = static_cast<IntermediateType>(x) * static_cast<IntermediateType>(y);
+ *validity = DstRangeRelationToSrcRange<T>(tmp);
+ return static_cast<T>(tmp);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed &&
+ (sizeof(T) * 2 > sizeof(uintmax_t)),
+ T>::type
+CheckedMul(T x, T y, RangeConstraint *validity)
+{
+ // If either side is zero then the result will be zero.
+ if (!x || !y)
+ {
+ *validity = RANGE_VALID;
+ return static_cast<T>(0);
+ }
+ else if (x > 0)
+ {
+ if (y > 0)
+ *validity = x <= std::numeric_limits<T>::max() / y ? RANGE_VALID : RANGE_OVERFLOW;
+ else
+ *validity = y >= std::numeric_limits<T>::min() / x ? RANGE_VALID : RANGE_UNDERFLOW;
+ }
+ else
+ {
+ if (y > 0)
+ *validity = x >= std::numeric_limits<T>::min() / y ? RANGE_VALID : RANGE_UNDERFLOW;
+ else
+ *validity = y >= std::numeric_limits<T>::max() / x ? RANGE_VALID : RANGE_OVERFLOW;
+ }
+
+ return static_cast<T>(x * y);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed &&
+ (sizeof(T) * 2 > sizeof(uintmax_t)),
+ T>::type
+CheckedMul(T x, T y, RangeConstraint *validity)
+{
+ *validity = (y == 0 || x <= std::numeric_limits<T>::max() / y) ? RANGE_VALID : RANGE_OVERFLOW;
+ return static_cast<T>(x * y);
+}
+
+// Division just requires a check for an invalid negation on signed min/-1.
+template <typename T>
+T CheckedDiv(T x,
+ T y,
+ RangeConstraint *validity,
+ typename std::enable_if<std::numeric_limits<T>::is_integer, int>::type = 0)
+{
+ if (std::numeric_limits<T>::is_signed && x == std::numeric_limits<T>::min() &&
+ y == static_cast<T>(-1))
+ {
+ *validity = RANGE_OVERFLOW;
+ return std::numeric_limits<T>::min();
+ }
+
+ *validity = RANGE_VALID;
+ return static_cast<T>(x / y);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
+ T>::type
+CheckedMod(T x, T y, RangeConstraint *validity)
+{
+ *validity = y > 0 ? RANGE_VALID : RANGE_INVALID;
+ return static_cast<T>(x % y);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
+ T>::type
+CheckedMod(T x, T y, RangeConstraint *validity)
+{
+ *validity = RANGE_VALID;
+ return static_cast<T>(x % y);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
+ T>::type
+CheckedNeg(T value, RangeConstraint *validity)
+{
+ *validity = value != std::numeric_limits<T>::min() ? RANGE_VALID : RANGE_OVERFLOW;
+ // The negation of signed min is min, so catch that one.
+ return static_cast<T>(-value);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
+ T>::type
+CheckedNeg(T value, RangeConstraint *validity)
+{
+ // The only legal unsigned negation is zero.
+ *validity = value ? RANGE_UNDERFLOW : RANGE_VALID;
+ return static_cast<T>(-static_cast<typename SignedIntegerForSize<T>::type>(value));
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
+ T>::type
+CheckedAbs(T value, RangeConstraint *validity)
+{
+ *validity = value != std::numeric_limits<T>::min() ? RANGE_VALID : RANGE_OVERFLOW;
+ return static_cast<T>(std::abs(value));
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
+ T>::type
+CheckedAbs(T value, RangeConstraint *validity)
+{
+ // T is unsigned, so |value| must already be positive.
+ *validity = RANGE_VALID;
+ return value;
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed,
+ typename UnsignedIntegerForSize<T>::type>::type
+CheckedUnsignedAbs(T value)
+{
+ typedef typename UnsignedIntegerForSize<T>::type UnsignedT;
+ return value == std::numeric_limits<T>::min()
+ ? static_cast<UnsignedT>(std::numeric_limits<T>::max()) + 1
+ : static_cast<UnsignedT>(std::abs(value));
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed,
+ T>::type
+CheckedUnsignedAbs(T value)
+{
+ // T is unsigned, so |value| must already be positive.
+ return static_cast<T>(value);
+}
+
+// These are the floating point stubs that the compiler needs to see. Only the
+// negation operation is ever called.
+#define ANGLEBASE_FLOAT_ARITHMETIC_STUBS(NAME) \
+ template <typename T> \
+ typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type Checked##NAME( \
+ T, T, RangeConstraint *) \
+ { \
+ NOTREACHED(); \
+ return static_cast<T>(0); \
+ }
+
+ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Add)
+ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Sub)
+ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Mul)
+ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Div)
+ANGLEBASE_FLOAT_ARITHMETIC_STUBS(Mod)
+
+#undef ANGLEBASE_FLOAT_ARITHMETIC_STUBS
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedNeg(T value,
+ RangeConstraint *)
+{
+ return static_cast<T>(-value);
+}
+
+template <typename T>
+typename std::enable_if<std::numeric_limits<T>::is_iec559, T>::type CheckedAbs(T value,
+ RangeConstraint *)
+{
+ return static_cast<T>(std::abs(value));
+}
+
+// Floats carry around their validity state with them, but integers do not. So,
+// we wrap the underlying value in a specialization in order to hide that detail
+// and expose an interface via accessors.
+enum NumericRepresentation
+{
+ NUMERIC_INTEGER,
+ NUMERIC_FLOATING,
+ NUMERIC_UNKNOWN
+};
+
+template <typename NumericType>
+struct GetNumericRepresentation
+{
+ static const NumericRepresentation value =
+ std::numeric_limits<NumericType>::is_integer
+ ? NUMERIC_INTEGER
+ : (std::numeric_limits<NumericType>::is_iec559 ? NUMERIC_FLOATING : NUMERIC_UNKNOWN);
+};
+
+template <typename T, NumericRepresentation type = GetNumericRepresentation<T>::value>
+class CheckedNumericState
+{};
+
+// Integrals require quite a bit of additional housekeeping to manage state.
+template <typename T>
+class CheckedNumericState<T, NUMERIC_INTEGER>
+{
+ private:
+ T value_;
+ RangeConstraint validity_ : CHAR_BIT; // Actually requires only two bits.
+
+ public:
+ template <typename Src, NumericRepresentation type>
+ friend class CheckedNumericState;
+
+ CheckedNumericState() : value_(0), validity_(RANGE_VALID) {}
+
+ template <typename Src>
+ CheckedNumericState(Src value, RangeConstraint validity)
+ : value_(static_cast<T>(value)),
+ validity_(GetRangeConstraint(validity | DstRangeRelationToSrcRange<T>(value)))
+ {
+ static_assert(std::numeric_limits<Src>::is_specialized, "Argument must be numeric.");
+ }
+
+ // Copy constructor.
+ template <typename Src>
+ CheckedNumericState(const CheckedNumericState<Src> &rhs)
+ : value_(static_cast<T>(rhs.value())),
+ validity_(GetRangeConstraint(rhs.validity() | DstRangeRelationToSrcRange<T>(rhs.value())))
+ {}
+
+ template <typename Src>
+ explicit CheckedNumericState(
+ Src value,
+ typename std::enable_if<std::numeric_limits<Src>::is_specialized, int>::type = 0)
+ : value_(static_cast<T>(value)), validity_(DstRangeRelationToSrcRange<T>(value))
+ {}
+
+ RangeConstraint validity() const { return validity_; }
+ T value() const { return value_; }
+};
+
+// Floating points maintain their own validity, but need translation wrappers.
+template <typename T>
+class CheckedNumericState<T, NUMERIC_FLOATING>
+{
+ private:
+ T value_;
+
+ public:
+ template <typename Src, NumericRepresentation type>
+ friend class CheckedNumericState;
+
+ CheckedNumericState() : value_(0.0) {}
+
+ template <typename Src>
+ CheckedNumericState(
+ Src value,
+ RangeConstraint validity,
+ typename std::enable_if<std::numeric_limits<Src>::is_integer, int>::type = 0)
+ {
+ switch (DstRangeRelationToSrcRange<T>(value))
+ {
+ case RANGE_VALID:
+ value_ = static_cast<T>(value);
+ break;
+
+ case RANGE_UNDERFLOW:
+ value_ = -std::numeric_limits<T>::infinity();
+ break;
+
+ case RANGE_OVERFLOW:
+ value_ = std::numeric_limits<T>::infinity();
+ break;
+
+ case RANGE_INVALID:
+ value_ = std::numeric_limits<T>::quiet_NaN();
+ break;
+
+ default:
+ NOTREACHED();
+ }
+ }
+
+ template <typename Src>
+ explicit CheckedNumericState(
+ Src value,
+ typename std::enable_if<std::numeric_limits<Src>::is_specialized, int>::type = 0)
+ : value_(static_cast<T>(value))
+ {}
+
+ // Copy constructor.
+ template <typename Src>
+ CheckedNumericState(const CheckedNumericState<Src> &rhs) : value_(static_cast<T>(rhs.value()))
+ {}
+
+ RangeConstraint validity() const
+ {
+ return GetRangeConstraint(value_ <= std::numeric_limits<T>::max(),
+ value_ >= -std::numeric_limits<T>::max());
+ }
+ T value() const { return value_; }
+};
+
+// For integers less than 128-bit and floats 32-bit or larger, we have the type
+// with the larger maximum exponent take precedence.
+enum ArithmeticPromotionCategory
+{
+ LEFT_PROMOTION,
+ RIGHT_PROMOTION
+};
+
+template <typename Lhs,
+ typename Rhs = Lhs,
+ ArithmeticPromotionCategory Promotion =
+ (MaxExponent<Lhs>::value > MaxExponent<Rhs>::value) ? LEFT_PROMOTION
+ : RIGHT_PROMOTION>
+struct ArithmeticPromotion;
+
+template <typename Lhs, typename Rhs>
+struct ArithmeticPromotion<Lhs, Rhs, LEFT_PROMOTION>
+{
+ typedef Lhs type;
+};
+
+template <typename Lhs, typename Rhs>
+struct ArithmeticPromotion<Lhs, Rhs, RIGHT_PROMOTION>
+{
+ typedef Rhs type;
+};
+
+// We can statically check if operations on the provided types can wrap, so we
+// can skip the checked operations if they're not needed. So, for an integer we
+// care if the destination type preserves the sign and is twice the width of
+// the source.
+template <typename T, typename Lhs, typename Rhs>
+struct IsIntegerArithmeticSafe
+{
+ static const bool value =
+ !std::numeric_limits<T>::is_iec559 &&
+ StaticDstRangeRelationToSrcRange<T, Lhs>::value == NUMERIC_RANGE_CONTAINED &&
+ sizeof(T) >= (2 * sizeof(Lhs)) &&
+ StaticDstRangeRelationToSrcRange<T, Rhs>::value != NUMERIC_RANGE_CONTAINED &&
+ sizeof(T) >= (2 * sizeof(Rhs));
+};
+
+} // namespace internal
+} // namespace base
+
+} // namespace angle
+
+#endif // ANGLEBASE_NUMERICS_SAFE_MATH_IMPL_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.cc b/gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.cc
new file mode 100644
index 0000000000..cb88ba06e1
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.cc
@@ -0,0 +1,245 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "anglebase/sha1.h"
+
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "anglebase/sys_byteorder.h"
+
+namespace angle
+{
+
+namespace base
+{
+
+// Implementation of SHA-1. Only handles data in byte-sized blocks,
+// which simplifies the code a fair bit.
+
+// Identifier names follow notation in FIPS PUB 180-3, where you'll
+// also find a description of the algorithm:
+// http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf
+
+// Usage example:
+//
+// SecureHashAlgorithm sha;
+// while(there is data to hash)
+// sha.Update(moredata, size of data);
+// sha.Final();
+// memcpy(somewhere, sha.Digest(), 20);
+//
+// to reuse the instance of sha, call sha.Init();
+
+// TODO(jhawkins): Replace this implementation with a per-platform
+// implementation using each platform's crypto library. See
+// http://crbug.com/47218
+
+class SecureHashAlgorithm
+{
+ public:
+ SecureHashAlgorithm() { Init(); }
+
+ static const int kDigestSizeBytes;
+
+ void Init();
+ void Update(const void *data, size_t nbytes);
+ void Final();
+
+ // 20 bytes of message digest.
+ const unsigned char *Digest() const { return reinterpret_cast<const unsigned char *>(H); }
+
+ private:
+ void Pad();
+ void Process();
+
+ uint32_t A, B, C, D, E;
+
+ uint32_t H[5];
+
+ union {
+ uint32_t W[80];
+ uint8_t M[64];
+ };
+
+ uint32_t cursor;
+ uint64_t l;
+};
+
+static inline uint32_t f(uint32_t t, uint32_t B, uint32_t C, uint32_t D)
+{
+ if (t < 20)
+ {
+ return (B & C) | ((~B) & D);
+ }
+ else if (t < 40)
+ {
+ return B ^ C ^ D;
+ }
+ else if (t < 60)
+ {
+ return (B & C) | (B & D) | (C & D);
+ }
+ else
+ {
+ return B ^ C ^ D;
+ }
+}
+
+static inline uint32_t S(uint32_t n, uint32_t X)
+{
+ return (X << n) | (X >> (32 - n));
+}
+
+static inline uint32_t K(uint32_t t)
+{
+ if (t < 20)
+ {
+ return 0x5a827999;
+ }
+ else if (t < 40)
+ {
+ return 0x6ed9eba1;
+ }
+ else if (t < 60)
+ {
+ return 0x8f1bbcdc;
+ }
+ else
+ {
+ return 0xca62c1d6;
+ }
+}
+
+const int SecureHashAlgorithm::kDigestSizeBytes = 20;
+
+void SecureHashAlgorithm::Init()
+{
+ A = 0;
+ B = 0;
+ C = 0;
+ D = 0;
+ E = 0;
+ cursor = 0;
+ l = 0;
+ H[0] = 0x67452301;
+ H[1] = 0xefcdab89;
+ H[2] = 0x98badcfe;
+ H[3] = 0x10325476;
+ H[4] = 0xc3d2e1f0;
+}
+
+void SecureHashAlgorithm::Final()
+{
+ Pad();
+ Process();
+
+ for (int t = 0; t < 5; ++t)
+ H[t] = ByteSwap(H[t]);
+}
+
+void SecureHashAlgorithm::Update(const void *data, size_t nbytes)
+{
+ const uint8_t *d = reinterpret_cast<const uint8_t *>(data);
+ while (nbytes--)
+ {
+ M[cursor++] = *d++;
+ if (cursor >= 64)
+ Process();
+ l += 8;
+ }
+}
+
+void SecureHashAlgorithm::Pad()
+{
+ M[cursor++] = 0x80;
+
+ if (cursor > 64 - 8)
+ {
+ // pad out to next block
+ while (cursor < 64)
+ M[cursor++] = 0;
+
+ Process();
+ }
+
+ while (cursor < 64 - 8)
+ M[cursor++] = 0;
+
+ M[cursor++] = (l >> 56) & 0xff;
+ M[cursor++] = (l >> 48) & 0xff;
+ M[cursor++] = (l >> 40) & 0xff;
+ M[cursor++] = (l >> 32) & 0xff;
+ M[cursor++] = (l >> 24) & 0xff;
+ M[cursor++] = (l >> 16) & 0xff;
+ M[cursor++] = (l >> 8) & 0xff;
+ M[cursor++] = l & 0xff;
+}
+
+void SecureHashAlgorithm::Process()
+{
+ uint32_t t;
+
+ // Each a...e corresponds to a section in the FIPS 180-3 algorithm.
+
+ // a.
+ //
+ // W and M are in a union, so no need to memcpy.
+ // memcpy(W, M, sizeof(M));
+ for (t = 0; t < 16; ++t)
+ W[t] = ByteSwap(W[t]);
+
+ // b.
+ for (t = 16; t < 80; ++t)
+ W[t] = S(1, W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16]);
+
+ // c.
+ A = H[0];
+ B = H[1];
+ C = H[2];
+ D = H[3];
+ E = H[4];
+
+ // d.
+ for (t = 0; t < 80; ++t)
+ {
+ uint32_t TEMP = S(5, A) + f(t, B, C, D) + E + W[t] + K(t);
+ E = D;
+ D = C;
+ C = S(30, B);
+ B = A;
+ A = TEMP;
+ }
+
+ // e.
+ H[0] += A;
+ H[1] += B;
+ H[2] += C;
+ H[3] += D;
+ H[4] += E;
+
+ cursor = 0;
+}
+
+std::string SHA1HashString(const std::string &str)
+{
+ char hash[SecureHashAlgorithm::kDigestSizeBytes];
+ SHA1HashBytes(reinterpret_cast<const unsigned char *>(str.c_str()), str.length(),
+ reinterpret_cast<unsigned char *>(hash));
+ return std::string(hash, SecureHashAlgorithm::kDigestSizeBytes);
+}
+
+void SHA1HashBytes(const unsigned char *data, size_t len, unsigned char *hash)
+{
+ SecureHashAlgorithm sha;
+ sha.Update(data, len);
+ sha.Final();
+
+ memcpy(hash, sha.Digest(), SecureHashAlgorithm::kDigestSizeBytes);
+}
+
+} // namespace base
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.h
new file mode 100644
index 0000000000..a60908814f
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/sha1.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANGLEBASE_SHA1_H_
+#define ANGLEBASE_SHA1_H_
+
+#include <stddef.h>
+
+#include <string>
+
+#include "anglebase/base_export.h"
+
+namespace angle
+{
+
+namespace base
+{
+
+// These functions perform SHA-1 operations.
+
+static const size_t kSHA1Length = 20; // Length in bytes of a SHA-1 hash.
+
+// Computes the SHA-1 hash of the input string |str| and returns the full
+// hash.
+ANGLEBASE_EXPORT std::string SHA1HashString(const std::string &str);
+
+// Computes the SHA-1 hash of the |len| bytes in |data| and puts the hash
+// in |hash|. |hash| must be kSHA1Length bytes long.
+ANGLEBASE_EXPORT void SHA1HashBytes(const unsigned char *data, size_t len, unsigned char *hash);
+
+} // namespace base
+
+} // namespace angle
+
+#endif // ANGLEBASE_SHA1_H_
diff --git a/gfx/angle/checkout/src/common/third_party/base/anglebase/sys_byteorder.h b/gfx/angle/checkout/src/common/third_party/base/anglebase/sys_byteorder.h
new file mode 100644
index 0000000000..43d1777f26
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/base/anglebase/sys_byteorder.h
@@ -0,0 +1,49 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// sys_byteorder.h: Compatiblity hacks for importing Chromium's base/SHA1.
+
+#ifndef ANGLEBASE_SYS_BYTEORDER_H_
+#define ANGLEBASE_SYS_BYTEORDER_H_
+
+namespace angle
+{
+
+namespace base
+{
+
+// Returns a value with all bytes in |x| swapped, i.e. reverses the endianness.
+inline uint16_t ByteSwap(uint16_t x)
+{
+#if defined(_MSC_VER)
+ return _byteswap_ushort(x);
+#else
+ return __builtin_bswap16(x);
+#endif
+}
+
+inline uint32_t ByteSwap(uint32_t x)
+{
+#if defined(_MSC_VER)
+ return _byteswap_ulong(x);
+#else
+ return __builtin_bswap32(x);
+#endif
+}
+
+inline uint64_t ByteSwap(uint64_t x)
+{
+#if defined(_MSC_VER)
+ return _byteswap_uint64(x);
+#else
+ return __builtin_bswap64(x);
+#endif
+}
+
+} // namespace base
+
+} // namespace angle
+
+#endif // ANGLEBASE_SYS_BYTEORDER_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp b/gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp
new file mode 100644
index 0000000000..379e5ce3d5
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp
@@ -0,0 +1,339 @@
+/*-----------------------------------------------------------------------------
+ * MurmurHash3 was written by Austin Appleby, and is placed in the public
+ * domain.
+ *
+ * This implementation was written by Shane Day, and is also public domain.
+ *
+ * This is a portable ANSI C implementation of MurmurHash3_x86_32 (Murmur3A)
+ * with support for progressive processing.
+ */
+
+/*-----------------------------------------------------------------------------
+
+If you want to understand the MurmurHash algorithm you would be much better
+off reading the original source. Just point your browser at:
+http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp
+
+
+What this version provides?
+
+1. Progressive data feeding. Useful when the entire payload to be hashed
+does not fit in memory or when the data is streamed through the application.
+Also useful when hashing a number of strings with a common prefix. A partial
+hash of a prefix string can be generated and reused for each suffix string.
+
+2. Portability. Plain old C so that it should compile on any old compiler.
+Both CPU endian and access-alignment neutral, but avoiding inefficient code
+when possible depending on CPU capabilities.
+
+3. Drop in. I personally like nice self contained public domain code, making it
+easy to pilfer without loads of refactoring to work properly in the existing
+application code & makefile structure and mucking around with licence files.
+Just copy PMurHash.h and PMurHash.c and you're ready to go.
+
+
+How does it work?
+
+We can only process entire 32 bit chunks of input, except for the very end
+that may be shorter. So along with the partial hash we need to give back to
+the caller a carry containing up to 3 bytes that we were unable to process.
+This carry also needs to record the number of bytes the carry holds. I use
+the low 2 bits as a count (0..3) and the carry bytes are shifted into the
+high byte in stream order.
+
+To handle endianess I simply use a macro that reads a uint32_t and define
+that macro to be a direct read on little endian machines, a read and swap
+on big endian machines, or a byte-by-byte read if the endianess is unknown.
+
+-----------------------------------------------------------------------------*/
+
+#include "PMurHash.h"
+#include <stdint.h>
+
+/* I used ugly type names in the header to avoid potential conflicts with
+ * application or system typedefs & defines. Since I'm not including any more
+ * headers below here I can rename these so that the code reads like C99 */
+#undef uint32_t
+#define uint32_t MH_UINT32
+#undef uint8_t
+#define uint8_t MH_UINT8
+
+/* MSVC warnings we choose to ignore */
+#if defined(_MSC_VER)
+# pragma warning(disable : 4127) /* conditional expression is constant */
+#endif
+
+/*-----------------------------------------------------------------------------
+ * Endianess, misalignment capabilities and util macros
+ *
+ * The following 3 macros are defined in this section. The other macros defined
+ * are only needed to help derive these 3.
+ *
+ * READ_UINT32(x) Read a little endian unsigned 32-bit int
+ * UNALIGNED_SAFE Defined if READ_UINT32 works on non-word boundaries
+ * ROTL32(x,r) Rotate x left by r bits
+ */
+
+/* Convention is to define __BYTE_ORDER == to one of these values */
+#if !defined(__BIG_ENDIAN)
+# define __BIG_ENDIAN 4321
+#endif
+#if !defined(__LITTLE_ENDIAN)
+# define __LITTLE_ENDIAN 1234
+#endif
+
+/* I386 */
+#if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(i386)
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# define UNALIGNED_SAFE
+#endif
+
+/* gcc 'may' define __LITTLE_ENDIAN__ or __BIG_ENDIAN__ to 1 (Note the trailing __),
+ * or even _LITTLE_ENDIAN or _BIG_ENDIAN (Note the single _ prefix) */
+#if !defined(__BYTE_ORDER)
+# if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__ == 1 || \
+ defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN == 1
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__ == 1 || defined(_BIG_ENDIAN) && _BIG_ENDIAN == 1
+# define __BYTE_ORDER __BIG_ENDIAN
+# endif
+#endif
+
+/* gcc (usually) defines xEL/EB macros for ARM and MIPS endianess */
+#if !defined(__BYTE_ORDER)
+# if defined(__ARMEL__) || defined(__MIPSEL__)
+# define __BYTE_ORDER __LITTLE_ENDIAN
+# endif
+# if defined(__ARMEB__) || defined(__MIPSEB__)
+# define __BYTE_ORDER __BIG_ENDIAN
+# endif
+#endif
+
+/* Now find best way we can to READ_UINT32 */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+/* CPU endian matches murmurhash algorithm, so read 32-bit word directly */
+# define READ_UINT32(ptr) (*((uint32_t *)(ptr)))
+#elif __BYTE_ORDER == __BIG_ENDIAN
+/* TODO: Add additional cases below where a compiler provided bswap32 is available */
+# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+# define READ_UINT32(ptr) (__builtin_bswap32(*((uint32_t *)(ptr))))
+# else
+/* Without a known fast bswap32 we're just as well off doing this */
+# define READ_UINT32(ptr) (ptr[0] | ptr[1] << 8 | ptr[2] << 16 | ptr[3] << 24)
+# define UNALIGNED_SAFE
+# endif
+#else
+/* Unknown endianess so last resort is to read individual bytes */
+# define READ_UINT32(ptr) (ptr[0] | ptr[1] << 8 | ptr[2] << 16 | ptr[3] << 24)
+
+/* Since we're not doing word-reads we can skip the messing about with realignment */
+# define UNALIGNED_SAFE
+#endif
+
+/* Find best way to ROTL32 */
+#if defined(_MSC_VER)
+# include <stdlib.h> /* Microsoft put _rotl declaration in here */
+# define ROTL32(x, r) _rotl(x, r)
+#else
+/* gcc recognises this code and generates a rotate instruction for CPUs with one */
+# define ROTL32(x, r) (((uint32_t)x << r) | ((uint32_t)x >> (32 - r)))
+#endif
+
+/*-----------------------------------------------------------------------------
+ * Core murmurhash algorithm macros */
+
+#define C1 (0xcc9e2d51)
+#define C2 (0x1b873593)
+
+/* This is the main processing body of the algorithm. It operates
+ * on each full 32-bits of input. */
+#define DOBLOCK(h1, k1) \
+ do \
+ { \
+ k1 *= C1; \
+ k1 = ROTL32(k1, 15); \
+ k1 *= C2; \
+ \
+ h1 ^= k1; \
+ h1 = ROTL32(h1, 13); \
+ h1 = h1 * 5 + 0xe6546b64; \
+ } while (0)
+
+/* Append unaligned bytes to carry, forcing hash churn if we have 4 bytes */
+/* cnt=bytes to process, h1=name of h1 var, c=carry, n=bytes in c, ptr/len=payload */
+#define DOBYTES(cnt, h1, c, n, ptr, len) \
+ do \
+ { \
+ int _i = cnt; \
+ while (_i--) \
+ { \
+ c = c >> 8 | *ptr++ << 24; \
+ n++; \
+ len--; \
+ if (n == 4) \
+ { \
+ DOBLOCK(h1, c); \
+ n = 0; \
+ } \
+ } \
+ } while (0)
+
+/*---------------------------------------------------------------------------*/
+
+namespace angle
+{
+/* Main hashing function. Initialise carry to 0 and h1 to 0 or an initial seed
+ * if wanted. Both ph1 and pcarry are required arguments. */
+void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int len)
+{
+ uint32_t h1 = *ph1;
+ uint32_t c = *pcarry;
+
+ const uint8_t *ptr = (uint8_t *)key;
+ const uint8_t *end;
+
+ /* Extract carry count from low 2 bits of c value */
+ int n = c & 3;
+
+#if defined(UNALIGNED_SAFE)
+ /* This CPU handles unaligned word access */
+
+ /* Consume any carry bytes */
+ int i = (4 - n) & 3;
+ if (i && i <= len)
+ {
+ DOBYTES(i, h1, c, n, ptr, len);
+ }
+
+ /* Process 32-bit chunks */
+ end = ptr + len / 4 * 4;
+ for (; ptr < end; ptr += 4)
+ {
+ uint32_t k1 = READ_UINT32(ptr);
+ DOBLOCK(h1, k1);
+ }
+
+#else /*UNALIGNED_SAFE*/
+ /* This CPU does not handle unaligned word access */
+
+ /* Consume enough so that the next data byte is word aligned */
+ int i = -(intptr_t)ptr & 3;
+ if (i && i <= len)
+ {
+ DOBYTES(i, h1, c, n, ptr, len);
+ }
+
+ /* We're now aligned. Process in aligned blocks. Specialise for each possible carry count */
+ end = ptr + len / 4 * 4;
+ switch (n)
+ { /* how many bytes in c */
+ case 0: /* c=[----] w=[3210] b=[3210]=w c'=[----] */
+ for (; ptr < end; ptr += 4)
+ {
+ uint32_t k1 = READ_UINT32(ptr);
+ DOBLOCK(h1, k1);
+ }
+ break;
+ case 1: /* c=[0---] w=[4321] b=[3210]=c>>24|w<<8 c'=[4---] */
+ for (; ptr < end; ptr += 4)
+ {
+ uint32_t k1 = c >> 24;
+ c = READ_UINT32(ptr);
+ k1 |= c << 8;
+ DOBLOCK(h1, k1);
+ }
+ break;
+ case 2: /* c=[10--] w=[5432] b=[3210]=c>>16|w<<16 c'=[54--] */
+ for (; ptr < end; ptr += 4)
+ {
+ uint32_t k1 = c >> 16;
+ c = READ_UINT32(ptr);
+ k1 |= c << 16;
+ DOBLOCK(h1, k1);
+ }
+ break;
+ case 3: /* c=[210-] w=[6543] b=[3210]=c>>8|w<<24 c'=[654-] */
+ for (; ptr < end; ptr += 4)
+ {
+ uint32_t k1 = c >> 8;
+ c = READ_UINT32(ptr);
+ k1 |= c << 24;
+ DOBLOCK(h1, k1);
+ }
+ }
+#endif /*UNALIGNED_SAFE*/
+
+ /* Advance over whole 32-bit chunks, possibly leaving 1..3 bytes */
+ len -= len / 4 * 4;
+
+ /* Append any remaining bytes into carry */
+ DOBYTES(len, h1, c, n, ptr, len);
+
+ /* Copy out new running hash and carry */
+ *ph1 = h1;
+ *pcarry = (c & ~0xff) | n;
+}
+
+/*---------------------------------------------------------------------------*/
+
+/* Finalize a hash. To match the original Murmur3A the total_length must be provided */
+uint32_t PMurHash32_Result(uint32_t h, uint32_t carry, uint32_t total_length)
+{
+ uint32_t k1;
+ int n = carry & 3;
+ if (n)
+ {
+ k1 = carry >> (4 - n) * 8;
+ k1 *= C1;
+ k1 = ROTL32(k1, 15);
+ k1 *= C2;
+ h ^= k1;
+ }
+ h ^= total_length;
+
+ /* fmix */
+ h ^= h >> 16;
+ h *= 0x85ebca6b;
+ h ^= h >> 13;
+ h *= 0xc2b2ae35;
+ h ^= h >> 16;
+
+ return h;
+}
+
+/*---------------------------------------------------------------------------*/
+
+/* Murmur3A compatable all-at-once */
+uint32_t PMurHash32(uint32_t seed, const void *key, int len)
+{
+ uint32_t h1 = seed, carry = 0;
+ PMurHash32_Process(&h1, &carry, key, len);
+ return PMurHash32_Result(h1, carry, len);
+}
+
+/*---------------------------------------------------------------------------*/
+
+/* Provide an API suitable for smhasher */
+void PMurHash32_test(const void *key, int len, uint32_t seed, void *out)
+{
+ uint32_t h1 = seed, carry = 0;
+ const uint8_t *ptr = (uint8_t *)key;
+ const uint8_t *end = ptr + len;
+
+#if 0 /* Exercise the progressive processing */
+ while(ptr < end) {
+ //const uint8_t *mid = ptr + rand()%(end-ptr)+1;
+ const uint8_t *mid = ptr + (rand()&0xF);
+ mid = mid<end?mid:end;
+ PMurHash32_Process(&h1, &carry, ptr, mid-ptr);
+ ptr = mid;
+ }
+#else
+ PMurHash32_Process(&h1, &carry, ptr, (int)(end - ptr));
+#endif
+ h1 = PMurHash32_Result(h1, carry, len);
+ *(uint32_t *)out = h1;
+}
+} // namespace angle
+
+/*---------------------------------------------------------------------------*/
diff --git a/gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.h b/gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.h
new file mode 100644
index 0000000000..0a3c96fa14
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.h
@@ -0,0 +1,57 @@
+/*-----------------------------------------------------------------------------
+ * MurmurHash3 was written by Austin Appleby, and is placed in the public
+ * domain.
+ *
+ * This implementation was written by Shane Day, and is also public domain.
+ *
+ * This is a portable ANSI C implementation of MurmurHash3_x86_32 (Murmur3A)
+ * with support for progressive processing.
+ */
+
+/* ------------------------------------------------------------------------- */
+/* Determine what native type to use for uint32_t */
+
+/* We can't use the name 'uint32_t' here because it will conflict with
+ * any version provided by the system headers or application. */
+
+/* First look for special cases */
+#if defined(_MSC_VER)
+# define MH_UINT32 unsigned long
+#endif
+
+/* If the compiler says it's C99 then take its word for it */
+#if !defined(MH_UINT32) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
+# include <stdint.h>
+# define MH_UINT32 uint32_t
+#endif
+
+/* Otherwise try testing against max value macros from limit.h */
+#if !defined(MH_UINT32)
+# include <limits.h>
+# if (USHRT_MAX == 0xffffffffUL)
+# define MH_UINT32 unsigned short
+# elif (UINT_MAX == 0xffffffffUL)
+# define MH_UINT32 unsigned int
+# elif (ULONG_MAX == 0xffffffffUL)
+# define MH_UINT32 unsigned long
+# endif
+#endif
+
+#if !defined(MH_UINT32)
+# error Unable to determine type name for unsigned 32-bit int
+#endif
+
+/* I'm yet to work on a platform where 'unsigned char' is not 8 bits */
+#define MH_UINT8 unsigned char
+
+/* ------------------------------------------------------------------------- */
+/* Prototypes */
+
+namespace angle
+{
+void PMurHash32_Process(MH_UINT32 *ph1, MH_UINT32 *pcarry, const void *key, int len);
+MH_UINT32 PMurHash32_Result(MH_UINT32 h1, MH_UINT32 carry, MH_UINT32 total_length);
+MH_UINT32 PMurHash32(MH_UINT32 seed, const void *key, int len);
+
+void PMurHash32_test(const void *key, int len, MH_UINT32 seed, void *out);
+} // namespace angle
diff --git a/gfx/angle/checkout/src/common/third_party/xxhash/xxhash.c b/gfx/angle/checkout/src/common/third_party/xxhash/xxhash.c
new file mode 100644
index 0000000000..13669b2a4d
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/xxhash/xxhash.c
@@ -0,0 +1,1030 @@
+/*
+* xxHash - Fast Hash algorithm
+* Copyright (C) 2012-2016, Yann Collet
+*
+* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following disclaimer
+* in the documentation and/or other materials provided with the
+* distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* You can contact the author at :
+* - xxHash homepage: http://www.xxhash.com
+* - xxHash source repository : https://github.com/Cyan4973/xxHash
+*/
+
+
+/* *************************************
+* Tuning parameters
+***************************************/
+/*!XXH_FORCE_MEMORY_ACCESS :
+ * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable.
+ * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal.
+ * The below switch allow to select different access method for improved performance.
+ * Method 0 (default) : use `memcpy()`. Safe and portable.
+ * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable).
+ * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`.
+ * Method 2 : direct access. This method doesn't depend on compiler but violate C standard.
+ * It can generate buggy code on targets which do not support unaligned memory accesses.
+ * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6)
+ * See http://stackoverflow.com/a/32095106/646947 for details.
+ * Prefer these methods in priority order (0 > 1 > 2)
+ */
+#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
+# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
+ || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
+# define XXH_FORCE_MEMORY_ACCESS 2
+# elif (defined(__INTEL_COMPILER) && !defined(_WIN32)) || \
+ (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+ || defined(__ARM_ARCH_7S__) ))
+# define XXH_FORCE_MEMORY_ACCESS 1
+# endif
+#endif
+
+/*!XXH_ACCEPT_NULL_INPUT_POINTER :
+ * If input pointer is NULL, xxHash default behavior is to dereference it, triggering a segfault.
+ * When this macro is enabled, xxHash actively checks input for null pointer.
+ * It it is, result for null input pointers is the same as a null-length input.
+ */
+#ifndef XXH_ACCEPT_NULL_INPUT_POINTER /* can be defined externally */
+# define XXH_ACCEPT_NULL_INPUT_POINTER 0
+#endif
+
+/*!XXH_FORCE_NATIVE_FORMAT :
+ * By default, xxHash library provides endian-independent Hash values, based on little-endian convention.
+ * Results are therefore identical for little-endian and big-endian CPU.
+ * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format.
+ * Should endian-independence be of no importance for your application, you may set the #define below to 1,
+ * to improve speed for Big-endian CPU.
+ * This option has no impact on Little_Endian CPU.
+ */
+#ifndef XXH_FORCE_NATIVE_FORMAT /* can be defined externally */
+# define XXH_FORCE_NATIVE_FORMAT 0
+#endif
+
+/*!XXH_FORCE_ALIGN_CHECK :
+ * This is a minor performance trick, only useful with lots of very small keys.
+ * It means : check for aligned/unaligned input.
+ * The check costs one initial branch per hash;
+ * set it to 0 when the input is guaranteed to be aligned,
+ * or when alignment doesn't matter for performance.
+ */
+#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */
+# if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64)
+# define XXH_FORCE_ALIGN_CHECK 0
+# else
+# define XXH_FORCE_ALIGN_CHECK 1
+# endif
+#endif
+
+
+/* *************************************
+* Includes & Memory related functions
+***************************************/
+/*! Modify the local functions below should you wish to use some other memory routines
+* for malloc(), free() */
+#include <stdlib.h>
+static void* XXH_malloc(size_t s) { return malloc(s); }
+static void XXH_free (void* p) { free(p); }
+/*! and for memcpy() */
+#include <string.h>
+static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); }
+
+#include <assert.h> /* assert */
+
+#define XXH_STATIC_LINKING_ONLY
+#include "xxhash.h"
+
+
+/* *************************************
+* Compiler Specific Options
+***************************************/
+#ifdef _MSC_VER /* Visual Studio */
+# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
+# define FORCE_INLINE static __forceinline
+#else
+# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
+# ifdef __GNUC__
+# define FORCE_INLINE static inline __attribute__((always_inline))
+# else
+# define FORCE_INLINE static inline
+# endif
+# else
+# define FORCE_INLINE static
+# endif /* __STDC_VERSION__ */
+#endif
+
+
+/* *************************************
+* Basic Types
+***************************************/
+#ifndef MEM_MODULE
+# if !defined (__VMS) \
+ && (defined (__cplusplus) \
+ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
+# include <stdint.h>
+ typedef uint8_t BYTE;
+ typedef uint16_t U16;
+ typedef uint32_t U32;
+# else
+ typedef unsigned char BYTE;
+ typedef unsigned short U16;
+ typedef unsigned int U32;
+# endif
+#endif
+
+#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2))
+
+/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */
+static U32 XXH_read32(const void* memPtr) { return *(const U32*) memPtr; }
+
+#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1))
+
+/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */
+/* currently only defined for gcc and icc */
+typedef union { U32 u32; } __attribute__((packed)) unalign;
+static U32 XXH_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
+
+#else
+
+/* portable and safe solution. Generally efficient.
+ * see : http://stackoverflow.com/a/32095106/646947
+ */
+static U32 XXH_read32(const void* memPtr)
+{
+ U32 val;
+ memcpy(&val, memPtr, sizeof(val));
+ return val;
+}
+
+#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */
+
+
+/* ****************************************
+* Compiler-specific Functions and Macros
+******************************************/
+#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
+
+/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */
+#if defined(_MSC_VER)
+# define XXH_rotl32(x,r) _rotl(x,r)
+# define XXH_rotl64(x,r) _rotl64(x,r)
+#else
+# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r)))
+# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r)))
+#endif
+
+#if defined(_MSC_VER) /* Visual Studio */
+# define XXH_swap32 _byteswap_ulong
+#elif XXH_GCC_VERSION >= 403
+# define XXH_swap32 __builtin_bswap32
+#else
+static U32 XXH_swap32 (U32 x)
+{
+ return ((x << 24) & 0xff000000 ) |
+ ((x << 8) & 0x00ff0000 ) |
+ ((x >> 8) & 0x0000ff00 ) |
+ ((x >> 24) & 0x000000ff );
+}
+#endif
+
+
+/* *************************************
+* Architecture Macros
+***************************************/
+typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess;
+
+/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler command line */
+#ifndef XXH_CPU_LITTLE_ENDIAN
+static int XXH_isLittleEndian(void)
+{
+ const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */
+ return one.c[0];
+}
+# define XXH_CPU_LITTLE_ENDIAN XXH_isLittleEndian()
+#endif
+
+
+/* ***************************
+* Memory reads
+*****************************/
+typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment;
+
+FORCE_INLINE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align)
+{
+ if (align==XXH_unaligned)
+ return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr));
+ else
+ return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr);
+}
+
+FORCE_INLINE U32 XXH_readLE32(const void* ptr, XXH_endianess endian)
+{
+ return XXH_readLE32_align(ptr, endian, XXH_unaligned);
+}
+
+static U32 XXH_readBE32(const void* ptr)
+{
+ return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr);
+}
+
+
+/* *************************************
+* Macros
+***************************************/
+#define XXH_STATIC_ASSERT(c) { enum { XXH_sa = 1/(int)(!!(c)) }; } /* use after variable declarations */
+XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; }
+
+
+/* *******************************************************************
+* 32-bit hash functions
+*********************************************************************/
+static const U32 PRIME32_1 = 2654435761U; /* 0b10011110001101110111100110110001 */
+static const U32 PRIME32_2 = 2246822519U; /* 0b10000101111010111100101001110111 */
+static const U32 PRIME32_3 = 3266489917U; /* 0b11000010101100101010111000111101 */
+static const U32 PRIME32_4 = 668265263U; /* 0b00100111110101001110101100101111 */
+static const U32 PRIME32_5 = 374761393U; /* 0b00010110010101100110011110110001 */
+
+static U32 XXH32_round(U32 seed, U32 input)
+{
+ seed += input * PRIME32_2;
+ seed = XXH_rotl32(seed, 13);
+ seed *= PRIME32_1;
+ return seed;
+}
+
+/* mix all bits */
+static U32 XXH32_avalanche(U32 h32)
+{
+ h32 ^= h32 >> 15;
+ h32 *= PRIME32_2;
+ h32 ^= h32 >> 13;
+ h32 *= PRIME32_3;
+ h32 ^= h32 >> 16;
+ return(h32);
+}
+
+#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align)
+
+static U32
+XXH32_finalize(U32 h32, const void* ptr, size_t len,
+ XXH_endianess endian, XXH_alignment align)
+
+{
+ const BYTE* p = (const BYTE*)ptr;
+
+#define PROCESS1 \
+ h32 += (*p++) * PRIME32_5; \
+ h32 = XXH_rotl32(h32, 11) * PRIME32_1 ;
+
+#define PROCESS4 \
+ h32 += XXH_get32bits(p) * PRIME32_3; \
+ p+=4; \
+ h32 = XXH_rotl32(h32, 17) * PRIME32_4 ;
+
+ switch(len&15) /* or switch(bEnd - p) */
+ {
+ case 12: PROCESS4;
+ /* fallthrough */
+ case 8: PROCESS4;
+ /* fallthrough */
+ case 4: PROCESS4;
+ return XXH32_avalanche(h32);
+
+ case 13: PROCESS4;
+ /* fallthrough */
+ case 9: PROCESS4;
+ /* fallthrough */
+ case 5: PROCESS4;
+ PROCESS1;
+ return XXH32_avalanche(h32);
+
+ case 14: PROCESS4;
+ /* fallthrough */
+ case 10: PROCESS4;
+ /* fallthrough */
+ case 6: PROCESS4;
+ PROCESS1;
+ PROCESS1;
+ return XXH32_avalanche(h32);
+
+ case 15: PROCESS4;
+ /* fallthrough */
+ case 11: PROCESS4;
+ /* fallthrough */
+ case 7: PROCESS4;
+ /* fallthrough */
+ case 3: PROCESS1;
+ /* fallthrough */
+ case 2: PROCESS1;
+ /* fallthrough */
+ case 1: PROCESS1;
+ /* fallthrough */
+ case 0: return XXH32_avalanche(h32);
+ }
+ assert(0);
+ return h32; /* reaching this point is deemed impossible */
+}
+
+
+FORCE_INLINE U32
+XXH32_endian_align(const void* input, size_t len, U32 seed,
+ XXH_endianess endian, XXH_alignment align)
+{
+ const BYTE* p = (const BYTE*)input;
+ const BYTE* bEnd = p + len;
+ U32 h32;
+
+#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
+ if (p==NULL) {
+ len=0;
+ bEnd=p=(const BYTE*)(size_t)16;
+ }
+#endif
+
+ if (len>=16) {
+ const BYTE* const limit = bEnd - 15;
+ U32 v1 = seed + PRIME32_1 + PRIME32_2;
+ U32 v2 = seed + PRIME32_2;
+ U32 v3 = seed + 0;
+ U32 v4 = seed - PRIME32_1;
+
+ do {
+ v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4;
+ v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4;
+ v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4;
+ v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4;
+ } while (p < limit);
+
+ h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7)
+ + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18);
+ } else {
+ h32 = seed + PRIME32_5;
+ }
+
+ h32 += (U32)len;
+
+ return XXH32_finalize(h32, p, len&15, endian, align);
+}
+
+
+XXH_PUBLIC_API unsigned int XXH32 (const void* input, size_t len, unsigned int seed)
+{
+#if 0
+ /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
+ XXH32_state_t state;
+ XXH32_reset(&state, seed);
+ XXH32_update(&state, input, len);
+ return XXH32_digest(&state);
+#else
+ XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
+
+ if (XXH_FORCE_ALIGN_CHECK) {
+ if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned);
+ else
+ return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned);
+ } }
+
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned);
+ else
+ return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned);
+#endif
+}
+
+
+
+/*====== Hash streaming ======*/
+
+XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void)
+{
+ return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t));
+}
+XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr)
+{
+ XXH_free(statePtr);
+ return XXH_OK;
+}
+
+XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState)
+{
+ memcpy(dstState, srcState, sizeof(*dstState));
+}
+
+XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, unsigned int seed)
+{
+ XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
+ memset(&state, 0, sizeof(state));
+ state.v1 = seed + PRIME32_1 + PRIME32_2;
+ state.v2 = seed + PRIME32_2;
+ state.v3 = seed + 0;
+ state.v4 = seed - PRIME32_1;
+ /* do not write into reserved, planned to be removed in a future version */
+ memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved));
+ return XXH_OK;
+}
+
+
+FORCE_INLINE XXH_errorcode
+XXH32_update_endian(XXH32_state_t* state, const void* input, size_t len, XXH_endianess endian)
+{
+ if (input==NULL)
+#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
+ return XXH_OK;
+#else
+ return XXH_ERROR;
+#endif
+
+ { const BYTE* p = (const BYTE*)input;
+ const BYTE* const bEnd = p + len;
+
+ state->total_len_32 += (unsigned)len;
+ state->large_len |= (len>=16) | (state->total_len_32>=16);
+
+ if (state->memsize + len < 16) { /* fill in tmp buffer */
+ XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len);
+ state->memsize += (unsigned)len;
+ return XXH_OK;
+ }
+
+ if (state->memsize) { /* some data left from previous update */
+ XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize);
+ { const U32* p32 = state->mem32;
+ state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++;
+ state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++;
+ state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++;
+ state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian));
+ }
+ p += 16-state->memsize;
+ state->memsize = 0;
+ }
+
+ if (p <= bEnd-16) {
+ const BYTE* const limit = bEnd - 16;
+ U32 v1 = state->v1;
+ U32 v2 = state->v2;
+ U32 v3 = state->v3;
+ U32 v4 = state->v4;
+
+ do {
+ v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4;
+ v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4;
+ v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4;
+ v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4;
+ } while (p<=limit);
+
+ state->v1 = v1;
+ state->v2 = v2;
+ state->v3 = v3;
+ state->v4 = v4;
+ }
+
+ if (p < bEnd) {
+ XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
+ state->memsize = (unsigned)(bEnd-p);
+ }
+ }
+
+ return XXH_OK;
+}
+
+
+XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len)
+{
+ XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
+
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH32_update_endian(state_in, input, len, XXH_littleEndian);
+ else
+ return XXH32_update_endian(state_in, input, len, XXH_bigEndian);
+}
+
+
+FORCE_INLINE U32
+XXH32_digest_endian (const XXH32_state_t* state, XXH_endianess endian)
+{
+ U32 h32;
+
+ if (state->large_len) {
+ h32 = XXH_rotl32(state->v1, 1)
+ + XXH_rotl32(state->v2, 7)
+ + XXH_rotl32(state->v3, 12)
+ + XXH_rotl32(state->v4, 18);
+ } else {
+ h32 = state->v3 /* == seed */ + PRIME32_5;
+ }
+
+ h32 += state->total_len_32;
+
+ return XXH32_finalize(h32, state->mem32, state->memsize, endian, XXH_aligned);
+}
+
+
+XXH_PUBLIC_API unsigned int XXH32_digest (const XXH32_state_t* state_in)
+{
+ XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
+
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH32_digest_endian(state_in, XXH_littleEndian);
+ else
+ return XXH32_digest_endian(state_in, XXH_bigEndian);
+}
+
+
+/*====== Canonical representation ======*/
+
+/*! Default XXH result types are basic unsigned 32 and 64 bits.
+* The canonical representation follows human-readable write convention, aka big-endian (large digits first).
+* These functions allow transformation of hash result into and from its canonical format.
+* This way, hash values can be written into a file or buffer, remaining comparable across different systems.
+*/
+
+XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash)
+{
+ XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t));
+ if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash);
+ memcpy(dst, &hash, sizeof(*dst));
+}
+
+XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src)
+{
+ return XXH_readBE32(src);
+}
+
+
+#ifndef XXH_NO_LONG_LONG
+
+/* *******************************************************************
+* 64-bit hash functions
+*********************************************************************/
+
+/*====== Memory access ======*/
+
+#ifndef MEM_MODULE
+# define MEM_MODULE
+# if !defined (__VMS) \
+ && (defined (__cplusplus) \
+ || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
+# include <stdint.h>
+ typedef uint64_t U64;
+# else
+ /* if compiler doesn't support unsigned long long, replace by another 64-bit type */
+ typedef unsigned long long U64;
+# endif
+#endif
+
+
+#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2))
+
+/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */
+static U64 XXH_read64(const void* memPtr) { return *(const U64*) memPtr; }
+
+#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1))
+
+/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */
+/* currently only defined for gcc and icc */
+typedef union { U32 u32; U64 u64; } __attribute__((packed)) unalign64;
+static U64 XXH_read64(const void* ptr) { return ((const unalign64*)ptr)->u64; }
+
+#else
+
+/* portable and safe solution. Generally efficient.
+ * see : http://stackoverflow.com/a/32095106/646947
+ */
+
+static U64 XXH_read64(const void* memPtr)
+{
+ U64 val;
+ memcpy(&val, memPtr, sizeof(val));
+ return val;
+}
+
+#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */
+
+#if defined(_MSC_VER) /* Visual Studio */
+# define XXH_swap64 _byteswap_uint64
+#elif XXH_GCC_VERSION >= 403
+# define XXH_swap64 __builtin_bswap64
+#else
+static U64 XXH_swap64 (U64 x)
+{
+ return ((x << 56) & 0xff00000000000000ULL) |
+ ((x << 40) & 0x00ff000000000000ULL) |
+ ((x << 24) & 0x0000ff0000000000ULL) |
+ ((x << 8) & 0x000000ff00000000ULL) |
+ ((x >> 8) & 0x00000000ff000000ULL) |
+ ((x >> 24) & 0x0000000000ff0000ULL) |
+ ((x >> 40) & 0x000000000000ff00ULL) |
+ ((x >> 56) & 0x00000000000000ffULL);
+}
+#endif
+
+FORCE_INLINE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align)
+{
+ if (align==XXH_unaligned)
+ return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr));
+ else
+ return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr);
+}
+
+FORCE_INLINE U64 XXH_readLE64(const void* ptr, XXH_endianess endian)
+{
+ return XXH_readLE64_align(ptr, endian, XXH_unaligned);
+}
+
+static U64 XXH_readBE64(const void* ptr)
+{
+ return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr);
+}
+
+
+/*====== xxh64 ======*/
+
+static const U64 PRIME64_1 = 11400714785074694791ULL; /* 0b1001111000110111011110011011000110000101111010111100101010000111 */
+static const U64 PRIME64_2 = 14029467366897019727ULL; /* 0b1100001010110010101011100011110100100111110101001110101101001111 */
+static const U64 PRIME64_3 = 1609587929392839161ULL; /* 0b0001011001010110011001111011000110011110001101110111100111111001 */
+static const U64 PRIME64_4 = 9650029242287828579ULL; /* 0b1000010111101011110010100111011111000010101100101010111001100011 */
+static const U64 PRIME64_5 = 2870177450012600261ULL; /* 0b0010011111010100111010110010111100010110010101100110011111000101 */
+
+static U64 XXH64_round(U64 acc, U64 input)
+{
+ acc += input * PRIME64_2;
+ acc = XXH_rotl64(acc, 31);
+ acc *= PRIME64_1;
+ return acc;
+}
+
+static U64 XXH64_mergeRound(U64 acc, U64 val)
+{
+ val = XXH64_round(0, val);
+ acc ^= val;
+ acc = acc * PRIME64_1 + PRIME64_4;
+ return acc;
+}
+
+static U64 XXH64_avalanche(U64 h64)
+{
+ h64 ^= h64 >> 33;
+ h64 *= PRIME64_2;
+ h64 ^= h64 >> 29;
+ h64 *= PRIME64_3;
+ h64 ^= h64 >> 32;
+ return h64;
+}
+
+
+#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align)
+
+static U64
+XXH64_finalize(U64 h64, const void* ptr, size_t len,
+ XXH_endianess endian, XXH_alignment align)
+{
+ const BYTE* p = (const BYTE*)ptr;
+
+#define PROCESS1_64 \
+ h64 ^= (*p++) * PRIME64_5; \
+ h64 = XXH_rotl64(h64, 11) * PRIME64_1;
+
+#define PROCESS4_64 \
+ h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1; \
+ p+=4; \
+ h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3;
+
+#define PROCESS8_64 { \
+ U64 const k1 = XXH64_round(0, XXH_get64bits(p)); \
+ p+=8; \
+ h64 ^= k1; \
+ h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; \
+}
+
+ switch(len&31) {
+ case 24: PROCESS8_64;
+ /* fallthrough */
+ case 16: PROCESS8_64;
+ /* fallthrough */
+ case 8: PROCESS8_64;
+ return XXH64_avalanche(h64);
+
+ case 28: PROCESS8_64;
+ /* fallthrough */
+ case 20: PROCESS8_64;
+ /* fallthrough */
+ case 12: PROCESS8_64;
+ /* fallthrough */
+ case 4: PROCESS4_64;
+ return XXH64_avalanche(h64);
+
+ case 25: PROCESS8_64;
+ /* fallthrough */
+ case 17: PROCESS8_64;
+ /* fallthrough */
+ case 9: PROCESS8_64;
+ PROCESS1_64;
+ return XXH64_avalanche(h64);
+
+ case 29: PROCESS8_64;
+ /* fallthrough */
+ case 21: PROCESS8_64;
+ /* fallthrough */
+ case 13: PROCESS8_64;
+ /* fallthrough */
+ case 5: PROCESS4_64;
+ PROCESS1_64;
+ return XXH64_avalanche(h64);
+
+ case 26: PROCESS8_64;
+ /* fallthrough */
+ case 18: PROCESS8_64;
+ /* fallthrough */
+ case 10: PROCESS8_64;
+ PROCESS1_64;
+ PROCESS1_64;
+ return XXH64_avalanche(h64);
+
+ case 30: PROCESS8_64;
+ /* fallthrough */
+ case 22: PROCESS8_64;
+ /* fallthrough */
+ case 14: PROCESS8_64;
+ /* fallthrough */
+ case 6: PROCESS4_64;
+ PROCESS1_64;
+ PROCESS1_64;
+ return XXH64_avalanche(h64);
+
+ case 27: PROCESS8_64;
+ /* fallthrough */
+ case 19: PROCESS8_64;
+ /* fallthrough */
+ case 11: PROCESS8_64;
+ PROCESS1_64;
+ PROCESS1_64;
+ PROCESS1_64;
+ return XXH64_avalanche(h64);
+
+ case 31: PROCESS8_64;
+ /* fallthrough */
+ case 23: PROCESS8_64;
+ /* fallthrough */
+ case 15: PROCESS8_64;
+ /* fallthrough */
+ case 7: PROCESS4_64;
+ /* fallthrough */
+ case 3: PROCESS1_64;
+ /* fallthrough */
+ case 2: PROCESS1_64;
+ /* fallthrough */
+ case 1: PROCESS1_64;
+ /* fallthrough */
+ case 0: return XXH64_avalanche(h64);
+ }
+
+ /* impossible to reach */
+ assert(0);
+ return 0; /* unreachable, but some compilers complain without it */
+}
+
+FORCE_INLINE U64
+XXH64_endian_align(const void* input, size_t len, U64 seed,
+ XXH_endianess endian, XXH_alignment align)
+{
+ const BYTE* p = (const BYTE*)input;
+ const BYTE* bEnd = p + len;
+ U64 h64;
+
+#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
+ if (p==NULL) {
+ len=0;
+ bEnd=p=(const BYTE*)(size_t)32;
+ }
+#endif
+
+ if (len>=32) {
+ const BYTE* const limit = bEnd - 32;
+ U64 v1 = seed + PRIME64_1 + PRIME64_2;
+ U64 v2 = seed + PRIME64_2;
+ U64 v3 = seed + 0;
+ U64 v4 = seed - PRIME64_1;
+
+ do {
+ v1 = XXH64_round(v1, XXH_get64bits(p)); p+=8;
+ v2 = XXH64_round(v2, XXH_get64bits(p)); p+=8;
+ v3 = XXH64_round(v3, XXH_get64bits(p)); p+=8;
+ v4 = XXH64_round(v4, XXH_get64bits(p)); p+=8;
+ } while (p<=limit);
+
+ h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18);
+ h64 = XXH64_mergeRound(h64, v1);
+ h64 = XXH64_mergeRound(h64, v2);
+ h64 = XXH64_mergeRound(h64, v3);
+ h64 = XXH64_mergeRound(h64, v4);
+
+ } else {
+ h64 = seed + PRIME64_5;
+ }
+
+ h64 += (U64) len;
+
+ return XXH64_finalize(h64, p, len, endian, align);
+}
+
+
+XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed)
+{
+#if 0
+ /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
+ XXH64_state_t state;
+ XXH64_reset(&state, seed);
+ XXH64_update(&state, input, len);
+ return XXH64_digest(&state);
+#else
+ XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
+
+ if (XXH_FORCE_ALIGN_CHECK) {
+ if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned);
+ else
+ return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned);
+ } }
+
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned);
+ else
+ return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned);
+#endif
+}
+
+/*====== Hash Streaming ======*/
+
+XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void)
+{
+ return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t));
+}
+XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr)
+{
+ XXH_free(statePtr);
+ return XXH_OK;
+}
+
+XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dstState, const XXH64_state_t* srcState)
+{
+ memcpy(dstState, srcState, sizeof(*dstState));
+}
+
+XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, unsigned long long seed)
+{
+ XXH64_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */
+ memset(&state, 0, sizeof(state));
+ state.v1 = seed + PRIME64_1 + PRIME64_2;
+ state.v2 = seed + PRIME64_2;
+ state.v3 = seed + 0;
+ state.v4 = seed - PRIME64_1;
+ /* do not write into reserved, planned to be removed in a future version */
+ memcpy(statePtr, &state, sizeof(state) - sizeof(state.reserved));
+ return XXH_OK;
+}
+
+FORCE_INLINE XXH_errorcode
+XXH64_update_endian (XXH64_state_t* state, const void* input, size_t len, XXH_endianess endian)
+{
+ if (input==NULL)
+#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
+ return XXH_OK;
+#else
+ return XXH_ERROR;
+#endif
+
+ { const BYTE* p = (const BYTE*)input;
+ const BYTE* const bEnd = p + len;
+
+ state->total_len += len;
+
+ if (state->memsize + len < 32) { /* fill in tmp buffer */
+ XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len);
+ state->memsize += (U32)len;
+ return XXH_OK;
+ }
+
+ if (state->memsize) { /* tmp buffer is full */
+ XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize);
+ state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0, endian));
+ state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1, endian));
+ state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2, endian));
+ state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3, endian));
+ p += 32-state->memsize;
+ state->memsize = 0;
+ }
+
+ if (p+32 <= bEnd) {
+ const BYTE* const limit = bEnd - 32;
+ U64 v1 = state->v1;
+ U64 v2 = state->v2;
+ U64 v3 = state->v3;
+ U64 v4 = state->v4;
+
+ do {
+ v1 = XXH64_round(v1, XXH_readLE64(p, endian)); p+=8;
+ v2 = XXH64_round(v2, XXH_readLE64(p, endian)); p+=8;
+ v3 = XXH64_round(v3, XXH_readLE64(p, endian)); p+=8;
+ v4 = XXH64_round(v4, XXH_readLE64(p, endian)); p+=8;
+ } while (p<=limit);
+
+ state->v1 = v1;
+ state->v2 = v2;
+ state->v3 = v3;
+ state->v4 = v4;
+ }
+
+ if (p < bEnd) {
+ XXH_memcpy(state->mem64, p, (size_t)(bEnd-p));
+ state->memsize = (unsigned)(bEnd-p);
+ }
+ }
+
+ return XXH_OK;
+}
+
+XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len)
+{
+ XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
+
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH64_update_endian(state_in, input, len, XXH_littleEndian);
+ else
+ return XXH64_update_endian(state_in, input, len, XXH_bigEndian);
+}
+
+FORCE_INLINE U64 XXH64_digest_endian (const XXH64_state_t* state, XXH_endianess endian)
+{
+ U64 h64;
+
+ if (state->total_len >= 32) {
+ U64 const v1 = state->v1;
+ U64 const v2 = state->v2;
+ U64 const v3 = state->v3;
+ U64 const v4 = state->v4;
+
+ h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18);
+ h64 = XXH64_mergeRound(h64, v1);
+ h64 = XXH64_mergeRound(h64, v2);
+ h64 = XXH64_mergeRound(h64, v3);
+ h64 = XXH64_mergeRound(h64, v4);
+ } else {
+ h64 = state->v3 /*seed*/ + PRIME64_5;
+ }
+
+ h64 += (U64) state->total_len;
+
+ return XXH64_finalize(h64, state->mem64, (size_t)state->total_len, endian, XXH_aligned);
+}
+
+XXH_PUBLIC_API unsigned long long XXH64_digest (const XXH64_state_t* state_in)
+{
+ XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN;
+
+ if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT)
+ return XXH64_digest_endian(state_in, XXH_littleEndian);
+ else
+ return XXH64_digest_endian(state_in, XXH_bigEndian);
+}
+
+
+/*====== Canonical representation ======*/
+
+XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash)
+{
+ XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t));
+ if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash);
+ memcpy(dst, &hash, sizeof(*dst));
+}
+
+XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src)
+{
+ return XXH_readBE64(src);
+}
+
+#endif /* XXH_NO_LONG_LONG */
diff --git a/gfx/angle/checkout/src/common/third_party/xxhash/xxhash.h b/gfx/angle/checkout/src/common/third_party/xxhash/xxhash.h
new file mode 100644
index 0000000000..0de203c947
--- /dev/null
+++ b/gfx/angle/checkout/src/common/third_party/xxhash/xxhash.h
@@ -0,0 +1,341 @@
+/*
+ xxHash - Extremely Fast Hash algorithm
+ Header File
+ Copyright (C) 2012-2016, Yann Collet.
+
+ BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ You can contact the author at :
+ - xxHash source repository : https://github.com/Cyan4973/xxHash
+*/
+
+/* Notice extracted from xxHash homepage :
+
+xxHash is an extremely fast Hash algorithm, running at RAM speed limits.
+It also successfully passes all tests from the SMHasher suite.
+
+Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz)
+
+Name Speed Q.Score Author
+xxHash 5.4 GB/s 10
+CrapWow 3.2 GB/s 2 Andrew
+MumurHash 3a 2.7 GB/s 10 Austin Appleby
+SpookyHash 2.0 GB/s 10 Bob Jenkins
+SBox 1.4 GB/s 9 Bret Mulvey
+Lookup3 1.2 GB/s 9 Bob Jenkins
+SuperFastHash 1.2 GB/s 1 Paul Hsieh
+CityHash64 1.05 GB/s 10 Pike & Alakuijala
+FNV 0.55 GB/s 5 Fowler, Noll, Vo
+CRC32 0.43 GB/s 9
+MD5-32 0.33 GB/s 10 Ronald L. Rivest
+SHA1-32 0.28 GB/s 10
+
+Q.Score is a measure of quality of the hash function.
+It depends on successfully passing SMHasher test set.
+10 is a perfect score.
+
+A 64-bit version, named XXH64, is available since r35.
+It offers much better speed, but for 64-bit applications only.
+Name Speed on 64 bits Speed on 32 bits
+XXH64 13.8 GB/s 1.9 GB/s
+XXH32 6.8 GB/s 6.0 GB/s
+*/
+
+#ifndef XXHASH_H_5627135585666179
+#define XXHASH_H_5627135585666179 1
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* ****************************
+ * Definitions
+ ******************************/
+#include <stddef.h> /* size_t */
+typedef enum
+{
+ XXH_OK = 0,
+ XXH_ERROR
+} XXH_errorcode;
+
+/* ****************************
+ * API modifier
+ ******************************/
+/** XXH_INLINE_ALL (and XXH_PRIVATE_API)
+ * This is useful to include xxhash functions in `static` mode
+ * in order to inline them, and remove their symbol from the public list.
+ * Inlining can offer dramatic performance improvement on small keys.
+ * Methodology :
+ * #define XXH_INLINE_ALL
+ * #include "xxhash.h"
+ * `xxhash.c` is automatically included.
+ * It's not useful to compile and link it as a separate module.
+ */
+#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)
+# ifndef XXH_STATIC_LINKING_ONLY
+# define XXH_STATIC_LINKING_ONLY
+# endif
+# if defined(__GNUC__)
+# define XXH_PUBLIC_API static __inline __attribute__((unused))
+#elif defined(__cplusplus) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 \
+ */)
+# define XXH_PUBLIC_API static inline
+# elif defined(_MSC_VER)
+# define XXH_PUBLIC_API static __inline
+# else
+/* this version may generate warnings for unused static functions */
+# define XXH_PUBLIC_API static
+# endif
+#else
+# define XXH_PUBLIC_API /* do nothing */
+#endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */
+
+/*! XXH_NAMESPACE, aka Namespace Emulation :
+ *
+ * If you want to include _and expose_ xxHash functions from within your own library,
+ * but also want to avoid symbol collisions with other libraries which may also include xxHash,
+ *
+ * you can use XXH_NAMESPACE, to automatically prefix any public symbol from xxhash library
+ * with the value of XXH_NAMESPACE (therefore, avoid NULL and numeric values).
+ *
+ * Note that no change is required within the calling program as long as it includes `xxhash.h` :
+ * regular symbol name will be automatically translated by this header.
+ */
+#ifdef XXH_NAMESPACE
+# define XXH_CAT(A, B) A##B
+# define XXH_NAME2(A, B) XXH_CAT(A, B)
+# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber)
+# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32)
+# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState)
+# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState)
+# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset)
+# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update)
+# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest)
+# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState)
+# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash)
+# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical)
+# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64)
+# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState)
+# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState)
+# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
+# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
+# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest)
+# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState)
+# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash)
+# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical)
+#endif
+
+/* *************************************
+ * Version
+ ***************************************/
+#define XXH_VERSION_MAJOR 0
+#define XXH_VERSION_MINOR 6
+#define XXH_VERSION_RELEASE 5
+#define XXH_VERSION_NUMBER \
+ (XXH_VERSION_MAJOR * 100 * 100 + XXH_VERSION_MINOR * 100 + XXH_VERSION_RELEASE)
+XXH_PUBLIC_API unsigned XXH_versionNumber(void);
+
+/*-**********************************************************************
+ * 32-bit hash
+ ************************************************************************/
+typedef unsigned int XXH32_hash_t;
+
+/*! XXH32() :
+ Calculate the 32-bit hash of sequence "length" bytes stored at memory address "input".
+ The memory between input & input+length must be valid (allocated and read-accessible).
+ "seed" can be used to alter the result predictably.
+ Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s */
+XXH_PUBLIC_API XXH32_hash_t XXH32(const void *input, size_t length, unsigned int seed);
+
+/*====== Streaming ======*/
+typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */
+XXH_PUBLIC_API XXH32_state_t *XXH32_createState(void);
+XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t *statePtr);
+XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t *dst_state, const XXH32_state_t *src_state);
+
+XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t *statePtr, unsigned int seed);
+XXH_PUBLIC_API XXH_errorcode XXH32_update(XXH32_state_t *statePtr,
+ const void *input,
+ size_t length);
+XXH_PUBLIC_API XXH32_hash_t XXH32_digest(const XXH32_state_t *statePtr);
+
+/*
+ * Streaming functions generate the xxHash of an input provided in multiple segments.
+ * Note that, for small input, they are slower than single-call functions, due to state
+ * management. For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized.
+ *
+ * XXH state must first be allocated, using XXH*_createState() .
+ *
+ * Start a new hash by initializing state with a seed, using XXH*_reset().
+ *
+ * Then, feed the hash state by calling XXH*_update() as many times as necessary.
+ * The function returns an error code, with 0 meaning OK, and any other value meaning there is
+ * an error.
+ *
+ * Finally, a hash value can be produced anytime, by using XXH*_digest().
+ * This function returns the nn-bits hash as an int or long long.
+ *
+ * It's still possible to continue inserting input into the hash state after a digest,
+ * and generate some new hashes later on, by calling again XXH*_digest().
+ *
+ * When done, free XXH state space if it was allocated dynamically.
+ */
+
+/*====== Canonical representation ======*/
+
+typedef struct
+{
+ unsigned char digest[4];
+} XXH32_canonical_t;
+XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t *dst, XXH32_hash_t hash);
+XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t *src);
+
+/* Default result type for XXH functions are primitive unsigned 32 and 64 bits.
+ * The canonical representation uses human-readable write convention, aka big-endian (large
+ * digits first). These functions allow transformation of hash result into and from its
+ * canonical format. This way, hash values can be written into a file / memory, and remain
+ * comparable on different systems and programs.
+ */
+
+#ifndef XXH_NO_LONG_LONG
+/*-**********************************************************************
+ * 64-bit hash
+ ************************************************************************/
+typedef unsigned long long XXH64_hash_t;
+
+/*! XXH64() :
+ Calculate the 64-bit hash of sequence of length "len" stored at memory address "input".
+ "seed" can be used to alter the result predictably.
+ This function runs faster on 64-bit systems, but slower on 32-bit systems (see benchmark).
+*/
+XXH_PUBLIC_API XXH64_hash_t XXH64(const void *input, size_t length, unsigned long long seed);
+
+/*====== Streaming ======*/
+typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */
+XXH_PUBLIC_API XXH64_state_t *XXH64_createState(void);
+XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t *statePtr);
+XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t *dst_state, const XXH64_state_t *src_state);
+
+XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t *statePtr, unsigned long long seed);
+XXH_PUBLIC_API XXH_errorcode XXH64_update(XXH64_state_t *statePtr,
+ const void *input,
+ size_t length);
+XXH_PUBLIC_API XXH64_hash_t XXH64_digest(const XXH64_state_t *statePtr);
+
+/*====== Canonical representation ======*/
+typedef struct
+{
+ unsigned char digest[8];
+} XXH64_canonical_t;
+XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t *dst, XXH64_hash_t hash);
+XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t *src);
+#endif /* XXH_NO_LONG_LONG */
+
+#ifdef XXH_STATIC_LINKING_ONLY
+
+/* ================================================================================================
+ This section contains declarations which are not guaranteed to remain stable.
+ They may change in future versions, becoming incompatible with a different version of the
+library. These declarations should only be used with static linking. Never use them in
+association with dynamic linking !
+===================================================================================================
+*/
+
+/* These definitions are only present to allow
+ * static allocation of XXH state, on stack or in a struct for example.
+ * Never **ever** use members directly. */
+
+# if !defined(__VMS) && (defined(__cplusplus) || (defined(__STDC_VERSION__) && \
+ (__STDC_VERSION__ >= 199901L) /* C99 */))
+# include <stdint.h>
+
+struct XXH32_state_s
+{
+ uint32_t total_len_32;
+ uint32_t large_len;
+ uint32_t v1;
+ uint32_t v2;
+ uint32_t v3;
+ uint32_t v4;
+ uint32_t mem32[4];
+ uint32_t memsize;
+ uint32_t reserved; /* never read nor write, might be removed in a future version */
+}; /* typedef'd to XXH32_state_t */
+
+struct XXH64_state_s
+{
+ uint64_t total_len;
+ uint64_t v1;
+ uint64_t v2;
+ uint64_t v3;
+ uint64_t v4;
+ uint64_t mem64[4];
+ uint32_t memsize;
+ uint32_t reserved[2]; /* never read nor write, might be removed in a future version */
+}; /* typedef'd to XXH64_state_t */
+
+# else
+
+struct XXH32_state_s
+{
+ unsigned total_len_32;
+ unsigned large_len;
+ unsigned v1;
+ unsigned v2;
+ unsigned v3;
+ unsigned v4;
+ unsigned mem32[4];
+ unsigned memsize;
+ unsigned reserved; /* never read nor write, might be removed in a future version */
+}; /* typedef'd to XXH32_state_t */
+
+# ifndef XXH_NO_LONG_LONG /* remove 64-bit support */
+struct XXH64_state_s
+{
+ unsigned long long total_len;
+ unsigned long long v1;
+ unsigned long long v2;
+ unsigned long long v3;
+ unsigned long long v4;
+ unsigned long long mem64[4];
+ unsigned memsize;
+ unsigned reserved[2]; /* never read nor write, might be removed in a future version */
+}; /* typedef'd to XXH64_state_t */
+# endif
+
+# endif
+
+# if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)
+# include "xxhash.c" /* include xxhash function bodies as `static`, for inlining */
+# endif
+
+#endif /* XXH_STATIC_LINKING_ONLY */
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* XXHASH_H_5627135585666179 */
diff --git a/gfx/angle/checkout/src/common/tls.cpp b/gfx/angle/checkout/src/common/tls.cpp
new file mode 100644
index 0000000000..20977f48cf
--- /dev/null
+++ b/gfx/angle/checkout/src/common/tls.cpp
@@ -0,0 +1,157 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// tls.cpp: Simple cross-platform interface for thread local storage.
+
+#include "common/tls.h"
+
+#include <assert.h>
+
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+# include <map>
+# include <mutex>
+# include <set>
+# include <vector>
+
+# include <Windows.System.Threading.h>
+# include <wrl/async.h>
+# include <wrl/client.h>
+
+using namespace std;
+using namespace Windows::Foundation;
+using namespace ABI::Windows::System::Threading;
+
+// Thread local storage for Windows Store support
+typedef vector<void *> ThreadLocalData;
+
+static __declspec(thread) ThreadLocalData *currentThreadData = nullptr;
+static set<ThreadLocalData *> allThreadData;
+static DWORD nextTlsIndex = 0;
+static vector<DWORD> freeTlsIndices;
+
+#endif
+
+TLSIndex CreateTLSIndex()
+{
+ TLSIndex index;
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+# ifdef ANGLE_ENABLE_WINDOWS_STORE
+ if (!freeTlsIndices.empty())
+ {
+ DWORD result = freeTlsIndices.back();
+ freeTlsIndices.pop_back();
+ index = result;
+ }
+ else
+ {
+ index = nextTlsIndex++;
+ }
+# else
+ index = TlsAlloc();
+# endif
+
+#elif defined(ANGLE_PLATFORM_POSIX)
+ // Create global pool key
+ if ((pthread_key_create(&index, nullptr)) != 0)
+ {
+ index = TLS_INVALID_INDEX;
+ }
+#endif
+
+ assert(index != TLS_INVALID_INDEX &&
+ "CreateTLSIndex(): Unable to allocate Thread Local Storage");
+ return index;
+}
+
+bool DestroyTLSIndex(TLSIndex index)
+{
+ assert(index != TLS_INVALID_INDEX && "DestroyTLSIndex(): Invalid TLS Index");
+ if (index == TLS_INVALID_INDEX)
+ {
+ return false;
+ }
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+# ifdef ANGLE_ENABLE_WINDOWS_STORE
+ assert(index < nextTlsIndex);
+ assert(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end());
+
+ freeTlsIndices.push_back(index);
+ for (auto threadData : allThreadData)
+ {
+ if (threadData->size() > index)
+ {
+ threadData->at(index) = nullptr;
+ }
+ }
+ return true;
+# else
+ return (TlsFree(index) == TRUE);
+# endif
+#elif defined(ANGLE_PLATFORM_POSIX)
+ return (pthread_key_delete(index) == 0);
+#endif
+}
+
+bool SetTLSValue(TLSIndex index, void *value)
+{
+ assert(index != TLS_INVALID_INDEX && "SetTLSValue(): Invalid TLS Index");
+ if (index == TLS_INVALID_INDEX)
+ {
+ return false;
+ }
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+# ifdef ANGLE_ENABLE_WINDOWS_STORE
+ ThreadLocalData *threadData = currentThreadData;
+ if (!threadData)
+ {
+ threadData = new ThreadLocalData(index + 1, nullptr);
+ allThreadData.insert(threadData);
+ currentThreadData = threadData;
+ }
+ else if (threadData->size() <= index)
+ {
+ threadData->resize(index + 1, nullptr);
+ }
+
+ threadData->at(index) = value;
+ return true;
+# else
+ return (TlsSetValue(index, value) == TRUE);
+# endif
+#elif defined(ANGLE_PLATFORM_POSIX)
+ return (pthread_setspecific(index, value) == 0);
+#endif
+}
+
+void *GetTLSValue(TLSIndex index)
+{
+ assert(index != TLS_INVALID_INDEX && "GetTLSValue(): Invalid TLS Index");
+ if (index == TLS_INVALID_INDEX)
+ {
+ return nullptr;
+ }
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+# ifdef ANGLE_ENABLE_WINDOWS_STORE
+ ThreadLocalData *threadData = currentThreadData;
+ if (threadData && threadData->size() > index)
+ {
+ return threadData->at(index);
+ }
+ else
+ {
+ return nullptr;
+ }
+# else
+ return TlsGetValue(index);
+# endif
+#elif defined(ANGLE_PLATFORM_POSIX)
+ return pthread_getspecific(index);
+#endif
+}
diff --git a/gfx/angle/checkout/src/common/tls.h b/gfx/angle/checkout/src/common/tls.h
new file mode 100644
index 0000000000..33c776adc5
--- /dev/null
+++ b/gfx/angle/checkout/src/common/tls.h
@@ -0,0 +1,46 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// tls.h: Simple cross-platform interface for thread local storage.
+
+#ifndef COMMON_TLS_H_
+#define COMMON_TLS_H_
+
+#include "common/platform.h"
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+
+// TLS does not exist for Windows Store and needs to be emulated
+# ifdef ANGLE_ENABLE_WINDOWS_STORE
+# ifndef TLS_OUT_OF_INDEXES
+# define TLS_OUT_OF_INDEXES static_cast<DWORD>(0xFFFFFFFF)
+# endif
+# ifndef CREATE_SUSPENDED
+# define CREATE_SUSPENDED 0x00000004
+# endif
+# endif
+typedef DWORD TLSIndex;
+# define TLS_INVALID_INDEX (TLS_OUT_OF_INDEXES)
+#elif defined(ANGLE_PLATFORM_POSIX)
+# include <errno.h>
+# include <pthread.h>
+# include <semaphore.h>
+typedef pthread_key_t TLSIndex;
+# define TLS_INVALID_INDEX (static_cast<TLSIndex>(-1))
+#else
+# error Unsupported platform.
+#endif
+
+// TODO(kbr): for POSIX platforms this will have to be changed to take
+// in a destructor function pointer, to allow the thread-local storage
+// to be properly deallocated upon thread exit.
+TLSIndex CreateTLSIndex();
+bool DestroyTLSIndex(TLSIndex index);
+
+bool SetTLSValue(TLSIndex index, void *value);
+void *GetTLSValue(TLSIndex index);
+
+#endif // COMMON_TLS_H_
diff --git a/gfx/angle/checkout/src/common/uniform_type_info_autogen.cpp b/gfx/angle/checkout/src/common/uniform_type_info_autogen.cpp
new file mode 100644
index 0000000000..58a67fe475
--- /dev/null
+++ b/gfx/angle/checkout/src/common/uniform_type_info_autogen.cpp
@@ -0,0 +1,318 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_uniform_type_table.py.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Uniform type info table:
+// Metadata about a particular uniform format, indexed by GL type.
+
+#include <array>
+#include "common/utilities.h"
+
+using namespace angle;
+
+namespace gl
+{
+
+namespace
+{
+constexpr std::array<UniformTypeInfo, 62> kInfoTable = {
+ {{GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 0, 0, 0, 0, 0 * 0,
+ 0 * 0, false, false, false, ""},
+ {GL_BOOL, GL_BOOL, GL_NONE, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, false, ""},
+ {GL_BOOL_VEC2, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC2, SamplerFormat::InvalidEnum, 1, 2, 2,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false, ""},
+ {GL_BOOL_VEC3, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC3, SamplerFormat::InvalidEnum, 1, 3, 3,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false, ""},
+ {GL_BOOL_VEC4, GL_BOOL, GL_NONE, GL_NONE, GL_BOOL_VEC4, SamplerFormat::InvalidEnum, 1, 4, 4,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false, ""},
+ {GL_FLOAT, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL, SamplerFormat::InvalidEnum, 1, 1, 1,
+ sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 1, false, false, false, ""},
+ {GL_FLOAT_MAT2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2, GL_NONE, SamplerFormat::InvalidEnum, 2, 2, 4,
+ sizeof(GLfloat), sizeof(GLfloat) * 8, sizeof(GLfloat) * 4, false, true, false, ""},
+ {GL_FLOAT_MAT2x3, GL_FLOAT, GL_NONE, GL_FLOAT_MAT3x2, GL_NONE, SamplerFormat::InvalidEnum, 3,
+ 2, 6, sizeof(GLfloat), sizeof(GLfloat) * 12, sizeof(GLfloat) * 6, false, true, false, ""},
+ {GL_FLOAT_MAT2x4, GL_FLOAT, GL_NONE, GL_FLOAT_MAT4x2, GL_NONE, SamplerFormat::InvalidEnum, 4,
+ 2, 8, sizeof(GLfloat), sizeof(GLfloat) * 16, sizeof(GLfloat) * 8, false, true, false, ""},
+ {GL_FLOAT_MAT3, GL_FLOAT, GL_NONE, GL_FLOAT_MAT3, GL_NONE, SamplerFormat::InvalidEnum, 3, 3, 9,
+ sizeof(GLfloat), sizeof(GLfloat) * 12, sizeof(GLfloat) * 9, false, true, false, ""},
+ {GL_FLOAT_MAT3x2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2x3, GL_NONE, SamplerFormat::InvalidEnum, 2,
+ 3, 6, sizeof(GLfloat), sizeof(GLfloat) * 8, sizeof(GLfloat) * 6, false, true, false, ""},
+ {GL_FLOAT_MAT3x4, GL_FLOAT, GL_NONE, GL_FLOAT_MAT4x3, GL_NONE, SamplerFormat::InvalidEnum, 4,
+ 3, 12, sizeof(GLfloat), sizeof(GLfloat) * 16, sizeof(GLfloat) * 12, false, true, false, ""},
+ {GL_FLOAT_MAT4, GL_FLOAT, GL_NONE, GL_FLOAT_MAT4, GL_NONE, SamplerFormat::InvalidEnum, 4, 4,
+ 16, sizeof(GLfloat), sizeof(GLfloat) * 16, sizeof(GLfloat) * 16, false, true, false, ""},
+ {GL_FLOAT_MAT4x2, GL_FLOAT, GL_NONE, GL_FLOAT_MAT2x4, GL_NONE, SamplerFormat::InvalidEnum, 2,
+ 4, 8, sizeof(GLfloat), sizeof(GLfloat) * 8, sizeof(GLfloat) * 8, false, true, false, ""},
+ {GL_FLOAT_MAT4x3, GL_FLOAT, GL_NONE, GL_FLOAT_MAT3x4, GL_NONE, SamplerFormat::InvalidEnum, 3,
+ 4, 12, sizeof(GLfloat), sizeof(GLfloat) * 12, sizeof(GLfloat) * 12, false, true, false, ""},
+ {GL_FLOAT_VEC2, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC2, SamplerFormat::InvalidEnum, 1, 2, 2,
+ sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 2, false, false, false, ""},
+ {GL_FLOAT_VEC3, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC3, SamplerFormat::InvalidEnum, 1, 3, 3,
+ sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 3, false, false, false, ""},
+ {GL_FLOAT_VEC4, GL_FLOAT, GL_NONE, GL_NONE, GL_BOOL_VEC4, SamplerFormat::InvalidEnum, 1, 4, 4,
+ sizeof(GLfloat), sizeof(GLfloat) * 4, sizeof(GLfloat) * 4, false, false, false, ""},
+ {GL_IMAGE_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
+ {GL_IMAGE_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum,
+ 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true,
+ "intBitsToFloat"},
+ {GL_IMAGE_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
+ {GL_IMAGE_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1,
+ 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true,
+ "intBitsToFloat"},
+ {GL_INT, GL_INT, GL_NONE, GL_NONE, GL_BOOL, SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLint),
+ sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, false, "intBitsToFloat"},
+ {GL_INT_IMAGE_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
+ {GL_INT_IMAGE_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE,
+ SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1,
+ false, false, true, "intBitsToFloat"},
+ {GL_INT_IMAGE_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true, "intBitsToFloat"},
+ {GL_INT_IMAGE_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, SamplerFormat::InvalidEnum,
+ 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, false, false, true,
+ "intBitsToFloat"},
+ {GL_INT_SAMPLER_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::Signed, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
+ {GL_INT_SAMPLER_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, SamplerFormat::Signed,
+ 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
+ "intBitsToFloat"},
+ {GL_INT_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE,
+ SamplerFormat::Signed, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
+ false, false, "intBitsToFloat"},
+ {GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_INT, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE,
+ GL_NONE, SamplerFormat::Signed, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1,
+ true, false, false, "intBitsToFloat"},
+ {GL_INT_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, SamplerFormat::Signed, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
+ {GL_INT_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, SamplerFormat::Signed, 1,
+ 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
+ "intBitsToFloat"},
+ {GL_INT_VEC2, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC2, SamplerFormat::InvalidEnum, 1, 2, 2,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 2, false, false, false, "intBitsToFloat"},
+ {GL_INT_VEC3, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3, SamplerFormat::InvalidEnum, 1, 3, 3,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 3, false, false, false, "intBitsToFloat"},
+ {GL_INT_VEC4, GL_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4, SamplerFormat::InvalidEnum, 1, 4, 4,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 4, false, false, false, "intBitsToFloat"},
+ {GL_SAMPLER_2D, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
+ {GL_SAMPLER_2D_ARRAY, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE, SamplerFormat::Float, 1,
+ 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
+ "intBitsToFloat"},
+ {GL_SAMPLER_2D_ARRAY_SHADOW, GL_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE,
+ SamplerFormat::Shadow, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
+ false, false, "intBitsToFloat"},
+ {GL_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE,
+ SamplerFormat::Float, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
+ false, false, "intBitsToFloat"},
+ {GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_INT, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE, GL_NONE,
+ SamplerFormat::Float, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
+ false, false, "intBitsToFloat"},
+ {GL_SAMPLER_2D_RECT_ANGLE, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1,
+ 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
+ {GL_SAMPLER_2D_SHADOW, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, SamplerFormat::Shadow, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
+ {GL_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
+ {GL_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, SamplerFormat::Float, 1, 1, 1,
+ sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false, "intBitsToFloat"},
+ {GL_SAMPLER_CUBE_SHADOW, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, SamplerFormat::Shadow,
+ 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false,
+ "intBitsToFloat"},
+ {GL_SAMPLER_EXTERNAL_OES, GL_INT, GL_TEXTURE_EXTERNAL_OES, GL_NONE, GL_NONE,
+ SamplerFormat::Float, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true,
+ false, false, "intBitsToFloat"},
+ {GL_UNSIGNED_INT, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL, SamplerFormat::InvalidEnum, 1, 1,
+ 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, false, false, false,
+ "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_ATOMIC_COUNTER, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_NONE,
+ SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ false, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_IMAGE_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE,
+ SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ false, false, true, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_IMAGE_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE,
+ SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ false, false, true, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_IMAGE_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE,
+ SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ false, false, true, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_IMAGE_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE,
+ SamplerFormat::InvalidEnum, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ false, false, true, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_SAMPLER_2D, GL_UNSIGNED_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE,
+ SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ true, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GL_UNSIGNED_INT, GL_TEXTURE_2D_ARRAY, GL_NONE, GL_NONE,
+ SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ true, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GL_UNSIGNED_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE,
+ GL_NONE, SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4,
+ sizeof(GLuint) * 1, true, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_UNSIGNED_INT,
+ GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE, GL_NONE, SamplerFormat::Unsigned, 1, 1, 1,
+ sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false,
+ "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_SAMPLER_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE,
+ SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ true, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_SAMPLER_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE,
+ SamplerFormat::Unsigned, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1,
+ true, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC2,
+ SamplerFormat::InvalidEnum, 1, 2, 2, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 2,
+ false, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC3,
+ SamplerFormat::InvalidEnum, 1, 3, 3, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 3,
+ false, false, false, "uintBitsToFloat"},
+ {GL_UNSIGNED_INT_VEC4, GL_UNSIGNED_INT, GL_NONE, GL_NONE, GL_BOOL_VEC4,
+ SamplerFormat::InvalidEnum, 1, 4, 4, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 4,
+ false, false, false, "uintBitsToFloat"}}};
+
+size_t GetTypeInfoIndex(GLenum uniformType)
+{
+ switch (uniformType)
+ {
+ case GL_NONE:
+ return 0;
+ case GL_BOOL:
+ return 1;
+ case GL_BOOL_VEC2:
+ return 2;
+ case GL_BOOL_VEC3:
+ return 3;
+ case GL_BOOL_VEC4:
+ return 4;
+ case GL_FLOAT:
+ return 5;
+ case GL_FLOAT_MAT2:
+ return 6;
+ case GL_FLOAT_MAT2x3:
+ return 7;
+ case GL_FLOAT_MAT2x4:
+ return 8;
+ case GL_FLOAT_MAT3:
+ return 9;
+ case GL_FLOAT_MAT3x2:
+ return 10;
+ case GL_FLOAT_MAT3x4:
+ return 11;
+ case GL_FLOAT_MAT4:
+ return 12;
+ case GL_FLOAT_MAT4x2:
+ return 13;
+ case GL_FLOAT_MAT4x3:
+ return 14;
+ case GL_FLOAT_VEC2:
+ return 15;
+ case GL_FLOAT_VEC3:
+ return 16;
+ case GL_FLOAT_VEC4:
+ return 17;
+ case GL_IMAGE_2D:
+ return 18;
+ case GL_IMAGE_2D_ARRAY:
+ return 19;
+ case GL_IMAGE_3D:
+ return 20;
+ case GL_IMAGE_CUBE:
+ return 21;
+ case GL_INT:
+ return 22;
+ case GL_INT_IMAGE_2D:
+ return 23;
+ case GL_INT_IMAGE_2D_ARRAY:
+ return 24;
+ case GL_INT_IMAGE_3D:
+ return 25;
+ case GL_INT_IMAGE_CUBE:
+ return 26;
+ case GL_INT_SAMPLER_2D:
+ return 27;
+ case GL_INT_SAMPLER_2D_ARRAY:
+ return 28;
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ return 29;
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ return 30;
+ case GL_INT_SAMPLER_3D:
+ return 31;
+ case GL_INT_SAMPLER_CUBE:
+ return 32;
+ case GL_INT_VEC2:
+ return 33;
+ case GL_INT_VEC3:
+ return 34;
+ case GL_INT_VEC4:
+ return 35;
+ case GL_SAMPLER_2D:
+ return 36;
+ case GL_SAMPLER_2D_ARRAY:
+ return 37;
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ return 38;
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ return 39;
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ return 40;
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ return 41;
+ case GL_SAMPLER_2D_SHADOW:
+ return 42;
+ case GL_SAMPLER_3D:
+ return 43;
+ case GL_SAMPLER_CUBE:
+ return 44;
+ case GL_SAMPLER_CUBE_SHADOW:
+ return 45;
+ case GL_SAMPLER_EXTERNAL_OES:
+ return 46;
+ case GL_UNSIGNED_INT:
+ return 47;
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ return 48;
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ return 49;
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ return 50;
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ return 51;
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ return 52;
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ return 53;
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ return 54;
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ return 55;
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ return 56;
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ return 57;
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ return 58;
+ case GL_UNSIGNED_INT_VEC2:
+ return 59;
+ case GL_UNSIGNED_INT_VEC3:
+ return 60;
+ case GL_UNSIGNED_INT_VEC4:
+ return 61;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+} // anonymous namespace
+
+const UniformTypeInfo &GetUniformTypeInfo(GLenum uniformType)
+{
+ ASSERT(kInfoTable[GetTypeInfoIndex(uniformType)].type == uniformType);
+ return kInfoTable[GetTypeInfoIndex(uniformType)];
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/common/utilities.cpp b/gfx/angle/checkout/src/common/utilities.cpp
new file mode 100644
index 0000000000..ea18cb356d
--- /dev/null
+++ b/gfx/angle/checkout/src/common/utilities.cpp
@@ -0,0 +1,1110 @@
+//
+// 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 <GLSLANG/ShaderVars.h>
+#include "common/mathutil.h"
+#include "common/platform.h"
+
+#include <set>
+
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+# include <windows.applicationmodel.core.h>
+# include <windows.graphics.display.h>
+# include <wrl.h>
+# include <wrl/wrappers/corewrappers.h>
+#endif
+
+namespace
+{
+
+template <class IndexType>
+gl::IndexRange ComputeTypedIndexRange(const IndexType *indices,
+ size_t count,
+ bool primitiveRestartEnabled,
+ GLuint primitiveRestartIndex)
+{
+ ASSERT(count > 0);
+
+ IndexType minIndex = 0;
+ IndexType maxIndex = 0;
+ size_t nonPrimitiveRestartIndices = 0;
+
+ if (primitiveRestartEnabled)
+ {
+ // Find the first non-primitive restart index to initialize the min and max values
+ size_t i = 0;
+ for (; i < count; i++)
+ {
+ if (indices[i] != primitiveRestartIndex)
+ {
+ minIndex = indices[i];
+ maxIndex = indices[i];
+ nonPrimitiveRestartIndices++;
+ break;
+ }
+ }
+
+ // Loop over the rest of the indices
+ for (; i < count; i++)
+ {
+ if (indices[i] != primitiveRestartIndex)
+ {
+ if (minIndex > indices[i])
+ {
+ minIndex = indices[i];
+ }
+ if (maxIndex < indices[i])
+ {
+ maxIndex = indices[i];
+ }
+ nonPrimitiveRestartIndices++;
+ }
+ }
+ }
+ else
+ {
+ minIndex = indices[0];
+ maxIndex = indices[0];
+ nonPrimitiveRestartIndices = count;
+
+ for (size_t i = 1; i < count; i++)
+ {
+ if (minIndex > indices[i])
+ {
+ minIndex = indices[i];
+ }
+ if (maxIndex < indices[i])
+ {
+ maxIndex = indices[i];
+ }
+ }
+ }
+
+ return gl::IndexRange(static_cast<size_t>(minIndex), static_cast<size_t>(maxIndex),
+ nonPrimitiveRestartIndices);
+}
+
+} // anonymous namespace
+
+namespace gl
+{
+
+int VariableComponentCount(GLenum type)
+{
+ return VariableRowCount(type) * VariableColumnCount(type);
+}
+
+GLenum VariableComponentType(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_2D_RECT_ANGLE:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_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_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_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:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ 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 VariableComponentSize(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 VariableInternalSize(GLenum type)
+{
+ // Expanded to 4-element vectors
+ return VariableComponentSize(VariableComponentType(type)) * VariableRowCount(type) * 4;
+}
+
+size_t VariableExternalSize(GLenum type)
+{
+ return VariableComponentSize(VariableComponentType(type)) * VariableComponentCount(type);
+}
+
+GLenum VariableBoolVectorType(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:
+ 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_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_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_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ 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:
+ 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_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ 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_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ 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 IsSamplerType(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_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_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ return true;
+ }
+
+ return false;
+}
+
+bool IsImageType(GLenum type)
+{
+ switch (type)
+ {
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ return true;
+ }
+ return false;
+}
+
+bool IsImage2DType(GLenum type)
+{
+ switch (type)
+ {
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ return true;
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ return false;
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool IsAtomicCounterType(GLenum type)
+{
+ return type == GL_UNSIGNED_INT_ATOMIC_COUNTER;
+}
+
+bool IsOpaqueType(GLenum type)
+{
+ // ESSL 3.10 section 4.1.7 defines opaque types as: samplers, images and atomic counters.
+ return IsImageType(type) || IsSamplerType(type) || IsAtomicCounterType(type);
+}
+
+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 VariableRegisterCount(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;
+}
+
+IndexRange ComputeIndexRange(DrawElementsType indexType,
+ const GLvoid *indices,
+ size_t count,
+ bool primitiveRestartEnabled)
+{
+ switch (indexType)
+ {
+ case DrawElementsType::UnsignedByte:
+ return ComputeTypedIndexRange(static_cast<const GLubyte *>(indices), count,
+ primitiveRestartEnabled,
+ GetPrimitiveRestartIndex(indexType));
+ case DrawElementsType::UnsignedShort:
+ return ComputeTypedIndexRange(static_cast<const GLushort *>(indices), count,
+ primitiveRestartEnabled,
+ GetPrimitiveRestartIndex(indexType));
+ case DrawElementsType::UnsignedInt:
+ return ComputeTypedIndexRange(static_cast<const GLuint *>(indices), count,
+ primitiveRestartEnabled,
+ GetPrimitiveRestartIndex(indexType));
+ default:
+ UNREACHABLE();
+ return IndexRange();
+ }
+}
+
+GLuint GetPrimitiveRestartIndex(DrawElementsType indexType)
+{
+ switch (indexType)
+ {
+ case DrawElementsType::UnsignedByte:
+ return 0xFF;
+ case DrawElementsType::UnsignedShort:
+ return 0xFFFF;
+ case DrawElementsType::UnsignedInt:
+ return 0xFFFFFFFF;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+bool IsTriangleMode(PrimitiveMode drawMode)
+{
+ switch (drawMode)
+ {
+ case PrimitiveMode::Triangles:
+ case PrimitiveMode::TriangleFan:
+ case PrimitiveMode::TriangleStrip:
+ return true;
+ case PrimitiveMode::Points:
+ case PrimitiveMode::Lines:
+ case PrimitiveMode::LineLoop:
+ case PrimitiveMode::LineStrip:
+ return false;
+ default:
+ UNREACHABLE();
+ }
+
+ return false;
+}
+
+namespace priv
+{
+const angle::PackedEnumMap<PrimitiveMode, bool> gLineModes = {
+ {{PrimitiveMode::LineLoop, true},
+ {PrimitiveMode::LineStrip, true},
+ {PrimitiveMode::LineStripAdjacency, true},
+ {PrimitiveMode::Lines, true}}};
+} // namespace priv
+
+bool IsIntegerFormat(GLenum unsizedFormat)
+{
+ switch (unsizedFormat)
+ {
+ case GL_RGBA_INTEGER:
+ case GL_RGB_INTEGER:
+ case GL_RG_INTEGER:
+ case GL_RED_INTEGER:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+// [OpenGL ES SL 3.00.4] Section 11 p. 120
+// Vertex Outs/Fragment Ins packing priorities
+int VariableSortOrder(GLenum type)
+{
+ switch (type)
+ {
+ // 1. Arrays of mat4 and mat4
+ // Non-square matrices of type matCxR consume the same space as a square
+ // matrix of type matN where N is the greater of C and R
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ return 0;
+
+ // 2. Arrays of mat2 and mat2 (since they occupy full rows)
+ case GL_FLOAT_MAT2:
+ return 1;
+
+ // 3. Arrays of vec4 and vec4
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ return 2;
+
+ // 4. Arrays of mat3 and mat3
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ return 3;
+
+ // 5. Arrays of vec3 and vec3
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ return 4;
+
+ // 6. Arrays of vec2 and vec2
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ return 5;
+
+ // 7. Single component types
+ case GL_FLOAT:
+ case GL_INT:
+ case GL_BOOL:
+ case GL_UNSIGNED_INT:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_2D_RECT_ANGLE:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_3D:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_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_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_IMAGE_2D:
+ case GL_INT_IMAGE_2D:
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ case GL_IMAGE_3D:
+ case GL_INT_IMAGE_3D:
+ case GL_UNSIGNED_INT_IMAGE_3D:
+ case GL_IMAGE_2D_ARRAY:
+ case GL_INT_IMAGE_2D_ARRAY:
+ case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+ case GL_IMAGE_CUBE:
+ case GL_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_IMAGE_CUBE:
+ case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+ return 6;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::string ParseResourceName(const std::string &name, std::vector<unsigned int> *outSubscripts)
+{
+ if (outSubscripts)
+ {
+ outSubscripts->clear();
+ }
+ // Strip any trailing array indexing operators and retrieve the subscripts.
+ size_t baseNameLength = name.length();
+ bool hasIndex = true;
+ while (hasIndex)
+ {
+ size_t open = name.find_last_of('[', baseNameLength - 1);
+ size_t close = name.find_last_of(']', baseNameLength - 1);
+ hasIndex = (open != std::string::npos) && (close == baseNameLength - 1);
+ if (hasIndex)
+ {
+ baseNameLength = open;
+ if (outSubscripts)
+ {
+ int index = atoi(name.substr(open + 1).c_str());
+ if (index >= 0)
+ {
+ outSubscripts->push_back(index);
+ }
+ else
+ {
+ outSubscripts->push_back(GL_INVALID_INDEX);
+ }
+ }
+ }
+ }
+
+ return name.substr(0, baseNameLength);
+}
+
+const sh::ShaderVariable *FindShaderVarField(const sh::ShaderVariable &var,
+ const std::string &fullName,
+ GLuint *fieldIndexOut)
+{
+ if (var.fields.empty())
+ {
+ return nullptr;
+ }
+ size_t pos = fullName.find_first_of(".");
+ if (pos == std::string::npos)
+ {
+ return nullptr;
+ }
+ std::string topName = fullName.substr(0, pos);
+ if (topName != var.name)
+ {
+ return nullptr;
+ }
+ std::string fieldName = fullName.substr(pos + 1);
+ if (fieldName.empty())
+ {
+ return nullptr;
+ }
+ for (size_t field = 0; field < var.fields.size(); ++field)
+ {
+ if (var.fields[field].name == fieldName)
+ {
+ *fieldIndexOut = static_cast<GLuint>(field);
+ return &var.fields[field];
+ }
+ }
+ return nullptr;
+}
+
+unsigned int ArraySizeProduct(const std::vector<unsigned int> &arraySizes)
+{
+ unsigned int arraySizeProduct = 1u;
+ for (unsigned int arraySize : arraySizes)
+ {
+ arraySizeProduct *= arraySize;
+ }
+ return arraySizeProduct;
+}
+
+unsigned int ParseArrayIndex(const std::string &name, size_t *nameLengthWithoutArrayIndexOut)
+{
+ ASSERT(nameLengthWithoutArrayIndexOut != nullptr);
+
+ // Strip any trailing array operator and retrieve the subscript
+ size_t open = name.find_last_of('[');
+ if (open != std::string::npos && name.back() == ']')
+ {
+ bool indexIsValidDecimalNumber = true;
+ for (size_t i = open + 1; i < name.length() - 1u; ++i)
+ {
+ if (!isdigit(name[i]))
+ {
+ indexIsValidDecimalNumber = false;
+ break;
+ }
+ }
+ if (indexIsValidDecimalNumber)
+ {
+ errno = 0; // reset global error flag.
+ unsigned long subscript =
+ strtoul(name.c_str() + open + 1, /*endptr*/ nullptr, /*radix*/ 10);
+
+ // Check if resulting integer is out-of-range or conversion error.
+ if ((subscript <= static_cast<unsigned long>(UINT_MAX)) &&
+ !(subscript == ULONG_MAX && errno == ERANGE) && !(errno != 0 && subscript == 0))
+ {
+ *nameLengthWithoutArrayIndexOut = open;
+ return static_cast<unsigned int>(subscript);
+ }
+ }
+ }
+
+ *nameLengthWithoutArrayIndexOut = name.length();
+ return GL_INVALID_INDEX;
+}
+
+const char *GetGenericErrorMessage(GLenum error)
+{
+ switch (error)
+ {
+ case GL_NO_ERROR:
+ return "";
+ case GL_INVALID_ENUM:
+ return "Invalid enum.";
+ case GL_INVALID_VALUE:
+ return "Invalid value.";
+ case GL_INVALID_OPERATION:
+ return "Invalid operation.";
+ case GL_STACK_OVERFLOW:
+ return "Stack overflow.";
+ case GL_STACK_UNDERFLOW:
+ return "Stack underflow.";
+ case GL_OUT_OF_MEMORY:
+ return "Out of memory.";
+ case GL_INVALID_FRAMEBUFFER_OPERATION:
+ return "Invalid framebuffer operation.";
+ default:
+ UNREACHABLE();
+ return "Unknown error.";
+ }
+}
+
+unsigned int ElementTypeSize(GLenum elementType)
+{
+ switch (elementType)
+ {
+ case GL_UNSIGNED_BYTE:
+ return sizeof(GLubyte);
+ case GL_UNSIGNED_SHORT:
+ return sizeof(GLushort);
+ case GL_UNSIGNED_INT:
+ return sizeof(GLuint);
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+PipelineType GetPipelineType(ShaderType type)
+{
+ switch (type)
+ {
+ case ShaderType::Vertex:
+ case ShaderType::Fragment:
+ case ShaderType::Geometry:
+ return PipelineType::GraphicsPipeline;
+ case ShaderType::Compute:
+ return PipelineType::ComputePipeline;
+ default:
+ UNREACHABLE();
+ return PipelineType::GraphicsPipeline;
+ }
+}
+
+} // namespace gl
+
+namespace egl
+{
+static_assert(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 1,
+ "Unexpected EGL cube map enum value.");
+static_assert(EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 2,
+ "Unexpected EGL cube map enum value.");
+static_assert(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 3,
+ "Unexpected EGL cube map enum value.");
+static_assert(EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 4,
+ "Unexpected EGL cube map enum value.");
+static_assert(EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR == 5,
+ "Unexpected EGL cube map enum value.");
+
+bool IsCubeMapTextureTarget(EGLenum target)
+{
+ return (target >= FirstCubeMapTextureTarget && target <= LastCubeMapTextureTarget);
+}
+
+size_t CubeMapTextureTargetToLayerIndex(EGLenum target)
+{
+ ASSERT(IsCubeMapTextureTarget(target));
+ return target - static_cast<size_t>(FirstCubeMapTextureTarget);
+}
+
+EGLenum LayerIndexToCubeMapTextureTarget(size_t index)
+{
+ ASSERT(index <= (LastCubeMapTextureTarget - FirstCubeMapTextureTarget));
+ return FirstCubeMapTextureTarget + static_cast<GLenum>(index);
+}
+
+bool IsTextureTarget(EGLenum target)
+{
+ switch (target)
+ {
+ case EGL_GL_TEXTURE_2D_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
+ case EGL_GL_TEXTURE_3D_KHR:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool IsRenderbufferTarget(EGLenum target)
+{
+ return target == EGL_GL_RENDERBUFFER_KHR;
+}
+
+bool IsExternalImageTarget(EGLenum target)
+{
+ switch (target)
+ {
+ case EGL_NATIVE_BUFFER_ANDROID:
+ case EGL_D3D11_TEXTURE_ANGLE:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+const char *GetGenericErrorMessage(EGLint error)
+{
+ switch (error)
+ {
+ case EGL_SUCCESS:
+ return "";
+ case EGL_NOT_INITIALIZED:
+ return "Not initialized.";
+ case EGL_BAD_ACCESS:
+ return "Bad access.";
+ case EGL_BAD_ALLOC:
+ return "Bad allocation.";
+ case EGL_BAD_ATTRIBUTE:
+ return "Bad attribute.";
+ case EGL_BAD_CONFIG:
+ return "Bad config.";
+ case EGL_BAD_CONTEXT:
+ return "Bad context.";
+ case EGL_BAD_CURRENT_SURFACE:
+ return "Bad current surface.";
+ case EGL_BAD_DISPLAY:
+ return "Bad display.";
+ case EGL_BAD_MATCH:
+ return "Bad match.";
+ case EGL_BAD_NATIVE_WINDOW:
+ return "Bad native window.";
+ case EGL_BAD_PARAMETER:
+ return "Bad parameter.";
+ case EGL_BAD_SURFACE:
+ return "Bad surface.";
+ case EGL_CONTEXT_LOST:
+ return "Context lost.";
+ case EGL_BAD_STREAM_KHR:
+ return "Bad stream.";
+ case EGL_BAD_STATE_KHR:
+ return "Bad state.";
+ case EGL_BAD_DEVICE_EXT:
+ return "Bad device.";
+ default:
+ UNREACHABLE();
+ return "Unknown error.";
+ }
+}
+
+} // namespace egl
+
+namespace egl_gl
+{
+GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer)
+{
+ return static_cast<GLuint>(reinterpret_cast<uintptr_t>(buffer));
+}
+} // namespace egl_gl
+
+namespace gl_egl
+{
+EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType)
+{
+ switch (glComponentType)
+ {
+ case GL_FLOAT:
+ return EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT;
+
+ case GL_UNSIGNED_NORMALIZED:
+ return EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
+
+ default:
+ UNREACHABLE();
+ return EGL_NONE;
+ }
+}
+
+EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle)
+{
+ return reinterpret_cast<EGLClientBuffer>(static_cast<uintptr_t>(handle));
+}
+
+} // namespace gl_egl
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+std::string getTempPath()
+{
+# ifdef ANGLE_PLATFORM_WINDOWS
+ 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);
+}
+#endif // !ANGLE_ENABLE_WINDOWS_STORE
+
+#if defined(ANGLE_PLATFORM_WINDOWS)
+
+// Causes the thread to relinquish the remainder of its time slice to any
+// other thread that is ready to run.If there are no other threads ready
+// to run, the function returns immediately, and the thread continues execution.
+void ScheduleYield()
+{
+ Sleep(0);
+}
+
+#endif
diff --git a/gfx/angle/checkout/src/common/utilities.h b/gfx/angle/checkout/src/common/utilities.h
new file mode 100644
index 0000000000..9cacac6286
--- /dev/null
+++ b/gfx/angle/checkout/src/common/utilities.h
@@ -0,0 +1,253 @@
+//
+// 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 COMMON_UTILITIES_H_
+#define COMMON_UTILITIES_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <math.h>
+#include <string>
+#include <vector>
+
+#include "angle_gl.h"
+
+#include "common/PackedEnums.h"
+#include "common/mathutil.h"
+#include "common/platform.h"
+
+namespace sh
+{
+struct ShaderVariable;
+}
+
+namespace gl
+{
+
+int VariableComponentCount(GLenum type);
+GLenum VariableComponentType(GLenum type);
+size_t VariableComponentSize(GLenum type);
+size_t VariableInternalSize(GLenum type);
+size_t VariableExternalSize(GLenum type);
+int VariableRowCount(GLenum type);
+int VariableColumnCount(GLenum type);
+bool IsSamplerType(GLenum type);
+bool IsImageType(GLenum type);
+bool IsImage2DType(GLenum type);
+bool IsAtomicCounterType(GLenum type);
+bool IsOpaqueType(GLenum type);
+bool IsMatrixType(GLenum type);
+GLenum TransposeMatrixType(GLenum type);
+int VariableRegisterCount(GLenum type);
+int MatrixRegisterCount(GLenum type, bool isRowMajorMatrix);
+int MatrixComponentCount(GLenum type, bool isRowMajorMatrix);
+int VariableSortOrder(GLenum type);
+GLenum VariableBoolVectorType(GLenum type);
+
+int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
+
+// Parse the base resource name and array indices. Returns the base name of the resource.
+// If the provided name doesn't index an array, the outSubscripts vector will be empty.
+// If the provided name indexes an array, the outSubscripts vector will contain indices with
+// outermost array indices in the back. If an array index is invalid, GL_INVALID_INDEX is added to
+// outSubscripts.
+std::string ParseResourceName(const std::string &name, std::vector<unsigned int> *outSubscripts);
+
+// Find the child field which matches 'fullName' == var.name + "." + field.name.
+// Return nullptr if not found.
+const sh::ShaderVariable *FindShaderVarField(const sh::ShaderVariable &var,
+ const std::string &fullName,
+ GLuint *fieldIndexOut);
+
+// Find the range of index values in the provided indices pointer. Primitive restart indices are
+// only counted in the range if primitive restart is disabled.
+IndexRange ComputeIndexRange(DrawElementsType indexType,
+ const GLvoid *indices,
+ size_t count,
+ bool primitiveRestartEnabled);
+
+// Get the primitive restart index value for the given index type.
+GLuint GetPrimitiveRestartIndex(DrawElementsType indexType);
+
+// Get the primitive restart index value with the given C++ type.
+template <typename T>
+constexpr T GetPrimitiveRestartIndexFromType()
+{
+ return std::numeric_limits<T>::max();
+}
+
+static_assert(GetPrimitiveRestartIndexFromType<uint8_t>() == 0xFF,
+ "verify restart index for uint8_t values");
+static_assert(GetPrimitiveRestartIndexFromType<uint16_t>() == 0xFFFF,
+ "verify restart index for uint8_t values");
+static_assert(GetPrimitiveRestartIndexFromType<uint32_t>() == 0xFFFFFFFF,
+ "verify restart index for uint8_t values");
+
+bool IsTriangleMode(PrimitiveMode drawMode);
+
+namespace priv
+{
+extern const angle::PackedEnumMap<PrimitiveMode, bool> gLineModes;
+} // namespace priv
+
+ANGLE_INLINE bool IsLineMode(PrimitiveMode primitiveMode)
+{
+ return priv::gLineModes[primitiveMode];
+}
+
+bool IsIntegerFormat(GLenum unsizedFormat);
+
+// Returns the product of the sizes in the vector, or 1 if the vector is empty. Doesn't currently
+// perform overflow checks.
+unsigned int ArraySizeProduct(const std::vector<unsigned int> &arraySizes);
+
+// Return the array index at the end of name, and write the length of name before the final array
+// index into nameLengthWithoutArrayIndexOut. In case name doesn't include an array index, return
+// GL_INVALID_INDEX and write the length of the original string.
+unsigned int ParseArrayIndex(const std::string &name, size_t *nameLengthWithoutArrayIndexOut);
+
+enum class SamplerFormat : uint8_t
+{
+ Float = 0,
+ Unsigned = 1,
+ Signed = 2,
+ Shadow = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+struct UniformTypeInfo final : angle::NonCopyable
+{
+ inline constexpr UniformTypeInfo(GLenum type,
+ GLenum componentType,
+ GLenum textureType,
+ GLenum transposedMatrixType,
+ GLenum boolVectorType,
+ SamplerFormat samplerFormat,
+ int rowCount,
+ int columnCount,
+ int componentCount,
+ size_t componentSize,
+ size_t internalSize,
+ size_t externalSize,
+ bool isSampler,
+ bool isMatrixType,
+ bool isImageType,
+ const char *glslAsFloat);
+
+ GLenum type;
+ GLenum componentType;
+ GLenum textureType;
+ GLenum transposedMatrixType;
+ GLenum boolVectorType;
+ SamplerFormat samplerFormat;
+ int rowCount;
+ int columnCount;
+ int componentCount;
+ size_t componentSize;
+ size_t internalSize;
+ size_t externalSize;
+ bool isSampler;
+ bool isMatrixType;
+ bool isImageType;
+ const char *glslAsFloat;
+};
+
+inline constexpr UniformTypeInfo::UniformTypeInfo(GLenum type,
+ GLenum componentType,
+ GLenum textureType,
+ GLenum transposedMatrixType,
+ GLenum boolVectorType,
+ SamplerFormat samplerFormat,
+ int rowCount,
+ int columnCount,
+ int componentCount,
+ size_t componentSize,
+ size_t internalSize,
+ size_t externalSize,
+ bool isSampler,
+ bool isMatrixType,
+ bool isImageType,
+ const char *glslAsFloat)
+ : type(type),
+ componentType(componentType),
+ textureType(textureType),
+ transposedMatrixType(transposedMatrixType),
+ boolVectorType(boolVectorType),
+ samplerFormat(samplerFormat),
+ rowCount(rowCount),
+ columnCount(columnCount),
+ componentCount(componentCount),
+ componentSize(componentSize),
+ internalSize(internalSize),
+ externalSize(externalSize),
+ isSampler(isSampler),
+ isMatrixType(isMatrixType),
+ isImageType(isImageType),
+ glslAsFloat(glslAsFloat)
+{}
+
+const UniformTypeInfo &GetUniformTypeInfo(GLenum uniformType);
+
+const char *GetGenericErrorMessage(GLenum error);
+
+unsigned int ElementTypeSize(GLenum elementType);
+
+template <typename T>
+T GetClampedVertexCount(size_t vertexCount)
+{
+ static constexpr size_t kMax = static_cast<size_t>(std::numeric_limits<T>::max());
+ return static_cast<T>(vertexCount > kMax ? kMax : vertexCount);
+}
+
+enum class PipelineType
+{
+ GraphicsPipeline = 0,
+ ComputePipeline = 1,
+};
+
+PipelineType GetPipelineType(ShaderType shaderType);
+} // namespace gl
+
+namespace egl
+{
+static const EGLenum FirstCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR;
+static const EGLenum LastCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR;
+bool IsCubeMapTextureTarget(EGLenum target);
+size_t CubeMapTextureTargetToLayerIndex(EGLenum target);
+EGLenum LayerIndexToCubeMapTextureTarget(size_t index);
+bool IsTextureTarget(EGLenum target);
+bool IsRenderbufferTarget(EGLenum target);
+bool IsExternalImageTarget(EGLenum target);
+
+const char *GetGenericErrorMessage(EGLint error);
+} // namespace egl
+
+namespace egl_gl
+{
+GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer);
+}
+
+namespace gl_egl
+{
+EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType);
+EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle);
+} // namespace gl_egl
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+std::string getTempPath();
+void writeFile(const char *path, const void *data, size_t size);
+#endif
+
+#if defined(ANGLE_PLATFORM_WINDOWS)
+void ScheduleYield();
+#endif
+
+#endif // COMMON_UTILITIES_H_
diff --git a/gfx/angle/checkout/src/common/vector_utils.h b/gfx/angle/checkout/src/common/vector_utils.h
new file mode 100644
index 0000000000..d23a836288
--- /dev/null
+++ b/gfx/angle/checkout/src/common/vector_utils.h
@@ -0,0 +1,523 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// vector_utils.h: Utility classes implementing various vector operations
+
+#ifndef COMMON_VECTOR_UTILS_H_
+#define COMMON_VECTOR_UTILS_H_
+
+#include <cmath>
+#include <cstddef>
+#include <ostream>
+#include <type_traits>
+
+namespace angle
+{
+
+template <size_t Dimension, typename Type>
+class Vector;
+
+using Vector2 = Vector<2, float>;
+using Vector3 = Vector<3, float>;
+using Vector4 = Vector<4, float>;
+
+using Vector2I = Vector<2, int>;
+using Vector3I = Vector<3, int>;
+using Vector4I = Vector<4, int>;
+
+using Vector2U = Vector<2, unsigned int>;
+using Vector3U = Vector<3, unsigned int>;
+using Vector4U = Vector<4, unsigned int>;
+
+template <size_t Dimension, typename Type>
+class VectorBase
+{
+ public:
+ using VectorN = Vector<Dimension, Type>;
+
+ // Constructors
+ VectorBase() = default;
+ explicit VectorBase(Type element);
+
+ template <typename Type2>
+ VectorBase(const VectorBase<Dimension, Type2> &other);
+
+ template <typename Arg1, typename Arg2, typename... Args>
+ VectorBase(const Arg1 &arg1, const Arg2 &arg2, const Args &... args);
+
+ // Access the vector backing storage directly
+ const Type *data() const { return mData; }
+ Type *data() { return mData; }
+ constexpr size_t size() const { return Dimension; }
+
+ // Load or store the pointer from / to raw data
+ static VectorN Load(const Type *source);
+ static void Store(const VectorN &source, Type *destination);
+
+ // Index the vector
+ Type &operator[](size_t i) { return mData[i]; }
+ const Type &operator[](size_t i) const { return mData[i]; }
+
+ // Basic arithmetic operations
+ VectorN operator+() const;
+ VectorN operator-() const;
+ VectorN operator+(const VectorN &other) const;
+ VectorN operator-(const VectorN &other) const;
+ VectorN operator*(const VectorN &other) const;
+ VectorN operator/(const VectorN &other) const;
+ VectorN operator*(Type other) const;
+ VectorN operator/(Type other) const;
+ friend VectorN operator*(Type a, const VectorN &b) { return b * a; }
+
+ // Compound arithmetic operations
+ VectorN &operator+=(const VectorN &other);
+ VectorN &operator-=(const VectorN &other);
+ VectorN &operator*=(const VectorN &other);
+ VectorN &operator/=(const VectorN &other);
+ VectorN &operator*=(Type other);
+ VectorN &operator/=(Type other);
+
+ // Comparison operators
+ bool operator==(const VectorN &other) const;
+ bool operator!=(const VectorN &other) const;
+
+ // Other arithmetic operations
+ Type length() const;
+ Type lengthSquared() const;
+ Type dot(const VectorBase<Dimension, Type> &other) const;
+ VectorN normalized() const;
+
+ protected:
+ template <size_t CurrentIndex, size_t OtherDimension, typename OtherType, typename... Args>
+ void initWithList(const Vector<OtherDimension, OtherType> &arg1, const Args &... args);
+
+ // Some old compilers consider this function an alternative for initWithList(Vector)
+ // when the variant above is more precise. Use SFINAE on the return value to hide
+ // this variant for non-arithmetic types. The return value is still void.
+ template <size_t CurrentIndex, typename OtherType, typename... Args>
+ typename std::enable_if<std::is_arithmetic<OtherType>::value>::type initWithList(
+ OtherType arg1,
+ const Args &... args);
+
+ template <size_t CurrentIndex>
+ void initWithList() const;
+
+ template <size_t Dimension2, typename Type2>
+ friend class VectorBase;
+
+ Type mData[Dimension];
+};
+
+template <size_t Dimension, typename Type>
+std::ostream &operator<<(std::ostream &ostream, const VectorBase<Dimension, Type> &vector);
+
+template <typename Type>
+class Vector<2, Type> : public VectorBase<2, Type>
+{
+ public:
+ // Import the constructors defined in VectorBase
+ using VectorBase<2, Type>::VectorBase;
+
+ // Element shorthands
+ Type &x() { return this->mData[0]; }
+ Type &y() { return this->mData[1]; }
+
+ const Type &x() const { return this->mData[0]; }
+ const Type &y() const { return this->mData[1]; }
+};
+
+template <typename Type>
+std::ostream &operator<<(std::ostream &ostream, const Vector<2, Type> &vector);
+
+template <typename Type>
+class Vector<3, Type> : public VectorBase<3, Type>
+{
+ public:
+ // Import the constructors defined in VectorBase
+ using VectorBase<3, Type>::VectorBase;
+
+ // Additional operations
+ Vector<3, Type> cross(const Vector<3, Type> &other) const;
+
+ // Element shorthands
+ Type &x() { return this->mData[0]; }
+ Type &y() { return this->mData[1]; }
+ Type &z() { return this->mData[2]; }
+
+ const Type &x() const { return this->mData[0]; }
+ const Type &y() const { return this->mData[1]; }
+ const Type &z() const { return this->mData[2]; }
+};
+
+template <typename Type>
+std::ostream &operator<<(std::ostream &ostream, const Vector<3, Type> &vector);
+
+template <typename Type>
+class Vector<4, Type> : public VectorBase<4, Type>
+{
+ public:
+ // Import the constructors defined in VectorBase
+ using VectorBase<4, Type>::VectorBase;
+
+ // Element shorthands
+ Type &x() { return this->mData[0]; }
+ Type &y() { return this->mData[1]; }
+ Type &z() { return this->mData[2]; }
+ Type &w() { return this->mData[3]; }
+
+ const Type &x() const { return this->mData[0]; }
+ const Type &y() const { return this->mData[1]; }
+ const Type &z() const { return this->mData[2]; }
+ const Type &w() const { return this->mData[3]; }
+};
+
+template <typename Type>
+std::ostream &operator<<(std::ostream &ostream, const Vector<4, Type> &vector);
+
+// Implementation of constructors and misc operations
+
+template <size_t Dimension, typename Type>
+VectorBase<Dimension, Type>::VectorBase(Type element)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] = element;
+ }
+}
+
+template <size_t Dimension, typename Type>
+template <typename Type2>
+VectorBase<Dimension, Type>::VectorBase(const VectorBase<Dimension, Type2> &other)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] = static_cast<Type>(other.mData[i]);
+ }
+}
+
+// Ideally we would like to have only two constructors:
+// - a scalar constructor that takes Type as a parameter
+// - a compound constructor
+// However if we define the compound constructor for when it has a single arguments, then calling
+// Vector2(0.0) will be ambiguous. To solve this we take advantage of there being a single compound
+// constructor with a single argument, which is the copy constructor. We end up with three
+// constructors:
+// - the scalar constructor
+// - the copy constructor
+// - the compound constructor for two or more arguments, hence the arg1, and arg2 here.
+template <size_t Dimension, typename Type>
+template <typename Arg1, typename Arg2, typename... Args>
+VectorBase<Dimension, Type>::VectorBase(const Arg1 &arg1, const Arg2 &arg2, const Args &... args)
+{
+ initWithList<0>(arg1, arg2, args...);
+}
+
+template <size_t Dimension, typename Type>
+template <size_t CurrentIndex, size_t OtherDimension, typename OtherType, typename... Args>
+void VectorBase<Dimension, Type>::initWithList(const Vector<OtherDimension, OtherType> &arg1,
+ const Args &... args)
+{
+ static_assert(CurrentIndex + OtherDimension <= Dimension,
+ "Too much data in the vector constructor.");
+ for (size_t i = 0; i < OtherDimension; ++i)
+ {
+ mData[CurrentIndex + i] = static_cast<Type>(arg1.mData[i]);
+ }
+ initWithList<CurrentIndex + OtherDimension>(args...);
+}
+
+template <size_t Dimension, typename Type>
+template <size_t CurrentIndex, typename OtherType, typename... Args>
+typename std::enable_if<std::is_arithmetic<OtherType>::value>::type
+VectorBase<Dimension, Type>::initWithList(OtherType arg1, const Args &... args)
+{
+ static_assert(CurrentIndex + 1 <= Dimension, "Too much data in the vector constructor.");
+ mData[CurrentIndex] = static_cast<Type>(arg1);
+ initWithList<CurrentIndex + 1>(args...);
+}
+
+template <size_t Dimension, typename Type>
+template <size_t CurrentIndex>
+void VectorBase<Dimension, Type>::initWithList() const
+{
+ static_assert(CurrentIndex == Dimension, "Not enough data in the vector constructor.");
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::Load(const Type *source)
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = source[i];
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+void VectorBase<Dimension, Type>::Store(const Vector<Dimension, Type> &source, Type *destination)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ destination[i] = source.mData[i];
+ }
+}
+
+// Implementation of basic arithmetic operations
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator+() const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = +mData[i];
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator-() const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = -mData[i];
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator+(
+ const Vector<Dimension, Type> &other) const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = mData[i] + other.mData[i];
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator-(
+ const Vector<Dimension, Type> &other) const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = mData[i] - other.mData[i];
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator*(
+ const Vector<Dimension, Type> &other) const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = mData[i] * other.mData[i];
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator/(
+ const Vector<Dimension, Type> &other) const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = mData[i] / other.mData[i];
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator*(Type other) const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = mData[i] * other;
+ }
+ return result;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::operator/(Type other) const
+{
+ Vector<Dimension, Type> result;
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ result.mData[i] = mData[i] / other;
+ }
+ return result;
+}
+
+// Implementation of compound arithmetic operations
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator+=(
+ const Vector<Dimension, Type> &other)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] += other.mData[i];
+ }
+ return *static_cast<Vector<Dimension, Type> *>(this);
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator-=(
+ const Vector<Dimension, Type> &other)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] -= other.mData[i];
+ }
+ return *static_cast<Vector<Dimension, Type> *>(this);
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator*=(
+ const Vector<Dimension, Type> &other)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] *= other.mData[i];
+ }
+ return *static_cast<Vector<Dimension, Type> *>(this);
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator/=(
+ const Vector<Dimension, Type> &other)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] /= other.mData[i];
+ }
+ return *static_cast<Vector<Dimension, Type> *>(this);
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator*=(Type other)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] *= other;
+ }
+ return *static_cast<Vector<Dimension, Type> *>(this);
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> &VectorBase<Dimension, Type>::operator/=(Type other)
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ mData[i] /= other;
+ }
+ return *static_cast<Vector<Dimension, Type> *>(this);
+}
+
+// Implementation of comparison operators
+template <size_t Dimension, typename Type>
+bool VectorBase<Dimension, Type>::operator==(const Vector<Dimension, Type> &other) const
+{
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ if (mData[i] != other.mData[i])
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+template <size_t Dimension, typename Type>
+bool VectorBase<Dimension, Type>::operator!=(const Vector<Dimension, Type> &other) const
+{
+ return !(*this == other);
+}
+
+// Implementation of other arithmetic operations
+template <size_t Dimension, typename Type>
+Type VectorBase<Dimension, Type>::length() const
+{
+ static_assert(std::is_floating_point<Type>::value,
+ "VectorN::length is only defined for floating point vectors");
+ return std::sqrt(lengthSquared());
+}
+
+template <size_t Dimension, typename Type>
+Type VectorBase<Dimension, Type>::lengthSquared() const
+{
+ return dot(*this);
+}
+
+template <size_t Dimension, typename Type>
+Type VectorBase<Dimension, Type>::dot(const VectorBase<Dimension, Type> &other) const
+{
+ Type sum = Type();
+ for (size_t i = 0; i < Dimension; ++i)
+ {
+ sum += mData[i] * other.mData[i];
+ }
+ return sum;
+}
+
+template <size_t Dimension, typename Type>
+std::ostream &operator<<(std::ostream &ostream, const VectorBase<Dimension, Type> &vector)
+{
+ ostream << "[ ";
+ for (size_t elementIdx = 0; elementIdx < Dimension; elementIdx++)
+ {
+ if (elementIdx > 0)
+ {
+ ostream << ", ";
+ }
+ ostream << vector.data()[elementIdx];
+ }
+ ostream << " ]";
+ return ostream;
+}
+
+template <size_t Dimension, typename Type>
+Vector<Dimension, Type> VectorBase<Dimension, Type>::normalized() const
+{
+ static_assert(std::is_floating_point<Type>::value,
+ "VectorN::normalized is only defined for floating point vectors");
+ return *this / length();
+}
+
+template <typename Type>
+std::ostream &operator<<(std::ostream &ostream, const Vector<2, Type> &vector)
+{
+ return ostream << static_cast<const VectorBase<2, Type> &>(vector);
+}
+
+template <typename Type>
+Vector<3, Type> Vector<3, Type>::cross(const Vector<3, Type> &other) const
+{
+ return Vector<3, Type>(y() * other.z() - z() * other.y(), z() * other.x() - x() * other.z(),
+ x() * other.y() - y() * other.x());
+}
+
+template <typename Type>
+std::ostream &operator<<(std::ostream &ostream, const Vector<3, Type> &vector)
+{
+ return ostream << static_cast<const VectorBase<3, Type> &>(vector);
+}
+
+template <typename Type>
+std::ostream &operator<<(std::ostream &ostream, const Vector<4, Type> &vector)
+{
+ return ostream << static_cast<const VectorBase<4, Type> &>(vector);
+}
+
+} // namespace angle
+
+#endif // COMMON_VECTOR_UTILS_H_
diff --git a/gfx/angle/checkout/src/common/version.h b/gfx/angle/checkout/src/common/version.h
new file mode 100644
index 0000000000..ff96e59919
--- /dev/null
+++ b/gfx/angle/checkout/src/common/version.h
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMMON_VERSION_H_
+#define COMMON_VERSION_H_
+
+#include "id/commit.h"
+
+#define ANGLE_MAJOR_VERSION 2
+#define ANGLE_MINOR_VERSION 1
+
+#ifndef ANGLE_REVISION
+# define ANGLE_REVISION 0
+#endif
+
+#define ANGLE_STRINGIFY(x) #x
+#define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
+
+#define ANGLE_VERSION_STRING \
+ ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) \
+ "." ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) "." ANGLE_MACRO_STRINGIFY( \
+ ANGLE_REVISION) "." ANGLE_COMMIT_HASH
+
+#endif // COMMON_VERSION_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.cpp b/gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.cpp
new file mode 100644
index 0000000000..7f1987695a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.cpp
@@ -0,0 +1,146 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/DiagnosticsBase.h"
+
+#include "common/debug.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+Diagnostics::~Diagnostics() {}
+
+void Diagnostics::report(ID id, const SourceLocation &loc, const std::string &text)
+{
+ print(id, loc, text);
+}
+
+bool Diagnostics::isError(ID id)
+{
+ if ((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
+ return true;
+
+ if ((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
+ return false;
+
+ UNREACHABLE();
+ return true;
+}
+
+const char *Diagnostics::message(ID id)
+{
+ switch (id)
+ {
+ // Errors begin.
+ case PP_INTERNAL_ERROR:
+ return "internal error";
+ case PP_OUT_OF_MEMORY:
+ return "out of memory";
+ case PP_INVALID_CHARACTER:
+ return "invalid character";
+ case PP_INVALID_NUMBER:
+ return "invalid number";
+ case PP_INTEGER_OVERFLOW:
+ return "integer overflow";
+ case PP_FLOAT_OVERFLOW:
+ return "float overflow";
+ case PP_TOKEN_TOO_LONG:
+ return "token too long";
+ case PP_INVALID_EXPRESSION:
+ return "invalid expression";
+ case PP_DIVISION_BY_ZERO:
+ return "division by zero";
+ case PP_EOF_IN_COMMENT:
+ return "unexpected end of file found in comment";
+ case PP_UNEXPECTED_TOKEN:
+ return "unexpected token";
+ case PP_DIRECTIVE_INVALID_NAME:
+ return "invalid directive name";
+ case PP_MACRO_NAME_RESERVED:
+ return "macro name is reserved";
+ case PP_MACRO_REDEFINED:
+ return "macro redefined";
+ case PP_MACRO_PREDEFINED_REDEFINED:
+ return "predefined macro redefined";
+ case PP_MACRO_PREDEFINED_UNDEFINED:
+ return "predefined macro undefined";
+ case PP_MACRO_UNTERMINATED_INVOCATION:
+ return "unterminated macro invocation";
+ case PP_MACRO_UNDEFINED_WHILE_INVOKED:
+ return "macro undefined while being invoked";
+ case PP_MACRO_TOO_FEW_ARGS:
+ return "Not enough arguments for macro";
+ case PP_MACRO_TOO_MANY_ARGS:
+ return "Too many arguments for macro";
+ case PP_MACRO_DUPLICATE_PARAMETER_NAMES:
+ return "duplicate macro parameter name";
+ case PP_MACRO_INVOCATION_CHAIN_TOO_DEEP:
+ return "macro invocation chain too deep";
+ case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
+ return "unexpected #endif found without a matching #if";
+ case PP_CONDITIONAL_ELSE_WITHOUT_IF:
+ return "unexpected #else found without a matching #if";
+ case PP_CONDITIONAL_ELSE_AFTER_ELSE:
+ return "unexpected #else found after another #else";
+ case PP_CONDITIONAL_ELIF_WITHOUT_IF:
+ return "unexpected #elif found without a matching #if";
+ case PP_CONDITIONAL_ELIF_AFTER_ELSE:
+ return "unexpected #elif found after #else";
+ case PP_CONDITIONAL_UNTERMINATED:
+ return "unexpected end of file found in conditional block";
+ case PP_INVALID_EXTENSION_NAME:
+ return "invalid extension name";
+ case PP_INVALID_EXTENSION_BEHAVIOR:
+ return "invalid extension behavior";
+ case PP_INVALID_EXTENSION_DIRECTIVE:
+ return "invalid extension directive";
+ case PP_INVALID_VERSION_NUMBER:
+ return "invalid version number";
+ case PP_INVALID_VERSION_DIRECTIVE:
+ return "invalid version directive";
+ case PP_VERSION_NOT_FIRST_STATEMENT:
+ return "#version directive must occur before anything else, "
+ "except for comments and white space";
+ case PP_VERSION_NOT_FIRST_LINE_ESSL3:
+ return "#version directive must occur on the first line of the shader";
+ case PP_INVALID_LINE_NUMBER:
+ return "invalid line number";
+ case PP_INVALID_FILE_NUMBER:
+ return "invalid file number";
+ case PP_INVALID_LINE_DIRECTIVE:
+ return "invalid line directive";
+ case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL:
+ return "extension directive must occur before any non-preprocessor tokens in ESSL";
+ case PP_UNDEFINED_SHIFT:
+ return "shift exponent is negative or undefined";
+ case PP_TOKENIZER_ERROR:
+ return "internal tokenizer error";
+ // Errors end.
+ // Warnings begin.
+ case PP_EOF_IN_DIRECTIVE:
+ return "unexpected end of file found in directive";
+ case PP_CONDITIONAL_UNEXPECTED_TOKEN:
+ return "unexpected token after conditional expression";
+ case PP_UNRECOGNIZED_PRAGMA:
+ return "unrecognized pragma";
+ case PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL:
+ return "extension directive should occur before any non-preprocessor tokens";
+ case PP_WARNING_MACRO_NAME_RESERVED:
+ return "macro name with a double underscore is reserved - unintented behavior is "
+ "possible";
+ // Warnings end.
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.h b/gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.h
new file mode 100644
index 0000000000..9f7a543b16
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/DiagnosticsBase.h
@@ -0,0 +1,95 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
+#define COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
+
+#include <string>
+
+namespace angle
+{
+
+namespace pp
+{
+
+struct SourceLocation;
+
+// Base class for reporting diagnostic messages.
+// Derived classes are responsible for formatting and printing the messages.
+class Diagnostics
+{
+ public:
+ enum ID
+ {
+ PP_ERROR_BEGIN,
+ PP_INTERNAL_ERROR,
+ PP_OUT_OF_MEMORY,
+ PP_INVALID_CHARACTER,
+ PP_INVALID_NUMBER,
+ PP_INTEGER_OVERFLOW,
+ PP_FLOAT_OVERFLOW,
+ PP_TOKEN_TOO_LONG,
+ PP_INVALID_EXPRESSION,
+ PP_DIVISION_BY_ZERO,
+ PP_EOF_IN_COMMENT,
+ PP_UNEXPECTED_TOKEN,
+ PP_DIRECTIVE_INVALID_NAME,
+ PP_MACRO_NAME_RESERVED,
+ PP_MACRO_REDEFINED,
+ PP_MACRO_PREDEFINED_REDEFINED,
+ PP_MACRO_PREDEFINED_UNDEFINED,
+ PP_MACRO_UNTERMINATED_INVOCATION,
+ PP_MACRO_UNDEFINED_WHILE_INVOKED,
+ PP_MACRO_TOO_FEW_ARGS,
+ PP_MACRO_TOO_MANY_ARGS,
+ PP_MACRO_DUPLICATE_PARAMETER_NAMES,
+ PP_MACRO_INVOCATION_CHAIN_TOO_DEEP,
+ PP_CONDITIONAL_ENDIF_WITHOUT_IF,
+ PP_CONDITIONAL_ELSE_WITHOUT_IF,
+ PP_CONDITIONAL_ELSE_AFTER_ELSE,
+ PP_CONDITIONAL_ELIF_WITHOUT_IF,
+ PP_CONDITIONAL_ELIF_AFTER_ELSE,
+ PP_CONDITIONAL_UNTERMINATED,
+ PP_CONDITIONAL_UNEXPECTED_TOKEN,
+ PP_INVALID_EXTENSION_NAME,
+ PP_INVALID_EXTENSION_BEHAVIOR,
+ PP_INVALID_EXTENSION_DIRECTIVE,
+ PP_INVALID_VERSION_NUMBER,
+ PP_INVALID_VERSION_DIRECTIVE,
+ PP_VERSION_NOT_FIRST_STATEMENT,
+ PP_VERSION_NOT_FIRST_LINE_ESSL3,
+ PP_INVALID_LINE_NUMBER,
+ PP_INVALID_FILE_NUMBER,
+ PP_INVALID_LINE_DIRECTIVE,
+ PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL,
+ PP_UNDEFINED_SHIFT,
+ PP_TOKENIZER_ERROR,
+ PP_ERROR_END,
+
+ PP_WARNING_BEGIN,
+ PP_EOF_IN_DIRECTIVE,
+ PP_UNRECOGNIZED_PRAGMA,
+ PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL,
+ PP_WARNING_MACRO_NAME_RESERVED,
+ PP_WARNING_END
+ };
+
+ virtual ~Diagnostics();
+
+ void report(ID id, const SourceLocation &loc, const std::string &text);
+
+ protected:
+ bool isError(ID id);
+ const char *message(ID id);
+
+ virtual void print(ID id, const SourceLocation &loc, const std::string &text) = 0;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.cpp b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.cpp
new file mode 100644
index 0000000000..c359ebcfd8
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.cpp
@@ -0,0 +1,19 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/DirectiveHandlerBase.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+DirectiveHandler::~DirectiveHandler() {}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.h b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.h
new file mode 100644
index 0000000000..d6ef85b812
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveHandlerBase.h
@@ -0,0 +1,49 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
+#define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
+
+#include <string>
+#include "GLSLANG/ShaderLang.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+struct SourceLocation;
+
+// Base class for handling directives.
+// Preprocessor uses this class to notify the clients about certain
+// preprocessor directives. Derived classes are responsible for
+// handling them in an appropriate manner.
+class DirectiveHandler
+{
+ public:
+ virtual ~DirectiveHandler();
+
+ virtual void handleError(const SourceLocation &loc, const std::string &msg) = 0;
+
+ // Handle pragma of form: #pragma name[(value)]
+ virtual void handlePragma(const SourceLocation &loc,
+ const std::string &name,
+ const std::string &value,
+ bool stdgl) = 0;
+
+ virtual void handleExtension(const SourceLocation &loc,
+ const std::string &name,
+ const std::string &behavior) = 0;
+
+ virtual void handleVersion(const SourceLocation &loc, int version, ShShaderSpec spec) = 0;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.cpp b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.cpp
new file mode 100644
index 0000000000..582f8f64a3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.cpp
@@ -0,0 +1,969 @@
+//
+// Copyright (c) 2011-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/preprocessor/DirectiveParser.h"
+
+#include <algorithm>
+#include <cstdlib>
+#include <sstream>
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/debug.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
+#include "compiler/preprocessor/DirectiveHandlerBase.h"
+#include "compiler/preprocessor/ExpressionParser.h"
+#include "compiler/preprocessor/MacroExpander.h"
+#include "compiler/preprocessor/Token.h"
+#include "compiler/preprocessor/Tokenizer.h"
+
+namespace angle
+{
+
+namespace
+{
+enum DirectiveType
+{
+ DIRECTIVE_NONE,
+ DIRECTIVE_DEFINE,
+ DIRECTIVE_UNDEF,
+ DIRECTIVE_IF,
+ DIRECTIVE_IFDEF,
+ DIRECTIVE_IFNDEF,
+ DIRECTIVE_ELSE,
+ DIRECTIVE_ELIF,
+ DIRECTIVE_ENDIF,
+ DIRECTIVE_ERROR,
+ DIRECTIVE_PRAGMA,
+ DIRECTIVE_EXTENSION,
+ DIRECTIVE_VERSION,
+ DIRECTIVE_LINE
+};
+
+DirectiveType getDirective(const pp::Token *token)
+{
+ const char kDirectiveDefine[] = "define";
+ const char kDirectiveUndef[] = "undef";
+ const char kDirectiveIf[] = "if";
+ const char kDirectiveIfdef[] = "ifdef";
+ const char kDirectiveIfndef[] = "ifndef";
+ const char kDirectiveElse[] = "else";
+ const char kDirectiveElif[] = "elif";
+ const char kDirectiveEndif[] = "endif";
+ const char kDirectiveError[] = "error";
+ const char kDirectivePragma[] = "pragma";
+ const char kDirectiveExtension[] = "extension";
+ const char kDirectiveVersion[] = "version";
+ const char kDirectiveLine[] = "line";
+
+ if (token->type != pp::Token::IDENTIFIER)
+ return DIRECTIVE_NONE;
+
+ if (token->text == kDirectiveDefine)
+ return DIRECTIVE_DEFINE;
+ if (token->text == kDirectiveUndef)
+ return DIRECTIVE_UNDEF;
+ if (token->text == kDirectiveIf)
+ return DIRECTIVE_IF;
+ if (token->text == kDirectiveIfdef)
+ return DIRECTIVE_IFDEF;
+ if (token->text == kDirectiveIfndef)
+ return DIRECTIVE_IFNDEF;
+ if (token->text == kDirectiveElse)
+ return DIRECTIVE_ELSE;
+ if (token->text == kDirectiveElif)
+ return DIRECTIVE_ELIF;
+ if (token->text == kDirectiveEndif)
+ return DIRECTIVE_ENDIF;
+ if (token->text == kDirectiveError)
+ return DIRECTIVE_ERROR;
+ if (token->text == kDirectivePragma)
+ return DIRECTIVE_PRAGMA;
+ if (token->text == kDirectiveExtension)
+ return DIRECTIVE_EXTENSION;
+ if (token->text == kDirectiveVersion)
+ return DIRECTIVE_VERSION;
+ if (token->text == kDirectiveLine)
+ return DIRECTIVE_LINE;
+
+ return DIRECTIVE_NONE;
+}
+
+bool isConditionalDirective(DirectiveType directive)
+{
+ switch (directive)
+ {
+ case DIRECTIVE_IF:
+ case DIRECTIVE_IFDEF:
+ case DIRECTIVE_IFNDEF:
+ case DIRECTIVE_ELSE:
+ case DIRECTIVE_ELIF:
+ case DIRECTIVE_ENDIF:
+ return true;
+ default:
+ return false;
+ }
+}
+
+// Returns true if the token represents End Of Directive.
+bool isEOD(const pp::Token *token)
+{
+ return (token->type == '\n') || (token->type == pp::Token::LAST);
+}
+
+void skipUntilEOD(pp::Lexer *lexer, pp::Token *token)
+{
+ while (!isEOD(token))
+ {
+ lexer->lex(token);
+ }
+}
+
+bool isMacroNameReserved(const std::string &name)
+{
+ // Names prefixed with "GL_" and the name "defined" are reserved.
+ return name == "defined" || (name.substr(0, 3) == "GL_");
+}
+
+bool hasDoubleUnderscores(const std::string &name)
+{
+ return (name.find("__") != std::string::npos);
+}
+
+bool isMacroPredefined(const std::string &name, const pp::MacroSet &macroSet)
+{
+ pp::MacroSet::const_iterator iter = macroSet.find(name);
+ return iter != macroSet.end() ? iter->second->predefined : false;
+}
+
+} // namespace
+
+namespace pp
+{
+DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler,
+ const PreprocessorSettings &settings)
+ : mPastFirstStatement(false),
+ mSeenNonPreprocessorToken(false),
+ mTokenizer(tokenizer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics),
+ mDirectiveHandler(directiveHandler),
+ mShaderVersion(100),
+ mSettings(settings)
+{}
+
+DirectiveParser::~DirectiveParser() {}
+
+void DirectiveParser::lex(Token *token)
+{
+ do
+ {
+ mTokenizer->lex(token);
+
+ if (token->type == Token::PP_HASH)
+ {
+ parseDirective(token);
+ mPastFirstStatement = true;
+ }
+ else if (!isEOD(token))
+ {
+ mSeenNonPreprocessorToken = true;
+ }
+
+ if (token->type == Token::LAST)
+ {
+ if (!mConditionalStack.empty())
+ {
+ const ConditionalBlock &block = mConditionalStack.back();
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED, block.location,
+ block.type);
+ }
+ break;
+ }
+
+ } while (skipping() || (token->type == '\n'));
+
+ mPastFirstStatement = true;
+}
+
+void DirectiveParser::parseDirective(Token *token)
+{
+ ASSERT(token->type == Token::PP_HASH);
+
+ mTokenizer->lex(token);
+ if (isEOD(token))
+ {
+ // Empty Directive.
+ return;
+ }
+
+ DirectiveType directive = getDirective(token);
+
+ // While in an excluded conditional block/group,
+ // we only parse conditional directives.
+ if (skipping() && !isConditionalDirective(directive))
+ {
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+
+ switch (directive)
+ {
+ case DIRECTIVE_NONE:
+ mDiagnostics->report(Diagnostics::PP_DIRECTIVE_INVALID_NAME, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ break;
+ case DIRECTIVE_DEFINE:
+ parseDefine(token);
+ break;
+ case DIRECTIVE_UNDEF:
+ parseUndef(token);
+ break;
+ case DIRECTIVE_IF:
+ parseIf(token);
+ break;
+ case DIRECTIVE_IFDEF:
+ parseIfdef(token);
+ break;
+ case DIRECTIVE_IFNDEF:
+ parseIfndef(token);
+ break;
+ case DIRECTIVE_ELSE:
+ parseElse(token);
+ break;
+ case DIRECTIVE_ELIF:
+ parseElif(token);
+ break;
+ case DIRECTIVE_ENDIF:
+ parseEndif(token);
+ break;
+ case DIRECTIVE_ERROR:
+ parseError(token);
+ break;
+ case DIRECTIVE_PRAGMA:
+ parsePragma(token);
+ break;
+ case DIRECTIVE_EXTENSION:
+ parseExtension(token);
+ break;
+ case DIRECTIVE_VERSION:
+ parseVersion(token);
+ break;
+ case DIRECTIVE_LINE:
+ parseLine(token);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ skipUntilEOD(mTokenizer, token);
+ if (token->type == Token::LAST)
+ {
+ mDiagnostics->report(Diagnostics::PP_EOF_IN_DIRECTIVE, token->location, token->text);
+ }
+}
+
+void DirectiveParser::parseDefine(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_DEFINE);
+
+ mTokenizer->lex(token);
+ if (token->type != Token::IDENTIFIER)
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
+ return;
+ }
+ if (isMacroPredefined(token->text, *mMacroSet))
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_REDEFINED, token->location,
+ token->text);
+ return;
+ }
+ if (isMacroNameReserved(token->text))
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_NAME_RESERVED, token->location, token->text);
+ return;
+ }
+ // Using double underscores is allowed, but may result in unintended
+ // behavior, so a warning is issued. At the time of writing this was
+ // specified in ESSL 3.10, but the intent judging from Khronos
+ // discussions and dEQP tests was that double underscores should be
+ // allowed in earlier ESSL versions too.
+ if (hasDoubleUnderscores(token->text))
+ {
+ mDiagnostics->report(Diagnostics::PP_WARNING_MACRO_NAME_RESERVED, token->location,
+ token->text);
+ }
+
+ std::shared_ptr<Macro> macro = std::make_shared<Macro>();
+ macro->type = Macro::kTypeObj;
+ macro->name = token->text;
+
+ mTokenizer->lex(token);
+ if (token->type == '(' && !token->hasLeadingSpace())
+ {
+ // Function-like macro. Collect arguments.
+ macro->type = Macro::kTypeFunc;
+ do
+ {
+ mTokenizer->lex(token);
+ if (token->type != Token::IDENTIFIER)
+ break;
+
+ if (std::find(macro->parameters.begin(), macro->parameters.end(), token->text) !=
+ macro->parameters.end())
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_DUPLICATE_PARAMETER_NAMES,
+ token->location, token->text);
+ return;
+ }
+
+ macro->parameters.push_back(token->text);
+
+ mTokenizer->lex(token); // Get ','.
+ } while (token->type == ',');
+
+ if (token->type != ')')
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
+ return;
+ }
+ mTokenizer->lex(token); // Get ')'.
+ }
+
+ while ((token->type != '\n') && (token->type != Token::LAST))
+ {
+ // Reset the token location because it is unnecessary in replacement
+ // list. Resetting it also allows us to reuse Token::equals() to
+ // compare macros.
+ token->location = SourceLocation();
+ macro->replacements.push_back(*token);
+ mTokenizer->lex(token);
+ }
+ if (!macro->replacements.empty())
+ {
+ // Whitespace preceding the replacement list is not considered part of
+ // the replacement list for either form of macro.
+ macro->replacements.front().setHasLeadingSpace(false);
+ }
+
+ // Check for macro redefinition.
+ MacroSet::const_iterator iter = mMacroSet->find(macro->name);
+ if (iter != mMacroSet->end() && !macro->equals(*iter->second))
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_REDEFINED, token->location, macro->name);
+ return;
+ }
+ mMacroSet->insert(std::make_pair(macro->name, macro));
+}
+
+void DirectiveParser::parseUndef(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_UNDEF);
+
+ mTokenizer->lex(token);
+ if (token->type != Token::IDENTIFIER)
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
+ return;
+ }
+
+ MacroSet::iterator iter = mMacroSet->find(token->text);
+ if (iter != mMacroSet->end())
+ {
+ if (iter->second->predefined)
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED, token->location,
+ token->text);
+ return;
+ }
+ else if (iter->second->expansionCount > 0)
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_UNDEFINED_WHILE_INVOKED, token->location,
+ token->text);
+ return;
+ }
+ else
+ {
+ mMacroSet->erase(iter);
+ }
+ }
+
+ mTokenizer->lex(token);
+ if (!isEOD(token))
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
+ skipUntilEOD(mTokenizer, token);
+ }
+}
+
+void DirectiveParser::parseIf(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_IF);
+ parseConditionalIf(token);
+}
+
+void DirectiveParser::parseIfdef(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_IFDEF);
+ parseConditionalIf(token);
+}
+
+void DirectiveParser::parseIfndef(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_IFNDEF);
+ parseConditionalIf(token);
+}
+
+void DirectiveParser::parseElse(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_ELSE);
+
+ if (mConditionalStack.empty())
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_WITHOUT_IF, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+
+ ConditionalBlock &block = mConditionalStack.back();
+ if (block.skipBlock)
+ {
+ // No diagnostics. Just skip the whole line.
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+ if (block.foundElseGroup)
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_AFTER_ELSE, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+
+ block.foundElseGroup = true;
+ block.skipGroup = block.foundValidGroup;
+ block.foundValidGroup = true;
+
+ // Check if there are extra tokens after #else.
+ mTokenizer->lex(token);
+ if (!isEOD(token))
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ }
+}
+
+void DirectiveParser::parseElif(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_ELIF);
+
+ if (mConditionalStack.empty())
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_WITHOUT_IF, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+
+ ConditionalBlock &block = mConditionalStack.back();
+ if (block.skipBlock)
+ {
+ // No diagnostics. Just skip the whole line.
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+ if (block.foundElseGroup)
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_AFTER_ELSE, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+ if (block.foundValidGroup)
+ {
+ // Do not parse the expression.
+ // Also be careful not to emit a diagnostic.
+ block.skipGroup = true;
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+
+ int expression = parseExpressionIf(token);
+ block.skipGroup = expression == 0;
+ block.foundValidGroup = expression != 0;
+}
+
+void DirectiveParser::parseEndif(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_ENDIF);
+
+ if (mConditionalStack.empty())
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ENDIF_WITHOUT_IF, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+
+ mConditionalStack.pop_back();
+
+ // Check if there are tokens after #endif.
+ mTokenizer->lex(token);
+ if (!isEOD(token))
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ }
+}
+
+void DirectiveParser::parseError(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_ERROR);
+
+ std::ostringstream stream;
+ mTokenizer->lex(token);
+ while ((token->type != '\n') && (token->type != Token::LAST))
+ {
+ stream << *token;
+ mTokenizer->lex(token);
+ }
+ mDirectiveHandler->handleError(token->location, stream.str());
+}
+
+// Parses pragma of form: #pragma name[(value)].
+void DirectiveParser::parsePragma(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_PRAGMA);
+
+ enum State
+ {
+ PRAGMA_NAME,
+ LEFT_PAREN,
+ PRAGMA_VALUE,
+ RIGHT_PAREN
+ };
+
+ bool valid = true;
+ std::string name, value;
+ int state = PRAGMA_NAME;
+
+ mTokenizer->lex(token);
+ bool stdgl = token->text == "STDGL";
+ if (stdgl)
+ {
+ mTokenizer->lex(token);
+ }
+ while ((token->type != '\n') && (token->type != Token::LAST))
+ {
+ switch (state++)
+ {
+ case PRAGMA_NAME:
+ name = token->text;
+ valid = valid && (token->type == Token::IDENTIFIER);
+ break;
+ case LEFT_PAREN:
+ valid = valid && (token->type == '(');
+ break;
+ case PRAGMA_VALUE:
+ value = token->text;
+ valid = valid && (token->type == Token::IDENTIFIER);
+ break;
+ case RIGHT_PAREN:
+ valid = valid && (token->type == ')');
+ break;
+ default:
+ valid = false;
+ break;
+ }
+ mTokenizer->lex(token);
+ }
+
+ valid = valid && ((state == PRAGMA_NAME) || // Empty pragma.
+ (state == LEFT_PAREN) || // Without value.
+ (state == RIGHT_PAREN + 1)); // With value.
+ if (!valid)
+ {
+ mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA, token->location, name);
+ }
+ else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
+ {
+ mDirectiveHandler->handlePragma(token->location, name, value, stdgl);
+ }
+}
+
+void DirectiveParser::parseExtension(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_EXTENSION);
+
+ enum State
+ {
+ EXT_NAME,
+ COLON,
+ EXT_BEHAVIOR
+ };
+
+ bool valid = true;
+ std::string name, behavior;
+ int state = EXT_NAME;
+
+ mTokenizer->lex(token);
+ while ((token->type != '\n') && (token->type != Token::LAST))
+ {
+ switch (state++)
+ {
+ case EXT_NAME:
+ if (valid && (token->type != Token::IDENTIFIER))
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_NAME, token->location,
+ token->text);
+ valid = false;
+ }
+ if (valid)
+ name = token->text;
+ break;
+ case COLON:
+ if (valid && (token->type != ':'))
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ valid = false;
+ }
+ break;
+ case EXT_BEHAVIOR:
+ if (valid && (token->type != Token::IDENTIFIER))
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_BEHAVIOR,
+ token->location, token->text);
+ valid = false;
+ }
+ if (valid)
+ behavior = token->text;
+ break;
+ default:
+ if (valid)
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ valid = false;
+ }
+ break;
+ }
+ mTokenizer->lex(token);
+ }
+ if (valid && (state != EXT_BEHAVIOR + 1))
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE, token->location,
+ token->text);
+ valid = false;
+ }
+ if (valid && mSeenNonPreprocessorToken)
+ {
+ if (mSettings.shaderSpec == SH_WEBGL_SPEC && mShaderVersion < 300)
+ {
+ mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL,
+ token->location, token->text);
+ }
+ else
+ {
+ mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL,
+ token->location, token->text);
+ valid = false;
+ }
+ }
+ if (valid)
+ mDirectiveHandler->handleExtension(token->location, name, behavior);
+}
+
+void DirectiveParser::parseVersion(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_VERSION);
+
+ if (mPastFirstStatement)
+ {
+ mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ return;
+ }
+
+ enum State
+ {
+ VERSION_NUMBER,
+ VERSION_PROFILE_ES,
+ VERSION_PROFILE_GL,
+ VERSION_ENDLINE
+ };
+
+ bool valid = true;
+ int version = 0;
+ int state = VERSION_NUMBER;
+
+ mTokenizer->lex(token);
+ while (valid && (token->type != '\n') && (token->type != Token::LAST))
+ {
+ switch (state)
+ {
+ case VERSION_NUMBER:
+ if (token->type != Token::CONST_INT)
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER, token->location,
+ token->text);
+ valid = false;
+ }
+ if (valid && !token->iValue(&version))
+ {
+ mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW, token->location,
+ token->text);
+ valid = false;
+ }
+ if (valid)
+ {
+ if (sh::IsDesktopGLSpec(mSettings.shaderSpec))
+ {
+ state = VERSION_PROFILE_GL;
+ }
+ else if (version < 300)
+ {
+ state = VERSION_ENDLINE;
+ }
+ else
+ {
+ state = VERSION_PROFILE_ES;
+ }
+ }
+ break;
+ case VERSION_PROFILE_ES:
+ ASSERT(!sh::IsDesktopGLSpec(mSettings.shaderSpec));
+ if (token->type != Token::IDENTIFIER || token->text != "es")
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE, token->location,
+ token->text);
+ valid = false;
+ }
+ state = VERSION_ENDLINE;
+ break;
+ case VERSION_PROFILE_GL:
+ ASSERT(sh::IsDesktopGLSpec(mSettings.shaderSpec));
+ if (token->type != Token::IDENTIFIER || token->text != "core")
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE, token->location,
+ token->text);
+ valid = false;
+ }
+ state = VERSION_ENDLINE;
+ break;
+ default:
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ valid = false;
+ break;
+ }
+
+ mTokenizer->lex(token);
+
+ if (token->type == '\n' && state == VERSION_PROFILE_GL)
+ {
+ state = VERSION_ENDLINE;
+ }
+ }
+
+ if (valid && (state != VERSION_ENDLINE))
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE, token->location,
+ token->text);
+ valid = false;
+ }
+
+ if (valid && version >= 300 && token->location.line > 1)
+ {
+ mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_LINE_ESSL3, token->location,
+ token->text);
+ valid = false;
+ }
+
+ if (valid)
+ {
+ mDirectiveHandler->handleVersion(token->location, version, mSettings.shaderSpec);
+ mShaderVersion = version;
+ PredefineMacro(mMacroSet, "__VERSION__", version);
+ }
+}
+
+void DirectiveParser::parseLine(Token *token)
+{
+ ASSERT(getDirective(token) == DIRECTIVE_LINE);
+
+ bool valid = true;
+ bool parsedFileNumber = false;
+ int line = 0, file = 0;
+
+ MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics, mSettings, false);
+
+ // Lex the first token after "#line" so we can check it for EOD.
+ macroExpander.lex(token);
+
+ if (isEOD(token))
+ {
+ mDiagnostics->report(Diagnostics::PP_INVALID_LINE_DIRECTIVE, token->location, token->text);
+ valid = false;
+ }
+ else
+ {
+ ExpressionParser expressionParser(&macroExpander, mDiagnostics);
+ ExpressionParser::ErrorSettings errorSettings;
+
+ // See GLES3 section 12.42
+ errorSettings.integerLiteralsMustFit32BitSignedRange = true;
+
+ errorSettings.unexpectedIdentifier = Diagnostics::PP_INVALID_LINE_NUMBER;
+ // The first token was lexed earlier to check if it was EOD. Include
+ // the token in parsing for a second time by setting the
+ // parsePresetToken flag to true.
+ expressionParser.parse(token, &line, true, errorSettings, &valid);
+ if (!isEOD(token) && valid)
+ {
+ errorSettings.unexpectedIdentifier = Diagnostics::PP_INVALID_FILE_NUMBER;
+ // After parsing the line expression expressionParser has also
+ // advanced to the first token of the file expression - this is the
+ // token that makes the parser reduce the "input" rule for the line
+ // expression and stop. So we're using parsePresetToken = true here
+ // as well.
+ expressionParser.parse(token, &file, true, errorSettings, &valid);
+ parsedFileNumber = true;
+ }
+ if (!isEOD(token))
+ {
+ if (valid)
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ valid = false;
+ }
+ skipUntilEOD(mTokenizer, token);
+ }
+ }
+
+ if (valid)
+ {
+ mTokenizer->setLineNumber(line);
+ if (parsedFileNumber)
+ mTokenizer->setFileNumber(file);
+ }
+}
+
+bool DirectiveParser::skipping() const
+{
+ if (mConditionalStack.empty())
+ return false;
+
+ const ConditionalBlock &block = mConditionalStack.back();
+ return block.skipBlock || block.skipGroup;
+}
+
+void DirectiveParser::parseConditionalIf(Token *token)
+{
+ ConditionalBlock block;
+ block.type = token->text;
+ block.location = token->location;
+
+ if (skipping())
+ {
+ // This conditional block is inside another conditional group
+ // which is skipped. As a consequence this whole block is skipped.
+ // Be careful not to parse the conditional expression that might
+ // emit a diagnostic.
+ skipUntilEOD(mTokenizer, token);
+ block.skipBlock = true;
+ }
+ else
+ {
+ DirectiveType directive = getDirective(token);
+
+ int expression = 0;
+ switch (directive)
+ {
+ case DIRECTIVE_IF:
+ expression = parseExpressionIf(token);
+ break;
+ case DIRECTIVE_IFDEF:
+ expression = parseExpressionIfdef(token);
+ break;
+ case DIRECTIVE_IFNDEF:
+ expression = parseExpressionIfdef(token) == 0 ? 1 : 0;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ block.skipGroup = expression == 0;
+ block.foundValidGroup = expression != 0;
+ }
+ mConditionalStack.push_back(block);
+}
+
+int DirectiveParser::parseExpressionIf(Token *token)
+{
+ ASSERT((getDirective(token) == DIRECTIVE_IF) || (getDirective(token) == DIRECTIVE_ELIF));
+
+ MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics, mSettings, true);
+ ExpressionParser expressionParser(&macroExpander, mDiagnostics);
+
+ int expression = 0;
+ ExpressionParser::ErrorSettings errorSettings;
+ errorSettings.integerLiteralsMustFit32BitSignedRange = false;
+ errorSettings.unexpectedIdentifier = Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN;
+
+ bool valid = true;
+ expressionParser.parse(token, &expression, false, errorSettings, &valid);
+
+ // Check if there are tokens after #if expression.
+ if (!isEOD(token))
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ }
+
+ return expression;
+}
+
+int DirectiveParser::parseExpressionIfdef(Token *token)
+{
+ ASSERT((getDirective(token) == DIRECTIVE_IFDEF) || (getDirective(token) == DIRECTIVE_IFNDEF));
+
+ mTokenizer->lex(token);
+ if (token->type != Token::IDENTIFIER)
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
+ skipUntilEOD(mTokenizer, token);
+ return 0;
+ }
+
+ MacroSet::const_iterator iter = mMacroSet->find(token->text);
+ int expression = iter != mMacroSet->end() ? 1 : 0;
+
+ // Check if there are tokens after #ifdef expression.
+ mTokenizer->lex(token);
+ if (!isEOD(token))
+ {
+ mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ skipUntilEOD(mTokenizer, token);
+ }
+ return expression;
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.h b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.h
new file mode 100644
index 0000000000..eb8a2ee9a2
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/DirectiveParser.h
@@ -0,0 +1,88 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
+#define COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
+
+#include "compiler/preprocessor/Lexer.h"
+#include "compiler/preprocessor/Macro.h"
+#include "compiler/preprocessor/Preprocessor.h"
+#include "compiler/preprocessor/SourceLocation.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+class Diagnostics;
+class DirectiveHandler;
+class Tokenizer;
+
+class DirectiveParser : public Lexer
+{
+ public:
+ DirectiveParser(Tokenizer *tokenizer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler,
+ const PreprocessorSettings &settings);
+ ~DirectiveParser() override;
+
+ void lex(Token *token) override;
+
+ private:
+ void parseDirective(Token *token);
+ void parseDefine(Token *token);
+ void parseUndef(Token *token);
+ void parseIf(Token *token);
+ void parseIfdef(Token *token);
+ void parseIfndef(Token *token);
+ void parseElse(Token *token);
+ void parseElif(Token *token);
+ void parseEndif(Token *token);
+ void parseError(Token *token);
+ void parsePragma(Token *token);
+ void parseExtension(Token *token);
+ void parseVersion(Token *token);
+ void parseLine(Token *token);
+
+ bool skipping() const;
+ void parseConditionalIf(Token *token);
+ int parseExpressionIf(Token *token);
+ int parseExpressionIfdef(Token *token);
+
+ struct ConditionalBlock
+ {
+ std::string type;
+ SourceLocation location;
+ bool skipBlock;
+ bool skipGroup;
+ bool foundValidGroup;
+ bool foundElseGroup;
+
+ ConditionalBlock()
+ : skipBlock(false), skipGroup(false), foundValidGroup(false), foundElseGroup(false)
+ {}
+ };
+ bool mPastFirstStatement;
+ bool mSeenNonPreprocessorToken; // Tracks if a non-preprocessor token has been seen yet. Some
+ // macros, such as
+ // #extension must be declared before all shader code.
+ std::vector<ConditionalBlock> mConditionalStack;
+ Tokenizer *mTokenizer;
+ MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
+ DirectiveHandler *mDirectiveHandler;
+ int mShaderVersion;
+ const PreprocessorSettings mSettings;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.cpp b/gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.cpp
new file mode 100644
index 0000000000..461c2145dd
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.cpp
@@ -0,0 +1,1906 @@
+/* A Bison parser, made by GNU Bison 3.0.4. */
+
+/* Bison implementation for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "3.0.4"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 1
+
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
+/* Substitute the variable and function names. */
+#define yyparse ppparse
+#define yylex pplex
+#define yyerror pperror
+#define yydebug ppdebug
+#define yynerrs ppnerrs
+
+/* Copy the first part of user declarations. */
+
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
+
+#if defined(__GNUC__)
+// Triggered by the auto-generated pplval variable.
+# if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+# else
+# pragma GCC diagnostic ignored "-Wuninitialized"
+# endif
+#elif defined(_MSC_VER)
+# pragma warning(disable : 4065 4244 4701 4702)
+#endif
+
+#include "ExpressionParser.h"
+
+#if defined(_MSC_VER)
+# include <malloc.h>
+#else
+# include <stdlib.h>
+#endif
+
+#include <stdint.h>
+#include <cassert>
+#include <sstream>
+
+#include "DiagnosticsBase.h"
+#include "Lexer.h"
+#include "Token.h"
+#include "common/mathutil.h"
+
+typedef int32_t YYSTYPE;
+typedef uint32_t UNSIGNED_TYPE;
+
+#define YYENABLE_NLS 0
+#define YYLTYPE_IS_TRIVIAL 1
+#define YYSTYPE_IS_TRIVIAL 1
+#define YYSTYPE_IS_DECLARED 1
+
+namespace
+{
+struct Context
+{
+ angle::pp::Diagnostics *diagnostics;
+ angle::pp::Lexer *lexer;
+ angle::pp::Token *token;
+ int *result;
+ bool parsePresetToken;
+
+ angle::pp::ExpressionParser::ErrorSettings errorSettings;
+ bool *valid;
+
+ void startIgnoreErrors() { ++ignoreErrors; }
+ void endIgnoreErrors() { --ignoreErrors; }
+
+ bool isIgnoringErrors() { return ignoreErrors > 0; }
+
+ int ignoreErrors;
+};
+} // namespace
+
+static int yylex(YYSTYPE *lvalp, Context *context);
+static void yyerror(Context *context, const char *reason);
+
+#ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int ppdebug;
+#endif
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+enum yytokentype
+{
+ TOK_CONST_INT = 258,
+ TOK_IDENTIFIER = 259,
+ TOK_OP_OR = 260,
+ TOK_OP_AND = 261,
+ TOK_OP_EQ = 262,
+ TOK_OP_NE = 263,
+ TOK_OP_LE = 264,
+ TOK_OP_GE = 265,
+ TOK_OP_LEFT = 266,
+ TOK_OP_RIGHT = 267,
+ TOK_UNARY = 268
+};
+#endif
+
+/* Value type. */
+#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+int ppparse(Context *context);
+
+/* Copy the second part of user declarations. */
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif !defined YYSIZE_T
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T)-1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(Msgid) dgettext("bison-runtime", Msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) || \
+ defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE((__unused__))
+#endif
+
+#if !defined _Noreturn && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec(noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE((__noreturn__))
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if !defined lint || defined __GNUC__
+# define YYUSE(E) ((void)(E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
+ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if !defined _ALLOCA_H && !defined EXIT_SUCCESS
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+/* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+/* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) \
+ do \
+ { /* empty */ \
+ ; \
+ } while (0)
+# ifndef YYSTACK_ALLOC_MAXIMUM
+/* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && !defined EXIT_SUCCESS && \
+ !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if !defined malloc && !defined EXIT_SUCCESS
+void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if !defined free && !defined EXIT_SUCCESS
+void free(void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+#if (!defined yyoverflow && \
+ (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ 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); \
+ } while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) __builtin_memcpy(Dst, Src, (Count) * sizeof(*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } while (0)
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 15
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 176
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 28
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 5
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 29
+/* YYNSTATES -- Number of states. */
+#define YYNSTATES 55
+
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 268
+
+#define YYTRANSLATE(YYX) ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
+static const yytype_uint8 yytranslate[] = {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 24, 2, 2, 2, 22, 9, 2, 26, 27, 20, 18, 2, 19, 2, 21, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 12, 2, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 10, 11, 14, 15, 16, 17, 23};
+
+#if YYDEBUG
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_uint16 yyrline[] = {0, 108, 108, 115, 116, 127, 127, 148, 148, 169,
+ 172, 175, 178, 181, 184, 187, 190, 193, 196, 221,
+ 243, 246, 249, 275, 302, 305, 308, 311, 323, 326};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 0
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] = {
+ "$end", "error", "$undefined", "TOK_CONST_INT", "TOK_IDENTIFIER",
+ "TOK_OP_OR", "TOK_OP_AND", "'|'", "'^'", "'&'",
+ "TOK_OP_EQ", "TOK_OP_NE", "'<'", "'>'", "TOK_OP_LE",
+ "TOK_OP_GE", "TOK_OP_LEFT", "TOK_OP_RIGHT", "'+'", "'-'",
+ "'*'", "'/'", "'%'", "TOK_UNARY", "'!'",
+ "'~'", "'('", "')'", "$accept", "input",
+ "expression", "$@1", "$@2", YY_NULLPTR};
+#endif
+
+#ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
+static const yytype_uint16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 124, 94, 38,
+ 262, 263, 60, 62, 264, 265, 266, 267, 43, 45,
+ 42, 47, 37, 268, 33, 126, 40, 41};
+#endif
+
+#define YYPACT_NINF -12
+
+#define yypact_value_is_default(Yystate) (!!((Yystate) == (-12)))
+
+#define YYTABLE_NINF -1
+
+#define yytable_value_is_error(Yytable_value) 0
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] = {
+ 31, -12, -12, 31, 31, 31, 31, 31, 51, 76, -12, -12, -12, -12, 53, -12, -12, -12, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, -12, 31, 31, 124,
+ 138, 26, 149, 149, -11, -11, -11, -11, 154, 154, -8, -8, -12, -12, -12, 93, 109};
+
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] = {0, 3, 4, 0, 0, 0, 0, 0, 0, 2, 28, 27, 25, 26,
+ 0, 1, 5, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 29, 0, 0, 9, 10, 11, 13, 12,
+ 17, 16, 15, 14, 19, 18, 21, 20, 24, 23, 22, 6, 8};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] = {-12, -12, -3, -12, -12};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] = {-1, 8, 9, 35, 36};
+
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_uint8 yytable[] = {
+ 10, 11, 12, 13, 14, 27, 28, 29, 30, 31, 32, 33, 31, 32, 33, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 0, 53, 54, 1, 2, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 3, 4, 15, 0, 0, 0, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 0, 0, 0, 0, 34, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 29, 30, 31, 32, 33};
+
+static const yytype_int8 yycheck[] = {
+ 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 20, 21, 22, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, -1, 35, 36, 3, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 18, 19, 0, -1, -1, -1, 24, 25, 26, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, -1, -1, -1, -1, 27, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 18, 19, 20, 21, 22};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] = {0, 3, 4, 18, 19, 24, 25, 26, 29, 30, 30, 30, 30, 30,
+ 30, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 27, 31, 32, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30};
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] = {0, 28, 29, 30, 30, 31, 30, 32, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30};
+
+/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] = {0, 2, 1, 1, 1, 0, 4, 0, 4, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3};
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK(yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror(context, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+ do \
+ { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+ } while (0)
+
+/* This macro is provided for backward compatibility. */
+# ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void)0)
+# endif
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+ do \
+ { \
+ if (yydebug) \
+ { \
+ YYFPRINTF(stderr, "%s ", Title); \
+ yy_symbol_print(stderr, Type, Value, context); \
+ YYFPRINTF(stderr, "\n"); \
+ } \
+ } while (0)
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
+
+static void yy_symbol_value_print(FILE *yyoutput,
+ int yytype,
+ YYSTYPE const *const yyvaluep,
+ Context *context)
+{
+ FILE *yyo = yyoutput;
+ YYUSE(yyo);
+ YYUSE(context);
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+ YYUSE(yytype);
+}
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+static void yy_symbol_print(FILE *yyoutput,
+ int yytype,
+ YYSTYPE const *const yyvaluep,
+ Context *context)
+{
+ YYFPRINTF(yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+ yy_symbol_value_print(yyoutput, yytype, yyvaluep, context);
+ YYFPRINTF(yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+static void yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop)
+{
+ YYFPRINTF(stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF(stderr, " %d", yybot);
+ }
+ YYFPRINTF(stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+ do \
+ { \
+ if (yydebug) \
+ yy_stack_print((Bottom), (Top)); \
+ } while (0)
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+static void yy_reduce_print(yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, Context *context)
+{
+ unsigned long int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF(stderr, " $%d = ", yyi + 1);
+ yy_symbol_print(stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]),
+ context);
+ YYFPRINTF(stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+ do \
+ { \
+ if (yydebug) \
+ yy_reduce_print(yyssp, yyvsp, Rule, context); \
+ } while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+static YYSIZE_T yystrlen(const char *yystr)
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *yystpcpy(char *yydest, const char *yysrc)
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T yytnamerr(char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes:;
+ }
+
+ if (!yyres)
+ return yystrlen(yystr);
+
+ return yystpcpy(yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int yysyntax_error(YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr(YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum
+ {
+ YYERROR_VERBOSE_ARGS_MAXIMUM = 5
+ };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
+ {
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default(yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR &&
+ !yytable_value_is_error(yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr(YY_NULLPTR, yytname[yyx]);
+ if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
+ }
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen(yyformat);
+ if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr(yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep, Context *context)
+{
+ YYUSE(yyvaluep);
+ YYUSE(context);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp);
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE(yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+/*----------.
+| yyparse. |
+`----------*/
+
+int yyparse(Context *context)
+{
+ /* The lookahead symbol. */
+ int yychar;
+
+ /* The semantic value of the lookahead symbol. */
+ /* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+ YY_INITIAL_VALUE(static YYSTYPE yyval_default;)
+ YYSTYPE yylval YY_INITIAL_VALUE(= yyval_default);
+
+ /* Number of syntax errors so far. */
+ int yynerrs;
+
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+
+ /* The stacks and their tools:
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
+
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
+
+ YYSIZE_T yystacksize;
+
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
+ YYDPRINTF((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+ goto yysetstate;
+
+ /*------------------------------------------------------------.
+ | yynewstate -- Push a new state, which is found in yystate. |
+ `------------------------------------------------------------*/
+yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow(YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1,
+ yysize * sizeof(*yyvsp), &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr = (union yyalloc *)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize));
+ if (!yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE(yyss_alloc, yyss);
+ YYSTACK_RELOCATE(yyvs_alloc, yyvs);
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE(yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+ YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int)yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF((stderr, "Entering state %d\n", yystate));
+
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+ if (yypact_value_is_default(yyn))
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF((stderr, "Reading a token: "));
+ yychar = yylex(&yylval, context);
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE(yychar);
+ YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yytable_value_is_error(yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ goto yynewstate;
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ '$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1 - yylen];
+
+ YY_REDUCE_PRINT(yyn);
+ switch (yyn)
+ {
+ case 2:
+
+ {
+ *(context->result) = static_cast<int>((yyvsp[0]));
+ YYACCEPT;
+ }
+
+ break;
+
+ case 4:
+
+ {
+ if (!context->isIgnoringErrors())
+ {
+ // This rule should be applied right after the token is lexed, so we can
+ // refer to context->token in the error message.
+ context->diagnostics->report(context->errorSettings.unexpectedIdentifier,
+ context->token->location, context->token->text);
+ *(context->valid) = false;
+ }
+ (yyval) = (yyvsp[0]);
+ }
+
+ break;
+
+ case 5:
+
+ {
+ if ((yyvsp[-1]) != 0)
+ {
+ // Ignore errors in the short-circuited part of the expression.
+ // ESSL3.00 section 3.4:
+ // If an operand is not evaluated, the presence of undefined identifiers
+ // in the operand will not cause an error.
+ // Unevaluated division by zero should not cause an error either.
+ context->startIgnoreErrors();
+ }
+ }
+
+ break;
+
+ case 6:
+
+ {
+ if ((yyvsp[-3]) != 0)
+ {
+ context->endIgnoreErrors();
+ (yyval) = static_cast<YYSTYPE>(1);
+ }
+ else
+ {
+ (yyval) = (yyvsp[-3]) || (yyvsp[0]);
+ }
+ }
+
+ break;
+
+ case 7:
+
+ {
+ if ((yyvsp[-1]) == 0)
+ {
+ // Ignore errors in the short-circuited part of the expression.
+ // ESSL3.00 section 3.4:
+ // If an operand is not evaluated, the presence of undefined identifiers
+ // in the operand will not cause an error.
+ // Unevaluated division by zero should not cause an error either.
+ context->startIgnoreErrors();
+ }
+ }
+
+ break;
+
+ case 8:
+
+ {
+ if ((yyvsp[-3]) == 0)
+ {
+ context->endIgnoreErrors();
+ (yyval) = static_cast<YYSTYPE>(0);
+ }
+ else
+ {
+ (yyval) = (yyvsp[-3]) && (yyvsp[0]);
+ }
+ }
+
+ break;
+
+ case 9:
+
+ {
+ (yyval) = (yyvsp[-2]) | (yyvsp[0]);
+ }
+
+ break;
+
+ case 10:
+
+ {
+ (yyval) = (yyvsp[-2]) ^ (yyvsp[0]);
+ }
+
+ break;
+
+ case 11:
+
+ {
+ (yyval) = (yyvsp[-2]) & (yyvsp[0]);
+ }
+
+ break;
+
+ case 12:
+
+ {
+ (yyval) = (yyvsp[-2]) != (yyvsp[0]);
+ }
+
+ break;
+
+ case 13:
+
+ {
+ (yyval) = (yyvsp[-2]) == (yyvsp[0]);
+ }
+
+ break;
+
+ case 14:
+
+ {
+ (yyval) = (yyvsp[-2]) >= (yyvsp[0]);
+ }
+
+ break;
+
+ case 15:
+
+ {
+ (yyval) = (yyvsp[-2]) <= (yyvsp[0]);
+ }
+
+ break;
+
+ case 16:
+
+ {
+ (yyval) = (yyvsp[-2]) > (yyvsp[0]);
+ }
+
+ break;
+
+ case 17:
+
+ {
+ (yyval) = (yyvsp[-2]) < (yyvsp[0]);
+ }
+
+ break;
+
+ case 18:
+
+ {
+ if ((yyvsp[0]) < 0 || (yyvsp[0]) > 31)
+ {
+ if (!context->isIgnoringErrors())
+ {
+ std::ostringstream stream;
+ stream << (yyvsp[-2]) << " >> " << (yyvsp[0]);
+ std::string text = stream.str();
+ context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
+ context->token->location, text.c_str());
+ *(context->valid) = false;
+ }
+ (yyval) = static_cast<YYSTYPE>(0);
+ }
+ else if ((yyvsp[-2]) < 0)
+ {
+ // Logical shift right.
+ (yyval) =
+ static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>((yyvsp[-2])) >> (yyvsp[0]));
+ }
+ else
+ {
+ (yyval) = (yyvsp[-2]) >> (yyvsp[0]);
+ }
+ }
+
+ break;
+
+ case 19:
+
+ {
+ if ((yyvsp[0]) < 0 || (yyvsp[0]) > 31)
+ {
+ if (!context->isIgnoringErrors())
+ {
+ std::ostringstream stream;
+ stream << (yyvsp[-2]) << " << " << (yyvsp[0]);
+ std::string text = stream.str();
+ context->diagnostics->report(angle::pp::Diagnostics::PP_UNDEFINED_SHIFT,
+ context->token->location, text.c_str());
+ *(context->valid) = false;
+ }
+ (yyval) = static_cast<YYSTYPE>(0);
+ }
+ else
+ {
+ // Logical shift left. Casting to unsigned is needed to ensure there's no signed
+ // integer overflow, which some tools treat as an error.
+ (yyval) =
+ static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>((yyvsp[-2])) << (yyvsp[0]));
+ }
+ }
+
+ break;
+
+ case 20:
+
+ {
+ (yyval) = gl::WrappingDiff<YYSTYPE>((yyvsp[-2]), (yyvsp[0]));
+ }
+
+ break;
+
+ case 21:
+
+ {
+ (yyval) = gl::WrappingSum<YYSTYPE>((yyvsp[-2]), (yyvsp[0]));
+ }
+
+ break;
+
+ case 22:
+
+ {
+ if ((yyvsp[0]) == 0)
+ {
+ if (!context->isIgnoringErrors())
+ {
+ std::ostringstream stream;
+ stream << (yyvsp[-2]) << " % " << (yyvsp[0]);
+ std::string text = stream.str();
+ context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
+ context->token->location, text.c_str());
+ *(context->valid) = false;
+ }
+ (yyval) = static_cast<YYSTYPE>(0);
+ }
+ else if (((yyvsp[-2]) == std::numeric_limits<YYSTYPE>::min()) && ((yyvsp[0]) == -1))
+ {
+ // Check for the special case where the minimum representable number is
+ // divided by -1. If left alone this has undefined results.
+ (yyval) = 0;
+ }
+ else
+ {
+ (yyval) = (yyvsp[-2]) % (yyvsp[0]);
+ }
+ }
+
+ break;
+
+ case 23:
+
+ {
+ if ((yyvsp[0]) == 0)
+ {
+ if (!context->isIgnoringErrors())
+ {
+ std::ostringstream stream;
+ stream << (yyvsp[-2]) << " / " << (yyvsp[0]);
+ std::string text = stream.str();
+ context->diagnostics->report(angle::pp::Diagnostics::PP_DIVISION_BY_ZERO,
+ context->token->location, text.c_str());
+ *(context->valid) = false;
+ }
+ (yyval) = static_cast<YYSTYPE>(0);
+ }
+ else if (((yyvsp[-2]) == std::numeric_limits<YYSTYPE>::min()) && ((yyvsp[0]) == -1))
+ {
+ // Check for the special case where the minimum representable number is
+ // divided by -1. If left alone this leads to integer overflow in C++, which
+ // has undefined results.
+ (yyval) = std::numeric_limits<YYSTYPE>::max();
+ }
+ else
+ {
+ (yyval) = (yyvsp[-2]) / (yyvsp[0]);
+ }
+ }
+
+ break;
+
+ case 24:
+
+ {
+ (yyval) = gl::WrappingMul((yyvsp[-2]), (yyvsp[0]));
+ }
+
+ break;
+
+ case 25:
+
+ {
+ (yyval) = !(yyvsp[0]);
+ }
+
+ break;
+
+ case 26:
+
+ {
+ (yyval) = ~(yyvsp[0]);
+ }
+
+ break;
+
+ case 27:
+
+ {
+ // Check for negation of minimum representable integer to prevent undefined signed int
+ // overflow.
+ if ((yyvsp[0]) == std::numeric_limits<YYSTYPE>::min())
+ {
+ (yyval) = std::numeric_limits<YYSTYPE>::min();
+ }
+ else
+ {
+ (yyval) = -(yyvsp[0]);
+ }
+ }
+
+ break;
+
+ case 28:
+
+ {
+ (yyval) = +(yyvsp[0]);
+ }
+
+ break;
+
+ case 29:
+
+ {
+ (yyval) = (yyvsp[-1]);
+ }
+
+ break;
+
+ default:
+ break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK(yylen);
+ yylen = 0;
+ YY_STACK_PRINT(yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+ /* Now 'shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
+yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE(yychar);
+
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if !YYERROR_VERBOSE
+ yyerror(context, YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error(&yymsg_alloc, &yymsg, yyssp, yytoken)
+ {
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE(yymsg);
+ yymsg = (char *)YYSTACK_ALLOC(yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror(context, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
+ }
+# undef YYSYNTAX_ERROR
+#endif
+ }
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct("Error: discarding", yytoken, &yylval, context);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK(yylen);
+ yylen = 0;
+ YY_STACK_PRINT(yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default(yyn))
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+ yydestruct("Error: popping", yystos[yystate], yyvsp, context);
+ YYPOPSTACK(1);
+ yystate = *yyssp;
+ YY_STACK_PRINT(yyss, yyssp);
+ }
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror(context, YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE(yychar);
+ yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, context);
+ }
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK(yylen);
+ YY_STACK_PRINT(yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct("Cleanup: popping", yystos[*yyssp], yyvsp, context);
+ YYPOPSTACK(1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE(yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE(yymsg);
+#endif
+ return yyresult;
+}
+
+int yylex(YYSTYPE *lvalp, Context *context)
+{
+ angle::pp::Token *token = context->token;
+ if (!context->parsePresetToken)
+ {
+ context->lexer->lex(token);
+ }
+ context->parsePresetToken = false;
+
+ int type = 0;
+
+ switch (token->type)
+ {
+ case angle::pp::Token::CONST_INT:
+ {
+ unsigned int val = 0;
+ int testVal = 0;
+ if (!token->uValue(&val) ||
+ (!token->iValue(&testVal) &&
+ context->errorSettings.integerLiteralsMustFit32BitSignedRange))
+ {
+ context->diagnostics->report(angle::pp::Diagnostics::PP_INTEGER_OVERFLOW,
+ token->location, token->text);
+ *(context->valid) = false;
+ }
+ *lvalp = static_cast<YYSTYPE>(val);
+ type = TOK_CONST_INT;
+ break;
+ }
+ case angle::pp::Token::IDENTIFIER:
+ *lvalp = static_cast<YYSTYPE>(-1);
+ type = TOK_IDENTIFIER;
+ break;
+ case angle::pp::Token::OP_OR:
+ type = TOK_OP_OR;
+ break;
+ case angle::pp::Token::OP_AND:
+ type = TOK_OP_AND;
+ break;
+ case angle::pp::Token::OP_NE:
+ type = TOK_OP_NE;
+ break;
+ case angle::pp::Token::OP_EQ:
+ type = TOK_OP_EQ;
+ break;
+ case angle::pp::Token::OP_GE:
+ type = TOK_OP_GE;
+ break;
+ case angle::pp::Token::OP_LE:
+ type = TOK_OP_LE;
+ break;
+ case angle::pp::Token::OP_RIGHT:
+ type = TOK_OP_RIGHT;
+ break;
+ case angle::pp::Token::OP_LEFT:
+ type = TOK_OP_LEFT;
+ break;
+ case '|':
+ case '^':
+ case '&':
+ case '>':
+ case '<':
+ case '-':
+ case '+':
+ case '%':
+ case '/':
+ case '*':
+ case '!':
+ case '~':
+ case '(':
+ case ')':
+ type = token->type;
+ break;
+
+ default:
+ break;
+ }
+
+ return type;
+}
+
+void yyerror(Context *context, const char *reason)
+{
+ context->diagnostics->report(angle::pp::Diagnostics::PP_INVALID_EXPRESSION,
+ context->token->location, reason);
+}
+
+namespace angle
+{
+
+namespace pp
+{
+
+ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
+ : mLexer(lexer), mDiagnostics(diagnostics)
+{}
+
+bool ExpressionParser::parse(Token *token,
+ int *result,
+ bool parsePresetToken,
+ const ErrorSettings &errorSettings,
+ bool *valid)
+{
+ Context context;
+ context.diagnostics = mDiagnostics;
+ context.lexer = mLexer;
+ context.token = token;
+ context.result = result;
+ context.ignoreErrors = 0;
+ context.parsePresetToken = parsePresetToken;
+ context.errorSettings = errorSettings;
+ context.valid = valid;
+ int ret = yyparse(&context);
+ switch (ret)
+ {
+ case 0:
+ case 1:
+ break;
+
+ case 2:
+ mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
+ break;
+
+ default:
+ assert(false);
+ mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
+ break;
+ }
+
+ return ret == 0;
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.h b/gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.h
new file mode 100644
index 0000000000..c5cd7f7d8b
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/ExpressionParser.h
@@ -0,0 +1,48 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
+#define COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
+
+#include "common/angleutils.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+class Lexer;
+struct Token;
+
+class ExpressionParser : angle::NonCopyable
+{
+ public:
+ struct ErrorSettings
+ {
+ Diagnostics::ID unexpectedIdentifier;
+ bool integerLiteralsMustFit32BitSignedRange;
+ };
+
+ ExpressionParser(Lexer *lexer, Diagnostics *diagnostics);
+
+ bool parse(Token *token,
+ int *result,
+ bool parsePresetToken,
+ const ErrorSettings &errorSettings,
+ bool *valid);
+
+ private:
+ Lexer *mLexer;
+ Diagnostics *mDiagnostics;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Input.cpp b/gfx/angle/checkout/src/compiler/preprocessor/Input.cpp
new file mode 100644
index 0000000000..8d1cac5386
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Input.cpp
@@ -0,0 +1,130 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/Input.h"
+
+#include <algorithm>
+#include <cstring>
+
+#include "common/debug.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+Input::Input() : mCount(0), mString(0) {}
+
+Input::~Input() {}
+
+Input::Input(size_t count, const char *const string[], const int length[])
+ : mCount(count), mString(string)
+{
+ mLength.reserve(mCount);
+ for (size_t i = 0; i < mCount; ++i)
+ {
+ int len = length ? length[i] : -1;
+ mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
+ }
+}
+
+const char *Input::skipChar()
+{
+ // This function should only be called when there is a character to skip.
+ ASSERT(mReadLoc.cIndex < mLength[mReadLoc.sIndex]);
+ ++mReadLoc.cIndex;
+ if (mReadLoc.cIndex == mLength[mReadLoc.sIndex])
+ {
+ ++mReadLoc.sIndex;
+ mReadLoc.cIndex = 0;
+ }
+ if (mReadLoc.sIndex >= mCount)
+ {
+ return nullptr;
+ }
+ return mString[mReadLoc.sIndex] + mReadLoc.cIndex;
+}
+
+size_t Input::read(char *buf, size_t maxSize, int *lineNo)
+{
+ size_t nRead = 0;
+ // The previous call to read might have stopped copying the string when encountering a line
+ // continuation. Check for this possibility first.
+ if (mReadLoc.sIndex < mCount && maxSize > 0)
+ {
+ const char *c = mString[mReadLoc.sIndex] + mReadLoc.cIndex;
+ if ((*c) == '\\')
+ {
+ c = skipChar();
+ if (c != nullptr && (*c) == '\n')
+ {
+ // Line continuation of backslash + newline.
+ skipChar();
+ // Fake an EOF if the line number would overflow.
+ if (*lineNo == INT_MAX)
+ {
+ return 0;
+ }
+ ++(*lineNo);
+ }
+ else if (c != nullptr && (*c) == '\r')
+ {
+ // Line continuation. Could be backslash + '\r\n' or just backslash + '\r'.
+ c = skipChar();
+ if (c != nullptr && (*c) == '\n')
+ {
+ skipChar();
+ }
+ // Fake an EOF if the line number would overflow.
+ if (*lineNo == INT_MAX)
+ {
+ return 0;
+ }
+ ++(*lineNo);
+ }
+ else
+ {
+ // Not line continuation, so write the skipped backslash to buf.
+ *buf = '\\';
+ ++nRead;
+ }
+ }
+ }
+
+ size_t maxRead = maxSize;
+ while ((nRead < maxRead) && (mReadLoc.sIndex < mCount))
+ {
+ size_t size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
+ size = std::min(size, maxSize);
+ for (size_t i = 0; i < size; ++i)
+ {
+ // Stop if a possible line continuation is encountered.
+ // It will be processed on the next call on input, which skips it
+ // and increments line number if necessary.
+ if (*(mString[mReadLoc.sIndex] + mReadLoc.cIndex + i) == '\\')
+ {
+ size = i;
+ maxRead = nRead + size; // Stop reading right before the backslash.
+ }
+ }
+ std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
+ nRead += size;
+ mReadLoc.cIndex += size;
+
+ // Advance string if we reached the end of current string.
+ if (mReadLoc.cIndex == mLength[mReadLoc.sIndex])
+ {
+ ++mReadLoc.sIndex;
+ mReadLoc.cIndex = 0;
+ }
+ }
+ return nRead;
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Input.h b/gfx/angle/checkout/src/compiler/preprocessor/Input.h
new file mode 100644
index 0000000000..e2150f899e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Input.h
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_INPUT_H_
+#define COMPILER_PREPROCESSOR_INPUT_H_
+
+#include <cstddef>
+#include <vector>
+
+namespace angle
+{
+
+namespace pp
+{
+
+// Holds and reads input for Lexer.
+class Input
+{
+ public:
+ Input();
+ ~Input();
+ Input(size_t count, const char *const string[], const int length[]);
+
+ size_t count() const { return mCount; }
+ const char *string(size_t index) const { return mString[index]; }
+ size_t length(size_t index) const { return mLength[index]; }
+
+ size_t read(char *buf, size_t maxSize, int *lineNo);
+
+ struct Location
+ {
+ size_t sIndex; // String index;
+ size_t cIndex; // Char index.
+
+ Location() : sIndex(0), cIndex(0) {}
+ };
+ const Location &readLoc() const { return mReadLoc; }
+
+ private:
+ // Skip a character and return the next character after the one that was skipped.
+ // Return nullptr if data runs out.
+ const char *skipChar();
+
+ // Input.
+ size_t mCount;
+ const char *const *mString;
+ std::vector<size_t> mLength;
+
+ Location mReadLoc;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_INPUT_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Lexer.cpp b/gfx/angle/checkout/src/compiler/preprocessor/Lexer.cpp
new file mode 100644
index 0000000000..4fc7797f56
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Lexer.cpp
@@ -0,0 +1,19 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/Lexer.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+Lexer::~Lexer() {}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Lexer.h b/gfx/angle/checkout/src/compiler/preprocessor/Lexer.h
new file mode 100644
index 0000000000..c26770745f
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Lexer.h
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_LEXER_H_
+#define COMPILER_PREPROCESSOR_LEXER_H_
+
+#include "common/angleutils.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+struct Token;
+
+class Lexer : angle::NonCopyable
+{
+ public:
+ virtual ~Lexer();
+
+ virtual void lex(Token *token) = 0;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_LEXER_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Macro.cpp b/gfx/angle/checkout/src/compiler/preprocessor/Macro.cpp
new file mode 100644
index 0000000000..a7a2f87b55
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Macro.cpp
@@ -0,0 +1,45 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/Macro.h"
+
+#include "common/angleutils.h"
+#include "compiler/preprocessor/Token.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+Macro::Macro() : predefined(false), disabled(false), expansionCount(0), type(kTypeObj) {}
+
+Macro::~Macro() {}
+
+bool Macro::equals(const Macro &other) const
+{
+ return (type == other.type) && (name == other.name) && (parameters == other.parameters) &&
+ (replacements == other.replacements);
+}
+
+void PredefineMacro(MacroSet *macroSet, const char *name, int value)
+{
+ Token token;
+ token.type = Token::CONST_INT;
+ token.text = ToString(value);
+
+ std::shared_ptr<Macro> macro = std::make_shared<Macro>();
+ macro->predefined = true;
+ macro->type = Macro::kTypeObj;
+ macro->name = name;
+ macro->replacements.push_back(token);
+
+ (*macroSet)[name] = macro;
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Macro.h b/gfx/angle/checkout/src/compiler/preprocessor/Macro.h
new file mode 100644
index 0000000000..d7880f4eb3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Macro.h
@@ -0,0 +1,55 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_MACRO_H_
+#define COMPILER_PREPROCESSOR_MACRO_H_
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace angle
+{
+
+namespace pp
+{
+
+struct Token;
+
+struct Macro
+{
+ enum Type
+ {
+ kTypeObj,
+ kTypeFunc
+ };
+ typedef std::vector<std::string> Parameters;
+ typedef std::vector<Token> Replacements;
+
+ Macro();
+ ~Macro();
+ bool equals(const Macro &other) const;
+
+ bool predefined;
+ mutable bool disabled;
+ mutable int expansionCount;
+
+ Type type;
+ std::string name;
+ Parameters parameters;
+ Replacements replacements;
+};
+
+typedef std::map<std::string, std::shared_ptr<Macro>> MacroSet;
+
+void PredefineMacro(MacroSet *macroSet, const char *name, int value);
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_MACRO_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.cpp b/gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.cpp
new file mode 100644
index 0000000000..32083c3e35
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.cpp
@@ -0,0 +1,531 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/MacroExpander.h"
+
+#include <GLSLANG/ShaderLang.h>
+#include <algorithm>
+
+#include "common/debug.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
+#include "compiler/preprocessor/Token.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+namespace
+{
+
+const size_t kMaxContextTokens = 10000;
+
+class TokenLexer : public Lexer
+{
+ public:
+ typedef std::vector<Token> TokenVector;
+
+ TokenLexer(TokenVector *tokens)
+ {
+ tokens->swap(mTokens);
+ mIter = mTokens.begin();
+ }
+
+ void lex(Token *token) override
+ {
+ if (mIter == mTokens.end())
+ {
+ token->reset();
+ token->type = Token::LAST;
+ }
+ else
+ {
+ *token = *mIter++;
+ }
+ }
+
+ private:
+ TokenVector mTokens;
+ TokenVector::const_iterator mIter;
+};
+
+} // anonymous namespace
+
+class MacroExpander::ScopedMacroReenabler final : angle::NonCopyable
+{
+ public:
+ ScopedMacroReenabler(MacroExpander *expander);
+ ~ScopedMacroReenabler();
+
+ private:
+ MacroExpander *mExpander;
+};
+
+MacroExpander::ScopedMacroReenabler::ScopedMacroReenabler(MacroExpander *expander)
+ : mExpander(expander)
+{
+ mExpander->mDeferReenablingMacros = true;
+}
+
+MacroExpander::ScopedMacroReenabler::~ScopedMacroReenabler()
+{
+ mExpander->mDeferReenablingMacros = false;
+ for (const std::shared_ptr<Macro> &macro : mExpander->mMacrosToReenable)
+ {
+ // Copying the string here by using substr is a check for use-after-free. It detects
+ // use-after-free more reliably than just toggling the disabled flag.
+ ASSERT(macro->name.substr() != "");
+ macro->disabled = false;
+ }
+ mExpander->mMacrosToReenable.clear();
+}
+
+MacroExpander::MacroExpander(Lexer *lexer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ const PreprocessorSettings &settings,
+ bool parseDefined)
+ : mLexer(lexer),
+ mMacroSet(macroSet),
+ mDiagnostics(diagnostics),
+ mParseDefined(parseDefined),
+ mTotalTokensInContexts(0),
+ mSettings(settings),
+ mDeferReenablingMacros(false)
+{}
+
+MacroExpander::~MacroExpander()
+{
+ ASSERT(mMacrosToReenable.empty());
+ for (MacroContext *context : mContextStack)
+ {
+ delete context;
+ }
+}
+
+void MacroExpander::lex(Token *token)
+{
+ while (true)
+ {
+ getToken(token);
+
+ if (token->type != Token::IDENTIFIER)
+ break;
+
+ // Defined operator is parsed here since it may be generated by macro expansion.
+ // Defined operator produced by macro expansion has undefined behavior according to C++
+ // spec, which the GLSL spec references (see C++14 draft spec section 16.1.4), but this
+ // behavior is needed for passing dEQP tests, which enforce stricter compatibility between
+ // implementations.
+ if (mParseDefined && token->text == kDefined)
+ {
+ // Defined inside a macro is forbidden in WebGL.
+ if (!mContextStack.empty() && sh::IsWebGLBasedSpec(mSettings.shaderSpec))
+ break;
+
+ bool paren = false;
+ getToken(token);
+ if (token->type == '(')
+ {
+ paren = true;
+ getToken(token);
+ }
+ if (token->type != Token::IDENTIFIER)
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ break;
+ }
+ auto iter = mMacroSet->find(token->text);
+ std::string expression = iter != mMacroSet->end() ? "1" : "0";
+
+ if (paren)
+ {
+ getToken(token);
+ if (token->type != ')')
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
+ token->text);
+ break;
+ }
+ }
+
+ // We have a valid defined operator.
+ // Convert the current token into a CONST_INT token.
+ token->type = Token::CONST_INT;
+ token->text = expression;
+ break;
+ }
+
+ if (token->expansionDisabled())
+ break;
+
+ MacroSet::const_iterator iter = mMacroSet->find(token->text);
+ if (iter == mMacroSet->end())
+ break;
+
+ std::shared_ptr<Macro> macro = iter->second;
+ if (macro->disabled)
+ {
+ // If a particular token is not expanded, it is never expanded.
+ token->setExpansionDisabled(true);
+ break;
+ }
+
+ // Bump the expansion count before peeking if the next token is a '('
+ // otherwise there could be a #undef of the macro before the next token.
+ macro->expansionCount++;
+ if ((macro->type == Macro::kTypeFunc) && !isNextTokenLeftParen())
+ {
+ // If the token immediately after the macro name is not a '(',
+ // this macro should not be expanded.
+ macro->expansionCount--;
+ break;
+ }
+
+ pushMacro(macro, *token);
+ }
+}
+
+void MacroExpander::getToken(Token *token)
+{
+ if (mReserveToken.get())
+ {
+ *token = *mReserveToken;
+ mReserveToken.reset();
+ return;
+ }
+
+ // First pop all empty macro contexts.
+ while (!mContextStack.empty() && mContextStack.back()->empty())
+ {
+ popMacro();
+ }
+
+ if (!mContextStack.empty())
+ {
+ *token = mContextStack.back()->get();
+ }
+ else
+ {
+ ASSERT(mTotalTokensInContexts == 0);
+ mLexer->lex(token);
+ }
+}
+
+void MacroExpander::ungetToken(const Token &token)
+{
+ if (!mContextStack.empty())
+ {
+ MacroContext *context = mContextStack.back();
+ context->unget();
+ ASSERT(context->replacements[context->index] == token);
+ }
+ else
+ {
+ ASSERT(!mReserveToken.get());
+ mReserveToken.reset(new Token(token));
+ }
+}
+
+bool MacroExpander::isNextTokenLeftParen()
+{
+ Token token;
+ getToken(&token);
+
+ bool lparen = token.type == '(';
+ ungetToken(token);
+
+ return lparen;
+}
+
+bool MacroExpander::pushMacro(std::shared_ptr<Macro> macro, const Token &identifier)
+{
+ ASSERT(!macro->disabled);
+ ASSERT(!identifier.expansionDisabled());
+ ASSERT(identifier.type == Token::IDENTIFIER);
+ ASSERT(identifier.text == macro->name);
+
+ std::vector<Token> replacements;
+ if (!expandMacro(*macro, identifier, &replacements))
+ return false;
+
+ // Macro is disabled for expansion until it is popped off the stack.
+ macro->disabled = true;
+
+ MacroContext *context = new MacroContext;
+ context->macro = macro;
+ context->replacements.swap(replacements);
+ mContextStack.push_back(context);
+ mTotalTokensInContexts += context->replacements.size();
+ return true;
+}
+
+void MacroExpander::popMacro()
+{
+ ASSERT(!mContextStack.empty());
+
+ MacroContext *context = mContextStack.back();
+ mContextStack.pop_back();
+
+ ASSERT(context->empty());
+ ASSERT(context->macro->disabled);
+ ASSERT(context->macro->expansionCount > 0);
+ if (mDeferReenablingMacros)
+ {
+ mMacrosToReenable.push_back(context->macro);
+ }
+ else
+ {
+ context->macro->disabled = false;
+ }
+ context->macro->expansionCount--;
+ mTotalTokensInContexts -= context->replacements.size();
+ delete context;
+}
+
+bool MacroExpander::expandMacro(const Macro &macro,
+ const Token &identifier,
+ std::vector<Token> *replacements)
+{
+ replacements->clear();
+
+ // In the case of an object-like macro, the replacement list gets its location
+ // from the identifier, but in the case of a function-like macro, the replacement
+ // list gets its location from the closing parenthesis of the macro invocation.
+ // This is tested by dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.*
+ SourceLocation replacementLocation = identifier.location;
+ if (macro.type == Macro::kTypeObj)
+ {
+ replacements->assign(macro.replacements.begin(), macro.replacements.end());
+
+ if (macro.predefined)
+ {
+ const char kLine[] = "__LINE__";
+ const char kFile[] = "__FILE__";
+
+ ASSERT(replacements->size() == 1);
+ Token &repl = replacements->front();
+ if (macro.name == kLine)
+ {
+ repl.text = ToString(identifier.location.line);
+ }
+ else if (macro.name == kFile)
+ {
+ repl.text = ToString(identifier.location.file);
+ }
+ }
+ }
+ else
+ {
+ ASSERT(macro.type == Macro::kTypeFunc);
+ std::vector<MacroArg> args;
+ args.reserve(macro.parameters.size());
+ if (!collectMacroArgs(macro, identifier, &args, &replacementLocation))
+ return false;
+
+ replaceMacroParams(macro, args, replacements);
+ }
+
+ for (std::size_t i = 0; i < replacements->size(); ++i)
+ {
+ Token &repl = replacements->at(i);
+ if (i == 0)
+ {
+ // The first token in the replacement list inherits the padding
+ // properties of the identifier token.
+ repl.setAtStartOfLine(identifier.atStartOfLine());
+ repl.setHasLeadingSpace(identifier.hasLeadingSpace());
+ }
+ repl.location = replacementLocation;
+ }
+ return true;
+}
+
+bool MacroExpander::collectMacroArgs(const Macro &macro,
+ const Token &identifier,
+ std::vector<MacroArg> *args,
+ SourceLocation *closingParenthesisLocation)
+{
+ Token token;
+ getToken(&token);
+ ASSERT(token.type == '(');
+
+ args->push_back(MacroArg());
+
+ // Defer reenabling macros until args collection is finished to avoid the possibility of
+ // infinite recursion. Otherwise infinite recursion might happen when expanding the args after
+ // macros have been popped from the context stack when parsing the args.
+ ScopedMacroReenabler deferReenablingMacros(this);
+
+ int openParens = 1;
+ while (openParens != 0)
+ {
+ getToken(&token);
+
+ if (token.type == Token::LAST)
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_UNTERMINATED_INVOCATION, identifier.location,
+ identifier.text);
+ // Do not lose EOF token.
+ ungetToken(token);
+ return false;
+ }
+
+ bool isArg = false; // True if token is part of the current argument.
+ switch (token.type)
+ {
+ case '(':
+ ++openParens;
+ isArg = true;
+ break;
+ case ')':
+ --openParens;
+ isArg = openParens != 0;
+ *closingParenthesisLocation = token.location;
+ break;
+ case ',':
+ // The individual arguments are separated by comma tokens, but
+ // the comma tokens between matching inner parentheses do not
+ // seperate arguments.
+ if (openParens == 1)
+ args->push_back(MacroArg());
+ isArg = openParens != 1;
+ break;
+ default:
+ isArg = true;
+ break;
+ }
+ if (isArg)
+ {
+ MacroArg &arg = args->back();
+ // Initial whitespace is not part of the argument.
+ if (arg.empty())
+ token.setHasLeadingSpace(false);
+ arg.push_back(token);
+ }
+ }
+
+ const Macro::Parameters &params = macro.parameters;
+ // If there is only one empty argument, it is equivalent to no argument.
+ if (params.empty() && (args->size() == 1) && args->front().empty())
+ {
+ args->clear();
+ }
+ // Validate the number of arguments.
+ if (args->size() != params.size())
+ {
+ Diagnostics::ID id = args->size() < macro.parameters.size()
+ ? Diagnostics::PP_MACRO_TOO_FEW_ARGS
+ : Diagnostics::PP_MACRO_TOO_MANY_ARGS;
+ mDiagnostics->report(id, identifier.location, identifier.text);
+ return false;
+ }
+
+ // Pre-expand each argument before substitution.
+ // This step expands each argument individually before they are
+ // inserted into the macro body.
+ size_t numTokens = 0;
+ for (auto &arg : *args)
+ {
+ TokenLexer lexer(&arg);
+ if (mSettings.maxMacroExpansionDepth < 1)
+ {
+ mDiagnostics->report(Diagnostics::PP_MACRO_INVOCATION_CHAIN_TOO_DEEP, token.location,
+ token.text);
+ return false;
+ }
+ PreprocessorSettings nestedSettings(mSettings.shaderSpec);
+ nestedSettings.maxMacroExpansionDepth = mSettings.maxMacroExpansionDepth - 1;
+ MacroExpander expander(&lexer, mMacroSet, mDiagnostics, nestedSettings, mParseDefined);
+
+ arg.clear();
+ expander.lex(&token);
+ while (token.type != Token::LAST)
+ {
+ arg.push_back(token);
+ expander.lex(&token);
+ numTokens++;
+ if (numTokens + mTotalTokensInContexts > kMaxContextTokens)
+ {
+ mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token.location, token.text);
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+void MacroExpander::replaceMacroParams(const Macro &macro,
+ const std::vector<MacroArg> &args,
+ std::vector<Token> *replacements)
+{
+ for (std::size_t i = 0; i < macro.replacements.size(); ++i)
+ {
+ if (!replacements->empty() &&
+ replacements->size() + mTotalTokensInContexts > kMaxContextTokens)
+ {
+ const Token &token = replacements->back();
+ mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token.location, token.text);
+ return;
+ }
+
+ const Token &repl = macro.replacements[i];
+ if (repl.type != Token::IDENTIFIER)
+ {
+ replacements->push_back(repl);
+ continue;
+ }
+
+ // TODO(alokp): Optimize this.
+ // There is no need to search for macro params every time.
+ // The param index can be cached with the replacement token.
+ Macro::Parameters::const_iterator iter =
+ std::find(macro.parameters.begin(), macro.parameters.end(), repl.text);
+ if (iter == macro.parameters.end())
+ {
+ replacements->push_back(repl);
+ continue;
+ }
+
+ std::size_t iArg = std::distance(macro.parameters.begin(), iter);
+ const MacroArg &arg = args[iArg];
+ if (arg.empty())
+ {
+ continue;
+ }
+ std::size_t iRepl = replacements->size();
+ replacements->insert(replacements->end(), arg.begin(), arg.end());
+ // The replacement token inherits padding properties from
+ // macro replacement token.
+ replacements->at(iRepl).setHasLeadingSpace(repl.hasLeadingSpace());
+ }
+}
+
+MacroExpander::MacroContext::MacroContext() : macro(0), index(0) {}
+
+MacroExpander::MacroContext::~MacroContext() {}
+
+bool MacroExpander::MacroContext::empty() const
+{
+ return index == replacements.size();
+}
+
+const Token &MacroExpander::MacroContext::get()
+{
+ return replacements[index++];
+}
+
+void MacroExpander::MacroContext::unget()
+{
+ ASSERT(index > 0);
+ --index;
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.h b/gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.h
new file mode 100644
index 0000000000..837bd73302
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/MacroExpander.h
@@ -0,0 +1,91 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_MACROEXPANDER_H_
+#define COMPILER_PREPROCESSOR_MACROEXPANDER_H_
+
+#include <memory>
+#include <vector>
+
+#include "compiler/preprocessor/Lexer.h"
+#include "compiler/preprocessor/Macro.h"
+#include "compiler/preprocessor/Preprocessor.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+class Diagnostics;
+struct SourceLocation;
+
+class MacroExpander : public Lexer
+{
+ public:
+ MacroExpander(Lexer *lexer,
+ MacroSet *macroSet,
+ Diagnostics *diagnostics,
+ const PreprocessorSettings &settings,
+ bool parseDefined);
+ ~MacroExpander() override;
+
+ void lex(Token *token) override;
+
+ private:
+ void getToken(Token *token);
+ void ungetToken(const Token &token);
+ bool isNextTokenLeftParen();
+
+ bool pushMacro(std::shared_ptr<Macro> macro, const Token &identifier);
+ void popMacro();
+
+ bool expandMacro(const Macro &macro, const Token &identifier, std::vector<Token> *replacements);
+
+ typedef std::vector<Token> MacroArg;
+ bool collectMacroArgs(const Macro &macro,
+ const Token &identifier,
+ std::vector<MacroArg> *args,
+ SourceLocation *closingParenthesisLocation);
+ void replaceMacroParams(const Macro &macro,
+ const std::vector<MacroArg> &args,
+ std::vector<Token> *replacements);
+
+ struct MacroContext
+ {
+ MacroContext();
+ ~MacroContext();
+ bool empty() const;
+ const Token &get();
+ void unget();
+
+ std::shared_ptr<Macro> macro;
+ std::size_t index;
+ std::vector<Token> replacements;
+ };
+
+ Lexer *mLexer;
+ MacroSet *mMacroSet;
+ Diagnostics *mDiagnostics;
+ bool mParseDefined;
+
+ std::unique_ptr<Token> mReserveToken;
+ std::vector<MacroContext *> mContextStack;
+ size_t mTotalTokensInContexts;
+
+ PreprocessorSettings mSettings;
+
+ bool mDeferReenablingMacros;
+ std::vector<std::shared_ptr<Macro>> mMacrosToReenable;
+
+ class ScopedMacroReenabler;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_MACROEXPANDER_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.cpp b/gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.cpp
new file mode 100644
index 0000000000..ec6f7e1430
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.cpp
@@ -0,0 +1,107 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/Preprocessor.h"
+
+#include "common/debug.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
+#include "compiler/preprocessor/DirectiveParser.h"
+#include "compiler/preprocessor/Macro.h"
+#include "compiler/preprocessor/MacroExpander.h"
+#include "compiler/preprocessor/Token.h"
+#include "compiler/preprocessor/Tokenizer.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+struct PreprocessorImpl
+{
+ Diagnostics *diagnostics;
+ MacroSet macroSet;
+ Tokenizer tokenizer;
+ DirectiveParser directiveParser;
+ MacroExpander macroExpander;
+
+ PreprocessorImpl(Diagnostics *diag,
+ DirectiveHandler *directiveHandler,
+ const PreprocessorSettings &settings)
+ : diagnostics(diag),
+ tokenizer(diag),
+ directiveParser(&tokenizer, &macroSet, diag, directiveHandler, settings),
+ macroExpander(&directiveParser, &macroSet, diag, settings, false)
+ {}
+};
+
+Preprocessor::Preprocessor(Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler,
+ const PreprocessorSettings &settings)
+{
+ mImpl = new PreprocessorImpl(diagnostics, directiveHandler, settings);
+}
+
+Preprocessor::~Preprocessor()
+{
+ delete mImpl;
+}
+
+bool Preprocessor::init(size_t count, const char *const string[], const int length[])
+{
+ static const int kDefaultGLSLVersion = 100;
+
+ // Add standard pre-defined macros.
+ predefineMacro("__LINE__", 0);
+ predefineMacro("__FILE__", 0);
+ predefineMacro("__VERSION__", kDefaultGLSLVersion);
+ predefineMacro("GL_ES", 1);
+
+ return mImpl->tokenizer.init(count, string, length);
+}
+
+void Preprocessor::predefineMacro(const char *name, int value)
+{
+ PredefineMacro(&mImpl->macroSet, name, value);
+}
+
+void Preprocessor::lex(Token *token)
+{
+ bool validToken = false;
+ while (!validToken)
+ {
+ mImpl->macroExpander.lex(token);
+ switch (token->type)
+ {
+ // We should not be returning internal preprocessing tokens.
+ // Convert preprocessing tokens to compiler tokens or report
+ // diagnostics.
+ case Token::PP_HASH:
+ UNREACHABLE();
+ break;
+ case Token::PP_NUMBER:
+ mImpl->diagnostics->report(Diagnostics::PP_INVALID_NUMBER, token->location,
+ token->text);
+ break;
+ case Token::PP_OTHER:
+ mImpl->diagnostics->report(Diagnostics::PP_INVALID_CHARACTER, token->location,
+ token->text);
+ break;
+ default:
+ validToken = true;
+ break;
+ }
+ }
+}
+
+void Preprocessor::setMaxTokenSize(size_t maxTokenSize)
+{
+ mImpl->tokenizer.setMaxTokenSize(maxTokenSize);
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.h b/gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.h
new file mode 100644
index 0000000000..58b4a70ec7
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Preprocessor.h
@@ -0,0 +1,72 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_PREPROCESSOR_H_
+#define COMPILER_PREPROCESSOR_PREPROCESSOR_H_
+
+#include <cstddef>
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/angleutils.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+class Diagnostics;
+class DirectiveHandler;
+struct PreprocessorImpl;
+struct Token;
+
+struct PreprocessorSettings final
+{
+ PreprocessorSettings(ShShaderSpec shaderSpec)
+ : maxMacroExpansionDepth(1000), shaderSpec(shaderSpec)
+ {}
+
+ PreprocessorSettings(const PreprocessorSettings &other) = default;
+
+ int maxMacroExpansionDepth;
+ ShShaderSpec shaderSpec;
+};
+
+class Preprocessor : angle::NonCopyable
+{
+ public:
+ Preprocessor(Diagnostics *diagnostics,
+ DirectiveHandler *directiveHandler,
+ const PreprocessorSettings &settings);
+ ~Preprocessor();
+
+ // count: specifies the number of elements in the string and length arrays.
+ // string: specifies an array of pointers to strings.
+ // length: specifies an array of string lengths.
+ // If length is NULL, each string is assumed to be null terminated.
+ // If length is a value other than NULL, it points to an array containing
+ // a string length for each of the corresponding elements of string.
+ // Each element in the length array may contain the length of the
+ // corresponding string or a value less than 0 to indicate that the string
+ // is null terminated.
+ bool init(size_t count, const char *const string[], const int length[]);
+ // Adds a pre-defined macro.
+ void predefineMacro(const char *name, int value);
+
+ void lex(Token *token);
+
+ // Set maximum preprocessor token size
+ void setMaxTokenSize(size_t maxTokenSize);
+
+ private:
+ PreprocessorImpl *mImpl;
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_PREPROCESSOR_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/SourceLocation.h b/gfx/angle/checkout/src/compiler/preprocessor/SourceLocation.h
new file mode 100644
index 0000000000..61d1af057c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/SourceLocation.h
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_
+#define COMPILER_PREPROCESSOR_SOURCELOCATION_H_
+
+namespace angle
+{
+
+namespace pp
+{
+
+struct SourceLocation
+{
+ SourceLocation() : file(0), line(0) {}
+ SourceLocation(int f, int l) : file(f), line(l) {}
+
+ bool equals(const SourceLocation &other) const
+ {
+ return (file == other.file) && (line == other.line);
+ }
+
+ int file;
+ int line;
+};
+
+inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
+{
+ return lhs.equals(rhs);
+}
+
+inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
+{
+ return !lhs.equals(rhs);
+}
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_SOURCELOCATION_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Token.cpp b/gfx/angle/checkout/src/compiler/preprocessor/Token.cpp
new file mode 100644
index 0000000000..45b917bf03
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Token.cpp
@@ -0,0 +1,79 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/preprocessor/Token.h"
+
+#include "common/debug.h"
+#include "compiler/preprocessor/numeric_lex.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+void Token::reset()
+{
+ type = 0;
+ flags = 0;
+ location = SourceLocation();
+ text.clear();
+}
+
+bool Token::equals(const Token &other) const
+{
+ return (type == other.type) && (flags == other.flags) && (location == other.location) &&
+ (text == other.text);
+}
+
+void Token::setAtStartOfLine(bool start)
+{
+ if (start)
+ flags |= AT_START_OF_LINE;
+ else
+ flags &= ~AT_START_OF_LINE;
+}
+
+void Token::setHasLeadingSpace(bool space)
+{
+ if (space)
+ flags |= HAS_LEADING_SPACE;
+ else
+ flags &= ~HAS_LEADING_SPACE;
+}
+
+void Token::setExpansionDisabled(bool disable)
+{
+ if (disable)
+ flags |= EXPANSION_DISABLED;
+ else
+ flags &= ~EXPANSION_DISABLED;
+}
+
+bool Token::iValue(int *value) const
+{
+ ASSERT(type == CONST_INT);
+ return numeric_lex_int(text, value);
+}
+
+bool Token::uValue(unsigned int *value) const
+{
+ ASSERT(type == CONST_INT);
+ return numeric_lex_int(text, value);
+}
+
+std::ostream &operator<<(std::ostream &out, const Token &token)
+{
+ if (token.hasLeadingSpace())
+ out << " ";
+
+ out << token.text;
+ return out;
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Token.h b/gfx/angle/checkout/src/compiler/preprocessor/Token.h
new file mode 100644
index 0000000000..436c5b6db7
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Token.h
@@ -0,0 +1,115 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_TOKEN_H_
+#define COMPILER_PREPROCESSOR_TOKEN_H_
+
+#include <ostream>
+#include <string>
+
+#include "compiler/preprocessor/SourceLocation.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+struct Token
+{
+ enum Type
+ {
+ // Calling this ERROR causes a conflict with wingdi.h
+ GOT_ERROR = -1,
+ LAST = 0, // EOF.
+
+ IDENTIFIER = 258,
+
+ CONST_INT,
+ CONST_FLOAT,
+
+ OP_INC,
+ OP_DEC,
+ OP_LEFT,
+ OP_RIGHT,
+ OP_LE,
+ OP_GE,
+ OP_EQ,
+ OP_NE,
+ OP_AND,
+ OP_XOR,
+ OP_OR,
+ OP_ADD_ASSIGN,
+ OP_SUB_ASSIGN,
+ OP_MUL_ASSIGN,
+ OP_DIV_ASSIGN,
+ OP_MOD_ASSIGN,
+ OP_LEFT_ASSIGN,
+ OP_RIGHT_ASSIGN,
+ OP_AND_ASSIGN,
+ OP_XOR_ASSIGN,
+ OP_OR_ASSIGN,
+
+ // Preprocessing token types.
+ // These types are used by the preprocessor internally.
+ // Preprocessor clients must not depend or check for them.
+ PP_HASH,
+ PP_NUMBER,
+ PP_OTHER
+ };
+ enum Flags
+ {
+ AT_START_OF_LINE = 1 << 0,
+ HAS_LEADING_SPACE = 1 << 1,
+ EXPANSION_DISABLED = 1 << 2
+ };
+
+ Token() : type(0), flags(0) {}
+
+ void reset();
+ bool equals(const Token &other) const;
+
+ // Returns true if this is the first token on line.
+ // It disregards any leading whitespace.
+ bool atStartOfLine() const { return (flags & AT_START_OF_LINE) != 0; }
+ void setAtStartOfLine(bool start);
+
+ bool hasLeadingSpace() const { return (flags & HAS_LEADING_SPACE) != 0; }
+ void setHasLeadingSpace(bool space);
+
+ bool expansionDisabled() const { return (flags & EXPANSION_DISABLED) != 0; }
+ void setExpansionDisabled(bool disable);
+
+ // Converts text into numeric value for CONST_INT and CONST_FLOAT token.
+ // Returns false if the parsed value cannot fit into an int or float.
+ bool iValue(int *value) const;
+ bool uValue(unsigned int *value) const;
+
+ int type;
+ unsigned int flags;
+ SourceLocation location;
+ std::string text;
+};
+
+inline bool operator==(const Token &lhs, const Token &rhs)
+{
+ return lhs.equals(rhs);
+}
+
+inline bool operator!=(const Token &lhs, const Token &rhs)
+{
+ return !lhs.equals(rhs);
+}
+
+std::ostream &operator<<(std::ostream &out, const Token &token);
+
+constexpr char kDefined[] = "defined";
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_TOKEN_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp
new file mode 100644
index 0000000000..2ce67b7386
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp
@@ -0,0 +1,2613 @@
+#line 16 "./Tokenizer.l"
+//
+// 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.
+//
+
+// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 4
+#if YY_FLEX_SUBMINOR_VERSION > 0
+# define FLEX_BETA
+#endif
+
+#ifdef yy_create_buffer
+# define pp_create_buffer_ALREADY_DEFINED
+#else
+# define yy_create_buffer pp_create_buffer
+#endif
+
+#ifdef yy_delete_buffer
+# define pp_delete_buffer_ALREADY_DEFINED
+#else
+# define yy_delete_buffer pp_delete_buffer
+#endif
+
+#ifdef yy_scan_buffer
+# define pp_scan_buffer_ALREADY_DEFINED
+#else
+# define yy_scan_buffer pp_scan_buffer
+#endif
+
+#ifdef yy_scan_string
+# define pp_scan_string_ALREADY_DEFINED
+#else
+# define yy_scan_string pp_scan_string
+#endif
+
+#ifdef yy_scan_bytes
+# define pp_scan_bytes_ALREADY_DEFINED
+#else
+# define yy_scan_bytes pp_scan_bytes
+#endif
+
+#ifdef yy_init_buffer
+# define pp_init_buffer_ALREADY_DEFINED
+#else
+# define yy_init_buffer pp_init_buffer
+#endif
+
+#ifdef yy_flush_buffer
+# define pp_flush_buffer_ALREADY_DEFINED
+#else
+# define yy_flush_buffer pp_flush_buffer
+#endif
+
+#ifdef yy_load_buffer_state
+# define pp_load_buffer_state_ALREADY_DEFINED
+#else
+# define yy_load_buffer_state pp_load_buffer_state
+#endif
+
+#ifdef yy_switch_to_buffer
+# define pp_switch_to_buffer_ALREADY_DEFINED
+#else
+# define yy_switch_to_buffer pp_switch_to_buffer
+#endif
+
+#ifdef yypush_buffer_state
+# define pppush_buffer_state_ALREADY_DEFINED
+#else
+# define yypush_buffer_state pppush_buffer_state
+#endif
+
+#ifdef yypop_buffer_state
+# define pppop_buffer_state_ALREADY_DEFINED
+#else
+# define yypop_buffer_state pppop_buffer_state
+#endif
+
+#ifdef yyensure_buffer_stack
+# define ppensure_buffer_stack_ALREADY_DEFINED
+#else
+# define yyensure_buffer_stack ppensure_buffer_stack
+#endif
+
+#ifdef yylex
+# define pplex_ALREADY_DEFINED
+#else
+# define yylex pplex
+#endif
+
+#ifdef yyrestart
+# define pprestart_ALREADY_DEFINED
+#else
+# define yyrestart pprestart
+#endif
+
+#ifdef yylex_init
+# define pplex_init_ALREADY_DEFINED
+#else
+# define yylex_init pplex_init
+#endif
+
+#ifdef yylex_init_extra
+# define pplex_init_extra_ALREADY_DEFINED
+#else
+# define yylex_init_extra pplex_init_extra
+#endif
+
+#ifdef yylex_destroy
+# define pplex_destroy_ALREADY_DEFINED
+#else
+# define yylex_destroy pplex_destroy
+#endif
+
+#ifdef yyget_debug
+# define ppget_debug_ALREADY_DEFINED
+#else
+# define yyget_debug ppget_debug
+#endif
+
+#ifdef yyset_debug
+# define ppset_debug_ALREADY_DEFINED
+#else
+# define yyset_debug ppset_debug
+#endif
+
+#ifdef yyget_extra
+# define ppget_extra_ALREADY_DEFINED
+#else
+# define yyget_extra ppget_extra
+#endif
+
+#ifdef yyset_extra
+# define ppset_extra_ALREADY_DEFINED
+#else
+# define yyset_extra ppset_extra
+#endif
+
+#ifdef yyget_in
+# define ppget_in_ALREADY_DEFINED
+#else
+# define yyget_in ppget_in
+#endif
+
+#ifdef yyset_in
+# define ppset_in_ALREADY_DEFINED
+#else
+# define yyset_in ppset_in
+#endif
+
+#ifdef yyget_out
+# define ppget_out_ALREADY_DEFINED
+#else
+# define yyget_out ppget_out
+#endif
+
+#ifdef yyset_out
+# define ppset_out_ALREADY_DEFINED
+#else
+# define yyset_out ppset_out
+#endif
+
+#ifdef yyget_leng
+# define ppget_leng_ALREADY_DEFINED
+#else
+# define yyget_leng ppget_leng
+#endif
+
+#ifdef yyget_text
+# define ppget_text_ALREADY_DEFINED
+#else
+# define yyget_text ppget_text
+#endif
+
+#ifdef yyget_lineno
+# define ppget_lineno_ALREADY_DEFINED
+#else
+# define yyget_lineno ppget_lineno
+#endif
+
+#ifdef yyset_lineno
+# define ppset_lineno_ALREADY_DEFINED
+#else
+# define yyset_lineno ppset_lineno
+#endif
+
+#ifdef yyget_column
+# define ppget_column_ALREADY_DEFINED
+#else
+# define yyget_column ppget_column
+#endif
+
+#ifdef yyset_column
+# define ppset_column_ALREADY_DEFINED
+#else
+# define yyset_column ppset_column
+#endif
+
+#ifdef yywrap
+# define ppwrap_ALREADY_DEFINED
+#else
+# define yywrap ppwrap
+#endif
+
+#ifdef yyget_lval
+# define ppget_lval_ALREADY_DEFINED
+#else
+# define yyget_lval ppget_lval
+#endif
+
+#ifdef yyset_lval
+# define ppset_lval_ALREADY_DEFINED
+#else
+# define yyset_lval ppset_lval
+#endif
+
+#ifdef yyget_lloc
+# define ppget_lloc_ALREADY_DEFINED
+#else
+# define yyget_lloc ppget_lloc
+#endif
+
+#ifdef yyset_lloc
+# define ppset_lloc_ALREADY_DEFINED
+#else
+# define yyset_lloc ppset_lloc
+#endif
+
+#ifdef yyalloc
+# define ppalloc_ALREADY_DEFINED
+#else
+# define yyalloc ppalloc
+#endif
+
+#ifdef yyrealloc
+# define pprealloc_ALREADY_DEFINED
+#else
+# define yyrealloc pprealloc
+#endif
+
+#ifdef yyfree
+# define ppfree_ALREADY_DEFINED
+#else
+# define yyfree ppfree
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+# define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+# ifndef __STDC_LIMIT_MACROS
+# define __STDC_LIMIT_MACROS 1
+# endif
+
+# include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+# else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+# ifndef INT8_MIN
+# define INT8_MIN (-128)
+# endif
+# ifndef INT16_MIN
+# define INT16_MIN (-32767 - 1)
+# endif
+# ifndef INT32_MIN
+# define INT32_MIN (-2147483647 - 1)
+# endif
+# ifndef INT8_MAX
+# define INT8_MAX (127)
+# endif
+# ifndef INT16_MAX
+# define INT16_MAX (32767)
+# endif
+# ifndef INT32_MAX
+# define INT32_MAX (2147483647)
+# endif
+# ifndef UINT8_MAX
+# define UINT8_MAX (255U)
+# endif
+# ifndef UINT16_MAX
+# define UINT16_MAX (65535U)
+# endif
+# ifndef UINT32_MAX
+# define UINT32_MAX (4294967295U)
+# endif
+
+# ifndef SIZE_MAX
+# define SIZE_MAX (~(size_t)0)
+# endif
+
+# endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+
+/* TODO: this is always defined, so inline it */
+#define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+# define yynoreturn __attribute__((__noreturn__))
+#else
+# define yynoreturn
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an
+ * integer in range [0..255] for use as an array index.
+ */
+#define YY_SC_TO_UI(c) ((YY_CHAR)(c))
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+# define YY_TYPEDEF_YY_SCANNER_T
+typedef void *yyscan_t;
+#endif
+
+/* For convenience, these vars (plus the bison vars far below)
+ are macros in the reentrant scanner. */
+#define yyin yyg->yyin_r
+#define yyout yyg->yyout_r
+#define yyextra yyg->yyextra_r
+#define yyleng yyg->yyleng_r
+#define yytext yyg->yytext_r
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug yyg->yy_flex_debug_r
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yyg->yy_start = 1 + 2 *
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yyg->yy_start - 1) / 2)
+#define YYSTATE YY_START
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin, yyscanner)
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+# ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+# define YY_BUF_SIZE 32768
+# else
+# define YY_BUF_SIZE 16384
+# endif /* __ia64__ */
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+# define YY_TYPEDEF_YY_BUFFER_STATE
+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
+
+#define YY_LESS_LINENO(n)
+#define YY_LINENO_REWIND_TO(ptr)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg); \
+ *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)
+#define unput(c) yyunput(c, yyg->yytext_ptr, yyscanner)
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+# define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+{
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ int yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int 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
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* 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;
+
+ /* 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;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+# define YY_BUFFER_NEW 0
+# define YY_BUFFER_NORMAL 1
+ /* 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.
+ */
+# define YY_BUFFER_EOF_PENDING 2
+};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER \
+ (yyg->yy_buffer_stack ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] : NULL)
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+
+void yyrestart(FILE *input_file, yyscan_t yyscanner);
+void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner);
+YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner);
+void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner);
+void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner);
+void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner);
+void yypop_buffer_state(yyscan_t yyscanner);
+
+static void yyensure_buffer_stack(yyscan_t yyscanner);
+static void yy_load_buffer_state(yyscan_t yyscanner);
+static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner);
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER, yyscanner)
+
+YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner);
+YY_BUFFER_STATE yy_scan_string(const char *yy_str, yyscan_t yyscanner);
+YY_BUFFER_STATE yy_scan_bytes(const char *bytes, int len, yyscan_t yyscanner);
+
+void *yyalloc(yy_size_t, yyscan_t yyscanner);
+void *yyrealloc(void *, yy_size_t, yyscan_t yyscanner);
+void yyfree(void *, yyscan_t yyscanner);
+
+#define yy_new_buffer yy_create_buffer
+#define yy_set_interactive(is_interactive) \
+ { \
+ if (!YY_CURRENT_BUFFER) \
+ { \
+ yyensure_buffer_stack(yyscanner); \
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+#define yy_set_bol(at_bol) \
+ { \
+ if (!YY_CURRENT_BUFFER) \
+ { \
+ yyensure_buffer_stack(yyscanner); \
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+#define ppwrap(yyscanner) (/*CONSTCOND*/ 1)
+#define YY_SKIP_YYWRAP
+typedef flex_uint8_t YY_CHAR;
+
+typedef int yy_state_type;
+
+#define yytext_ptr yytext_r
+
+static yy_state_type yy_get_previous_state(yyscan_t yyscanner);
+static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner);
+static int yy_get_next_buffer(yyscan_t yyscanner);
+static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner);
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yyg->yytext_ptr = yy_bp; \
+ yyleng = (int)(yy_cp - yy_bp); \
+ yyg->yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yyg->yy_c_buf_p = yy_cp;
+#define YY_NUM_RULES 37
+#define YY_END_OF_BUFFER 38
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+{
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+};
+static const flex_int16_t yy_accept[95] = {
+ 0, 0, 0, 0, 0, 38, 36, 34, 35, 35, 33, 7, 33, 33, 33, 33, 33, 33, 33, 33, 9, 9, 33, 33,
+ 33, 8, 33, 33, 3, 5, 5, 4, 34, 35, 19, 27, 20, 30, 25, 12, 23, 13, 24, 10, 2, 1, 26, 10,
+ 9, 11, 11, 11, 9, 11, 9, 9, 14, 16, 18, 17, 15, 8, 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
+
+};
+
+static const YY_CHAR yy_ec[256] = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, 9,
+ 10, 11, 9, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 9, 9, 18, 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, 1, 9, 27, 24, 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, 28, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+
+static const YY_CHAR yy_meta[29] = {0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 3, 1, 1, 4, 1,
+ 5, 5, 5, 1, 1, 1, 5, 5, 5, 5, 5, 5, 1, 1};
+
+static const flex_int16_t yy_base[100] = {
+ 0, 0, 0, 26, 28, 133, 195, 130, 195, 128, 105, 195, 104, 25, 195, 100, 23,
+ 27, 32, 31, 38, 50, 38, 93, 49, 0, 16, 51, 0, 195, 105, 87, 93, 195,
+ 195, 195, 195, 195, 195, 195, 195, 195, 195, 67, 195, 0, 195, 81, 55, 84, 98,
+ 110, 53, 61, 0, 52, 39, 195, 195, 195, 33, 0, 195, 195, 195, 195, 0, 195,
+ 195, 113, 0, 126, 0, 0, 0, 133, 0, 56, 128, 0, 133, 0, 195, 195, 101,
+ 141, 143, 145, 0, 15, 154, 195, 0, 195, 195, 177, 32, 182, 187, 189
+
+};
+
+static const flex_int16_t yy_def[100] = {
+ 0, 94, 1, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 20, 94, 94, 94, 96, 94, 94, 97, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 98, 94, 94, 20, 20, 49, 50, 50, 99, 21, 50, 94, 94, 94, 94, 94, 96, 94,
+ 94, 94, 94, 97, 94, 94, 43, 43, 69, 69, 98, 47, 50, 50, 94, 51, 50, 99, 50, 94, 94,
+ 94, 71, 75, 94, 50, 50, 94, 94, 50, 94, 0, 94, 94, 94, 94, 94
+
+};
+
+static const flex_int16_t yy_nxt[224] = {
+ 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 25,
+ 25, 25, 25, 25, 26, 27, 29, 30, 29, 30, 36, 39, 62, 31, 61, 31, 41, 92, 44, 40, 63, 37, 45,
+ 42, 43, 43, 43, 46, 47, 83, 48, 48, 49, 56, 57, 82, 50, 51, 50, 50, 52, 53, 54, 54, 54, 59,
+ 60, 64, 87, 87, 87, 50, 55, 50, 81, 79, 65, 69, 50, 70, 70, 70, 50, 50, 50, 69, 71, 72, 69,
+ 69, 69, 50, 32, 74, 74, 74, 49, 49,
+
+ 68, 50, 75, 76, 50, 50, 50, 67, 50, 50, 50, 58, 50, 50, 50, 90, 90, 90, 38, 50, 77, 77, 35,
+ 34, 78, 78, 78, 69, 69, 69, 33, 32, 94, 94, 69, 69, 84, 84, 94, 94, 85, 85, 85, 84, 84, 50,
+ 94, 86, 86, 86, 88, 94, 94, 94, 94, 94, 50, 89, 50, 87, 87, 87, 94, 72, 94, 76, 94, 91, 90,
+ 90, 90, 94, 94, 94, 94, 94, 93, 28, 28, 28, 28, 28, 66, 94, 94, 66, 66, 73, 94, 73, 73, 73,
+ 80, 80, 5, 94, 94, 94, 94, 94,
+
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94};
+
+static const flex_int16_t yy_chk[224] = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 13, 16, 26, 3, 96, 4, 17, 89, 19, 16, 26, 13, 19,
+ 17, 18, 18, 18, 19, 20, 60, 20, 20, 20, 22, 22, 56, 20, 20, 20, 20, 20, 20, 21, 21, 21, 24,
+ 24, 27, 77, 77, 77, 53, 21, 21, 55, 52, 27, 43, 48, 43, 43, 43, 53, 53, 53, 43, 43, 43, 43,
+ 43, 43, 47, 32, 47, 47, 47, 49, 49,
+
+ 31, 47, 47, 47, 47, 47, 47, 30, 49, 49, 50, 23, 50, 50, 50, 84, 84, 84, 15, 50, 51, 51, 12,
+ 10, 51, 51, 51, 69, 69, 69, 9, 7, 5, 0, 69, 69, 71, 71, 78, 78, 71, 71, 71, 75, 75, 80,
+ 0, 75, 75, 75, 78, 85, 85, 86, 86, 0, 80, 80, 80, 87, 87, 87, 0, 85, 0, 86, 0, 87, 90,
+ 90, 90, 0, 0, 0, 0, 0, 90, 95, 95, 95, 95, 95, 97, 0, 0, 97, 97, 98, 0, 98, 98, 98,
+ 99, 99, 94, 94, 94, 94, 94, 94,
+
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94};
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+/*
+//
+// 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.
+//
+
+This file contains the Lex specification for GLSL ES preprocessor.
+Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
+http://msdn.microsoft.com/en-us/library/2scxys89.aspx
+
+IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
+*/
+
+#if defined(_MSC_VER)
+# pragma warning(disable : 4005)
+#endif
+
+#include "compiler/preprocessor/Tokenizer.h"
+
+#include "compiler/preprocessor/DiagnosticsBase.h"
+#include "compiler/preprocessor/Token.h"
+
+#if defined(__GNUC__)
+// Triggered by the auto-generated yy_fatal_error function.
+# pragma GCC diagnostic ignored "-Wmissing-noreturn"
+#elif defined(_MSC_VER)
+# pragma warning(disable : 4244)
+#endif
+#if defined(__clang__)
+// Flex uses `/*FALLTHROUGH*/` instead of dedicated statements.
+# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+// Flex isn't semi-colon clean.
+# pragma clang diagnostic ignored "-Wextra-semi-stmt"
+#endif
+
+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+# if __cplusplus > 199711L
+# define register
+# endif
+#endif
+
+typedef std::string YYSTYPE;
+typedef angle::pp::SourceLocation YYLTYPE;
+
+// Use the unused yycolumn variable to track file (string) number.
+#define yyfileno yycolumn
+
+#define YY_USER_INIT \
+ do \
+ { \
+ yyfileno = 0; \
+ yylineno = 1; \
+ yyextra->leadingSpace = false; \
+ yyextra->lineStart = true; \
+ } while (0);
+
+#define YY_NO_INPUT
+#define YY_USER_ACTION \
+ do \
+ { \
+ angle::pp::Input *input = &yyextra->input; \
+ angle::pp::Input::Location *scanLoc = &yyextra->scanLoc; \
+ while ((scanLoc->sIndex < input->count()) && \
+ (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
+ { \
+ scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
+ ++yyfileno; \
+ yylineno = 1; \
+ } \
+ yylloc->file = yyfileno; \
+ yylloc->line = yylineno; \
+ scanLoc->cIndex += yyleng; \
+ } while (0);
+
+#define YY_INPUT(buf, result, maxSize) result = yyextra->input.read(buf, maxSize, &yylineno);
+
+#define INITIAL 0
+#define COMMENT 1
+
+#define YY_EXTRA_TYPE angle::pp::Tokenizer::Context *
+
+/* Holds the entire state of the reentrant scanner. */
+struct yyguts_t
+{
+
+ /* User-defined. Not touched by flex. */
+ YY_EXTRA_TYPE yyextra_r;
+
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
+ FILE *yyin_r, *yyout_r;
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ 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;
+ char *yy_c_buf_p;
+ int yy_init;
+ int yy_start;
+ int yy_did_buffer_switch_on_eof;
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int *yy_start_stack;
+ yy_state_type yy_last_accepting_state;
+ char *yy_last_accepting_cpos;
+
+ int yylineno_r;
+ int yy_flex_debug_r;
+
+ char *yytext_r;
+ int yy_more_flag;
+ int yy_more_len;
+
+ YYSTYPE *yylval_r;
+
+ YYLTYPE *yylloc_r;
+
+}; /* end struct yyguts_t */
+
+static int yy_init_globals(yyscan_t yyscanner);
+
+/* This must go here because YYSTYPE and YYLTYPE are included
+ * from bison output in section 1.*/
+#define yylval yyg->yylval_r
+
+#define yylloc yyg->yylloc_r
+
+int yylex_init(yyscan_t *scanner);
+
+int yylex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner);
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy(yyscan_t yyscanner);
+
+int yyget_debug(yyscan_t yyscanner);
+
+void yyset_debug(int debug_flag, yyscan_t yyscanner);
+
+YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner);
+
+void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner);
+
+FILE *yyget_in(yyscan_t yyscanner);
+
+void yyset_in(FILE *_in_str, yyscan_t yyscanner);
+
+FILE *yyget_out(yyscan_t yyscanner);
+
+void yyset_out(FILE *_out_str, yyscan_t yyscanner);
+
+int yyget_leng(yyscan_t yyscanner);
+
+char *yyget_text(yyscan_t yyscanner);
+
+int yyget_lineno(yyscan_t yyscanner);
+
+void yyset_lineno(int _line_number, yyscan_t yyscanner);
+
+int yyget_column(yyscan_t yyscanner);
+
+void yyset_column(int _column_no, yyscan_t yyscanner);
+
+YYSTYPE *yyget_lval(yyscan_t yyscanner);
+
+void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner);
+
+YYLTYPE *yyget_lloc(yyscan_t yyscanner);
+
+void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner);
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+# ifdef __cplusplus
+extern "C" int yywrap(yyscan_t yyscanner);
+# else
+extern int yywrap(yyscan_t yyscanner);
+# endif
+#endif
+
+#ifndef YY_NO_UNPUT
+
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy(char *, const char *, int, yyscan_t yyscanner);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen(const char *, yyscan_t yyscanner);
+#endif
+
+#ifndef YY_NO_INPUT
+# ifdef __cplusplus
+static int yyinput(yyscan_t yyscanner);
+# else
+static int input(yyscan_t yyscanner);
+# endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+# ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+# define YY_READ_BUF_SIZE 16384
+# else
+# define YY_READ_BUF_SIZE 8192
+# endif /* __ia64__ */
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+# define ECHO \
+ do \
+ { \
+ if (fwrite(yytext, (size_t)yyleng, 1, yyout)) \
+ { \
+ } \
+ } while (0)
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+# define YY_INPUT(buf, result, max_size) \
+ if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \
+ { \
+ int c = '*'; \
+ int n; \
+ for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \
+ buf[n] = (char)c; \
+ if (c == '\n') \
+ buf[n++] = (char)c; \
+ if (c == EOF && ferror(yyin)) \
+ YY_FATAL_ERROR("input in flex scanner failed"); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno = 0; \
+ while ((result = (int)fread(buf, 1, (yy_size_t)max_size, yyin)) == 0 && ferror(yyin)) \
+ { \
+ if (errno != EINTR) \
+ { \
+ YY_FATAL_ERROR("input in flex scanner failed"); \
+ break; \
+ } \
+ errno = 0; \
+ clearerr(yyin); \
+ } \
+ }
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+# define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+# define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+# define YY_FATAL_ERROR(msg) yy_fatal_error(msg, yyscanner)
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+# define YY_DECL_IS_OURS 1
+
+extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner);
+
+# define YY_DECL int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, yyscan_t yyscanner)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+# define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+# define YY_BREAK /*LINTED*/ break;
+#endif
+
+#define YY_RULE_SETUP YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ yylval = yylval_param;
+
+ yylloc = yylloc_param;
+
+ if (!yyg->yy_init)
+ {
+ yyg->yy_init = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if (!yyg->yy_start)
+ yyg->yy_start = 1; /* first start state */
+
+ if (!yyin)
+ yyin = stdin;
+
+ if (!yyout)
+ yyout = stdout;
+
+ if (!YY_CURRENT_BUFFER)
+ {
+ yyensure_buffer_stack(yyscanner);
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner);
+ }
+
+ yy_load_buffer_state(yyscanner);
+ }
+
+ {
+
+ /* Line comment */
+
+ while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */
+ {
+ yy_cp = yyg->yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yyg->yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yyg->yy_start;
+ yy_match:
+ do
+ {
+ 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 >= 95)
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ ++yy_cp;
+ } while (yy_current_state != 94);
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+
+ yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+
+ YY_DO_BEFORE_ACTION;
+
+ do_action: /* This label is used only to access EOF actions. */
+
+ 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;
+
+ case 1:
+ YY_RULE_SETUP
+
+ YY_BREAK
+ /* Block comment */
+ /* Line breaks are just counted - not returned. */
+ /* The comment is replaced by a single space. */
+ case 2:
+ YY_RULE_SETUP { BEGIN(COMMENT); }
+ YY_BREAK
+ case 3:
+ YY_RULE_SETUP
+
+ YY_BREAK
+ case 4:
+ YY_RULE_SETUP
+
+ YY_BREAK
+ case 5:
+ /* rule 5 can match eol */
+ YY_RULE_SETUP
+ {
+ if (yylineno == INT_MAX)
+ {
+ *yylval = "Integer overflow on line number";
+ return angle::pp::Token::GOT_ERROR;
+ }
+ ++yylineno;
+ }
+ YY_BREAK
+ case 6:
+ YY_RULE_SETUP
+ {
+ yyextra->leadingSpace = true;
+ BEGIN(INITIAL);
+ }
+ YY_BREAK
+ case 7:
+ YY_RULE_SETUP
+ {
+ // # is only valid at start of line for preprocessor directives.
+ yylval->assign(1, yytext[0]);
+ return yyextra->lineStart ? angle::pp::Token::PP_HASH
+ : angle::pp::Token::PP_OTHER;
+ }
+ YY_BREAK
+ case 8:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::IDENTIFIER;
+ }
+ YY_BREAK
+ case 9:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::CONST_INT;
+ }
+ YY_BREAK
+ case 10:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::CONST_FLOAT;
+ }
+ YY_BREAK
+ /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
+ /* Rule to catch all invalid integers and floats. */
+ case 11:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::PP_NUMBER;
+ }
+ YY_BREAK
+ case 12:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_INC;
+ }
+ YY_BREAK
+ case 13:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_DEC;
+ }
+ YY_BREAK
+ case 14:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_LEFT;
+ }
+ YY_BREAK
+ case 15:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_RIGHT;
+ }
+ YY_BREAK
+ case 16:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_LE;
+ }
+ YY_BREAK
+ case 17:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_GE;
+ }
+ YY_BREAK
+ case 18:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_EQ;
+ }
+ YY_BREAK
+ case 19:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_NE;
+ }
+ YY_BREAK
+ case 20:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_AND;
+ }
+ YY_BREAK
+ case 21:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_XOR;
+ }
+ YY_BREAK
+ case 22:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_OR;
+ }
+ YY_BREAK
+ case 23:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_ADD_ASSIGN;
+ }
+ YY_BREAK
+ case 24:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_SUB_ASSIGN;
+ }
+ YY_BREAK
+ case 25:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_MUL_ASSIGN;
+ }
+ YY_BREAK
+ case 26:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_DIV_ASSIGN;
+ }
+ YY_BREAK
+ case 27:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_MOD_ASSIGN;
+ }
+ YY_BREAK
+ case 28:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_LEFT_ASSIGN;
+ }
+ YY_BREAK
+ case 29:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_RIGHT_ASSIGN;
+ }
+ YY_BREAK
+ case 30:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_AND_ASSIGN;
+ }
+ YY_BREAK
+ case 31:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_XOR_ASSIGN;
+ }
+ YY_BREAK
+ case 32:
+ YY_RULE_SETUP
+ {
+ yylval->assign(yytext, yyleng);
+ return angle::pp::Token::OP_OR_ASSIGN;
+ }
+ YY_BREAK
+ case 33:
+ YY_RULE_SETUP
+ {
+ yylval->assign(1, yytext[0]);
+ return yytext[0];
+ }
+ YY_BREAK
+ case 34:
+ YY_RULE_SETUP { yyextra->leadingSpace = true; }
+ YY_BREAK
+ case 35:
+ /* rule 35 can match eol */
+ YY_RULE_SETUP
+ {
+ if (yylineno == INT_MAX)
+ {
+ *yylval = "Integer overflow on line number";
+ return angle::pp::Token::GOT_ERROR;
+ }
+ ++yylineno;
+ yylval->assign(1, '\n');
+ return '\n';
+ }
+ YY_BREAK
+ case 36:
+ YY_RULE_SETUP
+ {
+ yylval->assign(1, yytext[0]);
+ return angle::pp::Token::PP_OTHER;
+ }
+ YY_BREAK
+ case YY_STATE_EOF(INITIAL):
+ case YY_STATE_EOF(COMMENT):
+ {
+ // YY_USER_ACTION is not invoked for handling EOF.
+ // Set the location for EOF token manually.
+ angle::pp::Input *input = &yyextra->input;
+ angle::pp::Input::Location *scanLoc = &yyextra->scanLoc;
+ yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
+ if (scanLoc->sIndex != sIndexMax)
+ {
+ // We can only reach here if there are empty strings at the
+ // end of the input.
+ scanLoc->sIndex = sIndexMax;
+ scanLoc->cIndex = 0;
+ // FIXME: this is not 64-bit clean.
+ yyfileno = static_cast<int>(sIndexMax);
+ yylineno = 1;
+ }
+ yylloc->file = yyfileno;
+ yylloc->line = yylineno;
+ yylval->clear();
+
+ // Line number overflows fake EOFs to exit early, check for this case.
+ if (yylineno == INT_MAX)
+ {
+ yyextra->diagnostics->report(angle::pp::Diagnostics::PP_TOKENIZER_ERROR,
+ angle::pp::SourceLocation(yyfileno, yylineno),
+ "Integer overflow on line number");
+ }
+ else if (YY_START == COMMENT)
+ {
+ yyextra->diagnostics->report(angle::pp::Diagnostics::PP_EOF_IN_COMMENT,
+ angle::pp::SourceLocation(yyfileno, yylineno),
+ "EOF while in a comment");
+ }
+ yyterminate();
+ }
+ YY_BREAK
+ case 37:
+ YY_RULE_SETUP
+ ECHO;
+ YY_BREAK
+
+ 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;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yyg->yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ 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;
+ }
+
+ /* 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;
+
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state(yyscanner);
+
+ /* 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).
+ */
+
+ yy_next_state = yy_try_NUL_trans(yy_current_state, yyscanner);
+
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+
+ if (yy_next_state)
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yyg->yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+ goto yy_find_action;
+ }
+ }
+
+ else
+ switch (yy_get_next_buffer(yyscanner))
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yyg->yy_did_buffer_switch_on_eof = 0;
+
+ 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;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if (!yyg->yy_did_buffer_switch_on_eof)
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state(yyscanner);
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yyg->yy_c_buf_p =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+
+ yy_current_state = yy_get_previous_state(yyscanner);
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = yyg->yytext_ptr;
+ int number_to_move, i;
+ int ret_val;
+
+ 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");
+
+ 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;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
+
+ for (i = 0; i < number_to_move; ++i)
+ *(dest++) = *(source++);
+
+ 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;
+
+ else
+ {
+ int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while (num_to_read <= 0)
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+
+ int yy_c_buf_p_offset = (int)(yyg->yy_c_buf_p - b->yy_ch_buf);
+
+ if (b->yy_is_our_buffer)
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if (new_size <= 0)
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *)b->yy_ch_buf, (yy_size_t)(b->yy_buf_size + 2), yyscanner);
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = NULL;
+
+ if (!b->yy_ch_buf)
+ YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
+
+ yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+ }
+
+ if (num_to_read > YY_READ_BUF_SIZE)
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ yy_size_t ret = 0;
+ YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), ret, num_to_read);
+ yyg->yy_n_chars = static_cast<int>(ret);
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
+
+ if (yyg->yy_n_chars == 0)
+ {
+ if (number_to_move == YY_MORE_ADJ)
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin, yyscanner);
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((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. */
+ int 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, (yy_size_t)new_size, yyscanner);
+ if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
+ YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
+ /* "- 2" to take care of EOB's */
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int)(new_size - 2);
+ }
+
+ 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;
+
+ yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state(yyscan_t yyscanner)
+{
+ yy_state_type yy_current_state;
+ char *yy_cp;
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ yy_current_state = yyg->yy_start;
+
+ for (yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp)
+ {
+ 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 >= 95)
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state, yyscan_t yyscanner)
+{
+ int yy_is_jam;
+ struct yyguts_t *yyg =
+ (struct yyguts_t *)yyscanner; /* This var may be unused depending upon options. */
+ char *yy_cp = yyg->yy_c_buf_p;
+
+ 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 >= 95)
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ yy_is_jam = (yy_current_state == 94);
+
+ (void)yyg;
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_UNPUT
+
+#endif
+
+#ifndef YY_NO_INPUT
+# ifdef __cplusplus
+static int yyinput(yyscan_t yyscanner)
+# else
+static int input(yyscan_t yyscanner)
+# endif
+
+{
+ int c;
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+
+ 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';
+
+ else
+ { /* need more input */
+ int offset = (int)(yyg->yy_c_buf_p - yyg->yytext_ptr);
+ ++yyg->yy_c_buf_p;
+
+ 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.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin, yyscanner);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if (yywrap(yyscanner))
+ return 0;
+
+ if (!yyg->yy_did_buffer_switch_on_eof)
+ YY_NEW_FILE;
+# ifdef __cplusplus
+ return yyinput(yyscanner);
+# else
+ return input(yyscanner);
+# endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ 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;
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * @param yyscanner The scanner object.
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+void yyrestart(FILE *input_file, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ if (!YY_CURRENT_BUFFER)
+ {
+ yyensure_buffer_stack(yyscanner);
+ YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE, yyscanner);
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER, input_file, yyscanner);
+ yy_load_buffer_state(yyscanner);
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * @param yyscanner The scanner object.
+ */
+void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack(yyscanner);
+ if (YY_CURRENT_BUFFER == new_buffer)
+ return;
+
+ 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;
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state(yyscanner);
+
+ /* 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;
+}
+
+static void yy_load_buffer_state(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ 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;
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * @param yyscanner The scanner object.
+ * @return the allocated buffer state.
+ */
+YY_BUFFER_STATE yy_create_buffer(FILE *file, int size, yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner);
+ if (!b)
+ YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
+
+ b->yy_buf_size = size;
+
+ /* 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((yy_size_t)(b->yy_buf_size + 2), yyscanner);
+ if (!b->yy_ch_buf)
+ YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b, file, yyscanner);
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * @param yyscanner The scanner object.
+ */
+void yy_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ if (!b)
+ return;
+
+ if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0;
+
+ if (b->yy_is_our_buffer)
+ yyfree((void *)b->yy_ch_buf, yyscanner);
+
+ yyfree((void *)b, yyscanner);
+}
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+static void yy_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner)
+
+{
+ int oerrno = errno;
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ yy_flush_buffer(b, yyscanner);
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER)
+ {
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * @param yyscanner The scanner object.
+ */
+void yy_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ if (!b)
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* 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;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if (b == YY_CURRENT_BUFFER)
+ yy_load_buffer_state(yyscanner);
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ * @param yyscanner The scanner object.
+ */
+void yypush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack(yyscanner);
+
+ /* 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;
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ yyg->yy_buffer_stack_top++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state(yyscanner);
+ yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ * @param yyscanner The scanner object.
+ */
+void yypop_buffer_state(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if (yyg->yy_buffer_stack_top > 0)
+ --yyg->yy_buffer_stack_top;
+
+ if (YY_CURRENT_BUFFER)
+ {
+ yy_load_buffer_state(yyscanner);
+ yyg->yy_did_buffer_switch_on_eof = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack(yyscan_t yyscanner)
+{
+ yy_size_t num_to_alloc;
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ if (!yyg->yy_buffer_stack)
+ {
+
+ /* 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.
+ */
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ 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;
+ }
+
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1)
+ {
+
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ 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()");
+
+ /* 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;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+
+ 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 NULL;
+
+ b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state), yyscanner);
+ if (!b)
+ YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
+
+ b->yy_buf_size = (int)(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 = NULL;
+ 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;
+
+ yy_switch_to_buffer(b, yyscanner);
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string(const char *yystr, yyscan_t yyscanner)
+{
+
+ return yy_scan_bytes(yystr, (int)strlen(yystr), yyscanner);
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes(const char *yybytes, int _yybytes_len, yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = (yy_size_t)(_yybytes_len + 2);
+ buf = (char *)yyalloc(n, yyscanner);
+ if (!buf)
+ YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
+
+ for (i = 0; i < _yybytes_len; ++i)
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf, n, yyscanner);
+ if (!b)
+ YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+# define YY_EXIT_FAILURE 2
+#endif
+
+static void yynoreturn yy_fatal_error(const char *msg, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ (void)yyg;
+ fprintf(stderr, "%s\n", msg);
+ exit(YY_EXIT_FAILURE);
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg); \
+ 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)
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the user-defined data for this scanner.
+ * @param yyscanner The scanner object.
+ */
+YY_EXTRA_TYPE yyget_extra(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yyextra;
+}
+
+/** Get the current line number.
+ * @param yyscanner The scanner object.
+ */
+int yyget_lineno(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ if (!YY_CURRENT_BUFFER)
+ return 0;
+
+ return yylineno;
+}
+
+/** Get the current column number.
+ * @param yyscanner The scanner object.
+ */
+int yyget_column(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ if (!YY_CURRENT_BUFFER)
+ return 0;
+
+ return yycolumn;
+}
+
+/** Get the input stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *yyget_in(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yyin;
+}
+
+/** Get the output stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *yyget_out(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yyout;
+}
+
+/** Get the length of the current token.
+ * @param yyscanner The scanner object.
+ */
+int yyget_leng(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yyleng;
+}
+
+/** Get the current token.
+ * @param yyscanner The scanner object.
+ */
+
+char *yyget_text(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yytext;
+}
+
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * @param yyscanner The scanner object.
+ */
+void yyset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ yyextra = user_defined;
+}
+
+/** Set the current line number.
+ * @param _line_number line number
+ * @param yyscanner The scanner object.
+ */
+void yyset_lineno(int _line_number, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ /* lineno is only valid if an input buffer exists. */
+ if (!YY_CURRENT_BUFFER)
+ YY_FATAL_ERROR("yyset_lineno called with no buffer");
+
+ yylineno = _line_number;
+}
+
+/** Set the current column.
+ * @param _column_no column number
+ * @param yyscanner The scanner object.
+ */
+void yyset_column(int _column_no, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ /* column is only valid if an input buffer exists. */
+ if (!YY_CURRENT_BUFFER)
+ YY_FATAL_ERROR("yyset_column called with no buffer");
+
+ yycolumn = _column_no;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param _in_str A readable stream.
+ * @param yyscanner The scanner object.
+ * @see yy_switch_to_buffer
+ */
+void yyset_in(FILE *_in_str, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ yyin = _in_str;
+}
+
+void yyset_out(FILE *_out_str, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ yyout = _out_str;
+}
+
+int yyget_debug(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yy_flex_debug;
+}
+
+void yyset_debug(int _bdebug, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ yy_flex_debug = _bdebug;
+}
+
+/* Accessor methods for yylval and yylloc */
+
+YYSTYPE *yyget_lval(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yylval;
+}
+
+void yyset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ yylval = yylval_param;
+}
+
+YYLTYPE *yyget_lloc(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ return yylloc;
+}
+
+void yyset_lloc(YYLTYPE *yylloc_param, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ yylloc = yylloc_param;
+}
+
+/* User-visible API */
+
+/* yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+int yylex_init(yyscan_t *ptr_yy_globals)
+{
+ if (ptr_yy_globals == NULL)
+ {
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), NULL);
+
+ if (*ptr_yy_globals == NULL)
+ {
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t));
+
+ return yy_init_globals(*ptr_yy_globals);
+}
+
+/* yylex_init_extra has the same functionality as yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to yyalloc in
+ * the yyextra field.
+ */
+int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined, yyscan_t *ptr_yy_globals)
+{
+ struct yyguts_t dummy_yyguts;
+
+ yyset_extra(yy_user_defined, &dummy_yyguts);
+
+ if (ptr_yy_globals == NULL)
+ {
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t)yyalloc(sizeof(struct yyguts_t), &dummy_yyguts);
+
+ if (*ptr_yy_globals == NULL)
+ {
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in
+ yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t));
+
+ yyset_extra(yy_user_defined, *ptr_yy_globals);
+
+ return yy_init_globals(*ptr_yy_globals);
+}
+
+static int yy_init_globals(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ yyg->yy_buffer_stack = NULL;
+ yyg->yy_buffer_stack_top = 0;
+ yyg->yy_buffer_stack_max = 0;
+ yyg->yy_c_buf_p = NULL;
+ yyg->yy_init = 0;
+ yyg->yy_start = 0;
+
+ yyg->yy_start_stack_ptr = 0;
+ yyg->yy_start_stack_depth = 0;
+ yyg->yy_start_stack = NULL;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = NULL;
+ yyout = NULL;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+
+ /* Pop the buffer stack, destroying each element. */
+ while (YY_CURRENT_BUFFER)
+ {
+ yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state(yyscanner);
+ }
+
+ /* Destroy the stack itself. */
+ yyfree(yyg->yy_buffer_stack, yyscanner);
+ yyg->yy_buffer_stack = NULL;
+
+ /* Destroy the start condition stack. */
+ yyfree(yyg->yy_start_stack, yyscanner);
+ yyg->yy_start_stack = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals(yyscanner);
+
+ /* Destroy the main struct (reentrant only). */
+ yyfree(yyscanner, yyscanner);
+ yyscanner = NULL;
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy(char *s1, const char *s2, int n, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ (void)yyg;
+
+ int i;
+ for (i = 0; i < n; ++i)
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen(const char *s, yyscan_t yyscanner)
+{
+ int n;
+ for (n = 0; s[n]; ++n)
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc(yy_size_t size, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ (void)yyg;
+ return malloc(size);
+}
+
+void *yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ (void)yyg;
+
+ /* 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 realloc(ptr, size);
+}
+
+void yyfree(void *ptr, yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
+ (void)yyg;
+ free((char *)ptr); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+namespace angle
+{
+
+namespace pp
+{
+
+Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(256)
+{
+ mContext.diagnostics = diagnostics;
+}
+
+Tokenizer::~Tokenizer()
+{
+ destroyScanner();
+}
+
+bool Tokenizer::init(size_t count, const char *const string[], const int length[])
+{
+ if ((count > 0) && (string == 0))
+ return false;
+
+ mContext.input = Input(count, string, length);
+ return initScanner();
+}
+
+void Tokenizer::setFileNumber(int file)
+{
+ // We use column number as file number.
+ // See macro yyfileno.
+ yyset_column(file, mHandle);
+}
+
+void Tokenizer::setLineNumber(int line)
+{
+ yyset_lineno(line, mHandle);
+}
+
+void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
+{
+ mMaxTokenSize = maxTokenSize;
+}
+
+void Tokenizer::lex(Token *token)
+{
+ int tokenType = yylex(&token->text, &token->location, mHandle);
+
+ if (tokenType == Token::GOT_ERROR)
+ {
+ mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
+ token->type = Token::LAST;
+ }
+ else
+ {
+ token->type = tokenType;
+ }
+
+ if (token->text.size() > mMaxTokenSize)
+ {
+ mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG, token->location, token->text);
+ token->text.erase(mMaxTokenSize);
+ }
+
+ token->flags = 0;
+
+ token->setAtStartOfLine(mContext.lineStart);
+ mContext.lineStart = token->type == '\n';
+
+ token->setHasLeadingSpace(mContext.leadingSpace);
+ mContext.leadingSpace = false;
+}
+
+bool Tokenizer::initScanner()
+{
+ if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
+ return false;
+
+ yyrestart(0, mHandle);
+ return true;
+}
+
+void Tokenizer::destroyScanner()
+{
+ if (mHandle == nullptr)
+ return;
+
+ yylex_destroy(mHandle);
+ mHandle = nullptr;
+}
+
+} // namespace pp
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.h b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.h
new file mode 100644
index 0000000000..4609179a06
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.h
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_PREPROCESSOR_TOKENIZER_H_
+#define COMPILER_PREPROCESSOR_TOKENIZER_H_
+
+#include "common/angleutils.h"
+#include "compiler/preprocessor/Input.h"
+#include "compiler/preprocessor/Lexer.h"
+
+namespace angle
+{
+
+namespace pp
+{
+
+class Diagnostics;
+
+class Tokenizer : public Lexer
+{
+ public:
+ struct Context
+ {
+ Diagnostics *diagnostics;
+
+ Input input;
+ // The location where yytext points to. Token location should track
+ // scanLoc instead of Input::mReadLoc because they may not be the same
+ // if text is buffered up in the scanner input buffer.
+ Input::Location scanLoc;
+
+ bool leadingSpace;
+ bool lineStart;
+ };
+
+ Tokenizer(Diagnostics *diagnostics);
+ ~Tokenizer() override;
+
+ bool init(size_t count, const char *const string[], const int length[]);
+
+ void setFileNumber(int file);
+ void setLineNumber(int line);
+ void setMaxTokenSize(size_t maxTokenSize);
+
+ void lex(Token *token) override;
+
+ private:
+ bool initScanner();
+ void destroyScanner();
+
+ void *mHandle; // Scanner handle.
+ Context mContext; // Scanner extra.
+ size_t mMaxTokenSize; // Maximum token size
+};
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_TOKENIZER_H_
diff --git a/gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h b/gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h
new file mode 100644
index 0000000000..2203d8ac8f
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h
@@ -0,0 +1,54 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// numeric_lex.h: Functions to extract numeric values from string.
+
+#ifndef COMPILER_PREPROCESSOR_NUMERICLEX_H_
+#define COMPILER_PREPROCESSOR_NUMERICLEX_H_
+
+#include <sstream>
+
+namespace angle
+{
+
+namespace pp
+{
+
+inline std::ios::fmtflags numeric_base_int(const std::string &str)
+{
+ if ((str.size() >= 2) && (str[0] == '0') && (str[1] == 'x' || str[1] == 'X'))
+ {
+ return std::ios::hex;
+ }
+ if ((str.size() >= 1) && (str[0] == '0'))
+ {
+ return std::ios::oct;
+ }
+ return std::ios::dec;
+}
+
+// The following functions parse the given string to extract a numerical
+// value of the given type. These functions assume that the string is
+// of the correct form. They can only fail if the parsed value is too big,
+// in which case false is returned.
+
+template <typename IntType>
+bool numeric_lex_int(const std::string &str, IntType *value)
+{
+ std::istringstream stream(str);
+ // This should not be necessary, but MSVS has a buggy implementation.
+ // It returns incorrect results if the base is not specified.
+ stream.setf(numeric_base_int(str), std::ios::basefield);
+
+ stream >> (*value);
+ return !stream.fail();
+}
+
+} // namespace pp
+
+} // namespace angle
+
+#endif // COMPILER_PREPROCESSOR_NUMERICLEX_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp
new file mode 100644
index 0000000000..e2d4df3d5a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp
@@ -0,0 +1,461 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Analysis of the AST needed for HLSL generation
+
+#include "compiler/translator/ASTMetadataHLSL.h"
+
+#include "compiler/translator/CallDAG.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// Class used to traverse the AST of a function definition, checking if the
+// function uses a gradient, and writing the set of control flow using gradients.
+// It assumes that the analysis has already been made for the function's
+// callees.
+class PullGradient : public TIntermTraverser
+{
+ public:
+ PullGradient(MetadataList *metadataList, size_t index, const CallDAG &dag)
+ : TIntermTraverser(true, false, true),
+ mMetadataList(metadataList),
+ mMetadata(&(*metadataList)[index]),
+ mIndex(index),
+ mDag(dag)
+ {
+ ASSERT(index < metadataList->size());
+
+ // ESSL 100 builtin gradient functions
+ mGradientBuiltinFunctions.insert(ImmutableString("texture2D"));
+ mGradientBuiltinFunctions.insert(ImmutableString("texture2DProj"));
+ mGradientBuiltinFunctions.insert(ImmutableString("textureCube"));
+
+ // ESSL 300 builtin gradient functions
+ mGradientBuiltinFunctions.insert(ImmutableString("texture"));
+ mGradientBuiltinFunctions.insert(ImmutableString("textureProj"));
+ mGradientBuiltinFunctions.insert(ImmutableString("textureOffset"));
+ mGradientBuiltinFunctions.insert(ImmutableString("textureProjOffset"));
+
+ // ESSL 310 doesn't add builtin gradient functions
+ }
+
+ void traverse(TIntermFunctionDefinition *node)
+ {
+ node->traverse(this);
+ ASSERT(mParents.empty());
+ }
+
+ // Called when a gradient operation or a call to a function using a gradient is found.
+ void onGradient()
+ {
+ mMetadata->mUsesGradient = true;
+ // Mark the latest control flow as using a gradient.
+ if (!mParents.empty())
+ {
+ mMetadata->mControlFlowsContainingGradient.insert(mParents.back());
+ }
+ }
+
+ void visitControlFlow(Visit visit, TIntermNode *node)
+ {
+ if (visit == PreVisit)
+ {
+ mParents.push_back(node);
+ }
+ else if (visit == PostVisit)
+ {
+ ASSERT(mParents.back() == node);
+ mParents.pop_back();
+ // A control flow's using a gradient means its parents are too.
+ if (mMetadata->mControlFlowsContainingGradient.count(node) > 0 && !mParents.empty())
+ {
+ mMetadata->mControlFlowsContainingGradient.insert(mParents.back());
+ }
+ }
+ }
+
+ bool visitLoop(Visit visit, TIntermLoop *loop) override
+ {
+ visitControlFlow(visit, loop);
+ return true;
+ }
+
+ bool visitIfElse(Visit visit, TIntermIfElse *ifElse) override
+ {
+ visitControlFlow(visit, ifElse);
+ return true;
+ }
+
+ bool visitUnary(Visit visit, TIntermUnary *node) override
+ {
+ if (visit == PreVisit)
+ {
+ switch (node->getOp())
+ {
+ case EOpDFdx:
+ case EOpDFdy:
+ case EOpFwidth:
+ onGradient();
+ break;
+ default:
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ if (visit == PreVisit)
+ {
+ if (node->getOp() == EOpCallFunctionInAST)
+ {
+ size_t calleeIndex = mDag.findIndex(node->getFunction()->uniqueId());
+ ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex);
+
+ if ((*mMetadataList)[calleeIndex].mUsesGradient)
+ {
+ onGradient();
+ }
+ }
+ else if (node->getOp() == EOpCallBuiltInFunction)
+ {
+ if (mGradientBuiltinFunctions.find(node->getFunction()->name()) !=
+ mGradientBuiltinFunctions.end())
+ {
+ onGradient();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private:
+ MetadataList *mMetadataList;
+ ASTMetadataHLSL *mMetadata;
+ size_t mIndex;
+ const CallDAG &mDag;
+
+ // Contains a stack of the control flow nodes that are parents of the node being
+ // currently visited. It is used to mark control flows using a gradient.
+ std::vector<TIntermNode *> mParents;
+
+ // A list of builtin functions that use gradients
+ std::set<ImmutableString> mGradientBuiltinFunctions;
+};
+
+// Traverses the AST of a function definition to compute the the discontinuous loops
+// and the if statements containing gradient loops. It assumes that the gradient loops
+// (loops that contain a gradient) have already been computed and that it has already
+// traversed the current function's callees.
+class PullComputeDiscontinuousAndGradientLoops : public TIntermTraverser
+{
+ public:
+ PullComputeDiscontinuousAndGradientLoops(MetadataList *metadataList,
+ size_t index,
+ const CallDAG &dag)
+ : TIntermTraverser(true, false, true),
+ mMetadataList(metadataList),
+ mMetadata(&(*metadataList)[index]),
+ mIndex(index),
+ mDag(dag)
+ {}
+
+ void traverse(TIntermFunctionDefinition *node)
+ {
+ node->traverse(this);
+ ASSERT(mLoopsAndSwitches.empty());
+ ASSERT(mIfs.empty());
+ }
+
+ // Called when traversing a gradient loop or a call to a function with a
+ // gradient loop in its call graph.
+ void onGradientLoop()
+ {
+ mMetadata->mHasGradientLoopInCallGraph = true;
+ // Mark the latest if as using a discontinuous loop.
+ if (!mIfs.empty())
+ {
+ mMetadata->mIfsContainingGradientLoop.insert(mIfs.back());
+ }
+ }
+
+ bool visitLoop(Visit visit, TIntermLoop *loop) override
+ {
+ if (visit == PreVisit)
+ {
+ mLoopsAndSwitches.push_back(loop);
+
+ if (mMetadata->hasGradientInCallGraph(loop))
+ {
+ onGradientLoop();
+ }
+ }
+ else if (visit == PostVisit)
+ {
+ ASSERT(mLoopsAndSwitches.back() == loop);
+ mLoopsAndSwitches.pop_back();
+ }
+
+ return true;
+ }
+
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override
+ {
+ if (visit == PreVisit)
+ {
+ mIfs.push_back(node);
+ }
+ else if (visit == PostVisit)
+ {
+ ASSERT(mIfs.back() == node);
+ mIfs.pop_back();
+ // An if using a discontinuous loop means its parents ifs are also discontinuous.
+ if (mMetadata->mIfsContainingGradientLoop.count(node) > 0 && !mIfs.empty())
+ {
+ mMetadata->mIfsContainingGradientLoop.insert(mIfs.back());
+ }
+ }
+
+ return true;
+ }
+
+ bool visitBranch(Visit visit, TIntermBranch *node) override
+ {
+ if (visit == PreVisit)
+ {
+ switch (node->getFlowOp())
+ {
+ case EOpBreak:
+ {
+ ASSERT(!mLoopsAndSwitches.empty());
+ TIntermLoop *loop = mLoopsAndSwitches.back()->getAsLoopNode();
+ if (loop != nullptr)
+ {
+ mMetadata->mDiscontinuousLoops.insert(loop);
+ }
+ }
+ break;
+ case EOpContinue:
+ {
+ ASSERT(!mLoopsAndSwitches.empty());
+ TIntermLoop *loop = nullptr;
+ size_t i = mLoopsAndSwitches.size();
+ while (loop == nullptr && i > 0)
+ {
+ --i;
+ loop = mLoopsAndSwitches.at(i)->getAsLoopNode();
+ }
+ ASSERT(loop != nullptr);
+ mMetadata->mDiscontinuousLoops.insert(loop);
+ }
+ break;
+ case EOpKill:
+ case EOpReturn:
+ // A return or discard jumps out of all the enclosing loops
+ if (!mLoopsAndSwitches.empty())
+ {
+ for (TIntermNode *intermNode : mLoopsAndSwitches)
+ {
+ TIntermLoop *loop = intermNode->getAsLoopNode();
+ if (loop)
+ {
+ mMetadata->mDiscontinuousLoops.insert(loop);
+ }
+ }
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ return true;
+ }
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ if (visit == PreVisit && node->getOp() == EOpCallFunctionInAST)
+ {
+ size_t calleeIndex = mDag.findIndex(node->getFunction()->uniqueId());
+ ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex);
+
+ if ((*mMetadataList)[calleeIndex].mHasGradientLoopInCallGraph)
+ {
+ onGradientLoop();
+ }
+ }
+
+ return true;
+ }
+
+ bool visitSwitch(Visit visit, TIntermSwitch *node) override
+ {
+ if (visit == PreVisit)
+ {
+ mLoopsAndSwitches.push_back(node);
+ }
+ else if (visit == PostVisit)
+ {
+ ASSERT(mLoopsAndSwitches.back() == node);
+ mLoopsAndSwitches.pop_back();
+ }
+ return true;
+ }
+
+ private:
+ MetadataList *mMetadataList;
+ ASTMetadataHLSL *mMetadata;
+ size_t mIndex;
+ const CallDAG &mDag;
+
+ std::vector<TIntermNode *> mLoopsAndSwitches;
+ std::vector<TIntermIfElse *> mIfs;
+};
+
+// Tags all the functions called in a discontinuous loop
+class PushDiscontinuousLoops : public TIntermTraverser
+{
+ public:
+ PushDiscontinuousLoops(MetadataList *metadataList, size_t index, const CallDAG &dag)
+ : TIntermTraverser(true, true, true),
+ mMetadataList(metadataList),
+ mMetadata(&(*metadataList)[index]),
+ mIndex(index),
+ mDag(dag),
+ mNestedDiscont(mMetadata->mCalledInDiscontinuousLoop ? 1 : 0)
+ {}
+
+ void traverse(TIntermFunctionDefinition *node)
+ {
+ node->traverse(this);
+ ASSERT(mNestedDiscont == (mMetadata->mCalledInDiscontinuousLoop ? 1 : 0));
+ }
+
+ bool visitLoop(Visit visit, TIntermLoop *loop) override
+ {
+ bool isDiscontinuous = mMetadata->mDiscontinuousLoops.count(loop) > 0;
+
+ if (visit == PreVisit && isDiscontinuous)
+ {
+ mNestedDiscont++;
+ }
+ else if (visit == PostVisit && isDiscontinuous)
+ {
+ mNestedDiscont--;
+ }
+
+ return true;
+ }
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ switch (node->getOp())
+ {
+ case EOpCallFunctionInAST:
+ if (visit == PreVisit && mNestedDiscont > 0)
+ {
+ size_t calleeIndex = mDag.findIndex(node->getFunction()->uniqueId());
+ ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex);
+
+ (*mMetadataList)[calleeIndex].mCalledInDiscontinuousLoop = true;
+ }
+ break;
+ default:
+ break;
+ }
+ return true;
+ }
+
+ private:
+ MetadataList *mMetadataList;
+ ASTMetadataHLSL *mMetadata;
+ size_t mIndex;
+ const CallDAG &mDag;
+
+ int mNestedDiscont;
+};
+} // namespace
+
+bool ASTMetadataHLSL::hasGradientInCallGraph(TIntermLoop *node)
+{
+ return mControlFlowsContainingGradient.count(node) > 0;
+}
+
+bool ASTMetadataHLSL::hasGradientLoop(TIntermIfElse *node)
+{
+ return mIfsContainingGradientLoop.count(node) > 0;
+}
+
+MetadataList CreateASTMetadataHLSL(TIntermNode *root, const CallDAG &callDag)
+{
+ MetadataList metadataList(callDag.size());
+
+ // Compute all the information related to when gradient operations are used.
+ // We want to know for each function and control flow operation if they have
+ // a gradient operation in their call graph (shortened to "using a gradient"
+ // in the rest of the file).
+ //
+ // This computation is logically split in three steps:
+ // 1 - For each function compute if it uses a gradient in its body, ignoring
+ // calls to other user-defined functions.
+ // 2 - For each function determine if it uses a gradient in its call graph,
+ // using the result of step 1 and the CallDAG to know its callees.
+ // 3 - For each control flow statement of each function, check if it uses a
+ // gradient in the function's body, or if it calls a user-defined function that
+ // uses a gradient.
+ //
+ // We take advantage of the call graph being a DAG and instead compute 1, 2 and 3
+ // for leaves first, then going down the tree. This is correct because 1 doesn't
+ // depend on other functions, and 2 and 3 depend only on callees.
+ for (size_t i = 0; i < callDag.size(); i++)
+ {
+ PullGradient pull(&metadataList, i, callDag);
+ pull.traverse(callDag.getRecordFromIndex(i).node);
+ }
+
+ // Compute which loops are discontinuous and which function are called in
+ // these loops. The same way computing gradient usage is a "pull" process,
+ // computing "bing used in a discont. loop" is a push process. However we also
+ // need to know what ifs have a discontinuous loop inside so we do the same type
+ // of callgraph analysis as for the gradient.
+
+ // First compute which loops are discontinuous (no specific order) and pull
+ // the ifs and functions using a gradient loop.
+ for (size_t i = 0; i < callDag.size(); i++)
+ {
+ PullComputeDiscontinuousAndGradientLoops pull(&metadataList, i, callDag);
+ pull.traverse(callDag.getRecordFromIndex(i).node);
+ }
+
+ // Then push the information to callees, either from the a local discontinuous
+ // loop or from the caller being called in a discontinuous loop already
+ for (size_t i = callDag.size(); i-- > 0;)
+ {
+ PushDiscontinuousLoops push(&metadataList, i, callDag);
+ push.traverse(callDag.getRecordFromIndex(i).node);
+ }
+
+ // We create "Lod0" version of functions with the gradient operations replaced
+ // by non-gradient operations so that the D3D compiler is happier with discont
+ // loops.
+ for (auto &metadata : metadataList)
+ {
+ metadata.mNeedsLod0 = metadata.mCalledInDiscontinuousLoop && metadata.mUsesGradient;
+ }
+
+ return metadataList;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.h b/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.h
new file mode 100644
index 0000000000..da00faabeb
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.h
@@ -0,0 +1,62 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Defines analyses of the AST needed for HLSL generation
+
+#ifndef COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
+#define COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
+
+#include <set>
+#include <vector>
+
+namespace sh
+{
+
+class CallDAG;
+class TIntermNode;
+class TIntermIfElse;
+class TIntermLoop;
+
+struct ASTMetadataHLSL
+{
+ ASTMetadataHLSL()
+ : mUsesGradient(false),
+ mCalledInDiscontinuousLoop(false),
+ mHasGradientLoopInCallGraph(false),
+ mNeedsLod0(false)
+ {}
+
+ // Here "something uses a gradient" means here that it either contains a
+ // gradient operation, or a call to a function that uses a gradient.
+ bool hasGradientInCallGraph(TIntermLoop *node);
+ bool hasGradientLoop(TIntermIfElse *node);
+
+ // Does the function use a gradient.
+ bool mUsesGradient;
+
+ // Even if usesGradient is true, some control flow might not use a gradient
+ // so we store the set of all gradient-using control flows.
+ std::set<TIntermNode *> mControlFlowsContainingGradient;
+
+ // Remember information about the discontinuous loops and which functions
+ // are called in such loops.
+ bool mCalledInDiscontinuousLoop;
+ bool mHasGradientLoopInCallGraph;
+ std::set<TIntermLoop *> mDiscontinuousLoops;
+ std::set<TIntermIfElse *> mIfsContainingGradientLoop;
+
+ // Will we need to generate a Lod0 version of the function.
+ bool mNeedsLod0;
+};
+
+typedef std::vector<ASTMetadataHLSL> MetadataList;
+
+// Return the AST analysis result, in the order defined by the call DAG
+MetadataList CreateASTMetadataHLSL(TIntermNode *root, const CallDAG &callDag);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.cpp
new file mode 100644
index 0000000000..52b8b878c3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.cpp
@@ -0,0 +1,112 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// AtomicCounterFunctionHLSL: Class for writing implementation of atomic counter functions into HLSL
+// output.
+//
+
+#include "compiler/translator/AtomicCounterFunctionHLSL.h"
+
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/IntermNode.h"
+
+namespace sh
+{
+
+namespace
+{
+constexpr ImmutableString kAtomicCounter("atomicCounter");
+constexpr ImmutableString kAtomicCounterIncrement("atomicCounterIncrement");
+constexpr ImmutableString kAtomicCounterDecrement("atomicCounterDecrement");
+constexpr ImmutableString kAtomicCounterBaseName("_acbase_");
+} // namespace
+
+AtomicCounterFunctionHLSL::AtomicCounterFunctionHLSL(bool forceResolution)
+ : mForceResolution(forceResolution)
+{}
+
+ImmutableString AtomicCounterFunctionHLSL::useAtomicCounterFunction(const ImmutableString &name)
+{
+ // The largest string that will be create created is "_acbase_increment" or "_acbase_decrement"
+ ImmutableStringBuilder hlslFunctionNameSB(kAtomicCounterBaseName.length() +
+ strlen("increment"));
+ hlslFunctionNameSB << kAtomicCounterBaseName;
+
+ AtomicCounterFunction atomicMethod;
+ if (kAtomicCounter == name)
+ {
+ atomicMethod = AtomicCounterFunction::LOAD;
+ hlslFunctionNameSB << "load";
+ }
+ else if (kAtomicCounterIncrement == name)
+ {
+ atomicMethod = AtomicCounterFunction::INCREMENT;
+ hlslFunctionNameSB << "increment";
+ }
+ else if (kAtomicCounterDecrement == name)
+ {
+ atomicMethod = AtomicCounterFunction::DECREMENT;
+ hlslFunctionNameSB << "decrement";
+ }
+ else
+ {
+ atomicMethod = AtomicCounterFunction::INVALID;
+ UNREACHABLE();
+ }
+
+ ImmutableString hlslFunctionName(hlslFunctionNameSB);
+ mAtomicCounterFunctions[hlslFunctionName] = atomicMethod;
+
+ return hlslFunctionName;
+}
+
+void AtomicCounterFunctionHLSL::atomicCounterFunctionHeader(TInfoSinkBase &out)
+{
+ for (auto &atomicFunction : mAtomicCounterFunctions)
+ {
+ out << "uint " << atomicFunction.first
+ << "(in RWByteAddressBuffer counter, int address)\n"
+ "{\n"
+ " uint ret;\n";
+
+ switch (atomicFunction.second)
+ {
+ case AtomicCounterFunction::INCREMENT:
+ out << " counter.InterlockedAdd(address, 1u, ret);\n";
+ break;
+ case AtomicCounterFunction::DECREMENT:
+ out << " counter.InterlockedAdd(address, 0u - 1u, ret);\n"
+ " ret -= 1u;\n"; // atomicCounterDecrement is a post-decrement op
+ break;
+ case AtomicCounterFunction::LOAD:
+ out << " ret = counter.Load(address);\n";
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ if (mForceResolution && atomicFunction.second != AtomicCounterFunction::LOAD)
+ {
+ out << " if (ret == 0) {\n"
+ " ret = 0 - ret;\n"
+ " }\n";
+ }
+
+ out << " return ret;\n"
+ "}\n\n";
+ }
+}
+
+ImmutableString getAtomicCounterNameForBinding(int binding)
+{
+ std::stringstream counterName = sh::InitializeStream<std::stringstream>();
+ counterName << kAtomicCounterBaseName << binding;
+ return ImmutableString(counterName.str());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.h b/gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.h
new file mode 100644
index 0000000000..e658df3c20
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/AtomicCounterFunctionHLSL.h
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// AtomicCounterFunctionHLSL: Class for writing implementation of atomic counter functions into HLSL
+// output.
+//
+
+#ifndef COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_
+#define COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_
+
+#include <map>
+
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ImmutableString.h"
+
+namespace sh
+{
+
+class TInfoSinkBase;
+struct TLayoutQualifier;
+
+class AtomicCounterFunctionHLSL final : angle::NonCopyable
+{
+ public:
+ AtomicCounterFunctionHLSL(bool forceResolution);
+
+ ImmutableString useAtomicCounterFunction(const ImmutableString &name);
+
+ void atomicCounterFunctionHeader(TInfoSinkBase &out);
+
+ private:
+ enum class AtomicCounterFunction
+ {
+ LOAD,
+ INCREMENT,
+ DECREMENT,
+ INVALID
+ };
+
+ std::map<ImmutableString, AtomicCounterFunction> mAtomicCounterFunctions;
+ bool mForceResolution;
+};
+
+ImmutableString getAtomicCounterNameForBinding(int binding);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_ATOMICCOUNTERFUNCTIONHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/BaseTypes.h b/gfx/angle/checkout/src/compiler/translator/BaseTypes.h
new file mode 100644
index 0000000000..555910fa72
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/BaseTypes.h
@@ -0,0 +1,1086 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_BASETYPES_H_
+#define COMPILER_TRANSLATOR_BASETYPES_H_
+
+#include <algorithm>
+#include <array>
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/debug.h"
+#include "compiler/translator/ImmutableString.h"
+
+namespace sh
+{
+
+//
+// Precision qualifiers
+//
+enum TPrecision
+{
+ // These need to be kept sorted
+ EbpUndefined,
+ EbpLow,
+ EbpMedium,
+ EbpHigh,
+
+ // end of list
+ EbpLast
+};
+
+inline const char *getPrecisionString(TPrecision p)
+{
+ switch (p)
+ {
+ case EbpHigh:
+ return "highp";
+ case EbpMedium:
+ return "mediump";
+ case EbpLow:
+ return "lowp";
+ default:
+ return "mediump"; // Safest fallback
+ }
+}
+
+//
+// Basic type. Arrays, vectors, etc., are orthogonal to this.
+//
+enum TBasicType
+{
+ EbtVoid,
+ EbtFloat,
+ EbtInt,
+ EbtUInt,
+ EbtBool,
+
+ EbtAtomicCounter,
+ EbtYuvCscStandardEXT, // Only valid if EXT_YUV_target exists.
+
+ EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
+ EbtSampler2D = EbtGuardSamplerBegin,
+ EbtSampler3D,
+ EbtSamplerCube,
+ EbtSampler2DArray,
+ EbtSamplerExternalOES, // Only valid if OES_EGL_image_external exists.
+ EbtSamplerExternal2DY2YEXT, // Only valid if GL_EXT_YUV_target exists.
+ EbtSampler2DRect, // Only valid if GL_ARB_texture_rectangle exists.
+ EbtSampler2DMS,
+ EbtSampler2DMSArray,
+ EbtISampler2D,
+ EbtISampler3D,
+ EbtISamplerCube,
+ EbtISampler2DArray,
+ EbtISampler2DMS,
+ EbtISampler2DMSArray,
+ EbtUSampler2D,
+ EbtUSampler3D,
+ EbtUSamplerCube,
+ EbtUSampler2DArray,
+ EbtUSampler2DMS,
+ EbtUSampler2DMSArray,
+ EbtSampler2DShadow,
+ EbtSamplerCubeShadow,
+ EbtSampler2DArrayShadow,
+ EbtGuardSamplerEnd = EbtSampler2DArrayShadow, // non type: see implementation of IsSampler()
+
+ // images
+ EbtGuardImageBegin,
+ EbtImage2D = EbtGuardImageBegin,
+ EbtIImage2D,
+ EbtUImage2D,
+ EbtImage3D,
+ EbtIImage3D,
+ EbtUImage3D,
+ EbtImage2DArray,
+ EbtIImage2DArray,
+ EbtUImage2DArray,
+ EbtImageCube,
+ EbtIImageCube,
+ EbtUImageCube,
+ EbtGuardImageEnd = EbtUImageCube,
+
+ EbtLastSimpleType = EbtGuardImageEnd,
+
+ EbtStruct,
+ EbtInterfaceBlock,
+
+ // end of list
+ EbtLast = EbtInterfaceBlock
+};
+
+constexpr char GetBasicMangledName(TBasicType t)
+{
+ if (t > EbtLastSimpleType)
+ {
+ return '{';
+ }
+ static_assert(EbtLastSimpleType < 52, "We only use alphabetic characters for mangled names");
+ if (t < 26)
+ {
+ return static_cast<char>('A' + t);
+ }
+ return static_cast<char>('a' - 26 + t);
+}
+
+const char *getBasicString(TBasicType t);
+
+inline bool IsSampler(TBasicType type)
+{
+ return type >= EbtGuardSamplerBegin && type <= EbtGuardSamplerEnd;
+}
+
+inline bool IsImage(TBasicType type)
+{
+ return type >= EbtGuardImageBegin && type <= EbtGuardImageEnd;
+}
+
+inline bool IsAtomicCounter(TBasicType type)
+{
+ return type == EbtAtomicCounter;
+}
+
+inline bool IsOpaqueType(TBasicType type)
+{
+ return IsSampler(type) || IsImage(type) || IsAtomicCounter(type);
+}
+
+inline bool IsIntegerSampler(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtISampler2DMS:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtUSampler2DMS:
+ case EbtUSampler2DMSArray:
+ return true;
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSamplerExternal2DY2YEXT:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ case EbtSampler2DMS:
+ case EbtSampler2DMSArray:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsIntegerSamplerUnsigned(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtISampler2DMS:
+ case EbtISampler2DMSArray:
+ return false;
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtUSampler2DMS:
+ case EbtUSampler2DMSArray:
+ return true;
+ default:
+ assert(!IsIntegerSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsSampler2DMS(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2DMS:
+ case EbtISampler2DMS:
+ case EbtUSampler2DMS:
+ return true;
+ default:
+ return false;
+ }
+}
+
+inline bool IsSampler2DMSArray(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2DMSArray:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2DMSArray:
+ return true;
+ default:
+ return false;
+ }
+}
+
+inline bool IsFloatImage(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtImage2D:
+ case EbtImage3D:
+ case EbtImage2DArray:
+ case EbtImageCube:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+inline bool IsIntegerImage(TBasicType type)
+{
+
+ switch (type)
+ {
+ case EbtIImage2D:
+ case EbtIImage3D:
+ case EbtIImage2DArray:
+ case EbtIImageCube:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+inline bool IsUnsignedImage(TBasicType type)
+{
+
+ switch (type)
+ {
+ case EbtUImage2D:
+ case EbtUImage3D:
+ case EbtUImage2DArray:
+ case EbtUImageCube:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+// Samplers are divided into 4 disjoint categories: 2D, cube, 3D, and array.
+// Array samplers are not 2D samplers.
+inline bool IsSampler2D(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DRect:
+ case EbtSamplerExternalOES:
+ case EbtSamplerExternal2DY2YEXT:
+ case EbtSampler2DShadow:
+ case EbtSampler2DMS:
+ case EbtISampler2DMS:
+ case EbtUSampler2DMS:
+ return true;
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DMSArray:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2DMSArray:
+ case EbtSampler2DArrayShadow:
+ 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 EbtSamplerExternal2DY2YEXT:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtSampler2DMS:
+ case EbtSampler2DMSArray:
+ case EbtISampler2D:
+ case EbtISampler3D:
+ case EbtISampler2DArray:
+ case EbtISampler2DMS:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSampler2DArray:
+ case EbtUSampler2DMS:
+ case EbtUSampler2DMSArray:
+ 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 EbtSamplerExternal2DY2YEXT:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtSampler2DMS:
+ case EbtSampler2DMSArray:
+ case EbtISampler2D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ case EbtISampler2DMS:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtUSampler2DMS:
+ case EbtUSampler2DMSArray:
+ 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 EbtSampler2DMSArray:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2DMSArray:
+ case EbtSampler2DArrayShadow:
+ return true;
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DRect:
+ case EbtSamplerExternalOES:
+ case EbtSamplerExternal2DY2YEXT:
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCube:
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DMS:
+ case EbtISampler2DMS:
+ case EbtUSampler2DMS:
+ 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 EbtISampler2DMS:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2D:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ case EbtUSampler2DMS:
+ case EbtUSampler2DMSArray:
+ case EbtSampler2D:
+ case EbtSampler3D:
+ case EbtSamplerCube:
+ case EbtSamplerExternalOES:
+ case EbtSamplerExternal2DY2YEXT:
+ case EbtSampler2DRect:
+ case EbtSampler2DArray:
+ case EbtSampler2DMS:
+ case EbtSampler2DMSArray:
+ return false;
+ default:
+ assert(!IsSampler(type));
+ }
+
+ return false;
+}
+
+inline bool IsImage2D(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtImage2D:
+ case EbtIImage2D:
+ case EbtUImage2D:
+ return true;
+ case EbtImage3D:
+ case EbtIImage3D:
+ case EbtUImage3D:
+ case EbtImage2DArray:
+ case EbtIImage2DArray:
+ case EbtUImage2DArray:
+ case EbtImageCube:
+ case EbtIImageCube:
+ case EbtUImageCube:
+ return false;
+ default:
+ assert(!IsImage(type));
+ }
+
+ return false;
+}
+
+inline bool IsImage3D(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtImage3D:
+ case EbtIImage3D:
+ case EbtUImage3D:
+ return true;
+ case EbtImage2D:
+ case EbtIImage2D:
+ case EbtUImage2D:
+ case EbtImage2DArray:
+ case EbtIImage2DArray:
+ case EbtUImage2DArray:
+ case EbtImageCube:
+ case EbtIImageCube:
+ case EbtUImageCube:
+ return false;
+ default:
+ assert(!IsImage(type));
+ }
+
+ return false;
+}
+
+inline bool IsImage2DArray(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtImage2DArray:
+ case EbtIImage2DArray:
+ case EbtUImage2DArray:
+ return true;
+ case EbtImage2D:
+ case EbtIImage2D:
+ case EbtUImage2D:
+ case EbtImage3D:
+ case EbtIImage3D:
+ case EbtUImage3D:
+ case EbtImageCube:
+ case EbtIImageCube:
+ case EbtUImageCube:
+ return false;
+ default:
+ assert(!IsImage(type));
+ }
+
+ return false;
+}
+
+inline bool IsImageCube(TBasicType type)
+{
+ switch (type)
+ {
+ case EbtImageCube:
+ case EbtIImageCube:
+ case EbtUImageCube:
+ return true;
+ case EbtImage2D:
+ case EbtIImage2D:
+ case EbtUImage2D:
+ case EbtImage3D:
+ case EbtIImage3D:
+ case EbtUImage3D:
+ case EbtImage2DArray:
+ case EbtIImage2DArray:
+ case EbtUImage2DArray:
+ return false;
+ default:
+ assert(!IsImage(type));
+ }
+
+ return false;
+}
+
+inline bool IsInteger(TBasicType type)
+{
+ return type == EbtInt || type == EbtUInt;
+}
+
+inline bool SupportsPrecision(TBasicType type)
+{
+ return type == EbtFloat || type == EbtInt || type == EbtUInt || IsOpaqueType(type);
+}
+
+//
+// Qualifiers and built-ins. These are mainly used to see what can be read
+// or written, and by the machine dependent translator to know which registers
+// to allocate variables in. Since built-ins tend to go to different registers
+// than varying or uniform, it makes sense they are peers, not sub-classes.
+//
+enum TQualifier
+{
+ EvqTemporary, // For temporaries (within a function), read/write
+ EvqGlobal, // For globals read/write
+ EvqConst, // User defined constants and non-output parameters in functions
+ EvqAttribute, // Readonly
+ EvqVaryingIn, // readonly, fragment shaders only
+ EvqVaryingOut, // vertex shaders only read/write
+ EvqUniform, // Readonly, vertex and fragment
+ EvqBuffer, // read/write, vertex, fragment and compute shader
+
+ EvqVertexIn, // Vertex shader input
+ EvqFragmentOut, // Fragment shader output
+ EvqVertexOut, // Vertex shader output
+ EvqFragmentIn, // Fragment shader input
+
+ // parameters
+ EvqIn,
+ EvqOut,
+ EvqInOut,
+ EvqConstReadOnly,
+
+ // built-ins read by vertex shader
+ EvqInstanceID,
+ EvqVertexID,
+
+ // built-ins written by vertex shader
+ EvqPosition,
+ EvqPointSize,
+
+ EvqDrawID, // ANGLE_multi_draw
+
+ EvqBaseVertex, // ANGLE_base_vertex_base_instance
+ EvqBaseInstance, // ANGLE_base_vertex_base_instance
+
+ // built-ins read by fragment shader
+ EvqFragCoord,
+ EvqFrontFacing,
+ EvqPointCoord,
+
+ // built-ins written by fragment shader
+ EvqFragColor,
+ EvqFragData,
+
+ EvqFragDepth, // gl_FragDepth for ESSL300.
+ EvqFragDepthEXT, // gl_FragDepthEXT for ESSL100, EXT_frag_depth.
+
+ EvqSecondaryFragColorEXT, // EXT_blend_func_extended
+ EvqSecondaryFragDataEXT, // EXT_blend_func_extended
+
+ EvqViewIDOVR, // OVR_multiview
+ EvqViewportIndex, // gl_ViewportIndex
+
+ // built-ins written by the shader_framebuffer_fetch extension(s)
+ EvqLastFragColor,
+ EvqLastFragData,
+
+ // GLSL ES 3.0 vertex output and fragment input
+ EvqSmooth, // Incomplete qualifier, smooth is the default
+ EvqFlat, // Incomplete qualifier
+ EvqCentroid, // Incomplete qualifier
+ EvqSmoothOut,
+ EvqFlatOut,
+ EvqCentroidOut, // Implies smooth
+ EvqSmoothIn,
+ EvqFlatIn,
+ EvqCentroidIn, // Implies smooth
+
+ // GLSL ES 3.1 compute shader special variables
+ EvqShared,
+ EvqComputeIn,
+ EvqNumWorkGroups,
+ EvqWorkGroupSize,
+ EvqWorkGroupID,
+ EvqLocalInvocationID,
+ EvqGlobalInvocationID,
+ EvqLocalInvocationIndex,
+
+ // GLSL ES 3.1 memory qualifiers
+ EvqReadOnly,
+ EvqWriteOnly,
+ EvqCoherent,
+ EvqRestrict,
+ EvqVolatile,
+
+ // GLSL ES 3.1 extension EXT_geometry_shader qualifiers
+ EvqGeometryIn,
+ EvqGeometryOut,
+ EvqPerVertexIn, // gl_in
+ EvqPrimitiveIDIn, // gl_PrimitiveIDIn
+ EvqInvocationID, // gl_InvocationID
+ EvqPrimitiveID, // gl_PrimitiveID
+ EvqLayer, // gl_Layer
+
+ // end of list
+ EvqLast
+};
+
+inline bool IsQualifierUnspecified(TQualifier qualifier)
+{
+ return (qualifier == EvqTemporary || qualifier == EvqGlobal);
+}
+
+inline bool IsStorageBuffer(TQualifier qualifier)
+{
+ return qualifier == EvqBuffer;
+}
+
+enum TLayoutImageInternalFormat
+{
+ EiifUnspecified,
+ EiifRGBA32F,
+ EiifRGBA16F,
+ EiifR32F,
+ EiifRGBA32UI,
+ EiifRGBA16UI,
+ EiifRGBA8UI,
+ EiifR32UI,
+ EiifRGBA32I,
+ EiifRGBA16I,
+ EiifRGBA8I,
+ EiifR32I,
+ EiifRGBA8,
+ EiifRGBA8_SNORM
+};
+
+enum TLayoutMatrixPacking
+{
+ EmpUnspecified,
+ EmpRowMajor,
+ EmpColumnMajor
+};
+
+enum TLayoutBlockStorage
+{
+ EbsUnspecified,
+ EbsShared,
+ EbsPacked,
+ EbsStd140,
+ EbsStd430
+};
+
+enum TYuvCscStandardEXT
+{
+ EycsUndefined,
+ EycsItu601,
+ EycsItu601FullRange,
+ EycsItu709
+};
+
+enum TLayoutPrimitiveType
+{
+ EptUndefined,
+ EptPoints,
+ EptLines,
+ EptLinesAdjacency,
+ EptTriangles,
+ EptTrianglesAdjacency,
+ EptLineStrip,
+ EptTriangleStrip
+};
+
+struct TLayoutQualifier
+{
+ // Must have a trivial default constructor since it is used in YYSTYPE.
+ TLayoutQualifier() = default;
+
+ constexpr static TLayoutQualifier Create() { return TLayoutQualifier(0); }
+
+ bool isEmpty() const
+ {
+ return location == -1 && binding == -1 && offset == -1 && numViews == -1 && yuv == false &&
+ matrixPacking == EmpUnspecified && blockStorage == EbsUnspecified &&
+ !localSize.isAnyValueSet() && imageInternalFormat == EiifUnspecified &&
+ primitiveType == EptUndefined && invocations == 0 && maxVertices == -1 &&
+ index == -1;
+ }
+
+ bool isCombinationValid() const
+ {
+ bool workSizeSpecified = localSize.isAnyValueSet();
+ bool numViewsSet = (numViews != -1);
+ bool geometryShaderSpecified =
+ (primitiveType != EptUndefined) || (invocations != 0) || (maxVertices != -1);
+ bool otherLayoutQualifiersSpecified =
+ (location != -1 || binding != -1 || index != -1 || matrixPacking != EmpUnspecified ||
+ blockStorage != EbsUnspecified || imageInternalFormat != EiifUnspecified);
+
+ // we can have either the work group size specified, or number of views,
+ // or yuv layout qualifier, or the other layout qualifiers.
+ return (workSizeSpecified ? 1 : 0) + (numViewsSet ? 1 : 0) + (yuv ? 1 : 0) +
+ (otherLayoutQualifiersSpecified ? 1 : 0) + (geometryShaderSpecified ? 1 : 0) <=
+ 1;
+ }
+
+ bool isLocalSizeEqual(const WorkGroupSize &localSizeIn) const
+ {
+ return localSize.isWorkGroupSizeMatching(localSizeIn);
+ }
+
+ int location;
+ unsigned int locationsSpecified;
+ TLayoutMatrixPacking matrixPacking;
+ TLayoutBlockStorage blockStorage;
+
+ // Compute shader layout qualifiers.
+ WorkGroupSize localSize;
+
+ int binding;
+ int offset;
+
+ // Image format layout qualifier
+ TLayoutImageInternalFormat imageInternalFormat;
+
+ // OVR_multiview num_views.
+ int numViews;
+
+ // EXT_YUV_target yuv layout qualifier.
+ bool yuv;
+
+ // OES_geometry_shader layout qualifiers.
+ TLayoutPrimitiveType primitiveType;
+ int invocations;
+ int maxVertices;
+
+ // EXT_blend_func_extended fragment output layout qualifier
+ int index;
+
+ private:
+ explicit constexpr TLayoutQualifier(int /*placeholder*/)
+ : location(-1),
+ locationsSpecified(0),
+ matrixPacking(EmpUnspecified),
+ blockStorage(EbsUnspecified),
+ localSize(-1),
+ binding(-1),
+ offset(-1),
+ imageInternalFormat(EiifUnspecified),
+ numViews(-1),
+ yuv(false),
+ primitiveType(EptUndefined),
+ invocations(0),
+ maxVertices(-1),
+ index(-1)
+ {}
+};
+
+struct TMemoryQualifier
+{
+ // Must have a trivial default constructor since it is used in YYSTYPE.
+ TMemoryQualifier() = default;
+
+ bool isEmpty() const
+ {
+ return !readonly && !writeonly && !coherent && !restrictQualifier && !volatileQualifier;
+ }
+
+ constexpr static TMemoryQualifier Create() { return TMemoryQualifier(0); }
+
+ // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
+ // An image can be qualified as both readonly and writeonly. It still can be can be used with
+ // imageSize().
+ bool readonly;
+ bool writeonly;
+ bool coherent;
+
+ // restrict and volatile are reserved keywords in C/C++
+ bool restrictQualifier;
+ bool volatileQualifier;
+
+ private:
+ explicit constexpr TMemoryQualifier(int /*placeholder*/)
+ : readonly(false),
+ writeonly(false),
+ coherent(false),
+ restrictQualifier(false),
+ volatileQualifier(false)
+ {}
+};
+
+inline const char *getWorkGroupSizeString(size_t dimension)
+{
+ switch (dimension)
+ {
+ case 0u:
+ return "local_size_x";
+ case 1u:
+ return "local_size_y";
+ case 2u:
+ return "local_size_z";
+ default:
+ UNREACHABLE();
+ return "dimension out of bounds";
+ }
+}
+
+//
+// This is just for debug and error message print out, carried along with the definitions above.
+//
+inline const char *getQualifierString(TQualifier q)
+{
+ // clang-format off
+ switch(q)
+ {
+ case EvqTemporary: return "Temporary";
+ case EvqGlobal: return "Global";
+ case EvqConst: return "const";
+ case EvqAttribute: return "attribute";
+ case EvqVaryingIn: return "varying";
+ case EvqVaryingOut: return "varying";
+ case EvqUniform: return "uniform";
+ case EvqBuffer: return "buffer";
+ case EvqVertexIn: return "in";
+ case EvqFragmentOut: return "out";
+ case EvqVertexOut: return "out";
+ case EvqFragmentIn: return "in";
+ case EvqIn: return "in";
+ case EvqOut: return "out";
+ case EvqInOut: return "inout";
+ case EvqConstReadOnly: return "const";
+ case EvqInstanceID: return "InstanceID";
+ case EvqVertexID: return "VertexID";
+ case EvqPosition: return "Position";
+ case EvqPointSize: return "PointSize";
+ case EvqDrawID: return "DrawID";
+ case EvqBaseVertex: return "BaseVertex";
+ case EvqBaseInstance: return "BaseInstance";
+ case EvqFragCoord: return "FragCoord";
+ case EvqFrontFacing: return "FrontFacing";
+ case EvqPointCoord: return "PointCoord";
+ case EvqFragColor: return "FragColor";
+ case EvqFragData: return "FragData";
+ case EvqFragDepthEXT: return "FragDepth";
+ case EvqFragDepth: return "FragDepth";
+ case EvqSecondaryFragColorEXT: return "SecondaryFragColorEXT";
+ case EvqSecondaryFragDataEXT: return "SecondaryFragDataEXT";
+ case EvqViewIDOVR: return "ViewIDOVR";
+ case EvqViewportIndex: return "ViewportIndex";
+ case EvqLayer: return "Layer";
+ case EvqLastFragColor: return "LastFragColor";
+ case EvqLastFragData: return "LastFragData";
+ case EvqSmoothOut: return "smooth out";
+ case EvqCentroidOut: return "smooth centroid out";
+ case EvqFlatOut: return "flat out";
+ case EvqSmoothIn: return "smooth in";
+ case EvqFlatIn: return "flat in";
+ case EvqCentroidIn: return "smooth centroid in";
+ case EvqCentroid: return "centroid";
+ case EvqFlat: return "flat";
+ case EvqSmooth: return "smooth";
+ case EvqShared: return "shared";
+ case EvqComputeIn: return "in";
+ case EvqNumWorkGroups: return "NumWorkGroups";
+ case EvqWorkGroupSize: return "WorkGroupSize";
+ case EvqWorkGroupID: return "WorkGroupID";
+ case EvqLocalInvocationID: return "LocalInvocationID";
+ case EvqGlobalInvocationID: return "GlobalInvocationID";
+ case EvqLocalInvocationIndex: return "LocalInvocationIndex";
+ case EvqReadOnly: return "readonly";
+ case EvqWriteOnly: return "writeonly";
+ case EvqGeometryIn: return "in";
+ case EvqGeometryOut: return "out";
+ case EvqPerVertexIn: return "gl_in";
+ default: UNREACHABLE(); return "unknown qualifier";
+ }
+ // clang-format on
+}
+
+inline const char *getMatrixPackingString(TLayoutMatrixPacking mpq)
+{
+ switch (mpq)
+ {
+ case EmpUnspecified:
+ return "mp_unspecified";
+ case EmpRowMajor:
+ return "row_major";
+ case EmpColumnMajor:
+ return "column_major";
+ default:
+ UNREACHABLE();
+ 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";
+ case EbsStd430:
+ return "std430";
+ default:
+ UNREACHABLE();
+ return "unknown block storage";
+ }
+}
+
+inline const char *getImageInternalFormatString(TLayoutImageInternalFormat iifq)
+{
+ switch (iifq)
+ {
+ case EiifRGBA32F:
+ return "rgba32f";
+ case EiifRGBA16F:
+ return "rgba16f";
+ case EiifR32F:
+ return "r32f";
+ case EiifRGBA32UI:
+ return "rgba32ui";
+ case EiifRGBA16UI:
+ return "rgba16ui";
+ case EiifRGBA8UI:
+ return "rgba8ui";
+ case EiifR32UI:
+ return "r32ui";
+ case EiifRGBA32I:
+ return "rgba32i";
+ case EiifRGBA16I:
+ return "rgba16i";
+ case EiifRGBA8I:
+ return "rgba8i";
+ case EiifR32I:
+ return "r32i";
+ case EiifRGBA8:
+ return "rgba8";
+ case EiifRGBA8_SNORM:
+ return "rgba8_snorm";
+ default:
+ UNREACHABLE();
+ return "unknown internal image format";
+ }
+}
+
+inline TYuvCscStandardEXT getYuvCscStandardEXT(const ImmutableString &str)
+{
+ if (str == "itu_601")
+ return EycsItu601;
+ else if (str == "itu_601_full_range")
+ return EycsItu601FullRange;
+ else if (str == "itu_709")
+ return EycsItu709;
+ return EycsUndefined;
+}
+
+inline const char *getYuvCscStandardEXTString(TYuvCscStandardEXT ycsq)
+{
+ switch (ycsq)
+ {
+ case EycsItu601:
+ return "itu_601";
+ case EycsItu601FullRange:
+ return "itu_601_full_range";
+ case EycsItu709:
+ return "itu_709";
+ default:
+ UNREACHABLE();
+ return "unknown color space conversion standard";
+ }
+}
+
+inline const char *getGeometryShaderPrimitiveTypeString(TLayoutPrimitiveType primitiveType)
+{
+ switch (primitiveType)
+ {
+ case EptPoints:
+ return "points";
+ case EptLines:
+ return "lines";
+ case EptTriangles:
+ return "triangles";
+ case EptLinesAdjacency:
+ return "lines_adjacency";
+ case EptTrianglesAdjacency:
+ return "triangles_adjacency";
+ case EptLineStrip:
+ return "line_strip";
+ case EptTriangleStrip:
+ return "triangle_strip";
+ default:
+ UNREACHABLE();
+ return "unknown geometry shader primitive type";
+ }
+}
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_BASETYPES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp
new file mode 100644
index 0000000000..290f84df68
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp
@@ -0,0 +1,162 @@
+//
+// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "angle_gl.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+class BuiltInFunctionEmulator::BuiltInFunctionEmulationMarker : public TIntermTraverser
+{
+ public:
+ BuiltInFunctionEmulationMarker(BuiltInFunctionEmulator &emulator)
+ : TIntermTraverser(true, false, false), mEmulator(emulator)
+ {}
+
+ bool visitUnary(Visit visit, TIntermUnary *node) override
+ {
+ if (node->getFunction())
+ {
+ bool needToEmulate = mEmulator.setFunctionCalled(node->getFunction());
+ if (needToEmulate)
+ node->setUseEmulatedFunction();
+ }
+ return true;
+ }
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ // Here we handle all the built-in functions mapped to ops, not just the ones that are
+ // currently identified as problematic.
+ if (node->isConstructor() || node->isFunctionCall())
+ {
+ return true;
+ }
+ bool needToEmulate = mEmulator.setFunctionCalled(node->getFunction());
+ if (needToEmulate)
+ node->setUseEmulatedFunction();
+ return true;
+ }
+
+ private:
+ BuiltInFunctionEmulator &mEmulator;
+};
+
+BuiltInFunctionEmulator::BuiltInFunctionEmulator() {}
+
+void BuiltInFunctionEmulator::addEmulatedFunction(const TSymbolUniqueId &uniqueId,
+ const char *emulatedFunctionDefinition)
+{
+ mEmulatedFunctions[uniqueId.get()] = std::string(emulatedFunctionDefinition);
+}
+
+void BuiltInFunctionEmulator::addEmulatedFunctionWithDependency(
+ const TSymbolUniqueId &dependency,
+ const TSymbolUniqueId &uniqueId,
+ const char *emulatedFunctionDefinition)
+{
+ mEmulatedFunctions[uniqueId.get()] = std::string(emulatedFunctionDefinition);
+ mFunctionDependencies[uniqueId.get()] = dependency.get();
+}
+
+bool BuiltInFunctionEmulator::isOutputEmpty() const
+{
+ return (mFunctions.size() == 0);
+}
+
+void BuiltInFunctionEmulator::outputEmulatedFunctions(TInfoSinkBase &out) const
+{
+ for (const auto &function : mFunctions)
+ {
+ const char *body = findEmulatedFunction(function);
+ ASSERT(body);
+ out << body;
+ out << "\n\n";
+ }
+}
+
+const char *BuiltInFunctionEmulator::findEmulatedFunction(int uniqueId) const
+{
+ for (const auto &queryFunction : mQueryFunctions)
+ {
+ const char *result = queryFunction(uniqueId);
+ if (result)
+ {
+ return result;
+ }
+ }
+
+ const auto &result = mEmulatedFunctions.find(uniqueId);
+ if (result != mEmulatedFunctions.end())
+ {
+ return result->second.c_str();
+ }
+
+ return nullptr;
+}
+
+bool BuiltInFunctionEmulator::setFunctionCalled(const TFunction *function)
+{
+ ASSERT(function != nullptr);
+ return setFunctionCalled(function->uniqueId().get());
+}
+
+bool BuiltInFunctionEmulator::setFunctionCalled(int uniqueId)
+{
+ if (!findEmulatedFunction(uniqueId))
+ {
+ return false;
+ }
+
+ for (size_t i = 0; i < mFunctions.size(); ++i)
+ {
+ if (mFunctions[i] == uniqueId)
+ return true;
+ }
+ // If the function depends on another, mark the dependency as called.
+ auto dependency = mFunctionDependencies.find(uniqueId);
+ if (dependency != mFunctionDependencies.end())
+ {
+ setFunctionCalled((*dependency).second);
+ }
+ mFunctions.push_back(uniqueId);
+ return true;
+}
+
+void BuiltInFunctionEmulator::markBuiltInFunctionsForEmulation(TIntermNode *root)
+{
+ ASSERT(root);
+
+ if (mEmulatedFunctions.empty() && mQueryFunctions.empty())
+ return;
+
+ BuiltInFunctionEmulationMarker marker(*this);
+ root->traverse(&marker);
+}
+
+void BuiltInFunctionEmulator::cleanup()
+{
+ mFunctions.clear();
+ mFunctionDependencies.clear();
+}
+
+void BuiltInFunctionEmulator::addFunctionMap(BuiltinQueryFunc queryFunc)
+{
+ mQueryFunctions.push_back(queryFunc);
+}
+
+// static
+void BuiltInFunctionEmulator::WriteEmulatedFunctionName(TInfoSinkBase &out, const char *name)
+{
+ ASSERT(name[strlen(name) - 1] != '(');
+ out << name << "_emu";
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h
new file mode 100644
index 0000000000..d15e83d75c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_
+#define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_
+
+#include "compiler/translator/InfoSink.h"
+
+namespace sh
+{
+
+class TIntermNode;
+class TFunction;
+class TSymbolUniqueId;
+
+using BuiltinQueryFunc = const char *(int);
+
+//
+// This class decides which built-in functions need to be replaced with the emulated ones. It can be
+// used to work around driver bugs or implement functions that are not natively implemented on a
+// specific platform.
+//
+class BuiltInFunctionEmulator
+{
+ public:
+ BuiltInFunctionEmulator();
+
+ void markBuiltInFunctionsForEmulation(TIntermNode *root);
+
+ void cleanup();
+
+ // "name" gets written as "name_emu".
+ static void WriteEmulatedFunctionName(TInfoSinkBase &out, const char *name);
+
+ bool isOutputEmpty() const;
+
+ // Output function emulation definition. This should be before any other shader source.
+ void outputEmulatedFunctions(TInfoSinkBase &out) const;
+
+ // Add functions that need to be emulated.
+ void addEmulatedFunction(const TSymbolUniqueId &uniqueId,
+ const char *emulatedFunctionDefinition);
+
+ void addEmulatedFunctionWithDependency(const TSymbolUniqueId &dependency,
+ const TSymbolUniqueId &uniqueId,
+ const char *emulatedFunctionDefinition);
+
+ void addFunctionMap(BuiltinQueryFunc queryFunc);
+
+ private:
+ class BuiltInFunctionEmulationMarker;
+
+ // Records that a function is called by the shader and might need to be emulated. If the
+ // function is not in mEmulatedFunctions, this becomes a no-op. Returns true if the function
+ // call needs to be replaced with an emulated one.
+ bool setFunctionCalled(const TFunction *function);
+ bool setFunctionCalled(int uniqueId);
+
+ const char *findEmulatedFunction(int uniqueId) const;
+
+ // Map from function unique id to emulated function definition
+ std::map<int, std::string> mEmulatedFunctions;
+
+ // Map from dependent functions to their dependencies. This structure allows each function to
+ // have at most one dependency.
+ std::map<int, int> mFunctionDependencies;
+
+ // Called function ids
+ std::vector<int> mFunctions;
+
+ // Constexpr function tables.
+ std::vector<BuiltinQueryFunc *> mQueryFunctions;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp
new file mode 100644
index 0000000000..dc48527480
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp
@@ -0,0 +1,284 @@
+//
+// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/VersionGLSL.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+
+namespace sh
+{
+
+void InitBuiltInAbsFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu,
+ sh::GLenum shaderType)
+{
+ if (shaderType == GL_VERTEX_SHADER)
+ {
+ emu->addEmulatedFunction(BuiltInId::abs_Int1, "int abs_emu(int x) { return x * sign(x); }");
+ }
+}
+
+void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu,
+ int targetGLSLVersion)
+{
+ // isnan() is supported since GLSL 1.3.
+ if (targetGLSLVersion < GLSL_VERSION_130)
+ return;
+
+ // !(x > 0.0 || x < 0.0 || x == 0.0) will be optimized and always equal to false.
+ emu->addEmulatedFunction(
+ BuiltInId::isnan_Float1,
+ "bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? false : x != 0.0; }");
+ emu->addEmulatedFunction(
+ BuiltInId::isnan_Float2,
+ "bvec2 isnan_emu(vec2 x)\n"
+ "{\n"
+ " bvec2 isnan;\n"
+ " for (int i = 0; i < 2; i++)\n"
+ " {\n"
+ " isnan[i] = (x[i] > 0.0 || x[i] < 0.0) ? false : x[i] != 0.0;\n"
+ " }\n"
+ " return isnan;\n"
+ "}\n");
+ emu->addEmulatedFunction(
+ BuiltInId::isnan_Float3,
+ "bvec3 isnan_emu(vec3 x)\n"
+ "{\n"
+ " bvec3 isnan;\n"
+ " for (int i = 0; i < 3; i++)\n"
+ " {\n"
+ " isnan[i] = (x[i] > 0.0 || x[i] < 0.0) ? false : x[i] != 0.0;\n"
+ " }\n"
+ " return isnan;\n"
+ "}\n");
+ emu->addEmulatedFunction(
+ BuiltInId::isnan_Float4,
+ "bvec4 isnan_emu(vec4 x)\n"
+ "{\n"
+ " bvec4 isnan;\n"
+ " for (int i = 0; i < 4; i++)\n"
+ " {\n"
+ " isnan[i] = (x[i] > 0.0 || x[i] < 0.0) ? false : x[i] != 0.0;\n"
+ " }\n"
+ " return isnan;\n"
+ "}\n");
+}
+
+void InitBuiltInAtanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu)
+{
+ emu->addEmulatedFunction(BuiltInId::atan_Float1_Float1,
+ "emu_precision float atan_emu(emu_precision float y, emu_precision "
+ "float x)\n"
+ "{\n"
+ " if (x > 0.0) return atan(y / x);\n"
+ " else if (x < 0.0 && y >= 0.0) return atan(y / x) + 3.14159265;\n"
+ " else if (x < 0.0 && y < 0.0) return atan(y / x) - 3.14159265;\n"
+ " else return 1.57079632 * sign(y);\n"
+ "}\n");
+ static const std::array<TSymbolUniqueId, 4> ids = {
+ BuiltInId::atan_Float1_Float1,
+ BuiltInId::atan_Float2_Float2,
+ BuiltInId::atan_Float3_Float3,
+ BuiltInId::atan_Float4_Float4,
+ };
+ for (int dim = 2; dim <= 4; ++dim)
+ {
+ std::stringstream ss = sh::InitializeStream<std::stringstream>();
+ ss << "emu_precision vec" << dim << " atan_emu(emu_precision vec" << dim
+ << " y, emu_precision vec" << dim << " x)\n"
+ << "{\n"
+ " return vec"
+ << dim << "(";
+ for (int i = 0; i < dim; ++i)
+ {
+ ss << "atan_emu(y[" << i << "], x[" << i << "])";
+ if (i < dim - 1)
+ {
+ ss << ", ";
+ }
+ }
+ ss << ");\n"
+ "}\n";
+ emu->addEmulatedFunctionWithDependency(BuiltInId::atan_Float1_Float1, ids[dim - 1],
+ ss.str().c_str());
+ }
+}
+
+// Emulate built-in functions missing from GLSL 1.30 and higher
+void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator *emu,
+ sh::GLenum shaderType,
+ int targetGLSLVersion)
+{
+ // Emulate packUnorm2x16 and unpackUnorm2x16 (GLSL 4.10)
+ if (targetGLSLVersion < GLSL_VERSION_410)
+ {
+ // clang-format off
+ emu->addEmulatedFunction(BuiltInId::packUnorm2x16_Float2,
+ "uint packUnorm2x16_emu(vec2 v)\n"
+ "{\n"
+ " int x = int(round(clamp(v.x, 0.0, 1.0) * 65535.0));\n"
+ " int y = int(round(clamp(v.y, 0.0, 1.0) * 65535.0));\n"
+ " return uint((y << 16) | (x & 0xFFFF));\n"
+ "}\n");
+
+ emu->addEmulatedFunction(BuiltInId::unpackUnorm2x16_UInt1,
+ "vec2 unpackUnorm2x16_emu(uint u)\n"
+ "{\n"
+ " float x = float(u & 0xFFFFu) / 65535.0;\n"
+ " float y = float(u >> 16) / 65535.0;\n"
+ " return vec2(x, y);\n"
+ "}\n");
+ // clang-format on
+ }
+
+ // Emulate packSnorm2x16, packHalf2x16, unpackSnorm2x16, and unpackHalf2x16 (GLSL 4.20)
+ // by using floatBitsToInt, floatBitsToUint, intBitsToFloat, and uintBitsToFloat (GLSL 3.30).
+ if (targetGLSLVersion >= GLSL_VERSION_330 && targetGLSLVersion < GLSL_VERSION_420)
+ {
+ // clang-format off
+ emu->addEmulatedFunction(BuiltInId::packSnorm2x16_Float2,
+ "uint packSnorm2x16_emu(vec2 v)\n"
+ "{\n"
+ " #if defined(GL_ARB_shading_language_packing)\n"
+ " return packSnorm2x16(v);\n"
+ " #else\n"
+ " int x = int(round(clamp(v.x, -1.0, 1.0) * 32767.0));\n"
+ " int y = int(round(clamp(v.y, -1.0, 1.0) * 32767.0));\n"
+ " return uint((y << 16) | (x & 0xFFFF));\n"
+ " #endif\n"
+ "}\n");
+ emu->addEmulatedFunction(BuiltInId::unpackSnorm2x16_UInt1,
+ "#if !defined(GL_ARB_shading_language_packing)\n"
+ " float fromSnorm(uint x)\n"
+ " {\n"
+ " int xi = (int(x) & 0x7FFF) - (int(x) & 0x8000);\n"
+ " return clamp(float(xi) / 32767.0, -1.0, 1.0);\n"
+ " }\n"
+ "#endif\n"
+ "\n"
+ "vec2 unpackSnorm2x16_emu(uint u)\n"
+ "{\n"
+ " #if defined(GL_ARB_shading_language_packing)\n"
+ " return unpackSnorm2x16(u);\n"
+ " #else\n"
+ " uint y = (u >> 16);\n"
+ " uint x = u;\n"
+ " return vec2(fromSnorm(x), fromSnorm(y));\n"
+ " #endif\n"
+ "}\n");
+ // Functions uint f32tof16(float val) and float f16tof32(uint val) are
+ // based on the OpenGL redbook Appendix Session "Floating-Point Formats Used in OpenGL".
+ emu->addEmulatedFunction(BuiltInId::packHalf2x16_Float2,
+ "#if !defined(GL_ARB_shading_language_packing)\n"
+ " uint f32tof16(float val)\n"
+ " {\n"
+ " uint f32 = floatBitsToUint(val);\n"
+ " uint f16 = 0u;\n"
+ " uint sign = (f32 >> 16) & 0x8000u;\n"
+ " int exponent = int((f32 >> 23) & 0xFFu) - 127;\n"
+ " uint mantissa = f32 & 0x007FFFFFu;\n"
+ " if (exponent == 128)\n"
+ " {\n"
+ " // Infinity or NaN\n"
+ " // NaN bits that are masked out by 0x3FF get discarded.\n"
+ " // This can turn some NaNs to infinity, but this is allowed by the spec.\n"
+ " f16 = sign | (0x1Fu << 10);\n"
+ " f16 |= (mantissa & 0x3FFu);\n"
+ " }\n"
+ " else if (exponent > 15)\n"
+ " {\n"
+ " // Overflow - flush to Infinity\n"
+ " f16 = sign | (0x1Fu << 10);\n"
+ " }\n"
+ " else if (exponent > -15)\n"
+ " {\n"
+ " // Representable value\n"
+ " exponent += 15;\n"
+ " mantissa >>= 13;\n"
+ " f16 = sign | uint(exponent << 10) | mantissa;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " f16 = sign;\n"
+ " }\n"
+ " return f16;\n"
+ " }\n"
+ "#endif\n"
+ "\n"
+ "uint packHalf2x16_emu(vec2 v)\n"
+ "{\n"
+ " #if defined(GL_ARB_shading_language_packing)\n"
+ " return packHalf2x16(v);\n"
+ " #else\n"
+ " uint x = f32tof16(v.x);\n"
+ " uint y = f32tof16(v.y);\n"
+ " return (y << 16) | x;\n"
+ " #endif\n"
+ "}\n");
+ emu->addEmulatedFunction(BuiltInId::unpackHalf2x16_UInt1,
+ "#if !defined(GL_ARB_shading_language_packing)\n"
+ " float f16tof32(uint val)\n"
+ " {\n"
+ " uint sign = (val & 0x8000u) << 16;\n"
+ " int exponent = int((val & 0x7C00u) >> 10);\n"
+ " uint mantissa = val & 0x03FFu;\n"
+ " float f32 = 0.0;\n"
+ " if(exponent == 0)\n"
+ " {\n"
+ " if (mantissa != 0u)\n"
+ " {\n"
+ " const float scale = 1.0 / (1 << 24);\n"
+ " f32 = scale * mantissa;\n"
+ " }\n"
+ " }\n"
+ " else if (exponent == 31)\n"
+ " {\n"
+ " return uintBitsToFloat(sign | 0x7F800000u | mantissa);\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " exponent -= 15;\n"
+ " float scale;\n"
+ " if(exponent < 0)\n"
+ " {\n"
+ " // The negative unary operator is buggy on OSX.\n"
+ " // Work around this by using abs instead.\n"
+ " scale = 1.0 / (1 << abs(exponent));\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " scale = 1 << exponent;\n"
+ " }\n"
+ " float decimal = 1.0 + float(mantissa) / float(1 << 10);\n"
+ " f32 = scale * decimal;\n"
+ " }\n"
+ "\n"
+ " if (sign != 0u)\n"
+ " {\n"
+ " f32 = -f32;\n"
+ " }\n"
+ "\n"
+ " return f32;\n"
+ " }\n"
+ "#endif\n"
+ "\n"
+ "vec2 unpackHalf2x16_emu(uint u)\n"
+ "{\n"
+ " #if defined(GL_ARB_shading_language_packing)\n"
+ " return unpackHalf2x16(u);\n"
+ " #else\n"
+ " uint y = (u >> 16);\n"
+ " uint x = u & 0xFFFFu;\n"
+ " return vec2(f16tof32(x), f16tof32(y));\n"
+ " #endif\n"
+ "}\n");
+ // clang-format on
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h
new file mode 100644
index 0000000000..e1b4779bd5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_
+#define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_
+
+#include "GLSLANG/ShaderLang.h"
+
+namespace sh
+{
+class BuiltInFunctionEmulator;
+
+//
+// This works around bug in Intel Mac drivers.
+//
+void InitBuiltInAbsFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu,
+ sh::GLenum shaderType);
+
+//
+// This works around isnan() bug in Intel Mac drivers
+//
+void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu,
+ int targetGLSLVersion);
+//
+// This works around atan(y, x) bug in NVIDIA drivers.
+//
+void InitBuiltInAtanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu);
+
+//
+// This function is emulating built-in functions missing from GLSL 1.30 and higher.
+//
+void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator *emu,
+ sh::GLenum shaderType,
+ int targetGLSLVersion);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp
new file mode 100644
index 0000000000..b4bca0d36d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp
@@ -0,0 +1,173 @@
+//
+// 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 "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
+#include "angle_gl.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/VersionGLSL.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+
+namespace sh
+{
+
+// Defined in emulated_builtin_functions_hlsl_autogen.cpp.
+const char *FindHLSLFunction(int uniqueId);
+
+void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator *emu,
+ int targetGLSLVersion)
+{
+ if (targetGLSLVersion < GLSL_VERSION_130)
+ return;
+
+ emu->addEmulatedFunction(BuiltInId::isnan_Float1,
+ "bool isnan_emu(float x)\n"
+ "{\n"
+ " return (x > 0.0 || x < 0.0) ? false : x != 0.0;\n"
+ "}\n"
+ "\n");
+
+ emu->addEmulatedFunction(
+ BuiltInId::isnan_Float2,
+ "bool2 isnan_emu(float2 x)\n"
+ "{\n"
+ " bool2 isnan;\n"
+ " for (int i = 0; i < 2; i++)\n"
+ " {\n"
+ " isnan[i] = (x[i] > 0.0 || x[i] < 0.0) ? false : x[i] != 0.0;\n"
+ " }\n"
+ " return isnan;\n"
+ "}\n");
+
+ emu->addEmulatedFunction(
+ BuiltInId::isnan_Float3,
+ "bool3 isnan_emu(float3 x)\n"
+ "{\n"
+ " bool3 isnan;\n"
+ " for (int i = 0; i < 3; i++)\n"
+ " {\n"
+ " isnan[i] = (x[i] > 0.0 || x[i] < 0.0) ? false : x[i] != 0.0;\n"
+ " }\n"
+ " return isnan;\n"
+ "}\n");
+
+ emu->addEmulatedFunction(
+ BuiltInId::isnan_Float4,
+ "bool4 isnan_emu(float4 x)\n"
+ "{\n"
+ " bool4 isnan;\n"
+ " for (int i = 0; i < 4; i++)\n"
+ " {\n"
+ " isnan[i] = (x[i] > 0.0 || x[i] < 0.0) ? false : x[i] != 0.0;\n"
+ " }\n"
+ " return isnan;\n"
+ "}\n");
+}
+
+void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu)
+{
+ emu->addFunctionMap(FindHLSLFunction);
+
+ // (a + b2^16) * (c + d2^16) = ac + (ad + bc) * 2^16 + bd * 2^32
+ // Also note that below, a * d + ((a * c) >> 16) is guaranteed not to overflow, because:
+ // a <= 0xffff, d <= 0xffff, ((a * c) >> 16) <= 0xffff and 0xffff * 0xffff + 0xffff = 0xffff0000
+ emu->addEmulatedFunction(BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1,
+ "void umulExtended_emu(uint x, uint y, out uint msb, out uint lsb)\n"
+ "{\n"
+ " lsb = x * y;\n"
+ " uint a = (x & 0xffffu);\n"
+ " uint b = (x >> 16);\n"
+ " uint c = (y & 0xffffu);\n"
+ " uint d = (y >> 16);\n"
+ " uint ad = a * d + ((a * c) >> 16);\n"
+ " uint bc = b * c;\n"
+ " uint carry = uint(ad > (0xffffffffu - bc));\n"
+ " msb = ((ad + bc) >> 16) + (carry << 16) + b * d;\n"
+ "}\n");
+ emu->addEmulatedFunctionWithDependency(
+ BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1,
+ BuiltInId::umulExtended_UInt2_UInt2_UInt2_UInt2,
+ "void umulExtended_emu(uint2 x, uint2 y, out uint2 msb, out uint2 lsb)\n"
+ "{\n"
+ " umulExtended_emu(x.x, y.x, msb.x, lsb.x);\n"
+ " umulExtended_emu(x.y, y.y, msb.y, lsb.y);\n"
+ "}\n");
+ emu->addEmulatedFunctionWithDependency(
+ BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1,
+ BuiltInId::umulExtended_UInt3_UInt3_UInt3_UInt3,
+ "void umulExtended_emu(uint3 x, uint3 y, out uint3 msb, out uint3 lsb)\n"
+ "{\n"
+ " umulExtended_emu(x.x, y.x, msb.x, lsb.x);\n"
+ " umulExtended_emu(x.y, y.y, msb.y, lsb.y);\n"
+ " umulExtended_emu(x.z, y.z, msb.z, lsb.z);\n"
+ "}\n");
+ emu->addEmulatedFunctionWithDependency(
+ BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1,
+ BuiltInId::umulExtended_UInt4_UInt4_UInt4_UInt4,
+ "void umulExtended_emu(uint4 x, uint4 y, out uint4 msb, out uint4 lsb)\n"
+ "{\n"
+ " umulExtended_emu(x.x, y.x, msb.x, lsb.x);\n"
+ " umulExtended_emu(x.y, y.y, msb.y, lsb.y);\n"
+ " umulExtended_emu(x.z, y.z, msb.z, lsb.z);\n"
+ " umulExtended_emu(x.w, y.w, msb.w, lsb.w);\n"
+ "}\n");
+
+ // The imul emulation does two's complement negation on the lsb and msb manually in case the
+ // result needs to be negative.
+ // TODO(oetuaho): Note that this code doesn't take one edge case into account, where x or y is
+ // -2^31. abs(-2^31) is undefined.
+ emu->addEmulatedFunctionWithDependency(
+ BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1,
+ BuiltInId::imulExtended_Int1_Int1_Int1_Int1,
+ "void imulExtended_emu(int x, int y, out int msb, out int lsb)\n"
+ "{\n"
+ " uint unsignedMsb;\n"
+ " uint unsignedLsb;\n"
+ " bool negative = (x < 0) != (y < 0);\n"
+ " umulExtended_emu(uint(abs(x)), uint(abs(y)), unsignedMsb, unsignedLsb);\n"
+ " lsb = asint(unsignedLsb);\n"
+ " msb = asint(unsignedMsb);\n"
+ " if (negative)\n"
+ " {\n"
+ " lsb = ~lsb;\n"
+ " msb = ~msb;\n"
+ " if (lsb == 0xffffffff)\n"
+ " {\n"
+ " lsb = 0;\n"
+ " msb += 1;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " lsb += 1;\n"
+ " }\n"
+ " }\n"
+ "}\n");
+ emu->addEmulatedFunctionWithDependency(
+ BuiltInId::imulExtended_Int1_Int1_Int1_Int1, BuiltInId::imulExtended_Int2_Int2_Int2_Int2,
+ "void imulExtended_emu(int2 x, int2 y, out int2 msb, out int2 lsb)\n"
+ "{\n"
+ " imulExtended_emu(x.x, y.x, msb.x, lsb.x);\n"
+ " imulExtended_emu(x.y, y.y, msb.y, lsb.y);\n"
+ "}\n");
+ emu->addEmulatedFunctionWithDependency(
+ BuiltInId::imulExtended_Int1_Int1_Int1_Int1, BuiltInId::imulExtended_Int3_Int3_Int3_Int3,
+ "void imulExtended_emu(int3 x, int3 y, out int3 msb, out int3 lsb)\n"
+ "{\n"
+ " imulExtended_emu(x.x, y.x, msb.x, lsb.x);\n"
+ " imulExtended_emu(x.y, y.y, msb.y, lsb.y);\n"
+ " imulExtended_emu(x.z, y.z, msb.z, lsb.z);\n"
+ "}\n");
+ emu->addEmulatedFunctionWithDependency(
+ BuiltInId::imulExtended_Int1_Int1_Int1_Int1, BuiltInId::imulExtended_Int4_Int4_Int4_Int4,
+ "void imulExtended_emu(int4 x, int4 y, out int4 msb, out int4 lsb)\n"
+ "{\n"
+ " imulExtended_emu(x.x, y.x, msb.x, lsb.x);\n"
+ " imulExtended_emu(x.y, y.y, msb.y, lsb.y);\n"
+ " imulExtended_emu(x.z, y.z, msb.z, lsb.z);\n"
+ " imulExtended_emu(x.w, y.w, msb.w, lsb.w);\n"
+ "}\n");
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h
new file mode 100644
index 0000000000..48da73f58e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_
+#define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_
+
+#include "GLSLANG/ShaderLang.h"
+
+namespace sh
+{
+
+class BuiltInFunctionEmulator;
+
+void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu);
+
+//
+// This works around isnan() bug on some Intel drivers.
+//
+void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator *emu,
+ int targetGLSLVersion);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/CallDAG.cpp b/gfx/angle/checkout/src/compiler/translator/CallDAG.cpp
new file mode 100644
index 0000000000..63c8cd0f92
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/CallDAG.cpp
@@ -0,0 +1,316 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// CallDAG.h: Implements a call graph DAG of functions to be re-used accross
+// analyses, allows to efficiently traverse the functions in topological
+// order.
+
+#include "compiler/translator/CallDAG.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+// The CallDAGCreator does all the processing required to create the CallDAG
+// structure so that the latter contains only the necessary variables.
+class CallDAG::CallDAGCreator : public TIntermTraverser
+{
+ public:
+ CallDAGCreator(TDiagnostics *diagnostics)
+ : TIntermTraverser(true, false, false),
+ mDiagnostics(diagnostics),
+ mCurrentFunction(nullptr),
+ mCurrentIndex(0)
+ {}
+
+ InitResult assignIndices()
+ {
+ int skipped = 0;
+ for (auto &it : mFunctions)
+ {
+ // Skip unimplemented functions
+ if (it.second.definitionNode)
+ {
+ InitResult result = assignIndicesInternal(&it.second);
+ if (result != INITDAG_SUCCESS)
+ {
+ return result;
+ }
+ }
+ else
+ {
+ skipped++;
+ }
+ }
+
+ ASSERT(mFunctions.size() == mCurrentIndex + skipped);
+ return INITDAG_SUCCESS;
+ }
+
+ void fillDataStructures(std::vector<Record> *records, std::map<int, int> *idToIndex)
+ {
+ ASSERT(records->empty());
+ ASSERT(idToIndex->empty());
+
+ records->resize(mCurrentIndex);
+
+ for (auto &it : mFunctions)
+ {
+ CreatorFunctionData &data = it.second;
+ // Skip unimplemented functions
+ if (!data.definitionNode)
+ {
+ continue;
+ }
+ ASSERT(data.index < records->size());
+ Record &record = (*records)[data.index];
+
+ record.node = data.definitionNode;
+
+ record.callees.reserve(data.callees.size());
+ for (auto &callee : data.callees)
+ {
+ record.callees.push_back(static_cast<int>(callee->index));
+ }
+
+ (*idToIndex)[it.first] = static_cast<int>(data.index);
+ }
+ }
+
+ private:
+ struct CreatorFunctionData
+ {
+ CreatorFunctionData()
+ : definitionNode(nullptr), name(""), index(0), indexAssigned(false), visiting(false)
+ {}
+
+ std::set<CreatorFunctionData *> callees;
+ TIntermFunctionDefinition *definitionNode;
+ ImmutableString name;
+ size_t index;
+ bool indexAssigned;
+ bool visiting;
+ };
+
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override
+ {
+ // Create the record if need be and remember the definition node.
+ mCurrentFunction = &mFunctions[node->getFunction()->uniqueId().get()];
+ // Name will be overwritten here. If we've already traversed the prototype of this function,
+ // it should have had the same name.
+ ASSERT(mCurrentFunction->name == "" ||
+ mCurrentFunction->name == node->getFunction()->name());
+ mCurrentFunction->name = node->getFunction()->name();
+ mCurrentFunction->definitionNode = node;
+
+ node->getBody()->traverse(this);
+ mCurrentFunction = nullptr;
+ return false;
+ }
+
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override
+ {
+ ASSERT(mCurrentFunction == nullptr);
+
+ // Function declaration, create an empty record.
+ auto &record = mFunctions[node->getFunction()->uniqueId().get()];
+ record.name = node->getFunction()->name();
+ }
+
+ // Track functions called from another function.
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ if (node->getOp() == EOpCallFunctionInAST)
+ {
+ // Function call, add the callees
+ auto it = mFunctions.find(node->getFunction()->uniqueId().get());
+ ASSERT(it != mFunctions.end());
+
+ // We might be traversing the initializer of a global variable. Even though function
+ // calls in global scope are forbidden by the parser, some subsequent AST
+ // transformations can add them to emulate particular features.
+ if (mCurrentFunction)
+ {
+ mCurrentFunction->callees.insert(&it->second);
+ }
+ }
+ return true;
+ }
+
+ // Recursively assigns indices to a sub DAG
+ InitResult assignIndicesInternal(CreatorFunctionData *root)
+ {
+ // Iterative implementation of the index assignment algorithm. A recursive version
+ // would be prettier but since the CallDAG creation runs before the limiting of the
+ // call depth, we might get stack overflows (computation of the call depth uses the
+ // CallDAG).
+
+ ASSERT(root);
+
+ if (root->indexAssigned)
+ {
+ return INITDAG_SUCCESS;
+ }
+
+ // If we didn't have to detect recursion, functionsToProcess could be a simple queue
+ // in which we add the function being processed's callees. However in order to detect
+ // recursion we need to know which functions we are currently visiting. For that reason
+ // functionsToProcess will look like a concatenation of segments of the form
+ // [F visiting = true, subset of F callees with visiting = false] and the following
+ // segment (if any) will be start with a callee of F.
+ // This way we can remember when we started visiting a function, to put visiting back
+ // to false.
+ TVector<CreatorFunctionData *> functionsToProcess;
+ functionsToProcess.push_back(root);
+
+ InitResult result = INITDAG_SUCCESS;
+
+ std::stringstream errorStream = sh::InitializeStream<std::stringstream>();
+
+ while (!functionsToProcess.empty())
+ {
+ CreatorFunctionData *function = functionsToProcess.back();
+
+ if (function->visiting)
+ {
+ function->visiting = false;
+ function->index = mCurrentIndex++;
+ function->indexAssigned = true;
+
+ functionsToProcess.pop_back();
+ continue;
+ }
+
+ if (!function->definitionNode)
+ {
+ errorStream << "Undefined function '" << function->name
+ << ")' used in the following call chain:";
+ result = INITDAG_UNDEFINED;
+ break;
+ }
+
+ if (function->indexAssigned)
+ {
+ functionsToProcess.pop_back();
+ continue;
+ }
+
+ function->visiting = true;
+
+ for (auto callee : function->callees)
+ {
+ functionsToProcess.push_back(callee);
+
+ // Check if the callee is already being visited after pushing it so that it appears
+ // in the chain printed in the info log.
+ if (callee->visiting)
+ {
+ errorStream << "Recursive function call in the following call chain:";
+ result = INITDAG_RECURSION;
+ break;
+ }
+ }
+
+ if (result != INITDAG_SUCCESS)
+ {
+ break;
+ }
+ }
+
+ // The call chain is made of the function we were visiting when the error was detected.
+ if (result != INITDAG_SUCCESS)
+ {
+ bool first = true;
+ for (auto function : functionsToProcess)
+ {
+ if (function->visiting)
+ {
+ if (!first)
+ {
+ errorStream << " -> ";
+ }
+ errorStream << function->name << ")";
+ first = false;
+ }
+ }
+ if (mDiagnostics)
+ {
+ std::string errorStr = errorStream.str();
+ mDiagnostics->globalError(errorStr.c_str());
+ }
+ }
+
+ return result;
+ }
+
+ TDiagnostics *mDiagnostics;
+
+ std::map<int, CreatorFunctionData> mFunctions;
+ CreatorFunctionData *mCurrentFunction;
+ size_t mCurrentIndex;
+};
+
+// CallDAG
+
+CallDAG::CallDAG() {}
+
+CallDAG::~CallDAG() {}
+
+const size_t CallDAG::InvalidIndex = std::numeric_limits<size_t>::max();
+
+size_t CallDAG::findIndex(const TSymbolUniqueId &id) const
+{
+ auto it = mFunctionIdToIndex.find(id.get());
+
+ if (it == mFunctionIdToIndex.end())
+ {
+ return InvalidIndex;
+ }
+ else
+ {
+ return it->second;
+ }
+}
+
+const CallDAG::Record &CallDAG::getRecordFromIndex(size_t index) const
+{
+ ASSERT(index != InvalidIndex && index < mRecords.size());
+ return mRecords[index];
+}
+
+size_t CallDAG::size() const
+{
+ return mRecords.size();
+}
+
+void CallDAG::clear()
+{
+ mRecords.clear();
+ mFunctionIdToIndex.clear();
+}
+
+CallDAG::InitResult CallDAG::init(TIntermNode *root, TDiagnostics *diagnostics)
+{
+ CallDAGCreator creator(diagnostics);
+
+ // Creates the mapping of functions to callees
+ root->traverse(&creator);
+
+ // Does the topological sort and detects recursions
+ InitResult result = creator.assignIndices();
+ if (result != INITDAG_SUCCESS)
+ {
+ return result;
+ }
+
+ creator.fillDataStructures(&mRecords, &mFunctionIdToIndex);
+ return INITDAG_SUCCESS;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/CallDAG.h b/gfx/angle/checkout/src/compiler/translator/CallDAG.h
new file mode 100644
index 0000000000..813fc75573
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/CallDAG.h
@@ -0,0 +1,77 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// CallDAG.h: Defines a call graph DAG of functions to be re-used accross
+// analyses, allows to efficiently traverse the functions in topological
+// order.
+
+#ifndef COMPILER_TRANSLATOR_CALLDAG_H_
+#define COMPILER_TRANSLATOR_CALLDAG_H_
+
+#include <map>
+
+#include "compiler/translator/IntermNode.h"
+
+namespace sh
+{
+
+// The translator needs to analyze the the graph of the function calls
+// to run checks and analyses; since in GLSL recursion is not allowed
+// that graph is a DAG.
+// This class is used to precompute that function call DAG so that it
+// can be reused by multiple analyses.
+//
+// It stores a vector of function records, with one record per defined function.
+// Records are accessed by index but a function symbol id can be converted
+// to the index of the corresponding record. The records contain the AST node
+// of the function definition and the indices of the function's callees.
+//
+// In addition, records are in reverse topological order: a function F being
+// called by a function G will have index index(F) < index(G), that way
+// depth-first analysis becomes analysis in the order of indices.
+
+class CallDAG : angle::NonCopyable
+{
+ public:
+ CallDAG();
+ ~CallDAG();
+
+ struct Record
+ {
+ TIntermFunctionDefinition *node; // Guaranteed to be non-null.
+ std::vector<int> callees;
+ };
+
+ enum InitResult
+ {
+ INITDAG_SUCCESS,
+ INITDAG_RECURSION,
+ INITDAG_UNDEFINED,
+ };
+
+ // Returns INITDAG_SUCCESS if it was able to create the DAG, otherwise prints
+ // the initialization error in diagnostics, if present.
+ InitResult init(TIntermNode *root, TDiagnostics *diagnostics);
+
+ // Returns InvalidIndex if the function wasn't found
+ size_t findIndex(const TSymbolUniqueId &id) const;
+
+ const Record &getRecordFromIndex(size_t index) const;
+ size_t size() const;
+ void clear();
+
+ const static size_t InvalidIndex;
+
+ private:
+ std::vector<Record> mRecords;
+ std::map<int, int> mFunctionIdToIndex;
+
+ class CallDAGCreator;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_CALLDAG_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/CodeGen.cpp b/gfx/angle/checkout/src/compiler/translator/CodeGen.cpp
new file mode 100644
index 0000000000..6dc9485589
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/CodeGen.cpp
@@ -0,0 +1,75 @@
+//
+// 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.
+//
+
+#ifdef ANGLE_ENABLE_ESSL
+# include "compiler/translator/TranslatorESSL.h"
+#endif // ANGLE_ENABLE_ESSL
+
+#ifdef ANGLE_ENABLE_GLSL
+# include "compiler/translator/TranslatorGLSL.h"
+#endif // ANGLE_ENABLE_GLSL
+
+#ifdef ANGLE_ENABLE_HLSL
+# include "compiler/translator/TranslatorHLSL.h"
+#endif // ANGLE_ENABLE_HLSL
+
+#ifdef ANGLE_ENABLE_VULKAN
+# include "compiler/translator/TranslatorVulkan.h"
+#endif // ANGLE_ENABLE_VULKAN
+
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+//
+// This function must be provided to create the actual
+// compile object used by higher level code. It returns
+// a subclass of TCompiler.
+//
+TCompiler *ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
+{
+#ifdef ANGLE_ENABLE_ESSL
+ if (IsOutputESSL(output))
+ {
+ return new TranslatorESSL(type, spec);
+ }
+#endif // ANGLE_ENABLE_ESSL
+
+#ifdef ANGLE_ENABLE_GLSL
+ if (IsOutputGLSL(output))
+ {
+ return new TranslatorGLSL(type, spec, output);
+ }
+#endif // ANGLE_ENABLE_GLSL
+
+#ifdef ANGLE_ENABLE_HLSL
+ if (IsOutputHLSL(output))
+ {
+ return new TranslatorHLSL(type, spec, output);
+ }
+#endif // ANGLE_ENABLE_HLSL
+
+#ifdef ANGLE_ENABLE_VULKAN
+ if (IsOutputVulkan(output))
+ {
+ return new TranslatorVulkan(type, spec);
+ }
+#endif // ANGLE_ENABLE_VULKAN
+
+ // Unsupported compiler or unknown format. Return nullptr per the sh::ConstructCompiler API.
+ return nullptr;
+}
+
+//
+// Delete the compiler made by ConstructCompiler
+//
+void DeleteCompiler(TCompiler *compiler)
+{
+ SafeDelete(compiler);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp b/gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp
new file mode 100644
index 0000000000..e8bc6edd16
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp
@@ -0,0 +1,970 @@
+//
+// 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.
+//
+// CollectVariables.cpp: Collect lists of shader interface variables based on the AST.
+
+#include "compiler/translator/CollectVariables.h"
+
+#include "angle_gl.h"
+#include "common/utilities.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage)
+{
+ switch (blockStorage)
+ {
+ case EbsPacked:
+ return BLOCKLAYOUT_PACKED;
+ case EbsShared:
+ return BLOCKLAYOUT_SHARED;
+ case EbsStd140:
+ return BLOCKLAYOUT_STD140;
+ case EbsStd430:
+ return BLOCKLAYOUT_STD430;
+ default:
+ UNREACHABLE();
+ return BLOCKLAYOUT_SHARED;
+ }
+}
+
+// TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
+BlockType GetBlockType(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqUniform:
+ return BlockType::BLOCK_UNIFORM;
+ case EvqBuffer:
+ return BlockType::BLOCK_BUFFER;
+ case EvqPerVertexIn:
+ return BlockType::BLOCK_IN;
+ default:
+ UNREACHABLE();
+ return BlockType::BLOCK_UNIFORM;
+ }
+}
+
+template <class VarT>
+VarT *FindVariable(const ImmutableString &name, std::vector<VarT> *infoList)
+{
+ // TODO(zmo): optimize this function.
+ for (size_t ii = 0; ii < infoList->size(); ++ii)
+ {
+ if (name == (*infoList)[ii].name)
+ return &((*infoList)[ii]);
+ }
+
+ return nullptr;
+}
+
+// Note that this shouldn't be called for interface blocks - active information is collected for
+// individual fields in case of interface blocks.
+void MarkActive(ShaderVariable *variable)
+{
+ if (!variable->active)
+ {
+ if (variable->isStruct())
+ {
+ // Conservatively assume all fields are statically used as well.
+ for (auto &field : variable->fields)
+ {
+ MarkActive(&field);
+ }
+ }
+ ASSERT(variable->staticUse);
+ variable->active = true;
+ }
+}
+
+ShaderVariable *FindVariableInInterfaceBlock(const ImmutableString &name,
+ const TInterfaceBlock *interfaceBlock,
+ std::vector<InterfaceBlock> *infoList)
+{
+ ASSERT(interfaceBlock);
+ InterfaceBlock *namedBlock = FindVariable(interfaceBlock->name(), infoList);
+ ASSERT(namedBlock);
+
+ // Set static use on the parent interface block here
+ namedBlock->staticUse = true;
+ namedBlock->active = true;
+ return FindVariable(name, &namedBlock->fields);
+}
+
+// Traverses the intermediate tree to collect all attributes, uniforms, varyings, fragment outputs,
+// and interface blocks.
+class CollectVariablesTraverser : public TIntermTraverser
+{
+ public:
+ CollectVariablesTraverser(std::vector<Attribute> *attribs,
+ std::vector<OutputVariable> *outputVariables,
+ std::vector<Uniform> *uniforms,
+ std::vector<Varying> *inputVaryings,
+ std::vector<Varying> *outputVaryings,
+ std::vector<InterfaceBlock> *uniformBlocks,
+ std::vector<InterfaceBlock> *shaderStorageBlocks,
+ std::vector<InterfaceBlock> *inBlocks,
+ ShHashFunction64 hashFunction,
+ TSymbolTable *symbolTable,
+ GLenum shaderType,
+ const TExtensionBehavior &extensionBehavior);
+
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override;
+ void visitSymbol(TIntermSymbol *symbol) override;
+ bool visitDeclaration(Visit, TIntermDeclaration *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *binaryNode) override;
+
+ private:
+ std::string getMappedName(const TSymbol *symbol) const;
+
+ void setFieldOrVariableProperties(const TType &type,
+ bool staticUse,
+ ShaderVariable *variableOut) const;
+ void setFieldProperties(const TType &type,
+ const ImmutableString &name,
+ bool staticUse,
+ ShaderVariable *variableOut) const;
+ void setCommonVariableProperties(const TType &type,
+ const TVariable &variable,
+ ShaderVariable *variableOut) const;
+
+ Attribute recordAttribute(const TIntermSymbol &variable) const;
+ OutputVariable recordOutputVariable(const TIntermSymbol &variable) const;
+ Varying recordVarying(const TIntermSymbol &variable) const;
+ void recordInterfaceBlock(const char *instanceName,
+ const TType &interfaceBlockType,
+ InterfaceBlock *interfaceBlock) const;
+ Uniform recordUniform(const TIntermSymbol &variable) const;
+
+ void setBuiltInInfoFromSymbol(const TVariable &variable, ShaderVariable *info);
+
+ void recordBuiltInVaryingUsed(const TVariable &variable,
+ bool *addedFlag,
+ std::vector<Varying> *varyings);
+ void recordBuiltInFragmentOutputUsed(const TVariable &variable, bool *addedFlag);
+ void recordBuiltInAttributeUsed(const TVariable &variable, bool *addedFlag);
+ InterfaceBlock *recordGLInUsed(const TType &glInType);
+ InterfaceBlock *findNamedInterfaceBlock(const ImmutableString &name) const;
+
+ std::vector<Attribute> *mAttribs;
+ std::vector<OutputVariable> *mOutputVariables;
+ std::vector<Uniform> *mUniforms;
+ std::vector<Varying> *mInputVaryings;
+ std::vector<Varying> *mOutputVaryings;
+ std::vector<InterfaceBlock> *mUniformBlocks;
+ std::vector<InterfaceBlock> *mShaderStorageBlocks;
+ std::vector<InterfaceBlock> *mInBlocks;
+
+ std::map<std::string, InterfaceBlockField *> mInterfaceBlockFields;
+
+ // Shader uniforms
+ bool mDepthRangeAdded;
+
+ // Vertex Shader builtins
+ bool mInstanceIDAdded;
+ bool mVertexIDAdded;
+ bool mPointSizeAdded;
+ bool mDrawIDAdded;
+ bool mBaseVertexAdded;
+ bool mBaseInstanceAdded;
+
+ // Vertex Shader and Geometry Shader builtins
+ bool mPositionAdded;
+
+ // Fragment Shader builtins
+ bool mPointCoordAdded;
+ bool mFrontFacingAdded;
+ bool mFragCoordAdded;
+ bool mLastFragDataAdded;
+ bool mFragColorAdded;
+ bool mFragDataAdded;
+ bool mFragDepthEXTAdded;
+ bool mFragDepthAdded;
+ bool mSecondaryFragColorEXTAdded;
+ bool mSecondaryFragDataEXTAdded;
+
+ // Geometry Shader builtins
+ bool mPerVertexInAdded;
+ bool mPrimitiveIDInAdded;
+ bool mInvocationIDAdded;
+
+ // Geometry Shader and Fragment Shader builtins
+ bool mPrimitiveIDAdded;
+ bool mLayerAdded;
+
+ ShHashFunction64 mHashFunction;
+
+ GLenum mShaderType;
+ const TExtensionBehavior &mExtensionBehavior;
+};
+
+CollectVariablesTraverser::CollectVariablesTraverser(
+ std::vector<sh::Attribute> *attribs,
+ std::vector<sh::OutputVariable> *outputVariables,
+ std::vector<sh::Uniform> *uniforms,
+ std::vector<sh::Varying> *inputVaryings,
+ std::vector<sh::Varying> *outputVaryings,
+ std::vector<sh::InterfaceBlock> *uniformBlocks,
+ std::vector<sh::InterfaceBlock> *shaderStorageBlocks,
+ std::vector<sh::InterfaceBlock> *inBlocks,
+ ShHashFunction64 hashFunction,
+ TSymbolTable *symbolTable,
+ GLenum shaderType,
+ const TExtensionBehavior &extensionBehavior)
+ : TIntermTraverser(true, false, false, symbolTable),
+ mAttribs(attribs),
+ mOutputVariables(outputVariables),
+ mUniforms(uniforms),
+ mInputVaryings(inputVaryings),
+ mOutputVaryings(outputVaryings),
+ mUniformBlocks(uniformBlocks),
+ mShaderStorageBlocks(shaderStorageBlocks),
+ mInBlocks(inBlocks),
+ mDepthRangeAdded(false),
+ mInstanceIDAdded(false),
+ mVertexIDAdded(false),
+ mPointSizeAdded(false),
+ mDrawIDAdded(false),
+ mBaseVertexAdded(false),
+ mBaseInstanceAdded(false),
+ mPositionAdded(false),
+ mPointCoordAdded(false),
+ mFrontFacingAdded(false),
+ mFragCoordAdded(false),
+ mLastFragDataAdded(false),
+ mFragColorAdded(false),
+ mFragDataAdded(false),
+ mFragDepthEXTAdded(false),
+ mFragDepthAdded(false),
+ mSecondaryFragColorEXTAdded(false),
+ mSecondaryFragDataEXTAdded(false),
+ mPerVertexInAdded(false),
+ mPrimitiveIDInAdded(false),
+ mInvocationIDAdded(false),
+ mPrimitiveIDAdded(false),
+ mLayerAdded(false),
+ mHashFunction(hashFunction),
+ mShaderType(shaderType),
+ mExtensionBehavior(extensionBehavior)
+{}
+
+std::string CollectVariablesTraverser::getMappedName(const TSymbol *symbol) const
+{
+ return HashName(symbol, mHashFunction, nullptr).data();
+}
+
+void CollectVariablesTraverser::setBuiltInInfoFromSymbol(const TVariable &variable,
+ ShaderVariable *info)
+{
+ const TType &type = variable.getType();
+
+ info->name = variable.name().data();
+ info->mappedName = variable.name().data();
+ info->type = GLVariableType(type);
+ info->precision = GLVariablePrecision(type);
+ if (auto *arraySizes = type.getArraySizes())
+ {
+ info->arraySizes.assign(arraySizes->begin(), arraySizes->end());
+ }
+}
+
+void CollectVariablesTraverser::recordBuiltInVaryingUsed(const TVariable &variable,
+ bool *addedFlag,
+ std::vector<Varying> *varyings)
+{
+ ASSERT(varyings);
+ if (!(*addedFlag))
+ {
+ Varying info;
+ setBuiltInInfoFromSymbol(variable, &info);
+ info.staticUse = true;
+ info.active = true;
+ info.isInvariant = mSymbolTable->isVaryingInvariant(variable);
+ varyings->push_back(info);
+ (*addedFlag) = true;
+ }
+}
+
+void CollectVariablesTraverser::recordBuiltInFragmentOutputUsed(const TVariable &variable,
+ bool *addedFlag)
+{
+ if (!(*addedFlag))
+ {
+ OutputVariable info;
+ setBuiltInInfoFromSymbol(variable, &info);
+ info.staticUse = true;
+ info.active = true;
+ mOutputVariables->push_back(info);
+ (*addedFlag) = true;
+ }
+}
+
+void CollectVariablesTraverser::recordBuiltInAttributeUsed(const TVariable &variable,
+ bool *addedFlag)
+{
+ if (!(*addedFlag))
+ {
+ Attribute info;
+ setBuiltInInfoFromSymbol(variable, &info);
+ info.staticUse = true;
+ info.active = true;
+ info.location = -1;
+ mAttribs->push_back(info);
+ (*addedFlag) = true;
+ }
+}
+
+InterfaceBlock *CollectVariablesTraverser::recordGLInUsed(const TType &glInType)
+{
+ if (!mPerVertexInAdded)
+ {
+ ASSERT(glInType.getQualifier() == EvqPerVertexIn);
+ InterfaceBlock info;
+ recordInterfaceBlock("gl_in", glInType, &info);
+
+ mPerVertexInAdded = true;
+ mInBlocks->push_back(info);
+ return &mInBlocks->back();
+ }
+ else
+ {
+ return FindVariable(ImmutableString("gl_PerVertex"), mInBlocks);
+ }
+}
+
+bool CollectVariablesTraverser::visitInvariantDeclaration(Visit visit,
+ TIntermInvariantDeclaration *node)
+{
+ // We should not mark variables as active just based on an invariant declaration, so we don't
+ // traverse the symbols declared invariant.
+ return false;
+}
+
+// We want to check whether a uniform/varying is active because we need to skip updating inactive
+// ones. We also only count the active ones in packing computing. Also, gl_FragCoord, gl_PointCoord,
+// and gl_FrontFacing count toward varying counting if they are active in a fragment shader.
+void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol)
+{
+ ASSERT(symbol != nullptr);
+
+ if (symbol->variable().symbolType() == SymbolType::AngleInternal ||
+ symbol->variable().symbolType() == SymbolType::Empty)
+ {
+ // Internal variables or nameless variables are not collected.
+ return;
+ }
+
+ ShaderVariable *var = nullptr;
+
+ const ImmutableString &symbolName = symbol->getName();
+
+ // Check the qualifier from the variable, not from the symbol node. The node may have a
+ // different qualifier if it's the result of a folded ternary node.
+ TQualifier qualifier = symbol->variable().getType().getQualifier();
+
+ if (IsVaryingIn(qualifier))
+ {
+ var = FindVariable(symbolName, mInputVaryings);
+ }
+ else if (IsVaryingOut(qualifier))
+ {
+ var = FindVariable(symbolName, mOutputVaryings);
+ }
+ else if (symbol->getType().getBasicType() == EbtInterfaceBlock)
+ {
+ UNREACHABLE();
+ }
+ else if (symbolName == "gl_DepthRange")
+ {
+ ASSERT(qualifier == EvqUniform);
+
+ if (!mDepthRangeAdded)
+ {
+ Uniform info;
+ const char kName[] = "gl_DepthRange";
+ info.name = kName;
+ info.mappedName = kName;
+ info.type = GL_NONE;
+ info.precision = GL_NONE;
+ info.staticUse = true;
+ info.active = true;
+
+ ShaderVariable nearInfo(GL_FLOAT);
+ const char kNearName[] = "near";
+ nearInfo.name = kNearName;
+ nearInfo.mappedName = kNearName;
+ nearInfo.precision = GL_HIGH_FLOAT;
+ nearInfo.staticUse = true;
+ nearInfo.active = true;
+
+ ShaderVariable farInfo(GL_FLOAT);
+ const char kFarName[] = "far";
+ farInfo.name = kFarName;
+ farInfo.mappedName = kFarName;
+ farInfo.precision = GL_HIGH_FLOAT;
+ farInfo.staticUse = true;
+ farInfo.active = true;
+
+ ShaderVariable diffInfo(GL_FLOAT);
+ const char kDiffName[] = "diff";
+ diffInfo.name = kDiffName;
+ diffInfo.mappedName = kDiffName;
+ diffInfo.precision = GL_HIGH_FLOAT;
+ diffInfo.staticUse = true;
+ diffInfo.active = true;
+
+ info.fields.push_back(nearInfo);
+ info.fields.push_back(farInfo);
+ info.fields.push_back(diffInfo);
+
+ mUniforms->push_back(info);
+ mDepthRangeAdded = true;
+ }
+ }
+ else
+ {
+ switch (qualifier)
+ {
+ case EvqAttribute:
+ case EvqVertexIn:
+ var = FindVariable(symbolName, mAttribs);
+ break;
+ case EvqFragmentOut:
+ var = FindVariable(symbolName, mOutputVariables);
+ break;
+ case EvqUniform:
+ {
+ const TInterfaceBlock *interfaceBlock = symbol->getType().getInterfaceBlock();
+ if (interfaceBlock)
+ {
+ var = FindVariableInInterfaceBlock(symbolName, interfaceBlock, mUniformBlocks);
+ }
+ else
+ {
+ var = FindVariable(symbolName, mUniforms);
+ }
+
+ // It's an internal error to reference an undefined user uniform
+ ASSERT(!symbolName.beginsWith("gl_") || var);
+ }
+ break;
+ case EvqBuffer:
+ {
+ const TInterfaceBlock *interfaceBlock = symbol->getType().getInterfaceBlock();
+ var =
+ FindVariableInInterfaceBlock(symbolName, interfaceBlock, mShaderStorageBlocks);
+ }
+ break;
+ case EvqFragCoord:
+ recordBuiltInVaryingUsed(symbol->variable(), &mFragCoordAdded, mInputVaryings);
+ return;
+ case EvqFrontFacing:
+ recordBuiltInVaryingUsed(symbol->variable(), &mFrontFacingAdded, mInputVaryings);
+ return;
+ case EvqPointCoord:
+ recordBuiltInVaryingUsed(symbol->variable(), &mPointCoordAdded, mInputVaryings);
+ return;
+ case EvqInstanceID:
+ // Whenever the SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW option is set,
+ // gl_InstanceID is added inside expressions to initialize ViewID_OVR and
+ // InstanceID. Note that gl_InstanceID is not added to the symbol table for ESSL1
+ // shaders.
+ recordBuiltInAttributeUsed(symbol->variable(), &mInstanceIDAdded);
+ return;
+ case EvqVertexID:
+ recordBuiltInAttributeUsed(symbol->variable(), &mVertexIDAdded);
+ return;
+ case EvqPosition:
+ recordBuiltInVaryingUsed(symbol->variable(), &mPositionAdded, mOutputVaryings);
+ return;
+ case EvqPointSize:
+ recordBuiltInVaryingUsed(symbol->variable(), &mPointSizeAdded, mOutputVaryings);
+ return;
+ case EvqDrawID:
+ recordBuiltInAttributeUsed(symbol->variable(), &mDrawIDAdded);
+ return;
+ case EvqBaseVertex:
+ recordBuiltInAttributeUsed(symbol->variable(), &mBaseVertexAdded);
+ return;
+ case EvqBaseInstance:
+ recordBuiltInAttributeUsed(symbol->variable(), &mBaseInstanceAdded);
+ return;
+ case EvqLastFragData:
+ recordBuiltInVaryingUsed(symbol->variable(), &mLastFragDataAdded, mInputVaryings);
+ return;
+ case EvqFragColor:
+ recordBuiltInFragmentOutputUsed(symbol->variable(), &mFragColorAdded);
+ return;
+ case EvqFragData:
+ if (!mFragDataAdded)
+ {
+ OutputVariable info;
+ setBuiltInInfoFromSymbol(symbol->variable(), &info);
+ if (!IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_draw_buffers))
+ {
+ ASSERT(info.arraySizes.size() == 1u);
+ info.arraySizes.back() = 1u;
+ }
+ info.staticUse = true;
+ info.active = true;
+ mOutputVariables->push_back(info);
+ mFragDataAdded = true;
+ }
+ return;
+ case EvqFragDepthEXT:
+ recordBuiltInFragmentOutputUsed(symbol->variable(), &mFragDepthEXTAdded);
+ return;
+ case EvqFragDepth:
+ recordBuiltInFragmentOutputUsed(symbol->variable(), &mFragDepthAdded);
+ return;
+ case EvqSecondaryFragColorEXT:
+ recordBuiltInFragmentOutputUsed(symbol->variable(), &mSecondaryFragColorEXTAdded);
+ return;
+ case EvqSecondaryFragDataEXT:
+ recordBuiltInFragmentOutputUsed(symbol->variable(), &mSecondaryFragDataEXTAdded);
+ return;
+ case EvqInvocationID:
+ recordBuiltInVaryingUsed(symbol->variable(), &mInvocationIDAdded, mInputVaryings);
+ break;
+ case EvqPrimitiveIDIn:
+ recordBuiltInVaryingUsed(symbol->variable(), &mPrimitiveIDInAdded, mInputVaryings);
+ break;
+ case EvqPrimitiveID:
+ if (mShaderType == GL_GEOMETRY_SHADER_EXT)
+ {
+ recordBuiltInVaryingUsed(symbol->variable(), &mPrimitiveIDAdded,
+ mOutputVaryings);
+ }
+ else
+ {
+ ASSERT(mShaderType == GL_FRAGMENT_SHADER);
+ recordBuiltInVaryingUsed(symbol->variable(), &mPrimitiveIDAdded,
+ mInputVaryings);
+ }
+ break;
+ case EvqLayer:
+ if (mShaderType == GL_GEOMETRY_SHADER_EXT)
+ {
+ recordBuiltInVaryingUsed(symbol->variable(), &mLayerAdded, mOutputVaryings);
+ }
+ else if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ recordBuiltInVaryingUsed(symbol->variable(), &mLayerAdded, mInputVaryings);
+ }
+ else
+ {
+ ASSERT(mShaderType == GL_VERTEX_SHADER &&
+ (IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview2) ||
+ IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview)));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if (var)
+ {
+ MarkActive(var);
+ }
+}
+
+void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type,
+ bool staticUse,
+ ShaderVariable *variableOut) const
+{
+ ASSERT(variableOut);
+
+ variableOut->staticUse = staticUse;
+
+ const TStructure *structure = type.getStruct();
+ if (!structure)
+ {
+ variableOut->type = GLVariableType(type);
+ variableOut->precision = GLVariablePrecision(type);
+ }
+ else
+ {
+ // Structures use a NONE type that isn't exposed outside ANGLE.
+ variableOut->type = GL_NONE;
+ if (structure->symbolType() != SymbolType::Empty)
+ {
+ variableOut->structName = structure->name().data();
+ }
+
+ const TFieldList &fields = structure->fields();
+
+ for (const TField *field : fields)
+ {
+ // Regardless of the variable type (uniform, in/out etc.) its fields are always plain
+ // ShaderVariable objects.
+ ShaderVariable fieldVariable;
+ setFieldProperties(*field->type(), field->name(), staticUse, &fieldVariable);
+ variableOut->fields.push_back(fieldVariable);
+ }
+ }
+ if (auto *arraySizes = type.getArraySizes())
+ {
+ variableOut->arraySizes.assign(arraySizes->begin(), arraySizes->end());
+ }
+}
+
+void CollectVariablesTraverser::setFieldProperties(const TType &type,
+ const ImmutableString &name,
+ bool staticUse,
+ ShaderVariable *variableOut) const
+{
+ ASSERT(variableOut);
+ setFieldOrVariableProperties(type, staticUse, variableOut);
+ variableOut->name.assign(name.data(), name.length());
+ variableOut->mappedName = HashName(name, mHashFunction, nullptr).data();
+}
+
+void CollectVariablesTraverser::setCommonVariableProperties(const TType &type,
+ const TVariable &variable,
+ ShaderVariable *variableOut) const
+{
+ ASSERT(variableOut);
+
+ variableOut->staticUse = mSymbolTable->isStaticallyUsed(variable);
+ setFieldOrVariableProperties(type, variableOut->staticUse, variableOut);
+ ASSERT(variable.symbolType() != SymbolType::Empty);
+ variableOut->name.assign(variable.name().data(), variable.name().length());
+ variableOut->mappedName = getMappedName(&variable);
+}
+
+Attribute CollectVariablesTraverser::recordAttribute(const TIntermSymbol &variable) const
+{
+ const TType &type = variable.getType();
+ ASSERT(!type.getStruct());
+
+ Attribute attribute;
+ setCommonVariableProperties(type, variable.variable(), &attribute);
+
+ attribute.location = type.getLayoutQualifier().location;
+ return attribute;
+}
+
+OutputVariable CollectVariablesTraverser::recordOutputVariable(const TIntermSymbol &variable) const
+{
+ const TType &type = variable.getType();
+ ASSERT(!type.getStruct());
+
+ OutputVariable outputVariable;
+ setCommonVariableProperties(type, variable.variable(), &outputVariable);
+
+ outputVariable.location = type.getLayoutQualifier().location;
+ outputVariable.index = type.getLayoutQualifier().index;
+ return outputVariable;
+}
+
+Varying CollectVariablesTraverser::recordVarying(const TIntermSymbol &variable) const
+{
+ const TType &type = variable.getType();
+
+ Varying varying;
+ setCommonVariableProperties(type, variable.variable(), &varying);
+ varying.location = type.getLayoutQualifier().location;
+
+ switch (type.getQualifier())
+ {
+ case EvqVaryingIn:
+ case EvqVaryingOut:
+ case EvqVertexOut:
+ case EvqSmoothOut:
+ case EvqFlatOut:
+ case EvqCentroidOut:
+ case EvqGeometryOut:
+ if (mSymbolTable->isVaryingInvariant(variable.variable()) || type.isInvariant())
+ {
+ varying.isInvariant = true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ varying.interpolation = GetInterpolationType(type.getQualifier());
+ return varying;
+}
+
+// TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
+void CollectVariablesTraverser::recordInterfaceBlock(const char *instanceName,
+ const TType &interfaceBlockType,
+ InterfaceBlock *interfaceBlock) const
+{
+ ASSERT(interfaceBlockType.getBasicType() == EbtInterfaceBlock);
+ ASSERT(interfaceBlock);
+
+ const TInterfaceBlock *blockType = interfaceBlockType.getInterfaceBlock();
+ ASSERT(blockType);
+
+ interfaceBlock->name = blockType->name().data();
+ interfaceBlock->mappedName = getMappedName(blockType);
+ if (instanceName != nullptr)
+ {
+ interfaceBlock->instanceName = instanceName;
+ const TSymbol *blockSymbol = nullptr;
+ if (strncmp(instanceName, "gl_in", 5u) == 0)
+ {
+ blockSymbol = mSymbolTable->getGlInVariableWithArraySize();
+ }
+ else
+ {
+ blockSymbol = mSymbolTable->findGlobal(ImmutableString(instanceName));
+ }
+ ASSERT(blockSymbol && blockSymbol->isVariable());
+ interfaceBlock->staticUse =
+ mSymbolTable->isStaticallyUsed(*static_cast<const TVariable *>(blockSymbol));
+ }
+ ASSERT(!interfaceBlockType.isArrayOfArrays()); // Disallowed by GLSL ES 3.10 section 4.3.9
+ interfaceBlock->arraySize =
+ interfaceBlockType.isArray() ? interfaceBlockType.getOutermostArraySize() : 0;
+
+ interfaceBlock->blockType = GetBlockType(interfaceBlockType.getQualifier());
+ if (interfaceBlock->blockType == BlockType::BLOCK_UNIFORM ||
+ interfaceBlock->blockType == BlockType::BLOCK_BUFFER)
+ {
+ // TODO(oetuaho): Remove setting isRowMajorLayout.
+ interfaceBlock->isRowMajorLayout = false;
+ interfaceBlock->binding = blockType->blockBinding();
+ interfaceBlock->layout = GetBlockLayoutType(blockType->blockStorage());
+ }
+
+ // Gather field information
+ bool anyFieldStaticallyUsed = false;
+ for (const TField *field : blockType->fields())
+ {
+ const TType &fieldType = *field->type();
+
+ bool staticUse = false;
+ if (instanceName == nullptr)
+ {
+ // Static use of individual fields has been recorded, since they are present in the
+ // symbol table as variables.
+ const TSymbol *fieldSymbol = mSymbolTable->findGlobal(field->name());
+ ASSERT(fieldSymbol && fieldSymbol->isVariable());
+ staticUse =
+ mSymbolTable->isStaticallyUsed(*static_cast<const TVariable *>(fieldSymbol));
+ if (staticUse)
+ {
+ anyFieldStaticallyUsed = true;
+ }
+ }
+
+ InterfaceBlockField fieldVariable;
+ setFieldProperties(fieldType, field->name(), staticUse, &fieldVariable);
+ fieldVariable.isRowMajorLayout =
+ (fieldType.getLayoutQualifier().matrixPacking == EmpRowMajor);
+ interfaceBlock->fields.push_back(fieldVariable);
+ }
+ if (anyFieldStaticallyUsed)
+ {
+ interfaceBlock->staticUse = true;
+ }
+}
+
+Uniform CollectVariablesTraverser::recordUniform(const TIntermSymbol &variable) const
+{
+ Uniform uniform;
+ setCommonVariableProperties(variable.getType(), variable.variable(), &uniform);
+ uniform.binding = variable.getType().getLayoutQualifier().binding;
+ uniform.imageUnitFormat =
+ GetImageInternalFormatType(variable.getType().getLayoutQualifier().imageInternalFormat);
+ uniform.location = variable.getType().getLayoutQualifier().location;
+ uniform.offset = variable.getType().getLayoutQualifier().offset;
+ uniform.readonly = variable.getType().getMemoryQualifier().readonly;
+ uniform.writeonly = variable.getType().getMemoryQualifier().writeonly;
+ return uniform;
+}
+
+bool CollectVariablesTraverser::visitDeclaration(Visit, TIntermDeclaration *node)
+{
+ const TIntermSequence &sequence = *(node->getSequence());
+ ASSERT(!sequence.empty());
+
+ const TIntermTyped &typedNode = *(sequence.front()->getAsTyped());
+ TQualifier qualifier = typedNode.getQualifier();
+
+ bool isShaderVariable = qualifier == EvqAttribute || qualifier == EvqVertexIn ||
+ qualifier == EvqFragmentOut || qualifier == EvqUniform ||
+ IsVarying(qualifier);
+
+ if (typedNode.getBasicType() != EbtInterfaceBlock && !isShaderVariable)
+ {
+ return true;
+ }
+
+ for (TIntermNode *variableNode : sequence)
+ {
+ // The only case in which the sequence will not contain a TIntermSymbol node is
+ // initialization. It will contain a TInterBinary node in that case. Since attributes,
+ // uniforms, varyings, outputs and interface blocks cannot be initialized in a shader, we
+ // must have only TIntermSymbol nodes in the sequence in the cases we are interested in.
+ const TIntermSymbol &variable = *variableNode->getAsSymbolNode();
+ if (variable.variable().symbolType() == SymbolType::AngleInternal)
+ {
+ // Internal variables are not collected.
+ continue;
+ }
+
+ // TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
+ if (typedNode.getBasicType() == EbtInterfaceBlock)
+ {
+ InterfaceBlock interfaceBlock;
+ recordInterfaceBlock(variable.variable().symbolType() != SymbolType::Empty
+ ? variable.getName().data()
+ : nullptr,
+ variable.getType(), &interfaceBlock);
+
+ switch (qualifier)
+ {
+ case EvqUniform:
+ mUniformBlocks->push_back(interfaceBlock);
+ break;
+ case EvqBuffer:
+ mShaderStorageBlocks->push_back(interfaceBlock);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ ASSERT(variable.variable().symbolType() != SymbolType::Empty);
+ switch (qualifier)
+ {
+ case EvqAttribute:
+ case EvqVertexIn:
+ mAttribs->push_back(recordAttribute(variable));
+ break;
+ case EvqFragmentOut:
+ mOutputVariables->push_back(recordOutputVariable(variable));
+ break;
+ case EvqUniform:
+ mUniforms->push_back(recordUniform(variable));
+ break;
+ default:
+ if (IsVaryingIn(qualifier))
+ {
+ mInputVaryings->push_back(recordVarying(variable));
+ }
+ else
+ {
+ ASSERT(IsVaryingOut(qualifier));
+ mOutputVaryings->push_back(recordVarying(variable));
+ }
+ break;
+ }
+ }
+ }
+
+ // None of the recorded variables can have initializers, so we don't need to traverse the
+ // declarators.
+ return false;
+}
+
+// TODO(jiawei.shao@intel.com): add search on mInBlocks and mOutBlocks when implementing
+// GL_EXT_shader_io_blocks.
+InterfaceBlock *CollectVariablesTraverser::findNamedInterfaceBlock(
+ const ImmutableString &blockName) const
+{
+ InterfaceBlock *namedBlock = FindVariable(blockName, mUniformBlocks);
+ if (!namedBlock)
+ {
+ namedBlock = FindVariable(blockName, mShaderStorageBlocks);
+ }
+ return namedBlock;
+}
+
+bool CollectVariablesTraverser::visitBinary(Visit, TIntermBinary *binaryNode)
+{
+ if (binaryNode->getOp() == EOpIndexDirectInterfaceBlock)
+ {
+ // NOTE: we do not determine static use / activeness for individual blocks of an array.
+ TIntermTyped *blockNode = binaryNode->getLeft()->getAsTyped();
+ ASSERT(blockNode);
+
+ TIntermConstantUnion *constantUnion = binaryNode->getRight()->getAsConstantUnion();
+ ASSERT(constantUnion);
+
+ InterfaceBlock *namedBlock = nullptr;
+
+ bool traverseIndexExpression = false;
+ TIntermBinary *interfaceIndexingNode = blockNode->getAsBinaryNode();
+ if (interfaceIndexingNode)
+ {
+ TIntermTyped *interfaceNode = interfaceIndexingNode->getLeft()->getAsTyped();
+ ASSERT(interfaceNode);
+
+ const TType &interfaceType = interfaceNode->getType();
+ if (interfaceType.getQualifier() == EvqPerVertexIn)
+ {
+ namedBlock = recordGLInUsed(interfaceType);
+ ASSERT(namedBlock);
+
+ // We need to continue traversing to collect useful variables in the index
+ // expression of gl_in.
+ traverseIndexExpression = true;
+ }
+ }
+
+ const TInterfaceBlock *interfaceBlock = blockNode->getType().getInterfaceBlock();
+ if (!namedBlock)
+ {
+ namedBlock = findNamedInterfaceBlock(interfaceBlock->name());
+ }
+ ASSERT(namedBlock);
+ ASSERT(namedBlock->staticUse);
+ namedBlock->active = true;
+ unsigned int fieldIndex = static_cast<unsigned int>(constantUnion->getIConst(0));
+ ASSERT(fieldIndex < namedBlock->fields.size());
+ // TODO(oetuaho): Would be nicer to record static use of fields of named interface blocks
+ // more accurately at parse time - now we only mark the fields statically used if they are
+ // active. http://anglebug.com/2440
+ namedBlock->fields[fieldIndex].staticUse = true;
+ namedBlock->fields[fieldIndex].active = true;
+
+ if (traverseIndexExpression)
+ {
+ ASSERT(interfaceIndexingNode);
+ interfaceIndexingNode->getRight()->traverse(this);
+ }
+ return false;
+ }
+
+ return true;
+}
+
+} // anonymous namespace
+
+void CollectVariables(TIntermBlock *root,
+ std::vector<Attribute> *attributes,
+ std::vector<OutputVariable> *outputVariables,
+ std::vector<Uniform> *uniforms,
+ std::vector<Varying> *inputVaryings,
+ std::vector<Varying> *outputVaryings,
+ std::vector<InterfaceBlock> *uniformBlocks,
+ std::vector<InterfaceBlock> *shaderStorageBlocks,
+ std::vector<InterfaceBlock> *inBlocks,
+ ShHashFunction64 hashFunction,
+ TSymbolTable *symbolTable,
+ GLenum shaderType,
+ const TExtensionBehavior &extensionBehavior)
+{
+ CollectVariablesTraverser collect(attributes, outputVariables, uniforms, inputVaryings,
+ outputVaryings, uniformBlocks, shaderStorageBlocks, inBlocks,
+ hashFunction, symbolTable, shaderType, extensionBehavior);
+ root->traverse(&collect);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/CollectVariables.h b/gfx/angle/checkout/src/compiler/translator/CollectVariables.h
new file mode 100644
index 0000000000..84494a1433
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/CollectVariables.h
@@ -0,0 +1,36 @@
+//
+// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// CollectVariables.h: Collect lists of shader interface variables based on the AST.
+
+#ifndef COMPILER_TRANSLATOR_COLLECTVARIABLES_H_
+#define COMPILER_TRANSLATOR_COLLECTVARIABLES_H_
+
+#include <GLSLANG/ShaderLang.h>
+
+#include "compiler/translator/ExtensionBehavior.h"
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void CollectVariables(TIntermBlock *root,
+ std::vector<Attribute> *attributes,
+ std::vector<OutputVariable> *outputVariables,
+ std::vector<Uniform> *uniforms,
+ std::vector<Varying> *inputVaryings,
+ std::vector<Varying> *outputVaryings,
+ std::vector<InterfaceBlock> *uniformBlocks,
+ std::vector<InterfaceBlock> *shaderStorageBlocks,
+ std::vector<InterfaceBlock> *inBlocks,
+ ShHashFunction64 hashFunction,
+ TSymbolTable *symbolTable,
+ GLenum shaderType,
+ const TExtensionBehavior &extensionBehavior);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_COLLECTVARIABLES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Common.h b/gfx/angle/checkout/src/compiler/translator/Common.h
new file mode 100644
index 0000000000..179cfe21ee
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Common.h
@@ -0,0 +1,151 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_COMMON_H_
+#define COMPILER_TRANSLATOR_COMMON_H_
+
+#include <stdio.h>
+#include <limits>
+#include <map>
+#include <sstream>
+#include <string>
+#include <unordered_map>
+#include <vector>
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+#include "common/third_party/smhasher/src/PMurHash.h"
+#include "compiler/translator/PoolAlloc.h"
+
+namespace sh
+{
+
+struct TSourceLoc
+{
+ int first_file;
+ int first_line;
+ int last_file;
+ int last_line;
+};
+
+//
+// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.
+//
+#define POOL_ALLOCATOR_NEW_DELETE \
+ void *operator new(size_t s) { return GetGlobalPoolAllocator()->allocate(s); } \
+ void *operator new(size_t, void *_Where) { return (_Where); } \
+ void operator delete(void *) {} \
+ void operator delete(void *, void *) {} \
+ void *operator new[](size_t s) { return GetGlobalPoolAllocator()->allocate(s); } \
+ void *operator new[](size_t, void *_Where) { return (_Where); } \
+ void operator delete[](void *) {} \
+ void operator delete[](void *, void *) {}
+
+//
+// Pool version of string.
+//
+typedef pool_allocator<char> TStringAllocator;
+typedef std::basic_string<char, std::char_traits<char>, TStringAllocator> TString;
+typedef std::basic_ostringstream<char, std::char_traits<char>, TStringAllocator> TStringStream;
+
+//
+// Persistent string memory. Should only be used for strings that survive
+// across compiles.
+//
+#define TPersistString std::string
+#define TPersistStringStream std::ostringstream
+
+//
+// Pool allocator versions of vectors, lists, and maps
+//
+template <class T>
+class TVector : public std::vector<T, pool_allocator<T>>
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+
+ typedef typename std::vector<T, pool_allocator<T>>::size_type size_type;
+ TVector() : std::vector<T, pool_allocator<T>>() {}
+ TVector(const pool_allocator<T> &a) : std::vector<T, pool_allocator<T>>(a) {}
+ TVector(size_type i) : std::vector<T, pool_allocator<T>>(i) {}
+};
+
+template <class K, class D, class H = std::hash<K>, class CMP = std::equal_to<K>>
+class TUnorderedMap : public std::unordered_map<K, D, H, CMP, pool_allocator<std::pair<const K, D>>>
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ typedef pool_allocator<std::pair<const K, D>> tAllocator;
+
+ TUnorderedMap() : std::unordered_map<K, D, H, CMP, tAllocator>() {}
+ // use correct two-stage name lookup supported in gcc 3.4 and above
+ TUnorderedMap(const tAllocator &a)
+ : std::unordered_map<K, D, H, CMP, tAllocator>(
+ std::unordered_map<K, D, H, CMP, tAllocator>::key_compare(),
+ a)
+ {}
+};
+
+template <class K, class D, class CMP = std::less<K>>
+class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<const K, D>>>
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ typedef pool_allocator<std::pair<const K, D>> tAllocator;
+
+ TMap() : std::map<K, D, CMP, tAllocator>() {}
+ // use correct two-stage name lookup supported in gcc 3.4 and above
+ TMap(const tAllocator &a)
+ : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a)
+ {}
+};
+
+// Integer to TString conversion
+template <typename T>
+inline TString str(T i)
+{
+ ASSERT(std::numeric_limits<T>::is_integer);
+ char buffer[((8 * sizeof(T)) / 3) + 3];
+ const char *formatStr = std::numeric_limits<T>::is_signed ? "%d" : "%u";
+ snprintf(buffer, sizeof(buffer), formatStr, i);
+ return buffer;
+}
+
+// Allocate a char array in the global memory pool. str must be a null terminated string. strLength
+// is the length without the null terminator.
+inline const char *AllocatePoolCharArray(const char *str, size_t strLength)
+{
+ size_t requiredSize = strLength + 1;
+ char *buffer = static_cast<char *>(GetGlobalPoolAllocator()->allocate(requiredSize));
+ memcpy(buffer, str, requiredSize);
+ ASSERT(buffer[strLength] == '\0');
+ return buffer;
+}
+
+// Initialize a new stream which must be imbued with the classic locale
+template <typename T>
+T InitializeStream()
+{
+ T stream;
+ stream.imbue(std::locale::classic());
+ return stream;
+}
+
+} // namespace sh
+
+namespace std
+{
+template <>
+struct hash<sh::TString>
+{
+ size_t operator()(const sh::TString &s) const
+ {
+ return angle::PMurHash32(0, s.data(), static_cast<int>(s.length()));
+ }
+};
+} // namespace std
+
+#endif // COMPILER_TRANSLATOR_COMMON_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Compiler.cpp b/gfx/angle/checkout/src/compiler/translator/Compiler.cpp
new file mode 100644
index 0000000000..42a556f363
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Compiler.cpp
@@ -0,0 +1,1478 @@
+//
+// 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/Compiler.h"
+
+#include <sstream>
+
+#include "angle_gl.h"
+#include "common/utilities.h"
+#include "compiler/translator/CallDAG.h"
+#include "compiler/translator/CollectVariables.h"
+#include "compiler/translator/Initialize.h"
+#include "compiler/translator/IsASTDepthBelowLimit.h"
+#include "compiler/translator/OutputTree.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/ValidateLimitations.h"
+#include "compiler/translator/ValidateMaxParameters.h"
+#include "compiler/translator/ValidateOutputs.h"
+#include "compiler/translator/ValidateVaryingLocations.h"
+#include "compiler/translator/VariablePacker.h"
+#include "compiler/translator/tree_ops/AddAndTrueToLoopCondition.h"
+#include "compiler/translator/tree_ops/ClampFragDepth.h"
+#include "compiler/translator/tree_ops/ClampPointSize.h"
+#include "compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h"
+#include "compiler/translator/tree_ops/DeferGlobalInitializers.h"
+#include "compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h"
+#include "compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h"
+#include "compiler/translator/tree_ops/EmulatePrecision.h"
+#include "compiler/translator/tree_ops/FoldExpressions.h"
+#include "compiler/translator/tree_ops/InitializeVariables.h"
+#include "compiler/translator/tree_ops/PruneEmptyCases.h"
+#include "compiler/translator/tree_ops/PruneNoOps.h"
+#include "compiler/translator/tree_ops/RegenerateStructNames.h"
+#include "compiler/translator/tree_ops/RemoveArrayLengthMethod.h"
+#include "compiler/translator/tree_ops/RemoveInvariantDeclaration.h"
+#include "compiler/translator/tree_ops/RemovePow.h"
+#include "compiler/translator/tree_ops/RemoveUnreferencedVariables.h"
+#include "compiler/translator/tree_ops/RewriteDoWhile.h"
+#include "compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h"
+#include "compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h"
+#include "compiler/translator/tree_ops/SeparateDeclarations.h"
+#include "compiler/translator/tree_ops/SimplifyLoopConditions.h"
+#include "compiler/translator/tree_ops/SplitSequenceOperator.h"
+#include "compiler/translator/tree_ops/UnfoldShortCircuitAST.h"
+#include "compiler/translator/tree_ops/UseInterfaceBlockFields.h"
+#include "compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/ReplaceShadowingVariables.h"
+#include "compiler/translator/util.h"
+#include "third_party/compiler/ArrayBoundsClamper.h"
+
+namespace sh
+{
+
+namespace
+{
+
+#if defined(ANGLE_ENABLE_FUZZER_CORPUS_OUTPUT)
+void DumpFuzzerCase(char const *const *shaderStrings,
+ size_t numStrings,
+ uint32_t type,
+ uint32_t spec,
+ uint32_t output,
+ uint64_t options)
+{
+ static int fileIndex = 0;
+
+ std::ostringstream o = sh::InitializeStream<std::ostringstream>();
+ o << "corpus/" << fileIndex++ << ".sample";
+ std::string s = o.str();
+
+ // Must match the input format of the fuzzer
+ FILE *f = fopen(s.c_str(), "w");
+ fwrite(&type, sizeof(type), 1, f);
+ fwrite(&spec, sizeof(spec), 1, f);
+ fwrite(&output, sizeof(output), 1, f);
+ fwrite(&options, sizeof(options), 1, f);
+
+ char zero[128 - 20] = {0};
+ fwrite(&zero, 128 - 20, 1, f);
+
+ for (size_t i = 0; i < numStrings; i++)
+ {
+ fwrite(shaderStrings[i], sizeof(char), strlen(shaderStrings[i]), f);
+ }
+ fwrite(&zero, 1, 1, f);
+
+ fclose(f);
+}
+#endif // defined(ANGLE_ENABLE_FUZZER_CORPUS_OUTPUT)
+} // anonymous namespace
+
+bool IsGLSL130OrNewer(ShShaderOutput output)
+{
+ return (output == SH_GLSL_130_OUTPUT || output == SH_GLSL_140_OUTPUT ||
+ output == SH_GLSL_150_CORE_OUTPUT || output == SH_GLSL_330_CORE_OUTPUT ||
+ output == SH_GLSL_400_CORE_OUTPUT || output == SH_GLSL_410_CORE_OUTPUT ||
+ output == SH_GLSL_420_CORE_OUTPUT || output == SH_GLSL_430_CORE_OUTPUT ||
+ output == SH_GLSL_440_CORE_OUTPUT || output == SH_GLSL_450_CORE_OUTPUT);
+}
+
+bool IsGLSL420OrNewer(ShShaderOutput output)
+{
+ return (output == SH_GLSL_420_CORE_OUTPUT || output == SH_GLSL_430_CORE_OUTPUT ||
+ output == SH_GLSL_440_CORE_OUTPUT || output == SH_GLSL_450_CORE_OUTPUT);
+}
+
+bool IsGLSL410OrOlder(ShShaderOutput output)
+{
+ return (output == SH_GLSL_130_OUTPUT || output == SH_GLSL_140_OUTPUT ||
+ output == SH_GLSL_150_CORE_OUTPUT || output == SH_GLSL_330_CORE_OUTPUT ||
+ output == SH_GLSL_400_CORE_OUTPUT || output == SH_GLSL_410_CORE_OUTPUT);
+}
+
+bool RemoveInvariant(sh::GLenum shaderType,
+ int shaderVersion,
+ ShShaderOutput outputType,
+ ShCompileOptions compileOptions)
+{
+ if (shaderType == GL_FRAGMENT_SHADER && IsGLSL420OrNewer(outputType))
+ return true;
+
+ if ((compileOptions & SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3) != 0 &&
+ shaderVersion >= 300 && shaderType == GL_VERTEX_SHADER)
+ return true;
+
+ return false;
+}
+
+size_t GetGlobalMaxTokenSize(ShShaderSpec spec)
+{
+ // WebGL defines a max token length of 256, while ES2 leaves max token
+ // size undefined. ES3 defines a max size of 1024 characters.
+ switch (spec)
+ {
+ case SH_WEBGL_SPEC:
+ return 256;
+ default:
+ return 1024;
+ }
+}
+
+int GetMaxUniformVectorsForShaderType(GLenum shaderType, const ShBuiltInResources &resources)
+{
+ switch (shaderType)
+ {
+ case GL_VERTEX_SHADER:
+ return resources.MaxVertexUniformVectors;
+ case GL_FRAGMENT_SHADER:
+ return resources.MaxFragmentUniformVectors;
+
+ // TODO (jiawei.shao@intel.com): check if we need finer-grained component counting
+ case GL_COMPUTE_SHADER:
+ return resources.MaxComputeUniformComponents / 4;
+ case GL_GEOMETRY_SHADER_EXT:
+ return resources.MaxGeometryUniformComponents / 4;
+ default:
+ UNREACHABLE();
+ return -1;
+ }
+}
+
+namespace
+{
+
+class TScopedPoolAllocator
+{
+ public:
+ TScopedPoolAllocator(angle::PoolAllocator *allocator) : mAllocator(allocator)
+ {
+ mAllocator->push();
+ SetGlobalPoolAllocator(mAllocator);
+ }
+ ~TScopedPoolAllocator()
+ {
+ SetGlobalPoolAllocator(nullptr);
+ mAllocator->pop();
+ }
+
+ private:
+ angle::PoolAllocator *mAllocator;
+};
+
+class TScopedSymbolTableLevel
+{
+ public:
+ TScopedSymbolTableLevel(TSymbolTable *table) : mTable(table)
+ {
+ ASSERT(mTable->isEmpty());
+ mTable->push();
+ }
+ ~TScopedSymbolTableLevel()
+ {
+ while (!mTable->isEmpty())
+ mTable->pop();
+ }
+
+ private:
+ TSymbolTable *mTable;
+};
+
+int MapSpecToShaderVersion(ShShaderSpec spec)
+{
+ switch (spec)
+ {
+ case SH_GLES2_SPEC:
+ case SH_WEBGL_SPEC:
+ return 100;
+ case SH_GLES3_SPEC:
+ case SH_WEBGL2_SPEC:
+ return 300;
+ case SH_GLES3_1_SPEC:
+ case SH_WEBGL3_SPEC:
+ return 310;
+ case SH_GL3_3_SPEC:
+ return 330;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+bool ValidateFragColorAndFragData(GLenum shaderType,
+ int shaderVersion,
+ const TSymbolTable &symbolTable,
+ TDiagnostics *diagnostics)
+{
+ if (shaderVersion > 100 || shaderType != GL_FRAGMENT_SHADER)
+ {
+ return true;
+ }
+
+ bool usesFragColor = false;
+ bool usesFragData = false;
+ // This validation is a bit stricter than the spec - it's only an error to write to
+ // both FragData and FragColor. But because it's better not to have reads from undefined
+ // variables, we always return an error if they are both referenced, rather than only if they
+ // are written.
+ if (symbolTable.isStaticallyUsed(*BuiltInVariable::gl_FragColor()) ||
+ symbolTable.isStaticallyUsed(*BuiltInVariable::gl_SecondaryFragColorEXT()))
+ {
+ usesFragColor = true;
+ }
+ // Extension variables may not always be initialized (saves some time at symbol table init).
+ bool secondaryFragDataUsed =
+ symbolTable.gl_SecondaryFragDataEXT() != nullptr &&
+ symbolTable.isStaticallyUsed(*symbolTable.gl_SecondaryFragDataEXT());
+ if (symbolTable.isStaticallyUsed(*symbolTable.gl_FragData()) || secondaryFragDataUsed)
+ {
+ usesFragData = true;
+ }
+ if (usesFragColor && usesFragData)
+ {
+ const char *errorMessage = "cannot use both gl_FragData and gl_FragColor";
+ if (symbolTable.isStaticallyUsed(*BuiltInVariable::gl_SecondaryFragColorEXT()) ||
+ secondaryFragDataUsed)
+ {
+ errorMessage =
+ "cannot use both output variable sets (gl_FragData, gl_SecondaryFragDataEXT)"
+ " and (gl_FragColor, gl_SecondaryFragColorEXT)";
+ }
+ diagnostics->globalError(errorMessage);
+ return false;
+ }
+ return true;
+}
+
+} // namespace
+
+TShHandleBase::TShHandleBase()
+{
+ allocator.push();
+ SetGlobalPoolAllocator(&allocator);
+}
+
+TShHandleBase::~TShHandleBase()
+{
+ SetGlobalPoolAllocator(nullptr);
+ allocator.popAll();
+}
+
+TCompiler::TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
+ : mVariablesCollected(false),
+ mGLPositionInitialized(false),
+ mShaderType(type),
+ mShaderSpec(spec),
+ mOutputType(output),
+ mBuiltInFunctionEmulator(),
+ mDiagnostics(mInfoSink.info),
+ mSourcePath(nullptr),
+ mComputeShaderLocalSizeDeclared(false),
+ mComputeShaderLocalSize(1),
+ mGeometryShaderMaxVertices(-1),
+ mGeometryShaderInvocations(0),
+ mGeometryShaderInputPrimitiveType(EptUndefined),
+ mGeometryShaderOutputPrimitiveType(EptUndefined)
+{}
+
+TCompiler::~TCompiler() {}
+
+bool TCompiler::shouldRunLoopAndIndexingValidation(ShCompileOptions compileOptions) const
+{
+ // If compiling an ESSL 1.00 shader for WebGL, or if its been requested through the API,
+ // validate loop and indexing as well (to verify that the shader only uses minimal functionality
+ // of ESSL 1.00 as in Appendix A of the spec).
+ return (IsWebGLBasedSpec(mShaderSpec) && mShaderVersion == 100) ||
+ (compileOptions & SH_VALIDATE_LOOP_INDEXING);
+}
+
+bool TCompiler::Init(const ShBuiltInResources &resources)
+{
+ SetGlobalPoolAllocator(&allocator);
+
+ // Generate built-in symbol table.
+ if (!initBuiltInSymbolTable(resources))
+ return false;
+
+ mResources = resources;
+ setResourceString();
+
+ InitExtensionBehavior(resources, mExtensionBehavior);
+ mArrayBoundsClamper.SetClampingStrategy(resources.ArrayIndexClampingStrategy);
+ return true;
+}
+
+TIntermBlock *TCompiler::compileTreeForTesting(const char *const shaderStrings[],
+ size_t numStrings,
+ ShCompileOptions compileOptions)
+{
+ return compileTreeImpl(shaderStrings, numStrings, compileOptions);
+}
+
+TIntermBlock *TCompiler::compileTreeImpl(const char *const shaderStrings[],
+ size_t numStrings,
+ const ShCompileOptions compileOptions)
+{
+ clearResults();
+
+ ASSERT(numStrings > 0);
+ ASSERT(GetGlobalPoolAllocator());
+
+ // Reset the extension behavior for each compilation unit.
+ ResetExtensionBehavior(mExtensionBehavior);
+
+ // If gl_DrawID is not supported, remove it from the available extensions
+ // Currently we only allow emulation of gl_DrawID
+ const bool glDrawIDSupported = (compileOptions & SH_EMULATE_GL_DRAW_ID) != 0u;
+ if (!glDrawIDSupported)
+ {
+ auto it = mExtensionBehavior.find(TExtension::ANGLE_multi_draw);
+ if (it != mExtensionBehavior.end())
+ {
+ mExtensionBehavior.erase(it);
+ }
+ }
+
+ const bool glBaseVertexBaseInstanceSupported =
+ (compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0u;
+ if (!glBaseVertexBaseInstanceSupported)
+ {
+ auto it = mExtensionBehavior.find(TExtension::ANGLE_base_vertex_base_instance);
+ if (it != mExtensionBehavior.end())
+ {
+ mExtensionBehavior.erase(it);
+ }
+ }
+
+ // First string is path of source file if flag is set. The actual source follows.
+ size_t firstSource = 0;
+ if (compileOptions & SH_SOURCE_PATH)
+ {
+ mSourcePath = shaderStrings[0];
+ ++firstSource;
+ }
+
+ TParseContext parseContext(mSymbolTable, mExtensionBehavior, mShaderType, mShaderSpec,
+ compileOptions, !IsDesktopGLSpec(mShaderSpec), &mDiagnostics,
+ getResources());
+
+ parseContext.setFragmentPrecisionHighOnESSL1(mResources.FragmentPrecisionHigh == 1);
+
+ // We preserve symbols at the built-in level from compile-to-compile.
+ // Start pushing the user-defined symbols at global level.
+ TScopedSymbolTableLevel globalLevel(&mSymbolTable);
+ ASSERT(mSymbolTable.atGlobalLevel());
+
+ // Parse shader.
+ if (PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], nullptr,
+ &parseContext) != 0)
+ {
+ return nullptr;
+ }
+
+ if (parseContext.getTreeRoot() == nullptr)
+ {
+ return nullptr;
+ }
+
+ setASTMetadata(parseContext);
+
+ if (!checkShaderVersion(&parseContext))
+ {
+ return nullptr;
+ }
+
+ TIntermBlock *root = parseContext.getTreeRoot();
+ if (!checkAndSimplifyAST(root, parseContext, compileOptions))
+ {
+ return nullptr;
+ }
+
+ return root;
+}
+
+bool TCompiler::checkShaderVersion(TParseContext *parseContext)
+{
+ if (MapSpecToShaderVersion(mShaderSpec) < mShaderVersion)
+ {
+ mDiagnostics.globalError("unsupported shader version");
+ return false;
+ }
+
+ ASSERT(parseContext);
+ switch (mShaderType)
+ {
+ case GL_COMPUTE_SHADER:
+ if (mShaderVersion < 310)
+ {
+ mDiagnostics.globalError("Compute shader is not supported in this shader version.");
+ return false;
+ }
+ break;
+
+ case GL_GEOMETRY_SHADER_EXT:
+ if (mShaderVersion < 310)
+ {
+ mDiagnostics.globalError(
+ "Geometry shader is not supported in this shader version.");
+ return false;
+ }
+ else
+ {
+ ASSERT(mShaderVersion == 310);
+ if (!parseContext->checkCanUseExtension(sh::TSourceLoc(),
+ TExtension::EXT_geometry_shader))
+ {
+ return false;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+void TCompiler::setASTMetadata(const TParseContext &parseContext)
+{
+ mShaderVersion = parseContext.getShaderVersion();
+
+ mPragma = parseContext.pragma();
+ mSymbolTable.setGlobalInvariant(mPragma.stdgl.invariantAll);
+
+ mComputeShaderLocalSizeDeclared = parseContext.isComputeShaderLocalSizeDeclared();
+ mComputeShaderLocalSize = parseContext.getComputeShaderLocalSize();
+
+ mNumViews = parseContext.getNumViews();
+
+ if (mShaderType == GL_GEOMETRY_SHADER_EXT)
+ {
+ mGeometryShaderInputPrimitiveType = parseContext.getGeometryShaderInputPrimitiveType();
+ mGeometryShaderOutputPrimitiveType = parseContext.getGeometryShaderOutputPrimitiveType();
+ mGeometryShaderMaxVertices = parseContext.getGeometryShaderMaxVertices();
+ mGeometryShaderInvocations = parseContext.getGeometryShaderInvocations();
+ }
+}
+
+bool TCompiler::checkAndSimplifyAST(TIntermBlock *root,
+ const TParseContext &parseContext,
+ ShCompileOptions compileOptions)
+{
+ // Disallow expressions deemed too complex.
+ if ((compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY) && !limitExpressionComplexity(root))
+ {
+ return false;
+ }
+
+ if (shouldRunLoopAndIndexingValidation(compileOptions) &&
+ !ValidateLimitations(root, mShaderType, &mSymbolTable, &mDiagnostics))
+ {
+ return false;
+ }
+
+ if (!ValidateFragColorAndFragData(mShaderType, mShaderVersion, mSymbolTable, &mDiagnostics))
+ {
+ return false;
+ }
+
+ // Fold expressions that could not be folded before validation that was done as a part of
+ // parsing.
+ FoldExpressions(root, &mDiagnostics);
+ // Folding should only be able to generate warnings.
+ ASSERT(mDiagnostics.numErrors() == 0);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ // We prune no-ops to work around driver bugs and to keep AST processing and output simple.
+ // The following kinds of no-ops are pruned:
+ // 1. Empty declarations "int;".
+ // 2. Literal statements: "1.0;". The ESSL output doesn't define a default precision
+ // for float, so float literal statements would end up with no precision which is
+ // invalid ESSL.
+ // After this empty declarations are not allowed in the AST.
+ PruneNoOps(root, &mSymbolTable);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ // Create the function DAG and check there is no recursion
+ if (!initCallDag(root))
+ {
+ return false;
+ }
+
+ if ((compileOptions & SH_LIMIT_CALL_STACK_DEPTH) && !checkCallDepth())
+ {
+ return false;
+ }
+
+ // Checks which functions are used and if "main" exists
+ mFunctionMetadata.clear();
+ mFunctionMetadata.resize(mCallDag.size());
+ if (!tagUsedFunctions())
+ {
+ return false;
+ }
+
+ if (!(compileOptions & SH_DONT_PRUNE_UNUSED_FUNCTIONS))
+ {
+ pruneUnusedFunctions(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+ if (IsSpecWithFunctionBodyNewScope(mShaderSpec, mShaderVersion))
+ {
+ ReplaceShadowingVariables(root, &mSymbolTable);
+ }
+
+ if (mShaderVersion >= 310 && !ValidateVaryingLocations(root, &mDiagnostics, mShaderType))
+ {
+ return false;
+ }
+
+ if (mShaderVersion >= 300 && mShaderType == GL_FRAGMENT_SHADER &&
+ !ValidateOutputs(root, getExtensionBehavior(), mResources.MaxDrawBuffers, &mDiagnostics))
+ {
+ return false;
+ }
+
+ // Fail compilation if precision emulation not supported.
+ if (getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision &&
+ !EmulatePrecision::SupportedInLanguage(mOutputType))
+ {
+ mDiagnostics.globalError("Precision emulation not supported for this output type.");
+ return false;
+ }
+
+ // Clamping uniform array bounds needs to happen after validateLimitations pass.
+ if (compileOptions & SH_CLAMP_INDIRECT_ARRAY_BOUNDS)
+ {
+ mArrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
+ }
+
+ if ((compileOptions & SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW) &&
+ (parseContext.isExtensionEnabled(TExtension::OVR_multiview2) ||
+ parseContext.isExtensionEnabled(TExtension::OVR_multiview)) &&
+ getShaderType() != GL_COMPUTE_SHADER)
+ {
+ DeclareAndInitBuiltinsForInstancedMultiview(root, mNumViews, mShaderType, compileOptions,
+ mOutputType, &mSymbolTable);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ // This pass might emit short circuits so keep it before the short circuit unfolding
+ if (compileOptions & SH_REWRITE_DO_WHILE_LOOPS)
+ {
+ RewriteDoWhile(root, &mSymbolTable);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (compileOptions & SH_ADD_AND_TRUE_TO_LOOP_CONDITION)
+ {
+ AddAndTrueToLoopCondition(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (compileOptions & SH_UNFOLD_SHORT_CIRCUIT)
+ {
+ UnfoldShortCircuitAST(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (compileOptions & SH_REMOVE_POW_WITH_CONSTANT_EXPONENT)
+ {
+ RemovePow(root, &mSymbolTable);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (compileOptions & SH_REGENERATE_STRUCT_NAMES)
+ {
+ RegenerateStructNames gen(&mSymbolTable);
+ root->traverse(&gen);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (mShaderType == GL_VERTEX_SHADER &&
+ IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_multi_draw))
+ {
+ if ((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0u)
+ {
+ EmulateGLDrawID(root, &mSymbolTable, &mUniforms,
+ shouldCollectVariables(compileOptions));
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+ }
+
+ if (mShaderType == GL_VERTEX_SHADER &&
+ IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_base_vertex_base_instance))
+ {
+ if ((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0u)
+ {
+ EmulateGLBaseVertex(root, &mSymbolTable, &mUniforms,
+ shouldCollectVariables(compileOptions));
+ EmulateGLBaseInstance(root, &mSymbolTable, &mUniforms,
+ shouldCollectVariables(compileOptions));
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+ }
+
+ if (mShaderType == GL_FRAGMENT_SHADER && mShaderVersion == 100 && mResources.EXT_draw_buffers &&
+ mResources.MaxDrawBuffers > 1 &&
+ IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_draw_buffers))
+ {
+ EmulateGLFragColorBroadcast(root, mResources.MaxDrawBuffers, &mOutputVariables,
+ &mSymbolTable, mShaderVersion);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ int simplifyScalarized = (compileOptions & SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS)
+ ? IntermNodePatternMatcher::kScalarizedVecOrMatConstructor
+ : 0;
+
+ // Split multi declarations and remove calls to array length().
+ // Note that SimplifyLoopConditions needs to be run before any other AST transformations
+ // that may need to generate new statements from loop conditions or loop expressions.
+ SimplifyLoopConditions(root,
+ IntermNodePatternMatcher::kMultiDeclaration |
+ IntermNodePatternMatcher::kArrayLengthMethod | simplifyScalarized,
+ &getSymbolTable());
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ // Note that separate declarations need to be run before other AST transformations that
+ // generate new statements from expressions.
+ SeparateDeclarations(root);
+ mValidateASTOptions.validateMultiDeclarations = true;
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ SplitSequenceOperator(root, IntermNodePatternMatcher::kArrayLengthMethod | simplifyScalarized,
+ &getSymbolTable());
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ RemoveArrayLengthMethod(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ RemoveUnreferencedVariables(root, &mSymbolTable);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ // In case the last case inside a switch statement is a certain type of no-op, GLSL compilers in
+ // drivers may not accept it. In this case we clean up the dead code from the end of switch
+ // statements. This is also required because PruneNoOps or RemoveUnreferencedVariables may have
+ // left switch statements that only contained an empty declaration inside the final case in an
+ // invalid state. Relies on that PruneNoOps and RemoveUnreferencedVariables have already been
+ // run.
+ PruneEmptyCases(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ // Built-in function emulation needs to happen after validateLimitations pass.
+ // TODO(jmadill): Remove global pool allocator.
+ GetGlobalPoolAllocator()->lock();
+ initBuiltInFunctionEmulator(&mBuiltInFunctionEmulator, compileOptions);
+ GetGlobalPoolAllocator()->unlock();
+ mBuiltInFunctionEmulator.markBuiltInFunctionsForEmulation(root);
+
+ bool highPrecisionSupported = mShaderVersion > 100 || mShaderType != GL_FRAGMENT_SHADER ||
+ mResources.FragmentPrecisionHigh == 1;
+ if (compileOptions & SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS)
+ {
+ ScalarizeVecAndMatConstructorArgs(root, mShaderType, highPrecisionSupported, &mSymbolTable);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (shouldCollectVariables(compileOptions))
+ {
+ ASSERT(!mVariablesCollected);
+ CollectVariables(root, &mAttributes, &mOutputVariables, &mUniforms, &mInputVaryings,
+ &mOutputVaryings, &mUniformBlocks, &mShaderStorageBlocks, &mInBlocks,
+ mResources.HashFunction, &mSymbolTable, mShaderType, mExtensionBehavior);
+ collectInterfaceBlocks();
+ mVariablesCollected = true;
+ if (compileOptions & SH_USE_UNUSED_STANDARD_SHARED_BLOCKS)
+ {
+ useAllMembersInUnusedStandardAndSharedBlocks(root);
+ }
+ if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS)
+ {
+ int maxUniformVectors = GetMaxUniformVectorsForShaderType(mShaderType, mResources);
+ // Returns true if, after applying the packing rules in the GLSL ES 1.00.17 spec
+ // Appendix A, section 7, the shader does not use too many uniforms.
+ if (!CheckVariablesInPackingLimits(maxUniformVectors, mUniforms))
+ {
+ mDiagnostics.globalError("too many uniforms");
+ return false;
+ }
+ }
+ if ((compileOptions & SH_INIT_OUTPUT_VARIABLES) && (mShaderType != GL_COMPUTE_SHADER))
+ {
+ initializeOutputVariables(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+ }
+
+ // Removing invariant declarations must be done after collecting variables.
+ // Otherwise, built-in invariant declarations don't apply.
+ if (RemoveInvariant(mShaderType, mShaderVersion, mOutputType, compileOptions))
+ {
+ RemoveInvariantDeclaration(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ // gl_Position is always written in compatibility output mode.
+ // It may have been already initialized among other output variables, in that case we don't
+ // need to initialize it twice.
+ if (mShaderType == GL_VERTEX_SHADER && !mGLPositionInitialized &&
+ ((compileOptions & SH_INIT_GL_POSITION) || (mOutputType == SH_GLSL_COMPATIBILITY_OUTPUT)))
+ {
+ initializeGLPosition(root);
+ mGLPositionInitialized = true;
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ // DeferGlobalInitializers needs to be run before other AST transformations that generate new
+ // statements from expressions. But it's fine to run DeferGlobalInitializers after the above
+ // SplitSequenceOperator and RemoveArrayLengthMethod since they only have an effect on the AST
+ // on ESSL >= 3.00, and the initializers that need to be deferred can only exist in ESSL < 3.00.
+ bool initializeLocalsAndGlobals =
+ (compileOptions & SH_INITIALIZE_UNINITIALIZED_LOCALS) && !IsOutputHLSL(getOutputType());
+ bool canUseLoopsToInitialize = !(compileOptions & SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES);
+ DeferGlobalInitializers(root, initializeLocalsAndGlobals, canUseLoopsToInitialize,
+ highPrecisionSupported, &mSymbolTable);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+
+ if (initializeLocalsAndGlobals)
+ {
+ // Initialize uninitialized local variables.
+ // In some cases initializing can generate extra statements in the parent block, such as
+ // when initializing nameless structs or initializing arrays in ESSL 1.00. In that case
+ // we need to first simplify loop conditions. We've already separated declarations
+ // earlier, which is also required. If we don't follow the Appendix A limitations, loop
+ // init statements can declare arrays or nameless structs and have multiple
+ // declarations.
+
+ if (!shouldRunLoopAndIndexingValidation(compileOptions))
+ {
+ SimplifyLoopConditions(root,
+ IntermNodePatternMatcher::kArrayDeclaration |
+ IntermNodePatternMatcher::kNamelessStructDeclaration,
+ &getSymbolTable());
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ InitializeUninitializedLocals(root, getShaderVersion(), canUseLoopsToInitialize,
+ highPrecisionSupported, &getSymbolTable());
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (getShaderType() == GL_VERTEX_SHADER && (compileOptions & SH_CLAMP_POINT_SIZE))
+ {
+ ClampPointSize(root, mResources.MaxPointSize, &getSymbolTable());
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (getShaderType() == GL_FRAGMENT_SHADER && (compileOptions & SH_CLAMP_FRAG_DEPTH))
+ {
+ ClampFragDepth(root, &getSymbolTable());
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (compileOptions & SH_REWRITE_REPEATED_ASSIGN_TO_SWIZZLED)
+ {
+ sh::RewriteRepeatedAssignToSwizzled(root);
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ if (compileOptions & SH_REWRITE_VECTOR_SCALAR_ARITHMETIC)
+ {
+ VectorizeVectorScalarArithmetic(root, &getSymbolTable());
+ if (!ValidateAST(root, &mDiagnostics, mValidateASTOptions))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TCompiler::compile(const char *const shaderStrings[],
+ size_t numStrings,
+ ShCompileOptions compileOptionsIn)
+{
+#if defined(ANGLE_ENABLE_FUZZER_CORPUS_OUTPUT)
+ DumpFuzzerCase(shaderStrings, numStrings, mShaderType, mShaderSpec, mOutputType,
+ compileOptionsIn);
+#endif // defined(ANGLE_ENABLE_FUZZER_CORPUS_OUTPUT)
+
+ if (numStrings == 0)
+ return true;
+
+ ShCompileOptions compileOptions = compileOptionsIn;
+
+ // Apply key workarounds.
+ if (shouldFlattenPragmaStdglInvariantAll())
+ {
+ // This should be harmless to do in all cases, but for the moment, do it only conditionally.
+ compileOptions |= SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL;
+ }
+
+ TScopedPoolAllocator scopedAlloc(&allocator);
+ TIntermBlock *root = compileTreeImpl(shaderStrings, numStrings, compileOptions);
+
+ if (root)
+ {
+ if (compileOptions & SH_INTERMEDIATE_TREE)
+ OutputTree(root, mInfoSink.info);
+
+ if (compileOptions & SH_OBJECT_CODE)
+ {
+ PerformanceDiagnostics perfDiagnostics(&mDiagnostics);
+ translate(root, compileOptions, &perfDiagnostics);
+ }
+
+ if (mShaderType == GL_VERTEX_SHADER)
+ {
+ bool lookForDrawID =
+ IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_multi_draw) &&
+ ((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0u);
+ bool lookForBaseVertexBaseInstance =
+ IsExtensionEnabled(mExtensionBehavior,
+ TExtension::ANGLE_base_vertex_base_instance) &&
+ ((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0u);
+
+ if (lookForDrawID || lookForBaseVertexBaseInstance)
+ {
+ for (auto &uniform : mUniforms)
+ {
+ if (lookForDrawID && uniform.name == "angle_DrawID" &&
+ uniform.mappedName == "angle_DrawID")
+ {
+ uniform.name = "gl_DrawID";
+ }
+ else if (lookForBaseVertexBaseInstance && uniform.name == "angle_BaseVertex" &&
+ uniform.mappedName == "angle_BaseVertex")
+ {
+ uniform.name = "gl_BaseVertex";
+ }
+ else if (lookForBaseVertexBaseInstance &&
+ uniform.name == "angle_BaseInstance" &&
+ uniform.mappedName == "angle_BaseInstance")
+ {
+ uniform.name = "gl_BaseInstance";
+ }
+ }
+ }
+ }
+
+ // The IntermNode tree doesn't need to be deleted here, since the
+ // memory will be freed in a big chunk by the PoolAllocator.
+ return true;
+ }
+ return false;
+}
+
+bool TCompiler::initBuiltInSymbolTable(const ShBuiltInResources &resources)
+{
+ if (resources.MaxDrawBuffers < 1)
+ {
+ return false;
+ }
+ if (resources.EXT_blend_func_extended && resources.MaxDualSourceDrawBuffers < 1)
+ {
+ return false;
+ }
+
+ mSymbolTable.initializeBuiltIns(mShaderType, mShaderSpec, resources);
+
+ return true;
+}
+
+void TCompiler::setResourceString()
+{
+ std::ostringstream strstream = sh::InitializeStream<std::ostringstream>();
+
+ // clang-format off
+ strstream << ":MaxVertexAttribs:" << mResources.MaxVertexAttribs
+ << ":MaxVertexUniformVectors:" << mResources.MaxVertexUniformVectors
+ << ":MaxVaryingVectors:" << mResources.MaxVaryingVectors
+ << ":MaxVertexTextureImageUnits:" << mResources.MaxVertexTextureImageUnits
+ << ":MaxCombinedTextureImageUnits:" << mResources.MaxCombinedTextureImageUnits
+ << ":MaxTextureImageUnits:" << mResources.MaxTextureImageUnits
+ << ":MaxFragmentUniformVectors:" << mResources.MaxFragmentUniformVectors
+ << ":MaxDrawBuffers:" << mResources.MaxDrawBuffers
+ << ":OES_standard_derivatives:" << mResources.OES_standard_derivatives
+ << ":OES_EGL_image_external:" << mResources.OES_EGL_image_external
+ << ":OES_EGL_image_external_essl3:" << mResources.OES_EGL_image_external_essl3
+ << ":NV_EGL_stream_consumer_external:" << mResources.NV_EGL_stream_consumer_external
+ << ":ARB_texture_rectangle:" << mResources.ARB_texture_rectangle
+ << ":EXT_draw_buffers:" << mResources.EXT_draw_buffers
+ << ":FragmentPrecisionHigh:" << mResources.FragmentPrecisionHigh
+ << ":MaxExpressionComplexity:" << mResources.MaxExpressionComplexity
+ << ":MaxCallStackDepth:" << mResources.MaxCallStackDepth
+ << ":MaxFunctionParameters:" << mResources.MaxFunctionParameters
+ << ":EXT_blend_func_extended:" << mResources.EXT_blend_func_extended
+ << ":EXT_frag_depth:" << mResources.EXT_frag_depth
+ << ":EXT_shader_texture_lod:" << mResources.EXT_shader_texture_lod
+ << ":EXT_shader_framebuffer_fetch:" << mResources.EXT_shader_framebuffer_fetch
+ << ":NV_shader_framebuffer_fetch:" << mResources.NV_shader_framebuffer_fetch
+ << ":ARM_shader_framebuffer_fetch:" << mResources.ARM_shader_framebuffer_fetch
+ << ":OVR_multiview2:" << mResources.OVR_multiview2
+ << ":OVR_multiview:" << mResources.OVR_multiview
+ << ":EXT_YUV_target:" << mResources.EXT_YUV_target
+ << ":EXT_geometry_shader:" << mResources.EXT_geometry_shader
+ << ":OES_texture_3D:" << mResources.OES_texture_3D
+ << ":MaxVertexOutputVectors:" << mResources.MaxVertexOutputVectors
+ << ":MaxFragmentInputVectors:" << mResources.MaxFragmentInputVectors
+ << ":MinProgramTexelOffset:" << mResources.MinProgramTexelOffset
+ << ":MaxProgramTexelOffset:" << mResources.MaxProgramTexelOffset
+ << ":MaxDualSourceDrawBuffers:" << mResources.MaxDualSourceDrawBuffers
+ << ":MaxViewsOVR:" << mResources.MaxViewsOVR
+ << ":NV_draw_buffers:" << mResources.NV_draw_buffers
+ << ":WEBGL_debug_shader_precision:" << mResources.WEBGL_debug_shader_precision
+ << ":ANGLE_multi_draw:" << mResources.ANGLE_multi_draw
+ << ":ANGLE_base_vertex_base_instance:" << mResources.ANGLE_base_vertex_base_instance
+ << ":MinProgramTextureGatherOffset:" << mResources.MinProgramTextureGatherOffset
+ << ":MaxProgramTextureGatherOffset:" << mResources.MaxProgramTextureGatherOffset
+ << ":MaxImageUnits:" << mResources.MaxImageUnits
+ << ":MaxVertexImageUniforms:" << mResources.MaxVertexImageUniforms
+ << ":MaxFragmentImageUniforms:" << mResources.MaxFragmentImageUniforms
+ << ":MaxComputeImageUniforms:" << mResources.MaxComputeImageUniforms
+ << ":MaxCombinedImageUniforms:" << mResources.MaxCombinedImageUniforms
+ << ":MaxCombinedShaderOutputResources:" << mResources.MaxCombinedShaderOutputResources
+ << ":MaxComputeWorkGroupCountX:" << mResources.MaxComputeWorkGroupCount[0]
+ << ":MaxComputeWorkGroupCountY:" << mResources.MaxComputeWorkGroupCount[1]
+ << ":MaxComputeWorkGroupCountZ:" << mResources.MaxComputeWorkGroupCount[2]
+ << ":MaxComputeWorkGroupSizeX:" << mResources.MaxComputeWorkGroupSize[0]
+ << ":MaxComputeWorkGroupSizeY:" << mResources.MaxComputeWorkGroupSize[1]
+ << ":MaxComputeWorkGroupSizeZ:" << mResources.MaxComputeWorkGroupSize[2]
+ << ":MaxComputeUniformComponents:" << mResources.MaxComputeUniformComponents
+ << ":MaxComputeTextureImageUnits:" << mResources.MaxComputeTextureImageUnits
+ << ":MaxComputeAtomicCounters:" << mResources.MaxComputeAtomicCounters
+ << ":MaxComputeAtomicCounterBuffers:" << mResources.MaxComputeAtomicCounterBuffers
+ << ":MaxVertexAtomicCounters:" << mResources.MaxVertexAtomicCounters
+ << ":MaxFragmentAtomicCounters:" << mResources.MaxFragmentAtomicCounters
+ << ":MaxCombinedAtomicCounters:" << mResources.MaxCombinedAtomicCounters
+ << ":MaxAtomicCounterBindings:" << mResources.MaxAtomicCounterBindings
+ << ":MaxVertexAtomicCounterBuffers:" << mResources.MaxVertexAtomicCounterBuffers
+ << ":MaxFragmentAtomicCounterBuffers:" << mResources.MaxFragmentAtomicCounterBuffers
+ << ":MaxCombinedAtomicCounterBuffers:" << mResources.MaxCombinedAtomicCounterBuffers
+ << ":MaxAtomicCounterBufferSize:" << mResources.MaxAtomicCounterBufferSize
+ << ":MaxGeometryUniformComponents:" << mResources.MaxGeometryUniformComponents
+ << ":MaxGeometryUniformBlocks:" << mResources.MaxGeometryUniformBlocks
+ << ":MaxGeometryInputComponents:" << mResources.MaxGeometryInputComponents
+ << ":MaxGeometryOutputComponents:" << mResources.MaxGeometryOutputComponents
+ << ":MaxGeometryOutputVertices:" << mResources.MaxGeometryOutputVertices
+ << ":MaxGeometryTotalOutputComponents:" << mResources.MaxGeometryTotalOutputComponents
+ << ":MaxGeometryTextureImageUnits:" << mResources.MaxGeometryTextureImageUnits
+ << ":MaxGeometryAtomicCounterBuffers:" << mResources.MaxGeometryAtomicCounterBuffers
+ << ":MaxGeometryAtomicCounters:" << mResources.MaxGeometryAtomicCounters
+ << ":MaxGeometryShaderStorageBlocks:" << mResources.MaxGeometryShaderStorageBlocks
+ << ":MaxGeometryShaderInvocations:" << mResources.MaxGeometryShaderInvocations
+ << ":MaxGeometryImageUniforms:" << mResources.MaxGeometryImageUniforms;
+ // clang-format on
+
+ mBuiltInResourcesString = strstream.str();
+}
+
+void TCompiler::collectInterfaceBlocks()
+{
+ ASSERT(mInterfaceBlocks.empty());
+ mInterfaceBlocks.reserve(mUniformBlocks.size() + mShaderStorageBlocks.size() +
+ mInBlocks.size());
+ mInterfaceBlocks.insert(mInterfaceBlocks.end(), mUniformBlocks.begin(), mUniformBlocks.end());
+ mInterfaceBlocks.insert(mInterfaceBlocks.end(), mShaderStorageBlocks.begin(),
+ mShaderStorageBlocks.end());
+ mInterfaceBlocks.insert(mInterfaceBlocks.end(), mInBlocks.begin(), mInBlocks.end());
+}
+
+void TCompiler::clearResults()
+{
+ mArrayBoundsClamper.Cleanup();
+ mInfoSink.info.erase();
+ mInfoSink.obj.erase();
+ mInfoSink.debug.erase();
+ mDiagnostics.resetErrorCount();
+
+ mAttributes.clear();
+ mOutputVariables.clear();
+ mUniforms.clear();
+ mInputVaryings.clear();
+ mOutputVaryings.clear();
+ mInterfaceBlocks.clear();
+ mUniformBlocks.clear();
+ mShaderStorageBlocks.clear();
+ mInBlocks.clear();
+ mVariablesCollected = false;
+ mGLPositionInitialized = false;
+
+ mNumViews = -1;
+
+ mGeometryShaderInputPrimitiveType = EptUndefined;
+ mGeometryShaderOutputPrimitiveType = EptUndefined;
+ mGeometryShaderInvocations = 0;
+ mGeometryShaderMaxVertices = -1;
+
+ mBuiltInFunctionEmulator.cleanup();
+
+ mNameMap.clear();
+
+ mSourcePath = nullptr;
+
+ mSymbolTable.clearCompilationResults();
+}
+
+bool TCompiler::initCallDag(TIntermNode *root)
+{
+ mCallDag.clear();
+
+ switch (mCallDag.init(root, &mDiagnostics))
+ {
+ case CallDAG::INITDAG_SUCCESS:
+ return true;
+ case CallDAG::INITDAG_RECURSION:
+ case CallDAG::INITDAG_UNDEFINED:
+ // Error message has already been written out.
+ ASSERT(mDiagnostics.numErrors() > 0);
+ return false;
+ }
+
+ UNREACHABLE();
+ return true;
+}
+
+bool TCompiler::checkCallDepth()
+{
+ std::vector<int> depths(mCallDag.size());
+
+ for (size_t i = 0; i < mCallDag.size(); i++)
+ {
+ int depth = 0;
+ const CallDAG::Record &record = mCallDag.getRecordFromIndex(i);
+
+ for (const int &calleeIndex : record.callees)
+ {
+ depth = std::max(depth, depths[calleeIndex] + 1);
+ }
+
+ depths[i] = depth;
+
+ if (depth >= mResources.MaxCallStackDepth)
+ {
+ // Trace back the function chain to have a meaningful info log.
+ std::stringstream errorStream = sh::InitializeStream<std::stringstream>();
+ errorStream << "Call stack too deep (larger than " << mResources.MaxCallStackDepth
+ << ") with the following call chain: "
+ << record.node->getFunction()->name();
+
+ int currentFunction = static_cast<int>(i);
+ int currentDepth = depth;
+
+ while (currentFunction != -1)
+ {
+ errorStream
+ << " -> "
+ << mCallDag.getRecordFromIndex(currentFunction).node->getFunction()->name();
+
+ int nextFunction = -1;
+ for (const int &calleeIndex : mCallDag.getRecordFromIndex(currentFunction).callees)
+ {
+ if (depths[calleeIndex] == currentDepth - 1)
+ {
+ currentDepth--;
+ nextFunction = calleeIndex;
+ }
+ }
+
+ currentFunction = nextFunction;
+ }
+
+ std::string errorStr = errorStream.str();
+ mDiagnostics.globalError(errorStr.c_str());
+
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TCompiler::tagUsedFunctions()
+{
+ // Search from main, starting from the end of the DAG as it usually is the root.
+ for (size_t i = mCallDag.size(); i-- > 0;)
+ {
+ if (mCallDag.getRecordFromIndex(i).node->getFunction()->isMain())
+ {
+ internalTagUsedFunction(i);
+ return true;
+ }
+ }
+
+ mDiagnostics.globalError("Missing main()");
+ return false;
+}
+
+void TCompiler::internalTagUsedFunction(size_t index)
+{
+ if (mFunctionMetadata[index].used)
+ {
+ return;
+ }
+
+ mFunctionMetadata[index].used = true;
+
+ for (int calleeIndex : mCallDag.getRecordFromIndex(index).callees)
+ {
+ internalTagUsedFunction(calleeIndex);
+ }
+}
+
+// A predicate for the stl that returns if a top-level node is unused
+class TCompiler::UnusedPredicate
+{
+ public:
+ UnusedPredicate(const CallDAG *callDag, const std::vector<FunctionMetadata> *metadatas)
+ : mCallDag(callDag), mMetadatas(metadatas)
+ {}
+
+ bool operator()(TIntermNode *node)
+ {
+ const TIntermFunctionPrototype *asFunctionPrototype = node->getAsFunctionPrototypeNode();
+ const TIntermFunctionDefinition *asFunctionDefinition = node->getAsFunctionDefinition();
+
+ const TFunction *func = nullptr;
+
+ if (asFunctionDefinition)
+ {
+ func = asFunctionDefinition->getFunction();
+ }
+ else if (asFunctionPrototype)
+ {
+ func = asFunctionPrototype->getFunction();
+ }
+ if (func == nullptr)
+ {
+ return false;
+ }
+
+ size_t callDagIndex = mCallDag->findIndex(func->uniqueId());
+ if (callDagIndex == CallDAG::InvalidIndex)
+ {
+ // This happens only for unimplemented prototypes which are thus unused
+ ASSERT(asFunctionPrototype);
+ return true;
+ }
+
+ ASSERT(callDagIndex < mMetadatas->size());
+ return !(*mMetadatas)[callDagIndex].used;
+ }
+
+ private:
+ const CallDAG *mCallDag;
+ const std::vector<FunctionMetadata> *mMetadatas;
+};
+
+void TCompiler::pruneUnusedFunctions(TIntermBlock *root)
+{
+ UnusedPredicate isUnused(&mCallDag, &mFunctionMetadata);
+ TIntermSequence *sequence = root->getSequence();
+
+ if (!sequence->empty())
+ {
+ sequence->erase(std::remove_if(sequence->begin(), sequence->end(), isUnused),
+ sequence->end());
+ }
+}
+
+bool TCompiler::limitExpressionComplexity(TIntermBlock *root)
+{
+ if (!IsASTDepthBelowLimit(root, mResources.MaxExpressionComplexity))
+ {
+ mDiagnostics.globalError("Expression too complex.");
+ return false;
+ }
+
+ if (!ValidateMaxParameters(root, mResources.MaxFunctionParameters))
+ {
+ mDiagnostics.globalError("Function has too many parameters.");
+ return false;
+ }
+
+ return true;
+}
+
+bool TCompiler::shouldCollectVariables(ShCompileOptions compileOptions)
+{
+ return (compileOptions & SH_VARIABLES) != 0;
+}
+
+bool TCompiler::wereVariablesCollected() const
+{
+ return mVariablesCollected;
+}
+
+void TCompiler::initializeGLPosition(TIntermBlock *root)
+{
+ InitVariableList list;
+ sh::ShaderVariable var(GL_FLOAT_VEC4);
+ var.name = "gl_Position";
+ list.push_back(var);
+ InitializeVariables(root, list, &mSymbolTable, mShaderVersion, mExtensionBehavior, false,
+ false);
+}
+
+void TCompiler::useAllMembersInUnusedStandardAndSharedBlocks(TIntermBlock *root)
+{
+ sh::InterfaceBlockList list;
+
+ for (const sh::InterfaceBlock &block : mUniformBlocks)
+ {
+ if (!block.staticUse &&
+ (block.layout == sh::BLOCKLAYOUT_STD140 || block.layout == sh::BLOCKLAYOUT_SHARED))
+ {
+ list.push_back(block);
+ }
+ }
+
+ sh::UseInterfaceBlockFields(root, list, mSymbolTable);
+}
+
+void TCompiler::initializeOutputVariables(TIntermBlock *root)
+{
+ InitVariableList list;
+ if (mShaderType == GL_VERTEX_SHADER || mShaderType == GL_GEOMETRY_SHADER_EXT)
+ {
+ for (const sh::Varying &var : mOutputVaryings)
+ {
+ list.push_back(var);
+ if (var.name == "gl_Position")
+ {
+ ASSERT(!mGLPositionInitialized);
+ mGLPositionInitialized = true;
+ }
+ }
+ }
+ else
+ {
+ ASSERT(mShaderType == GL_FRAGMENT_SHADER);
+ for (const sh::OutputVariable &var : mOutputVariables)
+ {
+ list.push_back(var);
+ }
+ }
+ InitializeVariables(root, list, &mSymbolTable, mShaderVersion, mExtensionBehavior, false,
+ false);
+}
+
+const TExtensionBehavior &TCompiler::getExtensionBehavior() const
+{
+ return mExtensionBehavior;
+}
+
+const char *TCompiler::getSourcePath() const
+{
+ return mSourcePath;
+}
+
+const ShBuiltInResources &TCompiler::getResources() const
+{
+ return mResources;
+}
+
+const ArrayBoundsClamper &TCompiler::getArrayBoundsClamper() const
+{
+ return mArrayBoundsClamper;
+}
+
+ShArrayIndexClampingStrategy TCompiler::getArrayIndexClampingStrategy() const
+{
+ return mResources.ArrayIndexClampingStrategy;
+}
+
+const BuiltInFunctionEmulator &TCompiler::getBuiltInFunctionEmulator() const
+{
+ return mBuiltInFunctionEmulator;
+}
+
+void TCompiler::writePragma(ShCompileOptions compileOptions)
+{
+ if (!(compileOptions & SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL))
+ {
+ TInfoSinkBase &sink = mInfoSink.obj;
+ if (mPragma.stdgl.invariantAll)
+ sink << "#pragma STDGL invariant(all)\n";
+ }
+}
+
+bool TCompiler::isVaryingDefined(const char *varyingName)
+{
+ ASSERT(mVariablesCollected);
+ for (size_t ii = 0; ii < mInputVaryings.size(); ++ii)
+ {
+ if (mInputVaryings[ii].name == varyingName)
+ {
+ return true;
+ }
+ }
+ for (size_t ii = 0; ii < mOutputVaryings.size(); ++ii)
+ {
+ if (mOutputVaryings[ii].name == varyingName)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void EmitWorkGroupSizeGLSL(const TCompiler &compiler, TInfoSinkBase &sink)
+{
+ if (compiler.isComputeShaderLocalSizeDeclared())
+ {
+ const sh::WorkGroupSize &localSize = compiler.getComputeShaderLocalSize();
+ sink << "layout (local_size_x=" << localSize[0] << ", local_size_y=" << localSize[1]
+ << ", local_size_z=" << localSize[2] << ") in;\n";
+ }
+}
+
+void EmitMultiviewGLSL(const TCompiler &compiler,
+ const ShCompileOptions &compileOptions,
+ const TBehavior behavior,
+ TInfoSinkBase &sink)
+{
+ ASSERT(behavior != EBhUndefined);
+ if (behavior == EBhDisable)
+ return;
+
+ const bool isVertexShader = (compiler.getShaderType() == GL_VERTEX_SHADER);
+ if (compileOptions & SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW)
+ {
+ // Emit ARB_shader_viewport_layer_array/NV_viewport_array2 in a vertex shader if the
+ // SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER option is set and the
+ // OVR_multiview(2) extension is requested.
+ if (isVertexShader && (compileOptions & SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER))
+ {
+ sink << "#if defined(GL_ARB_shader_viewport_layer_array)\n"
+ << "#extension GL_ARB_shader_viewport_layer_array : require\n"
+ << "#elif defined(GL_NV_viewport_array2)\n"
+ << "#extension GL_NV_viewport_array2 : require\n"
+ << "#endif\n";
+ }
+ }
+ else
+ {
+ sink << "#extension GL_OVR_multiview2 : " << GetBehaviorString(behavior) << "\n";
+
+ const auto &numViews = compiler.getNumViews();
+ if (isVertexShader && numViews != -1)
+ {
+ sink << "layout(num_views=" << numViews << ") in;\n";
+ }
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/Compiler.h b/gfx/angle/checkout/src/compiler/translator/Compiler.h
new file mode 100644
index 0000000000..70c02855f1
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Compiler.h
@@ -0,0 +1,304 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_COMPILER_H_
+#define COMPILER_TRANSLATOR_COMPILER_H_
+
+//
+// Machine independent part of the compiler private objects
+// sent as ShHandle to the driver.
+//
+// This should not be included by driver code.
+//
+
+#include <GLSLANG/ShaderVars.h>
+
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/CallDAG.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/Pragma.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/ValidateAST.h"
+#include "third_party/compiler/ArrayBoundsClamper.h"
+
+namespace sh
+{
+
+class TCompiler;
+class TParseContext;
+#ifdef ANGLE_ENABLE_HLSL
+class TranslatorHLSL;
+#endif // ANGLE_ENABLE_HLSL
+
+//
+// Helper function to check if the shader type is GLSL.
+//
+bool IsGLSL130OrNewer(ShShaderOutput output);
+bool IsGLSL420OrNewer(ShShaderOutput output);
+bool IsGLSL410OrOlder(ShShaderOutput output);
+
+//
+// Helper function to check if the invariant qualifier can be removed.
+//
+bool RemoveInvariant(sh::GLenum shaderType,
+ int shaderVersion,
+ ShShaderOutput outputType,
+ ShCompileOptions compileOptions);
+
+//
+// The base class used to back handles returned to the driver.
+//
+class TShHandleBase
+{
+ public:
+ TShHandleBase();
+ virtual ~TShHandleBase();
+ virtual TCompiler *getAsCompiler() { return 0; }
+#ifdef ANGLE_ENABLE_HLSL
+ virtual TranslatorHLSL *getAsTranslatorHLSL() { return 0; }
+#endif // ANGLE_ENABLE_HLSL
+
+ protected:
+ // Memory allocator. Allocates and tracks memory required by the compiler.
+ // Deallocates all memory when compiler is destructed.
+ angle::PoolAllocator allocator;
+};
+
+//
+// The base class for the machine dependent compiler to derive from
+// for managing object code from the compile.
+//
+class TCompiler : public TShHandleBase
+{
+ public:
+ TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
+ ~TCompiler() override;
+ TCompiler *getAsCompiler() override { return this; }
+
+ bool Init(const ShBuiltInResources &resources);
+
+ // compileTreeForTesting should be used only when tests require access to
+ // the AST. Users of this function need to manually manage the global pool
+ // allocator. Returns nullptr whenever there are compilation errors.
+ TIntermBlock *compileTreeForTesting(const char *const shaderStrings[],
+ size_t numStrings,
+ ShCompileOptions compileOptions);
+
+ bool compile(const char *const shaderStrings[],
+ size_t numStrings,
+ ShCompileOptions compileOptions);
+
+ // Get results of the last compilation.
+ int getShaderVersion() const { return mShaderVersion; }
+ TInfoSink &getInfoSink() { return mInfoSink; }
+
+ bool isComputeShaderLocalSizeDeclared() const { return mComputeShaderLocalSizeDeclared; }
+ const sh::WorkGroupSize &getComputeShaderLocalSize() const { return mComputeShaderLocalSize; }
+ int getNumViews() const { return mNumViews; }
+
+ // Clears the results from the previous compilation.
+ void clearResults();
+
+ const std::vector<sh::Attribute> &getAttributes() const { return mAttributes; }
+ const std::vector<sh::OutputVariable> &getOutputVariables() const { return mOutputVariables; }
+ const std::vector<sh::Uniform> &getUniforms() const { return mUniforms; }
+ const std::vector<sh::Varying> &getInputVaryings() const { return mInputVaryings; }
+ const std::vector<sh::Varying> &getOutputVaryings() const { return mOutputVaryings; }
+ const std::vector<sh::InterfaceBlock> &getInterfaceBlocks() const { return mInterfaceBlocks; }
+ const std::vector<sh::InterfaceBlock> &getUniformBlocks() const { return mUniformBlocks; }
+ const std::vector<sh::InterfaceBlock> &getShaderStorageBlocks() const
+ {
+ return mShaderStorageBlocks;
+ }
+ const std::vector<sh::InterfaceBlock> &getInBlocks() const { return mInBlocks; }
+
+ ShHashFunction64 getHashFunction() const { return mResources.HashFunction; }
+ NameMap &getNameMap() { return mNameMap; }
+ TSymbolTable &getSymbolTable() { return mSymbolTable; }
+ ShShaderSpec getShaderSpec() const { return mShaderSpec; }
+ ShShaderOutput getOutputType() const { return mOutputType; }
+ const std::string &getBuiltInResourcesString() const { return mBuiltInResourcesString; }
+
+ bool shouldRunLoopAndIndexingValidation(ShCompileOptions compileOptions) const;
+
+ // Get the resources set by InitBuiltInSymbolTable
+ const ShBuiltInResources &getResources() const;
+
+ int getGeometryShaderMaxVertices() const { return mGeometryShaderMaxVertices; }
+ int getGeometryShaderInvocations() const { return mGeometryShaderInvocations; }
+ TLayoutPrimitiveType getGeometryShaderInputPrimitiveType() const
+ {
+ return mGeometryShaderInputPrimitiveType;
+ }
+ TLayoutPrimitiveType getGeometryShaderOutputPrimitiveType() const
+ {
+ return mGeometryShaderOutputPrimitiveType;
+ }
+
+ sh::GLenum getShaderType() const { return mShaderType; }
+
+ protected:
+ // Add emulated functions to the built-in function emulator.
+ virtual void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu,
+ ShCompileOptions compileOptions)
+ {}
+ // Translate to object code. May generate performance warnings through the diagnostics.
+ virtual void translate(TIntermBlock *root,
+ ShCompileOptions compileOptions,
+ PerformanceDiagnostics *perfDiagnostics) = 0;
+ // Get built-in extensions with default behavior.
+ const TExtensionBehavior &getExtensionBehavior() const;
+ const char *getSourcePath() const;
+ const TPragma &getPragma() const { return mPragma; }
+ void writePragma(ShCompileOptions compileOptions);
+ // Relies on collectVariables having been called.
+ bool isVaryingDefined(const char *varyingName);
+
+ const ArrayBoundsClamper &getArrayBoundsClamper() const;
+ ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const;
+ const BuiltInFunctionEmulator &getBuiltInFunctionEmulator() const;
+
+ virtual bool shouldFlattenPragmaStdglInvariantAll() = 0;
+ virtual bool shouldCollectVariables(ShCompileOptions compileOptions);
+
+ bool wereVariablesCollected() const;
+ std::vector<sh::Attribute> mAttributes;
+ std::vector<sh::OutputVariable> mOutputVariables;
+ std::vector<sh::Uniform> mUniforms;
+ std::vector<sh::Varying> mInputVaryings;
+ std::vector<sh::Varying> mOutputVaryings;
+ std::vector<sh::InterfaceBlock> mInterfaceBlocks;
+ std::vector<sh::InterfaceBlock> mUniformBlocks;
+ std::vector<sh::InterfaceBlock> mShaderStorageBlocks;
+ std::vector<sh::InterfaceBlock> mInBlocks;
+
+ private:
+ // Initialize symbol-table with built-in symbols.
+ bool initBuiltInSymbolTable(const ShBuiltInResources &resources);
+ // Compute the string representation of the built-in resources
+ void setResourceString();
+ // Return false if the call depth is exceeded.
+ bool checkCallDepth();
+ // Insert statements to reference all members in unused uniform blocks with standard and shared
+ // layout. This is to work around a Mac driver that treats unused standard/shared
+ // uniform blocks as inactive.
+ void useAllMembersInUnusedStandardAndSharedBlocks(TIntermBlock *root);
+ // Insert statements to initialize output variables in the beginning of main().
+ // This is to avoid undefined behaviors.
+ void initializeOutputVariables(TIntermBlock *root);
+ // Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
+ // It is to work around a Linux driver bug where missing this causes compile failure
+ // while spec says it is allowed.
+ // This function should only be applied to vertex shaders.
+ void initializeGLPosition(TIntermBlock *root);
+ // Return true if the maximum expression complexity is below the limit.
+ bool limitExpressionComplexity(TIntermBlock *root);
+ // Creates the function call DAG for further analysis, returning false if there is a recursion
+ bool initCallDag(TIntermNode *root);
+ // Return false if "main" doesn't exist
+ bool tagUsedFunctions();
+ void internalTagUsedFunction(size_t index);
+
+ void collectInterfaceBlocks();
+
+ bool mVariablesCollected;
+
+ bool mGLPositionInitialized;
+
+ // Removes unused function declarations and prototypes from the AST
+ class UnusedPredicate;
+ void pruneUnusedFunctions(TIntermBlock *root);
+
+ TIntermBlock *compileTreeImpl(const char *const shaderStrings[],
+ size_t numStrings,
+ const ShCompileOptions compileOptions);
+
+ // Fetches and stores shader metadata that is not stored within the AST itself, such as shader
+ // version.
+ void setASTMetadata(const TParseContext &parseContext);
+
+ // Check if shader version meets the requirement.
+ bool checkShaderVersion(TParseContext *parseContext);
+
+ // Does checks that need to be run after parsing is complete and returns true if they pass.
+ bool checkAndSimplifyAST(TIntermBlock *root,
+ const TParseContext &parseContext,
+ ShCompileOptions compileOptions);
+
+ sh::GLenum mShaderType;
+ ShShaderSpec mShaderSpec;
+ ShShaderOutput mOutputType;
+
+ struct FunctionMetadata
+ {
+ FunctionMetadata() : used(false) {}
+ bool used;
+ };
+
+ CallDAG mCallDag;
+ std::vector<FunctionMetadata> mFunctionMetadata;
+
+ ShBuiltInResources mResources;
+ std::string mBuiltInResourcesString;
+
+ // Built-in symbol table for the given language, spec, and resources.
+ // It is preserved from compile-to-compile.
+ TSymbolTable mSymbolTable;
+ // Built-in extensions with default behavior.
+ TExtensionBehavior mExtensionBehavior;
+
+ ArrayBoundsClamper mArrayBoundsClamper;
+ BuiltInFunctionEmulator mBuiltInFunctionEmulator;
+
+ // Results of compilation.
+ int mShaderVersion;
+ TInfoSink mInfoSink; // Output sink.
+ TDiagnostics mDiagnostics;
+ const char *mSourcePath; // Path of source file or NULL
+
+ // compute shader local group size
+ bool mComputeShaderLocalSizeDeclared;
+ sh::WorkGroupSize mComputeShaderLocalSize;
+
+ // GL_OVR_multiview num_views.
+ int mNumViews;
+
+ // geometry shader parameters.
+ int mGeometryShaderMaxVertices;
+ int mGeometryShaderInvocations;
+ TLayoutPrimitiveType mGeometryShaderInputPrimitiveType;
+ TLayoutPrimitiveType mGeometryShaderOutputPrimitiveType;
+
+ // name hashing.
+ NameMap mNameMap;
+
+ TPragma mPragma;
+
+ // Track what should be validated given passes currently applied.
+ ValidateASTOptions mValidateASTOptions;
+};
+
+//
+// This is the interface between the machine independent code
+// and the machine dependent code.
+//
+// The machine dependent code should derive from the classes
+// above. Then Construct*() and Delete*() will create and
+// destroy the machine dependent objects, which contain the
+// above machine independent information.
+//
+TCompiler *ConstructCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
+void DeleteCompiler(TCompiler *);
+
+void EmitWorkGroupSizeGLSL(const TCompiler &, TInfoSinkBase &sink);
+void EmitMultiviewGLSL(const TCompiler &, const ShCompileOptions &, TBehavior, TInfoSinkBase &sink);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_COMPILER_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ConstantUnion.cpp b/gfx/angle/checkout/src/compiler/translator/ConstantUnion.cpp
new file mode 100644
index 0000000000..fe22a2d9b9
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ConstantUnion.cpp
@@ -0,0 +1,772 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ConstantUnion: Constant folding helper class.
+
+#include "compiler/translator/ConstantUnion.h"
+
+#include "common/mathutil.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+float CheckedSum(float lhs, float rhs, TDiagnostics *diag, const TSourceLoc &line)
+{
+ float result = lhs + rhs;
+ if (gl::isNaN(result) && !gl::isNaN(lhs) && !gl::isNaN(rhs))
+ {
+ diag->warning(line, "Constant folded undefined addition generated NaN", "+");
+ }
+ else if (gl::isInf(result) && !gl::isInf(lhs) && !gl::isInf(rhs))
+ {
+ diag->warning(line, "Constant folded addition overflowed to infinity", "+");
+ }
+ return result;
+}
+
+float CheckedDiff(float lhs, float rhs, TDiagnostics *diag, const TSourceLoc &line)
+{
+ float result = lhs - rhs;
+ if (gl::isNaN(result) && !gl::isNaN(lhs) && !gl::isNaN(rhs))
+ {
+ diag->warning(line, "Constant folded undefined subtraction generated NaN", "-");
+ }
+ else if (gl::isInf(result) && !gl::isInf(lhs) && !gl::isInf(rhs))
+ {
+ diag->warning(line, "Constant folded subtraction overflowed to infinity", "-");
+ }
+ return result;
+}
+
+float CheckedMul(float lhs, float rhs, TDiagnostics *diag, const TSourceLoc &line)
+{
+ float result = lhs * rhs;
+ if (gl::isNaN(result) && !gl::isNaN(lhs) && !gl::isNaN(rhs))
+ {
+ diag->warning(line, "Constant folded undefined multiplication generated NaN", "*");
+ }
+ else if (gl::isInf(result) && !gl::isInf(lhs) && !gl::isInf(rhs))
+ {
+ diag->warning(line, "Constant folded multiplication overflowed to infinity", "*");
+ }
+ return result;
+}
+
+bool IsValidShiftOffset(const TConstantUnion &rhs)
+{
+ return (rhs.getType() == EbtInt && (rhs.getIConst() >= 0 && rhs.getIConst() <= 31)) ||
+ (rhs.getType() == EbtUInt && rhs.getUConst() <= 31u);
+}
+
+} // anonymous namespace
+
+TConstantUnion::TConstantUnion()
+{
+ iConst = 0;
+ type = EbtVoid;
+}
+
+int TConstantUnion::getIConst() const
+{
+ ASSERT(type == EbtInt);
+ return iConst;
+}
+
+unsigned int TConstantUnion::getUConst() const
+{
+ ASSERT(type == EbtUInt);
+ return uConst;
+}
+
+float TConstantUnion::getFConst() const
+{
+ switch (type)
+ {
+ case EbtInt:
+ return static_cast<float>(iConst);
+ case EbtUInt:
+ return static_cast<float>(uConst);
+ default:
+ ASSERT(type == EbtFloat);
+ return fConst;
+ }
+}
+
+bool TConstantUnion::getBConst() const
+{
+ ASSERT(type == EbtBool);
+ return bConst;
+}
+
+TYuvCscStandardEXT TConstantUnion::getYuvCscStandardEXTConst() const
+{
+ ASSERT(type == EbtYuvCscStandardEXT);
+ return yuvCscStandardEXTConst;
+}
+
+bool TConstantUnion::cast(TBasicType newType, const TConstantUnion &constant)
+{
+ switch (newType)
+ {
+ case EbtFloat:
+ switch (constant.type)
+ {
+ case EbtInt:
+ setFConst(static_cast<float>(constant.getIConst()));
+ break;
+ case EbtUInt:
+ setFConst(static_cast<float>(constant.getUConst()));
+ break;
+ case EbtBool:
+ setFConst(static_cast<float>(constant.getBConst()));
+ break;
+ case EbtFloat:
+ setFConst(static_cast<float>(constant.getFConst()));
+ break;
+ default:
+ return false;
+ }
+ break;
+ case EbtInt:
+ switch (constant.type)
+ {
+ case EbtInt:
+ setIConst(static_cast<int>(constant.getIConst()));
+ break;
+ case EbtUInt:
+ setIConst(static_cast<int>(constant.getUConst()));
+ break;
+ case EbtBool:
+ setIConst(static_cast<int>(constant.getBConst()));
+ break;
+ case EbtFloat:
+ setIConst(static_cast<int>(constant.getFConst()));
+ break;
+ default:
+ return false;
+ }
+ break;
+ case EbtUInt:
+ switch (constant.type)
+ {
+ case EbtInt:
+ setUConst(static_cast<unsigned int>(constant.getIConst()));
+ break;
+ case EbtUInt:
+ setUConst(static_cast<unsigned int>(constant.getUConst()));
+ break;
+ case EbtBool:
+ setUConst(static_cast<unsigned int>(constant.getBConst()));
+ break;
+ case EbtFloat:
+ if (constant.getFConst() < 0.0f)
+ {
+ // Avoid undefined behavior in C++ by first casting to signed int.
+ setUConst(
+ static_cast<unsigned int>(static_cast<int>(constant.getFConst())));
+ }
+ else
+ {
+ setUConst(static_cast<unsigned int>(constant.getFConst()));
+ }
+ break;
+ default:
+ return false;
+ }
+ break;
+ case EbtBool:
+ switch (constant.type)
+ {
+ case EbtInt:
+ setBConst(constant.getIConst() != 0);
+ break;
+ case EbtUInt:
+ setBConst(constant.getUConst() != 0);
+ break;
+ case EbtBool:
+ setBConst(constant.getBConst());
+ break;
+ case EbtFloat:
+ setBConst(constant.getFConst() != 0.0f);
+ break;
+ default:
+ return false;
+ }
+ break;
+ case EbtStruct: // Struct fields don't get cast
+ switch (constant.type)
+ {
+ case EbtInt:
+ setIConst(constant.getIConst());
+ break;
+ case EbtUInt:
+ setUConst(constant.getUConst());
+ break;
+ case EbtBool:
+ setBConst(constant.getBConst());
+ break;
+ case EbtFloat:
+ setFConst(constant.getFConst());
+ break;
+ default:
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool TConstantUnion::operator==(const int i) const
+{
+ switch (type)
+ {
+ case EbtFloat:
+ return static_cast<float>(i) == fConst;
+ default:
+ return i == iConst;
+ }
+}
+
+bool TConstantUnion::operator==(const unsigned int u) const
+{
+ switch (type)
+ {
+ case EbtFloat:
+ return static_cast<float>(u) == fConst;
+ default:
+ return u == uConst;
+ }
+}
+
+bool TConstantUnion::operator==(const float f) const
+{
+ switch (type)
+ {
+ case EbtInt:
+ return f == static_cast<float>(iConst);
+ case EbtUInt:
+ return f == static_cast<float>(uConst);
+ default:
+ return f == fConst;
+ }
+}
+
+bool TConstantUnion::operator==(const bool b) const
+{
+ return b == bConst;
+}
+
+bool TConstantUnion::operator==(const TYuvCscStandardEXT s) const
+{
+ return s == yuvCscStandardEXTConst;
+}
+
+bool TConstantUnion::operator==(const TConstantUnion &constant) const
+{
+ ImplicitTypeConversion conversion = GetConversion(constant.type, type);
+ if (conversion == ImplicitTypeConversion::Same)
+ {
+ switch (type)
+ {
+ case EbtInt:
+ return constant.iConst == iConst;
+ case EbtUInt:
+ return constant.uConst == uConst;
+ case EbtFloat:
+ return constant.fConst == fConst;
+ case EbtBool:
+ return constant.bConst == bConst;
+ case EbtYuvCscStandardEXT:
+ return constant.yuvCscStandardEXTConst == yuvCscStandardEXTConst;
+ default:
+ return false;
+ }
+ }
+ else if (conversion == ImplicitTypeConversion::Invalid)
+ {
+ return false;
+ }
+ else
+ {
+ return constant.getFConst() == getFConst();
+ }
+}
+
+bool TConstantUnion::operator!=(const int i) const
+{
+ return !operator==(i);
+}
+
+bool TConstantUnion::operator!=(const unsigned int u) const
+{
+ return !operator==(u);
+}
+
+bool TConstantUnion::operator!=(const float f) const
+{
+ return !operator==(f);
+}
+
+bool TConstantUnion::operator!=(const bool b) const
+{
+ return !operator==(b);
+}
+
+bool TConstantUnion::operator!=(const TYuvCscStandardEXT s) const
+{
+ return !operator==(s);
+}
+
+bool TConstantUnion::operator!=(const TConstantUnion &constant) const
+{
+ return !operator==(constant);
+}
+
+bool TConstantUnion::operator>(const TConstantUnion &constant) const
+{
+
+ ImplicitTypeConversion conversion = GetConversion(constant.type, type);
+ if (conversion == ImplicitTypeConversion::Same)
+ {
+ switch (type)
+ {
+ case EbtInt:
+ return iConst > constant.iConst;
+ case EbtUInt:
+ return uConst > constant.uConst;
+ case EbtFloat:
+ return fConst > constant.fConst;
+ default:
+ return false; // Invalid operation, handled at semantic analysis
+ }
+ }
+ else
+ {
+ ASSERT(conversion != ImplicitTypeConversion::Invalid);
+ return getFConst() > constant.getFConst();
+ }
+}
+
+bool TConstantUnion::operator<(const TConstantUnion &constant) const
+{
+ ImplicitTypeConversion conversion = GetConversion(constant.type, type);
+ if (conversion == ImplicitTypeConversion::Same)
+ {
+ switch (type)
+ {
+ case EbtInt:
+ return iConst < constant.iConst;
+ case EbtUInt:
+ return uConst < constant.uConst;
+ case EbtFloat:
+ return fConst < constant.fConst;
+ default:
+ return false; // Invalid operation, handled at semantic analysis
+ }
+ }
+ else
+ {
+ ASSERT(conversion != ImplicitTypeConversion::Invalid);
+ return getFConst() < constant.getFConst();
+ }
+}
+
+// static
+TConstantUnion TConstantUnion::add(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line)
+{
+ TConstantUnion returnValue;
+
+ ImplicitTypeConversion conversion = GetConversion(lhs.type, rhs.type);
+ if (conversion == ImplicitTypeConversion::Same)
+ {
+ switch (lhs.type)
+ {
+ case EbtInt:
+ returnValue.setIConst(gl::WrappingSum<int>(lhs.iConst, rhs.iConst));
+ break;
+ case EbtUInt:
+ returnValue.setUConst(gl::WrappingSum<unsigned int>(lhs.uConst, rhs.uConst));
+ break;
+ case EbtFloat:
+ returnValue.setFConst(CheckedSum(lhs.fConst, rhs.fConst, diag, line));
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ ASSERT(conversion != ImplicitTypeConversion::Invalid);
+ returnValue.setFConst(CheckedSum(lhs.getFConst(), rhs.getFConst(), diag, line));
+ }
+
+ return returnValue;
+}
+
+// static
+TConstantUnion TConstantUnion::sub(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line)
+{
+ TConstantUnion returnValue;
+
+ ImplicitTypeConversion conversion = GetConversion(lhs.type, rhs.type);
+ if (conversion == ImplicitTypeConversion::Same)
+ {
+ switch (lhs.type)
+ {
+ case EbtInt:
+ returnValue.setIConst(gl::WrappingDiff<int>(lhs.iConst, rhs.iConst));
+ break;
+ case EbtUInt:
+ returnValue.setUConst(gl::WrappingDiff<unsigned int>(lhs.uConst, rhs.uConst));
+ break;
+ case EbtFloat:
+ returnValue.setFConst(CheckedDiff(lhs.fConst, rhs.fConst, diag, line));
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ ASSERT(conversion != ImplicitTypeConversion::Invalid);
+ returnValue.setFConst(CheckedDiff(lhs.getFConst(), rhs.getFConst(), diag, line));
+ }
+
+ return returnValue;
+}
+
+// static
+TConstantUnion TConstantUnion::mul(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line)
+{
+ TConstantUnion returnValue;
+
+ ImplicitTypeConversion conversion = GetConversion(lhs.type, rhs.type);
+ if (conversion == ImplicitTypeConversion::Same)
+ {
+ switch (lhs.type)
+ {
+ case EbtInt:
+ returnValue.setIConst(gl::WrappingMul(lhs.iConst, rhs.iConst));
+ break;
+ case EbtUInt:
+ // Unsigned integer math in C++ is defined to be done in modulo 2^n, so we rely
+ // on that to implement wrapping multiplication.
+ returnValue.setUConst(lhs.uConst * rhs.uConst);
+ break;
+ case EbtFloat:
+ returnValue.setFConst(CheckedMul(lhs.fConst, rhs.fConst, diag, line));
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ ASSERT(conversion != ImplicitTypeConversion::Invalid);
+ returnValue.setFConst(CheckedMul(lhs.getFConst(), rhs.getFConst(), diag, line));
+ }
+
+ return returnValue;
+}
+
+TConstantUnion TConstantUnion::operator%(const TConstantUnion &constant) const
+{
+ TConstantUnion returnValue;
+ ASSERT(type == constant.type);
+ switch (type)
+ {
+ case EbtInt:
+ returnValue.setIConst(iConst % constant.iConst);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(uConst % constant.uConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return returnValue;
+}
+
+// static
+TConstantUnion TConstantUnion::rshift(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line)
+{
+ TConstantUnion returnValue;
+ ASSERT(lhs.type == EbtInt || lhs.type == EbtUInt);
+ ASSERT(rhs.type == EbtInt || rhs.type == EbtUInt);
+ if (!IsValidShiftOffset(rhs))
+ {
+ diag->warning(line, "Undefined shift (operand out of range)", ">>");
+ switch (lhs.type)
+ {
+ case EbtInt:
+ returnValue.setIConst(0);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(0u);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return returnValue;
+ }
+
+ switch (lhs.type)
+ {
+ case EbtInt:
+ {
+ unsigned int shiftOffset = 0;
+ switch (rhs.type)
+ {
+ case EbtInt:
+ shiftOffset = static_cast<unsigned int>(rhs.iConst);
+ break;
+ case EbtUInt:
+ shiftOffset = rhs.uConst;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ if (shiftOffset > 0)
+ {
+ // ESSL 3.00.6 section 5.9: "If E1 is a signed integer, the right-shift will extend
+ // the sign bit." In C++ shifting negative integers is undefined, so we implement
+ // extending the sign bit manually.
+ int lhsSafe = lhs.iConst;
+ if (lhsSafe == std::numeric_limits<int>::min())
+ {
+ // The min integer needs special treatment because only bit it has set is the
+ // sign bit, which we clear later to implement safe right shift of negative
+ // numbers.
+ lhsSafe = -0x40000000;
+ --shiftOffset;
+ }
+ if (shiftOffset > 0)
+ {
+ bool extendSignBit = false;
+ if (lhsSafe < 0)
+ {
+ extendSignBit = true;
+ // Clear the sign bit so that bitshift right is defined in C++.
+ lhsSafe &= 0x7fffffff;
+ ASSERT(lhsSafe > 0);
+ }
+ returnValue.setIConst(lhsSafe >> shiftOffset);
+
+ // Manually fill in the extended sign bit if necessary.
+ if (extendSignBit)
+ {
+ int extendedSignBit = static_cast<int>(0xffffffffu << (31 - shiftOffset));
+ returnValue.setIConst(returnValue.getIConst() | extendedSignBit);
+ }
+ }
+ else
+ {
+ returnValue.setIConst(lhsSafe);
+ }
+ }
+ else
+ {
+ returnValue.setIConst(lhs.iConst);
+ }
+ break;
+ }
+ case EbtUInt:
+ switch (rhs.type)
+ {
+ case EbtInt:
+ returnValue.setUConst(lhs.uConst >> rhs.iConst);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(lhs.uConst >> rhs.uConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ return returnValue;
+}
+
+// static
+TConstantUnion TConstantUnion::lshift(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line)
+{
+ TConstantUnion returnValue;
+ ASSERT(lhs.type == EbtInt || lhs.type == EbtUInt);
+ ASSERT(rhs.type == EbtInt || rhs.type == EbtUInt);
+ if (!IsValidShiftOffset(rhs))
+ {
+ diag->warning(line, "Undefined shift (operand out of range)", "<<");
+ switch (lhs.type)
+ {
+ case EbtInt:
+ returnValue.setIConst(0);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(0u);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return returnValue;
+ }
+
+ switch (lhs.type)
+ {
+ case EbtInt:
+ switch (rhs.type)
+ {
+ // Cast to unsigned integer before shifting, since ESSL 3.00.6 section 5.9 says that
+ // lhs is "interpreted as a bit pattern". This also avoids the possibility of signed
+ // integer overflow or undefined shift of a negative integer.
+ case EbtInt:
+ returnValue.setIConst(
+ static_cast<int>(static_cast<uint32_t>(lhs.iConst) << rhs.iConst));
+ break;
+ case EbtUInt:
+ returnValue.setIConst(
+ static_cast<int>(static_cast<uint32_t>(lhs.iConst) << rhs.uConst));
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+
+ case EbtUInt:
+ switch (rhs.type)
+ {
+ case EbtInt:
+ returnValue.setUConst(lhs.uConst << rhs.iConst);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(lhs.uConst << rhs.uConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ return returnValue;
+}
+
+TConstantUnion TConstantUnion::operator&(const TConstantUnion &constant) const
+{
+ TConstantUnion returnValue;
+ ASSERT(constant.type == EbtInt || constant.type == EbtUInt);
+ switch (type)
+ {
+ case EbtInt:
+ returnValue.setIConst(iConst & constant.iConst);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(uConst & constant.uConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return returnValue;
+}
+
+TConstantUnion TConstantUnion::operator|(const TConstantUnion &constant) const
+{
+ TConstantUnion returnValue;
+ ASSERT(type == constant.type);
+ switch (type)
+ {
+ case EbtInt:
+ returnValue.setIConst(iConst | constant.iConst);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(uConst | constant.uConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return returnValue;
+}
+
+TConstantUnion TConstantUnion::operator^(const TConstantUnion &constant) const
+{
+ TConstantUnion returnValue;
+ ASSERT(type == constant.type);
+ switch (type)
+ {
+ case EbtInt:
+ returnValue.setIConst(iConst ^ constant.iConst);
+ break;
+ case EbtUInt:
+ returnValue.setUConst(uConst ^ constant.uConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return returnValue;
+}
+
+TConstantUnion TConstantUnion::operator&&(const TConstantUnion &constant) const
+{
+ TConstantUnion returnValue;
+ ASSERT(type == constant.type);
+ switch (type)
+ {
+ case EbtBool:
+ returnValue.setBConst(bConst && constant.bConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return returnValue;
+}
+
+TConstantUnion TConstantUnion::operator||(const TConstantUnion &constant) const
+{
+ TConstantUnion returnValue;
+ ASSERT(type == constant.type);
+ switch (type)
+ {
+ case EbtBool:
+ returnValue.setBConst(bConst || constant.bConst);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return returnValue;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ConstantUnion.h b/gfx/angle/checkout/src/compiler/translator/ConstantUnion.h
new file mode 100644
index 0000000000..155fcd44b0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ConstantUnion.h
@@ -0,0 +1,119 @@
+//
+// 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_CONSTANTUNION_H_
+#define COMPILER_TRANSLATOR_CONSTANTUNION_H_
+
+#include <assert.h>
+
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+
+namespace sh
+{
+
+class TDiagnostics;
+
+class TConstantUnion
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TConstantUnion();
+
+ bool cast(TBasicType newType, const TConstantUnion &constant);
+
+ void setIConst(int i)
+ {
+ iConst = i;
+ type = EbtInt;
+ }
+ void setUConst(unsigned int u)
+ {
+ uConst = u;
+ type = EbtUInt;
+ }
+ void setFConst(float f)
+ {
+ fConst = f;
+ type = EbtFloat;
+ }
+ void setBConst(bool b)
+ {
+ bConst = b;
+ type = EbtBool;
+ }
+
+ void setYuvCscStandardEXTConst(TYuvCscStandardEXT s)
+ {
+ yuvCscStandardEXTConst = s;
+ type = EbtYuvCscStandardEXT;
+ }
+
+ int getIConst() const;
+ unsigned int getUConst() const;
+ float getFConst() const;
+ bool getBConst() const;
+ TYuvCscStandardEXT getYuvCscStandardEXTConst() const;
+
+ bool operator==(const int i) const;
+ bool operator==(const unsigned int u) const;
+ bool operator==(const float f) const;
+ bool operator==(const bool b) const;
+ bool operator==(const TYuvCscStandardEXT s) const;
+ bool operator==(const TConstantUnion &constant) const;
+ bool operator!=(const int i) const;
+ bool operator!=(const unsigned int u) const;
+ bool operator!=(const float f) const;
+ bool operator!=(const bool b) const;
+ bool operator!=(const TYuvCscStandardEXT s) const;
+ bool operator!=(const TConstantUnion &constant) const;
+ bool operator>(const TConstantUnion &constant) const;
+ bool operator<(const TConstantUnion &constant) const;
+ static TConstantUnion add(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line);
+ static TConstantUnion sub(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line);
+ static TConstantUnion mul(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line);
+ TConstantUnion operator%(const TConstantUnion &constant) const;
+ static TConstantUnion rshift(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line);
+ static TConstantUnion lshift(const TConstantUnion &lhs,
+ const TConstantUnion &rhs,
+ TDiagnostics *diag,
+ const TSourceLoc &line);
+ TConstantUnion operator&(const TConstantUnion &constant) const;
+ TConstantUnion operator|(const TConstantUnion &constant) const;
+ TConstantUnion operator^(const TConstantUnion &constant) const;
+ TConstantUnion operator&&(const TConstantUnion &constant) const;
+ TConstantUnion operator||(const TConstantUnion &constant) const;
+
+ TBasicType getType() const { return type; }
+
+ private:
+ union
+ {
+ int iConst; // used for ivec, scalar ints
+ unsigned int uConst; // used for uvec, scalar uints
+ bool bConst; // used for bvec, scalar bools
+ float fConst; // used for vec, mat, scalar floats
+ TYuvCscStandardEXT yuvCscStandardEXTConst;
+ };
+
+ TBasicType type;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_CONSTANTUNION_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Declarator.cpp b/gfx/angle/checkout/src/compiler/translator/Declarator.cpp
new file mode 100644
index 0000000000..7a17a82b6a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Declarator.cpp
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Declarator.cpp:
+// Declarator type for parsing structure field declarators.
+
+#include "compiler/translator/Declarator.h"
+
+namespace sh
+{
+
+TDeclarator::TDeclarator(const ImmutableString &name, const TSourceLoc &line)
+ : mName(name), mArraySizes(nullptr), mLine(line)
+{
+ ASSERT(mName != "");
+}
+
+TDeclarator::TDeclarator(const ImmutableString &name,
+ const TVector<unsigned int> *arraySizes,
+ const TSourceLoc &line)
+ : mName(name), mArraySizes(arraySizes), mLine(line)
+{
+ ASSERT(mArraySizes);
+}
+
+bool TDeclarator::isArray() const
+{
+ return mArraySizes != nullptr && mArraySizes->size() > 0;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/Declarator.h b/gfx/angle/checkout/src/compiler/translator/Declarator.h
new file mode 100644
index 0000000000..5b5d26b53a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Declarator.h
@@ -0,0 +1,49 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Declarator.h:
+// Declarator type for parsing structure field declarators.
+
+#ifndef COMPILER_TRANSLATOR_DECLARATOR_H_
+#define COMPILER_TRANSLATOR_DECLARATOR_H_
+
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ImmutableString.h"
+
+namespace sh
+{
+
+// Declarator like "a[2][4]". Only used for parsing structure field declarators.
+class TDeclarator : angle::NonCopyable
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TDeclarator(const ImmutableString &name, const TSourceLoc &line);
+
+ TDeclarator(const ImmutableString &name,
+ const TVector<unsigned int> *arraySizes,
+ const TSourceLoc &line);
+
+ const ImmutableString &name() const { return mName; }
+
+ bool isArray() const;
+ const TVector<unsigned int> *arraySizes() const { return mArraySizes; }
+
+ const TSourceLoc &line() const { return mLine; }
+
+ private:
+ const ImmutableString mName;
+
+ // Outermost array size is stored at the end of the vector.
+ const TVector<unsigned int> *const mArraySizes;
+
+ const TSourceLoc mLine;
+};
+
+using TDeclaratorList = TVector<TDeclarator *>;
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_DECLARATOR_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Diagnostics.cpp b/gfx/angle/checkout/src/compiler/translator/Diagnostics.cpp
new file mode 100644
index 0000000000..5ec4867cbb
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Diagnostics.cpp
@@ -0,0 +1,106 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/Diagnostics.h"
+
+#include "common/debug.h"
+#include "compiler/preprocessor/SourceLocation.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/InfoSink.h"
+
+namespace sh
+{
+
+TDiagnostics::TDiagnostics(TInfoSinkBase &infoSink)
+ : mInfoSink(infoSink), mNumErrors(0), mNumWarnings(0)
+{}
+
+TDiagnostics::~TDiagnostics() {}
+
+void TDiagnostics::writeInfo(Severity severity,
+ const angle::pp::SourceLocation &loc,
+ const char *reason,
+ const char *token)
+{
+ switch (severity)
+ {
+ case SH_ERROR:
+ ++mNumErrors;
+ break;
+ case SH_WARNING:
+ ++mNumWarnings;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
+ mInfoSink.prefix(severity);
+ mInfoSink.location(loc.file, loc.line);
+ mInfoSink << "'" << token << "' : " << reason << "\n";
+}
+
+void TDiagnostics::globalError(const char *message)
+{
+ ++mNumErrors;
+ mInfoSink.prefix(SH_ERROR);
+ mInfoSink << message << "\n";
+}
+
+void TDiagnostics::error(const angle::pp::SourceLocation &loc,
+ const char *reason,
+ const char *token)
+{
+ writeInfo(SH_ERROR, loc, reason, token);
+}
+
+void TDiagnostics::warning(const angle::pp::SourceLocation &loc,
+ const char *reason,
+ const char *token)
+{
+ writeInfo(SH_WARNING, loc, reason, token);
+}
+
+void TDiagnostics::error(const TSourceLoc &loc, const char *reason, const char *token)
+{
+ angle::pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ error(srcLoc, reason, token);
+}
+
+void TDiagnostics::warning(const TSourceLoc &loc, const char *reason, const char *token)
+{
+ angle::pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ warning(srcLoc, reason, token);
+}
+
+void TDiagnostics::print(ID id, const angle::pp::SourceLocation &loc, const std::string &text)
+{
+ writeInfo(isError(id) ? SH_ERROR : SH_WARNING, loc, message(id), text.c_str());
+}
+
+void TDiagnostics::resetErrorCount()
+{
+ mNumErrors = 0;
+ mNumWarnings = 0;
+}
+
+PerformanceDiagnostics::PerformanceDiagnostics(TDiagnostics *diagnostics)
+ : mDiagnostics(diagnostics)
+{
+ ASSERT(diagnostics);
+}
+
+void PerformanceDiagnostics::warning(const TSourceLoc &loc, const char *reason, const char *token)
+{
+ mDiagnostics->warning(loc, reason, token);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/Diagnostics.h b/gfx/angle/checkout/src/compiler/translator/Diagnostics.h
new file mode 100644
index 0000000000..121b6f3c2a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Diagnostics.h
@@ -0,0 +1,67 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_DIAGNOSTICS_H_
+#define COMPILER_TRANSLATOR_DIAGNOSTICS_H_
+
+#include "common/angleutils.h"
+#include "compiler/preprocessor/DiagnosticsBase.h"
+#include "compiler/translator/Severity.h"
+
+namespace sh
+{
+
+class TInfoSinkBase;
+struct TSourceLoc;
+
+class TDiagnostics : public angle::pp::Diagnostics, angle::NonCopyable
+{
+ public:
+ TDiagnostics(TInfoSinkBase &infoSink);
+ ~TDiagnostics() override;
+
+ int numErrors() const { return mNumErrors; }
+ int numWarnings() const { return mNumWarnings; }
+
+ void error(const angle::pp::SourceLocation &loc, const char *reason, const char *token);
+ void warning(const angle::pp::SourceLocation &loc, const char *reason, const char *token);
+
+ void error(const TSourceLoc &loc, const char *reason, const char *token);
+ void warning(const TSourceLoc &loc, const char *reason, const char *token);
+
+ void globalError(const char *message);
+
+ void resetErrorCount();
+
+ protected:
+ void writeInfo(Severity severity,
+ const angle::pp::SourceLocation &loc,
+ const char *reason,
+ const char *token);
+
+ void print(ID id, const angle::pp::SourceLocation &loc, const std::string &text) override;
+
+ private:
+ TInfoSinkBase &mInfoSink;
+ int mNumErrors;
+ int mNumWarnings;
+};
+
+// Diagnostics wrapper to use when the code is only allowed to generate warnings.
+class PerformanceDiagnostics : public angle::NonCopyable
+{
+ public:
+ PerformanceDiagnostics(TDiagnostics *diagnostics);
+
+ void warning(const TSourceLoc &loc, const char *reason, const char *token);
+
+ private:
+ TDiagnostics *mDiagnostics;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_DIAGNOSTICS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/DirectiveHandler.cpp b/gfx/angle/checkout/src/compiler/translator/DirectiveHandler.cpp
new file mode 100644
index 0000000000..8e4dae42d2
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/DirectiveHandler.cpp
@@ -0,0 +1,204 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/DirectiveHandler.h"
+
+#include <sstream>
+
+#include "angle_gl.h"
+#include "common/debug.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/Diagnostics.h"
+
+namespace sh
+{
+
+static TBehavior getBehavior(const std::string &str)
+{
+ const char kRequire[] = "require";
+ const char kEnable[] = "enable";
+ const char kDisable[] = "disable";
+ const char kWarn[] = "warn";
+
+ if (str == kRequire)
+ return EBhRequire;
+ else if (str == kEnable)
+ return EBhEnable;
+ else if (str == kDisable)
+ return EBhDisable;
+ else if (str == kWarn)
+ return EBhWarn;
+ return EBhUndefined;
+}
+
+TDirectiveHandler::TDirectiveHandler(TExtensionBehavior &extBehavior,
+ TDiagnostics &diagnostics,
+ int &shaderVersion,
+ sh::GLenum shaderType,
+ bool debugShaderPrecisionSupported)
+ : mExtensionBehavior(extBehavior),
+ mDiagnostics(diagnostics),
+ mShaderVersion(shaderVersion),
+ mShaderType(shaderType),
+ mDebugShaderPrecisionSupported(debugShaderPrecisionSupported)
+{}
+
+TDirectiveHandler::~TDirectiveHandler() {}
+
+void TDirectiveHandler::handleError(const angle::pp::SourceLocation &loc, const std::string &msg)
+{
+ mDiagnostics.error(loc, msg.c_str(), "");
+}
+
+void TDirectiveHandler::handlePragma(const angle::pp::SourceLocation &loc,
+ const std::string &name,
+ const std::string &value,
+ bool stdgl)
+{
+ if (stdgl)
+ {
+ const char kInvariant[] = "invariant";
+ const char kAll[] = "all";
+
+ if (name == kInvariant && value == kAll)
+ {
+ if (mShaderVersion == 300 && mShaderType == GL_FRAGMENT_SHADER)
+ {
+ // ESSL 3.00.4 section 4.6.1
+ mDiagnostics.error(
+ loc, "#pragma STDGL invariant(all) can not be used in fragment shader",
+ name.c_str());
+ }
+ mPragma.stdgl.invariantAll = true;
+ }
+ // The STDGL pragma is used to reserve pragmas for use by future
+ // revisions of GLSL. Do not generate an error on unexpected
+ // name and value.
+ return;
+ }
+ else
+ {
+ const char kOptimize[] = "optimize";
+ const char kDebug[] = "debug";
+ const char kDebugShaderPrecision[] = "webgl_debug_shader_precision";
+ const char kOn[] = "on";
+ const char kOff[] = "off";
+
+ bool invalidValue = false;
+ if (name == kOptimize)
+ {
+ if (value == kOn)
+ mPragma.optimize = true;
+ else if (value == kOff)
+ mPragma.optimize = false;
+ else
+ invalidValue = true;
+ }
+ else if (name == kDebug)
+ {
+ if (value == kOn)
+ mPragma.debug = true;
+ else if (value == kOff)
+ mPragma.debug = false;
+ else
+ invalidValue = true;
+ }
+ else if (name == kDebugShaderPrecision && mDebugShaderPrecisionSupported)
+ {
+ if (value == kOn)
+ mPragma.debugShaderPrecision = true;
+ else if (value == kOff)
+ mPragma.debugShaderPrecision = false;
+ else
+ invalidValue = true;
+ }
+ else
+ {
+ mDiagnostics.report(angle::pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
+ return;
+ }
+
+ if (invalidValue)
+ {
+ mDiagnostics.error(loc, "invalid pragma value - 'on' or 'off' expected", value.c_str());
+ }
+ }
+}
+
+void TDirectiveHandler::handleExtension(const angle::pp::SourceLocation &loc,
+ const std::string &name,
+ const std::string &behavior)
+{
+ const char kExtAll[] = "all";
+
+ TBehavior behaviorVal = getBehavior(behavior);
+ if (behaviorVal == EBhUndefined)
+ {
+ mDiagnostics.error(loc, "behavior invalid", name.c_str());
+ return;
+ }
+
+ if (name == kExtAll)
+ {
+ if (behaviorVal == EBhRequire)
+ {
+ mDiagnostics.error(loc, "extension cannot have 'require' behavior", name.c_str());
+ }
+ else if (behaviorVal == EBhEnable)
+ {
+ mDiagnostics.error(loc, "extension cannot have 'enable' behavior", name.c_str());
+ }
+ else
+ {
+ for (TExtensionBehavior::iterator iter = mExtensionBehavior.begin();
+ iter != mExtensionBehavior.end(); ++iter)
+ iter->second = behaviorVal;
+ }
+ return;
+ }
+
+ TExtensionBehavior::iterator iter = mExtensionBehavior.find(GetExtensionByName(name.c_str()));
+ if (iter != mExtensionBehavior.end())
+ {
+ iter->second = behaviorVal;
+ return;
+ }
+
+ switch (behaviorVal)
+ {
+ case EBhRequire:
+ mDiagnostics.error(loc, "extension is not supported", name.c_str());
+ break;
+ case EBhEnable:
+ case EBhWarn:
+ case EBhDisable:
+ mDiagnostics.warning(loc, "extension is not supported", name.c_str());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void TDirectiveHandler::handleVersion(const angle::pp::SourceLocation &loc,
+ int version,
+ ShShaderSpec spec)
+{
+ if (((version == 100 || version == 300 || version == 310) && !IsDesktopGLSpec(spec)) ||
+ (version == 330 && IsDesktopGLSpec(spec)))
+ {
+ mShaderVersion = version;
+ }
+ else
+ {
+ std::stringstream stream = sh::InitializeStream<std::stringstream>();
+ stream << version;
+ std::string str = stream.str();
+ mDiagnostics.error(loc, "client/version number not supported", str.c_str());
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/DirectiveHandler.h b/gfx/angle/checkout/src/compiler/translator/DirectiveHandler.h
new file mode 100644
index 0000000000..2d3b0ce044
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/DirectiveHandler.h
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
+#define COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/angleutils.h"
+#include "compiler/preprocessor/DirectiveHandlerBase.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/Pragma.h"
+
+namespace sh
+{
+class TDiagnostics;
+
+class TDirectiveHandler : public angle::pp::DirectiveHandler, angle::NonCopyable
+{
+ public:
+ TDirectiveHandler(TExtensionBehavior &extBehavior,
+ TDiagnostics &diagnostics,
+ int &shaderVersion,
+ sh::GLenum shaderType,
+ bool debugShaderPrecisionSupported);
+ ~TDirectiveHandler() override;
+
+ const TPragma &pragma() const { return mPragma; }
+ const TExtensionBehavior &extensionBehavior() const { return mExtensionBehavior; }
+
+ void handleError(const angle::pp::SourceLocation &loc, const std::string &msg) override;
+
+ void handlePragma(const angle::pp::SourceLocation &loc,
+ const std::string &name,
+ const std::string &value,
+ bool stdgl) override;
+
+ void handleExtension(const angle::pp::SourceLocation &loc,
+ const std::string &name,
+ const std::string &behavior) override;
+
+ void handleVersion(const angle::pp::SourceLocation &loc,
+ int version,
+ ShShaderSpec spec) override;
+
+ private:
+ TPragma mPragma;
+ TExtensionBehavior &mExtensionBehavior;
+ TDiagnostics &mDiagnostics;
+ int &mShaderVersion;
+ sh::GLenum mShaderType;
+ bool mDebugShaderPrecisionSupported;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.cpp b/gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.cpp
new file mode 100644
index 0000000000..5a5c92b8bd
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.cpp
@@ -0,0 +1,101 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ExtensionBehavior.cpp: Extension name enumeration and data structures for storing extension
+// behavior.
+
+#include "compiler/translator/ExtensionBehavior.h"
+
+#include "common/debug.h"
+
+#include <string.h>
+
+#define LIST_EXTENSIONS(OP) \
+ OP(ARB_texture_rectangle) \
+ OP(ANGLE_texture_multisample) \
+ OP(ARM_shader_framebuffer_fetch) \
+ OP(EXT_blend_func_extended) \
+ OP(EXT_draw_buffers) \
+ OP(EXT_frag_depth) \
+ OP(EXT_geometry_shader) \
+ OP(EXT_shader_framebuffer_fetch) \
+ OP(EXT_shader_texture_lod) \
+ OP(EXT_YUV_target) \
+ OP(NV_EGL_stream_consumer_external) \
+ OP(NV_shader_framebuffer_fetch) \
+ OP(OES_EGL_image_external) \
+ OP(OES_EGL_image_external_essl3) \
+ OP(OES_standard_derivatives) \
+ OP(OES_texture_storage_multisample_2d_array) \
+ OP(OES_texture_3D) \
+ OP(OVR_multiview) \
+ OP(OVR_multiview2) \
+ OP(ANGLE_multi_draw) \
+ OP(ANGLE_base_vertex_base_instance)
+
+namespace sh
+{
+
+#define RETURN_EXTENSION_NAME_CASE(ext) \
+ case TExtension::ext: \
+ return "GL_" #ext;
+
+const char *GetExtensionNameString(TExtension extension)
+{
+ switch (extension)
+ {
+ LIST_EXTENSIONS(RETURN_EXTENSION_NAME_CASE)
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+#define RETURN_EXTENSION_IF_NAME_MATCHES(ext) \
+ if (strcmp(extWithoutGLPrefix, #ext) == 0) \
+ { \
+ return TExtension::ext; \
+ }
+
+TExtension GetExtensionByName(const char *extension)
+{
+ // If first characters of the extension don't equal "GL_", early out.
+ if (strncmp(extension, "GL_", 3) != 0)
+ {
+ return TExtension::UNDEFINED;
+ }
+ const char *extWithoutGLPrefix = extension + 3;
+
+ LIST_EXTENSIONS(RETURN_EXTENSION_IF_NAME_MATCHES)
+
+ return TExtension::UNDEFINED;
+}
+
+const char *GetBehaviorString(TBehavior b)
+{
+ switch (b)
+ {
+ case EBhRequire:
+ return "require";
+ case EBhEnable:
+ return "enable";
+ case EBhWarn:
+ return "warn";
+ case EBhDisable:
+ return "disable";
+ default:
+ return nullptr;
+ }
+}
+
+bool IsExtensionEnabled(const TExtensionBehavior &extBehavior, TExtension extension)
+{
+ ASSERT(extension != TExtension::UNDEFINED);
+ auto iter = extBehavior.find(extension);
+ return iter != extBehavior.end() &&
+ (iter->second == EBhEnable || iter->second == EBhRequire || iter->second == EBhWarn);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.h b/gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.h
new file mode 100644
index 0000000000..2d27ab9922
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ExtensionBehavior.h
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ExtensionBehavior.h: Extension name enumeration and data structures for storing extension
+// behavior.
+
+#ifndef COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
+#define COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
+
+#include <map>
+
+namespace sh
+{
+
+enum class TExtension
+{
+ UNDEFINED, // Special value used to indicate no extension.
+
+ ARB_texture_rectangle,
+ ANGLE_texture_multisample,
+ ARM_shader_framebuffer_fetch,
+ EXT_blend_func_extended,
+ EXT_draw_buffers,
+ EXT_frag_depth,
+ EXT_geometry_shader,
+ EXT_shader_framebuffer_fetch,
+ EXT_shader_texture_lod,
+ EXT_YUV_target,
+ NV_EGL_stream_consumer_external,
+ NV_shader_framebuffer_fetch,
+ OES_EGL_image_external,
+ OES_EGL_image_external_essl3,
+ OES_standard_derivatives,
+ OES_texture_storage_multisample_2d_array,
+ OES_texture_3D,
+ OVR_multiview,
+ OVR_multiview2,
+ ANGLE_multi_draw,
+ ANGLE_base_vertex_base_instance
+};
+
+enum TBehavior
+{
+ EBhRequire,
+ EBhEnable,
+ EBhWarn,
+ EBhDisable,
+ EBhUndefined
+};
+
+const char *GetExtensionNameString(TExtension extension);
+TExtension GetExtensionByName(const char *extension);
+
+const char *GetBehaviorString(TBehavior b);
+
+// Mapping between extension id and behavior.
+typedef std::map<TExtension, TBehavior> TExtensionBehavior;
+
+bool IsExtensionEnabled(const TExtensionBehavior &extBehavior, TExtension extension);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.cpp
new file mode 100644
index 0000000000..8a7aca95f2
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.cpp
@@ -0,0 +1,104 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ExtensionGLSL.cpp: Implements the TExtensionGLSL class that tracks GLSL extension requirements
+// of shaders.
+
+#include "compiler/translator/ExtensionGLSL.h"
+
+#include "compiler/translator/VersionGLSL.h"
+
+namespace sh
+{
+
+TExtensionGLSL::TExtensionGLSL(ShShaderOutput output)
+ : TIntermTraverser(true, false, false), mTargetVersion(ShaderOutputTypeToGLSLVersion(output))
+{}
+
+const std::set<std::string> &TExtensionGLSL::getEnabledExtensions() const
+{
+ return mEnabledExtensions;
+}
+
+const std::set<std::string> &TExtensionGLSL::getRequiredExtensions() const
+{
+ return mRequiredExtensions;
+}
+
+bool TExtensionGLSL::visitUnary(Visit, TIntermUnary *node)
+{
+ checkOperator(node);
+
+ return true;
+}
+
+bool TExtensionGLSL::visitAggregate(Visit, TIntermAggregate *node)
+{
+ checkOperator(node);
+
+ return true;
+}
+
+void TExtensionGLSL::checkOperator(TIntermOperator *node)
+{
+ if (mTargetVersion < GLSL_VERSION_130)
+ {
+ return;
+ }
+
+ switch (node->getOp())
+ {
+ case EOpAbs:
+ break;
+
+ case EOpSign:
+ break;
+
+ case EOpMix:
+ break;
+
+ case EOpFloatBitsToInt:
+ case EOpFloatBitsToUint:
+ case EOpIntBitsToFloat:
+ case EOpUintBitsToFloat:
+ if (mTargetVersion < GLSL_VERSION_330)
+ {
+ // Bit conversion functions cannot be emulated.
+ mRequiredExtensions.insert("GL_ARB_shader_bit_encoding");
+ }
+ break;
+
+ case EOpPackSnorm2x16:
+ case EOpPackHalf2x16:
+ case EOpUnpackSnorm2x16:
+ case EOpUnpackHalf2x16:
+ if (mTargetVersion < GLSL_VERSION_420)
+ {
+ mEnabledExtensions.insert("GL_ARB_shading_language_packing");
+
+ if (mTargetVersion < GLSL_VERSION_330)
+ {
+ // floatBitsToUint and uintBitsToFloat are needed to emulate
+ // packHalf2x16 and unpackHalf2x16 respectively and cannot be
+ // emulated themselves.
+ mRequiredExtensions.insert("GL_ARB_shader_bit_encoding");
+ }
+ }
+ break;
+
+ case EOpPackUnorm2x16:
+ case EOpUnpackUnorm2x16:
+ if (mTargetVersion < GLSL_VERSION_410)
+ {
+ mEnabledExtensions.insert("GL_ARB_shading_language_packing");
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h b/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h
new file mode 100644
index 0000000000..9d752c4eaf
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ExtensionGLSL.h: Defines the TExtensionGLSL class that tracks GLSL extension requirements of
+// shaders.
+
+#ifndef COMPILER_TRANSLATOR_EXTENSIONGLSL_H_
+#define COMPILER_TRANSLATOR_EXTENSIONGLSL_H_
+
+#include <set>
+#include <string>
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+// Traverses the intermediate tree to determine which GLSL extensions are required
+// to support the shader.
+class TExtensionGLSL : public TIntermTraverser
+{
+ public:
+ TExtensionGLSL(ShShaderOutput output);
+
+ const std::set<std::string> &getEnabledExtensions() const;
+ const std::set<std::string> &getRequiredExtensions() const;
+
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+
+ private:
+ void checkOperator(TIntermOperator *node);
+
+ int mTargetVersion;
+
+ std::set<std::string> mEnabledExtensions;
+ std::set<std::string> mRequiredExtensions;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_EXTENSIONGLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp b/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp
new file mode 100644
index 0000000000..368854f068
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp
@@ -0,0 +1,76 @@
+//
+// 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.
+//
+// FlagStd140Structs.cpp: Find structs in std140 blocks, where the padding added in the translator
+// conflicts with the "natural" unpadded type.
+
+#include "compiler/translator/FlagStd140Structs.h"
+
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class FlagStd140StructsTraverser : public TIntermTraverser
+{
+ public:
+ FlagStd140StructsTraverser() : TIntermTraverser(true, false, false) {}
+
+ const std::vector<MappedStruct> getMappedStructs() const { return mMappedStructs; }
+
+ protected:
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+
+ private:
+ void mapBlockStructMembers(TIntermSymbol *blockDeclarator, const TInterfaceBlock *block);
+
+ std::vector<MappedStruct> mMappedStructs;
+};
+
+void FlagStd140StructsTraverser::mapBlockStructMembers(TIntermSymbol *blockDeclarator,
+ const TInterfaceBlock *block)
+{
+ for (auto *field : block->fields())
+ {
+ if (field->type()->getBasicType() == EbtStruct)
+ {
+ MappedStruct mappedStruct;
+ mappedStruct.blockDeclarator = blockDeclarator;
+ mappedStruct.field = field;
+ mMappedStructs.push_back(mappedStruct);
+ }
+ }
+}
+
+bool FlagStd140StructsTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ TIntermTyped *declarator = node->getSequence()->back()->getAsTyped();
+ if (declarator->getBasicType() == EbtInterfaceBlock)
+ {
+ const TInterfaceBlock *block = declarator->getType().getInterfaceBlock();
+ if (block->blockStorage() == EbsStd140)
+ {
+ mapBlockStructMembers(declarator->getAsSymbolNode(), block);
+ }
+ }
+ return false;
+}
+
+} // anonymous namespace
+
+std::vector<MappedStruct> FlagStd140Structs(TIntermNode *node)
+{
+ FlagStd140StructsTraverser flaggingTraversal;
+
+ node->traverse(&flaggingTraversal);
+
+ return flaggingTraversal.getMappedStructs();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.h b/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.h
new file mode 100644
index 0000000000..ce035d9185
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.h
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+// FlagStd140Structs.h: Find structs in std140 blocks, where the padding added in the translator
+// conflicts with the "natural" unpadded type.
+
+#ifndef COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
+#define COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
+
+#include <vector>
+
+namespace sh
+{
+
+class TField;
+class TIntermNode;
+class TIntermSymbol;
+
+struct MappedStruct
+{
+ TIntermSymbol *blockDeclarator;
+ TField *field;
+};
+
+std::vector<MappedStruct> FlagStd140Structs(TIntermNode *node);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/FunctionLookup.cpp b/gfx/angle/checkout/src/compiler/translator/FunctionLookup.cpp
new file mode 100644
index 0000000000..fd5091c5ed
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/FunctionLookup.cpp
@@ -0,0 +1,179 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FunctionLookup.cpp: Used for storing function calls that have not yet been resolved during
+// parsing.
+//
+
+#include "compiler/translator/FunctionLookup.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+
+namespace sh
+{
+
+namespace
+{
+
+const char kFunctionMangledNameSeparator = '(';
+
+constexpr const ImmutableString kEmptyName("");
+
+// Helper function for GetMangledNames
+// Gets all ordered combinations of elements in list[currentIndex, end]
+std::vector<std::vector<int>> GetImplicitConversionCombinations(const std::vector<int> &list)
+{
+ std::vector<std::vector<int>> target;
+ target.push_back(std::vector<int>());
+
+ for (size_t currentIndex = 0; currentIndex < list.size(); currentIndex++)
+ {
+ size_t prevIterSize = target.size();
+ for (size_t copyIndex = 0; copyIndex < prevIterSize; copyIndex++)
+ {
+ std::vector<int> combination = target[copyIndex];
+ combination.push_back(list[currentIndex]);
+ target.push_back(combination);
+ }
+ }
+
+ return target;
+}
+
+} // anonymous namespace
+
+TFunctionLookup::TFunctionLookup(const ImmutableString &name,
+ const TType *constructorType,
+ const TSymbol *symbol)
+ : mName(name), mConstructorType(constructorType), mThisNode(nullptr), mSymbol(symbol)
+{}
+
+// static
+TFunctionLookup *TFunctionLookup::CreateConstructor(const TType *type)
+{
+ ASSERT(type != nullptr);
+ return new TFunctionLookup(kEmptyName, type, nullptr);
+}
+
+// static
+TFunctionLookup *TFunctionLookup::CreateFunctionCall(const ImmutableString &name,
+ const TSymbol *symbol)
+{
+ ASSERT(name != "");
+ return new TFunctionLookup(name, nullptr, symbol);
+}
+
+const ImmutableString &TFunctionLookup::name() const
+{
+ return mName;
+}
+
+ImmutableString TFunctionLookup::getMangledName() const
+{
+ return GetMangledName(mName.data(), mArguments);
+}
+
+ImmutableString TFunctionLookup::GetMangledName(const char *functionName,
+ const TIntermSequence &arguments)
+{
+ std::string newName(functionName);
+ newName += kFunctionMangledNameSeparator;
+
+ for (TIntermNode *argument : arguments)
+ {
+ newName += argument->getAsTyped()->getType().getMangledName();
+ }
+ return ImmutableString(newName);
+}
+
+std::vector<ImmutableString> GetMangledNames(const char *functionName,
+ const TIntermSequence &arguments)
+{
+ std::vector<ImmutableString> target;
+
+ std::vector<int> indexes;
+ for (int i = 0; i < static_cast<int>(arguments.size()); i++)
+ {
+ TIntermNode *argument = arguments[i];
+ TBasicType argType = argument->getAsTyped()->getType().getBasicType();
+ if (argType == EbtInt || argType == EbtUInt)
+ {
+ indexes.push_back(i);
+ }
+ }
+
+ std::vector<std::vector<int>> combinations = GetImplicitConversionCombinations(indexes);
+ for (const std::vector<int> &combination : combinations)
+ {
+ // combination: ordered list of indexes for arguments that should be converted to float
+ std::string newName(functionName);
+ newName += kFunctionMangledNameSeparator;
+ // combination[currentIndex] represents index of next argument to be converted
+ int currentIndex = 0;
+ for (int i = 0; i < (int)arguments.size(); i++)
+ {
+ TIntermNode *argument = arguments[i];
+
+ if (currentIndex != static_cast<int>(combination.size()) &&
+ combination[currentIndex] == i)
+ {
+ // Convert
+ TType type = argument->getAsTyped()->getType();
+ type.setBasicType(EbtFloat);
+ newName += type.getMangledName();
+ currentIndex++;
+ }
+ else
+ {
+ // Don't convert
+ newName += argument->getAsTyped()->getType().getMangledName();
+ }
+ }
+ target.push_back(ImmutableString(newName));
+ }
+
+ return target;
+}
+
+std::vector<ImmutableString> TFunctionLookup::getMangledNamesForImplicitConversions() const
+{
+ return GetMangledNames(mName.data(), mArguments);
+}
+
+bool TFunctionLookup::isConstructor() const
+{
+ return mConstructorType != nullptr;
+}
+
+const TType &TFunctionLookup::constructorType() const
+{
+ return *mConstructorType;
+}
+
+void TFunctionLookup::setThisNode(TIntermTyped *thisNode)
+{
+ mThisNode = thisNode;
+}
+
+TIntermTyped *TFunctionLookup::thisNode() const
+{
+ return mThisNode;
+}
+
+void TFunctionLookup::addArgument(TIntermTyped *argument)
+{
+ mArguments.push_back(argument);
+}
+
+TIntermSequence &TFunctionLookup::arguments()
+{
+ return mArguments;
+}
+
+const TSymbol *TFunctionLookup::symbol() const
+{
+ return mSymbol;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/FunctionLookup.h b/gfx/angle/checkout/src/compiler/translator/FunctionLookup.h
new file mode 100644
index 0000000000..7b0b2dafa5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/FunctionLookup.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FunctionLookup.h: Used for storing function calls that have not yet been resolved during parsing.
+//
+
+#ifndef COMPILER_TRANSLATOR_FUNCTIONLOOKUP_H_
+#define COMPILER_TRANSLATOR_FUNCTIONLOOKUP_H_
+
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/IntermNode.h"
+
+namespace sh
+{
+
+// A function look-up.
+class TFunctionLookup : angle::NonCopyable
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+
+ static TFunctionLookup *CreateConstructor(const TType *type);
+ static TFunctionLookup *CreateFunctionCall(const ImmutableString &name, const TSymbol *symbol);
+
+ const ImmutableString &name() const;
+ ImmutableString getMangledName() const;
+ static ImmutableString GetMangledName(const char *functionName,
+ const TIntermSequence &arguments);
+ std::vector<ImmutableString> getMangledNamesForImplicitConversions() const;
+
+ bool isConstructor() const;
+ const TType &constructorType() const;
+
+ void setThisNode(TIntermTyped *thisNode);
+ TIntermTyped *thisNode() const;
+
+ void addArgument(TIntermTyped *argument);
+ TIntermSequence &arguments();
+
+ // Symbol looked up in the lexical phase using only the name of the function.
+ // This does not necessarily correspond to the correct overloaded function.
+ const TSymbol *symbol() const;
+
+ private:
+ TFunctionLookup(const ImmutableString &name,
+ const TType *constructorType,
+ const TSymbol *symbol);
+
+ const ImmutableString mName;
+ const TType *const mConstructorType;
+ TIntermTyped *mThisNode;
+ TIntermSequence mArguments;
+ const TSymbol *mSymbol;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_FUNCTIONLOOKUP_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/HashNames.cpp b/gfx/angle/checkout/src/compiler/translator/HashNames.cpp
new file mode 100644
index 0000000000..6994c10afa
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/HashNames.cpp
@@ -0,0 +1,94 @@
+//
+// Copyright (c) 2017 The ANGLE Project 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/HashNames.h"
+
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/Symbol.h"
+
+namespace sh
+{
+
+namespace
+{
+constexpr const ImmutableString kHashedNamePrefix("webgl_");
+
+// Can't prefix with just _ because then we might introduce a double underscore, which is not safe
+// in GLSL (ESSL 3.00.6 section 3.8: All identifiers containing a double underscore are reserved for
+// use by the underlying implementation). u is short for user-defined.
+constexpr const ImmutableString kUnhashedNamePrefix("_u");
+
+ImmutableString HashName(const ImmutableString &name, ShHashFunction64 hashFunction)
+{
+ ASSERT(!name.empty());
+ ASSERT(hashFunction);
+ khronos_uint64_t number = (*hashFunction)(name.data(), name.length());
+
+ // Build the hashed name in place.
+ static const unsigned int kHexStrMaxLength = sizeof(number) * 2;
+ static const size_t kHashedNameMaxLength = kHashedNamePrefix.length() + kHexStrMaxLength;
+
+ ImmutableStringBuilder hashedName(kHashedNameMaxLength);
+ hashedName << kHashedNamePrefix;
+
+ hashedName.appendHex(number);
+
+ return hashedName;
+}
+
+} // anonymous namespace
+
+ImmutableString HashName(const ImmutableString &name,
+ ShHashFunction64 hashFunction,
+ NameMap *nameMap)
+{
+ if (hashFunction == nullptr)
+ {
+ if (name.length() + kUnhashedNamePrefix.length() > kESSLMaxIdentifierLength)
+ {
+ // If the identifier length is already close to the limit, we can't prefix it. This is
+ // not a problem since there are no builtins or ANGLE's internal variables that would
+ // have as long names and could conflict.
+ return name;
+ }
+ ImmutableStringBuilder prefixedName(kUnhashedNamePrefix.length() + name.length());
+ prefixedName << kUnhashedNamePrefix << name;
+ return prefixedName;
+ }
+ if (nameMap)
+ {
+ NameMap::const_iterator it = nameMap->find(name.data());
+ if (it != nameMap->end())
+ {
+ // TODO(oetuaho): Would be nice if we didn't need to allocate a string here.
+ return ImmutableString(it->second);
+ }
+ }
+ ImmutableString hashedName = HashName(name, hashFunction);
+ if (nameMap)
+ {
+ (*nameMap)[name.data()] = hashedName.data();
+ }
+ return hashedName;
+}
+
+ImmutableString HashName(const TSymbol *symbol, ShHashFunction64 hashFunction, NameMap *nameMap)
+{
+ if (symbol->symbolType() == SymbolType::Empty)
+ {
+ return kEmptyImmutableString;
+ }
+ if (symbol->symbolType() == SymbolType::AngleInternal ||
+ symbol->symbolType() == SymbolType::BuiltIn)
+ {
+ return symbol->name();
+ }
+ return HashName(symbol->name(), hashFunction, nameMap);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/HashNames.h b/gfx/angle/checkout/src/compiler/translator/HashNames.h
new file mode 100644
index 0000000000..132cb59337
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/HashNames.h
@@ -0,0 +1,33 @@
+//
+// 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_TRANSLATOR_HASHNAMES_H_
+#define COMPILER_TRANSLATOR_HASHNAMES_H_
+
+#include <map>
+
+#include "GLSLANG/ShaderLang.h"
+#include "compiler/translator/Common.h"
+
+namespace sh
+{
+
+typedef std::map<TPersistString, TPersistString> NameMap;
+
+class ImmutableString;
+class TSymbol;
+
+ImmutableString HashName(const ImmutableString &name,
+ ShHashFunction64 hashFunction,
+ NameMap *nameMap);
+
+// Hash user-defined name for GLSL output, with special handling for internal names.
+// The nameMap parameter is optional and is used to cache hashed names if set.
+ImmutableString HashName(const TSymbol *symbol, ShHashFunction64 hashFunction, NameMap *nameMap);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_HASHNAMES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.cpp
new file mode 100644
index 0000000000..d60cce09e5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.cpp
@@ -0,0 +1,371 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ImageFunctionHLSL: Class for writing implementations of ESSL image functions into HLSL output.
+//
+
+#include "compiler/translator/ImageFunctionHLSL.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/UtilsHLSL.h"
+
+namespace sh
+{
+
+// static
+ImmutableString ImageFunctionHLSL::GetImageReference(
+ TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction)
+{
+ static const ImmutableString kImageIndexStr("[index]");
+ if (imageFunction.readonly)
+ {
+ static const ImmutableString kReadonlyImagesStr("readonlyImages");
+ ImmutableString suffix(
+ TextureGroupSuffix(imageFunction.image, imageFunction.imageInternalFormat));
+ out << " const uint index = imageIndex - readonlyImageIndexOffset" << suffix.data()
+ << ";\n";
+ ImmutableStringBuilder imageRefBuilder(kReadonlyImagesStr.length() + suffix.length() +
+ kImageIndexStr.length());
+ imageRefBuilder << kReadonlyImagesStr << suffix << kImageIndexStr;
+ return imageRefBuilder;
+ }
+ else
+ {
+ static const ImmutableString kImagesStr("images");
+ ImmutableString suffix(
+ RWTextureGroupSuffix(imageFunction.image, imageFunction.imageInternalFormat));
+ out << " const uint index = imageIndex - imageIndexOffset" << suffix.data() << ";\n";
+ ImmutableStringBuilder imageRefBuilder(kImagesStr.length() + suffix.length() +
+ kImageIndexStr.length());
+ imageRefBuilder << kImagesStr << suffix << kImageIndexStr;
+ return imageRefBuilder;
+ }
+}
+
+void ImageFunctionHLSL::OutputImageFunctionArgumentList(
+ TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction)
+{
+ out << "uint imageIndex";
+
+ if (imageFunction.method == ImageFunctionHLSL::ImageFunction::Method::LOAD ||
+ imageFunction.method == ImageFunctionHLSL::ImageFunction::Method::STORE)
+ {
+ switch (imageFunction.image)
+ {
+ case EbtImage2D:
+ case EbtIImage2D:
+ case EbtUImage2D:
+ out << ", int2 p";
+ break;
+ case EbtImage3D:
+ case EbtIImage3D:
+ case EbtUImage3D:
+ case EbtImageCube:
+ case EbtIImageCube:
+ case EbtUImageCube:
+ case EbtImage2DArray:
+ case EbtIImage2DArray:
+ case EbtUImage2DArray:
+ out << ", int3 p";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ if (imageFunction.method == ImageFunctionHLSL::ImageFunction::Method::STORE)
+ {
+ switch (imageFunction.image)
+ {
+ case EbtImage2D:
+ case EbtImage3D:
+ case EbtImageCube:
+ case EbtImage2DArray:
+ out << ", float4 data";
+ break;
+ case EbtIImage2D:
+ case EbtIImage3D:
+ case EbtIImageCube:
+ case EbtIImage2DArray:
+ out << ", int4 data";
+ break;
+ case EbtUImage2D:
+ case EbtUImage3D:
+ case EbtUImageCube:
+ case EbtUImage2DArray:
+ out << ", uint4 data";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+}
+
+// static
+void ImageFunctionHLSL::OutputImageSizeFunctionBody(
+ TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction,
+ const ImmutableString &imageReference)
+{
+ if (IsImage3D(imageFunction.image) || IsImage2DArray(imageFunction.image) ||
+ IsImageCube(imageFunction.image))
+ {
+ // "depth" stores either the number of layers in an array texture or 3D depth
+ out << " uint width; uint height; uint depth;\n"
+ << " " << imageReference << ".GetDimensions(width, height, depth);\n";
+ }
+ else if (IsImage2D(imageFunction.image))
+ {
+ out << " uint width; uint height;\n"
+ << " " << imageReference << ".GetDimensions(width, height);\n";
+ }
+ else
+ UNREACHABLE();
+
+ if (strcmp(imageFunction.getReturnType(), "int3") == 0)
+ {
+ out << " return int3(width, height, depth);\n";
+ }
+ else
+ {
+ out << " return int2(width, height);\n";
+ }
+}
+
+// static
+void ImageFunctionHLSL::OutputImageLoadFunctionBody(
+ TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction,
+ const ImmutableString &imageReference)
+{
+ if (IsImage3D(imageFunction.image) || IsImage2DArray(imageFunction.image) ||
+ IsImageCube(imageFunction.image))
+ {
+ out << " return " << imageReference << "[uint3(p.x, p.y, p.z)];\n";
+ }
+ else if (IsImage2D(imageFunction.image))
+ {
+ out << " return " << imageReference << "[uint2(p.x, p.y)];\n";
+ }
+ else
+ UNREACHABLE();
+}
+
+// static
+void ImageFunctionHLSL::OutputImageStoreFunctionBody(
+ TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction,
+ const ImmutableString &imageReference)
+{
+ if (IsImage3D(imageFunction.image) || IsImage2DArray(imageFunction.image) ||
+ IsImage2D(imageFunction.image) || IsImageCube(imageFunction.image))
+ {
+ out << " " << imageReference << "[p] = data;\n";
+ }
+ else
+ UNREACHABLE();
+}
+
+ImmutableString ImageFunctionHLSL::ImageFunction::name() const
+{
+ static const ImmutableString kGlImageName("gl_image");
+
+ ImmutableString suffix(nullptr);
+ if (readonly)
+ {
+ suffix = ImmutableString(TextureTypeSuffix(image, imageInternalFormat));
+ }
+ else
+ {
+ suffix = ImmutableString(RWTextureTypeSuffix(image, imageInternalFormat));
+ }
+
+ ImmutableStringBuilder name(kGlImageName.length() + suffix.length() + 5u);
+
+ name << kGlImageName << suffix;
+
+ switch (method)
+ {
+ case Method::SIZE:
+ name << "Size";
+ break;
+ case Method::LOAD:
+ name << "Load";
+ break;
+ case Method::STORE:
+ name << "Store";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return name;
+}
+
+ImageFunctionHLSL::ImageFunction::DataType ImageFunctionHLSL::ImageFunction::getDataType(
+ TLayoutImageInternalFormat format) const
+{
+ switch (format)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return ImageFunction::DataType::FLOAT4;
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return ImageFunction::DataType::UINT4;
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return ImageFunction::DataType::INT4;
+ case EiifRGBA8:
+ return ImageFunction::DataType::UNORM_FLOAT4;
+ case EiifRGBA8_SNORM:
+ return ImageFunction::DataType::SNORM_FLOAT4;
+ default:
+ UNREACHABLE();
+ }
+
+ return ImageFunction::DataType::NONE;
+}
+
+const char *ImageFunctionHLSL::ImageFunction::getReturnType() const
+{
+ if (method == ImageFunction::Method::SIZE)
+ {
+ switch (image)
+ {
+ case EbtImage2D:
+ case EbtIImage2D:
+ case EbtUImage2D:
+ case EbtImageCube:
+ case EbtIImageCube:
+ case EbtUImageCube:
+ return "int2";
+ case EbtImage3D:
+ case EbtIImage3D:
+ case EbtUImage3D:
+ case EbtImage2DArray:
+ case EbtIImage2DArray:
+ case EbtUImage2DArray:
+ return "int3";
+ default:
+ UNREACHABLE();
+ }
+ }
+ else if (method == ImageFunction::Method::LOAD)
+ {
+ switch (image)
+ {
+ case EbtImage2D:
+ case EbtImage3D:
+ case EbtImageCube:
+ case EbtImage2DArray:
+ return "float4";
+ case EbtIImage2D:
+ case EbtIImage3D:
+ case EbtIImageCube:
+ case EbtIImage2DArray:
+ return "int4";
+ case EbtUImage2D:
+ case EbtUImage3D:
+ case EbtUImageCube:
+ case EbtUImage2DArray:
+ return "uint4";
+ default:
+ UNREACHABLE();
+ }
+ }
+ else if (method == ImageFunction::Method::STORE)
+ {
+ return "void";
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ return "";
+}
+
+bool ImageFunctionHLSL::ImageFunction::operator<(const ImageFunction &rhs) const
+{
+ return std::tie(image, type, method, readonly) <
+ std::tie(rhs.image, rhs.type, rhs.method, rhs.readonly);
+}
+
+ImmutableString ImageFunctionHLSL::useImageFunction(const ImmutableString &name,
+ const TBasicType &type,
+ TLayoutImageInternalFormat imageInternalFormat,
+ bool readonly)
+{
+ ASSERT(IsImage(type));
+ ImageFunction imageFunction;
+ imageFunction.image = type;
+ imageFunction.imageInternalFormat = imageInternalFormat;
+ imageFunction.readonly = readonly;
+ imageFunction.type = imageFunction.getDataType(imageInternalFormat);
+
+ if (name == "imageSize")
+ {
+ imageFunction.method = ImageFunction::Method::SIZE;
+ }
+ else if (name == "imageLoad")
+ {
+ imageFunction.method = ImageFunction::Method::LOAD;
+ }
+ else if (name == "imageStore")
+ {
+ imageFunction.method = ImageFunction::Method::STORE;
+ }
+ else
+ UNREACHABLE();
+
+ mUsesImage.insert(imageFunction);
+ return imageFunction.name();
+}
+
+void ImageFunctionHLSL::imageFunctionHeader(TInfoSinkBase &out)
+{
+ for (const ImageFunction &imageFunction : mUsesImage)
+ {
+ // Skip to generate image2D functions here, dynamically generate these
+ // functions when linking, or after dispatch or draw.
+ if (IsImage2D(imageFunction.image))
+ {
+ mUsedImage2DFunctionNames.insert(imageFunction.name().data());
+ continue;
+ }
+ // Function header
+ out << imageFunction.getReturnType() << " " << imageFunction.name() << "(";
+
+ OutputImageFunctionArgumentList(out, imageFunction);
+
+ out << ")\n"
+ "{\n";
+
+ ImmutableString imageReference = GetImageReference(out, imageFunction);
+ if (imageFunction.method == ImageFunction::Method::SIZE)
+ {
+ OutputImageSizeFunctionBody(out, imageFunction, imageReference);
+ }
+ else if (imageFunction.method == ImageFunction::Method::LOAD)
+ {
+ OutputImageLoadFunctionBody(out, imageFunction, imageReference);
+ }
+ else
+ {
+ OutputImageStoreFunctionBody(out, imageFunction, imageReference);
+ }
+
+ out << "}\n"
+ "\n";
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.h b/gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.h
new file mode 100644
index 0000000000..56c1dcc8e0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ImageFunctionHLSL.h
@@ -0,0 +1,96 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ImageFunctionHLSL: Class for writing implementations of ESSL image functions into HLSL output.
+//
+
+#ifndef COMPILER_TRANSLATOR_IMAGEFUNCTIONHLSL_H_
+#define COMPILER_TRANSLATOR_IMAGEFUNCTIONHLSL_H_
+
+#include <set>
+
+#include "GLSLANG/ShaderLang.h"
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/Types.h"
+
+namespace sh
+{
+
+class ImageFunctionHLSL final : angle::NonCopyable
+{
+ public:
+ // Returns the name of the image function implementation to caller.
+ // The name that's passed in is the name of the GLSL image function that it should implement.
+ ImmutableString useImageFunction(const ImmutableString &name,
+ const TBasicType &type,
+ TLayoutImageInternalFormat imageInternalFormat,
+ bool readonly);
+
+ void imageFunctionHeader(TInfoSinkBase &out);
+ const std::set<std::string> &getUsedImage2DFunctionNames() const
+ {
+ return mUsedImage2DFunctionNames;
+ }
+
+ private:
+ struct ImageFunction
+ {
+ // See ESSL 3.10.4 section 8.12 for reference about what the different methods below do.
+ enum class Method
+ {
+ SIZE,
+ LOAD,
+ STORE
+ };
+
+ enum class DataType
+ {
+ NONE,
+ FLOAT4,
+ UINT4,
+ INT4,
+ UNORM_FLOAT4,
+ SNORM_FLOAT4
+ };
+
+ ImmutableString name() const;
+
+ bool operator<(const ImageFunction &rhs) const;
+
+ DataType getDataType(TLayoutImageInternalFormat format) const;
+
+ const char *getReturnType() const;
+
+ TBasicType image;
+ TLayoutImageInternalFormat imageInternalFormat;
+ bool readonly;
+ Method method;
+ DataType type;
+ };
+
+ static ImmutableString GetImageReference(TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction);
+ static void OutputImageFunctionArgumentList(
+ TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction);
+ static void OutputImageSizeFunctionBody(TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction,
+ const ImmutableString &imageReference);
+ static void OutputImageLoadFunctionBody(TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction,
+ const ImmutableString &imageReference);
+ static void OutputImageStoreFunctionBody(TInfoSinkBase &out,
+ const ImageFunctionHLSL::ImageFunction &imageFunction,
+ const ImmutableString &imageReference);
+ using ImageFunctionSet = std::set<ImageFunction>;
+ ImageFunctionSet mUsesImage;
+ std::set<std::string> mUsedImage2DFunctionNames;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_IMAGEFUNCTIONHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp b/gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp
new file mode 100644
index 0000000000..38f3fa052c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp
@@ -0,0 +1,69 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ImmutableString.cpp: Wrapper for static or pool allocated char arrays, that are guaranteed to be
+// valid and unchanged for the duration of the compilation.
+//
+
+#include "compiler/translator/ImmutableString.h"
+
+std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str)
+{
+ return os.write(str.data(), str.length());
+}
+
+#if defined(_MSC_VER)
+# pragma warning(disable : 4309) // truncation of constant value
+#endif
+
+namespace sh
+{
+
+template <>
+const size_t ImmutableString::FowlerNollVoHash<4>::kFnvPrime = 16777619u;
+
+template <>
+const size_t ImmutableString::FowlerNollVoHash<4>::kFnvOffsetBasis = 0x811c9dc5u;
+
+template <>
+const size_t ImmutableString::FowlerNollVoHash<8>::kFnvPrime =
+ static_cast<size_t>(1099511628211ull);
+
+template <>
+const size_t ImmutableString::FowlerNollVoHash<8>::kFnvOffsetBasis =
+ static_cast<size_t>(0xcbf29ce484222325ull);
+
+uint32_t ImmutableString::mangledNameHash() const
+{
+ const char *dataPtr = data();
+ uint32_t hash = static_cast<uint32_t>(FowlerNollVoHash<4>::kFnvOffsetBasis);
+ const uint32_t kMaxSixBitValue = (1u << 6) - 1u;
+ uint32_t parenLocation = kMaxSixBitValue;
+ uint32_t hasArrayOrBlockParamBit = 0u;
+ uint32_t index = 0;
+ while (dataPtr[index] != '\0')
+ {
+ hash = hash ^ dataPtr[index];
+ hash = hash * static_cast<uint32_t>(FowlerNollVoHash<4>::kFnvPrime);
+ if (dataPtr[index] == '(')
+ {
+ // We should only reach here once, since this function should not be called with invalid
+ // mangled names.
+ ASSERT(parenLocation == kMaxSixBitValue);
+ parenLocation = index;
+ }
+ else if (dataPtr[index] == '{' || dataPtr[index] == '[')
+ {
+ hasArrayOrBlockParamBit = 1u;
+ }
+ ++index;
+ }
+ // Should not be called with strings longer than 63 characters.
+ ASSERT(index <= kMaxSixBitValue);
+ return ((hash >> 13) ^ (hash & 0x1fff)) | (index << 19) | (parenLocation << 25) |
+ (hasArrayOrBlockParamBit << 31);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ImmutableString.h b/gfx/angle/checkout/src/compiler/translator/ImmutableString.h
new file mode 100644
index 0000000000..5f08ea06cc
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ImmutableString.h
@@ -0,0 +1,144 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ImmutableString.h: Wrapper for static or pool allocated char arrays, that are guaranteed to be
+// valid and unchanged for the duration of the compilation.
+//
+
+#ifndef COMPILER_TRANSLATOR_IMMUTABLESTRING_H_
+#define COMPILER_TRANSLATOR_IMMUTABLESTRING_H_
+
+#include <string>
+
+#include "common/string_utils.h"
+#include "compiler/translator/Common.h"
+
+namespace sh
+{
+
+namespace
+{
+constexpr size_t constStrlen(const char *str)
+{
+ if (str == nullptr)
+ {
+ return 0u;
+ }
+ size_t len = 0u;
+ while (*(str + len) != '\0')
+ {
+ ++len;
+ }
+ return len;
+}
+} // namespace
+
+class ImmutableString
+{
+ public:
+ // The data pointer passed in must be one of:
+ // 1. nullptr (only valid with length 0).
+ // 2. a null-terminated static char array like a string literal.
+ // 3. a null-terminated pool allocated char array. This can't be c_str() of a local TString,
+ // since when a TString goes out of scope it clears its first character.
+ explicit constexpr ImmutableString(const char *data) : mData(data), mLength(constStrlen(data))
+ {}
+
+ constexpr ImmutableString(const char *data, size_t length) : mData(data), mLength(length) {}
+
+ ImmutableString(const std::string &str)
+ : mData(AllocatePoolCharArray(str.c_str(), str.size())), mLength(str.size())
+ {}
+
+ constexpr ImmutableString(const ImmutableString &) = default;
+
+ ImmutableString &operator=(const ImmutableString &) = default;
+
+ constexpr const char *data() const { return mData ? mData : ""; }
+ constexpr size_t length() const { return mLength; }
+
+ char operator[](size_t index) const { return data()[index]; }
+
+ constexpr bool empty() const { return mLength == 0; }
+ bool beginsWith(const char *prefix) const { return angle::BeginsWith(data(), prefix); }
+ constexpr bool beginsWith(const ImmutableString &prefix) const
+ {
+ return mLength >= prefix.length() && memcmp(data(), prefix.data(), prefix.length()) == 0;
+ }
+ bool contains(const char *substr) const { return strstr(data(), substr) != nullptr; }
+
+ constexpr bool operator==(const ImmutableString &b) const
+ {
+ if (mLength != b.mLength)
+ {
+ return false;
+ }
+ return memcmp(data(), b.data(), mLength) == 0;
+ }
+ constexpr bool operator!=(const ImmutableString &b) const { return !(*this == b); }
+ constexpr bool operator==(const char *b) const
+ {
+ if (b == nullptr)
+ {
+ return empty();
+ }
+ return strcmp(data(), b) == 0;
+ }
+ constexpr bool operator!=(const char *b) const { return !(*this == b); }
+ bool operator==(const std::string &b) const
+ {
+ return mLength == b.length() && memcmp(data(), b.c_str(), mLength) == 0;
+ }
+ bool operator!=(const std::string &b) const { return !(*this == b); }
+
+ constexpr bool operator<(const ImmutableString &b) const
+ {
+ if (mLength < b.mLength)
+ {
+ return true;
+ }
+ if (mLength > b.mLength)
+ {
+ return false;
+ }
+ return (memcmp(data(), b.data(), mLength) < 0);
+ }
+
+ template <size_t hashBytes>
+ struct FowlerNollVoHash
+ {
+ static const size_t kFnvOffsetBasis;
+ static const size_t kFnvPrime;
+
+ constexpr size_t operator()(const ImmutableString &a) const
+ {
+ const char *data = a.data();
+ size_t hash = kFnvOffsetBasis;
+ while ((*data) != '\0')
+ {
+ hash = hash ^ (*data);
+ hash = hash * kFnvPrime;
+ ++data;
+ }
+ return hash;
+ }
+ };
+
+ // This hash encodes the opening parentheses location (if any), name length and whether the name
+ // contains { or [ characters in addition to a 19-bit hash. This way the hash is more useful for
+ // lookups. The string passed in should be at most 63 characters.
+ uint32_t mangledNameHash() const;
+
+ private:
+ const char *mData;
+ size_t mLength;
+};
+
+constexpr ImmutableString kEmptyImmutableString("");
+} // namespace sh
+
+std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str);
+
+#endif // COMPILER_TRANSLATOR_IMMUTABLESTRING_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.cpp b/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.cpp
new file mode 100644
index 0000000000..d7d0a0135d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.cpp
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ImmutableStringBuilder.cpp: Stringstream-like utility for building pool allocated strings where
+// the maximum length is known in advance.
+//
+
+#include "compiler/translator/ImmutableStringBuilder.h"
+
+#include <stdio.h>
+
+namespace sh
+{
+
+ImmutableStringBuilder &ImmutableStringBuilder::operator<<(const ImmutableString &str)
+{
+ ASSERT(mData != nullptr);
+ ASSERT(mPos + str.length() <= mMaxLength);
+ memcpy(mData + mPos, str.data(), str.length());
+ mPos += str.length();
+ return *this;
+}
+
+ImmutableStringBuilder &ImmutableStringBuilder::operator<<(const char *str)
+{
+ ASSERT(mData != nullptr);
+ size_t len = strlen(str);
+ ASSERT(mPos + len <= mMaxLength);
+ memcpy(mData + mPos, str, len);
+ mPos += len;
+ return *this;
+}
+
+ImmutableStringBuilder &ImmutableStringBuilder::operator<<(const char &c)
+{
+ ASSERT(mData != nullptr);
+ ASSERT(mPos + 1 <= mMaxLength);
+ mData[mPos++] = c;
+ return *this;
+}
+
+void ImmutableStringBuilder::appendDecimal(const uint32_t &u)
+{
+ int numChars = snprintf(mData + mPos, mMaxLength - mPos, "%d", u);
+ ASSERT(numChars >= 0);
+ ASSERT(mPos + numChars <= mMaxLength);
+ mPos += numChars;
+}
+
+ImmutableStringBuilder::operator ImmutableString()
+{
+ mData[mPos] = '\0';
+ ImmutableString str(static_cast<const char *>(mData), mPos);
+#if defined(ANGLE_ENABLE_ASSERTS)
+ // Make sure that nothing is added to the string after it is finalized.
+ mData = nullptr;
+#endif
+ return str;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h b/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h
new file mode 100644
index 0000000000..e68459169f
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ImmutableStringBuilder.h: Stringstream-like utility for building pool allocated strings where the
+// maximum length is known in advance.
+//
+
+#ifndef COMPILER_TRANSLATOR_IMMUTABLESTRINGBUILDER_H_
+#define COMPILER_TRANSLATOR_IMMUTABLESTRINGBUILDER_H_
+
+#include "compiler/translator/ImmutableString.h"
+
+namespace sh
+{
+
+class ImmutableStringBuilder
+{
+ public:
+ ImmutableStringBuilder(size_t maxLength)
+ : mPos(0u), mMaxLength(maxLength), mData(AllocateEmptyPoolCharArray(maxLength))
+ {}
+
+ ImmutableStringBuilder &operator<<(const ImmutableString &str);
+
+ ImmutableStringBuilder &operator<<(const char *str);
+
+ ImmutableStringBuilder &operator<<(const char &c);
+
+ // This invalidates the ImmutableStringBuilder, so it should only be called once.
+ operator ImmutableString();
+
+ void appendDecimal(const uint32_t &i);
+
+ template <typename T>
+ void appendHex(T number)
+ {
+ ASSERT(mData != nullptr);
+ ASSERT(mPos + sizeof(T) * 2u <= mMaxLength);
+ int index = static_cast<int>(sizeof(T)) * 2 - 1;
+ // Loop through leading zeroes.
+ while (((number >> (index * 4)) & 0xfu) == 0 && index > 0)
+ {
+ --index;
+ }
+ // Write the rest of the hex digits.
+ while (index >= 0)
+ {
+ char digit = static_cast<char>((number >> (index * 4)) & 0xfu);
+ char digitChar = (digit < 10) ? (digit + '0') : (digit + ('a' - 10));
+ mData[mPos++] = digitChar;
+ --index;
+ }
+ }
+
+ template <typename T>
+ static constexpr size_t GetHexCharCount()
+ {
+ return sizeof(T) * 2;
+ }
+
+ private:
+ inline static char *AllocateEmptyPoolCharArray(size_t strLength)
+ {
+ size_t requiredSize = strLength + 1u;
+ return static_cast<char *>(GetGlobalPoolAllocator()->allocate(requiredSize));
+ }
+
+ size_t mPos;
+ size_t mMaxLength;
+ char *mData;
+};
+
+// GLSL ES 3.00.6 section 3.9: the maximum length of an identifier is 1024 characters.
+constexpr unsigned int kESSLMaxIdentifierLength = 1024u;
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_IMMUTABLESTRINGBUILDER_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/InfoSink.cpp b/gfx/angle/checkout/src/compiler/translator/InfoSink.cpp
new file mode 100644
index 0000000000..e8a8453081
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/InfoSink.cpp
@@ -0,0 +1,82 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/InfoSink.h"
+
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/Types.h"
+
+namespace sh
+{
+
+void TInfoSinkBase::prefix(Severity severity)
+{
+ switch (severity)
+ {
+ case SH_WARNING:
+ sink.append("WARNING: ");
+ break;
+ case SH_ERROR:
+ sink.append("ERROR: ");
+ break;
+ default:
+ sink.append("UNKOWN ERROR: ");
+ break;
+ }
+}
+
+TInfoSinkBase &TInfoSinkBase::operator<<(const ImmutableString &str)
+{
+ sink.append(str.data());
+ return *this;
+}
+
+TInfoSinkBase &TInfoSinkBase::operator<<(const TType &type)
+{
+ if (type.isInvariant())
+ sink.append("invariant ");
+ if (type.getQualifier() != EvqTemporary && type.getQualifier() != EvqGlobal)
+ {
+ sink.append(type.getQualifierString());
+ sink.append(" ");
+ }
+ if (type.getPrecision() != EbpUndefined)
+ {
+ sink.append(type.getPrecisionString());
+ sink.append(" ");
+ }
+ if (type.isArray())
+ {
+ for (auto arraySizeIter = type.getArraySizes()->rbegin();
+ arraySizeIter != type.getArraySizes()->rend(); ++arraySizeIter)
+ {
+ *this << "array[" << (*arraySizeIter) << "] of ";
+ }
+ }
+ if (type.isMatrix())
+ {
+ *this << type.getCols() << "X" << type.getRows() << " matrix of ";
+ }
+ else if (type.isVector())
+ *this << type.getNominalSize() << "-component vector of ";
+
+ sink.append(type.getBasicString());
+ return *this;
+}
+
+void TInfoSinkBase::location(int file, int line)
+{
+ TPersistStringStream stream = sh::InitializeStream<TPersistStringStream>();
+ if (line)
+ stream << file << ":" << line;
+ else
+ stream << file << ":? ";
+ stream << ": ";
+
+ sink.append(stream.str());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/InfoSink.h b/gfx/angle/checkout/src/compiler/translator/InfoSink.h
new file mode 100644
index 0000000000..100d06ec6b
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/InfoSink.h
@@ -0,0 +1,129 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_INFOSINK_H_
+#define COMPILER_TRANSLATOR_INFOSINK_H_
+
+#include <math.h>
+#include <stdlib.h>
+#include "compiler/translator/Common.h"
+#include "compiler/translator/Severity.h"
+
+namespace sh
+{
+
+class ImmutableString;
+class TType;
+
+// Returns the fractional part of the given floating-point number.
+inline float fractionalPart(float f)
+{
+ float intPart = 0.0f;
+ return modff(f, &intPart);
+}
+
+class ImmutableString;
+
+//
+// Encapsulate info logs for all objects that have them.
+//
+// The methods are a general set of tools for getting a variety of
+// messages and types inserted into the log.
+//
+class TInfoSinkBase
+{
+ public:
+ TInfoSinkBase() {}
+
+ template <typename T>
+ TInfoSinkBase &operator<<(const T &t)
+ {
+ TPersistStringStream stream = sh::InitializeStream<TPersistStringStream>();
+ stream << t;
+ sink.append(stream.str());
+ return *this;
+ }
+ // Override << operator for specific types. It is faster to append strings
+ // and characters directly to the sink.
+ TInfoSinkBase &operator<<(char c)
+ {
+ sink.append(1, c);
+ return *this;
+ }
+ TInfoSinkBase &operator<<(const char *str)
+ {
+ sink.append(str);
+ return *this;
+ }
+ TInfoSinkBase &operator<<(const TPersistString &str)
+ {
+ sink.append(str);
+ return *this;
+ }
+ TInfoSinkBase &operator<<(const TString &str)
+ {
+ sink.append(str.c_str());
+ return *this;
+ }
+ TInfoSinkBase &operator<<(const ImmutableString &str);
+
+ TInfoSinkBase &operator<<(const TType &type);
+
+ // Make sure floats are written with correct precision.
+ TInfoSinkBase &operator<<(float f)
+ {
+ // Make sure that at least one decimal point is written. If a number
+ // does not have a fractional part, the default precision format does
+ // not write the decimal portion which gets interpreted as integer by
+ // the compiler.
+ TPersistStringStream stream = sh::InitializeStream<TPersistStringStream>();
+ if (fractionalPart(f) == 0.0f)
+ {
+ stream.precision(1);
+ stream << std::showpoint << std::fixed << f;
+ }
+ else
+ {
+ stream.unsetf(std::ios::fixed);
+ stream.unsetf(std::ios::scientific);
+ stream.precision(8);
+ stream << f;
+ }
+ sink.append(stream.str());
+ return *this;
+ }
+ // Write boolean values as their names instead of integral value.
+ TInfoSinkBase &operator<<(bool b)
+ {
+ const char *str = b ? "true" : "false";
+ sink.append(str);
+ return *this;
+ }
+
+ void erase() { sink.clear(); }
+ int size() { return static_cast<int>(sink.size()); }
+
+ const TPersistString &str() const { return sink; }
+ const char *c_str() const { return sink.c_str(); }
+
+ void prefix(Severity severity);
+ void location(int file, int line);
+
+ private:
+ TPersistString sink;
+};
+
+class TInfoSink
+{
+ public:
+ TInfoSinkBase info;
+ TInfoSinkBase debug;
+ TInfoSinkBase obj;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_INFOSINK_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Initialize.cpp b/gfx/angle/checkout/src/compiler/translator/Initialize.cpp
new file mode 100644
index 0000000000..eb3a7675a1
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Initialize.cpp
@@ -0,0 +1,117 @@
+//
+// 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/Initialize.h"
+
+namespace sh
+{
+
+void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavior &extBehavior)
+{
+ if (resources.OES_standard_derivatives)
+ {
+ extBehavior[TExtension::OES_standard_derivatives] = EBhUndefined;
+ }
+ if (resources.OES_EGL_image_external)
+ {
+ extBehavior[TExtension::OES_EGL_image_external] = EBhUndefined;
+ }
+ if (resources.OES_EGL_image_external_essl3)
+ {
+ extBehavior[TExtension::OES_EGL_image_external_essl3] = EBhUndefined;
+ }
+ if (resources.NV_EGL_stream_consumer_external)
+ {
+ extBehavior[TExtension::NV_EGL_stream_consumer_external] = EBhUndefined;
+ }
+ if (resources.ARB_texture_rectangle)
+ {
+ // Special: ARB_texture_rectangle extension does not follow the standard for #extension
+ // directives - it is enabled by default. An extension directive may still disable it.
+ extBehavior[TExtension::ARB_texture_rectangle] = EBhEnable;
+ }
+ if (resources.EXT_blend_func_extended)
+ {
+ extBehavior[TExtension::EXT_blend_func_extended] = EBhUndefined;
+ }
+ if (resources.EXT_draw_buffers)
+ {
+ extBehavior[TExtension::EXT_draw_buffers] = EBhUndefined;
+ }
+ if (resources.EXT_frag_depth)
+ {
+ extBehavior[TExtension::EXT_frag_depth] = EBhUndefined;
+ }
+ if (resources.EXT_shader_texture_lod)
+ {
+ extBehavior[TExtension::EXT_shader_texture_lod] = EBhUndefined;
+ }
+ if (resources.EXT_shader_framebuffer_fetch)
+ {
+ extBehavior[TExtension::EXT_shader_framebuffer_fetch] = EBhUndefined;
+ }
+ if (resources.NV_shader_framebuffer_fetch)
+ {
+ extBehavior[TExtension::NV_shader_framebuffer_fetch] = EBhUndefined;
+ }
+ if (resources.ARM_shader_framebuffer_fetch)
+ {
+ extBehavior[TExtension::ARM_shader_framebuffer_fetch] = EBhUndefined;
+ }
+ if (resources.OVR_multiview)
+ {
+ extBehavior[TExtension::OVR_multiview] = EBhUndefined;
+ }
+ if (resources.OVR_multiview2)
+ {
+ extBehavior[TExtension::OVR_multiview2] = EBhUndefined;
+ }
+ if (resources.EXT_YUV_target)
+ {
+ extBehavior[TExtension::EXT_YUV_target] = EBhUndefined;
+ }
+ if (resources.EXT_geometry_shader)
+ {
+ extBehavior[TExtension::EXT_geometry_shader] = EBhUndefined;
+ }
+ if (resources.OES_texture_storage_multisample_2d_array)
+ {
+ extBehavior[TExtension::OES_texture_storage_multisample_2d_array] = EBhUndefined;
+ }
+ if (resources.OES_texture_3D)
+ {
+ extBehavior[TExtension::OES_texture_3D] = EBhUndefined;
+ }
+ if (resources.ANGLE_texture_multisample)
+ {
+ extBehavior[TExtension::ANGLE_texture_multisample] = EBhUndefined;
+ }
+ if (resources.ANGLE_multi_draw)
+ {
+ extBehavior[TExtension::ANGLE_multi_draw] = EBhUndefined;
+ }
+ if (resources.ANGLE_base_vertex_base_instance)
+ {
+ extBehavior[TExtension::ANGLE_base_vertex_base_instance] = EBhUndefined;
+ }
+}
+
+void ResetExtensionBehavior(TExtensionBehavior &extBehavior)
+{
+ for (auto &ext : extBehavior)
+ {
+ if (ext.first == TExtension::ARB_texture_rectangle)
+ {
+ ext.second = EBhEnable;
+ }
+ else
+ {
+ ext.second = EBhUndefined;
+ }
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/Initialize.h b/gfx/angle/checkout/src/compiler/translator/Initialize.h
new file mode 100644
index 0000000000..290af56684
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Initialize.h
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_INITIALIZE_H_
+#define COMPILER_TRANSLATOR_INITIALIZE_H_
+
+#include "compiler/translator/Common.h"
+#include "compiler/translator/Compiler.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+void InitExtensionBehavior(const ShBuiltInResources &resources,
+ TExtensionBehavior &extensionBehavior);
+
+// Resets the behavior of the extensions listed in |extensionBehavior| to the
+// undefined state. These extensions will only be those initially supported in
+// the ShBuiltInResources object for this compiler instance. All other
+// extensions will remain unsupported.
+void ResetExtensionBehavior(TExtensionBehavior &extensionBehavior);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_INITIALIZE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/InitializeDll.cpp b/gfx/angle/checkout/src/compiler/translator/InitializeDll.cpp
new file mode 100644
index 0000000000..0698364500
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/InitializeDll.cpp
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/InitializeDll.h"
+#include "compiler/translator/InitializeGlobals.h"
+
+#include "common/platform.h"
+
+#include <assert.h>
+
+namespace sh
+{
+
+bool InitProcess()
+{
+ if (!InitializePoolIndex())
+ {
+ assert(0 && "InitProcess(): Failed to initalize global pool");
+ return false;
+ }
+
+ return true;
+}
+
+void DetachProcess()
+{
+ FreePoolIndex();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/InitializeDll.h b/gfx/angle/checkout/src/compiler/translator/InitializeDll.h
new file mode 100644
index 0000000000..87f7251470
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/InitializeDll.h
@@ -0,0 +1,15 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+#ifndef COMPILER_TRANSLATOR_INITIALIZEDLL_H_
+#define COMPILER_TRANSLATOR_INITIALIZEDLL_H_
+
+namespace sh
+{
+bool InitProcess();
+void DetachProcess();
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_INITIALIZEDLL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/InitializeGlobals.h b/gfx/angle/checkout/src/compiler/translator/InitializeGlobals.h
new file mode 100644
index 0000000000..9a67ed0e04
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/InitializeGlobals.h
@@ -0,0 +1,13 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
+#define COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
+
+bool InitializePoolIndex();
+void FreePoolIndex();
+
+#endif // COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNode.cpp b/gfx/angle/checkout/src/compiler/translator/IntermNode.cpp
new file mode 100644
index 0000000000..42c1c994cf
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/IntermNode.cpp
@@ -0,0 +1,3787 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Build the intermediate representation.
+//
+
+#include <float.h>
+#include <limits.h>
+#include <math.h>
+#include <stdlib.h>
+#include <algorithm>
+#include <vector>
+
+#include "common/mathutil.h"
+#include "common/matrix_utils.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+const float kPi = 3.14159265358979323846f;
+const float kDegreesToRadiansMultiplier = kPi / 180.0f;
+const float kRadiansToDegreesMultiplier = 180.0f / kPi;
+
+TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
+{
+ return left > right ? left : right;
+}
+
+TConstantUnion *Vectorize(const TConstantUnion &constant, size_t size)
+{
+ TConstantUnion *constUnion = new TConstantUnion[size];
+ for (unsigned int i = 0; i < size; ++i)
+ constUnion[i] = constant;
+
+ return constUnion;
+}
+
+void UndefinedConstantFoldingError(const TSourceLoc &loc,
+ TOperator op,
+ TBasicType basicType,
+ TDiagnostics *diagnostics,
+ TConstantUnion *result)
+{
+ diagnostics->warning(loc, "operation result is undefined for the values passed in",
+ GetOperatorString(op));
+
+ switch (basicType)
+ {
+ case EbtFloat:
+ result->setFConst(0.0f);
+ break;
+ case EbtInt:
+ result->setIConst(0);
+ break;
+ case EbtUInt:
+ result->setUConst(0u);
+ break;
+ case EbtBool:
+ result->setBConst(false);
+ break;
+ default:
+ break;
+ }
+}
+
+float VectorLength(const TConstantUnion *paramArray, size_t paramArraySize)
+{
+ float result = 0.0f;
+ for (size_t i = 0; i < paramArraySize; i++)
+ {
+ float f = paramArray[i].getFConst();
+ result += f * f;
+ }
+ return sqrtf(result);
+}
+
+float VectorDotProduct(const TConstantUnion *paramArray1,
+ const TConstantUnion *paramArray2,
+ size_t paramArraySize)
+{
+ float result = 0.0f;
+ for (size_t i = 0; i < paramArraySize; i++)
+ result += paramArray1[i].getFConst() * paramArray2[i].getFConst();
+ return result;
+}
+
+TIntermTyped *CreateFoldedNode(const TConstantUnion *constArray, const TIntermTyped *originalNode)
+{
+ ASSERT(constArray != nullptr);
+ // Note that we inherit whatever qualifier the folded node had. Nodes may be constant folded
+ // without being qualified as constant.
+ TIntermTyped *folded = new TIntermConstantUnion(constArray, originalNode->getType());
+ folded->setLine(originalNode->getLine());
+ return folded;
+}
+
+angle::Matrix<float> GetMatrix(const TConstantUnion *paramArray,
+ const unsigned int rows,
+ const unsigned int cols)
+{
+ std::vector<float> elements;
+ for (size_t i = 0; i < rows * cols; i++)
+ elements.push_back(paramArray[i].getFConst());
+ // Transpose is used since the Matrix constructor expects arguments in row-major order,
+ // whereas the paramArray is in column-major order. Rows/cols parameters are also flipped below
+ // so that the created matrix will have the expected dimensions after the transpose.
+ return angle::Matrix<float>(elements, cols, rows).transpose();
+}
+
+angle::Matrix<float> GetMatrix(const TConstantUnion *paramArray, const unsigned int size)
+{
+ std::vector<float> elements;
+ for (size_t i = 0; i < size * size; i++)
+ elements.push_back(paramArray[i].getFConst());
+ // Transpose is used since the Matrix constructor expects arguments in row-major order,
+ // whereas the paramArray is in column-major order.
+ return angle::Matrix<float>(elements, size).transpose();
+}
+
+void SetUnionArrayFromMatrix(const angle::Matrix<float> &m, TConstantUnion *resultArray)
+{
+ // Transpose is used since the input Matrix is in row-major order,
+ // whereas the actual result should be in column-major order.
+ angle::Matrix<float> result = m.transpose();
+ std::vector<float> resultElements = result.elements();
+ for (size_t i = 0; i < resultElements.size(); i++)
+ resultArray[i].setFConst(resultElements[i]);
+}
+
+bool CanFoldAggregateBuiltInOp(TOperator op)
+{
+ switch (op)
+ {
+ case EOpAtan:
+ case EOpPow:
+ case EOpMod:
+ case EOpMin:
+ case EOpMax:
+ case EOpClamp:
+ case EOpMix:
+ case EOpStep:
+ case EOpSmoothstep:
+ case EOpLdexp:
+ case EOpMulMatrixComponentWise:
+ case EOpOuterProduct:
+ case EOpEqualComponentWise:
+ case EOpNotEqualComponentWise:
+ case EOpLessThanComponentWise:
+ case EOpLessThanEqualComponentWise:
+ case EOpGreaterThanComponentWise:
+ case EOpGreaterThanEqualComponentWise:
+ case EOpDistance:
+ case EOpDot:
+ case EOpCross:
+ case EOpFaceforward:
+ case EOpReflect:
+ case EOpRefract:
+ case EOpBitfieldExtract:
+ case EOpBitfieldInsert:
+ return true;
+ default:
+ return false;
+ }
+}
+
+} // namespace
+
+////////////////////////////////////////////////////////////////
+//
+// Member functions of the nodes used for building the tree.
+//
+////////////////////////////////////////////////////////////////
+
+TIntermExpression::TIntermExpression(const TType &t) : TIntermTyped(), mType(t) {}
+
+void TIntermExpression::setTypePreservePrecision(const TType &t)
+{
+ TPrecision precision = getPrecision();
+ mType = t;
+ ASSERT(mType.getBasicType() != EbtBool || precision == EbpUndefined);
+ mType.setPrecision(precision);
+}
+
+#define REPLACE_IF_IS(node, type, original, replacement) \
+ do \
+ { \
+ if (node == original) \
+ { \
+ node = static_cast<type *>(replacement); \
+ return true; \
+ } \
+ } while (0)
+
+size_t TIntermSymbol::getChildCount() const
+{
+ return 0;
+}
+
+TIntermNode *TIntermSymbol::getChildNode(size_t index) const
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+size_t TIntermConstantUnion::getChildCount() const
+{
+ return 0;
+}
+
+TIntermNode *TIntermConstantUnion::getChildNode(size_t index) const
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+size_t TIntermLoop::getChildCount() const
+{
+ return (mInit ? 1 : 0) + (mCond ? 1 : 0) + (mExpr ? 1 : 0) + (mBody ? 1 : 0);
+}
+
+TIntermNode *TIntermLoop::getChildNode(size_t index) const
+{
+ TIntermNode *children[4];
+ unsigned int childIndex = 0;
+ if (mInit)
+ {
+ children[childIndex] = mInit;
+ ++childIndex;
+ }
+ if (mCond)
+ {
+ children[childIndex] = mCond;
+ ++childIndex;
+ }
+ if (mExpr)
+ {
+ children[childIndex] = mExpr;
+ ++childIndex;
+ }
+ if (mBody)
+ {
+ children[childIndex] = mBody;
+ ++childIndex;
+ }
+ ASSERT(index < childIndex);
+ return children[index];
+}
+
+bool TIntermLoop::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ ASSERT(original != nullptr); // This risks replacing multiple children.
+ REPLACE_IF_IS(mInit, TIntermNode, original, replacement);
+ REPLACE_IF_IS(mCond, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mExpr, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mBody, TIntermBlock, original, replacement);
+ return false;
+}
+
+size_t TIntermBranch::getChildCount() const
+{
+ return (mExpression ? 1 : 0);
+}
+
+TIntermNode *TIntermBranch::getChildNode(size_t index) const
+{
+ ASSERT(mExpression);
+ ASSERT(index == 0);
+ return mExpression;
+}
+
+bool TIntermBranch::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mExpression, TIntermTyped, original, replacement);
+ return false;
+}
+
+size_t TIntermSwizzle::getChildCount() const
+{
+ return 1;
+}
+
+TIntermNode *TIntermSwizzle::getChildNode(size_t index) const
+{
+ ASSERT(mOperand);
+ ASSERT(index == 0);
+ return mOperand;
+}
+
+bool TIntermSwizzle::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ ASSERT(original->getAsTyped()->getType() == replacement->getAsTyped()->getType());
+ REPLACE_IF_IS(mOperand, TIntermTyped, original, replacement);
+ return false;
+}
+
+size_t TIntermBinary::getChildCount() const
+{
+ return 2;
+}
+
+TIntermNode *TIntermBinary::getChildNode(size_t index) const
+{
+ ASSERT(index < 2);
+ if (index == 0)
+ {
+ return mLeft;
+ }
+ return mRight;
+}
+
+bool TIntermBinary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mLeft, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mRight, TIntermTyped, original, replacement);
+ return false;
+}
+
+size_t TIntermUnary::getChildCount() const
+{
+ return 1;
+}
+
+TIntermNode *TIntermUnary::getChildNode(size_t index) const
+{
+ ASSERT(mOperand);
+ ASSERT(index == 0);
+ return mOperand;
+}
+
+bool TIntermUnary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ ASSERT(original->getAsTyped()->getType() == replacement->getAsTyped()->getType());
+ REPLACE_IF_IS(mOperand, TIntermTyped, original, replacement);
+ return false;
+}
+
+size_t TIntermInvariantDeclaration::getChildCount() const
+{
+ return 1;
+}
+
+TIntermNode *TIntermInvariantDeclaration::getChildNode(size_t index) const
+{
+ ASSERT(mSymbol);
+ ASSERT(index == 0);
+ return mSymbol;
+}
+
+bool TIntermInvariantDeclaration::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mSymbol, TIntermSymbol, original, replacement);
+ return false;
+}
+
+size_t TIntermFunctionDefinition::getChildCount() const
+{
+ return 2;
+}
+
+TIntermNode *TIntermFunctionDefinition::getChildNode(size_t index) const
+{
+ ASSERT(index < 2);
+ if (index == 0)
+ {
+ return mPrototype;
+ }
+ return mBody;
+}
+
+bool TIntermFunctionDefinition::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mPrototype, TIntermFunctionPrototype, original, replacement);
+ REPLACE_IF_IS(mBody, TIntermBlock, original, replacement);
+ return false;
+}
+
+size_t TIntermAggregate::getChildCount() const
+{
+ return mArguments.size();
+}
+
+TIntermNode *TIntermAggregate::getChildNode(size_t index) const
+{
+ return mArguments[index];
+}
+
+bool TIntermAggregate::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ return replaceChildNodeInternal(original, replacement);
+}
+
+size_t TIntermBlock::getChildCount() const
+{
+ return mStatements.size();
+}
+
+TIntermNode *TIntermBlock::getChildNode(size_t index) const
+{
+ return mStatements[index];
+}
+
+bool TIntermBlock::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ return replaceChildNodeInternal(original, replacement);
+}
+
+size_t TIntermFunctionPrototype::getChildCount() const
+{
+ return 0;
+}
+
+TIntermNode *TIntermFunctionPrototype::getChildNode(size_t index) const
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+bool TIntermFunctionPrototype::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ return false;
+}
+
+size_t TIntermDeclaration::getChildCount() const
+{
+ return mDeclarators.size();
+}
+
+TIntermNode *TIntermDeclaration::getChildNode(size_t index) const
+{
+ return mDeclarators[index];
+}
+
+bool TIntermDeclaration::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ return replaceChildNodeInternal(original, replacement);
+}
+
+bool TIntermAggregateBase::replaceChildNodeInternal(TIntermNode *original, TIntermNode *replacement)
+{
+ for (size_t ii = 0; ii < getSequence()->size(); ++ii)
+ {
+ REPLACE_IF_IS((*getSequence())[ii], TIntermNode, original, replacement);
+ }
+ return false;
+}
+
+bool TIntermAggregateBase::replaceChildNodeWithMultiple(TIntermNode *original,
+ const TIntermSequence &replacements)
+{
+ for (auto it = getSequence()->begin(); it < getSequence()->end(); ++it)
+ {
+ if (*it == original)
+ {
+ it = getSequence()->erase(it);
+ getSequence()->insert(it, replacements.begin(), replacements.end());
+ return true;
+ }
+ }
+ return false;
+}
+
+bool TIntermAggregateBase::insertChildNodes(TIntermSequence::size_type position,
+ const TIntermSequence &insertions)
+{
+ if (position > getSequence()->size())
+ {
+ return false;
+ }
+ auto it = getSequence()->begin() + position;
+ getSequence()->insert(it, insertions.begin(), insertions.end());
+ return true;
+}
+
+TIntermSymbol::TIntermSymbol(const TVariable *variable) : TIntermTyped(), mVariable(variable) {}
+
+bool TIntermSymbol::hasConstantValue() const
+{
+ return variable().getConstPointer() != nullptr;
+}
+
+const TConstantUnion *TIntermSymbol::getConstantValue() const
+{
+ return variable().getConstPointer();
+}
+
+const TSymbolUniqueId &TIntermSymbol::uniqueId() const
+{
+ return mVariable->uniqueId();
+}
+
+ImmutableString TIntermSymbol::getName() const
+{
+ return mVariable->name();
+}
+
+const TType &TIntermSymbol::getType() const
+{
+ return mVariable->getType();
+}
+
+TIntermAggregate *TIntermAggregate::CreateFunctionCall(const TFunction &func,
+ TIntermSequence *arguments)
+{
+ return new TIntermAggregate(&func, func.getReturnType(), EOpCallFunctionInAST, arguments);
+}
+
+TIntermAggregate *TIntermAggregate::CreateRawFunctionCall(const TFunction &func,
+ TIntermSequence *arguments)
+{
+ return new TIntermAggregate(&func, func.getReturnType(), EOpCallInternalRawFunction, arguments);
+}
+
+TIntermAggregate *TIntermAggregate::CreateBuiltInFunctionCall(const TFunction &func,
+ TIntermSequence *arguments)
+{
+ // op should be either EOpCallBuiltInFunction or a specific math op.
+ ASSERT(func.getBuiltInOp() != EOpNull);
+ return new TIntermAggregate(&func, func.getReturnType(), func.getBuiltInOp(), arguments);
+}
+
+TIntermAggregate *TIntermAggregate::CreateConstructor(const TType &type, TIntermSequence *arguments)
+{
+ return new TIntermAggregate(nullptr, type, EOpConstruct, arguments);
+}
+
+TIntermAggregate::TIntermAggregate(const TFunction *func,
+ const TType &type,
+ TOperator op,
+ TIntermSequence *arguments)
+ : TIntermOperator(op, type),
+ mUseEmulatedFunction(false),
+ mGotPrecisionFromChildren(false),
+ mFunction(func)
+{
+ if (arguments != nullptr)
+ {
+ mArguments.swap(*arguments);
+ }
+ ASSERT(mFunction == nullptr || mFunction->symbolType() != SymbolType::Empty);
+ setPrecisionAndQualifier();
+}
+
+void TIntermAggregate::setPrecisionAndQualifier()
+{
+ mType.setQualifier(EvqTemporary);
+ if (mOp == EOpCallBuiltInFunction)
+ {
+ setBuiltInFunctionPrecision();
+ }
+ else if (!isFunctionCall())
+ {
+ if (isConstructor())
+ {
+ // Structs should not be precision qualified, the individual members may be.
+ // Built-in types on the other hand should be precision qualified.
+ if (getBasicType() != EbtStruct)
+ {
+ setPrecisionFromChildren();
+ }
+ }
+ else
+ {
+ setPrecisionForBuiltInOp();
+ }
+ if (areChildrenConstQualified())
+ {
+ mType.setQualifier(EvqConst);
+ }
+ }
+}
+
+bool TIntermAggregate::areChildrenConstQualified()
+{
+ for (TIntermNode *&arg : mArguments)
+ {
+ TIntermTyped *typedArg = arg->getAsTyped();
+ if (typedArg && typedArg->getQualifier() != EvqConst)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+void TIntermAggregate::setPrecisionFromChildren()
+{
+ mGotPrecisionFromChildren = true;
+ if (getBasicType() == EbtBool)
+ {
+ mType.setPrecision(EbpUndefined);
+ return;
+ }
+
+ TPrecision precision = EbpUndefined;
+ TIntermSequence::iterator childIter = mArguments.begin();
+ while (childIter != mArguments.end())
+ {
+ TIntermTyped *typed = (*childIter)->getAsTyped();
+ if (typed)
+ precision = GetHigherPrecision(typed->getPrecision(), precision);
+ ++childIter;
+ }
+ mType.setPrecision(precision);
+}
+
+void TIntermAggregate::setPrecisionForBuiltInOp()
+{
+ ASSERT(!isConstructor());
+ ASSERT(!isFunctionCall());
+ if (!setPrecisionForSpecialBuiltInOp())
+ {
+ setPrecisionFromChildren();
+ }
+}
+
+bool TIntermAggregate::setPrecisionForSpecialBuiltInOp()
+{
+ switch (mOp)
+ {
+ case EOpBitfieldExtract:
+ mType.setPrecision(mArguments[0]->getAsTyped()->getPrecision());
+ mGotPrecisionFromChildren = true;
+ return true;
+ case EOpBitfieldInsert:
+ mType.setPrecision(GetHigherPrecision(mArguments[0]->getAsTyped()->getPrecision(),
+ mArguments[1]->getAsTyped()->getPrecision()));
+ mGotPrecisionFromChildren = true;
+ return true;
+ case EOpUaddCarry:
+ case EOpUsubBorrow:
+ mType.setPrecision(EbpHigh);
+ return true;
+ default:
+ return false;
+ }
+}
+
+void TIntermAggregate::setBuiltInFunctionPrecision()
+{
+ // All built-ins returning bool should be handled as ops, not functions.
+ ASSERT(getBasicType() != EbtBool);
+ ASSERT(mOp == EOpCallBuiltInFunction);
+
+ TPrecision precision = EbpUndefined;
+ for (TIntermNode *arg : mArguments)
+ {
+ TIntermTyped *typed = arg->getAsTyped();
+ // ESSL spec section 8: texture functions get their precision from the sampler.
+ if (typed && IsSampler(typed->getBasicType()))
+ {
+ precision = typed->getPrecision();
+ break;
+ }
+ }
+ // ESSL 3.0 spec section 8: textureSize always gets highp precision.
+ // All other functions that take a sampler are assumed to be texture functions.
+ if (mFunction->name() == "textureSize")
+ mType.setPrecision(EbpHigh);
+ else
+ mType.setPrecision(precision);
+}
+
+const char *TIntermAggregate::functionName() const
+{
+ ASSERT(!isConstructor());
+ switch (mOp)
+ {
+ case EOpCallInternalRawFunction:
+ case EOpCallBuiltInFunction:
+ case EOpCallFunctionInAST:
+ return mFunction->name().data();
+ default:
+ return GetOperatorString(mOp);
+ }
+}
+
+bool TIntermAggregate::hasConstantValue() const
+{
+ if (!isConstructor())
+ {
+ return false;
+ }
+ for (TIntermNode *constructorArg : mArguments)
+ {
+ if (!constructorArg->getAsTyped()->hasConstantValue())
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+const TConstantUnion *TIntermAggregate::getConstantValue() const
+{
+ if (!hasConstantValue())
+ {
+ return nullptr;
+ }
+ ASSERT(isConstructor());
+ ASSERT(mArguments.size() > 0u);
+
+ TConstantUnion *constArray = nullptr;
+ if (isArray())
+ {
+ size_t elementSize = mArguments.front()->getAsTyped()->getType().getObjectSize();
+ constArray = new TConstantUnion[elementSize * getOutermostArraySize()];
+
+ size_t elementOffset = 0u;
+ for (TIntermNode *constructorArg : mArguments)
+ {
+ const TConstantUnion *elementConstArray =
+ constructorArg->getAsTyped()->getConstantValue();
+ ASSERT(elementConstArray);
+ size_t elementSizeBytes = sizeof(TConstantUnion) * elementSize;
+ memcpy(static_cast<void *>(&constArray[elementOffset]),
+ static_cast<const void *>(elementConstArray), elementSizeBytes);
+ elementOffset += elementSize;
+ }
+ return constArray;
+ }
+
+ size_t resultSize = getType().getObjectSize();
+ constArray = new TConstantUnion[resultSize];
+ TBasicType basicType = getBasicType();
+
+ size_t resultIndex = 0u;
+
+ if (mArguments.size() == 1u)
+ {
+ TIntermNode *argument = mArguments.front();
+ TIntermTyped *argumentTyped = argument->getAsTyped();
+ const TConstantUnion *argumentConstantValue = argumentTyped->getConstantValue();
+ // Check the special case of constructing a matrix diagonal from a single scalar,
+ // or a vector from a single scalar.
+ if (argumentTyped->getType().getObjectSize() == 1u)
+ {
+ if (isMatrix())
+ {
+ int resultCols = getType().getCols();
+ int resultRows = getType().getRows();
+ for (int col = 0; col < resultCols; ++col)
+ {
+ for (int row = 0; row < resultRows; ++row)
+ {
+ if (col == row)
+ {
+ constArray[resultIndex].cast(basicType, argumentConstantValue[0]);
+ }
+ else
+ {
+ constArray[resultIndex].setFConst(0.0f);
+ }
+ ++resultIndex;
+ }
+ }
+ }
+ else
+ {
+ while (resultIndex < resultSize)
+ {
+ constArray[resultIndex].cast(basicType, argumentConstantValue[0]);
+ ++resultIndex;
+ }
+ }
+ ASSERT(resultIndex == resultSize);
+ return constArray;
+ }
+ else if (isMatrix() && argumentTyped->isMatrix())
+ {
+ // The special case of constructing a matrix from a matrix.
+ int argumentCols = argumentTyped->getType().getCols();
+ int argumentRows = argumentTyped->getType().getRows();
+ int resultCols = getType().getCols();
+ int resultRows = getType().getRows();
+ for (int col = 0; col < resultCols; ++col)
+ {
+ for (int row = 0; row < resultRows; ++row)
+ {
+ if (col < argumentCols && row < argumentRows)
+ {
+ constArray[resultIndex].cast(
+ basicType, argumentConstantValue[col * argumentRows + row]);
+ }
+ else if (col == row)
+ {
+ constArray[resultIndex].setFConst(1.0f);
+ }
+ else
+ {
+ constArray[resultIndex].setFConst(0.0f);
+ }
+ ++resultIndex;
+ }
+ }
+ ASSERT(resultIndex == resultSize);
+ return constArray;
+ }
+ }
+
+ for (TIntermNode *argument : mArguments)
+ {
+ TIntermTyped *argumentTyped = argument->getAsTyped();
+ size_t argumentSize = argumentTyped->getType().getObjectSize();
+ const TConstantUnion *argumentConstantValue = argumentTyped->getConstantValue();
+ for (size_t i = 0u; i < argumentSize; ++i)
+ {
+ if (resultIndex >= resultSize)
+ break;
+ constArray[resultIndex].cast(basicType, argumentConstantValue[i]);
+ ++resultIndex;
+ }
+ }
+ ASSERT(resultIndex == resultSize);
+ return constArray;
+}
+
+bool TIntermAggregate::hasSideEffects() const
+{
+ if (getQualifier() == EvqConst)
+ {
+ return false;
+ }
+ bool calledFunctionHasNoSideEffects =
+ isFunctionCall() && mFunction != nullptr && mFunction->isKnownToNotHaveSideEffects();
+ if (calledFunctionHasNoSideEffects || isConstructor())
+ {
+ for (TIntermNode *arg : mArguments)
+ {
+ if (arg->getAsTyped()->hasSideEffects())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ // Conservatively assume most aggregate operators have side-effects
+ return true;
+}
+
+void TIntermBlock::appendStatement(TIntermNode *statement)
+{
+ // Declaration nodes with no children can appear if it was an empty declaration or if all the
+ // declarators just added constants to the symbol table instead of generating code. We still
+ // need to add the declaration to the AST in that case because it might be relevant to the
+ // validity of switch/case.
+ if (statement != nullptr)
+ {
+ mStatements.push_back(statement);
+ }
+}
+
+void TIntermBlock::insertStatement(size_t insertPosition, TIntermNode *statement)
+{
+ ASSERT(statement != nullptr);
+ mStatements.insert(mStatements.begin() + insertPosition, statement);
+}
+
+void TIntermDeclaration::appendDeclarator(TIntermTyped *declarator)
+{
+ ASSERT(declarator != nullptr);
+ ASSERT(declarator->getAsSymbolNode() != nullptr ||
+ (declarator->getAsBinaryNode() != nullptr &&
+ declarator->getAsBinaryNode()->getOp() == EOpInitialize));
+ ASSERT(mDeclarators.empty() ||
+ declarator->getType().sameNonArrayType(mDeclarators.back()->getAsTyped()->getType()));
+ mDeclarators.push_back(declarator);
+}
+
+size_t TIntermTernary::getChildCount() const
+{
+ return 3;
+}
+
+TIntermNode *TIntermTernary::getChildNode(size_t index) const
+{
+ ASSERT(index < 3);
+ if (index == 0)
+ {
+ return mCondition;
+ }
+ if (index == 1)
+ {
+ return mTrueExpression;
+ }
+ return mFalseExpression;
+}
+
+bool TIntermTernary::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mTrueExpression, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mFalseExpression, TIntermTyped, original, replacement);
+ return false;
+}
+
+size_t TIntermIfElse::getChildCount() const
+{
+ return 1 + (mTrueBlock ? 1 : 0) + (mFalseBlock ? 1 : 0);
+}
+
+TIntermNode *TIntermIfElse::getChildNode(size_t index) const
+{
+ if (index == 0)
+ {
+ return mCondition;
+ }
+ if (mTrueBlock && index == 1)
+ {
+ return mTrueBlock;
+ }
+ return mFalseBlock;
+}
+
+bool TIntermIfElse::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mTrueBlock, TIntermBlock, original, replacement);
+ REPLACE_IF_IS(mFalseBlock, TIntermBlock, original, replacement);
+ return false;
+}
+
+size_t TIntermSwitch::getChildCount() const
+{
+ return 2;
+}
+
+TIntermNode *TIntermSwitch::getChildNode(size_t index) const
+{
+ ASSERT(index < 2);
+ if (index == 0)
+ {
+ return mInit;
+ }
+ return mStatementList;
+}
+
+bool TIntermSwitch::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mInit, TIntermTyped, original, replacement);
+ REPLACE_IF_IS(mStatementList, TIntermBlock, original, replacement);
+ ASSERT(mStatementList);
+ return false;
+}
+
+size_t TIntermCase::getChildCount() const
+{
+ return (mCondition ? 1 : 0);
+}
+
+TIntermNode *TIntermCase::getChildNode(size_t index) const
+{
+ ASSERT(index == 0);
+ ASSERT(mCondition);
+ return mCondition;
+}
+
+bool TIntermCase::replaceChildNode(TIntermNode *original, TIntermNode *replacement)
+{
+ REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
+ return false;
+}
+
+TIntermTyped::TIntermTyped(const TIntermTyped &node) : TIntermNode()
+{
+ // Copy constructor is disallowed for TIntermNode in order to disallow it for subclasses that
+ // don't explicitly allow it, so normal TIntermNode constructor is used to construct the copy.
+ // We need to manually copy any fields of TIntermNode.
+ mLine = node.mLine;
+}
+
+bool TIntermTyped::hasConstantValue() const
+{
+ return false;
+}
+
+const TConstantUnion *TIntermTyped::getConstantValue() const
+{
+ return nullptr;
+}
+
+TIntermConstantUnion::TIntermConstantUnion(const TIntermConstantUnion &node)
+ : TIntermExpression(node)
+{
+ mUnionArrayPointer = node.mUnionArrayPointer;
+}
+
+TIntermFunctionPrototype::TIntermFunctionPrototype(const TFunction *function)
+ : TIntermTyped(), mFunction(function)
+{
+ ASSERT(mFunction->symbolType() != SymbolType::Empty);
+}
+
+const TType &TIntermFunctionPrototype::getType() const
+{
+ return mFunction->getReturnType();
+}
+
+TIntermAggregate::TIntermAggregate(const TIntermAggregate &node)
+ : TIntermOperator(node),
+ mUseEmulatedFunction(node.mUseEmulatedFunction),
+ mGotPrecisionFromChildren(node.mGotPrecisionFromChildren),
+ mFunction(node.mFunction)
+{
+ for (TIntermNode *arg : node.mArguments)
+ {
+ TIntermTyped *typedArg = arg->getAsTyped();
+ ASSERT(typedArg != nullptr);
+ TIntermTyped *argCopy = typedArg->deepCopy();
+ mArguments.push_back(argCopy);
+ }
+}
+
+TIntermAggregate *TIntermAggregate::shallowCopy() const
+{
+ TIntermSequence *copySeq = new TIntermSequence();
+ copySeq->insert(copySeq->begin(), getSequence()->begin(), getSequence()->end());
+ TIntermAggregate *copyNode = new TIntermAggregate(mFunction, mType, mOp, copySeq);
+ copyNode->setLine(mLine);
+ return copyNode;
+}
+
+TIntermSwizzle::TIntermSwizzle(const TIntermSwizzle &node) : TIntermExpression(node)
+{
+ TIntermTyped *operandCopy = node.mOperand->deepCopy();
+ ASSERT(operandCopy != nullptr);
+ mOperand = operandCopy;
+ mSwizzleOffsets = node.mSwizzleOffsets;
+ mHasFoldedDuplicateOffsets = node.mHasFoldedDuplicateOffsets;
+}
+
+TIntermBinary::TIntermBinary(const TIntermBinary &node)
+ : TIntermOperator(node), mAddIndexClamp(node.mAddIndexClamp)
+{
+ TIntermTyped *leftCopy = node.mLeft->deepCopy();
+ TIntermTyped *rightCopy = node.mRight->deepCopy();
+ ASSERT(leftCopy != nullptr && rightCopy != nullptr);
+ mLeft = leftCopy;
+ mRight = rightCopy;
+}
+
+TIntermUnary::TIntermUnary(const TIntermUnary &node)
+ : TIntermOperator(node),
+ mUseEmulatedFunction(node.mUseEmulatedFunction),
+ mFunction(node.mFunction)
+{
+ TIntermTyped *operandCopy = node.mOperand->deepCopy();
+ ASSERT(operandCopy != nullptr);
+ mOperand = operandCopy;
+}
+
+TIntermTernary::TIntermTernary(const TIntermTernary &node) : TIntermExpression(node)
+{
+ TIntermTyped *conditionCopy = node.mCondition->deepCopy();
+ TIntermTyped *trueCopy = node.mTrueExpression->deepCopy();
+ TIntermTyped *falseCopy = node.mFalseExpression->deepCopy();
+ ASSERT(conditionCopy != nullptr && trueCopy != nullptr && falseCopy != nullptr);
+ mCondition = conditionCopy;
+ mTrueExpression = trueCopy;
+ mFalseExpression = falseCopy;
+}
+
+bool TIntermOperator::isAssignment() const
+{
+ return IsAssignment(mOp);
+}
+
+bool TIntermOperator::isMultiplication() const
+{
+ switch (mOp)
+ {
+ case EOpMul:
+ case EOpMatrixTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpVectorTimesScalar:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool TIntermOperator::isConstructor() const
+{
+ return (mOp == EOpConstruct);
+}
+
+bool TIntermOperator::isFunctionCall() const
+{
+ switch (mOp)
+ {
+ case EOpCallFunctionInAST:
+ case EOpCallBuiltInFunction:
+ case EOpCallInternalRawFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+
+TOperator TIntermBinary::GetMulOpBasedOnOperands(const TType &left, const TType &right)
+{
+ if (left.isMatrix())
+ {
+ if (right.isMatrix())
+ {
+ return EOpMatrixTimesMatrix;
+ }
+ else
+ {
+ if (right.isVector())
+ {
+ return EOpMatrixTimesVector;
+ }
+ else
+ {
+ return EOpMatrixTimesScalar;
+ }
+ }
+ }
+ else
+ {
+ if (right.isMatrix())
+ {
+ if (left.isVector())
+ {
+ return EOpVectorTimesMatrix;
+ }
+ else
+ {
+ return EOpMatrixTimesScalar;
+ }
+ }
+ else
+ {
+ // Neither operand is a matrix.
+ if (left.isVector() == right.isVector())
+ {
+ // Leave as component product.
+ return EOpMul;
+ }
+ else
+ {
+ return EOpVectorTimesScalar;
+ }
+ }
+ }
+}
+
+TOperator TIntermBinary::GetMulAssignOpBasedOnOperands(const TType &left, const TType &right)
+{
+ if (left.isMatrix())
+ {
+ if (right.isMatrix())
+ {
+ return EOpMatrixTimesMatrixAssign;
+ }
+ else
+ {
+ // right should be scalar, but this may not be validated yet.
+ return EOpMatrixTimesScalarAssign;
+ }
+ }
+ else
+ {
+ if (right.isMatrix())
+ {
+ // Left should be a vector, but this may not be validated yet.
+ return EOpVectorTimesMatrixAssign;
+ }
+ else
+ {
+ // Neither operand is a matrix.
+ if (left.isVector() == right.isVector())
+ {
+ // Leave as component product.
+ return EOpMulAssign;
+ }
+ else
+ {
+ // left should be vector and right should be scalar, but this may not be validated
+ // yet.
+ return EOpVectorTimesScalarAssign;
+ }
+ }
+ }
+}
+
+//
+// Make sure the type of a unary operator is appropriate for its
+// combination of operation and operand type.
+//
+void TIntermUnary::promote()
+{
+ if (mOp == EOpArrayLength)
+ {
+ // Special case: the qualifier of .length() doesn't depend on the operand qualifier.
+ setType(TType(EbtInt, EbpUndefined, EvqConst));
+ return;
+ }
+
+ TQualifier resultQualifier = EvqTemporary;
+ if (mOperand->getQualifier() == EvqConst)
+ resultQualifier = EvqConst;
+
+ unsigned char operandPrimarySize =
+ static_cast<unsigned char>(mOperand->getType().getNominalSize());
+ switch (mOp)
+ {
+ case EOpFloatBitsToInt:
+ setType(TType(EbtInt, EbpHigh, resultQualifier, operandPrimarySize));
+ break;
+ case EOpFloatBitsToUint:
+ setType(TType(EbtUInt, EbpHigh, resultQualifier, operandPrimarySize));
+ break;
+ case EOpIntBitsToFloat:
+ case EOpUintBitsToFloat:
+ setType(TType(EbtFloat, EbpHigh, resultQualifier, operandPrimarySize));
+ break;
+ case EOpPackSnorm2x16:
+ case EOpPackUnorm2x16:
+ case EOpPackHalf2x16:
+ case EOpPackUnorm4x8:
+ case EOpPackSnorm4x8:
+ setType(TType(EbtUInt, EbpHigh, resultQualifier));
+ break;
+ case EOpUnpackSnorm2x16:
+ case EOpUnpackUnorm2x16:
+ setType(TType(EbtFloat, EbpHigh, resultQualifier, 2));
+ break;
+ case EOpUnpackHalf2x16:
+ setType(TType(EbtFloat, EbpMedium, resultQualifier, 2));
+ break;
+ case EOpUnpackUnorm4x8:
+ case EOpUnpackSnorm4x8:
+ setType(TType(EbtFloat, EbpMedium, resultQualifier, 4));
+ break;
+ case EOpAny:
+ case EOpAll:
+ setType(TType(EbtBool, EbpUndefined, resultQualifier));
+ break;
+ case EOpLength:
+ case EOpDeterminant:
+ setType(TType(EbtFloat, mOperand->getType().getPrecision(), resultQualifier));
+ break;
+ case EOpTranspose:
+ setType(TType(EbtFloat, mOperand->getType().getPrecision(), resultQualifier,
+ static_cast<unsigned char>(mOperand->getType().getRows()),
+ static_cast<unsigned char>(mOperand->getType().getCols())));
+ break;
+ case EOpIsinf:
+ case EOpIsnan:
+ setType(TType(EbtBool, EbpUndefined, resultQualifier, operandPrimarySize));
+ break;
+ case EOpBitfieldReverse:
+ setType(TType(mOperand->getBasicType(), EbpHigh, resultQualifier, operandPrimarySize));
+ break;
+ case EOpBitCount:
+ setType(TType(EbtInt, EbpLow, resultQualifier, operandPrimarySize));
+ break;
+ case EOpFindLSB:
+ setType(TType(EbtInt, EbpLow, resultQualifier, operandPrimarySize));
+ break;
+ case EOpFindMSB:
+ setType(TType(EbtInt, EbpLow, resultQualifier, operandPrimarySize));
+ break;
+ default:
+ setType(mOperand->getType());
+ mType.setQualifier(resultQualifier);
+ break;
+ }
+}
+
+TIntermSwizzle::TIntermSwizzle(TIntermTyped *operand, const TVector<int> &swizzleOffsets)
+ : TIntermExpression(TType(EbtFloat, EbpUndefined)),
+ mOperand(operand),
+ mSwizzleOffsets(swizzleOffsets),
+ mHasFoldedDuplicateOffsets(false)
+{
+ ASSERT(mOperand);
+ ASSERT(mSwizzleOffsets.size() <= 4);
+ promote();
+}
+
+TIntermUnary::TIntermUnary(TOperator op, TIntermTyped *operand, const TFunction *function)
+ : TIntermOperator(op), mOperand(operand), mUseEmulatedFunction(false), mFunction(function)
+{
+ ASSERT(mOperand);
+ promote();
+}
+
+TIntermBinary::TIntermBinary(TOperator op, TIntermTyped *left, TIntermTyped *right)
+ : TIntermOperator(op), mLeft(left), mRight(right), mAddIndexClamp(false)
+{
+ ASSERT(mLeft);
+ ASSERT(mRight);
+ promote();
+}
+
+TIntermBinary *TIntermBinary::CreateComma(TIntermTyped *left,
+ TIntermTyped *right,
+ int shaderVersion)
+{
+ TIntermBinary *node = new TIntermBinary(EOpComma, left, right);
+ node->getTypePointer()->setQualifier(GetCommaQualifier(shaderVersion, left, right));
+ return node;
+}
+
+TIntermInvariantDeclaration::TIntermInvariantDeclaration(TIntermSymbol *symbol,
+ const TSourceLoc &line)
+ : TIntermNode(), mSymbol(symbol)
+{
+ ASSERT(symbol);
+ setLine(line);
+}
+
+TIntermTernary::TIntermTernary(TIntermTyped *cond,
+ TIntermTyped *trueExpression,
+ TIntermTyped *falseExpression)
+ : TIntermExpression(trueExpression->getType()),
+ mCondition(cond),
+ mTrueExpression(trueExpression),
+ mFalseExpression(falseExpression)
+{
+ ASSERT(mCondition);
+ ASSERT(mTrueExpression);
+ ASSERT(mFalseExpression);
+ getTypePointer()->setQualifier(
+ TIntermTernary::DetermineQualifier(cond, trueExpression, falseExpression));
+}
+
+TIntermLoop::TIntermLoop(TLoopType type,
+ TIntermNode *init,
+ TIntermTyped *cond,
+ TIntermTyped *expr,
+ TIntermBlock *body)
+ : mType(type), mInit(init), mCond(cond), mExpr(expr), mBody(body)
+{
+ // Declaration nodes with no children can appear if all the declarators just added constants to
+ // the symbol table instead of generating code. They're no-ops so don't add them to the tree.
+ if (mInit && mInit->getAsDeclarationNode() &&
+ mInit->getAsDeclarationNode()->getSequence()->empty())
+ {
+ mInit = nullptr;
+ }
+}
+
+TIntermIfElse::TIntermIfElse(TIntermTyped *cond, TIntermBlock *trueB, TIntermBlock *falseB)
+ : TIntermNode(), mCondition(cond), mTrueBlock(trueB), mFalseBlock(falseB)
+{
+ ASSERT(mCondition);
+ // Prune empty false blocks so that there won't be unnecessary operations done on it.
+ if (mFalseBlock && mFalseBlock->getSequence()->empty())
+ {
+ mFalseBlock = nullptr;
+ }
+}
+
+TIntermSwitch::TIntermSwitch(TIntermTyped *init, TIntermBlock *statementList)
+ : TIntermNode(), mInit(init), mStatementList(statementList)
+{
+ ASSERT(mInit);
+ ASSERT(mStatementList);
+}
+
+void TIntermSwitch::setStatementList(TIntermBlock *statementList)
+{
+ ASSERT(statementList);
+ mStatementList = statementList;
+}
+
+// static
+TQualifier TIntermTernary::DetermineQualifier(TIntermTyped *cond,
+ TIntermTyped *trueExpression,
+ TIntermTyped *falseExpression)
+{
+ if (cond->getQualifier() == EvqConst && trueExpression->getQualifier() == EvqConst &&
+ falseExpression->getQualifier() == EvqConst)
+ {
+ return EvqConst;
+ }
+ return EvqTemporary;
+}
+
+TIntermTyped *TIntermTernary::fold(TDiagnostics * /* diagnostics */)
+{
+ if (mCondition->getAsConstantUnion())
+ {
+ if (mCondition->getAsConstantUnion()->getBConst(0))
+ {
+ return mTrueExpression;
+ }
+ else
+ {
+ return mFalseExpression;
+ }
+ }
+ return this;
+}
+
+void TIntermSwizzle::promote()
+{
+ TQualifier resultQualifier = EvqTemporary;
+ if (mOperand->getQualifier() == EvqConst)
+ resultQualifier = EvqConst;
+
+ auto numFields = mSwizzleOffsets.size();
+ setType(TType(mOperand->getBasicType(), mOperand->getPrecision(), resultQualifier,
+ static_cast<unsigned char>(numFields)));
+}
+
+bool TIntermSwizzle::hasDuplicateOffsets() const
+{
+ if (mHasFoldedDuplicateOffsets)
+ {
+ return true;
+ }
+ int offsetCount[4] = {0u, 0u, 0u, 0u};
+ for (const auto offset : mSwizzleOffsets)
+ {
+ offsetCount[offset]++;
+ if (offsetCount[offset] > 1)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+void TIntermSwizzle::setHasFoldedDuplicateOffsets(bool hasFoldedDuplicateOffsets)
+{
+ mHasFoldedDuplicateOffsets = hasFoldedDuplicateOffsets;
+}
+
+bool TIntermSwizzle::offsetsMatch(int offset) const
+{
+ return mSwizzleOffsets.size() == 1 && mSwizzleOffsets[0] == offset;
+}
+
+void TIntermSwizzle::writeOffsetsAsXYZW(TInfoSinkBase *out) const
+{
+ for (const int offset : mSwizzleOffsets)
+ {
+ switch (offset)
+ {
+ case 0:
+ *out << "x";
+ break;
+ case 1:
+ *out << "y";
+ break;
+ case 2:
+ *out << "z";
+ break;
+ case 3:
+ *out << "w";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+}
+
+TQualifier TIntermBinary::GetCommaQualifier(int shaderVersion,
+ const TIntermTyped *left,
+ const TIntermTyped *right)
+{
+ // ESSL3.00 section 12.43: The result of a sequence operator is not a constant-expression.
+ if (shaderVersion >= 300 || left->getQualifier() != EvqConst ||
+ right->getQualifier() != EvqConst)
+ {
+ return EvqTemporary;
+ }
+ return EvqConst;
+}
+
+// Establishes the type of the result of the binary operation.
+void TIntermBinary::promote()
+{
+ ASSERT(!isMultiplication() ||
+ mOp == GetMulOpBasedOnOperands(mLeft->getType(), mRight->getType()));
+
+ // Comma is handled as a special case. Note that the comma node qualifier depends on the shader
+ // version and so is not being set here.
+ if (mOp == EOpComma)
+ {
+ setType(mRight->getType());
+ return;
+ }
+
+ // Base assumption: just make the type the same as the left
+ // operand. Then only deviations from this need be coded.
+ setType(mLeft->getType());
+
+ TQualifier resultQualifier = EvqConst;
+ // Binary operations results in temporary variables unless both
+ // operands are const.
+ if (mLeft->getQualifier() != EvqConst || mRight->getQualifier() != EvqConst)
+ {
+ resultQualifier = EvqTemporary;
+ getTypePointer()->setQualifier(EvqTemporary);
+ }
+
+ // Handle indexing ops.
+ switch (mOp)
+ {
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ if (mLeft->isArray())
+ {
+ mType.toArrayElementType();
+ }
+ else if (mLeft->isMatrix())
+ {
+ setType(TType(mLeft->getBasicType(), mLeft->getPrecision(), resultQualifier,
+ static_cast<unsigned char>(mLeft->getRows())));
+ }
+ else if (mLeft->isVector())
+ {
+ setType(TType(mLeft->getBasicType(), mLeft->getPrecision(), resultQualifier));
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ return;
+ case EOpIndexDirectStruct:
+ {
+ const TFieldList &fields = mLeft->getType().getStruct()->fields();
+ const int i = mRight->getAsConstantUnion()->getIConst(0);
+ setType(*fields[i]->type());
+ getTypePointer()->setQualifier(resultQualifier);
+ return;
+ }
+ case EOpIndexDirectInterfaceBlock:
+ {
+ const TFieldList &fields = mLeft->getType().getInterfaceBlock()->fields();
+ const int i = mRight->getAsConstantUnion()->getIConst(0);
+ setType(*fields[i]->type());
+ getTypePointer()->setQualifier(resultQualifier);
+ return;
+ }
+ default:
+ break;
+ }
+
+ ASSERT(mLeft->isArray() == mRight->isArray());
+
+ // The result gets promoted to the highest precision.
+ TPrecision higherPrecision = GetHigherPrecision(mLeft->getPrecision(), mRight->getPrecision());
+ getTypePointer()->setPrecision(higherPrecision);
+
+ const int nominalSize = std::max(mLeft->getNominalSize(), mRight->getNominalSize());
+
+ //
+ // All scalars or structs. Code after this test assumes this case is removed!
+ //
+ if (nominalSize == 1)
+ {
+ switch (mOp)
+ {
+ //
+ // Promote to conditional
+ //
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ setType(TType(EbtBool, EbpUndefined, resultQualifier));
+ break;
+
+ //
+ // And and Or operate on conditionals
+ //
+ case EOpLogicalAnd:
+ case EOpLogicalXor:
+ case EOpLogicalOr:
+ ASSERT(mLeft->getBasicType() == EbtBool && mRight->getBasicType() == EbtBool);
+ setType(TType(EbtBool, EbpUndefined, resultQualifier));
+ break;
+
+ default:
+ break;
+ }
+ return;
+ }
+
+ // If we reach here, at least one of the operands is vector or matrix.
+ // The other operand could be a scalar, vector, or matrix.
+ TBasicType basicType = mLeft->getBasicType();
+
+ switch (mOp)
+ {
+ case EOpMul:
+ break;
+ case EOpMatrixTimesScalar:
+ if (mRight->isMatrix())
+ {
+ setType(TType(basicType, higherPrecision, resultQualifier,
+ static_cast<unsigned char>(mRight->getCols()),
+ static_cast<unsigned char>(mRight->getRows())));
+ }
+ break;
+ case EOpMatrixTimesVector:
+ setType(TType(basicType, higherPrecision, resultQualifier,
+ static_cast<unsigned char>(mLeft->getRows()), 1));
+ break;
+ case EOpMatrixTimesMatrix:
+ setType(TType(basicType, higherPrecision, resultQualifier,
+ static_cast<unsigned char>(mRight->getCols()),
+ static_cast<unsigned char>(mLeft->getRows())));
+ break;
+ case EOpVectorTimesScalar:
+ setType(TType(basicType, higherPrecision, resultQualifier,
+ static_cast<unsigned char>(nominalSize), 1));
+ break;
+ case EOpVectorTimesMatrix:
+ setType(TType(basicType, higherPrecision, resultQualifier,
+ static_cast<unsigned char>(mRight->getCols()), 1));
+ break;
+ case EOpMulAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ ASSERT(mOp == GetMulAssignOpBasedOnOperands(mLeft->getType(), mRight->getType()));
+ break;
+ case EOpAssign:
+ case EOpInitialize:
+ ASSERT((mLeft->getNominalSize() == mRight->getNominalSize()) &&
+ (mLeft->getSecondarySize() == mRight->getSecondarySize()));
+ break;
+ case EOpAdd:
+ case EOpSub:
+ case EOpDiv:
+ case EOpIMod:
+ case EOpBitShiftLeft:
+ case EOpBitShiftRight:
+ case EOpBitwiseAnd:
+ case EOpBitwiseXor:
+ case EOpBitwiseOr:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpDivAssign:
+ case EOpIModAssign:
+ case EOpBitShiftLeftAssign:
+ case EOpBitShiftRightAssign:
+ case EOpBitwiseAndAssign:
+ case EOpBitwiseXorAssign:
+ case EOpBitwiseOrAssign:
+ {
+ const int secondarySize =
+ std::max(mLeft->getSecondarySize(), mRight->getSecondarySize());
+ setType(TType(basicType, higherPrecision, resultQualifier,
+ static_cast<unsigned char>(nominalSize),
+ static_cast<unsigned char>(secondarySize)));
+ ASSERT(!mLeft->isArray() && !mRight->isArray());
+ break;
+ }
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ ASSERT((mLeft->getNominalSize() == mRight->getNominalSize()) &&
+ (mLeft->getSecondarySize() == mRight->getSecondarySize()));
+ setType(TType(EbtBool, EbpUndefined, resultQualifier));
+ break;
+
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ case EOpIndexDirectInterfaceBlock:
+ case EOpIndexDirectStruct:
+ // These ops should be already fully handled.
+ UNREACHABLE();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+bool TIntermConstantUnion::hasConstantValue() const
+{
+ return true;
+}
+
+const TConstantUnion *TIntermConstantUnion::getConstantValue() const
+{
+ return mUnionArrayPointer;
+}
+
+const TConstantUnion *TIntermConstantUnion::FoldIndexing(const TType &type,
+ const TConstantUnion *constArray,
+ int index)
+{
+ if (type.isArray())
+ {
+ ASSERT(index < static_cast<int>(type.getOutermostArraySize()));
+ TType arrayElementType(type);
+ arrayElementType.toArrayElementType();
+ size_t arrayElementSize = arrayElementType.getObjectSize();
+ return &constArray[arrayElementSize * index];
+ }
+ else if (type.isMatrix())
+ {
+ ASSERT(index < type.getCols());
+ int size = type.getRows();
+ return &constArray[size * index];
+ }
+ else if (type.isVector())
+ {
+ ASSERT(index < type.getNominalSize());
+ return &constArray[index];
+ }
+ else
+ {
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+TIntermTyped *TIntermSwizzle::fold(TDiagnostics * /* diagnostics */)
+{
+ TIntermSwizzle *operandSwizzle = mOperand->getAsSwizzleNode();
+ if (operandSwizzle)
+ {
+ // We need to fold the two swizzles into one, so that repeated swizzling can't cause stack
+ // overflow in ParseContext::checkCanBeLValue().
+ bool hadDuplicateOffsets = operandSwizzle->hasDuplicateOffsets();
+ TVector<int> foldedOffsets;
+ for (int offset : mSwizzleOffsets)
+ {
+ // Offset should already be validated.
+ ASSERT(static_cast<size_t>(offset) < operandSwizzle->mSwizzleOffsets.size());
+ foldedOffsets.push_back(operandSwizzle->mSwizzleOffsets[offset]);
+ }
+ operandSwizzle->mSwizzleOffsets = foldedOffsets;
+ operandSwizzle->setType(getType());
+ operandSwizzle->setHasFoldedDuplicateOffsets(hadDuplicateOffsets);
+ return operandSwizzle;
+ }
+ TIntermConstantUnion *operandConstant = mOperand->getAsConstantUnion();
+ if (operandConstant == nullptr)
+ {
+ return this;
+ }
+
+ TConstantUnion *constArray = new TConstantUnion[mSwizzleOffsets.size()];
+ for (size_t i = 0; i < mSwizzleOffsets.size(); ++i)
+ {
+ constArray[i] = *TIntermConstantUnion::FoldIndexing(
+ operandConstant->getType(), operandConstant->getConstantValue(), mSwizzleOffsets.at(i));
+ }
+ return CreateFoldedNode(constArray, this);
+}
+
+TIntermTyped *TIntermBinary::fold(TDiagnostics *diagnostics)
+{
+ const TConstantUnion *rightConstant = mRight->getConstantValue();
+ switch (mOp)
+ {
+ case EOpComma:
+ {
+ if (mLeft->hasSideEffects())
+ {
+ return this;
+ }
+ return mRight;
+ }
+ case EOpIndexDirect:
+ case EOpIndexDirectStruct:
+ {
+ if (rightConstant == nullptr)
+ {
+ return this;
+ }
+ size_t index = static_cast<size_t>(rightConstant->getIConst());
+ TIntermAggregate *leftAggregate = mLeft->getAsAggregate();
+ if (leftAggregate && leftAggregate->isConstructor() && leftAggregate->isArray() &&
+ !leftAggregate->hasSideEffects())
+ {
+ ASSERT(index < leftAggregate->getSequence()->size());
+ // This transformation can't add complexity as we're eliminating the constructor
+ // entirely.
+ return leftAggregate->getSequence()->at(index)->getAsTyped();
+ }
+
+ // If the indexed value is already a constant union, we can't increase duplication of
+ // data by folding the indexing. Also fold the node in case it's generally beneficial to
+ // replace this type of node with a constant union even if that would mean duplicating
+ // data.
+ if (mLeft->getAsConstantUnion() || getType().canReplaceWithConstantUnion())
+ {
+ const TConstantUnion *constantValue = getConstantValue();
+ if (constantValue == nullptr)
+ {
+ return this;
+ }
+ return CreateFoldedNode(constantValue, this);
+ }
+ return this;
+ }
+ case EOpIndexIndirect:
+ case EOpIndexDirectInterfaceBlock:
+ case EOpInitialize:
+ // Can never be constant folded.
+ return this;
+ default:
+ {
+ if (rightConstant == nullptr)
+ {
+ return this;
+ }
+ const TConstantUnion *leftConstant = mLeft->getConstantValue();
+ if (leftConstant == nullptr)
+ {
+ return this;
+ }
+ const TConstantUnion *constArray =
+ TIntermConstantUnion::FoldBinary(mOp, leftConstant, mLeft->getType(), rightConstant,
+ mRight->getType(), diagnostics, mLeft->getLine());
+ if (!constArray)
+ {
+ return this;
+ }
+ return CreateFoldedNode(constArray, this);
+ }
+ }
+}
+
+bool TIntermBinary::hasConstantValue() const
+{
+ switch (mOp)
+ {
+ case EOpIndexDirect:
+ case EOpIndexDirectStruct:
+ {
+ if (mLeft->hasConstantValue() && mRight->hasConstantValue())
+ {
+ return true;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return false;
+}
+
+const TConstantUnion *TIntermBinary::getConstantValue() const
+{
+ if (!hasConstantValue())
+ {
+ return nullptr;
+ }
+
+ const TConstantUnion *leftConstantValue = mLeft->getConstantValue();
+ int index = mRight->getConstantValue()->getIConst();
+ const TConstantUnion *constIndexingResult = nullptr;
+ if (mOp == EOpIndexDirect)
+ {
+ constIndexingResult =
+ TIntermConstantUnion::FoldIndexing(mLeft->getType(), leftConstantValue, index);
+ }
+ else
+ {
+ ASSERT(mOp == EOpIndexDirectStruct);
+ const TFieldList &fields = mLeft->getType().getStruct()->fields();
+
+ size_t previousFieldsSize = 0;
+ for (int i = 0; i < index; ++i)
+ {
+ previousFieldsSize += fields[i]->type()->getObjectSize();
+ }
+ constIndexingResult = leftConstantValue + previousFieldsSize;
+ }
+ return constIndexingResult;
+}
+
+const ImmutableString &TIntermBinary::getIndexStructFieldName() const
+{
+ ASSERT(mOp == EOpIndexDirectStruct);
+
+ const TType &lhsType = mLeft->getType();
+ const TStructure *structure = lhsType.getStruct();
+ const int index = mRight->getAsConstantUnion()->getIConst(0);
+
+ return structure->fields()[index]->name();
+}
+
+TIntermTyped *TIntermUnary::fold(TDiagnostics *diagnostics)
+{
+ TConstantUnion *constArray = nullptr;
+
+ if (mOp == EOpArrayLength)
+ {
+ // The size of runtime-sized arrays may only be determined at runtime.
+ if (mOperand->hasSideEffects() || mOperand->getType().isUnsizedArray())
+ {
+ return this;
+ }
+ constArray = new TConstantUnion[1];
+ constArray->setIConst(mOperand->getOutermostArraySize());
+ }
+ else
+ {
+ TIntermConstantUnion *operandConstant = mOperand->getAsConstantUnion();
+ if (operandConstant == nullptr)
+ {
+ return this;
+ }
+
+ switch (mOp)
+ {
+ case EOpAny:
+ case EOpAll:
+ case EOpLength:
+ case EOpTranspose:
+ case EOpDeterminant:
+ case EOpInverse:
+ case EOpPackSnorm2x16:
+ case EOpUnpackSnorm2x16:
+ case EOpPackUnorm2x16:
+ case EOpUnpackUnorm2x16:
+ case EOpPackHalf2x16:
+ case EOpUnpackHalf2x16:
+ case EOpPackUnorm4x8:
+ case EOpPackSnorm4x8:
+ case EOpUnpackUnorm4x8:
+ case EOpUnpackSnorm4x8:
+ constArray = operandConstant->foldUnaryNonComponentWise(mOp);
+ break;
+ default:
+ constArray = operandConstant->foldUnaryComponentWise(mOp, diagnostics);
+ break;
+ }
+ }
+ if (constArray == nullptr)
+ {
+ return this;
+ }
+ return CreateFoldedNode(constArray, this);
+}
+
+TIntermTyped *TIntermAggregate::fold(TDiagnostics *diagnostics)
+{
+ // Make sure that all params are constant before actual constant folding.
+ for (auto *param : *getSequence())
+ {
+ if (param->getAsConstantUnion() == nullptr)
+ {
+ return this;
+ }
+ }
+ const TConstantUnion *constArray = nullptr;
+ if (isConstructor())
+ {
+ if (mType.canReplaceWithConstantUnion())
+ {
+ constArray = getConstantValue();
+ if (constArray && mType.getBasicType() == EbtUInt)
+ {
+ // Check if we converted a negative float to uint and issue a warning in that case.
+ size_t sizeRemaining = mType.getObjectSize();
+ for (TIntermNode *arg : mArguments)
+ {
+ TIntermTyped *typedArg = arg->getAsTyped();
+ if (typedArg->getBasicType() == EbtFloat)
+ {
+ const TConstantUnion *argValue = typedArg->getConstantValue();
+ size_t castSize =
+ std::min(typedArg->getType().getObjectSize(), sizeRemaining);
+ for (size_t i = 0; i < castSize; ++i)
+ {
+ if (argValue[i].getFConst() < 0.0f)
+ {
+ // ESSL 3.00.6 section 5.4.1.
+ diagnostics->warning(
+ mLine, "casting a negative float to uint is undefined",
+ mType.getBuiltInTypeNameString());
+ }
+ }
+ }
+ sizeRemaining -= typedArg->getType().getObjectSize();
+ }
+ }
+ }
+ }
+ else if (CanFoldAggregateBuiltInOp(mOp))
+ {
+ constArray = TIntermConstantUnion::FoldAggregateBuiltIn(this, diagnostics);
+ }
+ if (constArray == nullptr)
+ {
+ return this;
+ }
+ return CreateFoldedNode(constArray, this);
+}
+
+//
+// The fold functions see if an operation on a constant can be done in place,
+// without generating run-time code.
+//
+// Returns the constant value to keep using or nullptr.
+//
+const TConstantUnion *TIntermConstantUnion::FoldBinary(TOperator op,
+ const TConstantUnion *leftArray,
+ const TType &leftType,
+ const TConstantUnion *rightArray,
+ const TType &rightType,
+ TDiagnostics *diagnostics,
+ const TSourceLoc &line)
+{
+ ASSERT(leftArray && rightArray);
+
+ size_t objectSize = leftType.getObjectSize();
+
+ // for a case like float f = vec4(2, 3, 4, 5) + 1.2;
+ if (rightType.getObjectSize() == 1 && objectSize > 1)
+ {
+ rightArray = Vectorize(*rightArray, objectSize);
+ }
+ else if (rightType.getObjectSize() > 1 && objectSize == 1)
+ {
+ // for a case like float f = 1.2 + vec4(2, 3, 4, 5);
+ leftArray = Vectorize(*leftArray, rightType.getObjectSize());
+ objectSize = rightType.getObjectSize();
+ }
+
+ TConstantUnion *resultArray = nullptr;
+
+ switch (op)
+ {
+ case EOpAdd:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] =
+ TConstantUnion::add(leftArray[i], rightArray[i], diagnostics, line);
+ break;
+ case EOpSub:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] =
+ TConstantUnion::sub(leftArray[i], rightArray[i], diagnostics, line);
+ break;
+
+ case EOpMul:
+ case EOpVectorTimesScalar:
+ case EOpMatrixTimesScalar:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] =
+ TConstantUnion::mul(leftArray[i], rightArray[i], diagnostics, line);
+ break;
+
+ case EOpMatrixTimesMatrix:
+ {
+ // TODO(jmadll): This code should check for overflows.
+ ASSERT(leftType.getBasicType() == EbtFloat && rightType.getBasicType() == EbtFloat);
+
+ const int leftCols = leftType.getCols();
+ const int leftRows = leftType.getRows();
+ const int rightCols = rightType.getCols();
+ const int rightRows = rightType.getRows();
+ const int resultCols = rightCols;
+ const int resultRows = leftRows;
+
+ resultArray = new TConstantUnion[resultCols * resultRows];
+ for (int row = 0; row < resultRows; row++)
+ {
+ for (int column = 0; column < resultCols; column++)
+ {
+ resultArray[resultRows * column + row].setFConst(0.0f);
+ for (int i = 0; i < leftCols; i++)
+ {
+ resultArray[resultRows * column + row].setFConst(
+ resultArray[resultRows * column + row].getFConst() +
+ leftArray[i * leftRows + row].getFConst() *
+ rightArray[column * rightRows + i].getFConst());
+ }
+ }
+ }
+ }
+ break;
+
+ case EOpDiv:
+ case EOpIMod:
+ {
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (IsFloatDivision(leftType.getBasicType(), rightType.getBasicType()))
+ {
+ // Float division requested, possibly with implicit conversion
+ ASSERT(op == EOpDiv);
+ float dividend = leftArray[i].getFConst();
+ float divisor = rightArray[i].getFConst();
+
+ if (divisor == 0.0f)
+ {
+ if (dividend == 0.0f)
+ {
+ diagnostics->warning(line,
+ "Zero divided by zero during constant "
+ "folding generated NaN",
+ "/");
+ resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
+ }
+ else
+ {
+ diagnostics->warning(line, "Divide by zero during constant folding",
+ "/");
+ bool negativeResult = std::signbit(dividend) != std::signbit(divisor);
+ resultArray[i].setFConst(negativeResult
+ ? -std::numeric_limits<float>::infinity()
+ : std::numeric_limits<float>::infinity());
+ }
+ }
+ else if (gl::isInf(dividend) && gl::isInf(divisor))
+ {
+ diagnostics->warning(line,
+ "Infinity divided by infinity during constant "
+ "folding generated NaN",
+ "/");
+ resultArray[i].setFConst(std::numeric_limits<float>::quiet_NaN());
+ }
+ else
+ {
+ float result = dividend / divisor;
+ if (!gl::isInf(dividend) && gl::isInf(result))
+ {
+ diagnostics->warning(
+ line, "Constant folded division overflowed to infinity", "/");
+ }
+ resultArray[i].setFConst(result);
+ }
+ }
+ else
+ {
+ // Types are either both int or both uint
+ switch (leftType.getBasicType())
+ {
+ case EbtInt:
+ {
+ if (rightArray[i] == 0)
+ {
+ diagnostics->warning(
+ line, "Divide by zero error during constant folding", "/");
+ resultArray[i].setIConst(INT_MAX);
+ }
+ else
+ {
+ int lhs = leftArray[i].getIConst();
+ int divisor = rightArray[i].getIConst();
+ if (op == EOpDiv)
+ {
+ // Check for the special case where the minimum
+ // representable number is divided by -1. If left alone this
+ // leads to integer overflow in C++. ESSL 3.00.6
+ // section 4.1.3 Integers: "However, for the case where the
+ // minimum representable value is divided by -1, it is
+ // allowed to return either the minimum representable value
+ // or the maximum representable value."
+ if (lhs == -0x7fffffff - 1 && divisor == -1)
+ {
+ resultArray[i].setIConst(0x7fffffff);
+ }
+ else
+ {
+ resultArray[i].setIConst(lhs / divisor);
+ }
+ }
+ else
+ {
+ ASSERT(op == EOpIMod);
+ if (lhs < 0 || divisor < 0)
+ {
+ // ESSL 3.00.6 section 5.9: Results of modulus are
+ // undefined when either one of the operands is
+ // negative.
+ diagnostics->warning(line,
+ "Negative modulus operator operand "
+ "encountered during constant folding. "
+ "Results are undefined.",
+ "%");
+ resultArray[i].setIConst(0);
+ }
+ else
+ {
+ resultArray[i].setIConst(lhs % divisor);
+ }
+ }
+ }
+ break;
+ }
+ case EbtUInt:
+ {
+ if (rightArray[i] == 0)
+ {
+ diagnostics->warning(
+ line, "Divide by zero error during constant folding", "/");
+ resultArray[i].setUConst(UINT_MAX);
+ }
+ else
+ {
+ if (op == EOpDiv)
+ {
+ resultArray[i].setUConst(leftArray[i].getUConst() /
+ rightArray[i].getUConst());
+ }
+ else
+ {
+ ASSERT(op == EOpIMod);
+ resultArray[i].setUConst(leftArray[i].getUConst() %
+ rightArray[i].getUConst());
+ }
+ }
+ break;
+ }
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ }
+ }
+ }
+ break;
+
+ case EOpMatrixTimesVector:
+ {
+ // TODO(jmadll): This code should check for overflows.
+ ASSERT(rightType.getBasicType() == EbtFloat);
+
+ const int matrixCols = leftType.getCols();
+ const int matrixRows = leftType.getRows();
+
+ resultArray = new TConstantUnion[matrixRows];
+
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ resultArray[matrixRow].setFConst(0.0f);
+ for (int col = 0; col < matrixCols; col++)
+ {
+ resultArray[matrixRow].setFConst(
+ resultArray[matrixRow].getFConst() +
+ leftArray[col * matrixRows + matrixRow].getFConst() *
+ rightArray[col].getFConst());
+ }
+ }
+ }
+ break;
+
+ case EOpVectorTimesMatrix:
+ {
+ // TODO(jmadll): This code should check for overflows.
+ ASSERT(leftType.getBasicType() == EbtFloat);
+
+ const int matrixCols = rightType.getCols();
+ const int matrixRows = rightType.getRows();
+
+ resultArray = new TConstantUnion[matrixCols];
+
+ for (int matrixCol = 0; matrixCol < matrixCols; matrixCol++)
+ {
+ resultArray[matrixCol].setFConst(0.0f);
+ for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
+ {
+ resultArray[matrixCol].setFConst(
+ resultArray[matrixCol].getFConst() +
+ leftArray[matrixRow].getFConst() *
+ rightArray[matrixCol * matrixRows + matrixRow].getFConst());
+ }
+ }
+ }
+ break;
+
+ case EOpLogicalAnd:
+ {
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ resultArray[i] = leftArray[i] && rightArray[i];
+ }
+ }
+ break;
+
+ case EOpLogicalOr:
+ {
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ resultArray[i] = leftArray[i] || rightArray[i];
+ }
+ }
+ break;
+
+ case EOpLogicalXor:
+ {
+ ASSERT(leftType.getBasicType() == EbtBool);
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ resultArray[i].setBConst(leftArray[i] != rightArray[i]);
+ }
+ }
+ break;
+
+ case EOpBitwiseAnd:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] = leftArray[i] & rightArray[i];
+ break;
+ case EOpBitwiseXor:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] = leftArray[i] ^ rightArray[i];
+ break;
+ case EOpBitwiseOr:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] = leftArray[i] | rightArray[i];
+ break;
+ case EOpBitShiftLeft:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] =
+ TConstantUnion::lshift(leftArray[i], rightArray[i], diagnostics, line);
+ break;
+ case EOpBitShiftRight:
+ resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ resultArray[i] =
+ TConstantUnion::rshift(leftArray[i], rightArray[i], diagnostics, line);
+ break;
+
+ case EOpLessThan:
+ ASSERT(objectSize == 1);
+ resultArray = new TConstantUnion[1];
+ resultArray->setBConst(*leftArray < *rightArray);
+ break;
+
+ case EOpGreaterThan:
+ ASSERT(objectSize == 1);
+ resultArray = new TConstantUnion[1];
+ resultArray->setBConst(*leftArray > *rightArray);
+ break;
+
+ case EOpLessThanEqual:
+ ASSERT(objectSize == 1);
+ resultArray = new TConstantUnion[1];
+ resultArray->setBConst(!(*leftArray > *rightArray));
+ break;
+
+ case EOpGreaterThanEqual:
+ ASSERT(objectSize == 1);
+ resultArray = new TConstantUnion[1];
+ resultArray->setBConst(!(*leftArray < *rightArray));
+ break;
+
+ case EOpEqual:
+ case EOpNotEqual:
+ {
+ resultArray = new TConstantUnion[1];
+ bool equal = true;
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (leftArray[i] != rightArray[i])
+ {
+ equal = false;
+ break; // break out of for loop
+ }
+ }
+ if (op == EOpEqual)
+ {
+ resultArray->setBConst(equal);
+ }
+ else
+ {
+ resultArray->setBConst(!equal);
+ }
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ return resultArray;
+}
+
+// The fold functions do operations on a constant at GLSL compile time, without generating run-time
+// code. Returns the constant value to keep using. Nullptr should not be returned.
+TConstantUnion *TIntermConstantUnion::foldUnaryNonComponentWise(TOperator op)
+{
+ // Do operations where the return type may have a different number of components compared to the
+ // operand type.
+
+ const TConstantUnion *operandArray = getConstantValue();
+ ASSERT(operandArray);
+
+ size_t objectSize = getType().getObjectSize();
+ TConstantUnion *resultArray = nullptr;
+ switch (op)
+ {
+ case EOpAny:
+ ASSERT(getType().getBasicType() == EbtBool);
+ resultArray = new TConstantUnion();
+ resultArray->setBConst(false);
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (operandArray[i].getBConst())
+ {
+ resultArray->setBConst(true);
+ break;
+ }
+ }
+ break;
+
+ case EOpAll:
+ ASSERT(getType().getBasicType() == EbtBool);
+ resultArray = new TConstantUnion();
+ resultArray->setBConst(true);
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ if (!operandArray[i].getBConst())
+ {
+ resultArray->setBConst(false);
+ break;
+ }
+ }
+ break;
+
+ case EOpLength:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray = new TConstantUnion();
+ resultArray->setFConst(VectorLength(operandArray, objectSize));
+ break;
+
+ case EOpTranspose:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray = new TConstantUnion[objectSize];
+ angle::Matrix<float> result =
+ GetMatrix(operandArray, getType().getRows(), getType().getCols()).transpose();
+ SetUnionArrayFromMatrix(result, resultArray);
+ break;
+ }
+
+ case EOpDeterminant:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ unsigned int size = getType().getNominalSize();
+ ASSERT(size >= 2 && size <= 4);
+ resultArray = new TConstantUnion();
+ resultArray->setFConst(GetMatrix(operandArray, size).determinant());
+ break;
+ }
+
+ case EOpInverse:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ unsigned int size = getType().getNominalSize();
+ ASSERT(size >= 2 && size <= 4);
+ resultArray = new TConstantUnion[objectSize];
+ angle::Matrix<float> result = GetMatrix(operandArray, size).inverse();
+ SetUnionArrayFromMatrix(result, resultArray);
+ break;
+ }
+
+ case EOpPackSnorm2x16:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ ASSERT(getType().getNominalSize() == 2);
+ resultArray = new TConstantUnion();
+ resultArray->setUConst(
+ gl::packSnorm2x16(operandArray[0].getFConst(), operandArray[1].getFConst()));
+ break;
+
+ case EOpUnpackSnorm2x16:
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ resultArray = new TConstantUnion[2];
+ float f1, f2;
+ gl::unpackSnorm2x16(operandArray[0].getUConst(), &f1, &f2);
+ resultArray[0].setFConst(f1);
+ resultArray[1].setFConst(f2);
+ break;
+ }
+
+ case EOpPackUnorm2x16:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ ASSERT(getType().getNominalSize() == 2);
+ resultArray = new TConstantUnion();
+ resultArray->setUConst(
+ gl::packUnorm2x16(operandArray[0].getFConst(), operandArray[1].getFConst()));
+ break;
+
+ case EOpUnpackUnorm2x16:
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ resultArray = new TConstantUnion[2];
+ float f1, f2;
+ gl::unpackUnorm2x16(operandArray[0].getUConst(), &f1, &f2);
+ resultArray[0].setFConst(f1);
+ resultArray[1].setFConst(f2);
+ break;
+ }
+
+ case EOpPackHalf2x16:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ ASSERT(getType().getNominalSize() == 2);
+ resultArray = new TConstantUnion();
+ resultArray->setUConst(
+ gl::packHalf2x16(operandArray[0].getFConst(), operandArray[1].getFConst()));
+ break;
+
+ case EOpUnpackHalf2x16:
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ resultArray = new TConstantUnion[2];
+ float f1, f2;
+ gl::unpackHalf2x16(operandArray[0].getUConst(), &f1, &f2);
+ resultArray[0].setFConst(f1);
+ resultArray[1].setFConst(f2);
+ break;
+ }
+
+ case EOpPackUnorm4x8:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray = new TConstantUnion();
+ resultArray->setUConst(
+ gl::PackUnorm4x8(operandArray[0].getFConst(), operandArray[1].getFConst(),
+ operandArray[2].getFConst(), operandArray[3].getFConst()));
+ break;
+ }
+ case EOpPackSnorm4x8:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray = new TConstantUnion();
+ resultArray->setUConst(
+ gl::PackSnorm4x8(operandArray[0].getFConst(), operandArray[1].getFConst(),
+ operandArray[2].getFConst(), operandArray[3].getFConst()));
+ break;
+ }
+ case EOpUnpackUnorm4x8:
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ resultArray = new TConstantUnion[4];
+ float f[4];
+ gl::UnpackUnorm4x8(operandArray[0].getUConst(), f);
+ for (size_t i = 0; i < 4; ++i)
+ {
+ resultArray[i].setFConst(f[i]);
+ }
+ break;
+ }
+ case EOpUnpackSnorm4x8:
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ resultArray = new TConstantUnion[4];
+ float f[4];
+ gl::UnpackSnorm4x8(operandArray[0].getUConst(), f);
+ for (size_t i = 0; i < 4; ++i)
+ {
+ resultArray[i].setFConst(f[i]);
+ }
+ break;
+ }
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return resultArray;
+}
+
+TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op,
+ TDiagnostics *diagnostics)
+{
+ // Do unary operations where each component of the result is computed based on the corresponding
+ // component of the operand. Also folds normalize, though the divisor in that case takes all
+ // components into account.
+
+ const TConstantUnion *operandArray = getConstantValue();
+ ASSERT(operandArray);
+
+ size_t objectSize = getType().getObjectSize();
+
+ TConstantUnion *resultArray = new TConstantUnion[objectSize];
+ for (size_t i = 0; i < objectSize; i++)
+ {
+ switch (op)
+ {
+ case EOpNegative:
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ resultArray[i].setFConst(-operandArray[i].getFConst());
+ break;
+ case EbtInt:
+ if (operandArray[i] == std::numeric_limits<int>::min())
+ {
+ // The minimum representable integer doesn't have a positive
+ // counterpart, rather the negation overflows and in ESSL is supposed to
+ // wrap back to the minimum representable integer. Make sure that we
+ // don't actually let the negation overflow, which has undefined
+ // behavior in C++.
+ resultArray[i].setIConst(std::numeric_limits<int>::min());
+ }
+ else
+ {
+ resultArray[i].setIConst(-operandArray[i].getIConst());
+ }
+ break;
+ case EbtUInt:
+ if (operandArray[i] == 0x80000000u)
+ {
+ resultArray[i].setUConst(0x80000000u);
+ }
+ else
+ {
+ resultArray[i].setUConst(static_cast<unsigned int>(
+ -static_cast<int>(operandArray[i].getUConst())));
+ }
+ break;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ break;
+
+ case EOpPositive:
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ resultArray[i].setFConst(operandArray[i].getFConst());
+ break;
+ case EbtInt:
+ resultArray[i].setIConst(operandArray[i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setUConst(static_cast<unsigned int>(
+ static_cast<int>(operandArray[i].getUConst())));
+ break;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ break;
+
+ case EOpLogicalNot:
+ switch (getType().getBasicType())
+ {
+ case EbtBool:
+ resultArray[i].setBConst(!operandArray[i].getBConst());
+ break;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ break;
+
+ case EOpBitwiseNot:
+ switch (getType().getBasicType())
+ {
+ case EbtInt:
+ resultArray[i].setIConst(~operandArray[i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setUConst(~operandArray[i].getUConst());
+ break;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ break;
+
+ case EOpRadians:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray[i].setFConst(kDegreesToRadiansMultiplier * operandArray[i].getFConst());
+ break;
+
+ case EOpDegrees:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray[i].setFConst(kRadiansToDegreesMultiplier * operandArray[i].getFConst());
+ break;
+
+ case EOpSin:
+ foldFloatTypeUnary(operandArray[i], &sinf, &resultArray[i]);
+ break;
+
+ case EOpCos:
+ foldFloatTypeUnary(operandArray[i], &cosf, &resultArray[i]);
+ break;
+
+ case EOpTan:
+ foldFloatTypeUnary(operandArray[i], &tanf, &resultArray[i]);
+ break;
+
+ case EOpAsin:
+ // For asin(x), results are undefined if |x| > 1, we are choosing to set result to
+ // 0.
+ if (fabsf(operandArray[i].getFConst()) > 1.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ foldFloatTypeUnary(operandArray[i], &asinf, &resultArray[i]);
+ break;
+
+ case EOpAcos:
+ // For acos(x), results are undefined if |x| > 1, we are choosing to set result to
+ // 0.
+ if (fabsf(operandArray[i].getFConst()) > 1.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ foldFloatTypeUnary(operandArray[i], &acosf, &resultArray[i]);
+ break;
+
+ case EOpAtan:
+ foldFloatTypeUnary(operandArray[i], &atanf, &resultArray[i]);
+ break;
+
+ case EOpSinh:
+ foldFloatTypeUnary(operandArray[i], &sinhf, &resultArray[i]);
+ break;
+
+ case EOpCosh:
+ foldFloatTypeUnary(operandArray[i], &coshf, &resultArray[i]);
+ break;
+
+ case EOpTanh:
+ foldFloatTypeUnary(operandArray[i], &tanhf, &resultArray[i]);
+ break;
+
+ case EOpAsinh:
+ foldFloatTypeUnary(operandArray[i], &asinhf, &resultArray[i]);
+ break;
+
+ case EOpAcosh:
+ // For acosh(x), results are undefined if x < 1, we are choosing to set result to 0.
+ if (operandArray[i].getFConst() < 1.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ foldFloatTypeUnary(operandArray[i], &acoshf, &resultArray[i]);
+ break;
+
+ case EOpAtanh:
+ // For atanh(x), results are undefined if |x| >= 1, we are choosing to set result to
+ // 0.
+ if (fabsf(operandArray[i].getFConst()) >= 1.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ foldFloatTypeUnary(operandArray[i], &atanhf, &resultArray[i]);
+ break;
+
+ case EOpAbs:
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ resultArray[i].setFConst(fabsf(operandArray[i].getFConst()));
+ break;
+ case EbtInt:
+ resultArray[i].setIConst(abs(operandArray[i].getIConst()));
+ break;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ break;
+
+ case EOpSign:
+ switch (getType().getBasicType())
+ {
+ case EbtFloat:
+ {
+ float fConst = operandArray[i].getFConst();
+ float fResult = 0.0f;
+ if (fConst > 0.0f)
+ fResult = 1.0f;
+ else if (fConst < 0.0f)
+ fResult = -1.0f;
+ resultArray[i].setFConst(fResult);
+ break;
+ }
+ case EbtInt:
+ {
+ int iConst = operandArray[i].getIConst();
+ int iResult = 0;
+ if (iConst > 0)
+ iResult = 1;
+ else if (iConst < 0)
+ iResult = -1;
+ resultArray[i].setIConst(iResult);
+ break;
+ }
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ break;
+
+ case EOpFloor:
+ foldFloatTypeUnary(operandArray[i], &floorf, &resultArray[i]);
+ break;
+
+ case EOpTrunc:
+ foldFloatTypeUnary(operandArray[i], &truncf, &resultArray[i]);
+ break;
+
+ case EOpRound:
+ foldFloatTypeUnary(operandArray[i], &roundf, &resultArray[i]);
+ break;
+
+ case EOpRoundEven:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ float x = operandArray[i].getFConst();
+ float result;
+ float fractPart = modff(x, &result);
+ if (fabsf(fractPart) == 0.5f)
+ result = 2.0f * roundf(x / 2.0f);
+ else
+ result = roundf(x);
+ resultArray[i].setFConst(result);
+ break;
+ }
+
+ case EOpCeil:
+ foldFloatTypeUnary(operandArray[i], &ceilf, &resultArray[i]);
+ break;
+
+ case EOpFract:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ float x = operandArray[i].getFConst();
+ resultArray[i].setFConst(x - floorf(x));
+ break;
+ }
+
+ case EOpIsnan:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray[i].setBConst(gl::isNaN(operandArray[0].getFConst()));
+ break;
+
+ case EOpIsinf:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray[i].setBConst(gl::isInf(operandArray[0].getFConst()));
+ break;
+
+ case EOpFloatBitsToInt:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray[i].setIConst(gl::bitCast<int32_t>(operandArray[0].getFConst()));
+ break;
+
+ case EOpFloatBitsToUint:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ resultArray[i].setUConst(gl::bitCast<uint32_t>(operandArray[0].getFConst()));
+ break;
+
+ case EOpIntBitsToFloat:
+ ASSERT(getType().getBasicType() == EbtInt);
+ resultArray[i].setFConst(gl::bitCast<float>(operandArray[0].getIConst()));
+ break;
+
+ case EOpUintBitsToFloat:
+ ASSERT(getType().getBasicType() == EbtUInt);
+ resultArray[i].setFConst(gl::bitCast<float>(operandArray[0].getUConst()));
+ break;
+
+ case EOpExp:
+ foldFloatTypeUnary(operandArray[i], &expf, &resultArray[i]);
+ break;
+
+ case EOpLog:
+ // For log(x), results are undefined if x <= 0, we are choosing to set result to 0.
+ if (operandArray[i].getFConst() <= 0.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ foldFloatTypeUnary(operandArray[i], &logf, &resultArray[i]);
+ break;
+
+ case EOpExp2:
+ foldFloatTypeUnary(operandArray[i], &exp2f, &resultArray[i]);
+ break;
+
+ case EOpLog2:
+ // For log2(x), results are undefined if x <= 0, we are choosing to set result to 0.
+ // And log2f is not available on some plarforms like old android, so just using
+ // log(x)/log(2) here.
+ if (operandArray[i].getFConst() <= 0.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ {
+ foldFloatTypeUnary(operandArray[i], &logf, &resultArray[i]);
+ resultArray[i].setFConst(resultArray[i].getFConst() / logf(2.0f));
+ }
+ break;
+
+ case EOpSqrt:
+ // For sqrt(x), results are undefined if x < 0, we are choosing to set result to 0.
+ if (operandArray[i].getFConst() < 0.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ foldFloatTypeUnary(operandArray[i], &sqrtf, &resultArray[i]);
+ break;
+
+ case EOpInversesqrt:
+ // There is no stdlib built-in function equavalent for GLES built-in inversesqrt(),
+ // so getting the square root first using builtin function sqrt() and then taking
+ // its inverse.
+ // Also, for inversesqrt(x), results are undefined if x <= 0, we are choosing to set
+ // result to 0.
+ if (operandArray[i].getFConst() <= 0.0f)
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ else
+ {
+ foldFloatTypeUnary(operandArray[i], &sqrtf, &resultArray[i]);
+ resultArray[i].setFConst(1.0f / resultArray[i].getFConst());
+ }
+ break;
+
+ case EOpLogicalNotComponentWise:
+ ASSERT(getType().getBasicType() == EbtBool);
+ resultArray[i].setBConst(!operandArray[i].getBConst());
+ break;
+
+ case EOpNormalize:
+ {
+ ASSERT(getType().getBasicType() == EbtFloat);
+ float x = operandArray[i].getFConst();
+ float length = VectorLength(operandArray, objectSize);
+ if (length)
+ resultArray[i].setFConst(x / length);
+ else
+ UndefinedConstantFoldingError(getLine(), op, getType().getBasicType(),
+ diagnostics, &resultArray[i]);
+ break;
+ }
+ case EOpBitfieldReverse:
+ {
+ uint32_t value;
+ if (getType().getBasicType() == EbtInt)
+ {
+ value = static_cast<uint32_t>(operandArray[i].getIConst());
+ }
+ else
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ value = operandArray[i].getUConst();
+ }
+ uint32_t result = gl::BitfieldReverse(value);
+ if (getType().getBasicType() == EbtInt)
+ {
+ resultArray[i].setIConst(static_cast<int32_t>(result));
+ }
+ else
+ {
+ resultArray[i].setUConst(result);
+ }
+ break;
+ }
+ case EOpBitCount:
+ {
+ uint32_t value;
+ if (getType().getBasicType() == EbtInt)
+ {
+ value = static_cast<uint32_t>(operandArray[i].getIConst());
+ }
+ else
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ value = operandArray[i].getUConst();
+ }
+ int result = gl::BitCount(value);
+ resultArray[i].setIConst(result);
+ break;
+ }
+ case EOpFindLSB:
+ {
+ uint32_t value;
+ if (getType().getBasicType() == EbtInt)
+ {
+ value = static_cast<uint32_t>(operandArray[i].getIConst());
+ }
+ else
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ value = operandArray[i].getUConst();
+ }
+ resultArray[i].setIConst(gl::FindLSB(value));
+ break;
+ }
+ case EOpFindMSB:
+ {
+ uint32_t value;
+ if (getType().getBasicType() == EbtInt)
+ {
+ int intValue = operandArray[i].getIConst();
+ value = static_cast<uint32_t>(intValue);
+ if (intValue < 0)
+ {
+ // Look for zero instead of one in value. This also handles the intValue ==
+ // -1 special case, where the return value needs to be -1.
+ value = ~value;
+ }
+ }
+ else
+ {
+ ASSERT(getType().getBasicType() == EbtUInt);
+ value = operandArray[i].getUConst();
+ }
+ resultArray[i].setIConst(gl::FindMSB(value));
+ break;
+ }
+ case EOpDFdx:
+ case EOpDFdy:
+ case EOpFwidth:
+ ASSERT(getType().getBasicType() == EbtFloat);
+ // Derivatives of constant arguments should be 0.
+ resultArray[i].setFConst(0.0f);
+ break;
+
+ default:
+ return nullptr;
+ }
+ }
+
+ return resultArray;
+}
+
+void TIntermConstantUnion::foldFloatTypeUnary(const TConstantUnion &parameter,
+ FloatTypeUnaryFunc builtinFunc,
+ TConstantUnion *result) const
+{
+ ASSERT(builtinFunc);
+
+ ASSERT(getType().getBasicType() == EbtFloat);
+ result->setFConst(builtinFunc(parameter.getFConst()));
+}
+
+// static
+TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *aggregate,
+ TDiagnostics *diagnostics)
+{
+ TOperator op = aggregate->getOp();
+ TIntermSequence *arguments = aggregate->getSequence();
+ unsigned int argsCount = static_cast<unsigned int>(arguments->size());
+ std::vector<const TConstantUnion *> unionArrays(argsCount);
+ std::vector<size_t> objectSizes(argsCount);
+ size_t maxObjectSize = 0;
+ TBasicType basicType = EbtVoid;
+ TSourceLoc loc;
+ for (unsigned int i = 0; i < argsCount; i++)
+ {
+ TIntermConstantUnion *argConstant = (*arguments)[i]->getAsConstantUnion();
+ ASSERT(argConstant != nullptr); // Should be checked already.
+
+ if (i == 0)
+ {
+ basicType = argConstant->getType().getBasicType();
+ loc = argConstant->getLine();
+ }
+ unionArrays[i] = argConstant->getConstantValue();
+ objectSizes[i] = argConstant->getType().getObjectSize();
+ if (objectSizes[i] > maxObjectSize)
+ maxObjectSize = objectSizes[i];
+ }
+
+ if (!(*arguments)[0]->getAsTyped()->isMatrix() && aggregate->getOp() != EOpOuterProduct)
+ {
+ for (unsigned int i = 0; i < argsCount; i++)
+ if (objectSizes[i] != maxObjectSize)
+ unionArrays[i] = Vectorize(*unionArrays[i], maxObjectSize);
+ }
+
+ TConstantUnion *resultArray = nullptr;
+
+ switch (op)
+ {
+ case EOpAtan:
+ {
+ ASSERT(basicType == EbtFloat);
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float y = unionArrays[0][i].getFConst();
+ float x = unionArrays[1][i].getFConst();
+ // Results are undefined if x and y are both 0.
+ if (x == 0.0f && y == 0.0f)
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics, &resultArray[i]);
+ else
+ resultArray[i].setFConst(atan2f(y, x));
+ }
+ break;
+ }
+
+ case EOpPow:
+ {
+ ASSERT(basicType == EbtFloat);
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float x = unionArrays[0][i].getFConst();
+ float y = unionArrays[1][i].getFConst();
+ // Results are undefined if x < 0.
+ // Results are undefined if x = 0 and y <= 0.
+ if (x < 0.0f)
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics, &resultArray[i]);
+ else if (x == 0.0f && y <= 0.0f)
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics, &resultArray[i]);
+ else
+ resultArray[i].setFConst(powf(x, y));
+ }
+ break;
+ }
+
+ case EOpMod:
+ {
+ ASSERT(basicType == EbtFloat);
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float x = unionArrays[0][i].getFConst();
+ float y = unionArrays[1][i].getFConst();
+ resultArray[i].setFConst(x - y * floorf(x / y));
+ }
+ break;
+ }
+
+ case EOpMin:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setFConst(
+ std::min(unionArrays[0][i].getFConst(), unionArrays[1][i].getFConst()));
+ break;
+ case EbtInt:
+ resultArray[i].setIConst(
+ std::min(unionArrays[0][i].getIConst(), unionArrays[1][i].getIConst()));
+ break;
+ case EbtUInt:
+ resultArray[i].setUConst(
+ std::min(unionArrays[0][i].getUConst(), unionArrays[1][i].getUConst()));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+
+ case EOpMax:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setFConst(
+ std::max(unionArrays[0][i].getFConst(), unionArrays[1][i].getFConst()));
+ break;
+ case EbtInt:
+ resultArray[i].setIConst(
+ std::max(unionArrays[0][i].getIConst(), unionArrays[1][i].getIConst()));
+ break;
+ case EbtUInt:
+ resultArray[i].setUConst(
+ std::max(unionArrays[0][i].getUConst(), unionArrays[1][i].getUConst()));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+
+ case EOpStep:
+ {
+ ASSERT(basicType == EbtFloat);
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ resultArray[i].setFConst(
+ unionArrays[1][i].getFConst() < unionArrays[0][i].getFConst() ? 0.0f : 1.0f);
+ break;
+ }
+
+ case EOpLessThanComponentWise:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setBConst(unionArrays[0][i].getFConst() <
+ unionArrays[1][i].getFConst());
+ break;
+ case EbtInt:
+ resultArray[i].setBConst(unionArrays[0][i].getIConst() <
+ unionArrays[1][i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setBConst(unionArrays[0][i].getUConst() <
+ unionArrays[1][i].getUConst());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+
+ case EOpLessThanEqualComponentWise:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setBConst(unionArrays[0][i].getFConst() <=
+ unionArrays[1][i].getFConst());
+ break;
+ case EbtInt:
+ resultArray[i].setBConst(unionArrays[0][i].getIConst() <=
+ unionArrays[1][i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setBConst(unionArrays[0][i].getUConst() <=
+ unionArrays[1][i].getUConst());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+
+ case EOpGreaterThanComponentWise:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setBConst(unionArrays[0][i].getFConst() >
+ unionArrays[1][i].getFConst());
+ break;
+ case EbtInt:
+ resultArray[i].setBConst(unionArrays[0][i].getIConst() >
+ unionArrays[1][i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setBConst(unionArrays[0][i].getUConst() >
+ unionArrays[1][i].getUConst());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+ case EOpGreaterThanEqualComponentWise:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setBConst(unionArrays[0][i].getFConst() >=
+ unionArrays[1][i].getFConst());
+ break;
+ case EbtInt:
+ resultArray[i].setBConst(unionArrays[0][i].getIConst() >=
+ unionArrays[1][i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setBConst(unionArrays[0][i].getUConst() >=
+ unionArrays[1][i].getUConst());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ }
+ break;
+
+ case EOpEqualComponentWise:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setBConst(unionArrays[0][i].getFConst() ==
+ unionArrays[1][i].getFConst());
+ break;
+ case EbtInt:
+ resultArray[i].setBConst(unionArrays[0][i].getIConst() ==
+ unionArrays[1][i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setBConst(unionArrays[0][i].getUConst() ==
+ unionArrays[1][i].getUConst());
+ break;
+ case EbtBool:
+ resultArray[i].setBConst(unionArrays[0][i].getBConst() ==
+ unionArrays[1][i].getBConst());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+
+ case EOpNotEqualComponentWise:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ resultArray[i].setBConst(unionArrays[0][i].getFConst() !=
+ unionArrays[1][i].getFConst());
+ break;
+ case EbtInt:
+ resultArray[i].setBConst(unionArrays[0][i].getIConst() !=
+ unionArrays[1][i].getIConst());
+ break;
+ case EbtUInt:
+ resultArray[i].setBConst(unionArrays[0][i].getUConst() !=
+ unionArrays[1][i].getUConst());
+ break;
+ case EbtBool:
+ resultArray[i].setBConst(unionArrays[0][i].getBConst() !=
+ unionArrays[1][i].getBConst());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+
+ case EOpDistance:
+ {
+ ASSERT(basicType == EbtFloat);
+ TConstantUnion *distanceArray = new TConstantUnion[maxObjectSize];
+ resultArray = new TConstantUnion();
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float x = unionArrays[0][i].getFConst();
+ float y = unionArrays[1][i].getFConst();
+ distanceArray[i].setFConst(x - y);
+ }
+ resultArray->setFConst(VectorLength(distanceArray, maxObjectSize));
+ break;
+ }
+
+ case EOpDot:
+ ASSERT(basicType == EbtFloat);
+ resultArray = new TConstantUnion();
+ resultArray->setFConst(VectorDotProduct(unionArrays[0], unionArrays[1], maxObjectSize));
+ break;
+
+ case EOpCross:
+ {
+ ASSERT(basicType == EbtFloat && maxObjectSize == 3);
+ resultArray = new TConstantUnion[maxObjectSize];
+ float x0 = unionArrays[0][0].getFConst();
+ float x1 = unionArrays[0][1].getFConst();
+ float x2 = unionArrays[0][2].getFConst();
+ float y0 = unionArrays[1][0].getFConst();
+ float y1 = unionArrays[1][1].getFConst();
+ float y2 = unionArrays[1][2].getFConst();
+ resultArray[0].setFConst(x1 * y2 - y1 * x2);
+ resultArray[1].setFConst(x2 * y0 - y2 * x0);
+ resultArray[2].setFConst(x0 * y1 - y0 * x1);
+ break;
+ }
+
+ case EOpReflect:
+ {
+ ASSERT(basicType == EbtFloat);
+ // genType reflect (genType I, genType N) :
+ // For the incident vector I and surface orientation N, returns the reflection
+ // direction:
+ // I - 2 * dot(N, I) * N.
+ resultArray = new TConstantUnion[maxObjectSize];
+ float dotProduct = VectorDotProduct(unionArrays[1], unionArrays[0], maxObjectSize);
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float result = unionArrays[0][i].getFConst() -
+ 2.0f * dotProduct * unionArrays[1][i].getFConst();
+ resultArray[i].setFConst(result);
+ }
+ break;
+ }
+
+ case EOpMulMatrixComponentWise:
+ {
+ ASSERT(basicType == EbtFloat && (*arguments)[0]->getAsTyped()->isMatrix() &&
+ (*arguments)[1]->getAsTyped()->isMatrix());
+ // Perform component-wise matrix multiplication.
+ resultArray = new TConstantUnion[maxObjectSize];
+ int rows = (*arguments)[0]->getAsTyped()->getRows();
+ int cols = (*arguments)[0]->getAsTyped()->getCols();
+ angle::Matrix<float> lhs = GetMatrix(unionArrays[0], rows, cols);
+ angle::Matrix<float> rhs = GetMatrix(unionArrays[1], rows, cols);
+ angle::Matrix<float> result = lhs.compMult(rhs);
+ SetUnionArrayFromMatrix(result, resultArray);
+ break;
+ }
+
+ case EOpOuterProduct:
+ {
+ ASSERT(basicType == EbtFloat);
+ size_t numRows = (*arguments)[0]->getAsTyped()->getType().getObjectSize();
+ size_t numCols = (*arguments)[1]->getAsTyped()->getType().getObjectSize();
+ resultArray = new TConstantUnion[numRows * numCols];
+ angle::Matrix<float> result =
+ GetMatrix(unionArrays[0], static_cast<int>(numRows), 1)
+ .outerProduct(GetMatrix(unionArrays[1], 1, static_cast<int>(numCols)));
+ SetUnionArrayFromMatrix(result, resultArray);
+ break;
+ }
+
+ case EOpClamp:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ switch (basicType)
+ {
+ case EbtFloat:
+ {
+ float x = unionArrays[0][i].getFConst();
+ float min = unionArrays[1][i].getFConst();
+ float max = unionArrays[2][i].getFConst();
+ // Results are undefined if min > max.
+ if (min > max)
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics,
+ &resultArray[i]);
+ else
+ resultArray[i].setFConst(gl::clamp(x, min, max));
+ break;
+ }
+
+ case EbtInt:
+ {
+ int x = unionArrays[0][i].getIConst();
+ int min = unionArrays[1][i].getIConst();
+ int max = unionArrays[2][i].getIConst();
+ // Results are undefined if min > max.
+ if (min > max)
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics,
+ &resultArray[i]);
+ else
+ resultArray[i].setIConst(gl::clamp(x, min, max));
+ break;
+ }
+ case EbtUInt:
+ {
+ unsigned int x = unionArrays[0][i].getUConst();
+ unsigned int min = unionArrays[1][i].getUConst();
+ unsigned int max = unionArrays[2][i].getUConst();
+ // Results are undefined if min > max.
+ if (min > max)
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics,
+ &resultArray[i]);
+ else
+ resultArray[i].setUConst(gl::clamp(x, min, max));
+ break;
+ }
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ break;
+ }
+
+ case EOpMix:
+ {
+ ASSERT(basicType == EbtFloat);
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float x = unionArrays[0][i].getFConst();
+ float y = unionArrays[1][i].getFConst();
+ TBasicType type = (*arguments)[2]->getAsTyped()->getType().getBasicType();
+ if (type == EbtFloat)
+ {
+ // Returns the linear blend of x and y, i.e., x * (1 - a) + y * a.
+ float a = unionArrays[2][i].getFConst();
+ resultArray[i].setFConst(x * (1.0f - a) + y * a);
+ }
+ else // 3rd parameter is EbtBool
+ {
+ ASSERT(type == EbtBool);
+ // Selects which vector each returned component comes from.
+ // For a component of a that is false, the corresponding component of x is
+ // returned.
+ // For a component of a that is true, the corresponding component of y is
+ // returned.
+ bool a = unionArrays[2][i].getBConst();
+ resultArray[i].setFConst(a ? y : x);
+ }
+ }
+ break;
+ }
+
+ case EOpSmoothstep:
+ {
+ ASSERT(basicType == EbtFloat);
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float edge0 = unionArrays[0][i].getFConst();
+ float edge1 = unionArrays[1][i].getFConst();
+ float x = unionArrays[2][i].getFConst();
+ // Results are undefined if edge0 >= edge1.
+ if (edge0 >= edge1)
+ {
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics, &resultArray[i]);
+ }
+ else
+ {
+ // Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and performs smooth
+ // Hermite interpolation between 0 and 1 when edge0 < x < edge1.
+ float t = gl::clamp((x - edge0) / (edge1 - edge0), 0.0f, 1.0f);
+ resultArray[i].setFConst(t * t * (3.0f - 2.0f * t));
+ }
+ }
+ break;
+ }
+
+ case EOpLdexp:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float x = unionArrays[0][i].getFConst();
+ int exp = unionArrays[1][i].getIConst();
+ if (exp > 128)
+ {
+ UndefinedConstantFoldingError(loc, op, basicType, diagnostics, &resultArray[i]);
+ }
+ else
+ {
+ resultArray[i].setFConst(gl::Ldexp(x, exp));
+ }
+ }
+ break;
+ }
+
+ case EOpFaceforward:
+ {
+ ASSERT(basicType == EbtFloat);
+ // genType faceforward(genType N, genType I, genType Nref) :
+ // If dot(Nref, I) < 0 return N, otherwise return -N.
+ resultArray = new TConstantUnion[maxObjectSize];
+ float dotProduct = VectorDotProduct(unionArrays[2], unionArrays[1], maxObjectSize);
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ if (dotProduct < 0)
+ resultArray[i].setFConst(unionArrays[0][i].getFConst());
+ else
+ resultArray[i].setFConst(-unionArrays[0][i].getFConst());
+ }
+ break;
+ }
+
+ case EOpRefract:
+ {
+ ASSERT(basicType == EbtFloat);
+ // genType refract(genType I, genType N, float eta) :
+ // For the incident vector I and surface normal N, and the ratio of indices of
+ // refraction eta,
+ // return the refraction vector. The result is computed by
+ // k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I))
+ // if (k < 0.0)
+ // return genType(0.0)
+ // else
+ // return eta * I - (eta * dot(N, I) + sqrt(k)) * N
+ resultArray = new TConstantUnion[maxObjectSize];
+ float dotProduct = VectorDotProduct(unionArrays[1], unionArrays[0], maxObjectSize);
+ for (size_t i = 0; i < maxObjectSize; i++)
+ {
+ float eta = unionArrays[2][i].getFConst();
+ float k = 1.0f - eta * eta * (1.0f - dotProduct * dotProduct);
+ if (k < 0.0f)
+ resultArray[i].setFConst(0.0f);
+ else
+ resultArray[i].setFConst(eta * unionArrays[0][i].getFConst() -
+ (eta * dotProduct + sqrtf(k)) *
+ unionArrays[1][i].getFConst());
+ }
+ break;
+ }
+ case EOpBitfieldExtract:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; ++i)
+ {
+ int offset = unionArrays[1][0].getIConst();
+ int bits = unionArrays[2][0].getIConst();
+ if (bits == 0)
+ {
+ if (aggregate->getBasicType() == EbtInt)
+ {
+ resultArray[i].setIConst(0);
+ }
+ else
+ {
+ ASSERT(aggregate->getBasicType() == EbtUInt);
+ resultArray[i].setUConst(0);
+ }
+ }
+ else if (offset < 0 || bits < 0 || offset >= 32 || bits > 32 || offset + bits > 32)
+ {
+ UndefinedConstantFoldingError(loc, op, aggregate->getBasicType(), diagnostics,
+ &resultArray[i]);
+ }
+ else
+ {
+ // bits can be 32 here, so we need to avoid bit shift overflow.
+ uint32_t maskMsb = 1u << (bits - 1);
+ uint32_t mask = ((maskMsb - 1u) | maskMsb) << offset;
+ if (aggregate->getBasicType() == EbtInt)
+ {
+ uint32_t value = static_cast<uint32_t>(unionArrays[0][i].getIConst());
+ uint32_t resultUnsigned = (value & mask) >> offset;
+ if ((resultUnsigned & maskMsb) != 0)
+ {
+ // The most significant bits (from bits+1 to the most significant bit)
+ // should be set to 1.
+ uint32_t higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;
+ resultUnsigned |= higherBitsMask;
+ }
+ resultArray[i].setIConst(static_cast<int32_t>(resultUnsigned));
+ }
+ else
+ {
+ ASSERT(aggregate->getBasicType() == EbtUInt);
+ uint32_t value = unionArrays[0][i].getUConst();
+ resultArray[i].setUConst((value & mask) >> offset);
+ }
+ }
+ }
+ break;
+ }
+ case EOpBitfieldInsert:
+ {
+ resultArray = new TConstantUnion[maxObjectSize];
+ for (size_t i = 0; i < maxObjectSize; ++i)
+ {
+ int offset = unionArrays[2][0].getIConst();
+ int bits = unionArrays[3][0].getIConst();
+ if (bits == 0)
+ {
+ if (aggregate->getBasicType() == EbtInt)
+ {
+ int32_t base = unionArrays[0][i].getIConst();
+ resultArray[i].setIConst(base);
+ }
+ else
+ {
+ ASSERT(aggregate->getBasicType() == EbtUInt);
+ uint32_t base = unionArrays[0][i].getUConst();
+ resultArray[i].setUConst(base);
+ }
+ }
+ else if (offset < 0 || bits < 0 || offset >= 32 || bits > 32 || offset + bits > 32)
+ {
+ UndefinedConstantFoldingError(loc, op, aggregate->getBasicType(), diagnostics,
+ &resultArray[i]);
+ }
+ else
+ {
+ // bits can be 32 here, so we need to avoid bit shift overflow.
+ uint32_t maskMsb = 1u << (bits - 1);
+ uint32_t insertMask = ((maskMsb - 1u) | maskMsb) << offset;
+ uint32_t baseMask = ~insertMask;
+ if (aggregate->getBasicType() == EbtInt)
+ {
+ uint32_t base = static_cast<uint32_t>(unionArrays[0][i].getIConst());
+ uint32_t insert = static_cast<uint32_t>(unionArrays[1][i].getIConst());
+ uint32_t resultUnsigned =
+ (base & baseMask) | ((insert << offset) & insertMask);
+ resultArray[i].setIConst(static_cast<int32_t>(resultUnsigned));
+ }
+ else
+ {
+ ASSERT(aggregate->getBasicType() == EbtUInt);
+ uint32_t base = unionArrays[0][i].getUConst();
+ uint32_t insert = unionArrays[1][i].getUConst();
+ resultArray[i].setUConst((base & baseMask) |
+ ((insert << offset) & insertMask));
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ return resultArray;
+}
+
+bool TIntermConstantUnion::IsFloatDivision(TBasicType t1, TBasicType t2)
+{
+ ImplicitTypeConversion conversion = GetConversion(t1, t2);
+ ASSERT(conversion != ImplicitTypeConversion::Invalid);
+ if (conversion == ImplicitTypeConversion::Same)
+ {
+ if (t1 == EbtFloat)
+ return true;
+ return false;
+ }
+ ASSERT(t1 == EbtFloat || t2 == EbtFloat);
+ return true;
+}
+
+// TIntermPreprocessorDirective implementation.
+TIntermPreprocessorDirective::TIntermPreprocessorDirective(PreprocessorDirective directive,
+ ImmutableString command)
+ : mDirective(directive), mCommand(std::move(command))
+{}
+
+TIntermPreprocessorDirective::~TIntermPreprocessorDirective() = default;
+
+size_t TIntermPreprocessorDirective::getChildCount() const
+{
+ return 0;
+}
+
+TIntermNode *TIntermPreprocessorDirective::getChildNode(size_t index) const
+{
+ UNREACHABLE();
+ return nullptr;
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNode.h b/gfx/angle/checkout/src/compiler/translator/IntermNode.h
new file mode 100644
index 0000000000..5667378b14
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/IntermNode.h
@@ -0,0 +1,936 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+//
+// Definition of the in-memory high-level intermediate representation
+// of shaders. This is a tree that parser creates.
+//
+// Nodes in the tree are defined as a hierarchy of classes derived from
+// TIntermNode. Each is a node in a tree. There is no preset branching factor;
+// each node can have it's own type of list of children.
+//
+
+#ifndef COMPILER_TRANSLATOR_INTERMNODE_H_
+#define COMPILER_TRANSLATOR_INTERMNODE_H_
+
+#include "GLSLANG/ShaderLang.h"
+
+#include <algorithm>
+#include <queue>
+
+#include "common/angleutils.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ConstantUnion.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/Operator.h"
+#include "compiler/translator/SymbolUniqueId.h"
+#include "compiler/translator/Types.h"
+#include "compiler/translator/tree_util/Visit.h"
+
+namespace sh
+{
+
+class TDiagnostics;
+
+class TIntermTraverser;
+class TIntermAggregate;
+class TIntermBlock;
+class TIntermInvariantDeclaration;
+class TIntermDeclaration;
+class TIntermFunctionPrototype;
+class TIntermFunctionDefinition;
+class TIntermSwizzle;
+class TIntermBinary;
+class TIntermUnary;
+class TIntermConstantUnion;
+class TIntermTernary;
+class TIntermIfElse;
+class TIntermSwitch;
+class TIntermCase;
+class TIntermTyped;
+class TIntermSymbol;
+class TIntermLoop;
+class TInfoSink;
+class TInfoSinkBase;
+class TIntermBranch;
+class TIntermPreprocessorDirective;
+
+class TSymbolTable;
+class TFunction;
+class TVariable;
+
+//
+// Base class for the tree nodes
+//
+class TIntermNode : angle::NonCopyable
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TIntermNode()
+ {
+ // TODO: Move this to TSourceLoc constructor
+ // after getting rid of TPublicType.
+ mLine.first_file = mLine.last_file = 0;
+ mLine.first_line = mLine.last_line = 0;
+ }
+ virtual ~TIntermNode() {}
+
+ const TSourceLoc &getLine() const { return mLine; }
+ void setLine(const TSourceLoc &l) { mLine = l; }
+
+ virtual void traverse(TIntermTraverser *it);
+ virtual bool visit(Visit visit, TIntermTraverser *it) = 0;
+
+ virtual TIntermTyped *getAsTyped() { return nullptr; }
+ virtual TIntermConstantUnion *getAsConstantUnion() { return nullptr; }
+ virtual TIntermFunctionDefinition *getAsFunctionDefinition() { return nullptr; }
+ virtual TIntermAggregate *getAsAggregate() { return nullptr; }
+ virtual TIntermBlock *getAsBlock() { return nullptr; }
+ virtual TIntermFunctionPrototype *getAsFunctionPrototypeNode() { return nullptr; }
+ virtual TIntermInvariantDeclaration *getAsInvariantDeclarationNode() { return nullptr; }
+ virtual TIntermDeclaration *getAsDeclarationNode() { return nullptr; }
+ virtual TIntermSwizzle *getAsSwizzleNode() { return nullptr; }
+ virtual TIntermBinary *getAsBinaryNode() { return nullptr; }
+ virtual TIntermUnary *getAsUnaryNode() { return nullptr; }
+ virtual TIntermTernary *getAsTernaryNode() { return nullptr; }
+ virtual TIntermIfElse *getAsIfElseNode() { return nullptr; }
+ virtual TIntermSwitch *getAsSwitchNode() { return nullptr; }
+ virtual TIntermCase *getAsCaseNode() { return nullptr; }
+ virtual TIntermSymbol *getAsSymbolNode() { return nullptr; }
+ virtual TIntermLoop *getAsLoopNode() { return nullptr; }
+ virtual TIntermBranch *getAsBranchNode() { return nullptr; }
+ virtual TIntermPreprocessorDirective *getAsPreprocessorDirective() { return nullptr; }
+
+ virtual size_t getChildCount() const = 0;
+ virtual TIntermNode *getChildNode(size_t index) const = 0;
+ // Replace a child node. Return true if |original| is a child
+ // node and it is replaced; otherwise, return false.
+ virtual bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) = 0;
+
+ protected:
+ TSourceLoc mLine;
+};
+
+//
+// This is just to help yacc.
+//
+struct TIntermNodePair
+{
+ TIntermNode *node1;
+ TIntermNode *node2;
+};
+
+//
+// Intermediate class for nodes that have a type.
+//
+class TIntermTyped : public TIntermNode
+{
+ public:
+ TIntermTyped() {}
+
+ virtual TIntermTyped *deepCopy() const = 0;
+
+ TIntermTyped *getAsTyped() override { return this; }
+
+ virtual TIntermTyped *fold(TDiagnostics *diagnostics) { return this; }
+
+ // getConstantValue() returns the constant value that this node represents, if any. It
+ // should only be used after nodes have been replaced with their folded versions returned
+ // from fold(). hasConstantValue() returns true if getConstantValue() will return a value.
+ virtual bool hasConstantValue() const;
+ virtual const TConstantUnion *getConstantValue() const;
+
+ // True if executing the expression represented by this node affects state, like values of
+ // variables. False if the executing the expression only computes its return value without
+ // affecting state. May return true conservatively.
+ virtual bool hasSideEffects() const = 0;
+
+ virtual const TType &getType() const = 0;
+
+ TBasicType getBasicType() const { return getType().getBasicType(); }
+ TQualifier getQualifier() const { return getType().getQualifier(); }
+ TPrecision getPrecision() const { return getType().getPrecision(); }
+ TMemoryQualifier getMemoryQualifier() const { return getType().getMemoryQualifier(); }
+ int getCols() const { return getType().getCols(); }
+ int getRows() const { return getType().getRows(); }
+ int getNominalSize() const { return getType().getNominalSize(); }
+ int getSecondarySize() const { return getType().getSecondarySize(); }
+
+ bool isInterfaceBlock() const { return getType().isInterfaceBlock(); }
+ bool isMatrix() const { return getType().isMatrix(); }
+ bool isArray() const { return getType().isArray(); }
+ bool isVector() const { return getType().isVector(); }
+ bool isScalar() const { return getType().isScalar(); }
+ bool isScalarInt() const { return getType().isScalarInt(); }
+ const char *getBasicString() const { return getType().getBasicString(); }
+
+ unsigned int getOutermostArraySize() const { return getType().getOutermostArraySize(); }
+
+ protected:
+ TIntermTyped(const TIntermTyped &node);
+};
+
+//
+// Handle for, do-while, and while loops.
+//
+enum TLoopType
+{
+ ELoopFor,
+ ELoopWhile,
+ ELoopDoWhile
+};
+
+class TIntermLoop : public TIntermNode
+{
+ public:
+ TIntermLoop(TLoopType type,
+ TIntermNode *init,
+ TIntermTyped *cond,
+ TIntermTyped *expr,
+ TIntermBlock *body);
+
+ TIntermLoop *getAsLoopNode() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ TLoopType getType() const { return mType; }
+ TIntermNode *getInit() { return mInit; }
+ TIntermTyped *getCondition() { return mCond; }
+ TIntermTyped *getExpression() { return mExpr; }
+ TIntermBlock *getBody() { return mBody; }
+
+ void setInit(TIntermNode *init) { mInit = init; }
+ void setCondition(TIntermTyped *condition) { mCond = condition; }
+ void setExpression(TIntermTyped *expression) { mExpr = expression; }
+ void setBody(TIntermBlock *body) { mBody = body; }
+
+ protected:
+ TLoopType mType;
+ TIntermNode *mInit; // for-loop initialization
+ TIntermTyped *mCond; // loop exit condition
+ TIntermTyped *mExpr; // for-loop expression
+ TIntermBlock *mBody; // loop body
+};
+
+//
+// Handle break, continue, return, and kill.
+//
+class TIntermBranch : public TIntermNode
+{
+ public:
+ TIntermBranch(TOperator op, TIntermTyped *e) : mFlowOp(op), mExpression(e) {}
+
+ TIntermBranch *getAsBranchNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ TOperator getFlowOp() { return mFlowOp; }
+ TIntermTyped *getExpression() { return mExpression; }
+
+ protected:
+ TOperator mFlowOp;
+ TIntermTyped *mExpression; // zero except for "return exp;" statements
+};
+
+// Nodes that correspond to variable symbols in the source code. These may be regular variables or
+// interface block instances. In declarations that only declare a struct type but no variables, a
+// TIntermSymbol node with an empty variable is used to store the type.
+class TIntermSymbol : public TIntermTyped
+{
+ public:
+ TIntermSymbol(const TVariable *variable);
+
+ TIntermTyped *deepCopy() const override { return new TIntermSymbol(*this); }
+
+ bool hasConstantValue() const override;
+ const TConstantUnion *getConstantValue() const override;
+
+ bool hasSideEffects() const override { return false; }
+
+ const TType &getType() const override;
+
+ const TSymbolUniqueId &uniqueId() const;
+ ImmutableString getName() const;
+ const TVariable &variable() const { return *mVariable; }
+
+ TIntermSymbol *getAsSymbolNode() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *, TIntermNode *) override { return false; }
+
+ private:
+ TIntermSymbol(const TIntermSymbol &) = default; // Note: not deleted, just private!
+
+ const TVariable *const mVariable; // Guaranteed to be non-null
+};
+
+// A typed expression that is not just representing a symbol table symbol.
+class TIntermExpression : public TIntermTyped
+{
+ public:
+ TIntermExpression(const TType &t);
+
+ const TType &getType() const override { return mType; }
+
+ protected:
+ TType *getTypePointer() { return &mType; }
+ void setType(const TType &t) { mType = t; }
+ void setTypePreservePrecision(const TType &t);
+
+ TIntermExpression(const TIntermExpression &node) = default;
+
+ TType mType;
+};
+
+// Constant folded node.
+// Note that nodes may be constant folded and not be constant expressions with the EvqConst
+// qualifier. This happens for example when the following expression is processed:
+// "true ? 1.0 : non_constant"
+// Other nodes than TIntermConstantUnion may also be constant expressions.
+//
+class TIntermConstantUnion : public TIntermExpression
+{
+ public:
+ TIntermConstantUnion(const TConstantUnion *unionPointer, const TType &type)
+ : TIntermExpression(type), mUnionArrayPointer(unionPointer)
+ {
+ ASSERT(unionPointer);
+ }
+
+ TIntermTyped *deepCopy() const override { return new TIntermConstantUnion(*this); }
+
+ bool hasConstantValue() const override;
+ const TConstantUnion *getConstantValue() const override;
+
+ bool hasSideEffects() const override { return false; }
+
+ int getIConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getIConst() : 0;
+ }
+ unsigned int getUConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getUConst() : 0;
+ }
+ float getFConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getFConst() : 0.0f;
+ }
+ bool getBConst(size_t index) const
+ {
+ return mUnionArrayPointer ? mUnionArrayPointer[index].getBConst() : false;
+ }
+
+ TIntermConstantUnion *getAsConstantUnion() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *, TIntermNode *) override { return false; }
+
+ TConstantUnion *foldUnaryNonComponentWise(TOperator op);
+ TConstantUnion *foldUnaryComponentWise(TOperator op, TDiagnostics *diagnostics);
+
+ static const TConstantUnion *FoldBinary(TOperator op,
+ const TConstantUnion *leftArray,
+ const TType &leftType,
+ const TConstantUnion *rightArray,
+ const TType &rightType,
+ TDiagnostics *diagnostics,
+ const TSourceLoc &line);
+
+ static const TConstantUnion *FoldIndexing(const TType &type,
+ const TConstantUnion *constArray,
+ int index);
+ static TConstantUnion *FoldAggregateBuiltIn(TIntermAggregate *aggregate,
+ TDiagnostics *diagnostics);
+ static bool IsFloatDivision(TBasicType t1, TBasicType t2);
+
+ protected:
+ // Same data may be shared between multiple constant unions, so it can't be modified.
+ const TConstantUnion *mUnionArrayPointer;
+
+ private:
+ typedef float (*FloatTypeUnaryFunc)(float);
+ void foldFloatTypeUnary(const TConstantUnion &parameter,
+ FloatTypeUnaryFunc builtinFunc,
+ TConstantUnion *result) const;
+
+ TIntermConstantUnion(const TIntermConstantUnion &node); // Note: not deleted, just private!
+};
+
+//
+// Intermediate class for node types that hold operators.
+//
+class TIntermOperator : public TIntermExpression
+{
+ public:
+ TOperator getOp() const { return mOp; }
+
+ bool isAssignment() const;
+ bool isMultiplication() const;
+ bool isConstructor() const;
+
+ // Returns true for calls mapped to EOpCall*, false for built-ins that have their own specific
+ // ops.
+ bool isFunctionCall() const;
+
+ bool hasSideEffects() const override { return isAssignment(); }
+
+ protected:
+ TIntermOperator(TOperator op) : TIntermExpression(TType(EbtFloat, EbpUndefined)), mOp(op) {}
+ TIntermOperator(TOperator op, const TType &type) : TIntermExpression(type), mOp(op) {}
+
+ TIntermOperator(const TIntermOperator &) = default;
+
+ const TOperator mOp;
+};
+
+// Node for vector swizzles.
+class TIntermSwizzle : public TIntermExpression
+{
+ public:
+ // This constructor determines the type of the node based on the operand.
+ TIntermSwizzle(TIntermTyped *operand, const TVector<int> &swizzleOffsets);
+
+ TIntermTyped *deepCopy() const override { return new TIntermSwizzle(*this); }
+
+ TIntermSwizzle *getAsSwizzleNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ bool hasSideEffects() const override { return mOperand->hasSideEffects(); }
+
+ TIntermTyped *getOperand() { return mOperand; }
+ void writeOffsetsAsXYZW(TInfoSinkBase *out) const;
+
+ const TVector<int> &getSwizzleOffsets() { return mSwizzleOffsets; }
+
+ bool hasDuplicateOffsets() const;
+ void setHasFoldedDuplicateOffsets(bool hasFoldedDuplicateOffsets);
+ bool offsetsMatch(int offset) const;
+
+ TIntermTyped *fold(TDiagnostics *diagnostics) override;
+
+ protected:
+ TIntermTyped *mOperand;
+ TVector<int> mSwizzleOffsets;
+ bool mHasFoldedDuplicateOffsets;
+
+ private:
+ void promote();
+
+ TIntermSwizzle(const TIntermSwizzle &node); // Note: not deleted, just private!
+};
+
+//
+// Nodes for all the basic binary math operators.
+//
+class TIntermBinary : public TIntermOperator
+{
+ public:
+ // This constructor determines the type of the binary node based on the operands and op.
+ TIntermBinary(TOperator op, TIntermTyped *left, TIntermTyped *right);
+ // Comma qualifier depends on the shader version, so use this to create comma nodes:
+ static TIntermBinary *CreateComma(TIntermTyped *left, TIntermTyped *right, int shaderVersion);
+
+ TIntermTyped *deepCopy() const override { return new TIntermBinary(*this); }
+
+ bool hasConstantValue() const override;
+ const TConstantUnion *getConstantValue() const override;
+
+ static TOperator GetMulOpBasedOnOperands(const TType &left, const TType &right);
+ static TOperator GetMulAssignOpBasedOnOperands(const TType &left, const TType &right);
+
+ TIntermBinary *getAsBinaryNode() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ bool hasSideEffects() const override
+ {
+ return isAssignment() || mLeft->hasSideEffects() || mRight->hasSideEffects();
+ }
+
+ TIntermTyped *getLeft() const { return mLeft; }
+ TIntermTyped *getRight() const { return mRight; }
+ TIntermTyped *fold(TDiagnostics *diagnostics) override;
+
+ void setAddIndexClamp() { mAddIndexClamp = true; }
+ bool getAddIndexClamp() const { return mAddIndexClamp; }
+
+ // This method is only valid for EOpIndexDirectStruct. It returns the name of the field.
+ const ImmutableString &getIndexStructFieldName() const;
+
+ protected:
+ TIntermTyped *mLeft;
+ TIntermTyped *mRight;
+
+ // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
+ bool mAddIndexClamp;
+
+ private:
+ void promote();
+
+ static TQualifier GetCommaQualifier(int shaderVersion,
+ const TIntermTyped *left,
+ const TIntermTyped *right);
+
+ TIntermBinary(const TIntermBinary &node); // Note: not deleted, just private!
+};
+
+//
+// Nodes for unary math operators.
+//
+class TIntermUnary : public TIntermOperator
+{
+ public:
+ TIntermUnary(TOperator op, TIntermTyped *operand, const TFunction *function);
+
+ TIntermTyped *deepCopy() const override { return new TIntermUnary(*this); }
+
+ TIntermUnary *getAsUnaryNode() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ bool hasSideEffects() const override { return isAssignment() || mOperand->hasSideEffects(); }
+
+ TIntermTyped *getOperand() { return mOperand; }
+ TIntermTyped *fold(TDiagnostics *diagnostics) override;
+
+ const TFunction *getFunction() const { return mFunction; }
+
+ void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
+ bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
+
+ protected:
+ TIntermTyped *mOperand;
+
+ // If set to true, replace the built-in function call with an emulated one
+ // to work around driver bugs.
+ bool mUseEmulatedFunction;
+
+ const TFunction *const mFunction;
+
+ private:
+ void promote();
+
+ TIntermUnary(const TIntermUnary &node); // note: not deleted, just private!
+};
+
+typedef TVector<TIntermNode *> TIntermSequence;
+typedef TVector<int> TQualifierList;
+
+// Interface for node classes that have an arbitrarily sized set of children.
+class TIntermAggregateBase
+{
+ public:
+ virtual ~TIntermAggregateBase() {}
+
+ virtual TIntermSequence *getSequence() = 0;
+ virtual const TIntermSequence *getSequence() const = 0;
+
+ bool replaceChildNodeWithMultiple(TIntermNode *original, const TIntermSequence &replacements);
+ bool insertChildNodes(TIntermSequence::size_type position, const TIntermSequence &insertions);
+
+ protected:
+ TIntermAggregateBase() {}
+
+ bool replaceChildNodeInternal(TIntermNode *original, TIntermNode *replacement);
+};
+
+//
+// Nodes that operate on an arbitrary sized set of children.
+//
+class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
+{
+ public:
+ static TIntermAggregate *CreateFunctionCall(const TFunction &func, TIntermSequence *arguments);
+
+ static TIntermAggregate *CreateRawFunctionCall(const TFunction &func,
+ TIntermSequence *arguments);
+
+ // This covers all built-in function calls - whether they are associated with an op or not.
+ static TIntermAggregate *CreateBuiltInFunctionCall(const TFunction &func,
+ TIntermSequence *arguments);
+ static TIntermAggregate *CreateConstructor(const TType &type, TIntermSequence *arguments);
+ ~TIntermAggregate() {}
+
+ // Note: only supported for nodes that can be a part of an expression.
+ TIntermTyped *deepCopy() const override { return new TIntermAggregate(*this); }
+
+ TIntermAggregate *shallowCopy() const;
+
+ bool hasConstantValue() const override;
+ const TConstantUnion *getConstantValue() const override;
+
+ TIntermAggregate *getAsAggregate() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ bool hasSideEffects() const override;
+
+ TIntermTyped *fold(TDiagnostics *diagnostics) override;
+
+ TIntermSequence *getSequence() override { return &mArguments; }
+ const TIntermSequence *getSequence() const override { return &mArguments; }
+
+ void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
+ bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
+
+ // Returns true if changing parameter precision may affect the return value.
+ bool gotPrecisionFromChildren() const { return mGotPrecisionFromChildren; }
+
+ const TFunction *getFunction() const { return mFunction; }
+
+ // Get the function name to display to the user in an error message.
+ const char *functionName() const;
+
+ protected:
+ TIntermSequence mArguments;
+
+ // If set to true, replace the built-in function call with an emulated one
+ // to work around driver bugs. Only for calls mapped to ops other than EOpCall*.
+ bool mUseEmulatedFunction;
+
+ bool mGotPrecisionFromChildren;
+
+ const TFunction *const mFunction;
+
+ private:
+ TIntermAggregate(const TFunction *func,
+ const TType &type,
+ TOperator op,
+ TIntermSequence *arguments);
+
+ TIntermAggregate(const TIntermAggregate &node); // note: not deleted, just private!
+
+ void setPrecisionAndQualifier();
+
+ bool areChildrenConstQualified();
+
+ void setPrecisionFromChildren();
+
+ void setPrecisionForBuiltInOp();
+
+ // Returns true if precision was set according to special rules for this built-in.
+ bool setPrecisionForSpecialBuiltInOp();
+
+ // Used for built-in functions under EOpCallBuiltInFunction. The function name in the symbol
+ // info needs to be set before calling this.
+ void setBuiltInFunctionPrecision();
+};
+
+// A list of statements. Either the root node which contains declarations and function definitions,
+// or a block that can be marked with curly braces {}.
+class TIntermBlock : public TIntermNode, public TIntermAggregateBase
+{
+ public:
+ TIntermBlock() : TIntermNode() {}
+ ~TIntermBlock() {}
+
+ TIntermBlock *getAsBlock() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ // Only intended for initially building the block.
+ void appendStatement(TIntermNode *statement);
+ void insertStatement(size_t insertPosition, TIntermNode *statement);
+
+ TIntermSequence *getSequence() override { return &mStatements; }
+ const TIntermSequence *getSequence() const override { return &mStatements; }
+
+ protected:
+ TIntermSequence mStatements;
+};
+
+// Function prototype. May be in the AST either as a function prototype declaration or as a part of
+// a function definition. The type of the node is the function return type.
+class TIntermFunctionPrototype : public TIntermTyped
+{
+ public:
+ TIntermFunctionPrototype(const TFunction *function);
+ ~TIntermFunctionPrototype() {}
+
+ TIntermFunctionPrototype *getAsFunctionPrototypeNode() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ const TType &getType() const override;
+
+ TIntermTyped *deepCopy() const override
+ {
+ UNREACHABLE();
+ return nullptr;
+ }
+ bool hasSideEffects() const override
+ {
+ UNREACHABLE();
+ return true;
+ }
+
+ const TFunction *getFunction() const { return mFunction; }
+
+ protected:
+ const TFunction *const mFunction;
+};
+
+// Node for function definitions. The prototype child node stores the function header including
+// parameters, and the body child node stores the function body.
+class TIntermFunctionDefinition : public TIntermNode
+{
+ public:
+ TIntermFunctionDefinition(TIntermFunctionPrototype *prototype, TIntermBlock *body)
+ : TIntermNode(), mPrototype(prototype), mBody(body)
+ {
+ ASSERT(prototype != nullptr);
+ ASSERT(body != nullptr);
+ }
+
+ TIntermFunctionDefinition *getAsFunctionDefinition() override { return this; }
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ TIntermFunctionPrototype *getFunctionPrototype() const { return mPrototype; }
+ TIntermBlock *getBody() const { return mBody; }
+
+ const TFunction *getFunction() const { return mPrototype->getFunction(); }
+
+ private:
+ TIntermFunctionPrototype *mPrototype;
+ TIntermBlock *mBody;
+};
+
+// Struct, interface block or variable declaration. Can contain multiple variable declarators.
+class TIntermDeclaration : public TIntermNode, public TIntermAggregateBase
+{
+ public:
+ TIntermDeclaration() : TIntermNode() {}
+ ~TIntermDeclaration() {}
+
+ TIntermDeclaration *getAsDeclarationNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ // Only intended for initially building the declaration.
+ // The declarator node should be either TIntermSymbol or TIntermBinary with op set to
+ // EOpInitialize.
+ void appendDeclarator(TIntermTyped *declarator);
+
+ TIntermSequence *getSequence() override { return &mDeclarators; }
+ const TIntermSequence *getSequence() const override { return &mDeclarators; }
+
+ protected:
+ TIntermSequence mDeclarators;
+};
+
+// Specialized declarations for attributing invariance.
+class TIntermInvariantDeclaration : public TIntermNode
+{
+ public:
+ TIntermInvariantDeclaration(TIntermSymbol *symbol, const TSourceLoc &line);
+
+ virtual TIntermInvariantDeclaration *getAsInvariantDeclarationNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ TIntermSymbol *getSymbol() { return mSymbol; }
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ private:
+ TIntermSymbol *mSymbol;
+};
+
+// For ternary operators like a ? b : c.
+class TIntermTernary : public TIntermExpression
+{
+ public:
+ TIntermTernary(TIntermTyped *cond, TIntermTyped *trueExpression, TIntermTyped *falseExpression);
+
+ TIntermTernary *getAsTernaryNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ TIntermTyped *getCondition() const { return mCondition; }
+ TIntermTyped *getTrueExpression() const { return mTrueExpression; }
+ TIntermTyped *getFalseExpression() const { return mFalseExpression; }
+
+ TIntermTyped *deepCopy() const override { return new TIntermTernary(*this); }
+
+ bool hasSideEffects() const override
+ {
+ return mCondition->hasSideEffects() || mTrueExpression->hasSideEffects() ||
+ mFalseExpression->hasSideEffects();
+ }
+
+ TIntermTyped *fold(TDiagnostics *diagnostics) override;
+
+ private:
+ TIntermTernary(const TIntermTernary &node); // Note: not deleted, just private!
+
+ static TQualifier DetermineQualifier(TIntermTyped *cond,
+ TIntermTyped *trueExpression,
+ TIntermTyped *falseExpression);
+
+ TIntermTyped *mCondition;
+ TIntermTyped *mTrueExpression;
+ TIntermTyped *mFalseExpression;
+};
+
+class TIntermIfElse : public TIntermNode
+{
+ public:
+ TIntermIfElse(TIntermTyped *cond, TIntermBlock *trueB, TIntermBlock *falseB);
+
+ TIntermIfElse *getAsIfElseNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ TIntermTyped *getCondition() const { return mCondition; }
+ TIntermBlock *getTrueBlock() const { return mTrueBlock; }
+ TIntermBlock *getFalseBlock() const { return mFalseBlock; }
+
+ protected:
+ TIntermTyped *mCondition;
+ TIntermBlock *mTrueBlock;
+ TIntermBlock *mFalseBlock;
+};
+
+//
+// Switch statement.
+//
+class TIntermSwitch : public TIntermNode
+{
+ public:
+ TIntermSwitch(TIntermTyped *init, TIntermBlock *statementList);
+
+ TIntermSwitch *getAsSwitchNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ TIntermTyped *getInit() { return mInit; }
+ TIntermBlock *getStatementList() { return mStatementList; }
+
+ // Must be called with a non-null statementList.
+ void setStatementList(TIntermBlock *statementList);
+
+ protected:
+ TIntermTyped *mInit;
+ TIntermBlock *mStatementList;
+};
+
+//
+// Case label.
+//
+class TIntermCase : public TIntermNode
+{
+ public:
+ TIntermCase(TIntermTyped *condition) : TIntermNode(), mCondition(condition) {}
+
+ TIntermCase *getAsCaseNode() override { return this; }
+ bool visit(Visit visit, TIntermTraverser *it) final;
+
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+ bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
+
+ bool hasCondition() const { return mCondition != nullptr; }
+ TIntermTyped *getCondition() const { return mCondition; }
+
+ protected:
+ TIntermTyped *mCondition;
+};
+
+//
+// Preprocessor Directive.
+// #ifdef, #define, #if, #endif, etc.
+//
+
+enum class PreprocessorDirective
+{
+ Define,
+ Ifdef,
+ If,
+ Endif,
+};
+
+class TIntermPreprocessorDirective : public TIntermNode
+{
+ public:
+ // This could also take an ImmutbleString as an argument.
+ TIntermPreprocessorDirective(PreprocessorDirective directive, ImmutableString command);
+ ~TIntermPreprocessorDirective() final;
+
+ void traverse(TIntermTraverser *it) final;
+ bool visit(Visit visit, TIntermTraverser *it) final;
+ bool replaceChildNode(TIntermNode *, TIntermNode *) final { return false; }
+
+ TIntermPreprocessorDirective *getAsPreprocessorDirective() final { return this; }
+ size_t getChildCount() const final;
+ TIntermNode *getChildNode(size_t index) const final;
+
+ PreprocessorDirective getDirective() const { return mDirective; }
+ const ImmutableString &getCommand() const { return mCommand; }
+
+ private:
+ PreprocessorDirective mDirective;
+ ImmutableString mCommand;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_INTERMNODE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp b/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp
new file mode 100644
index 0000000000..73cb9d1833
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2017 The ANGLE Project 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/IsASTDepthBelowLimit.h"
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// Traverse the tree and compute max depth. Takes a maximum depth limit to prevent stack overflow.
+class MaxDepthTraverser : public TIntermTraverser
+{
+ public:
+ MaxDepthTraverser(int depthLimit) : TIntermTraverser(true, false, false, nullptr)
+ {
+ setMaxAllowedDepth(depthLimit);
+ }
+};
+
+} // anonymous namespace
+
+bool IsASTDepthBelowLimit(TIntermNode *root, int maxDepth)
+{
+ MaxDepthTraverser traverser(maxDepth + 1);
+ root->traverse(&traverser);
+
+ return traverser.getMaxDepth() <= maxDepth;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.h b/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.h
new file mode 100644
index 0000000000..ef2f02c974
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.h
@@ -0,0 +1,20 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// IsASTDepthBelowLimit: Check whether AST depth is below a specific limit.
+
+#ifndef COMPILER_TRANSLATOR_ISASTDEPTHBELOWLIMIT_H_
+#define COMPILER_TRANSLATOR_ISASTDEPTHBELOWLIMIT_H_
+
+namespace sh
+{
+
+class TIntermNode;
+
+bool IsASTDepthBelowLimit(TIntermNode *root, int maxDepth);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_ISASTDEPTHBELOWLIMIT_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Operator.cpp b/gfx/angle/checkout/src/compiler/translator/Operator.cpp
new file mode 100644
index 0000000000..ce6bf3d868
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Operator.cpp
@@ -0,0 +1,420 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/Operator.h"
+
+const char *GetOperatorString(TOperator op)
+{
+ switch (op)
+ {
+ // Note: EOpNull and EOpCall* can't be handled here.
+
+ case EOpNegative:
+ return "-";
+ case EOpPositive:
+ return "+";
+ case EOpLogicalNot:
+ return "!";
+ case EOpBitwiseNot:
+ return "~";
+
+ case EOpPostIncrement:
+ return "++";
+ case EOpPostDecrement:
+ return "--";
+ case EOpPreIncrement:
+ return "++";
+ case EOpPreDecrement:
+ return "--";
+
+ case EOpArrayLength:
+ return ".length()";
+
+ case EOpAdd:
+ return "+";
+ case EOpSub:
+ return "-";
+ case EOpMul:
+ return "*";
+ case EOpDiv:
+ return "/";
+ case EOpIMod:
+ return "%";
+
+ case EOpEqual:
+ return "==";
+ case EOpNotEqual:
+ return "!=";
+ case EOpLessThan:
+ return "<";
+ case EOpGreaterThan:
+ return ">";
+ case EOpLessThanEqual:
+ return "<=";
+ case EOpGreaterThanEqual:
+ return ">=";
+
+ case EOpEqualComponentWise:
+ return "equal";
+ case EOpNotEqualComponentWise:
+ return "notEqual";
+ case EOpLessThanComponentWise:
+ return "lessThan";
+ case EOpGreaterThanComponentWise:
+ return "greaterThan";
+ case EOpLessThanEqualComponentWise:
+ return "lessThanEqual";
+ case EOpGreaterThanEqualComponentWise:
+ return "greaterThanEqual";
+
+ case EOpComma:
+ return ",";
+
+ // Fall-through.
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesMatrix:
+ return "*";
+
+ case EOpLogicalOr:
+ return "||";
+ case EOpLogicalXor:
+ return "^^";
+ case EOpLogicalAnd:
+ return "&&";
+
+ case EOpBitShiftLeft:
+ return "<<";
+ case EOpBitShiftRight:
+ return ">>";
+
+ case EOpBitwiseAnd:
+ return "&";
+ case EOpBitwiseXor:
+ return "^";
+ case EOpBitwiseOr:
+ return "|";
+
+ // Fall-through.
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ return "[]";
+
+ case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock:
+ return ".";
+
+ case EOpRadians:
+ return "radians";
+ case EOpDegrees:
+ return "degrees";
+ case EOpSin:
+ return "sin";
+ case EOpCos:
+ return "cos";
+ case EOpTan:
+ return "tan";
+ case EOpAsin:
+ return "asin";
+ case EOpAcos:
+ return "acos";
+ case EOpAtan:
+ return "atan";
+
+ case EOpSinh:
+ return "sinh";
+ case EOpCosh:
+ return "cosh";
+ case EOpTanh:
+ return "tanh";
+ case EOpAsinh:
+ return "asinh";
+ case EOpAcosh:
+ return "acosh";
+ case EOpAtanh:
+ return "atanh";
+
+ case EOpPow:
+ return "pow";
+ case EOpExp:
+ return "exp";
+ case EOpLog:
+ return "log";
+ case EOpExp2:
+ return "exp2";
+ case EOpLog2:
+ return "log2";
+ case EOpSqrt:
+ return "sqrt";
+ case EOpInversesqrt:
+ return "inversesqrt";
+
+ case EOpAbs:
+ return "abs";
+ case EOpSign:
+ return "sign";
+ case EOpFloor:
+ return "floor";
+ case EOpTrunc:
+ return "trunc";
+ case EOpRound:
+ return "round";
+ case EOpRoundEven:
+ return "roundEven";
+ case EOpCeil:
+ return "ceil";
+ case EOpFract:
+ return "fract";
+ case EOpMod:
+ return "mod";
+ case EOpModf:
+ return "modf";
+ case EOpMin:
+ return "min";
+ case EOpMax:
+ return "max";
+ case EOpClamp:
+ return "clamp";
+ case EOpMix:
+ return "mix";
+ case EOpStep:
+ return "step";
+ case EOpSmoothstep:
+ return "smoothstep";
+ case EOpIsnan:
+ return "isnan";
+ case EOpIsinf:
+ return "isinf";
+
+ case EOpFloatBitsToInt:
+ return "floatBitsToInt";
+ case EOpFloatBitsToUint:
+ return "floatBitsToUint";
+ case EOpIntBitsToFloat:
+ return "intBitsToFloat";
+ case EOpUintBitsToFloat:
+ return "uintBitsToFloat";
+
+ case EOpFrexp:
+ return "frexp";
+ case EOpLdexp:
+ return "ldexp";
+
+ case EOpPackSnorm2x16:
+ return "packSnorm2x16";
+ case EOpPackUnorm2x16:
+ return "packUnorm2x16";
+ case EOpPackHalf2x16:
+ return "packHalf2x16";
+ case EOpUnpackSnorm2x16:
+ return "unpackSnorm2x16";
+ case EOpUnpackUnorm2x16:
+ return "unpackUnorm2x16";
+ case EOpUnpackHalf2x16:
+ return "unpackHalf2x16";
+
+ case EOpPackUnorm4x8:
+ return "packUnorm4x8";
+ case EOpPackSnorm4x8:
+ return "packSnorm4x8";
+ case EOpUnpackUnorm4x8:
+ return "unpackUnorm4x8";
+ case EOpUnpackSnorm4x8:
+ return "unpackSnorm4x8";
+
+ case EOpLength:
+ return "length";
+ case EOpDistance:
+ return "distance";
+ case EOpDot:
+ return "dot";
+ case EOpCross:
+ return "cross";
+ case EOpNormalize:
+ return "normalize";
+ case EOpFaceforward:
+ return "faceforward";
+ case EOpReflect:
+ return "reflect";
+ case EOpRefract:
+ return "refract";
+
+ case EOpDFdx:
+ return "dFdx";
+ case EOpDFdy:
+ return "dFdy";
+ case EOpFwidth:
+ return "fwidth";
+
+ case EOpMulMatrixComponentWise:
+ return "matrixCompMult";
+ case EOpOuterProduct:
+ return "outerProduct";
+ case EOpTranspose:
+ return "transpose";
+ case EOpDeterminant:
+ return "determinant";
+ case EOpInverse:
+ return "inverse";
+
+ case EOpAny:
+ return "any";
+ case EOpAll:
+ return "all";
+ case EOpLogicalNotComponentWise:
+ return "not";
+
+ case EOpBitfieldExtract:
+ return "bitfieldExtract";
+ case EOpBitfieldInsert:
+ return "bitfieldInsert";
+ case EOpBitfieldReverse:
+ return "bitfieldReverse";
+ case EOpBitCount:
+ return "bitCount";
+ case EOpFindLSB:
+ return "findLSB";
+ case EOpFindMSB:
+ return "findMSB";
+ case EOpUaddCarry:
+ return "uaddCarry";
+ case EOpUsubBorrow:
+ return "usubBorrow";
+ case EOpUmulExtended:
+ return "umulExtended";
+ case EOpImulExtended:
+ return "imulExtended";
+
+ case EOpKill:
+ return "kill";
+ case EOpReturn:
+ return "return";
+ case EOpBreak:
+ return "break";
+ case EOpContinue:
+ return "continue";
+
+ case EOpAssign:
+ return "=";
+ case EOpInitialize:
+ return "=";
+ case EOpAddAssign:
+ return "+=";
+ case EOpSubAssign:
+ return "-=";
+
+ // Fall-through.
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ return "*=";
+
+ case EOpDivAssign:
+ return "/=";
+ case EOpIModAssign:
+ return "%=";
+ case EOpBitShiftLeftAssign:
+ return "<<=";
+ case EOpBitShiftRightAssign:
+ return ">>=";
+ case EOpBitwiseAndAssign:
+ return "&=";
+ case EOpBitwiseXorAssign:
+ return "^=";
+ case EOpBitwiseOrAssign:
+ return "|=";
+ case EOpBarrier:
+ return "barrier";
+ case EOpMemoryBarrier:
+ return "memoryBarrier";
+ case EOpMemoryBarrierAtomicCounter:
+ return "memoryBarrierAtomicCounter";
+ case EOpMemoryBarrierBuffer:
+ return "memoryBarrierBuffer";
+ case EOpMemoryBarrierImage:
+ return "memoryBarrierImage";
+ case EOpMemoryBarrierShared:
+ return "memoryBarrierShared";
+ case EOpGroupMemoryBarrier:
+ return "groupMemoryBarrier";
+
+ case EOpAtomicAdd:
+ return "atomicAdd";
+ case EOpAtomicMin:
+ return "atomicMin";
+ case EOpAtomicMax:
+ return "atomicMax";
+ case EOpAtomicAnd:
+ return "atomicAnd";
+ case EOpAtomicOr:
+ return "atomicOr";
+ case EOpAtomicXor:
+ return "atomicXor";
+ case EOpAtomicExchange:
+ return "atomicExchange";
+ case EOpAtomicCompSwap:
+ return "atomicCompSwap";
+
+ case EOpEmitVertex:
+ return "EmitVertex";
+ case EOpEndPrimitive:
+ return "EndPrimitive";
+ default:
+ break;
+ }
+ return "";
+}
+
+bool IsAssignment(TOperator op)
+{
+ switch (op)
+ {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ case EOpAssign:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ case EOpDivAssign:
+ case EOpIModAssign:
+ case EOpBitShiftLeftAssign:
+ case EOpBitShiftRightAssign:
+ case EOpBitwiseAndAssign:
+ case EOpBitwiseXorAssign:
+ case EOpBitwiseOrAssign:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool IsAtomicFunction(TOperator op)
+{
+ switch (op)
+ {
+ case EOpAtomicAdd:
+ case EOpAtomicMin:
+ case EOpAtomicMax:
+ case EOpAtomicAnd:
+ case EOpAtomicOr:
+ case EOpAtomicXor:
+ case EOpAtomicExchange:
+ case EOpAtomicCompSwap:
+ return true;
+ default:
+ return false;
+ }
+} \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/Operator.h b/gfx/angle/checkout/src/compiler/translator/Operator.h
new file mode 100644
index 0000000000..e1540faa44
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Operator.h
@@ -0,0 +1,268 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_OPERATOR_H_
+#define COMPILER_TRANSLATOR_OPERATOR_H_
+
+//
+// Operators used by the high-level (parse tree) representation.
+//
+enum TOperator
+{
+ EOpNull, // if in a node, should only mean a node is still being built
+
+ // Call a function defined in the AST. This might be a user-defined function or a function
+ // inserted by an AST transformation.
+ EOpCallFunctionInAST,
+
+ // Call an internal helper function with a raw implementation - the implementation can't be
+ // subject to AST transformations. Raw functions have a few constraints to keep them compatible
+ // with AST traversers:
+ // * They should not return arrays.
+ // * They should not have out parameters.
+ EOpCallInternalRawFunction,
+
+ // Call a built-in function like a texture or image function.
+ EOpCallBuiltInFunction,
+
+ //
+ // Unary operators
+ //
+
+ EOpNegative,
+ EOpPositive,
+ EOpLogicalNot,
+ EOpBitwiseNot,
+
+ EOpPostIncrement,
+ EOpPostDecrement,
+ EOpPreIncrement,
+ EOpPreDecrement,
+
+ EOpArrayLength,
+
+ //
+ // binary operations (ones with special GLSL syntax are used in TIntermBinary nodes, others in
+ // TIntermAggregate nodes)
+ //
+
+ EOpAdd,
+ EOpSub,
+ EOpMul,
+ EOpDiv,
+ EOpIMod,
+
+ EOpEqual,
+ EOpNotEqual,
+ EOpLessThan,
+ EOpGreaterThan,
+ EOpLessThanEqual,
+ EOpGreaterThanEqual,
+
+ EOpEqualComponentWise,
+ EOpNotEqualComponentWise,
+ EOpLessThanComponentWise,
+ EOpLessThanEqualComponentWise,
+ EOpGreaterThanComponentWise,
+ EOpGreaterThanEqualComponentWise,
+
+ EOpComma,
+
+ EOpVectorTimesScalar,
+ EOpVectorTimesMatrix,
+ EOpMatrixTimesVector,
+ EOpMatrixTimesScalar,
+ EOpMatrixTimesMatrix,
+
+ EOpLogicalOr,
+ EOpLogicalXor,
+ EOpLogicalAnd,
+
+ EOpBitShiftLeft,
+ EOpBitShiftRight,
+
+ EOpBitwiseAnd,
+ EOpBitwiseXor,
+ EOpBitwiseOr,
+
+ EOpIndexDirect,
+ EOpIndexIndirect,
+ EOpIndexDirectStruct,
+ EOpIndexDirectInterfaceBlock,
+
+ //
+ // Built-in functions mapped to operators (either unary or with multiple parameters)
+ //
+
+ EOpRadians,
+ EOpDegrees,
+ EOpSin,
+ EOpCos,
+ EOpTan,
+ EOpAsin,
+ EOpAcos,
+ EOpAtan,
+
+ EOpSinh,
+ EOpCosh,
+ EOpTanh,
+ EOpAsinh,
+ EOpAcosh,
+ EOpAtanh,
+
+ EOpPow,
+ EOpExp,
+ EOpLog,
+ EOpExp2,
+ EOpLog2,
+ EOpSqrt,
+ EOpInversesqrt,
+
+ EOpAbs,
+ EOpSign,
+ EOpFloor,
+ EOpTrunc,
+ EOpRound,
+ EOpRoundEven,
+ EOpCeil,
+ EOpFract,
+ EOpMod,
+ EOpModf,
+ EOpMin,
+ EOpMax,
+ EOpClamp,
+ EOpMix,
+ EOpStep,
+ EOpSmoothstep,
+ EOpIsnan,
+ EOpIsinf,
+
+ EOpFloatBitsToInt,
+ EOpFloatBitsToUint,
+ EOpIntBitsToFloat,
+ EOpUintBitsToFloat,
+
+ EOpFrexp,
+ EOpLdexp,
+
+ EOpPackSnorm2x16,
+ EOpPackUnorm2x16,
+ EOpPackHalf2x16,
+ EOpUnpackSnorm2x16,
+ EOpUnpackUnorm2x16,
+ EOpUnpackHalf2x16,
+
+ EOpPackUnorm4x8,
+ EOpPackSnorm4x8,
+ EOpUnpackUnorm4x8,
+ EOpUnpackSnorm4x8,
+
+ EOpLength,
+ EOpDistance,
+ EOpDot,
+ EOpCross,
+ EOpNormalize,
+ EOpFaceforward,
+ EOpReflect,
+ EOpRefract,
+
+ EOpDFdx, // Fragment only, OES_standard_derivatives extension
+ EOpDFdy, // Fragment only, OES_standard_derivatives extension
+ EOpFwidth, // Fragment only, OES_standard_derivatives extension
+
+ EOpMulMatrixComponentWise,
+ EOpOuterProduct,
+ EOpTranspose,
+ EOpDeterminant,
+ EOpInverse,
+
+ EOpAny,
+ EOpAll,
+ EOpLogicalNotComponentWise,
+
+ EOpBitfieldExtract,
+ EOpBitfieldInsert,
+ EOpBitfieldReverse,
+ EOpBitCount,
+ EOpFindLSB,
+ EOpFindMSB,
+ EOpUaddCarry,
+ EOpUsubBorrow,
+ EOpUmulExtended,
+ EOpImulExtended,
+
+ //
+ // Branch
+ //
+
+ EOpKill, // Fragment only
+ EOpReturn,
+ EOpBreak,
+ EOpContinue,
+
+ //
+ // Constructor
+ //
+
+ EOpConstruct,
+
+ //
+ // moves
+ //
+
+ EOpAssign,
+ EOpInitialize,
+ EOpAddAssign,
+ EOpSubAssign,
+
+ EOpMulAssign,
+ EOpVectorTimesMatrixAssign,
+ EOpVectorTimesScalarAssign,
+ EOpMatrixTimesScalarAssign,
+ EOpMatrixTimesMatrixAssign,
+
+ EOpDivAssign,
+ EOpIModAssign,
+ EOpBitShiftLeftAssign,
+ EOpBitShiftRightAssign,
+ EOpBitwiseAndAssign,
+ EOpBitwiseXorAssign,
+ EOpBitwiseOrAssign,
+
+ // barriers
+ EOpBarrier,
+ EOpMemoryBarrier,
+ EOpMemoryBarrierAtomicCounter,
+ EOpMemoryBarrierBuffer,
+ EOpMemoryBarrierImage,
+ EOpMemoryBarrierShared,
+ EOpGroupMemoryBarrier,
+
+ // Atomic functions
+ EOpAtomicAdd,
+ EOpAtomicMin,
+ EOpAtomicMax,
+ EOpAtomicAnd,
+ EOpAtomicOr,
+ EOpAtomicXor,
+ EOpAtomicExchange,
+ EOpAtomicCompSwap,
+
+ // Geometry only
+ EOpEmitVertex,
+ EOpEndPrimitive
+};
+
+// Returns the string corresponding to the operator in GLSL
+const char *GetOperatorString(TOperator op);
+
+// Say whether or not a binary or unary operation changes the value of a variable.
+bool IsAssignment(TOperator op);
+
+// Say whether or not an operator represents an atomic function.
+bool IsAtomicFunction(TOperator op);
+
+#endif // COMPILER_TRANSLATOR_OPERATOR_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputESSL.cpp b/gfx/angle/checkout/src/compiler/translator/OutputESSL.cpp
new file mode 100644
index 0000000000..8d57eeae84
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputESSL.cpp
@@ -0,0 +1,46 @@
+//
+// 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.
+//
+
+#include "compiler/translator/OutputESSL.h"
+
+namespace sh
+{
+
+TOutputESSL::TOutputESSL(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable *symbolTable,
+ sh::GLenum shaderType,
+ int shaderVersion,
+ bool forceHighp,
+ ShCompileOptions compileOptions)
+ : TOutputGLSLBase(objSink,
+ clampingStrategy,
+ hashFunction,
+ nameMap,
+ symbolTable,
+ shaderType,
+ shaderVersion,
+ SH_ESSL_OUTPUT,
+ compileOptions),
+ mForceHighp(forceHighp)
+{}
+
+bool TOutputESSL::writeVariablePrecision(TPrecision precision)
+{
+ if (precision == EbpUndefined)
+ return false;
+
+ TInfoSinkBase &out = objSink();
+ if (mForceHighp)
+ out << getPrecisionString(EbpHigh);
+ else
+ out << getPrecisionString(precision);
+ return true;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputESSL.h b/gfx/angle/checkout/src/compiler/translator/OutputESSL.h
new file mode 100644
index 0000000000..e0c7bf2ae6
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputESSL.h
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_OUTPUTESSL_H_
+#define COMPILER_TRANSLATOR_OUTPUTESSL_H_
+
+#include "compiler/translator/OutputGLSLBase.h"
+
+namespace sh
+{
+
+class TOutputESSL : public TOutputGLSLBase
+{
+ public:
+ TOutputESSL(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable *symbolTable,
+ sh::GLenum shaderType,
+ int shaderVersion,
+ bool forceHighp,
+ ShCompileOptions compileOptions);
+
+ protected:
+ bool writeVariablePrecision(TPrecision precision) override;
+
+ private:
+ bool mForceHighp;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_OUTPUTESSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp
new file mode 100644
index 0000000000..ced5020ba3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp
@@ -0,0 +1,118 @@
+//
+// 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.
+//
+
+#include "compiler/translator/OutputGLSL.h"
+
+#include "compiler/translator/Compiler.h"
+
+namespace sh
+{
+
+TOutputGLSL::TOutputGLSL(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable *symbolTable,
+ sh::GLenum shaderType,
+ int shaderVersion,
+ ShShaderOutput output,
+ ShCompileOptions compileOptions)
+ : TOutputGLSLBase(objSink,
+ clampingStrategy,
+ hashFunction,
+ nameMap,
+ symbolTable,
+ shaderType,
+ shaderVersion,
+ output,
+ compileOptions)
+{}
+
+bool TOutputGLSL::writeVariablePrecision(TPrecision)
+{
+ return false;
+}
+
+void TOutputGLSL::visitSymbol(TIntermSymbol *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ // All the special cases are built-ins, so if it's not a built-in we can return early.
+ if (node->variable().symbolType() != SymbolType::BuiltIn)
+ {
+ TOutputGLSLBase::visitSymbol(node);
+ return;
+ }
+
+ // Some built-ins get a special translation.
+ const ImmutableString &name = node->getName();
+ if (name == "gl_FragDepthEXT")
+ {
+ out << "gl_FragDepth";
+ }
+ else if (name == "gl_FragColor" && sh::IsGLSL130OrNewer(getShaderOutput()))
+ {
+ out << "webgl_FragColor";
+ }
+ else if (name == "gl_FragData" && sh::IsGLSL130OrNewer(getShaderOutput()))
+ {
+ out << "webgl_FragData";
+ }
+ else if (name == "gl_SecondaryFragColorEXT")
+ {
+ out << "angle_SecondaryFragColor";
+ }
+ else if (name == "gl_SecondaryFragDataEXT")
+ {
+ out << "angle_SecondaryFragData";
+ }
+ else
+ {
+ TOutputGLSLBase::visitSymbol(node);
+ }
+}
+
+ImmutableString TOutputGLSL::translateTextureFunction(const ImmutableString &name)
+{
+ static const char *simpleRename[] = {"texture2DLodEXT",
+ "texture2DLod",
+ "texture2DProjLodEXT",
+ "texture2DProjLod",
+ "textureCubeLodEXT",
+ "textureCubeLod",
+ "texture2DGradEXT",
+ "texture2DGradARB",
+ "texture2DProjGradEXT",
+ "texture2DProjGradARB",
+ "textureCubeGradEXT",
+ "textureCubeGradARB",
+ nullptr,
+ nullptr};
+ static const char *legacyToCoreRename[] = {
+ "texture2D", "texture", "texture2DProj", "textureProj", "texture2DLod", "textureLod",
+ "texture2DProjLod", "textureProjLod", "texture2DRect", "texture", "texture2DRectProj",
+ "textureProj", "textureCube", "texture", "textureCubeLod", "textureLod",
+ // Extensions
+ "texture2DLodEXT", "textureLod", "texture2DProjLodEXT", "textureProjLod",
+ "textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad",
+ "texture2DProjGradEXT", "textureProjGrad", "textureCubeGradEXT", "textureGrad", "texture3D",
+ "texture", "texture3DProj", "textureProj", "texture3DLod", "textureLod", "texture3DProjLod",
+ "textureProjLod", nullptr, nullptr};
+ const char **mapping =
+ (sh::IsGLSL130OrNewer(getShaderOutput())) ? legacyToCoreRename : simpleRename;
+
+ for (int i = 0; mapping[i] != nullptr; i += 2)
+ {
+ if (name == mapping[i])
+ {
+ return ImmutableString(mapping[i + 1]);
+ }
+ }
+
+ return name;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputGLSL.h b/gfx/angle/checkout/src/compiler/translator/OutputGLSL.h
new file mode 100644
index 0000000000..b676a79932
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputGLSL.h
@@ -0,0 +1,36 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_OUTPUTGLSL_H_
+#define COMPILER_TRANSLATOR_OUTPUTGLSL_H_
+
+#include "compiler/translator/OutputGLSLBase.h"
+
+namespace sh
+{
+
+class TOutputGLSL : public TOutputGLSLBase
+{
+ public:
+ TOutputGLSL(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable *symbolTable,
+ sh::GLenum shaderType,
+ int shaderVersion,
+ ShShaderOutput output,
+ ShCompileOptions compileOptions);
+
+ protected:
+ bool writeVariablePrecision(TPrecision) override;
+ void visitSymbol(TIntermSymbol *node) override;
+ ImmutableString translateTextureFunction(const ImmutableString &name) override;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_OUTPUTGLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp
new file mode 100644
index 0000000000..eb830612ff
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp
@@ -0,0 +1,1433 @@
+//
+// 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/OutputGLSLBase.h"
+
+#include "angle_gl.h"
+#include "common/debug.h"
+#include "common/mathutil.h"
+#include "compiler/translator/Compiler.h"
+#include "compiler/translator/util.h"
+
+#include <cfloat>
+
+namespace sh
+{
+
+namespace
+{
+
+bool isSingleStatement(TIntermNode *node)
+{
+ if (node->getAsFunctionDefinition())
+ {
+ return false;
+ }
+ else if (node->getAsBlock())
+ {
+ return false;
+ }
+ else if (node->getAsIfElseNode())
+ {
+ return false;
+ }
+ else if (node->getAsLoopNode())
+ {
+ return false;
+ }
+ else if (node->getAsSwitchNode())
+ {
+ return false;
+ }
+ else if (node->getAsCaseNode())
+ {
+ return false;
+ }
+ else if (node->getAsPreprocessorDirective())
+ {
+ return false;
+ }
+ return true;
+}
+
+class CommaSeparatedListItemPrefixGenerator
+{
+ public:
+ CommaSeparatedListItemPrefixGenerator() : mFirst(true) {}
+
+ private:
+ bool mFirst;
+
+ template <typename Stream>
+ friend Stream &operator<<(Stream &out, CommaSeparatedListItemPrefixGenerator &gen);
+};
+
+template <typename Stream>
+Stream &operator<<(Stream &out, CommaSeparatedListItemPrefixGenerator &gen)
+{
+ if (gen.mFirst)
+ {
+ gen.mFirst = false;
+ }
+ else
+ {
+ out << ", ";
+ }
+ return out;
+}
+
+} // namespace
+
+TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable *symbolTable,
+ sh::GLenum shaderType,
+ int shaderVersion,
+ ShShaderOutput output,
+ ShCompileOptions compileOptions)
+ : TIntermTraverser(true, true, true, symbolTable),
+ mObjSink(objSink),
+ mDeclaringVariable(false),
+ mClampingStrategy(clampingStrategy),
+ mHashFunction(hashFunction),
+ mNameMap(nameMap),
+ mShaderType(shaderType),
+ mShaderVersion(shaderVersion),
+ mOutput(output),
+ mCompileOptions(compileOptions)
+{}
+
+void TOutputGLSLBase::writeInvariantQualifier(const TType &type)
+{
+ if (!sh::RemoveInvariant(mShaderType, mShaderVersion, mOutput, mCompileOptions))
+ {
+ TInfoSinkBase &out = objSink();
+ out << "invariant ";
+ }
+}
+
+void TOutputGLSLBase::writeFloat(TInfoSinkBase &out, float f)
+{
+ if ((gl::isInf(f) || gl::isNaN(f)) && mShaderVersion >= 300)
+ {
+ out << "uintBitsToFloat(" << gl::bitCast<uint32_t>(f) << "u)";
+ }
+ else
+ {
+ out << std::min(FLT_MAX, std::max(-FLT_MAX, f));
+ }
+}
+
+void TOutputGLSLBase::writeTriplet(Visit visit,
+ const char *preStr,
+ const char *inStr,
+ const char *postStr)
+{
+ TInfoSinkBase &out = objSink();
+ if (visit == PreVisit && preStr)
+ out << preStr;
+ else if (visit == InVisit && inStr)
+ out << inStr;
+ else if (visit == PostVisit && postStr)
+ out << postStr;
+}
+
+void TOutputGLSLBase::writeBuiltInFunctionTriplet(Visit visit,
+ TOperator op,
+ bool useEmulatedFunction)
+{
+ TInfoSinkBase &out = objSink();
+ if (visit == PreVisit)
+ {
+ const char *opStr(GetOperatorString(op));
+ if (useEmulatedFunction)
+ {
+ BuiltInFunctionEmulator::WriteEmulatedFunctionName(out, opStr);
+ }
+ else
+ {
+ out << opStr;
+ }
+ out << "(";
+ }
+ else
+ {
+ writeTriplet(visit, nullptr, ", ", ")");
+ }
+}
+
+// Outputs what goes inside layout(), except for location and binding qualifiers, as they are
+// handled differently between GL GLSL and Vulkan GLSL.
+std::string TOutputGLSLBase::getCommonLayoutQualifiers(TIntermTyped *variable)
+{
+ std::ostringstream out;
+ CommaSeparatedListItemPrefixGenerator listItemPrefix;
+
+ const TType &type = variable->getType();
+ const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
+
+ if (type.getQualifier() == EvqFragmentOut || type.getQualifier() == EvqVertexIn ||
+ IsVarying(type.getQualifier()))
+ {
+ if (type.getQualifier() == EvqFragmentOut && layoutQualifier.index >= 0)
+ {
+ out << listItemPrefix << "index = " << layoutQualifier.index;
+ }
+ }
+
+ if (type.getQualifier() == EvqFragmentOut)
+ {
+ if (layoutQualifier.yuv == true)
+ {
+ out << listItemPrefix << "yuv";
+ }
+ }
+
+ if (IsImage(type.getBasicType()))
+ {
+ if (layoutQualifier.imageInternalFormat != EiifUnspecified)
+ {
+ ASSERT(type.getQualifier() == EvqTemporary || type.getQualifier() == EvqUniform);
+ out << listItemPrefix
+ << getImageInternalFormatString(layoutQualifier.imageInternalFormat);
+ }
+ }
+
+ if (IsAtomicCounter(type.getBasicType()))
+ {
+ out << listItemPrefix << "offset = " << layoutQualifier.offset;
+ }
+
+ return out.str();
+}
+
+// Outputs what comes after in/out/uniform/buffer storage qualifier.
+std::string TOutputGLSLBase::getMemoryQualifiers(const TType &type)
+{
+ std::ostringstream out;
+
+ const TMemoryQualifier &memoryQualifier = type.getMemoryQualifier();
+ if (memoryQualifier.readonly)
+ {
+ ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
+ out << "readonly ";
+ }
+
+ if (memoryQualifier.writeonly)
+ {
+ ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
+ out << "writeonly ";
+ }
+
+ if (memoryQualifier.coherent)
+ {
+ ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
+ out << "coherent ";
+ }
+
+ if (memoryQualifier.restrictQualifier)
+ {
+ ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
+ out << "restrict ";
+ }
+
+ if (memoryQualifier.volatileQualifier)
+ {
+ ASSERT(IsImage(type.getBasicType()) || IsStorageBuffer(type.getQualifier()));
+ out << "volatile ";
+ }
+
+ return out.str();
+}
+
+void TOutputGLSLBase::writeLayoutQualifier(TIntermTyped *variable)
+{
+ const TType &type = variable->getType();
+
+ if (!NeedsToWriteLayoutQualifier(type))
+ {
+ return;
+ }
+
+ if (type.getBasicType() == EbtInterfaceBlock)
+ {
+ const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
+ declareInterfaceBlockLayout(interfaceBlock);
+ return;
+ }
+
+ TInfoSinkBase &out = objSink();
+ const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
+ out << "layout(";
+
+ CommaSeparatedListItemPrefixGenerator listItemPrefix;
+
+ if (type.getQualifier() == EvqFragmentOut || type.getQualifier() == EvqVertexIn ||
+ IsVarying(type.getQualifier()))
+ {
+ if (layoutQualifier.location >= 0)
+ {
+ out << listItemPrefix << "location = " << layoutQualifier.location;
+ }
+ }
+
+ if (IsOpaqueType(type.getBasicType()))
+ {
+ if (layoutQualifier.binding >= 0)
+ {
+ out << listItemPrefix << "binding = " << layoutQualifier.binding;
+ }
+ }
+
+ std::string otherQualifiers = getCommonLayoutQualifiers(variable);
+ if (!otherQualifiers.empty())
+ {
+ out << listItemPrefix << otherQualifiers;
+ }
+
+ out << ") ";
+}
+
+void TOutputGLSLBase::writeQualifier(TQualifier qualifier, const TType &type, const TSymbol *symbol)
+{
+ const char *result = mapQualifierToString(qualifier);
+ if (result && result[0] != '\0')
+ {
+ objSink() << result << " ";
+ }
+
+ objSink() << getMemoryQualifiers(type);
+}
+
+const char *TOutputGLSLBase::mapQualifierToString(TQualifier qualifier)
+{
+ if (sh::IsGLSL410OrOlder(mOutput) && mShaderVersion >= 300 &&
+ (mCompileOptions & SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3) != 0)
+ {
+ switch (qualifier)
+ {
+ // The return string is consistent with sh::getQualifierString() from
+ // BaseTypes.h minus the "centroid" keyword.
+ case EvqCentroid:
+ return "";
+ case EvqCentroidIn:
+ return "smooth in";
+ case EvqCentroidOut:
+ return "smooth out";
+ default:
+ break;
+ }
+ }
+ if (sh::IsGLSL130OrNewer(mOutput))
+ {
+ switch (qualifier)
+ {
+ case EvqAttribute:
+ return "in";
+ case EvqVaryingIn:
+ return "in";
+ case EvqVaryingOut:
+ return "out";
+ default:
+ break;
+ }
+ }
+ return sh::getQualifierString(qualifier);
+}
+
+void TOutputGLSLBase::writeVariableType(const TType &type, const TSymbol *symbol)
+{
+ TQualifier qualifier = type.getQualifier();
+ TInfoSinkBase &out = objSink();
+ if (type.isInvariant())
+ {
+ writeInvariantQualifier(type);
+ }
+ if (qualifier != EvqTemporary && qualifier != EvqGlobal)
+ {
+ writeQualifier(qualifier, type, symbol);
+ }
+
+ // Declare the struct if we have not done so already.
+ if (type.getBasicType() == EbtStruct && !structDeclared(type.getStruct()))
+ {
+ const TStructure *structure = type.getStruct();
+
+ declareStruct(structure);
+ }
+ else if (type.getBasicType() == EbtInterfaceBlock)
+ {
+ const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
+ declareInterfaceBlock(interfaceBlock);
+ }
+ else
+ {
+ if (writeVariablePrecision(type.getPrecision()))
+ out << " ";
+ out << getTypeName(type);
+ }
+}
+
+void TOutputGLSLBase::writeFunctionParameters(const TFunction *func)
+{
+ TInfoSinkBase &out = objSink();
+ size_t paramCount = func->getParamCount();
+ for (size_t i = 0; i < paramCount; ++i)
+ {
+ const TVariable *param = func->getParam(i);
+ const TType &type = param->getType();
+ writeVariableType(type, param);
+
+ if (param->symbolType() != SymbolType::Empty)
+ out << " " << hashName(param);
+ if (type.isArray())
+ out << ArrayString(type);
+
+ // Put a comma if this is not the last argument.
+ if (i != paramCount - 1)
+ out << ", ";
+ }
+}
+
+const TConstantUnion *TOutputGLSLBase::writeConstantUnion(const TType &type,
+ const TConstantUnion *pConstUnion)
+{
+ TInfoSinkBase &out = objSink();
+
+ if (type.getBasicType() == EbtStruct)
+ {
+ const TStructure *structure = type.getStruct();
+ out << hashName(structure) << "(";
+
+ const TFieldList &fields = structure->fields();
+ for (size_t i = 0; i < fields.size(); ++i)
+ {
+ const TType *fieldType = fields[i]->type();
+ ASSERT(fieldType != nullptr);
+ pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
+ if (i != fields.size() - 1)
+ out << ", ";
+ }
+ out << ")";
+ }
+ else
+ {
+ size_t size = type.getObjectSize();
+ bool writeType = size > 1;
+ if (writeType)
+ out << getTypeName(type) << "(";
+ for (size_t i = 0; i < size; ++i, ++pConstUnion)
+ {
+ switch (pConstUnion->getType())
+ {
+ case EbtFloat:
+ writeFloat(out, pConstUnion->getFConst());
+ break;
+ case EbtInt:
+ out << pConstUnion->getIConst();
+ break;
+ case EbtUInt:
+ out << pConstUnion->getUConst() << "u";
+ break;
+ case EbtBool:
+ out << pConstUnion->getBConst();
+ break;
+ case EbtYuvCscStandardEXT:
+ out << getYuvCscStandardEXTString(pConstUnion->getYuvCscStandardEXTConst());
+ break;
+ default:
+ UNREACHABLE();
+ }
+ if (i != size - 1)
+ out << ", ";
+ }
+ if (writeType)
+ out << ")";
+ }
+ return pConstUnion;
+}
+
+void TOutputGLSLBase::writeConstructorTriplet(Visit visit, const TType &type)
+{
+ TInfoSinkBase &out = objSink();
+ if (visit == PreVisit)
+ {
+ if (type.isArray())
+ {
+ out << getTypeName(type);
+ out << ArrayString(type);
+ out << "(";
+ }
+ else
+ {
+ out << getTypeName(type) << "(";
+ }
+ }
+ else
+ {
+ writeTriplet(visit, nullptr, ", ", ")");
+ }
+}
+
+void TOutputGLSLBase::visitSymbol(TIntermSymbol *node)
+{
+ TInfoSinkBase &out = objSink();
+ out << hashName(&node->variable());
+
+ if (mDeclaringVariable && node->getType().isArray())
+ out << ArrayString(node->getType());
+}
+
+void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion *node)
+{
+ writeConstantUnion(node->getType(), node->getConstantValue());
+}
+
+bool TOutputGLSLBase::visitSwizzle(Visit visit, TIntermSwizzle *node)
+{
+ TInfoSinkBase &out = objSink();
+ if (visit == PostVisit)
+ {
+ out << ".";
+ node->writeOffsetsAsXYZW(&out);
+ }
+ return true;
+}
+
+bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary *node)
+{
+ bool visitChildren = true;
+ TInfoSinkBase &out = objSink();
+ switch (node->getOp())
+ {
+ case EOpComma:
+ writeTriplet(visit, "(", ", ", ")");
+ break;
+ case EOpInitialize:
+ if (visit == InVisit)
+ {
+ out << " = ";
+ // RHS of initialize is not being declared.
+ mDeclaringVariable = false;
+ }
+ break;
+ case EOpAssign:
+ writeTriplet(visit, "(", " = ", ")");
+ break;
+ case EOpAddAssign:
+ writeTriplet(visit, "(", " += ", ")");
+ break;
+ case EOpSubAssign:
+ writeTriplet(visit, "(", " -= ", ")");
+ break;
+ case EOpDivAssign:
+ writeTriplet(visit, "(", " /= ", ")");
+ break;
+ case EOpIModAssign:
+ writeTriplet(visit, "(", " %= ", ")");
+ break;
+ // Notice the fall-through.
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ writeTriplet(visit, "(", " *= ", ")");
+ break;
+ case EOpBitShiftLeftAssign:
+ writeTriplet(visit, "(", " <<= ", ")");
+ break;
+ case EOpBitShiftRightAssign:
+ writeTriplet(visit, "(", " >>= ", ")");
+ break;
+ case EOpBitwiseAndAssign:
+ writeTriplet(visit, "(", " &= ", ")");
+ break;
+ case EOpBitwiseXorAssign:
+ writeTriplet(visit, "(", " ^= ", ")");
+ break;
+ case EOpBitwiseOrAssign:
+ writeTriplet(visit, "(", " |= ", ")");
+ break;
+
+ case EOpIndexDirect:
+ writeTriplet(visit, nullptr, "[", "]");
+ break;
+ case EOpIndexIndirect:
+ if (node->getAddIndexClamp())
+ {
+ if (visit == InVisit)
+ {
+ if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC)
+ out << "[int(clamp(float(";
+ else
+ out << "[webgl_int_clamp(";
+ }
+ else if (visit == PostVisit)
+ {
+ TIntermTyped *left = node->getLeft();
+ TType leftType = left->getType();
+
+ if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC)
+ out << "), 0.0, float(";
+ else
+ out << ", 0, ";
+
+ if (leftType.isUnsizedArray())
+ {
+ // For runtime-sized arrays in ESSL 3.10 we need to call the length method
+ // to get the length to clamp against. See ESSL 3.10 section 4.1.9. Note
+ // that a runtime-sized array expression is guaranteed not to have side
+ // effects, so it's fine to add the expression to the output twice.
+ ASSERT(mShaderVersion >= 310);
+ ASSERT(!left->hasSideEffects());
+ left->traverse(this);
+ out << ".length() - 1";
+ }
+ else
+ {
+ int maxSize;
+ if (leftType.isArray())
+ {
+ maxSize = static_cast<int>(leftType.getOutermostArraySize()) - 1;
+ }
+ else
+ {
+ maxSize = leftType.getNominalSize() - 1;
+ }
+ out << maxSize;
+ }
+ if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC)
+ out << ")))]";
+ else
+ out << ")]";
+ }
+ }
+ else
+ {
+ writeTriplet(visit, nullptr, "[", "]");
+ }
+ break;
+ case EOpIndexDirectStruct:
+ if (visit == InVisit)
+ {
+ // Here we are writing out "foo.bar", where "foo" is struct
+ // and "bar" is field. In AST, it is represented as a binary
+ // node, where left child represents "foo" and right child "bar".
+ // The node itself represents ".". The struct field "bar" is
+ // actually stored as an index into TStructure::fields.
+ out << ".";
+ const TStructure *structure = node->getLeft()->getType().getStruct();
+ const TIntermConstantUnion *index = node->getRight()->getAsConstantUnion();
+ const TField *field = structure->fields()[index->getIConst(0)];
+
+ out << hashFieldName(field);
+ visitChildren = false;
+ }
+ break;
+ case EOpIndexDirectInterfaceBlock:
+ if (visit == InVisit)
+ {
+ out << ".";
+ const TInterfaceBlock *interfaceBlock =
+ node->getLeft()->getType().getInterfaceBlock();
+ const TIntermConstantUnion *index = node->getRight()->getAsConstantUnion();
+ const TField *field = interfaceBlock->fields()[index->getIConst(0)];
+ out << hashFieldName(field);
+ visitChildren = false;
+ }
+ break;
+
+ case EOpAdd:
+ writeTriplet(visit, "(", " + ", ")");
+ break;
+ case EOpSub:
+ writeTriplet(visit, "(", " - ", ")");
+ break;
+ case EOpMul:
+ writeTriplet(visit, "(", " * ", ")");
+ break;
+ case EOpDiv:
+ writeTriplet(visit, "(", " / ", ")");
+ break;
+ case EOpIMod:
+ writeTriplet(visit, "(", " % ", ")");
+ break;
+ case EOpBitShiftLeft:
+ writeTriplet(visit, "(", " << ", ")");
+ break;
+ case EOpBitShiftRight:
+ writeTriplet(visit, "(", " >> ", ")");
+ break;
+ case EOpBitwiseAnd:
+ writeTriplet(visit, "(", " & ", ")");
+ break;
+ case EOpBitwiseXor:
+ writeTriplet(visit, "(", " ^ ", ")");
+ break;
+ case EOpBitwiseOr:
+ writeTriplet(visit, "(", " | ", ")");
+ break;
+
+ case EOpEqual:
+ writeTriplet(visit, "(", " == ", ")");
+ break;
+ case EOpNotEqual:
+ writeTriplet(visit, "(", " != ", ")");
+ break;
+ case EOpLessThan:
+ writeTriplet(visit, "(", " < ", ")");
+ break;
+ case EOpGreaterThan:
+ writeTriplet(visit, "(", " > ", ")");
+ break;
+ case EOpLessThanEqual:
+ writeTriplet(visit, "(", " <= ", ")");
+ break;
+ case EOpGreaterThanEqual:
+ writeTriplet(visit, "(", " >= ", ")");
+ break;
+
+ // Notice the fall-through.
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesMatrix:
+ writeTriplet(visit, "(", " * ", ")");
+ break;
+
+ case EOpLogicalOr:
+ writeTriplet(visit, "(", " || ", ")");
+ break;
+ case EOpLogicalXor:
+ writeTriplet(visit, "(", " ^^ ", ")");
+ break;
+ case EOpLogicalAnd:
+ writeTriplet(visit, "(", " && ", ")");
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return visitChildren;
+}
+
+bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node)
+{
+ const char *preString = "";
+ const char *postString = ")";
+
+ switch (node->getOp())
+ {
+ case EOpNegative:
+ preString = "(-";
+ break;
+ case EOpPositive:
+ preString = "(+";
+ break;
+ case EOpLogicalNot:
+ preString = "(!";
+ break;
+ case EOpBitwiseNot:
+ preString = "(~";
+ break;
+
+ case EOpPostIncrement:
+ preString = "(";
+ postString = "++)";
+ break;
+ case EOpPostDecrement:
+ preString = "(";
+ postString = "--)";
+ break;
+ case EOpPreIncrement:
+ preString = "(++";
+ break;
+ case EOpPreDecrement:
+ preString = "(--";
+ break;
+ case EOpArrayLength:
+ preString = "((";
+ postString = ").length())";
+ break;
+
+ case EOpRadians:
+ case EOpDegrees:
+ case EOpSin:
+ case EOpCos:
+ case EOpTan:
+ case EOpAsin:
+ case EOpAcos:
+ case EOpAtan:
+ case EOpSinh:
+ case EOpCosh:
+ case EOpTanh:
+ case EOpAsinh:
+ case EOpAcosh:
+ case EOpAtanh:
+ case EOpExp:
+ case EOpLog:
+ case EOpExp2:
+ case EOpLog2:
+ case EOpSqrt:
+ case EOpInversesqrt:
+ case EOpAbs:
+ case EOpSign:
+ case EOpFloor:
+ case EOpTrunc:
+ case EOpRound:
+ case EOpRoundEven:
+ case EOpCeil:
+ case EOpFract:
+ case EOpIsnan:
+ case EOpIsinf:
+ case EOpFloatBitsToInt:
+ case EOpFloatBitsToUint:
+ case EOpIntBitsToFloat:
+ case EOpUintBitsToFloat:
+ case EOpPackSnorm2x16:
+ case EOpPackUnorm2x16:
+ case EOpPackHalf2x16:
+ case EOpUnpackSnorm2x16:
+ case EOpUnpackUnorm2x16:
+ case EOpUnpackHalf2x16:
+ case EOpPackUnorm4x8:
+ case EOpPackSnorm4x8:
+ case EOpUnpackUnorm4x8:
+ case EOpUnpackSnorm4x8:
+ case EOpLength:
+ case EOpNormalize:
+ case EOpDFdx:
+ case EOpDFdy:
+ case EOpFwidth:
+ case EOpTranspose:
+ case EOpDeterminant:
+ case EOpInverse:
+ case EOpAny:
+ case EOpAll:
+ case EOpLogicalNotComponentWise:
+ case EOpBitfieldReverse:
+ case EOpBitCount:
+ case EOpFindLSB:
+ case EOpFindMSB:
+ writeBuiltInFunctionTriplet(visit, node->getOp(), node->getUseEmulatedFunction());
+ return true;
+ default:
+ UNREACHABLE();
+ }
+
+ writeTriplet(visit, preString, nullptr, postString);
+
+ return true;
+}
+
+bool TOutputGLSLBase::visitTernary(Visit visit, TIntermTernary *node)
+{
+ TInfoSinkBase &out = objSink();
+ // Notice two brackets at the beginning and end. The outer ones
+ // encapsulate the whole ternary expression. This preserves the
+ // order of precedence when ternary expressions are used in a
+ // compound expression, i.e., c = 2 * (a < b ? 1 : 2).
+ out << "((";
+ node->getCondition()->traverse(this);
+ out << ") ? (";
+ node->getTrueExpression()->traverse(this);
+ out << ") : (";
+ node->getFalseExpression()->traverse(this);
+ out << "))";
+ return false;
+}
+
+bool TOutputGLSLBase::visitIfElse(Visit visit, TIntermIfElse *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ out << "if (";
+ node->getCondition()->traverse(this);
+ out << ")\n";
+
+ visitCodeBlock(node->getTrueBlock());
+
+ if (node->getFalseBlock())
+ {
+ out << "else\n";
+ visitCodeBlock(node->getFalseBlock());
+ }
+ return false;
+}
+
+bool TOutputGLSLBase::visitSwitch(Visit visit, TIntermSwitch *node)
+{
+ ASSERT(node->getStatementList());
+ writeTriplet(visit, "switch (", ") ", nullptr);
+ // The curly braces get written when visiting the statementList aggregate
+ return true;
+}
+
+bool TOutputGLSLBase::visitCase(Visit visit, TIntermCase *node)
+{
+ if (node->hasCondition())
+ {
+ writeTriplet(visit, "case (", nullptr, "):\n");
+ return true;
+ }
+ else
+ {
+ TInfoSinkBase &out = objSink();
+ out << "default:\n";
+ return false;
+ }
+}
+
+bool TOutputGLSLBase::visitBlock(Visit visit, TIntermBlock *node)
+{
+ TInfoSinkBase &out = objSink();
+ // Scope the blocks except when at the global scope.
+ if (getCurrentTraversalDepth() > 0)
+ {
+ out << "{\n";
+ }
+
+ for (TIntermSequence::const_iterator iter = node->getSequence()->begin();
+ iter != node->getSequence()->end(); ++iter)
+ {
+ TIntermNode *curNode = *iter;
+ ASSERT(curNode != nullptr);
+ curNode->traverse(this);
+
+ if (isSingleStatement(curNode))
+ out << ";\n";
+ }
+
+ // Scope the blocks except when at the global scope.
+ if (getCurrentTraversalDepth() > 0)
+ {
+ out << "}\n";
+ }
+ return false;
+}
+
+bool TOutputGLSLBase::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
+{
+ TIntermFunctionPrototype *prototype = node->getFunctionPrototype();
+ prototype->traverse(this);
+ visitCodeBlock(node->getBody());
+
+ // Fully processed; no need to visit children.
+ return false;
+}
+
+bool TOutputGLSLBase::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
+{
+ TInfoSinkBase &out = objSink();
+ ASSERT(visit == PreVisit);
+ const TIntermSymbol *symbol = node->getSymbol();
+ out << "invariant " << hashName(&symbol->variable());
+ return false;
+}
+
+void TOutputGLSLBase::visitFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ const TType &type = node->getType();
+ writeVariableType(type, node->getFunction());
+ if (type.isArray())
+ out << ArrayString(type);
+
+ out << " " << hashFunctionNameIfNeeded(node->getFunction());
+
+ out << "(";
+ writeFunctionParameters(node->getFunction());
+ out << ")";
+}
+
+bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ bool visitChildren = true;
+ TInfoSinkBase &out = objSink();
+ switch (node->getOp())
+ {
+ case EOpCallFunctionInAST:
+ case EOpCallInternalRawFunction:
+ case EOpCallBuiltInFunction:
+ // Function call.
+ if (visit == PreVisit)
+ {
+ if (node->getOp() == EOpCallBuiltInFunction)
+ {
+ out << translateTextureFunction(node->getFunction()->name());
+ }
+ else
+ {
+ out << hashFunctionNameIfNeeded(node->getFunction());
+ }
+ out << "(";
+ }
+ else if (visit == InVisit)
+ out << ", ";
+ else
+ out << ")";
+ break;
+ case EOpConstruct:
+ writeConstructorTriplet(visit, node->getType());
+ break;
+
+ case EOpEqualComponentWise:
+ case EOpNotEqualComponentWise:
+ case EOpLessThanComponentWise:
+ case EOpGreaterThanComponentWise:
+ case EOpLessThanEqualComponentWise:
+ case EOpGreaterThanEqualComponentWise:
+ case EOpMod:
+ case EOpModf:
+ case EOpPow:
+ case EOpAtan:
+ case EOpMin:
+ case EOpMax:
+ case EOpClamp:
+ case EOpMix:
+ case EOpStep:
+ case EOpSmoothstep:
+ case EOpFrexp:
+ case EOpLdexp:
+ case EOpDistance:
+ case EOpDot:
+ case EOpCross:
+ case EOpFaceforward:
+ case EOpReflect:
+ case EOpRefract:
+ case EOpMulMatrixComponentWise:
+ case EOpOuterProduct:
+ case EOpBitfieldExtract:
+ case EOpBitfieldInsert:
+ case EOpUaddCarry:
+ case EOpUsubBorrow:
+ case EOpUmulExtended:
+ case EOpImulExtended:
+ case EOpBarrier:
+ case EOpMemoryBarrier:
+ case EOpMemoryBarrierAtomicCounter:
+ case EOpMemoryBarrierBuffer:
+ case EOpMemoryBarrierImage:
+ case EOpMemoryBarrierShared:
+ case EOpGroupMemoryBarrier:
+ case EOpAtomicAdd:
+ case EOpAtomicMin:
+ case EOpAtomicMax:
+ case EOpAtomicAnd:
+ case EOpAtomicOr:
+ case EOpAtomicXor:
+ case EOpAtomicExchange:
+ case EOpAtomicCompSwap:
+ case EOpEmitVertex:
+ case EOpEndPrimitive:
+ writeBuiltInFunctionTriplet(visit, node->getOp(), node->getUseEmulatedFunction());
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return visitChildren;
+}
+
+bool TOutputGLSLBase::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ // Variable declaration.
+ if (visit == PreVisit)
+ {
+ const TIntermSequence &sequence = *(node->getSequence());
+ TIntermTyped *variable = sequence.front()->getAsTyped();
+ writeLayoutQualifier(variable);
+ TIntermSymbol *symbolNode = variable->getAsSymbolNode();
+ writeVariableType(variable->getType(), symbolNode ? &symbolNode->variable() : nullptr);
+ if (variable->getAsSymbolNode() == nullptr ||
+ variable->getAsSymbolNode()->variable().symbolType() != SymbolType::Empty)
+ {
+ out << " ";
+ }
+ mDeclaringVariable = true;
+ }
+ else if (visit == InVisit)
+ {
+ UNREACHABLE();
+ }
+ else
+ {
+ mDeclaringVariable = false;
+ }
+ return true;
+}
+
+bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ TLoopType loopType = node->getType();
+
+ if (loopType == ELoopFor) // for loop
+ {
+ out << "for (";
+ if (node->getInit())
+ node->getInit()->traverse(this);
+ out << "; ";
+
+ if (node->getCondition())
+ node->getCondition()->traverse(this);
+ out << "; ";
+
+ if (node->getExpression())
+ node->getExpression()->traverse(this);
+ out << ")\n";
+
+ visitCodeBlock(node->getBody());
+ }
+ else if (loopType == ELoopWhile) // while loop
+ {
+ out << "while (";
+ ASSERT(node->getCondition() != nullptr);
+ node->getCondition()->traverse(this);
+ out << ")\n";
+
+ visitCodeBlock(node->getBody());
+ }
+ else // do-while loop
+ {
+ ASSERT(loopType == ELoopDoWhile);
+ out << "do\n";
+
+ visitCodeBlock(node->getBody());
+
+ out << "while (";
+ ASSERT(node->getCondition() != nullptr);
+ node->getCondition()->traverse(this);
+ out << ");\n";
+ }
+
+ // No need to visit children. They have been already processed in
+ // this function.
+ return false;
+}
+
+bool TOutputGLSLBase::visitBranch(Visit visit, TIntermBranch *node)
+{
+ switch (node->getFlowOp())
+ {
+ case EOpKill:
+ writeTriplet(visit, "discard", nullptr, nullptr);
+ break;
+ case EOpBreak:
+ writeTriplet(visit, "break", nullptr, nullptr);
+ break;
+ case EOpContinue:
+ writeTriplet(visit, "continue", nullptr, nullptr);
+ break;
+ case EOpReturn:
+ writeTriplet(visit, "return ", nullptr, nullptr);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return true;
+}
+
+void TOutputGLSLBase::visitCodeBlock(TIntermBlock *node)
+{
+ TInfoSinkBase &out = objSink();
+ if (node != nullptr)
+ {
+ node->traverse(this);
+ // Single statements not part of a sequence need to be terminated
+ // with semi-colon.
+ if (isSingleStatement(node))
+ out << ";\n";
+ }
+ else
+ {
+ out << "{\n}\n"; // Empty code block.
+ }
+}
+
+void TOutputGLSLBase::visitPreprocessorDirective(TIntermPreprocessorDirective *node)
+{
+ TInfoSinkBase &out = objSink();
+
+ out << "\n";
+
+ switch (node->getDirective())
+ {
+ case PreprocessorDirective::Define:
+ out << "#define";
+ break;
+ case PreprocessorDirective::Endif:
+ out << "#endif";
+ break;
+ case PreprocessorDirective::If:
+ out << "#if";
+ break;
+ case PreprocessorDirective::Ifdef:
+ out << "#ifdef";
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ if (!node->getCommand().empty())
+ {
+ out << " " << node->getCommand();
+ }
+
+ out << "\n";
+}
+
+ImmutableString TOutputGLSLBase::getTypeName(const TType &type)
+{
+ return GetTypeName(type, mHashFunction, &mNameMap);
+}
+
+ImmutableString TOutputGLSLBase::hashName(const TSymbol *symbol)
+{
+ return HashName(symbol, mHashFunction, &mNameMap);
+}
+
+ImmutableString TOutputGLSLBase::hashFieldName(const TField *field)
+{
+ ASSERT(field->symbolType() != SymbolType::Empty);
+ if (field->symbolType() == SymbolType::UserDefined)
+ {
+ return HashName(field->name(), mHashFunction, &mNameMap);
+ }
+
+ return field->name();
+}
+
+ImmutableString TOutputGLSLBase::hashFunctionNameIfNeeded(const TFunction *func)
+{
+ if (func->isMain())
+ {
+ return func->name();
+ }
+ else
+ {
+ return hashName(func);
+ }
+}
+
+bool TOutputGLSLBase::structDeclared(const TStructure *structure) const
+{
+ ASSERT(structure);
+ if (structure->symbolType() == SymbolType::Empty)
+ {
+ return false;
+ }
+
+ return (mDeclaredStructs.count(structure->uniqueId().get()) > 0);
+}
+
+void TOutputGLSLBase::declareStruct(const TStructure *structure)
+{
+ TInfoSinkBase &out = objSink();
+
+ out << "struct ";
+
+ if (structure->symbolType() != SymbolType::Empty)
+ {
+ out << hashName(structure) << " ";
+ }
+ out << "{\n";
+ const TFieldList &fields = structure->fields();
+ for (size_t i = 0; i < fields.size(); ++i)
+ {
+ const TField *field = fields[i];
+ if (writeVariablePrecision(field->type()->getPrecision()))
+ out << " ";
+ out << getTypeName(*field->type()) << " " << hashFieldName(field);
+ if (field->type()->isArray())
+ out << ArrayString(*field->type());
+ out << ";\n";
+ }
+ out << "}";
+
+ if (structure->symbolType() != SymbolType::Empty)
+ {
+ mDeclaredStructs.insert(structure->uniqueId().get());
+ }
+}
+
+void TOutputGLSLBase::declareInterfaceBlockLayout(const TInterfaceBlock *interfaceBlock)
+{
+ TInfoSinkBase &out = objSink();
+
+ out << "layout(";
+
+ switch (interfaceBlock->blockStorage())
+ {
+ case EbsUnspecified:
+ case EbsShared:
+ // Default block storage is shared.
+ out << "shared";
+ break;
+
+ case EbsPacked:
+ out << "packed";
+ break;
+
+ case EbsStd140:
+ out << "std140";
+ break;
+
+ case EbsStd430:
+ out << "std430";
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ if (interfaceBlock->blockBinding() >= 0)
+ {
+ out << ", ";
+ out << "binding = " << interfaceBlock->blockBinding();
+ }
+
+ out << ") ";
+}
+
+void TOutputGLSLBase::declareInterfaceBlock(const TInterfaceBlock *interfaceBlock)
+{
+ TInfoSinkBase &out = objSink();
+
+ out << hashName(interfaceBlock) << "{\n";
+ const TFieldList &fields = interfaceBlock->fields();
+ for (const TField *field : fields)
+ {
+ if (field->type()->isMatrix() || field->type()->isStructureContainingMatrices())
+ {
+ out << "layout(";
+ switch (field->type()->getLayoutQualifier().matrixPacking)
+ {
+ case EmpUnspecified:
+ case EmpColumnMajor:
+ // Default matrix packing is column major.
+ out << "column_major";
+ break;
+
+ case EmpRowMajor:
+ out << "row_major";
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+ out << ") ";
+ }
+
+ if (writeVariablePrecision(field->type()->getPrecision()))
+ out << " ";
+ out << getTypeName(*field->type()) << " " << hashFieldName(field);
+ if (field->type()->isArray())
+ out << ArrayString(*field->type());
+ out << ";\n";
+ }
+ out << "}";
+}
+
+void WriteGeometryShaderLayoutQualifiers(TInfoSinkBase &out,
+ sh::TLayoutPrimitiveType inputPrimitive,
+ int invocations,
+ sh::TLayoutPrimitiveType outputPrimitive,
+ int maxVertices)
+{
+ // Omit 'invocations = 1'
+ if (inputPrimitive != EptUndefined || invocations > 1)
+ {
+ out << "layout (";
+
+ if (inputPrimitive != EptUndefined)
+ {
+ out << getGeometryShaderPrimitiveTypeString(inputPrimitive);
+ }
+
+ if (invocations > 1)
+ {
+ if (inputPrimitive != EptUndefined)
+ {
+ out << ", ";
+ }
+ out << "invocations = " << invocations;
+ }
+ out << ") in;\n";
+ }
+
+ if (outputPrimitive != EptUndefined || maxVertices != -1)
+ {
+ out << "layout (";
+
+ if (outputPrimitive != EptUndefined)
+ {
+ out << getGeometryShaderPrimitiveTypeString(outputPrimitive);
+ }
+
+ if (maxVertices != -1)
+ {
+ if (outputPrimitive != EptUndefined)
+ {
+ out << ", ";
+ }
+ out << "max_vertices = " << maxVertices;
+ }
+ out << ") out;\n";
+ }
+}
+
+// If SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS is enabled, layout qualifiers are spilled whenever
+// variables with specified layout qualifiers are copied. Additional checks are needed against the
+// type and storage qualifier of the variable to verify that layout qualifiers have to be outputted.
+// TODO (mradev): Fix layout qualifier spilling in ScalarizeVecAndMatConstructorArgs and remove
+// NeedsToWriteLayoutQualifier.
+bool NeedsToWriteLayoutQualifier(const TType &type)
+{
+ if (type.getBasicType() == EbtInterfaceBlock)
+ {
+ return true;
+ }
+
+ const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
+
+ if ((type.getQualifier() == EvqFragmentOut || type.getQualifier() == EvqVertexIn ||
+ IsVarying(type.getQualifier())) &&
+ layoutQualifier.location >= 0)
+ {
+ return true;
+ }
+
+ if (type.getQualifier() == EvqFragmentOut && layoutQualifier.yuv == true)
+ {
+ return true;
+ }
+
+ if (IsOpaqueType(type.getBasicType()) && layoutQualifier.binding != -1)
+ {
+ return true;
+ }
+
+ if (IsImage(type.getBasicType()) && layoutQualifier.imageInternalFormat != EiifUnspecified)
+ {
+ return true;
+ }
+ return false;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h
new file mode 100644
index 0000000000..d6f9416f33
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h
@@ -0,0 +1,125 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_OUTPUTGLSLBASE_H_
+#define COMPILER_TRANSLATOR_OUTPUTGLSLBASE_H_
+
+#include <set>
+
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+class TOutputGLSLBase : public TIntermTraverser
+{
+ public:
+ TOutputGLSLBase(TInfoSinkBase &objSink,
+ ShArrayIndexClampingStrategy clampingStrategy,
+ ShHashFunction64 hashFunction,
+ NameMap &nameMap,
+ TSymbolTable *symbolTable,
+ sh::GLenum shaderType,
+ int shaderVersion,
+ ShShaderOutput output,
+ ShCompileOptions compileOptions);
+
+ ShShaderOutput getShaderOutput() const { return mOutput; }
+
+ // Return the original name if hash function pointer is NULL;
+ // otherwise return the hashed name. Has special handling for internal names and built-ins,
+ // which are not hashed.
+ ImmutableString hashName(const TSymbol *symbol);
+
+ protected:
+ TInfoSinkBase &objSink() { return mObjSink; }
+ void writeFloat(TInfoSinkBase &out, float f);
+ void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr);
+ std::string getCommonLayoutQualifiers(TIntermTyped *variable);
+ std::string getMemoryQualifiers(const TType &type);
+ virtual void writeLayoutQualifier(TIntermTyped *variable);
+ void writeInvariantQualifier(const TType &type);
+ virtual void writeVariableType(const TType &type, const TSymbol *symbol);
+ virtual bool writeVariablePrecision(TPrecision precision) = 0;
+ void writeFunctionParameters(const TFunction *func);
+ const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *pConstUnion);
+ void writeConstructorTriplet(Visit visit, const TType &type);
+ ImmutableString getTypeName(const TType &type);
+
+ void visitSymbol(TIntermSymbol *node) override;
+ void visitConstantUnion(TIntermConstantUnion *node) override;
+ bool visitSwizzle(Visit visit, TIntermSwizzle *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override;
+ bool visitSwitch(Visit visit, TIntermSwitch *node) override;
+ bool visitCase(Visit visit, TIntermCase *node) override;
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitBlock(Visit visit, TIntermBlock *node) override;
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override;
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+ bool visitLoop(Visit visit, TIntermLoop *node) override;
+ bool visitBranch(Visit visit, TIntermBranch *node) override;
+ void visitPreprocessorDirective(TIntermPreprocessorDirective *node) override;
+
+ void visitCodeBlock(TIntermBlock *node);
+
+ ImmutableString hashFieldName(const TField *field);
+ // Same as hashName(), but without hashing "main".
+ ImmutableString hashFunctionNameIfNeeded(const TFunction *func);
+ // Used to translate function names for differences between ESSL and GLSL
+ virtual ImmutableString translateTextureFunction(const ImmutableString &name) { return name; }
+
+ void declareStruct(const TStructure *structure);
+ virtual void writeQualifier(TQualifier qualifier, const TType &type, const TSymbol *symbol);
+ bool structDeclared(const TStructure *structure) const;
+
+ private:
+ void declareInterfaceBlockLayout(const TInterfaceBlock *interfaceBlock);
+ void declareInterfaceBlock(const TInterfaceBlock *interfaceBlock);
+
+ void writeBuiltInFunctionTriplet(Visit visit, TOperator op, bool useEmulatedFunction);
+
+ const char *mapQualifierToString(TQualifier qualifier);
+
+ TInfoSinkBase &mObjSink;
+ bool mDeclaringVariable;
+
+ // This set contains all the ids of the structs from every scope.
+ std::set<int> mDeclaredStructs;
+
+ ShArrayIndexClampingStrategy mClampingStrategy;
+
+ // name hashing.
+ ShHashFunction64 mHashFunction;
+
+ NameMap &mNameMap;
+
+ sh::GLenum mShaderType;
+
+ const int mShaderVersion;
+
+ ShShaderOutput mOutput;
+
+ ShCompileOptions mCompileOptions;
+};
+
+void WriteGeometryShaderLayoutQualifiers(TInfoSinkBase &out,
+ sh::TLayoutPrimitiveType inputPrimitive,
+ int invocations,
+ sh::TLayoutPrimitiveType outputPrimitive,
+ int maxVertices);
+
+bool NeedsToWriteLayoutQualifier(const TType &type);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_OUTPUTGLSLBASE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp
new file mode 100644
index 0000000000..3ff3ffdd2a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp
@@ -0,0 +1,3568 @@
+//
+// 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/OutputHLSL.h"
+
+#include <stdio.h>
+#include <algorithm>
+#include <cfloat>
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+#include "common/utilities.h"
+#include "compiler/translator/AtomicCounterFunctionHLSL.h"
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
+#include "compiler/translator/ImageFunctionHLSL.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/ResourcesHLSL.h"
+#include "compiler/translator/StructureHLSL.h"
+#include "compiler/translator/TextureFunctionHLSL.h"
+#include "compiler/translator/TranslatorHLSL.h"
+#include "compiler/translator/UtilsHLSL.h"
+#include "compiler/translator/blocklayout.h"
+#include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h"
+#include "compiler/translator/tree_util/FindSymbolNode.h"
+#include "compiler/translator/tree_util/NodeSearch.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const char kImage2DFunctionString[] = "// @@ IMAGE2D DECLARATION FUNCTION STRING @@";
+
+TString ArrayHelperFunctionName(const char *prefix, const TType &type)
+{
+ TStringStream fnName = sh::InitializeStream<TStringStream>();
+ fnName << prefix << "_";
+ if (type.isArray())
+ {
+ for (unsigned int arraySize : *type.getArraySizes())
+ {
+ fnName << arraySize << "_";
+ }
+ }
+ fnName << TypeString(type);
+ return fnName.str();
+}
+
+bool IsDeclarationWrittenOut(TIntermDeclaration *node)
+{
+ TIntermSequence *sequence = node->getSequence();
+ TIntermTyped *variable = (*sequence)[0]->getAsTyped();
+ ASSERT(sequence->size() == 1);
+ ASSERT(variable);
+ return (variable->getQualifier() == EvqTemporary || variable->getQualifier() == EvqGlobal ||
+ variable->getQualifier() == EvqConst || variable->getQualifier() == EvqShared);
+}
+
+bool IsInStd140UniformBlock(TIntermTyped *node)
+{
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+
+ if (binaryNode)
+ {
+ return IsInStd140UniformBlock(binaryNode->getLeft());
+ }
+
+ const TType &type = node->getType();
+
+ if (type.getQualifier() == EvqUniform)
+ {
+ // determine if we are in the standard layout
+ const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
+ if (interfaceBlock)
+ {
+ return (interfaceBlock->blockStorage() == EbsStd140);
+ }
+ }
+
+ return false;
+}
+
+const char *GetHLSLAtomicFunctionStringAndLeftParenthesis(TOperator op)
+{
+ switch (op)
+ {
+ case EOpAtomicAdd:
+ return "InterlockedAdd(";
+ case EOpAtomicMin:
+ return "InterlockedMin(";
+ case EOpAtomicMax:
+ return "InterlockedMax(";
+ case EOpAtomicAnd:
+ return "InterlockedAnd(";
+ case EOpAtomicOr:
+ return "InterlockedOr(";
+ case EOpAtomicXor:
+ return "InterlockedXor(";
+ case EOpAtomicExchange:
+ return "InterlockedExchange(";
+ case EOpAtomicCompSwap:
+ return "InterlockedCompareExchange(";
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+bool IsAtomicFunctionForSharedVariableDirectAssign(const TIntermBinary &node)
+{
+ TIntermAggregate *aggregateNode = node.getRight()->getAsAggregate();
+ if (aggregateNode == nullptr)
+ {
+ return false;
+ }
+
+ if (node.getOp() == EOpAssign && IsAtomicFunction(aggregateNode->getOp()))
+ {
+ return !IsInShaderStorageBlock((*aggregateNode->getSequence())[0]->getAsTyped());
+ }
+
+ return false;
+}
+
+const char *kZeros = "_ANGLE_ZEROS_";
+constexpr int kZeroCount = 256;
+std::string DefineZeroArray()
+{
+ std::stringstream ss = sh::InitializeStream<std::stringstream>();
+ // For 'static', if the declaration does not include an initializer, the value is set to zero.
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-variable-syntax
+ ss << "static uint " << kZeros << "[" << kZeroCount << "];\n";
+ return ss.str();
+}
+
+std::string GetZeroInitializer(size_t size)
+{
+ std::stringstream ss = sh::InitializeStream<std::stringstream>();
+ size_t quotient = size / kZeroCount;
+ size_t reminder = size % kZeroCount;
+
+ for (size_t i = 0; i < quotient; ++i)
+ {
+ if (i != 0)
+ {
+ ss << ", ";
+ }
+ ss << kZeros;
+ }
+
+ for (size_t i = 0; i < reminder; ++i)
+ {
+ if (quotient != 0 || i != 0)
+ {
+ ss << ", ";
+ }
+ ss << "0";
+ }
+
+ return ss.str();
+}
+
+} // anonymous namespace
+
+TReferencedBlock::TReferencedBlock(const TInterfaceBlock *aBlock,
+ const TVariable *aInstanceVariable)
+ : block(aBlock), instanceVariable(aInstanceVariable)
+{}
+
+bool OutputHLSL::needStructMapping(TIntermTyped *node)
+{
+ ASSERT(node->getBasicType() == EbtStruct);
+ for (unsigned int n = 0u; getAncestorNode(n) != nullptr; ++n)
+ {
+ TIntermNode *ancestor = getAncestorNode(n);
+ const TIntermBinary *ancestorBinary = ancestor->getAsBinaryNode();
+ if (ancestorBinary)
+ {
+ switch (ancestorBinary->getOp())
+ {
+ case EOpIndexDirectStruct:
+ {
+ const TStructure *structure = ancestorBinary->getLeft()->getType().getStruct();
+ const TIntermConstantUnion *index =
+ ancestorBinary->getRight()->getAsConstantUnion();
+ const TField *field = structure->fields()[index->getIConst(0)];
+ if (field->type()->getStruct() == nullptr)
+ {
+ return false;
+ }
+ break;
+ }
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ break;
+ default:
+ return true;
+ }
+ }
+ else
+ {
+ const TIntermAggregate *ancestorAggregate = ancestor->getAsAggregate();
+ if (ancestorAggregate)
+ {
+ return true;
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
+void OutputHLSL::writeFloat(TInfoSinkBase &out, float f)
+{
+ // This is known not to work for NaN on all drivers but make the best effort to output NaNs
+ // regardless.
+ if ((gl::isInf(f) || gl::isNaN(f)) && mShaderVersion >= 300 &&
+ mOutputType == SH_HLSL_4_1_OUTPUT)
+ {
+ out << "asfloat(" << gl::bitCast<uint32_t>(f) << "u)";
+ }
+ else
+ {
+ out << std::min(FLT_MAX, std::max(-FLT_MAX, f));
+ }
+}
+
+void OutputHLSL::writeSingleConstant(TInfoSinkBase &out, const TConstantUnion *const constUnion)
+{
+ ASSERT(constUnion != nullptr);
+ switch (constUnion->getType())
+ {
+ case EbtFloat:
+ writeFloat(out, constUnion->getFConst());
+ break;
+ case EbtInt:
+ out << constUnion->getIConst();
+ break;
+ case EbtUInt:
+ out << constUnion->getUConst();
+ break;
+ case EbtBool:
+ out << constUnion->getBConst();
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+const TConstantUnion *OutputHLSL::writeConstantUnionArray(TInfoSinkBase &out,
+ const TConstantUnion *const constUnion,
+ const size_t size)
+{
+ const TConstantUnion *constUnionIterated = constUnion;
+ for (size_t i = 0; i < size; i++, constUnionIterated++)
+ {
+ writeSingleConstant(out, constUnionIterated);
+
+ if (i != size - 1)
+ {
+ out << ", ";
+ }
+ }
+ return constUnionIterated;
+}
+
+OutputHLSL::OutputHLSL(sh::GLenum shaderType,
+ int shaderVersion,
+ const TExtensionBehavior &extensionBehavior,
+ const char *sourcePath,
+ ShShaderOutput outputType,
+ int numRenderTargets,
+ int maxDualSourceDrawBuffers,
+ const std::vector<Uniform> &uniforms,
+ ShCompileOptions compileOptions,
+ sh::WorkGroupSize workGroupSize,
+ TSymbolTable *symbolTable,
+ PerformanceDiagnostics *perfDiagnostics,
+ const std::vector<InterfaceBlock> &shaderStorageBlocks)
+ : TIntermTraverser(true, true, true, symbolTable),
+ mShaderType(shaderType),
+ mShaderVersion(shaderVersion),
+ mExtensionBehavior(extensionBehavior),
+ mSourcePath(sourcePath),
+ mOutputType(outputType),
+ mCompileOptions(compileOptions),
+ mInsideFunction(false),
+ mInsideMain(false),
+ mNumRenderTargets(numRenderTargets),
+ mMaxDualSourceDrawBuffers(maxDualSourceDrawBuffers),
+ mCurrentFunctionMetadata(nullptr),
+ mWorkGroupSize(workGroupSize),
+ mPerfDiagnostics(perfDiagnostics),
+ mNeedStructMapping(false)
+{
+ mUsesFragColor = false;
+ mUsesFragData = false;
+ mUsesDepthRange = false;
+ mUsesFragCoord = false;
+ mUsesPointCoord = false;
+ mUsesFrontFacing = false;
+ mUsesPointSize = false;
+ mUsesInstanceID = false;
+ mHasMultiviewExtensionEnabled =
+ IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview) ||
+ IsExtensionEnabled(mExtensionBehavior, TExtension::OVR_multiview2);
+ mUsesViewID = false;
+ mUsesVertexID = false;
+ mUsesFragDepth = false;
+ mUsesNumWorkGroups = false;
+ mUsesWorkGroupID = false;
+ mUsesLocalInvocationID = false;
+ mUsesGlobalInvocationID = false;
+ mUsesLocalInvocationIndex = false;
+ mUsesXor = false;
+ mUsesDiscardRewriting = false;
+ mUsesNestedBreak = false;
+ mRequiresIEEEStrictCompiling = false;
+ mUseZeroArray = false;
+ mUsesSecondaryColor = false;
+
+ mUniqueIndex = 0;
+
+ mOutputLod0Function = false;
+ mInsideDiscontinuousLoop = false;
+ mNestedLoopDepth = 0;
+
+ mExcessiveLoopIndex = nullptr;
+
+ mStructureHLSL = new StructureHLSL;
+ mTextureFunctionHLSL = new TextureFunctionHLSL;
+ mImageFunctionHLSL = new ImageFunctionHLSL;
+ mAtomicCounterFunctionHLSL =
+ new AtomicCounterFunctionHLSL((compileOptions & SH_FORCE_ATOMIC_VALUE_RESOLUTION) != 0);
+
+ unsigned int firstUniformRegister =
+ ((compileOptions & SH_SKIP_D3D_CONSTANT_REGISTER_ZERO) != 0) ? 1u : 0u;
+ mResourcesHLSL = new ResourcesHLSL(mStructureHLSL, outputType, uniforms, firstUniformRegister);
+
+ if (mOutputType == SH_HLSL_3_0_OUTPUT)
+ {
+ // Fragment shaders need dx_DepthRange, dx_ViewCoords and dx_DepthFront.
+ // Vertex shaders need a slightly different set: dx_DepthRange, dx_ViewCoords and
+ // dx_ViewAdjust.
+ // In both cases total 3 uniform registers need to be reserved.
+ mResourcesHLSL->reserveUniformRegisters(3);
+ }
+
+ // Reserve registers for the default uniform block and driver constants
+ mResourcesHLSL->reserveUniformBlockRegisters(2);
+
+ mSSBOOutputHLSL =
+ new ShaderStorageBlockOutputHLSL(this, symbolTable, mResourcesHLSL, shaderStorageBlocks);
+}
+
+OutputHLSL::~OutputHLSL()
+{
+ SafeDelete(mSSBOOutputHLSL);
+ SafeDelete(mStructureHLSL);
+ SafeDelete(mResourcesHLSL);
+ SafeDelete(mTextureFunctionHLSL);
+ SafeDelete(mImageFunctionHLSL);
+ SafeDelete(mAtomicCounterFunctionHLSL);
+ for (auto &eqFunction : mStructEqualityFunctions)
+ {
+ SafeDelete(eqFunction);
+ }
+ for (auto &eqFunction : mArrayEqualityFunctions)
+ {
+ SafeDelete(eqFunction);
+ }
+}
+
+void OutputHLSL::output(TIntermNode *treeRoot, TInfoSinkBase &objSink)
+{
+ BuiltInFunctionEmulator builtInFunctionEmulator;
+ InitBuiltInFunctionEmulatorForHLSL(&builtInFunctionEmulator);
+ if ((mCompileOptions & SH_EMULATE_ISNAN_FLOAT_FUNCTION) != 0)
+ {
+ InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(&builtInFunctionEmulator,
+ mShaderVersion);
+ }
+
+ builtInFunctionEmulator.markBuiltInFunctionsForEmulation(treeRoot);
+
+ // Now that we are done changing the AST, do the analyses need for HLSL generation
+ CallDAG::InitResult success = mCallDag.init(treeRoot, nullptr);
+ ASSERT(success == CallDAG::INITDAG_SUCCESS);
+ mASTMetadataList = CreateASTMetadataHLSL(treeRoot, mCallDag);
+
+ const std::vector<MappedStruct> std140Structs = FlagStd140Structs(treeRoot);
+ // TODO(oetuaho): The std140Structs could be filtered based on which ones actually get used in
+ // the shader code. When we add shader storage blocks we might also consider an alternative
+ // solution, since the struct mapping won't work very well for shader storage blocks.
+
+ // Output the body and footer first to determine what has to go in the header
+ mInfoSinkStack.push(&mBody);
+ treeRoot->traverse(this);
+ mInfoSinkStack.pop();
+
+ mInfoSinkStack.push(&mFooter);
+ mInfoSinkStack.pop();
+
+ mInfoSinkStack.push(&mHeader);
+ header(mHeader, std140Structs, &builtInFunctionEmulator);
+ mInfoSinkStack.pop();
+
+ objSink << mHeader.c_str();
+ objSink << mBody.c_str();
+ objSink << mFooter.c_str();
+
+ builtInFunctionEmulator.cleanup();
+}
+
+const std::map<std::string, unsigned int> &OutputHLSL::getShaderStorageBlockRegisterMap() const
+{
+ return mResourcesHLSL->getShaderStorageBlockRegisterMap();
+}
+
+const std::map<std::string, unsigned int> &OutputHLSL::getUniformBlockRegisterMap() const
+{
+ return mResourcesHLSL->getUniformBlockRegisterMap();
+}
+
+const std::map<std::string, unsigned int> &OutputHLSL::getUniformRegisterMap() const
+{
+ return mResourcesHLSL->getUniformRegisterMap();
+}
+
+unsigned int OutputHLSL::getReadonlyImage2DRegisterIndex() const
+{
+ return mResourcesHLSL->getReadonlyImage2DRegisterIndex();
+}
+
+unsigned int OutputHLSL::getImage2DRegisterIndex() const
+{
+ return mResourcesHLSL->getImage2DRegisterIndex();
+}
+
+const std::set<std::string> &OutputHLSL::getUsedImage2DFunctionNames() const
+{
+ return mImageFunctionHLSL->getUsedImage2DFunctionNames();
+}
+
+TString OutputHLSL::structInitializerString(int indent,
+ const TType &type,
+ const TString &name) const
+{
+ TString init;
+
+ TString indentString;
+ for (int spaces = 0; spaces < indent; spaces++)
+ {
+ indentString += " ";
+ }
+
+ if (type.isArray())
+ {
+ init += indentString + "{\n";
+ for (unsigned int arrayIndex = 0u; arrayIndex < type.getOutermostArraySize(); ++arrayIndex)
+ {
+ TStringStream indexedString = sh::InitializeStream<TStringStream>();
+ indexedString << name << "[" << arrayIndex << "]";
+ TType elementType = type;
+ elementType.toArrayElementType();
+ init += structInitializerString(indent + 1, elementType, indexedString.str());
+ if (arrayIndex < type.getOutermostArraySize() - 1)
+ {
+ init += ",";
+ }
+ init += "\n";
+ }
+ init += indentString + "}";
+ }
+ else if (type.getBasicType() == EbtStruct)
+ {
+ init += indentString + "{\n";
+ const TStructure &structure = *type.getStruct();
+ const TFieldList &fields = structure.fields();
+ for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ const TField &field = *fields[fieldIndex];
+ const TString &fieldName = name + "." + Decorate(field.name());
+ const TType &fieldType = *field.type();
+
+ init += structInitializerString(indent + 1, fieldType, fieldName);
+ if (fieldIndex < fields.size() - 1)
+ {
+ init += ",";
+ }
+ init += "\n";
+ }
+ init += indentString + "}";
+ }
+ else
+ {
+ init += indentString + name;
+ }
+
+ return init;
+}
+
+TString OutputHLSL::generateStructMapping(const std::vector<MappedStruct> &std140Structs) const
+{
+ TString mappedStructs;
+
+ for (auto &mappedStruct : std140Structs)
+ {
+ const TInterfaceBlock *interfaceBlock =
+ mappedStruct.blockDeclarator->getType().getInterfaceBlock();
+ TQualifier qualifier = mappedStruct.blockDeclarator->getType().getQualifier();
+ switch (qualifier)
+ {
+ case EvqUniform:
+ if (mReferencedUniformBlocks.count(interfaceBlock->uniqueId().get()) == 0)
+ {
+ continue;
+ }
+ break;
+ case EvqBuffer:
+ continue;
+ default:
+ UNREACHABLE();
+ return mappedStructs;
+ }
+
+ unsigned int instanceCount = 1u;
+ bool isInstanceArray = mappedStruct.blockDeclarator->isArray();
+ if (isInstanceArray)
+ {
+ instanceCount = mappedStruct.blockDeclarator->getOutermostArraySize();
+ }
+
+ for (unsigned int instanceArrayIndex = 0; instanceArrayIndex < instanceCount;
+ ++instanceArrayIndex)
+ {
+ TString originalName;
+ TString mappedName("map");
+
+ if (mappedStruct.blockDeclarator->variable().symbolType() != SymbolType::Empty)
+ {
+ const ImmutableString &instanceName =
+ mappedStruct.blockDeclarator->variable().name();
+ unsigned int instanceStringArrayIndex = GL_INVALID_INDEX;
+ if (isInstanceArray)
+ instanceStringArrayIndex = instanceArrayIndex;
+ TString instanceString = mResourcesHLSL->InterfaceBlockInstanceString(
+ instanceName, instanceStringArrayIndex);
+ originalName += instanceString;
+ mappedName += instanceString;
+ originalName += ".";
+ mappedName += "_";
+ }
+
+ TString fieldName = Decorate(mappedStruct.field->name());
+ originalName += fieldName;
+ mappedName += fieldName;
+
+ TType *structType = mappedStruct.field->type();
+ mappedStructs +=
+ "static " + Decorate(structType->getStruct()->name()) + " " + mappedName;
+
+ if (structType->isArray())
+ {
+ mappedStructs += ArrayString(*mappedStruct.field->type()).data();
+ }
+
+ mappedStructs += " =\n";
+ mappedStructs += structInitializerString(0, *structType, originalName);
+ mappedStructs += ";\n";
+ }
+ }
+ return mappedStructs;
+}
+
+void OutputHLSL::writeReferencedAttributes(TInfoSinkBase &out) const
+{
+ for (const auto &attribute : mReferencedAttributes)
+ {
+ const TType &type = attribute.second->getType();
+ const ImmutableString &name = attribute.second->name();
+
+ out << "static " << TypeString(type) << " " << Decorate(name) << ArrayString(type) << " = "
+ << zeroInitializer(type) << ";\n";
+ }
+}
+
+void OutputHLSL::writeReferencedVaryings(TInfoSinkBase &out) const
+{
+ for (const auto &varying : mReferencedVaryings)
+ {
+ const TType &type = varying.second->getType();
+
+ // Program linking depends on this exact format
+ out << "static " << InterpolationString(type.getQualifier()) << " " << TypeString(type)
+ << " " << DecorateVariableIfNeeded(*varying.second) << ArrayString(type) << " = "
+ << zeroInitializer(type) << ";\n";
+ }
+}
+
+void OutputHLSL::header(TInfoSinkBase &out,
+ const std::vector<MappedStruct> &std140Structs,
+ const BuiltInFunctionEmulator *builtInFunctionEmulator) const
+{
+ TString mappedStructs;
+ if (mNeedStructMapping)
+ {
+ mappedStructs = generateStructMapping(std140Structs);
+ }
+
+ out << mStructureHLSL->structsHeader();
+
+ mResourcesHLSL->uniformsHeader(out, mOutputType, mReferencedUniforms, mSymbolTable);
+ out << mResourcesHLSL->uniformBlocksHeader(mReferencedUniformBlocks);
+ mSSBOOutputHLSL->writeShaderStorageBlocksHeader(out);
+
+ if (!mEqualityFunctions.empty())
+ {
+ out << "\n// Equality functions\n\n";
+ for (const auto &eqFunction : mEqualityFunctions)
+ {
+ out << eqFunction->functionDefinition << "\n";
+ }
+ }
+ if (!mArrayAssignmentFunctions.empty())
+ {
+ out << "\n// Assignment functions\n\n";
+ for (const auto &assignmentFunction : mArrayAssignmentFunctions)
+ {
+ out << assignmentFunction.functionDefinition << "\n";
+ }
+ }
+ if (!mArrayConstructIntoFunctions.empty())
+ {
+ out << "\n// Array constructor functions\n\n";
+ for (const auto &constructIntoFunction : mArrayConstructIntoFunctions)
+ {
+ out << constructIntoFunction.functionDefinition << "\n";
+ }
+ }
+
+ if (mUsesDiscardRewriting)
+ {
+ out << "#define ANGLE_USES_DISCARD_REWRITING\n";
+ }
+
+ if (mUsesNestedBreak)
+ {
+ out << "#define ANGLE_USES_NESTED_BREAK\n";
+ }
+
+ if (mRequiresIEEEStrictCompiling)
+ {
+ out << "#define ANGLE_REQUIRES_IEEE_STRICT_COMPILING\n";
+ }
+
+ out << "#ifdef ANGLE_ENABLE_LOOP_FLATTEN\n"
+ "#define LOOP [loop]\n"
+ "#define FLATTEN [flatten]\n"
+ "#else\n"
+ "#define LOOP\n"
+ "#define FLATTEN\n"
+ "#endif\n";
+
+ // array stride for atomic counter buffers is always 4 per original extension
+ // ARB_shader_atomic_counters and discussion on
+ // https://github.com/KhronosGroup/OpenGL-API/issues/5
+ out << "\n#define ATOMIC_COUNTER_ARRAY_STRIDE 4\n\n";
+
+ if (mUseZeroArray)
+ {
+ out << DefineZeroArray() << "\n";
+ }
+
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ const bool usingMRTExtension =
+ IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_draw_buffers);
+ const bool usingBFEExtension =
+ IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_blend_func_extended);
+
+ out << "// Varyings\n";
+ writeReferencedVaryings(out);
+ out << "\n";
+
+ if (mShaderVersion >= 300)
+ {
+ for (const auto &outputVariable : mReferencedOutputVariables)
+ {
+ const ImmutableString &variableName = outputVariable.second->name();
+ const TType &variableType = outputVariable.second->getType();
+
+ out << "static " << TypeString(variableType) << " out_" << variableName
+ << ArrayString(variableType) << " = " << zeroInitializer(variableType) << ";\n";
+ }
+ }
+ else
+ {
+ const unsigned int numColorValues = usingMRTExtension ? mNumRenderTargets : 1;
+
+ 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";
+
+ if (usingBFEExtension && mUsesSecondaryColor)
+ {
+ out << "static float4 gl_SecondaryColor[" << mMaxDualSourceDrawBuffers
+ << "] = \n"
+ "{\n";
+ for (int i = 0; i < mMaxDualSourceDrawBuffers; i++)
+ {
+ out << " float4(0, 0, 0, 0)";
+ if (i + 1 != mMaxDualSourceDrawBuffers)
+ {
+ out << ",";
+ }
+ out << "\n";
+ }
+ out << "};\n";
+ }
+ }
+
+ if (mUsesFragDepth)
+ {
+ out << "static float gl_Depth = 0.0;\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << "static float4 gl_FragCoord = float4(0, 0, 0, 0);\n";
+ }
+
+ if (mUsesPointCoord)
+ {
+ out << "static float2 gl_PointCoord = float2(0.5, 0.5);\n";
+ }
+
+ if (mUsesFrontFacing)
+ {
+ out << "static bool gl_FrontFacing = false;\n";
+ }
+
+ out << "\n";
+
+ if (mUsesDepthRange)
+ {
+ out << "struct gl_DepthRangeParameters\n"
+ "{\n"
+ " float near;\n"
+ " float far;\n"
+ " float diff;\n"
+ "};\n"
+ "\n";
+ }
+
+ if (mOutputType == SH_HLSL_4_1_OUTPUT || mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n";
+
+ if (mUsesDepthRange)
+ {
+ out << " float3 dx_DepthRange : packoffset(c0);\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << " float4 dx_ViewCoords : packoffset(c1);\n";
+ }
+
+ if (mUsesFragCoord || mUsesFrontFacing)
+ {
+ out << " float3 dx_DepthFront : packoffset(c2);\n";
+ }
+
+ if (mUsesFragCoord)
+ {
+ // dx_ViewScale is only used in the fragment shader to correct
+ // the value for glFragCoord if necessary
+ out << " float2 dx_ViewScale : packoffset(c3);\n";
+ }
+
+ if (mHasMultiviewExtensionEnabled)
+ {
+ // We have to add a value which we can use to keep track of which multi-view code
+ // path is to be selected in the GS.
+ out << " float multiviewSelectViewportIndex : packoffset(c3.z);\n";
+ }
+
+ if (mOutputType == SH_HLSL_4_1_OUTPUT)
+ {
+ mResourcesHLSL->samplerMetadataUniforms(out, 4);
+ }
+
+ out << "};\n";
+ }
+ else
+ {
+ if (mUsesDepthRange)
+ {
+ out << "uniform float3 dx_DepthRange : register(c0);";
+ }
+
+ if (mUsesFragCoord)
+ {
+ out << "uniform float4 dx_ViewCoords : register(c1);\n";
+ }
+
+ if (mUsesFragCoord || mUsesFrontFacing)
+ {
+ out << "uniform float3 dx_DepthFront : register(c2);\n";
+ }
+ }
+
+ out << "\n";
+
+ if (mUsesDepthRange)
+ {
+ out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, "
+ "dx_DepthRange.y, dx_DepthRange.z};\n"
+ "\n";
+ }
+
+ if (usingMRTExtension && mNumRenderTargets > 1)
+ {
+ out << "#define GL_USES_MRT\n";
+ }
+
+ if (mUsesFragColor)
+ {
+ out << "#define GL_USES_FRAG_COLOR\n";
+ }
+
+ if (mUsesFragData)
+ {
+ out << "#define GL_USES_FRAG_DATA\n";
+ }
+
+ if (mShaderVersion < 300 && usingBFEExtension && mUsesSecondaryColor)
+ {
+ out << "#define GL_USES_SECONDARY_COLOR\n";
+ }
+ }
+ else if (mShaderType == GL_VERTEX_SHADER)
+ {
+ out << "// Attributes\n";
+ writeReferencedAttributes(out);
+ out << "\n"
+ "static float4 gl_Position = float4(0, 0, 0, 0);\n";
+
+ if (mUsesPointSize)
+ {
+ out << "static float gl_PointSize = float(1);\n";
+ }
+
+ if (mUsesInstanceID)
+ {
+ out << "static int gl_InstanceID;";
+ }
+
+ if (mUsesVertexID)
+ {
+ out << "static int gl_VertexID;";
+ }
+
+ out << "\n"
+ "// Varyings\n";
+ writeReferencedVaryings(out);
+ out << "\n";
+
+ if (mUsesDepthRange)
+ {
+ out << "struct gl_DepthRangeParameters\n"
+ "{\n"
+ " float near;\n"
+ " float far;\n"
+ " float diff;\n"
+ "};\n"
+ "\n";
+ }
+
+ if (mOutputType == SH_HLSL_4_1_OUTPUT || mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n";
+
+ if (mUsesDepthRange)
+ {
+ out << " float3 dx_DepthRange : packoffset(c0);\n";
+ }
+
+ // dx_ViewAdjust and dx_ViewCoords will only be used in Feature Level 9
+ // shaders. However, we declare it for all shaders (including Feature Level 10+).
+ // The bytecode is the same whether we declare it or not, since D3DCompiler removes it
+ // if it's unused.
+ out << " float4 dx_ViewAdjust : packoffset(c1);\n";
+ out << " float2 dx_ViewCoords : packoffset(c2);\n";
+ out << " float2 dx_ViewScale : packoffset(c3);\n";
+
+ if (mHasMultiviewExtensionEnabled)
+ {
+ // We have to add a value which we can use to keep track of which multi-view code
+ // path is to be selected in the GS.
+ out << " float multiviewSelectViewportIndex : packoffset(c3.z);\n";
+ }
+
+ if (mOutputType == SH_HLSL_4_1_OUTPUT)
+ {
+ mResourcesHLSL->samplerMetadataUniforms(out, 4);
+ }
+
+ if (mUsesVertexID)
+ {
+ out << " uint dx_VertexID : packoffset(c3.w);\n";
+ }
+
+ out << "};\n"
+ "\n";
+ }
+ else
+ {
+ if (mUsesDepthRange)
+ {
+ out << "uniform float3 dx_DepthRange : register(c0);\n";
+ }
+
+ out << "uniform float4 dx_ViewAdjust : register(c1);\n";
+ out << "uniform float2 dx_ViewCoords : register(c2);\n"
+ "\n";
+ }
+
+ if (mUsesDepthRange)
+ {
+ out << "static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, "
+ "dx_DepthRange.y, dx_DepthRange.z};\n"
+ "\n";
+ }
+ }
+ else // Compute shader
+ {
+ ASSERT(mShaderType == GL_COMPUTE_SHADER);
+
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n";
+ if (mUsesNumWorkGroups)
+ {
+ out << " uint3 gl_NumWorkGroups : packoffset(c0);\n";
+ }
+ ASSERT(mOutputType == SH_HLSL_4_1_OUTPUT);
+ unsigned int registerIndex = 1;
+ mResourcesHLSL->samplerMetadataUniforms(out, registerIndex);
+ // Sampler metadata struct must be two 4-vec, 32 bytes.
+ registerIndex += mResourcesHLSL->getSamplerCount() * 2;
+ mResourcesHLSL->imageMetadataUniforms(out, registerIndex);
+ out << "};\n";
+
+ out << kImage2DFunctionString << "\n";
+
+ std::ostringstream systemValueDeclaration = sh::InitializeStream<std::ostringstream>();
+ std::ostringstream glBuiltinInitialization = sh::InitializeStream<std::ostringstream>();
+
+ systemValueDeclaration << "\nstruct CS_INPUT\n{\n";
+ glBuiltinInitialization << "\nvoid initGLBuiltins(CS_INPUT input)\n"
+ << "{\n";
+
+ if (mUsesWorkGroupID)
+ {
+ out << "static uint3 gl_WorkGroupID = uint3(0, 0, 0);\n";
+ systemValueDeclaration << " uint3 dx_WorkGroupID : "
+ << "SV_GroupID;\n";
+ glBuiltinInitialization << " gl_WorkGroupID = input.dx_WorkGroupID;\n";
+ }
+
+ if (mUsesLocalInvocationID)
+ {
+ out << "static uint3 gl_LocalInvocationID = uint3(0, 0, 0);\n";
+ systemValueDeclaration << " uint3 dx_LocalInvocationID : "
+ << "SV_GroupThreadID;\n";
+ glBuiltinInitialization << " gl_LocalInvocationID = input.dx_LocalInvocationID;\n";
+ }
+
+ if (mUsesGlobalInvocationID)
+ {
+ out << "static uint3 gl_GlobalInvocationID = uint3(0, 0, 0);\n";
+ systemValueDeclaration << " uint3 dx_GlobalInvocationID : "
+ << "SV_DispatchThreadID;\n";
+ glBuiltinInitialization << " gl_GlobalInvocationID = input.dx_GlobalInvocationID;\n";
+ }
+
+ if (mUsesLocalInvocationIndex)
+ {
+ out << "static uint gl_LocalInvocationIndex = uint(0);\n";
+ systemValueDeclaration << " uint dx_LocalInvocationIndex : "
+ << "SV_GroupIndex;\n";
+ glBuiltinInitialization
+ << " gl_LocalInvocationIndex = input.dx_LocalInvocationIndex;\n";
+ }
+
+ systemValueDeclaration << "};\n\n";
+ glBuiltinInitialization << "};\n\n";
+
+ out << systemValueDeclaration.str();
+ out << glBuiltinInitialization.str();
+ }
+
+ if (!mappedStructs.empty())
+ {
+ out << "// Structures from std140 blocks with padding removed\n";
+ out << "\n";
+ out << mappedStructs;
+ out << "\n";
+ }
+
+ bool getDimensionsIgnoresBaseLevel =
+ (mCompileOptions & SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL) != 0;
+ mTextureFunctionHLSL->textureFunctionHeader(out, mOutputType, getDimensionsIgnoresBaseLevel);
+ mImageFunctionHLSL->imageFunctionHeader(out);
+ mAtomicCounterFunctionHLSL->atomicCounterFunctionHeader(out);
+
+ if (mUsesFragCoord)
+ {
+ out << "#define GL_USES_FRAG_COORD\n";
+ }
+
+ if (mUsesPointCoord)
+ {
+ out << "#define GL_USES_POINT_COORD\n";
+ }
+
+ if (mUsesFrontFacing)
+ {
+ out << "#define GL_USES_FRONT_FACING\n";
+ }
+
+ if (mUsesPointSize)
+ {
+ out << "#define GL_USES_POINT_SIZE\n";
+ }
+
+ if (mHasMultiviewExtensionEnabled)
+ {
+ out << "#define GL_ANGLE_MULTIVIEW_ENABLED\n";
+ }
+
+ if (mUsesVertexID)
+ {
+ out << "#define GL_USES_VERTEX_ID\n";
+ }
+
+ if (mUsesViewID)
+ {
+ out << "#define GL_USES_VIEW_ID\n";
+ }
+
+ if (mUsesFragDepth)
+ {
+ out << "#define GL_USES_FRAG_DEPTH\n";
+ }
+
+ if (mUsesDepthRange)
+ {
+ out << "#define GL_USES_DEPTH_RANGE\n";
+ }
+
+ if (mUsesXor)
+ {
+ out << "bool xor(bool p, bool q)\n"
+ "{\n"
+ " return (p || q) && !(p && q);\n"
+ "}\n"
+ "\n";
+ }
+
+ builtInFunctionEmulator->outputEmulatedFunctions(out);
+}
+
+void OutputHLSL::visitSymbol(TIntermSymbol *node)
+{
+ const TVariable &variable = node->variable();
+
+ // Empty symbols can only appear in declarations and function arguments, and in either of those
+ // cases the symbol nodes are not visited.
+ ASSERT(variable.symbolType() != SymbolType::Empty);
+
+ TInfoSinkBase &out = getInfoSink();
+
+ // Handle accessing std140 structs by value
+ if (IsInStd140UniformBlock(node) && node->getBasicType() == EbtStruct &&
+ needStructMapping(node))
+ {
+ mNeedStructMapping = true;
+ out << "map";
+ }
+
+ const ImmutableString &name = variable.name();
+ const TSymbolUniqueId &uniqueId = variable.uniqueId();
+
+ if (name == "gl_DepthRange")
+ {
+ mUsesDepthRange = true;
+ out << name;
+ }
+ else if (IsAtomicCounter(variable.getType().getBasicType()))
+ {
+ const TType &variableType = variable.getType();
+ if (variableType.getQualifier() == EvqUniform)
+ {
+ TLayoutQualifier layout = variableType.getLayoutQualifier();
+ mReferencedUniforms[uniqueId.get()] = &variable;
+ out << getAtomicCounterNameForBinding(layout.binding) << ", " << layout.offset;
+ }
+ else
+ {
+ TString varName = DecorateVariableIfNeeded(variable);
+ out << varName << ", " << varName << "_offset";
+ }
+ }
+ else
+ {
+ const TType &variableType = variable.getType();
+ TQualifier qualifier = variable.getType().getQualifier();
+
+ ensureStructDefined(variableType);
+
+ if (qualifier == EvqUniform)
+ {
+ const TInterfaceBlock *interfaceBlock = variableType.getInterfaceBlock();
+
+ if (interfaceBlock)
+ {
+ if (mReferencedUniformBlocks.count(interfaceBlock->uniqueId().get()) == 0)
+ {
+ const TVariable *instanceVariable = nullptr;
+ if (variableType.isInterfaceBlock())
+ {
+ instanceVariable = &variable;
+ }
+ mReferencedUniformBlocks[interfaceBlock->uniqueId().get()] =
+ new TReferencedBlock(interfaceBlock, instanceVariable);
+ }
+ }
+ else
+ {
+ mReferencedUniforms[uniqueId.get()] = &variable;
+ }
+
+ out << DecorateVariableIfNeeded(variable);
+ }
+ else if (qualifier == EvqBuffer)
+ {
+ UNREACHABLE();
+ }
+ else if (qualifier == EvqAttribute || qualifier == EvqVertexIn)
+ {
+ mReferencedAttributes[uniqueId.get()] = &variable;
+ out << Decorate(name);
+ }
+ else if (IsVarying(qualifier))
+ {
+ mReferencedVaryings[uniqueId.get()] = &variable;
+ out << DecorateVariableIfNeeded(variable);
+ if (variable.symbolType() == SymbolType::AngleInternal && name == "ViewID_OVR")
+ {
+ mUsesViewID = true;
+ }
+ }
+ else if (qualifier == EvqFragmentOut)
+ {
+ mReferencedOutputVariables[uniqueId.get()] = &variable;
+ 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 == EvqSecondaryFragColorEXT)
+ {
+ out << "gl_SecondaryColor[0]";
+ mUsesSecondaryColor = true;
+ }
+ else if (qualifier == EvqSecondaryFragDataEXT)
+ {
+ out << "gl_SecondaryColor";
+ mUsesSecondaryColor = 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 (qualifier == EvqInstanceID)
+ {
+ mUsesInstanceID = true;
+ out << name;
+ }
+ else if (qualifier == EvqVertexID)
+ {
+ mUsesVertexID = true;
+ out << name;
+ }
+ else if (name == "gl_FragDepthEXT" || name == "gl_FragDepth")
+ {
+ mUsesFragDepth = true;
+ out << "gl_Depth";
+ }
+ else if (qualifier == EvqNumWorkGroups)
+ {
+ mUsesNumWorkGroups = true;
+ out << name;
+ }
+ else if (qualifier == EvqWorkGroupID)
+ {
+ mUsesWorkGroupID = true;
+ out << name;
+ }
+ else if (qualifier == EvqLocalInvocationID)
+ {
+ mUsesLocalInvocationID = true;
+ out << name;
+ }
+ else if (qualifier == EvqGlobalInvocationID)
+ {
+ mUsesGlobalInvocationID = true;
+ out << name;
+ }
+ else if (qualifier == EvqLocalInvocationIndex)
+ {
+ mUsesLocalInvocationIndex = true;
+ out << name;
+ }
+ else
+ {
+ out << DecorateVariableIfNeeded(variable);
+ }
+ }
+}
+
+void OutputHLSL::outputEqual(Visit visit, const TType &type, TOperator op, TInfoSinkBase &out)
+{
+ if (type.isScalar() && !type.isArray())
+ {
+ if (op == EOpEqual)
+ {
+ outputTriplet(out, visit, "(", " == ", ")");
+ }
+ else
+ {
+ outputTriplet(out, visit, "(", " != ", ")");
+ }
+ }
+ else
+ {
+ if (visit == PreVisit && op == EOpNotEqual)
+ {
+ out << "!";
+ }
+
+ if (type.isArray())
+ {
+ const TString &functionName = addArrayEqualityFunction(type);
+ outputTriplet(out, visit, (functionName + "(").c_str(), ", ", ")");
+ }
+ else if (type.getBasicType() == EbtStruct)
+ {
+ const TStructure &structure = *type.getStruct();
+ const TString &functionName = addStructEqualityFunction(structure);
+ outputTriplet(out, visit, (functionName + "(").c_str(), ", ", ")");
+ }
+ else
+ {
+ ASSERT(type.isMatrix() || type.isVector());
+ outputTriplet(out, visit, "all(", " == ", ")");
+ }
+ }
+}
+
+void OutputHLSL::outputAssign(Visit visit, const TType &type, TInfoSinkBase &out)
+{
+ if (type.isArray())
+ {
+ const TString &functionName = addArrayAssignmentFunction(type);
+ outputTriplet(out, visit, (functionName + "(").c_str(), ", ", ")");
+ }
+ else
+ {
+ outputTriplet(out, visit, "(", " = ", ")");
+ }
+}
+
+bool OutputHLSL::ancestorEvaluatesToSamplerInStruct()
+{
+ for (unsigned int n = 0u; getAncestorNode(n) != nullptr; ++n)
+ {
+ TIntermNode *ancestor = getAncestorNode(n);
+ const TIntermBinary *ancestorBinary = ancestor->getAsBinaryNode();
+ if (ancestorBinary == nullptr)
+ {
+ return false;
+ }
+ switch (ancestorBinary->getOp())
+ {
+ case EOpIndexDirectStruct:
+ {
+ const TStructure *structure = ancestorBinary->getLeft()->getType().getStruct();
+ const TIntermConstantUnion *index =
+ ancestorBinary->getRight()->getAsConstantUnion();
+ const TField *field = structure->fields()[index->getIConst(0)];
+ if (IsSampler(field->type()->getBasicType()))
+ {
+ return true;
+ }
+ break;
+ }
+ case EOpIndexDirect:
+ break;
+ default:
+ // Returning a sampler from indirect indexing is not supported.
+ return false;
+ }
+ }
+ return false;
+}
+
+bool OutputHLSL::visitSwizzle(Visit visit, TIntermSwizzle *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+ if (visit == PostVisit)
+ {
+ out << ".";
+ node->writeOffsetsAsXYZW(&out);
+ }
+ return true;
+}
+
+bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ switch (node->getOp())
+ {
+ case EOpComma:
+ outputTriplet(out, visit, "(", ", ", ")");
+ break;
+ case EOpAssign:
+ if (node->isArray())
+ {
+ TIntermAggregate *rightAgg = node->getRight()->getAsAggregate();
+ if (rightAgg != nullptr && rightAgg->isConstructor())
+ {
+ const TString &functionName = addArrayConstructIntoFunction(node->getType());
+ out << functionName << "(";
+ node->getLeft()->traverse(this);
+ TIntermSequence *seq = rightAgg->getSequence();
+ for (auto &arrayElement : *seq)
+ {
+ out << ", ";
+ arrayElement->traverse(this);
+ }
+ out << ")";
+ return false;
+ }
+ // ArrayReturnValueToOutParameter should have eliminated expressions where a
+ // function call is assigned.
+ ASSERT(rightAgg == nullptr);
+ }
+ // Assignment expressions with atomic functions should be transformed into atomic
+ // function calls in HLSL.
+ // e.g. original_value = atomicAdd(dest, value) should be translated into
+ // InterlockedAdd(dest, value, original_value);
+ else if (IsAtomicFunctionForSharedVariableDirectAssign(*node))
+ {
+ TIntermAggregate *atomicFunctionNode = node->getRight()->getAsAggregate();
+ TOperator atomicFunctionOp = atomicFunctionNode->getOp();
+ out << GetHLSLAtomicFunctionStringAndLeftParenthesis(atomicFunctionOp);
+ TIntermSequence *argumentSeq = atomicFunctionNode->getSequence();
+ ASSERT(argumentSeq->size() >= 2u);
+ for (auto &argument : *argumentSeq)
+ {
+ argument->traverse(this);
+ out << ", ";
+ }
+ node->getLeft()->traverse(this);
+ out << ")";
+ return false;
+ }
+ else if (IsInShaderStorageBlock(node->getLeft()))
+ {
+ mSSBOOutputHLSL->outputStoreFunctionCallPrefix(node->getLeft());
+ out << ", ";
+ if (IsInShaderStorageBlock(node->getRight()))
+ {
+ mSSBOOutputHLSL->outputLoadFunctionCall(node->getRight());
+ }
+ else
+ {
+ node->getRight()->traverse(this);
+ }
+
+ out << ")";
+ return false;
+ }
+ else if (IsInShaderStorageBlock(node->getRight()))
+ {
+ node->getLeft()->traverse(this);
+ out << " = ";
+ mSSBOOutputHLSL->outputLoadFunctionCall(node->getRight());
+ return false;
+ }
+
+ outputAssign(visit, node->getType(), out);
+ break;
+ case EOpInitialize:
+ if (visit == PreVisit)
+ {
+ TIntermSymbol *symbolNode = node->getLeft()->getAsSymbolNode();
+ ASSERT(symbolNode);
+ TIntermTyped *initializer = node->getRight();
+
+ // Global initializers must be constant at this point.
+ ASSERT(symbolNode->getQualifier() != EvqGlobal || initializer->hasConstantValue());
+
+ // GLSL allows to write things like "float x = x;" where a new variable x is defined
+ // and the value of an existing variable x is assigned. HLSL uses C semantics (the
+ // new variable is created before the assignment is evaluated), so we need to
+ // convert
+ // this to "float t = x, x = t;".
+ if (writeSameSymbolInitializer(out, symbolNode, initializer))
+ {
+ // Skip initializing the rest of the expression
+ return false;
+ }
+ else if (writeConstantInitialization(out, symbolNode, initializer))
+ {
+ return false;
+ }
+ }
+ else if (visit == InVisit)
+ {
+ out << " = ";
+ if (IsInShaderStorageBlock(node->getRight()))
+ {
+ mSSBOOutputHLSL->outputLoadFunctionCall(node->getRight());
+ return false;
+ }
+ }
+ break;
+ case EOpAddAssign:
+ outputTriplet(out, visit, "(", " += ", ")");
+ break;
+ case EOpSubAssign:
+ outputTriplet(out, visit, "(", " -= ", ")");
+ break;
+ case EOpMulAssign:
+ outputTriplet(out, visit, "(", " *= ", ")");
+ break;
+ case EOpVectorTimesScalarAssign:
+ outputTriplet(out, visit, "(", " *= ", ")");
+ break;
+ case EOpMatrixTimesScalarAssign:
+ outputTriplet(out, visit, "(", " *= ", ")");
+ break;
+ case EOpVectorTimesMatrixAssign:
+ if (visit == PreVisit)
+ {
+ out << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << " = mul(";
+ node->getLeft()->traverse(this);
+ out << ", transpose(";
+ }
+ else
+ {
+ out << ")))";
+ }
+ break;
+ case EOpMatrixTimesMatrixAssign:
+ if (visit == PreVisit)
+ {
+ out << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << " = transpose(mul(transpose(";
+ node->getLeft()->traverse(this);
+ out << "), transpose(";
+ }
+ else
+ {
+ out << "))))";
+ }
+ break;
+ case EOpDivAssign:
+ outputTriplet(out, visit, "(", " /= ", ")");
+ break;
+ case EOpIModAssign:
+ outputTriplet(out, visit, "(", " %= ", ")");
+ break;
+ case EOpBitShiftLeftAssign:
+ outputTriplet(out, visit, "(", " <<= ", ")");
+ break;
+ case EOpBitShiftRightAssign:
+ outputTriplet(out, visit, "(", " >>= ", ")");
+ break;
+ case EOpBitwiseAndAssign:
+ outputTriplet(out, visit, "(", " &= ", ")");
+ break;
+ case EOpBitwiseXorAssign:
+ outputTriplet(out, visit, "(", " ^= ", ")");
+ break;
+ case EOpBitwiseOrAssign:
+ outputTriplet(out, visit, "(", " |= ", ")");
+ break;
+ case EOpIndexDirect:
+ {
+ const TType &leftType = node->getLeft()->getType();
+ if (leftType.isInterfaceBlock())
+ {
+ if (visit == PreVisit)
+ {
+ TIntermSymbol *instanceArraySymbol = node->getLeft()->getAsSymbolNode();
+ const TInterfaceBlock *interfaceBlock = leftType.getInterfaceBlock();
+
+ ASSERT(leftType.getQualifier() == EvqUniform);
+ if (mReferencedUniformBlocks.count(interfaceBlock->uniqueId().get()) == 0)
+ {
+ mReferencedUniformBlocks[interfaceBlock->uniqueId().get()] =
+ new TReferencedBlock(interfaceBlock, &instanceArraySymbol->variable());
+ }
+ const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0);
+ out << mResourcesHLSL->InterfaceBlockInstanceString(
+ instanceArraySymbol->getName(), arrayIndex);
+ return false;
+ }
+ }
+ else if (ancestorEvaluatesToSamplerInStruct())
+ {
+ // All parts of an expression that access a sampler in a struct need to use _ as
+ // separator to access the sampler variable that has been moved out of the struct.
+ outputTriplet(out, visit, "", "_", "");
+ }
+ else if (IsAtomicCounter(leftType.getBasicType()))
+ {
+ outputTriplet(out, visit, "", " + (", ") * ATOMIC_COUNTER_ARRAY_STRIDE");
+ }
+ else
+ {
+ outputTriplet(out, visit, "", "[", "]");
+ }
+ }
+ break;
+ case EOpIndexIndirect:
+ {
+ // We do not currently support indirect references to interface blocks
+ ASSERT(node->getLeft()->getBasicType() != EbtInterfaceBlock);
+
+ const TType &leftType = node->getLeft()->getType();
+ if (IsAtomicCounter(leftType.getBasicType()))
+ {
+ outputTriplet(out, visit, "", " + (", ") * ATOMIC_COUNTER_ARRAY_STRIDE");
+ }
+ else
+ {
+ outputTriplet(out, visit, "", "[", "]");
+ }
+ break;
+ }
+ case EOpIndexDirectStruct:
+ {
+ const TStructure *structure = node->getLeft()->getType().getStruct();
+ const TIntermConstantUnion *index = node->getRight()->getAsConstantUnion();
+ const TField *field = structure->fields()[index->getIConst(0)];
+
+ // In cases where indexing returns a sampler, we need to access the sampler variable
+ // that has been moved out of the struct.
+ bool indexingReturnsSampler = IsSampler(field->type()->getBasicType());
+ if (visit == PreVisit && indexingReturnsSampler)
+ {
+ // Samplers extracted from structs have "angle" prefix to avoid name conflicts.
+ // This prefix is only output at the beginning of the indexing expression, which
+ // may have multiple parts.
+ out << "angle";
+ }
+ if (!indexingReturnsSampler)
+ {
+ // All parts of an expression that access a sampler in a struct need to use _ as
+ // separator to access the sampler variable that has been moved out of the struct.
+ indexingReturnsSampler = ancestorEvaluatesToSamplerInStruct();
+ }
+ if (visit == InVisit)
+ {
+ if (indexingReturnsSampler)
+ {
+ out << "_" << field->name();
+ }
+ else
+ {
+ out << "." << DecorateField(field->name(), *structure);
+ }
+
+ return false;
+ }
+ }
+ break;
+ case EOpIndexDirectInterfaceBlock:
+ {
+ ASSERT(!IsInShaderStorageBlock(node->getLeft()));
+ bool structInStd140UniformBlock = node->getBasicType() == EbtStruct &&
+ IsInStd140UniformBlock(node->getLeft()) &&
+ needStructMapping(node);
+ if (visit == PreVisit && structInStd140UniformBlock)
+ {
+ mNeedStructMapping = true;
+ out << "map";
+ }
+ if (visit == InVisit)
+ {
+ const TInterfaceBlock *interfaceBlock =
+ node->getLeft()->getType().getInterfaceBlock();
+ const TIntermConstantUnion *index = node->getRight()->getAsConstantUnion();
+ const TField *field = interfaceBlock->fields()[index->getIConst(0)];
+ if (structInStd140UniformBlock)
+ {
+ out << "_";
+ }
+ else
+ {
+ out << ".";
+ }
+ out << Decorate(field->name());
+
+ return false;
+ }
+ break;
+ }
+ case EOpAdd:
+ outputTriplet(out, visit, "(", " + ", ")");
+ break;
+ case EOpSub:
+ outputTriplet(out, visit, "(", " - ", ")");
+ break;
+ case EOpMul:
+ outputTriplet(out, visit, "(", " * ", ")");
+ break;
+ case EOpDiv:
+ outputTriplet(out, visit, "(", " / ", ")");
+ break;
+ case EOpIMod:
+ outputTriplet(out, visit, "(", " % ", ")");
+ break;
+ case EOpBitShiftLeft:
+ outputTriplet(out, visit, "(", " << ", ")");
+ break;
+ case EOpBitShiftRight:
+ outputTriplet(out, visit, "(", " >> ", ")");
+ break;
+ case EOpBitwiseAnd:
+ outputTriplet(out, visit, "(", " & ", ")");
+ break;
+ case EOpBitwiseXor:
+ outputTriplet(out, visit, "(", " ^ ", ")");
+ break;
+ case EOpBitwiseOr:
+ outputTriplet(out, visit, "(", " | ", ")");
+ break;
+ case EOpEqual:
+ case EOpNotEqual:
+ outputEqual(visit, node->getLeft()->getType(), node->getOp(), out);
+ break;
+ case EOpLessThan:
+ outputTriplet(out, visit, "(", " < ", ")");
+ break;
+ case EOpGreaterThan:
+ outputTriplet(out, visit, "(", " > ", ")");
+ break;
+ case EOpLessThanEqual:
+ outputTriplet(out, visit, "(", " <= ", ")");
+ break;
+ case EOpGreaterThanEqual:
+ outputTriplet(out, visit, "(", " >= ", ")");
+ break;
+ case EOpVectorTimesScalar:
+ outputTriplet(out, visit, "(", " * ", ")");
+ break;
+ case EOpMatrixTimesScalar:
+ outputTriplet(out, visit, "(", " * ", ")");
+ break;
+ case EOpVectorTimesMatrix:
+ outputTriplet(out, visit, "mul(", ", transpose(", "))");
+ break;
+ case EOpMatrixTimesVector:
+ outputTriplet(out, visit, "mul(transpose(", "), ", ")");
+ break;
+ case EOpMatrixTimesMatrix:
+ outputTriplet(out, visit, "transpose(mul(transpose(", "), transpose(", ")))");
+ break;
+ case EOpLogicalOr:
+ // HLSL doesn't short-circuit ||, so we assume that || affected by short-circuiting have
+ // been unfolded.
+ ASSERT(!node->getRight()->hasSideEffects());
+ outputTriplet(out, visit, "(", " || ", ")");
+ return true;
+ case EOpLogicalXor:
+ mUsesXor = true;
+ outputTriplet(out, visit, "xor(", ", ", ")");
+ break;
+ case EOpLogicalAnd:
+ // HLSL doesn't short-circuit &&, so we assume that && affected by short-circuiting have
+ // been unfolded.
+ ASSERT(!node->getRight()->hasSideEffects());
+ outputTriplet(out, visit, "(", " && ", ")");
+ return true;
+ default:
+ UNREACHABLE();
+ }
+
+ return true;
+}
+
+bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ switch (node->getOp())
+ {
+ case EOpNegative:
+ outputTriplet(out, visit, "(-", "", ")");
+ break;
+ case EOpPositive:
+ outputTriplet(out, visit, "(+", "", ")");
+ break;
+ case EOpLogicalNot:
+ outputTriplet(out, visit, "(!", "", ")");
+ break;
+ case EOpBitwiseNot:
+ outputTriplet(out, visit, "(~", "", ")");
+ break;
+ case EOpPostIncrement:
+ outputTriplet(out, visit, "(", "", "++)");
+ break;
+ case EOpPostDecrement:
+ outputTriplet(out, visit, "(", "", "--)");
+ break;
+ case EOpPreIncrement:
+ outputTriplet(out, visit, "(++", "", ")");
+ break;
+ case EOpPreDecrement:
+ outputTriplet(out, visit, "(--", "", ")");
+ break;
+ case EOpRadians:
+ outputTriplet(out, visit, "radians(", "", ")");
+ break;
+ case EOpDegrees:
+ outputTriplet(out, visit, "degrees(", "", ")");
+ break;
+ case EOpSin:
+ outputTriplet(out, visit, "sin(", "", ")");
+ break;
+ case EOpCos:
+ outputTriplet(out, visit, "cos(", "", ")");
+ break;
+ case EOpTan:
+ outputTriplet(out, visit, "tan(", "", ")");
+ break;
+ case EOpAsin:
+ outputTriplet(out, visit, "asin(", "", ")");
+ break;
+ case EOpAcos:
+ outputTriplet(out, visit, "acos(", "", ")");
+ break;
+ case EOpAtan:
+ outputTriplet(out, visit, "atan(", "", ")");
+ break;
+ case EOpSinh:
+ outputTriplet(out, visit, "sinh(", "", ")");
+ break;
+ case EOpCosh:
+ outputTriplet(out, visit, "cosh(", "", ")");
+ break;
+ case EOpTanh:
+ case EOpAsinh:
+ case EOpAcosh:
+ case EOpAtanh:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpExp:
+ outputTriplet(out, visit, "exp(", "", ")");
+ break;
+ case EOpLog:
+ outputTriplet(out, visit, "log(", "", ")");
+ break;
+ case EOpExp2:
+ outputTriplet(out, visit, "exp2(", "", ")");
+ break;
+ case EOpLog2:
+ outputTriplet(out, visit, "log2(", "", ")");
+ break;
+ case EOpSqrt:
+ outputTriplet(out, visit, "sqrt(", "", ")");
+ break;
+ case EOpInversesqrt:
+ outputTriplet(out, visit, "rsqrt(", "", ")");
+ break;
+ case EOpAbs:
+ outputTriplet(out, visit, "abs(", "", ")");
+ break;
+ case EOpSign:
+ outputTriplet(out, visit, "sign(", "", ")");
+ break;
+ case EOpFloor:
+ outputTriplet(out, visit, "floor(", "", ")");
+ break;
+ case EOpTrunc:
+ outputTriplet(out, visit, "trunc(", "", ")");
+ break;
+ case EOpRound:
+ outputTriplet(out, visit, "round(", "", ")");
+ break;
+ case EOpRoundEven:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpCeil:
+ outputTriplet(out, visit, "ceil(", "", ")");
+ break;
+ case EOpFract:
+ outputTriplet(out, visit, "frac(", "", ")");
+ break;
+ case EOpIsnan:
+ if (node->getUseEmulatedFunction())
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ else
+ outputTriplet(out, visit, "isnan(", "", ")");
+ mRequiresIEEEStrictCompiling = true;
+ break;
+ case EOpIsinf:
+ outputTriplet(out, visit, "isinf(", "", ")");
+ break;
+ case EOpFloatBitsToInt:
+ outputTriplet(out, visit, "asint(", "", ")");
+ break;
+ case EOpFloatBitsToUint:
+ outputTriplet(out, visit, "asuint(", "", ")");
+ break;
+ case EOpIntBitsToFloat:
+ outputTriplet(out, visit, "asfloat(", "", ")");
+ break;
+ case EOpUintBitsToFloat:
+ outputTriplet(out, visit, "asfloat(", "", ")");
+ break;
+ case EOpPackSnorm2x16:
+ case EOpPackUnorm2x16:
+ case EOpPackHalf2x16:
+ case EOpUnpackSnorm2x16:
+ case EOpUnpackUnorm2x16:
+ case EOpUnpackHalf2x16:
+ case EOpPackUnorm4x8:
+ case EOpPackSnorm4x8:
+ case EOpUnpackUnorm4x8:
+ case EOpUnpackSnorm4x8:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpLength:
+ outputTriplet(out, visit, "length(", "", ")");
+ break;
+ case EOpNormalize:
+ outputTriplet(out, visit, "normalize(", "", ")");
+ break;
+ case EOpDFdx:
+ if (mInsideDiscontinuousLoop || mOutputLod0Function)
+ {
+ outputTriplet(out, visit, "(", "", ", 0.0)");
+ }
+ else
+ {
+ outputTriplet(out, visit, "ddx(", "", ")");
+ }
+ break;
+ case EOpDFdy:
+ if (mInsideDiscontinuousLoop || mOutputLod0Function)
+ {
+ outputTriplet(out, visit, "(", "", ", 0.0)");
+ }
+ else
+ {
+ outputTriplet(out, visit, "ddy(", "", ")");
+ }
+ break;
+ case EOpFwidth:
+ if (mInsideDiscontinuousLoop || mOutputLod0Function)
+ {
+ outputTriplet(out, visit, "(", "", ", 0.0)");
+ }
+ else
+ {
+ outputTriplet(out, visit, "fwidth(", "", ")");
+ }
+ break;
+ case EOpTranspose:
+ outputTriplet(out, visit, "transpose(", "", ")");
+ break;
+ case EOpDeterminant:
+ outputTriplet(out, visit, "determinant(transpose(", "", "))");
+ break;
+ case EOpInverse:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+
+ case EOpAny:
+ outputTriplet(out, visit, "any(", "", ")");
+ break;
+ case EOpAll:
+ outputTriplet(out, visit, "all(", "", ")");
+ break;
+ case EOpLogicalNotComponentWise:
+ outputTriplet(out, visit, "(!", "", ")");
+ break;
+ case EOpBitfieldReverse:
+ outputTriplet(out, visit, "reversebits(", "", ")");
+ break;
+ case EOpBitCount:
+ outputTriplet(out, visit, "countbits(", "", ")");
+ break;
+ case EOpFindLSB:
+ // Note that it's unclear from the HLSL docs what this returns for 0, but this is tested
+ // in GLSLTest and results are consistent with GL.
+ outputTriplet(out, visit, "firstbitlow(", "", ")");
+ break;
+ case EOpFindMSB:
+ // Note that it's unclear from the HLSL docs what this returns for 0 or -1, but this is
+ // tested in GLSLTest and results are consistent with GL.
+ outputTriplet(out, visit, "firstbithigh(", "", ")");
+ break;
+ case EOpArrayLength:
+ {
+ TIntermTyped *operand = node->getOperand();
+ ASSERT(IsInShaderStorageBlock(operand));
+ mSSBOOutputHLSL->outputLengthFunctionCall(operand);
+ return false;
+ }
+ default:
+ UNREACHABLE();
+ }
+
+ return true;
+}
+
+ImmutableString OutputHLSL::samplerNamePrefixFromStruct(TIntermTyped *node)
+{
+ if (node->getAsSymbolNode())
+ {
+ ASSERT(node->getAsSymbolNode()->variable().symbolType() != SymbolType::Empty);
+ return node->getAsSymbolNode()->getName();
+ }
+ TIntermBinary *nodeBinary = node->getAsBinaryNode();
+ switch (nodeBinary->getOp())
+ {
+ case EOpIndexDirect:
+ {
+ int index = nodeBinary->getRight()->getAsConstantUnion()->getIConst(0);
+
+ std::stringstream prefixSink = sh::InitializeStream<std::stringstream>();
+ prefixSink << samplerNamePrefixFromStruct(nodeBinary->getLeft()) << "_" << index;
+ return ImmutableString(prefixSink.str());
+ }
+ case EOpIndexDirectStruct:
+ {
+ const TStructure *s = nodeBinary->getLeft()->getAsTyped()->getType().getStruct();
+ int index = nodeBinary->getRight()->getAsConstantUnion()->getIConst(0);
+ const TField *field = s->fields()[index];
+
+ std::stringstream prefixSink = sh::InitializeStream<std::stringstream>();
+ prefixSink << samplerNamePrefixFromStruct(nodeBinary->getLeft()) << "_"
+ << field->name();
+ return ImmutableString(prefixSink.str());
+ }
+ default:
+ UNREACHABLE();
+ return kEmptyImmutableString;
+ }
+}
+
+bool OutputHLSL::visitBlock(Visit visit, TIntermBlock *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ bool isMainBlock = mInsideMain && getParentNode()->getAsFunctionDefinition();
+
+ if (mInsideFunction)
+ {
+ outputLineDirective(out, node->getLine().first_line);
+ out << "{\n";
+ if (isMainBlock)
+ {
+ if (mShaderType == GL_COMPUTE_SHADER)
+ {
+ out << "initGLBuiltins(input);\n";
+ }
+ else
+ {
+ out << "@@ MAIN PROLOGUE @@\n";
+ }
+ }
+ }
+
+ for (TIntermNode *statement : *node->getSequence())
+ {
+ outputLineDirective(out, statement->getLine().first_line);
+
+ statement->traverse(this);
+
+ // Don't output ; after case labels, they're terminated by :
+ // This is needed especially since outputting a ; after a case statement would turn empty
+ // case statements into non-empty case statements, disallowing fall-through from them.
+ // Also the output code is clearer if we don't output ; after statements where it is not
+ // needed:
+ // * if statements
+ // * switch statements
+ // * blocks
+ // * function definitions
+ // * loops (do-while loops output the semicolon in VisitLoop)
+ // * declarations that don't generate output.
+ if (statement->getAsCaseNode() == nullptr && statement->getAsIfElseNode() == nullptr &&
+ statement->getAsBlock() == nullptr && statement->getAsLoopNode() == nullptr &&
+ statement->getAsSwitchNode() == nullptr &&
+ statement->getAsFunctionDefinition() == nullptr &&
+ (statement->getAsDeclarationNode() == nullptr ||
+ IsDeclarationWrittenOut(statement->getAsDeclarationNode())) &&
+ statement->getAsInvariantDeclarationNode() == nullptr)
+ {
+ out << ";\n";
+ }
+ }
+
+ if (mInsideFunction)
+ {
+ outputLineDirective(out, node->getLine().last_line);
+ if (isMainBlock && shaderNeedsGenerateOutput())
+ {
+ // We could have an empty main, a main function without a branch at the end, or a main
+ // function with a discard statement at the end. In these cases we need to add a return
+ // statement.
+ bool needReturnStatement =
+ node->getSequence()->empty() || !node->getSequence()->back()->getAsBranchNode() ||
+ node->getSequence()->back()->getAsBranchNode()->getFlowOp() != EOpReturn;
+ if (needReturnStatement)
+ {
+ out << "return " << generateOutputCall() << ";\n";
+ }
+ }
+ out << "}\n";
+ }
+
+ return false;
+}
+
+bool OutputHLSL::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ ASSERT(mCurrentFunctionMetadata == nullptr);
+
+ size_t index = mCallDag.findIndex(node->getFunction()->uniqueId());
+ ASSERT(index != CallDAG::InvalidIndex);
+ mCurrentFunctionMetadata = &mASTMetadataList[index];
+
+ const TFunction *func = node->getFunction();
+
+ if (func->isMain())
+ {
+ // The stub strings below are replaced when shader is dynamically defined by its layout:
+ switch (mShaderType)
+ {
+ case GL_VERTEX_SHADER:
+ out << "@@ VERTEX ATTRIBUTES @@\n\n"
+ << "@@ VERTEX OUTPUT @@\n\n"
+ << "VS_OUTPUT main(VS_INPUT input)";
+ break;
+ case GL_FRAGMENT_SHADER:
+ out << "@@ PIXEL OUTPUT @@\n\n"
+ << "PS_OUTPUT main(@@ PIXEL MAIN PARAMETERS @@)";
+ break;
+ case GL_COMPUTE_SHADER:
+ out << "[numthreads(" << mWorkGroupSize[0] << ", " << mWorkGroupSize[1] << ", "
+ << mWorkGroupSize[2] << ")]\n";
+ out << "void main(CS_INPUT input)";
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+ else
+ {
+ out << TypeString(node->getFunctionPrototype()->getType()) << " ";
+ out << DecorateFunctionIfNeeded(func) << DisambiguateFunctionName(func)
+ << (mOutputLod0Function ? "Lod0(" : "(");
+
+ size_t paramCount = func->getParamCount();
+ for (unsigned int i = 0; i < paramCount; i++)
+ {
+ const TVariable *param = func->getParam(i);
+ ensureStructDefined(param->getType());
+
+ writeParameter(param, out);
+
+ if (i < paramCount - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ out << ")\n";
+ }
+
+ mInsideFunction = true;
+ if (func->isMain())
+ {
+ mInsideMain = true;
+ }
+ // The function body node will output braces.
+ node->getBody()->traverse(this);
+ mInsideFunction = false;
+ mInsideMain = false;
+
+ mCurrentFunctionMetadata = nullptr;
+
+ bool needsLod0 = mASTMetadataList[index].mNeedsLod0;
+ if (needsLod0 && !mOutputLod0Function && mShaderType == GL_FRAGMENT_SHADER)
+ {
+ ASSERT(!node->getFunction()->isMain());
+ mOutputLod0Function = true;
+ node->traverse(this);
+ mOutputLod0Function = false;
+ }
+
+ return false;
+}
+
+bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ if (visit == PreVisit)
+ {
+ TIntermSequence *sequence = node->getSequence();
+ TIntermTyped *declarator = (*sequence)[0]->getAsTyped();
+ ASSERT(sequence->size() == 1);
+ ASSERT(declarator);
+
+ if (IsDeclarationWrittenOut(node))
+ {
+ TInfoSinkBase &out = getInfoSink();
+ ensureStructDefined(declarator->getType());
+
+ if (!declarator->getAsSymbolNode() ||
+ declarator->getAsSymbolNode()->variable().symbolType() !=
+ SymbolType::Empty) // Variable declaration
+ {
+ if (declarator->getQualifier() == EvqShared)
+ {
+ out << "groupshared ";
+ }
+ else if (!mInsideFunction)
+ {
+ out << "static ";
+ }
+
+ out << TypeString(declarator->getType()) + " ";
+
+ TIntermSymbol *symbol = declarator->getAsSymbolNode();
+
+ if (symbol)
+ {
+ symbol->traverse(this);
+ out << ArrayString(symbol->getType());
+ // Temporarily disable shadred memory initialization. It is very slow for D3D11
+ // drivers to compile a compute shader if we add code to initialize a
+ // groupshared array variable with a large array size. And maybe produce
+ // incorrect result. See http://anglebug.com/3226.
+ if (declarator->getQualifier() != EvqShared)
+ {
+ out << " = " + zeroInitializer(symbol->getType());
+ }
+ }
+ else
+ {
+ declarator->traverse(this);
+ }
+ }
+ }
+ else if (IsVaryingOut(declarator->getQualifier()))
+ {
+ TIntermSymbol *symbol = declarator->getAsSymbolNode();
+ ASSERT(symbol); // Varying declarations can't have initializers.
+
+ const TVariable &variable = symbol->variable();
+
+ if (variable.symbolType() != SymbolType::Empty)
+ {
+ // Vertex outputs which are declared but not written to should still be declared to
+ // allow successful linking.
+ mReferencedVaryings[symbol->uniqueId().get()] = &variable;
+ }
+ }
+ }
+ return false;
+}
+
+bool OutputHLSL::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
+{
+ // Do not do any translation
+ return false;
+}
+
+void OutputHLSL::visitFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ size_t index = mCallDag.findIndex(node->getFunction()->uniqueId());
+ // Skip the prototype if it is not implemented (and thus not used)
+ if (index == CallDAG::InvalidIndex)
+ {
+ return;
+ }
+
+ const TFunction *func = node->getFunction();
+
+ TString name = DecorateFunctionIfNeeded(func);
+ out << TypeString(node->getType()) << " " << name << DisambiguateFunctionName(func)
+ << (mOutputLod0Function ? "Lod0(" : "(");
+
+ size_t paramCount = func->getParamCount();
+ for (unsigned int i = 0; i < paramCount; i++)
+ {
+ writeParameter(func->getParam(i), out);
+
+ if (i < paramCount - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ out << ");\n";
+
+ // Also prototype the Lod0 variant if needed
+ bool needsLod0 = mASTMetadataList[index].mNeedsLod0;
+ if (needsLod0 && !mOutputLod0Function && mShaderType == GL_FRAGMENT_SHADER)
+ {
+ mOutputLod0Function = true;
+ node->traverse(this);
+ mOutputLod0Function = false;
+ }
+}
+
+bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ switch (node->getOp())
+ {
+ case EOpCallBuiltInFunction:
+ case EOpCallFunctionInAST:
+ case EOpCallInternalRawFunction:
+ {
+ TIntermSequence *arguments = node->getSequence();
+
+ bool lod0 = (mInsideDiscontinuousLoop || mOutputLod0Function) &&
+ mShaderType == GL_FRAGMENT_SHADER;
+ if (node->getOp() == EOpCallFunctionInAST)
+ {
+ if (node->isArray())
+ {
+ UNIMPLEMENTED();
+ }
+ size_t index = mCallDag.findIndex(node->getFunction()->uniqueId());
+ ASSERT(index != CallDAG::InvalidIndex);
+ lod0 &= mASTMetadataList[index].mNeedsLod0;
+
+ out << DecorateFunctionIfNeeded(node->getFunction());
+ out << DisambiguateFunctionName(node->getSequence());
+ out << (lod0 ? "Lod0(" : "(");
+ }
+ else if (node->getOp() == EOpCallInternalRawFunction)
+ {
+ // This path is used for internal functions that don't have their definitions in the
+ // AST, such as precision emulation functions.
+ out << DecorateFunctionIfNeeded(node->getFunction()) << "(";
+ }
+ else if (node->getFunction()->isImageFunction())
+ {
+ const ImmutableString &name = node->getFunction()->name();
+ TType type = (*arguments)[0]->getAsTyped()->getType();
+ const ImmutableString &imageFunctionName = mImageFunctionHLSL->useImageFunction(
+ name, type.getBasicType(), type.getLayoutQualifier().imageInternalFormat,
+ type.getMemoryQualifier().readonly);
+ out << imageFunctionName << "(";
+ }
+ else if (node->getFunction()->isAtomicCounterFunction())
+ {
+ const ImmutableString &name = node->getFunction()->name();
+ ImmutableString atomicFunctionName =
+ mAtomicCounterFunctionHLSL->useAtomicCounterFunction(name);
+ out << atomicFunctionName << "(";
+ }
+ else
+ {
+ const ImmutableString &name = node->getFunction()->name();
+ TBasicType samplerType = (*arguments)[0]->getAsTyped()->getType().getBasicType();
+ int coords = 0; // textureSize(gsampler2DMS) doesn't have a second argument.
+ if (arguments->size() > 1)
+ {
+ coords = (*arguments)[1]->getAsTyped()->getNominalSize();
+ }
+ const ImmutableString &textureFunctionName =
+ mTextureFunctionHLSL->useTextureFunction(name, samplerType, coords,
+ arguments->size(), lod0, mShaderType);
+ out << textureFunctionName << "(";
+ }
+
+ for (TIntermSequence::iterator arg = arguments->begin(); arg != arguments->end(); arg++)
+ {
+ TIntermTyped *typedArg = (*arg)->getAsTyped();
+ if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT && IsSampler(typedArg->getBasicType()))
+ {
+ out << "texture_";
+ (*arg)->traverse(this);
+ out << ", sampler_";
+ }
+
+ (*arg)->traverse(this);
+
+ if (typedArg->getType().isStructureContainingSamplers())
+ {
+ const TType &argType = typedArg->getType();
+ TVector<const TVariable *> samplerSymbols;
+ ImmutableString structName = samplerNamePrefixFromStruct(typedArg);
+ std::string namePrefix = "angle_";
+ namePrefix += structName.data();
+ argType.createSamplerSymbols(ImmutableString(namePrefix), "", &samplerSymbols,
+ nullptr, mSymbolTable);
+ for (const TVariable *sampler : samplerSymbols)
+ {
+ if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ out << ", texture_" << sampler->name();
+ out << ", sampler_" << sampler->name();
+ }
+ else
+ {
+ // In case of HLSL 4.1+, this symbol is the sampler index, and in case
+ // of D3D9, it's the sampler variable.
+ out << ", " << sampler->name();
+ }
+ }
+ }
+
+ if (arg < arguments->end() - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ out << ")";
+
+ return false;
+ }
+ case EOpConstruct:
+ outputConstructor(out, visit, node);
+ break;
+ case EOpEqualComponentWise:
+ outputTriplet(out, visit, "(", " == ", ")");
+ break;
+ case EOpNotEqualComponentWise:
+ outputTriplet(out, visit, "(", " != ", ")");
+ break;
+ case EOpLessThanComponentWise:
+ outputTriplet(out, visit, "(", " < ", ")");
+ break;
+ case EOpGreaterThanComponentWise:
+ outputTriplet(out, visit, "(", " > ", ")");
+ break;
+ case EOpLessThanEqualComponentWise:
+ outputTriplet(out, visit, "(", " <= ", ")");
+ break;
+ case EOpGreaterThanEqualComponentWise:
+ outputTriplet(out, visit, "(", " >= ", ")");
+ break;
+ case EOpMod:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpModf:
+ outputTriplet(out, visit, "modf(", ", ", ")");
+ break;
+ case EOpPow:
+ outputTriplet(out, visit, "pow(", ", ", ")");
+ break;
+ case EOpAtan:
+ ASSERT(node->getSequence()->size() == 2); // atan(x) is a unary operator
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpMin:
+ outputTriplet(out, visit, "min(", ", ", ")");
+ break;
+ case EOpMax:
+ outputTriplet(out, visit, "max(", ", ", ")");
+ break;
+ case EOpClamp:
+ outputTriplet(out, visit, "clamp(", ", ", ")");
+ break;
+ case EOpMix:
+ {
+ TIntermTyped *lastParamNode = (*(node->getSequence()))[2]->getAsTyped();
+ if (lastParamNode->getType().getBasicType() == EbtBool)
+ {
+ // There is no HLSL equivalent for ESSL3 built-in "genType mix (genType x, genType
+ // y, genBType a)",
+ // so use emulated version.
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ }
+ else
+ {
+ outputTriplet(out, visit, "lerp(", ", ", ")");
+ }
+ break;
+ }
+ case EOpStep:
+ outputTriplet(out, visit, "step(", ", ", ")");
+ break;
+ case EOpSmoothstep:
+ outputTriplet(out, visit, "smoothstep(", ", ", ")");
+ break;
+ case EOpFrexp:
+ case EOpLdexp:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpDistance:
+ outputTriplet(out, visit, "distance(", ", ", ")");
+ break;
+ case EOpDot:
+ outputTriplet(out, visit, "dot(", ", ", ")");
+ break;
+ case EOpCross:
+ outputTriplet(out, visit, "cross(", ", ", ")");
+ break;
+ case EOpFaceforward:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpReflect:
+ outputTriplet(out, visit, "reflect(", ", ", ")");
+ break;
+ case EOpRefract:
+ outputTriplet(out, visit, "refract(", ", ", ")");
+ break;
+ case EOpOuterProduct:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpMulMatrixComponentWise:
+ outputTriplet(out, visit, "(", " * ", ")");
+ break;
+ case EOpBitfieldExtract:
+ case EOpBitfieldInsert:
+ case EOpUaddCarry:
+ case EOpUsubBorrow:
+ case EOpUmulExtended:
+ case EOpImulExtended:
+ ASSERT(node->getUseEmulatedFunction());
+ writeEmulatedFunctionTriplet(out, visit, node->getOp());
+ break;
+ case EOpBarrier:
+ // barrier() is translated to GroupMemoryBarrierWithGroupSync(), which is the
+ // cheapest *WithGroupSync() function, without any functionality loss, but
+ // with the potential for severe performance loss.
+ outputTriplet(out, visit, "GroupMemoryBarrierWithGroupSync(", "", ")");
+ break;
+ case EOpMemoryBarrierShared:
+ outputTriplet(out, visit, "GroupMemoryBarrier(", "", ")");
+ break;
+ case EOpMemoryBarrierAtomicCounter:
+ case EOpMemoryBarrierBuffer:
+ case EOpMemoryBarrierImage:
+ outputTriplet(out, visit, "DeviceMemoryBarrier(", "", ")");
+ break;
+ case EOpGroupMemoryBarrier:
+ case EOpMemoryBarrier:
+ outputTriplet(out, visit, "AllMemoryBarrier(", "", ")");
+ break;
+
+ // Single atomic function calls without return value.
+ // e.g. atomicAdd(dest, value) should be translated into InterlockedAdd(dest, value).
+ case EOpAtomicAdd:
+ case EOpAtomicMin:
+ case EOpAtomicMax:
+ case EOpAtomicAnd:
+ case EOpAtomicOr:
+ case EOpAtomicXor:
+ // The parameter 'original_value' of InterlockedExchange(dest, value, original_value)
+ // and InterlockedCompareExchange(dest, compare_value, value, original_value) is not
+ // optional.
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/interlockedexchange
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/interlockedcompareexchange
+ // So all the call of atomicExchange(dest, value) and atomicCompSwap(dest,
+ // compare_value, value) should all be modified into the form of "int temp; temp =
+ // atomicExchange(dest, value);" and "int temp; temp = atomicCompSwap(dest,
+ // compare_value, value);" in the intermediate tree before traversing outputHLSL.
+ case EOpAtomicExchange:
+ case EOpAtomicCompSwap:
+ {
+ ASSERT(node->getChildCount() > 1);
+ TIntermTyped *memNode = (*node->getSequence())[0]->getAsTyped();
+ if (IsInShaderStorageBlock(memNode))
+ {
+ // Atomic memory functions for SSBO.
+ // "_ssbo_atomicXXX_TYPE(RWByteAddressBuffer buffer, uint loc" is written to |out|.
+ mSSBOOutputHLSL->outputAtomicMemoryFunctionCallPrefix(memNode, node->getOp());
+ // Write the rest argument list to |out|.
+ for (size_t i = 1; i < node->getChildCount(); i++)
+ {
+ out << ", ";
+ TIntermTyped *argument = (*node->getSequence())[i]->getAsTyped();
+ if (IsInShaderStorageBlock(argument))
+ {
+ mSSBOOutputHLSL->outputLoadFunctionCall(argument);
+ }
+ else
+ {
+ argument->traverse(this);
+ }
+ }
+
+ out << ")";
+ return false;
+ }
+ else
+ {
+ // Atomic memory functions for shared variable.
+ if (node->getOp() != EOpAtomicExchange && node->getOp() != EOpAtomicCompSwap)
+ {
+ outputTriplet(out, visit,
+ GetHLSLAtomicFunctionStringAndLeftParenthesis(node->getOp()), ",",
+ ")");
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ break;
+ }
+ default:
+ UNREACHABLE();
+ }
+
+ return true;
+}
+
+void OutputHLSL::writeIfElse(TInfoSinkBase &out, TIntermIfElse *node)
+{
+ out << "if (";
+
+ node->getCondition()->traverse(this);
+
+ out << ")\n";
+
+ outputLineDirective(out, node->getLine().first_line);
+
+ bool discard = false;
+
+ if (node->getTrueBlock())
+ {
+ // The trueBlock child node will output braces.
+ node->getTrueBlock()->traverse(this);
+
+ // Detect true discard
+ discard = (discard || FindDiscard::search(node->getTrueBlock()));
+ }
+ else
+ {
+ // TODO(oetuaho): Check if the semicolon inside is necessary.
+ // It's there as a result of conservative refactoring of the output.
+ out << "{;}\n";
+ }
+
+ outputLineDirective(out, node->getLine().first_line);
+
+ if (node->getFalseBlock())
+ {
+ out << "else\n";
+
+ outputLineDirective(out, node->getFalseBlock()->getLine().first_line);
+
+ // The falseBlock child node will output braces.
+ node->getFalseBlock()->traverse(this);
+
+ outputLineDirective(out, node->getFalseBlock()->getLine().first_line);
+
+ // Detect false discard
+ discard = (discard || FindDiscard::search(node->getFalseBlock()));
+ }
+
+ // ANGLE issue 486: Detect problematic conditional discard
+ if (discard)
+ {
+ mUsesDiscardRewriting = true;
+ }
+}
+
+bool OutputHLSL::visitTernary(Visit, TIntermTernary *)
+{
+ // Ternary ops should have been already converted to something else in the AST. HLSL ternary
+ // operator doesn't short-circuit, so it's not the same as the GLSL ternary operator.
+ UNREACHABLE();
+ return false;
+}
+
+bool OutputHLSL::visitIfElse(Visit visit, TIntermIfElse *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ ASSERT(mInsideFunction);
+
+ // D3D errors when there is a gradient operation in a loop in an unflattened if.
+ if (mShaderType == GL_FRAGMENT_SHADER && mCurrentFunctionMetadata->hasGradientLoop(node))
+ {
+ out << "FLATTEN ";
+ }
+
+ writeIfElse(out, node);
+
+ return false;
+}
+
+bool OutputHLSL::visitSwitch(Visit visit, TIntermSwitch *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ ASSERT(node->getStatementList());
+ if (visit == PreVisit)
+ {
+ node->setStatementList(RemoveSwitchFallThrough(node->getStatementList(), mPerfDiagnostics));
+ }
+ outputTriplet(out, visit, "switch (", ") ", "");
+ // The curly braces get written when visiting the statementList block.
+ return true;
+}
+
+bool OutputHLSL::visitCase(Visit visit, TIntermCase *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+
+ if (node->hasCondition())
+ {
+ outputTriplet(out, visit, "case (", "", "):\n");
+ return true;
+ }
+ else
+ {
+ out << "default:\n";
+ return false;
+ }
+}
+
+void OutputHLSL::visitConstantUnion(TIntermConstantUnion *node)
+{
+ TInfoSinkBase &out = getInfoSink();
+ writeConstantUnion(out, node->getType(), node->getConstantValue());
+}
+
+bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
+{
+ mNestedLoopDepth++;
+
+ bool wasDiscontinuous = mInsideDiscontinuousLoop;
+ mInsideDiscontinuousLoop =
+ mInsideDiscontinuousLoop || mCurrentFunctionMetadata->mDiscontinuousLoops.count(node) > 0;
+
+ TInfoSinkBase &out = getInfoSink();
+
+ if (mOutputType == SH_HLSL_3_0_OUTPUT)
+ {
+ if (handleExcessiveLoop(out, node))
+ {
+ mInsideDiscontinuousLoop = wasDiscontinuous;
+ mNestedLoopDepth--;
+
+ return false;
+ }
+ }
+
+ const char *unroll = mCurrentFunctionMetadata->hasGradientInCallGraph(node) ? "LOOP" : "";
+ if (node->getType() == ELoopDoWhile)
+ {
+ out << "{" << unroll << " do\n";
+
+ outputLineDirective(out, node->getLine().first_line);
+ }
+ else
+ {
+ out << "{" << unroll << " for(";
+
+ if (node->getInit())
+ {
+ node->getInit()->traverse(this);
+ }
+
+ out << "; ";
+
+ if (node->getCondition())
+ {
+ node->getCondition()->traverse(this);
+ }
+
+ out << "; ";
+
+ if (node->getExpression())
+ {
+ node->getExpression()->traverse(this);
+ }
+
+ out << ")\n";
+
+ outputLineDirective(out, node->getLine().first_line);
+ }
+
+ if (node->getBody())
+ {
+ // The loop body node will output braces.
+ node->getBody()->traverse(this);
+ }
+ else
+ {
+ // TODO(oetuaho): Check if the semicolon inside is necessary.
+ // It's there as a result of conservative refactoring of the output.
+ out << "{;}\n";
+ }
+
+ outputLineDirective(out, node->getLine().first_line);
+
+ if (node->getType() == ELoopDoWhile)
+ {
+ outputLineDirective(out, node->getCondition()->getLine().first_line);
+ out << "while (";
+
+ node->getCondition()->traverse(this);
+
+ out << ");\n";
+ }
+
+ out << "}\n";
+
+ mInsideDiscontinuousLoop = wasDiscontinuous;
+ mNestedLoopDepth--;
+
+ return false;
+}
+
+bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
+{
+ if (visit == PreVisit)
+ {
+ TInfoSinkBase &out = getInfoSink();
+
+ switch (node->getFlowOp())
+ {
+ case EOpKill:
+ out << "discard";
+ break;
+ case EOpBreak:
+ if (mNestedLoopDepth > 1)
+ {
+ mUsesNestedBreak = true;
+ }
+
+ if (mExcessiveLoopIndex)
+ {
+ out << "{Break";
+ mExcessiveLoopIndex->traverse(this);
+ out << " = true; break;}\n";
+ }
+ else
+ {
+ out << "break";
+ }
+ break;
+ case EOpContinue:
+ out << "continue";
+ break;
+ case EOpReturn:
+ if (node->getExpression())
+ {
+ ASSERT(!mInsideMain);
+ out << "return ";
+ }
+ else
+ {
+ if (mInsideMain && shaderNeedsGenerateOutput())
+ {
+ out << "return " << generateOutputCall();
+ }
+ else
+ {
+ out << "return";
+ }
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ return true;
+}
+
+// Handle loops with more than 254 iterations (unsupported by D3D9) by splitting them
+// (The D3D documentation says 255 iterations, but the compiler complains at anything more than
+// 254).
+bool OutputHLSL::handleExcessiveLoop(TInfoSinkBase &out, TIntermLoop *node)
+{
+ const int MAX_LOOP_ITERATIONS = 254;
+
+ // Parse loops of the form:
+ // for(int index = initial; index [comparator] limit; index += increment)
+ TIntermSymbol *index = nullptr;
+ TOperator comparator = EOpNull;
+ int initial = 0;
+ int limit = 0;
+ int increment = 0;
+
+ // Parse index name and intial value
+ if (node->getInit())
+ {
+ TIntermDeclaration *init = node->getInit()->getAsDeclarationNode();
+
+ if (init)
+ {
+ TIntermSequence *sequence = init->getSequence();
+ TIntermTyped *variable = (*sequence)[0]->getAsTyped();
+
+ if (variable && variable->getQualifier() == EvqTemporary)
+ {
+ TIntermBinary *assign = variable->getAsBinaryNode();
+
+ if (assign->getOp() == EOpInitialize)
+ {
+ TIntermSymbol *symbol = assign->getLeft()->getAsSymbolNode();
+ TIntermConstantUnion *constant = assign->getRight()->getAsConstantUnion();
+
+ if (symbol && constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->isScalar())
+ {
+ index = symbol;
+ initial = constant->getIConst(0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Parse comparator and limit value
+ if (index != nullptr && node->getCondition())
+ {
+ TIntermBinary *test = node->getCondition()->getAsBinaryNode();
+
+ if (test && test->getLeft()->getAsSymbolNode()->uniqueId() == index->uniqueId())
+ {
+ TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();
+
+ if (constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->isScalar())
+ {
+ comparator = test->getOp();
+ limit = constant->getIConst(0);
+ }
+ }
+ }
+ }
+
+ // Parse increment
+ if (index != nullptr && comparator != EOpNull && node->getExpression())
+ {
+ TIntermBinary *binaryTerminal = node->getExpression()->getAsBinaryNode();
+ TIntermUnary *unaryTerminal = node->getExpression()->getAsUnaryNode();
+
+ if (binaryTerminal)
+ {
+ TOperator op = binaryTerminal->getOp();
+ TIntermConstantUnion *constant = binaryTerminal->getRight()->getAsConstantUnion();
+
+ if (constant)
+ {
+ if (constant->getBasicType() == EbtInt && constant->isScalar())
+ {
+ int value = constant->getIConst(0);
+
+ switch (op)
+ {
+ case EOpAddAssign:
+ increment = value;
+ break;
+ case EOpSubAssign:
+ increment = -value;
+ break;
+ default:
+ UNIMPLEMENTED();
+ }
+ }
+ }
+ }
+ else if (unaryTerminal)
+ {
+ TOperator op = unaryTerminal->getOp();
+
+ switch (op)
+ {
+ case EOpPostIncrement:
+ increment = 1;
+ break;
+ case EOpPostDecrement:
+ increment = -1;
+ break;
+ case EOpPreIncrement:
+ increment = 1;
+ break;
+ case EOpPreDecrement:
+ increment = -1;
+ break;
+ default:
+ UNIMPLEMENTED();
+ }
+ }
+ }
+
+ if (index != nullptr && comparator != EOpNull && increment != 0)
+ {
+ if (comparator == EOpLessThanEqual)
+ {
+ comparator = EOpLessThan;
+ limit += 1;
+ }
+
+ if (comparator == EOpLessThan)
+ {
+ int iterations = (limit - initial) / increment;
+
+ if (iterations <= MAX_LOOP_ITERATIONS)
+ {
+ return false; // Not an excessive loop
+ }
+
+ TIntermSymbol *restoreIndex = mExcessiveLoopIndex;
+ mExcessiveLoopIndex = index;
+
+ out << "{int ";
+ index->traverse(this);
+ out << ";\n"
+ "bool Break";
+ index->traverse(this);
+ out << " = false;\n";
+
+ bool firstLoopFragment = true;
+
+ while (iterations > 0)
+ {
+ int clampedLimit = initial + increment * std::min(MAX_LOOP_ITERATIONS, iterations);
+
+ if (!firstLoopFragment)
+ {
+ out << "if (!Break";
+ index->traverse(this);
+ out << ") {\n";
+ }
+
+ if (iterations <= MAX_LOOP_ITERATIONS) // Last loop fragment
+ {
+ mExcessiveLoopIndex = nullptr; // Stops setting the Break flag
+ }
+
+ // for(int index = initial; index < clampedLimit; index += increment)
+ const char *unroll =
+ mCurrentFunctionMetadata->hasGradientInCallGraph(node) ? "LOOP" : "";
+
+ out << unroll << " for(";
+ index->traverse(this);
+ out << " = ";
+ out << initial;
+
+ out << "; ";
+ index->traverse(this);
+ out << " < ";
+ out << clampedLimit;
+
+ out << "; ";
+ index->traverse(this);
+ out << " += ";
+ out << increment;
+ out << ")\n";
+
+ outputLineDirective(out, node->getLine().first_line);
+ out << "{\n";
+
+ if (node->getBody())
+ {
+ node->getBody()->traverse(this);
+ }
+
+ outputLineDirective(out, node->getLine().first_line);
+ out << ";}\n";
+
+ if (!firstLoopFragment)
+ {
+ out << "}\n";
+ }
+
+ firstLoopFragment = false;
+
+ initial += MAX_LOOP_ITERATIONS * increment;
+ iterations -= MAX_LOOP_ITERATIONS;
+ }
+
+ out << "}";
+
+ mExcessiveLoopIndex = restoreIndex;
+
+ return true;
+ }
+ else
+ UNIMPLEMENTED();
+ }
+
+ return false; // Not handled as an excessive loop
+}
+
+void OutputHLSL::outputTriplet(TInfoSinkBase &out,
+ Visit visit,
+ const char *preString,
+ const char *inString,
+ const char *postString)
+{
+ if (visit == PreVisit)
+ {
+ out << preString;
+ }
+ else if (visit == InVisit)
+ {
+ out << inString;
+ }
+ else if (visit == PostVisit)
+ {
+ out << postString;
+ }
+}
+
+void OutputHLSL::outputLineDirective(TInfoSinkBase &out, int line)
+{
+ if ((mCompileOptions & SH_LINE_DIRECTIVES) && (line > 0))
+ {
+ out << "\n";
+ out << "#line " << line;
+
+ if (mSourcePath)
+ {
+ out << " \"" << mSourcePath << "\"";
+ }
+
+ out << "\n";
+ }
+}
+
+void OutputHLSL::writeParameter(const TVariable *param, TInfoSinkBase &out)
+{
+ const TType &type = param->getType();
+ TQualifier qualifier = type.getQualifier();
+
+ TString nameStr = DecorateVariableIfNeeded(*param);
+ ASSERT(nameStr != ""); // HLSL demands named arguments, also for prototypes
+
+ if (IsSampler(type.getBasicType()))
+ {
+ if (mOutputType == SH_HLSL_4_1_OUTPUT)
+ {
+ // Samplers are passed as indices to the sampler array.
+ ASSERT(qualifier != EvqOut && qualifier != EvqInOut);
+ out << "const uint " << nameStr << ArrayString(type);
+ return;
+ }
+ if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ out << QualifierString(qualifier) << " " << TextureString(type.getBasicType())
+ << " texture_" << nameStr << ArrayString(type) << ", " << QualifierString(qualifier)
+ << " " << SamplerString(type.getBasicType()) << " sampler_" << nameStr
+ << ArrayString(type);
+ return;
+ }
+ }
+
+ // If the parameter is an atomic counter, we need to add an extra parameter to keep track of the
+ // buffer offset.
+ if (IsAtomicCounter(type.getBasicType()))
+ {
+ out << QualifierString(qualifier) << " " << TypeString(type) << " " << nameStr << ", int "
+ << nameStr << "_offset";
+ }
+ else
+ {
+ out << QualifierString(qualifier) << " " << TypeString(type) << " " << nameStr
+ << ArrayString(type);
+ }
+
+ // If the structure parameter contains samplers, they need to be passed into the function as
+ // separate parameters. HLSL doesn't natively support samplers in structs.
+ if (type.isStructureContainingSamplers())
+ {
+ ASSERT(qualifier != EvqOut && qualifier != EvqInOut);
+ TVector<const TVariable *> samplerSymbols;
+ std::string namePrefix = "angle";
+ namePrefix += nameStr.c_str();
+ type.createSamplerSymbols(ImmutableString(namePrefix), "", &samplerSymbols, nullptr,
+ mSymbolTable);
+ for (const TVariable *sampler : samplerSymbols)
+ {
+ const TType &samplerType = sampler->getType();
+ if (mOutputType == SH_HLSL_4_1_OUTPUT)
+ {
+ out << ", const uint " << sampler->name() << ArrayString(samplerType);
+ }
+ else if (mOutputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ ASSERT(IsSampler(samplerType.getBasicType()));
+ out << ", " << QualifierString(qualifier) << " "
+ << TextureString(samplerType.getBasicType()) << " texture_" << sampler->name()
+ << ArrayString(samplerType) << ", " << QualifierString(qualifier) << " "
+ << SamplerString(samplerType.getBasicType()) << " sampler_" << sampler->name()
+ << ArrayString(samplerType);
+ }
+ else
+ {
+ ASSERT(IsSampler(samplerType.getBasicType()));
+ out << ", " << QualifierString(qualifier) << " " << TypeString(samplerType) << " "
+ << sampler->name() << ArrayString(samplerType);
+ }
+ }
+ }
+}
+
+TString OutputHLSL::zeroInitializer(const TType &type) const
+{
+ TString string;
+
+ size_t size = type.getObjectSize();
+ if (size >= kZeroCount)
+ {
+ mUseZeroArray = true;
+ }
+ string = GetZeroInitializer(size).c_str();
+
+ return "{" + string + "}";
+}
+
+void OutputHLSL::outputConstructor(TInfoSinkBase &out, Visit visit, TIntermAggregate *node)
+{
+ // Array constructors should have been already pruned from the code.
+ ASSERT(!node->getType().isArray());
+
+ if (visit == PreVisit)
+ {
+ TString constructorName;
+ if (node->getBasicType() == EbtStruct)
+ {
+ constructorName = mStructureHLSL->addStructConstructor(*node->getType().getStruct());
+ }
+ else
+ {
+ constructorName =
+ mStructureHLSL->addBuiltInConstructor(node->getType(), node->getSequence());
+ }
+ out << constructorName << "(";
+ }
+ else if (visit == InVisit)
+ {
+ out << ", ";
+ }
+ else if (visit == PostVisit)
+ {
+ out << ")";
+ }
+}
+
+const TConstantUnion *OutputHLSL::writeConstantUnion(TInfoSinkBase &out,
+ const TType &type,
+ const TConstantUnion *const constUnion)
+{
+ ASSERT(!type.isArray());
+
+ const TConstantUnion *constUnionIterated = constUnion;
+
+ const TStructure *structure = type.getStruct();
+ if (structure)
+ {
+ out << mStructureHLSL->addStructConstructor(*structure) << "(";
+
+ const TFieldList &fields = structure->fields();
+
+ for (size_t i = 0; i < fields.size(); i++)
+ {
+ const TType *fieldType = fields[i]->type();
+ constUnionIterated = writeConstantUnion(out, *fieldType, constUnionIterated);
+
+ if (i != fields.size() - 1)
+ {
+ out << ", ";
+ }
+ }
+
+ out << ")";
+ }
+ else
+ {
+ size_t size = type.getObjectSize();
+ bool writeType = size > 1;
+
+ if (writeType)
+ {
+ out << TypeString(type) << "(";
+ }
+ constUnionIterated = writeConstantUnionArray(out, constUnionIterated, size);
+ if (writeType)
+ {
+ out << ")";
+ }
+ }
+
+ return constUnionIterated;
+}
+
+void OutputHLSL::writeEmulatedFunctionTriplet(TInfoSinkBase &out, Visit visit, TOperator op)
+{
+ if (visit == PreVisit)
+ {
+ const char *opStr = GetOperatorString(op);
+ BuiltInFunctionEmulator::WriteEmulatedFunctionName(out, opStr);
+ out << "(";
+ }
+ else
+ {
+ outputTriplet(out, visit, nullptr, ", ", ")");
+ }
+}
+
+bool OutputHLSL::writeSameSymbolInitializer(TInfoSinkBase &out,
+ TIntermSymbol *symbolNode,
+ TIntermTyped *expression)
+{
+ ASSERT(symbolNode->variable().symbolType() != SymbolType::Empty);
+ const TIntermSymbol *symbolInInitializer = FindSymbolNode(expression, symbolNode->getName());
+
+ if (symbolInInitializer)
+ {
+ // Type already printed
+ out << "t" + str(mUniqueIndex) + " = ";
+ expression->traverse(this);
+ out << ", ";
+ symbolNode->traverse(this);
+ out << " = t" + str(mUniqueIndex);
+
+ mUniqueIndex++;
+ return true;
+ }
+
+ return false;
+}
+
+bool OutputHLSL::writeConstantInitialization(TInfoSinkBase &out,
+ TIntermSymbol *symbolNode,
+ TIntermTyped *initializer)
+{
+ if (initializer->hasConstantValue())
+ {
+ symbolNode->traverse(this);
+ out << ArrayString(symbolNode->getType());
+ out << " = {";
+ writeConstantUnionArray(out, initializer->getConstantValue(),
+ initializer->getType().getObjectSize());
+ out << "}";
+ return true;
+ }
+ return false;
+}
+
+TString OutputHLSL::addStructEqualityFunction(const TStructure &structure)
+{
+ const TFieldList &fields = structure.fields();
+
+ for (const auto &eqFunction : mStructEqualityFunctions)
+ {
+ if (eqFunction->structure == &structure)
+ {
+ return eqFunction->functionName;
+ }
+ }
+
+ const TString &structNameString = StructNameString(structure);
+
+ StructEqualityFunction *function = new StructEqualityFunction();
+ function->structure = &structure;
+ function->functionName = "angle_eq_" + structNameString;
+
+ TInfoSinkBase fnOut;
+
+ fnOut << "bool " << function->functionName << "(" << structNameString << " a, "
+ << structNameString + " b)\n"
+ << "{\n"
+ " return ";
+
+ for (size_t i = 0; i < fields.size(); i++)
+ {
+ const TField *field = fields[i];
+ const TType *fieldType = field->type();
+
+ const TString &fieldNameA = "a." + Decorate(field->name());
+ const TString &fieldNameB = "b." + Decorate(field->name());
+
+ if (i > 0)
+ {
+ fnOut << " && ";
+ }
+
+ fnOut << "(";
+ outputEqual(PreVisit, *fieldType, EOpEqual, fnOut);
+ fnOut << fieldNameA;
+ outputEqual(InVisit, *fieldType, EOpEqual, fnOut);
+ fnOut << fieldNameB;
+ outputEqual(PostVisit, *fieldType, EOpEqual, fnOut);
+ fnOut << ")";
+ }
+
+ fnOut << ";\n"
+ << "}\n";
+
+ function->functionDefinition = fnOut.c_str();
+
+ mStructEqualityFunctions.push_back(function);
+ mEqualityFunctions.push_back(function);
+
+ return function->functionName;
+}
+
+TString OutputHLSL::addArrayEqualityFunction(const TType &type)
+{
+ for (const auto &eqFunction : mArrayEqualityFunctions)
+ {
+ if (eqFunction->type == type)
+ {
+ return eqFunction->functionName;
+ }
+ }
+
+ TType elementType(type);
+ elementType.toArrayElementType();
+
+ ArrayHelperFunction *function = new ArrayHelperFunction();
+ function->type = type;
+
+ function->functionName = ArrayHelperFunctionName("angle_eq", type);
+
+ TInfoSinkBase fnOut;
+
+ const TString &typeName = TypeString(type);
+ fnOut << "bool " << function->functionName << "(" << typeName << " a" << ArrayString(type)
+ << ", " << typeName << " b" << ArrayString(type) << ")\n"
+ << "{\n"
+ " for (int i = 0; i < "
+ << type.getOutermostArraySize()
+ << "; ++i)\n"
+ " {\n"
+ " if (";
+
+ outputEqual(PreVisit, elementType, EOpNotEqual, fnOut);
+ fnOut << "a[i]";
+ outputEqual(InVisit, elementType, EOpNotEqual, fnOut);
+ fnOut << "b[i]";
+ outputEqual(PostVisit, elementType, EOpNotEqual, fnOut);
+
+ fnOut << ") { return false; }\n"
+ " }\n"
+ " return true;\n"
+ "}\n";
+
+ function->functionDefinition = fnOut.c_str();
+
+ mArrayEqualityFunctions.push_back(function);
+ mEqualityFunctions.push_back(function);
+
+ return function->functionName;
+}
+
+TString OutputHLSL::addArrayAssignmentFunction(const TType &type)
+{
+ for (const auto &assignFunction : mArrayAssignmentFunctions)
+ {
+ if (assignFunction.type == type)
+ {
+ return assignFunction.functionName;
+ }
+ }
+
+ TType elementType(type);
+ elementType.toArrayElementType();
+
+ ArrayHelperFunction function;
+ function.type = type;
+
+ function.functionName = ArrayHelperFunctionName("angle_assign", type);
+
+ TInfoSinkBase fnOut;
+
+ const TString &typeName = TypeString(type);
+ fnOut << "void " << function.functionName << "(out " << typeName << " a" << ArrayString(type)
+ << ", " << typeName << " b" << ArrayString(type) << ")\n"
+ << "{\n"
+ " for (int i = 0; i < "
+ << type.getOutermostArraySize()
+ << "; ++i)\n"
+ " {\n"
+ " ";
+
+ outputAssign(PreVisit, elementType, fnOut);
+ fnOut << "a[i]";
+ outputAssign(InVisit, elementType, fnOut);
+ fnOut << "b[i]";
+ outputAssign(PostVisit, elementType, fnOut);
+
+ fnOut << ";\n"
+ " }\n"
+ "}\n";
+
+ function.functionDefinition = fnOut.c_str();
+
+ mArrayAssignmentFunctions.push_back(function);
+
+ return function.functionName;
+}
+
+TString OutputHLSL::addArrayConstructIntoFunction(const TType &type)
+{
+ for (const auto &constructIntoFunction : mArrayConstructIntoFunctions)
+ {
+ if (constructIntoFunction.type == type)
+ {
+ return constructIntoFunction.functionName;
+ }
+ }
+
+ TType elementType(type);
+ elementType.toArrayElementType();
+
+ ArrayHelperFunction function;
+ function.type = type;
+
+ function.functionName = ArrayHelperFunctionName("angle_construct_into", type);
+
+ TInfoSinkBase fnOut;
+
+ const TString &typeName = TypeString(type);
+ fnOut << "void " << function.functionName << "(out " << typeName << " a" << ArrayString(type);
+ for (unsigned int i = 0u; i < type.getOutermostArraySize(); ++i)
+ {
+ fnOut << ", " << typeName << " b" << i << ArrayString(elementType);
+ }
+ fnOut << ")\n"
+ "{\n";
+
+ for (unsigned int i = 0u; i < type.getOutermostArraySize(); ++i)
+ {
+ fnOut << " ";
+ outputAssign(PreVisit, elementType, fnOut);
+ fnOut << "a[" << i << "]";
+ outputAssign(InVisit, elementType, fnOut);
+ fnOut << "b" << i;
+ outputAssign(PostVisit, elementType, fnOut);
+ fnOut << ";\n";
+ }
+ fnOut << "}\n";
+
+ function.functionDefinition = fnOut.c_str();
+
+ mArrayConstructIntoFunctions.push_back(function);
+
+ return function.functionName;
+}
+
+void OutputHLSL::ensureStructDefined(const TType &type)
+{
+ const TStructure *structure = type.getStruct();
+ if (structure)
+ {
+ ASSERT(type.getBasicType() == EbtStruct);
+ mStructureHLSL->ensureStructDefined(*structure);
+ }
+}
+
+bool OutputHLSL::shaderNeedsGenerateOutput() const
+{
+ return mShaderType == GL_VERTEX_SHADER || mShaderType == GL_FRAGMENT_SHADER;
+}
+
+const char *OutputHLSL::generateOutputCall() const
+{
+ if (mShaderType == GL_VERTEX_SHADER)
+ {
+ return "generateOutput(input)";
+ }
+ else
+ {
+ return "generateOutput()";
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputHLSL.h b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.h
new file mode 100644
index 0000000000..7aaa303e5d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.h
@@ -0,0 +1,279 @@
+//
+// 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_OUTPUTHLSL_H_
+#define COMPILER_TRANSLATOR_OUTPUTHLSL_H_
+
+#include <list>
+#include <map>
+#include <stack>
+
+#include "angle_gl.h"
+#include "compiler/translator/ASTMetadataHLSL.h"
+#include "compiler/translator/Compiler.h"
+#include "compiler/translator/FlagStd140Structs.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/ShaderStorageBlockOutputHLSL.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+class BuiltInFunctionEmulator;
+
+namespace sh
+{
+class AtomicCounterFunctionHLSL;
+class ImageFunctionHLSL;
+class ResourcesHLSL;
+class StructureHLSL;
+class TextureFunctionHLSL;
+class TSymbolTable;
+class TVariable;
+class UnfoldShortCircuit;
+
+using ReferencedVariables = std::map<int, const TVariable *>;
+
+class OutputHLSL : public TIntermTraverser
+{
+ public:
+ OutputHLSL(sh::GLenum shaderType,
+ int shaderVersion,
+ const TExtensionBehavior &extensionBehavior,
+ const char *sourcePath,
+ ShShaderOutput outputType,
+ int numRenderTargets,
+ int maxDualSourceDrawBuffers,
+ const std::vector<Uniform> &uniforms,
+ ShCompileOptions compileOptions,
+ sh::WorkGroupSize workGroupSize,
+ TSymbolTable *symbolTable,
+ PerformanceDiagnostics *perfDiagnostics,
+ const std::vector<InterfaceBlock> &shaderStorageBlocks);
+
+ ~OutputHLSL();
+
+ void output(TIntermNode *treeRoot, TInfoSinkBase &objSink);
+
+ const std::map<std::string, unsigned int> &getShaderStorageBlockRegisterMap() const;
+ const std::map<std::string, unsigned int> &getUniformBlockRegisterMap() const;
+ const std::map<std::string, unsigned int> &getUniformRegisterMap() const;
+ unsigned int getReadonlyImage2DRegisterIndex() const;
+ unsigned int getImage2DRegisterIndex() const;
+ const std::set<std::string> &getUsedImage2DFunctionNames() const;
+
+ TInfoSinkBase &getInfoSink()
+ {
+ ASSERT(!mInfoSinkStack.empty());
+ return *mInfoSinkStack.top();
+ }
+
+ protected:
+ friend class ShaderStorageBlockOutputHLSL;
+
+ TString zeroInitializer(const TType &type) const;
+
+ void writeReferencedAttributes(TInfoSinkBase &out) const;
+ void writeReferencedVaryings(TInfoSinkBase &out) const;
+ void header(TInfoSinkBase &out,
+ const std::vector<MappedStruct> &std140Structs,
+ const BuiltInFunctionEmulator *builtInFunctionEmulator) const;
+
+ void writeFloat(TInfoSinkBase &out, float f);
+ void writeSingleConstant(TInfoSinkBase &out, const TConstantUnion *const constUnion);
+ const TConstantUnion *writeConstantUnionArray(TInfoSinkBase &out,
+ const TConstantUnion *const constUnion,
+ const size_t size);
+
+ // Visit AST nodes and output their code to the body stream
+ void visitSymbol(TIntermSymbol *) override;
+ void visitConstantUnion(TIntermConstantUnion *) override;
+ bool visitSwizzle(Visit visit, TIntermSwizzle *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *) override;
+ bool visitUnary(Visit visit, TIntermUnary *) override;
+ bool visitTernary(Visit visit, TIntermTernary *) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *) override;
+ bool visitSwitch(Visit visit, TIntermSwitch *) override;
+ bool visitCase(Visit visit, TIntermCase *) override;
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *) override;
+ bool visitBlock(Visit visit, TIntermBlock *node) override;
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override;
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+ bool visitLoop(Visit visit, TIntermLoop *) override;
+ bool visitBranch(Visit visit, TIntermBranch *) override;
+
+ bool handleExcessiveLoop(TInfoSinkBase &out, TIntermLoop *node);
+
+ // Emit one of three strings depending on traverse phase. Called with literal strings so using
+ // const char* instead of TString.
+ void outputTriplet(TInfoSinkBase &out,
+ Visit visit,
+ const char *preString,
+ const char *inString,
+ const char *postString);
+ void outputLineDirective(TInfoSinkBase &out, int line);
+ void writeParameter(const TVariable *param, TInfoSinkBase &out);
+
+ void outputConstructor(TInfoSinkBase &out, Visit visit, TIntermAggregate *node);
+ const TConstantUnion *writeConstantUnion(TInfoSinkBase &out,
+ const TType &type,
+ const TConstantUnion *constUnion);
+
+ void outputEqual(Visit visit, const TType &type, TOperator op, TInfoSinkBase &out);
+ void outputAssign(Visit visit, const TType &type, TInfoSinkBase &out);
+
+ void writeEmulatedFunctionTriplet(TInfoSinkBase &out, Visit visit, TOperator op);
+
+ // Returns true if it found a 'same symbol' initializer (initializer that references the
+ // variable it's initting)
+ bool writeSameSymbolInitializer(TInfoSinkBase &out,
+ TIntermSymbol *symbolNode,
+ TIntermTyped *expression);
+ // Returns true if variable initializer could be written using literal {} notation.
+ bool writeConstantInitialization(TInfoSinkBase &out,
+ TIntermSymbol *symbolNode,
+ TIntermTyped *expression);
+
+ void writeIfElse(TInfoSinkBase &out, TIntermIfElse *node);
+
+ // Returns the function name
+ TString addStructEqualityFunction(const TStructure &structure);
+ TString addArrayEqualityFunction(const TType &type);
+ TString addArrayAssignmentFunction(const TType &type);
+ TString addArrayConstructIntoFunction(const TType &type);
+
+ // Ensures if the type is a struct, the struct is defined
+ void ensureStructDefined(const TType &type);
+
+ bool shaderNeedsGenerateOutput() const;
+ const char *generateOutputCall() const;
+
+ sh::GLenum mShaderType;
+ int mShaderVersion;
+ const TExtensionBehavior &mExtensionBehavior;
+ const char *mSourcePath;
+ const ShShaderOutput mOutputType;
+ ShCompileOptions mCompileOptions;
+
+ bool mInsideFunction;
+ bool mInsideMain;
+
+ // Output streams
+ TInfoSinkBase mHeader;
+ TInfoSinkBase mBody;
+ TInfoSinkBase mFooter;
+
+ // A stack is useful when we want to traverse in the header, or in helper functions, but not
+ // always write to the body. Instead use an InfoSink stack to keep our current state intact.
+ // TODO (jmadill): Just passing an InfoSink in function parameters would be simpler.
+ std::stack<TInfoSinkBase *> mInfoSinkStack;
+
+ ReferencedVariables mReferencedUniforms;
+
+ // Indexed by block id, not instance id.
+ ReferencedInterfaceBlocks mReferencedUniformBlocks;
+
+ ReferencedVariables mReferencedAttributes;
+ ReferencedVariables mReferencedVaryings;
+ ReferencedVariables mReferencedOutputVariables;
+
+ StructureHLSL *mStructureHLSL;
+ ResourcesHLSL *mResourcesHLSL;
+ TextureFunctionHLSL *mTextureFunctionHLSL;
+ ImageFunctionHLSL *mImageFunctionHLSL;
+ AtomicCounterFunctionHLSL *mAtomicCounterFunctionHLSL;
+
+ // Parameters determining what goes in the header output
+ bool mUsesFragColor;
+ bool mUsesFragData;
+ bool mUsesDepthRange;
+ bool mUsesFragCoord;
+ bool mUsesPointCoord;
+ bool mUsesFrontFacing;
+ bool mUsesPointSize;
+ bool mUsesInstanceID;
+ bool mHasMultiviewExtensionEnabled;
+ bool mUsesViewID;
+ bool mUsesVertexID;
+ bool mUsesFragDepth;
+ bool mUsesNumWorkGroups;
+ bool mUsesWorkGroupID;
+ bool mUsesLocalInvocationID;
+ bool mUsesGlobalInvocationID;
+ bool mUsesLocalInvocationIndex;
+ bool mUsesXor;
+ bool mUsesDiscardRewriting;
+ bool mUsesNestedBreak;
+ bool mRequiresIEEEStrictCompiling;
+ mutable bool mUseZeroArray;
+ bool mUsesSecondaryColor;
+
+ int mNumRenderTargets;
+ int mMaxDualSourceDrawBuffers;
+
+ int mUniqueIndex; // For creating unique names
+
+ CallDAG mCallDag;
+ MetadataList mASTMetadataList;
+ ASTMetadataHLSL *mCurrentFunctionMetadata;
+ bool mOutputLod0Function;
+ bool mInsideDiscontinuousLoop;
+ int mNestedLoopDepth;
+
+ TIntermSymbol *mExcessiveLoopIndex;
+
+ TString structInitializerString(int indent, const TType &type, const TString &name) const;
+
+ struct HelperFunction
+ {
+ TString functionName;
+ TString functionDefinition;
+
+ virtual ~HelperFunction() {}
+ };
+
+ // A list of all equality comparison functions. It's important to preserve the order at
+ // which we add the functions, since nested structures call each other recursively, and
+ // structure equality functions may need to call array equality functions and vice versa.
+ // The ownership of the pointers is maintained by the type-specific arrays.
+ std::vector<HelperFunction *> mEqualityFunctions;
+
+ struct StructEqualityFunction : public HelperFunction
+ {
+ const TStructure *structure;
+ };
+ std::vector<StructEqualityFunction *> mStructEqualityFunctions;
+
+ struct ArrayHelperFunction : public HelperFunction
+ {
+ TType type;
+ };
+ std::vector<ArrayHelperFunction *> mArrayEqualityFunctions;
+
+ std::vector<ArrayHelperFunction> mArrayAssignmentFunctions;
+
+ // The construct-into functions are functions that fill an N-element array passed as an out
+ // parameter with the other N parameters of the function. This is used to work around that
+ // arrays can't be return values in HLSL.
+ std::vector<ArrayHelperFunction> mArrayConstructIntoFunctions;
+
+ sh::WorkGroupSize mWorkGroupSize;
+
+ PerformanceDiagnostics *mPerfDiagnostics;
+
+ private:
+ TString generateStructMapping(const std::vector<MappedStruct> &std140Structs) const;
+ ImmutableString samplerNamePrefixFromStruct(TIntermTyped *node);
+ bool ancestorEvaluatesToSamplerInStruct();
+ // We need to do struct mapping when pass the struct to a function or copy the struct via
+ // assignment.
+ bool needStructMapping(TIntermTyped *node);
+
+ ShaderStorageBlockOutputHLSL *mSSBOOutputHLSL;
+ bool mNeedStructMapping;
+};
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_OUTPUTHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputTree.cpp b/gfx/angle/checkout/src/compiler/translator/OutputTree.cpp
new file mode 100644
index 0000000000..6de64a660a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputTree.cpp
@@ -0,0 +1,699 @@
+//
+// 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/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void OutputFunction(TInfoSinkBase &out, const char *str, const TFunction *func)
+{
+ const char *internal =
+ (func->symbolType() == SymbolType::AngleInternal) ? " (internal function)" : "";
+ out << str << internal << ": " << func->name() << " (symbol id " << func->uniqueId().get()
+ << ")";
+}
+
+// Two purposes:
+// 1. Show an example of how to iterate tree. Functions can also directly call traverse() on
+// children themselves to have finer grained control over the process than shown here, though
+// that's not recommended if it can be avoided.
+// 2. Print out a text based description of the tree.
+
+// The traverser subclass is used to carry along data from node to node in the traversal.
+class TOutputTraverser : public TIntermTraverser
+{
+ public:
+ TOutputTraverser(TInfoSinkBase &out)
+ : TIntermTraverser(true, false, false), mOut(out), mIndentDepth(0)
+ {}
+
+ protected:
+ void visitSymbol(TIntermSymbol *) override;
+ void visitConstantUnion(TIntermConstantUnion *) override;
+ bool visitSwizzle(Visit visit, TIntermSwizzle *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *) override;
+ bool visitUnary(Visit visit, TIntermUnary *) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override;
+ bool visitSwitch(Visit visit, TIntermSwitch *node) override;
+ bool visitCase(Visit visit, TIntermCase *node) override;
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *) override;
+ bool visitBlock(Visit visit, TIntermBlock *) override;
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override;
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+ bool visitLoop(Visit visit, TIntermLoop *) override;
+ bool visitBranch(Visit visit, TIntermBranch *) override;
+
+ int getCurrentIndentDepth() const { return mIndentDepth + getCurrentTraversalDepth(); }
+
+ TInfoSinkBase &mOut;
+ int mIndentDepth;
+};
+
+//
+// Helper functions for printing, not part of traversing.
+//
+void OutputTreeText(TInfoSinkBase &out, TIntermNode *node, const int depth)
+{
+ int i;
+
+ out.location(node->getLine().first_file, node->getLine().first_line);
+
+ for (i = 0; i < depth; ++i)
+ out << " ";
+}
+
+//
+// The rest of the file are the traversal functions. The last one
+// is the one that starts the traversal.
+//
+// Return true from interior nodes to have the external traversal
+// continue on to children. If you process children yourself,
+// return false.
+//
+
+void TOutputTraverser::visitSymbol(TIntermSymbol *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ if (node->variable().symbolType() == SymbolType::Empty)
+ {
+ mOut << "''";
+ }
+ else
+ {
+ mOut << "'" << node->getName() << "' ";
+ }
+ mOut << "(symbol id " << node->uniqueId().get() << ") ";
+ mOut << "(" << node->getType() << ")";
+ mOut << "\n";
+}
+
+bool TOutputTraverser::visitSwizzle(Visit visit, TIntermSwizzle *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "vector swizzle (";
+ node->writeOffsetsAsXYZW(&mOut);
+ mOut << ")";
+
+ mOut << " (" << node->getType() << ")";
+ mOut << "\n";
+ return true;
+}
+
+bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ switch (node->getOp())
+ {
+ case EOpComma:
+ mOut << "comma";
+ break;
+ case EOpAssign:
+ mOut << "move second child to first child";
+ break;
+ case EOpInitialize:
+ mOut << "initialize first child with second child";
+ break;
+ case EOpAddAssign:
+ mOut << "add second child into first child";
+ break;
+ case EOpSubAssign:
+ mOut << "subtract second child into first child";
+ break;
+ case EOpMulAssign:
+ mOut << "multiply second child into first child";
+ break;
+ case EOpVectorTimesMatrixAssign:
+ mOut << "matrix mult second child into first child";
+ break;
+ case EOpVectorTimesScalarAssign:
+ mOut << "vector scale second child into first child";
+ break;
+ case EOpMatrixTimesScalarAssign:
+ mOut << "matrix scale second child into first child";
+ break;
+ case EOpMatrixTimesMatrixAssign:
+ mOut << "matrix mult second child into first child";
+ break;
+ case EOpDivAssign:
+ mOut << "divide second child into first child";
+ break;
+ case EOpIModAssign:
+ mOut << "modulo second child into first child";
+ break;
+ case EOpBitShiftLeftAssign:
+ mOut << "bit-wise shift first child left by second child";
+ break;
+ case EOpBitShiftRightAssign:
+ mOut << "bit-wise shift first child right by second child";
+ break;
+ case EOpBitwiseAndAssign:
+ mOut << "bit-wise and second child into first child";
+ break;
+ case EOpBitwiseXorAssign:
+ mOut << "bit-wise xor second child into first child";
+ break;
+ case EOpBitwiseOrAssign:
+ mOut << "bit-wise or second child into first child";
+ break;
+
+ case EOpIndexDirect:
+ mOut << "direct index";
+ break;
+ case EOpIndexIndirect:
+ mOut << "indirect index";
+ break;
+ case EOpIndexDirectStruct:
+ mOut << "direct index for structure";
+ break;
+ case EOpIndexDirectInterfaceBlock:
+ mOut << "direct index for interface block";
+ break;
+
+ case EOpAdd:
+ mOut << "add";
+ break;
+ case EOpSub:
+ mOut << "subtract";
+ break;
+ case EOpMul:
+ mOut << "component-wise multiply";
+ break;
+ case EOpDiv:
+ mOut << "divide";
+ break;
+ case EOpIMod:
+ mOut << "modulo";
+ break;
+ case EOpBitShiftLeft:
+ mOut << "bit-wise shift left";
+ break;
+ case EOpBitShiftRight:
+ mOut << "bit-wise shift right";
+ break;
+ case EOpBitwiseAnd:
+ mOut << "bit-wise and";
+ break;
+ case EOpBitwiseXor:
+ mOut << "bit-wise xor";
+ break;
+ case EOpBitwiseOr:
+ mOut << "bit-wise or";
+ break;
+
+ case EOpEqual:
+ mOut << "Compare Equal";
+ break;
+ case EOpNotEqual:
+ mOut << "Compare Not Equal";
+ break;
+ case EOpLessThan:
+ mOut << "Compare Less Than";
+ break;
+ case EOpGreaterThan:
+ mOut << "Compare Greater Than";
+ break;
+ case EOpLessThanEqual:
+ mOut << "Compare Less Than or Equal";
+ break;
+ case EOpGreaterThanEqual:
+ mOut << "Compare Greater Than or Equal";
+ break;
+
+ case EOpVectorTimesScalar:
+ mOut << "vector-scale";
+ break;
+ case EOpVectorTimesMatrix:
+ mOut << "vector-times-matrix";
+ break;
+ case EOpMatrixTimesVector:
+ mOut << "matrix-times-vector";
+ break;
+ case EOpMatrixTimesScalar:
+ mOut << "matrix-scale";
+ break;
+ case EOpMatrixTimesMatrix:
+ mOut << "matrix-multiply";
+ break;
+
+ case EOpLogicalOr:
+ mOut << "logical-or";
+ break;
+ case EOpLogicalXor:
+ mOut << "logical-xor";
+ break;
+ case EOpLogicalAnd:
+ mOut << "logical-and";
+ break;
+ default:
+ mOut << "<unknown op>";
+ }
+
+ mOut << " (" << node->getType() << ")";
+
+ mOut << "\n";
+
+ // Special handling for direct indexes. Because constant
+ // unions are not aware they are struct indexes, treat them
+ // here where we have that contextual knowledge.
+ if (node->getOp() == EOpIndexDirectStruct || node->getOp() == EOpIndexDirectInterfaceBlock)
+ {
+ node->getLeft()->traverse(this);
+
+ TIntermConstantUnion *intermConstantUnion = node->getRight()->getAsConstantUnion();
+ ASSERT(intermConstantUnion);
+
+ OutputTreeText(mOut, intermConstantUnion, getCurrentIndentDepth() + 1);
+
+ // The following code finds the field name from the constant union
+ const TConstantUnion *constantUnion = intermConstantUnion->getConstantValue();
+ const TStructure *structure = node->getLeft()->getType().getStruct();
+ const TInterfaceBlock *interfaceBlock = node->getLeft()->getType().getInterfaceBlock();
+ ASSERT(structure || interfaceBlock);
+
+ const TFieldList &fields = structure ? structure->fields() : interfaceBlock->fields();
+
+ const TField *field = fields[constantUnion->getIConst()];
+
+ mOut << constantUnion->getIConst() << " (field '" << field->name() << "')";
+
+ mOut << "\n";
+
+ return false;
+ }
+
+ return true;
+}
+
+bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ switch (node->getOp())
+ {
+ // Give verbose names for ops that have special syntax and some built-in functions that are
+ // easy to confuse with others, but mostly use GLSL names for functions.
+ case EOpNegative:
+ mOut << "Negate value";
+ break;
+ case EOpPositive:
+ mOut << "Positive sign";
+ break;
+ case EOpLogicalNot:
+ mOut << "negation";
+ break;
+ case EOpBitwiseNot:
+ mOut << "bit-wise not";
+ break;
+
+ case EOpPostIncrement:
+ mOut << "Post-Increment";
+ break;
+ case EOpPostDecrement:
+ mOut << "Post-Decrement";
+ break;
+ case EOpPreIncrement:
+ mOut << "Pre-Increment";
+ break;
+ case EOpPreDecrement:
+ mOut << "Pre-Decrement";
+ break;
+
+ case EOpArrayLength:
+ mOut << "Array length";
+ break;
+
+ case EOpLogicalNotComponentWise:
+ mOut << "component-wise not";
+ break;
+
+ default:
+ mOut << GetOperatorString(node->getOp());
+ break;
+ }
+
+ mOut << " (" << node->getType() << ")";
+
+ mOut << "\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "Function Definition:\n";
+ return true;
+}
+
+bool TOutputTraverser::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "Invariant Declaration:\n";
+ return true;
+}
+
+void TOutputTraverser::visitFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ OutputFunction(mOut, "Function Prototype", node->getFunction());
+ mOut << " (" << node->getType() << ")";
+ mOut << "\n";
+ size_t paramCount = node->getFunction()->getParamCount();
+ for (size_t i = 0; i < paramCount; ++i)
+ {
+ const TVariable *param = node->getFunction()->getParam(i);
+ OutputTreeText(mOut, node, getCurrentIndentDepth() + 1);
+ mOut << "parameter: " << param->name() << " (" << param->getType() << ")";
+ }
+}
+
+bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ if (node->getOp() == EOpNull)
+ {
+ mOut.prefix(SH_ERROR);
+ mOut << "node is still EOpNull!\n";
+ return true;
+ }
+
+ // Give verbose names for some built-in functions that are easy to confuse with others, but
+ // mostly use GLSL names for functions.
+ switch (node->getOp())
+ {
+ case EOpCallFunctionInAST:
+ OutputFunction(mOut, "Call an user-defined function", node->getFunction());
+ break;
+ case EOpCallInternalRawFunction:
+ OutputFunction(mOut, "Call an internal function with raw implementation",
+ node->getFunction());
+ break;
+ case EOpCallBuiltInFunction:
+ OutputFunction(mOut, "Call a built-in function", node->getFunction());
+ break;
+
+ case EOpConstruct:
+ // The type of the constructor will be printed below.
+ mOut << "Construct";
+ break;
+
+ case EOpEqualComponentWise:
+ mOut << "component-wise equal";
+ break;
+ case EOpNotEqualComponentWise:
+ mOut << "component-wise not equal";
+ break;
+ case EOpLessThanComponentWise:
+ mOut << "component-wise less than";
+ break;
+ case EOpGreaterThanComponentWise:
+ mOut << "component-wise greater than";
+ break;
+ case EOpLessThanEqualComponentWise:
+ mOut << "component-wise less than or equal";
+ break;
+ case EOpGreaterThanEqualComponentWise:
+ mOut << "component-wise greater than or equal";
+ break;
+
+ case EOpDot:
+ mOut << "dot product";
+ break;
+ case EOpCross:
+ mOut << "cross product";
+ break;
+ case EOpMulMatrixComponentWise:
+ mOut << "component-wise multiply";
+ break;
+
+ default:
+ mOut << GetOperatorString(node->getOp());
+ break;
+ }
+
+ mOut << " (" << node->getType() << ")";
+
+ mOut << "\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitBlock(Visit visit, TIntermBlock *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "Code block\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "Declaration\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitTernary(Visit visit, TIntermTernary *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ mOut << "Ternary selection";
+ mOut << " (" << node->getType() << ")\n";
+
+ ++mIndentDepth;
+
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "Condition\n";
+ node->getCondition()->traverse(this);
+
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ if (node->getTrueExpression())
+ {
+ mOut << "true case\n";
+ node->getTrueExpression()->traverse(this);
+ }
+ if (node->getFalseExpression())
+ {
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "false case\n";
+ node->getFalseExpression()->traverse(this);
+ }
+
+ --mIndentDepth;
+
+ return false;
+}
+
+bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ mOut << "If test\n";
+
+ ++mIndentDepth;
+
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "Condition\n";
+ node->getCondition()->traverse(this);
+
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ if (node->getTrueBlock())
+ {
+ mOut << "true case\n";
+ node->getTrueBlock()->traverse(this);
+ }
+ else
+ {
+ mOut << "true case is null\n";
+ }
+
+ if (node->getFalseBlock())
+ {
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "false case\n";
+ node->getFalseBlock()->traverse(this);
+ }
+
+ --mIndentDepth;
+
+ return false;
+}
+
+bool TOutputTraverser::visitSwitch(Visit visit, TIntermSwitch *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ mOut << "Switch\n";
+
+ return true;
+}
+
+bool TOutputTraverser::visitCase(Visit visit, TIntermCase *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ if (node->getCondition() == nullptr)
+ {
+ mOut << "Default\n";
+ }
+ else
+ {
+ mOut << "Case\n";
+ }
+
+ return true;
+}
+
+void TOutputTraverser::visitConstantUnion(TIntermConstantUnion *node)
+{
+ size_t size = node->getType().getObjectSize();
+
+ for (size_t i = 0; i < size; i++)
+ {
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ switch (node->getConstantValue()[i].getType())
+ {
+ case EbtBool:
+ if (node->getConstantValue()[i].getBConst())
+ mOut << "true";
+ else
+ mOut << "false";
+
+ mOut << " ("
+ << "const bool"
+ << ")";
+ mOut << "\n";
+ break;
+ case EbtFloat:
+ mOut << node->getConstantValue()[i].getFConst();
+ mOut << " (const float)\n";
+ break;
+ case EbtInt:
+ mOut << node->getConstantValue()[i].getIConst();
+ mOut << " (const int)\n";
+ break;
+ case EbtUInt:
+ mOut << node->getConstantValue()[i].getUConst();
+ mOut << " (const uint)\n";
+ break;
+ case EbtYuvCscStandardEXT:
+ mOut << getYuvCscStandardEXTString(
+ node->getConstantValue()[i].getYuvCscStandardEXTConst());
+ mOut << " (const yuvCscStandardEXT)\n";
+ break;
+ default:
+ mOut.prefix(SH_ERROR);
+ mOut << "Unknown constant\n";
+ break;
+ }
+ }
+}
+
+bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ mOut << "Loop with condition ";
+ if (node->getType() == ELoopDoWhile)
+ mOut << "not ";
+ mOut << "tested first\n";
+
+ ++mIndentDepth;
+
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ if (node->getCondition())
+ {
+ mOut << "Loop Condition\n";
+ node->getCondition()->traverse(this);
+ }
+ else
+ {
+ mOut << "No loop condition\n";
+ }
+
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ if (node->getBody())
+ {
+ mOut << "Loop Body\n";
+ node->getBody()->traverse(this);
+ }
+ else
+ {
+ mOut << "No loop body\n";
+ }
+
+ if (node->getExpression())
+ {
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+ mOut << "Loop Terminal Expression\n";
+ node->getExpression()->traverse(this);
+ }
+
+ --mIndentDepth;
+
+ return false;
+}
+
+bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch *node)
+{
+ OutputTreeText(mOut, node, getCurrentIndentDepth());
+
+ switch (node->getFlowOp())
+ {
+ case EOpKill:
+ mOut << "Branch: Kill";
+ break;
+ case EOpBreak:
+ mOut << "Branch: Break";
+ break;
+ case EOpContinue:
+ mOut << "Branch: Continue";
+ break;
+ case EOpReturn:
+ mOut << "Branch: Return";
+ break;
+ default:
+ mOut << "Branch: Unknown Branch";
+ break;
+ }
+
+ if (node->getExpression())
+ {
+ mOut << " with expression\n";
+ ++mIndentDepth;
+ node->getExpression()->traverse(this);
+ --mIndentDepth;
+ }
+ else
+ {
+ mOut << "\n";
+ }
+
+ return false;
+}
+
+} // anonymous namespace
+
+void OutputTree(TIntermNode *root, TInfoSinkBase &out)
+{
+ TOutputTraverser it(out);
+ ASSERT(root);
+ root->traverse(&it);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/OutputTree.h b/gfx/angle/checkout/src/compiler/translator/OutputTree.h
new file mode 100644
index 0000000000..9f11989cb1
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/OutputTree.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Output the AST intermediate representation of the GLSL code.
+
+#ifndef COMPILER_TRANSLATOR_OUTPUTTREE_H_
+#define COMPILER_TRANSLATOR_OUTPUTTREE_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TInfoSinkBase;
+
+// Output the AST along with metadata.
+void OutputTree(TIntermNode *root, TInfoSinkBase &out);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_OUTPUTTREE_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/ParseContext.cpp b/gfx/angle/checkout/src/compiler/translator/ParseContext.cpp
new file mode 100644
index 0000000000..5808c880d1
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ParseContext.cpp
@@ -0,0 +1,6100 @@
+//
+// 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/ParseContext.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "common/mathutil.h"
+#include "compiler/preprocessor/SourceLocation.h"
+#include "compiler/translator/Declarator.h"
+#include "compiler/translator/ParseContext_autogen.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/ValidateGlobalInitializer.h"
+#include "compiler/translator/ValidateSwitch.h"
+#include "compiler/translator/glslang.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+///////////////////////////////////////////////////////////////////////
+//
+// Sub- vector and matrix fields
+//
+////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+
+const int kWebGLMaxStructNesting = 4;
+
+bool ContainsSampler(const TStructure *structType);
+
+bool ContainsSampler(const TType &type)
+{
+ if (IsSampler(type.getBasicType()))
+ {
+ return true;
+ }
+ if (type.getBasicType() == EbtStruct)
+ {
+ return ContainsSampler(type.getStruct());
+ }
+
+ return false;
+}
+
+bool ContainsSampler(const TStructure *structType)
+{
+ for (const auto &field : structType->fields())
+ {
+ if (ContainsSampler(*field->type()))
+ return true;
+ }
+ return false;
+}
+
+// Get a token from an image argument to use as an error message token.
+const char *GetImageArgumentToken(TIntermTyped *imageNode)
+{
+ ASSERT(IsImage(imageNode->getBasicType()));
+ while (imageNode->getAsBinaryNode() &&
+ (imageNode->getAsBinaryNode()->getOp() == EOpIndexIndirect ||
+ imageNode->getAsBinaryNode()->getOp() == EOpIndexDirect))
+ {
+ imageNode = imageNode->getAsBinaryNode()->getLeft();
+ }
+ TIntermSymbol *imageSymbol = imageNode->getAsSymbolNode();
+ if (imageSymbol)
+ {
+ return imageSymbol->getName().data();
+ }
+ return "image";
+}
+
+bool CanSetDefaultPrecisionOnType(const TPublicType &type)
+{
+ if (!SupportsPrecision(type.getBasicType()))
+ {
+ return false;
+ }
+ if (type.getBasicType() == EbtUInt)
+ {
+ // ESSL 3.00.4 section 4.5.4
+ return false;
+ }
+ if (type.isAggregate())
+ {
+ // Not allowed to set for aggregate types
+ return false;
+ }
+ return true;
+}
+
+// Map input primitive types to input array sizes in a geometry shader.
+GLuint GetGeometryShaderInputArraySize(TLayoutPrimitiveType primitiveType)
+{
+ switch (primitiveType)
+ {
+ case EptPoints:
+ return 1u;
+ case EptLines:
+ return 2u;
+ case EptTriangles:
+ return 3u;
+ case EptLinesAdjacency:
+ return 4u;
+ case EptTrianglesAdjacency:
+ return 6u;
+ default:
+ UNREACHABLE();
+ return 0u;
+ }
+}
+
+bool IsBufferOrSharedVariable(TIntermTyped *var)
+{
+ if (var->isInterfaceBlock() || var->getQualifier() == EvqBuffer ||
+ var->getQualifier() == EvqShared)
+ {
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
+// This tracks each binding point's current default offset for inheritance of subsequent
+// variables using the same binding, and keeps offsets unique and non overlapping.
+// See GLSL ES 3.1, section 4.4.6.
+class TParseContext::AtomicCounterBindingState
+{
+ public:
+ AtomicCounterBindingState() : mDefaultOffset(0) {}
+ // Inserts a new span and returns -1 if overlapping, else returns the starting offset of
+ // newly inserted span.
+ int insertSpan(int start, size_t length)
+ {
+ gl::RangeI newSpan(start, start + static_cast<int>(length));
+ for (const auto &span : mSpans)
+ {
+ if (newSpan.intersects(span))
+ {
+ return -1;
+ }
+ }
+ mSpans.push_back(newSpan);
+ mDefaultOffset = newSpan.high();
+ return start;
+ }
+ // Inserts a new span starting from the default offset.
+ int appendSpan(size_t length) { return insertSpan(mDefaultOffset, length); }
+ void setDefaultOffset(int offset) { mDefaultOffset = offset; }
+
+ private:
+ int mDefaultOffset;
+ std::vector<gl::RangeI> mSpans;
+};
+
+TParseContext::TParseContext(TSymbolTable &symt,
+ TExtensionBehavior &ext,
+ sh::GLenum type,
+ ShShaderSpec spec,
+ ShCompileOptions options,
+ bool checksPrecErrors,
+ TDiagnostics *diagnostics,
+ const ShBuiltInResources &resources)
+ : symbolTable(symt),
+ mDeferredNonEmptyDeclarationErrorCheck(false),
+ mShaderType(type),
+ mShaderSpec(spec),
+ mCompileOptions(options),
+ mShaderVersion(100),
+ mTreeRoot(nullptr),
+ mLoopNestingLevel(0),
+ mStructNestingLevel(0),
+ mSwitchNestingLevel(0),
+ mCurrentFunctionType(nullptr),
+ mFunctionReturnsValue(false),
+ mChecksPrecisionErrors(checksPrecErrors),
+ mFragmentPrecisionHighOnESSL1(false),
+ mDefaultUniformMatrixPacking(EmpColumnMajor),
+ mDefaultUniformBlockStorage(sh::IsWebGLBasedSpec(spec) ? EbsStd140 : EbsShared),
+ mDefaultBufferMatrixPacking(EmpColumnMajor),
+ mDefaultBufferBlockStorage(sh::IsWebGLBasedSpec(spec) ? EbsStd140 : EbsShared),
+ mDiagnostics(diagnostics),
+ mDirectiveHandler(ext,
+ *mDiagnostics,
+ mShaderVersion,
+ mShaderType,
+ resources.WEBGL_debug_shader_precision == 1),
+ mPreprocessor(mDiagnostics, &mDirectiveHandler, angle::pp::PreprocessorSettings(spec)),
+ mScanner(nullptr),
+ mMinProgramTexelOffset(resources.MinProgramTexelOffset),
+ mMaxProgramTexelOffset(resources.MaxProgramTexelOffset),
+ mMinProgramTextureGatherOffset(resources.MinProgramTextureGatherOffset),
+ mMaxProgramTextureGatherOffset(resources.MaxProgramTextureGatherOffset),
+ mComputeShaderLocalSizeDeclared(false),
+ mComputeShaderLocalSize(-1),
+ mNumViews(-1),
+ mMaxNumViews(resources.MaxViewsOVR),
+ mMaxImageUnits(resources.MaxImageUnits),
+ mMaxCombinedTextureImageUnits(resources.MaxCombinedTextureImageUnits),
+ mMaxUniformLocations(resources.MaxUniformLocations),
+ mMaxUniformBufferBindings(resources.MaxUniformBufferBindings),
+ mMaxAtomicCounterBindings(resources.MaxAtomicCounterBindings),
+ mMaxShaderStorageBufferBindings(resources.MaxShaderStorageBufferBindings),
+ mDeclaringFunction(false),
+ mGeometryShaderInputPrimitiveType(EptUndefined),
+ mGeometryShaderOutputPrimitiveType(EptUndefined),
+ mGeometryShaderInvocations(0),
+ mGeometryShaderMaxVertices(-1),
+ mMaxGeometryShaderInvocations(resources.MaxGeometryShaderInvocations),
+ mMaxGeometryShaderMaxVertices(resources.MaxGeometryOutputVertices),
+ mFunctionBodyNewScope(false)
+{}
+
+TParseContext::~TParseContext() {}
+
+bool TParseContext::anyMultiviewExtensionAvailable()
+{
+ return isExtensionEnabled(TExtension::OVR_multiview) ||
+ isExtensionEnabled(TExtension::OVR_multiview2);
+}
+
+bool TParseContext::parseVectorFields(const TSourceLoc &line,
+ const ImmutableString &compString,
+ int vecSize,
+ TVector<int> *fieldOffsets)
+{
+ ASSERT(fieldOffsets);
+ size_t fieldCount = compString.length();
+ if (fieldCount > 4u)
+ {
+ error(line, "illegal vector field selection", compString);
+ return false;
+ }
+ fieldOffsets->resize(fieldCount);
+
+ enum
+ {
+ exyzw,
+ ergba,
+ estpq
+ } fieldSet[4];
+
+ for (unsigned int i = 0u; i < fieldOffsets->size(); ++i)
+ {
+ switch (compString[i])
+ {
+ case 'x':
+ (*fieldOffsets)[i] = 0;
+ fieldSet[i] = exyzw;
+ break;
+ case 'r':
+ (*fieldOffsets)[i] = 0;
+ fieldSet[i] = ergba;
+ break;
+ case 's':
+ (*fieldOffsets)[i] = 0;
+ fieldSet[i] = estpq;
+ break;
+ case 'y':
+ (*fieldOffsets)[i] = 1;
+ fieldSet[i] = exyzw;
+ break;
+ case 'g':
+ (*fieldOffsets)[i] = 1;
+ fieldSet[i] = ergba;
+ break;
+ case 't':
+ (*fieldOffsets)[i] = 1;
+ fieldSet[i] = estpq;
+ break;
+ case 'z':
+ (*fieldOffsets)[i] = 2;
+ fieldSet[i] = exyzw;
+ break;
+ case 'b':
+ (*fieldOffsets)[i] = 2;
+ fieldSet[i] = ergba;
+ break;
+ case 'p':
+ (*fieldOffsets)[i] = 2;
+ fieldSet[i] = estpq;
+ break;
+
+ case 'w':
+ (*fieldOffsets)[i] = 3;
+ fieldSet[i] = exyzw;
+ break;
+ case 'a':
+ (*fieldOffsets)[i] = 3;
+ fieldSet[i] = ergba;
+ break;
+ case 'q':
+ (*fieldOffsets)[i] = 3;
+ fieldSet[i] = estpq;
+ break;
+ default:
+ error(line, "illegal vector field selection", compString);
+ return false;
+ }
+ }
+
+ for (unsigned int i = 0u; i < fieldOffsets->size(); ++i)
+ {
+ if ((*fieldOffsets)[i] >= vecSize)
+ {
+ error(line, "vector field selection out of range", compString);
+ return false;
+ }
+
+ if (i > 0)
+ {
+ if (fieldSet[i] != fieldSet[i - 1])
+ {
+ error(line, "illegal - vector component fields not from the same set", compString);
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// Errors
+//
+////////////////////////////////////////////////////////////////////////
+
+//
+// Used by flex/bison to output all syntax and parsing errors.
+//
+void TParseContext::error(const TSourceLoc &loc, const char *reason, const char *token)
+{
+ mDiagnostics->error(loc, reason, token);
+}
+
+void TParseContext::error(const TSourceLoc &loc, const char *reason, const ImmutableString &token)
+{
+ mDiagnostics->error(loc, reason, token.data());
+}
+
+void TParseContext::warning(const TSourceLoc &loc, const char *reason, const char *token)
+{
+ mDiagnostics->warning(loc, reason, token);
+}
+
+void TParseContext::outOfRangeError(bool isError,
+ const TSourceLoc &loc,
+ const char *reason,
+ const char *token)
+{
+ if (isError)
+ {
+ error(loc, reason, token);
+ }
+ else
+ {
+ warning(loc, reason, token);
+ }
+}
+
+//
+// Same error message for all places assignments don't work.
+//
+void TParseContext::assignError(const TSourceLoc &line,
+ const char *op,
+ const TType &left,
+ const TType &right)
+{
+ TInfoSinkBase reasonStream;
+ reasonStream << "cannot convert from '" << right << "' to '" << left << "'";
+ error(line, reasonStream.c_str(), op);
+}
+
+//
+// Same error message for all places unary operations don't work.
+//
+void TParseContext::unaryOpError(const TSourceLoc &line, const char *op, const TType &operand)
+{
+ TInfoSinkBase reasonStream;
+ reasonStream << "wrong operand type - no operation '" << op
+ << "' exists that takes an operand of type " << operand
+ << " (or there is no acceptable conversion)";
+ error(line, reasonStream.c_str(), op);
+}
+
+//
+// Same error message for all binary operations don't work.
+//
+void TParseContext::binaryOpError(const TSourceLoc &line,
+ const char *op,
+ const TType &left,
+ const TType &right)
+{
+ TInfoSinkBase reasonStream;
+ reasonStream << "wrong operand types - no operation '" << op
+ << "' exists that takes a left-hand operand of type '" << left
+ << "' and a right operand of type '" << right
+ << "' (or there is no acceptable conversion)";
+ error(line, reasonStream.c_str(), op);
+}
+
+void TParseContext::checkPrecisionSpecified(const TSourceLoc &line,
+ TPrecision precision,
+ TBasicType type)
+{
+ if (!mChecksPrecisionErrors)
+ return;
+
+ if (precision != EbpUndefined && !SupportsPrecision(type))
+ {
+ error(line, "illegal type for precision qualifier", getBasicString(type));
+ }
+
+ if (precision == EbpUndefined)
+ {
+ switch (type)
+ {
+ case EbtFloat:
+ error(line, "No precision specified for (float)", "");
+ return;
+ case EbtInt:
+ case EbtUInt:
+ UNREACHABLE(); // there's always a predeclared qualifier
+ error(line, "No precision specified (int)", "");
+ return;
+ default:
+ if (IsOpaqueType(type))
+ {
+ error(line, "No precision specified", getBasicString(type));
+ return;
+ }
+ }
+ }
+}
+
+void TParseContext::markStaticReadIfSymbol(TIntermNode *node)
+{
+ TIntermSwizzle *swizzleNode = node->getAsSwizzleNode();
+ if (swizzleNode)
+ {
+ markStaticReadIfSymbol(swizzleNode->getOperand());
+ return;
+ }
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+ if (binaryNode)
+ {
+ switch (binaryNode->getOp())
+ {
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock:
+ markStaticReadIfSymbol(binaryNode->getLeft());
+ return;
+ default:
+ return;
+ }
+ }
+ TIntermSymbol *symbolNode = node->getAsSymbolNode();
+ if (symbolNode)
+ {
+ symbolTable.markStaticRead(symbolNode->variable());
+ }
+}
+
+// Both test and if necessary, spit out an error, to see if the node is really
+// an l-value that can be operated on this way.
+bool TParseContext::checkCanBeLValue(const TSourceLoc &line, const char *op, TIntermTyped *node)
+{
+ TIntermSwizzle *swizzleNode = node->getAsSwizzleNode();
+ if (swizzleNode)
+ {
+ bool ok = checkCanBeLValue(line, op, swizzleNode->getOperand());
+ if (ok && swizzleNode->hasDuplicateOffsets())
+ {
+ error(line, " l-value of swizzle cannot have duplicate components", op);
+ return false;
+ }
+ return ok;
+ }
+
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+ if (binaryNode)
+ {
+ switch (binaryNode->getOp())
+ {
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock:
+ if (node->getMemoryQualifier().readonly)
+ {
+ error(line, "can't modify a readonly variable", op);
+ return false;
+ }
+ return checkCanBeLValue(line, op, binaryNode->getLeft());
+ default:
+ break;
+ }
+ error(line, " l-value required", op);
+ return false;
+ }
+
+ std::string message;
+ switch (node->getQualifier())
+ {
+ case EvqConst:
+ message = "can't modify a const";
+ break;
+ case EvqConstReadOnly:
+ message = "can't modify a const";
+ break;
+ case EvqAttribute:
+ message = "can't modify an attribute";
+ break;
+ case EvqFragmentIn:
+ case EvqVertexIn:
+ case EvqGeometryIn:
+ case EvqFlatIn:
+ case EvqSmoothIn:
+ case EvqCentroidIn:
+ message = "can't modify an input";
+ break;
+ case EvqUniform:
+ message = "can't modify a uniform";
+ break;
+ case EvqVaryingIn:
+ message = "can't modify a varying";
+ break;
+ case EvqFragCoord:
+ message = "can't modify gl_FragCoord";
+ break;
+ case EvqFrontFacing:
+ message = "can't modify gl_FrontFacing";
+ break;
+ case EvqPointCoord:
+ message = "can't modify gl_PointCoord";
+ break;
+ case EvqNumWorkGroups:
+ message = "can't modify gl_NumWorkGroups";
+ break;
+ case EvqWorkGroupSize:
+ message = "can't modify gl_WorkGroupSize";
+ break;
+ case EvqWorkGroupID:
+ message = "can't modify gl_WorkGroupID";
+ break;
+ case EvqLocalInvocationID:
+ message = "can't modify gl_LocalInvocationID";
+ break;
+ case EvqGlobalInvocationID:
+ message = "can't modify gl_GlobalInvocationID";
+ break;
+ case EvqLocalInvocationIndex:
+ message = "can't modify gl_LocalInvocationIndex";
+ break;
+ case EvqViewIDOVR:
+ message = "can't modify gl_ViewID_OVR";
+ break;
+ case EvqComputeIn:
+ message = "can't modify work group size variable";
+ break;
+ case EvqPerVertexIn:
+ message = "can't modify any member in gl_in";
+ break;
+ case EvqPrimitiveIDIn:
+ message = "can't modify gl_PrimitiveIDIn";
+ break;
+ case EvqInvocationID:
+ message = "can't modify gl_InvocationID";
+ break;
+ case EvqPrimitiveID:
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ message = "can't modify gl_PrimitiveID in a fragment shader";
+ }
+ break;
+ case EvqLayer:
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ message = "can't modify gl_Layer in a fragment shader";
+ }
+ break;
+ default:
+ //
+ // Type that can't be written to?
+ //
+ if (node->getBasicType() == EbtVoid)
+ {
+ message = "can't modify void";
+ }
+ if (IsOpaqueType(node->getBasicType()))
+ {
+ message = "can't modify a variable with type ";
+ message += getBasicString(node->getBasicType());
+ }
+ else if (node->getMemoryQualifier().readonly)
+ {
+ message = "can't modify a readonly variable";
+ }
+ }
+
+ ASSERT(binaryNode == nullptr && swizzleNode == nullptr);
+ TIntermSymbol *symNode = node->getAsSymbolNode();
+ if (message.empty() && symNode != nullptr)
+ {
+ symbolTable.markStaticWrite(symNode->variable());
+ return true;
+ }
+
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
+ reasonStream << "l-value required";
+ if (!message.empty())
+ {
+ if (symNode)
+ {
+ // Symbol inside an expression can't be nameless.
+ ASSERT(symNode->variable().symbolType() != SymbolType::Empty);
+ const ImmutableString &symbol = symNode->getName();
+ reasonStream << " (" << message << " \"" << symbol << "\")";
+ }
+ else
+ {
+ reasonStream << " (" << message << ")";
+ }
+ }
+ std::string reason = reasonStream.str();
+ error(line, reason.c_str(), op);
+
+ return false;
+}
+
+// Both test, and if necessary spit out an error, to see if the node is really
+// a constant.
+void TParseContext::checkIsConst(TIntermTyped *node)
+{
+ if (node->getQualifier() != EvqConst)
+ {
+ error(node->getLine(), "constant expression required", "");
+ }
+}
+
+// Both test, and if necessary spit out an error, to see if the node is really
+// an integer.
+void TParseContext::checkIsScalarInteger(TIntermTyped *node, const char *token)
+{
+ if (!node->isScalarInt())
+ {
+ error(node->getLine(), "integer expression required", token);
+ }
+}
+
+// Both test, and if necessary spit out an error, to see if we are currently
+// globally scoped.
+bool TParseContext::checkIsAtGlobalLevel(const TSourceLoc &line, const char *token)
+{
+ if (!symbolTable.atGlobalLevel())
+ {
+ error(line, "only allowed at global scope", token);
+ return false;
+ }
+ return true;
+}
+
+// ESSL 3.00.5 sections 3.8 and 3.9.
+// If it starts "gl_" or contains two consecutive underscores, it's reserved.
+// Also checks for "webgl_" and "_webgl_" reserved identifiers if parsing a webgl shader.
+bool TParseContext::checkIsNotReserved(const TSourceLoc &line, const ImmutableString &identifier)
+{
+ static const char *reservedErrMsg = "reserved built-in name";
+ if (identifier.beginsWith("gl_"))
+ {
+ error(line, reservedErrMsg, "gl_");
+ return false;
+ }
+ if (sh::IsWebGLBasedSpec(mShaderSpec))
+ {
+ if (identifier.beginsWith("webgl_"))
+ {
+ error(line, reservedErrMsg, "webgl_");
+ return false;
+ }
+ if (identifier.beginsWith("_webgl_"))
+ {
+ error(line, reservedErrMsg, "_webgl_");
+ return false;
+ }
+ }
+ if (identifier.contains("__"))
+ {
+ error(line,
+ "identifiers containing two consecutive underscores (__) are reserved as "
+ "possible future keywords",
+ identifier);
+ return false;
+ }
+ return true;
+}
+
+// Make sure the argument types are correct for constructing a specific type.
+bool TParseContext::checkConstructorArguments(const TSourceLoc &line,
+ const TIntermSequence &arguments,
+ const TType &type)
+{
+ if (arguments.empty())
+ {
+ error(line, "constructor does not have any arguments", "constructor");
+ return false;
+ }
+
+ for (TIntermNode *arg : arguments)
+ {
+ markStaticReadIfSymbol(arg);
+ const TIntermTyped *argTyped = arg->getAsTyped();
+ ASSERT(argTyped != nullptr);
+ if (type.getBasicType() != EbtStruct && IsOpaqueType(argTyped->getBasicType()))
+ {
+ std::string reason("cannot convert a variable with type ");
+ reason += getBasicString(argTyped->getBasicType());
+ error(line, reason.c_str(), "constructor");
+ return false;
+ }
+ else if (argTyped->getMemoryQualifier().writeonly)
+ {
+ error(line, "cannot convert a variable with writeonly", "constructor");
+ return false;
+ }
+ if (argTyped->getBasicType() == EbtVoid)
+ {
+ error(line, "cannot convert a void", "constructor");
+ return false;
+ }
+ }
+
+ if (type.isArray())
+ {
+ // The size of an unsized constructor should already have been determined.
+ ASSERT(!type.isUnsizedArray());
+ if (static_cast<size_t>(type.getOutermostArraySize()) != arguments.size())
+ {
+ error(line, "array constructor needs one argument per array element", "constructor");
+ return false;
+ }
+ // GLSL ES 3.00 section 5.4.4: Each argument must be the same type as the element type of
+ // the array.
+ for (TIntermNode *const &argNode : arguments)
+ {
+ const TType &argType = argNode->getAsTyped()->getType();
+ if (mShaderVersion < 310 && argType.isArray())
+ {
+ error(line, "constructing from a non-dereferenced array", "constructor");
+ return false;
+ }
+ if (!argType.isElementTypeOf(type))
+ {
+ error(line, "Array constructor argument has an incorrect type", "constructor");
+ return false;
+ }
+ }
+ }
+ else if (type.getBasicType() == EbtStruct)
+ {
+ const TFieldList &fields = type.getStruct()->fields();
+ if (fields.size() != arguments.size())
+ {
+ error(line,
+ "Number of constructor parameters does not match the number of structure fields",
+ "constructor");
+ return false;
+ }
+
+ for (size_t i = 0; i < fields.size(); i++)
+ {
+ if (i >= arguments.size() ||
+ arguments[i]->getAsTyped()->getType() != *fields[i]->type())
+ {
+ error(line, "Structure constructor arguments do not match structure fields",
+ "constructor");
+ return false;
+ }
+ }
+ }
+ else
+ {
+ // We're constructing a scalar, vector, or matrix.
+
+ // Note: It's okay to have too many components available, but not okay to have unused
+ // arguments. 'full' will go to true when enough args have been seen. If we loop again,
+ // there is an extra argument, so 'overFull' will become true.
+
+ size_t size = 0;
+ bool full = false;
+ bool overFull = false;
+ bool matrixArg = false;
+ for (TIntermNode *arg : arguments)
+ {
+ const TIntermTyped *argTyped = arg->getAsTyped();
+ ASSERT(argTyped != nullptr);
+
+ if (argTyped->getBasicType() == EbtStruct)
+ {
+ error(line, "a struct cannot be used as a constructor argument for this type",
+ "constructor");
+ return false;
+ }
+ if (argTyped->getType().isArray())
+ {
+ error(line, "constructing from a non-dereferenced array", "constructor");
+ return false;
+ }
+ if (argTyped->getType().isMatrix())
+ {
+ matrixArg = true;
+ }
+
+ size += argTyped->getType().getObjectSize();
+ if (full)
+ {
+ overFull = true;
+ }
+ if (size >= type.getObjectSize())
+ {
+ full = true;
+ }
+ }
+
+ if (type.isMatrix() && matrixArg)
+ {
+ if (arguments.size() != 1)
+ {
+ error(line, "constructing matrix from matrix can only take one argument",
+ "constructor");
+ return false;
+ }
+ }
+ else
+ {
+ if (size != 1 && size < type.getObjectSize())
+ {
+ error(line, "not enough data provided for construction", "constructor");
+ return false;
+ }
+ if (overFull)
+ {
+ error(line, "too many arguments", "constructor");
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+// This function checks to see if a void variable has been declared and raise an error message for
+// such a case
+//
+// returns true in case of an error
+//
+bool TParseContext::checkIsNonVoid(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ const TBasicType &type)
+{
+ if (type == EbtVoid)
+ {
+ error(line, "illegal use of type 'void'", identifier);
+ return false;
+ }
+
+ return true;
+}
+
+// This function checks to see if the node (for the expression) contains a scalar boolean expression
+// or not.
+bool TParseContext::checkIsScalarBool(const TSourceLoc &line, const TIntermTyped *type)
+{
+ if (type->getBasicType() != EbtBool || !type->isScalar())
+ {
+ error(line, "boolean expression expected", "");
+ return false;
+ }
+ return true;
+}
+
+// This function checks to see if the node (for the expression) contains a scalar boolean expression
+// or not.
+void TParseContext::checkIsScalarBool(const TSourceLoc &line, const TPublicType &pType)
+{
+ if (pType.getBasicType() != EbtBool || pType.isAggregate())
+ {
+ error(line, "boolean expression expected", "");
+ }
+}
+
+bool TParseContext::checkIsNotOpaqueType(const TSourceLoc &line,
+ const TTypeSpecifierNonArray &pType,
+ const char *reason)
+{
+ if (pType.type == EbtStruct)
+ {
+ if (ContainsSampler(pType.userDef))
+ {
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
+ reasonStream << reason << " (structure contains a sampler)";
+ std::string reasonStr = reasonStream.str();
+ error(line, reasonStr.c_str(), getBasicString(pType.type));
+ return false;
+ }
+ // only samplers need to be checked from structs, since other opaque types can't be struct
+ // members.
+ return true;
+ }
+ else if (IsOpaqueType(pType.type))
+ {
+ error(line, reason, getBasicString(pType.type));
+ return false;
+ }
+
+ return true;
+}
+
+void TParseContext::checkDeclaratorLocationIsNotSpecified(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");
+ }
+}
+
+void TParseContext::checkLocationIsNotSpecified(const TSourceLoc &location,
+ const TLayoutQualifier &layoutQualifier)
+{
+ if (layoutQualifier.location != -1)
+ {
+ const char *errorMsg = "invalid layout qualifier: only valid on program inputs and outputs";
+ if (mShaderVersion >= 310)
+ {
+ errorMsg =
+ "invalid layout qualifier: only valid on shader inputs, outputs, and uniforms";
+ }
+ error(location, errorMsg, "location");
+ }
+}
+
+void TParseContext::checkStd430IsForShaderStorageBlock(const TSourceLoc &location,
+ const TLayoutBlockStorage &blockStorage,
+ const TQualifier &qualifier)
+{
+ if (blockStorage == EbsStd430 && qualifier != EvqBuffer)
+ {
+ error(location, "The std430 layout is supported only for shader storage blocks.", "std430");
+ }
+}
+
+void TParseContext::checkOutParameterIsNotOpaqueType(const TSourceLoc &line,
+ TQualifier qualifier,
+ const TType &type)
+{
+ ASSERT(qualifier == EvqOut || qualifier == EvqInOut);
+ if (IsOpaqueType(type.getBasicType()))
+ {
+ error(line, "opaque types cannot be output parameters", type.getBasicString());
+ }
+}
+
+// Do size checking for an array type's size.
+unsigned int TParseContext::checkIsValidArraySize(const TSourceLoc &line, TIntermTyped *expr)
+{
+ TIntermConstantUnion *constant = expr->getAsConstantUnion();
+
+ // ANGLE should be able to fold any EvqConst expressions resulting in an integer - but to be
+ // safe against corner cases we still check for constant folding. Some interpretations of the
+ // spec have allowed constant expressions with side effects - like array length() method on a
+ // non-constant array.
+ if (expr->getQualifier() != EvqConst || constant == nullptr || !constant->isScalarInt())
+ {
+ error(line, "array size must be a constant integer expression", "");
+ return 1u;
+ }
+
+ unsigned int size = 0u;
+
+ if (constant->getBasicType() == EbtUInt)
+ {
+ size = constant->getUConst(0);
+ }
+ else
+ {
+ int signedSize = constant->getIConst(0);
+
+ if (signedSize < 0)
+ {
+ error(line, "array size must be non-negative", "");
+ return 1u;
+ }
+
+ size = static_cast<unsigned int>(signedSize);
+ }
+
+ if (size == 0u)
+ {
+ error(line, "array size must be greater than zero", "");
+ return 1u;
+ }
+
+ // The size of arrays is restricted here to prevent issues further down the
+ // compiler/translator/driver stack. Shader Model 5 generation hardware is limited to
+ // 4096 registers so this should be reasonable even for aggressively optimizable code.
+ const unsigned int sizeLimit = 65536;
+
+ if (size > sizeLimit)
+ {
+ error(line, "array size too large", "");
+ return 1u;
+ }
+
+ return size;
+}
+
+// See if this qualifier can be an array.
+bool TParseContext::checkIsValidQualifierForArray(const TSourceLoc &line,
+ const TPublicType &elementQualifier)
+{
+ if ((elementQualifier.qualifier == EvqAttribute) ||
+ (elementQualifier.qualifier == EvqVertexIn) ||
+ (elementQualifier.qualifier == EvqConst && mShaderVersion < 300))
+ {
+ error(line, "cannot declare arrays of this qualifier",
+ TType(elementQualifier).getQualifierString());
+ return false;
+ }
+
+ return true;
+}
+
+// See if this element type can be formed into an array.
+bool TParseContext::checkArrayElementIsNotArray(const TSourceLoc &line,
+ const TPublicType &elementType)
+{
+ if (mShaderVersion < 310 && elementType.isArray())
+ {
+ TInfoSinkBase typeString;
+ typeString << TType(elementType);
+ error(line, "cannot declare arrays of arrays", typeString.c_str());
+ return false;
+ }
+ return true;
+}
+
+// Check if this qualified element type can be formed into an array. This is only called when array
+// brackets are associated with an identifier in a declaration, like this:
+// float a[2];
+// Similar checks are done in addFullySpecifiedType for array declarations where the array brackets
+// are associated with the type, like this:
+// float[2] a;
+bool TParseContext::checkIsValidTypeAndQualifierForArray(const TSourceLoc &indexLocation,
+ const TPublicType &elementType)
+{
+ if (!checkArrayElementIsNotArray(indexLocation, elementType))
+ {
+ return false;
+ }
+ // In ESSL1.00 shaders, structs cannot be varying (section 4.3.5). This is checked elsewhere.
+ // In ESSL3.00 shaders, struct inputs/outputs are allowed but not arrays of structs (section
+ // 4.3.4).
+ // Geometry shader requires each user-defined input be declared as arrays or inside input
+ // blocks declared as arrays (GL_EXT_geometry_shader section 11.1gs.4.3). For the purposes of
+ // interface matching, such variables and blocks are treated as though they were not declared
+ // as arrays (GL_EXT_geometry_shader section 7.4.1).
+ if (mShaderVersion >= 300 && elementType.getBasicType() == EbtStruct &&
+ sh::IsVarying(elementType.qualifier) &&
+ !IsGeometryShaderInput(mShaderType, elementType.qualifier))
+ {
+ TInfoSinkBase typeString;
+ typeString << TType(elementType);
+ error(indexLocation, "cannot declare arrays of structs of this qualifier",
+ typeString.c_str());
+ return false;
+ }
+ return checkIsValidQualifierForArray(indexLocation, elementType);
+}
+
+// Enforce non-initializer type/qualifier rules.
+void TParseContext::checkCanBeDeclaredWithoutInitializer(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ TType *type)
+{
+ ASSERT(type != nullptr);
+ if (type->getQualifier() == EvqConst)
+ {
+ // Make the qualifier make sense.
+ type->setQualifier(EvqTemporary);
+
+ // Generate informative error messages for ESSL1.
+ // In ESSL3 arrays and structures containing arrays can be constant.
+ if (mShaderVersion < 300 && type->isStructureContainingArrays())
+ {
+ error(line,
+ "structures containing arrays may not be declared constant since they cannot be "
+ "initialized",
+ identifier);
+ }
+ else
+ {
+ error(line, "variables with qualifier 'const' must be initialized", identifier);
+ }
+ }
+ // This will make the type sized if it isn't sized yet.
+ checkIsNotUnsizedArray(line, "implicitly sized arrays need to be initialized", identifier,
+ type);
+}
+
+// Do some simple checks that are shared between all variable declarations,
+// and update the symbol table.
+//
+// Returns true if declaring the variable succeeded.
+//
+bool TParseContext::declareVariable(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ const TType *type,
+ TVariable **variable)
+{
+ ASSERT((*variable) == nullptr);
+
+ (*variable) = new TVariable(&symbolTable, identifier, type, SymbolType::UserDefined);
+
+ ASSERT(type->getLayoutQualifier().index == -1 ||
+ (isExtensionEnabled(TExtension::EXT_blend_func_extended) &&
+ mShaderType == GL_FRAGMENT_SHADER && mShaderVersion >= 300));
+ if (type->getQualifier() == EvqFragmentOut)
+ {
+ if (type->getLayoutQualifier().index != -1 && type->getLayoutQualifier().location == -1)
+ {
+ error(line,
+ "If index layout qualifier is specified for a fragment output, location must "
+ "also be specified.",
+ "index");
+ return false;
+ }
+ }
+ else
+ {
+ checkIndexIsNotSpecified(line, type->getLayoutQualifier().index);
+ }
+
+ checkBindingIsValid(line, *type);
+
+ bool needsReservedCheck = true;
+
+ // gl_LastFragData may be redeclared with a new precision qualifier
+ if (type->isArray() && identifier.beginsWith("gl_LastFragData"))
+ {
+ const TVariable *maxDrawBuffers = static_cast<const TVariable *>(
+ symbolTable.findBuiltIn(ImmutableString("gl_MaxDrawBuffers"), mShaderVersion));
+ if (type->isArrayOfArrays())
+ {
+ error(line, "redeclaration of gl_LastFragData as an array of arrays", identifier);
+ return false;
+ }
+ else if (static_cast<int>(type->getOutermostArraySize()) ==
+ maxDrawBuffers->getConstPointer()->getIConst())
+ {
+ if (const TSymbol *builtInSymbol = symbolTable.findBuiltIn(identifier, mShaderVersion))
+ {
+ needsReservedCheck = !checkCanUseExtension(line, builtInSymbol->extension());
+ }
+ }
+ else
+ {
+ error(line, "redeclaration of gl_LastFragData with size != gl_MaxDrawBuffers",
+ identifier);
+ return false;
+ }
+ }
+
+ if (needsReservedCheck && !checkIsNotReserved(line, identifier))
+ return false;
+
+ if (!symbolTable.declare(*variable))
+ {
+ error(line, "redefinition", identifier);
+ return false;
+ }
+
+ if (!checkIsNonVoid(line, identifier, type->getBasicType()))
+ return false;
+
+ return true;
+}
+
+void TParseContext::checkIsParameterQualifierValid(
+ const TSourceLoc &line,
+ const TTypeQualifierBuilder &typeQualifierBuilder,
+ TType *type)
+{
+ // The only parameter qualifiers a parameter can have are in, out, inout or const.
+ TTypeQualifier typeQualifier = typeQualifierBuilder.getParameterTypeQualifier(mDiagnostics);
+
+ if (typeQualifier.qualifier == EvqOut || typeQualifier.qualifier == EvqInOut)
+ {
+ checkOutParameterIsNotOpaqueType(line, typeQualifier.qualifier, *type);
+ }
+
+ if (!IsImage(type->getBasicType()))
+ {
+ checkMemoryQualifierIsNotSpecified(typeQualifier.memoryQualifier, line);
+ }
+ else
+ {
+ type->setMemoryQualifier(typeQualifier.memoryQualifier);
+ }
+
+ type->setQualifier(typeQualifier.qualifier);
+
+ if (typeQualifier.precision != EbpUndefined)
+ {
+ type->setPrecision(typeQualifier.precision);
+ }
+}
+
+template <size_t size>
+bool TParseContext::checkCanUseOneOfExtensions(const TSourceLoc &line,
+ const std::array<TExtension, size> &extensions)
+{
+ ASSERT(!extensions.empty());
+ const TExtensionBehavior &extBehavior = extensionBehavior();
+
+ bool canUseWithWarning = false;
+ bool canUseWithoutWarning = false;
+
+ const char *errorMsgString = "";
+ TExtension errorMsgExtension = TExtension::UNDEFINED;
+
+ for (TExtension extension : extensions)
+ {
+ auto extIter = extBehavior.find(extension);
+ if (canUseWithWarning)
+ {
+ // We already have an extension that we can use, but with a warning.
+ // See if we can use the alternative extension without a warning.
+ if (extIter == extBehavior.end())
+ {
+ continue;
+ }
+ if (extIter->second == EBhEnable || extIter->second == EBhRequire)
+ {
+ canUseWithoutWarning = true;
+ break;
+ }
+ continue;
+ }
+ if (extIter == extBehavior.end())
+ {
+ errorMsgString = "extension is not supported";
+ errorMsgExtension = extension;
+ }
+ else if (extIter->second == EBhUndefined || extIter->second == EBhDisable)
+ {
+ errorMsgString = "extension is disabled";
+ errorMsgExtension = extension;
+ }
+ else if (extIter->second == EBhWarn)
+ {
+ errorMsgExtension = extension;
+ canUseWithWarning = true;
+ }
+ else
+ {
+ ASSERT(extIter->second == EBhEnable || extIter->second == EBhRequire);
+ canUseWithoutWarning = true;
+ break;
+ }
+ }
+
+ if (canUseWithoutWarning)
+ {
+ return true;
+ }
+ if (canUseWithWarning)
+ {
+ warning(line, "extension is being used", GetExtensionNameString(errorMsgExtension));
+ return true;
+ }
+ error(line, errorMsgString, GetExtensionNameString(errorMsgExtension));
+ return false;
+}
+
+template bool TParseContext::checkCanUseOneOfExtensions(
+ const TSourceLoc &line,
+ const std::array<TExtension, 1> &extensions);
+template bool TParseContext::checkCanUseOneOfExtensions(
+ const TSourceLoc &line,
+ const std::array<TExtension, 2> &extensions);
+template bool TParseContext::checkCanUseOneOfExtensions(
+ const TSourceLoc &line,
+ const std::array<TExtension, 3> &extensions);
+
+bool TParseContext::checkCanUseExtension(const TSourceLoc &line, TExtension extension)
+{
+ ASSERT(extension != TExtension::UNDEFINED);
+ return checkCanUseOneOfExtensions(line, std::array<TExtension, 1u>{{extension}});
+}
+
+// ESSL 3.00.6 section 4.8 Empty Declarations: "The combinations of qualifiers that cause
+// compile-time or link-time errors are the same whether or not the declaration is empty".
+// This function implements all the checks that are done on qualifiers regardless of if the
+// declaration is empty.
+void TParseContext::declarationQualifierErrorCheck(const sh::TQualifier qualifier,
+ const sh::TLayoutQualifier &layoutQualifier,
+ const TSourceLoc &location)
+{
+ if (qualifier == EvqShared && !layoutQualifier.isEmpty())
+ {
+ error(location, "Shared memory declarations cannot have layout specified", "layout");
+ }
+
+ if (layoutQualifier.matrixPacking != EmpUnspecified)
+ {
+ error(location, "layout qualifier only valid for interface blocks",
+ getMatrixPackingString(layoutQualifier.matrixPacking));
+ return;
+ }
+
+ if (layoutQualifier.blockStorage != EbsUnspecified)
+ {
+ error(location, "layout qualifier only valid for interface blocks",
+ getBlockStorageString(layoutQualifier.blockStorage));
+ return;
+ }
+
+ if (qualifier == EvqFragmentOut)
+ {
+ if (layoutQualifier.location != -1 && layoutQualifier.yuv == true)
+ {
+ error(location, "invalid layout qualifier combination", "yuv");
+ return;
+ }
+ }
+ else
+ {
+ checkYuvIsNotSpecified(location, layoutQualifier.yuv);
+ }
+
+ // If multiview extension is enabled, "in" qualifier is allowed in the vertex shader in previous
+ // parsing steps. So it needs to be checked here.
+ if (anyMultiviewExtensionAvailable() && mShaderVersion < 300 && qualifier == EvqVertexIn)
+ {
+ error(location, "storage qualifier supported in GLSL ES 3.00 and above only", "in");
+ }
+
+ bool canHaveLocation = qualifier == EvqVertexIn || qualifier == EvqFragmentOut;
+ if (mShaderVersion >= 310)
+ {
+ canHaveLocation = canHaveLocation || qualifier == EvqUniform || IsVarying(qualifier);
+ // We're not checking whether the uniform location is in range here since that depends on
+ // the type of the variable.
+ // The type can only be fully determined for non-empty declarations.
+ }
+ if (!canHaveLocation)
+ {
+ checkLocationIsNotSpecified(location, layoutQualifier);
+ }
+}
+
+void TParseContext::atomicCounterQualifierErrorCheck(const TPublicType &publicType,
+ const TSourceLoc &location)
+{
+ if (publicType.precision != EbpHigh)
+ {
+ error(location, "Can only be highp", "atomic counter");
+ }
+ // dEQP enforces compile error if location is specified. See uniform_location.test.
+ if (publicType.layoutQualifier.location != -1)
+ {
+ error(location, "location must not be set for atomic_uint", "layout");
+ }
+ if (publicType.layoutQualifier.binding == -1)
+ {
+ error(location, "no binding specified", "atomic counter");
+ }
+}
+
+void TParseContext::emptyDeclarationErrorCheck(const TType &type, const TSourceLoc &location)
+{
+ if (type.isUnsizedArray())
+ {
+ // ESSL3 spec section 4.1.9: Array declaration which leaves the size unspecified is an
+ // error. It is assumed that this applies to empty declarations as well.
+ error(location, "empty array declaration needs to specify a size", "");
+ }
+
+ if (type.getQualifier() != EvqFragmentOut)
+ {
+ checkIndexIsNotSpecified(location, type.getLayoutQualifier().index);
+ }
+}
+
+// These checks are done for all declarations that are non-empty. They're done for non-empty
+// declarations starting a declarator list, and declarators that follow an empty declaration.
+void TParseContext::nonEmptyDeclarationErrorCheck(const TPublicType &publicType,
+ const TSourceLoc &identifierLocation)
+{
+ switch (publicType.qualifier)
+ {
+ case EvqVaryingIn:
+ case EvqVaryingOut:
+ case EvqAttribute:
+ case EvqVertexIn:
+ case EvqFragmentOut:
+ case EvqComputeIn:
+ if (publicType.getBasicType() == EbtStruct)
+ {
+ error(identifierLocation, "cannot be used with a structure",
+ getQualifierString(publicType.qualifier));
+ return;
+ }
+ break;
+ case EvqBuffer:
+ if (publicType.getBasicType() != EbtInterfaceBlock)
+ {
+ error(identifierLocation,
+ "cannot declare buffer variables at global scope(outside a block)",
+ getQualifierString(publicType.qualifier));
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+ std::string reason(getBasicString(publicType.getBasicType()));
+ reason += "s must be uniform";
+ if (publicType.qualifier != EvqUniform &&
+ !checkIsNotOpaqueType(identifierLocation, publicType.typeSpecifierNonArray, reason.c_str()))
+ {
+ return;
+ }
+
+ if ((publicType.qualifier != EvqTemporary && publicType.qualifier != EvqGlobal &&
+ publicType.qualifier != EvqConst) &&
+ publicType.getBasicType() == EbtYuvCscStandardEXT)
+ {
+ error(identifierLocation, "cannot be used with a yuvCscStandardEXT",
+ getQualifierString(publicType.qualifier));
+ return;
+ }
+
+ if (mShaderVersion >= 310 && publicType.qualifier == EvqUniform)
+ {
+ // Valid uniform declarations can't be unsized arrays since uniforms can't be initialized.
+ // But invalid shaders may still reach here with an unsized array declaration.
+ TType type(publicType);
+ if (!type.isUnsizedArray())
+ {
+ checkUniformLocationInRange(identifierLocation, type.getLocationCount(),
+ publicType.layoutQualifier);
+ }
+ }
+
+ // check for layout qualifier issues
+ const TLayoutQualifier layoutQualifier = publicType.layoutQualifier;
+
+ if (IsImage(publicType.getBasicType()))
+ {
+
+ switch (layoutQualifier.imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ case EiifRGBA8:
+ case EiifRGBA8_SNORM:
+ if (!IsFloatImage(publicType.getBasicType()))
+ {
+ error(identifierLocation,
+ "internal image format requires a floating image type",
+ getBasicString(publicType.getBasicType()));
+ return;
+ }
+ break;
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ if (!IsIntegerImage(publicType.getBasicType()))
+ {
+ error(identifierLocation,
+ "internal image format requires an integer image type",
+ getBasicString(publicType.getBasicType()));
+ return;
+ }
+ break;
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ if (!IsUnsignedImage(publicType.getBasicType()))
+ {
+ error(identifierLocation,
+ "internal image format requires an unsigned image type",
+ getBasicString(publicType.getBasicType()));
+ return;
+ }
+ break;
+ case EiifUnspecified:
+ error(identifierLocation, "layout qualifier", "No image internal format specified");
+ return;
+ default:
+ error(identifierLocation, "layout qualifier", "unrecognized token");
+ return;
+ }
+
+ // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
+ switch (layoutQualifier.imageInternalFormat)
+ {
+ case EiifR32F:
+ case EiifR32I:
+ case EiifR32UI:
+ break;
+ default:
+ if (!publicType.memoryQualifier.readonly && !publicType.memoryQualifier.writeonly)
+ {
+ error(identifierLocation, "layout qualifier",
+ "Except for images with the r32f, r32i and r32ui format qualifiers, "
+ "image variables must be qualified readonly and/or writeonly");
+ return;
+ }
+ break;
+ }
+ }
+ else
+ {
+ checkInternalFormatIsNotSpecified(identifierLocation, layoutQualifier.imageInternalFormat);
+ checkMemoryQualifierIsNotSpecified(publicType.memoryQualifier, identifierLocation);
+ }
+
+ if (IsAtomicCounter(publicType.getBasicType()))
+ {
+ atomicCounterQualifierErrorCheck(publicType, identifierLocation);
+ }
+ else
+ {
+ checkOffsetIsNotSpecified(identifierLocation, layoutQualifier.offset);
+ }
+}
+
+void TParseContext::checkBindingIsValid(const TSourceLoc &identifierLocation, const TType &type)
+{
+ TLayoutQualifier layoutQualifier = type.getLayoutQualifier();
+ // Note that the ESSL 3.10 section 4.4.5 is not particularly clear on how the binding qualifier
+ // on arrays of arrays should be handled. We interpret the spec so that the binding value is
+ // incremented for each element of the innermost nested arrays. This is in line with how arrays
+ // of arrays of blocks are specified to behave in GLSL 4.50 and a conservative interpretation
+ // when it comes to which shaders are accepted by the compiler.
+ int arrayTotalElementCount = type.getArraySizeProduct();
+ if (IsImage(type.getBasicType()))
+ {
+ checkImageBindingIsValid(identifierLocation, layoutQualifier.binding,
+ arrayTotalElementCount);
+ }
+ else if (IsSampler(type.getBasicType()))
+ {
+ checkSamplerBindingIsValid(identifierLocation, layoutQualifier.binding,
+ arrayTotalElementCount);
+ }
+ else if (IsAtomicCounter(type.getBasicType()))
+ {
+ checkAtomicCounterBindingIsValid(identifierLocation, layoutQualifier.binding);
+ }
+ else
+ {
+ ASSERT(!IsOpaqueType(type.getBasicType()));
+ checkBindingIsNotSpecified(identifierLocation, layoutQualifier.binding);
+ }
+}
+
+void TParseContext::checkLayoutQualifierSupported(const TSourceLoc &location,
+ const ImmutableString &layoutQualifierName,
+ int versionRequired)
+{
+
+ if (mShaderVersion < versionRequired)
+ {
+ error(location, "invalid layout qualifier: not supported", layoutQualifierName);
+ }
+}
+
+bool TParseContext::checkWorkGroupSizeIsNotSpecified(const TSourceLoc &location,
+ const TLayoutQualifier &layoutQualifier)
+{
+ const sh::WorkGroupSize &localSize = layoutQualifier.localSize;
+ for (size_t i = 0u; i < localSize.size(); ++i)
+ {
+ if (localSize[i] != -1)
+ {
+ error(location,
+ "invalid layout qualifier: only valid when used with 'in' in a compute shader "
+ "global layout declaration",
+ getWorkGroupSizeString(i));
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void TParseContext::checkInternalFormatIsNotSpecified(const TSourceLoc &location,
+ TLayoutImageInternalFormat internalFormat)
+{
+ if (internalFormat != EiifUnspecified)
+ {
+ error(location, "invalid layout qualifier: only valid when used with images",
+ getImageInternalFormatString(internalFormat));
+ }
+}
+
+void TParseContext::checkIndexIsNotSpecified(const TSourceLoc &location, int index)
+{
+ if (index != -1)
+ {
+ error(location,
+ "invalid layout qualifier: only valid when used with a fragment shader output in "
+ "ESSL version >= 3.00 and EXT_blend_func_extended is enabled",
+ "index");
+ }
+}
+
+void TParseContext::checkBindingIsNotSpecified(const TSourceLoc &location, int binding)
+{
+ if (binding != -1)
+ {
+ error(location,
+ "invalid layout qualifier: only valid when used with opaque types or blocks",
+ "binding");
+ }
+}
+
+void TParseContext::checkOffsetIsNotSpecified(const TSourceLoc &location, int offset)
+{
+ if (offset != -1)
+ {
+ error(location, "invalid layout qualifier: only valid when used with atomic counters",
+ "offset");
+ }
+}
+
+void TParseContext::checkImageBindingIsValid(const TSourceLoc &location,
+ int binding,
+ int arrayTotalElementCount)
+{
+ // Expects arraySize to be 1 when setting binding for only a single variable.
+ if (binding >= 0 && binding + arrayTotalElementCount > mMaxImageUnits)
+ {
+ error(location, "image binding greater than gl_MaxImageUnits", "binding");
+ }
+}
+
+void TParseContext::checkSamplerBindingIsValid(const TSourceLoc &location,
+ int binding,
+ int arrayTotalElementCount)
+{
+ // Expects arraySize to be 1 when setting binding for only a single variable.
+ if (binding >= 0 && binding + arrayTotalElementCount > mMaxCombinedTextureImageUnits)
+ {
+ error(location, "sampler binding greater than maximum texture units", "binding");
+ }
+}
+
+void TParseContext::checkBlockBindingIsValid(const TSourceLoc &location,
+ const TQualifier &qualifier,
+ int binding,
+ int arraySize)
+{
+ int size = (arraySize == 0 ? 1 : arraySize);
+ if (qualifier == EvqUniform)
+ {
+ if (binding + size > mMaxUniformBufferBindings)
+ {
+ error(location, "uniform block binding greater than MAX_UNIFORM_BUFFER_BINDINGS",
+ "binding");
+ }
+ }
+ else if (qualifier == EvqBuffer)
+ {
+ if (binding + size > mMaxShaderStorageBufferBindings)
+ {
+ error(location,
+ "shader storage block binding greater than MAX_SHADER_STORAGE_BUFFER_BINDINGS",
+ "binding");
+ }
+ }
+}
+void TParseContext::checkAtomicCounterBindingIsValid(const TSourceLoc &location, int binding)
+{
+ if (binding >= mMaxAtomicCounterBindings)
+ {
+ error(location, "atomic counter binding greater than gl_MaxAtomicCounterBindings",
+ "binding");
+ }
+}
+
+void TParseContext::checkUniformLocationInRange(const TSourceLoc &location,
+ int objectLocationCount,
+ const TLayoutQualifier &layoutQualifier)
+{
+ int loc = layoutQualifier.location;
+ if (loc >= 0 && loc + objectLocationCount > mMaxUniformLocations)
+ {
+ error(location, "Uniform location out of range", "location");
+ }
+}
+
+void TParseContext::checkYuvIsNotSpecified(const TSourceLoc &location, bool yuv)
+{
+ if (yuv != false)
+ {
+ error(location, "invalid layout qualifier: only valid on program outputs", "yuv");
+ }
+}
+
+void TParseContext::functionCallRValueLValueErrorCheck(const TFunction *fnCandidate,
+ TIntermAggregate *fnCall)
+{
+ for (size_t i = 0; i < fnCandidate->getParamCount(); ++i)
+ {
+ TQualifier qual = fnCandidate->getParam(i)->getType().getQualifier();
+ TIntermTyped *argument = (*(fnCall->getSequence()))[i]->getAsTyped();
+ bool argumentIsRead = (IsQualifierUnspecified(qual) || qual == EvqIn || qual == EvqInOut ||
+ qual == EvqConstReadOnly);
+ if (argumentIsRead)
+ {
+ markStaticReadIfSymbol(argument);
+ if (!IsImage(argument->getBasicType()))
+ {
+ if (argument->getMemoryQualifier().writeonly)
+ {
+ error(argument->getLine(),
+ "Writeonly value cannot be passed for 'in' or 'inout' parameters.",
+ fnCall->functionName());
+ return;
+ }
+ }
+ }
+ if (qual == EvqOut || qual == EvqInOut)
+ {
+ if (!checkCanBeLValue(argument->getLine(), "assign", argument))
+ {
+ error(argument->getLine(),
+ "Constant value cannot be passed for 'out' or 'inout' parameters.",
+ fnCall->functionName());
+ return;
+ }
+ }
+ }
+}
+
+void TParseContext::checkInvariantVariableQualifier(bool invariant,
+ const TQualifier qualifier,
+ const TSourceLoc &invariantLocation)
+{
+ if (!invariant)
+ return;
+
+ if (mShaderVersion < 300)
+ {
+ // input variables in the fragment shader can be also qualified as invariant
+ if (!sh::CanBeInvariantESSL1(qualifier))
+ {
+ error(invariantLocation, "Cannot be qualified as invariant.", "invariant");
+ }
+ }
+ else
+ {
+ if (!sh::CanBeInvariantESSL3OrGreater(qualifier))
+ {
+ error(invariantLocation, "Cannot be qualified as invariant.", "invariant");
+ }
+ }
+}
+
+bool TParseContext::isExtensionEnabled(TExtension extension) const
+{
+ return IsExtensionEnabled(extensionBehavior(), extension);
+}
+
+void TParseContext::handleExtensionDirective(const TSourceLoc &loc,
+ const char *extName,
+ const char *behavior)
+{
+ angle::pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ mDirectiveHandler.handleExtension(srcLoc, extName, behavior);
+}
+
+void TParseContext::handlePragmaDirective(const TSourceLoc &loc,
+ const char *name,
+ const char *value,
+ bool stdgl)
+{
+ angle::pp::SourceLocation srcLoc;
+ srcLoc.file = loc.first_file;
+ srcLoc.line = loc.first_line;
+ mDirectiveHandler.handlePragma(srcLoc, name, value, stdgl);
+}
+
+sh::WorkGroupSize TParseContext::getComputeShaderLocalSize() const
+{
+ sh::WorkGroupSize result(-1);
+ for (size_t i = 0u; i < result.size(); ++i)
+ {
+ if (mComputeShaderLocalSizeDeclared && mComputeShaderLocalSize[i] == -1)
+ {
+ result[i] = 1;
+ }
+ else
+ {
+ result[i] = mComputeShaderLocalSize[i];
+ }
+ }
+ return result;
+}
+
+TIntermConstantUnion *TParseContext::addScalarLiteral(const TConstantUnion *constantUnion,
+ const TSourceLoc &line)
+{
+ TIntermConstantUnion *node = new TIntermConstantUnion(
+ constantUnion, TType(constantUnion->getType(), EbpUndefined, EvqConst));
+ node->setLine(line);
+ return node;
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+//
+// Non-Errors.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+const TVariable *TParseContext::getNamedVariable(const TSourceLoc &location,
+ const ImmutableString &name,
+ const TSymbol *symbol)
+{
+ if (!symbol)
+ {
+ error(location, "undeclared identifier", name);
+ return nullptr;
+ }
+
+ if (!symbol->isVariable())
+ {
+ error(location, "variable expected", name);
+ return nullptr;
+ }
+
+ const TVariable *variable = static_cast<const TVariable *>(symbol);
+
+ if (variable->extension() != TExtension::UNDEFINED)
+ {
+ checkCanUseExtension(location, variable->extension());
+ }
+
+ // GLSL ES 3.1 Revision 4, 7.1.3 Compute Shader Special Variables
+ if (getShaderType() == GL_COMPUTE_SHADER && !mComputeShaderLocalSizeDeclared &&
+ variable->getType().getQualifier() == EvqWorkGroupSize)
+ {
+ error(location,
+ "It is an error to use gl_WorkGroupSize before declaring the local group size",
+ "gl_WorkGroupSize");
+ }
+ return variable;
+}
+
+TIntermTyped *TParseContext::parseVariableIdentifier(const TSourceLoc &location,
+ const ImmutableString &name,
+ const TSymbol *symbol)
+{
+ const TVariable *variable = getNamedVariable(location, name, symbol);
+
+ if (!variable)
+ {
+ TIntermTyped *node = CreateZeroNode(TType(EbtFloat, EbpHigh, EvqConst));
+ node->setLine(location);
+ return node;
+ }
+
+ const TType &variableType = variable->getType();
+ TIntermTyped *node = nullptr;
+
+ if (variable->getConstPointer() && variableType.canReplaceWithConstantUnion())
+ {
+ const TConstantUnion *constArray = variable->getConstPointer();
+ node = new TIntermConstantUnion(constArray, variableType);
+ }
+ else if (variableType.getQualifier() == EvqWorkGroupSize && mComputeShaderLocalSizeDeclared)
+ {
+ // gl_WorkGroupSize can be used to size arrays according to the ESSL 3.10.4 spec, so it
+ // needs to be added to the AST as a constant and not as a symbol.
+ sh::WorkGroupSize workGroupSize = getComputeShaderLocalSize();
+ TConstantUnion *constArray = new TConstantUnion[3];
+ for (size_t i = 0; i < 3; ++i)
+ {
+ constArray[i].setUConst(static_cast<unsigned int>(workGroupSize[i]));
+ }
+
+ ASSERT(variableType.getBasicType() == EbtUInt);
+ ASSERT(variableType.getObjectSize() == 3);
+
+ TType type(variableType);
+ type.setQualifier(EvqConst);
+ node = new TIntermConstantUnion(constArray, type);
+ }
+ else if ((mGeometryShaderInputPrimitiveType != EptUndefined) &&
+ (variableType.getQualifier() == EvqPerVertexIn))
+ {
+ ASSERT(symbolTable.getGlInVariableWithArraySize() != nullptr);
+ node = new TIntermSymbol(symbolTable.getGlInVariableWithArraySize());
+ }
+ else
+ {
+ node = new TIntermSymbol(variable);
+ }
+ ASSERT(node != nullptr);
+ node->setLine(location);
+ return node;
+}
+
+// Initializers show up in several places in the grammar. Have one set of
+// code to handle them here.
+//
+// Returns true on success.
+bool TParseContext::executeInitializer(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ TType *type,
+ TIntermTyped *initializer,
+ TIntermBinary **initNode)
+{
+ ASSERT(initNode != nullptr);
+ ASSERT(*initNode == nullptr);
+
+ if (type->isUnsizedArray())
+ {
+ // In case initializer is not an array or type has more dimensions than initializer, this
+ // will default to setting array sizes to 1. We have not checked yet whether the initializer
+ // actually is an array or not. Having a non-array initializer for an unsized array will
+ // result in an error later, so we don't generate an error message here.
+ auto *arraySizes = initializer->getType().getArraySizes();
+ type->sizeUnsizedArrays(arraySizes);
+ }
+
+ const TQualifier qualifier = type->getQualifier();
+
+ bool constError = false;
+ if (qualifier == EvqConst)
+ {
+ if (EvqConst != initializer->getType().getQualifier())
+ {
+ TInfoSinkBase reasonStream;
+ reasonStream << "assigning non-constant to '" << *type << "'";
+ error(line, reasonStream.c_str(), "=");
+
+ // We're still going to declare the variable to avoid extra error messages.
+ type->setQualifier(EvqTemporary);
+ constError = true;
+ }
+ }
+
+ TVariable *variable = nullptr;
+ if (!declareVariable(line, identifier, type, &variable))
+ {
+ return false;
+ }
+
+ if (constError)
+ {
+ return false;
+ }
+
+ bool globalInitWarning = false;
+ if (symbolTable.atGlobalLevel() &&
+ !ValidateGlobalInitializer(initializer, mShaderVersion, &globalInitWarning))
+ {
+ // Error message does not completely match behavior with ESSL 1.00, but
+ // we want to steer developers towards only using constant expressions.
+ error(line, "global variable initializers must be constant expressions", "=");
+ return false;
+ }
+ if (globalInitWarning)
+ {
+ warning(
+ line,
+ "global variable initializers should be constant expressions "
+ "(uniforms and globals are allowed in global initializers for legacy compatibility)",
+ "=");
+ }
+
+ // identifier must be of type constant, a global, or a temporary
+ if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal) && (qualifier != EvqConst))
+ {
+ error(line, " cannot initialize this type of qualifier ",
+ variable->getType().getQualifierString());
+ return false;
+ }
+
+ TIntermSymbol *intermSymbol = new TIntermSymbol(variable);
+ intermSymbol->setLine(line);
+
+ if (!binaryOpCommonCheck(EOpInitialize, intermSymbol, initializer, line))
+ {
+ assignError(line, "=", variable->getType(), initializer->getType());
+ return false;
+ }
+
+ if (qualifier == EvqConst)
+ {
+ // Save the constant folded value to the variable if possible.
+ const TConstantUnion *constArray = initializer->getConstantValue();
+ if (constArray)
+ {
+ variable->shareConstPointer(constArray);
+ if (initializer->getType().canReplaceWithConstantUnion())
+ {
+ ASSERT(*initNode == nullptr);
+ return true;
+ }
+ }
+ }
+
+ *initNode = new TIntermBinary(EOpInitialize, intermSymbol, initializer);
+ markStaticReadIfSymbol(initializer);
+ (*initNode)->setLine(line);
+ return true;
+}
+
+TIntermNode *TParseContext::addConditionInitializer(const TPublicType &pType,
+ const ImmutableString &identifier,
+ TIntermTyped *initializer,
+ const TSourceLoc &loc)
+{
+ checkIsScalarBool(loc, pType);
+ TIntermBinary *initNode = nullptr;
+ TType *type = new TType(pType);
+ if (executeInitializer(loc, identifier, type, initializer, &initNode))
+ {
+ // The initializer is valid. The init condition needs to have a node - either the
+ // initializer node, or a constant node in case the initialized variable is const and won't
+ // be recorded in the AST.
+ if (initNode == nullptr)
+ {
+ return initializer;
+ }
+ else
+ {
+ TIntermDeclaration *declaration = new TIntermDeclaration();
+ declaration->appendDeclarator(initNode);
+ return declaration;
+ }
+ }
+ return nullptr;
+}
+
+TIntermNode *TParseContext::addLoop(TLoopType type,
+ TIntermNode *init,
+ TIntermNode *cond,
+ TIntermTyped *expr,
+ TIntermNode *body,
+ const TSourceLoc &line)
+{
+ TIntermNode *node = nullptr;
+ TIntermTyped *typedCond = nullptr;
+ if (cond)
+ {
+ markStaticReadIfSymbol(cond);
+ typedCond = cond->getAsTyped();
+ }
+ if (expr)
+ {
+ markStaticReadIfSymbol(expr);
+ }
+ // In case the loop body was not parsed as a block and contains a statement that simply refers
+ // to a variable, we need to mark it as statically used.
+ if (body)
+ {
+ markStaticReadIfSymbol(body);
+ }
+ if (cond == nullptr || typedCond)
+ {
+ if (type == ELoopDoWhile)
+ {
+ checkIsScalarBool(line, typedCond);
+ }
+ // In the case of other loops, it was checked before that the condition is a scalar boolean.
+ ASSERT(mDiagnostics->numErrors() > 0 || typedCond == nullptr ||
+ (typedCond->getBasicType() == EbtBool && !typedCond->isArray() &&
+ !typedCond->isVector()));
+
+ node = new TIntermLoop(type, init, typedCond, expr, EnsureBlock(body));
+ node->setLine(line);
+ return node;
+ }
+
+ ASSERT(type != ELoopDoWhile);
+
+ TIntermDeclaration *declaration = cond->getAsDeclarationNode();
+ ASSERT(declaration);
+ TIntermBinary *declarator = declaration->getSequence()->front()->getAsBinaryNode();
+ ASSERT(declarator->getLeft()->getAsSymbolNode());
+
+ // The condition is a declaration. In the AST representation we don't support declarations as
+ // loop conditions. Wrap the loop to a block that declares the condition variable and contains
+ // the loop.
+ TIntermBlock *block = new TIntermBlock();
+
+ TIntermDeclaration *declareCondition = new TIntermDeclaration();
+ declareCondition->appendDeclarator(declarator->getLeft()->deepCopy());
+ block->appendStatement(declareCondition);
+
+ TIntermBinary *conditionInit = new TIntermBinary(EOpAssign, declarator->getLeft()->deepCopy(),
+ declarator->getRight()->deepCopy());
+ TIntermLoop *loop = new TIntermLoop(type, init, conditionInit, expr, EnsureBlock(body));
+ block->appendStatement(loop);
+ loop->setLine(line);
+ block->setLine(line);
+ return block;
+}
+
+TIntermNode *TParseContext::addIfElse(TIntermTyped *cond,
+ TIntermNodePair code,
+ const TSourceLoc &loc)
+{
+ bool isScalarBool = checkIsScalarBool(loc, cond);
+ // In case the conditional statements were not parsed as blocks and contain a statement that
+ // simply refers to a variable, we need to mark them as statically used.
+ if (code.node1)
+ {
+ markStaticReadIfSymbol(code.node1);
+ }
+ if (code.node2)
+ {
+ markStaticReadIfSymbol(code.node2);
+ }
+
+ // For compile time constant conditions, prune the code now.
+ if (isScalarBool && cond->getAsConstantUnion())
+ {
+ if (cond->getAsConstantUnion()->getBConst(0) == true)
+ {
+ return EnsureBlock(code.node1);
+ }
+ else
+ {
+ return EnsureBlock(code.node2);
+ }
+ }
+
+ TIntermIfElse *node = new TIntermIfElse(cond, EnsureBlock(code.node1), EnsureBlock(code.node2));
+ markStaticReadIfSymbol(cond);
+ node->setLine(loc);
+
+ return node;
+}
+
+void TParseContext::addFullySpecifiedType(TPublicType *typeSpecifier)
+{
+ checkPrecisionSpecified(typeSpecifier->getLine(), typeSpecifier->precision,
+ typeSpecifier->getBasicType());
+
+ if (mShaderVersion < 300 && typeSpecifier->isArray())
+ {
+ error(typeSpecifier->getLine(), "not supported", "first-class array");
+ typeSpecifier->clearArrayness();
+ }
+}
+
+TPublicType TParseContext::addFullySpecifiedType(const TTypeQualifierBuilder &typeQualifierBuilder,
+ const TPublicType &typeSpecifier)
+{
+ TTypeQualifier typeQualifier = typeQualifierBuilder.getVariableTypeQualifier(mDiagnostics);
+
+ TPublicType returnType = typeSpecifier;
+ returnType.qualifier = typeQualifier.qualifier;
+ returnType.invariant = typeQualifier.invariant;
+ returnType.layoutQualifier = typeQualifier.layoutQualifier;
+ returnType.memoryQualifier = typeQualifier.memoryQualifier;
+ returnType.precision = typeSpecifier.precision;
+
+ if (typeQualifier.precision != EbpUndefined)
+ {
+ returnType.precision = typeQualifier.precision;
+ }
+
+ checkPrecisionSpecified(typeSpecifier.getLine(), returnType.precision,
+ typeSpecifier.getBasicType());
+
+ checkInvariantVariableQualifier(returnType.invariant, returnType.qualifier,
+ typeSpecifier.getLine());
+
+ checkWorkGroupSizeIsNotSpecified(typeSpecifier.getLine(), returnType.layoutQualifier);
+
+ if (mShaderVersion < 300)
+ {
+ if (typeSpecifier.isArray())
+ {
+ error(typeSpecifier.getLine(), "not supported", "first-class array");
+ returnType.clearArrayness();
+ }
+
+ if (returnType.qualifier == EvqAttribute &&
+ (typeSpecifier.getBasicType() == EbtBool || typeSpecifier.getBasicType() == EbtInt))
+ {
+ error(typeSpecifier.getLine(), "cannot be bool or int",
+ getQualifierString(returnType.qualifier));
+ }
+
+ if ((returnType.qualifier == EvqVaryingIn || returnType.qualifier == EvqVaryingOut) &&
+ (typeSpecifier.getBasicType() == EbtBool || typeSpecifier.getBasicType() == EbtInt))
+ {
+ error(typeSpecifier.getLine(), "cannot be bool or int",
+ getQualifierString(returnType.qualifier));
+ }
+ }
+ else
+ {
+ if (!returnType.layoutQualifier.isEmpty())
+ {
+ checkIsAtGlobalLevel(typeSpecifier.getLine(), "layout");
+ }
+ if (sh::IsVarying(returnType.qualifier) || returnType.qualifier == EvqVertexIn ||
+ returnType.qualifier == EvqFragmentOut)
+ {
+ checkInputOutputTypeIsValidES3(returnType.qualifier, typeSpecifier,
+ typeSpecifier.getLine());
+ }
+ if (returnType.qualifier == EvqComputeIn)
+ {
+ error(typeSpecifier.getLine(), "'in' can be only used to specify the local group size",
+ "in");
+ }
+ }
+
+ return returnType;
+}
+
+void TParseContext::checkInputOutputTypeIsValidES3(const TQualifier qualifier,
+ const TPublicType &type,
+ const TSourceLoc &qualifierLocation)
+{
+ // An input/output variable can never be bool or a sampler. Samplers are checked elsewhere.
+ if (type.getBasicType() == EbtBool)
+ {
+ error(qualifierLocation, "cannot be bool", getQualifierString(qualifier));
+ }
+
+ // Specific restrictions apply for vertex shader inputs and fragment shader outputs.
+ switch (qualifier)
+ {
+ case EvqVertexIn:
+ // ESSL 3.00 section 4.3.4
+ if (type.isArray())
+ {
+ error(qualifierLocation, "cannot be array", getQualifierString(qualifier));
+ }
+ // Vertex inputs with a struct type are disallowed in nonEmptyDeclarationErrorCheck
+ return;
+ case EvqFragmentOut:
+ // ESSL 3.00 section 4.3.6
+ if (type.typeSpecifierNonArray.isMatrix())
+ {
+ error(qualifierLocation, "cannot be matrix", getQualifierString(qualifier));
+ }
+ // Fragment outputs with a struct type are disallowed in nonEmptyDeclarationErrorCheck
+ return;
+ default:
+ break;
+ }
+
+ // Vertex shader outputs / fragment shader inputs have a different, slightly more lenient set of
+ // restrictions.
+ bool typeContainsIntegers =
+ (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt ||
+ type.isStructureContainingType(EbtInt) || type.isStructureContainingType(EbtUInt));
+ if (typeContainsIntegers && qualifier != EvqFlatIn && qualifier != EvqFlatOut)
+ {
+ error(qualifierLocation, "must use 'flat' interpolation here",
+ getQualifierString(qualifier));
+ }
+
+ if (type.getBasicType() == EbtStruct)
+ {
+ // ESSL 3.00 sections 4.3.4 and 4.3.6.
+ // These restrictions are only implied by the ESSL 3.00 spec, but
+ // the ESSL 3.10 spec lists these restrictions explicitly.
+ if (type.isArray())
+ {
+ error(qualifierLocation, "cannot be an array of structures",
+ getQualifierString(qualifier));
+ }
+ if (type.isStructureContainingArrays())
+ {
+ error(qualifierLocation, "cannot be a structure containing an array",
+ getQualifierString(qualifier));
+ }
+ if (type.isStructureContainingType(EbtStruct))
+ {
+ error(qualifierLocation, "cannot be a structure containing a structure",
+ getQualifierString(qualifier));
+ }
+ if (type.isStructureContainingType(EbtBool))
+ {
+ error(qualifierLocation, "cannot be a structure containing a bool",
+ getQualifierString(qualifier));
+ }
+ }
+}
+
+void TParseContext::checkLocalVariableConstStorageQualifier(const TQualifierWrapperBase &qualifier)
+{
+ if (qualifier.getType() == QtStorage)
+ {
+ const TStorageQualifierWrapper &storageQualifier =
+ static_cast<const TStorageQualifierWrapper &>(qualifier);
+ if (!declaringFunction() && storageQualifier.getQualifier() != EvqConst &&
+ !symbolTable.atGlobalLevel())
+ {
+ error(storageQualifier.getLine(),
+ "Local variables can only use the const storage qualifier.",
+ storageQualifier.getQualifierString());
+ }
+ }
+}
+
+void TParseContext::checkMemoryQualifierIsNotSpecified(const TMemoryQualifier &memoryQualifier,
+ const TSourceLoc &location)
+{
+ const std::string reason(
+ "Only allowed with shader storage blocks, variables declared within shader storage blocks "
+ "and variables declared as image types.");
+ if (memoryQualifier.readonly)
+ {
+ error(location, reason.c_str(), "readonly");
+ }
+ if (memoryQualifier.writeonly)
+ {
+ error(location, reason.c_str(), "writeonly");
+ }
+ if (memoryQualifier.coherent)
+ {
+ error(location, reason.c_str(), "coherent");
+ }
+ if (memoryQualifier.restrictQualifier)
+ {
+ error(location, reason.c_str(), "restrict");
+ }
+ if (memoryQualifier.volatileQualifier)
+ {
+ error(location, reason.c_str(), "volatile");
+ }
+}
+
+// Make sure there is no offset overlapping, and store the newly assigned offset to "type" in
+// intermediate tree.
+void TParseContext::checkAtomicCounterOffsetDoesNotOverlap(bool forceAppend,
+ const TSourceLoc &loc,
+ TType *type)
+{
+ const size_t size = type->isArray() ? kAtomicCounterArrayStride * type->getArraySizeProduct()
+ : kAtomicCounterSize;
+ TLayoutQualifier layoutQualifier = type->getLayoutQualifier();
+ auto &bindingState = mAtomicCounterBindingStates[layoutQualifier.binding];
+ int offset;
+ if (layoutQualifier.offset == -1 || forceAppend)
+ {
+ offset = bindingState.appendSpan(size);
+ }
+ else
+ {
+ offset = bindingState.insertSpan(layoutQualifier.offset, size);
+ }
+ if (offset == -1)
+ {
+ error(loc, "Offset overlapping", "atomic counter");
+ return;
+ }
+ layoutQualifier.offset = offset;
+ type->setLayoutQualifier(layoutQualifier);
+}
+
+void TParseContext::checkAtomicCounterOffsetAlignment(const TSourceLoc &location, const TType &type)
+{
+ TLayoutQualifier layoutQualifier = type.getLayoutQualifier();
+
+ // OpenGL ES 3.1 Table 6.5, Atomic counter offset must be a multiple of 4
+ if (layoutQualifier.offset % 4 != 0)
+ {
+ error(location, "Offset must be multiple of 4", "atomic counter");
+ }
+}
+
+void TParseContext::checkGeometryShaderInputAndSetArraySize(const TSourceLoc &location,
+ const ImmutableString &token,
+ TType *type)
+{
+ if (IsGeometryShaderInput(mShaderType, type->getQualifier()))
+ {
+ if (type->isArray() && type->getOutermostArraySize() == 0u)
+ {
+ // Set size for the unsized geometry shader inputs if they are declared after a valid
+ // input primitive declaration.
+ if (mGeometryShaderInputPrimitiveType != EptUndefined)
+ {
+ ASSERT(symbolTable.getGlInVariableWithArraySize() != nullptr);
+ type->sizeOutermostUnsizedArray(
+ symbolTable.getGlInVariableWithArraySize()->getType().getOutermostArraySize());
+ }
+ else
+ {
+ // [GLSL ES 3.2 SPEC Chapter 4.4.1.2]
+ // An input can be declared without an array size if there is a previous layout
+ // which specifies the size.
+ error(location,
+ "Missing a valid input primitive declaration before declaring an unsized "
+ "array input",
+ token);
+ }
+ }
+ else if (type->isArray())
+ {
+ setGeometryShaderInputArraySize(type->getOutermostArraySize(), location);
+ }
+ else
+ {
+ error(location, "Geometry shader input variable must be declared as an array", token);
+ }
+ }
+}
+
+TIntermDeclaration *TParseContext::parseSingleDeclaration(
+ TPublicType &publicType,
+ const TSourceLoc &identifierOrTypeLocation,
+ const ImmutableString &identifier)
+{
+ TType *type = new TType(publicType);
+ if ((mCompileOptions & SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL) &&
+ mDirectiveHandler.pragma().stdgl.invariantAll)
+ {
+ TQualifier qualifier = type->getQualifier();
+
+ // The directive handler has already taken care of rejecting invalid uses of this pragma
+ // (for example, in ESSL 3.00 fragment shaders), so at this point, flatten it into all
+ // affected variable declarations:
+ //
+ // 1. Built-in special variables which are inputs to the fragment shader. (These are handled
+ // elsewhere, in TranslatorGLSL.)
+ //
+ // 2. Outputs from vertex shaders in ESSL 1.00 and 3.00 (EvqVaryingOut and EvqVertexOut). It
+ // is actually less likely that there will be bugs in the handling of ESSL 3.00 shaders, but
+ // the way this is currently implemented we have to enable this compiler option before
+ // parsing the shader and determining the shading language version it uses. If this were
+ // implemented as a post-pass, the workaround could be more targeted.
+ if (qualifier == EvqVaryingOut || qualifier == EvqVertexOut)
+ {
+ type->setInvariant(true);
+ }
+ }
+
+ checkGeometryShaderInputAndSetArraySize(identifierOrTypeLocation, identifier, type);
+
+ declarationQualifierErrorCheck(publicType.qualifier, publicType.layoutQualifier,
+ identifierOrTypeLocation);
+
+ bool emptyDeclaration = (identifier == "");
+ mDeferredNonEmptyDeclarationErrorCheck = emptyDeclaration;
+
+ TIntermSymbol *symbol = nullptr;
+ if (emptyDeclaration)
+ {
+ emptyDeclarationErrorCheck(*type, identifierOrTypeLocation);
+ // In most cases we don't need to create a symbol node for an empty declaration.
+ // But if the empty declaration is declaring a struct type, the symbol node will store that.
+ if (type->getBasicType() == EbtStruct)
+ {
+ TVariable *emptyVariable =
+ new TVariable(&symbolTable, kEmptyImmutableString, type, SymbolType::Empty);
+ symbol = new TIntermSymbol(emptyVariable);
+ }
+ else if (IsAtomicCounter(publicType.getBasicType()))
+ {
+ setAtomicCounterBindingDefaultOffset(publicType, identifierOrTypeLocation);
+ }
+ }
+ else
+ {
+ nonEmptyDeclarationErrorCheck(publicType, identifierOrTypeLocation);
+
+ checkCanBeDeclaredWithoutInitializer(identifierOrTypeLocation, identifier, type);
+
+ if (IsAtomicCounter(type->getBasicType()))
+ {
+ checkAtomicCounterOffsetDoesNotOverlap(false, identifierOrTypeLocation, type);
+
+ checkAtomicCounterOffsetAlignment(identifierOrTypeLocation, *type);
+ }
+
+ TVariable *variable = nullptr;
+ if (declareVariable(identifierOrTypeLocation, identifier, type, &variable))
+ {
+ symbol = new TIntermSymbol(variable);
+ }
+ }
+
+ TIntermDeclaration *declaration = new TIntermDeclaration();
+ declaration->setLine(identifierOrTypeLocation);
+ if (symbol)
+ {
+ symbol->setLine(identifierOrTypeLocation);
+ declaration->appendDeclarator(symbol);
+ }
+ return declaration;
+}
+
+TIntermDeclaration *TParseContext::parseSingleArrayDeclaration(
+ TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &indexLocation,
+ const TVector<unsigned int> &arraySizes)
+{
+ mDeferredNonEmptyDeclarationErrorCheck = false;
+
+ declarationQualifierErrorCheck(elementType.qualifier, elementType.layoutQualifier,
+ identifierLocation);
+
+ nonEmptyDeclarationErrorCheck(elementType, identifierLocation);
+
+ checkIsValidTypeAndQualifierForArray(indexLocation, elementType);
+
+ TType *arrayType = new TType(elementType);
+ arrayType->makeArrays(arraySizes);
+
+ checkGeometryShaderInputAndSetArraySize(indexLocation, identifier, arrayType);
+
+ checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, arrayType);
+
+ if (IsAtomicCounter(arrayType->getBasicType()))
+ {
+ checkAtomicCounterOffsetDoesNotOverlap(false, identifierLocation, arrayType);
+
+ checkAtomicCounterOffsetAlignment(identifierLocation, *arrayType);
+ }
+
+ TIntermDeclaration *declaration = new TIntermDeclaration();
+ declaration->setLine(identifierLocation);
+
+ TVariable *variable = nullptr;
+ if (declareVariable(identifierLocation, identifier, arrayType, &variable))
+ {
+ TIntermSymbol *symbol = new TIntermSymbol(variable);
+ symbol->setLine(identifierLocation);
+ declaration->appendDeclarator(symbol);
+ }
+
+ return declaration;
+}
+
+TIntermDeclaration *TParseContext::parseSingleInitDeclaration(const TPublicType &publicType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer)
+{
+ mDeferredNonEmptyDeclarationErrorCheck = false;
+
+ declarationQualifierErrorCheck(publicType.qualifier, publicType.layoutQualifier,
+ identifierLocation);
+
+ nonEmptyDeclarationErrorCheck(publicType, identifierLocation);
+
+ TIntermDeclaration *declaration = new TIntermDeclaration();
+ declaration->setLine(identifierLocation);
+
+ TIntermBinary *initNode = nullptr;
+ TType *type = new TType(publicType);
+ if (executeInitializer(identifierLocation, identifier, type, initializer, &initNode))
+ {
+ if (initNode)
+ {
+ declaration->appendDeclarator(initNode);
+ }
+ }
+ return declaration;
+}
+
+TIntermDeclaration *TParseContext::parseSingleArrayInitDeclaration(
+ TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &indexLocation,
+ const TVector<unsigned int> &arraySizes,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer)
+{
+ mDeferredNonEmptyDeclarationErrorCheck = false;
+
+ declarationQualifierErrorCheck(elementType.qualifier, elementType.layoutQualifier,
+ identifierLocation);
+
+ nonEmptyDeclarationErrorCheck(elementType, identifierLocation);
+
+ checkIsValidTypeAndQualifierForArray(indexLocation, elementType);
+
+ TType *arrayType = new TType(elementType);
+ arrayType->makeArrays(arraySizes);
+
+ TIntermDeclaration *declaration = new TIntermDeclaration();
+ declaration->setLine(identifierLocation);
+
+ // initNode will correspond to the whole of "type b[n] = initializer".
+ TIntermBinary *initNode = nullptr;
+ if (executeInitializer(identifierLocation, identifier, arrayType, initializer, &initNode))
+ {
+ if (initNode)
+ {
+ declaration->appendDeclarator(initNode);
+ }
+ }
+
+ return declaration;
+}
+
+TIntermInvariantDeclaration *TParseContext::parseInvariantDeclaration(
+ const TTypeQualifierBuilder &typeQualifierBuilder,
+ const TSourceLoc &identifierLoc,
+ const ImmutableString &identifier,
+ const TSymbol *symbol)
+{
+ TTypeQualifier typeQualifier = typeQualifierBuilder.getVariableTypeQualifier(mDiagnostics);
+
+ if (!typeQualifier.invariant)
+ {
+ error(identifierLoc, "Expected invariant", identifier);
+ return nullptr;
+ }
+ if (!checkIsAtGlobalLevel(identifierLoc, "invariant varying"))
+ {
+ return nullptr;
+ }
+ if (!symbol)
+ {
+ error(identifierLoc, "undeclared identifier declared as invariant", identifier);
+ return nullptr;
+ }
+ if (!IsQualifierUnspecified(typeQualifier.qualifier))
+ {
+ error(identifierLoc, "invariant declaration specifies qualifier",
+ getQualifierString(typeQualifier.qualifier));
+ }
+ if (typeQualifier.precision != EbpUndefined)
+ {
+ error(identifierLoc, "invariant declaration specifies precision",
+ getPrecisionString(typeQualifier.precision));
+ }
+ if (!typeQualifier.layoutQualifier.isEmpty())
+ {
+ error(identifierLoc, "invariant declaration specifies layout", "'layout'");
+ }
+
+ const TVariable *variable = getNamedVariable(identifierLoc, identifier, symbol);
+ if (!variable)
+ {
+ return nullptr;
+ }
+ const TType &type = variable->getType();
+
+ checkInvariantVariableQualifier(typeQualifier.invariant, type.getQualifier(),
+ typeQualifier.line);
+ checkMemoryQualifierIsNotSpecified(typeQualifier.memoryQualifier, typeQualifier.line);
+
+ symbolTable.addInvariantVarying(*variable);
+
+ TIntermSymbol *intermSymbol = new TIntermSymbol(variable);
+ intermSymbol->setLine(identifierLoc);
+
+ return new TIntermInvariantDeclaration(intermSymbol, identifierLoc);
+}
+
+void TParseContext::parseDeclarator(TPublicType &publicType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ TIntermDeclaration *declarationOut)
+{
+ // If the declaration starting this declarator list was empty (example: int,), some checks were
+ // not performed.
+ if (mDeferredNonEmptyDeclarationErrorCheck)
+ {
+ nonEmptyDeclarationErrorCheck(publicType, identifierLocation);
+ mDeferredNonEmptyDeclarationErrorCheck = false;
+ }
+
+ checkDeclaratorLocationIsNotSpecified(identifierLocation, publicType);
+
+ TType *type = new TType(publicType);
+
+ checkGeometryShaderInputAndSetArraySize(identifierLocation, identifier, type);
+
+ checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, type);
+
+ if (IsAtomicCounter(type->getBasicType()))
+ {
+ checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, type);
+
+ checkAtomicCounterOffsetAlignment(identifierLocation, *type);
+ }
+
+ TVariable *variable = nullptr;
+ if (declareVariable(identifierLocation, identifier, type, &variable))
+ {
+ TIntermSymbol *symbol = new TIntermSymbol(variable);
+ symbol->setLine(identifierLocation);
+ declarationOut->appendDeclarator(symbol);
+ }
+}
+
+void TParseContext::parseArrayDeclarator(TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &arrayLocation,
+ const TVector<unsigned int> &arraySizes,
+ TIntermDeclaration *declarationOut)
+{
+ // If the declaration starting this declarator list was empty (example: int,), some checks were
+ // not performed.
+ if (mDeferredNonEmptyDeclarationErrorCheck)
+ {
+ nonEmptyDeclarationErrorCheck(elementType, identifierLocation);
+ mDeferredNonEmptyDeclarationErrorCheck = false;
+ }
+
+ checkDeclaratorLocationIsNotSpecified(identifierLocation, elementType);
+
+ if (checkIsValidTypeAndQualifierForArray(arrayLocation, elementType))
+ {
+ TType *arrayType = new TType(elementType);
+ arrayType->makeArrays(arraySizes);
+
+ checkGeometryShaderInputAndSetArraySize(identifierLocation, identifier, arrayType);
+
+ checkCanBeDeclaredWithoutInitializer(identifierLocation, identifier, arrayType);
+
+ if (IsAtomicCounter(arrayType->getBasicType()))
+ {
+ checkAtomicCounterOffsetDoesNotOverlap(true, identifierLocation, arrayType);
+
+ checkAtomicCounterOffsetAlignment(identifierLocation, *arrayType);
+ }
+
+ TVariable *variable = nullptr;
+ if (declareVariable(identifierLocation, identifier, arrayType, &variable))
+ {
+ TIntermSymbol *symbol = new TIntermSymbol(variable);
+ symbol->setLine(identifierLocation);
+ declarationOut->appendDeclarator(symbol);
+ }
+ }
+}
+
+void TParseContext::parseInitDeclarator(const TPublicType &publicType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer,
+ TIntermDeclaration *declarationOut)
+{
+ // If the declaration starting this declarator list was empty (example: int,), some checks were
+ // not performed.
+ if (mDeferredNonEmptyDeclarationErrorCheck)
+ {
+ nonEmptyDeclarationErrorCheck(publicType, identifierLocation);
+ mDeferredNonEmptyDeclarationErrorCheck = false;
+ }
+
+ checkDeclaratorLocationIsNotSpecified(identifierLocation, publicType);
+
+ TIntermBinary *initNode = nullptr;
+ TType *type = new TType(publicType);
+ if (executeInitializer(identifierLocation, identifier, type, initializer, &initNode))
+ {
+ //
+ // build the intermediate representation
+ //
+ if (initNode)
+ {
+ declarationOut->appendDeclarator(initNode);
+ }
+ }
+}
+
+void TParseContext::parseArrayInitDeclarator(const TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &indexLocation,
+ const TVector<unsigned int> &arraySizes,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer,
+ TIntermDeclaration *declarationOut)
+{
+ // If the declaration starting this declarator list was empty (example: int,), some checks were
+ // not performed.
+ if (mDeferredNonEmptyDeclarationErrorCheck)
+ {
+ nonEmptyDeclarationErrorCheck(elementType, identifierLocation);
+ mDeferredNonEmptyDeclarationErrorCheck = false;
+ }
+
+ checkDeclaratorLocationIsNotSpecified(identifierLocation, elementType);
+
+ checkIsValidTypeAndQualifierForArray(indexLocation, elementType);
+
+ TType *arrayType = new TType(elementType);
+ arrayType->makeArrays(arraySizes);
+
+ // initNode will correspond to the whole of "b[n] = initializer".
+ TIntermBinary *initNode = nullptr;
+ if (executeInitializer(identifierLocation, identifier, arrayType, initializer, &initNode))
+ {
+ if (initNode)
+ {
+ declarationOut->appendDeclarator(initNode);
+ }
+ }
+}
+
+TIntermNode *TParseContext::addEmptyStatement(const TSourceLoc &location)
+{
+ // It's simpler to parse an empty statement as a constant expression rather than having a
+ // different type of node just for empty statements, that will be pruned from the AST anyway.
+ TIntermNode *node = CreateZeroNode(TType(EbtInt, EbpMedium));
+ node->setLine(location);
+ return node;
+}
+
+void TParseContext::setAtomicCounterBindingDefaultOffset(const TPublicType &publicType,
+ const TSourceLoc &location)
+{
+ const TLayoutQualifier &layoutQualifier = publicType.layoutQualifier;
+ checkAtomicCounterBindingIsValid(location, layoutQualifier.binding);
+ if (layoutQualifier.binding == -1 || layoutQualifier.offset == -1)
+ {
+ error(location, "Requires both binding and offset", "layout");
+ return;
+ }
+ mAtomicCounterBindingStates[layoutQualifier.binding].setDefaultOffset(layoutQualifier.offset);
+}
+
+void TParseContext::parseDefaultPrecisionQualifier(const TPrecision precision,
+ const TPublicType &type,
+ const TSourceLoc &loc)
+{
+ if ((precision == EbpHigh) && (getShaderType() == GL_FRAGMENT_SHADER) &&
+ !getFragmentPrecisionHigh())
+ {
+ error(loc, "precision is not supported in fragment shader", "highp");
+ }
+
+ if (!CanSetDefaultPrecisionOnType(type))
+ {
+ error(loc, "illegal type argument for default precision qualifier",
+ getBasicString(type.getBasicType()));
+ return;
+ }
+ symbolTable.setDefaultPrecision(type.getBasicType(), precision);
+}
+
+bool TParseContext::checkPrimitiveTypeMatchesTypeQualifier(const TTypeQualifier &typeQualifier)
+{
+ switch (typeQualifier.layoutQualifier.primitiveType)
+ {
+ case EptLines:
+ case EptLinesAdjacency:
+ case EptTriangles:
+ case EptTrianglesAdjacency:
+ return typeQualifier.qualifier == EvqGeometryIn;
+
+ case EptLineStrip:
+ case EptTriangleStrip:
+ return typeQualifier.qualifier == EvqGeometryOut;
+
+ case EptPoints:
+ return true;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+void TParseContext::setGeometryShaderInputArraySize(unsigned int inputArraySize,
+ const TSourceLoc &line)
+{
+ if (!symbolTable.setGlInArraySize(inputArraySize))
+ {
+ error(line,
+ "Array size or input primitive declaration doesn't match the size of earlier sized "
+ "array inputs.",
+ "layout");
+ }
+}
+
+bool TParseContext::parseGeometryShaderInputLayoutQualifier(const TTypeQualifier &typeQualifier)
+{
+ ASSERT(typeQualifier.qualifier == EvqGeometryIn);
+
+ const TLayoutQualifier &layoutQualifier = typeQualifier.layoutQualifier;
+
+ if (layoutQualifier.maxVertices != -1)
+ {
+ error(typeQualifier.line,
+ "max_vertices can only be declared in 'out' layout in a geometry shader", "layout");
+ return false;
+ }
+
+ // Set mGeometryInputPrimitiveType if exists
+ if (layoutQualifier.primitiveType != EptUndefined)
+ {
+ if (!checkPrimitiveTypeMatchesTypeQualifier(typeQualifier))
+ {
+ error(typeQualifier.line, "invalid primitive type for 'in' layout", "layout");
+ return false;
+ }
+
+ if (mGeometryShaderInputPrimitiveType == EptUndefined)
+ {
+ mGeometryShaderInputPrimitiveType = layoutQualifier.primitiveType;
+ setGeometryShaderInputArraySize(
+ GetGeometryShaderInputArraySize(mGeometryShaderInputPrimitiveType),
+ typeQualifier.line);
+ }
+ else if (mGeometryShaderInputPrimitiveType != layoutQualifier.primitiveType)
+ {
+ error(typeQualifier.line, "primitive doesn't match earlier input primitive declaration",
+ "layout");
+ return false;
+ }
+ }
+
+ // Set mGeometryInvocations if exists
+ if (layoutQualifier.invocations > 0)
+ {
+ if (mGeometryShaderInvocations == 0)
+ {
+ mGeometryShaderInvocations = layoutQualifier.invocations;
+ }
+ else if (mGeometryShaderInvocations != layoutQualifier.invocations)
+ {
+ error(typeQualifier.line, "invocations contradicts to the earlier declaration",
+ "layout");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TParseContext::parseGeometryShaderOutputLayoutQualifier(const TTypeQualifier &typeQualifier)
+{
+ ASSERT(typeQualifier.qualifier == EvqGeometryOut);
+
+ const TLayoutQualifier &layoutQualifier = typeQualifier.layoutQualifier;
+
+ if (layoutQualifier.invocations > 0)
+ {
+ error(typeQualifier.line,
+ "invocations can only be declared in 'in' layout in a geometry shader", "layout");
+ return false;
+ }
+
+ // Set mGeometryOutputPrimitiveType if exists
+ if (layoutQualifier.primitiveType != EptUndefined)
+ {
+ if (!checkPrimitiveTypeMatchesTypeQualifier(typeQualifier))
+ {
+ error(typeQualifier.line, "invalid primitive type for 'out' layout", "layout");
+ return false;
+ }
+
+ if (mGeometryShaderOutputPrimitiveType == EptUndefined)
+ {
+ mGeometryShaderOutputPrimitiveType = layoutQualifier.primitiveType;
+ }
+ else if (mGeometryShaderOutputPrimitiveType != layoutQualifier.primitiveType)
+ {
+ error(typeQualifier.line,
+ "primitive doesn't match earlier output primitive declaration", "layout");
+ return false;
+ }
+ }
+
+ // Set mGeometryMaxVertices if exists
+ if (layoutQualifier.maxVertices > -1)
+ {
+ if (mGeometryShaderMaxVertices == -1)
+ {
+ mGeometryShaderMaxVertices = layoutQualifier.maxVertices;
+ }
+ else if (mGeometryShaderMaxVertices != layoutQualifier.maxVertices)
+ {
+ error(typeQualifier.line, "max_vertices contradicts to the earlier declaration",
+ "layout");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void TParseContext::parseGlobalLayoutQualifier(const TTypeQualifierBuilder &typeQualifierBuilder)
+{
+ TTypeQualifier typeQualifier = typeQualifierBuilder.getVariableTypeQualifier(mDiagnostics);
+ const TLayoutQualifier layoutQualifier = typeQualifier.layoutQualifier;
+
+ checkInvariantVariableQualifier(typeQualifier.invariant, typeQualifier.qualifier,
+ typeQualifier.line);
+
+ // It should never be the case, but some strange parser errors can send us here.
+ if (layoutQualifier.isEmpty())
+ {
+ error(typeQualifier.line, "Error during layout qualifier parsing.", "?");
+ return;
+ }
+
+ if (!layoutQualifier.isCombinationValid())
+ {
+ error(typeQualifier.line, "invalid layout qualifier combination", "layout");
+ return;
+ }
+
+ checkIndexIsNotSpecified(typeQualifier.line, layoutQualifier.index);
+
+ checkBindingIsNotSpecified(typeQualifier.line, layoutQualifier.binding);
+
+ checkMemoryQualifierIsNotSpecified(typeQualifier.memoryQualifier, typeQualifier.line);
+
+ checkInternalFormatIsNotSpecified(typeQualifier.line, layoutQualifier.imageInternalFormat);
+
+ checkYuvIsNotSpecified(typeQualifier.line, layoutQualifier.yuv);
+
+ checkOffsetIsNotSpecified(typeQualifier.line, layoutQualifier.offset);
+
+ checkStd430IsForShaderStorageBlock(typeQualifier.line, layoutQualifier.blockStorage,
+ typeQualifier.qualifier);
+
+ if (typeQualifier.qualifier == EvqComputeIn)
+ {
+ if (mComputeShaderLocalSizeDeclared &&
+ !layoutQualifier.isLocalSizeEqual(mComputeShaderLocalSize))
+ {
+ error(typeQualifier.line, "Work group size does not match the previous declaration",
+ "layout");
+ return;
+ }
+
+ if (mShaderVersion < 310)
+ {
+ error(typeQualifier.line, "in type qualifier supported in GLSL ES 3.10 only", "layout");
+ return;
+ }
+
+ if (!layoutQualifier.localSize.isAnyValueSet())
+ {
+ error(typeQualifier.line, "No local work group size specified", "layout");
+ return;
+ }
+
+ const TVariable *maxComputeWorkGroupSize = static_cast<const TVariable *>(
+ symbolTable.findBuiltIn(ImmutableString("gl_MaxComputeWorkGroupSize"), mShaderVersion));
+
+ const TConstantUnion *maxComputeWorkGroupSizeData =
+ maxComputeWorkGroupSize->getConstPointer();
+
+ for (size_t i = 0u; i < layoutQualifier.localSize.size(); ++i)
+ {
+ if (layoutQualifier.localSize[i] != -1)
+ {
+ mComputeShaderLocalSize[i] = layoutQualifier.localSize[i];
+ const int maxComputeWorkGroupSizeValue = maxComputeWorkGroupSizeData[i].getIConst();
+ if (mComputeShaderLocalSize[i] < 1 ||
+ mComputeShaderLocalSize[i] > maxComputeWorkGroupSizeValue)
+ {
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
+ reasonStream << "invalid value: Value must be at least 1 and no greater than "
+ << maxComputeWorkGroupSizeValue;
+ const std::string &reason = reasonStream.str();
+
+ error(typeQualifier.line, reason.c_str(), getWorkGroupSizeString(i));
+ return;
+ }
+ }
+ }
+
+ mComputeShaderLocalSizeDeclared = true;
+ }
+ else if (typeQualifier.qualifier == EvqGeometryIn)
+ {
+ if (mShaderVersion < 310)
+ {
+ error(typeQualifier.line, "in type qualifier supported in GLSL ES 3.10 only", "layout");
+ return;
+ }
+
+ if (!parseGeometryShaderInputLayoutQualifier(typeQualifier))
+ {
+ return;
+ }
+ }
+ else if (typeQualifier.qualifier == EvqGeometryOut)
+ {
+ if (mShaderVersion < 310)
+ {
+ error(typeQualifier.line, "out type qualifier supported in GLSL ES 3.10 only",
+ "layout");
+ return;
+ }
+
+ if (!parseGeometryShaderOutputLayoutQualifier(typeQualifier))
+ {
+ return;
+ }
+ }
+ else if (anyMultiviewExtensionAvailable() && typeQualifier.qualifier == EvqVertexIn)
+ {
+ // This error is only specified in WebGL, but tightens unspecified behavior in the native
+ // specification.
+ if (mNumViews != -1 && layoutQualifier.numViews != mNumViews)
+ {
+ error(typeQualifier.line, "Number of views does not match the previous declaration",
+ "layout");
+ return;
+ }
+
+ if (layoutQualifier.numViews == -1)
+ {
+ error(typeQualifier.line, "No num_views specified", "layout");
+ return;
+ }
+
+ if (layoutQualifier.numViews > mMaxNumViews)
+ {
+ error(typeQualifier.line, "num_views greater than the value of GL_MAX_VIEWS_OVR",
+ "layout");
+ return;
+ }
+
+ mNumViews = layoutQualifier.numViews;
+ }
+ else
+ {
+ if (!checkWorkGroupSizeIsNotSpecified(typeQualifier.line, layoutQualifier))
+ {
+ return;
+ }
+
+ if (typeQualifier.qualifier != EvqUniform && typeQualifier.qualifier != EvqBuffer)
+ {
+ error(typeQualifier.line, "invalid qualifier: global layout can only be set for blocks",
+ getQualifierString(typeQualifier.qualifier));
+ return;
+ }
+
+ if (mShaderVersion < 300)
+ {
+ error(typeQualifier.line, "layout qualifiers supported in GLSL ES 3.00 and above",
+ "layout");
+ return;
+ }
+
+ checkLocationIsNotSpecified(typeQualifier.line, layoutQualifier);
+
+ if (layoutQualifier.matrixPacking != EmpUnspecified)
+ {
+ if (typeQualifier.qualifier == EvqUniform)
+ {
+ mDefaultUniformMatrixPacking = layoutQualifier.matrixPacking;
+ }
+ else if (typeQualifier.qualifier == EvqBuffer)
+ {
+ mDefaultBufferMatrixPacking = layoutQualifier.matrixPacking;
+ }
+ }
+
+ if (layoutQualifier.blockStorage != EbsUnspecified)
+ {
+ if (typeQualifier.qualifier == EvqUniform)
+ {
+ mDefaultUniformBlockStorage = layoutQualifier.blockStorage;
+ }
+ else if (typeQualifier.qualifier == EvqBuffer)
+ {
+ mDefaultBufferBlockStorage = layoutQualifier.blockStorage;
+ }
+ }
+ }
+}
+
+TIntermFunctionPrototype *TParseContext::createPrototypeNodeFromFunction(
+ const TFunction &function,
+ const TSourceLoc &location,
+ bool insertParametersToSymbolTable)
+{
+ checkIsNotReserved(location, function.name());
+
+ TIntermFunctionPrototype *prototype = new TIntermFunctionPrototype(&function);
+ prototype->setLine(location);
+
+ for (size_t i = 0; i < function.getParamCount(); i++)
+ {
+ const TVariable *param = function.getParam(i);
+
+ // If the parameter has no name, it's not an error, just don't add it to symbol table (could
+ // be used for unused args).
+ if (param->symbolType() != SymbolType::Empty)
+ {
+ if (insertParametersToSymbolTable)
+ {
+ if (!symbolTable.declare(const_cast<TVariable *>(param)))
+ {
+ error(location, "redefinition", param->name());
+ }
+ }
+ // Unsized type of a named parameter should have already been checked and sanitized.
+ ASSERT(!param->getType().isUnsizedArray());
+ }
+ else
+ {
+ if (param->getType().isUnsizedArray())
+ {
+ error(location, "function parameter array must be sized at compile time", "[]");
+ // We don't need to size the arrays since the parameter is unnamed and hence
+ // inaccessible.
+ }
+ }
+ }
+ return prototype;
+}
+
+TIntermFunctionPrototype *TParseContext::addFunctionPrototypeDeclaration(
+ const TFunction &parsedFunction,
+ const TSourceLoc &location)
+{
+ // Note: function found from the symbol table could be the same as parsedFunction if this is the
+ // first declaration. Either way the instance in the symbol table is used to track whether the
+ // function is declared multiple times.
+ bool hadPrototypeDeclaration = false;
+ const TFunction *function = symbolTable.markFunctionHasPrototypeDeclaration(
+ parsedFunction.getMangledName(), &hadPrototypeDeclaration);
+
+ if (hadPrototypeDeclaration && mShaderVersion == 100)
+ {
+ // ESSL 1.00.17 section 4.2.7.
+ // Doesn't apply to ESSL 3.00.4: see section 4.2.3.
+ error(location, "duplicate function prototype declarations are not allowed", "function");
+ }
+
+ TIntermFunctionPrototype *prototype =
+ createPrototypeNodeFromFunction(*function, location, false);
+
+ symbolTable.pop();
+
+ if (!symbolTable.atGlobalLevel())
+ {
+ // ESSL 3.00.4 section 4.2.4.
+ error(location, "local function prototype declarations are not allowed", "function");
+ }
+
+ return prototype;
+}
+
+TIntermFunctionDefinition *TParseContext::addFunctionDefinition(
+ TIntermFunctionPrototype *functionPrototype,
+ TIntermBlock *functionBody,
+ const TSourceLoc &location)
+{
+ // Undo push at end of parseFunctionDefinitionHeader() below for ESSL1.00 case
+ if (mFunctionBodyNewScope)
+ {
+ mFunctionBodyNewScope = false;
+ symbolTable.pop();
+ }
+
+ // Check that non-void functions have at least one return statement.
+ if (mCurrentFunctionType->getBasicType() != EbtVoid && !mFunctionReturnsValue)
+ {
+ error(location,
+ "function does not return a value:", functionPrototype->getFunction()->name());
+ }
+
+ if (functionBody == nullptr)
+ {
+ functionBody = new TIntermBlock();
+ functionBody->setLine(location);
+ }
+ TIntermFunctionDefinition *functionNode =
+ new TIntermFunctionDefinition(functionPrototype, functionBody);
+ functionNode->setLine(location);
+
+ symbolTable.pop();
+ return functionNode;
+}
+
+void TParseContext::parseFunctionDefinitionHeader(const TSourceLoc &location,
+ const TFunction *function,
+ TIntermFunctionPrototype **prototypeOut)
+{
+ ASSERT(function);
+
+ bool wasDefined = false;
+ function = symbolTable.setFunctionParameterNamesFromDefinition(function, &wasDefined);
+ if (wasDefined)
+ {
+ error(location, "function already has a body", function->name());
+ }
+
+ // Remember the return type for later checking for return statements.
+ mCurrentFunctionType = &(function->getReturnType());
+ mFunctionReturnsValue = false;
+
+ *prototypeOut = createPrototypeNodeFromFunction(*function, location, true);
+ setLoopNestingLevel(0);
+
+ // ESSL 1.00 spec allows for variable in function body to redefine parameter
+ if (IsSpecWithFunctionBodyNewScope(mShaderSpec, mShaderVersion))
+ {
+ mFunctionBodyNewScope = true;
+ symbolTable.push();
+ }
+}
+
+TFunction *TParseContext::parseFunctionDeclarator(const TSourceLoc &location, TFunction *function)
+{
+ //
+ // We don't know at this point whether this is a function definition or a prototype.
+ // The definition production code will check for redefinitions.
+ // In the case of ESSL 1.00 the prototype production code will also check for redeclarations.
+ //
+
+ for (size_t i = 0u; i < function->getParamCount(); ++i)
+ {
+ const TVariable *param = function->getParam(i);
+ if (param->getType().isStructSpecifier())
+ {
+ // ESSL 3.00.6 section 12.10.
+ error(location, "Function parameter type cannot be a structure definition",
+ function->name());
+ }
+ }
+
+ if (getShaderVersion() >= 300)
+ {
+ const UnmangledBuiltIn *builtIn =
+ symbolTable.getUnmangledBuiltInForShaderVersion(function->name(), getShaderVersion());
+ if (builtIn &&
+ (builtIn->extension == TExtension::UNDEFINED || isExtensionEnabled(builtIn->extension)))
+ {
+ // With ESSL 3.00 and above, names of built-in functions cannot be redeclared as
+ // functions. Therefore overloading or redefining builtin functions is an error.
+ error(location, "Name of a built-in function cannot be redeclared as function",
+ function->name());
+ }
+ }
+ else
+ {
+ // ESSL 1.00.17 section 4.2.6: built-ins can be overloaded but not redefined. We assume that
+ // this applies to redeclarations as well.
+ const TSymbol *builtIn =
+ symbolTable.findBuiltIn(function->getMangledName(), getShaderVersion());
+ if (builtIn)
+ {
+ error(location, "built-in functions cannot be redefined", function->name());
+ }
+ }
+
+ // Return types and parameter qualifiers must match in all redeclarations, so those are checked
+ // here.
+ const TFunction *prevDec =
+ static_cast<const TFunction *>(symbolTable.findGlobal(function->getMangledName()));
+ if (prevDec)
+ {
+ if (prevDec->getReturnType() != function->getReturnType())
+ {
+ error(location, "function must have the same return type in all of its declarations",
+ function->getReturnType().getBasicString());
+ }
+ for (size_t i = 0; i < prevDec->getParamCount(); ++i)
+ {
+ if (prevDec->getParam(i)->getType().getQualifier() !=
+ function->getParam(i)->getType().getQualifier())
+ {
+ error(location,
+ "function must have the same parameter qualifiers in all of its declarations",
+ function->getParam(i)->getType().getQualifierString());
+ }
+ }
+ }
+
+ // Check for previously declared variables using the same name.
+ const TSymbol *prevSym = symbolTable.find(function->name(), getShaderVersion());
+ bool insertUnmangledName = true;
+ if (prevSym)
+ {
+ if (!prevSym->isFunction())
+ {
+ error(location, "redefinition of a function", function->name());
+ }
+ insertUnmangledName = false;
+ }
+ // Parsing is at the inner scope level of the function's arguments and body statement at this
+ // point, but declareUserDefinedFunction takes care of declaring the function at the global
+ // scope.
+ symbolTable.declareUserDefinedFunction(function, insertUnmangledName);
+
+ // Raise error message if main function takes any parameters or return anything other than void
+ if (function->isMain())
+ {
+ if (function->getParamCount() > 0)
+ {
+ error(location, "function cannot take any parameter(s)", "main");
+ }
+ if (function->getReturnType().getBasicType() != EbtVoid)
+ {
+ error(location, "main function cannot return a value",
+ function->getReturnType().getBasicString());
+ }
+ }
+
+ //
+ // If this is a redeclaration, it could also be a definition, in which case, we want to use the
+ // variable names from this one, and not the one that's
+ // being redeclared. So, pass back up this declaration, not the one in the symbol table.
+ //
+ return function;
+}
+
+TFunction *TParseContext::parseFunctionHeader(const TPublicType &type,
+ const ImmutableString &name,
+ const TSourceLoc &location)
+{
+ if (type.qualifier != EvqGlobal && type.qualifier != EvqTemporary)
+ {
+ error(location, "no qualifiers allowed for function return",
+ getQualifierString(type.qualifier));
+ }
+ if (!type.layoutQualifier.isEmpty())
+ {
+ error(location, "no qualifiers allowed for function return", "layout");
+ }
+ // make sure an opaque type is not involved as well...
+ std::string reason(getBasicString(type.getBasicType()));
+ reason += "s can't be function return values";
+ checkIsNotOpaqueType(location, type.typeSpecifierNonArray, reason.c_str());
+ if (mShaderVersion < 300)
+ {
+ // Array return values are forbidden, but there's also no valid syntax for declaring array
+ // return values in ESSL 1.00.
+ ASSERT(!type.isArray() || mDiagnostics->numErrors() > 0);
+
+ if (type.isStructureContainingArrays())
+ {
+ // ESSL 1.00.17 section 6.1 Function Definitions
+ TInfoSinkBase typeString;
+ typeString << TType(type);
+ error(location, "structures containing arrays can't be function return values",
+ typeString.c_str());
+ }
+ }
+
+ // Add the function as a prototype after parsing it (we do not support recursion)
+ return new TFunction(&symbolTable, name, SymbolType::UserDefined, new TType(type), false);
+}
+
+TFunctionLookup *TParseContext::addNonConstructorFunc(const ImmutableString &name,
+ const TSymbol *symbol)
+{
+ return TFunctionLookup::CreateFunctionCall(name, symbol);
+}
+
+TFunctionLookup *TParseContext::addConstructorFunc(const TPublicType &publicType)
+{
+ if (mShaderVersion < 300 && publicType.isArray())
+ {
+ error(publicType.getLine(), "array constructor supported in GLSL ES 3.00 and above only",
+ "[]");
+ }
+ if (publicType.isStructSpecifier())
+ {
+ error(publicType.getLine(), "constructor can't be a structure definition",
+ getBasicString(publicType.getBasicType()));
+ }
+
+ TType *type = new TType(publicType);
+ if (!type->canBeConstructed())
+ {
+ error(publicType.getLine(), "cannot construct this type",
+ getBasicString(publicType.getBasicType()));
+ type->setBasicType(EbtFloat);
+ }
+ return TFunctionLookup::CreateConstructor(type);
+}
+
+void TParseContext::checkIsNotUnsizedArray(const TSourceLoc &line,
+ const char *errorMessage,
+ const ImmutableString &token,
+ TType *arrayType)
+{
+ if (arrayType->isUnsizedArray())
+ {
+ error(line, errorMessage, token);
+ arrayType->sizeUnsizedArrays(nullptr);
+ }
+}
+
+TParameter TParseContext::parseParameterDeclarator(TType *type,
+ const ImmutableString &name,
+ const TSourceLoc &nameLoc)
+{
+ ASSERT(type);
+ checkIsNotUnsizedArray(nameLoc, "function parameter array must specify a size", name, type);
+ if (type->getBasicType() == EbtVoid)
+ {
+ error(nameLoc, "illegal use of type 'void'", name);
+ }
+ checkIsNotReserved(nameLoc, name);
+ TParameter param = {name.data(), type};
+ return param;
+}
+
+TParameter TParseContext::parseParameterDeclarator(const TPublicType &publicType,
+ const ImmutableString &name,
+ const TSourceLoc &nameLoc)
+{
+ TType *type = new TType(publicType);
+ return parseParameterDeclarator(type, name, nameLoc);
+}
+
+TParameter TParseContext::parseParameterArrayDeclarator(const ImmutableString &name,
+ const TSourceLoc &nameLoc,
+ const TVector<unsigned int> &arraySizes,
+ const TSourceLoc &arrayLoc,
+ TPublicType *elementType)
+{
+ checkArrayElementIsNotArray(arrayLoc, *elementType);
+ TType *arrayType = new TType(*elementType);
+ arrayType->makeArrays(arraySizes);
+ return parseParameterDeclarator(arrayType, name, nameLoc);
+}
+
+bool TParseContext::checkUnsizedArrayConstructorArgumentDimensionality(
+ const TIntermSequence &arguments,
+ TType type,
+ const TSourceLoc &line)
+{
+ if (arguments.empty())
+ {
+ error(line, "implicitly sized array constructor must have at least one argument", "[]");
+ return false;
+ }
+ for (TIntermNode *arg : arguments)
+ {
+ const TIntermTyped *element = arg->getAsTyped();
+ ASSERT(element);
+ size_t dimensionalityFromElement = element->getType().getNumArraySizes() + 1u;
+ if (dimensionalityFromElement > type.getNumArraySizes())
+ {
+ error(line, "constructing from a non-dereferenced array", "constructor");
+ return false;
+ }
+ else if (dimensionalityFromElement < type.getNumArraySizes())
+ {
+ if (dimensionalityFromElement == 1u)
+ {
+ error(line, "implicitly sized array of arrays constructor argument is not an array",
+ "constructor");
+ }
+ else
+ {
+ error(line,
+ "implicitly sized array of arrays constructor argument dimensionality is too "
+ "low",
+ "constructor");
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
+// This function is used to test for the correctness of the parameters passed to various constructor
+// functions and also convert them to the right datatype if it is allowed and required.
+//
+// Returns a node to add to the tree regardless of if an error was generated or not.
+//
+TIntermTyped *TParseContext::addConstructor(TFunctionLookup *fnCall, const TSourceLoc &line)
+{
+ TType type = fnCall->constructorType();
+ TIntermSequence &arguments = fnCall->arguments();
+ if (type.isUnsizedArray())
+ {
+ if (!checkUnsizedArrayConstructorArgumentDimensionality(arguments, type, line))
+ {
+ type.sizeUnsizedArrays(nullptr);
+ return CreateZeroNode(type);
+ }
+ TIntermTyped *firstElement = arguments.at(0)->getAsTyped();
+ ASSERT(firstElement);
+ if (type.getOutermostArraySize() == 0u)
+ {
+ type.sizeOutermostUnsizedArray(static_cast<unsigned int>(arguments.size()));
+ }
+ for (size_t i = 0; i < firstElement->getType().getNumArraySizes(); ++i)
+ {
+ if ((*type.getArraySizes())[i] == 0u)
+ {
+ type.setArraySize(i, (*firstElement->getType().getArraySizes())[i]);
+ }
+ }
+ ASSERT(!type.isUnsizedArray());
+ }
+
+ if (!checkConstructorArguments(line, arguments, type))
+ {
+ return CreateZeroNode(type);
+ }
+
+ TIntermAggregate *constructorNode = TIntermAggregate::CreateConstructor(type, &arguments);
+ constructorNode->setLine(line);
+
+ return constructorNode->fold(mDiagnostics);
+}
+
+//
+// Interface/uniform blocks
+// TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
+//
+TIntermDeclaration *TParseContext::addInterfaceBlock(
+ const TTypeQualifierBuilder &typeQualifierBuilder,
+ const TSourceLoc &nameLine,
+ const ImmutableString &blockName,
+ TFieldList *fieldList,
+ const ImmutableString &instanceName,
+ const TSourceLoc &instanceLine,
+ TIntermTyped *arrayIndex,
+ const TSourceLoc &arrayIndexLine)
+{
+ checkIsNotReserved(nameLine, blockName);
+
+ TTypeQualifier typeQualifier = typeQualifierBuilder.getVariableTypeQualifier(mDiagnostics);
+
+ if (mShaderVersion < 310 && typeQualifier.qualifier != EvqUniform)
+ {
+ error(typeQualifier.line,
+ "invalid qualifier: interface blocks must be uniform in version lower than GLSL ES "
+ "3.10",
+ getQualifierString(typeQualifier.qualifier));
+ }
+ else if (typeQualifier.qualifier != EvqUniform && typeQualifier.qualifier != EvqBuffer)
+ {
+ error(typeQualifier.line, "invalid qualifier: interface blocks must be uniform or buffer",
+ getQualifierString(typeQualifier.qualifier));
+ }
+
+ if (typeQualifier.invariant)
+ {
+ error(typeQualifier.line, "invalid qualifier on interface block member", "invariant");
+ }
+
+ if (typeQualifier.qualifier != EvqBuffer)
+ {
+ checkMemoryQualifierIsNotSpecified(typeQualifier.memoryQualifier, typeQualifier.line);
+ }
+
+ // add array index
+ unsigned int arraySize = 0;
+ if (arrayIndex != nullptr)
+ {
+ arraySize = checkIsValidArraySize(arrayIndexLine, arrayIndex);
+ }
+
+ checkIndexIsNotSpecified(typeQualifier.line, typeQualifier.layoutQualifier.index);
+
+ if (mShaderVersion < 310)
+ {
+ checkBindingIsNotSpecified(typeQualifier.line, typeQualifier.layoutQualifier.binding);
+ }
+ else
+ {
+ checkBlockBindingIsValid(typeQualifier.line, typeQualifier.qualifier,
+ typeQualifier.layoutQualifier.binding, arraySize);
+ }
+
+ checkYuvIsNotSpecified(typeQualifier.line, typeQualifier.layoutQualifier.yuv);
+
+ TLayoutQualifier blockLayoutQualifier = typeQualifier.layoutQualifier;
+ checkLocationIsNotSpecified(typeQualifier.line, blockLayoutQualifier);
+ checkStd430IsForShaderStorageBlock(typeQualifier.line, blockLayoutQualifier.blockStorage,
+ typeQualifier.qualifier);
+
+ if (blockLayoutQualifier.matrixPacking == EmpUnspecified)
+ {
+ if (typeQualifier.qualifier == EvqUniform)
+ {
+ blockLayoutQualifier.matrixPacking = mDefaultUniformMatrixPacking;
+ }
+ else if (typeQualifier.qualifier == EvqBuffer)
+ {
+ blockLayoutQualifier.matrixPacking = mDefaultBufferMatrixPacking;
+ }
+ }
+
+ if (blockLayoutQualifier.blockStorage == EbsUnspecified)
+ {
+ if (typeQualifier.qualifier == EvqUniform)
+ {
+ blockLayoutQualifier.blockStorage = mDefaultUniformBlockStorage;
+ }
+ else if (typeQualifier.qualifier == EvqBuffer)
+ {
+ blockLayoutQualifier.blockStorage = mDefaultBufferBlockStorage;
+ }
+ }
+
+ checkWorkGroupSizeIsNotSpecified(nameLine, blockLayoutQualifier);
+
+ checkInternalFormatIsNotSpecified(nameLine, blockLayoutQualifier.imageInternalFormat);
+
+ // 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 (IsOpaqueType(fieldType->getBasicType()))
+ {
+ std::string reason("unsupported type - ");
+ reason += fieldType->getBasicString();
+ reason += " types are not allowed in interface blocks";
+ error(field->line(), reason.c_str(), fieldType->getBasicString());
+ }
+
+ const TQualifier qualifier = fieldType->getQualifier();
+ switch (qualifier)
+ {
+ case EvqGlobal:
+ break;
+ case EvqUniform:
+ if (typeQualifier.qualifier == EvqBuffer)
+ {
+ error(field->line(), "invalid qualifier on shader storage block member",
+ getQualifierString(qualifier));
+ }
+ break;
+ case EvqBuffer:
+ if (typeQualifier.qualifier == EvqUniform)
+ {
+ error(field->line(), "invalid qualifier on uniform block member",
+ getQualifierString(qualifier));
+ }
+ break;
+ default:
+ error(field->line(), "invalid qualifier on interface block member",
+ getQualifierString(qualifier));
+ break;
+ }
+
+ if (fieldType->isInvariant())
+ {
+ error(field->line(), "invalid qualifier on interface block member", "invariant");
+ }
+
+ // check layout qualifiers
+ TLayoutQualifier fieldLayoutQualifier = fieldType->getLayoutQualifier();
+ checkLocationIsNotSpecified(field->line(), fieldLayoutQualifier);
+ checkIndexIsNotSpecified(field->line(), fieldLayoutQualifier.index);
+ checkBindingIsNotSpecified(field->line(), fieldLayoutQualifier.binding);
+
+ if (fieldLayoutQualifier.blockStorage != EbsUnspecified)
+ {
+ error(field->line(), "invalid layout qualifier: cannot be used here",
+ getBlockStorageString(fieldLayoutQualifier.blockStorage));
+ }
+
+ if (fieldLayoutQualifier.matrixPacking == EmpUnspecified)
+ {
+ fieldLayoutQualifier.matrixPacking = blockLayoutQualifier.matrixPacking;
+ }
+ else if (!fieldType->isMatrix() && fieldType->getBasicType() != EbtStruct)
+ {
+ warning(field->line(),
+ "extraneous layout qualifier: only has an effect on matrix types",
+ getMatrixPackingString(fieldLayoutQualifier.matrixPacking));
+ }
+
+ fieldType->setLayoutQualifier(fieldLayoutQualifier);
+
+ if (mShaderVersion < 310 || memberIndex != fieldList->size() - 1u ||
+ typeQualifier.qualifier != EvqBuffer)
+ {
+ // ESSL 3.10 spec section 4.1.9 allows for runtime-sized arrays.
+ checkIsNotUnsizedArray(field->line(),
+ "array members of interface blocks must specify a size",
+ field->name(), field->type());
+ }
+
+ if (typeQualifier.qualifier == EvqBuffer)
+ {
+ // set memory qualifiers
+ // GLSL ES 3.10 session 4.9 [Memory Access Qualifiers]. When a block declaration is
+ // qualified with a memory qualifier, it is as if all of its members were declared with
+ // the same memory qualifier.
+ const TMemoryQualifier &blockMemoryQualifier = typeQualifier.memoryQualifier;
+ TMemoryQualifier fieldMemoryQualifier = fieldType->getMemoryQualifier();
+ fieldMemoryQualifier.readonly |= blockMemoryQualifier.readonly;
+ fieldMemoryQualifier.writeonly |= blockMemoryQualifier.writeonly;
+ fieldMemoryQualifier.coherent |= blockMemoryQualifier.coherent;
+ fieldMemoryQualifier.restrictQualifier |= blockMemoryQualifier.restrictQualifier;
+ fieldMemoryQualifier.volatileQualifier |= blockMemoryQualifier.volatileQualifier;
+ // TODO(jiajia.qin@intel.com): Decide whether if readonly and writeonly buffer variable
+ // is legal. See bug https://github.com/KhronosGroup/OpenGL-API/issues/7
+ fieldType->setMemoryQualifier(fieldMemoryQualifier);
+ }
+ }
+
+ TInterfaceBlock *interfaceBlock = new TInterfaceBlock(
+ &symbolTable, blockName, fieldList, blockLayoutQualifier, SymbolType::UserDefined);
+ if (!symbolTable.declare(interfaceBlock))
+ {
+ error(nameLine, "redefinition of an interface block name", blockName);
+ }
+
+ TType *interfaceBlockType =
+ new TType(interfaceBlock, typeQualifier.qualifier, blockLayoutQualifier);
+ if (arrayIndex != nullptr)
+ {
+ interfaceBlockType->makeArray(arraySize);
+ }
+
+ // The instance variable gets created to refer to the interface block type from the AST
+ // regardless of if there's an instance name. It's created as an empty symbol if there is no
+ // instance name.
+ TVariable *instanceVariable =
+ new TVariable(&symbolTable, instanceName, interfaceBlockType,
+ instanceName.empty() ? SymbolType::Empty : SymbolType::UserDefined);
+
+ if (instanceVariable->symbolType() == SymbolType::Empty)
+ {
+ // define symbols for the members of the interface block
+ for (size_t memberIndex = 0; memberIndex < fieldList->size(); ++memberIndex)
+ {
+ TField *field = (*fieldList)[memberIndex];
+ TType *fieldType = new TType(*field->type());
+
+ // set parent pointer of the field variable
+ fieldType->setInterfaceBlock(interfaceBlock);
+
+ fieldType->setQualifier(typeQualifier.qualifier);
+
+ TVariable *fieldVariable =
+ new TVariable(&symbolTable, field->name(), fieldType, SymbolType::UserDefined);
+ if (!symbolTable.declare(fieldVariable))
+ {
+ error(field->line(), "redefinition of an interface block member name",
+ field->name());
+ }
+ }
+ }
+ else
+ {
+ checkIsNotReserved(instanceLine, instanceName);
+
+ // add a symbol for this interface block
+ if (!symbolTable.declare(instanceVariable))
+ {
+ error(instanceLine, "redefinition of an interface block instance name", instanceName);
+ }
+ }
+
+ TIntermSymbol *blockSymbol = new TIntermSymbol(instanceVariable);
+ blockSymbol->setLine(typeQualifier.line);
+ TIntermDeclaration *declaration = new TIntermDeclaration();
+ declaration->appendDeclarator(blockSymbol);
+ declaration->setLine(nameLine);
+
+ exitStructDeclaration();
+ return declaration;
+}
+
+void TParseContext::enterStructDeclaration(const TSourceLoc &line,
+ const ImmutableString &identifier)
+{
+ ++mStructNestingLevel;
+
+ // Embedded structure definitions are not supported per GLSL ES spec.
+ // ESSL 1.00.17 section 10.9. ESSL 3.00.6 section 12.11.
+ if (mStructNestingLevel > 1)
+ {
+ error(line, "Embedded struct definitions are not allowed", "struct");
+ }
+}
+
+void TParseContext::exitStructDeclaration()
+{
+ --mStructNestingLevel;
+}
+
+void TParseContext::checkIsBelowStructNestingLimit(const TSourceLoc &line, const TField &field)
+{
+ if (!sh::IsWebGLBasedSpec(mShaderSpec))
+ {
+ return;
+ }
+
+ if (field.type()->getBasicType() != EbtStruct)
+ {
+ return;
+ }
+
+ // We're already inside a structure definition at this point, so add
+ // one to the field's struct nesting.
+ if (1 + field.type()->getDeepestStructNesting() > kWebGLMaxStructNesting)
+ {
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
+ if (field.type()->getStruct()->symbolType() == SymbolType::Empty)
+ {
+ // This may happen in case there are nested struct definitions. While they are also
+ // invalid GLSL, they don't cause a syntax error.
+ reasonStream << "Struct nesting";
+ }
+ else
+ {
+ reasonStream << "Reference of struct type " << field.type()->getStruct()->name();
+ }
+ reasonStream << " exceeds maximum allowed nesting level of " << kWebGLMaxStructNesting;
+ std::string reason = reasonStream.str();
+ error(line, reason.c_str(), field.name());
+ return;
+ }
+}
+
+//
+// Parse an array index expression
+//
+TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression,
+ const TSourceLoc &location,
+ TIntermTyped *indexExpression)
+{
+ if (!baseExpression->isArray() && !baseExpression->isMatrix() && !baseExpression->isVector())
+ {
+ if (baseExpression->getAsSymbolNode())
+ {
+ error(location, " left of '[' is not of type array, matrix, or vector ",
+ baseExpression->getAsSymbolNode()->getName());
+ }
+ else
+ {
+ error(location, " left of '[' is not of type array, matrix, or vector ", "expression");
+ }
+
+ return CreateZeroNode(TType(EbtFloat, EbpHigh, EvqConst));
+ }
+
+ if (baseExpression->getQualifier() == EvqPerVertexIn)
+ {
+ ASSERT(mShaderType == GL_GEOMETRY_SHADER_EXT);
+ if (mGeometryShaderInputPrimitiveType == EptUndefined)
+ {
+ error(location, "missing input primitive declaration before indexing gl_in.", "[");
+ return CreateZeroNode(TType(EbtFloat, EbpHigh, EvqConst));
+ }
+ }
+
+ TIntermConstantUnion *indexConstantUnion = indexExpression->getAsConstantUnion();
+
+ // ANGLE should be able to fold any constant expressions resulting in an integer - but to be
+ // safe we don't treat "EvqConst" that's evaluated according to the spec as being sufficient
+ // for constness. Some interpretations of the spec have allowed constant expressions with side
+ // effects - like array length() method on a non-constant array.
+ if (indexExpression->getQualifier() != EvqConst || indexConstantUnion == nullptr)
+ {
+ if (baseExpression->isInterfaceBlock())
+ {
+ // TODO(jiawei.shao@intel.com): implement GL_EXT_shader_io_blocks.
+ switch (baseExpression->getQualifier())
+ {
+ case EvqPerVertexIn:
+ break;
+ case EvqUniform:
+ case EvqBuffer:
+ error(location,
+ "array indexes for uniform block arrays and shader storage block arrays "
+ "must be constant integral expressions",
+ "[");
+ break;
+ default:
+ // We can reach here only in error cases.
+ ASSERT(mDiagnostics->numErrors() > 0);
+ break;
+ }
+ }
+ else if (baseExpression->getQualifier() == EvqFragmentOut)
+ {
+ error(location,
+ "array indexes for fragment outputs must be constant integral expressions", "[");
+ }
+ else if (mShaderSpec == SH_WEBGL2_SPEC && baseExpression->getQualifier() == EvqFragData)
+ {
+ error(location, "array index for gl_FragData must be constant zero", "[");
+ }
+ }
+
+ if (indexConstantUnion)
+ {
+ // If an out-of-range index is not qualified as constant, the behavior in the spec is
+ // undefined. This applies even if ANGLE has been able to constant fold it (ANGLE may
+ // constant fold expressions that are not constant expressions). The most compatible way to
+ // handle this case is to report a warning instead of an error and force the index to be in
+ // the correct range.
+ bool outOfRangeIndexIsError = indexExpression->getQualifier() == EvqConst;
+ int index = 0;
+ if (indexConstantUnion->getBasicType() == EbtInt)
+ {
+ index = indexConstantUnion->getIConst(0);
+ }
+ else if (indexConstantUnion->getBasicType() == EbtUInt)
+ {
+ index = static_cast<int>(indexConstantUnion->getUConst(0));
+ }
+
+ int safeIndex = -1;
+
+ if (index < 0)
+ {
+ outOfRangeError(outOfRangeIndexIsError, location, "index expression is negative", "[]");
+ safeIndex = 0;
+ }
+
+ if (!baseExpression->getType().isUnsizedArray())
+ {
+ if (baseExpression->isArray())
+ {
+ if (baseExpression->getQualifier() == EvqFragData && index > 0)
+ {
+ if (!isExtensionEnabled(TExtension::EXT_draw_buffers))
+ {
+ outOfRangeError(outOfRangeIndexIsError, location,
+ "array index for gl_FragData must be zero when "
+ "GL_EXT_draw_buffers is disabled",
+ "[]");
+ safeIndex = 0;
+ }
+ }
+ }
+ // Only do generic out-of-range check if similar error hasn't already been reported.
+ if (safeIndex < 0)
+ {
+ if (baseExpression->isArray())
+ {
+ safeIndex = checkIndexLessThan(outOfRangeIndexIsError, location, index,
+ baseExpression->getOutermostArraySize(),
+ "array index out of range");
+ }
+ else if (baseExpression->isMatrix())
+ {
+ safeIndex = checkIndexLessThan(outOfRangeIndexIsError, location, index,
+ baseExpression->getType().getCols(),
+ "matrix field selection out of range");
+ }
+ else
+ {
+ ASSERT(baseExpression->isVector());
+ safeIndex = checkIndexLessThan(outOfRangeIndexIsError, location, index,
+ baseExpression->getType().getNominalSize(),
+ "vector field selection out of range");
+ }
+ }
+
+ ASSERT(safeIndex >= 0);
+ // Data of constant unions can't be changed, because it may be shared with other
+ // constant unions or even builtins, like gl_MaxDrawBuffers. Instead use a new
+ // sanitized object.
+ if (safeIndex != index || indexConstantUnion->getBasicType() != EbtInt)
+ {
+ TConstantUnion *safeConstantUnion = new TConstantUnion();
+ safeConstantUnion->setIConst(safeIndex);
+ indexExpression = new TIntermConstantUnion(
+ safeConstantUnion, TType(EbtInt, indexExpression->getPrecision(),
+ indexExpression->getQualifier()));
+ }
+
+ TIntermBinary *node =
+ new TIntermBinary(EOpIndexDirect, baseExpression, indexExpression);
+ node->setLine(location);
+ return expressionOrFoldedResult(node);
+ }
+ }
+
+ markStaticReadIfSymbol(indexExpression);
+ TIntermBinary *node = new TIntermBinary(EOpIndexIndirect, baseExpression, indexExpression);
+ node->setLine(location);
+ // Indirect indexing can never be constant folded.
+ return node;
+}
+
+int TParseContext::checkIndexLessThan(bool outOfRangeIndexIsError,
+ const TSourceLoc &location,
+ int index,
+ int arraySize,
+ const char *reason)
+{
+ // Should not reach here with an unsized / runtime-sized array.
+ ASSERT(arraySize > 0);
+ // A negative index should already have been checked.
+ ASSERT(index >= 0);
+ if (index >= arraySize)
+ {
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
+ reasonStream << reason << " '" << index << "'";
+ std::string token = reasonStream.str();
+ outOfRangeError(outOfRangeIndexIsError, location, reason, "[]");
+ return arraySize - 1;
+ }
+ return index;
+}
+
+TIntermTyped *TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpression,
+ const TSourceLoc &dotLocation,
+ const ImmutableString &fieldString,
+ const TSourceLoc &fieldLocation)
+{
+ if (baseExpression->isArray())
+ {
+ error(fieldLocation, "cannot apply dot operator to an array", ".");
+ return baseExpression;
+ }
+
+ if (baseExpression->isVector())
+ {
+ TVector<int> fieldOffsets;
+ if (!parseVectorFields(fieldLocation, fieldString, baseExpression->getNominalSize(),
+ &fieldOffsets))
+ {
+ fieldOffsets.resize(1);
+ fieldOffsets[0] = 0;
+ }
+ TIntermSwizzle *node = new TIntermSwizzle(baseExpression, fieldOffsets);
+ node->setLine(dotLocation);
+
+ return node->fold(mDiagnostics);
+ }
+ else if (baseExpression->getBasicType() == EbtStruct)
+ {
+ const TFieldList &fields = baseExpression->getType().getStruct()->fields();
+ if (fields.empty())
+ {
+ error(dotLocation, "structure has no fields", "Internal Error");
+ return baseExpression;
+ }
+ else
+ {
+ bool fieldFound = false;
+ unsigned int i;
+ for (i = 0; i < fields.size(); ++i)
+ {
+ if (fields[i]->name() == fieldString)
+ {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound)
+ {
+ TIntermTyped *index = CreateIndexNode(i);
+ index->setLine(fieldLocation);
+ TIntermBinary *node =
+ new TIntermBinary(EOpIndexDirectStruct, baseExpression, index);
+ node->setLine(dotLocation);
+ return expressionOrFoldedResult(node);
+ }
+ else
+ {
+ error(dotLocation, " no such field in structure", fieldString);
+ return baseExpression;
+ }
+ }
+ }
+ else if (baseExpression->isInterfaceBlock())
+ {
+ const TFieldList &fields = baseExpression->getType().getInterfaceBlock()->fields();
+ if (fields.empty())
+ {
+ error(dotLocation, "interface block has no fields", "Internal Error");
+ return baseExpression;
+ }
+ else
+ {
+ bool fieldFound = false;
+ unsigned int i;
+ for (i = 0; i < fields.size(); ++i)
+ {
+ if (fields[i]->name() == fieldString)
+ {
+ fieldFound = true;
+ break;
+ }
+ }
+ if (fieldFound)
+ {
+ TIntermTyped *index = CreateIndexNode(i);
+ index->setLine(fieldLocation);
+ TIntermBinary *node =
+ new TIntermBinary(EOpIndexDirectInterfaceBlock, baseExpression, index);
+ node->setLine(dotLocation);
+ // Indexing interface blocks can never be constant folded.
+ return node;
+ }
+ else
+ {
+ error(dotLocation, " no such field in interface block", fieldString);
+ return baseExpression;
+ }
+ }
+ }
+ else
+ {
+ if (mShaderVersion < 300)
+ {
+ error(dotLocation, " field selection requires structure or vector on left hand side",
+ fieldString);
+ }
+ else
+ {
+ error(dotLocation,
+ " field selection requires structure, vector, or interface block on left hand "
+ "side",
+ fieldString);
+ }
+ return baseExpression;
+ }
+}
+
+TLayoutQualifier TParseContext::parseLayoutQualifier(const ImmutableString &qualifierType,
+ const TSourceLoc &qualifierTypeLine)
+{
+ TLayoutQualifier qualifier = TLayoutQualifier::Create();
+
+ if (qualifierType == "shared")
+ {
+ if (sh::IsWebGLBasedSpec(mShaderSpec))
+ {
+ error(qualifierTypeLine, "Only std140 layout is allowed in WebGL", "shared");
+ }
+ qualifier.blockStorage = EbsShared;
+ }
+ else if (qualifierType == "packed")
+ {
+ if (sh::IsWebGLBasedSpec(mShaderSpec))
+ {
+ error(qualifierTypeLine, "Only std140 layout is allowed in WebGL", "packed");
+ }
+ qualifier.blockStorage = EbsPacked;
+ }
+ else if (qualifierType == "std430")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.blockStorage = EbsStd430;
+ }
+ 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: location requires an argument",
+ qualifierType);
+ }
+ else if (qualifierType == "yuv" && mShaderType == GL_FRAGMENT_SHADER)
+ {
+ if (checkCanUseExtension(qualifierTypeLine, TExtension::EXT_YUV_target))
+ {
+ qualifier.yuv = true;
+ }
+ }
+ else if (qualifierType == "rgba32f")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA32F;
+ }
+ else if (qualifierType == "rgba16f")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA16F;
+ }
+ else if (qualifierType == "r32f")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifR32F;
+ }
+ else if (qualifierType == "rgba8")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA8;
+ }
+ else if (qualifierType == "rgba8_snorm")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA8_SNORM;
+ }
+ else if (qualifierType == "rgba32i")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA32I;
+ }
+ else if (qualifierType == "rgba16i")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA16I;
+ }
+ else if (qualifierType == "rgba8i")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA8I;
+ }
+ else if (qualifierType == "r32i")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifR32I;
+ }
+ else if (qualifierType == "rgba32ui")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA32UI;
+ }
+ else if (qualifierType == "rgba16ui")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA16UI;
+ }
+ else if (qualifierType == "rgba8ui")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifRGBA8UI;
+ }
+ else if (qualifierType == "r32ui")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.imageInternalFormat = EiifR32UI;
+ }
+ else if (qualifierType == "points" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.primitiveType = EptPoints;
+ }
+ else if (qualifierType == "lines" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.primitiveType = EptLines;
+ }
+ else if (qualifierType == "lines_adjacency" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.primitiveType = EptLinesAdjacency;
+ }
+ else if (qualifierType == "triangles" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.primitiveType = EptTriangles;
+ }
+ else if (qualifierType == "triangles_adjacency" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.primitiveType = EptTrianglesAdjacency;
+ }
+ else if (qualifierType == "line_strip" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.primitiveType = EptLineStrip;
+ }
+ else if (qualifierType == "triangle_strip" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ qualifier.primitiveType = EptTriangleStrip;
+ }
+
+ else
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType);
+ }
+
+ return qualifier;
+}
+
+void TParseContext::parseLocalSize(const ImmutableString &qualifierType,
+ const TSourceLoc &qualifierTypeLine,
+ int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ size_t index,
+ sh::WorkGroupSize *localSize)
+{
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ if (intValue < 1)
+ {
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
+ reasonStream << "out of range: " << getWorkGroupSizeString(index) << " must be positive";
+ std::string reason = reasonStream.str();
+ error(intValueLine, reason.c_str(), intValueString.c_str());
+ }
+ (*localSize)[index] = intValue;
+}
+
+void TParseContext::parseNumViews(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *numViews)
+{
+ // This error is only specified in WebGL, but tightens unspecified behavior in the native
+ // specification.
+ if (intValue < 1)
+ {
+ error(intValueLine, "out of range: num_views must be positive", intValueString.c_str());
+ }
+ *numViews = intValue;
+}
+
+void TParseContext::parseInvocations(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *numInvocations)
+{
+ // Although SPEC isn't clear whether invocations can be less than 1, we add this limit because
+ // it doesn't make sense to accept invocations <= 0.
+ if (intValue < 1 || intValue > mMaxGeometryShaderInvocations)
+ {
+ error(intValueLine,
+ "out of range: invocations must be in the range of [1, "
+ "MAX_GEOMETRY_SHADER_INVOCATIONS_OES]",
+ intValueString.c_str());
+ }
+ else
+ {
+ *numInvocations = intValue;
+ }
+}
+
+void TParseContext::parseMaxVertices(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *maxVertices)
+{
+ // Although SPEC isn't clear whether max_vertices can be less than 0, we add this limit because
+ // it doesn't make sense to accept max_vertices < 0.
+ if (intValue < 0 || intValue > mMaxGeometryShaderMaxVertices)
+ {
+ error(
+ intValueLine,
+ "out of range: max_vertices must be in the range of [0, gl_MaxGeometryOutputVertices]",
+ intValueString.c_str());
+ }
+ else
+ {
+ *maxVertices = intValue;
+ }
+}
+
+void TParseContext::parseIndexLayoutQualifier(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *index)
+{
+ // EXT_blend_func_extended specifies that most validation should happen at link time, but since
+ // we're validating output variable locations at compile time, it makes sense to validate that
+ // index is 0 or 1 also at compile time. Also since we use "-1" as a placeholder for unspecified
+ // index, we can't accept it here.
+ if (intValue < 0 || intValue > 1)
+ {
+ error(intValueLine, "out of range: index layout qualifier can only be 0 or 1",
+ intValueString.c_str());
+ }
+ else
+ {
+ *index = intValue;
+ }
+}
+
+TLayoutQualifier TParseContext::parseLayoutQualifier(const ImmutableString &qualifierType,
+ const TSourceLoc &qualifierTypeLine,
+ int intValue,
+ const TSourceLoc &intValueLine)
+{
+ TLayoutQualifier qualifier = TLayoutQualifier::Create();
+
+ std::string intValueString = Str(intValue);
+
+ if (qualifierType == "location")
+ {
+ // must check that location is non-negative
+ if (intValue < 0)
+ {
+ error(intValueLine, "out of range: location must be non-negative",
+ intValueString.c_str());
+ }
+ else
+ {
+ qualifier.location = intValue;
+ qualifier.locationsSpecified = 1;
+ }
+ }
+ else if (qualifierType == "binding")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ if (intValue < 0)
+ {
+ error(intValueLine, "out of range: binding must be non-negative",
+ intValueString.c_str());
+ }
+ else
+ {
+ qualifier.binding = intValue;
+ }
+ }
+ else if (qualifierType == "offset")
+ {
+ checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
+ if (intValue < 0)
+ {
+ error(intValueLine, "out of range: offset must be non-negative",
+ intValueString.c_str());
+ }
+ else
+ {
+ qualifier.offset = intValue;
+ }
+ }
+ else if (qualifierType == "local_size_x")
+ {
+ parseLocalSize(qualifierType, qualifierTypeLine, intValue, intValueLine, intValueString, 0u,
+ &qualifier.localSize);
+ }
+ else if (qualifierType == "local_size_y")
+ {
+ parseLocalSize(qualifierType, qualifierTypeLine, intValue, intValueLine, intValueString, 1u,
+ &qualifier.localSize);
+ }
+ else if (qualifierType == "local_size_z")
+ {
+ parseLocalSize(qualifierType, qualifierTypeLine, intValue, intValueLine, intValueString, 2u,
+ &qualifier.localSize);
+ }
+ else if (qualifierType == "num_views" && mShaderType == GL_VERTEX_SHADER)
+ {
+ if (checkCanUseOneOfExtensions(
+ qualifierTypeLine, std::array<TExtension, 2u>{
+ {TExtension::OVR_multiview, TExtension::OVR_multiview2}}))
+ {
+ parseNumViews(intValue, intValueLine, intValueString, &qualifier.numViews);
+ }
+ }
+ else if (qualifierType == "invocations" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ parseInvocations(intValue, intValueLine, intValueString, &qualifier.invocations);
+ }
+ else if (qualifierType == "max_vertices" && mShaderType == GL_GEOMETRY_SHADER_EXT &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_geometry_shader))
+ {
+ parseMaxVertices(intValue, intValueLine, intValueString, &qualifier.maxVertices);
+ }
+ else if (qualifierType == "index" && mShaderType == GL_FRAGMENT_SHADER &&
+ checkCanUseExtension(qualifierTypeLine, TExtension::EXT_blend_func_extended))
+ {
+ parseIndexLayoutQualifier(intValue, intValueLine, intValueString, &qualifier.index);
+ }
+ else
+ {
+ error(qualifierTypeLine, "invalid layout qualifier", qualifierType);
+ }
+
+ return qualifier;
+}
+
+TTypeQualifierBuilder *TParseContext::createTypeQualifierBuilder(const TSourceLoc &loc)
+{
+ return new TTypeQualifierBuilder(
+ new TStorageQualifierWrapper(symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary, loc),
+ mShaderVersion);
+}
+
+TStorageQualifierWrapper *TParseContext::parseGlobalStorageQualifier(TQualifier qualifier,
+ const TSourceLoc &loc)
+{
+ checkIsAtGlobalLevel(loc, getQualifierString(qualifier));
+ return new TStorageQualifierWrapper(qualifier, loc);
+}
+
+TStorageQualifierWrapper *TParseContext::parseVaryingQualifier(const TSourceLoc &loc)
+{
+ if (getShaderType() == GL_VERTEX_SHADER)
+ {
+ return parseGlobalStorageQualifier(EvqVaryingOut, loc);
+ }
+ return parseGlobalStorageQualifier(EvqVaryingIn, loc);
+}
+
+TStorageQualifierWrapper *TParseContext::parseInQualifier(const TSourceLoc &loc)
+{
+ if (declaringFunction())
+ {
+ return new TStorageQualifierWrapper(EvqIn, loc);
+ }
+
+ switch (getShaderType())
+ {
+ case GL_VERTEX_SHADER:
+ {
+ if (mShaderVersion < 300 && !anyMultiviewExtensionAvailable())
+ {
+ error(loc, "storage qualifier supported in GLSL ES 3.00 and above only", "in");
+ }
+ return new TStorageQualifierWrapper(EvqVertexIn, loc);
+ }
+ case GL_FRAGMENT_SHADER:
+ {
+ if (mShaderVersion < 300)
+ {
+ error(loc, "storage qualifier supported in GLSL ES 3.00 and above only", "in");
+ }
+ return new TStorageQualifierWrapper(EvqFragmentIn, loc);
+ }
+ case GL_COMPUTE_SHADER:
+ {
+ return new TStorageQualifierWrapper(EvqComputeIn, loc);
+ }
+ case GL_GEOMETRY_SHADER_EXT:
+ {
+ return new TStorageQualifierWrapper(EvqGeometryIn, loc);
+ }
+ default:
+ {
+ UNREACHABLE();
+ return new TStorageQualifierWrapper(EvqLast, loc);
+ }
+ }
+}
+
+TStorageQualifierWrapper *TParseContext::parseOutQualifier(const TSourceLoc &loc)
+{
+ if (declaringFunction())
+ {
+ return new TStorageQualifierWrapper(EvqOut, loc);
+ }
+ switch (getShaderType())
+ {
+ case GL_VERTEX_SHADER:
+ {
+ if (mShaderVersion < 300)
+ {
+ error(loc, "storage qualifier supported in GLSL ES 3.00 and above only", "out");
+ }
+ return new TStorageQualifierWrapper(EvqVertexOut, loc);
+ }
+ case GL_FRAGMENT_SHADER:
+ {
+ if (mShaderVersion < 300)
+ {
+ error(loc, "storage qualifier supported in GLSL ES 3.00 and above only", "out");
+ }
+ return new TStorageQualifierWrapper(EvqFragmentOut, loc);
+ }
+ case GL_COMPUTE_SHADER:
+ {
+ error(loc, "storage qualifier isn't supported in compute shaders", "out");
+ return new TStorageQualifierWrapper(EvqLast, loc);
+ }
+ case GL_GEOMETRY_SHADER_EXT:
+ {
+ return new TStorageQualifierWrapper(EvqGeometryOut, loc);
+ }
+ default:
+ {
+ UNREACHABLE();
+ return new TStorageQualifierWrapper(EvqLast, loc);
+ }
+ }
+}
+
+TStorageQualifierWrapper *TParseContext::parseInOutQualifier(const TSourceLoc &loc)
+{
+ if (!declaringFunction())
+ {
+ error(loc, "invalid qualifier: can be only used with function parameters", "inout");
+ }
+ return new TStorageQualifierWrapper(EvqInOut, loc);
+}
+
+TLayoutQualifier TParseContext::joinLayoutQualifiers(TLayoutQualifier leftQualifier,
+ TLayoutQualifier rightQualifier,
+ const TSourceLoc &rightQualifierLocation)
+{
+ return sh::JoinLayoutQualifiers(leftQualifier, rightQualifier, rightQualifierLocation,
+ mDiagnostics);
+}
+
+TDeclarator *TParseContext::parseStructDeclarator(const ImmutableString &identifier,
+ const TSourceLoc &loc)
+{
+ checkIsNotReserved(loc, identifier);
+ return new TDeclarator(identifier, loc);
+}
+
+TDeclarator *TParseContext::parseStructArrayDeclarator(const ImmutableString &identifier,
+ const TSourceLoc &loc,
+ const TVector<unsigned int> *arraySizes)
+{
+ checkIsNotReserved(loc, identifier);
+ return new TDeclarator(identifier, arraySizes, loc);
+}
+
+void TParseContext::checkDoesNotHaveDuplicateFieldName(const TFieldList::const_iterator begin,
+ const TFieldList::const_iterator end,
+ const ImmutableString &name,
+ const TSourceLoc &location)
+{
+ for (auto fieldIter = begin; fieldIter != end; ++fieldIter)
+ {
+ if ((*fieldIter)->name() == name)
+ {
+ error(location, "duplicate field name in structure", name);
+ }
+ }
+}
+
+TFieldList *TParseContext::addStructFieldList(TFieldList *fields, const TSourceLoc &location)
+{
+ for (TFieldList::const_iterator fieldIter = fields->begin(); fieldIter != fields->end();
+ ++fieldIter)
+ {
+ checkDoesNotHaveDuplicateFieldName(fields->begin(), fieldIter, (*fieldIter)->name(),
+ location);
+ }
+ return fields;
+}
+
+TFieldList *TParseContext::combineStructFieldLists(TFieldList *processedFields,
+ const TFieldList *newlyAddedFields,
+ const TSourceLoc &location)
+{
+ for (TField *field : *newlyAddedFields)
+ {
+ checkDoesNotHaveDuplicateFieldName(processedFields->begin(), processedFields->end(),
+ field->name(), location);
+ processedFields->push_back(field);
+ }
+ return processedFields;
+}
+
+TFieldList *TParseContext::addStructDeclaratorListWithQualifiers(
+ const TTypeQualifierBuilder &typeQualifierBuilder,
+ TPublicType *typeSpecifier,
+ const TDeclaratorList *declaratorList)
+{
+ TTypeQualifier typeQualifier = typeQualifierBuilder.getVariableTypeQualifier(mDiagnostics);
+
+ typeSpecifier->qualifier = typeQualifier.qualifier;
+ typeSpecifier->layoutQualifier = typeQualifier.layoutQualifier;
+ typeSpecifier->memoryQualifier = typeQualifier.memoryQualifier;
+ typeSpecifier->invariant = typeQualifier.invariant;
+ if (typeQualifier.precision != EbpUndefined)
+ {
+ typeSpecifier->precision = typeQualifier.precision;
+ }
+ return addStructDeclaratorList(*typeSpecifier, declaratorList);
+}
+
+TFieldList *TParseContext::addStructDeclaratorList(const TPublicType &typeSpecifier,
+ const TDeclaratorList *declaratorList)
+{
+ checkPrecisionSpecified(typeSpecifier.getLine(), typeSpecifier.precision,
+ typeSpecifier.getBasicType());
+
+ checkIsNonVoid(typeSpecifier.getLine(), (*declaratorList)[0]->name(),
+ typeSpecifier.getBasicType());
+
+ checkWorkGroupSizeIsNotSpecified(typeSpecifier.getLine(), typeSpecifier.layoutQualifier);
+
+ TFieldList *fieldList = new TFieldList();
+
+ for (const TDeclarator *declarator : *declaratorList)
+ {
+ TType *type = new TType(typeSpecifier);
+ if (declarator->isArray())
+ {
+ // Don't allow arrays of arrays in ESSL < 3.10.
+ checkArrayElementIsNotArray(typeSpecifier.getLine(), typeSpecifier);
+ type->makeArrays(*declarator->arraySizes());
+ }
+
+ TField *field =
+ new TField(type, declarator->name(), declarator->line(), SymbolType::UserDefined);
+ checkIsBelowStructNestingLimit(typeSpecifier.getLine(), *field);
+ fieldList->push_back(field);
+ }
+
+ return fieldList;
+}
+
+TTypeSpecifierNonArray TParseContext::addStructure(const TSourceLoc &structLine,
+ const TSourceLoc &nameLine,
+ const ImmutableString &structName,
+ TFieldList *fieldList)
+{
+ SymbolType structSymbolType = SymbolType::UserDefined;
+ if (structName.empty())
+ {
+ structSymbolType = SymbolType::Empty;
+ }
+ TStructure *structure = new TStructure(&symbolTable, structName, fieldList, structSymbolType);
+
+ // Store a bool in the struct if we're at global scope, to allow us to
+ // skip the local struct scoping workaround in HLSL.
+ structure->setAtGlobalScope(symbolTable.atGlobalLevel());
+
+ if (structSymbolType != SymbolType::Empty)
+ {
+ checkIsNotReserved(nameLine, structName);
+ if (!symbolTable.declare(structure))
+ {
+ error(nameLine, "redefinition of a struct", structName);
+ }
+ }
+
+ // ensure we do not specify any storage qualifiers on the struct members
+ for (unsigned int typeListIndex = 0; typeListIndex < fieldList->size(); typeListIndex++)
+ {
+ 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));
+ break;
+ }
+ if (field.type()->isInvariant())
+ {
+ error(field.line(), "invalid qualifier on struct member", "invariant");
+ }
+ // ESSL 3.10 section 4.1.8 -- atomic_uint or images are not allowed as structure member.
+ if (IsImage(field.type()->getBasicType()) || IsAtomicCounter(field.type()->getBasicType()))
+ {
+ error(field.line(), "disallowed type in struct", field.type()->getBasicString());
+ }
+
+ checkIsNotUnsizedArray(field.line(), "array members of structs must specify a size",
+ field.name(), field.type());
+
+ checkMemoryQualifierIsNotSpecified(field.type()->getMemoryQualifier(), field.line());
+
+ checkIndexIsNotSpecified(field.line(), field.type()->getLayoutQualifier().index);
+
+ checkBindingIsNotSpecified(field.line(), field.type()->getLayoutQualifier().binding);
+
+ checkLocationIsNotSpecified(field.line(), field.type()->getLayoutQualifier());
+ }
+
+ TTypeSpecifierNonArray typeSpecifierNonArray;
+ typeSpecifierNonArray.initializeStruct(structure, true, structLine);
+ exitStructDeclaration();
+
+ return typeSpecifierNonArray;
+}
+
+TIntermSwitch *TParseContext::addSwitch(TIntermTyped *init,
+ TIntermBlock *statementList,
+ const TSourceLoc &loc)
+{
+ TBasicType switchType = init->getBasicType();
+ if ((switchType != EbtInt && switchType != EbtUInt) || init->isMatrix() || init->isArray() ||
+ init->isVector())
+ {
+ error(init->getLine(), "init-expression in a switch statement must be a scalar integer",
+ "switch");
+ return nullptr;
+ }
+
+ ASSERT(statementList);
+ if (!ValidateSwitchStatementList(switchType, mDiagnostics, statementList, loc))
+ {
+ ASSERT(mDiagnostics->numErrors() > 0);
+ return nullptr;
+ }
+
+ markStaticReadIfSymbol(init);
+ TIntermSwitch *node = new TIntermSwitch(init, statementList);
+ node->setLine(loc);
+ return node;
+}
+
+TIntermCase *TParseContext::addCase(TIntermTyped *condition, const TSourceLoc &loc)
+{
+ if (mSwitchNestingLevel == 0)
+ {
+ error(loc, "case labels need to be inside switch statements", "case");
+ return nullptr;
+ }
+ if (condition == nullptr)
+ {
+ error(loc, "case label must have a condition", "case");
+ return nullptr;
+ }
+ if ((condition->getBasicType() != EbtInt && condition->getBasicType() != EbtUInt) ||
+ condition->isMatrix() || condition->isArray() || condition->isVector())
+ {
+ error(condition->getLine(), "case label must be a scalar integer", "case");
+ }
+ TIntermConstantUnion *conditionConst = condition->getAsConstantUnion();
+ // ANGLE should be able to fold any EvqConst expressions resulting in an integer - but to be
+ // safe against corner cases we still check for conditionConst. Some interpretations of the
+ // spec have allowed constant expressions with side effects - like array length() method on a
+ // non-constant array.
+ if (condition->getQualifier() != EvqConst || conditionConst == nullptr)
+ {
+ error(condition->getLine(), "case label must be constant", "case");
+ }
+ TIntermCase *node = new TIntermCase(condition);
+ node->setLine(loc);
+ return node;
+}
+
+TIntermCase *TParseContext::addDefault(const TSourceLoc &loc)
+{
+ if (mSwitchNestingLevel == 0)
+ {
+ error(loc, "default labels need to be inside switch statements", "default");
+ return nullptr;
+ }
+ TIntermCase *node = new TIntermCase(nullptr);
+ node->setLine(loc);
+ return node;
+}
+
+TIntermTyped *TParseContext::createUnaryMath(TOperator op,
+ TIntermTyped *child,
+ const TSourceLoc &loc,
+ const TFunction *func)
+{
+ ASSERT(child != nullptr);
+
+ switch (op)
+ {
+ case EOpLogicalNot:
+ if (child->getBasicType() != EbtBool || child->isMatrix() || child->isArray() ||
+ child->isVector())
+ {
+ unaryOpError(loc, GetOperatorString(op), child->getType());
+ return nullptr;
+ }
+ break;
+ case EOpBitwiseNot:
+ if ((child->getBasicType() != EbtInt && child->getBasicType() != EbtUInt) ||
+ child->isMatrix() || child->isArray())
+ {
+ unaryOpError(loc, GetOperatorString(op), child->getType());
+ return nullptr;
+ }
+ break;
+ case EOpPostIncrement:
+ case EOpPreIncrement:
+ case EOpPostDecrement:
+ case EOpPreDecrement:
+ case EOpNegative:
+ case EOpPositive:
+ if (child->getBasicType() == EbtStruct || child->isInterfaceBlock() ||
+ child->getBasicType() == EbtBool || child->isArray() ||
+ child->getBasicType() == EbtVoid || IsOpaqueType(child->getBasicType()))
+ {
+ unaryOpError(loc, GetOperatorString(op), child->getType());
+ return nullptr;
+ }
+ break;
+ // Operators for built-ins are already type checked against their prototype.
+ default:
+ break;
+ }
+
+ if (child->getMemoryQualifier().writeonly)
+ {
+ unaryOpError(loc, GetOperatorString(op), child->getType());
+ return nullptr;
+ }
+
+ markStaticReadIfSymbol(child);
+ TIntermUnary *node = new TIntermUnary(op, child, func);
+ node->setLine(loc);
+
+ return node->fold(mDiagnostics);
+}
+
+TIntermTyped *TParseContext::addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc)
+{
+ ASSERT(op != EOpNull);
+ TIntermTyped *node = createUnaryMath(op, child, loc, nullptr);
+ if (node == nullptr)
+ {
+ return child;
+ }
+ return node;
+}
+
+TIntermTyped *TParseContext::addUnaryMathLValue(TOperator op,
+ TIntermTyped *child,
+ const TSourceLoc &loc)
+{
+ checkCanBeLValue(loc, GetOperatorString(op), child);
+ return addUnaryMath(op, child, loc);
+}
+
+TIntermTyped *TParseContext::expressionOrFoldedResult(TIntermTyped *expression)
+{
+ // If we can, we should return the folded version of the expression for subsequent parsing. This
+ // enables folding the containing expression during parsing as well, instead of the separate
+ // FoldExpressions() step where folding nested expressions requires multiple full AST
+ // traversals.
+
+ // Even if folding fails the fold() functions return some node representing the expression,
+ // typically the original node. So "folded" can be assumed to be non-null.
+ TIntermTyped *folded = expression->fold(mDiagnostics);
+ ASSERT(folded != nullptr);
+ if (folded->getQualifier() == expression->getQualifier())
+ {
+ // We need this expression to have the correct qualifier when validating the consuming
+ // expression. So we can only return the folded node from here in case it has the same
+ // qualifier as the original expression. In this kind of a cases the qualifier of the folded
+ // node is EvqConst, whereas the qualifier of the expression is EvqTemporary:
+ // 1. (true ? 1.0 : non_constant)
+ // 2. (non_constant, 1.0)
+ return folded;
+ }
+ return expression;
+}
+
+bool TParseContext::binaryOpCommonCheck(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc)
+{
+ // Check opaque types are not allowed to be operands in expressions other than array indexing
+ // and structure member selection.
+ if (IsOpaqueType(left->getBasicType()) || IsOpaqueType(right->getBasicType()))
+ {
+ switch (op)
+ {
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ break;
+
+ default:
+ ASSERT(op != EOpIndexDirectStruct);
+ error(loc, "Invalid operation for variables with an opaque type",
+ GetOperatorString(op));
+ return false;
+ }
+ }
+
+ if (right->getMemoryQualifier().writeonly)
+ {
+ error(loc, "Invalid operation for variables with writeonly", GetOperatorString(op));
+ return false;
+ }
+
+ if (left->getMemoryQualifier().writeonly)
+ {
+ switch (op)
+ {
+ case EOpAssign:
+ case EOpInitialize:
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock:
+ break;
+ default:
+ error(loc, "Invalid operation for variables with writeonly", GetOperatorString(op));
+ return false;
+ }
+ }
+
+ if (left->getType().getStruct() || right->getType().getStruct())
+ {
+ switch (op)
+ {
+ case EOpIndexDirectStruct:
+ ASSERT(left->getType().getStruct());
+ break;
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpAssign:
+ case EOpInitialize:
+ if (left->getType() != right->getType())
+ {
+ return false;
+ }
+ break;
+ default:
+ error(loc, "Invalid operation for structs", GetOperatorString(op));
+ return false;
+ }
+ }
+
+ if (left->isInterfaceBlock() || right->isInterfaceBlock())
+ {
+ switch (op)
+ {
+ case EOpIndexDirectInterfaceBlock:
+ ASSERT(left->getType().getInterfaceBlock());
+ break;
+ default:
+ error(loc, "Invalid operation for interface blocks", GetOperatorString(op));
+ return false;
+ }
+ }
+
+ if (left->isArray() != right->isArray())
+ {
+ error(loc, "array / non-array mismatch", GetOperatorString(op));
+ return false;
+ }
+
+ if (left->isArray())
+ {
+ ASSERT(right->isArray());
+ if (mShaderVersion < 300)
+ {
+ error(loc, "Invalid operation for arrays", GetOperatorString(op));
+ return false;
+ }
+
+ switch (op)
+ {
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpAssign:
+ case EOpInitialize:
+ break;
+ default:
+ error(loc, "Invalid operation for arrays", GetOperatorString(op));
+ return false;
+ }
+ // At this point, size of implicitly sized arrays should be resolved.
+ if (*left->getType().getArraySizes() != *right->getType().getArraySizes())
+ {
+ error(loc, "array size mismatch", GetOperatorString(op));
+ return false;
+ }
+ }
+
+ // Check ops which require integer / ivec parameters
+ bool isBitShift = false;
+ switch (op)
+ {
+ case EOpBitShiftLeft:
+ case EOpBitShiftRight:
+ case EOpBitShiftLeftAssign:
+ case EOpBitShiftRightAssign:
+ // Unsigned can be bit-shifted by signed and vice versa, but we need to
+ // check that the basic type is an integer type.
+ isBitShift = true;
+ if (!IsInteger(left->getBasicType()) || !IsInteger(right->getBasicType()))
+ {
+ return false;
+ }
+ break;
+ case EOpBitwiseAnd:
+ case EOpBitwiseXor:
+ case EOpBitwiseOr:
+ case EOpBitwiseAndAssign:
+ case EOpBitwiseXorAssign:
+ case EOpBitwiseOrAssign:
+ // It is enough to check the type of only one operand, since later it
+ // is checked that the operand types match.
+ if (!IsInteger(left->getBasicType()))
+ {
+ return false;
+ }
+ break;
+ default:
+ break;
+ }
+
+ ImplicitTypeConversion conversion = GetConversion(left->getBasicType(), right->getBasicType());
+
+ // Implicit type casting only supported for GL shaders
+ if (!isBitShift && conversion != ImplicitTypeConversion::Same &&
+ (!IsDesktopGLSpec(mShaderSpec) || !IsValidImplicitConversion(conversion, op)))
+ {
+ return false;
+ }
+
+ // Check that:
+ // 1. Type sizes match exactly on ops that require that.
+ // 2. Restrictions for structs that contain arrays or samplers are respected.
+ // 3. Arithmetic op type dimensionality restrictions for ops other than multiply are respected.
+ switch (op)
+ {
+ case EOpAssign:
+ case EOpInitialize:
+ case EOpEqual:
+ case EOpNotEqual:
+ // ESSL 1.00 sections 5.7, 5.8, 5.9
+ if (mShaderVersion < 300 && left->getType().isStructureContainingArrays())
+ {
+ error(loc, "undefined operation for structs containing arrays",
+ GetOperatorString(op));
+ return false;
+ }
+ // Samplers as l-values are disallowed also in ESSL 3.00, see section 4.1.7,
+ // we interpret the spec so that this extends to structs containing samplers,
+ // similarly to ESSL 1.00 spec.
+ if ((mShaderVersion < 300 || op == EOpAssign || op == EOpInitialize) &&
+ left->getType().isStructureContainingSamplers())
+ {
+ error(loc, "undefined operation for structs containing samplers",
+ GetOperatorString(op));
+ return false;
+ }
+
+ if ((left->getNominalSize() != right->getNominalSize()) ||
+ (left->getSecondarySize() != right->getSecondarySize()))
+ {
+ error(loc, "dimension mismatch", GetOperatorString(op));
+ return false;
+ }
+ break;
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ if (!left->isScalar() || !right->isScalar())
+ {
+ error(loc, "comparison operator only defined for scalars", GetOperatorString(op));
+ return false;
+ }
+ break;
+ case EOpAdd:
+ case EOpSub:
+ case EOpDiv:
+ case EOpIMod:
+ case EOpBitShiftLeft:
+ case EOpBitShiftRight:
+ case EOpBitwiseAnd:
+ case EOpBitwiseXor:
+ case EOpBitwiseOr:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpDivAssign:
+ case EOpIModAssign:
+ case EOpBitShiftLeftAssign:
+ case EOpBitShiftRightAssign:
+ case EOpBitwiseAndAssign:
+ case EOpBitwiseXorAssign:
+ case EOpBitwiseOrAssign:
+ if ((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 sizes of operands do not match:
+ // One of them must be a scalar.
+ if (!left->isScalar() && !right->isScalar())
+ return false;
+
+ // In the case of compound assignment other than multiply-assign,
+ // the right side needs to be a scalar. Otherwise a vector/matrix
+ // would be assigned to a scalar. A scalar can't be shifted by a
+ // vector either.
+ if (!right->isScalar() &&
+ (IsAssignment(op) || op == EOpBitShiftLeft || op == EOpBitShiftRight))
+ return false;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return true;
+}
+
+bool TParseContext::isMultiplicationTypeCombinationValid(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:
+ return true;
+ case EOpVectorTimesScalarAssign:
+ ASSERT(!left.isMatrix() && !right.isMatrix());
+ return left.isVector() && !right.isVector();
+ case EOpVectorTimesMatrix:
+ return left.getNominalSize() == right.getRows();
+ case EOpVectorTimesMatrixAssign:
+ ASSERT(!left.isMatrix() && right.isMatrix());
+ return left.isVector() && left.getNominalSize() == right.getRows() &&
+ left.getNominalSize() == right.getCols();
+ case EOpMatrixTimesVector:
+ return left.getCols() == right.getNominalSize();
+ case EOpMatrixTimesScalar:
+ return true;
+ case EOpMatrixTimesScalarAssign:
+ ASSERT(left.isMatrix() && !right.isMatrix());
+ return !right.isVector();
+ case EOpMatrixTimesMatrix:
+ return left.getCols() == right.getRows();
+ case EOpMatrixTimesMatrixAssign:
+ ASSERT(left.isMatrix() && right.isMatrix());
+ // We need to check two things:
+ // 1. The matrix multiplication step is valid.
+ // 2. The result will have the same number of columns as the lvalue.
+ return left.getCols() == right.getRows() && left.getCols() == right.getCols();
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+TIntermTyped *TParseContext::addBinaryMathInternal(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc)
+{
+ if (!binaryOpCommonCheck(op, left, right, loc))
+ return nullptr;
+
+ switch (op)
+ {
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ break;
+ case EOpLogicalOr:
+ case EOpLogicalXor:
+ case EOpLogicalAnd:
+ ASSERT(!left->isArray() && !right->isArray() && !left->getType().getStruct() &&
+ !right->getType().getStruct());
+ if (left->getBasicType() != EbtBool || !left->isScalar() || !right->isScalar())
+ {
+ return nullptr;
+ }
+ // Basic types matching should have been already checked.
+ ASSERT(right->getBasicType() == EbtBool);
+ break;
+ case EOpAdd:
+ case EOpSub:
+ case EOpDiv:
+ case EOpMul:
+ ASSERT(!left->isArray() && !right->isArray() && !left->getType().getStruct() &&
+ !right->getType().getStruct());
+ if (left->getBasicType() == EbtBool)
+ {
+ return nullptr;
+ }
+ break;
+ case EOpIMod:
+ ASSERT(!left->isArray() && !right->isArray() && !left->getType().getStruct() &&
+ !right->getType().getStruct());
+ // Note that this is only for the % operator, not for mod()
+ if (left->getBasicType() == EbtBool || left->getBasicType() == EbtFloat)
+ {
+ return nullptr;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (op == EOpMul)
+ {
+ op = TIntermBinary::GetMulOpBasedOnOperands(left->getType(), right->getType());
+ if (!isMultiplicationTypeCombinationValid(op, left->getType(), right->getType()))
+ {
+ return nullptr;
+ }
+ }
+
+ TIntermBinary *node = new TIntermBinary(op, left, right);
+ ASSERT(op != EOpAssign);
+ markStaticReadIfSymbol(left);
+ markStaticReadIfSymbol(right);
+ node->setLine(loc);
+ return expressionOrFoldedResult(node);
+}
+
+TIntermTyped *TParseContext::addBinaryMath(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc)
+{
+ TIntermTyped *node = addBinaryMathInternal(op, left, right, loc);
+ if (node == 0)
+ {
+ binaryOpError(loc, GetOperatorString(op), left->getType(), right->getType());
+ return left;
+ }
+ return node;
+}
+
+TIntermTyped *TParseContext::addBinaryMathBooleanResult(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc)
+{
+ TIntermTyped *node = addBinaryMathInternal(op, left, right, loc);
+ if (node == nullptr)
+ {
+ binaryOpError(loc, GetOperatorString(op), left->getType(), right->getType());
+ node = CreateBoolNode(false);
+ node->setLine(loc);
+ }
+ return node;
+}
+
+TIntermTyped *TParseContext::addAssign(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc)
+{
+ checkCanBeLValue(loc, "assign", left);
+ TIntermBinary *node = nullptr;
+ if (binaryOpCommonCheck(op, left, right, loc))
+ {
+ if (op == EOpMulAssign)
+ {
+ op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType());
+ if (isMultiplicationTypeCombinationValid(op, left->getType(), right->getType()))
+ {
+ node = new TIntermBinary(op, left, right);
+ }
+ }
+ else
+ {
+ node = new TIntermBinary(op, left, right);
+ }
+ }
+ if (node == nullptr)
+ {
+ assignError(loc, "assign", left->getType(), right->getType());
+ return left;
+ }
+ if (op != EOpAssign)
+ {
+ markStaticReadIfSymbol(left);
+ }
+ markStaticReadIfSymbol(right);
+ node->setLine(loc);
+ return node;
+}
+
+TIntermTyped *TParseContext::addComma(TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc)
+{
+ // WebGL2 section 5.26, the following results in an error:
+ // "Sequence operator applied to void, arrays, or structs containing arrays"
+ if (mShaderSpec == SH_WEBGL2_SPEC &&
+ (left->isArray() || left->getBasicType() == EbtVoid ||
+ left->getType().isStructureContainingArrays() || right->isArray() ||
+ right->getBasicType() == EbtVoid || right->getType().isStructureContainingArrays()))
+ {
+ error(loc,
+ "sequence operator is not allowed for void, arrays, or structs containing arrays",
+ ",");
+ }
+
+ TIntermBinary *commaNode = TIntermBinary::CreateComma(left, right, mShaderVersion);
+ markStaticReadIfSymbol(left);
+ markStaticReadIfSymbol(right);
+ commaNode->setLine(loc);
+
+ return expressionOrFoldedResult(commaNode);
+}
+
+TIntermBranch *TParseContext::addBranch(TOperator op, const TSourceLoc &loc)
+{
+ switch (op)
+ {
+ case EOpContinue:
+ if (mLoopNestingLevel <= 0)
+ {
+ error(loc, "continue statement only allowed in loops", "");
+ }
+ break;
+ case EOpBreak:
+ if (mLoopNestingLevel <= 0 && mSwitchNestingLevel <= 0)
+ {
+ error(loc, "break statement only allowed in loops and switch statements", "");
+ }
+ break;
+ case EOpReturn:
+ if (mCurrentFunctionType->getBasicType() != EbtVoid)
+ {
+ error(loc, "non-void function must return a value", "return");
+ }
+ break;
+ case EOpKill:
+ if (mShaderType != GL_FRAGMENT_SHADER)
+ {
+ error(loc, "discard supported in fragment shaders only", "discard");
+ }
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ return addBranch(op, nullptr, loc);
+}
+
+TIntermBranch *TParseContext::addBranch(TOperator op,
+ TIntermTyped *expression,
+ const TSourceLoc &loc)
+{
+ if (expression != nullptr)
+ {
+ markStaticReadIfSymbol(expression);
+ ASSERT(op == EOpReturn);
+ mFunctionReturnsValue = true;
+ if (mCurrentFunctionType->getBasicType() == EbtVoid)
+ {
+ error(loc, "void function cannot return a value", "return");
+ }
+ else if (*mCurrentFunctionType != expression->getType())
+ {
+ error(loc, "function return is not matching type:", "return");
+ }
+ }
+ TIntermBranch *node = new TIntermBranch(op, expression);
+ node->setLine(loc);
+ return node;
+}
+
+void TParseContext::appendStatement(TIntermBlock *block, TIntermNode *statement)
+{
+ if (statement != nullptr)
+ {
+ markStaticReadIfSymbol(statement);
+ block->appendStatement(statement);
+ }
+}
+
+void TParseContext::checkTextureGather(TIntermAggregate *functionCall)
+{
+ ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
+ const TFunction *func = functionCall->getFunction();
+ if (BuiltInGroup::isTextureGather(func))
+ {
+ bool isTextureGatherOffset = BuiltInGroup::isTextureGatherOffset(func);
+ TIntermNode *componentNode = nullptr;
+ TIntermSequence *arguments = functionCall->getSequence();
+ ASSERT(arguments->size() >= 2u && arguments->size() <= 4u);
+ const TIntermTyped *sampler = arguments->front()->getAsTyped();
+ ASSERT(sampler != nullptr);
+ switch (sampler->getBasicType())
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ if ((!isTextureGatherOffset && arguments->size() == 3u) ||
+ (isTextureGatherOffset && arguments->size() == 4u))
+ {
+ componentNode = arguments->back();
+ }
+ break;
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ ASSERT(!isTextureGatherOffset);
+ if (arguments->size() == 3u)
+ {
+ componentNode = arguments->back();
+ }
+ break;
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ case EbtSamplerCubeShadow:
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ if (componentNode)
+ {
+ const TIntermConstantUnion *componentConstantUnion =
+ componentNode->getAsConstantUnion();
+ if (componentNode->getAsTyped()->getQualifier() != EvqConst || !componentConstantUnion)
+ {
+ error(functionCall->getLine(), "Texture component must be a constant expression",
+ func->name());
+ }
+ else
+ {
+ int component = componentConstantUnion->getIConst(0);
+ if (component < 0 || component > 3)
+ {
+ error(functionCall->getLine(), "Component must be in the range [0;3]",
+ func->name());
+ }
+ }
+ }
+ }
+}
+
+void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall)
+{
+ ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
+ const TFunction *func = functionCall->getFunction();
+ TIntermNode *offset = nullptr;
+ TIntermSequence *arguments = functionCall->getSequence();
+ bool useTextureGatherOffsetConstraints = false;
+ if (BuiltInGroup::isTextureOffsetNoBias(func))
+ {
+ offset = arguments->back();
+ }
+ else if (BuiltInGroup::isTextureOffsetBias(func))
+ {
+ // A bias parameter follows the offset parameter.
+ ASSERT(arguments->size() >= 3);
+ offset = (*arguments)[2];
+ }
+ else if (BuiltInGroup::isTextureGatherOffset(func))
+ {
+ ASSERT(arguments->size() >= 3u);
+ const TIntermTyped *sampler = arguments->front()->getAsTyped();
+ ASSERT(sampler != nullptr);
+ switch (sampler->getBasicType())
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ offset = (*arguments)[2];
+ break;
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ offset = (*arguments)[3];
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ useTextureGatherOffsetConstraints = true;
+ }
+ if (offset != nullptr)
+ {
+ TIntermConstantUnion *offsetConstantUnion = offset->getAsConstantUnion();
+ if (offset->getAsTyped()->getQualifier() != EvqConst || !offsetConstantUnion)
+ {
+ error(functionCall->getLine(), "Texture offset must be a constant expression",
+ func->name());
+ }
+ else
+ {
+ ASSERT(offsetConstantUnion->getBasicType() == EbtInt);
+ size_t size = offsetConstantUnion->getType().getObjectSize();
+ const TConstantUnion *values = offsetConstantUnion->getConstantValue();
+ int minOffsetValue = useTextureGatherOffsetConstraints ? mMinProgramTextureGatherOffset
+ : mMinProgramTexelOffset;
+ int maxOffsetValue = useTextureGatherOffsetConstraints ? mMaxProgramTextureGatherOffset
+ : mMaxProgramTexelOffset;
+ for (size_t i = 0u; i < size; ++i)
+ {
+ int offsetValue = values[i].getIConst();
+ if (offsetValue > maxOffsetValue || offsetValue < minOffsetValue)
+ {
+ std::stringstream tokenStream = sh::InitializeStream<std::stringstream>();
+ tokenStream << offsetValue;
+ std::string token = tokenStream.str();
+ error(offset->getLine(), "Texture offset value out of valid range",
+ token.c_str());
+ }
+ }
+ }
+ }
+}
+
+void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *functionCall)
+{
+ const TFunction *func = functionCall->getFunction();
+ if (BuiltInGroup::isAtomicMemory(func))
+ {
+ ASSERT(IsAtomicFunction(functionCall->getOp()));
+ TIntermSequence *arguments = functionCall->getSequence();
+ TIntermTyped *memNode = (*arguments)[0]->getAsTyped();
+
+ if (IsBufferOrSharedVariable(memNode))
+ {
+ return;
+ }
+
+ while (memNode->getAsBinaryNode())
+ {
+ memNode = memNode->getAsBinaryNode()->getLeft();
+ if (IsBufferOrSharedVariable(memNode))
+ {
+ return;
+ }
+ }
+
+ error(memNode->getLine(),
+ "The value passed to the mem argument of an atomic memory function does not "
+ "correspond to a buffer or shared variable.",
+ func->name());
+ }
+}
+
+// GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
+void TParseContext::checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate *functionCall)
+{
+ ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
+
+ const TFunction *func = functionCall->getFunction();
+
+ if (BuiltInGroup::isImage(func))
+ {
+ TIntermSequence *arguments = functionCall->getSequence();
+ TIntermTyped *imageNode = (*arguments)[0]->getAsTyped();
+
+ const TMemoryQualifier &memoryQualifier = imageNode->getMemoryQualifier();
+
+ if (BuiltInGroup::isImageStore(func))
+ {
+ if (memoryQualifier.readonly)
+ {
+ error(imageNode->getLine(),
+ "'imageStore' cannot be used with images qualified as 'readonly'",
+ GetImageArgumentToken(imageNode));
+ }
+ }
+ else if (BuiltInGroup::isImageLoad(func))
+ {
+ if (memoryQualifier.writeonly)
+ {
+ error(imageNode->getLine(),
+ "'imageLoad' cannot be used with images qualified as 'writeonly'",
+ GetImageArgumentToken(imageNode));
+ }
+ }
+ }
+}
+
+// GLSL ES 3.10 Revision 4, 13.51 Matching of Memory Qualifiers in Function Parameters
+void TParseContext::checkImageMemoryAccessForUserDefinedFunctions(
+ const TFunction *functionDefinition,
+ const TIntermAggregate *functionCall)
+{
+ ASSERT(functionCall->getOp() == EOpCallFunctionInAST);
+
+ const TIntermSequence &arguments = *functionCall->getSequence();
+
+ ASSERT(functionDefinition->getParamCount() == arguments.size());
+
+ for (size_t i = 0; i < arguments.size(); ++i)
+ {
+ TIntermTyped *typedArgument = arguments[i]->getAsTyped();
+ const TType &functionArgumentType = typedArgument->getType();
+ const TType &functionParameterType = functionDefinition->getParam(i)->getType();
+ ASSERT(functionArgumentType.getBasicType() == functionParameterType.getBasicType());
+
+ if (IsImage(functionArgumentType.getBasicType()))
+ {
+ const TMemoryQualifier &functionArgumentMemoryQualifier =
+ functionArgumentType.getMemoryQualifier();
+ const TMemoryQualifier &functionParameterMemoryQualifier =
+ functionParameterType.getMemoryQualifier();
+ if (functionArgumentMemoryQualifier.readonly &&
+ !functionParameterMemoryQualifier.readonly)
+ {
+ error(functionCall->getLine(),
+ "Function call discards the 'readonly' qualifier from image",
+ GetImageArgumentToken(typedArgument));
+ }
+
+ if (functionArgumentMemoryQualifier.writeonly &&
+ !functionParameterMemoryQualifier.writeonly)
+ {
+ error(functionCall->getLine(),
+ "Function call discards the 'writeonly' qualifier from image",
+ GetImageArgumentToken(typedArgument));
+ }
+
+ if (functionArgumentMemoryQualifier.coherent &&
+ !functionParameterMemoryQualifier.coherent)
+ {
+ error(functionCall->getLine(),
+ "Function call discards the 'coherent' qualifier from image",
+ GetImageArgumentToken(typedArgument));
+ }
+
+ if (functionArgumentMemoryQualifier.volatileQualifier &&
+ !functionParameterMemoryQualifier.volatileQualifier)
+ {
+ error(functionCall->getLine(),
+ "Function call discards the 'volatile' qualifier from image",
+ GetImageArgumentToken(typedArgument));
+ }
+ }
+ }
+}
+
+TIntermTyped *TParseContext::addFunctionCallOrMethod(TFunctionLookup *fnCall, const TSourceLoc &loc)
+{
+ if (fnCall->thisNode() != nullptr)
+ {
+ return addMethod(fnCall, loc);
+ }
+ if (fnCall->isConstructor())
+ {
+ return addConstructor(fnCall, loc);
+ }
+ return addNonConstructorFunctionCall(fnCall, loc);
+}
+
+TIntermTyped *TParseContext::addMethod(TFunctionLookup *fnCall, const TSourceLoc &loc)
+{
+ TIntermTyped *thisNode = fnCall->thisNode();
+ // It's possible for the name pointer in the TFunction to be null in case it gets parsed as
+ // a constructor. But such a TFunction can't reach here, since the lexer goes into FIELDS
+ // mode after a dot, which makes type identifiers to be parsed as FIELD_SELECTION instead.
+ // So accessing fnCall->name() below is safe.
+ if (fnCall->name() != "length")
+ {
+ error(loc, "invalid method", fnCall->name());
+ }
+ else if (!fnCall->arguments().empty())
+ {
+ error(loc, "method takes no parameters", "length");
+ }
+ else if (!thisNode->isArray())
+ {
+ error(loc, "length can only be called on arrays", "length");
+ }
+ else if (thisNode->getQualifier() == EvqPerVertexIn &&
+ mGeometryShaderInputPrimitiveType == EptUndefined)
+ {
+ ASSERT(mShaderType == GL_GEOMETRY_SHADER_EXT);
+ error(loc, "missing input primitive declaration before calling length on gl_in", "length");
+ }
+ else
+ {
+ TIntermUnary *node = new TIntermUnary(EOpArrayLength, thisNode, nullptr);
+ markStaticReadIfSymbol(thisNode);
+ node->setLine(loc);
+ return node->fold(mDiagnostics);
+ }
+ return CreateZeroNode(TType(EbtInt, EbpUndefined, EvqConst));
+}
+
+TIntermTyped *TParseContext::addNonConstructorFunctionCall(TFunctionLookup *fnCall,
+ const TSourceLoc &loc)
+{
+ // First check whether the function has been hidden by a variable name or struct typename by
+ // using the symbol looked up in the lexical phase. If the function is not hidden, look for one
+ // with a matching argument list.
+ if (fnCall->symbol() != nullptr && !fnCall->symbol()->isFunction())
+ {
+ error(loc, "function name expected", fnCall->name());
+ }
+ else
+ {
+ // There are no inner functions, so it's enough to look for user-defined functions in the
+ // global scope.
+ const TSymbol *symbol = symbolTable.findGlobal(fnCall->getMangledName());
+
+ if (symbol == nullptr && IsDesktopGLSpec(mShaderSpec))
+ {
+ // If using Desktop GL spec, need to check for implicit conversion
+ symbol = symbolTable.findGlobalWithConversion(
+ fnCall->getMangledNamesForImplicitConversions());
+ }
+
+ if (symbol != nullptr)
+ {
+ // A user-defined function - could be an overloaded built-in as well.
+ ASSERT(symbol->symbolType() == SymbolType::UserDefined);
+ const TFunction *fnCandidate = static_cast<const TFunction *>(symbol);
+ TIntermAggregate *callNode =
+ TIntermAggregate::CreateFunctionCall(*fnCandidate, &fnCall->arguments());
+ callNode->setLine(loc);
+ checkImageMemoryAccessForUserDefinedFunctions(fnCandidate, callNode);
+ functionCallRValueLValueErrorCheck(fnCandidate, callNode);
+ return callNode;
+ }
+
+ symbol = symbolTable.findBuiltIn(fnCall->getMangledName(), mShaderVersion);
+
+ if (symbol == nullptr && IsDesktopGLSpec(mShaderSpec))
+ {
+ // If using Desktop GL spec, need to check for implicit conversion
+ symbol = symbolTable.findBuiltInWithConversion(
+ fnCall->getMangledNamesForImplicitConversions(), mShaderVersion);
+ }
+
+ if (symbol != nullptr)
+ {
+ // A built-in function.
+ ASSERT(symbol->symbolType() == SymbolType::BuiltIn);
+ const TFunction *fnCandidate = static_cast<const TFunction *>(symbol);
+
+ if (fnCandidate->extension() != TExtension::UNDEFINED)
+ {
+ checkCanUseExtension(loc, fnCandidate->extension());
+ }
+ TOperator op = fnCandidate->getBuiltInOp();
+ if (op != EOpCallBuiltInFunction)
+ {
+ // A function call mapped to a built-in operation.
+ if (fnCandidate->getParamCount() == 1)
+ {
+ // Treat it like a built-in unary operator.
+ TIntermNode *unaryParamNode = fnCall->arguments().front();
+ TIntermTyped *callNode =
+ createUnaryMath(op, unaryParamNode->getAsTyped(), loc, fnCandidate);
+ ASSERT(callNode != nullptr);
+ return callNode;
+ }
+
+ TIntermAggregate *callNode =
+ TIntermAggregate::CreateBuiltInFunctionCall(*fnCandidate, &fnCall->arguments());
+ callNode->setLine(loc);
+
+ checkAtomicMemoryBuiltinFunctions(callNode);
+
+ // Some built-in functions have out parameters too.
+ functionCallRValueLValueErrorCheck(fnCandidate, callNode);
+
+ // See if we can constant fold a built-in. Note that this may be possible
+ // even if it is not const-qualified.
+ return callNode->fold(mDiagnostics);
+ }
+
+ // This is a built-in function with no op associated with it.
+ TIntermAggregate *callNode =
+ TIntermAggregate::CreateBuiltInFunctionCall(*fnCandidate, &fnCall->arguments());
+ callNode->setLine(loc);
+ checkTextureOffsetConst(callNode);
+ checkTextureGather(callNode);
+ checkImageMemoryAccessForBuiltinFunctions(callNode);
+ functionCallRValueLValueErrorCheck(fnCandidate, callNode);
+ return callNode;
+ }
+ else
+ {
+ error(loc, "no matching overloaded function found", fnCall->name());
+ }
+ }
+
+ // Error message was already written. Put on a dummy node for error recovery.
+ return CreateZeroNode(TType(EbtFloat, EbpMedium, EvqConst));
+}
+
+TIntermTyped *TParseContext::addTernarySelection(TIntermTyped *cond,
+ TIntermTyped *trueExpression,
+ TIntermTyped *falseExpression,
+ const TSourceLoc &loc)
+{
+ if (!checkIsScalarBool(loc, cond))
+ {
+ return falseExpression;
+ }
+
+ if (trueExpression->getType() != falseExpression->getType())
+ {
+ TInfoSinkBase reasonStream;
+ reasonStream << "mismatching ternary operator operand types '" << trueExpression->getType()
+ << " and '" << falseExpression->getType() << "'";
+ error(loc, reasonStream.c_str(), "?:");
+ return falseExpression;
+ }
+ if (IsOpaqueType(trueExpression->getBasicType()))
+ {
+ // ESSL 1.00 section 4.1.7
+ // ESSL 3.00.6 section 4.1.7
+ // Opaque/sampler types are not allowed in most types of expressions, including ternary.
+ // Note that structs containing opaque types don't need to be checked as structs are
+ // forbidden below.
+ error(loc, "ternary operator is not allowed for opaque types", "?:");
+ return falseExpression;
+ }
+
+ if (cond->getMemoryQualifier().writeonly || trueExpression->getMemoryQualifier().writeonly ||
+ falseExpression->getMemoryQualifier().writeonly)
+ {
+ error(loc, "ternary operator is not allowed for variables with writeonly", "?:");
+ return falseExpression;
+ }
+
+ // ESSL 1.00.17 sections 5.2 and 5.7:
+ // Ternary operator is not among the operators allowed for structures/arrays.
+ // ESSL 3.00.6 section 5.7:
+ // Ternary operator support is optional for arrays. No certainty that it works across all
+ // devices with struct either, so we err on the side of caution here. TODO (oetuaho@nvidia.com):
+ // Would be nice to make the spec and implementation agree completely here.
+ if (trueExpression->isArray() || trueExpression->getBasicType() == EbtStruct)
+ {
+ error(loc, "ternary operator is not allowed for structures or arrays", "?:");
+ return falseExpression;
+ }
+ if (trueExpression->getBasicType() == EbtInterfaceBlock)
+ {
+ error(loc, "ternary operator is not allowed for interface blocks", "?:");
+ return falseExpression;
+ }
+
+ // WebGL2 section 5.26, the following results in an error:
+ // "Ternary operator applied to void, arrays, or structs containing arrays"
+ if (mShaderSpec == SH_WEBGL2_SPEC && trueExpression->getBasicType() == EbtVoid)
+ {
+ error(loc, "ternary operator is not allowed for void", "?:");
+ return falseExpression;
+ }
+
+ TIntermTernary *node = new TIntermTernary(cond, trueExpression, falseExpression);
+ markStaticReadIfSymbol(cond);
+ markStaticReadIfSymbol(trueExpression);
+ markStaticReadIfSymbol(falseExpression);
+ node->setLine(loc);
+ return expressionOrFoldedResult(node);
+}
+
+//
+// Parse an array of strings using yyparse.
+//
+// Returns 0 for success.
+//
+int PaParseStrings(size_t count,
+ const char *const string[],
+ const int length[],
+ TParseContext *context)
+{
+ if ((count == 0) || (string == nullptr))
+ return 1;
+
+ if (glslang_initialize(context))
+ return 1;
+
+ int error = glslang_scan(count, string, length, context);
+ if (!error)
+ error = glslang_parse(context);
+
+ glslang_finalize(context);
+
+ return (error == 0) && (context->numErrors() == 0) ? 0 : 1;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ParseContext.h b/gfx/angle/checkout/src/compiler/translator/ParseContext.h
new file mode 100644
index 0000000000..22707d57aa
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ParseContext.h
@@ -0,0 +1,667 @@
+//
+// 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_PARSECONTEXT_H_
+#define COMPILER_TRANSLATOR_PARSECONTEXT_H_
+
+#include "compiler/preprocessor/Preprocessor.h"
+#include "compiler/translator/Compiler.h"
+#include "compiler/translator/Declarator.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/DirectiveHandler.h"
+#include "compiler/translator/FunctionLookup.h"
+#include "compiler/translator/QualifierTypes.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+struct TMatrixFields
+{
+ bool wholeRow;
+ bool wholeCol;
+ int row;
+ int col;
+};
+
+//
+// The following are extra variables needed during parsing, grouped together so
+// they can be passed to the parser without needing a global.
+//
+class TParseContext : angle::NonCopyable
+{
+ public:
+ TParseContext(TSymbolTable &symt,
+ TExtensionBehavior &ext,
+ sh::GLenum type,
+ ShShaderSpec spec,
+ ShCompileOptions options,
+ bool checksPrecErrors,
+ TDiagnostics *diagnostics,
+ const ShBuiltInResources &resources);
+ ~TParseContext();
+
+ bool anyMultiviewExtensionAvailable();
+ const angle::pp::Preprocessor &getPreprocessor() const { return mPreprocessor; }
+ angle::pp::Preprocessor &getPreprocessor() { return mPreprocessor; }
+ void *getScanner() const { return mScanner; }
+ void setScanner(void *scanner) { mScanner = scanner; }
+ int getShaderVersion() const { return mShaderVersion; }
+ sh::GLenum getShaderType() const { return mShaderType; }
+ ShShaderSpec getShaderSpec() const { return mShaderSpec; }
+ int numErrors() const { return mDiagnostics->numErrors(); }
+ void error(const TSourceLoc &loc, const char *reason, const char *token);
+ void error(const TSourceLoc &loc, const char *reason, const ImmutableString &token);
+ void warning(const TSourceLoc &loc, const char *reason, const char *token);
+
+ // If isError is false, a warning will be reported instead.
+ void outOfRangeError(bool isError,
+ const TSourceLoc &loc,
+ const char *reason,
+ const char *token);
+
+ TIntermBlock *getTreeRoot() const { return mTreeRoot; }
+ void setTreeRoot(TIntermBlock *treeRoot) { mTreeRoot = treeRoot; }
+
+ bool getFragmentPrecisionHigh() const
+ {
+ return mFragmentPrecisionHighOnESSL1 || mShaderVersion >= 300;
+ }
+ void setFragmentPrecisionHighOnESSL1(bool fragmentPrecisionHigh)
+ {
+ mFragmentPrecisionHighOnESSL1 = fragmentPrecisionHigh;
+ }
+
+ void setLoopNestingLevel(int loopNestintLevel) { mLoopNestingLevel = loopNestintLevel; }
+
+ void incrLoopNestingLevel() { ++mLoopNestingLevel; }
+ void decrLoopNestingLevel() { --mLoopNestingLevel; }
+
+ void incrSwitchNestingLevel() { ++mSwitchNestingLevel; }
+ void decrSwitchNestingLevel() { --mSwitchNestingLevel; }
+
+ bool isComputeShaderLocalSizeDeclared() const { return mComputeShaderLocalSizeDeclared; }
+ sh::WorkGroupSize getComputeShaderLocalSize() const;
+
+ int getNumViews() const { return mNumViews; }
+
+ void enterFunctionDeclaration() { mDeclaringFunction = true; }
+
+ void exitFunctionDeclaration() { mDeclaringFunction = false; }
+
+ bool declaringFunction() const { return mDeclaringFunction; }
+
+ TIntermConstantUnion *addScalarLiteral(const TConstantUnion *constantUnion,
+ const TSourceLoc &line);
+
+ // This method is guaranteed to succeed, even if no variable with 'name' exists.
+ const TVariable *getNamedVariable(const TSourceLoc &location,
+ const ImmutableString &name,
+ const TSymbol *symbol);
+ TIntermTyped *parseVariableIdentifier(const TSourceLoc &location,
+ const ImmutableString &name,
+ const TSymbol *symbol);
+
+ // Look at a '.' field selector string and change it into offsets for a vector.
+ bool parseVectorFields(const TSourceLoc &line,
+ const ImmutableString &compString,
+ int vecSize,
+ TVector<int> *fieldOffsets);
+
+ void assignError(const TSourceLoc &line, const char *op, const TType &left, const TType &right);
+ void unaryOpError(const TSourceLoc &line, const char *op, const TType &operand);
+ void binaryOpError(const TSourceLoc &line,
+ const char *op,
+ const TType &left,
+ const TType &right);
+
+ // Check functions - the ones that return bool return false if an error was generated.
+
+ bool checkIsNotReserved(const TSourceLoc &line, const ImmutableString &identifier);
+ void checkPrecisionSpecified(const TSourceLoc &line, TPrecision precision, TBasicType type);
+ bool checkCanBeLValue(const TSourceLoc &line, const char *op, TIntermTyped *node);
+ void checkIsConst(TIntermTyped *node);
+ void checkIsScalarInteger(TIntermTyped *node, const char *token);
+ bool checkIsAtGlobalLevel(const TSourceLoc &line, const char *token);
+ bool checkConstructorArguments(const TSourceLoc &line,
+ const TIntermSequence &arguments,
+ const TType &type);
+
+ // Returns a sanitized array size to use (the size is at least 1).
+ unsigned int checkIsValidArraySize(const TSourceLoc &line, TIntermTyped *expr);
+ bool checkIsValidQualifierForArray(const TSourceLoc &line, const TPublicType &elementQualifier);
+ bool checkArrayElementIsNotArray(const TSourceLoc &line, const TPublicType &elementType);
+ bool checkIsNonVoid(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ const TBasicType &type);
+ bool checkIsScalarBool(const TSourceLoc &line, const TIntermTyped *type);
+ void checkIsScalarBool(const TSourceLoc &line, const TPublicType &pType);
+ bool checkIsNotOpaqueType(const TSourceLoc &line,
+ const TTypeSpecifierNonArray &pType,
+ const char *reason);
+ void checkDeclaratorLocationIsNotSpecified(const TSourceLoc &line, const TPublicType &pType);
+ void checkLocationIsNotSpecified(const TSourceLoc &location,
+ const TLayoutQualifier &layoutQualifier);
+ void checkStd430IsForShaderStorageBlock(const TSourceLoc &location,
+ const TLayoutBlockStorage &blockStorage,
+ const TQualifier &qualifier);
+ void checkIsParameterQualifierValid(const TSourceLoc &line,
+ const TTypeQualifierBuilder &typeQualifierBuilder,
+ TType *type);
+
+ // Check if at least one of the specified extensions can be used, and generate error/warning as
+ // appropriate according to the spec.
+ // This function is only needed for a few different small constant sizes of extension array, and
+ // we want to avoid unnecessary dynamic allocations. That's why checkCanUseOneOfExtensions is a
+ // template function rather than one taking a vector.
+ template <size_t size>
+ bool checkCanUseOneOfExtensions(const TSourceLoc &line,
+ const std::array<TExtension, size> &extensions);
+ bool checkCanUseExtension(const TSourceLoc &line, TExtension extension);
+
+ // Done for all declarations, whether empty or not.
+ void declarationQualifierErrorCheck(const sh::TQualifier qualifier,
+ const sh::TLayoutQualifier &layoutQualifier,
+ const TSourceLoc &location);
+ // Done for the first non-empty declarator in a declaration.
+ void nonEmptyDeclarationErrorCheck(const TPublicType &publicType,
+ const TSourceLoc &identifierLocation);
+ // Done only for empty declarations.
+ void emptyDeclarationErrorCheck(const TType &type, const TSourceLoc &location);
+
+ void checkLayoutQualifierSupported(const TSourceLoc &location,
+ const ImmutableString &layoutQualifierName,
+ int versionRequired);
+ bool checkWorkGroupSizeIsNotSpecified(const TSourceLoc &location,
+ const TLayoutQualifier &layoutQualifier);
+ void functionCallRValueLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *fnCall);
+ void checkInvariantVariableQualifier(bool invariant,
+ const TQualifier qualifier,
+ const TSourceLoc &invariantLocation);
+ void checkInputOutputTypeIsValidES3(const TQualifier qualifier,
+ const TPublicType &type,
+ const TSourceLoc &qualifierLocation);
+ void checkLocalVariableConstStorageQualifier(const TQualifierWrapperBase &qualifier);
+ const TPragma &pragma() const { return mDirectiveHandler.pragma(); }
+ const TExtensionBehavior &extensionBehavior() const
+ {
+ return mDirectiveHandler.extensionBehavior();
+ }
+
+ bool isExtensionEnabled(TExtension extension) const;
+ void handleExtensionDirective(const TSourceLoc &loc, const char *extName, const char *behavior);
+ void handlePragmaDirective(const TSourceLoc &loc,
+ const char *name,
+ const char *value,
+ bool stdgl);
+
+ // Returns true on success. *initNode may still be nullptr on success in case the initialization
+ // is not needed in the AST.
+ bool executeInitializer(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ TType *type,
+ TIntermTyped *initializer,
+ TIntermBinary **initNode);
+ TIntermNode *addConditionInitializer(const TPublicType &pType,
+ const ImmutableString &identifier,
+ TIntermTyped *initializer,
+ const TSourceLoc &loc);
+ TIntermNode *addLoop(TLoopType type,
+ TIntermNode *init,
+ TIntermNode *cond,
+ TIntermTyped *expr,
+ TIntermNode *body,
+ const TSourceLoc &loc);
+
+ // For "if" test nodes. There are three children: a condition, a true path, and a false path.
+ // The two paths are in TIntermNodePair code.
+ TIntermNode *addIfElse(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &loc);
+
+ void addFullySpecifiedType(TPublicType *typeSpecifier);
+ TPublicType addFullySpecifiedType(const TTypeQualifierBuilder &typeQualifierBuilder,
+ const TPublicType &typeSpecifier);
+
+ TIntermDeclaration *parseSingleDeclaration(TPublicType &publicType,
+ const TSourceLoc &identifierOrTypeLocation,
+ const ImmutableString &identifier);
+ TIntermDeclaration *parseSingleArrayDeclaration(TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &indexLocation,
+ const TVector<unsigned int> &arraySizes);
+ TIntermDeclaration *parseSingleInitDeclaration(const TPublicType &publicType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer);
+
+ // Parse a declaration like "type a[n] = initializer"
+ // Note that this does not apply to declarations like "type[n] a = initializer"
+ TIntermDeclaration *parseSingleArrayInitDeclaration(TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &indexLocation,
+ const TVector<unsigned int> &arraySizes,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer);
+
+ TIntermInvariantDeclaration *parseInvariantDeclaration(
+ const TTypeQualifierBuilder &typeQualifierBuilder,
+ const TSourceLoc &identifierLoc,
+ const ImmutableString &identifier,
+ const TSymbol *symbol);
+
+ void parseDeclarator(TPublicType &publicType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ TIntermDeclaration *declarationOut);
+ void parseArrayDeclarator(TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &arrayLocation,
+ const TVector<unsigned int> &arraySizes,
+ TIntermDeclaration *declarationOut);
+ void parseInitDeclarator(const TPublicType &publicType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer,
+ TIntermDeclaration *declarationOut);
+
+ // Parse a declarator like "a[n] = initializer"
+ void parseArrayInitDeclarator(const TPublicType &elementType,
+ const TSourceLoc &identifierLocation,
+ const ImmutableString &identifier,
+ const TSourceLoc &indexLocation,
+ const TVector<unsigned int> &arraySizes,
+ const TSourceLoc &initLocation,
+ TIntermTyped *initializer,
+ TIntermDeclaration *declarationOut);
+
+ TIntermNode *addEmptyStatement(const TSourceLoc &location);
+
+ void parseDefaultPrecisionQualifier(const TPrecision precision,
+ const TPublicType &type,
+ const TSourceLoc &loc);
+ void parseGlobalLayoutQualifier(const TTypeQualifierBuilder &typeQualifierBuilder);
+
+ TIntermFunctionPrototype *addFunctionPrototypeDeclaration(const TFunction &parsedFunction,
+ const TSourceLoc &location);
+ TIntermFunctionDefinition *addFunctionDefinition(TIntermFunctionPrototype *functionPrototype,
+ TIntermBlock *functionBody,
+ const TSourceLoc &location);
+ void parseFunctionDefinitionHeader(const TSourceLoc &location,
+ const TFunction *function,
+ TIntermFunctionPrototype **prototypeOut);
+ TFunction *parseFunctionDeclarator(const TSourceLoc &location, TFunction *function);
+ TFunction *parseFunctionHeader(const TPublicType &type,
+ const ImmutableString &name,
+ const TSourceLoc &location);
+
+ TFunctionLookup *addNonConstructorFunc(const ImmutableString &name, const TSymbol *symbol);
+ TFunctionLookup *addConstructorFunc(const TPublicType &publicType);
+
+ TParameter parseParameterDeclarator(const TPublicType &publicType,
+ const ImmutableString &name,
+ const TSourceLoc &nameLoc);
+
+ TParameter parseParameterArrayDeclarator(const ImmutableString &name,
+ const TSourceLoc &nameLoc,
+ const TVector<unsigned int> &arraySizes,
+ const TSourceLoc &arrayLoc,
+ TPublicType *elementType);
+
+ TIntermTyped *addIndexExpression(TIntermTyped *baseExpression,
+ const TSourceLoc &location,
+ TIntermTyped *indexExpression);
+ TIntermTyped *addFieldSelectionExpression(TIntermTyped *baseExpression,
+ const TSourceLoc &dotLocation,
+ const ImmutableString &fieldString,
+ const TSourceLoc &fieldLocation);
+
+ // Parse declarator for a single field
+ TDeclarator *parseStructDeclarator(const ImmutableString &identifier, const TSourceLoc &loc);
+ TDeclarator *parseStructArrayDeclarator(const ImmutableString &identifier,
+ const TSourceLoc &loc,
+ const TVector<unsigned int> *arraySizes);
+
+ void checkDoesNotHaveDuplicateFieldName(const TFieldList::const_iterator begin,
+ const TFieldList::const_iterator end,
+ const ImmutableString &name,
+ const TSourceLoc &location);
+ TFieldList *addStructFieldList(TFieldList *fields, const TSourceLoc &location);
+ TFieldList *combineStructFieldLists(TFieldList *processedFields,
+ const TFieldList *newlyAddedFields,
+ const TSourceLoc &location);
+ TFieldList *addStructDeclaratorListWithQualifiers(
+ const TTypeQualifierBuilder &typeQualifierBuilder,
+ TPublicType *typeSpecifier,
+ const TDeclaratorList *declaratorList);
+ TFieldList *addStructDeclaratorList(const TPublicType &typeSpecifier,
+ const TDeclaratorList *declaratorList);
+ TTypeSpecifierNonArray addStructure(const TSourceLoc &structLine,
+ const TSourceLoc &nameLine,
+ const ImmutableString &structName,
+ TFieldList *fieldList);
+
+ TIntermDeclaration *addInterfaceBlock(const TTypeQualifierBuilder &typeQualifierBuilder,
+ const TSourceLoc &nameLine,
+ const ImmutableString &blockName,
+ TFieldList *fieldList,
+ const ImmutableString &instanceName,
+ const TSourceLoc &instanceLine,
+ TIntermTyped *arrayIndex,
+ const TSourceLoc &arrayIndexLine);
+
+ void parseLocalSize(const ImmutableString &qualifierType,
+ const TSourceLoc &qualifierTypeLine,
+ int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ size_t index,
+ sh::WorkGroupSize *localSize);
+ void parseNumViews(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *numViews);
+ void parseInvocations(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *numInvocations);
+ void parseMaxVertices(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *numMaxVertices);
+ void parseIndexLayoutQualifier(int intValue,
+ const TSourceLoc &intValueLine,
+ const std::string &intValueString,
+ int *index);
+ TLayoutQualifier parseLayoutQualifier(const ImmutableString &qualifierType,
+ const TSourceLoc &qualifierTypeLine);
+ TLayoutQualifier parseLayoutQualifier(const ImmutableString &qualifierType,
+ const TSourceLoc &qualifierTypeLine,
+ int intValue,
+ const TSourceLoc &intValueLine);
+ TTypeQualifierBuilder *createTypeQualifierBuilder(const TSourceLoc &loc);
+ TStorageQualifierWrapper *parseGlobalStorageQualifier(TQualifier qualifier,
+ const TSourceLoc &loc);
+ TStorageQualifierWrapper *parseVaryingQualifier(const TSourceLoc &loc);
+ TStorageQualifierWrapper *parseInQualifier(const TSourceLoc &loc);
+ TStorageQualifierWrapper *parseOutQualifier(const TSourceLoc &loc);
+ TStorageQualifierWrapper *parseInOutQualifier(const TSourceLoc &loc);
+ TLayoutQualifier joinLayoutQualifiers(TLayoutQualifier leftQualifier,
+ TLayoutQualifier rightQualifier,
+ const TSourceLoc &rightQualifierLocation);
+
+ // Performs an error check for embedded struct declarations.
+ void enterStructDeclaration(const TSourceLoc &line, const ImmutableString &identifier);
+ void exitStructDeclaration();
+
+ void checkIsBelowStructNestingLimit(const TSourceLoc &line, const TField &field);
+
+ TIntermSwitch *addSwitch(TIntermTyped *init,
+ TIntermBlock *statementList,
+ const TSourceLoc &loc);
+ TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &loc);
+ TIntermCase *addDefault(const TSourceLoc &loc);
+
+ TIntermTyped *addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc);
+ TIntermTyped *addUnaryMathLValue(TOperator op, TIntermTyped *child, const TSourceLoc &loc);
+ TIntermTyped *addBinaryMath(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc);
+ TIntermTyped *addBinaryMathBooleanResult(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc);
+ TIntermTyped *addAssign(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc);
+
+ TIntermTyped *addComma(TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
+
+ TIntermBranch *addBranch(TOperator op, const TSourceLoc &loc);
+ TIntermBranch *addBranch(TOperator op, TIntermTyped *expression, const TSourceLoc &loc);
+
+ void appendStatement(TIntermBlock *block, TIntermNode *statement);
+
+ void checkTextureGather(TIntermAggregate *functionCall);
+ void checkTextureOffsetConst(TIntermAggregate *functionCall);
+ void checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate *functionCall);
+ void checkImageMemoryAccessForUserDefinedFunctions(const TFunction *functionDefinition,
+ const TIntermAggregate *functionCall);
+ void checkAtomicMemoryBuiltinFunctions(TIntermAggregate *functionCall);
+
+ // fnCall is only storing the built-in op, and function name or constructor type. arguments
+ // has the arguments.
+ TIntermTyped *addFunctionCallOrMethod(TFunctionLookup *fnCall, const TSourceLoc &loc);
+
+ TIntermTyped *addTernarySelection(TIntermTyped *cond,
+ TIntermTyped *trueExpression,
+ TIntermTyped *falseExpression,
+ const TSourceLoc &line);
+
+ int getGeometryShaderMaxVertices() const { return mGeometryShaderMaxVertices; }
+ int getGeometryShaderInvocations() const
+ {
+ return (mGeometryShaderInvocations > 0) ? mGeometryShaderInvocations : 1;
+ }
+ TLayoutPrimitiveType getGeometryShaderInputPrimitiveType() const
+ {
+ return mGeometryShaderInputPrimitiveType;
+ }
+ TLayoutPrimitiveType getGeometryShaderOutputPrimitiveType() const
+ {
+ return mGeometryShaderOutputPrimitiveType;
+ }
+
+ // TODO(jmadill): make this private
+ TSymbolTable &symbolTable; // symbol table that goes with the language currently being parsed
+
+ private:
+ class AtomicCounterBindingState;
+ constexpr static size_t kAtomicCounterSize = 4;
+ // UNIFORM_ARRAY_STRIDE for atomic counter arrays is an implementation-dependent value which
+ // can be queried after a program is linked according to ES 3.10 section 7.7.1. This is
+ // controversial with the offset inheritance as described in ESSL 3.10 section 4.4.6. Currently
+ // we treat it as always 4 in favour of the original interpretation in
+ // "ARB_shader_atomic_counters".
+ // TODO(jie.a.chen@intel.com): Double check this once the spec vagueness is resolved.
+ // Note that there may be tests in AtomicCounter_test that will need to be updated as well.
+ constexpr static size_t kAtomicCounterArrayStride = 4;
+
+ void markStaticReadIfSymbol(TIntermNode *node);
+
+ // Returns a clamped index. If it prints out an error message, the token is "[]".
+ int checkIndexLessThan(bool outOfRangeIndexIsError,
+ const TSourceLoc &location,
+ int index,
+ int arraySize,
+ const char *reason);
+
+ bool declareVariable(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ const TType *type,
+ TVariable **variable);
+
+ void checkCanBeDeclaredWithoutInitializer(const TSourceLoc &line,
+ const ImmutableString &identifier,
+ TType *type);
+
+ TParameter parseParameterDeclarator(TType *type,
+ const ImmutableString &name,
+ const TSourceLoc &nameLoc);
+
+ bool checkIsValidTypeAndQualifierForArray(const TSourceLoc &indexLocation,
+ const TPublicType &elementType);
+ // Done for all atomic counter declarations, whether empty or not.
+ void atomicCounterQualifierErrorCheck(const TPublicType &publicType,
+ const TSourceLoc &location);
+
+ // Assumes that multiplication op has already been set based on the types.
+ bool isMultiplicationTypeCombinationValid(TOperator op, const TType &left, const TType &right);
+
+ void checkOutParameterIsNotOpaqueType(const TSourceLoc &line,
+ TQualifier qualifier,
+ const TType &type);
+
+ void checkInternalFormatIsNotSpecified(const TSourceLoc &location,
+ TLayoutImageInternalFormat internalFormat);
+ void checkMemoryQualifierIsNotSpecified(const TMemoryQualifier &memoryQualifier,
+ const TSourceLoc &location);
+ void checkAtomicCounterOffsetDoesNotOverlap(bool forceAppend,
+ const TSourceLoc &loc,
+ TType *type);
+ void checkAtomicCounterOffsetAlignment(const TSourceLoc &location, const TType &type);
+
+ void checkIndexIsNotSpecified(const TSourceLoc &location, int index);
+ void checkBindingIsValid(const TSourceLoc &identifierLocation, const TType &type);
+ void checkBindingIsNotSpecified(const TSourceLoc &location, int binding);
+ void checkOffsetIsNotSpecified(const TSourceLoc &location, int offset);
+ void checkImageBindingIsValid(const TSourceLoc &location,
+ int binding,
+ int arrayTotalElementCount);
+ void checkSamplerBindingIsValid(const TSourceLoc &location,
+ int binding,
+ int arrayTotalElementCount);
+ void checkBlockBindingIsValid(const TSourceLoc &location,
+ const TQualifier &qualifier,
+ int binding,
+ int arraySize);
+ void checkAtomicCounterBindingIsValid(const TSourceLoc &location, int binding);
+
+ void checkUniformLocationInRange(const TSourceLoc &location,
+ int objectLocationCount,
+ const TLayoutQualifier &layoutQualifier);
+
+ void checkYuvIsNotSpecified(const TSourceLoc &location, bool yuv);
+
+ bool checkUnsizedArrayConstructorArgumentDimensionality(const TIntermSequence &arguments,
+ TType type,
+ const TSourceLoc &line);
+
+ // Will set the size of the outermost array according to geometry shader input layout.
+ void checkGeometryShaderInputAndSetArraySize(const TSourceLoc &location,
+ const ImmutableString &token,
+ TType *type);
+
+ // Will size any unsized array type so unsized arrays won't need to be taken into account
+ // further along the line in parsing.
+ void checkIsNotUnsizedArray(const TSourceLoc &line,
+ const char *errorMessage,
+ const ImmutableString &token,
+ TType *arrayType);
+
+ TIntermTyped *addBinaryMathInternal(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc);
+ TIntermTyped *createUnaryMath(TOperator op,
+ TIntermTyped *child,
+ const TSourceLoc &loc,
+ const TFunction *func);
+
+ TIntermTyped *addMethod(TFunctionLookup *fnCall, const TSourceLoc &loc);
+ TIntermTyped *addConstructor(TFunctionLookup *fnCall, const TSourceLoc &line);
+ TIntermTyped *addNonConstructorFunctionCall(TFunctionLookup *fnCall, const TSourceLoc &loc);
+
+ // Return either the original expression or the folded version of the expression in case the
+ // folded node will validate the same way during subsequent parsing.
+ TIntermTyped *expressionOrFoldedResult(TIntermTyped *expression);
+
+ // Return true if the checks pass
+ bool binaryOpCommonCheck(TOperator op,
+ TIntermTyped *left,
+ TIntermTyped *right,
+ const TSourceLoc &loc);
+
+ TIntermFunctionPrototype *createPrototypeNodeFromFunction(const TFunction &function,
+ const TSourceLoc &location,
+ bool insertParametersToSymbolTable);
+
+ void setAtomicCounterBindingDefaultOffset(const TPublicType &declaration,
+ const TSourceLoc &location);
+
+ bool checkPrimitiveTypeMatchesTypeQualifier(const TTypeQualifier &typeQualifier);
+ bool parseGeometryShaderInputLayoutQualifier(const TTypeQualifier &typeQualifier);
+ bool parseGeometryShaderOutputLayoutQualifier(const TTypeQualifier &typeQualifier);
+ void setGeometryShaderInputArraySize(unsigned int inputArraySize, const TSourceLoc &line);
+
+ // Set to true when the last/current declarator list was started with an empty declaration. The
+ // non-empty declaration error check will need to be performed if the empty declaration is
+ // followed by a declarator.
+ bool mDeferredNonEmptyDeclarationErrorCheck;
+
+ sh::GLenum mShaderType; // vertex or fragment language (future: pack or unpack)
+ ShShaderSpec mShaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
+ ShCompileOptions mCompileOptions; // Options passed to TCompiler
+ int mShaderVersion;
+ TIntermBlock *mTreeRoot; // root of parse tree being created
+ int mLoopNestingLevel; // 0 if outside all loops
+ int mStructNestingLevel; // incremented while parsing a struct declaration
+ int mSwitchNestingLevel; // 0 if outside all switch statements
+ const TType
+ *mCurrentFunctionType; // the return type of the function that's currently being parsed
+ bool mFunctionReturnsValue; // true if a non-void function has a return
+ bool mChecksPrecisionErrors; // true if an error will be generated when a variable is declared
+ // without precision, explicit or implicit.
+ bool mFragmentPrecisionHighOnESSL1; // true if highp precision is supported when compiling
+ // ESSL1.
+ TLayoutMatrixPacking mDefaultUniformMatrixPacking;
+ TLayoutBlockStorage mDefaultUniformBlockStorage;
+ TLayoutMatrixPacking mDefaultBufferMatrixPacking;
+ TLayoutBlockStorage mDefaultBufferBlockStorage;
+ TString mHashErrMsg;
+ TDiagnostics *mDiagnostics;
+ TDirectiveHandler mDirectiveHandler;
+ angle::pp::Preprocessor mPreprocessor;
+ void *mScanner;
+ int mMinProgramTexelOffset;
+ int mMaxProgramTexelOffset;
+
+ int mMinProgramTextureGatherOffset;
+ int mMaxProgramTextureGatherOffset;
+
+ // keep track of local group size declared in layout. It should be declared only once.
+ bool mComputeShaderLocalSizeDeclared;
+ sh::WorkGroupSize mComputeShaderLocalSize;
+ // keep track of number of views declared in layout.
+ int mNumViews;
+ int mMaxNumViews;
+ int mMaxImageUnits;
+ int mMaxCombinedTextureImageUnits;
+ int mMaxUniformLocations;
+ int mMaxUniformBufferBindings;
+ int mMaxAtomicCounterBindings;
+ int mMaxShaderStorageBufferBindings;
+
+ // keeps track whether we are declaring / defining a function
+ bool mDeclaringFunction;
+
+ // Track the state of each atomic counter binding.
+ std::map<int, AtomicCounterBindingState> mAtomicCounterBindingStates;
+
+ // Track the geometry shader global parameters declared in layout.
+ TLayoutPrimitiveType mGeometryShaderInputPrimitiveType;
+ TLayoutPrimitiveType mGeometryShaderOutputPrimitiveType;
+ int mGeometryShaderInvocations;
+ int mGeometryShaderMaxVertices;
+ int mMaxGeometryShaderInvocations;
+ int mMaxGeometryShaderMaxVertices;
+
+ // Track when we add new scope for func body in ESSL 1.00 spec
+ bool mFunctionBodyNewScope;
+};
+
+int PaParseStrings(size_t count,
+ const char *const string[],
+ const int length[],
+ TParseContext *context);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_PARSECONTEXT_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ParseContext_autogen.h b/gfx/angle/checkout/src/compiler/translator/ParseContext_autogen.h
new file mode 100644
index 0000000000..8310be80b5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ParseContext_autogen.h
@@ -0,0 +1,66 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_builtin_symbols.py using data from builtin_variables.json and
+// builtin_function_declarations.txt.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ParseContext_autogen.h:
+// Helpers for built-in related checks.
+
+#ifndef COMPILER_TRANSLATOR_PARSECONTEXT_AUTOGEN_H_
+#define COMPILER_TRANSLATOR_PARSECONTEXT_AUTOGEN_H_
+
+namespace sh
+{
+
+namespace BuiltInGroup
+{
+
+bool isTextureOffsetNoBias(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 677 && id <= 746;
+}
+bool isTextureOffsetBias(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 747 && id <= 766;
+}
+bool isTextureGatherOffset(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 844 && id <= 857;
+}
+bool isTextureGather(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 820 && id <= 857;
+}
+bool isAtomicMemory(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 874 && id <= 891;
+}
+bool isImageLoad(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 916 && id <= 927;
+}
+bool isImageStore(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 928 && id <= 939;
+}
+bool isImage(const TFunction *func)
+{
+ int id = func->uniqueId().get();
+ return id >= 892 && id <= 939;
+}
+
+} // namespace BuiltInGroup
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_PARSECONTEXT_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/PoolAlloc.cpp b/gfx/angle/checkout/src/compiler/translator/PoolAlloc.cpp
new file mode 100644
index 0000000000..7a95658e7b
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/PoolAlloc.cpp
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/PoolAlloc.h"
+
+#include <assert.h>
+#include "common/tls.h"
+
+TLSIndex PoolIndex = TLS_INVALID_INDEX;
+
+bool InitializePoolIndex()
+{
+ assert(PoolIndex == TLS_INVALID_INDEX);
+
+ PoolIndex = CreateTLSIndex();
+ return PoolIndex != TLS_INVALID_INDEX;
+}
+
+void FreePoolIndex()
+{
+ assert(PoolIndex != TLS_INVALID_INDEX);
+
+ DestroyTLSIndex(PoolIndex);
+ PoolIndex = TLS_INVALID_INDEX;
+}
+
+angle::PoolAllocator *GetGlobalPoolAllocator()
+{
+ assert(PoolIndex != TLS_INVALID_INDEX);
+ return static_cast<angle::PoolAllocator *>(GetTLSValue(PoolIndex));
+}
+
+void SetGlobalPoolAllocator(angle::PoolAllocator *poolAllocator)
+{
+ assert(PoolIndex != TLS_INVALID_INDEX);
+ SetTLSValue(PoolIndex, poolAllocator);
+}
diff --git a/gfx/angle/checkout/src/compiler/translator/PoolAlloc.h b/gfx/angle/checkout/src/compiler/translator/PoolAlloc.h
new file mode 100644
index 0000000000..86980b43a1
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/PoolAlloc.h
@@ -0,0 +1,102 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_POOLALLOC_H_
+#define COMPILER_TRANSLATOR_POOLALLOC_H_
+
+//
+// This header defines the pool_allocator class that allows STL containers
+// to use the angle::PoolAllocator class by using the pool_allocator
+// class as the allocator (second) template argument.
+//
+// It also defines functions for managing the GlobalPoolAllocator used by the compiler.
+//
+
+#include <stddef.h>
+#include <string.h>
+#include <vector>
+
+#include "common/PoolAlloc.h"
+
+//
+// There could potentially be many pools with pops happening at
+// different times. But a simple use is to have a global pop
+// with everyone using the same global allocator.
+//
+extern angle::PoolAllocator *GetGlobalPoolAllocator();
+extern void SetGlobalPoolAllocator(angle::PoolAllocator *poolAllocator);
+
+//
+// This STL compatible allocator is intended to be used as the allocator
+// parameter to templatized STL containers, like vector and map.
+//
+// It will use the pools for allocation, and not
+// do any deallocation, but will still do destruction.
+//
+template <class T>
+class pool_allocator
+{
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef T *pointer;
+ typedef const T *const_pointer;
+ typedef T &reference;
+ typedef const T &const_reference;
+ typedef T value_type;
+
+ template <class Other>
+ struct rebind
+ {
+ typedef pool_allocator<Other> other;
+ };
+ pointer address(reference x) const { return &x; }
+ const_pointer address(const_reference x) const { return &x; }
+
+ pool_allocator() {}
+
+ template <class Other>
+ pool_allocator(const pool_allocator<Other> &p)
+ {}
+
+ template <class Other>
+ pool_allocator<T> &operator=(const pool_allocator<Other> &p)
+ {
+ return *this;
+ }
+
+#if defined(__SUNPRO_CC) && !defined(_RWSTD_ALLOCATOR)
+ // libCStd on some platforms have a different allocate/deallocate interface.
+ // Caller pre-bakes sizeof(T) into 'n' which is the number of bytes to be
+ // allocated, not the number of elements.
+ void *allocate(size_type n) { return getAllocator().allocate(n); }
+ void *allocate(size_type n, const void *) { return getAllocator().allocate(n); }
+ void deallocate(void *, size_type) {}
+#else
+ pointer allocate(size_type n)
+ {
+ return static_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
+ }
+ pointer allocate(size_type n, const void *)
+ {
+ return static_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
+ }
+ void deallocate(pointer, size_type) {}
+#endif // _RWSTD_ALLOCATOR
+
+ void construct(pointer p, const T &val) { new ((void *)p) T(val); }
+ void destroy(pointer p) { p->T::~T(); }
+
+ bool operator==(const pool_allocator &rhs) const { return true; }
+ bool operator!=(const pool_allocator &rhs) const { return false; }
+
+ size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); }
+ size_type max_size(int size) const { return static_cast<size_type>(-1) / size; }
+
+ angle::PoolAllocator &getAllocator() const { return *GetGlobalPoolAllocator(); }
+};
+
+#endif // COMPILER_TRANSLATOR_POOLALLOC_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Pragma.h b/gfx/angle/checkout/src/compiler/translator/Pragma.h
new file mode 100644
index 0000000000..8c419fc17e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Pragma.h
@@ -0,0 +1,31 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_PRAGMA_H_
+#define COMPILER_TRANSLATOR_PRAGMA_H_
+
+struct TPragma
+{
+ struct STDGL
+ {
+ STDGL() : invariantAll(false) {}
+
+ bool invariantAll;
+ };
+
+ // By default optimization is turned on and debug is turned off.
+ // Precision emulation is turned on by default, but has no effect unless
+ // the extension is enabled.
+ TPragma() : optimize(true), debug(false), debugShaderPrecision(true) {}
+ TPragma(bool o, bool d) : optimize(o), debug(d), debugShaderPrecision(true) {}
+
+ bool optimize;
+ bool debug;
+ bool debugShaderPrecision;
+ STDGL stdgl;
+};
+
+#endif // COMPILER_TRANSLATOR_PRAGMA_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/QualifierTypes.cpp b/gfx/angle/checkout/src/compiler/translator/QualifierTypes.cpp
new file mode 100644
index 0000000000..f9b4474b50
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/QualifierTypes.cpp
@@ -0,0 +1,829 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project 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/QualifierTypes.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+
+#include <algorithm>
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kSpecifiedMultipleTimes(" specified multiple times");
+constexpr const ImmutableString kInvariantMultipleTimes(
+ "The invariant qualifier specified multiple times.");
+constexpr const ImmutableString kPrecisionMultipleTimes(
+ "The precision qualifier specified multiple times.");
+constexpr const ImmutableString kLayoutMultipleTimes(
+ "The layout qualifier specified multiple times.");
+constexpr const ImmutableString kLayoutAndInvariantDisallowed(
+ "The layout qualifier and invariant qualifier cannot coexist in the same "
+ "declaration according to the grammar.");
+constexpr const ImmutableString kInterpolationMultipleTimes(
+ "The interpolation qualifier specified multiple times.");
+constexpr const ImmutableString kOutputLayoutMultipleTimes(
+ "Output layout location specified multiple times.");
+constexpr const ImmutableString kInvariantQualifierFirst(
+ "The invariant qualifier has to be first in the expression.");
+constexpr const ImmutableString kStorageAfterInterpolation(
+ "Storage qualifiers have to be after interpolation qualifiers.");
+constexpr const ImmutableString kPrecisionAfterInterpolation(
+ "Precision qualifiers have to be after interpolation qualifiers.");
+constexpr const ImmutableString kStorageAfterLayout(
+ "Storage qualifiers have to be after layout qualifiers.");
+constexpr const ImmutableString kPrecisionAfterLayout(
+ "Precision qualifiers have to be after layout qualifiers.");
+constexpr const ImmutableString kPrecisionAfterStorage(
+ "Precision qualifiers have to be after storage qualifiers.");
+constexpr const ImmutableString kPrecisionAfterMemory(
+ "Precision qualifiers have to be after memory qualifiers.");
+
+// GLSL ES 3.10 does not impose a strict order on type qualifiers and allows multiple layout
+// declarations.
+// GLSL ES 3.10 Revision 4, 4.10 Order of Qualification
+bool AreTypeQualifierChecksRelaxed(int shaderVersion)
+{
+ return shaderVersion >= 310;
+}
+
+bool IsScopeQualifier(TQualifier qualifier)
+{
+ return qualifier == EvqGlobal || qualifier == EvqTemporary;
+}
+
+bool IsScopeQualifierWrapper(const TQualifierWrapperBase *qualifier)
+{
+ if (qualifier->getType() != QtStorage)
+ return false;
+ const TStorageQualifierWrapper *storageQualifier =
+ static_cast<const TStorageQualifierWrapper *>(qualifier);
+ TQualifier q = storageQualifier->getQualifier();
+ return IsScopeQualifier(q);
+}
+
+// Returns true if the invariant for the qualifier sequence holds
+bool IsInvariantCorrect(const TTypeQualifierBuilder::QualifierSequence &qualifiers)
+{
+ // We should have at least one qualifier.
+ // The first qualifier always tells the scope.
+ return qualifiers.size() >= 1 && IsScopeQualifierWrapper(qualifiers[0]);
+}
+
+ImmutableString QualifierSpecifiedMultipleTimesErrorMessage(const ImmutableString &qualifierString)
+{
+ ImmutableStringBuilder errorMsg(qualifierString.length() + kSpecifiedMultipleTimes.length());
+ errorMsg << qualifierString << kSpecifiedMultipleTimes;
+ return errorMsg;
+}
+
+// Returns true if there are qualifiers which have been specified multiple times
+// If areQualifierChecksRelaxed is set to true, then layout qualifier repetition is allowed.
+bool HasRepeatingQualifiers(const TTypeQualifierBuilder::QualifierSequence &qualifiers,
+ bool areQualifierChecksRelaxed,
+ ImmutableString *errorMessage)
+{
+ bool invariantFound = false;
+ bool precisionFound = false;
+ bool layoutFound = false;
+ bool interpolationFound = false;
+
+ unsigned int locationsSpecified = 0;
+ bool isOut = false;
+
+ // The iteration starts from one since the first qualifier only reveals the scope of the
+ // expression. It is inserted first whenever the sequence gets created.
+ for (size_t i = 1; i < qualifiers.size(); ++i)
+ {
+ switch (qualifiers[i]->getType())
+ {
+ case QtInvariant:
+ {
+ if (invariantFound)
+ {
+ *errorMessage = kInvariantMultipleTimes;
+ return true;
+ }
+ invariantFound = true;
+ break;
+ }
+ case QtPrecision:
+ {
+ if (precisionFound)
+ {
+ *errorMessage = kPrecisionMultipleTimes;
+ return true;
+ }
+ precisionFound = true;
+ break;
+ }
+ case QtLayout:
+ {
+ if (layoutFound && !areQualifierChecksRelaxed)
+ {
+ *errorMessage = kLayoutMultipleTimes;
+ return true;
+ }
+ if (invariantFound && !areQualifierChecksRelaxed)
+ {
+ // This combination is not correct according to the syntax specified in the
+ // formal grammar in the ESSL 3.00 spec. In ESSL 3.10 the grammar does not have
+ // a similar restriction.
+ *errorMessage = kLayoutAndInvariantDisallowed;
+ return true;
+ }
+ layoutFound = true;
+ const TLayoutQualifier &currentQualifier =
+ static_cast<const TLayoutQualifierWrapper *>(qualifiers[i])->getQualifier();
+ locationsSpecified += currentQualifier.locationsSpecified;
+ break;
+ }
+ case QtInterpolation:
+ {
+ // 'centroid' is treated as a storage qualifier
+ // 'flat centroid' will be squashed to 'flat'
+ // 'smooth centroid' will be squashed to 'centroid'
+ if (interpolationFound)
+ {
+ *errorMessage = kInterpolationMultipleTimes;
+ return true;
+ }
+ interpolationFound = true;
+ break;
+ }
+ case QtStorage:
+ {
+ // Go over all of the storage qualifiers up until the current one and check for
+ // repetitions.
+ TQualifier currentQualifier =
+ static_cast<const TStorageQualifierWrapper *>(qualifiers[i])->getQualifier();
+ if (currentQualifier == EvqVertexOut || currentQualifier == EvqFragmentOut)
+ {
+ isOut = true;
+ }
+ for (size_t j = 1; j < i; ++j)
+ {
+ if (qualifiers[j]->getType() == QtStorage)
+ {
+ const TStorageQualifierWrapper *previousQualifierWrapper =
+ static_cast<const TStorageQualifierWrapper *>(qualifiers[j]);
+ TQualifier previousQualifier = previousQualifierWrapper->getQualifier();
+ if (currentQualifier == previousQualifier)
+ {
+ *errorMessage = QualifierSpecifiedMultipleTimesErrorMessage(
+ previousQualifierWrapper->getQualifierString());
+ return true;
+ }
+ }
+ }
+ break;
+ }
+ case QtMemory:
+ {
+ // Go over all of the memory qualifiers up until the current one and check for
+ // repetitions.
+ // Having both readonly and writeonly in a sequence is valid.
+ // GLSL ES 3.10 Revision 4, 4.9 Memory Access Qualifiers
+ TQualifier currentQualifier =
+ static_cast<const TMemoryQualifierWrapper *>(qualifiers[i])->getQualifier();
+ for (size_t j = 1; j < i; ++j)
+ {
+ if (qualifiers[j]->getType() == QtMemory)
+ {
+ const TMemoryQualifierWrapper *previousQualifierWrapper =
+ static_cast<const TMemoryQualifierWrapper *>(qualifiers[j]);
+ TQualifier previousQualifier = previousQualifierWrapper->getQualifier();
+ if (currentQualifier == previousQualifier)
+ {
+ *errorMessage = QualifierSpecifiedMultipleTimesErrorMessage(
+ previousQualifierWrapper->getQualifierString());
+ return true;
+ }
+ }
+ }
+ break;
+ }
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ if (locationsSpecified > 1 && isOut)
+ {
+ // GLSL ES 3.00.6 section 4.3.8.2 Output Layout Qualifiers
+ // GLSL ES 3.10 section 4.4.2 Output Layout Qualifiers
+ // "The qualifier may appear at most once within a declaration."
+ *errorMessage = kOutputLayoutMultipleTimes;
+ return true;
+ }
+
+ return false;
+}
+
+// GLSL ES 3.00_6, 4.7 Order of Qualification
+// The correct order of qualifiers is:
+// invariant-qualifier interpolation-qualifier storage-qualifier precision-qualifier
+// layout-qualifier has to be before storage-qualifier.
+bool AreQualifiersInOrder(const TTypeQualifierBuilder::QualifierSequence &qualifiers,
+ ImmutableString *errorMessage)
+{
+ bool foundInterpolation = false;
+ bool foundStorage = false;
+ bool foundPrecision = false;
+ for (size_t i = 1; i < qualifiers.size(); ++i)
+ {
+ switch (qualifiers[i]->getType())
+ {
+ case QtInvariant:
+ if (foundInterpolation || foundStorage || foundPrecision)
+ {
+ *errorMessage = kInvariantQualifierFirst;
+ return false;
+ }
+ break;
+ case QtInterpolation:
+ if (foundStorage)
+ {
+ *errorMessage = kStorageAfterInterpolation;
+ return false;
+ }
+ else if (foundPrecision)
+ {
+ *errorMessage = kPrecisionAfterInterpolation;
+ return false;
+ }
+ foundInterpolation = true;
+ break;
+ case QtLayout:
+ if (foundStorage)
+ {
+ *errorMessage = kStorageAfterLayout;
+ return false;
+ }
+ else if (foundPrecision)
+ {
+ *errorMessage = kPrecisionAfterLayout;
+ return false;
+ }
+ break;
+ case QtStorage:
+ if (foundPrecision)
+ {
+ *errorMessage = kPrecisionAfterStorage;
+ return false;
+ }
+ foundStorage = true;
+ break;
+ case QtMemory:
+ if (foundPrecision)
+ {
+ *errorMessage = kPrecisionAfterMemory;
+ return false;
+ }
+ break;
+ case QtPrecision:
+ foundPrecision = true;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ return true;
+}
+
+struct QualifierComparator
+{
+ bool operator()(const TQualifierWrapperBase *q1, const TQualifierWrapperBase *q2)
+ {
+ return q1->getRank() < q2->getRank();
+ }
+};
+
+void SortSequence(TTypeQualifierBuilder::QualifierSequence &qualifiers)
+{
+ // We need a stable sorting algorithm since the order of layout-qualifier declarations matter.
+ // The sorting starts from index 1, instead of 0, since the element at index 0 tells the scope
+ // and we always want it to be first.
+ std::stable_sort(qualifiers.begin() + 1, qualifiers.end(), QualifierComparator());
+}
+
+// Handles the joining of storage qualifiers for variables.
+bool JoinVariableStorageQualifier(TQualifier *joinedQualifier, TQualifier storageQualifier)
+{
+ switch (*joinedQualifier)
+ {
+ case EvqGlobal:
+ *joinedQualifier = storageQualifier;
+ break;
+ case EvqTemporary:
+ {
+ switch (storageQualifier)
+ {
+ case EvqConst:
+ *joinedQualifier = storageQualifier;
+ break;
+ default:
+ return false;
+ }
+ break;
+ }
+ case EvqSmooth:
+ {
+ switch (storageQualifier)
+ {
+ case EvqCentroid:
+ *joinedQualifier = EvqCentroid;
+ break;
+ case EvqVertexOut:
+ case EvqGeometryOut:
+ *joinedQualifier = EvqSmoothOut;
+ break;
+ case EvqFragmentIn:
+ case EvqGeometryIn:
+ *joinedQualifier = EvqSmoothIn;
+ break;
+ default:
+ return false;
+ }
+ break;
+ }
+ case EvqFlat:
+ {
+ switch (storageQualifier)
+ {
+ case EvqCentroid:
+ *joinedQualifier = EvqFlat;
+ break;
+ case EvqVertexOut:
+ case EvqGeometryOut:
+ *joinedQualifier = EvqFlatOut;
+ break;
+ case EvqFragmentIn:
+ case EvqGeometryIn:
+ *joinedQualifier = EvqFlatIn;
+ break;
+ default:
+ return false;
+ }
+ break;
+ }
+ case EvqCentroid:
+ {
+ switch (storageQualifier)
+ {
+ case EvqVertexOut:
+ case EvqGeometryOut:
+ *joinedQualifier = EvqCentroidOut;
+ break;
+ case EvqFragmentIn:
+ case EvqGeometryIn:
+ *joinedQualifier = EvqCentroidIn;
+ break;
+ default:
+ return false;
+ }
+ break;
+ }
+ default:
+ return false;
+ }
+ return true;
+}
+
+// Handles the joining of storage qualifiers for a parameter in a function.
+bool JoinParameterStorageQualifier(TQualifier *joinedQualifier, TQualifier storageQualifier)
+{
+ switch (*joinedQualifier)
+ {
+ case EvqTemporary:
+ *joinedQualifier = storageQualifier;
+ break;
+ case EvqConst:
+ {
+ switch (storageQualifier)
+ {
+ case EvqIn:
+ *joinedQualifier = EvqConstReadOnly;
+ break;
+ default:
+ return false;
+ }
+ break;
+ }
+ default:
+ return false;
+ }
+ return true;
+}
+
+bool JoinMemoryQualifier(TMemoryQualifier *joinedMemoryQualifier, TQualifier memoryQualifier)
+{
+ switch (memoryQualifier)
+ {
+ case EvqReadOnly:
+ joinedMemoryQualifier->readonly = true;
+ break;
+ case EvqWriteOnly:
+ joinedMemoryQualifier->writeonly = true;
+ break;
+ case EvqCoherent:
+ joinedMemoryQualifier->coherent = true;
+ break;
+ case EvqRestrict:
+ joinedMemoryQualifier->restrictQualifier = true;
+ break;
+ case EvqVolatile:
+ // Variables having the volatile qualifier are automatcally treated as coherent as well.
+ // GLSL ES 3.10, Revision 4, 4.9 Memory Access Qualifiers
+ joinedMemoryQualifier->volatileQualifier = true;
+ joinedMemoryQualifier->coherent = true;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return true;
+}
+
+TTypeQualifier GetVariableTypeQualifierFromSortedSequence(
+ const TTypeQualifierBuilder::QualifierSequence &sortedSequence,
+ TDiagnostics *diagnostics)
+{
+ TTypeQualifier typeQualifier(
+ static_cast<const TStorageQualifierWrapper *>(sortedSequence[0])->getQualifier(),
+ sortedSequence[0]->getLine());
+ for (size_t i = 1; i < sortedSequence.size(); ++i)
+ {
+ const TQualifierWrapperBase *qualifier = sortedSequence[i];
+ bool isQualifierValid = false;
+ switch (qualifier->getType())
+ {
+ case QtInvariant:
+ isQualifierValid = true;
+ typeQualifier.invariant = true;
+ break;
+ case QtInterpolation:
+ {
+ switch (typeQualifier.qualifier)
+ {
+ case EvqGlobal:
+ isQualifierValid = true;
+ typeQualifier.qualifier =
+ static_cast<const TInterpolationQualifierWrapper *>(qualifier)
+ ->getQualifier();
+ break;
+ default:
+ isQualifierValid = false;
+ }
+ break;
+ }
+ case QtLayout:
+ {
+ const TLayoutQualifierWrapper *layoutQualifierWrapper =
+ static_cast<const TLayoutQualifierWrapper *>(qualifier);
+ isQualifierValid = true;
+ typeQualifier.layoutQualifier = sh::JoinLayoutQualifiers(
+ typeQualifier.layoutQualifier, layoutQualifierWrapper->getQualifier(),
+ layoutQualifierWrapper->getLine(), diagnostics);
+ break;
+ }
+ case QtStorage:
+ isQualifierValid = JoinVariableStorageQualifier(
+ &typeQualifier.qualifier,
+ static_cast<const TStorageQualifierWrapper *>(qualifier)->getQualifier());
+ break;
+ case QtPrecision:
+ isQualifierValid = true;
+ typeQualifier.precision =
+ static_cast<const TPrecisionQualifierWrapper *>(qualifier)->getQualifier();
+ ASSERT(typeQualifier.precision != EbpUndefined);
+ break;
+ case QtMemory:
+ isQualifierValid = JoinMemoryQualifier(
+ &typeQualifier.memoryQualifier,
+ static_cast<const TMemoryQualifierWrapper *>(qualifier)->getQualifier());
+ break;
+ default:
+ UNREACHABLE();
+ }
+ if (!isQualifierValid)
+ {
+ const ImmutableString &qualifierString = qualifier->getQualifierString();
+ diagnostics->error(qualifier->getLine(), "invalid qualifier combination",
+ qualifierString.data());
+ break;
+ }
+ }
+ return typeQualifier;
+}
+
+TTypeQualifier GetParameterTypeQualifierFromSortedSequence(
+ const TTypeQualifierBuilder::QualifierSequence &sortedSequence,
+ TDiagnostics *diagnostics)
+{
+ TTypeQualifier typeQualifier(EvqTemporary, sortedSequence[0]->getLine());
+ for (size_t i = 1; i < sortedSequence.size(); ++i)
+ {
+ const TQualifierWrapperBase *qualifier = sortedSequence[i];
+ bool isQualifierValid = false;
+ switch (qualifier->getType())
+ {
+ case QtInvariant:
+ case QtInterpolation:
+ case QtLayout:
+ break;
+ case QtMemory:
+ isQualifierValid = JoinMemoryQualifier(
+ &typeQualifier.memoryQualifier,
+ static_cast<const TMemoryQualifierWrapper *>(qualifier)->getQualifier());
+ break;
+ case QtStorage:
+ isQualifierValid = JoinParameterStorageQualifier(
+ &typeQualifier.qualifier,
+ static_cast<const TStorageQualifierWrapper *>(qualifier)->getQualifier());
+ break;
+ case QtPrecision:
+ isQualifierValid = true;
+ typeQualifier.precision =
+ static_cast<const TPrecisionQualifierWrapper *>(qualifier)->getQualifier();
+ ASSERT(typeQualifier.precision != EbpUndefined);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ if (!isQualifierValid)
+ {
+ const ImmutableString &qualifierString = qualifier->getQualifierString();
+ diagnostics->error(qualifier->getLine(), "invalid parameter qualifier",
+ qualifierString.data());
+ break;
+ }
+ }
+
+ switch (typeQualifier.qualifier)
+ {
+ case EvqIn:
+ case EvqConstReadOnly: // const in
+ case EvqOut:
+ case EvqInOut:
+ break;
+ case EvqConst:
+ typeQualifier.qualifier = EvqConstReadOnly;
+ break;
+ case EvqTemporary:
+ // no qualifier has been specified, set it to EvqIn which is the default
+ typeQualifier.qualifier = EvqIn;
+ break;
+ default:
+ diagnostics->error(sortedSequence[0]->getLine(), "Invalid parameter qualifier ",
+ getQualifierString(typeQualifier.qualifier));
+ }
+ return typeQualifier;
+}
+} // namespace
+
+TLayoutQualifier JoinLayoutQualifiers(TLayoutQualifier leftQualifier,
+ TLayoutQualifier rightQualifier,
+ const TSourceLoc &rightQualifierLocation,
+ TDiagnostics *diagnostics)
+{
+ TLayoutQualifier joinedQualifier = leftQualifier;
+
+ if (rightQualifier.location != -1)
+ {
+ joinedQualifier.location = rightQualifier.location;
+ ++joinedQualifier.locationsSpecified;
+ }
+ if (rightQualifier.yuv != false)
+ {
+ joinedQualifier.yuv = rightQualifier.yuv;
+ }
+ if (rightQualifier.binding != -1)
+ {
+ joinedQualifier.binding = rightQualifier.binding;
+ }
+ if (rightQualifier.offset != -1)
+ {
+ joinedQualifier.offset = rightQualifier.offset;
+ }
+ if (rightQualifier.matrixPacking != EmpUnspecified)
+ {
+ joinedQualifier.matrixPacking = rightQualifier.matrixPacking;
+ }
+ if (rightQualifier.blockStorage != EbsUnspecified)
+ {
+ joinedQualifier.blockStorage = rightQualifier.blockStorage;
+ }
+
+ for (size_t i = 0u; i < rightQualifier.localSize.size(); ++i)
+ {
+ if (rightQualifier.localSize[i] != -1)
+ {
+ if (joinedQualifier.localSize[i] != -1 &&
+ joinedQualifier.localSize[i] != rightQualifier.localSize[i])
+ {
+ diagnostics->error(rightQualifierLocation,
+ "Cannot have multiple different work group size specifiers",
+ getWorkGroupSizeString(i));
+ }
+ joinedQualifier.localSize[i] = rightQualifier.localSize[i];
+ }
+ }
+
+ if (rightQualifier.numViews != -1)
+ {
+ joinedQualifier.numViews = rightQualifier.numViews;
+ }
+
+ if (rightQualifier.imageInternalFormat != EiifUnspecified)
+ {
+ joinedQualifier.imageInternalFormat = rightQualifier.imageInternalFormat;
+ }
+
+ if (rightQualifier.primitiveType != EptUndefined)
+ {
+ if (joinedQualifier.primitiveType != EptUndefined &&
+ joinedQualifier.primitiveType != rightQualifier.primitiveType)
+ {
+ diagnostics->error(rightQualifierLocation,
+ "Cannot have multiple different primitive specifiers",
+ getGeometryShaderPrimitiveTypeString(rightQualifier.primitiveType));
+ }
+ joinedQualifier.primitiveType = rightQualifier.primitiveType;
+ }
+
+ if (rightQualifier.invocations != 0)
+ {
+ if (joinedQualifier.invocations != 0 &&
+ joinedQualifier.invocations != rightQualifier.invocations)
+ {
+ diagnostics->error(rightQualifierLocation,
+ "Cannot have multiple different invocations specifiers",
+ "invocations");
+ }
+ joinedQualifier.invocations = rightQualifier.invocations;
+ }
+
+ if (rightQualifier.maxVertices != -1)
+ {
+ if (joinedQualifier.maxVertices != -1 &&
+ joinedQualifier.maxVertices != rightQualifier.maxVertices)
+ {
+ diagnostics->error(rightQualifierLocation,
+ "Cannot have multiple different max_vertices specifiers",
+ "max_vertices");
+ }
+ joinedQualifier.maxVertices = rightQualifier.maxVertices;
+ }
+
+ if (rightQualifier.index != -1)
+ {
+ if (joinedQualifier.index != -1)
+ {
+ // EXT_blend_func_extended spec: "Each of these qualifiers may appear at most once"
+ diagnostics->error(rightQualifierLocation, "Cannot have multiple index specifiers",
+ "index");
+ }
+ joinedQualifier.index = rightQualifier.index;
+ }
+
+ return joinedQualifier;
+}
+
+unsigned int TInvariantQualifierWrapper::getRank() const
+{
+ return 0u;
+}
+
+unsigned int TInterpolationQualifierWrapper::getRank() const
+{
+ return 1u;
+}
+
+unsigned int TLayoutQualifierWrapper::getRank() const
+{
+ return 2u;
+}
+
+unsigned int TStorageQualifierWrapper::getRank() const
+{
+ // Force the 'centroid' auxilary storage qualifier to be always first among all storage
+ // qualifiers.
+ if (mStorageQualifier == EvqCentroid)
+ {
+ return 3u;
+ }
+ else
+ {
+ return 4u;
+ }
+}
+
+unsigned int TMemoryQualifierWrapper::getRank() const
+{
+ return 4u;
+}
+
+unsigned int TPrecisionQualifierWrapper::getRank() const
+{
+ return 5u;
+}
+
+TTypeQualifier::TTypeQualifier(TQualifier scope, const TSourceLoc &loc)
+ : layoutQualifier(TLayoutQualifier::Create()),
+ memoryQualifier(TMemoryQualifier::Create()),
+ precision(EbpUndefined),
+ qualifier(scope),
+ invariant(false),
+ line(loc)
+{
+ ASSERT(IsScopeQualifier(qualifier));
+}
+
+TTypeQualifierBuilder::TTypeQualifierBuilder(const TStorageQualifierWrapper *scope,
+ int shaderVersion)
+ : mShaderVersion(shaderVersion)
+{
+ ASSERT(IsScopeQualifier(scope->getQualifier()));
+ mQualifiers.push_back(scope);
+}
+
+void TTypeQualifierBuilder::appendQualifier(const TQualifierWrapperBase *qualifier)
+{
+ mQualifiers.push_back(qualifier);
+}
+
+bool TTypeQualifierBuilder::checkSequenceIsValid(TDiagnostics *diagnostics) const
+{
+ bool areQualifierChecksRelaxed = AreTypeQualifierChecksRelaxed(mShaderVersion);
+ ImmutableString errorMessage("");
+ if (HasRepeatingQualifiers(mQualifiers, areQualifierChecksRelaxed, &errorMessage))
+ {
+ diagnostics->error(mQualifiers[0]->getLine(), errorMessage.data(), "qualifier sequence");
+ return false;
+ }
+
+ if (!areQualifierChecksRelaxed && !AreQualifiersInOrder(mQualifiers, &errorMessage))
+ {
+ diagnostics->error(mQualifiers[0]->getLine(), errorMessage.data(), "qualifier sequence");
+ return false;
+ }
+
+ return true;
+}
+
+TTypeQualifier TTypeQualifierBuilder::getParameterTypeQualifier(TDiagnostics *diagnostics) const
+{
+ ASSERT(IsInvariantCorrect(mQualifiers));
+ ASSERT(static_cast<const TStorageQualifierWrapper *>(mQualifiers[0])->getQualifier() ==
+ EvqTemporary);
+
+ if (!checkSequenceIsValid(diagnostics))
+ {
+ return TTypeQualifier(EvqTemporary, mQualifiers[0]->getLine());
+ }
+
+ // If the qualifier checks are relaxed, then it is easier to sort the qualifiers so
+ // that the order imposed by the GLSL ES 3.00 spec is kept. Then we can use the same code to
+ // combine the qualifiers.
+ if (AreTypeQualifierChecksRelaxed(mShaderVersion))
+ {
+ // Copy the qualifier sequence so that we can sort them.
+ QualifierSequence sortedQualifierSequence = mQualifiers;
+ SortSequence(sortedQualifierSequence);
+ return GetParameterTypeQualifierFromSortedSequence(sortedQualifierSequence, diagnostics);
+ }
+ return GetParameterTypeQualifierFromSortedSequence(mQualifiers, diagnostics);
+}
+
+TTypeQualifier TTypeQualifierBuilder::getVariableTypeQualifier(TDiagnostics *diagnostics) const
+{
+ ASSERT(IsInvariantCorrect(mQualifiers));
+
+ if (!checkSequenceIsValid(diagnostics))
+ {
+ return TTypeQualifier(
+ static_cast<const TStorageQualifierWrapper *>(mQualifiers[0])->getQualifier(),
+ mQualifiers[0]->getLine());
+ }
+
+ // If the qualifier checks are relaxed, then it is easier to sort the qualifiers so
+ // that the order imposed by the GLSL ES 3.00 spec is kept. Then we can use the same code to
+ // combine the qualifiers.
+ if (AreTypeQualifierChecksRelaxed(mShaderVersion))
+ {
+ // Copy the qualifier sequence so that we can sort them.
+ QualifierSequence sortedQualifierSequence = mQualifiers;
+ SortSequence(sortedQualifierSequence);
+ return GetVariableTypeQualifierFromSortedSequence(sortedQualifierSequence, diagnostics);
+ }
+ return GetVariableTypeQualifierFromSortedSequence(mQualifiers, diagnostics);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/QualifierTypes.h b/gfx/angle/checkout/src/compiler/translator/QualifierTypes.h
new file mode 100644
index 0000000000..950ba5f93e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/QualifierTypes.h
@@ -0,0 +1,200 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project 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_QUALIFIER_TYPES_H_
+#define COMPILER_TRANSLATOR_QUALIFIER_TYPES_H_
+
+#include "common/angleutils.h"
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/Types.h"
+
+namespace sh
+{
+class TDiagnostics;
+
+TLayoutQualifier JoinLayoutQualifiers(TLayoutQualifier leftQualifier,
+ TLayoutQualifier rightQualifier,
+ const TSourceLoc &rightQualifierLocation,
+ TDiagnostics *diagnostics);
+
+enum TQualifierType
+{
+ QtInvariant,
+ QtInterpolation,
+ QtLayout,
+ QtStorage,
+ QtPrecision,
+ QtMemory
+};
+
+class TQualifierWrapperBase : angle::NonCopyable
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TQualifierWrapperBase(const TSourceLoc &line) : mLine(line) {}
+ virtual ~TQualifierWrapperBase() {}
+ virtual TQualifierType getType() const = 0;
+ virtual ImmutableString getQualifierString() const = 0;
+ virtual unsigned int getRank() const = 0;
+ const TSourceLoc &getLine() const { return mLine; }
+
+ private:
+ TSourceLoc mLine;
+};
+
+class TInvariantQualifierWrapper final : public TQualifierWrapperBase
+{
+ public:
+ TInvariantQualifierWrapper(const TSourceLoc &line) : TQualifierWrapperBase(line) {}
+ ~TInvariantQualifierWrapper() {}
+
+ TQualifierType getType() const override { return QtInvariant; }
+ ImmutableString getQualifierString() const override { return ImmutableString("invariant"); }
+ unsigned int getRank() const override;
+};
+
+class TInterpolationQualifierWrapper final : public TQualifierWrapperBase
+{
+ public:
+ TInterpolationQualifierWrapper(TQualifier interpolationQualifier, const TSourceLoc &line)
+ : TQualifierWrapperBase(line), mInterpolationQualifier(interpolationQualifier)
+ {}
+ ~TInterpolationQualifierWrapper() {}
+
+ TQualifierType getType() const override { return QtInterpolation; }
+ ImmutableString getQualifierString() const override
+ {
+ return ImmutableString(sh::getQualifierString(mInterpolationQualifier));
+ }
+ TQualifier getQualifier() const { return mInterpolationQualifier; }
+ unsigned int getRank() const override;
+
+ private:
+ TQualifier mInterpolationQualifier;
+};
+
+class TLayoutQualifierWrapper final : public TQualifierWrapperBase
+{
+ public:
+ TLayoutQualifierWrapper(TLayoutQualifier layoutQualifier, const TSourceLoc &line)
+ : TQualifierWrapperBase(line), mLayoutQualifier(layoutQualifier)
+ {}
+ ~TLayoutQualifierWrapper() {}
+
+ TQualifierType getType() const override { return QtLayout; }
+ ImmutableString getQualifierString() const override { return ImmutableString("layout"); }
+ const TLayoutQualifier &getQualifier() const { return mLayoutQualifier; }
+ unsigned int getRank() const override;
+
+ private:
+ TLayoutQualifier mLayoutQualifier;
+};
+
+class TStorageQualifierWrapper final : public TQualifierWrapperBase
+{
+ public:
+ TStorageQualifierWrapper(TQualifier storageQualifier, const TSourceLoc &line)
+ : TQualifierWrapperBase(line), mStorageQualifier(storageQualifier)
+ {}
+ ~TStorageQualifierWrapper() {}
+
+ TQualifierType getType() const override { return QtStorage; }
+ ImmutableString getQualifierString() const override
+ {
+ return ImmutableString(sh::getQualifierString(mStorageQualifier));
+ }
+ TQualifier getQualifier() const { return mStorageQualifier; }
+ unsigned int getRank() const override;
+
+ private:
+ TQualifier mStorageQualifier;
+};
+
+class TPrecisionQualifierWrapper final : public TQualifierWrapperBase
+{
+ public:
+ TPrecisionQualifierWrapper(TPrecision precisionQualifier, const TSourceLoc &line)
+ : TQualifierWrapperBase(line), mPrecisionQualifier(precisionQualifier)
+ {}
+ ~TPrecisionQualifierWrapper() {}
+
+ TQualifierType getType() const override { return QtPrecision; }
+ ImmutableString getQualifierString() const override
+ {
+ return ImmutableString(sh::getPrecisionString(mPrecisionQualifier));
+ }
+ TPrecision getQualifier() const { return mPrecisionQualifier; }
+ unsigned int getRank() const override;
+
+ private:
+ TPrecision mPrecisionQualifier;
+};
+
+class TMemoryQualifierWrapper final : public TQualifierWrapperBase
+{
+ public:
+ TMemoryQualifierWrapper(TQualifier memoryQualifier, const TSourceLoc &line)
+ : TQualifierWrapperBase(line), mMemoryQualifier(memoryQualifier)
+ {}
+ ~TMemoryQualifierWrapper() {}
+
+ TQualifierType getType() const override { return QtMemory; }
+ ImmutableString getQualifierString() const override
+ {
+ return ImmutableString(sh::getQualifierString(mMemoryQualifier));
+ }
+ TQualifier getQualifier() const { return mMemoryQualifier; }
+ unsigned int getRank() const override;
+
+ private:
+ TQualifier mMemoryQualifier;
+};
+
+// TTypeQualifier tightly covers type_qualifier from the grammar
+struct TTypeQualifier
+{
+ // initializes all of the qualifiers and sets the scope
+ TTypeQualifier(TQualifier scope, const TSourceLoc &loc);
+
+ TLayoutQualifier layoutQualifier;
+ TMemoryQualifier memoryQualifier;
+ TPrecision precision;
+ TQualifier qualifier;
+ bool invariant;
+ TSourceLoc line;
+};
+
+// TTypeQualifierBuilder contains all of the qualifiers when type_qualifier gets parsed.
+// It is to be used to validate the qualifier sequence and build a TTypeQualifier from it.
+class TTypeQualifierBuilder : angle::NonCopyable
+{
+ public:
+ using QualifierSequence = TVector<const TQualifierWrapperBase *>;
+
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TTypeQualifierBuilder(const TStorageQualifierWrapper *scope, int shaderVersion);
+ // Adds the passed qualifier to the end of the sequence.
+ void appendQualifier(const TQualifierWrapperBase *qualifier);
+ // Checks for the order of qualification and repeating qualifiers.
+ bool checkSequenceIsValid(TDiagnostics *diagnostics) const;
+ // Goes over the qualifier sequence and parses it to form a type qualifier for a function
+ // parameter.
+ // The returned object is initialized even if the parsing fails.
+ TTypeQualifier getParameterTypeQualifier(TDiagnostics *diagnostics) const;
+ // Goes over the qualifier sequence and parses it to form a type qualifier for a variable.
+ // The returned object is initialized even if the parsing fails.
+ TTypeQualifier getVariableTypeQualifier(TDiagnostics *diagnostics) const;
+
+ private:
+ QualifierSequence mQualifiers;
+ int mShaderVersion;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_QUALIFIER_TYPES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.cpp
new file mode 100644
index 0000000000..4b600a9ae2
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.cpp
@@ -0,0 +1,790 @@
+//
+// 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.
+//
+// ResourcesHLSL.cpp:
+// Methods for GLSL to HLSL translation for uniforms and interface blocks.
+//
+
+#include "compiler/translator/ResourcesHLSL.h"
+
+#include "common/utilities.h"
+#include "compiler/translator/AtomicCounterFunctionHLSL.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/StructureHLSL.h"
+#include "compiler/translator/UtilsHLSL.h"
+#include "compiler/translator/blocklayoutHLSL.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kAngleDecorString("angle_");
+
+static const char *UniformRegisterPrefix(const TType &type)
+{
+ if (IsSampler(type.getBasicType()))
+ {
+ return "s";
+ }
+ else
+ {
+ return "c";
+ }
+}
+
+static TString InterfaceBlockFieldTypeString(const TField &field, TLayoutBlockStorage blockStorage)
+{
+ const TType &fieldType = *field.type();
+ const TLayoutMatrixPacking matrixPacking = fieldType.getLayoutQualifier().matrixPacking;
+ ASSERT(matrixPacking != EmpUnspecified);
+ const TStructure *structure = fieldType.getStruct();
+
+ if (fieldType.isMatrix())
+ {
+ // Use HLSL row-major packing for GLSL column-major matrices
+ const TString &matrixPackString =
+ (matrixPacking == EmpRowMajor ? "column_major" : "row_major");
+ return matrixPackString + " " + TypeString(fieldType);
+ }
+ else if (structure)
+ {
+ // Use HLSL row-major packing for GLSL column-major matrices
+ return QualifiedStructNameString(*structure, matrixPacking == EmpColumnMajor,
+ blockStorage == EbsStd140);
+ }
+ else
+ {
+ return TypeString(fieldType);
+ }
+}
+
+static TString InterfaceBlockStructName(const TInterfaceBlock &interfaceBlock)
+{
+ return DecoratePrivate(interfaceBlock.name()) + "_type";
+}
+
+void OutputUniformIndexArrayInitializer(TInfoSinkBase &out,
+ const TType &type,
+ unsigned int startIndex)
+{
+ out << "{";
+ TType elementType(type);
+ elementType.toArrayElementType();
+ for (unsigned int i = 0u; i < type.getOutermostArraySize(); ++i)
+ {
+ if (i > 0u)
+ {
+ out << ", ";
+ }
+ if (elementType.isArray())
+ {
+ OutputUniformIndexArrayInitializer(out, elementType,
+ startIndex + i * elementType.getArraySizeProduct());
+ }
+ else
+ {
+ out << (startIndex + i);
+ }
+ }
+ out << "}";
+}
+
+} // anonymous namespace
+
+ResourcesHLSL::ResourcesHLSL(StructureHLSL *structureHLSL,
+ ShShaderOutput outputType,
+ const std::vector<Uniform> &uniforms,
+ unsigned int firstUniformRegister)
+ : mUniformRegister(firstUniformRegister),
+ mUniformBlockRegister(0),
+ mTextureRegister(0),
+ mUAVRegister(0),
+ mSamplerCount(0),
+ mStructureHLSL(structureHLSL),
+ mOutputType(outputType),
+ mUniforms(uniforms)
+{}
+
+void ResourcesHLSL::reserveUniformRegisters(unsigned int registerCount)
+{
+ mUniformRegister = registerCount;
+}
+
+void ResourcesHLSL::reserveUniformBlockRegisters(unsigned int registerCount)
+{
+ mUniformBlockRegister = registerCount;
+}
+
+const Uniform *ResourcesHLSL::findUniformByName(const ImmutableString &name) const
+{
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); ++uniformIndex)
+ {
+ if (name == mUniforms[uniformIndex].name)
+ {
+ return &mUniforms[uniformIndex];
+ }
+ }
+
+ return nullptr;
+}
+
+unsigned int ResourcesHLSL::assignUniformRegister(const TType &type,
+ const ImmutableString &name,
+ unsigned int *outRegisterCount)
+{
+ unsigned int registerIndex;
+ const Uniform *uniform = findUniformByName(name);
+ ASSERT(uniform);
+
+ if (IsSampler(type.getBasicType()) ||
+ (IsImage(type.getBasicType()) && type.getMemoryQualifier().readonly))
+ {
+ registerIndex = mTextureRegister;
+ }
+ else if (IsImage(type.getBasicType()))
+ {
+ registerIndex = mUAVRegister;
+ }
+ else
+ {
+ registerIndex = mUniformRegister;
+ }
+
+ if (uniform->name == "angle_DrawID" && uniform->mappedName == "angle_DrawID")
+ {
+ mUniformRegisterMap["gl_DrawID"] = registerIndex;
+ }
+ else
+ {
+ mUniformRegisterMap[uniform->name] = registerIndex;
+ }
+
+ unsigned int registerCount = HLSLVariableRegisterCount(*uniform, mOutputType);
+
+ if (IsSampler(type.getBasicType()) ||
+ (IsImage(type.getBasicType()) && type.getMemoryQualifier().readonly))
+ {
+ mTextureRegister += registerCount;
+ }
+ else if (IsImage(type.getBasicType()))
+ {
+ mUAVRegister += registerCount;
+ }
+ else
+ {
+ mUniformRegister += registerCount;
+ }
+ if (outRegisterCount)
+ {
+ *outRegisterCount = registerCount;
+ }
+ return registerIndex;
+}
+
+unsigned int ResourcesHLSL::assignSamplerInStructUniformRegister(const TType &type,
+ const TString &name,
+ unsigned int *outRegisterCount)
+{
+ // Sampler that is a field of a uniform structure.
+ ASSERT(IsSampler(type.getBasicType()));
+ unsigned int registerIndex = mTextureRegister;
+ mUniformRegisterMap[std::string(name.c_str())] = registerIndex;
+ unsigned int registerCount = type.isArray() ? type.getArraySizeProduct() : 1u;
+ mTextureRegister += registerCount;
+ if (outRegisterCount)
+ {
+ *outRegisterCount = registerCount;
+ }
+ return registerIndex;
+}
+
+void ResourcesHLSL::outputHLSLSamplerUniformGroup(
+ TInfoSinkBase &out,
+ const HLSLTextureGroup textureGroup,
+ const TVector<const TVariable *> &group,
+ const TMap<const TVariable *, TString> &samplerInStructSymbolsToAPINames,
+ unsigned int *groupTextureRegisterIndex)
+{
+ if (group.empty())
+ {
+ return;
+ }
+ unsigned int groupRegisterCount = 0;
+ for (const TVariable *uniform : group)
+ {
+ const TType &type = uniform->getType();
+ const ImmutableString &name = uniform->name();
+ unsigned int registerCount;
+
+ // The uniform might be just a regular sampler or one extracted from a struct.
+ unsigned int samplerArrayIndex = 0u;
+ const Uniform *uniformByName = findUniformByName(name);
+ if (uniformByName)
+ {
+ samplerArrayIndex = assignUniformRegister(type, name, &registerCount);
+ }
+ else
+ {
+ ASSERT(samplerInStructSymbolsToAPINames.find(uniform) !=
+ samplerInStructSymbolsToAPINames.end());
+ samplerArrayIndex = assignSamplerInStructUniformRegister(
+ type, samplerInStructSymbolsToAPINames.at(uniform), &registerCount);
+ }
+ groupRegisterCount += registerCount;
+
+ if (type.isArray())
+ {
+ out << "static const uint " << DecorateVariableIfNeeded(*uniform) << ArrayString(type)
+ << " = ";
+ OutputUniformIndexArrayInitializer(out, type, samplerArrayIndex);
+ out << ";\n";
+ }
+ else
+ {
+ out << "static const uint " << DecorateVariableIfNeeded(*uniform) << " = "
+ << samplerArrayIndex << ";\n";
+ }
+ }
+ TString suffix = TextureGroupSuffix(textureGroup);
+ // Since HLSL_TEXTURE_2D is the first group, it has a fixed offset of zero.
+ if (textureGroup != HLSL_TEXTURE_2D)
+ {
+ out << "static const uint textureIndexOffset" << suffix << " = "
+ << (*groupTextureRegisterIndex) << ";\n";
+ out << "static const uint samplerIndexOffset" << suffix << " = "
+ << (*groupTextureRegisterIndex) << ";\n";
+ }
+ out << "uniform " << TextureString(textureGroup) << " textures" << suffix << "["
+ << groupRegisterCount << "]"
+ << " : register(t" << (*groupTextureRegisterIndex) << ");\n";
+ out << "uniform " << SamplerString(textureGroup) << " samplers" << suffix << "["
+ << groupRegisterCount << "]"
+ << " : register(s" << (*groupTextureRegisterIndex) << ");\n";
+ *groupTextureRegisterIndex += groupRegisterCount;
+}
+
+void ResourcesHLSL::outputHLSLImageUniformIndices(TInfoSinkBase &out,
+ const TVector<const TVariable *> &group,
+ unsigned int imageArrayIndex,
+ unsigned int *groupRegisterCount)
+{
+ for (const TVariable *uniform : group)
+ {
+ const TType &type = uniform->getType();
+ const ImmutableString &name = uniform->name();
+ unsigned int registerCount = 0;
+
+ assignUniformRegister(type, name, &registerCount);
+ *groupRegisterCount += registerCount;
+
+ if (type.isArray())
+ {
+ out << "static const uint " << DecorateVariableIfNeeded(*uniform) << ArrayString(type)
+ << " = ";
+ OutputUniformIndexArrayInitializer(out, type, imageArrayIndex);
+ out << ";\n";
+ }
+ else
+ {
+ out << "static const uint " << DecorateVariableIfNeeded(*uniform) << " = "
+ << imageArrayIndex << ";\n";
+ }
+
+ imageArrayIndex += registerCount;
+ }
+}
+
+void ResourcesHLSL::outputHLSLReadonlyImageUniformGroup(TInfoSinkBase &out,
+ const HLSLTextureGroup textureGroup,
+ const TVector<const TVariable *> &group,
+ unsigned int *groupTextureRegisterIndex)
+{
+ if (group.empty())
+ {
+ return;
+ }
+
+ unsigned int groupRegisterCount = 0;
+ outputHLSLImageUniformIndices(out, group, *groupTextureRegisterIndex, &groupRegisterCount);
+
+ TString suffix = TextureGroupSuffix(textureGroup);
+ out << "static const uint readonlyImageIndexOffset" << suffix << " = "
+ << (*groupTextureRegisterIndex) << ";\n";
+ out << "uniform " << TextureString(textureGroup) << " readonlyImages" << suffix << "["
+ << groupRegisterCount << "]"
+ << " : register(t" << (*groupTextureRegisterIndex) << ");\n";
+ *groupTextureRegisterIndex += groupRegisterCount;
+}
+
+void ResourcesHLSL::outputHLSLImageUniformGroup(TInfoSinkBase &out,
+ const HLSLRWTextureGroup textureGroup,
+ const TVector<const TVariable *> &group,
+ unsigned int *groupTextureRegisterIndex)
+{
+ if (group.empty())
+ {
+ return;
+ }
+
+ unsigned int groupRegisterCount = 0;
+ outputHLSLImageUniformIndices(out, group, *groupTextureRegisterIndex, &groupRegisterCount);
+
+ TString suffix = RWTextureGroupSuffix(textureGroup);
+ out << "static const uint imageIndexOffset" << suffix << " = " << (*groupTextureRegisterIndex)
+ << ";\n";
+ out << "uniform " << RWTextureString(textureGroup) << " images" << suffix << "["
+ << groupRegisterCount << "]"
+ << " : register(u" << (*groupTextureRegisterIndex) << ");\n";
+ *groupTextureRegisterIndex += groupRegisterCount;
+}
+
+void ResourcesHLSL::outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
+ const TType &type,
+ const TVariable &variable,
+ const unsigned int registerIndex)
+{
+ out << "uniform " << SamplerString(type.getBasicType()) << " sampler_"
+ << DecorateVariableIfNeeded(variable) << ArrayString(type) << " : register(s"
+ << str(registerIndex) << ");\n";
+ out << "uniform " << TextureString(type.getBasicType()) << " texture_"
+ << DecorateVariableIfNeeded(variable) << ArrayString(type) << " : register(t"
+ << str(registerIndex) << ");\n";
+}
+
+void ResourcesHLSL::outputUniform(TInfoSinkBase &out,
+ const TType &type,
+ const TVariable &variable,
+ const unsigned int registerIndex)
+{
+ const TStructure *structure = type.getStruct();
+ // If this is a nameless struct, we need to use its full definition, rather than its (empty)
+ // name.
+ // TypeString() will invoke defineNameless in this case; qualifier prefixes are unnecessary for
+ // nameless structs in ES, as nameless structs cannot be used anywhere that layout qualifiers
+ // are permitted.
+ const TString &typeName = ((structure && structure->symbolType() != SymbolType::Empty)
+ ? QualifiedStructNameString(*structure, false, false)
+ : TypeString(type));
+
+ const TString &registerString =
+ TString("register(") + UniformRegisterPrefix(type) + str(registerIndex) + ")";
+
+ out << "uniform " << typeName << " ";
+
+ out << DecorateVariableIfNeeded(variable);
+
+ out << ArrayString(type) << " : " << registerString << ";\n";
+}
+
+void ResourcesHLSL::outputAtomicCounterBuffer(TInfoSinkBase &out,
+ const int binding,
+ const unsigned int registerIndex)
+{
+ // Atomic counter memory access is not incoherent
+ out << "uniform globallycoherent RWByteAddressBuffer "
+ << getAtomicCounterNameForBinding(binding) << " : register(u" << registerIndex << ");\n";
+}
+
+void ResourcesHLSL::uniformsHeader(TInfoSinkBase &out,
+ ShShaderOutput outputType,
+ const ReferencedVariables &referencedUniforms,
+ TSymbolTable *symbolTable)
+{
+ if (!referencedUniforms.empty())
+ {
+ out << "// Uniforms\n\n";
+ }
+ // In the case of HLSL 4, sampler uniforms need to be grouped by type before the code is
+ // written. They are grouped based on the combination of the HLSL texture type and
+ // HLSL sampler type, enumerated in HLSLTextureSamplerGroup.
+ TVector<TVector<const TVariable *>> groupedSamplerUniforms(HLSL_TEXTURE_MAX + 1);
+ TMap<const TVariable *, TString> samplerInStructSymbolsToAPINames;
+ TVector<TVector<const TVariable *>> groupedReadonlyImageUniforms(HLSL_TEXTURE_MAX + 1);
+ TVector<TVector<const TVariable *>> groupedImageUniforms(HLSL_RWTEXTURE_MAX + 1);
+
+ TUnorderedMap<int, unsigned int> assignedAtomicCounterBindings;
+ unsigned int reservedReadonlyImageRegisterCount = 0, reservedImageRegisterCount = 0;
+ for (auto &uniformIt : referencedUniforms)
+ {
+ // Output regular uniforms. Group sampler uniforms by type.
+ const TVariable &variable = *uniformIt.second;
+ const TType &type = variable.getType();
+
+ if (outputType == SH_HLSL_4_1_OUTPUT && IsSampler(type.getBasicType()))
+ {
+ HLSLTextureGroup group = TextureGroup(type.getBasicType());
+ groupedSamplerUniforms[group].push_back(&variable);
+ }
+ else if (outputType == SH_HLSL_4_0_FL9_3_OUTPUT && IsSampler(type.getBasicType()))
+ {
+ unsigned int registerIndex = assignUniformRegister(type, variable.name(), nullptr);
+ outputHLSL4_0_FL9_3Sampler(out, type, variable, registerIndex);
+ }
+ else if (outputType == SH_HLSL_4_1_OUTPUT && IsImage(type.getBasicType()))
+ {
+ if (IsImage2D(type.getBasicType()))
+ {
+ const Uniform *uniform = findUniformByName(variable.name());
+ if (type.getMemoryQualifier().readonly)
+ {
+ reservedReadonlyImageRegisterCount +=
+ HLSLVariableRegisterCount(*uniform, mOutputType);
+ }
+ else
+ {
+ reservedImageRegisterCount += HLSLVariableRegisterCount(*uniform, mOutputType);
+ }
+ continue;
+ }
+ if (type.getMemoryQualifier().readonly)
+ {
+ HLSLTextureGroup group = TextureGroup(
+ type.getBasicType(), type.getLayoutQualifier().imageInternalFormat);
+ groupedReadonlyImageUniforms[group].push_back(&variable);
+ }
+ else
+ {
+ HLSLRWTextureGroup group = RWTextureGroup(
+ type.getBasicType(), type.getLayoutQualifier().imageInternalFormat);
+ groupedImageUniforms[group].push_back(&variable);
+ }
+ }
+ else if (outputType == SH_HLSL_4_1_OUTPUT && IsAtomicCounter(type.getBasicType()))
+ {
+ TLayoutQualifier layout = type.getLayoutQualifier();
+ int binding = layout.binding;
+ unsigned int registerIndex;
+ if (assignedAtomicCounterBindings.find(binding) == assignedAtomicCounterBindings.end())
+ {
+ registerIndex = mUAVRegister++;
+ assignedAtomicCounterBindings[binding] = registerIndex;
+ outputAtomicCounterBuffer(out, binding, registerIndex);
+ }
+ else
+ {
+ registerIndex = assignedAtomicCounterBindings[binding];
+ }
+ const Uniform *uniform = findUniformByName(variable.name());
+ mUniformRegisterMap[uniform->name] = registerIndex;
+ }
+ else
+ {
+ if (type.isStructureContainingSamplers())
+ {
+ TVector<const TVariable *> samplerSymbols;
+ TMap<const TVariable *, TString> symbolsToAPINames;
+ ImmutableStringBuilder namePrefix(kAngleDecorString.length() +
+ variable.name().length());
+ namePrefix << kAngleDecorString;
+ namePrefix << variable.name();
+ type.createSamplerSymbols(namePrefix, TString(variable.name().data()),
+ &samplerSymbols, &symbolsToAPINames, symbolTable);
+ for (const TVariable *sampler : samplerSymbols)
+ {
+ const TType &samplerType = sampler->getType();
+
+ if (outputType == SH_HLSL_4_1_OUTPUT)
+ {
+ HLSLTextureGroup group = TextureGroup(samplerType.getBasicType());
+ groupedSamplerUniforms[group].push_back(sampler);
+ samplerInStructSymbolsToAPINames[sampler] = symbolsToAPINames[sampler];
+ }
+ else if (outputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ unsigned int registerIndex = assignSamplerInStructUniformRegister(
+ samplerType, symbolsToAPINames[sampler], nullptr);
+ outputHLSL4_0_FL9_3Sampler(out, samplerType, *sampler, registerIndex);
+ }
+ else
+ {
+ ASSERT(outputType == SH_HLSL_3_0_OUTPUT);
+ unsigned int registerIndex = assignSamplerInStructUniformRegister(
+ samplerType, symbolsToAPINames[sampler], nullptr);
+ outputUniform(out, samplerType, *sampler, registerIndex);
+ }
+ }
+ }
+ unsigned int registerIndex = assignUniformRegister(type, variable.name(), nullptr);
+ outputUniform(out, type, variable, registerIndex);
+ }
+ }
+
+ if (outputType == SH_HLSL_4_1_OUTPUT)
+ {
+ unsigned int groupTextureRegisterIndex = 0;
+ // Atomic counters and RW texture share the same resources. Therefore, RW texture need to
+ // start counting after the last atomic counter.
+ unsigned int groupRWTextureRegisterIndex = mUAVRegister;
+ // TEXTURE_2D is special, index offset is assumed to be 0 and omitted in that case.
+ ASSERT(HLSL_TEXTURE_MIN == HLSL_TEXTURE_2D);
+ for (int groupId = HLSL_TEXTURE_MIN; groupId < HLSL_TEXTURE_MAX; ++groupId)
+ {
+ outputHLSLSamplerUniformGroup(
+ out, HLSLTextureGroup(groupId), groupedSamplerUniforms[groupId],
+ samplerInStructSymbolsToAPINames, &groupTextureRegisterIndex);
+ }
+ mSamplerCount = groupTextureRegisterIndex;
+
+ // Reserve t type register for readonly image2D variables.
+ mReadonlyImage2DRegisterIndex = mTextureRegister;
+ groupTextureRegisterIndex += reservedReadonlyImageRegisterCount;
+ mTextureRegister += reservedReadonlyImageRegisterCount;
+
+ for (int groupId = HLSL_TEXTURE_MIN; groupId < HLSL_TEXTURE_MAX; ++groupId)
+ {
+ outputHLSLReadonlyImageUniformGroup(out, HLSLTextureGroup(groupId),
+ groupedReadonlyImageUniforms[groupId],
+ &groupTextureRegisterIndex);
+ }
+ mReadonlyImageCount = groupTextureRegisterIndex - mReadonlyImage2DRegisterIndex;
+ if (mReadonlyImageCount)
+ {
+ out << "static const uint readonlyImageIndexStart = " << mReadonlyImage2DRegisterIndex
+ << ";\n";
+ }
+
+ // Reserve u type register for writable image2D variables.
+ mImage2DRegisterIndex = mUAVRegister;
+ groupRWTextureRegisterIndex += reservedImageRegisterCount;
+ mUAVRegister += reservedImageRegisterCount;
+
+ for (int groupId = HLSL_RWTEXTURE_MIN; groupId < HLSL_RWTEXTURE_MAX; ++groupId)
+ {
+ outputHLSLImageUniformGroup(out, HLSLRWTextureGroup(groupId),
+ groupedImageUniforms[groupId],
+ &groupRWTextureRegisterIndex);
+ }
+ mImageCount = groupRWTextureRegisterIndex - mImage2DRegisterIndex;
+ if (mImageCount)
+ {
+ out << "static const uint imageIndexStart = " << mImage2DRegisterIndex << ";\n";
+ }
+ }
+}
+
+void ResourcesHLSL::samplerMetadataUniforms(TInfoSinkBase &out, unsigned int regIndex)
+{
+ // If mSamplerCount is 0 the shader doesn't use any textures for samplers.
+ if (mSamplerCount > 0)
+ {
+ out << " struct SamplerMetadata\n"
+ " {\n"
+ " int baseLevel;\n"
+ " int internalFormatBits;\n"
+ " int wrapModes;\n"
+ " int padding;\n"
+ " int4 intBorderColor;\n"
+ " };\n"
+ " SamplerMetadata samplerMetadata["
+ << mSamplerCount << "] : packoffset(c" << regIndex << ");\n";
+ }
+}
+
+void ResourcesHLSL::imageMetadataUniforms(TInfoSinkBase &out, unsigned int regIndex)
+{
+ if (mReadonlyImageCount > 0 || mImageCount > 0)
+ {
+ out << " struct ImageMetadata\n"
+ " {\n"
+ " int layer;\n"
+ " uint level;\n"
+ " int2 padding;\n"
+ " };\n";
+
+ if (mReadonlyImageCount > 0)
+ {
+ out << " ImageMetadata readonlyImageMetadata[" << mReadonlyImageCount
+ << "] : packoffset(c" << regIndex << ");\n";
+ }
+
+ if (mImageCount > 0)
+ {
+ out << " ImageMetadata imageMetadata[" << mImageCount << "] : packoffset(c"
+ << regIndex + mReadonlyImageCount << ");\n";
+ }
+ }
+}
+
+TString ResourcesHLSL::uniformBlocksHeader(
+ const ReferencedInterfaceBlocks &referencedInterfaceBlocks)
+{
+ TString interfaceBlocks;
+
+ for (const auto &blockReference : referencedInterfaceBlocks)
+ {
+ const TInterfaceBlock &interfaceBlock = *blockReference.second->block;
+ const TVariable *instanceVariable = blockReference.second->instanceVariable;
+ if (instanceVariable != nullptr)
+ {
+ interfaceBlocks += uniformBlockStructString(interfaceBlock);
+ }
+
+ unsigned int activeRegister = mUniformBlockRegister;
+ mUniformBlockRegisterMap[interfaceBlock.name().data()] = activeRegister;
+
+ if (instanceVariable != nullptr && instanceVariable->getType().isArray())
+ {
+ unsigned int instanceArraySize = instanceVariable->getType().getOutermostArraySize();
+ for (unsigned int arrayIndex = 0; arrayIndex < instanceArraySize; arrayIndex++)
+ {
+ interfaceBlocks += uniformBlockString(interfaceBlock, instanceVariable,
+ activeRegister + arrayIndex, arrayIndex);
+ }
+ mUniformBlockRegister += instanceArraySize;
+ }
+ else
+ {
+ interfaceBlocks += uniformBlockString(interfaceBlock, instanceVariable, activeRegister,
+ GL_INVALID_INDEX);
+ mUniformBlockRegister += 1u;
+ }
+ }
+
+ return (interfaceBlocks.empty() ? "" : ("// Uniform Blocks\n\n" + interfaceBlocks));
+}
+
+TString ResourcesHLSL::shaderStorageBlocksHeader(
+ const ReferencedInterfaceBlocks &referencedInterfaceBlocks)
+{
+ TString interfaceBlocks;
+
+ for (const auto &interfaceBlockReference : referencedInterfaceBlocks)
+ {
+ const TInterfaceBlock &interfaceBlock = *interfaceBlockReference.second->block;
+ const TVariable *instanceVariable = interfaceBlockReference.second->instanceVariable;
+
+ unsigned int activeRegister = mUAVRegister;
+ mShaderStorageBlockRegisterMap[interfaceBlock.name().data()] = activeRegister;
+
+ if (instanceVariable != nullptr && instanceVariable->getType().isArray())
+ {
+ unsigned int instanceArraySize = instanceVariable->getType().getOutermostArraySize();
+ for (unsigned int arrayIndex = 0; arrayIndex < instanceArraySize; arrayIndex++)
+ {
+ interfaceBlocks += shaderStorageBlockString(
+ interfaceBlock, instanceVariable, activeRegister + arrayIndex, arrayIndex);
+ }
+ mUAVRegister += instanceArraySize;
+ }
+ else
+ {
+ interfaceBlocks += shaderStorageBlockString(interfaceBlock, instanceVariable,
+ activeRegister, GL_INVALID_INDEX);
+ mUAVRegister += 1u;
+ }
+ }
+
+ return (interfaceBlocks.empty() ? "" : ("// Shader Storage Blocks\n\n" + interfaceBlocks));
+}
+
+TString ResourcesHLSL::uniformBlockString(const TInterfaceBlock &interfaceBlock,
+ const TVariable *instanceVariable,
+ unsigned int registerIndex,
+ unsigned int arrayIndex)
+{
+ const TString &arrayIndexString = (arrayIndex != GL_INVALID_INDEX ? str(arrayIndex) : "");
+ const TString &blockName = TString(interfaceBlock.name().data()) + arrayIndexString;
+ TString hlsl;
+
+ hlsl += "cbuffer " + blockName + " : register(b" + str(registerIndex) +
+ ")\n"
+ "{\n";
+
+ if (instanceVariable != nullptr)
+ {
+ hlsl += " " + InterfaceBlockStructName(interfaceBlock) + " " +
+ InterfaceBlockInstanceString(instanceVariable->name(), arrayIndex) + ";\n";
+ }
+ else
+ {
+ const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+ hlsl += uniformBlockMembersString(interfaceBlock, blockStorage);
+ }
+
+ hlsl += "};\n\n";
+
+ return hlsl;
+}
+
+TString ResourcesHLSL::shaderStorageBlockString(const TInterfaceBlock &interfaceBlock,
+ const TVariable *instanceVariable,
+ unsigned int registerIndex,
+ unsigned int arrayIndex)
+{
+ TString hlsl;
+ if (instanceVariable != nullptr)
+ {
+ hlsl += "RWByteAddressBuffer " +
+ InterfaceBlockInstanceString(instanceVariable->name(), arrayIndex) +
+ ": register(u" + str(registerIndex) + ");\n";
+ }
+ else
+ {
+ hlsl += "RWByteAddressBuffer " + Decorate(interfaceBlock.name()) + ": register(u" +
+ str(registerIndex) + ");\n";
+ }
+ return hlsl;
+}
+
+TString ResourcesHLSL::InterfaceBlockInstanceString(const ImmutableString &instanceName,
+ unsigned int arrayIndex)
+{
+ if (arrayIndex != GL_INVALID_INDEX)
+ {
+ return DecoratePrivate(instanceName) + "_" + str(arrayIndex);
+ }
+ else
+ {
+ return Decorate(instanceName);
+ }
+}
+
+TString ResourcesHLSL::uniformBlockMembersString(const TInterfaceBlock &interfaceBlock,
+ TLayoutBlockStorage blockStorage)
+{
+ TString hlsl;
+
+ Std140PaddingHelper padHelper = mStructureHLSL->getPaddingHelper();
+
+ 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 += padHelper.prePaddingString(fieldType);
+ }
+
+ hlsl += " " + InterfaceBlockFieldTypeString(field, blockStorage) + " " +
+ Decorate(field.name()) + ArrayString(fieldType).data() + ";\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 += padHelper.postPaddingString(fieldType, useHLSLRowMajorPacking);
+ }
+ }
+
+ return hlsl;
+}
+
+TString ResourcesHLSL::uniformBlockStructString(const TInterfaceBlock &interfaceBlock)
+{
+ const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+
+ return "struct " + InterfaceBlockStructName(interfaceBlock) +
+ "\n"
+ "{\n" +
+ uniformBlockMembersString(interfaceBlock, blockStorage) + "};\n\n";
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.h b/gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.h
new file mode 100644
index 0000000000..0c028224b0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ResourcesHLSL.h
@@ -0,0 +1,139 @@
+//
+// 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.
+//
+// ResourcesHLSL.h:
+// Methods for GLSL to HLSL translation for uniforms and interface blocks.
+//
+
+#ifndef COMPILER_TRANSLATOR_RESOURCESHLSL_H_
+#define COMPILER_TRANSLATOR_RESOURCESHLSL_H_
+
+#include "compiler/translator/OutputHLSL.h"
+#include "compiler/translator/UtilsHLSL.h"
+
+namespace sh
+{
+class ImmutableString;
+class StructureHLSL;
+class TSymbolTable;
+
+class ResourcesHLSL : angle::NonCopyable
+{
+ public:
+ ResourcesHLSL(StructureHLSL *structureHLSL,
+ ShShaderOutput outputType,
+ const std::vector<Uniform> &uniforms,
+ unsigned int firstUniformRegister);
+
+ void reserveUniformRegisters(unsigned int registerCount);
+ void reserveUniformBlockRegisters(unsigned int registerCount);
+ void uniformsHeader(TInfoSinkBase &out,
+ ShShaderOutput outputType,
+ const ReferencedVariables &referencedUniforms,
+ TSymbolTable *symbolTable);
+
+ // Must be called after uniformsHeader
+ void samplerMetadataUniforms(TInfoSinkBase &out, unsigned int regIndex);
+ unsigned int getSamplerCount() const { return mSamplerCount; }
+ void imageMetadataUniforms(TInfoSinkBase &out, unsigned int regIndex);
+ TString uniformBlocksHeader(const ReferencedInterfaceBlocks &referencedInterfaceBlocks);
+ TString shaderStorageBlocksHeader(const ReferencedInterfaceBlocks &referencedInterfaceBlocks);
+
+ // Used for direct index references
+ static TString InterfaceBlockInstanceString(const ImmutableString &instanceName,
+ unsigned int arrayIndex);
+
+ const std::map<std::string, unsigned int> &getShaderStorageBlockRegisterMap() const
+ {
+ return mShaderStorageBlockRegisterMap;
+ }
+
+ const std::map<std::string, unsigned int> &getUniformBlockRegisterMap() const
+ {
+ return mUniformBlockRegisterMap;
+ }
+ const std::map<std::string, unsigned int> &getUniformRegisterMap() const
+ {
+ return mUniformRegisterMap;
+ }
+
+ unsigned int getReadonlyImage2DRegisterIndex() const { return mReadonlyImage2DRegisterIndex; }
+ unsigned int getImage2DRegisterIndex() const { return mImage2DRegisterIndex; }
+
+ private:
+ TString uniformBlockString(const TInterfaceBlock &interfaceBlock,
+ const TVariable *instanceVariable,
+ unsigned int registerIndex,
+ unsigned int arrayIndex);
+
+ TString shaderStorageBlockString(const TInterfaceBlock &interfaceBlock,
+ const TVariable *instanceVariable,
+ unsigned int registerIndex,
+ unsigned int arrayIndex);
+ TString uniformBlockMembersString(const TInterfaceBlock &interfaceBlock,
+ TLayoutBlockStorage blockStorage);
+ TString uniformBlockStructString(const TInterfaceBlock &interfaceBlock);
+ const Uniform *findUniformByName(const ImmutableString &name) const;
+
+ void outputHLSL4_0_FL9_3Sampler(TInfoSinkBase &out,
+ const TType &type,
+ const TVariable &variable,
+ const unsigned int registerIndex);
+ void outputUniform(TInfoSinkBase &out,
+ const TType &type,
+ const TVariable &variable,
+ const unsigned int registerIndex);
+ void outputAtomicCounterBuffer(TInfoSinkBase &out,
+ const int binding,
+ const unsigned int registerIndex);
+
+ // Returns the uniform's register index
+ unsigned int assignUniformRegister(const TType &type,
+ const ImmutableString &name,
+ unsigned int *outRegisterCount);
+ unsigned int assignSamplerInStructUniformRegister(const TType &type,
+ const TString &name,
+ unsigned int *outRegisterCount);
+
+ void outputHLSLSamplerUniformGroup(
+ TInfoSinkBase &out,
+ const HLSLTextureGroup textureGroup,
+ const TVector<const TVariable *> &group,
+ const TMap<const TVariable *, TString> &samplerInStructSymbolsToAPINames,
+ unsigned int *groupTextureRegisterIndex);
+
+ void outputHLSLImageUniformIndices(TInfoSinkBase &out,
+ const TVector<const TVariable *> &group,
+ unsigned int imageArrayIndex,
+ unsigned int *groupRegisterCount);
+ void outputHLSLReadonlyImageUniformGroup(TInfoSinkBase &out,
+ const HLSLTextureGroup textureGroup,
+ const TVector<const TVariable *> &group,
+ unsigned int *groupTextureRegisterIndex);
+ void outputHLSLImageUniformGroup(TInfoSinkBase &out,
+ const HLSLRWTextureGroup textureGroup,
+ const TVector<const TVariable *> &group,
+ unsigned int *groupTextureRegisterIndex);
+
+ unsigned int mUniformRegister;
+ unsigned int mUniformBlockRegister;
+ unsigned int mTextureRegister;
+ unsigned int mUAVRegister;
+ unsigned int mSamplerCount;
+ unsigned int mReadonlyImageCount;
+ unsigned int mImageCount;
+ StructureHLSL *mStructureHLSL;
+ ShShaderOutput mOutputType;
+
+ const std::vector<Uniform> &mUniforms;
+ std::map<std::string, unsigned int> mUniformBlockRegisterMap;
+ std::map<std::string, unsigned int> mShaderStorageBlockRegisterMap;
+ std::map<std::string, unsigned int> mUniformRegisterMap;
+ unsigned int mReadonlyImage2DRegisterIndex;
+ unsigned int mImage2DRegisterIndex;
+};
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_RESOURCESHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Severity.h b/gfx/angle/checkout/src/compiler/translator/Severity.h
new file mode 100644
index 0000000000..47808a16a7
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Severity.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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_SEVERITY_H_
+#define COMPILER_TRANSLATOR_SEVERITY_H_
+
+namespace sh
+{
+
+// Severity is used to classify info log messages.
+enum Severity
+{
+ SH_WARNING,
+ SH_ERROR
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_SEVERITY_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ShaderLang.cpp b/gfx/angle/checkout/src/compiler/translator/ShaderLang.cpp
new file mode 100644
index 0000000000..3a947d3c09
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ShaderLang.cpp
@@ -0,0 +1,675 @@
+//
+// 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.
+//
+
+//
+// Implement the top-level of interface to the compiler,
+// as defined in ShaderLang.h
+//
+
+#include "GLSLANG/ShaderLang.h"
+
+#include "compiler/translator/Compiler.h"
+#include "compiler/translator/InitializeDll.h"
+#include "compiler/translator/length_limits.h"
+#ifdef ANGLE_ENABLE_HLSL
+# include "compiler/translator/TranslatorHLSL.h"
+#endif // ANGLE_ENABLE_HLSL
+#include "angle_gl.h"
+#include "compiler/translator/VariablePacker.h"
+
+namespace sh
+{
+
+namespace
+{
+
+bool isInitialized = false;
+
+//
+// This is the platform independent interface between an OGL driver
+// and the shading language compiler.
+//
+
+template <typename VarT>
+const std::vector<VarT> *GetVariableList(const TCompiler *compiler);
+
+template <>
+const std::vector<Uniform> *GetVariableList(const TCompiler *compiler)
+{
+ return &compiler->getUniforms();
+}
+
+template <>
+const std::vector<Varying> *GetVariableList(const TCompiler *compiler)
+{
+ switch (compiler->getShaderType())
+ {
+ case GL_VERTEX_SHADER:
+ return &compiler->getOutputVaryings();
+ case GL_FRAGMENT_SHADER:
+ return &compiler->getInputVaryings();
+ case GL_COMPUTE_SHADER:
+ ASSERT(compiler->getOutputVaryings().empty() && compiler->getInputVaryings().empty());
+ return &compiler->getOutputVaryings();
+ // Since geometry shaders have both input and output varyings, we shouldn't call GetVaryings
+ // on a geometry shader.
+ default:
+ return nullptr;
+ }
+}
+
+template <>
+const std::vector<Attribute> *GetVariableList(const TCompiler *compiler)
+{
+ return &compiler->getAttributes();
+}
+
+template <>
+const std::vector<OutputVariable> *GetVariableList(const TCompiler *compiler)
+{
+ return &compiler->getOutputVariables();
+}
+
+template <>
+const std::vector<InterfaceBlock> *GetVariableList(const TCompiler *compiler)
+{
+ return &compiler->getInterfaceBlocks();
+}
+
+TCompiler *GetCompilerFromHandle(ShHandle handle)
+{
+ if (!handle)
+ {
+ return nullptr;
+ }
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ return base->getAsCompiler();
+}
+
+template <typename VarT>
+const std::vector<VarT> *GetShaderVariables(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ if (!compiler)
+ {
+ return nullptr;
+ }
+
+ return GetVariableList<VarT>(compiler);
+}
+
+#ifdef ANGLE_ENABLE_HLSL
+TranslatorHLSL *GetTranslatorHLSLFromHandle(ShHandle handle)
+{
+ if (!handle)
+ return nullptr;
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ return base->getAsTranslatorHLSL();
+}
+#endif // ANGLE_ENABLE_HLSL
+
+GLenum GetGeometryShaderPrimitiveTypeEnum(sh::TLayoutPrimitiveType primitiveType)
+{
+ switch (primitiveType)
+ {
+ case EptPoints:
+ return GL_POINTS;
+ case EptLines:
+ return GL_LINES;
+ case EptLinesAdjacency:
+ return GL_LINES_ADJACENCY_EXT;
+ case EptTriangles:
+ return GL_TRIANGLES;
+ case EptTrianglesAdjacency:
+ return GL_TRIANGLES_ADJACENCY_EXT;
+
+ case EptLineStrip:
+ return GL_LINE_STRIP;
+ case EptTriangleStrip:
+ return GL_TRIANGLE_STRIP;
+
+ case EptUndefined:
+ default:
+ UNREACHABLE();
+ return GL_INVALID_VALUE;
+ }
+}
+
+} // anonymous namespace
+
+//
+// Driver must call this first, once, before doing any other compiler operations.
+// Subsequent calls to this function are no-op.
+//
+bool Initialize()
+{
+ if (!isInitialized)
+ {
+ isInitialized = InitProcess();
+ }
+ return isInitialized;
+}
+
+//
+// Cleanup symbol tables
+//
+bool Finalize()
+{
+ if (isInitialized)
+ {
+ DetachProcess();
+ isInitialized = false;
+ }
+ return true;
+}
+
+//
+// Initialize built-in resources with minimum expected values.
+//
+void InitBuiltInResources(ShBuiltInResources *resources)
+{
+ // Make comparable.
+ memset(resources, 0, sizeof(*resources));
+
+ // Constants.
+ resources->MaxVertexAttribs = 8;
+ resources->MaxVertexUniformVectors = 128;
+ resources->MaxVaryingVectors = 8;
+ resources->MaxVertexTextureImageUnits = 0;
+ resources->MaxCombinedTextureImageUnits = 8;
+ resources->MaxTextureImageUnits = 8;
+ resources->MaxFragmentUniformVectors = 16;
+ resources->MaxDrawBuffers = 1;
+
+ // Extensions.
+ resources->OES_standard_derivatives = 0;
+ resources->OES_EGL_image_external = 0;
+ resources->OES_EGL_image_external_essl3 = 0;
+ resources->NV_EGL_stream_consumer_external = 0;
+ resources->ARB_texture_rectangle = 0;
+ resources->EXT_blend_func_extended = 0;
+ resources->EXT_draw_buffers = 0;
+ resources->EXT_frag_depth = 0;
+ resources->EXT_shader_texture_lod = 0;
+ resources->WEBGL_debug_shader_precision = 0;
+ resources->EXT_shader_framebuffer_fetch = 0;
+ resources->NV_shader_framebuffer_fetch = 0;
+ resources->ARM_shader_framebuffer_fetch = 0;
+ resources->OVR_multiview = 0;
+ resources->OVR_multiview2 = 0;
+ resources->EXT_YUV_target = 0;
+ resources->EXT_geometry_shader = 0;
+ resources->OES_texture_storage_multisample_2d_array = 0;
+ resources->OES_texture_3D = 0;
+ resources->ANGLE_texture_multisample = 0;
+ resources->ANGLE_multi_draw = 0;
+ resources->ANGLE_base_vertex_base_instance = 0;
+
+ resources->NV_draw_buffers = 0;
+
+ // Disable highp precision in fragment shader by default.
+ resources->FragmentPrecisionHigh = 0;
+
+ // GLSL ES 3.0 constants.
+ resources->MaxVertexOutputVectors = 16;
+ resources->MaxFragmentInputVectors = 15;
+ resources->MinProgramTexelOffset = -8;
+ resources->MaxProgramTexelOffset = 7;
+
+ // Extensions constants.
+ resources->MaxDualSourceDrawBuffers = 0;
+
+ resources->MaxViewsOVR = 4;
+
+ // Disable name hashing by default.
+ resources->HashFunction = nullptr;
+
+ resources->ArrayIndexClampingStrategy = SH_CLAMP_WITH_CLAMP_INTRINSIC;
+
+ resources->MaxExpressionComplexity = 256;
+ resources->MaxCallStackDepth = 256;
+ resources->MaxFunctionParameters = 1024;
+
+ // ES 3.1 Revision 4, 7.2 Built-in Constants
+
+ // ES 3.1, Revision 4, 8.13 Texture minification
+ // "The value of MIN_PROGRAM_TEXTURE_GATHER_OFFSET must be less than or equal to the value of
+ // MIN_PROGRAM_TEXEL_OFFSET. The value of MAX_PROGRAM_TEXTURE_GATHER_OFFSET must be greater than
+ // or equal to the value of MAX_PROGRAM_TEXEL_OFFSET"
+ resources->MinProgramTextureGatherOffset = -8;
+ resources->MaxProgramTextureGatherOffset = 7;
+
+ resources->MaxImageUnits = 4;
+ resources->MaxVertexImageUniforms = 0;
+ resources->MaxFragmentImageUniforms = 0;
+ resources->MaxComputeImageUniforms = 4;
+ resources->MaxCombinedImageUniforms = 4;
+
+ resources->MaxUniformLocations = 1024;
+
+ resources->MaxCombinedShaderOutputResources = 4;
+
+ resources->MaxComputeWorkGroupCount[0] = 65535;
+ resources->MaxComputeWorkGroupCount[1] = 65535;
+ resources->MaxComputeWorkGroupCount[2] = 65535;
+ resources->MaxComputeWorkGroupSize[0] = 128;
+ resources->MaxComputeWorkGroupSize[1] = 128;
+ resources->MaxComputeWorkGroupSize[2] = 64;
+ resources->MaxComputeUniformComponents = 512;
+ resources->MaxComputeTextureImageUnits = 16;
+
+ resources->MaxComputeAtomicCounters = 8;
+ resources->MaxComputeAtomicCounterBuffers = 1;
+
+ resources->MaxVertexAtomicCounters = 0;
+ resources->MaxFragmentAtomicCounters = 0;
+ resources->MaxCombinedAtomicCounters = 8;
+ resources->MaxAtomicCounterBindings = 1;
+
+ resources->MaxVertexAtomicCounterBuffers = 0;
+ resources->MaxFragmentAtomicCounterBuffers = 0;
+ resources->MaxCombinedAtomicCounterBuffers = 1;
+ resources->MaxAtomicCounterBufferSize = 32;
+
+ resources->MaxUniformBufferBindings = 32;
+ resources->MaxShaderStorageBufferBindings = 4;
+
+ resources->MaxGeometryUniformComponents = 1024;
+ resources->MaxGeometryUniformBlocks = 12;
+ resources->MaxGeometryInputComponents = 64;
+ resources->MaxGeometryOutputComponents = 64;
+ resources->MaxGeometryOutputVertices = 256;
+ resources->MaxGeometryTotalOutputComponents = 1024;
+ resources->MaxGeometryTextureImageUnits = 16;
+ resources->MaxGeometryAtomicCounterBuffers = 0;
+ resources->MaxGeometryAtomicCounters = 0;
+ resources->MaxGeometryShaderStorageBlocks = 0;
+ resources->MaxGeometryShaderInvocations = 32;
+ resources->MaxGeometryImageUniforms = 0;
+}
+
+//
+// Driver calls these to create and destroy compiler objects.
+//
+ShHandle ConstructCompiler(sh::GLenum type,
+ ShShaderSpec spec,
+ ShShaderOutput output,
+ const ShBuiltInResources *resources)
+{
+ TShHandleBase *base = static_cast<TShHandleBase *>(ConstructCompiler(type, spec, output));
+ if (base == nullptr)
+ {
+ return 0;
+ }
+
+ TCompiler *compiler = base->getAsCompiler();
+ if (compiler == nullptr)
+ {
+ return 0;
+ }
+
+ // Generate built-in symbol table.
+ if (!compiler->Init(*resources))
+ {
+ Destruct(base);
+ return 0;
+ }
+
+ return base;
+}
+
+void Destruct(ShHandle handle)
+{
+ if (handle == 0)
+ return;
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+
+ if (base->getAsCompiler())
+ DeleteCompiler(base->getAsCompiler());
+}
+
+const std::string &GetBuiltInResourcesString(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+ return compiler->getBuiltInResourcesString();
+}
+
+//
+// Do an actual compile on the given strings. The result is left
+// in the given compile object.
+//
+// Return: The return value of ShCompile is really boolean, indicating
+// success or failure.
+//
+bool Compile(const ShHandle handle,
+ const char *const shaderStrings[],
+ size_t numStrings,
+ ShCompileOptions compileOptions)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+
+ return compiler->compile(shaderStrings, numStrings, compileOptions);
+}
+
+void ClearResults(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+ compiler->clearResults();
+}
+
+int GetShaderVersion(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+ return compiler->getShaderVersion();
+}
+
+ShShaderOutput GetShaderOutputType(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+ return compiler->getOutputType();
+}
+
+//
+// Return any compiler log of messages for the application.
+//
+const std::string &GetInfoLog(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+
+ TInfoSink &infoSink = compiler->getInfoSink();
+ return infoSink.info.str();
+}
+
+//
+// Return any object code.
+//
+const std::string &GetObjectCode(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+
+ TInfoSink &infoSink = compiler->getInfoSink();
+ return infoSink.obj.str();
+}
+
+const std::map<std::string, std::string> *GetNameHashingMap(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ ASSERT(compiler);
+ return &(compiler->getNameMap());
+}
+
+const std::vector<Uniform> *GetUniforms(const ShHandle handle)
+{
+ return GetShaderVariables<Uniform>(handle);
+}
+
+const std::vector<Varying> *GetInputVaryings(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ if (compiler == nullptr)
+ {
+ return nullptr;
+ }
+ return &compiler->getInputVaryings();
+}
+
+const std::vector<Varying> *GetOutputVaryings(const ShHandle handle)
+{
+ TCompiler *compiler = GetCompilerFromHandle(handle);
+ if (compiler == nullptr)
+ {
+ return nullptr;
+ }
+ return &compiler->getOutputVaryings();
+}
+
+const std::vector<Varying> *GetVaryings(const ShHandle handle)
+{
+ return GetShaderVariables<Varying>(handle);
+}
+
+const std::vector<Attribute> *GetAttributes(const ShHandle handle)
+{
+ return GetShaderVariables<Attribute>(handle);
+}
+
+const std::vector<OutputVariable> *GetOutputVariables(const ShHandle handle)
+{
+ return GetShaderVariables<OutputVariable>(handle);
+}
+
+const std::vector<InterfaceBlock> *GetInterfaceBlocks(const ShHandle handle)
+{
+ return GetShaderVariables<InterfaceBlock>(handle);
+}
+
+const std::vector<InterfaceBlock> *GetUniformBlocks(const ShHandle handle)
+{
+ ASSERT(handle);
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return &compiler->getUniformBlocks();
+}
+
+const std::vector<InterfaceBlock> *GetShaderStorageBlocks(const ShHandle handle)
+{
+ ASSERT(handle);
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return &compiler->getShaderStorageBlocks();
+}
+
+WorkGroupSize GetComputeShaderLocalGroupSize(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return compiler->getComputeShaderLocalSize();
+}
+
+int GetVertexShaderNumViews(const ShHandle handle)
+{
+ ASSERT(handle);
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return compiler->getNumViews();
+}
+
+bool CheckVariablesWithinPackingLimits(int maxVectors, const std::vector<ShaderVariable> &variables)
+{
+ return CheckVariablesInPackingLimits(maxVectors, variables);
+}
+
+bool GetShaderStorageBlockRegister(const ShHandle handle,
+ const std::string &shaderStorageBlockName,
+ unsigned int *indexOut)
+{
+#ifdef ANGLE_ENABLE_HLSL
+ ASSERT(indexOut);
+
+ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+ ASSERT(translator);
+
+ if (!translator->hasShaderStorageBlock(shaderStorageBlockName))
+ {
+ return false;
+ }
+
+ *indexOut = translator->getShaderStorageBlockRegister(shaderStorageBlockName);
+ return true;
+#else
+ return false;
+#endif // ANGLE_ENABLE_HLSL
+}
+
+bool GetUniformBlockRegister(const ShHandle handle,
+ const std::string &uniformBlockName,
+ unsigned int *indexOut)
+{
+#ifdef ANGLE_ENABLE_HLSL
+ ASSERT(indexOut);
+
+ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+ ASSERT(translator);
+
+ if (!translator->hasUniformBlock(uniformBlockName))
+ {
+ return false;
+ }
+
+ *indexOut = translator->getUniformBlockRegister(uniformBlockName);
+ return true;
+#else
+ return false;
+#endif // ANGLE_ENABLE_HLSL
+}
+
+const std::map<std::string, unsigned int> *GetUniformRegisterMap(const ShHandle handle)
+{
+#ifdef ANGLE_ENABLE_HLSL
+ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+ ASSERT(translator);
+
+ return translator->getUniformRegisterMap();
+#else
+ return nullptr;
+#endif // ANGLE_ENABLE_HLSL
+}
+
+unsigned int GetReadonlyImage2DRegisterIndex(const ShHandle handle)
+{
+#ifdef ANGLE_ENABLE_HLSL
+ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+ ASSERT(translator);
+
+ return translator->getReadonlyImage2DRegisterIndex();
+#else
+ return 0;
+#endif // ANGLE_ENABLE_HLSL
+}
+
+unsigned int GetImage2DRegisterIndex(const ShHandle handle)
+{
+#ifdef ANGLE_ENABLE_HLSL
+ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+ ASSERT(translator);
+
+ return translator->getImage2DRegisterIndex();
+#else
+ return 0;
+#endif // ANGLE_ENABLE_HLSL
+}
+
+const std::set<std::string> *GetUsedImage2DFunctionNames(const ShHandle handle)
+{
+#ifdef ANGLE_ENABLE_HLSL
+ TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+ ASSERT(translator);
+
+ return translator->getUsedImage2DFunctionNames();
+#else
+ return nullptr;
+#endif // ANGLE_ENABLE_HLSL
+}
+
+bool HasValidGeometryShaderInputPrimitiveType(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return compiler->getGeometryShaderInputPrimitiveType() != EptUndefined;
+}
+
+bool HasValidGeometryShaderOutputPrimitiveType(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return compiler->getGeometryShaderOutputPrimitiveType() != EptUndefined;
+}
+
+bool HasValidGeometryShaderMaxVertices(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return compiler->getGeometryShaderMaxVertices() >= 0;
+}
+
+GLenum GetGeometryShaderInputPrimitiveType(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return GetGeometryShaderPrimitiveTypeEnum(compiler->getGeometryShaderInputPrimitiveType());
+}
+
+GLenum GetGeometryShaderOutputPrimitiveType(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return GetGeometryShaderPrimitiveTypeEnum(compiler->getGeometryShaderOutputPrimitiveType());
+}
+
+int GetGeometryShaderInvocations(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ return compiler->getGeometryShaderInvocations();
+}
+
+int GetGeometryShaderMaxVertices(const ShHandle handle)
+{
+ ASSERT(handle);
+
+ TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+ TCompiler *compiler = base->getAsCompiler();
+ ASSERT(compiler);
+
+ int maxVertices = compiler->getGeometryShaderMaxVertices();
+ ASSERT(maxVertices >= 0);
+ return maxVertices;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.cpp
new file mode 100644
index 0000000000..01b246d1d7
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.cpp
@@ -0,0 +1,435 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderStorageBlockFunctionHLSL: Wrapper functions for RWByteAddressBuffer Load/Store functions.
+//
+
+#include "compiler/translator/ShaderStorageBlockFunctionHLSL.h"
+
+#include "common/utilities.h"
+#include "compiler/translator/UtilsHLSL.h"
+#include "compiler/translator/blocklayout.h"
+#include "compiler/translator/blocklayoutHLSL.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+// static
+void ShaderStorageBlockFunctionHLSL::OutputSSBOLoadFunctionBody(
+ TInfoSinkBase &out,
+ const ShaderStorageBlockFunction &ssboFunction)
+{
+ const char *convertString;
+ switch (ssboFunction.type.getBasicType())
+ {
+ case EbtFloat:
+ convertString = "asfloat(";
+ break;
+ case EbtInt:
+ convertString = "asint(";
+ break;
+ case EbtUInt:
+ convertString = "asuint(";
+ break;
+ case EbtBool:
+ convertString = "asint(";
+ break;
+ default:
+ UNREACHABLE();
+ return;
+ }
+
+ size_t bytesPerComponent =
+ gl::VariableComponentSize(gl::VariableComponentType(GLVariableType(ssboFunction.type)));
+ out << " " << ssboFunction.typeString << " result";
+ if (ssboFunction.type.isScalar())
+ {
+ size_t offset = ssboFunction.swizzleOffsets[0] * bytesPerComponent;
+ out << " = " << convertString << "buffer.Load(loc + " << offset << "));\n ";
+ }
+ else if (ssboFunction.type.isVector())
+ {
+ if (ssboFunction.rowMajor || !ssboFunction.isDefaultSwizzle)
+ {
+ size_t componentStride = bytesPerComponent;
+ if (ssboFunction.rowMajor)
+ {
+ componentStride = ssboFunction.matrixStride;
+ }
+
+ out << " = {";
+ for (const int offset : ssboFunction.swizzleOffsets)
+ {
+ size_t offsetInBytes = offset * componentStride;
+ out << convertString << "buffer.Load(loc + " << offsetInBytes << ")),";
+ }
+ out << "};\n";
+ }
+ else
+ {
+ out << " = " << convertString << "buffer.Load" << ssboFunction.type.getNominalSize()
+ << "(loc));\n";
+ }
+ }
+ else if (ssboFunction.type.isMatrix())
+ {
+ if (ssboFunction.rowMajor)
+ {
+ out << ";";
+ out << " float" << ssboFunction.type.getRows() << "x" << ssboFunction.type.getCols()
+ << " tmp_ = {";
+ for (int rowIndex = 0; rowIndex < ssboFunction.type.getRows(); rowIndex++)
+ {
+ out << "asfloat(buffer.Load" << ssboFunction.type.getCols() << "(loc + "
+ << rowIndex * ssboFunction.matrixStride << ")), ";
+ }
+ out << "};\n";
+ out << " result = transpose(tmp_);\n";
+ }
+ else
+ {
+ out << " = {";
+ for (int columnIndex = 0; columnIndex < ssboFunction.type.getCols(); columnIndex++)
+ {
+ out << "asfloat(buffer.Load" << ssboFunction.type.getRows() << "(loc + "
+ << columnIndex * ssboFunction.matrixStride << ")), ";
+ }
+ out << "};\n";
+ }
+ }
+ else
+ {
+ // TODO(jiajia.qin@intel.com): Process all possible return types. http://anglebug.com/1951
+ out << ";\n";
+ }
+
+ out << " return result;\n";
+ return;
+}
+
+// static
+void ShaderStorageBlockFunctionHLSL::OutputSSBOStoreFunctionBody(
+ TInfoSinkBase &out,
+ const ShaderStorageBlockFunction &ssboFunction)
+{
+ size_t bytesPerComponent =
+ gl::VariableComponentSize(gl::VariableComponentType(GLVariableType(ssboFunction.type)));
+ if (ssboFunction.type.isScalar())
+ {
+ size_t offset = ssboFunction.swizzleOffsets[0] * bytesPerComponent;
+ if (ssboFunction.type.getBasicType() == EbtBool)
+ {
+ out << " buffer.Store(loc + " << offset << ", uint(value));\n";
+ }
+ else
+ {
+ out << " buffer.Store(loc + " << offset << ", asuint(value));\n";
+ }
+ }
+ else if (ssboFunction.type.isVector())
+ {
+ out << " uint" << ssboFunction.type.getNominalSize() << " _value;\n";
+ if (ssboFunction.type.getBasicType() == EbtBool)
+ {
+ out << " _value = uint" << ssboFunction.type.getNominalSize() << "(value);\n";
+ }
+ else
+ {
+ out << " _value = asuint(value);\n";
+ }
+
+ if (ssboFunction.rowMajor || !ssboFunction.isDefaultSwizzle)
+ {
+ size_t componentStride = bytesPerComponent;
+ if (ssboFunction.rowMajor)
+ {
+ componentStride = ssboFunction.matrixStride;
+ }
+ const TVector<int> &swizzleOffsets = ssboFunction.swizzleOffsets;
+ for (int index = 0; index < static_cast<int>(swizzleOffsets.size()); index++)
+ {
+ size_t offsetInBytes = swizzleOffsets[index] * componentStride;
+ out << "buffer.Store(loc + " << offsetInBytes << ", _value[" << index << "]);\n";
+ }
+ }
+ else
+ {
+ out << " buffer.Store" << ssboFunction.type.getNominalSize() << "(loc, _value);\n";
+ }
+ }
+ else if (ssboFunction.type.isMatrix())
+ {
+ if (ssboFunction.rowMajor)
+ {
+ out << " float" << ssboFunction.type.getRows() << "x" << ssboFunction.type.getCols()
+ << " tmp_ = transpose(value);\n";
+ for (int rowIndex = 0; rowIndex < ssboFunction.type.getRows(); rowIndex++)
+ {
+ out << " buffer.Store" << ssboFunction.type.getCols() << "(loc + "
+ << rowIndex * ssboFunction.matrixStride << ", asuint(tmp_[" << rowIndex
+ << "]));\n";
+ }
+ }
+ else
+ {
+ for (int columnIndex = 0; columnIndex < ssboFunction.type.getCols(); columnIndex++)
+ {
+ out << " buffer.Store" << ssboFunction.type.getRows() << "(loc + "
+ << columnIndex * ssboFunction.matrixStride << ", asuint(value[" << columnIndex
+ << "]));\n";
+ }
+ }
+ }
+ else
+ {
+ // TODO(jiajia.qin@intel.com): Process all possible return types. http://anglebug.com/1951
+ }
+}
+
+// static
+void ShaderStorageBlockFunctionHLSL::OutputSSBOLengthFunctionBody(TInfoSinkBase &out,
+ int unsizedArrayStride)
+{
+ out << " uint dim = 0;\n";
+ out << " buffer.GetDimensions(dim);\n";
+ out << " return int((dim - loc)/uint(" << unsizedArrayStride << "));\n";
+}
+
+// static
+void ShaderStorageBlockFunctionHLSL::OutputSSBOAtomicMemoryFunctionBody(
+ TInfoSinkBase &out,
+ const ShaderStorageBlockFunction &ssboFunction)
+{
+ out << " " << ssboFunction.typeString << " original_value;\n";
+ switch (ssboFunction.method)
+ {
+ case SSBOMethod::ATOMIC_ADD:
+ out << " buffer.InterlockedAdd(loc, value, original_value);\n";
+ break;
+ case SSBOMethod::ATOMIC_MIN:
+ out << " buffer.InterlockedMin(loc, value, original_value);\n";
+ break;
+ case SSBOMethod::ATOMIC_MAX:
+ out << " buffer.InterlockedMax(loc, value, original_value);\n";
+ break;
+ case SSBOMethod::ATOMIC_AND:
+ out << " buffer.InterlockedAnd(loc, value, original_value);\n";
+ break;
+ case SSBOMethod::ATOMIC_OR:
+ out << " buffer.InterlockedOr(loc, value, original_value);\n";
+ break;
+ case SSBOMethod::ATOMIC_XOR:
+ out << " buffer.InterlockedXor(loc, value, original_value);\n";
+ break;
+ case SSBOMethod::ATOMIC_EXCHANGE:
+ out << " buffer.InterlockedExchange(loc, value, original_value);\n";
+ break;
+ case SSBOMethod::ATOMIC_COMPSWAP:
+ out << " buffer.InterlockedCompareExchange(loc, compare_value, value, "
+ "original_value);\n";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ out << " return original_value;\n";
+}
+
+bool ShaderStorageBlockFunctionHLSL::ShaderStorageBlockFunction::operator<(
+ const ShaderStorageBlockFunction &rhs) const
+{
+ return functionName < rhs.functionName;
+}
+
+TString ShaderStorageBlockFunctionHLSL::registerShaderStorageBlockFunction(
+ const TType &type,
+ SSBOMethod method,
+ TLayoutBlockStorage storage,
+ bool rowMajor,
+ int matrixStride,
+ int unsizedArrayStride,
+ TIntermSwizzle *swizzleNode)
+{
+ ShaderStorageBlockFunction ssboFunction;
+ ssboFunction.typeString = TypeString(type);
+ ssboFunction.method = method;
+ switch (method)
+ {
+ case SSBOMethod::LOAD:
+ ssboFunction.functionName = "_Load_";
+ break;
+ case SSBOMethod::STORE:
+ ssboFunction.functionName = "_Store_";
+ break;
+ case SSBOMethod::LENGTH:
+ ssboFunction.unsizedArrayStride = unsizedArrayStride;
+ ssboFunction.functionName = "_Length_" + str(unsizedArrayStride);
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_ADD:
+ ssboFunction.functionName = "_ssbo_atomicAdd_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_MIN:
+ ssboFunction.functionName = "_ssbo_atomicMin_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_MAX:
+ ssboFunction.functionName = "_ssbo_atomicMax_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_AND:
+ ssboFunction.functionName = "_ssbo_atomicAnd_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_OR:
+ ssboFunction.functionName = "_ssbo_atomicOr_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_XOR:
+ ssboFunction.functionName = "_ssbo_atomicXor_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_EXCHANGE:
+ ssboFunction.functionName = "_ssbo_atomicExchange_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ case SSBOMethod::ATOMIC_COMPSWAP:
+ ssboFunction.functionName = "_ssbo_atomicCompSwap_" + ssboFunction.typeString;
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+ default:
+ UNREACHABLE();
+ }
+
+ ssboFunction.functionName += ssboFunction.typeString;
+ ssboFunction.type = type;
+ if (swizzleNode != nullptr)
+ {
+ ssboFunction.swizzleOffsets = swizzleNode->getSwizzleOffsets();
+ ssboFunction.isDefaultSwizzle = false;
+ }
+ else
+ {
+ if (ssboFunction.type.getNominalSize() > 1)
+ {
+ for (int index = 0; index < ssboFunction.type.getNominalSize(); index++)
+ {
+ ssboFunction.swizzleOffsets.push_back(index);
+ }
+ }
+ else
+ {
+ ssboFunction.swizzleOffsets.push_back(0);
+ }
+
+ ssboFunction.isDefaultSwizzle = true;
+ }
+ ssboFunction.rowMajor = rowMajor;
+ ssboFunction.matrixStride = matrixStride;
+ ssboFunction.functionName += "_" + TString(getBlockStorageString(storage));
+
+ if (rowMajor)
+ {
+ ssboFunction.functionName += "_rm_";
+ }
+ else
+ {
+ ssboFunction.functionName += "_cm_";
+ }
+
+ for (const int offset : ssboFunction.swizzleOffsets)
+ {
+ switch (offset)
+ {
+ case 0:
+ ssboFunction.functionName += "x";
+ break;
+ case 1:
+ ssboFunction.functionName += "y";
+ break;
+ case 2:
+ ssboFunction.functionName += "z";
+ break;
+ case 3:
+ ssboFunction.functionName += "w";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ mRegisteredShaderStorageBlockFunctions.insert(ssboFunction);
+ return ssboFunction.functionName;
+}
+
+void ShaderStorageBlockFunctionHLSL::shaderStorageBlockFunctionHeader(TInfoSinkBase &out)
+{
+ for (const ShaderStorageBlockFunction &ssboFunction : mRegisteredShaderStorageBlockFunctions)
+ {
+ switch (ssboFunction.method)
+ {
+ case SSBOMethod::LOAD:
+ {
+ // Function header
+ out << ssboFunction.typeString << " " << ssboFunction.functionName
+ << "(RWByteAddressBuffer buffer, uint loc)\n";
+ out << "{\n";
+ OutputSSBOLoadFunctionBody(out, ssboFunction);
+ break;
+ }
+ case SSBOMethod::STORE:
+ {
+ // Function header
+ out << "void " << ssboFunction.functionName
+ << "(RWByteAddressBuffer buffer, uint loc, " << ssboFunction.typeString
+ << " value)\n";
+ out << "{\n";
+ OutputSSBOStoreFunctionBody(out, ssboFunction);
+ break;
+ }
+ case SSBOMethod::LENGTH:
+ {
+ out << "int " << ssboFunction.functionName
+ << "(RWByteAddressBuffer buffer, uint loc)\n";
+ out << "{\n";
+ OutputSSBOLengthFunctionBody(out, ssboFunction.unsizedArrayStride);
+ break;
+ }
+ case SSBOMethod::ATOMIC_ADD:
+ case SSBOMethod::ATOMIC_MIN:
+ case SSBOMethod::ATOMIC_MAX:
+ case SSBOMethod::ATOMIC_AND:
+ case SSBOMethod::ATOMIC_OR:
+ case SSBOMethod::ATOMIC_XOR:
+ case SSBOMethod::ATOMIC_EXCHANGE:
+ {
+ out << ssboFunction.typeString << " " << ssboFunction.functionName
+ << "(RWByteAddressBuffer buffer, uint loc, " << ssboFunction.typeString
+ << " value)\n";
+ out << "{\n";
+
+ OutputSSBOAtomicMemoryFunctionBody(out, ssboFunction);
+ break;
+ }
+ case SSBOMethod::ATOMIC_COMPSWAP:
+ {
+ out << ssboFunction.typeString << " " << ssboFunction.functionName
+ << "(RWByteAddressBuffer buffer, uint loc, " << ssboFunction.typeString
+ << " compare_value, " << ssboFunction.typeString << " value)\n";
+ out << "{\n";
+ OutputSSBOAtomicMemoryFunctionBody(out, ssboFunction);
+ break;
+ }
+ default:
+ UNREACHABLE();
+ }
+
+ out << "}\n"
+ "\n";
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.h b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.h
new file mode 100644
index 0000000000..0d3cd0291b
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.h
@@ -0,0 +1,94 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderStorageBlockOutputHLSL: A traverser to translate a ssbo_access_chain to an offset of
+// RWByteAddressBuffer.
+// //EOpIndexDirectInterfaceBlock
+// ssbo_variable :=
+// | the name of the SSBO
+// | the name of a variable in an SSBO backed interface block
+
+// // EOpIndexInDirect
+// // EOpIndexDirect
+// ssbo_array_indexing := ssbo_access_chain[expr_no_ssbo]
+
+// // EOpIndexDirectStruct
+// ssbo_structure_access := ssbo_access_chain.identifier
+
+// ssbo_access_chain :=
+// | ssbo_variable
+// | ssbo_array_indexing
+// | ssbo_structure_access
+//
+
+#ifndef COMPILER_TRANSLATOR_SHADERSTORAGEBLOCKFUNCTIONHLSL_H_
+#define COMPILER_TRANSLATOR_SHADERSTORAGEBLOCKFUNCTIONHLSL_H_
+
+#include <set>
+
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/Types.h"
+
+namespace sh
+{
+
+class TIntermSwizzle;
+enum class SSBOMethod
+{
+ LOAD,
+ STORE,
+ LENGTH,
+ ATOMIC_ADD,
+ ATOMIC_MIN,
+ ATOMIC_MAX,
+ ATOMIC_AND,
+ ATOMIC_OR,
+ ATOMIC_XOR,
+ ATOMIC_EXCHANGE,
+ ATOMIC_COMPSWAP
+};
+
+class ShaderStorageBlockFunctionHLSL final : angle::NonCopyable
+{
+ public:
+ TString registerShaderStorageBlockFunction(const TType &type,
+ SSBOMethod method,
+ TLayoutBlockStorage storage,
+ bool rowMajor,
+ int matrixStride,
+ int unsizedArrayStride,
+ TIntermSwizzle *node);
+
+ void shaderStorageBlockFunctionHeader(TInfoSinkBase &out);
+
+ private:
+ struct ShaderStorageBlockFunction
+ {
+ bool operator<(const ShaderStorageBlockFunction &rhs) const;
+ TString functionName;
+ TString typeString;
+ SSBOMethod method;
+ TType type;
+ bool rowMajor;
+ int matrixStride;
+ int unsizedArrayStride;
+ TVector<int> swizzleOffsets;
+ bool isDefaultSwizzle;
+ };
+
+ static void OutputSSBOLoadFunctionBody(TInfoSinkBase &out,
+ const ShaderStorageBlockFunction &ssboFunction);
+ static void OutputSSBOStoreFunctionBody(TInfoSinkBase &out,
+ const ShaderStorageBlockFunction &ssboFunction);
+ static void OutputSSBOLengthFunctionBody(TInfoSinkBase &out, int unsizedArrayStride);
+ static void OutputSSBOAtomicMemoryFunctionBody(TInfoSinkBase &out,
+ const ShaderStorageBlockFunction &ssboFunction);
+ using ShaderStorageBlockFunctionSet = std::set<ShaderStorageBlockFunction>;
+ ShaderStorageBlockFunctionSet mRegisteredShaderStorageBlockFunctions;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_SHADERSTORAGEBLOCKFUNCTIONHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.cpp
new file mode 100644
index 0000000000..bef88db386
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.cpp
@@ -0,0 +1,762 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderStorageBlockOutputHLSL: A traverser to translate a ssbo_access_chain to an offset of
+// RWByteAddressBuffer.
+// //EOpIndexDirectInterfaceBlock
+// ssbo_variable :=
+// | the name of the SSBO
+// | the name of a variable in an SSBO backed interface block
+
+// // EOpIndexInDirect
+// // EOpIndexDirect
+// ssbo_array_indexing := ssbo_access_chain[expr_no_ssbo]
+
+// // EOpIndexDirectStruct
+// ssbo_structure_access := ssbo_access_chain.identifier
+
+// ssbo_access_chain :=
+// | ssbo_variable
+// | ssbo_array_indexing
+// | ssbo_structure_access
+//
+
+#include "compiler/translator/ShaderStorageBlockOutputHLSL.h"
+
+#include "compiler/translator/ResourcesHLSL.h"
+#include "compiler/translator/blocklayoutHLSL.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void GetBlockLayoutInfo(TIntermTyped *node,
+ bool rowMajorAlreadyAssigned,
+ TLayoutBlockStorage *storage,
+ bool *rowMajor)
+{
+ TIntermSwizzle *swizzleNode = node->getAsSwizzleNode();
+ if (swizzleNode)
+ {
+ return GetBlockLayoutInfo(swizzleNode->getOperand(), rowMajorAlreadyAssigned, storage,
+ rowMajor);
+ }
+
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+ if (binaryNode)
+ {
+ switch (binaryNode->getOp())
+ {
+ case EOpIndexDirectInterfaceBlock:
+ {
+ // The column_major/row_major qualifier of a field member overrides the interface
+ // block's row_major/column_major. So we can assign rowMajor here and don't need to
+ // assign it again. But we still need to call recursively to get the storage's
+ // value.
+ const TType &type = node->getType();
+ *rowMajor = type.getLayoutQualifier().matrixPacking == EmpRowMajor;
+ return GetBlockLayoutInfo(binaryNode->getLeft(), true, storage, rowMajor);
+ }
+ case EOpIndexIndirect:
+ case EOpIndexDirect:
+ case EOpIndexDirectStruct:
+ return GetBlockLayoutInfo(binaryNode->getLeft(), rowMajorAlreadyAssigned, storage,
+ rowMajor);
+ default:
+ UNREACHABLE();
+ return;
+ }
+ }
+
+ const TType &type = node->getType();
+ ASSERT(type.getQualifier() == EvqBuffer);
+ const TInterfaceBlock *interfaceBlock = type.getInterfaceBlock();
+ ASSERT(interfaceBlock);
+ *storage = interfaceBlock->blockStorage();
+ // If the block doesn't have an instance name, rowMajorAlreadyAssigned will be false. In
+ // this situation, we still need to set rowMajor's value.
+ if (!rowMajorAlreadyAssigned)
+ {
+ *rowMajor = type.getLayoutQualifier().matrixPacking == EmpRowMajor;
+ }
+}
+
+// It's possible that the current type has lost the original layout information. So we should pass
+// the right layout information to GetBlockMemberInfoByType.
+const BlockMemberInfo GetBlockMemberInfoByType(const TType &type,
+ TLayoutBlockStorage storage,
+ bool rowMajor)
+{
+ sh::Std140BlockEncoder std140Encoder;
+ sh::Std430BlockEncoder std430Encoder;
+ sh::HLSLBlockEncoder hlslEncoder(sh::HLSLBlockEncoder::ENCODE_PACKED, false);
+ sh::BlockLayoutEncoder *encoder = nullptr;
+
+ if (storage == EbsStd140)
+ {
+ encoder = &std140Encoder;
+ }
+ else if (storage == EbsStd430)
+ {
+ encoder = &std430Encoder;
+ }
+ else
+ {
+ encoder = &hlslEncoder;
+ }
+
+ std::vector<unsigned int> arraySizes;
+ auto *typeArraySizes = type.getArraySizes();
+ if (typeArraySizes != nullptr)
+ {
+ arraySizes.assign(typeArraySizes->begin(), typeArraySizes->end());
+ }
+ return encoder->encodeType(GLVariableType(type), arraySizes, rowMajor);
+}
+
+const TField *GetFieldMemberInShaderStorageBlock(const TInterfaceBlock *interfaceBlock,
+ const ImmutableString &variableName)
+{
+ for (const TField *field : interfaceBlock->fields())
+ {
+ if (field->name() == variableName)
+ {
+ return field;
+ }
+ }
+ return nullptr;
+}
+
+const InterfaceBlock *FindInterfaceBlock(const TInterfaceBlock *needle,
+ const std::vector<InterfaceBlock> &haystack)
+{
+ for (const InterfaceBlock &block : haystack)
+ {
+ if (strcmp(block.name.c_str(), needle->name().data()) == 0)
+ {
+ ASSERT(block.fields.size() == needle->fields().size());
+ return &block;
+ }
+ }
+
+ UNREACHABLE();
+ return nullptr;
+}
+
+std::string StripArrayIndices(const std::string &nameIn)
+{
+ std::string name = nameIn;
+ size_t pos = name.find('[');
+ while (pos != std::string::npos)
+ {
+ size_t closePos = name.find(']', pos);
+ ASSERT(closePos != std::string::npos);
+ name.erase(pos, closePos - pos + 1);
+ pos = name.find('[', pos);
+ }
+ ASSERT(name.find(']') == std::string::npos);
+ return name;
+}
+
+// Does not include any array indices.
+void MapVariableToField(const ShaderVariable &variable,
+ const TField *field,
+ std::string currentName,
+ ShaderVarToFieldMap *shaderVarToFieldMap)
+{
+ ASSERT((field->type()->getStruct() == nullptr) == variable.fields.empty());
+ (*shaderVarToFieldMap)[currentName] = field;
+
+ if (!variable.fields.empty())
+ {
+ const TStructure *subStruct = field->type()->getStruct();
+ ASSERT(variable.fields.size() == subStruct->fields().size());
+
+ for (size_t index = 0; index < variable.fields.size(); ++index)
+ {
+ const TField *subField = subStruct->fields()[index];
+ const ShaderVariable &subVariable = variable.fields[index];
+ std::string subName = currentName + "." + subVariable.name;
+ MapVariableToField(subVariable, subField, subName, shaderVarToFieldMap);
+ }
+ }
+}
+
+class BlockInfoVisitor final : public BlockEncoderVisitor
+{
+ public:
+ BlockInfoVisitor(const std::string &prefix,
+ TLayoutBlockStorage storage,
+ const ShaderVarToFieldMap &shaderVarToFieldMap,
+ BlockMemberInfoMap *blockInfoOut)
+ : BlockEncoderVisitor(prefix, "", getEncoder(storage)),
+ mShaderVarToFieldMap(shaderVarToFieldMap),
+ mBlockInfoOut(blockInfoOut),
+ mHLSLEncoder(HLSLBlockEncoder::ENCODE_PACKED, false),
+ mStorage(storage)
+ {}
+
+ BlockLayoutEncoder *getEncoder(TLayoutBlockStorage storage)
+ {
+ switch (storage)
+ {
+ case EbsStd140:
+ return &mStd140Encoder;
+ case EbsStd430:
+ return &mStd430Encoder;
+ default:
+ return &mHLSLEncoder;
+ }
+ }
+
+ void enterStructAccess(const ShaderVariable &structVar, bool isRowMajor) override
+ {
+ BlockEncoderVisitor::enterStructAccess(structVar, isRowMajor);
+
+ std::string variableName = StripArrayIndices(collapseNameStack());
+
+ // Remove the trailing "."
+ variableName.pop_back();
+
+ BlockInfoVisitor childVisitor(variableName, mStorage, mShaderVarToFieldMap, mBlockInfoOut);
+ childVisitor.getEncoder(mStorage)->enterAggregateType(structVar);
+ TraverseShaderVariables(structVar.fields, isRowMajor, &childVisitor);
+ childVisitor.getEncoder(mStorage)->exitAggregateType(structVar);
+
+ int offset = getEncoder(mStorage)->getCurrentOffset();
+ int arrayStride = childVisitor.getEncoder(mStorage)->getCurrentOffset();
+
+ auto iter = mShaderVarToFieldMap.find(variableName);
+ if (iter == mShaderVarToFieldMap.end())
+ return;
+
+ const TField *structField = iter->second;
+ if (mBlockInfoOut->count(structField) == 0)
+ {
+ mBlockInfoOut->emplace(structField, BlockMemberInfo(offset, arrayStride, -1, false));
+ }
+ }
+
+ void encodeVariable(const ShaderVariable &variable,
+ const BlockMemberInfo &variableInfo,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ auto iter = mShaderVarToFieldMap.find(StripArrayIndices(name));
+ if (iter == mShaderVarToFieldMap.end())
+ return;
+
+ const TField *field = iter->second;
+ if (mBlockInfoOut->count(field) == 0)
+ {
+ mBlockInfoOut->emplace(field, variableInfo);
+ }
+ }
+
+ private:
+ const ShaderVarToFieldMap &mShaderVarToFieldMap;
+ BlockMemberInfoMap *mBlockInfoOut;
+ Std140BlockEncoder mStd140Encoder;
+ Std430BlockEncoder mStd430Encoder;
+ HLSLBlockEncoder mHLSLEncoder;
+ TLayoutBlockStorage mStorage;
+};
+
+void GetShaderStorageBlockMembersInfo(const TInterfaceBlock *interfaceBlock,
+ const std::vector<InterfaceBlock> &shaderStorageBlocks,
+ BlockMemberInfoMap *blockInfoOut)
+{
+ // Find the sh::InterfaceBlock.
+ const InterfaceBlock *block = FindInterfaceBlock(interfaceBlock, shaderStorageBlocks);
+ ASSERT(block);
+
+ // Map ShaderVariable to TField.
+ ShaderVarToFieldMap shaderVarToFieldMap;
+ for (size_t index = 0; index < block->fields.size(); ++index)
+ {
+ const TField *field = interfaceBlock->fields()[index];
+ const ShaderVariable &variable = block->fields[index];
+ MapVariableToField(variable, field, variable.name, &shaderVarToFieldMap);
+ }
+
+ BlockInfoVisitor visitor("", interfaceBlock->blockStorage(), shaderVarToFieldMap, blockInfoOut);
+ TraverseShaderVariables(block->fields, false, &visitor);
+}
+
+bool IsInArrayOfArraysChain(TIntermTyped *node)
+{
+ if (node->getType().isArrayOfArrays())
+ return true;
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+ if (binaryNode)
+ {
+ if (binaryNode->getLeft()->getType().isArrayOfArrays())
+ return true;
+ }
+
+ return false;
+}
+} // anonymous namespace
+
+ShaderStorageBlockOutputHLSL::ShaderStorageBlockOutputHLSL(
+ OutputHLSL *outputHLSL,
+ TSymbolTable *symbolTable,
+ ResourcesHLSL *resourcesHLSL,
+ const std::vector<InterfaceBlock> &shaderStorageBlocks)
+ : TIntermTraverser(true, true, true, symbolTable),
+ mMatrixStride(0),
+ mRowMajor(false),
+ mLocationAsTheLastArgument(false),
+ mOutputHLSL(outputHLSL),
+ mResourcesHLSL(resourcesHLSL),
+ mShaderStorageBlocks(shaderStorageBlocks)
+{
+ mSSBOFunctionHLSL = new ShaderStorageBlockFunctionHLSL;
+}
+
+ShaderStorageBlockOutputHLSL::~ShaderStorageBlockOutputHLSL()
+{
+ SafeDelete(mSSBOFunctionHLSL);
+}
+
+void ShaderStorageBlockOutputHLSL::outputStoreFunctionCallPrefix(TIntermTyped *node)
+{
+ mLocationAsTheLastArgument = false;
+ traverseSSBOAccess(node, SSBOMethod::STORE);
+}
+
+void ShaderStorageBlockOutputHLSL::outputLoadFunctionCall(TIntermTyped *node)
+{
+ mLocationAsTheLastArgument = true;
+ traverseSSBOAccess(node, SSBOMethod::LOAD);
+}
+
+void ShaderStorageBlockOutputHLSL::outputLengthFunctionCall(TIntermTyped *node)
+{
+ mLocationAsTheLastArgument = true;
+ traverseSSBOAccess(node, SSBOMethod::LENGTH);
+}
+
+void ShaderStorageBlockOutputHLSL::outputAtomicMemoryFunctionCallPrefix(TIntermTyped *node,
+ TOperator op)
+{
+ mLocationAsTheLastArgument = false;
+
+ switch (op)
+ {
+ case EOpAtomicAdd:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_ADD);
+ break;
+ case EOpAtomicMin:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_MIN);
+ break;
+ case EOpAtomicMax:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_MAX);
+ break;
+ case EOpAtomicAnd:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_AND);
+ break;
+ case EOpAtomicOr:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_OR);
+ break;
+ case EOpAtomicXor:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_XOR);
+ break;
+ case EOpAtomicExchange:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_EXCHANGE);
+ break;
+ case EOpAtomicCompSwap:
+ traverseSSBOAccess(node, SSBOMethod::ATOMIC_COMPSWAP);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+// Note that we must calculate the matrix stride here instead of ShaderStorageBlockFunctionHLSL.
+// It's because that if the current node's type is a vector which comes from a matrix, we will
+// lose the matrix type info once we enter ShaderStorageBlockFunctionHLSL.
+void ShaderStorageBlockOutputHLSL::setMatrixStride(TIntermTyped *node,
+ TLayoutBlockStorage storage,
+ bool rowMajor)
+{
+ if (node->getType().isMatrix())
+ {
+ mMatrixStride = GetBlockMemberInfoByType(node->getType(), storage, rowMajor).matrixStride;
+ mRowMajor = rowMajor;
+ return;
+ }
+
+ if (node->getType().isVector())
+ {
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+ if (binaryNode)
+ {
+ return setMatrixStride(binaryNode->getLeft(), storage, rowMajor);
+ }
+ else
+ {
+ TIntermSwizzle *swizzleNode = node->getAsSwizzleNode();
+ if (swizzleNode)
+ {
+ return setMatrixStride(swizzleNode->getOperand(), storage, rowMajor);
+ }
+ }
+ }
+}
+
+void ShaderStorageBlockOutputHLSL::traverseSSBOAccess(TIntermTyped *node, SSBOMethod method)
+{
+ mMatrixStride = 0;
+ mRowMajor = false;
+
+ // Note that we don't have correct BlockMemberInfo from mBlockMemberInfoMap at the current
+ // point. But we must use those information to generate the right function name. So here we have
+ // to calculate them again.
+ TLayoutBlockStorage storage;
+ bool rowMajor;
+ GetBlockLayoutInfo(node, false, &storage, &rowMajor);
+ int unsizedArrayStride = 0;
+ if (node->getType().isUnsizedArray())
+ {
+ unsizedArrayStride =
+ GetBlockMemberInfoByType(node->getType(), storage, rowMajor).arrayStride;
+ }
+ setMatrixStride(node, storage, rowMajor);
+
+ const TString &functionName = mSSBOFunctionHLSL->registerShaderStorageBlockFunction(
+ node->getType(), method, storage, mRowMajor, mMatrixStride, unsizedArrayStride,
+ node->getAsSwizzleNode());
+ TInfoSinkBase &out = mOutputHLSL->getInfoSink();
+ out << functionName;
+ out << "(";
+ node->traverse(this);
+}
+
+void ShaderStorageBlockOutputHLSL::writeShaderStorageBlocksHeader(TInfoSinkBase &out) const
+{
+ out << mResourcesHLSL->shaderStorageBlocksHeader(mReferencedShaderStorageBlocks);
+ mSSBOFunctionHLSL->shaderStorageBlockFunctionHeader(out);
+}
+
+// Check if the current node is the end of the SSBO access chain. If true, we should output ')' for
+// Load method.
+bool ShaderStorageBlockOutputHLSL::isEndOfSSBOAccessChain()
+{
+ TIntermNode *parent = getParentNode();
+ if (parent)
+ {
+ TIntermBinary *parentBinary = parent->getAsBinaryNode();
+ if (parentBinary != nullptr)
+ {
+ switch (parentBinary->getOp())
+ {
+ case EOpIndexDirectStruct:
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ {
+ return false;
+ }
+ default:
+ return true;
+ }
+ }
+
+ const TIntermSwizzle *parentSwizzle = parent->getAsSwizzleNode();
+ if (parentSwizzle)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+void ShaderStorageBlockOutputHLSL::visitSymbol(TIntermSymbol *node)
+{
+ TInfoSinkBase &out = mOutputHLSL->getInfoSink();
+ const TVariable &variable = node->variable();
+ TQualifier qualifier = variable.getType().getQualifier();
+
+ if (qualifier == EvqBuffer)
+ {
+ const TType &variableType = variable.getType();
+ const TInterfaceBlock *interfaceBlock = variableType.getInterfaceBlock();
+ ASSERT(interfaceBlock);
+ if (mReferencedShaderStorageBlocks.count(interfaceBlock->uniqueId().get()) == 0)
+ {
+ const TVariable *instanceVariable = nullptr;
+ if (variableType.isInterfaceBlock())
+ {
+ instanceVariable = &variable;
+ }
+ mReferencedShaderStorageBlocks[interfaceBlock->uniqueId().get()] =
+ new TReferencedBlock(interfaceBlock, instanceVariable);
+ GetShaderStorageBlockMembersInfo(interfaceBlock, mShaderStorageBlocks,
+ &mBlockMemberInfoMap);
+ }
+ if (variableType.isInterfaceBlock())
+ {
+ out << DecorateVariableIfNeeded(variable);
+ }
+ else
+ {
+ out << Decorate(interfaceBlock->name());
+ out << ", ";
+
+ const TField *field =
+ GetFieldMemberInShaderStorageBlock(interfaceBlock, variable.name());
+ writeDotOperatorOutput(out, field);
+ }
+ }
+ else
+ {
+ return mOutputHLSL->visitSymbol(node);
+ }
+}
+
+void ShaderStorageBlockOutputHLSL::visitConstantUnion(TIntermConstantUnion *node)
+{
+ mOutputHLSL->visitConstantUnion(node);
+}
+
+bool ShaderStorageBlockOutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ return mOutputHLSL->visitAggregate(visit, node);
+}
+
+bool ShaderStorageBlockOutputHLSL::visitTernary(Visit visit, TIntermTernary *node)
+{
+ return mOutputHLSL->visitTernary(visit, node);
+}
+
+bool ShaderStorageBlockOutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
+{
+ return mOutputHLSL->visitUnary(visit, node);
+}
+
+bool ShaderStorageBlockOutputHLSL::visitSwizzle(Visit visit, TIntermSwizzle *node)
+{
+ if (visit == PostVisit)
+ {
+ if (!IsInShaderStorageBlock(node))
+ {
+ return mOutputHLSL->visitSwizzle(visit, node);
+ }
+
+ TInfoSinkBase &out = mOutputHLSL->getInfoSink();
+ // TODO(jiajia.qin@intel.com): add swizzle process if the swizzle node is not the last node
+ // of ssbo access chain. Such as, data.xy[0]
+ if (mLocationAsTheLastArgument && isEndOfSSBOAccessChain())
+ {
+ out << ")";
+ }
+ }
+ return true;
+}
+
+bool ShaderStorageBlockOutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
+{
+ TInfoSinkBase &out = mOutputHLSL->getInfoSink();
+
+ switch (node->getOp())
+ {
+ case EOpIndexDirect:
+ {
+ if (!IsInShaderStorageBlock(node->getLeft()))
+ {
+ return mOutputHLSL->visitBinary(visit, node);
+ }
+
+ const TType &leftType = node->getLeft()->getType();
+ if (leftType.isInterfaceBlock())
+ {
+ if (visit == PreVisit)
+ {
+ ASSERT(leftType.getQualifier() == EvqBuffer);
+ TIntermSymbol *instanceArraySymbol = node->getLeft()->getAsSymbolNode();
+ const TInterfaceBlock *interfaceBlock = leftType.getInterfaceBlock();
+
+ if (mReferencedShaderStorageBlocks.count(interfaceBlock->uniqueId().get()) == 0)
+ {
+ mReferencedShaderStorageBlocks[interfaceBlock->uniqueId().get()] =
+ new TReferencedBlock(interfaceBlock, &instanceArraySymbol->variable());
+ GetShaderStorageBlockMembersInfo(interfaceBlock, mShaderStorageBlocks,
+ &mBlockMemberInfoMap);
+ }
+
+ const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0);
+ out << mResourcesHLSL->InterfaceBlockInstanceString(
+ instanceArraySymbol->getName(), arrayIndex);
+ return false;
+ }
+ }
+ else
+ {
+ writeEOpIndexDirectOrIndirectOutput(out, visit, node);
+ }
+ break;
+ }
+ case EOpIndexIndirect:
+ {
+ if (!IsInShaderStorageBlock(node->getLeft()))
+ {
+ return mOutputHLSL->visitBinary(visit, node);
+ }
+
+ // We do not currently support indirect references to interface blocks
+ ASSERT(node->getLeft()->getBasicType() != EbtInterfaceBlock);
+ writeEOpIndexDirectOrIndirectOutput(out, visit, node);
+ break;
+ }
+ case EOpIndexDirectStruct:
+ {
+ if (!IsInShaderStorageBlock(node->getLeft()))
+ {
+ return mOutputHLSL->visitBinary(visit, node);
+ }
+
+ if (visit == InVisit)
+ {
+ ASSERT(IsInShaderStorageBlock(node->getLeft()));
+ const TStructure *structure = node->getLeft()->getType().getStruct();
+ const TIntermConstantUnion *index = node->getRight()->getAsConstantUnion();
+ const TField *field = structure->fields()[index->getIConst(0)];
+ out << " + ";
+ writeDotOperatorOutput(out, field);
+ return false;
+ }
+ break;
+ }
+ case EOpIndexDirectInterfaceBlock:
+ if (!IsInShaderStorageBlock(node->getLeft()))
+ {
+ return mOutputHLSL->visitBinary(visit, node);
+ }
+
+ if (visit == InVisit)
+ {
+ ASSERT(IsInShaderStorageBlock(node->getLeft()));
+ out << ", ";
+ const TInterfaceBlock *interfaceBlock =
+ node->getLeft()->getType().getInterfaceBlock();
+ const TIntermConstantUnion *index = node->getRight()->getAsConstantUnion();
+ const TField *field = interfaceBlock->fields()[index->getIConst(0)];
+ writeDotOperatorOutput(out, field);
+ return false;
+ }
+ break;
+ default:
+ // It may have other operators in EOpIndexIndirect. Such as buffer.attribs[(y * gridSize
+ // + x) * 6u + 0u]
+ return mOutputHLSL->visitBinary(visit, node);
+ }
+
+ return true;
+}
+
+void ShaderStorageBlockOutputHLSL::writeEOpIndexDirectOrIndirectOutput(TInfoSinkBase &out,
+ Visit visit,
+ TIntermBinary *node)
+{
+ ASSERT(IsInShaderStorageBlock(node->getLeft()));
+ if (visit == InVisit)
+ {
+ const TType &type = node->getLeft()->getType();
+ // For array of arrays, we calculate the offset using the formula below:
+ // elementStride * (a3 * a2 * a1 * i0 + a3 * a2 * i1 + a3 * i2 + i3)
+ // Note: assume that there are 4 dimensions.
+ // a0, a1, a2, a3 is the size of the array in each dimension. (S s[a0][a1][a2][a3])
+ // i0, i1, i2, i3 is the index of the array in each dimension. (s[i0][i1][i2][i3])
+ if (IsInArrayOfArraysChain(node->getLeft()))
+ {
+ if (type.isArrayOfArrays())
+ {
+ const TVector<unsigned int> &arraySizes = *type.getArraySizes();
+ // Don't need to concern the tail comma which will be used to multiply the index.
+ for (unsigned int i = 0; i < (arraySizes.size() - 1); i++)
+ {
+ out << arraySizes[i];
+ out << " * ";
+ }
+ }
+ }
+ else
+ {
+ if (node->getType().isVector() && type.isMatrix())
+ {
+ if (mRowMajor)
+ {
+ out << " + " << str(BlockLayoutEncoder::kBytesPerComponent);
+ }
+ else
+ {
+ out << " + " << str(mMatrixStride);
+ }
+ }
+ else if (node->getType().isScalar() && !type.isArray())
+ {
+ if (mRowMajor)
+ {
+ out << " + " << str(mMatrixStride);
+ }
+ else
+ {
+ out << " + " << str(BlockLayoutEncoder::kBytesPerComponent);
+ }
+ }
+
+ out << " * ";
+ }
+ }
+ else if (visit == PostVisit)
+ {
+ // This is used to output the '+' in the array of arrays formula in above.
+ if (node->getType().isArray() && !isEndOfSSBOAccessChain())
+ {
+ out << " + ";
+ }
+ // This corresponds to '(' in writeDotOperatorOutput when fieldType.isArrayOfArrays() is
+ // true.
+ if (IsInArrayOfArraysChain(node->getLeft()) && !node->getType().isArray())
+ {
+ out << ")";
+ }
+ if (mLocationAsTheLastArgument && isEndOfSSBOAccessChain())
+ {
+ out << ")";
+ }
+ }
+}
+
+void ShaderStorageBlockOutputHLSL::writeDotOperatorOutput(TInfoSinkBase &out, const TField *field)
+{
+ auto fieldInfoIter = mBlockMemberInfoMap.find(field);
+ ASSERT(fieldInfoIter != mBlockMemberInfoMap.end());
+ const BlockMemberInfo &memberInfo = fieldInfoIter->second;
+ mMatrixStride = memberInfo.matrixStride;
+ mRowMajor = memberInfo.isRowMajorMatrix;
+ out << memberInfo.offset;
+
+ const TType &fieldType = *field->type();
+ if (fieldType.isArray() && !isEndOfSSBOAccessChain())
+ {
+ out << " + ";
+ out << memberInfo.arrayStride;
+ if (fieldType.isArrayOfArrays())
+ {
+ out << " * (";
+ }
+ }
+ if (mLocationAsTheLastArgument && isEndOfSSBOAccessChain())
+ {
+ out << ")";
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.h b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.h
new file mode 100644
index 0000000000..2ef2364129
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.h
@@ -0,0 +1,92 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderStorageBlockOutputHLSL: A traverser to translate a buffer variable of shader storage block
+// to an offset of RWByteAddressBuffer.
+//
+
+#ifndef COMPILER_TRANSLATOR_SHADERSTORAGEBLOCKOUTPUTHLSL_H_
+#define COMPILER_TRANSLATOR_SHADERSTORAGEBLOCKOUTPUTHLSL_H_
+
+#include "compiler/translator/ShaderStorageBlockFunctionHLSL.h"
+#include "compiler/translator/blocklayout.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+class ResourcesHLSL;
+class OutputHLSL;
+class TSymbolTable;
+
+struct TReferencedBlock : angle::NonCopyable
+{
+ POOL_ALLOCATOR_NEW_DELETE
+ TReferencedBlock(const TInterfaceBlock *block, const TVariable *instanceVariable);
+ const TInterfaceBlock *block;
+ const TVariable *instanceVariable; // May be nullptr if the block is not instanced.
+};
+
+// Maps from uniqueId to a variable.
+using ReferencedInterfaceBlocks = std::map<int, const TReferencedBlock *>;
+
+// Used to save shader storage block field member information.
+using BlockMemberInfoMap = std::map<const TField *, BlockMemberInfo>;
+
+using ShaderVarToFieldMap = std::map<std::string, const TField *>;
+
+class ShaderStorageBlockOutputHLSL : public TIntermTraverser
+{
+ public:
+ ShaderStorageBlockOutputHLSL(OutputHLSL *outputHLSL,
+ TSymbolTable *symbolTable,
+ ResourcesHLSL *resourcesHLSL,
+ const std::vector<InterfaceBlock> &shaderStorageBlocks);
+
+ ~ShaderStorageBlockOutputHLSL();
+
+ // This writes part of the function call to store a value to a SSBO to the output stream. After
+ // calling this, ", <stored value>)" should be written to the output stream to complete the
+ // function call.
+ void outputStoreFunctionCallPrefix(TIntermTyped *node);
+ // This writes the function call to load a SSBO value to the output stream.
+ void outputLoadFunctionCall(TIntermTyped *node);
+ // This writes the function call to get the lengh of unsized array member of SSBO.
+ void outputLengthFunctionCall(TIntermTyped *node);
+ // Writes the atomic memory function calls for SSBO.
+ void outputAtomicMemoryFunctionCallPrefix(TIntermTyped *node, TOperator op);
+
+ void writeShaderStorageBlocksHeader(TInfoSinkBase &out) const;
+
+ protected:
+ void visitSymbol(TIntermSymbol *) override;
+ void visitConstantUnion(TIntermConstantUnion *) override;
+ bool visitSwizzle(Visit visit, TIntermSwizzle *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *) override;
+ bool visitUnary(Visit visit, TIntermUnary *) override;
+
+ private:
+ void traverseSSBOAccess(TIntermTyped *node, SSBOMethod method);
+ void setMatrixStride(TIntermTyped *node, TLayoutBlockStorage storage, bool rowMajor);
+ bool isEndOfSSBOAccessChain();
+ void writeEOpIndexDirectOrIndirectOutput(TInfoSinkBase &out, Visit visit, TIntermBinary *node);
+ // Common part in dot operations.
+ void writeDotOperatorOutput(TInfoSinkBase &out, const TField *field);
+
+ int mMatrixStride;
+ bool mRowMajor;
+ bool mLocationAsTheLastArgument;
+ OutputHLSL *mOutputHLSL;
+ ShaderStorageBlockFunctionHLSL *mSSBOFunctionHLSL;
+ ResourcesHLSL *mResourcesHLSL;
+ ReferencedInterfaceBlocks mReferencedShaderStorageBlocks;
+
+ BlockMemberInfoMap mBlockMemberInfoMap;
+ const std::vector<InterfaceBlock> &mShaderStorageBlocks;
+};
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_SHADERSTORAGEBLOCKOUTPUTHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp b/gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp
new file mode 100644
index 0000000000..202ed21119
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp
@@ -0,0 +1,582 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ShaderVars.cpp:
+// Methods for GL variable types (varyings, uniforms, etc)
+//
+
+#include <GLSLANG/ShaderLang.h>
+
+#include "common/debug.h"
+#include "common/utilities.h"
+
+namespace sh
+{
+
+namespace
+{
+
+InterpolationType GetNonAuxiliaryInterpolationType(InterpolationType interpolation)
+{
+ return (interpolation == INTERPOLATION_CENTROID ? INTERPOLATION_SMOOTH : interpolation);
+}
+} // namespace
+// The ES 3.0 spec is not clear on this point, but the ES 3.1 spec, and discussion
+// on Khronos.org, clarifies that a smooth/flat mismatch produces a link error,
+// but auxiliary qualifier mismatch (centroid) does not.
+bool InterpolationTypesMatch(InterpolationType a, InterpolationType b)
+{
+ return (GetNonAuxiliaryInterpolationType(a) == GetNonAuxiliaryInterpolationType(b));
+}
+
+ShaderVariable::ShaderVariable() : ShaderVariable(GL_NONE) {}
+
+ShaderVariable::ShaderVariable(GLenum typeIn)
+ : type(typeIn),
+ precision(0),
+ staticUse(false),
+ active(false),
+ isRowMajorLayout(false),
+ flattenedOffsetInParentArrays(-1)
+{}
+
+ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn) : ShaderVariable(typeIn)
+{
+ ASSERT(arraySizeIn != 0);
+ arraySizes.push_back(arraySizeIn);
+}
+
+ShaderVariable::~ShaderVariable() {}
+
+ShaderVariable::ShaderVariable(const ShaderVariable &other)
+ : type(other.type),
+ precision(other.precision),
+ name(other.name),
+ mappedName(other.mappedName),
+ arraySizes(other.arraySizes),
+ staticUse(other.staticUse),
+ active(other.active),
+ fields(other.fields),
+ structName(other.structName),
+ isRowMajorLayout(other.isRowMajorLayout),
+ flattenedOffsetInParentArrays(other.flattenedOffsetInParentArrays)
+{}
+
+ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
+{
+ type = other.type;
+ precision = other.precision;
+ name = other.name;
+ mappedName = other.mappedName;
+ arraySizes = other.arraySizes;
+ staticUse = other.staticUse;
+ active = other.active;
+ fields = other.fields;
+ structName = other.structName;
+ isRowMajorLayout = other.isRowMajorLayout;
+ flattenedOffsetInParentArrays = other.flattenedOffsetInParentArrays;
+ return *this;
+}
+
+bool ShaderVariable::operator==(const ShaderVariable &other) const
+{
+ if (type != other.type || precision != other.precision || name != other.name ||
+ mappedName != other.mappedName || arraySizes != other.arraySizes ||
+ staticUse != other.staticUse || active != other.active ||
+ fields.size() != other.fields.size() || structName != other.structName ||
+ isRowMajorLayout != other.isRowMajorLayout)
+ {
+ return false;
+ }
+ for (size_t ii = 0; ii < fields.size(); ++ii)
+ {
+ if (fields[ii] != other.fields[ii])
+ return false;
+ }
+ return true;
+}
+
+void ShaderVariable::setArraySize(unsigned int size)
+{
+ arraySizes.clear();
+ if (size != 0)
+ {
+ arraySizes.push_back(size);
+ }
+}
+
+unsigned int ShaderVariable::getInnerArraySizeProduct() const
+{
+ unsigned int arraySizeProduct = 1u;
+ for (size_t index = 1; index < arraySizes.size(); ++index)
+ {
+ arraySizeProduct *= getNestedArraySize(index);
+ }
+ return arraySizeProduct;
+}
+
+unsigned int ShaderVariable::getArraySizeProduct() const
+{
+ return gl::ArraySizeProduct(arraySizes);
+}
+
+void ShaderVariable::indexIntoArray(unsigned int arrayIndex)
+{
+ ASSERT(isArray());
+ flattenedOffsetInParentArrays = arrayIndex + getOutermostArraySize() * parentArrayIndex();
+ arraySizes.pop_back();
+}
+
+unsigned int ShaderVariable::getNestedArraySize(unsigned int arrayNestingIndex) const
+{
+ ASSERT(arraySizes.size() > arrayNestingIndex);
+ return arraySizes[arraySizes.size() - 1u - arrayNestingIndex];
+}
+
+unsigned int ShaderVariable::getBasicTypeElementCount() const
+{
+ // GLES 3.1 Nov 2016 section 7.3.1.1 page 77 specifies that a separate entry should be generated
+ // for each array element when dealing with an array of arrays or an array of structs.
+ ASSERT(!isArrayOfArrays());
+ ASSERT(!isStruct() || !isArray());
+
+ // GLES 3.1 Nov 2016 page 82.
+ if (isArray())
+ {
+ return getOutermostArraySize();
+ }
+ return 1u;
+}
+
+bool ShaderVariable::findInfoByMappedName(const std::string &mappedFullName,
+ const ShaderVariable **leafVar,
+ std::string *originalFullName) const
+{
+ ASSERT(leafVar && originalFullName);
+ // There are three cases:
+ // 1) the top variable is of struct type;
+ // 2) the top variable is an array;
+ // 3) otherwise.
+ size_t pos = mappedFullName.find_first_of(".[");
+
+ if (pos == std::string::npos)
+ {
+ // Case 3.
+ if (mappedFullName != this->mappedName)
+ return false;
+ *originalFullName = this->name;
+ *leafVar = this;
+ return true;
+ }
+ else
+ {
+ std::string topName = mappedFullName.substr(0, pos);
+ if (topName != this->mappedName)
+ return false;
+ std::string originalName = this->name;
+ std::string remaining;
+ if (mappedFullName[pos] == '[')
+ {
+ // Case 2.
+ size_t closePos = mappedFullName.find_first_of(']');
+ if (closePos < pos || closePos == std::string::npos)
+ return false;
+ // Append '[index]'.
+ originalName += mappedFullName.substr(pos, closePos - pos + 1);
+ if (closePos + 1 == mappedFullName.size())
+ {
+ *originalFullName = originalName;
+ *leafVar = this;
+ return true;
+ }
+ else
+ {
+ // In the form of 'a[0].b', so after ']', '.' is expected.
+ if (mappedFullName[closePos + 1] != '.')
+ return false;
+ remaining = mappedFullName.substr(closePos + 2); // Skip "]."
+ }
+ }
+ else
+ {
+ // Case 1.
+ remaining = mappedFullName.substr(pos + 1); // Skip "."
+ }
+ for (size_t ii = 0; ii < this->fields.size(); ++ii)
+ {
+ const ShaderVariable *fieldVar = nullptr;
+ std::string originalFieldName;
+ bool found = fields[ii].findInfoByMappedName(remaining, &fieldVar, &originalFieldName);
+ if (found)
+ {
+ *originalFullName = originalName + "." + originalFieldName;
+ *leafVar = fieldVar;
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+bool ShaderVariable::isBuiltIn() const
+{
+ return (name.size() >= 4 && name[0] == 'g' && name[1] == 'l' && name[2] == '_');
+}
+
+bool ShaderVariable::isEmulatedBuiltIn() const
+{
+ return isBuiltIn() && name != mappedName;
+}
+
+bool ShaderVariable::isSameVariableAtLinkTime(const ShaderVariable &other,
+ bool matchPrecision,
+ bool matchName) const
+{
+ if (type != other.type)
+ return false;
+ if (matchPrecision && precision != other.precision)
+ return false;
+ if (matchName && name != other.name)
+ return false;
+ ASSERT(!matchName || mappedName == other.mappedName);
+ if (arraySizes != other.arraySizes)
+ return false;
+ if (isRowMajorLayout != other.isRowMajorLayout)
+ return false;
+ if (fields.size() != other.fields.size())
+ return false;
+
+ // [OpenGL ES 3.1 SPEC Chapter 7.4.1]
+ // Variables declared as structures are considered to match in type if and only if structure
+ // members match in name, type, qualification, and declaration order.
+ for (size_t ii = 0; ii < fields.size(); ++ii)
+ {
+ if (!fields[ii].isSameVariableAtLinkTime(other.fields[ii], matchPrecision, true))
+ {
+ return false;
+ }
+ }
+ if (structName != other.structName)
+ return false;
+ return true;
+}
+
+Uniform::Uniform()
+ : binding(-1), imageUnitFormat(GL_NONE), offset(-1), readonly(false), writeonly(false)
+{}
+
+Uniform::~Uniform() {}
+
+Uniform::Uniform(const Uniform &other)
+ : VariableWithLocation(other),
+ binding(other.binding),
+ imageUnitFormat(other.imageUnitFormat),
+ offset(other.offset),
+ readonly(other.readonly),
+ writeonly(other.writeonly)
+{}
+
+Uniform &Uniform::operator=(const Uniform &other)
+{
+ VariableWithLocation::operator=(other);
+ binding = other.binding;
+ imageUnitFormat = other.imageUnitFormat;
+ offset = other.offset;
+ readonly = other.readonly;
+ writeonly = other.writeonly;
+ return *this;
+}
+
+bool Uniform::operator==(const Uniform &other) const
+{
+ return VariableWithLocation::operator==(other) && binding == other.binding &&
+ imageUnitFormat == other.imageUnitFormat && offset == other.offset &&
+ readonly == other.readonly && writeonly == other.writeonly;
+}
+
+bool Uniform::isSameUniformAtLinkTime(const Uniform &other) const
+{
+ // Enforce a consistent match.
+ // https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16261
+ if (binding != -1 && other.binding != -1 && binding != other.binding)
+ {
+ return false;
+ }
+ if (imageUnitFormat != other.imageUnitFormat)
+ {
+ return false;
+ }
+ if (location != -1 && other.location != -1 && location != other.location)
+ {
+ return false;
+ }
+ if (offset != other.offset)
+ {
+ return false;
+ }
+ if (readonly != other.readonly || writeonly != other.writeonly)
+ {
+ return false;
+ }
+ return VariableWithLocation::isSameVariableAtLinkTime(other, true, true);
+}
+
+VariableWithLocation::VariableWithLocation() : location(-1) {}
+
+VariableWithLocation::~VariableWithLocation() {}
+
+VariableWithLocation::VariableWithLocation(const VariableWithLocation &other)
+ : ShaderVariable(other), location(other.location)
+{}
+
+VariableWithLocation &VariableWithLocation::operator=(const VariableWithLocation &other)
+{
+ ShaderVariable::operator=(other);
+ location = other.location;
+ return *this;
+}
+
+bool VariableWithLocation::operator==(const VariableWithLocation &other) const
+{
+ return (ShaderVariable::operator==(other) && location == other.location);
+}
+
+Attribute::Attribute() {}
+
+Attribute::~Attribute() {}
+
+Attribute::Attribute(const Attribute &other) : VariableWithLocation(other) {}
+
+Attribute &Attribute::operator=(const Attribute &other)
+{
+ VariableWithLocation::operator=(other);
+ return *this;
+}
+
+bool Attribute::operator==(const Attribute &other) const
+{
+ return VariableWithLocation::operator==(other);
+}
+
+OutputVariable::OutputVariable() : index(-1) {}
+
+OutputVariable::~OutputVariable() {}
+
+OutputVariable::OutputVariable(const OutputVariable &other) = default;
+OutputVariable &OutputVariable::operator=(const OutputVariable &other) = default;
+
+bool OutputVariable::operator==(const OutputVariable &other) const
+{
+ return VariableWithLocation::operator==(other) && index == other.index;
+}
+
+InterfaceBlockField::InterfaceBlockField() {}
+
+InterfaceBlockField::~InterfaceBlockField() {}
+
+InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other) : ShaderVariable(other)
+{}
+
+InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other)
+{
+ ShaderVariable::operator=(other);
+ return *this;
+}
+
+bool InterfaceBlockField::operator==(const InterfaceBlockField &other) const
+{
+ return ShaderVariable::operator==(other);
+}
+
+bool InterfaceBlockField::isSameInterfaceBlockFieldAtLinkTime(
+ const InterfaceBlockField &other) const
+{
+ return (ShaderVariable::isSameVariableAtLinkTime(other, true, true));
+}
+
+Varying::Varying() : interpolation(INTERPOLATION_SMOOTH), isInvariant(false) {}
+
+Varying::~Varying() {}
+
+Varying::Varying(const Varying &other)
+ : VariableWithLocation(other),
+ interpolation(other.interpolation),
+ isInvariant(other.isInvariant)
+{}
+
+Varying &Varying::operator=(const Varying &other)
+{
+ VariableWithLocation::operator=(other);
+ interpolation = other.interpolation;
+ isInvariant = other.isInvariant;
+ return *this;
+}
+
+bool Varying::operator==(const Varying &other) const
+{
+ return (VariableWithLocation::operator==(other) && interpolation == other.interpolation &&
+ isInvariant == other.isInvariant);
+}
+
+bool Varying::isSameVaryingAtLinkTime(const Varying &other) const
+{
+ return isSameVaryingAtLinkTime(other, 100);
+}
+
+bool Varying::isSameVaryingAtLinkTime(const Varying &other, int shaderVersion) const
+{
+ return (ShaderVariable::isSameVariableAtLinkTime(other, false, false) &&
+ InterpolationTypesMatch(interpolation, other.interpolation) &&
+ (shaderVersion >= 300 || isInvariant == other.isInvariant) &&
+ (location == other.location) &&
+ (name == other.name || (shaderVersion >= 310 && location >= 0)));
+}
+
+InterfaceBlock::InterfaceBlock()
+ : arraySize(0),
+ layout(BLOCKLAYOUT_PACKED),
+ isRowMajorLayout(false),
+ binding(-1),
+ staticUse(false),
+ active(false),
+ blockType(BlockType::BLOCK_UNIFORM)
+{}
+
+InterfaceBlock::~InterfaceBlock() {}
+
+InterfaceBlock::InterfaceBlock(const InterfaceBlock &other)
+ : name(other.name),
+ mappedName(other.mappedName),
+ instanceName(other.instanceName),
+ arraySize(other.arraySize),
+ layout(other.layout),
+ isRowMajorLayout(other.isRowMajorLayout),
+ binding(other.binding),
+ staticUse(other.staticUse),
+ active(other.active),
+ blockType(other.blockType),
+ fields(other.fields)
+{}
+
+InterfaceBlock &InterfaceBlock::operator=(const InterfaceBlock &other)
+{
+ name = other.name;
+ mappedName = other.mappedName;
+ instanceName = other.instanceName;
+ arraySize = other.arraySize;
+ layout = other.layout;
+ isRowMajorLayout = other.isRowMajorLayout;
+ binding = other.binding;
+ staticUse = other.staticUse;
+ active = other.active;
+ blockType = other.blockType;
+ fields = other.fields;
+ return *this;
+}
+
+std::string InterfaceBlock::fieldPrefix() const
+{
+ return instanceName.empty() ? "" : name;
+}
+
+std::string InterfaceBlock::fieldMappedPrefix() const
+{
+ return instanceName.empty() ? "" : mappedName;
+}
+
+bool InterfaceBlock::isSameInterfaceBlockAtLinkTime(const InterfaceBlock &other) const
+{
+ if (name != other.name || mappedName != other.mappedName || arraySize != other.arraySize ||
+ layout != other.layout || isRowMajorLayout != other.isRowMajorLayout ||
+ binding != other.binding || blockType != other.blockType ||
+ fields.size() != other.fields.size())
+ {
+ return false;
+ }
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); ++fieldIndex)
+ {
+ if (!fields[fieldIndex].isSameInterfaceBlockFieldAtLinkTime(other.fields[fieldIndex]))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool InterfaceBlock::isBuiltIn() const
+{
+ return (name.size() >= 4 && name[0] == 'g' && name[1] == 'l' && name[2] == '_');
+}
+
+void WorkGroupSize::fill(int fillValue)
+{
+ localSizeQualifiers[0] = fillValue;
+ localSizeQualifiers[1] = fillValue;
+ localSizeQualifiers[2] = fillValue;
+}
+
+void WorkGroupSize::setLocalSize(int localSizeX, int localSizeY, int localSizeZ)
+{
+ localSizeQualifiers[0] = localSizeX;
+ localSizeQualifiers[1] = localSizeY;
+ localSizeQualifiers[2] = localSizeZ;
+}
+
+// check that if one of them is less than 1, then all of them are.
+// Or if one is positive, then all of them are positive.
+bool WorkGroupSize::isLocalSizeValid() const
+{
+ return (
+ (localSizeQualifiers[0] < 1 && localSizeQualifiers[1] < 1 && localSizeQualifiers[2] < 1) ||
+ (localSizeQualifiers[0] > 0 && localSizeQualifiers[1] > 0 && localSizeQualifiers[2] > 0));
+}
+
+bool WorkGroupSize::isAnyValueSet() const
+{
+ return localSizeQualifiers[0] > 0 || localSizeQualifiers[1] > 0 || localSizeQualifiers[2] > 0;
+}
+
+bool WorkGroupSize::isDeclared() const
+{
+ bool localSizeDeclared = localSizeQualifiers[0] > 0;
+ ASSERT(isLocalSizeValid());
+ return localSizeDeclared;
+}
+
+bool WorkGroupSize::isWorkGroupSizeMatching(const WorkGroupSize &right) const
+{
+ for (size_t i = 0u; i < size(); ++i)
+ {
+ bool result = (localSizeQualifiers[i] == right.localSizeQualifiers[i] ||
+ (localSizeQualifiers[i] == 1 && right.localSizeQualifiers[i] == -1) ||
+ (localSizeQualifiers[i] == -1 && right.localSizeQualifiers[i] == 1));
+ if (!result)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+int &WorkGroupSize::operator[](size_t index)
+{
+ ASSERT(index < size());
+ return localSizeQualifiers[index];
+}
+
+int WorkGroupSize::operator[](size_t index) const
+{
+ ASSERT(index < size());
+ return localSizeQualifiers[index];
+}
+
+size_t WorkGroupSize::size() const
+{
+ return 3u;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/StaticType.h b/gfx/angle/checkout/src/compiler/translator/StaticType.h
new file mode 100644
index 0000000000..6ecb24fbc9
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/StaticType.h
@@ -0,0 +1,202 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Compile-time instances of many common TType values. These are looked up
+// (statically or dynamically) through the methods defined in the namespace.
+//
+
+#ifndef COMPILER_TRANSLATOR_STATIC_TYPE_H_
+#define COMPILER_TRANSLATOR_STATIC_TYPE_H_
+
+#include "compiler/translator/Types.h"
+
+namespace sh
+{
+
+namespace StaticType
+{
+
+namespace Helpers
+{
+
+//
+// Generation and static allocation of type mangled name values.
+//
+
+// Size of the constexpr-generated mangled name.
+// If this value is too small, the compiler will produce errors.
+static constexpr size_t kStaticMangledNameLength = 2;
+
+// Type which holds the mangled names for constexpr-generated TTypes.
+// This simple struct is needed so that a char array can be returned by value.
+struct StaticMangledName
+{
+ // If this array is too small, the compiler will produce errors.
+ char name[kStaticMangledNameLength + 1] = {};
+};
+
+// Generates a mangled name for a TType given its parameters.
+constexpr StaticMangledName BuildStaticMangledName(TBasicType basicType,
+ TPrecision precision,
+ TQualifier qualifier,
+ unsigned char primarySize,
+ unsigned char secondarySize)
+{
+ StaticMangledName name = {};
+ name.name[0] = TType::GetSizeMangledName(primarySize, secondarySize);
+ name.name[1] = GetBasicMangledName(basicType);
+ name.name[2] = '\0';
+ return name;
+}
+
+// This "variable" contains the mangled names for every constexpr-generated TType.
+// If kMangledNameInstance<B, P, Q, PS, SS> is used anywhere (specifally
+// in instance, below), this is where the appropriate type will be stored.
+template <TBasicType basicType,
+ TPrecision precision,
+ TQualifier qualifier,
+ unsigned char primarySize,
+ unsigned char secondarySize>
+static constexpr StaticMangledName kMangledNameInstance =
+ BuildStaticMangledName(basicType, precision, qualifier, primarySize, secondarySize);
+
+//
+// Generation and static allocation of TType values.
+//
+
+// This "variable" contains every constexpr-generated TType.
+// If instance<B, P, Q, PS, SS> is used anywhere (specifally
+// in Get, below), this is where the appropriate type will be stored.
+//
+// TODO(crbug.com/981610): This is constexpr but doesn't follow the kConstant naming convention
+// because TType has a mutable member that prevents it from being in .data.rel.ro and makes the
+// Android Binary Size builder complain when ANGLE is rolled in Chromium.
+template <TBasicType basicType,
+ TPrecision precision,
+ TQualifier qualifier,
+ unsigned char primarySize,
+ unsigned char secondarySize>
+static constexpr TType instance =
+ TType(basicType,
+ precision,
+ qualifier,
+ primarySize,
+ secondarySize,
+ kMangledNameInstance<basicType, precision, qualifier, primarySize, secondarySize>.name);
+
+} // namespace Helpers
+
+//
+// Fully-qualified type lookup.
+//
+
+template <TBasicType basicType,
+ TPrecision precision,
+ TQualifier qualifier,
+ unsigned char primarySize,
+ unsigned char secondarySize>
+constexpr const TType *Get()
+{
+ static_assert(1 <= primarySize && primarySize <= 4, "primarySize out of bounds");
+ static_assert(1 <= secondarySize && secondarySize <= 4, "secondarySize out of bounds");
+ return &Helpers::instance<basicType, precision, qualifier, primarySize, secondarySize>;
+}
+
+//
+// Overloads
+//
+
+template <TBasicType basicType, unsigned char primarySize = 1, unsigned char secondarySize = 1>
+constexpr const TType *GetBasic()
+{
+ return Get<basicType, EbpUndefined, EvqGlobal, primarySize, secondarySize>();
+}
+
+template <TBasicType basicType,
+ TQualifier qualifier,
+ unsigned char primarySize = 1,
+ unsigned char secondarySize = 1>
+const TType *GetQualified()
+{
+ return Get<basicType, EbpUndefined, qualifier, primarySize, secondarySize>();
+}
+
+// Dynamic lookup methods (convert runtime values to template args)
+
+namespace Helpers
+{
+
+// Helper which takes secondarySize statically but primarySize dynamically.
+template <TBasicType basicType,
+ TPrecision precision,
+ TQualifier qualifier,
+ unsigned char secondarySize>
+constexpr const TType *GetForVecMatHelper(unsigned char primarySize)
+{
+ static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt ||
+ basicType == EbtBool,
+ "unsupported basicType");
+ switch (primarySize)
+ {
+ case 1:
+ return Get<basicType, precision, qualifier, 1, secondarySize>();
+ case 2:
+ return Get<basicType, precision, qualifier, 2, secondarySize>();
+ case 3:
+ return Get<basicType, precision, qualifier, 3, secondarySize>();
+ case 4:
+ return Get<basicType, precision, qualifier, 4, secondarySize>();
+ default:
+ UNREACHABLE();
+ return GetBasic<EbtVoid>();
+ }
+}
+
+} // namespace Helpers
+
+template <TBasicType basicType,
+ TPrecision precision = EbpUndefined,
+ TQualifier qualifier = EvqGlobal>
+constexpr const TType *GetForVecMat(unsigned char primarySize, unsigned char secondarySize = 1)
+{
+ static_assert(basicType == EbtFloat || basicType == EbtInt || basicType == EbtUInt ||
+ basicType == EbtBool,
+ "unsupported basicType");
+ switch (secondarySize)
+ {
+ case 1:
+ return Helpers::GetForVecMatHelper<basicType, precision, qualifier, 1>(primarySize);
+ case 2:
+ return Helpers::GetForVecMatHelper<basicType, precision, qualifier, 2>(primarySize);
+ case 3:
+ return Helpers::GetForVecMatHelper<basicType, precision, qualifier, 3>(primarySize);
+ case 4:
+ return Helpers::GetForVecMatHelper<basicType, precision, qualifier, 4>(primarySize);
+ default:
+ UNREACHABLE();
+ return GetBasic<EbtVoid>();
+ }
+}
+
+template <TBasicType basicType, TPrecision precision = EbpUndefined>
+constexpr const TType *GetForVec(TQualifier qualifier, unsigned char size)
+{
+ switch (qualifier)
+ {
+ case EvqGlobal:
+ return Helpers::GetForVecMatHelper<basicType, precision, EvqGlobal, 1>(size);
+ case EvqOut:
+ return Helpers::GetForVecMatHelper<basicType, precision, EvqOut, 1>(size);
+ default:
+ UNREACHABLE();
+ return GetBasic<EbtVoid>();
+ }
+}
+
+} // namespace StaticType
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_STATIC_TYPE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/StructureHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/StructureHLSL.cpp
new file mode 100644
index 0000000000..172ca07fc0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/StructureHLSL.cpp
@@ -0,0 +1,591 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// StructureHLSL.cpp:
+// HLSL translation of GLSL constructors and structures.
+//
+
+#include "compiler/translator/StructureHLSL.h"
+#include "common/utilities.h"
+#include "compiler/translator/OutputHLSL.h"
+#include "compiler/translator/Types.h"
+#include "compiler/translator/UtilsHLSL.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+TString Define(const TStructure &structure,
+ bool useHLSLRowMajorPacking,
+ bool useStd140Packing,
+ Std140PaddingHelper *padHelper)
+{
+ const TFieldList &fields = structure.fields();
+ const bool isNameless = (structure.symbolType() == SymbolType::Empty);
+ const TString &structName =
+ QualifiedStructNameString(structure, useHLSLRowMajorPacking, useStd140Packing);
+ const TString declareString = (isNameless ? "struct" : "struct " + structName);
+
+ TString string;
+ string += declareString +
+ "\n"
+ "{\n";
+
+ for (const TField *field : fields)
+ {
+ const TType &fieldType = *field->type();
+ if (!IsSampler(fieldType.getBasicType()))
+ {
+ const TStructure *fieldStruct = fieldType.getStruct();
+ const TString &fieldTypeString =
+ fieldStruct ? QualifiedStructNameString(*fieldStruct, useHLSLRowMajorPacking,
+ useStd140Packing)
+ : TypeString(fieldType);
+
+ if (padHelper)
+ {
+ string += padHelper->prePaddingString(fieldType);
+ }
+
+ string += " " + fieldTypeString + " " + DecorateField(field->name(), structure) +
+ ArrayString(fieldType).data() + ";\n";
+
+ if (padHelper)
+ {
+ string += padHelper->postPaddingString(fieldType, useHLSLRowMajorPacking);
+ }
+ }
+ }
+
+ // Nameless structs do not finish with a semicolon and newline, to leave room for an instance
+ // variable
+ string += (isNameless ? "} " : "};\n");
+
+ return string;
+}
+
+TString WriteParameterList(const std::vector<TType> &parameters)
+{
+ TString parameterList;
+ for (size_t parameter = 0u; parameter < parameters.size(); parameter++)
+ {
+ const TType &paramType = parameters[parameter];
+
+ parameterList +=
+ TypeString(paramType) + " x" + str(parameter) + ArrayString(paramType).data();
+
+ if (parameter < parameters.size() - 1u)
+ {
+ parameterList += ", ";
+ }
+ }
+ return parameterList;
+}
+
+} // anonymous namespace
+
+Std140PaddingHelper::Std140PaddingHelper(const std::map<TString, int> &structElementIndexes,
+ unsigned *uniqueCounter)
+ : mPaddingCounter(uniqueCounter), mElementIndex(0), mStructElementIndexes(&structElementIndexes)
+{}
+
+Std140PaddingHelper::Std140PaddingHelper(const Std140PaddingHelper &other)
+ : mPaddingCounter(other.mPaddingCounter),
+ mElementIndex(other.mElementIndex),
+ mStructElementIndexes(other.mStructElementIndexes)
+{}
+
+Std140PaddingHelper &Std140PaddingHelper::operator=(const Std140PaddingHelper &other)
+{
+ mPaddingCounter = other.mPaddingCounter;
+ mElementIndex = other.mElementIndex;
+ mStructElementIndexes = other.mStructElementIndexes;
+ return *this;
+}
+
+TString Std140PaddingHelper::next()
+{
+ unsigned value = (*mPaddingCounter)++;
+ return str(value);
+}
+
+int Std140PaddingHelper::prePadding(const TType &type)
+{
+ if (type.getBasicType() == EbtStruct || type.isMatrix() || type.isArray())
+ {
+ // no padding needed, HLSL will align the field to a new register
+ mElementIndex = 0;
+ return 0;
+ }
+
+ const GLenum glType = GLVariableType(type);
+ const int numComponents = gl::VariableComponentCount(glType);
+
+ if (numComponents >= 4)
+ {
+ // no padding needed, HLSL will align the field to a new register
+ mElementIndex = 0;
+ return 0;
+ }
+
+ if (mElementIndex + numComponents > 4)
+ {
+ // no padding needed, HLSL will align the field to a new register
+ mElementIndex = numComponents;
+ return 0;
+ }
+
+ const int alignment = numComponents == 3 ? 4 : numComponents;
+ const int paddingOffset = (mElementIndex % alignment);
+ const int paddingCount = (paddingOffset != 0 ? (alignment - paddingOffset) : 0);
+
+ mElementIndex += paddingCount;
+ mElementIndex += numComponents;
+ mElementIndex %= 4;
+
+ return paddingCount;
+}
+
+TString Std140PaddingHelper::prePaddingString(const TType &type)
+{
+ int paddingCount = prePadding(type);
+
+ TString padding;
+
+ for (int paddingIndex = 0; paddingIndex < paddingCount; paddingIndex++)
+ {
+ padding += " float pad_" + next() + ";\n";
+ }
+
+ return padding;
+}
+
+TString Std140PaddingHelper::postPaddingString(const TType &type, bool useHLSLRowMajorPacking)
+{
+ if (!type.isMatrix() && !type.isArray() && type.getBasicType() != EbtStruct)
+ {
+ return "";
+ }
+
+ int numComponents = 0;
+ const TStructure *structure = type.getStruct();
+
+ if (type.isMatrix())
+ {
+ // This method can also be called from structureString, which does not use layout
+ // qualifiers.
+ // Thus, use the method parameter for determining the matrix packing.
+ //
+ // Note HLSL row major packing corresponds to GL API column-major, and vice-versa, since we
+ // wish to always transpose GL matrices to play well with HLSL's matrix array indexing.
+ //
+ const bool isRowMajorMatrix = !useHLSLRowMajorPacking;
+ const GLenum glType = GLVariableType(type);
+ numComponents = gl::MatrixComponentCount(glType, isRowMajorMatrix);
+ }
+ else if (structure)
+ {
+ const TString &structName =
+ QualifiedStructNameString(*structure, useHLSLRowMajorPacking, true);
+ numComponents = mStructElementIndexes->find(structName)->second;
+
+ if (numComponents == 0)
+ {
+ return "";
+ }
+ }
+ else
+ {
+ const GLenum glType = GLVariableType(type);
+ numComponents = gl::VariableComponentCount(glType);
+ }
+
+ TString padding;
+ for (int paddingOffset = numComponents; paddingOffset < 4; paddingOffset++)
+ {
+ padding += " float pad_" + next() + ";\n";
+ }
+ return padding;
+}
+
+StructureHLSL::StructureHLSL() : mUniquePaddingCounter(0) {}
+
+Std140PaddingHelper StructureHLSL::getPaddingHelper()
+{
+ return Std140PaddingHelper(mStd140StructElementIndexes, &mUniquePaddingCounter);
+}
+
+TString StructureHLSL::defineQualified(const TStructure &structure,
+ bool useHLSLRowMajorPacking,
+ bool useStd140Packing)
+{
+ if (useStd140Packing)
+ {
+ Std140PaddingHelper padHelper = getPaddingHelper();
+ return Define(structure, useHLSLRowMajorPacking, useStd140Packing, &padHelper);
+ }
+ else
+ {
+ return Define(structure, useHLSLRowMajorPacking, useStd140Packing, nullptr);
+ }
+}
+
+TString StructureHLSL::defineNameless(const TStructure &structure)
+{
+ return Define(structure, false, false, nullptr);
+}
+
+StructureHLSL::DefinedStructs::iterator StructureHLSL::defineVariants(const TStructure &structure,
+ const TString &name)
+{
+ ASSERT(mDefinedStructs.find(name) == mDefinedStructs.end());
+
+ for (const TField *field : structure.fields())
+ {
+ const TType *fieldType = field->type();
+ if (fieldType->getBasicType() == EbtStruct)
+ {
+ ensureStructDefined(*fieldType->getStruct());
+ }
+ }
+
+ DefinedStructs::iterator addedStruct =
+ mDefinedStructs.insert(std::make_pair(name, new TStructProperties())).first;
+ // Add element index
+ storeStd140ElementIndex(structure, false);
+ storeStd140ElementIndex(structure, true);
+
+ const TString &structString = defineQualified(structure, false, false);
+
+ ASSERT(std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structString) ==
+ mStructDeclarations.end());
+ // Add row-major packed struct for interface blocks
+ TString rowMajorString = "#pragma pack_matrix(row_major)\n" +
+ defineQualified(structure, true, false) +
+ "#pragma pack_matrix(column_major)\n";
+
+ TString std140String = defineQualified(structure, false, true);
+ TString std140RowMajorString = "#pragma pack_matrix(row_major)\n" +
+ defineQualified(structure, true, true) +
+ "#pragma pack_matrix(column_major)\n";
+
+ mStructDeclarations.push_back(structString);
+ mStructDeclarations.push_back(rowMajorString);
+ mStructDeclarations.push_back(std140String);
+ mStructDeclarations.push_back(std140RowMajorString);
+ return addedStruct;
+}
+
+void StructureHLSL::ensureStructDefined(const TStructure &structure)
+{
+ const TString name = StructNameString(structure);
+ if (name == "")
+ {
+ return; // Nameless structures are not defined
+ }
+ if (mDefinedStructs.find(name) == mDefinedStructs.end())
+ {
+ defineVariants(structure, name);
+ }
+}
+
+TString StructureHLSL::addStructConstructor(const TStructure &structure)
+{
+ const TString name = StructNameString(structure);
+
+ if (name == "")
+ {
+ return TString(); // Nameless structures don't have constructors
+ }
+
+ auto definedStruct = mDefinedStructs.find(name);
+ if (definedStruct == mDefinedStructs.end())
+ {
+ definedStruct = defineVariants(structure, name);
+ }
+ const TString constructorFunctionName = TString(name) + "_ctor";
+ TString *constructor = &definedStruct->second->constructor;
+ if (!constructor->empty())
+ {
+ return constructorFunctionName; // Already added
+ }
+ *constructor += name + " " + constructorFunctionName + "(";
+
+ std::vector<TType> ctorParameters;
+ const TFieldList &fields = structure.fields();
+ for (const TField *field : fields)
+ {
+ const TType *fieldType = field->type();
+ if (!IsSampler(fieldType->getBasicType()))
+ {
+ ctorParameters.push_back(*fieldType);
+ }
+ }
+ // Structs that have sampler members should not have constructor calls, and otherwise structs
+ // are guaranteed to be non-empty by the grammar. Structs can't contain empty declarations
+ // either.
+ ASSERT(!ctorParameters.empty());
+
+ *constructor += WriteParameterList(ctorParameters);
+
+ *constructor +=
+ ")\n"
+ "{\n"
+ " " +
+ name + " structure = { ";
+
+ for (size_t parameterIndex = 0u; parameterIndex < ctorParameters.size(); ++parameterIndex)
+ {
+ *constructor += "x" + str(parameterIndex);
+ if (parameterIndex < ctorParameters.size() - 1u)
+ {
+ *constructor += ", ";
+ }
+ }
+ *constructor +=
+ "};\n"
+ " return structure;\n"
+ "}\n";
+
+ return constructorFunctionName;
+}
+
+TString StructureHLSL::addBuiltInConstructor(const TType &type, const TIntermSequence *parameters)
+{
+ ASSERT(!type.isArray());
+ ASSERT(type.getStruct() == nullptr);
+ ASSERT(parameters);
+
+ TType ctorType = type;
+ ctorType.setPrecision(EbpHigh);
+ ctorType.setQualifier(EvqTemporary);
+
+ const TString constructorFunctionName =
+ TString(type.getBuiltInTypeNameString()) + "_ctor" + DisambiguateFunctionName(parameters);
+ TString constructor = TypeString(ctorType) + " " + constructorFunctionName + "(";
+
+ std::vector<TType> ctorParameters;
+ for (auto parameter : *parameters)
+ {
+ const TType &paramType = parameter->getAsTyped()->getType();
+ ASSERT(!paramType.isArray());
+ ctorParameters.push_back(paramType);
+ }
+ constructor += WriteParameterList(ctorParameters);
+
+ constructor +=
+ ")\n"
+ "{\n"
+ " return " +
+ TypeString(ctorType) + "(";
+
+ if (ctorType.isMatrix() && ctorParameters.size() == 1)
+ {
+ int rows = ctorType.getRows();
+ int cols = ctorType.getCols();
+ const TType &parameter = ctorParameters[0];
+
+ if (parameter.isScalar())
+ {
+ for (int col = 0; col < cols; col++)
+ {
+ for (int row = 0; row < rows; row++)
+ {
+ constructor += TString((row == col) ? "x0" : "0.0");
+
+ if (row < rows - 1 || col < cols - 1)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+ }
+ else if (parameter.isMatrix())
+ {
+ for (int col = 0; col < cols; col++)
+ {
+ for (int row = 0; row < rows; row++)
+ {
+ if (row < parameter.getRows() && col < parameter.getCols())
+ {
+ constructor += TString("x0") + "[" + str(col) + "][" + str(row) + "]";
+ }
+ else
+ {
+ constructor += TString((row == col) ? "1.0" : "0.0");
+ }
+
+ if (row < rows - 1 || col < cols - 1)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+ }
+ else
+ {
+ ASSERT(rows == 2 && cols == 2 && parameter.isVector() &&
+ parameter.getNominalSize() == 4);
+
+ constructor += "x0";
+ }
+ }
+ else
+ {
+ size_t remainingComponents = ctorType.getObjectSize();
+ size_t parameterIndex = 0;
+
+ while (remainingComponents > 0)
+ {
+ const TType &parameter = ctorParameters[parameterIndex];
+ const size_t parameterSize = parameter.getObjectSize();
+ bool moreParameters = parameterIndex + 1 < ctorParameters.size();
+
+ constructor += "x" + str(parameterIndex);
+
+ if (parameter.isScalar())
+ {
+ remainingComponents -= parameter.getObjectSize();
+ }
+ else if (parameter.isVector())
+ {
+ if (remainingComponents == parameterSize || moreParameters)
+ {
+ ASSERT(parameterSize <= remainingComponents);
+ remainingComponents -= parameterSize;
+ }
+ else if (remainingComponents < static_cast<size_t>(parameter.getNominalSize()))
+ {
+ switch (remainingComponents)
+ {
+ case 1:
+ constructor += ".x";
+ break;
+ case 2:
+ constructor += ".xy";
+ break;
+ case 3:
+ constructor += ".xyz";
+ break;
+ case 4:
+ constructor += ".xyzw";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ remainingComponents = 0;
+ }
+ else
+ UNREACHABLE();
+ }
+ else if (parameter.isMatrix())
+ {
+ int column = 0;
+ while (remainingComponents > 0 && column < parameter.getCols())
+ {
+ constructor += "[" + str(column) + "]";
+
+ if (remainingComponents < static_cast<size_t>(parameter.getRows()))
+ {
+ switch (remainingComponents)
+ {
+ case 1:
+ constructor += ".x";
+ break;
+ case 2:
+ constructor += ".xy";
+ break;
+ case 3:
+ constructor += ".xyz";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ remainingComponents = 0;
+ }
+ else
+ {
+ remainingComponents -= parameter.getRows();
+
+ if (remainingComponents > 0)
+ {
+ constructor += ", x" + str(parameterIndex);
+ }
+ }
+
+ column++;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ if (moreParameters)
+ {
+ parameterIndex++;
+ }
+
+ if (remainingComponents)
+ {
+ constructor += ", ";
+ }
+ }
+ }
+
+ constructor +=
+ ");\n"
+ "}\n";
+
+ mBuiltInConstructors.insert(constructor);
+
+ return constructorFunctionName;
+}
+
+std::string StructureHLSL::structsHeader() const
+{
+ TInfoSinkBase out;
+
+ for (auto &declaration : mStructDeclarations)
+ {
+ out << declaration;
+ }
+
+ for (auto &structure : mDefinedStructs)
+ {
+ out << structure.second->constructor;
+ }
+
+ for (auto &constructor : mBuiltInConstructors)
+ {
+ out << constructor;
+ }
+
+ return out.str();
+}
+
+void StructureHLSL::storeStd140ElementIndex(const TStructure &structure,
+ bool useHLSLRowMajorPacking)
+{
+ Std140PaddingHelper padHelper = getPaddingHelper();
+ const TFieldList &fields = structure.fields();
+
+ for (const TField *field : fields)
+ {
+ padHelper.prePadding(*field->type());
+ }
+
+ // Add remaining element index to the global map, for use with nested structs in standard
+ // layouts
+ const TString &structName = QualifiedStructNameString(structure, useHLSLRowMajorPacking, true);
+ mStd140StructElementIndexes[structName] = padHelper.elementIndex();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/StructureHLSL.h b/gfx/angle/checkout/src/compiler/translator/StructureHLSL.h
new file mode 100644
index 0000000000..ba4a8d11bc
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/StructureHLSL.h
@@ -0,0 +1,98 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// StructureHLSL.h:
+// HLSL translation of GLSL constructors and structures.
+//
+
+#ifndef COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
+#define COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
+
+#include "compiler/translator/Common.h"
+#include "compiler/translator/IntermNode.h"
+
+#include <set>
+
+class TInfoSinkBase;
+class TScopeBracket;
+
+namespace sh
+{
+
+// This helper class assists structure and interface block definitions in determining
+// how to pack std140 structs within HLSL's packing rules.
+class Std140PaddingHelper
+{
+ public:
+ explicit Std140PaddingHelper(const std::map<TString, int> &structElementIndexes,
+ unsigned int *uniqueCounter);
+ Std140PaddingHelper(const Std140PaddingHelper &other);
+ Std140PaddingHelper &operator=(const Std140PaddingHelper &other);
+
+ int elementIndex() const { return mElementIndex; }
+ int prePadding(const TType &type);
+ TString prePaddingString(const TType &type);
+ TString postPaddingString(const TType &type, bool useHLSLRowMajorPacking);
+
+ private:
+ TString next();
+
+ unsigned *mPaddingCounter;
+ int mElementIndex;
+ const std::map<TString, int> *mStructElementIndexes;
+};
+
+class StructureHLSL : angle::NonCopyable
+{
+ public:
+ StructureHLSL();
+
+ // Returns the name of the constructor function.
+ TString addStructConstructor(const TStructure &structure);
+ TString addBuiltInConstructor(const TType &type, const TIntermSequence *parameters);
+
+ static TString defineNameless(const TStructure &structure);
+ void ensureStructDefined(const TStructure &structure);
+
+ std::string structsHeader() const;
+
+ Std140PaddingHelper getPaddingHelper();
+
+ private:
+ unsigned mUniquePaddingCounter;
+
+ std::map<TString, int> mStd140StructElementIndexes;
+
+ struct TStructProperties : public angle::NonCopyable
+ {
+ POOL_ALLOCATOR_NEW_DELETE
+
+ TStructProperties() {}
+
+ // Constructor is an empty string in case the struct doesn't have a constructor yet.
+ TString constructor;
+ };
+
+ // Map from struct name to struct properties.
+ typedef std::map<TString, TStructProperties *> DefinedStructs;
+ DefinedStructs mDefinedStructs;
+
+ // Struct declarations need to be kept in a vector instead of having them inside mDefinedStructs
+ // since maintaining the original order is necessary for nested structs.
+ typedef std::vector<TString> StructDeclarations;
+ StructDeclarations mStructDeclarations;
+
+ typedef std::set<TString> BuiltInConstructors;
+ BuiltInConstructors mBuiltInConstructors;
+
+ void storeStd140ElementIndex(const TStructure &structure, bool useHLSLRowMajorPacking);
+ TString defineQualified(const TStructure &structure,
+ bool useHLSLRowMajorPacking,
+ bool useStd140Packing);
+ DefinedStructs::iterator defineVariants(const TStructure &structure, const TString &name);
+};
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Symbol.cpp b/gfx/angle/checkout/src/compiler/translator/Symbol.cpp
new file mode 100644
index 0000000000..52ad4f319d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Symbol.cpp
@@ -0,0 +1,238 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Symbol.cpp: Symbols representing variables, functions, structures and interface blocks.
+//
+
+#if defined(_MSC_VER)
+# pragma warning(disable : 4718)
+#endif
+
+#include "compiler/translator/Symbol.h"
+
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kMainName("main");
+constexpr const ImmutableString kImageLoadName("imageLoad");
+constexpr const ImmutableString kImageStoreName("imageStore");
+constexpr const ImmutableString kImageSizeName("imageSize");
+constexpr const ImmutableString kAtomicCounterName("atomicCounter");
+
+static const char kFunctionMangledNameSeparator = '(';
+
+} // anonymous namespace
+
+TSymbol::TSymbol(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ SymbolType symbolType,
+ SymbolClass symbolClass,
+ TExtension extension)
+ : mName(name),
+ mUniqueId(symbolTable->nextUniqueId()),
+ mSymbolType(symbolType),
+ mExtension(extension),
+ mSymbolClass(symbolClass)
+{
+ ASSERT(mSymbolType == SymbolType::BuiltIn || mExtension == TExtension::UNDEFINED);
+ ASSERT(mName != "" || mSymbolType == SymbolType::AngleInternal ||
+ mSymbolType == SymbolType::Empty);
+}
+
+ImmutableString TSymbol::name() const
+{
+ if (!mName.empty())
+ {
+ return mName;
+ }
+ // This can be called for nameless function parameters in HLSL.
+ ASSERT(mSymbolType == SymbolType::AngleInternal ||
+ (mSymbolType == SymbolType::Empty && isVariable()));
+ int uniqueId = mUniqueId.get();
+ ImmutableStringBuilder symbolNameOut(sizeof(uniqueId) * 2u + 1u);
+ symbolNameOut << 's';
+ symbolNameOut.appendHex(mUniqueId.get());
+ return symbolNameOut;
+}
+
+ImmutableString TSymbol::getMangledName() const
+{
+ if (mSymbolClass == SymbolClass::Function)
+ {
+ // We do this instead of using proper virtual functions so that we can better support
+ // constexpr symbols.
+ return static_cast<const TFunction *>(this)->getFunctionMangledName();
+ }
+ ASSERT(mSymbolType != SymbolType::Empty);
+ return name();
+}
+
+TVariable::TVariable(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ const TType *type,
+ SymbolType symbolType,
+ TExtension extension)
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::Variable, extension),
+ mType(type),
+ unionArray(nullptr)
+{
+ ASSERT(mType);
+ ASSERT(name.empty() || symbolType != SymbolType::Empty);
+}
+
+TStructure::TStructure(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ const TFieldList *fields,
+ SymbolType symbolType)
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::Struct), TFieldListCollection(fields)
+{}
+
+TStructure::TStructure(const TSymbolUniqueId &id,
+ const ImmutableString &name,
+ TExtension extension,
+ const TFieldList *fields)
+ : TSymbol(id, name, SymbolType::BuiltIn, extension, SymbolClass::Struct),
+ TFieldListCollection(fields)
+{}
+
+void TStructure::createSamplerSymbols(const char *namePrefix,
+ const TString &apiNamePrefix,
+ TVector<const TVariable *> *outputSymbols,
+ TMap<const TVariable *, TString> *outputSymbolsToAPINames,
+ TSymbolTable *symbolTable) const
+{
+ ASSERT(containsSamplers());
+ for (const auto *field : *mFields)
+ {
+ const TType *fieldType = field->type();
+ if (IsSampler(fieldType->getBasicType()) || fieldType->isStructureContainingSamplers())
+ {
+ std::stringstream fieldName = sh::InitializeStream<std::stringstream>();
+ fieldName << namePrefix << "_" << field->name();
+ TString fieldApiName = apiNamePrefix + ".";
+ fieldApiName += field->name().data();
+ fieldType->createSamplerSymbols(ImmutableString(fieldName.str()), fieldApiName,
+ outputSymbols, outputSymbolsToAPINames, symbolTable);
+ }
+ }
+}
+
+void TStructure::setName(const ImmutableString &name)
+{
+ ImmutableString *mutableName = const_cast<ImmutableString *>(&mName);
+ *mutableName = name;
+}
+
+TInterfaceBlock::TInterfaceBlock(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ const TFieldList *fields,
+ const TLayoutQualifier &layoutQualifier,
+ SymbolType symbolType,
+ TExtension extension)
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::InterfaceBlock, extension),
+ TFieldListCollection(fields),
+ mBlockStorage(layoutQualifier.blockStorage),
+ mBinding(layoutQualifier.binding)
+{
+ ASSERT(name != nullptr);
+}
+
+TInterfaceBlock::TInterfaceBlock(const TSymbolUniqueId &id,
+ const ImmutableString &name,
+ TExtension extension,
+ const TFieldList *fields)
+ : TSymbol(id, name, SymbolType::BuiltIn, extension, SymbolClass::InterfaceBlock),
+ TFieldListCollection(fields),
+ mBlockStorage(EbsUnspecified),
+ mBinding(0)
+{}
+
+TFunction::TFunction(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ SymbolType symbolType,
+ const TType *retType,
+ bool knownToNotHaveSideEffects)
+ : TSymbol(symbolTable, name, symbolType, SymbolClass::Function, TExtension::UNDEFINED),
+ mParametersVector(new TParamVector()),
+ mParameters(nullptr),
+ mParamCount(0u),
+ returnType(retType),
+ mMangledName(""),
+ mOp(EOpNull),
+ defined(false),
+ mHasPrototypeDeclaration(false),
+ mKnownToNotHaveSideEffects(knownToNotHaveSideEffects)
+{
+ // Functions with an empty name are not allowed.
+ ASSERT(symbolType != SymbolType::Empty);
+ ASSERT(name != nullptr || symbolType == SymbolType::AngleInternal);
+}
+
+void TFunction::addParameter(const TVariable *p)
+{
+ ASSERT(mParametersVector);
+ mParametersVector->push_back(p);
+ mParameters = mParametersVector->data();
+ mParamCount = mParametersVector->size();
+ mMangledName = kEmptyImmutableString;
+}
+
+void TFunction::shareParameters(const TFunction &parametersSource)
+{
+ mParametersVector = nullptr;
+ mParameters = parametersSource.mParameters;
+ mParamCount = parametersSource.mParamCount;
+ ASSERT(parametersSource.name() == name());
+ mMangledName = parametersSource.mMangledName;
+}
+
+ImmutableString TFunction::buildMangledName() const
+{
+ std::string newName(name().data(), name().length());
+ newName += kFunctionMangledNameSeparator;
+
+ for (size_t i = 0u; i < mParamCount; ++i)
+ {
+ newName += mParameters[i]->getType().getMangledName();
+ }
+ return ImmutableString(newName);
+}
+
+bool TFunction::isMain() const
+{
+ return symbolType() == SymbolType::UserDefined && name() == kMainName;
+}
+
+bool TFunction::isImageFunction() const
+{
+ return symbolType() == SymbolType::BuiltIn &&
+ (name() == kImageSizeName || name() == kImageLoadName || name() == kImageStoreName);
+}
+
+bool TFunction::isAtomicCounterFunction() const
+{
+ return SymbolType() == SymbolType::BuiltIn && name().beginsWith(kAtomicCounterName);
+}
+
+bool TFunction::hasSamplerInStructParams() const
+{
+ for (size_t paramIndex = 0; paramIndex < mParamCount; ++paramIndex)
+ {
+ const TVariable *param = getParam(paramIndex);
+ if (param->getType().isStructureContainingSamplers())
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/Symbol.h b/gfx/angle/checkout/src/compiler/translator/Symbol.h
new file mode 100644
index 0000000000..3b74a0baa4
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Symbol.h
@@ -0,0 +1,277 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Symbol.h: Symbols representing variables, functions, structures and interface blocks.
+//
+
+#ifndef COMPILER_TRANSLATOR_SYMBOL_H_
+#define COMPILER_TRANSLATOR_SYMBOL_H_
+
+#include "common/angleutils.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/SymbolUniqueId.h"
+
+namespace sh
+{
+
+class TSymbolTable;
+
+// Symbol base class. (Can build functions or variables out of these...)
+class TSymbol : angle::NonCopyable
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TSymbol(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ SymbolType symbolType,
+ SymbolClass symbolClass,
+ TExtension extension = TExtension::UNDEFINED);
+
+ // Note that we can't have a virtual destructor in order to support constexpr symbols. Data is
+ // either statically allocated or pool allocated.
+ ~TSymbol() = default;
+
+ // Calling name() for empty symbols (symbolType == SymbolType::Empty) generates a similar name
+ // as for internal variables.
+ ImmutableString name() const;
+ // Don't call getMangledName() for empty symbols (symbolType == SymbolType::Empty).
+ ImmutableString getMangledName() const;
+
+ bool isFunction() const { return mSymbolClass == SymbolClass::Function; }
+ bool isVariable() const { return mSymbolClass == SymbolClass::Variable; }
+ bool isStruct() const { return mSymbolClass == SymbolClass::Struct; }
+ bool isInterfaceBlock() const { return mSymbolClass == SymbolClass::InterfaceBlock; }
+
+ const TSymbolUniqueId &uniqueId() const { return mUniqueId; }
+ SymbolType symbolType() const { return mSymbolType; }
+ TExtension extension() const { return mExtension; }
+
+ protected:
+ constexpr TSymbol(const TSymbolUniqueId &id,
+ const ImmutableString &name,
+ SymbolType symbolType,
+ TExtension extension,
+ SymbolClass symbolClass)
+ : mName(name),
+ mUniqueId(id),
+ mSymbolType(symbolType),
+ mExtension(extension),
+ mSymbolClass(symbolClass)
+ {}
+
+ const ImmutableString mName;
+
+ private:
+ const TSymbolUniqueId mUniqueId;
+ const SymbolType mSymbolType;
+ const TExtension mExtension;
+
+ // We use this instead of having virtual functions for querying the class in order to support
+ // constexpr symbols.
+ const SymbolClass mSymbolClass;
+};
+
+// Variable.
+// May store the value of a constant variable of any type (float, int, bool or struct).
+class TVariable : public TSymbol
+{
+ public:
+ TVariable(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ const TType *type,
+ SymbolType symbolType,
+ TExtension ext = TExtension::UNDEFINED);
+
+ const TType &getType() const { return *mType; }
+
+ const TConstantUnion *getConstPointer() const { return unionArray; }
+
+ void shareConstPointer(const TConstantUnion *constArray) { unionArray = constArray; }
+
+ // Note: only to be used for built-in variables with autogenerated ids!
+ constexpr TVariable(const TSymbolUniqueId &id,
+ const ImmutableString &name,
+ SymbolType symbolType,
+ TExtension extension,
+ const TType *type)
+ : TSymbol(id, name, symbolType, extension, SymbolClass::Variable),
+ mType(type),
+ unionArray(nullptr)
+ {}
+
+ private:
+ const TType *mType;
+ const TConstantUnion *unionArray;
+};
+
+// Struct type.
+class TStructure : public TSymbol, public TFieldListCollection
+{
+ public:
+ TStructure(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ const TFieldList *fields,
+ SymbolType symbolType);
+
+ // The char arrays passed in must be pool allocated or static.
+ void createSamplerSymbols(const char *namePrefix,
+ const TString &apiNamePrefix,
+ TVector<const TVariable *> *outputSymbols,
+ TMap<const TVariable *, TString> *outputSymbolsToAPINames,
+ TSymbolTable *symbolTable) const;
+
+ void setAtGlobalScope(bool atGlobalScope) { mAtGlobalScope = atGlobalScope; }
+ bool atGlobalScope() const { return mAtGlobalScope; }
+
+ private:
+ friend class TSymbolTable;
+ // For creating built-in structs.
+ TStructure(const TSymbolUniqueId &id,
+ const ImmutableString &name,
+ TExtension extension,
+ const TFieldList *fields);
+
+ // TODO(zmo): Find a way to get rid of the const_cast in function
+ // setName(). At the moment keep this function private so only
+ // friend class RegenerateStructNames may call it.
+ friend class RegenerateStructNames;
+ void setName(const ImmutableString &name);
+
+ bool mAtGlobalScope;
+};
+
+// Interface block. Note that this contains the block name, not the instance name. Interface block
+// instances are stored as TVariable.
+class TInterfaceBlock : public TSymbol, public TFieldListCollection
+{
+ public:
+ TInterfaceBlock(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ const TFieldList *fields,
+ const TLayoutQualifier &layoutQualifier,
+ SymbolType symbolType,
+ TExtension extension = TExtension::UNDEFINED);
+
+ TLayoutBlockStorage blockStorage() const { return mBlockStorage; }
+ int blockBinding() const { return mBinding; }
+
+ private:
+ friend class TSymbolTable;
+ // For creating built-in interface blocks.
+ TInterfaceBlock(const TSymbolUniqueId &id,
+ const ImmutableString &name,
+ TExtension extension,
+ const TFieldList *fields);
+
+ TLayoutBlockStorage mBlockStorage;
+ int mBinding;
+
+ // Note that we only record matrix packing on a per-field granularity.
+};
+
+// Parameter class used for parsing user-defined function parameters.
+struct TParameter
+{
+ // Destructively converts to TVariable.
+ // This method resets name and type to nullptrs to make sure
+ // their content cannot be modified after the call.
+ const TVariable *createVariable(TSymbolTable *symbolTable)
+ {
+ const ImmutableString constName(name);
+ const TType *constType = type;
+ name = nullptr;
+ type = nullptr;
+ return new TVariable(symbolTable, constName, constType,
+ constName.empty() ? SymbolType::Empty : SymbolType::UserDefined);
+ }
+
+ const char *name; // either pool allocated or static.
+ TType *type;
+};
+
+// The function sub-class of a symbol.
+class TFunction : public TSymbol
+{
+ public:
+ // User-defined function
+ TFunction(TSymbolTable *symbolTable,
+ const ImmutableString &name,
+ SymbolType symbolType,
+ const TType *retType,
+ bool knownToNotHaveSideEffects);
+
+ void addParameter(const TVariable *p);
+ void shareParameters(const TFunction &parametersSource);
+
+ ImmutableString getFunctionMangledName() const
+ {
+ ASSERT(symbolType() != SymbolType::BuiltIn);
+ if (mMangledName.empty())
+ {
+ mMangledName = buildMangledName();
+ }
+ return mMangledName;
+ }
+
+ const TType &getReturnType() const { return *returnType; }
+
+ TOperator getBuiltInOp() const { return mOp; }
+
+ void setDefined() { defined = true; }
+ bool isDefined() { return defined; }
+ void setHasPrototypeDeclaration() { mHasPrototypeDeclaration = true; }
+ bool hasPrototypeDeclaration() const { return mHasPrototypeDeclaration; }
+
+ size_t getParamCount() const { return mParamCount; }
+ const TVariable *getParam(size_t i) const { return mParameters[i]; }
+
+ bool isKnownToNotHaveSideEffects() const { return mKnownToNotHaveSideEffects; }
+
+ bool isMain() const;
+ bool isImageFunction() const;
+ bool isAtomicCounterFunction() const;
+ bool hasSamplerInStructParams() const;
+
+ // Note: Only to be used for static built-in functions!
+ constexpr TFunction(const TSymbolUniqueId &id,
+ const ImmutableString &name,
+ TExtension extension,
+ const TVariable *const *parameters,
+ size_t paramCount,
+ const TType *retType,
+ TOperator op,
+ bool knownToNotHaveSideEffects)
+ : TSymbol(id, name, SymbolType::BuiltIn, extension, SymbolClass::Function),
+ mParametersVector(nullptr),
+ mParameters(parameters),
+ mParamCount(paramCount),
+ returnType(retType),
+ mMangledName(nullptr),
+ mOp(op),
+ defined(false),
+ mHasPrototypeDeclaration(false),
+ mKnownToNotHaveSideEffects(knownToNotHaveSideEffects)
+ {}
+
+ private:
+ ImmutableString buildMangledName() const;
+
+ typedef TVector<const TVariable *> TParamVector;
+ TParamVector *mParametersVector;
+ const TVariable *const *mParameters;
+ size_t mParamCount;
+ const TType *const returnType;
+ mutable ImmutableString mMangledName;
+ const TOperator mOp; // Only set for built-ins
+ bool defined;
+ bool mHasPrototypeDeclaration;
+ bool mKnownToNotHaveSideEffects;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_SYMBOL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp b/gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp
new file mode 100644
index 0000000000..cc9e72e880
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp
@@ -0,0 +1,417 @@
+//
+// 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.
+//
+// Symbol table for parsing. The design principles and most of the functionality are documented in
+// the header file.
+//
+
+#if defined(_MSC_VER)
+# pragma warning(disable : 4718)
+#endif
+
+#include "compiler/translator/SymbolTable.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+class TSymbolTable::TSymbolTableLevel
+{
+ public:
+ TSymbolTableLevel() = default;
+
+ bool insert(TSymbol *symbol);
+
+ // Insert a function using its unmangled name as the key.
+ void insertUnmangled(TFunction *function);
+
+ TSymbol *find(const ImmutableString &name) const;
+
+ private:
+ using tLevel = TUnorderedMap<ImmutableString,
+ TSymbol *,
+ ImmutableString::FowlerNollVoHash<sizeof(size_t)>>;
+ using tLevelPair = const tLevel::value_type;
+ using tInsertResult = std::pair<tLevel::iterator, bool>;
+
+ tLevel level;
+};
+
+bool TSymbolTable::TSymbolTableLevel::insert(TSymbol *symbol)
+{
+ // returning true means symbol was added to the table
+ tInsertResult result = level.insert(tLevelPair(symbol->getMangledName(), symbol));
+ return result.second;
+}
+
+void TSymbolTable::TSymbolTableLevel::insertUnmangled(TFunction *function)
+{
+ level.insert(tLevelPair(function->name(), function));
+}
+
+TSymbol *TSymbolTable::TSymbolTableLevel::find(const ImmutableString &name) const
+{
+ tLevel::const_iterator it = level.find(name);
+ if (it == level.end())
+ return nullptr;
+ else
+ return (*it).second;
+}
+
+TSymbolTable::TSymbolTable()
+ : mGlobalInvariant(false),
+ mUniqueIdCounter(0),
+ mShaderType(GL_FRAGMENT_SHADER),
+ mGlInVariableWithArraySize(nullptr)
+{}
+
+TSymbolTable::~TSymbolTable() = default;
+
+bool TSymbolTable::isEmpty() const
+{
+ return mTable.empty();
+}
+
+bool TSymbolTable::atGlobalLevel() const
+{
+ return mTable.size() == 1u;
+}
+
+void TSymbolTable::push()
+{
+ mTable.emplace_back(new TSymbolTableLevel);
+ mPrecisionStack.emplace_back(new PrecisionStackLevel);
+}
+
+void TSymbolTable::pop()
+{
+ mTable.pop_back();
+ mPrecisionStack.pop_back();
+}
+
+const TFunction *TSymbolTable::markFunctionHasPrototypeDeclaration(
+ const ImmutableString &mangledName,
+ bool *hadPrototypeDeclarationOut) const
+{
+ TFunction *function = findUserDefinedFunction(mangledName);
+ *hadPrototypeDeclarationOut = function->hasPrototypeDeclaration();
+ function->setHasPrototypeDeclaration();
+ return function;
+}
+
+const TFunction *TSymbolTable::setFunctionParameterNamesFromDefinition(const TFunction *function,
+ bool *wasDefinedOut) const
+{
+ TFunction *firstDeclaration = findUserDefinedFunction(function->getMangledName());
+ ASSERT(firstDeclaration);
+ // Note: 'firstDeclaration' could be 'function' if this is the first time we've seen function as
+ // it would have just been put in the symbol table. Otherwise, we're looking up an earlier
+ // occurance.
+ if (function != firstDeclaration)
+ {
+ // The previous declaration should have the same parameters as the function definition
+ // (parameter names may differ).
+ firstDeclaration->shareParameters(*function);
+ }
+
+ *wasDefinedOut = firstDeclaration->isDefined();
+ firstDeclaration->setDefined();
+ return firstDeclaration;
+}
+
+bool TSymbolTable::setGlInArraySize(unsigned int inputArraySize)
+{
+ if (mGlInVariableWithArraySize)
+ {
+ return mGlInVariableWithArraySize->getType().getOutermostArraySize() == inputArraySize;
+ }
+ const TInterfaceBlock *glPerVertex = mVar_gl_PerVertex;
+ TType *glInType = new TType(glPerVertex, EvqPerVertexIn, TLayoutQualifier::Create());
+ glInType->makeArray(inputArraySize);
+ mGlInVariableWithArraySize =
+ new TVariable(this, ImmutableString("gl_in"), glInType, SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader);
+ return true;
+}
+
+TVariable *TSymbolTable::getGlInVariableWithArraySize() const
+{
+ return mGlInVariableWithArraySize;
+}
+
+const TVariable *TSymbolTable::gl_FragData() const
+{
+ return mVar_gl_FragData;
+}
+
+const TVariable *TSymbolTable::gl_SecondaryFragDataEXT() const
+{
+ return mVar_gl_SecondaryFragDataEXT;
+}
+
+TSymbolTable::VariableMetadata *TSymbolTable::getOrCreateVariableMetadata(const TVariable &variable)
+{
+ int id = variable.uniqueId().get();
+ auto iter = mVariableMetadata.find(id);
+ if (iter == mVariableMetadata.end())
+ {
+ iter = mVariableMetadata.insert(std::make_pair(id, VariableMetadata())).first;
+ }
+ return &iter->second;
+}
+
+void TSymbolTable::markStaticWrite(const TVariable &variable)
+{
+ auto metadata = getOrCreateVariableMetadata(variable);
+ metadata->staticWrite = true;
+}
+
+void TSymbolTable::markStaticRead(const TVariable &variable)
+{
+ auto metadata = getOrCreateVariableMetadata(variable);
+ metadata->staticRead = true;
+}
+
+bool TSymbolTable::isStaticallyUsed(const TVariable &variable) const
+{
+ ASSERT(!variable.getConstPointer());
+ int id = variable.uniqueId().get();
+ auto iter = mVariableMetadata.find(id);
+ return iter != mVariableMetadata.end() && (iter->second.staticRead || iter->second.staticWrite);
+}
+
+void TSymbolTable::addInvariantVarying(const TVariable &variable)
+{
+ ASSERT(atGlobalLevel());
+ auto metadata = getOrCreateVariableMetadata(variable);
+ metadata->invariant = true;
+}
+
+bool TSymbolTable::isVaryingInvariant(const TVariable &variable) const
+{
+ ASSERT(atGlobalLevel());
+ if (mGlobalInvariant && (IsShaderOutput(variable.getType().getQualifier())))
+ {
+ return true;
+ }
+ int id = variable.uniqueId().get();
+ auto iter = mVariableMetadata.find(id);
+ return iter != mVariableMetadata.end() && iter->second.invariant;
+}
+
+void TSymbolTable::setGlobalInvariant(bool invariant)
+{
+ ASSERT(atGlobalLevel());
+ mGlobalInvariant = invariant;
+}
+
+const TSymbol *TSymbolTable::find(const ImmutableString &name, int shaderVersion) const
+{
+ const TSymbol *userSymbol = findUserDefined(name);
+ if (userSymbol)
+ {
+ return userSymbol;
+ }
+
+ return findBuiltIn(name, shaderVersion);
+}
+
+const TSymbol *TSymbolTable::findUserDefined(const ImmutableString &name) const
+{
+ int userDefinedLevel = static_cast<int>(mTable.size()) - 1;
+ while (userDefinedLevel >= 0)
+ {
+ const TSymbol *symbol = mTable[userDefinedLevel]->find(name);
+ if (symbol)
+ {
+ return symbol;
+ }
+ userDefinedLevel--;
+ }
+
+ return nullptr;
+}
+
+TFunction *TSymbolTable::findUserDefinedFunction(const ImmutableString &name) const
+{
+ // User-defined functions are always declared at the global level.
+ ASSERT(!mTable.empty());
+ return static_cast<TFunction *>(mTable[0]->find(name));
+}
+
+const TSymbol *TSymbolTable::findGlobal(const ImmutableString &name) const
+{
+ ASSERT(!mTable.empty());
+ return mTable[0]->find(name);
+}
+
+const TSymbol *TSymbolTable::findGlobalWithConversion(
+ const std::vector<ImmutableString> &names) const
+{
+ const TSymbol *target;
+ for (ImmutableString name : names)
+ {
+ target = findGlobal(name);
+ if (target != nullptr)
+ break;
+ }
+ return target;
+}
+
+const TSymbol *TSymbolTable::findBuiltInWithConversion(const std::vector<ImmutableString> &names,
+ int shaderVersion) const
+{
+ const TSymbol *target;
+ for (ImmutableString name : names)
+ {
+ target = findBuiltIn(name, shaderVersion);
+ if (target != nullptr)
+ break;
+ }
+ return target;
+}
+
+bool TSymbolTable::declare(TSymbol *symbol)
+{
+ ASSERT(!mTable.empty());
+ ASSERT(symbol->symbolType() == SymbolType::UserDefined);
+ ASSERT(!symbol->isFunction());
+ return mTable.back()->insert(symbol);
+}
+
+bool TSymbolTable::declareInternal(TSymbol *symbol)
+{
+ ASSERT(!mTable.empty());
+ ASSERT(symbol->symbolType() == SymbolType::AngleInternal);
+ ASSERT(!symbol->isFunction());
+ return mTable.back()->insert(symbol);
+}
+
+void TSymbolTable::declareUserDefinedFunction(TFunction *function, bool insertUnmangledName)
+{
+ ASSERT(!mTable.empty());
+ if (insertUnmangledName)
+ {
+ // Insert the unmangled name to detect potential future redefinition as a variable.
+ mTable[0]->insertUnmangled(function);
+ }
+ mTable[0]->insert(function);
+}
+
+void TSymbolTable::setDefaultPrecision(TBasicType type, TPrecision prec)
+{
+ int indexOfLastElement = static_cast<int>(mPrecisionStack.size()) - 1;
+ // Uses map operator [], overwrites the current value
+ (*mPrecisionStack[indexOfLastElement])[type] = prec;
+}
+
+TPrecision TSymbolTable::getDefaultPrecision(TBasicType type) const
+{
+ if (!SupportsPrecision(type))
+ return EbpUndefined;
+
+ // unsigned integers use the same precision as signed
+ TBasicType baseType = (type == EbtUInt) ? EbtInt : type;
+
+ int level = static_cast<int>(mPrecisionStack.size()) - 1;
+ ASSERT(level >= 0); // Just to be safe. Should not happen.
+ // If we dont find anything we return this. Some types don't have predefined default precision.
+ TPrecision prec = EbpUndefined;
+ while (level >= 0)
+ {
+ PrecisionStackLevel::iterator it = mPrecisionStack[level]->find(baseType);
+ if (it != mPrecisionStack[level]->end())
+ {
+ prec = (*it).second;
+ break;
+ }
+ level--;
+ }
+ return prec;
+}
+
+void TSymbolTable::clearCompilationResults()
+{
+ mGlobalInvariant = false;
+ mUniqueIdCounter = kLastBuiltInId + 1;
+ mVariableMetadata.clear();
+ mGlInVariableWithArraySize = nullptr;
+
+ // User-defined scopes should have already been cleared when the compilation finished.
+ ASSERT(mTable.empty());
+}
+
+int TSymbolTable::nextUniqueIdValue()
+{
+ ASSERT(mUniqueIdCounter < std::numeric_limits<int>::max());
+ return ++mUniqueIdCounter;
+}
+
+void TSymbolTable::initializeBuiltIns(sh::GLenum type,
+ ShShaderSpec spec,
+ const ShBuiltInResources &resources)
+{
+ mShaderType = type;
+ mResources = resources;
+
+ // We need just one precision stack level for predefined precisions.
+ mPrecisionStack.emplace_back(new PrecisionStackLevel);
+
+ if (IsDesktopGLSpec(spec))
+ {
+ setDefaultPrecision(EbtInt, EbpUndefined);
+ setDefaultPrecision(EbtFloat, EbpUndefined);
+ }
+ else
+ {
+ switch (type)
+ {
+ case GL_FRAGMENT_SHADER:
+ setDefaultPrecision(EbtInt, EbpMedium);
+ break;
+ case GL_VERTEX_SHADER:
+ case GL_COMPUTE_SHADER:
+ case GL_GEOMETRY_SHADER_EXT:
+ setDefaultPrecision(EbtInt, EbpHigh);
+ setDefaultPrecision(EbtFloat, EbpHigh);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ // Set defaults for sampler types that have default precision, even those that are
+ // only available if an extension exists.
+ // New sampler types in ESSL3 don't have default precision. ESSL1 types do.
+ initSamplerDefaultPrecision(EbtSampler2D);
+ initSamplerDefaultPrecision(EbtSamplerCube);
+ // SamplerExternalOES is specified in the extension to have default precision.
+ initSamplerDefaultPrecision(EbtSamplerExternalOES);
+ // SamplerExternal2DY2YEXT is specified in the extension to have default precision.
+ initSamplerDefaultPrecision(EbtSamplerExternal2DY2YEXT);
+ // It isn't specified whether Sampler2DRect has default precision.
+ initSamplerDefaultPrecision(EbtSampler2DRect);
+
+ setDefaultPrecision(EbtAtomicCounter, EbpHigh);
+
+ initializeBuiltInVariables(type, spec, resources);
+ mUniqueIdCounter = kLastBuiltInId + 1;
+}
+
+void TSymbolTable::initSamplerDefaultPrecision(TBasicType samplerType)
+{
+ ASSERT(samplerType >= EbtGuardSamplerBegin && samplerType <= EbtGuardSamplerEnd);
+ setDefaultPrecision(samplerType, EbpLow);
+}
+
+TSymbolTable::VariableMetadata::VariableMetadata()
+ : staticRead(false), staticWrite(false), invariant(false)
+{}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable.h b/gfx/angle/checkout/src/compiler/translator/SymbolTable.h
new file mode 100644
index 0000000000..687ddccd6f
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable.h
@@ -0,0 +1,201 @@
+//
+// 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_SYMBOLTABLE_H_
+#define COMPILER_TRANSLATOR_SYMBOLTABLE_H_
+
+//
+// Symbol table for parsing. Has these design characteristics:
+//
+// * Same symbol table can be used to compile many shaders, to preserve
+// effort of creating and loading with the large numbers of built-in
+// symbols.
+//
+// * Name mangling will be used to give each function a unique name
+// so that symbol table lookups are never ambiguous. This allows
+// a simpler symbol table structure.
+//
+// * Pushing and popping of scope, so symbol table will really be a stack
+// of symbol tables. Searched from the top, with new inserts going into
+// the top.
+//
+// * Constants: Compile time constant symbols will keep their values
+// in the symbol table. The parser can substitute constants at parse
+// time, including doing constant folding and constant propagation.
+//
+// * No temporaries: Temporaries made from operations (+, --, .xy, etc.)
+// are tracked in the intermediate representation, not the symbol table.
+//
+
+#include <memory>
+#include <set>
+
+#include "common/angleutils.h"
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/SymbolTable_autogen.h"
+
+namespace sh
+{
+
+// Define ESymbolLevel as int rather than an enum so that we can do arithmetic on it.
+typedef int ESymbolLevel;
+const int COMMON_BUILTINS = 0;
+const int ESSL1_BUILTINS = 1;
+const int ESSL3_BUILTINS = 2;
+const int ESSL3_1_BUILTINS = 3;
+// GLSL_BUILTINS are desktop GLSL builtins that don't exist in ESSL but are used to implement
+// features in ANGLE's GLSL backend. They're not visible to the parser.
+const int GLSL_BUILTINS = 4;
+const int LAST_BUILTIN_LEVEL = GLSL_BUILTINS;
+
+struct UnmangledBuiltIn
+{
+ constexpr UnmangledBuiltIn(TExtension extension) : extension(extension) {}
+
+ TExtension extension;
+};
+
+class TSymbolTable : angle::NonCopyable, TSymbolTableBase
+{
+ public:
+ TSymbolTable();
+ // To start using the symbol table after construction:
+ // * initializeBuiltIns() needs to be called.
+ // * push() needs to be called to push the global level.
+
+ ~TSymbolTable();
+
+ bool isEmpty() const;
+ bool atGlobalLevel() const;
+
+ void push();
+ void pop();
+
+ // Declare a non-function symbol at the current scope. Return true in case the declaration was
+ // successful, and false if the declaration failed due to redefinition.
+ bool declare(TSymbol *symbol);
+
+ // Only used to declare internal variables.
+ bool declareInternal(TSymbol *symbol);
+
+ // Functions are always declared at global scope.
+ void declareUserDefinedFunction(TFunction *function, bool insertUnmangledName);
+
+ // These return the TFunction pointer to keep using to refer to this function.
+ const TFunction *markFunctionHasPrototypeDeclaration(const ImmutableString &mangledName,
+ bool *hadPrototypeDeclarationOut) const;
+ const TFunction *setFunctionParameterNamesFromDefinition(const TFunction *function,
+ bool *wasDefinedOut) const;
+
+ // Return false if the gl_in array size has already been initialized with a mismatching value.
+ bool setGlInArraySize(unsigned int inputArraySize);
+ TVariable *getGlInVariableWithArraySize() const;
+
+ const TVariable *gl_FragData() const;
+ const TVariable *gl_SecondaryFragDataEXT() const;
+
+ void markStaticRead(const TVariable &variable);
+ void markStaticWrite(const TVariable &variable);
+
+ // Note: Should not call this for constant variables.
+ bool isStaticallyUsed(const TVariable &variable) const;
+
+ // find() is guaranteed not to retain a reference to the ImmutableString, so an ImmutableString
+ // with a reference to a short-lived char * is fine to pass here.
+ const TSymbol *find(const ImmutableString &name, int shaderVersion) const;
+
+ const TSymbol *findUserDefined(const ImmutableString &name) const;
+
+ TFunction *findUserDefinedFunction(const ImmutableString &name) const;
+
+ const TSymbol *findGlobal(const ImmutableString &name) const;
+ const TSymbol *findGlobalWithConversion(const std::vector<ImmutableString> &names) const;
+
+ const TSymbol *findBuiltIn(const ImmutableString &name, int shaderVersion) const;
+ const TSymbol *findBuiltInWithConversion(const std::vector<ImmutableString> &names,
+ int shaderVersion) const;
+
+ void setDefaultPrecision(TBasicType type, TPrecision prec);
+
+ // Searches down the precisionStack for a precision qualifier
+ // for the specified TBasicType
+ TPrecision getDefaultPrecision(TBasicType type) const;
+
+ // This records invariant varyings declared through "invariant varying_name;".
+ void addInvariantVarying(const TVariable &variable);
+
+ // If this returns false, the varying could still be invariant if it is set as invariant during
+ // the varying variable declaration - this piece of information is stored in the variable's
+ // type, not here.
+ bool isVaryingInvariant(const TVariable &variable) const;
+
+ void setGlobalInvariant(bool invariant);
+
+ const TSymbolUniqueId nextUniqueId() { return TSymbolUniqueId(this); }
+
+ // Gets the built-in accessible by a shader with the specified version, if any.
+ const UnmangledBuiltIn *getUnmangledBuiltInForShaderVersion(const ImmutableString &name,
+ int shaderVersion);
+
+ void initializeBuiltIns(sh::GLenum type,
+ ShShaderSpec spec,
+ const ShBuiltInResources &resources);
+ void clearCompilationResults();
+
+ private:
+ friend class TSymbolUniqueId;
+
+ struct VariableMetadata
+ {
+ VariableMetadata();
+ bool staticRead;
+ bool staticWrite;
+ bool invariant;
+ };
+
+ int nextUniqueIdValue();
+
+ class TSymbolTableLevel;
+
+ void initSamplerDefaultPrecision(TBasicType samplerType);
+
+ void initializeBuiltInVariables(sh::GLenum shaderType,
+ ShShaderSpec spec,
+ const ShBuiltInResources &resources);
+
+ VariableMetadata *getOrCreateVariableMetadata(const TVariable &variable);
+
+ std::vector<std::unique_ptr<TSymbolTableLevel>> mTable;
+
+ // There's one precision stack level for predefined precisions and then one level for each scope
+ // in table.
+ typedef TMap<TBasicType, TPrecision> PrecisionStackLevel;
+ std::vector<std::unique_ptr<PrecisionStackLevel>> mPrecisionStack;
+
+ bool mGlobalInvariant;
+
+ int mUniqueIdCounter;
+
+ static const int kLastBuiltInId;
+
+ sh::GLenum mShaderType;
+ ShBuiltInResources mResources;
+
+ // Indexed by unique id. Map instead of vector since the variables are fairly sparse.
+ std::map<int, VariableMetadata> mVariableMetadata;
+
+ // Store gl_in variable with its array size once the array size can be determined. The array
+ // size can also be checked against latter input primitive type declaration.
+ TVariable *mGlInVariableWithArraySize;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_SYMBOLTABLE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp
new file mode 100644
index 0000000000..d2307d5f53
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp
@@ -0,0 +1,20959 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_builtin_symbols.py using data from builtin_variables.json and
+// builtin_function_declarations.txt.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SymbolTable_autogen.cpp:
+// Compile-time initialized built-ins.
+
+#include "compiler/translator/SymbolTable.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+
+namespace sh
+{
+
+// Since some of the BuiltInId declarations are used outside of constexpr expressions, we need to
+// have these definitions without an initializer. C++17 should eventually remove the need for this.
+constexpr const TSymbolUniqueId BuiltInId::radians_Float1;
+constexpr const TSymbolUniqueId BuiltInId::radians_Float2;
+constexpr const TSymbolUniqueId BuiltInId::radians_Float3;
+constexpr const TSymbolUniqueId BuiltInId::radians_Float4;
+constexpr const TSymbolUniqueId BuiltInId::degrees_Float1;
+constexpr const TSymbolUniqueId BuiltInId::degrees_Float2;
+constexpr const TSymbolUniqueId BuiltInId::degrees_Float3;
+constexpr const TSymbolUniqueId BuiltInId::degrees_Float4;
+constexpr const TSymbolUniqueId BuiltInId::sin_Float1;
+constexpr const TSymbolUniqueId BuiltInId::sin_Float2;
+constexpr const TSymbolUniqueId BuiltInId::sin_Float3;
+constexpr const TSymbolUniqueId BuiltInId::sin_Float4;
+constexpr const TSymbolUniqueId BuiltInId::cos_Float1;
+constexpr const TSymbolUniqueId BuiltInId::cos_Float2;
+constexpr const TSymbolUniqueId BuiltInId::cos_Float3;
+constexpr const TSymbolUniqueId BuiltInId::cos_Float4;
+constexpr const TSymbolUniqueId BuiltInId::tan_Float1;
+constexpr const TSymbolUniqueId BuiltInId::tan_Float2;
+constexpr const TSymbolUniqueId BuiltInId::tan_Float3;
+constexpr const TSymbolUniqueId BuiltInId::tan_Float4;
+constexpr const TSymbolUniqueId BuiltInId::asin_Float1;
+constexpr const TSymbolUniqueId BuiltInId::asin_Float2;
+constexpr const TSymbolUniqueId BuiltInId::asin_Float3;
+constexpr const TSymbolUniqueId BuiltInId::asin_Float4;
+constexpr const TSymbolUniqueId BuiltInId::acos_Float1;
+constexpr const TSymbolUniqueId BuiltInId::acos_Float2;
+constexpr const TSymbolUniqueId BuiltInId::acos_Float3;
+constexpr const TSymbolUniqueId BuiltInId::acos_Float4;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float1;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float2;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float3;
+constexpr const TSymbolUniqueId BuiltInId::atan_Float4;
+constexpr const TSymbolUniqueId BuiltInId::sinh_Float1;
+constexpr const TSymbolUniqueId BuiltInId::sinh_Float2;
+constexpr const TSymbolUniqueId BuiltInId::sinh_Float3;
+constexpr const TSymbolUniqueId BuiltInId::sinh_Float4;
+constexpr const TSymbolUniqueId BuiltInId::cosh_Float1;
+constexpr const TSymbolUniqueId BuiltInId::cosh_Float2;
+constexpr const TSymbolUniqueId BuiltInId::cosh_Float3;
+constexpr const TSymbolUniqueId BuiltInId::cosh_Float4;
+constexpr const TSymbolUniqueId BuiltInId::tanh_Float1;
+constexpr const TSymbolUniqueId BuiltInId::tanh_Float2;
+constexpr const TSymbolUniqueId BuiltInId::tanh_Float3;
+constexpr const TSymbolUniqueId BuiltInId::tanh_Float4;
+constexpr const TSymbolUniqueId BuiltInId::asinh_Float1;
+constexpr const TSymbolUniqueId BuiltInId::asinh_Float2;
+constexpr const TSymbolUniqueId BuiltInId::asinh_Float3;
+constexpr const TSymbolUniqueId BuiltInId::asinh_Float4;
+constexpr const TSymbolUniqueId BuiltInId::acosh_Float1;
+constexpr const TSymbolUniqueId BuiltInId::acosh_Float2;
+constexpr const TSymbolUniqueId BuiltInId::acosh_Float3;
+constexpr const TSymbolUniqueId BuiltInId::acosh_Float4;
+constexpr const TSymbolUniqueId BuiltInId::atanh_Float1;
+constexpr const TSymbolUniqueId BuiltInId::atanh_Float2;
+constexpr const TSymbolUniqueId BuiltInId::atanh_Float3;
+constexpr const TSymbolUniqueId BuiltInId::atanh_Float4;
+constexpr const TSymbolUniqueId BuiltInId::pow_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::pow_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::pow_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::pow_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::exp_Float1;
+constexpr const TSymbolUniqueId BuiltInId::exp_Float2;
+constexpr const TSymbolUniqueId BuiltInId::exp_Float3;
+constexpr const TSymbolUniqueId BuiltInId::exp_Float4;
+constexpr const TSymbolUniqueId BuiltInId::log_Float1;
+constexpr const TSymbolUniqueId BuiltInId::log_Float2;
+constexpr const TSymbolUniqueId BuiltInId::log_Float3;
+constexpr const TSymbolUniqueId BuiltInId::log_Float4;
+constexpr const TSymbolUniqueId BuiltInId::exp2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::exp2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::exp2_Float3;
+constexpr const TSymbolUniqueId BuiltInId::exp2_Float4;
+constexpr const TSymbolUniqueId BuiltInId::log2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::log2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::log2_Float3;
+constexpr const TSymbolUniqueId BuiltInId::log2_Float4;
+constexpr const TSymbolUniqueId BuiltInId::sqrt_Float1;
+constexpr const TSymbolUniqueId BuiltInId::sqrt_Float2;
+constexpr const TSymbolUniqueId BuiltInId::sqrt_Float3;
+constexpr const TSymbolUniqueId BuiltInId::sqrt_Float4;
+constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float1;
+constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float2;
+constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float3;
+constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float4;
+constexpr const TSymbolUniqueId BuiltInId::abs_Float1;
+constexpr const TSymbolUniqueId BuiltInId::abs_Float2;
+constexpr const TSymbolUniqueId BuiltInId::abs_Float3;
+constexpr const TSymbolUniqueId BuiltInId::abs_Float4;
+constexpr const TSymbolUniqueId BuiltInId::abs_Int1;
+constexpr const TSymbolUniqueId BuiltInId::abs_Int2;
+constexpr const TSymbolUniqueId BuiltInId::abs_Int3;
+constexpr const TSymbolUniqueId BuiltInId::abs_Int4;
+constexpr const TSymbolUniqueId BuiltInId::sign_Float1;
+constexpr const TSymbolUniqueId BuiltInId::sign_Float2;
+constexpr const TSymbolUniqueId BuiltInId::sign_Float3;
+constexpr const TSymbolUniqueId BuiltInId::sign_Float4;
+constexpr const TSymbolUniqueId BuiltInId::sign_Int1;
+constexpr const TSymbolUniqueId BuiltInId::sign_Int2;
+constexpr const TSymbolUniqueId BuiltInId::sign_Int3;
+constexpr const TSymbolUniqueId BuiltInId::sign_Int4;
+constexpr const TSymbolUniqueId BuiltInId::floor_Float1;
+constexpr const TSymbolUniqueId BuiltInId::floor_Float2;
+constexpr const TSymbolUniqueId BuiltInId::floor_Float3;
+constexpr const TSymbolUniqueId BuiltInId::floor_Float4;
+constexpr const TSymbolUniqueId BuiltInId::trunc_Float1;
+constexpr const TSymbolUniqueId BuiltInId::trunc_Float2;
+constexpr const TSymbolUniqueId BuiltInId::trunc_Float3;
+constexpr const TSymbolUniqueId BuiltInId::trunc_Float4;
+constexpr const TSymbolUniqueId BuiltInId::round_Float1;
+constexpr const TSymbolUniqueId BuiltInId::round_Float2;
+constexpr const TSymbolUniqueId BuiltInId::round_Float3;
+constexpr const TSymbolUniqueId BuiltInId::round_Float4;
+constexpr const TSymbolUniqueId BuiltInId::roundEven_Float1;
+constexpr const TSymbolUniqueId BuiltInId::roundEven_Float2;
+constexpr const TSymbolUniqueId BuiltInId::roundEven_Float3;
+constexpr const TSymbolUniqueId BuiltInId::roundEven_Float4;
+constexpr const TSymbolUniqueId BuiltInId::ceil_Float1;
+constexpr const TSymbolUniqueId BuiltInId::ceil_Float2;
+constexpr const TSymbolUniqueId BuiltInId::ceil_Float3;
+constexpr const TSymbolUniqueId BuiltInId::ceil_Float4;
+constexpr const TSymbolUniqueId BuiltInId::fract_Float1;
+constexpr const TSymbolUniqueId BuiltInId::fract_Float2;
+constexpr const TSymbolUniqueId BuiltInId::fract_Float3;
+constexpr const TSymbolUniqueId BuiltInId::fract_Float4;
+constexpr const TSymbolUniqueId BuiltInId::mod_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mod_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mod_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mod_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mod_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::mod_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::mod_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::min_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::min_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::min_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::min_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::min_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::min_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::min_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::min_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::min_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::min_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::min_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::min_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::min_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::min_Int4_Int1;
+constexpr const TSymbolUniqueId BuiltInId::min_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::min_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::min_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::min_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::min_UInt2_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::min_UInt3_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::min_UInt4_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::max_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::max_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::max_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::max_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::max_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::max_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::max_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::max_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::max_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::max_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::max_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::max_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::max_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::max_Int4_Int1;
+constexpr const TSymbolUniqueId BuiltInId::max_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::max_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::max_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::max_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::max_UInt2_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::max_UInt3_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::max_UInt4_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Float1_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Float2_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Float3_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Float4_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Float4_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Int1_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Int2_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Int3_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Int4_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Int2_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Int3_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::clamp_Int4_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::clamp_UInt1_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_UInt2_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_UInt3_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_UInt4_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::clamp_UInt2_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::clamp_UInt3_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::clamp_UInt4_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float1_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float2_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float3_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float4_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float4_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float1_Float1_Bool1;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float2_Float2_Bool2;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float3_Float3_Bool3;
+constexpr const TSymbolUniqueId BuiltInId::mix_Float4_Float4_Bool4;
+constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::step_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::step_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::step_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float4_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::modf_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::modf_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::modf_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::modf_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::isnan_Float1;
+constexpr const TSymbolUniqueId BuiltInId::isnan_Float2;
+constexpr const TSymbolUniqueId BuiltInId::isnan_Float3;
+constexpr const TSymbolUniqueId BuiltInId::isnan_Float4;
+constexpr const TSymbolUniqueId BuiltInId::isinf_Float1;
+constexpr const TSymbolUniqueId BuiltInId::isinf_Float2;
+constexpr const TSymbolUniqueId BuiltInId::isinf_Float3;
+constexpr const TSymbolUniqueId BuiltInId::isinf_Float4;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float1;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float2;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float3;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float4;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float1;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float2;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float3;
+constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float4;
+constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int1;
+constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int2;
+constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int3;
+constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int4;
+constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::frexp_Float1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::frexp_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::frexp_Float3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::frexp_Float4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::ldexp_Float1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::ldexp_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::ldexp_Float3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::ldexp_Float4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::packSnorm2x16_Float2;
+constexpr const TSymbolUniqueId BuiltInId::packUnorm2x16_Float2;
+constexpr const TSymbolUniqueId BuiltInId::packHalf2x16_Float2;
+constexpr const TSymbolUniqueId BuiltInId::unpackSnorm2x16_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::unpackUnorm2x16_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::unpackHalf2x16_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::packUnorm4x8_Float4;
+constexpr const TSymbolUniqueId BuiltInId::packSnorm4x8_Float4;
+constexpr const TSymbolUniqueId BuiltInId::unpackUnorm4x8_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::unpackSnorm4x8_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::length_Float1;
+constexpr const TSymbolUniqueId BuiltInId::length_Float2;
+constexpr const TSymbolUniqueId BuiltInId::length_Float3;
+constexpr const TSymbolUniqueId BuiltInId::length_Float4;
+constexpr const TSymbolUniqueId BuiltInId::distance_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::distance_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::distance_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::distance_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::dot_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::dot_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::dot_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::dot_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::cross_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::normalize_Float1;
+constexpr const TSymbolUniqueId BuiltInId::normalize_Float2;
+constexpr const TSymbolUniqueId BuiltInId::normalize_Float3;
+constexpr const TSymbolUniqueId BuiltInId::normalize_Float4;
+constexpr const TSymbolUniqueId BuiltInId::faceforward_Float1_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::faceforward_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::faceforward_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::faceforward_Float4_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::reflect_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::reflect_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::reflect_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::reflect_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::refract_Float1_Float1_Float1;
+constexpr const TSymbolUniqueId BuiltInId::refract_Float2_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::refract_Float3_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::refract_Float4_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float2x2_Float2x2;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float3x3_Float3x3;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float4x4_Float4x4;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float2x3_Float2x3;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float3x2_Float3x2;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float2x4_Float2x4;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float4x2_Float4x2;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float3x4_Float3x4;
+constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float4x3_Float4x3;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float3_Float2;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float2_Float3;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float4_Float2;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float2_Float4;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float4_Float3;
+constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float3_Float4;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float2x2;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float3x3;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float4x4;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float3x2;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float2x3;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float4x2;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float2x4;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float4x3;
+constexpr const TSymbolUniqueId BuiltInId::transpose_Float3x4;
+constexpr const TSymbolUniqueId BuiltInId::determinant_Float2x2;
+constexpr const TSymbolUniqueId BuiltInId::determinant_Float3x3;
+constexpr const TSymbolUniqueId BuiltInId::determinant_Float4x4;
+constexpr const TSymbolUniqueId BuiltInId::inverse_Float2x2;
+constexpr const TSymbolUniqueId BuiltInId::inverse_Float3x3;
+constexpr const TSymbolUniqueId BuiltInId::inverse_Float4x4;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::lessThan_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::greaterThan_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::equal_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::equal_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::equal_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::equal_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::equal_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::equal_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::equal_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::equal_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::equal_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::equal_Bool2_Bool2;
+constexpr const TSymbolUniqueId BuiltInId::equal_Bool3_Bool3;
+constexpr const TSymbolUniqueId BuiltInId::equal_Bool4_Bool4;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Float4_Float4;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Bool2_Bool2;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Bool3_Bool3;
+constexpr const TSymbolUniqueId BuiltInId::notEqual_Bool4_Bool4;
+constexpr const TSymbolUniqueId BuiltInId::any_Bool2;
+constexpr const TSymbolUniqueId BuiltInId::any_Bool3;
+constexpr const TSymbolUniqueId BuiltInId::any_Bool4;
+constexpr const TSymbolUniqueId BuiltInId::all_Bool2;
+constexpr const TSymbolUniqueId BuiltInId::all_Bool3;
+constexpr const TSymbolUniqueId BuiltInId::all_Bool4;
+constexpr const TSymbolUniqueId BuiltInId::notFunc_Bool2;
+constexpr const TSymbolUniqueId BuiltInId::notFunc_Bool3;
+constexpr const TSymbolUniqueId BuiltInId::notFunc_Bool4;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int1_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int2_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int3_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int4_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt1_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt2_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt3_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt4_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int1_Int1_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int2_Int2_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int3_Int3_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int4_Int4_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt1_UInt1_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt2_UInt2_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt3_UInt3_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt4_UInt4_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int2;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int3;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int4;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_Int1;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_Int2;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_Int3;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_Int4;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_Int1;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_Int2;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_Int3;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_Int4;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_Int1;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_Int2;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_Int3;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_Int4;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt1_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt2_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt3_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt4_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt1_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt2_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt3_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt4_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt2_UInt2_UInt2_UInt2;
+constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt3_UInt3_UInt3_UInt3;
+constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt4_UInt4_UInt4_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int1_Int1_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int2_Int2_Int2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int3_Int3_Int3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int4_Int4_Int4_Int4;
+constexpr const TSymbolUniqueId BuiltInId::texture2D_Sampler2D1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureCube_SamplerCube1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture2D_SamplerExternalOES1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProj_SamplerExternalOES1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProj_SamplerExternalOES1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::texture2DRect_Sampler2DRect1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture2DRectProj_Sampler2DRect1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture2DRectProj_Sampler2DRect1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DRect1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DRect1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DRect1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::texture2DGradEXT_Sampler2D1_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProjGradEXT_Sampler2D1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProjGradEXT_Sampler2D1_Float4_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureCubeGradEXT_SamplerCube1_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture2D_Sampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureCube_SamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float1;
+constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float2;
+constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float3;
+constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float4;
+constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float1;
+constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float2;
+constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float3;
+constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float4;
+constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float1;
+constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float2;
+constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float3;
+constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float4;
+constexpr const TSymbolUniqueId BuiltInId::texture2DLodEXT_Sampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProjLodEXT_Sampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProjLodEXT_Sampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureCubeLodEXT_SamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture3D_Sampler3D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture3D_Sampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture3DProj_Sampler3D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::texture3DProj_Sampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture3DLod_Sampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture3DProjLod_Sampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture2DLod_Sampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProjLod_Sampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture2DProjLod_Sampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureCubeLod_SamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2D1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2D1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture_USampler2D1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler3D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISampler3D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_USampler3D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCube1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISamplerCube1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_USamplerCube1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DArray1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2DArray1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_USampler2DArray1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler3D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler3D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler3D1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_ISampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_USampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_ISampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_USampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_SamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_ISamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_USamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler2DArray1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_ISampler2DArray1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_USampler2DArray1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DShadow1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCubeShadow1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DArrayShadow1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DShadow1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler2DShadow1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2D1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler2D1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler2D1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler3D1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler3D1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler3D1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerCube1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_ISamplerCube1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_USamplerCube1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DArray1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler2DArray1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler2DArray1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DShadow1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerCubeShadow1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DArrayShadow1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_ISampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_USampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_ISampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_USampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_ISampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_USampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler2DShadow1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler2D1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler2D1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler2D1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler3D1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler3D1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler3D1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler2DArray1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler2DArray1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler2DArray1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2D1_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISampler2D1_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_USampler2D1_Float2_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler3D1_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISampler3D1_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_USampler3D1_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_SamplerCube1_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISamplerCube1_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_USamplerCube1_Float3_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2DShadow1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_SamplerCubeShadow1_Float4_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2DArray1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISampler2DArray1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_USampler2DArray1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2DArrayShadow1_Float4_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler2D1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_ISampler2D1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_USampler2D1_Float3_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler2D1_Float4_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_ISampler2D1_Float4_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_USampler2D1_Float4_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler3D1_Float4_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_ISampler3D1_Float4_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_USampler3D1_Float4_Float3_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler2DShadow1_Float4_Float2_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DMS1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler2DMS1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler2DMS1;
+constexpr const TSymbolUniqueId BuiltInId::textureSizeExt_Sampler2DMS1;
+constexpr const TSymbolUniqueId BuiltInId::textureSizeExt_ISampler2DMS1;
+constexpr const TSymbolUniqueId BuiltInId::textureSizeExt_USampler2DMS1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DMSArray1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler2DMSArray1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler2DMSArray1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2D1_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2D1_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2D1_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler3D1_Float3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler3D1_Float3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler3D1_Float3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2DArray1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float4_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler3D1_Float4_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler2D1_Float2_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_ISampler2D1_Float2_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_USampler2D1_Float2_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler3D1_Float3_Float1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_ISampler3D1_Float3_Float1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_USampler3D1_Float3_Float1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler2DShadow1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler2DArray1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_ISampler2DArray1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_USampler2DArray1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler2D1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_ISampler2D1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_USampler2D1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler2D1_Float4_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_ISampler2D1_Float4_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_USampler2D1_Float4_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler3D1_Float4_Float1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_ISampler3D1_Float4_Float1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_USampler3D1_Float4_Float1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler2DShadow1_Float4_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_Sampler2D1_Int2_Int1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_ISampler2D1_Int2_Int1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_USampler2D1_Int2_Int1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_Sampler3D1_Int3_Int1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_ISampler3D1_Int3_Int1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_USampler3D1_Int3_Int1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_Sampler2DArray1_Int3_Int1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_ISampler2DArray1_Int3_Int1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_USampler2DArray1_Int3_Int1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_Sampler2D1_Float2_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_ISampler2D1_Float2_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_USampler2D1_Float2_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_Sampler3D1_Float3_Float3_Float3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_ISampler3D1_Float3_Float3_Float3_Int3;
+constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_USampler3D1_Float3_Float3_Float3_Int3;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureGradOffset_Sampler2DShadow1_Float3_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureGradOffset_Sampler2DArray1_Float3_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureGradOffset_ISampler2DArray1_Float3_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureGradOffset_USampler2DArray1_Float3_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureGradOffset_Sampler2DArrayShadow1_Float4_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_Sampler2D1_Float3_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_ISampler2D1_Float3_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_USampler2D1_Float3_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_Sampler2D1_Float4_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_ISampler2D1_Float4_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_USampler2D1_Float4_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_Sampler3D1_Float4_Float3_Float3_Int3;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_ISampler3D1_Float4_Float3_Float3_Int3;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_USampler3D1_Float4_Float3_Float3_Int3;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureProjGradOffset_Sampler2DShadow1_Float4_Float2_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2D1_Float2_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2D1_Float2_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2D1_Float2_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler3D1_Float3_Int3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler3D1_Float3_Int3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler3D1_Float3_Int3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2DArray1_Float3_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float3_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float4_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler3D1_Float4_Int3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternalOES1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerExternalOES1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_SamplerExternalOES1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4;
+constexpr const TSymbolUniqueId BuiltInId::rgb_2_yuv_Float3_YuvCscStandardEXT1;
+constexpr const TSymbolUniqueId BuiltInId::yuv_2_rgb_Float3_YuvCscStandardEXT1;
+constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerExternal2DY2YEXT1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_SamplerExternal2DY2YEXT1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_USampler2D1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_USampler3D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_USamplerCube1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DArray1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2DArray1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_USampler2DArray1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler3D1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DShadow1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCubeShadow1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DShadow1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternalOES1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4_Float1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler2DMS1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler2DMS1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler2DMS1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchExt_Sampler2DMS1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchExt_ISampler2DMS1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetchExt_USampler2DMS1_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler2DMSArray1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler2DMSArray1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler2DMSArray1_Int3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2D1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2D1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2D1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2D1_Float2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2D1_Float2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2D1_Float2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArray1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2DArray1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2DArray1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArray1_Float3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2DArray1_Float3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2DArray1_Float3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCube1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_ISamplerCube1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_USamplerCube1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCube1_Float3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_ISamplerCube1_Float3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_USamplerCube1_Float3_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DShadow1_Float2;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DShadow1_Float2_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArrayShadow1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArrayShadow1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCubeShadow1_Float3;
+constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCubeShadow1_Float3_Float1;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2_Int1;
+constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2DShadow1_Float2_Float1_Int2;
+constexpr const TSymbolUniqueId
+ BuiltInId::textureGatherOffset_Sampler2DArrayShadow1_Float3_Float1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::dFdx_Float1;
+constexpr const TSymbolUniqueId BuiltInId::dFdx_Float2;
+constexpr const TSymbolUniqueId BuiltInId::dFdx_Float3;
+constexpr const TSymbolUniqueId BuiltInId::dFdx_Float4;
+constexpr const TSymbolUniqueId BuiltInId::dFdy_Float1;
+constexpr const TSymbolUniqueId BuiltInId::dFdy_Float2;
+constexpr const TSymbolUniqueId BuiltInId::dFdy_Float3;
+constexpr const TSymbolUniqueId BuiltInId::dFdy_Float4;
+constexpr const TSymbolUniqueId BuiltInId::fwidth_Float1;
+constexpr const TSymbolUniqueId BuiltInId::fwidth_Float2;
+constexpr const TSymbolUniqueId BuiltInId::fwidth_Float3;
+constexpr const TSymbolUniqueId BuiltInId::fwidth_Float4;
+constexpr const TSymbolUniqueId BuiltInId::atomicCounter_AtomicCounter1;
+constexpr const TSymbolUniqueId BuiltInId::atomicCounterIncrement_AtomicCounter1;
+constexpr const TSymbolUniqueId BuiltInId::atomicCounterDecrement_AtomicCounter1;
+constexpr const TSymbolUniqueId BuiltInId::atomicAdd_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicAdd_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::atomicMin_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicMin_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::atomicMax_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicMax_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::atomicAnd_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicAnd_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::atomicOr_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicOr_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::atomicXor_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicXor_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::atomicExchange_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicExchange_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::atomicCompSwap_UInt1_UInt1_UInt1;
+constexpr const TSymbolUniqueId BuiltInId::atomicCompSwap_Int1_Int1_Int1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_Image2D1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_IImage2D1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_UImage2D1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_Image3D1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_IImage3D1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_UImage3D1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_Image2DArray1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_IImage2DArray1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_UImage2DArray1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_ImageCube1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_IImageCube1;
+constexpr const TSymbolUniqueId BuiltInId::imageSize_UImageCube1;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_Image2D1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImage2D1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImage2D1_Int2;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_Image3D1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImage3D1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImage3D1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_Image2DArray1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImage2DArray1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImage2DArray1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_ImageCube1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImageCube1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImageCube1_Int3;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_Image2D1_Int2_Float4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_IImage2D1_Int2_Int4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_UImage2D1_Int2_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_Image3D1_Int3_Float4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_IImage3D1_Int3_Int4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_UImage3D1_Int3_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_Image2DArray1_Int3_Float4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_IImage2DArray1_Int3_Int4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_UImage2DArray1_Int3_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_ImageCube1_Int3_Float4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_IImageCube1_Int3_Int4;
+constexpr const TSymbolUniqueId BuiltInId::imageStore_UImageCube1_Int3_UInt4;
+constexpr const TSymbolUniqueId BuiltInId::memoryBarrier;
+constexpr const TSymbolUniqueId BuiltInId::memoryBarrierAtomicCounter;
+constexpr const TSymbolUniqueId BuiltInId::memoryBarrierBuffer;
+constexpr const TSymbolUniqueId BuiltInId::memoryBarrierImage;
+constexpr const TSymbolUniqueId BuiltInId::barrier;
+constexpr const TSymbolUniqueId BuiltInId::memoryBarrierShared;
+constexpr const TSymbolUniqueId BuiltInId::groupMemoryBarrier;
+constexpr const TSymbolUniqueId BuiltInId::EmitVertex;
+constexpr const TSymbolUniqueId BuiltInId::EndPrimitive;
+constexpr const TSymbolUniqueId BuiltInId::gl_DepthRangeParameters;
+constexpr const TSymbolUniqueId BuiltInId::gl_DepthRange;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexAttribs;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexUniformVectors;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexTextureImageUnits;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedTextureImageUnits;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxTextureImageUnits;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentUniformVectors;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVaryingVectors;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxDrawBuffers;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxDualSourceDrawBuffersEXT;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexOutputVectors;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentInputVectors;
+constexpr const TSymbolUniqueId BuiltInId::gl_MinProgramTexelOffset;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxProgramTexelOffset;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxImageUnits;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexImageUniforms;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentImageUniforms;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeImageUniforms;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedImageUniforms;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedShaderOutputResources;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeWorkGroupCount;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeWorkGroupSize;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeUniformComponents;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeTextureImageUnits;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeAtomicCounters;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeAtomicCounterBuffers;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexAtomicCounters;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentAtomicCounters;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedAtomicCounters;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxAtomicCounterBindings;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexAtomicCounterBuffers;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentAtomicCounterBuffers;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedAtomicCounterBuffers;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxAtomicCounterBufferSize;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryInputComponents;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryOutputComponents;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryImageUniforms;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryTextureImageUnits;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryOutputVertices;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryTotalOutputComponents;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryUniformComponents;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryAtomicCounters;
+constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryAtomicCounterBuffers;
+constexpr const TSymbolUniqueId BuiltInId::gl_FragCoord;
+constexpr const TSymbolUniqueId BuiltInId::gl_FrontFacing;
+constexpr const TSymbolUniqueId BuiltInId::gl_PointCoord;
+constexpr const TSymbolUniqueId BuiltInId::gl_FragColor;
+constexpr const TSymbolUniqueId BuiltInId::gl_FragData;
+constexpr const TSymbolUniqueId BuiltInId::gl_FragDepth;
+constexpr const TSymbolUniqueId BuiltInId::gl_SecondaryFragColorEXT;
+constexpr const TSymbolUniqueId BuiltInId::gl_SecondaryFragDataEXT;
+constexpr const TSymbolUniqueId BuiltInId::gl_FragDepthEXT;
+constexpr const TSymbolUniqueId BuiltInId::gl_LastFragData;
+constexpr const TSymbolUniqueId BuiltInId::gl_LastFragColor;
+constexpr const TSymbolUniqueId BuiltInId::gl_LastFragDataNV;
+constexpr const TSymbolUniqueId BuiltInId::gl_LastFragColorARM;
+constexpr const TSymbolUniqueId BuiltInId::gl_PrimitiveID;
+constexpr const TSymbolUniqueId BuiltInId::gl_Layer;
+constexpr const TSymbolUniqueId BuiltInId::gl_Position;
+constexpr const TSymbolUniqueId BuiltInId::gl_PointSize;
+constexpr const TSymbolUniqueId BuiltInId::gl_InstanceID;
+constexpr const TSymbolUniqueId BuiltInId::gl_VertexID;
+constexpr const TSymbolUniqueId BuiltInId::gl_ViewportIndex;
+constexpr const TSymbolUniqueId BuiltInId::gl_LayerVS;
+constexpr const TSymbolUniqueId BuiltInId::gl_DrawID;
+constexpr const TSymbolUniqueId BuiltInId::gl_DrawIDESSL1;
+constexpr const TSymbolUniqueId BuiltInId::gl_BaseVertex;
+constexpr const TSymbolUniqueId BuiltInId::gl_BaseInstance;
+constexpr const TSymbolUniqueId BuiltInId::gl_NumWorkGroups;
+constexpr const TSymbolUniqueId BuiltInId::gl_WorkGroupSize;
+constexpr const TSymbolUniqueId BuiltInId::gl_WorkGroupID;
+constexpr const TSymbolUniqueId BuiltInId::gl_LocalInvocationID;
+constexpr const TSymbolUniqueId BuiltInId::gl_GlobalInvocationID;
+constexpr const TSymbolUniqueId BuiltInId::gl_LocalInvocationIndex;
+constexpr const TSymbolUniqueId BuiltInId::gl_PrimitiveIDIn;
+constexpr const TSymbolUniqueId BuiltInId::gl_InvocationID;
+constexpr const TSymbolUniqueId BuiltInId::gl_PrimitiveIDGS;
+constexpr const TSymbolUniqueId BuiltInId::gl_LayerGS;
+constexpr const TSymbolUniqueId BuiltInId::gl_PerVertex;
+constexpr const TSymbolUniqueId BuiltInId::gl_in;
+constexpr const TSymbolUniqueId BuiltInId::gl_PerVertexOutBlock;
+constexpr const TSymbolUniqueId BuiltInId::gl_PositionGS;
+constexpr const TSymbolUniqueId BuiltInId::gl_ViewID_OVR;
+constexpr const TSymbolUniqueId BuiltInId::gl_ViewID_OVRESSL1;
+
+const int TSymbolTable::kLastBuiltInId = 1033;
+
+namespace BuiltInName
+{
+
+constexpr const ImmutableString _empty("");
+constexpr const ImmutableString EmitVertex("EmitVertex");
+constexpr const ImmutableString EndPrimitive("EndPrimitive");
+constexpr const ImmutableString abs("abs");
+constexpr const ImmutableString acos("acos");
+constexpr const ImmutableString acosh("acosh");
+constexpr const ImmutableString all("all");
+constexpr const ImmutableString any("any");
+constexpr const ImmutableString asin("asin");
+constexpr const ImmutableString asinh("asinh");
+constexpr const ImmutableString atan("atan");
+constexpr const ImmutableString atanh("atanh");
+constexpr const ImmutableString atomicAdd("atomicAdd");
+constexpr const ImmutableString atomicAnd("atomicAnd");
+constexpr const ImmutableString atomicCompSwap("atomicCompSwap");
+constexpr const ImmutableString atomicCompSwap_0D0D0D("atomicCompSwap(0D0D0D");
+constexpr const ImmutableString atomicCounter("atomicCounter");
+constexpr const ImmutableString atomicCounterDecrement("atomicCounterDecrement");
+constexpr const ImmutableString atomicCounterIncrement("atomicCounterIncrement");
+constexpr const ImmutableString atomicExchange("atomicExchange");
+constexpr const ImmutableString atomicMax("atomicMax");
+constexpr const ImmutableString atomicMin("atomicMin");
+constexpr const ImmutableString atomicOr("atomicOr");
+constexpr const ImmutableString atomicXor("atomicXor");
+constexpr const ImmutableString barrier("barrier");
+constexpr const ImmutableString bitCount("bitCount");
+constexpr const ImmutableString bitfieldExtract("bitfieldExtract");
+constexpr const ImmutableString bitfieldExtract_0D0C0C("bitfieldExtract(0D0C0C");
+constexpr const ImmutableString bitfieldExtract_1C0C0C("bitfieldExtract(1C0C0C");
+constexpr const ImmutableString bitfieldExtract_3C0C0C("bitfieldExtract(3C0C0C");
+constexpr const ImmutableString bitfieldInsert("bitfieldInsert");
+constexpr const ImmutableString bitfieldInsert_0C0C0C0C("bitfieldInsert(0C0C0C0C");
+constexpr const ImmutableString bitfieldInsert_0D0D0C0C("bitfieldInsert(0D0D0C0C");
+constexpr const ImmutableString bitfieldInsert_1C1C0C0C("bitfieldInsert(1C1C0C0C");
+constexpr const ImmutableString bitfieldInsert_1D1D0C0C("bitfieldInsert(1D1D0C0C");
+constexpr const ImmutableString bitfieldInsert_2C2C0C0C("bitfieldInsert(2C2C0C0C");
+constexpr const ImmutableString bitfieldInsert_2D2D0C0C("bitfieldInsert(2D2D0C0C");
+constexpr const ImmutableString bitfieldInsert_3C3C0C0C("bitfieldInsert(3C3C0C0C");
+constexpr const ImmutableString bitfieldInsert_3D3D0C0C("bitfieldInsert(3D3D0C0C");
+constexpr const ImmutableString bitfieldReverse("bitfieldReverse");
+constexpr const ImmutableString ceil("ceil");
+constexpr const ImmutableString clamp("clamp");
+constexpr const ImmutableString clamp_0D0D0D("clamp(0D0D0D");
+constexpr const ImmutableString clamp_1B0B0B("clamp(1B0B0B");
+constexpr const ImmutableString clamp_1B1B1B("clamp(1B1B1B");
+constexpr const ImmutableString clamp_1C0C0C("clamp(1C0C0C");
+constexpr const ImmutableString clamp_1C1C1C("clamp(1C1C1C");
+constexpr const ImmutableString clamp_1D1D1D("clamp(1D1D1D");
+constexpr const ImmutableString clamp_2C2C2C("clamp(2C2C2C");
+constexpr const ImmutableString clamp_3B0B0B("clamp(3B0B0B");
+constexpr const ImmutableString clamp_3C0C0C("clamp(3C0C0C");
+constexpr const ImmutableString clamp_3D0D0D("clamp(3D0D0D");
+constexpr const ImmutableString cos("cos");
+constexpr const ImmutableString cosh("cosh");
+constexpr const ImmutableString cross("cross");
+constexpr const ImmutableString dFdx("dFdx");
+constexpr const ImmutableString dFdxExt("dFdx");
+constexpr const ImmutableString dFdy("dFdy");
+constexpr const ImmutableString dFdyExt("dFdy");
+constexpr const ImmutableString degrees("degrees");
+constexpr const ImmutableString determinant("determinant");
+constexpr const ImmutableString diff("diff");
+constexpr const ImmutableString distance("distance");
+constexpr const ImmutableString dot("dot");
+constexpr const ImmutableString equal("equal");
+constexpr const ImmutableString exp("exp");
+constexpr const ImmutableString exp2("exp2");
+constexpr const ImmutableString faceforward("faceforward");
+constexpr const ImmutableString faceforward_1B1B1B("faceforward(1B1B1B");
+constexpr const ImmutableString faceforward_2B2B2B("faceforward(2B2B2B");
+constexpr const ImmutableString faceforward_3B3B3B("faceforward(3B3B3B");
+constexpr const ImmutableString far("far");
+constexpr const ImmutableString findLSB("findLSB");
+constexpr const ImmutableString findMSB("findMSB");
+constexpr const ImmutableString floatBitsToInt("floatBitsToInt");
+constexpr const ImmutableString floatBitsToUint("floatBitsToUint");
+constexpr const ImmutableString floor("floor");
+constexpr const ImmutableString fract("fract");
+constexpr const ImmutableString frexp("frexp");
+constexpr const ImmutableString frexp_3B3C("frexp(3B3C");
+constexpr const ImmutableString fwidth("fwidth");
+constexpr const ImmutableString fwidthExt("fwidth");
+constexpr const ImmutableString gl_BaseInstance("gl_BaseInstance");
+constexpr const ImmutableString gl_BaseVertex("gl_BaseVertex");
+constexpr const ImmutableString gl_DepthRange("gl_DepthRange");
+constexpr const ImmutableString gl_DepthRangeParameters("gl_DepthRangeParameters");
+constexpr const ImmutableString gl_DrawID("gl_DrawID");
+constexpr const ImmutableString gl_FragColor("gl_FragColor");
+constexpr const ImmutableString gl_FragCoord("gl_FragCoord");
+constexpr const ImmutableString gl_FragData("gl_FragData");
+constexpr const ImmutableString gl_FragDepth("gl_FragDepth");
+constexpr const ImmutableString gl_FragDepthEXT("gl_FragDepthEXT");
+constexpr const ImmutableString gl_FrontFacing("gl_FrontFacing");
+constexpr const ImmutableString gl_GlobalInvocationID("gl_GlobalInvocationID");
+constexpr const ImmutableString gl_InstanceID("gl_InstanceID");
+constexpr const ImmutableString gl_InvocationID("gl_InvocationID");
+constexpr const ImmutableString gl_LastFragColor("gl_LastFragColor");
+constexpr const ImmutableString gl_LastFragColorARM("gl_LastFragColorARM");
+constexpr const ImmutableString gl_LastFragData("gl_LastFragData");
+constexpr const ImmutableString gl_Layer("gl_Layer");
+constexpr const ImmutableString gl_LocalInvocationID("gl_LocalInvocationID");
+constexpr const ImmutableString gl_LocalInvocationIndex("gl_LocalInvocationIndex");
+constexpr const ImmutableString gl_MaxAtomicCounterBindings("gl_MaxAtomicCounterBindings");
+constexpr const ImmutableString gl_MaxAtomicCounterBufferSize("gl_MaxAtomicCounterBufferSize");
+constexpr const ImmutableString gl_MaxCombinedAtomicCounterBuffers(
+ "gl_MaxCombinedAtomicCounterBuffers");
+constexpr const ImmutableString gl_MaxCombinedAtomicCounters("gl_MaxCombinedAtomicCounters");
+constexpr const ImmutableString gl_MaxCombinedImageUniforms("gl_MaxCombinedImageUniforms");
+constexpr const ImmutableString gl_MaxCombinedShaderOutputResources(
+ "gl_MaxCombinedShaderOutputResources");
+constexpr const ImmutableString gl_MaxCombinedTextureImageUnits("gl_MaxCombinedTextureImageUnits");
+constexpr const ImmutableString gl_MaxComputeAtomicCounterBuffers(
+ "gl_MaxComputeAtomicCounterBuffers");
+constexpr const ImmutableString gl_MaxComputeAtomicCounters("gl_MaxComputeAtomicCounters");
+constexpr const ImmutableString gl_MaxComputeImageUniforms("gl_MaxComputeImageUniforms");
+constexpr const ImmutableString gl_MaxComputeTextureImageUnits("gl_MaxComputeTextureImageUnits");
+constexpr const ImmutableString gl_MaxComputeUniformComponents("gl_MaxComputeUniformComponents");
+constexpr const ImmutableString gl_MaxComputeWorkGroupCount("gl_MaxComputeWorkGroupCount");
+constexpr const ImmutableString gl_MaxComputeWorkGroupSize("gl_MaxComputeWorkGroupSize");
+constexpr const ImmutableString gl_MaxDrawBuffers("gl_MaxDrawBuffers");
+constexpr const ImmutableString gl_MaxDualSourceDrawBuffersEXT("gl_MaxDualSourceDrawBuffersEXT");
+constexpr const ImmutableString gl_MaxFragmentAtomicCounterBuffers(
+ "gl_MaxFragmentAtomicCounterBuffers");
+constexpr const ImmutableString gl_MaxFragmentAtomicCounters("gl_MaxFragmentAtomicCounters");
+constexpr const ImmutableString gl_MaxFragmentImageUniforms("gl_MaxFragmentImageUniforms");
+constexpr const ImmutableString gl_MaxFragmentInputVectors("gl_MaxFragmentInputVectors");
+constexpr const ImmutableString gl_MaxFragmentUniformVectors("gl_MaxFragmentUniformVectors");
+constexpr const ImmutableString gl_MaxGeometryAtomicCounterBuffers(
+ "gl_MaxGeometryAtomicCounterBuffers");
+constexpr const ImmutableString gl_MaxGeometryAtomicCounters("gl_MaxGeometryAtomicCounters");
+constexpr const ImmutableString gl_MaxGeometryImageUniforms("gl_MaxGeometryImageUniforms");
+constexpr const ImmutableString gl_MaxGeometryInputComponents("gl_MaxGeometryInputComponents");
+constexpr const ImmutableString gl_MaxGeometryOutputComponents("gl_MaxGeometryOutputComponents");
+constexpr const ImmutableString gl_MaxGeometryOutputVertices("gl_MaxGeometryOutputVertices");
+constexpr const ImmutableString gl_MaxGeometryTextureImageUnits("gl_MaxGeometryTextureImageUnits");
+constexpr const ImmutableString gl_MaxGeometryTotalOutputComponents(
+ "gl_MaxGeometryTotalOutputComponents");
+constexpr const ImmutableString gl_MaxGeometryUniformComponents("gl_MaxGeometryUniformComponents");
+constexpr const ImmutableString gl_MaxImageUnits("gl_MaxImageUnits");
+constexpr const ImmutableString gl_MaxProgramTexelOffset("gl_MaxProgramTexelOffset");
+constexpr const ImmutableString gl_MaxTextureImageUnits("gl_MaxTextureImageUnits");
+constexpr const ImmutableString gl_MaxVaryingVectors("gl_MaxVaryingVectors");
+constexpr const ImmutableString gl_MaxVertexAtomicCounterBuffers(
+ "gl_MaxVertexAtomicCounterBuffers");
+constexpr const ImmutableString gl_MaxVertexAtomicCounters("gl_MaxVertexAtomicCounters");
+constexpr const ImmutableString gl_MaxVertexAttribs("gl_MaxVertexAttribs");
+constexpr const ImmutableString gl_MaxVertexImageUniforms("gl_MaxVertexImageUniforms");
+constexpr const ImmutableString gl_MaxVertexOutputVectors("gl_MaxVertexOutputVectors");
+constexpr const ImmutableString gl_MaxVertexTextureImageUnits("gl_MaxVertexTextureImageUnits");
+constexpr const ImmutableString gl_MaxVertexUniformVectors("gl_MaxVertexUniformVectors");
+constexpr const ImmutableString gl_MinProgramTexelOffset("gl_MinProgramTexelOffset");
+constexpr const ImmutableString gl_NumWorkGroups("gl_NumWorkGroups");
+constexpr const ImmutableString gl_PerVertex("gl_PerVertex");
+constexpr const ImmutableString gl_PointCoord("gl_PointCoord");
+constexpr const ImmutableString gl_PointSize("gl_PointSize");
+constexpr const ImmutableString gl_Position("gl_Position");
+constexpr const ImmutableString gl_PrimitiveID("gl_PrimitiveID");
+constexpr const ImmutableString gl_PrimitiveIDIn("gl_PrimitiveIDIn");
+constexpr const ImmutableString gl_SecondaryFragColorEXT("gl_SecondaryFragColorEXT");
+constexpr const ImmutableString gl_SecondaryFragDataEXT("gl_SecondaryFragDataEXT");
+constexpr const ImmutableString gl_VertexID("gl_VertexID");
+constexpr const ImmutableString gl_ViewID_OVR("gl_ViewID_OVR");
+constexpr const ImmutableString gl_ViewportIndex("gl_ViewportIndex");
+constexpr const ImmutableString gl_WorkGroupID("gl_WorkGroupID");
+constexpr const ImmutableString gl_WorkGroupSize("gl_WorkGroupSize");
+constexpr const ImmutableString gl_in("gl_in");
+constexpr const ImmutableString greaterThan("greaterThan");
+constexpr const ImmutableString greaterThanEqual("greaterThanEqual");
+constexpr const ImmutableString groupMemoryBarrier("groupMemoryBarrier");
+constexpr const ImmutableString imageLoad("imageLoad");
+constexpr const ImmutableString imageSize("imageSize");
+constexpr const ImmutableString imageStore("imageStore");
+constexpr const ImmutableString imageStore_0h1C3D("imageStore(0h1C3D");
+constexpr const ImmutableString imageStore_0j2C3C("imageStore(0j2C3C");
+constexpr const ImmutableString imageStore_0l2C3B("imageStore(0l2C3B");
+constexpr const ImmutableString imageStore_0n2C3D("imageStore(0n2C3D");
+constexpr const ImmutableString imageStore_0p2C3C("imageStore(0p2C3C");
+constexpr const ImmutableString imulExtended("imulExtended");
+constexpr const ImmutableString imulExtended_0C0C0C0C("imulExtended(0C0C0C0C");
+constexpr const ImmutableString imulExtended_1C1C1C1C("imulExtended(1C1C1C1C");
+constexpr const ImmutableString imulExtended_2C2C2C2C("imulExtended(2C2C2C2C");
+constexpr const ImmutableString imulExtended_3C3C3C3C("imulExtended(3C3C3C3C");
+constexpr const ImmutableString intBitsToFloat("intBitsToFloat");
+constexpr const ImmutableString inverse("inverse");
+constexpr const ImmutableString inversesqrt("inversesqrt");
+constexpr const ImmutableString isinf("isinf");
+constexpr const ImmutableString isnan("isnan");
+constexpr const ImmutableString ldexp("ldexp");
+constexpr const ImmutableString length("length");
+constexpr const ImmutableString lessThan("lessThan");
+constexpr const ImmutableString lessThanEqual("lessThanEqual");
+constexpr const ImmutableString log("log");
+constexpr const ImmutableString log2("log2");
+constexpr const ImmutableString matrixCompMult("matrixCompMult");
+constexpr const ImmutableString max("max");
+constexpr const ImmutableString memoryBarrier("memoryBarrier");
+constexpr const ImmutableString memoryBarrierAtomicCounter("memoryBarrierAtomicCounter");
+constexpr const ImmutableString memoryBarrierBuffer("memoryBarrierBuffer");
+constexpr const ImmutableString memoryBarrierImage("memoryBarrierImage");
+constexpr const ImmutableString memoryBarrierShared("memoryBarrierShared");
+constexpr const ImmutableString min("min");
+constexpr const ImmutableString mix("mix");
+constexpr const ImmutableString mix_0B0B0E("mix(0B0B0E");
+constexpr const ImmutableString mix_1B1B1B("mix(1B1B1B");
+constexpr const ImmutableString mix_1B1B1E("mix(1B1B1E");
+constexpr const ImmutableString mix_3B3B0B("mix(3B3B0B");
+constexpr const ImmutableString mix_3B3B3B("mix(3B3B3B");
+constexpr const ImmutableString mod("mod");
+constexpr const ImmutableString modf("modf");
+constexpr const ImmutableString near("near");
+constexpr const ImmutableString normalize("normalize");
+constexpr const ImmutableString notEqual("notEqual");
+constexpr const ImmutableString notFunc("not");
+constexpr const ImmutableString outerProduct("outerProduct");
+constexpr const ImmutableString packHalf2x16("packHalf2x16");
+constexpr const ImmutableString packSnorm2x16("packSnorm2x16");
+constexpr const ImmutableString packSnorm4x8("packSnorm4x8");
+constexpr const ImmutableString packUnorm2x16("packUnorm2x16");
+constexpr const ImmutableString packUnorm4x8("packUnorm4x8");
+constexpr const ImmutableString pow("pow");
+constexpr const ImmutableString radians("radians");
+constexpr const ImmutableString reflect("reflect");
+constexpr const ImmutableString refract("refract");
+constexpr const ImmutableString refract_3B3B0B("refract(3B3B0B");
+constexpr const ImmutableString rgb_2_yuv("rgb_2_yuv");
+constexpr const ImmutableString round("round");
+constexpr const ImmutableString roundEven("roundEven");
+constexpr const ImmutableString sign("sign");
+constexpr const ImmutableString sin("sin");
+constexpr const ImmutableString sinh("sinh");
+constexpr const ImmutableString smoothstep("smoothstep");
+constexpr const ImmutableString smoothstep_0B0B3B("smoothstep(0B0B3B");
+constexpr const ImmutableString smoothstep_1B1B1B("smoothstep(1B1B1B");
+constexpr const ImmutableString smoothstep_3B3B3B("smoothstep(3B3B3B");
+constexpr const ImmutableString sqrt("sqrt");
+constexpr const ImmutableString step("step");
+constexpr const ImmutableString tan("tan");
+constexpr const ImmutableString tanh("tanh");
+constexpr const ImmutableString texelFetch("texelFetch");
+constexpr const ImmutableString texelFetchExt("texelFetch");
+constexpr const ImmutableString texelFetchExt_0O1C0C("texelFetch(0O1C0C");
+constexpr const ImmutableString texelFetchOffset("texelFetchOffset");
+constexpr const ImmutableString texelFetchOffset_0H1C0C1C("texelFetchOffset(0H1C0C1C");
+constexpr const ImmutableString texelFetchOffset_0I2C0C2C("texelFetchOffset(0I2C0C2C");
+constexpr const ImmutableString texelFetchOffset_0K2C0C1C("texelFetchOffset(0K2C0C1C");
+constexpr const ImmutableString texelFetchOffset_0Q1C0C1C("texelFetchOffset(0Q1C0C1C");
+constexpr const ImmutableString texelFetchOffset_0R2C0C2C("texelFetchOffset(0R2C0C2C");
+constexpr const ImmutableString texelFetchOffset_0T2C0C1C("texelFetchOffset(0T2C0C1C");
+constexpr const ImmutableString texelFetchOffset_0W1C0C1C("texelFetchOffset(0W1C0C1C");
+constexpr const ImmutableString texelFetchOffset_0X2C0C2C("texelFetchOffset(0X2C0C2C");
+constexpr const ImmutableString texelFetchOffset_0Z2C0C1C("texelFetchOffset(0Z2C0C1C");
+constexpr const ImmutableString texelFetch_0H1C0C("texelFetch(0H1C0C");
+constexpr const ImmutableString texelFetch_0I2C0C("texelFetch(0I2C0C");
+constexpr const ImmutableString texelFetch_0K2C0C("texelFetch(0K2C0C");
+constexpr const ImmutableString texelFetch_0L1C0C("texelFetch(0L1C0C");
+constexpr const ImmutableString texelFetch_0O1C0C("texelFetch(0O1C0C");
+constexpr const ImmutableString texelFetch_0P2C0C("texelFetch(0P2C0C");
+constexpr const ImmutableString texelFetch_0Q1C0C("texelFetch(0Q1C0C");
+constexpr const ImmutableString texelFetch_0T2C0C("texelFetch(0T2C0C");
+constexpr const ImmutableString texelFetch_0V2C0C("texelFetch(0V2C0C");
+constexpr const ImmutableString texelFetch_0X2C0C("texelFetch(0X2C0C");
+constexpr const ImmutableString texelFetch_0Z2C0C("texelFetch(0Z2C0C");
+constexpr const ImmutableString texture("texture");
+constexpr const ImmutableString texture2D("texture2D");
+constexpr const ImmutableString texture2DGradEXT("texture2DGradEXT");
+constexpr const ImmutableString texture2DGradEXT_0H1B1B1B("texture2DGradEXT(0H1B1B1B");
+constexpr const ImmutableString texture2DLod("texture2DLod");
+constexpr const ImmutableString texture2DLodEXT("texture2DLodEXT");
+constexpr const ImmutableString texture2DLodEXT_0H1B0B("texture2DLodEXT(0H1B0B");
+constexpr const ImmutableString texture2DLod_0H1B0B("texture2DLod(0H1B0B");
+constexpr const ImmutableString texture2DProj("texture2DProj");
+constexpr const ImmutableString texture2DProjGradEXT("texture2DProjGradEXT");
+constexpr const ImmutableString texture2DProjGradEXT_0H2B1B1B("texture2DProjGradEXT(0H2B1B1B");
+constexpr const ImmutableString texture2DProjGradEXT_0H3B1B1B("texture2DProjGradEXT(0H3B1B1B");
+constexpr const ImmutableString texture2DProjLod("texture2DProjLod");
+constexpr const ImmutableString texture2DProjLodEXT("texture2DProjLodEXT");
+constexpr const ImmutableString texture2DProjLodEXT_0H2B0B("texture2DProjLodEXT(0H2B0B");
+constexpr const ImmutableString texture2DProjLod_0H2B0B("texture2DProjLod(0H2B0B");
+constexpr const ImmutableString texture2DProj_0H2B0B("texture2DProj(0H2B0B");
+constexpr const ImmutableString texture2DRect("texture2DRect");
+constexpr const ImmutableString texture2DRectProj("texture2DRectProj");
+constexpr const ImmutableString texture3D("texture3D");
+constexpr const ImmutableString texture3DLod("texture3DLod");
+constexpr const ImmutableString texture3DProj("texture3DProj");
+constexpr const ImmutableString texture3DProjLod("texture3DProjLod");
+constexpr const ImmutableString texture3DProj_0I3B0B("texture3DProj(0I3B0B");
+constexpr const ImmutableString texture3D_0I2B0B("texture3D(0I2B0B");
+constexpr const ImmutableString textureCube("textureCube");
+constexpr const ImmutableString textureCubeGradEXT("textureCubeGradEXT");
+constexpr const ImmutableString textureCubeGradEXT_0J2B2B2B("textureCubeGradEXT(0J2B2B2B");
+constexpr const ImmutableString textureCubeLod("textureCubeLod");
+constexpr const ImmutableString textureCubeLodEXT("textureCubeLodEXT");
+constexpr const ImmutableString textureGather("textureGather");
+constexpr const ImmutableString textureGatherOffset("textureGatherOffset");
+constexpr const ImmutableString textureGatherOffset_0H1B1C0C("textureGatherOffset(0H1B1C0C");
+constexpr const ImmutableString textureGatherOffset_0K2B1C0C("textureGatherOffset(0K2B1C0C");
+constexpr const ImmutableString textureGatherOffset_0Q1B1C0C("textureGatherOffset(0Q1B1C0C");
+constexpr const ImmutableString textureGatherOffset_0T2B1C("textureGatherOffset(0T2B1C");
+constexpr const ImmutableString textureGatherOffset_0T2B1C0C("textureGatherOffset(0T2B1C0C");
+constexpr const ImmutableString textureGatherOffset_0W1B1C("textureGatherOffset(0W1B1C");
+constexpr const ImmutableString textureGatherOffset_0W1B1C0C("textureGatherOffset(0W1B1C0C");
+constexpr const ImmutableString textureGatherOffset_0Z2B1C0C("textureGatherOffset(0Z2B1C0C");
+constexpr const ImmutableString textureGatherOffset_0c1B0B1C("textureGatherOffset(0c1B0B1C");
+constexpr const ImmutableString textureGatherOffset_0e2B0B1C("textureGatherOffset(0e2B0B1C");
+constexpr const ImmutableString textureGather_0J2B0C("textureGather(0J2B0C");
+constexpr const ImmutableString textureGather_0S2B0C("textureGather(0S2B0C");
+constexpr const ImmutableString textureGather_0T2B0C("textureGather(0T2B0C");
+constexpr const ImmutableString textureGather_0Z2B0C("textureGather(0Z2B0C");
+constexpr const ImmutableString textureGrad("textureGrad");
+constexpr const ImmutableString textureGradOffset("textureGradOffset");
+constexpr const ImmutableString textureGradOffset_0H1B1B1B1C("textureGradOffset(0H1B1B1B1C");
+constexpr const ImmutableString textureGradOffset_0I2B2B2B2C("textureGradOffset(0I2B2B2B2C");
+constexpr const ImmutableString textureGradOffset_0K2B1B1B1C("textureGradOffset(0K2B1B1B1C");
+constexpr const ImmutableString textureGradOffset_0Q1B1B1B1C("textureGradOffset(0Q1B1B1B1C");
+constexpr const ImmutableString textureGradOffset_0R2B2B2B2C("textureGradOffset(0R2B2B2B2C");
+constexpr const ImmutableString textureGradOffset_0T2B1B1B1C("textureGradOffset(0T2B1B1B1C");
+constexpr const ImmutableString textureGradOffset_0W1B1B1B1C("textureGradOffset(0W1B1B1B1C");
+constexpr const ImmutableString textureGradOffset_0X2B2B2B2C("textureGradOffset(0X2B2B2B2C");
+constexpr const ImmutableString textureGradOffset_0Z2B1B1B1C("textureGradOffset(0Z2B1B1B1C");
+constexpr const ImmutableString textureGradOffset_0c2B1B1B1C("textureGradOffset(0c2B1B1B1C");
+constexpr const ImmutableString textureGradOffset_0e3B1B1B1C("textureGradOffset(0e3B1B1B1C");
+constexpr const ImmutableString textureGrad_0H1B1B1B("textureGrad(0H1B1B1B");
+constexpr const ImmutableString textureGrad_0I2B2B2B("textureGrad(0I2B2B2B");
+constexpr const ImmutableString textureGrad_0J2B2B2B("textureGrad(0J2B2B2B");
+constexpr const ImmutableString textureGrad_0K2B1B1B("textureGrad(0K2B1B1B");
+constexpr const ImmutableString textureGrad_0Q1B1B1B("textureGrad(0Q1B1B1B");
+constexpr const ImmutableString textureGrad_0R2B2B2B("textureGrad(0R2B2B2B");
+constexpr const ImmutableString textureGrad_0S2B2B2B("textureGrad(0S2B2B2B");
+constexpr const ImmutableString textureGrad_0T2B1B1B("textureGrad(0T2B1B1B");
+constexpr const ImmutableString textureGrad_0W1B1B1B("textureGrad(0W1B1B1B");
+constexpr const ImmutableString textureGrad_0X2B2B2B("textureGrad(0X2B2B2B");
+constexpr const ImmutableString textureGrad_0Y2B2B2B("textureGrad(0Y2B2B2B");
+constexpr const ImmutableString textureGrad_0Z2B1B1B("textureGrad(0Z2B1B1B");
+constexpr const ImmutableString textureGrad_0c2B1B1B("textureGrad(0c2B1B1B");
+constexpr const ImmutableString textureGrad_0d3B2B2B("textureGrad(0d3B2B2B");
+constexpr const ImmutableString textureGrad_0e3B1B1B("textureGrad(0e3B1B1B");
+constexpr const ImmutableString textureLod("textureLod");
+constexpr const ImmutableString textureLodOffset("textureLodOffset");
+constexpr const ImmutableString textureLodOffset_0H1B0B1C("textureLodOffset(0H1B0B1C");
+constexpr const ImmutableString textureLodOffset_0I2B0B2C("textureLodOffset(0I2B0B2C");
+constexpr const ImmutableString textureLodOffset_0K2B0B1C("textureLodOffset(0K2B0B1C");
+constexpr const ImmutableString textureLodOffset_0Q1B0B1C("textureLodOffset(0Q1B0B1C");
+constexpr const ImmutableString textureLodOffset_0R2B0B2C("textureLodOffset(0R2B0B2C");
+constexpr const ImmutableString textureLodOffset_0T2B0B1C("textureLodOffset(0T2B0B1C");
+constexpr const ImmutableString textureLodOffset_0W1B0B1C("textureLodOffset(0W1B0B1C");
+constexpr const ImmutableString textureLodOffset_0X2B0B2C("textureLodOffset(0X2B0B2C");
+constexpr const ImmutableString textureLodOffset_0Z2B0B1C("textureLodOffset(0Z2B0B1C");
+constexpr const ImmutableString textureLodOffset_0c2B0B1C("textureLodOffset(0c2B0B1C");
+constexpr const ImmutableString textureLod_0J2B0B("textureLod(0J2B0B");
+constexpr const ImmutableString textureLod_0Q1B0B("textureLod(0Q1B0B");
+constexpr const ImmutableString textureLod_0S2B0B("textureLod(0S2B0B");
+constexpr const ImmutableString textureLod_0W1B0B("textureLod(0W1B0B");
+constexpr const ImmutableString textureLod_0Y2B0B("textureLod(0Y2B0B");
+constexpr const ImmutableString textureLod_0Z2B0B("textureLod(0Z2B0B");
+constexpr const ImmutableString textureOffset("textureOffset");
+constexpr const ImmutableString textureOffset_0H1B1C0B("textureOffset(0H1B1C0B");
+constexpr const ImmutableString textureOffset_0I2B2C0B("textureOffset(0I2B2C0B");
+constexpr const ImmutableString textureOffset_0K2B1C0B("textureOffset(0K2B1C0B");
+constexpr const ImmutableString textureOffset_0Q1B1C0B("textureOffset(0Q1B1C0B");
+constexpr const ImmutableString textureOffset_0R2B2C0B("textureOffset(0R2B2C0B");
+constexpr const ImmutableString textureOffset_0T2B1C0B("textureOffset(0T2B1C0B");
+constexpr const ImmutableString textureOffset_0W1B1C0B("textureOffset(0W1B1C0B");
+constexpr const ImmutableString textureOffset_0X2B2C("textureOffset(0X2B2C");
+constexpr const ImmutableString textureOffset_0X2B2C0B("textureOffset(0X2B2C0B");
+constexpr const ImmutableString textureOffset_0Z2B1C0B("textureOffset(0Z2B1C0B");
+constexpr const ImmutableString textureOffset_0c2B1C0B("textureOffset(0c2B1C0B");
+constexpr const ImmutableString textureProj("textureProj");
+constexpr const ImmutableString textureProjGrad("textureProjGrad");
+constexpr const ImmutableString textureProjGradOffset("textureProjGradOffset");
+constexpr const ImmutableString textureProjGradOffset_0H2B1B1B1C(
+ "textureProjGradOffset(0H2B1B1B1C");
+constexpr const ImmutableString textureProjGradOffset_0H3B1B1B1C(
+ "textureProjGradOffset(0H3B1B1B1C");
+constexpr const ImmutableString textureProjGradOffset_0I3B2B2B2C(
+ "textureProjGradOffset(0I3B2B2B2C");
+constexpr const ImmutableString textureProjGradOffset_0Q2B1B1B1C(
+ "textureProjGradOffset(0Q2B1B1B1C");
+constexpr const ImmutableString textureProjGradOffset_0Q3B1B1B1C(
+ "textureProjGradOffset(0Q3B1B1B1C");
+constexpr const ImmutableString textureProjGradOffset_0R3B2B2B2C(
+ "textureProjGradOffset(0R3B2B2B2C");
+constexpr const ImmutableString textureProjGradOffset_0W2B1B1B1C(
+ "textureProjGradOffset(0W2B1B1B1C");
+constexpr const ImmutableString textureProjGradOffset_0W3B1B1B1C(
+ "textureProjGradOffset(0W3B1B1B1C");
+constexpr const ImmutableString textureProjGradOffset_0X3B2B2B2C(
+ "textureProjGradOffset(0X3B2B2B2C");
+constexpr const ImmutableString textureProjGradOffset_0c3B1B1B1C(
+ "textureProjGradOffset(0c3B1B1B1C");
+constexpr const ImmutableString textureProjGrad_0H2B1B1B("textureProjGrad(0H2B1B1B");
+constexpr const ImmutableString textureProjGrad_0H3B1B1B("textureProjGrad(0H3B1B1B");
+constexpr const ImmutableString textureProjGrad_0I3B2B2B("textureProjGrad(0I3B2B2B");
+constexpr const ImmutableString textureProjGrad_0Q2B1B1B("textureProjGrad(0Q2B1B1B");
+constexpr const ImmutableString textureProjGrad_0Q3B1B1B("textureProjGrad(0Q3B1B1B");
+constexpr const ImmutableString textureProjGrad_0R3B2B2B("textureProjGrad(0R3B2B2B");
+constexpr const ImmutableString textureProjGrad_0W2B1B1B("textureProjGrad(0W2B1B1B");
+constexpr const ImmutableString textureProjGrad_0W3B1B1B("textureProjGrad(0W3B1B1B");
+constexpr const ImmutableString textureProjGrad_0X3B2B2B("textureProjGrad(0X3B2B2B");
+constexpr const ImmutableString textureProjGrad_0c3B1B1B("textureProjGrad(0c3B1B1B");
+constexpr const ImmutableString textureProjLod("textureProjLod");
+constexpr const ImmutableString textureProjLodOffset("textureProjLodOffset");
+constexpr const ImmutableString textureProjLodOffset_0H2B0B1C("textureProjLodOffset(0H2B0B1C");
+constexpr const ImmutableString textureProjLodOffset_0H3B0B1C("textureProjLodOffset(0H3B0B1C");
+constexpr const ImmutableString textureProjLodOffset_0I3B0B2C("textureProjLodOffset(0I3B0B2C");
+constexpr const ImmutableString textureProjLodOffset_0Q2B0B1C("textureProjLodOffset(0Q2B0B1C");
+constexpr const ImmutableString textureProjLodOffset_0Q3B0B1C("textureProjLodOffset(0Q3B0B1C");
+constexpr const ImmutableString textureProjLodOffset_0R3B0B2C("textureProjLodOffset(0R3B0B2C");
+constexpr const ImmutableString textureProjLodOffset_0W2B0B1C("textureProjLodOffset(0W2B0B1C");
+constexpr const ImmutableString textureProjLodOffset_0W3B0B1C("textureProjLodOffset(0W3B0B1C");
+constexpr const ImmutableString textureProjLodOffset_0X3B0B2C("textureProjLodOffset(0X3B0B2C");
+constexpr const ImmutableString textureProjLodOffset_0c3B0B1C("textureProjLodOffset(0c3B0B1C");
+constexpr const ImmutableString textureProjLod_0H3B0B("textureProjLod(0H3B0B");
+constexpr const ImmutableString textureProjLod_0I3B0B("textureProjLod(0I3B0B");
+constexpr const ImmutableString textureProjLod_0Q2B0B("textureProjLod(0Q2B0B");
+constexpr const ImmutableString textureProjLod_0Q3B0B("textureProjLod(0Q3B0B");
+constexpr const ImmutableString textureProjOffset("textureProjOffset");
+constexpr const ImmutableString textureProjOffset_0H2B1C("textureProjOffset(0H2B1C");
+constexpr const ImmutableString textureProjOffset_0H2B1C0B("textureProjOffset(0H2B1C0B");
+constexpr const ImmutableString textureProjOffset_0H3B1C("textureProjOffset(0H3B1C");
+constexpr const ImmutableString textureProjOffset_0H3B1C0B("textureProjOffset(0H3B1C0B");
+constexpr const ImmutableString textureProjOffset_0I3B2C0B("textureProjOffset(0I3B2C0B");
+constexpr const ImmutableString textureProjOffset_0Q2B1C("textureProjOffset(0Q2B1C");
+constexpr const ImmutableString textureProjOffset_0Q2B1C0B("textureProjOffset(0Q2B1C0B");
+constexpr const ImmutableString textureProjOffset_0Q3B1C("textureProjOffset(0Q3B1C");
+constexpr const ImmutableString textureProjOffset_0Q3B1C0B("textureProjOffset(0Q3B1C0B");
+constexpr const ImmutableString textureProjOffset_0R3B2C0B("textureProjOffset(0R3B2C0B");
+constexpr const ImmutableString textureProjOffset_0W2B1C0B("textureProjOffset(0W2B1C0B");
+constexpr const ImmutableString textureProjOffset_0W3B1C("textureProjOffset(0W3B1C");
+constexpr const ImmutableString textureProjOffset_0W3B1C0B("textureProjOffset(0W3B1C0B");
+constexpr const ImmutableString textureProjOffset_0X3B2C("textureProjOffset(0X3B2C");
+constexpr const ImmutableString textureProjOffset_0X3B2C0B("textureProjOffset(0X3B2C0B");
+constexpr const ImmutableString textureProjOffset_0c3B1C0B("textureProjOffset(0c3B1C0B");
+constexpr const ImmutableString textureProj_0Q2B0B("textureProj(0Q2B0B");
+constexpr const ImmutableString textureProj_0R3B0B("textureProj(0R3B0B");
+constexpr const ImmutableString textureProj_0X3B0B("textureProj(0X3B0B");
+constexpr const ImmutableString textureSize("textureSize");
+constexpr const ImmutableString textureSizeExt("textureSize");
+constexpr const ImmutableString texture_0Q1B0B("texture(0Q1B0B");
+constexpr const ImmutableString texture_0c2B0B("texture(0c2B0B");
+constexpr const ImmutableString texture_0d3B0B("texture(0d3B0B");
+constexpr const ImmutableString transpose("transpose");
+constexpr const ImmutableString trunc("trunc");
+constexpr const ImmutableString uaddCarry("uaddCarry");
+constexpr const ImmutableString uaddCarry_2D2D2D("uaddCarry(2D2D2D");
+constexpr const ImmutableString uaddCarry_3D3D3D("uaddCarry(3D3D3D");
+constexpr const ImmutableString uintBitsToFloat("uintBitsToFloat");
+constexpr const ImmutableString umulExtended("umulExtended");
+constexpr const ImmutableString umulExtended_0D0D0D0D("umulExtended(0D0D0D0D");
+constexpr const ImmutableString umulExtended_1D1D1D1D("umulExtended(1D1D1D1D");
+constexpr const ImmutableString umulExtended_2D2D2D2D("umulExtended(2D2D2D2D");
+constexpr const ImmutableString umulExtended_3D3D3D3D("umulExtended(3D3D3D3D");
+constexpr const ImmutableString unpackHalf2x16("unpackHalf2x16");
+constexpr const ImmutableString unpackSnorm2x16("unpackSnorm2x16");
+constexpr const ImmutableString unpackSnorm4x8("unpackSnorm4x8");
+constexpr const ImmutableString unpackUnorm2x16("unpackUnorm2x16");
+constexpr const ImmutableString unpackUnorm4x8("unpackUnorm4x8");
+constexpr const ImmutableString usubBorrow("usubBorrow");
+constexpr const ImmutableString usubBorrow_0D0D0D("usubBorrow(0D0D0D");
+constexpr const ImmutableString usubBorrow_1D1D1D("usubBorrow(1D1D1D");
+constexpr const ImmutableString usubBorrow_3D3D3D("usubBorrow(3D3D3D");
+constexpr const ImmutableString yuv_2_rgb("yuv_2_rgb");
+
+} // namespace BuiltInName
+
+// TODO(oetuaho): Would be nice to make this a class instead of a namespace so that we could friend
+// this from TVariable. Now symbol constructors taking an id have to be public even though they're
+// not supposed to be accessible from outside of here. http://anglebug.com/2390
+namespace BuiltInVariable
+{
+
+constexpr const TVariable kVar_gl_BaseInstance(
+ BuiltInId::gl_BaseInstance,
+ BuiltInName::gl_BaseInstance,
+ SymbolType::BuiltIn,
+ TExtension::ANGLE_base_vertex_base_instance,
+ StaticType::Get<EbtInt, EbpHigh, EvqBaseInstance, 1, 1>());
+constexpr const TVariable kVar_gl_BaseVertex(
+ BuiltInId::gl_BaseVertex,
+ BuiltInName::gl_BaseVertex,
+ SymbolType::BuiltIn,
+ TExtension::ANGLE_base_vertex_base_instance,
+ StaticType::Get<EbtInt, EbpHigh, EvqBaseVertex, 1, 1>());
+constexpr const TVariable kVar_gl_DrawID(BuiltInId::gl_DrawID,
+ BuiltInName::gl_DrawID,
+ SymbolType::BuiltIn,
+ TExtension::ANGLE_multi_draw,
+ StaticType::Get<EbtInt, EbpHigh, EvqDrawID, 1, 1>());
+constexpr const TVariable kVar_gl_DrawIDESSL1(BuiltInId::gl_DrawIDESSL1,
+ BuiltInName::gl_DrawID,
+ SymbolType::BuiltIn,
+ TExtension::ANGLE_multi_draw,
+ StaticType::Get<EbtInt, EbpHigh, EvqDrawID, 1, 1>());
+constexpr const TVariable kVar_gl_FragColor(
+ BuiltInId::gl_FragColor,
+ BuiltInName::gl_FragColor,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpMedium, EvqFragColor, 4, 1>());
+constexpr const TVariable kVar_gl_FragCoord(
+ BuiltInId::gl_FragCoord,
+ BuiltInName::gl_FragCoord,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpMedium, EvqFragCoord, 4, 1>());
+constexpr const TVariable kVar_gl_FragDepth(
+ BuiltInId::gl_FragDepth,
+ BuiltInName::gl_FragDepth,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpHigh, EvqFragDepth, 1, 1>());
+constexpr const TVariable kVar_gl_FrontFacing(
+ BuiltInId::gl_FrontFacing,
+ BuiltInName::gl_FrontFacing,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtBool, EbpUndefined, EvqFrontFacing, 1, 1>());
+constexpr const TVariable kVar_gl_GlobalInvocationID(
+ BuiltInId::gl_GlobalInvocationID,
+ BuiltInName::gl_GlobalInvocationID,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobalInvocationID, 3, 1>());
+constexpr const TVariable kVar_gl_InstanceID(
+ BuiltInId::gl_InstanceID,
+ BuiltInName::gl_InstanceID,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpHigh, EvqInstanceID, 1, 1>());
+constexpr const TVariable kVar_gl_InvocationID(
+ BuiltInId::gl_InvocationID,
+ BuiltInName::gl_InvocationID,
+ SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpHigh, EvqInvocationID, 1, 1>());
+constexpr const TVariable kVar_gl_LastFragColor(
+ BuiltInId::gl_LastFragColor,
+ BuiltInName::gl_LastFragColor,
+ SymbolType::BuiltIn,
+ TExtension::NV_shader_framebuffer_fetch,
+ StaticType::Get<EbtFloat, EbpMedium, EvqLastFragColor, 4, 1>());
+constexpr const TVariable kVar_gl_LastFragColorARM(
+ BuiltInId::gl_LastFragColorARM,
+ BuiltInName::gl_LastFragColorARM,
+ SymbolType::BuiltIn,
+ TExtension::ARM_shader_framebuffer_fetch,
+ StaticType::Get<EbtFloat, EbpMedium, EvqLastFragColor, 4, 1>());
+constexpr const TVariable kVar_gl_Layer(BuiltInId::gl_Layer,
+ BuiltInName::gl_Layer,
+ SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpHigh, EvqLayer, 1, 1>());
+constexpr const TVariable kVar_gl_LayerGS(BuiltInId::gl_LayerGS,
+ BuiltInName::gl_Layer,
+ SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpHigh, EvqLayer, 1, 1>());
+constexpr const TVariable kVar_gl_LayerVS(BuiltInId::gl_LayerVS,
+ BuiltInName::gl_Layer,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpHigh, EvqLayer, 1, 1>());
+constexpr const TVariable kVar_gl_LocalInvocationID(
+ BuiltInId::gl_LocalInvocationID,
+ BuiltInName::gl_LocalInvocationID,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqLocalInvocationID, 3, 1>());
+constexpr const TVariable kVar_gl_LocalInvocationIndex(
+ BuiltInId::gl_LocalInvocationIndex,
+ BuiltInName::gl_LocalInvocationIndex,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqLocalInvocationIndex, 1, 1>());
+constexpr const TVariable kVar_gl_NumWorkGroups(
+ BuiltInId::gl_NumWorkGroups,
+ BuiltInName::gl_NumWorkGroups,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqNumWorkGroups, 3, 1>());
+constexpr const TVariable kVar_gl_PointCoord(
+ BuiltInId::gl_PointCoord,
+ BuiltInName::gl_PointCoord,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpMedium, EvqPointCoord, 2, 1>());
+constexpr const TVariable kVar_gl_PointSize(
+ BuiltInId::gl_PointSize,
+ BuiltInName::gl_PointSize,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpMedium, EvqPointSize, 1, 1>());
+constexpr const TVariable kVar_gl_Position(BuiltInId::gl_Position,
+ BuiltInName::gl_Position,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpHigh, EvqPosition, 4, 1>());
+constexpr const TVariable kVar_gl_PrimitiveID(
+ BuiltInId::gl_PrimitiveID,
+ BuiltInName::gl_PrimitiveID,
+ SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpHigh, EvqPrimitiveID, 1, 1>());
+constexpr const TVariable kVar_gl_PrimitiveIDGS(
+ BuiltInId::gl_PrimitiveIDGS,
+ BuiltInName::gl_PrimitiveID,
+ SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpHigh, EvqPrimitiveID, 1, 1>());
+constexpr const TVariable kVar_gl_PrimitiveIDIn(
+ BuiltInId::gl_PrimitiveIDIn,
+ BuiltInName::gl_PrimitiveIDIn,
+ SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpHigh, EvqPrimitiveIDIn, 1, 1>());
+constexpr const TVariable kVar_gl_SecondaryFragColorEXT(
+ BuiltInId::gl_SecondaryFragColorEXT,
+ BuiltInName::gl_SecondaryFragColorEXT,
+ SymbolType::BuiltIn,
+ TExtension::EXT_blend_func_extended,
+ StaticType::Get<EbtFloat, EbpMedium, EvqSecondaryFragColorEXT, 4, 1>());
+constexpr const TVariable kVar_gl_VertexID(BuiltInId::gl_VertexID,
+ BuiltInName::gl_VertexID,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpHigh, EvqVertexID, 1, 1>());
+constexpr const TVariable kVar_gl_ViewID_OVR(
+ BuiltInId::gl_ViewID_OVR,
+ BuiltInName::gl_ViewID_OVR,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpHigh, EvqViewIDOVR, 1, 1>());
+constexpr const TVariable kVar_gl_ViewID_OVRESSL1(
+ BuiltInId::gl_ViewID_OVRESSL1,
+ BuiltInName::gl_ViewID_OVR,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpHigh, EvqViewIDOVR, 1, 1>());
+constexpr const TVariable kVar_gl_ViewportIndex(
+ BuiltInId::gl_ViewportIndex,
+ BuiltInName::gl_ViewportIndex,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpHigh, EvqViewportIndex, 1, 1>());
+constexpr const TVariable kVar_gl_WorkGroupID(
+ BuiltInId::gl_WorkGroupID,
+ BuiltInName::gl_WorkGroupID,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqWorkGroupID, 3, 1>());
+constexpr const TVariable kVar_gl_WorkGroupSize(
+ BuiltInId::gl_WorkGroupSize,
+ BuiltInName::gl_WorkGroupSize,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqWorkGroupSize, 3, 1>());
+constexpr const TVariable kVar_pt0B(BuiltInId::pt0B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0C(BuiltInId::pt0C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0D(BuiltInId::pt0D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0E(BuiltInId::pt0E,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0F(
+ BuiltInId::pt0F,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtAtomicCounter, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0G(
+ BuiltInId::pt0G,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtYuvCscStandardEXT, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0H(BuiltInId::pt0H,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler2D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0I(BuiltInId::pt0I,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler3D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0J(
+ BuiltInId::pt0J,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSamplerCube, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0K(
+ BuiltInId::pt0K,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler2DArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0L(
+ BuiltInId::pt0L,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSamplerExternalOES, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0M(
+ BuiltInId::pt0M,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSamplerExternal2DY2YEXT, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0N(
+ BuiltInId::pt0N,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler2DRect, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0O(
+ BuiltInId::pt0O,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler2DMS, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0P(
+ BuiltInId::pt0P,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler2DMSArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0Q(
+ BuiltInId::pt0Q,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtISampler2D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0R(
+ BuiltInId::pt0R,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtISampler3D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0S(
+ BuiltInId::pt0S,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtISamplerCube, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0T(
+ BuiltInId::pt0T,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtISampler2DArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0U(
+ BuiltInId::pt0U,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtISampler2DMS, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0V(
+ BuiltInId::pt0V,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtISampler2DMSArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0W(
+ BuiltInId::pt0W,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUSampler2D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0X(
+ BuiltInId::pt0X,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUSampler3D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0Y(
+ BuiltInId::pt0Y,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUSamplerCube, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0Z(
+ BuiltInId::pt0Z,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUSampler2DArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0a(
+ BuiltInId::pt0a,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUSampler2DMS, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0b(
+ BuiltInId::pt0b,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUSampler2DMSArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0c(
+ BuiltInId::pt0c,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler2DShadow, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0d(
+ BuiltInId::pt0d,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSamplerCubeShadow, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0e(
+ BuiltInId::pt0e,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtSampler2DArrayShadow, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0f(BuiltInId::pt0f,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtImage2D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0g(BuiltInId::pt0g,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtIImage2D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0h(BuiltInId::pt0h,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUImage2D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0i(BuiltInId::pt0i,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtImage3D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0j(BuiltInId::pt0j,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtIImage3D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0k(BuiltInId::pt0k,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUImage3D, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0l(
+ BuiltInId::pt0l,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtImage2DArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0m(
+ BuiltInId::pt0m,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtIImage2DArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0n(
+ BuiltInId::pt0n,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUImage2DArray, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0o(BuiltInId::pt0o,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtImageCube, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0p(
+ BuiltInId::pt0p,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtIImageCube, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt0q(
+ BuiltInId::pt0q,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUImageCube, EbpUndefined, EvqGlobal, 1, 1>());
+constexpr const TVariable kVar_pt1B(BuiltInId::pt1B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>());
+constexpr const TVariable kVar_pt1C(BuiltInId::pt1C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>());
+constexpr const TVariable kVar_pt1D(BuiltInId::pt1D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>());
+constexpr const TVariable kVar_pt1E(BuiltInId::pt1E,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>());
+constexpr const TVariable kVar_pt2B(BuiltInId::pt2B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>());
+constexpr const TVariable kVar_pt2C(BuiltInId::pt2C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>());
+constexpr const TVariable kVar_pt2D(BuiltInId::pt2D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>());
+constexpr const TVariable kVar_pt2E(BuiltInId::pt2E,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>());
+constexpr const TVariable kVar_pt3B(BuiltInId::pt3B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>());
+constexpr const TVariable kVar_pt3C(BuiltInId::pt3C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>());
+constexpr const TVariable kVar_pt3D(BuiltInId::pt3D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>());
+constexpr const TVariable kVar_pt3E(BuiltInId::pt3E,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>());
+constexpr const TVariable kVar_pt5B(BuiltInId::pt5B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 2>());
+constexpr const TVariable kVar_pt6B(BuiltInId::pt6B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 2>());
+constexpr const TVariable kVar_pt7B(BuiltInId::pt7B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 2>());
+constexpr const TVariable kVar_pt9B(BuiltInId::pt9B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 3>());
+constexpr const TVariable kVar_ptAB(BuiltInId::ptAB,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 3>());
+constexpr const TVariable kVar_ptBB(BuiltInId::ptBB,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 3>());
+constexpr const TVariable kVar_ptDB(BuiltInId::ptDB,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 4>());
+constexpr const TVariable kVar_ptEB(BuiltInId::ptEB,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 4>());
+constexpr const TVariable kVar_ptFB(BuiltInId::ptFB,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 4>());
+constexpr const TVariable kVar_pt_io_0C(BuiltInId::pt_io_0C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqInOut, 1, 1>());
+constexpr const TVariable kVar_pt_io_0D(BuiltInId::pt_io_0D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqInOut, 1, 1>());
+constexpr const TVariable kVar_pt_o_0B(BuiltInId::pt_o_0B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqOut, 1, 1>());
+constexpr const TVariable kVar_pt_o_0C(BuiltInId::pt_o_0C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqOut, 1, 1>());
+constexpr const TVariable kVar_pt_o_0D(BuiltInId::pt_o_0D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqOut, 1, 1>());
+constexpr const TVariable kVar_pt_o_1B(BuiltInId::pt_o_1B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqOut, 2, 1>());
+constexpr const TVariable kVar_pt_o_1C(BuiltInId::pt_o_1C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqOut, 2, 1>());
+constexpr const TVariable kVar_pt_o_1D(BuiltInId::pt_o_1D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqOut, 2, 1>());
+constexpr const TVariable kVar_pt_o_2B(BuiltInId::pt_o_2B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqOut, 3, 1>());
+constexpr const TVariable kVar_pt_o_2C(BuiltInId::pt_o_2C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqOut, 3, 1>());
+constexpr const TVariable kVar_pt_o_2D(BuiltInId::pt_o_2D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqOut, 3, 1>());
+constexpr const TVariable kVar_pt_o_3B(BuiltInId::pt_o_3B,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqOut, 4, 1>());
+constexpr const TVariable kVar_pt_o_3C(BuiltInId::pt_o_3C,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpUndefined, EvqOut, 4, 1>());
+constexpr const TVariable kVar_pt_o_3D(BuiltInId::pt_o_3D,
+ BuiltInName::_empty,
+ SymbolType::BuiltIn,
+ TExtension::UNDEFINED,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqOut, 4, 1>());
+
+const TVariable *gl_BaseInstance()
+{
+ return &kVar_gl_BaseInstance;
+}
+
+const TVariable *gl_BaseVertex()
+{
+ return &kVar_gl_BaseVertex;
+}
+
+const TVariable *gl_DrawID()
+{
+ return &kVar_gl_DrawID;
+}
+
+const TVariable *gl_DrawIDESSL1()
+{
+ return &kVar_gl_DrawIDESSL1;
+}
+
+const TVariable *gl_FragColor()
+{
+ return &kVar_gl_FragColor;
+}
+
+const TVariable *gl_FragCoord()
+{
+ return &kVar_gl_FragCoord;
+}
+
+const TVariable *gl_FragDepth()
+{
+ return &kVar_gl_FragDepth;
+}
+
+const TVariable *gl_FrontFacing()
+{
+ return &kVar_gl_FrontFacing;
+}
+
+const TVariable *gl_GlobalInvocationID()
+{
+ return &kVar_gl_GlobalInvocationID;
+}
+
+const TVariable *gl_InstanceID()
+{
+ return &kVar_gl_InstanceID;
+}
+
+const TVariable *gl_InvocationID()
+{
+ return &kVar_gl_InvocationID;
+}
+
+const TVariable *gl_LastFragColor()
+{
+ return &kVar_gl_LastFragColor;
+}
+
+const TVariable *gl_LastFragColorARM()
+{
+ return &kVar_gl_LastFragColorARM;
+}
+
+const TVariable *gl_Layer()
+{
+ return &kVar_gl_Layer;
+}
+
+const TVariable *gl_LayerGS()
+{
+ return &kVar_gl_LayerGS;
+}
+
+const TVariable *gl_LayerVS()
+{
+ return &kVar_gl_LayerVS;
+}
+
+const TVariable *gl_LocalInvocationID()
+{
+ return &kVar_gl_LocalInvocationID;
+}
+
+const TVariable *gl_LocalInvocationIndex()
+{
+ return &kVar_gl_LocalInvocationIndex;
+}
+
+const TVariable *gl_NumWorkGroups()
+{
+ return &kVar_gl_NumWorkGroups;
+}
+
+const TVariable *gl_PointCoord()
+{
+ return &kVar_gl_PointCoord;
+}
+
+const TVariable *gl_PointSize()
+{
+ return &kVar_gl_PointSize;
+}
+
+const TVariable *gl_Position()
+{
+ return &kVar_gl_Position;
+}
+
+const TVariable *gl_PrimitiveID()
+{
+ return &kVar_gl_PrimitiveID;
+}
+
+const TVariable *gl_PrimitiveIDGS()
+{
+ return &kVar_gl_PrimitiveIDGS;
+}
+
+const TVariable *gl_PrimitiveIDIn()
+{
+ return &kVar_gl_PrimitiveIDIn;
+}
+
+const TVariable *gl_SecondaryFragColorEXT()
+{
+ return &kVar_gl_SecondaryFragColorEXT;
+}
+
+const TVariable *gl_VertexID()
+{
+ return &kVar_gl_VertexID;
+}
+
+const TVariable *gl_ViewID_OVR()
+{
+ return &kVar_gl_ViewID_OVR;
+}
+
+const TVariable *gl_ViewID_OVRESSL1()
+{
+ return &kVar_gl_ViewID_OVRESSL1;
+}
+
+const TVariable *gl_ViewportIndex()
+{
+ return &kVar_gl_ViewportIndex;
+}
+
+const TVariable *gl_WorkGroupID()
+{
+ return &kVar_gl_WorkGroupID;
+}
+
+const TVariable *gl_WorkGroupSize()
+{
+ return &kVar_gl_WorkGroupSize;
+}
+
+} // namespace BuiltInVariable
+
+namespace BuiltInParameters
+{
+
+constexpr const TVariable **empty = nullptr;
+constexpr const TVariable *p0B0B0B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0B0B0E[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt0E};
+constexpr const TVariable *p0B0B1B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1B};
+constexpr const TVariable *p0B0B2B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p0B0B3B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p0B0C[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0B1B[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt1B};
+constexpr const TVariable *p0B2B[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p0B3B[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p0B_o_0B[2] = {&BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt_o_0B};
+constexpr const TVariable *p0B_o_0C[2] = {&BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt_o_0C};
+constexpr const TVariable *p0C0C0C0C[4] = {&BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0C0C_o_0C_o_0C[4] = {
+ &BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt_o_0C,
+ &BuiltInVariable::kVar_pt_o_0C};
+constexpr const TVariable *p0D0C0C[3] = {&BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0D0D0C0C[4] = {&BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0D0D0D[3] = {&BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D,
+ &BuiltInVariable::kVar_pt0D};
+constexpr const TVariable *p0D0D_o_0D_o_0D[4] = {
+ &BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt_o_0D,
+ &BuiltInVariable::kVar_pt_o_0D};
+constexpr const TVariable *p0F[1] = {&BuiltInVariable::kVar_pt0F};
+constexpr const TVariable *p0H0C[2] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0H1B0B1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0H1B0C[3] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0H1B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0H1B1C0B[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0H1B1C0C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0H1C0C1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0H2B0B1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0H2B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0H2B1C0B[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0H3B0B1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0H3B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0H3B1C0B[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0I0C[2] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0I2B0B2C[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0I2B2B2B2C[5] = {
+ &BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0I2B2C0B[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0I2C0C2C[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0I3B0B2C[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0I3B2B2B2C[5] = {
+ &BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0I3B2C0B[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0J0C[2] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0J2B0B[3] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0J2B0C[3] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0J2B2B2B[4] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p0K0C[2] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0K2B0B1C[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0K2B0C[3] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0K2B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0K2B1C0B[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0K2B1C0C[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0K2C0C1C[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0L0C[2] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0L1B0B[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0L1C0C[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0L2B0B[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0L3B0B[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0M0C[2] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0M1B0B[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0M1C0C[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0M2B0B[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0M3B0B[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0N1B[2] = {&BuiltInVariable::kVar_pt0N, &BuiltInVariable::kVar_pt1B};
+constexpr const TVariable *p0N2B[2] = {&BuiltInVariable::kVar_pt0N, &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p0N3B[2] = {&BuiltInVariable::kVar_pt0N, &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p0O1C0C[3] = {&BuiltInVariable::kVar_pt0O, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0P2C0C[3] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Q0C[2] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Q1B0B1C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Q1B0C[3] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Q1B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Q1B1C0B[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0Q1B1C0C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Q1C0C1C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Q2B0B1C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Q2B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Q2B1C0B[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0Q3B0B1C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Q3B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Q3B1C0B[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0R0C[2] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0R2B0B2C[4] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0R2B2B2B2C[5] = {
+ &BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0R2B2C0B[4] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0R2C0C2C[4] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0R3B0B2C[4] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0R3B2B2B2C[5] = {
+ &BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0R3B2C0B[4] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0S0C[2] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0S2B0B[3] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0S2B0C[3] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0S2B2B2B[4] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p0T0C[2] = {&BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0T2B0B1C[4] = {&BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0T2B0C[3] = {&BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0T2B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0T2B1C0B[4] = {&BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0T2B1C0C[4] = {&BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0T2C0C1C[4] = {&BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0U1C0C[3] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0V2C0C[3] = {&BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0W0C[2] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0W1B0B1C[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0W1B0C[3] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0W1B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0W1B1C0B[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0W1B1C0C[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0W1C0C1C[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0W2B0B1C[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0W2B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0W2B1C0B[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0W3B0B1C[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0W3B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0W3B1C0B[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0X0C[2] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0X2B0B2C[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0X2B2B2B2C[5] = {
+ &BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0X2B2C0B[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0X2C0C2C[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0X3B0B2C[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0X3B2B2B2C[5] = {
+ &BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p0X3B2C0B[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0Y0C[2] = {&BuiltInVariable::kVar_pt0Y, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Y2B0B[3] = {&BuiltInVariable::kVar_pt0Y, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0Y2B0C[3] = {&BuiltInVariable::kVar_pt0Y, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Y2B2B2B[4] = {&BuiltInVariable::kVar_pt0Y, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p0Z0C[2] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Z2B0B1C[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Z2B0C[3] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Z2B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0Z2B1C0B[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0Z2B1C0C[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0Z2C0C1C[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0a1C0C[3] = {&BuiltInVariable::kVar_pt0a, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0b2C0C[3] = {&BuiltInVariable::kVar_pt0b, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0c0C[2] = {&BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0c1B0B1C[4] = {&BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0c2B0B1C[4] = {&BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0c2B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0c2B1C0B[4] = {&BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0c3B0B1C[4] = {&BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0c3B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0c3B1C0B[4] = {&BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0d0C[2] = {&BuiltInVariable::kVar_pt0d, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0d2B0B[3] = {&BuiltInVariable::kVar_pt0d, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0d3B0B[3] = {&BuiltInVariable::kVar_pt0d, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p0d3B2B2B[4] = {&BuiltInVariable::kVar_pt0d, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p0e0C[2] = {&BuiltInVariable::kVar_pt0e, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p0e2B0B1C[4] = {&BuiltInVariable::kVar_pt0e, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0e3B1B1B1C[5] = {
+ &BuiltInVariable::kVar_pt0e, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p0f1C3B[3] = {&BuiltInVariable::kVar_pt0f, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p0g1C3C[3] = {&BuiltInVariable::kVar_pt0g, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt3C};
+constexpr const TVariable *p0h1C3D[3] = {&BuiltInVariable::kVar_pt0h, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt3D};
+constexpr const TVariable *p0i2C3B[3] = {&BuiltInVariable::kVar_pt0i, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p0j2C3C[3] = {&BuiltInVariable::kVar_pt0j, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3C};
+constexpr const TVariable *p0k2C3D[3] = {&BuiltInVariable::kVar_pt0k, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3D};
+constexpr const TVariable *p0l2C3B[3] = {&BuiltInVariable::kVar_pt0l, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p0m2C3C[3] = {&BuiltInVariable::kVar_pt0m, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3C};
+constexpr const TVariable *p0n2C3D[3] = {&BuiltInVariable::kVar_pt0n, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3D};
+constexpr const TVariable *p0o2C3B[3] = {&BuiltInVariable::kVar_pt0o, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p0p2C3C[3] = {&BuiltInVariable::kVar_pt0p, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3C};
+constexpr const TVariable *p0q2C3D[3] = {&BuiltInVariable::kVar_pt0q, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt3D};
+constexpr const TVariable *p1B0B0B[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p1B1B0B[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p1B1B1B[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1B};
+constexpr const TVariable *p1B1B1E[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt1E};
+constexpr const TVariable *p1B1C[2] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p1B2B[2] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p1B3B[2] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p1B_o_1B[2] = {&BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt_o_1B};
+constexpr const TVariable *p1B_o_1C[2] = {&BuiltInVariable::kVar_pt1B,
+ &BuiltInVariable::kVar_pt_o_1C};
+constexpr const TVariable *p1C0C0C[3] = {&BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p1C1C0C0C[4] = {&BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p1C1C1C[3] = {&BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt1C,
+ &BuiltInVariable::kVar_pt1C};
+constexpr const TVariable *p1C1C_o_1C_o_1C[4] = {
+ &BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt_o_1C,
+ &BuiltInVariable::kVar_pt_o_1C};
+constexpr const TVariable *p1D0C0C[3] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p1D0D0D[3] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt0D,
+ &BuiltInVariable::kVar_pt0D};
+constexpr const TVariable *p1D1D0C0C[4] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt1D,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p1D1D1D[3] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt1D,
+ &BuiltInVariable::kVar_pt1D};
+constexpr const TVariable *p1D1D_o_1D_o_1D[4] = {
+ &BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt_o_1D,
+ &BuiltInVariable::kVar_pt_o_1D};
+constexpr const TVariable *p1E1E[2] = {&BuiltInVariable::kVar_pt1E, &BuiltInVariable::kVar_pt1E};
+constexpr const TVariable *p2B0B0B[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p2B0G[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt0G};
+constexpr const TVariable *p2B1B[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B};
+constexpr const TVariable *p2B2B0B[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p2B2B2B[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p2B2B2E[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt2E};
+constexpr const TVariable *p2B2C[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p2B3B[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p2B_o_2B[2] = {&BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt_o_2B};
+constexpr const TVariable *p2B_o_2C[2] = {&BuiltInVariable::kVar_pt2B,
+ &BuiltInVariable::kVar_pt_o_2C};
+constexpr const TVariable *p2C0C0C[3] = {&BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p2C2C0C0C[4] = {&BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p2C2C2C[3] = {&BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt2C,
+ &BuiltInVariable::kVar_pt2C};
+constexpr const TVariable *p2C2C_o_2C_o_2C[4] = {
+ &BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt_o_2C,
+ &BuiltInVariable::kVar_pt_o_2C};
+constexpr const TVariable *p2D0C0C[3] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p2D0D0D[3] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt0D,
+ &BuiltInVariable::kVar_pt0D};
+constexpr const TVariable *p2D2D0C0C[4] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt2D,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p2D2D2D[3] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt2D,
+ &BuiltInVariable::kVar_pt2D};
+constexpr const TVariable *p2D2D_o_2D_o_2D[4] = {
+ &BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt_o_2D,
+ &BuiltInVariable::kVar_pt_o_2D};
+constexpr const TVariable *p2E2E[2] = {&BuiltInVariable::kVar_pt2E, &BuiltInVariable::kVar_pt2E};
+constexpr const TVariable *p3B0B0B[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt0B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p3B1B[2] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B};
+constexpr const TVariable *p3B2B[2] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B};
+constexpr const TVariable *p3B3B0B[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt0B};
+constexpr const TVariable *p3B3B3B[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt3B};
+constexpr const TVariable *p3B3B3E[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt3E};
+constexpr const TVariable *p3B3C[2] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3C};
+constexpr const TVariable *p3B_o_3B[2] = {&BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt_o_3B};
+constexpr const TVariable *p3B_o_3C[2] = {&BuiltInVariable::kVar_pt3B,
+ &BuiltInVariable::kVar_pt_o_3C};
+constexpr const TVariable *p3C0C0C[3] = {&BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p3C3C0C0C[4] = {&BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt3C,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p3C3C3C[3] = {&BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt3C,
+ &BuiltInVariable::kVar_pt3C};
+constexpr const TVariable *p3C3C_o_3C_o_3C[4] = {
+ &BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt_o_3C,
+ &BuiltInVariable::kVar_pt_o_3C};
+constexpr const TVariable *p3D0C0C[3] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p3D0D0D[3] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt0D,
+ &BuiltInVariable::kVar_pt0D};
+constexpr const TVariable *p3D3D0C0C[4] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt3D,
+ &BuiltInVariable::kVar_pt0C,
+ &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p3D3D3D[3] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt3D,
+ &BuiltInVariable::kVar_pt3D};
+constexpr const TVariable *p3D3D_o_3D_o_3D[4] = {
+ &BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt_o_3D,
+ &BuiltInVariable::kVar_pt_o_3D};
+constexpr const TVariable *p3E3E[2] = {&BuiltInVariable::kVar_pt3E, &BuiltInVariable::kVar_pt3E};
+constexpr const TVariable *p5B5B[2] = {&BuiltInVariable::kVar_pt5B, &BuiltInVariable::kVar_pt5B};
+constexpr const TVariable *p6B6B[2] = {&BuiltInVariable::kVar_pt6B, &BuiltInVariable::kVar_pt6B};
+constexpr const TVariable *p7B7B[2] = {&BuiltInVariable::kVar_pt7B, &BuiltInVariable::kVar_pt7B};
+constexpr const TVariable *p9B9B[2] = {&BuiltInVariable::kVar_pt9B, &BuiltInVariable::kVar_pt9B};
+constexpr const TVariable *pABAB[2] = {&BuiltInVariable::kVar_ptAB, &BuiltInVariable::kVar_ptAB};
+constexpr const TVariable *pBBBB[2] = {&BuiltInVariable::kVar_ptBB, &BuiltInVariable::kVar_ptBB};
+constexpr const TVariable *pDBDB[2] = {&BuiltInVariable::kVar_ptDB, &BuiltInVariable::kVar_ptDB};
+constexpr const TVariable *pEBEB[2] = {&BuiltInVariable::kVar_ptEB, &BuiltInVariable::kVar_ptEB};
+constexpr const TVariable *pFBFB[2] = {&BuiltInVariable::kVar_ptFB, &BuiltInVariable::kVar_ptFB};
+constexpr const TVariable *p_io_0C0C0C[3] = {
+ &BuiltInVariable::kVar_pt_io_0C, &BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt0C};
+constexpr const TVariable *p_io_0D0D0D[3] = {
+ &BuiltInVariable::kVar_pt_io_0D, &BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D};
+
+} // namespace BuiltInParameters
+
+namespace UnmangledBuiltIns
+{
+
+constexpr const UnmangledBuiltIn ARB_texture_rectangle(TExtension::ARB_texture_rectangle);
+constexpr const UnmangledBuiltIn EXT_YUV_target(TExtension::EXT_YUV_target);
+constexpr const UnmangledBuiltIn EXT_geometry_shader(TExtension::EXT_geometry_shader);
+constexpr const UnmangledBuiltIn EXT_shader_texture_lod(TExtension::EXT_shader_texture_lod);
+constexpr const UnmangledBuiltIn OES_standard_derivatives(TExtension::OES_standard_derivatives);
+constexpr const UnmangledBuiltIn OES_texture_3D(TExtension::OES_texture_3D);
+constexpr const UnmangledBuiltIn UNDEFINED(TExtension::UNDEFINED);
+
+} // namespace UnmangledBuiltIns
+
+// TODO(oetuaho): Would be nice to make this a class instead of a namespace so that we could friend
+// this from TFunction. Now symbol constructors taking an id have to be public even though they're
+// not supposed to be accessible from outside of here. http://anglebug.com/2390
+namespace BuiltInFunction
+{
+
+constexpr const TFunction kFunction_radians_0B(
+ BuiltInId::radians_Float1,
+ BuiltInName::radians,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpRadians,
+ true);
+constexpr const TFunction kFunction_radians_1B(
+ BuiltInId::radians_Float2,
+ BuiltInName::radians,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpRadians,
+ true);
+constexpr const TFunction kFunction_radians_2B(
+ BuiltInId::radians_Float3,
+ BuiltInName::radians,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpRadians,
+ true);
+constexpr const TFunction kFunction_radians_3B(
+ BuiltInId::radians_Float4,
+ BuiltInName::radians,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpRadians,
+ true);
+constexpr const TFunction kFunction_degrees_0B(
+ BuiltInId::degrees_Float1,
+ BuiltInName::degrees,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDegrees,
+ true);
+constexpr const TFunction kFunction_degrees_1B(
+ BuiltInId::degrees_Float2,
+ BuiltInName::degrees,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpDegrees,
+ true);
+constexpr const TFunction kFunction_degrees_2B(
+ BuiltInId::degrees_Float3,
+ BuiltInName::degrees,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpDegrees,
+ true);
+constexpr const TFunction kFunction_degrees_3B(
+ BuiltInId::degrees_Float4,
+ BuiltInName::degrees,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpDegrees,
+ true);
+constexpr const TFunction kFunction_sin_0B(
+ BuiltInId::sin_Float1,
+ BuiltInName::sin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpSin,
+ true);
+constexpr const TFunction kFunction_sin_1B(
+ BuiltInId::sin_Float2,
+ BuiltInName::sin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpSin,
+ true);
+constexpr const TFunction kFunction_sin_2B(
+ BuiltInId::sin_Float3,
+ BuiltInName::sin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpSin,
+ true);
+constexpr const TFunction kFunction_sin_3B(
+ BuiltInId::sin_Float4,
+ BuiltInName::sin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpSin,
+ true);
+constexpr const TFunction kFunction_cos_0B(
+ BuiltInId::cos_Float1,
+ BuiltInName::cos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCos,
+ true);
+constexpr const TFunction kFunction_cos_1B(
+ BuiltInId::cos_Float2,
+ BuiltInName::cos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCos,
+ true);
+constexpr const TFunction kFunction_cos_2B(
+ BuiltInId::cos_Float3,
+ BuiltInName::cos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCos,
+ true);
+constexpr const TFunction kFunction_cos_3B(
+ BuiltInId::cos_Float4,
+ BuiltInName::cos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCos,
+ true);
+constexpr const TFunction kFunction_tan_0B(
+ BuiltInId::tan_Float1,
+ BuiltInName::tan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpTan,
+ true);
+constexpr const TFunction kFunction_tan_1B(
+ BuiltInId::tan_Float2,
+ BuiltInName::tan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpTan,
+ true);
+constexpr const TFunction kFunction_tan_2B(
+ BuiltInId::tan_Float3,
+ BuiltInName::tan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpTan,
+ true);
+constexpr const TFunction kFunction_tan_3B(
+ BuiltInId::tan_Float4,
+ BuiltInName::tan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpTan,
+ true);
+constexpr const TFunction kFunction_asin_0B(
+ BuiltInId::asin_Float1,
+ BuiltInName::asin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAsin,
+ true);
+constexpr const TFunction kFunction_asin_1B(
+ BuiltInId::asin_Float2,
+ BuiltInName::asin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAsin,
+ true);
+constexpr const TFunction kFunction_asin_2B(
+ BuiltInId::asin_Float3,
+ BuiltInName::asin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAsin,
+ true);
+constexpr const TFunction kFunction_asin_3B(
+ BuiltInId::asin_Float4,
+ BuiltInName::asin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAsin,
+ true);
+constexpr const TFunction kFunction_acos_0B(
+ BuiltInId::acos_Float1,
+ BuiltInName::acos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAcos,
+ true);
+constexpr const TFunction kFunction_acos_1B(
+ BuiltInId::acos_Float2,
+ BuiltInName::acos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAcos,
+ true);
+constexpr const TFunction kFunction_acos_2B(
+ BuiltInId::acos_Float3,
+ BuiltInName::acos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAcos,
+ true);
+constexpr const TFunction kFunction_acos_3B(
+ BuiltInId::acos_Float4,
+ BuiltInName::acos,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAcos,
+ true);
+constexpr const TFunction kFunction_atan_0B0B(
+ BuiltInId::atan_Float1_Float1,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_atan_1B1B(
+ BuiltInId::atan_Float2_Float2,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_atan_2B2B(
+ BuiltInId::atan_Float3_Float3,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_atan_3B3B(
+ BuiltInId::atan_Float4_Float4,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_atan_0B(
+ BuiltInId::atan_Float1,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_atan_1B(
+ BuiltInId::atan_Float2,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_atan_2B(
+ BuiltInId::atan_Float3,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_atan_3B(
+ BuiltInId::atan_Float4,
+ BuiltInName::atan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAtan,
+ true);
+constexpr const TFunction kFunction_sinh_0B(
+ BuiltInId::sinh_Float1,
+ BuiltInName::sinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpSinh,
+ true);
+constexpr const TFunction kFunction_sinh_1B(
+ BuiltInId::sinh_Float2,
+ BuiltInName::sinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpSinh,
+ true);
+constexpr const TFunction kFunction_sinh_2B(
+ BuiltInId::sinh_Float3,
+ BuiltInName::sinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpSinh,
+ true);
+constexpr const TFunction kFunction_sinh_3B(
+ BuiltInId::sinh_Float4,
+ BuiltInName::sinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpSinh,
+ true);
+constexpr const TFunction kFunction_cosh_0B(
+ BuiltInId::cosh_Float1,
+ BuiltInName::cosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCosh,
+ true);
+constexpr const TFunction kFunction_cosh_1B(
+ BuiltInId::cosh_Float2,
+ BuiltInName::cosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCosh,
+ true);
+constexpr const TFunction kFunction_cosh_2B(
+ BuiltInId::cosh_Float3,
+ BuiltInName::cosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCosh,
+ true);
+constexpr const TFunction kFunction_cosh_3B(
+ BuiltInId::cosh_Float4,
+ BuiltInName::cosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCosh,
+ true);
+constexpr const TFunction kFunction_tanh_0B(
+ BuiltInId::tanh_Float1,
+ BuiltInName::tanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpTanh,
+ true);
+constexpr const TFunction kFunction_tanh_1B(
+ BuiltInId::tanh_Float2,
+ BuiltInName::tanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpTanh,
+ true);
+constexpr const TFunction kFunction_tanh_2B(
+ BuiltInId::tanh_Float3,
+ BuiltInName::tanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpTanh,
+ true);
+constexpr const TFunction kFunction_tanh_3B(
+ BuiltInId::tanh_Float4,
+ BuiltInName::tanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpTanh,
+ true);
+constexpr const TFunction kFunction_asinh_0B(
+ BuiltInId::asinh_Float1,
+ BuiltInName::asinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAsinh,
+ true);
+constexpr const TFunction kFunction_asinh_1B(
+ BuiltInId::asinh_Float2,
+ BuiltInName::asinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAsinh,
+ true);
+constexpr const TFunction kFunction_asinh_2B(
+ BuiltInId::asinh_Float3,
+ BuiltInName::asinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAsinh,
+ true);
+constexpr const TFunction kFunction_asinh_3B(
+ BuiltInId::asinh_Float4,
+ BuiltInName::asinh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAsinh,
+ true);
+constexpr const TFunction kFunction_acosh_0B(
+ BuiltInId::acosh_Float1,
+ BuiltInName::acosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAcosh,
+ true);
+constexpr const TFunction kFunction_acosh_1B(
+ BuiltInId::acosh_Float2,
+ BuiltInName::acosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAcosh,
+ true);
+constexpr const TFunction kFunction_acosh_2B(
+ BuiltInId::acosh_Float3,
+ BuiltInName::acosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAcosh,
+ true);
+constexpr const TFunction kFunction_acosh_3B(
+ BuiltInId::acosh_Float4,
+ BuiltInName::acosh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAcosh,
+ true);
+constexpr const TFunction kFunction_atanh_0B(
+ BuiltInId::atanh_Float1,
+ BuiltInName::atanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtanh,
+ true);
+constexpr const TFunction kFunction_atanh_1B(
+ BuiltInId::atanh_Float2,
+ BuiltInName::atanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAtanh,
+ true);
+constexpr const TFunction kFunction_atanh_2B(
+ BuiltInId::atanh_Float3,
+ BuiltInName::atanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAtanh,
+ true);
+constexpr const TFunction kFunction_atanh_3B(
+ BuiltInId::atanh_Float4,
+ BuiltInName::atanh,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAtanh,
+ true);
+constexpr const TFunction kFunction_pow_0B0B(
+ BuiltInId::pow_Float1_Float1,
+ BuiltInName::pow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpPow,
+ true);
+constexpr const TFunction kFunction_pow_1B1B(
+ BuiltInId::pow_Float2_Float2,
+ BuiltInName::pow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpPow,
+ true);
+constexpr const TFunction kFunction_pow_2B2B(
+ BuiltInId::pow_Float3_Float3,
+ BuiltInName::pow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpPow,
+ true);
+constexpr const TFunction kFunction_pow_3B3B(
+ BuiltInId::pow_Float4_Float4,
+ BuiltInName::pow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpPow,
+ true);
+constexpr const TFunction kFunction_exp_0B(
+ BuiltInId::exp_Float1,
+ BuiltInName::exp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpExp,
+ true);
+constexpr const TFunction kFunction_exp_1B(
+ BuiltInId::exp_Float2,
+ BuiltInName::exp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpExp,
+ true);
+constexpr const TFunction kFunction_exp_2B(
+ BuiltInId::exp_Float3,
+ BuiltInName::exp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpExp,
+ true);
+constexpr const TFunction kFunction_exp_3B(
+ BuiltInId::exp_Float4,
+ BuiltInName::exp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpExp,
+ true);
+constexpr const TFunction kFunction_log_0B(
+ BuiltInId::log_Float1,
+ BuiltInName::log,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpLog,
+ true);
+constexpr const TFunction kFunction_log_1B(
+ BuiltInId::log_Float2,
+ BuiltInName::log,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLog,
+ true);
+constexpr const TFunction kFunction_log_2B(
+ BuiltInId::log_Float3,
+ BuiltInName::log,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLog,
+ true);
+constexpr const TFunction kFunction_log_3B(
+ BuiltInId::log_Float4,
+ BuiltInName::log,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLog,
+ true);
+constexpr const TFunction kFunction_exp2_0B(
+ BuiltInId::exp2_Float1,
+ BuiltInName::exp2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpExp2,
+ true);
+constexpr const TFunction kFunction_exp2_1B(
+ BuiltInId::exp2_Float2,
+ BuiltInName::exp2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpExp2,
+ true);
+constexpr const TFunction kFunction_exp2_2B(
+ BuiltInId::exp2_Float3,
+ BuiltInName::exp2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpExp2,
+ true);
+constexpr const TFunction kFunction_exp2_3B(
+ BuiltInId::exp2_Float4,
+ BuiltInName::exp2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpExp2,
+ true);
+constexpr const TFunction kFunction_log2_0B(
+ BuiltInId::log2_Float1,
+ BuiltInName::log2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpLog2,
+ true);
+constexpr const TFunction kFunction_log2_1B(
+ BuiltInId::log2_Float2,
+ BuiltInName::log2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLog2,
+ true);
+constexpr const TFunction kFunction_log2_2B(
+ BuiltInId::log2_Float3,
+ BuiltInName::log2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLog2,
+ true);
+constexpr const TFunction kFunction_log2_3B(
+ BuiltInId::log2_Float4,
+ BuiltInName::log2,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLog2,
+ true);
+constexpr const TFunction kFunction_sqrt_0B(
+ BuiltInId::sqrt_Float1,
+ BuiltInName::sqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpSqrt,
+ true);
+constexpr const TFunction kFunction_sqrt_1B(
+ BuiltInId::sqrt_Float2,
+ BuiltInName::sqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpSqrt,
+ true);
+constexpr const TFunction kFunction_sqrt_2B(
+ BuiltInId::sqrt_Float3,
+ BuiltInName::sqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpSqrt,
+ true);
+constexpr const TFunction kFunction_sqrt_3B(
+ BuiltInId::sqrt_Float4,
+ BuiltInName::sqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpSqrt,
+ true);
+constexpr const TFunction kFunction_inversesqrt_0B(
+ BuiltInId::inversesqrt_Float1,
+ BuiltInName::inversesqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpInversesqrt,
+ true);
+constexpr const TFunction kFunction_inversesqrt_1B(
+ BuiltInId::inversesqrt_Float2,
+ BuiltInName::inversesqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpInversesqrt,
+ true);
+constexpr const TFunction kFunction_inversesqrt_2B(
+ BuiltInId::inversesqrt_Float3,
+ BuiltInName::inversesqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpInversesqrt,
+ true);
+constexpr const TFunction kFunction_inversesqrt_3B(
+ BuiltInId::inversesqrt_Float4,
+ BuiltInName::inversesqrt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpInversesqrt,
+ true);
+constexpr const TFunction kFunction_abs_0B(
+ BuiltInId::abs_Float1,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_abs_1B(
+ BuiltInId::abs_Float2,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_abs_2B(
+ BuiltInId::abs_Float3,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_abs_3B(
+ BuiltInId::abs_Float4,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_abs_0C(BuiltInId::abs_Int1,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_abs_1C(BuiltInId::abs_Int2,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_abs_2C(BuiltInId::abs_Int3,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_abs_3C(BuiltInId::abs_Int4,
+ BuiltInName::abs,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpAbs,
+ true);
+constexpr const TFunction kFunction_sign_0B(
+ BuiltInId::sign_Float1,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_sign_1B(
+ BuiltInId::sign_Float2,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_sign_2B(
+ BuiltInId::sign_Float3,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_sign_3B(
+ BuiltInId::sign_Float4,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_sign_0C(
+ BuiltInId::sign_Int1,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_sign_1C(
+ BuiltInId::sign_Int2,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_sign_2C(
+ BuiltInId::sign_Int3,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_sign_3C(
+ BuiltInId::sign_Int4,
+ BuiltInName::sign,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpSign,
+ true);
+constexpr const TFunction kFunction_floor_0B(
+ BuiltInId::floor_Float1,
+ BuiltInName::floor,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFloor,
+ true);
+constexpr const TFunction kFunction_floor_1B(
+ BuiltInId::floor_Float2,
+ BuiltInName::floor,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFloor,
+ true);
+constexpr const TFunction kFunction_floor_2B(
+ BuiltInId::floor_Float3,
+ BuiltInName::floor,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFloor,
+ true);
+constexpr const TFunction kFunction_floor_3B(
+ BuiltInId::floor_Float4,
+ BuiltInName::floor,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFloor,
+ true);
+constexpr const TFunction kFunction_trunc_0B(
+ BuiltInId::trunc_Float1,
+ BuiltInName::trunc,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpTrunc,
+ true);
+constexpr const TFunction kFunction_trunc_1B(
+ BuiltInId::trunc_Float2,
+ BuiltInName::trunc,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpTrunc,
+ true);
+constexpr const TFunction kFunction_trunc_2B(
+ BuiltInId::trunc_Float3,
+ BuiltInName::trunc,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpTrunc,
+ true);
+constexpr const TFunction kFunction_trunc_3B(
+ BuiltInId::trunc_Float4,
+ BuiltInName::trunc,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpTrunc,
+ true);
+constexpr const TFunction kFunction_round_0B(
+ BuiltInId::round_Float1,
+ BuiltInName::round,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpRound,
+ true);
+constexpr const TFunction kFunction_round_1B(
+ BuiltInId::round_Float2,
+ BuiltInName::round,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpRound,
+ true);
+constexpr const TFunction kFunction_round_2B(
+ BuiltInId::round_Float3,
+ BuiltInName::round,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpRound,
+ true);
+constexpr const TFunction kFunction_round_3B(
+ BuiltInId::round_Float4,
+ BuiltInName::round,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpRound,
+ true);
+constexpr const TFunction kFunction_roundEven_0B(
+ BuiltInId::roundEven_Float1,
+ BuiltInName::roundEven,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpRoundEven,
+ true);
+constexpr const TFunction kFunction_roundEven_1B(
+ BuiltInId::roundEven_Float2,
+ BuiltInName::roundEven,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpRoundEven,
+ true);
+constexpr const TFunction kFunction_roundEven_2B(
+ BuiltInId::roundEven_Float3,
+ BuiltInName::roundEven,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpRoundEven,
+ true);
+constexpr const TFunction kFunction_roundEven_3B(
+ BuiltInId::roundEven_Float4,
+ BuiltInName::roundEven,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpRoundEven,
+ true);
+constexpr const TFunction kFunction_ceil_0B(
+ BuiltInId::ceil_Float1,
+ BuiltInName::ceil,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCeil,
+ true);
+constexpr const TFunction kFunction_ceil_1B(
+ BuiltInId::ceil_Float2,
+ BuiltInName::ceil,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCeil,
+ true);
+constexpr const TFunction kFunction_ceil_2B(
+ BuiltInId::ceil_Float3,
+ BuiltInName::ceil,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCeil,
+ true);
+constexpr const TFunction kFunction_ceil_3B(
+ BuiltInId::ceil_Float4,
+ BuiltInName::ceil,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCeil,
+ true);
+constexpr const TFunction kFunction_fract_0B(
+ BuiltInId::fract_Float1,
+ BuiltInName::fract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFract,
+ true);
+constexpr const TFunction kFunction_fract_1B(
+ BuiltInId::fract_Float2,
+ BuiltInName::fract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFract,
+ true);
+constexpr const TFunction kFunction_fract_2B(
+ BuiltInId::fract_Float3,
+ BuiltInName::fract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFract,
+ true);
+constexpr const TFunction kFunction_fract_3B(
+ BuiltInId::fract_Float4,
+ BuiltInName::fract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFract,
+ true);
+constexpr const TFunction kFunction_mod_0B0B(
+ BuiltInId::mod_Float1_Float1,
+ BuiltInName::mod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMod,
+ true);
+constexpr const TFunction kFunction_mod_1B0B(
+ BuiltInId::mod_Float2_Float1,
+ BuiltInName::mod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMod,
+ true);
+constexpr const TFunction kFunction_mod_2B0B(
+ BuiltInId::mod_Float3_Float1,
+ BuiltInName::mod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMod,
+ true);
+constexpr const TFunction kFunction_mod_3B0B(
+ BuiltInId::mod_Float4_Float1,
+ BuiltInName::mod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMod,
+ true);
+constexpr const TFunction kFunction_mod_1B1B(
+ BuiltInId::mod_Float2_Float2,
+ BuiltInName::mod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMod,
+ true);
+constexpr const TFunction kFunction_mod_2B2B(
+ BuiltInId::mod_Float3_Float3,
+ BuiltInName::mod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMod,
+ true);
+constexpr const TFunction kFunction_mod_3B3B(
+ BuiltInId::mod_Float4_Float4,
+ BuiltInName::mod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMod,
+ true);
+constexpr const TFunction kFunction_min_0B0B(
+ BuiltInId::min_Float1_Float1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_1B0B(
+ BuiltInId::min_Float2_Float1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_2B0B(
+ BuiltInId::min_Float3_Float1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_3B0B(
+ BuiltInId::min_Float4_Float1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_1B1B(
+ BuiltInId::min_Float2_Float2,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_2B2B(
+ BuiltInId::min_Float3_Float3,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_3B3B(
+ BuiltInId::min_Float4_Float4,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_0C0C(
+ BuiltInId::min_Int1_Int1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_1C1C(
+ BuiltInId::min_Int2_Int2,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_2C2C(
+ BuiltInId::min_Int3_Int3,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_3C3C(
+ BuiltInId::min_Int4_Int4,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_1C0C(
+ BuiltInId::min_Int2_Int1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_2C0C(
+ BuiltInId::min_Int3_Int1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_3C0C(
+ BuiltInId::min_Int4_Int1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_0D0D(
+ BuiltInId::min_UInt1_UInt1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_1D1D(
+ BuiltInId::min_UInt2_UInt2,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_2D2D(
+ BuiltInId::min_UInt3_UInt3,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_3D3D(
+ BuiltInId::min_UInt4_UInt4,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_1D0D(
+ BuiltInId::min_UInt2_UInt1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_2D0D(
+ BuiltInId::min_UInt3_UInt1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_min_3D0D(
+ BuiltInId::min_UInt4_UInt1,
+ BuiltInName::min,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMin,
+ true);
+constexpr const TFunction kFunction_max_0B0B(
+ BuiltInId::max_Float1_Float1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_1B0B(
+ BuiltInId::max_Float2_Float1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_2B0B(
+ BuiltInId::max_Float3_Float1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_3B0B(
+ BuiltInId::max_Float4_Float1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_1B1B(
+ BuiltInId::max_Float2_Float2,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_2B2B(
+ BuiltInId::max_Float3_Float3,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_3B3B(
+ BuiltInId::max_Float4_Float4,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_0C0C(
+ BuiltInId::max_Int1_Int1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_1C1C(
+ BuiltInId::max_Int2_Int2,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_2C2C(
+ BuiltInId::max_Int3_Int3,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_3C3C(
+ BuiltInId::max_Int4_Int4,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_1C0C(
+ BuiltInId::max_Int2_Int1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_2C0C(
+ BuiltInId::max_Int3_Int1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_3C0C(
+ BuiltInId::max_Int4_Int1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_0D0D(
+ BuiltInId::max_UInt1_UInt1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_1D1D(
+ BuiltInId::max_UInt2_UInt2,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_2D2D(
+ BuiltInId::max_UInt3_UInt3,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_3D3D(
+ BuiltInId::max_UInt4_UInt4,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_1D0D(
+ BuiltInId::max_UInt2_UInt1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_2D0D(
+ BuiltInId::max_UInt3_UInt1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_max_3D0D(
+ BuiltInId::max_UInt4_UInt1,
+ BuiltInName::max,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMax,
+ true);
+constexpr const TFunction kFunction_clamp_0B0B0B(
+ BuiltInId::clamp_Float1_Float1_Float1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_1B0B0B(
+ BuiltInId::clamp_Float2_Float1_Float1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_2B0B0B(
+ BuiltInId::clamp_Float3_Float1_Float1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_3B0B0B(
+ BuiltInId::clamp_Float4_Float1_Float1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_1B1B1B(
+ BuiltInId::clamp_Float2_Float2_Float2,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B1B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_2B2B2B(
+ BuiltInId::clamp_Float3_Float3_Float3,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B2B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_3B3B3B(
+ BuiltInId::clamp_Float4_Float4_Float4,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B3B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_0C0C0C(
+ BuiltInId::clamp_Int1_Int1_Int1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_1C0C0C(
+ BuiltInId::clamp_Int2_Int1_Int1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_2C0C0C(
+ BuiltInId::clamp_Int3_Int1_Int1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_3C0C0C(
+ BuiltInId::clamp_Int4_Int1_Int1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_1C1C1C(
+ BuiltInId::clamp_Int2_Int2_Int2,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_2C2C2C(
+ BuiltInId::clamp_Int3_Int3_Int3,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C2C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_3C3C3C(
+ BuiltInId::clamp_Int4_Int4_Int4,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_0D0D0D(
+ BuiltInId::clamp_UInt1_UInt1_UInt1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0D0D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_1D0D0D(
+ BuiltInId::clamp_UInt2_UInt1_UInt1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0D0D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_2D0D0D(
+ BuiltInId::clamp_UInt3_UInt1_UInt1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D0D0D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_3D0D0D(
+ BuiltInId::clamp_UInt4_UInt1_UInt1,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0D0D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_1D1D1D(
+ BuiltInId::clamp_UInt2_UInt2_UInt2,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D1D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_2D2D2D(
+ BuiltInId::clamp_UInt3_UInt3_UInt3,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D2D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_clamp_3D3D3D(
+ BuiltInId::clamp_UInt4_UInt4_UInt4,
+ BuiltInName::clamp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D3D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpClamp,
+ true);
+constexpr const TFunction kFunction_mix_0B0B0B(
+ BuiltInId::mix_Float1_Float1_Float1,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_1B1B0B(
+ BuiltInId::mix_Float2_Float2_Float1,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_2B2B0B(
+ BuiltInId::mix_Float3_Float3_Float1,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_3B3B0B(
+ BuiltInId::mix_Float4_Float4_Float1,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_1B1B1B(
+ BuiltInId::mix_Float2_Float2_Float2,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B1B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_2B2B2B(
+ BuiltInId::mix_Float3_Float3_Float3,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B2B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_3B3B3B(
+ BuiltInId::mix_Float4_Float4_Float4,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B3B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_0B0B0E(
+ BuiltInId::mix_Float1_Float1_Bool1,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B0E,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_1B1B1E(
+ BuiltInId::mix_Float2_Float2_Bool2,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B1E,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_2B2B2E(
+ BuiltInId::mix_Float3_Float3_Bool3,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B2E,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_mix_3B3B3E(
+ BuiltInId::mix_Float4_Float4_Bool4,
+ BuiltInName::mix,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B3E,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpMix,
+ true);
+constexpr const TFunction kFunction_step_0B0B(
+ BuiltInId::step_Float1_Float1,
+ BuiltInName::step,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpStep,
+ true);
+constexpr const TFunction kFunction_step_1B1B(
+ BuiltInId::step_Float2_Float2,
+ BuiltInName::step,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpStep,
+ true);
+constexpr const TFunction kFunction_step_2B2B(
+ BuiltInId::step_Float3_Float3,
+ BuiltInName::step,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpStep,
+ true);
+constexpr const TFunction kFunction_step_3B3B(
+ BuiltInId::step_Float4_Float4,
+ BuiltInName::step,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpStep,
+ true);
+constexpr const TFunction kFunction_step_0B1B(
+ BuiltInId::step_Float1_Float2,
+ BuiltInName::step,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpStep,
+ true);
+constexpr const TFunction kFunction_step_0B2B(
+ BuiltInId::step_Float1_Float3,
+ BuiltInName::step,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpStep,
+ true);
+constexpr const TFunction kFunction_step_0B3B(
+ BuiltInId::step_Float1_Float4,
+ BuiltInName::step,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpStep,
+ true);
+constexpr const TFunction kFunction_smoothstep_0B0B0B(
+ BuiltInId::smoothstep_Float1_Float1_Float1,
+ BuiltInName::smoothstep,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpSmoothstep,
+ true);
+constexpr const TFunction kFunction_smoothstep_1B1B1B(
+ BuiltInId::smoothstep_Float2_Float2_Float2,
+ BuiltInName::smoothstep,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B1B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpSmoothstep,
+ true);
+constexpr const TFunction kFunction_smoothstep_2B2B2B(
+ BuiltInId::smoothstep_Float3_Float3_Float3,
+ BuiltInName::smoothstep,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B2B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpSmoothstep,
+ true);
+constexpr const TFunction kFunction_smoothstep_3B3B3B(
+ BuiltInId::smoothstep_Float4_Float4_Float4,
+ BuiltInName::smoothstep,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B3B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpSmoothstep,
+ true);
+constexpr const TFunction kFunction_smoothstep_0B0B1B(
+ BuiltInId::smoothstep_Float1_Float1_Float2,
+ BuiltInName::smoothstep,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpSmoothstep,
+ true);
+constexpr const TFunction kFunction_smoothstep_0B0B2B(
+ BuiltInId::smoothstep_Float1_Float1_Float3,
+ BuiltInName::smoothstep,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B2B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpSmoothstep,
+ true);
+constexpr const TFunction kFunction_smoothstep_0B0B3B(
+ BuiltInId::smoothstep_Float1_Float1_Float4,
+ BuiltInName::smoothstep,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B3B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpSmoothstep,
+ true);
+constexpr const TFunction kFunction_modf_0B0B(
+ BuiltInId::modf_Float1_Float1,
+ BuiltInName::modf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B_o_0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpModf,
+ false);
+constexpr const TFunction kFunction_modf_1B1B(
+ BuiltInId::modf_Float2_Float2,
+ BuiltInName::modf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B_o_1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpModf,
+ false);
+constexpr const TFunction kFunction_modf_2B2B(
+ BuiltInId::modf_Float3_Float3,
+ BuiltInName::modf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpModf,
+ false);
+constexpr const TFunction kFunction_modf_3B3B(
+ BuiltInId::modf_Float4_Float4,
+ BuiltInName::modf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B_o_3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpModf,
+ false);
+constexpr const TFunction kFunction_isnan_0B(
+ BuiltInId::isnan_Float1,
+ BuiltInName::isnan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpIsnan,
+ true);
+constexpr const TFunction kFunction_isnan_1B(
+ BuiltInId::isnan_Float2,
+ BuiltInName::isnan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpIsnan,
+ true);
+constexpr const TFunction kFunction_isnan_2B(
+ BuiltInId::isnan_Float3,
+ BuiltInName::isnan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpIsnan,
+ true);
+constexpr const TFunction kFunction_isnan_3B(
+ BuiltInId::isnan_Float4,
+ BuiltInName::isnan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpIsnan,
+ true);
+constexpr const TFunction kFunction_isinf_0B(
+ BuiltInId::isinf_Float1,
+ BuiltInName::isinf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpIsinf,
+ true);
+constexpr const TFunction kFunction_isinf_1B(
+ BuiltInId::isinf_Float2,
+ BuiltInName::isinf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpIsinf,
+ true);
+constexpr const TFunction kFunction_isinf_2B(
+ BuiltInId::isinf_Float3,
+ BuiltInName::isinf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpIsinf,
+ true);
+constexpr const TFunction kFunction_isinf_3B(
+ BuiltInId::isinf_Float4,
+ BuiltInName::isinf,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpIsinf,
+ true);
+constexpr const TFunction kFunction_floatBitsToInt_0B(
+ BuiltInId::floatBitsToInt_Float1,
+ BuiltInName::floatBitsToInt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFloatBitsToInt,
+ true);
+constexpr const TFunction kFunction_floatBitsToInt_1B(
+ BuiltInId::floatBitsToInt_Float2,
+ BuiltInName::floatBitsToInt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFloatBitsToInt,
+ true);
+constexpr const TFunction kFunction_floatBitsToInt_2B(
+ BuiltInId::floatBitsToInt_Float3,
+ BuiltInName::floatBitsToInt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFloatBitsToInt,
+ true);
+constexpr const TFunction kFunction_floatBitsToInt_3B(
+ BuiltInId::floatBitsToInt_Float4,
+ BuiltInName::floatBitsToInt,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFloatBitsToInt,
+ true);
+constexpr const TFunction kFunction_floatBitsToUint_0B(
+ BuiltInId::floatBitsToUint_Float1,
+ BuiltInName::floatBitsToUint,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFloatBitsToUint,
+ true);
+constexpr const TFunction kFunction_floatBitsToUint_1B(
+ BuiltInId::floatBitsToUint_Float2,
+ BuiltInName::floatBitsToUint,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFloatBitsToUint,
+ true);
+constexpr const TFunction kFunction_floatBitsToUint_2B(
+ BuiltInId::floatBitsToUint_Float3,
+ BuiltInName::floatBitsToUint,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFloatBitsToUint,
+ true);
+constexpr const TFunction kFunction_floatBitsToUint_3B(
+ BuiltInId::floatBitsToUint_Float4,
+ BuiltInName::floatBitsToUint,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFloatBitsToUint,
+ true);
+constexpr const TFunction kFunction_intBitsToFloat_0C(
+ BuiltInId::intBitsToFloat_Int1,
+ BuiltInName::intBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpIntBitsToFloat,
+ true);
+constexpr const TFunction kFunction_intBitsToFloat_1C(
+ BuiltInId::intBitsToFloat_Int2,
+ BuiltInName::intBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpIntBitsToFloat,
+ true);
+constexpr const TFunction kFunction_intBitsToFloat_2C(
+ BuiltInId::intBitsToFloat_Int3,
+ BuiltInName::intBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpIntBitsToFloat,
+ true);
+constexpr const TFunction kFunction_intBitsToFloat_3C(
+ BuiltInId::intBitsToFloat_Int4,
+ BuiltInName::intBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpIntBitsToFloat,
+ true);
+constexpr const TFunction kFunction_uintBitsToFloat_0D(
+ BuiltInId::uintBitsToFloat_UInt1,
+ BuiltInName::uintBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpUintBitsToFloat,
+ true);
+constexpr const TFunction kFunction_uintBitsToFloat_1D(
+ BuiltInId::uintBitsToFloat_UInt2,
+ BuiltInName::uintBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpUintBitsToFloat,
+ true);
+constexpr const TFunction kFunction_uintBitsToFloat_2D(
+ BuiltInId::uintBitsToFloat_UInt3,
+ BuiltInName::uintBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpUintBitsToFloat,
+ true);
+constexpr const TFunction kFunction_uintBitsToFloat_3D(
+ BuiltInId::uintBitsToFloat_UInt4,
+ BuiltInName::uintBitsToFloat,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpUintBitsToFloat,
+ true);
+constexpr const TFunction kFunction_frexp_0B0C(
+ BuiltInId::frexp_Float1_Int1,
+ BuiltInName::frexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B_o_0C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFrexp,
+ false);
+constexpr const TFunction kFunction_frexp_1B1C(
+ BuiltInId::frexp_Float2_Int2,
+ BuiltInName::frexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B_o_1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFrexp,
+ false);
+constexpr const TFunction kFunction_frexp_2B2C(
+ BuiltInId::frexp_Float3_Int3,
+ BuiltInName::frexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFrexp,
+ false);
+constexpr const TFunction kFunction_frexp_3B3C(
+ BuiltInId::frexp_Float4_Int4,
+ BuiltInName::frexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B_o_3C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFrexp,
+ false);
+constexpr const TFunction kFunction_ldexp_0B0C(
+ BuiltInId::ldexp_Float1_Int1,
+ BuiltInName::ldexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpLdexp,
+ true);
+constexpr const TFunction kFunction_ldexp_1B1C(
+ BuiltInId::ldexp_Float2_Int2,
+ BuiltInName::ldexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLdexp,
+ true);
+constexpr const TFunction kFunction_ldexp_2B2C(
+ BuiltInId::ldexp_Float3_Int3,
+ BuiltInName::ldexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLdexp,
+ true);
+constexpr const TFunction kFunction_ldexp_3B3C(
+ BuiltInId::ldexp_Float4_Int4,
+ BuiltInName::ldexp,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLdexp,
+ true);
+constexpr const TFunction kFunction_packSnorm2x16_1B(
+ BuiltInId::packSnorm2x16_Float2,
+ BuiltInName::packSnorm2x16,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpPackSnorm2x16,
+ true);
+constexpr const TFunction kFunction_packUnorm2x16_1B(
+ BuiltInId::packUnorm2x16_Float2,
+ BuiltInName::packUnorm2x16,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpPackUnorm2x16,
+ true);
+constexpr const TFunction kFunction_packHalf2x16_1B(
+ BuiltInId::packHalf2x16_Float2,
+ BuiltInName::packHalf2x16,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpPackHalf2x16,
+ true);
+constexpr const TFunction kFunction_unpackSnorm2x16_0D(
+ BuiltInId::unpackSnorm2x16_UInt1,
+ BuiltInName::unpackSnorm2x16,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpUnpackSnorm2x16,
+ true);
+constexpr const TFunction kFunction_unpackUnorm2x16_0D(
+ BuiltInId::unpackUnorm2x16_UInt1,
+ BuiltInName::unpackUnorm2x16,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpUnpackUnorm2x16,
+ true);
+constexpr const TFunction kFunction_unpackHalf2x16_0D(
+ BuiltInId::unpackHalf2x16_UInt1,
+ BuiltInName::unpackHalf2x16,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpUnpackHalf2x16,
+ true);
+constexpr const TFunction kFunction_packUnorm4x8_3B(
+ BuiltInId::packUnorm4x8_Float4,
+ BuiltInName::packUnorm4x8,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpPackUnorm4x8,
+ true);
+constexpr const TFunction kFunction_packSnorm4x8_3B(
+ BuiltInId::packSnorm4x8_Float4,
+ BuiltInName::packSnorm4x8,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpPackSnorm4x8,
+ true);
+constexpr const TFunction kFunction_unpackUnorm4x8_0D(
+ BuiltInId::unpackUnorm4x8_UInt1,
+ BuiltInName::unpackUnorm4x8,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpUnpackUnorm4x8,
+ true);
+constexpr const TFunction kFunction_unpackSnorm4x8_0D(
+ BuiltInId::unpackSnorm4x8_UInt1,
+ BuiltInName::unpackSnorm4x8,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpUnpackSnorm4x8,
+ true);
+constexpr const TFunction kFunction_length_0B(
+ BuiltInId::length_Float1,
+ BuiltInName::length,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpLength,
+ true);
+constexpr const TFunction kFunction_length_1B(
+ BuiltInId::length_Float2,
+ BuiltInName::length,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpLength,
+ true);
+constexpr const TFunction kFunction_length_2B(
+ BuiltInId::length_Float3,
+ BuiltInName::length,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpLength,
+ true);
+constexpr const TFunction kFunction_length_3B(
+ BuiltInId::length_Float4,
+ BuiltInName::length,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpLength,
+ true);
+constexpr const TFunction kFunction_distance_0B0B(
+ BuiltInId::distance_Float1_Float1,
+ BuiltInName::distance,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDistance,
+ true);
+constexpr const TFunction kFunction_distance_1B1B(
+ BuiltInId::distance_Float2_Float2,
+ BuiltInName::distance,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDistance,
+ true);
+constexpr const TFunction kFunction_distance_2B2B(
+ BuiltInId::distance_Float3_Float3,
+ BuiltInName::distance,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDistance,
+ true);
+constexpr const TFunction kFunction_distance_3B3B(
+ BuiltInId::distance_Float4_Float4,
+ BuiltInName::distance,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDistance,
+ true);
+constexpr const TFunction kFunction_dot_0B0B(
+ BuiltInId::dot_Float1_Float1,
+ BuiltInName::dot,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDot,
+ true);
+constexpr const TFunction kFunction_dot_1B1B(
+ BuiltInId::dot_Float2_Float2,
+ BuiltInName::dot,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDot,
+ true);
+constexpr const TFunction kFunction_dot_2B2B(
+ BuiltInId::dot_Float3_Float3,
+ BuiltInName::dot,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDot,
+ true);
+constexpr const TFunction kFunction_dot_3B3B(
+ BuiltInId::dot_Float4_Float4,
+ BuiltInName::dot,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDot,
+ true);
+constexpr const TFunction kFunction_cross_2B2B(
+ BuiltInId::cross_Float3_Float3,
+ BuiltInName::cross,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCross,
+ true);
+constexpr const TFunction kFunction_normalize_0B(
+ BuiltInId::normalize_Float1,
+ BuiltInName::normalize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpNormalize,
+ true);
+constexpr const TFunction kFunction_normalize_1B(
+ BuiltInId::normalize_Float2,
+ BuiltInName::normalize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpNormalize,
+ true);
+constexpr const TFunction kFunction_normalize_2B(
+ BuiltInId::normalize_Float3,
+ BuiltInName::normalize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpNormalize,
+ true);
+constexpr const TFunction kFunction_normalize_3B(
+ BuiltInId::normalize_Float4,
+ BuiltInName::normalize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpNormalize,
+ true);
+constexpr const TFunction kFunction_faceforward_0B0B0B(
+ BuiltInId::faceforward_Float1_Float1_Float1,
+ BuiltInName::faceforward,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFaceforward,
+ true);
+constexpr const TFunction kFunction_faceforward_1B1B1B(
+ BuiltInId::faceforward_Float2_Float2_Float2,
+ BuiltInName::faceforward,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B1B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFaceforward,
+ true);
+constexpr const TFunction kFunction_faceforward_2B2B2B(
+ BuiltInId::faceforward_Float3_Float3_Float3,
+ BuiltInName::faceforward,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B2B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFaceforward,
+ true);
+constexpr const TFunction kFunction_faceforward_3B3B3B(
+ BuiltInId::faceforward_Float4_Float4_Float4,
+ BuiltInName::faceforward,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B3B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFaceforward,
+ true);
+constexpr const TFunction kFunction_reflect_0B0B(
+ BuiltInId::reflect_Float1_Float1,
+ BuiltInName::reflect,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpReflect,
+ true);
+constexpr const TFunction kFunction_reflect_1B1B(
+ BuiltInId::reflect_Float2_Float2,
+ BuiltInName::reflect,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpReflect,
+ true);
+constexpr const TFunction kFunction_reflect_2B2B(
+ BuiltInId::reflect_Float3_Float3,
+ BuiltInName::reflect,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpReflect,
+ true);
+constexpr const TFunction kFunction_reflect_3B3B(
+ BuiltInId::reflect_Float4_Float4,
+ BuiltInName::reflect,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpReflect,
+ true);
+constexpr const TFunction kFunction_refract_0B0B0B(
+ BuiltInId::refract_Float1_Float1_Float1,
+ BuiltInName::refract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpRefract,
+ true);
+constexpr const TFunction kFunction_refract_1B1B0B(
+ BuiltInId::refract_Float2_Float2_Float1,
+ BuiltInName::refract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpRefract,
+ true);
+constexpr const TFunction kFunction_refract_2B2B0B(
+ BuiltInId::refract_Float3_Float3_Float1,
+ BuiltInName::refract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpRefract,
+ true);
+constexpr const TFunction kFunction_refract_3B3B0B(
+ BuiltInId::refract_Float4_Float4_Float1,
+ BuiltInName::refract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpRefract,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_5B5B(
+ BuiltInId::matrixCompMult_Float2x2_Float2x2,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p5B5B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 2>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_ABAB(
+ BuiltInId::matrixCompMult_Float3x3_Float3x3,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pABAB,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 3>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_FBFB(
+ BuiltInId::matrixCompMult_Float4x4_Float4x4,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pFBFB,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 4>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_9B9B(
+ BuiltInId::matrixCompMult_Float2x3_Float2x3,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p9B9B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 3>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_6B6B(
+ BuiltInId::matrixCompMult_Float3x2_Float3x2,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p6B6B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 2>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_DBDB(
+ BuiltInId::matrixCompMult_Float2x4_Float2x4,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pDBDB,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 4>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_7B7B(
+ BuiltInId::matrixCompMult_Float4x2_Float4x2,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p7B7B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 2>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_EBEB(
+ BuiltInId::matrixCompMult_Float3x4_Float3x4,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pEBEB,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 4>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_matrixCompMult_BBBB(
+ BuiltInId::matrixCompMult_Float4x3_Float4x3,
+ BuiltInName::matrixCompMult,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pBBBB,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 3>(),
+ EOpMulMatrixComponentWise,
+ true);
+constexpr const TFunction kFunction_outerProduct_1B1B(
+ BuiltInId::outerProduct_Float2_Float2,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 2>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_2B2B(
+ BuiltInId::outerProduct_Float3_Float3,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 3>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_3B3B(
+ BuiltInId::outerProduct_Float4_Float4,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 4>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_2B1B(
+ BuiltInId::outerProduct_Float3_Float2,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 3>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_1B2B(
+ BuiltInId::outerProduct_Float2_Float3,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 2>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_3B1B(
+ BuiltInId::outerProduct_Float4_Float2,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 4>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_1B3B(
+ BuiltInId::outerProduct_Float2_Float4,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 2>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_3B2B(
+ BuiltInId::outerProduct_Float4_Float3,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 4>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_outerProduct_2B3B(
+ BuiltInId::outerProduct_Float3_Float4,
+ BuiltInName::outerProduct,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 3>(),
+ EOpOuterProduct,
+ true);
+constexpr const TFunction kFunction_transpose_5B(
+ BuiltInId::transpose_Float2x2,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p5B5B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 2>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_AB(
+ BuiltInId::transpose_Float3x3,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pABAB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 3>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_FB(
+ BuiltInId::transpose_Float4x4,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pFBFB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 4>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_6B(
+ BuiltInId::transpose_Float3x2,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p6B6B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 3>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_9B(
+ BuiltInId::transpose_Float2x3,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p9B9B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 2>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_7B(
+ BuiltInId::transpose_Float4x2,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p7B7B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 4>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_DB(
+ BuiltInId::transpose_Float2x4,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pDBDB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 2>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_BB(
+ BuiltInId::transpose_Float4x3,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pBBBB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 4>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_transpose_EB(
+ BuiltInId::transpose_Float3x4,
+ BuiltInName::transpose,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pEBEB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 3>(),
+ EOpTranspose,
+ true);
+constexpr const TFunction kFunction_determinant_5B(
+ BuiltInId::determinant_Float2x2,
+ BuiltInName::determinant,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p5B5B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDeterminant,
+ true);
+constexpr const TFunction kFunction_determinant_AB(
+ BuiltInId::determinant_Float3x3,
+ BuiltInName::determinant,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pABAB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDeterminant,
+ true);
+constexpr const TFunction kFunction_determinant_FB(
+ BuiltInId::determinant_Float4x4,
+ BuiltInName::determinant,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pFBFB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDeterminant,
+ true);
+constexpr const TFunction kFunction_inverse_5B(
+ BuiltInId::inverse_Float2x2,
+ BuiltInName::inverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p5B5B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 2>(),
+ EOpInverse,
+ true);
+constexpr const TFunction kFunction_inverse_AB(
+ BuiltInId::inverse_Float3x3,
+ BuiltInName::inverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pABAB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 3>(),
+ EOpInverse,
+ true);
+constexpr const TFunction kFunction_inverse_FB(
+ BuiltInId::inverse_Float4x4,
+ BuiltInName::inverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::pFBFB,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 4>(),
+ EOpInverse,
+ true);
+constexpr const TFunction kFunction_lessThan_1B1B(
+ BuiltInId::lessThan_Float2_Float2,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_2B2B(
+ BuiltInId::lessThan_Float3_Float3,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_3B3B(
+ BuiltInId::lessThan_Float4_Float4,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_1C1C(
+ BuiltInId::lessThan_Int2_Int2,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_2C2C(
+ BuiltInId::lessThan_Int3_Int3,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_3C3C(
+ BuiltInId::lessThan_Int4_Int4,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_1D1D(
+ BuiltInId::lessThan_UInt2_UInt2,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_2D2D(
+ BuiltInId::lessThan_UInt3_UInt3,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThan_3D3D(
+ BuiltInId::lessThan_UInt4_UInt4,
+ BuiltInName::lessThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLessThanComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_1B1B(
+ BuiltInId::lessThanEqual_Float2_Float2,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_2B2B(
+ BuiltInId::lessThanEqual_Float3_Float3,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_3B3B(
+ BuiltInId::lessThanEqual_Float4_Float4,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_1C1C(
+ BuiltInId::lessThanEqual_Int2_Int2,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_2C2C(
+ BuiltInId::lessThanEqual_Int3_Int3,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_3C3C(
+ BuiltInId::lessThanEqual_Int4_Int4,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_1D1D(
+ BuiltInId::lessThanEqual_UInt2_UInt2,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_2D2D(
+ BuiltInId::lessThanEqual_UInt3_UInt3,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_lessThanEqual_3D3D(
+ BuiltInId::lessThanEqual_UInt4_UInt4,
+ BuiltInName::lessThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLessThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_1B1B(
+ BuiltInId::greaterThan_Float2_Float2,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_2B2B(
+ BuiltInId::greaterThan_Float3_Float3,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_3B3B(
+ BuiltInId::greaterThan_Float4_Float4,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_1C1C(
+ BuiltInId::greaterThan_Int2_Int2,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_2C2C(
+ BuiltInId::greaterThan_Int3_Int3,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_3C3C(
+ BuiltInId::greaterThan_Int4_Int4,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_1D1D(
+ BuiltInId::greaterThan_UInt2_UInt2,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_2D2D(
+ BuiltInId::greaterThan_UInt3_UInt3,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThan_3D3D(
+ BuiltInId::greaterThan_UInt4_UInt4,
+ BuiltInName::greaterThan,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpGreaterThanComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_1B1B(
+ BuiltInId::greaterThanEqual_Float2_Float2,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_2B2B(
+ BuiltInId::greaterThanEqual_Float3_Float3,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_3B3B(
+ BuiltInId::greaterThanEqual_Float4_Float4,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_1C1C(
+ BuiltInId::greaterThanEqual_Int2_Int2,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_2C2C(
+ BuiltInId::greaterThanEqual_Int3_Int3,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_3C3C(
+ BuiltInId::greaterThanEqual_Int4_Int4,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_1D1D(
+ BuiltInId::greaterThanEqual_UInt2_UInt2,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_2D2D(
+ BuiltInId::greaterThanEqual_UInt3_UInt3,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_greaterThanEqual_3D3D(
+ BuiltInId::greaterThanEqual_UInt4_UInt4,
+ BuiltInName::greaterThanEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpGreaterThanEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_1B1B(
+ BuiltInId::equal_Float2_Float2,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_2B2B(
+ BuiltInId::equal_Float3_Float3,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_3B3B(
+ BuiltInId::equal_Float4_Float4,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_1C1C(
+ BuiltInId::equal_Int2_Int2,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_2C2C(
+ BuiltInId::equal_Int3_Int3,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_3C3C(
+ BuiltInId::equal_Int4_Int4,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_1D1D(
+ BuiltInId::equal_UInt2_UInt2,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_2D2D(
+ BuiltInId::equal_UInt3_UInt3,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_3D3D(
+ BuiltInId::equal_UInt4_UInt4,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_1E1E(
+ BuiltInId::equal_Bool2_Bool2,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1E1E,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_2E2E(
+ BuiltInId::equal_Bool3_Bool3,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2E2E,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_equal_3E3E(
+ BuiltInId::equal_Bool4_Bool4,
+ BuiltInName::equal,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3E3E,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_1B1B(
+ BuiltInId::notEqual_Float2_Float2,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_2B2B(
+ BuiltInId::notEqual_Float3_Float3,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B2B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_3B3B(
+ BuiltInId::notEqual_Float4_Float4,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B3B0B,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_1C1C(
+ BuiltInId::notEqual_Int2_Int2,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_2C2C(
+ BuiltInId::notEqual_Int3_Int3,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_3C3C(
+ BuiltInId::notEqual_Int4_Int4,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C3C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_1D1D(
+ BuiltInId::notEqual_UInt2_UInt2,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_2D2D(
+ BuiltInId::notEqual_UInt3_UInt3,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_3D3D(
+ BuiltInId::notEqual_UInt4_UInt4,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_1E1E(
+ BuiltInId::notEqual_Bool2_Bool2,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1E1E,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_2E2E(
+ BuiltInId::notEqual_Bool3_Bool3,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2E2E,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_notEqual_3E3E(
+ BuiltInId::notEqual_Bool4_Bool4,
+ BuiltInName::notEqual,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3E3E,
+ 2,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpNotEqualComponentWise,
+ true);
+constexpr const TFunction kFunction_any_1E(
+ BuiltInId::any_Bool2,
+ BuiltInName::any,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1E1E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAny,
+ true);
+constexpr const TFunction kFunction_any_2E(
+ BuiltInId::any_Bool3,
+ BuiltInName::any,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2E2E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAny,
+ true);
+constexpr const TFunction kFunction_any_3E(
+ BuiltInId::any_Bool4,
+ BuiltInName::any,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3E3E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAny,
+ true);
+constexpr const TFunction kFunction_all_1E(
+ BuiltInId::all_Bool2,
+ BuiltInName::all,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1E1E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAll,
+ true);
+constexpr const TFunction kFunction_all_2E(
+ BuiltInId::all_Bool3,
+ BuiltInName::all,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2E2E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAll,
+ true);
+constexpr const TFunction kFunction_all_3E(
+ BuiltInId::all_Bool4,
+ BuiltInName::all,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3E3E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAll,
+ true);
+constexpr const TFunction kFunction_notFunc_1E(
+ BuiltInId::notFunc_Bool2,
+ BuiltInName::notFunc,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1E1E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpLogicalNotComponentWise,
+ true);
+constexpr const TFunction kFunction_notFunc_2E(
+ BuiltInId::notFunc_Bool3,
+ BuiltInName::notFunc,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2E2E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpLogicalNotComponentWise,
+ true);
+constexpr const TFunction kFunction_notFunc_3E(
+ BuiltInId::notFunc_Bool4,
+ BuiltInName::notFunc,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3E3E,
+ 1,
+ StaticType::Get<EbtBool, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpLogicalNotComponentWise,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_0C0C0C(
+ BuiltInId::bitfieldExtract_Int1_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_1C0C0C(
+ BuiltInId::bitfieldExtract_Int2_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_2C0C0C(
+ BuiltInId::bitfieldExtract_Int3_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_3C0C0C(
+ BuiltInId::bitfieldExtract_Int4_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_0D0C0C(
+ BuiltInId::bitfieldExtract_UInt1_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_1D0C0C(
+ BuiltInId::bitfieldExtract_UInt2_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_2D0C0C(
+ BuiltInId::bitfieldExtract_UInt3_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D0C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldExtract_3D0C0C(
+ BuiltInId::bitfieldExtract_UInt4_Int1_Int1,
+ BuiltInName::bitfieldExtract,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitfieldExtract,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_0C0C0C0C(
+ BuiltInId::bitfieldInsert_Int1_Int1_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C0C0C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_1C1C0C0C(
+ BuiltInId::bitfieldInsert_Int2_Int2_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C0C0C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_2C2C0C0C(
+ BuiltInId::bitfieldInsert_Int3_Int3_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_3C3C0C0C(
+ BuiltInId::bitfieldInsert_Int4_Int4_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C0C0C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_0D0D0C0C(
+ BuiltInId::bitfieldInsert_UInt1_UInt1_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0D0C0C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_1D1D0C0C(
+ BuiltInId::bitfieldInsert_UInt2_UInt2_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D0C0C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_2D2D0C0C(
+ BuiltInId::bitfieldInsert_UInt3_UInt3_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldInsert_3D3D0C0C(
+ BuiltInId::bitfieldInsert_UInt4_UInt4_Int1_Int1,
+ BuiltInName::bitfieldInsert,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D0C0C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitfieldInsert,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_0C(
+ BuiltInId::bitfieldReverse_Int1,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_1C(
+ BuiltInId::bitfieldReverse_Int2,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_2C(
+ BuiltInId::bitfieldReverse_Int3,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_3C(
+ BuiltInId::bitfieldReverse_Int4,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_0D(
+ BuiltInId::bitfieldReverse_UInt1,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_1D(
+ BuiltInId::bitfieldReverse_UInt2,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0C0C,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_2D(
+ BuiltInId::bitfieldReverse_UInt3,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitfieldReverse_3D(
+ BuiltInId::bitfieldReverse_UInt4,
+ BuiltInName::bitfieldReverse,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0C0C,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitfieldReverse,
+ true);
+constexpr const TFunction kFunction_bitCount_0C(
+ BuiltInId::bitCount_Int1,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_bitCount_1C(
+ BuiltInId::bitCount_Int2,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_bitCount_2C(
+ BuiltInId::bitCount_Int3,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_bitCount_3C(
+ BuiltInId::bitCount_Int4,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_bitCount_0D(
+ BuiltInId::bitCount_UInt1,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_bitCount_1D(
+ BuiltInId::bitCount_UInt2,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_bitCount_2D(
+ BuiltInId::bitCount_UInt3,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_bitCount_3D(
+ BuiltInId::bitCount_UInt4,
+ BuiltInName::bitCount,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpBitCount,
+ true);
+constexpr const TFunction kFunction_findLSB_0C(
+ BuiltInId::findLSB_Int1,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findLSB_1C(
+ BuiltInId::findLSB_Int2,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findLSB_2C(
+ BuiltInId::findLSB_Int3,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findLSB_3C(
+ BuiltInId::findLSB_Int4,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findLSB_0D(
+ BuiltInId::findLSB_UInt1,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findLSB_1D(
+ BuiltInId::findLSB_UInt2,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findLSB_2D(
+ BuiltInId::findLSB_UInt3,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findLSB_3D(
+ BuiltInId::findLSB_UInt4,
+ BuiltInName::findLSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFindLSB,
+ true);
+constexpr const TFunction kFunction_findMSB_0C(
+ BuiltInId::findMSB_Int1,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_findMSB_1C(
+ BuiltInId::findMSB_Int2,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_findMSB_2C(
+ BuiltInId::findMSB_Int3,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_findMSB_3C(
+ BuiltInId::findMSB_Int4,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_findMSB_0D(
+ BuiltInId::findMSB_UInt1,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_findMSB_1D(
+ BuiltInId::findMSB_UInt2,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_findMSB_2D(
+ BuiltInId::findMSB_UInt3,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_findMSB_3D(
+ BuiltInId::findMSB_UInt4,
+ BuiltInName::findMSB,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D0C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFindMSB,
+ true);
+constexpr const TFunction kFunction_uaddCarry_0D0D0D(
+ BuiltInId::uaddCarry_UInt1_UInt1_UInt1,
+ BuiltInName::uaddCarry,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0D_o_0D_o_0D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpUaddCarry,
+ false);
+constexpr const TFunction kFunction_uaddCarry_1D1D1D(
+ BuiltInId::uaddCarry_UInt2_UInt2_UInt2,
+ BuiltInName::uaddCarry,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D_o_1D_o_1D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpUaddCarry,
+ false);
+constexpr const TFunction kFunction_uaddCarry_2D2D2D(
+ BuiltInId::uaddCarry_UInt3_UInt3_UInt3,
+ BuiltInName::uaddCarry,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D_o_2D_o_2D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpUaddCarry,
+ false);
+constexpr const TFunction kFunction_uaddCarry_3D3D3D(
+ BuiltInId::uaddCarry_UInt4_UInt4_UInt4,
+ BuiltInName::uaddCarry,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D_o_3D_o_3D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpUaddCarry,
+ false);
+constexpr const TFunction kFunction_usubBorrow_0D0D0D(
+ BuiltInId::usubBorrow_UInt1_UInt1_UInt1,
+ BuiltInName::usubBorrow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0D_o_0D_o_0D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpUsubBorrow,
+ false);
+constexpr const TFunction kFunction_usubBorrow_1D1D1D(
+ BuiltInId::usubBorrow_UInt2_UInt2_UInt2,
+ BuiltInName::usubBorrow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D_o_1D_o_1D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpUsubBorrow,
+ false);
+constexpr const TFunction kFunction_usubBorrow_2D2D2D(
+ BuiltInId::usubBorrow_UInt3_UInt3_UInt3,
+ BuiltInName::usubBorrow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D_o_2D_o_2D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpUsubBorrow,
+ false);
+constexpr const TFunction kFunction_usubBorrow_3D3D3D(
+ BuiltInId::usubBorrow_UInt4_UInt4_UInt4,
+ BuiltInName::usubBorrow,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D_o_3D_o_3D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpUsubBorrow,
+ false);
+constexpr const TFunction kFunction_umulExtended_0D0D0D0D(
+ BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1,
+ BuiltInName::umulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0D0D_o_0D_o_0D,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpUmulExtended,
+ false);
+constexpr const TFunction kFunction_umulExtended_1D1D1D1D(
+ BuiltInId::umulExtended_UInt2_UInt2_UInt2_UInt2,
+ BuiltInName::umulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1D1D_o_1D_o_1D,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpUmulExtended,
+ false);
+constexpr const TFunction kFunction_umulExtended_2D2D2D2D(
+ BuiltInId::umulExtended_UInt3_UInt3_UInt3_UInt3,
+ BuiltInName::umulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2D2D_o_2D_o_2D,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpUmulExtended,
+ false);
+constexpr const TFunction kFunction_umulExtended_3D3D3D3D(
+ BuiltInId::umulExtended_UInt4_UInt4_UInt4_UInt4,
+ BuiltInName::umulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3D3D_o_3D_o_3D,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpUmulExtended,
+ false);
+constexpr const TFunction kFunction_imulExtended_0C0C0C0C(
+ BuiltInId::imulExtended_Int1_Int1_Int1_Int1,
+ BuiltInName::imulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0C0C_o_0C_o_0C,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpImulExtended,
+ false);
+constexpr const TFunction kFunction_imulExtended_1C1C1C1C(
+ BuiltInId::imulExtended_Int2_Int2_Int2_Int2,
+ BuiltInName::imulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1C1C_o_1C_o_1C,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpImulExtended,
+ false);
+constexpr const TFunction kFunction_imulExtended_2C2C2C2C(
+ BuiltInId::imulExtended_Int3_Int3_Int3_Int3,
+ BuiltInName::imulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2C2C_o_2C_o_2C,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpImulExtended,
+ false);
+constexpr const TFunction kFunction_imulExtended_3C3C3C3C(
+ BuiltInId::imulExtended_Int4_Int4_Int4_Int4,
+ BuiltInName::imulExtended,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3C3C_o_3C_o_3C,
+ 4,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpImulExtended,
+ false);
+constexpr const TFunction kFunction_texture2D_0H1B(
+ BuiltInId::texture2D_Sampler2D1_Float2,
+ BuiltInName::texture2D,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1B1B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProj_0H2B(
+ BuiltInId::texture2DProj_Sampler2D1_Float3,
+ BuiltInName::texture2DProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProj_0H3B(
+ BuiltInId::texture2DProj_Sampler2D1_Float4,
+ BuiltInName::texture2DProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureCube_0J2B(
+ BuiltInId::textureCube_SamplerCube1_Float3,
+ BuiltInName::textureCube,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B2B2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2D_0L1B(
+ BuiltInId::texture2D_SamplerExternalOES1_Float2,
+ BuiltInName::texture2D,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0L1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProj_0L2B(
+ BuiltInId::texture2DProj_SamplerExternalOES1_Float3,
+ BuiltInName::texture2DProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0L2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProj_0L3B(
+ BuiltInId::texture2DProj_SamplerExternalOES1_Float4,
+ BuiltInName::texture2DProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0L3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DRect_0N1B(
+ BuiltInId::texture2DRect_Sampler2DRect1_Float2,
+ BuiltInName::texture2DRect,
+ TExtension::ARB_texture_rectangle,
+ BuiltInParameters::p0N1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DRectProj_0N2B(
+ BuiltInId::texture2DRectProj_Sampler2DRect1_Float3,
+ BuiltInName::texture2DRectProj,
+ TExtension::ARB_texture_rectangle,
+ BuiltInParameters::p0N2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DRectProj_0N3B(
+ BuiltInId::texture2DRectProj_Sampler2DRect1_Float4,
+ BuiltInName::texture2DRectProj,
+ TExtension::ARB_texture_rectangle,
+ BuiltInParameters::p0N3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0N1B(
+ BuiltInId::texture_Sampler2DRect1_Float2,
+ BuiltInName::texture,
+ TExtension::ARB_texture_rectangle,
+ BuiltInParameters::p0N1B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0N2B(
+ BuiltInId::textureProj_Sampler2DRect1_Float3,
+ BuiltInName::textureProj,
+ TExtension::ARB_texture_rectangle,
+ BuiltInParameters::p0N2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0N3B(
+ BuiltInId::textureProj_Sampler2DRect1_Float4,
+ BuiltInName::textureProj,
+ TExtension::ARB_texture_rectangle,
+ BuiltInParameters::p0N3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DGradEXT_0H1B1B1B(
+ BuiltInId::texture2DGradEXT_Sampler2D1_Float2_Float2_Float2,
+ BuiltInName::texture2DGradEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0H1B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProjGradEXT_0H2B1B1B(
+ BuiltInId::texture2DProjGradEXT_Sampler2D1_Float3_Float2_Float2,
+ BuiltInName::texture2DProjGradEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0H2B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProjGradEXT_0H3B1B1B(
+ BuiltInId::texture2DProjGradEXT_Sampler2D1_Float4_Float2_Float2,
+ BuiltInName::texture2DProjGradEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0H3B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureCubeGradEXT_0J2B2B2B(
+ BuiltInId::textureCubeGradEXT_SamplerCube1_Float3_Float3_Float3,
+ BuiltInName::textureCubeGradEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0J2B2B2B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2D_0H1B0B(
+ BuiltInId::texture2D_Sampler2D1_Float2_Float1,
+ BuiltInName::texture2D,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProj_0H2B0B(
+ BuiltInId::texture2DProj_Sampler2D1_Float3_Float1,
+ BuiltInName::texture2DProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProj_0H3B0B(
+ BuiltInId::texture2DProj_Sampler2D1_Float4_Float1,
+ BuiltInName::texture2DProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureCube_0J2B0B(
+ BuiltInId::textureCube_SamplerCube1_Float3_Float1,
+ BuiltInName::textureCube,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_dFdxExt_0B(
+ BuiltInId::dFdxExt_Float1,
+ BuiltInName::dFdxExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdxExt_1B(
+ BuiltInId::dFdxExt_Float2,
+ BuiltInName::dFdxExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdxExt_2B(
+ BuiltInId::dFdxExt_Float3,
+ BuiltInName::dFdxExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdxExt_3B(
+ BuiltInId::dFdxExt_Float4,
+ BuiltInName::dFdxExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdyExt_0B(
+ BuiltInId::dFdyExt_Float1,
+ BuiltInName::dFdyExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_dFdyExt_1B(
+ BuiltInId::dFdyExt_Float2,
+ BuiltInName::dFdyExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_dFdyExt_2B(
+ BuiltInId::dFdyExt_Float3,
+ BuiltInName::dFdyExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_dFdyExt_3B(
+ BuiltInId::dFdyExt_Float4,
+ BuiltInName::dFdyExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_fwidthExt_0B(
+ BuiltInId::fwidthExt_Float1,
+ BuiltInName::fwidthExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_fwidthExt_1B(
+ BuiltInId::fwidthExt_Float2,
+ BuiltInName::fwidthExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_fwidthExt_2B(
+ BuiltInId::fwidthExt_Float3,
+ BuiltInName::fwidthExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_fwidthExt_3B(
+ BuiltInId::fwidthExt_Float4,
+ BuiltInName::fwidthExt,
+ TExtension::OES_standard_derivatives,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_texture2DLodEXT_0H1B0B(
+ BuiltInId::texture2DLodEXT_Sampler2D1_Float2_Float1,
+ BuiltInName::texture2DLodEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0H1B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProjLodEXT_0H2B0B(
+ BuiltInId::texture2DProjLodEXT_Sampler2D1_Float3_Float1,
+ BuiltInName::texture2DProjLodEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0H2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProjLodEXT_0H3B0B(
+ BuiltInId::texture2DProjLodEXT_Sampler2D1_Float4_Float1,
+ BuiltInName::texture2DProjLodEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0H3B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureCubeLodEXT_0J2B0B(
+ BuiltInId::textureCubeLodEXT_SamplerCube1_Float3_Float1,
+ BuiltInName::textureCubeLodEXT,
+ TExtension::EXT_shader_texture_lod,
+ BuiltInParameters::p0J2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture3D_0I2B(
+ BuiltInId::texture3D_Sampler3D1_Float3,
+ BuiltInName::texture3D,
+ TExtension::OES_texture_3D,
+ BuiltInParameters::p0I2B0B2C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture3D_0I2B0B(
+ BuiltInId::texture3D_Sampler3D1_Float3_Float1,
+ BuiltInName::texture3D,
+ TExtension::OES_texture_3D,
+ BuiltInParameters::p0I2B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture3DProj_0I3B(
+ BuiltInId::texture3DProj_Sampler3D1_Float4,
+ BuiltInName::texture3DProj,
+ TExtension::OES_texture_3D,
+ BuiltInParameters::p0I3B2C0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture3DProj_0I3B0B(
+ BuiltInId::texture3DProj_Sampler3D1_Float4_Float1,
+ BuiltInName::texture3DProj,
+ TExtension::OES_texture_3D,
+ BuiltInParameters::p0I3B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture3DLod_0I2B0B(
+ BuiltInId::texture3DLod_Sampler3D1_Float3_Float1,
+ BuiltInName::texture3DLod,
+ TExtension::OES_texture_3D,
+ BuiltInParameters::p0I2B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture3DProjLod_0I3B0B(
+ BuiltInId::texture3DProjLod_Sampler3D1_Float4_Float1,
+ BuiltInName::texture3DProjLod,
+ TExtension::OES_texture_3D,
+ BuiltInParameters::p0I3B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DLod_0H1B0B(
+ BuiltInId::texture2DLod_Sampler2D1_Float2_Float1,
+ BuiltInName::texture2DLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProjLod_0H2B0B(
+ BuiltInId::texture2DProjLod_Sampler2D1_Float3_Float1,
+ BuiltInName::texture2DProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture2DProjLod_0H3B0B(
+ BuiltInId::texture2DProjLod_Sampler2D1_Float4_Float1,
+ BuiltInName::texture2DProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureCubeLod_0J2B0B(
+ BuiltInId::textureCubeLod_SamplerCube1_Float3_Float1,
+ BuiltInName::textureCubeLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0H1B(
+ BuiltInId::texture_Sampler2D1_Float2,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1B1B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0Q1B(
+ BuiltInId::texture_ISampler2D1_Float2,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1B1B1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0W1B(
+ BuiltInId::texture_USampler2D1_Float2,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0I2B(
+ BuiltInId::texture_Sampler3D1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B0B2C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0R2B(
+ BuiltInId::texture_ISampler3D1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B0B2C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0X2B(
+ BuiltInId::texture_USampler3D1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B0B2C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0J2B(
+ BuiltInId::texture_SamplerCube1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B2B2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0S2B(
+ BuiltInId::texture_ISamplerCube1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0S2B0B,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0Y2B(
+ BuiltInId::texture_USamplerCube1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Y2B2B2B,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0K2B(
+ BuiltInId::texture_Sampler2DArray1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0T2B(
+ BuiltInId::texture_ISampler2DArray1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1B1B1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0Z2B(
+ BuiltInId::texture_USampler2DArray1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1B1B1C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0H2B(
+ BuiltInId::textureProj_Sampler2D1_Float3,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0Q2B(
+ BuiltInId::textureProj_ISampler2D1_Float3,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B1B1B1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0W2B(
+ BuiltInId::textureProj_USampler2D1_Float3,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B1C0B,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0H3B(
+ BuiltInId::textureProj_Sampler2D1_Float4,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0Q3B(
+ BuiltInId::textureProj_ISampler2D1_Float4,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B1B1B1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0W3B(
+ BuiltInId::textureProj_USampler2D1_Float4,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B1B1B1C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0I3B(
+ BuiltInId::textureProj_Sampler3D1_Float4,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B2C0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0R3B(
+ BuiltInId::textureProj_ISampler3D1_Float4,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B0B2C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0X3B(
+ BuiltInId::textureProj_USampler3D1_Float4,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B2B2B2C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0H1B0B(
+ BuiltInId::textureLod_Sampler2D1_Float2_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0Q1B0B(
+ BuiltInId::textureLod_ISampler2D1_Float2_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0W1B0B(
+ BuiltInId::textureLod_USampler2D1_Float2_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0I2B0B(
+ BuiltInId::textureLod_Sampler3D1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0R2B0B(
+ BuiltInId::textureLod_ISampler3D1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B0B2C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0X2B0B(
+ BuiltInId::textureLod_USampler3D1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B0B2C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0J2B0B(
+ BuiltInId::textureLod_SamplerCube1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0S2B0B(
+ BuiltInId::textureLod_ISamplerCube1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0S2B0B,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0Y2B0B(
+ BuiltInId::textureLod_USamplerCube1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Y2B0B,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0K2B0B(
+ BuiltInId::textureLod_Sampler2DArray1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0T2B0B(
+ BuiltInId::textureLod_ISampler2DArray1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0Z2B0B(
+ BuiltInId::textureLod_USampler2DArray1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0c2B(
+ BuiltInId::texture_Sampler2DShadow1_Float3,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B1B1B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0d3B(
+ BuiltInId::texture_SamplerCubeShadow1_Float4,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0d3B2B2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0e3B(
+ BuiltInId::texture_Sampler2DArrayShadow1_Float4,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0e3B1B1B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0c3B(
+ BuiltInId::textureProj_Sampler2DShadow1_Float4,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLod_0c2B0B(
+ BuiltInId::textureLod_Sampler2DShadow1_Float3_Float1,
+ BuiltInName::textureLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0H0C(
+ BuiltInId::textureSize_Sampler2D1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0Q0C(
+ BuiltInId::textureSize_ISampler2D1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0W0C(
+ BuiltInId::textureSize_USampler2D1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0I0C(
+ BuiltInId::textureSize_Sampler3D1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0R0C(
+ BuiltInId::textureSize_ISampler3D1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0X0C(
+ BuiltInId::textureSize_USampler3D1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0J0C(
+ BuiltInId::textureSize_SamplerCube1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0S0C(
+ BuiltInId::textureSize_ISamplerCube1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0S0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0Y0C(
+ BuiltInId::textureSize_USamplerCube1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Y0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0K0C(
+ BuiltInId::textureSize_Sampler2DArray1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0T0C(
+ BuiltInId::textureSize_ISampler2DArray1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0Z0C(
+ BuiltInId::textureSize_USampler2DArray1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0c0C(
+ BuiltInId::textureSize_Sampler2DShadow1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0d0C(
+ BuiltInId::textureSize_SamplerCubeShadow1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0d0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0e0C(
+ BuiltInId::textureSize_Sampler2DArrayShadow1_Int1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0e0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0H2B0B(
+ BuiltInId::textureProjLod_Sampler2D1_Float3_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0Q2B0B(
+ BuiltInId::textureProjLod_ISampler2D1_Float3_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0W2B0B(
+ BuiltInId::textureProjLod_USampler2D1_Float3_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0H3B0B(
+ BuiltInId::textureProjLod_Sampler2D1_Float4_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0Q3B0B(
+ BuiltInId::textureProjLod_ISampler2D1_Float4_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0W3B0B(
+ BuiltInId::textureProjLod_USampler2D1_Float4_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0I3B0B(
+ BuiltInId::textureProjLod_Sampler3D1_Float4_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0R3B0B(
+ BuiltInId::textureProjLod_ISampler3D1_Float4_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B0B2C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0X3B0B(
+ BuiltInId::textureProjLod_USampler3D1_Float4_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B0B2C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLod_0c3B0B(
+ BuiltInId::textureProjLod_Sampler2DShadow1_Float4_Float1,
+ BuiltInName::textureProjLod,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0H1C0C(
+ BuiltInId::texelFetch_Sampler2D1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1C0C1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0Q1C0C(
+ BuiltInId::texelFetch_ISampler2D1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1C0C1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0W1C0C(
+ BuiltInId::texelFetch_USampler2D1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1C0C1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0I2C0C(
+ BuiltInId::texelFetch_Sampler3D1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2C0C2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0R2C0C(
+ BuiltInId::texelFetch_ISampler3D1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2C0C2C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0X2C0C(
+ BuiltInId::texelFetch_USampler3D1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2C0C2C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0K2C0C(
+ BuiltInId::texelFetch_Sampler2DArray1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2C0C1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0T2C0C(
+ BuiltInId::texelFetch_ISampler2DArray1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2C0C1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0Z2C0C(
+ BuiltInId::texelFetch_USampler2DArray1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2C0C1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0H1B1B1B(
+ BuiltInId::textureGrad_Sampler2D1_Float2_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0Q1B1B1B(
+ BuiltInId::textureGrad_ISampler2D1_Float2_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1B1B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0W1B1B1B(
+ BuiltInId::textureGrad_USampler2D1_Float2_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1B1B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0I2B2B2B(
+ BuiltInId::textureGrad_Sampler3D1_Float3_Float3_Float3,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B2B2B2C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0R2B2B2B(
+ BuiltInId::textureGrad_ISampler3D1_Float3_Float3_Float3,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B2B2B2C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0X2B2B2B(
+ BuiltInId::textureGrad_USampler3D1_Float3_Float3_Float3,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B2B2B2C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0J2B2B2B(
+ BuiltInId::textureGrad_SamplerCube1_Float3_Float3_Float3,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B2B2B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0S2B2B2B(
+ BuiltInId::textureGrad_ISamplerCube1_Float3_Float3_Float3,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0S2B2B2B,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0Y2B2B2B(
+ BuiltInId::textureGrad_USamplerCube1_Float3_Float3_Float3,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Y2B2B2B,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0c2B1B1B(
+ BuiltInId::textureGrad_Sampler2DShadow1_Float3_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0d3B2B2B(
+ BuiltInId::textureGrad_SamplerCubeShadow1_Float4_Float3_Float3,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0d3B2B2B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0K2B1B1B(
+ BuiltInId::textureGrad_Sampler2DArray1_Float3_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0T2B1B1B(
+ BuiltInId::textureGrad_ISampler2DArray1_Float3_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1B1B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0Z2B1B1B(
+ BuiltInId::textureGrad_USampler2DArray1_Float3_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1B1B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGrad_0e3B1B1B(
+ BuiltInId::textureGrad_Sampler2DArrayShadow1_Float4_Float2_Float2,
+ BuiltInName::textureGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0e3B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0H2B1B1B(
+ BuiltInId::textureProjGrad_Sampler2D1_Float3_Float2_Float2,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0Q2B1B1B(
+ BuiltInId::textureProjGrad_ISampler2D1_Float3_Float2_Float2,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B1B1B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0W2B1B1B(
+ BuiltInId::textureProjGrad_USampler2D1_Float3_Float2_Float2,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B1B1B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0H3B1B1B(
+ BuiltInId::textureProjGrad_Sampler2D1_Float4_Float2_Float2,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0Q3B1B1B(
+ BuiltInId::textureProjGrad_ISampler2D1_Float4_Float2_Float2,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B1B1B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0W3B1B1B(
+ BuiltInId::textureProjGrad_USampler2D1_Float4_Float2_Float2,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B1B1B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0I3B2B2B(
+ BuiltInId::textureProjGrad_Sampler3D1_Float4_Float3_Float3,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B2B2B2C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0R3B2B2B(
+ BuiltInId::textureProjGrad_ISampler3D1_Float4_Float3_Float3,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B2B2B2C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0X3B2B2B(
+ BuiltInId::textureProjGrad_USampler3D1_Float4_Float3_Float3,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B2B2B2C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGrad_0c3B1B1B(
+ BuiltInId::textureProjGrad_Sampler2DShadow1_Float4_Float2_Float2,
+ BuiltInName::textureProjGrad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B1B1B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0O(
+ BuiltInId::textureSize_Sampler2DMS1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0O1C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0U(
+ BuiltInId::textureSize_ISampler2DMS1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0U1C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0a(
+ BuiltInId::textureSize_USampler2DMS1,
+ BuiltInName::textureSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0a1C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSizeExt_0O(
+ BuiltInId::textureSizeExt_Sampler2DMS1,
+ BuiltInName::textureSizeExt,
+ TExtension::ANGLE_texture_multisample,
+ BuiltInParameters::p0O1C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSizeExt_0U(
+ BuiltInId::textureSizeExt_ISampler2DMS1,
+ BuiltInName::textureSizeExt,
+ TExtension::ANGLE_texture_multisample,
+ BuiltInParameters::p0U1C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSizeExt_0a(
+ BuiltInId::textureSizeExt_USampler2DMS1,
+ BuiltInName::textureSizeExt,
+ TExtension::ANGLE_texture_multisample,
+ BuiltInParameters::p0a1C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0P(
+ BuiltInId::textureSize_Sampler2DMSArray1,
+ BuiltInName::textureSize,
+ TExtension::OES_texture_storage_multisample_2d_array,
+ BuiltInParameters::p0P2C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0V(
+ BuiltInId::textureSize_ISampler2DMSArray1,
+ BuiltInName::textureSize,
+ TExtension::OES_texture_storage_multisample_2d_array,
+ BuiltInParameters::p0V2C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0b(
+ BuiltInId::textureSize_USampler2DMSArray1,
+ BuiltInName::textureSize,
+ TExtension::OES_texture_storage_multisample_2d_array,
+ BuiltInParameters::p0b2C0C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0H1B1C(
+ BuiltInId::textureOffset_Sampler2D1_Float2_Int2,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0Q1B1C(
+ BuiltInId::textureOffset_ISampler2D1_Float2_Int2,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0W1B1C(
+ BuiltInId::textureOffset_USampler2D1_Float2_Int2,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0I2B2C(
+ BuiltInId::textureOffset_Sampler3D1_Float3_Int3,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B2C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0R2B2C(
+ BuiltInId::textureOffset_ISampler3D1_Float3_Int3,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B2C0B,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0X2B2C(
+ BuiltInId::textureOffset_USampler3D1_Float3_Int3,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B2C0B,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0c2B1C(
+ BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B1C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0K2B1C(
+ BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B1C0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0T2B1C(
+ BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0Z2B1C(
+ BuiltInId::textureOffset_USampler2DArray1_Float3_Int2,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0H2B1C(
+ BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B1C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0Q2B1C(
+ BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B1C0B,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0W2B1C(
+ BuiltInId::textureProjOffset_USampler2D1_Float3_Int2,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B1C0B,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0H3B1C(
+ BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B1C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0Q3B1C(
+ BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B1C0B,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0W3B1C(
+ BuiltInId::textureProjOffset_USampler2D1_Float4_Int2,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B1C0B,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0I3B2C(
+ BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B2C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0R3B2C(
+ BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B2C0B,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0X3B2C(
+ BuiltInId::textureProjOffset_USampler3D1_Float4_Int3,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B2C0B,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0c3B1C(
+ BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B1C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0H1B0B1C(
+ BuiltInId::textureLodOffset_Sampler2D1_Float2_Float1_Int2,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0Q1B0B1C(
+ BuiltInId::textureLodOffset_ISampler2D1_Float2_Float1_Int2,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B0B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0W1B0B1C(
+ BuiltInId::textureLodOffset_USampler2D1_Float2_Float1_Int2,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B0B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0I2B0B2C(
+ BuiltInId::textureLodOffset_Sampler3D1_Float3_Float1_Int3,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B0B2C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0R2B0B2C(
+ BuiltInId::textureLodOffset_ISampler3D1_Float3_Float1_Int3,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B0B2C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0X2B0B2C(
+ BuiltInId::textureLodOffset_USampler3D1_Float3_Float1_Int3,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B0B2C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0c2B0B1C(
+ BuiltInId::textureLodOffset_Sampler2DShadow1_Float3_Float1_Int2,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0K2B0B1C(
+ BuiltInId::textureLodOffset_Sampler2DArray1_Float3_Float1_Int2,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0T2B0B1C(
+ BuiltInId::textureLodOffset_ISampler2DArray1_Float3_Float1_Int2,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B0B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureLodOffset_0Z2B0B1C(
+ BuiltInId::textureLodOffset_USampler2DArray1_Float3_Float1_Int2,
+ BuiltInName::textureLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B0B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0H2B0B1C(
+ BuiltInId::textureProjLodOffset_Sampler2D1_Float3_Float1_Int2,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0Q2B0B1C(
+ BuiltInId::textureProjLodOffset_ISampler2D1_Float3_Float1_Int2,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B0B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0W2B0B1C(
+ BuiltInId::textureProjLodOffset_USampler2D1_Float3_Float1_Int2,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B0B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0H3B0B1C(
+ BuiltInId::textureProjLodOffset_Sampler2D1_Float4_Float1_Int2,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0Q3B0B1C(
+ BuiltInId::textureProjLodOffset_ISampler2D1_Float4_Float1_Int2,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B0B1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0W3B0B1C(
+ BuiltInId::textureProjLodOffset_USampler2D1_Float4_Float1_Int2,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B0B1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0I3B0B2C(
+ BuiltInId::textureProjLodOffset_Sampler3D1_Float4_Float1_Int3,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B0B2C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0R3B0B2C(
+ BuiltInId::textureProjLodOffset_ISampler3D1_Float4_Float1_Int3,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B0B2C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0X3B0B2C(
+ BuiltInId::textureProjLodOffset_USampler3D1_Float4_Float1_Int3,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B0B2C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjLodOffset_0c3B0B1C(
+ BuiltInId::textureProjLodOffset_Sampler2DShadow1_Float4_Float1_Int2,
+ BuiltInName::textureProjLodOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0H1C0C1C(
+ BuiltInId::texelFetchOffset_Sampler2D1_Int2_Int1_Int2,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1C0C1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0Q1C0C1C(
+ BuiltInId::texelFetchOffset_ISampler2D1_Int2_Int1_Int2,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1C0C1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0W1C0C1C(
+ BuiltInId::texelFetchOffset_USampler2D1_Int2_Int1_Int2,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1C0C1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0I2C0C2C(
+ BuiltInId::texelFetchOffset_Sampler3D1_Int3_Int1_Int3,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2C0C2C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0R2C0C2C(
+ BuiltInId::texelFetchOffset_ISampler3D1_Int3_Int1_Int3,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2C0C2C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0X2C0C2C(
+ BuiltInId::texelFetchOffset_USampler3D1_Int3_Int1_Int3,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2C0C2C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0K2C0C1C(
+ BuiltInId::texelFetchOffset_Sampler2DArray1_Int3_Int1_Int2,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2C0C1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0T2C0C1C(
+ BuiltInId::texelFetchOffset_ISampler2DArray1_Int3_Int1_Int2,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2C0C1C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchOffset_0Z2C0C1C(
+ BuiltInId::texelFetchOffset_USampler2DArray1_Int3_Int1_Int2,
+ BuiltInName::texelFetchOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2C0C1C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0H1B1B1B1C(
+ BuiltInId::textureGradOffset_Sampler2D1_Float2_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1B1B1C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0Q1B1B1B1C(
+ BuiltInId::textureGradOffset_ISampler2D1_Float2_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1B1B1C,
+ 5,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0W1B1B1B1C(
+ BuiltInId::textureGradOffset_USampler2D1_Float2_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1B1B1C,
+ 5,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0I2B2B2B2C(
+ BuiltInId::textureGradOffset_Sampler3D1_Float3_Float3_Float3_Int3,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B2B2B2C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0R2B2B2B2C(
+ BuiltInId::textureGradOffset_ISampler3D1_Float3_Float3_Float3_Int3,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B2B2B2C,
+ 5,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0X2B2B2B2C(
+ BuiltInId::textureGradOffset_USampler3D1_Float3_Float3_Float3_Int3,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B2B2B2C,
+ 5,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0c2B1B1B1C(
+ BuiltInId::textureGradOffset_Sampler2DShadow1_Float3_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B1B1B1C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0K2B1B1B1C(
+ BuiltInId::textureGradOffset_Sampler2DArray1_Float3_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B1B1B1C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0T2B1B1B1C(
+ BuiltInId::textureGradOffset_ISampler2DArray1_Float3_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1B1B1C,
+ 5,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0Z2B1B1B1C(
+ BuiltInId::textureGradOffset_USampler2DArray1_Float3_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1B1B1C,
+ 5,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGradOffset_0e3B1B1B1C(
+ BuiltInId::textureGradOffset_Sampler2DArrayShadow1_Float4_Float2_Float2_Int2,
+ BuiltInName::textureGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0e3B1B1B1C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0H2B1B1B1C(
+ BuiltInId::textureProjGradOffset_Sampler2D1_Float3_Float2_Float2_Int2,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B1B1B1C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0Q2B1B1B1C(
+ BuiltInId::textureProjGradOffset_ISampler2D1_Float3_Float2_Float2_Int2,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B1B1B1C,
+ 5,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0W2B1B1B1C(
+ BuiltInId::textureProjGradOffset_USampler2D1_Float3_Float2_Float2_Int2,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B1B1B1C,
+ 5,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0H3B1B1B1C(
+ BuiltInId::textureProjGradOffset_Sampler2D1_Float4_Float2_Float2_Int2,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B1B1B1C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0Q3B1B1B1C(
+ BuiltInId::textureProjGradOffset_ISampler2D1_Float4_Float2_Float2_Int2,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B1B1B1C,
+ 5,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0W3B1B1B1C(
+ BuiltInId::textureProjGradOffset_USampler2D1_Float4_Float2_Float2_Int2,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B1B1B1C,
+ 5,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0I3B2B2B2C(
+ BuiltInId::textureProjGradOffset_Sampler3D1_Float4_Float3_Float3_Int3,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B2B2B2C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0R3B2B2B2C(
+ BuiltInId::textureProjGradOffset_ISampler3D1_Float4_Float3_Float3_Int3,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B2B2B2C,
+ 5,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0X3B2B2B2C(
+ BuiltInId::textureProjGradOffset_USampler3D1_Float4_Float3_Float3_Int3,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B2B2B2C,
+ 5,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjGradOffset_0c3B1B1B1C(
+ BuiltInId::textureProjGradOffset_Sampler2DShadow1_Float4_Float2_Float2_Int2,
+ BuiltInName::textureProjGradOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B1B1B1C,
+ 5,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0H1B1C0B(
+ BuiltInId::textureOffset_Sampler2D1_Float2_Int2_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0Q1B1C0B(
+ BuiltInId::textureOffset_ISampler2D1_Float2_Int2_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1C0B,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0W1B1C0B(
+ BuiltInId::textureOffset_USampler2D1_Float2_Int2_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1C0B,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0I2B2C0B(
+ BuiltInId::textureOffset_Sampler3D1_Float3_Int3_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B2C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0R2B2C0B(
+ BuiltInId::textureOffset_ISampler3D1_Float3_Int3_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B2C0B,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0X2B2C0B(
+ BuiltInId::textureOffset_USampler3D1_Float3_Int3_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B2C0B,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0c2B1C0B(
+ BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B1C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0K2B1C0B(
+ BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B1C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0T2B1C0B(
+ BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1C0B,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureOffset_0Z2B1C0B(
+ BuiltInId::textureOffset_USampler2DArray1_Float3_Int2_Float1,
+ BuiltInName::textureOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1C0B,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0H2B1C0B(
+ BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B1C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0Q2B1C0B(
+ BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B1C0B,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0W2B1C0B(
+ BuiltInId::textureProjOffset_USampler2D1_Float3_Int2_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B1C0B,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0H3B1C0B(
+ BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B1C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0Q3B1C0B(
+ BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B1C0B,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0W3B1C0B(
+ BuiltInId::textureProjOffset_USampler2D1_Float4_Int2_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B1C0B,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0I3B2C0B(
+ BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B2C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0R3B2C0B(
+ BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B2C0B,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0X3B2C0B(
+ BuiltInId::textureProjOffset_USampler3D1_Float4_Int3_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B2C0B,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProjOffset_0c3B1C0B(
+ BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2_Float1,
+ BuiltInName::textureProjOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B1C0B,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0L1B(
+ BuiltInId::texture_SamplerExternalOES1_Float2,
+ BuiltInName::texture,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0L2B(
+ BuiltInId::textureProj_SamplerExternalOES1_Float3,
+ BuiltInName::textureProj,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0L3B(
+ BuiltInId::textureProj_SamplerExternalOES1_Float4,
+ BuiltInName::textureProj,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0L0C(
+ BuiltInId::textureSize_SamplerExternalOES1_Int1,
+ BuiltInName::textureSize,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0L1C0C(
+ BuiltInId::texelFetch_SamplerExternalOES1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L1C0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0M1B(
+ BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2,
+ BuiltInName::texture,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M1B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0M2B(
+ BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3,
+ BuiltInName::textureProj,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0M3B(
+ BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4,
+ BuiltInName::textureProj,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M3B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_rgb_2_yuv_2B0G(
+ BuiltInId::rgb_2_yuv_Float3_YuvCscStandardEXT1,
+ BuiltInName::rgb_2_yuv,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p2B0G,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_yuv_2_rgb_2B0G(
+ BuiltInId::yuv_2_rgb_Float3_YuvCscStandardEXT1,
+ BuiltInName::yuv_2_rgb,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p2B0G,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureSize_0M0C(
+ BuiltInId::textureSize_SamplerExternal2DY2YEXT1_Int1,
+ BuiltInName::textureSize,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0M1C0C(
+ BuiltInId::texelFetch_SamplerExternal2DY2YEXT1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M1C0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0H1B0B(
+ BuiltInId::texture_Sampler2D1_Float2_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0Q1B0B(
+ BuiltInId::texture_ISampler2D1_Float2_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0W1B0B(
+ BuiltInId::texture_USampler2D1_Float2_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0I2B0B(
+ BuiltInId::texture_Sampler3D1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I2B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0R2B0B(
+ BuiltInId::texture_ISampler3D1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R2B0B2C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0X2B0B(
+ BuiltInId::texture_USampler3D1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X2B0B2C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0J2B0B(
+ BuiltInId::texture_SamplerCube1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0S2B0B(
+ BuiltInId::texture_ISamplerCube1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0S2B0B,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0Y2B0B(
+ BuiltInId::texture_USamplerCube1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Y2B0B,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0K2B0B(
+ BuiltInId::texture_Sampler2DArray1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0T2B0B(
+ BuiltInId::texture_ISampler2DArray1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0Z2B0B(
+ BuiltInId::texture_USampler2DArray1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0H2B0B(
+ BuiltInId::textureProj_Sampler2D1_Float3_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0Q2B0B(
+ BuiltInId::textureProj_ISampler2D1_Float3_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q2B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0W2B0B(
+ BuiltInId::textureProj_USampler2D1_Float3_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W2B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0H3B0B(
+ BuiltInId::textureProj_Sampler2D1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H3B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0Q3B0B(
+ BuiltInId::textureProj_ISampler2D1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q3B0B1C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0W3B0B(
+ BuiltInId::textureProj_USampler2D1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W3B0B1C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0I3B0B(
+ BuiltInId::textureProj_Sampler3D1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0I3B0B2C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0R3B0B(
+ BuiltInId::textureProj_ISampler3D1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0R3B0B2C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0X3B0B(
+ BuiltInId::textureProj_USampler3D1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0X3B0B2C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0c2B0B(
+ BuiltInId::texture_Sampler2DShadow1_Float3_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0d3B0B(
+ BuiltInId::texture_SamplerCubeShadow1_Float4_Float1,
+ BuiltInName::texture,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0d3B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0c3B0B(
+ BuiltInId::textureProj_Sampler2DShadow1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c3B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0L1B0B(
+ BuiltInId::texture_SamplerExternalOES1_Float2_Float1,
+ BuiltInName::texture,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L1B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0L2B0B(
+ BuiltInId::textureProj_SamplerExternalOES1_Float3_Float1,
+ BuiltInName::textureProj,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0L3B0B(
+ BuiltInId::textureProj_SamplerExternalOES1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::OES_EGL_image_external_essl3,
+ BuiltInParameters::p0L3B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texture_0M1B0B(
+ BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2_Float1,
+ BuiltInName::texture,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M1B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0M2B0B(
+ BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3_Float1,
+ BuiltInName::textureProj,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureProj_0M3B0B(
+ BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4_Float1,
+ BuiltInName::textureProj,
+ TExtension::EXT_YUV_target,
+ BuiltInParameters::p0M3B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0O1C0C(
+ BuiltInId::texelFetch_Sampler2DMS1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0O1C0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0U1C0C(
+ BuiltInId::texelFetch_ISampler2DMS1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0U1C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0a1C0C(
+ BuiltInId::texelFetch_USampler2DMS1_Int2_Int1,
+ BuiltInName::texelFetch,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0a1C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchExt_0O1C0C(
+ BuiltInId::texelFetchExt_Sampler2DMS1_Int2_Int1,
+ BuiltInName::texelFetchExt,
+ TExtension::ANGLE_texture_multisample,
+ BuiltInParameters::p0O1C0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchExt_0U1C0C(
+ BuiltInId::texelFetchExt_ISampler2DMS1_Int2_Int1,
+ BuiltInName::texelFetchExt,
+ TExtension::ANGLE_texture_multisample,
+ BuiltInParameters::p0U1C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetchExt_0a1C0C(
+ BuiltInId::texelFetchExt_USampler2DMS1_Int2_Int1,
+ BuiltInName::texelFetchExt,
+ TExtension::ANGLE_texture_multisample,
+ BuiltInParameters::p0a1C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0P2C0C(
+ BuiltInId::texelFetch_Sampler2DMSArray1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::OES_texture_storage_multisample_2d_array,
+ BuiltInParameters::p0P2C0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0V2C0C(
+ BuiltInId::texelFetch_ISampler2DMSArray1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::OES_texture_storage_multisample_2d_array,
+ BuiltInParameters::p0V2C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_texelFetch_0b2C0C(
+ BuiltInId::texelFetch_USampler2DMSArray1_Int3_Int1,
+ BuiltInName::texelFetch,
+ TExtension::OES_texture_storage_multisample_2d_array,
+ BuiltInParameters::p0b2C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0H1B(
+ BuiltInId::textureGather_Sampler2D1_Float2,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1B1B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0Q1B(
+ BuiltInId::textureGather_ISampler2D1_Float2,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1B1B1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0W1B(
+ BuiltInId::textureGather_USampler2D1_Float2,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1C0C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0H1B0C(
+ BuiltInId::textureGather_Sampler2D1_Float2_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0Q1B0C(
+ BuiltInId::textureGather_ISampler2D1_Float2_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0W1B0C(
+ BuiltInId::textureGather_USampler2D1_Float2_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0K2B(
+ BuiltInId::textureGather_Sampler2DArray1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0T2B(
+ BuiltInId::textureGather_ISampler2DArray1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1B1B1C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0Z2B(
+ BuiltInId::textureGather_USampler2DArray1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1B1B1C,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0K2B0C(
+ BuiltInId::textureGather_Sampler2DArray1_Float3_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0T2B0C(
+ BuiltInId::textureGather_ISampler2DArray1_Float3_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0Z2B0C(
+ BuiltInId::textureGather_USampler2DArray1_Float3_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0J2B(
+ BuiltInId::textureGather_SamplerCube1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B2B2B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0S2B(
+ BuiltInId::textureGather_ISamplerCube1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0S2B0B,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0Y2B(
+ BuiltInId::textureGather_USamplerCube1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Y2B2B2B,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0J2B0C(
+ BuiltInId::textureGather_SamplerCube1_Float3_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0J2B0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0S2B0C(
+ BuiltInId::textureGather_ISamplerCube1_Float3_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0S2B0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0Y2B0C(
+ BuiltInId::textureGather_USamplerCube1_Float3_Int1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Y2B0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0c1B(
+ BuiltInId::textureGather_Sampler2DShadow1_Float2,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c1B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0c1B0B(
+ BuiltInId::textureGather_Sampler2DShadow1_Float2_Float1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c1B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0e2B(
+ BuiltInId::textureGather_Sampler2DArrayShadow1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0e2B0B1C,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0e2B0B(
+ BuiltInId::textureGather_Sampler2DArrayShadow1_Float3_Float1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0e2B0B1C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0d2B(
+ BuiltInId::textureGather_SamplerCubeShadow1_Float3,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0d2B0B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGather_0d2B0B(
+ BuiltInId::textureGather_SamplerCubeShadow1_Float3_Float1,
+ BuiltInName::textureGather,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0d2B0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0H1B1C(
+ BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1C0B,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0Q1B1C(
+ BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0W1B1C(
+ BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0H1B1C0C(
+ BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2_Int1,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0H1B1C0C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0Q1B1C0C(
+ BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2_Int1,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Q1B1C0C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0W1B1C0C(
+ BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2_Int1,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0W1B1C0C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0K2B1C(
+ BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B1C0C,
+ 3,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0T2B1C(
+ BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0Z2B1C(
+ BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1C0C,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0K2B1C0C(
+ BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2_Int1,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0K2B1C0C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0T2B1C0C(
+ BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2_Int1,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0T2B1C0C,
+ 4,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0Z2B1C0C(
+ BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2_Int1,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0Z2B1C0C,
+ 4,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0c1B0B1C(
+ BuiltInId::textureGatherOffset_Sampler2DShadow1_Float2_Float1_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0c1B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_textureGatherOffset_0e2B0B1C(
+ BuiltInId::textureGatherOffset_Sampler2DArrayShadow1_Float3_Float1_Int2,
+ BuiltInName::textureGatherOffset,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0e2B0B1C,
+ 4,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_dFdx_0B(
+ BuiltInId::dFdx_Float1,
+ BuiltInName::dFdx,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdx_1B(
+ BuiltInId::dFdx_Float2,
+ BuiltInName::dFdx,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdx_2B(
+ BuiltInId::dFdx_Float3,
+ BuiltInName::dFdx,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdx_3B(
+ BuiltInId::dFdx_Float4,
+ BuiltInName::dFdx,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpDFdx,
+ false);
+constexpr const TFunction kFunction_dFdy_0B(
+ BuiltInId::dFdy_Float1,
+ BuiltInName::dFdy,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_dFdy_1B(
+ BuiltInId::dFdy_Float2,
+ BuiltInName::dFdy,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_dFdy_2B(
+ BuiltInId::dFdy_Float3,
+ BuiltInName::dFdy,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_dFdy_3B(
+ BuiltInId::dFdy_Float4,
+ BuiltInName::dFdy,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpDFdy,
+ false);
+constexpr const TFunction kFunction_fwidth_0B(
+ BuiltInId::fwidth_Float1,
+ BuiltInName::fwidth,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0B0C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_fwidth_1B(
+ BuiltInId::fwidth_Float2,
+ BuiltInName::fwidth,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p1B1B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_fwidth_2B(
+ BuiltInId::fwidth_Float3,
+ BuiltInName::fwidth,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p2B_o_2C,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_fwidth_3B(
+ BuiltInId::fwidth_Float4,
+ BuiltInName::fwidth,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p3B0B0B,
+ 1,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpFwidth,
+ false);
+constexpr const TFunction kFunction_atomicCounter_0F(
+ BuiltInId::atomicCounter_AtomicCounter1,
+ BuiltInName::atomicCounter,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0F,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_atomicCounterIncrement_0F(
+ BuiltInId::atomicCounterIncrement_AtomicCounter1,
+ BuiltInName::atomicCounterIncrement,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0F,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_atomicCounterDecrement_0F(
+ BuiltInId::atomicCounterDecrement_AtomicCounter1,
+ BuiltInName::atomicCounterDecrement,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0F,
+ 1,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_atomicAdd_0D0D(
+ BuiltInId::atomicAdd_UInt1_UInt1,
+ BuiltInName::atomicAdd,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicAdd,
+ false);
+constexpr const TFunction kFunction_atomicAdd_0C0C(
+ BuiltInId::atomicAdd_Int1_Int1,
+ BuiltInName::atomicAdd,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicAdd,
+ false);
+constexpr const TFunction kFunction_atomicMin_0D0D(
+ BuiltInId::atomicMin_UInt1_UInt1,
+ BuiltInName::atomicMin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicMin,
+ false);
+constexpr const TFunction kFunction_atomicMin_0C0C(
+ BuiltInId::atomicMin_Int1_Int1,
+ BuiltInName::atomicMin,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicMin,
+ false);
+constexpr const TFunction kFunction_atomicMax_0D0D(
+ BuiltInId::atomicMax_UInt1_UInt1,
+ BuiltInName::atomicMax,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicMax,
+ false);
+constexpr const TFunction kFunction_atomicMax_0C0C(
+ BuiltInId::atomicMax_Int1_Int1,
+ BuiltInName::atomicMax,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicMax,
+ false);
+constexpr const TFunction kFunction_atomicAnd_0D0D(
+ BuiltInId::atomicAnd_UInt1_UInt1,
+ BuiltInName::atomicAnd,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicAnd,
+ false);
+constexpr const TFunction kFunction_atomicAnd_0C0C(
+ BuiltInId::atomicAnd_Int1_Int1,
+ BuiltInName::atomicAnd,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicAnd,
+ false);
+constexpr const TFunction kFunction_atomicOr_0D0D(
+ BuiltInId::atomicOr_UInt1_UInt1,
+ BuiltInName::atomicOr,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicOr,
+ false);
+constexpr const TFunction kFunction_atomicOr_0C0C(
+ BuiltInId::atomicOr_Int1_Int1,
+ BuiltInName::atomicOr,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicOr,
+ false);
+constexpr const TFunction kFunction_atomicXor_0D0D(
+ BuiltInId::atomicXor_UInt1_UInt1,
+ BuiltInName::atomicXor,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicXor,
+ false);
+constexpr const TFunction kFunction_atomicXor_0C0C(
+ BuiltInId::atomicXor_Int1_Int1,
+ BuiltInName::atomicXor,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicXor,
+ false);
+constexpr const TFunction kFunction_atomicExchange_0D0D(
+ BuiltInId::atomicExchange_UInt1_UInt1,
+ BuiltInName::atomicExchange,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicExchange,
+ false);
+constexpr const TFunction kFunction_atomicExchange_0C0C(
+ BuiltInId::atomicExchange_Int1_Int1,
+ BuiltInName::atomicExchange,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicExchange,
+ false);
+constexpr const TFunction kFunction_atomicCompSwap_0D0D0D(
+ BuiltInId::atomicCompSwap_UInt1_UInt1_UInt1,
+ BuiltInName::atomicCompSwap,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0D0D0D,
+ 3,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicCompSwap,
+ false);
+constexpr const TFunction kFunction_atomicCompSwap_0C0C0C(
+ BuiltInId::atomicCompSwap_Int1_Int1_Int1,
+ BuiltInName::atomicCompSwap,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p_io_0C0C0C,
+ 3,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpAtomicCompSwap,
+ false);
+constexpr const TFunction kFunction_imageSize_0f(
+ BuiltInId::imageSize_Image2D1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0f1C3B,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0g(
+ BuiltInId::imageSize_IImage2D1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0g1C3C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0h(
+ BuiltInId::imageSize_UImage2D1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0h1C3D,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0i(
+ BuiltInId::imageSize_Image3D1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0i2C3B,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0j(
+ BuiltInId::imageSize_IImage3D1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0j2C3C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0k(
+ BuiltInId::imageSize_UImage3D1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0k2C3D,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0l(
+ BuiltInId::imageSize_Image2DArray1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0l2C3B,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0m(
+ BuiltInId::imageSize_IImage2DArray1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0m2C3C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0n(
+ BuiltInId::imageSize_UImage2DArray1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0n2C3D,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 3, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0o(
+ BuiltInId::imageSize_ImageCube1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0o2C3B,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0p(
+ BuiltInId::imageSize_IImageCube1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0p2C3C,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageSize_0q(
+ BuiltInId::imageSize_UImageCube1,
+ BuiltInName::imageSize,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0q2C3D,
+ 1,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 2, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0f1C(
+ BuiltInId::imageLoad_Image2D1_Int2,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0f1C3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0g1C(
+ BuiltInId::imageLoad_IImage2D1_Int2,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0g1C3C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0h1C(
+ BuiltInId::imageLoad_UImage2D1_Int2,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0h1C3D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0i2C(
+ BuiltInId::imageLoad_Image3D1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0i2C3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0j2C(
+ BuiltInId::imageLoad_IImage3D1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0j2C3C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0k2C(
+ BuiltInId::imageLoad_UImage3D1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0k2C3D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0l2C(
+ BuiltInId::imageLoad_Image2DArray1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0l2C3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0m2C(
+ BuiltInId::imageLoad_IImage2DArray1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0m2C3C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0n2C(
+ BuiltInId::imageLoad_UImage2DArray1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0n2C3D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0o2C(
+ BuiltInId::imageLoad_ImageCube1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0o2C3B,
+ 2,
+ StaticType::Get<EbtFloat, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0p2C(
+ BuiltInId::imageLoad_IImageCube1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0p2C3C,
+ 2,
+ StaticType::Get<EbtInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageLoad_0q2C(
+ BuiltInId::imageLoad_UImageCube1_Int3,
+ BuiltInName::imageLoad,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0q2C3D,
+ 2,
+ StaticType::Get<EbtUInt, EbpUndefined, EvqGlobal, 4, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0f1C3B(
+ BuiltInId::imageStore_Image2D1_Int2_Float4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0f1C3B,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0g1C3C(
+ BuiltInId::imageStore_IImage2D1_Int2_Int4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0g1C3C,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0h1C3D(
+ BuiltInId::imageStore_UImage2D1_Int2_UInt4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0h1C3D,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0i2C3B(
+ BuiltInId::imageStore_Image3D1_Int3_Float4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0i2C3B,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0j2C3C(
+ BuiltInId::imageStore_IImage3D1_Int3_Int4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0j2C3C,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0k2C3D(
+ BuiltInId::imageStore_UImage3D1_Int3_UInt4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0k2C3D,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0l2C3B(
+ BuiltInId::imageStore_Image2DArray1_Int3_Float4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0l2C3B,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0m2C3C(
+ BuiltInId::imageStore_IImage2DArray1_Int3_Int4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0m2C3C,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0n2C3D(
+ BuiltInId::imageStore_UImage2DArray1_Int3_UInt4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0n2C3D,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0o2C3B(
+ BuiltInId::imageStore_ImageCube1_Int3_Float4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0o2C3B,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0p2C3C(
+ BuiltInId::imageStore_IImageCube1_Int3_Int4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0p2C3C,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_imageStore_0q2C3D(
+ BuiltInId::imageStore_UImageCube1_Int3_UInt4,
+ BuiltInName::imageStore,
+ TExtension::UNDEFINED,
+ BuiltInParameters::p0q2C3D,
+ 3,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpCallBuiltInFunction,
+ false);
+constexpr const TFunction kFunction_memoryBarrier_(
+ BuiltInId::memoryBarrier,
+ BuiltInName::memoryBarrier,
+ TExtension::UNDEFINED,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMemoryBarrier,
+ false);
+constexpr const TFunction kFunction_memoryBarrierAtomicCounter_(
+ BuiltInId::memoryBarrierAtomicCounter,
+ BuiltInName::memoryBarrierAtomicCounter,
+ TExtension::UNDEFINED,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMemoryBarrierAtomicCounter,
+ false);
+constexpr const TFunction kFunction_memoryBarrierBuffer_(
+ BuiltInId::memoryBarrierBuffer,
+ BuiltInName::memoryBarrierBuffer,
+ TExtension::UNDEFINED,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMemoryBarrierBuffer,
+ false);
+constexpr const TFunction kFunction_memoryBarrierImage_(
+ BuiltInId::memoryBarrierImage,
+ BuiltInName::memoryBarrierImage,
+ TExtension::UNDEFINED,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMemoryBarrierImage,
+ false);
+constexpr const TFunction kFunction_barrier_(
+ BuiltInId::barrier,
+ BuiltInName::barrier,
+ TExtension::UNDEFINED,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpBarrier,
+ false);
+constexpr const TFunction kFunction_memoryBarrierShared_(
+ BuiltInId::memoryBarrierShared,
+ BuiltInName::memoryBarrierShared,
+ TExtension::UNDEFINED,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpMemoryBarrierShared,
+ false);
+constexpr const TFunction kFunction_groupMemoryBarrier_(
+ BuiltInId::groupMemoryBarrier,
+ BuiltInName::groupMemoryBarrier,
+ TExtension::UNDEFINED,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpGroupMemoryBarrier,
+ false);
+constexpr const TFunction kFunction_EmitVertex_(
+ BuiltInId::EmitVertex,
+ BuiltInName::EmitVertex,
+ TExtension::EXT_geometry_shader,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpEmitVertex,
+ false);
+constexpr const TFunction kFunction_EndPrimitive_(
+ BuiltInId::EndPrimitive,
+ BuiltInName::EndPrimitive,
+ TExtension::EXT_geometry_shader,
+ BuiltInParameters::empty,
+ 0,
+ StaticType::Get<EbtVoid, EbpUndefined, EvqGlobal, 1, 1>(),
+ EOpEndPrimitive,
+ false);
+
+} // namespace BuiltInFunction
+
+void TSymbolTable::initializeBuiltInVariables(sh::GLenum shaderType,
+ ShShaderSpec spec,
+ const ShBuiltInResources &resources)
+{
+ const TSourceLoc zeroSourceLoc = {0, 0, 0, 0};
+ TFieldList *fields_gl_DepthRangeParameters = new TFieldList();
+ fields_gl_DepthRangeParameters->push_back(
+ new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1, 1), BuiltInName::near, zeroSourceLoc,
+ SymbolType::BuiltIn));
+ fields_gl_DepthRangeParameters->push_back(
+ new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1, 1), BuiltInName::far, zeroSourceLoc,
+ SymbolType::BuiltIn));
+ fields_gl_DepthRangeParameters->push_back(
+ new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1, 1), BuiltInName::diff, zeroSourceLoc,
+ SymbolType::BuiltIn));
+ TStructure *gl_DepthRangeParameters =
+ new TStructure(BuiltInId::gl_DepthRangeParameters, BuiltInName::gl_DepthRangeParameters,
+ TExtension::UNDEFINED, fields_gl_DepthRangeParameters);
+ mVar_gl_DepthRangeParameters = gl_DepthRangeParameters;
+ TType *type_gl_DepthRange = new TType(gl_DepthRangeParameters, false);
+ type_gl_DepthRange->setQualifier(EvqUniform);
+ type_gl_DepthRange->realize();
+ mVar_gl_DepthRange =
+ new TVariable(BuiltInId::gl_DepthRange, BuiltInName::gl_DepthRange, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, type_gl_DepthRange);
+ mVar_gl_MaxVertexAttribs = new TVariable(
+ BuiltInId::gl_MaxVertexAttribs, BuiltInName::gl_MaxVertexAttribs, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVertexAttribs);
+ mVar_gl_MaxVertexAttribs->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxVertexUniformVectors =
+ new TVariable(BuiltInId::gl_MaxVertexUniformVectors,
+ BuiltInName::gl_MaxVertexUniformVectors, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVertexUniformVectors);
+ mVar_gl_MaxVertexUniformVectors->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxVertexTextureImageUnits =
+ new TVariable(BuiltInId::gl_MaxVertexTextureImageUnits,
+ BuiltInName::gl_MaxVertexTextureImageUnits, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVertexTextureImageUnits);
+ mVar_gl_MaxVertexTextureImageUnits->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxCombinedTextureImageUnits =
+ new TVariable(BuiltInId::gl_MaxCombinedTextureImageUnits,
+ BuiltInName::gl_MaxCombinedTextureImageUnits, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxCombinedTextureImageUnits);
+ mVar_gl_MaxCombinedTextureImageUnits->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxTextureImageUnits =
+ new TVariable(BuiltInId::gl_MaxTextureImageUnits, BuiltInName::gl_MaxTextureImageUnits,
+ SymbolType::BuiltIn, TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxTextureImageUnits);
+ mVar_gl_MaxTextureImageUnits->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxFragmentUniformVectors =
+ new TVariable(BuiltInId::gl_MaxFragmentUniformVectors,
+ BuiltInName::gl_MaxFragmentUniformVectors, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxFragmentUniformVectors);
+ mVar_gl_MaxFragmentUniformVectors->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxVaryingVectors = new TVariable(
+ BuiltInId::gl_MaxVaryingVectors, BuiltInName::gl_MaxVaryingVectors, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVaryingVectors);
+ mVar_gl_MaxVaryingVectors->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxDrawBuffers = new TVariable(
+ BuiltInId::gl_MaxDrawBuffers, BuiltInName::gl_MaxDrawBuffers, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxDrawBuffers);
+ mVar_gl_MaxDrawBuffers->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxDualSourceDrawBuffersEXT = new TVariable(
+ BuiltInId::gl_MaxDualSourceDrawBuffersEXT, BuiltInName::gl_MaxDualSourceDrawBuffersEXT,
+ SymbolType::BuiltIn, TExtension::EXT_blend_func_extended,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxDualSourceDrawBuffers);
+ mVar_gl_MaxDualSourceDrawBuffersEXT->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxVertexOutputVectors =
+ new TVariable(BuiltInId::gl_MaxVertexOutputVectors, BuiltInName::gl_MaxVertexOutputVectors,
+ SymbolType::BuiltIn, TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVertexOutputVectors);
+ mVar_gl_MaxVertexOutputVectors->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxFragmentInputVectors =
+ new TVariable(BuiltInId::gl_MaxFragmentInputVectors,
+ BuiltInName::gl_MaxFragmentInputVectors, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxFragmentInputVectors);
+ mVar_gl_MaxFragmentInputVectors->shareConstPointer(unionArray);
+ }
+ mVar_gl_MinProgramTexelOffset =
+ new TVariable(BuiltInId::gl_MinProgramTexelOffset, BuiltInName::gl_MinProgramTexelOffset,
+ SymbolType::BuiltIn, TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MinProgramTexelOffset);
+ mVar_gl_MinProgramTexelOffset->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxProgramTexelOffset =
+ new TVariable(BuiltInId::gl_MaxProgramTexelOffset, BuiltInName::gl_MaxProgramTexelOffset,
+ SymbolType::BuiltIn, TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxProgramTexelOffset);
+ mVar_gl_MaxProgramTexelOffset->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxImageUnits = new TVariable(
+ BuiltInId::gl_MaxImageUnits, BuiltInName::gl_MaxImageUnits, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxImageUnits);
+ mVar_gl_MaxImageUnits->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxVertexImageUniforms =
+ new TVariable(BuiltInId::gl_MaxVertexImageUniforms, BuiltInName::gl_MaxVertexImageUniforms,
+ SymbolType::BuiltIn, TExtension::UNDEFINED,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVertexImageUniforms);
+ mVar_gl_MaxVertexImageUniforms->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxFragmentImageUniforms =
+ new TVariable(BuiltInId::gl_MaxFragmentImageUniforms,
+ BuiltInName::gl_MaxFragmentImageUniforms, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxFragmentImageUniforms);
+ mVar_gl_MaxFragmentImageUniforms->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxComputeImageUniforms =
+ new TVariable(BuiltInId::gl_MaxComputeImageUniforms,
+ BuiltInName::gl_MaxComputeImageUniforms, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxComputeImageUniforms);
+ mVar_gl_MaxComputeImageUniforms->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxCombinedImageUniforms =
+ new TVariable(BuiltInId::gl_MaxCombinedImageUniforms,
+ BuiltInName::gl_MaxCombinedImageUniforms, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxCombinedImageUniforms);
+ mVar_gl_MaxCombinedImageUniforms->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxCombinedShaderOutputResources =
+ new TVariable(BuiltInId::gl_MaxCombinedShaderOutputResources,
+ BuiltInName::gl_MaxCombinedShaderOutputResources, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxCombinedShaderOutputResources);
+ mVar_gl_MaxCombinedShaderOutputResources->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxComputeWorkGroupCount =
+ new TVariable(BuiltInId::gl_MaxComputeWorkGroupCount,
+ BuiltInName::gl_MaxComputeWorkGroupCount, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpHigh, EvqConst, 3, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[3];
+ for (size_t index = 0u; index < 3; ++index)
+ {
+ unionArray[index].setIConst(resources.MaxComputeWorkGroupCount[index]);
+ }
+ mVar_gl_MaxComputeWorkGroupCount->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxComputeWorkGroupSize =
+ new TVariable(BuiltInId::gl_MaxComputeWorkGroupSize,
+ BuiltInName::gl_MaxComputeWorkGroupSize, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpHigh, EvqConst, 3, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[3];
+ for (size_t index = 0u; index < 3; ++index)
+ {
+ unionArray[index].setIConst(resources.MaxComputeWorkGroupSize[index]);
+ }
+ mVar_gl_MaxComputeWorkGroupSize->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxComputeUniformComponents =
+ new TVariable(BuiltInId::gl_MaxComputeUniformComponents,
+ BuiltInName::gl_MaxComputeUniformComponents, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxComputeUniformComponents);
+ mVar_gl_MaxComputeUniformComponents->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxComputeTextureImageUnits =
+ new TVariable(BuiltInId::gl_MaxComputeTextureImageUnits,
+ BuiltInName::gl_MaxComputeTextureImageUnits, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxComputeTextureImageUnits);
+ mVar_gl_MaxComputeTextureImageUnits->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxComputeAtomicCounters =
+ new TVariable(BuiltInId::gl_MaxComputeAtomicCounters,
+ BuiltInName::gl_MaxComputeAtomicCounters, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxComputeAtomicCounters);
+ mVar_gl_MaxComputeAtomicCounters->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxComputeAtomicCounterBuffers =
+ new TVariable(BuiltInId::gl_MaxComputeAtomicCounterBuffers,
+ BuiltInName::gl_MaxComputeAtomicCounterBuffers, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxComputeAtomicCounterBuffers);
+ mVar_gl_MaxComputeAtomicCounterBuffers->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxVertexAtomicCounters =
+ new TVariable(BuiltInId::gl_MaxVertexAtomicCounters,
+ BuiltInName::gl_MaxVertexAtomicCounters, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVertexAtomicCounters);
+ mVar_gl_MaxVertexAtomicCounters->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxFragmentAtomicCounters =
+ new TVariable(BuiltInId::gl_MaxFragmentAtomicCounters,
+ BuiltInName::gl_MaxFragmentAtomicCounters, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxFragmentAtomicCounters);
+ mVar_gl_MaxFragmentAtomicCounters->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxCombinedAtomicCounters =
+ new TVariable(BuiltInId::gl_MaxCombinedAtomicCounters,
+ BuiltInName::gl_MaxCombinedAtomicCounters, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxCombinedAtomicCounters);
+ mVar_gl_MaxCombinedAtomicCounters->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxAtomicCounterBindings =
+ new TVariable(BuiltInId::gl_MaxAtomicCounterBindings,
+ BuiltInName::gl_MaxAtomicCounterBindings, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxAtomicCounterBindings);
+ mVar_gl_MaxAtomicCounterBindings->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxVertexAtomicCounterBuffers =
+ new TVariable(BuiltInId::gl_MaxVertexAtomicCounterBuffers,
+ BuiltInName::gl_MaxVertexAtomicCounterBuffers, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxVertexAtomicCounterBuffers);
+ mVar_gl_MaxVertexAtomicCounterBuffers->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxFragmentAtomicCounterBuffers =
+ new TVariable(BuiltInId::gl_MaxFragmentAtomicCounterBuffers,
+ BuiltInName::gl_MaxFragmentAtomicCounterBuffers, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxFragmentAtomicCounterBuffers);
+ mVar_gl_MaxFragmentAtomicCounterBuffers->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxCombinedAtomicCounterBuffers =
+ new TVariable(BuiltInId::gl_MaxCombinedAtomicCounterBuffers,
+ BuiltInName::gl_MaxCombinedAtomicCounterBuffers, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxCombinedAtomicCounterBuffers);
+ mVar_gl_MaxCombinedAtomicCounterBuffers->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxAtomicCounterBufferSize =
+ new TVariable(BuiltInId::gl_MaxAtomicCounterBufferSize,
+ BuiltInName::gl_MaxAtomicCounterBufferSize, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxAtomicCounterBufferSize);
+ mVar_gl_MaxAtomicCounterBufferSize->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryInputComponents = new TVariable(
+ BuiltInId::gl_MaxGeometryInputComponents, BuiltInName::gl_MaxGeometryInputComponents,
+ SymbolType::BuiltIn, TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryInputComponents);
+ mVar_gl_MaxGeometryInputComponents->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryOutputComponents = new TVariable(
+ BuiltInId::gl_MaxGeometryOutputComponents, BuiltInName::gl_MaxGeometryOutputComponents,
+ SymbolType::BuiltIn, TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryOutputComponents);
+ mVar_gl_MaxGeometryOutputComponents->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryImageUniforms = new TVariable(
+ BuiltInId::gl_MaxGeometryImageUniforms, BuiltInName::gl_MaxGeometryImageUniforms,
+ SymbolType::BuiltIn, TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryImageUniforms);
+ mVar_gl_MaxGeometryImageUniforms->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryTextureImageUnits = new TVariable(
+ BuiltInId::gl_MaxGeometryTextureImageUnits, BuiltInName::gl_MaxGeometryTextureImageUnits,
+ SymbolType::BuiltIn, TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryTextureImageUnits);
+ mVar_gl_MaxGeometryTextureImageUnits->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryOutputVertices = new TVariable(
+ BuiltInId::gl_MaxGeometryOutputVertices, BuiltInName::gl_MaxGeometryOutputVertices,
+ SymbolType::BuiltIn, TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryOutputVertices);
+ mVar_gl_MaxGeometryOutputVertices->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryTotalOutputComponents = new TVariable(
+ BuiltInId::gl_MaxGeometryTotalOutputComponents,
+ BuiltInName::gl_MaxGeometryTotalOutputComponents, SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryTotalOutputComponents);
+ mVar_gl_MaxGeometryTotalOutputComponents->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryUniformComponents = new TVariable(
+ BuiltInId::gl_MaxGeometryUniformComponents, BuiltInName::gl_MaxGeometryUniformComponents,
+ SymbolType::BuiltIn, TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryUniformComponents);
+ mVar_gl_MaxGeometryUniformComponents->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryAtomicCounters = new TVariable(
+ BuiltInId::gl_MaxGeometryAtomicCounters, BuiltInName::gl_MaxGeometryAtomicCounters,
+ SymbolType::BuiltIn, TExtension::EXT_geometry_shader,
+ StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryAtomicCounters);
+ mVar_gl_MaxGeometryAtomicCounters->shareConstPointer(unionArray);
+ }
+ mVar_gl_MaxGeometryAtomicCounterBuffers = new TVariable(
+ BuiltInId::gl_MaxGeometryAtomicCounterBuffers,
+ BuiltInName::gl_MaxGeometryAtomicCounterBuffers, SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader, StaticType::Get<EbtInt, EbpMedium, EvqConst, 1, 1>());
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray[0].setIConst(resources.MaxGeometryAtomicCounterBuffers);
+ mVar_gl_MaxGeometryAtomicCounterBuffers->shareConstPointer(unionArray);
+ }
+ if (shaderType == GL_FRAGMENT_SHADER)
+ {
+ TType *type_gl_FragData = new TType(EbtFloat, EbpMedium, EvqFragData, 4);
+ if (spec != SH_WEBGL2_SPEC && spec != SH_WEBGL3_SPEC)
+ {
+ type_gl_FragData->makeArray(resources.MaxDrawBuffers);
+ }
+ else
+ {
+ type_gl_FragData->makeArray(1u);
+ }
+ type_gl_FragData->realize();
+ mVar_gl_FragData =
+ new TVariable(BuiltInId::gl_FragData, BuiltInName::gl_FragData, SymbolType::BuiltIn,
+ TExtension::UNDEFINED, type_gl_FragData);
+ }
+ if ((shaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_blend_func_extended))
+ {
+ TType *type_gl_SecondaryFragDataEXT =
+ new TType(EbtFloat, EbpMedium, EvqSecondaryFragDataEXT, 4, 1);
+ type_gl_SecondaryFragDataEXT->makeArray(resources.MaxDualSourceDrawBuffers);
+ type_gl_SecondaryFragDataEXT->realize();
+ mVar_gl_SecondaryFragDataEXT = new TVariable(
+ BuiltInId::gl_SecondaryFragDataEXT, BuiltInName::gl_SecondaryFragDataEXT,
+ SymbolType::BuiltIn, TExtension::EXT_blend_func_extended, type_gl_SecondaryFragDataEXT);
+ }
+ if ((shaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_frag_depth))
+ {
+ TType *type_gl_FragDepthEXT = new TType(
+ EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepthEXT, 1);
+ type_gl_FragDepthEXT->realize();
+ mVar_gl_FragDepthEXT =
+ new TVariable(BuiltInId::gl_FragDepthEXT, BuiltInName::gl_FragDepthEXT,
+ SymbolType::BuiltIn, TExtension::EXT_frag_depth, type_gl_FragDepthEXT);
+ }
+ TType *type_gl_LastFragData = new TType(EbtFloat, EbpMedium, EvqLastFragData, 4, 1);
+ type_gl_LastFragData->makeArray(resources.MaxDrawBuffers);
+ type_gl_LastFragData->realize();
+ mVar_gl_LastFragData =
+ new TVariable(BuiltInId::gl_LastFragData, BuiltInName::gl_LastFragData, SymbolType::BuiltIn,
+ TExtension::EXT_shader_framebuffer_fetch, type_gl_LastFragData);
+ TType *type_gl_LastFragDataNV = new TType(EbtFloat, EbpMedium, EvqLastFragData, 4, 1);
+ type_gl_LastFragDataNV->makeArray(resources.MaxDrawBuffers);
+ type_gl_LastFragDataNV->realize();
+ mVar_gl_LastFragDataNV = new TVariable(
+ BuiltInId::gl_LastFragDataNV, BuiltInName::gl_LastFragData, SymbolType::BuiltIn,
+ TExtension::NV_shader_framebuffer_fetch, type_gl_LastFragDataNV);
+ TFieldList *fields_gl_PerVertex = new TFieldList();
+ fields_gl_PerVertex->push_back(new TField(new TType(EbtFloat, EbpHigh, EvqPosition, 4, 1),
+ BuiltInName::gl_Position, zeroSourceLoc,
+ SymbolType::BuiltIn));
+ TInterfaceBlock *gl_PerVertex =
+ new TInterfaceBlock(BuiltInId::gl_PerVertex, BuiltInName::gl_PerVertex,
+ TExtension::EXT_geometry_shader, fields_gl_PerVertex);
+ mVar_gl_PerVertex = gl_PerVertex;
+ if (shaderType == GL_GEOMETRY_SHADER_EXT)
+ {
+ TType *type_gl_in = new TType(gl_PerVertex, EvqPerVertexIn, TLayoutQualifier::Create());
+ type_gl_in->makeArray(0u);
+ type_gl_in->realize();
+ mVar_gl_in = new TVariable(BuiltInId::gl_in, BuiltInName::gl_in, SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader, type_gl_in);
+ }
+ TFieldList *fields_gl_PerVertexOutBlock = new TFieldList();
+ fields_gl_PerVertexOutBlock->push_back(
+ new TField(new TType(EbtFloat, EbpHigh, EvqPosition, 4, 1), BuiltInName::gl_Position,
+ zeroSourceLoc, SymbolType::BuiltIn));
+ TInterfaceBlock *gl_PerVertexOutBlock =
+ new TInterfaceBlock(BuiltInId::gl_PerVertexOutBlock, BuiltInName::gl_PerVertex,
+ TExtension::EXT_geometry_shader, fields_gl_PerVertexOutBlock);
+ TType *type_gl_PositionGS = new TType(EbtFloat, EbpHigh, EvqPosition, 4);
+ type_gl_PositionGS->setInterfaceBlock(gl_PerVertexOutBlock);
+ type_gl_PositionGS->realize();
+ mVar_gl_PositionGS =
+ new TVariable(BuiltInId::gl_PositionGS, BuiltInName::gl_Position, SymbolType::BuiltIn,
+ TExtension::EXT_geometry_shader, type_gl_PositionGS);
+}
+
+const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shaderVersion) const
+{
+ if (name.length() > 35)
+ {
+ return nullptr;
+ }
+ uint32_t nameHash = name.mangledNameHash();
+ if ((nameHash >> 31) != 0)
+ {
+ // The name contains [ or {.
+ return nullptr;
+ }
+ if (shaderVersion >= 310)
+ {
+ switch (nameHash)
+ {
+ case 0x0a50832eu:
+ {
+ if (name.beginsWith(BuiltInName::ldexp))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_ldexp_1B1C;
+ }
+ break;
+ }
+ case 0x0a50a6eeu:
+ {
+ if (name.beginsWith(BuiltInName::frexp))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_frexp_2B2C;
+ }
+ break;
+ }
+ case 0x0a52bed1u:
+ {
+ if (name.beginsWith(BuiltInName::ldexp))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_ldexp_0B0C;
+ }
+ break;
+ }
+ case 0x0a53e9c4u:
+ {
+ if (name == BuiltInName::frexp_3B3C)
+ {
+ return &BuiltInFunction::kFunction_frexp_3B3C;
+ }
+ break;
+ }
+ case 0x0a54aa52u:
+ {
+ if (name.beginsWith(BuiltInName::ldexp))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_ldexp_2B2C;
+ }
+ break;
+ }
+ case 0x0a55008fu:
+ {
+ if (name.beginsWith(BuiltInName::frexp))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_frexp_1B1C;
+ }
+ break;
+ }
+ case 0x0a5799e7u:
+ {
+ if (name.beginsWith(BuiltInName::frexp))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_frexp_0B0C;
+ }
+ break;
+ }
+ case 0x0a57c201u:
+ {
+ if (name.beginsWith(BuiltInName::ldexp))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_ldexp_3B3C;
+ }
+ break;
+ }
+ case 0x0e500330u:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_3C;
+ }
+ break;
+ }
+ case 0x0e503089u:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_3D;
+ }
+ break;
+ }
+ case 0x0e508070u:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_0C;
+ }
+ break;
+ }
+ case 0x0e508a05u:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_0D;
+ }
+ break;
+ }
+ case 0x0e51917du:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_1C;
+ }
+ break;
+ }
+ case 0x0e51dc78u:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_1D;
+ }
+ break;
+ }
+ case 0x0e54832eu:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_2C;
+ }
+ break;
+ }
+ case 0x0e54b667u:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_2D;
+ }
+ break;
+ }
+ case 0x0e550f72u:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_1D;
+ }
+ break;
+ }
+ case 0x0e5514e7u:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_1C;
+ }
+ break;
+ }
+ case 0x0e5607c2u:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_0C;
+ }
+ break;
+ }
+ case 0x0e5650c7u:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_0D;
+ }
+ break;
+ }
+ case 0x0e56a99cu:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_2D;
+ }
+ break;
+ }
+ case 0x0e56cd55u:
+ {
+ if (name.beginsWith(BuiltInName::findMSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findMSB_2C;
+ }
+ break;
+ }
+ case 0x0e573680u:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_3D;
+ }
+ break;
+ }
+ case 0x0e574a59u:
+ {
+ if (name.beginsWith(BuiltInName::findLSB))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_findLSB_3C;
+ }
+ break;
+ }
+ case 0x10581cccu:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_2D;
+ }
+ break;
+ }
+ case 0x10584c2du:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_2C;
+ }
+ break;
+ }
+ case 0x105896f1u:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_1D;
+ }
+ break;
+ }
+ case 0x1058cbf7u:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_1C;
+ }
+ break;
+ }
+ case 0x1059a37cu:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_0D;
+ }
+ break;
+ }
+ case 0x1059dae9u:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_0C;
+ }
+ break;
+ }
+ case 0x105b1832u:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_3C;
+ }
+ break;
+ }
+ case 0x105b2810u:
+ {
+ if (name.beginsWith(BuiltInName::bitCount))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_bitCount_3D;
+ }
+ break;
+ }
+ case 0x106a2daeu:
+ {
+ if (name.beginsWith(BuiltInName::atomicOr))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_atomicOr_0D0D;
+ }
+ break;
+ }
+ case 0x106bd5b6u:
+ {
+ if (name.beginsWith(BuiltInName::atomicOr))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_atomicOr_0C0C;
+ }
+ break;
+ }
+ case 0x126520f8u:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0p;
+ }
+ break;
+ }
+ case 0x12653967u:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0q;
+ }
+ break;
+ }
+ case 0x1265b53eu:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0g;
+ }
+ break;
+ }
+ case 0x1265cbcau:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0k;
+ }
+ break;
+ }
+ case 0x1265cc8du:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0f;
+ }
+ break;
+ }
+ case 0x1265e196u:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0o;
+ }
+ break;
+ }
+ case 0x1265e603u:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0h;
+ }
+ break;
+ }
+ case 0x1265f559u:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0j;
+ }
+ break;
+ }
+ case 0x1265fcacu:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0i;
+ }
+ break;
+ }
+ case 0x12660ccfu:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0l;
+ }
+ break;
+ }
+ case 0x12661578u:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0m;
+ }
+ break;
+ }
+ case 0x12661be5u:
+ {
+ if (name.beginsWith(BuiltInName::imageSize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_imageSize_0n;
+ }
+ break;
+ }
+ case 0x12700109u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0h1C;
+ }
+ break;
+ }
+ case 0x1270b3f8u:
+ {
+ if (name.beginsWith(BuiltInName::atomicAdd))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicAdd_0C0C;
+ }
+ break;
+ }
+ case 0x1270b766u:
+ {
+ if (name.beginsWith(BuiltInName::atomicXor))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicXor_0C0C;
+ }
+ break;
+ }
+ case 0x12712664u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0n2C;
+ }
+ break;
+ }
+ case 0x12715f47u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0j2C;
+ }
+ break;
+ }
+ case 0x12717c89u:
+ {
+ if (name.beginsWith(BuiltInName::atomicMin))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicMin_0C0C;
+ }
+ break;
+ }
+ case 0x127258f0u:
+ {
+ if (name.beginsWith(BuiltInName::atomicAdd))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicAdd_0D0D;
+ }
+ break;
+ }
+ case 0x12731984u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0m2C;
+ }
+ break;
+ }
+ case 0x12737ed6u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0q2C;
+ }
+ break;
+ }
+ case 0x12739c87u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0f1C;
+ }
+ break;
+ }
+ case 0x1273d1adu:
+ {
+ if (name.beginsWith(BuiltInName::atomicMax))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicMax_0D0D;
+ }
+ break;
+ }
+ case 0x1273e62au:
+ {
+ if (name.beginsWith(BuiltInName::atomicMin))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicMin_0D0D;
+ }
+ break;
+ }
+ case 0x12744c0du:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0o2C;
+ }
+ break;
+ }
+ case 0x127474cau:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0k2C;
+ }
+ break;
+ }
+ case 0x127478d9u:
+ {
+ if (name.beginsWith(BuiltInName::atomicAnd))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicAnd_0C0C;
+ }
+ break;
+ }
+ case 0x1274d54bu:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0p2C;
+ }
+ break;
+ }
+ case 0x127539b2u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0i2C;
+ }
+ break;
+ }
+ case 0x12755603u:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0g1C;
+ }
+ break;
+ }
+ case 0x127648cau:
+ {
+ if (name.beginsWith(BuiltInName::atomicAnd))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicAnd_0D0D;
+ }
+ break;
+ }
+ case 0x1276656cu:
+ {
+ if (name.beginsWith(BuiltInName::imageLoad))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_imageLoad_0l2C;
+ }
+ break;
+ }
+ case 0x12771119u:
+ {
+ if (name.beginsWith(BuiltInName::atomicXor))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicXor_0D0D;
+ }
+ break;
+ }
+ case 0x1277882au:
+ {
+ if (name.beginsWith(BuiltInName::atomicMax))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_atomicMax_0C0C;
+ }
+ break;
+ }
+ case 0x1283ba95u:
+ {
+ if (name.beginsWith(BuiltInName::uaddCarry))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_uaddCarry_0D0D0D;
+ }
+ break;
+ }
+ case 0x12840dfbu:
+ {
+ if (name == BuiltInName::uaddCarry_2D2D2D)
+ {
+ return &BuiltInFunction::kFunction_uaddCarry_2D2D2D;
+ }
+ break;
+ }
+ case 0x12842566u:
+ {
+ if (name == BuiltInName::uaddCarry_3D3D3D)
+ {
+ return &BuiltInFunction::kFunction_uaddCarry_3D3D3D;
+ }
+ break;
+ }
+ case 0x12843bc0u:
+ {
+ if (name.beginsWith(BuiltInName::uaddCarry))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_uaddCarry_1D1D1D;
+ }
+ break;
+ }
+ case 0x1488078cu:
+ {
+ if (name.beginsWith(BuiltInName::imageStore))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_imageStore_0k2C3D;
+ }
+ break;
+ }
+ case 0x14880e11u:
+ {
+ if (name == BuiltInName::texelFetch_0V2C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0V2C0C;
+ }
+ break;
+ }
+ case 0x1488ffa7u:
+ {
+ if (name == BuiltInName::usubBorrow_3D3D3D)
+ {
+ return &BuiltInFunction::kFunction_usubBorrow_3D3D3D;
+ }
+ break;
+ }
+ case 0x1489244fu:
+ {
+ if (name.beginsWith(BuiltInName::texelFetch))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetch_0b2C0C;
+ }
+ break;
+ }
+ case 0x14896692u:
+ {
+ if (name.beginsWith(BuiltInName::usubBorrow))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_usubBorrow_2D2D2D;
+ }
+ break;
+ }
+ case 0x14896e41u:
+ {
+ if (name == BuiltInName::texelFetch_0O1C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0O1C0C;
+ }
+ break;
+ }
+ case 0x148a0cecu:
+ {
+ if (name == BuiltInName::imageStore_0p2C3C)
+ {
+ return &BuiltInFunction::kFunction_imageStore_0p2C3C;
+ }
+ break;
+ }
+ case 0x148ab5f1u:
+ {
+ if (name == BuiltInName::usubBorrow_1D1D1D)
+ {
+ return &BuiltInFunction::kFunction_usubBorrow_1D1D1D;
+ }
+ break;
+ }
+ case 0x148bb1bdu:
+ {
+ if (name.beginsWith(BuiltInName::imageStore))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_imageStore_0g1C3C;
+ }
+ break;
+ }
+ case 0x148c1e41u:
+ {
+ if (name.beginsWith(BuiltInName::imageStore))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_imageStore_0q2C3D;
+ }
+ break;
+ }
+ case 0x148d86dcu:
+ {
+ if (name.beginsWith(BuiltInName::imageStore))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_imageStore_0f1C3B;
+ }
+ break;
+ }
+ case 0x148dcfd5u:
+ {
+ if (name == BuiltInName::imageStore_0l2C3B)
+ {
+ return &BuiltInFunction::kFunction_imageStore_0l2C3B;
+ }
+ break;
+ }
+ case 0x148ddb10u:
+ {
+ if (name.beginsWith(BuiltInName::texelFetch))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetch_0a1C0C;
+ }
+ break;
+ }
+ case 0x148e37b8u:
+ {
+ if (name.beginsWith(BuiltInName::imageStore))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_imageStore_0m2C3C;
+ }
+ break;
+ }
+ case 0x148e668au:
+ {
+ if (name == BuiltInName::imageStore_0j2C3C)
+ {
+ return &BuiltInFunction::kFunction_imageStore_0j2C3C;
+ }
+ break;
+ }
+ case 0x148e872bu:
+ {
+ if (name == BuiltInName::texelFetch_0P2C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0P2C0C;
+ }
+ break;
+ }
+ case 0x148ed16fu:
+ {
+ if (name.beginsWith(BuiltInName::texelFetch))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetch_0U1C0C;
+ }
+ break;
+ }
+ case 0x148ed534u:
+ {
+ if (name == BuiltInName::imageStore_0n2C3D)
+ {
+ return &BuiltInFunction::kFunction_imageStore_0n2C3D;
+ }
+ break;
+ }
+ case 0x148f6fe1u:
+ {
+ if (name == BuiltInName::usubBorrow_0D0D0D)
+ {
+ return &BuiltInFunction::kFunction_usubBorrow_0D0D0D;
+ }
+ break;
+ }
+ case 0x148f7a82u:
+ {
+ if (name.beginsWith(BuiltInName::imageStore))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_imageStore_0o2C3B;
+ }
+ break;
+ }
+ case 0x148fd5f1u:
+ {
+ if (name.beginsWith(BuiltInName::imageStore))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_imageStore_0i2C3B;
+ }
+ break;
+ }
+ case 0x148ffee8u:
+ {
+ if (name == BuiltInName::imageStore_0h1C3D)
+ {
+ return &BuiltInFunction::kFunction_imageStore_0h1C3D;
+ }
+ break;
+ }
+ case 0x167394d8u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSize_0U;
+ }
+ break;
+ }
+ case 0x1673a791u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSize_0V;
+ }
+ break;
+ }
+ case 0x1673b4b7u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSize_0P;
+ }
+ break;
+ }
+ case 0x1673f496u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSize_0O;
+ }
+ break;
+ }
+ case 0x16752ab6u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSize_0a;
+ }
+ break;
+ }
+ case 0x1675566fu:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSize_0b;
+ }
+ break;
+ }
+ case 0x187b7b7cu:
+ {
+ if (name.beginsWith(BuiltInName::packSnorm4x8))
+ {
+ ASSERT(name.length() == 15);
+ return &BuiltInFunction::kFunction_packSnorm4x8_3B;
+ }
+ break;
+ }
+ case 0x187c1f3fu:
+ {
+ if (name.beginsWith(BuiltInName::packUnorm4x8))
+ {
+ ASSERT(name.length() == 15);
+ return &BuiltInFunction::kFunction_packUnorm4x8_3B;
+ }
+ break;
+ }
+ case 0x18a851efu:
+ {
+ if (name == BuiltInName::imulExtended_2C2C2C2C)
+ {
+ return &BuiltInFunction::kFunction_imulExtended_2C2C2C2C;
+ }
+ break;
+ }
+ case 0x18a93bdcu:
+ {
+ if (name == BuiltInName::umulExtended_0D0D0D0D)
+ {
+ return &BuiltInFunction::kFunction_umulExtended_0D0D0D0D;
+ }
+ break;
+ }
+ case 0x18a94b63u:
+ {
+ if (name == BuiltInName::umulExtended_3D3D3D3D)
+ {
+ return &BuiltInFunction::kFunction_umulExtended_3D3D3D3D;
+ }
+ break;
+ }
+ case 0x18aa71ceu:
+ {
+ if (name == BuiltInName::umulExtended_2D2D2D2D)
+ {
+ return &BuiltInFunction::kFunction_umulExtended_2D2D2D2D;
+ }
+ break;
+ }
+ case 0x18ab4baeu:
+ {
+ if (name == BuiltInName::umulExtended_1D1D1D1D)
+ {
+ return &BuiltInFunction::kFunction_umulExtended_1D1D1D1D;
+ }
+ break;
+ }
+ case 0x18ac1df0u:
+ {
+ if (name == BuiltInName::imulExtended_3C3C3C3C)
+ {
+ return &BuiltInFunction::kFunction_imulExtended_3C3C3C3C;
+ }
+ break;
+ }
+ case 0x18ac377fu:
+ {
+ if (name == BuiltInName::imulExtended_0C0C0C0C)
+ {
+ return &BuiltInFunction::kFunction_imulExtended_0C0C0C0C;
+ }
+ break;
+ }
+ case 0x18ae7b8cu:
+ {
+ if (name == BuiltInName::imulExtended_1C1C1C1C)
+ {
+ return &BuiltInFunction::kFunction_imulExtended_1C1C1C1C;
+ }
+ break;
+ }
+ case 0x1a7538dfu:
+ {
+ if (name.beginsWith(BuiltInName::memoryBarrier))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_memoryBarrier_;
+ }
+ break;
+ }
+ case 0x1a805162u:
+ {
+ if (name.beginsWith(BuiltInName::atomicCounter))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_atomicCounter_0F;
+ }
+ break;
+ }
+ case 0x1a910beau:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0Y2B;
+ }
+ break;
+ }
+ case 0x1a91963cu:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0d2B;
+ }
+ break;
+ }
+ case 0x1a926b0du:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0c1B;
+ }
+ break;
+ }
+ case 0x1a92a168u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0W1B;
+ }
+ break;
+ }
+ case 0x1a92a1ceu:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0H1B;
+ }
+ break;
+ }
+ case 0x1a92c882u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0Q1B;
+ }
+ break;
+ }
+ case 0x1a9418e8u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0S2B;
+ }
+ break;
+ }
+ case 0x1a94543du:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0K2B;
+ }
+ break;
+ }
+ case 0x1a94d27du:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0e2B;
+ }
+ break;
+ }
+ case 0x1a94eb48u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0Z2B;
+ }
+ break;
+ }
+ case 0x1a95f707u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0T2B;
+ }
+ break;
+ }
+ case 0x1a979ae3u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureGather_0J2B;
+ }
+ break;
+ }
+ case 0x1aa039c7u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0e2B0B;
+ }
+ break;
+ }
+ case 0x1aa133bcu:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0Q1B0C;
+ }
+ break;
+ }
+ case 0x1aa17115u:
+ {
+ if (name == BuiltInName::textureGather_0Z2B0C)
+ {
+ return &BuiltInFunction::kFunction_textureGather_0Z2B0C;
+ }
+ break;
+ }
+ case 0x1aa182eeu:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0c1B0B;
+ }
+ break;
+ }
+ case 0x1aa220b0u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0W1B0C;
+ }
+ break;
+ }
+ case 0x1aa2aafeu:
+ {
+ if (name == BuiltInName::textureGather_0T2B0C)
+ {
+ return &BuiltInFunction::kFunction_textureGather_0T2B0C;
+ }
+ break;
+ }
+ case 0x1aa353f8u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0d2B0B;
+ }
+ break;
+ }
+ case 0x1aa3ef46u:
+ {
+ if (name == BuiltInName::textureGather_0S2B0C)
+ {
+ return &BuiltInFunction::kFunction_textureGather_0S2B0C;
+ }
+ break;
+ }
+ case 0x1aa4986bu:
+ {
+ if (name == BuiltInName::textureGather_0J2B0C)
+ {
+ return &BuiltInFunction::kFunction_textureGather_0J2B0C;
+ }
+ break;
+ }
+ case 0x1aa4c59du:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0H1B0C;
+ }
+ break;
+ }
+ case 0x1aa78b86u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0K2B0C;
+ }
+ break;
+ }
+ case 0x1aa7fa48u:
+ {
+ if (name.beginsWith(BuiltInName::textureGather))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureGather_0Y2B0C;
+ }
+ break;
+ }
+ case 0x1c894fb3u:
+ {
+ if (name.beginsWith(BuiltInName::unpackSnorm4x8))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_unpackSnorm4x8_0D;
+ }
+ break;
+ }
+ case 0x1c8be3bau:
+ {
+ if (name.beginsWith(BuiltInName::unpackUnorm4x8))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_unpackUnorm4x8_0D;
+ }
+ break;
+ }
+ case 0x1c9986beu:
+ {
+ if (name.beginsWith(BuiltInName::atomicExchange))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_atomicExchange_0D0D;
+ }
+ break;
+ }
+ case 0x1c9b5eecu:
+ {
+ if (name.beginsWith(BuiltInName::atomicExchange))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_atomicExchange_0C0C;
+ }
+ break;
+ }
+ case 0x1ca86085u:
+ {
+ if (name.beginsWith(BuiltInName::atomicCompSwap))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_atomicCompSwap_0C0C0C;
+ }
+ break;
+ }
+ case 0x1caa900cu:
+ {
+ if (name == BuiltInName::atomicCompSwap_0D0D0D)
+ {
+ return &BuiltInFunction::kFunction_atomicCompSwap_0D0D0D;
+ }
+ break;
+ }
+ case 0x1cb84b0cu:
+ {
+ if (name == BuiltInName::bitfieldInsert_3D3D0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_3D3D0C0C;
+ }
+ break;
+ }
+ case 0x1cb880bfu:
+ {
+ if (name == BuiltInName::bitfieldInsert_3C3C0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_3C3C0C0C;
+ }
+ break;
+ }
+ case 0x1cb90fd0u:
+ {
+ if (name == BuiltInName::bitfieldInsert_1C1C0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_1C1C0C0C;
+ }
+ break;
+ }
+ case 0x1cb9fb13u:
+ {
+ if (name == BuiltInName::bitfieldInsert_1D1D0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_1D1D0C0C;
+ }
+ break;
+ }
+ case 0x1cbb43f5u:
+ {
+ if (name == BuiltInName::bitfieldInsert_0D0D0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_0D0D0C0C;
+ }
+ break;
+ }
+ case 0x1cbb9db3u:
+ {
+ if (name == BuiltInName::bitfieldInsert_2D2D0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_2D2D0C0C;
+ }
+ break;
+ }
+ case 0x1cbdf898u:
+ {
+ if (name == BuiltInName::bitfieldInsert_0C0C0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_0C0C0C0C;
+ }
+ break;
+ }
+ case 0x1cbfaf73u:
+ {
+ if (name == BuiltInName::bitfieldInsert_2C2C0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldInsert_2C2C0C0C;
+ }
+ break;
+ }
+ case 0x1e907f62u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_3D;
+ }
+ break;
+ }
+ case 0x1e9088f7u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_3C;
+ }
+ break;
+ }
+ case 0x1e91c654u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_0C;
+ }
+ break;
+ }
+ case 0x1e91e675u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_0D;
+ }
+ break;
+ }
+ case 0x1e96ddc2u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_1D;
+ }
+ break;
+ }
+ case 0x1e970da3u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_1C;
+ }
+ break;
+ }
+ case 0x1e9744d7u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_2D;
+ }
+ break;
+ }
+ case 0x1e9797d2u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldReverse))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_bitfieldReverse_2C;
+ }
+ break;
+ }
+ case 0x1eb0c64fu:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldExtract))
+ {
+ ASSERT(name.length() == 22);
+ return &BuiltInFunction::kFunction_bitfieldExtract_2C0C0C;
+ }
+ break;
+ }
+ case 0x1eb0f9fau:
+ {
+ if (name == BuiltInName::bitfieldExtract_0D0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldExtract_0D0C0C;
+ }
+ break;
+ }
+ case 0x1eb12f29u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldExtract))
+ {
+ ASSERT(name.length() == 22);
+ return &BuiltInFunction::kFunction_bitfieldExtract_3D0C0C;
+ }
+ break;
+ }
+ case 0x1eb17d11u:
+ {
+ if (name == BuiltInName::bitfieldExtract_3C0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldExtract_3C0C0C;
+ }
+ break;
+ }
+ case 0x1eb17f7du:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldExtract))
+ {
+ ASSERT(name.length() == 22);
+ return &BuiltInFunction::kFunction_bitfieldExtract_0C0C0C;
+ }
+ break;
+ }
+ case 0x1eb19a50u:
+ {
+ if (name == BuiltInName::bitfieldExtract_1C0C0C)
+ {
+ return &BuiltInFunction::kFunction_bitfieldExtract_1C0C0C;
+ }
+ break;
+ }
+ case 0x1eb28b55u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldExtract))
+ {
+ ASSERT(name.length() == 22);
+ return &BuiltInFunction::kFunction_bitfieldExtract_2D0C0C;
+ }
+ break;
+ }
+ case 0x1eb5f0c8u:
+ {
+ if (name.beginsWith(BuiltInName::bitfieldExtract))
+ {
+ ASSERT(name.length() == 22);
+ return &BuiltInFunction::kFunction_bitfieldExtract_1D0C0C;
+ }
+ break;
+ }
+ case 0x249e7359u:
+ {
+ if (name.beginsWith(BuiltInName::memoryBarrierImage))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_memoryBarrierImage_;
+ }
+ break;
+ }
+ case 0x26a7e24bu:
+ {
+ if (name.beginsWith(BuiltInName::memoryBarrierBuffer))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_memoryBarrierBuffer_;
+ }
+ break;
+ }
+ case 0x26d00e91u:
+ {
+ if (name == BuiltInName::textureGatherOffset_0W1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0W1B1C;
+ }
+ break;
+ }
+ case 0x26d0b451u:
+ {
+ if (name.beginsWith(BuiltInName::textureGatherOffset))
+ {
+ ASSERT(name.length() == 26);
+ return &BuiltInFunction::kFunction_textureGatherOffset_0Q1B1C;
+ }
+ break;
+ }
+ case 0x26d0db41u:
+ {
+ if (name.beginsWith(BuiltInName::textureGatherOffset))
+ {
+ ASSERT(name.length() == 26);
+ return &BuiltInFunction::kFunction_textureGatherOffset_0Z2B1C;
+ }
+ break;
+ }
+ case 0x26d1f440u:
+ {
+ if (name.beginsWith(BuiltInName::textureGatherOffset))
+ {
+ ASSERT(name.length() == 26);
+ return &BuiltInFunction::kFunction_textureGatherOffset_0K2B1C;
+ }
+ break;
+ }
+ case 0x26d2d875u:
+ {
+ if (name == BuiltInName::textureGatherOffset_0T2B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0T2B1C;
+ }
+ break;
+ }
+ case 0x26d71952u:
+ {
+ if (name.beginsWith(BuiltInName::textureGatherOffset))
+ {
+ ASSERT(name.length() == 26);
+ return &BuiltInFunction::kFunction_textureGatherOffset_0H1B1C;
+ }
+ break;
+ }
+ case 0x26e1982cu:
+ {
+ if (name == BuiltInName::textureGatherOffset_0T2B1C0C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0T2B1C0C;
+ }
+ break;
+ }
+ case 0x26e459f8u:
+ {
+ if (name == BuiltInName::textureGatherOffset_0K2B1C0C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0K2B1C0C;
+ }
+ break;
+ }
+ case 0x26e476d0u:
+ {
+ if (name == BuiltInName::textureGatherOffset_0H1B1C0C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0H1B1C0C;
+ }
+ break;
+ }
+ case 0x26e47c82u:
+ {
+ if (name == BuiltInName::textureGatherOffset_0Z2B1C0C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0Z2B1C0C;
+ }
+ break;
+ }
+ case 0x26e53ca1u:
+ {
+ if (name == BuiltInName::textureGatherOffset_0e2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0e2B0B1C;
+ }
+ break;
+ }
+ case 0x26e567feu:
+ {
+ if (name == BuiltInName::textureGatherOffset_0Q1B1C0C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0Q1B1C0C;
+ }
+ break;
+ }
+ case 0x26e580eau:
+ {
+ if (name == BuiltInName::textureGatherOffset_0c1B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0c1B0B1C;
+ }
+ break;
+ }
+ case 0x26e737a0u:
+ {
+ if (name == BuiltInName::textureGatherOffset_0W1B1C0C)
+ {
+ return &BuiltInFunction::kFunction_textureGatherOffset_0W1B1C0C;
+ }
+ break;
+ }
+ case 0x2ccf8f34u:
+ {
+ if (name.beginsWith(BuiltInName::atomicCounterIncrement))
+ {
+ ASSERT(name.length() == 25);
+ return &BuiltInFunction::kFunction_atomicCounterIncrement_0F;
+ }
+ break;
+ }
+ case 0x2ccfbbbeu:
+ {
+ if (name.beginsWith(BuiltInName::atomicCounterDecrement))
+ {
+ ASSERT(name.length() == 25);
+ return &BuiltInFunction::kFunction_atomicCounterDecrement_0F;
+ }
+ break;
+ }
+ case 0x34ded18du:
+ {
+ if (name.beginsWith(BuiltInName::memoryBarrierAtomicCounter))
+ {
+ ASSERT(name.length() == 27);
+ return &BuiltInFunction::kFunction_memoryBarrierAtomicCounter_;
+ }
+ break;
+ }
+ case 0x7e2bef7au:
+ {
+ if (name == BuiltInName::gl_in)
+ {
+ // Only initialized if shaderType == GL_GEOMETRY_SHADER_EXT
+ return mVar_gl_in;
+ }
+ break;
+ }
+ case 0x7e8166efu:
+ {
+ if (name == BuiltInName::gl_MaxImageUnits)
+ {
+ return mVar_gl_MaxImageUnits;
+ }
+ break;
+ }
+ case 0x7ecf4a1bu:
+ {
+ if (name == BuiltInName::gl_MaxVertexImageUniforms)
+ {
+ return mVar_gl_MaxVertexImageUniforms;
+ }
+ break;
+ }
+ case 0x7ed27574u:
+ {
+ if (name == BuiltInName::gl_MaxVertexAtomicCounters)
+ {
+ return mVar_gl_MaxVertexAtomicCounters;
+ }
+ break;
+ }
+ case 0x7ed2bd5cu:
+ {
+ if (name == BuiltInName::gl_MaxComputeImageUniforms)
+ {
+ return mVar_gl_MaxComputeImageUniforms;
+ }
+ break;
+ }
+ case 0x7ed77973u:
+ {
+ if (name == BuiltInName::gl_MaxComputeWorkGroupSize)
+ {
+ return mVar_gl_MaxComputeWorkGroupSize;
+ }
+ break;
+ }
+ case 0x7ed9ae57u:
+ {
+ if (name == BuiltInName::gl_MaxCombinedImageUniforms)
+ {
+ return mVar_gl_MaxCombinedImageUniforms;
+ }
+ break;
+ }
+ case 0x7ed9f437u:
+ {
+ if (name == BuiltInName::gl_MaxGeometryImageUniforms)
+ {
+ return mVar_gl_MaxGeometryImageUniforms;
+ }
+ break;
+ }
+ case 0x7edacc17u:
+ {
+ if (name == BuiltInName::gl_MaxAtomicCounterBindings)
+ {
+ return mVar_gl_MaxAtomicCounterBindings;
+ }
+ break;
+ }
+ case 0x7ede0db3u:
+ {
+ if (name == BuiltInName::gl_MaxComputeAtomicCounters)
+ {
+ return mVar_gl_MaxComputeAtomicCounters;
+ }
+ break;
+ }
+ case 0x7edeadeeu:
+ {
+ if (name == BuiltInName::gl_MaxComputeWorkGroupCount)
+ {
+ return mVar_gl_MaxComputeWorkGroupCount;
+ }
+ break;
+ }
+ case 0x7edf534au:
+ {
+ if (name == BuiltInName::gl_MaxFragmentImageUniforms)
+ {
+ return mVar_gl_MaxFragmentImageUniforms;
+ }
+ break;
+ }
+ case 0x7ee1b439u:
+ {
+ if (name == BuiltInName::gl_MaxGeometryOutputVertices)
+ {
+ return mVar_gl_MaxGeometryOutputVertices;
+ }
+ break;
+ }
+ case 0x7ee23dcau:
+ {
+ if (name == BuiltInName::gl_MaxFragmentAtomicCounters)
+ {
+ return mVar_gl_MaxFragmentAtomicCounters;
+ }
+ break;
+ }
+ case 0x7ee400c5u:
+ {
+ if (name == BuiltInName::gl_MaxCombinedAtomicCounters)
+ {
+ return mVar_gl_MaxCombinedAtomicCounters;
+ }
+ break;
+ }
+ case 0x7ee6d3cfu:
+ {
+ if (name == BuiltInName::gl_MaxGeometryAtomicCounters)
+ {
+ return mVar_gl_MaxGeometryAtomicCounters;
+ }
+ break;
+ }
+ case 0x7eec3ae1u:
+ {
+ if (name == BuiltInName::gl_MaxGeometryInputComponents)
+ {
+ return mVar_gl_MaxGeometryInputComponents;
+ }
+ break;
+ }
+ case 0x7eecdfadu:
+ {
+ if (name == BuiltInName::gl_MaxAtomicCounterBufferSize)
+ {
+ return mVar_gl_MaxAtomicCounterBufferSize;
+ }
+ break;
+ }
+ case 0x7ef00fc2u:
+ {
+ if (name == BuiltInName::gl_MaxComputeTextureImageUnits)
+ {
+ return mVar_gl_MaxComputeTextureImageUnits;
+ }
+ break;
+ }
+ case 0x7ef3740bu:
+ {
+ if (name == BuiltInName::gl_MaxComputeUniformComponents)
+ {
+ return mVar_gl_MaxComputeUniformComponents;
+ }
+ break;
+ }
+ case 0x7ef69ab4u:
+ {
+ if (name == BuiltInName::gl_MaxGeometryOutputComponents)
+ {
+ return mVar_gl_MaxGeometryOutputComponents;
+ }
+ break;
+ }
+ case 0x7ef9b17du:
+ {
+ if (name == BuiltInName::gl_MaxGeometryTextureImageUnits)
+ {
+ return mVar_gl_MaxGeometryTextureImageUnits;
+ }
+ break;
+ }
+ case 0x7efe1865u:
+ {
+ if (name == BuiltInName::gl_MaxGeometryUniformComponents)
+ {
+ return mVar_gl_MaxGeometryUniformComponents;
+ }
+ break;
+ }
+ case 0x7f008375u:
+ {
+ if (name == BuiltInName::gl_MaxVertexAtomicCounterBuffers)
+ {
+ return mVar_gl_MaxVertexAtomicCounterBuffers;
+ }
+ break;
+ }
+ case 0x7f0d626fu:
+ {
+ if (name == BuiltInName::gl_MaxComputeAtomicCounterBuffers)
+ {
+ return mVar_gl_MaxComputeAtomicCounterBuffers;
+ }
+ break;
+ }
+ case 0x7f11e359u:
+ {
+ if (name == BuiltInName::gl_MaxCombinedAtomicCounterBuffers)
+ {
+ return mVar_gl_MaxCombinedAtomicCounterBuffers;
+ }
+ break;
+ }
+ case 0x7f170f84u:
+ {
+ if (name == BuiltInName::gl_MaxGeometryAtomicCounterBuffers)
+ {
+ return mVar_gl_MaxGeometryAtomicCounterBuffers;
+ }
+ break;
+ }
+ case 0x7f17bd18u:
+ {
+ if (name == BuiltInName::gl_MaxFragmentAtomicCounterBuffers)
+ {
+ return mVar_gl_MaxFragmentAtomicCounterBuffers;
+ }
+ break;
+ }
+ case 0x7f1c60f8u:
+ {
+ if (name == BuiltInName::gl_MaxCombinedShaderOutputResources)
+ {
+ return mVar_gl_MaxCombinedShaderOutputResources;
+ }
+ break;
+ }
+ case 0x7f1cd073u:
+ {
+ if (name == BuiltInName::gl_MaxGeometryTotalOutputComponents)
+ {
+ return mVar_gl_MaxGeometryTotalOutputComponents;
+ }
+ break;
+ }
+ }
+ if (mShaderType == GL_COMPUTE_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x0e41a660u:
+ {
+ if (name.beginsWith(BuiltInName::barrier))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_barrier_;
+ }
+ break;
+ }
+ case 0x249ee97cu:
+ {
+ if (name.beginsWith(BuiltInName::groupMemoryBarrier))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_groupMemoryBarrier_;
+ }
+ break;
+ }
+ case 0x26a4d8e6u:
+ {
+ if (name.beginsWith(BuiltInName::memoryBarrierShared))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_memoryBarrierShared_;
+ }
+ break;
+ }
+ case 0x7e736b62u:
+ {
+ if (name == BuiltInName::gl_WorkGroupID)
+ {
+ return &BuiltInVariable::kVar_gl_WorkGroupID;
+ }
+ break;
+ }
+ case 0x7e808e8fu:
+ {
+ if (name == BuiltInName::gl_WorkGroupSize)
+ {
+ return &BuiltInVariable::kVar_gl_WorkGroupSize;
+ }
+ break;
+ }
+ case 0x7e82b146u:
+ {
+ if (name == BuiltInName::gl_NumWorkGroups)
+ {
+ return &BuiltInVariable::kVar_gl_NumWorkGroups;
+ }
+ break;
+ }
+ case 0x7ea251edu:
+ {
+ if (name == BuiltInName::gl_LocalInvocationID)
+ {
+ return &BuiltInVariable::kVar_gl_LocalInvocationID;
+ }
+ break;
+ }
+ case 0x7ead13a8u:
+ {
+ if (name == BuiltInName::gl_GlobalInvocationID)
+ {
+ return &BuiltInVariable::kVar_gl_GlobalInvocationID;
+ }
+ break;
+ }
+ case 0x7ebcd395u:
+ {
+ if (name == BuiltInName::gl_LocalInvocationIndex)
+ {
+ return &BuiltInVariable::kVar_gl_LocalInvocationIndex;
+ }
+ break;
+ }
+ }
+ }
+ if (mShaderType == GL_GEOMETRY_SHADER_EXT)
+ {
+ switch (nameHash)
+ {
+ case 0x145d55c9u:
+ {
+ if (name.beginsWith(BuiltInName::EmitVertex))
+ {
+ ASSERT(name.length() == 11);
+ return &BuiltInFunction::kFunction_EmitVertex_;
+ }
+ break;
+ }
+ case 0x186fcde2u:
+ {
+ if (name.beginsWith(BuiltInName::EndPrimitive))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_EndPrimitive_;
+ }
+ break;
+ }
+ case 0x7e400f84u:
+ {
+ if (name == BuiltInName::gl_Layer)
+ {
+ return &BuiltInVariable::kVar_gl_LayerGS;
+ }
+ break;
+ }
+ case 0x7e580bc5u:
+ {
+ if (name == BuiltInName::gl_Position)
+ {
+ return mVar_gl_PositionGS;
+ }
+ break;
+ }
+ case 0x7e67167au:
+ {
+ if (name == BuiltInName::gl_PerVertex)
+ {
+ return mVar_gl_PerVertex;
+ }
+ break;
+ }
+ case 0x7e742076u:
+ {
+ if (name == BuiltInName::gl_PrimitiveID)
+ {
+ return &BuiltInVariable::kVar_gl_PrimitiveIDGS;
+ }
+ break;
+ }
+ case 0x7e7fe684u:
+ {
+ if (name == BuiltInName::gl_InvocationID)
+ {
+ return &BuiltInVariable::kVar_gl_InvocationID;
+ }
+ break;
+ }
+ case 0x7e865240u:
+ {
+ if (name == BuiltInName::gl_PrimitiveIDIn)
+ {
+ return &BuiltInVariable::kVar_gl_PrimitiveIDIn;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_geometry_shader))
+ {
+ switch (nameHash)
+ {
+ case 0x7e400f84u:
+ {
+ if (name == BuiltInName::gl_Layer)
+ {
+ return &BuiltInVariable::kVar_gl_Layer;
+ }
+ break;
+ }
+ case 0x7e742076u:
+ {
+ if (name == BuiltInName::gl_PrimitiveID)
+ {
+ return &BuiltInVariable::kVar_gl_PrimitiveID;
+ }
+ break;
+ }
+ }
+ }
+ }
+ if (shaderVersion >= 300)
+ {
+ switch (nameHash)
+ {
+ case 0x06309dbcu:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_0C;
+ }
+ break;
+ }
+ case 0x0631d85fu:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_3C;
+ }
+ break;
+ }
+ case 0x06370c70u:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_2C;
+ }
+ break;
+ }
+ case 0x06378eb0u:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_1C;
+ }
+ break;
+ }
+ case 0x06408ba2u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_2D0D;
+ }
+ break;
+ }
+ case 0x0640f128u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_1C0C;
+ }
+ break;
+ }
+ case 0x06420bb0u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_0D0D;
+ }
+ break;
+ }
+ case 0x064236d1u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_2D2D;
+ }
+ break;
+ }
+ case 0x06425522u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_3C0C;
+ }
+ break;
+ }
+ case 0x06425db3u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_2C0C;
+ }
+ break;
+ }
+ case 0x06429550u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_2D2D;
+ }
+ break;
+ }
+ case 0x06429e9cu:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_2C0C;
+ }
+ break;
+ }
+ case 0x0642c869u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_3D3D;
+ }
+ break;
+ }
+ case 0x0642dbfeu:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_3C3C;
+ }
+ break;
+ }
+ case 0x064305b5u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_3D3D;
+ }
+ break;
+ }
+ case 0x06436c9au:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_1D0D;
+ }
+ break;
+ }
+ case 0x0643ebd5u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_3D0D;
+ }
+ break;
+ }
+ case 0x06441467u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_2C2C;
+ }
+ break;
+ }
+ case 0x0644176eu:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_1C1C;
+ }
+ break;
+ }
+ case 0x06443b94u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_2D0D;
+ }
+ break;
+ }
+ case 0x06448798u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_3C3C;
+ }
+ break;
+ }
+ case 0x0644a6dfu:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_1D1D;
+ }
+ break;
+ }
+ case 0x0644cd73u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_2C2C;
+ }
+ break;
+ }
+ case 0x06450593u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_1C0C;
+ }
+ break;
+ }
+ case 0x06452105u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_1D0D;
+ }
+ break;
+ }
+ case 0x06454045u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_0C0C;
+ }
+ break;
+ }
+ case 0x0645e25du:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_0C0C;
+ }
+ break;
+ }
+ case 0x06460349u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_1D1D;
+ }
+ break;
+ }
+ case 0x06472b16u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_3D0D;
+ }
+ break;
+ }
+ case 0x06473146u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_0D0D;
+ }
+ break;
+ }
+ case 0x06475b89u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_3C0C;
+ }
+ break;
+ }
+ case 0x0647bc75u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_1C1C;
+ }
+ break;
+ }
+ case 0x0654b2f8u:
+ {
+ if (name.beginsWith(BuiltInName::mix))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_mix_2B2B2E;
+ }
+ break;
+ }
+ case 0x0655a7e2u:
+ {
+ if (name == BuiltInName::mix_0B0B0E)
+ {
+ return &BuiltInFunction::kFunction_mix_0B0B0E;
+ }
+ break;
+ }
+ case 0x06567d08u:
+ {
+ if (name.beginsWith(BuiltInName::mix))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_mix_3B3B3E;
+ }
+ break;
+ }
+ case 0x0657f3adu:
+ {
+ if (name == BuiltInName::mix_1B1B1E)
+ {
+ return &BuiltInFunction::kFunction_mix_1B1B1E;
+ }
+ break;
+ }
+ case 0x0838025eu:
+ {
+ if (name.beginsWith(BuiltInName::tanh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_tanh_3B;
+ }
+ break;
+ }
+ case 0x0838944cu:
+ {
+ if (name.beginsWith(BuiltInName::tanh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_tanh_0B;
+ }
+ break;
+ }
+ case 0x08392747u:
+ {
+ if (name.beginsWith(BuiltInName::sinh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sinh_2B;
+ }
+ break;
+ }
+ case 0x08398f4au:
+ {
+ if (name.beginsWith(BuiltInName::sinh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sinh_1B;
+ }
+ break;
+ }
+ case 0x083991ddu:
+ {
+ if (name.beginsWith(BuiltInName::tanh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_tanh_1B;
+ }
+ break;
+ }
+ case 0x083aa373u:
+ {
+ if (name.beginsWith(BuiltInName::sinh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sinh_0B;
+ }
+ break;
+ }
+ case 0x083acb5eu:
+ {
+ if (name.beginsWith(BuiltInName::tanh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_tanh_2B;
+ }
+ break;
+ }
+ case 0x083acbf5u:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_1C;
+ }
+ break;
+ }
+ case 0x083b5c45u:
+ {
+ if (name.beginsWith(BuiltInName::cosh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_cosh_0B;
+ }
+ break;
+ }
+ case 0x083bd9f8u:
+ {
+ if (name.beginsWith(BuiltInName::sinh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sinh_3B;
+ }
+ break;
+ }
+ case 0x083c1656u:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_2C;
+ }
+ break;
+ }
+ case 0x083c57c4u:
+ {
+ if (name.beginsWith(BuiltInName::cosh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_cosh_1B;
+ }
+ break;
+ }
+ case 0x083d503bu:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_3C;
+ }
+ break;
+ }
+ case 0x083d8227u:
+ {
+ if (name.beginsWith(BuiltInName::cosh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_cosh_2B;
+ }
+ break;
+ }
+ case 0x083dd369u:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_0C;
+ }
+ break;
+ }
+ case 0x083ed2deu:
+ {
+ if (name.beginsWith(BuiltInName::cosh))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_cosh_3B;
+ }
+ break;
+ }
+ case 0x084807e9u:
+ {
+ if (name.beginsWith(BuiltInName::modf))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_modf_3B3B;
+ }
+ break;
+ }
+ case 0x084a908au:
+ {
+ if (name.beginsWith(BuiltInName::modf))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_modf_1B1B;
+ }
+ break;
+ }
+ case 0x084bf445u:
+ {
+ if (name.beginsWith(BuiltInName::modf))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_modf_0B0B;
+ }
+ break;
+ }
+ case 0x084fa835u:
+ {
+ if (name.beginsWith(BuiltInName::modf))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_modf_2B2B;
+ }
+ break;
+ }
+ case 0x0a400148u:
+ {
+ if (name.beginsWith(BuiltInName::asinh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_asinh_2B;
+ }
+ break;
+ }
+ case 0x0a406460u:
+ {
+ if (name.beginsWith(BuiltInName::isnan))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isnan_2B;
+ }
+ break;
+ }
+ case 0x0a407c52u:
+ {
+ if (name.beginsWith(BuiltInName::round))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_round_0B;
+ }
+ break;
+ }
+ case 0x0a412446u:
+ {
+ if (name.beginsWith(BuiltInName::trunc))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_trunc_0B;
+ }
+ break;
+ }
+ case 0x0a4125d1u:
+ {
+ if (name.beginsWith(BuiltInName::asinh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_asinh_3B;
+ }
+ break;
+ }
+ case 0x0a4189d9u:
+ {
+ if (name.beginsWith(BuiltInName::round))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_round_3B;
+ }
+ break;
+ }
+ case 0x0a41bc4bu:
+ {
+ if (name.beginsWith(BuiltInName::trunc))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_trunc_3B;
+ }
+ break;
+ }
+ case 0x0a4262ceu:
+ {
+ if (name.beginsWith(BuiltInName::isinf))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isinf_2B;
+ }
+ break;
+ }
+ case 0x0a42b872u:
+ {
+ if (name.beginsWith(BuiltInName::trunc))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_trunc_2B;
+ }
+ break;
+ }
+ case 0x0a430643u:
+ {
+ if (name.beginsWith(BuiltInName::atanh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_atanh_2B;
+ }
+ break;
+ }
+ case 0x0a43b397u:
+ {
+ if (name.beginsWith(BuiltInName::isinf))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isinf_3B;
+ }
+ break;
+ }
+ case 0x0a43edf9u:
+ {
+ if (name.beginsWith(BuiltInName::trunc))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_trunc_1B;
+ }
+ break;
+ }
+ case 0x0a4431a8u:
+ {
+ if (name.beginsWith(BuiltInName::atanh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_atanh_1B;
+ }
+ break;
+ }
+ case 0x0a443a26u:
+ {
+ if (name.beginsWith(BuiltInName::isinf))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isinf_0B;
+ }
+ break;
+ }
+ case 0x0a44ad91u:
+ {
+ if (name.beginsWith(BuiltInName::acosh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_acosh_1B;
+ }
+ break;
+ }
+ case 0x0a452617u:
+ {
+ if (name.beginsWith(BuiltInName::isinf))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isinf_1B;
+ }
+ break;
+ }
+ case 0x0a4561b0u:
+ {
+ if (name.beginsWith(BuiltInName::isnan))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isnan_3B;
+ }
+ break;
+ }
+ case 0x0a4582c9u:
+ {
+ if (name.beginsWith(BuiltInName::atanh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_atanh_0B;
+ }
+ break;
+ }
+ case 0x0a45fcfdu:
+ {
+ if (name.beginsWith(BuiltInName::atanh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_atanh_3B;
+ }
+ break;
+ }
+ case 0x0a461d10u:
+ {
+ if (name.beginsWith(BuiltInName::acosh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_acosh_0B;
+ }
+ break;
+ }
+ case 0x0a464ad3u:
+ {
+ if (name.beginsWith(BuiltInName::asinh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_asinh_0B;
+ }
+ break;
+ }
+ case 0x0a46778au:
+ {
+ if (name.beginsWith(BuiltInName::acosh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_acosh_3B;
+ }
+ break;
+ }
+ case 0x0a46ab3bu:
+ {
+ if (name.beginsWith(BuiltInName::isnan))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isnan_0B;
+ }
+ break;
+ }
+ case 0x0a46f2d2u:
+ {
+ if (name.beginsWith(BuiltInName::round))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_round_2B;
+ }
+ break;
+ }
+ case 0x0a4758c8u:
+ {
+ if (name.beginsWith(BuiltInName::round))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_round_1B;
+ }
+ break;
+ }
+ case 0x0a478c93u:
+ {
+ if (name.beginsWith(BuiltInName::acosh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_acosh_2B;
+ }
+ break;
+ }
+ case 0x0a47bb52u:
+ {
+ if (name.beginsWith(BuiltInName::asinh))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_asinh_1B;
+ }
+ break;
+ }
+ case 0x0a47fa7au:
+ {
+ if (name.beginsWith(BuiltInName::isnan))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_isnan_1B;
+ }
+ break;
+ }
+ case 0x0a524bc4u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_2D2D;
+ }
+ break;
+ }
+ case 0x0a5613e7u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_1D1D;
+ }
+ break;
+ }
+ case 0x0a56ba24u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_3D3D;
+ }
+ break;
+ }
+ case 0x0a601dd8u:
+ {
+ if (name == BuiltInName::clamp_2C2C2C)
+ {
+ return &BuiltInFunction::kFunction_clamp_2C2C2C;
+ }
+ break;
+ }
+ case 0x0a60570du:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_1D0D0D;
+ }
+ break;
+ }
+ case 0x0a60d0c5u:
+ {
+ if (name == BuiltInName::clamp_1C0C0C)
+ {
+ return &BuiltInFunction::kFunction_clamp_1C0C0C;
+ }
+ break;
+ }
+ case 0x0a621a2bu:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_0C0C0C;
+ }
+ break;
+ }
+ case 0x0a623042u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_2D0D0D;
+ }
+ break;
+ }
+ case 0x0a624f01u:
+ {
+ if (name == BuiltInName::clamp_3C0C0C)
+ {
+ return &BuiltInFunction::kFunction_clamp_3C0C0C;
+ }
+ break;
+ }
+ case 0x0a62ab50u:
+ {
+ if (name == BuiltInName::clamp_1C1C1C)
+ {
+ return &BuiltInFunction::kFunction_clamp_1C1C1C;
+ }
+ break;
+ }
+ case 0x0a631d0bu:
+ {
+ if (name == BuiltInName::clamp_1D1D1D)
+ {
+ return &BuiltInFunction::kFunction_clamp_1D1D1D;
+ }
+ break;
+ }
+ case 0x0a64f567u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_2D2D2D;
+ }
+ break;
+ }
+ case 0x0a656274u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_3C3C3C;
+ }
+ break;
+ }
+ case 0x0a65a625u:
+ {
+ if (name == BuiltInName::clamp_3D0D0D)
+ {
+ return &BuiltInFunction::kFunction_clamp_3D0D0D;
+ }
+ break;
+ }
+ case 0x0a660047u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_2C0C0C;
+ }
+ break;
+ }
+ case 0x0a660f60u:
+ {
+ if (name == BuiltInName::clamp_0D0D0D)
+ {
+ return &BuiltInFunction::kFunction_clamp_0D0D0D;
+ }
+ break;
+ }
+ case 0x0a674065u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_3D3D3D;
+ }
+ break;
+ }
+ case 0x0e503084u:
+ {
+ if (name.beginsWith(BuiltInName::inverse))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_inverse_5B;
+ }
+ break;
+ }
+ case 0x0e507cbdu:
+ {
+ if (name.beginsWith(BuiltInName::inverse))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_inverse_AB;
+ }
+ break;
+ }
+ case 0x0e50cc43u:
+ {
+ if (name.beginsWith(BuiltInName::inverse))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_inverse_FB;
+ }
+ break;
+ }
+ case 0x0e600d82u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0c2B;
+ }
+ break;
+ }
+ case 0x0e60445cu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0S2B;
+ }
+ break;
+ }
+ case 0x0e6044aeu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0e3B;
+ }
+ break;
+ }
+ case 0x0e60bb56u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0Q1B;
+ }
+ break;
+ }
+ case 0x0e61222eu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0K2B;
+ }
+ break;
+ }
+ case 0x0e61e49du:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0Z2B;
+ }
+ break;
+ }
+ case 0x0e625169u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0I2B;
+ }
+ break;
+ }
+ case 0x0e62790eu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0T2B;
+ }
+ break;
+ }
+ case 0x0e63b9efu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0M1B;
+ }
+ break;
+ }
+ case 0x0e6470f1u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0J2B;
+ }
+ break;
+ }
+ case 0x0e64854cu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0X2B;
+ }
+ break;
+ }
+ case 0x0e64ec86u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0W1B;
+ }
+ break;
+ }
+ case 0x0e65ea73u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0H1B;
+ }
+ break;
+ }
+ case 0x0e661665u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0L1B;
+ }
+ break;
+ }
+ case 0x0e663be3u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0N1B;
+ }
+ break;
+ }
+ case 0x0e67665bu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0d3B;
+ }
+ break;
+ }
+ case 0x0e67a979u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0R2B;
+ }
+ break;
+ }
+ case 0x0e67dce5u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_texture_0Y2B;
+ }
+ break;
+ }
+ case 0x106843efu:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_3D3D;
+ }
+ break;
+ }
+ case 0x10697de8u:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_2D2D;
+ }
+ break;
+ }
+ case 0x106ad530u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_1D1D;
+ }
+ break;
+ }
+ case 0x106d7bd6u:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_1D1D;
+ }
+ break;
+ }
+ case 0x106e2903u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_3D3D;
+ }
+ break;
+ }
+ case 0x106e7a45u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_2D2D;
+ }
+ break;
+ }
+ case 0x12601c9du:
+ {
+ if (name.beginsWith(BuiltInName::roundEven))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_roundEven_3B;
+ }
+ break;
+ }
+ case 0x12602fd7u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_AB;
+ }
+ break;
+ }
+ case 0x12614fd4u:
+ {
+ if (name.beginsWith(BuiltInName::roundEven))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_roundEven_2B;
+ }
+ break;
+ }
+ case 0x1264f5e4u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_EB;
+ }
+ break;
+ }
+ case 0x12650771u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_6B;
+ }
+ break;
+ }
+ case 0x12655b22u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_BB;
+ }
+ break;
+ }
+ case 0x12658f24u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_9B;
+ }
+ break;
+ }
+ case 0x1265cf4cu:
+ {
+ if (name.beginsWith(BuiltInName::roundEven))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_roundEven_1B;
+ }
+ break;
+ }
+ case 0x12661b07u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_FB;
+ }
+ break;
+ }
+ case 0x12665430u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_7B;
+ }
+ break;
+ }
+ case 0x1266c2deu:
+ {
+ if (name.beginsWith(BuiltInName::roundEven))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_roundEven_0B;
+ }
+ break;
+ }
+ case 0x1267db60u:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_5B;
+ }
+ break;
+ }
+ case 0x1267de6cu:
+ {
+ if (name.beginsWith(BuiltInName::transpose))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_transpose_DB;
+ }
+ break;
+ }
+ case 0x1273f9dbu:
+ {
+ if (name.beginsWith(BuiltInName::yuv_2_rgb))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_yuv_2_rgb_2B0G;
+ }
+ break;
+ }
+ case 0x127589a7u:
+ {
+ if (name.beginsWith(BuiltInName::rgb_2_yuv))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_rgb_2_yuv_2B0G;
+ }
+ break;
+ }
+ case 0x14882ba7u:
+ {
+ if (name.beginsWith(BuiltInName::textureLod))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_textureLod_0X2B0B;
+ }
+ break;
+ }
+ case 0x14885983u:
+ {
+ if (name.beginsWith(BuiltInName::texelFetch))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetch_0R2C0C;
+ }
+ break;
+ }
+ case 0x14885e67u:
+ {
+ if (name == BuiltInName::texelFetch_0Z2C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0Z2C0C;
+ }
+ break;
+ }
+ case 0x1488a5bfu:
+ {
+ if (name == BuiltInName::textureLod_0W1B0B)
+ {
+ return &BuiltInFunction::kFunction_textureLod_0W1B0B;
+ }
+ break;
+ }
+ case 0x14896e41u:
+ {
+ if (name == BuiltInName::texelFetchExt_0O1C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchExt_0O1C0C;
+ }
+ break;
+ }
+ case 0x1489e510u:
+ {
+ if (name.beginsWith(BuiltInName::textureLod))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_textureLod_0T2B0B;
+ }
+ break;
+ }
+ case 0x148a14a7u:
+ {
+ if (name.beginsWith(BuiltInName::texelFetch))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetch_0M1C0C;
+ }
+ break;
+ }
+ case 0x148a66beu:
+ {
+ if (name == BuiltInName::textureLod_0S2B0B)
+ {
+ return &BuiltInFunction::kFunction_textureLod_0S2B0B;
+ }
+ break;
+ }
+ case 0x148a95e7u:
+ {
+ if (name.beginsWith(BuiltInName::textureLod))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_textureLod_0c2B0B;
+ }
+ break;
+ }
+ case 0x148b00dbu:
+ {
+ if (name == BuiltInName::textureLod_0J2B0B)
+ {
+ return &BuiltInFunction::kFunction_textureLod_0J2B0B;
+ }
+ break;
+ }
+ case 0x148b33b6u:
+ {
+ if (name.beginsWith(BuiltInName::textureLod))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_textureLod_0H1B0B;
+ }
+ break;
+ }
+ case 0x148bab65u:
+ {
+ if (name == BuiltInName::texelFetch_0I2C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0I2C0C;
+ }
+ break;
+ }
+ case 0x148cccafu:
+ {
+ if (name.beginsWith(BuiltInName::textureLod))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_textureLod_0R2B0B;
+ }
+ break;
+ }
+ case 0x148d0a7bu:
+ {
+ if (name == BuiltInName::texelFetch_0K2C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0K2C0C;
+ }
+ break;
+ }
+ case 0x148d335cu:
+ {
+ if (name.beginsWith(BuiltInName::textureLod))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_textureLod_0I2B0B;
+ }
+ break;
+ }
+ case 0x148ddb10u:
+ {
+ if (name.beginsWith(BuiltInName::texelFetchExt))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetchExt_0a1C0C;
+ }
+ break;
+ }
+ case 0x148e100eu:
+ {
+ if (name == BuiltInName::texelFetch_0X2C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0X2C0C;
+ }
+ break;
+ }
+ case 0x148e44d3u:
+ {
+ if (name == BuiltInName::textureLod_0Y2B0B)
+ {
+ return &BuiltInFunction::kFunction_textureLod_0Y2B0B;
+ }
+ break;
+ }
+ case 0x148e5d86u:
+ {
+ if (name == BuiltInName::texelFetch_0Q1C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0Q1C0C;
+ }
+ break;
+ }
+ case 0x148e6d96u:
+ {
+ if (name.beginsWith(BuiltInName::texelFetch))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetch_0W1C0C;
+ }
+ break;
+ }
+ case 0x148ed16fu:
+ {
+ if (name.beginsWith(BuiltInName::texelFetchExt))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_texelFetchExt_0U1C0C;
+ }
+ break;
+ }
+ case 0x148ed87fu:
+ {
+ if (name.beginsWith(BuiltInName::textureLod))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_textureLod_0K2B0B;
+ }
+ break;
+ }
+ case 0x148eff58u:
+ {
+ if (name == BuiltInName::texelFetch_0L1C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0L1C0C;
+ }
+ break;
+ }
+ case 0x148fa8bbu:
+ {
+ if (name == BuiltInName::textureLod_0Q1B0B)
+ {
+ return &BuiltInFunction::kFunction_textureLod_0Q1B0B;
+ }
+ break;
+ }
+ case 0x148fb13cu:
+ {
+ if (name == BuiltInName::texelFetch_0T2C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0T2C0C;
+ }
+ break;
+ }
+ case 0x148fd5b6u:
+ {
+ if (name == BuiltInName::texelFetch_0H1C0C)
+ {
+ return &BuiltInFunction::kFunction_texelFetch_0H1C0C;
+ }
+ break;
+ }
+ case 0x148fe911u:
+ {
+ if (name == BuiltInName::textureLod_0Z2B0B)
+ {
+ return &BuiltInFunction::kFunction_textureLod_0Z2B0B;
+ }
+ break;
+ }
+ case 0x167394d8u:
+ {
+ if (name.beginsWith(BuiltInName::textureSizeExt))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSizeExt_0U;
+ }
+ break;
+ }
+ case 0x1673f496u:
+ {
+ if (name.beginsWith(BuiltInName::textureSizeExt))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSizeExt_0O;
+ }
+ break;
+ }
+ case 0x1674ed12u:
+ {
+ if (name.beginsWith(BuiltInName::determinant))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_determinant_FB;
+ }
+ break;
+ }
+ case 0x16752ab6u:
+ {
+ if (name.beginsWith(BuiltInName::textureSizeExt))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_textureSizeExt_0a;
+ }
+ break;
+ }
+ case 0x1676ad75u:
+ {
+ if (name.beginsWith(BuiltInName::determinant))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_determinant_5B;
+ }
+ break;
+ }
+ case 0x167719ccu:
+ {
+ if (name.beginsWith(BuiltInName::determinant))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_determinant_AB;
+ }
+ break;
+ }
+ case 0x16803d05u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0I0C;
+ }
+ break;
+ }
+ case 0x168046b0u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0M0C;
+ }
+ break;
+ }
+ case 0x168093aau:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0T0C;
+ }
+ break;
+ }
+ case 0x168115fbu:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0e0C;
+ }
+ break;
+ }
+ case 0x16812c54u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_3D3D;
+ }
+ break;
+ }
+ case 0x16812eeeu:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0W3B;
+ }
+ break;
+ }
+ case 0x168174f7u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_1D1D;
+ }
+ break;
+ }
+ case 0x168178c7u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0H2B;
+ }
+ break;
+ }
+ case 0x1681d6b4u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_2D2D;
+ }
+ break;
+ }
+ case 0x1681f153u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0J0C;
+ }
+ break;
+ }
+ case 0x168245a4u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0S0C;
+ }
+ break;
+ }
+ case 0x1682b6c4u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0X3B;
+ }
+ break;
+ }
+ case 0x1682d0c8u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0M2B;
+ }
+ break;
+ }
+ case 0x1682d660u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0Y0C;
+ }
+ break;
+ }
+ case 0x16838d15u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0L2B;
+ }
+ break;
+ }
+ case 0x1683ecb1u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0M3B;
+ }
+ break;
+ }
+ case 0x16840064u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0H3B;
+ }
+ break;
+ }
+ case 0x168434eeu:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0H0C;
+ }
+ break;
+ }
+ case 0x16845c90u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0L0C;
+ }
+ break;
+ }
+ case 0x16846c6cu:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0W0C;
+ }
+ break;
+ }
+ case 0x16849618u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0Z0C;
+ }
+ break;
+ }
+ case 0x1684f1b3u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0d0C;
+ }
+ break;
+ }
+ case 0x1685011eu:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0Q2B;
+ }
+ break;
+ }
+ case 0x1685b785u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0N3B;
+ }
+ break;
+ }
+ case 0x1685ca01u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0I3B;
+ }
+ break;
+ }
+ case 0x16860d28u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0Q3B;
+ }
+ break;
+ }
+ case 0x16861104u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0K0C;
+ }
+ break;
+ }
+ case 0x16863c73u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0R0C;
+ }
+ break;
+ }
+ case 0x16865716u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0L3B;
+ }
+ break;
+ }
+ case 0x16869d00u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0Q0C;
+ }
+ break;
+ }
+ case 0x1686a82au:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0X0C;
+ }
+ break;
+ }
+ case 0x1686aa87u:
+ {
+ if (name.beginsWith(BuiltInName::textureSize))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureSize_0c0C;
+ }
+ break;
+ }
+ case 0x1686cb94u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0N2B;
+ }
+ break;
+ }
+ case 0x16875a59u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0c3B;
+ }
+ break;
+ }
+ case 0x1687c54du:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0R3B;
+ }
+ break;
+ }
+ case 0x1687d107u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureProj_0W2B;
+ }
+ break;
+ }
+ case 0x16a00e04u:
+ {
+ if (name == BuiltInName::textureGrad_0I2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0I2B2B2B;
+ }
+ break;
+ }
+ case 0x16a04ad9u:
+ {
+ if (name == BuiltInName::textureGrad_0X2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0X2B2B2B;
+ }
+ break;
+ }
+ case 0x16a1478fu:
+ {
+ if (name == BuiltInName::textureGrad_0e3B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0e3B1B1B;
+ }
+ break;
+ }
+ case 0x16a19c8du:
+ {
+ if (name == BuiltInName::textureGrad_0H1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0H1B1B1B;
+ }
+ break;
+ }
+ case 0x16a1ec87u:
+ {
+ if (name == BuiltInName::textureGrad_0J2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0J2B2B2B;
+ }
+ break;
+ }
+ case 0x16a2ff3du:
+ {
+ if (name == BuiltInName::textureGrad_0Q1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0Q1B1B1B;
+ }
+ break;
+ }
+ case 0x16a34692u:
+ {
+ if (name == BuiltInName::textureGrad_0R2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0R2B2B2B;
+ }
+ break;
+ }
+ case 0x16a3a842u:
+ {
+ if (name == BuiltInName::textureGrad_0c2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0c2B1B1B;
+ }
+ break;
+ }
+ case 0x16a3b8f6u:
+ {
+ if (name == BuiltInName::textureGrad_0Y2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0Y2B2B2B;
+ }
+ break;
+ }
+ case 0x16a4a66cu:
+ {
+ if (name == BuiltInName::textureGrad_0W1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0W1B1B1B;
+ }
+ break;
+ }
+ case 0x16a4e27cu:
+ {
+ if (name == BuiltInName::textureGrad_0d3B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0d3B2B2B;
+ }
+ break;
+ }
+ case 0x16a66883u:
+ {
+ if (name == BuiltInName::textureGrad_0T2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0T2B1B1B;
+ }
+ break;
+ }
+ case 0x16a68a81u:
+ {
+ if (name == BuiltInName::textureGrad_0S2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0S2B2B2B;
+ }
+ break;
+ }
+ case 0x16a6a742u:
+ {
+ if (name == BuiltInName::textureGrad_0Z2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0Z2B1B1B;
+ }
+ break;
+ }
+ case 0x16a71104u:
+ {
+ if (name == BuiltInName::textureGrad_0K2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureGrad_0K2B1B1B;
+ }
+ break;
+ }
+ case 0x187df788u:
+ {
+ if (name.beginsWith(BuiltInName::packHalf2x16))
+ {
+ ASSERT(name.length() == 15);
+ return &BuiltInFunction::kFunction_packHalf2x16_1B;
+ }
+ break;
+ }
+ case 0x18887331u:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_2B3B;
+ }
+ break;
+ }
+ case 0x188880cbu:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_1B1B;
+ }
+ break;
+ }
+ case 0x1888c44du:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_3B2B;
+ }
+ break;
+ }
+ case 0x188916c3u:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_1B2B;
+ }
+ break;
+ }
+ case 0x188a12cau:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_1B3B;
+ }
+ break;
+ }
+ case 0x188db87au:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_2B2B;
+ }
+ break;
+ }
+ case 0x188e0232u:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_3B3B;
+ }
+ break;
+ }
+ case 0x188e2270u:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_2B1B;
+ }
+ break;
+ }
+ case 0x188f8feeu:
+ {
+ if (name.beginsWith(BuiltInName::outerProduct))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_outerProduct_3B1B;
+ }
+ break;
+ }
+ case 0x1a84fa77u:
+ {
+ if (name.beginsWith(BuiltInName::packSnorm2x16))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_packSnorm2x16_1B;
+ }
+ break;
+ }
+ case 0x1a873678u:
+ {
+ if (name.beginsWith(BuiltInName::packUnorm2x16))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_packUnorm2x16_1B;
+ }
+ break;
+ }
+ case 0x1a92589du:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_2D2D;
+ }
+ break;
+ }
+ case 0x1a95efdcu:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_1D1D;
+ }
+ break;
+ }
+ case 0x1a96ec62u:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_3D3D;
+ }
+ break;
+ }
+ case 0x1aa01270u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0Q1B1C;
+ }
+ break;
+ }
+ case 0x1aa05156u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0c2B1C;
+ }
+ break;
+ }
+ case 0x1aa11785u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0H1B1C;
+ }
+ break;
+ }
+ case 0x1aa26095u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0T2B1C;
+ }
+ break;
+ }
+ case 0x1aa31637u:
+ {
+ if (name == BuiltInName::textureOffset_0X2B2C)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0X2B2C;
+ }
+ break;
+ }
+ case 0x1aa385c2u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0Z2B1C;
+ }
+ break;
+ }
+ case 0x1aa41f4au:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0K2B1C;
+ }
+ break;
+ }
+ case 0x1aa541b7u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0W1B1C;
+ }
+ break;
+ }
+ case 0x1aa64995u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0I2B2C;
+ }
+ break;
+ }
+ case 0x1aa7a781u:
+ {
+ if (name.beginsWith(BuiltInName::textureOffset))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_textureOffset_0R2B2C;
+ }
+ break;
+ }
+ case 0x1c887424u:
+ {
+ if (name.beginsWith(BuiltInName::intBitsToFloat))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_intBitsToFloat_2C;
+ }
+ break;
+ }
+ case 0x1c887f5eu:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToInt))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_floatBitsToInt_2B;
+ }
+ break;
+ }
+ case 0x1c88f18cu:
+ {
+ if (name.beginsWith(BuiltInName::intBitsToFloat))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_intBitsToFloat_1C;
+ }
+ break;
+ }
+ case 0x1c89b11cu:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToInt))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_floatBitsToInt_1B;
+ }
+ break;
+ }
+ case 0x1c89e261u:
+ {
+ if (name.beginsWith(BuiltInName::intBitsToFloat))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_intBitsToFloat_0C;
+ }
+ break;
+ }
+ case 0x1c8ae0a5u:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToInt))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_floatBitsToInt_0B;
+ }
+ break;
+ }
+ case 0x1c8b20dau:
+ {
+ if (name.beginsWith(BuiltInName::intBitsToFloat))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_intBitsToFloat_3C;
+ }
+ break;
+ }
+ case 0x1c8dd4e6u:
+ {
+ if (name.beginsWith(BuiltInName::unpackHalf2x16))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_unpackHalf2x16_0D;
+ }
+ break;
+ }
+ case 0x1c8f60afu:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToInt))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_floatBitsToInt_3B;
+ }
+ break;
+ }
+ case 0x1c9876e4u:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_9B9B;
+ }
+ break;
+ }
+ case 0x1c99affcu:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_7B7B;
+ }
+ break;
+ }
+ case 0x1c9c8697u:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_6B6B;
+ }
+ break;
+ }
+ case 0x1c9ccd5au:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_BBBB;
+ }
+ break;
+ }
+ case 0x1c9ea241u:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_DBDB;
+ }
+ break;
+ }
+ case 0x1c9fa571u:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_EBEB;
+ }
+ break;
+ }
+ case 0x1ca81af6u:
+ {
+ if (name.beginsWith(BuiltInName::textureProjLod))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_textureProjLod_0c3B0B;
+ }
+ break;
+ }
+ case 0x1ca85d55u:
+ {
+ if (name == BuiltInName::textureProjLod_0Q3B0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjLod_0Q3B0B;
+ }
+ break;
+ }
+ case 0x1ca8c89au:
+ {
+ if (name == BuiltInName::textureProjLod_0H3B0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjLod_0H3B0B;
+ }
+ break;
+ }
+ case 0x1ca9ff27u:
+ {
+ if (name.beginsWith(BuiltInName::textureProjLod))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_textureProjLod_0W2B0B;
+ }
+ break;
+ }
+ case 0x1caa108bu:
+ {
+ if (name.beginsWith(BuiltInName::textureProjLod))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_textureProjLod_0H2B0B;
+ }
+ break;
+ }
+ case 0x1caa957cu:
+ {
+ if (name == BuiltInName::textureProjLod_0Q2B0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjLod_0Q2B0B;
+ }
+ break;
+ }
+ case 0x1cab3a35u:
+ {
+ if (name.beginsWith(BuiltInName::textureProjLod))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_textureProjLod_0W3B0B;
+ }
+ break;
+ }
+ case 0x1cadb5feu:
+ {
+ if (name.beginsWith(BuiltInName::textureProjLod))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_textureProjLod_0X3B0B;
+ }
+ break;
+ }
+ case 0x1cae6ef8u:
+ {
+ if (name.beginsWith(BuiltInName::textureProjLod))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_textureProjLod_0R3B0B;
+ }
+ break;
+ }
+ case 0x1caf96afu:
+ {
+ if (name == BuiltInName::textureProjLod_0I3B0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjLod_0I3B0B;
+ }
+ break;
+ }
+ case 0x1e903284u:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToUint))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_floatBitsToUint_0B;
+ }
+ break;
+ }
+ case 0x1e92e353u:
+ {
+ if (name.beginsWith(BuiltInName::uintBitsToFloat))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_uintBitsToFloat_3D;
+ }
+ break;
+ }
+ case 0x1e93c13fu:
+ {
+ if (name.beginsWith(BuiltInName::uintBitsToFloat))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_uintBitsToFloat_0D;
+ }
+ break;
+ }
+ case 0x1e95201fu:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToUint))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_floatBitsToUint_1B;
+ }
+ break;
+ }
+ case 0x1e95511bu:
+ {
+ if (name.beginsWith(BuiltInName::unpackSnorm2x16))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_unpackSnorm2x16_0D;
+ }
+ break;
+ }
+ case 0x1e95582au:
+ {
+ if (name.beginsWith(BuiltInName::uintBitsToFloat))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_uintBitsToFloat_1D;
+ }
+ break;
+ }
+ case 0x1e95b0a7u:
+ {
+ if (name.beginsWith(BuiltInName::uintBitsToFloat))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_uintBitsToFloat_2D;
+ }
+ break;
+ }
+ case 0x1e966adcu:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToUint))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_floatBitsToUint_2B;
+ }
+ break;
+ }
+ case 0x1e9718ffu:
+ {
+ if (name.beginsWith(BuiltInName::unpackUnorm2x16))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_unpackUnorm2x16_0D;
+ }
+ break;
+ }
+ case 0x1e97a505u:
+ {
+ if (name.beginsWith(BuiltInName::floatBitsToUint))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_floatBitsToUint_3B;
+ }
+ break;
+ }
+ case 0x1ec1a98bu:
+ {
+ if (name == BuiltInName::textureProjGrad_0Q2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0Q2B1B1B;
+ }
+ break;
+ }
+ case 0x1ec2304bu:
+ {
+ if (name == BuiltInName::textureProjGrad_0X3B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0X3B2B2B;
+ }
+ break;
+ }
+ case 0x1ec25826u:
+ {
+ if (name == BuiltInName::textureProjGrad_0W2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0W2B1B1B;
+ }
+ break;
+ }
+ case 0x1ec323fdu:
+ {
+ if (name == BuiltInName::textureProjGrad_0H3B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0H3B1B1B;
+ }
+ break;
+ }
+ case 0x1ec3ee61u:
+ {
+ if (name == BuiltInName::textureProjGrad_0I3B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0I3B2B2B;
+ }
+ break;
+ }
+ case 0x1ec578cfu:
+ {
+ if (name == BuiltInName::textureProjGrad_0R3B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0R3B2B2B;
+ }
+ break;
+ }
+ case 0x1ec5ab9du:
+ {
+ if (name == BuiltInName::textureProjGrad_0H2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0H2B1B1B;
+ }
+ break;
+ }
+ case 0x1ec5fc9fu:
+ {
+ if (name == BuiltInName::textureProjGrad_0Q3B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0Q3B1B1B;
+ }
+ break;
+ }
+ case 0x1ec67b05u:
+ {
+ if (name == BuiltInName::textureProjGrad_0W3B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0W3B1B1B;
+ }
+ break;
+ }
+ case 0x1ec719d1u:
+ {
+ if (name == BuiltInName::textureProjGrad_0c3B1B1B)
+ {
+ return &BuiltInFunction::kFunction_textureProjGrad_0c3B1B1B;
+ }
+ break;
+ }
+ case 0x20a92dc6u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_2D2D;
+ }
+ break;
+ }
+ case 0x20ae96edu:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_3D3D;
+ }
+ break;
+ }
+ case 0x20aedbacu:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_1D1D;
+ }
+ break;
+ }
+ case 0x20c8fa96u:
+ {
+ if (name == BuiltInName::texelFetchOffset_0I2C0C2C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0I2C0C2C;
+ }
+ break;
+ }
+ case 0x20c9733bu:
+ {
+ if (name == BuiltInName::textureLodOffset_0c2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0c2B0B1C;
+ }
+ break;
+ }
+ case 0x20c9a178u:
+ {
+ if (name == BuiltInName::texelFetchOffset_0X2C0C2C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0X2C0C2C;
+ }
+ break;
+ }
+ case 0x20ca4914u:
+ {
+ if (name == BuiltInName::textureLodOffset_0Z2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0Z2B0B1C;
+ }
+ break;
+ }
+ case 0x20cac068u:
+ {
+ if (name == BuiltInName::texelFetchOffset_0K2C0C1C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0K2C0C1C;
+ }
+ break;
+ }
+ case 0x20cb3102u:
+ {
+ if (name == BuiltInName::texelFetchOffset_0H1C0C1C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0H1C0C1C;
+ }
+ break;
+ }
+ case 0x20cb952du:
+ {
+ if (name == BuiltInName::texelFetchOffset_0Z2C0C1C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0Z2C0C1C;
+ }
+ break;
+ }
+ case 0x20cbf8d9u:
+ {
+ if (name == BuiltInName::texelFetchOffset_0W1C0C1C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0W1C0C1C;
+ }
+ break;
+ }
+ case 0x20cbfefau:
+ {
+ if (name == BuiltInName::texelFetchOffset_0R2C0C2C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0R2C0C2C;
+ }
+ break;
+ }
+ case 0x20cc1a52u:
+ {
+ if (name == BuiltInName::texelFetchOffset_0Q1C0C1C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0Q1C0C1C;
+ }
+ break;
+ }
+ case 0x20cc9477u:
+ {
+ if (name == BuiltInName::textureLodOffset_0H1B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0H1B0B1C;
+ }
+ break;
+ }
+ case 0x20ccf3edu:
+ {
+ if (name == BuiltInName::textureLodOffset_0Q1B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0Q1B0B1C;
+ }
+ break;
+ }
+ case 0x20cd0de3u:
+ {
+ if (name == BuiltInName::textureLodOffset_0K2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0K2B0B1C;
+ }
+ break;
+ }
+ case 0x20cd8d8du:
+ {
+ if (name == BuiltInName::textureLodOffset_0T2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0T2B0B1C;
+ }
+ break;
+ }
+ case 0x20cdc61au:
+ {
+ if (name == BuiltInName::textureLodOffset_0W1B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0W1B0B1C;
+ }
+ break;
+ }
+ case 0x20cde370u:
+ {
+ if (name == BuiltInName::textureLodOffset_0X2B0B2C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0X2B0B2C;
+ }
+ break;
+ }
+ case 0x20cde748u:
+ {
+ if (name == BuiltInName::textureLodOffset_0I2B0B2C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0I2B0B2C;
+ }
+ break;
+ }
+ case 0x20ceb3dau:
+ {
+ if (name == BuiltInName::textureLodOffset_0R2B0B2C)
+ {
+ return &BuiltInFunction::kFunction_textureLodOffset_0R2B0B2C;
+ }
+ break;
+ }
+ case 0x20cfe609u:
+ {
+ if (name == BuiltInName::texelFetchOffset_0T2C0C1C)
+ {
+ return &BuiltInFunction::kFunction_texelFetchOffset_0T2C0C1C;
+ }
+ break;
+ }
+ case 0x22c03489u:
+ {
+ if (name.beginsWith(BuiltInName::textureProjOffset))
+ {
+ ASSERT(name.length() == 24);
+ return &BuiltInFunction::kFunction_textureProjOffset_0W2B1C;
+ }
+ break;
+ }
+ case 0x22c0a359u:
+ {
+ if (name == BuiltInName::textureProjOffset_0H2B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0H2B1C;
+ }
+ break;
+ }
+ case 0x22c19992u:
+ {
+ if (name.beginsWith(BuiltInName::textureProjOffset))
+ {
+ ASSERT(name.length() == 24);
+ return &BuiltInFunction::kFunction_textureProjOffset_0c3B1C;
+ }
+ break;
+ }
+ case 0x22c246a2u:
+ {
+ if (name == BuiltInName::textureProjOffset_0Q3B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0Q3B1C;
+ }
+ break;
+ }
+ case 0x22c29005u:
+ {
+ if (name == BuiltInName::textureProjOffset_0Q2B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0Q2B1C;
+ }
+ break;
+ }
+ case 0x22c2da46u:
+ {
+ if (name == BuiltInName::textureProjOffset_0H3B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0H3B1C;
+ }
+ break;
+ }
+ case 0x22c3e359u:
+ {
+ if (name == BuiltInName::textureProjOffset_0W3B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0W3B1C;
+ }
+ break;
+ }
+ case 0x22c43880u:
+ {
+ if (name.beginsWith(BuiltInName::textureProjOffset))
+ {
+ ASSERT(name.length() == 24);
+ return &BuiltInFunction::kFunction_textureProjOffset_0R3B2C;
+ }
+ break;
+ }
+ case 0x22c458dcu:
+ {
+ if (name.beginsWith(BuiltInName::textureProjOffset))
+ {
+ ASSERT(name.length() == 24);
+ return &BuiltInFunction::kFunction_textureProjOffset_0I3B2C;
+ }
+ break;
+ }
+ case 0x22c47909u:
+ {
+ if (name == BuiltInName::textureProjOffset_0X3B2C)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0X3B2C;
+ }
+ break;
+ }
+ case 0x22e0fe8cu:
+ {
+ if (name == BuiltInName::textureGradOffset_0W1B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0W1B1B1B1C;
+ }
+ break;
+ }
+ case 0x22e165b8u:
+ {
+ if (name == BuiltInName::textureGradOffset_0K2B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0K2B1B1B1C;
+ }
+ break;
+ }
+ case 0x22e28d80u:
+ {
+ if (name == BuiltInName::textureGradOffset_0T2B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0T2B1B1B1C;
+ }
+ break;
+ }
+ case 0x22e3ab1cu:
+ {
+ if (name == BuiltInName::textureGradOffset_0e3B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0e3B1B1B1C;
+ }
+ break;
+ }
+ case 0x22e3e9eau:
+ {
+ if (name == BuiltInName::textureGradOffset_0I2B2B2B2C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0I2B2B2B2C;
+ }
+ break;
+ }
+ case 0x22e5bb38u:
+ {
+ if (name == BuiltInName::textureGradOffset_0R2B2B2B2C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0R2B2B2B2C;
+ }
+ break;
+ }
+ case 0x22e5c876u:
+ {
+ if (name == BuiltInName::textureGradOffset_0Q1B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0Q1B1B1B1C;
+ }
+ break;
+ }
+ case 0x22e61729u:
+ {
+ if (name == BuiltInName::textureGradOffset_0X2B2B2B2C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0X2B2B2B2C;
+ }
+ break;
+ }
+ case 0x22e68293u:
+ {
+ if (name == BuiltInName::textureGradOffset_0Z2B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0Z2B1B1B1C;
+ }
+ break;
+ }
+ case 0x22e71012u:
+ {
+ if (name == BuiltInName::textureGradOffset_0H1B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0H1B1B1B1C;
+ }
+ break;
+ }
+ case 0x22e7429eu:
+ {
+ if (name == BuiltInName::textureGradOffset_0c2B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureGradOffset_0c2B1B1B1C;
+ }
+ break;
+ }
+ case 0x28e8b7d0u:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0W3B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0W3B0B1C;
+ }
+ break;
+ }
+ case 0x28e91d51u:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0R3B0B2C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0R3B0B2C;
+ }
+ break;
+ }
+ case 0x28e9a246u:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0W2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0W2B0B1C;
+ }
+ break;
+ }
+ case 0x28eab462u:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0H2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0H2B0B1C;
+ }
+ break;
+ }
+ case 0x28eb8605u:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0I3B0B2C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0I3B0B2C;
+ }
+ break;
+ }
+ case 0x28ebf99eu:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0H3B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0H3B0B1C;
+ }
+ break;
+ }
+ case 0x28ec29a7u:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0Q3B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0Q3B0B1C;
+ }
+ break;
+ }
+ case 0x28eecd92u:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0X3B0B2C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0X3B0B2C;
+ }
+ break;
+ }
+ case 0x28ef956cu:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0Q2B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0Q2B0B1C;
+ }
+ break;
+ }
+ case 0x28efb13bu:
+ {
+ if (name == BuiltInName::textureProjLodOffset_0c3B0B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjLodOffset_0c3B0B1C;
+ }
+ break;
+ }
+ case 0x2b00aacdu:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0c3B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0c3B1B1B1C;
+ }
+ break;
+ }
+ case 0x2b022418u:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0H3B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0H3B1B1B1C;
+ }
+ break;
+ }
+ case 0x2b0252ccu:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0X3B2B2B2C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0X3B2B2B2C;
+ }
+ break;
+ }
+ case 0x2b02af8fu:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0I3B2B2B2C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0I3B2B2B2C;
+ }
+ break;
+ }
+ case 0x2b03ccf9u:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0Q2B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0Q2B1B1B1C;
+ }
+ break;
+ }
+ case 0x2b03db51u:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0W2B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0W2B1B1B1C;
+ }
+ break;
+ }
+ case 0x2b047dfau:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0R3B2B2B2C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0R3B2B2B2C;
+ }
+ break;
+ }
+ case 0x2b06f874u:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0Q3B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0Q3B1B1B1C;
+ }
+ break;
+ }
+ case 0x2b077535u:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0H2B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0H2B1B1B1C;
+ }
+ break;
+ }
+ case 0x2b07f768u:
+ {
+ if (name == BuiltInName::textureProjGradOffset_0W3B1B1B1C)
+ {
+ return &BuiltInFunction::kFunction_textureProjGradOffset_0W3B1B1B1C;
+ }
+ break;
+ }
+ case 0x7ec10648u:
+ {
+ if (name == BuiltInName::gl_MaxProgramTexelOffset)
+ {
+ return mVar_gl_MaxProgramTexelOffset;
+ }
+ break;
+ }
+ case 0x7ec3c4d1u:
+ {
+ if (name == BuiltInName::gl_MinProgramTexelOffset)
+ {
+ return mVar_gl_MinProgramTexelOffset;
+ }
+ break;
+ }
+ case 0x7ec8d677u:
+ {
+ if (name == BuiltInName::gl_MaxVertexOutputVectors)
+ {
+ return mVar_gl_MaxVertexOutputVectors;
+ }
+ break;
+ }
+ case 0x7ed1aaebu:
+ {
+ if (name == BuiltInName::gl_MaxFragmentInputVectors)
+ {
+ return mVar_gl_MaxFragmentInputVectors;
+ }
+ break;
+ }
+ }
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x08394c88u:
+ {
+ if (name.beginsWith(BuiltInName::dFdy))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdy_0B;
+ }
+ break;
+ }
+ case 0x08398819u:
+ {
+ if (name.beginsWith(BuiltInName::dFdx))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdx_0B;
+ }
+ break;
+ }
+ case 0x083a7081u:
+ {
+ if (name.beginsWith(BuiltInName::dFdy))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdy_1B;
+ }
+ break;
+ }
+ case 0x083abe52u:
+ {
+ if (name.beginsWith(BuiltInName::dFdx))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdx_3B;
+ }
+ break;
+ }
+ case 0x083b9d7au:
+ {
+ if (name.beginsWith(BuiltInName::dFdy))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdy_2B;
+ }
+ break;
+ }
+ case 0x083c0d13u:
+ {
+ if (name.beginsWith(BuiltInName::dFdx))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdx_2B;
+ }
+ break;
+ }
+ case 0x083c6796u:
+ {
+ if (name.beginsWith(BuiltInName::dFdx))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdx_1B;
+ }
+ break;
+ }
+ case 0x083ced8bu:
+ {
+ if (name.beginsWith(BuiltInName::dFdy))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdy_3B;
+ }
+ break;
+ }
+ case 0x0c483e39u:
+ {
+ if (name.beginsWith(BuiltInName::fwidth))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidth_1B;
+ }
+ break;
+ }
+ case 0x0c4d354eu:
+ {
+ if (name.beginsWith(BuiltInName::fwidth))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidth_0B;
+ }
+ break;
+ }
+ case 0x0c4e7b0cu:
+ {
+ if (name.beginsWith(BuiltInName::fwidth))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidth_3B;
+ }
+ break;
+ }
+ case 0x0c4fa8b5u:
+ {
+ if (name.beginsWith(BuiltInName::fwidth))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidth_2B;
+ }
+ break;
+ }
+ case 0x0e7013d9u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0T2B0B;
+ }
+ break;
+ }
+ case 0x0e70d11du:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0W1B0B;
+ }
+ break;
+ }
+ case 0x0e70eff9u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0X2B0B;
+ }
+ break;
+ }
+ case 0x0e716d8fu:
+ {
+ if (name == BuiltInName::texture_0c2B0B)
+ {
+ return &BuiltInFunction::kFunction_texture_0c2B0B;
+ }
+ break;
+ }
+ case 0x0e71856cu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0M1B0B;
+ }
+ break;
+ }
+ case 0x0e723219u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0L1B0B;
+ }
+ break;
+ }
+ case 0x0e734ff8u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0Z2B0B;
+ }
+ break;
+ }
+ case 0x0e7386b0u:
+ {
+ if (name == BuiltInName::texture_0Q1B0B)
+ {
+ return &BuiltInFunction::kFunction_texture_0Q1B0B;
+ }
+ break;
+ }
+ case 0x0e740087u:
+ {
+ if (name == BuiltInName::texture_0d3B0B)
+ {
+ return &BuiltInFunction::kFunction_texture_0d3B0B;
+ }
+ break;
+ }
+ case 0x0e742a66u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0K2B0B;
+ }
+ break;
+ }
+ case 0x0e75399eu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0S2B0B;
+ }
+ break;
+ }
+ case 0x0e755c73u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0Y2B0B;
+ }
+ break;
+ }
+ case 0x0e75d15fu:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0J2B0B;
+ }
+ break;
+ }
+ case 0x0e76e7c1u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0H1B0B;
+ }
+ break;
+ }
+ case 0x0e7720c0u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0R2B0B;
+ }
+ break;
+ }
+ case 0x0e77d1c8u:
+ {
+ if (name.beginsWith(BuiltInName::texture))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture_0I2B0B;
+ }
+ break;
+ }
+ case 0x16900558u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0L3B0B;
+ }
+ break;
+ }
+ case 0x1690a3cfu:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0W3B0B;
+ }
+ break;
+ }
+ case 0x1690ae9fu:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0M3B0B;
+ }
+ break;
+ }
+ case 0x1691c2edu:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0M2B0B;
+ }
+ break;
+ }
+ case 0x16925badu:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0Q3B0B;
+ }
+ break;
+ }
+ case 0x1692d089u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0c3B0B;
+ }
+ break;
+ }
+ case 0x169350d8u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0I3B0B;
+ }
+ break;
+ }
+ case 0x16939955u:
+ {
+ if (name == BuiltInName::textureProj_0Q2B0B)
+ {
+ return &BuiltInFunction::kFunction_textureProj_0Q2B0B;
+ }
+ break;
+ }
+ case 0x1694622au:
+ {
+ if (name == BuiltInName::textureProj_0R3B0B)
+ {
+ return &BuiltInFunction::kFunction_textureProj_0R3B0B;
+ }
+ break;
+ }
+ case 0x169465e2u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0W2B0B;
+ }
+ break;
+ }
+ case 0x1695f573u:
+ {
+ if (name == BuiltInName::textureProj_0X3B0B)
+ {
+ return &BuiltInFunction::kFunction_textureProj_0X3B0B;
+ }
+ break;
+ }
+ case 0x16965fd9u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0H3B0B;
+ }
+ break;
+ }
+ case 0x1696f029u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0H2B0B;
+ }
+ break;
+ }
+ case 0x1697e9b9u:
+ {
+ if (name.beginsWith(BuiltInName::textureProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureProj_0L2B0B;
+ }
+ break;
+ }
+ case 0x1ab0a952u:
+ {
+ if (name == BuiltInName::textureOffset_0X2B2C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0X2B2C0B;
+ }
+ break;
+ }
+ case 0x1ab29724u:
+ {
+ if (name == BuiltInName::textureOffset_0Z2B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0Z2B1C0B;
+ }
+ break;
+ }
+ case 0x1ab55c9du:
+ {
+ if (name == BuiltInName::textureOffset_0Q1B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0Q1B1C0B;
+ }
+ break;
+ }
+ case 0x1ab5753fu:
+ {
+ if (name == BuiltInName::textureOffset_0T2B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0T2B1C0B;
+ }
+ break;
+ }
+ case 0x1ab57bbcu:
+ {
+ if (name == BuiltInName::textureOffset_0H1B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0H1B1C0B;
+ }
+ break;
+ }
+ case 0x1ab59b6cu:
+ {
+ if (name == BuiltInName::textureOffset_0I2B2C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0I2B2C0B;
+ }
+ break;
+ }
+ case 0x1ab5d795u:
+ {
+ if (name == BuiltInName::textureOffset_0W1B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0W1B1C0B;
+ }
+ break;
+ }
+ case 0x1ab63ddau:
+ {
+ if (name == BuiltInName::textureOffset_0K2B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0K2B1C0B;
+ }
+ break;
+ }
+ case 0x1ab63f72u:
+ {
+ if (name == BuiltInName::textureOffset_0R2B2C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0R2B2C0B;
+ }
+ break;
+ }
+ case 0x1ab7e533u:
+ {
+ if (name == BuiltInName::textureOffset_0c2B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureOffset_0c2B1C0B;
+ }
+ break;
+ }
+ case 0x22d11d67u:
+ {
+ if (name == BuiltInName::textureProjOffset_0Q3B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0Q3B1C0B;
+ }
+ break;
+ }
+ case 0x22d1425bu:
+ {
+ if (name == BuiltInName::textureProjOffset_0W2B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0W2B1C0B;
+ }
+ break;
+ }
+ case 0x22d17100u:
+ {
+ if (name == BuiltInName::textureProjOffset_0W3B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0W3B1C0B;
+ }
+ break;
+ }
+ case 0x22d1ca54u:
+ {
+ if (name == BuiltInName::textureProjOffset_0c3B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0c3B1C0B;
+ }
+ break;
+ }
+ case 0x22d6074cu:
+ {
+ if (name == BuiltInName::textureProjOffset_0R3B2C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0R3B2C0B;
+ }
+ break;
+ }
+ case 0x22d60cd3u:
+ {
+ if (name == BuiltInName::textureProjOffset_0X3B2C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0X3B2C0B;
+ }
+ break;
+ }
+ case 0x22d60e91u:
+ {
+ if (name == BuiltInName::textureProjOffset_0Q2B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0Q2B1C0B;
+ }
+ break;
+ }
+ case 0x22d62e81u:
+ {
+ if (name == BuiltInName::textureProjOffset_0H3B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0H3B1C0B;
+ }
+ break;
+ }
+ case 0x22d6b2e8u:
+ {
+ if (name == BuiltInName::textureProjOffset_0I3B2C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0I3B2C0B;
+ }
+ break;
+ }
+ case 0x22d6ee53u:
+ {
+ if (name == BuiltInName::textureProjOffset_0H2B1C0B)
+ {
+ return &BuiltInFunction::kFunction_textureProjOffset_0H2B1C0B;
+ }
+ break;
+ }
+ case 0x7e645c89u:
+ {
+ if (name == BuiltInName::gl_FragDepth)
+ {
+ return &BuiltInVariable::kVar_gl_FragDepth;
+ }
+ break;
+ }
+ }
+ }
+ if (mShaderType == GL_VERTEX_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e5f8987u:
+ {
+ if (name == BuiltInName::gl_VertexID)
+ {
+ return &BuiltInVariable::kVar_gl_VertexID;
+ }
+ break;
+ }
+ case 0x7e6be47fu:
+ {
+ if (name == BuiltInName::gl_InstanceID)
+ {
+ return &BuiltInVariable::kVar_gl_InstanceID;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_VERTEX_SHADER) && (mResources.ANGLE_multi_draw))
+ {
+ switch (nameHash)
+ {
+ case 0x7e4c3c42u:
+ {
+ if (name == BuiltInName::gl_DrawID)
+ {
+ return &BuiltInVariable::kVar_gl_DrawID;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_VERTEX_SHADER) && (mResources.ANGLE_base_vertex_base_instance))
+ {
+ switch (nameHash)
+ {
+ case 0x7e695e00u:
+ {
+ if (name == BuiltInName::gl_BaseVertex)
+ {
+ return &BuiltInVariable::kVar_gl_BaseVertex;
+ }
+ break;
+ }
+ case 0x7e785b75u:
+ {
+ if (name == BuiltInName::gl_BaseInstance)
+ {
+ return &BuiltInVariable::kVar_gl_BaseInstance;
+ }
+ break;
+ }
+ }
+ }
+ if ((mResources.OVR_multiview || mResources.OVR_multiview2) &&
+ mShaderType != GL_COMPUTE_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e6f6de9u:
+ {
+ if (name == BuiltInName::gl_ViewID_OVR)
+ {
+ return &BuiltInVariable::kVar_gl_ViewID_OVR;
+ }
+ break;
+ }
+ }
+ }
+ }
+ if (shaderVersion == 100)
+ {
+ switch (nameHash)
+ {
+ case 0x1271689cu:
+ {
+ if (name.beginsWith(BuiltInName::texture2D))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture2D_0H1B;
+ }
+ break;
+ }
+ case 0x127728cau:
+ {
+ if (name.beginsWith(BuiltInName::texture2D))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture2D_0L1B;
+ }
+ break;
+ }
+ case 0x1680927du:
+ {
+ if (name.beginsWith(BuiltInName::textureCube))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_textureCube_0J2B;
+ }
+ break;
+ }
+ case 0x1a902408u:
+ {
+ if (name.beginsWith(BuiltInName::texture2DRect))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_texture2DRect_0N1B;
+ }
+ break;
+ }
+ case 0x1a92969du:
+ {
+ if (name.beginsWith(BuiltInName::texture2DProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_texture2DProj_0L2B;
+ }
+ break;
+ }
+ case 0x1a9584eau:
+ {
+ if (name.beginsWith(BuiltInName::texture2DProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_texture2DProj_0L3B;
+ }
+ break;
+ }
+ case 0x1a95bcc7u:
+ {
+ if (name.beginsWith(BuiltInName::texture2DProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_texture2DProj_0H3B;
+ }
+ break;
+ }
+ case 0x1a96b8d6u:
+ {
+ if (name.beginsWith(BuiltInName::texture2DProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_texture2DProj_0H2B;
+ }
+ break;
+ }
+ case 0x20cb8d71u:
+ {
+ if (name == BuiltInName::texture2DGradEXT_0H1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_texture2DGradEXT_0H1B1B1B;
+ }
+ break;
+ }
+ case 0x22b53a05u:
+ {
+ if (name.beginsWith(BuiltInName::texture2DRectProj))
+ {
+ ASSERT(name.length() == 22);
+ return &BuiltInFunction::kFunction_texture2DRectProj_0N3B;
+ }
+ break;
+ }
+ case 0x22b65e05u:
+ {
+ if (name.beginsWith(BuiltInName::texture2DRectProj))
+ {
+ ASSERT(name.length() == 22);
+ return &BuiltInFunction::kFunction_texture2DRectProj_0N2B;
+ }
+ break;
+ }
+ case 0x24dbd51eu:
+ {
+ if (name == BuiltInName::textureCubeGradEXT_0J2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_textureCubeGradEXT_0J2B2B2B;
+ }
+ break;
+ }
+ case 0x28e995cbu:
+ {
+ if (name == BuiltInName::texture2DProjGradEXT_0H3B1B1B)
+ {
+ return &BuiltInFunction::kFunction_texture2DProjGradEXT_0H3B1B1B;
+ }
+ break;
+ }
+ case 0x28ed5178u:
+ {
+ if (name == BuiltInName::texture2DProjGradEXT_0H2B1B1B)
+ {
+ return &BuiltInFunction::kFunction_texture2DProjGradEXT_0H2B1B1B;
+ }
+ break;
+ }
+ case 0x7e5a0c08u:
+ {
+ if (name == BuiltInName::gl_FragData)
+ {
+ // Only initialized if shaderType == GL_FRAGMENT_SHADER
+ return mVar_gl_FragData;
+ }
+ break;
+ }
+ case 0x7e7c38efu:
+ {
+ if (name == BuiltInName::gl_FragDepthEXT)
+ {
+ // Only initialized if (shaderType == GL_FRAGMENT_SHADER) &&
+ // (mResources.EXT_frag_depth)
+ return mVar_gl_FragDepthEXT;
+ }
+ break;
+ }
+ case 0x7ea6cdf6u:
+ {
+ if (name == BuiltInName::gl_MaxVaryingVectors)
+ {
+ return mVar_gl_MaxVaryingVectors;
+ }
+ break;
+ }
+ case 0x7ebce486u:
+ {
+ if (name == BuiltInName::gl_SecondaryFragDataEXT)
+ {
+ // Only initialized if (shaderType == GL_FRAGMENT_SHADER) &&
+ // (mResources.EXT_blend_func_extended)
+ return mVar_gl_SecondaryFragDataEXT;
+ }
+ break;
+ }
+ }
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x08394c88u:
+ {
+ if (name.beginsWith(BuiltInName::dFdyExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdyExt_0B;
+ }
+ break;
+ }
+ case 0x08398819u:
+ {
+ if (name.beginsWith(BuiltInName::dFdxExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdxExt_0B;
+ }
+ break;
+ }
+ case 0x083a7081u:
+ {
+ if (name.beginsWith(BuiltInName::dFdyExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdyExt_1B;
+ }
+ break;
+ }
+ case 0x083abe52u:
+ {
+ if (name.beginsWith(BuiltInName::dFdxExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdxExt_3B;
+ }
+ break;
+ }
+ case 0x083b9d7au:
+ {
+ if (name.beginsWith(BuiltInName::dFdyExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdyExt_2B;
+ }
+ break;
+ }
+ case 0x083c0d13u:
+ {
+ if (name.beginsWith(BuiltInName::dFdxExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdxExt_2B;
+ }
+ break;
+ }
+ case 0x083c6796u:
+ {
+ if (name.beginsWith(BuiltInName::dFdxExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdxExt_1B;
+ }
+ break;
+ }
+ case 0x083ced8bu:
+ {
+ if (name.beginsWith(BuiltInName::dFdyExt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_dFdyExt_3B;
+ }
+ break;
+ }
+ case 0x0c483e39u:
+ {
+ if (name.beginsWith(BuiltInName::fwidthExt))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidthExt_1B;
+ }
+ break;
+ }
+ case 0x0c4d354eu:
+ {
+ if (name.beginsWith(BuiltInName::fwidthExt))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidthExt_0B;
+ }
+ break;
+ }
+ case 0x0c4e7b0cu:
+ {
+ if (name.beginsWith(BuiltInName::fwidthExt))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidthExt_3B;
+ }
+ break;
+ }
+ case 0x0c4fa8b5u:
+ {
+ if (name.beginsWith(BuiltInName::fwidthExt))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_fwidthExt_2B;
+ }
+ break;
+ }
+ case 0x12764e24u:
+ {
+ if (name.beginsWith(BuiltInName::texture3D))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_texture3D_0I2B;
+ }
+ break;
+ }
+ case 0x12810dc6u:
+ {
+ if (name == BuiltInName::texture3D_0I2B0B)
+ {
+ return &BuiltInFunction::kFunction_texture3D_0I2B0B;
+ }
+ break;
+ }
+ case 0x12846ba6u:
+ {
+ if (name.beginsWith(BuiltInName::texture2D))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_texture2D_0H1B0B;
+ }
+ break;
+ }
+ case 0x1696a314u:
+ {
+ if (name.beginsWith(BuiltInName::textureCube))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_textureCube_0J2B0B;
+ }
+ break;
+ }
+ case 0x189e8416u:
+ {
+ if (name.beginsWith(BuiltInName::texture3DLod))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_texture3DLod_0I2B0B;
+ }
+ break;
+ }
+ case 0x1a93312fu:
+ {
+ if (name.beginsWith(BuiltInName::texture3DProj))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_texture3DProj_0I3B;
+ }
+ break;
+ }
+ case 0x1aa197a7u:
+ {
+ if (name.beginsWith(BuiltInName::texture2DProj))
+ {
+ ASSERT(name.length() == 20);
+ return &BuiltInFunction::kFunction_texture2DProj_0H3B0B;
+ }
+ break;
+ }
+ case 0x1aa44389u:
+ {
+ if (name == BuiltInName::texture2DProj_0H2B0B)
+ {
+ return &BuiltInFunction::kFunction_texture2DProj_0H2B0B;
+ }
+ break;
+ }
+ case 0x1aa7eecdu:
+ {
+ if (name == BuiltInName::texture3DProj_0I3B0B)
+ {
+ return &BuiltInFunction::kFunction_texture3DProj_0I3B0B;
+ }
+ break;
+ }
+ case 0x1eb43b6cu:
+ {
+ if (name == BuiltInName::texture2DLodEXT_0H1B0B)
+ {
+ return &BuiltInFunction::kFunction_texture2DLodEXT_0H1B0B;
+ }
+ break;
+ }
+ case 0x20b9ceecu:
+ {
+ if (name.beginsWith(BuiltInName::texture3DProjLod))
+ {
+ ASSERT(name.length() == 23);
+ return &BuiltInFunction::kFunction_texture3DProjLod_0I3B0B;
+ }
+ break;
+ }
+ case 0x22c206a5u:
+ {
+ if (name.beginsWith(BuiltInName::textureCubeLodEXT))
+ {
+ ASSERT(name.length() == 24);
+ return &BuiltInFunction::kFunction_textureCubeLodEXT_0J2B0B;
+ }
+ break;
+ }
+ case 0x26d1d3beu:
+ {
+ if (name.beginsWith(BuiltInName::texture2DProjLodEXT))
+ {
+ ASSERT(name.length() == 26);
+ return &BuiltInFunction::kFunction_texture2DProjLodEXT_0H3B0B;
+ }
+ break;
+ }
+ case 0x26d60d82u:
+ {
+ if (name == BuiltInName::texture2DProjLodEXT_0H2B0B)
+ {
+ return &BuiltInFunction::kFunction_texture2DProjLodEXT_0H2B0B;
+ }
+ break;
+ }
+ case 0x7e60c438u:
+ {
+ if (name == BuiltInName::gl_FragColor)
+ {
+ return &BuiltInVariable::kVar_gl_FragColor;
+ }
+ break;
+ }
+ }
+ }
+ if (mShaderType == GL_VERTEX_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x18986fc2u:
+ {
+ if (name == BuiltInName::texture2DLod_0H1B0B)
+ {
+ return &BuiltInFunction::kFunction_texture2DLod_0H1B0B;
+ }
+ break;
+ }
+ case 0x1cac1f4du:
+ {
+ if (name.beginsWith(BuiltInName::textureCubeLod))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_textureCubeLod_0J2B0B;
+ }
+ break;
+ }
+ case 0x20b8a0c3u:
+ {
+ if (name.beginsWith(BuiltInName::texture2DProjLod))
+ {
+ ASSERT(name.length() == 23);
+ return &BuiltInFunction::kFunction_texture2DProjLod_0H3B0B;
+ }
+ break;
+ }
+ case 0x20bc6337u:
+ {
+ if (name == BuiltInName::texture2DProjLod_0H2B0B)
+ {
+ return &BuiltInFunction::kFunction_texture2DProjLod_0H2B0B;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_blend_func_extended))
+ {
+ switch (nameHash)
+ {
+ case 0x7ec56cbeu:
+ {
+ if (name == BuiltInName::gl_SecondaryFragColorEXT)
+ {
+ return &BuiltInVariable::kVar_gl_SecondaryFragColorEXT;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_shader_framebuffer_fetch))
+ {
+ switch (nameHash)
+ {
+ case 0x7e7970c2u:
+ {
+ if (name == BuiltInName::gl_LastFragData)
+ {
+ return mVar_gl_LastFragData;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.NV_shader_framebuffer_fetch))
+ {
+ switch (nameHash)
+ {
+ case 0x7e7970c2u:
+ {
+ if (name == BuiltInName::gl_LastFragData)
+ {
+ return mVar_gl_LastFragDataNV;
+ }
+ break;
+ }
+ case 0x7e802016u:
+ {
+ if (name == BuiltInName::gl_LastFragColor)
+ {
+ return &BuiltInVariable::kVar_gl_LastFragColor;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_FRAGMENT_SHADER) &&
+ (!mResources.EXT_shader_framebuffer_fetch && !mResources.NV_shader_framebuffer_fetch &&
+ mResources.ARM_shader_framebuffer_fetch))
+ {
+ switch (nameHash)
+ {
+ case 0x7e9f0a88u:
+ {
+ if (name == BuiltInName::gl_LastFragColorARM)
+ {
+ return &BuiltInVariable::kVar_gl_LastFragColorARM;
+ }
+ break;
+ }
+ }
+ }
+ if ((mShaderType == GL_VERTEX_SHADER) && (mResources.ANGLE_multi_draw))
+ {
+ switch (nameHash)
+ {
+ case 0x7e4c3c42u:
+ {
+ if (name == BuiltInName::gl_DrawID)
+ {
+ return &BuiltInVariable::kVar_gl_DrawIDESSL1;
+ }
+ break;
+ }
+ }
+ }
+ if ((mResources.OVR_multiview || mResources.OVR_multiview2) &&
+ mShaderType != GL_COMPUTE_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e6f6de9u:
+ {
+ if (name == BuiltInName::gl_ViewID_OVR)
+ {
+ return &BuiltInVariable::kVar_gl_ViewID_OVRESSL1;
+ }
+ break;
+ }
+ }
+ }
+ }
+ switch (nameHash)
+ {
+ case 0x063055e6u:
+ {
+ if (name.beginsWith(BuiltInName::log))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_log_0B;
+ }
+ break;
+ }
+ case 0x06307fbcu:
+ {
+ if (name.beginsWith(BuiltInName::all))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_all_1E;
+ }
+ break;
+ }
+ case 0x0630826fu:
+ {
+ if (name.beginsWith(BuiltInName::notFunc))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_notFunc_3E;
+ }
+ break;
+ }
+ case 0x0630942fu:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_0B;
+ }
+ break;
+ }
+ case 0x06309ccau:
+ {
+ if (name.beginsWith(BuiltInName::tan))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_tan_1B;
+ }
+ break;
+ }
+ case 0x0630bc6au:
+ {
+ if (name.beginsWith(BuiltInName::cos))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_cos_2B;
+ }
+ break;
+ }
+ case 0x0630dce3u:
+ {
+ if (name.beginsWith(BuiltInName::log))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_log_3B;
+ }
+ break;
+ }
+ case 0x063194bfu:
+ {
+ if (name.beginsWith(BuiltInName::any))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_any_1E;
+ }
+ break;
+ }
+ case 0x0631a1ccu:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_3B;
+ }
+ break;
+ }
+ case 0x0631d12au:
+ {
+ if (name.beginsWith(BuiltInName::log))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_log_2B;
+ }
+ break;
+ }
+ case 0x06320b8bu:
+ {
+ if (name.beginsWith(BuiltInName::cos))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_cos_3B;
+ }
+ break;
+ }
+ case 0x0632fcb3u:
+ {
+ if (name.beginsWith(BuiltInName::any))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_any_3E;
+ }
+ break;
+ }
+ case 0x06330b41u:
+ {
+ if (name.beginsWith(BuiltInName::log))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_log_1B;
+ }
+ break;
+ }
+ case 0x063314b1u:
+ {
+ if (name.beginsWith(BuiltInName::sin))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_sin_1B;
+ }
+ break;
+ }
+ case 0x063415e2u:
+ {
+ if (name.beginsWith(BuiltInName::any))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_any_2E;
+ }
+ break;
+ }
+ case 0x06344570u:
+ {
+ if (name.beginsWith(BuiltInName::sin))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_sin_0B;
+ }
+ break;
+ }
+ case 0x0634cf9au:
+ {
+ if (name.beginsWith(BuiltInName::sin))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_sin_3B;
+ }
+ break;
+ }
+ case 0x06352335u:
+ {
+ if (name.beginsWith(BuiltInName::exp))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_exp_3B;
+ }
+ break;
+ }
+ case 0x063595b9u:
+ {
+ if (name.beginsWith(BuiltInName::exp))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_exp_0B;
+ }
+ break;
+ }
+ case 0x0635a80fu:
+ {
+ if (name.beginsWith(BuiltInName::tan))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_tan_2B;
+ }
+ break;
+ }
+ case 0x0635d3b3u:
+ {
+ if (name.beginsWith(BuiltInName::sin))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_sin_2B;
+ }
+ break;
+ }
+ case 0x0635eb79u:
+ {
+ if (name.beginsWith(BuiltInName::all))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_all_2E;
+ }
+ break;
+ }
+ case 0x06366a98u:
+ {
+ if (name.beginsWith(BuiltInName::cos))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_cos_0B;
+ }
+ break;
+ }
+ case 0x0636b1f1u:
+ {
+ if (name.beginsWith(BuiltInName::exp))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_exp_1B;
+ }
+ break;
+ }
+ case 0x0636dda0u:
+ {
+ if (name.beginsWith(BuiltInName::all))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_all_3E;
+ }
+ break;
+ }
+ case 0x0636e0efu:
+ {
+ if (name.beginsWith(BuiltInName::notFunc))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_notFunc_1E;
+ }
+ break;
+ }
+ case 0x063719d6u:
+ {
+ if (name.beginsWith(BuiltInName::tan))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_tan_3B;
+ }
+ break;
+ }
+ case 0x06371aefu:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_2B;
+ }
+ break;
+ }
+ case 0x06376a86u:
+ {
+ if (name.beginsWith(BuiltInName::notFunc))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_notFunc_2E;
+ }
+ break;
+ }
+ case 0x063770d0u:
+ {
+ if (name.beginsWith(BuiltInName::tan))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_tan_0B;
+ }
+ break;
+ }
+ case 0x063770dfu:
+ {
+ if (name.beginsWith(BuiltInName::abs))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_abs_1B;
+ }
+ break;
+ }
+ case 0x063786f1u:
+ {
+ if (name.beginsWith(BuiltInName::cos))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_cos_1B;
+ }
+ break;
+ }
+ case 0x0637ca4au:
+ {
+ if (name.beginsWith(BuiltInName::exp))
+ {
+ ASSERT(name.length() == 6);
+ return &BuiltInFunction::kFunction_exp_2B;
+ }
+ break;
+ }
+ case 0x06400261u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_2B2B;
+ }
+ break;
+ }
+ case 0x06403847u:
+ {
+ if (name.beginsWith(BuiltInName::mod))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_mod_2B0B;
+ }
+ break;
+ }
+ case 0x064082ceu:
+ {
+ if (name.beginsWith(BuiltInName::mod))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_mod_1B0B;
+ }
+ break;
+ }
+ case 0x0640a98au:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_2B2B;
+ }
+ break;
+ }
+ case 0x064107b7u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_1B0B;
+ }
+ break;
+ }
+ case 0x06415ae6u:
+ {
+ if (name.beginsWith(BuiltInName::dot))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_dot_3B3B;
+ }
+ break;
+ }
+ case 0x06418e42u:
+ {
+ if (name.beginsWith(BuiltInName::pow))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_pow_3B3B;
+ }
+ break;
+ }
+ case 0x0641ceeeu:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_0B0B;
+ }
+ break;
+ }
+ case 0x0641f1d7u:
+ {
+ if (name.beginsWith(BuiltInName::mod))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_mod_1B1B;
+ }
+ break;
+ }
+ case 0x06421555u:
+ {
+ if (name.beginsWith(BuiltInName::dot))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_dot_1B1B;
+ }
+ break;
+ }
+ case 0x064225ceu:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_3B3B;
+ }
+ break;
+ }
+ case 0x064274eeu:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_1B1B;
+ }
+ break;
+ }
+ case 0x0642b54du:
+ {
+ if (name.beginsWith(BuiltInName::mod))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_mod_2B2B;
+ }
+ break;
+ }
+ case 0x064318fcu:
+ {
+ if (name.beginsWith(BuiltInName::pow))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_pow_2B2B;
+ }
+ break;
+ }
+ case 0x0643486cu:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_3B0B;
+ }
+ break;
+ }
+ case 0x06439435u:
+ {
+ if (name.beginsWith(BuiltInName::pow))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_pow_1B1B;
+ }
+ break;
+ }
+ case 0x06450933u:
+ {
+ if (name.beginsWith(BuiltInName::dot))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_dot_0B0B;
+ }
+ break;
+ }
+ case 0x0645114fu:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_1B0B;
+ }
+ break;
+ }
+ case 0x06457883u:
+ {
+ if (name.beginsWith(BuiltInName::mod))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_mod_3B3B;
+ }
+ break;
+ }
+ case 0x0645f03eu:
+ {
+ if (name.beginsWith(BuiltInName::mod))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_mod_3B0B;
+ }
+ break;
+ }
+ case 0x0645fd82u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_3B3B;
+ }
+ break;
+ }
+ case 0x0646155eu:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_1B1B;
+ }
+ break;
+ }
+ case 0x06462cf0u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_2B0B;
+ }
+ break;
+ }
+ case 0x06463219u:
+ {
+ if (name.beginsWith(BuiltInName::dot))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_dot_2B2B;
+ }
+ break;
+ }
+ case 0x06467507u:
+ {
+ if (name.beginsWith(BuiltInName::min))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_min_3B0B;
+ }
+ break;
+ }
+ case 0x06468fb1u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_2B0B;
+ }
+ break;
+ }
+ case 0x0646b392u:
+ {
+ if (name.beginsWith(BuiltInName::pow))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_pow_0B0B;
+ }
+ break;
+ }
+ case 0x06472996u:
+ {
+ if (name.beginsWith(BuiltInName::max))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_max_0B0B;
+ }
+ break;
+ }
+ case 0x064778feu:
+ {
+ if (name.beginsWith(BuiltInName::mod))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_mod_0B0B;
+ }
+ break;
+ }
+ case 0x0650f1c9u:
+ {
+ if (name.beginsWith(BuiltInName::mix))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_mix_1B1B0B;
+ }
+ break;
+ }
+ case 0x0653049du:
+ {
+ if (name.beginsWith(BuiltInName::mix))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_mix_2B2B0B;
+ }
+ break;
+ }
+ case 0x06549219u:
+ {
+ if (name.beginsWith(BuiltInName::mix))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_mix_2B2B2B;
+ }
+ break;
+ }
+ case 0x0655be57u:
+ {
+ if (name.beginsWith(BuiltInName::mix))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_mix_0B0B0B;
+ }
+ break;
+ }
+ case 0x06561bdcu:
+ {
+ if (name == BuiltInName::mix_3B3B0B)
+ {
+ return &BuiltInFunction::kFunction_mix_3B3B0B;
+ }
+ break;
+ }
+ case 0x06568deeu:
+ {
+ if (name == BuiltInName::mix_3B3B3B)
+ {
+ return &BuiltInFunction::kFunction_mix_3B3B3B;
+ }
+ break;
+ }
+ case 0x0657a0a8u:
+ {
+ if (name == BuiltInName::mix_1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_mix_1B1B1B;
+ }
+ break;
+ }
+ case 0x08383aacu:
+ {
+ if (name.beginsWith(BuiltInName::acos))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_acos_3B;
+ }
+ break;
+ }
+ case 0x0838a17eu:
+ {
+ if (name.beginsWith(BuiltInName::ceil))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_ceil_2B;
+ }
+ break;
+ }
+ case 0x0838ac89u:
+ {
+ if (name.beginsWith(BuiltInName::exp2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_exp2_3B;
+ }
+ break;
+ }
+ case 0x0838dc31u:
+ {
+ if (name.beginsWith(BuiltInName::sqrt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sqrt_0B;
+ }
+ break;
+ }
+ case 0x08396a55u:
+ {
+ if (name.beginsWith(BuiltInName::acos))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_acos_2B;
+ }
+ break;
+ }
+ case 0x0839daf2u:
+ {
+ if (name.beginsWith(BuiltInName::exp2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_exp2_0B;
+ }
+ break;
+ }
+ case 0x0839e751u:
+ {
+ if (name.beginsWith(BuiltInName::acos))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_acos_1B;
+ }
+ break;
+ }
+ case 0x0839f1a7u:
+ {
+ if (name.beginsWith(BuiltInName::ceil))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_ceil_3B;
+ }
+ break;
+ }
+ case 0x083a07bau:
+ {
+ if (name.beginsWith(BuiltInName::sqrt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sqrt_3B;
+ }
+ break;
+ }
+ case 0x083a7922u:
+ {
+ if (name.beginsWith(BuiltInName::ceil))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_ceil_0B;
+ }
+ break;
+ }
+ case 0x083aea5fu:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_atan_2B;
+ }
+ break;
+ }
+ case 0x083af266u:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_1B;
+ }
+ break;
+ }
+ case 0x083afbc8u:
+ {
+ if (name.beginsWith(BuiltInName::acos))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_acos_0B;
+ }
+ break;
+ }
+ case 0x083b2b93u:
+ {
+ if (name.beginsWith(BuiltInName::exp2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_exp2_1B;
+ }
+ break;
+ }
+ case 0x083b577bu:
+ {
+ if (name.beginsWith(BuiltInName::sqrt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sqrt_2B;
+ }
+ break;
+ }
+ case 0x083b7e52u:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_atan_1B;
+ }
+ break;
+ }
+ case 0x083bcf76u:
+ {
+ if (name.beginsWith(BuiltInName::sqrt))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sqrt_1B;
+ }
+ break;
+ }
+ case 0x083c1fc5u:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_2B;
+ }
+ break;
+ }
+ case 0x083c624bu:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_atan_0B;
+ }
+ break;
+ }
+ case 0x083ca453u:
+ {
+ if (name.beginsWith(BuiltInName::asin))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_asin_0B;
+ }
+ break;
+ }
+ case 0x083cc6e1u:
+ {
+ if (name.beginsWith(BuiltInName::log2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_log2_2B;
+ }
+ break;
+ }
+ case 0x083d6eacu:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_3B;
+ }
+ break;
+ }
+ case 0x083dac10u:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_atan_3B;
+ }
+ break;
+ }
+ case 0x083dd4deu:
+ {
+ if (name.beginsWith(BuiltInName::sign))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_sign_0B;
+ }
+ break;
+ }
+ case 0x083df752u:
+ {
+ if (name.beginsWith(BuiltInName::asin))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_asin_1B;
+ }
+ break;
+ }
+ case 0x083e1b7au:
+ {
+ if (name.beginsWith(BuiltInName::log2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_log2_1B;
+ }
+ break;
+ }
+ case 0x083e6948u:
+ {
+ if (name.beginsWith(BuiltInName::asin))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_asin_2B;
+ }
+ break;
+ }
+ case 0x083f4babu:
+ {
+ if (name.beginsWith(BuiltInName::log2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_log2_0B;
+ }
+ break;
+ }
+ case 0x083f6552u:
+ {
+ if (name.beginsWith(BuiltInName::asin))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_asin_3B;
+ }
+ break;
+ }
+ case 0x083f6afdu:
+ {
+ if (name.beginsWith(BuiltInName::ceil))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_ceil_1B;
+ }
+ break;
+ }
+ case 0x083f8b90u:
+ {
+ if (name.beginsWith(BuiltInName::exp2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_exp2_2B;
+ }
+ break;
+ }
+ case 0x083fd32eu:
+ {
+ if (name.beginsWith(BuiltInName::log2))
+ {
+ ASSERT(name.length() == 7);
+ return &BuiltInFunction::kFunction_log2_3B;
+ }
+ break;
+ }
+ case 0x08482806u:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_atan_3B3B;
+ }
+ break;
+ }
+ case 0x08491304u:
+ {
+ if (name.beginsWith(BuiltInName::step))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_step_0B1B;
+ }
+ break;
+ }
+ case 0x0849bcfdu:
+ {
+ if (name.beginsWith(BuiltInName::step))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_step_2B2B;
+ }
+ break;
+ }
+ case 0x084aa6bfu:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_atan_1B1B;
+ }
+ break;
+ }
+ case 0x084c10fau:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_atan_0B0B;
+ }
+ break;
+ }
+ case 0x084c9765u:
+ {
+ if (name.beginsWith(BuiltInName::step))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_step_1B1B;
+ }
+ break;
+ }
+ case 0x084e7af1u:
+ {
+ if (name.beginsWith(BuiltInName::step))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_step_3B3B;
+ }
+ break;
+ }
+ case 0x084e7be4u:
+ {
+ if (name.beginsWith(BuiltInName::step))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_step_0B0B;
+ }
+ break;
+ }
+ case 0x084ec1e6u:
+ {
+ if (name.beginsWith(BuiltInName::step))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_step_0B3B;
+ }
+ break;
+ }
+ case 0x084ee899u:
+ {
+ if (name.beginsWith(BuiltInName::atan))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_atan_2B2B;
+ }
+ break;
+ }
+ case 0x084feda7u:
+ {
+ if (name.beginsWith(BuiltInName::step))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_step_0B2B;
+ }
+ break;
+ }
+ case 0x0a402a9cu:
+ {
+ if (name.beginsWith(BuiltInName::fract))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_fract_0B;
+ }
+ break;
+ }
+ case 0x0a41745fu:
+ {
+ if (name.beginsWith(BuiltInName::fract))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_fract_3B;
+ }
+ break;
+ }
+ case 0x0a42a596u:
+ {
+ if (name.beginsWith(BuiltInName::fract))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_fract_2B;
+ }
+ break;
+ }
+ case 0x0a43465eu:
+ {
+ if (name.beginsWith(BuiltInName::floor))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_floor_0B;
+ }
+ break;
+ }
+ case 0x0a43be63u:
+ {
+ if (name.beginsWith(BuiltInName::floor))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_floor_3B;
+ }
+ break;
+ }
+ case 0x0a44da6bu:
+ {
+ if (name.beginsWith(BuiltInName::floor))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_floor_2B;
+ }
+ break;
+ }
+ case 0x0a45ecc0u:
+ {
+ if (name.beginsWith(BuiltInName::floor))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_floor_1B;
+ }
+ break;
+ }
+ case 0x0a4726f2u:
+ {
+ if (name.beginsWith(BuiltInName::fract))
+ {
+ ASSERT(name.length() == 8);
+ return &BuiltInFunction::kFunction_fract_1B;
+ }
+ break;
+ }
+ case 0x0a513a26u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_3E3E;
+ }
+ break;
+ }
+ case 0x0a51bddcu:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_3B3B;
+ }
+ break;
+ }
+ case 0x0a527d10u:
+ {
+ if (name.beginsWith(BuiltInName::cross))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_cross_2B2B;
+ }
+ break;
+ }
+ case 0x0a542036u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_2C2C;
+ }
+ break;
+ }
+ case 0x0a54c30cu:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_2B2B;
+ }
+ break;
+ }
+ case 0x0a554046u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_1C1C;
+ }
+ break;
+ }
+ case 0x0a56874bu:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_3C3C;
+ }
+ break;
+ }
+ case 0x0a56fc88u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_2E2E;
+ }
+ break;
+ }
+ case 0x0a5744dcu:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_1E1E;
+ }
+ break;
+ }
+ case 0x0a57a8f5u:
+ {
+ if (name.beginsWith(BuiltInName::equal))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_equal_1B1B;
+ }
+ break;
+ }
+ case 0x0a619e65u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_3B3B3B;
+ }
+ break;
+ }
+ case 0x0a62e0c3u:
+ {
+ if (name == BuiltInName::clamp_1B0B0B)
+ {
+ return &BuiltInFunction::kFunction_clamp_1B0B0B;
+ }
+ break;
+ }
+ case 0x0a635d1au:
+ {
+ if (name == BuiltInName::clamp_1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_clamp_1B1B1B;
+ }
+ break;
+ }
+ case 0x0a658fc9u:
+ {
+ if (name == BuiltInName::clamp_3B0B0B)
+ {
+ return &BuiltInFunction::kFunction_clamp_3B0B0B;
+ }
+ break;
+ }
+ case 0x0a65f6b4u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_0B0B0B;
+ }
+ break;
+ }
+ case 0x0a6670deu:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_2B0B0B;
+ }
+ break;
+ }
+ case 0x0a679af4u:
+ {
+ if (name.beginsWith(BuiltInName::clamp))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_clamp_2B2B2B;
+ }
+ break;
+ }
+ case 0x0c48bffau:
+ {
+ if (name.beginsWith(BuiltInName::length))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_length_0B;
+ }
+ break;
+ }
+ case 0x0c4924f7u:
+ {
+ if (name.beginsWith(BuiltInName::length))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_length_3B;
+ }
+ break;
+ }
+ case 0x0c4a38b6u:
+ {
+ if (name.beginsWith(BuiltInName::length))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_length_2B;
+ }
+ break;
+ }
+ case 0x0c4f6cbbu:
+ {
+ if (name.beginsWith(BuiltInName::length))
+ {
+ ASSERT(name.length() == 9);
+ return &BuiltInFunction::kFunction_length_1B;
+ }
+ break;
+ }
+ case 0x0e507f22u:
+ {
+ if (name.beginsWith(BuiltInName::degrees))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_degrees_2B;
+ }
+ break;
+ }
+ case 0x0e519bd4u:
+ {
+ if (name.beginsWith(BuiltInName::degrees))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_degrees_3B;
+ }
+ break;
+ }
+ case 0x0e52b187u:
+ {
+ if (name.beginsWith(BuiltInName::degrees))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_degrees_0B;
+ }
+ break;
+ }
+ case 0x0e52e500u:
+ {
+ if (name.beginsWith(BuiltInName::radians))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_radians_0B;
+ }
+ break;
+ }
+ case 0x0e537b7au:
+ {
+ if (name.beginsWith(BuiltInName::radians))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_radians_3B;
+ }
+ break;
+ }
+ case 0x0e541edeu:
+ {
+ if (name.beginsWith(BuiltInName::degrees))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_degrees_1B;
+ }
+ break;
+ }
+ case 0x0e547683u:
+ {
+ if (name.beginsWith(BuiltInName::radians))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_radians_2B;
+ }
+ break;
+ }
+ case 0x0e55ac28u:
+ {
+ if (name.beginsWith(BuiltInName::radians))
+ {
+ ASSERT(name.length() == 10);
+ return &BuiltInFunction::kFunction_radians_1B;
+ }
+ break;
+ }
+ case 0x0e620f44u:
+ {
+ if (name.beginsWith(BuiltInName::reflect))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_reflect_2B2B;
+ }
+ break;
+ }
+ case 0x0e631c50u:
+ {
+ if (name.beginsWith(BuiltInName::reflect))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_reflect_3B3B;
+ }
+ break;
+ }
+ case 0x0e63358eu:
+ {
+ if (name.beginsWith(BuiltInName::reflect))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_reflect_0B0B;
+ }
+ break;
+ }
+ case 0x0e665b7bu:
+ {
+ if (name.beginsWith(BuiltInName::reflect))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_reflect_1B1B;
+ }
+ break;
+ }
+ case 0x0e706684u:
+ {
+ if (name.beginsWith(BuiltInName::refract))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_refract_1B1B0B;
+ }
+ break;
+ }
+ case 0x0e71a4fcu:
+ {
+ if (name.beginsWith(BuiltInName::refract))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_refract_2B2B0B;
+ }
+ break;
+ }
+ case 0x0e71b28du:
+ {
+ if (name == BuiltInName::refract_3B3B0B)
+ {
+ return &BuiltInFunction::kFunction_refract_3B3B0B;
+ }
+ break;
+ }
+ case 0x0e73b594u:
+ {
+ if (name.beginsWith(BuiltInName::refract))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_refract_0B0B0B;
+ }
+ break;
+ }
+ case 0x1068425fu:
+ {
+ if (name.beginsWith(BuiltInName::distance))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_distance_3B3B;
+ }
+ break;
+ }
+ case 0x1068c0bfu:
+ {
+ if (name.beginsWith(BuiltInName::distance))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_distance_2B2B;
+ }
+ break;
+ }
+ case 0x1068f060u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_1E1E;
+ }
+ break;
+ }
+ case 0x10695fe7u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_2E2E;
+ }
+ break;
+ }
+ case 0x1069b2c0u:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_1B1B;
+ }
+ break;
+ }
+ case 0x106a110cu:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_3C3C;
+ }
+ break;
+ }
+ case 0x106a63f2u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_2C2C;
+ }
+ break;
+ }
+ case 0x106a713eu:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_2B2B;
+ }
+ break;
+ }
+ case 0x106ade94u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_1B1B;
+ }
+ break;
+ }
+ case 0x106b25c9u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_1C1C;
+ }
+ break;
+ }
+ case 0x106b4468u:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_1C1C;
+ }
+ break;
+ }
+ case 0x106b8219u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_3B3B;
+ }
+ break;
+ }
+ case 0x106bc4fcu:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_3E3E;
+ }
+ break;
+ }
+ case 0x106caf4fu:
+ {
+ if (name.beginsWith(BuiltInName::distance))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_distance_0B0B;
+ }
+ break;
+ }
+ case 0x106d2c39u:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_3B3B;
+ }
+ break;
+ }
+ case 0x106dabccu:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_2B2B;
+ }
+ break;
+ }
+ case 0x106eaf65u:
+ {
+ if (name.beginsWith(BuiltInName::notEqual))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_notEqual_3C3C;
+ }
+ break;
+ }
+ case 0x106faaeau:
+ {
+ if (name.beginsWith(BuiltInName::lessThan))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_lessThan_2C2C;
+ }
+ break;
+ }
+ case 0x106ff564u:
+ {
+ if (name.beginsWith(BuiltInName::distance))
+ {
+ ASSERT(name.length() == 13);
+ return &BuiltInFunction::kFunction_distance_1B1B;
+ }
+ break;
+ }
+ case 0x126235c4u:
+ {
+ if (name.beginsWith(BuiltInName::normalize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_normalize_1B;
+ }
+ break;
+ }
+ case 0x12635a67u:
+ {
+ if (name.beginsWith(BuiltInName::normalize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_normalize_2B;
+ }
+ break;
+ }
+ case 0x1264aa3eu:
+ {
+ if (name.beginsWith(BuiltInName::normalize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_normalize_3B;
+ }
+ break;
+ }
+ case 0x12650243u:
+ {
+ if (name.beginsWith(BuiltInName::normalize))
+ {
+ ASSERT(name.length() == 12);
+ return &BuiltInFunction::kFunction_normalize_0B;
+ }
+ break;
+ }
+ case 0x14888e72u:
+ {
+ if (name.beginsWith(BuiltInName::smoothstep))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_smoothstep_0B0B1B;
+ }
+ break;
+ }
+ case 0x1489436du:
+ {
+ if (name == BuiltInName::smoothstep_1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_smoothstep_1B1B1B;
+ }
+ break;
+ }
+ case 0x1489bfb6u:
+ {
+ if (name == BuiltInName::smoothstep_3B3B3B)
+ {
+ return &BuiltInFunction::kFunction_smoothstep_3B3B3B;
+ }
+ break;
+ }
+ case 0x148a33b9u:
+ {
+ if (name.beginsWith(BuiltInName::smoothstep))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_smoothstep_2B2B2B;
+ }
+ break;
+ }
+ case 0x148de9b5u:
+ {
+ if (name.beginsWith(BuiltInName::smoothstep))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_smoothstep_0B0B0B;
+ }
+ break;
+ }
+ case 0x148e5c11u:
+ {
+ if (name == BuiltInName::smoothstep_0B0B3B)
+ {
+ return &BuiltInFunction::kFunction_smoothstep_0B0B3B;
+ }
+ break;
+ }
+ case 0x148f7bf9u:
+ {
+ if (name.beginsWith(BuiltInName::smoothstep))
+ {
+ ASSERT(name.length() == 17);
+ return &BuiltInFunction::kFunction_smoothstep_0B0B2B;
+ }
+ break;
+ }
+ case 0x1670b92du:
+ {
+ if (name.beginsWith(BuiltInName::inversesqrt))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_inversesqrt_2B;
+ }
+ break;
+ }
+ case 0x1671d38eu:
+ {
+ if (name.beginsWith(BuiltInName::inversesqrt))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_inversesqrt_1B;
+ }
+ break;
+ }
+ case 0x16772b69u:
+ {
+ if (name.beginsWith(BuiltInName::inversesqrt))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_inversesqrt_0B;
+ }
+ break;
+ }
+ case 0x1677857cu:
+ {
+ if (name.beginsWith(BuiltInName::inversesqrt))
+ {
+ ASSERT(name.length() == 14);
+ return &BuiltInFunction::kFunction_inversesqrt_3B;
+ }
+ break;
+ }
+ case 0x16817df9u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_1B1B;
+ }
+ break;
+ }
+ case 0x1681b963u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_3C3C;
+ }
+ break;
+ }
+ case 0x16829d5du:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_3B3B;
+ }
+ break;
+ }
+ case 0x16853112u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_2B2B;
+ }
+ break;
+ }
+ case 0x1685d025u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_2C2C;
+ }
+ break;
+ }
+ case 0x1685db46u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThan))
+ {
+ ASSERT(name.length() == 16);
+ return &BuiltInFunction::kFunction_greaterThan_1C1C;
+ }
+ break;
+ }
+ case 0x1690b84du:
+ {
+ if (name == BuiltInName::faceforward_3B3B3B)
+ {
+ return &BuiltInFunction::kFunction_faceforward_3B3B3B;
+ }
+ break;
+ }
+ case 0x1691c40bu:
+ {
+ if (name == BuiltInName::faceforward_1B1B1B)
+ {
+ return &BuiltInFunction::kFunction_faceforward_1B1B1B;
+ }
+ break;
+ }
+ case 0x1696babeu:
+ {
+ if (name == BuiltInName::faceforward_2B2B2B)
+ {
+ return &BuiltInFunction::kFunction_faceforward_2B2B2B;
+ }
+ break;
+ }
+ case 0x1697cde8u:
+ {
+ if (name.beginsWith(BuiltInName::faceforward))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_faceforward_0B0B0B;
+ }
+ break;
+ }
+ case 0x1a9481a8u:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_2C2C;
+ }
+ break;
+ }
+ case 0x1a94a164u:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_3C3C;
+ }
+ break;
+ }
+ case 0x1a95c72au:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_1B1B;
+ }
+ break;
+ }
+ case 0x1a9642f7u:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_3B3B;
+ }
+ break;
+ }
+ case 0x1a977782u:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_1C1C;
+ }
+ break;
+ }
+ case 0x1a97d055u:
+ {
+ if (name.beginsWith(BuiltInName::lessThanEqual))
+ {
+ ASSERT(name.length() == 18);
+ return &BuiltInFunction::kFunction_lessThanEqual_2B2B;
+ }
+ break;
+ }
+ case 0x1c993bdfu:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_5B5B;
+ }
+ break;
+ }
+ case 0x1c9b357cu:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_FBFB;
+ }
+ break;
+ }
+ case 0x1c9e72dbu:
+ {
+ if (name.beginsWith(BuiltInName::matrixCompMult))
+ {
+ ASSERT(name.length() == 19);
+ return &BuiltInFunction::kFunction_matrixCompMult_ABAB;
+ }
+ break;
+ }
+ case 0x20ab1dc0u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_2C2C;
+ }
+ break;
+ }
+ case 0x20acdd3au:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_1B1B;
+ }
+ break;
+ }
+ case 0x20ad192cu:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_3C3C;
+ }
+ break;
+ }
+ case 0x20adfc96u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_3B3B;
+ }
+ break;
+ }
+ case 0x20ae6ffbu:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_2B2B;
+ }
+ break;
+ }
+ case 0x20af1dd4u:
+ {
+ if (name.beginsWith(BuiltInName::greaterThanEqual))
+ {
+ ASSERT(name.length() == 21);
+ return &BuiltInFunction::kFunction_greaterThanEqual_1C1C;
+ }
+ break;
+ }
+ case 0x7e6af03cu:
+ {
+ if (name == BuiltInName::gl_DepthRange)
+ {
+ return mVar_gl_DepthRange;
+ }
+ break;
+ }
+ case 0x7e8ab02eu:
+ {
+ if (name == BuiltInName::gl_MaxDrawBuffers)
+ {
+ return mVar_gl_MaxDrawBuffers;
+ }
+ break;
+ }
+ case 0x7e9ad799u:
+ {
+ if (name == BuiltInName::gl_MaxVertexAttribs)
+ {
+ return mVar_gl_MaxVertexAttribs;
+ }
+ break;
+ }
+ case 0x7ebaa8e5u:
+ {
+ if (name == BuiltInName::gl_MaxTextureImageUnits)
+ {
+ return mVar_gl_MaxTextureImageUnits;
+ }
+ break;
+ }
+ case 0x7ebeff64u:
+ {
+ if (name == BuiltInName::gl_DepthRangeParameters)
+ {
+ return mVar_gl_DepthRangeParameters;
+ }
+ break;
+ }
+ case 0x7ed35151u:
+ {
+ if (name == BuiltInName::gl_MaxVertexUniformVectors)
+ {
+ return mVar_gl_MaxVertexUniformVectors;
+ }
+ break;
+ }
+ case 0x7ee45ba1u:
+ {
+ if (name == BuiltInName::gl_MaxFragmentUniformVectors)
+ {
+ return mVar_gl_MaxFragmentUniformVectors;
+ }
+ break;
+ }
+ case 0x7eea039au:
+ {
+ if (name == BuiltInName::gl_MaxVertexTextureImageUnits)
+ {
+ return mVar_gl_MaxVertexTextureImageUnits;
+ }
+ break;
+ }
+ case 0x7ef1e608u:
+ {
+ if (name == BuiltInName::gl_MaxDualSourceDrawBuffersEXT)
+ {
+ return mVar_gl_MaxDualSourceDrawBuffersEXT;
+ }
+ break;
+ }
+ case 0x7ef84293u:
+ {
+ if (name == BuiltInName::gl_MaxCombinedTextureImageUnits)
+ {
+ return mVar_gl_MaxCombinedTextureImageUnits;
+ }
+ break;
+ }
+ }
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e64c010u:
+ {
+ if (name == BuiltInName::gl_FragCoord)
+ {
+ return &BuiltInVariable::kVar_gl_FragCoord;
+ }
+ break;
+ }
+ case 0x7e6c2088u:
+ {
+ if (name == BuiltInName::gl_PointCoord)
+ {
+ return &BuiltInVariable::kVar_gl_PointCoord;
+ }
+ break;
+ }
+ case 0x7e73011eu:
+ {
+ if (name == BuiltInName::gl_FrontFacing)
+ {
+ return &BuiltInVariable::kVar_gl_FrontFacing;
+ }
+ break;
+ }
+ }
+ }
+ if (mShaderType == GL_VERTEX_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e580bc5u:
+ {
+ if (name == BuiltInName::gl_Position)
+ {
+ return &BuiltInVariable::kVar_gl_Position;
+ }
+ break;
+ }
+ case 0x7e63931cu:
+ {
+ if (name == BuiltInName::gl_PointSize)
+ {
+ return &BuiltInVariable::kVar_gl_PointSize;
+ }
+ break;
+ }
+ }
+ }
+ return nullptr;
+}
+
+const UnmangledBuiltIn *TSymbolTable::getUnmangledBuiltInForShaderVersion(
+ const ImmutableString &name,
+ int shaderVersion)
+{
+ if (name.length() > 26)
+ {
+ return nullptr;
+ }
+ uint32_t nameHash = name.mangledNameHash();
+ if (shaderVersion >= 310)
+ {
+ switch (nameHash)
+ {
+ case 0x7e2c727fu:
+ {
+ if (name == BuiltInName::ldexp)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2d0692u:
+ {
+ if (name == BuiltInName::frexp)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e399596u:
+ {
+ if (name == BuiltInName::findLSB)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e3bdf3fu:
+ {
+ if (name == BuiltInName::findMSB)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e41283bu:
+ {
+ if (name == BuiltInName::bitCount)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4690b3u:
+ {
+ if (name == BuiltInName::atomicOr)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4800e3u:
+ {
+ if (name == BuiltInName::atomicAdd)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4893a8u:
+ {
+ if (name == BuiltInName::atomicMax)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e49061fu:
+ {
+ if (name == BuiltInName::atomicMin)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4a45b6u:
+ {
+ if (name == BuiltInName::imageLoad)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4b6656u:
+ {
+ if (name == BuiltInName::imageSize)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4dea77u:
+ {
+ if (name == BuiltInName::atomicXor)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4e5094u:
+ {
+ if (name == BuiltInName::uaddCarry)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4f21aeu:
+ {
+ if (name == BuiltInName::atomicAnd)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5237e1u:
+ {
+ if (name == BuiltInName::texelFetch)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5276efu:
+ {
+ if (name == BuiltInName::imageStore)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e55de86u:
+ {
+ if (name == BuiltInName::usubBorrow)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5e217eu:
+ {
+ if (name == BuiltInName::textureSize)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e6273e5u:
+ {
+ if (name == BuiltInName::packSnorm4x8)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e62a9a0u:
+ {
+ if (name == BuiltInName::imulExtended)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e657e29u:
+ {
+ if (name == BuiltInName::packUnorm4x8)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e6746f4u:
+ {
+ if (name == BuiltInName::umulExtended)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e69d0dbu:
+ {
+ if (name == BuiltInName::memoryBarrier)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e6d0f32u:
+ {
+ if (name == BuiltInName::textureGather)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e6e00a5u:
+ {
+ if (name == BuiltInName::atomicCounter)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e71963eu:
+ {
+ if (name == BuiltInName::unpackUnorm4x8)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e73f1d1u:
+ {
+ if (name == BuiltInName::unpackSnorm4x8)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e75cfb1u:
+ {
+ if (name == BuiltInName::atomicExchange)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e778ffcu:
+ {
+ if (name == BuiltInName::atomicCompSwap)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e77c121u:
+ {
+ if (name == BuiltInName::bitfieldInsert)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e7f2cb2u:
+ {
+ if (name == BuiltInName::bitfieldReverse)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e7fa0c1u:
+ {
+ if (name == BuiltInName::bitfieldExtract)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e9269d7u:
+ {
+ if (name == BuiltInName::memoryBarrierImage)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e9b7f32u:
+ {
+ if (name == BuiltInName::memoryBarrierBuffer)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e9d8ad9u:
+ {
+ if (name == BuiltInName::textureGatherOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7eb323ddu:
+ {
+ if (name == BuiltInName::atomicCounterIncrement)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7eb6aed0u:
+ {
+ if (name == BuiltInName::atomicCounterDecrement)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7ed5b06bu:
+ {
+ if (name == BuiltInName::memoryBarrierAtomicCounter)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ }
+ if (mShaderType == GL_COMPUTE_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e39f4e9u:
+ {
+ if (name == BuiltInName::barrier)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e93c6b9u:
+ {
+ if (name == BuiltInName::groupMemoryBarrier)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e9f4b19u:
+ {
+ if (name == BuiltInName::memoryBarrierShared)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ }
+ }
+ if (mShaderType == GL_GEOMETRY_SHADER_EXT)
+ {
+ switch (nameHash)
+ {
+ case 0x7e55adc2u:
+ {
+ if (name == BuiltInName::EmitVertex)
+ {
+ return &UnmangledBuiltIns::EXT_geometry_shader;
+ }
+ break;
+ }
+ case 0x7e65b2cau:
+ {
+ if (name == BuiltInName::EndPrimitive)
+ {
+ return &UnmangledBuiltIns::EXT_geometry_shader;
+ }
+ break;
+ }
+ }
+ }
+ }
+ if (shaderVersion >= 300)
+ {
+ switch (nameHash)
+ {
+ case 0x7e19507bu:
+ {
+ if (name == BuiltInName::abs)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1e492du:
+ {
+ if (name == BuiltInName::min)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1ea71bu:
+ {
+ if (name == BuiltInName::mix)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1ebe0eu:
+ {
+ if (name == BuiltInName::max)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e205c92u:
+ {
+ if (name == BuiltInName::tanh)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e206e40u:
+ {
+ if (name == BuiltInName::sign)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e209eadu:
+ {
+ if (name == BuiltInName::sinh)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e274509u:
+ {
+ if (name == BuiltInName::modf)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e27a4feu:
+ {
+ if (name == BuiltInName::cosh)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e28294fu:
+ {
+ if (name == BuiltInName::atanh)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2924b8u:
+ {
+ if (name == BuiltInName::isinf)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e297347u:
+ {
+ if (name == BuiltInName::equal)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2a7a64u:
+ {
+ if (name == BuiltInName::round)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2d5dcbu:
+ {
+ if (name == BuiltInName::clamp)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2d8df4u:
+ {
+ if (name == BuiltInName::isnan)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2dcbc6u:
+ {
+ if (name == BuiltInName::asinh)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2eab16u:
+ {
+ if (name == BuiltInName::trunc)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2f67c3u:
+ {
+ if (name == BuiltInName::acosh)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e39ebd7u:
+ {
+ if (name == BuiltInName::texture)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e3d828cu:
+ {
+ if (name == BuiltInName::inverse)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e403a20u:
+ {
+ if (name == BuiltInName::lessThan)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e413f93u:
+ {
+ if (name == BuiltInName::notEqual)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4d27c2u:
+ {
+ if (name == BuiltInName::rgb_2_yuv)
+ {
+ return &UnmangledBuiltIns::EXT_YUV_target;
+ }
+ break;
+ }
+ case 0x7e4d323bu:
+ {
+ if (name == BuiltInName::roundEven)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4e024cu:
+ {
+ if (name == BuiltInName::transpose)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4e33aeu:
+ {
+ if (name == BuiltInName::yuv_2_rgb)
+ {
+ return &UnmangledBuiltIns::EXT_YUV_target;
+ }
+ break;
+ }
+ case 0x7e501e0cu:
+ {
+ if (name == BuiltInName::textureLod)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5237e1u:
+ {
+ if (name == BuiltInName::texelFetch)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e582ffcu:
+ {
+ if (name == BuiltInName::greaterThan)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e599347u:
+ {
+ if (name == BuiltInName::textureGrad)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5ba531u:
+ {
+ if (name == BuiltInName::determinant)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5caafbu:
+ {
+ if (name == BuiltInName::textureProj)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5e217eu:
+ {
+ if (name == BuiltInName::textureSize)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e62daa3u:
+ {
+ if (name == BuiltInName::packHalf2x16)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e646b9bu:
+ {
+ if (name == BuiltInName::outerProduct)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e683586u:
+ {
+ if (name == BuiltInName::lessThanEqual)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e6a013du:
+ {
+ if (name == BuiltInName::packSnorm2x16)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e6b72b8u:
+ {
+ if (name == BuiltInName::packUnorm2x16)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e6c5187u:
+ {
+ if (name == BuiltInName::textureOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e715db5u:
+ {
+ if (name == BuiltInName::unpackHalf2x16)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e759618u:
+ {
+ if (name == BuiltInName::floatBitsToInt)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e75ae2fu:
+ {
+ if (name == BuiltInName::textureProjLod)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e76bea7u:
+ {
+ if (name == BuiltInName::matrixCompMult)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e77fc97u:
+ {
+ if (name == BuiltInName::intBitsToFloat)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e792d39u:
+ {
+ if (name == BuiltInName::unpackUnorm2x16)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e7b6a0eu:
+ {
+ if (name == BuiltInName::unpackSnorm2x16)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e7bc1fdu:
+ {
+ if (name == BuiltInName::textureProjGrad)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e7e0e81u:
+ {
+ if (name == BuiltInName::uintBitsToFloat)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e7e5132u:
+ {
+ if (name == BuiltInName::floatBitsToUint)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e80919du:
+ {
+ if (name == BuiltInName::texelFetchOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e81c71au:
+ {
+ if (name == BuiltInName::textureLodOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e876cccu:
+ {
+ if (name == BuiltInName::greaterThanEqual)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e8b5832u:
+ {
+ if (name == BuiltInName::textureGradOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e8d2d2du:
+ {
+ if (name == BuiltInName::textureProjOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7ea0be08u:
+ {
+ if (name == BuiltInName::textureProjLodOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7eac5717u:
+ {
+ if (name == BuiltInName::textureProjGradOffset)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ }
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e2624d4u:
+ {
+ if (name == BuiltInName::dFdy)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e265ea7u:
+ {
+ if (name == BuiltInName::dFdx)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e324ea1u:
+ {
+ if (name == BuiltInName::fwidth)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ }
+ }
+ }
+ if (shaderVersion == 100)
+ {
+ switch (nameHash)
+ {
+ case 0x7e48c50cu:
+ {
+ if (name == BuiltInName::texture2D)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5ffc48u:
+ {
+ if (name == BuiltInName::textureCube)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e69f545u:
+ {
+ if (name == BuiltInName::texture2DRect)
+ {
+ return &UnmangledBuiltIns::ARB_texture_rectangle;
+ }
+ break;
+ }
+ case 0x7e6e3735u:
+ {
+ if (name == BuiltInName::texture2DProj)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e868a22u:
+ {
+ if (name == BuiltInName::texture2DGradEXT)
+ {
+ return &UnmangledBuiltIns::EXT_shader_texture_lod;
+ }
+ break;
+ }
+ case 0x7e8b66e4u:
+ {
+ if (name == BuiltInName::texture2DRectProj)
+ {
+ return &UnmangledBuiltIns::ARB_texture_rectangle;
+ }
+ break;
+ }
+ case 0x7e90fa5bu:
+ {
+ if (name == BuiltInName::textureCubeGradEXT)
+ {
+ return &UnmangledBuiltIns::EXT_shader_texture_lod;
+ }
+ break;
+ }
+ case 0x7ea20b8fu:
+ {
+ if (name == BuiltInName::texture2DProjGradEXT)
+ {
+ return &UnmangledBuiltIns::EXT_shader_texture_lod;
+ }
+ break;
+ }
+ }
+ if (mShaderType == GL_FRAGMENT_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e2624d4u:
+ {
+ if (name == BuiltInName::dFdyExt)
+ {
+ return &UnmangledBuiltIns::OES_standard_derivatives;
+ }
+ break;
+ }
+ case 0x7e265ea7u:
+ {
+ if (name == BuiltInName::dFdxExt)
+ {
+ return &UnmangledBuiltIns::OES_standard_derivatives;
+ }
+ break;
+ }
+ case 0x7e324ea1u:
+ {
+ if (name == BuiltInName::fwidthExt)
+ {
+ return &UnmangledBuiltIns::OES_standard_derivatives;
+ }
+ break;
+ }
+ case 0x7e4db1c8u:
+ {
+ if (name == BuiltInName::texture3D)
+ {
+ return &UnmangledBuiltIns::OES_texture_3D;
+ }
+ break;
+ }
+ case 0x7e63c1d1u:
+ {
+ if (name == BuiltInName::texture3DLod)
+ {
+ return &UnmangledBuiltIns::OES_texture_3D;
+ }
+ break;
+ }
+ case 0x7e687e40u:
+ {
+ if (name == BuiltInName::texture3DProj)
+ {
+ return &UnmangledBuiltIns::OES_texture_3D;
+ }
+ break;
+ }
+ case 0x7e7b843eu:
+ {
+ if (name == BuiltInName::texture2DLodEXT)
+ {
+ return &UnmangledBuiltIns::EXT_shader_texture_lod;
+ }
+ break;
+ }
+ case 0x7e85692eu:
+ {
+ if (name == BuiltInName::texture3DProjLod)
+ {
+ return &UnmangledBuiltIns::OES_texture_3D;
+ }
+ break;
+ }
+ case 0x7e8b81cau:
+ {
+ if (name == BuiltInName::textureCubeLodEXT)
+ {
+ return &UnmangledBuiltIns::EXT_shader_texture_lod;
+ }
+ break;
+ }
+ case 0x7e9ddba0u:
+ {
+ if (name == BuiltInName::texture2DProjLodEXT)
+ {
+ return &UnmangledBuiltIns::EXT_shader_texture_lod;
+ }
+ break;
+ }
+ }
+ }
+ if (mShaderType == GL_VERTEX_SHADER)
+ {
+ switch (nameHash)
+ {
+ case 0x7e67c7ceu:
+ {
+ if (name == BuiltInName::texture2DLod)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e758eddu:
+ {
+ if (name == BuiltInName::textureCubeLod)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e819b90u:
+ {
+ if (name == BuiltInName::texture2DProjLod)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ }
+ }
+ }
+ switch (nameHash)
+ {
+ case 0x7e1892eeu:
+ {
+ if (name == BuiltInName::all)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e19507bu:
+ {
+ if (name == BuiltInName::abs)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e195106u:
+ {
+ if (name == BuiltInName::notFunc)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e197102u:
+ {
+ if (name == BuiltInName::any)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e19ebdbu:
+ {
+ if (name == BuiltInName::log)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1acb4eu:
+ {
+ if (name == BuiltInName::pow)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1b921cu:
+ {
+ if (name == BuiltInName::exp)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1cf321u:
+ {
+ if (name == BuiltInName::tan)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1e492du:
+ {
+ if (name == BuiltInName::min)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1e8464u:
+ {
+ if (name == BuiltInName::dot)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1ea71bu:
+ {
+ if (name == BuiltInName::mix)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1ebe0eu:
+ {
+ if (name == BuiltInName::max)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1eee70u:
+ {
+ if (name == BuiltInName::mod)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1f0bccu:
+ {
+ if (name == BuiltInName::sin)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e1fdef3u:
+ {
+ if (name == BuiltInName::cos)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e203979u:
+ {
+ if (name == BuiltInName::atan)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e206e40u:
+ {
+ if (name == BuiltInName::sign)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e209ec1u:
+ {
+ if (name == BuiltInName::log2)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e21ff11u:
+ {
+ if (name == BuiltInName::acos)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e23152fu:
+ {
+ if (name == BuiltInName::ceil)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e23f4beu:
+ {
+ if (name == BuiltInName::sqrt)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e24bcdbu:
+ {
+ if (name == BuiltInName::exp2)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e26202fu:
+ {
+ if (name == BuiltInName::step)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e27ebd5u:
+ {
+ if (name == BuiltInName::asin)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e295733u:
+ {
+ if (name == BuiltInName::cross)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e297347u:
+ {
+ if (name == BuiltInName::equal)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2d5dcbu:
+ {
+ if (name == BuiltInName::clamp)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2dcb25u:
+ {
+ if (name == BuiltInName::floor)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e2f6df3u:
+ {
+ if (name == BuiltInName::fract)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e340894u:
+ {
+ if (name == BuiltInName::length)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e38233fu:
+ {
+ if (name == BuiltInName::refract)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e3c3cb3u:
+ {
+ if (name == BuiltInName::radians)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e3c8e91u:
+ {
+ if (name == BuiltInName::reflect)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e3d784cu:
+ {
+ if (name == BuiltInName::degrees)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e403a20u:
+ {
+ if (name == BuiltInName::lessThan)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e413f93u:
+ {
+ if (name == BuiltInName::notEqual)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4161fau:
+ {
+ if (name == BuiltInName::distance)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e4e7aa5u:
+ {
+ if (name == BuiltInName::normalize)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e54a2cfu:
+ {
+ if (name == BuiltInName::smoothstep)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e582ffcu:
+ {
+ if (name == BuiltInName::greaterThan)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5ae14bu:
+ {
+ if (name == BuiltInName::faceforward)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e5f4d0fu:
+ {
+ if (name == BuiltInName::inversesqrt)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e683586u:
+ {
+ if (name == BuiltInName::lessThanEqual)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e76bea7u:
+ {
+ if (name == BuiltInName::matrixCompMult)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ case 0x7e876cccu:
+ {
+ if (name == BuiltInName::greaterThanEqual)
+ {
+ return &UnmangledBuiltIns::UNDEFINED;
+ }
+ break;
+ }
+ }
+ return nullptr;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.h b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.h
new file mode 100644
index 0000000000..2168743e29
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.h
@@ -0,0 +1,78 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_builtin_symbols.py using data from builtin_variables.json and
+// builtin_function_declarations.txt.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SymbolTable_autogen.h:
+// Autogenerated member variables of TSymbolTable.
+
+#ifndef COMPILER_TRANSLATOR_SYMBOLTABLE_AUTOGEN_H_
+#define COMPILER_TRANSLATOR_SYMBOLTABLE_AUTOGEN_H_
+
+namespace sh
+{
+
+class TSymbolTableBase
+{
+ protected:
+ TSymbolTableBase() = default;
+ TStructure *mVar_gl_DepthRangeParameters = nullptr;
+ TVariable *mVar_gl_DepthRange = nullptr;
+ TVariable *mVar_gl_MaxVertexAttribs = nullptr;
+ TVariable *mVar_gl_MaxVertexUniformVectors = nullptr;
+ TVariable *mVar_gl_MaxVertexTextureImageUnits = nullptr;
+ TVariable *mVar_gl_MaxCombinedTextureImageUnits = nullptr;
+ TVariable *mVar_gl_MaxTextureImageUnits = nullptr;
+ TVariable *mVar_gl_MaxFragmentUniformVectors = nullptr;
+ TVariable *mVar_gl_MaxVaryingVectors = nullptr;
+ TVariable *mVar_gl_MaxDrawBuffers = nullptr;
+ TVariable *mVar_gl_MaxDualSourceDrawBuffersEXT = nullptr;
+ TVariable *mVar_gl_MaxVertexOutputVectors = nullptr;
+ TVariable *mVar_gl_MaxFragmentInputVectors = nullptr;
+ TVariable *mVar_gl_MinProgramTexelOffset = nullptr;
+ TVariable *mVar_gl_MaxProgramTexelOffset = nullptr;
+ TVariable *mVar_gl_MaxImageUnits = nullptr;
+ TVariable *mVar_gl_MaxVertexImageUniforms = nullptr;
+ TVariable *mVar_gl_MaxFragmentImageUniforms = nullptr;
+ TVariable *mVar_gl_MaxComputeImageUniforms = nullptr;
+ TVariable *mVar_gl_MaxCombinedImageUniforms = nullptr;
+ TVariable *mVar_gl_MaxCombinedShaderOutputResources = nullptr;
+ TVariable *mVar_gl_MaxComputeWorkGroupCount = nullptr;
+ TVariable *mVar_gl_MaxComputeWorkGroupSize = nullptr;
+ TVariable *mVar_gl_MaxComputeUniformComponents = nullptr;
+ TVariable *mVar_gl_MaxComputeTextureImageUnits = nullptr;
+ TVariable *mVar_gl_MaxComputeAtomicCounters = nullptr;
+ TVariable *mVar_gl_MaxComputeAtomicCounterBuffers = nullptr;
+ TVariable *mVar_gl_MaxVertexAtomicCounters = nullptr;
+ TVariable *mVar_gl_MaxFragmentAtomicCounters = nullptr;
+ TVariable *mVar_gl_MaxCombinedAtomicCounters = nullptr;
+ TVariable *mVar_gl_MaxAtomicCounterBindings = nullptr;
+ TVariable *mVar_gl_MaxVertexAtomicCounterBuffers = nullptr;
+ TVariable *mVar_gl_MaxFragmentAtomicCounterBuffers = nullptr;
+ TVariable *mVar_gl_MaxCombinedAtomicCounterBuffers = nullptr;
+ TVariable *mVar_gl_MaxAtomicCounterBufferSize = nullptr;
+ TVariable *mVar_gl_MaxGeometryInputComponents = nullptr;
+ TVariable *mVar_gl_MaxGeometryOutputComponents = nullptr;
+ TVariable *mVar_gl_MaxGeometryImageUniforms = nullptr;
+ TVariable *mVar_gl_MaxGeometryTextureImageUnits = nullptr;
+ TVariable *mVar_gl_MaxGeometryOutputVertices = nullptr;
+ TVariable *mVar_gl_MaxGeometryTotalOutputComponents = nullptr;
+ TVariable *mVar_gl_MaxGeometryUniformComponents = nullptr;
+ TVariable *mVar_gl_MaxGeometryAtomicCounters = nullptr;
+ TVariable *mVar_gl_MaxGeometryAtomicCounterBuffers = nullptr;
+ TVariable *mVar_gl_FragData = nullptr;
+ TVariable *mVar_gl_SecondaryFragDataEXT = nullptr;
+ TVariable *mVar_gl_FragDepthEXT = nullptr;
+ TVariable *mVar_gl_LastFragData = nullptr;
+ TVariable *mVar_gl_LastFragDataNV = nullptr;
+ TInterfaceBlock *mVar_gl_PerVertex = nullptr;
+ TVariable *mVar_gl_in = nullptr;
+ TVariable *mVar_gl_PositionGS = nullptr;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_SYMBOLTABLE_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp
new file mode 100644
index 0000000000..3aeb80b708
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SymbolUniqueId.cpp: Encapsulates a unique id for a symbol.
+
+#include "compiler/translator/SymbolUniqueId.h"
+
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+TSymbolUniqueId::TSymbolUniqueId(TSymbolTable *symbolTable) : mId(symbolTable->nextUniqueIdValue())
+{}
+
+TSymbolUniqueId::TSymbolUniqueId(const TSymbol &symbol) : mId(symbol.uniqueId().get()) {}
+
+TSymbolUniqueId &TSymbolUniqueId::operator=(const TSymbolUniqueId &) = default;
+
+bool TSymbolUniqueId::operator==(const TSymbolUniqueId &other) const
+{
+ return mId == other.mId;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h
new file mode 100644
index 0000000000..7d0979e266
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SymbolUniqueId.h: Encapsulates a unique id for a symbol.
+
+#ifndef COMPILER_TRANSLATOR_SYMBOLUNIQUEID_H_
+#define COMPILER_TRANSLATOR_SYMBOLUNIQUEID_H_
+
+#include "compiler/translator/Common.h"
+
+namespace sh
+{
+
+class TSymbolTable;
+class TSymbol;
+
+class TSymbolUniqueId
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ explicit TSymbolUniqueId(const TSymbol &symbol);
+ constexpr TSymbolUniqueId(const TSymbolUniqueId &) = default;
+ TSymbolUniqueId &operator =(const TSymbolUniqueId &);
+ bool operator==(const TSymbolUniqueId &) const;
+
+ constexpr int get() const { return mId; }
+
+ private:
+ friend class TSymbolTable;
+ explicit TSymbolUniqueId(TSymbolTable *symbolTable);
+
+ friend class BuiltInId;
+ constexpr TSymbolUniqueId(int staticId) : mId(staticId) {}
+
+ int mId;
+};
+
+enum class SymbolType
+{
+ BuiltIn,
+ UserDefined,
+ AngleInternal,
+ Empty // Meaning symbol without a name.
+};
+
+enum class SymbolClass
+{
+ Function,
+ Variable,
+ Struct,
+ InterfaceBlock
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_SYMBOLUNIQUEID_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.cpp
new file mode 100644
index 0000000000..6ef502587c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.cpp
@@ -0,0 +1,1554 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// TextureFunctionHLSL: Class for writing implementations of ESSL texture functions into HLSL
+// output. Some of the implementations are straightforward and just call the HLSL equivalent of the
+// ESSL texture function, others do more work to emulate ESSL texture sampling or size query
+// behavior.
+//
+
+#include "compiler/translator/TextureFunctionHLSL.h"
+
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/UtilsHLSL.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void OutputIntTexCoordWrap(TInfoSinkBase &out,
+ const char *wrapMode,
+ const char *size,
+ const ImmutableString &texCoord,
+ const char *texCoordOffset,
+ const char *texCoordOutName)
+{
+ // GLES 3.0.4 table 3.22 specifies how the wrap modes work. We don't use the formulas verbatim
+ // but rather use equivalent formulas that map better to HLSL.
+ out << "int " << texCoordOutName << ";\n";
+ out << "float " << texCoordOutName << "Offset = " << texCoord << " + float(" << texCoordOffset
+ << ") / " << size << ";\n";
+ out << "bool " << texCoordOutName << "UseBorderColor = false;\n";
+
+ // CLAMP_TO_EDGE
+ out << "if (" << wrapMode << " == 0)\n";
+ out << "{\n";
+ out << " " << texCoordOutName << " = clamp(int(floor(" << size << " * " << texCoordOutName
+ << "Offset)), 0, int(" << size << ") - 1);\n";
+ out << "}\n";
+
+ // CLAMP_TO_BORDER
+ out << "else if (" << wrapMode << " == 3)\n";
+ out << "{\n";
+ out << " int texCoordInt = int(floor(" << size << " * " << texCoordOutName << "Offset));\n";
+ out << " " << texCoordOutName << " = clamp(texCoordInt, 0, int(" << size << ") - 1);\n";
+ out << " " << texCoordOutName << "UseBorderColor = (texCoordInt != " << texCoordOutName
+ << ");\n";
+ out << "}\n";
+
+ // MIRRORED_REPEAT
+ out << "else if (" << wrapMode << " == 2)\n";
+ out << "{\n";
+ out << " float coordWrapped = 1.0 - abs(frac(abs(" << texCoordOutName
+ << "Offset) * 0.5) * 2.0 - 1.0);\n";
+ out << " " << texCoordOutName << " = int(floor(" << size << " * coordWrapped));\n";
+ out << "}\n";
+
+ // REPEAT
+ out << "else\n";
+ out << "{\n";
+ out << " " << texCoordOutName << " = int(floor(" << size << " * frac(" << texCoordOutName
+ << "Offset)));\n";
+ out << "}\n";
+}
+
+void OutputIntTexCoordWraps(TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ ImmutableString *texCoordX,
+ ImmutableString *texCoordY,
+ ImmutableString *texCoordZ)
+{
+ // Convert from normalized floating-point to integer
+ out << "int wrapS = samplerMetadata[samplerIndex].wrapModes & 0x3;\n";
+ if (textureFunction.offset)
+ {
+ OutputIntTexCoordWrap(out, "wrapS", "width", *texCoordX, "offset.x", "tix");
+ }
+ else
+ {
+ OutputIntTexCoordWrap(out, "wrapS", "width", *texCoordX, "0", "tix");
+ }
+ *texCoordX = ImmutableString("tix");
+ out << "int wrapT = (samplerMetadata[samplerIndex].wrapModes >> 2) & 0x3;\n";
+ if (textureFunction.offset)
+ {
+ OutputIntTexCoordWrap(out, "wrapT", "height", *texCoordY, "offset.y", "tiy");
+ }
+ else
+ {
+ OutputIntTexCoordWrap(out, "wrapT", "height", *texCoordY, "0", "tiy");
+ }
+ *texCoordY = ImmutableString("tiy");
+
+ bool tizAvailable = false;
+
+ if (IsSamplerArray(textureFunction.sampler))
+ {
+ *texCoordZ = ImmutableString("int(max(0, min(layers - 1, floor(0.5 + t.z))))");
+ }
+ else if (!IsSamplerCube(textureFunction.sampler) && !IsSampler2D(textureFunction.sampler))
+ {
+ out << "int wrapR = (samplerMetadata[samplerIndex].wrapModes >> 4) & 0x3;\n";
+ if (textureFunction.offset)
+ {
+ OutputIntTexCoordWrap(out, "wrapR", "depth", *texCoordZ, "offset.z", "tiz");
+ }
+ else
+ {
+ OutputIntTexCoordWrap(out, "wrapR", "depth", *texCoordZ, "0", "tiz");
+ }
+ *texCoordZ = ImmutableString("tiz");
+ tizAvailable = true;
+ }
+
+ out << "bool useBorderColor = tixUseBorderColor || tiyUseBorderColor"
+ << (tizAvailable ? " || tizUseBorderColor" : "") << ";\n";
+}
+
+void OutputHLSL4SampleFunctionPrefix(TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ const ImmutableString &textureReference,
+ const ImmutableString &samplerReference)
+{
+ out << textureReference;
+ if (IsIntegerSampler(textureFunction.sampler) ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::FETCH)
+ {
+ out << ".Load(";
+ return;
+ }
+
+ if (IsShadowSampler(textureFunction.sampler))
+ {
+ switch (textureFunction.method)
+ {
+ case TextureFunctionHLSL::TextureFunction::IMPLICIT:
+ case TextureFunctionHLSL::TextureFunction::BIAS:
+ case TextureFunctionHLSL::TextureFunction::LOD:
+ out << ".SampleCmp(";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0:
+ case TextureFunctionHLSL::TextureFunction::LOD0BIAS:
+ case TextureFunctionHLSL::TextureFunction::GRAD:
+ out << ".SampleCmpLevelZero(";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ switch (textureFunction.method)
+ {
+ case TextureFunctionHLSL::TextureFunction::IMPLICIT:
+ out << ".Sample(";
+ break;
+ case TextureFunctionHLSL::TextureFunction::BIAS:
+ out << ".SampleBias(";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD:
+ case TextureFunctionHLSL::TextureFunction::LOD0:
+ case TextureFunctionHLSL::TextureFunction::LOD0BIAS:
+ out << ".SampleLevel(";
+ break;
+ case TextureFunctionHLSL::TextureFunction::GRAD:
+ out << ".SampleGrad(";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ out << samplerReference << ", ";
+}
+
+const char *GetSamplerCoordinateTypeString(
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ int hlslCoords)
+{
+ // Gather[Red|Green|Blue|Alpha] accepts float texture coordinates on textures in integer or
+ // unsigned integer formats.
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-to-gather
+ if ((IsIntegerSampler(textureFunction.sampler) &&
+ textureFunction.method != TextureFunctionHLSL::TextureFunction::GATHER) ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::FETCH)
+ {
+ switch (hlslCoords)
+ {
+ case 2:
+ if (IsSampler2DMS(textureFunction.sampler))
+ {
+ return "int2";
+ }
+ else
+ {
+ return "int3";
+ }
+ case 3:
+ if (IsSampler2DMSArray(textureFunction.sampler))
+ {
+ return "int3";
+ }
+ else
+ {
+ return "int4";
+ }
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ switch (hlslCoords)
+ {
+ case 2:
+ return "float2";
+ case 3:
+ return "float3";
+ case 4:
+ return "float4";
+ default:
+ UNREACHABLE();
+ }
+ }
+ return "";
+}
+
+int GetHLSLCoordCount(const TextureFunctionHLSL::TextureFunction &textureFunction,
+ ShShaderOutput outputType)
+{
+ if (outputType == SH_HLSL_3_0_OUTPUT)
+ {
+ int hlslCoords = 2;
+ switch (textureFunction.sampler)
+ {
+ case EbtSampler2D:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DMS:
+ hlslCoords = 2;
+ break;
+ case EbtSamplerCube:
+ hlslCoords = 3;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ switch (textureFunction.method)
+ {
+ case TextureFunctionHLSL::TextureFunction::IMPLICIT:
+ case TextureFunctionHLSL::TextureFunction::GRAD:
+ return hlslCoords;
+ case TextureFunctionHLSL::TextureFunction::BIAS:
+ case TextureFunctionHLSL::TextureFunction::LOD:
+ case TextureFunctionHLSL::TextureFunction::LOD0:
+ case TextureFunctionHLSL::TextureFunction::LOD0BIAS:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ if (IsSampler3D(textureFunction.sampler) || IsSamplerArray(textureFunction.sampler) ||
+ IsSamplerCube(textureFunction.sampler))
+ {
+ return 3;
+ }
+ ASSERT(IsSampler2D(textureFunction.sampler));
+ return 2;
+ }
+ return 0;
+}
+
+void OutputTextureFunctionArgumentList(TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ const ShShaderOutput outputType)
+{
+ if (outputType == SH_HLSL_3_0_OUTPUT)
+ {
+ switch (textureFunction.sampler)
+ {
+ case EbtSampler2D:
+ case EbtSamplerExternalOES:
+ out << "sampler2D s";
+ break;
+ case EbtSamplerCube:
+ out << "samplerCUBE s";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ if (outputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ out << TextureString(textureFunction.sampler) << " x, "
+ << SamplerString(textureFunction.sampler) << " s";
+ }
+ else
+ {
+ ASSERT(outputType == SH_HLSL_4_1_OUTPUT);
+ // A bug in the D3D compiler causes some nested sampling operations to fail.
+ // See http://anglebug.com/1923
+ // TODO(jmadill): Reinstate the const keyword when possible.
+ out << /*"const"*/ "uint samplerIndex";
+ }
+ }
+
+ if (textureFunction.method ==
+ TextureFunctionHLSL::TextureFunction::FETCH) // Integer coordinates
+ {
+ switch (textureFunction.coords)
+ {
+ case 2:
+ out << ", int2 t";
+ break;
+ case 3:
+ out << ", int3 t";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else // Floating-point coordinates (except textureSize)
+ {
+ switch (textureFunction.coords)
+ {
+ case 0:
+ break; // textureSize(gSampler2DMS sampler)
+ 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();
+ }
+ }
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
+ {
+ switch (textureFunction.sampler)
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ case EbtSamplerExternalOES:
+ 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();
+ }
+ }
+
+ switch (textureFunction.method)
+ {
+ case TextureFunctionHLSL::TextureFunction::IMPLICIT:
+ break;
+ case TextureFunctionHLSL::TextureFunction::BIAS:
+ break; // Comes after the offset parameter
+ case TextureFunctionHLSL::TextureFunction::LOD:
+ out << ", float lod";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0:
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0BIAS:
+ break; // Comes after the offset parameter
+ case TextureFunctionHLSL::TextureFunction::SIZE:
+ break;
+ case TextureFunctionHLSL::TextureFunction::FETCH:
+ if (IsSampler2DMS(textureFunction.sampler) ||
+ IsSampler2DMSArray(textureFunction.sampler))
+ out << ", int index";
+ else
+ out << ", int mip";
+ break;
+ case TextureFunctionHLSL::TextureFunction::GRAD:
+ break;
+ case TextureFunctionHLSL::TextureFunction::GATHER:
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GATHER &&
+ IsShadowSampler(textureFunction.sampler))
+ {
+ out << ", float refZ";
+ }
+
+ if (textureFunction.offset)
+ {
+ switch (textureFunction.sampler)
+ {
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ out << ", int3 offset";
+ break;
+ case EbtSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2D:
+ case EbtISampler2DArray:
+ case EbtUSampler2D:
+ case EbtUSampler2DArray:
+ case EbtSampler2DShadow:
+ case EbtSampler2DArrayShadow:
+ case EbtSamplerExternalOES:
+ out << ", int2 offset";
+ break;
+ default:
+ // Offset is not supported for multisampled textures.
+ UNREACHABLE();
+ }
+ }
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0BIAS)
+ {
+ out << ", float bias";
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GATHER &&
+ !IsShadowSampler(textureFunction.sampler))
+ {
+ out << ", int comp = 0";
+ }
+}
+
+void GetTextureReference(TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ const ShShaderOutput outputType,
+ ImmutableString *textureReference,
+ ImmutableString *samplerReference)
+{
+ if (outputType == SH_HLSL_4_1_OUTPUT)
+ {
+ static const ImmutableString kTexturesStr("textures");
+ static const ImmutableString kSamplersStr("samplers");
+ static const ImmutableString kSamplerIndexStr("[samplerIndex]");
+ static const ImmutableString kTextureIndexStr("[textureIndex]");
+ static const ImmutableString kSamplerArrayIndexStr("[samplerArrayIndex]");
+ ImmutableString suffix(TextureGroupSuffix(textureFunction.sampler));
+
+ if (TextureGroup(textureFunction.sampler) == HLSL_TEXTURE_2D)
+ {
+ ImmutableStringBuilder textureRefBuilder(kTexturesStr.length() + suffix.length() +
+ kSamplerIndexStr.length());
+ textureRefBuilder << kTexturesStr << suffix << kSamplerIndexStr;
+ *textureReference = textureRefBuilder;
+ ImmutableStringBuilder samplerRefBuilder(kSamplersStr.length() + suffix.length() +
+ kSamplerIndexStr.length());
+ samplerRefBuilder << kSamplersStr << suffix << kSamplerIndexStr;
+ *samplerReference = samplerRefBuilder;
+ }
+ else
+ {
+ out << " const uint textureIndex = samplerIndex - textureIndexOffset"
+ << suffix.data() << ";\n";
+ ImmutableStringBuilder textureRefBuilder(kTexturesStr.length() + suffix.length() +
+ kTextureIndexStr.length());
+ textureRefBuilder << kTexturesStr << suffix << kTextureIndexStr;
+ *textureReference = textureRefBuilder;
+
+ out << " const uint samplerArrayIndex = samplerIndex - samplerIndexOffset"
+ << suffix.data() << ";\n";
+ ImmutableStringBuilder samplerRefBuilder(kSamplersStr.length() + suffix.length() +
+ kSamplerArrayIndexStr.length());
+ samplerRefBuilder << kSamplersStr << suffix << kSamplerArrayIndexStr;
+ *samplerReference = samplerRefBuilder;
+ }
+ }
+ else
+ {
+ *textureReference = ImmutableString("x");
+ *samplerReference = ImmutableString("s");
+ }
+}
+
+void OutputTextureSizeFunctionBody(TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ const ImmutableString &textureReference,
+ bool getDimensionsIgnoresBaseLevel)
+{
+ if (IsSampler2DMS(textureFunction.sampler))
+ {
+ out << " uint width; uint height; uint samples;\n"
+ << " " << textureReference << ".GetDimensions(width, height, samples);\n";
+ }
+ else if (IsSampler2DMSArray(textureFunction.sampler))
+ {
+ out << " uint width; uint height; uint depth; uint samples;\n"
+ << " " << textureReference << ".GetDimensions(width, height, depth, samples);\n";
+ }
+ else
+ {
+ if (getDimensionsIgnoresBaseLevel)
+ {
+ out << " int baseLevel = samplerMetadata[samplerIndex].baseLevel;\n";
+ }
+ else
+ {
+ out << " int baseLevel = 0;\n";
+ }
+
+ if (IsSampler3D(textureFunction.sampler) || IsSamplerArray(textureFunction.sampler) ||
+ (IsIntegerSampler(textureFunction.sampler) && IsSamplerCube(textureFunction.sampler)))
+ {
+ // "depth" stores either the number of layers in an array texture or 3D depth
+ out << " uint width; uint height; uint depth; uint numberOfLevels;\n"
+ << " " << textureReference
+ << ".GetDimensions(baseLevel, width, height, depth, numberOfLevels);\n"
+ << " width = max(width >> lod, 1);\n"
+ << " height = max(height >> lod, 1);\n";
+
+ if (!IsSamplerArray(textureFunction.sampler))
+ {
+ out << " depth = max(depth >> lod, 1);\n";
+ }
+ }
+ else if (IsSampler2D(textureFunction.sampler) || IsSamplerCube(textureFunction.sampler))
+ {
+ out << " uint width; uint height; uint numberOfLevels;\n"
+ << " " << textureReference
+ << ".GetDimensions(baseLevel, width, height, numberOfLevels);\n"
+ << " width = max(width >> lod, 1);\n"
+ << " height = max(height >> lod, 1);\n";
+ }
+ else
+ UNREACHABLE();
+ }
+
+ if (strcmp(textureFunction.getReturnType(), "int3") == 0)
+ {
+ out << " return int3(width, height, depth);\n";
+ }
+ else
+ {
+ out << " return int2(width, height);\n";
+ }
+}
+
+void ProjectTextureCoordinates(const TextureFunctionHLSL::TextureFunction &textureFunction,
+ ImmutableString *texCoordX,
+ ImmutableString *texCoordY,
+ ImmutableString *texCoordZ)
+{
+ if (textureFunction.proj)
+ {
+ ImmutableString proj("");
+ switch (textureFunction.coords)
+ {
+ case 3:
+ proj = ImmutableString(" / t.z");
+ break;
+ case 4:
+ proj = ImmutableString(" / t.w");
+ break;
+ default:
+ UNREACHABLE();
+ }
+ ImmutableStringBuilder texCoordXBuilder(texCoordX->length() + proj.length() + 2u);
+ texCoordXBuilder << '(' << *texCoordX << proj << ')';
+ *texCoordX = texCoordXBuilder;
+ ImmutableStringBuilder texCoordYBuilder(texCoordY->length() + proj.length() + 2u);
+ texCoordYBuilder << '(' << *texCoordY << proj << ')';
+ *texCoordY = texCoordYBuilder;
+ ImmutableStringBuilder texCoordZBuilder(texCoordZ->length() + proj.length() + 2u);
+ texCoordZBuilder << '(' << *texCoordZ << proj << ')';
+ *texCoordZ = texCoordZBuilder;
+ }
+}
+
+void OutputIntegerTextureSampleFunctionComputations(
+ TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ const ShShaderOutput outputType,
+ const ImmutableString &textureReference,
+ ImmutableString *texCoordX,
+ ImmutableString *texCoordY,
+ ImmutableString *texCoordZ,
+ bool getDimensionsIgnoresBaseLevel)
+{
+ if (!IsIntegerSampler(textureFunction.sampler))
+ {
+ return;
+ }
+
+ if (getDimensionsIgnoresBaseLevel)
+ {
+ out << " int baseLevel = samplerMetadata[samplerIndex].baseLevel;\n";
+ }
+ else
+ {
+ out << " int baseLevel = 0;\n";
+ }
+
+ if (IsSamplerCube(textureFunction.sampler))
+ {
+ out << " float width; float height; float layers; float levels;\n";
+
+ out << " uint mip = 0;\n";
+
+ out << " " << textureReference
+ << ".GetDimensions(baseLevel + 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 << " float3 r = any(t) ? t : float3(1, 0, 0);\n";
+ out << " t.x = (u * 0.5f / m) + 0.5f;\n";
+ out << " t.y = (v * 0.5f / m) + 0.5f;\n";
+
+ // Mip level computation.
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
+ {
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT)
+ {
+ // We would like to calculate tha maximum of how many texels we move in the major
+ // face's texture as we move across the screen in any direction. Namely, we want the
+ // length of the directional derivative of the function p (defined below), maximized
+ // over screen space directions. (For short: we want the norm of Dp.) For
+ // simplicity, assume that z-axis is the major axis. By symmetry, we can assume that
+ // the positive z direction is major. (The calculated value will be the same even if
+ // this is false.) Let r denote the function from screen position to cube texture
+ // coordinates. Then p can be written as p = s . P . r, where P(r) = (r.x, r.y)/r.z
+ // is the projection onto the major cube face, and s = diag(width, height)/2. (s
+ // linearly maps from the cube face into texture space, so that p(r) is in units of
+ // texels.) The derivative is
+ // Dp(r) = s |1 0 -r.x/r.z|
+ // |0 1 -r.y/r.z| |ddx(r) ddy(r)| / r.z
+ // = |dot(a, ddx(r)) dot(a, ddy(r))|
+ // |dot(b, ddx(r)) dot(b, ddy(r))| / (2 r.z)
+ // where a = w * vec3(1, 0, -r.x/r.z)
+ // b = h * vec3(0, 1, -r.y/r.z)
+ // We would like to know max(L(x)) over unit vectors x, where L(x) = |Dp(r) x|^2.
+ // Since ddx(r) and ddy(r) are unknown, the best we can do is to sample L in some
+ // directions and take the maximum across the samples.
+ //
+ // Some implementations use max(L(n1), L(n2)) where n1 = vec2(1,0) and n2 =
+ // vec2(0,1).
+ //
+ // Some implementations use max(L(n1), L(n2), L(n3), L(n4)),
+ // where n3 = (n1 + n2) / |n1 + n2| = (n1 + n2)/sqrt(2)
+ // n4 = (n1 - n2) / |n1 - n2| = (n1 - n2)/sqrt(2).
+ // In other words, two samples along the diagonal screen space directions have been
+ // added, giving a strictly better estimate of the true maximum.
+ //
+ // It turns out we can get twice the sample count very cheaply.
+ // We can use the linearity of Dp(r) to get these extra samples of L cheaply in
+ // terms of the already taken samples, L(n1) and L(n2):
+ // Denoting
+ // dpx = Dp(r)n1
+ // dpy = Dp(r)n2
+ // dpxx = dot(dpx, dpx)
+ // dpyy = dot(dpy, dpy)
+ // dpxy = dot(dpx, dpy)
+ // we obtain
+ // L(n3) = |Dp(r)n1 + Dp(r)n2|^2/2 = (dpxx + dpyy)/2 + dpxy
+ // L(n4) = |Dp(r)n1 - Dp(r)n2|^2/2 = (dpxx + dpyy)/2 - dpxy
+ // max(L(n1), L(n2), L(n3), L(n4))
+ // = max(max(L(n1), L(n2)), max(L(n3), L(n4)))
+ // = max(max(dpxx, dpyy), (dpxx + dpyy)/2 + abs(dpxy))
+ // So the extra cost is: one dot, one abs, one add, one multiply-add and one max.
+ // (All scalar.)
+ //
+ // In section 3.8.10.1, the OpenGL ES 3 specification defines the "scale factor",
+ // rho. In our terminology, this definition works out to taking sqrt(max(L(n1),
+ // L(n2))). Some implementations will use this estimate, here we use the strictly
+ // better sqrt(max(L(n1), L(n2), L(n3), L(n4))), since it's not much more expensive
+ // to calculate.
+
+ // Swap coordinates such that we can assume that the positive z-axis is major, in
+ // what follows.
+ out << " float3 ddxr = xMajor ? ddx(r).yzx : yMajor ? ddx(r).zxy : ddx(r).xyz;\n"
+ " float3 ddyr = xMajor ? ddy(r).yzx : yMajor ? ddy(r).zxy : ddy(r).xyz;\n"
+ " r = xMajor ? r.yzx : yMajor ? r.zxy : r.xyz;\n";
+
+ out << " float2 s = 0.5*float2(width, height);\n"
+ " float2 dpx = s * (ddxr.xy - ddxr.z*r.xy/r.z)/r.z;\n"
+ " float2 dpy = s * (ddyr.xy - ddyr.z*r.xy/r.z)/r.z;\n"
+ " float dpxx = dot(dpx, dpx);\n;"
+ " float dpyy = dot(dpy, dpy);\n;"
+ " float dpxy = dot(dpx, dpy);\n"
+ " float ma = max(dpxx, dpyy);\n"
+ " float mb = 0.5 * (dpxx + dpyy) + abs(dpxy);\n"
+ " float mab = max(ma, mb);\n"
+ " float lod = 0.5f * log2(mab);\n";
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
+ {
+ // ESSL 3.00.6 spec section 8.8: "For the cube version, the partial
+ // derivatives of P are assumed to be in the coordinate system used before
+ // texture coordinates are projected onto the appropriate cube face."
+ // ddx[0] and ddy[0] are the derivatives of t.x passed into the function
+ // ddx[1] and ddy[1] are the derivatives of t.y passed into the function
+ // ddx[2] and ddy[2] are the derivatives of t.z passed into the function
+ // Determine the derivatives of u, v and m
+ out << " float dudx = xMajor ? ddx[2] : (yMajor && t.y < 0.0f ? -ddx[0] "
+ ": ddx[0]);\n"
+ " float dudy = xMajor ? ddy[2] : (yMajor && t.y < 0.0f ? -ddy[0] "
+ ": ddy[0]);\n"
+ " float dvdx = yMajor ? ddx[2] : (negative ? ddx[1] : -ddx[1]);\n"
+ " float dvdy = yMajor ? ddy[2] : (negative ? ddy[1] : -ddy[1]);\n"
+ " float dmdx = xMajor ? ddx[0] : (yMajor ? ddx[1] : ddx[2]);\n"
+ " float dmdy = xMajor ? ddy[0] : (yMajor ? ddy[1] : ddy[2]);\n";
+ // Now determine the derivatives of the face coordinates, using the
+ // derivatives calculated above.
+ // d / dx (u(x) * 0.5 / m(x) + 0.5)
+ // = 0.5 * (m(x) * u'(x) - u(x) * m'(x)) / m(x)^2
+ out << " float dfacexdx = 0.5f * (m * dudx - u * dmdx) / (m * m);\n"
+ " float dfaceydx = 0.5f * (m * dvdx - v * dmdx) / (m * m);\n"
+ " float dfacexdy = 0.5f * (m * dudy - u * dmdy) / (m * m);\n"
+ " float dfaceydy = 0.5f * (m * dvdy - v * dmdy) / (m * m);\n"
+ " float2 sizeVec = float2(width, height);\n"
+ " float2 faceddx = float2(dfacexdx, dfaceydx) * sizeVec;\n"
+ " float2 faceddy = float2(dfacexdy, dfaceydy) * sizeVec;\n";
+ // Optimization: instead of: log2(max(length(faceddx), length(faceddy)))
+ // we compute: log2(max(length(faceddx)^2, length(faceddy)^2)) / 2
+ out << " float lengthfaceddx2 = dot(faceddx, faceddx);\n"
+ " float lengthfaceddy2 = dot(faceddy, faceddy);\n"
+ " float lod = log2(max(lengthfaceddx2, lengthfaceddy2)) * 0.5f;\n";
+ }
+ out << " mip = uint(min(max(round(lod), 0), levels - 1));\n"
+ << " " << textureReference
+ << ".GetDimensions(baseLevel + mip, width, height, layers, levels);\n";
+ }
+
+ // Convert from normalized floating-point to integer
+ static const ImmutableString kXPrefix("int(floor(width * frac(");
+ static const ImmutableString kYPrefix("int(floor(height * frac(");
+ static const ImmutableString kSuffix(")))");
+ ImmutableStringBuilder texCoordXBuilder(kXPrefix.length() + texCoordX->length() +
+ kSuffix.length());
+ texCoordXBuilder << kXPrefix << *texCoordX << kSuffix;
+ *texCoordX = texCoordXBuilder;
+ ImmutableStringBuilder texCoordYBuilder(kYPrefix.length() + texCoordX->length() +
+ kSuffix.length());
+ texCoordYBuilder << kYPrefix << *texCoordY << kSuffix;
+ *texCoordY = texCoordYBuilder;
+ *texCoordZ = ImmutableString("face");
+ }
+ else if (textureFunction.method != TextureFunctionHLSL::TextureFunction::FETCH)
+ {
+ if (IsSamplerArray(textureFunction.sampler))
+ {
+ out << " float width; float height; float layers; float levels;\n";
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+
+ out << " " << textureReference
+ << ".GetDimensions(baseLevel, width, height, layers, levels);\n";
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS)
+ {
+ out << " 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 == TextureFunctionHLSL::TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
+ {
+ out << " float2 sizeVec = float2(width, height);\n"
+ " float2 sizeDdx = ddx * sizeVec;\n"
+ " float2 sizeDdy = ddy * sizeVec;\n"
+ " float lod = log2(max(dot(sizeDdx, sizeDdx), "
+ "dot(sizeDdy, sizeDdy))) * 0.5f;\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " " << textureReference
+ << ".GetDimensions(baseLevel + mip, width, height, layers, levels);\n";
+ }
+ else if (IsSampler2D(textureFunction.sampler))
+ {
+ out << " float width; float height; float levels;\n";
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ out << " " << textureReference
+ << ".GetDimensions(baseLevel, width, height, levels);\n";
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS)
+ {
+ out << " 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 == TextureFunctionHLSL::TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
+ {
+ out << " float2 sizeVec = float2(width, height);\n"
+ " float2 sizeDdx = ddx * sizeVec;\n"
+ " float2 sizeDdy = ddy * sizeVec;\n"
+ " float lod = log2(max(dot(sizeDdx, sizeDdx), "
+ "dot(sizeDdy, sizeDdy))) * 0.5f;\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " " << textureReference
+ << ".GetDimensions(baseLevel + mip, width, height, levels);\n";
+ }
+ else if (IsSampler3D(textureFunction.sampler))
+ {
+ out << " float width; float height; float depth; float levels;\n";
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0)
+ {
+ out << " uint mip = 0;\n";
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::LOD0BIAS)
+ {
+ out << " uint mip = bias;\n";
+ }
+ else
+ {
+ out << " " << textureReference
+ << ".GetDimensions(baseLevel, width, height, depth, levels);\n";
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::IMPLICIT ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::BIAS)
+ {
+ out << " 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 == TextureFunctionHLSL::TextureFunction::BIAS)
+ {
+ out << " lod += bias;\n";
+ }
+ }
+ else if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
+ {
+ out << " float3 sizeVec = float3(width, height, depth);\n"
+ " float3 sizeDdx = ddx * sizeVec;\n"
+ " float3 sizeDdy = ddy * sizeVec;\n"
+ " float lod = log2(max(dot(sizeDdx, sizeDdx), dot(sizeDdy, "
+ "sizeDdy))) * 0.5f;\n";
+ }
+
+ out << " uint mip = uint(min(max(round(lod), 0), levels - 1));\n";
+ }
+
+ out << " " << textureReference
+ << ".GetDimensions(baseLevel + mip, width, height, depth, levels);\n";
+ }
+ else
+ UNREACHABLE();
+
+ OutputIntTexCoordWraps(out, textureFunction, texCoordX, texCoordY, texCoordZ);
+ }
+}
+
+void OutputTextureGatherFunctionBody(TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ ShShaderOutput outputType,
+ const ImmutableString &textureReference,
+ const ImmutableString &samplerReference,
+ const ImmutableString &texCoordX,
+ const ImmutableString &texCoordY,
+ const ImmutableString &texCoordZ)
+{
+ const int hlslCoords = GetHLSLCoordCount(textureFunction, outputType);
+ ImmutableString samplerCoordTypeString(
+ GetSamplerCoordinateTypeString(textureFunction, hlslCoords));
+ ImmutableStringBuilder samplerCoordBuilder(
+ samplerCoordTypeString.length() + strlen("(") + texCoordX.length() + strlen(", ") +
+ texCoordY.length() + strlen(", ") + texCoordZ.length() + strlen(")"));
+
+ samplerCoordBuilder << samplerCoordTypeString << "(" << texCoordX << ", " << texCoordY;
+ if (hlslCoords >= 3)
+ {
+ if (textureFunction.coords < 3)
+ {
+ samplerCoordBuilder << ", 0";
+ }
+ else
+ {
+ samplerCoordBuilder << ", " << texCoordZ;
+ }
+ }
+ samplerCoordBuilder << ")";
+
+ ImmutableString samplerCoordString(samplerCoordBuilder);
+
+ if (IsShadowSampler(textureFunction.sampler))
+ {
+ out << "return " << textureReference << ".GatherCmp(" << samplerReference << ", "
+ << samplerCoordString << ", refZ";
+ if (textureFunction.offset)
+ {
+ out << ", offset";
+ }
+ out << ");\n";
+ return;
+ }
+
+ constexpr std::array<const char *, 4> kHLSLGatherFunctions = {
+ {"GatherRed", "GatherGreen", "GatherBlue", "GatherAlpha"}};
+
+ out << " switch(comp)\n"
+ " {\n";
+ for (size_t component = 0; component < kHLSLGatherFunctions.size(); ++component)
+ {
+ out << " case " << component << ":\n"
+ << " return " << textureReference << "." << kHLSLGatherFunctions[component]
+ << "(" << samplerReference << ", " << samplerCoordString;
+ if (textureFunction.offset)
+ {
+ out << ", offset";
+ }
+ out << ");\n";
+ }
+
+ out << " default:\n"
+ " return float4(0.0, 0.0, 0.0, 1.0);\n"
+ " }\n";
+}
+
+void OutputTextureSampleFunctionReturnStatement(
+ TInfoSinkBase &out,
+ const TextureFunctionHLSL::TextureFunction &textureFunction,
+ const ShShaderOutput outputType,
+ const ImmutableString &textureReference,
+ const ImmutableString &samplerReference,
+ const ImmutableString &texCoordX,
+ const ImmutableString &texCoordY,
+ const ImmutableString &texCoordZ)
+{
+ out << " return ";
+
+ if (IsIntegerSampler(textureFunction.sampler) && !IsSamplerCube(textureFunction.sampler) &&
+ textureFunction.method != TextureFunctionHLSL::TextureFunction::FETCH)
+ {
+ out << " useBorderColor ? ";
+ if (IsIntegerSamplerUnsigned(textureFunction.sampler))
+ {
+ out << "asuint";
+ }
+ out << "(samplerMetadata[samplerIndex].intBorderColor) : ";
+ }
+
+ // HLSL intrinsic
+ if (outputType == SH_HLSL_3_0_OUTPUT)
+ {
+ switch (textureFunction.sampler)
+ {
+ case EbtSampler2D:
+ case EbtSamplerExternalOES:
+ out << "tex2D";
+ break;
+ case EbtSamplerCube:
+ out << "texCUBE";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ switch (textureFunction.method)
+ {
+ case TextureFunctionHLSL::TextureFunction::IMPLICIT:
+ out << "(" << samplerReference << ", ";
+ break;
+ case TextureFunctionHLSL::TextureFunction::BIAS:
+ out << "bias(" << samplerReference << ", ";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD:
+ out << "lod(" << samplerReference << ", ";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0:
+ out << "lod(" << samplerReference << ", ";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0BIAS:
+ out << "lod(" << samplerReference << ", ";
+ break;
+ case TextureFunctionHLSL::TextureFunction::GRAD:
+ out << "grad(" << samplerReference << ", ";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else if (outputType == SH_HLSL_4_1_OUTPUT || outputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ OutputHLSL4SampleFunctionPrefix(out, textureFunction, textureReference, samplerReference);
+ }
+ else
+ UNREACHABLE();
+
+ const int hlslCoords = GetHLSLCoordCount(textureFunction, outputType);
+
+ out << GetSamplerCoordinateTypeString(textureFunction, hlslCoords) << "(" << texCoordX << ", "
+ << texCoordY;
+
+ if (outputType == SH_HLSL_3_0_OUTPUT)
+ {
+ if (hlslCoords >= 3)
+ {
+ if (textureFunction.coords < 3)
+ {
+ out << ", 0";
+ }
+ else
+ {
+ out << ", " << texCoordZ;
+ }
+ }
+
+ if (hlslCoords == 4)
+ {
+ switch (textureFunction.method)
+ {
+ case TextureFunctionHLSL::TextureFunction::BIAS:
+ out << ", bias";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD:
+ out << ", lod";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0:
+ out << ", 0";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0BIAS:
+ out << ", bias";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ out << ")";
+ }
+ else if (outputType == SH_HLSL_4_1_OUTPUT || outputType == SH_HLSL_4_0_FL9_3_OUTPUT)
+ {
+ if (hlslCoords >= 3)
+ {
+ ASSERT(!IsIntegerSampler(textureFunction.sampler) ||
+ !IsSamplerCube(textureFunction.sampler) || texCoordZ == "face");
+ out << ", " << texCoordZ;
+ }
+
+ if (textureFunction.method == TextureFunctionHLSL::TextureFunction::GRAD)
+ {
+ if (IsIntegerSampler(textureFunction.sampler))
+ {
+ out << ", mip)";
+ }
+ else if (IsShadowSampler(textureFunction.sampler))
+ {
+ // Compare value
+ if (textureFunction.proj)
+ {
+ // According to ESSL 3.00.4 sec 8.8 p95 on textureProj:
+ // The resulting third component of P' in the shadow forms is used as
+ // Dref
+ out << "), " << texCoordZ;
+ }
+ else
+ {
+ 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 == TextureFunctionHLSL::TextureFunction::FETCH)
+ {
+ if (IsSampler2DMS(textureFunction.sampler) ||
+ IsSampler2DMSArray(textureFunction.sampler))
+ out << "), index";
+ else
+ out << ", mip)";
+ }
+ else if (IsShadowSampler(textureFunction.sampler))
+ {
+ // Compare value
+ if (textureFunction.proj)
+ {
+ // According to ESSL 3.00.4 sec 8.8 p95 on textureProj:
+ // The resulting third component of P' in the shadow forms is used as Dref
+ out << "), " << texCoordZ;
+ }
+ else
+ {
+ switch (textureFunction.coords)
+ {
+ case 3:
+ out << "), t.z";
+ break;
+ case 4:
+ out << "), t.w";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+ else
+ {
+ switch (textureFunction.method)
+ {
+ case TextureFunctionHLSL::TextureFunction::IMPLICIT:
+ out << ")";
+ break;
+ case TextureFunctionHLSL::TextureFunction::BIAS:
+ out << "), bias";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD:
+ out << "), lod";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0:
+ out << "), 0";
+ break;
+ case TextureFunctionHLSL::TextureFunction::LOD0BIAS:
+ out << "), bias";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ if (textureFunction.offset &&
+ (!IsIntegerSampler(textureFunction.sampler) ||
+ textureFunction.method == TextureFunctionHLSL::TextureFunction::FETCH))
+ {
+ out << ", offset";
+ }
+ }
+ else
+ UNREACHABLE();
+
+ out << ");\n"; // Close the sample function call and return statement
+}
+
+} // Anonymous namespace
+
+ImmutableString TextureFunctionHLSL::TextureFunction::name() const
+{
+ static const ImmutableString kGlTextureName("gl_texture");
+
+ ImmutableString suffix(TextureTypeSuffix(this->sampler));
+
+ ImmutableStringBuilder name(kGlTextureName.length() + suffix.length() + 4u + 6u + 5u);
+
+ name << kGlTextureName;
+
+ // We need to include full the sampler type in the function name to make the signature unique
+ // on D3D11, where samplers are passed to texture functions as indices.
+ name << suffix;
+
+ 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;
+ case GATHER:
+ name << "Gather";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return name;
+}
+
+const char *TextureFunctionHLSL::TextureFunction::getReturnType() const
+{
+ if (method == TextureFunction::SIZE)
+ {
+ switch (sampler)
+ {
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DShadow:
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ case EbtSamplerCubeShadow:
+ case EbtSamplerExternalOES:
+ case EbtSampler2DMS:
+ case EbtISampler2DMS:
+ case EbtUSampler2DMS:
+ return "int2";
+ case EbtSampler3D:
+ case EbtISampler3D:
+ case EbtUSampler3D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ case EbtSampler2DMSArray:
+ case EbtISampler2DMSArray:
+ case EbtUSampler2DMSArray:
+ case EbtSampler2DArrayShadow:
+ return "int3";
+ default:
+ UNREACHABLE();
+ }
+ }
+ else // Sampling function
+ {
+ switch (sampler)
+ {
+ case EbtSampler2D:
+ case EbtSampler2DMS:
+ case EbtSampler2DMSArray:
+ case EbtSampler3D:
+ case EbtSamplerCube:
+ case EbtSampler2DArray:
+ case EbtSamplerExternalOES:
+ return "float4";
+ case EbtISampler2D:
+ case EbtISampler2DMS:
+ case EbtISampler2DMSArray:
+ case EbtISampler3D:
+ case EbtISamplerCube:
+ case EbtISampler2DArray:
+ return "int4";
+ case EbtUSampler2D:
+ case EbtUSampler2DMS:
+ case EbtUSampler2DMSArray:
+ case EbtUSampler3D:
+ case EbtUSamplerCube:
+ case EbtUSampler2DArray:
+ return "uint4";
+ case EbtSampler2DShadow:
+ case EbtSamplerCubeShadow:
+ case EbtSampler2DArrayShadow:
+ if (method == TextureFunctionHLSL::TextureFunction::GATHER)
+ {
+ return "float4";
+ }
+ else
+ {
+ return "float";
+ }
+ default:
+ UNREACHABLE();
+ }
+ }
+ return "";
+}
+
+bool TextureFunctionHLSL::TextureFunction::operator<(const TextureFunction &rhs) const
+{
+ return std::tie(sampler, coords, proj, offset, method) <
+ std::tie(rhs.sampler, rhs.coords, rhs.proj, rhs.offset, rhs.method);
+}
+
+ImmutableString TextureFunctionHLSL::useTextureFunction(const ImmutableString &name,
+ TBasicType samplerType,
+ int coords,
+ size_t argumentCount,
+ bool lod0,
+ sh::GLenum shaderType)
+{
+ TextureFunction textureFunction;
+ textureFunction.sampler = samplerType;
+ textureFunction.coords = coords;
+ textureFunction.method = TextureFunction::IMPLICIT;
+ textureFunction.proj = false;
+ textureFunction.offset = false;
+
+ if (name == "texture2D" || name == "textureCube" || name == "texture")
+ {
+ textureFunction.method = TextureFunction::IMPLICIT;
+ }
+ else if (name == "texture2DProj" || name == "textureProj")
+ {
+ 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 if (name == "textureGather")
+ {
+ textureFunction.method = TextureFunction::GATHER;
+ }
+ else if (name == "textureGatherOffset")
+ {
+ textureFunction.method = TextureFunction::GATHER;
+ textureFunction.offset = true;
+ }
+ else
+ UNREACHABLE();
+
+ if (textureFunction.method ==
+ TextureFunction::IMPLICIT) // Could require lod 0 or have a bias argument
+ {
+ size_t mandatoryArgumentCount = 2; // All functions have sampler and coordinate arguments
+
+ if (textureFunction.offset)
+ {
+ mandatoryArgumentCount++;
+ }
+
+ bool bias = (argumentCount > mandatoryArgumentCount); // Bias argument is optional
+
+ if (lod0 || shaderType == GL_VERTEX_SHADER || shaderType == GL_COMPUTE_SHADER)
+ {
+ if (bias)
+ {
+ textureFunction.method = TextureFunction::LOD0BIAS;
+ }
+ else
+ {
+ textureFunction.method = TextureFunction::LOD0;
+ }
+ }
+ else if (bias)
+ {
+ textureFunction.method = TextureFunction::BIAS;
+ }
+ }
+
+ mUsesTexture.insert(textureFunction);
+ return textureFunction.name();
+}
+
+void TextureFunctionHLSL::textureFunctionHeader(TInfoSinkBase &out,
+ const ShShaderOutput outputType,
+ bool getDimensionsIgnoresBaseLevel)
+{
+ for (const TextureFunction &textureFunction : mUsesTexture)
+ {
+ // Function header
+ out << textureFunction.getReturnType() << " " << textureFunction.name() << "(";
+
+ OutputTextureFunctionArgumentList(out, textureFunction, outputType);
+
+ out << ")\n"
+ "{\n";
+
+ // In some cases we use a variable to store the texture/sampler objects, but to work around
+ // a D3D11 compiler bug related to discard inside a loop that is conditional on texture
+ // sampling we need to call the function directly on references to the texture and sampler
+ // arrays. The bug was found using dEQP-GLES3.functional.shaders.discard*loop_texture*
+ // tests.
+ ImmutableString textureReference("");
+ ImmutableString samplerReference("");
+ GetTextureReference(out, textureFunction, outputType, &textureReference, &samplerReference);
+
+ if (textureFunction.method == TextureFunction::SIZE)
+ {
+ OutputTextureSizeFunctionBody(out, textureFunction, textureReference,
+ getDimensionsIgnoresBaseLevel);
+ }
+ else
+ {
+ ImmutableString texCoordX("t.x");
+ ImmutableString texCoordY("t.y");
+ ImmutableString texCoordZ("t.z");
+ if (textureFunction.method == TextureFunction::GATHER)
+ {
+ OutputTextureGatherFunctionBody(out, textureFunction, outputType, textureReference,
+ samplerReference, texCoordX, texCoordY, texCoordZ);
+ }
+ else
+ {
+ ProjectTextureCoordinates(textureFunction, &texCoordX, &texCoordY, &texCoordZ);
+ OutputIntegerTextureSampleFunctionComputations(
+ out, textureFunction, outputType, textureReference, &texCoordX, &texCoordY,
+ &texCoordZ, getDimensionsIgnoresBaseLevel);
+ OutputTextureSampleFunctionReturnStatement(out, textureFunction, outputType,
+ textureReference, samplerReference,
+ texCoordX, texCoordY, texCoordZ);
+ }
+ }
+
+ out << "}\n"
+ "\n";
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.h b/gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.h
new file mode 100644
index 0000000000..98de98fff5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TextureFunctionHLSL.h
@@ -0,0 +1,77 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// TextureFunctionHLSL: Class for writing implementations of ESSL texture functions into HLSL
+// output. Some of the implementations are straightforward and just call the HLSL equivalent of the
+// ESSL texture function, others do more work to emulate ESSL texture sampling or size query
+// behavior.
+//
+
+#ifndef COMPILER_TRANSLATOR_TEXTUREFUNCTIONHLSL_H_
+#define COMPILER_TRANSLATOR_TEXTUREFUNCTIONHLSL_H_
+
+#include <set>
+
+#include "GLSLANG/ShaderLang.h"
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/InfoSink.h"
+
+namespace sh
+{
+
+class TextureFunctionHLSL final : angle::NonCopyable
+{
+ public:
+ struct TextureFunction
+ {
+ // See ESSL 3.00.6 section 8.8 for reference about what the different methods below do.
+ enum Method
+ {
+ IMPLICIT, // Mipmap LOD determined implicitly (standard lookup)
+ BIAS,
+ LOD,
+ LOD0,
+ LOD0BIAS,
+ SIZE, // textureSize()
+ FETCH,
+ GRAD,
+ GATHER
+ };
+
+ ImmutableString name() const;
+
+ bool operator<(const TextureFunction &rhs) const;
+
+ const char *getReturnType() const;
+
+ TBasicType sampler;
+ int coords;
+ bool proj;
+ bool offset;
+ Method method;
+ };
+
+ // Returns the name of the texture function implementation to call.
+ // The name that's passed in is the name of the GLSL texture function that it should implement.
+ ImmutableString useTextureFunction(const ImmutableString &name,
+ TBasicType samplerType,
+ int coords,
+ size_t argumentCount,
+ bool lod0,
+ sh::GLenum shaderType);
+
+ void textureFunctionHeader(TInfoSinkBase &out,
+ const ShShaderOutput outputType,
+ bool getDimensionsIgnoresBaseLevel);
+
+ private:
+ typedef std::set<TextureFunction> TextureFunctionSet;
+ TextureFunctionSet mUsesTexture;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TEXTUREFUNCTIONHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp b/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp
new file mode 100644
index 0000000000..9631a32cb6
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp
@@ -0,0 +1,184 @@
+//
+// 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.
+//
+
+#include "compiler/translator/TranslatorESSL.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
+#include "compiler/translator/OutputESSL.h"
+#include "compiler/translator/tree_ops/EmulatePrecision.h"
+#include "compiler/translator/tree_ops/RecordConstantPrecision.h"
+
+namespace sh
+{
+
+TranslatorESSL::TranslatorESSL(sh::GLenum type, ShShaderSpec spec)
+ : TCompiler(type, spec, SH_ESSL_OUTPUT)
+{}
+
+void TranslatorESSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu,
+ ShCompileOptions compileOptions)
+{
+ if (compileOptions & SH_EMULATE_ATAN2_FLOAT_FUNCTION)
+ {
+ InitBuiltInAtanFunctionEmulatorForGLSLWorkarounds(emu);
+ }
+}
+
+void TranslatorESSL::translate(TIntermBlock *root,
+ ShCompileOptions compileOptions,
+ PerformanceDiagnostics * /*perfDiagnostics*/)
+{
+ TInfoSinkBase &sink = getInfoSink().obj;
+
+ int shaderVer = getShaderVersion();
+ if (shaderVer > 100)
+ {
+ sink << "#version " << shaderVer << " es\n";
+ }
+
+ // Write built-in extension behaviors.
+ writeExtensionBehavior(compileOptions);
+
+ // Write pragmas after extensions because some drivers consider pragmas
+ // like non-preprocessor tokens.
+ writePragma(compileOptions);
+
+ bool precisionEmulation =
+ getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision;
+
+ if (precisionEmulation)
+ {
+ EmulatePrecision emulatePrecision(&getSymbolTable());
+ root->traverse(&emulatePrecision);
+ emulatePrecision.updateTree();
+ emulatePrecision.writeEmulationHelpers(sink, shaderVer, SH_ESSL_OUTPUT);
+ }
+
+ RecordConstantPrecision(root, &getSymbolTable());
+
+ // Write emulated built-in functions if needed.
+ if (!getBuiltInFunctionEmulator().isOutputEmpty())
+ {
+ sink << "// BEGIN: Generated code for built-in function emulation\n\n";
+ if (getShaderType() == GL_FRAGMENT_SHADER)
+ {
+ sink << "#if defined(GL_FRAGMENT_PRECISION_HIGH)\n"
+ << "#define emu_precision highp\n"
+ << "#else\n"
+ << "#define emu_precision mediump\n"
+ << "#endif\n\n";
+ }
+ else
+ {
+ sink << "#define emu_precision highp\n";
+ }
+
+ getBuiltInFunctionEmulator().outputEmulatedFunctions(sink);
+ sink << "// END: Generated code for built-in function emulation\n\n";
+ }
+
+ // Write array bounds clamping emulation if needed.
+ getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
+
+ if (getShaderType() == GL_COMPUTE_SHADER)
+ {
+ EmitWorkGroupSizeGLSL(*this, sink);
+ }
+
+ if (getShaderType() == GL_GEOMETRY_SHADER_EXT)
+ {
+ WriteGeometryShaderLayoutQualifiers(
+ sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(),
+ getGeometryShaderOutputPrimitiveType(), getGeometryShaderMaxVertices());
+ }
+
+ // Write translated shader.
+ TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(),
+ &getSymbolTable(), getShaderType(), shaderVer, precisionEmulation,
+ compileOptions);
+
+ root->traverse(&outputESSL);
+}
+
+bool TranslatorESSL::shouldFlattenPragmaStdglInvariantAll()
+{
+ // If following the spec to the letter, we should not flatten this pragma.
+ // However, the spec's wording means that the pragma applies only to outputs.
+ // This contradicts the spirit of using the pragma,
+ // because if the pragma is used in a vertex shader,
+ // the only way to be able to link it to a fragment shader
+ // is to manually qualify each of fragment shader's inputs as invariant.
+ // Which defeats the purpose of this pragma - temporarily make all varyings
+ // invariant for debugging.
+ // Thus, we should be non-conformant to spec's letter here and flatten.
+ return true;
+}
+
+void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions)
+{
+ TInfoSinkBase &sink = getInfoSink().obj;
+ const TExtensionBehavior &extBehavior = getExtensionBehavior();
+ for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); iter != extBehavior.end();
+ ++iter)
+ {
+ if (iter->second != EBhUndefined)
+ {
+ const bool isMultiview = (iter->first == TExtension::OVR_multiview) ||
+ (iter->first == TExtension::OVR_multiview2);
+ if (getResources().NV_shader_framebuffer_fetch &&
+ iter->first == TExtension::EXT_shader_framebuffer_fetch)
+ {
+ sink << "#extension GL_NV_shader_framebuffer_fetch : "
+ << GetBehaviorString(iter->second) << "\n";
+ }
+ else if (getResources().NV_draw_buffers && iter->first == TExtension::EXT_draw_buffers)
+ {
+ sink << "#extension GL_NV_draw_buffers : " << GetBehaviorString(iter->second)
+ << "\n";
+ }
+ else if (isMultiview)
+ {
+ EmitMultiviewGLSL(*this, compileOptions, iter->second, sink);
+ }
+ else if (iter->first == TExtension::EXT_geometry_shader)
+ {
+ sink << "#ifdef GL_EXT_geometry_shader\n"
+ << "#extension GL_EXT_geometry_shader : " << GetBehaviorString(iter->second)
+ << "\n"
+ << "#elif defined GL_OES_geometry_shader\n"
+ << "#extension GL_OES_geometry_shader : " << GetBehaviorString(iter->second)
+ << "\n";
+ if (iter->second == EBhRequire)
+ {
+ sink << "#else\n"
+ << "#error \"No geometry shader extensions available.\" // Only generate "
+ "this if the extension is \"required\"\n";
+ }
+ sink << "#endif\n";
+ }
+ else if (iter->first == TExtension::ANGLE_multi_draw)
+ {
+ // Don't emit anything. This extension is emulated
+ ASSERT((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0);
+ continue;
+ }
+ else if (iter->first == TExtension::ANGLE_base_vertex_base_instance)
+ {
+ // Don't emit anything. This extension is emulated
+ ASSERT((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0);
+ continue;
+ }
+ else
+ {
+ sink << "#extension " << GetExtensionNameString(iter->first) << " : "
+ << GetBehaviorString(iter->second) << "\n";
+ }
+ }
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.h b/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.h
new file mode 100644
index 0000000000..24dc738513
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.h
@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_TRANSLATORESSL_H_
+#define COMPILER_TRANSLATOR_TRANSLATORESSL_H_
+
+#include "compiler/translator/Compiler.h"
+
+namespace sh
+{
+
+class TranslatorESSL : public TCompiler
+{
+ public:
+ TranslatorESSL(sh::GLenum type, ShShaderSpec spec);
+
+ protected:
+ void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu,
+ ShCompileOptions compileOptions) override;
+
+ void translate(TIntermBlock *root,
+ ShCompileOptions compileOptions,
+ PerformanceDiagnostics *perfDiagnostics) override;
+ bool shouldFlattenPragmaStdglInvariantAll() override;
+
+ private:
+ void writeExtensionBehavior(ShCompileOptions compileOptions);
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TRANSLATORESSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp
new file mode 100644
index 0000000000..81b43b8245
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp
@@ -0,0 +1,334 @@
+//
+// 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.
+//
+
+#include "compiler/translator/TranslatorGLSL.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h"
+#include "compiler/translator/ExtensionGLSL.h"
+#include "compiler/translator/OutputGLSL.h"
+#include "compiler/translator/VersionGLSL.h"
+#include "compiler/translator/tree_ops/EmulatePrecision.h"
+#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h"
+#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h"
+
+namespace sh
+{
+
+TranslatorGLSL::TranslatorGLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
+ : TCompiler(type, spec, output)
+{}
+
+void TranslatorGLSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu,
+ ShCompileOptions compileOptions)
+{
+ if (compileOptions & SH_EMULATE_ABS_INT_FUNCTION)
+ {
+ InitBuiltInAbsFunctionEmulatorForGLSLWorkarounds(emu, getShaderType());
+ }
+
+ if (compileOptions & SH_EMULATE_ISNAN_FLOAT_FUNCTION)
+ {
+ InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(emu, getShaderVersion());
+ }
+
+ if (compileOptions & SH_EMULATE_ATAN2_FLOAT_FUNCTION)
+ {
+ InitBuiltInAtanFunctionEmulatorForGLSLWorkarounds(emu);
+ }
+
+ int targetGLSLVersion = ShaderOutputTypeToGLSLVersion(getOutputType());
+ InitBuiltInFunctionEmulatorForGLSLMissingFunctions(emu, getShaderType(), targetGLSLVersion);
+}
+
+void TranslatorGLSL::translate(TIntermBlock *root,
+ ShCompileOptions compileOptions,
+ PerformanceDiagnostics * /*perfDiagnostics*/)
+{
+ TInfoSinkBase &sink = getInfoSink().obj;
+
+ // Write GLSL version.
+ writeVersion(root);
+
+ // Write extension behaviour as needed
+ writeExtensionBehavior(root, compileOptions);
+
+ // Write pragmas after extensions because some drivers consider pragmas
+ // like non-preprocessor tokens.
+ writePragma(compileOptions);
+
+ // If flattening the global invariant pragma, write invariant declarations for built-in
+ // variables. It should be harmless to do this twice in the case that the shader also explicitly
+ // did this. However, it's important to emit invariant qualifiers only for those built-in
+ // variables that are actually used, to avoid affecting the behavior of the shader.
+ if ((compileOptions & SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL) != 0 &&
+ getPragma().stdgl.invariantAll &&
+ !sh::RemoveInvariant(getShaderType(), getShaderVersion(), getOutputType(), compileOptions))
+ {
+ ASSERT(wereVariablesCollected());
+
+ switch (getShaderType())
+ {
+ case GL_VERTEX_SHADER:
+ sink << "invariant gl_Position;\n";
+
+ // gl_PointSize should be declared invariant in both ESSL 1.00 and 3.00 fragment
+ // shaders if it's statically referenced.
+ conditionallyOutputInvariantDeclaration("gl_PointSize");
+ break;
+ case GL_FRAGMENT_SHADER:
+ // The preprocessor will reject this pragma if it's used in ESSL 3.00 fragment
+ // shaders, so we can use simple logic to determine whether to declare these
+ // variables invariant.
+ conditionallyOutputInvariantDeclaration("gl_FragCoord");
+ conditionallyOutputInvariantDeclaration("gl_PointCoord");
+ break;
+ default:
+ // Currently not reached, but leave this in for future expansion.
+ ASSERT(false);
+ break;
+ }
+ }
+
+ if ((compileOptions & SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH) != 0)
+ {
+ sh::RewriteTexelFetchOffset(root, getSymbolTable(), getShaderVersion());
+ }
+
+ if ((compileOptions & SH_REWRITE_FLOAT_UNARY_MINUS_OPERATOR) != 0)
+ {
+ sh::RewriteUnaryMinusOperatorFloat(root);
+ }
+
+ bool precisionEmulation =
+ getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision;
+
+ if (precisionEmulation)
+ {
+ EmulatePrecision emulatePrecision(&getSymbolTable());
+ root->traverse(&emulatePrecision);
+ emulatePrecision.updateTree();
+ emulatePrecision.writeEmulationHelpers(sink, getShaderVersion(), getOutputType());
+ }
+
+ // Write emulated built-in functions if needed.
+ if (!getBuiltInFunctionEmulator().isOutputEmpty())
+ {
+ sink << "// BEGIN: Generated code for built-in function emulation\n\n";
+ sink << "#define emu_precision\n\n";
+ getBuiltInFunctionEmulator().outputEmulatedFunctions(sink);
+ sink << "// END: Generated code for built-in function emulation\n\n";
+ }
+
+ // Write array bounds clamping emulation if needed.
+ getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
+
+ // Declare gl_FragColor and glFragData as webgl_FragColor and webgl_FragData
+ // if it's core profile shaders and they are used.
+ if (getShaderType() == GL_FRAGMENT_SHADER)
+ {
+ const bool mayHaveESSL1SecondaryOutputs =
+ IsExtensionEnabled(getExtensionBehavior(), TExtension::EXT_blend_func_extended) &&
+ getShaderVersion() == 100;
+ const bool declareGLFragmentOutputs = IsGLSL130OrNewer(getOutputType());
+
+ bool hasGLFragColor = false;
+ bool hasGLFragData = false;
+ bool hasGLSecondaryFragColor = false;
+ bool hasGLSecondaryFragData = false;
+
+ for (const auto &outputVar : mOutputVariables)
+ {
+ if (declareGLFragmentOutputs)
+ {
+ if (outputVar.name == "gl_FragColor")
+ {
+ ASSERT(!hasGLFragColor);
+ hasGLFragColor = true;
+ continue;
+ }
+ else if (outputVar.name == "gl_FragData")
+ {
+ ASSERT(!hasGLFragData);
+ hasGLFragData = true;
+ continue;
+ }
+ }
+ if (mayHaveESSL1SecondaryOutputs)
+ {
+ if (outputVar.name == "gl_SecondaryFragColorEXT")
+ {
+ ASSERT(!hasGLSecondaryFragColor);
+ hasGLSecondaryFragColor = true;
+ continue;
+ }
+ else if (outputVar.name == "gl_SecondaryFragDataEXT")
+ {
+ ASSERT(!hasGLSecondaryFragData);
+ hasGLSecondaryFragData = true;
+ continue;
+ }
+ }
+ }
+ ASSERT(!((hasGLFragColor || hasGLSecondaryFragColor) &&
+ (hasGLFragData || hasGLSecondaryFragData)));
+ if (hasGLFragColor)
+ {
+ sink << "out vec4 webgl_FragColor;\n";
+ }
+ if (hasGLFragData)
+ {
+ sink << "out vec4 webgl_FragData[gl_MaxDrawBuffers];\n";
+ }
+ if (hasGLSecondaryFragColor)
+ {
+ sink << "out vec4 angle_SecondaryFragColor;\n";
+ }
+ if (hasGLSecondaryFragData)
+ {
+ sink << "out vec4 angle_SecondaryFragData[" << getResources().MaxDualSourceDrawBuffers
+ << "];\n";
+ }
+ }
+
+ if (getShaderType() == GL_COMPUTE_SHADER)
+ {
+ EmitWorkGroupSizeGLSL(*this, sink);
+ }
+
+ if (getShaderType() == GL_GEOMETRY_SHADER_EXT)
+ {
+ WriteGeometryShaderLayoutQualifiers(
+ sink, getGeometryShaderInputPrimitiveType(), getGeometryShaderInvocations(),
+ getGeometryShaderOutputPrimitiveType(), getGeometryShaderMaxVertices());
+ }
+
+ // Write translated shader.
+ TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(),
+ &getSymbolTable(), getShaderType(), getShaderVersion(), getOutputType(),
+ compileOptions);
+
+ root->traverse(&outputGLSL);
+}
+
+bool TranslatorGLSL::shouldFlattenPragmaStdglInvariantAll()
+{
+ // Required when outputting to any GLSL version greater than 1.20, but since ANGLE doesn't
+ // translate to that version, return true for the next higher version.
+ return IsGLSL130OrNewer(getOutputType());
+}
+
+bool TranslatorGLSL::shouldCollectVariables(ShCompileOptions compileOptions)
+{
+ return (compileOptions & SH_FLATTEN_PRAGMA_STDGL_INVARIANT_ALL) ||
+ TCompiler::shouldCollectVariables(compileOptions);
+}
+
+void TranslatorGLSL::writeVersion(TIntermNode *root)
+{
+ TVersionGLSL versionGLSL(getShaderType(), getPragma(), getOutputType());
+ root->traverse(&versionGLSL);
+ int version = versionGLSL.getVersion();
+ // We need to write version directive only if it is greater than 110.
+ // If there is no version directive in the shader, 110 is implied.
+ if (version > 110)
+ {
+ TInfoSinkBase &sink = getInfoSink().obj;
+ sink << "#version " << version << "\n";
+ }
+}
+
+void TranslatorGLSL::writeExtensionBehavior(TIntermNode *root, ShCompileOptions compileOptions)
+{
+ TInfoSinkBase &sink = getInfoSink().obj;
+ const TExtensionBehavior &extBehavior = getExtensionBehavior();
+ for (const auto &iter : extBehavior)
+ {
+ if (iter.second == EBhUndefined)
+ {
+ continue;
+ }
+
+ if (getOutputType() == SH_GLSL_COMPATIBILITY_OUTPUT)
+ {
+ // For GLSL output, we don't need to emit most extensions explicitly,
+ // but some we need to translate in GL compatibility profile.
+ if (iter.first == TExtension::EXT_shader_texture_lod)
+ {
+ sink << "#extension GL_ARB_shader_texture_lod : " << GetBehaviorString(iter.second)
+ << "\n";
+ }
+
+ if (iter.first == TExtension::EXT_draw_buffers)
+ {
+ sink << "#extension GL_ARB_draw_buffers : " << GetBehaviorString(iter.second)
+ << "\n";
+ }
+
+ if (iter.first == TExtension::EXT_geometry_shader)
+ {
+ sink << "#extension GL_ARB_geometry_shader4 : " << GetBehaviorString(iter.second)
+ << "\n";
+ }
+ }
+
+ const bool isMultiview =
+ (iter.first == TExtension::OVR_multiview) || (iter.first == TExtension::OVR_multiview2);
+ if (isMultiview)
+ {
+ EmitMultiviewGLSL(*this, compileOptions, iter.second, sink);
+ }
+
+ // Support ANGLE_texture_multisample extension on GLSL300
+ if (getShaderVersion() >= 300 && iter.first == TExtension::ANGLE_texture_multisample &&
+ getOutputType() < SH_GLSL_330_CORE_OUTPUT)
+ {
+ sink << "#extension GL_ARB_texture_multisample : " << GetBehaviorString(iter.second)
+ << "\n";
+ }
+ }
+
+ // GLSL ES 3 explicit location qualifiers need to use an extension before GLSL 330
+ if (getShaderVersion() >= 300 && getOutputType() < SH_GLSL_330_CORE_OUTPUT &&
+ getShaderType() != GL_COMPUTE_SHADER)
+ {
+ sink << "#extension GL_ARB_explicit_attrib_location : require\n";
+ }
+
+ // Need to enable gpu_shader5 to have index constant sampler array indexing
+ if (getOutputType() != SH_ESSL_OUTPUT && getOutputType() < SH_GLSL_400_CORE_OUTPUT &&
+ getShaderVersion() == 100)
+ {
+ // Don't use "require" on to avoid breaking WebGL 1 on drivers that silently
+ // support index constant sampler array indexing, but don't have the extension or
+ // on drivers that don't have the extension at all as it would break WebGL 1 for
+ // some users.
+ sink << "#extension GL_ARB_gpu_shader5 : enable\n";
+ }
+
+ TExtensionGLSL extensionGLSL(getOutputType());
+ root->traverse(&extensionGLSL);
+
+ for (const auto &ext : extensionGLSL.getEnabledExtensions())
+ {
+ sink << "#extension " << ext << " : enable\n";
+ }
+ for (const auto &ext : extensionGLSL.getRequiredExtensions())
+ {
+ sink << "#extension " << ext << " : require\n";
+ }
+}
+
+void TranslatorGLSL::conditionallyOutputInvariantDeclaration(const char *builtinVaryingName)
+{
+ if (isVaryingDefined(builtinVaryingName))
+ {
+ TInfoSinkBase &sink = getInfoSink().obj;
+ sink << "invariant " << builtinVaryingName << ";\n";
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.h b/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.h
new file mode 100644
index 0000000000..982d0e5ddc
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_TRANSLATORGLSL_H_
+#define COMPILER_TRANSLATOR_TRANSLATORGLSL_H_
+
+#include "compiler/translator/Compiler.h"
+
+namespace sh
+{
+
+class TranslatorGLSL : public TCompiler
+{
+ public:
+ TranslatorGLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
+
+ protected:
+ void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu,
+ ShCompileOptions compileOptions) override;
+
+ void translate(TIntermBlock *root,
+ ShCompileOptions compileOptions,
+ PerformanceDiagnostics *perfDiagnostics) override;
+ bool shouldFlattenPragmaStdglInvariantAll() override;
+ bool shouldCollectVariables(ShCompileOptions compileOptions) override;
+
+ private:
+ void writeVersion(TIntermNode *root);
+ void writeExtensionBehavior(TIntermNode *root, ShCompileOptions compileOptions);
+ void conditionallyOutputInvariantDeclaration(const char *builtinVaryingName);
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TRANSLATORGLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp
new file mode 100644
index 0000000000..c4be3b027c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp
@@ -0,0 +1,204 @@
+//
+// 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.
+//
+
+#include "compiler/translator/TranslatorHLSL.h"
+
+#include "compiler/translator/OutputHLSL.h"
+#include "compiler/translator/tree_ops/AddDefaultReturnStatements.h"
+#include "compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h"
+#include "compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h"
+#include "compiler/translator/tree_ops/EmulatePrecision.h"
+#include "compiler/translator/tree_ops/ExpandIntegerPowExpressions.h"
+#include "compiler/translator/tree_ops/PruneEmptyCases.h"
+#include "compiler/translator/tree_ops/RemoveDynamicIndexing.h"
+#include "compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.h"
+#include "compiler/translator/tree_ops/RewriteElseBlocks.h"
+#include "compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h"
+#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h"
+#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h"
+#include "compiler/translator/tree_ops/SeparateArrayConstructorStatements.h"
+#include "compiler/translator/tree_ops/SeparateArrayInitialization.h"
+#include "compiler/translator/tree_ops/SeparateDeclarations.h"
+#include "compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h"
+#include "compiler/translator/tree_ops/SimplifyLoopConditions.h"
+#include "compiler/translator/tree_ops/SplitSequenceOperator.h"
+#include "compiler/translator/tree_ops/UnfoldShortCircuitToIf.h"
+#include "compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h"
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+
+namespace sh
+{
+
+TranslatorHLSL::TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
+ : TCompiler(type, spec, output)
+{}
+
+void TranslatorHLSL::translate(TIntermBlock *root,
+ ShCompileOptions compileOptions,
+ PerformanceDiagnostics *perfDiagnostics)
+{
+ const ShBuiltInResources &resources = getResources();
+ int numRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
+ int maxDualSourceDrawBuffers =
+ resources.EXT_blend_func_extended ? resources.MaxDualSourceDrawBuffers : 0;
+
+ sh::AddDefaultReturnStatements(root);
+
+ // Note that SimplifyLoopConditions needs to be run before any other AST transformations that
+ // may need to generate new statements from loop conditions or loop expressions.
+ // Note that SeparateDeclarations has already been run in TCompiler::compileTreeImpl().
+ SimplifyLoopConditions(root,
+ IntermNodePatternMatcher::kExpressionReturningArray |
+ IntermNodePatternMatcher::kUnfoldedShortCircuitExpression |
+ IntermNodePatternMatcher::kDynamicIndexingOfVectorOrMatrixInLValue,
+ &getSymbolTable());
+
+ SplitSequenceOperator(root,
+ IntermNodePatternMatcher::kExpressionReturningArray |
+ IntermNodePatternMatcher::kUnfoldedShortCircuitExpression |
+ IntermNodePatternMatcher::kDynamicIndexingOfVectorOrMatrixInLValue,
+ &getSymbolTable());
+
+ // Note that SeparateDeclarations needs to be run before UnfoldShortCircuitToIf.
+ UnfoldShortCircuitToIf(root, &getSymbolTable());
+
+ SeparateArrayConstructorStatements(root);
+
+ SeparateExpressionsReturningArrays(root, &getSymbolTable());
+
+ // Note that SeparateDeclarations needs to be run before SeparateArrayInitialization.
+ SeparateArrayInitialization(root);
+
+ // HLSL doesn't support arrays as return values, we'll need to make functions that have an array
+ // as a return value to use an out parameter to transfer the array data instead.
+ ArrayReturnValueToOutParameter(root, &getSymbolTable());
+
+ if (!shouldRunLoopAndIndexingValidation(compileOptions))
+ {
+ // HLSL doesn't support dynamic indexing of vectors and matrices.
+ RemoveDynamicIndexing(root, &getSymbolTable(), perfDiagnostics);
+ }
+
+ // Work around D3D9 bug that would manifest in vertex shaders with selection blocks which
+ // use a vertex attribute as a condition, and some related computation in the else block.
+ if (getOutputType() == SH_HLSL_3_0_OUTPUT && getShaderType() == GL_VERTEX_SHADER)
+ {
+ sh::RewriteElseBlocks(root, &getSymbolTable());
+ }
+
+ // Work around an HLSL compiler frontend aliasing optimization bug.
+ // TODO(cwallez) The date is 2016-08-25, Microsoft said the bug would be fixed
+ // in the next release of d3dcompiler.dll, it would be nice to detect the DLL
+ // version and only apply the workaround if it is too old.
+ sh::BreakVariableAliasingInInnerLoops(root);
+
+ // WrapSwitchStatementsInBlocks should be called after any AST transformations that might
+ // introduce variable declarations inside the main scope of any switch statement. It cannot
+ // result in no-op cases at the end of switch statements, because unreferenced variables
+ // have already been pruned.
+ WrapSwitchStatementsInBlocks(root);
+
+ bool precisionEmulation =
+ getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision;
+
+ if (precisionEmulation)
+ {
+ EmulatePrecision emulatePrecision(&getSymbolTable());
+ root->traverse(&emulatePrecision);
+ emulatePrecision.updateTree();
+ emulatePrecision.writeEmulationHelpers(getInfoSink().obj, getShaderVersion(),
+ getOutputType());
+ }
+
+ if ((compileOptions & SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS) != 0)
+ {
+ sh::ExpandIntegerPowExpressions(root, &getSymbolTable());
+ }
+
+ if ((compileOptions & SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH) != 0)
+ {
+ sh::RewriteTexelFetchOffset(root, getSymbolTable(), getShaderVersion());
+ }
+
+ if (((compileOptions & SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR) != 0) &&
+ getShaderType() == GL_VERTEX_SHADER)
+ {
+ sh::RewriteUnaryMinusOperatorInt(root);
+ }
+
+ if (getShaderVersion() >= 310)
+ {
+ // Due to ssbo also can be used as the argument of atomic memory functions, we should put
+ // RewriteExpressionsWithShaderStorageBlock before RewriteAtomicFunctionExpressions.
+ sh::RewriteExpressionsWithShaderStorageBlock(root, &getSymbolTable());
+ sh::RewriteAtomicFunctionExpressions(root, &getSymbolTable(), getShaderVersion());
+ }
+
+ sh::OutputHLSL outputHLSL(
+ getShaderType(), getShaderVersion(), getExtensionBehavior(), getSourcePath(),
+ getOutputType(), numRenderTargets, maxDualSourceDrawBuffers, getUniforms(), compileOptions,
+ getComputeShaderLocalSize(), &getSymbolTable(), perfDiagnostics, mShaderStorageBlocks);
+
+ outputHLSL.output(root, getInfoSink().obj);
+
+ mShaderStorageBlockRegisterMap = outputHLSL.getShaderStorageBlockRegisterMap();
+ mUniformBlockRegisterMap = outputHLSL.getUniformBlockRegisterMap();
+ mUniformRegisterMap = outputHLSL.getUniformRegisterMap();
+ mReadonlyImage2DRegisterIndex = outputHLSL.getReadonlyImage2DRegisterIndex();
+ mImage2DRegisterIndex = outputHLSL.getImage2DRegisterIndex();
+ mUsedImage2DFunctionNames = outputHLSL.getUsedImage2DFunctionNames();
+}
+
+bool TranslatorHLSL::shouldFlattenPragmaStdglInvariantAll()
+{
+ // Not necessary when translating to HLSL.
+ return false;
+}
+
+bool TranslatorHLSL::hasShaderStorageBlock(const std::string &uniformBlockName) const
+{
+ return (mShaderStorageBlockRegisterMap.count(uniformBlockName) > 0);
+}
+
+unsigned int TranslatorHLSL::getShaderStorageBlockRegister(
+ const std::string &shaderStorageBlockName) const
+{
+ ASSERT(hasShaderStorageBlock(shaderStorageBlockName));
+ return mShaderStorageBlockRegisterMap.find(shaderStorageBlockName)->second;
+}
+
+bool TranslatorHLSL::hasUniformBlock(const std::string &uniformBlockName) const
+{
+ return (mUniformBlockRegisterMap.count(uniformBlockName) > 0);
+}
+
+unsigned int TranslatorHLSL::getUniformBlockRegister(const std::string &uniformBlockName) const
+{
+ ASSERT(hasUniformBlock(uniformBlockName));
+ return mUniformBlockRegisterMap.find(uniformBlockName)->second;
+}
+
+const std::map<std::string, unsigned int> *TranslatorHLSL::getUniformRegisterMap() const
+{
+ return &mUniformRegisterMap;
+}
+
+unsigned int TranslatorHLSL::getReadonlyImage2DRegisterIndex() const
+{
+ return mReadonlyImage2DRegisterIndex;
+}
+
+unsigned int TranslatorHLSL::getImage2DRegisterIndex() const
+{
+ return mImage2DRegisterIndex;
+}
+
+const std::set<std::string> *TranslatorHLSL::getUsedImage2DFunctionNames() const
+{
+ return &mUsedImage2DFunctionNames;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.h b/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.h
new file mode 100644
index 0000000000..bb8b7f2855
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.h
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_TRANSLATORHLSL_H_
+#define COMPILER_TRANSLATOR_TRANSLATORHLSL_H_
+
+#include "compiler/translator/Compiler.h"
+
+namespace sh
+{
+
+class TranslatorHLSL : public TCompiler
+{
+ public:
+ TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
+ TranslatorHLSL *getAsTranslatorHLSL() override { return this; }
+
+ bool hasShaderStorageBlock(const std::string &interfaceBlockName) const;
+ unsigned int getShaderStorageBlockRegister(const std::string &interfaceBlockName) const;
+
+ bool hasUniformBlock(const std::string &interfaceBlockName) const;
+ unsigned int getUniformBlockRegister(const std::string &interfaceBlockName) const;
+
+ const std::map<std::string, unsigned int> *getUniformRegisterMap() const;
+ unsigned int getReadonlyImage2DRegisterIndex() const;
+ unsigned int getImage2DRegisterIndex() const;
+ const std::set<std::string> *getUsedImage2DFunctionNames() const;
+
+ protected:
+ void translate(TIntermBlock *root,
+ ShCompileOptions compileOptions,
+ PerformanceDiagnostics *perfDiagnostics) override;
+ bool shouldFlattenPragmaStdglInvariantAll() override;
+
+ // collectVariables needs to be run always so registers can be assigned.
+ bool shouldCollectVariables(ShCompileOptions compileOptions) override { return true; }
+
+ std::map<std::string, unsigned int> mShaderStorageBlockRegisterMap;
+ std::map<std::string, unsigned int> mUniformBlockRegisterMap;
+ std::map<std::string, unsigned int> mUniformRegisterMap;
+ unsigned int mReadonlyImage2DRegisterIndex;
+ unsigned int mImage2DRegisterIndex;
+ std::set<std::string> mUsedImage2DFunctionNames;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TRANSLATORHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/Types.cpp b/gfx/angle/checkout/src/compiler/translator/Types.cpp
new file mode 100644
index 0000000000..9d0374b170
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Types.cpp
@@ -0,0 +1,970 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#if defined(_MSC_VER)
+# pragma warning(disable : 4718)
+#endif
+
+#include "compiler/translator/Types.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/SymbolTable.h"
+
+#include <algorithm>
+#include <climits>
+
+namespace sh
+{
+
+const char *getBasicString(TBasicType t)
+{
+ switch (t)
+ {
+ case EbtVoid:
+ return "void";
+ case EbtFloat:
+ return "float";
+ case EbtInt:
+ return "int";
+ case EbtUInt:
+ return "uint";
+ case EbtBool:
+ return "bool";
+ case EbtYuvCscStandardEXT:
+ return "yuvCscStandardEXT";
+ case EbtSampler2D:
+ return "sampler2D";
+ case EbtSampler3D:
+ return "sampler3D";
+ case EbtSamplerCube:
+ return "samplerCube";
+ case EbtSamplerExternalOES:
+ return "samplerExternalOES";
+ case EbtSamplerExternal2DY2YEXT:
+ return "__samplerExternal2DY2YEXT";
+ case EbtSampler2DRect:
+ return "sampler2DRect";
+ case EbtSampler2DArray:
+ return "sampler2DArray";
+ case EbtSampler2DMS:
+ return "sampler2DMS";
+ case EbtSampler2DMSArray:
+ return "sampler2DMSArray";
+ case EbtISampler2D:
+ return "isampler2D";
+ case EbtISampler3D:
+ return "isampler3D";
+ case EbtISamplerCube:
+ return "isamplerCube";
+ case EbtISampler2DArray:
+ return "isampler2DArray";
+ case EbtISampler2DMS:
+ return "isampler2DMS";
+ case EbtISampler2DMSArray:
+ return "isampler2DMSArray";
+ case EbtUSampler2D:
+ return "usampler2D";
+ case EbtUSampler3D:
+ return "usampler3D";
+ case EbtUSamplerCube:
+ return "usamplerCube";
+ case EbtUSampler2DArray:
+ return "usampler2DArray";
+ case EbtUSampler2DMS:
+ return "usampler2DMS";
+ case EbtUSampler2DMSArray:
+ return "usampler2DMSArray";
+ case EbtSampler2DShadow:
+ return "sampler2DShadow";
+ case EbtSamplerCubeShadow:
+ return "samplerCubeShadow";
+ case EbtSampler2DArrayShadow:
+ return "sampler2DArrayShadow";
+ case EbtStruct:
+ return "structure";
+ case EbtInterfaceBlock:
+ return "interface block";
+ case EbtImage2D:
+ return "image2D";
+ case EbtIImage2D:
+ return "iimage2D";
+ case EbtUImage2D:
+ return "uimage2D";
+ case EbtImage3D:
+ return "image3D";
+ case EbtIImage3D:
+ return "iimage3D";
+ case EbtUImage3D:
+ return "uimage3D";
+ case EbtImage2DArray:
+ return "image2DArray";
+ case EbtIImage2DArray:
+ return "iimage2DArray";
+ case EbtUImage2DArray:
+ return "uimage2DArray";
+ case EbtImageCube:
+ return "imageCube";
+ case EbtIImageCube:
+ return "iimageCube";
+ case EbtUImageCube:
+ return "uimageCube";
+ case EbtAtomicCounter:
+ return "atomic_uint";
+ default:
+ UNREACHABLE();
+ return "unknown type";
+ }
+}
+
+// TType implementation.
+TType::TType()
+ : type(EbtVoid),
+ precision(EbpUndefined),
+ qualifier(EvqGlobal),
+ invariant(false),
+ memoryQualifier(TMemoryQualifier::Create()),
+ layoutQualifier(TLayoutQualifier::Create()),
+ primarySize(0),
+ secondarySize(0),
+ mArraySizes(nullptr),
+ mInterfaceBlock(nullptr),
+ mStructure(nullptr),
+ mIsStructSpecifier(false),
+ mMangledName(nullptr)
+{}
+
+TType::TType(TBasicType t, unsigned char ps, unsigned char ss)
+ : type(t),
+ precision(EbpUndefined),
+ qualifier(EvqGlobal),
+ invariant(false),
+ memoryQualifier(TMemoryQualifier::Create()),
+ layoutQualifier(TLayoutQualifier::Create()),
+ primarySize(ps),
+ secondarySize(ss),
+ mArraySizes(nullptr),
+ mInterfaceBlock(nullptr),
+ mStructure(nullptr),
+ mIsStructSpecifier(false),
+ mMangledName(nullptr)
+{}
+
+TType::TType(TBasicType t, TPrecision p, TQualifier q, unsigned char ps, unsigned char ss)
+ : type(t),
+ precision(p),
+ qualifier(q),
+ invariant(false),
+ memoryQualifier(TMemoryQualifier::Create()),
+ layoutQualifier(TLayoutQualifier::Create()),
+ primarySize(ps),
+ secondarySize(ss),
+ mArraySizes(nullptr),
+ mInterfaceBlock(nullptr),
+ mStructure(nullptr),
+ mIsStructSpecifier(false),
+ mMangledName(nullptr)
+{}
+
+TType::TType(const TPublicType &p)
+ : type(p.getBasicType()),
+ precision(p.precision),
+ qualifier(p.qualifier),
+ invariant(p.invariant),
+ memoryQualifier(p.memoryQualifier),
+ layoutQualifier(p.layoutQualifier),
+ primarySize(p.getPrimarySize()),
+ secondarySize(p.getSecondarySize()),
+ mArraySizes(nullptr),
+ mInterfaceBlock(nullptr),
+ mStructure(nullptr),
+ mIsStructSpecifier(false),
+ mMangledName(nullptr)
+{
+ ASSERT(primarySize <= 4);
+ ASSERT(secondarySize <= 4);
+ if (p.isArray())
+ {
+ mArraySizes = new TVector<unsigned int>(*p.arraySizes);
+ }
+ if (p.getUserDef())
+ {
+ mStructure = p.getUserDef();
+ mIsStructSpecifier = p.isStructSpecifier();
+ }
+}
+
+TType::TType(const TStructure *userDef, bool isStructSpecifier)
+ : type(EbtStruct),
+ precision(EbpUndefined),
+ qualifier(EvqTemporary),
+ invariant(false),
+ memoryQualifier(TMemoryQualifier::Create()),
+ layoutQualifier(TLayoutQualifier::Create()),
+ primarySize(1),
+ secondarySize(1),
+ mArraySizes(nullptr),
+ mInterfaceBlock(nullptr),
+ mStructure(userDef),
+ mIsStructSpecifier(isStructSpecifier),
+ mMangledName(nullptr)
+{}
+
+TType::TType(const TInterfaceBlock *interfaceBlockIn,
+ TQualifier qualifierIn,
+ TLayoutQualifier layoutQualifierIn)
+ : type(EbtInterfaceBlock),
+ precision(EbpUndefined),
+ qualifier(qualifierIn),
+ invariant(false),
+ memoryQualifier(TMemoryQualifier::Create()),
+ layoutQualifier(layoutQualifierIn),
+ primarySize(1),
+ secondarySize(1),
+ mArraySizes(nullptr),
+ mInterfaceBlock(interfaceBlockIn),
+ mStructure(0),
+ mIsStructSpecifier(false),
+ mMangledName(nullptr)
+{}
+
+TType::TType(const TType &t)
+ : type(t.type),
+ precision(t.precision),
+ qualifier(t.qualifier),
+ invariant(t.invariant),
+ memoryQualifier(t.memoryQualifier),
+ layoutQualifier(t.layoutQualifier),
+ primarySize(t.primarySize),
+ secondarySize(t.secondarySize),
+ mArraySizes(t.mArraySizes ? new TVector<unsigned int>(*t.mArraySizes) : nullptr),
+ mInterfaceBlock(t.mInterfaceBlock),
+ mStructure(t.mStructure),
+ mIsStructSpecifier(t.mIsStructSpecifier),
+ mMangledName(t.mMangledName)
+{}
+
+TType &TType::operator=(const TType &t)
+{
+ type = t.type;
+ precision = t.precision;
+ qualifier = t.qualifier;
+ invariant = t.invariant;
+ memoryQualifier = t.memoryQualifier;
+ layoutQualifier = t.layoutQualifier;
+ primarySize = t.primarySize;
+ secondarySize = t.secondarySize;
+ mArraySizes = t.mArraySizes ? new TVector<unsigned int>(*t.mArraySizes) : nullptr;
+ mInterfaceBlock = t.mInterfaceBlock;
+ mStructure = t.mStructure;
+ mIsStructSpecifier = t.mIsStructSpecifier;
+ mMangledName = t.mMangledName;
+ return *this;
+}
+
+bool TType::canBeConstructed() const
+{
+ switch (type)
+ {
+ case EbtFloat:
+ case EbtInt:
+ case EbtUInt:
+ case EbtBool:
+ case EbtStruct:
+ return true;
+ default:
+ return false;
+ }
+}
+
+const char *TType::getBuiltInTypeNameString() const
+{
+ if (isMatrix())
+ {
+ switch (getCols())
+ {
+ case 2:
+ switch (getRows())
+ {
+ case 2:
+ return "mat2";
+ case 3:
+ return "mat2x3";
+ case 4:
+ return "mat2x4";
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ case 3:
+ switch (getRows())
+ {
+ case 2:
+ return "mat3x2";
+ case 3:
+ return "mat3";
+ case 4:
+ return "mat3x4";
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ case 4:
+ switch (getRows())
+ {
+ case 2:
+ return "mat4x2";
+ case 3:
+ return "mat4x3";
+ case 4:
+ return "mat4";
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ }
+ if (isVector())
+ {
+ switch (getBasicType())
+ {
+ case EbtFloat:
+ switch (getNominalSize())
+ {
+ case 2:
+ return "vec2";
+ case 3:
+ return "vec3";
+ case 4:
+ return "vec4";
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ case EbtInt:
+ switch (getNominalSize())
+ {
+ case 2:
+ return "ivec2";
+ case 3:
+ return "ivec3";
+ case 4:
+ return "ivec4";
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ case EbtBool:
+ switch (getNominalSize())
+ {
+ case 2:
+ return "bvec2";
+ case 3:
+ return "bvec3";
+ case 4:
+ return "bvec4";
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ case EbtUInt:
+ switch (getNominalSize())
+ {
+ case 2:
+ return "uvec2";
+ case 3:
+ return "uvec3";
+ case 4:
+ return "uvec4";
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ }
+ ASSERT(getBasicType() != EbtStruct);
+ ASSERT(getBasicType() != EbtInterfaceBlock);
+ return getBasicString();
+}
+
+int TType::getDeepestStructNesting() const
+{
+ return mStructure ? mStructure->deepestNesting() : 0;
+}
+
+bool TType::isNamelessStruct() const
+{
+ return mStructure && mStructure->symbolType() == SymbolType::Empty;
+}
+
+bool TType::isStructureContainingArrays() const
+{
+ return mStructure ? mStructure->containsArrays() : false;
+}
+
+bool TType::isStructureContainingMatrices() const
+{
+ return mStructure ? mStructure->containsMatrices() : false;
+}
+
+bool TType::isStructureContainingType(TBasicType t) const
+{
+ return mStructure ? mStructure->containsType(t) : false;
+}
+
+bool TType::isStructureContainingSamplers() const
+{
+ return mStructure ? mStructure->containsSamplers() : false;
+}
+
+bool TType::canReplaceWithConstantUnion() const
+{
+ if (isArray())
+ {
+ return false;
+ }
+ if (!mStructure)
+ {
+ return true;
+ }
+ if (isStructureContainingArrays())
+ {
+ return false;
+ }
+ if (getObjectSize() > 16)
+ {
+ return false;
+ }
+ return true;
+}
+
+//
+// Recursively generate mangled names.
+//
+const char *TType::buildMangledName() const
+{
+ TString mangledName(1, GetSizeMangledName(primarySize, secondarySize));
+
+ char basicMangledName = GetBasicMangledName(type);
+ if (basicMangledName != '{')
+ {
+ mangledName += basicMangledName;
+ }
+ else
+ {
+ ASSERT(type == EbtStruct || type == EbtInterfaceBlock);
+ switch (type)
+ {
+ case EbtStruct:
+ mangledName += "{s";
+ if (mStructure->symbolType() != SymbolType::Empty)
+ {
+ mangledName += mStructure->name().data();
+ }
+ mangledName += mStructure->mangledFieldList();
+ mangledName += '}';
+ break;
+ case EbtInterfaceBlock:
+ mangledName += "{i";
+ mangledName += mInterfaceBlock->name().data();
+ mangledName += mInterfaceBlock->mangledFieldList();
+ mangledName += '}';
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+
+ if (mArraySizes)
+ {
+ for (unsigned int arraySize : *mArraySizes)
+ {
+ char buf[20];
+ snprintf(buf, sizeof(buf), "%d", arraySize);
+ mangledName += '[';
+ mangledName += buf;
+ mangledName += ']';
+ }
+ }
+
+ // Copy string contents into a pool-allocated buffer, so we never need to call delete.
+ return AllocatePoolCharArray(mangledName.c_str(), mangledName.size());
+}
+
+size_t TType::getObjectSize() const
+{
+ size_t totalSize;
+
+ if (getBasicType() == EbtStruct)
+ totalSize = mStructure->objectSize();
+ else
+ totalSize = primarySize * secondarySize;
+
+ if (totalSize == 0)
+ return 0;
+
+ if (mArraySizes)
+ {
+ for (size_t arraySize : *mArraySizes)
+ {
+ if (arraySize > INT_MAX / totalSize)
+ totalSize = INT_MAX;
+ else
+ totalSize *= arraySize;
+ }
+ }
+
+ return totalSize;
+}
+
+int TType::getLocationCount() const
+{
+ int count = 1;
+
+ if (getBasicType() == EbtStruct)
+ {
+ count = mStructure->getLocationCount();
+ }
+
+ if (count == 0)
+ {
+ return 0;
+ }
+
+ if (mArraySizes)
+ {
+ for (unsigned int arraySize : *mArraySizes)
+ {
+ if (arraySize > static_cast<unsigned int>(std::numeric_limits<int>::max() / count))
+ {
+ count = std::numeric_limits<int>::max();
+ }
+ else
+ {
+ count *= static_cast<int>(arraySize);
+ }
+ }
+ }
+
+ return count;
+}
+
+unsigned int TType::getArraySizeProduct() const
+{
+ if (!mArraySizes)
+ return 1u;
+
+ unsigned int product = 1u;
+
+ for (unsigned int arraySize : *mArraySizes)
+ {
+ product *= arraySize;
+ }
+ return product;
+}
+
+bool TType::isUnsizedArray() const
+{
+ if (!mArraySizes)
+ return false;
+
+ for (unsigned int arraySize : *mArraySizes)
+ {
+ if (arraySize == 0u)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool TType::sameNonArrayType(const TType &right) const
+{
+ return (type == right.type && primarySize == right.primarySize &&
+ secondarySize == right.secondarySize && mStructure == right.mStructure);
+}
+
+bool TType::isElementTypeOf(const TType &arrayType) const
+{
+ if (!sameNonArrayType(arrayType))
+ {
+ return false;
+ }
+ if (arrayType.getNumArraySizes() != getNumArraySizes() + 1u)
+ {
+ return false;
+ }
+ if (isArray())
+ {
+ for (size_t i = 0; i < mArraySizes->size(); ++i)
+ {
+ if ((*mArraySizes)[i] != (*arrayType.mArraySizes)[i])
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+void TType::sizeUnsizedArrays(const TVector<unsigned int> *newArraySizes)
+{
+ size_t newArraySizesSize = newArraySizes ? newArraySizes->size() : 0;
+ for (size_t i = 0u; i < getNumArraySizes(); ++i)
+ {
+ if ((*mArraySizes)[i] == 0)
+ {
+ if (i < newArraySizesSize)
+ {
+ ASSERT(newArraySizes != nullptr);
+ (*mArraySizes)[i] = (*newArraySizes)[i];
+ }
+ else
+ {
+ (*mArraySizes)[i] = 1u;
+ }
+ }
+ }
+ invalidateMangledName();
+}
+
+void TType::sizeOutermostUnsizedArray(unsigned int arraySize)
+{
+ ASSERT(isArray());
+ ASSERT(mArraySizes->back() == 0u);
+ mArraySizes->back() = arraySize;
+}
+
+void TType::setBasicType(TBasicType t)
+{
+ if (type != t)
+ {
+ type = t;
+ invalidateMangledName();
+ }
+}
+
+void TType::setPrimarySize(unsigned char ps)
+{
+ if (primarySize != ps)
+ {
+ ASSERT(ps <= 4);
+ primarySize = ps;
+ invalidateMangledName();
+ }
+}
+
+void TType::setSecondarySize(unsigned char ss)
+{
+ if (secondarySize != ss)
+ {
+ ASSERT(ss <= 4);
+ secondarySize = ss;
+ invalidateMangledName();
+ }
+}
+
+void TType::makeArray(unsigned int s)
+{
+ if (!mArraySizes)
+ mArraySizes = new TVector<unsigned int>();
+
+ mArraySizes->push_back(s);
+ invalidateMangledName();
+}
+
+void TType::makeArrays(const TVector<unsigned int> &sizes)
+{
+ if (!mArraySizes)
+ mArraySizes = new TVector<unsigned int>();
+
+ mArraySizes->insert(mArraySizes->end(), sizes.begin(), sizes.end());
+ invalidateMangledName();
+}
+
+void TType::setArraySize(size_t arrayDimension, unsigned int s)
+{
+ ASSERT(mArraySizes != nullptr);
+ ASSERT(arrayDimension < mArraySizes->size());
+ if (mArraySizes->at(arrayDimension) != s)
+ {
+ (*mArraySizes)[arrayDimension] = s;
+ invalidateMangledName();
+ }
+}
+
+void TType::toArrayElementType()
+{
+ ASSERT(mArraySizes != nullptr);
+ if (mArraySizes->size() > 0)
+ {
+ mArraySizes->pop_back();
+ invalidateMangledName();
+ }
+}
+
+void TType::setInterfaceBlock(const TInterfaceBlock *interfaceBlockIn)
+{
+ if (mInterfaceBlock != interfaceBlockIn)
+ {
+ mInterfaceBlock = interfaceBlockIn;
+ invalidateMangledName();
+ }
+}
+
+const char *TType::getMangledName() const
+{
+ if (mMangledName == nullptr)
+ {
+ mMangledName = buildMangledName();
+ }
+
+ return mMangledName;
+}
+
+void TType::realize()
+{
+ getMangledName();
+}
+
+void TType::invalidateMangledName()
+{
+ mMangledName = nullptr;
+}
+
+void TType::createSamplerSymbols(const ImmutableString &namePrefix,
+ const TString &apiNamePrefix,
+ TVector<const TVariable *> *outputSymbols,
+ TMap<const TVariable *, TString> *outputSymbolsToAPINames,
+ TSymbolTable *symbolTable) const
+{
+ if (isStructureContainingSamplers())
+ {
+ if (isArray())
+ {
+ TType elementType(*this);
+ elementType.toArrayElementType();
+ for (unsigned int arrayIndex = 0u; arrayIndex < getOutermostArraySize(); ++arrayIndex)
+ {
+ std::stringstream elementName = sh::InitializeStream<std::stringstream>();
+ elementName << namePrefix << "_" << arrayIndex;
+ TStringStream elementApiName;
+ elementApiName << apiNamePrefix << "[" << arrayIndex << "]";
+ elementType.createSamplerSymbols(ImmutableString(elementName.str()),
+ elementApiName.str(), outputSymbols,
+ outputSymbolsToAPINames, symbolTable);
+ }
+ }
+ else
+ {
+ mStructure->createSamplerSymbols(namePrefix.data(), apiNamePrefix, outputSymbols,
+ outputSymbolsToAPINames, symbolTable);
+ }
+ return;
+ }
+
+ ASSERT(IsSampler(type));
+ TVariable *variable =
+ new TVariable(symbolTable, namePrefix, new TType(*this), SymbolType::AngleInternal);
+ outputSymbols->push_back(variable);
+ if (outputSymbolsToAPINames)
+ {
+ (*outputSymbolsToAPINames)[variable] = apiNamePrefix;
+ }
+}
+
+TFieldListCollection::TFieldListCollection(const TFieldList *fields)
+ : mFields(fields), mObjectSize(0), mDeepestNesting(0)
+{}
+
+bool TFieldListCollection::containsArrays() const
+{
+ for (const auto *field : *mFields)
+ {
+ const TType *fieldType = field->type();
+ if (fieldType->isArray() || fieldType->isStructureContainingArrays())
+ return true;
+ }
+ return false;
+}
+
+bool TFieldListCollection::containsMatrices() const
+{
+ for (const auto *field : *mFields)
+ {
+ const TType *fieldType = field->type();
+ if (fieldType->isMatrix() || fieldType->isStructureContainingMatrices())
+ return true;
+ }
+ return false;
+}
+
+bool TFieldListCollection::containsType(TBasicType type) const
+{
+ for (const auto *field : *mFields)
+ {
+ const TType *fieldType = field->type();
+ if (fieldType->getBasicType() == type || fieldType->isStructureContainingType(type))
+ return true;
+ }
+ return false;
+}
+
+bool TFieldListCollection::containsSamplers() const
+{
+ for (const auto *field : *mFields)
+ {
+ const TType *fieldType = field->type();
+ if (IsSampler(fieldType->getBasicType()) || fieldType->isStructureContainingSamplers())
+ return true;
+ }
+ return false;
+}
+
+TString TFieldListCollection::buildMangledFieldList() const
+{
+ TString mangledName;
+ for (const auto *field : *mFields)
+ {
+ mangledName += field->type()->getMangledName();
+ }
+ return mangledName;
+}
+
+size_t TFieldListCollection::calculateObjectSize() const
+{
+ size_t size = 0;
+ for (const TField *field : *mFields)
+ {
+ size_t fieldSize = field->type()->getObjectSize();
+ if (fieldSize > INT_MAX - size)
+ size = INT_MAX;
+ else
+ size += fieldSize;
+ }
+ return size;
+}
+
+size_t TFieldListCollection::objectSize() const
+{
+ if (mObjectSize == 0)
+ mObjectSize = calculateObjectSize();
+ return mObjectSize;
+}
+
+int TFieldListCollection::getLocationCount() const
+{
+ int count = 0;
+ for (const TField *field : *mFields)
+ {
+ int fieldCount = field->type()->getLocationCount();
+ if (fieldCount > std::numeric_limits<int>::max() - count)
+ {
+ count = std::numeric_limits<int>::max();
+ }
+ else
+ {
+ count += fieldCount;
+ }
+ }
+ return count;
+}
+
+int TFieldListCollection::deepestNesting() const
+{
+ if (mDeepestNesting == 0)
+ mDeepestNesting = calculateDeepestNesting();
+ return mDeepestNesting;
+}
+
+const TString &TFieldListCollection::mangledFieldList() const
+{
+ if (mMangledFieldList.empty())
+ mMangledFieldList = buildMangledFieldList();
+ return mMangledFieldList;
+}
+
+int TFieldListCollection::calculateDeepestNesting() const
+{
+ int maxNesting = 0;
+ for (size_t i = 0; i < mFields->size(); ++i)
+ maxNesting = std::max(maxNesting, (*mFields)[i]->type()->getDeepestStructNesting());
+ return 1 + maxNesting;
+}
+
+// TPublicType implementation.
+void TPublicType::initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q)
+{
+ typeSpecifierNonArray = typeSpecifier;
+ layoutQualifier = TLayoutQualifier::Create();
+ memoryQualifier = TMemoryQualifier::Create();
+ qualifier = q;
+ invariant = false;
+ precision = EbpUndefined;
+ arraySizes = nullptr;
+}
+
+void TPublicType::initializeBasicType(TBasicType basicType)
+{
+ typeSpecifierNonArray.type = basicType;
+ typeSpecifierNonArray.primarySize = 1;
+ typeSpecifierNonArray.secondarySize = 1;
+ layoutQualifier = TLayoutQualifier::Create();
+ memoryQualifier = TMemoryQualifier::Create();
+ qualifier = EvqTemporary;
+ invariant = false;
+ precision = EbpUndefined;
+ arraySizes = nullptr;
+}
+
+bool TPublicType::isStructureContainingArrays() const
+{
+ if (!typeSpecifierNonArray.userDef)
+ {
+ return false;
+ }
+
+ return typeSpecifierNonArray.userDef->containsArrays();
+}
+
+bool TPublicType::isStructureContainingType(TBasicType t) const
+{
+ if (!typeSpecifierNonArray.userDef)
+ {
+ return false;
+ }
+
+ return typeSpecifierNonArray.userDef->containsType(t);
+}
+
+void TPublicType::setArraySizes(TVector<unsigned int> *sizes)
+{
+ arraySizes = sizes;
+}
+
+bool TPublicType::isArray() const
+{
+ return arraySizes && !arraySizes->empty();
+}
+
+void TPublicType::clearArrayness()
+{
+ arraySizes = nullptr;
+}
+
+bool TPublicType::isAggregate() const
+{
+ return isArray() || typeSpecifierNonArray.isMatrix() || typeSpecifierNonArray.isVector();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/Types.h b/gfx/angle/checkout/src/compiler/translator/Types.h
new file mode 100644
index 0000000000..2a78d1e114
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/Types.h
@@ -0,0 +1,464 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_TYPES_H_
+#define COMPILER_TRANSLATOR_TYPES_H_
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/SymbolUniqueId.h"
+
+namespace sh
+{
+
+struct TPublicType;
+class TType;
+class TInterfaceBlock;
+class TStructure;
+class TSymbol;
+class TVariable;
+class TIntermSymbol;
+class TSymbolTable;
+
+class TField : angle::NonCopyable
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TField(TType *type, const ImmutableString &name, const TSourceLoc &line, SymbolType symbolType)
+ : mType(type), mName(name), mLine(line), mSymbolType(symbolType)
+ {
+ ASSERT(mSymbolType != SymbolType::Empty);
+ }
+
+ // TODO(alokp): We should only return const type.
+ // Fix it by tweaking grammar.
+ TType *type() { return mType; }
+ const TType *type() const { return mType; }
+ const ImmutableString &name() const { return mName; }
+ const TSourceLoc &line() const { return mLine; }
+ SymbolType symbolType() const { return mSymbolType; }
+
+ private:
+ TType *mType;
+ const ImmutableString mName;
+ const TSourceLoc mLine;
+ const SymbolType mSymbolType;
+};
+
+typedef TVector<TField *> TFieldList;
+
+class TFieldListCollection : angle::NonCopyable
+{
+ public:
+ const TFieldList &fields() const { return *mFields; }
+
+ bool containsArrays() const;
+ bool containsMatrices() const;
+ bool containsType(TBasicType t) const;
+ bool containsSamplers() const;
+
+ size_t objectSize() const;
+ // How many locations the field list consumes as a uniform.
+ int getLocationCount() const;
+ int deepestNesting() const;
+ const TString &mangledFieldList() const;
+
+ protected:
+ TFieldListCollection(const TFieldList *fields);
+
+ const TFieldList *mFields;
+
+ private:
+ size_t calculateObjectSize() const;
+ int calculateDeepestNesting() const;
+ TString buildMangledFieldList() const;
+
+ mutable size_t mObjectSize;
+ mutable int mDeepestNesting;
+ mutable TString mMangledFieldList;
+};
+
+//
+// Base class for things that have a type.
+//
+class TType
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TType();
+ explicit TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1);
+ TType(TBasicType t,
+ TPrecision p,
+ TQualifier q = EvqTemporary,
+ unsigned char ps = 1,
+ unsigned char ss = 1);
+ explicit TType(const TPublicType &p);
+ TType(const TStructure *userDef, bool isStructSpecifier);
+ TType(const TInterfaceBlock *interfaceBlockIn,
+ TQualifier qualifierIn,
+ TLayoutQualifier layoutQualifierIn);
+ TType(const TType &t);
+ TType &operator=(const TType &t);
+
+ constexpr TType(TBasicType t,
+ TPrecision p,
+ TQualifier q,
+ unsigned char ps,
+ unsigned char ss,
+ const char *mangledName)
+ : type(t),
+ precision(p),
+ qualifier(q),
+ invariant(false),
+ memoryQualifier(TMemoryQualifier::Create()),
+ layoutQualifier(TLayoutQualifier::Create()),
+ primarySize(ps),
+ secondarySize(ss),
+ mArraySizes(nullptr),
+ mInterfaceBlock(nullptr),
+ mStructure(nullptr),
+ mIsStructSpecifier(false),
+ mMangledName(mangledName)
+ {}
+
+ constexpr TType(TType &&t)
+ : type(t.type),
+ precision(t.precision),
+ qualifier(t.qualifier),
+ invariant(t.invariant),
+ memoryQualifier(t.memoryQualifier),
+ layoutQualifier(t.layoutQualifier),
+ primarySize(t.primarySize),
+ secondarySize(t.secondarySize),
+ mArraySizes(t.mArraySizes),
+ mInterfaceBlock(t.mInterfaceBlock),
+ mStructure(t.mStructure),
+ mIsStructSpecifier(t.mIsStructSpecifier),
+ mMangledName(t.mMangledName)
+ {}
+
+ constexpr TBasicType getBasicType() const { return type; }
+ void setBasicType(TBasicType t);
+
+ TPrecision getPrecision() const { return precision; }
+ void setPrecision(TPrecision p) { precision = p; }
+
+ constexpr TQualifier getQualifier() const { return qualifier; }
+ void setQualifier(TQualifier q) { qualifier = q; }
+
+ bool isInvariant() const { return invariant; }
+
+ void setInvariant(bool i) { invariant = i; }
+
+ TMemoryQualifier getMemoryQualifier() const { return memoryQualifier; }
+ void setMemoryQualifier(const TMemoryQualifier &mq) { memoryQualifier = mq; }
+
+ 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);
+ void setSecondarySize(unsigned char ss);
+
+ // Full size of single instance of type
+ size_t getObjectSize() const;
+
+ // Get how many locations this type consumes as a uniform.
+ int getLocationCount() const;
+
+ bool isMatrix() const { return primarySize > 1 && secondarySize > 1; }
+ bool isNonSquareMatrix() const { return isMatrix() && primarySize != secondarySize; }
+ bool isArray() const { return mArraySizes != nullptr && !mArraySizes->empty(); }
+ bool isArrayOfArrays() const { return isArray() && mArraySizes->size() > 1u; }
+ size_t getNumArraySizes() const { return isArray() ? mArraySizes->size() : 0; }
+ const TVector<unsigned int> *getArraySizes() const { return mArraySizes; }
+ unsigned int getArraySizeProduct() const;
+ bool isUnsizedArray() const;
+ unsigned int getOutermostArraySize() const
+ {
+ ASSERT(isArray());
+ return mArraySizes->back();
+ }
+ void makeArray(unsigned int s);
+
+ // sizes contain new outermost array sizes.
+ void makeArrays(const TVector<unsigned int> &sizes);
+ // Here, the array dimension value 0 corresponds to the innermost array.
+ void setArraySize(size_t arrayDimension, unsigned int s);
+
+ // Will set unsized array sizes according to newArraySizes. In case there are more
+ // unsized arrays than there are sizes in newArraySizes, defaults to setting any
+ // remaining array sizes to 1.
+ void sizeUnsizedArrays(const TVector<unsigned int> *newArraySizes);
+
+ // Will size the outermost array according to arraySize.
+ void sizeOutermostUnsizedArray(unsigned int arraySize);
+
+ // Note that the array element type might still be an array type in GLSL ES version >= 3.10.
+ void toArrayElementType();
+
+ const TInterfaceBlock *getInterfaceBlock() const { return mInterfaceBlock; }
+ void setInterfaceBlock(const TInterfaceBlock *interfaceBlockIn);
+ bool isInterfaceBlock() const { return type == EbtInterfaceBlock; }
+
+ bool isVector() const { return primarySize > 1 && secondarySize == 1; }
+ bool isScalar() const
+ {
+ return primarySize == 1 && secondarySize == 1 && !mStructure && !isArray();
+ }
+ bool isScalarFloat() const { return isScalar() && type == EbtFloat; }
+ bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); }
+
+ bool canBeConstructed() const;
+
+ const TStructure *getStruct() const { return mStructure; }
+
+ static constexpr char GetSizeMangledName(unsigned char primarySize, unsigned char secondarySize)
+ {
+ unsigned int sizeKey = (secondarySize - 1u) * 4u + primarySize - 1u;
+ if (sizeKey < 10u)
+ {
+ return static_cast<char>('0' + sizeKey);
+ }
+ return static_cast<char>('A' + sizeKey - 10);
+ }
+ const char *getMangledName() const;
+
+ bool sameNonArrayType(const TType &right) const;
+
+ // Returns true if arrayType is an array made of this type.
+ bool isElementTypeOf(const TType &arrayType) const;
+
+ bool operator==(const TType &right) const
+ {
+ size_t numArraySizesL = getNumArraySizes();
+ size_t numArraySizesR = right.getNumArraySizes();
+ bool arraySizesEqual = numArraySizesL == numArraySizesR &&
+ (numArraySizesL == 0 || *mArraySizes == *right.mArraySizes);
+ return type == right.type && primarySize == right.primarySize &&
+ secondarySize == right.secondarySize && arraySizesEqual &&
+ mStructure == right.mStructure;
+ // don't check the qualifier, it's not ever what's being sought after
+ }
+ bool operator!=(const TType &right) const { return !operator==(right); }
+ bool operator<(const TType &right) const
+ {
+ if (type != right.type)
+ return type < right.type;
+ if (primarySize != right.primarySize)
+ return primarySize < right.primarySize;
+ if (secondarySize != right.secondarySize)
+ return secondarySize < right.secondarySize;
+ size_t numArraySizesL = getNumArraySizes();
+ size_t numArraySizesR = right.getNumArraySizes();
+ if (numArraySizesL != numArraySizesR)
+ return numArraySizesL < numArraySizesR;
+ for (size_t i = 0; i < numArraySizesL; ++i)
+ {
+ if ((*mArraySizes)[i] != (*right.mArraySizes)[i])
+ return (*mArraySizes)[i] < (*right.mArraySizes)[i];
+ }
+ if (mStructure != right.mStructure)
+ return mStructure < right.mStructure;
+
+ return false;
+ }
+
+ const char *getBasicString() const { return sh::getBasicString(type); }
+
+ const char *getPrecisionString() const { return sh::getPrecisionString(precision); }
+ const char *getQualifierString() const { return sh::getQualifierString(qualifier); }
+
+ const char *getBuiltInTypeNameString() const;
+
+ // If this type is a struct, returns the deepest struct nesting of
+ // any field in the struct. For example:
+ // struct nesting1 {
+ // vec4 position;
+ // };
+ // struct nesting2 {
+ // nesting1 field1;
+ // vec4 field2;
+ // };
+ // For type "nesting2", this method would return 2 -- the number
+ // of structures through which indirection must occur to reach the
+ // deepest field (nesting2.field1.position).
+ int getDeepestStructNesting() const;
+
+ bool isNamelessStruct() const;
+
+ bool isStructureContainingArrays() const;
+ bool isStructureContainingMatrices() const;
+ bool isStructureContainingType(TBasicType t) const;
+ bool isStructureContainingSamplers() const;
+
+ bool isStructSpecifier() const { return mIsStructSpecifier; }
+
+ // Return true if variables of this type should be replaced with an inline constant value if
+ // such is available. False will be returned in cases where output doesn't support
+ // TIntermConstantUnion nodes of the type, or if the type contains a lot of fields and creating
+ // several copies of it in the output code is undesirable for performance.
+ bool canReplaceWithConstantUnion() const;
+
+ // The char arrays passed in must be pool allocated or static.
+ void createSamplerSymbols(const ImmutableString &namePrefix,
+ const TString &apiNamePrefix,
+ TVector<const TVariable *> *outputSymbols,
+ TMap<const TVariable *, TString> *outputSymbolsToAPINames,
+ TSymbolTable *symbolTable) const;
+
+ // Initializes all lazily-initialized members.
+ void realize();
+
+ bool isSampler() const { return IsSampler(type); }
+ bool isAtomicCounter() const { return IsAtomicCounter(type); }
+
+ private:
+ void invalidateMangledName();
+ const char *buildMangledName() const;
+
+ TBasicType type;
+ TPrecision precision;
+ TQualifier qualifier;
+ bool invariant;
+ TMemoryQualifier memoryQualifier;
+ TLayoutQualifier layoutQualifier;
+ unsigned char primarySize; // size of vector or cols matrix
+ unsigned char secondarySize; // rows of a matrix
+
+ // Used to make an array type. Outermost array size is stored at the end of the vector. Having 0
+ // in this vector means an unsized array.
+ TVector<unsigned int> *mArraySizes;
+
+ // This is set only in the following two cases:
+ // 1) Represents an interface block.
+ // 2) Represents the member variable of an unnamed interface block.
+ // It's nullptr also for members of named interface blocks.
+ const TInterfaceBlock *mInterfaceBlock;
+
+ // nullptr unless this is a struct
+ const TStructure *mStructure;
+ bool mIsStructSpecifier;
+
+ mutable const char *mMangledName;
+};
+
+// TTypeSpecifierNonArray stores all of the necessary fields for type_specifier_nonarray from the
+// grammar
+struct TTypeSpecifierNonArray
+{
+ TBasicType type;
+ unsigned char primarySize; // size of vector or cols of matrix
+ unsigned char secondarySize; // rows of matrix
+ const TStructure *userDef;
+ TSourceLoc line;
+
+ // true if the type was defined by a struct specifier rather than a reference to a type name.
+ bool isStructSpecifier;
+
+ void initialize(TBasicType aType, const TSourceLoc &aLine)
+ {
+ ASSERT(aType != EbtStruct);
+ type = aType;
+ primarySize = 1;
+ secondarySize = 1;
+ userDef = nullptr;
+ line = aLine;
+ isStructSpecifier = false;
+ }
+
+ void initializeStruct(const TStructure *aUserDef,
+ bool aIsStructSpecifier,
+ const TSourceLoc &aLine)
+ {
+ type = EbtStruct;
+ primarySize = 1;
+ secondarySize = 1;
+ userDef = aUserDef;
+ line = aLine;
+ isStructSpecifier = aIsStructSpecifier;
+ }
+
+ void setAggregate(unsigned char size) { primarySize = size; }
+
+ void setMatrix(unsigned char columns, unsigned char rows)
+ {
+ ASSERT(columns > 1 && rows > 1 && columns <= 4 && rows <= 4);
+ primarySize = columns;
+ secondarySize = rows;
+ }
+
+ bool isMatrix() const { return primarySize > 1 && secondarySize > 1; }
+
+ bool isVector() const { return primarySize > 1 && secondarySize == 1; }
+};
+
+//
+// This is a workaround for a problem with the yacc stack, It can't have
+// types that it thinks have non-trivial constructors. It should
+// just be used while recognizing the grammar, not anything else. Pointers
+// could be used, but also trying to avoid lots of memory management overhead.
+//
+// Not as bad as it looks, there is no actual assumption that the fields
+// match up or are name the same or anything like that.
+//
+struct TPublicType
+{
+ // Must have a trivial default constructor since it is used in YYSTYPE.
+ TPublicType() = default;
+
+ void initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q);
+ void initializeBasicType(TBasicType basicType);
+
+ TBasicType getBasicType() const { return typeSpecifierNonArray.type; }
+ void setBasicType(TBasicType basicType) { typeSpecifierNonArray.type = basicType; }
+
+ unsigned char getPrimarySize() const { return typeSpecifierNonArray.primarySize; }
+ unsigned char getSecondarySize() const { return typeSpecifierNonArray.secondarySize; }
+
+ const TStructure *getUserDef() const { return typeSpecifierNonArray.userDef; }
+ const TSourceLoc &getLine() const { return typeSpecifierNonArray.line; }
+
+ bool isStructSpecifier() const { return typeSpecifierNonArray.isStructSpecifier; }
+
+ bool isStructureContainingArrays() const;
+ bool isStructureContainingType(TBasicType t) const;
+ void setArraySizes(TVector<unsigned int> *sizes);
+ bool isArray() const;
+ void clearArrayness();
+ bool isAggregate() const;
+
+ TTypeSpecifierNonArray typeSpecifierNonArray;
+ TLayoutQualifier layoutQualifier;
+ TMemoryQualifier memoryQualifier;
+ TQualifier qualifier;
+ bool invariant;
+ TPrecision precision;
+
+ // Either nullptr or empty in case the type is not an array. The last element is the outermost
+ // array size. Note that due to bison restrictions, copies of the public type created by the
+ // copy constructor share the same arraySizes pointer.
+ const TVector<unsigned int> *arraySizes;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TYPES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp
new file mode 100644
index 0000000000..11e337dabd
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp
@@ -0,0 +1,1108 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// UtilsHLSL.cpp:
+// Utility methods for GLSL to HLSL translation.
+//
+
+#include "compiler/translator/UtilsHLSL.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/StructureHLSL.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void DisambiguateFunctionNameForParameterType(const TType &paramType,
+ TString *disambiguatingStringOut)
+{
+ // Parameter types are only added to function names if they are ambiguous according to the
+ // native HLSL compiler. Other parameter types are not added to function names to avoid
+ // making function names longer.
+ if (paramType.getObjectSize() == 4 && paramType.getBasicType() == EbtFloat)
+ {
+ // Disambiguation is needed for float2x2 and float4 parameters. These are the only
+ // built-in types that HLSL thinks are identical. float2x3 and float3x2 are different
+ // types, for example.
+ *disambiguatingStringOut += "_" + TypeString(paramType);
+ }
+ else if (paramType.getBasicType() == EbtStruct)
+ {
+ // Disambiguation is needed for struct parameters, since HLSL thinks that structs with
+ // the same fields but a different name are identical.
+ ASSERT(paramType.getStruct()->symbolType() != SymbolType::Empty);
+ *disambiguatingStringOut += "_" + TypeString(paramType);
+ }
+}
+
+} // anonymous namespace
+
+const char *SamplerString(const TBasicType type)
+{
+ if (IsShadowSampler(type))
+ {
+ return "SamplerComparisonState";
+ }
+ else
+ {
+ return "SamplerState";
+ }
+}
+
+const char *SamplerString(HLSLTextureGroup type)
+{
+ if (type >= HLSL_COMPARISON_SAMPLER_GROUP_BEGIN && type <= HLSL_COMPARISON_SAMPLER_GROUP_END)
+ {
+ return "SamplerComparisonState";
+ }
+ else
+ {
+ return "SamplerState";
+ }
+}
+
+HLSLTextureGroup TextureGroup(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
+
+{
+ switch (type)
+ {
+ case EbtSampler2D:
+ return HLSL_TEXTURE_2D;
+ case EbtSamplerCube:
+ return HLSL_TEXTURE_CUBE;
+ case EbtSamplerExternalOES:
+ return HLSL_TEXTURE_2D;
+ case EbtSampler2DArray:
+ return HLSL_TEXTURE_2D_ARRAY;
+ case EbtSampler3D:
+ return HLSL_TEXTURE_3D;
+ case EbtSampler2DMS:
+ return HLSL_TEXTURE_2D_MS;
+ case EbtSampler2DMSArray:
+ return HLSL_TEXTURE_2D_MS_ARRAY;
+ case EbtISampler2D:
+ return HLSL_TEXTURE_2D_INT4;
+ case EbtISampler3D:
+ return HLSL_TEXTURE_3D_INT4;
+ case EbtISamplerCube:
+ return HLSL_TEXTURE_2D_ARRAY_INT4;
+ case EbtISampler2DArray:
+ return HLSL_TEXTURE_2D_ARRAY_INT4;
+ case EbtISampler2DMS:
+ return HLSL_TEXTURE_2D_MS_INT4;
+ case EbtISampler2DMSArray:
+ return HLSL_TEXTURE_2D_MS_ARRAY_INT4;
+ case EbtUSampler2D:
+ return HLSL_TEXTURE_2D_UINT4;
+ case EbtUSampler3D:
+ return HLSL_TEXTURE_3D_UINT4;
+ case EbtUSamplerCube:
+ return HLSL_TEXTURE_2D_ARRAY_UINT4;
+ case EbtUSampler2DArray:
+ return HLSL_TEXTURE_2D_ARRAY_UINT4;
+ case EbtUSampler2DMS:
+ return HLSL_TEXTURE_2D_MS_UINT4;
+ case EbtUSampler2DMSArray:
+ return HLSL_TEXTURE_2D_MS_ARRAY_UINT4;
+ case EbtSampler2DShadow:
+ return HLSL_TEXTURE_2D_COMPARISON;
+ case EbtSamplerCubeShadow:
+ return HLSL_TEXTURE_CUBE_COMPARISON;
+ case EbtSampler2DArrayShadow:
+ return HLSL_TEXTURE_2D_ARRAY_COMPARISON;
+ case EbtImage2D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return HLSL_TEXTURE_2D;
+ case EiifRGBA8:
+ return HLSL_TEXTURE_2D_UNORM;
+ case EiifRGBA8_SNORM:
+ return HLSL_TEXTURE_2D_SNORM;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtIImage2D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return HLSL_TEXTURE_2D_INT4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtUImage2D:
+ {
+ switch (imageInternalFormat)
+ {
+
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return HLSL_TEXTURE_2D_UINT4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtImage3D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return HLSL_TEXTURE_3D;
+ case EiifRGBA8:
+ return HLSL_TEXTURE_3D_UNORM;
+ case EiifRGBA8_SNORM:
+ return HLSL_TEXTURE_3D_SNORM;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtIImage3D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return HLSL_TEXTURE_3D_INT4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtUImage3D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return HLSL_TEXTURE_3D_UINT4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtImage2DArray:
+ case EbtImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return HLSL_TEXTURE_2D_ARRAY;
+ case EiifRGBA8:
+ return HLSL_TEXTURE_2D_ARRAY_UNORN;
+ case EiifRGBA8_SNORM:
+ return HLSL_TEXTURE_2D_ARRAY_SNORM;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtIImage2DArray:
+ case EbtIImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return HLSL_TEXTURE_2D_ARRAY_INT4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ case EbtUImage2DArray:
+ case EbtUImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return HLSL_TEXTURE_2D_ARRAY_UINT4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+ }
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return HLSL_TEXTURE_UNKNOWN;
+#endif
+ }
+}
+
+const char *TextureString(const HLSLTextureGroup textureGroup)
+{
+ switch (textureGroup)
+ {
+ case HLSL_TEXTURE_2D:
+ return "Texture2D<float4>";
+ case HLSL_TEXTURE_CUBE:
+ return "TextureCube<float4>";
+ case HLSL_TEXTURE_2D_ARRAY:
+ return "Texture2DArray<float4>";
+ case HLSL_TEXTURE_3D:
+ return "Texture3D<float4>";
+ case HLSL_TEXTURE_2D_UNORM:
+ return "Texture2D<unorm float4>";
+ case HLSL_TEXTURE_CUBE_UNORM:
+ return "TextureCube<unorm float4>";
+ case HLSL_TEXTURE_2D_ARRAY_UNORN:
+ return "Texture2DArray<unorm float4>";
+ case HLSL_TEXTURE_3D_UNORM:
+ return "Texture3D<unorm float4>";
+ case HLSL_TEXTURE_2D_SNORM:
+ return "Texture2D<snorm float4>";
+ case HLSL_TEXTURE_CUBE_SNORM:
+ return "TextureCube<snorm float4>";
+ case HLSL_TEXTURE_2D_ARRAY_SNORM:
+ return "Texture2DArray<snorm float4>";
+ case HLSL_TEXTURE_3D_SNORM:
+ return "Texture3D<snorm float4>";
+ case HLSL_TEXTURE_2D_MS:
+ return "Texture2DMS<float4>";
+ case HLSL_TEXTURE_2D_MS_ARRAY:
+ return "Texture2DMSArray<float4>";
+ case HLSL_TEXTURE_2D_INT4:
+ return "Texture2D<int4>";
+ case HLSL_TEXTURE_3D_INT4:
+ return "Texture3D<int4>";
+ case HLSL_TEXTURE_2D_ARRAY_INT4:
+ return "Texture2DArray<int4>";
+ case HLSL_TEXTURE_2D_MS_INT4:
+ return "Texture2DMS<int4>";
+ case HLSL_TEXTURE_2D_MS_ARRAY_INT4:
+ return "Texture2DMSArray<int4>";
+ case HLSL_TEXTURE_2D_UINT4:
+ return "Texture2D<uint4>";
+ case HLSL_TEXTURE_3D_UINT4:
+ return "Texture3D<uint4>";
+ case HLSL_TEXTURE_2D_ARRAY_UINT4:
+ return "Texture2DArray<uint4>";
+ case HLSL_TEXTURE_2D_MS_UINT4:
+ return "Texture2DMS<uint4>";
+ case HLSL_TEXTURE_2D_MS_ARRAY_UINT4:
+ return "Texture2DMSArray<uint4>";
+ case HLSL_TEXTURE_2D_COMPARISON:
+ return "Texture2D";
+ case HLSL_TEXTURE_CUBE_COMPARISON:
+ return "TextureCube";
+ case HLSL_TEXTURE_2D_ARRAY_COMPARISON:
+ return "Texture2DArray";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown read texture type>";
+}
+
+const char *TextureString(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
+{
+ return TextureString(TextureGroup(type, imageInternalFormat));
+}
+
+const char *TextureGroupSuffix(const HLSLTextureGroup type)
+{
+ switch (type)
+ {
+ case HLSL_TEXTURE_2D:
+ return "2D";
+ case HLSL_TEXTURE_CUBE:
+ return "Cube";
+ case HLSL_TEXTURE_2D_ARRAY:
+ return "2DArray";
+ case HLSL_TEXTURE_3D:
+ return "3D";
+ case HLSL_TEXTURE_2D_UNORM:
+ return "2D_unorm_float4_";
+ case HLSL_TEXTURE_CUBE_UNORM:
+ return "Cube_unorm_float4_";
+ case HLSL_TEXTURE_2D_ARRAY_UNORN:
+ return "2DArray_unorm_float4_";
+ case HLSL_TEXTURE_3D_UNORM:
+ return "3D_unorm_float4_";
+ case HLSL_TEXTURE_2D_SNORM:
+ return "2D_snorm_float4_";
+ case HLSL_TEXTURE_CUBE_SNORM:
+ return "Cube_snorm_float4_";
+ case HLSL_TEXTURE_2D_ARRAY_SNORM:
+ return "2DArray_snorm_float4_";
+ case HLSL_TEXTURE_3D_SNORM:
+ return "3D_snorm_float4_";
+ case HLSL_TEXTURE_2D_MS:
+ return "2DMS";
+ case HLSL_TEXTURE_2D_MS_ARRAY:
+ return "2DMSArray";
+ case HLSL_TEXTURE_2D_INT4:
+ return "2D_int4_";
+ case HLSL_TEXTURE_3D_INT4:
+ return "3D_int4_";
+ case HLSL_TEXTURE_2D_ARRAY_INT4:
+ return "2DArray_int4_";
+ case HLSL_TEXTURE_2D_MS_INT4:
+ return "2DMS_int4_";
+ case HLSL_TEXTURE_2D_MS_ARRAY_INT4:
+ return "2DMSArray_int4_";
+ case HLSL_TEXTURE_2D_UINT4:
+ return "2D_uint4_";
+ case HLSL_TEXTURE_3D_UINT4:
+ return "3D_uint4_";
+ case HLSL_TEXTURE_2D_ARRAY_UINT4:
+ return "2DArray_uint4_";
+ case HLSL_TEXTURE_2D_MS_UINT4:
+ return "2DMS_uint4_";
+ case HLSL_TEXTURE_2D_MS_ARRAY_UINT4:
+ return "2DMSArray_uint4_";
+ case HLSL_TEXTURE_2D_COMPARISON:
+ return "2D_comparison";
+ case HLSL_TEXTURE_CUBE_COMPARISON:
+ return "Cube_comparison";
+ case HLSL_TEXTURE_2D_ARRAY_COMPARISON:
+ return "2DArray_comparison";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown texture type>";
+}
+
+const char *TextureGroupSuffix(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat)
+{
+ return TextureGroupSuffix(TextureGroup(type, imageInternalFormat));
+}
+
+const char *TextureTypeSuffix(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
+{
+ switch (type)
+ {
+ case EbtISamplerCube:
+ return "Cube_int4_";
+ case EbtUSamplerCube:
+ return "Cube_uint4_";
+ case EbtSamplerExternalOES:
+ return "_External";
+ case EbtImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return "Cube_float4_";
+ case EiifRGBA8:
+ return "Cube_unorm_float4_";
+ case EiifRGBA8_SNORM:
+ return "Cube_snorm_float4_";
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtIImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return "Cube_int4_";
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtUImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return "Cube_uint4_";
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ default:
+ // All other types are identified by their group suffix
+ return TextureGroupSuffix(type, imageInternalFormat);
+ }
+#if !UNREACHABLE_IS_NORETURN
+ UNREACHABLE();
+ return "_TTS_invalid_";
+#endif
+}
+
+HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat)
+
+{
+ switch (type)
+ {
+ case EbtImage2D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return HLSL_RWTEXTURE_2D_FLOAT4;
+ case EiifRGBA8:
+ return HLSL_RWTEXTURE_2D_UNORM;
+ case EiifRGBA8_SNORM:
+ return HLSL_RWTEXTURE_2D_SNORM;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtIImage2D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return HLSL_RWTEXTURE_2D_INT4;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtUImage2D:
+ {
+ switch (imageInternalFormat)
+ {
+
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return HLSL_RWTEXTURE_2D_UINT4;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtImage3D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return HLSL_RWTEXTURE_3D_FLOAT4;
+ case EiifRGBA8:
+ return HLSL_RWTEXTURE_3D_UNORM;
+ case EiifRGBA8_SNORM:
+ return HLSL_RWTEXTURE_3D_SNORM;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtIImage3D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return HLSL_RWTEXTURE_3D_INT4;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtUImage3D:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return HLSL_RWTEXTURE_3D_UINT4;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtImage2DArray:
+ case EbtImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return HLSL_RWTEXTURE_2D_ARRAY_FLOAT4;
+ case EiifRGBA8:
+ return HLSL_RWTEXTURE_2D_ARRAY_UNORN;
+ case EiifRGBA8_SNORM:
+ return HLSL_RWTEXTURE_2D_ARRAY_SNORM;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtIImage2DArray:
+ case EbtIImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return HLSL_RWTEXTURE_2D_ARRAY_INT4;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtUImage2DArray:
+ case EbtUImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return HLSL_RWTEXTURE_2D_ARRAY_UINT4;
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ default:
+ UNREACHABLE();
+ }
+ return HLSL_RWTEXTURE_UNKNOWN;
+}
+
+const char *RWTextureString(const HLSLRWTextureGroup RWTextureGroup)
+{
+ switch (RWTextureGroup)
+ {
+ case HLSL_RWTEXTURE_2D_FLOAT4:
+ return "RWTexture2D<float4>";
+ case HLSL_RWTEXTURE_2D_ARRAY_FLOAT4:
+ return "RWTexture2DArray<float4>";
+ case HLSL_RWTEXTURE_3D_FLOAT4:
+ return "RWTexture3D<float4>";
+ case HLSL_RWTEXTURE_2D_UNORM:
+ return "RWTexture2D<unorm float4>";
+ case HLSL_RWTEXTURE_2D_ARRAY_UNORN:
+ return "RWTexture2DArray<unorm float4>";
+ case HLSL_RWTEXTURE_3D_UNORM:
+ return "RWTexture3D<unorm float4>";
+ case HLSL_RWTEXTURE_2D_SNORM:
+ return "RWTexture2D<snorm float4>";
+ case HLSL_RWTEXTURE_2D_ARRAY_SNORM:
+ return "RWTexture2DArray<snorm float4>";
+ case HLSL_RWTEXTURE_3D_SNORM:
+ return "RWTexture3D<snorm float4>";
+ case HLSL_RWTEXTURE_2D_UINT4:
+ return "RWTexture2D<uint4>";
+ case HLSL_RWTEXTURE_2D_ARRAY_UINT4:
+ return "RWTexture2DArray<uint4>";
+ case HLSL_RWTEXTURE_3D_UINT4:
+ return "RWTexture3D<uint4>";
+ case HLSL_RWTEXTURE_2D_INT4:
+ return "RWTexture2D<int4>";
+ case HLSL_RWTEXTURE_2D_ARRAY_INT4:
+ return "RWTexture2DArray<int4>";
+ case HLSL_RWTEXTURE_3D_INT4:
+ return "RWTexture3D<int4>";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown read and write texture type>";
+}
+
+const char *RWTextureString(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat)
+{
+ return RWTextureString(RWTextureGroup(type, imageInternalFormat));
+}
+
+const char *RWTextureGroupSuffix(const HLSLRWTextureGroup type)
+{
+ switch (type)
+ {
+ case HLSL_RWTEXTURE_2D_FLOAT4:
+ return "RW2D_float4_";
+ case HLSL_RWTEXTURE_2D_ARRAY_FLOAT4:
+ return "RW2DArray_float4_";
+ case HLSL_RWTEXTURE_3D_FLOAT4:
+ return "RW3D_float4_";
+ case HLSL_RWTEXTURE_2D_UNORM:
+ return "RW2D_unorm_float4_";
+ case HLSL_RWTEXTURE_2D_ARRAY_UNORN:
+ return "RW2DArray_unorm_float4_";
+ case HLSL_RWTEXTURE_3D_UNORM:
+ return "RW3D_unorm_float4_";
+ case HLSL_RWTEXTURE_2D_SNORM:
+ return "RW2D_snorm_float4_";
+ case HLSL_RWTEXTURE_2D_ARRAY_SNORM:
+ return "RW2DArray_snorm_float4_";
+ case HLSL_RWTEXTURE_3D_SNORM:
+ return "RW3D_snorm_float4_";
+ case HLSL_RWTEXTURE_2D_UINT4:
+ return "RW2D_uint4_";
+ case HLSL_RWTEXTURE_2D_ARRAY_UINT4:
+ return "RW2DArray_uint4_";
+ case HLSL_RWTEXTURE_3D_UINT4:
+ return "RW3D_uint4_";
+ case HLSL_RWTEXTURE_2D_INT4:
+ return "RW2D_int4_";
+ case HLSL_RWTEXTURE_2D_ARRAY_INT4:
+ return "RW2DArray_int4_";
+ case HLSL_RWTEXTURE_3D_INT4:
+ return "RW3D_int4_";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown read and write resource>";
+}
+
+const char *RWTextureGroupSuffix(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat)
+{
+ return RWTextureGroupSuffix(RWTextureGroup(type, imageInternalFormat));
+}
+
+const char *RWTextureTypeSuffix(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat)
+{
+ switch (type)
+ {
+ case EbtImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32F:
+ case EiifRGBA16F:
+ case EiifR32F:
+ return "RWCube_float4_";
+ case EiifRGBA8:
+ return "RWCube_unorm_float4_";
+ case EiifRGBA8_SNORM:
+ return "RWCube_unorm_float4_";
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtIImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32I:
+ case EiifRGBA16I:
+ case EiifRGBA8I:
+ case EiifR32I:
+ return "RWCube_int4_";
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ case EbtUImageCube:
+ {
+ switch (imageInternalFormat)
+ {
+ case EiifRGBA32UI:
+ case EiifRGBA16UI:
+ case EiifRGBA8UI:
+ case EiifR32UI:
+ return "RWCube_uint4_";
+ default:
+ UNREACHABLE();
+ }
+#if !UNREACHABLE_IS_NORETURN
+ break;
+#endif
+ }
+ default:
+ // All other types are identified by their group suffix
+ return RWTextureGroupSuffix(type, imageInternalFormat);
+ }
+#if !UNREACHABLE_IS_NORETURN
+ UNREACHABLE();
+ return "_RWTS_invalid_";
+#endif
+}
+
+TString DecorateField(const ImmutableString &string, const TStructure &structure)
+{
+ if (structure.symbolType() != SymbolType::BuiltIn)
+ {
+ return Decorate(string);
+ }
+
+ return TString(string.data());
+}
+
+TString DecoratePrivate(const ImmutableString &privateText)
+{
+ return "dx_" + TString(privateText.data());
+}
+
+TString Decorate(const ImmutableString &string)
+{
+ if (!string.beginsWith("gl_"))
+ {
+ return "_" + TString(string.data());
+ }
+
+ return TString(string.data());
+}
+
+TString DecorateVariableIfNeeded(const TVariable &variable)
+{
+ if (variable.symbolType() == SymbolType::AngleInternal ||
+ variable.symbolType() == SymbolType::Empty)
+ {
+ // Besides handling internal variables, we generate names for nameless parameters here.
+ const ImmutableString &name = variable.name();
+ // The name should not have a prefix reserved for user-defined variables or functions.
+ ASSERT(!name.beginsWith("f_"));
+ ASSERT(!name.beginsWith("_"));
+ return TString(name.data());
+ }
+ // For user defined variables, combine variable name with unique id
+ // so variables of the same name in different scopes do not get overwritten.
+ else if (variable.symbolType() == SymbolType::UserDefined &&
+ variable.getType().getQualifier() == EvqTemporary)
+ {
+ return Decorate(variable.name()) + str(variable.uniqueId().get());
+ }
+ else
+ {
+ return Decorate(variable.name());
+ }
+}
+
+TString DecorateFunctionIfNeeded(const TFunction *func)
+{
+ if (func->symbolType() == SymbolType::AngleInternal)
+ {
+ // The name should not have a prefix reserved for user-defined variables or functions.
+ ASSERT(!func->name().beginsWith("f_"));
+ ASSERT(!func->name().beginsWith("_"));
+ return TString(func->name().data());
+ }
+ ASSERT(!func->name().beginsWith("gl_"));
+ // Add an additional f prefix to functions so that they're always disambiguated from variables.
+ // This is necessary in the corner case where a variable declaration hides a function that it
+ // uses in its initializer.
+ return "f_" + TString(func->name().data());
+}
+
+TString TypeString(const TType &type)
+{
+ const TStructure *structure = type.getStruct();
+ if (structure)
+ {
+ if (structure->symbolType() != SymbolType::Empty)
+ {
+ return StructNameString(*structure);
+ }
+ else // Nameless structure, define in place
+ {
+ return StructureHLSL::defineNameless(*structure);
+ }
+ }
+ else if (type.isMatrix())
+ {
+ int cols = type.getCols();
+ int rows = type.getRows();
+ return "float" + str(cols) + "x" + str(rows);
+ }
+ else
+ {
+ switch (type.getBasicType())
+ {
+ case EbtFloat:
+ switch (type.getNominalSize())
+ {
+ case 1:
+ return "float";
+ case 2:
+ return "float2";
+ case 3:
+ return "float3";
+ case 4:
+ return "float4";
+ }
+ case EbtInt:
+ switch (type.getNominalSize())
+ {
+ case 1:
+ return "int";
+ case 2:
+ return "int2";
+ case 3:
+ return "int3";
+ case 4:
+ return "int4";
+ }
+ case EbtUInt:
+ switch (type.getNominalSize())
+ {
+ case 1:
+ return "uint";
+ case 2:
+ return "uint2";
+ case 3:
+ return "uint3";
+ case 4:
+ return "uint4";
+ }
+ case EbtBool:
+ switch (type.getNominalSize())
+ {
+ case 1:
+ return "bool";
+ case 2:
+ return "bool2";
+ case 3:
+ return "bool3";
+ case 4:
+ return "bool4";
+ }
+ case EbtVoid:
+ return "void";
+ case EbtSampler2D:
+ case EbtISampler2D:
+ case EbtUSampler2D:
+ case EbtSampler2DArray:
+ case EbtISampler2DArray:
+ case EbtUSampler2DArray:
+ return "sampler2D";
+ case EbtSamplerCube:
+ case EbtISamplerCube:
+ case EbtUSamplerCube:
+ return "samplerCUBE";
+ case EbtSamplerExternalOES:
+ return "sampler2D";
+ case EbtAtomicCounter:
+ // Multiple atomic_uints will be implemented as a single RWByteAddressBuffer
+ return "RWByteAddressBuffer";
+ default:
+ break;
+ }
+ }
+
+ UNREACHABLE();
+ return "<unknown type>";
+}
+
+TString StructNameString(const TStructure &structure)
+{
+ if (structure.symbolType() == SymbolType::Empty)
+ {
+ return "";
+ }
+
+ // For structures at global scope we use a consistent
+ // translation so that we can link between shader stages.
+ if (structure.atGlobalScope())
+ {
+ return Decorate(structure.name());
+ }
+
+ return "ss" + str(structure.uniqueId().get()) + "_" + TString(structure.name().data());
+}
+
+TString QualifiedStructNameString(const TStructure &structure,
+ bool useHLSLRowMajorPacking,
+ bool useStd140Packing)
+{
+ if (structure.symbolType() == SymbolType::Empty)
+ {
+ 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)
+ {
+ prefix += "rm_";
+ }
+
+ return prefix + StructNameString(structure);
+}
+
+const char *InterpolationString(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqVaryingIn:
+ return "";
+ case EvqFragmentIn:
+ return "";
+ case EvqSmoothIn:
+ return "linear";
+ case EvqFlatIn:
+ return "nointerpolation";
+ case EvqCentroidIn:
+ return "centroid";
+ case EvqVaryingOut:
+ return "";
+ case EvqVertexOut:
+ return "";
+ case EvqSmoothOut:
+ return "linear";
+ case EvqFlatOut:
+ return "nointerpolation";
+ case EvqCentroidOut:
+ return "centroid";
+ default:
+ UNREACHABLE();
+ }
+
+ return "";
+}
+
+const char *QualifierString(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqIn:
+ return "in";
+ case EvqOut:
+ return "inout"; // 'out' results in an HLSL error if not all fields are written, for
+ // GLSL it's undefined
+ case EvqInOut:
+ return "inout";
+ case EvqConstReadOnly:
+ return "const";
+ default:
+ UNREACHABLE();
+ }
+
+ return "";
+}
+
+TString DisambiguateFunctionName(const TFunction *func)
+{
+ TString disambiguatingString;
+ size_t paramCount = func->getParamCount();
+ for (size_t i = 0; i < paramCount; ++i)
+ {
+ DisambiguateFunctionNameForParameterType(func->getParam(i)->getType(),
+ &disambiguatingString);
+ }
+ return disambiguatingString;
+}
+
+TString DisambiguateFunctionName(const TIntermSequence *args)
+{
+ TString disambiguatingString;
+ for (TIntermNode *arg : *args)
+ {
+ ASSERT(arg->getAsTyped());
+ DisambiguateFunctionNameForParameterType(arg->getAsTyped()->getType(),
+ &disambiguatingString);
+ }
+ return disambiguatingString;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h
new file mode 100644
index 0000000000..ebd7ab3dc0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h
@@ -0,0 +1,135 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// UtilsHLSL.h:
+// Utility methods for GLSL to HLSL translation.
+//
+
+#ifndef COMPILER_TRANSLATOR_UTILSHLSL_H_
+#define COMPILER_TRANSLATOR_UTILSHLSL_H_
+
+#include <vector>
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/Types.h"
+
+#include "angle_gl.h"
+
+namespace sh
+{
+
+class TFunction;
+
+// HLSL Texture type for GLSL sampler type and readonly image type.
+enum HLSLTextureGroup
+{
+ // read resources
+ HLSL_TEXTURE_2D,
+ HLSL_TEXTURE_MIN = HLSL_TEXTURE_2D,
+
+ HLSL_TEXTURE_CUBE,
+ HLSL_TEXTURE_2D_ARRAY,
+ HLSL_TEXTURE_3D,
+ HLSL_TEXTURE_2D_UNORM,
+ HLSL_TEXTURE_CUBE_UNORM,
+ HLSL_TEXTURE_2D_ARRAY_UNORN,
+ HLSL_TEXTURE_3D_UNORM,
+ HLSL_TEXTURE_2D_SNORM,
+ HLSL_TEXTURE_CUBE_SNORM,
+ HLSL_TEXTURE_2D_ARRAY_SNORM,
+ HLSL_TEXTURE_3D_SNORM,
+ HLSL_TEXTURE_2D_MS,
+ HLSL_TEXTURE_2D_MS_ARRAY,
+ HLSL_TEXTURE_2D_INT4,
+ HLSL_TEXTURE_3D_INT4,
+ HLSL_TEXTURE_2D_ARRAY_INT4,
+ HLSL_TEXTURE_2D_MS_INT4,
+ HLSL_TEXTURE_2D_MS_ARRAY_INT4,
+ HLSL_TEXTURE_2D_UINT4,
+ HLSL_TEXTURE_3D_UINT4,
+ HLSL_TEXTURE_2D_ARRAY_UINT4,
+ HLSL_TEXTURE_2D_MS_UINT4,
+ HLSL_TEXTURE_2D_MS_ARRAY_UINT4,
+
+ // Comparison samplers
+
+ HLSL_TEXTURE_2D_COMPARISON,
+ HLSL_TEXTURE_CUBE_COMPARISON,
+ HLSL_TEXTURE_2D_ARRAY_COMPARISON,
+
+ HLSL_COMPARISON_SAMPLER_GROUP_BEGIN = HLSL_TEXTURE_2D_COMPARISON,
+ HLSL_COMPARISON_SAMPLER_GROUP_END = HLSL_TEXTURE_2D_ARRAY_COMPARISON,
+
+ HLSL_TEXTURE_UNKNOWN,
+ HLSL_TEXTURE_MAX = HLSL_TEXTURE_UNKNOWN
+};
+
+// HLSL RWTexture type for GLSL read and write image type.
+enum HLSLRWTextureGroup
+{
+ // read/write resource
+ HLSL_RWTEXTURE_2D_FLOAT4,
+ HLSL_RWTEXTURE_MIN = HLSL_RWTEXTURE_2D_FLOAT4,
+ HLSL_RWTEXTURE_2D_ARRAY_FLOAT4,
+ HLSL_RWTEXTURE_3D_FLOAT4,
+ HLSL_RWTEXTURE_2D_UNORM,
+ HLSL_RWTEXTURE_2D_ARRAY_UNORN,
+ HLSL_RWTEXTURE_3D_UNORM,
+ HLSL_RWTEXTURE_2D_SNORM,
+ HLSL_RWTEXTURE_2D_ARRAY_SNORM,
+ HLSL_RWTEXTURE_3D_SNORM,
+ HLSL_RWTEXTURE_2D_UINT4,
+ HLSL_RWTEXTURE_2D_ARRAY_UINT4,
+ HLSL_RWTEXTURE_3D_UINT4,
+ HLSL_RWTEXTURE_2D_INT4,
+ HLSL_RWTEXTURE_2D_ARRAY_INT4,
+ HLSL_RWTEXTURE_3D_INT4,
+
+ HLSL_RWTEXTURE_UNKNOWN,
+ HLSL_RWTEXTURE_MAX = HLSL_RWTEXTURE_UNKNOWN
+};
+
+HLSLTextureGroup TextureGroup(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified);
+const char *TextureString(const HLSLTextureGroup textureGroup);
+const char *TextureString(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified);
+const char *TextureGroupSuffix(const HLSLTextureGroup type);
+const char *TextureGroupSuffix(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified);
+const char *TextureTypeSuffix(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat = EiifUnspecified);
+HLSLRWTextureGroup RWTextureGroup(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat);
+const char *RWTextureString(const HLSLRWTextureGroup textureGroup);
+const char *RWTextureString(const TBasicType type, TLayoutImageInternalFormat imageInternalFormat);
+const char *RWTextureGroupSuffix(const HLSLRWTextureGroup type);
+const char *RWTextureGroupSuffix(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat);
+const char *RWTextureTypeSuffix(const TBasicType type,
+ TLayoutImageInternalFormat imageInternalFormat);
+
+const char *SamplerString(const TBasicType type);
+const char *SamplerString(HLSLTextureGroup type);
+
+// Adds a prefix to user-defined names to avoid naming clashes.
+TString Decorate(const ImmutableString &string);
+TString DecorateVariableIfNeeded(const TVariable &variable);
+TString DecorateFunctionIfNeeded(const TFunction *func);
+TString DecorateField(const ImmutableString &string, const TStructure &structure);
+TString DecoratePrivate(const ImmutableString &privateText);
+TString TypeString(const TType &type);
+TString StructNameString(const TStructure &structure);
+TString QualifiedStructNameString(const TStructure &structure,
+ bool useHLSLRowMajorPacking,
+ bool useStd140Packing);
+const char *InterpolationString(TQualifier qualifier);
+const char *QualifierString(TQualifier qualifier);
+// Parameters may need to be included in function names to disambiguate between overloaded
+// functions.
+TString DisambiguateFunctionName(const TFunction *func);
+TString DisambiguateFunctionName(const TIntermSequence *args);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_UTILSHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateAST.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateAST.cpp
new file mode 100644
index 0000000000..c0ec114741
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateAST.cpp
@@ -0,0 +1,251 @@
+//
+// Copyright 2019 The ANGLE Project 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/ValidateAST.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class ValidateAST : public TIntermTraverser
+{
+ public:
+ static bool validate(TIntermNode *root,
+ TDiagnostics *diagnostics,
+ const ValidateASTOptions &options);
+
+ void visitSymbol(TIntermSymbol *node) override;
+ void visitConstantUnion(TIntermConstantUnion *node) override;
+ bool visitSwizzle(Visit visit, TIntermSwizzle *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override;
+ bool visitSwitch(Visit visit, TIntermSwitch *node) override;
+ bool visitCase(Visit visit, TIntermCase *node) override;
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitBlock(Visit visit, TIntermBlock *node) override;
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override;
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+ bool visitLoop(Visit visit, TIntermLoop *node) override;
+ bool visitBranch(Visit visit, TIntermBranch *node) override;
+ void visitPreprocessorDirective(TIntermPreprocessorDirective *node) override;
+
+ private:
+ ValidateAST(TIntermNode *root, TDiagnostics *diagnostics, const ValidateASTOptions &options);
+
+ // Visit as a generic node
+ void visitNode(Visit visit, TIntermNode *node);
+
+ void expectNonNullChildren(Visit visit, TIntermNode *node, size_t least_count);
+
+ bool validateInternal();
+
+ ValidateASTOptions mOptions;
+ TDiagnostics *mDiagnostics;
+
+ // For validateSingleParent:
+ std::map<TIntermNode *, TIntermNode *> mParent;
+ bool mSingleParentFailed = false;
+
+ // For validateNullNodes
+ bool mNullNodesFailed = false;
+};
+
+bool ValidateAST::validate(TIntermNode *root,
+ TDiagnostics *diagnostics,
+ const ValidateASTOptions &options)
+{
+ ValidateAST validate(root, diagnostics, options);
+ root->traverse(&validate);
+ return validate.validateInternal();
+}
+
+ValidateAST::ValidateAST(TIntermNode *root,
+ TDiagnostics *diagnostics,
+ const ValidateASTOptions &options)
+ : TIntermTraverser(true, false, true, nullptr), mOptions(options), mDiagnostics(diagnostics)
+{
+ if (mOptions.validateSingleParent)
+ {
+ mParent[root] = nullptr;
+ }
+}
+
+void ValidateAST::visitNode(Visit visit, TIntermNode *node)
+{
+ if (visit == PreVisit && mOptions.validateSingleParent)
+ {
+ size_t childCount = node->getChildCount();
+ for (size_t i = 0; i < childCount; ++i)
+ {
+ TIntermNode *child = node->getChildNode(i);
+ if (mParent.find(child) != mParent.end())
+ {
+ // If child is visited twice but through the same parent, the problem is in one of
+ // the ancestors.
+ if (mParent[child] != node)
+ {
+ mDiagnostics->error(node->getLine(), "Found child with two parents",
+ "<validateSingleParent>");
+ mSingleParentFailed = true;
+ }
+ }
+
+ mParent[child] = node;
+ }
+ }
+}
+
+void ValidateAST::expectNonNullChildren(Visit visit, TIntermNode *node, size_t least_count)
+{
+ if (visit == PreVisit && mOptions.validateNullNodes)
+ {
+ size_t childCount = node->getChildCount();
+ if (childCount < least_count)
+ {
+ mDiagnostics->error(node->getLine(), "Too few children", "<validateNullNodes>");
+ mNullNodesFailed = true;
+ }
+
+ for (size_t i = 0; i < childCount; ++i)
+ {
+ if (node->getChildNode(i) == nullptr)
+ {
+ mDiagnostics->error(node->getLine(), "Found nullptr child", "<validateNullNodes>");
+ mNullNodesFailed = true;
+ }
+ }
+ }
+}
+
+void ValidateAST::visitSymbol(TIntermSymbol *node)
+{
+ visitNode(PreVisit, node);
+}
+
+void ValidateAST::visitConstantUnion(TIntermConstantUnion *node)
+{
+ visitNode(PreVisit, node);
+}
+
+bool ValidateAST::visitSwizzle(Visit visit, TIntermSwizzle *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitBinary(Visit visit, TIntermBinary *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitUnary(Visit visit, TIntermUnary *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitTernary(Visit visit, TIntermTernary *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitIfElse(Visit visit, TIntermIfElse *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitSwitch(Visit visit, TIntermSwitch *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitCase(Visit visit, TIntermCase *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+void ValidateAST::visitFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ visitNode(PreVisit, node);
+}
+
+bool ValidateAST::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ visitNode(visit, node);
+ expectNonNullChildren(visit, node, 0);
+ return true;
+}
+
+bool ValidateAST::visitBlock(Visit visit, TIntermBlock *node)
+{
+ visitNode(visit, node);
+ expectNonNullChildren(visit, node, 0);
+ return true;
+}
+
+bool ValidateAST::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ visitNode(visit, node);
+ expectNonNullChildren(visit, node, 0);
+ return true;
+}
+
+bool ValidateAST::visitLoop(Visit visit, TIntermLoop *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+bool ValidateAST::visitBranch(Visit visit, TIntermBranch *node)
+{
+ visitNode(visit, node);
+ return true;
+}
+
+void ValidateAST::visitPreprocessorDirective(TIntermPreprocessorDirective *node)
+{
+ visitNode(PreVisit, node);
+}
+
+bool ValidateAST::validateInternal()
+{
+ return !mSingleParentFailed && !mNullNodesFailed;
+}
+
+} // anonymous namespace
+
+bool ValidateAST(TIntermNode *root, TDiagnostics *diagnostics, const ValidateASTOptions &options)
+{
+ return ValidateAST::validate(root, diagnostics, options);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateAST.h b/gfx/angle/checkout/src/compiler/translator/ValidateAST.h
new file mode 100644
index 0000000000..7314f6e653
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateAST.h
@@ -0,0 +1,58 @@
+//
+// Copyright 2019 The ANGLE Project 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_VALIDATEAST_H_
+#define COMPILER_TRANSLATOR_VALIDATEAST_H_
+
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+
+namespace sh
+{
+class TDiagnostics;
+class TIntermNode;
+
+// The following options (stored in Compiler) tell the validator what to validate. Some validations
+// are conditional to certain passes.
+struct ValidateASTOptions
+{
+ // TODO: add support for the flags marked with TODO. http://anglebug.com/2733
+
+ // Check that every node always has only one parent,
+ bool validateSingleParent = true;
+ // Check that all EOpCallFunctionInAST have their corresponding function definitions in the AST,
+ // with matching symbol ids. There should also be at least a prototype declaration before the
+ // function is called.
+ bool validateFunctionCall = true; // TODO
+ // Check that there are no null nodes where they are not allowed, for example as children of
+ // TIntermDeclaration or TIntermBlock.
+ bool validateNullNodes = true;
+ // Check that symbols that reference variables have consistent qualifiers and symbol ids with
+ // the variable declaration. For example, references to function out parameters should be
+ // EvqOut.
+ bool validateQualifiers = true; // TODO
+ // Check that variable declarations that can't have initializers don't have initializers
+ // (varyings, uniforms for example).
+ bool validateInitializers = true; // TODO
+ // Check that there is only one TFunction with each function name referenced in the nodes (no
+ // two TFunctions with the same name, taking internal/non-internal namespaces into account).
+ bool validateUniqueFunctions = true; // TODO
+ // Check that references to user-defined structs are matched with the corresponding struct
+ // declaration.
+ bool validateStructUsage = true; // TODO
+ // Check that expression nodes have the correct type considering their operand(s).
+ bool validateExpressionTypes = true; // TODO
+ // If SeparateDeclarations has been run, check for the absence of multi declarations as well.
+ bool validateMultiDeclarations = false; // TODO
+};
+
+// Check for errors and output error messages on the context.
+// Returns true if there are no errors.
+bool ValidateAST(TIntermNode *root, TDiagnostics *diagnostics, const ValidateASTOptions &options);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VALIDATESWITCH_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp
new file mode 100644
index 0000000000..4ffb832d99
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp
@@ -0,0 +1,141 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/ValidateGlobalInitializer.h"
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+const int kMaxAllowedTraversalDepth = 256;
+
+class ValidateGlobalInitializerTraverser : public TIntermTraverser
+{
+ public:
+ ValidateGlobalInitializerTraverser(int shaderVersion);
+
+ void visitSymbol(TIntermSymbol *node) override;
+ void visitConstantUnion(TIntermConstantUnion *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+
+ bool isValid() const { return mIsValid && mMaxDepth < mMaxAllowedDepth; }
+ bool issueWarning() const { return mIssueWarning; }
+
+ private:
+ int mShaderVersion;
+ bool mIsValid;
+ bool mIssueWarning;
+};
+
+void ValidateGlobalInitializerTraverser::visitSymbol(TIntermSymbol *node)
+{
+ // ESSL 1.00 section 4.3 (or ESSL 3.00 section 4.3):
+ // Global initializers must be constant expressions.
+ switch (node->getType().getQualifier())
+ {
+ case EvqConst:
+ break;
+ case EvqGlobal:
+ case EvqTemporary:
+ case EvqUniform:
+ // We allow these cases to be compatible with legacy ESSL 1.00 content.
+ // Implement stricter rules for ESSL 3.00 since there's no legacy content to deal
+ // with.
+ if (mShaderVersion >= 300)
+ {
+ mIsValid = false;
+ }
+ else
+ {
+ mIssueWarning = true;
+ }
+ break;
+ default:
+ mIsValid = false;
+ }
+}
+
+void ValidateGlobalInitializerTraverser::visitConstantUnion(TIntermConstantUnion *node)
+{
+ // Constant unions that are not constant expressions may result from folding a ternary
+ // expression.
+ switch (node->getType().getQualifier())
+ {
+ case EvqConst:
+ break;
+ case EvqTemporary:
+ if (mShaderVersion >= 300)
+ {
+ mIsValid = false;
+ }
+ else
+ {
+ mIssueWarning = true;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+bool ValidateGlobalInitializerTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ // Disallow calls to user-defined functions and texture lookup functions in global variable
+ // initializers.
+ // This is done simply by disabling all function calls - built-in math functions don't use
+ // the function call ops.
+ if (node->isFunctionCall())
+ {
+ mIsValid = false;
+ }
+ return true;
+}
+
+bool ValidateGlobalInitializerTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ if (node->isAssignment())
+ {
+ mIsValid = false;
+ }
+ return true;
+}
+
+bool ValidateGlobalInitializerTraverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ if (node->isAssignment())
+ {
+ mIsValid = false;
+ }
+ return true;
+}
+
+ValidateGlobalInitializerTraverser::ValidateGlobalInitializerTraverser(int shaderVersion)
+ : TIntermTraverser(true, false, false, nullptr),
+ mShaderVersion(shaderVersion),
+ mIsValid(true),
+ mIssueWarning(false)
+{
+ setMaxAllowedDepth(kMaxAllowedTraversalDepth);
+}
+
+} // namespace
+
+bool ValidateGlobalInitializer(TIntermTyped *initializer, int shaderVersion, bool *warning)
+{
+ ValidateGlobalInitializerTraverser validate(shaderVersion);
+ initializer->traverse(&validate);
+ ASSERT(warning != nullptr);
+ *warning = validate.issueWarning();
+ return validate.isValid();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.h b/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.h
new file mode 100644
index 0000000000..b830760ca4
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.h
@@ -0,0 +1,20 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_
+#define COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_
+
+namespace sh
+{
+
+class TIntermTyped;
+
+// Returns true if the initializer is valid.
+bool ValidateGlobalInitializer(TIntermTyped *initializer, int shaderVersion, bool *warning);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VALIDATEGLOBALINITIALIZER_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp
new file mode 100644
index 0000000000..ac8d5c14ed
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp
@@ -0,0 +1,442 @@
+//
+// 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.
+//
+
+#include "compiler/translator/ValidateLimitations.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+int GetLoopSymbolId(TIntermLoop *loop)
+{
+ // Here we assume all the operations are valid, because the loop node is
+ // already validated before this call.
+ TIntermSequence *declSeq = loop->getInit()->getAsDeclarationNode()->getSequence();
+ TIntermBinary *declInit = (*declSeq)[0]->getAsBinaryNode();
+ TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
+
+ return symbol->uniqueId().get();
+}
+
+// Traverses a node to check if it represents a constant index expression.
+// Definition:
+// constant-index-expressions are a superset of constant-expressions.
+// Constant-index-expressions can include loop indices as defined in
+// GLSL ES 1.0 spec, Appendix A, section 4.
+// The following are constant-index-expressions:
+// - Constant expressions
+// - Loop indices as defined in section 4
+// - Expressions composed of both of the above
+class ValidateConstIndexExpr : public TIntermTraverser
+{
+ public:
+ ValidateConstIndexExpr(const std::vector<int> &loopSymbols)
+ : TIntermTraverser(true, false, false), mValid(true), mLoopSymbolIds(loopSymbols)
+ {}
+
+ // Returns true if the parsed node represents a constant index expression.
+ bool isValid() const { return mValid; }
+
+ void visitSymbol(TIntermSymbol *symbol) override
+ {
+ // Only constants and loop indices are allowed in a
+ // constant index expression.
+ if (mValid)
+ {
+ bool isLoopSymbol = std::find(mLoopSymbolIds.begin(), mLoopSymbolIds.end(),
+ symbol->uniqueId().get()) != mLoopSymbolIds.end();
+ mValid = (symbol->getQualifier() == EvqConst) || isLoopSymbol;
+ }
+ }
+
+ private:
+ bool mValid;
+ const std::vector<int> mLoopSymbolIds;
+};
+
+// Traverses intermediate tree to ensure that the shader does not exceed the
+// minimum functionality mandated in GLSL 1.0 spec, Appendix A.
+class ValidateLimitationsTraverser : public TLValueTrackingTraverser
+{
+ public:
+ ValidateLimitationsTraverser(sh::GLenum shaderType,
+ TSymbolTable *symbolTable,
+ TDiagnostics *diagnostics);
+
+ void visitSymbol(TIntermSymbol *node) override;
+ bool visitBinary(Visit, TIntermBinary *) override;
+ bool visitLoop(Visit, TIntermLoop *) override;
+
+ private:
+ void error(TSourceLoc loc, const char *reason, const char *token);
+ void error(TSourceLoc loc, const char *reason, const ImmutableString &token);
+
+ 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);
+
+ // Returns true if indexing does not exceed the minimum functionality
+ // mandated in GLSL 1.0 spec, Appendix A, Section 5.
+ bool isConstExpr(TIntermNode *node);
+ bool isConstIndexExpr(TIntermNode *node);
+ bool validateIndexing(TIntermBinary *node);
+
+ sh::GLenum mShaderType;
+ TDiagnostics *mDiagnostics;
+ std::vector<int> mLoopSymbolIds;
+};
+
+ValidateLimitationsTraverser::ValidateLimitationsTraverser(sh::GLenum shaderType,
+ TSymbolTable *symbolTable,
+ TDiagnostics *diagnostics)
+ : TLValueTrackingTraverser(true, false, false, symbolTable),
+ mShaderType(shaderType),
+ mDiagnostics(diagnostics)
+{
+ ASSERT(diagnostics);
+}
+
+void ValidateLimitationsTraverser::visitSymbol(TIntermSymbol *node)
+{
+ if (isLoopIndex(node) && isLValueRequiredHere())
+ {
+ error(node->getLine(),
+ "Loop index cannot be statically assigned to within the body of the loop",
+ node->getName());
+ }
+}
+
+bool ValidateLimitationsTraverser::visitBinary(Visit, TIntermBinary *node)
+{
+ // Check indexing.
+ switch (node->getOp())
+ {
+ case EOpIndexDirect:
+ case EOpIndexIndirect:
+ validateIndexing(node);
+ break;
+ default:
+ break;
+ }
+ return true;
+}
+
+bool ValidateLimitationsTraverser::visitLoop(Visit, TIntermLoop *node)
+{
+ if (!validateLoopType(node))
+ return false;
+
+ if (!validateForLoopHeader(node))
+ return false;
+
+ TIntermNode *body = node->getBody();
+ if (body != nullptr)
+ {
+ mLoopSymbolIds.push_back(GetLoopSymbolId(node));
+ body->traverse(this);
+ mLoopSymbolIds.pop_back();
+ }
+
+ // The loop is fully processed - no need to visit children.
+ return false;
+}
+
+void ValidateLimitationsTraverser::error(TSourceLoc loc, const char *reason, const char *token)
+{
+ mDiagnostics->error(loc, reason, token);
+}
+
+void ValidateLimitationsTraverser::error(TSourceLoc loc,
+ const char *reason,
+ const ImmutableString &token)
+{
+ error(loc, reason, token.data());
+}
+
+bool ValidateLimitationsTraverser::isLoopIndex(TIntermSymbol *symbol)
+{
+ return std::find(mLoopSymbolIds.begin(), mLoopSymbolIds.end(), symbol->uniqueId().get()) !=
+ mLoopSymbolIds.end();
+}
+
+bool ValidateLimitationsTraverser::validateLoopType(TIntermLoop *node)
+{
+ TLoopType type = node->getType();
+ if (type == ELoopFor)
+ return true;
+
+ // Reject while and do-while loops.
+ error(node->getLine(), "This type of loop is not allowed", type == ELoopWhile ? "while" : "do");
+ return false;
+}
+
+bool ValidateLimitationsTraverser::validateForLoopHeader(TIntermLoop *node)
+{
+ ASSERT(node->getType() == ELoopFor);
+
+ //
+ // The for statement has the form:
+ // for ( init-declaration ; condition ; expression ) statement
+ //
+ int indexSymbolId = validateForLoopInit(node);
+ if (indexSymbolId < 0)
+ return false;
+ if (!validateForLoopCond(node, indexSymbolId))
+ return false;
+ if (!validateForLoopExpr(node, indexSymbolId))
+ return false;
+
+ return true;
+}
+
+int ValidateLimitationsTraverser::validateForLoopInit(TIntermLoop *node)
+{
+ TIntermNode *init = node->getInit();
+ if (init == nullptr)
+ {
+ error(node->getLine(), "Missing init declaration", "for");
+ return -1;
+ }
+
+ //
+ // init-declaration has the form:
+ // type-specifier identifier = constant-expression
+ //
+ TIntermDeclaration *decl = init->getAsDeclarationNode();
+ if (decl == nullptr)
+ {
+ error(init->getLine(), "Invalid init declaration", "for");
+ return -1;
+ }
+ // To keep things simple do not allow declaration list.
+ TIntermSequence *declSeq = decl->getSequence();
+ if (declSeq->size() != 1)
+ {
+ error(decl->getLine(), "Invalid init declaration", "for");
+ return -1;
+ }
+ TIntermBinary *declInit = (*declSeq)[0]->getAsBinaryNode();
+ if ((declInit == nullptr) || (declInit->getOp() != EOpInitialize))
+ {
+ error(decl->getLine(), "Invalid init declaration", "for");
+ return -1;
+ }
+ TIntermSymbol *symbol = declInit->getLeft()->getAsSymbolNode();
+ if (symbol == nullptr)
+ {
+ error(declInit->getLine(), "Invalid init declaration", "for");
+ return -1;
+ }
+ // The loop index has type int or float.
+ TBasicType type = symbol->getBasicType();
+ if ((type != EbtInt) && (type != EbtUInt) && (type != EbtFloat))
+ {
+ error(symbol->getLine(), "Invalid type for loop index", getBasicString(type));
+ return -1;
+ }
+ // The loop index is initialized with constant expression.
+ if (!isConstExpr(declInit->getRight()))
+ {
+ error(declInit->getLine(), "Loop index cannot be initialized with non-constant expression",
+ symbol->getName());
+ return -1;
+ }
+
+ return symbol->uniqueId().get();
+}
+
+bool ValidateLimitationsTraverser::validateForLoopCond(TIntermLoop *node, int indexSymbolId)
+{
+ TIntermNode *cond = node->getCondition();
+ if (cond == nullptr)
+ {
+ error(node->getLine(), "Missing condition", "for");
+ return false;
+ }
+ //
+ // condition has the form:
+ // loop_index relational_operator constant_expression
+ //
+ TIntermBinary *binOp = cond->getAsBinaryNode();
+ if (binOp == nullptr)
+ {
+ error(node->getLine(), "Invalid condition", "for");
+ return false;
+ }
+ // Loop index should be to the left of relational operator.
+ TIntermSymbol *symbol = binOp->getLeft()->getAsSymbolNode();
+ if (symbol == nullptr)
+ {
+ error(binOp->getLine(), "Invalid condition", "for");
+ return false;
+ }
+ if (symbol->uniqueId().get() != indexSymbolId)
+ {
+ error(symbol->getLine(), "Expected loop index", symbol->getName());
+ return false;
+ }
+ // Relational operator is one of: > >= < <= == or !=.
+ switch (binOp->getOp())
+ {
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ break;
+ default:
+ error(binOp->getLine(), "Invalid relational operator",
+ GetOperatorString(binOp->getOp()));
+ break;
+ }
+ // Loop index must be compared with a constant.
+ if (!isConstExpr(binOp->getRight()))
+ {
+ error(binOp->getLine(), "Loop index cannot be compared with non-constant expression",
+ symbol->getName());
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLimitationsTraverser::validateForLoopExpr(TIntermLoop *node, int indexSymbolId)
+{
+ TIntermNode *expr = node->getExpression();
+ if (expr == nullptr)
+ {
+ error(node->getLine(), "Missing expression", "for");
+ return false;
+ }
+
+ // 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 ? nullptr : expr->getAsBinaryNode();
+
+ TOperator op = EOpNull;
+ TIntermSymbol *symbol = nullptr;
+ if (unOp != nullptr)
+ {
+ op = unOp->getOp();
+ symbol = unOp->getOperand()->getAsSymbolNode();
+ }
+ else if (binOp != nullptr)
+ {
+ op = binOp->getOp();
+ symbol = binOp->getLeft()->getAsSymbolNode();
+ }
+
+ // The operand must be loop index.
+ if (symbol == nullptr)
+ {
+ error(expr->getLine(), "Invalid expression", "for");
+ return false;
+ }
+ if (symbol->uniqueId().get() != indexSymbolId)
+ {
+ error(symbol->getLine(), "Expected loop index", symbol->getName());
+ return false;
+ }
+
+ // The operator is one of: ++ -- += -=.
+ switch (op)
+ {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ ASSERT((unOp != nullptr) && (binOp == nullptr));
+ break;
+ case EOpAddAssign:
+ case EOpSubAssign:
+ ASSERT((unOp == nullptr) && (binOp != nullptr));
+ break;
+ default:
+ error(expr->getLine(), "Invalid operator", GetOperatorString(op));
+ return false;
+ }
+
+ // Loop index must be incremented/decremented with a constant.
+ if (binOp != nullptr)
+ {
+ if (!isConstExpr(binOp->getRight()))
+ {
+ error(binOp->getLine(), "Loop index cannot be modified by non-constant expression",
+ symbol->getName());
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateLimitationsTraverser::isConstExpr(TIntermNode *node)
+{
+ ASSERT(node != nullptr);
+ return node->getAsConstantUnion() != nullptr && node->getAsTyped()->getQualifier() == EvqConst;
+}
+
+bool ValidateLimitationsTraverser::isConstIndexExpr(TIntermNode *node)
+{
+ ASSERT(node != nullptr);
+
+ ValidateConstIndexExpr validate(mLoopSymbolIds);
+ node->traverse(&validate);
+ return validate.isValid();
+}
+
+bool ValidateLimitationsTraverser::validateIndexing(TIntermBinary *node)
+{
+ ASSERT((node->getOp() == EOpIndexDirect) || (node->getOp() == EOpIndexIndirect));
+
+ bool valid = true;
+ TIntermTyped *index = node->getRight();
+ // The index expession must be a constant-index-expression unless
+ // the operand is a uniform in a vertex shader.
+ TIntermTyped *operand = node->getLeft();
+ bool skip = (mShaderType == GL_VERTEX_SHADER) && (operand->getQualifier() == EvqUniform);
+ if (!skip && !isConstIndexExpr(index))
+ {
+ error(index->getLine(), "Index expression must be constant", "[]");
+ valid = false;
+ }
+ return valid;
+}
+
+} // namespace
+
+bool ValidateLimitations(TIntermNode *root,
+ GLenum shaderType,
+ TSymbolTable *symbolTable,
+ TDiagnostics *diagnostics)
+{
+ ValidateLimitationsTraverser validate(shaderType, symbolTable, diagnostics);
+ root->traverse(&validate);
+ return diagnostics->numErrors() == 0;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.h b/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.h
new file mode 100644
index 0000000000..d219ed680a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.h
@@ -0,0 +1,26 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_VALIDATELIMITATIONS_H_
+#define COMPILER_TRANSLATOR_VALIDATELIMITATIONS_H_
+
+#include "compiler/translator/IntermNode.h"
+
+namespace sh
+{
+
+class TDiagnostics;
+
+// Returns true if the given shader does not exceed the minimum functionality mandated in GLSL ES
+// 1.00 spec Appendix A.
+bool ValidateLimitations(TIntermNode *root,
+ GLenum shaderType,
+ TSymbolTable *symbolTable,
+ TDiagnostics *diagnostics);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VALIDATELIMITATIONS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp
new file mode 100644
index 0000000000..a06babd3bd
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp
@@ -0,0 +1,30 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ValidateMaxParameters checks if function definitions have more than a set number of parameters.
+
+#include "compiler/translator/ValidateMaxParameters.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/Symbol.h"
+
+namespace sh
+{
+
+bool ValidateMaxParameters(TIntermBlock *root, unsigned int maxParameters)
+{
+ for (TIntermNode *node : *root->getSequence())
+ {
+ TIntermFunctionDefinition *definition = node->getAsFunctionDefinition();
+ if (definition != nullptr &&
+ definition->getFunctionPrototype()->getFunction()->getParamCount() > maxParameters)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.h b/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.h
new file mode 100644
index 0000000000..dec7597da4
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.h
@@ -0,0 +1,21 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ValidateMaxParameters checks if function definitions have more than a set number of parameters.
+
+#ifndef COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_
+#define COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+
+// Return true if valid.
+bool ValidateMaxParameters(TIntermBlock *root, unsigned int maxParameters);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VALIDATEMAXPARAMETERS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp
new file mode 100644
index 0000000000..98802554d6
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp
@@ -0,0 +1,184 @@
+//
+// 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.
+//
+// ValidateOutputs validates fragment shader outputs. It checks for conflicting locations,
+// out-of-range locations, that locations are specified when using multiple outputs, and YUV output
+// validity.
+
+#include "compiler/translator/ValidateOutputs.h"
+
+#include <set>
+
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void error(const TIntermSymbol &symbol, const char *reason, TDiagnostics *diagnostics)
+{
+ diagnostics->error(symbol.getLine(), reason, symbol.getName().data());
+}
+
+class ValidateOutputsTraverser : public TIntermTraverser
+{
+ public:
+ ValidateOutputsTraverser(const TExtensionBehavior &extBehavior, int maxDrawBuffers);
+
+ void validate(TDiagnostics *diagnostics) const;
+
+ void visitSymbol(TIntermSymbol *) override;
+
+ private:
+ int mMaxDrawBuffers;
+ bool mAllowUnspecifiedOutputLocationResolution;
+ bool mUsesFragDepth;
+
+ typedef std::vector<TIntermSymbol *> OutputVector;
+ OutputVector mOutputs;
+ OutputVector mUnspecifiedLocationOutputs;
+ OutputVector mYuvOutputs;
+ std::set<int> mVisitedSymbols; // Visited symbol ids.
+};
+
+ValidateOutputsTraverser::ValidateOutputsTraverser(const TExtensionBehavior &extBehavior,
+ int maxDrawBuffers)
+ : TIntermTraverser(true, false, false),
+ mMaxDrawBuffers(maxDrawBuffers),
+ mAllowUnspecifiedOutputLocationResolution(
+ IsExtensionEnabled(extBehavior, TExtension::EXT_blend_func_extended)),
+ mUsesFragDepth(false)
+{}
+
+void ValidateOutputsTraverser::visitSymbol(TIntermSymbol *symbol)
+{
+ if (symbol->variable().symbolType() == SymbolType::Empty)
+ return;
+
+ if (mVisitedSymbols.count(symbol->uniqueId().get()) == 1)
+ return;
+
+ mVisitedSymbols.insert(symbol->uniqueId().get());
+
+ TQualifier qualifier = symbol->getQualifier();
+ if (qualifier == EvqFragmentOut)
+ {
+ if (symbol->getType().getLayoutQualifier().location != -1)
+ {
+ mOutputs.push_back(symbol);
+ }
+ else if (symbol->getType().getLayoutQualifier().yuv == true)
+ {
+ mYuvOutputs.push_back(symbol);
+ }
+ else
+ {
+ mUnspecifiedLocationOutputs.push_back(symbol);
+ }
+ }
+ else if (qualifier == EvqFragDepth || qualifier == EvqFragDepthEXT)
+ {
+ mUsesFragDepth = true;
+ }
+}
+
+void ValidateOutputsTraverser::validate(TDiagnostics *diagnostics) const
+{
+ ASSERT(diagnostics);
+ OutputVector validOutputs(mMaxDrawBuffers, nullptr);
+ OutputVector validSecondaryOutputs(mMaxDrawBuffers, nullptr);
+
+ for (const auto &symbol : mOutputs)
+ {
+ const TType &type = symbol->getType();
+ ASSERT(!type.isArrayOfArrays()); // Disallowed in GLSL ES 3.10 section 4.3.6.
+ const size_t elementCount =
+ static_cast<size_t>(type.isArray() ? type.getOutermostArraySize() : 1u);
+ const size_t location = static_cast<size_t>(type.getLayoutQualifier().location);
+
+ ASSERT(type.getLayoutQualifier().location != -1);
+
+ OutputVector *validOutputsToUse = &validOutputs;
+ // The default index is 0, so we only assign the output to secondary outputs in case the
+ // index is explicitly set to 1.
+ if (type.getLayoutQualifier().index == 1)
+ {
+ validOutputsToUse = &validSecondaryOutputs;
+ }
+
+ if (location + elementCount <= validOutputsToUse->size())
+ {
+ for (size_t elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ const size_t offsetLocation = location + elementIndex;
+ if ((*validOutputsToUse)[offsetLocation])
+ {
+ std::stringstream strstr = sh::InitializeStream<std::stringstream>();
+ strstr << "conflicting output locations with previously defined output '"
+ << (*validOutputsToUse)[offsetLocation]->getName() << "'";
+ error(*symbol, strstr.str().c_str(), diagnostics);
+ }
+ else
+ {
+ (*validOutputsToUse)[offsetLocation] = symbol;
+ }
+ }
+ }
+ else
+ {
+ if (elementCount > 0)
+ {
+ error(*symbol,
+ elementCount > 1 ? "output array locations would exceed MAX_DRAW_BUFFERS"
+ : "output location must be < MAX_DRAW_BUFFERS",
+ diagnostics);
+ }
+ }
+ }
+
+ if (!mAllowUnspecifiedOutputLocationResolution &&
+ ((!mOutputs.empty() && !mUnspecifiedLocationOutputs.empty()) ||
+ mUnspecifiedLocationOutputs.size() > 1))
+ {
+ for (const auto &symbol : mUnspecifiedLocationOutputs)
+ {
+ error(*symbol,
+ "must explicitly specify all locations when using multiple fragment outputs",
+ diagnostics);
+ }
+ }
+
+ if (!mYuvOutputs.empty() && (mYuvOutputs.size() > 1 || mUsesFragDepth || !mOutputs.empty() ||
+ !mUnspecifiedLocationOutputs.empty()))
+ {
+ for (const auto &symbol : mYuvOutputs)
+ {
+ error(*symbol,
+ "not allowed to specify yuv qualifier when using depth or multiple color "
+ "fragment outputs",
+ diagnostics);
+ }
+ }
+}
+
+} // anonymous namespace
+
+bool ValidateOutputs(TIntermBlock *root,
+ const TExtensionBehavior &extBehavior,
+ int maxDrawBuffers,
+ TDiagnostics *diagnostics)
+{
+ ValidateOutputsTraverser validateOutputs(extBehavior, maxDrawBuffers);
+ root->traverse(&validateOutputs);
+ int numErrorsBefore = diagnostics->numErrors();
+ validateOutputs.validate(diagnostics);
+ return (diagnostics->numErrors() == numErrorsBefore);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.h b/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.h
new file mode 100644
index 0000000000..e41ccd990c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.h
@@ -0,0 +1,30 @@
+//
+// 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.
+//
+// ValidateOutputs validates fragment shader outputs. It checks for conflicting locations,
+// out-of-range locations, that locations are specified when using multiple outputs, and YUV output
+// validity.
+//
+
+#ifndef COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_
+#define COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_
+
+#include "compiler/translator/ExtensionBehavior.h"
+
+namespace sh
+{
+
+class TIntermBlock;
+class TDiagnostics;
+
+// Returns true if the shader has no conflicting or otherwise erroneous fragment outputs.
+bool ValidateOutputs(TIntermBlock *root,
+ const TExtensionBehavior &extBehavior,
+ int maxDrawBuffers,
+ TDiagnostics *diagnostics);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp
new file mode 100644
index 0000000000..37c33a867c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp
@@ -0,0 +1,315 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/ValidateSwitch.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+const int kMaxAllowedTraversalDepth = 256;
+
+class ValidateSwitch : public TIntermTraverser
+{
+ public:
+ static bool validate(TBasicType switchType,
+ TDiagnostics *diagnostics,
+ TIntermBlock *statementList,
+ const TSourceLoc &loc);
+
+ void visitSymbol(TIntermSymbol *) override;
+ void visitConstantUnion(TIntermConstantUnion *) override;
+ bool visitDeclaration(Visit, TIntermDeclaration *) override;
+ bool visitBlock(Visit visit, TIntermBlock *) override;
+ bool visitBinary(Visit, TIntermBinary *) override;
+ bool visitUnary(Visit, TIntermUnary *) override;
+ bool visitTernary(Visit, TIntermTernary *) override;
+ bool visitSwizzle(Visit, TIntermSwizzle *) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *) override;
+ bool visitSwitch(Visit, TIntermSwitch *) override;
+ bool visitCase(Visit, TIntermCase *node) override;
+ bool visitAggregate(Visit, TIntermAggregate *) override;
+ bool visitLoop(Visit visit, TIntermLoop *) override;
+ bool visitBranch(Visit, TIntermBranch *) override;
+
+ private:
+ ValidateSwitch(TBasicType switchType, TDiagnostics *context);
+
+ bool validateInternal(const TSourceLoc &loc);
+
+ TBasicType mSwitchType;
+ TDiagnostics *mDiagnostics;
+ bool mCaseTypeMismatch;
+ bool mFirstCaseFound;
+ bool mStatementBeforeCase;
+ bool mLastStatementWasCase;
+ int mControlFlowDepth;
+ bool mCaseInsideControlFlow;
+ int mDefaultCount;
+ std::set<int> mCasesSigned;
+ std::set<unsigned int> mCasesUnsigned;
+ bool mDuplicateCases;
+};
+
+bool ValidateSwitch::validate(TBasicType switchType,
+ TDiagnostics *diagnostics,
+ TIntermBlock *statementList,
+ const TSourceLoc &loc)
+{
+ ValidateSwitch validate(switchType, diagnostics);
+ ASSERT(statementList);
+ statementList->traverse(&validate);
+ return validate.validateInternal(loc);
+}
+
+ValidateSwitch::ValidateSwitch(TBasicType switchType, TDiagnostics *diagnostics)
+ : TIntermTraverser(true, false, true, nullptr),
+ mSwitchType(switchType),
+ mDiagnostics(diagnostics),
+ mCaseTypeMismatch(false),
+ mFirstCaseFound(false),
+ mStatementBeforeCase(false),
+ mLastStatementWasCase(false),
+ mControlFlowDepth(0),
+ mCaseInsideControlFlow(false),
+ mDefaultCount(0),
+ mDuplicateCases(false)
+{
+ setMaxAllowedDepth(kMaxAllowedTraversalDepth);
+}
+
+void ValidateSwitch::visitSymbol(TIntermSymbol *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+}
+
+void ValidateSwitch::visitConstantUnion(TIntermConstantUnion *)
+{
+ // Conditions of case labels are not traversed, so this is some other constant
+ // Could be just a statement like "0;"
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+}
+
+bool ValidateSwitch::visitDeclaration(Visit, TIntermDeclaration *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::visitBlock(Visit visit, TIntermBlock *)
+{
+ if (getParentNode() != nullptr)
+ {
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ if (visit == PreVisit)
+ ++mControlFlowDepth;
+ if (visit == PostVisit)
+ --mControlFlowDepth;
+ }
+ return true;
+}
+
+bool ValidateSwitch::visitBinary(Visit, TIntermBinary *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::visitUnary(Visit, TIntermUnary *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::visitTernary(Visit, TIntermTernary *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::visitSwizzle(Visit, TIntermSwizzle *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::visitIfElse(Visit visit, TIntermIfElse *)
+{
+ if (visit == PreVisit)
+ ++mControlFlowDepth;
+ if (visit == PostVisit)
+ --mControlFlowDepth;
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::visitSwitch(Visit, TIntermSwitch *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ // Don't go into nested switch statements
+ return false;
+}
+
+bool ValidateSwitch::visitCase(Visit, TIntermCase *node)
+{
+ const char *nodeStr = node->hasCondition() ? "case" : "default";
+ if (mControlFlowDepth > 0)
+ {
+ mDiagnostics->error(node->getLine(), "label statement nested inside control flow", nodeStr);
+ mCaseInsideControlFlow = true;
+ }
+ mFirstCaseFound = true;
+ mLastStatementWasCase = true;
+ if (!node->hasCondition())
+ {
+ ++mDefaultCount;
+ if (mDefaultCount > 1)
+ {
+ mDiagnostics->error(node->getLine(), "duplicate default label", nodeStr);
+ }
+ }
+ else
+ {
+ TIntermConstantUnion *condition = node->getCondition()->getAsConstantUnion();
+ if (condition == nullptr)
+ {
+ // This can happen in error cases.
+ return false;
+ }
+ TBasicType conditionType = condition->getBasicType();
+ if (conditionType != mSwitchType)
+ {
+ mDiagnostics->error(condition->getLine(),
+ "case label type does not match switch init-expression type",
+ nodeStr);
+ mCaseTypeMismatch = true;
+ }
+
+ if (conditionType == EbtInt)
+ {
+ int iConst = condition->getIConst(0);
+ if (mCasesSigned.find(iConst) != mCasesSigned.end())
+ {
+ mDiagnostics->error(condition->getLine(), "duplicate case label", nodeStr);
+ mDuplicateCases = true;
+ }
+ else
+ {
+ mCasesSigned.insert(iConst);
+ }
+ }
+ else if (conditionType == EbtUInt)
+ {
+ unsigned int uConst = condition->getUConst(0);
+ if (mCasesUnsigned.find(uConst) != mCasesUnsigned.end())
+ {
+ mDiagnostics->error(condition->getLine(), "duplicate case label", nodeStr);
+ mDuplicateCases = true;
+ }
+ else
+ {
+ mCasesUnsigned.insert(uConst);
+ }
+ }
+ // Other types are possible only in error cases, where the error has already been generated
+ // when parsing the case statement.
+ }
+ // Don't traverse the condition of the case statement
+ return false;
+}
+
+bool ValidateSwitch::visitAggregate(Visit visit, TIntermAggregate *)
+{
+ if (getParentNode() != nullptr)
+ {
+ // This is not the statementList node, but some other node.
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ }
+ return true;
+}
+
+bool ValidateSwitch::visitLoop(Visit visit, TIntermLoop *)
+{
+ if (visit == PreVisit)
+ ++mControlFlowDepth;
+ if (visit == PostVisit)
+ --mControlFlowDepth;
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::visitBranch(Visit, TIntermBranch *)
+{
+ if (!mFirstCaseFound)
+ mStatementBeforeCase = true;
+ mLastStatementWasCase = false;
+ return true;
+}
+
+bool ValidateSwitch::validateInternal(const TSourceLoc &loc)
+{
+ if (mStatementBeforeCase)
+ {
+ mDiagnostics->error(loc, "statement before the first label", "switch");
+ }
+ if (mLastStatementWasCase)
+ {
+ // There have been some differences between versions of GLSL ES specs on whether this should
+ // be an error or not, but as of early 2018 the latest discussion is that this is an error
+ // also on GLSL ES versions newer than 3.00.
+ mDiagnostics->error(
+ loc, "no statement between the last label and the end of the switch statement",
+ "switch");
+ }
+ if (getMaxDepth() >= kMaxAllowedTraversalDepth)
+ {
+ mDiagnostics->error(loc, "too complex expressions inside a switch statement", "switch");
+ }
+ return !mStatementBeforeCase && !mLastStatementWasCase && !mCaseInsideControlFlow &&
+ !mCaseTypeMismatch && mDefaultCount <= 1 && !mDuplicateCases &&
+ getMaxDepth() < kMaxAllowedTraversalDepth;
+}
+
+} // anonymous namespace
+
+bool ValidateSwitchStatementList(TBasicType switchType,
+ TDiagnostics *diagnostics,
+ TIntermBlock *statementList,
+ const TSourceLoc &loc)
+{
+ return ValidateSwitch::validate(switchType, diagnostics, statementList, loc);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h
new file mode 100644
index 0000000000..757820a164
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_VALIDATESWITCH_H_
+#define COMPILER_TRANSLATOR_VALIDATESWITCH_H_
+
+#include "compiler/translator/BaseTypes.h"
+#include "compiler/translator/Common.h"
+
+namespace sh
+{
+class TDiagnostics;
+class TIntermBlock;
+
+// Check for errors and output error messages on the context.
+// Returns true if there are no errors.
+bool ValidateSwitchStatementList(TBasicType switchType,
+ TDiagnostics *diagnostics,
+ TIntermBlock *statementList,
+ const TSourceLoc &loc);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VALIDATESWITCH_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp
new file mode 100644
index 0000000000..394e35c8d8
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp
@@ -0,0 +1,179 @@
+//
+// Copyright (c) 2002-2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The ValidateVaryingLocations function checks if there exists location conflicts on shader
+// varyings.
+//
+
+#include "ValidateVaryingLocations.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void error(const TIntermSymbol &symbol, const char *reason, TDiagnostics *diagnostics)
+{
+ diagnostics->error(symbol.getLine(), reason, symbol.getName().data());
+}
+
+int GetLocationCount(const TIntermSymbol *varying, bool ignoreVaryingArraySize)
+{
+ const auto &varyingType = varying->getType();
+ if (varyingType.getStruct() != nullptr)
+ {
+ ASSERT(!varyingType.isArray());
+ int totalLocation = 0;
+ for (const auto *field : varyingType.getStruct()->fields())
+ {
+ const auto *fieldType = field->type();
+ ASSERT(fieldType->getStruct() == nullptr && !fieldType->isArray());
+
+ totalLocation += fieldType->getSecondarySize();
+ }
+ return totalLocation;
+ }
+ // [GL_EXT_shader_io_blocks SPEC Chapter 4.4.1]
+ // Geometry shader inputs, tessellation control shader inputs and outputs, and tessellation
+ // evaluation inputs all have an additional level of arrayness relative to other shader inputs
+ // and outputs. This outer array level is removed from the type before considering how many
+ // locations the type consumes.
+ else if (ignoreVaryingArraySize)
+ {
+ // Array-of-arrays cannot be inputs or outputs of a geometry shader.
+ // (GL_EXT_geometry_shader SPEC issues(5))
+ ASSERT(!varyingType.isArrayOfArrays());
+ return varyingType.getSecondarySize();
+ }
+ else
+ {
+ return varyingType.getSecondarySize() * static_cast<int>(varyingType.getArraySizeProduct());
+ }
+}
+
+using VaryingVector = std::vector<const TIntermSymbol *>;
+
+void ValidateShaderInterface(TDiagnostics *diagnostics,
+ VaryingVector &varyingVector,
+ bool ignoreVaryingArraySize)
+{
+ // Location conflicts can only happen when there are two or more varyings in varyingVector.
+ if (varyingVector.size() <= 1)
+ {
+ return;
+ }
+
+ std::map<int, const TIntermSymbol *> locationMap;
+ for (const TIntermSymbol *varying : varyingVector)
+ {
+ const int location = varying->getType().getLayoutQualifier().location;
+ ASSERT(location >= 0);
+
+ const int elementCount = GetLocationCount(varying, ignoreVaryingArraySize);
+ for (int elementIndex = 0; elementIndex < elementCount; ++elementIndex)
+ {
+ const int offsetLocation = location + elementIndex;
+ if (locationMap.find(offsetLocation) != locationMap.end())
+ {
+ std::stringstream strstr = sh::InitializeStream<std::stringstream>();
+ strstr << "'" << varying->getName()
+ << "' conflicting location with previously defined '"
+ << locationMap[offsetLocation]->getName() << "'";
+ error(*varying, strstr.str().c_str(), diagnostics);
+ }
+ else
+ {
+ locationMap[offsetLocation] = varying;
+ }
+ }
+ }
+}
+
+class ValidateVaryingLocationsTraverser : public TIntermTraverser
+{
+ public:
+ ValidateVaryingLocationsTraverser(GLenum shaderType);
+ void validate(TDiagnostics *diagnostics);
+
+ private:
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
+
+ VaryingVector mInputVaryingsWithLocation;
+ VaryingVector mOutputVaryingsWithLocation;
+ GLenum mShaderType;
+};
+
+ValidateVaryingLocationsTraverser::ValidateVaryingLocationsTraverser(GLenum shaderType)
+ : TIntermTraverser(true, false, false), mShaderType(shaderType)
+{}
+
+bool ValidateVaryingLocationsTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ const TIntermSequence &sequence = *(node->getSequence());
+ ASSERT(!sequence.empty());
+
+ const TIntermSymbol *symbol = sequence.front()->getAsSymbolNode();
+ if (symbol == nullptr)
+ {
+ return false;
+ }
+
+ if (symbol->variable().symbolType() == SymbolType::Empty)
+ {
+ return false;
+ }
+
+ // Collect varyings that have explicit 'location' qualifiers.
+ const TQualifier qualifier = symbol->getQualifier();
+ if (symbol->getType().getLayoutQualifier().location != -1)
+ {
+ if (IsVaryingIn(qualifier))
+ {
+ mInputVaryingsWithLocation.push_back(symbol);
+ }
+ else if (IsVaryingOut(qualifier))
+ {
+ mOutputVaryingsWithLocation.push_back(symbol);
+ }
+ }
+
+ return false;
+}
+
+bool ValidateVaryingLocationsTraverser::visitFunctionDefinition(Visit visit,
+ TIntermFunctionDefinition *node)
+{
+ // We stop traversing function definitions because varyings cannot be defined in a function.
+ return false;
+}
+
+void ValidateVaryingLocationsTraverser::validate(TDiagnostics *diagnostics)
+{
+ ASSERT(diagnostics);
+
+ ValidateShaderInterface(diagnostics, mInputVaryingsWithLocation,
+ mShaderType == GL_GEOMETRY_SHADER_EXT);
+ ValidateShaderInterface(diagnostics, mOutputVaryingsWithLocation, false);
+}
+
+} // anonymous namespace
+
+bool ValidateVaryingLocations(TIntermBlock *root, TDiagnostics *diagnostics, GLenum shaderType)
+{
+ ValidateVaryingLocationsTraverser varyingValidator(shaderType);
+ root->traverse(&varyingValidator);
+ int numErrorsBefore = diagnostics->numErrors();
+ varyingValidator.validate(diagnostics);
+ return (diagnostics->numErrors() == numErrorsBefore);
+}
+
+} // namespace sh \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.h b/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.h
new file mode 100644
index 0000000000..1e53977c68
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.h
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2002-2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The ValidateVaryingLocations function checks if there exists location conflicts on shader
+// varyings.
+//
+
+#ifndef COMPILER_TRANSLATOR_VALIDATEVARYINGLOCATIONS_H_
+#define COMPILER_TRANSLATOR_VALIDATEVARYINGLOCATIONS_H_
+
+#include "GLSLANG/ShaderVars.h"
+
+namespace sh
+{
+
+class TIntermBlock;
+class TDiagnostics;
+
+bool ValidateVaryingLocations(TIntermBlock *root, TDiagnostics *diagnostics, GLenum shaderType);
+
+} // namespace sh
+
+#endif \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/VariablePacker.cpp b/gfx/angle/checkout/src/compiler/translator/VariablePacker.cpp
new file mode 100644
index 0000000000..123da4b35e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/VariablePacker.cpp
@@ -0,0 +1,413 @@
+//
+// 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.
+//
+// Check whether variables fit within packing limits according to the packing rules from the GLSL ES
+// 1.00.17 spec, Appendix A, section 7.
+
+#include <algorithm>
+
+#include "angle_gl.h"
+
+#include "common/utilities.h"
+#include "compiler/translator/VariablePacker.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// Expand the variable so that struct variables are split into their individual fields.
+// Will not set the mappedName or staticUse fields on the expanded variables.
+void ExpandVariable(const ShaderVariable &variable,
+ const std::string &name,
+ std::vector<ShaderVariable> *expanded);
+
+void ExpandStructVariable(const ShaderVariable &variable,
+ const std::string &name,
+ std::vector<ShaderVariable> *expanded)
+{
+ ASSERT(variable.isStruct());
+
+ const std::vector<ShaderVariable> &fields = variable.fields;
+
+ for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++)
+ {
+ const ShaderVariable &field = fields[fieldIndex];
+ ExpandVariable(field, name + "." + field.name, expanded);
+ }
+}
+
+void ExpandStructArrayVariable(const ShaderVariable &variable,
+ unsigned int arrayNestingIndex,
+ const std::string &name,
+ std::vector<ShaderVariable> *expanded)
+{
+ // Nested arrays are processed starting from outermost (arrayNestingIndex 0u) and ending at the
+ // innermost.
+ const unsigned int currentArraySize = variable.getNestedArraySize(arrayNestingIndex);
+ for (unsigned int arrayElement = 0u; arrayElement < currentArraySize; ++arrayElement)
+ {
+ const std::string elementName = name + ArrayString(arrayElement);
+ if (arrayNestingIndex + 1u < variable.arraySizes.size())
+ {
+ ExpandStructArrayVariable(variable, arrayNestingIndex + 1u, elementName, expanded);
+ }
+ else
+ {
+ ExpandStructVariable(variable, elementName, expanded);
+ }
+ }
+}
+
+void ExpandVariable(const ShaderVariable &variable,
+ const std::string &name,
+ std::vector<ShaderVariable> *expanded)
+{
+ if (variable.isStruct())
+ {
+ if (variable.isArray())
+ {
+ ExpandStructArrayVariable(variable, 0u, name, expanded);
+ }
+ else
+ {
+ ExpandStructVariable(variable, name, expanded);
+ }
+ }
+ else
+ {
+ ShaderVariable expandedVar = variable;
+ expandedVar.name = name;
+
+ expanded->push_back(expandedVar);
+ }
+}
+
+int GetVariablePackingRows(const ShaderVariable &variable)
+{
+ return GetTypePackingRows(variable.type) * variable.getArraySizeProduct();
+}
+
+class VariablePacker
+{
+ public:
+ bool checkExpandedVariablesWithinPackingLimits(unsigned int maxVectors,
+ std::vector<sh::ShaderVariable> *variables);
+
+ private:
+ static const int kNumColumns = 4;
+ static const unsigned kColumnMask = (1 << kNumColumns) - 1;
+
+ unsigned makeColumnFlags(int column, int numComponentsPerRow);
+ void fillColumns(int topRow, int numRows, int column, int numComponentsPerRow);
+ bool searchColumn(int column, int numRows, int *destRow, int *destSize);
+
+ int topNonFullRow_;
+ int bottomNonFullRow_;
+ int maxRows_;
+ std::vector<unsigned> rows_;
+};
+
+struct TVariableInfoComparer
+{
+ bool operator()(const sh::ShaderVariable &lhs, const sh::ShaderVariable &rhs) const
+ {
+ int lhsSortOrder = gl::VariableSortOrder(lhs.type);
+ int rhsSortOrder = gl::VariableSortOrder(rhs.type);
+ if (lhsSortOrder != rhsSortOrder)
+ {
+ return lhsSortOrder < rhsSortOrder;
+ }
+ // Sort by largest first.
+ return lhs.getArraySizeProduct() > rhs.getArraySizeProduct();
+ }
+};
+
+unsigned VariablePacker::makeColumnFlags(int column, int numComponentsPerRow)
+{
+ return ((kColumnMask << (kNumColumns - numComponentsPerRow)) & kColumnMask) >> column;
+}
+
+void VariablePacker::fillColumns(int topRow, int numRows, int column, int numComponentsPerRow)
+{
+ unsigned columnFlags = makeColumnFlags(column, numComponentsPerRow);
+ for (int r = 0; r < numRows; ++r)
+ {
+ int row = topRow + r;
+ ASSERT((rows_[row] & columnFlags) == 0);
+ rows_[row] |= columnFlags;
+ }
+}
+
+bool VariablePacker::searchColumn(int column, int numRows, int *destRow, int *destSize)
+{
+ ASSERT(destRow);
+
+ for (; topNonFullRow_ < maxRows_ && rows_[topNonFullRow_] == kColumnMask; ++topNonFullRow_)
+ {
+ }
+
+ for (; bottomNonFullRow_ >= 0 && rows_[bottomNonFullRow_] == kColumnMask; --bottomNonFullRow_)
+ {
+ }
+
+ if (bottomNonFullRow_ - topNonFullRow_ + 1 < numRows)
+ {
+ return false;
+ }
+
+ unsigned columnFlags = makeColumnFlags(column, 1);
+ int topGoodRow = 0;
+ int smallestGoodTop = -1;
+ int smallestGoodSize = maxRows_ + 1;
+ int bottomRow = bottomNonFullRow_ + 1;
+ bool found = false;
+ for (int row = topNonFullRow_; row <= bottomRow; ++row)
+ {
+ bool rowEmpty = row < bottomRow ? ((rows_[row] & columnFlags) == 0) : false;
+ if (rowEmpty)
+ {
+ if (!found)
+ {
+ topGoodRow = row;
+ found = true;
+ }
+ }
+ else
+ {
+ if (found)
+ {
+ int size = row - topGoodRow;
+ if (size >= numRows && size < smallestGoodSize)
+ {
+ smallestGoodSize = size;
+ smallestGoodTop = topGoodRow;
+ }
+ }
+ found = false;
+ }
+ }
+ if (smallestGoodTop < 0)
+ {
+ return false;
+ }
+
+ *destRow = smallestGoodTop;
+ if (destSize)
+ {
+ *destSize = smallestGoodSize;
+ }
+ return true;
+}
+
+bool VariablePacker::checkExpandedVariablesWithinPackingLimits(
+ unsigned int maxVectors,
+ std::vector<sh::ShaderVariable> *variables)
+{
+ ASSERT(maxVectors > 0);
+ maxRows_ = maxVectors;
+ topNonFullRow_ = 0;
+ bottomNonFullRow_ = maxRows_ - 1;
+
+ // Check whether each variable fits in the available vectors.
+ for (const sh::ShaderVariable &variable : *variables)
+ {
+ // Structs should have been expanded before reaching here.
+ ASSERT(!variable.isStruct());
+ if (variable.getArraySizeProduct() > maxVectors / GetTypePackingRows(variable.type))
+ {
+ return false;
+ }
+ }
+
+ // As per GLSL 1.017 Appendix A, Section 7 variables are packed in specific
+ // order by type, then by size of array, largest first.
+ std::sort(variables->begin(), variables->end(), TVariableInfoComparer());
+ rows_.clear();
+ rows_.resize(maxVectors, 0);
+
+ // Packs the 4 column variables.
+ size_t ii = 0;
+ for (; ii < variables->size(); ++ii)
+ {
+ const sh::ShaderVariable &variable = (*variables)[ii];
+ if (GetTypePackingComponentsPerRow(variable.type) != 4)
+ {
+ break;
+ }
+ topNonFullRow_ += GetVariablePackingRows(variable);
+ }
+
+ if (topNonFullRow_ > maxRows_)
+ {
+ return false;
+ }
+
+ // Packs the 3 column variables.
+ int num3ColumnRows = 0;
+ for (; ii < variables->size(); ++ii)
+ {
+ const sh::ShaderVariable &variable = (*variables)[ii];
+ if (GetTypePackingComponentsPerRow(variable.type) != 3)
+ {
+ break;
+ }
+ num3ColumnRows += GetVariablePackingRows(variable);
+ }
+
+ if (topNonFullRow_ + num3ColumnRows > maxRows_)
+ {
+ return false;
+ }
+
+ fillColumns(topNonFullRow_, num3ColumnRows, 0, 3);
+
+ // Packs the 2 column variables.
+ int top2ColumnRow = topNonFullRow_ + num3ColumnRows;
+ int twoColumnRowsAvailable = maxRows_ - top2ColumnRow;
+ int rowsAvailableInColumns01 = twoColumnRowsAvailable;
+ int rowsAvailableInColumns23 = twoColumnRowsAvailable;
+ for (; ii < variables->size(); ++ii)
+ {
+ const sh::ShaderVariable &variable = (*variables)[ii];
+ if (GetTypePackingComponentsPerRow(variable.type) != 2)
+ {
+ break;
+ }
+ int numRows = GetVariablePackingRows(variable);
+ if (numRows <= rowsAvailableInColumns01)
+ {
+ rowsAvailableInColumns01 -= numRows;
+ }
+ else if (numRows <= rowsAvailableInColumns23)
+ {
+ rowsAvailableInColumns23 -= numRows;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ int numRowsUsedInColumns01 = twoColumnRowsAvailable - rowsAvailableInColumns01;
+ int numRowsUsedInColumns23 = twoColumnRowsAvailable - rowsAvailableInColumns23;
+ fillColumns(top2ColumnRow, numRowsUsedInColumns01, 0, 2);
+ fillColumns(maxRows_ - numRowsUsedInColumns23, numRowsUsedInColumns23, 2, 2);
+
+ // Packs the 1 column variables.
+ for (; ii < variables->size(); ++ii)
+ {
+ const sh::ShaderVariable &variable = (*variables)[ii];
+ ASSERT(1 == GetTypePackingComponentsPerRow(variable.type));
+ int numRows = GetVariablePackingRows(variable);
+ int smallestColumn = -1;
+ int smallestSize = maxRows_ + 1;
+ int topRow = -1;
+ for (int column = 0; column < kNumColumns; ++column)
+ {
+ int row = 0;
+ int size = 0;
+ if (searchColumn(column, numRows, &row, &size))
+ {
+ if (size < smallestSize)
+ {
+ smallestSize = size;
+ smallestColumn = column;
+ topRow = row;
+ }
+ }
+ }
+
+ if (smallestColumn < 0)
+ {
+ return false;
+ }
+
+ fillColumns(topRow, numRows, smallestColumn, 1);
+ }
+
+ ASSERT(variables->size() == ii);
+
+ return true;
+}
+
+} // anonymous namespace
+
+int GetTypePackingComponentsPerRow(sh::GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x2:
+ case GL_FLOAT_MAT4x3:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
+ case GL_UNSIGNED_INT_VEC4:
+ return 4;
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ case GL_FLOAT_VEC3:
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
+ case GL_UNSIGNED_INT_VEC3:
+ return 3;
+ case GL_FLOAT_VEC2:
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
+ case GL_UNSIGNED_INT_VEC2:
+ return 2;
+ default:
+ ASSERT(gl::VariableComponentCount(type) == 1);
+ return 1;
+ }
+}
+
+int GetTypePackingRows(sh::GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT_MAT4:
+ case GL_FLOAT_MAT2x4:
+ case GL_FLOAT_MAT3x4:
+ case GL_FLOAT_MAT4x3:
+ case GL_FLOAT_MAT4x2:
+ return 4;
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT2x3:
+ case GL_FLOAT_MAT3x2:
+ return 3;
+ case GL_FLOAT_MAT2:
+ return 2;
+ default:
+ ASSERT(gl::VariableRowCount(type) == 1);
+ return 1;
+ }
+}
+
+template <typename T>
+bool CheckVariablesInPackingLimits(unsigned int maxVectors, const std::vector<T> &variables)
+{
+ VariablePacker packer;
+ std::vector<sh::ShaderVariable> expandedVariables;
+ for (const ShaderVariable &variable : variables)
+ {
+ ExpandVariable(variable, variable.name, &expandedVariables);
+ }
+ return packer.checkExpandedVariablesWithinPackingLimits(maxVectors, &expandedVariables);
+}
+
+template bool CheckVariablesInPackingLimits<ShaderVariable>(
+ unsigned int maxVectors,
+ const std::vector<ShaderVariable> &variables);
+template bool CheckVariablesInPackingLimits<Uniform>(unsigned int maxVectors,
+ const std::vector<Uniform> &variables);
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/VariablePacker.h b/gfx/angle/checkout/src/compiler/translator/VariablePacker.h
new file mode 100644
index 0000000000..36b2104cd0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/VariablePacker.h
@@ -0,0 +1,32 @@
+//
+// 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.
+//
+// Check whether variables fit within packing limits according to the packing rules from the GLSL ES
+// 1.00.17 spec, Appendix A, section 7.
+
+#ifndef COMPILER_TRANSLATOR_VARIABLEPACKER_H_
+#define COMPILER_TRANSLATOR_VARIABLEPACKER_H_
+
+#include <vector>
+
+#include <GLSLANG/ShaderLang.h>
+
+namespace sh
+{
+
+// Gets how many components in a row a data type takes.
+int GetTypePackingComponentsPerRow(sh::GLenum type);
+
+// Gets how many rows a data type takes.
+int GetTypePackingRows(sh::GLenum type);
+
+// Returns true if the passed in variables pack in maxVectors.
+// T should be ShaderVariable or one of the subclasses of ShaderVariable.
+template <typename T>
+bool CheckVariablesInPackingLimits(unsigned int maxVectors, const std::vector<T> &variables);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VARIABLEPACKER_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp
new file mode 100644
index 0000000000..eb431c3117
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp
@@ -0,0 +1,149 @@
+//
+// 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/VersionGLSL.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/Symbol.h"
+
+namespace sh
+{
+
+namespace
+{
+constexpr const ImmutableString kGlPointCoordString("gl_PointCoord");
+} // anonymous namespace
+
+int ShaderOutputTypeToGLSLVersion(ShShaderOutput output)
+{
+ switch (output)
+ {
+ case SH_GLSL_130_OUTPUT:
+ return GLSL_VERSION_130;
+ case SH_GLSL_140_OUTPUT:
+ return GLSL_VERSION_140;
+ case SH_GLSL_150_CORE_OUTPUT:
+ return GLSL_VERSION_150;
+ case SH_GLSL_330_CORE_OUTPUT:
+ return GLSL_VERSION_330;
+ case SH_GLSL_400_CORE_OUTPUT:
+ return GLSL_VERSION_400;
+ case SH_GLSL_410_CORE_OUTPUT:
+ return GLSL_VERSION_410;
+ case SH_GLSL_420_CORE_OUTPUT:
+ return GLSL_VERSION_420;
+ case SH_GLSL_430_CORE_OUTPUT:
+ return GLSL_VERSION_430;
+ case SH_GLSL_440_CORE_OUTPUT:
+ return GLSL_VERSION_440;
+ case SH_GLSL_450_CORE_OUTPUT:
+ return GLSL_VERSION_450;
+ case SH_GLSL_COMPATIBILITY_OUTPUT:
+ return GLSL_VERSION_110;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+// We need to scan for the following:
+// 1. "invariant" keyword: This can occur in both - vertex and fragment shaders
+// but only at the global scope.
+// 2. "gl_PointCoord" built-in variable: This can only occur in fragment shader
+// but inside any scope.
+// 3. Call to a matrix constructor with another matrix as argument.
+// (These constructors were reserved in GLSL version 1.10.)
+// 4. Arrays as "out" function parameters.
+// GLSL spec section 6.1.1: "When calling a function, expressions that do
+// not evaluate to l-values cannot be passed to parameters declared as
+// out or inout."
+// GLSL 1.1 section 5.8: "Other binary or unary expressions,
+// non-dereferenced arrays, function names, swizzles with repeated fields,
+// and constants cannot be l-values."
+// GLSL 1.2 relaxed the restriction on arrays, section 5.8: "Variables that
+// are built-in types, entire structures or arrays... are all l-values."
+//
+TVersionGLSL::TVersionGLSL(sh::GLenum type, const TPragma &pragma, ShShaderOutput output)
+ : TIntermTraverser(true, false, false)
+{
+ mVersion = ShaderOutputTypeToGLSLVersion(output);
+ if (pragma.stdgl.invariantAll)
+ {
+ ensureVersionIsAtLeast(GLSL_VERSION_120);
+ }
+ if (type == GL_COMPUTE_SHADER)
+ {
+ ensureVersionIsAtLeast(GLSL_VERSION_430);
+ }
+}
+
+void TVersionGLSL::visitSymbol(TIntermSymbol *node)
+{
+ if (node->variable().symbolType() == SymbolType::BuiltIn &&
+ node->getName() == kGlPointCoordString)
+ {
+ ensureVersionIsAtLeast(GLSL_VERSION_120);
+ }
+}
+
+bool TVersionGLSL::visitDeclaration(Visit, TIntermDeclaration *node)
+{
+ const TIntermSequence &sequence = *(node->getSequence());
+ if (sequence.front()->getAsTyped()->getType().isInvariant())
+ {
+ ensureVersionIsAtLeast(GLSL_VERSION_120);
+ }
+ return true;
+}
+
+bool TVersionGLSL::visitInvariantDeclaration(Visit, TIntermInvariantDeclaration *node)
+{
+ ensureVersionIsAtLeast(GLSL_VERSION_120);
+ return true;
+}
+
+void TVersionGLSL::visitFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ size_t paramCount = node->getFunction()->getParamCount();
+ for (size_t i = 0; i < paramCount; ++i)
+ {
+ const TVariable *param = node->getFunction()->getParam(i);
+ const TType &type = param->getType();
+ if (type.isArray())
+ {
+ TQualifier qualifier = type.getQualifier();
+ if ((qualifier == EvqOut) || (qualifier == EvqInOut))
+ {
+ ensureVersionIsAtLeast(GLSL_VERSION_120);
+ break;
+ }
+ }
+ }
+}
+
+bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node)
+{
+ if (node->getOp() == EOpConstruct && node->getType().isMatrix())
+ {
+ const TIntermSequence &sequence = *(node->getSequence());
+ if (sequence.size() == 1)
+ {
+ TIntermTyped *typed = sequence.front()->getAsTyped();
+ if (typed && typed->isMatrix())
+ {
+ ensureVersionIsAtLeast(GLSL_VERSION_120);
+ }
+ }
+ }
+ return true;
+}
+
+void TVersionGLSL::ensureVersionIsAtLeast(int version)
+{
+ mVersion = std::max(version, mVersion);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/VersionGLSL.h b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.h
new file mode 100644
index 0000000000..f05da966f4
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.h
@@ -0,0 +1,76 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_VERSIONGLSL_H_
+#define COMPILER_TRANSLATOR_VERSIONGLSL_H_
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+#include "compiler/translator/Pragma.h"
+
+namespace sh
+{
+
+static const int GLSL_VERSION_110 = 110;
+static const int GLSL_VERSION_120 = 120;
+static const int GLSL_VERSION_130 = 130;
+static const int GLSL_VERSION_140 = 140;
+static const int GLSL_VERSION_150 = 150;
+static const int GLSL_VERSION_330 = 330;
+static const int GLSL_VERSION_400 = 400;
+static const int GLSL_VERSION_410 = 410;
+static const int GLSL_VERSION_420 = 420;
+static const int GLSL_VERSION_430 = 430;
+static const int GLSL_VERSION_440 = 440;
+static const int GLSL_VERSION_450 = 450;
+
+int ShaderOutputTypeToGLSLVersion(ShShaderOutput output);
+
+// Traverses the intermediate tree to return the minimum GLSL version
+// required to legally access all built-in features used in the shader.
+// GLSL 1.1 which is mandated by OpenGL 2.0 provides:
+// - #version and #extension to declare version and extensions.
+// - built-in functions refract, exp, and log.
+// - updated step() to compare x < edge instead of x <= edge.
+// GLSL 1.2 which is mandated by OpenGL 2.1 provides:
+// - many changes to reduce differences when compared to the ES specification.
+// - invariant keyword and its support.
+// - c++ style name hiding rules.
+// - built-in variable gl_PointCoord for fragment shaders.
+// - matrix constructors taking matrix as argument.
+// - array as "out" function parameters
+//
+// TODO: ES3 equivalent versions of GLSL
+class TVersionGLSL : public TIntermTraverser
+{
+ public:
+ TVersionGLSL(sh::GLenum type, const TPragma &pragma, ShShaderOutput output);
+
+ // If output is core profile, returns 150.
+ // If output is legacy profile,
+ // Returns 120 if the following is used the shader:
+ // - "invariant",
+ // - "gl_PointCoord",
+ // - matrix/matrix constructors
+ // - array "out" parameters
+ // Else 110 is returned.
+ int getVersion() const { return mVersion; }
+
+ void visitSymbol(TIntermSymbol *node) override;
+ bool visitAggregate(Visit, TIntermAggregate *node) override;
+ bool visitInvariantDeclaration(Visit, TIntermInvariantDeclaration *node) override;
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
+ bool visitDeclaration(Visit, TIntermDeclaration *node) override;
+
+ private:
+ void ensureVersionIsAtLeast(int version);
+
+ int mVersion;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_VERSIONGLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/blocklayout.cpp b/gfx/angle/checkout/src/compiler/translator/blocklayout.cpp
new file mode 100644
index 0000000000..7d0609ec82
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/blocklayout.cpp
@@ -0,0 +1,606 @@
+//
+// 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 "compiler/translator/blocklayout.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "compiler/translator/Common.h"
+
+namespace sh
+{
+
+namespace
+{
+class BlockLayoutMapVisitor : public BlockEncoderVisitor
+{
+ public:
+ BlockLayoutMapVisitor(BlockLayoutMap *blockInfoOut,
+ const std::string &instanceName,
+ BlockLayoutEncoder *encoder)
+ : BlockEncoderVisitor(instanceName, instanceName, encoder), mInfoOut(blockInfoOut)
+ {}
+
+ void encodeVariable(const ShaderVariable &variable,
+ const BlockMemberInfo &variableInfo,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ ASSERT(!gl::IsSamplerType(variable.type));
+ (*mInfoOut)[name] = variableInfo;
+ }
+
+ private:
+ BlockLayoutMap *mInfoOut;
+};
+
+template <typename VarT>
+void GetInterfaceBlockInfo(const std::vector<VarT> &fields,
+ const std::string &prefix,
+ BlockLayoutEncoder *encoder,
+ bool inRowMajorLayout,
+ BlockLayoutMap *blockInfoOut)
+{
+ BlockLayoutMapVisitor visitor(blockInfoOut, prefix, encoder);
+ TraverseShaderVariables(fields, inRowMajorLayout, &visitor);
+}
+
+void TraverseStructVariable(const ShaderVariable &variable,
+ bool isRowMajorLayout,
+ ShaderVariableVisitor *visitor)
+{
+ const std::vector<ShaderVariable> &fields = variable.fields;
+
+ visitor->enterStructAccess(variable, isRowMajorLayout);
+ TraverseShaderVariables(fields, isRowMajorLayout, visitor);
+ visitor->exitStructAccess(variable, isRowMajorLayout);
+}
+
+void TraverseStructArrayVariable(const ShaderVariable &variable,
+ bool inRowMajorLayout,
+ ShaderVariableVisitor *visitor)
+{
+ visitor->enterArray(variable);
+
+ // Nested arrays are processed starting from outermost (arrayNestingIndex 0u) and ending at the
+ // innermost. We make a special case for unsized arrays.
+ const unsigned int currentArraySize = variable.getNestedArraySize(0);
+ unsigned int count = std::max(currentArraySize, 1u);
+ for (unsigned int arrayElement = 0u; arrayElement < count; ++arrayElement)
+ {
+ visitor->enterArrayElement(variable, arrayElement);
+ ShaderVariable elementVar = variable;
+ elementVar.indexIntoArray(arrayElement);
+
+ if (variable.arraySizes.size() > 1u)
+ {
+ TraverseStructArrayVariable(elementVar, inRowMajorLayout, visitor);
+ }
+ else
+ {
+ TraverseStructVariable(elementVar, inRowMajorLayout, visitor);
+ }
+
+ visitor->exitArrayElement(variable, arrayElement);
+ }
+
+ visitor->exitArray(variable);
+}
+
+void TraverseArrayOfArraysVariable(const ShaderVariable &variable,
+ unsigned int arrayNestingIndex,
+ bool isRowMajorMatrix,
+ ShaderVariableVisitor *visitor)
+{
+ visitor->enterArray(variable);
+
+ const unsigned int currentArraySize = variable.getNestedArraySize(arrayNestingIndex);
+ unsigned int count = std::max(currentArraySize, 1u);
+ for (unsigned int arrayElement = 0u; arrayElement < count; ++arrayElement)
+ {
+ visitor->enterArrayElement(variable, arrayElement);
+
+ ShaderVariable elementVar = variable;
+ elementVar.indexIntoArray(arrayElement);
+
+ if (arrayNestingIndex + 2u < variable.arraySizes.size())
+ {
+ TraverseArrayOfArraysVariable(elementVar, arrayNestingIndex, isRowMajorMatrix, visitor);
+ }
+ else
+ {
+ if (gl::IsSamplerType(variable.type))
+ {
+ visitor->visitSampler(elementVar);
+ }
+ else
+ {
+ visitor->visitVariable(elementVar, isRowMajorMatrix);
+ }
+ }
+
+ visitor->exitArrayElement(variable, arrayElement);
+ }
+
+ visitor->exitArray(variable);
+}
+
+std::string CollapseNameStack(const std::vector<std::string> &nameStack)
+{
+ std::stringstream strstr = sh::InitializeStream<std::stringstream>();
+ for (const std::string &part : nameStack)
+ {
+ strstr << part;
+ }
+ return strstr.str();
+}
+
+size_t GetStd430BaseAlignment(GLenum variableType, bool isRowMajor)
+{
+ GLenum flippedType = isRowMajor ? variableType : gl::TransposeMatrixType(variableType);
+ size_t numComponents = static_cast<size_t>(gl::VariableColumnCount(flippedType));
+ return ComponentAlignment(numComponents);
+}
+
+class BaseAlignmentVisitor : public ShaderVariableVisitor
+{
+ public:
+ BaseAlignmentVisitor() = default;
+ void visitVariable(const ShaderVariable &variable, bool isRowMajor) override
+ {
+ size_t baseAlignment = GetStd430BaseAlignment(variable.type, isRowMajor);
+ mCurrentAlignment = std::max(mCurrentAlignment, baseAlignment);
+ }
+
+ // This is in components rather than bytes.
+ size_t getBaseAlignment() const { return mCurrentAlignment; }
+
+ private:
+ size_t mCurrentAlignment = 0;
+};
+} // anonymous namespace
+
+// BlockLayoutEncoder implementation.
+BlockLayoutEncoder::BlockLayoutEncoder() : mCurrentOffset(0) {}
+
+BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix)
+{
+ int arrayStride;
+ int matrixStride;
+
+ getBlockLayoutInfo(type, arraySizes, isRowMajorMatrix, &arrayStride, &matrixStride);
+
+ const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * kBytesPerComponent),
+ static_cast<int>(arrayStride * kBytesPerComponent),
+ static_cast<int>(matrixStride * kBytesPerComponent),
+ isRowMajorMatrix);
+
+ advanceOffset(type, arraySizes, isRowMajorMatrix, arrayStride, matrixStride);
+
+ return memberInfo;
+}
+
+size_t BlockLayoutEncoder::getShaderVariableSize(const ShaderVariable &structVar, bool isRowMajor)
+{
+ size_t currentOffset = mCurrentOffset;
+ mCurrentOffset = 0;
+ BlockEncoderVisitor visitor("", "", this);
+ enterAggregateType(structVar);
+ TraverseShaderVariables(structVar.fields, isRowMajor, &visitor);
+ exitAggregateType(structVar);
+ size_t structVarSize = getCurrentOffset();
+ mCurrentOffset = currentOffset;
+ return structVarSize;
+}
+
+// static
+size_t BlockLayoutEncoder::GetBlockRegister(const BlockMemberInfo &info)
+{
+ return (info.offset / kBytesPerComponent) / kComponentsPerRegister;
+}
+
+// static
+size_t BlockLayoutEncoder::GetBlockRegisterElement(const BlockMemberInfo &info)
+{
+ return (info.offset / kBytesPerComponent) % kComponentsPerRegister;
+}
+
+void BlockLayoutEncoder::align(size_t baseAlignment)
+{
+ mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, baseAlignment);
+}
+
+// DummyBlockEncoder implementation.
+void DummyBlockEncoder::getBlockLayoutInfo(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int *arrayStrideOut,
+ int *matrixStrideOut)
+{
+ *arrayStrideOut = 0;
+ *matrixStrideOut = 0;
+}
+
+// Std140BlockEncoder implementation.
+Std140BlockEncoder::Std140BlockEncoder() {}
+
+void Std140BlockEncoder::enterAggregateType(const ShaderVariable &structVar)
+{
+ align(getBaseAlignment(structVar));
+}
+
+void Std140BlockEncoder::exitAggregateType(const ShaderVariable &structVar)
+{
+ align(getBaseAlignment(structVar));
+}
+
+void Std140BlockEncoder::getBlockLayoutInfo(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int *arrayStrideOut,
+ int *matrixStrideOut)
+{
+ // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
+ ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == kBytesPerComponent);
+
+ size_t baseAlignment = 0;
+ int matrixStride = 0;
+ int arrayStride = 0;
+
+ if (gl::IsMatrixType(type))
+ {
+ baseAlignment = getTypeBaseAlignment(type, isRowMajorMatrix);
+ matrixStride = getTypeBaseAlignment(type, isRowMajorMatrix);
+
+ if (!arraySizes.empty())
+ {
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ arrayStride = getTypeBaseAlignment(type, isRowMajorMatrix) * numRegisters;
+ }
+ }
+ else if (!arraySizes.empty())
+ {
+ baseAlignment = getTypeBaseAlignment(type, false);
+ arrayStride = getTypeBaseAlignment(type, false);
+ }
+ else
+ {
+ const size_t numComponents = static_cast<size_t>(gl::VariableComponentCount(type));
+ baseAlignment = ComponentAlignment(numComponents);
+ }
+
+ mCurrentOffset = rx::roundUp(mCurrentOffset, baseAlignment);
+
+ *matrixStrideOut = matrixStride;
+ *arrayStrideOut = arrayStride;
+}
+
+void Std140BlockEncoder::advanceOffset(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int arrayStride,
+ int matrixStride)
+{
+ if (!arraySizes.empty())
+ {
+ mCurrentOffset += arrayStride * gl::ArraySizeProduct(arraySizes);
+ }
+ else if (gl::IsMatrixType(type))
+ {
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ mCurrentOffset += matrixStride * numRegisters;
+ }
+ else
+ {
+ mCurrentOffset += gl::VariableComponentCount(type);
+ }
+}
+
+size_t Std140BlockEncoder::getBaseAlignment(const ShaderVariable &variable) const
+{
+ return kComponentsPerRegister;
+}
+
+size_t Std140BlockEncoder::getTypeBaseAlignment(GLenum type, bool isRowMajorMatrix) const
+{
+ return kComponentsPerRegister;
+}
+
+// Std430BlockEncoder implementation.
+Std430BlockEncoder::Std430BlockEncoder() {}
+
+size_t Std430BlockEncoder::getBaseAlignment(const ShaderVariable &shaderVar) const
+{
+ if (shaderVar.isStruct())
+ {
+ BaseAlignmentVisitor visitor;
+ TraverseShaderVariables(shaderVar.fields, false, &visitor);
+ return visitor.getBaseAlignment();
+ }
+
+ return GetStd430BaseAlignment(shaderVar.type, shaderVar.isRowMajorLayout);
+}
+
+size_t Std430BlockEncoder::getTypeBaseAlignment(GLenum type, bool isRowMajorMatrix) const
+{
+ return GetStd430BaseAlignment(type, isRowMajorMatrix);
+}
+
+void GetInterfaceBlockInfo(const std::vector<InterfaceBlockField> &fields,
+ const std::string &prefix,
+ BlockLayoutEncoder *encoder,
+ BlockLayoutMap *blockInfoOut)
+{
+ // Matrix packing is always recorded in individual fields, so they'll set the row major layout
+ // flag to true if needed.
+ GetInterfaceBlockInfo(fields, prefix, encoder, false, blockInfoOut);
+}
+
+void GetUniformBlockInfo(const std::vector<Uniform> &uniforms,
+ const std::string &prefix,
+ BlockLayoutEncoder *encoder,
+ BlockLayoutMap *blockInfoOut)
+{
+ // Matrix packing is always recorded in individual fields, so they'll set the row major layout
+ // flag to true if needed.
+ GetInterfaceBlockInfo(uniforms, prefix, encoder, false, blockInfoOut);
+}
+
+// VariableNameVisitor implementation.
+VariableNameVisitor::VariableNameVisitor(const std::string &namePrefix,
+ const std::string &mappedNamePrefix)
+{
+ if (!namePrefix.empty())
+ {
+ mNameStack.push_back(namePrefix + ".");
+ }
+
+ if (!mappedNamePrefix.empty())
+ {
+ mMappedNameStack.push_back(mappedNamePrefix + ".");
+ }
+}
+
+VariableNameVisitor::~VariableNameVisitor() = default;
+
+void VariableNameVisitor::enterStruct(const ShaderVariable &structVar)
+{
+ mNameStack.push_back(structVar.name);
+ mMappedNameStack.push_back(structVar.mappedName);
+}
+
+void VariableNameVisitor::exitStruct(const ShaderVariable &structVar)
+{
+ mNameStack.pop_back();
+ mMappedNameStack.pop_back();
+}
+
+void VariableNameVisitor::enterStructAccess(const ShaderVariable &structVar, bool isRowMajor)
+{
+ mNameStack.push_back(".");
+ mMappedNameStack.push_back(".");
+}
+
+void VariableNameVisitor::exitStructAccess(const ShaderVariable &structVar, bool isRowMajor)
+{
+ mNameStack.pop_back();
+ mMappedNameStack.pop_back();
+}
+
+void VariableNameVisitor::enterArray(const ShaderVariable &arrayVar)
+{
+ if (!arrayVar.hasParentArrayIndex() && !arrayVar.isStruct())
+ {
+ mNameStack.push_back(arrayVar.name);
+ mMappedNameStack.push_back(arrayVar.mappedName);
+ }
+}
+
+void VariableNameVisitor::exitArray(const ShaderVariable &arrayVar)
+{
+ if (!arrayVar.hasParentArrayIndex() && !arrayVar.isStruct())
+ {
+ mNameStack.pop_back();
+ mMappedNameStack.pop_back();
+ }
+}
+
+void VariableNameVisitor::enterArrayElement(const ShaderVariable &arrayVar,
+ unsigned int arrayElement)
+{
+ std::stringstream strstr = sh::InitializeStream<std::stringstream>();
+ strstr << "[" << arrayElement << "]";
+ std::string elementString = strstr.str();
+ mNameStack.push_back(elementString);
+ mMappedNameStack.push_back(elementString);
+}
+
+void VariableNameVisitor::exitArrayElement(const ShaderVariable &arrayVar,
+ unsigned int arrayElement)
+{
+ mNameStack.pop_back();
+ mMappedNameStack.pop_back();
+}
+
+std::string VariableNameVisitor::collapseNameStack() const
+{
+ return CollapseNameStack(mNameStack);
+}
+
+std::string VariableNameVisitor::collapseMappedNameStack() const
+{
+ return CollapseNameStack(mMappedNameStack);
+}
+
+void VariableNameVisitor::visitSampler(const sh::ShaderVariable &sampler)
+{
+ if (!sampler.hasParentArrayIndex())
+ {
+ mNameStack.push_back(sampler.name);
+ mMappedNameStack.push_back(sampler.mappedName);
+ }
+
+ std::string name = collapseNameStack();
+ std::string mappedName = collapseMappedNameStack();
+
+ if (!sampler.hasParentArrayIndex())
+ {
+ mNameStack.pop_back();
+ mMappedNameStack.pop_back();
+ }
+
+ visitNamedSampler(sampler, name, mappedName);
+}
+
+void VariableNameVisitor::visitVariable(const ShaderVariable &variable, bool isRowMajor)
+{
+ if (!variable.hasParentArrayIndex())
+ {
+ mNameStack.push_back(variable.name);
+ mMappedNameStack.push_back(variable.mappedName);
+ }
+
+ std::string name = collapseNameStack();
+ std::string mappedName = collapseMappedNameStack();
+
+ if (!variable.hasParentArrayIndex())
+ {
+ mNameStack.pop_back();
+ mMappedNameStack.pop_back();
+ }
+
+ visitNamedVariable(variable, isRowMajor, name, mappedName);
+}
+
+// BlockEncoderVisitor implementation.
+BlockEncoderVisitor::BlockEncoderVisitor(const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ BlockLayoutEncoder *encoder)
+ : VariableNameVisitor(namePrefix, mappedNamePrefix), mEncoder(encoder)
+{}
+
+BlockEncoderVisitor::~BlockEncoderVisitor() = default;
+
+void BlockEncoderVisitor::enterStructAccess(const ShaderVariable &structVar, bool isRowMajor)
+{
+ mStructStackSize++;
+ if (!mIsTopLevelArrayStrideReady)
+ {
+ size_t structSize = mEncoder->getShaderVariableSize(structVar, isRowMajor);
+ mTopLevelArrayStride *= structSize;
+ mIsTopLevelArrayStrideReady = true;
+ }
+
+ VariableNameVisitor::enterStructAccess(structVar, isRowMajor);
+ mEncoder->enterAggregateType(structVar);
+}
+
+void BlockEncoderVisitor::exitStructAccess(const ShaderVariable &structVar, bool isRowMajor)
+{
+ mStructStackSize--;
+ mEncoder->exitAggregateType(structVar);
+ VariableNameVisitor::exitStructAccess(structVar, isRowMajor);
+}
+
+void BlockEncoderVisitor::enterArrayElement(const sh::ShaderVariable &arrayVar,
+ unsigned int arrayElement)
+{
+ if (mStructStackSize == 0 && !arrayVar.hasParentArrayIndex())
+ {
+ // From the ES 3.1 spec "7.3.1.1 Naming Active Resources":
+ // For an active shader storage block member declared as an array of an aggregate type,
+ // an entry will be generated only for the first array element, regardless of its type.
+ // Such block members are referred to as top-level arrays. If the block member is an
+ // aggregate type, the enumeration rules are then applied recursively.
+ if (arrayElement == 0)
+ {
+ mTopLevelArraySize = arrayVar.getOutermostArraySize();
+ mTopLevelArrayStride = arrayVar.getInnerArraySizeProduct();
+ mIsTopLevelArrayStrideReady = false;
+ }
+ else
+ {
+ mSkipEnabled = true;
+ }
+ }
+ VariableNameVisitor::enterArrayElement(arrayVar, arrayElement);
+}
+
+void BlockEncoderVisitor::exitArrayElement(const sh::ShaderVariable &arrayVar,
+ unsigned int arrayElement)
+{
+ if (mStructStackSize == 0 && !arrayVar.hasParentArrayIndex())
+ {
+ mTopLevelArraySize = 1;
+ mTopLevelArrayStride = 0;
+ mIsTopLevelArrayStrideReady = true;
+ mSkipEnabled = false;
+ }
+ VariableNameVisitor::exitArrayElement(arrayVar, arrayElement);
+}
+
+void BlockEncoderVisitor::visitNamedVariable(const ShaderVariable &variable,
+ bool isRowMajor,
+ const std::string &name,
+ const std::string &mappedName)
+{
+ std::vector<unsigned int> innermostArraySize;
+
+ if (variable.isArray())
+ {
+ innermostArraySize.push_back(variable.getNestedArraySize(0));
+ }
+ BlockMemberInfo variableInfo =
+ mEncoder->encodeType(variable.type, innermostArraySize, isRowMajor);
+ if (!mIsTopLevelArrayStrideReady)
+ {
+ ASSERT(mTopLevelArrayStride);
+ mTopLevelArrayStride *= variableInfo.arrayStride;
+ mIsTopLevelArrayStrideReady = true;
+ }
+ variableInfo.topLevelArrayStride = mTopLevelArrayStride;
+ encodeVariable(variable, variableInfo, name, mappedName);
+}
+
+void TraverseShaderVariable(const ShaderVariable &variable,
+ bool isRowMajorLayout,
+ ShaderVariableVisitor *visitor)
+{
+ bool rowMajorLayout = (isRowMajorLayout || variable.isRowMajorLayout);
+ bool isRowMajor = rowMajorLayout && gl::IsMatrixType(variable.type);
+
+ if (variable.isStruct())
+ {
+ visitor->enterStruct(variable);
+ if (variable.isArray())
+ {
+ TraverseStructArrayVariable(variable, rowMajorLayout, visitor);
+ }
+ else
+ {
+ TraverseStructVariable(variable, rowMajorLayout, visitor);
+ }
+ visitor->exitStruct(variable);
+ }
+ else if (variable.isArrayOfArrays())
+ {
+ TraverseArrayOfArraysVariable(variable, 0u, isRowMajor, visitor);
+ }
+ else if (gl::IsSamplerType(variable.type))
+ {
+ visitor->visitSampler(variable);
+ }
+ else
+ {
+ visitor->visitVariable(variable, isRowMajor);
+ }
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/blocklayout.h b/gfx/angle/checkout/src/compiler/translator/blocklayout.h
new file mode 100644
index 0000000000..30d5d1c3a5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/blocklayout.h
@@ -0,0 +1,302 @@
+//
+// 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 <cstddef>
+#include <map>
+#include <vector>
+
+#include <GLSLANG/ShaderLang.h>
+#include "angle_gl.h"
+
+namespace sh
+{
+struct ShaderVariable;
+struct InterfaceBlockField;
+struct Uniform;
+struct Varying;
+struct InterfaceBlock;
+
+struct BlockMemberInfo
+{
+ constexpr BlockMemberInfo() = default;
+
+ constexpr BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
+ : offset(offset),
+ arrayStride(arrayStride),
+ matrixStride(matrixStride),
+ isRowMajorMatrix(isRowMajorMatrix)
+ {}
+
+ constexpr BlockMemberInfo(int offset,
+ int arrayStride,
+ int matrixStride,
+ bool isRowMajorMatrix,
+ int topLevelArrayStride)
+ : offset(offset),
+ arrayStride(arrayStride),
+ matrixStride(matrixStride),
+ isRowMajorMatrix(isRowMajorMatrix),
+ topLevelArrayStride(topLevelArrayStride)
+ {}
+
+ // A single integer identifying the offset of an active variable.
+ int offset = -1;
+
+ // A single integer identifying the stride between array elements in an active variable.
+ int arrayStride = -1;
+
+ // A single integer identifying the stride between columns of a column-major matrix or rows of a
+ // row-major matrix.
+ int matrixStride = -1;
+
+ // A single integer identifying whether an active variable is a row-major matrix.
+ bool isRowMajorMatrix = false;
+
+ // A single integer identifying the number of active array elements of the top-level shader
+ // storage block member containing the active variable.
+ int topLevelArrayStride = -1;
+};
+
+constexpr size_t ComponentAlignment(size_t numComponents)
+{
+ return (numComponents == 3u ? 4u : numComponents);
+}
+
+constexpr BlockMemberInfo kDefaultBlockMemberInfo;
+
+class BlockLayoutEncoder
+{
+ public:
+ BlockLayoutEncoder();
+ virtual ~BlockLayoutEncoder() {}
+
+ BlockMemberInfo encodeType(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix);
+
+ size_t getCurrentOffset() const { return mCurrentOffset * kBytesPerComponent; }
+ size_t getShaderVariableSize(const ShaderVariable &structVar, bool isRowMajor);
+
+ // Called when entering/exiting a structure variable.
+ virtual void enterAggregateType(const ShaderVariable &structVar) = 0;
+ virtual void exitAggregateType(const ShaderVariable &structVar) = 0;
+
+ static constexpr size_t kBytesPerComponent = 4u;
+ static constexpr unsigned int kComponentsPerRegister = 4u;
+
+ static size_t GetBlockRegister(const BlockMemberInfo &info);
+ static size_t GetBlockRegisterElement(const BlockMemberInfo &info);
+
+ protected:
+ void align(size_t baseAlignment);
+
+ virtual void getBlockLayoutInfo(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int *arrayStrideOut,
+ int *matrixStrideOut) = 0;
+ virtual void advanceOffset(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int arrayStride,
+ int matrixStride) = 0;
+
+ size_t mCurrentOffset;
+};
+
+// Will return default values for everything.
+class DummyBlockEncoder : public BlockLayoutEncoder
+{
+ public:
+ DummyBlockEncoder() = default;
+
+ void enterAggregateType(const ShaderVariable &structVar) override {}
+ void exitAggregateType(const ShaderVariable &structVar) override {}
+
+ protected:
+ void getBlockLayoutInfo(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int *arrayStrideOut,
+ int *matrixStrideOut) override;
+
+ void advanceOffset(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int arrayStride,
+ int matrixStride) override
+ {}
+};
+
+// 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();
+
+ void enterAggregateType(const ShaderVariable &structVar) override;
+ void exitAggregateType(const ShaderVariable &structVar) override;
+
+ protected:
+ void getBlockLayoutInfo(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int *arrayStrideOut,
+ int *matrixStrideOut) override;
+ void advanceOffset(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int arrayStride,
+ int matrixStride) override;
+
+ virtual size_t getBaseAlignment(const ShaderVariable &variable) const;
+ virtual size_t getTypeBaseAlignment(GLenum type, bool isRowMajorMatrix) const;
+};
+
+class Std430BlockEncoder : public Std140BlockEncoder
+{
+ public:
+ Std430BlockEncoder();
+
+ protected:
+ size_t getBaseAlignment(const ShaderVariable &variable) const override;
+ size_t getTypeBaseAlignment(GLenum type, bool isRowMajorMatrix) const override;
+};
+
+using BlockLayoutMap = std::map<std::string, BlockMemberInfo>;
+
+void GetInterfaceBlockInfo(const std::vector<InterfaceBlockField> &fields,
+ const std::string &prefix,
+ BlockLayoutEncoder *encoder,
+ BlockLayoutMap *blockInfoOut);
+
+// Used for laying out the default uniform block on the Vulkan backend.
+void GetUniformBlockInfo(const std::vector<Uniform> &uniforms,
+ const std::string &prefix,
+ BlockLayoutEncoder *encoder,
+ BlockLayoutMap *blockInfoOut);
+
+class ShaderVariableVisitor
+{
+ public:
+ virtual ~ShaderVariableVisitor() {}
+
+ virtual void enterStruct(const ShaderVariable &structVar) {}
+ virtual void exitStruct(const ShaderVariable &structVar) {}
+
+ virtual void enterStructAccess(const ShaderVariable &structVar, bool isRowMajor) {}
+ virtual void exitStructAccess(const ShaderVariable &structVar, bool isRowMajor) {}
+
+ virtual void enterArray(const ShaderVariable &arrayVar) {}
+ virtual void exitArray(const ShaderVariable &arrayVar) {}
+
+ virtual void enterArrayElement(const ShaderVariable &arrayVar, unsigned int arrayElement) {}
+ virtual void exitArrayElement(const ShaderVariable &arrayVar, unsigned int arrayElement) {}
+
+ virtual void visitSampler(const sh::ShaderVariable &sampler) {}
+
+ virtual void visitVariable(const ShaderVariable &variable, bool isRowMajor) = 0;
+
+ protected:
+ ShaderVariableVisitor() {}
+};
+
+class VariableNameVisitor : public ShaderVariableVisitor
+{
+ public:
+ VariableNameVisitor(const std::string &namePrefix, const std::string &mappedNamePrefix);
+ ~VariableNameVisitor() override;
+
+ void enterStruct(const ShaderVariable &structVar) override;
+ void exitStruct(const ShaderVariable &structVar) override;
+ void enterStructAccess(const ShaderVariable &structVar, bool isRowMajor) override;
+ void exitStructAccess(const ShaderVariable &structVar, bool isRowMajor) override;
+ void enterArray(const ShaderVariable &arrayVar) override;
+ void exitArray(const ShaderVariable &arrayVar) override;
+ void enterArrayElement(const ShaderVariable &arrayVar, unsigned int arrayElement) override;
+ void exitArrayElement(const ShaderVariable &arrayVar, unsigned int arrayElement) override;
+
+ protected:
+ virtual void visitNamedSampler(const sh::ShaderVariable &sampler,
+ const std::string &name,
+ const std::string &mappedName)
+ {}
+ virtual void visitNamedVariable(const ShaderVariable &variable,
+ bool isRowMajor,
+ const std::string &name,
+ const std::string &mappedName) = 0;
+
+ std::string collapseNameStack() const;
+ std::string collapseMappedNameStack() const;
+
+ private:
+ void visitSampler(const sh::ShaderVariable &sampler) final;
+ void visitVariable(const ShaderVariable &variable, bool isRowMajor) final;
+
+ std::vector<std::string> mNameStack;
+ std::vector<std::string> mMappedNameStack;
+};
+
+class BlockEncoderVisitor : public VariableNameVisitor
+{
+ public:
+ BlockEncoderVisitor(const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ BlockLayoutEncoder *encoder);
+ ~BlockEncoderVisitor() override;
+
+ void enterStructAccess(const ShaderVariable &structVar, bool isRowMajor) override;
+ void exitStructAccess(const ShaderVariable &structVar, bool isRowMajor) override;
+ void enterArrayElement(const ShaderVariable &arrayVar, unsigned int arrayElement) override;
+ void exitArrayElement(const ShaderVariable &arrayVar, unsigned int arrayElement) override;
+
+ void visitNamedVariable(const ShaderVariable &variable,
+ bool isRowMajor,
+ const std::string &name,
+ const std::string &mappedName) override;
+
+ virtual void encodeVariable(const ShaderVariable &variable,
+ const BlockMemberInfo &variableInfo,
+ const std::string &name,
+ const std::string &mappedName)
+ {}
+
+ protected:
+ int mTopLevelArraySize = 1;
+ int mTopLevelArrayStride = 0;
+ bool mIsTopLevelArrayStrideReady = true;
+ bool mSkipEnabled = false;
+
+ private:
+ BlockLayoutEncoder *mEncoder;
+ unsigned int mStructStackSize = 0;
+};
+
+void TraverseShaderVariable(const ShaderVariable &variable,
+ bool isRowMajorLayout,
+ ShaderVariableVisitor *visitor);
+
+template <typename T>
+void TraverseShaderVariables(const std::vector<T> &vars,
+ bool isRowMajorLayout,
+ ShaderVariableVisitor *visitor)
+{
+ for (const T &var : vars)
+ {
+ TraverseShaderVariable(var, isRowMajorLayout, visitor);
+ }
+}
+} // namespace sh
+
+#endif // COMMON_BLOCKLAYOUT_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.cpp
new file mode 100644
index 0000000000..dde403699c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.cpp
@@ -0,0 +1,167 @@
+//
+// 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 "compiler/translator/blocklayoutHLSL.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+namespace sh
+{
+
+HLSLBlockEncoder::HLSLBlockEncoder(HLSLBlockEncoderStrategy strategy, bool transposeMatrices)
+ : mEncoderStrategy(strategy), mTransposeMatrices(transposeMatrices)
+{}
+
+void HLSLBlockEncoder::enterAggregateType(const ShaderVariable &structVar)
+{
+ align(kComponentsPerRegister);
+}
+
+void HLSLBlockEncoder::exitAggregateType(const ShaderVariable &structVar) {}
+
+void HLSLBlockEncoder::getBlockLayoutInfo(GLenum typeIn,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int *arrayStrideOut,
+ int *matrixStrideOut)
+{
+ GLenum type = (mTransposeMatrices ? gl::TransposeMatrixType(typeIn) : typeIn);
+
+ // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
+ ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == kBytesPerComponent);
+
+ int matrixStride = 0;
+ int arrayStride = 0;
+
+ // if variables are not to be packed, or we're about to
+ // pack a matrix or array, skip to the start of the next
+ // register
+ if (!isPacked() || gl::IsMatrixType(type) || !arraySizes.empty())
+ {
+ align(kComponentsPerRegister);
+ }
+
+ if (gl::IsMatrixType(type))
+ {
+ matrixStride = kComponentsPerRegister;
+
+ if (!arraySizes.empty())
+ {
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ arrayStride = kComponentsPerRegister * numRegisters;
+ }
+ }
+ else if (!arraySizes.empty())
+ {
+ arrayStride = kComponentsPerRegister;
+ }
+ else if (isPacked())
+ {
+ int numComponents = gl::VariableComponentCount(type);
+ if ((numComponents + (mCurrentOffset % kComponentsPerRegister)) > kComponentsPerRegister)
+ {
+ align(kComponentsPerRegister);
+ }
+ }
+
+ *matrixStrideOut = matrixStride;
+ *arrayStrideOut = arrayStride;
+}
+
+void HLSLBlockEncoder::advanceOffset(GLenum typeIn,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int arrayStride,
+ int matrixStride)
+{
+ GLenum type = (mTransposeMatrices ? gl::TransposeMatrixType(typeIn) : typeIn);
+
+ if (!arraySizes.empty())
+ {
+ unsigned int arraySize = gl::ArraySizeProduct(arraySizes);
+ if (arraySize > 0)
+ {
+ mCurrentOffset += arrayStride * (arraySize - 1);
+ }
+ }
+
+ if (gl::IsMatrixType(type))
+ {
+ ASSERT(matrixStride == kComponentsPerRegister);
+ const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+ const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
+ mCurrentOffset += kComponentsPerRegister * (numRegisters - 1);
+ mCurrentOffset += numComponents;
+ }
+ else if (isPacked())
+ {
+ mCurrentOffset += gl::VariableComponentCount(type);
+ }
+ else
+ {
+ mCurrentOffset += kComponentsPerRegister;
+ }
+}
+
+void HLSLBlockEncoder::skipRegisters(unsigned int numRegisters)
+{
+ mCurrentOffset += (numRegisters * kComponentsPerRegister);
+}
+
+HLSLBlockEncoder::HLSLBlockEncoderStrategy HLSLBlockEncoder::GetStrategyFor(
+ ShShaderOutput outputType)
+{
+ switch (outputType)
+ {
+ case SH_HLSL_3_0_OUTPUT:
+ return ENCODE_LOOSE;
+ case SH_HLSL_4_1_OUTPUT:
+ case SH_HLSL_4_0_FL9_3_OUTPUT:
+ return ENCODE_PACKED;
+ default:
+ UNREACHABLE();
+ return ENCODE_PACKED;
+ }
+}
+
+template <class ShaderVarType>
+void HLSLVariableRegisterCount(const ShaderVarType &variable, HLSLBlockEncoder *encoder)
+{
+ if (variable.isStruct())
+ {
+ for (size_t arrayElement = 0; arrayElement < variable.getArraySizeProduct(); arrayElement++)
+ {
+ encoder->enterAggregateType(variable);
+
+ for (const ShaderVariable &field : variable.fields)
+ {
+ HLSLVariableRegisterCount(field, encoder);
+ }
+
+ encoder->exitAggregateType(variable);
+ }
+ }
+ else
+ {
+ // We operate only on varyings and uniforms, which do not have matrix layout qualifiers
+ encoder->encodeType(variable.type, variable.arraySizes, false);
+ }
+}
+
+unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType)
+{
+ HLSLBlockEncoder encoder(HLSLBlockEncoder::GetStrategyFor(outputType), true);
+ HLSLVariableRegisterCount(variable, &encoder);
+
+ const size_t registerBytes = (encoder.kBytesPerComponent * encoder.kComponentsPerRegister);
+ return static_cast<unsigned int>(
+ rx::roundUp<size_t>(encoder.getCurrentOffset(), registerBytes) / registerBytes);
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.h b/gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.h
new file mode 100644
index 0000000000..98d93fccb0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/blocklayoutHLSL.h
@@ -0,0 +1,68 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// blocklayout.h:
+// Methods and classes related to uniform layout and packing in GLSL and HLSL.
+//
+
+#ifndef COMMON_BLOCKLAYOUTHLSL_H_
+#define COMMON_BLOCKLAYOUTHLSL_H_
+
+#include <cstddef>
+#include <vector>
+
+#include <GLSLANG/ShaderLang.h>
+#include "angle_gl.h"
+#include "blocklayout.h"
+
+namespace sh
+{
+// Block layout packed according to the D3D9 or default D3D10+ register packing rules
+// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb509632(v=vs.85).aspx
+// The strategy should be ENCODE_LOOSE for D3D9 constant blocks, and ENCODE_PACKED
+// for everything else (D3D10+ constant blocks and all attributes/varyings).
+
+class HLSLBlockEncoder : public BlockLayoutEncoder
+{
+ public:
+ enum HLSLBlockEncoderStrategy
+ {
+ ENCODE_PACKED,
+ ENCODE_LOOSE
+ };
+
+ HLSLBlockEncoder(HLSLBlockEncoderStrategy strategy, bool transposeMatrices);
+
+ void enterAggregateType(const ShaderVariable &structVar) override;
+ void exitAggregateType(const ShaderVariable &structVar) override;
+ void skipRegisters(unsigned int numRegisters);
+
+ bool isPacked() const { return mEncoderStrategy == ENCODE_PACKED; }
+
+ static HLSLBlockEncoderStrategy GetStrategyFor(ShShaderOutput outputType);
+
+ protected:
+ void getBlockLayoutInfo(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int *arrayStrideOut,
+ int *matrixStrideOut) override;
+ void advanceOffset(GLenum type,
+ const std::vector<unsigned int> &arraySizes,
+ bool isRowMajorMatrix,
+ int arrayStride,
+ int matrixStride) override;
+
+ HLSLBlockEncoderStrategy mEncoderStrategy;
+ bool mTransposeMatrices;
+};
+
+// This method returns the number of used registers for a ShaderVariable. It is dependent on the
+// HLSLBlockEncoder class to count the number of used registers in a struct (which are individually
+// packed according to the same rules).
+unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType);
+} // namespace sh
+
+#endif // COMMON_BLOCKLAYOUTHLSL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp b/gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp
new file mode 100644
index 0000000000..c61e77a110
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp
@@ -0,0 +1,881 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_emulated_builtin_function_tables.py using data from
+// emulated_builtin_function_data_hlsl.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// emulated_builtin_functions_hlsl:
+// HLSL code for emulating GLSL builtin functions not present in HLSL.
+
+#include "compiler/translator/BuiltInFunctionEmulator.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+
+namespace sh
+{
+
+namespace
+{
+
+struct FunctionPair
+{
+ constexpr FunctionPair(const TSymbolUniqueId &idIn, const char *bodyIn)
+ : id(idIn.get()), body(bodyIn)
+ {}
+
+ int id;
+ const char *body;
+};
+
+constexpr FunctionPair g_hlslFunctions[] = {
+ {BuiltInId::mod_Float1_Float1,
+ "float mod_emu(float x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"},
+ {BuiltInId::mod_Float2_Float2,
+ "float2 mod_emu(float2 x, float2 y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"},
+ {BuiltInId::mod_Float2_Float1,
+ "float2 mod_emu(float2 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"},
+ {BuiltInId::mod_Float3_Float3,
+ "float3 mod_emu(float3 x, float3 y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"},
+ {BuiltInId::mod_Float3_Float1,
+ "float3 mod_emu(float3 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"},
+ {BuiltInId::mod_Float4_Float4,
+ "float4 mod_emu(float4 x, float4 y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"},
+ {BuiltInId::mod_Float4_Float1,
+ "float4 mod_emu(float4 x, float y)\n"
+ "{\n"
+ " return x - y * floor(x / y);\n"
+ "}\n"},
+ {BuiltInId::frexp_Float1_Int1,
+ "float frexp_emu(float x, out int exp)\n"
+ "{\n"
+ " float fexp;\n"
+ " float mantissa = frexp(abs(x), fexp) * sign(x);\n"
+ " exp = int(fexp);\n"
+ " return mantissa;\n"
+ "}\n"},
+ {BuiltInId::frexp_Float2_Int2,
+ "float2 frexp_emu(float2 x, out int2 exp)\n"
+ "{\n"
+ " float2 fexp;\n"
+ " float2 mantissa = frexp(abs(x), fexp) * sign(x);\n"
+ " exp = int2(fexp);\n"
+ " return mantissa;\n"
+ "}\n"},
+ {BuiltInId::frexp_Float3_Int3,
+ "float3 frexp_emu(float3 x, out int3 exp)\n"
+ "{\n"
+ " float3 fexp;\n"
+ " float3 mantissa = frexp(abs(x), fexp) * sign(x);\n"
+ " exp = int3(fexp);\n"
+ " return mantissa;\n"
+ "}\n"},
+ {BuiltInId::frexp_Float4_Int4,
+ "float4 frexp_emu(float4 x, out int4 exp)\n"
+ "{\n"
+ " float4 fexp;\n"
+ " float4 mantissa = frexp(abs(x), fexp) * sign(x);\n"
+ " exp = int4(fexp);\n"
+ " return mantissa;\n"
+ "}\n"},
+ {BuiltInId::ldexp_Float1_Int1,
+ "float ldexp_emu(float x, int exp)\n"
+ "{\n"
+ " return ldexp(x, float(exp));\n"
+ "}\n"},
+ {BuiltInId::ldexp_Float2_Int2,
+ "float2 ldexp_emu(float2 x, int2 exp)\n"
+ "{\n"
+ " return ldexp(x, float2(exp));\n"
+ "}\n"},
+ {BuiltInId::ldexp_Float3_Int3,
+ "float3 ldexp_emu(float3 x, int3 exp)\n"
+ "{\n"
+ " return ldexp(x, float3(exp));\n"
+ "}\n"},
+ {BuiltInId::ldexp_Float4_Int4,
+ "float4 ldexp_emu(float4 x, int4 exp)\n"
+ "{\n"
+ " return ldexp(x, float4(exp));\n"
+ "}\n"},
+ {BuiltInId::faceforward_Float1_Float1_Float1,
+ "float faceforward_emu(float N, float I, float Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"},
+ {BuiltInId::faceforward_Float2_Float2_Float2,
+ "float2 faceforward_emu(float2 N, float2 I, float2 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"},
+ {BuiltInId::faceforward_Float3_Float3_Float3,
+ "float3 faceforward_emu(float3 N, float3 I, float3 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"},
+ {BuiltInId::faceforward_Float4_Float4_Float4,
+ "float4 faceforward_emu(float4 N, float4 I, float4 Nref)\n"
+ "{\n"
+ " if(dot(Nref, I) >= 0)\n"
+ " {\n"
+ " return -N;\n"
+ " }\n"
+ " else\n"
+ " {\n"
+ " return N;\n"
+ " }\n"
+ "}\n"},
+ {BuiltInId::atan_Float1_Float1,
+ "float atan_emu(float y, float x)\n"
+ "{\n"
+ " if(x == 0 && y == 0) x = 1;\n"
+ " return atan2(y, x);\n"
+ "}\n"},
+ {BuiltInId::atan_Float2_Float2,
+ "float2 atan_emu(float2 y, float2 x)\n"
+ "{\n"
+ " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
+ " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
+ " return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));\n"
+ "}\n"},
+ {BuiltInId::atan_Float3_Float3,
+ "float3 atan_emu(float3 y, float3 x)\n"
+ "{\n"
+ " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
+ " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
+ " if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
+ " return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));\n"
+ "}\n"},
+ {BuiltInId::atan_Float4_Float4,
+ "float4 atan_emu(float4 y, float4 x)\n"
+ "{\n"
+ " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n"
+ " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n"
+ " if(x[2] == 0 && y[2] == 0) x[2] = 1;\n"
+ " if(x[3] == 0 && y[3] == 0) x[3] = 1;\n"
+ " return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], \n"
+ " x[2]), atan2(y[3], x[3]));\n"
+ "}\n"},
+ {BuiltInId::asinh_Float1,
+ "float asinh_emu(in float x)\n"
+ "{\n"
+ " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
+ "}\n"},
+ {BuiltInId::asinh_Float2,
+ "float2 asinh_emu(in float2 x)\n"
+ "{\n"
+ " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
+ "}\n"},
+ {BuiltInId::asinh_Float3,
+ "float3 asinh_emu(in float3 x)\n"
+ "{\n"
+ " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
+ "}\n"},
+ {BuiltInId::asinh_Float4,
+ "float4 asinh_emu(in float4 x)\n"
+ "{\n"
+ " return log(x + sqrt(pow(x, 2.0) + 1.0));\n"
+ "}\n"},
+ {BuiltInId::acosh_Float1,
+ "float acosh_emu(in float x)\n"
+ "{\n"
+ " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
+ "}\n"},
+ {BuiltInId::acosh_Float2,
+ "float2 acosh_emu(in float2 x)\n"
+ "{\n"
+ " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
+ "}\n"},
+ {BuiltInId::acosh_Float3,
+ "float3 acosh_emu(in float3 x)\n"
+ "{\n"
+ " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
+ "}\n"},
+ {BuiltInId::acosh_Float4,
+ "float4 acosh_emu(in float4 x)\n"
+ "{\n"
+ " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n"
+ "}\n"},
+ {BuiltInId::atanh_Float1,
+ "float atanh_emu(in float x)\n"
+ "{\n"
+ " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
+ "}\n"},
+ {BuiltInId::atanh_Float2,
+ "float2 atanh_emu(in float2 x)\n"
+ "{\n"
+ " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
+ "}\n"},
+ {BuiltInId::atanh_Float3,
+ "float3 atanh_emu(in float3 x)\n"
+ "{\n"
+ " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
+ "}\n"},
+ {BuiltInId::atanh_Float4,
+ "float4 atanh_emu(in float4 x)\n"
+ "{\n"
+ " return 0.5 * log((1.0 + x) / (1.0 - x));\n"
+ "}\n"},
+ {BuiltInId::roundEven_Float1,
+ "float roundEven_emu(in float x)\n"
+ "{\n"
+ " return (frac(x) == 0.5 && trunc(x) % 2.0 == 0.0) ? trunc(x) : round(x);\n"
+ "}\n"},
+ {BuiltInId::roundEven_Float2,
+ "float2 roundEven_emu(in float2 x)\n"
+ "{\n"
+ " float2 v;\n"
+ " v[0] = (frac(x[0]) == 0.5 && trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);\n"
+ " v[1] = (frac(x[1]) == 0.5 && trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);\n"
+ " return v;\n"
+ "}\n"},
+ {BuiltInId::roundEven_Float3,
+ "float3 roundEven_emu(in float3 x)\n"
+ "{\n"
+ " float3 v;\n"
+ " v[0] = (frac(x[0]) == 0.5 && trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);\n"
+ " v[1] = (frac(x[1]) == 0.5 && trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);\n"
+ " v[2] = (frac(x[2]) == 0.5 && trunc(x[2]) % 2.0 == 0.0) ? trunc(x[2]) : round(x[2]);\n"
+ " return v;\n"
+ "}\n"},
+ {BuiltInId::roundEven_Float4,
+ "float4 roundEven_emu(in float4 x)\n"
+ "{\n"
+ " float4 v;\n"
+ " v[0] = (frac(x[0]) == 0.5 && trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);\n"
+ " v[1] = (frac(x[1]) == 0.5 && trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);\n"
+ " v[2] = (frac(x[2]) == 0.5 && trunc(x[2]) % 2.0 == 0.0) ? trunc(x[2]) : round(x[2]);\n"
+ " v[3] = (frac(x[3]) == 0.5 && trunc(x[3]) % 2.0 == 0.0) ? trunc(x[3]) : round(x[3]);\n"
+ " return v;\n"
+ "}\n"},
+ {BuiltInId::packSnorm2x16_Float2,
+ "int webgl_toSnorm16(in float x) {\n"
+ " return int(round(clamp(x, -1.0, 1.0) * 32767.0));\n"
+ "}\n"
+ "uint packSnorm2x16_emu(in float2 v)\n"
+ "{\n"
+ " int x = webgl_toSnorm16(v.x);\n"
+ " int y = webgl_toSnorm16(v.y);\n"
+ " return (asuint(y) << 16) | (asuint(x) & 0xffffu);\n"
+ "}\n"},
+ {BuiltInId::packUnorm2x16_Float2,
+ "uint webgl_toUnorm16(in float x) {\n"
+ " return uint(round(clamp(x, 0.0, 1.0) * 65535.0));\n"
+ "}\n"
+ "uint packUnorm2x16_emu(in float2 v)\n"
+ "{\n"
+ " uint x = webgl_toUnorm16(v.x);\n"
+ " uint y = webgl_toUnorm16(v.y);\n"
+ " return (y << 16) | x;\n"
+ "}\n"},
+ {BuiltInId::packHalf2x16_Float2,
+ "uint packHalf2x16_emu(in float2 v)\n"
+ "{\n"
+ " uint x = f32tof16(v.x);\n"
+ " uint y = f32tof16(v.y);\n"
+ " return (y << 16) | x;\n"
+ "}\n"},
+ {BuiltInId::unpackSnorm2x16_UInt1,
+ "float webgl_fromSnorm16(in uint x) {\n"
+ " int xi = asint(x & 0x7fffu) - asint(x & 0x8000u);\n"
+ " return clamp(float(xi) / 32767.0, -1.0, 1.0);\n"
+ "}\n"
+ "float2 unpackSnorm2x16_emu(in uint u)\n"
+ "{\n"
+ " uint y = (u >> 16);\n"
+ " uint x = u;\n"
+ " return float2(webgl_fromSnorm16(x), webgl_fromSnorm16(y));\n"
+ "}\n"},
+ {BuiltInId::unpackUnorm2x16_UInt1,
+ "float webgl_fromUnorm16(in uint x) {\n"
+ " return float(x) / 65535.0;\n"
+ "}\n"
+ "float2 unpackUnorm2x16_emu(in uint u)\n"
+ "{\n"
+ " uint y = (u >> 16);\n"
+ " uint x = u & 0xffffu;\n"
+ " return float2(webgl_fromUnorm16(x), webgl_fromUnorm16(y));\n"
+ "}\n"},
+ {BuiltInId::unpackHalf2x16_UInt1,
+ "float2 unpackHalf2x16_emu(in uint u)\n"
+ "{\n"
+ " uint y = (u >> 16);\n"
+ " uint x = u & 0xffffu;\n"
+ " return float2(f16tof32(x), f16tof32(y));\n"
+ "}\n"},
+ {BuiltInId::packSnorm4x8_Float4,
+ "int webgl_toSnorm8(in float x) {\n"
+ " return int(round(clamp(x, -1.0, 1.0) * 127.0));\n"
+ "}\n"
+ "uint packSnorm4x8_emu(in float4 v)\n"
+ "{\n"
+ " int x = webgl_toSnorm8(v.x);\n"
+ " int y = webgl_toSnorm8(v.y);\n"
+ " int z = webgl_toSnorm8(v.z);\n"
+ " int w = webgl_toSnorm8(v.w);\n"
+ " return ((asuint(w) & 0xffu) << 24) | ((asuint(z) & 0xffu) << 16) \n"
+ " | ((asuint(y) & 0xffu) << 8) | (asuint(x) & 0xffu);\n"
+ "}\n"},
+ {BuiltInId::packUnorm4x8_Float4,
+ "uint webgl_toUnorm8(in float x) {\n"
+ " return uint(round(clamp(x, 0.0, 1.0) * 255.0));\n"
+ "}\n"
+ "uint packUnorm4x8_emu(in float4 v)\n"
+ "{\n"
+ " uint x = webgl_toUnorm8(v.x);\n"
+ " uint y = webgl_toUnorm8(v.y);\n"
+ " uint z = webgl_toUnorm8(v.z);\n"
+ " uint w = webgl_toUnorm8(v.w);\n"
+ " return (w << 24) | (z << 16) | (y << 8) | x;\n"
+ "}\n"},
+ {BuiltInId::unpackSnorm4x8_UInt1,
+ "float webgl_fromSnorm8(in uint x) {\n"
+ " int xi = asint(x & 0x7fu) - asint(x & 0x80u);\n"
+ " return clamp(float(xi) / 127.0, -1.0, 1.0);\n"
+ "}\n"
+ "float4 unpackSnorm4x8_emu(in uint u)\n"
+ "{\n"
+ " uint w = (u >> 24);\n"
+ " uint z = (u >> 16);\n"
+ " uint y = (u >> 8);\n"
+ " uint x = u;\n"
+ " return float4(webgl_fromSnorm8(x), webgl_fromSnorm8(y), \n"
+ " webgl_fromSnorm8(z), webgl_fromSnorm8(w));\n"
+ "}\n"},
+ {BuiltInId::unpackUnorm4x8_UInt1,
+ "float webgl_fromUnorm8(in uint x) {\n"
+ " return float(x) / 255.0;\n"
+ "}\n"
+ "float4 unpackUnorm4x8_emu(in uint u)\n"
+ "{\n"
+ " uint w = (u >> 24) & 0xffu;\n"
+ " uint z = (u >> 16) & 0xffu;\n"
+ " uint y = (u >> 8) & 0xffu;\n"
+ " uint x = u & 0xffu;\n"
+ " return float4(webgl_fromUnorm8(x), webgl_fromUnorm8(y), \n"
+ " webgl_fromUnorm8(z), webgl_fromUnorm8(w));\n"
+ "}\n"},
+ // The matrix resulting from outer product needs to be transposed
+ // (matrices are stored as transposed to simplify element access in HLSL).
+ // So the function should return transpose(c * r) where c is a column vector
+ // and r is a row vector. This can be simplified by using the following
+ // formula:
+ // transpose(c * r) = transpose(r) * transpose(c)
+ // transpose(r) and transpose(c) are in a sense free, since to get the
+ // transpose of r, we simply can build a column matrix out of the original
+ // vector instead of a row matrix.
+ {BuiltInId::outerProduct_Float2_Float2,
+ "float2x2 outerProduct_emu(in float2 c, in float2 r)\n"
+ "{\n"
+ " return mul(float2x1(r), float1x2(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float3_Float3,
+ "float3x3 outerProduct_emu(in float3 c, in float3 r)\n"
+ "{\n"
+ " return mul(float3x1(r), float1x3(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float4_Float4,
+ "float4x4 outerProduct_emu(in float4 c, in float4 r)\n"
+ "{\n"
+ " return mul(float4x1(r), float1x4(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float3_Float2,
+ "float2x3 outerProduct_emu(in float3 c, in float2 r)\n"
+ "{\n"
+ " return mul(float2x1(r), float1x3(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float2_Float3,
+ "float3x2 outerProduct_emu(in float2 c, in float3 r)\n"
+ "{\n"
+ " return mul(float3x1(r), float1x2(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float4_Float2,
+ "float2x4 outerProduct_emu(in float4 c, in float2 r)\n"
+ "{\n"
+ " return mul(float2x1(r), float1x4(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float2_Float4,
+ "float4x2 outerProduct_emu(in float2 c, in float4 r)\n"
+ "{\n"
+ " return mul(float4x1(r), float1x2(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float4_Float3,
+ "float3x4 outerProduct_emu(in float4 c, in float3 r)\n"
+ "{\n"
+ " return mul(float3x1(r), float1x4(c));\n"
+ "}\n"},
+ {BuiltInId::outerProduct_Float3_Float4,
+ "float4x3 outerProduct_emu(in float3 c, in float4 r)\n"
+ "{\n"
+ " return mul(float4x1(r), float1x3(c));\n"
+ "}\n"},
+ // Remember here that the parameter matrix is actually the transpose
+ // of the matrix that we're trying to invert, and the resulting matrix
+ // should also be the transpose of the inverse.
+ // When accessing the parameter matrix with m[a][b] it can be thought of so
+ // that a is the column and b is the row of the matrix that we're inverting.
+ // We calculate the inverse as the adjugate matrix divided by the
+ // determinant of the matrix being inverted. However, as the result needs
+ // to be transposed, we actually use of the transpose of the adjugate matrix
+ // which happens to be the cofactor matrix. That's stored in 'cof'.
+ // We don't need to care about divide-by-zero since results are undefined
+ // for singular or poorly-conditioned matrices.
+ {BuiltInId::inverse_Float2x2,
+ "float2x2 inverse_emu(in float2x2 m)\n"
+ "{\n"
+ " float2x2 cof = { m[1][1], -m[0][1], -m[1][0], m[0][0] };\n"
+ " return cof / determinant(transpose(m));\n"
+ "}\n"},
+ // cofAB is the cofactor for column A and row B.
+ {BuiltInId::inverse_Float3x3,
+ "float3x3 inverse_emu(in float3x3 m)\n"
+ "{\n"
+ " float cof00 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n"
+ " float cof01 = -(m[1][0] * m[2][2] - m[2][0] * m[1][2]);\n"
+ " float cof02 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n"
+ " float cof10 = -(m[0][1] * m[2][2] - m[2][1] * m[0][2]);\n"
+ " float cof11 = m[0][0] * m[2][2] - m[2][0] * m[0][2];\n"
+ " float cof12 = -(m[0][0] * m[2][1] - m[2][0] * m[0][1]);\n"
+ " float cof20 = m[0][1] * m[1][2] - m[1][1] * m[0][2];\n"
+ " float cof21 = -(m[0][0] * m[1][2] - m[1][0] * m[0][2]);\n"
+ " float cof22 = m[0][0] * m[1][1] - m[1][0] * m[0][1];\n"
+ " float3x3 cof = { cof00, cof10, cof20, cof01, cof11, cof21, cof02, cof12, cof22 };\n"
+ " return cof / determinant(transpose(m));\n"
+ "}\n"},
+ {BuiltInId::inverse_Float4x4,
+ "float4x4 inverse_emu(in float4x4 m)\n"
+ "{\n"
+ " float cof00 = m[1][1] * m[2][2] * m[3][3] + m[2][1] * m[3][2] * m[1][3] + m[3][1] * \n"
+ " m[1][2] * m[2][3]\n"
+ " - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] - m[3][1] * m[2][2] * \n"
+ " m[1][3];\n"
+ " float cof01 = -(m[1][0] * m[2][2] * m[3][3] + m[2][0] * m[3][2] * m[1][3] + m[3][0] * \n"
+ " m[1][2] * m[2][3]\n"
+ " - m[1][0] * m[3][2] * m[2][3] - m[2][0] * m[1][2] * m[3][3] - m[3][0] * m[2][2] * \n"
+ " m[1][3]);\n"
+ " float cof02 = m[1][0] * m[2][1] * m[3][3] + m[2][0] * m[3][1] * m[1][3] + m[3][0] * \n"
+ " m[1][1] * m[2][3]\n"
+ " - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] - m[3][0] * m[2][1] * \n"
+ " m[1][3];\n"
+ " float cof03 = -(m[1][0] * m[2][1] * m[3][2] + m[2][0] * m[3][1] * m[1][2] + m[3][0] * \n"
+ " m[1][1] * m[2][2]\n"
+ " - m[1][0] * m[3][1] * m[2][2] - m[2][0] * m[1][1] * m[3][2] - m[3][0] * m[2][1] * \n"
+ " m[1][2]);\n"
+ " float cof10 = -(m[0][1] * m[2][2] * m[3][3] + m[2][1] * m[3][2] * m[0][3] + m[3][1] * \n"
+ " m[0][2] * m[2][3]\n"
+ " - m[0][1] * m[3][2] * m[2][3] - m[2][1] * m[0][2] * m[3][3] - m[3][1] * m[2][2] * \n"
+ " m[0][3]);\n"
+ " float cof11 = m[0][0] * m[2][2] * m[3][3] + m[2][0] * m[3][2] * m[0][3] + m[3][0] * \n"
+ " m[0][2] * m[2][3]\n"
+ " - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] - m[3][0] * m[2][2] * \n"
+ " m[0][3];\n"
+ " float cof12 = -(m[0][0] * m[2][1] * m[3][3] + m[2][0] * m[3][1] * m[0][3] + m[3][0] * \n"
+ " m[0][1] * m[2][3]\n"
+ " - m[0][0] * m[3][1] * m[2][3] - m[2][0] * m[0][1] * m[3][3] - m[3][0] * m[2][1] * \n"
+ " m[0][3]);\n"
+ " float cof13 = m[0][0] * m[2][1] * m[3][2] + m[2][0] * m[3][1] * m[0][2] + m[3][0] * \n"
+ " m[0][1] * m[2][2]\n"
+ " - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] - m[3][0] * m[2][1] * \n"
+ " m[0][2];\n"
+ " float cof20 = m[0][1] * m[1][2] * m[3][3] + m[1][1] * m[3][2] * m[0][3] + m[3][1] * \n"
+ " m[0][2] * m[1][3]\n"
+ " - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] - m[3][1] * m[1][2] * \n"
+ " m[0][3];\n"
+ " float cof21 = -(m[0][0] * m[1][2] * m[3][3] + m[1][0] * m[3][2] * m[0][3] + m[3][0] * \n"
+ " m[0][2] * m[1][3]\n"
+ " - m[0][0] * m[3][2] * m[1][3] - m[1][0] * m[0][2] * m[3][3] - m[3][0] * m[1][2] * \n"
+ " m[0][3]);\n"
+ " float cof22 = m[0][0] * m[1][1] * m[3][3] + m[1][0] * m[3][1] * m[0][3] + m[3][0] * \n"
+ " m[0][1] * m[1][3]\n"
+ " - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] - m[3][0] * m[1][1] * \n"
+ " m[0][3];\n"
+ " float cof23 = -(m[0][0] * m[1][1] * m[3][2] + m[1][0] * m[3][1] * m[0][2] + m[3][0] * \n"
+ " m[0][1] * m[1][2]\n"
+ " - m[0][0] * m[3][1] * m[1][2] - m[1][0] * m[0][1] * m[3][2] - m[3][0] * m[1][1] * \n"
+ " m[0][2]);\n"
+ " float cof30 = -(m[0][1] * m[1][2] * m[2][3] + m[1][1] * m[2][2] * m[0][3] + m[2][1] * \n"
+ " m[0][2] * m[1][3]\n"
+ " - m[0][1] * m[2][2] * m[1][3] - m[1][1] * m[0][2] * m[2][3] - m[2][1] * m[1][2] * \n"
+ " m[0][3]);\n"
+ " float cof31 = m[0][0] * m[1][2] * m[2][3] + m[1][0] * m[2][2] * m[0][3] + m[2][0] * \n"
+ " m[0][2] * m[1][3]\n"
+ " - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] - m[2][0] * m[1][2] * \n"
+ " m[0][3];\n"
+ " float cof32 = -(m[0][0] * m[1][1] * m[2][3] + m[1][0] * m[2][1] * m[0][3] + m[2][0] * \n"
+ " m[0][1] * m[1][3]\n"
+ " - m[0][0] * m[2][1] * m[1][3] - m[1][0] * m[0][1] * m[2][3] - m[2][0] * m[1][1] * \n"
+ " m[0][3]);\n"
+ " float cof33 = m[0][0] * m[1][1] * m[2][2] + m[1][0] * m[2][1] * m[0][2] + m[2][0] * \n"
+ " m[0][1] * m[1][2]\n"
+ " - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] - m[2][0] * m[1][1] * \n"
+ " m[0][2];\n"
+ " float4x4 cof = { cof00, cof10, cof20, cof30, cof01, cof11, cof21, cof31,\n"
+ " cof02, cof12, cof22, cof32, cof03, cof13, cof23, cof33 };\n"
+ " return cof / determinant(transpose(m));\n"
+ "}\n"},
+ // Emulate ESSL3 variant of mix that takes last argument as boolean vector.
+ // genType mix(genType x, genType y, genBType a): Selects which vector each returned component
+ // comes from. For a component of 'a' that is false, the corresponding component of 'x' is
+ // returned. For a component of 'a' that is true, the corresponding component of 'y' is
+ // returned.
+ {BuiltInId::mix_Float1_Float1_Bool1,
+ "float mix_emu(float x, float y, bool a)\n"
+ "{\n"
+ " return a ? y : x;\n"
+ "}\n"},
+ {BuiltInId::mix_Float2_Float2_Bool2,
+ "float2 mix_emu(float2 x, float2 y, bool2 a)\n"
+ "{\n"
+ " return a ? y : x;\n"
+ "}\n"},
+ {BuiltInId::mix_Float3_Float3_Bool3,
+ "float3 mix_emu(float3 x, float3 y, bool3 a)\n"
+ "{\n"
+ " return a ? y : x;\n"
+ "}\n"},
+ {BuiltInId::mix_Float4_Float4_Bool4,
+ "float4 mix_emu(float4 x, float4 y, bool4 a)\n"
+ "{\n"
+ " return a ? y : x;\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_UInt1_Int1_Int1,
+ "uint bitfieldExtract_emu(uint value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return 0u;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " return (value & mask) >> offset;\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_UInt2_Int1_Int1,
+ "uint2 bitfieldExtract_emu(uint2 value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return uint2(0u, 0u);\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " return (value & mask) >> offset;\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_UInt3_Int1_Int1,
+ "uint3 bitfieldExtract_emu(uint3 value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return uint3(0u, 0u, 0u);\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " return (value & mask) >> offset;\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_UInt4_Int1_Int1,
+ "uint4 bitfieldExtract_emu(uint4 value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return uint4(0u, 0u, 0u, 0u);\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " return (value & mask) >> offset;\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_Int1_Int1_Int1,
+ "int bitfieldExtract_emu(int value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return 0;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint resultUnsigned = (asuint(value) & mask) >> offset;\n"
+ " if (bits != 32 && (resultUnsigned & maskMsb) != 0)\n"
+ " {\n"
+ " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;\n"
+ " resultUnsigned |= higherBitsMask;\n"
+ " }\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_Int2_Int1_Int1,
+ "int2 bitfieldExtract_emu(int2 value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return int2(0, 0);\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint2 resultUnsigned = (asuint(value) & mask) >> offset;\n"
+ " if (bits != 32)\n"
+ " {\n"
+ " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;\n"
+ " resultUnsigned |= ((resultUnsigned & maskMsb) >> (bits - 1)) * higherBitsMask;\n"
+ " }\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_Int3_Int1_Int1,
+ "int3 bitfieldExtract_emu(int3 value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return int3(0, 0, 0);\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint3 resultUnsigned = (asuint(value) & mask) >> offset;\n"
+ " if (bits != 32)\n"
+ " {\n"
+ " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;\n"
+ " resultUnsigned |= ((resultUnsigned & maskMsb) >> (bits - 1)) * higherBitsMask;\n"
+ " }\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::bitfieldExtract_Int4_Int1_Int1,
+ "int4 bitfieldExtract_emu(int4 value, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return int4(0, 0, 0, 0);\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint4 resultUnsigned = (asuint(value) & mask) >> offset;\n"
+ " if (bits != 32)\n"
+ " {\n"
+ " uint higherBitsMask = ((1u << (32 - bits)) - 1u) << bits;\n"
+ " resultUnsigned |= ((resultUnsigned & maskMsb) >> (bits - 1)) * higherBitsMask;\n"
+ " }\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_UInt1_UInt1_Int1_Int1,
+ "uint bitfieldInsert_emu(uint base, uint insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " return (base & baseMask) | ((insert << offset) & insertMask);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_UInt2_UInt2_Int1_Int1,
+ "uint2 bitfieldInsert_emu(uint2 base, uint2 insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " return (base & baseMask) | ((insert << offset) & insertMask);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_UInt3_UInt3_Int1_Int1,
+ "uint3 bitfieldInsert_emu(uint3 base, uint3 insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " return (base & baseMask) | ((insert << offset) & insertMask);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_UInt4_UInt4_Int1_Int1,
+ "uint4 bitfieldInsert_emu(uint4 base, uint4 insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " return (base & baseMask) | ((insert << offset) & insertMask);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_Int1_Int1_Int1_Int1,
+ "int bitfieldInsert_emu(int base, int insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " uint resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & \n"
+ " insertMask);\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_Int2_Int2_Int1_Int1,
+ "int2 bitfieldInsert_emu(int2 base, int2 insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " uint2 resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & \n"
+ " insertMask);\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_Int3_Int3_Int1_Int1,
+ "int3 bitfieldInsert_emu(int3 base, int3 insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " uint3 resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & \n"
+ " insertMask);\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::bitfieldInsert_Int4_Int4_Int1_Int1,
+ "int4 bitfieldInsert_emu(int4 base, int4 insert, int offset, int bits)\n"
+ "{\n"
+ " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n"
+ " {\n"
+ " return base;\n"
+ " }\n"
+ " uint maskMsb = (1u << (bits - 1));\n"
+ " uint insertMask = ((maskMsb - 1u) | maskMsb) << offset;\n"
+ " uint baseMask = ~insertMask;\n"
+ " uint4 resultUnsigned = (asuint(base) & baseMask) | ((asuint(insert) << offset) & \n"
+ " insertMask);\n"
+ " return asint(resultUnsigned);\n"
+ "}\n"},
+ {BuiltInId::uaddCarry_UInt1_UInt1_UInt1,
+ "uint uaddCarry_emu(uint x, uint y, out uint carry)\n"
+ "{\n"
+ " carry = uint(x > (0xffffffffu - y));\n"
+ " return x + y;\n"
+ "}\n"},
+ {BuiltInId::uaddCarry_UInt2_UInt2_UInt2,
+ "uint2 uaddCarry_emu(uint2 x, uint2 y, out uint2 carry)\n"
+ "{\n"
+ " carry = uint2(x > (0xffffffffu - y));\n"
+ " return x + y;\n"
+ "}\n"},
+ {BuiltInId::uaddCarry_UInt3_UInt3_UInt3,
+ "uint3 uaddCarry_emu(uint3 x, uint3 y, out uint3 carry)\n"
+ "{\n"
+ " carry = uint3(x > (0xffffffffu - y));\n"
+ " return x + y;\n"
+ "}\n"},
+ {BuiltInId::uaddCarry_UInt4_UInt4_UInt4,
+ "uint4 uaddCarry_emu(uint4 x, uint4 y, out uint4 carry)\n"
+ "{\n"
+ " carry = uint4(x > (0xffffffffu - y));\n"
+ " return x + y;\n"
+ "}\n"},
+ {BuiltInId::usubBorrow_UInt1_UInt1_UInt1,
+ "uint usubBorrow_emu(uint x, uint y, out uint borrow)\n"
+ "{\n"
+ " borrow = uint(x < y);\n"
+ " return x - y;\n"
+ "}\n"},
+ {BuiltInId::usubBorrow_UInt2_UInt2_UInt2,
+ "uint2 usubBorrow_emu(uint2 x, uint2 y, out uint2 borrow)\n"
+ "{\n"
+ " borrow = uint2(x < y);\n"
+ " return x - y;\n"
+ "}\n"},
+ {BuiltInId::usubBorrow_UInt3_UInt3_UInt3,
+ "uint3 usubBorrow_emu(uint3 x, uint3 y, out uint3 borrow)\n"
+ "{\n"
+ " borrow = uint3(x < y);\n"
+ " return x - y;\n"
+ "}\n"},
+ {BuiltInId::usubBorrow_UInt4_UInt4_UInt4,
+ "uint4 usubBorrow_emu(uint4 x, uint4 y, out uint4 borrow)\n"
+ "{\n"
+ " borrow = uint4(x < y);\n"
+ " return x - y;\n"
+ "}\n"},
+ // We emulate tanh just to avoid overflow on large arguments.
+ {BuiltInId::tanh_Float1,
+ "float tanh_emu(float x)\n"
+ "{\n"
+ " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n"
+ "}\n"},
+ {BuiltInId::tanh_Float2,
+ "float2 tanh_emu(float2 x)\n"
+ "{\n"
+ " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n"
+ "}\n"},
+ {BuiltInId::tanh_Float3,
+ "float3 tanh_emu(float3 x)\n"
+ "{\n"
+ " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n"
+ "}\n"},
+ {BuiltInId::tanh_Float4,
+ "float4 tanh_emu(float4 x)\n"
+ "{\n"
+ " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n"
+ "}\n"},
+};
+} // anonymous namespace
+
+const char *FindHLSLFunction(int uniqueId)
+{
+ for (size_t index = 0; index < ArraySize(g_hlslFunctions); ++index)
+ {
+ const auto &function = g_hlslFunctions[index];
+ if (function.id == uniqueId)
+ {
+ return function.body;
+ }
+ }
+
+ return nullptr;
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/glslang.h b/gfx/angle/checkout/src/compiler/translator/glslang.h
new file mode 100644
index 0000000000..e54c31ba3e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/glslang.h
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_GLSLANG_H_
+#define COMPILER_TRANSLATOR_GLSLANG_H_
+
+namespace sh
+{
+class TParseContext;
+}
+
+extern int glslang_initialize(sh::TParseContext *context);
+extern int glslang_finalize(sh::TParseContext *context);
+
+extern int glslang_scan(size_t count,
+ const char *const string[],
+ const int length[],
+ sh::TParseContext *context);
+extern int glslang_parse(sh::TParseContext *context);
+
+#endif // COMPILER_TRANSLATOR_GLSLANG_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/glslang_lex.cpp b/gfx/angle/checkout/src/compiler/translator/glslang_lex.cpp
new file mode 100644
index 0000000000..3a65f1ebce
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/glslang_lex.cpp
@@ -0,0 +1,4108 @@
+#line 17 "./glslang.l"
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
+
+/* clang-format off */
+
+// Ignore errors in auto-generated code.
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wswitch-enum"
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#elif defined(_MSC_VER)
+#pragma warning(disable: 4005)
+#pragma warning(disable: 4065)
+#pragma warning(disable: 4189)
+#pragma warning(disable: 4244)
+#pragma warning(disable: 4505)
+#pragma warning(disable: 4701)
+#pragma warning(disable: 4702)
+#endif
+#if defined(__clang__)
+#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+// Flex isn't semi-colon clean.
+#pragma clang diagnostic ignored "-Wextra-semi-stmt"
+#endif
+
+
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+
+
+
+
+
+
+
+
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 4
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#ifdef yyget_lval
+#define yyget_lval_ALREADY_DEFINED
+#else
+#define yyget_lval yyget_lval
+#endif
+
+
+#ifdef yyset_lval
+#define yyset_lval_ALREADY_DEFINED
+#else
+#define yyset_lval yyset_lval
+#endif
+
+
+
+
+
+#ifdef yyget_lloc
+#define yyget_lloc_ALREADY_DEFINED
+#else
+#define yyget_lloc yyget_lloc
+#endif
+
+
+#ifdef yyset_lloc
+#define yyset_lloc_ALREADY_DEFINED
+#else
+#define yyset_lloc yyset_lloc
+#endif
+
+
+
+
+
+
+
+
+
+
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#ifndef SIZE_MAX
+#define SIZE_MAX (~(size_t)0)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+
+/* begin standard C++ headers. */
+
+/* TODO: this is always defined, so inline it */
+#define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define yynoreturn __attribute__((__noreturn__))
+#else
+#define yynoreturn
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+
+/* Promotes a possibly negative, possibly signed char to an
+ * integer in range [0..255] for use as an array index.
+ */
+#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
+
+
+
+
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* For convenience, these vars (plus the bison vars far below)
+ are macros in the reentrant scanner. */
+#define yyin yyg->yyin_r
+#define yyout yyg->yyout_r
+#define yyextra yyg->yyextra_r
+#define yyleng yyg->yyleng_r
+#define yytext yyg->yytext_r
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug yyg->yy_flex_debug_r
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yyg->yy_start = 1 + 2 *
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yyg->yy_start - 1) / 2)
+#define YYSTATE YY_START
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin , yyscanner )
+#define YY_END_OF_BUFFER_CHAR 0
+
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+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
+
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE yylex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ int yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
+ #define YY_LINENO_REWIND_TO(dst) \
+ do {\
+ const char *p;\
+ for ( p = yy_cp-1; p >= (dst); --p)\
+ if ( *p == '\n' )\
+ --yylineno;\
+ }while(0)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *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 )
+#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ int yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int 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
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* 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;
+
+ /* 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;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* 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.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+
+
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
+ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
+ : NULL)
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+
+
+
+
+
+void yyrestart ( FILE *input_file , yyscan_t yyscanner );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
+void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+void yypop_buffer_state ( yyscan_t yyscanner );
+
+
+static void yyensure_buffer_stack ( yyscan_t yyscanner );
+static void yy_load_buffer_state ( yyscan_t yyscanner );
+static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
+
+
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
+
+
+void *yyalloc ( yy_size_t , yyscan_t yyscanner );
+void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
+void yyfree ( void * , yyscan_t yyscanner );
+
+
+#define yy_new_buffer yy_create_buffer
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (yyscanner); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (yyscanner); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+
+/* Begin user sect3 */
+
+#define yywrap(yyscanner) (/*CONSTCOND*/1)
+#define YY_SKIP_YYWRAP
+typedef flex_uint8_t YY_CHAR;
+
+
+typedef int yy_state_type;
+
+#define yytext_ptr yytext_r
+
+
+
+
+
+
+static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
+static int yy_get_next_buffer ( yyscan_t yyscanner );
+static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
+
+
+
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yyg->yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yyg->yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yyg->yy_c_buf_p = yy_cp;
+#define YY_NUM_RULES 247
+#define YY_END_OF_BUFFER 248
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static const flex_int16_t yy_accept[891] =
+ { 0,
+ 0, 0, 0, 0, 248, 246, 245, 245, 229, 235,
+ 240, 224, 225, 233, 232, 221, 230, 228, 234, 187,
+ 187, 222, 218, 236, 223, 237, 241, 184, 226, 227,
+ 239, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 219, 238, 220, 231, 244, 243, 247,
+ 242, 215, 201, 220, 209, 204, 199, 207, 197, 208,
+ 198, 193, 200, 192, 186, 187, 0, 190, 0, 227,
+ 219, 226, 216, 212, 214, 213, 217, 184, 205, 211,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+
+ 184, 184, 184, 184, 13, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 16, 184,
+ 184, 24, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 206, 210, 242,
+ 0, 196, 192, 0, 195, 189, 0, 191, 185, 202,
+ 203, 184, 184, 144, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 14, 184,
+
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 29,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 25, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 0,
+ 193, 0, 192, 194, 188, 184, 184, 184, 184, 32,
+ 184, 184, 184, 19, 181, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 17, 147, 184, 184, 184,
+ 184, 22, 184, 184, 151, 162, 184, 184, 184, 184,
+
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 159,
+ 4, 37, 38, 39, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 150,
+ 33, 184, 184, 30, 184, 184, 184, 184, 184, 184,
+ 184, 49, 50, 51, 31, 184, 184, 184, 184, 184,
+ 184, 184, 184, 11, 184, 55, 56, 57, 184, 145,
+ 184, 184, 7, 184, 184, 184, 184, 171, 172, 173,
+ 184, 34, 184, 163, 28, 174, 175, 176, 2, 168,
+ 169, 170, 184, 184, 184, 26, 166, 184, 184, 184,
+
+ 184, 184, 52, 53, 54, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 112, 184, 184, 184,
+ 184, 184, 184, 184, 184, 160, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 146, 184, 184,
+ 183, 58, 59, 60, 184, 184, 15, 184, 184, 184,
+ 117, 184, 184, 9, 184, 184, 115, 184, 184, 184,
+ 161, 156, 118, 184, 184, 184, 184, 184, 184, 152,
+ 184, 184, 184, 184, 184, 87, 40, 43, 45, 44,
+ 41, 47, 46, 48, 42, 184, 184, 184, 184, 167,
+ 143, 184, 184, 154, 184, 184, 184, 36, 113, 27,
+
+ 180, 23, 155, 86, 184, 165, 18, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 20, 35, 184, 184, 184, 184, 184,
+ 184, 119, 92, 98, 184, 184, 184, 184, 184, 89,
+ 91, 3, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 148, 184, 184, 184, 184, 184, 8,
+ 184, 184, 10, 184, 184, 184, 184, 184, 184, 21,
+ 106, 12, 157, 120, 93, 100, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 153,
+ 184, 184, 184, 104, 110, 107, 184, 184, 184, 184,
+
+ 184, 184, 184, 149, 121, 94, 99, 184, 184, 164,
+ 184, 108, 184, 184, 184, 184, 6, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 103, 158, 1, 184,
+ 184, 184, 184, 184, 184, 182, 184, 116, 5, 177,
+ 61, 64, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 105, 184, 184, 184, 184,
+ 184, 184, 101, 184, 184, 184, 184, 184, 134, 69,
+ 70, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 114, 184, 184, 184, 102,
+ 136, 74, 75, 184, 184, 184, 184, 109, 184, 184,
+
+ 184, 184, 184, 184, 184, 129, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 68, 184, 184,
+ 184, 184, 62, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 130, 122, 184,
+ 95, 184, 184, 184, 73, 184, 184, 71, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 131, 184, 184, 78, 184, 184, 76, 184,
+ 184, 123, 96, 184, 125, 184, 126, 184, 184, 184,
+ 184, 184, 184, 111, 184, 184, 184, 184, 66, 184,
+ 65, 140, 184, 184, 124, 97, 184, 184, 184, 184,
+
+ 184, 184, 184, 184, 184, 184, 184, 184, 138, 141,
+ 184, 132, 184, 67, 184, 184, 184, 184, 184, 184,
+ 184, 184, 139, 142, 184, 184, 184, 184, 135, 72,
+ 184, 184, 184, 178, 184, 184, 184, 79, 184, 184,
+ 137, 77, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 83, 184, 184, 184, 184, 184, 184, 184, 184,
+ 84, 184, 184, 184, 184, 80, 184, 85, 88, 184,
+ 127, 128, 90, 184, 184, 184, 63, 184, 184, 184,
+ 179, 184, 133, 81, 184, 184, 184, 184, 82, 0
+ } ;
+
+static const YY_CHAR yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 4, 1, 1, 1, 5, 6, 1, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 1, 31, 32, 33, 34, 35, 36,
+ 37, 37, 37, 37, 37, 37, 38, 37, 39, 37,
+ 37, 40, 41, 42, 43, 37, 37, 44, 45, 37,
+ 46, 1, 47, 48, 49, 1, 50, 51, 52, 53,
+
+ 54, 55, 56, 57, 58, 37, 59, 60, 61, 62,
+ 63, 64, 37, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static const YY_CHAR yy_meta[78] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 1, 2, 3, 1, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 1, 1, 1, 1, 1, 1,
+ 5, 5, 5, 5, 6, 7, 8, 8, 8, 8,
+ 8, 8, 9, 8, 8, 1, 1, 1, 8, 5,
+ 5, 5, 5, 6, 7, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 9, 8, 8,
+ 8, 8, 8, 1, 1, 1, 1
+ } ;
+
+static const flex_int16_t yy_base[900] =
+ { 0,
+ 0, 0, 77, 0, 1094, 1095, 1095, 1095, 1065, 127,
+ 151, 1095, 1095, 1064, 148, 1095, 147, 145, 1063, 167,
+ 158, 1061, 1095, 167, 1061, 145, 1095, 0, 1095, 1095,
+ 149, 1039, 147, 135, 155, 162, 146, 174, 1024, 172,
+ 178, 179, 169, 196, 1018, 198, 1031, 200, 197, 213,
+ 202, 113, 1016, 1095, 153, 1095, 1095, 1095, 1095, 1095,
+ 0, 1095, 1095, 1095, 1095, 1095, 1095, 1095, 1095, 1095,
+ 1095, 237, 1095, 241, 237, 271, 243, 1095, 0, 1095,
+ 1095, 1095, 1055, 1095, 1095, 1095, 1054, 0, 1095, 1095,
+ 1015, 1013, 1018, 197, 1015, 1023, 1021, 1021, 1008, 1011,
+
+ 1022, 226, 1016, 1004, 1001, 1014, 1001, 998, 998, 1004,
+ 136, 235, 998, 1008, 994, 1000, 1003, 1004, 0, 996,
+ 1006, 230, 1005, 986, 999, 980, 216, 984, 997, 988,
+ 243, 981, 237, 993, 995, 250, 984, 259, 971, 980,
+ 253, 259, 984, 980, 982, 971, 974, 250, 255, 269,
+ 983, 971, 983, 266, 976, 975, 963, 1095, 1095, 0,
+ 318, 1095, 296, 323, 1095, 1095, 325, 324, 206, 1095,
+ 1095, 981, 972, 0, 968, 963, 967, 976, 970, 972,
+ 298, 956, 956, 967, 959, 271, 969, 966, 966, 964,
+ 961, 953, 959, 946, 944, 956, 942, 958, 0, 955,
+
+ 943, 950, 947, 951, 952, 945, 942, 931, 930, 943,
+ 946, 934, 945, 941, 929, 935, 926, 336, 931, 934,
+ 925, 932, 921, 925, 916, 930, 929, 920, 926, 294,
+ 910, 913, 911, 910, 920, 910, 905, 903, 905, 915,
+ 901, 903, 900, 911, 910, 913, 895, 301, 903, 899,
+ 897, 906, 885, 349, 903, 905, 894, 886, 919, 354,
+ 370, 368, 383, 1095, 1095, 890, 881, 891, 890, 0,
+ 888, 892, 379, 0, 0, 880, 878, 878, 879, 874,
+ 882, 871, 888, 877, 382, 0, 0, 871, 881, 880,
+ 880, 0, 865, 385, 0, 0, 867, 390, 874, 875,
+
+ 866, 860, 859, 860, 859, 859, 337, 393, 854, 0,
+ 0, 850, 849, 848, 850, 851, 856, 850, 846, 859,
+ 854, 854, 852, 851, 845, 839, 841, 840, 844, 849,
+ 835, 838, 833, 841, 846, 834, 831, 843, 834, 0,
+ 0, 840, 836, 0, 828, 828, 833, 824, 831, 396,
+ 828, 0, 0, 0, 0, 818, 830, 829, 816, 817,
+ 826, 827, 827, 0, 812, 0, 0, 0, 813, 0,
+ 821, 812, 0, 811, 812, 806, 816, 0, 0, 0,
+ 807, 0, 803, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 813, 400, 812, 0, 0, 810, 806, 803,
+
+ 847, 846, 0, 0, 0, 793, 403, 409, 412, 798,
+ 794, 799, 790, 788, 801, 786, 0, 786, 799, 788,
+ 784, 790, 785, 792, 792, 0, 789, 786, 790, 774,
+ 772, 775, 781, 787, 782, 781, 769, 0, 771, 772,
+ 0, 0, 0, 0, 769, 772, 0, 766, 776, 767,
+ 0, 777, 757, 0, 766, 761, 0, 754, 754, 767,
+ 0, 769, 0, 418, 784, 783, 782, 747, 746, 0,
+ 763, 762, 757, 794, 785, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 744, 757, 744, 741, 0,
+ 0, 746, 745, 0, 742, 749, 748, 0, 734, 0,
+
+ 0, 0, 0, 0, 731, 0, 0, 730, 741, 423,
+ 734, 740, 739, 736, 731, 728, 748, 734, 719, 719,
+ 732, 717, 729, 0, 0, 722, 747, 746, 745, 710,
+ 709, 406, 411, 0, 721, 724, 722, 711, 707, 722,
+ 0, 0, 718, 715, 714, 704, 703, 693, 710, 696,
+ 427, 704, 707, 0, 726, 725, 724, 689, 688, 0,
+ 702, 689, 0, 699, 692, 684, 685, 691, 694, 0,
+ 0, 0, 0, 716, 715, 0, 690, 693, 678, 685,
+ 676, 683, 684, 684, 683, 669, 447, 680, 680, 0,
+ 681, 670, 669, 0, 0, 0, 696, 695, 694, 659,
+
+ 658, 654, 662, 0, 692, 691, 0, 666, 669, 0,
+ 450, 0, 647, 668, 682, 654, 0, 650, 649, 658,
+ 658, 646, 660, 644, 658, 653, 0, 0, 0, 672,
+ 671, 670, 635, 634, 633, 0, 633, 0, 0, 417,
+ 446, 659, 643, 646, 629, 641, 629, 628, 637, 637,
+ 656, 655, 654, 619, 618, 0, 623, 613, 616, 617,
+ 616, 626, 0, 629, 625, 627, 623, 610, 643, 438,
+ 0, 618, 621, 611, 612, 604, 611, 602, 625, 611,
+ 607, 609, 607, 607, 606, 0, 594, 593, 603, 0,
+ 625, 450, 0, 600, 603, 600, 585, 0, 601, 600,
+
+ 584, 576, 584, 574, 582, 0, 579, 578, 601, 587,
+ 585, 585, 578, 568, 571, 585, 569, 602, 580, 581,
+ 578, 575, 587, 562, 576, 575, 559, 558, 557, 580,
+ 566, 564, 564, 567, 562, 543, 542, 0, 572, 542,
+ 570, 540, 544, 543, 576, 554, 551, 0, 555, 548,
+ 549, 539, 538, 519, 502, 515, 499, 162, 258, 258,
+ 257, 290, 0, 298, 316, 363, 353, 369, 0, 359,
+ 381, 0, 0, 392, 0, 396, 0, 404, 407, 396,
+ 403, 406, 407, 0, 401, 411, 403, 420, 448, 428,
+ 0, 0, 442, 443, 0, 0, 444, 445, 431, 430,
+
+ 433, 446, 438, 451, 452, 431, 432, 440, 0, 0,
+ 456, 466, 438, 468, 460, 454, 442, 460, 454, 443,
+ 444, 452, 0, 0, 483, 469, 467, 468, 0, 0,
+ 472, 461, 467, 0, 468, 454, 477, 0, 465, 490,
+ 0, 0, 480, 487, 472, 470, 471, 463, 480, 487,
+ 488, 0, 486, 470, 506, 470, 501, 527, 475, 476,
+ 0, 493, 495, 496, 487, 0, 510, 0, 0, 518,
+ 0, 0, 0, 490, 491, 485, 0, 511, 487, 488,
+ 0, 542, 0, 0, 515, 526, 518, 521, 0, 1095,
+ 561, 567, 573, 579, 583, 589, 590, 596, 599
+
+ } ;
+
+static const flex_int16_t yy_def[900] =
+ { 0,
+ 890, 1, 890, 3, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 891, 890, 890, 890, 890, 890, 890, 892, 890, 890,
+ 890, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 890, 890, 890, 890, 890, 890, 890,
+ 893, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 894, 890, 895, 20, 891, 896, 890, 897, 890,
+ 890, 890, 890, 890, 890, 890, 890, 892, 890, 890,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 890, 890, 893,
+ 898, 890, 895, 899, 890, 890, 890, 896, 897, 890,
+ 890, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 890,
+ 898, 890, 899, 890, 890, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 892,
+ 892, 892, 892, 892, 892, 892, 892, 892, 892, 0,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890
+
+ } ;
+
+static const flex_int16_t yy_nxt[1173] =
+ { 0,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 22, 23, 24, 25, 26, 27,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 28, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 28, 53, 28, 54, 55, 56, 57, 58, 59, 60,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+
+ 58, 58, 58, 58, 58, 58, 58, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 58, 58, 58, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
+ 58, 58, 58, 58, 63, 64, 65, 68, 70, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 155,
+ 74, 81, 86, 87, 71, 69, 89, 156, 66, 74,
+ 158, 75, 75, 75, 75, 75, 75, 75, 75, 76,
+ 76, 82, 77, 83, 84, 195, 90, 95, 92, 96,
+
+ 78, 77, 97, 98, 99, 107, 196, 108, 100, 78,
+ 79, 77, 93, 94, 101, 103, 109, 102, 128, 104,
+ 77, 116, 129, 110, 105, 78, 792, 159, 126, 117,
+ 106, 111, 119, 112, 78, 120, 113, 79, 121, 122,
+ 118, 127, 114, 123, 124, 130, 125, 133, 265, 137,
+ 144, 152, 167, 145, 167, 153, 138, 139, 131, 175,
+ 140, 146, 134, 176, 154, 135, 141, 142, 147, 143,
+ 148, 161, 162, 265, 149, 164, 165, 216, 150, 166,
+ 890, 151, 184, 74, 197, 217, 185, 186, 224, 207,
+ 161, 162, 208, 209, 164, 165, 210, 198, 211, 229,
+
+ 221, 225, 237, 226, 166, 77, 222, 890, 233, 239,
+ 246, 247, 248, 78, 793, 230, 231, 238, 250, 794,
+ 249, 234, 240, 255, 77, 256, 251, 260, 795, 260,
+ 164, 165, 262, 890, 262, 890, 280, 281, 78, 168,
+ 168, 168, 168, 168, 168, 168, 168, 168, 168, 164,
+ 165, 274, 312, 313, 314, 345, 326, 401, 402, 264,
+ 327, 796, 797, 346, 275, 352, 353, 354, 261, 261,
+ 261, 261, 261, 261, 261, 261, 261, 261, 264, 890,
+ 798, 890, 263, 263, 263, 263, 263, 263, 263, 263,
+ 263, 263, 890, 799, 890, 366, 367, 368, 378, 379,
+
+ 380, 386, 387, 388, 800, 162, 390, 391, 392, 403,
+ 404, 405, 442, 443, 444, 465, 466, 467, 165, 477,
+ 478, 479, 801, 802, 162, 480, 481, 482, 483, 484,
+ 485, 468, 469, 527, 528, 529, 579, 165, 555, 556,
+ 557, 581, 597, 598, 599, 803, 580, 676, 804, 530,
+ 531, 582, 805, 806, 558, 559, 807, 677, 600, 601,
+ 808, 602, 630, 631, 632, 651, 652, 653, 708, 809,
+ 810, 811, 812, 813, 814, 709, 678, 710, 633, 634,
+ 729, 654, 655, 679, 815, 680, 681, 730, 816, 731,
+ 817, 818, 819, 820, 821, 822, 823, 824, 825, 826,
+
+ 827, 828, 829, 830, 831, 832, 833, 834, 835, 836,
+ 837, 838, 839, 840, 841, 842, 843, 844, 845, 846,
+ 847, 848, 849, 850, 851, 852, 853, 854, 855, 856,
+ 857, 858, 859, 860, 861, 862, 863, 864, 865, 866,
+ 867, 868, 869, 870, 871, 872, 873, 874, 875, 876,
+ 877, 878, 879, 880, 881, 882, 883, 884, 885, 886,
+ 887, 888, 889, 76, 76, 791, 76, 790, 789, 76,
+ 88, 88, 88, 88, 88, 88, 160, 160, 160, 160,
+ 160, 160, 72, 788, 72, 72, 163, 787, 163, 163,
+ 168, 786, 168, 169, 169, 169, 169, 261, 785, 261,
+
+ 263, 784, 263, 783, 782, 781, 780, 779, 778, 777,
+ 776, 775, 774, 773, 772, 771, 770, 769, 768, 767,
+ 766, 765, 764, 763, 762, 761, 760, 759, 758, 757,
+ 756, 755, 754, 753, 752, 751, 750, 749, 748, 747,
+ 746, 745, 744, 743, 742, 741, 740, 739, 738, 737,
+ 736, 735, 734, 733, 732, 728, 727, 726, 725, 724,
+ 723, 722, 721, 720, 719, 718, 717, 716, 715, 714,
+ 713, 712, 711, 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, 675,
+
+ 674, 673, 672, 671, 670, 669, 668, 667, 666, 665,
+ 664, 663, 662, 661, 660, 659, 658, 657, 656, 650,
+ 649, 648, 647, 646, 645, 644, 643, 642, 641, 640,
+ 639, 638, 637, 636, 635, 629, 628, 627, 626, 625,
+ 624, 623, 622, 621, 620, 619, 618, 617, 616, 615,
+ 614, 613, 612, 611, 610, 609, 608, 607, 606, 605,
+ 604, 603, 596, 595, 594, 593, 592, 591, 590, 589,
+ 588, 587, 586, 585, 584, 583, 578, 577, 576, 575,
+ 574, 573, 572, 571, 570, 569, 568, 567, 566, 565,
+ 564, 563, 562, 561, 560, 554, 553, 552, 551, 550,
+
+ 549, 548, 547, 546, 545, 544, 543, 542, 541, 540,
+ 539, 538, 537, 536, 535, 534, 533, 532, 526, 525,
+ 524, 523, 522, 521, 520, 519, 518, 517, 516, 515,
+ 514, 513, 512, 511, 510, 509, 508, 507, 506, 505,
+ 504, 503, 502, 501, 500, 499, 498, 497, 496, 495,
+ 494, 493, 492, 491, 490, 489, 488, 487, 486, 476,
+ 475, 474, 473, 472, 471, 470, 464, 463, 462, 461,
+ 460, 459, 458, 457, 456, 455, 454, 453, 452, 451,
+ 450, 449, 448, 447, 446, 445, 441, 440, 439, 438,
+ 437, 436, 435, 434, 433, 432, 431, 430, 429, 428,
+
+ 427, 426, 425, 424, 423, 422, 421, 420, 419, 418,
+ 417, 416, 415, 414, 413, 412, 411, 410, 409, 408,
+ 407, 406, 400, 399, 398, 397, 396, 395, 394, 393,
+ 389, 385, 384, 383, 382, 381, 377, 376, 375, 374,
+ 373, 372, 371, 370, 369, 365, 364, 363, 362, 361,
+ 360, 359, 358, 357, 356, 355, 351, 350, 349, 348,
+ 347, 344, 343, 342, 341, 340, 339, 338, 337, 336,
+ 335, 334, 333, 332, 331, 330, 329, 328, 325, 324,
+ 323, 322, 321, 320, 319, 318, 317, 316, 315, 311,
+ 310, 309, 308, 307, 306, 305, 304, 303, 302, 301,
+
+ 300, 299, 298, 297, 296, 295, 294, 293, 292, 291,
+ 290, 289, 288, 287, 286, 285, 284, 283, 282, 279,
+ 278, 277, 276, 273, 272, 271, 270, 269, 268, 267,
+ 266, 259, 258, 257, 254, 253, 252, 245, 244, 243,
+ 242, 241, 236, 235, 232, 228, 227, 223, 220, 219,
+ 218, 215, 214, 213, 212, 206, 205, 204, 203, 202,
+ 201, 200, 199, 194, 193, 192, 191, 190, 189, 188,
+ 187, 183, 182, 181, 180, 179, 178, 177, 174, 173,
+ 172, 171, 170, 157, 136, 132, 115, 91, 85, 80,
+ 73, 67, 62, 890, 5, 890, 890, 890, 890, 890,
+
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890
+ } ;
+
+static const flex_int16_t yy_chk[1173] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 10, 10, 11, 15, 17, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 52,
+ 21, 24, 26, 26, 17, 15, 31, 52, 11, 20,
+ 55, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 24, 21, 24, 24, 111, 31, 34, 33, 34,
+
+ 21, 20, 34, 34, 35, 37, 111, 37, 35, 20,
+ 20, 21, 33, 33, 35, 36, 37, 35, 43, 36,
+ 20, 40, 43, 38, 36, 21, 758, 55, 42, 40,
+ 36, 38, 41, 38, 20, 41, 38, 20, 41, 41,
+ 40, 42, 38, 41, 41, 44, 41, 46, 169, 48,
+ 49, 51, 77, 49, 77, 51, 48, 48, 44, 94,
+ 48, 49, 46, 94, 51, 46, 48, 48, 49, 48,
+ 50, 72, 72, 169, 50, 74, 74, 127, 50, 75,
+ 75, 50, 102, 76, 112, 127, 102, 102, 133, 122,
+ 72, 72, 122, 122, 74, 74, 122, 112, 122, 136,
+
+ 131, 133, 141, 133, 75, 76, 131, 75, 138, 142,
+ 148, 148, 149, 76, 759, 136, 136, 141, 150, 760,
+ 149, 138, 142, 154, 76, 154, 150, 161, 761, 161,
+ 163, 163, 164, 168, 164, 168, 186, 186, 76, 167,
+ 167, 167, 167, 167, 167, 167, 167, 167, 167, 163,
+ 163, 181, 218, 218, 218, 248, 230, 307, 307, 168,
+ 230, 762, 764, 248, 181, 254, 254, 254, 260, 260,
+ 260, 260, 260, 260, 260, 260, 260, 260, 168, 261,
+ 765, 261, 262, 262, 262, 262, 262, 262, 262, 262,
+ 262, 262, 263, 766, 263, 273, 273, 273, 285, 285,
+
+ 285, 294, 294, 294, 767, 261, 298, 298, 298, 308,
+ 308, 308, 350, 350, 350, 394, 394, 394, 263, 407,
+ 407, 407, 768, 770, 261, 408, 408, 408, 409, 409,
+ 409, 394, 394, 464, 464, 464, 532, 263, 510, 510,
+ 510, 533, 551, 551, 551, 771, 532, 640, 774, 464,
+ 464, 533, 776, 778, 510, 510, 779, 640, 551, 551,
+ 780, 551, 587, 587, 587, 611, 611, 611, 670, 781,
+ 782, 783, 785, 786, 787, 670, 641, 670, 587, 587,
+ 692, 611, 611, 641, 788, 641, 641, 692, 789, 692,
+ 790, 793, 794, 797, 798, 799, 800, 801, 802, 803,
+
+ 804, 805, 806, 807, 808, 811, 812, 813, 814, 815,
+ 816, 817, 818, 819, 820, 821, 822, 825, 826, 827,
+ 828, 831, 832, 833, 835, 836, 837, 839, 840, 843,
+ 844, 845, 846, 847, 848, 849, 850, 851, 853, 854,
+ 855, 856, 857, 858, 859, 860, 862, 863, 864, 865,
+ 867, 870, 874, 875, 876, 878, 879, 880, 882, 885,
+ 886, 887, 888, 891, 891, 757, 891, 756, 755, 891,
+ 892, 892, 892, 892, 892, 892, 893, 893, 893, 893,
+ 893, 893, 894, 754, 894, 894, 895, 753, 895, 895,
+ 896, 752, 896, 897, 897, 897, 897, 898, 751, 898,
+
+ 899, 750, 899, 749, 747, 746, 745, 744, 743, 742,
+ 741, 740, 739, 737, 736, 735, 734, 733, 732, 731,
+ 730, 729, 728, 727, 726, 725, 724, 723, 722, 721,
+ 720, 719, 718, 717, 716, 715, 714, 713, 712, 711,
+ 710, 709, 708, 707, 705, 704, 703, 702, 701, 700,
+ 699, 697, 696, 695, 694, 691, 689, 688, 687, 685,
+ 684, 683, 682, 681, 680, 679, 678, 677, 676, 675,
+ 674, 673, 672, 669, 668, 667, 666, 665, 664, 662,
+ 661, 660, 659, 658, 657, 655, 654, 653, 652, 651,
+ 650, 649, 648, 647, 646, 645, 644, 643, 642, 637,
+
+ 635, 634, 633, 632, 631, 630, 626, 625, 624, 623,
+ 622, 621, 620, 619, 618, 616, 615, 614, 613, 609,
+ 608, 606, 605, 603, 602, 601, 600, 599, 598, 597,
+ 593, 592, 591, 589, 588, 586, 585, 584, 583, 582,
+ 581, 580, 579, 578, 577, 575, 574, 569, 568, 567,
+ 566, 565, 564, 562, 561, 559, 558, 557, 556, 555,
+ 553, 552, 550, 549, 548, 547, 546, 545, 544, 543,
+ 540, 539, 538, 537, 536, 535, 531, 530, 529, 528,
+ 527, 526, 523, 522, 521, 520, 519, 518, 517, 516,
+ 515, 514, 513, 512, 511, 509, 508, 505, 499, 497,
+
+ 496, 495, 493, 492, 489, 488, 487, 486, 475, 474,
+ 473, 472, 471, 469, 468, 467, 466, 465, 462, 460,
+ 459, 458, 456, 455, 453, 452, 450, 449, 448, 446,
+ 445, 440, 439, 437, 436, 435, 434, 433, 432, 431,
+ 430, 429, 428, 427, 425, 424, 423, 422, 421, 420,
+ 419, 418, 416, 415, 414, 413, 412, 411, 410, 406,
+ 402, 401, 400, 399, 398, 395, 393, 383, 381, 377,
+ 376, 375, 374, 372, 371, 369, 365, 363, 362, 361,
+ 360, 359, 358, 357, 356, 351, 349, 348, 347, 346,
+ 345, 343, 342, 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, 309, 306, 305, 304, 303, 302, 301, 300, 299,
+ 297, 293, 291, 290, 289, 288, 284, 283, 282, 281,
+ 280, 279, 278, 277, 276, 272, 271, 269, 268, 267,
+ 266, 259, 258, 257, 256, 255, 253, 252, 251, 250,
+ 249, 247, 246, 245, 244, 243, 242, 241, 240, 239,
+ 238, 237, 236, 235, 234, 233, 232, 231, 229, 228,
+ 227, 226, 225, 224, 223, 222, 221, 220, 219, 217,
+ 216, 215, 214, 213, 212, 211, 210, 209, 208, 207,
+
+ 206, 205, 204, 203, 202, 201, 200, 198, 197, 196,
+ 195, 194, 193, 192, 191, 190, 189, 188, 187, 185,
+ 184, 183, 182, 180, 179, 178, 177, 176, 175, 173,
+ 172, 157, 156, 155, 153, 152, 151, 147, 146, 145,
+ 144, 143, 140, 139, 137, 135, 134, 132, 130, 129,
+ 128, 126, 125, 124, 123, 121, 120, 118, 117, 116,
+ 115, 114, 113, 110, 109, 108, 107, 106, 105, 104,
+ 103, 101, 100, 99, 98, 97, 96, 95, 93, 92,
+ 91, 87, 83, 53, 47, 45, 39, 32, 25, 22,
+ 19, 14, 9, 5, 890, 890, 890, 890, 890, 890,
+
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890, 890, 890, 890, 890, 890, 890, 890, 890,
+ 890, 890
+ } ;
+
+
+/* Table of booleans, true if rule could match eol. */
+static const flex_int32_t yy_rule_can_match_eol[248] =
+ { 0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 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, };
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+/*
+//
+// 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.
+//
+
+This file contains the Lex specification for GLSL ES.
+Based on ANSI C grammar, Lex specification:
+http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
+
+IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
+WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
+*/
+
+#include "compiler/preprocessor/Token.h"
+#include "compiler/translator/ParseContext.h"
+#include "compiler/translator/glslang.h"
+#include "compiler/translator/length_limits.h"
+#include "compiler/translator/util.h"
+
+using namespace sh;
+
+#include "glslang_tab.h"
+
+/* windows only pragma */
+#ifdef _MSC_VER
+#pragma warning(disable : 4102)
+#endif
+
+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus > 199711L
+#define register
+#endif
+#endif
+
+#define YY_NO_INPUT
+#define YY_USER_ACTION \
+ yylloc->first_file = yylloc->last_file = yycolumn; \
+ yylloc->first_line = yylloc->last_line = yylineno;
+
+#define YY_INPUT(buf, result, max_size) \
+ result = string_input(buf, max_size, yyscanner);
+
+static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
+static int check_type(yyscan_t yyscanner);
+static int reserved_word(yyscan_t yyscanner);
+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 ES2_ident_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
+static int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token);
+static int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token);
+static int ES2_extension_ES3_keyword_else_reserved(TParseContext *context, TExtension extension, int token);
+static int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token);
+static int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token);
+static int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token);
+static int uint_constant(TParseContext *context);
+static int int_constant(TParseContext *context);
+static int float_constant(yyscan_t yyscanner);
+static int floatsuffix_check(TParseContext* context);
+static int yuvcscstandardext_constant(TParseContext *context);
+
+
+
+
+#define INITIAL 0
+#define FIELDS 1
+
+
+
+
+
+
+#define YY_EXTRA_TYPE TParseContext*
+
+
+
+
+/* Holds the entire state of the reentrant scanner. */
+struct yyguts_t
+ {
+
+ /* User-defined. Not touched by flex. */
+ YY_EXTRA_TYPE yyextra_r;
+
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
+ FILE *yyin_r, *yyout_r;
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ 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;
+ char *yy_c_buf_p;
+ int yy_init;
+ int yy_start;
+ int yy_did_buffer_switch_on_eof;
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int *yy_start_stack;
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ int yylineno_r;
+ int yy_flex_debug_r;
+
+
+
+
+ char *yytext_r;
+ int yy_more_flag;
+ int yy_more_len;
+
+
+
+ YYSTYPE * yylval_r;
+
+
+
+ YYLTYPE * yylloc_r;
+
+
+ }; /* end struct yyguts_t */
+
+
+
+
+static int yy_init_globals ( yyscan_t yyscanner );
+
+
+
+
+
+ /* This must go here because YYSTYPE and YYLTYPE are included
+ * from bison output in section 1.*/
+ # define yylval yyg->yylval_r
+
+
+
+ # define yylloc yyg->yylloc_r
+
+
+
+int yylex_init (yyscan_t* scanner);
+
+int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
+
+
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+
+int yylex_destroy ( yyscan_t yyscanner );
+
+
+
+int yyget_debug ( yyscan_t yyscanner );
+
+
+
+void yyset_debug ( int debug_flag , yyscan_t yyscanner );
+
+
+
+YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
+
+
+
+void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
+
+
+
+FILE *yyget_in ( yyscan_t yyscanner );
+
+
+
+void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
+
+
+
+FILE *yyget_out ( yyscan_t yyscanner );
+
+
+
+void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
+
+
+
+ int yyget_leng ( yyscan_t yyscanner );
+
+
+
+char *yyget_text ( yyscan_t yyscanner );
+
+
+
+int yyget_lineno ( yyscan_t yyscanner );
+
+
+
+void yyset_lineno ( int _line_number , yyscan_t yyscanner );
+
+
+
+
+int yyget_column ( yyscan_t yyscanner );
+
+
+
+
+
+void yyset_column ( int _column_no , yyscan_t yyscanner );
+
+
+
+
+YYSTYPE * yyget_lval ( yyscan_t yyscanner );
+
+
+void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
+
+
+
+ YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
+
+
+
+ void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
+
+
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap ( yyscan_t yyscanner );
+#else
+extern int yywrap ( yyscan_t yyscanner );
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+
+#endif
+
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput ( yyscan_t yyscanner );
+#else
+static int input ( yyscan_t yyscanner );
+#endif
+
+#endif
+
+
+
+
+
+
+
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
+#endif
+
+
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ int n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
+#endif
+
+
+
+/* end tables serialization structures and prototypes */
+
+
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+extern int yylex \
+ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
+
+#define YY_DECL int yylex \
+ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
+#endif /* !YY_DECL */
+
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK /*LINTED*/break;
+#endif
+
+
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+
+
+
+ yylval = yylval_param;
+
+
+
+ yylloc = yylloc_param;
+
+
+ if ( !yyg->yy_init )
+ {
+ yyg->yy_init = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+
+
+ if ( ! yyg->yy_start )
+ yyg->yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack (yyscanner);
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
+ }
+
+ yy_load_buffer_state( yyscanner );
+ }
+
+ {
+
+
+
+ TParseContext* context = yyextra;
+
+
+
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yyg->yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yyg->yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yyg->yy_start;
+yy_match:
+ do
+ {
+ 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 >= 891 )
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ ++yy_cp;
+ }
+ while ( yy_current_state != 890 );
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+
+ YY_DO_BEFORE_ACTION;
+
+
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ int yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
+
+ do{ yylineno++;
+ yycolumn=0;
+ }while(0)
+;
+ }
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ 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;
+
+case 1:
+YY_RULE_SETUP
+{ return INVARIANT; }
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+{ return HIGH_PRECISION; }
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+{ return MEDIUM_PRECISION; }
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+{ return LOW_PRECISION; }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+{ return PRECISION; }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+{ return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+{ return CONST_QUAL; }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+{ return UNIFORM; }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+{ return ES2_and_ES3_ident_ES3_1_keyword(context, BUFFER); }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+{ return ES2_keyword_ES3_reserved(context, VARYING); }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+{ return BREAK; }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+{ return CONTINUE; }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+{ return DO; }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+{ return FOR; }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+{ return WHILE; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+{ return IF; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+{ return ELSE; }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+{ return ES2_reserved_ES3_keyword(context, SWITCH); }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, CASE); }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+{ return ES2_reserved_ES3_keyword(context, DEFAULT); }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, CENTROID); }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+{ return ES2_reserved_ES3_keyword(context, FLAT); }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, SMOOTH); }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+{ return IN_QUAL; }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+{ return OUT_QUAL; }
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+{ return INOUT_QUAL; }
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+{ return ES2_and_ES3_ident_ES3_1_keyword(context, SHARED); }
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+{ return FLOAT_TYPE; }
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+{ return INT_TYPE; }
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, UINT_TYPE); }
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+{ return VOID_TYPE; }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+{ return BOOL_TYPE; }
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+{ yylval->lex.b = true; return BOOLCONSTANT; }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+{ yylval->lex.b = false; return BOOLCONSTANT; }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+{ return DISCARD; }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+{ return RETURN; }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+{ return MATRIX2; }
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+{ return MATRIX3; }
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+{ return MATRIX4; }
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX2); }
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX3); }
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX4); }
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX2x3); }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX3x2); }
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX2x4); }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX4x2); }
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX3x4); }
+ YY_BREAK
+case 48:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, MATRIX4x3); }
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
+{ return VEC2; }
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+{ return VEC3; }
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
+{ return VEC4; }
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+{ return IVEC2; }
+ YY_BREAK
+case 53:
+YY_RULE_SETUP
+{ return IVEC3; }
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+{ return IVEC4; }
+ YY_BREAK
+case 55:
+YY_RULE_SETUP
+{ return BVEC2; }
+ YY_BREAK
+case 56:
+YY_RULE_SETUP
+{ return BVEC3; }
+ YY_BREAK
+case 57:
+YY_RULE_SETUP
+{ return BVEC4; }
+ YY_BREAK
+case 58:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, UVEC2); }
+ YY_BREAK
+case 59:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, UVEC3); }
+ YY_BREAK
+case 60:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, UVEC4); }
+ YY_BREAK
+case 61:
+YY_RULE_SETUP
+{ return SAMPLER2D; }
+ YY_BREAK
+case 62:
+YY_RULE_SETUP
+{ return SAMPLERCUBE; }
+ YY_BREAK
+case 63:
+YY_RULE_SETUP
+{ return SAMPLER_EXTERNAL_OES; }
+ YY_BREAK
+case 64:
+YY_RULE_SETUP
+{ return ES2_extension_ES3_keyword_else_reserved(context, TExtension::OES_texture_3D, SAMPLER3D); }
+ YY_BREAK
+case 65:
+YY_RULE_SETUP
+{ return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
+ YY_BREAK
+case 66:
+YY_RULE_SETUP
+{ return SAMPLER2DRECT; }
+ YY_BREAK
+case 67:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, SAMPLER2DARRAY); }
+ YY_BREAK
+case 68:
+YY_RULE_SETUP
+{ return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, SAMPLER2DMS); }
+ YY_BREAK
+case 69:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, ISAMPLER2D); }
+ YY_BREAK
+case 70:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, ISAMPLER3D); }
+ YY_BREAK
+case 71:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, ISAMPLERCUBE); }
+ YY_BREAK
+case 72:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, ISAMPLER2DARRAY); }
+ YY_BREAK
+case 73:
+YY_RULE_SETUP
+{ return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, ISAMPLER2DMS); }
+ YY_BREAK
+case 74:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, USAMPLER2D); }
+ YY_BREAK
+case 75:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, USAMPLER3D); }
+ YY_BREAK
+case 76:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, USAMPLERCUBE); }
+ YY_BREAK
+case 77:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, USAMPLER2DARRAY); }
+ YY_BREAK
+case 78:
+YY_RULE_SETUP
+{ return ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(context, TExtension::ANGLE_texture_multisample, USAMPLER2DMS); }
+ YY_BREAK
+case 79:
+YY_RULE_SETUP
+{ return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
+ YY_BREAK
+case 80:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, SAMPLERCUBESHADOW); }
+ YY_BREAK
+case 81:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
+ YY_BREAK
+case 82:
+YY_RULE_SETUP
+{ return ES3_extension_keyword_else_ident(context, TExtension::EXT_YUV_target, SAMPLEREXTERNAL2DY2YEXT); }
+ YY_BREAK
+case 83:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_extension_keyword(context, TExtension::OES_texture_storage_multisample_2d_array, SAMPLER2DMSARRAY); }
+ YY_BREAK
+case 84:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_extension_keyword(context, TExtension::OES_texture_storage_multisample_2d_array, ISAMPLER2DMSARRAY); }
+ YY_BREAK
+case 85:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_extension_keyword(context, TExtension::OES_texture_storage_multisample_2d_array, USAMPLER2DMSARRAY); }
+ YY_BREAK
+case 86:
+YY_RULE_SETUP
+{ return STRUCT; }
+ YY_BREAK
+case 87:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_keyword(context, LAYOUT); }
+ YY_BREAK
+case 88:
+YY_RULE_SETUP
+{ return ES3_extension_keyword_else_ident(context, TExtension::EXT_YUV_target, YUVCSCSTANDARDEXT); }
+ YY_BREAK
+case 89:
+YY_RULE_SETUP
+{ return yuvcscstandardext_constant(context); }
+ YY_BREAK
+case 90:
+YY_RULE_SETUP
+{ return yuvcscstandardext_constant(context); }
+ YY_BREAK
+case 91:
+YY_RULE_SETUP
+{ return yuvcscstandardext_constant(context); }
+ YY_BREAK
+case 92:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGE2D); }
+ YY_BREAK
+case 93:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGE2D); }
+ YY_BREAK
+case 94:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGE2D); }
+ YY_BREAK
+case 95:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGE2DARRAY); }
+ YY_BREAK
+case 96:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGE2DARRAY); }
+ YY_BREAK
+case 97:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGE2DARRAY); }
+ YY_BREAK
+case 98:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGE3D); }
+ YY_BREAK
+case 99:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGE3D); }
+ YY_BREAK
+case 100:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGE3D); }
+ YY_BREAK
+case 101:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IIMAGECUBE); }
+ YY_BREAK
+case 102:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, UIMAGECUBE); }
+ YY_BREAK
+case 103:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, IMAGECUBE); }
+ YY_BREAK
+case 104:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, READONLY); }
+ YY_BREAK
+case 105:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, WRITEONLY); }
+ YY_BREAK
+case 106:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, COHERENT); }
+ YY_BREAK
+case 107:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, RESTRICT); }
+ YY_BREAK
+case 108:
+YY_RULE_SETUP
+{ return ES2_and_ES3_reserved_ES3_1_keyword(context, VOLATILE); }
+ YY_BREAK
+case 109:
+YY_RULE_SETUP
+{ return ES2_ident_ES3_reserved_ES3_1_keyword(context, ATOMICUINT); }
+ YY_BREAK
+/* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
+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:
+case 135:
+case 136:
+case 137:
+case 138:
+case 139:
+case 140:
+case 141:
+case 142:
+YY_RULE_SETUP
+{
+ if (context->getShaderVersion() < 300) {
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ 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 143:
+YY_RULE_SETUP
+{
+ if (context->getShaderVersion() >= 300)
+ {
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+ }
+
+ return reserved_word(yyscanner);
+}
+ YY_BREAK
+/* Reserved keywords */
+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:
+case 177:
+case 178:
+case 179:
+case 180:
+case 181:
+case 182:
+case 183:
+YY_RULE_SETUP
+{ return reserved_word(yyscanner); }
+ YY_BREAK
+case 184:
+YY_RULE_SETUP
+{
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+}
+ YY_BREAK
+case 185:
+YY_RULE_SETUP
+{ return int_constant(context); }
+ YY_BREAK
+case 186:
+YY_RULE_SETUP
+{ return int_constant(context); }
+ YY_BREAK
+case 187:
+YY_RULE_SETUP
+{ return int_constant(context); }
+ YY_BREAK
+case 188:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+ YY_BREAK
+case 189:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+ YY_BREAK
+case 190:
+YY_RULE_SETUP
+{ return uint_constant(context); }
+ YY_BREAK
+case 191:
+YY_RULE_SETUP
+{ return float_constant(yyscanner); }
+ YY_BREAK
+case 192:
+YY_RULE_SETUP
+{ return float_constant(yyscanner); }
+ YY_BREAK
+case 193:
+YY_RULE_SETUP
+{ return float_constant(yyscanner); }
+ YY_BREAK
+case 194:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+ YY_BREAK
+case 195:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+ YY_BREAK
+case 196:
+YY_RULE_SETUP
+{ return floatsuffix_check(context); }
+ YY_BREAK
+case 197:
+YY_RULE_SETUP
+{ return ADD_ASSIGN; }
+ YY_BREAK
+case 198:
+YY_RULE_SETUP
+{ return SUB_ASSIGN; }
+ YY_BREAK
+case 199:
+YY_RULE_SETUP
+{ return MUL_ASSIGN; }
+ YY_BREAK
+case 200:
+YY_RULE_SETUP
+{ return DIV_ASSIGN; }
+ YY_BREAK
+case 201:
+YY_RULE_SETUP
+{ return MOD_ASSIGN; }
+ YY_BREAK
+case 202:
+YY_RULE_SETUP
+{ return LEFT_ASSIGN; }
+ YY_BREAK
+case 203:
+YY_RULE_SETUP
+{ return RIGHT_ASSIGN; }
+ YY_BREAK
+case 204:
+YY_RULE_SETUP
+{ return AND_ASSIGN; }
+ YY_BREAK
+case 205:
+YY_RULE_SETUP
+{ return XOR_ASSIGN; }
+ YY_BREAK
+case 206:
+YY_RULE_SETUP
+{ return OR_ASSIGN; }
+ YY_BREAK
+case 207:
+YY_RULE_SETUP
+{ return INC_OP; }
+ YY_BREAK
+case 208:
+YY_RULE_SETUP
+{ return DEC_OP; }
+ YY_BREAK
+case 209:
+YY_RULE_SETUP
+{ return AND_OP; }
+ YY_BREAK
+case 210:
+YY_RULE_SETUP
+{ return OR_OP; }
+ YY_BREAK
+case 211:
+YY_RULE_SETUP
+{ return XOR_OP; }
+ YY_BREAK
+case 212:
+YY_RULE_SETUP
+{ return LE_OP; }
+ YY_BREAK
+case 213:
+YY_RULE_SETUP
+{ return GE_OP; }
+ YY_BREAK
+case 214:
+YY_RULE_SETUP
+{ return EQ_OP; }
+ YY_BREAK
+case 215:
+YY_RULE_SETUP
+{ return NE_OP; }
+ YY_BREAK
+case 216:
+YY_RULE_SETUP
+{ return LEFT_OP; }
+ YY_BREAK
+case 217:
+YY_RULE_SETUP
+{ return RIGHT_OP; }
+ YY_BREAK
+case 218:
+YY_RULE_SETUP
+{ return SEMICOLON; }
+ YY_BREAK
+case 219:
+YY_RULE_SETUP
+{ return LEFT_BRACE; }
+ YY_BREAK
+case 220:
+YY_RULE_SETUP
+{ return RIGHT_BRACE; }
+ YY_BREAK
+case 221:
+YY_RULE_SETUP
+{ return COMMA; }
+ YY_BREAK
+case 222:
+YY_RULE_SETUP
+{ return COLON; }
+ YY_BREAK
+case 223:
+YY_RULE_SETUP
+{ return EQUAL; }
+ YY_BREAK
+case 224:
+YY_RULE_SETUP
+{ return LEFT_PAREN; }
+ YY_BREAK
+case 225:
+YY_RULE_SETUP
+{ return RIGHT_PAREN; }
+ YY_BREAK
+case 226:
+YY_RULE_SETUP
+{ return LEFT_BRACKET; }
+ YY_BREAK
+case 227:
+YY_RULE_SETUP
+{ return RIGHT_BRACKET; }
+ YY_BREAK
+case 228:
+YY_RULE_SETUP
+{ BEGIN(FIELDS); return DOT; }
+ YY_BREAK
+case 229:
+YY_RULE_SETUP
+{ return BANG; }
+ YY_BREAK
+case 230:
+YY_RULE_SETUP
+{ return DASH; }
+ YY_BREAK
+case 231:
+YY_RULE_SETUP
+{ return TILDE; }
+ YY_BREAK
+case 232:
+YY_RULE_SETUP
+{ return PLUS; }
+ YY_BREAK
+case 233:
+YY_RULE_SETUP
+{ return STAR; }
+ YY_BREAK
+case 234:
+YY_RULE_SETUP
+{ return SLASH; }
+ YY_BREAK
+case 235:
+YY_RULE_SETUP
+{ return PERCENT; }
+ YY_BREAK
+case 236:
+YY_RULE_SETUP
+{ return LEFT_ANGLE; }
+ YY_BREAK
+case 237:
+YY_RULE_SETUP
+{ return RIGHT_ANGLE; }
+ YY_BREAK
+case 238:
+YY_RULE_SETUP
+{ return VERTICAL_BAR; }
+ YY_BREAK
+case 239:
+YY_RULE_SETUP
+{ return CARET; }
+ YY_BREAK
+case 240:
+YY_RULE_SETUP
+{ return AMPERSAND; }
+ YY_BREAK
+case 241:
+YY_RULE_SETUP
+{ return QUESTION; }
+ YY_BREAK
+case 242:
+YY_RULE_SETUP
+{
+ BEGIN(INITIAL);
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return FIELD_SELECTION;
+}
+ YY_BREAK
+case 243:
+YY_RULE_SETUP
+{}
+ YY_BREAK
+case 244:
+YY_RULE_SETUP
+{
+ yyextra->error(*yylloc, "Illegal character at fieldname start", yytext);
+ return 0;
+}
+ YY_BREAK
+case 245:
+/* rule 245 can match eol */
+YY_RULE_SETUP
+{ }
+ YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(FIELDS):
+{ yyterminate(); }
+ YY_BREAK
+case 246:
+YY_RULE_SETUP
+{ assert(false); return 0; }
+ YY_BREAK
+case 247:
+YY_RULE_SETUP
+ECHO;
+ YY_BREAK
+
+ 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;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yyg->yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ 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;
+ }
+
+ /* 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;
+
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ /* 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).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yyg->yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( yyscanner ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yyg->yy_did_buffer_switch_on_eof = 0;
+
+ 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;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p =
+ yyg->yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yyg->yy_c_buf_p =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+
+ yy_current_state = yy_get_previous_state( yyscanner );
+
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of user's declarations */
+} /* end of yylex */
+
+
+
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = yyg->yytext_ptr;
+ int number_to_move, i;
+ int ret_val;
+
+ 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" );
+
+ 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;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ 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;
+
+ else
+ {
+ int num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+
+ int yy_c_buf_p_offset =
+ (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc( (void *) b->yy_ch_buf,
+ (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = NULL;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ size_t result = 0;
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ result, num_to_read );
+ yyg->yy_n_chars = static_cast<int>(result);
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+ }
+
+ if ( yyg->yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin , yyscanner);
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((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. */
+ int 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, (yy_size_t) new_size , yyscanner );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ /* "- 2" to take care of EOB's */
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+ }
+
+ 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;
+
+ yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
+{
+ yy_state_type yy_current_state;
+ char *yy_cp;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ yy_current_state = yyg->yy_start;
+
+ for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+ {
+ 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 >= 891 )
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ }
+
+ return yy_current_state;
+}
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
+{
+ int yy_is_jam;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+ char *yy_cp = yyg->yy_c_buf_p;
+
+ 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 >= 891 )
+ yy_c = yy_meta[yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+ yy_is_jam = (yy_current_state == 890);
+
+ (void)yyg;
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+
+#ifndef YY_NO_UNPUT
+
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (yyscan_t yyscanner)
+#else
+ static int input (yyscan_t yyscanner)
+#endif
+
+{
+ int c;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
+
+ 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';
+
+ else
+ { /* need more input */
+ int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
+ ++yyg->yy_c_buf_p;
+
+ 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.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin , yyscanner);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( yyscanner ) )
+ return 0;
+
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput(yyscanner);
+#else
+ return input(yyscanner);
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ 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;
+
+ if ( c == '\n' )
+
+ do{ yylineno++;
+ yycolumn=0;
+ }while(0)
+;
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * @param yyscanner The scanner object.
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack (yyscanner);
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
+ }
+
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
+ yy_load_buffer_state( yyscanner );
+}
+
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * @param yyscanner The scanner object.
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack (yyscanner);
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ 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;
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( yyscanner );
+
+ /* 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;
+}
+
+
+static void yy_load_buffer_state (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ 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;
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * @param yyscanner The scanner object.
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* 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( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file , yyscanner);
+
+ return b;
+}
+
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * @param yyscanner The scanner object.
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree( (void *) b->yy_ch_buf , yyscanner );
+
+ yyfree( (void *) b , yyscanner );
+}
+
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
+
+{
+ int oerrno = errno;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ yy_flush_buffer( b , yyscanner);
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+
+
+ b->yy_is_interactive = 0;
+
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * @param yyscanner The scanner object.
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* 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;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( yyscanner );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ * @param yyscanner The scanner object.
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack(yyscanner);
+
+ /* 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;
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ yyg->yy_buffer_stack_top++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ * @param yyscanner The scanner object.
+ */
+void yypop_buffer_state (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if (yyg->yy_buffer_stack_top > 0)
+ --yyg->yy_buffer_stack_top;
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( yyscanner );
+ yyg->yy_did_buffer_switch_on_eof = 1;
+ }
+}
+
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (yyscan_t yyscanner)
+{
+ yy_size_t num_to_alloc;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if (!yyg->yy_buffer_stack) {
+
+ /* 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.
+ */
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ 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;
+ }
+
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
+
+ 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()" );
+
+ /* 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;
+ }
+}
+
+
+
+
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+
+ 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 NULL;
+
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = (int) (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 = NULL;
+ 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;
+
+ yy_switch_to_buffer( b , yyscanner );
+
+ return b;
+}
+
+
+
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
+{
+
+ return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
+}
+
+
+
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = (yy_size_t) (_yybytes_len + 2);
+ buf = (char *) yyalloc( n , yyscanner );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n , yyscanner);
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+
+
+
+
+
+
+
+
+
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ 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 )
+
+
+
+/* Accessor methods (get/set functions) to struct members. */
+
+
+/** Get the user-defined data for this scanner.
+ * @param yyscanner The scanner object.
+ */
+YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyextra;
+}
+
+
+
+/** Get the current line number.
+ * @param yyscanner The scanner object.
+ */
+int yyget_lineno (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+
+ return yylineno;
+}
+
+
+
+
+/** Get the current column number.
+ * @param yyscanner The scanner object.
+ */
+int yyget_column (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+
+ return yycolumn;
+}
+
+
+
+
+/** Get the input stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *yyget_in (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyin;
+}
+
+
+
+/** Get the output stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *yyget_out (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyout;
+}
+
+
+
+/** Get the length of the current token.
+ * @param yyscanner The scanner object.
+ */
+int yyget_leng (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyleng;
+}
+
+
+/** Get the current token.
+ * @param yyscanner The scanner object.
+ */
+
+char *yyget_text (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yytext;
+}
+
+
+
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * @param yyscanner The scanner object.
+ */
+void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyextra = user_defined ;
+}
+
+
+
+/** Set the current line number.
+ * @param _line_number line number
+ * @param yyscanner The scanner object.
+ */
+void yyset_lineno (int _line_number , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+
+ /* lineno is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
+
+ yylineno = _line_number;
+}
+
+
+
+
+/** Set the current column.
+ * @param _column_no column number
+ * @param yyscanner The scanner object.
+ */
+void yyset_column (int _column_no , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+
+ /* column is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ YY_FATAL_ERROR( "yyset_column called with no buffer" );
+
+ yycolumn = _column_no;
+}
+
+
+
+
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param _in_str A readable stream.
+ * @param yyscanner The scanner object.
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * _in_str , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyin = _in_str ;
+}
+
+
+
+void yyset_out (FILE * _out_str , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyout = _out_str ;
+}
+
+
+
+
+int yyget_debug (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yy_flex_debug;
+}
+
+
+
+void yyset_debug (int _bdebug , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yy_flex_debug = _bdebug ;
+}
+
+
+/* Accessor methods for yylval and yylloc */
+
+
+YYSTYPE * yyget_lval (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yylval;
+}
+
+
+
+void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yylval = yylval_param;
+}
+
+
+
+
+YYLTYPE *yyget_lloc (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yylloc;
+}
+
+
+
+void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yylloc = yylloc_param;
+}
+
+
+
+
+
+/* User-visible API */
+
+/* yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+int yylex_init(yyscan_t* ptr_yy_globals)
+{
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ return yy_init_globals ( *ptr_yy_globals );
+}
+
+
+/* yylex_init_extra has the same functionality as yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to yyalloc in
+ * the yyextra field.
+ */
+int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
+{
+ struct yyguts_t dummy_yyguts;
+
+ yyset_extra (yy_user_defined, &dummy_yyguts);
+
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in
+ yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ yyset_extra (yy_user_defined, *ptr_yy_globals);
+
+ return yy_init_globals ( *ptr_yy_globals );
+}
+
+
+static int yy_init_globals (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+
+
+
+ yyg->yy_buffer_stack = NULL;
+ yyg->yy_buffer_stack_top = 0;
+ yyg->yy_buffer_stack_max = 0;
+ yyg->yy_c_buf_p = NULL;
+ yyg->yy_init = 0;
+ yyg->yy_start = 0;
+
+
+ yyg->yy_start_stack_ptr = 0;
+ yyg->yy_start_stack_depth = 0;
+ yyg->yy_start_stack = NULL;
+
+
+
+
+
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = NULL;
+ yyout = NULL;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state(yyscanner);
+ }
+
+ /* Destroy the stack itself. */
+ yyfree(yyg->yy_buffer_stack , yyscanner);
+ yyg->yy_buffer_stack = NULL;
+
+
+ /* Destroy the start condition stack. */
+ yyfree( yyg->yy_start_stack , yyscanner );
+ yyg->yy_start_stack = NULL;
+
+
+
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( yyscanner);
+
+ /* Destroy the main struct (reentrant only). */
+ yyfree ( yyscanner , yyscanner );
+ yyscanner = NULL;
+ return 0;
+}
+
+
+
+/*
+ * Internal utility routines.
+ */
+
+
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+
+ int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
+{
+ int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+
+
+void *yyalloc (yy_size_t size , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ return malloc(size);
+}
+
+
+
+void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+
+ /* 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 realloc(ptr, size);
+}
+
+
+
+void yyfree (void * ptr , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+
+#define YYTABLES_NAME "yytables"
+
+
+
+
+
+
+
+
+yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
+ angle::pp::Token token;
+ yyget_extra(yyscanner)->getPreprocessor().lex(&token);
+ yy_size_t len = token.type == angle::pp::Token::LAST ? 0 : token.text.size();
+ if (len < max_size)
+ memcpy(buf, token.text.c_str(), len);
+ yyset_column(token.location.file, yyscanner);
+ yyset_lineno(token.location.line, yyscanner);
+
+ if (len >= max_size)
+ YY_FATAL_ERROR("Input buffer overflow");
+ else if (len > 0)
+ buf[len++] = ' ';
+ return len;
+}
+
+int check_type(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ int token = IDENTIFIER;
+ // Note that the ImmutableString used here isn't static or pool allocated - but it's fine since yytext is valid for the duration of its use.
+ const TSymbol* symbol = yyextra->symbolTable.find(ImmutableString(yytext, yyleng), yyextra->getShaderVersion());
+ if (symbol && symbol->isStruct())
+ {
+ token = TYPE_NAME;
+ }
+ yylval->lex.symbol = symbol;
+ return token;
+}
+
+int reserved_word(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ yyextra->error(*yylloc, "Illegal use of reserved word", yytext);
+ return 0;
+}
+
+int ES2_reserved_ES3_keyword(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ if (context->getShaderVersion() < 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_keyword_ES3_reserved(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ if (context->getShaderVersion() >= 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_ident_ES3_reserved_ES3_1_keyword(TParseContext *context, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ if (context->getShaderVersion() < 300)
+ {
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+ }
+ else if (context->getShaderVersion() == 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_ident_ES3_keyword(TParseContext *context, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
+ if (context->getShaderVersion() < 300)
+ {
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_and_ES3_reserved_ES3_1_keyword(TParseContext *context, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ if (context->getShaderVersion() < 310)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_and_ES3_ident_ES3_1_keyword(TParseContext *context, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ // not a reserved word in GLSL ES 1.00 and GLSL ES 3.00, so could be used as an identifier/type name
+ if (context->getShaderVersion() < 310)
+ {
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+ }
+
+ return token;
+}
+
+int ES2_extension_ES3_keyword_else_reserved(TParseContext *context, TExtension extension, int token)
+{
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ // Available with extension or ES 3.00 and above, reserved otherwise
+ if (context->isExtensionEnabled(extension) || context->getShaderVersion() >= 300)
+ {
+ return token;
+ }
+
+ return reserved_word(yyscanner);
+}
+
+int ES3_extension_keyword_else_ident(TParseContext *context, TExtension extension, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ // a reserved word in GLSL ES 3.00 with enabled extension, otherwise could be used as an identifier/type name
+ if (context->getShaderVersion() >= 300 && context->isExtensionEnabled(extension))
+ {
+ return token;
+ }
+
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+}
+
+int ES2_ident_ES3_reserved_ES3_1_extension_keyword(TParseContext *context, TExtension extension, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ // a keyword in GLSL ES 3.10 with enabled extension
+ if (context->getShaderVersion() >= 310 && context->isExtensionEnabled(extension))
+ {
+ return token;
+ }
+ // a reserved word in GLSL ES 3.00+
+ if (context->getShaderVersion() >= 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ // Otherwise can be used as an identifier/type name
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+}
+
+int ES3_extension_and_ES3_1_keyword_ES3_reserved_else_ident(TParseContext *context, TExtension extension, int token)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ // A keyword in GLSL ES 3.00 with enabled extension or in GLSL ES 3.10
+ if (context->getShaderVersion() >= 310 || (context->getShaderVersion() == 300 && context->isExtensionEnabled(extension)))
+ {
+ return token;
+ }
+
+ if(context->getShaderVersion() == 300)
+ {
+ return reserved_word(yyscanner);
+ }
+
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+}
+
+int uint_constant(TParseContext *context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+
+ if (context->getShaderVersion() < 300)
+ {
+ context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext);
+ return 0;
+ }
+
+ if (!atoi_clamp(yytext, &(yylval->lex.u)))
+ yyextra->error(*yylloc, "Integer overflow", yytext);
+
+ return UINTCONSTANT;
+}
+
+int floatsuffix_check(TParseContext* context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+
+ if (context->getShaderVersion() < 300)
+ {
+ context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
+ return 0;
+ }
+
+ std::string text = yytext;
+ text.resize(text.size() - 1);
+ if (!strtof_clamp(text, &(yylval->lex.f)))
+ yyextra->warning(*yylloc, "Float overflow", yytext);
+
+ return(FLOATCONSTANT);
+}
+
+void yyerror(YYLTYPE* lloc, TParseContext* context, void *scanner, const char* reason) {
+ context->error(*lloc, reason, yyget_text(scanner));
+}
+
+int int_constant(TParseContext *context) {
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+
+ unsigned int u;
+ if (!atoi_clamp(yytext, &u))
+ {
+ if (context->getShaderVersion() >= 300)
+ yyextra->error(*yylloc, "Integer overflow", yytext);
+ else
+ yyextra->warning(*yylloc, "Integer overflow", yytext);
+ }
+ yylval->lex.i = static_cast<int>(u);
+ return INTCONSTANT;
+}
+
+int float_constant(yyscan_t yyscanner) {
+ struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
+
+ if (!strtof_clamp(yytext, &(yylval->lex.f)))
+ yyextra->warning(*yylloc, "Float overflow", yytext);
+ return FLOATCONSTANT;
+}
+
+int yuvcscstandardext_constant(TParseContext *context)
+{
+ struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
+ yyscan_t yyscanner = (yyscan_t) context->getScanner();
+
+ // a reserved word in GLSL ES 3.00 with enabled extension, otherwise could be used as an identifier/type name
+ if (context->getShaderVersion() >= 300 && context->isExtensionEnabled(TExtension::EXT_YUV_target))
+ {
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return YUVCSCSTANDARDEXTCONSTANT;
+ }
+
+ yylval->lex.string = AllocatePoolCharArray(yytext, yyleng);
+ return check_type(yyscanner);
+}
+
+int glslang_initialize(TParseContext* context) {
+ yyscan_t scanner = NULL;
+ if (yylex_init_extra(context, &scanner))
+ return 1;
+
+ context->setScanner(scanner);
+ return 0;
+}
+
+int glslang_finalize(TParseContext* context) {
+ yyscan_t scanner = context->getScanner();
+ if (scanner == NULL) return 0;
+
+ context->setScanner(NULL);
+ yylex_destroy(scanner);
+
+ return 0;
+}
+
+int glslang_scan(size_t count, const char* const string[], const int length[],
+ TParseContext* context) {
+ yyrestart(NULL, context->getScanner());
+ yyset_column(0, context->getScanner());
+ yyset_lineno(1, context->getScanner());
+
+ // Initialize preprocessor.
+ angle::pp::Preprocessor *preprocessor = &context->getPreprocessor();
+
+ if (!preprocessor->init(count, string, length))
+ return 1;
+
+ // Define extension macros.
+ const TExtensionBehavior& extBehavior = context->extensionBehavior();
+ for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
+ iter != extBehavior.end(); ++iter) {
+ preprocessor->predefineMacro(GetExtensionNameString(iter->first), 1);
+ }
+ if (context->getFragmentPrecisionHigh())
+ preprocessor->predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
+
+ preprocessor->setMaxTokenSize(sh::GetGlobalMaxTokenSize(context->getShaderSpec()));
+
+ return 0;
+}
+
diff --git a/gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp b/gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp
new file mode 100644
index 0000000000..bf4efe8cb7
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp
@@ -0,0 +1,5201 @@
+/* A Bison parser, made by GNU Bison 3.0.4. */
+
+/* Bison implementation for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "3.0.4"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 2
+
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
+/* Copy the first part of user declarations. */
+
+//
+// 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.
+//
+
+// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
+
+// clang-format off
+
+// Ignore errors in auto-generated code.
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#pragma GCC diagnostic ignored "-Wswitch-enum"
+#elif defined(_MSC_VER)
+#pragma warning(disable: 4065)
+#pragma warning(disable: 4189)
+#pragma warning(disable: 4244)
+#pragma warning(disable: 4505)
+#pragma warning(disable: 4701)
+#pragma warning(disable: 4702)
+#endif
+
+#include "angle_gl.h"
+#include "compiler/translator/Declarator.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/ParseContext.h"
+#include "GLSLANG/ShaderLang.h"
+
+#define YYENABLE_NLS 0
+
+using namespace sh;
+
+
+
+
+# ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* In a future release of Bison, this section will be replaced
+ by #include "glslang_tab.h". */
+#ifndef YY_YY_GLSLANG_TAB_H_INCLUDED
+# define YY_YY_GLSLANG_TAB_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+/* "%code requires" blocks. */
+
+
+#define YYLTYPE TSourceLoc
+#define YYLTYPE_IS_DECLARED 1
+#define YYLTYPE_IS_TRIVIAL 1
+
+
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ enum yytokentype
+ {
+ INVARIANT = 258,
+ HIGH_PRECISION = 259,
+ MEDIUM_PRECISION = 260,
+ LOW_PRECISION = 261,
+ PRECISION = 262,
+ ATTRIBUTE = 263,
+ CONST_QUAL = 264,
+ BOOL_TYPE = 265,
+ FLOAT_TYPE = 266,
+ INT_TYPE = 267,
+ UINT_TYPE = 268,
+ BREAK = 269,
+ CONTINUE = 270,
+ DO = 271,
+ ELSE = 272,
+ FOR = 273,
+ IF = 274,
+ DISCARD = 275,
+ RETURN = 276,
+ SWITCH = 277,
+ CASE = 278,
+ DEFAULT = 279,
+ BVEC2 = 280,
+ BVEC3 = 281,
+ BVEC4 = 282,
+ IVEC2 = 283,
+ IVEC3 = 284,
+ IVEC4 = 285,
+ VEC2 = 286,
+ VEC3 = 287,
+ VEC4 = 288,
+ UVEC2 = 289,
+ UVEC3 = 290,
+ UVEC4 = 291,
+ MATRIX2 = 292,
+ MATRIX3 = 293,
+ MATRIX4 = 294,
+ IN_QUAL = 295,
+ OUT_QUAL = 296,
+ INOUT_QUAL = 297,
+ UNIFORM = 298,
+ BUFFER = 299,
+ VARYING = 300,
+ MATRIX2x3 = 301,
+ MATRIX3x2 = 302,
+ MATRIX2x4 = 303,
+ MATRIX4x2 = 304,
+ MATRIX3x4 = 305,
+ MATRIX4x3 = 306,
+ CENTROID = 307,
+ FLAT = 308,
+ SMOOTH = 309,
+ READONLY = 310,
+ WRITEONLY = 311,
+ COHERENT = 312,
+ RESTRICT = 313,
+ VOLATILE = 314,
+ SHARED = 315,
+ STRUCT = 316,
+ VOID_TYPE = 317,
+ WHILE = 318,
+ SAMPLER2D = 319,
+ SAMPLERCUBE = 320,
+ SAMPLER_EXTERNAL_OES = 321,
+ SAMPLER2DRECT = 322,
+ SAMPLER2DARRAY = 323,
+ ISAMPLER2D = 324,
+ ISAMPLER3D = 325,
+ ISAMPLERCUBE = 326,
+ ISAMPLER2DARRAY = 327,
+ USAMPLER2D = 328,
+ USAMPLER3D = 329,
+ USAMPLERCUBE = 330,
+ USAMPLER2DARRAY = 331,
+ SAMPLER2DMS = 332,
+ ISAMPLER2DMS = 333,
+ USAMPLER2DMS = 334,
+ SAMPLER2DMSARRAY = 335,
+ ISAMPLER2DMSARRAY = 336,
+ USAMPLER2DMSARRAY = 337,
+ SAMPLER3D = 338,
+ SAMPLER3DRECT = 339,
+ SAMPLER2DSHADOW = 340,
+ SAMPLERCUBESHADOW = 341,
+ SAMPLER2DARRAYSHADOW = 342,
+ SAMPLEREXTERNAL2DY2YEXT = 343,
+ IMAGE2D = 344,
+ IIMAGE2D = 345,
+ UIMAGE2D = 346,
+ IMAGE3D = 347,
+ IIMAGE3D = 348,
+ UIMAGE3D = 349,
+ IMAGE2DARRAY = 350,
+ IIMAGE2DARRAY = 351,
+ UIMAGE2DARRAY = 352,
+ IMAGECUBE = 353,
+ IIMAGECUBE = 354,
+ UIMAGECUBE = 355,
+ ATOMICUINT = 356,
+ LAYOUT = 357,
+ YUVCSCSTANDARDEXT = 358,
+ YUVCSCSTANDARDEXTCONSTANT = 359,
+ IDENTIFIER = 360,
+ TYPE_NAME = 361,
+ FLOATCONSTANT = 362,
+ INTCONSTANT = 363,
+ UINTCONSTANT = 364,
+ BOOLCONSTANT = 365,
+ FIELD_SELECTION = 366,
+ LEFT_OP = 367,
+ RIGHT_OP = 368,
+ INC_OP = 369,
+ DEC_OP = 370,
+ LE_OP = 371,
+ GE_OP = 372,
+ EQ_OP = 373,
+ NE_OP = 374,
+ AND_OP = 375,
+ OR_OP = 376,
+ XOR_OP = 377,
+ MUL_ASSIGN = 378,
+ DIV_ASSIGN = 379,
+ ADD_ASSIGN = 380,
+ MOD_ASSIGN = 381,
+ LEFT_ASSIGN = 382,
+ RIGHT_ASSIGN = 383,
+ AND_ASSIGN = 384,
+ XOR_ASSIGN = 385,
+ OR_ASSIGN = 386,
+ SUB_ASSIGN = 387,
+ LEFT_PAREN = 388,
+ RIGHT_PAREN = 389,
+ LEFT_BRACKET = 390,
+ RIGHT_BRACKET = 391,
+ LEFT_BRACE = 392,
+ RIGHT_BRACE = 393,
+ DOT = 394,
+ COMMA = 395,
+ COLON = 396,
+ EQUAL = 397,
+ SEMICOLON = 398,
+ BANG = 399,
+ DASH = 400,
+ TILDE = 401,
+ PLUS = 402,
+ STAR = 403,
+ SLASH = 404,
+ PERCENT = 405,
+ LEFT_ANGLE = 406,
+ RIGHT_ANGLE = 407,
+ VERTICAL_BAR = 408,
+ CARET = 409,
+ AMPERSAND = 410,
+ QUESTION = 411
+ };
+#endif
+
+/* Value type. */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+
+union YYSTYPE
+{
+
+
+ struct {
+ union {
+ const char *string; // pool allocated.
+ float f;
+ int i;
+ unsigned int u;
+ bool b;
+ };
+ const TSymbol* symbol;
+ } lex;
+ struct {
+ TOperator op;
+ union {
+ TIntermNode *intermNode;
+ TIntermNodePair nodePair;
+ TIntermTyped *intermTypedNode;
+ TIntermAggregate *intermAggregate;
+ TIntermBlock *intermBlock;
+ TIntermDeclaration *intermDeclaration;
+ TIntermFunctionPrototype *intermFunctionPrototype;
+ TIntermSwitch *intermSwitch;
+ TIntermCase *intermCase;
+ };
+ union {
+ TVector<unsigned int> *arraySizes;
+ TTypeSpecifierNonArray typeSpecifierNonArray;
+ TPublicType type;
+ TPrecision precision;
+ TLayoutQualifier layoutQualifier;
+ TQualifier qualifier;
+ TFunction *function;
+ TFunctionLookup *functionLookup;
+ TParameter param;
+ TDeclarator *declarator;
+ TDeclaratorList *declaratorList;
+ TFieldList *fieldList;
+ TQualifierWrapperBase *qualifierWrapper;
+ TTypeQualifierBuilder *typeQualifierBuilder;
+ };
+ } interm;
+
+
+};
+
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* Location type. */
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+};
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+int yyparse (TParseContext* context, void *scanner);
+
+#endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED */
+
+/* Copy the second part of user declarations. */
+
+
+extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
+extern void yyerror(YYLTYPE* yylloc, TParseContext* context, void *scanner, const char* reason);
+
+#define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do { \
+ if (N) { \
+ (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
+ (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
+ (Current).last_file = YYRHSLOC(Rhs, N).last_file; \
+ (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
+ } \
+ else { \
+ (Current).first_file = YYRHSLOC(Rhs, 0).last_file; \
+ (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
+ (Current).last_file = YYRHSLOC(Rhs, 0).last_file; \
+ (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
+ } \
+ } while (0)
+
+#define VERTEX_ONLY(S, L) do { \
+ if (context->getShaderType() != GL_VERTEX_SHADER) { \
+ context->error(L, " supported in vertex shaders only", S); \
+ } \
+} while (0)
+
+#define COMPUTE_ONLY(S, L) do { \
+ if (context->getShaderType() != GL_COMPUTE_SHADER) { \
+ context->error(L, " supported in compute shaders only", S); \
+ } \
+} while (0)
+
+#define ES2_ONLY(S, L) do { \
+ if (context->getShaderVersion() != 100) { \
+ context->error(L, " supported in GLSL ES 1.00 only", S); \
+ } \
+} while (0)
+
+#define ES3_OR_NEWER(TOKEN, LINE, REASON) do { \
+ if (context->getShaderVersion() < 300) { \
+ context->error(LINE, REASON " supported in GLSL ES 3.00 and above only", TOKEN); \
+ } \
+} while (0)
+
+#define ES3_1_ONLY(TOKEN, LINE, REASON) do { \
+ if (context->getShaderVersion() != 310) { \
+ context->error(LINE, REASON " supported in GLSL ES 3.10 only", TOKEN); \
+ } \
+} while (0)
+
+
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+ YYLTYPE yyls_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ + 2 * YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ 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); \
+ } \
+ while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 138
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 2973
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 157
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 95
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 300
+/* YYNSTATES -- Number of states. */
+#define YYNSTATES 426
+
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 411
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 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, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 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, 128, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
+ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
+ 155, 156
+};
+
+#if YYDEBUG
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_uint16 yyrline[] =
+{
+ 0, 248, 248, 249, 252, 259, 262, 267, 272, 277,
+ 282, 291, 297, 300, 303, 306, 309, 312, 318, 325,
+ 331, 334, 342, 345, 351, 354, 360, 364, 371, 379,
+ 382, 385, 391, 394, 397, 400, 407, 408, 409, 410,
+ 418, 419, 422, 425, 432, 433, 436, 442, 443, 447,
+ 454, 455, 458, 461, 464, 470, 471, 474, 480, 481,
+ 488, 489, 496, 497, 504, 505, 511, 512, 518, 519,
+ 525, 526, 532, 533, 539, 540, 541, 542, 546, 547,
+ 548, 552, 556, 560, 564, 571, 574, 580, 587, 594,
+ 597, 600, 604, 608, 612, 616, 620, 627, 634, 637,
+ 644, 652, 669, 679, 682, 688, 692, 696, 700, 707,
+ 714, 717, 721, 725, 730, 737, 741, 745, 749, 754,
+ 761, 765, 771, 774, 780, 784, 791, 797, 801, 805,
+ 808, 811, 820, 825, 829, 832, 835, 838, 841, 845,
+ 848, 852, 855, 858, 861, 864, 867, 874, 881, 884,
+ 887, 893, 900, 903, 909, 912, 915, 918, 924, 927,
+ 934, 939, 946, 951, 962, 965, 968, 971, 974, 977,
+ 981, 985, 989, 993, 997, 1001, 1005, 1009, 1013, 1017,
+ 1021, 1025, 1029, 1033, 1037, 1041, 1045, 1049, 1053, 1057,
+ 1061, 1068, 1071, 1074, 1077, 1080, 1083, 1086, 1089, 1092,
+ 1095, 1098, 1101, 1104, 1107, 1110, 1113, 1116, 1119, 1122,
+ 1125, 1128, 1131, 1141, 1148, 1155, 1158, 1161, 1164, 1167,
+ 1170, 1173, 1176, 1179, 1182, 1185, 1188, 1191, 1194, 1197,
+ 1205, 1205, 1208, 1208, 1214, 1217, 1223, 1226, 1233, 1237,
+ 1243, 1246, 1252, 1256, 1260, 1261, 1267, 1268, 1269, 1270,
+ 1271, 1272, 1273, 1277, 1281, 1281, 1281, 1288, 1289, 1293,
+ 1293, 1294, 1294, 1299, 1303, 1310, 1314, 1321, 1322, 1326,
+ 1332, 1336, 1345, 1345, 1352, 1355, 1361, 1365, 1371, 1371,
+ 1376, 1376, 1380, 1380, 1388, 1391, 1397, 1400, 1406, 1410,
+ 1417, 1420, 1423, 1426, 1429, 1437, 1443, 1449, 1452, 1458,
+ 1458
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 0
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
+ "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
+ "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",
+ "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
+ "BUFFER", "VARYING", "MATRIX2x3", "MATRIX3x2", "MATRIX2x4", "MATRIX4x2",
+ "MATRIX3x4", "MATRIX4x3", "CENTROID", "FLAT", "SMOOTH", "READONLY",
+ "WRITEONLY", "COHERENT", "RESTRICT", "VOLATILE", "SHARED", "STRUCT",
+ "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES",
+ "SAMPLER2DRECT", "SAMPLER2DARRAY", "ISAMPLER2D", "ISAMPLER3D",
+ "ISAMPLERCUBE", "ISAMPLER2DARRAY", "USAMPLER2D", "USAMPLER3D",
+ "USAMPLERCUBE", "USAMPLER2DARRAY", "SAMPLER2DMS", "ISAMPLER2DMS",
+ "USAMPLER2DMS", "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY",
+ "USAMPLER2DMSARRAY", "SAMPLER3D", "SAMPLER3DRECT", "SAMPLER2DSHADOW",
+ "SAMPLERCUBESHADOW", "SAMPLER2DARRAYSHADOW", "SAMPLEREXTERNAL2DY2YEXT",
+ "IMAGE2D", "IIMAGE2D", "UIMAGE2D", "IMAGE3D", "IIMAGE3D", "UIMAGE3D",
+ "IMAGE2DARRAY", "IIMAGE2DARRAY", "UIMAGE2DARRAY", "IMAGECUBE",
+ "IIMAGECUBE", "UIMAGECUBE", "ATOMICUINT", "LAYOUT", "YUVCSCSTANDARDEXT",
+ "YUVCSCSTANDARDEXTCONSTANT", "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT",
+ "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION",
+ "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP",
+ "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN",
+ "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN",
+ "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN",
+ "LEFT_BRACKET", "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT",
+ "COMMA", "COLON", "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS",
+ "STAR", "SLASH", "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR",
+ "CARET", "AMPERSAND", "QUESTION", "$accept", "identifier",
+ "variable_identifier", "primary_expression", "postfix_expression",
+ "integer_expression", "function_call", "function_call_or_method",
+ "function_call_generic", "function_call_header_no_parameters",
+ "function_call_header_with_parameters", "function_call_header",
+ "function_identifier", "unary_expression", "unary_operator",
+ "multiplicative_expression", "additive_expression", "shift_expression",
+ "relational_expression", "equality_expression", "and_expression",
+ "exclusive_or_expression", "inclusive_or_expression",
+ "logical_and_expression", "logical_xor_expression",
+ "logical_or_expression", "conditional_expression",
+ "assignment_expression", "assignment_operator", "expression",
+ "constant_expression", "enter_struct", "declaration",
+ "function_prototype", "function_declarator",
+ "function_header_with_parameters", "function_header",
+ "parameter_declarator", "parameter_declaration",
+ "parameter_type_specifier", "init_declarator_list", "single_declaration",
+ "fully_specified_type", "interpolation_qualifier", "type_qualifier",
+ "invariant_qualifier", "single_type_qualifier", "storage_qualifier",
+ "type_specifier", "precision_qualifier", "layout_qualifier",
+ "layout_qualifier_id_list", "layout_qualifier_id",
+ "type_specifier_no_prec", "array_specifier", "type_specifier_nonarray",
+ "struct_specifier", "$@1", "$@2", "struct_declaration_list",
+ "struct_declaration", "struct_declarator_list", "struct_declarator",
+ "initializer", "declaration_statement", "statement", "simple_statement",
+ "compound_statement_with_scope", "$@3", "$@4", "statement_no_new_scope",
+ "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
+ "statement_list", "expression_statement", "selection_statement",
+ "selection_rest_statement", "switch_statement", "$@7", "case_label",
+ "condition", "iteration_statement", "$@8", "$@9", "$@10",
+ "for_init_statement", "conditionopt", "for_rest_statement",
+ "jump_statement", "translation_unit", "external_declaration",
+ "function_definition", "$@11", YY_NULLPTR
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
+ 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
+ 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
+ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
+ 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
+ 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, 383, 384,
+ 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
+ 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
+ 405, 406, 407, 408, 409, 410, 411
+};
+# endif
+
+#define YYPACT_NINF -361
+
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-361)))
+
+#define YYTABLE_NINF -260
+
+#define yytable_value_is_error(Yytable_value) \
+ 0
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] =
+{
+ 2569, -361, -361, -361, -361, 126, -361, -361, -361, -361,
+ -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, -361, -361, -361, -361, -361, -361, -61, -361,
+ -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, -361, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, -361, -361, -361, -361, -361, -108, -361, -361,
+ -361, -69, -99, -45, 2673, -119, -361, 2, -361, 1397,
+ -361, -361, -361, -361, -361, -361, -361, -80, -361, 2465,
+ -361, -361, 2867, -361, -361, -361, -24, -40, -361, -17,
+ -361, 2673, -361, -361, -361, 2673, 39, 39, -361, -5,
+ -96, -56, -361, 2673, -361, -361, 1495, -32, -361, -361,
+ -9, 2673, -361, -361, -2, -51, -361, 420, -361, -361,
+ -361, -361, -80, -65, -361, 1873, -60, -361, -361, 2673,
+ 39, 2123, -361, -361, 27, -361, -361, -361, -361, -361,
+ 1873, 1873, 1873, -361, -361, -361, -361, -361, -361, -361,
+ -67, -361, -361, -361, 28, -48, 1997, 33, -361, 1873,
+ 15, 22, 58, -89, 54, 24, 34, 38, 67, 72,
+ -95, -361, 59, -361, 1622, -361, 2237, 2673, 66, -361,
+ -40, 53, 55, -361, 64, 69, 56, 1749, 71, 1873,
+ 68, 75, 62, -361, -361, 26, -361, -361, -86, -361,
+ -69, 77, -361, -361, -361, -361, 565, -361, -361, -361,
+ -361, -361, -361, -32, 1873, -57, -361, -361, 1873, 39,
+ -80, -50, -361, -83, -361, -361, -361, -43, -361, -361,
+ 1873, 2770, -361, -361, 1873, 81, -361, -361, -361, 1873,
+ 1873, 1873, 1873, 1873, 1873, 1873, 1873, 1873, 1873, 1873,
+ 1873, 1873, 1873, 1873, 1873, 1873, 1873, 1873, 1873, -361,
+ -361, 80, -361, 2351, -361, -361, -361, -361, -361, 74,
+ -361, 1873, -361, -361, -21, 1873, 76, -361, -361, -361,
+ 710, -361, -361, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, 1873, 1873, -361, -361, -361, -361, 1873, -361,
+ -16, -32, 39, -361, -101, -361, -361, 82, 65, -361,
+ 86, -361, -361, -361, -361, -361, 15, 15, 22, 22,
+ 58, 58, 58, 58, -89, -89, 54, 24, 34, 38,
+ 67, 72, 40, -361, -361, 157, -17, 1000, 1145, -34,
+ -361, -30, -361, 1271, 710, -361, -361, -361, -361, -361,
+ 1873, -361, -361, 1873, 88, -361, -361, -361, -361, 1271,
+ 74, -361, 65, 39, 2673, 89, 84, 90, -361, 1873,
+ -361, 85, 91, 207, -361, 92, 93, 855, -361, 95,
+ -29, 1873, 855, 74, -361, 1873, -361, -361, -361, -361,
+ 96, 65, -361, -361, -361, -361
+};
+
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint16 yydefact[] =
+{
+ 0, 126, 148, 149, 150, 0, 132, 134, 168, 165,
+ 166, 167, 172, 173, 174, 175, 176, 177, 169, 170,
+ 171, 178, 179, 180, 181, 182, 183, 135, 136, 137,
+ 139, 140, 133, 184, 185, 186, 187, 188, 189, 138,
+ 123, 122, 141, 142, 143, 144, 145, 146, 0, 164,
+ 191, 193, 212, 214, 194, 197, 198, 199, 200, 203,
+ 204, 205, 206, 195, 201, 207, 196, 202, 208, 192,
+ 209, 210, 211, 213, 215, 216, 217, 218, 219, 220,
+ 221, 222, 223, 224, 225, 226, 227, 0, 190, 229,
+ 298, 299, 0, 99, 98, 0, 110, 115, 130, 0,
+ 131, 124, 127, 120, 129, 128, 147, 158, 228, 0,
+ 295, 297, 0, 2, 3, 232, 0, 0, 89, 0,
+ 97, 0, 106, 100, 108, 0, 109, 0, 90, 2,
+ 116, 0, 95, 0, 125, 121, 0, 159, 1, 296,
+ 0, 0, 230, 157, 154, 0, 152, 0, 300, 101,
+ 105, 107, 103, 111, 102, 0, 117, 88, 96, 0,
+ 0, 0, 234, 10, 4, 8, 6, 7, 9, 31,
+ 0, 0, 0, 160, 38, 37, 39, 36, 5, 12,
+ 32, 14, 19, 20, 0, 0, 25, 0, 40, 0,
+ 44, 47, 50, 55, 58, 60, 62, 64, 66, 68,
+ 70, 87, 0, 29, 0, 91, 0, 0, 0, 151,
+ 0, 0, 0, 280, 0, 0, 0, 0, 0, 0,
+ 0, 0, 254, 263, 267, 40, 72, 85, 0, 243,
+ 0, 147, 246, 265, 245, 244, 0, 247, 248, 249,
+ 250, 251, 252, 104, 0, 112, 242, 119, 0, 0,
+ 240, 0, 238, 0, 235, 33, 34, 0, 16, 17,
+ 0, 0, 23, 22, 0, 164, 26, 28, 35, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 161,
+ 162, 0, 233, 0, 155, 156, 153, 291, 290, 261,
+ 282, 0, 294, 292, 0, 0, 0, 275, 278, 253,
+ 0, 75, 76, 78, 77, 80, 81, 82, 83, 84,
+ 79, 74, 0, 0, 268, 264, 266, 114, 0, 118,
+ 0, 241, 0, 236, 0, 92, 11, 0, 18, 30,
+ 15, 21, 27, 41, 42, 43, 46, 45, 48, 49,
+ 53, 54, 51, 52, 56, 57, 59, 61, 63, 65,
+ 67, 69, 0, 163, 231, 0, 0, 0, 0, 0,
+ 293, 0, 274, 0, 255, 73, 86, 113, 237, 239,
+ 0, 93, 13, 0, 0, 260, 262, 285, 284, 287,
+ 261, 272, 276, 0, 0, 0, 0, 0, 71, 0,
+ 286, 0, 0, 271, 269, 0, 0, 0, 256, 0,
+ 0, 288, 0, 261, 273, 0, 258, 279, 257, 94,
+ 0, 289, 283, 270, 277, 281
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
+static const yytype_int16 yypgoto[] =
+{
+ -361, -47, -361, -361, -361, -361, -361, -361, -28, -361,
+ -361, -361, -361, 42, -361, -87, -85, -140, -88, -55,
+ -49, -52, -44, -42, -39, -361, -131, -146, -361, -159,
+ -196, -361, 14, 17, -361, -361, -361, 117, 122, 120,
+ -361, -361, -337, -361, -90, -361, -93, -361, -92, 242,
+ -361, -361, 41, 0, -115, -361, -361, -361, -361, -123,
+ -150, 4, -78, -232, -113, -226, -348, -149, -361, -361,
+ -155, -360, -361, -361, -116, -46, -110, -361, -361, -361,
+ -361, -361, -130, -361, -361, -361, -361, -361, -361, -361,
+ -361, -361, 151, -361, -361
+};
+
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
+{
+ -1, 250, 178, 179, 180, 337, 181, 182, 183, 184,
+ 185, 186, 187, 225, 189, 190, 191, 192, 193, 194,
+ 195, 196, 197, 198, 199, 200, 226, 227, 322, 228,
+ 202, 133, 229, 230, 92, 93, 94, 122, 123, 124,
+ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 145, 146, 203, 137, 107, 108, 207, 141, 161,
+ 162, 251, 252, 247, 232, 233, 234, 235, 310, 396,
+ 417, 365, 366, 367, 418, 236, 237, 238, 404, 239,
+ 405, 240, 395, 241, 373, 299, 368, 389, 401, 402,
+ 242, 109, 110, 111, 119
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_int16 yytable[] =
+{
+ 106, 116, 126, 148, 125, 201, 134, 135, 291, 246,
+ 326, 254, 327, 257, 90, 156, 329, 91, 206, 386,
+ 143, 127, 334, 306, 128, 117, 287, 276, 277, 126,
+ 403, 125, 134, 126, 380, 120, 393, 243, 245, 136,
+ 266, 160, 381, 159, 113, 114, 155, 258, 259, 160,
+ 130, 159, 393, 423, 323, 136, 254, 324, 304, 416,
+ 335, 288, 278, 279, 416, 144, 134, 249, 260, 160,
+ 136, 159, 261, 201, 118, 204, 115, 244, 204, 152,
+ 153, 157, 248, 209, 293, 328, 263, 158, 201, 210,
+ 332, 336, 264, 333, 106, 121, 377, 323, 246, 106,
+ 390, 338, 246, 204, 391, 420, 323, 129, 114, 106,
+ 323, 323, 140, 142, 160, 160, 159, 159, 342, 323,
+ 147, 106, 370, 90, 332, 106, 91, 378, 154, 362,
+ 2, 3, 4, 106, 205, 331, 350, 351, 352, 353,
+ 208, 106, 369, 254, 113, 114, 371, 231, 326, 311,
+ 312, 313, 314, 315, 316, 317, 318, 319, 320, 106,
+ -30, 106, 262, 269, 270, 271, 267, 272, 321, 273,
+ 274, 275, 280, 281, 294, 295, 375, 376, 188, 282,
+ 323, 383, 246, 424, 397, 346, 347, 285, 283, 348,
+ 349, 284, 354, 355, 286, 289, 297, 300, 298, 302,
+ 309, 160, 301, 159, 305, 323, 106, 106, 308, 307,
+ -29, -259, 255, 256, 392, -24, 363, 372, 382, -31,
+ 384, 399, 408, 407, 413, 412, 409, 356, 411, 222,
+ 392, 268, 358, 341, 357, 415, 231, 398, 419, 425,
+ 410, 359, 150, 149, 360, 151, 188, 112, 361, 201,
+ 385, 296, 421, 330, 379, 387, 414, 422, 388, 400,
+ 139, 188, 0, 0, 374, 0, 0, 0, 0, 246,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 394, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 106, 0, 0, 0, 0, 0, 394,
+ 0, 134, 135, 0, 0, 0, 0, 0, 0, 0,
+ 231, 343, 344, 345, 188, 188, 188, 188, 188, 188,
+ 188, 188, 188, 188, 188, 188, 188, 188, 188, 188,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 406, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 231, 231, 0,
+ 0, 0, 0, 231, 231, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 231,
+ 0, 0, 0, 0, 106, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 231, 0, 0,
+ 0, 0, 231, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 188, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 211, 212, 213, 0, 214, 215,
+ 216, 217, 218, 219, 220, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 221, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 87, 88, 163, 164, 89, 165, 166, 167,
+ 168, 169, 0, 0, 170, 171, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 172, 0, 0, 0, 222, 223, 0,
+ 0, 0, 0, 224, 174, 175, 176, 177, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 211,
+ 212, 213, 0, 214, 215, 216, 217, 218, 219, 220,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 221, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 0,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 163,
+ 164, 89, 165, 166, 167, 168, 169, 0, 0, 170,
+ 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 172, 0,
+ 0, 0, 222, 325, 0, 0, 0, 0, 224, 174,
+ 175, 176, 177, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 211, 212, 213, 0, 214, 215,
+ 216, 217, 218, 219, 220, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 221, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 87, 88, 163, 164, 89, 165, 166, 167,
+ 168, 169, 0, 0, 170, 171, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 172, 0, 0, 0, 222, 0, 0,
+ 0, 0, 0, 224, 174, 175, 176, 177, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 211,
+ 212, 213, 0, 214, 215, 216, 217, 218, 219, 220,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 221, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 0,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 163,
+ 164, 89, 165, 166, 167, 168, 169, 0, 0, 170,
+ 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 172, 0,
+ 0, 0, 147, 0, 0, 0, 0, 0, 224, 174,
+ 175, 176, 177, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 211, 212, 213, 0, 214, 215,
+ 216, 217, 218, 219, 220, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 221, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 87, 88, 163, 164, 89, 165, 166, 167,
+ 168, 169, 0, 0, 170, 171, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 172, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 224, 174, 175, 176, 177, 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, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 0, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 0,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 163,
+ 164, 89, 165, 166, 167, 168, 169, 0, 0, 170,
+ 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 2, 3, 4, 172, 6,
+ 7, 8, 9, 10, 11, 0, 0, 0, 224, 174,
+ 175, 176, 177, 0, 0, 0, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 0, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 0, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+ 84, 85, 86, 87, 88, 163, 164, 89, 165, 166,
+ 167, 168, 169, 0, 0, 170, 171, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 3, 4, 172, 6, 7, 8, 9, 10,
+ 11, 0, 0, 0, 0, 174, 175, 176, 177, 0,
+ 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 0, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ 69, 0, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 0, 131, 89, 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,
+ 132, 33, 34, 35, 36, 37, 38, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 48, 49, 0, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 0,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 0, 88, 163,
+ 164, 89, 165, 166, 167, 168, 169, 0, 0, 170,
+ 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 172, 0,
+ 0, 173, 8, 9, 10, 11, 0, 0, 0, 174,
+ 175, 176, 177, 0, 0, 0, 0, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 0, 0, 0, 0, 0, 0, 33, 34,
+ 35, 36, 37, 38, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 48, 49, 0, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 0, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, 84, 85, 86, 0, 88, 163, 164, 89, 165,
+ 166, 167, 168, 169, 0, 0, 170, 171, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 172, 0, 0, 290, 8,
+ 9, 10, 11, 0, 0, 0, 174, 175, 176, 177,
+ 0, 0, 0, 0, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 0,
+ 0, 0, 0, 0, 0, 33, 34, 35, 36, 37,
+ 38, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 48, 49, 0, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 0, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+ 86, 0, 88, 163, 164, 89, 165, 166, 167, 168,
+ 169, 0, 0, 170, 171, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 172, 8, 9, 10, 11, 0, 0, 0,
+ 0, 0, 303, 174, 175, 176, 177, 0, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 0, 0, 0, 0, 33,
+ 34, 35, 36, 37, 38, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 48, 49, 0, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 0, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 0, 88, 163, 164, 89,
+ 165, 166, 167, 168, 169, 0, 0, 170, 171, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 172, 8, 9, 10,
+ 11, 0, 0, 0, 0, 0, 0, 174, 175, 176,
+ 177, 0, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
+ 0, 0, 0, 33, 34, 35, 36, 37, 38, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 48, 265,
+ 0, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ 69, 0, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 0,
+ 88, 163, 164, 89, 165, 166, 167, 168, 169, 0,
+ 0, 170, 171, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 2, 3, 4,
+ 172, 6, 7, 8, 9, 10, 11, 0, 0, 0,
+ 0, 174, 175, 176, 177, 0, 0, 0, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 0, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 0, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 87, 88, 0, 0, 89,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 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, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 0, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ 69, 0, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 0, 0, 89, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 2, 3, 4, 0, 6,
+ 7, 8, 9, 10, 11, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 292, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 0, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 0, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+ 84, 85, 86, 87, 88, 0, 0, 89, 0, 0,
+ 0, 0, 0, 0, 0, 138, 0, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 364,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 0, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 0,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 0,
+ 0, 89, 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, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 0, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 0, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+ 86, 87, 88, 0, 0, 89, 1, 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, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 0, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 0, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 87, 88, 0, 0, 89,
+ 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, 0, 33, 34, 35, 36,
+ 37, 38, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 48, 49, 0, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 0, 88, 0, 339, 89, 8, 9, 10,
+ 11, 340, 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, 0, 33, 34, 35, 36, 37, 38, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 48, 49,
+ 0, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ 69, 0, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 0,
+ 88, 0, 0, 89
+};
+
+static const yytype_int16 yycheck[] =
+{
+ 0, 48, 94, 119, 94, 136, 99, 99, 204, 155,
+ 236, 161, 244, 172, 0, 130, 248, 0, 141, 367,
+ 60, 140, 105, 219, 143, 133, 121, 116, 117, 121,
+ 390, 121, 125, 125, 135, 134, 373, 152, 153, 135,
+ 186, 133, 143, 133, 105, 106, 142, 114, 115, 141,
+ 97, 141, 389, 413, 140, 135, 206, 143, 217, 407,
+ 143, 156, 151, 152, 412, 105, 159, 159, 135, 161,
+ 135, 161, 139, 204, 143, 135, 137, 142, 135, 126,
+ 127, 137, 142, 134, 207, 142, 134, 143, 219, 140,
+ 140, 134, 140, 143, 94, 140, 328, 140, 244, 99,
+ 134, 260, 248, 135, 134, 134, 140, 105, 106, 109,
+ 140, 140, 112, 137, 206, 207, 206, 207, 264, 140,
+ 137, 121, 143, 109, 140, 125, 109, 143, 133, 288,
+ 4, 5, 6, 133, 143, 250, 276, 277, 278, 279,
+ 142, 141, 301, 293, 105, 106, 305, 147, 374, 123,
+ 124, 125, 126, 127, 128, 129, 130, 131, 132, 159,
+ 133, 161, 134, 148, 149, 150, 133, 145, 142, 147,
+ 112, 113, 118, 119, 108, 109, 322, 323, 136, 155,
+ 140, 141, 328, 415, 380, 272, 273, 120, 154, 274,
+ 275, 153, 280, 281, 122, 136, 143, 133, 143, 143,
+ 138, 293, 133, 293, 133, 140, 206, 207, 133, 141,
+ 133, 137, 170, 171, 373, 134, 136, 141, 136, 133,
+ 63, 133, 138, 134, 17, 134, 136, 282, 143, 137,
+ 389, 189, 284, 261, 283, 142, 236, 383, 143, 143,
+ 399, 285, 125, 121, 286, 125, 204, 5, 287, 380,
+ 366, 210, 411, 249, 332, 368, 405, 412, 368, 389,
+ 109, 219, -1, -1, 310, -1, -1, -1, -1, 415,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 373, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 293, -1, -1, -1, -1, -1, 389,
+ -1, 394, 394, -1, -1, -1, -1, -1, -1, -1,
+ 310, 269, 270, 271, 272, 273, 274, 275, 276, 277,
+ 278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 393, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 367, 368, -1,
+ -1, -1, -1, 373, 374, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 389,
+ -1, -1, -1, -1, 394, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 407, -1, -1,
+ -1, -1, 412, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 380, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 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, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, -1, 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, -1, -1, 114, 115, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 133, -1, -1, -1, 137, 138, -1,
+ -1, -1, -1, 143, 144, 145, 146, 147, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, -1, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 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, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, -1,
+ 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, -1, -1, 114,
+ 115, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 133, -1,
+ -1, -1, 137, 138, -1, -1, -1, -1, 143, 144,
+ 145, 146, 147, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 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, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, -1, 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, -1, -1, 114, 115, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 133, -1, -1, -1, 137, -1, -1,
+ -1, -1, -1, 143, 144, 145, 146, 147, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, -1, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 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, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, -1,
+ 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, -1, -1, 114,
+ 115, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 133, -1,
+ -1, -1, 137, -1, -1, -1, -1, -1, 143, 144,
+ 145, 146, 147, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 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, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, -1, 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, -1, -1, 114, 115, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 133, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 143, 144, 145, 146, 147, 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, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, -1, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, -1,
+ 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, -1, -1, 114,
+ 115, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 3, 4, 5, 6, 133, 8,
+ 9, 10, 11, 12, 13, -1, -1, -1, 143, 144,
+ 145, 146, 147, -1, -1, -1, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, -1, 64, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, -1, 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, -1, -1, 114, 115, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 3, 4, 5, 6, 133, 8, 9, 10, 11, 12,
+ 13, -1, -1, -1, -1, 144, 145, 146, 147, -1,
+ -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ -1, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, -1, 85, 86, 87, 88, 89, 90, 91, 92,
+ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ 103, -1, 105, 106, -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,
+ 143, 46, 47, 48, 49, 50, 51, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 61, 62, -1, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, -1,
+ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, -1, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, -1, -1, 114,
+ 115, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 133, -1,
+ -1, 136, 10, 11, 12, 13, -1, -1, -1, 144,
+ 145, 146, 147, -1, -1, -1, -1, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, -1, -1, -1, -1, -1, -1, 46, 47,
+ 48, 49, 50, 51, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 61, 62, -1, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, -1, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ 98, 99, 100, 101, -1, 103, 104, 105, 106, 107,
+ 108, 109, 110, 111, -1, -1, 114, 115, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 133, -1, -1, 136, 10,
+ 11, 12, 13, -1, -1, -1, 144, 145, 146, 147,
+ -1, -1, -1, -1, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
+ -1, -1, -1, -1, -1, 46, 47, 48, 49, 50,
+ 51, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 61, 62, -1, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 81, 82, 83, -1, 85, 86, 87, 88, 89, 90,
+ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
+ 101, -1, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, -1, -1, 114, 115, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 133, 10, 11, 12, 13, -1, -1, -1,
+ -1, -1, 143, 144, 145, 146, 147, -1, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, -1, -1, -1, -1, -1, -1, 46,
+ 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 61, 62, -1, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, 82, 83, -1, 85, 86,
+ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+ 97, 98, 99, 100, 101, -1, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, -1, -1, 114, 115, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 133, 10, 11, 12,
+ 13, -1, -1, -1, -1, -1, -1, 144, 145, 146,
+ 147, -1, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
+ -1, -1, -1, 46, 47, 48, 49, 50, 51, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 61, 62,
+ -1, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, -1, 85, 86, 87, 88, 89, 90, 91, 92,
+ 93, 94, 95, 96, 97, 98, 99, 100, 101, -1,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, -1,
+ -1, 114, 115, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
+ 133, 8, 9, 10, 11, 12, 13, -1, -1, -1,
+ -1, 144, 145, 146, 147, -1, -1, -1, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, -1, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, 82, 83, -1, 85, 86,
+ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, -1, -1, 106,
+ -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, 138, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ -1, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, -1, 85, 86, 87, 88, 89, 90, 91, 92,
+ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ 103, -1, -1, 106, -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, 138, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, -1, 64, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, -1, 85, 86, 87, 88,
+ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+ 99, 100, 101, 102, 103, -1, -1, 106, -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, 138,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, -1, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, -1,
+ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, 102, 103, -1,
+ -1, 106, 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, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, -1, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 81, 82, 83, -1, 85, 86, 87, 88, 89, 90,
+ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
+ 101, 102, 103, -1, -1, 106, 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, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, -1, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, 82, 83, -1, 85, 86,
+ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, -1, -1, 106,
+ 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, -1, 46, 47, 48, 49,
+ 50, 51, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 61, 62, -1, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, -1, 85, 86, 87, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, -1, 103, -1, 105, 106, 10, 11, 12,
+ 13, 111, -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, -1, 46, 47, 48, 49, 50, 51, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 61, 62,
+ -1, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, -1, 85, 86, 87, 88, 89, 90, 91, 92,
+ 93, 94, 95, 96, 97, 98, 99, 100, 101, -1,
+ 103, -1, -1, 106
+};
+
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, 102, 103, 106,
+ 189, 190, 191, 192, 193, 197, 198, 199, 200, 201,
+ 202, 203, 204, 205, 206, 207, 210, 212, 213, 248,
+ 249, 250, 206, 105, 106, 137, 158, 133, 143, 251,
+ 134, 140, 194, 195, 196, 201, 205, 140, 143, 105,
+ 158, 105, 143, 188, 203, 205, 135, 211, 0, 249,
+ 210, 215, 137, 60, 105, 208, 209, 137, 231, 195,
+ 194, 196, 158, 158, 133, 142, 211, 137, 143, 201,
+ 205, 216, 217, 104, 105, 107, 108, 109, 110, 111,
+ 114, 115, 133, 136, 144, 145, 146, 147, 159, 160,
+ 161, 163, 164, 165, 166, 167, 168, 169, 170, 171,
+ 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
+ 182, 183, 187, 210, 135, 143, 216, 214, 142, 134,
+ 140, 14, 15, 16, 18, 19, 20, 21, 22, 23,
+ 24, 63, 137, 138, 143, 170, 183, 184, 186, 189,
+ 190, 210, 221, 222, 223, 224, 232, 233, 234, 236,
+ 238, 240, 247, 211, 142, 211, 184, 220, 142, 205,
+ 158, 218, 219, 138, 217, 170, 170, 186, 114, 115,
+ 135, 139, 134, 134, 140, 62, 184, 133, 170, 148,
+ 149, 150, 145, 147, 112, 113, 116, 117, 151, 152,
+ 118, 119, 155, 154, 153, 120, 122, 121, 156, 136,
+ 136, 187, 138, 216, 108, 109, 209, 143, 143, 242,
+ 133, 133, 143, 143, 186, 133, 187, 141, 133, 138,
+ 225, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ 132, 142, 185, 140, 143, 138, 222, 220, 142, 220,
+ 218, 211, 140, 143, 105, 143, 134, 162, 186, 105,
+ 111, 165, 184, 170, 170, 170, 172, 172, 173, 173,
+ 174, 174, 174, 174, 175, 175, 176, 177, 178, 179,
+ 180, 181, 186, 136, 138, 228, 229, 230, 243, 186,
+ 143, 186, 141, 241, 232, 184, 184, 220, 143, 219,
+ 135, 143, 136, 141, 63, 231, 223, 221, 233, 244,
+ 134, 134, 186, 199, 201, 239, 226, 187, 184, 133,
+ 239, 245, 246, 228, 235, 237, 158, 134, 138, 136,
+ 186, 143, 134, 17, 224, 142, 223, 227, 231, 143,
+ 134, 186, 227, 228, 220, 143
+};
+
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 157, 158, 158, 159, 160, 160, 160, 160, 160,
+ 160, 160, 161, 161, 161, 161, 161, 161, 162, 163,
+ 164, 164, 165, 165, 166, 166, 167, 167, 168, 169,
+ 169, 169, 170, 170, 170, 170, 171, 171, 171, 171,
+ 172, 172, 172, 172, 173, 173, 173, 174, 174, 174,
+ 175, 175, 175, 175, 175, 176, 176, 176, 177, 177,
+ 178, 178, 179, 179, 180, 180, 181, 181, 182, 182,
+ 183, 183, 184, 184, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 186, 186, 187, 188, 189,
+ 189, 189, 189, 189, 189, 189, 189, 190, 191, 191,
+ 192, 192, 193, 194, 194, 195, 195, 195, 195, 196,
+ 197, 197, 197, 197, 197, 198, 198, 198, 198, 198,
+ 199, 199, 200, 200, 201, 201, 202, 203, 203, 203,
+ 203, 203, 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 205, 206, 206,
+ 206, 207, 208, 208, 209, 209, 209, 209, 210, 210,
+ 211, 211, 211, 211, 212, 212, 212, 212, 212, 212,
+ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
+ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
+ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
+ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
+ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
+ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
+ 214, 213, 215, 213, 216, 216, 217, 217, 218, 218,
+ 219, 219, 220, 221, 222, 222, 223, 223, 223, 223,
+ 223, 223, 223, 224, 225, 226, 224, 227, 227, 229,
+ 228, 230, 228, 231, 231, 232, 232, 233, 233, 234,
+ 235, 235, 237, 236, 238, 238, 239, 239, 241, 240,
+ 242, 240, 243, 240, 244, 244, 245, 245, 246, 246,
+ 247, 247, 247, 247, 247, 248, 248, 249, 249, 251,
+ 250
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 3, 1, 4, 1, 3, 2, 2, 1, 1,
+ 1, 3, 2, 2, 2, 1, 2, 3, 2, 1,
+ 1, 1, 1, 2, 2, 2, 1, 1, 1, 1,
+ 1, 3, 3, 3, 1, 3, 3, 1, 3, 3,
+ 1, 3, 3, 3, 3, 1, 3, 3, 1, 3,
+ 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
+ 1, 5, 1, 3, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 3, 1, 2, 2,
+ 2, 4, 5, 6, 9, 2, 3, 2, 1, 1,
+ 2, 3, 3, 2, 3, 2, 1, 2, 1, 1,
+ 1, 3, 4, 6, 5, 1, 2, 3, 5, 4,
+ 1, 2, 1, 1, 1, 2, 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, 4, 1, 3, 1, 3, 3, 1, 1, 2,
+ 2, 3, 3, 4, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 0, 0, 5, 1, 1, 0,
+ 2, 0, 2, 2, 3, 1, 2, 1, 2, 5,
+ 3, 1, 0, 6, 3, 2, 1, 4, 0, 6,
+ 0, 8, 0, 7, 1, 1, 1, 0, 2, 3,
+ 2, 2, 2, 3, 2, 1, 2, 1, 1, 0,
+ 3
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (&yylloc, context, scanner, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (N) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (0)
+#endif
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
+#ifndef YY_LOCATION_PRINT
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+
+/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
+
+YY_ATTRIBUTE_UNUSED
+static unsigned
+yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
+{
+ unsigned res = 0;
+ int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
+ if (0 <= yylocp->first_line)
+ {
+ res += YYFPRINTF (yyo, "%d", yylocp->first_line);
+ if (0 <= yylocp->first_column)
+ res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
+ }
+ if (0 <= yylocp->last_line)
+ {
+ if (yylocp->first_line < yylocp->last_line)
+ {
+ res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
+ if (0 <= end_col)
+ res += YYFPRINTF (yyo, ".%d", end_col);
+ }
+ else if (0 <= end_col && yylocp->first_column < end_col)
+ res += YYFPRINTF (yyo, "-%d", end_col);
+ }
+ return res;
+ }
+
+# define YY_LOCATION_PRINT(File, Loc) \
+ yy_location_print_ (File, &(Loc))
+
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, Location, context, scanner); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context, void *scanner)
+{
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
+ YYUSE (yylocationp);
+ YYUSE (context);
+ YYUSE (scanner);
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+ YYUSE (yytype);
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context, void *scanner)
+{
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+ YY_LOCATION_PRINT (yyoutput, *yylocationp);
+ YYFPRINTF (yyoutput, ": ");
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context, scanner);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context, void *scanner)
+{
+ unsigned long int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , &(yylsp[(yyi + 1) - (yynrhs)]) , context, scanner);
+ YYFPRINTF (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, yylsp, Rule, context, scanner); \
+} while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+static YYSIZE_T
+yystrlen (const char *yystr)
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
+ {
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
+ }
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context, void *scanner)
+{
+ YYUSE (yyvaluep);
+ YYUSE (yylocationp);
+ YYUSE (context);
+ YYUSE (scanner);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+int
+yyparse (TParseContext* context, void *scanner)
+{
+/* The lookahead symbol. */
+int yychar;
+
+
+/* The semantic value of the lookahead symbol. */
+/* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
+
+/* Location data for the lookahead symbol. */
+static YYLTYPE yyloc_default
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+ = { 1, 1, 1, 1 }
+# endif
+;
+YYLTYPE yylloc = yyloc_default;
+
+ /* Number of syntax errors so far. */
+ int yynerrs;
+
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+
+ /* The stacks and their tools:
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
+ 'yyls': related to locations.
+
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
+
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls;
+ YYLTYPE *yylsp;
+
+ /* The locations where the error started and ended. */
+ YYLTYPE yyerror_range[3];
+
+ YYSIZE_T yystacksize;
+
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+ YYLTYPE yyloc;
+
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yylsp = yyls = yylsa;
+ yystacksize = YYINITDEPTH;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+ yylsp[0] = yylloc;
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+ YYLTYPE *yyls1 = yyls;
+
+ /* 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);
+
+ yyls = yyls1;
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ YYSTACK_RELOCATE (yyls_alloc, yyls);
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+ yylsp = yyls + yysize - 1;
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+ if (yypact_value_is_default (yyn))
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = yylex (&yylval, &yylloc, scanner);
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+ *++yylsp = yylloc;
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ '$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+ /* Default location. */
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 4:
+
+ {
+ // The symbol table search was done in the lexical phase
+ (yyval.interm.intermTypedNode) = context->parseVariableIdentifier((yylsp[0]), ImmutableString((yyvsp[0].lex).string), (yyvsp[0].lex).symbol);
+ }
+
+ break;
+
+ case 5:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 6:
+
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray->setIConst((yyvsp[0].lex).i);
+ (yyval.interm.intermTypedNode) = context->addScalarLiteral(unionArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 7:
+
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray->setUConst((yyvsp[0].lex).u);
+ (yyval.interm.intermTypedNode) = context->addScalarLiteral(unionArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 8:
+
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray->setFConst((yyvsp[0].lex).f);
+ (yyval.interm.intermTypedNode) = context->addScalarLiteral(unionArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 9:
+
+ {
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray->setBConst((yyvsp[0].lex).b);
+ (yyval.interm.intermTypedNode) = context->addScalarLiteral(unionArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 10:
+
+ {
+ if (!context->checkCanUseExtension((yylsp[0]), TExtension::EXT_YUV_target))
+ {
+ context->error((yylsp[0]), "unsupported value", ImmutableString((yyvsp[0].lex).string));
+ }
+ TConstantUnion *unionArray = new TConstantUnion[1];
+ unionArray->setYuvCscStandardEXTConst(getYuvCscStandardEXT(ImmutableString((yyvsp[0].lex).string)));
+ (yyval.interm.intermTypedNode) = context->addScalarLiteral(unionArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 11:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 12:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 13:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[-3].interm.intermTypedNode), (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
+ }
+
+ break;
+
+ case 14:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 15:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addFieldSelectionExpression((yyvsp[-2].interm.intermTypedNode), (yylsp[-1]), ImmutableString((yyvsp[0].lex).string), (yylsp[0]));
+ }
+
+ break;
+
+ case 16:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]));
+ }
+
+ break;
+
+ case 17:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]));
+ }
+
+ break;
+
+ case 18:
+
+ {
+ context->checkIsScalarInteger((yyvsp[0].interm.intermTypedNode), "[]");
+ (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 19:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addFunctionCallOrMethod((yyvsp[0].interm.functionLookup), (yylsp[0]));
+ }
+
+ break;
+
+ case 20:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[0].interm.functionLookup);
+ }
+
+ break;
+
+ case 21:
+
+ {
+ ES3_OR_NEWER("", (yylsp[0]), "methods");
+ (yyval.interm.functionLookup) = (yyvsp[0].interm.functionLookup);
+ (yyval.interm.functionLookup)->setThisNode((yyvsp[-2].interm.intermTypedNode));
+ }
+
+ break;
+
+ case 22:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[-1].interm.functionLookup);
+ }
+
+ break;
+
+ case 23:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[-1].interm.functionLookup);
+ }
+
+ break;
+
+ case 24:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[-1].interm.functionLookup);
+ }
+
+ break;
+
+ case 25:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[0].interm.functionLookup);
+ }
+
+ break;
+
+ case 26:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[-1].interm.functionLookup);
+ (yyval.interm.functionLookup)->addArgument((yyvsp[0].interm.intermTypedNode));
+ }
+
+ break;
+
+ case 27:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[-2].interm.functionLookup);
+ (yyval.interm.functionLookup)->addArgument((yyvsp[0].interm.intermTypedNode));
+ }
+
+ break;
+
+ case 28:
+
+ {
+ (yyval.interm.functionLookup) = (yyvsp[-1].interm.functionLookup);
+ }
+
+ break;
+
+ case 29:
+
+ {
+ (yyval.interm.functionLookup) = context->addConstructorFunc((yyvsp[0].interm.type));
+ }
+
+ break;
+
+ case 30:
+
+ {
+ (yyval.interm.functionLookup) = context->addNonConstructorFunc(ImmutableString((yyvsp[0].lex).string), (yyvsp[0].lex).symbol);
+ }
+
+ break;
+
+ case 31:
+
+ {
+ (yyval.interm.functionLookup) = context->addNonConstructorFunc(ImmutableString((yyvsp[0].lex).string), (yyvsp[0].lex).symbol);
+ }
+
+ break;
+
+ case 32:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 33:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPreIncrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 34:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPreDecrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 35:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addUnaryMath((yyvsp[-1].interm.op), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 36:
+
+ { (yyval.interm.op) = EOpPositive; }
+
+ break;
+
+ case 37:
+
+ { (yyval.interm.op) = EOpNegative; }
+
+ break;
+
+ case 38:
+
+ { (yyval.interm.op) = EOpLogicalNot; }
+
+ break;
+
+ case 39:
+
+ {
+ ES3_OR_NEWER("~", (yyloc), "bit-wise operator");
+ (yyval.interm.op) = EOpBitwiseNot;
+ }
+
+ break;
+
+ case 40:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 41:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 42:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 43:
+
+ {
+ ES3_OR_NEWER("%", (yylsp[-1]), "integer modulus operator");
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpIMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 44:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 45:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 46:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 47:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 48:
+
+ {
+ ES3_OR_NEWER("<<", (yylsp[-1]), "bit-wise operator");
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftLeft, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 49:
+
+ {
+ ES3_OR_NEWER(">>", (yylsp[-1]), "bit-wise operator");
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftRight, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 50:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 51:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 52:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 53:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 54:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 55:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 56:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 57:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpNotEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 58:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 59:
+
+ {
+ ES3_OR_NEWER("&", (yylsp[-1]), "bit-wise operator");
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 60:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 61:
+
+ {
+ ES3_OR_NEWER("^", (yylsp[-1]), "bit-wise operator");
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 62:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 63:
+
+ {
+ ES3_OR_NEWER("|", (yylsp[-1]), "bit-wise operator");
+ (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 64:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 65:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 66:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 67:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 68:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 69:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 70:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 71:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addTernarySelection((yyvsp[-4].interm.intermTypedNode), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-3]));
+ }
+
+ break;
+
+ case 72:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 73:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addAssign((yyvsp[-1].interm.op), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 74:
+
+ { (yyval.interm.op) = EOpAssign; }
+
+ break;
+
+ case 75:
+
+ { (yyval.interm.op) = EOpMulAssign; }
+
+ break;
+
+ case 76:
+
+ { (yyval.interm.op) = EOpDivAssign; }
+
+ break;
+
+ case 77:
+
+ {
+ ES3_OR_NEWER("%=", (yyloc), "integer modulus operator");
+ (yyval.interm.op) = EOpIModAssign;
+ }
+
+ break;
+
+ case 78:
+
+ { (yyval.interm.op) = EOpAddAssign; }
+
+ break;
+
+ case 79:
+
+ { (yyval.interm.op) = EOpSubAssign; }
+
+ break;
+
+ case 80:
+
+ {
+ ES3_OR_NEWER("<<=", (yyloc), "bit-wise operator");
+ (yyval.interm.op) = EOpBitShiftLeftAssign;
+ }
+
+ break;
+
+ case 81:
+
+ {
+ ES3_OR_NEWER(">>=", (yyloc), "bit-wise operator");
+ (yyval.interm.op) = EOpBitShiftRightAssign;
+ }
+
+ break;
+
+ case 82:
+
+ {
+ ES3_OR_NEWER("&=", (yyloc), "bit-wise operator");
+ (yyval.interm.op) = EOpBitwiseAndAssign;
+ }
+
+ break;
+
+ case 83:
+
+ {
+ ES3_OR_NEWER("^=", (yyloc), "bit-wise operator");
+ (yyval.interm.op) = EOpBitwiseXorAssign;
+ }
+
+ break;
+
+ case 84:
+
+ {
+ ES3_OR_NEWER("|=", (yyloc), "bit-wise operator");
+ (yyval.interm.op) = EOpBitwiseOrAssign;
+ }
+
+ break;
+
+ case 85:
+
+ {
+ (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 86:
+
+ {
+ (yyval.interm.intermTypedNode) = context->addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+ }
+
+ break;
+
+ case 87:
+
+ {
+ context->checkIsConst((yyvsp[0].interm.intermTypedNode));
+ (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 88:
+
+ {
+ context->enterStructDeclaration((yylsp[-1]), ImmutableString((yyvsp[-1].lex).string));
+ (yyval.lex) = (yyvsp[-1].lex);
+ }
+
+ break;
+
+ case 89:
+
+ {
+ (yyval.interm.intermNode) = context->addFunctionPrototypeDeclaration(*((yyvsp[-1].interm).function), (yylsp[-1]));
+ }
+
+ break;
+
+ case 90:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[-1].interm).intermDeclaration;
+ }
+
+ break;
+
+ case 91:
+
+ {
+ context->parseDefaultPrecisionQualifier((yyvsp[-2].interm.precision), (yyvsp[-1].interm.type), (yylsp[-3]));
+ (yyval.interm.intermNode) = nullptr;
+ }
+
+ break;
+
+ case 92:
+
+ {
+ ES3_OR_NEWER(ImmutableString((yyvsp[-3].lex).string), (yylsp[-4]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock(*(yyvsp[-4].interm.typeQualifierBuilder), (yylsp[-3]), ImmutableString((yyvsp[-3].lex).string), (yyvsp[-2].interm.fieldList), kEmptyImmutableString, (yyloc), NULL, (yyloc));
+ }
+
+ break;
+
+ case 93:
+
+ {
+ ES3_OR_NEWER(ImmutableString((yyvsp[-4].lex).string), (yylsp[-5]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock(*(yyvsp[-5].interm.typeQualifierBuilder), (yylsp[-4]), ImmutableString((yyvsp[-4].lex).string), (yyvsp[-3].interm.fieldList), ImmutableString((yyvsp[-1].lex).string), (yylsp[-1]), NULL, (yyloc));
+ }
+
+ break;
+
+ case 94:
+
+ {
+ ES3_OR_NEWER(ImmutableString((yyvsp[-7].lex).string), (yylsp[-8]), "interface blocks");
+ (yyval.interm.intermNode) = context->addInterfaceBlock(*(yyvsp[-8].interm.typeQualifierBuilder), (yylsp[-7]), ImmutableString((yyvsp[-7].lex).string), (yyvsp[-6].interm.fieldList), ImmutableString((yyvsp[-4].lex).string), (yylsp[-4]), (yyvsp[-2].interm.intermTypedNode), (yylsp[-3]));
+ }
+
+ break;
+
+ case 95:
+
+ {
+ context->parseGlobalLayoutQualifier(*(yyvsp[-1].interm.typeQualifierBuilder));
+ (yyval.interm.intermNode) = nullptr;
+ }
+
+ break;
+
+ case 96:
+
+ {
+ (yyval.interm.intermNode) = context->parseInvariantDeclaration(*(yyvsp[-2].interm.typeQualifierBuilder), (yylsp[-1]), ImmutableString((yyvsp[-1].lex).string), (yyvsp[-1].lex).symbol);
+ }
+
+ break;
+
+ case 97:
+
+ {
+ (yyval.interm).function = context->parseFunctionDeclarator((yylsp[0]), (yyvsp[-1].interm.function));
+ context->exitFunctionDeclaration();
+ }
+
+ break;
+
+ case 98:
+
+ {
+ (yyval.interm.function) = (yyvsp[0].interm.function);
+ }
+
+ break;
+
+ case 99:
+
+ {
+ (yyval.interm.function) = (yyvsp[0].interm.function);
+ }
+
+ break;
+
+ case 100:
+
+ {
+ // Add the parameter
+ (yyval.interm.function) = (yyvsp[-1].interm.function);
+ if ((yyvsp[0].interm.param).type->getBasicType() != EbtVoid)
+ {
+ (yyvsp[-1].interm.function)->addParameter((yyvsp[0].interm.param).createVariable(&context->symbolTable));
+ }
+ }
+
+ break;
+
+ case 101:
+
+ {
+ (yyval.interm.function) = (yyvsp[-2].interm.function);
+ // Only first parameter of one-parameter functions can be void
+ // The check for named parameters not being void is done in parameter_declarator
+ if ((yyvsp[0].interm.param).type->getBasicType() == EbtVoid)
+ {
+ // This parameter > first is void
+ context->error((yylsp[-1]), "cannot be a parameter type except for '(void)'", "void");
+ }
+ else
+ {
+ (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm.param).createVariable(&context->symbolTable));
+ }
+ }
+
+ break;
+
+ case 102:
+
+ {
+ (yyval.interm.function) = context->parseFunctionHeader((yyvsp[-2].interm.type), ImmutableString((yyvsp[-1].lex).string), (yylsp[-1]));
+
+ context->symbolTable.push();
+ context->enterFunctionDeclaration();
+ }
+
+ break;
+
+ case 103:
+
+ {
+ (yyval.interm.param) = context->parseParameterDeclarator((yyvsp[-1].interm.type), ImmutableString((yyvsp[0].lex).string), (yylsp[0]));
+ }
+
+ break;
+
+ case 104:
+
+ {
+ (yyval.interm.param) = context->parseParameterArrayDeclarator(ImmutableString((yyvsp[-1].lex).string), (yylsp[-1]), *((yyvsp[0].interm.arraySizes)), (yylsp[0]), &(yyvsp[-2].interm.type));
+ }
+
+ break;
+
+ case 105:
+
+ {
+ (yyval.interm.param) = (yyvsp[0].interm.param);
+ context->checkIsParameterQualifierValid((yylsp[0]), *(yyvsp[-1].interm.typeQualifierBuilder), (yyvsp[0].interm.param).type);
+ }
+
+ break;
+
+ case 106:
+
+ {
+ (yyval.interm.param) = (yyvsp[0].interm.param);
+ (yyval.interm.param).type->setQualifier(EvqIn);
+ }
+
+ break;
+
+ case 107:
+
+ {
+ (yyval.interm.param) = (yyvsp[0].interm.param);
+ context->checkIsParameterQualifierValid((yylsp[0]), *(yyvsp[-1].interm.typeQualifierBuilder), (yyvsp[0].interm.param).type);
+ }
+
+ break;
+
+ case 108:
+
+ {
+ (yyval.interm.param) = (yyvsp[0].interm.param);
+ (yyval.interm.param).type->setQualifier(EvqIn);
+ }
+
+ break;
+
+ case 109:
+
+ {
+ TParameter param = { 0, new TType((yyvsp[0].interm.type)) };
+ (yyval.interm.param) = param;
+ }
+
+ break;
+
+ case 110:
+
+ {
+ (yyval.interm) = (yyvsp[0].interm);
+ }
+
+ break;
+
+ case 111:
+
+ {
+ (yyval.interm) = (yyvsp[-2].interm);
+ context->parseDeclarator((yyval.interm).type, (yylsp[0]), ImmutableString((yyvsp[0].lex).string), (yyval.interm).intermDeclaration);
+ }
+
+ break;
+
+ case 112:
+
+ {
+ (yyval.interm) = (yyvsp[-3].interm);
+ context->parseArrayDeclarator((yyval.interm).type, (yylsp[-1]), ImmutableString((yyvsp[-1].lex).string), (yylsp[0]), *((yyvsp[0].interm.arraySizes)), (yyval.interm).intermDeclaration);
+ }
+
+ break;
+
+ case 113:
+
+ {
+ ES3_OR_NEWER("=", (yylsp[-1]), "first-class arrays (array initializer)");
+ (yyval.interm) = (yyvsp[-5].interm);
+ context->parseArrayInitDeclarator((yyval.interm).type, (yylsp[-3]), ImmutableString((yyvsp[-3].lex).string), (yylsp[-2]), *((yyvsp[-2].interm.arraySizes)), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode), (yyval.interm).intermDeclaration);
+ }
+
+ break;
+
+ case 114:
+
+ {
+ (yyval.interm) = (yyvsp[-4].interm);
+ context->parseInitDeclarator((yyval.interm).type, (yylsp[-2]), ImmutableString((yyvsp[-2].lex).string), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode), (yyval.interm).intermDeclaration);
+ }
+
+ break;
+
+ case 115:
+
+ {
+ (yyval.interm).type = (yyvsp[0].interm.type);
+ (yyval.interm).intermDeclaration = context->parseSingleDeclaration((yyval.interm).type, (yylsp[0]), kEmptyImmutableString);
+ }
+
+ break;
+
+ case 116:
+
+ {
+ (yyval.interm).type = (yyvsp[-1].interm.type);
+ (yyval.interm).intermDeclaration = context->parseSingleDeclaration((yyval.interm).type, (yylsp[0]), ImmutableString((yyvsp[0].lex).string));
+ }
+
+ break;
+
+ case 117:
+
+ {
+ (yyval.interm).type = (yyvsp[-2].interm.type);
+ (yyval.interm).intermDeclaration = context->parseSingleArrayDeclaration((yyval.interm).type, (yylsp[-1]), ImmutableString((yyvsp[-1].lex).string), (yylsp[0]), *((yyvsp[0].interm.arraySizes)));
+ }
+
+ break;
+
+ case 118:
+
+ {
+ ES3_OR_NEWER("[]", (yylsp[-2]), "first-class arrays (array initializer)");
+ (yyval.interm).type = (yyvsp[-4].interm.type);
+ (yyval.interm).intermDeclaration = context->parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[-3]), ImmutableString((yyvsp[-3].lex).string), (yylsp[-2]), *((yyvsp[-2].interm.arraySizes)), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
+ }
+
+ break;
+
+ case 119:
+
+ {
+ (yyval.interm).type = (yyvsp[-3].interm.type);
+ (yyval.interm).intermDeclaration = context->parseSingleInitDeclaration((yyval.interm).type, (yylsp[-2]), ImmutableString((yyvsp[-2].lex).string), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
+ }
+
+ break;
+
+ case 120:
+
+ {
+ context->addFullySpecifiedType(&(yyvsp[0].interm.type));
+ (yyval.interm.type) = (yyvsp[0].interm.type);
+ }
+
+ break;
+
+ case 121:
+
+ {
+ (yyval.interm.type) = context->addFullySpecifiedType(*(yyvsp[-1].interm.typeQualifierBuilder), (yyvsp[0].interm.type));
+ }
+
+ break;
+
+ case 122:
+
+ {
+ (yyval.interm.qualifier) = EvqSmooth;
+ }
+
+ break;
+
+ case 123:
+
+ {
+ (yyval.interm.qualifier) = EvqFlat;
+ }
+
+ break;
+
+ case 124:
+
+ {
+ (yyval.interm.typeQualifierBuilder) = context->createTypeQualifierBuilder((yylsp[0]));
+ (yyval.interm.typeQualifierBuilder)->appendQualifier((yyvsp[0].interm.qualifierWrapper));
+ }
+
+ break;
+
+ case 125:
+
+ {
+ (yyval.interm.typeQualifierBuilder) = (yyvsp[-1].interm.typeQualifierBuilder);
+ (yyval.interm.typeQualifierBuilder)->appendQualifier((yyvsp[0].interm.qualifierWrapper));
+ }
+
+ break;
+
+ case 126:
+
+ {
+ // empty
+ }
+
+ break;
+
+ case 127:
+
+ {
+ context->checkLocalVariableConstStorageQualifier(*(yyvsp[0].interm.qualifierWrapper));
+ (yyval.interm.qualifierWrapper) = (yyvsp[0].interm.qualifierWrapper);
+ }
+
+ break;
+
+ case 128:
+
+ {
+ context->checkIsAtGlobalLevel((yylsp[0]), "layout");
+ (yyval.interm.qualifierWrapper) = new TLayoutQualifierWrapper((yyvsp[0].interm.layoutQualifier), (yylsp[0]));
+ }
+
+ break;
+
+ case 129:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TPrecisionQualifierWrapper((yyvsp[0].interm.precision), (yylsp[0]));
+ }
+
+ break;
+
+ case 130:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TInterpolationQualifierWrapper((yyvsp[0].interm.qualifier), (yylsp[0]));
+ }
+
+ break;
+
+ case 131:
+
+ {
+ context->checkIsAtGlobalLevel((yylsp[0]), "invariant");
+ (yyval.interm.qualifierWrapper) = new TInvariantQualifierWrapper((yylsp[0]));
+ }
+
+ break;
+
+ case 132:
+
+ {
+ VERTEX_ONLY("attribute", (yylsp[0]));
+ ES2_ONLY("attribute", (yylsp[0]));
+ (yyval.interm.qualifierWrapper) = context->parseGlobalStorageQualifier(EvqAttribute, (yylsp[0]));
+ }
+
+ break;
+
+ case 133:
+
+ {
+ ES2_ONLY("varying", (yylsp[0]));
+ (yyval.interm.qualifierWrapper) = context->parseVaryingQualifier((yylsp[0]));
+ }
+
+ break;
+
+ case 134:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TStorageQualifierWrapper(EvqConst, (yylsp[0]));
+ }
+
+ break;
+
+ case 135:
+
+ {
+ (yyval.interm.qualifierWrapper) = context->parseInQualifier((yylsp[0]));
+ }
+
+ break;
+
+ case 136:
+
+ {
+ (yyval.interm.qualifierWrapper) = context->parseOutQualifier((yylsp[0]));
+ }
+
+ break;
+
+ case 137:
+
+ {
+ (yyval.interm.qualifierWrapper) = context->parseInOutQualifier((yylsp[0]));
+ }
+
+ break;
+
+ case 138:
+
+ {
+ ES3_OR_NEWER("centroid", (yylsp[0]), "storage qualifier");
+ (yyval.interm.qualifierWrapper) = new TStorageQualifierWrapper(EvqCentroid, (yylsp[0]));
+ }
+
+ break;
+
+ case 139:
+
+ {
+ (yyval.interm.qualifierWrapper) = context->parseGlobalStorageQualifier(EvqUniform, (yylsp[0]));
+ }
+
+ break;
+
+ case 140:
+
+ {
+ ES3_1_ONLY("buffer", (yylsp[0]), "storage qualifier");
+ (yyval.interm.qualifierWrapper) = context->parseGlobalStorageQualifier(EvqBuffer, (yylsp[0]));
+ }
+
+ break;
+
+ case 141:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TMemoryQualifierWrapper(EvqReadOnly, (yylsp[0]));
+ }
+
+ break;
+
+ case 142:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TMemoryQualifierWrapper(EvqWriteOnly, (yylsp[0]));
+ }
+
+ break;
+
+ case 143:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TMemoryQualifierWrapper(EvqCoherent, (yylsp[0]));
+ }
+
+ break;
+
+ case 144:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TMemoryQualifierWrapper(EvqRestrict, (yylsp[0]));
+ }
+
+ break;
+
+ case 145:
+
+ {
+ (yyval.interm.qualifierWrapper) = new TMemoryQualifierWrapper(EvqVolatile, (yylsp[0]));
+ }
+
+ break;
+
+ case 146:
+
+ {
+ COMPUTE_ONLY("shared", (yylsp[0]));
+ (yyval.interm.qualifierWrapper) = context->parseGlobalStorageQualifier(EvqShared, (yylsp[0]));
+ }
+
+ break;
+
+ case 147:
+
+ {
+ (yyval.interm.type) = (yyvsp[0].interm.type);
+ (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[0].interm.type).getBasicType());
+ }
+
+ break;
+
+ case 148:
+
+ {
+ (yyval.interm.precision) = EbpHigh;
+ }
+
+ break;
+
+ case 149:
+
+ {
+ (yyval.interm.precision) = EbpMedium;
+ }
+
+ break;
+
+ case 150:
+
+ {
+ (yyval.interm.precision) = EbpLow;
+ }
+
+ break;
+
+ case 151:
+
+ {
+ ES3_OR_NEWER("layout", (yylsp[-3]), "qualifier");
+ (yyval.interm.layoutQualifier) = (yyvsp[-1].interm.layoutQualifier);
+ }
+
+ break;
+
+ case 152:
+
+ {
+ (yyval.interm.layoutQualifier) = (yyvsp[0].interm.layoutQualifier);
+ }
+
+ break;
+
+ case 153:
+
+ {
+ (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[-2].interm.layoutQualifier), (yyvsp[0].interm.layoutQualifier), (yylsp[0]));
+ }
+
+ break;
+
+ case 154:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(ImmutableString((yyvsp[0].lex).string), (yylsp[0]));
+ }
+
+ break;
+
+ case 155:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(ImmutableString((yyvsp[-2].lex).string), (yylsp[-2]), (yyvsp[0].lex).i, (yylsp[0]));
+ }
+
+ break;
+
+ case 156:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(ImmutableString((yyvsp[-2].lex).string), (yylsp[-2]), (yyvsp[0].lex).i, (yylsp[0]));
+ }
+
+ break;
+
+ case 157:
+
+ {
+ (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(ImmutableString("shared"), (yylsp[0]));
+ }
+
+ break;
+
+ case 158:
+
+ {
+ (yyval.interm.type).initialize((yyvsp[0].interm.typeSpecifierNonArray), (context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary));
+ }
+
+ break;
+
+ case 159:
+
+ {
+ (yyval.interm.type).initialize((yyvsp[-1].interm.typeSpecifierNonArray), (context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary));
+ (yyval.interm.type).setArraySizes((yyvsp[0].interm.arraySizes));
+ }
+
+ break;
+
+ case 160:
+
+ {
+ ES3_OR_NEWER("[]", (yylsp[-1]), "implicitly sized array");
+ (yyval.interm.arraySizes) = new TVector<unsigned int>();
+ (yyval.interm.arraySizes)->push_back(0u);
+ }
+
+ break;
+
+ case 161:
+
+ {
+ (yyval.interm.arraySizes) = new TVector<unsigned int>();
+ unsigned int size = context->checkIsValidArraySize((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
+ // Make the type an array even if size check failed.
+ // This ensures useless error messages regarding a variable's non-arrayness won't follow.
+ (yyval.interm.arraySizes)->push_back(size);
+ }
+
+ break;
+
+ case 162:
+
+ {
+ ES3_1_ONLY("[]", (yylsp[-1]), "arrays of arrays");
+ (yyval.interm.arraySizes) = (yyvsp[-2].interm.arraySizes);
+ (yyval.interm.arraySizes)->insert((yyval.interm.arraySizes)->begin(), 0u);
+ }
+
+ break;
+
+ case 163:
+
+ {
+ ES3_1_ONLY("[]", (yylsp[-2]), "arrays of arrays");
+ (yyval.interm.arraySizes) = (yyvsp[-3].interm.arraySizes);
+ unsigned int size = context->checkIsValidArraySize((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
+ // Make the type an array even if size check failed.
+ // This ensures useless error messages regarding a variable's non-arrayness won't follow.
+ (yyval.interm.arraySizes)->insert((yyval.interm.arraySizes)->begin(), size);
+ }
+
+ break;
+
+ case 164:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtVoid, (yylsp[0]));
+ }
+
+ break;
+
+ case 165:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ }
+
+ break;
+
+ case 166:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtInt, (yylsp[0]));
+ }
+
+ break;
+
+ case 167:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUInt, (yylsp[0]));
+ }
+
+ break;
+
+ case 168:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtBool, (yylsp[0]));
+ }
+
+ break;
+
+ case 169:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(2);
+ }
+
+ break;
+
+ case 170:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(3);
+ }
+
+ break;
+
+ case 171:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(4);
+ }
+
+ break;
+
+ case 172:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtBool, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(2);
+ }
+
+ break;
+
+ case 173:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtBool, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(3);
+ }
+
+ break;
+
+ case 174:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtBool, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(4);
+ }
+
+ break;
+
+ case 175:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtInt, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(2);
+ }
+
+ break;
+
+ case 176:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtInt, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(3);
+ }
+
+ break;
+
+ case 177:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtInt, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(4);
+ }
+
+ break;
+
+ case 178:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUInt, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(2);
+ }
+
+ break;
+
+ case 179:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUInt, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(3);
+ }
+
+ break;
+
+ case 180:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUInt, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setAggregate(4);
+ }
+
+ break;
+
+ case 181:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(2, 2);
+ }
+
+ break;
+
+ case 182:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(3, 3);
+ }
+
+ break;
+
+ case 183:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(4, 4);
+ }
+
+ break;
+
+ case 184:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(2, 3);
+ }
+
+ break;
+
+ case 185:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(3, 2);
+ }
+
+ break;
+
+ case 186:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(2, 4);
+ }
+
+ break;
+
+ case 187:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(4, 2);
+ }
+
+ break;
+
+ case 188:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(3, 4);
+ }
+
+ break;
+
+ case 189:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtFloat, (yylsp[0]));
+ (yyval.interm.typeSpecifierNonArray).setMatrix(4, 3);
+ }
+
+ break;
+
+ case 190:
+
+ {
+ if (!context->checkCanUseExtension((yylsp[0]), TExtension::EXT_YUV_target))
+ {
+ context->error((yylsp[0]), "unsupported type", "yuvCscStandardEXT");
+ }
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtYuvCscStandardEXT, (yylsp[0]));
+ }
+
+ break;
+
+ case 191:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler2D, (yylsp[0]));
+ }
+
+ break;
+
+ case 192:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler3D, (yylsp[0]));
+ }
+
+ break;
+
+ case 193:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSamplerCube, (yylsp[0]));
+ }
+
+ break;
+
+ case 194:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler2DArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 195:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler2DMS, (yylsp[0]));
+ }
+
+ break;
+
+ case 196:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler2DMSArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 197:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtISampler2D, (yylsp[0]));
+ }
+
+ break;
+
+ case 198:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtISampler3D, (yylsp[0]));
+ }
+
+ break;
+
+ case 199:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtISamplerCube, (yylsp[0]));
+ }
+
+ break;
+
+ case 200:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtISampler2DArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 201:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtISampler2DMS, (yylsp[0]));
+ }
+
+ break;
+
+ case 202:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtISampler2DMSArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 203:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUSampler2D, (yylsp[0]));
+ }
+
+ break;
+
+ case 204:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUSampler3D, (yylsp[0]));
+ }
+
+ break;
+
+ case 205:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUSamplerCube, (yylsp[0]));
+ }
+
+ break;
+
+ case 206:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUSampler2DArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 207:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUSampler2DMS, (yylsp[0]));
+ }
+
+ break;
+
+ case 208:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUSampler2DMSArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 209:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler2DShadow, (yylsp[0]));
+ }
+
+ break;
+
+ case 210:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSamplerCubeShadow, (yylsp[0]));
+ }
+
+ break;
+
+ case 211:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler2DArrayShadow, (yylsp[0]));
+ }
+
+ break;
+
+ case 212:
+
+ {
+ constexpr std::array<TExtension, 3u> extensions{ { TExtension::NV_EGL_stream_consumer_external,
+ TExtension::OES_EGL_image_external_essl3,
+ TExtension::OES_EGL_image_external } };
+ if (!context->checkCanUseOneOfExtensions((yylsp[0]), extensions))
+ {
+ context->error((yylsp[0]), "unsupported type", "samplerExternalOES");
+ }
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSamplerExternalOES, (yylsp[0]));
+ }
+
+ break;
+
+ case 213:
+
+ {
+ if (!context->checkCanUseExtension((yylsp[0]), TExtension::EXT_YUV_target))
+ {
+ context->error((yylsp[0]), "unsupported type", "__samplerExternal2DY2YEXT");
+ }
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSamplerExternal2DY2YEXT, (yylsp[0]));
+ }
+
+ break;
+
+ case 214:
+
+ {
+ if (!context->checkCanUseExtension((yylsp[0]), TExtension::ARB_texture_rectangle))
+ {
+ context->error((yylsp[0]), "unsupported type", "sampler2DRect");
+ }
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtSampler2DRect, (yylsp[0]));
+ }
+
+ break;
+
+ case 215:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtImage2D, (yylsp[0]));
+ }
+
+ break;
+
+ case 216:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtIImage2D, (yylsp[0]));
+ }
+
+ break;
+
+ case 217:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUImage2D, (yylsp[0]));
+ }
+
+ break;
+
+ case 218:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtImage3D, (yylsp[0]));
+ }
+
+ break;
+
+ case 219:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtIImage3D, (yylsp[0]));
+ }
+
+ break;
+
+ case 220:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUImage3D, (yylsp[0]));
+ }
+
+ break;
+
+ case 221:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtImage2DArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 222:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtIImage2DArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 223:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUImage2DArray, (yylsp[0]));
+ }
+
+ break;
+
+ case 224:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtImageCube, (yylsp[0]));
+ }
+
+ break;
+
+ case 225:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtIImageCube, (yylsp[0]));
+ }
+
+ break;
+
+ case 226:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtUImageCube, (yylsp[0]));
+ }
+
+ break;
+
+ case 227:
+
+ {
+ (yyval.interm.typeSpecifierNonArray).initialize(EbtAtomicCounter, (yylsp[0]));
+ }
+
+ break;
+
+ case 228:
+
+ {
+ (yyval.interm.typeSpecifierNonArray) = (yyvsp[0].interm.typeSpecifierNonArray);
+ }
+
+ break;
+
+ case 229:
+
+ {
+ // This is for user defined type names. The lexical phase looked up the type.
+ const TStructure *structure = static_cast<const TStructure*>((yyvsp[0].lex).symbol);
+ (yyval.interm.typeSpecifierNonArray).initializeStruct(structure, false, (yylsp[0]));
+ }
+
+ break;
+
+ case 230:
+
+ { context->enterStructDeclaration((yylsp[-1]), ImmutableString((yyvsp[-1].lex).string)); }
+
+ break;
+
+ case 231:
+
+ {
+ (yyval.interm.typeSpecifierNonArray) = context->addStructure((yylsp[-5]), (yylsp[-4]), ImmutableString((yyvsp[-4].lex).string), (yyvsp[-1].interm.fieldList));
+ }
+
+ break;
+
+ case 232:
+
+ { context->enterStructDeclaration((yylsp[0]), kEmptyImmutableString); }
+
+ break;
+
+ case 233:
+
+ {
+ (yyval.interm.typeSpecifierNonArray) = context->addStructure((yylsp[-4]), (yyloc), kEmptyImmutableString, (yyvsp[-1].interm.fieldList));
+ }
+
+ break;
+
+ case 234:
+
+ {
+ (yyval.interm.fieldList) = context->addStructFieldList((yyvsp[0].interm.fieldList), (yylsp[0]));
+ }
+
+ break;
+
+ case 235:
+
+ {
+ (yyval.interm.fieldList) = context->combineStructFieldLists((yyvsp[-1].interm.fieldList), (yyvsp[0].interm.fieldList), (yylsp[0]));
+ }
+
+ break;
+
+ case 236:
+
+ {
+ (yyval.interm.fieldList) = context->addStructDeclaratorList((yyvsp[-2].interm.type), (yyvsp[-1].interm.declaratorList));
+ }
+
+ break;
+
+ case 237:
+
+ {
+ // ES3 Only, but errors should be handled elsewhere
+ (yyval.interm.fieldList) = context->addStructDeclaratorListWithQualifiers(*(yyvsp[-3].interm.typeQualifierBuilder), &(yyvsp[-2].interm.type), (yyvsp[-1].interm.declaratorList));
+ }
+
+ break;
+
+ case 238:
+
+ {
+ (yyval.interm.declaratorList) = new TDeclaratorList();
+ (yyval.interm.declaratorList)->push_back((yyvsp[0].interm.declarator));
+ }
+
+ break;
+
+ case 239:
+
+ {
+ (yyval.interm.declaratorList)->push_back((yyvsp[0].interm.declarator));
+ }
+
+ break;
+
+ case 240:
+
+ {
+ (yyval.interm.declarator) = context->parseStructDeclarator(ImmutableString((yyvsp[0].lex).string), (yylsp[0]));
+ }
+
+ break;
+
+ case 241:
+
+ {
+ (yyval.interm.declarator) = context->parseStructArrayDeclarator(ImmutableString((yyvsp[-1].lex).string), (yylsp[-1]), (yyvsp[0].interm.arraySizes));
+ }
+
+ break;
+
+ case 242:
+
+ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+ break;
+
+ case 243:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 244:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermBlock); }
+
+ break;
+
+ case 245:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 246:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 247:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 248:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 249:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermSwitch); }
+
+ break;
+
+ case 250:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermCase); }
+
+ break;
+
+ case 251:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 252:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 253:
+
+ {
+ (yyval.interm.intermBlock) = new TIntermBlock();
+ (yyval.interm.intermBlock)->setLine((yyloc));
+ }
+
+ break;
+
+ case 254:
+
+ { context->symbolTable.push(); }
+
+ break;
+
+ case 255:
+
+ { context->symbolTable.pop(); }
+
+ break;
+
+ case 256:
+
+ {
+ (yyvsp[-2].interm.intermBlock)->setLine((yyloc));
+ (yyval.interm.intermBlock) = (yyvsp[-2].interm.intermBlock);
+ }
+
+ break;
+
+ case 257:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermBlock); }
+
+ break;
+
+ case 258:
+
+ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 259:
+
+ { context->symbolTable.push(); }
+
+ break;
+
+ case 260:
+
+ { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermBlock); }
+
+ break;
+
+ case 261:
+
+ { context->symbolTable.push(); }
+
+ break;
+
+ case 262:
+
+ { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+ break;
+
+ case 263:
+
+ {
+ (yyval.interm.intermBlock) = new TIntermBlock();
+ (yyval.interm.intermBlock)->setLine((yyloc));
+ }
+
+ break;
+
+ case 264:
+
+ {
+ (yyvsp[-1].interm.intermBlock)->setLine((yyloc));
+ (yyval.interm.intermBlock) = (yyvsp[-1].interm.intermBlock);
+ }
+
+ break;
+
+ case 265:
+
+ {
+ (yyval.interm.intermBlock) = new TIntermBlock();
+ context->appendStatement((yyval.interm.intermBlock), (yyvsp[0].interm.intermNode));
+ }
+
+ break;
+
+ case 266:
+
+ {
+ (yyval.interm.intermBlock) = (yyvsp[-1].interm.intermBlock);
+ context->appendStatement((yyval.interm.intermBlock), (yyvsp[0].interm.intermNode));
+ }
+
+ break;
+
+ case 267:
+
+ { (yyval.interm.intermNode) = context->addEmptyStatement((yyloc)); }
+
+ break;
+
+ case 268:
+
+ { (yyval.interm.intermNode) = (yyvsp[-1].interm.intermTypedNode); }
+
+ break;
+
+ case 269:
+
+ {
+ (yyval.interm.intermNode) = context->addIfElse((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yylsp[-4]));
+ }
+
+ break;
+
+ case 270:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode);
+ (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode);
+ }
+
+ break;
+
+ case 271:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode);
+ (yyval.interm.nodePair).node2 = nullptr;
+ }
+
+ break;
+
+ case 272:
+
+ { context->incrSwitchNestingLevel(); }
+
+ break;
+
+ case 273:
+
+ {
+ (yyval.interm.intermSwitch) = context->addSwitch((yyvsp[-3].interm.intermTypedNode), (yyvsp[0].interm.intermBlock), (yylsp[-5]));
+ context->decrSwitchNestingLevel();
+ }
+
+ break;
+
+ case 274:
+
+ {
+ (yyval.interm.intermCase) = context->addCase((yyvsp[-1].interm.intermTypedNode), (yylsp[-2]));
+ }
+
+ break;
+
+ case 275:
+
+ {
+ (yyval.interm.intermCase) = context->addDefault((yylsp[-1]));
+ }
+
+ break;
+
+ case 276:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[0].interm.intermTypedNode);
+ context->checkIsScalarBool((yyvsp[0].interm.intermTypedNode)->getLine(), (yyvsp[0].interm.intermTypedNode));
+ }
+
+ break;
+
+ case 277:
+
+ {
+ (yyval.interm.intermNode) = context->addConditionInitializer((yyvsp[-3].interm.type), ImmutableString((yyvsp[-2].lex).string), (yyvsp[0].interm.intermTypedNode), (yylsp[-2]));
+ }
+
+ break;
+
+ case 278:
+
+ { context->symbolTable.push(); context->incrLoopNestingLevel(); }
+
+ break;
+
+ case 279:
+
+ {
+ context->symbolTable.pop();
+ (yyval.interm.intermNode) = context->addLoop(ELoopWhile, 0, (yyvsp[-2].interm.intermNode), 0, (yyvsp[0].interm.intermNode), (yylsp[-5]));
+ context->decrLoopNestingLevel();
+ }
+
+ break;
+
+ case 280:
+
+ { context->incrLoopNestingLevel(); }
+
+ break;
+
+ case 281:
+
+ {
+ (yyval.interm.intermNode) = context->addLoop(ELoopDoWhile, 0, (yyvsp[-2].interm.intermTypedNode), 0, (yyvsp[-5].interm.intermNode), (yylsp[-4]));
+ context->decrLoopNestingLevel();
+ }
+
+ break;
+
+ case 282:
+
+ { context->symbolTable.push(); context->incrLoopNestingLevel(); }
+
+ break;
+
+ case 283:
+
+ {
+ context->symbolTable.pop();
+ (yyval.interm.intermNode) = context->addLoop(ELoopFor, (yyvsp[-3].interm.intermNode), (yyvsp[-2].interm.nodePair).node1, reinterpret_cast<TIntermTyped*>((yyvsp[-2].interm.nodePair).node2), (yyvsp[0].interm.intermNode), (yylsp[-6]));
+ context->decrLoopNestingLevel();
+ }
+
+ break;
+
+ case 284:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
+ }
+
+ break;
+
+ case 285:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
+ }
+
+ break;
+
+ case 286:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
+ }
+
+ break;
+
+ case 287:
+
+ {
+ (yyval.interm.intermNode) = nullptr;
+ }
+
+ break;
+
+ case 288:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermNode);
+ (yyval.interm.nodePair).node2 = 0;
+ }
+
+ break;
+
+ case 289:
+
+ {
+ (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode);
+ (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode);
+ }
+
+ break;
+
+ case 290:
+
+ {
+ (yyval.interm.intermNode) = context->addBranch(EOpContinue, (yylsp[-1]));
+ }
+
+ break;
+
+ case 291:
+
+ {
+ (yyval.interm.intermNode) = context->addBranch(EOpBreak, (yylsp[-1]));
+ }
+
+ break;
+
+ case 292:
+
+ {
+ (yyval.interm.intermNode) = context->addBranch(EOpReturn, (yylsp[-1]));
+ }
+
+ break;
+
+ case 293:
+
+ {
+ (yyval.interm.intermNode) = context->addBranch(EOpReturn, (yyvsp[-1].interm.intermTypedNode), (yylsp[-2]));
+ }
+
+ break;
+
+ case 294:
+
+ {
+ (yyval.interm.intermNode) = context->addBranch(EOpKill, (yylsp[-1]));
+ }
+
+ break;
+
+ case 295:
+
+ {
+ (yyval.interm.intermBlock) = new TIntermBlock();
+ (yyval.interm.intermBlock)->setLine((yyloc));
+ (yyval.interm.intermBlock)->appendStatement((yyvsp[0].interm.intermNode));
+ context->setTreeRoot((yyval.interm.intermBlock));
+ }
+
+ break;
+
+ case 296:
+
+ {
+ (yyval.interm.intermBlock)->appendStatement((yyvsp[0].interm.intermNode));
+ }
+
+ break;
+
+ case 297:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
+ }
+
+ break;
+
+ case 298:
+
+ {
+ (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
+ }
+
+ break;
+
+ case 299:
+
+ {
+ context->parseFunctionDefinitionHeader((yylsp[0]), (yyvsp[0].interm).function, &((yyvsp[0].interm).intermFunctionPrototype));
+ }
+
+ break;
+
+ case 300:
+
+ {
+ (yyval.interm.intermNode) = context->addFunctionDefinition((yyvsp[-2].interm).intermFunctionPrototype, (yyvsp[0].interm.intermBlock), (yylsp[-2]));
+ }
+
+ break;
+
+
+
+ default: break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+ *++yylsp = yyloc;
+
+ /* Now 'shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
+yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (&yylloc, context, scanner, YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
+ {
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (&yylloc, context, scanner, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
+ }
+# undef YYSYNTAX_ERROR
+#endif
+ }
+
+ yyerror_range[1] = yylloc;
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, &yylloc, context, scanner);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ yyerror_range[1] = yylsp[1-yylen];
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default (yyn))
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+ yyerror_range[1] = *yylsp;
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp, yylsp, context, scanner);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ yyerror_range[2] = yylloc;
+ /* Using YYLLOC is tempting, but would change the location of
+ the lookahead. YYLOC is available though. */
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+ *++yylsp = yyloc;
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (&yylloc, context, scanner, YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, &yylloc, context, scanner);
+ }
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp, yylsp, context, scanner);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ return yyresult;
+}
+
+
+
+int glslang_parse(TParseContext* context) {
+ return yyparse(context, context->getScanner());
+}
diff --git a/gfx/angle/checkout/src/compiler/translator/glslang_tab.h b/gfx/angle/checkout/src/compiler/translator/glslang_tab.h
new file mode 100644
index 0000000000..5ffee8a4c5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/glslang_tab.h
@@ -0,0 +1,284 @@
+/* A Bison parser, made by GNU Bison 3.0.4. */
+
+/* Bison interface for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+#ifndef YY_YY_GLSLANG_TAB_H_INCLUDED
+#define YY_YY_GLSLANG_TAB_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+/* "%code requires" blocks. */
+
+#define YYLTYPE TSourceLoc
+#define YYLTYPE_IS_DECLARED 1
+#define YYLTYPE_IS_TRIVIAL 1
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+enum yytokentype
+{
+ INVARIANT = 258,
+ HIGH_PRECISION = 259,
+ MEDIUM_PRECISION = 260,
+ LOW_PRECISION = 261,
+ PRECISION = 262,
+ ATTRIBUTE = 263,
+ CONST_QUAL = 264,
+ BOOL_TYPE = 265,
+ FLOAT_TYPE = 266,
+ INT_TYPE = 267,
+ UINT_TYPE = 268,
+ BREAK = 269,
+ CONTINUE = 270,
+ DO = 271,
+ ELSE = 272,
+ FOR = 273,
+ IF = 274,
+ DISCARD = 275,
+ RETURN = 276,
+ SWITCH = 277,
+ CASE = 278,
+ DEFAULT = 279,
+ BVEC2 = 280,
+ BVEC3 = 281,
+ BVEC4 = 282,
+ IVEC2 = 283,
+ IVEC3 = 284,
+ IVEC4 = 285,
+ VEC2 = 286,
+ VEC3 = 287,
+ VEC4 = 288,
+ UVEC2 = 289,
+ UVEC3 = 290,
+ UVEC4 = 291,
+ MATRIX2 = 292,
+ MATRIX3 = 293,
+ MATRIX4 = 294,
+ IN_QUAL = 295,
+ OUT_QUAL = 296,
+ INOUT_QUAL = 297,
+ UNIFORM = 298,
+ BUFFER = 299,
+ VARYING = 300,
+ MATRIX2x3 = 301,
+ MATRIX3x2 = 302,
+ MATRIX2x4 = 303,
+ MATRIX4x2 = 304,
+ MATRIX3x4 = 305,
+ MATRIX4x3 = 306,
+ CENTROID = 307,
+ FLAT = 308,
+ SMOOTH = 309,
+ READONLY = 310,
+ WRITEONLY = 311,
+ COHERENT = 312,
+ RESTRICT = 313,
+ VOLATILE = 314,
+ SHARED = 315,
+ STRUCT = 316,
+ VOID_TYPE = 317,
+ WHILE = 318,
+ SAMPLER2D = 319,
+ SAMPLERCUBE = 320,
+ SAMPLER_EXTERNAL_OES = 321,
+ SAMPLER2DRECT = 322,
+ SAMPLER2DARRAY = 323,
+ ISAMPLER2D = 324,
+ ISAMPLER3D = 325,
+ ISAMPLERCUBE = 326,
+ ISAMPLER2DARRAY = 327,
+ USAMPLER2D = 328,
+ USAMPLER3D = 329,
+ USAMPLERCUBE = 330,
+ USAMPLER2DARRAY = 331,
+ SAMPLER2DMS = 332,
+ ISAMPLER2DMS = 333,
+ USAMPLER2DMS = 334,
+ SAMPLER2DMSARRAY = 335,
+ ISAMPLER2DMSARRAY = 336,
+ USAMPLER2DMSARRAY = 337,
+ SAMPLER3D = 338,
+ SAMPLER3DRECT = 339,
+ SAMPLER2DSHADOW = 340,
+ SAMPLERCUBESHADOW = 341,
+ SAMPLER2DARRAYSHADOW = 342,
+ SAMPLEREXTERNAL2DY2YEXT = 343,
+ IMAGE2D = 344,
+ IIMAGE2D = 345,
+ UIMAGE2D = 346,
+ IMAGE3D = 347,
+ IIMAGE3D = 348,
+ UIMAGE3D = 349,
+ IMAGE2DARRAY = 350,
+ IIMAGE2DARRAY = 351,
+ UIMAGE2DARRAY = 352,
+ IMAGECUBE = 353,
+ IIMAGECUBE = 354,
+ UIMAGECUBE = 355,
+ ATOMICUINT = 356,
+ LAYOUT = 357,
+ YUVCSCSTANDARDEXT = 358,
+ YUVCSCSTANDARDEXTCONSTANT = 359,
+ IDENTIFIER = 360,
+ TYPE_NAME = 361,
+ FLOATCONSTANT = 362,
+ INTCONSTANT = 363,
+ UINTCONSTANT = 364,
+ BOOLCONSTANT = 365,
+ FIELD_SELECTION = 366,
+ LEFT_OP = 367,
+ RIGHT_OP = 368,
+ INC_OP = 369,
+ DEC_OP = 370,
+ LE_OP = 371,
+ GE_OP = 372,
+ EQ_OP = 373,
+ NE_OP = 374,
+ AND_OP = 375,
+ OR_OP = 376,
+ XOR_OP = 377,
+ MUL_ASSIGN = 378,
+ DIV_ASSIGN = 379,
+ ADD_ASSIGN = 380,
+ MOD_ASSIGN = 381,
+ LEFT_ASSIGN = 382,
+ RIGHT_ASSIGN = 383,
+ AND_ASSIGN = 384,
+ XOR_ASSIGN = 385,
+ OR_ASSIGN = 386,
+ SUB_ASSIGN = 387,
+ LEFT_PAREN = 388,
+ RIGHT_PAREN = 389,
+ LEFT_BRACKET = 390,
+ RIGHT_BRACKET = 391,
+ LEFT_BRACE = 392,
+ RIGHT_BRACE = 393,
+ DOT = 394,
+ COMMA = 395,
+ COLON = 396,
+ EQUAL = 397,
+ SEMICOLON = 398,
+ BANG = 399,
+ DASH = 400,
+ TILDE = 401,
+ PLUS = 402,
+ STAR = 403,
+ SLASH = 404,
+ PERCENT = 405,
+ LEFT_ANGLE = 406,
+ RIGHT_ANGLE = 407,
+ VERTICAL_BAR = 408,
+ CARET = 409,
+ AMPERSAND = 410,
+ QUESTION = 411
+};
+#endif
+
+/* Value type. */
+#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
+
+union YYSTYPE
+{
+
+ struct
+ {
+ union
+ {
+ const char *string; // pool allocated.
+ float f;
+ int i;
+ unsigned int u;
+ bool b;
+ };
+ const TSymbol *symbol;
+ } lex;
+ struct
+ {
+ TOperator op;
+ union
+ {
+ TIntermNode *intermNode;
+ TIntermNodePair nodePair;
+ TIntermTyped *intermTypedNode;
+ TIntermAggregate *intermAggregate;
+ TIntermBlock *intermBlock;
+ TIntermDeclaration *intermDeclaration;
+ TIntermFunctionPrototype *intermFunctionPrototype;
+ TIntermSwitch *intermSwitch;
+ TIntermCase *intermCase;
+ };
+ union
+ {
+ TVector<unsigned int> *arraySizes;
+ TTypeSpecifierNonArray typeSpecifierNonArray;
+ TPublicType type;
+ TPrecision precision;
+ TLayoutQualifier layoutQualifier;
+ TQualifier qualifier;
+ TFunction *function;
+ TFunctionLookup *functionLookup;
+ TParameter param;
+ TDeclarator *declarator;
+ TDeclaratorList *declaratorList;
+ TFieldList *fieldList;
+ TQualifierWrapperBase *qualifierWrapper;
+ TTypeQualifierBuilder *typeQualifierBuilder;
+ };
+ } interm;
+};
+
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* Location type. */
+#if !defined YYLTYPE && !defined YYLTYPE_IS_DECLARED
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+};
+# define YYLTYPE_IS_DECLARED 1
+# define YYLTYPE_IS_TRIVIAL 1
+#endif
+
+int yyparse(TParseContext *context, void *scanner);
+
+#endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED */
diff --git a/gfx/angle/checkout/src/compiler/translator/length_limits.h b/gfx/angle/checkout/src/compiler/translator/length_limits.h
new file mode 100644
index 0000000000..fcda639d71
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/length_limits.h
@@ -0,0 +1,26 @@
+//
+// 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
+//
+
+#ifndef COMPILER_TRANSLATOR_LENGTHLIMITS_H_
+#define COMPILER_TRANSLATOR_LENGTHLIMITS_H_
+
+#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.
+
+namespace sh
+{
+
+size_t GetGlobalMaxTokenSize(ShShaderSpec spec);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_LENGTHLIMITS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp
new file mode 100644
index 0000000000..25a52983a3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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/tree_ops/AddAndTrueToLoopCondition.h"
+
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// An AST traverser that rewrites for and while loops by replacing "condition" with
+// "condition && true" to work around condition bug on Intel Mac.
+class AddAndTrueToLoopConditionTraverser : public TIntermTraverser
+{
+ public:
+ AddAndTrueToLoopConditionTraverser() : TIntermTraverser(true, false, false) {}
+
+ bool visitLoop(Visit, TIntermLoop *loop) override
+ {
+ // do-while loop doesn't have this bug.
+ if (loop->getType() != ELoopFor && loop->getType() != ELoopWhile)
+ {
+ return true;
+ }
+
+ // For loop may not have a condition.
+ if (loop->getCondition() == nullptr)
+ {
+ return true;
+ }
+
+ // Constant true.
+ TIntermTyped *trueValue = CreateBoolNode(true);
+
+ // CONDITION && true.
+ TIntermBinary *andOp = new TIntermBinary(EOpLogicalAnd, loop->getCondition(), trueValue);
+ loop->setCondition(andOp);
+
+ return true;
+ }
+};
+
+} // anonymous namespace
+
+void AddAndTrueToLoopCondition(TIntermNode *root)
+{
+ AddAndTrueToLoopConditionTraverser traverser;
+ root->traverse(&traverser);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.h
new file mode 100644
index 0000000000..3a9efc2133
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.h
@@ -0,0 +1,20 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Rewrite condition in for and while loops to work around driver bug on Intel Mac.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_
+#define COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_
+
+class TIntermNode;
+namespace sh
+{
+
+void AddAndTrueToLoopCondition(TIntermNode *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp
new file mode 100644
index 0000000000..636ce37506
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// AddDefaultReturnStatements.cpp: Add default return statements to functions that do not end in a
+// return.
+//
+
+#include "compiler/translator/tree_ops/AddDefaultReturnStatements.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+bool NeedsReturnStatement(TIntermFunctionDefinition *node, TType *returnType)
+{
+ *returnType = node->getFunctionPrototype()->getType();
+ if (returnType->getBasicType() == EbtVoid)
+ {
+ return false;
+ }
+
+ TIntermBlock *bodyNode = node->getBody();
+ TIntermBranch *returnNode = bodyNode->getSequence()->back()->getAsBranchNode();
+ if (returnNode != nullptr && returnNode->getFlowOp() == EOpReturn)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+} // anonymous namespace
+
+void AddDefaultReturnStatements(TIntermBlock *root)
+{
+ TType returnType;
+ for (TIntermNode *node : *root->getSequence())
+ {
+ TIntermFunctionDefinition *definition = node->getAsFunctionDefinition();
+ if (definition != nullptr && NeedsReturnStatement(definition, &returnType))
+ {
+ TIntermBranch *branch = new TIntermBranch(EOpReturn, CreateZeroNode(returnType));
+
+ TIntermBlock *bodyNode = definition->getBody();
+ bodyNode->getSequence()->push_back(branch);
+ }
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.h
new file mode 100644
index 0000000000..6d537978f5
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// AddDefaultReturnStatements.h: Add default return statements to functions that do not end in a
+// return.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_
+
+class TIntermBlock;
+
+namespace sh
+{
+
+void AddDefaultReturnStatements(TIntermBlock *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp
new file mode 100644
index 0000000000..824908b0e6
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp
@@ -0,0 +1,228 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The ArrayReturnValueToOutParameter function changes return values of an array type to out
+// parameters in function definitions, prototypes, and call sites.
+
+#include "compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h"
+
+#include <map>
+
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kReturnValueVariableName("angle_return");
+
+class ArrayReturnValueToOutParameterTraverser : private TIntermTraverser
+{
+ public:
+ static void apply(TIntermNode *root, TSymbolTable *symbolTable);
+
+ private:
+ ArrayReturnValueToOutParameterTraverser(TSymbolTable *symbolTable);
+
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitBranch(Visit visit, TIntermBranch *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+
+ TIntermAggregate *createReplacementCall(TIntermAggregate *originalCall,
+ TIntermTyped *returnValueTarget);
+
+ // Set when traversal is inside a function with array return value.
+ TIntermFunctionDefinition *mFunctionWithArrayReturnValue;
+
+ struct ChangedFunction
+ {
+ const TVariable *returnValueVariable;
+ const TFunction *func;
+ };
+
+ // Map from function symbol ids to the changed function.
+ std::map<int, ChangedFunction> mChangedFunctions;
+};
+
+TIntermAggregate *ArrayReturnValueToOutParameterTraverser::createReplacementCall(
+ TIntermAggregate *originalCall,
+ TIntermTyped *returnValueTarget)
+{
+ TIntermSequence *replacementArguments = new TIntermSequence();
+ TIntermSequence *originalArguments = originalCall->getSequence();
+ for (auto &arg : *originalArguments)
+ {
+ replacementArguments->push_back(arg);
+ }
+ replacementArguments->push_back(returnValueTarget);
+ ASSERT(originalCall->getFunction());
+ const TSymbolUniqueId &originalId = originalCall->getFunction()->uniqueId();
+ TIntermAggregate *replacementCall = TIntermAggregate::CreateFunctionCall(
+ *mChangedFunctions[originalId.get()].func, replacementArguments);
+ replacementCall->setLine(originalCall->getLine());
+ return replacementCall;
+}
+
+void ArrayReturnValueToOutParameterTraverser::apply(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ ArrayReturnValueToOutParameterTraverser arrayReturnValueToOutParam(symbolTable);
+ root->traverse(&arrayReturnValueToOutParam);
+ arrayReturnValueToOutParam.updateTree();
+}
+
+ArrayReturnValueToOutParameterTraverser::ArrayReturnValueToOutParameterTraverser(
+ TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, true, symbolTable), mFunctionWithArrayReturnValue(nullptr)
+{}
+
+bool ArrayReturnValueToOutParameterTraverser::visitFunctionDefinition(
+ Visit visit,
+ TIntermFunctionDefinition *node)
+{
+ if (node->getFunctionPrototype()->isArray() && visit == PreVisit)
+ {
+ // Replacing the function header is done on visitFunctionPrototype().
+ mFunctionWithArrayReturnValue = node;
+ }
+ if (visit == PostVisit)
+ {
+ mFunctionWithArrayReturnValue = nullptr;
+ }
+ return true;
+}
+
+void ArrayReturnValueToOutParameterTraverser::visitFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ if (node->isArray())
+ {
+ // Replace the whole prototype node with another node that has the out parameter
+ // added. Also set the function to return void.
+ const TSymbolUniqueId &functionId = node->getFunction()->uniqueId();
+ if (mChangedFunctions.find(functionId.get()) == mChangedFunctions.end())
+ {
+ TType *returnValueVariableType = new TType(node->getType());
+ returnValueVariableType->setQualifier(EvqOut);
+ ChangedFunction changedFunction;
+ changedFunction.returnValueVariable =
+ new TVariable(mSymbolTable, kReturnValueVariableName, returnValueVariableType,
+ SymbolType::AngleInternal);
+ TFunction *func = new TFunction(mSymbolTable, node->getFunction()->name(),
+ node->getFunction()->symbolType(),
+ StaticType::GetBasic<EbtVoid>(), false);
+ for (size_t i = 0; i < node->getFunction()->getParamCount(); ++i)
+ {
+ func->addParameter(node->getFunction()->getParam(i));
+ }
+ func->addParameter(changedFunction.returnValueVariable);
+ changedFunction.func = func;
+ mChangedFunctions[functionId.get()] = changedFunction;
+ }
+ TIntermFunctionPrototype *replacement =
+ new TIntermFunctionPrototype(mChangedFunctions[functionId.get()].func);
+ replacement->setLine(node->getLine());
+
+ queueReplacement(replacement, OriginalNode::IS_DROPPED);
+ }
+}
+
+bool ArrayReturnValueToOutParameterTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ ASSERT(!node->isArray() || node->getOp() != EOpCallInternalRawFunction);
+ if (visit == PreVisit && node->isArray() && node->getOp() == EOpCallFunctionInAST)
+ {
+ // Handle call sites where the returned array is not assigned.
+ // Examples where f() is a function returning an array:
+ // 1. f();
+ // 2. another_array == f();
+ // 3. another_function(f());
+ // 4. return f();
+ // Cases 2 to 4 are already converted to simpler cases by
+ // SeparateExpressionsReturningArrays, so we only need to worry about the case where a
+ // function call returning an array forms an expression by itself.
+ TIntermBlock *parentBlock = getParentNode()->getAsBlock();
+ if (parentBlock)
+ {
+ // replace
+ // f();
+ // with
+ // type s0[size]; f(s0);
+ TIntermSequence replacements;
+
+ // type s0[size];
+ TIntermDeclaration *returnValueDeclaration = nullptr;
+ TVariable *returnValue = DeclareTempVariable(mSymbolTable, new TType(node->getType()),
+ EvqTemporary, &returnValueDeclaration);
+ replacements.push_back(returnValueDeclaration);
+
+ // f(s0);
+ TIntermSymbol *returnValueSymbol = CreateTempSymbolNode(returnValue);
+ replacements.push_back(createReplacementCall(node, returnValueSymbol));
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(parentBlock, node, replacements));
+ }
+ return false;
+ }
+ return true;
+}
+
+bool ArrayReturnValueToOutParameterTraverser::visitBranch(Visit visit, TIntermBranch *node)
+{
+ if (mFunctionWithArrayReturnValue && node->getFlowOp() == EOpReturn)
+ {
+ // Instead of returning a value, assign to the out parameter and then return.
+ TIntermSequence replacements;
+
+ TIntermTyped *expression = node->getExpression();
+ ASSERT(expression != nullptr);
+ const TSymbolUniqueId &functionId =
+ mFunctionWithArrayReturnValue->getFunction()->uniqueId();
+ ASSERT(mChangedFunctions.find(functionId.get()) != mChangedFunctions.end());
+ TIntermSymbol *returnValueSymbol =
+ new TIntermSymbol(mChangedFunctions[functionId.get()].returnValueVariable);
+ TIntermBinary *replacementAssignment =
+ new TIntermBinary(EOpAssign, returnValueSymbol, expression);
+ replacementAssignment->setLine(expression->getLine());
+ replacements.push_back(replacementAssignment);
+
+ TIntermBranch *replacementBranch = new TIntermBranch(EOpReturn, nullptr);
+ replacementBranch->setLine(node->getLine());
+ replacements.push_back(replacementBranch);
+
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(), node, replacements));
+ }
+ return false;
+}
+
+bool ArrayReturnValueToOutParameterTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ if (node->getOp() == EOpAssign && node->getLeft()->isArray())
+ {
+ TIntermAggregate *rightAgg = node->getRight()->getAsAggregate();
+ ASSERT(rightAgg == nullptr || rightAgg->getOp() != EOpCallInternalRawFunction);
+ if (rightAgg != nullptr && rightAgg->getOp() == EOpCallFunctionInAST)
+ {
+ TIntermAggregate *replacementCall = createReplacementCall(rightAgg, node->getLeft());
+ queueReplacement(replacementCall, OriginalNode::IS_DROPPED);
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+void ArrayReturnValueToOutParameter(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ ArrayReturnValueToOutParameterTraverser::apply(root, symbolTable);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h
new file mode 100644
index 0000000000..9ceb02c76a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The ArrayReturnValueToOutParameter function changes return values of an array type to out
+// parameters in function definitions, prototypes and call sites.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_
+#define COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TSymbolTable;
+
+void ArrayReturnValueToOutParameter(TIntermNode *root, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp
new file mode 100644
index 0000000000..19f53a7383
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp
@@ -0,0 +1,107 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BreakVariableAliasingInInnerLoops.h: To optimize simple assignments, the HLSL compiler frontend
+// may record a variable as aliasing another. Sometimes the alias information gets garbled
+// so we work around this issue by breaking the aliasing chain in inner loops.
+
+#include "BreakVariableAliasingInInnerLoops.h"
+
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+// A HLSL compiler developer gave us more details on the root cause and the workaround needed:
+// The root problem is that if the HLSL compiler is applying aliasing information even on
+// incomplete simulations (in this case, a single pass). The bug is triggered by an assignment
+// that comes from a series of assignments, possibly with swizzled or ternary operators with
+// known conditionals, where the source is before the loop.
+// So, a workaround is to add a +0 term to variables the first time they are assigned to in
+// an inner loop (if they are declared in an outside scope, otherwise there is no need).
+// This will break the aliasing chain.
+
+// For simplicity here we add a +0 to any assignment that is in at least two nested loops. Because
+// the bug only shows up with swizzles, and ternary assignment, whole array or whole structure
+// assignment don't need a workaround.
+
+namespace sh
+{
+
+namespace
+{
+
+class AliasingBreaker : public TIntermTraverser
+{
+ public:
+ AliasingBreaker() : TIntermTraverser(true, false, true) {}
+
+ protected:
+ bool visitBinary(Visit visit, TIntermBinary *binary)
+ {
+ if (visit != PreVisit)
+ {
+ return false;
+ }
+
+ if (mLoopLevel < 2 || !binary->isAssignment())
+ {
+ return true;
+ }
+
+ TIntermTyped *B = binary->getRight();
+ TType type = B->getType();
+
+ if (!type.isScalar() && !type.isVector() && !type.isMatrix())
+ {
+ return true;
+ }
+
+ if (type.isArray() || IsSampler(type.getBasicType()))
+ {
+ return true;
+ }
+
+ // We have a scalar / vector / matrix assignment with loop depth 2.
+ // Transform it from
+ // A = B
+ // to
+ // A = (B + typeof<B>(0));
+
+ TIntermBinary *bPlusZero = new TIntermBinary(EOpAdd, B, CreateZeroNode(type));
+ bPlusZero->setLine(B->getLine());
+
+ binary->replaceChildNode(B, bPlusZero);
+
+ return true;
+ }
+
+ bool visitLoop(Visit visit, TIntermLoop *loop)
+ {
+ if (visit == PreVisit)
+ {
+ mLoopLevel++;
+ }
+ else
+ {
+ ASSERT(mLoopLevel > 0);
+ mLoopLevel--;
+ }
+
+ return true;
+ }
+
+ private:
+ int mLoopLevel = 0;
+};
+
+} // anonymous namespace
+
+void BreakVariableAliasingInInnerLoops(TIntermNode *root)
+{
+ AliasingBreaker breaker;
+ root->traverse(&breaker);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h
new file mode 100644
index 0000000000..cdbdb7aa96
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BreakVariableAliasingInInnerLoops.h: To optimize simple assignments, the HLSL compiler frontend
+// may record a variable as aliasing another. Sometimes the alias information gets garbled
+// so we work around this issue by breaking the aliasing chain in inner loops.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_
+
+class TIntermNode;
+
+namespace sh
+{
+
+void BreakVariableAliasingInInnerLoops(TIntermNode *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp
new file mode 100644
index 0000000000..d721160a32
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp
@@ -0,0 +1,54 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ClampFragDepth.cpp: Limit the value that is written to gl_FragDepth to the range [0.0, 1.0].
+// The clamping is run at the very end of shader execution, and is only performed if the shader
+// statically accesses gl_FragDepth.
+//
+
+#include "compiler/translator/tree_ops/ClampFragDepth.h"
+
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+#include "compiler/translator/tree_util/FindSymbolNode.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/RunAtTheEndOfShader.h"
+
+namespace sh
+{
+
+void ClampFragDepth(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ // Only clamp gl_FragDepth if it's used in the shader.
+ if (!FindSymbolNode(root, ImmutableString("gl_FragDepth")))
+ {
+ return;
+ }
+
+ TIntermSymbol *fragDepthNode = new TIntermSymbol(BuiltInVariable::gl_FragDepth());
+
+ TIntermTyped *minFragDepthNode = CreateZeroNode(TType(EbtFloat, EbpHigh, EvqConst));
+
+ TConstantUnion *maxFragDepthConstant = new TConstantUnion();
+ maxFragDepthConstant->setFConst(1.0);
+ TIntermConstantUnion *maxFragDepthNode =
+ new TIntermConstantUnion(maxFragDepthConstant, TType(EbtFloat, EbpHigh, EvqConst));
+
+ // clamp(gl_FragDepth, 0.0, 1.0)
+ TIntermSequence *clampArguments = new TIntermSequence();
+ clampArguments->push_back(fragDepthNode->deepCopy());
+ clampArguments->push_back(minFragDepthNode);
+ clampArguments->push_back(maxFragDepthNode);
+ TIntermTyped *clampedFragDepth =
+ CreateBuiltInFunctionCallNode("clamp", clampArguments, *symbolTable, 100);
+
+ // gl_FragDepth = clamp(gl_FragDepth, 0.0, 1.0)
+ TIntermBinary *assignFragDepth = new TIntermBinary(EOpAssign, fragDepthNode, clampedFragDepth);
+
+ RunAtTheEndOfShader(root, assignFragDepth, symbolTable);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.h
new file mode 100644
index 0000000000..70d1f7336a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.h
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ClampFragDepth.h: Limit the value that is written to gl_FragDepth to the range [0.0, 1.0].
+// The clamping is run at the very end of shader execution, and is only performed if the shader
+// statically accesses gl_FragDepth.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_
+#define COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void ClampFragDepth(TIntermBlock *root, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp
new file mode 100644
index 0000000000..3966aabd83
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp
@@ -0,0 +1,48 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ClampPointSize.cpp: Limit the value that is written to gl_PointSize.
+//
+
+#include "compiler/translator/tree_ops/ClampPointSize.h"
+
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+#include "compiler/translator/tree_util/FindSymbolNode.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/RunAtTheEndOfShader.h"
+
+namespace sh
+{
+
+void ClampPointSize(TIntermBlock *root, float maxPointSize, TSymbolTable *symbolTable)
+{
+ // Only clamp gl_PointSize if it's used in the shader.
+ if (!FindSymbolNode(root, ImmutableString("gl_PointSize")))
+ {
+ return;
+ }
+
+ TIntermSymbol *pointSizeNode = new TIntermSymbol(BuiltInVariable::gl_PointSize());
+
+ TConstantUnion *maxPointSizeConstant = new TConstantUnion();
+ maxPointSizeConstant->setFConst(maxPointSize);
+ TIntermConstantUnion *maxPointSizeNode =
+ new TIntermConstantUnion(maxPointSizeConstant, TType(EbtFloat, EbpHigh, EvqConst));
+
+ // min(gl_PointSize, maxPointSize)
+ TIntermSequence *minArguments = new TIntermSequence();
+ minArguments->push_back(pointSizeNode->deepCopy());
+ minArguments->push_back(maxPointSizeNode);
+ TIntermTyped *clampedPointSize =
+ CreateBuiltInFunctionCallNode("min", minArguments, *symbolTable, 100);
+
+ // gl_PointSize = min(gl_PointSize, maxPointSize)
+ TIntermBinary *assignPointSize = new TIntermBinary(EOpAssign, pointSizeNode, clampedPointSize);
+
+ RunAtTheEndOfShader(root, assignPointSize, symbolTable);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.h
new file mode 100644
index 0000000000..5bc7cd4d43
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ClampPointSize.h: Limit the value that is written to gl_PointSize.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_CLAMPPOINTSIZE_H_
+#define COMPILER_TRANSLATOR_TREEOPS_CLAMPPOINTSIZE_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void ClampPointSize(TIntermBlock *root, float maxPointSize, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_CLAMPPOINTSIZE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp
new file mode 100644
index 0000000000..91ffe5966a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp
@@ -0,0 +1,186 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Applies the necessary AST transformations to support multiview rendering through instancing.
+// Check the header file For more information.
+//
+
+#include "compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h"
+
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_ops/InitializeVariables.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+#include "compiler/translator/tree_util/FindMain.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/tree_util/ReplaceVariable.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kViewIDVariableName("ViewID_OVR");
+constexpr const ImmutableString kInstanceIDVariableName("InstanceID");
+constexpr const ImmutableString kMultiviewBaseViewLayerIndexVariableName(
+ "multiviewBaseViewLayerIndex");
+
+// Adds the InstanceID and ViewID_OVR initializers to the end of the initializers' sequence.
+void InitializeViewIDAndInstanceID(const TVariable *viewID,
+ const TVariable *instanceID,
+ unsigned numberOfViews,
+ const TSymbolTable &symbolTable,
+ TIntermSequence *initializers)
+{
+ // Create an unsigned numberOfViews node.
+ TConstantUnion *numberOfViewsUnsignedConstant = new TConstantUnion();
+ numberOfViewsUnsignedConstant->setUConst(numberOfViews);
+ TIntermConstantUnion *numberOfViewsUint =
+ new TIntermConstantUnion(numberOfViewsUnsignedConstant, TType(EbtUInt, EbpHigh, EvqConst));
+
+ // Create a uint(gl_InstanceID) node.
+ TIntermSequence *glInstanceIDSymbolCastArguments = new TIntermSequence();
+ glInstanceIDSymbolCastArguments->push_back(new TIntermSymbol(BuiltInVariable::gl_InstanceID()));
+ TIntermAggregate *glInstanceIDAsUint = TIntermAggregate::CreateConstructor(
+ TType(EbtUInt, EbpHigh, EvqTemporary), glInstanceIDSymbolCastArguments);
+
+ // Create a uint(gl_InstanceID) / numberOfViews node.
+ TIntermBinary *normalizedInstanceID =
+ new TIntermBinary(EOpDiv, glInstanceIDAsUint, numberOfViewsUint);
+
+ // Create an int(uint(gl_InstanceID) / numberOfViews) node.
+ TIntermSequence *normalizedInstanceIDCastArguments = new TIntermSequence();
+ normalizedInstanceIDCastArguments->push_back(normalizedInstanceID);
+ TIntermAggregate *normalizedInstanceIDAsInt = TIntermAggregate::CreateConstructor(
+ TType(EbtInt, EbpHigh, EvqTemporary), normalizedInstanceIDCastArguments);
+
+ // Create an InstanceID = int(uint(gl_InstanceID) / numberOfViews) node.
+ TIntermBinary *instanceIDInitializer =
+ new TIntermBinary(EOpAssign, new TIntermSymbol(instanceID), normalizedInstanceIDAsInt);
+ initializers->push_back(instanceIDInitializer);
+
+ // Create a uint(gl_InstanceID) % numberOfViews node.
+ TIntermBinary *normalizedViewID =
+ new TIntermBinary(EOpIMod, glInstanceIDAsUint->deepCopy(), numberOfViewsUint->deepCopy());
+
+ // Create a ViewID_OVR = uint(gl_InstanceID) % numberOfViews node.
+ TIntermBinary *viewIDInitializer =
+ new TIntermBinary(EOpAssign, new TIntermSymbol(viewID), normalizedViewID);
+ initializers->push_back(viewIDInitializer);
+}
+
+// Adds a branch to write int(ViewID_OVR) to either gl_ViewportIndex or gl_Layer. The branch is
+// added to the end of the initializers' sequence.
+void SelectViewIndexInVertexShader(const TVariable *viewID,
+ const TVariable *multiviewBaseViewLayerIndex,
+ TIntermSequence *initializers,
+ const TSymbolTable &symbolTable)
+{
+ // Create an int(ViewID_OVR) node.
+ TIntermSequence *viewIDSymbolCastArguments = new TIntermSequence();
+ viewIDSymbolCastArguments->push_back(new TIntermSymbol(viewID));
+ TIntermAggregate *viewIDAsInt = TIntermAggregate::CreateConstructor(
+ TType(EbtInt, EbpHigh, EvqTemporary), viewIDSymbolCastArguments);
+
+ // Create a gl_ViewportIndex node.
+ TIntermSymbol *viewportIndexSymbol = new TIntermSymbol(BuiltInVariable::gl_ViewportIndex());
+
+ // Create a { gl_ViewportIndex = int(ViewID_OVR) } node.
+ TIntermBlock *viewportIndexInitializerInBlock = new TIntermBlock();
+ viewportIndexInitializerInBlock->appendStatement(
+ new TIntermBinary(EOpAssign, viewportIndexSymbol, viewIDAsInt));
+
+ // Create a gl_Layer node.
+ TIntermSymbol *layerSymbol = new TIntermSymbol(BuiltInVariable::gl_LayerVS());
+
+ // Create an int(ViewID_OVR) + multiviewBaseViewLayerIndex node
+ TIntermBinary *sumOfViewIDAndBaseViewIndex = new TIntermBinary(
+ EOpAdd, viewIDAsInt->deepCopy(), new TIntermSymbol(multiviewBaseViewLayerIndex));
+
+ // Create a { gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex } node.
+ TIntermBlock *layerInitializerInBlock = new TIntermBlock();
+ layerInitializerInBlock->appendStatement(
+ new TIntermBinary(EOpAssign, layerSymbol, sumOfViewIDAndBaseViewIndex));
+
+ // Create a node to compare whether the base view index uniform is less than zero.
+ TIntermBinary *multiviewBaseViewLayerIndexZeroComparison =
+ new TIntermBinary(EOpLessThan, new TIntermSymbol(multiviewBaseViewLayerIndex),
+ CreateZeroNode(TType(EbtInt, EbpHigh, EvqConst)));
+
+ // Create an if-else statement to select the code path.
+ TIntermIfElse *multiviewBranch =
+ new TIntermIfElse(multiviewBaseViewLayerIndexZeroComparison,
+ viewportIndexInitializerInBlock, layerInitializerInBlock);
+
+ initializers->push_back(multiviewBranch);
+}
+
+} // namespace
+
+void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root,
+ unsigned numberOfViews,
+ GLenum shaderType,
+ ShCompileOptions compileOptions,
+ ShShaderOutput shaderOutput,
+ TSymbolTable *symbolTable)
+{
+ ASSERT(shaderType == GL_VERTEX_SHADER || shaderType == GL_FRAGMENT_SHADER);
+
+ TQualifier viewIDQualifier = (shaderType == GL_VERTEX_SHADER) ? EvqFlatOut : EvqFlatIn;
+ const TVariable *viewID =
+ new TVariable(symbolTable, kViewIDVariableName,
+ new TType(EbtUInt, EbpHigh, viewIDQualifier), SymbolType::AngleInternal);
+
+ DeclareGlobalVariable(root, viewID);
+ ReplaceVariable(root, BuiltInVariable::gl_ViewID_OVR(), viewID);
+ if (shaderType == GL_VERTEX_SHADER)
+ {
+ // Replacing gl_InstanceID with InstanceID should happen before adding the initializers of
+ // InstanceID and ViewID.
+ const TType *instanceIDVariableType = StaticType::Get<EbtInt, EbpHigh, EvqGlobal, 1, 1>();
+ const TVariable *instanceID =
+ new TVariable(symbolTable, kInstanceIDVariableName, instanceIDVariableType,
+ SymbolType::AngleInternal);
+ DeclareGlobalVariable(root, instanceID);
+ ReplaceVariable(root, BuiltInVariable::gl_InstanceID(), instanceID);
+
+ TIntermSequence *initializers = new TIntermSequence();
+ InitializeViewIDAndInstanceID(viewID, instanceID, numberOfViews, *symbolTable,
+ initializers);
+
+ // The AST transformation which adds the expression to select the viewport index should
+ // be done only for the GLSL and ESSL output.
+ const bool selectView = (compileOptions & SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER) != 0u;
+ // Assert that if the view is selected in the vertex shader, then the output is
+ // either GLSL or ESSL.
+ ASSERT(!selectView || IsOutputGLSL(shaderOutput) || IsOutputESSL(shaderOutput));
+ if (selectView)
+ {
+ // Add a uniform to switch between side-by-side and layered rendering.
+ const TType *baseLayerIndexVariableType =
+ StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
+ const TVariable *multiviewBaseViewLayerIndex =
+ new TVariable(symbolTable, kMultiviewBaseViewLayerIndexVariableName,
+ baseLayerIndexVariableType, SymbolType::AngleInternal);
+ DeclareGlobalVariable(root, multiviewBaseViewLayerIndex);
+
+ // Setting a value to gl_ViewportIndex or gl_Layer should happen after ViewID_OVR's
+ // initialization.
+ SelectViewIndexInVertexShader(viewID, multiviewBaseViewLayerIndex, initializers,
+ *symbolTable);
+ }
+
+ // Insert initializers at the beginning of main().
+ TIntermBlock *initializersBlock = new TIntermBlock();
+ initializersBlock->getSequence()->swap(*initializers);
+ TIntermBlock *mainBody = FindMainBody(root);
+ mainBody->getSequence()->insert(mainBody->getSequence()->begin(), initializersBlock);
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h
new file mode 100644
index 0000000000..9501ea58b3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h
@@ -0,0 +1,48 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Regardless of the shader type, the following AST transformations are applied:
+// - Add declaration of View_ID_OVR.
+// - Replace every occurrence of gl_ViewID_OVR with ViewID_OVR, mark ViewID_OVR as internal and
+// declare it as a flat varying.
+//
+// If the shader type is a vertex shader, the following AST transformations are applied:
+// - Replace every occurrence of gl_InstanceID with InstanceID, mark InstanceID as internal and set
+// its qualifier to EvqTemporary.
+// - Add initializers of ViewID_OVR and InstanceID to the beginning of the body of main. The pass
+// should be executed before any variables get collected so that usage of gl_InstanceID is recorded.
+// - If the output is ESSL or GLSL and the SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER option is
+// enabled, the expression
+// "if (multiviewBaseViewLayerIndex < 0) {
+// gl_ViewportIndex = int(ViewID_OVR);
+// } else {
+// gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex;
+// }"
+// is added after ViewID and InstanceID are initialized. Also, MultiviewRenderPath is added as a
+// uniform.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_
+#define COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_
+
+#include "GLSLANG/ShaderLang.h"
+#include "angle_gl.h"
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root,
+ unsigned numberOfViews,
+ GLenum shaderType,
+ ShCompileOptions compileOptions,
+ ShShaderOutput shaderOutput,
+ TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp
new file mode 100644
index 0000000000..8f48d3e352
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp
@@ -0,0 +1,167 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DeferGlobalInitializers is an AST traverser that moves global initializers into a separate
+// function that is called in the beginning of main(). This enables initialization of globals with
+// uniforms or non-constant globals, as allowed by the WebGL spec. Some initializers referencing
+// non-constants may need to be unfolded into if statements in HLSL - this kind of steps should be
+// done after DeferGlobalInitializers is run. Note that it's important that the function definition
+// is at the end of the shader, as some globals may be declared after main().
+//
+// It can also initialize all uninitialized globals.
+//
+
+#include "compiler/translator/tree_ops/DeferGlobalInitializers.h"
+
+#include <vector>
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_ops/InitializeVariables.h"
+#include "compiler/translator/tree_util/FindMain.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/ReplaceVariable.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kInitGlobalsString("initGlobals");
+
+void GetDeferredInitializers(TIntermDeclaration *declaration,
+ bool initializeUninitializedGlobals,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TIntermSequence *deferredInitializersOut,
+ std::vector<const TVariable *> *variablesToReplaceOut,
+ TSymbolTable *symbolTable)
+{
+ // SeparateDeclarations should have already been run.
+ ASSERT(declaration->getSequence()->size() == 1);
+
+ TIntermNode *declarator = declaration->getSequence()->back();
+ TIntermBinary *init = declarator->getAsBinaryNode();
+ if (init)
+ {
+ TIntermSymbol *symbolNode = init->getLeft()->getAsSymbolNode();
+ ASSERT(symbolNode);
+ TIntermTyped *expression = init->getRight();
+
+ if (expression->getQualifier() != EvqConst || !expression->hasConstantValue())
+ {
+ // For variables which are not constant, defer their real initialization until
+ // after we initialize uniforms.
+ // Deferral is done also in any cases where the variable can not be converted to a
+ // constant union, since otherwise there's a chance that HLSL output will generate extra
+ // statements from the initializer expression.
+
+ // Change const global to a regular global if its initialization is deferred.
+ // This can happen if ANGLE has not been able to fold the constant expression used
+ // as an initializer.
+ ASSERT(symbolNode->getQualifier() == EvqConst ||
+ symbolNode->getQualifier() == EvqGlobal);
+ if (symbolNode->getQualifier() == EvqConst)
+ {
+ variablesToReplaceOut->push_back(&symbolNode->variable());
+ }
+
+ TIntermBinary *deferredInit =
+ new TIntermBinary(EOpAssign, symbolNode->deepCopy(), init->getRight());
+ deferredInitializersOut->push_back(deferredInit);
+
+ // Remove the initializer from the global scope and just declare the global instead.
+ declaration->replaceChildNode(init, symbolNode);
+ }
+ }
+ else if (initializeUninitializedGlobals)
+ {
+ TIntermSymbol *symbolNode = declarator->getAsSymbolNode();
+ ASSERT(symbolNode);
+
+ // Ignore ANGLE internal variables and nameless declarations.
+ if (symbolNode->variable().symbolType() == SymbolType::AngleInternal ||
+ symbolNode->variable().symbolType() == SymbolType::Empty)
+ return;
+
+ if (symbolNode->getQualifier() == EvqGlobal)
+ {
+ TIntermSequence *initCode = CreateInitCode(symbolNode, canUseLoopsToInitialize,
+ highPrecisionSupported, symbolTable);
+ deferredInitializersOut->insert(deferredInitializersOut->end(), initCode->begin(),
+ initCode->end());
+ }
+ }
+}
+
+void InsertInitCallToMain(TIntermBlock *root,
+ TIntermSequence *deferredInitializers,
+ TSymbolTable *symbolTable)
+{
+ TIntermBlock *initGlobalsBlock = new TIntermBlock();
+ initGlobalsBlock->getSequence()->swap(*deferredInitializers);
+
+ TFunction *initGlobalsFunction =
+ new TFunction(symbolTable, kInitGlobalsString, SymbolType::AngleInternal,
+ StaticType::GetBasic<EbtVoid>(), false);
+
+ TIntermFunctionPrototype *initGlobalsFunctionPrototype =
+ CreateInternalFunctionPrototypeNode(*initGlobalsFunction);
+ root->getSequence()->insert(root->getSequence()->begin(), initGlobalsFunctionPrototype);
+ TIntermFunctionDefinition *initGlobalsFunctionDefinition =
+ CreateInternalFunctionDefinitionNode(*initGlobalsFunction, initGlobalsBlock);
+ root->appendStatement(initGlobalsFunctionDefinition);
+
+ TIntermAggregate *initGlobalsCall =
+ TIntermAggregate::CreateFunctionCall(*initGlobalsFunction, new TIntermSequence());
+
+ TIntermBlock *mainBody = FindMainBody(root);
+ mainBody->getSequence()->insert(mainBody->getSequence()->begin(), initGlobalsCall);
+}
+
+} // namespace
+
+void DeferGlobalInitializers(TIntermBlock *root,
+ bool initializeUninitializedGlobals,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TSymbolTable *symbolTable)
+{
+ TIntermSequence *deferredInitializers = new TIntermSequence();
+ std::vector<const TVariable *> variablesToReplace;
+
+ // Loop over all global statements and process the declarations. This is simpler than using a
+ // traverser.
+ for (TIntermNode *statement : *root->getSequence())
+ {
+ TIntermDeclaration *declaration = statement->getAsDeclarationNode();
+ if (declaration)
+ {
+ GetDeferredInitializers(declaration, initializeUninitializedGlobals,
+ canUseLoopsToInitialize, highPrecisionSupported,
+ deferredInitializers, &variablesToReplace, symbolTable);
+ }
+ }
+
+ // Add the function with initialization and the call to that.
+ if (!deferredInitializers->empty())
+ {
+ InsertInitCallToMain(root, deferredInitializers, symbolTable);
+ }
+
+ // Replace constant variables with non-constant global variables.
+ for (const TVariable *var : variablesToReplace)
+ {
+ TType *replacementType = new TType(var->getType());
+ replacementType->setQualifier(EvqGlobal);
+ TVariable *replacement =
+ new TVariable(symbolTable, var->name(), replacementType, var->symbolType());
+ ReplaceVariable(root, var, replacement);
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.h
new file mode 100644
index 0000000000..b0e4547857
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.h
@@ -0,0 +1,33 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DeferGlobalInitializers is an AST traverser that moves global initializers into a separate
+// function that is called in the beginning of main(). This enables initialization of globals with
+// uniforms or non-constant globals, as allowed by the WebGL spec. Some initializers referencing
+// non-constants may need to be unfolded into if statements in HLSL - this kind of steps should be
+// done after DeferGlobalInitializers is run. Note that it's important that the function definition
+// is at the end of the shader, as some globals may be declared after main().
+//
+// It can also initialize all uninitialized globals.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_DEFERGLOBALINITIALIZERS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_DEFERGLOBALINITIALIZERS_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void DeferGlobalInitializers(TIntermBlock *root,
+ bool initializeUninitializedGlobals,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_DEFERGLOBALINITIALIZERS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp
new file mode 100644
index 0000000000..d562136999
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp
@@ -0,0 +1,131 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// gl_FragColor needs to broadcast to all color buffers in ES2 if
+// GL_EXT_draw_buffers is explicitly enabled in a fragment shader.
+//
+// We emulate this by replacing all gl_FragColor with gl_FragData[0], and in the end
+// of main() function, assigning gl_FragData[1], ..., gl_FragData[maxDrawBuffers-1]
+// with gl_FragData[0].
+//
+
+#include "compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h"
+
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/tree_util/RunAtTheEndOfShader.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kGlFragDataString("gl_FragData");
+
+class GLFragColorBroadcastTraverser : public TIntermTraverser
+{
+ public:
+ GLFragColorBroadcastTraverser(int maxDrawBuffers, TSymbolTable *symbolTable, int shaderVersion)
+ : TIntermTraverser(true, false, false, symbolTable),
+ mGLFragColorUsed(false),
+ mMaxDrawBuffers(maxDrawBuffers),
+ mShaderVersion(shaderVersion)
+ {}
+
+ void broadcastGLFragColor(TIntermBlock *root);
+
+ bool isGLFragColorUsed() const { return mGLFragColorUsed; }
+
+ protected:
+ void visitSymbol(TIntermSymbol *node) override;
+
+ TIntermBinary *constructGLFragDataNode(int index) const;
+ TIntermBinary *constructGLFragDataAssignNode(int index) const;
+
+ private:
+ bool mGLFragColorUsed;
+ int mMaxDrawBuffers;
+ const int mShaderVersion;
+};
+
+TIntermBinary *GLFragColorBroadcastTraverser::constructGLFragDataNode(int index) const
+{
+ TIntermSymbol *symbol =
+ ReferenceBuiltInVariable(kGlFragDataString, *mSymbolTable, mShaderVersion);
+ TIntermTyped *indexNode = CreateIndexNode(index);
+
+ TIntermBinary *binary = new TIntermBinary(EOpIndexDirect, symbol, indexNode);
+ return binary;
+}
+
+TIntermBinary *GLFragColorBroadcastTraverser::constructGLFragDataAssignNode(int index) const
+{
+ TIntermTyped *fragDataIndex = constructGLFragDataNode(index);
+ TIntermTyped *fragDataZero = constructGLFragDataNode(0);
+
+ return new TIntermBinary(EOpAssign, fragDataIndex, fragDataZero);
+}
+
+void GLFragColorBroadcastTraverser::visitSymbol(TIntermSymbol *node)
+{
+ if (node->variable().symbolType() == SymbolType::BuiltIn && node->getName() == "gl_FragColor")
+ {
+ queueReplacement(constructGLFragDataNode(0), OriginalNode::IS_DROPPED);
+ mGLFragColorUsed = true;
+ }
+}
+
+void GLFragColorBroadcastTraverser::broadcastGLFragColor(TIntermBlock *root)
+{
+ ASSERT(mMaxDrawBuffers > 1);
+ if (!mGLFragColorUsed)
+ {
+ return;
+ }
+
+ TIntermBlock *broadcastBlock = new TIntermBlock();
+ // Now insert statements
+ // gl_FragData[1] = gl_FragData[0];
+ // ...
+ // gl_FragData[maxDrawBuffers - 1] = gl_FragData[0];
+ for (int colorIndex = 1; colorIndex < mMaxDrawBuffers; ++colorIndex)
+ {
+ broadcastBlock->appendStatement(constructGLFragDataAssignNode(colorIndex));
+ }
+ RunAtTheEndOfShader(root, broadcastBlock, mSymbolTable);
+}
+
+} // namespace
+
+void EmulateGLFragColorBroadcast(TIntermBlock *root,
+ int maxDrawBuffers,
+ std::vector<sh::OutputVariable> *outputVariables,
+ TSymbolTable *symbolTable,
+ int shaderVersion)
+{
+ ASSERT(maxDrawBuffers > 1);
+ GLFragColorBroadcastTraverser traverser(maxDrawBuffers, symbolTable, shaderVersion);
+ root->traverse(&traverser);
+ if (traverser.isGLFragColorUsed())
+ {
+ traverser.updateTree();
+ traverser.broadcastGLFragColor(root);
+ for (auto &var : *outputVariables)
+ {
+ if (var.name == "gl_FragColor")
+ {
+ // TODO(zmo): Find a way to keep the original variable information.
+ var.name = "gl_FragData";
+ var.mappedName = "gl_FragData";
+ var.arraySizes.push_back(maxDrawBuffers);
+ ASSERT(var.arraySizes.size() == 1u);
+ }
+ }
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h
new file mode 100644
index 0000000000..f6bf549bac
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h
@@ -0,0 +1,31 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Emulate gl_FragColor broadcast behaviors in ES2 where
+// GL_EXT_draw_buffers is explicitly enabled in a fragment shader.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_
+#define COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_
+
+#include <vector>
+
+namespace sh
+{
+struct OutputVariable;
+class TIntermBlock;
+class TSymbolTable;
+
+// Replace all gl_FragColor with gl_FragData[0], and in the end of main() function,
+// assign gl_FragData[1] ... gl_FragData[maxDrawBuffers - 1] with gl_FragData[0].
+// If gl_FragColor is in outputVariables, it is replaced by gl_FragData.
+void EmulateGLFragColorBroadcast(TIntermBlock *root,
+ int maxDrawBuffers,
+ std::vector<OutputVariable> *outputVariables,
+ TSymbolTable *symbolTable,
+ int shaderVersion);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.cpp
new file mode 100644
index 0000000000..8134ea79c3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.cpp
@@ -0,0 +1,213 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// EmulateGLDrawID is an AST traverser to convert the gl_DrawID builtin
+// to a uniform int
+//
+// EmulateGLBaseVertex is an AST traverser to convert the gl_BaseVertex builtin
+// to a uniform int
+//
+// EmulateGLBaseInstance is an AST traverser to convert the gl_BaseInstance builtin
+// to a uniform int
+//
+
+#include "compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h"
+
+#include "angle_gl.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/BuiltIn_autogen.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/tree_util/ReplaceVariable.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kEmulatedGLDrawIDName("angle_DrawID");
+
+class FindGLDrawIDTraverser : public TIntermTraverser
+{
+ public:
+ FindGLDrawIDTraverser() : TIntermTraverser(true, false, false), mVariable(nullptr) {}
+
+ const TVariable *getGLDrawIDBuiltinVariable() { return mVariable; }
+
+ protected:
+ void visitSymbol(TIntermSymbol *node) override
+ {
+ if (&node->variable() == BuiltInVariable::gl_DrawID() ||
+ &node->variable() == BuiltInVariable::gl_DrawIDESSL1())
+ {
+ mVariable = &node->variable();
+ }
+ }
+
+ private:
+ const TVariable *mVariable;
+};
+
+constexpr const ImmutableString kEmulatedGLBaseVertexName("angle_BaseVertex");
+
+class FindGLBaseVertexTraverser : public TIntermTraverser
+{
+ public:
+ FindGLBaseVertexTraverser() : TIntermTraverser(true, false, false), mVariable(nullptr) {}
+
+ const TVariable *getGLBaseVertexBuiltinVariable() { return mVariable; }
+
+ protected:
+ void visitSymbol(TIntermSymbol *node) override
+ {
+ if (&node->variable() == BuiltInVariable::gl_BaseVertex())
+ {
+ mVariable = &node->variable();
+ }
+ }
+
+ private:
+ const TVariable *mVariable;
+};
+
+constexpr const ImmutableString kEmulatedGLBaseInstanceName("angle_BaseInstance");
+
+class FindGLBaseInstanceTraverser : public TIntermTraverser
+{
+ public:
+ FindGLBaseInstanceTraverser() : TIntermTraverser(true, false, false), mVariable(nullptr) {}
+
+ const TVariable *getGLBaseInstanceBuiltinVariable() { return mVariable; }
+
+ protected:
+ void visitSymbol(TIntermSymbol *node) override
+ {
+ if (&node->variable() == BuiltInVariable::gl_BaseInstance())
+ {
+ mVariable = &node->variable();
+ }
+ }
+
+ private:
+ const TVariable *mVariable;
+};
+
+} // namespace
+
+void EmulateGLDrawID(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ std::vector<sh::Uniform> *uniforms,
+ bool shouldCollect)
+{
+ FindGLDrawIDTraverser traverser;
+ root->traverse(&traverser);
+ const TVariable *builtInVariable = traverser.getGLDrawIDBuiltinVariable();
+ if (builtInVariable)
+ {
+ const TType *type = StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
+ const TVariable *drawID =
+ new TVariable(symbolTable, kEmulatedGLDrawIDName, type, SymbolType::AngleInternal);
+
+ // AngleInternal variables don't get collected
+ if (shouldCollect)
+ {
+ Uniform uniform;
+ uniform.name = kEmulatedGLDrawIDName.data();
+ uniform.mappedName = kEmulatedGLDrawIDName.data();
+ uniform.type = GLVariableType(*type);
+ uniform.precision = GLVariablePrecision(*type);
+ uniform.staticUse = symbolTable->isStaticallyUsed(*builtInVariable);
+ uniform.active = true;
+ uniform.binding = type->getLayoutQualifier().binding;
+ uniform.location = type->getLayoutQualifier().location;
+ uniform.offset = type->getLayoutQualifier().offset;
+ uniform.readonly = type->getMemoryQualifier().readonly;
+ uniform.writeonly = type->getMemoryQualifier().writeonly;
+ uniforms->push_back(uniform);
+ }
+
+ DeclareGlobalVariable(root, drawID);
+ ReplaceVariable(root, builtInVariable, drawID);
+ }
+}
+
+void EmulateGLBaseVertex(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ std::vector<sh::Uniform> *uniforms,
+ bool shouldCollect)
+{
+ FindGLBaseVertexTraverser traverser;
+ root->traverse(&traverser);
+ const TVariable *builtInVariable = traverser.getGLBaseVertexBuiltinVariable();
+ if (builtInVariable)
+ {
+ const TType *type = StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
+ const TVariable *baseVertex =
+ new TVariable(symbolTable, kEmulatedGLBaseVertexName, type, SymbolType::AngleInternal);
+
+ // AngleInternal variables don't get collected
+ if (shouldCollect)
+ {
+ Uniform uniform;
+ uniform.name = kEmulatedGLBaseVertexName.data();
+ uniform.mappedName = kEmulatedGLBaseVertexName.data();
+ uniform.type = GLVariableType(*type);
+ uniform.precision = GLVariablePrecision(*type);
+ uniform.staticUse = symbolTable->isStaticallyUsed(*builtInVariable);
+ uniform.active = true;
+ uniform.binding = type->getLayoutQualifier().binding;
+ uniform.location = type->getLayoutQualifier().location;
+ uniform.offset = type->getLayoutQualifier().offset;
+ uniform.readonly = type->getMemoryQualifier().readonly;
+ uniform.writeonly = type->getMemoryQualifier().writeonly;
+ uniforms->push_back(uniform);
+ }
+
+ DeclareGlobalVariable(root, baseVertex);
+ ReplaceVariable(root, builtInVariable, baseVertex);
+ }
+}
+
+void EmulateGLBaseInstance(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ std::vector<sh::Uniform> *uniforms,
+ bool shouldCollect)
+{
+ FindGLBaseInstanceTraverser traverser;
+ root->traverse(&traverser);
+ const TVariable *builtInVariable = traverser.getGLBaseInstanceBuiltinVariable();
+ if (builtInVariable)
+ {
+ const TType *type = StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
+ const TVariable *baseInstance = new TVariable(symbolTable, kEmulatedGLBaseInstanceName,
+ type, SymbolType::AngleInternal);
+
+ // AngleInternal variables don't get collected
+ if (shouldCollect)
+ {
+ Uniform uniform;
+ uniform.name = kEmulatedGLBaseInstanceName.data();
+ uniform.mappedName = kEmulatedGLBaseInstanceName.data();
+ uniform.type = GLVariableType(*type);
+ uniform.precision = GLVariablePrecision(*type);
+ uniform.staticUse = symbolTable->isStaticallyUsed(*builtInVariable);
+ uniform.active = true;
+ uniform.binding = type->getLayoutQualifier().binding;
+ uniform.location = type->getLayoutQualifier().location;
+ uniform.offset = type->getLayoutQualifier().offset;
+ uniform.readonly = type->getMemoryQualifier().readonly;
+ uniform.writeonly = type->getMemoryQualifier().writeonly;
+ uniforms->push_back(uniform);
+ }
+
+ DeclareGlobalVariable(root, baseInstance);
+ ReplaceVariable(root, builtInVariable, baseInstance);
+ }
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h
new file mode 100644
index 0000000000..8134db9873
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.h
@@ -0,0 +1,47 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// EmulateGLDrawID is an AST traverser to convert the gl_DrawID builtin
+// to a uniform int
+//
+// EmulateGLBaseVertex is an AST traverser to convert the gl_BaseVertex builtin
+// to a uniform int
+//
+// EmulateGLBaseInstance is an AST traverser to convert the gl_BaseInstance builtin
+// to a uniform int
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_EMULATEMULTIDRAWSHADERBUILTINS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_EMULATEMULTIDRAWSHADERBUILTINS_H_
+
+#include <GLSLANG/ShaderLang.h>
+#include <vector>
+
+#include "compiler/translator/HashNames.h"
+
+namespace sh
+{
+struct Uniform;
+class TIntermBlock;
+class TSymbolTable;
+
+void EmulateGLDrawID(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ std::vector<sh::Uniform> *uniforms,
+ bool shouldCollect);
+
+void EmulateGLBaseVertex(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ std::vector<sh::Uniform> *uniforms,
+ bool shouldCollect);
+
+void EmulateGLBaseInstance(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ std::vector<sh::Uniform> *uniforms,
+ bool shouldCollect);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_EMULATEMULTIDRAWSHADERBUILTINS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp
new file mode 100644
index 0000000000..ba19bd112e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp
@@ -0,0 +1,776 @@
+//
+// 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/tree_ops/EmulatePrecision.h"
+
+#include "compiler/translator/FunctionLookup.h"
+
+#include <memory>
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kParamXName("x");
+constexpr const ImmutableString kParamYName("y");
+constexpr const ImmutableString kAngleFrmString("angle_frm");
+constexpr const ImmutableString kAngleFrlString("angle_frl");
+
+class RoundingHelperWriter : angle::NonCopyable
+{
+ public:
+ static RoundingHelperWriter *createHelperWriter(const ShShaderOutput outputLanguage);
+
+ void writeCommonRoundingHelpers(TInfoSinkBase &sink, const int shaderVersion);
+ void writeCompoundAssignmentHelper(TInfoSinkBase &sink,
+ const char *lType,
+ const char *rType,
+ const char *opStr,
+ const char *opNameStr);
+
+ virtual ~RoundingHelperWriter() {}
+
+ protected:
+ RoundingHelperWriter(const ShShaderOutput outputLanguage) : mOutputLanguage(outputLanguage) {}
+ RoundingHelperWriter() = delete;
+
+ const ShShaderOutput mOutputLanguage;
+
+ private:
+ virtual std::string getTypeString(const char *glslType) = 0;
+ virtual void writeFloatRoundingHelpers(TInfoSinkBase &sink) = 0;
+ virtual void writeVectorRoundingHelpers(TInfoSinkBase &sink, const unsigned int size) = 0;
+ virtual void writeMatrixRoundingHelper(TInfoSinkBase &sink,
+ const unsigned int columns,
+ const unsigned int rows,
+ const char *functionName) = 0;
+};
+
+class RoundingHelperWriterGLSL : public RoundingHelperWriter
+{
+ public:
+ RoundingHelperWriterGLSL(const ShShaderOutput outputLanguage)
+ : RoundingHelperWriter(outputLanguage)
+ {}
+
+ private:
+ std::string getTypeString(const char *glslType) override;
+ void writeFloatRoundingHelpers(TInfoSinkBase &sink) override;
+ void writeVectorRoundingHelpers(TInfoSinkBase &sink, const unsigned int size) override;
+ void writeMatrixRoundingHelper(TInfoSinkBase &sink,
+ const unsigned int columns,
+ const unsigned int rows,
+ const char *functionName) override;
+};
+
+class RoundingHelperWriterESSL : public RoundingHelperWriterGLSL
+{
+ public:
+ RoundingHelperWriterESSL(const ShShaderOutput outputLanguage)
+ : RoundingHelperWriterGLSL(outputLanguage)
+ {}
+
+ private:
+ std::string getTypeString(const char *glslType) override;
+};
+
+class RoundingHelperWriterHLSL : public RoundingHelperWriter
+{
+ public:
+ RoundingHelperWriterHLSL(const ShShaderOutput outputLanguage)
+ : RoundingHelperWriter(outputLanguage)
+ {}
+
+ private:
+ std::string getTypeString(const char *glslType) override;
+ void writeFloatRoundingHelpers(TInfoSinkBase &sink) override;
+ void writeVectorRoundingHelpers(TInfoSinkBase &sink, const unsigned int size) override;
+ void writeMatrixRoundingHelper(TInfoSinkBase &sink,
+ const unsigned int columns,
+ const unsigned int rows,
+ const char *functionName) override;
+};
+
+RoundingHelperWriter *RoundingHelperWriter::createHelperWriter(const ShShaderOutput outputLanguage)
+{
+ ASSERT(EmulatePrecision::SupportedInLanguage(outputLanguage));
+ switch (outputLanguage)
+ {
+ case SH_HLSL_4_1_OUTPUT:
+ return new RoundingHelperWriterHLSL(outputLanguage);
+ case SH_ESSL_OUTPUT:
+ return new RoundingHelperWriterESSL(outputLanguage);
+ default:
+ return new RoundingHelperWriterGLSL(outputLanguage);
+ }
+}
+
+void RoundingHelperWriter::writeCommonRoundingHelpers(TInfoSinkBase &sink, const int shaderVersion)
+{
+ // Write the angle_frm functions that round floating point numbers to
+ // half precision, and angle_frl functions that round them to minimum lowp
+ // precision.
+
+ writeFloatRoundingHelpers(sink);
+ writeVectorRoundingHelpers(sink, 2);
+ writeVectorRoundingHelpers(sink, 3);
+ writeVectorRoundingHelpers(sink, 4);
+ if (shaderVersion > 100)
+ {
+ for (unsigned int columns = 2; columns <= 4; ++columns)
+ {
+ for (unsigned int rows = 2; rows <= 4; ++rows)
+ {
+ writeMatrixRoundingHelper(sink, columns, rows, "angle_frm");
+ writeMatrixRoundingHelper(sink, columns, rows, "angle_frl");
+ }
+ }
+ }
+ else
+ {
+ for (unsigned int size = 2; size <= 4; ++size)
+ {
+ writeMatrixRoundingHelper(sink, size, size, "angle_frm");
+ writeMatrixRoundingHelper(sink, size, size, "angle_frl");
+ }
+ }
+}
+
+void RoundingHelperWriter::writeCompoundAssignmentHelper(TInfoSinkBase &sink,
+ const char *lType,
+ const char *rType,
+ const char *opStr,
+ const char *opNameStr)
+{
+ std::string lTypeStr = getTypeString(lType);
+ std::string rTypeStr = getTypeString(rType);
+
+ // Note that y should be passed through angle_frm at the function call site,
+ // but x can't be passed through angle_frm there since it is an inout parameter.
+ // So only pass x and the result through angle_frm here.
+ // clang-format off
+ sink <<
+ lTypeStr << " angle_compound_" << opNameStr << "_frm(inout " << lTypeStr << " x, in " << rTypeStr << " y) {\n"
+ " x = angle_frm(angle_frm(x) " << opStr << " y);\n"
+ " return x;\n"
+ "}\n";
+ sink <<
+ lTypeStr << " angle_compound_" << opNameStr << "_frl(inout " << lTypeStr << " x, in " << rTypeStr << " y) {\n"
+ " x = angle_frl(angle_frl(x) " << opStr << " y);\n"
+ " return x;\n"
+ "}\n";
+ // clang-format on
+}
+
+std::string RoundingHelperWriterGLSL::getTypeString(const char *glslType)
+{
+ return glslType;
+}
+
+std::string RoundingHelperWriterESSL::getTypeString(const char *glslType)
+{
+ std::stringstream typeStrStr = sh::InitializeStream<std::stringstream>();
+ typeStrStr << "highp " << glslType;
+ return typeStrStr.str();
+}
+
+void RoundingHelperWriterGLSL::writeFloatRoundingHelpers(TInfoSinkBase &sink)
+{
+ // Unoptimized version of angle_frm for single floats:
+ //
+ // int webgl_maxNormalExponent(in int exponentBits)
+ // {
+ // int possibleExponents = int(exp2(float(exponentBits)));
+ // int exponentBias = possibleExponents / 2 - 1;
+ // int allExponentBitsOne = possibleExponents - 1;
+ // return (allExponentBitsOne - 1) - exponentBias;
+ // }
+ //
+ // float angle_frm(in float x)
+ // {
+ // int mantissaBits = 10;
+ // int exponentBits = 5;
+ // float possibleMantissas = exp2(float(mantissaBits));
+ // float mantissaMax = 2.0 - 1.0 / possibleMantissas;
+ // int maxNE = webgl_maxNormalExponent(exponentBits);
+ // float max = exp2(float(maxNE)) * mantissaMax;
+ // if (x > max)
+ // {
+ // return max;
+ // }
+ // if (x < -max)
+ // {
+ // return -max;
+ // }
+ // float exponent = floor(log2(abs(x)));
+ // if (abs(x) == 0.0 || exponent < -float(maxNE))
+ // {
+ // return 0.0 * sign(x)
+ // }
+ // x = x * exp2(-(exponent - float(mantissaBits)));
+ // x = sign(x) * floor(abs(x));
+ // return x * exp2(exponent - float(mantissaBits));
+ // }
+
+ // All numbers with a magnitude less than 2^-15 are subnormal, and are
+ // flushed to zero.
+
+ // Note the constant numbers below:
+ // a) 65504 is the maximum possible mantissa (1.1111111111 in binary) times
+ // 2^15, the maximum normal exponent.
+ // b) 10.0 is the number of mantissa bits.
+ // c) -25.0 is the minimum normal half-float exponent -15.0 minus the number
+ // of mantissa bits.
+ // d) + 1e-30 is to make sure the argument of log2() won't be zero. It can
+ // only affect the result of log2 on x where abs(x) < 1e-22. Since these
+ // numbers will be flushed to zero either way (2^-15 is the smallest
+ // normal positive number), this does not introduce any error.
+
+ std::string floatType = getTypeString("float");
+
+ // clang-format off
+ sink <<
+ floatType << " angle_frm(in " << floatType << " x) {\n"
+ " x = clamp(x, -65504.0, 65504.0);\n"
+ " " << floatType << " exponent = floor(log2(abs(x) + 1e-30)) - 10.0;\n"
+ " bool isNonZero = (exponent >= -25.0);\n"
+ " x = x * exp2(-exponent);\n"
+ " x = sign(x) * floor(abs(x));\n"
+ " return x * exp2(exponent) * float(isNonZero);\n"
+ "}\n";
+
+ sink <<
+ floatType << " angle_frl(in " << floatType << " x) {\n"
+ " x = clamp(x, -2.0, 2.0);\n"
+ " x = x * 256.0;\n"
+ " x = sign(x) * floor(abs(x));\n"
+ " return x * 0.00390625;\n"
+ "}\n";
+ // clang-format on
+}
+
+void RoundingHelperWriterGLSL::writeVectorRoundingHelpers(TInfoSinkBase &sink,
+ const unsigned int size)
+{
+ std::stringstream vecTypeStrStr = sh::InitializeStream<std::stringstream>();
+ vecTypeStrStr << "vec" << size;
+ std::string vecType = getTypeString(vecTypeStrStr.str().c_str());
+
+ // clang-format off
+ sink <<
+ vecType << " angle_frm(in " << vecType << " v) {\n"
+ " v = clamp(v, -65504.0, 65504.0);\n"
+ " " << vecType << " exponent = floor(log2(abs(v) + 1e-30)) - 10.0;\n"
+ " bvec" << size << " isNonZero = greaterThanEqual(exponent, vec" << size << "(-25.0));\n"
+ " v = v * exp2(-exponent);\n"
+ " v = sign(v) * floor(abs(v));\n"
+ " return v * exp2(exponent) * vec" << size << "(isNonZero);\n"
+ "}\n";
+
+ sink <<
+ vecType << " angle_frl(in " << vecType << " v) {\n"
+ " v = clamp(v, -2.0, 2.0);\n"
+ " v = v * 256.0;\n"
+ " v = sign(v) * floor(abs(v));\n"
+ " return v * 0.00390625;\n"
+ "}\n";
+ // clang-format on
+}
+
+void RoundingHelperWriterGLSL::writeMatrixRoundingHelper(TInfoSinkBase &sink,
+ const unsigned int columns,
+ const unsigned int rows,
+ const char *functionName)
+{
+ std::stringstream matTypeStrStr = sh::InitializeStream<std::stringstream>();
+ matTypeStrStr << "mat" << columns;
+ if (rows != columns)
+ {
+ matTypeStrStr << "x" << rows;
+ }
+ std::string matType = getTypeString(matTypeStrStr.str().c_str());
+
+ sink << matType << " " << functionName << "(in " << matType << " m) {\n"
+ << " " << matType << " rounded;\n";
+
+ for (unsigned int i = 0; i < columns; ++i)
+ {
+ sink << " rounded[" << i << "] = " << functionName << "(m[" << i << "]);\n";
+ }
+
+ sink << " return rounded;\n"
+ "}\n";
+}
+
+static const char *GetHLSLTypeStr(const char *floatTypeStr)
+{
+ if (strcmp(floatTypeStr, "float") == 0)
+ {
+ return "float";
+ }
+ if (strcmp(floatTypeStr, "vec2") == 0)
+ {
+ return "float2";
+ }
+ if (strcmp(floatTypeStr, "vec3") == 0)
+ {
+ return "float3";
+ }
+ if (strcmp(floatTypeStr, "vec4") == 0)
+ {
+ return "float4";
+ }
+ if (strcmp(floatTypeStr, "mat2") == 0)
+ {
+ return "float2x2";
+ }
+ if (strcmp(floatTypeStr, "mat3") == 0)
+ {
+ return "float3x3";
+ }
+ if (strcmp(floatTypeStr, "mat4") == 0)
+ {
+ return "float4x4";
+ }
+ if (strcmp(floatTypeStr, "mat2x3") == 0)
+ {
+ return "float2x3";
+ }
+ if (strcmp(floatTypeStr, "mat2x4") == 0)
+ {
+ return "float2x4";
+ }
+ if (strcmp(floatTypeStr, "mat3x2") == 0)
+ {
+ return "float3x2";
+ }
+ if (strcmp(floatTypeStr, "mat3x4") == 0)
+ {
+ return "float3x4";
+ }
+ if (strcmp(floatTypeStr, "mat4x2") == 0)
+ {
+ return "float4x2";
+ }
+ if (strcmp(floatTypeStr, "mat4x3") == 0)
+ {
+ return "float4x3";
+ }
+ UNREACHABLE();
+ return nullptr;
+}
+
+std::string RoundingHelperWriterHLSL::getTypeString(const char *glslType)
+{
+ return GetHLSLTypeStr(glslType);
+}
+
+void RoundingHelperWriterHLSL::writeFloatRoundingHelpers(TInfoSinkBase &sink)
+{
+ // In HLSL scalars are the same as 1-vectors.
+ writeVectorRoundingHelpers(sink, 1);
+}
+
+void RoundingHelperWriterHLSL::writeVectorRoundingHelpers(TInfoSinkBase &sink,
+ const unsigned int size)
+{
+ std::stringstream vecTypeStrStr = sh::InitializeStream<std::stringstream>();
+ vecTypeStrStr << "float" << size;
+ std::string vecType = vecTypeStrStr.str();
+
+ // clang-format off
+ sink <<
+ vecType << " angle_frm(" << vecType << " v) {\n"
+ " v = clamp(v, -65504.0, 65504.0);\n"
+ " " << vecType << " exponent = floor(log2(abs(v) + 1e-30)) - 10.0;\n"
+ " bool" << size << " isNonZero = exponent < -25.0;\n"
+ " v = v * exp2(-exponent);\n"
+ " v = sign(v) * floor(abs(v));\n"
+ " return v * exp2(exponent) * (float" << size << ")(isNonZero);\n"
+ "}\n";
+
+ sink <<
+ vecType << " angle_frl(" << vecType << " v) {\n"
+ " v = clamp(v, -2.0, 2.0);\n"
+ " v = v * 256.0;\n"
+ " v = sign(v) * floor(abs(v));\n"
+ " return v * 0.00390625;\n"
+ "}\n";
+ // clang-format on
+}
+
+void RoundingHelperWriterHLSL::writeMatrixRoundingHelper(TInfoSinkBase &sink,
+ const unsigned int columns,
+ const unsigned int rows,
+ const char *functionName)
+{
+ std::stringstream matTypeStrStr = sh::InitializeStream<std::stringstream>();
+ matTypeStrStr << "float" << columns << "x" << rows;
+ std::string matType = matTypeStrStr.str();
+
+ sink << matType << " " << functionName << "(" << matType << " m) {\n"
+ << " " << matType << " rounded;\n";
+
+ for (unsigned int i = 0; i < columns; ++i)
+ {
+ sink << " rounded[" << i << "] = " << functionName << "(m[" << i << "]);\n";
+ }
+
+ sink << " return rounded;\n"
+ "}\n";
+}
+
+bool canRoundFloat(const TType &type)
+{
+ return type.getBasicType() == EbtFloat && !type.isArray() &&
+ (type.getPrecision() == EbpLow || type.getPrecision() == EbpMedium);
+}
+
+bool ParentUsesResult(TIntermNode *parent, TIntermTyped *node)
+{
+ if (!parent)
+ {
+ return false;
+ }
+
+ TIntermBlock *blockParent = parent->getAsBlock();
+ // If the parent is a block, the result is not assigned anywhere,
+ // so rounding it is not needed. In particular, this can avoid a lot of
+ // unnecessary rounding of unused return values of assignment.
+ if (blockParent)
+ {
+ return false;
+ }
+ TIntermBinary *binaryParent = parent->getAsBinaryNode();
+ if (binaryParent && binaryParent->getOp() == EOpComma && (binaryParent->getRight() != node))
+ {
+ return false;
+ }
+ return true;
+}
+
+bool ParentConstructorTakesCareOfRounding(TIntermNode *parent, TIntermTyped *node)
+{
+ if (!parent)
+ {
+ return false;
+ }
+ TIntermAggregate *parentConstructor = parent->getAsAggregate();
+ if (!parentConstructor || parentConstructor->getOp() != EOpConstruct)
+ {
+ return false;
+ }
+ if (parentConstructor->getPrecision() != node->getPrecision())
+ {
+ return false;
+ }
+ return canRoundFloat(parentConstructor->getType());
+}
+
+} // namespace
+
+EmulatePrecision::EmulatePrecision(TSymbolTable *symbolTable)
+ : TLValueTrackingTraverser(true, true, true, symbolTable), mDeclaringVariables(false)
+{}
+
+void EmulatePrecision::visitSymbol(TIntermSymbol *node)
+{
+ TIntermNode *parent = getParentNode();
+ if (canRoundFloat(node->getType()) && ParentUsesResult(parent, node) &&
+ !ParentConstructorTakesCareOfRounding(parent, node) && !mDeclaringVariables &&
+ !isLValueRequiredHere())
+ {
+ TIntermNode *replacement = createRoundingFunctionCallNode(node);
+ queueReplacement(replacement, OriginalNode::BECOMES_CHILD);
+ }
+}
+
+bool EmulatePrecision::visitBinary(Visit visit, TIntermBinary *node)
+{
+ bool visitChildren = true;
+
+ TOperator op = node->getOp();
+
+ // RHS of initialize is not being declared.
+ if (op == EOpInitialize && visit == InVisit)
+ mDeclaringVariables = false;
+
+ if ((op == EOpIndexDirectStruct) && visit == InVisit)
+ visitChildren = false;
+
+ if (visit != PreVisit)
+ return visitChildren;
+
+ const TType &type = node->getType();
+ bool roundFloat = canRoundFloat(type);
+
+ if (roundFloat)
+ {
+ switch (op)
+ {
+ // Math operators that can result in a float may need to apply rounding to the return
+ // value. Note that in the case of assignment, the rounding is applied to its return
+ // value here, not the value being assigned.
+ case EOpAssign:
+ case EOpAdd:
+ case EOpSub:
+ case EOpMul:
+ case EOpDiv:
+ case EOpVectorTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesScalar:
+ case EOpMatrixTimesMatrix:
+ {
+ TIntermNode *parent = getParentNode();
+ if (!ParentUsesResult(parent, node) ||
+ ParentConstructorTakesCareOfRounding(parent, node))
+ {
+ break;
+ }
+ TIntermNode *replacement = createRoundingFunctionCallNode(node);
+ queueReplacement(replacement, OriginalNode::BECOMES_CHILD);
+ break;
+ }
+
+ // Compound assignment cases need to replace the operator with a function call.
+ case EOpAddAssign:
+ {
+ mEmulateCompoundAdd.insert(
+ TypePair(type.getBuiltInTypeNameString(),
+ node->getRight()->getType().getBuiltInTypeNameString()));
+ TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(
+ node->getLeft(), node->getRight(), "add");
+ queueReplacement(replacement, OriginalNode::IS_DROPPED);
+ break;
+ }
+ case EOpSubAssign:
+ {
+ mEmulateCompoundSub.insert(
+ TypePair(type.getBuiltInTypeNameString(),
+ node->getRight()->getType().getBuiltInTypeNameString()));
+ TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(
+ node->getLeft(), node->getRight(), "sub");
+ queueReplacement(replacement, OriginalNode::IS_DROPPED);
+ break;
+ }
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ {
+ mEmulateCompoundMul.insert(
+ TypePair(type.getBuiltInTypeNameString(),
+ node->getRight()->getType().getBuiltInTypeNameString()));
+ TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(
+ node->getLeft(), node->getRight(), "mul");
+ queueReplacement(replacement, OriginalNode::IS_DROPPED);
+ break;
+ }
+ case EOpDivAssign:
+ {
+ mEmulateCompoundDiv.insert(
+ TypePair(type.getBuiltInTypeNameString(),
+ node->getRight()->getType().getBuiltInTypeNameString()));
+ TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(
+ node->getLeft(), node->getRight(), "div");
+ queueReplacement(replacement, OriginalNode::IS_DROPPED);
+ break;
+ }
+ default:
+ // The rest of the binary operations should not need precision emulation.
+ break;
+ }
+ }
+ return visitChildren;
+}
+
+bool EmulatePrecision::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ // Variable or interface block declaration.
+ if (visit == PreVisit)
+ {
+ mDeclaringVariables = true;
+ }
+ else if (visit == InVisit)
+ {
+ mDeclaringVariables = true;
+ }
+ else
+ {
+ mDeclaringVariables = false;
+ }
+ return true;
+}
+
+bool EmulatePrecision::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
+{
+ return false;
+}
+
+bool EmulatePrecision::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (visit != PreVisit)
+ return true;
+
+ // User-defined function return values are not rounded. The calculations that produced
+ // the value inside the function definition should have been rounded.
+ TOperator op = node->getOp();
+ if (op == EOpCallInternalRawFunction || op == EOpCallFunctionInAST ||
+ (op == EOpConstruct && node->getBasicType() == EbtStruct))
+ {
+ return true;
+ }
+
+ TIntermNode *parent = getParentNode();
+ if (canRoundFloat(node->getType()) && ParentUsesResult(parent, node) &&
+ !ParentConstructorTakesCareOfRounding(parent, node))
+ {
+ TIntermNode *replacement = createRoundingFunctionCallNode(node);
+ queueReplacement(replacement, OriginalNode::BECOMES_CHILD);
+ }
+ return true;
+}
+
+bool EmulatePrecision::visitUnary(Visit visit, TIntermUnary *node)
+{
+ switch (node->getOp())
+ {
+ case EOpNegative:
+ case EOpLogicalNot:
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ case EOpLogicalNotComponentWise:
+ break;
+ default:
+ if (canRoundFloat(node->getType()) && visit == PreVisit)
+ {
+ TIntermNode *replacement = createRoundingFunctionCallNode(node);
+ queueReplacement(replacement, OriginalNode::BECOMES_CHILD);
+ }
+ break;
+ }
+
+ return true;
+}
+
+void EmulatePrecision::writeEmulationHelpers(TInfoSinkBase &sink,
+ const int shaderVersion,
+ const ShShaderOutput outputLanguage)
+{
+ std::unique_ptr<RoundingHelperWriter> roundingHelperWriter(
+ RoundingHelperWriter::createHelperWriter(outputLanguage));
+
+ roundingHelperWriter->writeCommonRoundingHelpers(sink, shaderVersion);
+
+ EmulationSet::const_iterator it;
+ for (it = mEmulateCompoundAdd.begin(); it != mEmulateCompoundAdd.end(); it++)
+ roundingHelperWriter->writeCompoundAssignmentHelper(sink, it->lType, it->rType, "+", "add");
+ for (it = mEmulateCompoundSub.begin(); it != mEmulateCompoundSub.end(); it++)
+ roundingHelperWriter->writeCompoundAssignmentHelper(sink, it->lType, it->rType, "-", "sub");
+ for (it = mEmulateCompoundDiv.begin(); it != mEmulateCompoundDiv.end(); it++)
+ roundingHelperWriter->writeCompoundAssignmentHelper(sink, it->lType, it->rType, "/", "div");
+ for (it = mEmulateCompoundMul.begin(); it != mEmulateCompoundMul.end(); it++)
+ roundingHelperWriter->writeCompoundAssignmentHelper(sink, it->lType, it->rType, "*", "mul");
+}
+
+// static
+bool EmulatePrecision::SupportedInLanguage(const ShShaderOutput outputLanguage)
+{
+ switch (outputLanguage)
+ {
+ case SH_HLSL_4_1_OUTPUT:
+ case SH_ESSL_OUTPUT:
+ return true;
+ default:
+ // Other languages not yet supported
+ return (outputLanguage == SH_GLSL_COMPATIBILITY_OUTPUT ||
+ sh::IsGLSL130OrNewer(outputLanguage));
+ }
+}
+
+const TFunction *EmulatePrecision::getInternalFunction(const ImmutableString &functionName,
+ const TType &returnType,
+ TIntermSequence *arguments,
+ const TVector<const TVariable *> &parameters,
+ bool knownToNotHaveSideEffects)
+{
+ ImmutableString mangledName = TFunctionLookup::GetMangledName(functionName.data(), *arguments);
+ if (mInternalFunctions.find(mangledName) == mInternalFunctions.end())
+ {
+ TFunction *func = new TFunction(mSymbolTable, functionName, SymbolType::AngleInternal,
+ new TType(returnType), knownToNotHaveSideEffects);
+ ASSERT(parameters.size() == arguments->size());
+ for (size_t i = 0; i < parameters.size(); ++i)
+ {
+ func->addParameter(parameters[i]);
+ }
+ mInternalFunctions[mangledName] = func;
+ }
+ return mInternalFunctions[mangledName];
+}
+
+TIntermAggregate *EmulatePrecision::createRoundingFunctionCallNode(TIntermTyped *roundedChild)
+{
+ const ImmutableString *roundFunctionName = &kAngleFrmString;
+ if (roundedChild->getPrecision() == EbpLow)
+ roundFunctionName = &kAngleFrlString;
+ TIntermSequence *arguments = new TIntermSequence();
+ arguments->push_back(roundedChild);
+
+ TVector<const TVariable *> parameters;
+ TType *paramType = new TType(roundedChild->getType());
+ paramType->setPrecision(EbpHigh);
+ paramType->setQualifier(EvqIn);
+ parameters.push_back(new TVariable(mSymbolTable, kParamXName,
+ static_cast<const TType *>(paramType),
+ SymbolType::AngleInternal));
+
+ return TIntermAggregate::CreateRawFunctionCall(
+ *getInternalFunction(*roundFunctionName, roundedChild->getType(), arguments, parameters,
+ true),
+ arguments);
+}
+
+TIntermAggregate *EmulatePrecision::createCompoundAssignmentFunctionCallNode(TIntermTyped *left,
+ TIntermTyped *right,
+ const char *opNameStr)
+{
+ std::stringstream strstr = sh::InitializeStream<std::stringstream>();
+ if (left->getPrecision() == EbpMedium)
+ strstr << "angle_compound_" << opNameStr << "_frm";
+ else
+ strstr << "angle_compound_" << opNameStr << "_frl";
+ ImmutableString functionName = ImmutableString(strstr.str());
+ TIntermSequence *arguments = new TIntermSequence();
+ arguments->push_back(left);
+ arguments->push_back(right);
+
+ TVector<const TVariable *> parameters;
+ TType *leftParamType = new TType(left->getType());
+ leftParamType->setPrecision(EbpHigh);
+ leftParamType->setQualifier(EvqOut);
+ parameters.push_back(new TVariable(mSymbolTable, kParamXName,
+ static_cast<const TType *>(leftParamType),
+ SymbolType::AngleInternal));
+ TType *rightParamType = new TType(right->getType());
+ rightParamType->setPrecision(EbpHigh);
+ rightParamType->setQualifier(EvqIn);
+ parameters.push_back(new TVariable(mSymbolTable, kParamYName,
+ static_cast<const TType *>(rightParamType),
+ SymbolType::AngleInternal));
+
+ return TIntermAggregate::CreateRawFunctionCall(
+ *getInternalFunction(functionName, left->getType(), arguments, parameters, false),
+ arguments);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.h
new file mode 100644
index 0000000000..10501fa1d0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.h
@@ -0,0 +1,85 @@
+//
+// 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_TREEOPS_EMULATE_PRECISION_H_
+#define COMPILER_TRANSLATOR_TREEOPS_EMULATE_PRECISION_H_
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/angleutils.h"
+#include "compiler/translator/Compiler.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+// This class gathers all compound assignments from the AST and can then write
+// the functions required for their precision emulation. This way there is no
+// need to write a huge number of variations of the emulated compound assignment
+// to every translated shader with emulation enabled.
+
+namespace sh
+{
+
+class EmulatePrecision : public TLValueTrackingTraverser
+{
+ public:
+ EmulatePrecision(TSymbolTable *symbolTable);
+
+ void visitSymbol(TIntermSymbol *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override;
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+
+ void writeEmulationHelpers(TInfoSinkBase &sink,
+ const int shaderVersion,
+ const ShShaderOutput outputLanguage);
+
+ static bool SupportedInLanguage(const ShShaderOutput outputLanguage);
+
+ private:
+ struct TypePair
+ {
+ TypePair(const char *l, const char *r) : lType(l), rType(r) {}
+
+ const char *lType;
+ const char *rType;
+ };
+
+ struct TypePairComparator
+ {
+ bool operator()(const TypePair &l, const TypePair &r) const
+ {
+ if (l.lType == r.lType)
+ return l.rType < r.rType;
+ return l.lType < r.lType;
+ }
+ };
+
+ const TFunction *getInternalFunction(const ImmutableString &functionName,
+ const TType &returnType,
+ TIntermSequence *arguments,
+ const TVector<const TVariable *> &parameters,
+ bool knownToNotHaveSideEffects);
+ TIntermAggregate *createRoundingFunctionCallNode(TIntermTyped *roundedChild);
+ TIntermAggregate *createCompoundAssignmentFunctionCallNode(TIntermTyped *left,
+ TIntermTyped *right,
+ const char *opNameStr);
+
+ typedef std::set<TypePair, TypePairComparator> EmulationSet;
+ EmulationSet mEmulateCompoundAdd;
+ EmulationSet mEmulateCompoundSub;
+ EmulationSet mEmulateCompoundMul;
+ EmulationSet mEmulateCompoundDiv;
+
+ // Map from mangled name to function.
+ TMap<ImmutableString, const TFunction *> mInternalFunctions;
+
+ bool mDeclaringVariables;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_EMULATE_PRECISION_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp
new file mode 100644
index 0000000000..73791c1ce1
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp
@@ -0,0 +1,145 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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 integer pow expressions HLSL bug workaround.
+// See header for more info.
+
+#include "compiler/translator/tree_ops/ExpandIntegerPowExpressions.h"
+
+#include <cmath>
+#include <cstdlib>
+
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class Traverser : public TIntermTraverser
+{
+ public:
+ static void Apply(TIntermNode *root, TSymbolTable *symbolTable);
+
+ private:
+ Traverser(TSymbolTable *symbolTable);
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ void nextIteration();
+
+ bool mFound = false;
+};
+
+// static
+void Traverser::Apply(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ Traverser traverser(symbolTable);
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.mFound)
+ {
+ traverser.updateTree();
+ }
+ } while (traverser.mFound);
+}
+
+Traverser::Traverser(TSymbolTable *symbolTable) : TIntermTraverser(true, false, false, symbolTable)
+{}
+
+void Traverser::nextIteration()
+{
+ mFound = false;
+}
+
+bool Traverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (mFound)
+ {
+ return false;
+ }
+
+ // Test 0: skip non-pow operators.
+ if (node->getOp() != EOpPow)
+ {
+ return true;
+ }
+
+ const TIntermSequence *sequence = node->getSequence();
+ ASSERT(sequence->size() == 2u);
+ const TIntermConstantUnion *constantExponent = sequence->at(1)->getAsConstantUnion();
+
+ // Test 1: check for a single constant.
+ if (!constantExponent || constantExponent->getNominalSize() != 1)
+ {
+ return true;
+ }
+
+ float exponentValue = constantExponent->getConstantValue()->getFConst();
+
+ // Test 2: exponentValue is in the problematic range.
+ if (exponentValue < -5.0f || exponentValue > 9.0f)
+ {
+ return true;
+ }
+
+ // Test 3: exponentValue is integer or pretty close to an integer.
+ if (std::abs(exponentValue - std::round(exponentValue)) > 0.0001f)
+ {
+ return true;
+ }
+
+ // Test 4: skip -1, 0, and 1
+ int exponent = static_cast<int>(std::round(exponentValue));
+ int n = std::abs(exponent);
+ if (n < 2)
+ {
+ return true;
+ }
+
+ // Potential problem case detected, apply workaround.
+
+ TIntermTyped *lhs = sequence->at(0)->getAsTyped();
+ ASSERT(lhs);
+
+ TIntermDeclaration *lhsVariableDeclaration = nullptr;
+ TVariable *lhsVariable =
+ DeclareTempVariable(mSymbolTable, lhs, EvqTemporary, &lhsVariableDeclaration);
+ insertStatementInParentBlock(lhsVariableDeclaration);
+
+ // Create a chain of n-1 multiples.
+ TIntermTyped *current = CreateTempSymbolNode(lhsVariable);
+ for (int i = 1; i < n; ++i)
+ {
+ TIntermBinary *mul = new TIntermBinary(EOpMul, current, CreateTempSymbolNode(lhsVariable));
+ mul->setLine(node->getLine());
+ current = mul;
+ }
+
+ // For negative pow, compute the reciprocal of the positive pow.
+ if (exponent < 0)
+ {
+ TConstantUnion *oneVal = new TConstantUnion();
+ oneVal->setFConst(1.0f);
+ TIntermConstantUnion *oneNode = new TIntermConstantUnion(oneVal, node->getType());
+ TIntermBinary *div = new TIntermBinary(EOpDiv, oneNode, current);
+ current = div;
+ }
+
+ queueReplacement(current, OriginalNode::IS_DROPPED);
+ mFound = true;
+ return false;
+}
+
+} // anonymous namespace
+
+void ExpandIntegerPowExpressions(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ Traverser::Apply(root, symbolTable);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.h
new file mode 100644
index 0000000000..7ee5adab3c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.h
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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 mutating tree traversal works around a bug in the HLSL compiler optimizer with "pow" that
+// manifests under the following conditions:
+//
+// - If pow() has a literal exponent value
+// - ... and this value is integer or within 10e-6 of an integer
+// - ... and it is in {-4, -3, -2, 2, 3, 4, 5, 6, 7, 8}
+//
+// The workaround is to replace the pow with a series of multiplies.
+// See http://anglebug.com/851
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TSymbolTable;
+
+void ExpandIntegerPowExpressions(TIntermNode *root, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp
new file mode 100644
index 0000000000..5d57e1e716
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp
@@ -0,0 +1,115 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FoldExpressions.cpp: Fold expressions. This may fold expressions so that the qualifier of the
+// folded node differs from the qualifier of the original expression, so it needs to be done after
+// parsing and validation of qualifiers is complete. Expressions that are folded:
+// 1. Ternary ops with a constant condition.
+// 2. Sequence aka comma ops where the left side has no side effects.
+// 3. Any expressions containing any of the above.
+
+#include "compiler/translator/tree_ops/FoldExpressions.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class FoldExpressionsTraverser : public TIntermTraverser
+{
+ public:
+ FoldExpressionsTraverser(TDiagnostics *diagnostics)
+ : TIntermTraverser(true, false, false), mDiagnostics(diagnostics), mDidReplace(false)
+ {}
+
+ bool didReplace() { return mDidReplace; }
+
+ void nextIteration() { mDidReplace = false; }
+
+ protected:
+ bool visitTernary(Visit visit, TIntermTernary *node) override
+ {
+ TIntermTyped *folded = node->fold(mDiagnostics);
+ if (folded != node)
+ {
+ queueReplacement(folded, OriginalNode::IS_DROPPED);
+ mDidReplace = true;
+ return false;
+ }
+ return true;
+ }
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ TIntermTyped *folded = node->fold(mDiagnostics);
+ if (folded != node)
+ {
+ queueReplacement(folded, OriginalNode::IS_DROPPED);
+ mDidReplace = true;
+ return false;
+ }
+ return true;
+ }
+
+ bool visitBinary(Visit visit, TIntermBinary *node) override
+ {
+ TIntermTyped *folded = node->fold(mDiagnostics);
+ if (folded != node)
+ {
+ queueReplacement(folded, OriginalNode::IS_DROPPED);
+ mDidReplace = true;
+ return false;
+ }
+ return true;
+ }
+
+ bool visitUnary(Visit visit, TIntermUnary *node) override
+ {
+ TIntermTyped *folded = node->fold(mDiagnostics);
+ if (folded != node)
+ {
+ queueReplacement(folded, OriginalNode::IS_DROPPED);
+ mDidReplace = true;
+ return false;
+ }
+ return true;
+ }
+
+ bool visitSwizzle(Visit visit, TIntermSwizzle *node) override
+ {
+ TIntermTyped *folded = node->fold(mDiagnostics);
+ if (folded != node)
+ {
+ queueReplacement(folded, OriginalNode::IS_DROPPED);
+ mDidReplace = true;
+ return false;
+ }
+ return true;
+ }
+
+ private:
+ TDiagnostics *mDiagnostics;
+ bool mDidReplace;
+};
+
+} // anonymous namespace
+
+void FoldExpressions(TIntermBlock *root, TDiagnostics *diagnostics)
+{
+ FoldExpressionsTraverser traverser(diagnostics);
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ traverser.updateTree();
+ } while (traverser.didReplace());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.h
new file mode 100644
index 0000000000..42d026afb8
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.h
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FoldExpressions.h: Fold expressions. This may fold expressions so that the qualifier of the
+// folded node differs from the qualifier of the original expression, so it needs to be done after
+// parsing and validation of qualifiers is complete. Expressions that are folded: 1. Ternary ops
+// with a constant condition.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_FOLDEXPRESSIONS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_FOLDEXPRESSIONS_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TDiagnostics;
+
+void FoldExpressions(TIntermBlock *root, TDiagnostics *diagnostics);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_FOLDEXPRESSIONS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp
new file mode 100644
index 0000000000..21b0bed658
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp
@@ -0,0 +1,311 @@
+//
+// 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.
+//
+
+#include "compiler/translator/tree_ops/InitializeVariables.h"
+
+#include "angle_gl.h"
+#include "common/debug.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/FindMain.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void AddArrayZeroInitSequence(const TIntermTyped *initializedNode,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TIntermSequence *initSequenceOut,
+ TSymbolTable *symbolTable);
+
+void AddStructZeroInitSequence(const TIntermTyped *initializedNode,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TIntermSequence *initSequenceOut,
+ TSymbolTable *symbolTable);
+
+TIntermBinary *CreateZeroInitAssignment(const TIntermTyped *initializedNode)
+{
+ TIntermTyped *zero = CreateZeroNode(initializedNode->getType());
+ return new TIntermBinary(EOpAssign, initializedNode->deepCopy(), zero);
+}
+
+void AddZeroInitSequence(const TIntermTyped *initializedNode,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TIntermSequence *initSequenceOut,
+ TSymbolTable *symbolTable)
+{
+ if (initializedNode->isArray())
+ {
+ AddArrayZeroInitSequence(initializedNode, canUseLoopsToInitialize, highPrecisionSupported,
+ initSequenceOut, symbolTable);
+ }
+ else if (initializedNode->getType().isStructureContainingArrays() ||
+ initializedNode->getType().isNamelessStruct())
+ {
+ AddStructZeroInitSequence(initializedNode, canUseLoopsToInitialize, highPrecisionSupported,
+ initSequenceOut, symbolTable);
+ }
+ else
+ {
+ initSequenceOut->push_back(CreateZeroInitAssignment(initializedNode));
+ }
+}
+
+void AddStructZeroInitSequence(const TIntermTyped *initializedNode,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TIntermSequence *initSequenceOut,
+ TSymbolTable *symbolTable)
+{
+ ASSERT(initializedNode->getBasicType() == EbtStruct);
+ const TStructure *structType = initializedNode->getType().getStruct();
+ for (int i = 0; i < static_cast<int>(structType->fields().size()); ++i)
+ {
+ TIntermBinary *element = new TIntermBinary(EOpIndexDirectStruct,
+ initializedNode->deepCopy(), CreateIndexNode(i));
+ // Structs can't be defined inside structs, so the type of a struct field can't be a
+ // nameless struct.
+ ASSERT(!element->getType().isNamelessStruct());
+ AddZeroInitSequence(element, canUseLoopsToInitialize, highPrecisionSupported,
+ initSequenceOut, symbolTable);
+ }
+}
+
+void AddArrayZeroInitStatementList(const TIntermTyped *initializedNode,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TIntermSequence *initSequenceOut,
+ TSymbolTable *symbolTable)
+{
+ for (unsigned int i = 0; i < initializedNode->getOutermostArraySize(); ++i)
+ {
+ TIntermBinary *element =
+ new TIntermBinary(EOpIndexDirect, initializedNode->deepCopy(), CreateIndexNode(i));
+ AddZeroInitSequence(element, canUseLoopsToInitialize, highPrecisionSupported,
+ initSequenceOut, symbolTable);
+ }
+}
+
+void AddArrayZeroInitForLoop(const TIntermTyped *initializedNode,
+ bool highPrecisionSupported,
+ TIntermSequence *initSequenceOut,
+ TSymbolTable *symbolTable)
+{
+ ASSERT(initializedNode->isArray());
+ const TType *mediumpIndexType = StaticType::Get<EbtInt, EbpMedium, EvqTemporary, 1, 1>();
+ const TType *highpIndexType = StaticType::Get<EbtInt, EbpHigh, EvqTemporary, 1, 1>();
+ TVariable *indexVariable =
+ CreateTempVariable(symbolTable, highPrecisionSupported ? highpIndexType : mediumpIndexType);
+
+ TIntermSymbol *indexSymbolNode = CreateTempSymbolNode(indexVariable);
+ TIntermDeclaration *indexInit =
+ CreateTempInitDeclarationNode(indexVariable, CreateZeroNode(indexVariable->getType()));
+ TIntermConstantUnion *arraySizeNode = CreateIndexNode(initializedNode->getOutermostArraySize());
+ TIntermBinary *indexSmallerThanSize =
+ new TIntermBinary(EOpLessThan, indexSymbolNode->deepCopy(), arraySizeNode);
+ TIntermUnary *indexIncrement =
+ new TIntermUnary(EOpPreIncrement, indexSymbolNode->deepCopy(), nullptr);
+
+ TIntermBlock *forLoopBody = new TIntermBlock();
+ TIntermSequence *forLoopBodySeq = forLoopBody->getSequence();
+
+ TIntermBinary *element = new TIntermBinary(EOpIndexIndirect, initializedNode->deepCopy(),
+ indexSymbolNode->deepCopy());
+ AddZeroInitSequence(element, true, highPrecisionSupported, forLoopBodySeq, symbolTable);
+
+ TIntermLoop *forLoop =
+ new TIntermLoop(ELoopFor, indexInit, indexSmallerThanSize, indexIncrement, forLoopBody);
+ initSequenceOut->push_back(forLoop);
+}
+
+void AddArrayZeroInitSequence(const TIntermTyped *initializedNode,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TIntermSequence *initSequenceOut,
+ TSymbolTable *symbolTable)
+{
+ // The array elements are assigned one by one to keep the AST compatible with ESSL 1.00 which
+ // doesn't have array assignment. We'll do this either with a for loop or just a list of
+ // statements assigning to each array index. Note that it is important to have the array init in
+ // the right order to workaround http://crbug.com/709317
+ bool isSmallArray = initializedNode->getOutermostArraySize() <= 1u ||
+ (initializedNode->getBasicType() != EbtStruct &&
+ !initializedNode->getType().isArrayOfArrays() &&
+ initializedNode->getOutermostArraySize() <= 3u);
+ if (initializedNode->getQualifier() == EvqFragData ||
+ initializedNode->getQualifier() == EvqFragmentOut || isSmallArray ||
+ !canUseLoopsToInitialize)
+ {
+ // Fragment outputs should not be indexed by non-constant indices.
+ // Also it doesn't make sense to use loops to initialize very small arrays.
+ AddArrayZeroInitStatementList(initializedNode, canUseLoopsToInitialize,
+ highPrecisionSupported, initSequenceOut, symbolTable);
+ }
+ else
+ {
+ AddArrayZeroInitForLoop(initializedNode, highPrecisionSupported, initSequenceOut,
+ symbolTable);
+ }
+}
+
+void InsertInitCode(TIntermSequence *mainBody,
+ const InitVariableList &variables,
+ TSymbolTable *symbolTable,
+ int shaderVersion,
+ const TExtensionBehavior &extensionBehavior,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported)
+{
+ for (const auto &var : variables)
+ {
+ // Note that tempVariableName will reference a short-lived char array here - that's fine
+ // since we're only using it to find symbols.
+ ImmutableString tempVariableName(var.name.c_str(), var.name.length());
+
+ TIntermTyped *initializedSymbol = nullptr;
+ if (var.isBuiltIn())
+ {
+ initializedSymbol =
+ ReferenceBuiltInVariable(tempVariableName, *symbolTable, shaderVersion);
+ if (initializedSymbol->getQualifier() == EvqFragData &&
+ !IsExtensionEnabled(extensionBehavior, TExtension::EXT_draw_buffers))
+ {
+ // If GL_EXT_draw_buffers is disabled, only the 0th index of gl_FragData can be
+ // written to.
+ // TODO(oetuaho): This is a bit hacky and would be better to remove, if we came up
+ // with a good way to do it. Right now "gl_FragData" in symbol table is initialized
+ // to have the array size of MaxDrawBuffers, and the initialization happens before
+ // the shader sets the extensions it is using.
+ initializedSymbol =
+ new TIntermBinary(EOpIndexDirect, initializedSymbol, CreateIndexNode(0));
+ }
+ }
+ else
+ {
+ initializedSymbol = ReferenceGlobalVariable(tempVariableName, *symbolTable);
+ }
+ ASSERT(initializedSymbol != nullptr);
+
+ TIntermSequence *initCode = CreateInitCode(initializedSymbol, canUseLoopsToInitialize,
+ highPrecisionSupported, symbolTable);
+ mainBody->insert(mainBody->begin(), initCode->begin(), initCode->end());
+ }
+}
+
+class InitializeLocalsTraverser : public TIntermTraverser
+{
+ public:
+ InitializeLocalsTraverser(int shaderVersion,
+ TSymbolTable *symbolTable,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported)
+ : TIntermTraverser(true, false, false, symbolTable),
+ mShaderVersion(shaderVersion),
+ mCanUseLoopsToInitialize(canUseLoopsToInitialize),
+ mHighPrecisionSupported(highPrecisionSupported)
+ {}
+
+ protected:
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override
+ {
+ for (TIntermNode *declarator : *node->getSequence())
+ {
+ if (!mInGlobalScope && !declarator->getAsBinaryNode())
+ {
+ TIntermSymbol *symbol = declarator->getAsSymbolNode();
+ ASSERT(symbol);
+ if (symbol->variable().symbolType() == SymbolType::Empty)
+ {
+ continue;
+ }
+
+ // Arrays may need to be initialized one element at a time, since ESSL 1.00 does not
+ // support array constructors or assigning arrays.
+ bool arrayConstructorUnavailable =
+ (symbol->isArray() || symbol->getType().isStructureContainingArrays()) &&
+ mShaderVersion == 100;
+ // Nameless struct constructors can't be referred to, so they also need to be
+ // initialized one element at a time.
+ // TODO(oetuaho): Check if it makes sense to initialize using a loop, even if we
+ // could use an initializer. It could at least reduce code size for very large
+ // arrays, but could hurt runtime performance.
+ if (arrayConstructorUnavailable || symbol->getType().isNamelessStruct())
+ {
+ // SimplifyLoopConditions should have been run so the parent node of this node
+ // should not be a loop.
+ ASSERT(getParentNode()->getAsLoopNode() == nullptr);
+ // SeparateDeclarations should have already been run, so we don't need to worry
+ // about further declarators in this declaration depending on the effects of
+ // this declarator.
+ ASSERT(node->getSequence()->size() == 1);
+ insertStatementsInParentBlock(
+ TIntermSequence(), *CreateInitCode(symbol, mCanUseLoopsToInitialize,
+ mHighPrecisionSupported, mSymbolTable));
+ }
+ else
+ {
+ TIntermBinary *init =
+ new TIntermBinary(EOpInitialize, symbol, CreateZeroNode(symbol->getType()));
+ queueReplacementWithParent(node, symbol, init, OriginalNode::BECOMES_CHILD);
+ }
+ }
+ }
+ return false;
+ }
+
+ private:
+ int mShaderVersion;
+ bool mCanUseLoopsToInitialize;
+ bool mHighPrecisionSupported;
+};
+
+} // namespace
+
+TIntermSequence *CreateInitCode(const TIntermTyped *initializedSymbol,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TSymbolTable *symbolTable)
+{
+ TIntermSequence *initCode = new TIntermSequence();
+ AddZeroInitSequence(initializedSymbol, canUseLoopsToInitialize, highPrecisionSupported,
+ initCode, symbolTable);
+ return initCode;
+}
+
+void InitializeUninitializedLocals(TIntermBlock *root,
+ int shaderVersion,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TSymbolTable *symbolTable)
+{
+ InitializeLocalsTraverser traverser(shaderVersion, symbolTable, canUseLoopsToInitialize,
+ highPrecisionSupported);
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+void InitializeVariables(TIntermBlock *root,
+ const InitVariableList &vars,
+ TSymbolTable *symbolTable,
+ int shaderVersion,
+ const TExtensionBehavior &extensionBehavior,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported)
+{
+ TIntermBlock *body = FindMainBody(root);
+ InsertInitCode(body->getSequence(), vars, symbolTable, shaderVersion, extensionBehavior,
+ canUseLoopsToInitialize, highPrecisionSupported);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.h
new file mode 100644
index 0000000000..06695f93c9
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.h
@@ -0,0 +1,56 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_INITIALIZEVARIABLES_H_
+#define COMPILER_TRANSLATOR_TREEOPS_INITIALIZEVARIABLES_H_
+
+#include <GLSLANG/ShaderLang.h>
+
+#include "compiler/translator/ExtensionBehavior.h"
+#include "compiler/translator/IntermNode.h"
+
+namespace sh
+{
+class TSymbolTable;
+
+typedef std::vector<sh::ShaderVariable> InitVariableList;
+
+// For all of the functions below: If canUseLoopsToInitialize is set, for loops are used instead of
+// a large number of initializers where it can make sense, such as for initializing large arrays.
+
+// Return a sequence of assignment operations to initialize "initializedSymbol". initializedSymbol
+// may be an array, struct or any combination of these, as long as it contains only basic types.
+TIntermSequence *CreateInitCode(const TIntermTyped *initializedSymbol,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TSymbolTable *symbolTable);
+
+// Initialize all uninitialized local variables, so that undefined behavior is avoided.
+void InitializeUninitializedLocals(TIntermBlock *root,
+ int shaderVersion,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported,
+ TSymbolTable *symbolTable);
+
+// This function can initialize all the types that CreateInitCode is able to initialize. All
+// variables must be globals which can be found in the symbol table. For now it is used for the
+// following two scenarios:
+// 1. Initializing gl_Position;
+// 2. Initializing output variables referred to in the shader source.
+// Note: The type of each lvalue in an initializer is retrieved from the symbol table. gl_FragData
+// requires special handling because the number of indices which can be initialized is determined by
+// enabled extensions.
+void InitializeVariables(TIntermBlock *root,
+ const InitVariableList &vars,
+ TSymbolTable *symbolTable,
+ int shaderVersion,
+ const TExtensionBehavior &extensionBehavior,
+ bool canUseLoopsToInitialize,
+ bool highPrecisionSupported);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_INITIALIZEVARIABLES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.cpp
new file mode 100644
index 0000000000..9c544491ec
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.cpp
@@ -0,0 +1,101 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// NameEmbeddedUniformStructs: Gives nameless uniform struct internal names.
+//
+
+#include "compiler/translator/tree_ops/NameEmbeddedUniformStructs.h"
+
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+namespace
+{
+// This traverser translates embedded uniform structs into a specifier and declaration.
+// This makes the declarations easier to move into uniform blocks.
+class Traverser : public TIntermTraverser
+{
+ public:
+ explicit Traverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable)
+ {}
+
+ bool visitDeclaration(Visit visit, TIntermDeclaration *decl) override
+ {
+ ASSERT(visit == PreVisit);
+
+ if (!mInGlobalScope)
+ {
+ return false;
+ }
+
+ const TIntermSequence &sequence = *(decl->getSequence());
+ ASSERT(sequence.size() == 1);
+ TIntermTyped *declarator = sequence.front()->getAsTyped();
+ const TType &type = declarator->getType();
+
+ if (type.isStructSpecifier() && type.getQualifier() == EvqUniform)
+ {
+ const TStructure *structure = type.getStruct();
+
+ if (structure->symbolType() == SymbolType::Empty)
+ {
+ doReplacement(decl, declarator, structure);
+ }
+ }
+
+ return false;
+ }
+
+ private:
+ void doReplacement(TIntermDeclaration *decl,
+ TIntermTyped *declarator,
+ const TStructure *oldStructure)
+ {
+ // struct <structName> { ... };
+ TStructure *structure = new TStructure(mSymbolTable, kEmptyImmutableString,
+ &oldStructure->fields(), SymbolType::AngleInternal);
+ TType *namedType = new TType(structure, true);
+ namedType->setQualifier(EvqGlobal);
+
+ TVariable *structVariable =
+ new TVariable(mSymbolTable, kEmptyImmutableString, namedType, SymbolType::Empty);
+ TIntermSymbol *structDeclarator = new TIntermSymbol(structVariable);
+ TIntermDeclaration *structDeclaration = new TIntermDeclaration;
+ structDeclaration->appendDeclarator(structDeclarator);
+
+ TIntermSequence *newSequence = new TIntermSequence;
+ newSequence->push_back(structDeclaration);
+
+ // uniform <structName> <structUniformName>;
+ TIntermSymbol *asSymbol = declarator->getAsSymbolNode();
+ if (asSymbol && asSymbol->variable().symbolType() != SymbolType::Empty)
+ {
+ TIntermDeclaration *namedDecl = new TIntermDeclaration;
+ TType *uniformType = new TType(structure, false);
+ uniformType->setQualifier(EvqUniform);
+
+ TVariable *newVar = new TVariable(mSymbolTable, asSymbol->getName(), uniformType,
+ asSymbol->variable().symbolType());
+ TIntermSymbol *newSymbol = new TIntermSymbol(newVar);
+ namedDecl->appendDeclarator(newSymbol);
+
+ newSequence->push_back(namedDecl);
+ }
+
+ mMultiReplacements.emplace_back(getParentNode()->getAsBlock(), decl, *newSequence);
+ }
+};
+} // anonymous namespace
+
+void NameEmbeddedStructUniforms(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ Traverser nameStructs(symbolTable);
+ root->traverse(&nameStructs);
+ nameStructs.updateTree();
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.h
new file mode 100644
index 0000000000..0ada189501
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.h
@@ -0,0 +1,25 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// NameEmbeddedUniformStructs: Gives nameless uniform struct internal names.
+//
+// For example:
+// uniform struct { int a; } uni;
+// becomes:
+// struct s1 { int a; };
+// uniform s1 uni;
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
+
+namespace sh
+{
+class TIntermBlock;
+class TSymbolTable;
+void NameEmbeddedStructUniforms(TIntermBlock *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_NAMEEMBEDDEDUNIFORMSTRUCTS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp
new file mode 100644
index 0000000000..7dd756ca2d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp
@@ -0,0 +1,127 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PruneEmptyCases.cpp: The PruneEmptyCases function prunes cases that are followed by nothing from
+// the AST.
+
+#include "compiler/translator/tree_ops/PruneEmptyCases.h"
+
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+bool AreEmptyBlocks(TIntermSequence *statements);
+
+bool IsEmptyBlock(TIntermNode *node)
+{
+ TIntermBlock *asBlock = node->getAsBlock();
+ if (asBlock)
+ {
+ return AreEmptyBlocks(asBlock->getSequence());
+ }
+ // Empty declarations should have already been pruned, otherwise they would need to be handled
+ // here. Note that declarations for struct types do contain a nameless child node.
+ ASSERT(node->getAsDeclarationNode() == nullptr ||
+ !node->getAsDeclarationNode()->getSequence()->empty());
+ // Pure literal statements should also already be pruned.
+ ASSERT(node->getAsConstantUnion() == nullptr);
+ return false;
+}
+
+// Return true if all statements in "statements" consist only of empty blocks and no-op statements.
+// Returns true also if there are no statements.
+bool AreEmptyBlocks(TIntermSequence *statements)
+{
+ for (size_t i = 0u; i < statements->size(); ++i)
+ {
+ if (!IsEmptyBlock(statements->at(i)))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+class PruneEmptyCasesTraverser : private TIntermTraverser
+{
+ public:
+ static void apply(TIntermBlock *root);
+
+ private:
+ PruneEmptyCasesTraverser();
+ bool visitSwitch(Visit visit, TIntermSwitch *node) override;
+};
+
+void PruneEmptyCasesTraverser::apply(TIntermBlock *root)
+{
+ PruneEmptyCasesTraverser prune;
+ root->traverse(&prune);
+ prune.updateTree();
+}
+
+PruneEmptyCasesTraverser::PruneEmptyCasesTraverser() : TIntermTraverser(true, false, false) {}
+
+bool PruneEmptyCasesTraverser::visitSwitch(Visit visit, TIntermSwitch *node)
+{
+ // This may mutate the statementList, but that's okay, since traversal has not yet reached
+ // there.
+ TIntermBlock *statementList = node->getStatementList();
+ TIntermSequence *statements = statementList->getSequence();
+
+ // Iterate block children in reverse order. Cases that are only followed by other cases or empty
+ // blocks are marked for pruning.
+ size_t i = statements->size();
+ size_t lastNoOpInStatementList = i;
+ while (i > 0)
+ {
+ --i;
+ TIntermNode *statement = statements->at(i);
+ if (statement->getAsCaseNode() || IsEmptyBlock(statement))
+ {
+ lastNoOpInStatementList = i;
+ }
+ else
+ {
+ break;
+ }
+ }
+ if (lastNoOpInStatementList == 0)
+ {
+ // Remove the entire switch statement, extracting the init expression if needed.
+ TIntermTyped *init = node->getInit();
+ if (init->hasSideEffects())
+ {
+ queueReplacement(init, OriginalNode::IS_DROPPED);
+ }
+ else
+ {
+ TIntermSequence emptyReplacement;
+ ASSERT(getParentNode()->getAsBlock());
+ mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(),
+ node, emptyReplacement));
+ }
+ return false;
+ }
+ if (lastNoOpInStatementList < statements->size())
+ {
+ statements->erase(statements->begin() + lastNoOpInStatementList, statements->end());
+ }
+
+ return true;
+}
+
+} // namespace
+
+void PruneEmptyCases(TIntermBlock *root)
+{
+ PruneEmptyCasesTraverser::apply(root);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.h
new file mode 100644
index 0000000000..0b88ac181c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.h
@@ -0,0 +1,19 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PruneEmptyCases.h: The PruneEmptyCases function prunes cases that are followed by nothing from
+// the AST.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_PRUNEEMPTYCASES_H_
+#define COMPILER_TRANSLATOR_TREEOPS_PRUNEEMPTYCASES_H_
+
+namespace sh
+{
+class TIntermBlock;
+
+void PruneEmptyCases(TIntermBlock *root);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_PRUNEEMPTYCASES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp
new file mode 100644
index 0000000000..620c3f481b
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp
@@ -0,0 +1,166 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PruneNoOps.cpp: The PruneNoOps function prunes:
+// 1. Empty declarations "int;". Empty declarators will be pruned as well, so for example:
+// int , a;
+// is turned into
+// int a;
+// 2. Literal statements: "1.0;". The ESSL output doesn't define a default precision for float,
+// so float literal statements would end up with no precision which is invalid ESSL.
+
+#include "compiler/translator/tree_ops/PruneNoOps.h"
+
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+bool IsNoOp(TIntermNode *node)
+{
+ if (node->getAsConstantUnion() != nullptr)
+ {
+ return true;
+ }
+ bool isEmptyDeclaration = node->getAsDeclarationNode() != nullptr &&
+ node->getAsDeclarationNode()->getSequence()->empty();
+ if (isEmptyDeclaration)
+ {
+ return true;
+ }
+ return false;
+}
+
+class PruneNoOpsTraverser : private TIntermTraverser
+{
+ public:
+ static void apply(TIntermBlock *root, TSymbolTable *symbolTable);
+
+ private:
+ PruneNoOpsTraverser(TSymbolTable *symbolTable);
+ bool visitDeclaration(Visit, TIntermDeclaration *node) override;
+ bool visitBlock(Visit visit, TIntermBlock *node) override;
+ bool visitLoop(Visit visit, TIntermLoop *loop) override;
+};
+
+void PruneNoOpsTraverser::apply(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ PruneNoOpsTraverser prune(symbolTable);
+ root->traverse(&prune);
+ prune.updateTree();
+}
+
+PruneNoOpsTraverser::PruneNoOpsTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable)
+{}
+
+bool PruneNoOpsTraverser::visitDeclaration(Visit, TIntermDeclaration *node)
+{
+ TIntermSequence *sequence = node->getSequence();
+ if (sequence->size() >= 1)
+ {
+ TIntermSymbol *declaratorSymbol = sequence->front()->getAsSymbolNode();
+ // Prune declarations without a variable name, unless it's an interface block declaration.
+ if (declaratorSymbol != nullptr &&
+ declaratorSymbol->variable().symbolType() == SymbolType::Empty &&
+ !declaratorSymbol->isInterfaceBlock())
+ {
+ if (sequence->size() > 1)
+ {
+ // Generate a replacement that will remove the empty declarator in the beginning of
+ // a declarator list. Example of a declaration that will be changed:
+ // float, a;
+ // will be changed to
+ // float a;
+ // This applies also to struct declarations.
+ TIntermSequence emptyReplacement;
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(node, declaratorSymbol, emptyReplacement));
+ }
+ else if (declaratorSymbol->getBasicType() != EbtStruct)
+ {
+ // If there are entirely empty non-struct declarations, they result in
+ // TIntermDeclaration nodes without any children in the parsing stage. These are
+ // handled in visitBlock and visitLoop.
+ UNREACHABLE();
+ }
+ else if (declaratorSymbol->getQualifier() != EvqGlobal &&
+ declaratorSymbol->getQualifier() != EvqTemporary)
+ {
+ // Single struct declarations may just declare the struct type and no variables, so
+ // they should not be pruned. Here we handle an empty struct declaration with a
+ // qualifier, for example like this:
+ // const struct a { int i; };
+ // NVIDIA GL driver version 367.27 doesn't accept this kind of declarations, so we
+ // convert the declaration to a regular struct declaration. This is okay, since ESSL
+ // 1.00 spec section 4.1.8 says about structs that "The optional qualifiers only
+ // apply to any declarators, and are not part of the type being defined for name."
+
+ // Create a new variable to use in the declarator so that the variable and node
+ // types are kept consistent.
+ TType *type = new TType(declaratorSymbol->getType());
+ if (mInGlobalScope)
+ {
+ type->setQualifier(EvqGlobal);
+ }
+ else
+ {
+ type->setQualifier(EvqTemporary);
+ }
+ TVariable *variable =
+ new TVariable(mSymbolTable, kEmptyImmutableString, type, SymbolType::Empty);
+ queueReplacementWithParent(node, declaratorSymbol, new TIntermSymbol(variable),
+ OriginalNode::IS_DROPPED);
+ }
+ }
+ }
+ return false;
+}
+
+bool PruneNoOpsTraverser::visitBlock(Visit visit, TIntermBlock *node)
+{
+ TIntermSequence *statements = node->getSequence();
+
+ for (TIntermNode *statement : *statements)
+ {
+ if (IsNoOp(statement))
+ {
+ TIntermSequence emptyReplacement;
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(node, statement, emptyReplacement));
+ }
+ }
+
+ return true;
+}
+
+bool PruneNoOpsTraverser::visitLoop(Visit visit, TIntermLoop *loop)
+{
+ TIntermTyped *expr = loop->getExpression();
+ if (expr != nullptr && IsNoOp(expr))
+ {
+ loop->setExpression(nullptr);
+ }
+ TIntermNode *init = loop->getInit();
+ if (init != nullptr && IsNoOp(init))
+ {
+ loop->setInit(nullptr);
+ }
+
+ return true;
+}
+
+} // namespace
+
+void PruneNoOps(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ PruneNoOpsTraverser::apply(root, symbolTable);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.h
new file mode 100644
index 0000000000..83a6c66589
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.h
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// PruneNoOps.h: The PruneNoOps function prunes:
+// 1. Empty declarations "int;". Empty declarators will be pruned as well, so for example:
+// int , a;
+// is turned into
+// int a;
+// 2. Literal statements: "1.0;". The ESSL output doesn't define a default precision for float,
+// so float literal statements would end up with no precision which is invalid ESSL.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
+
+namespace sh
+{
+class TIntermBlock;
+class TSymbolTable;
+
+void PruneNoOps(TIntermBlock *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp
new file mode 100644
index 0000000000..9e7b0a0330
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp
@@ -0,0 +1,167 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// During parsing, all constant expressions are folded to constant union nodes. The expressions that
+// have been folded may have had precision qualifiers, which should affect the precision of the
+// consuming operation. If the folded constant union nodes are written to output as such they won't
+// have any precision qualifiers, and their effect on the precision of the consuming operation is
+// lost.
+//
+// RecordConstantPrecision is an AST traverser that inspects the precision qualifiers of constants
+// and hoists the constants outside the containing expression as precision qualified named variables
+// in case that is required for correct precision propagation.
+//
+
+#include "compiler/translator/tree_ops/RecordConstantPrecision.h"
+
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class RecordConstantPrecisionTraverser : public TIntermTraverser
+{
+ public:
+ RecordConstantPrecisionTraverser(TSymbolTable *symbolTable);
+
+ void visitConstantUnion(TIntermConstantUnion *node) override;
+
+ void nextIteration();
+
+ bool foundHigherPrecisionConstant() const { return mFoundHigherPrecisionConstant; }
+
+ protected:
+ bool operandAffectsParentOperationPrecision(TIntermTyped *operand);
+
+ bool mFoundHigherPrecisionConstant;
+};
+
+RecordConstantPrecisionTraverser::RecordConstantPrecisionTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, true, symbolTable), mFoundHigherPrecisionConstant(false)
+{}
+
+bool RecordConstantPrecisionTraverser::operandAffectsParentOperationPrecision(TIntermTyped *operand)
+{
+ if (getParentNode()->getAsCaseNode() || getParentNode()->getAsBlock())
+ {
+ return false;
+ }
+
+ const TIntermBinary *parentAsBinary = getParentNode()->getAsBinaryNode();
+ if (parentAsBinary != nullptr)
+ {
+ // If the constant is assigned or is used to initialize a variable, or if it's an index,
+ // its precision has no effect.
+ switch (parentAsBinary->getOp())
+ {
+ case EOpInitialize:
+ case EOpAssign:
+ case EOpIndexDirect:
+ case EOpIndexDirectStruct:
+ case EOpIndexDirectInterfaceBlock:
+ case EOpIndexIndirect:
+ return false;
+ default:
+ break;
+ }
+
+ TIntermTyped *otherOperand = parentAsBinary->getRight();
+ if (otherOperand == operand)
+ {
+ otherOperand = parentAsBinary->getLeft();
+ }
+ // If the precision of the other child is at least as high as the precision of the constant,
+ // the precision of the constant has no effect.
+ if (otherOperand->getAsConstantUnion() == nullptr &&
+ otherOperand->getPrecision() >= operand->getPrecision())
+ {
+ return false;
+ }
+ }
+
+ TIntermAggregate *parentAsAggregate = getParentNode()->getAsAggregate();
+ if (parentAsAggregate != nullptr)
+ {
+ if (!parentAsAggregate->gotPrecisionFromChildren())
+ {
+ // This can be either:
+ // * a call to an user-defined function
+ // * a call to a texture function
+ // * some other kind of aggregate
+ // In any of these cases the constant precision has no effect.
+ return false;
+ }
+ if (parentAsAggregate->isConstructor() && parentAsAggregate->getBasicType() == EbtBool)
+ {
+ return false;
+ }
+ // If the precision of operands does affect the result, but the precision of any of the
+ // other children has a precision that's at least as high as the precision of the constant,
+ // the precision of the constant has no effect.
+ TIntermSequence *parameters = parentAsAggregate->getSequence();
+ for (TIntermNode *parameter : *parameters)
+ {
+ const TIntermTyped *typedParameter = parameter->getAsTyped();
+ if (parameter != operand && typedParameter != nullptr &&
+ parameter->getAsConstantUnion() == nullptr &&
+ typedParameter->getPrecision() >= operand->getPrecision())
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+void RecordConstantPrecisionTraverser::visitConstantUnion(TIntermConstantUnion *node)
+{
+ if (mFoundHigherPrecisionConstant)
+ return;
+
+ // If the constant has lowp or undefined precision, it can't increase the precision of consuming
+ // operations.
+ if (node->getPrecision() < EbpMedium)
+ return;
+
+ // It's possible the node has no effect on the precision of the consuming expression, depending
+ // on the consuming expression, and the precision of the other parameters of the expression.
+ if (!operandAffectsParentOperationPrecision(node))
+ return;
+
+ // Make the constant a precision-qualified named variable to make sure it affects the precision
+ // of the consuming expression.
+ TIntermDeclaration *variableDeclaration = nullptr;
+ TVariable *variable = DeclareTempVariable(mSymbolTable, node, EvqConst, &variableDeclaration);
+ insertStatementInParentBlock(variableDeclaration);
+ queueReplacement(CreateTempSymbolNode(variable), OriginalNode::IS_DROPPED);
+ mFoundHigherPrecisionConstant = true;
+}
+
+void RecordConstantPrecisionTraverser::nextIteration()
+{
+ mFoundHigherPrecisionConstant = false;
+}
+
+} // namespace
+
+void RecordConstantPrecision(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ RecordConstantPrecisionTraverser traverser(symbolTable);
+ // Iterate as necessary, and reset the traverser between iterations.
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.foundHigherPrecisionConstant())
+ traverser.updateTree();
+ } while (traverser.foundHigherPrecisionConstant());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.h
new file mode 100644
index 0000000000..5b15db5e48
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.h
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// During parsing, all constant expressions are folded to constant union nodes. The expressions that
+// have been folded may have had precision qualifiers, which should affect the precision of the
+// consuming operation. If the folded constant union nodes are written to output as such they won't
+// have any precision qualifiers, and their effect on the precision of the consuming operation is
+// lost.
+//
+// RecordConstantPrecision is an AST traverser that inspects the precision qualifiers of constants
+// and hoists the constants outside the containing expression as precision qualified named variables
+// in case that is required for correct precision propagation.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
+#define COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
+
+namespace sh
+{
+class TIntermNode;
+class TSymbolTable;
+
+void RecordConstantPrecision(TIntermNode *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp
new file mode 100644
index 0000000000..dd700246db
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp
@@ -0,0 +1,87 @@
+//
+// 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/tree_ops/RegenerateStructNames.h"
+
+#include "common/debug.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+
+namespace sh
+{
+
+namespace
+{
+constexpr const ImmutableString kPrefix("_webgl_struct_");
+} // anonymous namespace
+
+void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
+{
+ ASSERT(symbol);
+ const TType &type = symbol->getType();
+ const TStructure *userType = type.getStruct();
+ if (!userType)
+ return;
+
+ if (userType->symbolType() == SymbolType::BuiltIn ||
+ userType->symbolType() == SymbolType::Empty)
+ {
+ // Built-in struct or nameless struct, do not touch it.
+ return;
+ }
+
+ int uniqueId = userType->uniqueId().get();
+
+ ASSERT(mScopeDepth > 0);
+ if (mScopeDepth == 1)
+ {
+ // If a struct is defined at global scope, we don't map its name.
+ // This is because at global level, the struct might be used to
+ // declare a uniform, so the same name needs to stay the same for
+ // vertex/fragment shaders. However, our mapping uses internal ID,
+ // which will be different for the same struct in vertex/fragment
+ // shaders.
+ // This is OK because names for any structs defined in other scopes
+ // will begin with "_webgl", which is reserved. So there will be
+ // no conflicts among unmapped struct names from global scope and
+ // mapped struct names from other scopes.
+ // However, we need to keep track of these global structs, so if a
+ // variable is used in a local scope, we don't try to modify the
+ // struct name through that variable.
+ mDeclaredGlobalStructs.insert(uniqueId);
+ return;
+ }
+ if (mDeclaredGlobalStructs.count(uniqueId) > 0)
+ return;
+ // Map {name} to _webgl_struct_{uniqueId}_{name}.
+ if (userType->name().beginsWith(kPrefix))
+ {
+ // The name has already been regenerated.
+ return;
+ }
+ ImmutableStringBuilder tmp(kPrefix.length() + sizeof(uniqueId) * 2u + 1u +
+ userType->name().length());
+ tmp << kPrefix;
+ tmp.appendHex(uniqueId);
+ tmp << '_' << userType->name();
+
+ // TODO(oetuaho): Add another mechanism to change symbol names so that the const_cast is not
+ // needed.
+ const_cast<TStructure *>(userType)->setName(tmp);
+}
+
+bool RegenerateStructNames::visitBlock(Visit, TIntermBlock *block)
+{
+ ++mScopeDepth;
+ TIntermSequence &sequence = *(block->getSequence());
+ for (TIntermNode *node : sequence)
+ {
+ node->traverse(this);
+ }
+ --mScopeDepth;
+ return false;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.h
new file mode 100644
index 0000000000..4c53cd50e8
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.h
@@ -0,0 +1,40 @@
+//
+// 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_TREEOPS_REGENERATESTRUCTNAMES_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_
+
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+#include <set>
+
+namespace sh
+{
+
+class RegenerateStructNames : public TIntermTraverser
+{
+ public:
+ RegenerateStructNames(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable), mScopeDepth(0)
+ {}
+
+ protected:
+ void visitSymbol(TIntermSymbol *) override;
+ bool visitBlock(Visit, TIntermBlock *block) override;
+
+ private:
+ // Indicating the depth of the current scope.
+ // The global scope is 1.
+ int mScopeDepth;
+
+ // If a struct's declared globally, push its ID in this set.
+ std::set<int> mDeclaredGlobalStructs;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp
new file mode 100644
index 0000000000..473159f89c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp
@@ -0,0 +1,83 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveArrayLengthMethod.cpp:
+// Fold array length expressions, including cases where the "this" node has side effects.
+// Example:
+// int i = (a = b).length();
+// int j = (func()).length();
+// becomes:
+// (a = b);
+// int i = <constant array length>;
+// func();
+// int j = <constant array length>;
+//
+// Must be run after SplitSequenceOperator, SimplifyLoopConditions and SeparateDeclarations steps
+// have been done to expressions containing calls of the array length method.
+//
+// Does nothing to length method calls done on runtime-sized arrays.
+
+#include "compiler/translator/tree_ops/RemoveArrayLengthMethod.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class RemoveArrayLengthTraverser : public TIntermTraverser
+{
+ public:
+ RemoveArrayLengthTraverser() : TIntermTraverser(true, false, false), mFoundArrayLength(false) {}
+
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+
+ void nextIteration() { mFoundArrayLength = false; }
+
+ bool foundArrayLength() const { return mFoundArrayLength; }
+
+ private:
+ bool mFoundArrayLength;
+};
+
+bool RemoveArrayLengthTraverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ // The only case where we leave array length() in place is for runtime-sized arrays.
+ if (node->getOp() == EOpArrayLength && !node->getOperand()->getType().isUnsizedArray())
+ {
+ mFoundArrayLength = true;
+ if (!node->getOperand()->hasSideEffects())
+ {
+ queueReplacement(node->fold(nullptr), OriginalNode::IS_DROPPED);
+ return false;
+ }
+ insertStatementInParentBlock(node->getOperand()->deepCopy());
+ TConstantUnion *constArray = new TConstantUnion[1];
+ constArray->setIConst(node->getOperand()->getOutermostArraySize());
+ queueReplacement(new TIntermConstantUnion(constArray, node->getType()),
+ OriginalNode::IS_DROPPED);
+ return false;
+ }
+ return true;
+}
+
+} // anonymous namespace
+
+void RemoveArrayLengthMethod(TIntermBlock *root)
+{
+ RemoveArrayLengthTraverser traverser;
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.foundArrayLength())
+ traverser.updateTree();
+ } while (traverser.foundArrayLength());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.h
new file mode 100644
index 0000000000..6376828749
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.h
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveArrayLengthMethod.h:
+// Fold array length expressions, including cases where the "this" node has side effects.
+// Example:
+// int i = (a = b).length();
+// int j = (func()).length();
+// becomes:
+// (a = b);
+// int i = <constant array length>;
+// func();
+// int j = <constant array length>;
+//
+// Must be run after SplitSequenceOperator, SimplifyLoopConditions and SeparateDeclarations steps
+// have been done to expressions containing calls of the array length method.
+//
+// Does nothing to length method calls done on runtime-sized arrays.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+
+void RemoveArrayLengthMethod(TIntermBlock *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp
new file mode 100644
index 0000000000..879d29eba0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp
@@ -0,0 +1,543 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveDynamicIndexing is an AST traverser to remove dynamic indexing of non-SSBO vectors and
+// matrices, replacing them with calls to functions that choose which component to return or write.
+// We don't need to consider dynamic indexing in SSBO since it can be directly as part of the offset
+// of RWByteAddressBuffer.
+//
+
+#include "compiler/translator/tree_ops/RemoveDynamicIndexing.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+const TType *kIndexType = StaticType::Get<EbtInt, EbpHigh, EvqIn, 1, 1>();
+
+constexpr const ImmutableString kBaseName("base");
+constexpr const ImmutableString kIndexName("index");
+constexpr const ImmutableString kValueName("value");
+
+std::string GetIndexFunctionName(const TType &type, bool write)
+{
+ TInfoSinkBase nameSink;
+ nameSink << "dyn_index_";
+ if (write)
+ {
+ nameSink << "write_";
+ }
+ if (type.isMatrix())
+ {
+ nameSink << "mat" << type.getCols() << "x" << type.getRows();
+ }
+ else
+ {
+ switch (type.getBasicType())
+ {
+ case EbtInt:
+ nameSink << "ivec";
+ break;
+ case EbtBool:
+ nameSink << "bvec";
+ break;
+ case EbtUInt:
+ nameSink << "uvec";
+ break;
+ case EbtFloat:
+ nameSink << "vec";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ nameSink << type.getNominalSize();
+ }
+ return nameSink.str();
+}
+
+TIntermConstantUnion *CreateIntConstantNode(int i)
+{
+ TConstantUnion *constant = new TConstantUnion();
+ constant->setIConst(i);
+ return new TIntermConstantUnion(constant, TType(EbtInt, EbpHigh));
+}
+
+TIntermTyped *EnsureSignedInt(TIntermTyped *node)
+{
+ if (node->getBasicType() == EbtInt)
+ return node;
+
+ TIntermSequence *arguments = new TIntermSequence();
+ arguments->push_back(node);
+ return TIntermAggregate::CreateConstructor(TType(EbtInt), arguments);
+}
+
+TType *GetFieldType(const TType &indexedType)
+{
+ if (indexedType.isMatrix())
+ {
+ TType *fieldType = new TType(indexedType.getBasicType(), indexedType.getPrecision());
+ fieldType->setPrimarySize(static_cast<unsigned char>(indexedType.getRows()));
+ return fieldType;
+ }
+ else
+ {
+ return new TType(indexedType.getBasicType(), indexedType.getPrecision());
+ }
+}
+
+const TType *GetBaseType(const TType &type, bool write)
+{
+ TType *baseType = new TType(type);
+ // Conservatively use highp here, even if the indexed type is not highp. That way the code can't
+ // end up using mediump version of an indexing function for a highp value, if both mediump and
+ // highp values are being indexed in the shader. For HLSL precision doesn't matter, but in
+ // principle this code could be used with multiple backends.
+ baseType->setPrecision(EbpHigh);
+ baseType->setQualifier(EvqInOut);
+ if (!write)
+ baseType->setQualifier(EvqIn);
+ return baseType;
+}
+
+// Generate a read or write function for one field in a vector/matrix.
+// Out-of-range indices are clamped. This is consistent with how ANGLE handles out-of-range
+// indices in other places.
+// Note that indices can be either int or uint. We create only int versions of the functions,
+// and convert uint indices to int at the call site.
+// read function example:
+// float dyn_index_vec2(in vec2 base, in int index)
+// {
+// switch(index)
+// {
+// case (0):
+// return base[0];
+// case (1):
+// return base[1];
+// default:
+// break;
+// }
+// if (index < 0)
+// return base[0];
+// return base[1];
+// }
+// write function example:
+// void dyn_index_write_vec2(inout vec2 base, in int index, in float value)
+// {
+// switch(index)
+// {
+// case (0):
+// base[0] = value;
+// return;
+// case (1):
+// base[1] = value;
+// return;
+// default:
+// break;
+// }
+// if (index < 0)
+// {
+// base[0] = value;
+// return;
+// }
+// base[1] = value;
+// }
+// Note that else is not used in above functions to avoid the RewriteElseBlocks transformation.
+TIntermFunctionDefinition *GetIndexFunctionDefinition(const TType &type,
+ bool write,
+ const TFunction &func,
+ TSymbolTable *symbolTable)
+{
+ ASSERT(!type.isArray());
+
+ int numCases = 0;
+ if (type.isMatrix())
+ {
+ numCases = type.getCols();
+ }
+ else
+ {
+ numCases = type.getNominalSize();
+ }
+
+ std::string functionName = GetIndexFunctionName(type, write);
+ TIntermFunctionPrototype *prototypeNode = CreateInternalFunctionPrototypeNode(func);
+
+ TIntermSymbol *baseParam = new TIntermSymbol(func.getParam(0));
+ TIntermSymbol *indexParam = new TIntermSymbol(func.getParam(1));
+ TIntermSymbol *valueParam = nullptr;
+ if (write)
+ {
+ valueParam = new TIntermSymbol(func.getParam(2));
+ }
+
+ TIntermBlock *statementList = new TIntermBlock();
+ for (int i = 0; i < numCases; ++i)
+ {
+ TIntermCase *caseNode = new TIntermCase(CreateIntConstantNode(i));
+ statementList->getSequence()->push_back(caseNode);
+
+ TIntermBinary *indexNode =
+ new TIntermBinary(EOpIndexDirect, baseParam->deepCopy(), CreateIndexNode(i));
+ if (write)
+ {
+ TIntermBinary *assignNode =
+ new TIntermBinary(EOpAssign, indexNode, valueParam->deepCopy());
+ statementList->getSequence()->push_back(assignNode);
+ TIntermBranch *returnNode = new TIntermBranch(EOpReturn, nullptr);
+ statementList->getSequence()->push_back(returnNode);
+ }
+ else
+ {
+ TIntermBranch *returnNode = new TIntermBranch(EOpReturn, indexNode);
+ statementList->getSequence()->push_back(returnNode);
+ }
+ }
+
+ // Default case
+ TIntermCase *defaultNode = new TIntermCase(nullptr);
+ statementList->getSequence()->push_back(defaultNode);
+ TIntermBranch *breakNode = new TIntermBranch(EOpBreak, nullptr);
+ statementList->getSequence()->push_back(breakNode);
+
+ TIntermSwitch *switchNode = new TIntermSwitch(indexParam->deepCopy(), statementList);
+
+ TIntermBlock *bodyNode = new TIntermBlock();
+ bodyNode->getSequence()->push_back(switchNode);
+
+ TIntermBinary *cond =
+ new TIntermBinary(EOpLessThan, indexParam->deepCopy(), CreateIntConstantNode(0));
+
+ // Two blocks: one accesses (either reads or writes) the first element and returns,
+ // the other accesses the last element.
+ TIntermBlock *useFirstBlock = new TIntermBlock();
+ TIntermBlock *useLastBlock = new TIntermBlock();
+ TIntermBinary *indexFirstNode =
+ new TIntermBinary(EOpIndexDirect, baseParam->deepCopy(), CreateIndexNode(0));
+ TIntermBinary *indexLastNode =
+ new TIntermBinary(EOpIndexDirect, baseParam->deepCopy(), CreateIndexNode(numCases - 1));
+ if (write)
+ {
+ TIntermBinary *assignFirstNode =
+ new TIntermBinary(EOpAssign, indexFirstNode, valueParam->deepCopy());
+ useFirstBlock->getSequence()->push_back(assignFirstNode);
+ TIntermBranch *returnNode = new TIntermBranch(EOpReturn, nullptr);
+ useFirstBlock->getSequence()->push_back(returnNode);
+
+ TIntermBinary *assignLastNode =
+ new TIntermBinary(EOpAssign, indexLastNode, valueParam->deepCopy());
+ useLastBlock->getSequence()->push_back(assignLastNode);
+ }
+ else
+ {
+ TIntermBranch *returnFirstNode = new TIntermBranch(EOpReturn, indexFirstNode);
+ useFirstBlock->getSequence()->push_back(returnFirstNode);
+
+ TIntermBranch *returnLastNode = new TIntermBranch(EOpReturn, indexLastNode);
+ useLastBlock->getSequence()->push_back(returnLastNode);
+ }
+ TIntermIfElse *ifNode = new TIntermIfElse(cond, useFirstBlock, nullptr);
+ bodyNode->getSequence()->push_back(ifNode);
+ bodyNode->getSequence()->push_back(useLastBlock);
+
+ TIntermFunctionDefinition *indexingFunction =
+ new TIntermFunctionDefinition(prototypeNode, bodyNode);
+ return indexingFunction;
+}
+
+class RemoveDynamicIndexingTraverser : public TLValueTrackingTraverser
+{
+ public:
+ RemoveDynamicIndexingTraverser(TSymbolTable *symbolTable,
+ PerformanceDiagnostics *perfDiagnostics);
+
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+
+ void insertHelperDefinitions(TIntermNode *root);
+
+ void nextIteration();
+
+ bool usedTreeInsertion() const { return mUsedTreeInsertion; }
+
+ protected:
+ // Maps of types that are indexed to the indexing function ids used for them. Note that these
+ // can not store multiple variants of the same type with different precisions - only one
+ // precision gets stored.
+ std::map<TType, TFunction *> mIndexedVecAndMatrixTypes;
+ std::map<TType, TFunction *> mWrittenVecAndMatrixTypes;
+
+ bool mUsedTreeInsertion;
+
+ // When true, the traverser will remove side effects from any indexing expression.
+ // This is done so that in code like
+ // V[j++][i]++.
+ // where V is an array of vectors, j++ will only be evaluated once.
+ bool mRemoveIndexSideEffectsInSubtree;
+
+ PerformanceDiagnostics *mPerfDiagnostics;
+};
+
+RemoveDynamicIndexingTraverser::RemoveDynamicIndexingTraverser(
+ TSymbolTable *symbolTable,
+ PerformanceDiagnostics *perfDiagnostics)
+ : TLValueTrackingTraverser(true, false, false, symbolTable),
+ mUsedTreeInsertion(false),
+ mRemoveIndexSideEffectsInSubtree(false),
+ mPerfDiagnostics(perfDiagnostics)
+{}
+
+void RemoveDynamicIndexingTraverser::insertHelperDefinitions(TIntermNode *root)
+{
+ TIntermBlock *rootBlock = root->getAsBlock();
+ ASSERT(rootBlock != nullptr);
+ TIntermSequence insertions;
+ for (auto &type : mIndexedVecAndMatrixTypes)
+ {
+ insertions.push_back(
+ GetIndexFunctionDefinition(type.first, false, *type.second, mSymbolTable));
+ }
+ for (auto &type : mWrittenVecAndMatrixTypes)
+ {
+ insertions.push_back(
+ GetIndexFunctionDefinition(type.first, true, *type.second, mSymbolTable));
+ }
+ rootBlock->insertChildNodes(0, insertions);
+}
+
+// Create a call to dyn_index_*() based on an indirect indexing op node
+TIntermAggregate *CreateIndexFunctionCall(TIntermBinary *node,
+ TIntermTyped *index,
+ TFunction *indexingFunction)
+{
+ ASSERT(node->getOp() == EOpIndexIndirect);
+ TIntermSequence *arguments = new TIntermSequence();
+ arguments->push_back(node->getLeft());
+ arguments->push_back(index);
+
+ TIntermAggregate *indexingCall =
+ TIntermAggregate::CreateFunctionCall(*indexingFunction, arguments);
+ indexingCall->setLine(node->getLine());
+ return indexingCall;
+}
+
+TIntermAggregate *CreateIndexedWriteFunctionCall(TIntermBinary *node,
+ TVariable *index,
+ TVariable *writtenValue,
+ TFunction *indexedWriteFunction)
+{
+ ASSERT(node->getOp() == EOpIndexIndirect);
+ TIntermSequence *arguments = new TIntermSequence();
+ // Deep copy the child nodes so that two pointers to the same node don't end up in the tree.
+ arguments->push_back(node->getLeft()->deepCopy());
+ arguments->push_back(CreateTempSymbolNode(index));
+ arguments->push_back(CreateTempSymbolNode(writtenValue));
+
+ TIntermAggregate *indexedWriteCall =
+ TIntermAggregate::CreateFunctionCall(*indexedWriteFunction, arguments);
+ indexedWriteCall->setLine(node->getLine());
+ return indexedWriteCall;
+}
+
+bool RemoveDynamicIndexingTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ if (mUsedTreeInsertion)
+ return false;
+
+ if (node->getOp() == EOpIndexIndirect)
+ {
+ if (mRemoveIndexSideEffectsInSubtree)
+ {
+ ASSERT(node->getRight()->hasSideEffects());
+ // In case we're just removing index side effects, convert
+ // v_expr[index_expr]
+ // to this:
+ // int s0 = index_expr; v_expr[s0];
+ // Now v_expr[s0] can be safely executed several times without unintended side effects.
+ TIntermDeclaration *indexVariableDeclaration = nullptr;
+ TVariable *indexVariable = DeclareTempVariable(mSymbolTable, node->getRight(),
+ EvqTemporary, &indexVariableDeclaration);
+ insertStatementInParentBlock(indexVariableDeclaration);
+ mUsedTreeInsertion = true;
+
+ // Replace the index with the temp variable
+ TIntermSymbol *tempIndex = CreateTempSymbolNode(indexVariable);
+ queueReplacementWithParent(node, node->getRight(), tempIndex, OriginalNode::IS_DROPPED);
+ }
+ else if (IntermNodePatternMatcher::IsDynamicIndexingOfNonSSBOVectorOrMatrix(node))
+ {
+ mPerfDiagnostics->warning(node->getLine(),
+ "Performance: dynamic indexing of vectors and "
+ "matrices is emulated and can be slow.",
+ "[]");
+ bool write = isLValueRequiredHere();
+
+#if defined(ANGLE_ENABLE_ASSERTS)
+ // Make sure that IntermNodePatternMatcher is consistent with the slightly differently
+ // implemented checks in this traverser.
+ IntermNodePatternMatcher matcher(
+ IntermNodePatternMatcher::kDynamicIndexingOfVectorOrMatrixInLValue);
+ ASSERT(matcher.match(node, getParentNode(), isLValueRequiredHere()) == write);
+#endif
+
+ const TType &type = node->getLeft()->getType();
+ ImmutableString indexingFunctionName(GetIndexFunctionName(type, false));
+ TFunction *indexingFunction = nullptr;
+ if (mIndexedVecAndMatrixTypes.find(type) == mIndexedVecAndMatrixTypes.end())
+ {
+ indexingFunction =
+ new TFunction(mSymbolTable, indexingFunctionName, SymbolType::AngleInternal,
+ GetFieldType(type), true);
+ indexingFunction->addParameter(new TVariable(
+ mSymbolTable, kBaseName, GetBaseType(type, false), SymbolType::AngleInternal));
+ indexingFunction->addParameter(
+ new TVariable(mSymbolTable, kIndexName, kIndexType, SymbolType::AngleInternal));
+ mIndexedVecAndMatrixTypes[type] = indexingFunction;
+ }
+ else
+ {
+ indexingFunction = mIndexedVecAndMatrixTypes[type];
+ }
+
+ if (write)
+ {
+ // Convert:
+ // v_expr[index_expr]++;
+ // to this:
+ // int s0 = index_expr; float s1 = dyn_index(v_expr, s0); s1++;
+ // dyn_index_write(v_expr, s0, s1);
+ // This works even if index_expr has some side effects.
+ if (node->getLeft()->hasSideEffects())
+ {
+ // If v_expr has side effects, those need to be removed before proceeding.
+ // Otherwise the side effects of v_expr would be evaluated twice.
+ // The only case where an l-value can have side effects is when it is
+ // indexing. For example, it can be V[j++] where V is an array of vectors.
+ mRemoveIndexSideEffectsInSubtree = true;
+ return true;
+ }
+
+ TIntermBinary *leftBinary = node->getLeft()->getAsBinaryNode();
+ if (leftBinary != nullptr &&
+ IntermNodePatternMatcher::IsDynamicIndexingOfNonSSBOVectorOrMatrix(leftBinary))
+ {
+ // This is a case like:
+ // mat2 m;
+ // m[a][b]++;
+ // Process the child node m[a] first.
+ return true;
+ }
+
+ // TODO(oetuaho@nvidia.com): This is not optimal if the expression using the value
+ // only writes it and doesn't need the previous value. http://anglebug.com/1116
+
+ TFunction *indexedWriteFunction = nullptr;
+ if (mWrittenVecAndMatrixTypes.find(type) == mWrittenVecAndMatrixTypes.end())
+ {
+ ImmutableString functionName(
+ GetIndexFunctionName(node->getLeft()->getType(), true));
+ indexedWriteFunction =
+ new TFunction(mSymbolTable, functionName, SymbolType::AngleInternal,
+ StaticType::GetBasic<EbtVoid>(), false);
+ indexedWriteFunction->addParameter(new TVariable(mSymbolTable, kBaseName,
+ GetBaseType(type, true),
+ SymbolType::AngleInternal));
+ indexedWriteFunction->addParameter(new TVariable(
+ mSymbolTable, kIndexName, kIndexType, SymbolType::AngleInternal));
+ TType *valueType = GetFieldType(type);
+ valueType->setQualifier(EvqIn);
+ indexedWriteFunction->addParameter(new TVariable(
+ mSymbolTable, kValueName, static_cast<const TType *>(valueType),
+ SymbolType::AngleInternal));
+ mWrittenVecAndMatrixTypes[type] = indexedWriteFunction;
+ }
+ else
+ {
+ indexedWriteFunction = mWrittenVecAndMatrixTypes[type];
+ }
+
+ TIntermSequence insertionsBefore;
+ TIntermSequence insertionsAfter;
+
+ // Store the index in a temporary signed int variable.
+ // s0 = index_expr;
+ TIntermTyped *indexInitializer = EnsureSignedInt(node->getRight());
+ TIntermDeclaration *indexVariableDeclaration = nullptr;
+ TVariable *indexVariable = DeclareTempVariable(
+ mSymbolTable, indexInitializer, EvqTemporary, &indexVariableDeclaration);
+ insertionsBefore.push_back(indexVariableDeclaration);
+
+ // s1 = dyn_index(v_expr, s0);
+ TIntermAggregate *indexingCall = CreateIndexFunctionCall(
+ node, CreateTempSymbolNode(indexVariable), indexingFunction);
+ TIntermDeclaration *fieldVariableDeclaration = nullptr;
+ TVariable *fieldVariable = DeclareTempVariable(
+ mSymbolTable, indexingCall, EvqTemporary, &fieldVariableDeclaration);
+ insertionsBefore.push_back(fieldVariableDeclaration);
+
+ // dyn_index_write(v_expr, s0, s1);
+ TIntermAggregate *indexedWriteCall = CreateIndexedWriteFunctionCall(
+ node, indexVariable, fieldVariable, indexedWriteFunction);
+ insertionsAfter.push_back(indexedWriteCall);
+ insertStatementsInParentBlock(insertionsBefore, insertionsAfter);
+
+ // replace the node with s1
+ queueReplacement(CreateTempSymbolNode(fieldVariable), OriginalNode::IS_DROPPED);
+ mUsedTreeInsertion = true;
+ }
+ else
+ {
+ // The indexed value is not being written, so we can simply convert
+ // v_expr[index_expr]
+ // into
+ // dyn_index(v_expr, index_expr)
+ // If the index_expr is unsigned, we'll convert it to signed.
+ ASSERT(!mRemoveIndexSideEffectsInSubtree);
+ TIntermAggregate *indexingCall = CreateIndexFunctionCall(
+ node, EnsureSignedInt(node->getRight()), indexingFunction);
+ queueReplacement(indexingCall, OriginalNode::IS_DROPPED);
+ }
+ }
+ }
+ return !mUsedTreeInsertion;
+}
+
+void RemoveDynamicIndexingTraverser::nextIteration()
+{
+ mUsedTreeInsertion = false;
+ mRemoveIndexSideEffectsInSubtree = false;
+}
+
+} // namespace
+
+void RemoveDynamicIndexing(TIntermNode *root,
+ TSymbolTable *symbolTable,
+ PerformanceDiagnostics *perfDiagnostics)
+{
+ RemoveDynamicIndexingTraverser traverser(symbolTable, perfDiagnostics);
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ traverser.updateTree();
+ } while (traverser.usedTreeInsertion());
+ // TODO(oetuaho@nvidia.com): It might be nicer to add the helper definitions also in the middle
+ // of traversal. Now the tree ends up in an inconsistent state in the middle, since there are
+ // function call nodes with no corresponding definition nodes. This needs special handling in
+ // TIntermLValueTrackingTraverser, and creates intricacies that are not easily apparent from a
+ // superficial reading of the code.
+ traverser.insertHelperDefinitions(root);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.h
new file mode 100644
index 0000000000..500c88ed12
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.h
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveDynamicIndexing is an AST traverser to remove dynamic indexing of non-SSBO vectors and
+// matrices, replacing them with calls to functions that choose which component to return or write.
+// We don't need to consider dynamic indexing in SSBO since it can be directly as part of the offset
+// of RWByteAddressBuffer.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEDYNAMICINDEXING_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REMOVEDYNAMICINDEXING_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TSymbolTable;
+class PerformanceDiagnostics;
+
+void RemoveDynamicIndexing(TIntermNode *root,
+ TSymbolTable *symbolTable,
+ PerformanceDiagnostics *perfDiagnostics);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEDYNAMICINDEXING_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp
new file mode 100644
index 0000000000..e40fe95929
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp
@@ -0,0 +1,43 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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/tree_ops/RemoveInvariantDeclaration.h"
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// An AST traverser that removes invariant declaration for input in fragment shader
+// when GLSL >= 4.20 and for output in vertex shader when GLSL < 4.2.
+class RemoveInvariantDeclarationTraverser : public TIntermTraverser
+{
+ public:
+ RemoveInvariantDeclarationTraverser() : TIntermTraverser(true, false, false) {}
+
+ private:
+ bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override
+ {
+ TIntermSequence emptyReplacement;
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(), node, emptyReplacement));
+ return false;
+ }
+};
+
+} // anonymous namespace
+
+void RemoveInvariantDeclaration(TIntermNode *root)
+{
+ RemoveInvariantDeclarationTraverser traverser;
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.h
new file mode 100644
index 0000000000..3281014ad0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.h
@@ -0,0 +1,18 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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_TREEOPS_REMOVEINVARIANTDECLARATION_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REMOVEINVARIANTDECLARATION_H_
+
+class TIntermNode;
+namespace sh
+{
+
+void RemoveInvariantDeclaration(TIntermNode *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEINVARIANTDECLARATION_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.cpp
new file mode 100644
index 0000000000..c270ff0f4a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.cpp
@@ -0,0 +1,101 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemovePow is an AST traverser to convert pow(x, y) built-in calls where y is a
+// constant to exp2(y * log2(x)). This works around an issue in NVIDIA 311 series
+// OpenGL drivers.
+//
+
+#include "compiler/translator/tree_ops/RemovePow.h"
+
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+bool IsProblematicPow(TIntermTyped *node)
+{
+ TIntermAggregate *agg = node->getAsAggregate();
+ if (agg != nullptr && agg->getOp() == EOpPow)
+ {
+ ASSERT(agg->getSequence()->size() == 2);
+ return agg->getSequence()->at(1)->getAsConstantUnion() != nullptr;
+ }
+ return false;
+}
+
+// Traverser that converts all pow operations simultaneously.
+class RemovePowTraverser : public TIntermTraverser
+{
+ public:
+ RemovePowTraverser(TSymbolTable *symbolTable);
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+
+ void nextIteration() { mNeedAnotherIteration = false; }
+ bool needAnotherIteration() const { return mNeedAnotherIteration; }
+
+ protected:
+ bool mNeedAnotherIteration;
+};
+
+RemovePowTraverser::RemovePowTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable), mNeedAnotherIteration(false)
+{}
+
+bool RemovePowTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (IsProblematicPow(node))
+ {
+ TIntermTyped *x = node->getSequence()->at(0)->getAsTyped();
+ TIntermTyped *y = node->getSequence()->at(1)->getAsTyped();
+
+ TIntermSequence *logArgs = new TIntermSequence();
+ logArgs->push_back(x);
+ TIntermTyped *log = CreateBuiltInFunctionCallNode("log2", logArgs, *mSymbolTable, 100);
+ log->setLine(node->getLine());
+
+ TOperator op = TIntermBinary::GetMulOpBasedOnOperands(y->getType(), log->getType());
+ TIntermBinary *mul = new TIntermBinary(op, y, log);
+ mul->setLine(node->getLine());
+
+ TIntermSequence *expArgs = new TIntermSequence();
+ expArgs->push_back(mul);
+ TIntermTyped *exp = CreateBuiltInFunctionCallNode("exp2", expArgs, *mSymbolTable, 100);
+ exp->setLine(node->getLine());
+
+ queueReplacement(exp, OriginalNode::IS_DROPPED);
+
+ // If the x parameter also needs to be replaced, we need to do that in another traversal,
+ // since it's parent node will change in a way that's not handled correctly by updateTree().
+ if (IsProblematicPow(x))
+ {
+ mNeedAnotherIteration = true;
+ return false;
+ }
+ }
+ return true;
+}
+
+} // namespace
+
+void RemovePow(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ RemovePowTraverser traverser(symbolTable);
+ // Iterate as necessary, and reset the traverser between iterations.
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ traverser.updateTree();
+ } while (traverser.needAnotherIteration());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.h
new file mode 100644
index 0000000000..bb0e990656
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemovePow is an AST traverser to convert pow(x, y) built-in calls where y is a
+// constant to exp2(y * log2(x)). This works around an issue in NVIDIA 311 series
+// OpenGL drivers.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEPOW_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REMOVEPOW_H_
+
+namespace sh
+{
+class TIntermNode;
+class TSymbolTable;
+
+void RemovePow(TIntermNode *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEPOW_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp
new file mode 100644
index 0000000000..9af46770f8
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp
@@ -0,0 +1,270 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveSwitchFallThrough.cpp: Remove fall-through from switch statements.
+// Note that it is unsafe to do further AST transformations on the AST generated
+// by this function. It leaves duplicate nodes in the AST making replacements
+// unreliable.
+
+#include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h"
+
+#include "compiler/translator/Diagnostics.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class RemoveSwitchFallThroughTraverser : public TIntermTraverser
+{
+ public:
+ static TIntermBlock *removeFallThrough(TIntermBlock *statementList,
+ PerformanceDiagnostics *perfDiagnostics);
+
+ private:
+ RemoveSwitchFallThroughTraverser(TIntermBlock *statementList,
+ PerformanceDiagnostics *perfDiagnostics);
+
+ void visitSymbol(TIntermSymbol *node) override;
+ void visitConstantUnion(TIntermConstantUnion *node) override;
+ bool visitDeclaration(Visit, TIntermDeclaration *node) override;
+ bool visitBinary(Visit, TIntermBinary *node) override;
+ bool visitUnary(Visit, TIntermUnary *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
+ bool visitSwizzle(Visit, TIntermSwizzle *node) override;
+ bool visitIfElse(Visit visit, TIntermIfElse *node) override;
+ bool visitSwitch(Visit, TIntermSwitch *node) override;
+ bool visitCase(Visit, TIntermCase *node) override;
+ bool visitAggregate(Visit, TIntermAggregate *node) override;
+ bool visitBlock(Visit, TIntermBlock *node) override;
+ bool visitLoop(Visit, TIntermLoop *node) override;
+ bool visitBranch(Visit, TIntermBranch *node) override;
+
+ void outputSequence(TIntermSequence *sequence, size_t startIndex);
+ void handlePreviousCase();
+
+ TIntermBlock *mStatementList;
+ TIntermBlock *mStatementListOut;
+ bool mLastStatementWasBreak;
+ TIntermBlock *mPreviousCase;
+ std::vector<TIntermBlock *> mCasesSharingBreak;
+ PerformanceDiagnostics *mPerfDiagnostics;
+};
+
+TIntermBlock *RemoveSwitchFallThroughTraverser::removeFallThrough(
+ TIntermBlock *statementList,
+ PerformanceDiagnostics *perfDiagnostics)
+{
+ RemoveSwitchFallThroughTraverser rm(statementList, perfDiagnostics);
+ ASSERT(statementList);
+ statementList->traverse(&rm);
+ ASSERT(rm.mPreviousCase || statementList->getSequence()->empty());
+ if (!rm.mLastStatementWasBreak && rm.mPreviousCase)
+ {
+ // Make sure that there's a branch at the end of the final case inside the switch statement.
+ // This also ensures that any cases that fall through to the final case will get the break.
+ TIntermBranch *finalBreak = new TIntermBranch(EOpBreak, nullptr);
+ rm.mPreviousCase->getSequence()->push_back(finalBreak);
+ rm.mLastStatementWasBreak = true;
+ }
+ rm.handlePreviousCase();
+ return rm.mStatementListOut;
+}
+
+RemoveSwitchFallThroughTraverser::RemoveSwitchFallThroughTraverser(
+ TIntermBlock *statementList,
+ PerformanceDiagnostics *perfDiagnostics)
+ : TIntermTraverser(true, false, false),
+ mStatementList(statementList),
+ mLastStatementWasBreak(false),
+ mPreviousCase(nullptr),
+ mPerfDiagnostics(perfDiagnostics)
+{
+ mStatementListOut = new TIntermBlock();
+}
+
+void RemoveSwitchFallThroughTraverser::visitSymbol(TIntermSymbol *node)
+{
+ // Note that this assumes that switch statements which don't begin by a case statement
+ // have already been weeded out in validation.
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+}
+
+void RemoveSwitchFallThroughTraverser::visitConstantUnion(TIntermConstantUnion *node)
+{
+ // Conditions of case labels are not traversed, so this is a constant statement like "0;".
+ // These are no-ops so there's no need to add them back to the statement list. Should have
+ // already been pruned out of the AST, in fact.
+ UNREACHABLE();
+}
+
+bool RemoveSwitchFallThroughTraverser::visitDeclaration(Visit, TIntermDeclaration *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitBinary(Visit, TIntermBinary *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitUnary(Visit, TIntermUnary *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitTernary(Visit, TIntermTernary *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitSwizzle(Visit, TIntermSwizzle *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitIfElse(Visit, TIntermIfElse *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitSwitch(Visit, TIntermSwitch *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ // Don't go into nested switch statements
+ return false;
+}
+
+void RemoveSwitchFallThroughTraverser::outputSequence(TIntermSequence *sequence, size_t startIndex)
+{
+ for (size_t i = startIndex; i < sequence->size(); ++i)
+ {
+ mStatementListOut->getSequence()->push_back(sequence->at(i));
+ }
+}
+
+void RemoveSwitchFallThroughTraverser::handlePreviousCase()
+{
+ if (mPreviousCase)
+ mCasesSharingBreak.push_back(mPreviousCase);
+ if (mLastStatementWasBreak)
+ {
+ for (size_t i = 0; i < mCasesSharingBreak.size(); ++i)
+ {
+ ASSERT(!mCasesSharingBreak.at(i)->getSequence()->empty());
+ if (mCasesSharingBreak.at(i)->getSequence()->size() == 1)
+ {
+ // Fall-through is allowed in case the label has no statements.
+ outputSequence(mCasesSharingBreak.at(i)->getSequence(), 0);
+ }
+ else
+ {
+ // Include all the statements that this case can fall through under the same label.
+ if (mCasesSharingBreak.size() > i + 1u)
+ {
+ mPerfDiagnostics->warning(mCasesSharingBreak.at(i)->getLine(),
+ "Performance: non-empty fall-through cases in "
+ "switch statements generate extra code.",
+ "switch");
+ }
+ for (size_t j = i; j < mCasesSharingBreak.size(); ++j)
+ {
+ size_t startIndex =
+ j > i ? 1 : 0; // Add the label only from the first sequence.
+ outputSequence(mCasesSharingBreak.at(j)->getSequence(), startIndex);
+ }
+ }
+ }
+ mCasesSharingBreak.clear();
+ }
+ mLastStatementWasBreak = false;
+ mPreviousCase = nullptr;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitCase(Visit, TIntermCase *node)
+{
+ handlePreviousCase();
+ mPreviousCase = new TIntermBlock();
+ mPreviousCase->getSequence()->push_back(node);
+ mPreviousCase->setLine(node->getLine());
+ // Don't traverse the condition of the case statement
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitAggregate(Visit, TIntermAggregate *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool DoesBlockAlwaysBreak(TIntermBlock *node)
+{
+ if (node->getSequence()->empty())
+ {
+ return false;
+ }
+
+ TIntermBlock *lastStatementAsBlock = node->getSequence()->back()->getAsBlock();
+ if (lastStatementAsBlock)
+ {
+ return DoesBlockAlwaysBreak(lastStatementAsBlock);
+ }
+
+ TIntermBranch *lastStatementAsBranch = node->getSequence()->back()->getAsBranchNode();
+ return lastStatementAsBranch != nullptr;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitBlock(Visit, TIntermBlock *node)
+{
+ if (node != mStatementList)
+ {
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = DoesBlockAlwaysBreak(node);
+ return false;
+ }
+ return true;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitLoop(Visit, TIntermLoop *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ mLastStatementWasBreak = false;
+ return false;
+}
+
+bool RemoveSwitchFallThroughTraverser::visitBranch(Visit, TIntermBranch *node)
+{
+ mPreviousCase->getSequence()->push_back(node);
+ // TODO: Verify that accepting return or continue statements here doesn't cause problems.
+ mLastStatementWasBreak = true;
+ return false;
+}
+
+} // anonymous namespace
+
+TIntermBlock *RemoveSwitchFallThrough(TIntermBlock *statementList,
+ PerformanceDiagnostics *perfDiagnostics)
+{
+ return RemoveSwitchFallThroughTraverser::removeFallThrough(statementList, perfDiagnostics);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.h
new file mode 100644
index 0000000000..58cad0c856
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.h
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveSwitchFallThrough.h: Remove fall-through from switch statements.
+// Note that it is unsafe to do further AST transformations on the AST generated
+// by this function. It leaves duplicate nodes in the AST making replacements
+// unreliable.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class PerformanceDiagnostics;
+
+// When given a statementList from a switch AST node, return an updated
+// statementList that has fall-through removed.
+TIntermBlock *RemoveSwitchFallThrough(TIntermBlock *statementList,
+ PerformanceDiagnostics *perfDiagnostics);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp
new file mode 100644
index 0000000000..28471a309d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp
@@ -0,0 +1,371 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveUnreferencedVariables.cpp:
+// Drop variables that are declared but never referenced in the AST. This avoids adding unnecessary
+// initialization code for them. Also removes unreferenced struct types.
+//
+
+#include "compiler/translator/tree_ops/RemoveUnreferencedVariables.h"
+
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class CollectVariableRefCountsTraverser : public TIntermTraverser
+{
+ public:
+ CollectVariableRefCountsTraverser();
+
+ using RefCountMap = std::unordered_map<int, unsigned int>;
+ RefCountMap &getSymbolIdRefCounts() { return mSymbolIdRefCounts; }
+ RefCountMap &getStructIdRefCounts() { return mStructIdRefCounts; }
+
+ void visitSymbol(TIntermSymbol *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override;
+
+ private:
+ void incrementStructTypeRefCount(const TType &type);
+
+ RefCountMap mSymbolIdRefCounts;
+
+ // Structure reference counts are counted from symbols, constructors, function calls, function
+ // return values and from interface block and structure fields. We need to track both function
+ // calls and function return values since there's a compiler option not to prune unused
+ // functions. The type of a constant union may also be a struct, but statements that are just a
+ // constant union are always pruned, and if the constant union is used somehow it will get
+ // counted by something else.
+ RefCountMap mStructIdRefCounts;
+};
+
+CollectVariableRefCountsTraverser::CollectVariableRefCountsTraverser()
+ : TIntermTraverser(true, false, false)
+{}
+
+void CollectVariableRefCountsTraverser::incrementStructTypeRefCount(const TType &type)
+{
+ if (type.isInterfaceBlock())
+ {
+ const auto *block = type.getInterfaceBlock();
+ ASSERT(block);
+
+ // We can end up incrementing ref counts of struct types referenced from an interface block
+ // multiple times for the same block. This doesn't matter, because interface blocks can't be
+ // pruned so we'll never do the reverse operation.
+ for (const auto &field : block->fields())
+ {
+ ASSERT(!field->type()->isInterfaceBlock());
+ incrementStructTypeRefCount(*field->type());
+ }
+ return;
+ }
+
+ const auto *structure = type.getStruct();
+ if (structure != nullptr)
+ {
+ auto structIter = mStructIdRefCounts.find(structure->uniqueId().get());
+ if (structIter == mStructIdRefCounts.end())
+ {
+ mStructIdRefCounts[structure->uniqueId().get()] = 1u;
+
+ for (const auto &field : structure->fields())
+ {
+ incrementStructTypeRefCount(*field->type());
+ }
+
+ return;
+ }
+ ++(structIter->second);
+ }
+}
+
+void CollectVariableRefCountsTraverser::visitSymbol(TIntermSymbol *node)
+{
+ incrementStructTypeRefCount(node->getType());
+
+ auto iter = mSymbolIdRefCounts.find(node->uniqueId().get());
+ if (iter == mSymbolIdRefCounts.end())
+ {
+ mSymbolIdRefCounts[node->uniqueId().get()] = 1u;
+ return;
+ }
+ ++(iter->second);
+}
+
+bool CollectVariableRefCountsTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ // This tracks struct references in both function calls and constructors.
+ incrementStructTypeRefCount(node->getType());
+ return true;
+}
+
+void CollectVariableRefCountsTraverser::visitFunctionPrototype(TIntermFunctionPrototype *node)
+{
+ incrementStructTypeRefCount(node->getType());
+ size_t paramCount = node->getFunction()->getParamCount();
+ for (size_t i = 0; i < paramCount; ++i)
+ {
+ incrementStructTypeRefCount(node->getFunction()->getParam(i)->getType());
+ }
+}
+
+// Traverser that removes all unreferenced variables on one traversal.
+class RemoveUnreferencedVariablesTraverser : public TIntermTraverser
+{
+ public:
+ RemoveUnreferencedVariablesTraverser(
+ CollectVariableRefCountsTraverser::RefCountMap *symbolIdRefCounts,
+ CollectVariableRefCountsTraverser::RefCountMap *structIdRefCounts,
+ TSymbolTable *symbolTable);
+
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+ void visitSymbol(TIntermSymbol *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+
+ // Traverse loop and block nodes in reverse order. Note that this traverser does not track
+ // parent block positions, so insertStatementInParentBlock is unusable!
+ void traverseBlock(TIntermBlock *block) override;
+ void traverseLoop(TIntermLoop *loop) override;
+
+ private:
+ void removeVariableDeclaration(TIntermDeclaration *node, TIntermTyped *declarator);
+ void decrementStructTypeRefCount(const TType &type);
+
+ CollectVariableRefCountsTraverser::RefCountMap *mSymbolIdRefCounts;
+ CollectVariableRefCountsTraverser::RefCountMap *mStructIdRefCounts;
+ bool mRemoveReferences;
+};
+
+RemoveUnreferencedVariablesTraverser::RemoveUnreferencedVariablesTraverser(
+ CollectVariableRefCountsTraverser::RefCountMap *symbolIdRefCounts,
+ CollectVariableRefCountsTraverser::RefCountMap *structIdRefCounts,
+ TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, true, symbolTable),
+ mSymbolIdRefCounts(symbolIdRefCounts),
+ mStructIdRefCounts(structIdRefCounts),
+ mRemoveReferences(false)
+{}
+
+void RemoveUnreferencedVariablesTraverser::decrementStructTypeRefCount(const TType &type)
+{
+ auto *structure = type.getStruct();
+ if (structure != nullptr)
+ {
+ ASSERT(mStructIdRefCounts->find(structure->uniqueId().get()) != mStructIdRefCounts->end());
+ unsigned int structRefCount = --(*mStructIdRefCounts)[structure->uniqueId().get()];
+
+ if (structRefCount == 0)
+ {
+ for (const auto &field : structure->fields())
+ {
+ decrementStructTypeRefCount(*field->type());
+ }
+ }
+ }
+}
+
+void RemoveUnreferencedVariablesTraverser::removeVariableDeclaration(TIntermDeclaration *node,
+ TIntermTyped *declarator)
+{
+ if (declarator->getType().isStructSpecifier() && !declarator->getType().isNamelessStruct())
+ {
+ unsigned int structId = declarator->getType().getStruct()->uniqueId().get();
+ unsigned int structRefCountInThisDeclarator = 1u;
+ if (declarator->getAsBinaryNode() &&
+ declarator->getAsBinaryNode()->getRight()->getAsAggregate())
+ {
+ ASSERT(declarator->getAsBinaryNode()->getLeft()->getType().getStruct() ==
+ declarator->getType().getStruct());
+ ASSERT(declarator->getAsBinaryNode()->getRight()->getType().getStruct() ==
+ declarator->getType().getStruct());
+ structRefCountInThisDeclarator = 2u;
+ }
+ if ((*mStructIdRefCounts)[structId] > structRefCountInThisDeclarator)
+ {
+ // If this declaration declares a named struct type that is used elsewhere, we need to
+ // keep it. We can still change the declarator though so that it doesn't declare an
+ // unreferenced variable.
+
+ // Note that since we're not removing the entire declaration, the struct's reference
+ // count will end up being one less than the correct refcount. But since the struct
+ // declaration is kept, the incorrect refcount can't cause any other problems.
+
+ if (declarator->getAsSymbolNode() &&
+ declarator->getAsSymbolNode()->variable().symbolType() == SymbolType::Empty)
+ {
+ // Already an empty declaration - nothing to do.
+ return;
+ }
+ TVariable *emptyVariable =
+ new TVariable(mSymbolTable, kEmptyImmutableString, new TType(declarator->getType()),
+ SymbolType::Empty);
+ queueReplacementWithParent(node, declarator, new TIntermSymbol(emptyVariable),
+ OriginalNode::IS_DROPPED);
+ return;
+ }
+ }
+
+ if (getParentNode()->getAsBlock())
+ {
+ TIntermSequence emptyReplacement;
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(), node, emptyReplacement));
+ }
+ else
+ {
+ ASSERT(getParentNode()->getAsLoopNode());
+ queueReplacement(nullptr, OriginalNode::IS_DROPPED);
+ }
+}
+
+bool RemoveUnreferencedVariablesTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ if (visit == PreVisit)
+ {
+ // SeparateDeclarations should have already been run.
+ ASSERT(node->getSequence()->size() == 1u);
+
+ TIntermTyped *declarator = node->getSequence()->back()->getAsTyped();
+ ASSERT(declarator);
+
+ // We can only remove variables that are not a part of the shader interface.
+ TQualifier qualifier = declarator->getQualifier();
+ if (qualifier != EvqTemporary && qualifier != EvqGlobal && qualifier != EvqConst)
+ {
+ return true;
+ }
+
+ bool canRemoveVariable = false;
+ TIntermSymbol *symbolNode = declarator->getAsSymbolNode();
+ if (symbolNode != nullptr)
+ {
+ canRemoveVariable = (*mSymbolIdRefCounts)[symbolNode->uniqueId().get()] == 1u ||
+ symbolNode->variable().symbolType() == SymbolType::Empty;
+ }
+ TIntermBinary *initNode = declarator->getAsBinaryNode();
+ if (initNode != nullptr)
+ {
+ ASSERT(initNode->getLeft()->getAsSymbolNode());
+ int symbolId = initNode->getLeft()->getAsSymbolNode()->uniqueId().get();
+ canRemoveVariable =
+ (*mSymbolIdRefCounts)[symbolId] == 1u && !initNode->getRight()->hasSideEffects();
+ }
+
+ if (canRemoveVariable)
+ {
+ removeVariableDeclaration(node, declarator);
+ mRemoveReferences = true;
+ }
+ return true;
+ }
+ ASSERT(visit == PostVisit);
+ mRemoveReferences = false;
+ return true;
+}
+
+void RemoveUnreferencedVariablesTraverser::visitSymbol(TIntermSymbol *node)
+{
+ if (mRemoveReferences)
+ {
+ ASSERT(mSymbolIdRefCounts->find(node->uniqueId().get()) != mSymbolIdRefCounts->end());
+ --(*mSymbolIdRefCounts)[node->uniqueId().get()];
+
+ decrementStructTypeRefCount(node->getType());
+ }
+}
+
+bool RemoveUnreferencedVariablesTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (visit == PreVisit && mRemoveReferences)
+ {
+ decrementStructTypeRefCount(node->getType());
+ }
+ return true;
+}
+
+void RemoveUnreferencedVariablesTraverser::traverseBlock(TIntermBlock *node)
+{
+ // We traverse blocks in reverse order. This way reference counts can be decremented when
+ // removing initializers, and variables that become unused when initializers are removed can be
+ // removed on the same traversal.
+
+ ScopedNodeInTraversalPath addToPath(this, node);
+
+ bool visit = true;
+
+ TIntermSequence *sequence = node->getSequence();
+
+ if (preVisit)
+ visit = visitBlock(PreVisit, node);
+
+ if (visit)
+ {
+ for (auto iter = sequence->rbegin(); iter != sequence->rend(); ++iter)
+ {
+ (*iter)->traverse(this);
+ if (visit && inVisit)
+ {
+ if ((iter + 1) != sequence->rend())
+ visit = visitBlock(InVisit, node);
+ }
+ }
+ }
+
+ if (visit && postVisit)
+ visitBlock(PostVisit, node);
+}
+
+void RemoveUnreferencedVariablesTraverser::traverseLoop(TIntermLoop *node)
+{
+ // We traverse loops in reverse order as well. The loop body gets traversed before the init
+ // node.
+
+ ScopedNodeInTraversalPath addToPath(this, node);
+
+ bool visit = true;
+
+ if (preVisit)
+ visit = visitLoop(PreVisit, node);
+
+ if (visit)
+ {
+ // We don't need to traverse loop expressions or conditions since they can't be declarations
+ // in the AST (loops which have a declaration in their condition get transformed in the
+ // parsing stage).
+ ASSERT(node->getExpression() == nullptr ||
+ node->getExpression()->getAsDeclarationNode() == nullptr);
+ ASSERT(node->getCondition() == nullptr ||
+ node->getCondition()->getAsDeclarationNode() == nullptr);
+
+ if (node->getBody())
+ node->getBody()->traverse(this);
+
+ if (node->getInit())
+ node->getInit()->traverse(this);
+ }
+
+ if (visit && postVisit)
+ visitLoop(PostVisit, node);
+}
+
+} // namespace
+
+void RemoveUnreferencedVariables(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ CollectVariableRefCountsTraverser collector;
+ root->traverse(&collector);
+ RemoveUnreferencedVariablesTraverser traverser(&collector.getSymbolIdRefCounts(),
+ &collector.getStructIdRefCounts(), symbolTable);
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h
new file mode 100644
index 0000000000..6888b2f2a0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RemoveUnreferencedVariables.h:
+// Drop variables that are declared but never referenced in the AST. This avoids adding unnecessary
+// initialization code for them. Also removes unreferenced struct types.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEUNREFERENCEDVARIABLES_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REMOVEUNREFERENCEDVARIABLES_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void RemoveUnreferencedVariables(TIntermBlock *root, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEUNREFERENCEDVARIABLES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.cpp
new file mode 100644
index 0000000000..8e76c4862c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.cpp
@@ -0,0 +1,462 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteAtomicCounters: Emulate atomic counter buffers with storage buffers.
+//
+
+#include "compiler/translator/tree_ops/RewriteAtomicCounters.h"
+
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+namespace
+{
+// DeclareAtomicCountersBuffer adds a storage buffer that's used with atomic counters.
+const TVariable *DeclareAtomicCountersBuffer(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ // Define `uint counters[];` as the only field in the interface block.
+ TFieldList *fieldList = new TFieldList;
+ TType *counterType = new TType(EbtUInt);
+ counterType->makeArray(0);
+
+ TField *countersField = new TField(counterType, ImmutableString("counters"), TSourceLoc(),
+ SymbolType::AngleInternal);
+
+ fieldList->push_back(countersField);
+
+ TMemoryQualifier coherentMemory = TMemoryQualifier::Create();
+ coherentMemory.coherent = true;
+
+ // Define a storage block "ANGLEAtomicCounters" with instance name "atomicCounters".
+ return DeclareInterfaceBlock(root, symbolTable, fieldList, EvqBuffer, coherentMemory,
+ "ANGLEAtomicCounters", "atomicCounters");
+}
+
+TIntermBinary *CreateAtomicCounterRef(const TVariable *atomicCounters, TIntermTyped *offset)
+{
+ TIntermSymbol *atomicCountersRef = new TIntermSymbol(atomicCounters);
+ TConstantUnion *firstFieldIndex = new TConstantUnion;
+ firstFieldIndex->setIConst(0);
+ TIntermConstantUnion *firstFieldRef =
+ new TIntermConstantUnion(firstFieldIndex, *StaticType::GetBasic<EbtUInt>());
+ TIntermBinary *firstField =
+ new TIntermBinary(EOpIndexDirectInterfaceBlock, atomicCountersRef, firstFieldRef);
+ return new TIntermBinary(EOpIndexDirect, firstField, offset);
+}
+
+TIntermConstantUnion *CreateUIntConstant(uint32_t value)
+{
+ const TType *constantType = StaticType::GetBasic<EbtUInt, 1>();
+ TConstantUnion *constantValue = new TConstantUnion;
+ constantValue->setUConst(value);
+ return new TIntermConstantUnion(constantValue, *constantType);
+}
+
+// Traverser that:
+//
+// 1. Converts the |atomic_uint| types to |uint|.
+// 2. Substitutes the |uniform atomic_uint| declarations with a global declaration that holds the
+// offset.
+// 3. Substitutes |atomicVar[n]| with |offset + n|.
+class RewriteAtomicCountersTraverser : public TIntermTraverser
+{
+ public:
+ RewriteAtomicCountersTraverser(TSymbolTable *symbolTable, const TVariable *atomicCounters)
+ : TIntermTraverser(true, true, true, symbolTable),
+ mAtomicCounters(atomicCounters),
+ mCurrentAtomicCounterOffset(0),
+ mCurrentAtomicCounterDecl(nullptr),
+ mCurrentAtomicCounterDeclParent(nullptr)
+ {}
+
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override
+ {
+ const TIntermSequence &sequence = *(node->getSequence());
+
+ TIntermTyped *variable = sequence.front()->getAsTyped();
+ const TType &type = variable->getType();
+ bool isAtomicCounter = type.getQualifier() == EvqUniform && type.isAtomicCounter();
+
+ if (visit == PreVisit || visit == InVisit)
+ {
+ if (isAtomicCounter)
+ {
+ // We only support one atomic counter buffer, so the binding should necessarily be
+ // 0.
+ ASSERT(type.getLayoutQualifier().binding == 0);
+
+ mCurrentAtomicCounterDecl = node;
+ mCurrentAtomicCounterDeclParent = getParentNode()->getAsBlock();
+ mCurrentAtomicCounterOffset = type.getLayoutQualifier().offset;
+ }
+ }
+ else if (visit == PostVisit)
+ {
+ mCurrentAtomicCounterDecl = nullptr;
+ mCurrentAtomicCounterDeclParent = nullptr;
+ mCurrentAtomicCounterOffset = 0;
+ }
+ return true;
+ }
+
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override
+ {
+ const TFunction *function = node->getFunction();
+ // Go over the parameters and replace the atomic arguments with a uint type. If this is
+ // the function definition, keep the replaced variable for future encounters.
+ mAtomicCounterFunctionParams.clear();
+ for (size_t paramIndex = 0; paramIndex < function->getParamCount(); ++paramIndex)
+ {
+ const TVariable *param = function->getParam(paramIndex);
+ TVariable *replacement = convertFunctionParameter(node, param);
+ if (replacement)
+ {
+ mAtomicCounterFunctionParams[param] = replacement;
+ }
+ }
+
+ if (mAtomicCounterFunctionParams.empty())
+ {
+ return;
+ }
+
+ // Create a new function prototype and replace this with it.
+ TFunction *replacementFunction = new TFunction(
+ mSymbolTable, function->name(), SymbolType::UserDefined,
+ new TType(function->getReturnType()), function->isKnownToNotHaveSideEffects());
+ for (size_t paramIndex = 0; paramIndex < function->getParamCount(); ++paramIndex)
+ {
+ const TVariable *param = function->getParam(paramIndex);
+ TVariable *replacement = nullptr;
+ if (param->getType().isAtomicCounter())
+ {
+ ASSERT(mAtomicCounterFunctionParams.count(param) != 0);
+ replacement = mAtomicCounterFunctionParams[param];
+ }
+ else
+ {
+ replacement = new TVariable(mSymbolTable, param->name(),
+ new TType(param->getType()), SymbolType::UserDefined);
+ }
+ replacementFunction->addParameter(replacement);
+ }
+
+ TIntermFunctionPrototype *replacementPrototype =
+ new TIntermFunctionPrototype(replacementFunction);
+ queueReplacement(replacementPrototype, OriginalNode::IS_DROPPED);
+
+ mReplacedFunctions[function] = replacementFunction;
+ }
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ if (visit == PreVisit)
+ {
+ mAtomicCounterFunctionCallArgs.clear();
+ }
+
+ if (visit != PostVisit)
+ {
+ return true;
+ }
+
+ if (node->getOp() == EOpCallBuiltInFunction)
+ {
+ convertBuiltinFunction(node);
+ }
+ else if (node->getOp() == EOpCallFunctionInAST)
+ {
+ convertASTFunction(node);
+ }
+
+ return true;
+ }
+
+ void visitSymbol(TIntermSymbol *symbol) override
+ {
+ const TVariable *symbolVariable = &symbol->variable();
+
+ if (mCurrentAtomicCounterDecl)
+ {
+ declareAtomicCounter(symbolVariable);
+ return;
+ }
+
+ if (!symbol->getType().isAtomicCounter())
+ {
+ return;
+ }
+
+ // The symbol is either referencing a global atomic counter, or is a function parameter. In
+ // either case, it could be an array. The are the following possibilities:
+ //
+ // layout(..) uniform atomic_uint ac;
+ // layout(..) uniform atomic_uint acArray[N];
+ //
+ // void func(inout atomic_uint c)
+ // {
+ // otherFunc(c);
+ // }
+ //
+ // void funcArray(inout atomic_uint cArray[N])
+ // {
+ // otherFuncArray(cArray);
+ // otherFunc(cArray[n]);
+ // }
+ //
+ // void funcGlobal()
+ // {
+ // func(ac);
+ // func(acArray[n]);
+ // funcArray(acArray);
+ // atomicIncrement(ac);
+ // atomicIncrement(acArray[n]);
+ // }
+ //
+ // This should translate to:
+ //
+ // buffer ANGLEAtomicCounters
+ // {
+ // uint counters[];
+ // } atomicCounters;
+ //
+ // const uint ac = <offset>;
+ // const uint acArray = <offset>;
+ //
+ // void func(inout uint c)
+ // {
+ // otherFunc(c);
+ // }
+ //
+ // void funcArray(inout uint cArray)
+ // {
+ // otherFuncArray(cArray);
+ // otherFunc(cArray + n);
+ // }
+ //
+ // void funcGlobal()
+ // {
+ // func(ac);
+ // func(acArray+n);
+ // funcArray(acArray);
+ // atomicAdd(atomicCounters.counters[ac]);
+ // atomicAdd(atomicCounters.counters[ac+n]);
+ // }
+ //
+ // In all cases, the argument transformation is stored in |mAtomicCounterFunctionCallArgs|.
+ // In the function call's PostVisit, if it's a builtin, the look up in
+ // |atomicCounters.counters| is done as well as the builtin function change. Otherwise,
+ // the transformed argument is passed on as is.
+ //
+
+ TIntermTyped *offset = nullptr;
+ if (mAtomicCounterOffsets.count(symbolVariable) != 0)
+ {
+ offset = new TIntermSymbol(mAtomicCounterOffsets[symbolVariable]);
+ }
+ else
+ {
+ ASSERT(mAtomicCounterFunctionParams.count(symbolVariable) != 0);
+ offset = new TIntermSymbol(mAtomicCounterFunctionParams[symbolVariable]);
+ }
+
+ TIntermNode *argument = symbol;
+
+ TIntermNode *parent = getParentNode();
+ ASSERT(parent);
+
+ TIntermBinary *arrayExpression = parent->getAsBinaryNode();
+ if (arrayExpression)
+ {
+ ASSERT(arrayExpression->getOp() == EOpIndexDirect ||
+ arrayExpression->getOp() == EOpIndexIndirect);
+
+ offset = new TIntermBinary(EOpAdd, offset, arrayExpression->getRight()->deepCopy());
+ argument = arrayExpression;
+ }
+
+ mAtomicCounterFunctionCallArgs[argument] = offset;
+ }
+
+ private:
+ void declareAtomicCounter(const TVariable *symbolVariable)
+ {
+ // Create a global variable that contains the offset of this atomic counter declaration.
+ TType *uintType = new TType(*StaticType::GetBasic<EbtUInt, 1>());
+ uintType->setQualifier(EvqConst);
+ TVariable *offset =
+ new TVariable(mSymbolTable, symbolVariable->name(), uintType, SymbolType::UserDefined);
+
+ ASSERT(mCurrentAtomicCounterOffset % 4 == 0);
+ TIntermConstantUnion *offsetInitValue = CreateIndexNode(mCurrentAtomicCounterOffset / 4);
+
+ TIntermSymbol *offsetSymbol = new TIntermSymbol(offset);
+ TIntermBinary *offsetInit = new TIntermBinary(EOpInitialize, offsetSymbol, offsetInitValue);
+
+ TIntermDeclaration *offsetDeclaration = new TIntermDeclaration();
+ offsetDeclaration->appendDeclarator(offsetInit);
+
+ // Replace the atomic_uint declaration with the offset declaration.
+ TIntermSequence replacement;
+ replacement.push_back(offsetDeclaration);
+ mMultiReplacements.emplace_back(mCurrentAtomicCounterDeclParent, mCurrentAtomicCounterDecl,
+ replacement);
+
+ // Remember the offset variable.
+ mAtomicCounterOffsets[symbolVariable] = offset;
+ }
+
+ TVariable *convertFunctionParameter(TIntermNode *parent, const TVariable *param)
+ {
+ if (!param->getType().isAtomicCounter())
+ {
+ return nullptr;
+ }
+
+ const TType *newType = StaticType::GetBasic<EbtUInt>();
+
+ TVariable *replacementVar =
+ new TVariable(mSymbolTable, param->name(), newType, SymbolType::UserDefined);
+
+ return replacementVar;
+ }
+
+ void convertBuiltinFunction(TIntermAggregate *node)
+ {
+ // If the function is |memoryBarrierAtomicCounter|, simply replace it with
+ // |memoryBarrierBuffer|.
+ if (node->getFunction()->name() == "memoryBarrierAtomicCounter")
+ {
+ TIntermTyped *substituteCall = CreateBuiltInFunctionCallNode(
+ "memoryBarrierBuffer", new TIntermSequence, *mSymbolTable, 310);
+ queueReplacement(substituteCall, OriginalNode::IS_DROPPED);
+ return;
+ }
+
+ // If it's an |atomicCounter*| function, replace the function with an |atomic*| equivalent.
+ if (!node->getFunction()->isAtomicCounterFunction())
+ {
+ return;
+ }
+
+ const ImmutableString &functionName = node->getFunction()->name();
+ TIntermSequence *arguments = node->getSequence();
+
+ // Note: atomicAdd(0) is used for atomic reads.
+ uint32_t valueChange = 0;
+ constexpr char kAtomicAddFunction[] = "atomicAdd";
+ bool isDecrement = false;
+
+ if (functionName == "atomicCounterIncrement")
+ {
+ valueChange = 1;
+ }
+ else if (functionName == "atomicCounterDecrement")
+ {
+ // uint values are required to wrap around, so 0xFFFFFFFFu is used as -1.
+ valueChange = std::numeric_limits<uint32_t>::max();
+ static_assert(static_cast<uint32_t>(-1) == std::numeric_limits<uint32_t>::max(),
+ "uint32_t max is not -1");
+
+ isDecrement = true;
+ }
+ else
+ {
+ ASSERT(functionName == "atomicCounter");
+ }
+
+ const TIntermNode *param = (*arguments)[0];
+ ASSERT(mAtomicCounterFunctionCallArgs.count(param) != 0);
+
+ TIntermTyped *offset = mAtomicCounterFunctionCallArgs[param];
+
+ TIntermSequence *substituteArguments = new TIntermSequence;
+ substituteArguments->push_back(CreateAtomicCounterRef(mAtomicCounters, offset));
+ substituteArguments->push_back(CreateUIntConstant(valueChange));
+
+ TIntermTyped *substituteCall = CreateBuiltInFunctionCallNode(
+ kAtomicAddFunction, substituteArguments, *mSymbolTable, 310);
+
+ // Note that atomicCounterDecrement returns the *new* value instead of the prior value,
+ // unlike atomicAdd. So we need to do a -1 on the result as well.
+ if (isDecrement)
+ {
+ substituteCall = new TIntermBinary(EOpSub, substituteCall, CreateUIntConstant(1));
+ }
+
+ queueReplacement(substituteCall, OriginalNode::IS_DROPPED);
+ }
+
+ void convertASTFunction(TIntermAggregate *node)
+ {
+ // See if the function needs replacement at all.
+ const TFunction *function = node->getFunction();
+ if (mReplacedFunctions.count(function) == 0)
+ {
+ return;
+ }
+
+ // atomic_uint arguments to this call are staged to be replaced at the same time.
+ TFunction *substituteFunction = mReplacedFunctions[function];
+ TIntermSequence *substituteArguments = new TIntermSequence;
+
+ for (size_t paramIndex = 0; paramIndex < function->getParamCount(); ++paramIndex)
+ {
+ TIntermNode *param = node->getChildNode(paramIndex);
+
+ TIntermNode *replacement = nullptr;
+ if (param->getAsTyped()->getType().isAtomicCounter())
+ {
+ ASSERT(mAtomicCounterFunctionCallArgs.count(param) != 0);
+ replacement = mAtomicCounterFunctionCallArgs[param];
+ }
+ else
+ {
+ replacement = param->getAsTyped()->deepCopy();
+ }
+ substituteArguments->push_back(replacement);
+ }
+
+ TIntermTyped *substituteCall =
+ TIntermAggregate::CreateFunctionCall(*substituteFunction, substituteArguments);
+
+ queueReplacement(substituteCall, OriginalNode::IS_DROPPED);
+ }
+
+ private:
+ const TVariable *mAtomicCounters;
+
+ // A map from the atomic_uint variable to the offset declaration.
+ std::unordered_map<const TVariable *, TVariable *> mAtomicCounterOffsets;
+ // A map from functions with atomic_uint parameters to one where that's replaced with uint.
+ std::unordered_map<const TFunction *, TFunction *> mReplacedFunctions;
+ // A map from atomic_uint function parameters to their replacement uint parameter for the
+ // current function definition.
+ std::unordered_map<const TVariable *, TVariable *> mAtomicCounterFunctionParams;
+ // A map from atomic_uint function call arguments to their replacement for the current
+ // non-builtin function call.
+ std::unordered_map<const TIntermNode *, TIntermTyped *> mAtomicCounterFunctionCallArgs;
+
+ uint32_t mCurrentAtomicCounterOffset;
+ TIntermDeclaration *mCurrentAtomicCounterDecl;
+ TIntermAggregateBase *mCurrentAtomicCounterDeclParent;
+};
+
+} // anonymous namespace
+
+void RewriteAtomicCounters(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ const TVariable *atomicCounters = DeclareAtomicCountersBuffer(root, symbolTable);
+
+ RewriteAtomicCountersTraverser traverser(symbolTable, atomicCounters);
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.h
new file mode 100644
index 0000000000..905b258bd7
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.h
@@ -0,0 +1,21 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteAtomicCounters: Change atomic counter buffers to storage buffers, with atomic counter
+// variables being offsets into the uint array of that storage buffer.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEATOMICCOUNTERS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITEATOMICCOUNTERS_H_
+
+namespace sh
+{
+class TIntermBlock;
+class TSymbolTable;
+class TVariable;
+
+void RewriteAtomicCounters(TIntermBlock *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEATOMICCOUNTERS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.cpp
new file mode 100644
index 0000000000..f47e790b0a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.cpp
@@ -0,0 +1,182 @@
+//
+// Copyright (c) 2018 The ANGLE Project 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 function RewriteAtomicFunctionExpressions.
+// See the header for more details.
+
+#include "RewriteAtomicFunctionExpressions.h"
+
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+namespace
+{
+// Traverser that simplifies all the atomic function expressions into the ones that can be directly
+// translated into HLSL.
+//
+// case 1 (only for atomicExchange and atomicCompSwap):
+// original:
+// atomicExchange(counter, newValue);
+// new:
+// tempValue = atomicExchange(counter, newValue);
+//
+// case 2 (atomic function, temporary variable required):
+// original:
+// value = atomicAdd(counter, 1) * otherValue;
+// someArray[atomicAdd(counter, 1)] = someOtherValue;
+// new:
+// value = ((tempValue = atomicAdd(counter, 1)), tempValue) * otherValue;
+// someArray[((tempValue = atomicAdd(counter, 1)), tempValue)] = someOtherValue;
+//
+// case 3 (atomic function used directly initialize a variable):
+// original:
+// int value = atomicAdd(counter, 1);
+// new:
+// tempValue = atomicAdd(counter, 1);
+// int value = tempValue;
+//
+class RewriteAtomicFunctionExpressionsTraverser : public TIntermTraverser
+{
+ public:
+ RewriteAtomicFunctionExpressionsTraverser(TSymbolTable *symbolTable, int shaderVersion);
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitBlock(Visit visit, TIntermBlock *node) override;
+
+ private:
+ static bool IsAtomicExchangeOrCompSwapNoReturnValue(TIntermAggregate *node,
+ TIntermNode *parentNode);
+ static bool IsAtomicFunctionInsideExpression(TIntermAggregate *node, TIntermNode *parentNode);
+
+ void rewriteAtomicFunctionCallNode(TIntermAggregate *oldAtomicFunctionNode);
+
+ const TVariable *getTempVariable(const TType *type);
+
+ int mShaderVersion;
+ TIntermSequence mTempVariables;
+};
+
+RewriteAtomicFunctionExpressionsTraverser::RewriteAtomicFunctionExpressionsTraverser(
+ TSymbolTable *symbolTable,
+ int shaderVersion)
+ : TIntermTraverser(false, false, true, symbolTable), mShaderVersion(shaderVersion)
+{}
+
+void RewriteAtomicFunctionExpressionsTraverser::rewriteAtomicFunctionCallNode(
+ TIntermAggregate *oldAtomicFunctionNode)
+{
+ ASSERT(oldAtomicFunctionNode);
+
+ const TVariable *returnVariable = getTempVariable(&oldAtomicFunctionNode->getType());
+
+ TIntermBinary *rewrittenNode = new TIntermBinary(
+ TOperator::EOpAssign, CreateTempSymbolNode(returnVariable), oldAtomicFunctionNode);
+
+ auto *parentNode = getParentNode();
+
+ auto *parentBinary = parentNode->getAsBinaryNode();
+ if (parentBinary && parentBinary->getOp() == EOpInitialize)
+ {
+ insertStatementInParentBlock(rewrittenNode);
+ queueReplacement(CreateTempSymbolNode(returnVariable), OriginalNode::IS_DROPPED);
+ }
+ else
+ {
+ // As all atomic function assignment will be converted to the last argument of an
+ // interlocked function, if we need the return value, assignment needs to be wrapped with
+ // the comma operator and the temporary variables.
+ if (!parentNode->getAsBlock())
+ {
+ rewrittenNode = TIntermBinary::CreateComma(
+ rewrittenNode, new TIntermSymbol(returnVariable), mShaderVersion);
+ }
+
+ queueReplacement(rewrittenNode, OriginalNode::IS_DROPPED);
+ }
+}
+
+const TVariable *RewriteAtomicFunctionExpressionsTraverser::getTempVariable(const TType *type)
+{
+ TIntermDeclaration *variableDeclaration;
+ TVariable *returnVariable =
+ DeclareTempVariable(mSymbolTable, type, EvqTemporary, &variableDeclaration);
+ mTempVariables.push_back(variableDeclaration);
+ return returnVariable;
+}
+
+bool RewriteAtomicFunctionExpressionsTraverser::IsAtomicExchangeOrCompSwapNoReturnValue(
+ TIntermAggregate *node,
+ TIntermNode *parentNode)
+{
+ ASSERT(node);
+ return (node->getOp() == EOpAtomicExchange || node->getOp() == EOpAtomicCompSwap) &&
+ parentNode && parentNode->getAsBlock();
+}
+
+bool RewriteAtomicFunctionExpressionsTraverser::IsAtomicFunctionInsideExpression(
+ TIntermAggregate *node,
+ TIntermNode *parentNode)
+{
+ ASSERT(node);
+ // We only need to handle atomic functions with a parent that it is not block nodes. If the
+ // parent node is block, it means that the atomic function is not inside an expression.
+ if (!IsAtomicFunction(node->getOp()) || parentNode->getAsBlock())
+ {
+ return false;
+ }
+
+ auto *parentAsBinary = parentNode->getAsBinaryNode();
+ // Assignments are handled in OutputHLSL
+ return !parentAsBinary || parentAsBinary->getOp() != EOpAssign;
+}
+
+bool RewriteAtomicFunctionExpressionsTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ ASSERT(visit == PostVisit);
+ // Skip atomic memory functions for SSBO. They will be processed in the OutputHLSL traverser.
+ if (IsAtomicFunction(node->getOp()) &&
+ IsInShaderStorageBlock((*node->getSequence())[0]->getAsTyped()))
+ {
+ return false;
+ }
+
+ TIntermNode *parentNode = getParentNode();
+ if (IsAtomicExchangeOrCompSwapNoReturnValue(node, parentNode) ||
+ IsAtomicFunctionInsideExpression(node, parentNode))
+ {
+ rewriteAtomicFunctionCallNode(node);
+ }
+
+ return true;
+}
+
+bool RewriteAtomicFunctionExpressionsTraverser::visitBlock(Visit visit, TIntermBlock *node)
+{
+ ASSERT(visit == PostVisit);
+
+ if (!mTempVariables.empty() && getParentNode()->getAsFunctionDefinition())
+ {
+ insertStatementsInBlockAtPosition(node, 0, mTempVariables, TIntermSequence());
+ mTempVariables.clear();
+ }
+
+ return true;
+}
+
+} // anonymous namespace
+
+void RewriteAtomicFunctionExpressions(TIntermNode *root,
+ TSymbolTable *symbolTable,
+ int shaderVersion)
+{
+ RewriteAtomicFunctionExpressionsTraverser traverser(symbolTable, shaderVersion);
+ traverser.traverse(root);
+ traverser.updateTree();
+}
+} // namespace sh \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.h
new file mode 100644
index 0000000000..a54440536e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteAtomicFunctionExpressions rewrites the expressions that contain
+// atomic function calls and cannot be directly translated into HLSL into
+// several simple ones that can be easily handled in the HLSL translator.
+//
+// We need to rewite these expressions because:
+// 1. All GLSL atomic functions have return values, which all represent the
+// original value of the shared or ssbo variable; while all HLSL atomic
+// functions don't, and the original value can be stored in the last
+// parameter of the function call.
+// 2. For HLSL atomic functions, the last parameter that stores the original
+// value is optional except for InterlockedExchange and
+// InterlockedCompareExchange. Missing original_value in the call of
+// InterlockedExchange or InterlockedCompareExchange results in a compile
+// error from HLSL compiler.
+//
+// RewriteAtomicFunctionExpressions is a function that can modify the AST
+// to ensure all the expressions that contain atomic function calls can be
+// directly translated into HLSL expressions.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_
+
+namespace sh
+{
+class TIntermNode;
+class TSymbolTable;
+
+void RewriteAtomicFunctionExpressions(TIntermNode *root,
+ TSymbolTable *symbolTable,
+ int shaderVersion);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITE_ATOMIC_FUNCTION_EXPRESSIONS_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.cpp
new file mode 100644
index 0000000000..80606e7844
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.cpp
@@ -0,0 +1,89 @@
+//
+// Copyright 2019 The ANGLE Project 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 dFdy viewport transformation.
+// See header for more info.
+
+#include "compiler/translator/tree_ops/RewriteDfdy.h"
+
+#include "common/angleutils.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class Traverser : public TIntermTraverser
+{
+ public:
+ static void Apply(TIntermNode *root,
+ const TSymbolTable &symbolTable,
+ TIntermBinary *viewportYScale);
+
+ private:
+ Traverser(TIntermBinary *viewportYScale, TSymbolTable *symbolTable);
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+
+ TIntermBinary *mViewportYScale = nullptr;
+};
+
+Traverser::Traverser(TIntermBinary *viewportYScale, TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable), mViewportYScale(viewportYScale)
+{}
+
+// static
+void Traverser::Apply(TIntermNode *root,
+ const TSymbolTable &symbolTable,
+ TIntermBinary *viewportYScale)
+{
+ TSymbolTable *pSymbolTable = const_cast<TSymbolTable *>(&symbolTable);
+ Traverser traverser(viewportYScale, pSymbolTable);
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+bool Traverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ // Decide if the node represents a call to dFdy()
+ if (node->getOp() != EOpDFdy)
+ {
+ return true;
+ }
+
+ // Copy the dFdy node so we can replace it with the corrected value
+ TIntermUnary *newDfdy = node->deepCopy()->getAsUnaryNode();
+
+ size_t objectSize = node->getType().getObjectSize();
+ TOperator multiplyOp = (objectSize == 1) ? EOpMul : EOpVectorTimesScalar;
+
+ // Correct dFdy()'s value:
+ // (dFdy() * ANGLEUniforms.viewportYScale)
+ TIntermBinary *correctedDfdy = new TIntermBinary(multiplyOp, newDfdy, mViewportYScale);
+
+ // Replace the old dFdy node with the new node that contains the corrected value
+ queueReplacement(correctedDfdy, OriginalNode::IS_DROPPED);
+
+ return true;
+}
+
+} // anonymous namespace
+
+void RewriteDfdy(TIntermNode *root,
+ const TSymbolTable &symbolTable,
+ int shaderVersion,
+ TIntermBinary *viewportYScale)
+{
+ // dFdy is only valid in GLSL 3.0 and later.
+ if (shaderVersion < 300)
+ return;
+
+ Traverser::Apply(root, symbolTable, viewportYScale);
+}
+
+} // namespace sh \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.h
new file mode 100644
index 0000000000..299d3652f9
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDfdy.h
@@ -0,0 +1,30 @@
+//
+// Copyright 2019 The ANGLE Project 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 mutating tree traversal flips the output of dFdy() to account for framebuffer flipping.
+//
+// From: dFdy(p)
+// To: (dFdy(p) * viewportYScale)
+//
+// See http://anglebug.com/3487
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_FLIP_DFDY_H_
+#define COMPILER_TRANSLATOR_TREEOPS_FLIP_DFDY_H_
+
+class TIntermNode;
+class TIntermBinary;
+class TSymbolTable;
+
+namespace sh
+{
+
+void RewriteDfdy(TIntermNode *root,
+ const TSymbolTable &symbolTable,
+ int shaderVersion,
+ TIntermBinary *viewportYScale);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_FLIP_DFDY_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp
new file mode 100644
index 0000000000..7956322a5a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp
@@ -0,0 +1,144 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RewriteDoWhile.cpp: rewrites do-while loops using another equivalent
+// construct.
+
+#include "compiler/translator/tree_ops/RewriteDoWhile.h"
+
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// An AST traverser that rewrites loops of the form
+// do {
+// CODE;
+// } while (CONDITION)
+//
+// to loops of the form
+// bool temp = false;
+// while (true) {
+// if (temp) {
+// if (!CONDITION) {
+// break;
+// }
+// }
+// temp = true;
+// CODE;
+// }
+//
+// The reason we don't use a simpler form, with for example just (temp && !CONDITION) in the
+// while condition, is that short-circuit is often badly supported by driver shader compiler.
+// The double if has the same effect, but forces shader compilers to behave.
+//
+// TODO(cwallez) when UnfoldShortCircuitIntoIf handles loops correctly, revisit this as we might
+// be able to use while (temp || CONDITION) with temp initially set to true then run
+// UnfoldShortCircuitIntoIf
+class DoWhileRewriter : public TIntermTraverser
+{
+ public:
+ DoWhileRewriter(TSymbolTable *symbolTable) : TIntermTraverser(true, false, false, symbolTable)
+ {}
+
+ bool visitBlock(Visit, TIntermBlock *node) override
+ {
+ // A well-formed AST can only have do-while inside TIntermBlock. By doing a prefix traversal
+ // we are able to replace the do-while in the sequence directly as the content of the
+ // do-while will be traversed later.
+
+ TIntermSequence *statements = node->getSequence();
+
+ // The statements vector will have new statements inserted when we encounter a do-while,
+ // which prevents us from using a range-based for loop. Using the usual i++ works, as
+ // the (two) new statements inserted replace the statement at the current position.
+ for (size_t i = 0; i < statements->size(); i++)
+ {
+ TIntermNode *statement = (*statements)[i];
+ TIntermLoop *loop = statement->getAsLoopNode();
+
+ if (loop == nullptr || loop->getType() != ELoopDoWhile)
+ {
+ continue;
+ }
+
+ // Found a loop to change.
+ const TType *boolType = StaticType::Get<EbtBool, EbpUndefined, EvqTemporary, 1, 1>();
+ TVariable *conditionVariable = CreateTempVariable(mSymbolTable, boolType);
+
+ // bool temp = false;
+ TIntermDeclaration *tempDeclaration =
+ CreateTempInitDeclarationNode(conditionVariable, CreateBoolNode(false));
+
+ // temp = true;
+ TIntermBinary *assignTrue =
+ CreateTempAssignmentNode(conditionVariable, CreateBoolNode(true));
+
+ // if (temp) {
+ // if (!CONDITION) {
+ // break;
+ // }
+ // }
+ TIntermIfElse *breakIf = nullptr;
+ {
+ TIntermBranch *breakStatement = new TIntermBranch(EOpBreak, nullptr);
+
+ TIntermBlock *breakBlock = new TIntermBlock();
+ breakBlock->getSequence()->push_back(breakStatement);
+
+ TIntermUnary *negatedCondition =
+ new TIntermUnary(EOpLogicalNot, loop->getCondition(), nullptr);
+
+ TIntermIfElse *innerIf = new TIntermIfElse(negatedCondition, breakBlock, nullptr);
+
+ TIntermBlock *innerIfBlock = new TIntermBlock();
+ innerIfBlock->getSequence()->push_back(innerIf);
+
+ breakIf = new TIntermIfElse(CreateTempSymbolNode(conditionVariable), innerIfBlock,
+ nullptr);
+ }
+
+ // Assemble the replacement loops, reusing the do-while loop's body and inserting our
+ // statements at the front.
+ TIntermLoop *newLoop = nullptr;
+ {
+ TIntermBlock *body = loop->getBody();
+ if (body == nullptr)
+ {
+ body = new TIntermBlock();
+ }
+ auto sequence = body->getSequence();
+ sequence->insert(sequence->begin(), assignTrue);
+ sequence->insert(sequence->begin(), breakIf);
+
+ newLoop = new TIntermLoop(ELoopWhile, nullptr, CreateBoolNode(true), nullptr, body);
+ }
+
+ TIntermSequence replacement;
+ replacement.push_back(tempDeclaration);
+ replacement.push_back(newLoop);
+
+ node->replaceChildNodeWithMultiple(loop, replacement);
+ }
+ return true;
+ }
+};
+
+} // anonymous namespace
+
+void RewriteDoWhile(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ DoWhileRewriter rewriter(symbolTable);
+
+ root->traverse(&rewriter);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.h
new file mode 100644
index 0000000000..c91d7deb06
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.h
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RewriteDoWhile.h: rewrite do-while loops as while loops to work around
+// driver bugs
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TSymbolTable;
+
+void RewriteDoWhile(TIntermNode *root, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp
new file mode 100644
index 0000000000..701e29aa9d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp
@@ -0,0 +1,120 @@
+//
+// 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.
+//
+// RewriteElseBlocks.cpp: Implementation for tree transform to change
+// all if-else blocks to if-if blocks.
+//
+
+#include "compiler/translator/tree_ops/RewriteElseBlocks.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/NodeSearch.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class ElseBlockRewriter : public TIntermTraverser
+{
+ public:
+ ElseBlockRewriter(TSymbolTable *symbolTable);
+
+ protected:
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *aggregate) override;
+ bool visitBlock(Visit visit, TIntermBlock *block) override;
+
+ private:
+ TIntermNode *rewriteIfElse(TIntermIfElse *ifElse);
+
+ const TType *mFunctionType;
+};
+
+ElseBlockRewriter::ElseBlockRewriter(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, true, symbolTable), mFunctionType(nullptr)
+{}
+
+bool ElseBlockRewriter::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
+{
+ // Store the current function context (see comment below)
+ mFunctionType = ((visit == PreVisit) ? &node->getFunctionPrototype()->getType() : nullptr);
+ return true;
+}
+
+bool ElseBlockRewriter::visitBlock(Visit visit, TIntermBlock *node)
+{
+ if (visit == PostVisit)
+ {
+ for (size_t statementIndex = 0; statementIndex != node->getSequence()->size();
+ statementIndex++)
+ {
+ TIntermNode *statement = (*node->getSequence())[statementIndex];
+ TIntermIfElse *ifElse = statement->getAsIfElseNode();
+ if (ifElse && ifElse->getFalseBlock() != nullptr)
+ {
+ (*node->getSequence())[statementIndex] = rewriteIfElse(ifElse);
+ }
+ }
+ }
+ return true;
+}
+
+TIntermNode *ElseBlockRewriter::rewriteIfElse(TIntermIfElse *ifElse)
+{
+ ASSERT(ifElse != nullptr);
+
+ TIntermDeclaration *storeCondition = nullptr;
+ TVariable *conditionVariable =
+ DeclareTempVariable(mSymbolTable, ifElse->getCondition(), EvqTemporary, &storeCondition);
+
+ TIntermBlock *falseBlock = nullptr;
+
+ TType boolType(EbtBool, EbpUndefined, EvqTemporary);
+
+ if (ifElse->getFalseBlock())
+ {
+ TIntermBlock *negatedElse = nullptr;
+ // crbug.com/346463
+ // D3D generates error messages claiming a function has no return value, when rewriting
+ // an if-else clause that returns something non-void in a function. By appending dummy
+ // returns (that are unreachable) we can silence this compile error.
+ if (mFunctionType && mFunctionType->getBasicType() != EbtVoid)
+ {
+ TIntermNode *returnNode = new TIntermBranch(EOpReturn, CreateZeroNode(*mFunctionType));
+ negatedElse = new TIntermBlock();
+ negatedElse->appendStatement(returnNode);
+ }
+
+ TIntermSymbol *conditionSymbolElse = CreateTempSymbolNode(conditionVariable);
+ TIntermUnary *negatedCondition =
+ new TIntermUnary(EOpLogicalNot, conditionSymbolElse, nullptr);
+ TIntermIfElse *falseIfElse =
+ new TIntermIfElse(negatedCondition, ifElse->getFalseBlock(), negatedElse);
+ falseBlock = EnsureBlock(falseIfElse);
+ }
+
+ TIntermSymbol *conditionSymbolSel = CreateTempSymbolNode(conditionVariable);
+ TIntermIfElse *newIfElse =
+ new TIntermIfElse(conditionSymbolSel, ifElse->getTrueBlock(), falseBlock);
+
+ TIntermBlock *block = new TIntermBlock();
+ block->getSequence()->push_back(storeCondition);
+ block->getSequence()->push_back(newIfElse);
+
+ return block;
+}
+
+} // anonymous namespace
+
+void RewriteElseBlocks(TIntermNode *node, TSymbolTable *symbolTable)
+{
+ ElseBlockRewriter rewriter(symbolTable);
+ node->traverse(&rewriter);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.h
new file mode 100644
index 0000000000..3ae3b4a710
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.h
@@ -0,0 +1,22 @@
+//
+// 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.
+//
+// RewriteElseBlocks.h: Prototype for tree transform to change
+// all if-else blocks to if-if blocks.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TSymbolTable;
+
+void RewriteElseBlocks(TIntermNode *node, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.cpp
new file mode 100644
index 0000000000..9228f5b4ec
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.cpp
@@ -0,0 +1,411 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteExpressionsWithShaderStorageBlock rewrites the expressions that contain shader storage
+// block calls into several simple ones that can be easily handled in the HLSL translator. After the
+// AST pass, all ssbo related blocks will be like below:
+// ssbo_access_chain = ssbo_access_chain;
+// ssbo_access_chain = expr_no_ssbo;
+// lvalue_no_ssbo = ssbo_access_chain;
+//
+
+#include "compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h"
+
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+namespace
+{
+
+bool IsIncrementOrDecrementOperator(TOperator op)
+{
+ switch (op)
+ {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool IsCompoundAssignment(TOperator op)
+{
+ switch (op)
+ {
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpMulAssign:
+ case EOpVectorTimesMatrixAssign:
+ case EOpVectorTimesScalarAssign:
+ case EOpMatrixTimesScalarAssign:
+ case EOpMatrixTimesMatrixAssign:
+ case EOpDivAssign:
+ case EOpIModAssign:
+ case EOpBitShiftLeftAssign:
+ case EOpBitShiftRightAssign:
+ case EOpBitwiseAndAssign:
+ case EOpBitwiseXorAssign:
+ case EOpBitwiseOrAssign:
+ return true;
+ default:
+ return false;
+ }
+}
+
+// EOpIndexDirect, EOpIndexIndirect, EOpIndexDirectStruct, EOpIndexDirectInterfaceBlock belong to
+// operators in SSBO access chain.
+bool IsReadonlyBinaryOperatorNotInSSBOAccessChain(TOperator op)
+{
+ switch (op)
+ {
+ case EOpComma:
+ case EOpAdd:
+ case EOpSub:
+ case EOpMul:
+ case EOpDiv:
+ case EOpIMod:
+ case EOpBitShiftLeft:
+ case EOpBitShiftRight:
+ case EOpBitwiseAnd:
+ case EOpBitwiseXor:
+ case EOpBitwiseOr:
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ case EOpVectorTimesScalar:
+ case EOpMatrixTimesScalar:
+ case EOpVectorTimesMatrix:
+ case EOpMatrixTimesVector:
+ case EOpMatrixTimesMatrix:
+ case EOpLogicalOr:
+ case EOpLogicalXor:
+ case EOpLogicalAnd:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool HasSSBOAsFunctionArgument(TIntermSequence *arguments)
+{
+ for (TIntermNode *arg : *arguments)
+ {
+ TIntermTyped *typedArg = arg->getAsTyped();
+ if (IsInShaderStorageBlock(typedArg))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+class RewriteExpressionsWithShaderStorageBlockTraverser : public TIntermTraverser
+{
+ public:
+ RewriteExpressionsWithShaderStorageBlockTraverser(TSymbolTable *symbolTable);
+ void nextIteration();
+ bool foundSSBO() const { return mFoundSSBO; }
+
+ private:
+ bool visitBinary(Visit, TIntermBinary *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+
+ TIntermSymbol *insertInitStatementAndReturnTempSymbol(TIntermTyped *node,
+ TIntermSequence *insertions);
+
+ bool mFoundSSBO;
+};
+
+RewriteExpressionsWithShaderStorageBlockTraverser::
+ RewriteExpressionsWithShaderStorageBlockTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, true, false, symbolTable), mFoundSSBO(false)
+{}
+
+TIntermSymbol *
+RewriteExpressionsWithShaderStorageBlockTraverser::insertInitStatementAndReturnTempSymbol(
+ TIntermTyped *node,
+ TIntermSequence *insertions)
+{
+ TIntermDeclaration *variableDeclaration;
+ TVariable *tempVariable =
+ DeclareTempVariable(mSymbolTable, node, EvqTemporary, &variableDeclaration);
+
+ insertions->push_back(variableDeclaration);
+ return CreateTempSymbolNode(tempVariable);
+}
+
+bool RewriteExpressionsWithShaderStorageBlockTraverser::visitBinary(Visit visit,
+ TIntermBinary *node)
+{
+ // Make sure that the expression is caculated from left to right.
+ if (visit != InVisit)
+ {
+ return true;
+ }
+
+ if (mFoundSSBO)
+ {
+ return false;
+ }
+
+ bool rightSSBO = IsInShaderStorageBlock(node->getRight());
+ bool leftSSBO = IsInShaderStorageBlock(node->getLeft());
+ if (!leftSSBO && !rightSSBO)
+ {
+ return true;
+ }
+
+ // case 1: Compound assigment operator
+ // original:
+ // lssbo += expr;
+ // new:
+ // var rvalue = expr;
+ // var temp = lssbo;
+ // temp += rvalue;
+ // lssbo = temp;
+ //
+ // original:
+ // lvalue_no_ssbo += rssbo;
+ // new:
+ // var rvalue = rssbo;
+ // lvalue_no_ssbo += rvalue;
+ if (IsCompoundAssignment(node->getOp()))
+ {
+ mFoundSSBO = true;
+ TIntermSequence insertions;
+ TIntermTyped *rightNode =
+ insertInitStatementAndReturnTempSymbol(node->getRight(), &insertions);
+ if (leftSSBO)
+ {
+ TIntermSymbol *tempSymbol =
+ insertInitStatementAndReturnTempSymbol(node->getLeft()->deepCopy(), &insertions);
+ TIntermBinary *tempCompoundOperate =
+ new TIntermBinary(node->getOp(), tempSymbol->deepCopy(), rightNode->deepCopy());
+ insertions.push_back(tempCompoundOperate);
+ insertStatementsInParentBlock(insertions);
+
+ TIntermBinary *assignTempValueToSSBO =
+ new TIntermBinary(EOpAssign, node->getLeft(), tempSymbol->deepCopy());
+ queueReplacement(assignTempValueToSSBO, OriginalNode::IS_DROPPED);
+ }
+ else
+ {
+ insertStatementsInParentBlock(insertions);
+ TIntermBinary *compoundAssignRValueToLValue =
+ new TIntermBinary(node->getOp(), node->getLeft(), rightNode->deepCopy());
+ queueReplacement(compoundAssignRValueToLValue, OriginalNode::IS_DROPPED);
+ }
+ }
+ // case 2: Readonly binary operator
+ // original:
+ // ssbo0 + ssbo1 + ssbo2;
+ // new:
+ // var temp0 = ssbo0;
+ // var temp1 = ssbo1;
+ // var temp2 = ssbo2;
+ // temp0 + temp1 + temp2;
+ else if (IsReadonlyBinaryOperatorNotInSSBOAccessChain(node->getOp()) && (leftSSBO || rightSSBO))
+ {
+ mFoundSSBO = true;
+ TIntermTyped *rightNode = node->getRight();
+ TIntermTyped *leftNode = node->getLeft();
+ TIntermSequence insertions;
+ if (rightSSBO)
+ {
+ rightNode = insertInitStatementAndReturnTempSymbol(node->getRight(), &insertions);
+ }
+ if (leftSSBO)
+ {
+ leftNode = insertInitStatementAndReturnTempSymbol(node->getLeft(), &insertions);
+ }
+
+ insertStatementsInParentBlock(insertions);
+ TIntermBinary *newExpr =
+ new TIntermBinary(node->getOp(), leftNode->deepCopy(), rightNode->deepCopy());
+ queueReplacement(newExpr, OriginalNode::IS_DROPPED);
+ }
+ return !mFoundSSBO;
+}
+
+// case 3: ssbo as the argument of aggregate type
+// original:
+// foo(ssbo);
+// new:
+// var tempArg = ssbo;
+// foo(tempArg);
+// ssbo = tempArg; (Optional based on whether ssbo is an out|input argument)
+//
+// original:
+// foo(ssbo) * expr;
+// new:
+// var tempArg = ssbo;
+// var tempReturn = foo(tempArg);
+// ssbo = tempArg; (Optional based on whether ssbo is an out|input argument)
+// tempReturn * expr;
+bool RewriteExpressionsWithShaderStorageBlockTraverser::visitAggregate(Visit visit,
+ TIntermAggregate *node)
+{
+ // Make sure that visitAggregate is only executed once for same node.
+ if (visit != PreVisit)
+ {
+ return true;
+ }
+
+ if (mFoundSSBO)
+ {
+ return false;
+ }
+
+ // We still need to process the ssbo as the non-first argument of atomic memory functions.
+ if (IsAtomicFunction(node->getOp()) &&
+ IsInShaderStorageBlock((*node->getSequence())[0]->getAsTyped()))
+ {
+ return true;
+ }
+
+ if (!HasSSBOAsFunctionArgument(node->getSequence()))
+ {
+ return true;
+ }
+
+ mFoundSSBO = true;
+ TIntermSequence insertions;
+ TIntermSequence readBackToSSBOs;
+ TIntermSequence *originalArguments = node->getSequence();
+ for (size_t i = 0; i < node->getChildCount(); ++i)
+ {
+ TIntermTyped *ssboArgument = (*originalArguments)[i]->getAsTyped();
+ if (IsInShaderStorageBlock(ssboArgument))
+ {
+ TIntermSymbol *argumentCopy =
+ insertInitStatementAndReturnTempSymbol(ssboArgument, &insertions);
+ if (node->getFunction() != nullptr)
+ {
+ TQualifier qual = node->getFunction()->getParam(i)->getType().getQualifier();
+ if (qual == EvqInOut || qual == EvqOut)
+ {
+ TIntermBinary *readBackToSSBO = new TIntermBinary(
+ EOpAssign, ssboArgument->deepCopy(), argumentCopy->deepCopy());
+ readBackToSSBOs.push_back(readBackToSSBO);
+ }
+ }
+ node->replaceChildNode(ssboArgument, argumentCopy);
+ }
+ }
+
+ TIntermBlock *parentBlock = getParentNode()->getAsBlock();
+ if (parentBlock)
+ {
+ // Aggregate node is as a single sentence.
+ insertions.push_back(node);
+ if (!readBackToSSBOs.empty())
+ {
+ insertions.insert(insertions.end(), readBackToSSBOs.begin(), readBackToSSBOs.end());
+ }
+ mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(parentBlock, node, insertions));
+ }
+ else
+ {
+ // Aggregate node is inside an expression.
+ TIntermSymbol *tempSymbol = insertInitStatementAndReturnTempSymbol(node, &insertions);
+ if (!readBackToSSBOs.empty())
+ {
+ insertions.insert(insertions.end(), readBackToSSBOs.begin(), readBackToSSBOs.end());
+ }
+ insertStatementsInParentBlock(insertions);
+ queueReplacement(tempSymbol->deepCopy(), OriginalNode::IS_DROPPED);
+ }
+
+ return false;
+}
+
+bool RewriteExpressionsWithShaderStorageBlockTraverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ if (mFoundSSBO)
+ {
+ return false;
+ }
+
+ if (!IsInShaderStorageBlock(node->getOperand()))
+ {
+ return true;
+ }
+
+ // .length() is processed in OutputHLSL.
+ if (node->getOp() == EOpArrayLength)
+ {
+ return true;
+ }
+
+ mFoundSSBO = true;
+
+ // case 4: ssbo as the operand of ++/--
+ // original:
+ // ++ssbo * expr;
+ // new:
+ // var temp1 = ssbo;
+ // var temp2 = ++temp1;
+ // ssbo = temp1;
+ // temp2 * expr;
+ if (IsIncrementOrDecrementOperator(node->getOp()))
+ {
+ TIntermSequence insertions;
+ TIntermSymbol *temp1 =
+ insertInitStatementAndReturnTempSymbol(node->getOperand(), &insertions);
+ TIntermUnary *newUnary = new TIntermUnary(node->getOp(), temp1->deepCopy(), nullptr);
+ TIntermSymbol *temp2 = insertInitStatementAndReturnTempSymbol(newUnary, &insertions);
+ TIntermBinary *readBackToSSBO =
+ new TIntermBinary(EOpAssign, node->getOperand()->deepCopy(), temp1->deepCopy());
+ insertions.push_back(readBackToSSBO);
+ insertStatementsInParentBlock(insertions);
+ queueReplacement(temp2->deepCopy(), OriginalNode::IS_DROPPED);
+ }
+ // case 5: ssbo as the operand of readonly unary operator
+ // original:
+ // ~ssbo * expr;
+ // new:
+ // var temp = ssbo;
+ // ~temp * expr;
+ else
+ {
+ TIntermSequence insertions;
+ TIntermSymbol *temp =
+ insertInitStatementAndReturnTempSymbol(node->getOperand(), &insertions);
+ insertStatementsInParentBlock(insertions);
+ node->replaceChildNode(node->getOperand(), temp->deepCopy());
+ }
+ return false;
+}
+
+void RewriteExpressionsWithShaderStorageBlockTraverser::nextIteration()
+{
+ mFoundSSBO = false;
+}
+
+} // anonymous namespace
+
+void RewriteExpressionsWithShaderStorageBlock(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ RewriteExpressionsWithShaderStorageBlockTraverser traverser(symbolTable);
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.foundSSBO())
+ traverser.updateTree();
+ } while (traverser.foundSSBO());
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h
new file mode 100644
index 0000000000..957552e6fd
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.h
@@ -0,0 +1,32 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteExpressionsWithShaderStorageBlock rewrites the expressions that contain shader storage
+// block calls into several simple ones that can be easily handled in the HLSL translator. After the
+// AST pass, all ssbo related blocks will be like below:
+// ssbo_access_chain = ssbo_access_chain;
+// ssbo_access_chain = expr_no_ssbo;
+// lvalue_no_ssbo = ssbo_access_chain;
+//
+// Below situations are needed to be rewritten (Details can be found in .cpp file).
+// SSBO as the operand of compound assignment operators.
+// SSBO as the operand of ++/--.
+// SSBO as the operand of repeated assignment.
+// SSBO as the operand of readonly unary/binary/ternary operators.
+// SSBO as the argument of aggregate type.
+// SSBO as the condition of if/switch/while/do-while/for
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
+
+namespace sh
+{
+class TIntermNode;
+class TSymbolTable;
+
+void RewriteExpressionsWithShaderStorageBlock(TIntermNode *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITE_EXPRESSIONS_WITH_SHADER_STORAGE_BLOCK_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.cpp
new file mode 100644
index 0000000000..3cc670e688
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.cpp
@@ -0,0 +1,92 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteRepeatedAssignToSwizzled.cpp: Rewrite expressions that assign an assignment to a swizzled
+// vector, like:
+// v.x = z = expression;
+// to:
+// z = expression;
+// v.x = z;
+//
+// Note that this doesn't handle some corner cases: expressions nested inside other expressions,
+// inside loop headers, or inside if conditions.
+
+#include "compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h"
+
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class RewriteAssignToSwizzledTraverser : public TIntermTraverser
+{
+ public:
+ static void rewrite(TIntermBlock *root);
+
+ private:
+ RewriteAssignToSwizzledTraverser();
+
+ bool visitBinary(Visit, TIntermBinary *node) override;
+
+ void nextIteration();
+
+ bool didRewrite() { return mDidRewrite; }
+
+ bool mDidRewrite;
+};
+
+// static
+void RewriteAssignToSwizzledTraverser::rewrite(TIntermBlock *root)
+{
+ RewriteAssignToSwizzledTraverser rewrite;
+ do
+ {
+ rewrite.nextIteration();
+ root->traverse(&rewrite);
+ rewrite.updateTree();
+ } while (rewrite.didRewrite());
+}
+
+RewriteAssignToSwizzledTraverser::RewriteAssignToSwizzledTraverser()
+ : TIntermTraverser(true, false, false), mDidRewrite(false)
+{}
+
+void RewriteAssignToSwizzledTraverser::nextIteration()
+{
+ mDidRewrite = false;
+}
+
+bool RewriteAssignToSwizzledTraverser::visitBinary(Visit, TIntermBinary *node)
+{
+ TIntermBinary *rightBinary = node->getRight()->getAsBinaryNode();
+ TIntermBlock *parentBlock = getParentNode()->getAsBlock();
+ if (parentBlock && node->isAssignment() && node->getLeft()->getAsSwizzleNode() && rightBinary &&
+ rightBinary->isAssignment())
+ {
+ TIntermSequence replacements;
+ replacements.push_back(rightBinary);
+ TIntermTyped *rightAssignmentTargetCopy = rightBinary->getLeft()->deepCopy();
+ TIntermBinary *lastAssign =
+ new TIntermBinary(EOpAssign, node->getLeft(), rightAssignmentTargetCopy);
+ replacements.push_back(lastAssign);
+ mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(parentBlock, node, replacements));
+ mDidRewrite = true;
+ return false;
+ }
+ return true;
+}
+
+} // anonymous namespace
+
+void RewriteRepeatedAssignToSwizzled(TIntermBlock *root)
+{
+ RewriteAssignToSwizzledTraverser::rewrite(root);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h
new file mode 100644
index 0000000000..2f2d3b9f80
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.h
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteRepeatedAssignToSwizzled.h: Rewrite expressions that assign an assignment to a swizzled
+// vector, like:
+// v.x = z = expression;
+// to:
+// z = expression;
+// v.x = z;
+//
+// Note that this doesn't handle some corner cases: expressions nested inside other expressions,
+// inside loop headers, or inside if conditions.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+
+void RewriteRepeatedAssignToSwizzled(TIntermBlock *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEREPEATEDASSIGNTOSWIZZLED_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.cpp
new file mode 100644
index 0000000000..8d5bdd0bae
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.cpp
@@ -0,0 +1,699 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteStructSamplers: Extract structs from samplers.
+//
+
+#include "compiler/translator/tree_ops/RewriteStructSamplers.h"
+
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+namespace
+{
+// Helper method to get the sampler extracted struct type of a parameter.
+TType *GetStructSamplerParameterType(TSymbolTable *symbolTable, const TVariable &param)
+{
+ const TStructure *structure = param.getType().getStruct();
+ const TSymbol *structSymbol = symbolTable->findUserDefined(structure->name());
+ ASSERT(structSymbol && structSymbol->isStruct());
+ const TStructure *structVar = static_cast<const TStructure *>(structSymbol);
+ TType *structType = new TType(structVar, false);
+
+ if (param.getType().isArray())
+ {
+ structType->makeArrays(*param.getType().getArraySizes());
+ }
+
+ ASSERT(!structType->isStructureContainingSamplers());
+
+ return structType;
+}
+
+TIntermSymbol *ReplaceTypeOfSymbolNode(TIntermSymbol *symbolNode, TSymbolTable *symbolTable)
+{
+ const TVariable &oldVariable = symbolNode->variable();
+
+ TType *newType = GetStructSamplerParameterType(symbolTable, oldVariable);
+
+ TVariable *newVariable =
+ new TVariable(oldVariable.uniqueId(), oldVariable.name(), oldVariable.symbolType(),
+ oldVariable.extension(), newType);
+ return new TIntermSymbol(newVariable);
+}
+
+TIntermTyped *ReplaceTypeOfTypedStructNode(TIntermTyped *argument, TSymbolTable *symbolTable)
+{
+ TIntermSymbol *asSymbol = argument->getAsSymbolNode();
+ if (asSymbol)
+ {
+ ASSERT(asSymbol->getType().getStruct());
+ return ReplaceTypeOfSymbolNode(asSymbol, symbolTable);
+ }
+
+ TIntermTyped *replacement = argument->deepCopy();
+ TIntermBinary *binary = replacement->getAsBinaryNode();
+ ASSERT(binary);
+
+ while (binary)
+ {
+ ASSERT(binary->getOp() == EOpIndexDirectStruct || binary->getOp() == EOpIndexDirect);
+
+ asSymbol = binary->getLeft()->getAsSymbolNode();
+
+ if (asSymbol)
+ {
+ ASSERT(asSymbol->getType().getStruct());
+ TIntermSymbol *newSymbol = ReplaceTypeOfSymbolNode(asSymbol, symbolTable);
+ binary->replaceChildNode(binary->getLeft(), newSymbol);
+ return replacement;
+ }
+
+ binary = binary->getLeft()->getAsBinaryNode();
+ }
+
+ UNREACHABLE();
+ return nullptr;
+}
+
+// Maximum string size of a hex unsigned int.
+constexpr size_t kHexSize = ImmutableStringBuilder::GetHexCharCount<unsigned int>();
+
+class Traverser final : public TIntermTraverser
+{
+ public:
+ explicit Traverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, true, symbolTable), mRemovedUniformsCount(0)
+ {
+ mSymbolTable->push();
+ }
+
+ ~Traverser() override { mSymbolTable->pop(); }
+
+ int removedUniformsCount() const { return mRemovedUniformsCount; }
+
+ // Each struct sampler declaration is stripped of its samplers. New uniforms are added for each
+ // stripped struct sampler.
+ bool visitDeclaration(Visit visit, TIntermDeclaration *decl) override
+ {
+ if (visit != PreVisit)
+ return true;
+
+ if (!mInGlobalScope)
+ {
+ return true;
+ }
+
+ const TIntermSequence &sequence = *(decl->getSequence());
+ TIntermTyped *declarator = sequence.front()->getAsTyped();
+ const TType &type = declarator->getType();
+
+ if (type.isStructureContainingSamplers())
+ {
+ TIntermSequence *newSequence = new TIntermSequence;
+
+ if (type.isStructSpecifier())
+ {
+ stripStructSpecifierSamplers(type.getStruct(), newSequence);
+ }
+ else
+ {
+ TIntermSymbol *asSymbol = declarator->getAsSymbolNode();
+ ASSERT(asSymbol);
+ const TVariable &variable = asSymbol->variable();
+ ASSERT(variable.symbolType() != SymbolType::Empty);
+ extractStructSamplerUniforms(decl, variable, type.getStruct(), newSequence);
+ }
+
+ mMultiReplacements.emplace_back(getParentNode()->getAsBlock(), decl, *newSequence);
+ }
+
+ return true;
+ }
+
+ // Each struct sampler reference is replaced with a reference to the new extracted sampler.
+ bool visitBinary(Visit visit, TIntermBinary *node) override
+ {
+ if (visit != PreVisit)
+ return true;
+
+ if (node->getOp() == EOpIndexDirectStruct && node->getType().isSampler())
+ {
+ ImmutableString newName = GetStructSamplerNameFromTypedNode(node);
+ const TVariable *samplerReplacement =
+ static_cast<const TVariable *>(mSymbolTable->findUserDefined(newName));
+ ASSERT(samplerReplacement);
+
+ TIntermSymbol *replacement = new TIntermSymbol(samplerReplacement);
+
+ queueReplacement(replacement, OriginalNode::IS_DROPPED);
+ return true;
+ }
+
+ return true;
+ }
+
+ // In we are passing references to structs containing samplers we must new additional
+ // arguments. For each extracted struct sampler a new argument is added. This chains to nested
+ // structs.
+ void visitFunctionPrototype(TIntermFunctionPrototype *node) override
+ {
+ const TFunction *function = node->getFunction();
+
+ if (!function->hasSamplerInStructParams())
+ {
+ return;
+ }
+
+ const TSymbol *foundFunction = mSymbolTable->findUserDefined(function->name());
+ if (foundFunction)
+ {
+ ASSERT(foundFunction->isFunction());
+ function = static_cast<const TFunction *>(foundFunction);
+ }
+ else
+ {
+ TFunction *newFunction = createStructSamplerFunction(function);
+ mSymbolTable->declareUserDefinedFunction(newFunction, true);
+ function = newFunction;
+ }
+
+ ASSERT(!function->hasSamplerInStructParams());
+ TIntermFunctionPrototype *newProto = new TIntermFunctionPrototype(function);
+ queueReplacement(newProto, OriginalNode::IS_DROPPED);
+ }
+
+ // We insert a new scope for each function definition so we can track the new parameters.
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override
+ {
+ if (visit == PreVisit)
+ {
+ mSymbolTable->push();
+ }
+ else
+ {
+ ASSERT(visit == PostVisit);
+ mSymbolTable->pop();
+ }
+ return true;
+ }
+
+ // For function call nodes we pass references to the extracted struct samplers in that scope.
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override
+ {
+ if (visit != PreVisit)
+ return true;
+
+ if (!node->isFunctionCall())
+ return true;
+
+ const TFunction *function = node->getFunction();
+ if (!function->hasSamplerInStructParams())
+ return true;
+
+ ASSERT(node->getOp() == EOpCallFunctionInAST);
+ TFunction *newFunction = mSymbolTable->findUserDefinedFunction(function->name());
+ TIntermSequence *newArguments = getStructSamplerArguments(function, node->getSequence());
+
+ TIntermAggregate *newCall =
+ TIntermAggregate::CreateFunctionCall(*newFunction, newArguments);
+ queueReplacement(newCall, OriginalNode::IS_DROPPED);
+ return true;
+ }
+
+ private:
+ // This returns the name of a struct sampler reference. References are always TIntermBinary.
+ static ImmutableString GetStructSamplerNameFromTypedNode(TIntermTyped *node)
+ {
+ std::string stringBuilder;
+
+ TIntermTyped *currentNode = node;
+ while (currentNode->getAsBinaryNode())
+ {
+ TIntermBinary *asBinary = currentNode->getAsBinaryNode();
+
+ switch (asBinary->getOp())
+ {
+ case EOpIndexDirect:
+ {
+ const int index = asBinary->getRight()->getAsConstantUnion()->getIConst(0);
+ const std::string strInt = Str(index);
+ stringBuilder.insert(0, strInt);
+ stringBuilder.insert(0, "_");
+ break;
+ }
+ case EOpIndexDirectStruct:
+ {
+ stringBuilder.insert(0, asBinary->getIndexStructFieldName().data());
+ stringBuilder.insert(0, "_");
+ break;
+ }
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ currentNode = asBinary->getLeft();
+ }
+
+ const ImmutableString &variableName = currentNode->getAsSymbolNode()->variable().name();
+ stringBuilder.insert(0, variableName.data());
+
+ return stringBuilder;
+ }
+
+ // Removes all the struct samplers from a struct specifier.
+ void stripStructSpecifierSamplers(const TStructure *structure, TIntermSequence *newSequence)
+ {
+ TFieldList *newFieldList = new TFieldList;
+ ASSERT(structure->containsSamplers());
+
+ for (const TField *field : structure->fields())
+ {
+ const TType &fieldType = *field->type();
+ if (!fieldType.isSampler() && !isRemovedStructType(fieldType))
+ {
+ TType *newType = nullptr;
+
+ if (fieldType.isStructureContainingSamplers())
+ {
+ const TSymbol *structSymbol =
+ mSymbolTable->findUserDefined(fieldType.getStruct()->name());
+ ASSERT(structSymbol && structSymbol->isStruct());
+ const TStructure *fieldStruct = static_cast<const TStructure *>(structSymbol);
+ newType = new TType(fieldStruct, true);
+ if (fieldType.isArray())
+ {
+ newType->makeArrays(*fieldType.getArraySizes());
+ }
+ }
+ else
+ {
+ newType = new TType(fieldType);
+ }
+
+ TField *newField =
+ new TField(newType, field->name(), field->line(), field->symbolType());
+ newFieldList->push_back(newField);
+ }
+ }
+
+ // Prune empty structs.
+ if (newFieldList->empty())
+ {
+ mRemovedStructs.insert(structure->name());
+ return;
+ }
+
+ TStructure *newStruct =
+ new TStructure(mSymbolTable, structure->name(), newFieldList, structure->symbolType());
+ TType *newStructType = new TType(newStruct, true);
+ TVariable *newStructVar =
+ new TVariable(mSymbolTable, kEmptyImmutableString, newStructType, SymbolType::Empty);
+ TIntermSymbol *newStructRef = new TIntermSymbol(newStructVar);
+
+ TIntermDeclaration *structDecl = new TIntermDeclaration;
+ structDecl->appendDeclarator(newStructRef);
+
+ newSequence->push_back(structDecl);
+
+ mSymbolTable->declare(newStruct);
+ }
+
+ // Returns true if the type is a struct that was removed because we extracted all the members.
+ bool isRemovedStructType(const TType &type) const
+ {
+ const TStructure *structure = type.getStruct();
+ return (structure && (mRemovedStructs.count(structure->name()) > 0));
+ }
+
+ // Removes samplers from struct uniforms. For each sampler removed also adds a new globally
+ // defined sampler uniform.
+ void extractStructSamplerUniforms(TIntermDeclaration *oldDeclaration,
+ const TVariable &variable,
+ const TStructure *structure,
+ TIntermSequence *newSequence)
+ {
+ ASSERT(structure->containsSamplers());
+
+ size_t nonSamplerCount = 0;
+
+ for (const TField *field : structure->fields())
+ {
+ nonSamplerCount +=
+ extractFieldSamplers(variable.name(), field, variable.getType(), newSequence);
+ }
+
+ if (nonSamplerCount > 0)
+ {
+ // Keep the old declaration around if it has other members.
+ newSequence->push_back(oldDeclaration);
+ }
+ else
+ {
+ mRemovedUniformsCount++;
+ }
+ }
+
+ // Extracts samplers from a field of a struct. Works with nested structs and arrays.
+ size_t extractFieldSamplers(const ImmutableString &prefix,
+ const TField *field,
+ const TType &containingType,
+ TIntermSequence *newSequence)
+ {
+ if (containingType.isArray())
+ {
+ size_t nonSamplerCount = 0;
+
+ // Name the samplers internally as varName_<index>_fieldName
+ const TVector<unsigned int> &arraySizes = *containingType.getArraySizes();
+ for (unsigned int arrayElement = 0; arrayElement < arraySizes[0]; ++arrayElement)
+ {
+ ImmutableStringBuilder stringBuilder(prefix.length() + kHexSize + 1);
+ stringBuilder << prefix << "_";
+ stringBuilder.appendHex(arrayElement);
+ nonSamplerCount = extractFieldSamplersImpl(stringBuilder, field, newSequence);
+ }
+
+ return nonSamplerCount;
+ }
+
+ return extractFieldSamplersImpl(prefix, field, newSequence);
+ }
+
+ // Extracts samplers from a field of a struct. Works with nested structs and arrays.
+ size_t extractFieldSamplersImpl(const ImmutableString &prefix,
+ const TField *field,
+ TIntermSequence *newSequence)
+ {
+ size_t nonSamplerCount = 0;
+
+ const TType &fieldType = *field->type();
+ if (fieldType.isSampler() || fieldType.isStructureContainingSamplers())
+ {
+ ImmutableStringBuilder stringBuilder(prefix.length() + field->name().length() + 1);
+ stringBuilder << prefix << "_" << field->name();
+ ImmutableString newPrefix(stringBuilder);
+
+ if (fieldType.isSampler())
+ {
+ extractSampler(newPrefix, fieldType, newSequence);
+ }
+ else
+ {
+ const TStructure *structure = fieldType.getStruct();
+ for (const TField *nestedField : structure->fields())
+ {
+ nonSamplerCount +=
+ extractFieldSamplers(newPrefix, nestedField, fieldType, newSequence);
+ }
+ }
+ }
+ else
+ {
+ nonSamplerCount++;
+ }
+
+ return nonSamplerCount;
+ }
+
+ // Extracts a sampler from a struct. Declares the new extracted sampler.
+ void extractSampler(const ImmutableString &newName,
+ const TType &fieldType,
+ TIntermSequence *newSequence) const
+ {
+ TType *newType = new TType(fieldType);
+ newType->setQualifier(EvqUniform);
+ TVariable *newVariable =
+ new TVariable(mSymbolTable, newName, newType, SymbolType::AngleInternal);
+ TIntermSymbol *newRef = new TIntermSymbol(newVariable);
+
+ TIntermDeclaration *samplerDecl = new TIntermDeclaration;
+ samplerDecl->appendDeclarator(newRef);
+
+ newSequence->push_back(samplerDecl);
+
+ mSymbolTable->declareInternal(newVariable);
+ }
+
+ // Returns the chained name of a sampler uniform field.
+ static ImmutableString GetFieldName(const ImmutableString &paramName,
+ const TField *field,
+ unsigned arrayIndex)
+ {
+ ImmutableStringBuilder nameBuilder(paramName.length() + kHexSize + 2 +
+ field->name().length());
+ nameBuilder << paramName << "_";
+
+ if (arrayIndex < std::numeric_limits<unsigned>::max())
+ {
+ nameBuilder.appendHex(arrayIndex);
+ nameBuilder << "_";
+ }
+ nameBuilder << field->name();
+
+ return nameBuilder;
+ }
+
+ // A pattern that visits every parameter of a function call. Uses different handlers for struct
+ // parameters, struct sampler parameters, and non-struct parameters.
+ class StructSamplerFunctionVisitor : angle::NonCopyable
+ {
+ public:
+ StructSamplerFunctionVisitor() = default;
+ virtual ~StructSamplerFunctionVisitor() = default;
+
+ virtual void traverse(const TFunction *function)
+ {
+ size_t paramCount = function->getParamCount();
+
+ for (size_t paramIndex = 0; paramIndex < paramCount; ++paramIndex)
+ {
+ const TVariable *param = function->getParam(paramIndex);
+ const TType &paramType = param->getType();
+
+ if (paramType.isStructureContainingSamplers())
+ {
+ const ImmutableString &baseName = getNameFromIndex(function, paramIndex);
+ if (traverseStructContainingSamplers(baseName, paramType))
+ {
+ visitStructParam(function, paramIndex);
+ }
+ }
+ else
+ {
+ visitNonStructParam(function, paramIndex);
+ }
+ }
+ }
+
+ virtual ImmutableString getNameFromIndex(const TFunction *function, size_t paramIndex) = 0;
+ virtual void visitSamplerInStructParam(const ImmutableString &name,
+ const TField *field) = 0;
+ virtual void visitStructParam(const TFunction *function, size_t paramIndex) = 0;
+ virtual void visitNonStructParam(const TFunction *function, size_t paramIndex) = 0;
+
+ private:
+ bool traverseStructContainingSamplers(const ImmutableString &baseName,
+ const TType &structType)
+ {
+ bool hasNonSamplerFields = false;
+ const TStructure *structure = structType.getStruct();
+ for (const TField *field : structure->fields())
+ {
+ if (field->type()->isStructureContainingSamplers() || field->type()->isSampler())
+ {
+ if (traverseSamplerInStruct(baseName, structType, field))
+ {
+ hasNonSamplerFields = true;
+ }
+ }
+ else
+ {
+ hasNonSamplerFields = true;
+ }
+ }
+ return hasNonSamplerFields;
+ }
+
+ bool traverseSamplerInStruct(const ImmutableString &baseName,
+ const TType &baseType,
+ const TField *field)
+ {
+ bool hasNonSamplerParams = false;
+
+ if (baseType.isArray())
+ {
+ const TVector<unsigned int> &arraySizes = *baseType.getArraySizes();
+ ASSERT(arraySizes.size() == 1);
+
+ for (unsigned int arrayIndex = 0; arrayIndex < arraySizes[0]; ++arrayIndex)
+ {
+ ImmutableString name = GetFieldName(baseName, field, arrayIndex);
+
+ if (field->type()->isStructureContainingSamplers())
+ {
+ if (traverseStructContainingSamplers(name, *field->type()))
+ {
+ hasNonSamplerParams = true;
+ }
+ }
+ else
+ {
+ ASSERT(field->type()->isSampler());
+ visitSamplerInStructParam(name, field);
+ }
+ }
+ }
+ else if (field->type()->isStructureContainingSamplers())
+ {
+ ImmutableString name =
+ GetFieldName(baseName, field, std::numeric_limits<unsigned>::max());
+ hasNonSamplerParams = traverseStructContainingSamplers(name, *field->type());
+ }
+ else
+ {
+ ASSERT(field->type()->isSampler());
+ ImmutableString name =
+ GetFieldName(baseName, field, std::numeric_limits<unsigned>::max());
+ visitSamplerInStructParam(name, field);
+ }
+
+ return hasNonSamplerParams;
+ }
+ };
+
+ // A visitor that replaces functions with struct sampler references. The struct sampler
+ // references are expanded to include new fields for the structs.
+ class CreateStructSamplerFunctionVisitor final : public StructSamplerFunctionVisitor
+ {
+ public:
+ CreateStructSamplerFunctionVisitor(TSymbolTable *symbolTable)
+ : mSymbolTable(symbolTable), mNewFunction(nullptr)
+ {}
+
+ ImmutableString getNameFromIndex(const TFunction *function, size_t paramIndex) override
+ {
+ const TVariable *param = function->getParam(paramIndex);
+ return param->name();
+ }
+
+ void traverse(const TFunction *function) override
+ {
+ mNewFunction =
+ new TFunction(mSymbolTable, function->name(), function->symbolType(),
+ &function->getReturnType(), function->isKnownToNotHaveSideEffects());
+
+ StructSamplerFunctionVisitor::traverse(function);
+ }
+
+ void visitSamplerInStructParam(const ImmutableString &name, const TField *field) override
+ {
+ TVariable *fieldSampler =
+ new TVariable(mSymbolTable, name, field->type(), SymbolType::AngleInternal);
+ mNewFunction->addParameter(fieldSampler);
+ mSymbolTable->declareInternal(fieldSampler);
+ }
+
+ void visitStructParam(const TFunction *function, size_t paramIndex) override
+ {
+ const TVariable *param = function->getParam(paramIndex);
+ TType *structType = GetStructSamplerParameterType(mSymbolTable, *param);
+ TVariable *newParam =
+ new TVariable(mSymbolTable, param->name(), structType, param->symbolType());
+ mNewFunction->addParameter(newParam);
+ }
+
+ void visitNonStructParam(const TFunction *function, size_t paramIndex) override
+ {
+ const TVariable *param = function->getParam(paramIndex);
+ mNewFunction->addParameter(param);
+ }
+
+ TFunction *getNewFunction() const { return mNewFunction; }
+
+ private:
+ TSymbolTable *mSymbolTable;
+ TFunction *mNewFunction;
+ };
+
+ TFunction *createStructSamplerFunction(const TFunction *function) const
+ {
+ CreateStructSamplerFunctionVisitor visitor(mSymbolTable);
+ visitor.traverse(function);
+ return visitor.getNewFunction();
+ }
+
+ // A visitor that replaces function calls with expanded struct sampler parameters.
+ class GetSamplerArgumentsVisitor final : public StructSamplerFunctionVisitor
+ {
+ public:
+ GetSamplerArgumentsVisitor(TSymbolTable *symbolTable, const TIntermSequence *arguments)
+ : mSymbolTable(symbolTable), mArguments(arguments), mNewArguments(new TIntermSequence)
+ {}
+
+ ImmutableString getNameFromIndex(const TFunction *function, size_t paramIndex) override
+ {
+ TIntermTyped *argument = (*mArguments)[paramIndex]->getAsTyped();
+ return GetStructSamplerNameFromTypedNode(argument);
+ }
+
+ void visitSamplerInStructParam(const ImmutableString &name, const TField *field) override
+ {
+ TVariable *argSampler =
+ new TVariable(mSymbolTable, name, field->type(), SymbolType::AngleInternal);
+ TIntermSymbol *argSymbol = new TIntermSymbol(argSampler);
+ mNewArguments->push_back(argSymbol);
+ }
+
+ void visitStructParam(const TFunction *function, size_t paramIndex) override
+ {
+ // The tree structure of the parameter is modified to point to the new type. This leaves
+ // the tree in a consistent state.
+ TIntermTyped *argument = (*mArguments)[paramIndex]->getAsTyped();
+ TIntermTyped *replacement = ReplaceTypeOfTypedStructNode(argument, mSymbolTable);
+ mNewArguments->push_back(replacement);
+ }
+
+ void visitNonStructParam(const TFunction *function, size_t paramIndex) override
+ {
+ TIntermTyped *argument = (*mArguments)[paramIndex]->getAsTyped();
+ mNewArguments->push_back(argument);
+ }
+
+ TIntermSequence *getNewArguments() const { return mNewArguments; }
+
+ private:
+ TSymbolTable *mSymbolTable;
+ const TIntermSequence *mArguments;
+ TIntermSequence *mNewArguments;
+ };
+
+ TIntermSequence *getStructSamplerArguments(const TFunction *function,
+ const TIntermSequence *arguments) const
+ {
+ GetSamplerArgumentsVisitor visitor(mSymbolTable, arguments);
+ visitor.traverse(function);
+ return visitor.getNewArguments();
+ }
+
+ int mRemovedUniformsCount;
+ std::set<ImmutableString> mRemovedStructs;
+};
+} // anonymous namespace
+
+int RewriteStructSamplers(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ Traverser rewriteStructSamplers(symbolTable);
+ root->traverse(&rewriteStructSamplers);
+ rewriteStructSamplers.updateTree();
+
+ return rewriteStructSamplers.removedUniformsCount();
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.h
new file mode 100644
index 0000000000..2b7aa6e1c4
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.h
@@ -0,0 +1,31 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RewriteStructSamplers: Extract structs from samplers.
+//
+// This traverser is designed to strip out samplers from structs. It moves them into
+// separate uniform sampler declarations. This allows the struct to be stored in the
+// default uniform block. It also requires that we rewrite any functions that take the
+// struct as an argument. The struct is split into two arguments.
+//
+// For example:
+// struct S { sampler2D samp; int i; };
+// uniform S uni;
+// Is rewritten as:
+// struct S { int i; };
+// uniform S uni;
+// uniform sampler2D uni_i;
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
+
+namespace sh
+{
+class TIntermBlock;
+class TSymbolTable;
+int RewriteStructSamplers(TIntermBlock *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITESTRUCTSAMPLERS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp
new file mode 100644
index 0000000000..3587fd6538
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp
@@ -0,0 +1,154 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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 texelFetchOffset translation issue workaround.
+// See header for more info.
+
+#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h"
+
+#include "common/angleutils.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class Traverser : public TIntermTraverser
+{
+ public:
+ static void Apply(TIntermNode *root, const TSymbolTable &symbolTable, int shaderVersion);
+
+ private:
+ Traverser(const TSymbolTable &symbolTable, int shaderVersion);
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ void nextIteration();
+
+ const TSymbolTable *symbolTable;
+ const int shaderVersion;
+ bool mFound = false;
+};
+
+Traverser::Traverser(const TSymbolTable &symbolTable, int shaderVersion)
+ : TIntermTraverser(true, false, false), symbolTable(&symbolTable), shaderVersion(shaderVersion)
+{}
+
+// static
+void Traverser::Apply(TIntermNode *root, const TSymbolTable &symbolTable, int shaderVersion)
+{
+ Traverser traverser(symbolTable, shaderVersion);
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.mFound)
+ {
+ traverser.updateTree();
+ }
+ } while (traverser.mFound);
+}
+
+void Traverser::nextIteration()
+{
+ mFound = false;
+}
+
+bool Traverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (mFound)
+ {
+ return false;
+ }
+
+ // Decide if the node represents the call of texelFetchOffset.
+ if (node->getOp() != EOpCallBuiltInFunction)
+ {
+ return true;
+ }
+
+ ASSERT(node->getFunction()->symbolType() == SymbolType::BuiltIn);
+ if (node->getFunction()->name() != "texelFetchOffset")
+ {
+ return true;
+ }
+
+ // Potential problem case detected, apply workaround.
+ const TIntermSequence *sequence = node->getSequence();
+ ASSERT(sequence->size() == 4u);
+
+ // Decide if the sampler is a 2DArray sampler. In that case position is ivec3 and offset is
+ // ivec2.
+ bool is2DArray = sequence->at(1)->getAsTyped()->getNominalSize() == 3 &&
+ sequence->at(3)->getAsTyped()->getNominalSize() == 2;
+
+ // Create new node that represents the call of function texelFetch.
+ // Its argument list will be: texelFetch(sampler, Position+offset, lod).
+
+ TIntermSequence *texelFetchArguments = new TIntermSequence();
+
+ // sampler
+ texelFetchArguments->push_back(sequence->at(0));
+
+ // Position
+ TIntermTyped *texCoordNode = sequence->at(1)->getAsTyped();
+ ASSERT(texCoordNode);
+
+ // offset
+ TIntermTyped *offsetNode = nullptr;
+ ASSERT(sequence->at(3)->getAsTyped());
+ if (is2DArray)
+ {
+ // For 2DArray samplers, Position is ivec3 and offset is ivec2;
+ // So offset must be converted into an ivec3 before being added to Position.
+ TIntermSequence *constructOffsetIvecArguments = new TIntermSequence();
+ constructOffsetIvecArguments->push_back(sequence->at(3)->getAsTyped());
+
+ TIntermTyped *zeroNode = CreateZeroNode(TType(EbtInt));
+ constructOffsetIvecArguments->push_back(zeroNode);
+
+ offsetNode = TIntermAggregate::CreateConstructor(texCoordNode->getType(),
+ constructOffsetIvecArguments);
+ offsetNode->setLine(texCoordNode->getLine());
+ }
+ else
+ {
+ offsetNode = sequence->at(3)->getAsTyped();
+ }
+
+ // Position+offset
+ TIntermBinary *add = new TIntermBinary(EOpAdd, texCoordNode, offsetNode);
+ add->setLine(texCoordNode->getLine());
+ texelFetchArguments->push_back(add);
+
+ // lod
+ texelFetchArguments->push_back(sequence->at(2));
+
+ ASSERT(texelFetchArguments->size() == 3u);
+
+ TIntermTyped *texelFetchNode = CreateBuiltInFunctionCallNode("texelFetch", texelFetchArguments,
+ *symbolTable, shaderVersion);
+ texelFetchNode->setLine(node->getLine());
+
+ // Replace the old node by this new node.
+ queueReplacement(texelFetchNode, OriginalNode::IS_DROPPED);
+ mFound = true;
+ return false;
+}
+
+} // anonymous namespace
+
+void RewriteTexelFetchOffset(TIntermNode *root, const TSymbolTable &symbolTable, int shaderVersion)
+{
+ // texelFetchOffset is only valid in GLSL 3.0 and later.
+ if (shaderVersion < 300)
+ return;
+
+ Traverser::Apply(root, symbolTable, shaderVersion);
+}
+
+} // namespace sh \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.h
new file mode 100644
index 0000000000..45e224dd62
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.h
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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 mutating tree traversal works around an issue on the translation
+// from texelFetchOffset into HLSL function Load on INTEL drivers. It
+// works by translating texelFetchOffset into texelFetch:
+//
+// - From: texelFetchOffset(sampler, Position, lod, offset)
+// - To: texelFetch(sampler, Position+offset, lod)
+//
+// See http://anglebug.com/1469
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITE_TEXELFETCHOFFSET_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITE_TEXELFETCHOFFSET_H_
+
+class TIntermNode;
+class TSymbolTable;
+
+namespace sh
+{
+
+void RewriteTexelFetchOffset(TIntermNode *root, const TSymbolTable &symbolTable, int shaderVersion);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITE_TEXELFETCHOFFSET_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp
new file mode 100644
index 0000000000..e95dde2a76
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp
@@ -0,0 +1,92 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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/tree_ops/RewriteUnaryMinusOperatorFloat.h"
+
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class Traverser : public TIntermTraverser
+{
+ public:
+ static void Apply(TIntermNode *root);
+
+ private:
+ Traverser();
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ void nextIteration();
+
+ bool mFound = false;
+};
+
+// static
+void Traverser::Apply(TIntermNode *root)
+{
+ Traverser traverser;
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.mFound)
+ {
+ traverser.updateTree();
+ }
+ } while (traverser.mFound);
+}
+
+Traverser::Traverser() : TIntermTraverser(true, false, false) {}
+
+void Traverser::nextIteration()
+{
+ mFound = false;
+}
+
+bool Traverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ if (mFound)
+ {
+ return false;
+ }
+
+ // Detect if the current operator is unary minus operator.
+ if (node->getOp() != EOpNegative)
+ {
+ return true;
+ }
+
+ // Detect if the current operand is a float variable.
+ TIntermTyped *fValue = node->getOperand();
+ if (!fValue->getType().isScalarFloat())
+ {
+ return true;
+ }
+
+ // 0.0 - float
+ TIntermTyped *zero = CreateZeroNode(fValue->getType());
+ zero->setLine(fValue->getLine());
+ TIntermBinary *sub = new TIntermBinary(EOpSub, zero, fValue);
+ sub->setLine(fValue->getLine());
+
+ queueReplacement(sub, OriginalNode::IS_DROPPED);
+
+ mFound = true;
+ return false;
+}
+
+} // anonymous namespace
+
+void RewriteUnaryMinusOperatorFloat(TIntermNode *root)
+{
+ Traverser::Apply(root);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h
new file mode 100644
index 0000000000..2df592a775
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h
@@ -0,0 +1,19 @@
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Rewrite "-float" to "0.0 - float" to work around unary minus operator on float issue on Intel Mac
+// OSX 10.11.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_
+
+class TIntermNode;
+namespace sh
+{
+
+void RewriteUnaryMinusOperatorFloat(TIntermNode *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp
new file mode 100644
index 0000000000..5bfdb76e03
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp
@@ -0,0 +1,110 @@
+//
+// Copyright (c) 2016 The ANGLE Project 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 evaluating unary integer variable bug workaround.
+// See header for more info.
+
+#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h"
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class Traverser : public TIntermTraverser
+{
+ public:
+ static void Apply(TIntermNode *root);
+
+ private:
+ Traverser();
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ void nextIteration();
+
+ bool mFound = false;
+};
+
+// static
+void Traverser::Apply(TIntermNode *root)
+{
+ Traverser traverser;
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.mFound)
+ {
+ traverser.updateTree();
+ }
+ } while (traverser.mFound);
+}
+
+Traverser::Traverser() : TIntermTraverser(true, false, false) {}
+
+void Traverser::nextIteration()
+{
+ mFound = false;
+}
+
+bool Traverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ if (mFound)
+ {
+ return false;
+ }
+
+ // Decide if the current unary operator is unary minus.
+ if (node->getOp() != EOpNegative)
+ {
+ return true;
+ }
+
+ // Decide if the current operand is an integer variable.
+ TIntermTyped *opr = node->getOperand();
+ if (!opr->getType().isScalarInt())
+ {
+ return true;
+ }
+
+ // Potential problem case detected, apply workaround: -(int) -> ~(int) + 1.
+ // ~(int)
+ TIntermUnary *bitwiseNot = new TIntermUnary(EOpBitwiseNot, opr, nullptr);
+ bitwiseNot->setLine(opr->getLine());
+
+ // Constant 1 (or 1u)
+ TConstantUnion *one = new TConstantUnion();
+ if (opr->getType().getBasicType() == EbtInt)
+ {
+ one->setIConst(1);
+ }
+ else
+ {
+ one->setUConst(1u);
+ }
+ TIntermConstantUnion *oneNode =
+ new TIntermConstantUnion(one, TType(opr->getBasicType(), opr->getPrecision(), EvqConst));
+ oneNode->setLine(opr->getLine());
+
+ // ~(int) + 1
+ TIntermBinary *add = new TIntermBinary(EOpAdd, bitwiseNot, oneNode);
+ add->setLine(opr->getLine());
+
+ queueReplacement(add, OriginalNode::IS_DROPPED);
+
+ mFound = true;
+ return false;
+}
+
+} // anonymous namespace
+
+void RewriteUnaryMinusOperatorInt(TIntermNode *root)
+{
+ Traverser::Apply(root);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h
new file mode 100644
index 0000000000..66192179c4
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h
@@ -0,0 +1,20 @@
+// Copyright (c) 2016 The ANGLE Project 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 mutating tree traversal works around a bug on evaluating unary
+// integer variable on Intel D3D driver. It works by rewriting -(int) to
+// ~(int) + 1 when evaluating unary integer variables.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_
+#define COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_
+
+class TIntermNode;
+namespace sh
+{
+
+void RewriteUnaryMinusOperatorInt(TIntermNode *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp
new file mode 100644
index 0000000000..53d34ec5c1
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp
@@ -0,0 +1,226 @@
+//
+// 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.
+//
+// Scalarize vector and matrix constructor args, so that vectors built from components don't have
+// matrix arguments, and matrices built from components don't have vector arguments. This avoids
+// driver bugs around vector and matrix constructors.
+//
+
+#include "compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h"
+#include "common/debug.h"
+
+#include <algorithm>
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+TIntermBinary *ConstructVectorIndexBinaryNode(TIntermSymbol *symbolNode, int index)
+{
+ return new TIntermBinary(EOpIndexDirect, symbolNode, CreateIndexNode(index));
+}
+
+TIntermBinary *ConstructMatrixIndexBinaryNode(TIntermSymbol *symbolNode, int colIndex, int rowIndex)
+{
+ TIntermBinary *colVectorNode = ConstructVectorIndexBinaryNode(symbolNode, colIndex);
+
+ return new TIntermBinary(EOpIndexDirect, colVectorNode, CreateIndexNode(rowIndex));
+}
+
+class ScalarizeArgsTraverser : public TIntermTraverser
+{
+ public:
+ ScalarizeArgsTraverser(sh::GLenum shaderType,
+ bool fragmentPrecisionHigh,
+ TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable),
+ mShaderType(shaderType),
+ mFragmentPrecisionHigh(fragmentPrecisionHigh),
+ mNodesToScalarize(IntermNodePatternMatcher::kScalarizedVecOrMatConstructor)
+ {}
+
+ protected:
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitBlock(Visit visit, TIntermBlock *node) override;
+
+ private:
+ void scalarizeArgs(TIntermAggregate *aggregate, bool scalarizeVector, bool scalarizeMatrix);
+
+ // If we have the following code:
+ // mat4 m(0);
+ // vec4 v(1, m);
+ // We will rewrite to:
+ // mat4 m(0);
+ // mat4 s0 = m;
+ // vec4 v(1, s0[0][0], s0[0][1], s0[0][2]);
+ // This function is to create nodes for "mat4 s0 = m;" and insert it to the code sequence. This
+ // way the possible side effects of the constructor argument will only be evaluated once.
+ TVariable *createTempVariable(TIntermTyped *original);
+
+ std::vector<TIntermSequence> mBlockStack;
+
+ sh::GLenum mShaderType;
+ bool mFragmentPrecisionHigh;
+
+ IntermNodePatternMatcher mNodesToScalarize;
+};
+
+bool ScalarizeArgsTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ ASSERT(visit == PreVisit);
+ if (mNodesToScalarize.match(node, getParentNode()))
+ {
+ if (node->getType().isVector())
+ {
+ scalarizeArgs(node, false, true);
+ }
+ else
+ {
+ ASSERT(node->getType().isMatrix());
+ scalarizeArgs(node, true, false);
+ }
+ }
+ return true;
+}
+
+bool ScalarizeArgsTraverser::visitBlock(Visit visit, TIntermBlock *node)
+{
+ mBlockStack.push_back(TIntermSequence());
+ {
+ for (TIntermNode *child : *node->getSequence())
+ {
+ ASSERT(child != nullptr);
+ child->traverse(this);
+ mBlockStack.back().push_back(child);
+ }
+ }
+ if (mBlockStack.back().size() > node->getSequence()->size())
+ {
+ node->getSequence()->clear();
+ *(node->getSequence()) = mBlockStack.back();
+ }
+ mBlockStack.pop_back();
+ return false;
+}
+
+void ScalarizeArgsTraverser::scalarizeArgs(TIntermAggregate *aggregate,
+ bool scalarizeVector,
+ bool scalarizeMatrix)
+{
+ ASSERT(aggregate);
+ ASSERT(!aggregate->isArray());
+ int size = static_cast<int>(aggregate->getType().getObjectSize());
+ TIntermSequence *sequence = aggregate->getSequence();
+ TIntermSequence originalArgs(*sequence);
+ sequence->clear();
+ for (TIntermNode *originalArgNode : originalArgs)
+ {
+ ASSERT(size > 0);
+ TIntermTyped *originalArg = originalArgNode->getAsTyped();
+ ASSERT(originalArg);
+ TVariable *argVariable = createTempVariable(originalArg);
+ if (originalArg->isScalar())
+ {
+ sequence->push_back(CreateTempSymbolNode(argVariable));
+ size--;
+ }
+ else if (originalArg->isVector())
+ {
+ if (scalarizeVector)
+ {
+ int repeat = std::min(size, originalArg->getNominalSize());
+ size -= repeat;
+ for (int index = 0; index < repeat; ++index)
+ {
+ TIntermSymbol *symbolNode = CreateTempSymbolNode(argVariable);
+ TIntermBinary *newNode = ConstructVectorIndexBinaryNode(symbolNode, index);
+ sequence->push_back(newNode);
+ }
+ }
+ else
+ {
+ TIntermSymbol *symbolNode = CreateTempSymbolNode(argVariable);
+ sequence->push_back(symbolNode);
+ size -= originalArg->getNominalSize();
+ }
+ }
+ else
+ {
+ ASSERT(originalArg->isMatrix());
+ if (scalarizeMatrix)
+ {
+ int colIndex = 0, rowIndex = 0;
+ int repeat = std::min(size, originalArg->getCols() * originalArg->getRows());
+ size -= repeat;
+ while (repeat > 0)
+ {
+ TIntermSymbol *symbolNode = CreateTempSymbolNode(argVariable);
+ TIntermBinary *newNode =
+ ConstructMatrixIndexBinaryNode(symbolNode, colIndex, rowIndex);
+ sequence->push_back(newNode);
+ rowIndex++;
+ if (rowIndex >= originalArg->getRows())
+ {
+ rowIndex = 0;
+ colIndex++;
+ }
+ repeat--;
+ }
+ }
+ else
+ {
+ TIntermSymbol *symbolNode = CreateTempSymbolNode(argVariable);
+ sequence->push_back(symbolNode);
+ size -= originalArg->getCols() * originalArg->getRows();
+ }
+ }
+ }
+}
+
+TVariable *ScalarizeArgsTraverser::createTempVariable(TIntermTyped *original)
+{
+ ASSERT(original);
+
+ TType *type = new TType(original->getType());
+ type->setQualifier(EvqTemporary);
+ if (mShaderType == GL_FRAGMENT_SHADER && type->getBasicType() == EbtFloat &&
+ type->getPrecision() == EbpUndefined)
+ {
+ // We use the highest available precision for the temporary variable
+ // to avoid computing the actual precision using the rules defined
+ // in GLSL ES 1.0 Section 4.5.2.
+ type->setPrecision(mFragmentPrecisionHigh ? EbpHigh : EbpMedium);
+ }
+
+ TVariable *variable = CreateTempVariable(mSymbolTable, type);
+
+ ASSERT(mBlockStack.size() > 0);
+ TIntermSequence &sequence = mBlockStack.back();
+ TIntermDeclaration *declaration = CreateTempInitDeclarationNode(variable, original);
+ sequence.push_back(declaration);
+
+ return variable;
+}
+
+} // namespace
+
+void ScalarizeVecAndMatConstructorArgs(TIntermBlock *root,
+ sh::GLenum shaderType,
+ bool fragmentPrecisionHigh,
+ TSymbolTable *symbolTable)
+{
+ ScalarizeArgsTraverser scalarizer(shaderType, fragmentPrecisionHigh, symbolTable);
+ root->traverse(&scalarizer);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h
new file mode 100644
index 0000000000..e66908de1d
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h
@@ -0,0 +1,27 @@
+//
+// 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.
+//
+// Scalarize vector and matrix constructor args, so that vectors built from components don't have
+// matrix arguments, and matrices built from components don't have vector arguments. This avoids
+// driver bugs around vector and matrix constructors.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
+
+#include "GLSLANG/ShaderLang.h"
+
+namespace sh
+{
+class TIntermBlock;
+class TSymbolTable;
+
+void ScalarizeVecAndMatConstructorArgs(TIntermBlock *root,
+ sh::GLenum shaderType,
+ bool fragmentPrecisionHigh,
+ TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp
new file mode 100644
index 0000000000..5b4672bf24
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp
@@ -0,0 +1,84 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SeparateArrayConstructorStatements splits statements that are array constructors and drops all of
+// their constant arguments. For example, a statement like:
+// int[2](0, i++);
+// Will be changed to:
+// i++;
+
+#include "compiler/translator/tree_ops/SeparateArrayConstructorStatements.h"
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void SplitConstructorArgs(const TIntermSequence &originalArgs, TIntermSequence *argsOut)
+{
+ for (TIntermNode *arg : originalArgs)
+ {
+ TIntermTyped *argTyped = arg->getAsTyped();
+ if (argTyped->hasSideEffects())
+ {
+ TIntermAggregate *argAggregate = argTyped->getAsAggregate();
+ if (argTyped->isArray() && argAggregate && argAggregate->isConstructor())
+ {
+ SplitConstructorArgs(*argAggregate->getSequence(), argsOut);
+ }
+ else
+ {
+ argsOut->push_back(argTyped);
+ }
+ }
+ }
+}
+
+class SeparateArrayConstructorStatementsTraverser : public TIntermTraverser
+{
+ public:
+ SeparateArrayConstructorStatementsTraverser();
+
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+};
+
+SeparateArrayConstructorStatementsTraverser::SeparateArrayConstructorStatementsTraverser()
+ : TIntermTraverser(true, false, false)
+{}
+
+bool SeparateArrayConstructorStatementsTraverser::visitAggregate(Visit visit,
+ TIntermAggregate *node)
+{
+ TIntermBlock *parentAsBlock = getParentNode()->getAsBlock();
+ if (!parentAsBlock)
+ {
+ return false;
+ }
+ if (!node->isArray() || !node->isConstructor())
+ {
+ return false;
+ }
+
+ TIntermSequence constructorArgs;
+ SplitConstructorArgs(*node->getSequence(), &constructorArgs);
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(parentAsBlock, node, constructorArgs));
+
+ return false;
+}
+
+} // namespace
+
+void SeparateArrayConstructorStatements(TIntermBlock *root)
+{
+ SeparateArrayConstructorStatementsTraverser traverser;
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.h
new file mode 100644
index 0000000000..740ba95aca
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SeparateArrayConstructorStatements splits statements that are array constructors and drops all of
+// their constant arguments. For example, a statement like:
+// int[2](0, i++);
+// Will be changed to:
+// i++;
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
+
+namespace sh
+{
+class TIntermBlock;
+
+void SeparateArrayConstructorStatements(TIntermBlock *root);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp
new file mode 100644
index 0000000000..435ba9d6c4
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp
@@ -0,0 +1,90 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The SeparateArrayInitialization function splits each array initialization into a declaration and
+// an assignment.
+// Example:
+// type[n] a = initializer;
+// will effectively become
+// type[n] a;
+// a = initializer;
+//
+// Note that if the array is declared as const, the initialization may still be split, making the
+// AST technically invalid. Because of that this transformation should only be used when subsequent
+// stages don't care about const qualifiers. However, the initialization will not be split if the
+// initializer can be written as a HLSL literal.
+
+#include "compiler/translator/tree_ops/SeparateArrayInitialization.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/OutputHLSL.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class SeparateArrayInitTraverser : private TIntermTraverser
+{
+ public:
+ static void apply(TIntermNode *root);
+
+ private:
+ SeparateArrayInitTraverser();
+ bool visitDeclaration(Visit, TIntermDeclaration *node) override;
+};
+
+void SeparateArrayInitTraverser::apply(TIntermNode *root)
+{
+ SeparateArrayInitTraverser separateInit;
+ root->traverse(&separateInit);
+ separateInit.updateTree();
+}
+
+SeparateArrayInitTraverser::SeparateArrayInitTraverser() : TIntermTraverser(true, false, false) {}
+
+bool SeparateArrayInitTraverser::visitDeclaration(Visit, TIntermDeclaration *node)
+{
+ TIntermSequence *sequence = node->getSequence();
+ TIntermBinary *initNode = sequence->back()->getAsBinaryNode();
+ if (initNode != nullptr && initNode->getOp() == EOpInitialize)
+ {
+ TIntermTyped *initializer = initNode->getRight();
+ if (initializer->isArray() && !initializer->hasConstantValue())
+ {
+ // We rely on that array declarations have been isolated to single declarations.
+ ASSERT(sequence->size() == 1);
+ TIntermTyped *symbol = initNode->getLeft();
+ TIntermBlock *parentBlock = getParentNode()->getAsBlock();
+ ASSERT(parentBlock != nullptr);
+
+ TIntermSequence replacements;
+
+ TIntermDeclaration *replacementDeclaration = new TIntermDeclaration();
+ replacementDeclaration->appendDeclarator(symbol);
+ replacementDeclaration->setLine(symbol->getLine());
+ replacements.push_back(replacementDeclaration);
+
+ TIntermBinary *replacementAssignment =
+ new TIntermBinary(EOpAssign, symbol, initializer);
+ replacementAssignment->setLine(symbol->getLine());
+ replacements.push_back(replacementAssignment);
+
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(parentBlock, node, replacements));
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+void SeparateArrayInitialization(TIntermNode *root)
+{
+ SeparateArrayInitTraverser::apply(root);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.h
new file mode 100644
index 0000000000..a197ff5a86
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.h
@@ -0,0 +1,29 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The SeparateArrayInitialization function splits each array initialization into a declaration and
+// an assignment.
+// Example:
+// type[n] a = initializer;
+// will effectively become
+// type[n] a;
+// a = initializer;
+//
+// Note that if the array is declared as const, the initialization may still be split, making the
+// AST technically invalid. Because of that this transformation should only be used when subsequent
+// stages don't care about const qualifiers. However, the initialization will not be split if the
+// initializer can be written as a HLSL literal.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_
+#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_
+
+namespace sh
+{
+class TIntermNode;
+
+void SeparateArrayInitialization(TIntermNode *root);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp
new file mode 100644
index 0000000000..82011acd8a
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp
@@ -0,0 +1,78 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The SeparateDeclarations function processes declarations, so that in the end each declaration
+// contains only one declarator.
+// This is useful as an intermediate step when initialization needs to be separated from
+// declaration, or when things need to be unfolded out of the initializer.
+// Example:
+// int a[1] = int[1](1), b[1] = int[1](2);
+// gets transformed when run through this class into the AST equivalent of:
+// int a[1] = int[1](1);
+// int b[1] = int[1](2);
+
+#include "compiler/translator/tree_ops/SeparateDeclarations.h"
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class SeparateDeclarationsTraverser : private TIntermTraverser
+{
+ public:
+ static void apply(TIntermNode *root);
+
+ private:
+ SeparateDeclarationsTraverser();
+ bool visitDeclaration(Visit, TIntermDeclaration *node) override;
+};
+
+void SeparateDeclarationsTraverser::apply(TIntermNode *root)
+{
+ SeparateDeclarationsTraverser separateDecl;
+ root->traverse(&separateDecl);
+ separateDecl.updateTree();
+}
+
+SeparateDeclarationsTraverser::SeparateDeclarationsTraverser()
+ : TIntermTraverser(true, false, false)
+{}
+
+bool SeparateDeclarationsTraverser::visitDeclaration(Visit, TIntermDeclaration *node)
+{
+ TIntermSequence *sequence = node->getSequence();
+ if (sequence->size() > 1)
+ {
+ TIntermBlock *parentBlock = getParentNode()->getAsBlock();
+ ASSERT(parentBlock != nullptr);
+
+ TIntermSequence replacementDeclarations;
+ for (size_t ii = 0; ii < sequence->size(); ++ii)
+ {
+ TIntermDeclaration *replacementDeclaration = new TIntermDeclaration();
+
+ replacementDeclaration->appendDeclarator(sequence->at(ii)->getAsTyped());
+ replacementDeclaration->setLine(sequence->at(ii)->getLine());
+ replacementDeclarations.push_back(replacementDeclaration);
+ }
+
+ mMultiReplacements.push_back(
+ NodeReplaceWithMultipleEntry(parentBlock, node, replacementDeclarations));
+ }
+ return false;
+}
+
+} // namespace
+
+void SeparateDeclarations(TIntermNode *root)
+{
+ SeparateDeclarationsTraverser::apply(root);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.h
new file mode 100644
index 0000000000..1e7f967be9
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.h
@@ -0,0 +1,26 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// The SeparateDeclarations function processes declarations, so that in the end each declaration
+// contains only one declarator.
+// This is useful as an intermediate step when initialization needs to be separated from
+// declaration, or when things need to be unfolded out of the initializer.
+// Example:
+// int a[1] = int[1](1), b[1] = int[1](2);
+// gets transformed when run through this class into the AST equivalent of:
+// int a[1] = int[1](1);
+// int b[1] = int[1](2);
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_
+
+namespace sh
+{
+class TIntermNode;
+
+void SeparateDeclarations(TIntermNode *root);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp
new file mode 100644
index 0000000000..127e97ebcf
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp
@@ -0,0 +1,129 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SeparateExpressionsReturningArrays splits array-returning expressions that are not array names
+// from more complex expressions, assigning them to a temporary variable a#.
+// Examples where a, b and c are all arrays:
+// (a = b) == (a = c) is split into a = b; type[n] a1 = a; a = c; type[n] a2 = a; a1 == a2;
+// type d = type[n](...)[i]; is split into type[n] a1 = type[n](...); type d = a1[i];
+
+#include "compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h"
+
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// Traverser that separates one array expression into a statement at a time.
+class SeparateExpressionsTraverser : public TIntermTraverser
+{
+ public:
+ SeparateExpressionsTraverser(TSymbolTable *symbolTable);
+
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+
+ void nextIteration();
+ bool foundArrayExpression() const { return mFoundArrayExpression; }
+
+ protected:
+ // Marked to true once an operation that needs to be hoisted out of the expression has been
+ // found. After that, no more AST updates are performed on that traversal.
+ bool mFoundArrayExpression;
+
+ IntermNodePatternMatcher mPatternToSeparateMatcher;
+};
+
+SeparateExpressionsTraverser::SeparateExpressionsTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable),
+ mFoundArrayExpression(false),
+ mPatternToSeparateMatcher(IntermNodePatternMatcher::kExpressionReturningArray)
+{}
+
+// Performs a shallow copy of an assignment node.
+// These shallow copies are useful when a node gets inserted into an aggregate node
+// and also needs to be replaced in its original location by a different node.
+TIntermBinary *CopyAssignmentNode(TIntermBinary *node)
+{
+ return new TIntermBinary(node->getOp(), node->getLeft(), node->getRight());
+}
+
+bool SeparateExpressionsTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ if (mFoundArrayExpression)
+ return false;
+
+ // Return if the expression is not an array or if we're not inside a complex expression.
+ if (!mPatternToSeparateMatcher.match(node, getParentNode()))
+ return true;
+
+ ASSERT(node->getOp() == EOpAssign);
+
+ mFoundArrayExpression = true;
+
+ TIntermSequence insertions;
+ insertions.push_back(CopyAssignmentNode(node));
+ // TODO(oetuaho): In some cases it would be more optimal to not add the temporary node, but just
+ // use the original target of the assignment. Care must be taken so that this doesn't happen
+ // when the same array symbol is a target of assignment more than once in one expression.
+ TIntermDeclaration *arrayVariableDeclaration;
+ TVariable *arrayVariable =
+ DeclareTempVariable(mSymbolTable, node->getLeft(), EvqTemporary, &arrayVariableDeclaration);
+ insertions.push_back(arrayVariableDeclaration);
+ insertStatementsInParentBlock(insertions);
+
+ queueReplacement(CreateTempSymbolNode(arrayVariable), OriginalNode::IS_DROPPED);
+
+ return false;
+}
+
+bool SeparateExpressionsTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (mFoundArrayExpression)
+ return false; // No need to traverse further
+
+ if (!mPatternToSeparateMatcher.match(node, getParentNode()))
+ return true;
+
+ ASSERT(node->isConstructor() || node->getOp() == EOpCallFunctionInAST);
+
+ mFoundArrayExpression = true;
+
+ TIntermDeclaration *arrayVariableDeclaration;
+ TVariable *arrayVariable = DeclareTempVariable(mSymbolTable, node->shallowCopy(), EvqTemporary,
+ &arrayVariableDeclaration);
+ insertStatementInParentBlock(arrayVariableDeclaration);
+
+ queueReplacement(CreateTempSymbolNode(arrayVariable), OriginalNode::IS_DROPPED);
+
+ return false;
+}
+
+void SeparateExpressionsTraverser::nextIteration()
+{
+ mFoundArrayExpression = false;
+}
+
+} // namespace
+
+void SeparateExpressionsReturningArrays(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ SeparateExpressionsTraverser traverser(symbolTable);
+ // Separate one expression at a time, and reset the traverser between iterations.
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.foundArrayExpression())
+ traverser.updateTree();
+ } while (traverser.foundArrayExpression());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h
new file mode 100644
index 0000000000..9b09f7c61e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SeparateExpressionsReturningArrays splits array-returning expressions that are not array names
+// from more complex expressions, assigning them to a temporary variable a#.
+// Examples where a, b and c are all arrays:
+// (a = b) == (a = c) is split into a = b; type[n] a1 = a; a = c; type[n] a2 = a; a1 == a2;
+// type d = type[n](...)[i]; is split into type[n] a1 = type[n](...); type d = a1[i];
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
+
+namespace sh
+{
+class TIntermNode;
+class TSymbolTable;
+
+void SeparateExpressionsReturningArrays(TIntermNode *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp
new file mode 100644
index 0000000000..35d3c33f34
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp
@@ -0,0 +1,299 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SimplifyLoopConditions is an AST traverser that converts loop conditions and loop expressions
+// to regular statements inside the loop. This way further transformations that generate statements
+// from loop conditions and loop expressions work correctly.
+//
+
+#include "compiler/translator/tree_ops/SimplifyLoopConditions.h"
+
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class SimplifyLoopConditionsTraverser : public TLValueTrackingTraverser
+{
+ public:
+ SimplifyLoopConditionsTraverser(unsigned int conditionsToSimplifyMask,
+ TSymbolTable *symbolTable);
+
+ void traverseLoop(TIntermLoop *node) override;
+
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
+
+ bool foundLoopToChange() const { return mFoundLoopToChange; }
+
+ protected:
+ // Marked to true once an operation that needs to be hoisted out of a loop expression has been
+ // found.
+ bool mFoundLoopToChange;
+ bool mInsideLoopInitConditionOrExpression;
+ IntermNodePatternMatcher mConditionsToSimplify;
+};
+
+SimplifyLoopConditionsTraverser::SimplifyLoopConditionsTraverser(
+ unsigned int conditionsToSimplifyMask,
+ TSymbolTable *symbolTable)
+ : TLValueTrackingTraverser(true, false, false, symbolTable),
+ mFoundLoopToChange(false),
+ mInsideLoopInitConditionOrExpression(false),
+ mConditionsToSimplify(conditionsToSimplifyMask)
+{}
+
+// If we're inside a loop initialization, condition, or expression, we check for expressions that
+// should be moved out of the loop condition or expression. If one is found, the loop is
+// transformed.
+// If we're not inside loop initialization, condition, or expression, we only need to traverse nodes
+// that may contain loops.
+
+bool SimplifyLoopConditionsTraverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ if (!mInsideLoopInitConditionOrExpression)
+ return false;
+
+ if (mFoundLoopToChange)
+ return false; // Already decided to change this loop.
+
+ mFoundLoopToChange = mConditionsToSimplify.match(node);
+ return !mFoundLoopToChange;
+}
+
+bool SimplifyLoopConditionsTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ if (!mInsideLoopInitConditionOrExpression)
+ return false;
+
+ if (mFoundLoopToChange)
+ return false; // Already decided to change this loop.
+
+ mFoundLoopToChange = mConditionsToSimplify.match(node, getParentNode(), isLValueRequiredHere());
+ return !mFoundLoopToChange;
+}
+
+bool SimplifyLoopConditionsTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (!mInsideLoopInitConditionOrExpression)
+ return false;
+
+ if (mFoundLoopToChange)
+ return false; // Already decided to change this loop.
+
+ mFoundLoopToChange = mConditionsToSimplify.match(node, getParentNode());
+ return !mFoundLoopToChange;
+}
+
+bool SimplifyLoopConditionsTraverser::visitTernary(Visit visit, TIntermTernary *node)
+{
+ if (!mInsideLoopInitConditionOrExpression)
+ return false;
+
+ if (mFoundLoopToChange)
+ return false; // Already decided to change this loop.
+
+ mFoundLoopToChange = mConditionsToSimplify.match(node);
+ return !mFoundLoopToChange;
+}
+
+bool SimplifyLoopConditionsTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node)
+{
+ if (!mInsideLoopInitConditionOrExpression)
+ return false;
+
+ if (mFoundLoopToChange)
+ return false; // Already decided to change this loop.
+
+ mFoundLoopToChange = mConditionsToSimplify.match(node);
+ return !mFoundLoopToChange;
+}
+
+void SimplifyLoopConditionsTraverser::traverseLoop(TIntermLoop *node)
+{
+ // Mark that we're inside a loop condition or expression, and determine if the loop needs to be
+ // transformed.
+
+ ScopedNodeInTraversalPath addToPath(this, node);
+
+ mInsideLoopInitConditionOrExpression = true;
+ mFoundLoopToChange = false;
+
+ if (!mFoundLoopToChange && node->getInit())
+ {
+ node->getInit()->traverse(this);
+ }
+
+ if (!mFoundLoopToChange && node->getCondition())
+ {
+ node->getCondition()->traverse(this);
+ }
+
+ if (!mFoundLoopToChange && node->getExpression())
+ {
+ node->getExpression()->traverse(this);
+ }
+
+ mInsideLoopInitConditionOrExpression = false;
+
+ if (mFoundLoopToChange)
+ {
+ const TType *boolType = StaticType::Get<EbtBool, EbpUndefined, EvqTemporary, 1, 1>();
+ TVariable *conditionVariable = CreateTempVariable(mSymbolTable, boolType);
+
+ // Replace the loop condition with a boolean variable that's updated on each iteration.
+ TLoopType loopType = node->getType();
+ if (loopType == ELoopWhile)
+ {
+ // Transform:
+ // while (expr) { body; }
+ // into
+ // bool s0 = expr;
+ // while (s0) { { body; } s0 = expr; }
+ TIntermDeclaration *tempInitDeclaration =
+ CreateTempInitDeclarationNode(conditionVariable, node->getCondition()->deepCopy());
+ insertStatementInParentBlock(tempInitDeclaration);
+
+ TIntermBlock *newBody = new TIntermBlock();
+ if (node->getBody())
+ {
+ newBody->getSequence()->push_back(node->getBody());
+ }
+ newBody->getSequence()->push_back(
+ CreateTempAssignmentNode(conditionVariable, node->getCondition()->deepCopy()));
+
+ // Can't use queueReplacement to replace old body, since it may have been nullptr.
+ // It's safe to do the replacements in place here - the new body will still be
+ // traversed, but that won't create any problems.
+ node->setBody(newBody);
+ node->setCondition(CreateTempSymbolNode(conditionVariable));
+ }
+ else if (loopType == ELoopDoWhile)
+ {
+ // Transform:
+ // do {
+ // body;
+ // } while (expr);
+ // into
+ // bool s0 = true;
+ // do {
+ // { body; }
+ // s0 = expr;
+ // } while (s0);
+ TIntermDeclaration *tempInitDeclaration =
+ CreateTempInitDeclarationNode(conditionVariable, CreateBoolNode(true));
+ insertStatementInParentBlock(tempInitDeclaration);
+
+ TIntermBlock *newBody = new TIntermBlock();
+ if (node->getBody())
+ {
+ newBody->getSequence()->push_back(node->getBody());
+ }
+ newBody->getSequence()->push_back(
+ CreateTempAssignmentNode(conditionVariable, node->getCondition()->deepCopy()));
+
+ // Can't use queueReplacement to replace old body, since it may have been nullptr.
+ // It's safe to do the replacements in place here - the new body will still be
+ // traversed, but that won't create any problems.
+ node->setBody(newBody);
+ node->setCondition(CreateTempSymbolNode(conditionVariable));
+ }
+ else if (loopType == ELoopFor)
+ {
+ // Move the loop condition inside the loop.
+ // Transform:
+ // for (init; expr; exprB) { body; }
+ // into
+ // {
+ // init;
+ // bool s0 = expr;
+ // while (s0) {
+ // { body; }
+ // exprB;
+ // s0 = expr;
+ // }
+ // }
+ TIntermBlock *loopScope = new TIntermBlock();
+ TIntermSequence *loopScopeSequence = loopScope->getSequence();
+
+ // Insert "init;"
+ if (node->getInit())
+ {
+ loopScopeSequence->push_back(node->getInit());
+ }
+
+ // Insert "bool s0 = expr;" if applicable, "bool s0 = true;" otherwise
+ TIntermTyped *conditionInitializer = nullptr;
+ if (node->getCondition())
+ {
+ conditionInitializer = node->getCondition()->deepCopy();
+ }
+ else
+ {
+ conditionInitializer = CreateBoolNode(true);
+ }
+ loopScopeSequence->push_back(
+ CreateTempInitDeclarationNode(conditionVariable, conditionInitializer));
+
+ // Insert "{ body; }" in the while loop
+ TIntermBlock *whileLoopBody = new TIntermBlock();
+ if (node->getBody())
+ {
+ whileLoopBody->getSequence()->push_back(node->getBody());
+ }
+ // Insert "exprB;" in the while loop
+ if (node->getExpression())
+ {
+ whileLoopBody->getSequence()->push_back(node->getExpression());
+ }
+ // Insert "s0 = expr;" in the while loop
+ if (node->getCondition())
+ {
+ whileLoopBody->getSequence()->push_back(
+ CreateTempAssignmentNode(conditionVariable, node->getCondition()->deepCopy()));
+ }
+
+ // Create "while(s0) { whileLoopBody }"
+ TIntermLoop *whileLoop =
+ new TIntermLoop(ELoopWhile, nullptr, CreateTempSymbolNode(conditionVariable),
+ nullptr, whileLoopBody);
+ loopScope->getSequence()->push_back(whileLoop);
+ queueReplacement(loopScope, OriginalNode::IS_DROPPED);
+
+ // After this the old body node will be traversed and loops inside it may be
+ // transformed. This is fine, since the old body node will still be in the AST after the
+ // transformation that's queued here, and transforming loops inside it doesn't need to
+ // know the exact post-transform path to it.
+ }
+ }
+
+ mFoundLoopToChange = false;
+
+ // We traverse the body of the loop even if the loop is transformed.
+ if (node->getBody())
+ node->getBody()->traverse(this);
+}
+
+} // namespace
+
+void SimplifyLoopConditions(TIntermNode *root,
+ unsigned int conditionsToSimplifyMask,
+ TSymbolTable *symbolTable)
+{
+ SimplifyLoopConditionsTraverser traverser(conditionsToSimplifyMask, symbolTable);
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.h
new file mode 100644
index 0000000000..15265bb577
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.h
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SimplifyLoopConditions is an AST traverser that converts loop conditions and loop expressions
+// to regular statements inside the loop. This way further transformations that generate statements
+// from loop conditions and loop expressions work correctly.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_SIMPLIFYLOOPCONDITIONS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_SIMPLIFYLOOPCONDITIONS_H_
+
+namespace sh
+{
+class TIntermNode;
+class TSymbolTable;
+
+void SimplifyLoopConditions(TIntermNode *root,
+ unsigned int conditionsToSimplify,
+ TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_SIMPLIFYLOOPCONDITIONS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp
new file mode 100644
index 0000000000..72804946fa
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp
@@ -0,0 +1,163 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SplitSequenceOperator is an AST traverser that detects sequence operator expressions that
+// go through further AST transformations that generate statements, and splits them so that
+// possible side effects of earlier parts of the sequence operator expression are guaranteed to be
+// evaluated before the latter parts of the sequence operator expression are evaluated.
+//
+
+#include "compiler/translator/tree_ops/SplitSequenceOperator.h"
+
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class SplitSequenceOperatorTraverser : public TLValueTrackingTraverser
+{
+ public:
+ SplitSequenceOperatorTraverser(unsigned int patternsToSplitMask, TSymbolTable *symbolTable);
+
+ bool visitUnary(Visit visit, TIntermUnary *node) override;
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
+
+ void nextIteration();
+ bool foundExpressionToSplit() const { return mFoundExpressionToSplit; }
+
+ protected:
+ // Marked to true once an operation that needs to be hoisted out of the expression has been
+ // found. After that, no more AST updates are performed on that traversal.
+ bool mFoundExpressionToSplit;
+ int mInsideSequenceOperator;
+
+ IntermNodePatternMatcher mPatternToSplitMatcher;
+};
+
+SplitSequenceOperatorTraverser::SplitSequenceOperatorTraverser(unsigned int patternsToSplitMask,
+ TSymbolTable *symbolTable)
+ : TLValueTrackingTraverser(true, false, true, symbolTable),
+ mFoundExpressionToSplit(false),
+ mInsideSequenceOperator(0),
+ mPatternToSplitMatcher(patternsToSplitMask)
+{}
+
+void SplitSequenceOperatorTraverser::nextIteration()
+{
+ mFoundExpressionToSplit = false;
+ mInsideSequenceOperator = 0;
+}
+
+bool SplitSequenceOperatorTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+ if (mFoundExpressionToSplit)
+ return false;
+
+ if (mInsideSequenceOperator > 0 && visit == PreVisit)
+ {
+ // Detect expressions that need to be simplified
+ mFoundExpressionToSplit = mPatternToSplitMatcher.match(node, getParentNode());
+ return !mFoundExpressionToSplit;
+ }
+
+ return true;
+}
+
+bool SplitSequenceOperatorTraverser::visitUnary(Visit visit, TIntermUnary *node)
+{
+ if (mFoundExpressionToSplit)
+ return false;
+
+ if (mInsideSequenceOperator > 0 && visit == PreVisit)
+ {
+ // Detect expressions that need to be simplified
+ mFoundExpressionToSplit = mPatternToSplitMatcher.match(node);
+ return !mFoundExpressionToSplit;
+ }
+
+ return true;
+}
+
+bool SplitSequenceOperatorTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ if (node->getOp() == EOpComma)
+ {
+ if (visit == PreVisit)
+ {
+ if (mFoundExpressionToSplit)
+ {
+ return false;
+ }
+ mInsideSequenceOperator++;
+ }
+ else if (visit == PostVisit)
+ {
+ // Split sequence operators starting from the outermost one to preserve correct
+ // execution order.
+ if (mFoundExpressionToSplit && mInsideSequenceOperator == 1)
+ {
+ // Move the left side operand into a separate statement in the parent block.
+ TIntermSequence insertions;
+ insertions.push_back(node->getLeft());
+ insertStatementsInParentBlock(insertions);
+ // Replace the comma node with its right side operand.
+ queueReplacement(node->getRight(), OriginalNode::IS_DROPPED);
+ }
+ mInsideSequenceOperator--;
+ }
+ return true;
+ }
+
+ if (mFoundExpressionToSplit)
+ return false;
+
+ if (mInsideSequenceOperator > 0 && visit == PreVisit)
+ {
+ // Detect expressions that need to be simplified
+ mFoundExpressionToSplit =
+ mPatternToSplitMatcher.match(node, getParentNode(), isLValueRequiredHere());
+ return !mFoundExpressionToSplit;
+ }
+
+ return true;
+}
+
+bool SplitSequenceOperatorTraverser::visitTernary(Visit visit, TIntermTernary *node)
+{
+ if (mFoundExpressionToSplit)
+ return false;
+
+ if (mInsideSequenceOperator > 0 && visit == PreVisit)
+ {
+ // Detect expressions that need to be simplified
+ mFoundExpressionToSplit = mPatternToSplitMatcher.match(node);
+ return !mFoundExpressionToSplit;
+ }
+
+ return true;
+}
+
+} // namespace
+
+void SplitSequenceOperator(TIntermNode *root, int patternsToSplitMask, TSymbolTable *symbolTable)
+{
+ SplitSequenceOperatorTraverser traverser(patternsToSplitMask, symbolTable);
+ // Separate one expression at a time, and reset the traverser between iterations.
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.foundExpressionToSplit())
+ traverser.updateTree();
+ } while (traverser.foundExpressionToSplit());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.h
new file mode 100644
index 0000000000..fc341c968e
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.h
@@ -0,0 +1,25 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SplitSequenceOperator is an AST traverser that detects sequence operator expressions that
+// go through further AST transformations that generate statements, and splits them so that
+// possible side effects of earlier parts of the sequence operator expression are guaranteed to be
+// evaluated before the latter parts of the sequence operator expression are evaluated.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_SPLITSEQUENCEOPERATOR_H_
+#define COMPILER_TRANSLATOR_TREEOPS_SPLITSEQUENCEOPERATOR_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TSymbolTable;
+
+void SplitSequenceOperator(TIntermNode *root, int patternsToSplitMask, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_SPLITSEQUENCEOPERATOR_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp
new file mode 100644
index 0000000000..e408714fde
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp
@@ -0,0 +1,74 @@
+//
+// 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.
+//
+
+#include "compiler/translator/tree_ops/UnfoldShortCircuitAST.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// "x || y" is equivalent to "x ? true : y".
+TIntermTernary *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
+{
+ return new TIntermTernary(x, CreateBoolNode(true), y);
+}
+
+// "x && y" is equivalent to "x ? y : false".
+TIntermTernary *UnfoldAND(TIntermTyped *x, TIntermTyped *y)
+{
+ return new TIntermTernary(x, y, CreateBoolNode(false));
+}
+
+// This traverser identifies all the short circuit binary nodes that need to
+// be replaced, and creates the corresponding replacement nodes. However,
+// the actual replacements happen after the traverse through updateTree().
+
+class UnfoldShortCircuitASTTraverser : public TIntermTraverser
+{
+ public:
+ UnfoldShortCircuitASTTraverser() : TIntermTraverser(true, false, false) {}
+
+ bool visitBinary(Visit visit, TIntermBinary *) override;
+};
+
+bool UnfoldShortCircuitASTTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ TIntermTernary *replacement = nullptr;
+
+ switch (node->getOp())
+ {
+ case EOpLogicalOr:
+ replacement = UnfoldOR(node->getLeft(), node->getRight());
+ break;
+ case EOpLogicalAnd:
+ replacement = UnfoldAND(node->getLeft(), node->getRight());
+ break;
+ default:
+ break;
+ }
+ if (replacement)
+ {
+ queueReplacement(replacement, OriginalNode::IS_DROPPED);
+ }
+ return true;
+}
+
+} // anonymous namespace
+
+void UnfoldShortCircuitAST(TIntermBlock *root)
+{
+ UnfoldShortCircuitASTTraverser traverser;
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.h
new file mode 100644
index 0000000000..7f492a9ca0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.h
@@ -0,0 +1,22 @@
+//
+// 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.
+//
+// UnfoldShortCircuitAST is an AST traverser to replace short-circuiting
+// operations with ternary operations.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_
+#define COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+
+void UnfoldShortCircuitAST(TIntermBlock *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp
new file mode 100644
index 0000000000..4a86c04766
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp
@@ -0,0 +1,193 @@
+//
+// 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.
+//
+// UnfoldShortCircuitToIf is an AST traverser to convert short-circuiting operators to if-else
+// statements.
+// The results are assigned to s# temporaries, which are used by the main translator instead of
+// the original expression.
+//
+
+#include "compiler/translator/tree_ops/UnfoldShortCircuitToIf.h"
+
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+// Traverser that unfolds one short-circuiting operation at a time.
+class UnfoldShortCircuitTraverser : public TIntermTraverser
+{
+ public:
+ UnfoldShortCircuitTraverser(TSymbolTable *symbolTable);
+
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitTernary(Visit visit, TIntermTernary *node) override;
+
+ void nextIteration();
+ bool foundShortCircuit() const { return mFoundShortCircuit; }
+
+ protected:
+ // Marked to true once an operation that needs to be unfolded has been found.
+ // After that, no more unfolding is performed on that traversal.
+ bool mFoundShortCircuit;
+
+ IntermNodePatternMatcher mPatternToUnfoldMatcher;
+};
+
+UnfoldShortCircuitTraverser::UnfoldShortCircuitTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, true, symbolTable),
+ mFoundShortCircuit(false),
+ mPatternToUnfoldMatcher(IntermNodePatternMatcher::kUnfoldedShortCircuitExpression)
+{}
+
+bool UnfoldShortCircuitTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+ if (mFoundShortCircuit)
+ return false;
+
+ if (visit != PreVisit)
+ return true;
+
+ if (!mPatternToUnfoldMatcher.match(node, getParentNode()))
+ return true;
+
+ // If our right node doesn't have side effects, we know we don't need to unfold this
+ // expression: there will be no short-circuiting side effects to avoid
+ // (note: unfolding doesn't depend on the left node -- it will always be evaluated)
+ ASSERT(node->getRight()->hasSideEffects());
+
+ mFoundShortCircuit = true;
+
+ switch (node->getOp())
+ {
+ case EOpLogicalOr:
+ {
+ // "x || y" is equivalent to "x ? true : y", which unfolds to "bool s; if(x) s = true;
+ // else s = y;",
+ // and then further simplifies down to "bool s = x; if(!s) s = y;".
+
+ TIntermSequence insertions;
+ const TType *boolType = StaticType::Get<EbtBool, EbpUndefined, EvqTemporary, 1, 1>();
+ TVariable *resultVariable = CreateTempVariable(mSymbolTable, boolType);
+
+ ASSERT(node->getLeft()->getType() == *boolType);
+ insertions.push_back(CreateTempInitDeclarationNode(resultVariable, node->getLeft()));
+
+ TIntermBlock *assignRightBlock = new TIntermBlock();
+ ASSERT(node->getRight()->getType() == *boolType);
+ assignRightBlock->getSequence()->push_back(
+ CreateTempAssignmentNode(resultVariable, node->getRight()));
+
+ TIntermUnary *notTempSymbol =
+ new TIntermUnary(EOpLogicalNot, CreateTempSymbolNode(resultVariable), nullptr);
+ TIntermIfElse *ifNode = new TIntermIfElse(notTempSymbol, assignRightBlock, nullptr);
+ insertions.push_back(ifNode);
+
+ insertStatementsInParentBlock(insertions);
+
+ queueReplacement(CreateTempSymbolNode(resultVariable), OriginalNode::IS_DROPPED);
+ return false;
+ }
+ case EOpLogicalAnd:
+ {
+ // "x && y" is equivalent to "x ? y : false", which unfolds to "bool s; if(x) s = y;
+ // else s = false;",
+ // and then further simplifies down to "bool s = x; if(s) s = y;".
+ TIntermSequence insertions;
+ const TType *boolType = StaticType::Get<EbtBool, EbpUndefined, EvqTemporary, 1, 1>();
+ TVariable *resultVariable = CreateTempVariable(mSymbolTable, boolType);
+
+ ASSERT(node->getLeft()->getType() == *boolType);
+ insertions.push_back(CreateTempInitDeclarationNode(resultVariable, node->getLeft()));
+
+ TIntermBlock *assignRightBlock = new TIntermBlock();
+ ASSERT(node->getRight()->getType() == *boolType);
+ assignRightBlock->getSequence()->push_back(
+ CreateTempAssignmentNode(resultVariable, node->getRight()));
+
+ TIntermIfElse *ifNode =
+ new TIntermIfElse(CreateTempSymbolNode(resultVariable), assignRightBlock, nullptr);
+ insertions.push_back(ifNode);
+
+ insertStatementsInParentBlock(insertions);
+
+ queueReplacement(CreateTempSymbolNode(resultVariable), OriginalNode::IS_DROPPED);
+ return false;
+ }
+ default:
+ UNREACHABLE();
+ return true;
+ }
+}
+
+bool UnfoldShortCircuitTraverser::visitTernary(Visit visit, TIntermTernary *node)
+{
+ if (mFoundShortCircuit)
+ return false;
+
+ if (visit != PreVisit)
+ return true;
+
+ if (!mPatternToUnfoldMatcher.match(node))
+ return true;
+
+ mFoundShortCircuit = true;
+
+ // Unfold "b ? x : y" into "type s; if(b) s = x; else s = y;"
+ TIntermSequence insertions;
+ TIntermDeclaration *tempDeclaration = nullptr;
+ TVariable *resultVariable = DeclareTempVariable(mSymbolTable, new TType(node->getType()),
+ EvqTemporary, &tempDeclaration);
+ insertions.push_back(tempDeclaration);
+
+ TIntermBlock *trueBlock = new TIntermBlock();
+ TIntermBinary *trueAssignment =
+ CreateTempAssignmentNode(resultVariable, node->getTrueExpression());
+ trueBlock->getSequence()->push_back(trueAssignment);
+
+ TIntermBlock *falseBlock = new TIntermBlock();
+ TIntermBinary *falseAssignment =
+ CreateTempAssignmentNode(resultVariable, node->getFalseExpression());
+ falseBlock->getSequence()->push_back(falseAssignment);
+
+ TIntermIfElse *ifNode =
+ new TIntermIfElse(node->getCondition()->getAsTyped(), trueBlock, falseBlock);
+ insertions.push_back(ifNode);
+
+ insertStatementsInParentBlock(insertions);
+
+ TIntermSymbol *ternaryResult = CreateTempSymbolNode(resultVariable);
+ queueReplacement(ternaryResult, OriginalNode::IS_DROPPED);
+
+ return false;
+}
+
+void UnfoldShortCircuitTraverser::nextIteration()
+{
+ mFoundShortCircuit = false;
+}
+
+} // namespace
+
+void UnfoldShortCircuitToIf(TIntermNode *root, TSymbolTable *symbolTable)
+{
+ UnfoldShortCircuitTraverser traverser(symbolTable);
+ // Unfold one operator at a time, and reset the traverser between iterations.
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ if (traverser.foundShortCircuit())
+ traverser.updateTree();
+ } while (traverser.foundShortCircuit());
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.h
new file mode 100644
index 0000000000..3458cd27f0
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.h
@@ -0,0 +1,25 @@
+//
+// 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.
+//
+// UnfoldShortCircuitToIf is an AST traverser to convert short-circuiting operators to if-else
+// statements.
+// The results are assigned to s# temporaries, which are used by the main translator instead of
+// the original expression.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_
+#define COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_
+
+namespace sh
+{
+
+class TIntermNode;
+class TSymbolTable;
+
+void UnfoldShortCircuitToIf(TIntermNode *root, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp
new file mode 100644
index 0000000000..83a133ca1f
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp
@@ -0,0 +1,104 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// UseInterfaceBlockFields.cpp: insert statements to reference all members in InterfaceBlock list at
+// the beginning of main. This is to work around a Mac driver that treats unused standard/shared
+// uniform blocks as inactive.
+
+#include "compiler/translator/tree_ops/UseInterfaceBlockFields.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/FindMain.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+void AddNodeUseStatements(TIntermTyped *node, TIntermSequence *sequence)
+{
+ if (node->isArray())
+ {
+ for (unsigned int i = 0u; i < node->getOutermostArraySize(); ++i)
+ {
+ TIntermBinary *element =
+ new TIntermBinary(EOpIndexDirect, node->deepCopy(), CreateIndexNode(i));
+ AddNodeUseStatements(element, sequence);
+ }
+ }
+ else
+ {
+ sequence->insert(sequence->begin(), node);
+ }
+}
+
+void AddFieldUseStatements(const ShaderVariable &var,
+ TIntermSequence *sequence,
+ const TSymbolTable &symbolTable)
+{
+ ASSERT(var.name.find_last_of('[') == std::string::npos);
+ TIntermSymbol *symbol = ReferenceGlobalVariable(ImmutableString(var.name), symbolTable);
+ AddNodeUseStatements(symbol, sequence);
+}
+
+void InsertUseCode(const InterfaceBlock &block, TIntermTyped *blockNode, TIntermSequence *sequence)
+{
+ for (unsigned int i = 0; i < block.fields.size(); ++i)
+ {
+ TIntermBinary *element = new TIntermBinary(EOpIndexDirectInterfaceBlock,
+ blockNode->deepCopy(), CreateIndexNode(i));
+ sequence->insert(sequence->begin(), element);
+ }
+}
+
+void InsertUseCode(TIntermSequence *sequence,
+ const InterfaceBlockList &blocks,
+ const TSymbolTable &symbolTable)
+{
+ for (const auto &block : blocks)
+ {
+ if (block.instanceName.empty())
+ {
+ for (const auto &var : block.fields)
+ {
+ AddFieldUseStatements(var, sequence, symbolTable);
+ }
+ }
+ else if (block.arraySize > 0u)
+ {
+ TIntermSymbol *arraySymbol =
+ ReferenceGlobalVariable(ImmutableString(block.instanceName), symbolTable);
+ for (unsigned int i = 0u; i < block.arraySize; ++i)
+ {
+ TIntermBinary *elementSymbol =
+ new TIntermBinary(EOpIndexDirect, arraySymbol->deepCopy(), CreateIndexNode(i));
+ InsertUseCode(block, elementSymbol, sequence);
+ }
+ }
+ else
+ {
+ TIntermSymbol *blockSymbol =
+ ReferenceGlobalVariable(ImmutableString(block.instanceName), symbolTable);
+ InsertUseCode(block, blockSymbol, sequence);
+ }
+ }
+}
+
+} // namespace
+
+void UseInterfaceBlockFields(TIntermBlock *root,
+ const InterfaceBlockList &blocks,
+ const TSymbolTable &symbolTable)
+{
+ TIntermBlock *mainBody = FindMainBody(root);
+ InsertUseCode(mainBody->getSequence(), blocks, symbolTable);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.h
new file mode 100644
index 0000000000..37f0ba0220
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.h
@@ -0,0 +1,30 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// UseInterfaceBlockFields.h: insert statements to reference all members in InterfaceBlock list at
+// the beginning of main. This is to work around a Mac driver that treats unused standard/shared
+// uniform blocks as inactive.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_
+
+#include <GLSLANG/ShaderLang.h>
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+using InterfaceBlockList = std::vector<sh::InterfaceBlock>;
+
+void UseInterfaceBlockFields(TIntermBlock *root,
+ const InterfaceBlockList &blocks,
+ const TSymbolTable &symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp
new file mode 100644
index 0000000000..221a73592b
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp
@@ -0,0 +1,287 @@
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// VectorizeVectorScalarArithmetic.cpp: Turn some arithmetic operations that operate on a float
+// vector-scalar pair into vector-vector operations. This is done recursively. Some scalar binary
+// operations inside vector constructors are also turned into vector operations.
+//
+// This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA
+// driver version 387.92. It works around the most common occurrences of the bug.
+
+#include "compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h"
+
+#include <set>
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class VectorizeVectorScalarArithmeticTraverser : public TIntermTraverser
+{
+ public:
+ VectorizeVectorScalarArithmeticTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, false, false, symbolTable), mReplaced(false)
+ {}
+
+ bool didReplaceScalarsWithVectors() { return mReplaced; }
+ void nextIteration()
+ {
+ mReplaced = false;
+ mModifiedBlocks.clear();
+ }
+
+ protected:
+ bool visitBinary(Visit visit, TIntermBinary *node) override;
+ bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+
+ private:
+ // These helpers should only be called from visitAggregate when visiting a constructor.
+ // argBinary is the only argument of the constructor.
+ void replaceMathInsideConstructor(TIntermAggregate *node, TIntermBinary *argBinary);
+ void replaceAssignInsideConstructor(const TIntermAggregate *node,
+ const TIntermBinary *argBinary);
+
+ static TIntermTyped *Vectorize(TIntermTyped *node,
+ TType vectorType,
+ TIntermTraverser::OriginalNode *originalNodeFate);
+
+ bool mReplaced;
+ std::set<const TIntermBlock *> mModifiedBlocks;
+};
+
+TIntermTyped *VectorizeVectorScalarArithmeticTraverser::Vectorize(
+ TIntermTyped *node,
+ TType vectorType,
+ TIntermTraverser::OriginalNode *originalNodeFate)
+{
+ ASSERT(node->isScalar());
+ vectorType.setQualifier(EvqTemporary);
+ TIntermSequence vectorConstructorArgs;
+ vectorConstructorArgs.push_back(node);
+ TIntermAggregate *vectorized =
+ TIntermAggregate::CreateConstructor(vectorType, &vectorConstructorArgs);
+ TIntermTyped *vectorizedFolded = vectorized->fold(nullptr);
+ if (originalNodeFate != nullptr)
+ {
+ if (vectorizedFolded != vectorized)
+ {
+ *originalNodeFate = OriginalNode::IS_DROPPED;
+ }
+ else
+ {
+ *originalNodeFate = OriginalNode::BECOMES_CHILD;
+ }
+ }
+ return vectorizedFolded;
+}
+
+bool VectorizeVectorScalarArithmeticTraverser::visitBinary(Visit /*visit*/, TIntermBinary *node)
+{
+ TIntermTyped *left = node->getLeft();
+ TIntermTyped *right = node->getRight();
+ ASSERT(left);
+ ASSERT(right);
+ switch (node->getOp())
+ {
+ case EOpAdd:
+ case EOpAddAssign:
+ // Only these specific ops are necessary to turn into vector ops.
+ break;
+ default:
+ return true;
+ }
+ if (node->getBasicType() != EbtFloat)
+ {
+ // Only float ops have reproduced the bug.
+ return true;
+ }
+ if (left->isScalar() && right->isVector())
+ {
+ ASSERT(!node->isAssignment());
+ ASSERT(!right->isArray());
+ OriginalNode originalNodeFate;
+ TIntermTyped *leftVectorized = Vectorize(left, right->getType(), &originalNodeFate);
+ queueReplacementWithParent(node, left, leftVectorized, originalNodeFate);
+ mReplaced = true;
+ // Don't replace more nodes in the same subtree on this traversal. However, nodes elsewhere
+ // in the tree may still be replaced.
+ return false;
+ }
+ else if (left->isVector() && right->isScalar())
+ {
+ OriginalNode originalNodeFate;
+ TIntermTyped *rightVectorized = Vectorize(right, left->getType(), &originalNodeFate);
+ queueReplacementWithParent(node, right, rightVectorized, originalNodeFate);
+ mReplaced = true;
+ // Don't replace more nodes in the same subtree on this traversal. However, nodes elsewhere
+ // in the tree may still be replaced.
+ return false;
+ }
+ return true;
+}
+
+void VectorizeVectorScalarArithmeticTraverser::replaceMathInsideConstructor(
+ TIntermAggregate *node,
+ TIntermBinary *argBinary)
+{
+ // Turn:
+ // a * b
+ // into:
+ // gvec(a) * gvec(b)
+
+ TIntermTyped *left = argBinary->getLeft();
+ TIntermTyped *right = argBinary->getRight();
+ ASSERT(left->isScalar() && right->isScalar());
+
+ TType leftVectorizedType = left->getType();
+ leftVectorizedType.setPrimarySize(static_cast<unsigned char>(node->getType().getNominalSize()));
+ TIntermTyped *leftVectorized = Vectorize(left, leftVectorizedType, nullptr);
+ TType rightVectorizedType = right->getType();
+ rightVectorizedType.setPrimarySize(
+ static_cast<unsigned char>(node->getType().getNominalSize()));
+ TIntermTyped *rightVectorized = Vectorize(right, rightVectorizedType, nullptr);
+
+ TIntermBinary *newArg = new TIntermBinary(argBinary->getOp(), leftVectorized, rightVectorized);
+ queueReplacementWithParent(node, argBinary, newArg, OriginalNode::IS_DROPPED);
+}
+
+void VectorizeVectorScalarArithmeticTraverser::replaceAssignInsideConstructor(
+ const TIntermAggregate *node,
+ const TIntermBinary *argBinary)
+{
+ // Turn:
+ // gvec(a *= b);
+ // into:
+ // // This is inserted into the parent block:
+ // gvec s0 = gvec(a);
+ //
+ // // This goes where the gvec constructor used to be:
+ // ((s0 *= b, a = s0.x), s0);
+
+ TIntermTyped *left = argBinary->getLeft();
+ TIntermTyped *right = argBinary->getRight();
+ ASSERT(left->isScalar() && right->isScalar());
+ ASSERT(!left->hasSideEffects());
+
+ TType vecType = node->getType();
+ vecType.setQualifier(EvqTemporary);
+
+ // gvec s0 = gvec(a);
+ // s0 is called "tempAssignmentTarget" below.
+ TIntermTyped *tempAssignmentTargetInitializer = Vectorize(left->deepCopy(), vecType, nullptr);
+ TIntermDeclaration *tempAssignmentTargetDeclaration = nullptr;
+ TVariable *tempAssignmentTarget =
+ DeclareTempVariable(mSymbolTable, tempAssignmentTargetInitializer, EvqTemporary,
+ &tempAssignmentTargetDeclaration);
+
+ // s0 *= b
+ TOperator compoundAssignmentOp = argBinary->getOp();
+ if (compoundAssignmentOp == EOpMulAssign)
+ {
+ compoundAssignmentOp = EOpVectorTimesScalarAssign;
+ }
+ TIntermBinary *replacementCompoundAssignment = new TIntermBinary(
+ compoundAssignmentOp, CreateTempSymbolNode(tempAssignmentTarget), right->deepCopy());
+
+ // s0.x
+ TVector<int> swizzleXOffset;
+ swizzleXOffset.push_back(0);
+ TIntermSwizzle *tempAssignmentTargetX =
+ new TIntermSwizzle(CreateTempSymbolNode(tempAssignmentTarget), swizzleXOffset);
+ // a = s0.x
+ TIntermBinary *replacementAssignBackToTarget =
+ new TIntermBinary(EOpAssign, left->deepCopy(), tempAssignmentTargetX);
+
+ // s0 *= b, a = s0.x
+ TIntermBinary *replacementSequenceLeft =
+ new TIntermBinary(EOpComma, replacementCompoundAssignment, replacementAssignBackToTarget);
+ // (s0 *= b, a = s0.x), s0
+ // Note that the created comma node is not const qualified in any case, so we can always pass
+ // shader version 300 here.
+ TIntermBinary *replacementSequence = TIntermBinary::CreateComma(
+ replacementSequenceLeft, CreateTempSymbolNode(tempAssignmentTarget), 300);
+
+ insertStatementInParentBlock(tempAssignmentTargetDeclaration);
+ queueReplacement(replacementSequence, OriginalNode::IS_DROPPED);
+}
+
+bool VectorizeVectorScalarArithmeticTraverser::visitAggregate(Visit /*visit*/,
+ TIntermAggregate *node)
+{
+ // Transform scalar binary expressions inside vector constructors.
+ if (!node->isConstructor() || !node->isVector() || node->getSequence()->size() != 1)
+ {
+ return true;
+ }
+ TIntermTyped *argument = node->getSequence()->back()->getAsTyped();
+ ASSERT(argument);
+ if (!argument->isScalar() || argument->getBasicType() != EbtFloat)
+ {
+ return true;
+ }
+ TIntermBinary *argBinary = argument->getAsBinaryNode();
+ if (!argBinary)
+ {
+ return true;
+ }
+
+ // Only specific ops are necessary to change.
+ switch (argBinary->getOp())
+ {
+ case EOpMul:
+ case EOpDiv:
+ {
+ replaceMathInsideConstructor(node, argBinary);
+ mReplaced = true;
+ // Don't replace more nodes in the same subtree on this traversal. However, nodes
+ // elsewhere in the tree may still be replaced.
+ return false;
+ }
+ case EOpMulAssign:
+ case EOpDivAssign:
+ {
+ // The case where the left side has side effects is too complicated to deal with, so we
+ // leave that be.
+ if (!argBinary->getLeft()->hasSideEffects())
+ {
+ const TIntermBlock *parentBlock = getParentBlock();
+ // We can't do more than one insertion to the same block on the same traversal.
+ if (mModifiedBlocks.find(parentBlock) == mModifiedBlocks.end())
+ {
+ replaceAssignInsideConstructor(node, argBinary);
+ mModifiedBlocks.insert(parentBlock);
+ mReplaced = true;
+ // Don't replace more nodes in the same subtree on this traversal.
+ // However, nodes elsewhere in the tree may still be replaced.
+ return false;
+ }
+ }
+ break;
+ }
+ default:
+ return true;
+ }
+ return true;
+}
+
+} // anonymous namespace
+
+void VectorizeVectorScalarArithmetic(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ VectorizeVectorScalarArithmeticTraverser traverser(symbolTable);
+ do
+ {
+ traverser.nextIteration();
+ root->traverse(&traverser);
+ traverser.updateTree();
+ } while (traverser.didReplaceScalarsWithVectors());
+}
+
+} // namespace sh \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h
new file mode 100644
index 0000000000..e6480646f8
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// VectorizeVectorScalarArithmetic.h: Turn some arithmetic operations that operate on a float
+// vector-scalar pair into vector-vector operations. This is done recursively. Some scalar binary
+// operations inside vector constructors are also turned into vector operations.
+//
+// This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA
+// driver version 387.92. It works around the most common occurrences of the bug.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_
+#define COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void VectorizeVectorScalarArithmetic(TIntermBlock *root, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp
new file mode 100644
index 0000000000..5a4dd30853
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp
@@ -0,0 +1,126 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// WrapSwitchStatementsInBlocks.cpp: Wrap switch statements in blocks and declare all switch-scoped
+// variables there to make the AST compatible with HLSL output.
+//
+// switch (init)
+// {
+// case 0:
+// float f;
+// default:
+// f = 1.0;
+// }
+//
+// becomes
+//
+// {
+// float f;
+// switch (init)
+// {
+// case 0:
+// default:
+// f = 1.0;
+// }
+// }
+
+#include "compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class WrapSwitchStatementsInBlocksTraverser : public TIntermTraverser
+{
+ public:
+ WrapSwitchStatementsInBlocksTraverser() : TIntermTraverser(true, false, false) {}
+
+ bool visitSwitch(Visit visit, TIntermSwitch *node) override;
+};
+
+bool WrapSwitchStatementsInBlocksTraverser::visitSwitch(Visit, TIntermSwitch *node)
+{
+ std::vector<TIntermDeclaration *> declarations;
+ TIntermSequence *statementList = node->getStatementList()->getSequence();
+ for (TIntermNode *statement : *statementList)
+ {
+ TIntermDeclaration *asDeclaration = statement->getAsDeclarationNode();
+ if (asDeclaration)
+ {
+ declarations.push_back(asDeclaration);
+ }
+ }
+ if (declarations.empty())
+ {
+ // We don't need to wrap the switch if it doesn't contain declarations as its direct
+ // descendants.
+ return true;
+ }
+
+ TIntermBlock *wrapperBlock = new TIntermBlock();
+ for (TIntermDeclaration *declaration : declarations)
+ {
+ // SeparateDeclarations should have already been run.
+ ASSERT(declaration->getSequence()->size() == 1);
+
+ TIntermDeclaration *declarationInBlock = new TIntermDeclaration();
+ TIntermSymbol *declaratorAsSymbol = declaration->getSequence()->at(0)->getAsSymbolNode();
+ if (declaratorAsSymbol)
+ {
+ // This is a simple declaration like: "float f;"
+ // Remove the declaration from inside the switch and put it in the wrapping block.
+ TIntermSequence emptyReplacement;
+ mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(
+ node->getStatementList(), declaration, emptyReplacement));
+
+ declarationInBlock->appendDeclarator(declaratorAsSymbol->deepCopy());
+ // The declaration can't be the last statement inside the switch since unused variables
+ // should already have been pruned.
+ ASSERT(declaration != statementList->back());
+ }
+ else
+ {
+ // This is an init declaration like: "float f = 0.0;"
+ // Change the init declaration inside the switch into an assignment and put a plain
+ // declaration in the wrapping block.
+ TIntermBinary *declaratorAsBinary =
+ declaration->getSequence()->at(0)->getAsBinaryNode();
+ ASSERT(declaratorAsBinary);
+
+ TIntermBinary *initAssignment = new TIntermBinary(
+ EOpAssign, declaratorAsBinary->getLeft(), declaratorAsBinary->getRight());
+
+ queueReplacementWithParent(node->getStatementList(), declaration, initAssignment,
+ OriginalNode::IS_DROPPED);
+
+ declarationInBlock->appendDeclarator(declaratorAsBinary->getLeft()->deepCopy());
+ }
+ wrapperBlock->appendStatement(declarationInBlock);
+ }
+
+ wrapperBlock->appendStatement(node);
+ queueReplacement(wrapperBlock, OriginalNode::BECOMES_CHILD);
+
+ // Should be fine to process multiple switch statements, even nesting ones in the same
+ // traversal.
+ return true;
+}
+
+} // anonymous namespace
+
+// Wrap switch statements in the AST into blocks when needed.
+void WrapSwitchStatementsInBlocks(TIntermBlock *root)
+{
+ WrapSwitchStatementsInBlocksTraverser traverser;
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h
new file mode 100644
index 0000000000..d04893cb52
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// WrapSwitchStatementsInBlocks.h: Wrap switch statements in blocks and declare all switch-scoped
+// variables there to make the AST compatible with HLSL output.
+
+#ifndef COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_
+#define COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+
+// Wrap switch statements in the AST into blocks when needed. Returns true if the AST was changed.
+void WrapSwitchStatementsInBlocks(TIntermBlock *root);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/BuiltIn_autogen.h b/gfx/angle/checkout/src/compiler/translator/tree_util/BuiltIn_autogen.h
new file mode 100644
index 0000000000..6c84834550
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/BuiltIn_autogen.h
@@ -0,0 +1,1373 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_builtin_symbols.py using data from builtin_variables.json and
+// builtin_function_declarations.txt.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// BuiltIn_autogen.h:
+// Compile-time initialized built-ins.
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_BUILTIN_AUTOGEN_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_BUILTIN_AUTOGEN_H_
+
+#include "compiler/translator/SymbolUniqueId.h"
+
+namespace sh
+{
+
+class TVariable;
+
+class BuiltInId
+{
+ public:
+ static constexpr const TSymbolUniqueId radians_Float1 = TSymbolUniqueId(0);
+ static constexpr const TSymbolUniqueId pt0B = TSymbolUniqueId(1);
+ static constexpr const TSymbolUniqueId radians_Float2 = TSymbolUniqueId(2);
+ static constexpr const TSymbolUniqueId pt1B = TSymbolUniqueId(3);
+ static constexpr const TSymbolUniqueId radians_Float3 = TSymbolUniqueId(4);
+ static constexpr const TSymbolUniqueId pt2B = TSymbolUniqueId(5);
+ static constexpr const TSymbolUniqueId radians_Float4 = TSymbolUniqueId(6);
+ static constexpr const TSymbolUniqueId pt3B = TSymbolUniqueId(7);
+ static constexpr const TSymbolUniqueId degrees_Float1 = TSymbolUniqueId(8);
+ static constexpr const TSymbolUniqueId degrees_Float2 = TSymbolUniqueId(9);
+ static constexpr const TSymbolUniqueId degrees_Float3 = TSymbolUniqueId(10);
+ static constexpr const TSymbolUniqueId degrees_Float4 = TSymbolUniqueId(11);
+ static constexpr const TSymbolUniqueId sin_Float1 = TSymbolUniqueId(12);
+ static constexpr const TSymbolUniqueId sin_Float2 = TSymbolUniqueId(13);
+ static constexpr const TSymbolUniqueId sin_Float3 = TSymbolUniqueId(14);
+ static constexpr const TSymbolUniqueId sin_Float4 = TSymbolUniqueId(15);
+ static constexpr const TSymbolUniqueId cos_Float1 = TSymbolUniqueId(16);
+ static constexpr const TSymbolUniqueId cos_Float2 = TSymbolUniqueId(17);
+ static constexpr const TSymbolUniqueId cos_Float3 = TSymbolUniqueId(18);
+ static constexpr const TSymbolUniqueId cos_Float4 = TSymbolUniqueId(19);
+ static constexpr const TSymbolUniqueId tan_Float1 = TSymbolUniqueId(20);
+ static constexpr const TSymbolUniqueId tan_Float2 = TSymbolUniqueId(21);
+ static constexpr const TSymbolUniqueId tan_Float3 = TSymbolUniqueId(22);
+ static constexpr const TSymbolUniqueId tan_Float4 = TSymbolUniqueId(23);
+ static constexpr const TSymbolUniqueId asin_Float1 = TSymbolUniqueId(24);
+ static constexpr const TSymbolUniqueId asin_Float2 = TSymbolUniqueId(25);
+ static constexpr const TSymbolUniqueId asin_Float3 = TSymbolUniqueId(26);
+ static constexpr const TSymbolUniqueId asin_Float4 = TSymbolUniqueId(27);
+ static constexpr const TSymbolUniqueId acos_Float1 = TSymbolUniqueId(28);
+ static constexpr const TSymbolUniqueId acos_Float2 = TSymbolUniqueId(29);
+ static constexpr const TSymbolUniqueId acos_Float3 = TSymbolUniqueId(30);
+ static constexpr const TSymbolUniqueId acos_Float4 = TSymbolUniqueId(31);
+ static constexpr const TSymbolUniqueId atan_Float1_Float1 = TSymbolUniqueId(32);
+ static constexpr const TSymbolUniqueId atan_Float2_Float2 = TSymbolUniqueId(33);
+ static constexpr const TSymbolUniqueId atan_Float3_Float3 = TSymbolUniqueId(34);
+ static constexpr const TSymbolUniqueId atan_Float4_Float4 = TSymbolUniqueId(35);
+ static constexpr const TSymbolUniqueId atan_Float1 = TSymbolUniqueId(36);
+ static constexpr const TSymbolUniqueId atan_Float2 = TSymbolUniqueId(37);
+ static constexpr const TSymbolUniqueId atan_Float3 = TSymbolUniqueId(38);
+ static constexpr const TSymbolUniqueId atan_Float4 = TSymbolUniqueId(39);
+ static constexpr const TSymbolUniqueId sinh_Float1 = TSymbolUniqueId(40);
+ static constexpr const TSymbolUniqueId sinh_Float2 = TSymbolUniqueId(41);
+ static constexpr const TSymbolUniqueId sinh_Float3 = TSymbolUniqueId(42);
+ static constexpr const TSymbolUniqueId sinh_Float4 = TSymbolUniqueId(43);
+ static constexpr const TSymbolUniqueId cosh_Float1 = TSymbolUniqueId(44);
+ static constexpr const TSymbolUniqueId cosh_Float2 = TSymbolUniqueId(45);
+ static constexpr const TSymbolUniqueId cosh_Float3 = TSymbolUniqueId(46);
+ static constexpr const TSymbolUniqueId cosh_Float4 = TSymbolUniqueId(47);
+ static constexpr const TSymbolUniqueId tanh_Float1 = TSymbolUniqueId(48);
+ static constexpr const TSymbolUniqueId tanh_Float2 = TSymbolUniqueId(49);
+ static constexpr const TSymbolUniqueId tanh_Float3 = TSymbolUniqueId(50);
+ static constexpr const TSymbolUniqueId tanh_Float4 = TSymbolUniqueId(51);
+ static constexpr const TSymbolUniqueId asinh_Float1 = TSymbolUniqueId(52);
+ static constexpr const TSymbolUniqueId asinh_Float2 = TSymbolUniqueId(53);
+ static constexpr const TSymbolUniqueId asinh_Float3 = TSymbolUniqueId(54);
+ static constexpr const TSymbolUniqueId asinh_Float4 = TSymbolUniqueId(55);
+ static constexpr const TSymbolUniqueId acosh_Float1 = TSymbolUniqueId(56);
+ static constexpr const TSymbolUniqueId acosh_Float2 = TSymbolUniqueId(57);
+ static constexpr const TSymbolUniqueId acosh_Float3 = TSymbolUniqueId(58);
+ static constexpr const TSymbolUniqueId acosh_Float4 = TSymbolUniqueId(59);
+ static constexpr const TSymbolUniqueId atanh_Float1 = TSymbolUniqueId(60);
+ static constexpr const TSymbolUniqueId atanh_Float2 = TSymbolUniqueId(61);
+ static constexpr const TSymbolUniqueId atanh_Float3 = TSymbolUniqueId(62);
+ static constexpr const TSymbolUniqueId atanh_Float4 = TSymbolUniqueId(63);
+ static constexpr const TSymbolUniqueId pow_Float1_Float1 = TSymbolUniqueId(64);
+ static constexpr const TSymbolUniqueId pow_Float2_Float2 = TSymbolUniqueId(65);
+ static constexpr const TSymbolUniqueId pow_Float3_Float3 = TSymbolUniqueId(66);
+ static constexpr const TSymbolUniqueId pow_Float4_Float4 = TSymbolUniqueId(67);
+ static constexpr const TSymbolUniqueId exp_Float1 = TSymbolUniqueId(68);
+ static constexpr const TSymbolUniqueId exp_Float2 = TSymbolUniqueId(69);
+ static constexpr const TSymbolUniqueId exp_Float3 = TSymbolUniqueId(70);
+ static constexpr const TSymbolUniqueId exp_Float4 = TSymbolUniqueId(71);
+ static constexpr const TSymbolUniqueId log_Float1 = TSymbolUniqueId(72);
+ static constexpr const TSymbolUniqueId log_Float2 = TSymbolUniqueId(73);
+ static constexpr const TSymbolUniqueId log_Float3 = TSymbolUniqueId(74);
+ static constexpr const TSymbolUniqueId log_Float4 = TSymbolUniqueId(75);
+ static constexpr const TSymbolUniqueId exp2_Float1 = TSymbolUniqueId(76);
+ static constexpr const TSymbolUniqueId exp2_Float2 = TSymbolUniqueId(77);
+ static constexpr const TSymbolUniqueId exp2_Float3 = TSymbolUniqueId(78);
+ static constexpr const TSymbolUniqueId exp2_Float4 = TSymbolUniqueId(79);
+ static constexpr const TSymbolUniqueId log2_Float1 = TSymbolUniqueId(80);
+ static constexpr const TSymbolUniqueId log2_Float2 = TSymbolUniqueId(81);
+ static constexpr const TSymbolUniqueId log2_Float3 = TSymbolUniqueId(82);
+ static constexpr const TSymbolUniqueId log2_Float4 = TSymbolUniqueId(83);
+ static constexpr const TSymbolUniqueId sqrt_Float1 = TSymbolUniqueId(84);
+ static constexpr const TSymbolUniqueId sqrt_Float2 = TSymbolUniqueId(85);
+ static constexpr const TSymbolUniqueId sqrt_Float3 = TSymbolUniqueId(86);
+ static constexpr const TSymbolUniqueId sqrt_Float4 = TSymbolUniqueId(87);
+ static constexpr const TSymbolUniqueId inversesqrt_Float1 = TSymbolUniqueId(88);
+ static constexpr const TSymbolUniqueId inversesqrt_Float2 = TSymbolUniqueId(89);
+ static constexpr const TSymbolUniqueId inversesqrt_Float3 = TSymbolUniqueId(90);
+ static constexpr const TSymbolUniqueId inversesqrt_Float4 = TSymbolUniqueId(91);
+ static constexpr const TSymbolUniqueId abs_Float1 = TSymbolUniqueId(92);
+ static constexpr const TSymbolUniqueId abs_Float2 = TSymbolUniqueId(93);
+ static constexpr const TSymbolUniqueId abs_Float3 = TSymbolUniqueId(94);
+ static constexpr const TSymbolUniqueId abs_Float4 = TSymbolUniqueId(95);
+ static constexpr const TSymbolUniqueId abs_Int1 = TSymbolUniqueId(96);
+ static constexpr const TSymbolUniqueId pt0C = TSymbolUniqueId(97);
+ static constexpr const TSymbolUniqueId abs_Int2 = TSymbolUniqueId(98);
+ static constexpr const TSymbolUniqueId pt1C = TSymbolUniqueId(99);
+ static constexpr const TSymbolUniqueId abs_Int3 = TSymbolUniqueId(100);
+ static constexpr const TSymbolUniqueId pt2C = TSymbolUniqueId(101);
+ static constexpr const TSymbolUniqueId abs_Int4 = TSymbolUniqueId(102);
+ static constexpr const TSymbolUniqueId pt3C = TSymbolUniqueId(103);
+ static constexpr const TSymbolUniqueId sign_Float1 = TSymbolUniqueId(104);
+ static constexpr const TSymbolUniqueId sign_Float2 = TSymbolUniqueId(105);
+ static constexpr const TSymbolUniqueId sign_Float3 = TSymbolUniqueId(106);
+ static constexpr const TSymbolUniqueId sign_Float4 = TSymbolUniqueId(107);
+ static constexpr const TSymbolUniqueId sign_Int1 = TSymbolUniqueId(108);
+ static constexpr const TSymbolUniqueId sign_Int2 = TSymbolUniqueId(109);
+ static constexpr const TSymbolUniqueId sign_Int3 = TSymbolUniqueId(110);
+ static constexpr const TSymbolUniqueId sign_Int4 = TSymbolUniqueId(111);
+ static constexpr const TSymbolUniqueId floor_Float1 = TSymbolUniqueId(112);
+ static constexpr const TSymbolUniqueId floor_Float2 = TSymbolUniqueId(113);
+ static constexpr const TSymbolUniqueId floor_Float3 = TSymbolUniqueId(114);
+ static constexpr const TSymbolUniqueId floor_Float4 = TSymbolUniqueId(115);
+ static constexpr const TSymbolUniqueId trunc_Float1 = TSymbolUniqueId(116);
+ static constexpr const TSymbolUniqueId trunc_Float2 = TSymbolUniqueId(117);
+ static constexpr const TSymbolUniqueId trunc_Float3 = TSymbolUniqueId(118);
+ static constexpr const TSymbolUniqueId trunc_Float4 = TSymbolUniqueId(119);
+ static constexpr const TSymbolUniqueId round_Float1 = TSymbolUniqueId(120);
+ static constexpr const TSymbolUniqueId round_Float2 = TSymbolUniqueId(121);
+ static constexpr const TSymbolUniqueId round_Float3 = TSymbolUniqueId(122);
+ static constexpr const TSymbolUniqueId round_Float4 = TSymbolUniqueId(123);
+ static constexpr const TSymbolUniqueId roundEven_Float1 = TSymbolUniqueId(124);
+ static constexpr const TSymbolUniqueId roundEven_Float2 = TSymbolUniqueId(125);
+ static constexpr const TSymbolUniqueId roundEven_Float3 = TSymbolUniqueId(126);
+ static constexpr const TSymbolUniqueId roundEven_Float4 = TSymbolUniqueId(127);
+ static constexpr const TSymbolUniqueId ceil_Float1 = TSymbolUniqueId(128);
+ static constexpr const TSymbolUniqueId ceil_Float2 = TSymbolUniqueId(129);
+ static constexpr const TSymbolUniqueId ceil_Float3 = TSymbolUniqueId(130);
+ static constexpr const TSymbolUniqueId ceil_Float4 = TSymbolUniqueId(131);
+ static constexpr const TSymbolUniqueId fract_Float1 = TSymbolUniqueId(132);
+ static constexpr const TSymbolUniqueId fract_Float2 = TSymbolUniqueId(133);
+ static constexpr const TSymbolUniqueId fract_Float3 = TSymbolUniqueId(134);
+ static constexpr const TSymbolUniqueId fract_Float4 = TSymbolUniqueId(135);
+ static constexpr const TSymbolUniqueId mod_Float1_Float1 = TSymbolUniqueId(136);
+ static constexpr const TSymbolUniqueId mod_Float2_Float1 = TSymbolUniqueId(137);
+ static constexpr const TSymbolUniqueId mod_Float3_Float1 = TSymbolUniqueId(138);
+ static constexpr const TSymbolUniqueId mod_Float4_Float1 = TSymbolUniqueId(139);
+ static constexpr const TSymbolUniqueId mod_Float2_Float2 = TSymbolUniqueId(140);
+ static constexpr const TSymbolUniqueId mod_Float3_Float3 = TSymbolUniqueId(141);
+ static constexpr const TSymbolUniqueId mod_Float4_Float4 = TSymbolUniqueId(142);
+ static constexpr const TSymbolUniqueId min_Float1_Float1 = TSymbolUniqueId(143);
+ static constexpr const TSymbolUniqueId min_Float2_Float1 = TSymbolUniqueId(144);
+ static constexpr const TSymbolUniqueId min_Float3_Float1 = TSymbolUniqueId(145);
+ static constexpr const TSymbolUniqueId min_Float4_Float1 = TSymbolUniqueId(146);
+ static constexpr const TSymbolUniqueId min_Float2_Float2 = TSymbolUniqueId(147);
+ static constexpr const TSymbolUniqueId min_Float3_Float3 = TSymbolUniqueId(148);
+ static constexpr const TSymbolUniqueId min_Float4_Float4 = TSymbolUniqueId(149);
+ static constexpr const TSymbolUniqueId min_Int1_Int1 = TSymbolUniqueId(150);
+ static constexpr const TSymbolUniqueId min_Int2_Int2 = TSymbolUniqueId(151);
+ static constexpr const TSymbolUniqueId min_Int3_Int3 = TSymbolUniqueId(152);
+ static constexpr const TSymbolUniqueId min_Int4_Int4 = TSymbolUniqueId(153);
+ static constexpr const TSymbolUniqueId min_Int2_Int1 = TSymbolUniqueId(154);
+ static constexpr const TSymbolUniqueId min_Int3_Int1 = TSymbolUniqueId(155);
+ static constexpr const TSymbolUniqueId min_Int4_Int1 = TSymbolUniqueId(156);
+ static constexpr const TSymbolUniqueId min_UInt1_UInt1 = TSymbolUniqueId(157);
+ static constexpr const TSymbolUniqueId pt0D = TSymbolUniqueId(158);
+ static constexpr const TSymbolUniqueId min_UInt2_UInt2 = TSymbolUniqueId(159);
+ static constexpr const TSymbolUniqueId pt1D = TSymbolUniqueId(160);
+ static constexpr const TSymbolUniqueId min_UInt3_UInt3 = TSymbolUniqueId(161);
+ static constexpr const TSymbolUniqueId pt2D = TSymbolUniqueId(162);
+ static constexpr const TSymbolUniqueId min_UInt4_UInt4 = TSymbolUniqueId(163);
+ static constexpr const TSymbolUniqueId pt3D = TSymbolUniqueId(164);
+ static constexpr const TSymbolUniqueId min_UInt2_UInt1 = TSymbolUniqueId(165);
+ static constexpr const TSymbolUniqueId min_UInt3_UInt1 = TSymbolUniqueId(166);
+ static constexpr const TSymbolUniqueId min_UInt4_UInt1 = TSymbolUniqueId(167);
+ static constexpr const TSymbolUniqueId max_Float1_Float1 = TSymbolUniqueId(168);
+ static constexpr const TSymbolUniqueId max_Float2_Float1 = TSymbolUniqueId(169);
+ static constexpr const TSymbolUniqueId max_Float3_Float1 = TSymbolUniqueId(170);
+ static constexpr const TSymbolUniqueId max_Float4_Float1 = TSymbolUniqueId(171);
+ static constexpr const TSymbolUniqueId max_Float2_Float2 = TSymbolUniqueId(172);
+ static constexpr const TSymbolUniqueId max_Float3_Float3 = TSymbolUniqueId(173);
+ static constexpr const TSymbolUniqueId max_Float4_Float4 = TSymbolUniqueId(174);
+ static constexpr const TSymbolUniqueId max_Int1_Int1 = TSymbolUniqueId(175);
+ static constexpr const TSymbolUniqueId max_Int2_Int2 = TSymbolUniqueId(176);
+ static constexpr const TSymbolUniqueId max_Int3_Int3 = TSymbolUniqueId(177);
+ static constexpr const TSymbolUniqueId max_Int4_Int4 = TSymbolUniqueId(178);
+ static constexpr const TSymbolUniqueId max_Int2_Int1 = TSymbolUniqueId(179);
+ static constexpr const TSymbolUniqueId max_Int3_Int1 = TSymbolUniqueId(180);
+ static constexpr const TSymbolUniqueId max_Int4_Int1 = TSymbolUniqueId(181);
+ static constexpr const TSymbolUniqueId max_UInt1_UInt1 = TSymbolUniqueId(182);
+ static constexpr const TSymbolUniqueId max_UInt2_UInt2 = TSymbolUniqueId(183);
+ static constexpr const TSymbolUniqueId max_UInt3_UInt3 = TSymbolUniqueId(184);
+ static constexpr const TSymbolUniqueId max_UInt4_UInt4 = TSymbolUniqueId(185);
+ static constexpr const TSymbolUniqueId max_UInt2_UInt1 = TSymbolUniqueId(186);
+ static constexpr const TSymbolUniqueId max_UInt3_UInt1 = TSymbolUniqueId(187);
+ static constexpr const TSymbolUniqueId max_UInt4_UInt1 = TSymbolUniqueId(188);
+ static constexpr const TSymbolUniqueId clamp_Float1_Float1_Float1 = TSymbolUniqueId(189);
+ static constexpr const TSymbolUniqueId clamp_Float2_Float1_Float1 = TSymbolUniqueId(190);
+ static constexpr const TSymbolUniqueId clamp_Float3_Float1_Float1 = TSymbolUniqueId(191);
+ static constexpr const TSymbolUniqueId clamp_Float4_Float1_Float1 = TSymbolUniqueId(192);
+ static constexpr const TSymbolUniqueId clamp_Float2_Float2_Float2 = TSymbolUniqueId(193);
+ static constexpr const TSymbolUniqueId clamp_Float3_Float3_Float3 = TSymbolUniqueId(194);
+ static constexpr const TSymbolUniqueId clamp_Float4_Float4_Float4 = TSymbolUniqueId(195);
+ static constexpr const TSymbolUniqueId clamp_Int1_Int1_Int1 = TSymbolUniqueId(196);
+ static constexpr const TSymbolUniqueId clamp_Int2_Int1_Int1 = TSymbolUniqueId(197);
+ static constexpr const TSymbolUniqueId clamp_Int3_Int1_Int1 = TSymbolUniqueId(198);
+ static constexpr const TSymbolUniqueId clamp_Int4_Int1_Int1 = TSymbolUniqueId(199);
+ static constexpr const TSymbolUniqueId clamp_Int2_Int2_Int2 = TSymbolUniqueId(200);
+ static constexpr const TSymbolUniqueId clamp_Int3_Int3_Int3 = TSymbolUniqueId(201);
+ static constexpr const TSymbolUniqueId clamp_Int4_Int4_Int4 = TSymbolUniqueId(202);
+ static constexpr const TSymbolUniqueId clamp_UInt1_UInt1_UInt1 = TSymbolUniqueId(203);
+ static constexpr const TSymbolUniqueId clamp_UInt2_UInt1_UInt1 = TSymbolUniqueId(204);
+ static constexpr const TSymbolUniqueId clamp_UInt3_UInt1_UInt1 = TSymbolUniqueId(205);
+ static constexpr const TSymbolUniqueId clamp_UInt4_UInt1_UInt1 = TSymbolUniqueId(206);
+ static constexpr const TSymbolUniqueId clamp_UInt2_UInt2_UInt2 = TSymbolUniqueId(207);
+ static constexpr const TSymbolUniqueId clamp_UInt3_UInt3_UInt3 = TSymbolUniqueId(208);
+ static constexpr const TSymbolUniqueId clamp_UInt4_UInt4_UInt4 = TSymbolUniqueId(209);
+ static constexpr const TSymbolUniqueId mix_Float1_Float1_Float1 = TSymbolUniqueId(210);
+ static constexpr const TSymbolUniqueId mix_Float2_Float2_Float1 = TSymbolUniqueId(211);
+ static constexpr const TSymbolUniqueId mix_Float3_Float3_Float1 = TSymbolUniqueId(212);
+ static constexpr const TSymbolUniqueId mix_Float4_Float4_Float1 = TSymbolUniqueId(213);
+ static constexpr const TSymbolUniqueId mix_Float2_Float2_Float2 = TSymbolUniqueId(214);
+ static constexpr const TSymbolUniqueId mix_Float3_Float3_Float3 = TSymbolUniqueId(215);
+ static constexpr const TSymbolUniqueId mix_Float4_Float4_Float4 = TSymbolUniqueId(216);
+ static constexpr const TSymbolUniqueId mix_Float1_Float1_Bool1 = TSymbolUniqueId(217);
+ static constexpr const TSymbolUniqueId pt0E = TSymbolUniqueId(218);
+ static constexpr const TSymbolUniqueId mix_Float2_Float2_Bool2 = TSymbolUniqueId(219);
+ static constexpr const TSymbolUniqueId pt1E = TSymbolUniqueId(220);
+ static constexpr const TSymbolUniqueId mix_Float3_Float3_Bool3 = TSymbolUniqueId(221);
+ static constexpr const TSymbolUniqueId pt2E = TSymbolUniqueId(222);
+ static constexpr const TSymbolUniqueId mix_Float4_Float4_Bool4 = TSymbolUniqueId(223);
+ static constexpr const TSymbolUniqueId pt3E = TSymbolUniqueId(224);
+ static constexpr const TSymbolUniqueId step_Float1_Float1 = TSymbolUniqueId(225);
+ static constexpr const TSymbolUniqueId step_Float2_Float2 = TSymbolUniqueId(226);
+ static constexpr const TSymbolUniqueId step_Float3_Float3 = TSymbolUniqueId(227);
+ static constexpr const TSymbolUniqueId step_Float4_Float4 = TSymbolUniqueId(228);
+ static constexpr const TSymbolUniqueId step_Float1_Float2 = TSymbolUniqueId(229);
+ static constexpr const TSymbolUniqueId step_Float1_Float3 = TSymbolUniqueId(230);
+ static constexpr const TSymbolUniqueId step_Float1_Float4 = TSymbolUniqueId(231);
+ static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float1 = TSymbolUniqueId(232);
+ static constexpr const TSymbolUniqueId smoothstep_Float2_Float2_Float2 = TSymbolUniqueId(233);
+ static constexpr const TSymbolUniqueId smoothstep_Float3_Float3_Float3 = TSymbolUniqueId(234);
+ static constexpr const TSymbolUniqueId smoothstep_Float4_Float4_Float4 = TSymbolUniqueId(235);
+ static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float2 = TSymbolUniqueId(236);
+ static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float3 = TSymbolUniqueId(237);
+ static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float4 = TSymbolUniqueId(238);
+ static constexpr const TSymbolUniqueId modf_Float1_Float1 = TSymbolUniqueId(239);
+ static constexpr const TSymbolUniqueId pt_o_0B = TSymbolUniqueId(240);
+ static constexpr const TSymbolUniqueId modf_Float2_Float2 = TSymbolUniqueId(241);
+ static constexpr const TSymbolUniqueId pt_o_1B = TSymbolUniqueId(242);
+ static constexpr const TSymbolUniqueId modf_Float3_Float3 = TSymbolUniqueId(243);
+ static constexpr const TSymbolUniqueId pt_o_2B = TSymbolUniqueId(244);
+ static constexpr const TSymbolUniqueId modf_Float4_Float4 = TSymbolUniqueId(245);
+ static constexpr const TSymbolUniqueId pt_o_3B = TSymbolUniqueId(246);
+ static constexpr const TSymbolUniqueId isnan_Float1 = TSymbolUniqueId(247);
+ static constexpr const TSymbolUniqueId isnan_Float2 = TSymbolUniqueId(248);
+ static constexpr const TSymbolUniqueId isnan_Float3 = TSymbolUniqueId(249);
+ static constexpr const TSymbolUniqueId isnan_Float4 = TSymbolUniqueId(250);
+ static constexpr const TSymbolUniqueId isinf_Float1 = TSymbolUniqueId(251);
+ static constexpr const TSymbolUniqueId isinf_Float2 = TSymbolUniqueId(252);
+ static constexpr const TSymbolUniqueId isinf_Float3 = TSymbolUniqueId(253);
+ static constexpr const TSymbolUniqueId isinf_Float4 = TSymbolUniqueId(254);
+ static constexpr const TSymbolUniqueId floatBitsToInt_Float1 = TSymbolUniqueId(255);
+ static constexpr const TSymbolUniqueId floatBitsToInt_Float2 = TSymbolUniqueId(256);
+ static constexpr const TSymbolUniqueId floatBitsToInt_Float3 = TSymbolUniqueId(257);
+ static constexpr const TSymbolUniqueId floatBitsToInt_Float4 = TSymbolUniqueId(258);
+ static constexpr const TSymbolUniqueId floatBitsToUint_Float1 = TSymbolUniqueId(259);
+ static constexpr const TSymbolUniqueId floatBitsToUint_Float2 = TSymbolUniqueId(260);
+ static constexpr const TSymbolUniqueId floatBitsToUint_Float3 = TSymbolUniqueId(261);
+ static constexpr const TSymbolUniqueId floatBitsToUint_Float4 = TSymbolUniqueId(262);
+ static constexpr const TSymbolUniqueId intBitsToFloat_Int1 = TSymbolUniqueId(263);
+ static constexpr const TSymbolUniqueId intBitsToFloat_Int2 = TSymbolUniqueId(264);
+ static constexpr const TSymbolUniqueId intBitsToFloat_Int3 = TSymbolUniqueId(265);
+ static constexpr const TSymbolUniqueId intBitsToFloat_Int4 = TSymbolUniqueId(266);
+ static constexpr const TSymbolUniqueId uintBitsToFloat_UInt1 = TSymbolUniqueId(267);
+ static constexpr const TSymbolUniqueId uintBitsToFloat_UInt2 = TSymbolUniqueId(268);
+ static constexpr const TSymbolUniqueId uintBitsToFloat_UInt3 = TSymbolUniqueId(269);
+ static constexpr const TSymbolUniqueId uintBitsToFloat_UInt4 = TSymbolUniqueId(270);
+ static constexpr const TSymbolUniqueId frexp_Float1_Int1 = TSymbolUniqueId(271);
+ static constexpr const TSymbolUniqueId pt_o_0C = TSymbolUniqueId(272);
+ static constexpr const TSymbolUniqueId frexp_Float2_Int2 = TSymbolUniqueId(273);
+ static constexpr const TSymbolUniqueId pt_o_1C = TSymbolUniqueId(274);
+ static constexpr const TSymbolUniqueId frexp_Float3_Int3 = TSymbolUniqueId(275);
+ static constexpr const TSymbolUniqueId pt_o_2C = TSymbolUniqueId(276);
+ static constexpr const TSymbolUniqueId frexp_Float4_Int4 = TSymbolUniqueId(277);
+ static constexpr const TSymbolUniqueId pt_o_3C = TSymbolUniqueId(278);
+ static constexpr const TSymbolUniqueId ldexp_Float1_Int1 = TSymbolUniqueId(279);
+ static constexpr const TSymbolUniqueId ldexp_Float2_Int2 = TSymbolUniqueId(280);
+ static constexpr const TSymbolUniqueId ldexp_Float3_Int3 = TSymbolUniqueId(281);
+ static constexpr const TSymbolUniqueId ldexp_Float4_Int4 = TSymbolUniqueId(282);
+ static constexpr const TSymbolUniqueId packSnorm2x16_Float2 = TSymbolUniqueId(283);
+ static constexpr const TSymbolUniqueId packUnorm2x16_Float2 = TSymbolUniqueId(284);
+ static constexpr const TSymbolUniqueId packHalf2x16_Float2 = TSymbolUniqueId(285);
+ static constexpr const TSymbolUniqueId unpackSnorm2x16_UInt1 = TSymbolUniqueId(286);
+ static constexpr const TSymbolUniqueId unpackUnorm2x16_UInt1 = TSymbolUniqueId(287);
+ static constexpr const TSymbolUniqueId unpackHalf2x16_UInt1 = TSymbolUniqueId(288);
+ static constexpr const TSymbolUniqueId packUnorm4x8_Float4 = TSymbolUniqueId(289);
+ static constexpr const TSymbolUniqueId packSnorm4x8_Float4 = TSymbolUniqueId(290);
+ static constexpr const TSymbolUniqueId unpackUnorm4x8_UInt1 = TSymbolUniqueId(291);
+ static constexpr const TSymbolUniqueId unpackSnorm4x8_UInt1 = TSymbolUniqueId(292);
+ static constexpr const TSymbolUniqueId length_Float1 = TSymbolUniqueId(293);
+ static constexpr const TSymbolUniqueId length_Float2 = TSymbolUniqueId(294);
+ static constexpr const TSymbolUniqueId length_Float3 = TSymbolUniqueId(295);
+ static constexpr const TSymbolUniqueId length_Float4 = TSymbolUniqueId(296);
+ static constexpr const TSymbolUniqueId distance_Float1_Float1 = TSymbolUniqueId(297);
+ static constexpr const TSymbolUniqueId distance_Float2_Float2 = TSymbolUniqueId(298);
+ static constexpr const TSymbolUniqueId distance_Float3_Float3 = TSymbolUniqueId(299);
+ static constexpr const TSymbolUniqueId distance_Float4_Float4 = TSymbolUniqueId(300);
+ static constexpr const TSymbolUniqueId dot_Float1_Float1 = TSymbolUniqueId(301);
+ static constexpr const TSymbolUniqueId dot_Float2_Float2 = TSymbolUniqueId(302);
+ static constexpr const TSymbolUniqueId dot_Float3_Float3 = TSymbolUniqueId(303);
+ static constexpr const TSymbolUniqueId dot_Float4_Float4 = TSymbolUniqueId(304);
+ static constexpr const TSymbolUniqueId cross_Float3_Float3 = TSymbolUniqueId(305);
+ static constexpr const TSymbolUniqueId normalize_Float1 = TSymbolUniqueId(306);
+ static constexpr const TSymbolUniqueId normalize_Float2 = TSymbolUniqueId(307);
+ static constexpr const TSymbolUniqueId normalize_Float3 = TSymbolUniqueId(308);
+ static constexpr const TSymbolUniqueId normalize_Float4 = TSymbolUniqueId(309);
+ static constexpr const TSymbolUniqueId faceforward_Float1_Float1_Float1 = TSymbolUniqueId(310);
+ static constexpr const TSymbolUniqueId faceforward_Float2_Float2_Float2 = TSymbolUniqueId(311);
+ static constexpr const TSymbolUniqueId faceforward_Float3_Float3_Float3 = TSymbolUniqueId(312);
+ static constexpr const TSymbolUniqueId faceforward_Float4_Float4_Float4 = TSymbolUniqueId(313);
+ static constexpr const TSymbolUniqueId reflect_Float1_Float1 = TSymbolUniqueId(314);
+ static constexpr const TSymbolUniqueId reflect_Float2_Float2 = TSymbolUniqueId(315);
+ static constexpr const TSymbolUniqueId reflect_Float3_Float3 = TSymbolUniqueId(316);
+ static constexpr const TSymbolUniqueId reflect_Float4_Float4 = TSymbolUniqueId(317);
+ static constexpr const TSymbolUniqueId refract_Float1_Float1_Float1 = TSymbolUniqueId(318);
+ static constexpr const TSymbolUniqueId refract_Float2_Float2_Float1 = TSymbolUniqueId(319);
+ static constexpr const TSymbolUniqueId refract_Float3_Float3_Float1 = TSymbolUniqueId(320);
+ static constexpr const TSymbolUniqueId refract_Float4_Float4_Float1 = TSymbolUniqueId(321);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float2x2_Float2x2 = TSymbolUniqueId(322);
+ static constexpr const TSymbolUniqueId pt5B = TSymbolUniqueId(323);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float3x3_Float3x3 = TSymbolUniqueId(324);
+ static constexpr const TSymbolUniqueId ptAB = TSymbolUniqueId(325);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float4x4_Float4x4 = TSymbolUniqueId(326);
+ static constexpr const TSymbolUniqueId ptFB = TSymbolUniqueId(327);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float2x3_Float2x3 = TSymbolUniqueId(328);
+ static constexpr const TSymbolUniqueId pt9B = TSymbolUniqueId(329);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float3x2_Float3x2 = TSymbolUniqueId(330);
+ static constexpr const TSymbolUniqueId pt6B = TSymbolUniqueId(331);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float2x4_Float2x4 = TSymbolUniqueId(332);
+ static constexpr const TSymbolUniqueId ptDB = TSymbolUniqueId(333);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float4x2_Float4x2 = TSymbolUniqueId(334);
+ static constexpr const TSymbolUniqueId pt7B = TSymbolUniqueId(335);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float3x4_Float3x4 = TSymbolUniqueId(336);
+ static constexpr const TSymbolUniqueId ptEB = TSymbolUniqueId(337);
+ static constexpr const TSymbolUniqueId matrixCompMult_Float4x3_Float4x3 = TSymbolUniqueId(338);
+ static constexpr const TSymbolUniqueId ptBB = TSymbolUniqueId(339);
+ static constexpr const TSymbolUniqueId outerProduct_Float2_Float2 = TSymbolUniqueId(340);
+ static constexpr const TSymbolUniqueId outerProduct_Float3_Float3 = TSymbolUniqueId(341);
+ static constexpr const TSymbolUniqueId outerProduct_Float4_Float4 = TSymbolUniqueId(342);
+ static constexpr const TSymbolUniqueId outerProduct_Float3_Float2 = TSymbolUniqueId(343);
+ static constexpr const TSymbolUniqueId outerProduct_Float2_Float3 = TSymbolUniqueId(344);
+ static constexpr const TSymbolUniqueId outerProduct_Float4_Float2 = TSymbolUniqueId(345);
+ static constexpr const TSymbolUniqueId outerProduct_Float2_Float4 = TSymbolUniqueId(346);
+ static constexpr const TSymbolUniqueId outerProduct_Float4_Float3 = TSymbolUniqueId(347);
+ static constexpr const TSymbolUniqueId outerProduct_Float3_Float4 = TSymbolUniqueId(348);
+ static constexpr const TSymbolUniqueId transpose_Float2x2 = TSymbolUniqueId(349);
+ static constexpr const TSymbolUniqueId transpose_Float3x3 = TSymbolUniqueId(350);
+ static constexpr const TSymbolUniqueId transpose_Float4x4 = TSymbolUniqueId(351);
+ static constexpr const TSymbolUniqueId transpose_Float3x2 = TSymbolUniqueId(352);
+ static constexpr const TSymbolUniqueId transpose_Float2x3 = TSymbolUniqueId(353);
+ static constexpr const TSymbolUniqueId transpose_Float4x2 = TSymbolUniqueId(354);
+ static constexpr const TSymbolUniqueId transpose_Float2x4 = TSymbolUniqueId(355);
+ static constexpr const TSymbolUniqueId transpose_Float4x3 = TSymbolUniqueId(356);
+ static constexpr const TSymbolUniqueId transpose_Float3x4 = TSymbolUniqueId(357);
+ static constexpr const TSymbolUniqueId determinant_Float2x2 = TSymbolUniqueId(358);
+ static constexpr const TSymbolUniqueId determinant_Float3x3 = TSymbolUniqueId(359);
+ static constexpr const TSymbolUniqueId determinant_Float4x4 = TSymbolUniqueId(360);
+ static constexpr const TSymbolUniqueId inverse_Float2x2 = TSymbolUniqueId(361);
+ static constexpr const TSymbolUniqueId inverse_Float3x3 = TSymbolUniqueId(362);
+ static constexpr const TSymbolUniqueId inverse_Float4x4 = TSymbolUniqueId(363);
+ static constexpr const TSymbolUniqueId lessThan_Float2_Float2 = TSymbolUniqueId(364);
+ static constexpr const TSymbolUniqueId lessThan_Float3_Float3 = TSymbolUniqueId(365);
+ static constexpr const TSymbolUniqueId lessThan_Float4_Float4 = TSymbolUniqueId(366);
+ static constexpr const TSymbolUniqueId lessThan_Int2_Int2 = TSymbolUniqueId(367);
+ static constexpr const TSymbolUniqueId lessThan_Int3_Int3 = TSymbolUniqueId(368);
+ static constexpr const TSymbolUniqueId lessThan_Int4_Int4 = TSymbolUniqueId(369);
+ static constexpr const TSymbolUniqueId lessThan_UInt2_UInt2 = TSymbolUniqueId(370);
+ static constexpr const TSymbolUniqueId lessThan_UInt3_UInt3 = TSymbolUniqueId(371);
+ static constexpr const TSymbolUniqueId lessThan_UInt4_UInt4 = TSymbolUniqueId(372);
+ static constexpr const TSymbolUniqueId lessThanEqual_Float2_Float2 = TSymbolUniqueId(373);
+ static constexpr const TSymbolUniqueId lessThanEqual_Float3_Float3 = TSymbolUniqueId(374);
+ static constexpr const TSymbolUniqueId lessThanEqual_Float4_Float4 = TSymbolUniqueId(375);
+ static constexpr const TSymbolUniqueId lessThanEqual_Int2_Int2 = TSymbolUniqueId(376);
+ static constexpr const TSymbolUniqueId lessThanEqual_Int3_Int3 = TSymbolUniqueId(377);
+ static constexpr const TSymbolUniqueId lessThanEqual_Int4_Int4 = TSymbolUniqueId(378);
+ static constexpr const TSymbolUniqueId lessThanEqual_UInt2_UInt2 = TSymbolUniqueId(379);
+ static constexpr const TSymbolUniqueId lessThanEqual_UInt3_UInt3 = TSymbolUniqueId(380);
+ static constexpr const TSymbolUniqueId lessThanEqual_UInt4_UInt4 = TSymbolUniqueId(381);
+ static constexpr const TSymbolUniqueId greaterThan_Float2_Float2 = TSymbolUniqueId(382);
+ static constexpr const TSymbolUniqueId greaterThan_Float3_Float3 = TSymbolUniqueId(383);
+ static constexpr const TSymbolUniqueId greaterThan_Float4_Float4 = TSymbolUniqueId(384);
+ static constexpr const TSymbolUniqueId greaterThan_Int2_Int2 = TSymbolUniqueId(385);
+ static constexpr const TSymbolUniqueId greaterThan_Int3_Int3 = TSymbolUniqueId(386);
+ static constexpr const TSymbolUniqueId greaterThan_Int4_Int4 = TSymbolUniqueId(387);
+ static constexpr const TSymbolUniqueId greaterThan_UInt2_UInt2 = TSymbolUniqueId(388);
+ static constexpr const TSymbolUniqueId greaterThan_UInt3_UInt3 = TSymbolUniqueId(389);
+ static constexpr const TSymbolUniqueId greaterThan_UInt4_UInt4 = TSymbolUniqueId(390);
+ static constexpr const TSymbolUniqueId greaterThanEqual_Float2_Float2 = TSymbolUniqueId(391);
+ static constexpr const TSymbolUniqueId greaterThanEqual_Float3_Float3 = TSymbolUniqueId(392);
+ static constexpr const TSymbolUniqueId greaterThanEqual_Float4_Float4 = TSymbolUniqueId(393);
+ static constexpr const TSymbolUniqueId greaterThanEqual_Int2_Int2 = TSymbolUniqueId(394);
+ static constexpr const TSymbolUniqueId greaterThanEqual_Int3_Int3 = TSymbolUniqueId(395);
+ static constexpr const TSymbolUniqueId greaterThanEqual_Int4_Int4 = TSymbolUniqueId(396);
+ static constexpr const TSymbolUniqueId greaterThanEqual_UInt2_UInt2 = TSymbolUniqueId(397);
+ static constexpr const TSymbolUniqueId greaterThanEqual_UInt3_UInt3 = TSymbolUniqueId(398);
+ static constexpr const TSymbolUniqueId greaterThanEqual_UInt4_UInt4 = TSymbolUniqueId(399);
+ static constexpr const TSymbolUniqueId equal_Float2_Float2 = TSymbolUniqueId(400);
+ static constexpr const TSymbolUniqueId equal_Float3_Float3 = TSymbolUniqueId(401);
+ static constexpr const TSymbolUniqueId equal_Float4_Float4 = TSymbolUniqueId(402);
+ static constexpr const TSymbolUniqueId equal_Int2_Int2 = TSymbolUniqueId(403);
+ static constexpr const TSymbolUniqueId equal_Int3_Int3 = TSymbolUniqueId(404);
+ static constexpr const TSymbolUniqueId equal_Int4_Int4 = TSymbolUniqueId(405);
+ static constexpr const TSymbolUniqueId equal_UInt2_UInt2 = TSymbolUniqueId(406);
+ static constexpr const TSymbolUniqueId equal_UInt3_UInt3 = TSymbolUniqueId(407);
+ static constexpr const TSymbolUniqueId equal_UInt4_UInt4 = TSymbolUniqueId(408);
+ static constexpr const TSymbolUniqueId equal_Bool2_Bool2 = TSymbolUniqueId(409);
+ static constexpr const TSymbolUniqueId equal_Bool3_Bool3 = TSymbolUniqueId(410);
+ static constexpr const TSymbolUniqueId equal_Bool4_Bool4 = TSymbolUniqueId(411);
+ static constexpr const TSymbolUniqueId notEqual_Float2_Float2 = TSymbolUniqueId(412);
+ static constexpr const TSymbolUniqueId notEqual_Float3_Float3 = TSymbolUniqueId(413);
+ static constexpr const TSymbolUniqueId notEqual_Float4_Float4 = TSymbolUniqueId(414);
+ static constexpr const TSymbolUniqueId notEqual_Int2_Int2 = TSymbolUniqueId(415);
+ static constexpr const TSymbolUniqueId notEqual_Int3_Int3 = TSymbolUniqueId(416);
+ static constexpr const TSymbolUniqueId notEqual_Int4_Int4 = TSymbolUniqueId(417);
+ static constexpr const TSymbolUniqueId notEqual_UInt2_UInt2 = TSymbolUniqueId(418);
+ static constexpr const TSymbolUniqueId notEqual_UInt3_UInt3 = TSymbolUniqueId(419);
+ static constexpr const TSymbolUniqueId notEqual_UInt4_UInt4 = TSymbolUniqueId(420);
+ static constexpr const TSymbolUniqueId notEqual_Bool2_Bool2 = TSymbolUniqueId(421);
+ static constexpr const TSymbolUniqueId notEqual_Bool3_Bool3 = TSymbolUniqueId(422);
+ static constexpr const TSymbolUniqueId notEqual_Bool4_Bool4 = TSymbolUniqueId(423);
+ static constexpr const TSymbolUniqueId any_Bool2 = TSymbolUniqueId(424);
+ static constexpr const TSymbolUniqueId any_Bool3 = TSymbolUniqueId(425);
+ static constexpr const TSymbolUniqueId any_Bool4 = TSymbolUniqueId(426);
+ static constexpr const TSymbolUniqueId all_Bool2 = TSymbolUniqueId(427);
+ static constexpr const TSymbolUniqueId all_Bool3 = TSymbolUniqueId(428);
+ static constexpr const TSymbolUniqueId all_Bool4 = TSymbolUniqueId(429);
+ static constexpr const TSymbolUniqueId notFunc_Bool2 = TSymbolUniqueId(430);
+ static constexpr const TSymbolUniqueId notFunc_Bool3 = TSymbolUniqueId(431);
+ static constexpr const TSymbolUniqueId notFunc_Bool4 = TSymbolUniqueId(432);
+ static constexpr const TSymbolUniqueId bitfieldExtract_Int1_Int1_Int1 = TSymbolUniqueId(433);
+ static constexpr const TSymbolUniqueId bitfieldExtract_Int2_Int1_Int1 = TSymbolUniqueId(434);
+ static constexpr const TSymbolUniqueId bitfieldExtract_Int3_Int1_Int1 = TSymbolUniqueId(435);
+ static constexpr const TSymbolUniqueId bitfieldExtract_Int4_Int1_Int1 = TSymbolUniqueId(436);
+ static constexpr const TSymbolUniqueId bitfieldExtract_UInt1_Int1_Int1 = TSymbolUniqueId(437);
+ static constexpr const TSymbolUniqueId bitfieldExtract_UInt2_Int1_Int1 = TSymbolUniqueId(438);
+ static constexpr const TSymbolUniqueId bitfieldExtract_UInt3_Int1_Int1 = TSymbolUniqueId(439);
+ static constexpr const TSymbolUniqueId bitfieldExtract_UInt4_Int1_Int1 = TSymbolUniqueId(440);
+ static constexpr const TSymbolUniqueId bitfieldInsert_Int1_Int1_Int1_Int1 =
+ TSymbolUniqueId(441);
+ static constexpr const TSymbolUniqueId bitfieldInsert_Int2_Int2_Int1_Int1 =
+ TSymbolUniqueId(442);
+ static constexpr const TSymbolUniqueId bitfieldInsert_Int3_Int3_Int1_Int1 =
+ TSymbolUniqueId(443);
+ static constexpr const TSymbolUniqueId bitfieldInsert_Int4_Int4_Int1_Int1 =
+ TSymbolUniqueId(444);
+ static constexpr const TSymbolUniqueId bitfieldInsert_UInt1_UInt1_Int1_Int1 =
+ TSymbolUniqueId(445);
+ static constexpr const TSymbolUniqueId bitfieldInsert_UInt2_UInt2_Int1_Int1 =
+ TSymbolUniqueId(446);
+ static constexpr const TSymbolUniqueId bitfieldInsert_UInt3_UInt3_Int1_Int1 =
+ TSymbolUniqueId(447);
+ static constexpr const TSymbolUniqueId bitfieldInsert_UInt4_UInt4_Int1_Int1 =
+ TSymbolUniqueId(448);
+ static constexpr const TSymbolUniqueId bitfieldReverse_Int1 = TSymbolUniqueId(449);
+ static constexpr const TSymbolUniqueId bitfieldReverse_Int2 = TSymbolUniqueId(450);
+ static constexpr const TSymbolUniqueId bitfieldReverse_Int3 = TSymbolUniqueId(451);
+ static constexpr const TSymbolUniqueId bitfieldReverse_Int4 = TSymbolUniqueId(452);
+ static constexpr const TSymbolUniqueId bitfieldReverse_UInt1 = TSymbolUniqueId(453);
+ static constexpr const TSymbolUniqueId bitfieldReverse_UInt2 = TSymbolUniqueId(454);
+ static constexpr const TSymbolUniqueId bitfieldReverse_UInt3 = TSymbolUniqueId(455);
+ static constexpr const TSymbolUniqueId bitfieldReverse_UInt4 = TSymbolUniqueId(456);
+ static constexpr const TSymbolUniqueId bitCount_Int1 = TSymbolUniqueId(457);
+ static constexpr const TSymbolUniqueId bitCount_Int2 = TSymbolUniqueId(458);
+ static constexpr const TSymbolUniqueId bitCount_Int3 = TSymbolUniqueId(459);
+ static constexpr const TSymbolUniqueId bitCount_Int4 = TSymbolUniqueId(460);
+ static constexpr const TSymbolUniqueId bitCount_UInt1 = TSymbolUniqueId(461);
+ static constexpr const TSymbolUniqueId bitCount_UInt2 = TSymbolUniqueId(462);
+ static constexpr const TSymbolUniqueId bitCount_UInt3 = TSymbolUniqueId(463);
+ static constexpr const TSymbolUniqueId bitCount_UInt4 = TSymbolUniqueId(464);
+ static constexpr const TSymbolUniqueId findLSB_Int1 = TSymbolUniqueId(465);
+ static constexpr const TSymbolUniqueId findLSB_Int2 = TSymbolUniqueId(466);
+ static constexpr const TSymbolUniqueId findLSB_Int3 = TSymbolUniqueId(467);
+ static constexpr const TSymbolUniqueId findLSB_Int4 = TSymbolUniqueId(468);
+ static constexpr const TSymbolUniqueId findLSB_UInt1 = TSymbolUniqueId(469);
+ static constexpr const TSymbolUniqueId findLSB_UInt2 = TSymbolUniqueId(470);
+ static constexpr const TSymbolUniqueId findLSB_UInt3 = TSymbolUniqueId(471);
+ static constexpr const TSymbolUniqueId findLSB_UInt4 = TSymbolUniqueId(472);
+ static constexpr const TSymbolUniqueId findMSB_Int1 = TSymbolUniqueId(473);
+ static constexpr const TSymbolUniqueId findMSB_Int2 = TSymbolUniqueId(474);
+ static constexpr const TSymbolUniqueId findMSB_Int3 = TSymbolUniqueId(475);
+ static constexpr const TSymbolUniqueId findMSB_Int4 = TSymbolUniqueId(476);
+ static constexpr const TSymbolUniqueId findMSB_UInt1 = TSymbolUniqueId(477);
+ static constexpr const TSymbolUniqueId findMSB_UInt2 = TSymbolUniqueId(478);
+ static constexpr const TSymbolUniqueId findMSB_UInt3 = TSymbolUniqueId(479);
+ static constexpr const TSymbolUniqueId findMSB_UInt4 = TSymbolUniqueId(480);
+ static constexpr const TSymbolUniqueId uaddCarry_UInt1_UInt1_UInt1 = TSymbolUniqueId(481);
+ static constexpr const TSymbolUniqueId pt_o_0D = TSymbolUniqueId(482);
+ static constexpr const TSymbolUniqueId uaddCarry_UInt2_UInt2_UInt2 = TSymbolUniqueId(483);
+ static constexpr const TSymbolUniqueId pt_o_1D = TSymbolUniqueId(484);
+ static constexpr const TSymbolUniqueId uaddCarry_UInt3_UInt3_UInt3 = TSymbolUniqueId(485);
+ static constexpr const TSymbolUniqueId pt_o_2D = TSymbolUniqueId(486);
+ static constexpr const TSymbolUniqueId uaddCarry_UInt4_UInt4_UInt4 = TSymbolUniqueId(487);
+ static constexpr const TSymbolUniqueId pt_o_3D = TSymbolUniqueId(488);
+ static constexpr const TSymbolUniqueId usubBorrow_UInt1_UInt1_UInt1 = TSymbolUniqueId(489);
+ static constexpr const TSymbolUniqueId usubBorrow_UInt2_UInt2_UInt2 = TSymbolUniqueId(490);
+ static constexpr const TSymbolUniqueId usubBorrow_UInt3_UInt3_UInt3 = TSymbolUniqueId(491);
+ static constexpr const TSymbolUniqueId usubBorrow_UInt4_UInt4_UInt4 = TSymbolUniqueId(492);
+ static constexpr const TSymbolUniqueId umulExtended_UInt1_UInt1_UInt1_UInt1 =
+ TSymbolUniqueId(493);
+ static constexpr const TSymbolUniqueId umulExtended_UInt2_UInt2_UInt2_UInt2 =
+ TSymbolUniqueId(494);
+ static constexpr const TSymbolUniqueId umulExtended_UInt3_UInt3_UInt3_UInt3 =
+ TSymbolUniqueId(495);
+ static constexpr const TSymbolUniqueId umulExtended_UInt4_UInt4_UInt4_UInt4 =
+ TSymbolUniqueId(496);
+ static constexpr const TSymbolUniqueId imulExtended_Int1_Int1_Int1_Int1 = TSymbolUniqueId(497);
+ static constexpr const TSymbolUniqueId imulExtended_Int2_Int2_Int2_Int2 = TSymbolUniqueId(498);
+ static constexpr const TSymbolUniqueId imulExtended_Int3_Int3_Int3_Int3 = TSymbolUniqueId(499);
+ static constexpr const TSymbolUniqueId imulExtended_Int4_Int4_Int4_Int4 = TSymbolUniqueId(500);
+ static constexpr const TSymbolUniqueId texture2D_Sampler2D1_Float2 = TSymbolUniqueId(501);
+ static constexpr const TSymbolUniqueId pt0H = TSymbolUniqueId(502);
+ static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float3 = TSymbolUniqueId(503);
+ static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float4 = TSymbolUniqueId(504);
+ static constexpr const TSymbolUniqueId textureCube_SamplerCube1_Float3 = TSymbolUniqueId(505);
+ static constexpr const TSymbolUniqueId pt0J = TSymbolUniqueId(506);
+ static constexpr const TSymbolUniqueId texture2D_SamplerExternalOES1_Float2 =
+ TSymbolUniqueId(507);
+ static constexpr const TSymbolUniqueId pt0L = TSymbolUniqueId(508);
+ static constexpr const TSymbolUniqueId texture2DProj_SamplerExternalOES1_Float3 =
+ TSymbolUniqueId(509);
+ static constexpr const TSymbolUniqueId texture2DProj_SamplerExternalOES1_Float4 =
+ TSymbolUniqueId(510);
+ static constexpr const TSymbolUniqueId texture2DRect_Sampler2DRect1_Float2 =
+ TSymbolUniqueId(511);
+ static constexpr const TSymbolUniqueId pt0N = TSymbolUniqueId(512);
+ static constexpr const TSymbolUniqueId texture2DRectProj_Sampler2DRect1_Float3 =
+ TSymbolUniqueId(513);
+ static constexpr const TSymbolUniqueId texture2DRectProj_Sampler2DRect1_Float4 =
+ TSymbolUniqueId(514);
+ static constexpr const TSymbolUniqueId texture_Sampler2DRect1_Float2 = TSymbolUniqueId(515);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2DRect1_Float3 = TSymbolUniqueId(516);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2DRect1_Float4 = TSymbolUniqueId(517);
+ static constexpr const TSymbolUniqueId texture2DGradEXT_Sampler2D1_Float2_Float2_Float2 =
+ TSymbolUniqueId(518);
+ static constexpr const TSymbolUniqueId texture2DProjGradEXT_Sampler2D1_Float3_Float2_Float2 =
+ TSymbolUniqueId(519);
+ static constexpr const TSymbolUniqueId texture2DProjGradEXT_Sampler2D1_Float4_Float2_Float2 =
+ TSymbolUniqueId(520);
+ static constexpr const TSymbolUniqueId textureCubeGradEXT_SamplerCube1_Float3_Float3_Float3 =
+ TSymbolUniqueId(521);
+ static constexpr const TSymbolUniqueId texture2D_Sampler2D1_Float2_Float1 =
+ TSymbolUniqueId(522);
+ static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float3_Float1 =
+ TSymbolUniqueId(523);
+ static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float4_Float1 =
+ TSymbolUniqueId(524);
+ static constexpr const TSymbolUniqueId textureCube_SamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(525);
+ static constexpr const TSymbolUniqueId dFdxExt_Float1 = TSymbolUniqueId(526);
+ static constexpr const TSymbolUniqueId dFdxExt_Float2 = TSymbolUniqueId(527);
+ static constexpr const TSymbolUniqueId dFdxExt_Float3 = TSymbolUniqueId(528);
+ static constexpr const TSymbolUniqueId dFdxExt_Float4 = TSymbolUniqueId(529);
+ static constexpr const TSymbolUniqueId dFdyExt_Float1 = TSymbolUniqueId(530);
+ static constexpr const TSymbolUniqueId dFdyExt_Float2 = TSymbolUniqueId(531);
+ static constexpr const TSymbolUniqueId dFdyExt_Float3 = TSymbolUniqueId(532);
+ static constexpr const TSymbolUniqueId dFdyExt_Float4 = TSymbolUniqueId(533);
+ static constexpr const TSymbolUniqueId fwidthExt_Float1 = TSymbolUniqueId(534);
+ static constexpr const TSymbolUniqueId fwidthExt_Float2 = TSymbolUniqueId(535);
+ static constexpr const TSymbolUniqueId fwidthExt_Float3 = TSymbolUniqueId(536);
+ static constexpr const TSymbolUniqueId fwidthExt_Float4 = TSymbolUniqueId(537);
+ static constexpr const TSymbolUniqueId texture2DLodEXT_Sampler2D1_Float2_Float1 =
+ TSymbolUniqueId(538);
+ static constexpr const TSymbolUniqueId texture2DProjLodEXT_Sampler2D1_Float3_Float1 =
+ TSymbolUniqueId(539);
+ static constexpr const TSymbolUniqueId texture2DProjLodEXT_Sampler2D1_Float4_Float1 =
+ TSymbolUniqueId(540);
+ static constexpr const TSymbolUniqueId textureCubeLodEXT_SamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(541);
+ static constexpr const TSymbolUniqueId texture3D_Sampler3D1_Float3 = TSymbolUniqueId(542);
+ static constexpr const TSymbolUniqueId pt0I = TSymbolUniqueId(543);
+ static constexpr const TSymbolUniqueId texture3D_Sampler3D1_Float3_Float1 =
+ TSymbolUniqueId(544);
+ static constexpr const TSymbolUniqueId texture3DProj_Sampler3D1_Float4 = TSymbolUniqueId(545);
+ static constexpr const TSymbolUniqueId texture3DProj_Sampler3D1_Float4_Float1 =
+ TSymbolUniqueId(546);
+ static constexpr const TSymbolUniqueId texture3DLod_Sampler3D1_Float3_Float1 =
+ TSymbolUniqueId(547);
+ static constexpr const TSymbolUniqueId texture3DProjLod_Sampler3D1_Float4_Float1 =
+ TSymbolUniqueId(548);
+ static constexpr const TSymbolUniqueId texture2DLod_Sampler2D1_Float2_Float1 =
+ TSymbolUniqueId(549);
+ static constexpr const TSymbolUniqueId texture2DProjLod_Sampler2D1_Float3_Float1 =
+ TSymbolUniqueId(550);
+ static constexpr const TSymbolUniqueId texture2DProjLod_Sampler2D1_Float4_Float1 =
+ TSymbolUniqueId(551);
+ static constexpr const TSymbolUniqueId textureCubeLod_SamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(552);
+ static constexpr const TSymbolUniqueId texture_Sampler2D1_Float2 = TSymbolUniqueId(553);
+ static constexpr const TSymbolUniqueId texture_ISampler2D1_Float2 = TSymbolUniqueId(554);
+ static constexpr const TSymbolUniqueId pt0Q = TSymbolUniqueId(555);
+ static constexpr const TSymbolUniqueId texture_USampler2D1_Float2 = TSymbolUniqueId(556);
+ static constexpr const TSymbolUniqueId pt0W = TSymbolUniqueId(557);
+ static constexpr const TSymbolUniqueId texture_Sampler3D1_Float3 = TSymbolUniqueId(558);
+ static constexpr const TSymbolUniqueId texture_ISampler3D1_Float3 = TSymbolUniqueId(559);
+ static constexpr const TSymbolUniqueId pt0R = TSymbolUniqueId(560);
+ static constexpr const TSymbolUniqueId texture_USampler3D1_Float3 = TSymbolUniqueId(561);
+ static constexpr const TSymbolUniqueId pt0X = TSymbolUniqueId(562);
+ static constexpr const TSymbolUniqueId texture_SamplerCube1_Float3 = TSymbolUniqueId(563);
+ static constexpr const TSymbolUniqueId texture_ISamplerCube1_Float3 = TSymbolUniqueId(564);
+ static constexpr const TSymbolUniqueId pt0S = TSymbolUniqueId(565);
+ static constexpr const TSymbolUniqueId texture_USamplerCube1_Float3 = TSymbolUniqueId(566);
+ static constexpr const TSymbolUniqueId pt0Y = TSymbolUniqueId(567);
+ static constexpr const TSymbolUniqueId texture_Sampler2DArray1_Float3 = TSymbolUniqueId(568);
+ static constexpr const TSymbolUniqueId pt0K = TSymbolUniqueId(569);
+ static constexpr const TSymbolUniqueId texture_ISampler2DArray1_Float3 = TSymbolUniqueId(570);
+ static constexpr const TSymbolUniqueId pt0T = TSymbolUniqueId(571);
+ static constexpr const TSymbolUniqueId texture_USampler2DArray1_Float3 = TSymbolUniqueId(572);
+ static constexpr const TSymbolUniqueId pt0Z = TSymbolUniqueId(573);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float3 = TSymbolUniqueId(574);
+ static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float3 = TSymbolUniqueId(575);
+ static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float3 = TSymbolUniqueId(576);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float4 = TSymbolUniqueId(577);
+ static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float4 = TSymbolUniqueId(578);
+ static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float4 = TSymbolUniqueId(579);
+ static constexpr const TSymbolUniqueId textureProj_Sampler3D1_Float4 = TSymbolUniqueId(580);
+ static constexpr const TSymbolUniqueId textureProj_ISampler3D1_Float4 = TSymbolUniqueId(581);
+ static constexpr const TSymbolUniqueId textureProj_USampler3D1_Float4 = TSymbolUniqueId(582);
+ static constexpr const TSymbolUniqueId textureLod_Sampler2D1_Float2_Float1 =
+ TSymbolUniqueId(583);
+ static constexpr const TSymbolUniqueId textureLod_ISampler2D1_Float2_Float1 =
+ TSymbolUniqueId(584);
+ static constexpr const TSymbolUniqueId textureLod_USampler2D1_Float2_Float1 =
+ TSymbolUniqueId(585);
+ static constexpr const TSymbolUniqueId textureLod_Sampler3D1_Float3_Float1 =
+ TSymbolUniqueId(586);
+ static constexpr const TSymbolUniqueId textureLod_ISampler3D1_Float3_Float1 =
+ TSymbolUniqueId(587);
+ static constexpr const TSymbolUniqueId textureLod_USampler3D1_Float3_Float1 =
+ TSymbolUniqueId(588);
+ static constexpr const TSymbolUniqueId textureLod_SamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(589);
+ static constexpr const TSymbolUniqueId textureLod_ISamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(590);
+ static constexpr const TSymbolUniqueId textureLod_USamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(591);
+ static constexpr const TSymbolUniqueId textureLod_Sampler2DArray1_Float3_Float1 =
+ TSymbolUniqueId(592);
+ static constexpr const TSymbolUniqueId textureLod_ISampler2DArray1_Float3_Float1 =
+ TSymbolUniqueId(593);
+ static constexpr const TSymbolUniqueId textureLod_USampler2DArray1_Float3_Float1 =
+ TSymbolUniqueId(594);
+ static constexpr const TSymbolUniqueId texture_Sampler2DShadow1_Float3 = TSymbolUniqueId(595);
+ static constexpr const TSymbolUniqueId pt0c = TSymbolUniqueId(596);
+ static constexpr const TSymbolUniqueId texture_SamplerCubeShadow1_Float4 = TSymbolUniqueId(597);
+ static constexpr const TSymbolUniqueId pt0d = TSymbolUniqueId(598);
+ static constexpr const TSymbolUniqueId texture_Sampler2DArrayShadow1_Float4 =
+ TSymbolUniqueId(599);
+ static constexpr const TSymbolUniqueId pt0e = TSymbolUniqueId(600);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2DShadow1_Float4 =
+ TSymbolUniqueId(601);
+ static constexpr const TSymbolUniqueId textureLod_Sampler2DShadow1_Float3_Float1 =
+ TSymbolUniqueId(602);
+ static constexpr const TSymbolUniqueId textureSize_Sampler2D1_Int1 = TSymbolUniqueId(603);
+ static constexpr const TSymbolUniqueId textureSize_ISampler2D1_Int1 = TSymbolUniqueId(604);
+ static constexpr const TSymbolUniqueId textureSize_USampler2D1_Int1 = TSymbolUniqueId(605);
+ static constexpr const TSymbolUniqueId textureSize_Sampler3D1_Int1 = TSymbolUniqueId(606);
+ static constexpr const TSymbolUniqueId textureSize_ISampler3D1_Int1 = TSymbolUniqueId(607);
+ static constexpr const TSymbolUniqueId textureSize_USampler3D1_Int1 = TSymbolUniqueId(608);
+ static constexpr const TSymbolUniqueId textureSize_SamplerCube1_Int1 = TSymbolUniqueId(609);
+ static constexpr const TSymbolUniqueId textureSize_ISamplerCube1_Int1 = TSymbolUniqueId(610);
+ static constexpr const TSymbolUniqueId textureSize_USamplerCube1_Int1 = TSymbolUniqueId(611);
+ static constexpr const TSymbolUniqueId textureSize_Sampler2DArray1_Int1 = TSymbolUniqueId(612);
+ static constexpr const TSymbolUniqueId textureSize_ISampler2DArray1_Int1 = TSymbolUniqueId(613);
+ static constexpr const TSymbolUniqueId textureSize_USampler2DArray1_Int1 = TSymbolUniqueId(614);
+ static constexpr const TSymbolUniqueId textureSize_Sampler2DShadow1_Int1 = TSymbolUniqueId(615);
+ static constexpr const TSymbolUniqueId textureSize_SamplerCubeShadow1_Int1 =
+ TSymbolUniqueId(616);
+ static constexpr const TSymbolUniqueId textureSize_Sampler2DArrayShadow1_Int1 =
+ TSymbolUniqueId(617);
+ static constexpr const TSymbolUniqueId textureProjLod_Sampler2D1_Float3_Float1 =
+ TSymbolUniqueId(618);
+ static constexpr const TSymbolUniqueId textureProjLod_ISampler2D1_Float3_Float1 =
+ TSymbolUniqueId(619);
+ static constexpr const TSymbolUniqueId textureProjLod_USampler2D1_Float3_Float1 =
+ TSymbolUniqueId(620);
+ static constexpr const TSymbolUniqueId textureProjLod_Sampler2D1_Float4_Float1 =
+ TSymbolUniqueId(621);
+ static constexpr const TSymbolUniqueId textureProjLod_ISampler2D1_Float4_Float1 =
+ TSymbolUniqueId(622);
+ static constexpr const TSymbolUniqueId textureProjLod_USampler2D1_Float4_Float1 =
+ TSymbolUniqueId(623);
+ static constexpr const TSymbolUniqueId textureProjLod_Sampler3D1_Float4_Float1 =
+ TSymbolUniqueId(624);
+ static constexpr const TSymbolUniqueId textureProjLod_ISampler3D1_Float4_Float1 =
+ TSymbolUniqueId(625);
+ static constexpr const TSymbolUniqueId textureProjLod_USampler3D1_Float4_Float1 =
+ TSymbolUniqueId(626);
+ static constexpr const TSymbolUniqueId textureProjLod_Sampler2DShadow1_Float4_Float1 =
+ TSymbolUniqueId(627);
+ static constexpr const TSymbolUniqueId texelFetch_Sampler2D1_Int2_Int1 = TSymbolUniqueId(628);
+ static constexpr const TSymbolUniqueId texelFetch_ISampler2D1_Int2_Int1 = TSymbolUniqueId(629);
+ static constexpr const TSymbolUniqueId texelFetch_USampler2D1_Int2_Int1 = TSymbolUniqueId(630);
+ static constexpr const TSymbolUniqueId texelFetch_Sampler3D1_Int3_Int1 = TSymbolUniqueId(631);
+ static constexpr const TSymbolUniqueId texelFetch_ISampler3D1_Int3_Int1 = TSymbolUniqueId(632);
+ static constexpr const TSymbolUniqueId texelFetch_USampler3D1_Int3_Int1 = TSymbolUniqueId(633);
+ static constexpr const TSymbolUniqueId texelFetch_Sampler2DArray1_Int3_Int1 =
+ TSymbolUniqueId(634);
+ static constexpr const TSymbolUniqueId texelFetch_ISampler2DArray1_Int3_Int1 =
+ TSymbolUniqueId(635);
+ static constexpr const TSymbolUniqueId texelFetch_USampler2DArray1_Int3_Int1 =
+ TSymbolUniqueId(636);
+ static constexpr const TSymbolUniqueId textureGrad_Sampler2D1_Float2_Float2_Float2 =
+ TSymbolUniqueId(637);
+ static constexpr const TSymbolUniqueId textureGrad_ISampler2D1_Float2_Float2_Float2 =
+ TSymbolUniqueId(638);
+ static constexpr const TSymbolUniqueId textureGrad_USampler2D1_Float2_Float2_Float2 =
+ TSymbolUniqueId(639);
+ static constexpr const TSymbolUniqueId textureGrad_Sampler3D1_Float3_Float3_Float3 =
+ TSymbolUniqueId(640);
+ static constexpr const TSymbolUniqueId textureGrad_ISampler3D1_Float3_Float3_Float3 =
+ TSymbolUniqueId(641);
+ static constexpr const TSymbolUniqueId textureGrad_USampler3D1_Float3_Float3_Float3 =
+ TSymbolUniqueId(642);
+ static constexpr const TSymbolUniqueId textureGrad_SamplerCube1_Float3_Float3_Float3 =
+ TSymbolUniqueId(643);
+ static constexpr const TSymbolUniqueId textureGrad_ISamplerCube1_Float3_Float3_Float3 =
+ TSymbolUniqueId(644);
+ static constexpr const TSymbolUniqueId textureGrad_USamplerCube1_Float3_Float3_Float3 =
+ TSymbolUniqueId(645);
+ static constexpr const TSymbolUniqueId textureGrad_Sampler2DShadow1_Float3_Float2_Float2 =
+ TSymbolUniqueId(646);
+ static constexpr const TSymbolUniqueId textureGrad_SamplerCubeShadow1_Float4_Float3_Float3 =
+ TSymbolUniqueId(647);
+ static constexpr const TSymbolUniqueId textureGrad_Sampler2DArray1_Float3_Float2_Float2 =
+ TSymbolUniqueId(648);
+ static constexpr const TSymbolUniqueId textureGrad_ISampler2DArray1_Float3_Float2_Float2 =
+ TSymbolUniqueId(649);
+ static constexpr const TSymbolUniqueId textureGrad_USampler2DArray1_Float3_Float2_Float2 =
+ TSymbolUniqueId(650);
+ static constexpr const TSymbolUniqueId textureGrad_Sampler2DArrayShadow1_Float4_Float2_Float2 =
+ TSymbolUniqueId(651);
+ static constexpr const TSymbolUniqueId textureProjGrad_Sampler2D1_Float3_Float2_Float2 =
+ TSymbolUniqueId(652);
+ static constexpr const TSymbolUniqueId textureProjGrad_ISampler2D1_Float3_Float2_Float2 =
+ TSymbolUniqueId(653);
+ static constexpr const TSymbolUniqueId textureProjGrad_USampler2D1_Float3_Float2_Float2 =
+ TSymbolUniqueId(654);
+ static constexpr const TSymbolUniqueId textureProjGrad_Sampler2D1_Float4_Float2_Float2 =
+ TSymbolUniqueId(655);
+ static constexpr const TSymbolUniqueId textureProjGrad_ISampler2D1_Float4_Float2_Float2 =
+ TSymbolUniqueId(656);
+ static constexpr const TSymbolUniqueId textureProjGrad_USampler2D1_Float4_Float2_Float2 =
+ TSymbolUniqueId(657);
+ static constexpr const TSymbolUniqueId textureProjGrad_Sampler3D1_Float4_Float3_Float3 =
+ TSymbolUniqueId(658);
+ static constexpr const TSymbolUniqueId textureProjGrad_ISampler3D1_Float4_Float3_Float3 =
+ TSymbolUniqueId(659);
+ static constexpr const TSymbolUniqueId textureProjGrad_USampler3D1_Float4_Float3_Float3 =
+ TSymbolUniqueId(660);
+ static constexpr const TSymbolUniqueId textureProjGrad_Sampler2DShadow1_Float4_Float2_Float2 =
+ TSymbolUniqueId(661);
+ static constexpr const TSymbolUniqueId textureSize_Sampler2DMS1 = TSymbolUniqueId(662);
+ static constexpr const TSymbolUniqueId pt0O = TSymbolUniqueId(663);
+ static constexpr const TSymbolUniqueId textureSize_ISampler2DMS1 = TSymbolUniqueId(664);
+ static constexpr const TSymbolUniqueId pt0U = TSymbolUniqueId(665);
+ static constexpr const TSymbolUniqueId textureSize_USampler2DMS1 = TSymbolUniqueId(666);
+ static constexpr const TSymbolUniqueId pt0a = TSymbolUniqueId(667);
+ static constexpr const TSymbolUniqueId textureSizeExt_Sampler2DMS1 = TSymbolUniqueId(668);
+ static constexpr const TSymbolUniqueId textureSizeExt_ISampler2DMS1 = TSymbolUniqueId(669);
+ static constexpr const TSymbolUniqueId textureSizeExt_USampler2DMS1 = TSymbolUniqueId(670);
+ static constexpr const TSymbolUniqueId textureSize_Sampler2DMSArray1 = TSymbolUniqueId(671);
+ static constexpr const TSymbolUniqueId pt0P = TSymbolUniqueId(672);
+ static constexpr const TSymbolUniqueId textureSize_ISampler2DMSArray1 = TSymbolUniqueId(673);
+ static constexpr const TSymbolUniqueId pt0V = TSymbolUniqueId(674);
+ static constexpr const TSymbolUniqueId textureSize_USampler2DMSArray1 = TSymbolUniqueId(675);
+ static constexpr const TSymbolUniqueId pt0b = TSymbolUniqueId(676);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler2D1_Float2_Int2 =
+ TSymbolUniqueId(677);
+ static constexpr const TSymbolUniqueId textureOffset_ISampler2D1_Float2_Int2 =
+ TSymbolUniqueId(678);
+ static constexpr const TSymbolUniqueId textureOffset_USampler2D1_Float2_Int2 =
+ TSymbolUniqueId(679);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler3D1_Float3_Int3 =
+ TSymbolUniqueId(680);
+ static constexpr const TSymbolUniqueId textureOffset_ISampler3D1_Float3_Int3 =
+ TSymbolUniqueId(681);
+ static constexpr const TSymbolUniqueId textureOffset_USampler3D1_Float3_Int3 =
+ TSymbolUniqueId(682);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler2DShadow1_Float3_Int2 =
+ TSymbolUniqueId(683);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler2DArray1_Float3_Int2 =
+ TSymbolUniqueId(684);
+ static constexpr const TSymbolUniqueId textureOffset_ISampler2DArray1_Float3_Int2 =
+ TSymbolUniqueId(685);
+ static constexpr const TSymbolUniqueId textureOffset_USampler2DArray1_Float3_Int2 =
+ TSymbolUniqueId(686);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float3_Int2 =
+ TSymbolUniqueId(687);
+ static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float3_Int2 =
+ TSymbolUniqueId(688);
+ static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float3_Int2 =
+ TSymbolUniqueId(689);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float4_Int2 =
+ TSymbolUniqueId(690);
+ static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float4_Int2 =
+ TSymbolUniqueId(691);
+ static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float4_Int2 =
+ TSymbolUniqueId(692);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler3D1_Float4_Int3 =
+ TSymbolUniqueId(693);
+ static constexpr const TSymbolUniqueId textureProjOffset_ISampler3D1_Float4_Int3 =
+ TSymbolUniqueId(694);
+ static constexpr const TSymbolUniqueId textureProjOffset_USampler3D1_Float4_Int3 =
+ TSymbolUniqueId(695);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler2DShadow1_Float4_Int2 =
+ TSymbolUniqueId(696);
+ static constexpr const TSymbolUniqueId textureLodOffset_Sampler2D1_Float2_Float1_Int2 =
+ TSymbolUniqueId(697);
+ static constexpr const TSymbolUniqueId textureLodOffset_ISampler2D1_Float2_Float1_Int2 =
+ TSymbolUniqueId(698);
+ static constexpr const TSymbolUniqueId textureLodOffset_USampler2D1_Float2_Float1_Int2 =
+ TSymbolUniqueId(699);
+ static constexpr const TSymbolUniqueId textureLodOffset_Sampler3D1_Float3_Float1_Int3 =
+ TSymbolUniqueId(700);
+ static constexpr const TSymbolUniqueId textureLodOffset_ISampler3D1_Float3_Float1_Int3 =
+ TSymbolUniqueId(701);
+ static constexpr const TSymbolUniqueId textureLodOffset_USampler3D1_Float3_Float1_Int3 =
+ TSymbolUniqueId(702);
+ static constexpr const TSymbolUniqueId textureLodOffset_Sampler2DShadow1_Float3_Float1_Int2 =
+ TSymbolUniqueId(703);
+ static constexpr const TSymbolUniqueId textureLodOffset_Sampler2DArray1_Float3_Float1_Int2 =
+ TSymbolUniqueId(704);
+ static constexpr const TSymbolUniqueId textureLodOffset_ISampler2DArray1_Float3_Float1_Int2 =
+ TSymbolUniqueId(705);
+ static constexpr const TSymbolUniqueId textureLodOffset_USampler2DArray1_Float3_Float1_Int2 =
+ TSymbolUniqueId(706);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_Sampler2D1_Float3_Float1_Int2 =
+ TSymbolUniqueId(707);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_ISampler2D1_Float3_Float1_Int2 =
+ TSymbolUniqueId(708);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_USampler2D1_Float3_Float1_Int2 =
+ TSymbolUniqueId(709);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_Sampler2D1_Float4_Float1_Int2 =
+ TSymbolUniqueId(710);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_ISampler2D1_Float4_Float1_Int2 =
+ TSymbolUniqueId(711);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_USampler2D1_Float4_Float1_Int2 =
+ TSymbolUniqueId(712);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_Sampler3D1_Float4_Float1_Int3 =
+ TSymbolUniqueId(713);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_ISampler3D1_Float4_Float1_Int3 =
+ TSymbolUniqueId(714);
+ static constexpr const TSymbolUniqueId textureProjLodOffset_USampler3D1_Float4_Float1_Int3 =
+ TSymbolUniqueId(715);
+ static constexpr const TSymbolUniqueId
+ textureProjLodOffset_Sampler2DShadow1_Float4_Float1_Int2 = TSymbolUniqueId(716);
+ static constexpr const TSymbolUniqueId texelFetchOffset_Sampler2D1_Int2_Int1_Int2 =
+ TSymbolUniqueId(717);
+ static constexpr const TSymbolUniqueId texelFetchOffset_ISampler2D1_Int2_Int1_Int2 =
+ TSymbolUniqueId(718);
+ static constexpr const TSymbolUniqueId texelFetchOffset_USampler2D1_Int2_Int1_Int2 =
+ TSymbolUniqueId(719);
+ static constexpr const TSymbolUniqueId texelFetchOffset_Sampler3D1_Int3_Int1_Int3 =
+ TSymbolUniqueId(720);
+ static constexpr const TSymbolUniqueId texelFetchOffset_ISampler3D1_Int3_Int1_Int3 =
+ TSymbolUniqueId(721);
+ static constexpr const TSymbolUniqueId texelFetchOffset_USampler3D1_Int3_Int1_Int3 =
+ TSymbolUniqueId(722);
+ static constexpr const TSymbolUniqueId texelFetchOffset_Sampler2DArray1_Int3_Int1_Int2 =
+ TSymbolUniqueId(723);
+ static constexpr const TSymbolUniqueId texelFetchOffset_ISampler2DArray1_Int3_Int1_Int2 =
+ TSymbolUniqueId(724);
+ static constexpr const TSymbolUniqueId texelFetchOffset_USampler2DArray1_Int3_Int1_Int2 =
+ TSymbolUniqueId(725);
+ static constexpr const TSymbolUniqueId textureGradOffset_Sampler2D1_Float2_Float2_Float2_Int2 =
+ TSymbolUniqueId(726);
+ static constexpr const TSymbolUniqueId textureGradOffset_ISampler2D1_Float2_Float2_Float2_Int2 =
+ TSymbolUniqueId(727);
+ static constexpr const TSymbolUniqueId textureGradOffset_USampler2D1_Float2_Float2_Float2_Int2 =
+ TSymbolUniqueId(728);
+ static constexpr const TSymbolUniqueId textureGradOffset_Sampler3D1_Float3_Float3_Float3_Int3 =
+ TSymbolUniqueId(729);
+ static constexpr const TSymbolUniqueId textureGradOffset_ISampler3D1_Float3_Float3_Float3_Int3 =
+ TSymbolUniqueId(730);
+ static constexpr const TSymbolUniqueId textureGradOffset_USampler3D1_Float3_Float3_Float3_Int3 =
+ TSymbolUniqueId(731);
+ static constexpr const TSymbolUniqueId
+ textureGradOffset_Sampler2DShadow1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(732);
+ static constexpr const TSymbolUniqueId
+ textureGradOffset_Sampler2DArray1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(733);
+ static constexpr const TSymbolUniqueId
+ textureGradOffset_ISampler2DArray1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(734);
+ static constexpr const TSymbolUniqueId
+ textureGradOffset_USampler2DArray1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(735);
+ static constexpr const TSymbolUniqueId
+ textureGradOffset_Sampler2DArrayShadow1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(736);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_Sampler2D1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(737);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_ISampler2D1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(738);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_USampler2D1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(739);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_Sampler2D1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(740);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_ISampler2D1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(741);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_USampler2D1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(742);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_Sampler3D1_Float4_Float3_Float3_Int3 = TSymbolUniqueId(743);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_ISampler3D1_Float4_Float3_Float3_Int3 = TSymbolUniqueId(744);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_USampler3D1_Float4_Float3_Float3_Int3 = TSymbolUniqueId(745);
+ static constexpr const TSymbolUniqueId
+ textureProjGradOffset_Sampler2DShadow1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(746);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler2D1_Float2_Int2_Float1 =
+ TSymbolUniqueId(747);
+ static constexpr const TSymbolUniqueId textureOffset_ISampler2D1_Float2_Int2_Float1 =
+ TSymbolUniqueId(748);
+ static constexpr const TSymbolUniqueId textureOffset_USampler2D1_Float2_Int2_Float1 =
+ TSymbolUniqueId(749);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler3D1_Float3_Int3_Float1 =
+ TSymbolUniqueId(750);
+ static constexpr const TSymbolUniqueId textureOffset_ISampler3D1_Float3_Int3_Float1 =
+ TSymbolUniqueId(751);
+ static constexpr const TSymbolUniqueId textureOffset_USampler3D1_Float3_Int3_Float1 =
+ TSymbolUniqueId(752);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler2DShadow1_Float3_Int2_Float1 =
+ TSymbolUniqueId(753);
+ static constexpr const TSymbolUniqueId textureOffset_Sampler2DArray1_Float3_Int2_Float1 =
+ TSymbolUniqueId(754);
+ static constexpr const TSymbolUniqueId textureOffset_ISampler2DArray1_Float3_Int2_Float1 =
+ TSymbolUniqueId(755);
+ static constexpr const TSymbolUniqueId textureOffset_USampler2DArray1_Float3_Int2_Float1 =
+ TSymbolUniqueId(756);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float3_Int2_Float1 =
+ TSymbolUniqueId(757);
+ static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float3_Int2_Float1 =
+ TSymbolUniqueId(758);
+ static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float3_Int2_Float1 =
+ TSymbolUniqueId(759);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float4_Int2_Float1 =
+ TSymbolUniqueId(760);
+ static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float4_Int2_Float1 =
+ TSymbolUniqueId(761);
+ static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float4_Int2_Float1 =
+ TSymbolUniqueId(762);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler3D1_Float4_Int3_Float1 =
+ TSymbolUniqueId(763);
+ static constexpr const TSymbolUniqueId textureProjOffset_ISampler3D1_Float4_Int3_Float1 =
+ TSymbolUniqueId(764);
+ static constexpr const TSymbolUniqueId textureProjOffset_USampler3D1_Float4_Int3_Float1 =
+ TSymbolUniqueId(765);
+ static constexpr const TSymbolUniqueId textureProjOffset_Sampler2DShadow1_Float4_Int2_Float1 =
+ TSymbolUniqueId(766);
+ static constexpr const TSymbolUniqueId texture_SamplerExternalOES1_Float2 =
+ TSymbolUniqueId(767);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float3 =
+ TSymbolUniqueId(768);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float4 =
+ TSymbolUniqueId(769);
+ static constexpr const TSymbolUniqueId textureSize_SamplerExternalOES1_Int1 =
+ TSymbolUniqueId(770);
+ static constexpr const TSymbolUniqueId texelFetch_SamplerExternalOES1_Int2_Int1 =
+ TSymbolUniqueId(771);
+ static constexpr const TSymbolUniqueId texture_SamplerExternal2DY2YEXT1_Float2 =
+ TSymbolUniqueId(772);
+ static constexpr const TSymbolUniqueId pt0M = TSymbolUniqueId(773);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float3 =
+ TSymbolUniqueId(774);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float4 =
+ TSymbolUniqueId(775);
+ static constexpr const TSymbolUniqueId rgb_2_yuv_Float3_YuvCscStandardEXT1 =
+ TSymbolUniqueId(776);
+ static constexpr const TSymbolUniqueId pt0G = TSymbolUniqueId(777);
+ static constexpr const TSymbolUniqueId yuv_2_rgb_Float3_YuvCscStandardEXT1 =
+ TSymbolUniqueId(778);
+ static constexpr const TSymbolUniqueId textureSize_SamplerExternal2DY2YEXT1_Int1 =
+ TSymbolUniqueId(779);
+ static constexpr const TSymbolUniqueId texelFetch_SamplerExternal2DY2YEXT1_Int2_Int1 =
+ TSymbolUniqueId(780);
+ static constexpr const TSymbolUniqueId texture_Sampler2D1_Float2_Float1 = TSymbolUniqueId(781);
+ static constexpr const TSymbolUniqueId texture_ISampler2D1_Float2_Float1 = TSymbolUniqueId(782);
+ static constexpr const TSymbolUniqueId texture_USampler2D1_Float2_Float1 = TSymbolUniqueId(783);
+ static constexpr const TSymbolUniqueId texture_Sampler3D1_Float3_Float1 = TSymbolUniqueId(784);
+ static constexpr const TSymbolUniqueId texture_ISampler3D1_Float3_Float1 = TSymbolUniqueId(785);
+ static constexpr const TSymbolUniqueId texture_USampler3D1_Float3_Float1 = TSymbolUniqueId(786);
+ static constexpr const TSymbolUniqueId texture_SamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(787);
+ static constexpr const TSymbolUniqueId texture_ISamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(788);
+ static constexpr const TSymbolUniqueId texture_USamplerCube1_Float3_Float1 =
+ TSymbolUniqueId(789);
+ static constexpr const TSymbolUniqueId texture_Sampler2DArray1_Float3_Float1 =
+ TSymbolUniqueId(790);
+ static constexpr const TSymbolUniqueId texture_ISampler2DArray1_Float3_Float1 =
+ TSymbolUniqueId(791);
+ static constexpr const TSymbolUniqueId texture_USampler2DArray1_Float3_Float1 =
+ TSymbolUniqueId(792);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float3_Float1 =
+ TSymbolUniqueId(793);
+ static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float3_Float1 =
+ TSymbolUniqueId(794);
+ static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float3_Float1 =
+ TSymbolUniqueId(795);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float4_Float1 =
+ TSymbolUniqueId(796);
+ static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float4_Float1 =
+ TSymbolUniqueId(797);
+ static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float4_Float1 =
+ TSymbolUniqueId(798);
+ static constexpr const TSymbolUniqueId textureProj_Sampler3D1_Float4_Float1 =
+ TSymbolUniqueId(799);
+ static constexpr const TSymbolUniqueId textureProj_ISampler3D1_Float4_Float1 =
+ TSymbolUniqueId(800);
+ static constexpr const TSymbolUniqueId textureProj_USampler3D1_Float4_Float1 =
+ TSymbolUniqueId(801);
+ static constexpr const TSymbolUniqueId texture_Sampler2DShadow1_Float3_Float1 =
+ TSymbolUniqueId(802);
+ static constexpr const TSymbolUniqueId texture_SamplerCubeShadow1_Float4_Float1 =
+ TSymbolUniqueId(803);
+ static constexpr const TSymbolUniqueId textureProj_Sampler2DShadow1_Float4_Float1 =
+ TSymbolUniqueId(804);
+ static constexpr const TSymbolUniqueId texture_SamplerExternalOES1_Float2_Float1 =
+ TSymbolUniqueId(805);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float3_Float1 =
+ TSymbolUniqueId(806);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float4_Float1 =
+ TSymbolUniqueId(807);
+ static constexpr const TSymbolUniqueId texture_SamplerExternal2DY2YEXT1_Float2_Float1 =
+ TSymbolUniqueId(808);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float3_Float1 =
+ TSymbolUniqueId(809);
+ static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float4_Float1 =
+ TSymbolUniqueId(810);
+ static constexpr const TSymbolUniqueId texelFetch_Sampler2DMS1_Int2_Int1 = TSymbolUniqueId(811);
+ static constexpr const TSymbolUniqueId texelFetch_ISampler2DMS1_Int2_Int1 =
+ TSymbolUniqueId(812);
+ static constexpr const TSymbolUniqueId texelFetch_USampler2DMS1_Int2_Int1 =
+ TSymbolUniqueId(813);
+ static constexpr const TSymbolUniqueId texelFetchExt_Sampler2DMS1_Int2_Int1 =
+ TSymbolUniqueId(814);
+ static constexpr const TSymbolUniqueId texelFetchExt_ISampler2DMS1_Int2_Int1 =
+ TSymbolUniqueId(815);
+ static constexpr const TSymbolUniqueId texelFetchExt_USampler2DMS1_Int2_Int1 =
+ TSymbolUniqueId(816);
+ static constexpr const TSymbolUniqueId texelFetch_Sampler2DMSArray1_Int3_Int1 =
+ TSymbolUniqueId(817);
+ static constexpr const TSymbolUniqueId texelFetch_ISampler2DMSArray1_Int3_Int1 =
+ TSymbolUniqueId(818);
+ static constexpr const TSymbolUniqueId texelFetch_USampler2DMSArray1_Int3_Int1 =
+ TSymbolUniqueId(819);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2D1_Float2 = TSymbolUniqueId(820);
+ static constexpr const TSymbolUniqueId textureGather_ISampler2D1_Float2 = TSymbolUniqueId(821);
+ static constexpr const TSymbolUniqueId textureGather_USampler2D1_Float2 = TSymbolUniqueId(822);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2D1_Float2_Int1 =
+ TSymbolUniqueId(823);
+ static constexpr const TSymbolUniqueId textureGather_ISampler2D1_Float2_Int1 =
+ TSymbolUniqueId(824);
+ static constexpr const TSymbolUniqueId textureGather_USampler2D1_Float2_Int1 =
+ TSymbolUniqueId(825);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2DArray1_Float3 =
+ TSymbolUniqueId(826);
+ static constexpr const TSymbolUniqueId textureGather_ISampler2DArray1_Float3 =
+ TSymbolUniqueId(827);
+ static constexpr const TSymbolUniqueId textureGather_USampler2DArray1_Float3 =
+ TSymbolUniqueId(828);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2DArray1_Float3_Int1 =
+ TSymbolUniqueId(829);
+ static constexpr const TSymbolUniqueId textureGather_ISampler2DArray1_Float3_Int1 =
+ TSymbolUniqueId(830);
+ static constexpr const TSymbolUniqueId textureGather_USampler2DArray1_Float3_Int1 =
+ TSymbolUniqueId(831);
+ static constexpr const TSymbolUniqueId textureGather_SamplerCube1_Float3 = TSymbolUniqueId(832);
+ static constexpr const TSymbolUniqueId textureGather_ISamplerCube1_Float3 =
+ TSymbolUniqueId(833);
+ static constexpr const TSymbolUniqueId textureGather_USamplerCube1_Float3 =
+ TSymbolUniqueId(834);
+ static constexpr const TSymbolUniqueId textureGather_SamplerCube1_Float3_Int1 =
+ TSymbolUniqueId(835);
+ static constexpr const TSymbolUniqueId textureGather_ISamplerCube1_Float3_Int1 =
+ TSymbolUniqueId(836);
+ static constexpr const TSymbolUniqueId textureGather_USamplerCube1_Float3_Int1 =
+ TSymbolUniqueId(837);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2DShadow1_Float2 =
+ TSymbolUniqueId(838);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2DShadow1_Float2_Float1 =
+ TSymbolUniqueId(839);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2DArrayShadow1_Float3 =
+ TSymbolUniqueId(840);
+ static constexpr const TSymbolUniqueId textureGather_Sampler2DArrayShadow1_Float3_Float1 =
+ TSymbolUniqueId(841);
+ static constexpr const TSymbolUniqueId textureGather_SamplerCubeShadow1_Float3 =
+ TSymbolUniqueId(842);
+ static constexpr const TSymbolUniqueId textureGather_SamplerCubeShadow1_Float3_Float1 =
+ TSymbolUniqueId(843);
+ static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2D1_Float2_Int2 =
+ TSymbolUniqueId(844);
+ static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2D1_Float2_Int2 =
+ TSymbolUniqueId(845);
+ static constexpr const TSymbolUniqueId textureGatherOffset_USampler2D1_Float2_Int2 =
+ TSymbolUniqueId(846);
+ static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2D1_Float2_Int2_Int1 =
+ TSymbolUniqueId(847);
+ static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2D1_Float2_Int2_Int1 =
+ TSymbolUniqueId(848);
+ static constexpr const TSymbolUniqueId textureGatherOffset_USampler2D1_Float2_Int2_Int1 =
+ TSymbolUniqueId(849);
+ static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2DArray1_Float3_Int2 =
+ TSymbolUniqueId(850);
+ static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2DArray1_Float3_Int2 =
+ TSymbolUniqueId(851);
+ static constexpr const TSymbolUniqueId textureGatherOffset_USampler2DArray1_Float3_Int2 =
+ TSymbolUniqueId(852);
+ static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2DArray1_Float3_Int2_Int1 =
+ TSymbolUniqueId(853);
+ static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2DArray1_Float3_Int2_Int1 =
+ TSymbolUniqueId(854);
+ static constexpr const TSymbolUniqueId textureGatherOffset_USampler2DArray1_Float3_Int2_Int1 =
+ TSymbolUniqueId(855);
+ static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2DShadow1_Float2_Float1_Int2 =
+ TSymbolUniqueId(856);
+ static constexpr const TSymbolUniqueId
+ textureGatherOffset_Sampler2DArrayShadow1_Float3_Float1_Int2 = TSymbolUniqueId(857);
+ static constexpr const TSymbolUniqueId dFdx_Float1 = TSymbolUniqueId(858);
+ static constexpr const TSymbolUniqueId dFdx_Float2 = TSymbolUniqueId(859);
+ static constexpr const TSymbolUniqueId dFdx_Float3 = TSymbolUniqueId(860);
+ static constexpr const TSymbolUniqueId dFdx_Float4 = TSymbolUniqueId(861);
+ static constexpr const TSymbolUniqueId dFdy_Float1 = TSymbolUniqueId(862);
+ static constexpr const TSymbolUniqueId dFdy_Float2 = TSymbolUniqueId(863);
+ static constexpr const TSymbolUniqueId dFdy_Float3 = TSymbolUniqueId(864);
+ static constexpr const TSymbolUniqueId dFdy_Float4 = TSymbolUniqueId(865);
+ static constexpr const TSymbolUniqueId fwidth_Float1 = TSymbolUniqueId(866);
+ static constexpr const TSymbolUniqueId fwidth_Float2 = TSymbolUniqueId(867);
+ static constexpr const TSymbolUniqueId fwidth_Float3 = TSymbolUniqueId(868);
+ static constexpr const TSymbolUniqueId fwidth_Float4 = TSymbolUniqueId(869);
+ static constexpr const TSymbolUniqueId atomicCounter_AtomicCounter1 = TSymbolUniqueId(870);
+ static constexpr const TSymbolUniqueId pt0F = TSymbolUniqueId(871);
+ static constexpr const TSymbolUniqueId atomicCounterIncrement_AtomicCounter1 =
+ TSymbolUniqueId(872);
+ static constexpr const TSymbolUniqueId atomicCounterDecrement_AtomicCounter1 =
+ TSymbolUniqueId(873);
+ static constexpr const TSymbolUniqueId atomicAdd_UInt1_UInt1 = TSymbolUniqueId(874);
+ static constexpr const TSymbolUniqueId pt_io_0D = TSymbolUniqueId(875);
+ static constexpr const TSymbolUniqueId atomicAdd_Int1_Int1 = TSymbolUniqueId(876);
+ static constexpr const TSymbolUniqueId pt_io_0C = TSymbolUniqueId(877);
+ static constexpr const TSymbolUniqueId atomicMin_UInt1_UInt1 = TSymbolUniqueId(878);
+ static constexpr const TSymbolUniqueId atomicMin_Int1_Int1 = TSymbolUniqueId(879);
+ static constexpr const TSymbolUniqueId atomicMax_UInt1_UInt1 = TSymbolUniqueId(880);
+ static constexpr const TSymbolUniqueId atomicMax_Int1_Int1 = TSymbolUniqueId(881);
+ static constexpr const TSymbolUniqueId atomicAnd_UInt1_UInt1 = TSymbolUniqueId(882);
+ static constexpr const TSymbolUniqueId atomicAnd_Int1_Int1 = TSymbolUniqueId(883);
+ static constexpr const TSymbolUniqueId atomicOr_UInt1_UInt1 = TSymbolUniqueId(884);
+ static constexpr const TSymbolUniqueId atomicOr_Int1_Int1 = TSymbolUniqueId(885);
+ static constexpr const TSymbolUniqueId atomicXor_UInt1_UInt1 = TSymbolUniqueId(886);
+ static constexpr const TSymbolUniqueId atomicXor_Int1_Int1 = TSymbolUniqueId(887);
+ static constexpr const TSymbolUniqueId atomicExchange_UInt1_UInt1 = TSymbolUniqueId(888);
+ static constexpr const TSymbolUniqueId atomicExchange_Int1_Int1 = TSymbolUniqueId(889);
+ static constexpr const TSymbolUniqueId atomicCompSwap_UInt1_UInt1_UInt1 = TSymbolUniqueId(890);
+ static constexpr const TSymbolUniqueId atomicCompSwap_Int1_Int1_Int1 = TSymbolUniqueId(891);
+ static constexpr const TSymbolUniqueId imageSize_Image2D1 = TSymbolUniqueId(892);
+ static constexpr const TSymbolUniqueId pt0f = TSymbolUniqueId(893);
+ static constexpr const TSymbolUniqueId imageSize_IImage2D1 = TSymbolUniqueId(894);
+ static constexpr const TSymbolUniqueId pt0g = TSymbolUniqueId(895);
+ static constexpr const TSymbolUniqueId imageSize_UImage2D1 = TSymbolUniqueId(896);
+ static constexpr const TSymbolUniqueId pt0h = TSymbolUniqueId(897);
+ static constexpr const TSymbolUniqueId imageSize_Image3D1 = TSymbolUniqueId(898);
+ static constexpr const TSymbolUniqueId pt0i = TSymbolUniqueId(899);
+ static constexpr const TSymbolUniqueId imageSize_IImage3D1 = TSymbolUniqueId(900);
+ static constexpr const TSymbolUniqueId pt0j = TSymbolUniqueId(901);
+ static constexpr const TSymbolUniqueId imageSize_UImage3D1 = TSymbolUniqueId(902);
+ static constexpr const TSymbolUniqueId pt0k = TSymbolUniqueId(903);
+ static constexpr const TSymbolUniqueId imageSize_Image2DArray1 = TSymbolUniqueId(904);
+ static constexpr const TSymbolUniqueId pt0l = TSymbolUniqueId(905);
+ static constexpr const TSymbolUniqueId imageSize_IImage2DArray1 = TSymbolUniqueId(906);
+ static constexpr const TSymbolUniqueId pt0m = TSymbolUniqueId(907);
+ static constexpr const TSymbolUniqueId imageSize_UImage2DArray1 = TSymbolUniqueId(908);
+ static constexpr const TSymbolUniqueId pt0n = TSymbolUniqueId(909);
+ static constexpr const TSymbolUniqueId imageSize_ImageCube1 = TSymbolUniqueId(910);
+ static constexpr const TSymbolUniqueId pt0o = TSymbolUniqueId(911);
+ static constexpr const TSymbolUniqueId imageSize_IImageCube1 = TSymbolUniqueId(912);
+ static constexpr const TSymbolUniqueId pt0p = TSymbolUniqueId(913);
+ static constexpr const TSymbolUniqueId imageSize_UImageCube1 = TSymbolUniqueId(914);
+ static constexpr const TSymbolUniqueId pt0q = TSymbolUniqueId(915);
+ static constexpr const TSymbolUniqueId imageLoad_Image2D1_Int2 = TSymbolUniqueId(916);
+ static constexpr const TSymbolUniqueId imageLoad_IImage2D1_Int2 = TSymbolUniqueId(917);
+ static constexpr const TSymbolUniqueId imageLoad_UImage2D1_Int2 = TSymbolUniqueId(918);
+ static constexpr const TSymbolUniqueId imageLoad_Image3D1_Int3 = TSymbolUniqueId(919);
+ static constexpr const TSymbolUniqueId imageLoad_IImage3D1_Int3 = TSymbolUniqueId(920);
+ static constexpr const TSymbolUniqueId imageLoad_UImage3D1_Int3 = TSymbolUniqueId(921);
+ static constexpr const TSymbolUniqueId imageLoad_Image2DArray1_Int3 = TSymbolUniqueId(922);
+ static constexpr const TSymbolUniqueId imageLoad_IImage2DArray1_Int3 = TSymbolUniqueId(923);
+ static constexpr const TSymbolUniqueId imageLoad_UImage2DArray1_Int3 = TSymbolUniqueId(924);
+ static constexpr const TSymbolUniqueId imageLoad_ImageCube1_Int3 = TSymbolUniqueId(925);
+ static constexpr const TSymbolUniqueId imageLoad_IImageCube1_Int3 = TSymbolUniqueId(926);
+ static constexpr const TSymbolUniqueId imageLoad_UImageCube1_Int3 = TSymbolUniqueId(927);
+ static constexpr const TSymbolUniqueId imageStore_Image2D1_Int2_Float4 = TSymbolUniqueId(928);
+ static constexpr const TSymbolUniqueId imageStore_IImage2D1_Int2_Int4 = TSymbolUniqueId(929);
+ static constexpr const TSymbolUniqueId imageStore_UImage2D1_Int2_UInt4 = TSymbolUniqueId(930);
+ static constexpr const TSymbolUniqueId imageStore_Image3D1_Int3_Float4 = TSymbolUniqueId(931);
+ static constexpr const TSymbolUniqueId imageStore_IImage3D1_Int3_Int4 = TSymbolUniqueId(932);
+ static constexpr const TSymbolUniqueId imageStore_UImage3D1_Int3_UInt4 = TSymbolUniqueId(933);
+ static constexpr const TSymbolUniqueId imageStore_Image2DArray1_Int3_Float4 =
+ TSymbolUniqueId(934);
+ static constexpr const TSymbolUniqueId imageStore_IImage2DArray1_Int3_Int4 =
+ TSymbolUniqueId(935);
+ static constexpr const TSymbolUniqueId imageStore_UImage2DArray1_Int3_UInt4 =
+ TSymbolUniqueId(936);
+ static constexpr const TSymbolUniqueId imageStore_ImageCube1_Int3_Float4 = TSymbolUniqueId(937);
+ static constexpr const TSymbolUniqueId imageStore_IImageCube1_Int3_Int4 = TSymbolUniqueId(938);
+ static constexpr const TSymbolUniqueId imageStore_UImageCube1_Int3_UInt4 = TSymbolUniqueId(939);
+ static constexpr const TSymbolUniqueId memoryBarrier = TSymbolUniqueId(940);
+ static constexpr const TSymbolUniqueId memoryBarrierAtomicCounter = TSymbolUniqueId(941);
+ static constexpr const TSymbolUniqueId memoryBarrierBuffer = TSymbolUniqueId(942);
+ static constexpr const TSymbolUniqueId memoryBarrierImage = TSymbolUniqueId(943);
+ static constexpr const TSymbolUniqueId barrier = TSymbolUniqueId(944);
+ static constexpr const TSymbolUniqueId memoryBarrierShared = TSymbolUniqueId(945);
+ static constexpr const TSymbolUniqueId groupMemoryBarrier = TSymbolUniqueId(946);
+ static constexpr const TSymbolUniqueId EmitVertex = TSymbolUniqueId(947);
+ static constexpr const TSymbolUniqueId EndPrimitive = TSymbolUniqueId(948);
+ static constexpr const TSymbolUniqueId gl_DepthRangeParameters = TSymbolUniqueId(949);
+ static constexpr const TSymbolUniqueId gl_DepthRange = TSymbolUniqueId(950);
+ static constexpr const TSymbolUniqueId gl_MaxVertexAttribs = TSymbolUniqueId(951);
+ static constexpr const TSymbolUniqueId gl_MaxVertexUniformVectors = TSymbolUniqueId(952);
+ static constexpr const TSymbolUniqueId gl_MaxVertexTextureImageUnits = TSymbolUniqueId(953);
+ static constexpr const TSymbolUniqueId gl_MaxCombinedTextureImageUnits = TSymbolUniqueId(954);
+ static constexpr const TSymbolUniqueId gl_MaxTextureImageUnits = TSymbolUniqueId(955);
+ static constexpr const TSymbolUniqueId gl_MaxFragmentUniformVectors = TSymbolUniqueId(956);
+ static constexpr const TSymbolUniqueId gl_MaxVaryingVectors = TSymbolUniqueId(957);
+ static constexpr const TSymbolUniqueId gl_MaxDrawBuffers = TSymbolUniqueId(958);
+ static constexpr const TSymbolUniqueId gl_MaxDualSourceDrawBuffersEXT = TSymbolUniqueId(959);
+ static constexpr const TSymbolUniqueId gl_MaxVertexOutputVectors = TSymbolUniqueId(960);
+ static constexpr const TSymbolUniqueId gl_MaxFragmentInputVectors = TSymbolUniqueId(961);
+ static constexpr const TSymbolUniqueId gl_MinProgramTexelOffset = TSymbolUniqueId(962);
+ static constexpr const TSymbolUniqueId gl_MaxProgramTexelOffset = TSymbolUniqueId(963);
+ static constexpr const TSymbolUniqueId gl_MaxImageUnits = TSymbolUniqueId(964);
+ static constexpr const TSymbolUniqueId gl_MaxVertexImageUniforms = TSymbolUniqueId(965);
+ static constexpr const TSymbolUniqueId gl_MaxFragmentImageUniforms = TSymbolUniqueId(966);
+ static constexpr const TSymbolUniqueId gl_MaxComputeImageUniforms = TSymbolUniqueId(967);
+ static constexpr const TSymbolUniqueId gl_MaxCombinedImageUniforms = TSymbolUniqueId(968);
+ static constexpr const TSymbolUniqueId gl_MaxCombinedShaderOutputResources =
+ TSymbolUniqueId(969);
+ static constexpr const TSymbolUniqueId gl_MaxComputeWorkGroupCount = TSymbolUniqueId(970);
+ static constexpr const TSymbolUniqueId gl_MaxComputeWorkGroupSize = TSymbolUniqueId(971);
+ static constexpr const TSymbolUniqueId gl_MaxComputeUniformComponents = TSymbolUniqueId(972);
+ static constexpr const TSymbolUniqueId gl_MaxComputeTextureImageUnits = TSymbolUniqueId(973);
+ static constexpr const TSymbolUniqueId gl_MaxComputeAtomicCounters = TSymbolUniqueId(974);
+ static constexpr const TSymbolUniqueId gl_MaxComputeAtomicCounterBuffers = TSymbolUniqueId(975);
+ static constexpr const TSymbolUniqueId gl_MaxVertexAtomicCounters = TSymbolUniqueId(976);
+ static constexpr const TSymbolUniqueId gl_MaxFragmentAtomicCounters = TSymbolUniqueId(977);
+ static constexpr const TSymbolUniqueId gl_MaxCombinedAtomicCounters = TSymbolUniqueId(978);
+ static constexpr const TSymbolUniqueId gl_MaxAtomicCounterBindings = TSymbolUniqueId(979);
+ static constexpr const TSymbolUniqueId gl_MaxVertexAtomicCounterBuffers = TSymbolUniqueId(980);
+ static constexpr const TSymbolUniqueId gl_MaxFragmentAtomicCounterBuffers =
+ TSymbolUniqueId(981);
+ static constexpr const TSymbolUniqueId gl_MaxCombinedAtomicCounterBuffers =
+ TSymbolUniqueId(982);
+ static constexpr const TSymbolUniqueId gl_MaxAtomicCounterBufferSize = TSymbolUniqueId(983);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryInputComponents = TSymbolUniqueId(984);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryOutputComponents = TSymbolUniqueId(985);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryImageUniforms = TSymbolUniqueId(986);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryTextureImageUnits = TSymbolUniqueId(987);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryOutputVertices = TSymbolUniqueId(988);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryTotalOutputComponents =
+ TSymbolUniqueId(989);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryUniformComponents = TSymbolUniqueId(990);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryAtomicCounters = TSymbolUniqueId(991);
+ static constexpr const TSymbolUniqueId gl_MaxGeometryAtomicCounterBuffers =
+ TSymbolUniqueId(992);
+ static constexpr const TSymbolUniqueId gl_FragCoord = TSymbolUniqueId(993);
+ static constexpr const TSymbolUniqueId gl_FrontFacing = TSymbolUniqueId(994);
+ static constexpr const TSymbolUniqueId gl_PointCoord = TSymbolUniqueId(995);
+ static constexpr const TSymbolUniqueId gl_FragColor = TSymbolUniqueId(996);
+ static constexpr const TSymbolUniqueId gl_FragData = TSymbolUniqueId(997);
+ static constexpr const TSymbolUniqueId gl_FragDepth = TSymbolUniqueId(998);
+ static constexpr const TSymbolUniqueId gl_SecondaryFragColorEXT = TSymbolUniqueId(999);
+ static constexpr const TSymbolUniqueId gl_SecondaryFragDataEXT = TSymbolUniqueId(1000);
+ static constexpr const TSymbolUniqueId gl_FragDepthEXT = TSymbolUniqueId(1001);
+ static constexpr const TSymbolUniqueId gl_LastFragData = TSymbolUniqueId(1002);
+ static constexpr const TSymbolUniqueId gl_LastFragColor = TSymbolUniqueId(1003);
+ static constexpr const TSymbolUniqueId gl_LastFragDataNV = TSymbolUniqueId(1004);
+ static constexpr const TSymbolUniqueId gl_LastFragColorARM = TSymbolUniqueId(1005);
+ static constexpr const TSymbolUniqueId gl_PrimitiveID = TSymbolUniqueId(1006);
+ static constexpr const TSymbolUniqueId gl_Layer = TSymbolUniqueId(1007);
+ static constexpr const TSymbolUniqueId gl_Position = TSymbolUniqueId(1008);
+ static constexpr const TSymbolUniqueId gl_PointSize = TSymbolUniqueId(1009);
+ static constexpr const TSymbolUniqueId gl_InstanceID = TSymbolUniqueId(1010);
+ static constexpr const TSymbolUniqueId gl_VertexID = TSymbolUniqueId(1011);
+ static constexpr const TSymbolUniqueId gl_ViewportIndex = TSymbolUniqueId(1012);
+ static constexpr const TSymbolUniqueId gl_LayerVS = TSymbolUniqueId(1013);
+ static constexpr const TSymbolUniqueId gl_DrawID = TSymbolUniqueId(1014);
+ static constexpr const TSymbolUniqueId gl_DrawIDESSL1 = TSymbolUniqueId(1015);
+ static constexpr const TSymbolUniqueId gl_BaseVertex = TSymbolUniqueId(1016);
+ static constexpr const TSymbolUniqueId gl_BaseInstance = TSymbolUniqueId(1017);
+ static constexpr const TSymbolUniqueId gl_NumWorkGroups = TSymbolUniqueId(1018);
+ static constexpr const TSymbolUniqueId gl_WorkGroupSize = TSymbolUniqueId(1019);
+ static constexpr const TSymbolUniqueId gl_WorkGroupID = TSymbolUniqueId(1020);
+ static constexpr const TSymbolUniqueId gl_LocalInvocationID = TSymbolUniqueId(1021);
+ static constexpr const TSymbolUniqueId gl_GlobalInvocationID = TSymbolUniqueId(1022);
+ static constexpr const TSymbolUniqueId gl_LocalInvocationIndex = TSymbolUniqueId(1023);
+ static constexpr const TSymbolUniqueId gl_PrimitiveIDIn = TSymbolUniqueId(1024);
+ static constexpr const TSymbolUniqueId gl_InvocationID = TSymbolUniqueId(1025);
+ static constexpr const TSymbolUniqueId gl_PrimitiveIDGS = TSymbolUniqueId(1026);
+ static constexpr const TSymbolUniqueId gl_LayerGS = TSymbolUniqueId(1027);
+ static constexpr const TSymbolUniqueId gl_PerVertex = TSymbolUniqueId(1028);
+ static constexpr const TSymbolUniqueId gl_in = TSymbolUniqueId(1029);
+ static constexpr const TSymbolUniqueId gl_PerVertexOutBlock = TSymbolUniqueId(1030);
+ static constexpr const TSymbolUniqueId gl_PositionGS = TSymbolUniqueId(1031);
+ static constexpr const TSymbolUniqueId gl_ViewID_OVR = TSymbolUniqueId(1032);
+ static constexpr const TSymbolUniqueId gl_ViewID_OVRESSL1 = TSymbolUniqueId(1033);
+
+}; // class BuiltInId
+
+namespace BuiltInVariable
+{
+
+const TVariable *gl_BaseInstance();
+const TVariable *gl_BaseVertex();
+const TVariable *gl_DrawID();
+const TVariable *gl_DrawIDESSL1();
+const TVariable *gl_FragColor();
+const TVariable *gl_FragCoord();
+const TVariable *gl_FragDepth();
+const TVariable *gl_FrontFacing();
+const TVariable *gl_GlobalInvocationID();
+const TVariable *gl_InstanceID();
+const TVariable *gl_InvocationID();
+const TVariable *gl_LastFragColor();
+const TVariable *gl_LastFragColorARM();
+const TVariable *gl_Layer();
+const TVariable *gl_LayerGS();
+const TVariable *gl_LayerVS();
+const TVariable *gl_LocalInvocationID();
+const TVariable *gl_LocalInvocationIndex();
+const TVariable *gl_NumWorkGroups();
+const TVariable *gl_PointCoord();
+const TVariable *gl_PointSize();
+const TVariable *gl_Position();
+const TVariable *gl_PrimitiveID();
+const TVariable *gl_PrimitiveIDGS();
+const TVariable *gl_PrimitiveIDIn();
+const TVariable *gl_SecondaryFragColorEXT();
+const TVariable *gl_VertexID();
+const TVariable *gl_ViewID_OVR();
+const TVariable *gl_ViewID_OVRESSL1();
+const TVariable *gl_ViewportIndex();
+const TVariable *gl_WorkGroupID();
+const TVariable *gl_WorkGroupSize();
+
+} // namespace BuiltInVariable
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_BUILTIN_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.cpp
new file mode 100644
index 0000000000..198040df14
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.cpp
@@ -0,0 +1,32 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FindFunction.cpp: Find functions.
+
+#include "compiler/translator/tree_util/FindFunction.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/Symbol.h"
+
+namespace sh
+{
+
+size_t FindFirstFunctionDefinitionIndex(TIntermBlock *root)
+{
+ const TIntermSequence &sequence = *root->getSequence();
+ for (size_t index = 0; index < sequence.size(); ++index)
+ {
+ TIntermNode *node = sequence[index];
+ TIntermFunctionDefinition *nodeFunction = node->getAsFunctionDefinition();
+ if (nodeFunction != nullptr)
+ {
+ return index;
+ }
+ }
+ return std::numeric_limits<size_t>::max();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.h b/gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.h
new file mode 100644
index 0000000000..946a135037
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindFunction.h
@@ -0,0 +1,21 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FindFunction.h: Adds functions to find functions
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_FINDFUNCTION_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_FINDFUNCTION_H_
+
+#include <cstddef>
+
+namespace sh
+{
+class TIntermBlock;
+
+size_t FindFirstFunctionDefinitionIndex(TIntermBlock *root);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_FINDFUNCTION_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.cpp
new file mode 100644
index 0000000000..0e3023b2bf
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.cpp
@@ -0,0 +1,54 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FindMain.cpp: Find the main() function definition in a given AST.
+
+#include "compiler/translator/tree_util/FindMain.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/Symbol.h"
+
+namespace sh
+{
+
+size_t FindMainIndex(TIntermBlock *root)
+{
+ const TIntermSequence &sequence = *root->getSequence();
+ for (size_t index = 0; index < sequence.size(); ++index)
+ {
+ TIntermNode *node = sequence[index];
+ TIntermFunctionDefinition *nodeFunction = node->getAsFunctionDefinition();
+ if (nodeFunction != nullptr && nodeFunction->getFunction()->isMain())
+ {
+ return index;
+ }
+ }
+ return std::numeric_limits<size_t>::max();
+}
+
+TIntermFunctionDefinition *FindMain(TIntermBlock *root)
+{
+ for (TIntermNode *node : *root->getSequence())
+ {
+ TIntermFunctionDefinition *nodeFunction = node->getAsFunctionDefinition();
+ if (nodeFunction != nullptr && nodeFunction->getFunction()->isMain())
+ {
+ return nodeFunction;
+ }
+ }
+ return nullptr;
+}
+
+TIntermBlock *FindMainBody(TIntermBlock *root)
+{
+ TIntermFunctionDefinition *main = FindMain(root);
+ ASSERT(main != nullptr);
+ TIntermBlock *mainBody = main->getBody();
+ ASSERT(mainBody != nullptr);
+ return mainBody;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.h b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.h
new file mode 100644
index 0000000000..a313315d76
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.h
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FindMain.h: Adds functions to get the main function definition and its body.
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_FINDMAIN_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_FINDMAIN_H_
+
+#include <cstddef>
+
+namespace sh
+{
+class TIntermBlock;
+class TIntermFunctionDefinition;
+
+size_t FindMainIndex(TIntermBlock *root);
+TIntermFunctionDefinition *FindMain(TIntermBlock *root);
+TIntermBlock *FindMainBody(TIntermBlock *root);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_FINDMAIN_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp
new file mode 100644
index 0000000000..3eeb9cfd05
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp
@@ -0,0 +1,53 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FindSymbol.cpp:
+// Utility for finding a symbol node inside an AST tree.
+
+#include "compiler/translator/tree_util/FindSymbolNode.h"
+
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class SymbolFinder : public TIntermTraverser
+{
+ public:
+ SymbolFinder(const ImmutableString &symbolName)
+ : TIntermTraverser(true, false, false), mSymbolName(symbolName), mNodeFound(nullptr)
+ {}
+
+ void visitSymbol(TIntermSymbol *node)
+ {
+ if (node->variable().symbolType() != SymbolType::Empty && node->getName() == mSymbolName)
+ {
+ mNodeFound = node;
+ }
+ }
+
+ bool isFound() const { return mNodeFound != nullptr; }
+ const TIntermSymbol *getNode() const { return mNodeFound; }
+
+ private:
+ ImmutableString mSymbolName;
+ TIntermSymbol *mNodeFound;
+};
+
+} // anonymous namespace
+
+const TIntermSymbol *FindSymbolNode(TIntermNode *root, const ImmutableString &symbolName)
+{
+ SymbolFinder finder(symbolName);
+ root->traverse(&finder);
+ return finder.getNode();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.h b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.h
new file mode 100644
index 0000000000..f285479277
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.h
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FindSymbolNode.h:
+// Utility for finding a symbol node inside an AST tree.
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_FINDSYMBOLNODE_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_FINDSYMBOLNODE_H_
+
+namespace sh
+{
+
+class ImmutableString;
+class TIntermNode;
+class TIntermSymbol;
+
+const TIntermSymbol *FindSymbolNode(TIntermNode *root, const ImmutableString &symbolName);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_FINDSYMBOLNODE_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp
new file mode 100644
index 0000000000..0f3c3a42a3
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp
@@ -0,0 +1,204 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// IntermNodePatternMatcher is a helper class for matching node trees to given patterns.
+// It can be used whenever the same checks for certain node structures are common to multiple AST
+// traversers.
+//
+
+#include "compiler/translator/tree_util/IntermNodePatternMatcher.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/util.h"
+
+namespace sh
+{
+
+namespace
+{
+
+bool ContainsMatrixNode(const TIntermSequence &sequence)
+{
+ for (size_t ii = 0; ii < sequence.size(); ++ii)
+ {
+ TIntermTyped *node = sequence[ii]->getAsTyped();
+ if (node && node->isMatrix())
+ return true;
+ }
+ return false;
+}
+
+bool ContainsVectorNode(const TIntermSequence &sequence)
+{
+ for (size_t ii = 0; ii < sequence.size(); ++ii)
+ {
+ TIntermTyped *node = sequence[ii]->getAsTyped();
+ if (node && node->isVector())
+ return true;
+ }
+ return false;
+}
+
+} // anonymous namespace
+
+IntermNodePatternMatcher::IntermNodePatternMatcher(const unsigned int mask) : mMask(mask) {}
+
+// static
+bool IntermNodePatternMatcher::IsDynamicIndexingOfNonSSBOVectorOrMatrix(TIntermBinary *node)
+{
+ return IsDynamicIndexingOfVectorOrMatrix(node) && !IsInShaderStorageBlock(node->getLeft());
+}
+
+// static
+bool IntermNodePatternMatcher::IsDynamicIndexingOfVectorOrMatrix(TIntermBinary *node)
+{
+ return node->getOp() == EOpIndexIndirect && !node->getLeft()->isArray() &&
+ node->getLeft()->getBasicType() != EbtStruct;
+}
+
+bool IntermNodePatternMatcher::matchInternal(TIntermBinary *node, TIntermNode *parentNode)
+{
+ if ((mMask & kExpressionReturningArray) != 0)
+ {
+ if (node->isArray() && node->getOp() == EOpAssign && parentNode != nullptr &&
+ !parentNode->getAsBlock())
+ {
+ return true;
+ }
+ }
+
+ if ((mMask & kUnfoldedShortCircuitExpression) != 0)
+ {
+ if (node->getRight()->hasSideEffects() &&
+ (node->getOp() == EOpLogicalOr || node->getOp() == EOpLogicalAnd))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool IntermNodePatternMatcher::match(TIntermUnary *node)
+{
+ if ((mMask & kArrayLengthMethod) != 0)
+ {
+ if (node->getOp() == EOpArrayLength)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool IntermNodePatternMatcher::match(TIntermBinary *node, TIntermNode *parentNode)
+{
+ // L-value tracking information is needed to check for dynamic indexing in L-value.
+ // Traversers that don't track l-values can still use this class and match binary nodes with
+ // this variation of this method if they don't need to check for dynamic indexing in l-values.
+ ASSERT((mMask & kDynamicIndexingOfVectorOrMatrixInLValue) == 0);
+ return matchInternal(node, parentNode);
+}
+
+bool IntermNodePatternMatcher::match(TIntermBinary *node,
+ TIntermNode *parentNode,
+ bool isLValueRequiredHere)
+{
+ if (matchInternal(node, parentNode))
+ {
+ return true;
+ }
+ if ((mMask & kDynamicIndexingOfVectorOrMatrixInLValue) != 0)
+ {
+ if (isLValueRequiredHere && IsDynamicIndexingOfVectorOrMatrix(node))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool IntermNodePatternMatcher::match(TIntermAggregate *node, TIntermNode *parentNode)
+{
+ if ((mMask & kExpressionReturningArray) != 0)
+ {
+ if (parentNode != nullptr)
+ {
+ TIntermBinary *parentBinary = parentNode->getAsBinaryNode();
+ bool parentIsAssignment =
+ (parentBinary != nullptr &&
+ (parentBinary->getOp() == EOpAssign || parentBinary->getOp() == EOpInitialize));
+
+ if (node->getType().isArray() && !parentIsAssignment &&
+ (node->isConstructor() || node->isFunctionCall()) && !parentNode->getAsBlock())
+ {
+ return true;
+ }
+ }
+ }
+ if ((mMask & kScalarizedVecOrMatConstructor) != 0)
+ {
+ if (node->getOp() == EOpConstruct)
+ {
+ if (node->getType().isVector() && ContainsMatrixNode(*(node->getSequence())))
+ {
+ return true;
+ }
+ else if (node->getType().isMatrix() && ContainsVectorNode(*(node->getSequence())))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool IntermNodePatternMatcher::match(TIntermTernary *node)
+{
+ if ((mMask & kUnfoldedShortCircuitExpression) != 0)
+ {
+ return true;
+ }
+ return false;
+}
+
+bool IntermNodePatternMatcher::match(TIntermDeclaration *node)
+{
+ if ((mMask & kMultiDeclaration) != 0)
+ {
+ if (node->getSequence()->size() > 1)
+ {
+ return true;
+ }
+ }
+ if ((mMask & kArrayDeclaration) != 0)
+ {
+ if (node->getSequence()->front()->getAsTyped()->getType().isStructureContainingArrays())
+ {
+ return true;
+ }
+ // Need to check from all declarators whether they are arrays since that may vary between
+ // declarators.
+ for (TIntermNode *declarator : *node->getSequence())
+ {
+ if (declarator->getAsTyped()->isArray())
+ {
+ return true;
+ }
+ }
+ }
+ if ((mMask & kNamelessStructDeclaration) != 0)
+ {
+ TIntermTyped *declarator = node->getSequence()->front()->getAsTyped();
+ if (declarator->getBasicType() == EbtStruct &&
+ declarator->getType().getStruct()->symbolType() == SymbolType::Empty)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.h b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.h
new file mode 100644
index 0000000000..25a46ff4f6
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// IntermNodePatternMatcher is a helper class for matching node trees to given patterns.
+// It can be used whenever the same checks for certain node structures are common to multiple AST
+// traversers.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_INTERMNODEPATTERNMATCHER_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_INTERMNODEPATTERNMATCHER_H_
+
+namespace sh
+{
+
+class TIntermAggregate;
+class TIntermBinary;
+class TIntermDeclaration;
+class TIntermNode;
+class TIntermTernary;
+class TIntermUnary;
+
+class IntermNodePatternMatcher
+{
+ public:
+ static bool IsDynamicIndexingOfNonSSBOVectorOrMatrix(TIntermBinary *node);
+ static bool IsDynamicIndexingOfVectorOrMatrix(TIntermBinary *node);
+
+ enum PatternType
+ {
+ // Matches expressions that are unfolded to if statements by UnfoldShortCircuitToIf
+ kUnfoldedShortCircuitExpression = 0x0001,
+
+ // Matches expressions that return arrays with the exception of simple statements where a
+ // constructor or function call result is assigned.
+ kExpressionReturningArray = 0x0001 << 1,
+
+ // Matches dynamic indexing of vectors or matrices in l-values.
+ kDynamicIndexingOfVectorOrMatrixInLValue = 0x0001 << 2,
+
+ // Matches declarations with more than one declared variables.
+ kMultiDeclaration = 0x0001 << 3,
+
+ // Matches declarations of arrays.
+ kArrayDeclaration = 0x0001 << 4,
+
+ // Matches declarations of structs where the struct type does not have a name.
+ kNamelessStructDeclaration = 0x0001 << 5,
+
+ // Matches array length() method.
+ kArrayLengthMethod = 0x0001 << 6,
+
+ // Matches a vector or matrix constructor whose arguments are scalarized by the
+ // SH_SCALARIZE_VEC_OR_MAT_CONSTRUCTOR_ARGUMENTS workaround.
+ kScalarizedVecOrMatConstructor = 0x0001 << 7
+ };
+ IntermNodePatternMatcher(const unsigned int mask);
+
+ bool match(TIntermUnary *node);
+
+ bool match(TIntermBinary *node, TIntermNode *parentNode);
+
+ // Use this version for checking binary node matches in case you're using flag
+ // kDynamicIndexingOfVectorOrMatrixInLValue.
+ bool match(TIntermBinary *node, TIntermNode *parentNode, bool isLValueRequiredHere);
+
+ bool match(TIntermAggregate *node, TIntermNode *parentNode);
+ bool match(TIntermTernary *node);
+ bool match(TIntermDeclaration *node);
+
+ private:
+ const unsigned int mMask;
+
+ bool matchInternal(TIntermBinary *node, TIntermNode *parentNode);
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_INTERMNODEPATTERNMATCHER_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.cpp
new file mode 100644
index 0000000000..224535bd8c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.cpp
@@ -0,0 +1,291 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// IntermNode_util.cpp: High-level utilities for creating AST nodes and node hierarchies. Mostly
+// meant to be used in AST transforms.
+
+#include "compiler/translator/tree_util/IntermNode_util.h"
+
+#include "compiler/translator/FunctionLookup.h"
+#include "compiler/translator/SymbolTable.h"
+
+namespace sh
+{
+
+namespace
+{
+
+const TFunction *LookUpBuiltInFunction(const char *name,
+ const TIntermSequence *arguments,
+ const TSymbolTable &symbolTable,
+ int shaderVersion)
+{
+ const ImmutableString &mangledName = TFunctionLookup::GetMangledName(name, *arguments);
+ const TSymbol *symbol = symbolTable.findBuiltIn(mangledName, shaderVersion);
+ if (symbol)
+ {
+ ASSERT(symbol->isFunction());
+ return static_cast<const TFunction *>(symbol);
+ }
+ return nullptr;
+}
+
+} // anonymous namespace
+
+TIntermFunctionPrototype *CreateInternalFunctionPrototypeNode(const TFunction &func)
+{
+ return new TIntermFunctionPrototype(&func);
+}
+
+TIntermFunctionDefinition *CreateInternalFunctionDefinitionNode(const TFunction &func,
+ TIntermBlock *functionBody)
+{
+ return new TIntermFunctionDefinition(new TIntermFunctionPrototype(&func), functionBody);
+}
+
+TIntermTyped *CreateZeroNode(const TType &type)
+{
+ TType constType(type);
+ constType.setQualifier(EvqConst);
+
+ if (!type.isArray() && type.getBasicType() != EbtStruct)
+ {
+ size_t size = constType.getObjectSize();
+ TConstantUnion *u = new TConstantUnion[size];
+ for (size_t i = 0; i < size; ++i)
+ {
+ switch (type.getBasicType())
+ {
+ case EbtFloat:
+ u[i].setFConst(0.0f);
+ break;
+ case EbtInt:
+ u[i].setIConst(0);
+ break;
+ case EbtUInt:
+ u[i].setUConst(0u);
+ break;
+ case EbtBool:
+ u[i].setBConst(false);
+ break;
+ default:
+ // CreateZeroNode is called by ParseContext that keeps parsing even when an
+ // error occurs, so it is possible for CreateZeroNode to be called with
+ // non-basic types. This happens only on error condition but CreateZeroNode
+ // needs to return a value with the correct type to continue the typecheck.
+ // That's why we handle non-basic type by setting whatever value, we just need
+ // the type to be right.
+ u[i].setIConst(42);
+ break;
+ }
+ }
+
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, constType);
+ return node;
+ }
+
+ TIntermSequence *arguments = new TIntermSequence();
+
+ if (type.isArray())
+ {
+ TType elementType(type);
+ elementType.toArrayElementType();
+
+ size_t arraySize = type.getOutermostArraySize();
+ for (size_t i = 0; i < arraySize; ++i)
+ {
+ arguments->push_back(CreateZeroNode(elementType));
+ }
+ }
+ else
+ {
+ ASSERT(type.getBasicType() == EbtStruct);
+
+ const TStructure *structure = type.getStruct();
+ for (const auto &field : structure->fields())
+ {
+ arguments->push_back(CreateZeroNode(*field->type()));
+ }
+ }
+
+ return TIntermAggregate::CreateConstructor(constType, arguments);
+}
+
+TIntermConstantUnion *CreateIndexNode(int index)
+{
+ TConstantUnion *u = new TConstantUnion[1];
+ u[0].setIConst(index);
+
+ TType type(EbtInt, EbpUndefined, EvqConst, 1);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
+ return node;
+}
+
+TIntermConstantUnion *CreateBoolNode(bool value)
+{
+ TConstantUnion *u = new TConstantUnion[1];
+ u[0].setBConst(value);
+
+ TType type(EbtBool, EbpUndefined, EvqConst, 1);
+ TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
+ return node;
+}
+
+TVariable *CreateTempVariable(TSymbolTable *symbolTable, const TType *type)
+{
+ ASSERT(symbolTable != nullptr);
+ // TODO(oetuaho): Might be useful to sanitize layout qualifier etc. on the type of the created
+ // variable. This might need to be done in other places as well.
+ return new TVariable(symbolTable, kEmptyImmutableString, type, SymbolType::AngleInternal);
+}
+
+TVariable *CreateTempVariable(TSymbolTable *symbolTable, const TType *type, TQualifier qualifier)
+{
+ ASSERT(symbolTable != nullptr);
+ if (type->getQualifier() == qualifier)
+ {
+ return CreateTempVariable(symbolTable, type);
+ }
+ TType *typeWithQualifier = new TType(*type);
+ typeWithQualifier->setQualifier(qualifier);
+ return CreateTempVariable(symbolTable, typeWithQualifier);
+}
+
+TIntermSymbol *CreateTempSymbolNode(const TVariable *tempVariable)
+{
+ ASSERT(tempVariable->symbolType() == SymbolType::AngleInternal);
+ ASSERT(tempVariable->getType().getQualifier() == EvqTemporary ||
+ tempVariable->getType().getQualifier() == EvqConst ||
+ tempVariable->getType().getQualifier() == EvqGlobal);
+ return new TIntermSymbol(tempVariable);
+}
+
+TIntermDeclaration *CreateTempDeclarationNode(const TVariable *tempVariable)
+{
+ TIntermDeclaration *tempDeclaration = new TIntermDeclaration();
+ tempDeclaration->appendDeclarator(CreateTempSymbolNode(tempVariable));
+ return tempDeclaration;
+}
+
+TIntermDeclaration *CreateTempInitDeclarationNode(const TVariable *tempVariable,
+ TIntermTyped *initializer)
+{
+ ASSERT(initializer != nullptr);
+ TIntermSymbol *tempSymbol = CreateTempSymbolNode(tempVariable);
+ TIntermDeclaration *tempDeclaration = new TIntermDeclaration();
+ TIntermBinary *tempInit = new TIntermBinary(EOpInitialize, tempSymbol, initializer);
+ tempDeclaration->appendDeclarator(tempInit);
+ return tempDeclaration;
+}
+
+TIntermBinary *CreateTempAssignmentNode(const TVariable *tempVariable, TIntermTyped *rightNode)
+{
+ ASSERT(rightNode != nullptr);
+ TIntermSymbol *tempSymbol = CreateTempSymbolNode(tempVariable);
+ return new TIntermBinary(EOpAssign, tempSymbol, rightNode);
+}
+
+TVariable *DeclareTempVariable(TSymbolTable *symbolTable,
+ const TType *type,
+ TQualifier qualifier,
+ TIntermDeclaration **declarationOut)
+{
+ TVariable *variable = CreateTempVariable(symbolTable, type, qualifier);
+ *declarationOut = CreateTempDeclarationNode(variable);
+ return variable;
+}
+
+TVariable *DeclareTempVariable(TSymbolTable *symbolTable,
+ TIntermTyped *initializer,
+ TQualifier qualifier,
+ TIntermDeclaration **declarationOut)
+{
+ TVariable *variable =
+ CreateTempVariable(symbolTable, new TType(initializer->getType()), qualifier);
+ *declarationOut = CreateTempInitDeclarationNode(variable, initializer);
+ return variable;
+}
+
+const TVariable *DeclareInterfaceBlock(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ TFieldList *fieldList,
+ TQualifier qualifier,
+ const TMemoryQualifier &memoryQualifier,
+ const char *blockTypeName,
+ const char *blockVariableName)
+{
+ // Define an interface block.
+ TLayoutQualifier layoutQualifier = TLayoutQualifier::Create();
+ TInterfaceBlock *interfaceBlock =
+ new TInterfaceBlock(symbolTable, ImmutableString(blockTypeName), fieldList, layoutQualifier,
+ SymbolType::AngleInternal);
+
+ // Turn the inteface block into a declaration.
+ TType *interfaceBlockType = new TType(interfaceBlock, qualifier, layoutQualifier);
+ interfaceBlockType->setMemoryQualifier(memoryQualifier);
+
+ TIntermDeclaration *interfaceBlockDecl = new TIntermDeclaration;
+ TVariable *interfaceBlockVar = new TVariable(symbolTable, ImmutableString(blockVariableName),
+ interfaceBlockType, SymbolType::AngleInternal);
+ TIntermSymbol *interfaceBlockDeclarator = new TIntermSymbol(interfaceBlockVar);
+ interfaceBlockDecl->appendDeclarator(interfaceBlockDeclarator);
+
+ // Insert the declarations before the first function.
+ TIntermSequence *insertSequence = new TIntermSequence;
+ insertSequence->push_back(interfaceBlockDecl);
+
+ size_t firstFunctionIndex = FindFirstFunctionDefinitionIndex(root);
+ root->insertChildNodes(firstFunctionIndex, *insertSequence);
+
+ return interfaceBlockVar;
+}
+
+TIntermBlock *EnsureBlock(TIntermNode *node)
+{
+ if (node == nullptr)
+ return nullptr;
+ TIntermBlock *blockNode = node->getAsBlock();
+ if (blockNode != nullptr)
+ return blockNode;
+
+ blockNode = new TIntermBlock();
+ blockNode->setLine(node->getLine());
+ blockNode->appendStatement(node);
+ return blockNode;
+}
+
+TIntermSymbol *ReferenceGlobalVariable(const ImmutableString &name, const TSymbolTable &symbolTable)
+{
+ const TVariable *var = static_cast<const TVariable *>(symbolTable.findGlobal(name));
+ ASSERT(var);
+ return new TIntermSymbol(var);
+}
+
+TIntermSymbol *ReferenceBuiltInVariable(const ImmutableString &name,
+ const TSymbolTable &symbolTable,
+ int shaderVersion)
+{
+ const TVariable *var =
+ static_cast<const TVariable *>(symbolTable.findBuiltIn(name, shaderVersion));
+ ASSERT(var);
+ return new TIntermSymbol(var);
+}
+
+TIntermTyped *CreateBuiltInFunctionCallNode(const char *name,
+ TIntermSequence *arguments,
+ const TSymbolTable &symbolTable,
+ int shaderVersion)
+{
+ const TFunction *fn = LookUpBuiltInFunction(name, arguments, symbolTable, shaderVersion);
+ ASSERT(fn);
+ TOperator op = fn->getBuiltInOp();
+ if (op != EOpCallBuiltInFunction && arguments->size() == 1)
+ {
+ return new TIntermUnary(op, arguments->at(0)->getAsTyped(), fn);
+ }
+ return TIntermAggregate::CreateBuiltInFunctionCall(*fn, arguments);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.h b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.h
new file mode 100644
index 0000000000..3a82ec07a7
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.h
@@ -0,0 +1,76 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// IntermNode_util.h: High-level utilities for creating AST nodes and node hierarchies. Mostly meant
+// to be used in AST transforms.
+
+#ifndef COMPILER_TRANSLATOR_INTERMNODEUTIL_H_
+#define COMPILER_TRANSLATOR_INTERMNODEUTIL_H_
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/FindFunction.h"
+
+namespace sh
+{
+
+class TSymbolTable;
+class TVariable;
+
+TIntermFunctionPrototype *CreateInternalFunctionPrototypeNode(const TFunction &func);
+TIntermFunctionDefinition *CreateInternalFunctionDefinitionNode(const TFunction &func,
+ TIntermBlock *functionBody);
+
+TIntermTyped *CreateZeroNode(const TType &type);
+TIntermConstantUnion *CreateIndexNode(int index);
+TIntermConstantUnion *CreateBoolNode(bool value);
+
+TVariable *CreateTempVariable(TSymbolTable *symbolTable, const TType *type);
+TVariable *CreateTempVariable(TSymbolTable *symbolTable, const TType *type, TQualifier qualifier);
+
+TIntermSymbol *CreateTempSymbolNode(const TVariable *tempVariable);
+TIntermDeclaration *CreateTempDeclarationNode(const TVariable *tempVariable);
+TIntermDeclaration *CreateTempInitDeclarationNode(const TVariable *tempVariable,
+ TIntermTyped *initializer);
+TIntermBinary *CreateTempAssignmentNode(const TVariable *tempVariable, TIntermTyped *rightNode);
+
+TVariable *DeclareTempVariable(TSymbolTable *symbolTable,
+ const TType *type,
+ TQualifier qualifier,
+ TIntermDeclaration **declarationOut);
+TVariable *DeclareTempVariable(TSymbolTable *symbolTable,
+ TIntermTyped *initializer,
+ TQualifier qualifier,
+ TIntermDeclaration **declarationOut);
+const TVariable *DeclareInterfaceBlock(TIntermBlock *root,
+ TSymbolTable *symbolTable,
+ TFieldList *fieldList,
+ TQualifier qualifier,
+ const TMemoryQualifier &memoryQualifier,
+ const char *blockTypeName,
+ const char *blockVariableName);
+
+// If the input node is nullptr, return nullptr.
+// If the input node is a block node, return it.
+// If the input node is not a block node, put it inside a block node and return that.
+TIntermBlock *EnsureBlock(TIntermNode *node);
+
+// Should be called from inside Compiler::compileTreeImpl() where the global level is in scope.
+TIntermSymbol *ReferenceGlobalVariable(const ImmutableString &name,
+ const TSymbolTable &symbolTable);
+
+// Note: this can't access desktop GLSL built-ins. Those can only be accessed directly through
+// BuiltIn_autogen.h.
+TIntermSymbol *ReferenceBuiltInVariable(const ImmutableString &name,
+ const TSymbolTable &symbolTable,
+ int shaderVersion);
+
+TIntermTyped *CreateBuiltInFunctionCallNode(const char *name,
+ TIntermSequence *arguments,
+ const TSymbolTable &symbolTable,
+ int shaderVersion);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_INTERMNODEUTIL_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp
new file mode 100644
index 0000000000..c38baa12bf
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp
@@ -0,0 +1,638 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+
+namespace sh
+{
+
+// Traverse the intermediate representation tree, and call a node type specific visit function for
+// each node. Traversal is done recursively through the node member function traverse(). Nodes with
+// children can have their whole subtree skipped if preVisit is turned on and the type specific
+// function returns false.
+template <typename T>
+void TIntermTraverser::traverse(T *node)
+{
+ ScopedNodeInTraversalPath addToPath(this, node);
+ if (!addToPath.isWithinDepthLimit())
+ return;
+
+ bool visit = true;
+
+ // Visit the node before children if pre-visiting.
+ if (preVisit)
+ visit = node->visit(PreVisit, this);
+
+ if (visit)
+ {
+ size_t childIndex = 0;
+ size_t childCount = node->getChildCount();
+
+ while (childIndex < childCount && visit)
+ {
+ node->getChildNode(childIndex)->traverse(this);
+ if (inVisit && childIndex != childCount - 1)
+ {
+ visit = node->visit(InVisit, this);
+ }
+ ++childIndex;
+ }
+
+ if (visit && postVisit)
+ node->visit(PostVisit, this);
+ }
+}
+
+void TIntermNode::traverse(TIntermTraverser *it)
+{
+ it->traverse(this);
+}
+
+void TIntermSymbol::traverse(TIntermTraverser *it)
+{
+ TIntermTraverser::ScopedNodeInTraversalPath addToPath(it, this);
+ it->visitSymbol(this);
+}
+
+void TIntermConstantUnion::traverse(TIntermTraverser *it)
+{
+ TIntermTraverser::ScopedNodeInTraversalPath addToPath(it, this);
+ it->visitConstantUnion(this);
+}
+
+void TIntermFunctionPrototype::traverse(TIntermTraverser *it)
+{
+ TIntermTraverser::ScopedNodeInTraversalPath addToPath(it, this);
+ it->visitFunctionPrototype(this);
+}
+
+void TIntermBinary::traverse(TIntermTraverser *it)
+{
+ it->traverseBinary(this);
+}
+
+void TIntermUnary::traverse(TIntermTraverser *it)
+{
+ it->traverseUnary(this);
+}
+
+void TIntermFunctionDefinition::traverse(TIntermTraverser *it)
+{
+ it->traverseFunctionDefinition(this);
+}
+
+void TIntermBlock::traverse(TIntermTraverser *it)
+{
+ it->traverseBlock(this);
+}
+
+void TIntermAggregate::traverse(TIntermTraverser *it)
+{
+ it->traverseAggregate(this);
+}
+
+void TIntermLoop::traverse(TIntermTraverser *it)
+{
+ it->traverseLoop(this);
+}
+
+void TIntermPreprocessorDirective::traverse(TIntermTraverser *it)
+{
+ it->visitPreprocessorDirective(this);
+}
+
+bool TIntermSymbol::visit(Visit visit, TIntermTraverser *it)
+{
+ it->visitSymbol(this);
+ return false;
+}
+
+bool TIntermConstantUnion::visit(Visit visit, TIntermTraverser *it)
+{
+ it->visitConstantUnion(this);
+ return false;
+}
+
+bool TIntermFunctionPrototype::visit(Visit visit, TIntermTraverser *it)
+{
+ it->visitFunctionPrototype(this);
+ return false;
+}
+
+bool TIntermFunctionDefinition::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitFunctionDefinition(visit, this);
+}
+
+bool TIntermUnary::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitUnary(visit, this);
+}
+
+bool TIntermSwizzle::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitSwizzle(visit, this);
+}
+
+bool TIntermBinary::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitBinary(visit, this);
+}
+
+bool TIntermTernary::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitTernary(visit, this);
+}
+
+bool TIntermAggregate::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitAggregate(visit, this);
+}
+
+bool TIntermDeclaration::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitDeclaration(visit, this);
+}
+
+bool TIntermInvariantDeclaration::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitInvariantDeclaration(visit, this);
+}
+
+bool TIntermBlock::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitBlock(visit, this);
+}
+
+bool TIntermIfElse::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitIfElse(visit, this);
+}
+
+bool TIntermLoop::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitLoop(visit, this);
+}
+
+bool TIntermBranch::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitBranch(visit, this);
+}
+
+bool TIntermSwitch::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitSwitch(visit, this);
+}
+
+bool TIntermCase::visit(Visit visit, TIntermTraverser *it)
+{
+ return it->visitCase(visit, this);
+}
+
+bool TIntermPreprocessorDirective::visit(Visit visit, TIntermTraverser *it)
+{
+ it->visitPreprocessorDirective(this);
+ return false;
+}
+
+TIntermTraverser::TIntermTraverser(bool preVisit,
+ bool inVisit,
+ bool postVisit,
+ TSymbolTable *symbolTable)
+ : preVisit(preVisit),
+ inVisit(inVisit),
+ postVisit(postVisit),
+ mMaxDepth(0),
+ mMaxAllowedDepth(std::numeric_limits<int>::max()),
+ mInGlobalScope(true),
+ mSymbolTable(symbolTable)
+{
+ // Only enabling inVisit is not supported.
+ ASSERT(!(inVisit && !preVisit && !postVisit));
+}
+
+TIntermTraverser::~TIntermTraverser() {}
+
+void TIntermTraverser::setMaxAllowedDepth(int depth)
+{
+ mMaxAllowedDepth = depth;
+}
+
+const TIntermBlock *TIntermTraverser::getParentBlock() const
+{
+ if (!mParentBlockStack.empty())
+ {
+ return mParentBlockStack.back().node;
+ }
+ return nullptr;
+}
+
+void TIntermTraverser::pushParentBlock(TIntermBlock *node)
+{
+ mParentBlockStack.push_back(ParentBlock(node, 0));
+}
+
+void TIntermTraverser::incrementParentBlockPos()
+{
+ ++mParentBlockStack.back().pos;
+}
+
+void TIntermTraverser::popParentBlock()
+{
+ ASSERT(!mParentBlockStack.empty());
+ mParentBlockStack.pop_back();
+}
+
+void TIntermTraverser::insertStatementsInParentBlock(const TIntermSequence &insertions)
+{
+ TIntermSequence emptyInsertionsAfter;
+ insertStatementsInParentBlock(insertions, emptyInsertionsAfter);
+}
+
+void TIntermTraverser::insertStatementsInParentBlock(const TIntermSequence &insertionsBefore,
+ const TIntermSequence &insertionsAfter)
+{
+ ASSERT(!mParentBlockStack.empty());
+ ParentBlock &parentBlock = mParentBlockStack.back();
+ if (mPath.back() == parentBlock.node)
+ {
+ ASSERT(mParentBlockStack.size() >= 2u);
+ // The current node is a block node, so the parent block is not the topmost one in the block
+ // stack, but the one below that.
+ parentBlock = mParentBlockStack.at(mParentBlockStack.size() - 2u);
+ }
+ NodeInsertMultipleEntry insert(parentBlock.node, parentBlock.pos, insertionsBefore,
+ insertionsAfter);
+ mInsertions.push_back(insert);
+}
+
+void TIntermTraverser::insertStatementInParentBlock(TIntermNode *statement)
+{
+ TIntermSequence insertions;
+ insertions.push_back(statement);
+ insertStatementsInParentBlock(insertions);
+}
+
+void TIntermTraverser::insertStatementsInBlockAtPosition(TIntermBlock *parent,
+ size_t position,
+ const TIntermSequence &insertionsBefore,
+ const TIntermSequence &insertionsAfter)
+{
+ ASSERT(parent);
+ ASSERT(position >= 0);
+ ASSERT(position < parent->getChildCount());
+
+ mInsertions.emplace_back(parent, position, insertionsBefore, insertionsAfter);
+}
+
+void TLValueTrackingTraverser::setInFunctionCallOutParameter(bool inOutParameter)
+{
+ mInFunctionCallOutParameter = inOutParameter;
+}
+
+bool TLValueTrackingTraverser::isInFunctionCallOutParameter() const
+{
+ return mInFunctionCallOutParameter;
+}
+
+void TIntermTraverser::traverseBinary(TIntermBinary *node)
+{
+ traverse(node);
+}
+
+void TLValueTrackingTraverser::traverseBinary(TIntermBinary *node)
+{
+ ScopedNodeInTraversalPath addToPath(this, node);
+ if (!addToPath.isWithinDepthLimit())
+ return;
+
+ bool visit = true;
+
+ // visit the node before children if pre-visiting.
+ if (preVisit)
+ visit = node->visit(PreVisit, this);
+
+ // Visit the children, in the right order.
+ if (visit)
+ {
+ if (node->isAssignment())
+ {
+ ASSERT(!isLValueRequiredHere());
+ setOperatorRequiresLValue(true);
+ }
+
+ node->getLeft()->traverse(this);
+
+ if (node->isAssignment())
+ setOperatorRequiresLValue(false);
+
+ if (inVisit)
+ visit = node->visit(InVisit, this);
+
+ if (visit)
+ {
+ // Some binary operations like indexing can be inside an expression which must be an
+ // l-value.
+ bool parentOperatorRequiresLValue = operatorRequiresLValue();
+ bool parentInFunctionCallOutParameter = isInFunctionCallOutParameter();
+
+ // Index is not required to be an l-value even when the surrounding expression is
+ // required to be an l-value.
+ TOperator op = node->getOp();
+ if (op == EOpIndexDirect || op == EOpIndexDirectInterfaceBlock ||
+ op == EOpIndexDirectStruct || op == EOpIndexIndirect)
+ {
+ setOperatorRequiresLValue(false);
+ setInFunctionCallOutParameter(false);
+ }
+
+ node->getRight()->traverse(this);
+
+ setOperatorRequiresLValue(parentOperatorRequiresLValue);
+ setInFunctionCallOutParameter(parentInFunctionCallOutParameter);
+
+ // Visit the node after the children, if requested and the traversal
+ // hasn't been cancelled yet.
+ if (postVisit)
+ visit = node->visit(PostVisit, this);
+ }
+ }
+}
+
+void TIntermTraverser::traverseUnary(TIntermUnary *node)
+{
+ traverse(node);
+}
+
+void TLValueTrackingTraverser::traverseUnary(TIntermUnary *node)
+{
+ ScopedNodeInTraversalPath addToPath(this, node);
+ if (!addToPath.isWithinDepthLimit())
+ return;
+
+ bool visit = true;
+
+ if (preVisit)
+ visit = node->visit(PreVisit, this);
+
+ if (visit)
+ {
+ ASSERT(!operatorRequiresLValue());
+ switch (node->getOp())
+ {
+ case EOpPostIncrement:
+ case EOpPostDecrement:
+ case EOpPreIncrement:
+ case EOpPreDecrement:
+ setOperatorRequiresLValue(true);
+ break;
+ default:
+ break;
+ }
+
+ node->getOperand()->traverse(this);
+
+ setOperatorRequiresLValue(false);
+
+ if (postVisit)
+ visit = node->visit(PostVisit, this);
+ }
+}
+
+// Traverse a function definition node. This keeps track of global scope.
+void TIntermTraverser::traverseFunctionDefinition(TIntermFunctionDefinition *node)
+{
+ ScopedNodeInTraversalPath addToPath(this, node);
+ if (!addToPath.isWithinDepthLimit())
+ return;
+
+ bool visit = true;
+
+ if (preVisit)
+ visit = node->visit(PreVisit, this);
+
+ if (visit)
+ {
+ node->getFunctionPrototype()->traverse(this);
+ if (inVisit)
+ visit = node->visit(InVisit, this);
+ if (visit)
+ {
+ mInGlobalScope = false;
+ node->getBody()->traverse(this);
+ mInGlobalScope = true;
+ if (postVisit)
+ visit = node->visit(PostVisit, this);
+ }
+ }
+}
+
+// Traverse a block node. This keeps track of the position of traversed child nodes within the block
+// so that nodes may be inserted before or after them.
+void TIntermTraverser::traverseBlock(TIntermBlock *node)
+{
+ ScopedNodeInTraversalPath addToPath(this, node);
+ if (!addToPath.isWithinDepthLimit())
+ return;
+
+ pushParentBlock(node);
+
+ bool visit = true;
+
+ TIntermSequence *sequence = node->getSequence();
+
+ if (preVisit)
+ visit = node->visit(PreVisit, this);
+
+ if (visit)
+ {
+ for (auto *child : *sequence)
+ {
+ if (visit)
+ {
+ child->traverse(this);
+ if (inVisit)
+ {
+ if (child != sequence->back())
+ visit = node->visit(InVisit, this);
+ }
+
+ incrementParentBlockPos();
+ }
+ }
+
+ if (visit && postVisit)
+ visit = node->visit(PostVisit, this);
+ }
+
+ popParentBlock();
+}
+
+void TIntermTraverser::traverseAggregate(TIntermAggregate *node)
+{
+ traverse(node);
+}
+
+bool TIntermTraverser::CompareInsertion(const NodeInsertMultipleEntry &a,
+ const NodeInsertMultipleEntry &b)
+{
+ if (a.parent != b.parent)
+ {
+ return a.parent > b.parent;
+ }
+ return a.position > b.position;
+}
+
+void TIntermTraverser::updateTree()
+{
+ // Sort the insertions so that insertion position is decreasing. This way multiple insertions to
+ // the same parent node are handled correctly.
+ std::sort(mInsertions.begin(), mInsertions.end(), CompareInsertion);
+ for (size_t ii = 0; ii < mInsertions.size(); ++ii)
+ {
+ // We can't know here what the intended ordering of two insertions to the same position is,
+ // so it is not supported.
+ ASSERT(ii == 0 || mInsertions[ii].position != mInsertions[ii - 1].position ||
+ mInsertions[ii].parent != mInsertions[ii - 1].parent);
+ const NodeInsertMultipleEntry &insertion = mInsertions[ii];
+ ASSERT(insertion.parent);
+ if (!insertion.insertionsAfter.empty())
+ {
+ bool inserted = insertion.parent->insertChildNodes(insertion.position + 1,
+ insertion.insertionsAfter);
+ ASSERT(inserted);
+ }
+ if (!insertion.insertionsBefore.empty())
+ {
+ bool inserted =
+ insertion.parent->insertChildNodes(insertion.position, insertion.insertionsBefore);
+ ASSERT(inserted);
+ }
+ }
+ for (size_t ii = 0; ii < mReplacements.size(); ++ii)
+ {
+ const NodeUpdateEntry &replacement = mReplacements[ii];
+ ASSERT(replacement.parent);
+ bool replaced =
+ replacement.parent->replaceChildNode(replacement.original, replacement.replacement);
+ ASSERT(replaced);
+
+ if (!replacement.originalBecomesChildOfReplacement)
+ {
+ // In AST traversing, a parent is visited before its children.
+ // After we replace a node, if its immediate child is to
+ // be replaced, we need to make sure we don't update the replaced
+ // node; instead, we update the replacement node.
+ for (size_t jj = ii + 1; jj < mReplacements.size(); ++jj)
+ {
+ NodeUpdateEntry &replacement2 = mReplacements[jj];
+ if (replacement2.parent == replacement.original)
+ replacement2.parent = replacement.replacement;
+ }
+ }
+ }
+ for (size_t ii = 0; ii < mMultiReplacements.size(); ++ii)
+ {
+ const NodeReplaceWithMultipleEntry &replacement = mMultiReplacements[ii];
+ ASSERT(replacement.parent);
+ bool replaced = replacement.parent->replaceChildNodeWithMultiple(replacement.original,
+ replacement.replacements);
+ ASSERT(replaced);
+ }
+
+ clearReplacementQueue();
+}
+
+void TIntermTraverser::clearReplacementQueue()
+{
+ mReplacements.clear();
+ mMultiReplacements.clear();
+ mInsertions.clear();
+}
+
+void TIntermTraverser::queueReplacement(TIntermNode *replacement, OriginalNode originalStatus)
+{
+ queueReplacementWithParent(getParentNode(), mPath.back(), replacement, originalStatus);
+}
+
+void TIntermTraverser::queueReplacementWithParent(TIntermNode *parent,
+ TIntermNode *original,
+ TIntermNode *replacement,
+ OriginalNode originalStatus)
+{
+ bool originalBecomesChild = (originalStatus == OriginalNode::BECOMES_CHILD);
+ mReplacements.push_back(NodeUpdateEntry(parent, original, replacement, originalBecomesChild));
+}
+
+TLValueTrackingTraverser::TLValueTrackingTraverser(bool preVisit,
+ bool inVisit,
+ bool postVisit,
+ TSymbolTable *symbolTable)
+ : TIntermTraverser(preVisit, inVisit, postVisit, symbolTable),
+ mOperatorRequiresLValue(false),
+ mInFunctionCallOutParameter(false)
+{
+ ASSERT(symbolTable);
+}
+
+void TLValueTrackingTraverser::traverseAggregate(TIntermAggregate *node)
+{
+ ScopedNodeInTraversalPath addToPath(this, node);
+ if (!addToPath.isWithinDepthLimit())
+ return;
+
+ bool visit = true;
+
+ TIntermSequence *sequence = node->getSequence();
+
+ if (preVisit)
+ visit = node->visit(PreVisit, this);
+
+ if (visit)
+ {
+ size_t paramIndex = 0u;
+ for (auto *child : *sequence)
+ {
+ if (visit)
+ {
+ if (node->getFunction())
+ {
+ // Both built-ins and user defined functions should have the function symbol
+ // set.
+ ASSERT(paramIndex < node->getFunction()->getParamCount());
+ TQualifier qualifier =
+ node->getFunction()->getParam(paramIndex)->getType().getQualifier();
+ setInFunctionCallOutParameter(qualifier == EvqOut || qualifier == EvqInOut);
+ ++paramIndex;
+ }
+ else
+ {
+ ASSERT(node->isConstructor());
+ }
+ child->traverse(this);
+ if (inVisit)
+ {
+ if (child != sequence->back())
+ visit = node->visit(InVisit, this);
+ }
+ }
+ }
+ setInFunctionCallOutParameter(false);
+
+ if (visit && postVisit)
+ visit = node->visit(PostVisit, this);
+ }
+}
+
+void TIntermTraverser::traverseLoop(TIntermLoop *node)
+{
+ traverse(node);
+}
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.h b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.h
new file mode 100644
index 0000000000..30687a4869
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.h
@@ -0,0 +1,322 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// IntermTraverse.h : base classes for AST traversers that walk the AST and
+// also have the ability to transform it by replacing nodes.
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/Visit.h"
+
+namespace sh
+{
+
+class TSymbolTable;
+class TSymbolUniqueId;
+
+// For traversing the tree. User should derive from this class overriding the visit functions,
+// and then pass an object of the subclass to a traverse method of a node.
+//
+// The traverse*() functions may also be overridden to do other bookkeeping on the tree to provide
+// contextual information to the visit functions, such as whether the node is the target of an
+// assignment. This is complex to maintain and so should only be done in special cases.
+//
+// When using this, just fill in the methods for nodes you want visited.
+// Return false from a pre-visit to skip visiting that node's subtree.
+//
+// See also how to write AST transformations documentation:
+// https://github.com/google/angle/blob/master/doc/WritingShaderASTTransformations.md
+class TIntermTraverser : angle::NonCopyable
+{
+ public:
+ POOL_ALLOCATOR_NEW_DELETE
+ TIntermTraverser(bool preVisit,
+ bool inVisit,
+ bool postVisit,
+ TSymbolTable *symbolTable = nullptr);
+ virtual ~TIntermTraverser();
+
+ virtual void visitSymbol(TIntermSymbol *node) {}
+ virtual void visitConstantUnion(TIntermConstantUnion *node) {}
+ virtual bool visitSwizzle(Visit visit, TIntermSwizzle *node) { return true; }
+ virtual bool visitBinary(Visit visit, TIntermBinary *node) { return true; }
+ virtual bool visitUnary(Visit visit, TIntermUnary *node) { return true; }
+ virtual bool visitTernary(Visit visit, TIntermTernary *node) { return true; }
+ virtual bool visitIfElse(Visit visit, TIntermIfElse *node) { return true; }
+ virtual bool visitSwitch(Visit visit, TIntermSwitch *node) { return true; }
+ virtual bool visitCase(Visit visit, TIntermCase *node) { return true; }
+ virtual void visitFunctionPrototype(TIntermFunctionPrototype *node) {}
+ virtual bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node)
+ {
+ return true;
+ }
+ virtual bool visitAggregate(Visit visit, TIntermAggregate *node) { return true; }
+ virtual bool visitBlock(Visit visit, TIntermBlock *node) { return true; }
+ virtual bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
+ {
+ return true;
+ }
+ virtual bool visitDeclaration(Visit visit, TIntermDeclaration *node) { return true; }
+ virtual bool visitLoop(Visit visit, TIntermLoop *node) { return true; }
+ virtual bool visitBranch(Visit visit, TIntermBranch *node) { return true; }
+ virtual void visitPreprocessorDirective(TIntermPreprocessorDirective *node) {}
+
+ // The traverse functions contain logic for iterating over the children of the node
+ // and calling the visit functions in the appropriate places. They also track some
+ // context that may be used by the visit functions.
+
+ // The generic traverse() function is used for nodes that don't need special handling.
+ // It's templated in order to avoid virtual function calls, this gains around 2% compiler
+ // performance.
+ template <typename T>
+ void traverse(T *node);
+
+ // Specialized traverse functions are implemented for node types where traversal logic may need
+ // to be overridden or where some special bookkeeping needs to be done.
+ virtual void traverseBinary(TIntermBinary *node);
+ virtual void traverseUnary(TIntermUnary *node);
+ virtual void traverseFunctionDefinition(TIntermFunctionDefinition *node);
+ virtual void traverseAggregate(TIntermAggregate *node);
+ virtual void traverseBlock(TIntermBlock *node);
+ virtual void traverseLoop(TIntermLoop *node);
+
+ int getMaxDepth() const { return mMaxDepth; }
+
+ // If traversers need to replace nodes, they can add the replacements in
+ // mReplacements/mMultiReplacements during traversal and the user of the traverser should call
+ // this function after traversal to perform them.
+ void updateTree();
+
+ protected:
+ void setMaxAllowedDepth(int depth);
+
+ // Should only be called from traverse*() functions
+ bool incrementDepth(TIntermNode *current)
+ {
+ mMaxDepth = std::max(mMaxDepth, static_cast<int>(mPath.size()));
+ mPath.push_back(current);
+ return mMaxDepth < mMaxAllowedDepth;
+ }
+
+ // Should only be called from traverse*() functions
+ void decrementDepth() { mPath.pop_back(); }
+
+ int getCurrentTraversalDepth() const { return static_cast<int>(mPath.size()) - 1; }
+
+ // RAII helper for incrementDepth/decrementDepth
+ class ScopedNodeInTraversalPath
+ {
+ public:
+ ScopedNodeInTraversalPath(TIntermTraverser *traverser, TIntermNode *current)
+ : mTraverser(traverser)
+ {
+ mWithinDepthLimit = mTraverser->incrementDepth(current);
+ }
+ ~ScopedNodeInTraversalPath() { mTraverser->decrementDepth(); }
+
+ bool isWithinDepthLimit() { return mWithinDepthLimit; }
+
+ private:
+ TIntermTraverser *mTraverser;
+ bool mWithinDepthLimit;
+ };
+ // Optimized traversal functions for leaf nodes directly access ScopedNodeInTraversalPath.
+ friend void TIntermSymbol::traverse(TIntermTraverser *);
+ friend void TIntermConstantUnion::traverse(TIntermTraverser *);
+ friend void TIntermFunctionPrototype::traverse(TIntermTraverser *);
+
+ TIntermNode *getParentNode() { return mPath.size() <= 1 ? nullptr : mPath[mPath.size() - 2u]; }
+
+ // Return the nth ancestor of the node being traversed. getAncestorNode(0) == getParentNode()
+ TIntermNode *getAncestorNode(unsigned int n)
+ {
+ if (mPath.size() > n + 1u)
+ {
+ return mPath[mPath.size() - n - 2u];
+ }
+ return nullptr;
+ }
+
+ const TIntermBlock *getParentBlock() const;
+
+ void pushParentBlock(TIntermBlock *node);
+ void incrementParentBlockPos();
+ void popParentBlock();
+
+ // To replace a single node with multiple nodes in the parent aggregate. May be used with blocks
+ // but also with other nodes like declarations.
+ struct NodeReplaceWithMultipleEntry
+ {
+ NodeReplaceWithMultipleEntry(TIntermAggregateBase *parentIn,
+ TIntermNode *originalIn,
+ TIntermSequence replacementsIn)
+ : parent(parentIn), original(originalIn), replacements(std::move(replacementsIn))
+ {}
+
+ TIntermAggregateBase *parent;
+ TIntermNode *original;
+ TIntermSequence replacements;
+ };
+
+ // Helper to insert statements in the parent block of the node currently being traversed.
+ // The statements will be inserted before the node being traversed once updateTree is called.
+ // Should only be called during PreVisit or PostVisit if called from block nodes.
+ // Note that two insertions to the same position in the same block are not supported.
+ void insertStatementsInParentBlock(const TIntermSequence &insertions);
+
+ // Same as above, but supports simultaneous insertion of statements before and after the node
+ // currently being traversed.
+ void insertStatementsInParentBlock(const TIntermSequence &insertionsBefore,
+ const TIntermSequence &insertionsAfter);
+
+ // Helper to insert a single statement.
+ void insertStatementInParentBlock(TIntermNode *statement);
+
+ // Explicitly specify where to insert statements. The statements are inserted before and after
+ // the specified position. The statements will be inserted once updateTree is called. Note that
+ // two insertions to the same position in the same block are not supported.
+ void insertStatementsInBlockAtPosition(TIntermBlock *parent,
+ size_t position,
+ const TIntermSequence &insertionsBefore,
+ const TIntermSequence &insertionsAfter);
+
+ enum class OriginalNode
+ {
+ BECOMES_CHILD,
+ IS_DROPPED
+ };
+
+ void clearReplacementQueue();
+
+ // Replace the node currently being visited with replacement.
+ void queueReplacement(TIntermNode *replacement, OriginalNode originalStatus);
+ // Explicitly specify a node to replace with replacement.
+ void queueReplacementWithParent(TIntermNode *parent,
+ TIntermNode *original,
+ TIntermNode *replacement,
+ OriginalNode originalStatus);
+
+ const bool preVisit;
+ const bool inVisit;
+ const bool postVisit;
+
+ int mMaxDepth;
+ int mMaxAllowedDepth;
+
+ bool mInGlobalScope;
+
+ // During traversing, save all the changes that need to happen into
+ // mReplacements/mMultiReplacements, then do them by calling updateTree().
+ // Multi replacements are processed after single replacements.
+ std::vector<NodeReplaceWithMultipleEntry> mMultiReplacements;
+
+ TSymbolTable *mSymbolTable;
+
+ private:
+ // To insert multiple nodes into the parent block.
+ struct NodeInsertMultipleEntry
+ {
+ NodeInsertMultipleEntry(TIntermBlock *_parent,
+ TIntermSequence::size_type _position,
+ TIntermSequence _insertionsBefore,
+ TIntermSequence _insertionsAfter)
+ : parent(_parent),
+ position(_position),
+ insertionsBefore(_insertionsBefore),
+ insertionsAfter(_insertionsAfter)
+ {}
+
+ TIntermBlock *parent;
+ TIntermSequence::size_type position;
+ TIntermSequence insertionsBefore;
+ TIntermSequence insertionsAfter;
+ };
+
+ static bool CompareInsertion(const NodeInsertMultipleEntry &a,
+ const NodeInsertMultipleEntry &b);
+
+ // To replace a single node with another on the parent node
+ struct NodeUpdateEntry
+ {
+ NodeUpdateEntry(TIntermNode *_parent,
+ TIntermNode *_original,
+ TIntermNode *_replacement,
+ bool _originalBecomesChildOfReplacement)
+ : parent(_parent),
+ original(_original),
+ replacement(_replacement),
+ originalBecomesChildOfReplacement(_originalBecomesChildOfReplacement)
+ {}
+
+ TIntermNode *parent;
+ TIntermNode *original;
+ TIntermNode *replacement;
+ bool originalBecomesChildOfReplacement;
+ };
+
+ struct ParentBlock
+ {
+ ParentBlock(TIntermBlock *nodeIn, TIntermSequence::size_type posIn)
+ : node(nodeIn), pos(posIn)
+ {}
+
+ TIntermBlock *node;
+ TIntermSequence::size_type pos;
+ };
+
+ std::vector<NodeInsertMultipleEntry> mInsertions;
+ std::vector<NodeUpdateEntry> mReplacements;
+
+ // All the nodes from root to the current node during traversing.
+ TVector<TIntermNode *> mPath;
+
+ // All the code blocks from the root to the current node's parent during traversal.
+ std::vector<ParentBlock> mParentBlockStack;
+};
+
+// Traverser parent class that tracks where a node is a destination of a write operation and so is
+// required to be an l-value.
+class TLValueTrackingTraverser : public TIntermTraverser
+{
+ public:
+ TLValueTrackingTraverser(bool preVisit,
+ bool inVisit,
+ bool postVisit,
+ TSymbolTable *symbolTable);
+ virtual ~TLValueTrackingTraverser() {}
+
+ void traverseBinary(TIntermBinary *node) final;
+ void traverseUnary(TIntermUnary *node) final;
+ void traverseAggregate(TIntermAggregate *node) final;
+
+ protected:
+ bool isLValueRequiredHere() const
+ {
+ return mOperatorRequiresLValue || mInFunctionCallOutParameter;
+ }
+
+ private:
+ // Track whether an l-value is required in the node that is currently being traversed by the
+ // surrounding operator.
+ // Use isLValueRequiredHere to check all conditions which require an l-value.
+ void setOperatorRequiresLValue(bool lValueRequired)
+ {
+ mOperatorRequiresLValue = lValueRequired;
+ }
+ bool operatorRequiresLValue() const { return mOperatorRequiresLValue; }
+
+ // Track whether an l-value is required inside a function call.
+ void setInFunctionCallOutParameter(bool inOutParameter);
+ bool isInFunctionCallOutParameter() const;
+
+ bool mOperatorRequiresLValue;
+ bool mInFunctionCallOutParameter;
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/NodeSearch.h b/gfx/angle/checkout/src/compiler/translator/tree_util/NodeSearch.h
new file mode 100644
index 0000000000..c083531578
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/NodeSearch.h
@@ -0,0 +1,56 @@
+//
+// 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.
+//
+// NodeSearch.h: Utilities for searching translator node graphs
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_NODESEARCH_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_NODESEARCH_H_
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+template <class Parent>
+class NodeSearchTraverser : public TIntermTraverser
+{
+ public:
+ NodeSearchTraverser() : TIntermTraverser(true, false, false), mFound(false) {}
+
+ bool found() const { return mFound; }
+
+ static bool search(TIntermNode *node)
+ {
+ Parent searchTraverser;
+ node->traverse(&searchTraverser);
+ return searchTraverser.found();
+ }
+
+ protected:
+ bool mFound;
+};
+
+class FindDiscard : public NodeSearchTraverser<FindDiscard>
+{
+ public:
+ virtual bool visitBranch(Visit visit, TIntermBranch *node)
+ {
+ switch (node->getFlowOp())
+ {
+ case EOpKill:
+ mFound = true;
+ break;
+
+ default:
+ break;
+ }
+
+ return !mFound;
+ }
+};
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_NODESEARCH_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.cpp
new file mode 100644
index 0000000000..14f6f7db98
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.cpp
@@ -0,0 +1,136 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ReplaceShadowingVariables.cpp: Replace all references to any variable in the AST that is
+// a redefinition of a variable in a nested scope. This is a useful for ESSL 1.00 shaders
+// where the spec section "4.2.3. Redeclaring Variables" states "However, a nested scope can
+// override an outer scope's declaration of a particular variable name." This is changed in
+// later spec versions, such as ESSL 3.20 spec which states "If [a variable] is declared as
+// a parameter in a function definition, it is scoped until the end of that function
+// definition. A function's parameter declarations and body together form a single scope."
+//
+// So this class is useful when translating from ESSL 1.00 shaders, where function body var
+// redefinition is allowed, to later shader versions where it's not allowed.
+//
+
+#include "compiler/translator/tree_util/ReplaceShadowingVariables.h"
+#include "compiler/translator/tree_util/ReplaceVariable.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/Symbol.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+#include <unordered_set>
+
+namespace sh
+{
+
+namespace
+{
+
+// Custom struct to queue up any replacements until after AST traversal
+struct DeferredReplacementBlock
+{
+ const TVariable *originalVariable; // variable to be replaced
+ TVariable *replacementVariable; // variable to replace originalVar with
+ TIntermBlock *functionBody; // function body where replacement occurs
+};
+
+class ReplaceShadowingVariablesTraverser : public TIntermTraverser
+{
+ public:
+ ReplaceShadowingVariablesTraverser(TSymbolTable *symbolTable)
+ : TIntermTraverser(true, true, true),
+ mSymbolTable(symbolTable),
+ mParameterNames{},
+ mFunctionBody(nullptr)
+ {}
+
+ bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override
+ {
+ // In pre-visit of function, record params
+ if (visit == PreVisit)
+ {
+ ASSERT(mParameterNames.size() == 0);
+ const TFunction *func = node->getFunctionPrototype()->getFunction();
+ // Grab all of the parameter names from the function prototype
+ uint32_t paramCount = func->getParamCount();
+ for (uint32_t i = 0; i < paramCount; ++i)
+ {
+ mParameterNames.emplace(std::string(func->getParam(i)->name().data()));
+ }
+ if (mParameterNames.size() > 0)
+ mFunctionBody = node->getBody();
+ }
+ else if (visit == PostVisit)
+ {
+ // Clear data saved from function definition
+ mParameterNames.clear();
+ mFunctionBody = nullptr;
+ }
+ return true;
+ }
+ bool visitDeclaration(Visit visit, TIntermDeclaration *node) override
+ {
+ if (visit == PreVisit && mParameterNames.size() != 0)
+ {
+ TIntermSequence *decls = node->getSequence();
+ for (auto &declVector : *decls)
+ {
+ // no init case
+ TIntermSymbol *symNode = declVector->getAsSymbolNode();
+ if (symNode == nullptr)
+ {
+ // init case
+ TIntermBinary *binaryNode = declVector->getAsBinaryNode();
+ ASSERT(binaryNode->getOp() == EOpInitialize);
+ symNode = binaryNode->getLeft()->getAsSymbolNode();
+ }
+ ASSERT(symNode != nullptr);
+ std::string varName = std::string(symNode->variable().name().data());
+ if (mParameterNames.count(varName) > 0)
+ {
+ // We found a redefined var so queue replacement
+ mReplacements.emplace_back(DeferredReplacementBlock{
+ &symNode->variable(),
+ CreateTempVariable(mSymbolTable, &symNode->variable().getType()),
+ mFunctionBody});
+ }
+ }
+ }
+ return true;
+ }
+ // Perform replacement of vars for any deferred replacements that were identified
+ void executeReplacements()
+ {
+ for (DeferredReplacementBlock &replace : mReplacements)
+ {
+ ReplaceVariable(replace.functionBody, replace.originalVariable,
+ replace.replacementVariable);
+ }
+ mReplacements.clear();
+ }
+
+ private:
+ TSymbolTable *mSymbolTable;
+ std::unordered_set<std::string> mParameterNames;
+ TIntermBlock *mFunctionBody;
+ std::vector<DeferredReplacementBlock> mReplacements;
+};
+
+} // anonymous namespace
+
+// Replaces every occurrence of a variable with another variable.
+void ReplaceShadowingVariables(TIntermBlock *root, TSymbolTable *symbolTable)
+{
+ ReplaceShadowingVariablesTraverser traverser(symbolTable);
+ root->traverse(&traverser);
+ traverser.executeReplacements();
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.h b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.h
new file mode 100644
index 0000000000..79e2694d53
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.h
@@ -0,0 +1,21 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ReplaceShadowingVariables.h: Find any variables that are redefined within a nested
+// scope and replace them with a newly named variable.
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_REPLACESHADOWINGVARIABLES_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_REPLACESHADOWINGVARIABLES_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TSymbolTable;
+
+void ReplaceShadowingVariables(TIntermBlock *root, TSymbolTable *symbolTable);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_REPLACESHADOWINGVARIABLES_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp
new file mode 100644
index 0000000000..7120cea20b
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp
@@ -0,0 +1,64 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ReplaceVariable.cpp: Replace all references to a specific variable in the AST with references to
+// another variable.
+
+#include "compiler/translator/tree_util/ReplaceVariable.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+class ReplaceVariableTraverser : public TIntermTraverser
+{
+ public:
+ ReplaceVariableTraverser(const TVariable *toBeReplaced, const TIntermTyped *replacement)
+ : TIntermTraverser(true, false, false),
+ mToBeReplaced(toBeReplaced),
+ mReplacement(replacement)
+ {}
+
+ void visitSymbol(TIntermSymbol *node) override
+ {
+ if (&node->variable() == mToBeReplaced)
+ {
+ queueReplacement(mReplacement->deepCopy(), OriginalNode::IS_DROPPED);
+ }
+ }
+
+ private:
+ const TVariable *const mToBeReplaced;
+ const TIntermTyped *const mReplacement;
+};
+
+} // anonymous namespace
+
+// Replaces every occurrence of a variable with another variable.
+void ReplaceVariable(TIntermBlock *root,
+ const TVariable *toBeReplaced,
+ const TVariable *replacement)
+{
+ ReplaceVariableTraverser traverser(toBeReplaced, new TIntermSymbol(replacement));
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+// Replaces every occurrence of a variable with a TIntermNode.
+void ReplaceVariableWithTyped(TIntermBlock *root,
+ const TVariable *toBeReplaced,
+ const TIntermTyped *replacement)
+{
+ ReplaceVariableTraverser traverser(toBeReplaced, replacement);
+ root->traverse(&traverser);
+ traverser.updateTree();
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.h b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.h
new file mode 100644
index 0000000000..3a9e34ee34
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.h
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ReplaceVariable.h: Replace all references to a specific variable in the AST with references to
+// another variable.
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_REPLACEVARIABLE_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_REPLACEVARIABLE_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TVariable;
+class TIntermTyped;
+
+void ReplaceVariable(TIntermBlock *root,
+ const TVariable *toBeReplaced,
+ const TVariable *replacement);
+void ReplaceVariableWithTyped(TIntermBlock *root,
+ const TVariable *toBeReplaced,
+ const TIntermTyped *replacement);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_REPLACEVARIABLE_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp
new file mode 100644
index 0000000000..bd00b8a0d9
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp
@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RunAtTheEndOfShader.cpp: Add code to be run at the end of the shader. In case main() contains a
+// return statement, this is done by replacing the main() function with another function that calls
+// the old main, like this:
+//
+// void main() { body }
+// =>
+// void main0() { body }
+// void main()
+// {
+// main0();
+// codeToRun
+// }
+//
+// This way the code will get run even if the return statement inside main is executed.
+//
+
+#include "compiler/translator/tree_util/RunAtTheEndOfShader.h"
+
+#include "compiler/translator/IntermNode.h"
+#include "compiler/translator/StaticType.h"
+#include "compiler/translator/SymbolTable.h"
+#include "compiler/translator/tree_util/FindMain.h"
+#include "compiler/translator/tree_util/IntermNode_util.h"
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+namespace sh
+{
+
+namespace
+{
+
+constexpr const ImmutableString kMainString("main");
+
+class ContainsReturnTraverser : public TIntermTraverser
+{
+ public:
+ ContainsReturnTraverser() : TIntermTraverser(true, false, false), mContainsReturn(false) {}
+
+ bool visitBranch(Visit visit, TIntermBranch *node) override
+ {
+ if (node->getFlowOp() == EOpReturn)
+ {
+ mContainsReturn = true;
+ }
+ return false;
+ }
+
+ bool containsReturn() { return mContainsReturn; }
+
+ private:
+ bool mContainsReturn;
+};
+
+bool ContainsReturn(TIntermNode *node)
+{
+ ContainsReturnTraverser traverser;
+ node->traverse(&traverser);
+ return traverser.containsReturn();
+}
+
+void WrapMainAndAppend(TIntermBlock *root,
+ TIntermFunctionDefinition *main,
+ TIntermNode *codeToRun,
+ TSymbolTable *symbolTable)
+{
+ // Replace main() with main0() with the same body.
+ TFunction *oldMain =
+ new TFunction(symbolTable, kEmptyImmutableString, SymbolType::AngleInternal,
+ StaticType::GetBasic<EbtVoid>(), false);
+ TIntermFunctionDefinition *oldMainDefinition =
+ CreateInternalFunctionDefinitionNode(*oldMain, main->getBody());
+
+ bool replaced = root->replaceChildNode(main, oldMainDefinition);
+ ASSERT(replaced);
+
+ // void main()
+ TFunction *newMain = new TFunction(symbolTable, kMainString, SymbolType::UserDefined,
+ StaticType::GetBasic<EbtVoid>(), false);
+ TIntermFunctionPrototype *newMainProto = new TIntermFunctionPrototype(newMain);
+
+ // {
+ // main0();
+ // codeToRun
+ // }
+ TIntermBlock *newMainBody = new TIntermBlock();
+ TIntermAggregate *oldMainCall =
+ TIntermAggregate::CreateFunctionCall(*oldMain, new TIntermSequence());
+ newMainBody->appendStatement(oldMainCall);
+ newMainBody->appendStatement(codeToRun);
+
+ // Add the new main() to the root node.
+ TIntermFunctionDefinition *newMainDefinition =
+ new TIntermFunctionDefinition(newMainProto, newMainBody);
+ root->appendStatement(newMainDefinition);
+}
+
+} // anonymous namespace
+
+void RunAtTheEndOfShader(TIntermBlock *root, TIntermNode *codeToRun, TSymbolTable *symbolTable)
+{
+ TIntermFunctionDefinition *main = FindMain(root);
+ if (!ContainsReturn(main))
+ {
+ main->getBody()->appendStatement(codeToRun);
+ return;
+ }
+
+ WrapMainAndAppend(root, main, codeToRun, symbolTable);
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.h b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.h
new file mode 100644
index 0000000000..ed5a0bb64f
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.h
@@ -0,0 +1,23 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RunAtTheEndOfShader.h: Add code to be run at the end of the shader.
+//
+
+#ifndef COMPILER_TRANSLATOR_TREEUTIL_RUNATTHEENDOFSHADER_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_RUNATTHEENDOFSHADER_H_
+
+namespace sh
+{
+
+class TIntermBlock;
+class TIntermNode;
+class TSymbolTable;
+
+void RunAtTheEndOfShader(TIntermBlock *root, TIntermNode *codeToRun, TSymbolTable *symbolTable);
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_RUNATTHEENDOFSHADER_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/Visit.h b/gfx/angle/checkout/src/compiler/translator/tree_util/Visit.h
new file mode 100644
index 0000000000..2b22fbdf86
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/tree_util/Visit.h
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2018 The ANGLE Project 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_TREEUTIL_VISIT_H_
+#define COMPILER_TRANSLATOR_TREEUTIL_VISIT_H_
+
+namespace sh
+{
+
+enum Visit
+{
+ PreVisit,
+ InVisit,
+ PostVisit
+};
+
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_TREEUTIL_VISIT_H_
diff --git a/gfx/angle/checkout/src/compiler/translator/util.cpp b/gfx/angle/checkout/src/compiler/translator/util.cpp
new file mode 100644
index 0000000000..7781c1bc7c
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/util.cpp
@@ -0,0 +1,936 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/util.h"
+
+#include <limits>
+
+#include "common/utilities.h"
+#include "compiler/preprocessor/numeric_lex.h"
+#include "compiler/translator/ImmutableStringBuilder.h"
+#include "compiler/translator/SymbolTable.h"
+
+bool atoi_clamp(const char *str, unsigned int *value)
+{
+ bool success = angle::pp::numeric_lex_int(str, value);
+ if (!success)
+ *value = std::numeric_limits<unsigned int>::max();
+ return success;
+}
+
+namespace sh
+{
+
+namespace
+{
+
+bool IsInterpolationIn(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqSmoothIn:
+ case EvqFlatIn:
+ case EvqCentroidIn:
+ return true;
+ default:
+ return false;
+ }
+}
+
+} // anonymous namespace
+
+float NumericLexFloat32OutOfRangeToInfinity(const std::string &str)
+{
+ // Parses a decimal string using scientific notation into a floating point number.
+ // Out-of-range values are converted to infinity. Values that are too small to be
+ // represented are converted to zero.
+
+ // The mantissa in decimal scientific notation. The magnitude of the mantissa integer does not
+ // matter.
+ unsigned int decimalMantissa = 0;
+ size_t i = 0;
+ bool decimalPointSeen = false;
+ bool nonZeroSeenInMantissa = false;
+
+ // The exponent offset reflects the position of the decimal point.
+ int exponentOffset = -1;
+
+ // This is just a counter for how many decimal digits are written to decimalMantissa.
+ int mantissaDecimalDigits = 0;
+
+ while (i < str.length())
+ {
+ const char c = str[i];
+ if (c == 'e' || c == 'E')
+ {
+ break;
+ }
+ if (c == '.')
+ {
+ decimalPointSeen = true;
+ ++i;
+ continue;
+ }
+
+ unsigned int digit = static_cast<unsigned int>(c - '0');
+ ASSERT(digit < 10u);
+ if (digit != 0u)
+ {
+ nonZeroSeenInMantissa = true;
+ }
+ if (nonZeroSeenInMantissa)
+ {
+ // Add bits to the mantissa until space runs out in 32-bit int. This should be
+ // enough precision to make the resulting binary mantissa accurate to 1 ULP.
+ if (decimalMantissa <= (std::numeric_limits<unsigned int>::max() - 9u) / 10u)
+ {
+ decimalMantissa = decimalMantissa * 10u + digit;
+ ++mantissaDecimalDigits;
+ }
+ if (!decimalPointSeen)
+ {
+ ++exponentOffset;
+ }
+ }
+ else if (decimalPointSeen)
+ {
+ --exponentOffset;
+ }
+ ++i;
+ }
+ if (decimalMantissa == 0)
+ {
+ return 0.0f;
+ }
+ int exponent = 0;
+ if (i < str.length())
+ {
+ ASSERT(str[i] == 'e' || str[i] == 'E');
+ ++i;
+ bool exponentOutOfRange = false;
+ bool negativeExponent = false;
+ if (str[i] == '-')
+ {
+ negativeExponent = true;
+ ++i;
+ }
+ else if (str[i] == '+')
+ {
+ ++i;
+ }
+ while (i < str.length())
+ {
+ const char c = str[i];
+ unsigned int digit = static_cast<unsigned int>(c - '0');
+ ASSERT(digit < 10u);
+ if (exponent <= (std::numeric_limits<int>::max() - 9) / 10)
+ {
+ exponent = exponent * 10 + digit;
+ }
+ else
+ {
+ exponentOutOfRange = true;
+ }
+ ++i;
+ }
+ if (negativeExponent)
+ {
+ exponent = -exponent;
+ }
+ if (exponentOutOfRange)
+ {
+ if (negativeExponent)
+ {
+ return 0.0f;
+ }
+ else
+ {
+ return std::numeric_limits<float>::infinity();
+ }
+ }
+ }
+ // Do the calculation in 64-bit to avoid overflow.
+ long long exponentLong =
+ static_cast<long long>(exponent) + static_cast<long long>(exponentOffset);
+ if (exponentLong > std::numeric_limits<float>::max_exponent10)
+ {
+ return std::numeric_limits<float>::infinity();
+ }
+ else if (exponentLong < std::numeric_limits<float>::min_exponent10)
+ {
+ return 0.0f;
+ }
+ // The exponent is in range, so we need to actually evaluate the float.
+ exponent = static_cast<int>(exponentLong);
+ double value = decimalMantissa;
+
+ // Calculate the exponent offset to normalize the mantissa.
+ int normalizationExponentOffset = 1 - mantissaDecimalDigits;
+ // Apply the exponent.
+ value *= std::pow(10.0, static_cast<double>(exponent + normalizationExponentOffset));
+ if (value > static_cast<double>(std::numeric_limits<float>::max()))
+ {
+ return std::numeric_limits<float>::infinity();
+ }
+ if (value < static_cast<double>(std::numeric_limits<float>::min()))
+ {
+ return 0.0f;
+ }
+ return static_cast<float>(value);
+}
+
+bool strtof_clamp(const std::string &str, float *value)
+{
+ // Custom float parsing that can handle the following corner cases:
+ // 1. The decimal mantissa is very small but the exponent is very large, putting the resulting
+ // number inside the float range.
+ // 2. The decimal mantissa is very large but the exponent is very small, putting the resulting
+ // number inside the float range.
+ // 3. The value is out-of-range and should be evaluated as infinity.
+ // 4. The value is too small and should be evaluated as zero.
+ // See ESSL 3.00.6 section 4.1.4 for the relevant specification.
+ *value = NumericLexFloat32OutOfRangeToInfinity(str);
+ return !gl::isInf(*value);
+}
+
+GLenum GLVariableType(const TType &type)
+{
+ if (type.getBasicType() == EbtFloat)
+ {
+ if (type.isVector())
+ {
+ switch (type.getNominalSize())
+ {
+ case 2:
+ return GL_FLOAT_VEC2;
+ case 3:
+ return GL_FLOAT_VEC3;
+ case 4:
+ return GL_FLOAT_VEC4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+ }
+ else if (type.isMatrix())
+ {
+ switch (type.getCols())
+ {
+ case 2:
+ switch (type.getRows())
+ {
+ case 2:
+ return GL_FLOAT_MAT2;
+ case 3:
+ return GL_FLOAT_MAT2x3;
+ case 4:
+ return GL_FLOAT_MAT2x4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+
+ 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();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+
+ 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();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+ }
+ else
+ {
+ return GL_FLOAT;
+ }
+ }
+ else if (type.getBasicType() == EbtInt)
+ {
+ if (type.isVector())
+ {
+ switch (type.getNominalSize())
+ {
+ case 2:
+ return GL_INT_VEC2;
+ case 3:
+ return GL_INT_VEC3;
+ case 4:
+ return GL_INT_VEC4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+ }
+ else
+ {
+ ASSERT(!type.isMatrix());
+ return GL_INT;
+ }
+ }
+ else if (type.getBasicType() == EbtUInt)
+ {
+ 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();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+ }
+ else
+ {
+ ASSERT(!type.isMatrix());
+ return GL_UNSIGNED_INT;
+ }
+ }
+ else if (type.getBasicType() == EbtBool)
+ {
+ if (type.isVector())
+ {
+ switch (type.getNominalSize())
+ {
+ case 2:
+ return GL_BOOL_VEC2;
+ case 3:
+ return GL_BOOL_VEC3;
+ case 4:
+ return GL_BOOL_VEC4;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return GL_NONE;
+#endif
+ }
+ }
+ else
+ {
+ ASSERT(!type.isMatrix());
+ return GL_BOOL;
+ }
+ }
+
+ switch (type.getBasicType())
+ {
+ case EbtSampler2D:
+ return GL_SAMPLER_2D;
+ case EbtSampler3D:
+ return GL_SAMPLER_3D;
+ case EbtSamplerCube:
+ return GL_SAMPLER_CUBE;
+ case EbtSamplerExternalOES:
+ return GL_SAMPLER_EXTERNAL_OES;
+ case EbtSamplerExternal2DY2YEXT:
+ return GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT;
+ case EbtSampler2DRect:
+ return GL_SAMPLER_2D_RECT_ANGLE;
+ case EbtSampler2DArray:
+ return GL_SAMPLER_2D_ARRAY;
+ case EbtSampler2DMS:
+ return GL_SAMPLER_2D_MULTISAMPLE;
+ case EbtSampler2DMSArray:
+ return GL_SAMPLER_2D_MULTISAMPLE_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 EbtISampler2DMS:
+ return GL_INT_SAMPLER_2D_MULTISAMPLE;
+ case EbtISampler2DMSArray:
+ return GL_INT_SAMPLER_2D_MULTISAMPLE_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 EbtUSampler2DMS:
+ return GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE;
+ case EbtUSampler2DMSArray:
+ return GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY;
+ case EbtSampler2DShadow:
+ return GL_SAMPLER_2D_SHADOW;
+ case EbtSamplerCubeShadow:
+ return GL_SAMPLER_CUBE_SHADOW;
+ case EbtSampler2DArrayShadow:
+ return GL_SAMPLER_2D_ARRAY_SHADOW;
+ case EbtImage2D:
+ return GL_IMAGE_2D;
+ case EbtIImage2D:
+ return GL_INT_IMAGE_2D;
+ case EbtUImage2D:
+ return GL_UNSIGNED_INT_IMAGE_2D;
+ case EbtImage2DArray:
+ return GL_IMAGE_2D_ARRAY;
+ case EbtIImage2DArray:
+ return GL_INT_IMAGE_2D_ARRAY;
+ case EbtUImage2DArray:
+ return GL_UNSIGNED_INT_IMAGE_2D_ARRAY;
+ case EbtImage3D:
+ return GL_IMAGE_3D;
+ case EbtIImage3D:
+ return GL_INT_IMAGE_3D;
+ case EbtUImage3D:
+ return GL_UNSIGNED_INT_IMAGE_3D;
+ case EbtImageCube:
+ return GL_IMAGE_CUBE;
+ case EbtIImageCube:
+ return GL_INT_IMAGE_CUBE;
+ case EbtUImageCube:
+ return GL_UNSIGNED_INT_IMAGE_CUBE;
+ case EbtAtomicCounter:
+ return GL_UNSIGNED_INT_ATOMIC_COUNTER;
+ default:
+ UNREACHABLE();
+ }
+
+ return GL_NONE;
+}
+
+GLenum GLVariablePrecision(const TType &type)
+{
+ if (type.getBasicType() == EbtFloat)
+ {
+ switch (type.getPrecision())
+ {
+ case EbpHigh:
+ return GL_HIGH_FLOAT;
+ case EbpMedium:
+ return GL_MEDIUM_FLOAT;
+ case EbpLow:
+ return GL_LOW_FLOAT;
+ case EbpUndefined:
+ // Desktop specs do not use precision
+ return GL_NONE;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
+ {
+ switch (type.getPrecision())
+ {
+ case EbpHigh:
+ return GL_HIGH_INT;
+ case EbpMedium:
+ return GL_MEDIUM_INT;
+ case EbpLow:
+ return GL_LOW_INT;
+ case EbpUndefined:
+ // Desktop specs do not use precision
+ return GL_NONE;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ // Other types (boolean, sampler) don't have a precision
+ return GL_NONE;
+}
+
+ImmutableString ArrayString(const TType &type)
+{
+ if (!type.isArray())
+ return ImmutableString("");
+
+ const TVector<unsigned int> &arraySizes = *type.getArraySizes();
+ constexpr const size_t kMaxDecimalDigitsPerSize = 10u;
+ ImmutableStringBuilder arrayString(arraySizes.size() * (kMaxDecimalDigitsPerSize + 2u));
+ for (auto arraySizeIter = arraySizes.rbegin(); arraySizeIter != arraySizes.rend();
+ ++arraySizeIter)
+ {
+ arrayString << "[";
+ if (*arraySizeIter > 0)
+ {
+ arrayString.appendDecimal(*arraySizeIter);
+ }
+ arrayString << "]";
+ }
+ return arrayString;
+}
+
+ImmutableString GetTypeName(const TType &type, ShHashFunction64 hashFunction, NameMap *nameMap)
+{
+ if (type.getBasicType() == EbtStruct)
+ return HashName(type.getStruct(), hashFunction, nameMap);
+ else
+ return ImmutableString(type.getBuiltInTypeNameString());
+}
+
+bool IsVaryingOut(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqVaryingOut:
+ case EvqSmoothOut:
+ case EvqFlatOut:
+ case EvqCentroidOut:
+ case EvqVertexOut:
+ case EvqGeometryOut:
+ return true;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+bool IsVaryingIn(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqVaryingIn:
+ case EvqSmoothIn:
+ case EvqFlatIn:
+ case EvqCentroidIn:
+ case EvqFragmentIn:
+ case EvqGeometryIn:
+ return true;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+bool IsVarying(TQualifier qualifier)
+{
+ return IsVaryingIn(qualifier) || IsVaryingOut(qualifier);
+}
+
+bool IsGeometryShaderInput(GLenum shaderType, TQualifier qualifier)
+{
+ return (qualifier == EvqGeometryIn) ||
+ ((shaderType == GL_GEOMETRY_SHADER_EXT) && IsInterpolationIn(qualifier));
+}
+
+InterpolationType GetInterpolationType(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqFlatIn:
+ case EvqFlatOut:
+ return INTERPOLATION_FLAT;
+
+ case EvqSmoothIn:
+ case EvqSmoothOut:
+ case EvqVertexOut:
+ case EvqFragmentIn:
+ case EvqVaryingIn:
+ case EvqVaryingOut:
+ case EvqGeometryIn:
+ case EvqGeometryOut:
+ return INTERPOLATION_SMOOTH;
+
+ case EvqCentroidIn:
+ case EvqCentroidOut:
+ return INTERPOLATION_CENTROID;
+
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return INTERPOLATION_SMOOTH;
+#endif
+ }
+}
+
+TType GetShaderVariableBasicType(const sh::ShaderVariable &var)
+{
+ switch (var.type)
+ {
+ case GL_BOOL:
+ return TType(EbtBool);
+ case GL_BOOL_VEC2:
+ return TType(EbtBool, 2);
+ case GL_BOOL_VEC3:
+ return TType(EbtBool, 3);
+ case GL_BOOL_VEC4:
+ return TType(EbtBool, 4);
+ case GL_FLOAT:
+ return TType(EbtFloat);
+ case GL_FLOAT_VEC2:
+ return TType(EbtFloat, 2);
+ case GL_FLOAT_VEC3:
+ return TType(EbtFloat, 3);
+ case GL_FLOAT_VEC4:
+ return TType(EbtFloat, 4);
+ case GL_FLOAT_MAT2:
+ return TType(EbtFloat, 2, 2);
+ case GL_FLOAT_MAT3:
+ return TType(EbtFloat, 3, 3);
+ case GL_FLOAT_MAT4:
+ return TType(EbtFloat, 4, 4);
+ case GL_FLOAT_MAT2x3:
+ return TType(EbtFloat, 2, 3);
+ case GL_FLOAT_MAT2x4:
+ return TType(EbtFloat, 2, 4);
+ case GL_FLOAT_MAT3x2:
+ return TType(EbtFloat, 3, 2);
+ case GL_FLOAT_MAT3x4:
+ return TType(EbtFloat, 3, 4);
+ case GL_FLOAT_MAT4x2:
+ return TType(EbtFloat, 4, 2);
+ case GL_FLOAT_MAT4x3:
+ return TType(EbtFloat, 4, 3);
+ case GL_INT:
+ return TType(EbtInt);
+ case GL_INT_VEC2:
+ return TType(EbtInt, 2);
+ case GL_INT_VEC3:
+ return TType(EbtInt, 3);
+ case GL_INT_VEC4:
+ return TType(EbtInt, 4);
+ case GL_UNSIGNED_INT:
+ return TType(EbtUInt);
+ case GL_UNSIGNED_INT_VEC2:
+ return TType(EbtUInt, 2);
+ case GL_UNSIGNED_INT_VEC3:
+ return TType(EbtUInt, 3);
+ case GL_UNSIGNED_INT_VEC4:
+ return TType(EbtUInt, 4);
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return TType();
+#endif
+ }
+}
+
+void DeclareGlobalVariable(TIntermBlock *root, const TVariable *variable)
+{
+ TIntermDeclaration *declaration = new TIntermDeclaration();
+ declaration->appendDeclarator(new TIntermSymbol(variable));
+
+ TIntermSequence *globalSequence = root->getSequence();
+ globalSequence->insert(globalSequence->begin(), declaration);
+}
+
+// GLSL ES 1.0.17 4.6.1 The Invariant Qualifier
+bool CanBeInvariantESSL1(TQualifier qualifier)
+{
+ return IsVaryingIn(qualifier) || IsVaryingOut(qualifier) ||
+ IsBuiltinOutputVariable(qualifier) ||
+ (IsBuiltinFragmentInputVariable(qualifier) && qualifier != EvqFrontFacing);
+}
+
+// GLSL ES 3.00 Revision 6, 4.6.1 The Invariant Qualifier
+// GLSL ES 3.10 Revision 4, 4.8.1 The Invariant Qualifier
+bool CanBeInvariantESSL3OrGreater(TQualifier qualifier)
+{
+ return IsVaryingOut(qualifier) || qualifier == EvqFragmentOut ||
+ IsBuiltinOutputVariable(qualifier);
+}
+
+bool IsBuiltinOutputVariable(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqPosition:
+ case EvqPointSize:
+ case EvqFragDepth:
+ case EvqFragDepthEXT:
+ case EvqFragColor:
+ case EvqSecondaryFragColorEXT:
+ case EvqFragData:
+ case EvqSecondaryFragDataEXT:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+bool IsBuiltinFragmentInputVariable(TQualifier qualifier)
+{
+ switch (qualifier)
+ {
+ case EvqFragCoord:
+ case EvqPointCoord:
+ case EvqFrontFacing:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+bool IsShaderOutput(TQualifier qualifier)
+{
+ return IsVaryingOut(qualifier) || IsBuiltinOutputVariable(qualifier);
+}
+
+bool IsOutputESSL(ShShaderOutput output)
+{
+ return output == SH_ESSL_OUTPUT;
+}
+
+bool IsOutputGLSL(ShShaderOutput output)
+{
+ switch (output)
+ {
+ case SH_GLSL_130_OUTPUT:
+ case SH_GLSL_140_OUTPUT:
+ case SH_GLSL_150_CORE_OUTPUT:
+ case SH_GLSL_330_CORE_OUTPUT:
+ case SH_GLSL_400_CORE_OUTPUT:
+ case SH_GLSL_410_CORE_OUTPUT:
+ case SH_GLSL_420_CORE_OUTPUT:
+ case SH_GLSL_430_CORE_OUTPUT:
+ case SH_GLSL_440_CORE_OUTPUT:
+ case SH_GLSL_450_CORE_OUTPUT:
+ case SH_GLSL_COMPATIBILITY_OUTPUT:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+bool IsOutputHLSL(ShShaderOutput output)
+{
+ switch (output)
+ {
+ case SH_HLSL_3_0_OUTPUT:
+ case SH_HLSL_4_1_OUTPUT:
+ case SH_HLSL_4_0_FL9_3_OUTPUT:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+bool IsOutputVulkan(ShShaderOutput output)
+{
+ return output == SH_GLSL_VULKAN_OUTPUT;
+}
+
+bool IsInShaderStorageBlock(TIntermTyped *node)
+{
+ TIntermSwizzle *swizzleNode = node->getAsSwizzleNode();
+ if (swizzleNode)
+ {
+ return IsInShaderStorageBlock(swizzleNode->getOperand());
+ }
+
+ TIntermBinary *binaryNode = node->getAsBinaryNode();
+ if (binaryNode)
+ {
+ switch (binaryNode->getOp())
+ {
+ case EOpIndexDirectInterfaceBlock:
+ case EOpIndexIndirect:
+ case EOpIndexDirect:
+ case EOpIndexDirectStruct:
+ return IsInShaderStorageBlock(binaryNode->getLeft());
+ default:
+ return false;
+ }
+ }
+
+ const TType &type = node->getType();
+ return type.getQualifier() == EvqBuffer;
+}
+
+GLenum GetImageInternalFormatType(TLayoutImageInternalFormat iifq)
+{
+ switch (iifq)
+ {
+ case EiifRGBA32F:
+ return GL_RGBA32F;
+ case EiifRGBA16F:
+ return GL_RGBA16F;
+ case EiifR32F:
+ return GL_R32F;
+ case EiifRGBA32UI:
+ return GL_RGBA32UI;
+ case EiifRGBA16UI:
+ return GL_RGBA16UI;
+ case EiifRGBA8UI:
+ return GL_RGBA8UI;
+ case EiifR32UI:
+ return GL_R32UI;
+ case EiifRGBA32I:
+ return GL_RGBA32I;
+ case EiifRGBA16I:
+ return GL_RGBA16I;
+ case EiifRGBA8I:
+ return GL_RGBA8I;
+ case EiifR32I:
+ return GL_R32I;
+ case EiifRGBA8:
+ return GL_RGBA8;
+ case EiifRGBA8_SNORM:
+ return GL_RGBA8_SNORM;
+ default:
+ return GL_NONE;
+ }
+}
+
+bool IsSpecWithFunctionBodyNewScope(ShShaderSpec shaderSpec, int shaderVersion)
+{
+ return (shaderVersion == 100 && !sh::IsWebGLBasedSpec(shaderSpec));
+}
+
+ImplicitTypeConversion GetConversion(TBasicType t1, TBasicType t2)
+{
+ if (t1 == t2)
+ return ImplicitTypeConversion::Same;
+
+ switch (t1)
+ {
+ case EbtInt:
+ switch (t2)
+ {
+ case EbtInt:
+ UNREACHABLE();
+ break;
+ case EbtUInt:
+ return ImplicitTypeConversion::Invalid;
+ case EbtFloat:
+ return ImplicitTypeConversion::Left;
+ default:
+ return ImplicitTypeConversion::Invalid;
+ }
+ break;
+ case EbtUInt:
+ switch (t2)
+ {
+ case EbtInt:
+ return ImplicitTypeConversion::Invalid;
+ case EbtUInt:
+ UNREACHABLE();
+ break;
+ case EbtFloat:
+ return ImplicitTypeConversion::Left;
+ default:
+ return ImplicitTypeConversion::Invalid;
+ }
+ break;
+ case EbtFloat:
+ switch (t2)
+ {
+ case EbtInt:
+ case EbtUInt:
+ return ImplicitTypeConversion::Right;
+ case EbtFloat:
+ UNREACHABLE();
+ break;
+ default:
+ return ImplicitTypeConversion::Invalid;
+ }
+ break;
+ default:
+ return ImplicitTypeConversion::Invalid;
+ }
+ return ImplicitTypeConversion::Invalid;
+}
+
+bool IsValidImplicitConversion(sh::ImplicitTypeConversion conversion, TOperator op)
+{
+ switch (conversion)
+ {
+ case sh::ImplicitTypeConversion::Same:
+ return true;
+ case sh::ImplicitTypeConversion::Left:
+ switch (op)
+ {
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ case EOpAdd:
+ case EOpSub:
+ case EOpMul:
+ case EOpDiv:
+ return true;
+ default:
+ break;
+ }
+ break;
+ case sh::ImplicitTypeConversion::Right:
+ switch (op)
+ {
+ case EOpAssign:
+ case EOpInitialize:
+ case EOpEqual:
+ case EOpNotEqual:
+ case EOpLessThan:
+ case EOpGreaterThan:
+ case EOpLessThanEqual:
+ case EOpGreaterThanEqual:
+ case EOpAdd:
+ case EOpSub:
+ case EOpMul:
+ case EOpDiv:
+ case EOpAddAssign:
+ case EOpSubAssign:
+ case EOpMulAssign:
+ case EOpDivAssign:
+ return true;
+ default:
+ break;
+ }
+ break;
+ case sh::ImplicitTypeConversion::Invalid:
+ break;
+ }
+ return false;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/compiler/translator/util.h b/gfx/angle/checkout/src/compiler/translator/util.h
new file mode 100644
index 0000000000..609c72af67
--- /dev/null
+++ b/gfx/angle/checkout/src/compiler/translator/util.h
@@ -0,0 +1,92 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_UTIL_H_
+#define COMPILER_TRANSLATOR_UTIL_H_
+
+#include <stack>
+
+#include <GLSLANG/ShaderLang.h>
+#include "angle_gl.h"
+
+#include "compiler/translator/HashNames.h"
+#include "compiler/translator/ImmutableString.h"
+#include "compiler/translator/Operator.h"
+#include "compiler/translator/Types.h"
+
+// If overflow happens, clamp the value to UINT_MIN or UINT_MAX.
+// Return false if overflow happens.
+bool atoi_clamp(const char *str, unsigned int *value);
+
+namespace sh
+{
+
+// Keeps track of whether an implicit conversion from int/uint to float is possible.
+// These conversions are supported in desktop GLSL shaders only.
+// Also keeps track of which side of operation should be converted.
+enum class ImplicitTypeConversion
+{
+ Same,
+ Left,
+ Right,
+ Invalid,
+};
+
+class TIntermBlock;
+class TSymbolTable;
+class TIntermTyped;
+
+float NumericLexFloat32OutOfRangeToInfinity(const std::string &str);
+
+// strtof_clamp is like strtof but
+// 1. it forces C locale, i.e. forcing '.' as decimal point.
+// 2. it sets the value to infinity if overflow happens.
+// 3. str should be guaranteed to be in the valid format for a floating point number as defined
+// by the grammar in the ESSL 3.00.6 spec section 4.1.4.
+// Return false if overflow happens.
+bool strtof_clamp(const std::string &str, float *value);
+
+GLenum GLVariableType(const TType &type);
+GLenum GLVariablePrecision(const TType &type);
+bool IsVaryingIn(TQualifier qualifier);
+bool IsVaryingOut(TQualifier qualifier);
+bool IsVarying(TQualifier qualifier);
+bool IsGeometryShaderInput(GLenum shaderType, TQualifier qualifier);
+InterpolationType GetInterpolationType(TQualifier qualifier);
+
+// Returns array brackets including size with outermost array size first, as specified in GLSL ES
+// 3.10 section 4.1.9.
+ImmutableString ArrayString(const TType &type);
+
+ImmutableString GetTypeName(const TType &type, ShHashFunction64 hashFunction, NameMap *nameMap);
+
+TType GetShaderVariableBasicType(const sh::ShaderVariable &var);
+
+void DeclareGlobalVariable(TIntermBlock *root, const TVariable *variable);
+
+bool IsBuiltinOutputVariable(TQualifier qualifier);
+bool IsBuiltinFragmentInputVariable(TQualifier qualifier);
+bool CanBeInvariantESSL1(TQualifier qualifier);
+bool CanBeInvariantESSL3OrGreater(TQualifier qualifier);
+bool IsShaderOutput(TQualifier qualifier);
+bool IsOutputESSL(ShShaderOutput output);
+bool IsOutputGLSL(ShShaderOutput output);
+bool IsOutputHLSL(ShShaderOutput output);
+bool IsOutputVulkan(ShShaderOutput output);
+
+bool IsInShaderStorageBlock(TIntermTyped *node);
+
+GLenum GetImageInternalFormatType(TLayoutImageInternalFormat iifq);
+// ESSL 1.00 shaders nest function body scope within function parameter scope
+bool IsSpecWithFunctionBodyNewScope(ShShaderSpec shaderSpec, int shaderVersion);
+
+// Helper functions for implicit conversions
+ImplicitTypeConversion GetConversion(TBasicType t1, TBasicType t2);
+
+bool IsValidImplicitConversion(ImplicitTypeConversion conversion, TOperator op);
+} // namespace sh
+
+#endif // COMPILER_TRANSLATOR_UTIL_H_
diff --git a/gfx/angle/checkout/src/gpu_info_util/SystemInfo.cpp b/gfx/angle/checkout/src/gpu_info_util/SystemInfo.cpp
new file mode 100644
index 0000000000..c12bf8fd8d
--- /dev/null
+++ b/gfx/angle/checkout/src/gpu_info_util/SystemInfo.cpp
@@ -0,0 +1,312 @@
+//
+// Copyright (c) 2013-2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SystemInfo.cpp: implementation of the system-agnostic parts of SystemInfo.h
+
+#include "gpu_info_util/SystemInfo.h"
+
+#include <cstring>
+#include <iostream>
+#include <sstream>
+
+#include "common/debug.h"
+#include "common/string_utils.h"
+
+namespace angle
+{
+namespace
+{
+std::string VendorName(VendorID vendor)
+{
+ switch (vendor)
+ {
+ case kVendorID_AMD:
+ return "AMD";
+ case kVendorID_Intel:
+ return "Intel";
+ case kVendorID_ImgTec:
+ return "ImgTec";
+ case kVendorID_NVIDIA:
+ return "NVIDIA";
+ case kVendorID_Qualcomm:
+ return "Qualcomm";
+ case kVendorID_Vivante:
+ return "Vivante";
+ case kVendorID_VeriSilicon:
+ return "VeriSilicon";
+ case kVendorID_VMWare:
+ return "VMWare";
+ case kVendorID_Kazan:
+ return "Kazan";
+ default:
+ return "Unknown (" + std::to_string(vendor) + ")";
+ }
+}
+} // anonymous namespace
+GPUDeviceInfo::GPUDeviceInfo() = default;
+
+GPUDeviceInfo::~GPUDeviceInfo() = default;
+
+GPUDeviceInfo::GPUDeviceInfo(const GPUDeviceInfo &other) = default;
+
+SystemInfo::SystemInfo() = default;
+
+SystemInfo::~SystemInfo() = default;
+
+SystemInfo::SystemInfo(const SystemInfo &other) = default;
+
+bool SystemInfo::hasNVIDIAGPU() const
+{
+ for (const GPUDeviceInfo &gpu : gpus)
+ {
+ if (IsNVIDIA(gpu.vendorId))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SystemInfo::hasIntelGPU() const
+{
+ for (const GPUDeviceInfo &gpu : gpus)
+ {
+ if (IsIntel(gpu.vendorId))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SystemInfo::hasAMDGPU() const
+{
+ for (const GPUDeviceInfo &gpu : gpus)
+ {
+ if (IsAMD(gpu.vendorId))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool IsAMD(VendorID vendorId)
+{
+ return vendorId == kVendorID_AMD;
+}
+
+bool IsARM(VendorID vendorId)
+{
+ return vendorId == kVendorID_ARM;
+}
+
+bool IsImgTec(VendorID vendorId)
+{
+ return vendorId == kVendorID_ImgTec;
+}
+
+bool IsKazan(VendorID vendorId)
+{
+ return vendorId == kVendorID_Kazan;
+}
+
+bool IsIntel(VendorID vendorId)
+{
+ return vendorId == kVendorID_Intel;
+}
+
+bool IsNVIDIA(VendorID vendorId)
+{
+ return vendorId == kVendorID_NVIDIA;
+}
+
+bool IsQualcomm(VendorID vendorId)
+{
+ return vendorId == kVendorID_Qualcomm;
+}
+
+bool IsVeriSilicon(VendorID vendorId)
+{
+ return vendorId == kVendorID_VeriSilicon;
+}
+
+bool IsVMWare(VendorID vendorId)
+{
+ return vendorId == kVendorID_VMWare;
+}
+
+bool IsVivante(VendorID vendorId)
+{
+ return vendorId == kVendorID_Vivante;
+}
+
+bool ParseAMDBrahmaDriverVersion(const std::string &content, std::string *version)
+{
+ const size_t begin = content.find_first_of("0123456789");
+ if (begin == std::string::npos)
+ {
+ return false;
+ }
+
+ const size_t end = content.find_first_not_of("0123456789.", begin);
+ if (end == std::string::npos)
+ {
+ *version = content.substr(begin);
+ }
+ else
+ {
+ *version = content.substr(begin, end - begin);
+ }
+ return true;
+}
+
+bool ParseAMDCatalystDriverVersion(const std::string &content, std::string *version)
+{
+ std::istringstream stream(content);
+
+ std::string line;
+ while (std::getline(stream, line))
+ {
+ static const char kReleaseVersion[] = "ReleaseVersion=";
+ if (line.compare(0, std::strlen(kReleaseVersion), kReleaseVersion) != 0)
+ {
+ continue;
+ }
+
+ if (ParseAMDBrahmaDriverVersion(line, version))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool ParseMacMachineModel(const std::string &identifier,
+ std::string *type,
+ int32_t *major,
+ int32_t *minor)
+{
+ size_t numberLoc = identifier.find_first_of("0123456789");
+ if (numberLoc == std::string::npos)
+ {
+ return false;
+ }
+
+ size_t commaLoc = identifier.find(',', numberLoc);
+ if (commaLoc == std::string::npos || commaLoc >= identifier.size())
+ {
+ return false;
+ }
+
+ const char *numberPtr = &identifier[numberLoc];
+ const char *commaPtr = &identifier[commaLoc + 1];
+ char *endPtr = nullptr;
+
+ int32_t majorTmp = std::strtol(numberPtr, &endPtr, 10);
+ if (endPtr == numberPtr)
+ {
+ return false;
+ }
+
+ int32_t minorTmp = std::strtol(commaPtr, &endPtr, 10);
+ if (endPtr == commaPtr)
+ {
+ return false;
+ }
+
+ *major = majorTmp;
+ *minor = minorTmp;
+ *type = identifier.substr(0, numberLoc);
+
+ return true;
+}
+
+bool CMDeviceIDToDeviceAndVendorID(const std::string &id, uint32_t *vendorId, uint32_t *deviceId)
+{
+ unsigned int vendor = 0;
+ unsigned int device = 0;
+
+ bool success = id.length() >= 21 && HexStringToUInt(id.substr(8, 4), &vendor) &&
+ HexStringToUInt(id.substr(17, 4), &device);
+
+ *vendorId = vendor;
+ *deviceId = device;
+ return success;
+}
+
+void FindActiveGPU(SystemInfo *info)
+{
+ ASSERT(!info->gpus.empty());
+
+ // On dual-GPU systems we assume the non-Intel GPU is the graphics one.
+ int active = 0;
+ bool hasIntel = false;
+ for (size_t i = 0; i < info->gpus.size(); ++i)
+ {
+ if (IsIntel(info->gpus[i].vendorId))
+ {
+ hasIntel = true;
+ }
+ if (IsIntel(info->gpus[active].vendorId))
+ {
+ active = static_cast<int>(i);
+ }
+ }
+
+ // Assume that a combination of NVIDIA or AMD with Intel means Optimus or AMD Switchable
+ info->activeGPUIndex = active;
+ info->isOptimus = hasIntel && IsNVIDIA(info->gpus[active].vendorId);
+ info->isAMDSwitchable = hasIntel && IsAMD(info->gpus[active].vendorId);
+}
+
+void PrintSystemInfo(const SystemInfo &info)
+{
+ std::cout << info.gpus.size() << " GPUs:\n";
+
+ for (size_t i = 0; i < info.gpus.size(); i++)
+ {
+ const auto &gpu = info.gpus[i];
+
+ std::cout << " " << i << " - " << VendorName(gpu.vendorId) << " device id: 0x" << std::hex
+ << std::uppercase << gpu.deviceId << std::dec << "\n";
+ if (!gpu.driverVendor.empty())
+ {
+ std::cout << " Driver Vendor: " << gpu.driverVendor << "\n";
+ }
+ if (!gpu.driverVersion.empty())
+ {
+ std::cout << " Driver Version: " << gpu.driverVersion << "\n";
+ }
+ if (!gpu.driverDate.empty())
+ {
+ std::cout << " Driver Date: " << gpu.driverDate << "\n";
+ }
+ }
+
+ std::cout << "\n";
+ std::cout << "Active GPU: " << info.activeGPUIndex << "\n";
+
+ std::cout << "\n";
+ std::cout << "Optimus: " << (info.isOptimus ? "true" : "false") << "\n";
+ std::cout << "AMD Switchable: " << (info.isAMDSwitchable ? "true" : "false") << "\n";
+
+ std::cout << "\n";
+ if (!info.machineManufacturer.empty())
+ {
+ std::cout << "Machine Manufacturer: " << info.machineManufacturer << "\n";
+ }
+ if (!info.machineModelName.empty())
+ {
+ std::cout << "Machine Model: " << info.machineModelName << "\n";
+ }
+ if (!info.machineModelVersion.empty())
+ {
+ std::cout << "Machine Model Version: " << info.machineModelVersion << "\n";
+ }
+ std::cout << std::endl;
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/gpu_info_util/SystemInfo.h b/gfx/angle/checkout/src/gpu_info_util/SystemInfo.h
new file mode 100644
index 0000000000..219ec37207
--- /dev/null
+++ b/gfx/angle/checkout/src/gpu_info_util/SystemInfo.h
@@ -0,0 +1,115 @@
+//
+// Copyright (c) 2013-2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SystemInfo.h: gathers information available without starting a GPU driver.
+
+#ifndef GPU_INFO_UTIL_SYSTEM_INFO_H_
+#define GPU_INFO_UTIL_SYSTEM_INFO_H_
+
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace angle
+{
+
+using VendorID = uint32_t;
+using DeviceID = uint32_t;
+
+struct VersionInfo
+{
+ uint32_t major = 0;
+ uint32_t minor = 0;
+ uint32_t subMinor = 0;
+ uint32_t patch = 0;
+};
+
+struct GPUDeviceInfo
+{
+ GPUDeviceInfo();
+ ~GPUDeviceInfo();
+
+ GPUDeviceInfo(const GPUDeviceInfo &other);
+
+ VendorID vendorId = 0;
+ DeviceID deviceId = 0;
+
+ std::string driverVendor;
+ std::string driverVersion;
+ std::string driverDate;
+
+ // Only available on Android
+ VersionInfo detailedDriverVersion;
+};
+
+struct SystemInfo
+{
+ SystemInfo();
+ ~SystemInfo();
+
+ SystemInfo(const SystemInfo &other);
+
+ bool hasNVIDIAGPU() const;
+ bool hasIntelGPU() const;
+ bool hasAMDGPU() const;
+
+ std::vector<GPUDeviceInfo> gpus;
+
+ // Index of the GPU expected to be used for 3D graphics. Based on a best-guess heuristic on
+ // some platforms. On windows, this is accurate.
+ int activeGPUIndex = -1;
+
+ bool isOptimus = false;
+ bool isAMDSwitchable = false;
+ // Only true on dual-GPU Mac laptops.
+ bool isMacSwitchable = false;
+
+ // Only available on Android
+ std::string machineManufacturer;
+
+ // Only available on macOS and Android
+ std::string machineModelName;
+
+ // Only available on macOS
+ std::string machineModelVersion;
+};
+
+// Gathers information about the system without starting a GPU driver and returns them in `info`.
+// Returns true if all info was gathered, false otherwise. Even when false is returned, `info` will
+// be filled with partial information.
+bool GetSystemInfo(SystemInfo *info);
+
+// Known PCI vendor IDs
+constexpr VendorID kVendorID_AMD = 0x1002;
+constexpr VendorID kVendorID_ARM = 0x13B5;
+constexpr VendorID kVendorID_ImgTec = 0x1010;
+constexpr VendorID kVendorID_Intel = 0x8086;
+constexpr VendorID kVendorID_NVIDIA = 0x10DE;
+constexpr VendorID kVendorID_Qualcomm = 0x5143;
+constexpr VendorID kVendorID_VMWare = 0x15ad;
+
+// Known non-PCI (i.e. Khronos-registered) vendor IDs
+constexpr VendorID kVendorID_Vivante = 0x10001;
+constexpr VendorID kVendorID_VeriSilicon = 0x10002;
+constexpr VendorID kVendorID_Kazan = 0x10003;
+
+// Predicates on vendor IDs
+bool IsAMD(VendorID vendorId);
+bool IsARM(VendorID vendorId);
+bool IsImgTec(VendorID vendorId);
+bool IsIntel(VendorID vendorId);
+bool IsKazan(VendorID vendorId);
+bool IsNVIDIA(VendorID vendorId);
+bool IsQualcomm(VendorID vendorId);
+bool IsVeriSilicon(VendorID vendorId);
+bool IsVMWare(VendorID vendorId);
+bool IsVivante(VendorID vendorId);
+
+// Dumps the system info to stdout.
+void PrintSystemInfo(const SystemInfo &info);
+} // namespace angle
+
+#endif // GPU_INFO_UTIL_SYSTEM_INFO_H_
diff --git a/gfx/angle/checkout/src/gpu_info_util/SystemInfo_internal.h b/gfx/angle/checkout/src/gpu_info_util/SystemInfo_internal.h
new file mode 100644
index 0000000000..dd3e750197
--- /dev/null
+++ b/gfx/angle/checkout/src/gpu_info_util/SystemInfo_internal.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2013-2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SystemInfo_internal.h: Functions used by the SystemInfo_* files and unittests
+
+#ifndef GPU_INFO_UTIL_SYSTEM_INFO_INTERNAL_H_
+#define GPU_INFO_UTIL_SYSTEM_INFO_INTERNAL_H_
+
+#include "gpu_info_util/SystemInfo.h"
+
+namespace angle
+{
+
+// Defined in SystemInfo_libpci when GPU_INFO_USE_LIBPCI is defined.
+bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices);
+// Defined in SystemInfo_x11 when GPU_INFO_USE_X11 is defined.
+bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version);
+
+// Target specific helper functions that can be compiled on all targets
+// Live in SystemInfo.cpp
+bool ParseAMDBrahmaDriverVersion(const std::string &content, std::string *version);
+bool ParseAMDCatalystDriverVersion(const std::string &content, std::string *version);
+bool ParseMacMachineModel(const std::string &identifier,
+ std::string *type,
+ int32_t *major,
+ int32_t *minor);
+bool CMDeviceIDToDeviceAndVendorID(const std::string &id, uint32_t *vendorId, uint32_t *deviceId);
+
+// Use a heuristic to attempt to find the GPU used for 3D graphics. Sets activeGPUIndex,
+// isOptimus, and isAMDSwitchable. Deprecated: also sets primaryGPUIndex.
+void FindActiveGPU(SystemInfo *info);
+
+} // namespace angle
+
+#endif // GPU_INFO_UTIL_SYSTEM_INFO_INTERNAL_H_
diff --git a/gfx/angle/checkout/src/gpu_info_util/SystemInfo_win.cpp b/gfx/angle/checkout/src/gpu_info_util/SystemInfo_win.cpp
new file mode 100644
index 0000000000..b19f9b7403
--- /dev/null
+++ b/gfx/angle/checkout/src/gpu_info_util/SystemInfo_win.cpp
@@ -0,0 +1,105 @@
+//
+// Copyright (c) 2013-2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SystemInfo_win.cpp: implementation of the Windows-specific parts of SystemInfo.h
+
+#include "gpu_info_util/SystemInfo_internal.h"
+
+#include "common/debug.h"
+#include "common/string_utils.h"
+
+// Windows.h needs to be included first
+#include <windows.h>
+
+#include <d3d10.h>
+#include <dxgi.h>
+
+#include <array>
+#include <sstream>
+
+namespace angle
+{
+
+namespace
+{
+
+bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices)
+{
+ IDXGIFactory *factory;
+ if (!SUCCEEDED(CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void **>(&factory))))
+ {
+ return false;
+ }
+
+ UINT i = 0;
+ IDXGIAdapter *adapter = nullptr;
+ while (factory->EnumAdapters(i++, &adapter) != DXGI_ERROR_NOT_FOUND)
+ {
+ DXGI_ADAPTER_DESC desc;
+ adapter->GetDesc(&desc);
+
+ LARGE_INTEGER umdVersion;
+ if (adapter->CheckInterfaceSupport(__uuidof(ID3D10Device), &umdVersion) ==
+ DXGI_ERROR_UNSUPPORTED)
+ {
+ adapter->Release();
+ continue;
+ }
+
+ // The UMD driver version here is the same as in the registry except for the last number.
+ uint64_t intVersion = umdVersion.QuadPart;
+ std::ostringstream o;
+
+ const uint64_t kMask = 0xFF;
+ o << ((intVersion >> 48) & kMask) << ".";
+ o << ((intVersion >> 32) & kMask) << ".";
+ o << ((intVersion >> 16) & kMask) << ".";
+ o << (intVersion & kMask);
+
+ GPUDeviceInfo device;
+ device.vendorId = desc.VendorId;
+ device.deviceId = desc.DeviceId;
+ device.driverVersion = o.str();
+
+ devices->push_back(device);
+
+ adapter->Release();
+ }
+
+ factory->Release();
+
+ return (i > 0);
+}
+
+} // anonymous namespace
+
+bool GetSystemInfo(SystemInfo *info)
+{
+ if (!GetDevicesFromDXGI(&info->gpus))
+ {
+ return false;
+ }
+
+ if (info->gpus.size() == 0)
+ {
+ return false;
+ }
+
+ // Call FindActiveGPU to populate activeGPUIndex, isOptimus, and isAMDSwitchable.
+ FindActiveGPU(info);
+
+ // Override activeGPUIndex. The first index returned by EnumAdapters is the active GPU. We
+ // can override the heuristic to find the active GPU
+ info->activeGPUIndex = 0;
+
+ // Override isOptimus. nvd3d9wrap.dll is loaded into all processes when Optimus is enabled.
+ HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll");
+ info->isOptimus = nvd3d9wrap != nullptr;
+
+ return true;
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/image_util/copyimage.cpp b/gfx/angle/checkout/src/image_util/copyimage.cpp
new file mode 100644
index 0000000000..cc07908158
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/copyimage.cpp
@@ -0,0 +1,22 @@
+//
+// 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 "image_util/copyimage.h"
+
+namespace angle
+{
+
+void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest)
+{
+ uint32_t argb = *reinterpret_cast<const uint32_t *>(source);
+ *reinterpret_cast<uint32_t *>(dest) = (argb & 0xFF00FF00) | // Keep alpha and green
+ (argb & 0x00FF0000) >> 16 | // Move red to blue
+ (argb & 0x000000FF) << 16; // Move blue to red
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/image_util/copyimage.h b/gfx/angle/checkout/src/image_util/copyimage.h
new file mode 100644
index 0000000000..3076640177
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/copyimage.h
@@ -0,0 +1,39 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// copyimage.h: Defines image copying functions
+
+#ifndef IMAGEUTIL_COPYIMAGE_H_
+#define IMAGEUTIL_COPYIMAGE_H_
+
+#include "common/Color.h"
+
+#include "image_util/imageformats.h"
+
+#include <stdint.h>
+
+namespace angle
+{
+
+template <typename sourceType, typename colorDataType>
+void ReadColor(const uint8_t *source, uint8_t *dest);
+
+template <typename destType, typename colorDataType>
+void WriteColor(const uint8_t *source, uint8_t *dest);
+
+template <typename SourceType>
+void ReadDepthStencil(const uint8_t *source, uint8_t *dest);
+
+template <typename DestType>
+void WriteDepthStencil(const uint8_t *source, uint8_t *dest);
+
+void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest);
+
+} // namespace angle
+
+#include "copyimage.inc"
+
+#endif // IMAGEUTIL_COPYIMAGE_H_
diff --git a/gfx/angle/checkout/src/image_util/copyimage.inc b/gfx/angle/checkout/src/image_util/copyimage.inc
new file mode 100644
index 0000000000..dac0db6652
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/copyimage.inc
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// copyimage.inc: Defines image copying functions
+
+namespace angle
+{
+template <typename sourceType, typename colorDataType>
+void ReadColor(const uint8_t *source, uint8_t *dest)
+{
+ sourceType::readColor(reinterpret_cast<Color<colorDataType>*>(dest),
+ reinterpret_cast<const sourceType*>(source));
+}
+
+template <typename destType, typename colorDataType>
+void WriteColor(const uint8_t *source, uint8_t *dest)
+{
+ destType::writeColor(reinterpret_cast<destType*>(dest),
+ reinterpret_cast<const Color<colorDataType>*>(source));
+}
+
+template <typename SourceType>
+void ReadDepthStencil(const uint8_t *source, uint8_t *dest)
+{
+ SourceType::ReadDepthStencil(reinterpret_cast<DepthStencil *>(dest),
+ reinterpret_cast<const SourceType *>(source));
+}
+
+template <typename DestType>
+void WriteDepthStencil(const uint8_t *source, uint8_t *dest)
+{
+ DestType::WriteDepthStencil(reinterpret_cast<DestType *>(dest),
+ reinterpret_cast<const DepthStencil *>(source));
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/image_util/generatemip.h b/gfx/angle/checkout/src/image_util/generatemip.h
new file mode 100644
index 0000000000..e89559df95
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/generatemip.h
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// generatemip.h: Defines the GenerateMip function, templated on the format
+// type of the image for which mip levels are being generated.
+
+#ifndef IMAGEUTIL_GENERATEMIP_H_
+#define IMAGEUTIL_GENERATEMIP_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace angle
+{
+
+template <typename T>
+inline void GenerateMip(size_t sourceWidth,
+ size_t sourceHeight,
+ size_t sourceDepth,
+ const uint8_t *sourceData,
+ size_t sourceRowPitch,
+ size_t sourceDepthPitch,
+ uint8_t *destData,
+ size_t destRowPitch,
+ size_t destDepthPitch);
+
+} // namespace angle
+
+#include "generatemip.inc"
+
+#endif // IMAGEUTIL_GENERATEMIP_H_
diff --git a/gfx/angle/checkout/src/image_util/generatemip.inc b/gfx/angle/checkout/src/image_util/generatemip.inc
new file mode 100644
index 0000000000..7d977795d5
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/generatemip.inc
@@ -0,0 +1,268 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// generatemip.inc: Defines the GenerateMip function, templated on the format
+// type of the image for which mip levels are being generated.
+
+#include "common/mathutil.h"
+
+#include "image_util/imageformats.h"
+
+namespace angle
+{
+
+namespace priv
+{
+
+template <typename T>
+static inline T *GetPixel(uint8_t *data, size_t x, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+ return reinterpret_cast<T*>(data + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
+
+template <typename T>
+static inline const T *GetPixel(const uint8_t *data, size_t x, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+ return reinterpret_cast<const T*>(data + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
+
+template <typename T>
+static void GenerateMip_Y(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth == 1);
+
+ for (size_t y = 0; y < destHeight; y++)
+ {
+ 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);
+ }
+}
+
+template <typename T>
+static void GenerateMip_X(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth == 1);
+
+ for (size_t x = 0; x < destWidth; x++)
+ {
+ 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);
+ }
+}
+
+template <typename T>
+static void GenerateMip_Z(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth > 1);
+
+ for (size_t z = 0; z < destDepth; z++)
+ {
+ 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);
+ }
+}
+
+template <typename T>
+static void GenerateMip_XY(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth == 1);
+
+ for (size_t y = 0; y < destHeight; y++)
+ {
+ for (size_t 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);
+
+ T tmp0, tmp1;
+
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
+ }
+}
+
+template <typename T>
+static void GenerateMip_YZ(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ ASSERT(sourceWidth == 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth > 1);
+
+ for (size_t z = 0; z < destDepth; z++)
+ {
+ for (size_t 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);
+
+ T tmp0, tmp1;
+
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
+ }
+}
+
+template <typename T>
+static void GenerateMip_XZ(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight == 1);
+ ASSERT(sourceDepth > 1);
+
+ for (size_t z = 0; z < destDepth; z++)
+ {
+ for (size_t 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);
+
+ T tmp0, tmp1;
+
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(dst, &tmp0, &tmp1);
+ }
+ }
+}
+
+template <typename T>
+static void GenerateMip_XYZ(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ ASSERT(sourceWidth > 1);
+ ASSERT(sourceHeight > 1);
+ ASSERT(sourceDepth > 1);
+
+ for (size_t z = 0; z < destDepth; z++)
+ {
+ for (size_t y = 0; y < destHeight; y++)
+ {
+ for (size_t 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);
+
+ T tmp0, tmp1, tmp2, tmp3, tmp4, tmp5;
+
+ T::average(&tmp0, src0, src1);
+ T::average(&tmp1, src2, src3);
+ T::average(&tmp2, src4, src5);
+ T::average(&tmp3, src6, src7);
+
+ T::average(&tmp4, &tmp0, &tmp1);
+ T::average(&tmp5, &tmp2, &tmp3);
+
+ T::average(dst, &tmp4, &tmp5);
+ }
+ }
+ }
+}
+
+
+typedef void (*MipGenerationFunction)(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ size_t destWidth, size_t destHeight, size_t destDepth,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch);
+
+template <typename T>
+static MipGenerationFunction GetMipGenerationFunction(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth)
+{
+ uint8_t index = ((sourceWidth > 1) ? 1 : 0) |
+ ((sourceHeight > 1) ? 2 : 0) |
+ ((sourceDepth > 1) ? 4 : 0);
+
+ switch (index)
+ {
+ case 0: return nullptr;
+ 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
+ }
+
+ UNREACHABLE();
+ return nullptr;
+}
+
+} // namespace priv
+
+template <typename T>
+inline void GenerateMip(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+ const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+ uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+ size_t mipWidth = std::max<size_t>(1, sourceWidth >> 1);
+ size_t mipHeight = std::max<size_t>(1, sourceHeight >> 1);
+ size_t mipDepth = std::max<size_t>(1, sourceDepth >> 1);
+
+ priv::MipGenerationFunction generationFunction = priv::GetMipGenerationFunction<T>(sourceWidth, sourceHeight, sourceDepth);
+ ASSERT(generationFunction != nullptr);
+
+ generationFunction(sourceWidth, sourceHeight, sourceDepth, sourceData, sourceRowPitch, sourceDepthPitch,
+ mipWidth, mipHeight, mipDepth, destData, destRowPitch, destDepthPitch);
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/image_util/imageformats.cpp b/gfx/angle/checkout/src/image_util/imageformats.cpp
new file mode 100644
index 0000000000..c33c485342
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/imageformats.cpp
@@ -0,0 +1,1835 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// imageformats.cpp: Defines image format types with functions for mip generation
+// and copying.
+
+#include "image_util/imageformats.h"
+
+#include "common/mathutil.h"
+
+namespace angle
+{
+
+void L8::readColor(gl::ColorF *dst, const L8 *src)
+{
+ const float lum = gl::normalizedToFloat(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = 1.0f;
+}
+
+void L8::writeColor(L8 *dst, const gl::ColorF *src)
+{
+ dst->L = gl::floatToNormalized<uint8_t>(src->red);
+}
+
+void L8::average(L8 *dst, const L8 *src1, const L8 *src2)
+{
+ dst->L = gl::average(src1->L, src2->L);
+}
+
+void R8::readColor(gl::ColorUI *dst, const R8 *src)
+{
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R8::readColor(gl::ColorF *dst, const R8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R8::writeColor(R8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+}
+
+void R8::writeColor(R8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+}
+
+void R8::average(R8 *dst, const R8 *src1, const R8 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+}
+
+void A8::readColor(gl::ColorF *dst, const A8 *src)
+{
+ dst->red = 0.0f;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void A8::writeColor(A8 *dst, const gl::ColorF *src)
+{
+ dst->A = gl::floatToNormalized<uint8_t>(src->alpha);
+}
+
+void A8::average(A8 *dst, const A8 *src1, const A8 *src2)
+{
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void L8A8::readColor(gl::ColorF *dst, const L8A8 *src)
+{
+ const float lum = gl::normalizedToFloat(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void L8A8::writeColor(L8A8 *dst, const gl::ColorF *src)
+{
+ dst->L = gl::floatToNormalized<uint8_t>(src->red);
+ dst->A = gl::floatToNormalized<uint8_t>(src->alpha);
+}
+
+void L8A8::average(L8A8 *dst, const L8A8 *src1, const L8A8 *src2)
+{
+ *(uint16_t *)dst = (((*(uint16_t *)src1 ^ *(uint16_t *)src2) & 0xFEFE) >> 1) +
+ (*(uint16_t *)src1 & *(uint16_t *)src2);
+}
+
+void A8L8::readColor(gl::ColorF *dst, const A8L8 *src)
+{
+ const float lum = gl::normalizedToFloat(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void A8L8::writeColor(A8L8 *dst, const gl::ColorF *src)
+{
+ dst->L = gl::floatToNormalized<uint8_t>(src->red);
+ dst->A = gl::floatToNormalized<uint8_t>(src->alpha);
+}
+
+void A8L8::average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2)
+{
+ *(uint16_t *)dst = (((*(uint16_t *)src1 ^ *(uint16_t *)src2) & 0xFEFE) >> 1) +
+ (*(uint16_t *)src1 & *(uint16_t *)src2);
+}
+
+void R8G8::readColor(gl::ColorUI *dst, const R8G8 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R8G8::readColor(gl::ColorF *dst, const R8G8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R8G8::writeColor(R8G8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+ dst->G = static_cast<uint8_t>(src->green);
+}
+
+void R8G8::writeColor(R8G8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+}
+
+void R8G8::average(R8G8 *dst, const R8G8 *src1, const R8G8 *src2)
+{
+ *(uint16_t *)dst = (((*(uint16_t *)src1 ^ *(uint16_t *)src2) & 0xFEFE) >> 1) +
+ (*(uint16_t *)src1 & *(uint16_t *)src2);
+}
+
+void R8G8B8::readColor(gl::ColorUI *dst, const R8G8B8 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->G;
+ dst->alpha = 1;
+}
+
+void R8G8B8::readColor(gl::ColorF *dst, const R8G8B8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R8G8B8::writeColor(R8G8B8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+ dst->G = static_cast<uint8_t>(src->green);
+ dst->B = static_cast<uint8_t>(src->blue);
+}
+
+void R8G8B8::writeColor(R8G8B8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+ dst->B = gl::floatToNormalized<uint8_t>(src->blue);
+}
+
+void R8G8B8::average(R8G8B8 *dst, const R8G8B8 *src1, const R8G8B8 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+}
+
+void B8G8R8::readColor(gl::ColorUI *dst, const B8G8R8 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->G;
+ dst->alpha = 1;
+}
+
+void B8G8R8::readColor(gl::ColorF *dst, const B8G8R8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void B8G8R8::writeColor(B8G8R8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+ dst->G = static_cast<uint8_t>(src->green);
+ dst->B = static_cast<uint8_t>(src->blue);
+}
+
+void B8G8R8::writeColor(B8G8R8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+ dst->B = gl::floatToNormalized<uint8_t>(src->blue);
+}
+
+void B8G8R8::average(B8G8R8 *dst, const B8G8R8 *src1, const B8G8R8 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+}
+
+void R5G6B5::readColor(gl::ColorF *dst, const R5G6B5 *src)
+{
+ dst->red = gl::normalizedToFloat<5>(gl::getShiftedData<5, 11>(src->RGB));
+ dst->green = gl::normalizedToFloat<6>(gl::getShiftedData<6, 5>(src->RGB));
+ dst->blue = gl::normalizedToFloat<5>(gl::getShiftedData<5, 0>(src->RGB));
+ dst->alpha = 1.0f;
+}
+
+void R5G6B5::writeColor(R5G6B5 *dst, const gl::ColorF *src)
+{
+ dst->RGB = gl::shiftData<5, 11>(gl::floatToNormalized<5, uint16_t>(src->red)) |
+ gl::shiftData<6, 5>(gl::floatToNormalized<6, uint16_t>(src->green)) |
+ gl::shiftData<5, 0>(gl::floatToNormalized<5, uint16_t>(src->blue));
+}
+
+void R5G6B5::average(R5G6B5 *dst, const R5G6B5 *src1, const R5G6B5 *src2)
+{
+ dst->RGB = gl::shiftData<5, 11>(gl::average(gl::getShiftedData<5, 11>(src1->RGB),
+ gl::getShiftedData<5, 11>(src2->RGB))) |
+ gl::shiftData<6, 5>(gl::average(gl::getShiftedData<6, 5>(src1->RGB),
+ gl::getShiftedData<6, 5>(src2->RGB))) |
+ gl::shiftData<5, 0>(gl::average(gl::getShiftedData<5, 0>(src1->RGB),
+ gl::getShiftedData<5, 0>(src2->RGB)));
+}
+
+void B5G6R5::readColor(gl::ColorF *dst, const B5G6R5 *src)
+{
+ dst->red = gl::normalizedToFloat<5>(gl::getShiftedData<5, 11>(src->BGR));
+ dst->green = gl::normalizedToFloat<6>(gl::getShiftedData<6, 5>(src->BGR));
+ dst->blue = gl::normalizedToFloat<5>(gl::getShiftedData<5, 0>(src->BGR));
+ dst->alpha = 1.0f;
+}
+
+void B5G6R5::writeColor(B5G6R5 *dst, const gl::ColorF *src)
+{
+ dst->BGR = gl::shiftData<5, 0>(gl::floatToNormalized<5, unsigned short>(src->blue)) |
+ gl::shiftData<6, 5>(gl::floatToNormalized<6, unsigned short>(src->green)) |
+ gl::shiftData<5, 11>(gl::floatToNormalized<5, unsigned short>(src->red));
+}
+
+void B5G6R5::average(B5G6R5 *dst, const B5G6R5 *src1, const B5G6R5 *src2)
+{
+ dst->BGR = gl::shiftData<5, 11>(gl::average(gl::getShiftedData<5, 11>(src1->BGR),
+ gl::getShiftedData<5, 11>(src2->BGR))) |
+ gl::shiftData<6, 5>(gl::average(gl::getShiftedData<6, 5>(src1->BGR),
+ gl::getShiftedData<6, 5>(src2->BGR))) |
+ gl::shiftData<5, 0>(gl::average(gl::getShiftedData<5, 0>(src1->BGR),
+ gl::getShiftedData<5, 0>(src2->BGR)));
+}
+
+void A8R8G8B8::readColor(gl::ColorUI *dst, const A8R8G8B8 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void A8R8G8B8::readColor(gl::ColorF *dst, const A8R8G8B8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void A8R8G8B8::writeColor(A8R8G8B8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+ dst->G = static_cast<uint8_t>(src->green);
+ dst->B = static_cast<uint8_t>(src->blue);
+ dst->A = static_cast<uint8_t>(src->alpha);
+}
+
+void A8R8G8B8::writeColor(A8R8G8B8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+ dst->B = gl::floatToNormalized<uint8_t>(src->blue);
+ dst->A = gl::floatToNormalized<uint8_t>(src->alpha);
+}
+
+void A8R8G8B8::average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2)
+{
+ *(uint32_t *)dst = (((*(uint32_t *)src1 ^ *(uint32_t *)src2) & 0xFEFEFEFE) >> 1) +
+ (*(uint32_t *)src1 & *(uint32_t *)src2);
+}
+
+void R8G8B8A8::readColor(gl::ColorUI *dst, const R8G8B8A8 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R8G8B8A8::readColor(gl::ColorF *dst, const R8G8B8A8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void R8G8B8A8::writeColor(R8G8B8A8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+ dst->G = static_cast<uint8_t>(src->green);
+ dst->B = static_cast<uint8_t>(src->blue);
+ dst->A = static_cast<uint8_t>(src->alpha);
+}
+
+void R8G8B8A8::writeColor(R8G8B8A8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+ dst->B = gl::floatToNormalized<uint8_t>(src->blue);
+ dst->A = gl::floatToNormalized<uint8_t>(src->alpha);
+}
+
+void R8G8B8A8::average(R8G8B8A8 *dst, const R8G8B8A8 *src1, const R8G8B8A8 *src2)
+{
+ *(uint32_t *)dst = (((*(uint32_t *)src1 ^ *(uint32_t *)src2) & 0xFEFEFEFE) >> 1) +
+ (*(uint32_t *)src1 & *(uint32_t *)src2);
+}
+
+void R8G8B8A8SRGB::readColor(gl::ColorF *dst, const R8G8B8A8SRGB *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void R8G8B8A8SRGB::writeColor(R8G8B8A8SRGB *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+ dst->B = gl::floatToNormalized<uint8_t>(src->blue);
+ dst->A = gl::floatToNormalized<uint8_t>(src->alpha);
+}
+
+void R8G8B8A8SRGB::average(R8G8B8A8SRGB *dst, const R8G8B8A8SRGB *src1, const R8G8B8A8SRGB *src2)
+{
+ dst->R =
+ gl::linearToSRGB(static_cast<uint8_t>((static_cast<uint16_t>(gl::sRGBToLinear(src1->R)) +
+ static_cast<uint16_t>(gl::sRGBToLinear(src2->R))) >>
+ 1));
+ dst->G =
+ gl::linearToSRGB(static_cast<uint8_t>((static_cast<uint16_t>(gl::sRGBToLinear(src1->G)) +
+ static_cast<uint16_t>(gl::sRGBToLinear(src2->G))) >>
+ 1));
+ dst->B =
+ gl::linearToSRGB(static_cast<uint8_t>((static_cast<uint16_t>(gl::sRGBToLinear(src1->B)) +
+ static_cast<uint16_t>(gl::sRGBToLinear(src2->B))) >>
+ 1));
+ dst->A = static_cast<uint8_t>(
+ (static_cast<uint16_t>(src1->A) + static_cast<uint16_t>(src2->A)) >> 1);
+}
+
+void B8G8R8A8::readColor(gl::ColorUI *dst, const B8G8R8A8 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void B8G8R8A8::readColor(gl::ColorF *dst, const B8G8R8A8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void B8G8R8A8::writeColor(B8G8R8A8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+ dst->G = static_cast<uint8_t>(src->green);
+ dst->B = static_cast<uint8_t>(src->blue);
+ dst->A = static_cast<uint8_t>(src->alpha);
+}
+
+void B8G8R8A8::writeColor(B8G8R8A8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+ dst->B = gl::floatToNormalized<uint8_t>(src->blue);
+ dst->A = gl::floatToNormalized<uint8_t>(src->alpha);
+}
+
+void B8G8R8A8::average(B8G8R8A8 *dst, const B8G8R8A8 *src1, const B8G8R8A8 *src2)
+{
+ *(uint32_t *)dst = (((*(uint32_t *)src1 ^ *(uint32_t *)src2) & 0xFEFEFEFE) >> 1) +
+ (*(uint32_t *)src1 & *(uint32_t *)src2);
+}
+
+void B8G8R8X8::readColor(gl::ColorUI *dst, const B8G8R8X8 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+}
+
+void B8G8R8X8::readColor(gl::ColorF *dst, const B8G8R8X8 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void B8G8R8X8::writeColor(B8G8R8X8 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint8_t>(src->red);
+ dst->G = static_cast<uint8_t>(src->green);
+ dst->B = static_cast<uint8_t>(src->blue);
+ dst->X = 255;
+}
+
+void B8G8R8X8::writeColor(B8G8R8X8 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint8_t>(src->red);
+ dst->G = gl::floatToNormalized<uint8_t>(src->green);
+ dst->B = gl::floatToNormalized<uint8_t>(src->blue);
+ dst->X = 255;
+}
+
+void B8G8R8X8::average(B8G8R8X8 *dst, const B8G8R8X8 *src1, const B8G8R8X8 *src2)
+{
+ *(uint32_t *)dst = (((*(uint32_t *)src1 ^ *(uint32_t *)src2) & 0xFEFEFEFE) >> 1) +
+ (*(uint32_t *)src1 & *(uint32_t *)src2);
+ dst->X = 255;
+}
+
+void A1R5G5B5::readColor(gl::ColorF *dst, const A1R5G5B5 *src)
+{
+ dst->alpha = gl::normalizedToFloat<1>(gl::getShiftedData<1, 15>(src->ARGB));
+ dst->red = gl::normalizedToFloat<5>(gl::getShiftedData<5, 10>(src->ARGB));
+ dst->green = gl::normalizedToFloat<5>(gl::getShiftedData<5, 5>(src->ARGB));
+ dst->blue = gl::normalizedToFloat<5>(gl::getShiftedData<5, 0>(src->ARGB));
+}
+
+void A1R5G5B5::writeColor(A1R5G5B5 *dst, const gl::ColorF *src)
+{
+ dst->ARGB = gl::shiftData<1, 15>(gl::floatToNormalized<1, uint16_t>(src->alpha)) |
+ gl::shiftData<5, 10>(gl::floatToNormalized<5, uint16_t>(src->red)) |
+ gl::shiftData<5, 5>(gl::floatToNormalized<5, uint16_t>(src->green)) |
+ gl::shiftData<5, 0>(gl::floatToNormalized<5, uint16_t>(src->blue));
+}
+
+void A1R5G5B5::average(A1R5G5B5 *dst, const A1R5G5B5 *src1, const A1R5G5B5 *src2)
+{
+ dst->ARGB = gl::shiftData<1, 15>(gl::average(gl::getShiftedData<1, 15>(src1->ARGB),
+ gl::getShiftedData<1, 15>(src2->ARGB))) |
+ gl::shiftData<5, 10>(gl::average(gl::getShiftedData<5, 10>(src1->ARGB),
+ gl::getShiftedData<5, 10>(src2->ARGB))) |
+ gl::shiftData<5, 5>(gl::average(gl::getShiftedData<5, 5>(src1->ARGB),
+ gl::getShiftedData<5, 5>(src2->ARGB))) |
+ gl::shiftData<5, 0>(gl::average(gl::getShiftedData<5, 0>(src1->ARGB),
+ gl::getShiftedData<5, 0>(src2->ARGB)));
+}
+
+void R5G5B5A1::readColor(gl::ColorF *dst, const R5G5B5A1 *src)
+{
+ dst->red = gl::normalizedToFloat<5>(gl::getShiftedData<5, 11>(src->RGBA));
+ dst->green = gl::normalizedToFloat<5>(gl::getShiftedData<5, 6>(src->RGBA));
+ dst->blue = gl::normalizedToFloat<5>(gl::getShiftedData<5, 1>(src->RGBA));
+ dst->alpha = gl::normalizedToFloat<1>(gl::getShiftedData<1, 0>(src->RGBA));
+}
+
+void R5G5B5A1::writeColor(R5G5B5A1 *dst, const gl::ColorF *src)
+{
+ dst->RGBA = gl::shiftData<5, 11>(gl::floatToNormalized<5, uint16_t>(src->red)) |
+ gl::shiftData<5, 6>(gl::floatToNormalized<5, uint16_t>(src->green)) |
+ gl::shiftData<5, 1>(gl::floatToNormalized<5, uint16_t>(src->blue)) |
+ gl::shiftData<1, 0>(gl::floatToNormalized<1, uint16_t>(src->alpha));
+}
+
+void R5G5B5A1::average(R5G5B5A1 *dst, const R5G5B5A1 *src1, const R5G5B5A1 *src2)
+{
+ dst->RGBA = gl::shiftData<5, 11>(gl::average(gl::getShiftedData<5, 11>(src1->RGBA),
+ gl::getShiftedData<5, 11>(src2->RGBA))) |
+ gl::shiftData<5, 6>(gl::average(gl::getShiftedData<5, 6>(src1->RGBA),
+ gl::getShiftedData<5, 6>(src2->RGBA))) |
+ gl::shiftData<5, 1>(gl::average(gl::getShiftedData<5, 1>(src1->RGBA),
+ gl::getShiftedData<5, 1>(src2->RGBA))) |
+ gl::shiftData<1, 0>(gl::average(gl::getShiftedData<1, 0>(src1->RGBA),
+ gl::getShiftedData<1, 0>(src2->RGBA)));
+}
+
+void R4G4B4A4::readColor(gl::ColorF *dst, const R4G4B4A4 *src)
+{
+ dst->red = gl::normalizedToFloat<4>(gl::getShiftedData<4, 12>(src->RGBA));
+ dst->green = gl::normalizedToFloat<4>(gl::getShiftedData<4, 8>(src->RGBA));
+ dst->blue = gl::normalizedToFloat<4>(gl::getShiftedData<4, 4>(src->RGBA));
+ dst->alpha = gl::normalizedToFloat<4>(gl::getShiftedData<4, 0>(src->RGBA));
+}
+
+void R4G4B4A4::writeColor(R4G4B4A4 *dst, const gl::ColorF *src)
+{
+ dst->RGBA = gl::shiftData<4, 12>(gl::floatToNormalized<4, uint16_t>(src->red)) |
+ gl::shiftData<4, 8>(gl::floatToNormalized<4, uint16_t>(src->green)) |
+ gl::shiftData<4, 4>(gl::floatToNormalized<4, uint16_t>(src->blue)) |
+ gl::shiftData<4, 0>(gl::floatToNormalized<4, uint16_t>(src->alpha));
+}
+
+void R4G4B4A4::average(R4G4B4A4 *dst, const R4G4B4A4 *src1, const R4G4B4A4 *src2)
+{
+ dst->RGBA = gl::shiftData<4, 12>(gl::average(gl::getShiftedData<4, 12>(src1->RGBA),
+ gl::getShiftedData<4, 12>(src2->RGBA))) |
+ gl::shiftData<4, 8>(gl::average(gl::getShiftedData<4, 8>(src1->RGBA),
+ gl::getShiftedData<4, 8>(src2->RGBA))) |
+ gl::shiftData<4, 4>(gl::average(gl::getShiftedData<4, 4>(src1->RGBA),
+ gl::getShiftedData<4, 4>(src2->RGBA))) |
+ gl::shiftData<4, 0>(gl::average(gl::getShiftedData<4, 0>(src1->RGBA),
+ gl::getShiftedData<4, 0>(src2->RGBA)));
+}
+
+void A4R4G4B4::readColor(gl::ColorF *dst, const A4R4G4B4 *src)
+{
+ dst->alpha = gl::normalizedToFloat<4>(gl::getShiftedData<4, 12>(src->ARGB));
+ dst->red = gl::normalizedToFloat<4>(gl::getShiftedData<4, 8>(src->ARGB));
+ dst->green = gl::normalizedToFloat<4>(gl::getShiftedData<4, 4>(src->ARGB));
+ dst->blue = gl::normalizedToFloat<4>(gl::getShiftedData<4, 0>(src->ARGB));
+}
+
+void A4R4G4B4::writeColor(A4R4G4B4 *dst, const gl::ColorF *src)
+{
+ dst->ARGB = gl::shiftData<4, 12>(gl::floatToNormalized<4, uint16_t>(src->alpha)) |
+ gl::shiftData<4, 8>(gl::floatToNormalized<4, uint16_t>(src->red)) |
+ gl::shiftData<4, 4>(gl::floatToNormalized<4, uint16_t>(src->green)) |
+ gl::shiftData<4, 0>(gl::floatToNormalized<4, uint16_t>(src->blue));
+}
+
+void A4R4G4B4::average(A4R4G4B4 *dst, const A4R4G4B4 *src1, const A4R4G4B4 *src2)
+{
+ dst->ARGB = gl::shiftData<4, 12>(gl::average(gl::getShiftedData<4, 12>(src1->ARGB),
+ gl::getShiftedData<4, 12>(src2->ARGB))) |
+ gl::shiftData<4, 8>(gl::average(gl::getShiftedData<4, 8>(src1->ARGB),
+ gl::getShiftedData<4, 8>(src2->ARGB))) |
+ gl::shiftData<4, 4>(gl::average(gl::getShiftedData<4, 4>(src1->ARGB),
+ gl::getShiftedData<4, 4>(src2->ARGB))) |
+ gl::shiftData<4, 0>(gl::average(gl::getShiftedData<4, 0>(src1->ARGB),
+ gl::getShiftedData<4, 0>(src2->ARGB)));
+}
+
+void R16::readColor(gl::ColorUI *dst, const R16 *src)
+{
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R16::readColor(gl::ColorF *dst, const R16 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R16::writeColor(R16 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint16_t>(src->red);
+}
+
+void R16::writeColor(R16 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint16_t>(src->red);
+}
+
+void R16::average(R16 *dst, const R16 *src1, const R16 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+}
+
+void R16G16::readColor(gl::ColorUI *dst, const R16G16 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R16G16::readColor(gl::ColorF *dst, const R16G16 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R16G16::writeColor(R16G16 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint16_t>(src->red);
+ dst->G = static_cast<uint16_t>(src->green);
+}
+
+void R16G16::writeColor(R16G16 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint16_t>(src->red);
+ dst->G = gl::floatToNormalized<uint16_t>(src->green);
+}
+
+void R16G16::average(R16G16 *dst, const R16G16 *src1, const R16G16 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+}
+
+void R16G16B16::readColor(gl::ColorUI *dst, const R16G16B16 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+}
+
+void R16G16B16::readColor(gl::ColorF *dst, const R16G16B16 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R16G16B16::writeColor(R16G16B16 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint16_t>(src->red);
+ dst->G = static_cast<uint16_t>(src->green);
+ dst->B = static_cast<uint16_t>(src->blue);
+}
+
+void R16G16B16::writeColor(R16G16B16 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint16_t>(src->red);
+ dst->G = gl::floatToNormalized<uint16_t>(src->green);
+ dst->B = gl::floatToNormalized<uint16_t>(src->blue);
+}
+
+void R16G16B16::average(R16G16B16 *dst, const R16G16B16 *src1, const R16G16B16 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+}
+
+void R16G16B16A16::readColor(gl::ColorUI *dst, const R16G16B16A16 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R16G16B16A16::readColor(gl::ColorF *dst, const R16G16B16A16 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void R16G16B16A16::writeColor(R16G16B16A16 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint16_t>(src->red);
+ dst->G = static_cast<uint16_t>(src->green);
+ dst->B = static_cast<uint16_t>(src->blue);
+ dst->A = static_cast<uint16_t>(src->alpha);
+}
+
+void R16G16B16A16::writeColor(R16G16B16A16 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint16_t>(src->red);
+ dst->G = gl::floatToNormalized<uint16_t>(src->green);
+ dst->B = gl::floatToNormalized<uint16_t>(src->blue);
+ dst->A = gl::floatToNormalized<uint16_t>(src->alpha);
+}
+
+void R16G16B16A16::average(R16G16B16A16 *dst, const R16G16B16A16 *src1, const R16G16B16A16 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R32::readColor(gl::ColorUI *dst, const R32 *src)
+{
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R32::readColor(gl::ColorF *dst, const R32 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R32::writeColor(R32 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint32_t>(src->red);
+}
+
+void R32::writeColor(R32 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint32_t>(src->red);
+}
+
+void R32::average(R32 *dst, const R32 *src1, const R32 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+}
+
+void R32G32::readColor(gl::ColorUI *dst, const R32G32 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R32G32::readColor(gl::ColorF *dst, const R32G32 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R32G32::writeColor(R32G32 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint32_t>(src->red);
+ dst->G = static_cast<uint32_t>(src->green);
+}
+
+void R32G32::writeColor(R32G32 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint32_t>(src->red);
+ dst->G = gl::floatToNormalized<uint32_t>(src->green);
+}
+
+void R32G32::average(R32G32 *dst, const R32G32 *src1, const R32G32 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+}
+
+void R32G32B32::readColor(gl::ColorUI *dst, const R32G32B32 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+}
+
+void R32G32B32::readColor(gl::ColorF *dst, const R32G32B32 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R32G32B32::writeColor(R32G32B32 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint32_t>(src->red);
+ dst->G = static_cast<uint32_t>(src->green);
+ dst->B = static_cast<uint32_t>(src->blue);
+}
+
+void R32G32B32::writeColor(R32G32B32 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint32_t>(src->red);
+ dst->G = gl::floatToNormalized<uint32_t>(src->green);
+ dst->B = gl::floatToNormalized<uint32_t>(src->blue);
+}
+
+void R32G32B32::average(R32G32B32 *dst, const R32G32B32 *src1, const R32G32B32 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+}
+
+void R32G32B32A32::readColor(gl::ColorUI *dst, const R32G32B32A32 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R32G32B32A32::readColor(gl::ColorF *dst, const R32G32B32A32 *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void R32G32B32A32::writeColor(R32G32B32A32 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint32_t>(src->red);
+ dst->G = static_cast<uint32_t>(src->green);
+ dst->B = static_cast<uint32_t>(src->blue);
+ dst->A = static_cast<uint32_t>(src->alpha);
+}
+
+void R32G32B32A32::writeColor(R32G32B32A32 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<uint32_t>(src->red);
+ dst->G = gl::floatToNormalized<uint32_t>(src->green);
+ dst->B = gl::floatToNormalized<uint32_t>(src->blue);
+ dst->A = gl::floatToNormalized<uint32_t>(src->alpha);
+}
+
+void R32G32B32A32::average(R32G32B32A32 *dst, const R32G32B32A32 *src1, const R32G32B32A32 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R8S::readColor(gl::ColorI *dst, const R8S *src)
+{
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R8S::readColor(gl::ColorF *dst, const R8S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R8S::writeColor(R8S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int8_t>(src->red);
+}
+
+void R8S::writeColor(R8S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int8_t>(src->red);
+}
+
+void R8S::average(R8S *dst, const R8S *src1, const R8S *src2)
+{
+ dst->R = static_cast<int8_t>(gl::average(src1->R, src2->R));
+}
+
+void R8G8S::readColor(gl::ColorI *dst, const R8G8S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R8G8S::readColor(gl::ColorF *dst, const R8G8S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R8G8S::writeColor(R8G8S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int8_t>(src->red);
+ dst->G = static_cast<int8_t>(src->green);
+}
+
+void R8G8S::writeColor(R8G8S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int8_t>(src->red);
+ dst->G = gl::floatToNormalized<int8_t>(src->green);
+}
+
+void R8G8S::average(R8G8S *dst, const R8G8S *src1, const R8G8S *src2)
+{
+ dst->R = static_cast<int8_t>(gl::average(src1->R, src2->R));
+ dst->G = static_cast<int8_t>(gl::average(src1->G, src2->G));
+}
+
+void R8G8B8S::readColor(gl::ColorI *dst, const R8G8B8S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+}
+
+void R8G8B8S::readColor(gl::ColorF *dst, const R8G8B8S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R8G8B8S::writeColor(R8G8B8S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int8_t>(src->red);
+ dst->G = static_cast<int8_t>(src->green);
+ dst->B = static_cast<int8_t>(src->blue);
+}
+
+void R8G8B8S::writeColor(R8G8B8S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int8_t>(src->red);
+ dst->G = gl::floatToNormalized<int8_t>(src->green);
+ dst->B = gl::floatToNormalized<int8_t>(src->blue);
+}
+
+void R8G8B8S::average(R8G8B8S *dst, const R8G8B8S *src1, const R8G8B8S *src2)
+{
+ dst->R = static_cast<int8_t>(gl::average(src1->R, src2->R));
+ dst->G = static_cast<int8_t>(gl::average(src1->G, src2->G));
+ dst->B = static_cast<int8_t>(gl::average(src1->B, src2->B));
+}
+
+void R8G8B8A8S::readColor(gl::ColorI *dst, const R8G8B8A8S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R8G8B8A8S::readColor(gl::ColorF *dst, const R8G8B8A8S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void R8G8B8A8S::writeColor(R8G8B8A8S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int8_t>(src->red);
+ dst->G = static_cast<int8_t>(src->green);
+ dst->B = static_cast<int8_t>(src->blue);
+ dst->A = static_cast<int8_t>(src->alpha);
+}
+
+void R8G8B8A8S::writeColor(R8G8B8A8S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int8_t>(src->red);
+ dst->G = gl::floatToNormalized<int8_t>(src->green);
+ dst->B = gl::floatToNormalized<int8_t>(src->blue);
+ dst->A = gl::floatToNormalized<int8_t>(src->alpha);
+}
+
+void R8G8B8A8S::average(R8G8B8A8S *dst, const R8G8B8A8S *src1, const R8G8B8A8S *src2)
+{
+ dst->R = static_cast<int8_t>(gl::average(src1->R, src2->R));
+ dst->G = static_cast<int8_t>(gl::average(src1->G, src2->G));
+ dst->B = static_cast<int8_t>(gl::average(src1->B, src2->B));
+ dst->A = static_cast<int8_t>(gl::average(src1->A, src2->A));
+}
+
+void R16S::readColor(gl::ColorI *dst, const R16S *src)
+{
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R16S::readColor(gl::ColorF *dst, const R16S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R16S::writeColor(R16S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int16_t>(src->red);
+}
+
+void R16S::writeColor(R16S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int16_t>(src->red);
+}
+
+void R16S::average(R16S *dst, const R16S *src1, const R16S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+}
+
+void R16G16S::readColor(gl::ColorI *dst, const R16G16S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R16G16S::readColor(gl::ColorF *dst, const R16G16S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R16G16S::writeColor(R16G16S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int16_t>(src->red);
+ dst->G = static_cast<int16_t>(src->green);
+}
+
+void R16G16S::writeColor(R16G16S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int16_t>(src->red);
+ dst->G = gl::floatToNormalized<int16_t>(src->green);
+}
+
+void R16G16S::average(R16G16S *dst, const R16G16S *src1, const R16G16S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+}
+
+void R16G16B16S::readColor(gl::ColorI *dst, const R16G16B16S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+}
+
+void R16G16B16S::readColor(gl::ColorF *dst, const R16G16B16S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R16G16B16S::writeColor(R16G16B16S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int16_t>(src->red);
+ dst->G = static_cast<int16_t>(src->green);
+ dst->B = static_cast<int16_t>(src->blue);
+}
+
+void R16G16B16S::writeColor(R16G16B16S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int16_t>(src->red);
+ dst->G = gl::floatToNormalized<int16_t>(src->green);
+ dst->B = gl::floatToNormalized<int16_t>(src->blue);
+}
+
+void R16G16B16S::average(R16G16B16S *dst, const R16G16B16S *src1, const R16G16B16S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+}
+
+void R16G16B16A16S::readColor(gl::ColorI *dst, const R16G16B16A16S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R16G16B16A16S::readColor(gl::ColorF *dst, const R16G16B16A16S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void R16G16B16A16S::writeColor(R16G16B16A16S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int16_t>(src->red);
+ dst->G = static_cast<int16_t>(src->green);
+ dst->B = static_cast<int16_t>(src->blue);
+ dst->A = static_cast<int16_t>(src->alpha);
+}
+
+void R16G16B16A16S::writeColor(R16G16B16A16S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int16_t>(src->red);
+ dst->G = gl::floatToNormalized<int16_t>(src->green);
+ dst->B = gl::floatToNormalized<int16_t>(src->blue);
+ dst->A = gl::floatToNormalized<int16_t>(src->alpha);
+}
+
+void R16G16B16A16S::average(R16G16B16A16S *dst,
+ const R16G16B16A16S *src1,
+ const R16G16B16A16S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R32S::readColor(gl::ColorI *dst, const R32S *src)
+{
+ dst->red = src->R;
+ dst->green = 0;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R32S::readColor(gl::ColorF *dst, const R32S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R32S::writeColor(R32S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int32_t>(src->red);
+}
+
+void R32S::writeColor(R32S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int32_t>(src->red);
+}
+
+void R32S::average(R32S *dst, const R32S *src1, const R32S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+}
+
+void R32G32S::readColor(gl::ColorI *dst, const R32G32S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0;
+ dst->alpha = 1;
+}
+
+void R32G32S::readColor(gl::ColorF *dst, const R32G32S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R32G32S::writeColor(R32G32S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int32_t>(src->red);
+ dst->G = static_cast<int32_t>(src->green);
+}
+
+void R32G32S::writeColor(R32G32S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int32_t>(src->red);
+ dst->G = gl::floatToNormalized<int32_t>(src->green);
+}
+
+void R32G32S::average(R32G32S *dst, const R32G32S *src1, const R32G32S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+}
+
+void R32G32B32S::readColor(gl::ColorI *dst, const R32G32B32S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1;
+}
+
+void R32G32B32S::readColor(gl::ColorF *dst, const R32G32B32S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R32G32B32S::writeColor(R32G32B32S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int32_t>(src->red);
+ dst->G = static_cast<int32_t>(src->green);
+ dst->B = static_cast<int32_t>(src->blue);
+}
+
+void R32G32B32S::writeColor(R32G32B32S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int32_t>(src->red);
+ dst->G = gl::floatToNormalized<int32_t>(src->green);
+ dst->B = gl::floatToNormalized<int32_t>(src->blue);
+}
+
+void R32G32B32S::average(R32G32B32S *dst, const R32G32B32S *src1, const R32G32B32S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+}
+
+void R32G32B32A32S::readColor(gl::ColorI *dst, const R32G32B32A32S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R32G32B32A32S::readColor(gl::ColorF *dst, const R32G32B32A32S *src)
+{
+ dst->red = gl::normalizedToFloat(src->R);
+ dst->green = gl::normalizedToFloat(src->G);
+ dst->blue = gl::normalizedToFloat(src->B);
+ dst->alpha = gl::normalizedToFloat(src->A);
+}
+
+void R32G32B32A32S::writeColor(R32G32B32A32S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int32_t>(src->red);
+ dst->G = static_cast<int32_t>(src->green);
+ dst->B = static_cast<int32_t>(src->blue);
+ dst->A = static_cast<int32_t>(src->alpha);
+}
+
+void R32G32B32A32S::writeColor(R32G32B32A32S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<int32_t>(src->red);
+ dst->G = gl::floatToNormalized<int32_t>(src->green);
+ dst->B = gl::floatToNormalized<int32_t>(src->blue);
+ dst->A = gl::floatToNormalized<int32_t>(src->alpha);
+}
+
+void R32G32B32A32S::average(R32G32B32A32S *dst,
+ const R32G32B32A32S *src1,
+ const R32G32B32A32S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void A16B16G16R16F::readColor(gl::ColorF *dst, const A16B16G16R16F *src)
+{
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = gl::float16ToFloat32(src->B);
+ dst->alpha = gl::float16ToFloat32(src->A);
+}
+
+void A16B16G16R16F::writeColor(A16B16G16R16F *dst, const gl::ColorF *src)
+{
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+ dst->B = gl::float32ToFloat16(src->blue);
+ dst->A = gl::float32ToFloat16(src->alpha);
+}
+
+void A16B16G16R16F::average(A16B16G16R16F *dst,
+ const A16B16G16R16F *src1,
+ const A16B16G16R16F *src2)
+{
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+ dst->B = gl::averageHalfFloat(src1->B, src2->B);
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+}
+
+void R16G16B16A16F::readColor(gl::ColorF *dst, const R16G16B16A16F *src)
+{
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = gl::float16ToFloat32(src->B);
+ dst->alpha = gl::float16ToFloat32(src->A);
+}
+
+void R16G16B16A16F::writeColor(R16G16B16A16F *dst, const gl::ColorF *src)
+{
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+ dst->B = gl::float32ToFloat16(src->blue);
+ dst->A = gl::float32ToFloat16(src->alpha);
+}
+
+void R16G16B16A16F::average(R16G16B16A16F *dst,
+ const R16G16B16A16F *src1,
+ const R16G16B16A16F *src2)
+{
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+ dst->B = gl::averageHalfFloat(src1->B, src2->B);
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+}
+
+void R16F::readColor(gl::ColorF *dst, const R16F *src)
+{
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R16F::writeColor(R16F *dst, const gl::ColorF *src)
+{
+ dst->R = gl::float32ToFloat16(src->red);
+}
+
+void R16F::average(R16F *dst, const R16F *src1, const R16F *src2)
+{
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+}
+
+void A16F::readColor(gl::ColorF *dst, const A16F *src)
+{
+ dst->red = 0.0f;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = gl::float16ToFloat32(src->A);
+}
+
+void A16F::writeColor(A16F *dst, const gl::ColorF *src)
+{
+ dst->A = gl::float32ToFloat16(src->alpha);
+}
+
+void A16F::average(A16F *dst, const A16F *src1, const A16F *src2)
+{
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+}
+
+void L16F::readColor(gl::ColorF *dst, const L16F *src)
+{
+ float lum = gl::float16ToFloat32(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = 1.0f;
+}
+
+void L16F::writeColor(L16F *dst, const gl::ColorF *src)
+{
+ dst->L = gl::float32ToFloat16(src->red);
+}
+
+void L16F::average(L16F *dst, const L16F *src1, const L16F *src2)
+{
+ dst->L = gl::averageHalfFloat(src1->L, src2->L);
+}
+
+void L16A16F::readColor(gl::ColorF *dst, const L16A16F *src)
+{
+ float lum = gl::float16ToFloat32(src->L);
+ dst->red = lum;
+ dst->green = lum;
+ dst->blue = lum;
+ dst->alpha = gl::float16ToFloat32(src->A);
+}
+
+void L16A16F::writeColor(L16A16F *dst, const gl::ColorF *src)
+{
+ dst->L = gl::float32ToFloat16(src->red);
+ dst->A = gl::float32ToFloat16(src->alpha);
+}
+
+void L16A16F::average(L16A16F *dst, const L16A16F *src1, const L16A16F *src2)
+{
+ dst->L = gl::averageHalfFloat(src1->L, src2->L);
+ dst->A = gl::averageHalfFloat(src1->A, src2->A);
+}
+
+void R16G16F::readColor(gl::ColorF *dst, const R16G16F *src)
+{
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R16G16F::writeColor(R16G16F *dst, const gl::ColorF *src)
+{
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+}
+
+void R16G16F::average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2)
+{
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+}
+
+void R16G16B16F::readColor(gl::ColorF *dst, const R16G16B16F *src)
+{
+ dst->red = gl::float16ToFloat32(src->R);
+ dst->green = gl::float16ToFloat32(src->G);
+ dst->blue = gl::float16ToFloat32(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R16G16B16F::writeColor(R16G16B16F *dst, const gl::ColorF *src)
+{
+ dst->R = gl::float32ToFloat16(src->red);
+ dst->G = gl::float32ToFloat16(src->green);
+ dst->B = gl::float32ToFloat16(src->blue);
+}
+
+void R16G16B16F::average(R16G16B16F *dst, const R16G16B16F *src1, const R16G16B16F *src2)
+{
+ dst->R = gl::averageHalfFloat(src1->R, src2->R);
+ dst->G = gl::averageHalfFloat(src1->G, src2->G);
+ dst->B = gl::averageHalfFloat(src1->B, src2->B);
+}
+
+void A32B32G32R32F::readColor(gl::ColorF *dst, const A32B32G32R32F *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void A32B32G32R32F::writeColor(A32B32G32R32F *dst, const gl::ColorF *src)
+{
+ dst->R = src->red;
+ dst->G = src->green;
+ dst->B = src->blue;
+ dst->A = src->alpha;
+}
+
+void A32B32G32R32F::average(A32B32G32R32F *dst,
+ const A32B32G32R32F *src1,
+ const A32B32G32R32F *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R32G32B32A32F::readColor(gl::ColorF *dst, const R32G32B32A32F *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R32G32B32A32F::writeColor(R32G32B32A32F *dst, const gl::ColorF *src)
+{
+ dst->R = src->red;
+ dst->G = src->green;
+ dst->B = src->blue;
+ dst->A = src->alpha;
+}
+
+void R32G32B32A32F::average(R32G32B32A32F *dst,
+ const R32G32B32A32F *src1,
+ const R32G32B32A32F *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R32F::readColor(gl::ColorF *dst, const R32F *src)
+{
+ dst->red = src->R;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R32F::writeColor(R32F *dst, const gl::ColorF *src)
+{
+ dst->R = src->red;
+}
+
+void R32F::average(R32F *dst, const R32F *src1, const R32F *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+}
+
+void A32F::readColor(gl::ColorF *dst, const A32F *src)
+{
+ dst->red = 0.0f;
+ dst->green = 0.0f;
+ dst->blue = 0.0f;
+ dst->alpha = src->A;
+}
+
+void A32F::writeColor(A32F *dst, const gl::ColorF *src)
+{
+ dst->A = src->alpha;
+}
+
+void A32F::average(A32F *dst, const A32F *src1, const A32F *src2)
+{
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void L32F::readColor(gl::ColorF *dst, const L32F *src)
+{
+ dst->red = src->L;
+ dst->green = src->L;
+ dst->blue = src->L;
+ dst->alpha = 1.0f;
+}
+
+void L32F::writeColor(L32F *dst, const gl::ColorF *src)
+{
+ dst->L = src->red;
+}
+
+void L32F::average(L32F *dst, const L32F *src1, const L32F *src2)
+{
+ dst->L = gl::average(src1->L, src2->L);
+}
+
+void L32A32F::readColor(gl::ColorF *dst, const L32A32F *src)
+{
+ dst->red = src->L;
+ dst->green = src->L;
+ dst->blue = src->L;
+ dst->alpha = src->A;
+}
+
+void L32A32F::writeColor(L32A32F *dst, const gl::ColorF *src)
+{
+ dst->L = src->red;
+ dst->A = src->alpha;
+}
+
+void L32A32F::average(L32A32F *dst, const L32A32F *src1, const L32A32F *src2)
+{
+ dst->L = gl::average(src1->L, src2->L);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R32G32F::readColor(gl::ColorF *dst, const R32G32F *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = 0.0f;
+ dst->alpha = 1.0f;
+}
+
+void R32G32F::writeColor(R32G32F *dst, const gl::ColorF *src)
+{
+ dst->R = src->red;
+ dst->G = src->green;
+}
+
+void R32G32F::average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+}
+
+void R32G32B32F::readColor(gl::ColorF *dst, const R32G32B32F *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = 1.0f;
+}
+
+void R32G32B32F::writeColor(R32G32B32F *dst, const gl::ColorF *src)
+{
+ dst->R = src->red;
+ dst->G = src->green;
+ dst->B = src->blue;
+}
+
+void R32G32B32F::average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+}
+
+void R10G10B10A2::readColor(gl::ColorUI *dst, const R10G10B10A2 *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R10G10B10A2::readColor(gl::ColorF *dst, const R10G10B10A2 *src)
+{
+ dst->red = gl::normalizedToFloat<10>(src->R);
+ dst->green = gl::normalizedToFloat<10>(src->G);
+ dst->blue = gl::normalizedToFloat<10>(src->B);
+ dst->alpha = gl::normalizedToFloat<2>(src->A);
+}
+
+void R10G10B10A2::writeColor(R10G10B10A2 *dst, const gl::ColorUI *src)
+{
+ dst->R = static_cast<uint32_t>(src->red);
+ dst->G = static_cast<uint32_t>(src->green);
+ dst->B = static_cast<uint32_t>(src->blue);
+ dst->A = static_cast<uint32_t>(src->alpha);
+}
+
+void R10G10B10A2::writeColor(R10G10B10A2 *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<10, uint32_t>(src->red);
+ dst->G = gl::floatToNormalized<10, uint32_t>(src->green);
+ dst->B = gl::floatToNormalized<10, uint32_t>(src->blue);
+ dst->A = gl::floatToNormalized<2, uint32_t>(src->alpha);
+}
+
+void R10G10B10A2::average(R10G10B10A2 *dst, const R10G10B10A2 *src1, const R10G10B10A2 *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R10G10B10A2S::readColor(gl::ColorI *dst, const R10G10B10A2S *src)
+{
+ dst->red = src->R;
+ dst->green = src->G;
+ dst->blue = src->B;
+ dst->alpha = src->A;
+}
+
+void R10G10B10A2S::readColor(gl::ColorF *dst, const R10G10B10A2S *src)
+{
+ dst->red = gl::normalizedToFloat<10>(src->R);
+ dst->green = gl::normalizedToFloat<10>(src->G);
+ dst->blue = gl::normalizedToFloat<10>(src->B);
+ dst->alpha = gl::normalizedToFloat<2>(src->A);
+}
+
+void R10G10B10A2S::writeColor(R10G10B10A2S *dst, const gl::ColorI *src)
+{
+ dst->R = static_cast<int32_t>(src->red);
+ dst->G = static_cast<int32_t>(src->green);
+ dst->B = static_cast<int32_t>(src->blue);
+ dst->A = static_cast<int32_t>(src->alpha);
+}
+
+void R10G10B10A2S::writeColor(R10G10B10A2S *dst, const gl::ColorF *src)
+{
+ dst->R = gl::floatToNormalized<10, int32_t>(src->red);
+ dst->G = gl::floatToNormalized<10, int32_t>(src->green);
+ dst->B = gl::floatToNormalized<10, int32_t>(src->blue);
+ dst->A = gl::floatToNormalized<2, int32_t>(src->alpha);
+}
+
+void R10G10B10A2S::average(R10G10B10A2S *dst, const R10G10B10A2S *src1, const R10G10B10A2S *src2)
+{
+ dst->R = gl::average(src1->R, src2->R);
+ dst->G = gl::average(src1->G, src2->G);
+ dst->B = gl::average(src1->B, src2->B);
+ dst->A = gl::average(src1->A, src2->A);
+}
+
+void R9G9B9E5::readColor(gl::ColorF *dst, const R9G9B9E5 *src)
+{
+ gl::convert999E5toRGBFloats(gl::bitCast<uint32_t>(*src), &dst->red, &dst->green, &dst->blue);
+ dst->alpha = 1.0f;
+}
+
+void R9G9B9E5::writeColor(R9G9B9E5 *dst, const gl::ColorF *src)
+{
+ *reinterpret_cast<uint32_t *>(dst) =
+ gl::convertRGBFloatsTo999E5(src->red, src->green, src->blue);
+}
+
+void R9G9B9E5::average(R9G9B9E5 *dst, const R9G9B9E5 *src1, const R9G9B9E5 *src2)
+{
+ float r1, g1, b1;
+ gl::convert999E5toRGBFloats(*reinterpret_cast<const uint32_t *>(src1), &r1, &g1, &b1);
+
+ float r2, g2, b2;
+ gl::convert999E5toRGBFloats(*reinterpret_cast<const uint32_t *>(src2), &r2, &g2, &b2);
+
+ *reinterpret_cast<uint32_t *>(dst) =
+ gl::convertRGBFloatsTo999E5(gl::average(r1, r2), gl::average(g1, g2), gl::average(b1, b2));
+}
+
+void R11G11B10F::readColor(gl::ColorF *dst, const R11G11B10F *src)
+{
+ dst->red = gl::float11ToFloat32(src->R);
+ dst->green = gl::float11ToFloat32(src->G);
+ dst->blue = gl::float10ToFloat32(src->B);
+ dst->alpha = 1.0f;
+}
+
+void R11G11B10F::writeColor(R11G11B10F *dst, const gl::ColorF *src)
+{
+ dst->R = gl::float32ToFloat11(src->red);
+ dst->G = gl::float32ToFloat11(src->green);
+ dst->B = gl::float32ToFloat10(src->blue);
+}
+
+void R11G11B10F::average(R11G11B10F *dst, const R11G11B10F *src1, const R11G11B10F *src2)
+{
+ dst->R = gl::averageFloat11(src1->R, src2->R);
+ dst->G = gl::averageFloat11(src1->G, src2->G);
+ dst->B = gl::averageFloat10(src1->B, src2->B);
+}
+
+void D24S8::ReadDepthStencil(DepthStencil *dst, const D24S8 *src)
+{
+ dst->depth = gl::normalizedToFloat<24>(src->D);
+ dst->stencil = gl::getShiftedData<8, 24>(src->S);
+}
+
+void D24S8::WriteDepthStencil(D24S8 *dst, const DepthStencil *src)
+{
+ dst->D = gl::floatToNormalized<24, uint32_t>(static_cast<float>(src->depth));
+ dst->S = src->stencil & 0xFF;
+}
+
+void S8::ReadDepthStencil(DepthStencil *dst, const S8 *src)
+{
+ UNIMPLEMENTED();
+}
+
+void S8::WriteDepthStencil(S8 *dst, const DepthStencil *src)
+{
+ UNIMPLEMENTED();
+}
+
+void D16::ReadDepthStencil(DepthStencil *dst, const D16 *src)
+{
+ UNIMPLEMENTED();
+}
+
+void D16::WriteDepthStencil(D16 *dst, const DepthStencil *src)
+{
+ UNIMPLEMENTED();
+}
+
+void D24::ReadDepthStencil(DepthStencil *dst, const D24 *src)
+{
+ dst->depth = gl::normalizedToFloat<24>(src->D);
+}
+
+void D24::WriteDepthStencil(D24 *dst, const DepthStencil *src)
+{
+ UNIMPLEMENTED();
+}
+
+void D32F::ReadDepthStencil(DepthStencil *dst, const D32F *src)
+{
+ dst->depth = src->D;
+}
+
+void D32F::WriteDepthStencil(D32F *dst, const DepthStencil *src)
+{
+ UNIMPLEMENTED();
+}
+
+void D32::ReadDepthStencil(DepthStencil *dst, const D32 *src)
+{
+ UNIMPLEMENTED();
+}
+
+void D32::WriteDepthStencil(D32 *dst, const DepthStencil *src)
+{
+ UNIMPLEMENTED();
+}
+
+void D32FS8::ReadDepthStencil(DepthStencil *dst, const D32FS8 *src)
+{
+ dst->depth = src->D;
+ dst->stencil = gl::getShiftedData<8, 24>(static_cast<uint32_t>(src->S));
+}
+
+void D32FS8::WriteDepthStencil(D32FS8 *dst, const DepthStencil *src)
+{
+ dst->D = static_cast<float>(src->depth);
+ dst->S = src->stencil & 0xFF;
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/image_util/imageformats.h b/gfx/angle/checkout/src/image_util/imageformats.h
new file mode 100644
index 0000000000..d8dbd0004a
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/imageformats.h
@@ -0,0 +1,772 @@
+//
+// Copyright (c) 2013-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// imageformats.h: Defines image format types with functions for mip generation
+// and copying.
+
+#ifndef IMAGEUTIL_IMAGEFORMATS_H_
+#define IMAGEUTIL_IMAGEFORMATS_H_
+
+#include "common/Color.h"
+
+#include <cstdint>
+
+namespace angle
+{
+
+// Several structures share functionality for reading, writing or mipmapping but the layout
+// must match the texture format which the structure represents. If collapsing or typedefing
+// structs in this header, make sure the functionality and memory layout is exactly the same.
+
+struct L8
+{
+ uint8_t L;
+
+ static void readColor(gl::ColorF *dst, const L8 *src);
+ static void writeColor(L8 *dst, const gl::ColorF *src);
+ static void average(L8 *dst, const L8 *src1, const L8 *src2);
+};
+
+struct R8
+{
+ uint8_t R;
+
+ static void readColor(gl::ColorF *dst, const R8 *src);
+ static void readColor(gl::ColorUI *dst, const R8 *src);
+ static void writeColor(R8 *dst, const gl::ColorF *src);
+ static void writeColor(R8 *dst, const gl::ColorUI *src);
+ static void average(R8 *dst, const R8 *src1, const R8 *src2);
+};
+
+struct A8
+{
+ uint8_t A;
+
+ static void readColor(gl::ColorF *dst, const A8 *src);
+ static void writeColor(A8 *dst, const gl::ColorF *src);
+ static void average(A8 *dst, const A8 *src1, const A8 *src2);
+};
+
+struct L8A8
+{
+ uint8_t L;
+ uint8_t A;
+
+ static void readColor(gl::ColorF *dst, const L8A8 *src);
+ static void writeColor(L8A8 *dst, const gl::ColorF *src);
+ static void average(L8A8 *dst, const L8A8 *src1, const L8A8 *src2);
+};
+
+struct A8L8
+{
+ uint8_t A;
+ uint8_t L;
+
+ static void readColor(gl::ColorF *dst, const A8L8 *src);
+ static void writeColor(A8L8 *dst, const gl::ColorF *src);
+ static void average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2);
+};
+
+struct R8G8
+{
+ uint8_t R;
+ uint8_t G;
+
+ static void readColor(gl::ColorF *dst, const R8G8 *src);
+ static void readColor(gl::ColorUI *dst, const R8G8 *src);
+ static void writeColor(R8G8 *dst, const gl::ColorF *src);
+ static void writeColor(R8G8 *dst, const gl::ColorUI *src);
+ static void average(R8G8 *dst, const R8G8 *src1, const R8G8 *src2);
+};
+
+struct R8G8B8
+{
+ uint8_t R;
+ uint8_t G;
+ uint8_t B;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8 *src);
+ static void readColor(gl::ColorUI *dst, const R8G8B8 *src);
+ static void writeColor(R8G8B8 *dst, const gl::ColorF *src);
+ static void writeColor(R8G8B8 *dst, const gl::ColorUI *src);
+ static void average(R8G8B8 *dst, const R8G8B8 *src1, const R8G8B8 *src2);
+};
+
+struct B8G8R8
+{
+ uint8_t B;
+ uint8_t G;
+ uint8_t R;
+
+ static void readColor(gl::ColorF *dst, const B8G8R8 *src);
+ static void readColor(gl::ColorUI *dst, const B8G8R8 *src);
+ static void writeColor(B8G8R8 *dst, const gl::ColorF *src);
+ static void writeColor(B8G8R8 *dst, const gl::ColorUI *src);
+ static void average(B8G8R8 *dst, const B8G8R8 *src1, const B8G8R8 *src2);
+};
+
+struct R5G6B5
+{
+ // OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the
+ // most significant bits of the bitfield, and successive component occupying progressively less
+ // significant locations"
+ uint16_t RGB;
+
+ static void readColor(gl::ColorF *dst, const R5G6B5 *src);
+ static void writeColor(R5G6B5 *dst, const gl::ColorF *src);
+ static void average(R5G6B5 *dst, const R5G6B5 *src1, const R5G6B5 *src2);
+};
+
+struct B5G6R5
+{
+ uint16_t BGR;
+
+ static void readColor(gl::ColorF *dst, const B5G6R5 *src);
+ static void writeColor(B5G6R5 *dst, const gl::ColorF *src);
+ static void average(B5G6R5 *dst, const B5G6R5 *src1, const B5G6R5 *src2);
+};
+
+struct A8R8G8B8
+{
+ uint8_t A;
+ uint8_t R;
+ uint8_t G;
+ uint8_t B;
+
+ static void readColor(gl::ColorF *dst, const A8R8G8B8 *src);
+ static void readColor(gl::ColorUI *dst, const A8R8G8B8 *src);
+ static void writeColor(A8R8G8B8 *dst, const gl::ColorF *src);
+ static void writeColor(A8R8G8B8 *dst, const gl::ColorUI *src);
+ static void average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2);
+};
+
+struct R8G8B8A8
+{
+ uint8_t R;
+ uint8_t G;
+ uint8_t B;
+ uint8_t A;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8A8 *src);
+ static void readColor(gl::ColorUI *dst, const R8G8B8A8 *src);
+ static void writeColor(R8G8B8A8 *dst, const gl::ColorF *src);
+ static void writeColor(R8G8B8A8 *dst, const gl::ColorUI *src);
+ static void average(R8G8B8A8 *dst, const R8G8B8A8 *src1, const R8G8B8A8 *src2);
+};
+
+struct R8G8B8A8SRGB
+{
+ uint8_t R;
+ uint8_t G;
+ uint8_t B;
+ uint8_t A;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8A8SRGB *src);
+ static void writeColor(R8G8B8A8SRGB *dst, const gl::ColorF *src);
+ static void average(R8G8B8A8SRGB *dst, const R8G8B8A8SRGB *src1, const R8G8B8A8SRGB *src2);
+};
+
+struct B8G8R8A8
+{
+ uint8_t B;
+ uint8_t G;
+ uint8_t R;
+ uint8_t A;
+
+ static void readColor(gl::ColorF *dst, const B8G8R8A8 *src);
+ static void readColor(gl::ColorUI *dst, const B8G8R8A8 *src);
+ static void writeColor(B8G8R8A8 *dst, const gl::ColorF *src);
+ static void writeColor(B8G8R8A8 *dst, const gl::ColorUI *src);
+ static void average(B8G8R8A8 *dst, const B8G8R8A8 *src1, const B8G8R8A8 *src2);
+};
+
+struct B8G8R8X8
+{
+ uint8_t B;
+ uint8_t G;
+ uint8_t R;
+ uint8_t X;
+
+ static void readColor(gl::ColorF *dst, const B8G8R8X8 *src);
+ static void readColor(gl::ColorUI *dst, const B8G8R8X8 *src);
+ static void writeColor(B8G8R8X8 *dst, const gl::ColorF *src);
+ static void writeColor(B8G8R8X8 *dst, const gl::ColorUI *src);
+ static void average(B8G8R8X8 *dst, const B8G8R8X8 *src1, const B8G8R8X8 *src2);
+};
+
+struct A1R5G5B5
+{
+ uint16_t ARGB;
+
+ static void readColor(gl::ColorF *dst, const A1R5G5B5 *src);
+ static void writeColor(A1R5G5B5 *dst, const gl::ColorF *src);
+ static void average(A1R5G5B5 *dst, const A1R5G5B5 *src1, const A1R5G5B5 *src2);
+};
+
+struct R5G5B5A1
+{
+ // OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the
+ // most significant
+ // bits of the bitfield, and successive component occupying progressively less significant
+ // locations"
+ uint16_t RGBA;
+
+ static void readColor(gl::ColorF *dst, const R5G5B5A1 *src);
+ static void writeColor(R5G5B5A1 *dst, const gl::ColorF *src);
+ static void average(R5G5B5A1 *dst, const R5G5B5A1 *src1, const R5G5B5A1 *src2);
+};
+
+struct R4G4B4A4
+{
+ // OpenGL ES 2.0.25 spec Section 3.6.2: "Components are packed with the first component in the
+ // most significant
+ // bits of the bitfield, and successive component occupying progressively less significant
+ // locations"
+ uint16_t RGBA;
+
+ static void readColor(gl::ColorF *dst, const R4G4B4A4 *src);
+ static void writeColor(R4G4B4A4 *dst, const gl::ColorF *src);
+ static void average(R4G4B4A4 *dst, const R4G4B4A4 *src1, const R4G4B4A4 *src2);
+};
+
+struct A4R4G4B4
+{
+ uint16_t ARGB;
+
+ static void readColor(gl::ColorF *dst, const A4R4G4B4 *src);
+ static void writeColor(A4R4G4B4 *dst, const gl::ColorF *src);
+ static void average(A4R4G4B4 *dst, const A4R4G4B4 *src1, const A4R4G4B4 *src2);
+};
+
+struct R16
+{
+ uint16_t R;
+
+ static void readColor(gl::ColorF *dst, const R16 *src);
+ static void readColor(gl::ColorUI *dst, const R16 *src);
+ static void writeColor(R16 *dst, const gl::ColorF *src);
+ static void writeColor(R16 *dst, const gl::ColorUI *src);
+ static void average(R16 *dst, const R16 *src1, const R16 *src2);
+};
+
+struct R16G16
+{
+ uint16_t R;
+ uint16_t G;
+
+ static void readColor(gl::ColorF *dst, const R16G16 *src);
+ static void readColor(gl::ColorUI *dst, const R16G16 *src);
+ static void writeColor(R16G16 *dst, const gl::ColorF *src);
+ static void writeColor(R16G16 *dst, const gl::ColorUI *src);
+ static void average(R16G16 *dst, const R16G16 *src1, const R16G16 *src2);
+};
+
+struct R16G16B16
+{
+ uint16_t R;
+ uint16_t G;
+ uint16_t B;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16 *src);
+ static void readColor(gl::ColorUI *dst, const R16G16B16 *src);
+ static void writeColor(R16G16B16 *dst, const gl::ColorF *src);
+ static void writeColor(R16G16B16 *dst, const gl::ColorUI *src);
+ static void average(R16G16B16 *dst, const R16G16B16 *src1, const R16G16B16 *src2);
+};
+
+struct R16G16B16A16
+{
+ uint16_t R;
+ uint16_t G;
+ uint16_t B;
+ uint16_t A;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16A16 *src);
+ static void readColor(gl::ColorUI *dst, const R16G16B16A16 *src);
+ static void writeColor(R16G16B16A16 *dst, const gl::ColorF *src);
+ static void writeColor(R16G16B16A16 *dst, const gl::ColorUI *src);
+ static void average(R16G16B16A16 *dst, const R16G16B16A16 *src1, const R16G16B16A16 *src2);
+};
+
+struct R32
+{
+ uint32_t R;
+
+ static void readColor(gl::ColorF *dst, const R32 *src);
+ static void readColor(gl::ColorUI *dst, const R32 *src);
+ static void writeColor(R32 *dst, const gl::ColorF *src);
+ static void writeColor(R32 *dst, const gl::ColorUI *src);
+ static void average(R32 *dst, const R32 *src1, const R32 *src2);
+};
+
+struct R32G32
+{
+ uint32_t R;
+ uint32_t G;
+
+ static void readColor(gl::ColorF *dst, const R32G32 *src);
+ static void readColor(gl::ColorUI *dst, const R32G32 *src);
+ static void writeColor(R32G32 *dst, const gl::ColorF *src);
+ static void writeColor(R32G32 *dst, const gl::ColorUI *src);
+ static void average(R32G32 *dst, const R32G32 *src1, const R32G32 *src2);
+};
+
+struct R32G32B32
+{
+ uint32_t R;
+ uint32_t G;
+ uint32_t B;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32 *src);
+ static void readColor(gl::ColorUI *dst, const R32G32B32 *src);
+ static void writeColor(R32G32B32 *dst, const gl::ColorF *src);
+ static void writeColor(R32G32B32 *dst, const gl::ColorUI *src);
+ static void average(R32G32B32 *dst, const R32G32B32 *src1, const R32G32B32 *src2);
+};
+
+struct R32G32B32A32
+{
+ uint32_t R;
+ uint32_t G;
+ uint32_t B;
+ uint32_t A;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32A32 *src);
+ static void readColor(gl::ColorUI *dst, const R32G32B32A32 *src);
+ static void writeColor(R32G32B32A32 *dst, const gl::ColorF *src);
+ static void writeColor(R32G32B32A32 *dst, const gl::ColorUI *src);
+ static void average(R32G32B32A32 *dst, const R32G32B32A32 *src1, const R32G32B32A32 *src2);
+};
+
+struct R8S
+{
+ int8_t R;
+
+ static void readColor(gl::ColorF *dst, const R8S *src);
+ static void readColor(gl::ColorI *dst, const R8S *src);
+ static void writeColor(R8S *dst, const gl::ColorF *src);
+ static void writeColor(R8S *dst, const gl::ColorI *src);
+ static void average(R8S *dst, const R8S *src1, const R8S *src2);
+};
+
+struct R8G8S
+{
+ int8_t R;
+ int8_t G;
+
+ static void readColor(gl::ColorF *dst, const R8G8S *src);
+ static void readColor(gl::ColorI *dst, const R8G8S *src);
+ static void writeColor(R8G8S *dst, const gl::ColorF *src);
+ static void writeColor(R8G8S *dst, const gl::ColorI *src);
+ static void average(R8G8S *dst, const R8G8S *src1, const R8G8S *src2);
+};
+
+struct R8G8B8S
+{
+ int8_t R;
+ int8_t G;
+ int8_t B;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8S *src);
+ static void readColor(gl::ColorI *dst, const R8G8B8S *src);
+ static void writeColor(R8G8B8S *dst, const gl::ColorF *src);
+ static void writeColor(R8G8B8S *dst, const gl::ColorI *src);
+ static void average(R8G8B8S *dst, const R8G8B8S *src1, const R8G8B8S *src2);
+};
+
+struct R8G8B8A8S
+{
+ int8_t R;
+ int8_t G;
+ int8_t B;
+ int8_t A;
+
+ static void readColor(gl::ColorF *dst, const R8G8B8A8S *src);
+ static void readColor(gl::ColorI *dst, const R8G8B8A8S *src);
+ static void writeColor(R8G8B8A8S *dst, const gl::ColorF *src);
+ static void writeColor(R8G8B8A8S *dst, const gl::ColorI *src);
+ static void average(R8G8B8A8S *dst, const R8G8B8A8S *src1, const R8G8B8A8S *src2);
+};
+
+struct R16S
+{
+ int16_t R;
+
+ static void readColor(gl::ColorF *dst, const R16S *src);
+ static void readColor(gl::ColorI *dst, const R16S *src);
+ static void writeColor(R16S *dst, const gl::ColorF *src);
+ static void writeColor(R16S *dst, const gl::ColorI *src);
+ static void average(R16S *dst, const R16S *src1, const R16S *src2);
+};
+
+struct R16G16S
+{
+ int16_t R;
+ int16_t G;
+
+ static void readColor(gl::ColorF *dst, const R16G16S *src);
+ static void readColor(gl::ColorI *dst, const R16G16S *src);
+ static void writeColor(R16G16S *dst, const gl::ColorF *src);
+ static void writeColor(R16G16S *dst, const gl::ColorI *src);
+ static void average(R16G16S *dst, const R16G16S *src1, const R16G16S *src2);
+};
+
+struct R16G16B16S
+{
+ int16_t R;
+ int16_t G;
+ int16_t B;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16S *src);
+ static void readColor(gl::ColorI *dst, const R16G16B16S *src);
+ static void writeColor(R16G16B16S *dst, const gl::ColorF *src);
+ static void writeColor(R16G16B16S *dst, const gl::ColorI *src);
+ static void average(R16G16B16S *dst, const R16G16B16S *src1, const R16G16B16S *src2);
+};
+
+struct R16G16B16A16S
+{
+ int16_t R;
+ int16_t G;
+ int16_t B;
+ int16_t A;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16A16S *src);
+ static void readColor(gl::ColorI *dst, const R16G16B16A16S *src);
+ static void writeColor(R16G16B16A16S *dst, const gl::ColorF *src);
+ static void writeColor(R16G16B16A16S *dst, const gl::ColorI *src);
+ static void average(R16G16B16A16S *dst, const R16G16B16A16S *src1, const R16G16B16A16S *src2);
+};
+
+struct R32S
+{
+ int32_t R;
+
+ static void readColor(gl::ColorF *dst, const R32S *src);
+ static void readColor(gl::ColorI *dst, const R32S *src);
+ static void writeColor(R32S *dst, const gl::ColorF *src);
+ static void writeColor(R32S *dst, const gl::ColorI *src);
+ static void average(R32S *dst, const R32S *src1, const R32S *src2);
+};
+
+struct R32G32S
+{
+ int32_t R;
+ int32_t G;
+
+ static void readColor(gl::ColorF *dst, const R32G32S *src);
+ static void readColor(gl::ColorI *dst, const R32G32S *src);
+ static void writeColor(R32G32S *dst, const gl::ColorF *src);
+ static void writeColor(R32G32S *dst, const gl::ColorI *src);
+ static void average(R32G32S *dst, const R32G32S *src1, const R32G32S *src2);
+};
+
+struct R32G32B32S
+{
+ int32_t R;
+ int32_t G;
+ int32_t B;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32S *src);
+ static void readColor(gl::ColorI *dst, const R32G32B32S *src);
+ static void writeColor(R32G32B32S *dst, const gl::ColorF *src);
+ static void writeColor(R32G32B32S *dst, const gl::ColorI *src);
+ static void average(R32G32B32S *dst, const R32G32B32S *src1, const R32G32B32S *src2);
+};
+
+struct R32G32B32A32S
+{
+ int32_t R;
+ int32_t G;
+ int32_t B;
+ int32_t A;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32A32S *src);
+ static void readColor(gl::ColorI *dst, const R32G32B32A32S *src);
+ static void writeColor(R32G32B32A32S *dst, const gl::ColorF *src);
+ static void writeColor(R32G32B32A32S *dst, const gl::ColorI *src);
+ static void average(R32G32B32A32S *dst, const R32G32B32A32S *src1, const R32G32B32A32S *src2);
+};
+
+struct A16B16G16R16F
+{
+ uint16_t A;
+ uint16_t R;
+ uint16_t G;
+ uint16_t B;
+
+ static void readColor(gl::ColorF *dst, const A16B16G16R16F *src);
+ static void writeColor(A16B16G16R16F *dst, const gl::ColorF *src);
+ static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2);
+};
+
+struct R16G16B16A16F
+{
+ uint16_t R;
+ uint16_t G;
+ uint16_t B;
+ uint16_t A;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16A16F *src);
+ static void writeColor(R16G16B16A16F *dst, const gl::ColorF *src);
+ static void average(R16G16B16A16F *dst, const R16G16B16A16F *src1, const R16G16B16A16F *src2);
+};
+
+struct R16F
+{
+ uint16_t R;
+
+ static void readColor(gl::ColorF *dst, const R16F *src);
+ static void writeColor(R16F *dst, const gl::ColorF *src);
+ static void average(R16F *dst, const R16F *src1, const R16F *src2);
+};
+
+struct A16F
+{
+ uint16_t A;
+
+ static void readColor(gl::ColorF *dst, const A16F *src);
+ static void writeColor(A16F *dst, const gl::ColorF *src);
+ static void average(A16F *dst, const A16F *src1, const A16F *src2);
+};
+
+struct L16F
+{
+ uint16_t L;
+
+ static void readColor(gl::ColorF *dst, const L16F *src);
+ static void writeColor(L16F *dst, const gl::ColorF *src);
+ static void average(L16F *dst, const L16F *src1, const L16F *src2);
+};
+
+struct L16A16F
+{
+ uint16_t L;
+ uint16_t A;
+
+ static void readColor(gl::ColorF *dst, const L16A16F *src);
+ static void writeColor(L16A16F *dst, const gl::ColorF *src);
+ static void average(L16A16F *dst, const L16A16F *src1, const L16A16F *src2);
+};
+
+struct R16G16F
+{
+ uint16_t R;
+ uint16_t G;
+
+ static void readColor(gl::ColorF *dst, const R16G16F *src);
+ static void writeColor(R16G16F *dst, const gl::ColorF *src);
+ static void average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2);
+};
+
+struct R16G16B16F
+{
+ uint16_t R;
+ uint16_t G;
+ uint16_t B;
+
+ static void readColor(gl::ColorF *dst, const R16G16B16F *src);
+ static void writeColor(R16G16B16F *dst, const gl::ColorF *src);
+ static void average(R16G16B16F *dst, const R16G16B16F *src1, const R16G16B16F *src2);
+};
+
+struct A32B32G32R32F
+{
+ float A;
+ float R;
+ float G;
+ float B;
+
+ static void readColor(gl::ColorF *dst, const A32B32G32R32F *src);
+ static void writeColor(A32B32G32R32F *dst, const gl::ColorF *src);
+ static void average(A32B32G32R32F *dst, const A32B32G32R32F *src1, const A32B32G32R32F *src2);
+};
+
+struct R32G32B32A32F
+{
+ float R;
+ float G;
+ float B;
+ float A;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32A32F *src);
+ static void writeColor(R32G32B32A32F *dst, const gl::ColorF *src);
+ static void average(R32G32B32A32F *dst, const R32G32B32A32F *src1, const R32G32B32A32F *src2);
+};
+
+struct R32F
+{
+ float R;
+
+ static void readColor(gl::ColorF *dst, const R32F *src);
+ static void writeColor(R32F *dst, const gl::ColorF *src);
+ static void average(R32F *dst, const R32F *src1, const R32F *src2);
+};
+
+struct A32F
+{
+ float A;
+
+ static void readColor(gl::ColorF *dst, const A32F *src);
+ static void writeColor(A32F *dst, const gl::ColorF *src);
+ static void average(A32F *dst, const A32F *src1, const A32F *src2);
+};
+
+struct L32F
+{
+ float L;
+
+ static void readColor(gl::ColorF *dst, const L32F *src);
+ static void writeColor(L32F *dst, const gl::ColorF *src);
+ static void average(L32F *dst, const L32F *src1, const L32F *src2);
+};
+
+struct L32A32F
+{
+ float L;
+ float A;
+
+ static void readColor(gl::ColorF *dst, const L32A32F *src);
+ static void writeColor(L32A32F *dst, const gl::ColorF *src);
+ static void average(L32A32F *dst, const L32A32F *src1, const L32A32F *src2);
+};
+
+struct R32G32F
+{
+ float R;
+ float G;
+
+ static void readColor(gl::ColorF *dst, const R32G32F *src);
+ static void writeColor(R32G32F *dst, const gl::ColorF *src);
+ static void average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2);
+};
+
+struct R32G32B32F
+{
+ float R;
+ float G;
+ float B;
+
+ static void readColor(gl::ColorF *dst, const R32G32B32F *src);
+ static void writeColor(R32G32B32F *dst, const gl::ColorF *src);
+ static void average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2);
+};
+
+struct R10G10B10A2
+{
+ uint32_t R : 10;
+ uint32_t G : 10;
+ uint32_t B : 10;
+ uint32_t A : 2;
+
+ static void readColor(gl::ColorF *dst, const R10G10B10A2 *src);
+ static void readColor(gl::ColorUI *dst, const R10G10B10A2 *src);
+ static void writeColor(R10G10B10A2 *dst, const gl::ColorF *src);
+ static void writeColor(R10G10B10A2 *dst, const gl::ColorUI *src);
+ static void average(R10G10B10A2 *dst, const R10G10B10A2 *src1, const R10G10B10A2 *src2);
+};
+static_assert(sizeof(R10G10B10A2) == 4, "R10G10B10A2 struct not 32-bits.");
+
+struct R10G10B10A2S
+{
+ int32_t R : 10;
+ int32_t G : 10;
+ int32_t B : 10;
+ int32_t A : 2;
+
+ static void readColor(gl::ColorF *dst, const R10G10B10A2S *src);
+ static void readColor(gl::ColorI *dst, const R10G10B10A2S *src);
+ static void writeColor(R10G10B10A2S *dst, const gl::ColorF *src);
+ static void writeColor(R10G10B10A2S *dst, const gl::ColorI *src);
+ static void average(R10G10B10A2S *dst, const R10G10B10A2S *src1, const R10G10B10A2S *src2);
+};
+static_assert(sizeof(R10G10B10A2S) == 4, "R10G10B10A2S struct not 32-bits.");
+
+struct R9G9B9E5
+{
+ uint32_t R : 9;
+ uint32_t G : 9;
+ uint32_t B : 9;
+ uint32_t E : 5;
+
+ static void readColor(gl::ColorF *dst, const R9G9B9E5 *src);
+ static void writeColor(R9G9B9E5 *dst, const gl::ColorF *src);
+ static void average(R9G9B9E5 *dst, const R9G9B9E5 *src1, const R9G9B9E5 *src2);
+};
+static_assert(sizeof(R9G9B9E5) == 4, "R9G9B9E5 struct not 32-bits.");
+
+struct R11G11B10F
+{
+ uint32_t R : 11;
+ uint32_t G : 11;
+ uint32_t B : 10;
+
+ static void readColor(gl::ColorF *dst, const R11G11B10F *src);
+ static void writeColor(R11G11B10F *dst, const gl::ColorF *src);
+ static void average(R11G11B10F *dst, const R11G11B10F *src1, const R11G11B10F *src2);
+};
+static_assert(sizeof(R11G11B10F) == 4, "R11G11B10F struct not 32-bits.");
+
+struct D24S8
+{
+ uint32_t D : 24;
+ uint32_t S : 8;
+
+ static void ReadDepthStencil(DepthStencil *dst, const D24S8 *src);
+ static void WriteDepthStencil(D24S8 *dst, const DepthStencil *src);
+};
+
+struct S8
+{
+ uint8_t S;
+
+ static void ReadDepthStencil(DepthStencil *dst, const S8 *src);
+ static void WriteDepthStencil(S8 *dst, const DepthStencil *src);
+};
+
+struct D16
+{
+ uint16_t D;
+
+ static void ReadDepthStencil(DepthStencil *dst, const D16 *src);
+ static void WriteDepthStencil(D16 *dst, const DepthStencil *src);
+};
+
+struct D24
+{
+ uint32_t D;
+
+ static void ReadDepthStencil(DepthStencil *dst, const D24 *src);
+ static void WriteDepthStencil(D24 *dst, const DepthStencil *src);
+};
+
+struct D32F
+{
+ float D;
+
+ static void ReadDepthStencil(DepthStencil *dst, const D32F *src);
+ static void WriteDepthStencil(D32F *dst, const DepthStencil *src);
+};
+
+struct D32
+{
+ uint32_t D;
+
+ static void ReadDepthStencil(DepthStencil *dst, const D32 *src);
+ static void WriteDepthStencil(D32 *dst, const DepthStencil *src);
+};
+
+struct D32FS8
+{
+ float D;
+ uint32_t S;
+
+ static void ReadDepthStencil(DepthStencil *dst, const D32FS8 *src);
+ static void WriteDepthStencil(D32FS8 *dst, const DepthStencil *src);
+};
+} // namespace angle
+
+#endif // IMAGEUTIL_IMAGEFORMATS_H_
diff --git a/gfx/angle/checkout/src/image_util/loadimage.cpp b/gfx/angle/checkout/src/image_util/loadimage.cpp
new file mode 100644
index 0000000000..adcd016f9f
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/loadimage.cpp
@@ -0,0 +1,1437 @@
+//
+// Copyright (c) 2013-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// angle_loadimage.cpp: Defines image loading functions.
+
+#include "image_util/loadimage.h"
+
+#include "common/mathutil.h"
+#include "common/platform.h"
+#include "image_util/imageformats.h"
+
+namespace angle
+{
+
+void LoadA8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+#if defined(ANGLE_USE_SSE)
+ if (gl::supportsSSE2())
+ {
+ __m128i zeroWide = _mm_setzero_si128();
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest = priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch,
+ outputDepthPitch);
+
+ size_t x = 0;
+
+ // Make output writes aligned
+ for (; ((reinterpret_cast<intptr_t>(&dest[x]) & 0xF) != 0 && x < width); x++)
+ {
+ dest[x] = static_cast<uint32_t>(source[x]) << 24;
+ }
+
+ for (; x + 7 < width; x += 8)
+ {
+ __m128i sourceData =
+ _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&source[x]));
+ // Interleave each byte to 16bit, make the lower byte to zero
+ sourceData = _mm_unpacklo_epi8(zeroWide, sourceData);
+ // Interleave each 16bit to 32bit, make the lower 16bit to zero
+ __m128i lo = _mm_unpacklo_epi16(zeroWide, sourceData);
+ __m128i hi = _mm_unpackhi_epi16(zeroWide, sourceData);
+
+ _mm_store_si128(reinterpret_cast<__m128i *>(&dest[x]), lo);
+ _mm_store_si128(reinterpret_cast<__m128i *>(&dest[x + 4]), hi);
+ }
+
+ // Handle the remainder
+ for (; x < width; x++)
+ {
+ dest[x] = static_cast<uint32_t>(source[x]) << 24;
+ }
+ }
+ }
+
+ return;
+ }
+#endif
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = static_cast<uint32_t>(source[x]) << 24;
+ }
+ }
+ }
+}
+
+void LoadA8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ // Same as loading to RGBA
+ LoadA8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch);
+}
+
+void LoadA32FToRGBA32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ float *dest =
+ priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0.0f;
+ dest[4 * x + 1] = 0.0f;
+ dest[4 * x + 2] = 0.0f;
+ dest[4 * x + 3] = source[x];
+ }
+ }
+ }
+}
+
+void LoadA16FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t 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 LoadL8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint8_t sourceVal = source[x];
+ dest[4 * x + 0] = sourceVal;
+ dest[4 * x + 1] = sourceVal;
+ dest[4 * x + 2] = sourceVal;
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void LoadL8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ // Same as loading to RGBA
+ LoadL8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch);
+}
+
+void LoadL32FToRGBA32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ float *dest =
+ priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t 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 LoadL16FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t 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] = gl::Float16One;
+ }
+ }
+ }
+}
+
+void LoadLA8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t 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 LoadLA8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ // Same as loading to RGBA
+ LoadLA8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch);
+}
+
+void LoadLA32FToRGBA32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ float *dest =
+ priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t 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 LoadLA16FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t 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 LoadRGB8ToBGR565(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint8_t r8 = source[x * 3 + 0];
+ uint8_t g8 = source[x * 3 + 1];
+ uint8_t b8 = source[x * 3 + 2];
+ auto r5 = static_cast<uint16_t>(r8 >> 3);
+ auto g6 = static_cast<uint16_t>(g8 >> 2);
+ auto b5 = static_cast<uint16_t>(b8 >> 3);
+ dest[x] = (r5 << 11) | (g6 << 5) | b5;
+ }
+ }
+ }
+}
+
+void LoadRGB565ToBGR565(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ // The GL type RGB is packed with with red in the MSB, while the D3D11 type BGR
+ // is packed with red in the LSB
+ auto rgb = source[x];
+ uint16_t r5 = gl::getShiftedData<5, 11>(rgb);
+ uint16_t g6 = gl::getShiftedData<6, 5>(rgb);
+ uint16_t b5 = gl::getShiftedData<5, 0>(rgb);
+ dest[x] = (r5 << 11) | (g6 << 5) | b5;
+ }
+ }
+ }
+}
+
+void LoadRGB8ToBGRX8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t 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 LoadRG8ToBGRX8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0x00;
+ dest[4 * x + 1] = source[x * 2 + 1];
+ dest[4 * x + 2] = source[x * 2 + 0];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void LoadR8ToBGRX8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint8_t *source =
+ priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[4 * x + 0] = 0x00;
+ dest[4 * x + 1] = 0x00;
+ dest[4 * x + 2] = source[x];
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void LoadR5G6B5ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t rgb = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((rgb & 0x001F) << 3) | ((rgb & 0x001F) >> 2));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((rgb & 0x07E0) >> 3) | ((rgb & 0x07E0) >> 9));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((rgb & 0xF800) >> 8) | ((rgb & 0xF800) >> 13));
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void LoadR5G6B5ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t rgb = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((rgb & 0xF800) >> 8) | ((rgb & 0xF800) >> 13));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((rgb & 0x07E0) >> 3) | ((rgb & 0x07E0) >> 9));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((rgb & 0x001F) << 3) | ((rgb & 0x001F) >> 2));
+ dest[4 * x + 3] = 0xFF;
+ }
+ }
+ }
+}
+
+void LoadRGBA8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+#if defined(ANGLE_USE_SSE)
+ if (gl::supportsSSE2())
+ {
+ __m128i brMask = _mm_set1_epi32(0x00ff00ff);
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest = priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch,
+ outputDepthPitch);
+
+ size_t x = 0;
+
+ // Make output writes aligned
+ for (; ((reinterpret_cast<intptr_t>(&dest[x]) & 15) != 0) && x < width; x++)
+ {
+ uint32_t rgba = source[x];
+ dest[x] = (ANGLE_ROTL(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
+ }
+
+ for (; x + 3 < width; x += 4)
+ {
+ __m128i sourceData =
+ _mm_loadu_si128(reinterpret_cast<const __m128i *>(&source[x]));
+ // Mask out g and a, which don't change
+ __m128i gaComponents = _mm_andnot_si128(brMask, sourceData);
+ // Mask out b and r
+ __m128i brComponents = _mm_and_si128(sourceData, brMask);
+ // Swap b and r
+ __m128i brSwapped = _mm_shufflehi_epi16(
+ _mm_shufflelo_epi16(brComponents, _MM_SHUFFLE(2, 3, 0, 1)),
+ _MM_SHUFFLE(2, 3, 0, 1));
+ __m128i result = _mm_or_si128(gaComponents, brSwapped);
+ _mm_store_si128(reinterpret_cast<__m128i *>(&dest[x]), result);
+ }
+
+ // Perform leftover writes
+ for (; x < width; x++)
+ {
+ uint32_t rgba = source[x];
+ dest[x] = (ANGLE_ROTL(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
+ }
+ }
+ }
+
+ return;
+ }
+#endif
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint32_t rgba = source[x];
+ dest[x] = (ANGLE_ROTL(rgba, 16) & 0x00ff00ff) | (rgba & 0xff00ff00);
+ }
+ }
+ }
+}
+
+void LoadRGBA8ToBGRA4(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint32_t rgba8 = source[x];
+ auto r4 = static_cast<uint16_t>((rgba8 & 0x000000FF) >> 4);
+ auto g4 = static_cast<uint16_t>((rgba8 & 0x0000FF00) >> 12);
+ auto b4 = static_cast<uint16_t>((rgba8 & 0x00FF0000) >> 20);
+ auto a4 = static_cast<uint16_t>((rgba8 & 0xFF000000) >> 28);
+ dest[x] = (a4 << 12) | (r4 << 8) | (g4 << 4) | b4;
+ }
+ }
+ }
+}
+
+void LoadRGBA4ToARGB4(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = ANGLE_ROTR16(source[x], 4);
+ }
+ }
+ }
+}
+
+void LoadRGBA4ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t rgba = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12));
+ dest[4 * x + 3] =
+ static_cast<uint8_t>(((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0));
+ }
+ }
+ }
+}
+
+void LoadRGBA4ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t rgba = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4));
+ dest[4 * x + 3] =
+ static_cast<uint8_t>(((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0));
+ }
+ }
+ }
+}
+
+void LoadBGRA4ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t bgra = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((bgra & 0xF000) >> 8) | ((bgra & 0xF000) >> 12));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((bgra & 0x0F00) >> 4) | ((bgra & 0x0F00) >> 8));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((bgra & 0x00F0) << 0) | ((bgra & 0x00F0) >> 4));
+ dest[4 * x + 3] =
+ static_cast<uint8_t>(((bgra & 0x000F) << 4) | ((bgra & 0x000F) >> 0));
+ }
+ }
+ }
+}
+
+void LoadRGBA8ToBGR5A1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint32_t rgba8 = source[x];
+ auto r5 = static_cast<uint16_t>((rgba8 & 0x000000FF) >> 3);
+ auto g5 = static_cast<uint16_t>((rgba8 & 0x0000FF00) >> 11);
+ auto b5 = static_cast<uint16_t>((rgba8 & 0x00FF0000) >> 19);
+ auto a1 = static_cast<uint16_t>((rgba8 & 0xFF000000) >> 31);
+ dest[x] = (a1 << 15) | (r5 << 10) | (g5 << 5) | b5;
+ }
+ }
+ }
+}
+
+void LoadRGB10A2ToBGR5A1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const R10G10B10A2 *source =
+ priv::OffsetDataPointer<R10G10B10A2>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ R10G10B10A2 rgb10a2 = source[x];
+
+ uint16_t r5 = static_cast<uint16_t>(rgb10a2.R >> 5u);
+ uint16_t g5 = static_cast<uint16_t>(rgb10a2.G >> 5u);
+ uint16_t b5 = static_cast<uint16_t>(rgb10a2.B >> 5u);
+ uint16_t a1 = static_cast<uint16_t>(rgb10a2.A >> 1u);
+
+ dest[x] = (a1 << 15) | (r5 << 10) | (g5 << 5) | b5;
+ }
+ }
+ }
+}
+
+void LoadRGB5A1ToA1RGB5(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = ANGLE_ROTR16(source[x], 1);
+ }
+ }
+ }
+}
+
+void LoadRGB5A1ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t rgba = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13));
+ dest[4 * x + 3] = static_cast<uint8_t>((rgba & 0x0001) ? 0xFF : 0);
+ }
+ }
+ }
+}
+
+void LoadRGB5A1ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t rgba = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3));
+ dest[4 * x + 3] = static_cast<uint8_t>((rgba & 0x0001) ? 0xFF : 0);
+ }
+ }
+ }
+}
+
+void LoadBGR5A1ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint16_t bgra = source[x];
+ dest[4 * x + 0] =
+ static_cast<uint8_t>(((bgra & 0xF800) >> 8) | ((bgra & 0xF800) >> 13));
+ dest[4 * x + 1] =
+ static_cast<uint8_t>(((bgra & 0x07C0) >> 3) | ((bgra & 0x07C0) >> 8));
+ dest[4 * x + 2] =
+ static_cast<uint8_t>(((bgra & 0x003E) << 2) | ((bgra & 0x003E) >> 3));
+ dest[4 * x + 3] = static_cast<uint8_t>((bgra & 0x0001) ? 0xFF : 0);
+ }
+ }
+ }
+}
+
+void LoadRGB10A2ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint32_t rgba = source[x];
+ dest[4 * x + 0] = static_cast<uint8_t>((rgba & 0x000003FF) >> 2);
+ dest[4 * x + 1] = static_cast<uint8_t>((rgba & 0x000FFC00) >> 12);
+ dest[4 * x + 2] = static_cast<uint8_t>((rgba & 0x3FF00000) >> 22);
+ dest[4 * x + 3] = static_cast<uint8_t>(((rgba & 0xC0000000) >> 30) * 0x55);
+ }
+ }
+ }
+}
+
+void LoadRGB16FToRGB9E5(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = gl::convertRGBFloatsTo999E5(gl::float16ToFloat32(source[x * 3 + 0]),
+ gl::float16ToFloat32(source[x * 3 + 1]),
+ gl::float16ToFloat32(source[x * 3 + 2]));
+ }
+ }
+ }
+}
+
+void LoadRGB32FToRGB9E5(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = gl::convertRGBFloatsTo999E5(source[x * 3 + 0], source[x * 3 + 1],
+ source[x * 3 + 2]);
+ }
+ }
+ }
+}
+
+void LoadRGB16FToRG11B10F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint16_t *source =
+ priv::OffsetDataPointer<uint16_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = (gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 0])) << 0) |
+ (gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 1])) << 11) |
+ (gl::float32ToFloat10(gl::float16ToFloat32(source[x * 3 + 2])) << 22);
+ }
+ }
+ }
+}
+
+void LoadRGB32FToRG11B10F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = (gl::float32ToFloat11(source[x * 3 + 0]) << 0) |
+ (gl::float32ToFloat11(source[x * 3 + 1]) << 11) |
+ (gl::float32ToFloat10(source[x * 3 + 2]) << 22);
+ }
+ }
+ }
+}
+
+void LoadG8R24ToR24G8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint32_t d = source[x] >> 8;
+ uint8_t s = source[x] & 0xFF;
+ dest[x] = d | (s << 24);
+ }
+ }
+ }
+}
+
+void LoadD24S8ToD32FS8X24(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ float *destDepth =
+ priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ uint32_t *destStencil =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch) +
+ 1;
+ for (size_t x = 0; x < width; x++)
+ {
+ destDepth[x * 2] = (source[x] & 0xFFFFFF) / static_cast<float>(0xFFFFFF);
+ destStencil[x * 2] = source[x] & 0xFF000000;
+ }
+ }
+ }
+}
+
+void LoadD32FToD32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ float *dest =
+ priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = gl::clamp01(source[x]);
+ }
+ }
+ }
+}
+
+void LoadD32FS8X24ToD24S8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *sourceDepth =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ const uint32_t *sourceStencil =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch) + 1;
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ uint32_t d = static_cast<uint32_t>(gl::clamp01(sourceDepth[x * 2]) * 0xFFFFFF);
+ uint32_t s = sourceStencil[x * 2] & 0xFF000000;
+ dest[x] = d | s;
+ }
+ }
+ }
+}
+
+void LoadX24S8ToS8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source = reinterpret_cast<const uint32_t *>(
+ input + (y * inputRowPitch) + (z * inputDepthPitch));
+ uint8_t *destStencil =
+ reinterpret_cast<uint8_t *>(output + (y * outputRowPitch) + (z * outputDepthPitch));
+ for (size_t x = 0; x < width; x++)
+ {
+ destStencil[x] = (source[x] & 0xFF);
+ }
+ }
+ }
+}
+
+void LoadD32FS8X24ToD32FS8X24(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *sourceDepth =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ const uint32_t *sourceStencil =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch) + 1;
+ float *destDepth =
+ priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
+ uint32_t *destStencil =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch) +
+ 1;
+ for (size_t x = 0; x < width; x++)
+ {
+ destDepth[x * 2] = gl::clamp01(sourceDepth[x * 2]);
+ destStencil[x * 2] = sourceStencil[x * 2] & 0xFF000000;
+ }
+ }
+ }
+}
+
+void LoadRGB32FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x * 4 + 0] = gl::float32ToFloat16(source[x * 3 + 0]);
+ dest[x * 4 + 1] = gl::float32ToFloat16(source[x * 3 + 1]);
+ dest[x * 4 + 2] = gl::float32ToFloat16(source[x * 3 + 2]);
+ dest[x * 4 + 3] = gl::Float16One;
+ }
+ }
+ }
+}
+
+void LoadRGB32FToRGB16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source =
+ priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x * 3 + 0] = gl::float32ToFloat16(source[x * 3 + 0]);
+ dest[x * 3 + 1] = gl::float32ToFloat16(source[x * 3 + 1]);
+ dest[x * 3 + 2] = gl::float32ToFloat16(source[x * 3 + 2]);
+ }
+ }
+ }
+}
+
+void LoadR32ToR16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = source[x] >> 16;
+ }
+ }
+ }
+}
+
+void LoadR32ToR24G8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const uint32_t *source =
+ priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint32_t *dest =
+ priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x] = source[x] >> 8;
+ }
+ }
+ }
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/image_util/loadimage.h b/gfx/angle/checkout/src/image_util/loadimage.h
new file mode 100644
index 0000000000..1b997bab72
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/loadimage.h
@@ -0,0 +1,738 @@
+//
+// Copyright (c) 2013-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// loadimage.h: Defines image loading functions
+
+#ifndef IMAGEUTIL_LOADIMAGE_H_
+#define IMAGEUTIL_LOADIMAGE_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+namespace angle
+{
+
+void LoadA8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadA8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadA32FToRGBA32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadA16FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadL8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadL8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadL32FToRGBA32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadL16FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadLA8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadLA8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadLA32FToRGBA32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadLA16FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB8ToBGR565(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB565ToBGR565(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB8ToBGRX8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRG8ToBGRX8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadR8ToBGRX8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadR5G6B5ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadR5G6B5ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGBA8ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGBA8ToBGRA4(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGBA4ToARGB4(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGBA4ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGBA4ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadBGRA4ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGBA8ToBGR5A1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB10A2ToBGR5A1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB5A1ToA1RGB5(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB5A1ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB5A1ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadBGR5A1ToBGRA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB10A2ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB16FToRGB9E5(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB32FToRGB9E5(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB16FToRG11B10F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB32FToRG11B10F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadG8R24ToR24G8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadD24S8ToD32FS8X24(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadD32FToD32F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadD32FS8X24ToD24S8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadX24S8ToS8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadD32FS8X24ToD32FS8X24(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+template <typename type, size_t componentCount>
+inline void LoadToNative(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+template <typename type, uint32_t fourthComponentBits>
+inline void LoadToNative3To4(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+template <size_t componentCount>
+inline void Load32FTo16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB32FToRGBA16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadRGB32FToRGB16F(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+template <size_t blockWidth, size_t blockHeight, size_t blockDepth, size_t blockSize>
+inline void LoadCompressedToNative(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadR32ToR16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+template <typename type,
+ uint32_t firstBits,
+ uint32_t secondBits,
+ uint32_t thirdBits,
+ uint32_t fourthBits>
+inline void Initialize4ComponentData(size_t width,
+ size_t height,
+ size_t depth,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadR32ToR24G8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC1RGB8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC1RGB8ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACR11ToR8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACR11SToR8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACRG11ToRG8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACRG11SToRG8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACR11ToR16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACR11SToR16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACRG11ToRG16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadEACRG11SToRG16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2RGB8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2RGB8ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2SRGB8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2SRGB8ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2RGB8A1ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2RGB8A1ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2SRGB8A1ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2SRGB8A1ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2RGBA8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+void LoadETC2SRGBA8ToSRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+} // namespace angle
+
+#include "loadimage.inc"
+
+#endif // IMAGEUTIL_LOADIMAGE_H_
diff --git a/gfx/angle/checkout/src/image_util/loadimage.inc b/gfx/angle/checkout/src/image_util/loadimage.inc
new file mode 100644
index 0000000000..58886a00a0
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/loadimage.inc
@@ -0,0 +1,164 @@
+//
+// Copyright (c) 2014-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "common/mathutil.h"
+
+#include <string.h>
+
+namespace angle
+{
+
+namespace priv
+{
+
+template <typename T>
+inline T *OffsetDataPointer(uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+ return reinterpret_cast<T*>(data + (y * rowPitch) + (z * depthPitch));
+}
+
+template <typename T>
+inline const T *OffsetDataPointer(const uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+ return reinterpret_cast<const T*>(data + (y * rowPitch) + (z * depthPitch));
+}
+
+} // namespace priv
+
+template <typename type, size_t componentCount>
+inline void LoadToNative(size_t width, size_t height, size_t depth,
+ const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+ uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+ const size_t rowSize = width * sizeof(type) * componentCount;
+ const size_t layerSize = rowSize * height;
+ const size_t imageSize = layerSize * depth;
+
+ if (layerSize == inputDepthPitch && layerSize == outputDepthPitch)
+ {
+ ASSERT(rowSize == inputRowPitch && rowSize == outputRowPitch);
+ memcpy(output, input, imageSize);
+ }
+ else if (rowSize == inputRowPitch && rowSize == outputRowPitch)
+ {
+ for (size_t z = 0; z < depth; z++)
+ {
+ const type *source = priv::OffsetDataPointer<type>(input, 0, z, inputRowPitch, inputDepthPitch);
+ type *dest = priv::OffsetDataPointer<type>(output, 0, z, outputRowPitch, outputDepthPitch);
+
+ memcpy(dest, source, layerSize);
+ }
+ }
+ else
+ {
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const type *source = priv::OffsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
+ type *dest = priv::OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, width * sizeof(type) * componentCount);
+ }
+ }
+ }
+}
+
+template <typename type, uint32_t fourthComponentBits>
+inline void LoadToNative3To4(size_t width, size_t height, size_t depth,
+ const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+ uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+ const type fourthValue = gl::bitCast<type>(fourthComponentBits);
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const type *source = priv::OffsetDataPointer<type>(input, y, z, inputRowPitch, inputDepthPitch);
+ type *dest = priv::OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ dest[x * 4 + 0] = source[x * 3 + 0];
+ dest[x * 4 + 1] = source[x * 3 + 1];
+ dest[x * 4 + 2] = source[x * 3 + 2];
+ dest[x * 4 + 3] = fourthValue;
+ }
+ }
+ }
+}
+
+template <size_t componentCount>
+inline void Load32FTo16F(size_t width, size_t height, size_t depth,
+ const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+ uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+ const size_t elementWidth = componentCount * width;
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ const float *source = priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint16_t *dest = priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < elementWidth; x++)
+ {
+ dest[x] = gl::float32ToFloat16(source[x]);
+ }
+ }
+ }
+}
+
+template <size_t blockWidth, size_t blockHeight, size_t blockDepth, size_t blockSize>
+inline void LoadCompressedToNative(size_t width, size_t height, size_t depth,
+ const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+ uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+ const size_t columns = (width + (blockWidth - 1)) / blockWidth;
+ const size_t rows = (height + (blockHeight - 1)) / blockHeight;
+ const size_t layers = (depth + (blockDepth - 1)) / blockDepth;
+
+ for (size_t z = 0; z < layers; ++z)
+ {
+ for (size_t y = 0; y < rows; ++y)
+ {
+ const uint8_t *source = priv::OffsetDataPointer<uint8_t>(input, y, z, inputRowPitch, inputDepthPitch);
+ uint8_t *dest = priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+ memcpy(dest, source, columns * blockSize);
+ }
+ }
+}
+
+template <typename type, uint32_t firstBits, uint32_t secondBits, uint32_t thirdBits, uint32_t fourthBits>
+inline void Initialize4ComponentData(size_t width, size_t height, size_t depth,
+ uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+ type writeValues[4] =
+ {
+ gl::bitCast<type>(firstBits),
+ gl::bitCast<type>(secondBits),
+ gl::bitCast<type>(thirdBits),
+ gl::bitCast<type>(fourthBits),
+ };
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ type *destRow = priv::OffsetDataPointer<type>(output, y, z, outputRowPitch, outputDepthPitch);
+ for (size_t x = 0; x < width; x++)
+ {
+ type* destPixel = destRow + x * 4;
+
+ // This could potentially be optimized by generating an entire row of initialization
+ // data and copying row by row instead of pixel by pixel.
+ memcpy(destPixel, writeValues, sizeof(type) * 4);
+ }
+ }
+ }
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/image_util/loadimage_etc.cpp b/gfx/angle/checkout/src/image_util/loadimage_etc.cpp
new file mode 100644
index 0000000000..53edad37d6
--- /dev/null
+++ b/gfx/angle/checkout/src/image_util/loadimage_etc.cpp
@@ -0,0 +1,1912 @@
+//
+// Copyright (c) 2013-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// loadimage_etc.cpp: Decodes ETC and EAC encoded textures.
+
+#include "image_util/loadimage.h"
+
+#include "common/mathutil.h"
+
+#include "image_util/imageformats.h"
+
+namespace angle
+{
+namespace
+{
+
+using IntensityModifier = const int[4];
+
+// Table 3.17.2 sorted according to table 3.17.3
+// clang-format off
+static IntensityModifier intensityModifierDefault[] =
+{
+ { 2, 8, -2, -8 },
+ { 5, 17, -5, -17 },
+ { 9, 29, -9, -29 },
+ { 13, 42, -13, -42 },
+ { 18, 60, -18, -60 },
+ { 24, 80, -24, -80 },
+ { 33, 106, -33, -106 },
+ { 47, 183, -47, -183 },
+};
+// clang-format on
+
+// Table C.12, intensity modifier for non opaque punchthrough alpha
+// clang-format off
+static IntensityModifier intensityModifierNonOpaque[] =
+{
+ { 0, 8, 0, -8 },
+ { 0, 17, 0, -17 },
+ { 0, 29, 0, -29 },
+ { 0, 42, 0, -42 },
+ { 0, 60, 0, -60 },
+ { 0, 80, 0, -80 },
+ { 0, 106, 0, -106 },
+ { 0, 183, 0, -183 },
+};
+// clang-format on
+
+static const int kNumPixelsInBlock = 16;
+
+struct ETC2Block
+{
+ // Decodes unsigned single or dual channel ETC2 block to 8-bit color
+ void decodeAsSingleETC2Channel(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destPixelStride,
+ size_t destRowPitch,
+ bool isSigned) const
+ {
+ for (size_t j = 0; j < 4 && (y + j) < h; j++)
+ {
+ uint8_t *row = dest + (j * destRowPitch);
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ uint8_t *pixel = row + (i * destPixelStride);
+ if (isSigned)
+ {
+ *pixel = clampSByte(getSingleETC2Channel(i, j, isSigned));
+ }
+ else
+ {
+ *pixel = clampByte(getSingleETC2Channel(i, j, isSigned));
+ }
+ }
+ }
+ }
+
+ // Decodes unsigned single or dual channel EAC block to 16-bit color
+ void decodeAsSingleEACChannel(uint16_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destPixelStride,
+ size_t destRowPitch,
+ bool isSigned) const
+ {
+ for (size_t j = 0; j < 4 && (y + j) < h; j++)
+ {
+ uint16_t *row = reinterpret_cast<uint16_t *>(reinterpret_cast<uint8_t *>(dest) +
+ (j * destRowPitch));
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ uint16_t *pixel = row + (i * destPixelStride);
+ if (isSigned)
+ {
+ *pixel = renormalizeSignedEAC(getSingleEACChannel(i, j, isSigned));
+ }
+ else
+ {
+ *pixel = renormalizeUnsignedEAC(getSingleEACChannel(i, j, isSigned));
+ }
+ }
+ }
+ }
+
+ // Decodes RGB block to rgba8
+ void decodeAsRGB(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destRowPitch,
+ const uint8_t alphaValues[4][4],
+ bool punchThroughAlpha) const
+ {
+ bool opaqueBit = u.idht.mode.idm.diffbit;
+ bool nonOpaquePunchThroughAlpha = punchThroughAlpha && !opaqueBit;
+ // Select mode
+ if (u.idht.mode.idm.diffbit || punchThroughAlpha)
+ {
+ const auto &block = u.idht.mode.idm.colors.diff;
+ int r = (block.R + block.dR);
+ int g = (block.G + block.dG);
+ int b = (block.B + block.dB);
+ if (r < 0 || r > 31)
+ {
+ decodeTBlock(dest, x, y, w, h, destRowPitch, alphaValues,
+ nonOpaquePunchThroughAlpha);
+ }
+ else if (g < 0 || g > 31)
+ {
+ decodeHBlock(dest, x, y, w, h, destRowPitch, alphaValues,
+ nonOpaquePunchThroughAlpha);
+ }
+ else if (b < 0 || b > 31)
+ {
+ decodePlanarBlock(dest, x, y, w, h, destRowPitch, alphaValues);
+ }
+ else
+ {
+ decodeDifferentialBlock(dest, x, y, w, h, destRowPitch, alphaValues,
+ nonOpaquePunchThroughAlpha);
+ }
+ }
+ else
+ {
+ decodeIndividualBlock(dest, x, y, w, h, destRowPitch, alphaValues,
+ nonOpaquePunchThroughAlpha);
+ }
+ }
+
+ // Transcodes RGB block to BC1
+ void transcodeAsBC1(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ const uint8_t alphaValues[4][4],
+ bool punchThroughAlpha) const
+ {
+ bool opaqueBit = u.idht.mode.idm.diffbit;
+ bool nonOpaquePunchThroughAlpha = punchThroughAlpha && !opaqueBit;
+ // Select mode
+ if (u.idht.mode.idm.diffbit || punchThroughAlpha)
+ {
+ const auto &block = u.idht.mode.idm.colors.diff;
+ int r = (block.R + block.dR);
+ int g = (block.G + block.dG);
+ int b = (block.B + block.dB);
+ if (r < 0 || r > 31)
+ {
+ transcodeTBlockToBC1(dest, x, y, w, h, alphaValues, nonOpaquePunchThroughAlpha);
+ }
+ else if (g < 0 || g > 31)
+ {
+ transcodeHBlockToBC1(dest, x, y, w, h, alphaValues, nonOpaquePunchThroughAlpha);
+ }
+ else if (b < 0 || b > 31)
+ {
+ transcodePlanarBlockToBC1(dest, x, y, w, h, alphaValues);
+ }
+ else
+ {
+ transcodeDifferentialBlockToBC1(dest, x, y, w, h, alphaValues,
+ nonOpaquePunchThroughAlpha);
+ }
+ }
+ else
+ {
+ transcodeIndividualBlockToBC1(dest, x, y, w, h, alphaValues,
+ nonOpaquePunchThroughAlpha);
+ }
+ }
+
+ private:
+ union
+ {
+ // Individual, differential, H and T modes
+ struct
+ {
+ union
+ {
+ // Individual and differential modes
+ struct
+ {
+ union
+ {
+ struct // Individual colors
+ {
+ unsigned char R2 : 4;
+ unsigned char R1 : 4;
+ unsigned char G2 : 4;
+ unsigned char G1 : 4;
+ unsigned char B2 : 4;
+ unsigned char B1 : 4;
+ } indiv;
+ struct // Differential colors
+ {
+ signed char dR : 3;
+ unsigned char R : 5;
+ signed char dG : 3;
+ unsigned char G : 5;
+ signed char dB : 3;
+ unsigned char B : 5;
+ } diff;
+ } colors;
+ bool flipbit : 1;
+ bool diffbit : 1;
+ unsigned char cw2 : 3;
+ unsigned char cw1 : 3;
+ } idm;
+ // T mode
+ struct
+ {
+ // Byte 1
+ unsigned char TR1b : 2;
+ unsigned char TdummyB : 1;
+ unsigned char TR1a : 2;
+ unsigned char TdummyA : 3;
+ // Byte 2
+ unsigned char TB1 : 4;
+ unsigned char TG1 : 4;
+ // Byte 3
+ unsigned char TG2 : 4;
+ unsigned char TR2 : 4;
+ // Byte 4
+ unsigned char Tdb : 1;
+ bool Tflipbit : 1;
+ unsigned char Tda : 2;
+ unsigned char TB2 : 4;
+ } tm;
+ // H mode
+ struct
+ {
+ // Byte 1
+ unsigned char HG1a : 3;
+ unsigned char HR1 : 4;
+ unsigned char HdummyA : 1;
+ // Byte 2
+ unsigned char HB1b : 2;
+ unsigned char HdummyC : 1;
+ unsigned char HB1a : 1;
+ unsigned char HG1b : 1;
+ unsigned char HdummyB : 3;
+ // Byte 3
+ unsigned char HG2a : 3;
+ unsigned char HR2 : 4;
+ unsigned char HB1c : 1;
+ // Byte 4
+ unsigned char Hdb : 1;
+ bool Hflipbit : 1;
+ unsigned char Hda : 1;
+ unsigned char HB2 : 4;
+ unsigned char HG2b : 1;
+ } hm;
+ } mode;
+ unsigned char pixelIndexMSB[2];
+ unsigned char pixelIndexLSB[2];
+ } idht;
+ // planar mode
+ struct
+ {
+ // Byte 1
+ unsigned char GO1 : 1;
+ unsigned char RO : 6;
+ unsigned char PdummyA : 1;
+ // Byte 2
+ unsigned char BO1 : 1;
+ unsigned char GO2 : 6;
+ unsigned char PdummyB : 1;
+ // Byte 3
+ unsigned char BO3a : 2;
+ unsigned char PdummyD : 1;
+ unsigned char BO2 : 2;
+ unsigned char PdummyC : 3;
+ // Byte 4
+ unsigned char RH2 : 1;
+ bool Pflipbit : 1;
+ unsigned char RH1 : 5;
+ unsigned char BO3b : 1;
+ // Byte 5
+ unsigned char BHa : 1;
+ unsigned char GH : 7;
+ // Byte 6
+ unsigned char RVa : 3;
+ unsigned char BHb : 5;
+ // Byte 7
+ unsigned char GVa : 5;
+ unsigned char RVb : 3;
+ // Byte 8
+ unsigned char BV : 6;
+ unsigned char GVb : 2;
+ } pblk;
+ // Single channel block
+ struct
+ {
+ union
+ {
+ unsigned char us;
+ signed char s;
+ } base_codeword;
+ unsigned char table_index : 4;
+ unsigned char multiplier : 4;
+ unsigned char mc1 : 2;
+ unsigned char mb : 3;
+ unsigned char ma : 3;
+ unsigned char mf1 : 1;
+ unsigned char me : 3;
+ unsigned char md : 3;
+ unsigned char mc2 : 1;
+ unsigned char mh : 3;
+ unsigned char mg : 3;
+ unsigned char mf2 : 2;
+ unsigned char mk1 : 2;
+ unsigned char mj : 3;
+ unsigned char mi : 3;
+ unsigned char mn1 : 1;
+ unsigned char mm : 3;
+ unsigned char ml : 3;
+ unsigned char mk2 : 1;
+ unsigned char mp : 3;
+ unsigned char mo : 3;
+ unsigned char mn2 : 2;
+ } scblk;
+ } u;
+
+ static unsigned char clampByte(int value)
+ {
+ return static_cast<unsigned char>(gl::clamp(value, 0, 255));
+ }
+
+ static signed char clampSByte(int value)
+ {
+ return static_cast<signed char>(gl::clamp(value, -128, 127));
+ }
+
+ static uint16_t renormalizeUnsignedEAC(int value)
+ {
+ // Data is in the range 0 to 2047, clamp it and then scale it to 16-bit
+ return static_cast<uint16_t>(gl::clamp(value, 0, 2047)) << 5;
+ }
+
+ static int16_t renormalizeSignedEAC(int value)
+ {
+ // Data is in the range -1023 to 1023, clamp it and then scale it to 16-bit
+ // The spec states that -1024 invalid and should be clamped to -1023
+ return static_cast<int16_t>(gl::clamp(value, -1023, 1023)) * 32;
+ }
+
+ static R8G8B8A8 createRGBA(int red, int green, int blue, int alpha)
+ {
+ R8G8B8A8 rgba;
+ rgba.R = clampByte(red);
+ rgba.G = clampByte(green);
+ rgba.B = clampByte(blue);
+ rgba.A = clampByte(alpha);
+ return rgba;
+ }
+
+ static R8G8B8A8 createRGBA(int red, int green, int blue)
+ {
+ return createRGBA(red, green, blue, 255);
+ }
+
+ static int extend_4to8bits(int x) { return (x << 4) | x; }
+ static int extend_5to8bits(int x) { return (x << 3) | (x >> 2); }
+ static int extend_6to8bits(int x) { return (x << 2) | (x >> 4); }
+ static int extend_7to8bits(int x) { return (x << 1) | (x >> 6); }
+
+ void decodeIndividualBlock(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destRowPitch,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ const auto &block = u.idht.mode.idm.colors.indiv;
+ int r1 = extend_4to8bits(block.R1);
+ int g1 = extend_4to8bits(block.G1);
+ int b1 = extend_4to8bits(block.B1);
+ int r2 = extend_4to8bits(block.R2);
+ int g2 = extend_4to8bits(block.G2);
+ int b2 = extend_4to8bits(block.B2);
+ decodeIndividualOrDifferentialBlock(dest, x, y, w, h, destRowPitch, r1, g1, b1, r2, g2, b2,
+ alphaValues, nonOpaquePunchThroughAlpha);
+ }
+
+ void decodeDifferentialBlock(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destRowPitch,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ const auto &block = u.idht.mode.idm.colors.diff;
+ int b1 = extend_5to8bits(block.B);
+ int g1 = extend_5to8bits(block.G);
+ int r1 = extend_5to8bits(block.R);
+ int r2 = extend_5to8bits(block.R + block.dR);
+ int g2 = extend_5to8bits(block.G + block.dG);
+ int b2 = extend_5to8bits(block.B + block.dB);
+ decodeIndividualOrDifferentialBlock(dest, x, y, w, h, destRowPitch, r1, g1, b1, r2, g2, b2,
+ alphaValues, nonOpaquePunchThroughAlpha);
+ }
+
+ void decodeIndividualOrDifferentialBlock(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destRowPitch,
+ int r1,
+ int g1,
+ int b1,
+ int r2,
+ int g2,
+ int b2,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ const IntensityModifier *intensityModifier =
+ nonOpaquePunchThroughAlpha ? intensityModifierNonOpaque : intensityModifierDefault;
+
+ R8G8B8A8 subblockColors0[4];
+ R8G8B8A8 subblockColors1[4];
+ for (size_t modifierIdx = 0; modifierIdx < 4; modifierIdx++)
+ {
+ const int i1 = intensityModifier[u.idht.mode.idm.cw1][modifierIdx];
+ subblockColors0[modifierIdx] = createRGBA(r1 + i1, g1 + i1, b1 + i1);
+
+ const int i2 = intensityModifier[u.idht.mode.idm.cw2][modifierIdx];
+ subblockColors1[modifierIdx] = createRGBA(r2 + i2, g2 + i2, b2 + i2);
+ }
+
+ if (u.idht.mode.idm.flipbit)
+ {
+ uint8_t *curPixel = dest;
+ for (size_t j = 0; j < 2 && (y + j) < h; j++)
+ {
+ R8G8B8A8 *row = reinterpret_cast<R8G8B8A8 *>(curPixel);
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ row[i] = subblockColors0[getIndex(i, j)];
+ row[i].A = alphaValues[j][i];
+ }
+ curPixel += destRowPitch;
+ }
+ for (size_t j = 2; j < 4 && (y + j) < h; j++)
+ {
+ R8G8B8A8 *row = reinterpret_cast<R8G8B8A8 *>(curPixel);
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ row[i] = subblockColors1[getIndex(i, j)];
+ row[i].A = alphaValues[j][i];
+ }
+ curPixel += destRowPitch;
+ }
+ }
+ else
+ {
+ uint8_t *curPixel = dest;
+ for (size_t j = 0; j < 4 && (y + j) < h; j++)
+ {
+ R8G8B8A8 *row = reinterpret_cast<R8G8B8A8 *>(curPixel);
+ for (size_t i = 0; i < 2 && (x + i) < w; i++)
+ {
+ row[i] = subblockColors0[getIndex(i, j)];
+ row[i].A = alphaValues[j][i];
+ }
+ for (size_t i = 2; i < 4 && (x + i) < w; i++)
+ {
+ row[i] = subblockColors1[getIndex(i, j)];
+ row[i].A = alphaValues[j][i];
+ }
+ curPixel += destRowPitch;
+ }
+ }
+ if (nonOpaquePunchThroughAlpha)
+ {
+ decodePunchThroughAlphaBlock(dest, x, y, w, h, destRowPitch);
+ }
+ }
+
+ void decodeTBlock(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destRowPitch,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ // Table C.8, distance index for T and H modes
+ const auto &block = u.idht.mode.tm;
+
+ int r1 = extend_4to8bits(block.TR1a << 2 | block.TR1b);
+ int g1 = extend_4to8bits(block.TG1);
+ int b1 = extend_4to8bits(block.TB1);
+ int r2 = extend_4to8bits(block.TR2);
+ int g2 = extend_4to8bits(block.TG2);
+ int b2 = extend_4to8bits(block.TB2);
+
+ static int distance[8] = {3, 6, 11, 16, 23, 32, 41, 64};
+ const int d = distance[block.Tda << 1 | block.Tdb];
+
+ const R8G8B8A8 paintColors[4] = {
+ createRGBA(r1, g1, b1),
+ createRGBA(r2 + d, g2 + d, b2 + d),
+ createRGBA(r2, g2, b2),
+ createRGBA(r2 - d, g2 - d, b2 - d),
+ };
+
+ uint8_t *curPixel = dest;
+ for (size_t j = 0; j < 4 && (y + j) < h; j++)
+ {
+ R8G8B8A8 *row = reinterpret_cast<R8G8B8A8 *>(curPixel);
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ row[i] = paintColors[getIndex(i, j)];
+ row[i].A = alphaValues[j][i];
+ }
+ curPixel += destRowPitch;
+ }
+
+ if (nonOpaquePunchThroughAlpha)
+ {
+ decodePunchThroughAlphaBlock(dest, x, y, w, h, destRowPitch);
+ }
+ }
+
+ void decodeHBlock(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destRowPitch,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ // Table C.8, distance index for T and H modes
+ const auto &block = u.idht.mode.hm;
+
+ int r1 = extend_4to8bits(block.HR1);
+ int g1 = extend_4to8bits(block.HG1a << 1 | block.HG1b);
+ int b1 = extend_4to8bits(block.HB1a << 3 | block.HB1b << 1 | block.HB1c);
+ int r2 = extend_4to8bits(block.HR2);
+ int g2 = extend_4to8bits(block.HG2a << 1 | block.HG2b);
+ int b2 = extend_4to8bits(block.HB2);
+
+ static const int distance[8] = {3, 6, 11, 16, 23, 32, 41, 64};
+ const int orderingTrickBit =
+ ((r1 << 16 | g1 << 8 | b1) >= (r2 << 16 | g2 << 8 | b2) ? 1 : 0);
+ const int d = distance[(block.Hda << 2) | (block.Hdb << 1) | orderingTrickBit];
+
+ const R8G8B8A8 paintColors[4] = {
+ createRGBA(r1 + d, g1 + d, b1 + d),
+ createRGBA(r1 - d, g1 - d, b1 - d),
+ createRGBA(r2 + d, g2 + d, b2 + d),
+ createRGBA(r2 - d, g2 - d, b2 - d),
+ };
+
+ uint8_t *curPixel = dest;
+ for (size_t j = 0; j < 4 && (y + j) < h; j++)
+ {
+ R8G8B8A8 *row = reinterpret_cast<R8G8B8A8 *>(curPixel);
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ row[i] = paintColors[getIndex(i, j)];
+ row[i].A = alphaValues[j][i];
+ }
+ curPixel += destRowPitch;
+ }
+
+ if (nonOpaquePunchThroughAlpha)
+ {
+ decodePunchThroughAlphaBlock(dest, x, y, w, h, destRowPitch);
+ }
+ }
+
+ void decodePlanarBlock(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t pitch,
+ const uint8_t alphaValues[4][4]) const
+ {
+ int ro = extend_6to8bits(u.pblk.RO);
+ int go = extend_7to8bits(u.pblk.GO1 << 6 | u.pblk.GO2);
+ int bo =
+ extend_6to8bits(u.pblk.BO1 << 5 | u.pblk.BO2 << 3 | u.pblk.BO3a << 1 | u.pblk.BO3b);
+ int rh = extend_6to8bits(u.pblk.RH1 << 1 | u.pblk.RH2);
+ int gh = extend_7to8bits(u.pblk.GH);
+ int bh = extend_6to8bits(u.pblk.BHa << 5 | u.pblk.BHb);
+ int rv = extend_6to8bits(u.pblk.RVa << 3 | u.pblk.RVb);
+ int gv = extend_7to8bits(u.pblk.GVa << 2 | u.pblk.GVb);
+ int bv = extend_6to8bits(u.pblk.BV);
+
+ uint8_t *curPixel = dest;
+ for (size_t j = 0; j < 4 && (y + j) < h; j++)
+ {
+ R8G8B8A8 *row = reinterpret_cast<R8G8B8A8 *>(curPixel);
+
+ int ry = static_cast<int>(j) * (rv - ro) + 2;
+ int gy = static_cast<int>(j) * (gv - go) + 2;
+ int by = static_cast<int>(j) * (bv - bo) + 2;
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ row[i] = createRGBA(((static_cast<int>(i) * (rh - ro) + ry) >> 2) + ro,
+ ((static_cast<int>(i) * (gh - go) + gy) >> 2) + go,
+ ((static_cast<int>(i) * (bh - bo) + by) >> 2) + bo,
+ alphaValues[j][i]);
+ }
+ curPixel += pitch;
+ }
+ }
+
+ // Index for individual, differential, H and T modes
+ size_t getIndex(size_t x, size_t y) const
+ {
+ size_t bitIndex = x * 4 + y;
+ size_t bitOffset = bitIndex & 7;
+ size_t lsb = (u.idht.pixelIndexLSB[1 - (bitIndex >> 3)] >> bitOffset) & 1;
+ size_t msb = (u.idht.pixelIndexMSB[1 - (bitIndex >> 3)] >> bitOffset) & 1;
+ return (msb << 1) | lsb;
+ }
+
+ void decodePunchThroughAlphaBlock(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ size_t destRowPitch) const
+ {
+ uint8_t *curPixel = dest;
+ for (size_t j = 0; j < 4 && (y + j) < h; j++)
+ {
+ R8G8B8A8 *row = reinterpret_cast<R8G8B8A8 *>(curPixel);
+ for (size_t i = 0; i < 4 && (x + i) < w; i++)
+ {
+ if (getIndex(i, j) == 2) // msb == 1 && lsb == 0
+ {
+ row[i] = createRGBA(0, 0, 0, 0);
+ }
+ }
+ curPixel += destRowPitch;
+ }
+ }
+
+ uint16_t RGB8ToRGB565(const R8G8B8A8 &rgba) const
+ {
+ return (static_cast<uint16_t>(rgba.R >> 3) << 11) |
+ (static_cast<uint16_t>(rgba.G >> 2) << 5) |
+ (static_cast<uint16_t>(rgba.B >> 3) << 0);
+ }
+
+ uint32_t matchBC1Bits(const int *pixelIndices,
+ const int *pixelIndexCounts,
+ const R8G8B8A8 *subblockColors,
+ size_t numColors,
+ const R8G8B8A8 &minColor,
+ const R8G8B8A8 &maxColor,
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ // Project each pixel on the (maxColor, minColor) line to decide which
+ // BC1 code to assign to it.
+
+ uint8_t decodedColors[2][3] = {{maxColor.R, maxColor.G, maxColor.B},
+ {minColor.R, minColor.G, minColor.B}};
+
+ int direction[3];
+ for (int ch = 0; ch < 3; ch++)
+ {
+ direction[ch] = decodedColors[0][ch] - decodedColors[1][ch];
+ }
+
+ int stops[2];
+ for (int i = 0; i < 2; i++)
+ {
+ stops[i] = decodedColors[i][0] * direction[0] + decodedColors[i][1] * direction[1] +
+ decodedColors[i][2] * direction[2];
+ }
+
+ ASSERT(numColors <= kNumPixelsInBlock);
+
+ int encodedColors[kNumPixelsInBlock];
+ if (nonOpaquePunchThroughAlpha)
+ {
+ for (size_t i = 0; i < numColors; i++)
+ {
+ const int count = pixelIndexCounts[i];
+ if (count > 0)
+ {
+ // In non-opaque mode, 3 is for tranparent pixels.
+
+ if (0 == subblockColors[i].A)
+ {
+ encodedColors[i] = 3;
+ }
+ else
+ {
+ const R8G8B8A8 &pixel = subblockColors[i];
+ const int dot = pixel.R * direction[0] + pixel.G * direction[1] +
+ pixel.B * direction[2];
+ const int factor = gl::clamp(
+ static_cast<int>(
+ (static_cast<float>(dot - stops[1]) / (stops[0] - stops[1])) * 2 +
+ 0.5f),
+ 0, 2);
+ switch (factor)
+ {
+ case 0:
+ encodedColors[i] = 0;
+ break;
+ case 1:
+ encodedColors[i] = 2;
+ break;
+ case 2:
+ default:
+ encodedColors[i] = 1;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for (size_t i = 0; i < numColors; i++)
+ {
+ const int count = pixelIndexCounts[i];
+ if (count > 0)
+ {
+ // In opaque mode, the code is from 0 to 3.
+
+ const R8G8B8A8 &pixel = subblockColors[i];
+ const int dot =
+ pixel.R * direction[0] + pixel.G * direction[1] + pixel.B * direction[2];
+ const int factor = gl::clamp(
+ static_cast<int>(
+ (static_cast<float>(dot - stops[1]) / (stops[0] - stops[1])) * 3 +
+ 0.5f),
+ 0, 3);
+ switch (factor)
+ {
+ case 0:
+ encodedColors[i] = 1;
+ break;
+ case 1:
+ encodedColors[i] = 3;
+ break;
+ case 2:
+ encodedColors[i] = 2;
+ break;
+ case 3:
+ default:
+ encodedColors[i] = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ uint32_t bits = 0;
+ for (int i = kNumPixelsInBlock - 1; i >= 0; i--)
+ {
+ bits <<= 2;
+ bits |= encodedColors[pixelIndices[i]];
+ }
+
+ return bits;
+ }
+
+ void packBC1(void *bc1,
+ const int *pixelIndices,
+ const int *pixelIndexCounts,
+ const R8G8B8A8 *subblockColors,
+ size_t numColors,
+ int minColorIndex,
+ int maxColorIndex,
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ const R8G8B8A8 &minColor = subblockColors[minColorIndex];
+ const R8G8B8A8 &maxColor = subblockColors[maxColorIndex];
+
+ uint32_t bits;
+ uint16_t max16 = RGB8ToRGB565(maxColor);
+ uint16_t min16 = RGB8ToRGB565(minColor);
+ if (max16 != min16)
+ {
+ // Find the best BC1 code for each pixel
+ bits = matchBC1Bits(pixelIndices, pixelIndexCounts, subblockColors, numColors, minColor,
+ maxColor, nonOpaquePunchThroughAlpha);
+ }
+ else
+ {
+ // Same colors, BC1 index 0 is the color in both opaque and transparent mode
+ bits = 0;
+ // BC1 index 3 is transparent
+ if (nonOpaquePunchThroughAlpha)
+ {
+ for (int i = 0; i < kNumPixelsInBlock; i++)
+ {
+ if (0 == subblockColors[pixelIndices[i]].A)
+ {
+ bits |= (3 << (i * 2));
+ }
+ }
+ }
+ }
+
+ if (max16 < min16)
+ {
+ std::swap(max16, min16);
+
+ uint32_t xorMask = 0;
+ if (nonOpaquePunchThroughAlpha)
+ {
+ // In transparent mode switching the colors is doing the
+ // following code swap: 0 <-> 1. 0xA selects the second bit of
+ // each code, bits >> 1 selects the first bit of the code when
+ // the seconds bit is set (case 2 and 3). We invert all the
+ // non-selected bits, that is the first bit when the code is
+ // 0 or 1.
+ xorMask = ~((bits >> 1) | 0xAAAAAAAA);
+ }
+ else
+ {
+ // In opaque mode switching the two colors is doing the
+ // following code swaps: 0 <-> 1 and 2 <-> 3. This is
+ // equivalent to flipping the first bit of each code
+ // (5 = 0b0101)
+ xorMask = 0x55555555;
+ }
+ bits ^= xorMask;
+ }
+
+ struct BC1Block
+ {
+ uint16_t color0;
+ uint16_t color1;
+ uint32_t bits;
+ };
+
+ // Encode the opaqueness in the order of the two BC1 colors
+ BC1Block *dest = reinterpret_cast<BC1Block *>(bc1);
+ if (nonOpaquePunchThroughAlpha)
+ {
+ dest->color0 = min16;
+ dest->color1 = max16;
+ }
+ else
+ {
+ dest->color0 = max16;
+ dest->color1 = min16;
+ }
+ dest->bits = bits;
+ }
+
+ void transcodeIndividualBlockToBC1(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ const auto &block = u.idht.mode.idm.colors.indiv;
+ int r1 = extend_4to8bits(block.R1);
+ int g1 = extend_4to8bits(block.G1);
+ int b1 = extend_4to8bits(block.B1);
+ int r2 = extend_4to8bits(block.R2);
+ int g2 = extend_4to8bits(block.G2);
+ int b2 = extend_4to8bits(block.B2);
+ transcodeIndividualOrDifferentialBlockToBC1(dest, x, y, w, h, r1, g1, b1, r2, g2, b2,
+ alphaValues, nonOpaquePunchThroughAlpha);
+ }
+
+ void transcodeDifferentialBlockToBC1(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ const auto &block = u.idht.mode.idm.colors.diff;
+ int b1 = extend_5to8bits(block.B);
+ int g1 = extend_5to8bits(block.G);
+ int r1 = extend_5to8bits(block.R);
+ int r2 = extend_5to8bits(block.R + block.dR);
+ int g2 = extend_5to8bits(block.G + block.dG);
+ int b2 = extend_5to8bits(block.B + block.dB);
+ transcodeIndividualOrDifferentialBlockToBC1(dest, x, y, w, h, r1, g1, b1, r2, g2, b2,
+ alphaValues, nonOpaquePunchThroughAlpha);
+ }
+
+ void extractPixelIndices(int *pixelIndices,
+ int *pixelIndicesCounts,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ bool flipbit,
+ size_t subblockIdx) const
+ {
+ size_t dxBegin = 0;
+ size_t dxEnd = 4;
+ size_t dyBegin = subblockIdx * 2;
+ size_t dyEnd = dyBegin + 2;
+ if (!flipbit)
+ {
+ std::swap(dxBegin, dyBegin);
+ std::swap(dxEnd, dyEnd);
+ }
+
+ for (size_t j = dyBegin; j < dyEnd; j++)
+ {
+ int *row = &pixelIndices[j * 4];
+ for (size_t i = dxBegin; i < dxEnd; i++)
+ {
+ const size_t pixelIndex = subblockIdx * 4 + getIndex(i, j);
+ row[i] = static_cast<int>(pixelIndex);
+ pixelIndicesCounts[pixelIndex]++;
+ }
+ }
+ }
+
+ void selectEndPointPCA(const int *pixelIndexCounts,
+ const R8G8B8A8 *subblockColors,
+ size_t numColors,
+ int *minColorIndex,
+ int *maxColorIndex) const
+ {
+ // determine color distribution
+ int mu[3], min[3], max[3];
+ for (int ch = 0; ch < 3; ch++)
+ {
+ int muv = 0;
+ int minv = 255;
+ int maxv = 0;
+ for (size_t i = 0; i < numColors; i++)
+ {
+ const int count = pixelIndexCounts[i];
+ if (count > 0)
+ {
+ const auto &pixel = subblockColors[i];
+ if (pixel.A > 0)
+ {
+ // Non-transparent pixels
+ muv += (&pixel.R)[ch] * count;
+ minv = std::min<int>(minv, (&pixel.R)[ch]);
+ maxv = std::max<int>(maxv, (&pixel.R)[ch]);
+ }
+ }
+ }
+
+ mu[ch] = (muv + kNumPixelsInBlock / 2) / kNumPixelsInBlock;
+ min[ch] = minv;
+ max[ch] = maxv;
+ }
+
+ // determine covariance matrix
+ int cov[6] = {0, 0, 0, 0, 0, 0};
+ for (size_t i = 0; i < numColors; i++)
+ {
+ const int count = pixelIndexCounts[i];
+ if (count > 0)
+ {
+ const auto &pixel = subblockColors[i];
+ if (pixel.A > 0)
+ {
+ int r = pixel.R - mu[0];
+ int g = pixel.G - mu[1];
+ int b = pixel.B - mu[2];
+
+ cov[0] += r * r * count;
+ cov[1] += r * g * count;
+ cov[2] += r * b * count;
+ cov[3] += g * g * count;
+ cov[4] += g * b * count;
+ cov[5] += b * b * count;
+ }
+ }
+ }
+
+ // Power iteration algorithm to get the eigenvalues and eigenvector
+
+ // Starts with diagonal vector
+ float vfr = static_cast<float>(max[0] - min[0]);
+ float vfg = static_cast<float>(max[1] - min[1]);
+ float vfb = static_cast<float>(max[2] - min[2]);
+ float eigenvalue;
+
+ static const size_t kPowerIterations = 4;
+ for (size_t i = 0; i < kPowerIterations; i++)
+ {
+ float r = vfr * cov[0] + vfg * cov[1] + vfb * cov[2];
+ float g = vfr * cov[1] + vfg * cov[3] + vfb * cov[4];
+ float b = vfr * cov[2] + vfg * cov[4] + vfb * cov[5];
+
+ vfr = r;
+ vfg = g;
+ vfb = b;
+
+ eigenvalue = sqrt(r * r + g * g + b * b);
+ if (eigenvalue > 0)
+ {
+ float invNorm = 1.0f / eigenvalue;
+ vfr *= invNorm;
+ vfg *= invNorm;
+ vfb *= invNorm;
+ }
+ }
+
+ int vr, vg, vb;
+
+ static const float kDefaultLuminanceThreshold = 4.0f * 255;
+ static const float kQuantizeRange = 512.0f;
+ if (eigenvalue < kDefaultLuminanceThreshold) // too small, default to luminance
+ {
+ // Luminance weights defined by ITU-R Recommendation BT.601, scaled by 1000
+ vr = 299;
+ vg = 587;
+ vb = 114;
+ }
+ else
+ {
+ // From the eigenvalue and eigenvector, choose the axis to project
+ // colors on. When projecting colors we want to do integer computations
+ // for speed, so we normalize the eigenvector to the [0, 512] range.
+ float magn = std::max(std::max(std::abs(vfr), std::abs(vfg)), std::abs(vfb));
+ magn = kQuantizeRange / magn;
+ vr = static_cast<int>(vfr * magn);
+ vg = static_cast<int>(vfg * magn);
+ vb = static_cast<int>(vfb * magn);
+ }
+
+ // Pick colors at extreme points
+ int minD = INT_MAX;
+ int maxD = 0;
+ size_t minIndex = 0;
+ size_t maxIndex = 0;
+ for (size_t i = 0; i < numColors; i++)
+ {
+ const int count = pixelIndexCounts[i];
+ if (count > 0)
+ {
+ const auto &pixel = subblockColors[i];
+ if (pixel.A > 0)
+ {
+ int dot = pixel.R * vr + pixel.G * vg + pixel.B * vb;
+ if (dot < minD)
+ {
+ minD = dot;
+ minIndex = i;
+ }
+ if (dot > maxD)
+ {
+ maxD = dot;
+ maxIndex = i;
+ }
+ }
+ }
+ }
+
+ *minColorIndex = static_cast<int>(minIndex);
+ *maxColorIndex = static_cast<int>(maxIndex);
+ }
+
+ void transcodeIndividualOrDifferentialBlockToBC1(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ int r1,
+ int g1,
+ int b1,
+ int r2,
+ int g2,
+ int b2,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ // A BC1 block has 2 endpoints, pixels is encoded as linear
+ // interpolations of them. A ETC1/ETC2 individual or differential block
+ // has 2 subblocks. Each subblock has one color and a modifier. We
+ // select axis by principal component analysis (PCA) to use as
+ // our two BC1 endpoints and then map pixels to BC1 by projecting on the
+ // line between the two endpoints and choosing the right fraction.
+
+ // The goal of this algorithm is make it faster than decode ETC to RGBs
+ // and then encode to BC. To achieve this, we only extract subblock
+ // colors, pixel indices, and counts of each pixel indices from ETC.
+ // With those information, we can only encode used subblock colors
+ // to BC1, and copy the bits to the right pixels.
+ // Fully decode and encode need to process 16 RGBA pixels. With this
+ // algorithm, it's 8 pixels at maximum for a individual or
+ // differential block. Saves us bandwidth and computations.
+
+ static const size_t kNumColors = 8;
+
+ const IntensityModifier *intensityModifier =
+ nonOpaquePunchThroughAlpha ? intensityModifierNonOpaque : intensityModifierDefault;
+
+ // Compute the colors that pixels can have in each subblock both for
+ // the decoding of the RGBA data and BC1 encoding
+ R8G8B8A8 subblockColors[kNumColors];
+ for (size_t modifierIdx = 0; modifierIdx < 4; modifierIdx++)
+ {
+ if (nonOpaquePunchThroughAlpha && (modifierIdx == 2))
+ {
+ // In ETC opaque punch through formats, individual and
+ // differential blocks take index 2 as transparent pixel.
+ // Thus we don't need to compute its color, just assign it
+ // as black.
+ subblockColors[modifierIdx] = createRGBA(0, 0, 0, 0);
+ subblockColors[4 + modifierIdx] = createRGBA(0, 0, 0, 0);
+ }
+ else
+ {
+ const int i1 = intensityModifier[u.idht.mode.idm.cw1][modifierIdx];
+ subblockColors[modifierIdx] = createRGBA(r1 + i1, g1 + i1, b1 + i1);
+
+ const int i2 = intensityModifier[u.idht.mode.idm.cw2][modifierIdx];
+ subblockColors[4 + modifierIdx] = createRGBA(r2 + i2, g2 + i2, b2 + i2);
+ }
+ }
+
+ int pixelIndices[kNumPixelsInBlock];
+ int pixelIndexCounts[kNumColors] = {0};
+ // Extract pixel indices from a ETC block.
+ for (size_t blockIdx = 0; blockIdx < 2; blockIdx++)
+ {
+ extractPixelIndices(pixelIndices, pixelIndexCounts, x, y, w, h, u.idht.mode.idm.flipbit,
+ blockIdx);
+ }
+
+ int minColorIndex, maxColorIndex;
+ selectEndPointPCA(pixelIndexCounts, subblockColors, kNumColors, &minColorIndex,
+ &maxColorIndex);
+
+ packBC1(dest, pixelIndices, pixelIndexCounts, subblockColors, kNumColors, minColorIndex,
+ maxColorIndex, nonOpaquePunchThroughAlpha);
+ }
+
+ void transcodeTBlockToBC1(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ static const size_t kNumColors = 4;
+
+ // Table C.8, distance index for T and H modes
+ const auto &block = u.idht.mode.tm;
+
+ int r1 = extend_4to8bits(block.TR1a << 2 | block.TR1b);
+ int g1 = extend_4to8bits(block.TG1);
+ int b1 = extend_4to8bits(block.TB1);
+ int r2 = extend_4to8bits(block.TR2);
+ int g2 = extend_4to8bits(block.TG2);
+ int b2 = extend_4to8bits(block.TB2);
+
+ static int distance[8] = {3, 6, 11, 16, 23, 32, 41, 64};
+ const int d = distance[block.Tda << 1 | block.Tdb];
+
+ // In ETC opaque punch through formats, index == 2 means transparent pixel.
+ // Thus we don't need to compute its color, just assign it as black.
+ const R8G8B8A8 paintColors[kNumColors] = {
+ createRGBA(r1, g1, b1),
+ createRGBA(r2 + d, g2 + d, b2 + d),
+ nonOpaquePunchThroughAlpha ? createRGBA(0, 0, 0, 0) : createRGBA(r2, g2, b2),
+ createRGBA(r2 - d, g2 - d, b2 - d),
+ };
+
+ int pixelIndices[kNumPixelsInBlock];
+ int pixelIndexCounts[kNumColors] = {0};
+ for (size_t j = 0; j < 4; j++)
+ {
+ int *row = &pixelIndices[j * 4];
+ for (size_t i = 0; i < 4; i++)
+ {
+ const size_t pixelIndex = getIndex(i, j);
+ row[i] = static_cast<int>(pixelIndex);
+ pixelIndexCounts[pixelIndex]++;
+ }
+ }
+
+ int minColorIndex, maxColorIndex;
+ selectEndPointPCA(pixelIndexCounts, paintColors, kNumColors, &minColorIndex,
+ &maxColorIndex);
+
+ packBC1(dest, pixelIndices, pixelIndexCounts, paintColors, kNumColors, minColorIndex,
+ maxColorIndex, nonOpaquePunchThroughAlpha);
+ }
+
+ void transcodeHBlockToBC1(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ const uint8_t alphaValues[4][4],
+ bool nonOpaquePunchThroughAlpha) const
+ {
+ static const size_t kNumColors = 4;
+
+ // Table C.8, distance index for T and H modes
+ const auto &block = u.idht.mode.hm;
+
+ int r1 = extend_4to8bits(block.HR1);
+ int g1 = extend_4to8bits(block.HG1a << 1 | block.HG1b);
+ int b1 = extend_4to8bits(block.HB1a << 3 | block.HB1b << 1 | block.HB1c);
+ int r2 = extend_4to8bits(block.HR2);
+ int g2 = extend_4to8bits(block.HG2a << 1 | block.HG2b);
+ int b2 = extend_4to8bits(block.HB2);
+
+ static const int distance[8] = {3, 6, 11, 16, 23, 32, 41, 64};
+ const int orderingTrickBit =
+ ((r1 << 16 | g1 << 8 | b1) >= (r2 << 16 | g2 << 8 | b2) ? 1 : 0);
+ const int d = distance[(block.Hda << 2) | (block.Hdb << 1) | orderingTrickBit];
+
+ // In ETC opaque punch through formats, index == 2 means transparent pixel.
+ // Thus we don't need to compute its color, just assign it as black.
+ const R8G8B8A8 paintColors[kNumColors] = {
+ createRGBA(r1 + d, g1 + d, b1 + d),
+ createRGBA(r1 - d, g1 - d, b1 - d),
+ nonOpaquePunchThroughAlpha ? createRGBA(0, 0, 0, 0)
+ : createRGBA(r2 + d, g2 + d, b2 + d),
+ createRGBA(r2 - d, g2 - d, b2 - d),
+ };
+
+ int pixelIndices[kNumPixelsInBlock];
+ int pixelIndexCounts[kNumColors] = {0};
+ for (size_t j = 0; j < 4; j++)
+ {
+ int *row = &pixelIndices[j * 4];
+ for (size_t i = 0; i < 4; i++)
+ {
+ const size_t pixelIndex = getIndex(i, j);
+ row[i] = static_cast<int>(pixelIndex);
+ pixelIndexCounts[pixelIndex]++;
+ }
+ }
+
+ int minColorIndex, maxColorIndex;
+ selectEndPointPCA(pixelIndexCounts, paintColors, kNumColors, &minColorIndex,
+ &maxColorIndex);
+
+ packBC1(dest, pixelIndices, pixelIndexCounts, paintColors, kNumColors, minColorIndex,
+ maxColorIndex, nonOpaquePunchThroughAlpha);
+ }
+
+ void transcodePlanarBlockToBC1(uint8_t *dest,
+ size_t x,
+ size_t y,
+ size_t w,
+ size_t h,
+ const uint8_t alphaValues[4][4]) const
+ {
+ static const size_t kNumColors = kNumPixelsInBlock;
+
+ R8G8B8A8 rgbaBlock[kNumColors];
+ decodePlanarBlock(reinterpret_cast<uint8_t *>(rgbaBlock), x, y, w, h, sizeof(R8G8B8A8) * 4,
+ alphaValues);
+
+ // Planar block doesn't have a color table, fill indices as full
+ int pixelIndices[kNumPixelsInBlock] = {0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15};
+ int pixelIndexCounts[kNumColors] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+
+ int minColorIndex, maxColorIndex;
+ selectEndPointPCA(pixelIndexCounts, rgbaBlock, kNumColors, &minColorIndex, &maxColorIndex);
+
+ packBC1(dest, pixelIndices, pixelIndexCounts, rgbaBlock, kNumColors, minColorIndex,
+ maxColorIndex, false);
+ }
+
+ // Single channel utility functions
+ int getSingleEACChannel(size_t x, size_t y, bool isSigned) const
+ {
+ int codeword = isSigned ? u.scblk.base_codeword.s : u.scblk.base_codeword.us;
+ int multiplier = (u.scblk.multiplier == 0) ? 1 : u.scblk.multiplier * 8;
+ return codeword * 8 + 4 + getSingleChannelModifier(x, y) * multiplier;
+ }
+
+ int getSingleETC2Channel(size_t x, size_t y, bool isSigned) const
+ {
+ int codeword = isSigned ? u.scblk.base_codeword.s : u.scblk.base_codeword.us;
+ return codeword + getSingleChannelModifier(x, y) * u.scblk.multiplier;
+ }
+
+ int getSingleChannelIndex(size_t x, size_t y) const
+ {
+ ASSERT(x < 4 && y < 4);
+
+ // clang-format off
+ switch (x * 4 + y)
+ {
+ case 0: return u.scblk.ma;
+ case 1: return u.scblk.mb;
+ case 2: return u.scblk.mc1 << 1 | u.scblk.mc2;
+ case 3: return u.scblk.md;
+ case 4: return u.scblk.me;
+ case 5: return u.scblk.mf1 << 2 | u.scblk.mf2;
+ case 6: return u.scblk.mg;
+ case 7: return u.scblk.mh;
+ case 8: return u.scblk.mi;
+ case 9: return u.scblk.mj;
+ case 10: return u.scblk.mk1 << 1 | u.scblk.mk2;
+ case 11: return u.scblk.ml;
+ case 12: return u.scblk.mm;
+ case 13: return u.scblk.mn1 << 2 | u.scblk.mn2;
+ case 14: return u.scblk.mo;
+ case 15: return u.scblk.mp;
+ default: UNREACHABLE(); return 0;
+ }
+ // clang-format on
+ }
+
+ int getSingleChannelModifier(size_t x, size_t y) const
+ {
+ // clang-format off
+ static const int modifierTable[16][8] =
+ {
+ { -3, -6, -9, -15, 2, 5, 8, 14 },
+ { -3, -7, -10, -13, 2, 6, 9, 12 },
+ { -2, -5, -8, -13, 1, 4, 7, 12 },
+ { -2, -4, -6, -13, 1, 3, 5, 12 },
+ { -3, -6, -8, -12, 2, 5, 7, 11 },
+ { -3, -7, -9, -11, 2, 6, 8, 10 },
+ { -4, -7, -8, -11, 3, 6, 7, 10 },
+ { -3, -5, -8, -11, 2, 4, 7, 10 },
+ { -2, -6, -8, -10, 1, 5, 7, 9 },
+ { -2, -5, -8, -10, 1, 4, 7, 9 },
+ { -2, -4, -8, -10, 1, 3, 7, 9 },
+ { -2, -5, -7, -10, 1, 4, 6, 9 },
+ { -3, -4, -7, -10, 2, 3, 6, 9 },
+ { -1, -2, -3, -10, 0, 1, 2, 9 },
+ { -4, -6, -8, -9, 3, 5, 7, 8 },
+ { -3, -5, -7, -9, 2, 4, 6, 8 }
+ };
+ // clang-format on
+
+ return modifierTable[u.scblk.table_index][getSingleChannelIndex(x, y)];
+ }
+};
+
+// clang-format off
+static const uint8_t DefaultETCAlphaValues[4][4] =
+{
+ { 255, 255, 255, 255 },
+ { 255, 255, 255, 255 },
+ { 255, 255, 255, 255 },
+ { 255, 255, 255, 255 },
+};
+
+// clang-format on
+void LoadR11EACToR8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch,
+ bool isSigned)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y += 4)
+ {
+ const ETC2Block *sourceRow =
+ priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
+ uint8_t *destRow =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < width; x += 4)
+ {
+ const ETC2Block *sourceBlock = sourceRow + (x / 4);
+ uint8_t *destPixels = destRow + x;
+
+ sourceBlock->decodeAsSingleETC2Channel(destPixels, x, y, width, height, 1,
+ outputRowPitch, isSigned);
+ }
+ }
+ }
+}
+
+void LoadRG11EACToRG8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch,
+ bool isSigned)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y += 4)
+ {
+ const ETC2Block *sourceRow =
+ priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
+ uint8_t *destRow =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < width; x += 4)
+ {
+ uint8_t *destPixelsRed = destRow + (x * 2);
+ const ETC2Block *sourceBlockRed = sourceRow + (x / 2);
+ sourceBlockRed->decodeAsSingleETC2Channel(destPixelsRed, x, y, width, height, 2,
+ outputRowPitch, isSigned);
+
+ uint8_t *destPixelsGreen = destPixelsRed + 1;
+ const ETC2Block *sourceBlockGreen = sourceBlockRed + 1;
+ sourceBlockGreen->decodeAsSingleETC2Channel(destPixelsGreen, x, y, width, height, 2,
+ outputRowPitch, isSigned);
+ }
+ }
+ }
+}
+
+void LoadR11EACToR16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch,
+ bool isSigned)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y += 4)
+ {
+ const ETC2Block *sourceRow =
+ priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
+ uint16_t *destRow =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < width; x += 4)
+ {
+ const ETC2Block *sourceBlock = sourceRow + (x / 4);
+ uint16_t *destPixels = destRow + x;
+
+ sourceBlock->decodeAsSingleEACChannel(destPixels, x, y, width, height, 1,
+ outputRowPitch, isSigned);
+ }
+ }
+ }
+}
+
+void LoadRG11EACToRG16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch,
+ bool isSigned)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y += 4)
+ {
+ const ETC2Block *sourceRow =
+ priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
+ uint16_t *destRow =
+ priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < width; x += 4)
+ {
+ uint16_t *destPixelsRed = destRow + (x * 2);
+ const ETC2Block *sourceBlockRed = sourceRow + (x / 2);
+ sourceBlockRed->decodeAsSingleEACChannel(destPixelsRed, x, y, width, height, 2,
+ outputRowPitch, isSigned);
+
+ uint16_t *destPixelsGreen = destPixelsRed + 1;
+ const ETC2Block *sourceBlockGreen = sourceBlockRed + 1;
+ sourceBlockGreen->decodeAsSingleEACChannel(destPixelsGreen, x, y, width, height, 2,
+ outputRowPitch, isSigned);
+ }
+ }
+ }
+}
+
+void LoadETC2RGB8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch,
+ bool punchthroughAlpha)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y += 4)
+ {
+ const ETC2Block *sourceRow =
+ priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
+ uint8_t *destRow =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < width; x += 4)
+ {
+ const ETC2Block *sourceBlock = sourceRow + (x / 4);
+ uint8_t *destPixels = destRow + (x * 4);
+
+ sourceBlock->decodeAsRGB(destPixels, x, y, width, height, outputRowPitch,
+ DefaultETCAlphaValues, punchthroughAlpha);
+ }
+ }
+ }
+}
+
+void LoadETC2RGB8ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch,
+ bool punchthroughAlpha)
+{
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y += 4)
+ {
+ const ETC2Block *sourceRow =
+ priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
+ uint8_t *destRow = priv::OffsetDataPointer<uint8_t>(output, y / 4, z, outputRowPitch,
+ outputDepthPitch);
+
+ for (size_t x = 0; x < width; x += 4)
+ {
+ const ETC2Block *sourceBlock = sourceRow + (x / 4);
+ uint8_t *destPixels = destRow + (x * 2);
+
+ sourceBlock->transcodeAsBC1(destPixels, x, y, width, height, DefaultETCAlphaValues,
+ punchthroughAlpha);
+ }
+ }
+ }
+}
+
+void LoadETC2RGBA8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch,
+ bool srgb)
+{
+ uint8_t decodedAlphaValues[4][4];
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y += 4)
+ {
+ const ETC2Block *sourceRow =
+ priv::OffsetDataPointer<ETC2Block>(input, y / 4, z, inputRowPitch, inputDepthPitch);
+ uint8_t *destRow =
+ priv::OffsetDataPointer<uint8_t>(output, y, z, outputRowPitch, outputDepthPitch);
+
+ for (size_t x = 0; x < width; x += 4)
+ {
+ const ETC2Block *sourceBlockAlpha = sourceRow + (x / 2);
+ sourceBlockAlpha->decodeAsSingleETC2Channel(
+ reinterpret_cast<uint8_t *>(decodedAlphaValues), x, y, width, height, 1, 4,
+ false);
+
+ uint8_t *destPixels = destRow + (x * 4);
+ const ETC2Block *sourceBlockRGB = sourceBlockAlpha + 1;
+ sourceBlockRGB->decodeAsRGB(destPixels, x, y, width, height, outputRowPitch,
+ decodedAlphaValues, false);
+ }
+ }
+ }
+}
+
+} // anonymous namespace
+
+void LoadETC1RGB8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadETC1RGB8ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToBC1(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadEACR11ToR8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadR11EACToR8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadEACR11SToR8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadR11EACToR8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadEACRG11ToRG8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadRG11EACToRG8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadEACRG11SToRG8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadRG11EACToRG8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadEACR11ToR16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadR11EACToR16(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadEACR11SToR16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadR11EACToR16(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadEACRG11ToRG16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadRG11EACToRG16(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadEACRG11SToRG16(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadRG11EACToRG16(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadETC2RGB8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadETC2RGB8ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToBC1(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadETC2SRGB8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadETC2SRGB8ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToBC1(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadETC2RGB8A1ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadETC2RGB8A1ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToBC1(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadETC2SRGB8A1ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadETC2SRGB8A1ToBC1(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGB8ToBC1(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+void LoadETC2RGBA8ToRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGBA8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, false);
+}
+
+void LoadETC2SRGBA8ToSRGBA8(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ LoadETC2RGBA8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output,
+ outputRowPitch, outputDepthPitch, true);
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libANGLE/AttributeMap.cpp b/gfx/angle/checkout/src/libANGLE/AttributeMap.cpp
new file mode 100644
index 0000000000..9db71745fe
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/AttributeMap.cpp
@@ -0,0 +1,108 @@
+//
+// 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 "libANGLE/AttributeMap.h"
+
+#include "common/debug.h"
+
+namespace egl
+{
+
+AttributeMap::AttributeMap() {}
+
+AttributeMap::AttributeMap(const AttributeMap &other) = default;
+
+AttributeMap::~AttributeMap() = default;
+
+void AttributeMap::insert(EGLAttrib key, EGLAttrib value)
+{
+ mAttributes[key] = value;
+}
+
+bool AttributeMap::contains(EGLAttrib key) const
+{
+ return (mAttributes.find(key) != mAttributes.end());
+}
+
+EGLAttrib AttributeMap::get(EGLAttrib key) const
+{
+ auto iter = mAttributes.find(key);
+ ASSERT(iter != mAttributes.end());
+ return iter->second;
+}
+
+EGLAttrib AttributeMap::get(EGLAttrib key, EGLAttrib defaultValue) const
+{
+ auto iter = mAttributes.find(key);
+ return (iter != mAttributes.end()) ? iter->second : defaultValue;
+}
+
+EGLint AttributeMap::getAsInt(EGLAttrib key) const
+{
+ return static_cast<EGLint>(get(key));
+}
+
+EGLint AttributeMap::getAsInt(EGLAttrib key, EGLint defaultValue) const
+{
+ return static_cast<EGLint>(get(key, static_cast<EGLAttrib>(defaultValue)));
+}
+
+bool AttributeMap::isEmpty() const
+{
+ return mAttributes.empty();
+}
+
+std::vector<EGLint> AttributeMap::toIntVector() const
+{
+ std::vector<EGLint> ret;
+ for (const auto &pair : mAttributes)
+ {
+ ret.push_back(static_cast<EGLint>(pair.first));
+ ret.push_back(static_cast<EGLint>(pair.second));
+ }
+ ret.push_back(EGL_NONE);
+
+ return ret;
+}
+
+AttributeMap::const_iterator AttributeMap::begin() const
+{
+ return mAttributes.begin();
+}
+
+AttributeMap::const_iterator AttributeMap::end() const
+{
+ return mAttributes.end();
+}
+
+// static
+AttributeMap AttributeMap::CreateFromIntArray(const EGLint *attributes)
+{
+ AttributeMap map;
+ if (attributes)
+ {
+ for (const EGLint *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib += 2)
+ {
+ map.insert(static_cast<EGLAttrib>(curAttrib[0]), static_cast<EGLAttrib>(curAttrib[1]));
+ }
+ }
+ return map;
+}
+
+// static
+AttributeMap AttributeMap::CreateFromAttribArray(const EGLAttrib *attributes)
+{
+ AttributeMap map;
+ if (attributes)
+ {
+ for (const EGLAttrib *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib += 2)
+ {
+ map.insert(curAttrib[0], curAttrib[1]);
+ }
+ }
+ return map;
+}
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/AttributeMap.h b/gfx/angle/checkout/src/libANGLE/AttributeMap.h
new file mode 100644
index 0000000000..0000ecd817
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/AttributeMap.h
@@ -0,0 +1,66 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBANGLE_ATTRIBUTEMAP_H_
+#define LIBANGLE_ATTRIBUTEMAP_H_
+
+#include "common/PackedEnums.h"
+
+#include <EGL/egl.h>
+
+#include <map>
+#include <vector>
+
+namespace egl
+{
+
+class AttributeMap final
+{
+ public:
+ AttributeMap();
+ AttributeMap(const AttributeMap &other);
+ ~AttributeMap();
+
+ void insert(EGLAttrib key, EGLAttrib value);
+ bool contains(EGLAttrib key) const;
+
+ EGLAttrib get(EGLAttrib key) const;
+ EGLAttrib get(EGLAttrib key, EGLAttrib defaultValue) const;
+ EGLint getAsInt(EGLAttrib key) const;
+ EGLint getAsInt(EGLAttrib key, EGLint defaultValue) const;
+
+ template <typename PackedEnumT>
+ PackedEnumT getAsPackedEnum(EGLAttrib key) const
+ {
+ return FromEGLenum<PackedEnumT>(static_cast<EGLenum>(get(key)));
+ }
+
+ template <typename PackedEnumT>
+ PackedEnumT getAsPackedEnum(EGLAttrib key, PackedEnumT defaultValue) const
+ {
+ auto iter = mAttributes.find(key);
+ return (mAttributes.find(key) != mAttributes.end())
+ ? FromEGLenum<PackedEnumT>(static_cast<EGLenum>(iter->second))
+ : defaultValue;
+ }
+
+ bool isEmpty() const;
+ std::vector<EGLint> toIntVector() const;
+
+ typedef std::map<EGLAttrib, EGLAttrib>::const_iterator const_iterator;
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ static AttributeMap CreateFromIntArray(const EGLint *attributes);
+ static AttributeMap CreateFromAttribArray(const EGLAttrib *attributes);
+
+ private:
+ std::map<EGLAttrib, EGLAttrib> mAttributes;
+};
+} // namespace egl
+
+#endif // LIBANGLE_ATTRIBUTEMAP_H_
diff --git a/gfx/angle/checkout/src/libANGLE/BinaryStream.h b/gfx/angle/checkout/src/libANGLE/BinaryStream.h
new file mode 100644
index 0000000000..083cc7bf27
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/BinaryStream.h
@@ -0,0 +1,255 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BinaryStream.h: Provides binary serialization of simple types.
+
+#ifndef LIBANGLE_BINARYSTREAM_H_
+#define LIBANGLE_BINARYSTREAM_H_
+
+#include <stdint.h>
+#include <cstddef>
+#include <string>
+#include <vector>
+
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+
+namespace gl
+{
+
+class BinaryInputStream : angle::NonCopyable
+{
+ public:
+ BinaryInputStream(const void *data, size_t length)
+ {
+ mError = false;
+ mOffset = 0;
+ mData = static_cast<const uint8_t *>(data);
+ mLength = length;
+ }
+
+ // readInt will generate an error for bool types
+ template <class IntT>
+ IntT readInt()
+ {
+ int value = 0;
+ read(&value);
+ return static_cast<IntT>(value);
+ }
+
+ template <class IntT>
+ void readInt(IntT *outValue)
+ {
+ *outValue = readInt<IntT>();
+ }
+
+ template <class IntT, class VectorElementT>
+ void readIntVector(std::vector<VectorElementT> *param)
+ {
+ unsigned int size = readInt<unsigned int>();
+ for (unsigned int index = 0; index < size; ++index)
+ {
+ param->push_back(readInt<IntT>());
+ }
+ }
+
+ template <class EnumT>
+ EnumT readEnum()
+ {
+ using UnderlyingType = typename std::underlying_type<EnumT>::type;
+ return static_cast<EnumT>(readInt<UnderlyingType>());
+ }
+
+ template <class EnumT>
+ void readEnum(EnumT *outValue)
+ {
+ *outValue = readEnum<EnumT>();
+ }
+
+ bool readBool()
+ {
+ int value = 0;
+ read(&value);
+ return (value > 0);
+ }
+
+ void readBool(bool *outValue) { *outValue = readBool(); }
+
+ void readBytes(unsigned char outArray[], size_t count) { read<unsigned char>(outArray, count); }
+
+ std::string readString()
+ {
+ std::string outString;
+ readString(&outString);
+ return outString;
+ }
+
+ void readString(std::string *v)
+ {
+ size_t length;
+ readInt(&length);
+
+ if (mError)
+ {
+ return;
+ }
+
+ angle::CheckedNumeric<size_t> checkedOffset(mOffset);
+ checkedOffset += length;
+
+ if (!checkedOffset.IsValid() || mOffset + length > mLength)
+ {
+ mError = true;
+ return;
+ }
+
+ v->assign(reinterpret_cast<const char *>(mData) + mOffset, length);
+ mOffset = checkedOffset.ValueOrDie();
+ }
+
+ void skip(size_t length)
+ {
+ angle::CheckedNumeric<size_t> checkedOffset(mOffset);
+ checkedOffset += length;
+
+ if (!checkedOffset.IsValid() || mOffset + length > mLength)
+ {
+ mError = true;
+ return;
+ }
+
+ mOffset = checkedOffset.ValueOrDie();
+ }
+
+ size_t offset() const { return mOffset; }
+ size_t remainingSize() const
+ {
+ ASSERT(mLength >= mOffset);
+ return mLength - mOffset;
+ }
+
+ bool error() const { return mError; }
+
+ bool endOfStream() const { return mOffset == mLength; }
+
+ const uint8_t *data() { return mData; }
+
+ private:
+ bool mError;
+ size_t mOffset;
+ const uint8_t *mData;
+ size_t mLength;
+
+ template <typename T>
+ void read(T *v, size_t num)
+ {
+ static_assert(std::is_fundamental<T>::value, "T must be a fundamental type.");
+
+ angle::CheckedNumeric<size_t> checkedLength(num);
+ checkedLength *= sizeof(T);
+ if (!checkedLength.IsValid())
+ {
+ mError = true;
+ return;
+ }
+
+ angle::CheckedNumeric<size_t> checkedOffset(mOffset);
+ checkedOffset += checkedLength;
+
+ if (!checkedOffset.IsValid() || checkedOffset.ValueOrDie() > mLength)
+ {
+ mError = true;
+ return;
+ }
+
+ memcpy(v, mData + mOffset, checkedLength.ValueOrDie());
+ mOffset = checkedOffset.ValueOrDie();
+ }
+
+ template <typename T>
+ void read(T *v)
+ {
+ read(v, 1);
+ }
+};
+
+class BinaryOutputStream : angle::NonCopyable
+{
+ public:
+ BinaryOutputStream();
+ ~BinaryOutputStream();
+
+ // writeInt also handles bool types
+ template <class IntT>
+ void writeInt(IntT param)
+ {
+ ASSERT(angle::IsValueInRangeForNumericType<int>(param));
+ int intValue = static_cast<int>(param);
+ write(&intValue, 1);
+ }
+
+ // Specialized writeInt for values that can also be exactly -1.
+ template <class UintT>
+ void writeIntOrNegOne(UintT param)
+ {
+ if (param == static_cast<UintT>(-1))
+ {
+ writeInt(-1);
+ }
+ else
+ {
+ writeInt(param);
+ }
+ }
+
+ template <class IntT>
+ void writeIntVector(std::vector<IntT> param)
+ {
+ writeInt(param.size());
+ for (IntT element : param)
+ {
+ writeIntOrNegOne(element);
+ }
+ }
+
+ template <class EnumT>
+ void writeEnum(EnumT param)
+ {
+ using UnderlyingType = typename std::underlying_type<EnumT>::type;
+ writeInt<UnderlyingType>(static_cast<UnderlyingType>(param));
+ }
+
+ void writeString(const std::string &v)
+ {
+ writeInt(v.length());
+ write(v.c_str(), v.length());
+ }
+
+ void writeBytes(const unsigned char *bytes, size_t count) { write(bytes, count); }
+
+ size_t length() const { return mData.size(); }
+
+ const void *data() const { return mData.size() ? &mData[0] : nullptr; }
+
+ private:
+ std::vector<char> mData;
+
+ template <typename T>
+ void write(const T *v, size_t num)
+ {
+ static_assert(std::is_fundamental<T>::value, "T must be a fundamental type.");
+ const char *asBytes = reinterpret_cast<const char *>(v);
+ mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
+ }
+};
+
+inline BinaryOutputStream::BinaryOutputStream() {}
+
+inline BinaryOutputStream::~BinaryOutputStream() = default;
+
+} // namespace gl
+
+#endif // LIBANGLE_BINARYSTREAM_H_
diff --git a/gfx/angle/checkout/src/libANGLE/BlobCache.cpp b/gfx/angle/checkout/src/libANGLE/BlobCache.cpp
new file mode 100644
index 0000000000..56720915bd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/BlobCache.cpp
@@ -0,0 +1,168 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// BlobCache: Stores keyed blobs in memory to support EGL_ANDROID_blob_cache.
+// Can be used in conjunction with the platform layer to warm up the cache from
+// disk. MemoryProgramCache uses this to handle caching of compiled programs.
+
+#include "libANGLE/BlobCache.h"
+#include "common/utilities.h"
+#include "common/version.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/histogram_macros.h"
+#include "platform/Platform.h"
+
+namespace egl
+{
+
+namespace
+{
+enum CacheResult
+{
+ kCacheMiss,
+ kCacheHitMemory,
+ kCacheHitDisk,
+ kCacheResultMax,
+};
+
+} // anonymous namespace
+
+BlobCache::BlobCache(size_t maxCacheSizeBytes)
+ : mBlobCache(maxCacheSizeBytes), mSetBlobFunc(nullptr), mGetBlobFunc(nullptr)
+{}
+
+BlobCache::~BlobCache() {}
+
+void BlobCache::put(const BlobCache::Key &key, angle::MemoryBuffer &&value)
+{
+ if (areBlobCacheFuncsSet())
+ {
+ // Store the result in the application's cache
+ mSetBlobFunc(key.data(), key.size(), value.data(), value.size());
+ }
+ else
+ {
+ populate(key, std::move(value), CacheSource::Memory);
+ }
+}
+
+void BlobCache::putApplication(const BlobCache::Key &key, const angle::MemoryBuffer &value)
+{
+ if (areBlobCacheFuncsSet())
+ {
+ mSetBlobFunc(key.data(), key.size(), value.data(), value.size());
+ }
+}
+
+void BlobCache::populate(const BlobCache::Key &key, angle::MemoryBuffer &&value, CacheSource source)
+{
+ CacheEntry newEntry;
+ newEntry.first = std::move(value);
+ newEntry.second = source;
+
+ // Cache it inside blob cache only if caching inside the application is not possible.
+ mBlobCache.put(key, std::move(newEntry), newEntry.first.size());
+}
+
+bool BlobCache::get(angle::ScratchBuffer *scratchBuffer,
+ const BlobCache::Key &key,
+ BlobCache::Value *valueOut)
+{
+ // Look into the application's cache, if there is such a cache
+ if (areBlobCacheFuncsSet())
+ {
+ EGLsizeiANDROID valueSize = mGetBlobFunc(key.data(), key.size(), nullptr, 0);
+ if (valueSize <= 0)
+ {
+ return false;
+ }
+
+ angle::MemoryBuffer *scratchMemory;
+ bool result = scratchBuffer->get(valueSize, &scratchMemory);
+ if (!result)
+ {
+ ERR() << "Failed to allocate memory for binary blob";
+ return false;
+ }
+
+ EGLsizeiANDROID originalValueSize = valueSize;
+ valueSize = mGetBlobFunc(key.data(), key.size(), scratchMemory->data(), valueSize);
+
+ // Make sure the key/value pair still exists/is unchanged after the second call
+ // (modifications to the application cache by another thread are a possibility)
+ if (valueSize != originalValueSize)
+ {
+ // This warning serves to find issues with the application cache, none of which are
+ // currently known to be thread-safe. If such a use ever arises, this WARN can be
+ // removed.
+ WARN() << "Binary blob no longer available in cache (removed by a thread?)";
+ return false;
+ }
+
+ *valueOut = BlobCache::Value(scratchMemory->data(), scratchMemory->size());
+ return true;
+ }
+
+ // Otherwise we are doing caching internally, so try to find it there
+ const CacheEntry *entry;
+ bool result = mBlobCache.get(key, &entry);
+
+ if (result)
+ {
+ if (entry->second == CacheSource::Memory)
+ {
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.ProgramCache.CacheResult", kCacheHitMemory,
+ kCacheResultMax);
+ }
+ else
+ {
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.ProgramCache.CacheResult", kCacheHitDisk,
+ kCacheResultMax);
+ }
+
+ *valueOut = BlobCache::Value(entry->first.data(), entry->first.size());
+ }
+ else
+ {
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.ProgramCache.CacheResult", kCacheMiss,
+ kCacheResultMax);
+ }
+
+ return result;
+}
+
+bool BlobCache::getAt(size_t index, const BlobCache::Key **keyOut, BlobCache::Value *valueOut)
+{
+ const CacheEntry *valueBuf;
+ bool result = mBlobCache.getAt(index, keyOut, &valueBuf);
+ if (result)
+ {
+ *valueOut = BlobCache::Value(valueBuf->first.data(), valueBuf->first.size());
+ }
+ return result;
+}
+
+void BlobCache::remove(const BlobCache::Key &key)
+{
+ bool result = mBlobCache.eraseByKey(key);
+ ASSERT(result);
+}
+
+void BlobCache::setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get)
+{
+ mSetBlobFunc = set;
+ mGetBlobFunc = get;
+}
+
+bool BlobCache::areBlobCacheFuncsSet() const
+{
+ // Either none or both of the callbacks should be set.
+ ASSERT((mSetBlobFunc != nullptr) == (mGetBlobFunc != nullptr));
+
+ return mSetBlobFunc != nullptr && mGetBlobFunc != nullptr;
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/BlobCache.h b/gfx/angle/checkout/src/libANGLE/BlobCache.h
new file mode 100644
index 0000000000..eec906dadc
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/BlobCache.h
@@ -0,0 +1,153 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// BlobCache: Stores compiled and linked programs in memory so they don't
+// always have to be re-compiled. Can be used in conjunction with the platform
+// layer to warm up the cache from disk.
+
+#ifndef LIBANGLE_BLOB_CACHE_H_
+#define LIBANGLE_BLOB_CACHE_H_
+
+#include <array>
+#include <cstring>
+
+#include <anglebase/sha1.h>
+#include "common/MemoryBuffer.h"
+#include "common/hash_utils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/SizedMRUCache.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace egl
+{
+// 160-bit SHA-1 hash key used for hasing a program. BlobCache opts in using fixed keys for
+// simplicity and efficiency.
+static constexpr size_t kBlobCacheKeyLength = angle::base::kSHA1Length;
+using BlobCacheKey = std::array<uint8_t, kBlobCacheKeyLength>;
+} // namespace egl
+
+namespace std
+{
+template <>
+struct hash<egl::BlobCacheKey>
+{
+ // Simple routine to hash four ints.
+ size_t operator()(const egl::BlobCacheKey &key) const
+ {
+ return angle::ComputeGenericHash(key.data(), key.size());
+ }
+};
+} // namespace std
+
+namespace egl
+{
+
+class BlobCache final : angle::NonCopyable
+{
+ public:
+ // 160-bit SHA-1 hash key used for hasing a program. BlobCache opts in using fixed keys for
+ // simplicity and efficiency.
+ static constexpr size_t kKeyLength = kBlobCacheKeyLength;
+ using Key = BlobCacheKey;
+ class Value
+ {
+ public:
+ Value() : mPtr(nullptr), mSize(0) {}
+ Value(const uint8_t *ptr, size_t sz) : mPtr(ptr), mSize(sz) {}
+
+ // A very basic struct to hold the pointer and size together. The objects of this class
+ // don't own the memory.
+ const uint8_t *data() { return mPtr; }
+ size_t size() { return mSize; }
+
+ const uint8_t &operator[](size_t pos) const
+ {
+ ASSERT(pos < mSize);
+ return mPtr[pos];
+ }
+
+ private:
+ const uint8_t *mPtr;
+ size_t mSize;
+ };
+ enum class CacheSource
+ {
+ Memory,
+ Disk,
+ };
+
+ explicit BlobCache(size_t maxCacheSizeBytes);
+ ~BlobCache();
+
+ // Store a key-blob pair in the cache. If application callbacks are set, the application cache
+ // will be used. Otherwise the value is cached in this object.
+ void put(const BlobCache::Key &key, angle::MemoryBuffer &&value);
+
+ // Store a key-blob pair in the application cache, only if application callbacks are set.
+ void putApplication(const BlobCache::Key &key, const angle::MemoryBuffer &value);
+
+ // Store a key-blob pair in the cache without making callbacks to the application. This is used
+ // to repopulate this object's cache on startup without generating callback calls.
+ void populate(const BlobCache::Key &key,
+ angle::MemoryBuffer &&value,
+ CacheSource source = CacheSource::Disk);
+
+ // Check if the cache contains the blob corresponding to this key. If application callbacks are
+ // set, those will be used. Otherwise they key is looked up in this object's cache.
+ ANGLE_NO_DISCARD bool get(angle::ScratchBuffer *scratchBuffer,
+ const BlobCache::Key &key,
+ BlobCache::Value *valueOut);
+
+ // For querying the contents of the cache.
+ ANGLE_NO_DISCARD bool getAt(size_t index,
+ const BlobCache::Key **keyOut,
+ BlobCache::Value *valueOut);
+
+ // Evict a blob from the binary cache.
+ void remove(const BlobCache::Key &key);
+
+ // Empty the cache.
+ void clear() { mBlobCache.clear(); }
+
+ // Resize the cache. Discards current contents.
+ void resize(size_t maxCacheSizeBytes) { mBlobCache.resize(maxCacheSizeBytes); }
+
+ // Returns the number of entries in the cache.
+ size_t entryCount() const { return mBlobCache.entryCount(); }
+
+ // Reduces the current cache size and returns the number of bytes freed.
+ size_t trim(size_t limit) { return mBlobCache.shrinkToSize(limit); }
+
+ // Returns the current cache size in bytes.
+ size_t size() const { return mBlobCache.size(); }
+
+ // Returns whether the cache is empty
+ bool empty() const { return mBlobCache.empty(); }
+
+ // Returns the maximum cache size in bytes.
+ size_t maxSize() const { return mBlobCache.maxSize(); }
+
+ void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+
+ bool areBlobCacheFuncsSet() const;
+
+ bool isCachingEnabled() const { return areBlobCacheFuncsSet() || maxSize() > 0; }
+
+ private:
+ // This internal cache is used only if the application is not providing caching callbacks
+ using CacheEntry = std::pair<angle::MemoryBuffer, CacheSource>;
+ angle::SizedMRUCache<BlobCache::Key, CacheEntry> mBlobCache;
+
+ EGLSetBlobFuncANDROID mSetBlobFunc;
+ EGLGetBlobFuncANDROID mGetBlobFunc;
+};
+
+} // namespace egl
+
+#endif // LIBANGLE_MEMORY_PROGRAM_CACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Buffer.cpp b/gfx/angle/checkout/src/libANGLE/Buffer.cpp
new file mode 100644
index 0000000000..9ffcddba24
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Buffer.cpp
@@ -0,0 +1,284 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer.cpp: Implements the gl::Buffer class, representing storage of vertex and/or
+// index data. Implements GL buffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 2.9 page 21.
+
+#include "libANGLE/Buffer.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/BufferImpl.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+
+namespace gl
+{
+namespace
+{
+constexpr angle::SubjectIndex kImplementationSubjectIndex = 0;
+} // anonymous namespace
+
+BufferState::BufferState()
+ : mLabel(),
+ mUsage(BufferUsage::StaticDraw),
+ mSize(0),
+ mAccessFlags(0),
+ mAccess(GL_WRITE_ONLY_OES),
+ mMapped(GL_FALSE),
+ mMapPointer(nullptr),
+ mMapOffset(0),
+ mMapLength(0),
+ mBindingCount(0),
+ mTransformFeedbackIndexedBindingCount(0),
+ mTransformFeedbackGenericBindingCount(0)
+{}
+
+BufferState::~BufferState() {}
+
+Buffer::Buffer(rx::GLImplFactory *factory, GLuint id)
+ : RefCountObject(id),
+ mImpl(factory->createBuffer(mState)),
+ mImplObserver(this, kImplementationSubjectIndex)
+{
+ mImplObserver.bind(mImpl);
+}
+
+Buffer::~Buffer()
+{
+ SafeDelete(mImpl);
+}
+
+void Buffer::onDestroy(const Context *context)
+{
+ // In tests, mImpl might be null.
+ if (mImpl)
+ mImpl->destroy(context);
+}
+
+void Buffer::setLabel(const Context *context, const std::string &label)
+{
+ mState.mLabel = label;
+}
+
+const std::string &Buffer::getLabel() const
+{
+ return mState.mLabel;
+}
+
+angle::Result Buffer::bufferData(Context *context,
+ BufferBinding target,
+ const void *data,
+ GLsizeiptr size,
+ BufferUsage usage)
+{
+ const void *dataForImpl = data;
+
+ // If we are using robust resource init, make sure the buffer starts cleared.
+ // Note: the Context is checked for nullptr because of some testing code.
+ // TODO(jmadill): Investigate lazier clearing.
+ if (context && context->getState().isRobustResourceInitEnabled() && !data && size > 0)
+ {
+ angle::MemoryBuffer *scratchBuffer = nullptr;
+ ANGLE_CHECK_GL_ALLOC(
+ context, context->getZeroFilledBuffer(static_cast<size_t>(size), &scratchBuffer));
+ dataForImpl = scratchBuffer->data();
+ }
+
+ ANGLE_TRY(mImpl->setData(context, target, dataForImpl, size, usage));
+
+ mIndexRangeCache.clear();
+ mState.mUsage = usage;
+ mState.mSize = size;
+
+ // Notify when storage changes.
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer::bufferSubData(const Context *context,
+ BufferBinding target,
+ const void *data,
+ GLsizeiptr size,
+ GLintptr offset)
+{
+ ANGLE_TRY(mImpl->setSubData(context, target, data, size, offset));
+
+ mIndexRangeCache.invalidateRange(static_cast<unsigned int>(offset),
+ static_cast<unsigned int>(size));
+
+ // Notify when data changes.
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer::copyBufferSubData(const Context *context,
+ Buffer *source,
+ GLintptr sourceOffset,
+ GLintptr destOffset,
+ GLsizeiptr size)
+{
+ ANGLE_TRY(
+ mImpl->copySubData(context, source->getImplementation(), sourceOffset, destOffset, size));
+
+ mIndexRangeCache.invalidateRange(static_cast<unsigned int>(destOffset),
+ static_cast<unsigned int>(size));
+
+ // Notify when data changes.
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer::map(const Context *context, GLenum access)
+{
+ ASSERT(!mState.mMapped);
+
+ mState.mMapPointer = nullptr;
+ ANGLE_TRY(mImpl->map(context, access, &mState.mMapPointer));
+
+ ASSERT(access == GL_WRITE_ONLY_OES);
+
+ mState.mMapped = GL_TRUE;
+ mState.mMapOffset = 0;
+ mState.mMapLength = mState.mSize;
+ mState.mAccess = access;
+ mState.mAccessFlags = GL_MAP_WRITE_BIT;
+ mIndexRangeCache.clear();
+
+ // Notify when state changes.
+ onStateChange(angle::SubjectMessage::SubjectMapped);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer::mapRange(const Context *context,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ ASSERT(!mState.mMapped);
+ ASSERT(offset + length <= mState.mSize);
+
+ mState.mMapPointer = nullptr;
+ ANGLE_TRY(mImpl->mapRange(context, offset, length, access, &mState.mMapPointer));
+
+ mState.mMapped = GL_TRUE;
+ mState.mMapOffset = static_cast<GLint64>(offset);
+ mState.mMapLength = static_cast<GLint64>(length);
+ mState.mAccess = GL_WRITE_ONLY_OES;
+ mState.mAccessFlags = access;
+
+ // The OES_mapbuffer extension states that GL_WRITE_ONLY_OES is the only valid
+ // value for GL_BUFFER_ACCESS_OES because it was written against ES2. Since there is
+ // no update for ES3 and the GL_READ_ONLY and GL_READ_WRITE enums don't exist for ES,
+ // we cannot properly set GL_BUFFER_ACCESS_OES when glMapBufferRange is called.
+
+ if ((access & GL_MAP_WRITE_BIT) > 0)
+ {
+ mIndexRangeCache.invalidateRange(static_cast<unsigned int>(offset),
+ static_cast<unsigned int>(length));
+ }
+
+ // Notify when state changes.
+ onStateChange(angle::SubjectMessage::SubjectMapped);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer::unmap(const Context *context, GLboolean *result)
+{
+ ASSERT(mState.mMapped);
+
+ *result = GL_FALSE;
+ ANGLE_TRY(mImpl->unmap(context, result));
+
+ mState.mMapped = GL_FALSE;
+ mState.mMapPointer = nullptr;
+ mState.mMapOffset = 0;
+ mState.mMapLength = 0;
+ mState.mAccess = GL_WRITE_ONLY_OES;
+ mState.mAccessFlags = 0;
+
+ // Notify when data changes.
+ onStateChange(angle::SubjectMessage::SubjectUnmapped);
+
+ return angle::Result::Continue;
+}
+
+void Buffer::onTransformFeedback()
+{
+ mIndexRangeCache.clear();
+
+ // Notify when data changes.
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+}
+
+void Buffer::onPixelPack()
+{
+ mIndexRangeCache.clear();
+
+ // Notify when data changes.
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+}
+
+angle::Result Buffer::getIndexRange(const gl::Context *context,
+ DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ IndexRange *outRange) const
+{
+ if (mIndexRangeCache.findRange(type, offset, count, primitiveRestartEnabled, outRange))
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRY(
+ mImpl->getIndexRange(context, type, offset, count, primitiveRestartEnabled, outRange));
+
+ mIndexRangeCache.addRange(type, offset, count, primitiveRestartEnabled, *outRange);
+
+ return angle::Result::Continue;
+}
+
+GLint64 Buffer::getMemorySize() const
+{
+ GLint64 implSize = mImpl->getMemorySize();
+ return implSize > 0 ? implSize : mState.mSize;
+}
+
+bool Buffer::isDoubleBoundForTransformFeedback() const
+{
+ return mState.mTransformFeedbackIndexedBindingCount > 1;
+}
+
+void Buffer::onTFBindingChanged(const Context *context, bool bound, bool indexed)
+{
+ ASSERT(bound || mState.mBindingCount > 0);
+ mState.mBindingCount += bound ? 1 : -1;
+ if (indexed)
+ {
+ ASSERT(bound || mState.mTransformFeedbackIndexedBindingCount > 0);
+ mState.mTransformFeedbackIndexedBindingCount += bound ? 1 : -1;
+
+ onStateChange(angle::SubjectMessage::BindingChanged);
+ }
+ else
+ {
+ mState.mTransformFeedbackGenericBindingCount += bound ? 1 : -1;
+ }
+}
+
+void Buffer::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message)
+{
+ // Pass it along!
+ ASSERT(index == kImplementationSubjectIndex);
+ ASSERT(message == angle::SubjectMessage::SubjectChanged);
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Buffer.h b/gfx/angle/checkout/src/libANGLE/Buffer.h
new file mode 100644
index 0000000000..ef3eefe4fe
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Buffer.h
@@ -0,0 +1,155 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer.h: Defines the gl::Buffer class, representing storage of vertex and/or
+// index data. Implements GL buffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 2.9 page 21.
+
+#ifndef LIBANGLE_BUFFER_H_
+#define LIBANGLE_BUFFER_H_
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/IndexRangeCache.h"
+#include "libANGLE/Observer.h"
+#include "libANGLE/RefCountObject.h"
+
+namespace rx
+{
+class BufferImpl;
+class GLImplFactory;
+} // namespace rx
+
+namespace gl
+{
+class Buffer;
+class Context;
+
+class BufferState final : angle::NonCopyable
+{
+ public:
+ BufferState();
+ ~BufferState();
+
+ BufferUsage getUsage() const { return mUsage; }
+ GLbitfield getAccessFlags() const { return mAccessFlags; }
+ GLenum getAccess() const { return mAccess; }
+ GLboolean isMapped() const { return mMapped; }
+ void *getMapPointer() const { return mMapPointer; }
+ GLint64 getMapOffset() const { return mMapOffset; }
+ GLint64 getMapLength() const { return mMapLength; }
+ GLint64 getSize() const { return mSize; }
+ bool isBoundForTransformFeedback() const { return mTransformFeedbackIndexedBindingCount != 0; }
+
+ private:
+ friend class Buffer;
+
+ std::string mLabel;
+
+ BufferUsage mUsage;
+ GLint64 mSize;
+ GLbitfield mAccessFlags;
+ GLenum mAccess;
+ GLboolean mMapped;
+ void *mMapPointer;
+ GLint64 mMapOffset;
+ GLint64 mMapLength;
+ int mBindingCount;
+ int mTransformFeedbackIndexedBindingCount;
+ int mTransformFeedbackGenericBindingCount;
+};
+
+class Buffer final : public RefCountObject,
+ public LabeledObject,
+ public angle::ObserverInterface,
+ public angle::Subject
+{
+ public:
+ Buffer(rx::GLImplFactory *factory, GLuint id);
+ ~Buffer() override;
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ angle::Result bufferData(Context *context,
+ BufferBinding target,
+ const void *data,
+ GLsizeiptr size,
+ BufferUsage usage);
+ angle::Result bufferSubData(const Context *context,
+ BufferBinding target,
+ const void *data,
+ GLsizeiptr size,
+ GLintptr offset);
+ angle::Result copyBufferSubData(const Context *context,
+ Buffer *source,
+ GLintptr sourceOffset,
+ GLintptr destOffset,
+ GLsizeiptr size);
+ angle::Result map(const Context *context, GLenum access);
+ angle::Result mapRange(const Context *context,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+ angle::Result unmap(const Context *context, GLboolean *result);
+
+ // These are called when another operation changes Buffer data.
+ void onTransformFeedback();
+ void onPixelPack();
+
+ angle::Result getIndexRange(const gl::Context *context,
+ DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ IndexRange *outRange) const;
+
+ BufferUsage getUsage() const { return mState.mUsage; }
+ GLbitfield getAccessFlags() const { return mState.mAccessFlags; }
+ GLenum getAccess() const { return mState.mAccess; }
+ GLboolean isMapped() const { return mState.mMapped; }
+ void *getMapPointer() const { return mState.mMapPointer; }
+ GLint64 getMapOffset() const { return mState.mMapOffset; }
+ GLint64 getMapLength() const { return mState.mMapLength; }
+ GLint64 getSize() const { return mState.mSize; }
+ GLint64 getMemorySize() const;
+
+ rx::BufferImpl *getImplementation() const { return mImpl; }
+
+ ANGLE_INLINE bool isBound() const { return mState.mBindingCount > 0; }
+
+ ANGLE_INLINE bool isBoundForTransformFeedbackAndOtherUse() const
+ {
+ // The transform feedback generic binding point is not an indexed binding point but it also
+ // does not count as a non-transform-feedback use of the buffer, so we subtract it from the
+ // binding count when checking if the buffer is bound to a non-transform-feedback location.
+ // See https://crbug.com/853978
+ return mState.mTransformFeedbackIndexedBindingCount > 0 &&
+ mState.mTransformFeedbackIndexedBindingCount !=
+ mState.mBindingCount - mState.mTransformFeedbackGenericBindingCount;
+ }
+
+ bool isDoubleBoundForTransformFeedback() const;
+ void onTFBindingChanged(const Context *context, bool bound, bool indexed);
+ void onNonTFBindingChanged(int incr) { mState.mBindingCount += incr; }
+
+ // angle::ObserverInterface implementation.
+ void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
+
+ private:
+ BufferState mState;
+ rx::BufferImpl *mImpl;
+ angle::ObserverBinding mImplObserver;
+
+ mutable IndexRangeCache mIndexRangeCache;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_BUFFER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Caps.cpp b/gfx/angle/checkout/src/libANGLE/Caps.cpp
new file mode 100644
index 0000000000..4ee8411b70
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Caps.cpp
@@ -0,0 +1,1243 @@
+//
+// 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 "libANGLE/Caps.h"
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+
+#include "libANGLE/formatutils.h"
+
+#include "angle_gl.h"
+
+#include <algorithm>
+#include <sstream>
+
+static void InsertExtensionString(const std::string &extension,
+ bool supported,
+ std::vector<std::string> *extensionVector)
+{
+ if (supported)
+ {
+ extensionVector->push_back(extension);
+ }
+}
+
+namespace gl
+{
+
+TextureCaps::TextureCaps() = default;
+
+TextureCaps::TextureCaps(const TextureCaps &other) = default;
+
+TextureCaps::~TextureCaps() = default;
+
+GLuint TextureCaps::getMaxSamples() const
+{
+ return !sampleCounts.empty() ? *sampleCounts.rbegin() : 0;
+}
+
+GLuint TextureCaps::getNearestSamples(GLuint requestedSamples) const
+{
+ if (requestedSamples == 0)
+ {
+ return 0;
+ }
+
+ for (SupportedSampleSet::const_iterator i = sampleCounts.begin(); i != sampleCounts.end(); i++)
+ {
+ GLuint samples = *i;
+ if (samples >= requestedSamples)
+ {
+ return samples;
+ }
+ }
+
+ return 0;
+}
+
+TextureCaps GenerateMinimumTextureCaps(GLenum sizedInternalFormat,
+ const Version &clientVersion,
+ const Extensions &extensions)
+{
+ TextureCaps caps;
+
+ const InternalFormat &internalFormatInfo = GetSizedInternalFormatInfo(sizedInternalFormat);
+ caps.texturable = internalFormatInfo.textureSupport(clientVersion, extensions);
+ caps.filterable = internalFormatInfo.filterSupport(clientVersion, extensions);
+ caps.textureAttachment = internalFormatInfo.textureAttachmentSupport(clientVersion, extensions);
+ caps.renderbuffer = internalFormatInfo.renderbufferSupport(clientVersion, extensions);
+
+ caps.sampleCounts.insert(0);
+ if (internalFormatInfo.isRequiredRenderbufferFormat(clientVersion))
+ {
+ if ((clientVersion.major >= 3 && clientVersion.minor >= 1) ||
+ (clientVersion.major >= 3 && !internalFormatInfo.isInt()))
+ {
+ caps.sampleCounts.insert(4);
+ }
+ }
+
+ return caps;
+}
+
+TextureCapsMap::TextureCapsMap() {}
+
+TextureCapsMap::~TextureCapsMap() {}
+
+void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &caps)
+{
+ angle::FormatID formatID = angle::Format::InternalFormatToID(internalFormat);
+ get(formatID) = caps;
+}
+
+void TextureCapsMap::clear()
+{
+ mFormatData.fill(TextureCaps());
+}
+
+const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const
+{
+ angle::FormatID formatID = angle::Format::InternalFormatToID(internalFormat);
+ return get(formatID);
+}
+
+const TextureCaps &TextureCapsMap::get(angle::FormatID formatID) const
+{
+ return mFormatData[static_cast<size_t>(formatID)];
+}
+
+TextureCaps &TextureCapsMap::get(angle::FormatID formatID)
+{
+ return mFormatData[static_cast<size_t>(formatID)];
+}
+
+void TextureCapsMap::set(angle::FormatID formatID, const TextureCaps &caps)
+{
+ get(formatID) = caps;
+}
+
+void InitMinimumTextureCapsMap(const Version &clientVersion,
+ const Extensions &extensions,
+ TextureCapsMap *capsMap)
+{
+ for (GLenum internalFormat : GetAllSizedInternalFormats())
+ {
+ capsMap->insert(internalFormat,
+ GenerateMinimumTextureCaps(internalFormat, clientVersion, extensions));
+ }
+}
+
+Extensions::Extensions() = default;
+
+Extensions::Extensions(const Extensions &other) = default;
+
+std::vector<std::string> Extensions::getStrings() const
+{
+ std::vector<std::string> extensionStrings;
+
+ for (const auto &extensionInfo : GetExtensionInfoMap())
+ {
+ if (this->*(extensionInfo.second.ExtensionsMember))
+ {
+ extensionStrings.push_back(extensionInfo.first);
+ }
+ }
+
+ return extensionStrings;
+}
+
+Limitations::Limitations() = default;
+
+static bool GetFormatSupportBase(const TextureCapsMap &textureCaps,
+ const GLenum *requiredFormats,
+ size_t requiredFormatsSize,
+ bool requiresTexturing,
+ bool requiresFiltering,
+ bool requiresAttachingTexture,
+ bool requiresRenderbufferSupport)
+{
+ for (size_t i = 0; i < requiredFormatsSize; i++)
+ {
+ const TextureCaps &cap = textureCaps.get(requiredFormats[i]);
+
+ if (requiresTexturing && !cap.texturable)
+ {
+ return false;
+ }
+
+ if (requiresFiltering && !cap.filterable)
+ {
+ return false;
+ }
+
+ if (requiresAttachingTexture && !cap.textureAttachment)
+ {
+ return false;
+ }
+
+ if (requiresRenderbufferSupport && !cap.renderbuffer)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+template <size_t N>
+static bool GetFormatSupport(const TextureCapsMap &textureCaps,
+ const GLenum (&requiredFormats)[N],
+ bool requiresTexturing,
+ bool requiresFiltering,
+ bool requiresAttachingTexture,
+ bool requiresRenderbufferSupport)
+{
+ return GetFormatSupportBase(textureCaps, requiredFormats, N, requiresTexturing,
+ requiresFiltering, requiresAttachingTexture,
+ requiresRenderbufferSupport);
+}
+
+// Check for GL_OES_packed_depth_stencil
+static bool DeterminePackedDepthStencilSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_DEPTH24_STENCIL8,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true);
+}
+
+// Checks for GL_OES_rgb8_rgba8 support
+static bool DetermineRGB8AndRGBA8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_RGB8,
+ GL_RGBA8,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, false, false, false, true);
+}
+
+// Checks for GL_EXT_texture_format_BGRA8888 support
+static bool DetermineBGRA8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_BGRA8_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
+}
+
+// Checks for GL_OES_color_buffer_half_float support
+static bool DetermineColorBufferHalfFloatSupport(const TextureCapsMap &textureCaps)
+{
+ // EXT_color_buffer_half_float issue #2 states that an implementation doesn't need to support
+ // rendering to any of the formats but is expected to be able to render to at least one. WebGL
+ // requires that at least RGBA16F is renderable so we make the same requirement.
+ constexpr GLenum requiredFormats[] = {
+ GL_RGBA16F,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true);
+}
+
+// Checks for GL_OES_texture_half_float support
+static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_RGBA16F, GL_RGB16F, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE16F_EXT, GL_ALPHA16F_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, false, false);
+}
+
+// Checks for GL_OES_texture_half_float_linear support
+static bool DetermineHalfFloatTextureFilteringSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_RGBA16F, GL_RGB16F, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE16F_EXT, GL_ALPHA16F_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, false, true, false, false);
+}
+
+// Checks for GL_OES_texture_float support
+static bool DetermineFloatTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_RGBA32F, GL_RGB32F, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE32F_EXT, GL_ALPHA32F_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, false, false);
+}
+
+// Checks for GL_OES_texture_float_linear support
+static bool DetermineFloatTextureFilteringSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_RGBA32F, GL_RGB32F, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE32F_EXT, GL_ALPHA32F_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, false, true, false, false);
+}
+
+// Checks for GL_EXT_texture_rg support
+static bool DetermineRGTextureSupport(const TextureCapsMap &textureCaps,
+ bool checkHalfFloatFormats,
+ bool checkFloatFormats)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_R8,
+ GL_RG8,
+ };
+ constexpr GLenum requiredHalfFloatFormats[] = {
+ GL_R16F,
+ GL_RG16F,
+ };
+ constexpr GLenum requiredFloatFormats[] = {
+ GL_R32F,
+ GL_RG32F,
+ };
+
+ if (checkHalfFloatFormats &&
+ !GetFormatSupport(textureCaps, requiredHalfFloatFormats, true, false, false, false))
+ {
+ return false;
+ }
+
+ if (checkFloatFormats &&
+ !GetFormatSupport(textureCaps, requiredFloatFormats, true, false, false, false))
+ {
+ return false;
+ }
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
+}
+
+// Check for GL_EXT_texture_compression_dxt1
+static bool DetermineDXT1TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for GL_ANGLE_texture_compression_dxt3
+static bool DetermineDXT3TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for GL_ANGLE_texture_compression_dxt5
+static bool DetermineDXT5TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for GL_EXT_texture_compression_s3tc_srgb
+static bool DetermineS3TCsRGBTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
+ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
+ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
+ GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for GL_KHR_texture_compression_astc_ldr
+static bool DetermineASTCLDRTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
+ GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
+ GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
+ GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
+ GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
+ GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
+ GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for GL_OES_texture_compression_astc
+static bool DetermineASTCOESTExtureSupport(const TextureCapsMap &textureCaps)
+{
+ if (!DetermineASTCLDRTextureSupport(textureCaps))
+ {
+ return false;
+ }
+
+ // The OES version of the extension also requires the 3D ASTC formats
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGBA_ASTC_3x3x3_OES, GL_COMPRESSED_RGBA_ASTC_4x3x3_OES,
+ GL_COMPRESSED_RGBA_ASTC_4x4x3_OES, GL_COMPRESSED_RGBA_ASTC_4x4x4_OES,
+ GL_COMPRESSED_RGBA_ASTC_5x4x4_OES, GL_COMPRESSED_RGBA_ASTC_5x5x4_OES,
+ GL_COMPRESSED_RGBA_ASTC_5x5x5_OES, GL_COMPRESSED_RGBA_ASTC_6x5x5_OES,
+ GL_COMPRESSED_RGBA_ASTC_6x6x5_OES, GL_COMPRESSED_RGBA_ASTC_6x6x6_OES,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for GL_ETC1_RGB8_OES
+static bool DetermineETC1RGB8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_ETC1_RGB8_OES,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_ETC2_RGB8_texture
+static bool DetermineETC2RGB8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGB8_ETC2,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_ETC2_sRGB8_texture
+static bool DetermineETC2sRGB8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_SRGB8_ETC2,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_ETC2_punchthroughA_RGBA8_texture
+static bool DetermineETC2PunchthroughARGB8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture
+static bool DetermineETC2PunchthroughAsRGB8AlphaTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_ETC2_RGBA8_texture
+static bool DetermineETC2RGBA8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGBA8_ETC2_EAC,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_ETC2_sRGB8_alpha8_texture
+static bool DetermineETC2sRGB8Alpha8TextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_EAC_R11_unsigned_texture
+static bool DetermineEACR11UnsignedTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_R11_EAC,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_EAC_R11_signed_texture
+static bool DetermineEACR11SignedTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_SIGNED_R11_EAC,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_EAC_RG11_unsigned_texture
+static bool DetermineEACRG11UnsignedTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RG11_EAC,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for OES_compressed_EAC_RG11_signed_texture
+static bool DetermineEACRG11SignedTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_SIGNED_RG11_EAC,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+// Check for GL_EXT_sRGB
+static bool DetermineSRGBTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFilterFormats[] = {
+ GL_SRGB8,
+ GL_SRGB8_ALPHA8,
+ };
+
+ constexpr GLenum requiredRenderFormats[] = {
+ GL_SRGB8_ALPHA8,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false) &&
+ GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true, true);
+}
+
+// Check for GL_ANGLE_depth_texture
+static bool DetermineDepthTextureANGLESupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_DEPTH_COMPONENT16,
+ GL_DEPTH_COMPONENT32_OES,
+ GL_DEPTH24_STENCIL8_OES,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
+}
+
+// Check for GL_OES_depth_texture
+static bool DetermineDepthTextureOESSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_DEPTH_COMPONENT16,
+ GL_DEPTH_COMPONENT32_OES,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
+}
+
+// Check for GL_OES_depth24
+static bool DetermineDepth24OESSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_DEPTH_COMPONENT24_OES,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, false, false, false, true);
+}
+
+// Check for GL_OES_depth32
+static bool DetermineDepth32Support(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_DEPTH_COMPONENT32_OES,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true);
+}
+
+// Check for GL_CHROMIUM_color_buffer_float_rgb
+static bool DetermineColorBufferFloatRGBSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_RGB32F,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, true, false);
+}
+
+// Check for GL_CHROMIUM_color_buffer_float_rgba
+static bool DetermineColorBufferFloatRGBASupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_RGBA32F,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, true, true);
+}
+
+// Check for GL_EXT_color_buffer_float
+static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F, GL_R11F_G11F_B10F,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, false, true, true);
+}
+
+// Check for GL_EXT_texture_norm16
+static bool DetermineTextureNorm16Support(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFilterFormats[] = {
+ GL_R16_EXT, GL_RG16_EXT, GL_RGB16_EXT, GL_RGBA16_EXT,
+ GL_R16_SNORM_EXT, GL_RG16_SNORM_EXT, GL_RGB16_SNORM_EXT, GL_RGBA16_SNORM_EXT,
+ };
+
+ constexpr GLenum requiredRenderFormats[] = {
+ GL_R16_EXT,
+ GL_RG16_EXT,
+ GL_RGBA16_EXT,
+ };
+
+ return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false) &&
+ GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true, true);
+}
+
+// Check for EXT_texture_compression_bptc
+static bool DetermineBPTCTextureSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {
+ GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
+ GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT};
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps)
+{
+ constexpr GLenum requiredFormats[] = {GL_COMPRESSED_R11_EAC,
+ GL_COMPRESSED_SIGNED_R11_EAC,
+ GL_COMPRESSED_RG11_EAC,
+ GL_COMPRESSED_SIGNED_RG11_EAC,
+ GL_COMPRESSED_RGB8_ETC2,
+ GL_COMPRESSED_SRGB8_ETC2,
+ GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ GL_COMPRESSED_RGBA8_ETC2_EAC,
+ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC};
+
+ return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
+}
+
+void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
+{
+ // TODO(ynovikov): rgb8rgba8, colorBufferHalfFloat, textureHalfFloat, textureHalfFloatLinear,
+ // textureFloat, textureFloatLinear, textureRG, sRGB, colorBufferFloatRGB, colorBufferFloatRGBA
+ // and colorBufferFloat were verified. Verify the rest.
+ packedDepthStencil = DeterminePackedDepthStencilSupport(textureCaps);
+ rgb8rgba8 = DetermineRGB8AndRGBA8TextureSupport(textureCaps);
+ textureFormatBGRA8888 = DetermineBGRA8TextureSupport(textureCaps);
+ textureHalfFloat = DetermineHalfFloatTextureSupport(textureCaps);
+ textureHalfFloatLinear =
+ textureHalfFloat && DetermineHalfFloatTextureFilteringSupport(textureCaps);
+ textureFloat = DetermineFloatTextureSupport(textureCaps);
+ textureFloatLinear = textureFloat && DetermineFloatTextureFilteringSupport(textureCaps);
+ textureRG = DetermineRGTextureSupport(textureCaps, textureHalfFloat, textureFloat);
+ colorBufferHalfFloat = textureHalfFloat && DetermineColorBufferHalfFloatSupport(textureCaps);
+ textureCompressionDXT1 = DetermineDXT1TextureSupport(textureCaps);
+ textureCompressionDXT3 = DetermineDXT3TextureSupport(textureCaps);
+ textureCompressionDXT5 = DetermineDXT5TextureSupport(textureCaps);
+ textureCompressionS3TCsRGB = DetermineS3TCsRGBTextureSupport(textureCaps);
+ textureCompressionASTCLDRKHR = DetermineASTCLDRTextureSupport(textureCaps);
+ textureCompressionASTCOES = DetermineASTCOESTExtureSupport(textureCaps);
+ compressedETC1RGB8Texture = DetermineETC1RGB8TextureSupport(textureCaps);
+ compressedETC2RGB8Texture = DetermineETC2RGB8TextureSupport(textureCaps);
+ compressedETC2sRGB8Texture = DetermineETC2sRGB8TextureSupport(textureCaps);
+ compressedETC2PunchthroughARGB8Texture =
+ DetermineETC2PunchthroughARGB8TextureSupport(textureCaps);
+ compressedETC2PunchthroughAsRGB8AlphaTexture =
+ DetermineETC2PunchthroughAsRGB8AlphaTextureSupport(textureCaps);
+ compressedETC2RGBA8Texture = DetermineETC2RGBA8TextureSupport(textureCaps);
+ compressedETC2sRGB8Alpha8Texture = DetermineETC2sRGB8Alpha8TextureSupport(textureCaps);
+ compressedEACR11UnsignedTexture = DetermineEACR11UnsignedTextureSupport(textureCaps);
+ compressedEACR11SignedTexture = DetermineEACR11SignedTextureSupport(textureCaps);
+ compressedEACRG11UnsignedTexture = DetermineEACRG11UnsignedTextureSupport(textureCaps);
+ compressedEACRG11SignedTexture = DetermineEACRG11SignedTextureSupport(textureCaps);
+ sRGB = DetermineSRGBTextureSupport(textureCaps);
+ depthTextureANGLE = DetermineDepthTextureANGLESupport(textureCaps);
+ depthTextureOES = DetermineDepthTextureOESSupport(textureCaps);
+ depth24OES = DetermineDepth24OESSupport(textureCaps);
+ depth32 = DetermineDepth32Support(textureCaps);
+ colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps);
+ colorBufferFloatRGBA = DetermineColorBufferFloatRGBASupport(textureCaps);
+ colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
+ textureNorm16 = DetermineTextureNorm16Support(textureCaps);
+ textureCompressionBPTC = DetermineBPTCTextureSupport(textureCaps);
+}
+
+const ExtensionInfoMap &GetExtensionInfoMap()
+{
+ auto buildExtensionInfoMap = []() {
+ auto enableableExtension = [](ExtensionInfo::ExtensionBool member) {
+ ExtensionInfo info;
+ info.Requestable = true;
+ info.ExtensionsMember = member;
+ return info;
+ };
+
+ auto esOnlyExtension = [](ExtensionInfo::ExtensionBool member) {
+ ExtensionInfo info;
+ info.ExtensionsMember = member;
+ return info;
+ };
+
+ // clang-format off
+ ExtensionInfoMap map;
+ map["GL_OES_element_index_uint"] = enableableExtension(&Extensions::elementIndexUint);
+ map["GL_OES_packed_depth_stencil"] = esOnlyExtension(&Extensions::packedDepthStencil);
+ map["GL_OES_get_program_binary"] = enableableExtension(&Extensions::getProgramBinary);
+ map["GL_OES_rgb8_rgba8"] = enableableExtension(&Extensions::rgb8rgba8);
+ map["GL_EXT_texture_format_BGRA8888"] = enableableExtension(&Extensions::textureFormatBGRA8888);
+ map["GL_EXT_read_format_bgra"] = esOnlyExtension(&Extensions::readFormatBGRA);
+ map["GL_NV_pixel_buffer_object"] = enableableExtension(&Extensions::pixelBufferObject);
+ map["GL_OES_mapbuffer"] = enableableExtension(&Extensions::mapBuffer);
+ map["GL_EXT_map_buffer_range"] = enableableExtension(&Extensions::mapBufferRange);
+ map["GL_EXT_color_buffer_half_float"] = enableableExtension(&Extensions::colorBufferHalfFloat);
+ map["GL_OES_texture_half_float"] = enableableExtension(&Extensions::textureHalfFloat);
+ map["GL_OES_texture_half_float_linear"] = enableableExtension(&Extensions::textureHalfFloatLinear);
+ map["GL_OES_texture_float"] = enableableExtension(&Extensions::textureFloat);
+ map["GL_OES_texture_float_linear"] = enableableExtension(&Extensions::textureFloatLinear);
+ map["GL_EXT_texture_rg"] = enableableExtension(&Extensions::textureRG);
+ map["GL_EXT_texture_compression_dxt1"] = enableableExtension(&Extensions::textureCompressionDXT1);
+ map["GL_ANGLE_texture_compression_dxt3"] = enableableExtension(&Extensions::textureCompressionDXT3);
+ map["GL_ANGLE_texture_compression_dxt5"] = enableableExtension(&Extensions::textureCompressionDXT5);
+ map["GL_EXT_texture_compression_s3tc_srgb"] = enableableExtension(&Extensions::textureCompressionS3TCsRGB);
+ map["GL_KHR_texture_compression_astc_ldr"] = enableableExtension(&Extensions::textureCompressionASTCLDRKHR);
+ map["GL_KHR_texture_compression_astc_hdr"] = enableableExtension(&Extensions::textureCompressionASTCHDRKHR);
+ map["GL_OES_texture_compression_astc"] = enableableExtension(&Extensions::textureCompressionASTCOES);
+ map["GL_EXT_texture_compression_bptc"] = enableableExtension(&Extensions::textureCompressionBPTC);
+ map["GL_OES_compressed_ETC1_RGB8_texture"] = enableableExtension(&Extensions::compressedETC1RGB8Texture);
+ map["OES_compressed_ETC2_RGB8_texture"] = enableableExtension(&Extensions::compressedETC2RGB8Texture);
+ map["OES_compressed_ETC2_sRGB8_texture"] = enableableExtension(&Extensions::compressedETC2sRGB8Texture);
+ map["OES_compressed_ETC2_punchthroughA_RGBA8_texture"] = enableableExtension(&Extensions::compressedETC2PunchthroughARGB8Texture);
+ map["OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture"] = enableableExtension(&Extensions::compressedETC2PunchthroughAsRGB8AlphaTexture);
+ map["OES_compressed_ETC2_RGBA8_texture"] = enableableExtension(&Extensions::compressedETC2RGBA8Texture);
+ map["OES_compressed_ETC2_sRGB8_alpha8_texture"] = enableableExtension(&Extensions::compressedETC2sRGB8Alpha8Texture);
+ map["OES_compressed_EAC_R11_unsigned_texture"] = enableableExtension(&Extensions::compressedEACR11UnsignedTexture);
+ map["OES_compressed_EAC_R11_signed_texture"] = enableableExtension(&Extensions::compressedEACR11SignedTexture);
+ map["OES_compressed_EAC_RG11_unsigned_texture"] = enableableExtension(&Extensions::compressedEACRG11UnsignedTexture);
+ map["OES_compressed_EAC_RG11_signed_texture"] = enableableExtension(&Extensions::compressedEACRG11SignedTexture);
+ map["GL_CHROMIUM_compressed_texture_etc"] = enableableExtension(&Extensions::compressedTextureETC);
+ map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB);
+ map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextureANGLE);
+ map["GL_OES_depth_texture"] = esOnlyExtension(&Extensions::depthTextureOES);
+ map["GL_OES_depth24"] = esOnlyExtension(&Extensions::depth24OES);
+ map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32);
+ map["GL_OES_texture_3D"] = enableableExtension(&Extensions::texture3DOES);
+ map["GL_EXT_texture_storage"] = enableableExtension(&Extensions::textureStorage);
+ map["GL_OES_texture_npot"] = enableableExtension(&Extensions::textureNPOT);
+ map["GL_EXT_draw_buffers"] = enableableExtension(&Extensions::drawBuffers);
+ map["GL_EXT_texture_filter_anisotropic"] = enableableExtension(&Extensions::textureFilterAnisotropic);
+ map["GL_EXT_occlusion_query_boolean"] = enableableExtension(&Extensions::occlusionQueryBoolean);
+ map["GL_NV_fence"] = esOnlyExtension(&Extensions::fence);
+ map["GL_EXT_disjoint_timer_query"] = enableableExtension(&Extensions::disjointTimerQuery);
+ map["GL_EXT_robustness"] = esOnlyExtension(&Extensions::robustness);
+ map["GL_KHR_robust_buffer_access_behavior"] = esOnlyExtension(&Extensions::robustBufferAccessBehavior);
+ map["GL_EXT_blend_minmax"] = enableableExtension(&Extensions::blendMinMax);
+ map["GL_ANGLE_framebuffer_blit"] = enableableExtension(&Extensions::framebufferBlit);
+ map["GL_ANGLE_framebuffer_multisample"] = enableableExtension(&Extensions::framebufferMultisample);
+ map["GL_ANGLE_instanced_arrays"] = enableableExtension(&Extensions::instancedArraysANGLE);
+ map["GL_EXT_instanced_arrays"] = enableableExtension(&Extensions::instancedArraysEXT);
+ map["GL_ANGLE_pack_reverse_row_order"] = enableableExtension(&Extensions::packReverseRowOrder);
+ map["GL_OES_standard_derivatives"] = enableableExtension(&Extensions::standardDerivatives);
+ map["GL_EXT_shader_texture_lod"] = enableableExtension(&Extensions::shaderTextureLOD);
+ map["GL_EXT_frag_depth"] = enableableExtension(&Extensions::fragDepth);
+ map["GL_OVR_multiview"] = enableableExtension(&Extensions::multiview);
+ map["GL_OVR_multiview2"] = enableableExtension(&Extensions::multiview2);
+ map["GL_ANGLE_texture_usage"] = enableableExtension(&Extensions::textureUsage);
+ map["GL_ANGLE_translated_shader_source"] = esOnlyExtension(&Extensions::translatedShaderSource);
+ map["GL_OES_fbo_render_mipmap"] = enableableExtension(&Extensions::fboRenderMipmap);
+ map["GL_EXT_discard_framebuffer"] = esOnlyExtension(&Extensions::discardFramebuffer);
+ map["GL_EXT_debug_marker"] = esOnlyExtension(&Extensions::debugMarker);
+ map["GL_OES_EGL_image"] = enableableExtension(&Extensions::eglImage);
+ map["GL_OES_EGL_image_external"] = enableableExtension(&Extensions::eglImageExternal);
+ map["GL_OES_EGL_image_external_essl3"] = enableableExtension(&Extensions::eglImageExternalEssl3);
+ map["GL_OES_EGL_sync"] = esOnlyExtension(&Extensions::eglSync);
+ map["GL_EXT_memory_object"] = enableableExtension(&Extensions::memoryObject);
+ map["GL_EXT_memory_object_fd"] = enableableExtension(&Extensions::memoryObjectFd);
+ map["GL_EXT_semaphore"] = enableableExtension(&Extensions::semaphore);
+ map["GL_EXT_semaphore_fd"] = enableableExtension(&Extensions::semaphoreFd);
+ map["GL_NV_EGL_stream_consumer_external"] = enableableExtension(&Extensions::eglStreamConsumerExternal);
+ map["GL_EXT_unpack_subimage"] = enableableExtension(&Extensions::unpackSubimage);
+ map["GL_NV_pack_subimage"] = enableableExtension(&Extensions::packSubimage);
+ map["GL_EXT_color_buffer_float"] = enableableExtension(&Extensions::colorBufferFloat);
+ map["GL_OES_vertex_array_object"] = enableableExtension(&Extensions::vertexArrayObject);
+ map["GL_KHR_debug"] = esOnlyExtension(&Extensions::debug);
+ map["GL_OES_texture_border_clamp"] = enableableExtension(&Extensions::textureBorderClamp);
+ // TODO(jmadill): Enable this when complete.
+ //map["GL_KHR_no_error"] = esOnlyExtension(&Extensions::noError);
+ map["GL_ANGLE_lossy_etc_decode"] = enableableExtension(&Extensions::lossyETCDecode);
+ map["GL_CHROMIUM_bind_uniform_location"] = esOnlyExtension(&Extensions::bindUniformLocation);
+ map["GL_CHROMIUM_sync_query"] = enableableExtension(&Extensions::syncQuery);
+ map["GL_CHROMIUM_copy_texture"] = esOnlyExtension(&Extensions::copyTexture);
+ map["GL_CHROMIUM_copy_compressed_texture"] = esOnlyExtension(&Extensions::copyCompressedTexture);
+ map["GL_ANGLE_copy_texture_3d"] = enableableExtension(&Extensions::copyTexture3d);
+ map["GL_ANGLE_webgl_compatibility"] = esOnlyExtension(&Extensions::webglCompatibility);
+ map["GL_ANGLE_request_extension"] = esOnlyExtension(&Extensions::requestExtension);
+ map["GL_CHROMIUM_bind_generates_resource"] = esOnlyExtension(&Extensions::bindGeneratesResource);
+ map["GL_ANGLE_robust_client_memory"] = esOnlyExtension(&Extensions::robustClientMemory);
+ map["GL_EXT_texture_sRGB_decode"] = esOnlyExtension(&Extensions::textureSRGBDecode);
+ map["GL_EXT_sRGB_write_control"] = esOnlyExtension(&Extensions::sRGBWriteControl);
+ map["GL_CHROMIUM_color_buffer_float_rgb"] = enableableExtension(&Extensions::colorBufferFloatRGB);
+ map["GL_CHROMIUM_color_buffer_float_rgba"] = enableableExtension(&Extensions::colorBufferFloatRGBA);
+ map["GL_EXT_multisample_compatibility"] = esOnlyExtension(&Extensions::multisampleCompatibility);
+ map["GL_CHROMIUM_framebuffer_mixed_samples"] = esOnlyExtension(&Extensions::framebufferMixedSamples);
+ map["GL_EXT_texture_norm16"] = esOnlyExtension(&Extensions::textureNorm16);
+ map["GL_CHROMIUM_path_rendering"] = esOnlyExtension(&Extensions::pathRendering);
+ map["GL_OES_surfaceless_context"] = esOnlyExtension(&Extensions::surfacelessContext);
+ map["GL_ANGLE_client_arrays"] = esOnlyExtension(&Extensions::clientArrays);
+ map["GL_ANGLE_robust_resource_initialization"] = esOnlyExtension(&Extensions::robustResourceInitialization);
+ map["GL_ANGLE_program_cache_control"] = esOnlyExtension(&Extensions::programCacheControl);
+ map["GL_ANGLE_texture_rectangle"] = enableableExtension(&Extensions::textureRectangle);
+ map["GL_EXT_geometry_shader"] = enableableExtension(&Extensions::geometryShader);
+ map["GL_ANGLE_explicit_context_gles1"] = enableableExtension(&Extensions::explicitContextGles1);
+ map["GL_ANGLE_explicit_context"] = enableableExtension(&Extensions::explicitContext);
+ map["GL_KHR_parallel_shader_compile"] = enableableExtension(&Extensions::parallelShaderCompile);
+ map["GL_OES_texture_storage_multisample_2d_array"] = enableableExtension(&Extensions::textureStorageMultisample2DArray);
+ map["GL_ANGLE_multiview_multisample"] = enableableExtension(&Extensions::multiviewMultisample);
+ map["GL_EXT_blend_func_extended"] = enableableExtension(&Extensions::blendFuncExtended);
+ map["GL_EXT_float_blend"] = enableableExtension(&Extensions::floatBlend);
+ map["GL_ANGLE_texture_multisample"] = enableableExtension(&Extensions::textureMultisample);
+ map["GL_ANGLE_multi_draw"] = enableableExtension(&Extensions::multiDraw);
+ map["GL_ANGLE_provoking_vertex"] = enableableExtension(&Extensions::provokingVertex);
+ map["GL_CHROMIUM_lose_context"] = enableableExtension(&Extensions::loseContextCHROMIUM);
+ map["GL_ANGLE_texture_external_update"] = enableableExtension(&Extensions::textureExternalUpdateANGLE);
+ map["GL_ANGLE_base_vertex_base_instance"] = enableableExtension(&Extensions::baseVertexBaseInstance);
+ // GLES1 extensinos
+ map["GL_OES_point_size_array"] = enableableExtension(&Extensions::pointSizeArray);
+ map["GL_OES_texture_cube_map"] = enableableExtension(&Extensions::textureCubeMap);
+ map["GL_OES_point_sprite"] = enableableExtension(&Extensions::pointSprite);
+ map["GL_OES_draw_texture"] = enableableExtension(&Extensions::drawTexture);
+ map["GL_ANGLE_memory_size"] = enableableExtension(&Extensions::memorySize);
+ // clang-format on
+
+ return map;
+ };
+
+ static const ExtensionInfoMap extensionInfo = buildExtensionInfoMap();
+ return extensionInfo;
+}
+
+TypePrecision::TypePrecision() = default;
+
+TypePrecision::TypePrecision(const TypePrecision &other) = default;
+
+void TypePrecision::setIEEEFloat()
+{
+ range = {{127, 127}};
+ precision = 23;
+}
+
+void TypePrecision::setTwosComplementInt(unsigned int bits)
+{
+ range = {{static_cast<GLint>(bits) - 1, static_cast<GLint>(bits) - 2}};
+ precision = 0;
+}
+
+void TypePrecision::setSimulatedFloat(unsigned int r, unsigned int p)
+{
+ range = {{static_cast<GLint>(r), static_cast<GLint>(r)}};
+ precision = static_cast<GLint>(p);
+}
+
+void TypePrecision::setSimulatedInt(unsigned int r)
+{
+ range = {{static_cast<GLint>(r), static_cast<GLint>(r)}};
+ precision = 0;
+}
+
+void TypePrecision::get(GLint *returnRange, GLint *returnPrecision) const
+{
+ std::copy(range.begin(), range.end(), returnRange);
+ *returnPrecision = precision;
+}
+
+Caps::Caps() = default;
+Caps::Caps(const Caps &other) = default;
+Caps::~Caps() = default;
+
+Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions)
+{
+ Caps caps;
+
+ // GLES1 emulation (Minimums taken from Table 6.20 / 6.22 (ES 1.1 spec))
+ if (clientVersion < Version(2, 0))
+ {
+ caps.maxMultitextureUnits = 2;
+ caps.maxLights = 8;
+ caps.maxClipPlanes = 1;
+
+ caps.maxModelviewMatrixStackDepth = 16;
+ caps.maxProjectionMatrixStackDepth = 2;
+ caps.maxTextureMatrixStackDepth = 2;
+
+ caps.minSmoothPointSize = 1.0f;
+ caps.maxSmoothPointSize = 1.0f;
+ }
+
+ if (clientVersion >= Version(2, 0))
+ {
+ // Table 6.18
+ caps.max2DTextureSize = 64;
+ caps.maxCubeMapTextureSize = 16;
+ caps.maxViewportWidth = caps.max2DTextureSize;
+ caps.maxViewportHeight = caps.max2DTextureSize;
+ caps.minAliasedPointSize = 1;
+ caps.maxAliasedPointSize = 1;
+ caps.minAliasedLineWidth = 1;
+ caps.maxAliasedLineWidth = 1;
+
+ // Table 6.19
+ caps.vertexHighpFloat.setSimulatedFloat(62, 16);
+ caps.vertexMediumpFloat.setSimulatedFloat(14, 10);
+ caps.vertexLowpFloat.setSimulatedFloat(1, 8);
+ caps.vertexHighpInt.setSimulatedInt(16);
+ caps.vertexMediumpInt.setSimulatedInt(10);
+ caps.vertexLowpInt.setSimulatedInt(8);
+ caps.fragmentHighpFloat.setSimulatedFloat(62, 16);
+ caps.fragmentMediumpFloat.setSimulatedFloat(14, 10);
+ caps.fragmentLowpFloat.setSimulatedFloat(1, 8);
+ caps.fragmentHighpInt.setSimulatedInt(16);
+ caps.fragmentMediumpInt.setSimulatedInt(10);
+ caps.fragmentLowpInt.setSimulatedInt(8);
+
+ // Table 6.20
+ caps.maxVertexAttributes = 8;
+ caps.maxVertexUniformVectors = 128;
+ caps.maxVaryingVectors = 8;
+ caps.maxCombinedTextureImageUnits = 8;
+ caps.maxShaderTextureImageUnits[ShaderType::Fragment] = 8;
+ caps.maxFragmentUniformVectors = 16;
+ caps.maxRenderbufferSize = 1;
+ }
+
+ if (clientVersion >= Version(3, 0))
+ {
+ // Table 6.28
+ caps.maxElementIndex = (1 << 24) - 1;
+ caps.max3DTextureSize = 256;
+ caps.max2DTextureSize = 2048;
+ caps.maxArrayTextureLayers = 256;
+ caps.maxLODBias = 2.0f;
+ caps.maxCubeMapTextureSize = 2048;
+ caps.maxRenderbufferSize = 2048;
+ caps.maxDrawBuffers = 4;
+ caps.maxColorAttachments = 4;
+ caps.maxViewportWidth = caps.max2DTextureSize;
+ caps.maxViewportHeight = caps.max2DTextureSize;
+
+ // Table 6.29
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_R11_EAC);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_SIGNED_R11_EAC);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_RG11_EAC);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_SIGNED_RG11_EAC);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGB8_ETC2);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_ETC2);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_RGBA8_ETC2_EAC);
+ caps.compressedTextureFormats.push_back(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC);
+ caps.vertexHighpFloat.setIEEEFloat();
+ caps.vertexHighpInt.setTwosComplementInt(32);
+ caps.vertexMediumpInt.setTwosComplementInt(16);
+ caps.vertexLowpInt.setTwosComplementInt(8);
+ caps.fragmentHighpFloat.setIEEEFloat();
+ caps.fragmentHighpInt.setSimulatedInt(32);
+ caps.fragmentMediumpInt.setTwosComplementInt(16);
+ caps.fragmentLowpInt.setTwosComplementInt(8);
+ caps.maxServerWaitTimeout = 0;
+
+ // Table 6.31
+ caps.maxVertexAttributes = 16;
+ caps.maxShaderUniformComponents[ShaderType::Vertex] = 1024;
+ caps.maxVertexUniformVectors = 256;
+ caps.maxShaderUniformBlocks[ShaderType::Vertex] = 12;
+ caps.maxVertexOutputComponents = 64;
+ caps.maxShaderTextureImageUnits[ShaderType::Vertex] = 16;
+
+ // Table 6.32
+ caps.maxShaderUniformComponents[ShaderType::Fragment] = 896;
+ caps.maxFragmentUniformVectors = 224;
+ caps.maxShaderUniformBlocks[ShaderType::Fragment] = 12;
+ caps.maxFragmentInputComponents = 60;
+ caps.maxShaderTextureImageUnits[ShaderType::Fragment] = 16;
+ caps.minProgramTexelOffset = -8;
+ caps.maxProgramTexelOffset = 7;
+
+ // Table 6.33
+ caps.maxUniformBufferBindings = 24;
+ caps.maxUniformBlockSize = 16384;
+ caps.uniformBufferOffsetAlignment = 256;
+ caps.maxCombinedUniformBlocks = 24;
+ caps.maxVaryingComponents = 60;
+ caps.maxVaryingVectors = 15;
+ caps.maxCombinedTextureImageUnits = 32;
+
+ // Table 6.34
+ caps.maxTransformFeedbackInterleavedComponents = 64;
+ caps.maxTransformFeedbackSeparateAttributes = 4;
+ caps.maxTransformFeedbackSeparateComponents = 4;
+
+ // Table 3.35
+ caps.maxSamples = 4;
+ }
+
+ if (clientVersion >= Version(3, 1))
+ {
+ // Table 20.40
+ caps.maxFramebufferWidth = 2048;
+ caps.maxFramebufferHeight = 2048;
+ caps.maxFramebufferSamples = 4;
+ caps.maxSampleMaskWords = 1;
+ caps.maxColorTextureSamples = 1;
+ caps.maxDepthTextureSamples = 1;
+ caps.maxIntegerSamples = 1;
+
+ // Table 20.41
+ caps.maxVertexAttribRelativeOffset = 2047;
+ caps.maxVertexAttribBindings = 16;
+ caps.maxVertexAttribStride = 2048;
+
+ // Table 20.43
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Vertex] = 0;
+ caps.maxShaderAtomicCounters[ShaderType::Vertex] = 0;
+ caps.maxShaderImageUniforms[ShaderType::Vertex] = 0;
+ caps.maxShaderStorageBlocks[ShaderType::Vertex] = 0;
+
+ // Table 20.44
+ caps.maxShaderUniformComponents[ShaderType::Fragment] = 1024;
+ caps.maxFragmentUniformVectors = 256;
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Fragment] = 0;
+ caps.maxShaderAtomicCounters[ShaderType::Fragment] = 0;
+ caps.maxShaderImageUniforms[ShaderType::Fragment] = 0;
+ caps.maxShaderStorageBlocks[ShaderType::Fragment] = 0;
+ caps.minProgramTextureGatherOffset = 0;
+ caps.maxProgramTextureGatherOffset = 0;
+
+ // Table 20.45
+ caps.maxComputeWorkGroupCount = {{65535, 65535, 65535}};
+ caps.maxComputeWorkGroupSize = {{128, 128, 64}};
+ caps.maxComputeWorkGroupInvocations = 12;
+ caps.maxShaderUniformBlocks[ShaderType::Compute] = 12;
+ caps.maxShaderTextureImageUnits[ShaderType::Compute] = 16;
+ caps.maxComputeSharedMemorySize = 16384;
+ caps.maxShaderUniformComponents[ShaderType::Compute] = 1024;
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Compute] = 1;
+ caps.maxShaderAtomicCounters[ShaderType::Compute] = 8;
+ caps.maxShaderImageUniforms[ShaderType::Compute] = 4;
+ caps.maxShaderStorageBlocks[ShaderType::Compute] = 4;
+
+ // Table 20.46
+ caps.maxUniformBufferBindings = 36;
+ caps.maxCombinedTextureImageUnits = 48;
+ caps.maxCombinedShaderOutputResources = 4;
+
+ // Table 20.47
+ caps.maxUniformLocations = 1024;
+ caps.maxAtomicCounterBufferBindings = 1;
+ caps.maxAtomicCounterBufferSize = 32;
+ caps.maxCombinedAtomicCounterBuffers = 1;
+ caps.maxCombinedAtomicCounters = 8;
+ caps.maxImageUnits = 4;
+ caps.maxCombinedImageUniforms = 4;
+ caps.maxShaderStorageBufferBindings = 4;
+ caps.maxShaderStorageBlockSize = 1 << 27;
+ caps.maxCombinedShaderStorageBlocks = 4;
+ caps.shaderStorageBufferOffsetAlignment = 256;
+ }
+
+ if (extensions.textureRectangle)
+ {
+ caps.maxRectangleTextureSize = 64;
+ }
+
+ if (extensions.geometryShader)
+ {
+ // Table 20.40 (GL_EXT_geometry_shader)
+ caps.maxFramebufferLayers = 256;
+ caps.layerProvokingVertex = GL_LAST_VERTEX_CONVENTION_EXT;
+
+ // Table 20.43gs (GL_EXT_geometry_shader)
+ caps.maxShaderUniformComponents[ShaderType::Geometry] = 1024;
+ caps.maxShaderUniformBlocks[ShaderType::Geometry] = 12;
+ caps.maxGeometryInputComponents = 64;
+ caps.maxGeometryOutputComponents = 64;
+ caps.maxGeometryOutputVertices = 256;
+ caps.maxGeometryTotalOutputComponents = 1024;
+ caps.maxShaderTextureImageUnits[ShaderType::Geometry] = 16;
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Geometry] = 0;
+ caps.maxShaderAtomicCounters[ShaderType::Geometry] = 0;
+ caps.maxShaderStorageBlocks[ShaderType::Geometry] = 0;
+ caps.maxGeometryShaderInvocations = 32;
+
+ // Table 20.46 (GL_EXT_geometry_shader)
+ caps.maxShaderImageUniforms[ShaderType::Geometry] = 0;
+
+ // Table 20.46 (GL_EXT_geometry_shader)
+ caps.maxUniformBufferBindings = 48;
+ caps.maxCombinedUniformBlocks = 36;
+ caps.maxCombinedTextureImageUnits = 64;
+ }
+
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ caps.maxCombinedShaderUniformComponents[shaderType] =
+ caps.maxShaderUniformBlocks[shaderType] *
+ static_cast<GLuint>(caps.maxUniformBlockSize / 4) +
+ caps.maxShaderUniformComponents[shaderType];
+ }
+
+ return caps;
+}
+} // namespace gl
+
+namespace egl
+{
+
+Caps::Caps() = default;
+
+DisplayExtensions::DisplayExtensions() = default;
+
+std::vector<std::string> DisplayExtensions::getStrings() const
+{
+ std::vector<std::string> extensionStrings;
+
+ // clang-format off
+ // | Extension name | Supported flag | Output vector |
+ InsertExtensionString("EGL_EXT_create_context_robustness", createContextRobustness, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_d3d_share_handle_client_buffer", d3dShareHandleClientBuffer, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_d3d_texture_client_buffer", d3dTextureClientBuffer, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_surface_d3d_texture_2d_share_handle", surfaceD3DTexture2DShareHandle, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_query_surface_pointer", querySurfacePointer, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_window_fixed_size", windowFixedSize, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_keyed_mutex", keyedMutex, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_surface_orientation", surfaceOrientation, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_direct_composition", directComposition, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_windows_ui_composition", windowsUIComposition, &extensionStrings);
+ InsertExtensionString("EGL_NV_post_sub_buffer", postSubBuffer, &extensionStrings);
+ InsertExtensionString("EGL_KHR_create_context", createContext, &extensionStrings);
+ InsertExtensionString("EGL_EXT_device_query", deviceQuery, &extensionStrings);
+ InsertExtensionString("EGL_KHR_image", image, &extensionStrings);
+ InsertExtensionString("EGL_KHR_image_base", imageBase, &extensionStrings);
+ InsertExtensionString("EGL_KHR_image_pixmap", imagePixmap, &extensionStrings);
+ InsertExtensionString("EGL_KHR_gl_texture_2D_image", glTexture2DImage, &extensionStrings);
+ InsertExtensionString("EGL_KHR_gl_texture_cubemap_image", glTextureCubemapImage, &extensionStrings);
+ InsertExtensionString("EGL_KHR_gl_texture_3D_image", glTexture3DImage, &extensionStrings);
+ InsertExtensionString("EGL_KHR_gl_renderbuffer_image", glRenderbufferImage, &extensionStrings);
+ InsertExtensionString("EGL_KHR_get_all_proc_addresses", getAllProcAddresses, &extensionStrings);
+ InsertExtensionString("EGL_KHR_stream", stream, &extensionStrings);
+ InsertExtensionString("EGL_KHR_stream_consumer_gltexture", streamConsumerGLTexture, &extensionStrings);
+ InsertExtensionString("EGL_NV_stream_consumer_gltexture_yuv", streamConsumerGLTextureYUV, &extensionStrings);
+ InsertExtensionString("EGL_KHR_fence_sync", fenceSync, &extensionStrings);
+ InsertExtensionString("EGL_KHR_wait_sync", waitSync, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_flexible_surface_compatibility", flexibleSurfaceCompatibility, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_stream_producer_d3d_texture", streamProducerD3DTexture, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_create_context_webgl_compatibility", createContextWebGLCompatibility, &extensionStrings);
+ InsertExtensionString("EGL_CHROMIUM_create_context_bind_generates_resource", createContextBindGeneratesResource, &extensionStrings);
+ InsertExtensionString("EGL_CHROMIUM_sync_control", getSyncValues, &extensionStrings);
+ InsertExtensionString("EGL_KHR_swap_buffers_with_damage", swapBuffersWithDamage, &extensionStrings);
+ InsertExtensionString("EGL_EXT_pixel_format_float", pixelFormatFloat, &extensionStrings);
+ InsertExtensionString("EGL_KHR_surfaceless_context", surfacelessContext, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_display_texture_share_group", displayTextureShareGroup, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_create_context_client_arrays", createContextClientArrays, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_program_cache_control", programCacheControl, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_robust_resource_initialization", robustResourceInitialization, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_iosurface_client_buffer", iosurfaceClientBuffer, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_create_context_extensions_enabled", createContextExtensionsEnabled, &extensionStrings);
+ InsertExtensionString("EGL_ANDROID_presentation_time", presentationTime, &extensionStrings);
+ InsertExtensionString("EGL_ANDROID_blob_cache", blobCache, &extensionStrings);
+ InsertExtensionString("EGL_ANDROID_image_native_buffer", imageNativeBuffer, &extensionStrings);
+ InsertExtensionString("EGL_ANDROID_get_frame_timestamps", getFrameTimestamps, &extensionStrings);
+ InsertExtensionString("EGL_ANDROID_recordable", recordable, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_power_preference", powerPreference, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_image_d3d11_texture", imageD3D11Texture, &extensionStrings);
+ InsertExtensionString("EGL_ANDROID_get_native_client_buffer", getNativeClientBufferANDROID, &extensionStrings);
+ InsertExtensionString("EGL_ANDROID_native_fence_sync", nativeFenceSyncANDROID, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_create_context_backwards_compatible", createContextBackwardsCompatible, &extensionStrings);
+ // TODO(jmadill): Enable this when complete.
+ //InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings);
+ // clang-format on
+
+ return extensionStrings;
+}
+
+DeviceExtensions::DeviceExtensions() = default;
+
+std::vector<std::string> DeviceExtensions::getStrings() const
+{
+ std::vector<std::string> extensionStrings;
+
+ // clang-format off
+ // | Extension name | Supported flag | Output vector |
+ InsertExtensionString("EGL_ANGLE_device_d3d", deviceD3D, &extensionStrings);
+ // clang-format on
+
+ return extensionStrings;
+}
+
+ClientExtensions::ClientExtensions() = default;
+ClientExtensions::ClientExtensions(const ClientExtensions &other) = default;
+
+std::vector<std::string> ClientExtensions::getStrings() const
+{
+ std::vector<std::string> extensionStrings;
+
+ // clang-format off
+ // | Extension name | Supported flag | Output vector |
+ InsertExtensionString("EGL_EXT_client_extensions", clientExtensions, &extensionStrings);
+ InsertExtensionString("EGL_EXT_platform_base", platformBase, &extensionStrings);
+ InsertExtensionString("EGL_EXT_platform_device", platformDevice, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_platform_angle", platformANGLE, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_platform_angle_d3d", platformANGLED3D, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_platform_angle_opengl", platformANGLEOpenGL, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_platform_angle_null", platformANGLENULL, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_platform_angle_vulkan", platformANGLEVulkan, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_platform_angle_context_virtualization", platformANGLEContextVirtualization, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_device_creation", deviceCreation, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_device_creation_d3d11", deviceCreationD3D11, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_x11_visual", x11Visual, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_experimental_present_path", experimentalPresentPath, &extensionStrings);
+ InsertExtensionString("EGL_KHR_client_get_all_proc_addresses", clientGetAllProcAddresses, &extensionStrings);
+ InsertExtensionString("EGL_KHR_debug", debug, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_explicit_context", explicitContext, &extensionStrings);
+ InsertExtensionString("EGL_ANGLE_feature_control", featureControlANGLE, &extensionStrings);
+ // clang-format on
+
+ return extensionStrings;
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Caps.h b/gfx/angle/checkout/src/libANGLE/Caps.h
new file mode 100644
index 0000000000..c727590cb9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Caps.h
@@ -0,0 +1,994 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBANGLE_CAPS_H_
+#define LIBANGLE_CAPS_H_
+
+#include "angle_gl.h"
+#include "libANGLE/Version.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/Format.h"
+
+#include <array>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+namespace gl
+{
+
+struct Extensions;
+
+struct TextureCaps
+{
+ TextureCaps();
+ TextureCaps(const TextureCaps &other);
+ ~TextureCaps();
+
+ // Supports for basic texturing: glTexImage, glTexSubImage, etc
+ bool texturable = false;
+
+ // Support for linear or anisotropic filtering
+ bool filterable = false;
+
+ // Support for being used as a framebuffer attachment, i.e. glFramebufferTexture2D
+ bool textureAttachment = false;
+
+ // Support for being used as a renderbuffer format, i.e. glFramebufferRenderbuffer
+ bool renderbuffer = false;
+
+ // Set of supported sample counts, only guaranteed to be valid in ES3.
+ SupportedSampleSet sampleCounts;
+
+ // Get the maximum number of samples supported
+ GLuint getMaxSamples() const;
+
+ // Get the number of supported samples that is at least as many as requested. Returns 0 if
+ // there are no sample counts available
+ GLuint getNearestSamples(GLuint requestedSamples) const;
+};
+
+TextureCaps GenerateMinimumTextureCaps(GLenum internalFormat,
+ const Version &clientVersion,
+ const Extensions &extensions);
+
+class TextureCapsMap final : angle::NonCopyable
+{
+ public:
+ TextureCapsMap();
+ ~TextureCapsMap();
+
+ // These methods are deprecated. Please use angle::Format for new features.
+ void insert(GLenum internalFormat, const TextureCaps &caps);
+ const TextureCaps &get(GLenum internalFormat) const;
+
+ void clear();
+
+ // Prefer using angle::Format methods.
+ const TextureCaps &get(angle::FormatID formatID) const;
+ void set(angle::FormatID formatID, const TextureCaps &caps);
+
+ private:
+ TextureCaps &get(angle::FormatID formatID);
+
+ // Indexed by angle::FormatID
+ std::array<TextureCaps, angle::kNumANGLEFormats> mFormatData;
+};
+
+void InitMinimumTextureCapsMap(const Version &clientVersion,
+ const Extensions &extensions,
+ TextureCapsMap *capsMap);
+
+// Returns true if all the formats required to support GL_CHROMIUM_compressed_texture_etc are
+// present. Does not determine if they are natively supported without decompression.
+bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps);
+
+struct Extensions
+{
+ Extensions();
+ Extensions(const Extensions &other);
+
+ // Generate a vector of supported extension strings
+ std::vector<std::string> getStrings() const;
+
+ // Set all texture related extension support based on the supported textures.
+ // Determines support for:
+ // GL_OES_packed_depth_stencil
+ // GL_OES_rgb8_rgba8
+ // GL_EXT_texture_format_BGRA8888
+ // GL_EXT_color_buffer_half_float,
+ // GL_OES_texture_half_float, GL_OES_texture_half_float_linear
+ // GL_OES_texture_float, GL_OES_texture_float_linear
+ // GL_EXT_texture_rg
+ // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3,
+ // GL_ANGLE_texture_compression_dxt5
+ // GL_KHR_texture_compression_astc_ldr, GL_OES_texture_compression_astc.
+ // NOTE: GL_KHR_texture_compression_astc_hdr must be enabled separately. Support for the
+ // HDR profile cannot be determined from the format enums alone.
+ // GL_OES_compressed_ETC1_RGB8_texture
+ // GL_EXT_sRGB
+ // GL_ANGLE_depth_texture, GL_OES_depth32
+ // GL_EXT_color_buffer_float
+ // GL_EXT_texture_norm16
+ // GL_EXT_texture_compression_bptc
+ void setTextureExtensionSupport(const TextureCapsMap &textureCaps);
+
+ // indicate if any depth texture extension is available
+ bool depthTextureAny() const { return (depthTextureANGLE || depthTextureOES); }
+
+ // ES2 Extension support
+
+ // GL_OES_element_index_uint
+ bool elementIndexUint = false;
+
+ // GL_OES_packed_depth_stencil
+ bool packedDepthStencil = false;
+
+ // GL_OES_get_program_binary
+ bool getProgramBinary = false;
+
+ // GL_OES_rgb8_rgba8
+ // Implies that TextureCaps for GL_RGB8 and GL_RGBA8 exist
+ bool rgb8rgba8 = false;
+
+ // GL_EXT_texture_format_BGRA8888
+ // Implies that TextureCaps for GL_BGRA8 exist
+ bool textureFormatBGRA8888 = false;
+
+ // GL_EXT_read_format_bgra
+ bool readFormatBGRA = false;
+
+ // GL_NV_pixel_buffer_object
+ bool pixelBufferObject = false;
+
+ // GL_OES_mapbuffer and GL_EXT_map_buffer_range
+ bool mapBuffer = false;
+ bool mapBufferRange = false;
+
+ // GL_EXT_color_buffer_half_float
+ // Together with GL_OES_texture_half_float in a GLES 2.0 context, implies that half-float
+ // textures are renderable.
+ bool colorBufferHalfFloat = false;
+
+ // GL_OES_texture_half_float and GL_OES_texture_half_float_linear
+ // Implies that TextureCaps for GL_RGB16F, GL_RGBA16F, GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT and
+ // GL_LUMINANCE_ALPHA32F_EXT exist
+ bool textureHalfFloat = false;
+ bool textureHalfFloatLinear = false;
+
+ // GL_OES_texture_float and GL_OES_texture_float_linear
+ // Implies that TextureCaps for GL_RGB32F, GL_RGBA32F, GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT and
+ // GL_LUMINANCE_ALPHA16F_EXT exist
+ bool textureFloat = false;
+ bool textureFloatLinear = false;
+
+ // GL_EXT_texture_rg
+ // Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if
+ // floating point extensions are also present) exist
+ bool textureRG = false;
+
+ // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and
+ // GL_ANGLE_texture_compression_dxt5 Implies that TextureCaps exist for
+ // GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
+ // GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE and GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE
+ bool textureCompressionDXT1 = false;
+ bool textureCompressionDXT3 = false;
+ bool textureCompressionDXT5 = false;
+
+ // GL_EXT_texture_compression_s3tc_srgb
+ // Implies that TextureCaps exist for GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
+ // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, and
+ // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
+ bool textureCompressionS3TCsRGB = false;
+
+ // GL_KHR_texture_compression_astc_ldr
+ bool textureCompressionASTCLDRKHR = false;
+
+ // GL_KHR_texture_compression_astc_hdr
+ bool textureCompressionASTCHDRKHR = false;
+
+ // GL_OES_texture_compression_astc
+ bool textureCompressionASTCOES = false;
+
+ // GL_EXT_texture_compression_bptc
+ bool textureCompressionBPTC = false;
+
+ // GL_OES_compressed_ETC1_RGB8_texture
+ // Implies that TextureCaps for GL_ETC1_RGB8_OES exist
+ bool compressedETC1RGB8Texture = false;
+
+ // OES_compressed_ETC2_RGB8_texture
+ bool compressedETC2RGB8Texture = false;
+
+ // OES_compressed_ETC2_sRGB8_texture
+ bool compressedETC2sRGB8Texture = false;
+
+ // OES_compressed_ETC2_punchthroughA_RGBA8_texture
+ bool compressedETC2PunchthroughARGB8Texture = false;
+
+ // OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture
+ bool compressedETC2PunchthroughAsRGB8AlphaTexture = false;
+
+ // OES_compressed_ETC2_RGBA8_texture
+ bool compressedETC2RGBA8Texture = false;
+
+ // OES_compressed_ETC2_sRGB8_alpha8_texture
+ bool compressedETC2sRGB8Alpha8Texture = false;
+
+ // OES_compressed_EAC_R11_unsigned_texture
+ bool compressedEACR11UnsignedTexture = false;
+
+ // OES_compressed_EAC_R11_signed_texture
+ bool compressedEACR11SignedTexture = false;
+
+ // OES_compressed_EAC_RG11_unsigned_texture
+ bool compressedEACRG11UnsignedTexture = false;
+
+ // OES_compressed_EAC_RG11_signed_texture
+ bool compressedEACRG11SignedTexture = false;
+
+ // GL_CHROMIUM_compressed_texture_etc
+ // ONLY exposed if ETC texture formats are natively supported without decompression
+ // Backends should enable this extension explicitly. It is not enabled with
+ // setTextureExtensionSupport, use DetermineCompressedTextureETCSupport to check if all of the
+ // individual formats required to support this extension are available.
+ bool compressedTextureETC = false;
+
+ // GL_EXT_sRGB
+ // Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist
+ // TODO: Don't advertise this extension in ES3
+ bool sRGB = false;
+
+ // GL_ANGLE_depth_texture
+ bool depthTextureANGLE = false;
+
+ // OES_depth_texture
+ bool depthTextureOES = false;
+
+ // GL_OES_depth24
+ // Allows DEPTH_COMPONENT24_OES as a valid Renderbuffer format.
+ bool depth24OES = false;
+
+ // GL_OES_depth32
+ // Allows DEPTH_COMPONENT32_OES as a valid Renderbuffer format.
+ bool depth32 = false;
+
+ // GL_OES_texture_3D
+ bool texture3DOES = false;
+
+ // GL_EXT_texture_storage
+ bool textureStorage = false;
+
+ // GL_OES_texture_npot
+ bool textureNPOT = false;
+
+ // GL_EXT_draw_buffers
+ bool drawBuffers = false;
+
+ // GL_EXT_texture_filter_anisotropic
+ bool textureFilterAnisotropic = false;
+ GLfloat maxTextureAnisotropy = 0.0f;
+
+ // GL_EXT_occlusion_query_boolean
+ bool occlusionQueryBoolean = false;
+
+ // GL_NV_fence
+ bool fence = false;
+
+ // GL_EXT_disjoint_timer_query
+ bool disjointTimerQuery = false;
+ GLuint queryCounterBitsTimeElapsed = 0;
+ GLuint queryCounterBitsTimestamp = 0;
+
+ // GL_EXT_robustness
+ bool robustness = false;
+
+ // GL_KHR_robust_buffer_access_behavior
+ bool robustBufferAccessBehavior = false;
+
+ // GL_EXT_blend_minmax
+ bool blendMinMax = false;
+
+ // GL_ANGLE_framebuffer_blit
+ bool framebufferBlit = false;
+
+ // GL_ANGLE_framebuffer_multisample
+ bool framebufferMultisample = false;
+
+ // GL_ANGLE_instanced_arrays
+ bool instancedArraysANGLE = false;
+ // GL_EXT_instanced_arrays
+ bool instancedArraysEXT = false;
+ // Any version of the instanced arrays extension
+ bool instancedArraysAny() const { return (instancedArraysANGLE || instancedArraysEXT); }
+
+ // GL_ANGLE_pack_reverse_row_order
+ bool packReverseRowOrder = false;
+
+ // GL_OES_standard_derivatives
+ bool standardDerivatives = false;
+
+ // GL_EXT_shader_texture_lod
+ bool shaderTextureLOD = false;
+
+ // GL_EXT_frag_depth
+ bool fragDepth = false;
+
+ // OVR_multiview
+ bool multiview = false;
+ GLuint maxViews = 1;
+
+ // OVR_multiview2
+ bool multiview2 = false;
+
+ // GL_ANGLE_texture_usage
+ bool textureUsage = false;
+
+ // GL_ANGLE_translated_shader_source
+ bool translatedShaderSource = false;
+
+ // GL_OES_fbo_render_mipmap
+ bool fboRenderMipmap = false;
+
+ // GL_EXT_discard_framebuffer
+ bool discardFramebuffer = false;
+
+ // EXT_debug_marker
+ bool debugMarker = false;
+
+ // GL_OES_EGL_image
+ bool eglImage = false;
+
+ // GL_OES_EGL_image_external
+ bool eglImageExternal = false;
+
+ // GL_OES_EGL_image_external_essl3
+ bool eglImageExternalEssl3 = false;
+
+ // GL_OES_EGL_sync
+ bool eglSync = false;
+
+ // GL_EXT_memory_object
+ bool memoryObject = false;
+
+ // GL_EXT_memory_object_fd
+ bool memoryObjectFd = false;
+
+ // GL_EXT_semaphore
+ bool semaphore = false;
+
+ // GL_EXT_semaphore_fd
+ bool semaphoreFd = false;
+
+ // NV_EGL_stream_consumer_external
+ bool eglStreamConsumerExternal = false;
+
+ // EXT_unpack_subimage
+ bool unpackSubimage = false;
+
+ // NV_pack_subimage
+ bool packSubimage = false;
+
+ // GL_OES_vertex_array_object
+ bool vertexArrayObject = false;
+
+ // GL_KHR_debug
+ bool debug = false;
+ GLuint maxDebugMessageLength = 0;
+ GLuint maxDebugLoggedMessages = 0;
+ GLuint maxDebugGroupStackDepth = 0;
+ GLuint maxLabelLength = 0;
+
+ // KHR_no_error
+ bool noError = false;
+
+ // GL_ANGLE_lossy_etc_decode
+ bool lossyETCDecode = false;
+
+ // GL_CHROMIUM_bind_uniform_location
+ bool bindUniformLocation = false;
+
+ // GL_CHROMIUM_sync_query
+ bool syncQuery = false;
+
+ // GL_CHROMIUM_copy_texture
+ bool copyTexture = false;
+
+ // GL_CHROMIUM_copy_compressed_texture
+ bool copyCompressedTexture = false;
+
+ // GL_ANGLE_copy_texture_3d
+ bool copyTexture3d = false;
+
+ // GL_ANGLE_webgl_compatibility
+ bool webglCompatibility = false;
+
+ // GL_ANGLE_request_extension
+ bool requestExtension = false;
+
+ // GL_CHROMIUM_bind_generates_resource
+ bool bindGeneratesResource = false;
+
+ // GL_ANGLE_robust_client_memory
+ bool robustClientMemory = false;
+
+ // GL_OES_texture_border_clamp
+ bool textureBorderClamp = false;
+
+ // GL_EXT_texture_sRGB_decode
+ bool textureSRGBDecode = false;
+
+ // GL_EXT_sRGB_write_control
+ bool sRGBWriteControl = false;
+
+ // GL_CHROMIUM_color_buffer_float_rgb
+ bool colorBufferFloatRGB = false;
+
+ // GL_CHROMIUM_color_buffer_float_rgba
+ bool colorBufferFloatRGBA = false;
+
+ // ES3 Extension support
+
+ // GL_EXT_color_buffer_float
+ bool colorBufferFloat = false;
+
+ // GL_EXT_multisample_compatibility.
+ // written against ES 3.1 but can apply to earlier versions.
+ bool multisampleCompatibility = false;
+
+ // GL_CHROMIUM_framebuffer_mixed_samples
+ bool framebufferMixedSamples = false;
+
+ // GL_EXT_texture_norm16
+ // written against ES 3.1 but can apply to ES 3.0 as well.
+ bool textureNorm16 = false;
+
+ // GL_CHROMIUM_path_rendering
+ bool pathRendering = false;
+
+ // GL_OES_surfaceless_context
+ bool surfacelessContext = false;
+
+ // GL_ANGLE_client_arrays
+ bool clientArrays = false;
+
+ // GL_ANGLE_robust_resource_initialization
+ bool robustResourceInitialization = false;
+
+ // GL_ANGLE_program_cache_control
+ bool programCacheControl = false;
+
+ // GL_ANGLE_texture_rectangle
+ bool textureRectangle = false;
+
+ // GL_EXT_geometry_shader
+ bool geometryShader = false;
+
+ // GLES1 emulation: GLES1 extensions
+ // GL_OES_point_size_array
+ bool pointSizeArray = false;
+
+ // GL_OES_texture_cube_map
+ bool textureCubeMap = false;
+
+ // GL_OES_point_sprite
+ bool pointSprite = false;
+
+ // GL_OES_draw_texture
+ bool drawTexture = false;
+
+ // EGL_ANGLE_explicit_context GL subextensions
+ // GL_ANGLE_explicit_context_gles1
+ bool explicitContextGles1 = false;
+ // GL_ANGLE_explicit_context
+ bool explicitContext = false;
+
+ // GL_KHR_parallel_shader_compile
+ bool parallelShaderCompile = false;
+
+ // GL_OES_texture_storage_multisample_2d_array
+ bool textureStorageMultisample2DArray = false;
+
+ // GL_ANGLE_multiview_multisample
+ bool multiviewMultisample = false;
+
+ // GL_EXT_blend_func_extended
+ bool blendFuncExtended = false;
+ GLuint maxDualSourceDrawBuffers = 0;
+
+ // GL_EXT_float_blend
+ bool floatBlend = false;
+
+ // GL_ANGLE_memory_size
+ bool memorySize = false;
+
+ // GL_ANGLE_texture_multisample
+ bool textureMultisample = false;
+
+ // GL_ANGLE_multi_draw
+ bool multiDraw = false;
+
+ // GL_ANGLE_provoking_vertex
+ bool provokingVertex = false;
+
+ // GL_CHROMIUM_lose_context
+ bool loseContextCHROMIUM = false;
+
+ // GL_ANGLE_texture_external_update
+ bool textureExternalUpdateANGLE = false;
+
+ // GL_ANGLE_base_vertex_base_instance
+ bool baseVertexBaseInstance = false;
+};
+
+struct ExtensionInfo
+{
+ // If this extension can be enabled with glRequestExtension (GL_ANGLE_request_extension)
+ bool Requestable = false;
+
+ // Pointer to a boolean member of the Extensions struct
+ typedef bool(Extensions::*ExtensionBool);
+ ExtensionBool ExtensionsMember = nullptr;
+};
+
+using ExtensionInfoMap = std::map<std::string, ExtensionInfo>;
+const ExtensionInfoMap &GetExtensionInfoMap();
+
+struct Limitations
+{
+ Limitations();
+
+ // Renderer doesn't support gl_FrontFacing in fragment shaders
+ bool noFrontFacingSupport = false;
+
+ // Renderer doesn't support GL_SAMPLE_ALPHA_TO_COVERAGE
+ bool noSampleAlphaToCoverageSupport = false;
+
+ // In glVertexAttribDivisorANGLE, attribute zero must have a zero divisor
+ bool attributeZeroRequiresZeroDivisorInEXT = false;
+
+ // Unable to support different values for front and back faces for stencil refs and masks
+ bool noSeparateStencilRefsAndMasks = false;
+
+ // Renderer doesn't support non-constant indexing loops in fragment shader
+ bool shadersRequireIndexedLoopValidation = false;
+
+ // Renderer doesn't support Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA
+ // and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR blend functions.
+ bool noSimultaneousConstantColorAndAlphaBlendFunc = false;
+
+ // D3D9 does not support flexible varying register packing.
+ bool noFlexibleVaryingPacking = false;
+
+ // D3D does not support having multiple transform feedback outputs go to the same buffer.
+ bool noDoubleBoundTransformFeedbackBuffers = false;
+
+ // D3D does not support vertex attribute aliasing
+ bool noVertexAttributeAliasing = false;
+};
+
+struct TypePrecision
+{
+ TypePrecision();
+ TypePrecision(const TypePrecision &other);
+
+ void setIEEEFloat();
+ void setTwosComplementInt(unsigned int bits);
+ void setSimulatedFloat(unsigned int range, unsigned int precision);
+ void setSimulatedInt(unsigned int range);
+
+ void get(GLint *returnRange, GLint *returnPrecision) const;
+
+ std::array<GLint, 2> range = {0, 0};
+ GLint precision = 0;
+};
+
+struct Caps
+{
+ Caps();
+ Caps(const Caps &other);
+ ~Caps();
+
+ // ES 3.1 (April 29, 2015) 20.39: implementation dependent values
+ GLuint64 maxElementIndex = 0;
+ GLuint max3DTextureSize = 0;
+ GLuint max2DTextureSize = 0;
+ GLuint maxRectangleTextureSize = 0;
+ GLuint maxArrayTextureLayers = 0;
+ GLfloat maxLODBias = 0.0f;
+ GLuint maxCubeMapTextureSize = 0;
+ GLuint maxRenderbufferSize = 0;
+ GLfloat minAliasedPointSize = 1.0f;
+ GLfloat maxAliasedPointSize = 1.0f;
+ GLfloat minAliasedLineWidth = 0.0f;
+ GLfloat maxAliasedLineWidth = 0.0f;
+
+ // ES 3.1 (April 29, 2015) 20.40: implementation dependent values (cont.)
+ GLuint maxDrawBuffers = 0;
+ GLuint maxFramebufferWidth = 0;
+ GLuint maxFramebufferHeight = 0;
+ GLuint maxFramebufferSamples = 0;
+ GLuint maxColorAttachments = 0;
+ GLuint maxViewportWidth = 0;
+ GLuint maxViewportHeight = 0;
+ GLuint maxSampleMaskWords = 0;
+ GLuint maxColorTextureSamples = 0;
+ GLuint maxDepthTextureSamples = 0;
+ GLuint maxIntegerSamples = 0;
+ GLuint64 maxServerWaitTimeout = 0;
+
+ // ES 3.1 (April 29, 2015) Table 20.41: Implementation dependent values (cont.)
+ GLint maxVertexAttribRelativeOffset = 0;
+ GLuint maxVertexAttribBindings = 0;
+ GLint maxVertexAttribStride = 0;
+ GLuint maxElementsIndices = 0;
+ GLuint maxElementsVertices = 0;
+ std::vector<GLenum> compressedTextureFormats;
+ std::vector<GLenum> programBinaryFormats;
+ std::vector<GLenum> shaderBinaryFormats;
+ TypePrecision vertexHighpFloat;
+ TypePrecision vertexMediumpFloat;
+ TypePrecision vertexLowpFloat;
+ TypePrecision vertexHighpInt;
+ TypePrecision vertexMediumpInt;
+ TypePrecision vertexLowpInt;
+ TypePrecision fragmentHighpFloat;
+ TypePrecision fragmentMediumpFloat;
+ TypePrecision fragmentLowpFloat;
+ TypePrecision fragmentHighpInt;
+ TypePrecision fragmentMediumpInt;
+ TypePrecision fragmentLowpInt;
+
+ // Implementation dependent limits required on all shader types.
+ // TODO(jiawei.shao@intel.com): organize all such limits into ShaderMap.
+ // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
+ // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
+ // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
+ // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
+ // limits
+ // GL_EXT_geometry_shader (May 31, 2016) Table 20.46: Implementation dependent aggregate shader
+ // limits
+ ShaderMap<GLuint> maxShaderUniformBlocks = {};
+ ShaderMap<GLuint> maxShaderTextureImageUnits = {};
+ ShaderMap<GLuint> maxShaderStorageBlocks = {};
+ ShaderMap<GLuint> maxShaderUniformComponents = {};
+ ShaderMap<GLuint> maxShaderAtomicCounterBuffers = {};
+ ShaderMap<GLuint> maxShaderAtomicCounters = {};
+ ShaderMap<GLuint> maxShaderImageUniforms = {};
+ // Note that we can query MAX_COMPUTE_UNIFORM_COMPONENTS and MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT
+ // by GetIntegerv, but we can only use GetInteger64v on MAX_VERTEX_UNIFORM_COMPONENTS and
+ // MAX_FRAGMENT_UNIFORM_COMPONENTS. Currently we use GLuint64 to store all these values so that
+ // we can put them together into one ShaderMap.
+ ShaderMap<GLuint64> maxCombinedShaderUniformComponents = {};
+
+ // ES 3.1 (April 29, 2015) Table 20.43: Implementation dependent Vertex shader limits
+ GLuint maxVertexAttributes = 0;
+ GLuint maxVertexUniformVectors = 0;
+ GLuint maxVertexOutputComponents = 0;
+
+ // ES 3.1 (April 29, 2015) Table 20.44: Implementation dependent Fragment shader limits
+ GLuint maxFragmentUniformVectors = 0;
+ GLuint maxFragmentInputComponents = 0;
+ GLint minProgramTextureGatherOffset = 0;
+ GLuint maxProgramTextureGatherOffset = 0;
+ GLint minProgramTexelOffset = 0;
+ GLint maxProgramTexelOffset = 0;
+
+ // ES 3.1 (April 29, 2015) Table 20.45: implementation dependent compute shader limits
+ std::array<GLuint, 3> maxComputeWorkGroupCount = {0, 0, 0};
+ std::array<GLuint, 3> maxComputeWorkGroupSize = {0, 0, 0};
+ GLuint maxComputeWorkGroupInvocations = 0;
+ GLuint maxComputeSharedMemorySize = 0;
+
+ // ES 3.1 (April 29, 2015) Table 20.46: implementation dependent aggregate shader limits
+ GLuint maxUniformBufferBindings = 0;
+ GLuint64 maxUniformBlockSize = 0;
+ GLuint uniformBufferOffsetAlignment = 0;
+ GLuint maxCombinedUniformBlocks = 0;
+ GLuint maxVaryingComponents = 0;
+ GLuint maxVaryingVectors = 0;
+ GLuint maxCombinedTextureImageUnits = 0;
+ GLuint maxCombinedShaderOutputResources = 0;
+
+ // ES 3.1 (April 29, 2015) Table 20.47: implementation dependent aggregate shader limits (cont.)
+ GLuint maxUniformLocations = 0;
+ GLuint maxAtomicCounterBufferBindings = 0;
+ GLuint maxAtomicCounterBufferSize = 0;
+ GLuint maxCombinedAtomicCounterBuffers = 0;
+ GLuint maxCombinedAtomicCounters = 0;
+ GLuint maxImageUnits = 0;
+ GLuint maxCombinedImageUniforms = 0;
+ GLuint maxShaderStorageBufferBindings = 0;
+ GLuint64 maxShaderStorageBlockSize = 0;
+ GLuint maxCombinedShaderStorageBlocks = 0;
+ GLuint shaderStorageBufferOffsetAlignment = 0;
+
+ // ES 3.1 (April 29, 2015) Table 20.48: implementation dependent transform feedback limits
+ GLuint maxTransformFeedbackInterleavedComponents = 0;
+ GLuint maxTransformFeedbackSeparateAttributes = 0;
+ GLuint maxTransformFeedbackSeparateComponents = 0;
+
+ // ES 3.1 (April 29, 2015) Table 20.49: Framebuffer Dependent Values
+ GLuint maxSamples = 0;
+
+ // GL_EXT_geometry_shader (May 31, 2016) Table 20.40: Implementation-Dependent Values (cont.)
+ GLuint maxFramebufferLayers = 0;
+ GLuint layerProvokingVertex = 0;
+
+ // GL_EXT_geometry_shader (May 31, 2016) Table 20.43gs: Implementation dependent geometry shader
+ // limits
+ GLuint maxGeometryInputComponents = 0;
+ GLuint maxGeometryOutputComponents = 0;
+ GLuint maxGeometryOutputVertices = 0;
+ GLuint maxGeometryTotalOutputComponents = 0;
+ GLuint maxGeometryShaderInvocations = 0;
+
+ GLuint subPixelBits = 4;
+
+ // GLES1 emulation: Caps for ES 1.1. Taken from Table 6.20 / 6.22 in the OpenGL ES 1.1 spec.
+ GLuint maxMultitextureUnits = 0;
+ GLuint maxClipPlanes = 0;
+ GLuint maxLights = 0;
+ static constexpr int GlobalMatrixStackDepth = 16;
+ GLuint maxModelviewMatrixStackDepth = 0;
+ GLuint maxProjectionMatrixStackDepth = 0;
+ GLuint maxTextureMatrixStackDepth = 0;
+ GLfloat minSmoothPointSize = 0.0f;
+ GLfloat maxSmoothPointSize = 0.0f;
+ GLfloat minSmoothLineWidth = 0.0f;
+ GLfloat maxSmoothLineWidth = 0.0f;
+};
+
+Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions);
+} // namespace gl
+
+namespace egl
+{
+
+struct Caps
+{
+ Caps();
+
+ // Support for NPOT surfaces
+ bool textureNPOT;
+};
+
+struct DisplayExtensions
+{
+ DisplayExtensions();
+
+ // Generate a vector of supported extension strings
+ std::vector<std::string> getStrings() const;
+
+ // EGL_EXT_create_context_robustness
+ bool createContextRobustness = false;
+
+ // EGL_ANGLE_d3d_share_handle_client_buffer
+ bool d3dShareHandleClientBuffer = false;
+
+ // EGL_ANGLE_d3d_texture_client_buffer
+ bool d3dTextureClientBuffer = false;
+
+ // EGL_ANGLE_surface_d3d_texture_2d_share_handle
+ bool surfaceD3DTexture2DShareHandle = false;
+
+ // EGL_ANGLE_query_surface_pointer
+ bool querySurfacePointer = false;
+
+ // EGL_ANGLE_window_fixed_size
+ bool windowFixedSize = false;
+
+ // EGL_ANGLE_keyed_mutex
+ bool keyedMutex = false;
+
+ // EGL_ANGLE_surface_orientation
+ bool surfaceOrientation = false;
+
+ // EGL_NV_post_sub_buffer
+ bool postSubBuffer = false;
+
+ // EGL_KHR_create_context
+ bool createContext = false;
+
+ // EGL_EXT_device_query
+ bool deviceQuery = false;
+
+ // EGL_KHR_image
+ bool image = false;
+
+ // EGL_KHR_image_base
+ bool imageBase = false;
+
+ // EGL_KHR_image_pixmap
+ bool imagePixmap = false;
+
+ // EGL_KHR_gl_texture_2D_image
+ bool glTexture2DImage = false;
+
+ // EGL_KHR_gl_texture_cubemap_image
+ bool glTextureCubemapImage = false;
+
+ // EGL_KHR_gl_texture_3D_image
+ bool glTexture3DImage = false;
+
+ // EGL_KHR_gl_renderbuffer_image
+ bool glRenderbufferImage = false;
+
+ // EGL_KHR_get_all_proc_addresses
+ bool getAllProcAddresses = false;
+
+ // EGL_ANGLE_flexible_surface_compatibility
+ bool flexibleSurfaceCompatibility = false;
+
+ // EGL_ANGLE_direct_composition
+ bool directComposition = false;
+
+ // EGL_ANGLE_windows_ui_composition
+ bool windowsUIComposition = false;
+
+ // KHR_create_context_no_error
+ bool createContextNoError = false;
+
+ // EGL_KHR_stream
+ bool stream = false;
+
+ // EGL_KHR_stream_consumer_gltexture
+ bool streamConsumerGLTexture = false;
+
+ // EGL_NV_stream_consumer_gltexture_yuv
+ bool streamConsumerGLTextureYUV = false;
+
+ // EGL_ANGLE_stream_producer_d3d_texture
+ bool streamProducerD3DTexture = false;
+
+ // EGL_KHR_fence_sync
+ bool fenceSync = false;
+
+ // EGL_KHR_wait_sync
+ bool waitSync = false;
+
+ // EGL_ANGLE_create_context_webgl_compatibility
+ bool createContextWebGLCompatibility = false;
+
+ // EGL_CHROMIUM_create_context_bind_generates_resource
+ bool createContextBindGeneratesResource = false;
+
+ // EGL_CHROMIUM_get_sync_values
+ bool getSyncValues = false;
+
+ // EGL_KHR_swap_buffers_with_damage
+ bool swapBuffersWithDamage = false;
+
+ // EGL_EXT_pixel_format_float
+ bool pixelFormatFloat = false;
+
+ // EGL_KHR_surfaceless_context
+ bool surfacelessContext = false;
+
+ // EGL_ANGLE_display_texture_share_group
+ bool displayTextureShareGroup = false;
+
+ // EGL_ANGLE_create_context_client_arrays
+ bool createContextClientArrays = false;
+
+ // EGL_ANGLE_program_cache_control
+ bool programCacheControl = false;
+
+ // EGL_ANGLE_robust_resource_initialization
+ bool robustResourceInitialization = false;
+
+ // EGL_ANGLE_iosurface_client_buffer
+ bool iosurfaceClientBuffer = false;
+
+ // EGL_ANGLE_create_context_extensions_enabled
+ bool createContextExtensionsEnabled = false;
+
+ // EGL_ANDROID_presentation_time
+ bool presentationTime = false;
+
+ // EGL_ANDROID_blob_cache
+ bool blobCache = false;
+
+ // EGL_ANDROID_image_native_buffer
+ bool imageNativeBuffer = false;
+
+ // EGL_ANDROID_get_frame_timestamps
+ bool getFrameTimestamps = false;
+
+ // EGL_ANDROID_recordable
+ bool recordable = false;
+
+ // EGL_ANGLE_power_preference
+ bool powerPreference = false;
+
+ // EGL_ANGLE_image_d3d11_texture
+ bool imageD3D11Texture = false;
+
+ // EGL_ANDROID_get_native_client_buffer
+ bool getNativeClientBufferANDROID = false;
+
+ // EGL_ANDROID_native_fence_sync
+ bool nativeFenceSyncANDROID = false;
+
+ // EGL_ANGLE_create_context_backwards_compatible
+ bool createContextBackwardsCompatible = false;
+};
+
+struct DeviceExtensions
+{
+ DeviceExtensions();
+
+ // Generate a vector of supported extension strings
+ std::vector<std::string> getStrings() const;
+
+ // EGL_ANGLE_device_d3d
+ bool deviceD3D = false;
+};
+
+struct ClientExtensions
+{
+ ClientExtensions();
+ ClientExtensions(const ClientExtensions &other);
+
+ // Generate a vector of supported extension strings
+ std::vector<std::string> getStrings() const;
+
+ // EGL_EXT_client_extensions
+ bool clientExtensions = false;
+
+ // EGL_EXT_platform_base
+ bool platformBase = false;
+
+ // EGL_EXT_platform_device
+ bool platformDevice = false;
+
+ // EGL_ANGLE_platform_angle
+ bool platformANGLE = false;
+
+ // EGL_ANGLE_platform_angle_d3d
+ bool platformANGLED3D = false;
+
+ // EGL_ANGLE_platform_angle_opengl
+ bool platformANGLEOpenGL = false;
+
+ // EGL_ANGLE_platform_angle_null
+ bool platformANGLENULL = false;
+
+ // EGL_ANGLE_platform_angle_vulkan
+ bool platformANGLEVulkan = false;
+
+ // EGL_ANGLE_platform_angle_context_virtualization
+ bool platformANGLEContextVirtualization = false;
+
+ // EGL_ANGLE_device_creation
+ bool deviceCreation = false;
+
+ // EGL_ANGLE_device_creation_d3d11
+ bool deviceCreationD3D11 = false;
+
+ // EGL_ANGLE_x11_visual
+ bool x11Visual = false;
+
+ // EGL_ANGLE_experimental_present_path
+ bool experimentalPresentPath = false;
+
+ // EGL_KHR_client_get_all_proc_addresses
+ bool clientGetAllProcAddresses = false;
+
+ // EGL_KHR_debug
+ bool debug = false;
+
+ // EGL_ANGLE_explicit_context
+ bool explicitContext = false;
+
+ // EGL_ANGLE_feature_control
+ bool featureControlANGLE = false;
+};
+
+} // namespace egl
+
+#endif // LIBANGLE_CAPS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Compiler.cpp b/gfx/angle/checkout/src/libANGLE/Compiler.cpp
new file mode 100644
index 0000000000..9810abd701
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Compiler.cpp
@@ -0,0 +1,294 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Compiler.cpp: implements the gl::Compiler class.
+
+#include "libANGLE/Compiler.h"
+
+#include "common/debug.h"
+#include "libANGLE/State.h"
+#include "libANGLE/renderer/CompilerImpl.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+
+namespace gl
+{
+
+namespace
+{
+
+// To know when to call sh::Initialize and sh::Finalize.
+size_t gActiveCompilers = 0;
+
+ShShaderSpec SelectShaderSpec(GLint majorVersion,
+ GLint minorVersion,
+ bool isWebGL,
+ EGLenum clientType)
+{
+ // For Desktop GL
+ if (clientType == EGL_OPENGL_API)
+ {
+ ASSERT(majorVersion == 3 && minorVersion == 3);
+ return SH_GL3_3_SPEC;
+ }
+
+ if (majorVersion >= 3)
+ {
+ if (minorVersion == 1)
+ {
+ return isWebGL ? SH_WEBGL3_SPEC : SH_GLES3_1_SPEC;
+ }
+ else
+ {
+ return isWebGL ? SH_WEBGL2_SPEC : SH_GLES3_SPEC;
+ }
+ }
+
+ // GLES1 emulation: Use GLES3 shader spec.
+ if (!isWebGL && majorVersion == 1)
+ {
+ return SH_GLES3_SPEC;
+ }
+
+ return isWebGL ? SH_WEBGL_SPEC : SH_GLES2_SPEC;
+}
+
+} // anonymous namespace
+
+Compiler::Compiler(rx::GLImplFactory *implFactory, const State &state)
+ : mImplementation(implFactory->createCompiler()),
+ mSpec(SelectShaderSpec(state.getClientMajorVersion(),
+ state.getClientMinorVersion(),
+ state.getExtensions().webglCompatibility,
+ state.getClientType())),
+ mOutputType(mImplementation->getTranslatorOutputType()),
+ mResources()
+{
+ ASSERT(state.getClientMajorVersion() == 1 || state.getClientMajorVersion() == 2 ||
+ state.getClientMajorVersion() == 3);
+
+ const gl::Caps &caps = state.getCaps();
+ const gl::Extensions &extensions = state.getExtensions();
+
+ if (gActiveCompilers == 0)
+ {
+ sh::Initialize();
+ }
+ ++gActiveCompilers;
+
+ sh::InitBuiltInResources(&mResources);
+ mResources.MaxVertexAttribs = caps.maxVertexAttributes;
+ mResources.MaxVertexUniformVectors = caps.maxVertexUniformVectors;
+ mResources.MaxVaryingVectors = caps.maxVaryingVectors;
+ mResources.MaxVertexTextureImageUnits = caps.maxShaderTextureImageUnits[ShaderType::Vertex];
+ mResources.MaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
+ mResources.MaxTextureImageUnits = caps.maxShaderTextureImageUnits[ShaderType::Fragment];
+ mResources.MaxFragmentUniformVectors = caps.maxFragmentUniformVectors;
+ mResources.MaxDrawBuffers = caps.maxDrawBuffers;
+ mResources.OES_standard_derivatives = extensions.standardDerivatives;
+ mResources.EXT_draw_buffers = extensions.drawBuffers;
+ mResources.EXT_shader_texture_lod = extensions.shaderTextureLOD;
+ mResources.OES_EGL_image_external = extensions.eglImageExternal;
+ mResources.OES_EGL_image_external_essl3 = extensions.eglImageExternalEssl3;
+ mResources.NV_EGL_stream_consumer_external = extensions.eglStreamConsumerExternal;
+ mResources.ARB_texture_rectangle = extensions.textureRectangle;
+ mResources.OES_texture_storage_multisample_2d_array =
+ extensions.textureStorageMultisample2DArray;
+ mResources.OES_texture_3D = extensions.texture3DOES;
+ mResources.ANGLE_texture_multisample = extensions.textureMultisample;
+ mResources.ANGLE_multi_draw = extensions.multiDraw;
+ mResources.ANGLE_base_vertex_base_instance = extensions.baseVertexBaseInstance;
+
+ // TODO: use shader precision caps to determine if high precision is supported?
+ mResources.FragmentPrecisionHigh = 1;
+ mResources.EXT_frag_depth = extensions.fragDepth;
+
+ // OVR_multiview state
+ mResources.OVR_multiview = extensions.multiview;
+
+ // OVR_multiview2 state
+ mResources.OVR_multiview2 = extensions.multiview2;
+ mResources.MaxViewsOVR = extensions.maxViews;
+
+ // GLSL ES 3.0 constants
+ mResources.MaxVertexOutputVectors = caps.maxVertexOutputComponents / 4;
+ mResources.MaxFragmentInputVectors = caps.maxFragmentInputComponents / 4;
+ mResources.MinProgramTexelOffset = caps.minProgramTexelOffset;
+ mResources.MaxProgramTexelOffset = caps.maxProgramTexelOffset;
+
+ // EXT_blend_func_extended
+ mResources.EXT_blend_func_extended = extensions.blendFuncExtended;
+ mResources.MaxDualSourceDrawBuffers = extensions.maxDualSourceDrawBuffers;
+
+ // GLSL ES 3.1 constants
+ mResources.MaxProgramTextureGatherOffset = caps.maxProgramTextureGatherOffset;
+ mResources.MinProgramTextureGatherOffset = caps.minProgramTextureGatherOffset;
+ mResources.MaxImageUnits = caps.maxImageUnits;
+ mResources.MaxVertexImageUniforms = caps.maxShaderImageUniforms[ShaderType::Vertex];
+ mResources.MaxFragmentImageUniforms = caps.maxShaderImageUniforms[ShaderType::Fragment];
+ mResources.MaxComputeImageUniforms = caps.maxShaderImageUniforms[ShaderType::Compute];
+ mResources.MaxCombinedImageUniforms = caps.maxCombinedImageUniforms;
+ mResources.MaxCombinedShaderOutputResources = caps.maxCombinedShaderOutputResources;
+ mResources.MaxUniformLocations = caps.maxUniformLocations;
+
+ for (size_t index = 0u; index < 3u; ++index)
+ {
+ mResources.MaxComputeWorkGroupCount[index] = caps.maxComputeWorkGroupCount[index];
+ mResources.MaxComputeWorkGroupSize[index] = caps.maxComputeWorkGroupSize[index];
+ }
+
+ mResources.MaxComputeUniformComponents = caps.maxShaderUniformComponents[ShaderType::Compute];
+ mResources.MaxComputeTextureImageUnits = caps.maxShaderTextureImageUnits[ShaderType::Compute];
+
+ mResources.MaxComputeAtomicCounters = caps.maxShaderAtomicCounters[ShaderType::Compute];
+ mResources.MaxComputeAtomicCounterBuffers =
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Compute];
+
+ mResources.MaxVertexAtomicCounters = caps.maxShaderAtomicCounters[ShaderType::Vertex];
+ mResources.MaxFragmentAtomicCounters = caps.maxShaderAtomicCounters[ShaderType::Fragment];
+ mResources.MaxCombinedAtomicCounters = caps.maxCombinedAtomicCounters;
+ mResources.MaxAtomicCounterBindings = caps.maxAtomicCounterBufferBindings;
+ mResources.MaxVertexAtomicCounterBuffers =
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Vertex];
+ mResources.MaxFragmentAtomicCounterBuffers =
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Fragment];
+ mResources.MaxCombinedAtomicCounterBuffers = caps.maxCombinedAtomicCounterBuffers;
+ mResources.MaxAtomicCounterBufferSize = caps.maxAtomicCounterBufferSize;
+
+ mResources.MaxUniformBufferBindings = caps.maxUniformBufferBindings;
+ mResources.MaxShaderStorageBufferBindings = caps.maxShaderStorageBufferBindings;
+
+ // Needed by point size clamping workaround
+ mResources.MaxPointSize = caps.maxAliasedPointSize;
+
+ if (state.getClientMajorVersion() == 2 && !extensions.drawBuffers)
+ {
+ mResources.MaxDrawBuffers = 1;
+ }
+
+ // Geometry Shader constants
+ mResources.EXT_geometry_shader = extensions.geometryShader;
+ mResources.MaxGeometryUniformComponents = caps.maxShaderUniformComponents[ShaderType::Geometry];
+ mResources.MaxGeometryUniformBlocks = caps.maxShaderUniformBlocks[ShaderType::Geometry];
+ mResources.MaxGeometryInputComponents = caps.maxGeometryInputComponents;
+ mResources.MaxGeometryOutputComponents = caps.maxGeometryOutputComponents;
+ mResources.MaxGeometryOutputVertices = caps.maxGeometryOutputVertices;
+ mResources.MaxGeometryTotalOutputComponents = caps.maxGeometryTotalOutputComponents;
+ mResources.MaxGeometryTextureImageUnits = caps.maxShaderTextureImageUnits[ShaderType::Geometry];
+
+ mResources.MaxGeometryAtomicCounterBuffers =
+ caps.maxShaderAtomicCounterBuffers[ShaderType::Geometry];
+ mResources.MaxGeometryAtomicCounters = caps.maxShaderAtomicCounters[ShaderType::Geometry];
+ mResources.MaxGeometryShaderStorageBlocks = caps.maxShaderStorageBlocks[ShaderType::Geometry];
+ mResources.MaxGeometryShaderInvocations = caps.maxGeometryShaderInvocations;
+ mResources.MaxGeometryImageUniforms = caps.maxShaderImageUniforms[ShaderType::Geometry];
+}
+
+Compiler::~Compiler()
+{
+ for (auto &pool : mPools)
+ {
+ for (ShCompilerInstance &instance : pool)
+ {
+ instance.destroy();
+ }
+ }
+ --gActiveCompilers;
+ if (gActiveCompilers == 0)
+ {
+ sh::Finalize();
+ }
+}
+
+ShCompilerInstance Compiler::getInstance(ShaderType type)
+{
+ ASSERT(type != ShaderType::InvalidEnum);
+ auto &pool = mPools[type];
+ if (pool.empty())
+ {
+ ShHandle handle = sh::ConstructCompiler(ToGLenum(type), mSpec, mOutputType, &mResources);
+ ASSERT(handle);
+ return ShCompilerInstance(handle, mOutputType, type);
+ }
+ else
+ {
+ ShCompilerInstance instance = std::move(pool.back());
+ pool.pop_back();
+ return instance;
+ }
+}
+
+void Compiler::putInstance(ShCompilerInstance &&instance)
+{
+ static constexpr size_t kMaxPoolSize = 32;
+ auto &pool = mPools[instance.getShaderType()];
+ if (pool.size() < kMaxPoolSize)
+ {
+ pool.push_back(std::move(instance));
+ }
+ else
+ {
+ instance.destroy();
+ }
+}
+
+ShCompilerInstance::ShCompilerInstance() : mHandle(nullptr) {}
+
+ShCompilerInstance::ShCompilerInstance(ShHandle handle,
+ ShShaderOutput outputType,
+ ShaderType shaderType)
+ : mHandle(handle), mOutputType(outputType), mShaderType(shaderType)
+{}
+
+ShCompilerInstance::~ShCompilerInstance()
+{
+ ASSERT(mHandle == nullptr);
+}
+
+void ShCompilerInstance::destroy()
+{
+ if (mHandle != nullptr)
+ {
+ sh::Destruct(mHandle);
+ mHandle = nullptr;
+ }
+}
+
+ShCompilerInstance::ShCompilerInstance(ShCompilerInstance &&other)
+ : mHandle(other.mHandle), mOutputType(other.mOutputType), mShaderType(other.mShaderType)
+{
+ other.mHandle = nullptr;
+}
+
+ShCompilerInstance &ShCompilerInstance::operator=(ShCompilerInstance &&other)
+{
+ mHandle = other.mHandle;
+ mOutputType = other.mOutputType;
+ mShaderType = other.mShaderType;
+ other.mHandle = nullptr;
+ return *this;
+}
+
+ShHandle ShCompilerInstance::getHandle()
+{
+ return mHandle;
+}
+
+ShaderType ShCompilerInstance::getShaderType() const
+{
+ return mShaderType;
+}
+
+const std::string &ShCompilerInstance::getBuiltinResourcesString()
+{
+ return sh::GetBuiltInResourcesString(mHandle);
+}
+
+ShShaderOutput ShCompilerInstance::getShaderOutputType() const
+{
+ return mOutputType;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Compiler.h b/gfx/angle/checkout/src/libANGLE/Compiler.h
new file mode 100644
index 0000000000..0b1105a279
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Compiler.h
@@ -0,0 +1,73 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Compiler.h: Defines the gl::Compiler class, abstracting the ESSL compiler
+// that a GL context holds.
+
+#ifndef LIBANGLE_COMPILER_H_
+#define LIBANGLE_COMPILER_H_
+
+#include <vector>
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/PackedEnums.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+
+namespace rx
+{
+class CompilerImpl;
+class GLImplFactory;
+} // namespace rx
+
+namespace gl
+{
+class ShCompilerInstance;
+class State;
+
+class Compiler final : public RefCountObjectNoID
+{
+ public:
+ Compiler(rx::GLImplFactory *implFactory, const State &data);
+
+ ShCompilerInstance getInstance(ShaderType shaderType);
+ void putInstance(ShCompilerInstance &&instance);
+ ShShaderOutput getShaderOutputType() const { return mOutputType; }
+
+ private:
+ ~Compiler() override;
+ std::unique_ptr<rx::CompilerImpl> mImplementation;
+ ShShaderSpec mSpec;
+ ShShaderOutput mOutputType;
+ ShBuiltInResources mResources;
+ ShaderMap<std::vector<ShCompilerInstance>> mPools;
+};
+
+class ShCompilerInstance final : public angle::NonCopyable
+{
+ public:
+ ShCompilerInstance();
+ ShCompilerInstance(ShHandle handle, ShShaderOutput outputType, ShaderType shaderType);
+ ~ShCompilerInstance();
+ void destroy();
+
+ ShCompilerInstance(ShCompilerInstance &&other);
+ ShCompilerInstance &operator=(ShCompilerInstance &&other);
+
+ ShHandle getHandle();
+ ShaderType getShaderType() const;
+ const std::string &getBuiltinResourcesString();
+ ShShaderOutput getShaderOutputType() const;
+
+ private:
+ ShHandle mHandle;
+ ShShaderOutput mOutputType;
+ ShaderType mShaderType;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_COMPILER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Config.cpp b/gfx/angle/checkout/src/libANGLE/Config.cpp
new file mode 100644
index 0000000000..4134226d05
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Config.cpp
@@ -0,0 +1,394 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Config.cpp: Implements the egl::Config class, describing the format, type
+// and size for an egl::Surface. Implements EGLConfig and related functionality.
+// [EGL 1.5] section 3.4 page 19.
+
+#include "libANGLE/Config.h"
+#include "libANGLE/AttributeMap.h"
+
+#include <algorithm>
+#include <vector>
+
+#include <EGL/eglext.h>
+#include "angle_gl.h"
+
+#include "common/debug.h"
+
+namespace egl
+{
+
+Config::Config()
+ : renderTargetFormat(GL_NONE),
+ depthStencilFormat(GL_NONE),
+ bufferSize(0),
+ redSize(0),
+ greenSize(0),
+ blueSize(0),
+ luminanceSize(0),
+ alphaSize(0),
+ alphaMaskSize(0),
+ bindToTextureRGB(EGL_FALSE),
+ bindToTextureRGBA(EGL_FALSE),
+ colorBufferType(EGL_RGB_BUFFER),
+ configCaveat(EGL_NONE),
+ configID(0),
+ conformant(0),
+ depthSize(0),
+ level(0),
+ matchNativePixmap(EGL_FALSE),
+ maxPBufferWidth(0),
+ maxPBufferHeight(0),
+ maxPBufferPixels(0),
+ maxSwapInterval(0),
+ minSwapInterval(0),
+ nativeRenderable(EGL_FALSE),
+ nativeVisualID(0),
+ nativeVisualType(0),
+ renderableType(0),
+ sampleBuffers(0),
+ samples(0),
+ stencilSize(0),
+ surfaceType(0),
+ transparentType(EGL_NONE),
+ transparentRedValue(0),
+ transparentGreenValue(0),
+ transparentBlueValue(0),
+ optimalOrientation(0),
+ colorComponentType(EGL_COLOR_COMPONENT_TYPE_FIXED_EXT),
+ recordable(EGL_FALSE)
+{}
+
+Config::~Config() {}
+
+Config::Config(const Config &other) = default;
+
+Config &Config::operator=(const Config &other) = default;
+
+ConfigSet::ConfigSet() = default;
+
+ConfigSet::ConfigSet(const ConfigSet &other) = default;
+
+ConfigSet &ConfigSet::operator=(const ConfigSet &other) = default;
+
+ConfigSet::~ConfigSet() = default;
+
+EGLint ConfigSet::add(const Config &config)
+{
+ // Set the config's ID to a small number that starts at 1 ([EGL 1.5] section 3.4)
+ EGLint id = static_cast<EGLint>(mConfigs.size()) + 1;
+
+ Config copyConfig(config);
+ copyConfig.configID = id;
+ mConfigs.insert(std::make_pair(id, copyConfig));
+
+ return id;
+}
+
+const Config &ConfigSet::get(EGLint id) const
+{
+ ASSERT(mConfigs.find(id) != mConfigs.end());
+ return mConfigs.find(id)->second;
+}
+
+void ConfigSet::clear()
+{
+ mConfigs.clear();
+}
+
+size_t ConfigSet::size() const
+{
+ return mConfigs.size();
+}
+
+bool ConfigSet::contains(const Config *config) const
+{
+ for (auto i = mConfigs.begin(); i != mConfigs.end(); i++)
+ {
+ const Config &item = i->second;
+ if (config == &item)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Function object used by STL sorting routines for ordering Configs according to [EGL 1.5]
+// section 3.4.1.2 page 28.
+class ConfigSorter
+{
+ public:
+ explicit ConfigSorter(const AttributeMap &attributeMap)
+ : mWantRed(false),
+ mWantGreen(false),
+ mWantBlue(false),
+ mWantAlpha(false),
+ mWantLuminance(false)
+ {
+ scanForWantedComponents(attributeMap);
+ }
+
+ bool operator()(const Config *x, const Config *y) const { return (*this)(*x, *y); }
+
+ bool operator()(const Config &x, const Config &y) const
+ {
+#define SORT(attribute) \
+ do \
+ { \
+ if (x.attribute != y.attribute) \
+ return x.attribute < y.attribute; \
+ } while (0)
+
+ static_assert(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG,
+ "Unexpected EGL enum value.");
+ SORT(configCaveat);
+
+ static_assert(EGL_COLOR_COMPONENT_TYPE_FIXED_EXT < EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT,
+ "Unexpected order of EGL enums.");
+ SORT(colorComponentType);
+
+ static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, "Unexpected EGL enum value.");
+ SORT(colorBufferType);
+
+ // By larger total number of color bits, only considering those that are requested to be >
+ // 0.
+ EGLint xComponentsSize = wantedComponentsSize(x);
+ EGLint yComponentsSize = wantedComponentsSize(y);
+ if (xComponentsSize != yComponentsSize)
+ {
+ return xComponentsSize > yComponentsSize;
+ }
+
+ SORT(bufferSize);
+ SORT(sampleBuffers);
+ SORT(samples);
+ SORT(depthSize);
+ SORT(stencilSize);
+ SORT(alphaMaskSize);
+ SORT(nativeVisualType);
+ SORT(configID);
+
+#undef SORT
+
+ return false;
+ }
+
+ private:
+ static bool wantsComponent(const AttributeMap &attributeMap, EGLAttrib component)
+ {
+ // [EGL 1.5] section 3.4.1.2 page 30
+ // Sorting rule #3: by larger total number of color bits, not considering
+ // components that are 0 or don't-care.
+ EGLAttrib value = attributeMap.get(component, 0);
+ return value != 0 && value != EGL_DONT_CARE;
+ }
+
+ void scanForWantedComponents(const AttributeMap &attributeMap)
+ {
+ mWantRed = wantsComponent(attributeMap, EGL_RED_SIZE);
+ mWantGreen = wantsComponent(attributeMap, EGL_GREEN_SIZE);
+ mWantBlue = wantsComponent(attributeMap, EGL_BLUE_SIZE);
+ mWantAlpha = wantsComponent(attributeMap, EGL_ALPHA_SIZE);
+ mWantLuminance = wantsComponent(attributeMap, EGL_LUMINANCE_SIZE);
+ }
+
+ EGLint wantedComponentsSize(const Config &config) const
+ {
+ EGLint total = 0;
+
+ if (mWantRed)
+ total += config.redSize;
+ if (mWantGreen)
+ total += config.greenSize;
+ if (mWantBlue)
+ total += config.blueSize;
+ if (mWantAlpha)
+ total += config.alphaSize;
+ if (mWantLuminance)
+ total += config.luminanceSize;
+
+ return total;
+ }
+
+ bool mWantRed;
+ bool mWantGreen;
+ bool mWantBlue;
+ bool mWantAlpha;
+ bool mWantLuminance;
+};
+
+std::vector<const Config *> ConfigSet::filter(const AttributeMap &attributeMap) const
+{
+ std::vector<const Config *> result;
+ result.reserve(mConfigs.size());
+
+ for (auto configIter = mConfigs.begin(); configIter != mConfigs.end(); configIter++)
+ {
+ const Config &config = configIter->second;
+ bool match = true;
+
+ for (auto attribIter = attributeMap.begin(); attribIter != attributeMap.end(); attribIter++)
+ {
+ EGLAttrib attributeKey = attribIter->first;
+ EGLAttrib attributeValue = attribIter->second;
+
+ if (attributeValue == EGL_DONT_CARE)
+ {
+ continue;
+ }
+
+ switch (attributeKey)
+ {
+ case EGL_BUFFER_SIZE:
+ match = config.bufferSize >= attributeValue;
+ break;
+ case EGL_ALPHA_SIZE:
+ match = config.alphaSize >= attributeValue;
+ break;
+ case EGL_BLUE_SIZE:
+ match = config.blueSize >= attributeValue;
+ break;
+ case EGL_GREEN_SIZE:
+ match = config.greenSize >= attributeValue;
+ break;
+ case EGL_RED_SIZE:
+ match = config.redSize >= attributeValue;
+ break;
+ case EGL_DEPTH_SIZE:
+ match = config.depthSize >= attributeValue;
+ break;
+ case EGL_STENCIL_SIZE:
+ match = config.stencilSize >= attributeValue;
+ break;
+ case EGL_CONFIG_CAVEAT:
+ match = config.configCaveat == static_cast<EGLenum>(attributeValue);
+ break;
+ case EGL_CONFIG_ID:
+ match = config.configID == attributeValue;
+ break;
+ case EGL_LEVEL:
+ match = config.level == attributeValue;
+ break;
+ case EGL_NATIVE_RENDERABLE:
+ match = config.nativeRenderable == static_cast<EGLBoolean>(attributeValue);
+ break;
+ case EGL_NATIVE_VISUAL_TYPE:
+ match = config.nativeVisualType == attributeValue;
+ break;
+ case EGL_SAMPLES:
+ match = config.samples >= attributeValue;
+ break;
+ case EGL_SAMPLE_BUFFERS:
+ match = config.sampleBuffers >= attributeValue;
+ break;
+ case EGL_SURFACE_TYPE:
+ match = (config.surfaceType & attributeValue) == attributeValue;
+ break;
+ case EGL_TRANSPARENT_TYPE:
+ match = config.transparentType == static_cast<EGLenum>(attributeValue);
+ break;
+ case EGL_TRANSPARENT_BLUE_VALUE:
+ if (attributeMap.get(EGL_TRANSPARENT_TYPE, EGL_NONE) != EGL_NONE)
+ {
+ match = config.transparentBlueValue == attributeValue;
+ }
+ break;
+ case EGL_TRANSPARENT_GREEN_VALUE:
+ if (attributeMap.get(EGL_TRANSPARENT_TYPE, EGL_NONE) != EGL_NONE)
+ {
+ match = config.transparentGreenValue == attributeValue;
+ }
+ break;
+ case EGL_TRANSPARENT_RED_VALUE:
+ if (attributeMap.get(EGL_TRANSPARENT_TYPE, EGL_NONE) != EGL_NONE)
+ {
+ match = config.transparentRedValue == attributeValue;
+ }
+ break;
+ case EGL_BIND_TO_TEXTURE_RGB:
+ match = config.bindToTextureRGB == static_cast<EGLBoolean>(attributeValue);
+ break;
+ case EGL_BIND_TO_TEXTURE_RGBA:
+ match = config.bindToTextureRGBA == static_cast<EGLBoolean>(attributeValue);
+ break;
+ case EGL_MIN_SWAP_INTERVAL:
+ match = config.minSwapInterval == attributeValue;
+ break;
+ case EGL_MAX_SWAP_INTERVAL:
+ match = config.maxSwapInterval == attributeValue;
+ break;
+ case EGL_LUMINANCE_SIZE:
+ match = config.luminanceSize >= attributeValue;
+ break;
+ case EGL_ALPHA_MASK_SIZE:
+ match = config.alphaMaskSize >= attributeValue;
+ break;
+ case EGL_COLOR_BUFFER_TYPE:
+ match = config.colorBufferType == static_cast<EGLenum>(attributeValue);
+ break;
+ case EGL_RENDERABLE_TYPE:
+ match = (config.renderableType & attributeValue) == attributeValue;
+ break;
+ case EGL_MATCH_NATIVE_PIXMAP:
+ match = false;
+ UNIMPLEMENTED();
+ break;
+ case EGL_CONFORMANT:
+ match = (config.conformant & attributeValue) == attributeValue;
+ break;
+ case EGL_MAX_PBUFFER_WIDTH:
+ match = config.maxPBufferWidth >= attributeValue;
+ break;
+ case EGL_MAX_PBUFFER_HEIGHT:
+ match = config.maxPBufferHeight >= attributeValue;
+ break;
+ case EGL_MAX_PBUFFER_PIXELS:
+ match = config.maxPBufferPixels >= attributeValue;
+ break;
+ case EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE:
+ match = config.optimalOrientation == attributeValue;
+ break;
+ case EGL_COLOR_COMPONENT_TYPE_EXT:
+ match = config.colorComponentType == static_cast<EGLenum>(attributeValue);
+ break;
+ case EGL_RECORDABLE_ANDROID:
+ match = config.recordable == static_cast<EGLBoolean>(attributeValue);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ if (!match)
+ {
+ break;
+ }
+ }
+
+ if (match)
+ {
+ result.push_back(&config);
+ }
+ }
+
+ // Sort the result
+ std::sort(result.begin(), result.end(), ConfigSorter(attributeMap));
+
+ return result;
+}
+
+ConfigSet::ConfigMap::iterator ConfigSet::begin()
+{
+ return mConfigs.begin();
+}
+
+ConfigSet::ConfigMap::iterator ConfigSet::end()
+{
+ return mConfigs.end();
+}
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Config.h b/gfx/angle/checkout/src/libANGLE/Config.h
new file mode 100644
index 0000000000..e4c3921dc4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Config.h
@@ -0,0 +1,107 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Config.h: Defines the egl::Config class, describing the format, type
+// and size for an egl::Surface. Implements EGLConfig and related functionality.
+// [EGL 1.5] section 3.4 page 19.
+
+#ifndef INCLUDE_CONFIG_H_
+#define INCLUDE_CONFIG_H_
+
+#include "libANGLE/AttributeMap.h"
+
+#include "common/angleutils.h"
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
+#include <map>
+#include <vector>
+
+namespace egl
+{
+
+struct Config
+{
+ Config();
+ ~Config();
+ Config(const Config &other);
+ Config &operator=(const Config &other);
+
+ GLenum renderTargetFormat; // TODO(geofflang): remove this
+ GLenum depthStencilFormat; // TODO(geofflang): remove this
+
+ EGLint bufferSize; // Depth of the color buffer
+ EGLint redSize; // Bits of Red in the color buffer
+ EGLint greenSize; // Bits of Green in the color buffer
+ EGLint blueSize; // Bits of Blue in the color buffer
+ EGLint luminanceSize; // Bits of Luminance in the color buffer
+ EGLint alphaSize; // Bits of Alpha in the color buffer
+ EGLint alphaMaskSize; // Bits of Alpha Mask in the mask buffer
+ EGLBoolean bindToTextureRGB; // True if bindable to RGB textures.
+ EGLBoolean bindToTextureRGBA; // True if bindable to RGBA textures.
+ EGLenum colorBufferType; // Color buffer type
+ EGLenum configCaveat; // Any caveats for the configuration
+ EGLint configID; // Unique EGLConfig identifier
+ EGLint conformant; // Whether contexts created with this config are conformant
+ EGLint depthSize; // Bits of Z in the depth buffer
+ EGLint level; // Frame buffer level
+ EGLBoolean matchNativePixmap; // Match the native pixmap format
+ EGLint maxPBufferWidth; // Maximum width of pbuffer
+ EGLint maxPBufferHeight; // Maximum height of pbuffer
+ EGLint maxPBufferPixels; // Maximum size of pbuffer
+ EGLint maxSwapInterval; // Maximum swap interval
+ EGLint minSwapInterval; // Minimum swap interval
+ EGLBoolean nativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
+ EGLint nativeVisualID; // Handle of corresponding native visual
+ EGLint nativeVisualType; // Native visual type of the associated visual
+ EGLint renderableType; // Which client rendering APIs are supported.
+ EGLint sampleBuffers; // Number of multisample buffers
+ EGLint samples; // Number of samples per pixel
+ EGLint stencilSize; // Bits of Stencil in the stencil buffer
+ EGLint surfaceType; // Which types of EGL surfaces are supported.
+ EGLenum transparentType; // Type of transparency supported
+ EGLint transparentRedValue; // Transparent red value
+ EGLint transparentGreenValue; // Transparent green value
+ EGLint transparentBlueValue; // Transparent blue value
+ EGLint optimalOrientation; // Optimal window surface orientation
+ EGLenum colorComponentType; // Color component type
+ EGLBoolean recordable; // EGL_TRUE if a surface can support recording on Android
+};
+
+class ConfigSet
+{
+ private:
+ typedef std::map<EGLint, Config> ConfigMap;
+
+ public:
+ ConfigSet();
+ ConfigSet(const ConfigSet &other);
+ ~ConfigSet();
+ ConfigSet &operator=(const ConfigSet &other);
+
+ EGLint add(const Config &config);
+ const Config &get(EGLint id) const;
+
+ void clear();
+
+ size_t size() const;
+
+ bool contains(const Config *config) const;
+
+ // Filter configurations based on the table in [EGL 1.5] section 3.4.1.2 page 29
+ std::vector<const Config *> filter(const AttributeMap &attributeMap) const;
+
+ ConfigMap::iterator begin();
+ ConfigMap::iterator end();
+
+ private:
+ ConfigMap mConfigs;
+};
+
+} // namespace egl
+
+#endif // INCLUDE_CONFIG_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Constants.h b/gfx/angle/checkout/src/libANGLE/Constants.h
new file mode 100644
index 0000000000..0fd38748c1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Constants.h
@@ -0,0 +1,87 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Contants.h: Defines some implementation specific and gl constants
+
+#ifndef LIBANGLE_CONSTANTS_H_
+#define LIBANGLE_CONSTANTS_H_
+
+#include "common/platform.h"
+
+#include <stdint.h>
+
+namespace gl
+{
+
+// The binary cache is currently left disable by default, and the application can enable it.
+const size_t kDefaultMaxProgramCacheMemoryBytes = 0;
+
+enum
+{
+ // Implementation upper limits, real maximums depend on the hardware
+ MAX_SAMPLE_MASK_WORDS = 2,
+
+ MAX_VERTEX_ATTRIBS = 16,
+ MAX_VERTEX_ATTRIB_BINDINGS = 16,
+
+ // Implementation upper limits, real maximums depend on the hardware
+ IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
+ IMPLEMENTATION_MAX_DRAW_BUFFERS = 8,
+ IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS =
+ IMPLEMENTATION_MAX_DRAW_BUFFERS + 2, // 2 extra for depth and/or stencil buffers
+
+ IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS = 16,
+ IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
+ IMPLEMENTATION_MAX_COMPUTE_SHADER_UNIFORM_BUFFERS = 16,
+ IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS =
+ IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS +
+ IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS,
+
+ // GL_EXT_geometry_shader increases the minimum value of GL_MAX_UNIFORM_BUFFER_BINDINGS to 48.
+ IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS = 48,
+
+ // Transform feedback limits set to the minimum required by the spec.
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 64,
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 4,
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 4,
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS = 4,
+
+ // Maximum number of views which are supported by the implementation of ANGLE_multiview.
+ IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS = 4,
+
+ // These are the maximums the implementation can support
+ // The actual GL caps are limited by the device caps
+ // and should be queried from the Context
+ IMPLEMENTATION_MAX_2D_TEXTURE_SIZE = 16384,
+ IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
+ IMPLEMENTATION_MAX_3D_TEXTURE_SIZE = 2048,
+ IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
+
+ // 1+log2 of max of MAX_*_TEXTURE_SIZE
+ IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15,
+
+ // Limit active textures so we can use fast bitsets.
+ IMPLEMENTATION_MAX_SHADER_TEXTURES = 32,
+ IMPLEMENTATION_MAX_ACTIVE_TEXTURES = IMPLEMENTATION_MAX_SHADER_TEXTURES * 2,
+ IMPLEMENTATION_MAX_IMAGE_UNITS = IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
+
+ // Maximum number of slots allocated for atomic counter buffers.
+ IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS = 8,
+
+ // Implementation upper limits, real maximums depend on the hardware.
+ IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 64
+};
+
+namespace limits
+{
+// Some of the minimums required by GL, used to detect if the backend meets the minimum requirement.
+// Currently, there's no need to separate these values per spec version.
+constexpr uint32_t kMinimumComputeStorageBuffers = 4;
+} // namespace limits
+
+} // namespace gl
+
+#endif // LIBANGLE_CONSTANTS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context.cpp b/gfx/angle/checkout/src/libANGLE/Context.cpp
new file mode 100644
index 0000000000..e834735074
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context.cpp
@@ -0,0 +1,8927 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Context.cpp: Implements the gl::Context class, managing all GL state and performing
+// rendering operations. It is the GLES2 specific implementation of EGLContext.
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Context.inl.h"
+
+#include <string.h>
+#include <iterator>
+#include <sstream>
+#include <vector>
+
+#include "common/PackedEnums.h"
+#include "common/matrix_utils.h"
+#include "common/platform.h"
+#include "common/utilities.h"
+#include "common/version.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Compiler.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Fence.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/MemoryObject.h"
+#include "libANGLE/Path.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/ProgramPipeline.h"
+#include "libANGLE/Query.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/ResourceManager.h"
+#include "libANGLE/Sampler.h"
+#include "libANGLE/Semaphore.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/TransformFeedback.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/queryconversions.h"
+#include "libANGLE/queryutils.h"
+#include "libANGLE/renderer/DisplayImpl.h"
+#include "libANGLE/renderer/Format.h"
+#include "libANGLE/validationES.h"
+
+namespace gl
+{
+namespace
+{
+template <typename T>
+std::vector<Path *> GatherPaths(PathManager &resourceManager,
+ GLsizei numPaths,
+ const void *paths,
+ GLuint pathBase)
+{
+ std::vector<Path *> ret;
+ ret.reserve(numPaths);
+
+ const auto *nameArray = static_cast<const T *>(paths);
+
+ for (GLsizei i = 0; i < numPaths; ++i)
+ {
+ const GLuint pathName = nameArray[i] + pathBase;
+
+ ret.push_back(resourceManager.getPath(pathName));
+ }
+
+ return ret;
+}
+
+std::vector<Path *> GatherPaths(PathManager &resourceManager,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase)
+{
+ switch (pathNameType)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GatherPaths<GLubyte>(resourceManager, numPaths, paths, pathBase);
+
+ case GL_BYTE:
+ return GatherPaths<GLbyte>(resourceManager, numPaths, paths, pathBase);
+
+ case GL_UNSIGNED_SHORT:
+ return GatherPaths<GLushort>(resourceManager, numPaths, paths, pathBase);
+
+ case GL_SHORT:
+ return GatherPaths<GLshort>(resourceManager, numPaths, paths, pathBase);
+
+ case GL_UNSIGNED_INT:
+ return GatherPaths<GLuint>(resourceManager, numPaths, paths, pathBase);
+
+ case GL_INT:
+ return GatherPaths<GLint>(resourceManager, numPaths, paths, pathBase);
+ }
+
+ UNREACHABLE();
+ return std::vector<Path *>();
+}
+
+template <typename T>
+angle::Result GetQueryObjectParameter(const Context *context, Query *query, GLenum pname, T *params)
+{
+ ASSERT(query != nullptr || pname == GL_QUERY_RESULT_AVAILABLE_EXT);
+
+ switch (pname)
+ {
+ case GL_QUERY_RESULT_EXT:
+ return query->getResult(context, params);
+ case GL_QUERY_RESULT_AVAILABLE_EXT:
+ {
+ bool available = false;
+ if (context->isContextLost())
+ {
+ available = true;
+ }
+ else
+ {
+ ANGLE_TRY(query->isResultAvailable(context, &available));
+ }
+ *params = CastFromStateValue<T>(pname, static_cast<GLuint>(available));
+ return angle::Result::Continue;
+ }
+ default:
+ UNREACHABLE();
+ return angle::Result::Stop;
+ }
+}
+
+// Attribute map queries.
+EGLint GetClientMajorVersion(const egl::AttributeMap &attribs)
+{
+ return static_cast<EGLint>(attribs.get(EGL_CONTEXT_CLIENT_VERSION, 1));
+}
+
+EGLint GetClientMinorVersion(const egl::AttributeMap &attribs)
+{
+ return static_cast<EGLint>(attribs.get(EGL_CONTEXT_MINOR_VERSION, 0));
+}
+
+bool GetBackwardCompatibleContext(const egl::AttributeMap &attribs)
+{
+ return attribs.get(EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE, EGL_TRUE) == EGL_TRUE;
+}
+
+Version GetClientVersion(egl::Display *display, const egl::AttributeMap &attribs)
+{
+ Version requestedVersion =
+ Version(GetClientMajorVersion(attribs), GetClientMinorVersion(attribs));
+ if (GetBackwardCompatibleContext(attribs))
+ {
+ if (requestedVersion.major == 1)
+ {
+ // If the user requests an ES1 context, we cannot return an ES 2+ context.
+ return Version(1, 1);
+ }
+ else
+ {
+ // Always up the version to at least the max conformant version this display supports.
+ // Only return a higher client version if requested.
+ return std::max(display->getImplementation()->getMaxConformantESVersion(),
+ requestedVersion);
+ }
+ }
+ else
+ {
+ return requestedVersion;
+ }
+}
+
+GLenum GetResetStrategy(const egl::AttributeMap &attribs)
+{
+ EGLAttrib attrib =
+ attribs.get(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, EGL_NO_RESET_NOTIFICATION);
+ switch (attrib)
+ {
+ case EGL_NO_RESET_NOTIFICATION:
+ return GL_NO_RESET_NOTIFICATION_EXT;
+ case EGL_LOSE_CONTEXT_ON_RESET:
+ return GL_LOSE_CONTEXT_ON_RESET_EXT;
+ default:
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+bool GetRobustAccess(const egl::AttributeMap &attribs)
+{
+ return (attribs.get(EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_FALSE) == EGL_TRUE) ||
+ ((attribs.get(EGL_CONTEXT_FLAGS_KHR, 0) & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) !=
+ 0);
+}
+
+bool GetDebug(const egl::AttributeMap &attribs)
+{
+ return (attribs.get(EGL_CONTEXT_OPENGL_DEBUG, EGL_FALSE) == EGL_TRUE) ||
+ ((attribs.get(EGL_CONTEXT_FLAGS_KHR, 0) & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR) != 0);
+}
+
+bool GetNoError(const egl::AttributeMap &attribs)
+{
+ return (attribs.get(EGL_CONTEXT_OPENGL_NO_ERROR_KHR, EGL_FALSE) == EGL_TRUE);
+}
+
+bool GetWebGLContext(const egl::AttributeMap &attribs)
+{
+ return (attribs.get(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE, EGL_FALSE) == EGL_TRUE);
+}
+
+bool GetExtensionsEnabled(const egl::AttributeMap &attribs, bool webGLContext)
+{
+ // If the context is WebGL, extensions are disabled by default
+ EGLAttrib defaultValue = webGLContext ? EGL_FALSE : EGL_TRUE;
+ return (attribs.get(EGL_EXTENSIONS_ENABLED_ANGLE, defaultValue) == EGL_TRUE);
+}
+
+bool GetBindGeneratesResource(const egl::AttributeMap &attribs)
+{
+ return (attribs.get(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM, EGL_TRUE) == EGL_TRUE);
+}
+
+bool GetClientArraysEnabled(const egl::AttributeMap &attribs)
+{
+ return (attribs.get(EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE, EGL_TRUE) == EGL_TRUE);
+}
+
+bool GetRobustResourceInit(const egl::AttributeMap &attribs)
+{
+ return (attribs.get(EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE, EGL_FALSE) == EGL_TRUE);
+}
+
+std::string GetObjectLabelFromPointer(GLsizei length, const GLchar *label)
+{
+ std::string labelName;
+ if (label != nullptr)
+ {
+ size_t labelLength = length < 0 ? strlen(label) : length;
+ labelName = std::string(label, labelLength);
+ }
+ return labelName;
+}
+
+void GetObjectLabelBase(const std::string &objectLabel,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ size_t writeLength = objectLabel.length();
+ if (label != nullptr && bufSize > 0)
+ {
+ writeLength = std::min(static_cast<size_t>(bufSize) - 1, objectLabel.length());
+ std::copy(objectLabel.begin(), objectLabel.begin() + writeLength, label);
+ label[writeLength] = '\0';
+ }
+
+ if (length != nullptr)
+ {
+ *length = static_cast<GLsizei>(writeLength);
+ }
+}
+
+template <typename CapT, typename MaxT>
+void LimitCap(CapT *cap, MaxT maximum)
+{
+ *cap = std::min(*cap, static_cast<CapT>(maximum));
+}
+
+// The rest default to false.
+constexpr angle::PackedEnumMap<PrimitiveMode, bool, angle::EnumSize<PrimitiveMode>() + 1>
+ kValidBasicDrawModes = {{
+ {PrimitiveMode::Points, true},
+ {PrimitiveMode::Lines, true},
+ {PrimitiveMode::LineLoop, true},
+ {PrimitiveMode::LineStrip, true},
+ {PrimitiveMode::Triangles, true},
+ {PrimitiveMode::TriangleStrip, true},
+ {PrimitiveMode::TriangleFan, true},
+ }};
+
+enum SubjectIndexes : angle::SubjectIndex
+{
+ kTexture0SubjectIndex = 0,
+ kTextureMaxSubjectIndex = kTexture0SubjectIndex + IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
+ kUniformBuffer0SubjectIndex = kTextureMaxSubjectIndex,
+ kUniformBufferMaxSubjectIndex =
+ kUniformBuffer0SubjectIndex + IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS,
+ kSampler0SubjectIndex = kUniformBufferMaxSubjectIndex,
+ kSamplerMaxSubjectIndex = kSampler0SubjectIndex + IMPLEMENTATION_MAX_ACTIVE_TEXTURES,
+ kVertexArraySubjectIndex = kSamplerMaxSubjectIndex,
+ kReadFramebufferSubjectIndex,
+ kDrawFramebufferSubjectIndex
+};
+} // anonymous namespace
+
+Context::Context(egl::Display *display,
+ const egl::Config *config,
+ const Context *shareContext,
+ TextureManager *shareTextures,
+ MemoryProgramCache *memoryProgramCache,
+ const EGLenum clientType,
+ const egl::AttributeMap &attribs,
+ const egl::DisplayExtensions &displayExtensions,
+ const egl::ClientExtensions &clientExtensions)
+ : mState(reinterpret_cast<ContextID>(this),
+ shareContext ? &shareContext->mState : nullptr,
+ shareTextures,
+ clientType,
+ GetClientVersion(display, attribs),
+ GetDebug(attribs),
+ GetBindGeneratesResource(attribs),
+ GetClientArraysEnabled(attribs),
+ GetRobustResourceInit(attribs),
+ memoryProgramCache != nullptr),
+ mSkipValidation(GetNoError(attribs)),
+ mDisplayTextureShareGroup(shareTextures != nullptr),
+ mErrors(this),
+ mImplementation(display->getImplementation()
+ ->createContext(mState, &mErrors, config, shareContext, attribs)),
+ mLabel(nullptr),
+ mCompiler(),
+ mConfig(config),
+ mHasBeenCurrent(false),
+ mContextLost(false),
+ mResetStatus(GraphicsResetStatus::NoError),
+ mContextLostForced(false),
+ mResetStrategy(GetResetStrategy(attribs)),
+ mRobustAccess(GetRobustAccess(attribs)),
+ mSurfacelessSupported(displayExtensions.surfacelessContext),
+ mExplicitContextAvailable(clientExtensions.explicitContext),
+ mCurrentSurface(static_cast<egl::Surface *>(EGL_NO_SURFACE)),
+ mDisplay(static_cast<egl::Display *>(EGL_NO_DISPLAY)),
+ mWebGLContext(GetWebGLContext(attribs)),
+ mBufferAccessValidationEnabled(false),
+ mExtensionsEnabled(GetExtensionsEnabled(attribs, mWebGLContext)),
+ mMemoryProgramCache(memoryProgramCache),
+ mVertexArrayObserverBinding(this, kVertexArraySubjectIndex),
+ mDrawFramebufferObserverBinding(this, kDrawFramebufferSubjectIndex),
+ mReadFramebufferObserverBinding(this, kReadFramebufferSubjectIndex),
+ mScratchBuffer(1000u),
+ mZeroFilledBuffer(1000u),
+ mThreadPool(nullptr)
+{
+ for (angle::SubjectIndex uboIndex = kUniformBuffer0SubjectIndex;
+ uboIndex < kUniformBufferMaxSubjectIndex; ++uboIndex)
+ {
+ mUniformBufferObserverBindings.emplace_back(this, uboIndex);
+ }
+
+ for (angle::SubjectIndex samplerIndex = kSampler0SubjectIndex;
+ samplerIndex < kSamplerMaxSubjectIndex; ++samplerIndex)
+ {
+ mSamplerObserverBindings.emplace_back(this, samplerIndex);
+ }
+}
+
+void Context::initialize()
+{
+ mImplementation->setMemoryProgramCache(mMemoryProgramCache);
+
+ initCaps();
+
+ if (mDisplay->getFrontendFeatures().syncFramebufferBindingsOnTexImage.enabled)
+ {
+ mTexImageDirtyBits.set(State::DIRTY_BIT_READ_FRAMEBUFFER_BINDING);
+ mTexImageDirtyBits.set(State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING);
+ }
+
+ mState.initialize(this);
+
+ mFenceNVHandleAllocator.setBaseHandle(0);
+
+ // [OpenGL ES 2.0.24] section 3.7 page 83:
+ // In the initial state, TEXTURE_2D and TEXTURE_CUBE_MAP have two-dimensional
+ // and cube map texture state vectors respectively associated with them.
+ // In order that access to these initial textures not be lost, they are treated as texture
+ // objects all of whose names are 0.
+
+ Texture *zeroTexture2D = new Texture(mImplementation.get(), 0, TextureType::_2D);
+ mZeroTextures[TextureType::_2D].set(this, zeroTexture2D);
+
+ Texture *zeroTextureCube = new Texture(mImplementation.get(), 0, TextureType::CubeMap);
+ mZeroTextures[TextureType::CubeMap].set(this, zeroTextureCube);
+
+ if (getClientVersion() >= Version(3, 0) || mSupportedExtensions.texture3DOES)
+ {
+ Texture *zeroTexture3D = new Texture(mImplementation.get(), 0, TextureType::_3D);
+ mZeroTextures[TextureType::_3D].set(this, zeroTexture3D);
+ }
+ if (getClientVersion() >= Version(3, 0))
+ {
+ Texture *zeroTexture2DArray = new Texture(mImplementation.get(), 0, TextureType::_2DArray);
+ mZeroTextures[TextureType::_2DArray].set(this, zeroTexture2DArray);
+ }
+ if (getClientVersion() >= Version(3, 1) || mSupportedExtensions.textureMultisample)
+ {
+ Texture *zeroTexture2DMultisample =
+ new Texture(mImplementation.get(), 0, TextureType::_2DMultisample);
+ mZeroTextures[TextureType::_2DMultisample].set(this, zeroTexture2DMultisample);
+ }
+ if (getClientVersion() >= Version(3, 1))
+ {
+ Texture *zeroTexture2DMultisampleArray =
+ new Texture(mImplementation.get(), 0, TextureType::_2DMultisampleArray);
+ mZeroTextures[TextureType::_2DMultisampleArray].set(this, zeroTexture2DMultisampleArray);
+
+ for (unsigned int i = 0; i < mState.mCaps.maxAtomicCounterBufferBindings; i++)
+ {
+ bindBufferRange(BufferBinding::AtomicCounter, i, 0, 0, 0);
+ }
+
+ for (unsigned int i = 0; i < mState.mCaps.maxShaderStorageBufferBindings; i++)
+ {
+ bindBufferRange(BufferBinding::ShaderStorage, i, 0, 0, 0);
+ }
+ }
+
+ if (mSupportedExtensions.textureRectangle)
+ {
+ Texture *zeroTextureRectangle =
+ new Texture(mImplementation.get(), 0, TextureType::Rectangle);
+ mZeroTextures[TextureType::Rectangle].set(this, zeroTextureRectangle);
+ }
+
+ if (mSupportedExtensions.eglImageExternal || mSupportedExtensions.eglStreamConsumerExternal)
+ {
+ Texture *zeroTextureExternal = new Texture(mImplementation.get(), 0, TextureType::External);
+ mZeroTextures[TextureType::External].set(this, zeroTextureExternal);
+ }
+
+ mState.initializeZeroTextures(this, mZeroTextures);
+
+ bindVertexArray(0);
+
+ if (getClientVersion() >= Version(3, 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
+ bindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
+ }
+
+ for (auto type : angle::AllEnums<BufferBinding>())
+ {
+ bindBuffer(type, 0);
+ }
+
+ bindRenderbuffer(GL_RENDERBUFFER, 0);
+
+ for (unsigned int i = 0; i < mState.mCaps.maxUniformBufferBindings; i++)
+ {
+ bindBufferRange(BufferBinding::Uniform, i, 0, 0, -1);
+ }
+
+ // Initialize GLES1 renderer if appropriate.
+ if (getClientVersion() < Version(2, 0))
+ {
+ mGLES1Renderer.reset(new GLES1Renderer());
+ }
+
+ // Initialize dirty bit masks
+ mAllDirtyBits.set();
+
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_VERTEX_ARRAY);
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_TEXTURES);
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_PROGRAM);
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_SAMPLERS);
+
+ mPathOperationDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
+ mPathOperationDirtyObjects.set(State::DIRTY_OBJECT_VERTEX_ARRAY);
+ mPathOperationDirtyObjects.set(State::DIRTY_OBJECT_TEXTURES);
+ mPathOperationDirtyObjects.set(State::DIRTY_OBJECT_SAMPLERS);
+
+ mTexImageDirtyBits.set(State::DIRTY_BIT_UNPACK_STATE);
+ mTexImageDirtyBits.set(State::DIRTY_BIT_UNPACK_BUFFER_BINDING);
+ // No dirty objects.
+
+ // Readpixels uses the pack state and read FBO
+ mReadPixelsDirtyBits.set(State::DIRTY_BIT_PACK_STATE);
+ mReadPixelsDirtyBits.set(State::DIRTY_BIT_PACK_BUFFER_BINDING);
+ mReadPixelsDirtyBits.set(State::DIRTY_BIT_READ_FRAMEBUFFER_BINDING);
+ mReadPixelsDirtyObjects.set(State::DIRTY_OBJECT_READ_FRAMEBUFFER);
+
+ mClearDirtyBits.set(State::DIRTY_BIT_RASTERIZER_DISCARD_ENABLED);
+ mClearDirtyBits.set(State::DIRTY_BIT_SCISSOR_TEST_ENABLED);
+ mClearDirtyBits.set(State::DIRTY_BIT_SCISSOR);
+ mClearDirtyBits.set(State::DIRTY_BIT_VIEWPORT);
+ mClearDirtyBits.set(State::DIRTY_BIT_CLEAR_COLOR);
+ mClearDirtyBits.set(State::DIRTY_BIT_CLEAR_DEPTH);
+ mClearDirtyBits.set(State::DIRTY_BIT_CLEAR_STENCIL);
+ mClearDirtyBits.set(State::DIRTY_BIT_COLOR_MASK);
+ mClearDirtyBits.set(State::DIRTY_BIT_DEPTH_MASK);
+ mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT);
+ mClearDirtyBits.set(State::DIRTY_BIT_STENCIL_WRITEMASK_BACK);
+ mClearDirtyBits.set(State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING);
+
+ // We sync the draw Framebuffer manually in prepareForClear to allow the clear calls to do
+ // more custom handling for robust resource init.
+
+ mBlitDirtyBits.set(State::DIRTY_BIT_SCISSOR_TEST_ENABLED);
+ mBlitDirtyBits.set(State::DIRTY_BIT_SCISSOR);
+ mBlitDirtyBits.set(State::DIRTY_BIT_FRAMEBUFFER_SRGB);
+ mBlitDirtyBits.set(State::DIRTY_BIT_READ_FRAMEBUFFER_BINDING);
+ mBlitDirtyBits.set(State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING);
+ mBlitDirtyObjects.set(State::DIRTY_OBJECT_READ_FRAMEBUFFER);
+ mBlitDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
+
+ mComputeDirtyBits.set(State::DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING);
+ mComputeDirtyBits.set(State::DIRTY_BIT_UNIFORM_BUFFER_BINDINGS);
+ mComputeDirtyBits.set(State::DIRTY_BIT_ATOMIC_COUNTER_BUFFER_BINDING);
+ mComputeDirtyBits.set(State::DIRTY_BIT_PROGRAM_BINDING);
+ mComputeDirtyBits.set(State::DIRTY_BIT_PROGRAM_EXECUTABLE);
+ mComputeDirtyBits.set(State::DIRTY_BIT_TEXTURE_BINDINGS);
+ mComputeDirtyBits.set(State::DIRTY_BIT_SAMPLER_BINDINGS);
+ mComputeDirtyBits.set(State::DIRTY_BIT_IMAGE_BINDINGS);
+ mComputeDirtyBits.set(State::DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING);
+ mComputeDirtyObjects.set(State::DIRTY_OBJECT_TEXTURES);
+ mComputeDirtyObjects.set(State::DIRTY_OBJECT_PROGRAM);
+ mComputeDirtyObjects.set(State::DIRTY_OBJECT_SAMPLERS);
+
+ mCopyImageDirtyObjects.set(State::DIRTY_OBJECT_READ_FRAMEBUFFER);
+
+ ANGLE_CONTEXT_TRY(mImplementation->initialize());
+}
+
+egl::Error Context::onDestroy(const egl::Display *display)
+{
+ if (mGLES1Renderer)
+ {
+ mGLES1Renderer->onDestroy(this, &mState);
+ }
+
+ ANGLE_TRY(unMakeCurrent(display));
+
+ for (auto fence : mFenceNVMap)
+ {
+ SafeDelete(fence.second);
+ }
+ mFenceNVMap.clear();
+
+ for (auto query : mQueryMap)
+ {
+ if (query.second != nullptr)
+ {
+ query.second->release(this);
+ }
+ }
+ mQueryMap.clear();
+
+ for (auto vertexArray : mVertexArrayMap)
+ {
+ if (vertexArray.second)
+ {
+ vertexArray.second->onDestroy(this);
+ }
+ }
+ mVertexArrayMap.clear();
+
+ for (auto transformFeedback : mTransformFeedbackMap)
+ {
+ if (transformFeedback.second != nullptr)
+ {
+ transformFeedback.second->release(this);
+ }
+ }
+ mTransformFeedbackMap.clear();
+
+ for (BindingPointer<Texture> &zeroTexture : mZeroTextures)
+ {
+ if (zeroTexture.get() != nullptr)
+ {
+ zeroTexture.set(this, nullptr);
+ }
+ }
+
+ releaseShaderCompiler();
+
+ mState.reset(this);
+
+ mState.mBufferManager->release(this);
+ mState.mShaderProgramManager->release(this);
+ mState.mTextureManager->release(this);
+ mState.mRenderbufferManager->release(this);
+ mState.mSamplerManager->release(this);
+ mState.mSyncManager->release(this);
+ mState.mPathManager->release(this);
+ mState.mFramebufferManager->release(this);
+ mState.mProgramPipelineManager->release(this);
+ mState.mMemoryObjectManager->release(this);
+ mState.mSemaphoreManager->release(this);
+
+ mThreadPool.reset();
+
+ mImplementation->onDestroy(this);
+
+ return egl::NoError();
+}
+
+Context::~Context() {}
+
+void Context::setLabel(EGLLabelKHR label)
+{
+ mLabel = label;
+}
+
+EGLLabelKHR Context::getLabel() const
+{
+ return mLabel;
+}
+
+egl::Error Context::makeCurrent(egl::Display *display, egl::Surface *surface)
+{
+ mDisplay = display;
+
+ if (!mHasBeenCurrent)
+ {
+ initialize();
+ initRendererString();
+ initVersionStrings();
+ initExtensionStrings();
+
+ int width = 0;
+ int height = 0;
+ if (surface != nullptr)
+ {
+ width = surface->getWidth();
+ height = surface->getHeight();
+ }
+
+ mState.setViewportParams(0, 0, width, height);
+ mState.setScissorParams(0, 0, width, height);
+
+ mHasBeenCurrent = true;
+ }
+
+ // TODO(jmadill): Rework this when we support ContextImpl
+ mState.setAllDirtyBits();
+ mState.setAllDirtyObjects();
+
+ ANGLE_TRY(setDefaultFramebuffer(surface));
+
+ // Notify the renderer of a context switch.
+ angle::Result implResult = mImplementation->onMakeCurrent(this);
+
+ // If the implementation fails onMakeCurrent, unset the default framebuffer.
+ if (implResult != angle::Result::Continue)
+ {
+ ANGLE_TRY(unsetDefaultFramebuffer());
+ return angle::ResultToEGL(implResult);
+ }
+
+ return egl::NoError();
+}
+
+egl::Error Context::unMakeCurrent(const egl::Display *display)
+{
+ ANGLE_TRY(unsetDefaultFramebuffer());
+
+ return angle::ResultToEGL(mImplementation->onUnMakeCurrent(this));
+}
+
+GLuint Context::createBuffer()
+{
+ return mState.mBufferManager->createBuffer();
+}
+
+GLuint Context::createProgram()
+{
+ return mState.mShaderProgramManager->createProgram(mImplementation.get());
+}
+
+GLuint Context::createShader(ShaderType type)
+{
+ return mState.mShaderProgramManager->createShader(mImplementation.get(), mState.mLimitations,
+ type);
+}
+
+GLuint Context::createTexture()
+{
+ return mState.mTextureManager->createTexture();
+}
+
+GLuint Context::createRenderbuffer()
+{
+ return mState.mRenderbufferManager->createRenderbuffer();
+}
+
+void Context::tryGenPaths(GLsizei range, GLuint *createdOut)
+{
+ ANGLE_CONTEXT_TRY(mState.mPathManager->createPaths(this, range, createdOut));
+}
+
+GLuint Context::genPaths(GLsizei range)
+{
+ GLuint created = 0;
+ tryGenPaths(range, &created);
+ return created;
+}
+
+// Returns an unused framebuffer name
+GLuint Context::createFramebuffer()
+{
+ return mState.mFramebufferManager->createFramebuffer();
+}
+
+void Context::genFencesNV(GLsizei n, GLuint *fences)
+{
+ for (int i = 0; i < n; i++)
+ {
+ GLuint handle = mFenceNVHandleAllocator.allocate();
+ mFenceNVMap.assign(handle, new FenceNV(mImplementation->createFenceNV()));
+ fences[i] = handle;
+ }
+}
+
+GLuint Context::createProgramPipeline()
+{
+ return mState.mProgramPipelineManager->createProgramPipeline();
+}
+
+GLuint Context::createShaderProgramv(ShaderType type, GLsizei count, const GLchar *const *strings)
+{
+ UNIMPLEMENTED();
+ return 0u;
+}
+
+GLuint Context::createMemoryObject()
+{
+ return mState.mMemoryObjectManager->createMemoryObject(mImplementation.get());
+}
+
+GLuint Context::createSemaphore()
+{
+ return mState.mSemaphoreManager->createSemaphore(mImplementation.get());
+}
+
+void Context::deleteBuffer(GLuint bufferName)
+{
+ Buffer *buffer = mState.mBufferManager->getBuffer(bufferName);
+ if (buffer)
+ {
+ detachBuffer(buffer);
+ }
+
+ mState.mBufferManager->deleteObject(this, bufferName);
+}
+
+void Context::deleteShader(GLuint shader)
+{
+ mState.mShaderProgramManager->deleteShader(this, shader);
+}
+
+void Context::deleteProgram(GLuint program)
+{
+ mState.mShaderProgramManager->deleteProgram(this, program);
+}
+
+void Context::deleteTexture(GLuint texture)
+{
+ if (mState.mTextureManager->getTexture(texture))
+ {
+ detachTexture(texture);
+ }
+
+ mState.mTextureManager->deleteObject(this, texture);
+}
+
+void Context::deleteRenderbuffer(GLuint renderbuffer)
+{
+ if (mState.mRenderbufferManager->getRenderbuffer(renderbuffer))
+ {
+ detachRenderbuffer(renderbuffer);
+ }
+
+ mState.mRenderbufferManager->deleteObject(this, renderbuffer);
+}
+
+void Context::deleteSync(GLsync sync)
+{
+ // 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.
+ mState.mSyncManager->deleteObject(this, static_cast<GLuint>(reinterpret_cast<uintptr_t>(sync)));
+}
+
+void Context::deleteProgramPipeline(GLuint pipeline)
+{
+ if (mState.mProgramPipelineManager->getProgramPipeline(pipeline))
+ {
+ detachProgramPipeline(pipeline);
+ }
+
+ mState.mProgramPipelineManager->deleteObject(this, pipeline);
+}
+
+void Context::deleteMemoryObject(GLuint memoryObject)
+{
+ mState.mMemoryObjectManager->deleteMemoryObject(this, memoryObject);
+}
+
+void Context::deleteSemaphore(GLuint semaphore)
+{
+ mState.mSemaphoreManager->deleteSemaphore(this, semaphore);
+}
+
+void Context::deletePaths(GLuint first, GLsizei range)
+{
+ mState.mPathManager->deletePaths(first, range);
+}
+
+GLboolean Context::isPath(GLuint path)
+{
+ const auto *pathObj = mState.mPathManager->getPath(path);
+ if (pathObj == nullptr)
+ return false;
+
+ return pathObj->hasPathData();
+}
+
+bool Context::isPathGenerated(GLuint path) const
+{
+ return mState.mPathManager->hasPath(path);
+}
+
+void Context::pathCommands(GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords)
+{
+ auto *pathObject = mState.mPathManager->getPath(path);
+
+ ANGLE_CONTEXT_TRY(pathObject->setCommands(numCommands, commands, numCoords, coordType, coords));
+}
+
+void Context::pathParameterf(GLuint path, GLenum pname, GLfloat value)
+{
+ Path *pathObj = mState.mPathManager->getPath(path);
+
+ switch (pname)
+ {
+ case GL_PATH_STROKE_WIDTH_CHROMIUM:
+ pathObj->setStrokeWidth(value);
+ break;
+ case GL_PATH_END_CAPS_CHROMIUM:
+ pathObj->setEndCaps(static_cast<GLenum>(value));
+ break;
+ case GL_PATH_JOIN_STYLE_CHROMIUM:
+ pathObj->setJoinStyle(static_cast<GLenum>(value));
+ break;
+ case GL_PATH_MITER_LIMIT_CHROMIUM:
+ pathObj->setMiterLimit(value);
+ break;
+ case GL_PATH_STROKE_BOUND_CHROMIUM:
+ pathObj->setStrokeBound(value);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void Context::pathParameteri(GLuint path, GLenum pname, GLint value)
+{
+ // TODO(jmadill): Should use proper clamping/casting.
+ pathParameterf(path, pname, static_cast<GLfloat>(value));
+}
+
+void Context::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value)
+{
+ const Path *pathObj = mState.mPathManager->getPath(path);
+
+ switch (pname)
+ {
+ case GL_PATH_STROKE_WIDTH_CHROMIUM:
+ *value = pathObj->getStrokeWidth();
+ break;
+ case GL_PATH_END_CAPS_CHROMIUM:
+ *value = static_cast<GLfloat>(pathObj->getEndCaps());
+ break;
+ case GL_PATH_JOIN_STYLE_CHROMIUM:
+ *value = static_cast<GLfloat>(pathObj->getJoinStyle());
+ break;
+ case GL_PATH_MITER_LIMIT_CHROMIUM:
+ *value = pathObj->getMiterLimit();
+ break;
+ case GL_PATH_STROKE_BOUND_CHROMIUM:
+ *value = pathObj->getStrokeBound();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void Context::getPathParameteriv(GLuint path, GLenum pname, GLint *value)
+{
+ GLfloat val = 0.0f;
+ getPathParameterfv(path, pname, value != nullptr ? &val : nullptr);
+ if (value)
+ *value = static_cast<GLint>(val);
+}
+
+void Context::pathStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ mState.setPathStencilFunc(func, ref, mask);
+}
+
+// GL_CHROMIUM_lose_context
+void Context::loseContext(GraphicsResetStatus current, GraphicsResetStatus other)
+{
+ // TODO(geofflang): mark the rest of the share group lost. Requires access to the entire share
+ // group from a context. http://anglebug.com/3379
+ markContextLost(current);
+}
+
+void Context::deleteFramebuffer(GLuint framebuffer)
+{
+ if (mState.mFramebufferManager->getFramebuffer(framebuffer))
+ {
+ detachFramebuffer(framebuffer);
+ }
+
+ mState.mFramebufferManager->deleteObject(this, framebuffer);
+}
+
+void Context::deleteFencesNV(GLsizei n, const GLuint *fences)
+{
+ for (int i = 0; i < n; i++)
+ {
+ GLuint fence = fences[i];
+
+ FenceNV *fenceObject = nullptr;
+ if (mFenceNVMap.erase(fence, &fenceObject))
+ {
+ mFenceNVHandleAllocator.release(fence);
+ delete fenceObject;
+ }
+ }
+}
+
+Buffer *Context::getBuffer(GLuint handle) const
+{
+ return mState.mBufferManager->getBuffer(handle);
+}
+
+Renderbuffer *Context::getRenderbuffer(GLuint handle) const
+{
+ return mState.mRenderbufferManager->getRenderbuffer(handle);
+}
+
+Sync *Context::getSync(GLsync handle) const
+{
+ return mState.mSyncManager->getSync(static_cast<GLuint>(reinterpret_cast<uintptr_t>(handle)));
+}
+
+VertexArray *Context::getVertexArray(GLuint handle) const
+{
+ return mVertexArrayMap.query(handle);
+}
+
+Sampler *Context::getSampler(GLuint handle) const
+{
+ return mState.mSamplerManager->getSampler(handle);
+}
+
+TransformFeedback *Context::getTransformFeedback(GLuint handle) const
+{
+ return mTransformFeedbackMap.query(handle);
+}
+
+ProgramPipeline *Context::getProgramPipeline(GLuint handle) const
+{
+ return mState.mProgramPipelineManager->getProgramPipeline(handle);
+}
+
+gl::LabeledObject *Context::getLabeledObject(GLenum identifier, GLuint name) const
+{
+ switch (identifier)
+ {
+ case GL_BUFFER:
+ return getBuffer(name);
+ case GL_SHADER:
+ return getShader(name);
+ case GL_PROGRAM:
+ return getProgramNoResolveLink(name);
+ case GL_VERTEX_ARRAY:
+ return getVertexArray(name);
+ case GL_QUERY:
+ return getQuery(name);
+ case GL_TRANSFORM_FEEDBACK:
+ return getTransformFeedback(name);
+ case GL_SAMPLER:
+ return getSampler(name);
+ case GL_TEXTURE:
+ return getTexture(name);
+ case GL_RENDERBUFFER:
+ return getRenderbuffer(name);
+ case GL_FRAMEBUFFER:
+ return getFramebuffer(name);
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+gl::LabeledObject *Context::getLabeledObjectFromPtr(const void *ptr) const
+{
+ return getSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr)));
+}
+
+void Context::objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
+{
+ gl::LabeledObject *object = getLabeledObject(identifier, name);
+ ASSERT(object != nullptr);
+
+ std::string labelName = GetObjectLabelFromPointer(length, label);
+ object->setLabel(this, labelName);
+
+ // TODO(jmadill): Determine if the object is dirty based on 'name'. Conservatively assume the
+ // specified object is active until we do this.
+ mState.setObjectDirty(identifier);
+}
+
+void Context::objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
+{
+ gl::LabeledObject *object = getLabeledObjectFromPtr(ptr);
+ ASSERT(object != nullptr);
+
+ std::string labelName = GetObjectLabelFromPointer(length, label);
+ object->setLabel(this, labelName);
+}
+
+void Context::getObjectLabel(GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ gl::LabeledObject *object = getLabeledObject(identifier, name);
+ ASSERT(object != nullptr);
+
+ const std::string &objectLabel = object->getLabel();
+ GetObjectLabelBase(objectLabel, bufSize, length, label);
+}
+
+void Context::getObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label)
+{
+ gl::LabeledObject *object = getLabeledObjectFromPtr(ptr);
+ ASSERT(object != nullptr);
+
+ const std::string &objectLabel = object->getLabel();
+ GetObjectLabelBase(objectLabel, bufSize, length, label);
+}
+
+GLboolean Context::isSampler(GLuint samplerName)
+{
+ return mState.mSamplerManager->isSampler(samplerName);
+}
+
+void Context::bindTexture(TextureType target, GLuint handle)
+{
+ Texture *texture = nullptr;
+
+ if (handle == 0)
+ {
+ texture = mZeroTextures[target].get();
+ }
+ else
+ {
+ texture =
+ mState.mTextureManager->checkTextureAllocation(mImplementation.get(), handle, target);
+ }
+
+ ASSERT(texture);
+ mState.setSamplerTexture(this, target, texture);
+ mStateCache.onActiveTextureChange(this);
+}
+
+void Context::bindReadFramebuffer(GLuint framebufferHandle)
+{
+ Framebuffer *framebuffer = mState.mFramebufferManager->checkFramebufferAllocation(
+ mImplementation.get(), mState.mCaps, framebufferHandle);
+ mState.setReadFramebufferBinding(framebuffer);
+ mReadFramebufferObserverBinding.bind(framebuffer);
+}
+
+void Context::bindDrawFramebuffer(GLuint framebufferHandle)
+{
+ Framebuffer *framebuffer = mState.mFramebufferManager->checkFramebufferAllocation(
+ mImplementation.get(), mState.mCaps, framebufferHandle);
+ mState.setDrawFramebufferBinding(framebuffer);
+ mDrawFramebufferObserverBinding.bind(framebuffer);
+ mStateCache.onDrawFramebufferChange(this);
+}
+
+void Context::bindVertexArray(GLuint vertexArrayHandle)
+{
+ VertexArray *vertexArray = checkVertexArrayAllocation(vertexArrayHandle);
+ mState.setVertexArrayBinding(this, vertexArray);
+ mVertexArrayObserverBinding.bind(vertexArray);
+ mStateCache.onVertexArrayBindingChange(this);
+}
+
+void Context::bindVertexBuffer(GLuint bindingIndex,
+ GLuint bufferHandle,
+ GLintptr offset,
+ GLsizei stride)
+{
+ Buffer *buffer =
+ mState.mBufferManager->checkBufferAllocation(mImplementation.get(), bufferHandle);
+ mState.bindVertexBuffer(this, bindingIndex, buffer, offset, stride);
+ mStateCache.onVertexArrayStateChange(this);
+}
+
+void Context::bindSampler(GLuint textureUnit, GLuint samplerHandle)
+{
+ ASSERT(textureUnit < mState.mCaps.maxCombinedTextureImageUnits);
+ Sampler *sampler =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), samplerHandle);
+ mState.setSamplerBinding(this, textureUnit, sampler);
+ mSamplerObserverBindings[textureUnit].bind(sampler);
+ mStateCache.onActiveTextureChange(this);
+}
+
+void Context::bindImageTexture(GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format)
+{
+ Texture *tex = mState.mTextureManager->getTexture(texture);
+ mState.setImageUnit(this, unit, tex, level, layered, layer, access, format);
+}
+
+void Context::useProgram(GLuint program)
+{
+ ANGLE_CONTEXT_TRY(mState.setProgram(this, getProgramResolveLink(program)));
+ mStateCache.onProgramExecutableChange(this);
+}
+
+void Context::useProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle)
+{
+ ASSERT(target == GL_TRANSFORM_FEEDBACK);
+ TransformFeedback *transformFeedback =
+ checkTransformFeedbackAllocation(transformFeedbackHandle);
+ mState.setTransformFeedbackBinding(this, transformFeedback);
+}
+
+void Context::bindProgramPipeline(GLuint pipelineHandle)
+{
+ ProgramPipeline *pipeline = mState.mProgramPipelineManager->checkProgramPipelineAllocation(
+ mImplementation.get(), pipelineHandle);
+ mState.setProgramPipelineBinding(this, pipeline);
+}
+
+void Context::beginQuery(QueryType target, GLuint query)
+{
+ Query *queryObject = getQuery(query, true, target);
+ ASSERT(queryObject);
+
+ // begin query
+ ANGLE_CONTEXT_TRY(queryObject->begin(this));
+
+ // set query as active for specified target only if begin succeeded
+ mState.setActiveQuery(this, target, queryObject);
+ mStateCache.onQueryChange(this);
+}
+
+void Context::endQuery(QueryType target)
+{
+ Query *queryObject = mState.getActiveQuery(target);
+ ASSERT(queryObject);
+
+ // Intentionally don't call try here. We don't want an early return.
+ (void)(queryObject->end(this));
+
+ // Always unbind the query, even if there was an error. This may delete the query object.
+ mState.setActiveQuery(this, target, nullptr);
+ mStateCache.onQueryChange(this);
+}
+
+void Context::queryCounter(GLuint id, QueryType target)
+{
+ ASSERT(target == QueryType::Timestamp);
+
+ Query *queryObject = getQuery(id, true, target);
+ ASSERT(queryObject);
+
+ ANGLE_CONTEXT_TRY(queryObject->queryCounter(this));
+}
+
+void Context::getQueryiv(QueryType target, GLenum pname, GLint *params)
+{
+ switch (pname)
+ {
+ case GL_CURRENT_QUERY_EXT:
+ params[0] = mState.getActiveQueryId(target);
+ break;
+ case GL_QUERY_COUNTER_BITS_EXT:
+ switch (target)
+ {
+ case QueryType::TimeElapsed:
+ params[0] = getExtensions().queryCounterBitsTimeElapsed;
+ break;
+ case QueryType::Timestamp:
+ params[0] = getExtensions().queryCounterBitsTimestamp;
+ break;
+ default:
+ UNREACHABLE();
+ params[0] = 0;
+ break;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ return;
+ }
+}
+
+void Context::getQueryivRobust(QueryType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getQueryiv(target, pname, params);
+}
+
+void Context::getUnsignedBytev(GLenum pname, GLubyte *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getUnsignedBytei_v(GLenum target, GLuint index, GLubyte *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getQueryObjectiv(GLuint id, GLenum pname, GLint *params)
+{
+ ANGLE_CONTEXT_TRY(GetQueryObjectParameter(this, getQuery(id), pname, params));
+}
+
+void Context::getQueryObjectivRobust(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getQueryObjectiv(id, pname, params);
+}
+
+void Context::getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
+{
+ ANGLE_CONTEXT_TRY(GetQueryObjectParameter(this, getQuery(id), pname, params));
+}
+
+void Context::getQueryObjectuivRobust(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ getQueryObjectuiv(id, pname, params);
+}
+
+void Context::getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params)
+{
+ ANGLE_CONTEXT_TRY(GetQueryObjectParameter(this, getQuery(id), pname, params));
+}
+
+void Context::getQueryObjecti64vRobust(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ getQueryObjecti64v(id, pname, params);
+}
+
+void Context::getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params)
+{
+ ANGLE_CONTEXT_TRY(GetQueryObjectParameter(this, getQuery(id), pname, params));
+}
+
+void Context::getQueryObjectui64vRobust(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params)
+{
+ getQueryObjectui64v(id, pname, params);
+}
+
+Framebuffer *Context::getFramebuffer(GLuint handle) const
+{
+ return mState.mFramebufferManager->getFramebuffer(handle);
+}
+
+FenceNV *Context::getFenceNV(GLuint handle)
+{
+ return mFenceNVMap.query(handle);
+}
+
+Query *Context::getQuery(GLuint handle, bool create, QueryType type)
+{
+ if (!mQueryMap.contains(handle))
+ {
+ return nullptr;
+ }
+
+ Query *query = mQueryMap.query(handle);
+ if (!query && create)
+ {
+ ASSERT(type != QueryType::InvalidEnum);
+ query = new Query(mImplementation->createQuery(type), handle);
+ query->addRef();
+ mQueryMap.assign(handle, query);
+ }
+ return query;
+}
+
+Query *Context::getQuery(GLuint handle) const
+{
+ return mQueryMap.query(handle);
+}
+
+Texture *Context::getTextureByType(TextureType type) const
+{
+ ASSERT(ValidTextureTarget(this, type) || ValidTextureExternalTarget(this, type));
+ return mState.getTargetTexture(type);
+}
+
+Texture *Context::getTextureByTarget(TextureTarget target) const
+{
+ return getTextureByType(TextureTargetToType(target));
+}
+
+Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type) const
+{
+ return mState.getSamplerTexture(sampler, type);
+}
+
+Compiler *Context::getCompiler() const
+{
+ if (mCompiler.get() == nullptr)
+ {
+ mCompiler.set(this, new Compiler(mImplementation.get(), mState));
+ }
+ return mCompiler.get();
+}
+
+void Context::getBooleanvImpl(GLenum pname, GLboolean *params)
+{
+ switch (pname)
+ {
+ case GL_SHADER_COMPILER:
+ *params = GL_TRUE;
+ break;
+ case GL_CONTEXT_ROBUST_ACCESS_EXT:
+ *params = ConvertToGLBoolean(mRobustAccess);
+ break;
+
+ default:
+ mState.getBooleanv(pname, params);
+ break;
+ }
+}
+
+void Context::getFloatvImpl(GLenum pname, GLfloat *params)
+{
+ // Queries about context capabilities and maximums are answered by Context.
+ // Queries about current GL state values are answered by State.
+ switch (pname)
+ {
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ params[0] = mState.mCaps.minAliasedLineWidth;
+ params[1] = mState.mCaps.maxAliasedLineWidth;
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ params[0] = mState.mCaps.minAliasedPointSize;
+ params[1] = mState.mCaps.maxAliasedPointSize;
+ break;
+ case GL_SMOOTH_POINT_SIZE_RANGE:
+ params[0] = mState.mCaps.minSmoothPointSize;
+ params[1] = mState.mCaps.maxSmoothPointSize;
+ break;
+ case GL_SMOOTH_LINE_WIDTH_RANGE:
+ params[0] = mState.mCaps.minSmoothLineWidth;
+ params[1] = mState.mCaps.maxSmoothLineWidth;
+ break;
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ ASSERT(mState.mExtensions.textureFilterAnisotropic);
+ *params = mState.mExtensions.maxTextureAnisotropy;
+ break;
+ case GL_MAX_TEXTURE_LOD_BIAS:
+ *params = mState.mCaps.maxLODBias;
+ break;
+
+ case GL_PATH_MODELVIEW_MATRIX_CHROMIUM:
+ case GL_PATH_PROJECTION_MATRIX_CHROMIUM:
+ {
+ // GLES1 emulation: // GL_PATH_(MODELVIEW|PROJECTION)_MATRIX_CHROMIUM collides with the
+ // GLES1 constants for modelview/projection matrix.
+ if (getClientVersion() < Version(2, 0))
+ {
+ mState.getFloatv(pname, params);
+ }
+ else
+ {
+ ASSERT(mState.mExtensions.pathRendering);
+ const GLfloat *m = mState.getPathRenderingMatrix(pname);
+ memcpy(params, m, 16 * sizeof(GLfloat));
+ }
+ }
+ break;
+
+ default:
+ mState.getFloatv(pname, params);
+ break;
+ }
+}
+
+void Context::getIntegervImpl(GLenum pname, GLint *params)
+{
+ // Queries about context capabilities and maximums are answered by Context.
+ // Queries about current GL state values are answered by State.
+
+ switch (pname)
+ {
+ case GL_MAX_VERTEX_ATTRIBS:
+ *params = mState.mCaps.maxVertexAttributes;
+ break;
+ case GL_MAX_VERTEX_UNIFORM_VECTORS:
+ *params = mState.mCaps.maxVertexUniformVectors;
+ break;
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
+ *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Vertex];
+ break;
+ case GL_MAX_VARYING_VECTORS:
+ *params = mState.mCaps.maxVaryingVectors;
+ break;
+ case GL_MAX_VARYING_COMPONENTS:
+ *params = mState.mCaps.maxVertexOutputComponents;
+ break;
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+ *params = mState.mCaps.maxCombinedTextureImageUnits;
+ break;
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+ *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Vertex];
+ break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS:
+ *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Fragment];
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+ *params = mState.mCaps.maxFragmentUniformVectors;
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+ *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Fragment];
+ break;
+ case GL_MAX_RENDERBUFFER_SIZE:
+ *params = mState.mCaps.maxRenderbufferSize;
+ break;
+ case GL_MAX_COLOR_ATTACHMENTS_EXT:
+ *params = mState.mCaps.maxColorAttachments;
+ break;
+ case GL_MAX_DRAW_BUFFERS_EXT:
+ *params = mState.mCaps.maxDrawBuffers;
+ break;
+ case GL_SUBPIXEL_BITS:
+ *params = mState.mCaps.subPixelBits;
+ break;
+ case GL_MAX_TEXTURE_SIZE:
+ *params = mState.mCaps.max2DTextureSize;
+ break;
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE:
+ *params = mState.mCaps.maxRectangleTextureSize;
+ break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
+ *params = mState.mCaps.maxCubeMapTextureSize;
+ break;
+ case GL_MAX_3D_TEXTURE_SIZE:
+ *params = mState.mCaps.max3DTextureSize;
+ break;
+ case GL_MAX_ARRAY_TEXTURE_LAYERS:
+ *params = mState.mCaps.maxArrayTextureLayers;
+ break;
+ case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
+ *params = mState.mCaps.uniformBufferOffsetAlignment;
+ break;
+ case GL_MAX_UNIFORM_BUFFER_BINDINGS:
+ *params = mState.mCaps.maxUniformBufferBindings;
+ break;
+ case GL_MAX_VERTEX_UNIFORM_BLOCKS:
+ *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Vertex];
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
+ *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Fragment];
+ break;
+ case GL_MAX_COMBINED_UNIFORM_BLOCKS:
+ *params = mState.mCaps.maxCombinedUniformBlocks;
+ break;
+ case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
+ *params = mState.mCaps.maxVertexOutputComponents;
+ break;
+ case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
+ *params = mState.mCaps.maxFragmentInputComponents;
+ break;
+ case GL_MIN_PROGRAM_TEXEL_OFFSET:
+ *params = mState.mCaps.minProgramTexelOffset;
+ break;
+ case GL_MAX_PROGRAM_TEXEL_OFFSET:
+ *params = mState.mCaps.maxProgramTexelOffset;
+ break;
+ case GL_MAJOR_VERSION:
+ *params = getClientVersion().major;
+ break;
+ case GL_MINOR_VERSION:
+ *params = getClientVersion().minor;
+ break;
+ case GL_MAX_ELEMENTS_INDICES:
+ *params = mState.mCaps.maxElementsIndices;
+ break;
+ case GL_MAX_ELEMENTS_VERTICES:
+ *params = mState.mCaps.maxElementsVertices;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ *params = mState.mCaps.maxTransformFeedbackInterleavedComponents;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+ *params = mState.mCaps.maxTransformFeedbackSeparateAttributes;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ *params = mState.mCaps.maxTransformFeedbackSeparateComponents;
+ break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+ *params = static_cast<GLint>(mState.mCaps.compressedTextureFormats.size());
+ break;
+ case GL_MAX_SAMPLES_ANGLE:
+ *params = mState.mCaps.maxSamples;
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ {
+ params[0] = mState.mCaps.maxViewportWidth;
+ params[1] = mState.mCaps.maxViewportHeight;
+ }
+ break;
+ case GL_COMPRESSED_TEXTURE_FORMATS:
+ std::copy(mState.mCaps.compressedTextureFormats.begin(),
+ mState.mCaps.compressedTextureFormats.end(), params);
+ break;
+ case GL_RESET_NOTIFICATION_STRATEGY_EXT:
+ *params = mResetStrategy;
+ break;
+ case GL_NUM_SHADER_BINARY_FORMATS:
+ *params = static_cast<GLint>(mState.mCaps.shaderBinaryFormats.size());
+ break;
+ case GL_SHADER_BINARY_FORMATS:
+ std::copy(mState.mCaps.shaderBinaryFormats.begin(),
+ mState.mCaps.shaderBinaryFormats.end(), params);
+ break;
+ case GL_NUM_PROGRAM_BINARY_FORMATS:
+ *params = static_cast<GLint>(mState.mCaps.programBinaryFormats.size());
+ break;
+ case GL_PROGRAM_BINARY_FORMATS:
+ std::copy(mState.mCaps.programBinaryFormats.begin(),
+ mState.mCaps.programBinaryFormats.end(), params);
+ break;
+ case GL_NUM_EXTENSIONS:
+ *params = static_cast<GLint>(mExtensionStrings.size());
+ break;
+
+ // GL_ANGLE_request_extension
+ case GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE:
+ *params = static_cast<GLint>(mRequestableExtensionStrings.size());
+ break;
+
+ // GL_KHR_debug
+ case GL_MAX_DEBUG_MESSAGE_LENGTH:
+ *params = mState.mExtensions.maxDebugMessageLength;
+ break;
+ case GL_MAX_DEBUG_LOGGED_MESSAGES:
+ *params = mState.mExtensions.maxDebugLoggedMessages;
+ break;
+ case GL_MAX_DEBUG_GROUP_STACK_DEPTH:
+ *params = mState.mExtensions.maxDebugGroupStackDepth;
+ break;
+ case GL_MAX_LABEL_LENGTH:
+ *params = mState.mExtensions.maxLabelLength;
+ break;
+
+ // GL_OVR_multiview2
+ case GL_MAX_VIEWS_OVR:
+ *params = mState.mExtensions.maxViews;
+ break;
+
+ // GL_EXT_disjoint_timer_query
+ case GL_GPU_DISJOINT_EXT:
+ *params = mImplementation->getGPUDisjoint();
+ break;
+ case GL_MAX_FRAMEBUFFER_WIDTH:
+ *params = mState.mCaps.maxFramebufferWidth;
+ break;
+ case GL_MAX_FRAMEBUFFER_HEIGHT:
+ *params = mState.mCaps.maxFramebufferHeight;
+ break;
+ case GL_MAX_FRAMEBUFFER_SAMPLES:
+ *params = mState.mCaps.maxFramebufferSamples;
+ break;
+ case GL_MAX_SAMPLE_MASK_WORDS:
+ *params = mState.mCaps.maxSampleMaskWords;
+ break;
+ case GL_MAX_COLOR_TEXTURE_SAMPLES:
+ *params = mState.mCaps.maxColorTextureSamples;
+ break;
+ case GL_MAX_DEPTH_TEXTURE_SAMPLES:
+ *params = mState.mCaps.maxDepthTextureSamples;
+ break;
+ case GL_MAX_INTEGER_SAMPLES:
+ *params = mState.mCaps.maxIntegerSamples;
+ break;
+ case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET:
+ *params = mState.mCaps.maxVertexAttribRelativeOffset;
+ break;
+ case GL_MAX_VERTEX_ATTRIB_BINDINGS:
+ *params = mState.mCaps.maxVertexAttribBindings;
+ break;
+ case GL_MAX_VERTEX_ATTRIB_STRIDE:
+ *params = mState.mCaps.maxVertexAttribStride;
+ break;
+ case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
+ *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Vertex];
+ break;
+ case GL_MAX_VERTEX_ATOMIC_COUNTERS:
+ *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Vertex];
+ break;
+ case GL_MAX_VERTEX_IMAGE_UNIFORMS:
+ *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Vertex];
+ break;
+ case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
+ *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Vertex];
+ break;
+ case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
+ *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Fragment];
+ break;
+ case GL_MAX_FRAGMENT_ATOMIC_COUNTERS:
+ *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Fragment];
+ break;
+ case GL_MAX_FRAGMENT_IMAGE_UNIFORMS:
+ *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Fragment];
+ break;
+ case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
+ *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Fragment];
+ break;
+ case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET:
+ *params = mState.mCaps.minProgramTextureGatherOffset;
+ break;
+ case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET:
+ *params = mState.mCaps.maxProgramTextureGatherOffset;
+ break;
+ case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS:
+ *params = mState.mCaps.maxComputeWorkGroupInvocations;
+ break;
+ case GL_MAX_COMPUTE_UNIFORM_BLOCKS:
+ *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Compute];
+ break;
+ case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS:
+ *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Compute];
+ break;
+ case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE:
+ *params = mState.mCaps.maxComputeSharedMemorySize;
+ break;
+ case GL_MAX_COMPUTE_UNIFORM_COMPONENTS:
+ *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Compute];
+ break;
+ case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
+ *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Compute];
+ break;
+ case GL_MAX_COMPUTE_ATOMIC_COUNTERS:
+ *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Compute];
+ break;
+ case GL_MAX_COMPUTE_IMAGE_UNIFORMS:
+ *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Compute];
+ break;
+ case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS:
+ *params = static_cast<GLint>(
+ mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Compute]);
+ break;
+ case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
+ *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Compute];
+ break;
+ case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
+ *params = mState.mCaps.maxCombinedShaderOutputResources;
+ break;
+ case GL_MAX_UNIFORM_LOCATIONS:
+ *params = mState.mCaps.maxUniformLocations;
+ break;
+ case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS:
+ *params = mState.mCaps.maxAtomicCounterBufferBindings;
+ break;
+ case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE:
+ *params = mState.mCaps.maxAtomicCounterBufferSize;
+ break;
+ case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS:
+ *params = mState.mCaps.maxCombinedAtomicCounterBuffers;
+ break;
+ case GL_MAX_COMBINED_ATOMIC_COUNTERS:
+ *params = mState.mCaps.maxCombinedAtomicCounters;
+ break;
+ case GL_MAX_IMAGE_UNITS:
+ *params = mState.mCaps.maxImageUnits;
+ break;
+ case GL_MAX_COMBINED_IMAGE_UNIFORMS:
+ *params = mState.mCaps.maxCombinedImageUniforms;
+ break;
+ case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS:
+ *params = mState.mCaps.maxShaderStorageBufferBindings;
+ break;
+ case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS:
+ *params = mState.mCaps.maxCombinedShaderStorageBlocks;
+ break;
+ case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT:
+ *params = mState.mCaps.shaderStorageBufferOffsetAlignment;
+ break;
+
+ // GL_EXT_geometry_shader
+ case GL_MAX_FRAMEBUFFER_LAYERS_EXT:
+ *params = mState.mCaps.maxFramebufferLayers;
+ break;
+ case GL_LAYER_PROVOKING_VERTEX_EXT:
+ *params = mState.mCaps.layerProvokingVertex;
+ break;
+ case GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT:
+ *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Geometry];
+ break;
+ case GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT:
+ *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Geometry];
+ break;
+ case GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT:
+ *params = static_cast<GLint>(
+ mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Geometry]);
+ break;
+ case GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT:
+ *params = mState.mCaps.maxGeometryInputComponents;
+ break;
+ case GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT:
+ *params = mState.mCaps.maxGeometryOutputComponents;
+ break;
+ case GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT:
+ *params = mState.mCaps.maxGeometryOutputVertices;
+ break;
+ case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT:
+ *params = mState.mCaps.maxGeometryTotalOutputComponents;
+ break;
+ case GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT:
+ *params = mState.mCaps.maxGeometryShaderInvocations;
+ break;
+ case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT:
+ *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Geometry];
+ break;
+ case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT:
+ *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Geometry];
+ break;
+ case GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT:
+ *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Geometry];
+ break;
+ case GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT:
+ *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Geometry];
+ break;
+ case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT:
+ *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Geometry];
+ break;
+ // GLES1 emulation: Caps queries
+ case GL_MAX_TEXTURE_UNITS:
+ *params = mState.mCaps.maxMultitextureUnits;
+ break;
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ *params = mState.mCaps.maxModelviewMatrixStackDepth;
+ break;
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ *params = mState.mCaps.maxProjectionMatrixStackDepth;
+ break;
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ *params = mState.mCaps.maxTextureMatrixStackDepth;
+ break;
+ case GL_MAX_LIGHTS:
+ *params = mState.mCaps.maxLights;
+ break;
+ case GL_MAX_CLIP_PLANES:
+ *params = mState.mCaps.maxClipPlanes;
+ break;
+ // GLES1 emulation: Vertex attribute queries
+ case GL_VERTEX_ARRAY_BUFFER_BINDING:
+ case GL_NORMAL_ARRAY_BUFFER_BINDING:
+ case GL_COLOR_ARRAY_BUFFER_BINDING:
+ case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+ getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
+ GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, params);
+ break;
+ case GL_VERTEX_ARRAY_STRIDE:
+ case GL_NORMAL_ARRAY_STRIDE:
+ case GL_COLOR_ARRAY_STRIDE:
+ case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
+ GL_VERTEX_ATTRIB_ARRAY_STRIDE, params);
+ break;
+ case GL_VERTEX_ARRAY_SIZE:
+ case GL_COLOR_ARRAY_SIZE:
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
+ GL_VERTEX_ATTRIB_ARRAY_SIZE, params);
+ break;
+ case GL_VERTEX_ARRAY_TYPE:
+ case GL_COLOR_ARRAY_TYPE:
+ case GL_NORMAL_ARRAY_TYPE:
+ case GL_POINT_SIZE_ARRAY_TYPE_OES:
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ getVertexAttribiv(static_cast<GLuint>(vertexArrayIndex(ParamToVertexArrayType(pname))),
+ GL_VERTEX_ATTRIB_ARRAY_TYPE, params);
+ break;
+
+ // GL_KHR_parallel_shader_compile
+ case GL_MAX_SHADER_COMPILER_THREADS_KHR:
+ *params = mState.getMaxShaderCompilerThreads();
+ break;
+
+ // GL_EXT_blend_func_extended
+ case GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT:
+ *params = mState.mExtensions.maxDualSourceDrawBuffers;
+ break;
+
+ default:
+ ANGLE_CONTEXT_TRY(mState.getIntegerv(this, pname, params));
+ break;
+ }
+}
+
+void Context::getInteger64vImpl(GLenum pname, GLint64 *params)
+{
+ // Queries about context capabilities and maximums are answered by Context.
+ // Queries about current GL state values are answered by State.
+ switch (pname)
+ {
+ case GL_MAX_ELEMENT_INDEX:
+ *params = mState.mCaps.maxElementIndex;
+ break;
+ case GL_MAX_UNIFORM_BLOCK_SIZE:
+ *params = mState.mCaps.maxUniformBlockSize;
+ break;
+ case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+ *params = mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Vertex];
+ break;
+ case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+ *params = mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Fragment];
+ break;
+ case GL_MAX_SERVER_WAIT_TIMEOUT:
+ *params = mState.mCaps.maxServerWaitTimeout;
+ break;
+
+ // GL_EXT_disjoint_timer_query
+ case GL_TIMESTAMP_EXT:
+ *params = mImplementation->getTimestamp();
+ break;
+
+ case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
+ *params = mState.mCaps.maxShaderStorageBlockSize;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void Context::getPointerv(GLenum pname, void **params) const
+{
+ mState.getPointerv(this, pname, params);
+}
+
+void Context::getPointervRobustANGLERobust(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getIntegeri_v(GLenum target, GLuint index, GLint *data)
+{
+ // Queries about context capabilities and maximums are answered by Context.
+ // Queries about current GL state values are answered by State.
+
+ GLenum nativeType;
+ unsigned int numParams;
+ bool queryStatus = getIndexedQueryParameterInfo(target, &nativeType, &numParams);
+ ASSERT(queryStatus);
+
+ if (nativeType == GL_INT)
+ {
+ switch (target)
+ {
+ case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
+ ASSERT(index < 3u);
+ *data = mState.mCaps.maxComputeWorkGroupCount[index];
+ break;
+ case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
+ ASSERT(index < 3u);
+ *data = mState.mCaps.maxComputeWorkGroupSize[index];
+ break;
+ default:
+ mState.getIntegeri_v(target, index, data);
+ }
+ }
+ else
+ {
+ CastIndexedStateValues(this, nativeType, target, index, numParams, data);
+ }
+}
+
+void Context::getIntegeri_vRobust(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ getIntegeri_v(target, index, data);
+}
+
+void Context::getInteger64i_v(GLenum target, GLuint index, GLint64 *data)
+{
+ // Queries about context capabilities and maximums are answered by Context.
+ // Queries about current GL state values are answered by State.
+
+ GLenum nativeType;
+ unsigned int numParams;
+ bool queryStatus = getIndexedQueryParameterInfo(target, &nativeType, &numParams);
+ ASSERT(queryStatus);
+
+ if (nativeType == GL_INT_64_ANGLEX)
+ {
+ mState.getInteger64i_v(target, index, data);
+ }
+ else
+ {
+ CastIndexedStateValues(this, nativeType, target, index, numParams, data);
+ }
+}
+
+void Context::getInteger64i_vRobust(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ getInteger64i_v(target, index, data);
+}
+
+void Context::getBooleani_v(GLenum target, GLuint index, GLboolean *data)
+{
+ // Queries about context capabilities and maximums are answered by Context.
+ // Queries about current GL state values are answered by State.
+
+ GLenum nativeType;
+ unsigned int numParams;
+ bool queryStatus = getIndexedQueryParameterInfo(target, &nativeType, &numParams);
+ ASSERT(queryStatus);
+
+ if (nativeType == GL_BOOL)
+ {
+ mState.getBooleani_v(target, index, data);
+ }
+ else
+ {
+ CastIndexedStateValues(this, nativeType, target, index, numParams, data);
+ }
+}
+
+void Context::getBooleani_vRobust(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data)
+{
+ getBooleani_v(target, index, data);
+}
+
+void Context::getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params)
+{
+ Buffer *buffer = mState.getTargetBuffer(target);
+ QueryBufferParameteriv(buffer, pname, params);
+}
+
+void Context::getBufferParameterivRobust(BufferBinding target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getBufferParameteriv(target, pname, params);
+}
+
+void Context::getFramebufferAttachmentParameteriv(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ const Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ QueryFramebufferAttachmentParameteriv(this, framebuffer, attachment, pname, params);
+}
+
+void Context::getFramebufferAttachmentParameterivRobust(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getFramebufferAttachmentParameteriv(target, attachment, pname, params);
+}
+
+void Context::getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
+ QueryRenderbufferiv(this, renderbuffer, pname, params);
+}
+
+void Context::getRenderbufferParameterivRobust(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getRenderbufferParameteriv(target, pname, params);
+}
+
+void Context::getTexParameterfv(TextureType target, GLenum pname, GLfloat *params)
+{
+ const Texture *const texture = getTextureByType(target);
+ QueryTexParameterfv(texture, pname, params);
+}
+
+void Context::getTexParameterfvRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ getTexParameterfv(target, pname, params);
+}
+
+void Context::getTexParameteriv(TextureType target, GLenum pname, GLint *params)
+{
+ const Texture *const texture = getTextureByType(target);
+ QueryTexParameteriv(texture, pname, params);
+}
+
+void Context::getTexParameterIiv(TextureType target, GLenum pname, GLint *params)
+{
+ const Texture *const texture = getTextureByType(target);
+ QueryTexParameterIiv(texture, pname, params);
+}
+
+void Context::getTexParameterIuiv(TextureType target, GLenum pname, GLuint *params)
+{
+ const Texture *const texture = getTextureByType(target);
+ QueryTexParameterIuiv(texture, pname, params);
+}
+
+void Context::getTexParameterivRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getTexParameteriv(target, pname, params);
+}
+
+void Context::getTexParameterIivRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTexParameterIuivRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTexLevelParameteriv(TextureTarget target, GLint level, GLenum pname, GLint *params)
+{
+ Texture *texture = getTextureByTarget(target);
+ QueryTexLevelParameteriv(texture, target, level, pname, params);
+}
+
+void Context::getTexLevelParameterivRobust(TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTexLevelParameterfv(TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ Texture *texture = getTextureByTarget(target);
+ QueryTexLevelParameterfv(texture, target, level, pname, params);
+}
+
+void Context::getTexLevelParameterfvRobust(TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texParameterf(TextureType target, GLenum pname, GLfloat param)
+{
+ Texture *const texture = getTextureByType(target);
+ SetTexParameterf(this, texture, pname, param);
+}
+
+void Context::texParameterfv(TextureType target, GLenum pname, const GLfloat *params)
+{
+ Texture *const texture = getTextureByType(target);
+ SetTexParameterfv(this, texture, pname, params);
+}
+
+void Context::texParameterfvRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params)
+{
+ texParameterfv(target, pname, params);
+}
+
+void Context::texParameteri(TextureType target, GLenum pname, GLint param)
+{
+ Texture *const texture = getTextureByType(target);
+ SetTexParameteri(this, texture, pname, param);
+}
+
+void Context::texParameteriv(TextureType target, GLenum pname, const GLint *params)
+{
+ Texture *const texture = getTextureByType(target);
+ SetTexParameteriv(this, texture, pname, params);
+}
+
+void Context::texParameterIiv(TextureType target, GLenum pname, const GLint *params)
+{
+ Texture *const texture = getTextureByType(target);
+ SetTexParameterIiv(this, texture, pname, params);
+}
+
+void Context::texParameterIuiv(TextureType target, GLenum pname, const GLuint *params)
+{
+ Texture *const texture = getTextureByType(target);
+ SetTexParameterIuiv(this, texture, pname, params);
+}
+
+void Context::texParameterivRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ texParameteriv(target, pname, params);
+}
+
+void Context::texParameterIivRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texParameterIuivRobust(TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawArraysInstanced(PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instanceCount)
+{
+ // No-op if count draws no primitives for given mode
+ if (noopDrawInstanced(mode, count, instanceCount))
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ ANGLE_CONTEXT_TRY(
+ mImplementation->drawArraysInstanced(this, mode, first, count, instanceCount));
+ MarkTransformFeedbackBufferUsage(this, count, instanceCount);
+}
+
+void Context::drawElementsInstanced(PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei instances)
+{
+ // No-op if count draws no primitives for given mode
+ if (noopDrawInstanced(mode, count, instances))
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ ANGLE_CONTEXT_TRY(
+ mImplementation->drawElementsInstanced(this, mode, count, type, indices, instances));
+}
+
+void Context::drawRangeElements(PrimitiveMode mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices)
+{
+ // No-op if count draws no primitives for given mode
+ if (noopDraw(mode, count))
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ ANGLE_CONTEXT_TRY(
+ mImplementation->drawRangeElements(this, mode, start, end, count, type, indices));
+}
+
+void Context::drawArraysIndirect(PrimitiveMode mode, const void *indirect)
+{
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ ANGLE_CONTEXT_TRY(mImplementation->drawArraysIndirect(this, mode, indirect));
+}
+
+void Context::drawElementsIndirect(PrimitiveMode mode, DrawElementsType type, const void *indirect)
+{
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ ANGLE_CONTEXT_TRY(mImplementation->drawElementsIndirect(this, mode, type, indirect));
+}
+
+void Context::flush()
+{
+ ANGLE_CONTEXT_TRY(mImplementation->flush(this));
+}
+
+void Context::finish()
+{
+ ANGLE_CONTEXT_TRY(mImplementation->finish(this));
+}
+
+void Context::insertEventMarker(GLsizei length, const char *marker)
+{
+ ASSERT(mImplementation);
+ mImplementation->insertEventMarker(length, marker);
+}
+
+void Context::pushGroupMarker(GLsizei length, const char *marker)
+{
+ ASSERT(mImplementation);
+
+ if (marker == nullptr)
+ {
+ // From the EXT_debug_marker spec,
+ // "If <marker> is null then an empty string is pushed on the stack."
+ mImplementation->pushGroupMarker(length, "");
+ }
+ else
+ {
+ mImplementation->pushGroupMarker(length, marker);
+ }
+}
+
+void Context::popGroupMarker()
+{
+ ASSERT(mImplementation);
+ mImplementation->popGroupMarker();
+}
+
+void Context::bindUniformLocation(GLuint program, GLint location, const GLchar *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+
+ programObject->bindUniformLocation(location, name);
+}
+
+void Context::coverageModulation(GLenum components)
+{
+ mState.setCoverageModulation(components);
+}
+
+void Context::matrixLoadf(GLenum matrixMode, const GLfloat *matrix)
+{
+ mState.loadPathRenderingMatrix(matrixMode, matrix);
+}
+
+void Context::matrixLoadIdentity(GLenum matrixMode)
+{
+ GLfloat I[16];
+ angle::Matrix<GLfloat>::setToIdentity(I);
+
+ mState.loadPathRenderingMatrix(matrixMode, I);
+}
+
+void Context::stencilFillPath(GLuint path, GLenum fillMode, GLuint mask)
+{
+ const auto *pathObj = mState.mPathManager->getPath(path);
+ if (!pathObj)
+ return;
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilFillPath(pathObj, fillMode, mask);
+}
+
+void Context::stencilStrokePath(GLuint path, GLint reference, GLuint mask)
+{
+ const auto *pathObj = mState.mPathManager->getPath(path);
+ if (!pathObj)
+ return;
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilStrokePath(pathObj, reference, mask);
+}
+
+void Context::coverFillPath(GLuint path, GLenum coverMode)
+{
+ const auto *pathObj = mState.mPathManager->getPath(path);
+ if (!pathObj)
+ return;
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->coverFillPath(pathObj, coverMode);
+}
+
+void Context::coverStrokePath(GLuint path, GLenum coverMode)
+{
+ const auto *pathObj = mState.mPathManager->getPath(path);
+ if (!pathObj)
+ return;
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->coverStrokePath(pathObj, coverMode);
+}
+
+void Context::stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode)
+{
+ const auto *pathObj = mState.mPathManager->getPath(path);
+ if (!pathObj)
+ return;
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilThenCoverFillPath(pathObj, fillMode, mask, coverMode);
+}
+
+void Context::stencilThenCoverStrokePath(GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode)
+{
+ const auto *pathObj = mState.mPathManager->getPath(path);
+ if (!pathObj)
+ return;
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilThenCoverStrokePath(pathObj, reference, mask, coverMode);
+}
+
+void Context::coverFillPathInstanced(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ const auto &pathObjects =
+ GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->coverFillPathInstanced(pathObjects, coverMode, transformType, transformValues);
+}
+
+void Context::coverStrokePathInstanced(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ const auto &pathObjects =
+ GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
+
+ // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->coverStrokePathInstanced(pathObjects, coverMode, transformType,
+ transformValues);
+}
+
+void Context::stencilFillPathInstanced(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ const auto &pathObjects =
+ GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
+
+ // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilFillPathInstanced(pathObjects, fillMode, mask, transformType,
+ transformValues);
+}
+
+void Context::stencilStrokePathInstanced(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ const auto &pathObjects =
+ GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilStrokePathInstanced(pathObjects, reference, mask, transformType,
+ transformValues);
+}
+
+void Context::stencilThenCoverFillPathInstanced(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ const auto &pathObjects =
+ GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilThenCoverFillPathInstanced(pathObjects, coverMode, fillMode, mask,
+ transformType, transformValues);
+}
+
+void Context::stencilThenCoverStrokePathInstanced(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ const auto &pathObjects =
+ GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
+
+ ANGLE_CONTEXT_TRY(syncStateForPathOperation());
+
+ mImplementation->stencilThenCoverStrokePathInstanced(pathObjects, coverMode, reference, mask,
+ transformType, transformValues);
+}
+
+void Context::bindFragmentInputLocation(GLuint program, GLint location, const GLchar *name)
+{
+ auto *programObject = getProgramResolveLink(program);
+
+ programObject->bindFragmentInputLocation(location, name);
+}
+
+void Context::programPathFragmentInputGen(GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ auto *programObject = getProgramResolveLink(program);
+
+ programObject->pathFragmentInputGen(location, genMode, components, coeffs);
+}
+
+GLuint Context::getProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ return QueryProgramResourceIndex(programObject, programInterface, name);
+}
+
+void Context::getProgramResourceName(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ QueryProgramResourceName(programObject, programInterface, index, bufSize, length, name);
+}
+
+GLint Context::getProgramResourceLocation(GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ return QueryProgramResourceLocation(programObject, programInterface, name);
+}
+
+void Context::getProgramResourceiv(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ QueryProgramResourceiv(programObject, programInterface, index, propCount, props, bufSize,
+ length, params);
+}
+
+void Context::getProgramInterfaceiv(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ QueryProgramInterfaceiv(programObject, programInterface, pname, params);
+}
+
+void Context::getProgramInterfaceivRobust(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::handleError(GLenum errorCode,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line)
+{
+ mErrors.handleError(errorCode, message, file, function, line);
+}
+
+void Context::validationError(GLenum errorCode, const char *message)
+{
+ mErrors.validationError(errorCode, message);
+}
+
+// Get one of the recorded errors and clear its flag, if any.
+// [OpenGL ES 2.0.24] section 2.5 page 13.
+GLenum Context::getError()
+{
+ if (mErrors.empty())
+ {
+ return GL_NO_ERROR;
+ }
+ else
+ {
+ return mErrors.popError();
+ }
+}
+
+// NOTE: this function should not assume that this context is current!
+void Context::markContextLost(GraphicsResetStatus status)
+{
+ ASSERT(status != GraphicsResetStatus::NoError);
+ if (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT)
+ {
+ mResetStatus = status;
+ mContextLostForced = true;
+ }
+ mContextLost = true;
+}
+
+GLenum Context::getGraphicsResetStatus()
+{
+ // Even if the application doesn't want to know about resets, we want to know
+ // as it will allow us to skip all the calls.
+ if (mResetStrategy == GL_NO_RESET_NOTIFICATION_EXT)
+ {
+ if (!mContextLost && mImplementation->getResetStatus() != GraphicsResetStatus::NoError)
+ {
+ mContextLost = true;
+ }
+
+ // EXT_robustness, section 2.6: If the reset notification behavior is
+ // NO_RESET_NOTIFICATION_EXT, then the implementation will never deliver notification of
+ // reset events, and GetGraphicsResetStatusEXT will always return NO_ERROR.
+ return GL_NO_ERROR;
+ }
+
+ // The GL_EXT_robustness spec says that if a reset is encountered, a reset
+ // status should be returned at least once, and GL_NO_ERROR should be returned
+ // once the device has finished resetting.
+ if (!mContextLost)
+ {
+ ASSERT(mResetStatus == GraphicsResetStatus::NoError);
+ mResetStatus = mImplementation->getResetStatus();
+
+ if (mResetStatus != GraphicsResetStatus::NoError)
+ {
+ mContextLost = true;
+ }
+ }
+ else if (!mContextLostForced && mResetStatus != GraphicsResetStatus::NoError)
+ {
+ // If markContextLost was used to mark the context lost then
+ // assume that is not recoverable, and continue to report the
+ // lost reset status for the lifetime of this context.
+ mResetStatus = mImplementation->getResetStatus();
+ }
+
+ return ToGLenum(mResetStatus);
+}
+
+bool Context::isResetNotificationEnabled()
+{
+ return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
+}
+
+const egl::Config *Context::getConfig() const
+{
+ return mConfig;
+}
+
+EGLenum Context::getClientType() const
+{
+ return mState.getClientType();
+}
+
+EGLenum Context::getRenderBuffer() const
+{
+ const Framebuffer *framebuffer = mState.mFramebufferManager->getFramebuffer(0);
+ if (framebuffer == nullptr)
+ {
+ return EGL_NONE;
+ }
+
+ const FramebufferAttachment *backAttachment = framebuffer->getAttachment(this, GL_BACK);
+ ASSERT(backAttachment != nullptr);
+ return backAttachment->getSurface()->getRenderBuffer();
+}
+
+VertexArray *Context::checkVertexArrayAllocation(GLuint vertexArrayHandle)
+{
+ // Only called after a prior call to Gen.
+ VertexArray *vertexArray = getVertexArray(vertexArrayHandle);
+ if (!vertexArray)
+ {
+ vertexArray =
+ new VertexArray(mImplementation.get(), vertexArrayHandle,
+ mState.mCaps.maxVertexAttributes, mState.mCaps.maxVertexAttribBindings);
+ vertexArray->setBufferAccessValidationEnabled(mBufferAccessValidationEnabled);
+
+ mVertexArrayMap.assign(vertexArrayHandle, vertexArray);
+ }
+
+ return vertexArray;
+}
+
+TransformFeedback *Context::checkTransformFeedbackAllocation(GLuint transformFeedbackHandle)
+{
+ // Only called after a prior call to Gen.
+ TransformFeedback *transformFeedback = getTransformFeedback(transformFeedbackHandle);
+ if (!transformFeedback)
+ {
+ transformFeedback =
+ new TransformFeedback(mImplementation.get(), transformFeedbackHandle, mState.mCaps);
+ transformFeedback->addRef();
+ mTransformFeedbackMap.assign(transformFeedbackHandle, transformFeedback);
+ }
+
+ return transformFeedback;
+}
+
+bool Context::isVertexArrayGenerated(GLuint vertexArray)
+{
+ ASSERT(mVertexArrayMap.contains(0));
+ return mVertexArrayMap.contains(vertexArray);
+}
+
+bool Context::isTransformFeedbackGenerated(GLuint transformFeedback)
+{
+ ASSERT(mTransformFeedbackMap.contains(0));
+ return mTransformFeedbackMap.contains(transformFeedback);
+}
+
+void Context::detachTexture(GLuint texture)
+{
+ // Simple pass-through to State's detachTexture method, as textures do not require
+ // allocation map management either here or in the resource manager at detach time.
+ // Zero textures are held by the Context, and we don't attempt to request them from
+ // the State.
+ mState.detachTexture(this, mZeroTextures, texture);
+}
+
+void Context::detachBuffer(Buffer *buffer)
+{
+ // Simple pass-through to State's detachBuffer method, since
+ // only buffer attachments to container objects that are bound to the current context
+ // should be detached. And all those are available in State.
+
+ // [OpenGL ES 3.2] section 5.1.2 page 45:
+ // Attachments to unbound container objects, such as
+ // deletion of a buffer attached to a vertex array object which is not bound to the context,
+ // are not affected and continue to act as references on the deleted object
+ ANGLE_CONTEXT_TRY(mState.detachBuffer(this, buffer));
+}
+
+void Context::detachFramebuffer(GLuint framebuffer)
+{
+ // Framebuffer detachment is handled by Context, because 0 is a valid
+ // Framebuffer object, and a pointer to it must be passed from Context
+ // to State at binding time.
+
+ // [OpenGL ES 2.0.24] section 4.4 page 107:
+ // If a framebuffer that is currently bound to the target FRAMEBUFFER is deleted, it is as
+ // though BindFramebuffer had been executed with the target of FRAMEBUFFER and framebuffer of
+ // zero.
+
+ if (mState.removeReadFramebufferBinding(framebuffer) && framebuffer != 0)
+ {
+ bindReadFramebuffer(0);
+ }
+
+ if (mState.removeDrawFramebufferBinding(framebuffer) && framebuffer != 0)
+ {
+ bindDrawFramebuffer(0);
+ }
+}
+
+void Context::detachRenderbuffer(GLuint renderbuffer)
+{
+ mState.detachRenderbuffer(this, renderbuffer);
+}
+
+void Context::detachVertexArray(GLuint vertexArray)
+{
+ // Vertex array detachment is handled by Context, because 0 is a valid
+ // VAO, and a pointer to it must be passed from Context to State at
+ // binding time.
+
+ // [OpenGL ES 3.0.2] section 2.10 page 43:
+ // If a vertex array object that is currently bound is deleted, the binding
+ // for that object reverts to zero and the default vertex array becomes current.
+ if (mState.removeVertexArrayBinding(this, vertexArray))
+ {
+ bindVertexArray(0);
+ }
+}
+
+void Context::detachTransformFeedback(GLuint transformFeedback)
+{
+ // Transform feedback detachment is handled by Context, because 0 is a valid
+ // transform feedback, and a pointer to it must be passed from Context to State at
+ // binding time.
+
+ // The OpenGL specification doesn't mention what should happen when the currently bound
+ // transform feedback object is deleted. Since it is a container object, we treat it like
+ // VAOs and FBOs and set the current bound transform feedback back to 0.
+ if (mState.removeTransformFeedbackBinding(this, transformFeedback))
+ {
+ bindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
+ }
+}
+
+void Context::detachSampler(GLuint sampler)
+{
+ mState.detachSampler(this, sampler);
+}
+
+void Context::detachProgramPipeline(GLuint pipeline)
+{
+ mState.detachProgramPipeline(this, pipeline);
+}
+
+void Context::vertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ mState.setVertexAttribDivisor(this, index, divisor);
+ mStateCache.onVertexArrayStateChange(this);
+}
+
+void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ SetSamplerParameteri(this, samplerObject, pname, param);
+}
+
+void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
+{
+ Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ SetSamplerParameteriv(this, samplerObject, pname, param);
+}
+
+void Context::samplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
+{
+ Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ SetSamplerParameterIiv(this, samplerObject, pname, param);
+}
+
+void Context::samplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
+{
+ Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ SetSamplerParameterIuiv(this, samplerObject, pname, param);
+}
+
+void Context::samplerParameterivRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ samplerParameteriv(sampler, pname, param);
+}
+
+void Context::samplerParameterIivRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::samplerParameterIuivRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ SetSamplerParameterf(this, samplerObject, pname, param);
+}
+
+void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
+{
+ Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ SetSamplerParameterfv(this, samplerObject, pname, param);
+}
+
+void Context::samplerParameterfvRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param)
+{
+ samplerParameterfv(sampler, pname, param);
+}
+
+void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
+{
+ const Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ QuerySamplerParameteriv(samplerObject, pname, params);
+}
+
+void Context::getSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
+{
+ const Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ QuerySamplerParameterIiv(samplerObject, pname, params);
+}
+
+void Context::getSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
+{
+ const Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ QuerySamplerParameterIuiv(samplerObject, pname, params);
+}
+
+void Context::getSamplerParameterivRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getSamplerParameteriv(sampler, pname, params);
+}
+
+void Context::getSamplerParameterIivRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getSamplerParameterIuivRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
+{
+ const Sampler *const samplerObject =
+ mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
+ QuerySamplerParameterfv(samplerObject, pname, params);
+}
+
+void Context::getSamplerParameterfvRobust(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ getSamplerParameterfv(sampler, pname, params);
+}
+
+void Context::programParameteri(GLuint program, GLenum pname, GLint value)
+{
+ gl::Program *programObject = getProgramResolveLink(program);
+ SetProgramParameteri(programObject, pname, value);
+}
+
+void Context::initRendererString()
+{
+ std::ostringstream rendererString;
+ rendererString << "ANGLE (";
+ rendererString << mImplementation->getRendererDescription();
+ rendererString << ")";
+
+ mRendererString = MakeStaticString(rendererString.str());
+}
+
+void Context::initVersionStrings()
+{
+ const Version &clientVersion = getClientVersion();
+
+ std::ostringstream versionString;
+ if (getClientType() == EGL_OPENGL_ES_API)
+ {
+ versionString << "OpenGL ES ";
+ }
+ versionString << clientVersion.major << "." << clientVersion.minor << ".0 (ANGLE "
+ << ANGLE_VERSION_STRING << ")";
+ mVersionString = MakeStaticString(versionString.str());
+
+ std::ostringstream shadingLanguageVersionString;
+ if (getClientType() == EGL_OPENGL_ES_API)
+ {
+ shadingLanguageVersionString << "OpenGL ES GLSL ES ";
+ }
+ else
+ {
+ ASSERT(getClientType() == EGL_OPENGL_API);
+ shadingLanguageVersionString << "OpenGL GLSL ";
+ }
+ shadingLanguageVersionString << (clientVersion.major == 2 ? 1 : clientVersion.major) << "."
+ << clientVersion.minor << "0 (ANGLE " << ANGLE_VERSION_STRING
+ << ")";
+ mShadingLanguageString = MakeStaticString(shadingLanguageVersionString.str());
+}
+
+void Context::initExtensionStrings()
+{
+ auto mergeExtensionStrings = [](const std::vector<const char *> &strings) {
+ std::ostringstream combinedStringStream;
+ std::copy(strings.begin(), strings.end(),
+ std::ostream_iterator<const char *>(combinedStringStream, " "));
+ return MakeStaticString(combinedStringStream.str());
+ };
+
+ mExtensionStrings.clear();
+ for (const auto &extensionString : mState.mExtensions.getStrings())
+ {
+ mExtensionStrings.push_back(MakeStaticString(extensionString));
+ }
+ mExtensionString = mergeExtensionStrings(mExtensionStrings);
+
+ mRequestableExtensionStrings.clear();
+ for (const auto &extensionInfo : GetExtensionInfoMap())
+ {
+ if (extensionInfo.second.Requestable &&
+ !(mState.mExtensions.*(extensionInfo.second.ExtensionsMember)) &&
+ mSupportedExtensions.*(extensionInfo.second.ExtensionsMember))
+ {
+ mRequestableExtensionStrings.push_back(MakeStaticString(extensionInfo.first));
+ }
+ }
+ mRequestableExtensionString = mergeExtensionStrings(mRequestableExtensionStrings);
+}
+
+const GLubyte *Context::getString(GLenum name)
+{
+ return static_cast<const Context *>(this)->getString(name);
+}
+
+const GLubyte *Context::getStringi(GLenum name, GLuint index)
+{
+ return static_cast<const Context *>(this)->getStringi(name, index);
+}
+
+const GLubyte *Context::getString(GLenum name) const
+{
+ switch (name)
+ {
+ case GL_VENDOR:
+ return reinterpret_cast<const GLubyte *>("Google Inc.");
+
+ case GL_RENDERER:
+ return reinterpret_cast<const GLubyte *>(mRendererString);
+
+ case GL_VERSION:
+ return reinterpret_cast<const GLubyte *>(mVersionString);
+
+ case GL_SHADING_LANGUAGE_VERSION:
+ return reinterpret_cast<const GLubyte *>(mShadingLanguageString);
+
+ case GL_EXTENSIONS:
+ return reinterpret_cast<const GLubyte *>(mExtensionString);
+
+ case GL_REQUESTABLE_EXTENSIONS_ANGLE:
+ return reinterpret_cast<const GLubyte *>(mRequestableExtensionString);
+
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+const GLubyte *Context::getStringi(GLenum name, GLuint index) const
+{
+ switch (name)
+ {
+ case GL_EXTENSIONS:
+ return reinterpret_cast<const GLubyte *>(mExtensionStrings[index]);
+
+ case GL_REQUESTABLE_EXTENSIONS_ANGLE:
+ return reinterpret_cast<const GLubyte *>(mRequestableExtensionStrings[index]);
+
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+size_t Context::getExtensionStringCount() const
+{
+ return mExtensionStrings.size();
+}
+
+bool Context::isExtensionRequestable(const char *name)
+{
+ const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap();
+ auto extension = extensionInfos.find(name);
+
+ return extension != extensionInfos.end() && extension->second.Requestable &&
+ mSupportedExtensions.*(extension->second.ExtensionsMember);
+}
+
+void Context::requestExtension(const char *name)
+{
+ const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap();
+ ASSERT(extensionInfos.find(name) != extensionInfos.end());
+ const auto &extension = extensionInfos.at(name);
+ ASSERT(extension.Requestable);
+ ASSERT(isExtensionRequestable(name));
+
+ if (mState.mExtensions.*(extension.ExtensionsMember))
+ {
+ // Extension already enabled
+ return;
+ }
+
+ mState.mExtensions.*(extension.ExtensionsMember) = true;
+ updateCaps();
+ initExtensionStrings();
+
+ // Release the shader compiler so it will be re-created with the requested extensions enabled.
+ releaseShaderCompiler();
+
+ // Invalidate all textures and framebuffer. Some extensions make new formats renderable or
+ // sampleable.
+ mState.mTextureManager->signalAllTexturesDirty();
+ for (auto &zeroTexture : mZeroTextures)
+ {
+ if (zeroTexture.get() != nullptr)
+ {
+ zeroTexture->signalDirtyStorage(InitState::Initialized);
+ }
+ }
+
+ mState.mFramebufferManager->invalidateFramebufferComplenessCache();
+}
+
+size_t Context::getRequestableExtensionStringCount() const
+{
+ return mRequestableExtensionStrings.size();
+}
+
+void Context::beginTransformFeedback(PrimitiveMode primitiveMode)
+{
+ TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
+ ASSERT(transformFeedback != nullptr);
+ ASSERT(!transformFeedback->isPaused());
+
+ ANGLE_CONTEXT_TRY(transformFeedback->begin(this, primitiveMode, mState.getProgram()));
+ mStateCache.onActiveTransformFeedbackChange(this);
+}
+
+bool Context::hasActiveTransformFeedback(GLuint program) const
+{
+ for (auto pair : mTransformFeedbackMap)
+ {
+ if (pair.second != nullptr && pair.second->hasBoundProgram(program))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+Extensions Context::generateSupportedExtensions() const
+{
+ Extensions supportedExtensions = mImplementation->getNativeExtensions();
+
+ // Explicitly enable GL_KHR_parallel_shader_compile
+ supportedExtensions.parallelShaderCompile = true;
+
+ if (getClientVersion() < ES_2_0)
+ {
+ // Default extensions for GLES1
+ supportedExtensions.pointSizeArray = true;
+ supportedExtensions.textureCubeMap = true;
+ supportedExtensions.pointSprite = true;
+ supportedExtensions.drawTexture = true;
+ supportedExtensions.parallelShaderCompile = false;
+ supportedExtensions.texture3DOES = false;
+ }
+
+ if (getClientVersion() < ES_3_0)
+ {
+ // Disable ES3+ extensions
+ supportedExtensions.colorBufferFloat = false;
+ supportedExtensions.eglImageExternalEssl3 = false;
+ supportedExtensions.textureNorm16 = false;
+ supportedExtensions.multiview = false;
+ supportedExtensions.multiview2 = false;
+ supportedExtensions.maxViews = 1u;
+ supportedExtensions.copyTexture3d = false;
+ supportedExtensions.textureMultisample = false;
+
+ // Requires glCompressedTexImage3D
+ supportedExtensions.textureCompressionASTCOES = false;
+
+ // Don't expose GL_EXT_texture_sRGB_decode without sRGB texture support
+ if (!supportedExtensions.sRGB)
+ {
+ supportedExtensions.textureSRGBDecode = false;
+ }
+ }
+
+ if (getClientVersion() < ES_3_1)
+ {
+ // Disable ES3.1+ extensions
+ supportedExtensions.geometryShader = false;
+
+ // TODO(http://anglebug.com/2775): Multisample arrays could be supported on ES 3.0 as well
+ // once 2D multisample texture extension is exposed there.
+ supportedExtensions.textureStorageMultisample2DArray = false;
+ }
+
+ if (getClientVersion() > ES_2_0)
+ {
+ // FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
+ // supportedExtensions.sRGB = false;
+ }
+
+ // Some extensions are always available because they are implemented in the GL layer.
+ supportedExtensions.bindUniformLocation = true;
+ supportedExtensions.vertexArrayObject = true;
+ supportedExtensions.bindGeneratesResource = true;
+ supportedExtensions.clientArrays = true;
+ supportedExtensions.requestExtension = true;
+ supportedExtensions.multiDraw = true;
+
+ // Enable the no error extension if the context was created with the flag.
+ supportedExtensions.noError = mSkipValidation;
+
+ // Enable surfaceless to advertise we'll have the correct behavior when there is no default FBO
+ supportedExtensions.surfacelessContext = mSurfacelessSupported;
+
+ // Explicitly enable GL_KHR_debug
+ supportedExtensions.debug = true;
+ supportedExtensions.maxDebugMessageLength = 1024;
+ supportedExtensions.maxDebugLoggedMessages = 1024;
+ supportedExtensions.maxDebugGroupStackDepth = 1024;
+ supportedExtensions.maxLabelLength = 1024;
+
+ // Explicitly enable GL_ANGLE_robust_client_memory
+ supportedExtensions.robustClientMemory = true;
+
+ // Determine robust resource init availability from EGL.
+ supportedExtensions.robustResourceInitialization = mState.isRobustResourceInitEnabled();
+
+ // mState.mExtensions.robustBufferAccessBehavior is true only if robust access is true and the
+ // backend supports it.
+ supportedExtensions.robustBufferAccessBehavior =
+ mRobustAccess && supportedExtensions.robustBufferAccessBehavior;
+
+ // Enable the cache control query unconditionally.
+ supportedExtensions.programCacheControl = true;
+
+ // Enable EGL_ANGLE_explicit_context subextensions
+ if (mExplicitContextAvailable)
+ {
+ // GL_ANGLE_explicit_context_gles1
+ supportedExtensions.explicitContextGles1 = true;
+ // GL_ANGLE_explicit_context
+ supportedExtensions.explicitContext = true;
+ }
+
+ // If EGL_KHR_fence_sync is not enabled, don't expose GL_OES_EGL_sync.
+ ASSERT(mDisplay);
+ if (!mDisplay->getExtensions().fenceSync)
+ {
+ supportedExtensions.eglSync = false;
+ }
+
+ supportedExtensions.memorySize = true;
+
+ // GL_CHROMIUM_lose_context is implemented in the frontend
+ supportedExtensions.loseContextCHROMIUM = true;
+
+ // The ASTC texture extensions have dependency requirements.
+ if (supportedExtensions.textureCompressionASTCHDRKHR)
+ {
+ // GL_KHR_texture_compression_astc_hdr cannot be exposed without also exposing
+ // GL_KHR_texture_compression_astc_ldr
+ ASSERT(supportedExtensions.textureCompressionASTCLDRKHR);
+ }
+
+ if (supportedExtensions.textureCompressionASTCOES)
+ {
+ // GL_OES_texture_compression_astc cannot be exposed without also exposing
+ // GL_KHR_texture_compression_astc_ldr and GL_KHR_texture_compression_astc_hdr
+ ASSERT(supportedExtensions.textureCompressionASTCLDRKHR);
+ ASSERT(supportedExtensions.textureCompressionASTCHDRKHR);
+ }
+
+ return supportedExtensions;
+}
+
+void Context::initCaps()
+{
+ mState.mCaps = mImplementation->getNativeCaps();
+
+ mSupportedExtensions = generateSupportedExtensions();
+ mState.mExtensions = mSupportedExtensions;
+
+ mState.mLimitations = mImplementation->getNativeLimitations();
+
+ // GLES1 emulation: Initialize caps (Table 6.20 / 6.22 in the ES 1.1 spec)
+ if (getClientVersion() < Version(2, 0))
+ {
+ mState.mCaps.maxMultitextureUnits = 4;
+ mState.mCaps.maxClipPlanes = 6;
+ mState.mCaps.maxLights = 8;
+ mState.mCaps.maxModelviewMatrixStackDepth = Caps::GlobalMatrixStackDepth;
+ mState.mCaps.maxProjectionMatrixStackDepth = Caps::GlobalMatrixStackDepth;
+ mState.mCaps.maxTextureMatrixStackDepth = Caps::GlobalMatrixStackDepth;
+ mState.mCaps.minSmoothPointSize = 1.0f;
+ mState.mCaps.maxSmoothPointSize = 1.0f;
+ mState.mCaps.minSmoothLineWidth = 1.0f;
+ mState.mCaps.maxSmoothLineWidth = 1.0f;
+ }
+
+ // Apply/Verify implementation limits
+ LimitCap(&mState.mCaps.maxVertexAttributes, MAX_VERTEX_ATTRIBS);
+
+ ASSERT(mState.mCaps.minAliasedPointSize >= 1.0f);
+
+ if (getClientVersion() < ES_3_1)
+ {
+ mState.mCaps.maxVertexAttribBindings = mState.mCaps.maxVertexAttributes;
+ }
+ else
+ {
+ LimitCap(&mState.mCaps.maxVertexAttribBindings, MAX_VERTEX_ATTRIB_BINDINGS);
+ }
+
+ LimitCap(&mState.mCaps.maxShaderUniformBlocks[ShaderType::Vertex],
+ IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
+ LimitCap(&mState.mCaps.maxUniformBufferBindings, IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS);
+
+ LimitCap(&mState.mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+ LimitCap(&mState.mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+
+ LimitCap(&mState.mCaps.maxTransformFeedbackInterleavedComponents,
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS);
+ LimitCap(&mState.mCaps.maxTransformFeedbackSeparateAttributes,
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS);
+ LimitCap(&mState.mCaps.maxTransformFeedbackSeparateComponents,
+ IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS);
+
+ // Limit textures as well, so we can use fast bitsets with texture bindings.
+ LimitCap(&mState.mCaps.maxCombinedTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES);
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ LimitCap(&mState.mCaps.maxShaderTextureImageUnits[shaderType],
+ IMPLEMENTATION_MAX_SHADER_TEXTURES);
+ }
+
+ LimitCap(&mState.mCaps.maxImageUnits, IMPLEMENTATION_MAX_IMAGE_UNITS);
+
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ LimitCap(&mState.mCaps.maxShaderAtomicCounterBuffers[shaderType],
+ IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS);
+ }
+ LimitCap(&mState.mCaps.maxCombinedAtomicCounterBuffers,
+ IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS);
+
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ LimitCap(&mState.mCaps.maxShaderStorageBlocks[shaderType],
+ IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS);
+ }
+ LimitCap(&mState.mCaps.maxShaderStorageBufferBindings,
+ IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS);
+ LimitCap(&mState.mCaps.maxCombinedShaderStorageBlocks,
+ IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS);
+
+ mState.mCaps.maxSampleMaskWords =
+ std::min<GLuint>(mState.mCaps.maxSampleMaskWords, MAX_SAMPLE_MASK_WORDS);
+
+ // WebGL compatibility
+ mState.mExtensions.webglCompatibility = mWebGLContext;
+ for (const auto &extensionInfo : GetExtensionInfoMap())
+ {
+ // If the user has requested that extensions start disabled and they are requestable,
+ // disable them.
+ if (!mExtensionsEnabled && extensionInfo.second.Requestable)
+ {
+ mState.mExtensions.*(extensionInfo.second.ExtensionsMember) = false;
+ }
+ }
+
+ // Generate texture caps
+ updateCaps();
+}
+
+void Context::updateCaps()
+{
+ mState.mCaps.compressedTextureFormats.clear();
+ mState.mTextureCaps.clear();
+
+ for (GLenum sizedInternalFormat : GetAllSizedInternalFormats())
+ {
+ TextureCaps formatCaps = mImplementation->getNativeTextureCaps().get(sizedInternalFormat);
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(sizedInternalFormat);
+
+ // Update the format caps based on the client version and extensions.
+ // Caps are AND'd with the renderer caps because some core formats are still unsupported in
+ // ES3.
+ formatCaps.texturable = formatCaps.texturable &&
+ formatInfo.textureSupport(getClientVersion(), mState.mExtensions);
+ formatCaps.filterable = formatCaps.filterable &&
+ formatInfo.filterSupport(getClientVersion(), mState.mExtensions);
+ formatCaps.textureAttachment =
+ formatCaps.textureAttachment &&
+ formatInfo.textureAttachmentSupport(getClientVersion(), mState.mExtensions);
+ formatCaps.renderbuffer =
+ formatCaps.renderbuffer &&
+ formatInfo.renderbufferSupport(getClientVersion(), mState.mExtensions);
+
+ // OpenGL ES does not support multisampling with non-rendererable formats
+ // OpenGL ES 3.0 or prior does not support multisampling with integer formats
+ if (!formatCaps.renderbuffer ||
+ (getClientVersion() < ES_3_1 && !mSupportedExtensions.textureMultisample &&
+ formatInfo.isInt()))
+ {
+ formatCaps.sampleCounts.clear();
+ }
+ else
+ {
+ // We may have limited the max samples for some required renderbuffer formats due to
+ // non-conformant formats. In this case MAX_SAMPLES needs to be lowered accordingly.
+ GLuint formatMaxSamples = formatCaps.getMaxSamples();
+
+ // GLES 3.0.5 section 4.4.2.2: "Implementations must support creation of renderbuffers
+ // in these required formats with up to the value of MAX_SAMPLES multisamples, with the
+ // exception of signed and unsigned integer formats."
+ if (!formatInfo.isInt() && formatInfo.isRequiredRenderbufferFormat(getClientVersion()))
+ {
+ ASSERT(getClientVersion() < ES_3_0 || formatMaxSamples >= 4);
+ mState.mCaps.maxSamples = std::min(mState.mCaps.maxSamples, formatMaxSamples);
+ }
+
+ // Handle GLES 3.1 MAX_*_SAMPLES values similarly to MAX_SAMPLES.
+ if (getClientVersion() >= ES_3_1 || mSupportedExtensions.textureMultisample)
+ {
+ // GLES 3.1 section 9.2.5: "Implementations must support creation of renderbuffers
+ // in these required formats with up to the value of MAX_SAMPLES multisamples, with
+ // the exception that the signed and unsigned integer formats are required only to
+ // support creation of renderbuffers with up to the value of MAX_INTEGER_SAMPLES
+ // multisamples, which must be at least one."
+ if (formatInfo.isInt())
+ {
+ mState.mCaps.maxIntegerSamples =
+ std::min(mState.mCaps.maxIntegerSamples, formatMaxSamples);
+ }
+
+ // GLES 3.1 section 19.3.1.
+ if (formatCaps.texturable)
+ {
+ if (formatInfo.depthBits > 0)
+ {
+ mState.mCaps.maxDepthTextureSamples =
+ std::min(mState.mCaps.maxDepthTextureSamples, formatMaxSamples);
+ }
+ else if (formatInfo.redBits > 0)
+ {
+ mState.mCaps.maxColorTextureSamples =
+ std::min(mState.mCaps.maxColorTextureSamples, formatMaxSamples);
+ }
+ }
+ }
+ }
+
+ if (formatCaps.texturable && formatInfo.compressed)
+ {
+ mState.mCaps.compressedTextureFormats.push_back(sizedInternalFormat);
+ }
+
+ mState.mTextureCaps.insert(sizedInternalFormat, formatCaps);
+ }
+
+ // If program binary is disabled, blank out the memory cache pointer.
+ if (!mSupportedExtensions.getProgramBinary)
+ {
+ mMemoryProgramCache = nullptr;
+ }
+
+ // Compute which buffer types are allowed
+ mValidBufferBindings.reset();
+ mValidBufferBindings.set(BufferBinding::ElementArray);
+ mValidBufferBindings.set(BufferBinding::Array);
+
+ if (mState.mExtensions.pixelBufferObject || getClientVersion() >= ES_3_0)
+ {
+ mValidBufferBindings.set(BufferBinding::PixelPack);
+ mValidBufferBindings.set(BufferBinding::PixelUnpack);
+ }
+
+ if (getClientVersion() >= ES_3_0)
+ {
+ mValidBufferBindings.set(BufferBinding::CopyRead);
+ mValidBufferBindings.set(BufferBinding::CopyWrite);
+ mValidBufferBindings.set(BufferBinding::TransformFeedback);
+ mValidBufferBindings.set(BufferBinding::Uniform);
+ }
+
+ if (getClientVersion() >= ES_3_1)
+ {
+ mValidBufferBindings.set(BufferBinding::AtomicCounter);
+ mValidBufferBindings.set(BufferBinding::ShaderStorage);
+ mValidBufferBindings.set(BufferBinding::DrawIndirect);
+ mValidBufferBindings.set(BufferBinding::DispatchIndirect);
+ }
+
+ mThreadPool = angle::WorkerThreadPool::Create(mState.mExtensions.parallelShaderCompile);
+
+ // Reinitialize some dirty bits that depend on extensions.
+ if (mState.isRobustResourceInitEnabled())
+ {
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_DRAW_ATTACHMENTS);
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_TEXTURES_INIT);
+ mDrawDirtyObjects.set(State::DIRTY_OBJECT_IMAGES_INIT);
+ mBlitDirtyObjects.set(State::DIRTY_OBJECT_DRAW_ATTACHMENTS);
+ mBlitDirtyObjects.set(State::DIRTY_OBJECT_READ_ATTACHMENTS);
+ mComputeDirtyObjects.set(State::DIRTY_OBJECT_TEXTURES_INIT);
+ mComputeDirtyObjects.set(State::DIRTY_OBJECT_IMAGES_INIT);
+ mReadPixelsDirtyObjects.set(State::DIRTY_OBJECT_READ_ATTACHMENTS);
+ mCopyImageDirtyObjects.set(State::DIRTY_OBJECT_READ_ATTACHMENTS);
+ }
+
+ // We need to validate buffer bounds if we are in a WebGL or robust access context and the
+ // back-end does not support robust buffer access behaviour.
+ mBufferAccessValidationEnabled =
+ (!mSupportedExtensions.robustBufferAccessBehavior && (mState.isWebGL() || mRobustAccess));
+
+ // Cache this in the VertexArrays. They need to check it in state change notifications.
+ for (auto vaoIter : mVertexArrayMap)
+ {
+ VertexArray *vao = vaoIter.second;
+ vao->setBufferAccessValidationEnabled(mBufferAccessValidationEnabled);
+ }
+
+ // Reinitialize state cache after extension changes.
+ mStateCache.initialize(this);
+}
+
+bool Context::noopDrawInstanced(PrimitiveMode mode, GLsizei count, GLsizei instanceCount)
+{
+ return (instanceCount == 0) || noopDraw(mode, count);
+}
+
+angle::Result Context::prepareForClear(GLbitfield mask)
+{
+ // Sync the draw framebuffer manually after the clear attachments.
+ ASSERT(mClearDirtyObjects.none());
+ ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearAttachmentsInitialized(this, mask));
+ ANGLE_TRY(mState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER));
+ ANGLE_TRY(syncDirtyBits(mClearDirtyBits));
+ return angle::Result::Continue;
+}
+
+angle::Result Context::prepareForClearBuffer(GLenum buffer, GLint drawbuffer)
+{
+ // Sync the draw framebuffer manually after the clear attachments.
+ ASSERT(mClearDirtyObjects.none());
+ ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearBufferAttachmentsInitialized(this, buffer,
+ drawbuffer));
+ ANGLE_TRY(mState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER));
+ ANGLE_TRY(syncDirtyBits(mClearDirtyBits));
+ return angle::Result::Continue;
+}
+
+ANGLE_INLINE angle::Result Context::prepareForDispatch()
+{
+ ANGLE_TRY(syncDirtyObjects(mComputeDirtyObjects));
+ return syncDirtyBits(mComputeDirtyBits);
+}
+
+angle::Result Context::syncState(const State::DirtyBits &bitMask,
+ const State::DirtyObjects &objectMask)
+{
+ ANGLE_TRY(syncDirtyObjects(objectMask));
+ ANGLE_TRY(syncDirtyBits(bitMask));
+ return angle::Result::Continue;
+}
+
+void Context::blitFramebuffer(GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ if (mask == 0)
+ {
+ // ES3.0 spec, section 4.3.2 specifies that a mask of zero is valid and no
+ // buffers are copied.
+ return;
+ }
+
+ Framebuffer *drawFramebuffer = mState.getDrawFramebuffer();
+ ASSERT(drawFramebuffer);
+
+ Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
+ Rectangle dstArea(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
+
+ if (dstArea.width == 0 || dstArea.height == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(syncStateForBlit());
+
+ ANGLE_CONTEXT_TRY(drawFramebuffer->blit(this, srcArea, dstArea, mask, filter));
+}
+
+void Context::clear(GLbitfield mask)
+{
+ ANGLE_CONTEXT_TRY(prepareForClear(mask));
+ ANGLE_CONTEXT_TRY(mState.getDrawFramebuffer()->clear(this, mask));
+}
+
+void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values)
+{
+ Framebuffer *framebufferObject = mState.getDrawFramebuffer();
+ const FramebufferAttachment *attachment = nullptr;
+ if (buffer == GL_DEPTH)
+ {
+ attachment = framebufferObject->getDepthAttachment();
+ }
+ if (buffer == GL_COLOR &&
+ static_cast<size_t>(drawbuffer) < framebufferObject->getNumColorAttachments())
+ {
+ attachment = framebufferObject->getColorAttachment(drawbuffer);
+ }
+ // It's not an error to try to clear a non-existent buffer, but it's a no-op. We early out so
+ // that the backend doesn't need to take this case into account.
+ if (!attachment)
+ {
+ return;
+ }
+ ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer));
+ ANGLE_CONTEXT_TRY(framebufferObject->clearBufferfv(this, buffer, drawbuffer, values));
+}
+
+void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values)
+{
+ Framebuffer *framebufferObject = mState.getDrawFramebuffer();
+ const FramebufferAttachment *attachment = nullptr;
+ if (buffer == GL_COLOR &&
+ static_cast<size_t>(drawbuffer) < framebufferObject->getNumColorAttachments())
+ {
+ attachment = framebufferObject->getColorAttachment(drawbuffer);
+ }
+ // It's not an error to try to clear a non-existent buffer, but it's a no-op. We early out so
+ // that the backend doesn't need to take this case into account.
+ if (!attachment)
+ {
+ return;
+ }
+ ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer));
+ ANGLE_CONTEXT_TRY(framebufferObject->clearBufferuiv(this, buffer, drawbuffer, values));
+}
+
+void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values)
+{
+ Framebuffer *framebufferObject = mState.getDrawFramebuffer();
+ const FramebufferAttachment *attachment = nullptr;
+ if (buffer == GL_STENCIL)
+ {
+ attachment = framebufferObject->getStencilAttachment();
+ }
+ if (buffer == GL_COLOR &&
+ static_cast<size_t>(drawbuffer) < framebufferObject->getNumColorAttachments())
+ {
+ attachment = framebufferObject->getColorAttachment(drawbuffer);
+ }
+ // It's not an error to try to clear a non-existent buffer, but it's a no-op. We early out so
+ // that the backend doesn't need to take this case into account.
+ if (!attachment)
+ {
+ return;
+ }
+ ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer));
+ ANGLE_CONTEXT_TRY(framebufferObject->clearBufferiv(this, buffer, drawbuffer, values));
+}
+
+void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+ Framebuffer *framebufferObject = mState.getDrawFramebuffer();
+ ASSERT(framebufferObject);
+
+ // If a buffer is not present, the clear has no effect
+ if (framebufferObject->getDepthAttachment() == nullptr &&
+ framebufferObject->getStencilAttachment() == nullptr)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer));
+ ANGLE_CONTEXT_TRY(framebufferObject->clearBufferfi(this, buffer, drawbuffer, depth, stencil));
+}
+
+void Context::readPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(syncStateForReadPixels());
+
+ Framebuffer *readFBO = mState.getReadFramebuffer();
+ ASSERT(readFBO);
+
+ Rectangle area(x, y, width, height);
+ ANGLE_CONTEXT_TRY(readFBO->readPixels(this, area, format, type, pixels));
+}
+
+void Context::readPixelsRobust(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels)
+{
+ readPixels(x, y, width, height, format, type, pixels);
+}
+
+void Context::readnPixelsRobust(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data)
+{
+ readPixels(x, y, width, height, format, type, data);
+}
+
+void Context::copyTexImage2D(TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ ANGLE_CONTEXT_TRY(mState.syncDirtyObjects(this, mCopyImageDirtyObjects));
+
+ Rectangle sourceArea(x, y, width, height);
+
+ Framebuffer *framebuffer = mState.getReadFramebuffer();
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(
+ texture->copyImage(this, target, level, sourceArea, internalformat, framebuffer));
+}
+
+void Context::copyTexSubImage2D(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(mState.syncDirtyObjects(this, mCopyImageDirtyObjects));
+
+ Offset destOffset(xoffset, yoffset, 0);
+ Rectangle sourceArea(x, y, width, height);
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, 1);
+
+ Framebuffer *framebuffer = mState.getReadFramebuffer();
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->copySubImage(this, index, destOffset, sourceArea, framebuffer));
+}
+
+void Context::copyTexSubImage3D(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(mState.syncDirtyObjects(this, mCopyImageDirtyObjects));
+
+ Offset destOffset(xoffset, yoffset, zoffset);
+ Rectangle sourceArea(x, y, width, height);
+
+ ImageIndex index = ImageIndex::MakeFromType(TextureTargetToType(target), level, zoffset);
+
+ Framebuffer *framebuffer = mState.getReadFramebuffer();
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->copySubImage(this, index, destOffset, sourceArea, framebuffer));
+}
+
+void Context::framebufferTexture2D(GLenum target,
+ GLenum attachment,
+ TextureTarget textarget,
+ GLuint texture,
+ GLint level)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (texture != 0)
+ {
+ Texture *textureObj = getTexture(texture);
+ ImageIndex index = ImageIndex::MakeFromTarget(textarget, level, 1);
+ framebuffer->setAttachment(this, GL_TEXTURE, attachment, index, textureObj);
+ }
+ else
+ {
+ framebuffer->resetAttachment(this, attachment);
+ }
+
+ mState.setObjectDirty(target);
+}
+
+void Context::framebufferTexture3D(GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::framebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (renderbuffer != 0)
+ {
+ Renderbuffer *renderbufferObject = getRenderbuffer(renderbuffer);
+
+ framebuffer->setAttachment(this, GL_RENDERBUFFER, attachment, gl::ImageIndex(),
+ renderbufferObject);
+ }
+ else
+ {
+ framebuffer->resetAttachment(this, attachment);
+ }
+
+ mState.setObjectDirty(target);
+}
+
+void Context::framebufferTextureLayer(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (texture != 0)
+ {
+ Texture *textureObject = getTexture(texture);
+ ImageIndex index = ImageIndex::MakeFromType(textureObject->getType(), level, layer);
+ framebuffer->setAttachment(this, GL_TEXTURE, attachment, index, textureObject);
+ }
+ else
+ {
+ framebuffer->resetAttachment(this, attachment);
+ }
+
+ mState.setObjectDirty(target);
+}
+
+void Context::framebufferTextureMultiview(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (texture != 0)
+ {
+ Texture *textureObj = getTexture(texture);
+
+ ImageIndex index;
+ if (textureObj->getType() == TextureType::_2DArray)
+ {
+ index = ImageIndex::Make2DArrayRange(level, baseViewIndex, numViews);
+ }
+ else
+ {
+ ASSERT(textureObj->getType() == TextureType::_2DMultisampleArray);
+ ASSERT(level == 0);
+ index = ImageIndex::Make2DMultisampleArrayRange(baseViewIndex, numViews);
+ }
+ framebuffer->setAttachmentMultiview(this, GL_TEXTURE, attachment, index, textureObj,
+ numViews, baseViewIndex);
+ }
+ else
+ {
+ framebuffer->resetAttachment(this, attachment);
+ }
+
+ mState.setObjectDirty(target);
+}
+
+void Context::framebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (texture != 0)
+ {
+ Texture *textureObj = getTexture(texture);
+
+ ImageIndex index = ImageIndex::MakeFromType(
+ textureObj->getType(), level, ImageIndex::kEntireLevel, ImageIndex::kEntireLevel);
+ framebuffer->setAttachment(this, GL_TEXTURE, attachment, index, textureObj);
+ }
+ else
+ {
+ framebuffer->resetAttachment(this, attachment);
+ }
+
+ mState.setObjectDirty(target);
+}
+
+void Context::drawBuffers(GLsizei n, const GLenum *bufs)
+{
+ Framebuffer *framebuffer = mState.getDrawFramebuffer();
+ ASSERT(framebuffer);
+ framebuffer->setDrawBuffers(n, bufs);
+ mState.setDrawFramebufferDirty();
+ mStateCache.onDrawFramebufferChange(this);
+}
+
+void Context::readBuffer(GLenum mode)
+{
+ Framebuffer *readFBO = mState.getReadFramebuffer();
+ readFBO->setReadBuffer(mode);
+ mState.setObjectDirty(GL_READ_FRAMEBUFFER);
+}
+
+void Context::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
+{
+ // Only sync the FBO
+ ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, target));
+
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ // The specification isn't clear what should be done when the framebuffer isn't complete.
+ // We leave it up to the framebuffer implementation to decide what to do.
+ ANGLE_CONTEXT_TRY(framebuffer->discard(this, numAttachments, attachments));
+}
+
+void Context::invalidateFramebuffer(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ // Only sync the FBO
+ ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, target));
+
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (!framebuffer->isComplete(this))
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(framebuffer->invalidate(this, numAttachments, attachments));
+}
+
+void Context::invalidateSubFramebuffer(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ // Only sync the FBO
+ ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, target));
+
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (!framebuffer->isComplete(this))
+ {
+ return;
+ }
+
+ Rectangle area(x, y, width, height);
+ ANGLE_CONTEXT_TRY(framebuffer->invalidateSub(this, numAttachments, attachments, area));
+}
+
+void Context::texImage2D(TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Extents size(width, height, 1);
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->setImage(this, mState.getUnpackState(), target, level,
+ internalformat, size, format, type,
+ static_cast<const uint8_t *>(pixels)));
+}
+
+void Context::texImage2DRobust(TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ texImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+}
+
+void Context::texImage3D(TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Extents size(width, height, depth);
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->setImage(this, mState.getUnpackState(), target, level,
+ internalformat, size, format, type,
+ static_cast<const uint8_t *>(pixels)));
+}
+
+void Context::texImage3DRobust(TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ texImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
+}
+
+void Context::texSubImage2D(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Box area(xoffset, yoffset, 0, width, height, 1);
+ Texture *texture = getTextureByTarget(target);
+
+ gl::Buffer *unpackBuffer = mState.getTargetBuffer(gl::BufferBinding::PixelUnpack);
+
+ ANGLE_CONTEXT_TRY(texture->setSubImage(this, mState.getUnpackState(), unpackBuffer, target,
+ level, area, format, type,
+ static_cast<const uint8_t *>(pixels)));
+}
+
+void Context::texSubImage2DRobust(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+
+void Context::texSubImage3D(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0 || depth == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Box area(xoffset, yoffset, zoffset, width, height, depth);
+ Texture *texture = getTextureByTarget(target);
+
+ gl::Buffer *unpackBuffer = mState.getTargetBuffer(gl::BufferBinding::PixelUnpack);
+
+ ANGLE_CONTEXT_TRY(texture->setSubImage(this, mState.getUnpackState(), unpackBuffer, target,
+ level, area, format, type,
+ static_cast<const uint8_t *>(pixels)));
+}
+
+void Context::texSubImage3DRobust(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type,
+ pixels);
+}
+
+void Context::compressedTexImage2D(TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Extents size(width, height, 1);
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, mState.getUnpackState(), target, level,
+ internalformat, size, imageSize,
+ static_cast<const uint8_t *>(data)));
+}
+
+void Context::compressedTexImage2DRobust(TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+}
+
+void Context::compressedTexImage3D(TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Extents size(width, height, depth);
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, mState.getUnpackState(), target, level,
+ internalformat, size, imageSize,
+ static_cast<const uint8_t *>(data)));
+}
+
+void Context::compressedTexImage3DRobust(TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ compressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize,
+ data);
+}
+
+void Context::compressedTexSubImage2D(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Box area(xoffset, yoffset, 0, width, height, 1);
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, mState.getUnpackState(), target, level,
+ area, format, imageSize,
+ static_cast<const uint8_t *>(data)));
+}
+
+void Context::compressedTexSubImage2DRobust(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize,
+ data);
+}
+
+void Context::compressedTexSubImage3D(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ // Zero sized uploads are valid but no-ops
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Box area(xoffset, yoffset, zoffset, width, height, depth);
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, mState.getUnpackState(), target, level,
+ area, format, imageSize,
+ static_cast<const uint8_t *>(data)));
+}
+
+void Context::compressedTexSubImage3DRobust(TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format,
+ imageSize, data);
+}
+
+void Context::generateMipmap(TextureType target)
+{
+ Texture *texture = getTextureByType(target);
+ ANGLE_CONTEXT_TRY(texture->generateMipmap(this));
+}
+
+void Context::copyTexture(GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ gl::Texture *sourceTexture = getTexture(sourceId);
+ gl::Texture *destTexture = getTexture(destId);
+ ANGLE_CONTEXT_TRY(
+ destTexture->copyTexture(this, destTarget, destLevel, internalFormat, destType, sourceLevel,
+ ConvertToBool(unpackFlipY), ConvertToBool(unpackPremultiplyAlpha),
+ ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
+}
+
+void Context::copySubTexture(GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ // Zero sized copies are valid but no-ops
+ if (width == 0 || height == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ gl::Texture *sourceTexture = getTexture(sourceId);
+ gl::Texture *destTexture = getTexture(destId);
+ Offset offset(xoffset, yoffset, 0);
+ Box box(x, y, 0, width, height, 1);
+ ANGLE_CONTEXT_TRY(destTexture->copySubTexture(
+ this, destTarget, destLevel, offset, sourceLevel, box, ConvertToBool(unpackFlipY),
+ ConvertToBool(unpackPremultiplyAlpha), ConvertToBool(unpackUnmultiplyAlpha),
+ sourceTexture));
+}
+
+void Context::copyTexture3D(GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Texture *sourceTexture = getTexture(sourceId);
+ Texture *destTexture = getTexture(destId);
+ ANGLE_CONTEXT_TRY(
+ destTexture->copyTexture(this, destTarget, destLevel, internalFormat, destType, sourceLevel,
+ ConvertToBool(unpackFlipY), ConvertToBool(unpackPremultiplyAlpha),
+ ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
+}
+
+void Context::copySubTexture3D(GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ // Zero sized copies are valid but no-ops
+ if (width == 0 || height == 0 || depth == 0)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ Texture *sourceTexture = getTexture(sourceId);
+ Texture *destTexture = getTexture(destId);
+ Offset offset(xoffset, yoffset, zoffset);
+ Box box(x, y, z, width, height, depth);
+ ANGLE_CONTEXT_TRY(destTexture->copySubTexture(
+ this, destTarget, destLevel, offset, sourceLevel, box, ConvertToBool(unpackFlipY),
+ ConvertToBool(unpackPremultiplyAlpha), ConvertToBool(unpackUnmultiplyAlpha),
+ sourceTexture));
+}
+
+void Context::compressedCopyTexture(GLuint sourceId, GLuint destId)
+{
+ ANGLE_CONTEXT_TRY(syncStateForTexImage());
+
+ gl::Texture *sourceTexture = getTexture(sourceId);
+ gl::Texture *destTexture = getTexture(destId);
+ ANGLE_CONTEXT_TRY(destTexture->copyCompressedTexture(this, sourceTexture));
+}
+
+void Context::getBufferPointerv(BufferBinding target, GLenum pname, void **params)
+{
+ Buffer *buffer = mState.getTargetBuffer(target);
+ ASSERT(buffer);
+
+ QueryBufferPointerv(buffer, pname, params);
+}
+
+void Context::getBufferPointervRobust(BufferBinding target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ getBufferPointerv(target, pname, params);
+}
+
+void *Context::mapBuffer(BufferBinding target, GLenum access)
+{
+ Buffer *buffer = mState.getTargetBuffer(target);
+ ASSERT(buffer);
+
+ if (buffer->map(this, access) == angle::Result::Stop)
+ {
+ return nullptr;
+ }
+
+ return buffer->getMapPointer();
+}
+
+GLboolean Context::unmapBuffer(BufferBinding target)
+{
+ Buffer *buffer = mState.getTargetBuffer(target);
+ ASSERT(buffer);
+
+ GLboolean result;
+ if (buffer->unmap(this, &result) == angle::Result::Stop)
+ {
+ return GL_FALSE;
+ }
+
+ return result;
+}
+
+void *Context::mapBufferRange(BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ Buffer *buffer = mState.getTargetBuffer(target);
+ ASSERT(buffer);
+
+ if (buffer->mapRange(this, offset, length, access) == angle::Result::Stop)
+ {
+ return nullptr;
+ }
+
+ return buffer->getMapPointer();
+}
+
+void Context::flushMappedBufferRange(BufferBinding /*target*/,
+ GLintptr /*offset*/,
+ GLsizeiptr /*length*/)
+{
+ // We do not currently support a non-trivial implementation of FlushMappedBufferRange
+}
+
+angle::Result Context::syncStateForReadPixels()
+{
+ return syncState(mReadPixelsDirtyBits, mReadPixelsDirtyObjects);
+}
+
+angle::Result Context::syncStateForTexImage()
+{
+ return syncState(mTexImageDirtyBits, mTexImageDirtyObjects);
+}
+
+angle::Result Context::syncStateForBlit()
+{
+ return syncState(mBlitDirtyBits, mBlitDirtyObjects);
+}
+
+angle::Result Context::syncStateForPathOperation()
+{
+ ANGLE_TRY(syncDirtyObjects(mPathOperationDirtyObjects));
+
+ // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
+ ANGLE_TRY(syncDirtyBits());
+
+ return angle::Result::Continue;
+}
+
+void Context::activeShaderProgram(GLuint pipeline, GLuint program)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::activeTexture(GLenum texture)
+{
+ mState.setActiveSampler(texture - GL_TEXTURE0);
+}
+
+void Context::blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ /* EXT_color_buffer_half_float:
+ Modify Section 4.1.6 (Blending), p. 96
+
+ (modify second paragraph, p. 96) [...]
+
+ If the color buffer is fixed-point, the components of the source and
+ destination values and blend factors are clamped to [0, 1] prior to
+ evaluating the blend equation. If the color buffer is floating-point, no
+ clamping occurs. The resulting four values are sent to the next operation.
+ */
+ /* EXT_color_buffer_float:
+ 4.1.7 Blending, p.177 (section 15.1.7 p.315 in ES 3.1)
+
+ Modify paragraphs 3 & 4:
+
+ * "If the color buffer is fixed-point, the components of the
+ source and destination values and blend factors are clamped
+ * to [0; 1] prior to evaluating the blend equation. If the color
+ + buffer is floating-point, no clamping occurs. The resulting four
+ + values are sent to the next operation.
+ */
+ // Fortunately, (at least) GL and D3D11 have this same behavior, so there's nothing special we
+ // need to do there. If any backend /doesn't/ do this (does Vulkan?), it will need to do
+ // clamping based on the pipeline formats.
+ const auto &exts = mState.mExtensions;
+ const bool hasFloatBlending = exts.colorBufferFloat || exts.colorBufferHalfFloat ||
+ exts.colorBufferFloatRGB || exts.colorBufferFloatRGBA;
+ if (!hasFloatBlending)
+ {
+ red = clamp01(red);
+ green = clamp01(green);
+ blue = clamp01(blue);
+ alpha = clamp01(alpha);
+ }
+
+ mState.setBlendColor(red, green, blue, alpha);
+}
+
+void Context::blendEquation(GLenum mode)
+{
+ mState.setBlendEquation(mode, mode);
+}
+
+void Context::blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+ mState.setBlendEquation(modeRGB, modeAlpha);
+}
+
+void Context::blendFunc(GLenum sfactor, GLenum dfactor)
+{
+ mState.setBlendFactors(sfactor, dfactor, sfactor, dfactor);
+}
+
+void Context::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+ mState.setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+
+void Context::clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ mState.setColorClearValue(red, green, blue, alpha);
+}
+
+void Context::clearDepthf(GLfloat depth)
+{
+ mState.setDepthClearValue(clamp01(depth));
+}
+
+void Context::clearStencil(GLint s)
+{
+ mState.setStencilClearValue(s);
+}
+
+void Context::colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ mState.setColorMask(ConvertToBool(red), ConvertToBool(green), ConvertToBool(blue),
+ ConvertToBool(alpha));
+ mStateCache.onColorMaskChange(this);
+}
+
+void Context::cullFace(CullFaceMode mode)
+{
+ mState.setCullMode(mode);
+}
+
+void Context::depthFunc(GLenum func)
+{
+ mState.setDepthFunc(func);
+}
+
+void Context::depthMask(GLboolean flag)
+{
+ mState.setDepthMask(ConvertToBool(flag));
+}
+
+void Context::depthRangef(GLfloat zNear, GLfloat zFar)
+{
+ mState.setDepthRange(clamp01(zNear), clamp01(zFar));
+}
+
+void Context::disable(GLenum cap)
+{
+ mState.setEnableFeature(cap, false);
+ mStateCache.onContextCapChange(this);
+}
+
+void Context::disableVertexAttribArray(GLuint index)
+{
+ mState.setEnableVertexAttribArray(index, false);
+ mStateCache.onVertexArrayStateChange(this);
+}
+
+void Context::enable(GLenum cap)
+{
+ mState.setEnableFeature(cap, true);
+ mStateCache.onContextCapChange(this);
+}
+
+void Context::enableVertexAttribArray(GLuint index)
+{
+ mState.setEnableVertexAttribArray(index, true);
+ mStateCache.onVertexArrayStateChange(this);
+}
+
+void Context::frontFace(GLenum mode)
+{
+ mState.setFrontFace(mode);
+}
+
+void Context::hint(GLenum target, GLenum mode)
+{
+ switch (target)
+ {
+ case GL_GENERATE_MIPMAP_HINT:
+ mState.setGenerateMipmapHint(mode);
+ break;
+
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+ mState.setFragmentShaderDerivativeHint(mode);
+ break;
+
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ case GL_POINT_SMOOTH_HINT:
+ case GL_LINE_SMOOTH_HINT:
+ case GL_FOG_HINT:
+ mState.gles1().setHint(target, mode);
+ break;
+ default:
+ UNREACHABLE();
+ return;
+ }
+}
+
+void Context::lineWidth(GLfloat width)
+{
+ mState.setLineWidth(width);
+}
+
+void Context::pixelStorei(GLenum pname, GLint param)
+{
+ switch (pname)
+ {
+ case GL_UNPACK_ALIGNMENT:
+ mState.setUnpackAlignment(param);
+ break;
+
+ case GL_PACK_ALIGNMENT:
+ mState.setPackAlignment(param);
+ break;
+
+ case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
+ mState.setPackReverseRowOrder(param != 0);
+ break;
+
+ case GL_UNPACK_ROW_LENGTH:
+ ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
+ mState.setUnpackRowLength(param);
+ break;
+
+ case GL_UNPACK_IMAGE_HEIGHT:
+ ASSERT(getClientMajorVersion() >= 3);
+ mState.setUnpackImageHeight(param);
+ break;
+
+ case GL_UNPACK_SKIP_IMAGES:
+ ASSERT(getClientMajorVersion() >= 3);
+ mState.setUnpackSkipImages(param);
+ break;
+
+ case GL_UNPACK_SKIP_ROWS:
+ ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
+ mState.setUnpackSkipRows(param);
+ break;
+
+ case GL_UNPACK_SKIP_PIXELS:
+ ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
+ mState.setUnpackSkipPixels(param);
+ break;
+
+ case GL_PACK_ROW_LENGTH:
+ ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
+ mState.setPackRowLength(param);
+ break;
+
+ case GL_PACK_SKIP_ROWS:
+ ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
+ mState.setPackSkipRows(param);
+ break;
+
+ case GL_PACK_SKIP_PIXELS:
+ ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
+ mState.setPackSkipPixels(param);
+ break;
+
+ default:
+ UNREACHABLE();
+ return;
+ }
+}
+
+void Context::polygonOffset(GLfloat factor, GLfloat units)
+{
+ mState.setPolygonOffsetParams(factor, units);
+}
+
+void Context::sampleCoverage(GLfloat value, GLboolean invert)
+{
+ mState.setSampleCoverageParams(clamp01(value), ConvertToBool(invert));
+}
+
+void Context::sampleMaski(GLuint maskNumber, GLbitfield mask)
+{
+ mState.setSampleMaskParams(maskNumber, mask);
+}
+
+void Context::scissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ mState.setScissorParams(x, y, width, height);
+}
+
+void Context::stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ mState.setStencilParams(func, ref, mask);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ mState.setStencilBackParams(func, ref, mask);
+ }
+
+ mStateCache.onStencilStateChange(this);
+}
+
+void Context::stencilMaskSeparate(GLenum face, GLuint mask)
+{
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ mState.setStencilWritemask(mask);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ mState.setStencilBackWritemask(mask);
+ }
+
+ mStateCache.onStencilStateChange(this);
+}
+
+void Context::stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+ {
+ mState.setStencilOperations(fail, zfail, zpass);
+ }
+
+ if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+ {
+ mState.setStencilBackOperations(fail, zfail, zpass);
+ }
+}
+
+void Context::vertexAttrib1f(GLuint index, GLfloat x)
+{
+ GLfloat vals[4] = {x, 0, 0, 1};
+ mState.setVertexAttribf(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttrib1fv(GLuint index, const GLfloat *values)
+{
+ GLfloat vals[4] = {values[0], 0, 0, 1};
+ mState.setVertexAttribf(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+ GLfloat vals[4] = {x, y, 0, 1};
+ mState.setVertexAttribf(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttrib2fv(GLuint index, const GLfloat *values)
+{
+ GLfloat vals[4] = {values[0], values[1], 0, 1};
+ mState.setVertexAttribf(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ GLfloat vals[4] = {x, y, z, 1};
+ mState.setVertexAttribf(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttrib3fv(GLuint index, const GLfloat *values)
+{
+ GLfloat vals[4] = {values[0], values[1], values[2], 1};
+ mState.setVertexAttribf(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GLfloat vals[4] = {x, y, z, w};
+ mState.setVertexAttribf(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttrib4fv(GLuint index, const GLfloat *values)
+{
+ mState.setVertexAttribf(index, values);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttribPointer(GLuint index,
+ GLint size,
+ VertexAttribType type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *ptr)
+{
+ mState.setVertexAttribPointer(this, index, mState.getTargetBuffer(BufferBinding::Array), size,
+ type, ConvertToBool(normalized), stride, ptr);
+ mStateCache.onVertexArrayStateChange(this);
+}
+
+void Context::vertexAttribFormat(GLuint attribIndex,
+ GLint size,
+ VertexAttribType type,
+ GLboolean normalized,
+ GLuint relativeOffset)
+{
+ mState.setVertexAttribFormat(attribIndex, size, type, ConvertToBool(normalized), false,
+ relativeOffset);
+ mStateCache.onVertexArrayFormatChange(this);
+}
+
+void Context::vertexAttribIFormat(GLuint attribIndex,
+ GLint size,
+ VertexAttribType type,
+ GLuint relativeOffset)
+{
+ mState.setVertexAttribFormat(attribIndex, size, type, false, true, relativeOffset);
+ mStateCache.onVertexArrayFormatChange(this);
+}
+
+void Context::vertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
+{
+ mState.setVertexAttribBinding(this, attribIndex, bindingIndex);
+ mStateCache.onVertexArrayStateChange(this);
+}
+
+void Context::vertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
+{
+ mState.setVertexBindingDivisor(bindingIndex, divisor);
+ mStateCache.onVertexArrayFormatChange(this);
+}
+
+void Context::viewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ mState.setViewportParams(x, y, width, height);
+}
+
+void Context::vertexAttribIPointer(GLuint index,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ mState.setVertexAttribIPointer(this, index, mState.getTargetBuffer(BufferBinding::Array), size,
+ type, stride, pointer);
+ mStateCache.onVertexArrayStateChange(this);
+}
+
+void Context::vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+ GLint vals[4] = {x, y, z, w};
+ mState.setVertexAttribi(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+ GLuint vals[4] = {x, y, z, w};
+ mState.setVertexAttribu(index, vals);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttribI4iv(GLuint index, const GLint *v)
+{
+ mState.setVertexAttribi(index, v);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::vertexAttribI4uiv(GLuint index, const GLuint *v)
+{
+ mState.setVertexAttribu(index, v);
+ mStateCache.onDefaultVertexAttributeChange(this);
+}
+
+void Context::getVertexAttribiv(GLuint index, GLenum pname, GLint *params)
+{
+ const VertexAttribCurrentValueData &currentValues =
+ getState().getVertexAttribCurrentValue(index);
+ const VertexArray *vao = getState().getVertexArray();
+ QueryVertexAttribiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
+ currentValues, pname, params);
+}
+
+void Context::getVertexAttribivRobust(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getVertexAttribiv(index, pname, params);
+}
+
+void Context::getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
+{
+ const VertexAttribCurrentValueData &currentValues =
+ getState().getVertexAttribCurrentValue(index);
+ const VertexArray *vao = getState().getVertexArray();
+ QueryVertexAttribfv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
+ currentValues, pname, params);
+}
+
+void Context::getVertexAttribfvRobust(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ getVertexAttribfv(index, pname, params);
+}
+
+void Context::getVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
+{
+ const VertexAttribCurrentValueData &currentValues =
+ getState().getVertexAttribCurrentValue(index);
+ const VertexArray *vao = getState().getVertexArray();
+ QueryVertexAttribIiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
+ currentValues, pname, params);
+}
+
+void Context::getVertexAttribIivRobust(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getVertexAttribIiv(index, pname, params);
+}
+
+void Context::getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
+{
+ const VertexAttribCurrentValueData &currentValues =
+ getState().getVertexAttribCurrentValue(index);
+ const VertexArray *vao = getState().getVertexArray();
+ QueryVertexAttribIuiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
+ currentValues, pname, params);
+}
+
+void Context::getVertexAttribIuivRobust(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ getVertexAttribIuiv(index, pname, params);
+}
+
+void Context::getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
+{
+ const VertexAttribute &attrib = getState().getVertexArray()->getVertexAttribute(index);
+ QueryVertexAttribPointerv(attrib, pname, pointer);
+}
+
+void Context::getVertexAttribPointervRobust(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer)
+{
+ getVertexAttribPointerv(index, pname, pointer);
+}
+
+void Context::debugMessageControl(GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled)
+{
+ std::vector<GLuint> idVector(ids, ids + count);
+ mState.getDebug().setMessageControl(source, type, severity, std::move(idVector),
+ ConvertToBool(enabled));
+}
+
+void Context::debugMessageInsert(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf)
+{
+ std::string msg(buf, (length > 0) ? static_cast<size_t>(length) : strlen(buf));
+ mState.getDebug().insertMessage(source, type, id, severity, std::move(msg), gl::LOG_INFO);
+}
+
+void Context::debugMessageCallback(GLDEBUGPROCKHR callback, const void *userParam)
+{
+ mState.getDebug().setCallback(callback, userParam);
+}
+
+GLuint Context::getDebugMessageLog(GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ return static_cast<GLuint>(mState.getDebug().getMessages(count, bufSize, sources, types, ids,
+ severities, lengths, messageLog));
+}
+
+void Context::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
+{
+ std::string msg(message, (length > 0) ? static_cast<size_t>(length) : strlen(message));
+ mImplementation->pushDebugGroup(source, id, msg);
+ mState.getDebug().pushGroup(source, id, std::move(msg));
+}
+
+void Context::popDebugGroup()
+{
+ mState.getDebug().popGroup();
+ mImplementation->popDebugGroup();
+}
+
+void Context::bufferData(BufferBinding target, GLsizeiptr size, const void *data, BufferUsage usage)
+{
+ Buffer *buffer = mState.getTargetBuffer(target);
+ ASSERT(buffer);
+ ANGLE_CONTEXT_TRY(buffer->bufferData(this, target, data, size, usage));
+}
+
+void Context::bufferSubData(BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data)
+{
+ if (data == nullptr || size == 0)
+ {
+ return;
+ }
+
+ Buffer *buffer = mState.getTargetBuffer(target);
+ ASSERT(buffer);
+ ANGLE_CONTEXT_TRY(buffer->bufferSubData(this, target, data, size, offset));
+}
+
+void Context::attachShader(GLuint program, GLuint shader)
+{
+ Program *programObject = mState.mShaderProgramManager->getProgram(program);
+ Shader *shaderObject = mState.mShaderProgramManager->getShader(shader);
+ ASSERT(programObject && shaderObject);
+ programObject->attachShader(shaderObject);
+}
+
+void Context::copyBufferSubData(BufferBinding readTarget,
+ BufferBinding writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ // if size is zero, the copy is a successful no-op
+ if (size == 0)
+ {
+ return;
+ }
+
+ // TODO(jmadill): cache these.
+ Buffer *readBuffer = mState.getTargetBuffer(readTarget);
+ Buffer *writeBuffer = mState.getTargetBuffer(writeTarget);
+
+ ANGLE_CONTEXT_TRY(
+ writeBuffer->copyBufferSubData(this, readBuffer, readOffset, writeOffset, size));
+}
+
+void Context::bindAttribLocation(GLuint program, GLuint index, const GLchar *name)
+{
+ // Ideally we could share the program query with the validation layer if possible.
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->bindAttributeLocation(index, name);
+}
+
+void Context::bindBufferBase(BufferBinding target, GLuint index, GLuint buffer)
+{
+ bindBufferRange(target, index, buffer, 0, 0);
+}
+
+void Context::bindBufferRange(BufferBinding target,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ Buffer *object = mState.mBufferManager->checkBufferAllocation(mImplementation.get(), buffer);
+ ANGLE_CONTEXT_TRY(mState.setIndexedBufferBinding(this, target, index, object, offset, size));
+ if (target == BufferBinding::Uniform)
+ {
+ mUniformBufferObserverBindings[index].bind(object);
+ mStateCache.onUniformBufferStateChange(this);
+ }
+ else
+ {
+ mStateCache.onBufferBindingChange(this);
+ }
+}
+
+void Context::bindFramebuffer(GLenum target, GLuint framebuffer)
+{
+ if (target == GL_READ_FRAMEBUFFER || target == GL_FRAMEBUFFER)
+ {
+ bindReadFramebuffer(framebuffer);
+ }
+
+ if (target == GL_DRAW_FRAMEBUFFER || target == GL_FRAMEBUFFER)
+ {
+ bindDrawFramebuffer(framebuffer);
+ }
+}
+
+void Context::bindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+ ASSERT(target == GL_RENDERBUFFER);
+ Renderbuffer *object = mState.mRenderbufferManager->checkRenderbufferAllocation(
+ mImplementation.get(), renderbuffer);
+ mState.setRenderbufferBinding(this, object);
+}
+
+void Context::texStorage2DMultisample(TextureType target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ Extents size(width, height, 1);
+ Texture *texture = getTextureByType(target);
+ ANGLE_CONTEXT_TRY(texture->setStorageMultisample(this, target, samples, internalformat, size,
+ ConvertToBool(fixedsamplelocations)));
+}
+
+void Context::texStorage3DMultisample(TextureType target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ Extents size(width, height, depth);
+ Texture *texture = getTextureByType(target);
+ ANGLE_CONTEXT_TRY(texture->setStorageMultisample(this, target, samples, internalformat, size,
+ ConvertToBool(fixedsamplelocations)));
+}
+
+void Context::texImage2DExternal(TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type)
+{
+ Extents size(width, height, 1);
+ Texture *texture = getTextureByTarget(target);
+ ANGLE_CONTEXT_TRY(
+ texture->setImageExternal(this, target, level, internalformat, size, format, type));
+}
+
+void Context::invalidateTexture(TextureType target)
+{
+ mImplementation->invalidateTexture(target);
+ mState.invalidateTexture(target);
+}
+
+void Context::getMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
+{
+ // According to spec 3.1 Table 20.49: Framebuffer Dependent Values,
+ // the sample position should be queried by DRAW_FRAMEBUFFER.
+ ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER));
+ const Framebuffer *framebuffer = mState.getDrawFramebuffer();
+
+ switch (pname)
+ {
+ case GL_SAMPLE_POSITION:
+ ANGLE_CONTEXT_TRY(framebuffer->getSamplePosition(this, index, val));
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+void Context::getMultisamplefvRobust(GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::renderbufferStorage(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
+ GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
+
+ Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
+ ANGLE_CONTEXT_TRY(renderbuffer->setStorage(this, convertedInternalFormat, width, height));
+}
+
+void Context::renderbufferStorageMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
+ GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
+
+ Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
+ ANGLE_CONTEXT_TRY(
+ renderbuffer->setStorageMultisample(this, samples, convertedInternalFormat, width, height));
+}
+
+void Context::getSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
+{
+ const Sync *syncObject = nullptr;
+ if (!mContextLost)
+ {
+ syncObject = getSync(sync);
+ }
+ ANGLE_CONTEXT_TRY(QuerySynciv(this, syncObject, pname, bufSize, length, values));
+}
+
+void Context::getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ QueryFramebufferParameteriv(framebuffer, pname, params);
+}
+
+void Context::getFramebufferParameterivRobust(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ SetFramebufferParameteri(this, framebuffer, pname, param);
+}
+
+bool Context::getScratchBuffer(size_t requstedSizeBytes,
+ angle::MemoryBuffer **scratchBufferOut) const
+{
+ return mScratchBuffer.get(requstedSizeBytes, scratchBufferOut);
+}
+
+bool Context::getZeroFilledBuffer(size_t requstedSizeBytes,
+ angle::MemoryBuffer **zeroBufferOut) const
+{
+ return mZeroFilledBuffer.getInitialized(requstedSizeBytes, zeroBufferOut, 0);
+}
+
+void Context::dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ)
+{
+ if (numGroupsX == 0u || numGroupsY == 0u || numGroupsZ == 0u)
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(prepareForDispatch());
+ ANGLE_CONTEXT_TRY(mImplementation->dispatchCompute(this, numGroupsX, numGroupsY, numGroupsZ));
+}
+
+void Context::dispatchComputeIndirect(GLintptr indirect)
+{
+ ANGLE_CONTEXT_TRY(prepareForDispatch());
+ ANGLE_CONTEXT_TRY(mImplementation->dispatchComputeIndirect(this, indirect));
+}
+
+void Context::texStorage2D(TextureType target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height)
+{
+ Extents size(width, height, 1);
+ Texture *texture = getTextureByType(target);
+ ANGLE_CONTEXT_TRY(texture->setStorage(this, target, levels, internalFormat, size));
+}
+
+void Context::texStorage3D(TextureType target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ Extents size(width, height, depth);
+ Texture *texture = getTextureByType(target);
+ ANGLE_CONTEXT_TRY(texture->setStorage(this, target, levels, internalFormat, size));
+}
+
+void Context::memoryBarrier(GLbitfield barriers)
+{
+ ANGLE_CONTEXT_TRY(mImplementation->memoryBarrier(this, barriers));
+}
+
+void Context::memoryBarrierByRegion(GLbitfield barriers)
+{
+ ANGLE_CONTEXT_TRY(mImplementation->memoryBarrierByRegion(this, barriers));
+}
+
+void Context::multiDrawArrays(PrimitiveMode mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount)
+{
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ Program *programObject = mState.getLinkedProgram(this);
+ const bool hasDrawID = programObject && programObject->hasDrawIDUniform();
+ if (hasDrawID)
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDraw(mode, counts[drawID]))
+ {
+ continue;
+ }
+ programObject->setDrawIDUniform(drawID);
+ ANGLE_CONTEXT_TRY(
+ mImplementation->drawArrays(this, mode, firsts[drawID], counts[drawID]));
+ MarkTransformFeedbackBufferUsage(this, counts[drawID], 1);
+ }
+ }
+ else
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDraw(mode, counts[drawID]))
+ {
+ continue;
+ }
+ ANGLE_CONTEXT_TRY(
+ mImplementation->drawArrays(this, mode, firsts[drawID], counts[drawID]));
+ MarkTransformFeedbackBufferUsage(this, counts[drawID], 1);
+ }
+ }
+}
+
+void Context::multiDrawArraysInstanced(PrimitiveMode mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ Program *programObject = mState.getLinkedProgram(this);
+ const bool hasDrawID = programObject && programObject->hasDrawIDUniform();
+ if (hasDrawID)
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDrawInstanced(mode, counts[drawID], instanceCounts[drawID]))
+ {
+ continue;
+ }
+ programObject->setDrawIDUniform(drawID);
+ ANGLE_CONTEXT_TRY(mImplementation->drawArraysInstanced(
+ this, mode, firsts[drawID], counts[drawID], instanceCounts[drawID]));
+ MarkTransformFeedbackBufferUsage(this, counts[drawID], instanceCounts[drawID]);
+ }
+ }
+ else
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDrawInstanced(mode, counts[drawID], instanceCounts[drawID]))
+ {
+ continue;
+ }
+ ANGLE_CONTEXT_TRY(mImplementation->drawArraysInstanced(
+ this, mode, firsts[drawID], counts[drawID], instanceCounts[drawID]));
+ MarkTransformFeedbackBufferUsage(this, counts[drawID], instanceCounts[drawID]);
+ }
+ }
+}
+
+void Context::multiDrawElements(PrimitiveMode mode,
+ const GLsizei *counts,
+ DrawElementsType type,
+ const GLvoid *const *indices,
+ GLsizei drawcount)
+{
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ Program *programObject = mState.getLinkedProgram(this);
+ const bool hasDrawID = programObject && programObject->hasDrawIDUniform();
+ if (hasDrawID)
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDraw(mode, counts[drawID]))
+ {
+ continue;
+ }
+ programObject->setDrawIDUniform(drawID);
+ ANGLE_CONTEXT_TRY(
+ mImplementation->drawElements(this, mode, counts[drawID], type, indices[drawID]));
+ }
+ }
+ else
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDraw(mode, counts[drawID]))
+ {
+ continue;
+ }
+ ANGLE_CONTEXT_TRY(
+ mImplementation->drawElements(this, mode, counts[drawID], type, indices[drawID]));
+ }
+ }
+}
+
+void Context::multiDrawElementsInstanced(PrimitiveMode mode,
+ const GLsizei *counts,
+ DrawElementsType type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ Program *programObject = mState.getLinkedProgram(this);
+ const bool hasDrawID = programObject && programObject->hasDrawIDUniform();
+ if (hasDrawID)
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDrawInstanced(mode, counts[drawID], instanceCounts[drawID]))
+ {
+ continue;
+ }
+ programObject->setDrawIDUniform(drawID);
+ ANGLE_CONTEXT_TRY(mImplementation->drawElementsInstanced(
+ this, mode, counts[drawID], type, indices[drawID], instanceCounts[drawID]));
+ }
+ }
+ else
+ {
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (noopDrawInstanced(mode, counts[drawID], instanceCounts[drawID]))
+ {
+ continue;
+ }
+ ANGLE_CONTEXT_TRY(mImplementation->drawElementsInstanced(
+ this, mode, counts[drawID], type, indices[drawID], instanceCounts[drawID]));
+ }
+ }
+}
+
+void Context::provokingVertex(ProvokingVertexConvention provokeMode)
+{
+ mState.setProvokingVertex(provokeMode);
+}
+
+GLenum Context::checkFramebufferStatus(GLenum target)
+{
+ Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+ return framebuffer->checkStatus(this);
+}
+
+void Context::compileShader(GLuint shader)
+{
+ Shader *shaderObject = GetValidShader(this, shader);
+ if (!shaderObject)
+ {
+ return;
+ }
+ shaderObject->compile(this);
+}
+
+void Context::deleteBuffers(GLsizei n, const GLuint *buffers)
+{
+ for (int i = 0; i < n; i++)
+ {
+ deleteBuffer(buffers[i]);
+ }
+}
+
+void Context::deleteFramebuffers(GLsizei n, const GLuint *framebuffers)
+{
+ for (int i = 0; i < n; i++)
+ {
+ if (framebuffers[i] != 0)
+ {
+ deleteFramebuffer(framebuffers[i]);
+ }
+ }
+}
+
+void Context::deleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
+{
+ for (int i = 0; i < n; i++)
+ {
+ deleteRenderbuffer(renderbuffers[i]);
+ }
+}
+
+void Context::deleteTextures(GLsizei n, const GLuint *textures)
+{
+ for (int i = 0; i < n; i++)
+ {
+ if (textures[i] != 0)
+ {
+ deleteTexture(textures[i]);
+ }
+ }
+}
+
+void Context::detachShader(GLuint program, GLuint shader)
+{
+ Program *programObject = getProgramNoResolveLink(program);
+ ASSERT(programObject);
+
+ Shader *shaderObject = getShader(shader);
+ ASSERT(shaderObject);
+
+ programObject->detachShader(this, shaderObject);
+}
+
+void Context::genBuffers(GLsizei n, GLuint *buffers)
+{
+ for (int i = 0; i < n; i++)
+ {
+ buffers[i] = createBuffer();
+ }
+}
+
+void Context::genFramebuffers(GLsizei n, GLuint *framebuffers)
+{
+ for (int i = 0; i < n; i++)
+ {
+ framebuffers[i] = createFramebuffer();
+ }
+}
+
+void Context::genRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ for (int i = 0; i < n; i++)
+ {
+ renderbuffers[i] = createRenderbuffer();
+ }
+}
+
+void Context::genTextures(GLsizei n, GLuint *textures)
+{
+ for (int i = 0; i < n; i++)
+ {
+ textures[i] = createTexture();
+ }
+}
+
+void Context::getActiveAttrib(GLuint program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->getActiveAttribute(index, bufsize, length, size, type, name);
+}
+
+void Context::getActiveUniform(GLuint program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->getActiveUniform(index, bufsize, length, size, type, name);
+}
+
+void Context::getAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders)
+{
+ Program *programObject = getProgramNoResolveLink(program);
+ ASSERT(programObject);
+ programObject->getAttachedShaders(maxcount, count, shaders);
+}
+
+GLint Context::getAttribLocation(GLuint program, const GLchar *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ return programObject->getAttributeLocation(name);
+}
+
+void Context::getBooleanv(GLenum pname, GLboolean *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ getQueryParameterInfo(pname, &nativeType, &numParams);
+
+ if (nativeType == GL_BOOL)
+ {
+ getBooleanvImpl(pname, params);
+ }
+ else
+ {
+ CastStateValues(this, nativeType, pname, numParams, params);
+ }
+}
+
+void Context::getBooleanvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *params)
+{
+ getBooleanv(pname, params);
+}
+
+void Context::getFloatv(GLenum pname, GLfloat *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ getQueryParameterInfo(pname, &nativeType, &numParams);
+
+ if (nativeType == GL_FLOAT)
+ {
+ getFloatvImpl(pname, params);
+ }
+ else
+ {
+ CastStateValues(this, nativeType, pname, numParams, params);
+ }
+}
+
+void Context::getFloatvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params)
+{
+ getFloatv(pname, params);
+}
+
+void Context::getIntegerv(GLenum pname, GLint *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ getQueryParameterInfo(pname, &nativeType, &numParams);
+
+ if (nativeType == GL_INT)
+ {
+ getIntegervImpl(pname, params);
+ }
+ else
+ {
+ CastStateValues(this, nativeType, pname, numParams, params);
+ }
+}
+
+void Context::getIntegervRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data)
+{
+ getIntegerv(pname, data);
+}
+
+void Context::getProgramiv(GLuint program, GLenum pname, GLint *params)
+{
+ if (mContextLost)
+ return; // This must be a no-error context, to skip context-loss validation!
+
+ // Don't resolve link if checking the link completion status.
+ Program *programObject = (pname == GL_COMPLETION_STATUS_KHR ? getProgramNoResolveLink(program)
+ : getProgramResolveLink(program));
+ ASSERT(programObject);
+ QueryProgramiv(this, programObject, pname, params);
+}
+
+void Context::getProgramivRobust(GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getProgramiv(program, pname, params);
+}
+
+void Context::getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+MemoryObject *Context::getMemoryObject(GLuint handle) const
+{
+ return mState.mMemoryObjectManager->getMemoryObject(handle);
+}
+
+Semaphore *Context::getSemaphore(GLuint handle) const
+{
+ return mState.mSemaphoreManager->getSemaphore(handle);
+}
+
+void Context::getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->getInfoLog(bufsize, length, infolog);
+}
+
+void Context::getProgramPipelineInfoLog(GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getShaderiv(GLuint shader, GLenum pname, GLint *params)
+{
+ Shader *shaderObject = nullptr;
+ if (!mContextLost)
+ {
+ shaderObject = getShader(shader);
+ ASSERT(shaderObject);
+ }
+ QueryShaderiv(this, shaderObject, pname, params);
+}
+
+void Context::getShaderivRobust(GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getShaderiv(shader, pname, params);
+}
+
+void Context::getShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog)
+{
+ Shader *shaderObject = getShader(shader);
+ ASSERT(shaderObject);
+ shaderObject->getInfoLog(bufsize, length, infolog);
+}
+
+void Context::getShaderPrecisionFormat(GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision)
+{
+ // TODO(jmadill): Compute shaders.
+
+ switch (shadertype)
+ {
+ case GL_VERTEX_SHADER:
+ switch (precisiontype)
+ {
+ case GL_LOW_FLOAT:
+ mState.mCaps.vertexLowpFloat.get(range, precision);
+ break;
+ case GL_MEDIUM_FLOAT:
+ mState.mCaps.vertexMediumpFloat.get(range, precision);
+ break;
+ case GL_HIGH_FLOAT:
+ mState.mCaps.vertexHighpFloat.get(range, precision);
+ break;
+
+ case GL_LOW_INT:
+ mState.mCaps.vertexLowpInt.get(range, precision);
+ break;
+ case GL_MEDIUM_INT:
+ mState.mCaps.vertexMediumpInt.get(range, precision);
+ break;
+ case GL_HIGH_INT:
+ mState.mCaps.vertexHighpInt.get(range, precision);
+ break;
+
+ default:
+ UNREACHABLE();
+ return;
+ }
+ break;
+
+ case GL_FRAGMENT_SHADER:
+ switch (precisiontype)
+ {
+ case GL_LOW_FLOAT:
+ mState.mCaps.fragmentLowpFloat.get(range, precision);
+ break;
+ case GL_MEDIUM_FLOAT:
+ mState.mCaps.fragmentMediumpFloat.get(range, precision);
+ break;
+ case GL_HIGH_FLOAT:
+ mState.mCaps.fragmentHighpFloat.get(range, precision);
+ break;
+
+ case GL_LOW_INT:
+ mState.mCaps.fragmentLowpInt.get(range, precision);
+ break;
+ case GL_MEDIUM_INT:
+ mState.mCaps.fragmentMediumpInt.get(range, precision);
+ break;
+ case GL_HIGH_INT:
+ mState.mCaps.fragmentHighpInt.get(range, precision);
+ break;
+
+ default:
+ UNREACHABLE();
+ return;
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ return;
+ }
+}
+
+void Context::getShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source)
+{
+ Shader *shaderObject = getShader(shader);
+ ASSERT(shaderObject);
+ shaderObject->getSource(bufsize, length, source);
+}
+
+void Context::getUniformfv(GLuint program, GLint location, GLfloat *params)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->getUniformfv(this, location, params);
+}
+
+void Context::getUniformfvRobust(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ getUniformfv(program, location, params);
+}
+
+void Context::getUniformiv(GLuint program, GLint location, GLint *params)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->getUniformiv(this, location, params);
+}
+
+void Context::getUniformivRobust(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getUniformiv(program, location, params);
+}
+
+GLint Context::getUniformLocation(GLuint program, const GLchar *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ return programObject->getUniformLocation(name);
+}
+
+GLboolean Context::isBuffer(GLuint buffer)
+{
+ if (buffer == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getBuffer(buffer));
+}
+
+GLboolean Context::isEnabled(GLenum cap)
+{
+ return mState.getEnableFeature(cap);
+}
+
+GLboolean Context::isFramebuffer(GLuint framebuffer)
+{
+ if (framebuffer == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getFramebuffer(framebuffer));
+}
+
+GLboolean Context::isProgram(GLuint program)
+{
+ if (program == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getProgramNoResolveLink(program));
+}
+
+GLboolean Context::isRenderbuffer(GLuint renderbuffer)
+{
+ if (renderbuffer == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getRenderbuffer(renderbuffer));
+}
+
+GLboolean Context::isShader(GLuint shader)
+{
+ if (shader == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getShader(shader));
+}
+
+GLboolean Context::isTexture(GLuint texture)
+{
+ if (texture == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getTexture(texture));
+}
+
+void Context::linkProgram(GLuint program)
+{
+ Program *programObject = getProgramNoResolveLink(program);
+ ASSERT(programObject);
+ ANGLE_CONTEXT_TRY(programObject->link(this));
+ ANGLE_CONTEXT_TRY(onProgramLink(programObject));
+}
+
+void Context::releaseShaderCompiler()
+{
+ mCompiler.set(this, nullptr);
+}
+
+void Context::shaderBinary(GLsizei n,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length)
+{
+ // No binary shader formats are supported.
+ UNIMPLEMENTED();
+}
+
+void Context::bindFragDataLocationIndexed(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char *name)
+{
+ Program *programObject = getProgramNoResolveLink(program);
+ programObject->bindFragmentOutputLocation(colorNumber, name);
+ programObject->bindFragmentOutputIndex(index, name);
+}
+
+void Context::bindFragDataLocation(GLuint program, GLuint colorNumber, const char *name)
+{
+ bindFragDataLocationIndexed(program, colorNumber, 0u, name);
+}
+
+int Context::getFragDataIndex(GLuint program, const char *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ return programObject->getFragDataIndex(name);
+}
+
+int Context::getProgramResourceLocationIndex(GLuint program,
+ GLenum programInterface,
+ const char *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programInterface == GL_PROGRAM_OUTPUT);
+ return programObject->getFragDataIndex(name);
+}
+
+void Context::shaderSource(GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length)
+{
+ Shader *shaderObject = getShader(shader);
+ ASSERT(shaderObject);
+ shaderObject->setSource(count, string, length);
+}
+
+void Context::stencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ stencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask);
+}
+
+void Context::stencilMask(GLuint mask)
+{
+ stencilMaskSeparate(GL_FRONT_AND_BACK, mask);
+}
+
+void Context::stencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ stencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass);
+}
+
+void Context::uniform1f(GLint location, GLfloat x)
+{
+ Program *program = mState.getProgram();
+ program->setUniform1fv(location, 1, &x);
+}
+
+void Context::uniform1fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ Program *program = mState.getProgram();
+ program->setUniform1fv(location, count, v);
+}
+
+void Context::setUniform1iImpl(Program *program, GLint location, GLsizei count, const GLint *v)
+{
+ program->setUniform1iv(this, location, count, v);
+}
+
+void Context::onSamplerUniformChange(size_t textureUnitIndex)
+{
+ mState.onActiveTextureChange(this, textureUnitIndex);
+ mStateCache.onActiveTextureChange(this);
+}
+
+void Context::uniform1i(GLint location, GLint x)
+{
+ setUniform1iImpl(mState.getProgram(), location, 1, &x);
+}
+
+void Context::uniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+ setUniform1iImpl(mState.getProgram(), location, count, v);
+}
+
+void Context::uniform2f(GLint location, GLfloat x, GLfloat y)
+{
+ GLfloat xy[2] = {x, y};
+ Program *program = mState.getProgram();
+ program->setUniform2fv(location, 1, xy);
+}
+
+void Context::uniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ Program *program = mState.getProgram();
+ program->setUniform2fv(location, count, v);
+}
+
+void Context::uniform2i(GLint location, GLint x, GLint y)
+{
+ GLint xy[2] = {x, y};
+ Program *program = mState.getProgram();
+ program->setUniform2iv(location, 1, xy);
+}
+
+void Context::uniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+ Program *program = mState.getProgram();
+ program->setUniform2iv(location, count, v);
+}
+
+void Context::uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+ GLfloat xyz[3] = {x, y, z};
+ Program *program = mState.getProgram();
+ program->setUniform3fv(location, 1, xyz);
+}
+
+void Context::uniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ Program *program = mState.getProgram();
+ program->setUniform3fv(location, count, v);
+}
+
+void Context::uniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+ GLint xyz[3] = {x, y, z};
+ Program *program = mState.getProgram();
+ program->setUniform3iv(location, 1, xyz);
+}
+
+void Context::uniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+ Program *program = mState.getProgram();
+ program->setUniform3iv(location, count, v);
+}
+
+void Context::uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ GLfloat xyzw[4] = {x, y, z, w};
+ Program *program = mState.getProgram();
+ program->setUniform4fv(location, 1, xyzw);
+}
+
+void Context::uniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ Program *program = mState.getProgram();
+ program->setUniform4fv(location, count, v);
+}
+
+void Context::uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+ GLint xyzw[4] = {x, y, z, w};
+ Program *program = mState.getProgram();
+ program->setUniform4iv(location, 1, xyzw);
+}
+
+void Context::uniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+ Program *program = mState.getProgram();
+ program->setUniform4iv(location, count, v);
+}
+
+void Context::uniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix2fv(location, count, transpose, value);
+}
+
+void Context::uniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix3fv(location, count, transpose, value);
+}
+
+void Context::uniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix4fv(location, count, transpose, value);
+}
+
+void Context::validateProgram(GLuint program)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->validate(mState.mCaps);
+}
+
+void Context::validateProgramPipeline(GLuint pipeline)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getProgramBinary(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject != nullptr);
+
+ ANGLE_CONTEXT_TRY(programObject->saveBinary(this, binaryFormat, binary, bufSize, length));
+}
+
+void Context::programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject != nullptr);
+
+ ANGLE_CONTEXT_TRY(programObject->loadBinary(this, binaryFormat, binary, length));
+ ANGLE_CONTEXT_TRY(onProgramLink(programObject));
+}
+
+void Context::uniform1ui(GLint location, GLuint v0)
+{
+ Program *program = mState.getProgram();
+ program->setUniform1uiv(location, 1, &v0);
+}
+
+void Context::uniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ Program *program = mState.getProgram();
+ const GLuint xy[] = {v0, v1};
+ program->setUniform2uiv(location, 1, xy);
+}
+
+void Context::uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ Program *program = mState.getProgram();
+ const GLuint xyz[] = {v0, v1, v2};
+ program->setUniform3uiv(location, 1, xyz);
+}
+
+void Context::uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ Program *program = mState.getProgram();
+ const GLuint xyzw[] = {v0, v1, v2, v3};
+ program->setUniform4uiv(location, 1, xyzw);
+}
+
+void Context::uniform1uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniform1uiv(location, count, value);
+}
+void Context::uniform2uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniform2uiv(location, count, value);
+}
+
+void Context::uniform3uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniform3uiv(location, count, value);
+}
+
+void Context::uniform4uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniform4uiv(location, count, value);
+}
+
+void Context::genQueries(GLsizei n, GLuint *ids)
+{
+ for (GLsizei i = 0; i < n; i++)
+ {
+ GLuint handle = mQueryHandleAllocator.allocate();
+ mQueryMap.assign(handle, nullptr);
+ ids[i] = handle;
+ }
+}
+
+void Context::deleteQueries(GLsizei n, const GLuint *ids)
+{
+ for (int i = 0; i < n; i++)
+ {
+ GLuint query = ids[i];
+
+ Query *queryObject = nullptr;
+ if (mQueryMap.erase(query, &queryObject))
+ {
+ mQueryHandleAllocator.release(query);
+ if (queryObject)
+ {
+ queryObject->release(this);
+ }
+ }
+ }
+}
+
+GLboolean Context::isQuery(GLuint id)
+{
+ return ConvertToGLBoolean(getQuery(id, false, QueryType::InvalidEnum) != nullptr);
+}
+
+void Context::uniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix2x3fv(location, count, transpose, value);
+}
+
+void Context::uniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix3x2fv(location, count, transpose, value);
+}
+
+void Context::uniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix2x4fv(location, count, transpose, value);
+}
+
+void Context::uniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix4x2fv(location, count, transpose, value);
+}
+
+void Context::uniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix3x4fv(location, count, transpose, value);
+}
+
+void Context::uniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *program = mState.getProgram();
+ program->setUniformMatrix4x3fv(location, count, transpose, value);
+}
+
+void Context::deleteVertexArrays(GLsizei n, const GLuint *arrays)
+{
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ GLuint vertexArray = arrays[arrayIndex];
+
+ if (arrays[arrayIndex] != 0)
+ {
+ VertexArray *vertexArrayObject = nullptr;
+ if (mVertexArrayMap.erase(vertexArray, &vertexArrayObject))
+ {
+ if (vertexArrayObject != nullptr)
+ {
+ detachVertexArray(vertexArray);
+ vertexArrayObject->onDestroy(this);
+ }
+
+ mVertexArrayHandleAllocator.release(vertexArray);
+ }
+ }
+ }
+}
+
+void Context::genVertexArrays(GLsizei n, GLuint *arrays)
+{
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ GLuint vertexArray = mVertexArrayHandleAllocator.allocate();
+ mVertexArrayMap.assign(vertexArray, nullptr);
+ arrays[arrayIndex] = vertexArray;
+ }
+}
+
+GLboolean Context::isVertexArray(GLuint array)
+{
+ if (array == 0)
+ {
+ return GL_FALSE;
+ }
+
+ VertexArray *vao = getVertexArray(array);
+ return ConvertToGLBoolean(vao != nullptr);
+}
+
+void Context::endTransformFeedback()
+{
+ TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
+ ANGLE_CONTEXT_TRY(transformFeedback->end(this));
+ mStateCache.onActiveTransformFeedbackChange(this);
+}
+
+void Context::transformFeedbackVaryings(GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setTransformFeedbackVaryings(count, varyings, bufferMode);
+}
+
+void Context::getTransformFeedbackVarying(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name);
+}
+
+void Context::deleteTransformFeedbacks(GLsizei n, const GLuint *ids)
+{
+ for (int i = 0; i < n; i++)
+ {
+ GLuint transformFeedback = ids[i];
+ if (transformFeedback == 0)
+ {
+ continue;
+ }
+
+ TransformFeedback *transformFeedbackObject = nullptr;
+ if (mTransformFeedbackMap.erase(transformFeedback, &transformFeedbackObject))
+ {
+ if (transformFeedbackObject != nullptr)
+ {
+ detachTransformFeedback(transformFeedback);
+ transformFeedbackObject->release(this);
+ }
+
+ mTransformFeedbackHandleAllocator.release(transformFeedback);
+ }
+ }
+}
+
+void Context::genTransformFeedbacks(GLsizei n, GLuint *ids)
+{
+ for (int i = 0; i < n; i++)
+ {
+ GLuint transformFeedback = mTransformFeedbackHandleAllocator.allocate();
+ mTransformFeedbackMap.assign(transformFeedback, nullptr);
+ ids[i] = transformFeedback;
+ }
+}
+
+GLboolean Context::isTransformFeedback(GLuint id)
+{
+ if (id == 0)
+ {
+ // The 3.0.4 spec [section 6.1.11] states that if ID is zero, IsTransformFeedback
+ // returns FALSE
+ return GL_FALSE;
+ }
+
+ const TransformFeedback *transformFeedback = getTransformFeedback(id);
+ return ConvertToGLBoolean(transformFeedback != nullptr);
+}
+
+void Context::pauseTransformFeedback()
+{
+ TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
+ ANGLE_CONTEXT_TRY(transformFeedback->pause(this));
+ mStateCache.onActiveTransformFeedbackChange(this);
+}
+
+void Context::resumeTransformFeedback()
+{
+ TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
+ ANGLE_CONTEXT_TRY(transformFeedback->resume(this));
+ mStateCache.onActiveTransformFeedbackChange(this);
+}
+
+void Context::getUniformuiv(GLuint program, GLint location, GLuint *params)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ programObject->getUniformuiv(this, location, params);
+}
+
+void Context::getUniformuivRobust(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ getUniformuiv(program, location, params);
+}
+
+GLint Context::getFragDataLocation(GLuint program, const GLchar *name)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ return programObject->getFragDataLocation(name);
+}
+
+void Context::getUniformIndices(GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ if (!programObject->isLinked())
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ uniformIndices[uniformId] = GL_INVALID_INDEX;
+ }
+ }
+ else
+ {
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ uniformIndices[uniformId] = programObject->getUniformIndex(uniformNames[uniformId]);
+ }
+ }
+}
+
+void Context::getActiveUniformsiv(GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+ params[uniformId] = GetUniformResourceProperty(programObject, index, pname);
+ }
+}
+
+GLuint Context::getUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ return programObject->getUniformBlockIndex(uniformBlockName);
+}
+
+void Context::getActiveUniformBlockiv(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params);
+}
+
+void Context::getActiveUniformBlockivRobust(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
+}
+
+void Context::getActiveUniformBlockName(GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName)
+{
+ const Program *programObject = getProgramResolveLink(program);
+ programObject->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
+}
+
+void Context::uniformBlockBinding(GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding)
+{
+ Program *programObject = getProgramResolveLink(program);
+ programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
+
+ // Note: If the Program is shared between Contexts we would be better using Observer/Subject.
+ if (programObject->isInUse())
+ {
+ mState.setObjectDirty(GL_PROGRAM);
+ mStateCache.onUniformBufferStateChange(this);
+ }
+}
+
+GLsync Context::fenceSync(GLenum condition, GLbitfield flags)
+{
+ GLuint handle = mState.mSyncManager->createSync(mImplementation.get());
+ GLsync syncHandle = reinterpret_cast<GLsync>(static_cast<uintptr_t>(handle));
+
+ Sync *syncObject = getSync(syncHandle);
+ if (syncObject->set(this, condition, flags) == angle::Result::Stop)
+ {
+ deleteSync(syncHandle);
+ return nullptr;
+ }
+
+ return syncHandle;
+}
+
+GLboolean Context::isSync(GLsync sync)
+{
+ return (getSync(sync) != nullptr);
+}
+
+GLenum Context::clientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ Sync *syncObject = getSync(sync);
+
+ GLenum result = GL_WAIT_FAILED;
+ if (syncObject->clientWait(this, flags, timeout, &result) == angle::Result::Stop)
+ {
+ return GL_WAIT_FAILED;
+ }
+ return result;
+}
+
+void Context::waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ Sync *syncObject = getSync(sync);
+ ANGLE_CONTEXT_TRY(syncObject->serverWait(this, flags, timeout));
+}
+
+void Context::getInteger64v(GLenum pname, GLint64 *params)
+{
+ GLenum nativeType = GL_NONE;
+ unsigned int numParams = 0;
+ getQueryParameterInfo(pname, &nativeType, &numParams);
+
+ if (nativeType == GL_INT_64_ANGLEX)
+ {
+ getInteger64vImpl(pname, params);
+ }
+ else
+ {
+ CastStateValues(this, nativeType, pname, numParams, params);
+ }
+}
+
+void Context::getInteger64vRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data)
+{
+ getInteger64v(pname, data);
+}
+
+void Context::getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params)
+{
+ Buffer *buffer = mState.getTargetBuffer(target);
+ QueryBufferParameteri64v(buffer, pname, params);
+}
+
+void Context::getBufferParameteri64vRobust(BufferBinding target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ getBufferParameteri64v(target, pname, params);
+}
+
+void Context::genSamplers(GLsizei count, GLuint *samplers)
+{
+ for (int i = 0; i < count; i++)
+ {
+ samplers[i] = mState.mSamplerManager->createSampler();
+ }
+}
+
+void Context::deleteSamplers(GLsizei count, const GLuint *samplers)
+{
+ for (int i = 0; i < count; i++)
+ {
+ GLuint sampler = samplers[i];
+
+ if (mState.mSamplerManager->getSampler(sampler))
+ {
+ detachSampler(sampler);
+ }
+
+ mState.mSamplerManager->deleteObject(this, sampler);
+ }
+}
+
+void Context::getInternalformativ(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params)
+{
+ const TextureCaps &formatCaps = mState.mTextureCaps.get(internalformat);
+ QueryInternalFormativ(formatCaps, pname, bufSize, params);
+}
+
+void Context::getInternalformativRobust(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ getInternalformativ(target, internalformat, pname, bufSize, params);
+}
+
+void Context::programUniform1i(GLuint program, GLint location, GLint v0)
+{
+ programUniform1iv(program, location, 1, &v0);
+}
+
+void Context::programUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
+{
+ GLint xy[2] = {v0, v1};
+ programUniform2iv(program, location, 1, xy);
+}
+
+void Context::programUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
+{
+ GLint xyz[3] = {v0, v1, v2};
+ programUniform3iv(program, location, 1, xyz);
+}
+
+void Context::programUniform4i(GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3)
+{
+ GLint xyzw[4] = {v0, v1, v2, v3};
+ programUniform4iv(program, location, 1, xyzw);
+}
+
+void Context::programUniform1ui(GLuint program, GLint location, GLuint v0)
+{
+ programUniform1uiv(program, location, 1, &v0);
+}
+
+void Context::programUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
+{
+ GLuint xy[2] = {v0, v1};
+ programUniform2uiv(program, location, 1, xy);
+}
+
+void Context::programUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ GLuint xyz[3] = {v0, v1, v2};
+ programUniform3uiv(program, location, 1, xyz);
+}
+
+void Context::programUniform4ui(GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3)
+{
+ GLuint xyzw[4] = {v0, v1, v2, v3};
+ programUniform4uiv(program, location, 1, xyzw);
+}
+
+void Context::programUniform1f(GLuint program, GLint location, GLfloat v0)
+{
+ programUniform1fv(program, location, 1, &v0);
+}
+
+void Context::programUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
+{
+ GLfloat xy[2] = {v0, v1};
+ programUniform2fv(program, location, 1, xy);
+}
+
+void Context::programUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ GLfloat xyz[3] = {v0, v1, v2};
+ programUniform3fv(program, location, 1, xyz);
+}
+
+void Context::programUniform4f(GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3)
+{
+ GLfloat xyzw[4] = {v0, v1, v2, v3};
+ programUniform4fv(program, location, 1, xyzw);
+}
+
+void Context::programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ setUniform1iImpl(programObject, location, count, value);
+}
+
+void Context::programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform2iv(location, count, value);
+}
+
+void Context::programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform3iv(location, count, value);
+}
+
+void Context::programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform4iv(location, count, value);
+}
+
+void Context::programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform1uiv(location, count, value);
+}
+
+void Context::programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform2uiv(location, count, value);
+}
+
+void Context::programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform3uiv(location, count, value);
+}
+
+void Context::programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform4uiv(location, count, value);
+}
+
+void Context::programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform1fv(location, count, value);
+}
+
+void Context::programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform2fv(location, count, value);
+}
+
+void Context::programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform3fv(location, count, value);
+}
+
+void Context::programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniform4fv(location, count, value);
+}
+
+void Context::programUniformMatrix2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix2fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix3fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix4fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix2x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix2x3fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix3x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix3x2fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix2x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix2x4fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix4x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix4x2fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix3x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix3x4fv(location, count, transpose, value);
+}
+
+void Context::programUniformMatrix4x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+ programObject->setUniformMatrix4x3fv(location, count, transpose, value);
+}
+
+bool Context::isCurrentTransformFeedback(const TransformFeedback *tf) const
+{
+ return mState.isCurrentTransformFeedback(tf);
+}
+
+void Context::genProgramPipelines(GLsizei count, GLuint *pipelines)
+{
+ for (int i = 0; i < count; i++)
+ {
+ pipelines[i] = createProgramPipeline();
+ }
+}
+
+void Context::deleteProgramPipelines(GLsizei count, const GLuint *pipelines)
+{
+ for (int i = 0; i < count; i++)
+ {
+ if (pipelines[i] != 0)
+ {
+ deleteProgramPipeline(pipelines[i]);
+ }
+ }
+}
+
+GLboolean Context::isProgramPipeline(GLuint pipeline)
+{
+ if (pipeline == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getProgramPipeline(pipeline));
+}
+
+void Context::finishFenceNV(GLuint fence)
+{
+ FenceNV *fenceObject = getFenceNV(fence);
+
+ ASSERT(fenceObject && fenceObject->isSet());
+ ANGLE_CONTEXT_TRY(fenceObject->finish(this));
+}
+
+void Context::getFenceivNV(GLuint fence, GLenum pname, GLint *params)
+{
+ FenceNV *fenceObject = getFenceNV(fence);
+
+ ASSERT(fenceObject && fenceObject->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.
+ GLboolean status = GL_TRUE;
+ if (fenceObject->getStatus() != GL_TRUE)
+ {
+ ANGLE_CONTEXT_TRY(fenceObject->test(this, &status));
+ }
+ *params = status;
+ break;
+ }
+
+ case GL_FENCE_CONDITION_NV:
+ {
+ *params = static_cast<GLint>(fenceObject->getCondition());
+ break;
+ }
+
+ default:
+ UNREACHABLE();
+ }
+}
+
+void Context::getTranslatedShaderSource(GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source)
+{
+ Shader *shaderObject = getShader(shader);
+ ASSERT(shaderObject);
+ shaderObject->getTranslatedSourceWithDebugInfo(bufsize, length, source);
+}
+
+void Context::getnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+
+ programObject->getUniformfv(this, location, params);
+}
+
+void Context::getnUniformfvRobust(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params)
+{
+ Program *programObject = getProgramResolveLink(program);
+ ASSERT(programObject);
+
+ programObject->getUniformiv(this, location, params);
+}
+
+void Context::getnUniformivRobust(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnUniformuivRobust(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+GLboolean Context::isFenceNV(GLuint fence)
+{
+ FenceNV *fenceObject = getFenceNV(fence);
+
+ if (fenceObject == nullptr)
+ {
+ return GL_FALSE;
+ }
+
+ // GL_NV_fence spec:
+ // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an
+ // existing fence.
+ return fenceObject->isSet();
+}
+
+void Context::readnPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data)
+{
+ return readPixels(x, y, width, height, format, type, data);
+}
+
+void Context::setFenceNV(GLuint fence, GLenum condition)
+{
+ ASSERT(condition == GL_ALL_COMPLETED_NV);
+
+ FenceNV *fenceObject = getFenceNV(fence);
+ ASSERT(fenceObject != nullptr);
+ ANGLE_CONTEXT_TRY(fenceObject->set(this, condition));
+}
+
+GLboolean Context::testFenceNV(GLuint fence)
+{
+ FenceNV *fenceObject = getFenceNV(fence);
+
+ ASSERT(fenceObject != nullptr);
+ ASSERT(fenceObject->isSet() == GL_TRUE);
+
+ GLboolean result = GL_TRUE;
+ if (fenceObject->test(this, &result) == angle::Result::Stop)
+ {
+ return GL_TRUE;
+ }
+
+ return result;
+}
+
+void Context::deleteMemoryObjects(GLsizei n, const GLuint *memoryObjects)
+{
+ for (int i = 0; i < n; i++)
+ {
+ deleteMemoryObject(memoryObjects[i]);
+ }
+}
+
+GLboolean Context::isMemoryObject(GLuint memoryObject)
+{
+ if (memoryObject == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getMemoryObject(memoryObject));
+}
+
+void Context::createMemoryObjects(GLsizei n, GLuint *memoryObjects)
+{
+ for (int i = 0; i < n; i++)
+ {
+ memoryObjects[i] = createMemoryObject();
+ }
+}
+
+void Context::memoryObjectParameteriv(GLuint memoryObject, GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getMemoryObjectParameteriv(GLuint memoryObject, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texStorageMem2D(TextureType target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset)
+{
+ MemoryObject *memoryObject = getMemoryObject(memory);
+ ASSERT(memoryObject);
+ Extents size(width, height, 1);
+ Texture *texture = getTextureByType(target);
+ ANGLE_CONTEXT_TRY(texture->setStorageExternalMemory(this, target, levels, internalFormat, size,
+ memoryObject, offset));
+}
+
+void Context::texStorageMem2DMultisample(TextureType target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texStorageMem3D(TextureType target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texStorageMem3DMultisample(TextureType target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bufferStorageMem(TextureType target, GLsizeiptr size, GLuint memory, GLuint64 offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::importMemoryFd(GLuint memory, GLuint64 size, HandleType handleType, GLint fd)
+{
+ MemoryObject *memoryObject = getMemoryObject(memory);
+ ASSERT(memoryObject != nullptr);
+ ANGLE_CONTEXT_TRY(memoryObject->importFd(this, size, handleType, fd));
+}
+
+void Context::genSemaphores(GLsizei n, GLuint *semaphores)
+{
+ for (int i = 0; i < n; i++)
+ {
+ semaphores[i] = createSemaphore();
+ }
+}
+
+void Context::deleteSemaphores(GLsizei n, const GLuint *semaphores)
+{
+ for (int i = 0; i < n; i++)
+ {
+ deleteSemaphore(semaphores[i]);
+ }
+}
+
+GLboolean Context::isSemaphore(GLuint semaphore)
+{
+ if (semaphore == 0)
+ {
+ return GL_FALSE;
+ }
+
+ return ConvertToGLBoolean(getSemaphore(semaphore));
+}
+
+void Context::semaphoreParameterui64v(GLuint semaphore, GLenum pname, const GLuint64 *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getSemaphoreParameterui64v(GLuint semaphore, GLenum pname, GLuint64 *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::waitSemaphore(GLuint semaphoreHandle,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts)
+{
+ Semaphore *semaphore = getSemaphore(semaphoreHandle);
+ ASSERT(semaphore);
+
+ BufferBarrierVector bufferBarriers(numBufferBarriers);
+ for (GLuint bufferBarrierIdx = 0; bufferBarrierIdx < numBufferBarriers; bufferBarrierIdx++)
+ {
+ bufferBarriers[bufferBarrierIdx] = getBuffer(buffers[bufferBarrierIdx]);
+ }
+
+ TextureBarrierVector textureBarriers(numTextureBarriers);
+ for (GLuint textureBarrierIdx = 0; textureBarrierIdx < numTextureBarriers; textureBarrierIdx++)
+ {
+ textureBarriers[textureBarrierIdx].texture = getTexture(textures[textureBarrierIdx]);
+ textureBarriers[textureBarrierIdx].layout = srcLayouts[textureBarrierIdx];
+ }
+
+ ANGLE_CONTEXT_TRY(semaphore->wait(this, bufferBarriers, textureBarriers));
+}
+
+void Context::signalSemaphore(GLuint semaphoreHandle,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts)
+{
+ Semaphore *semaphore = getSemaphore(semaphoreHandle);
+ ASSERT(semaphore);
+
+ BufferBarrierVector bufferBarriers(numBufferBarriers);
+ for (GLuint bufferBarrierIdx = 0; bufferBarrierIdx < numBufferBarriers; bufferBarrierIdx++)
+ {
+ bufferBarriers[bufferBarrierIdx] = getBuffer(buffers[bufferBarrierIdx]);
+ }
+
+ TextureBarrierVector textureBarriers(numTextureBarriers);
+ for (GLuint textureBarrierIdx = 0; textureBarrierIdx < numTextureBarriers; textureBarrierIdx++)
+ {
+ textureBarriers[textureBarrierIdx].texture = getTexture(textures[textureBarrierIdx]);
+ textureBarriers[textureBarrierIdx].layout = dstLayouts[textureBarrierIdx];
+ }
+
+ ANGLE_CONTEXT_TRY(semaphore->signal(this, bufferBarriers, textureBarriers));
+}
+
+void Context::importSemaphoreFd(GLuint semaphore, HandleType handleType, GLint fd)
+{
+ Semaphore *semaphoreObject = getSemaphore(semaphore);
+ ASSERT(semaphoreObject != nullptr);
+ ANGLE_CONTEXT_TRY(semaphoreObject->importFd(this, handleType, fd));
+}
+
+void Context::eGLImageTargetTexture2D(TextureType target, GLeglImageOES image)
+{
+ Texture *texture = getTextureByType(target);
+ egl::Image *imageObject = static_cast<egl::Image *>(image);
+ ANGLE_CONTEXT_TRY(texture->setEGLImageTarget(this, target, imageObject));
+}
+
+void Context::eGLImageTargetRenderbufferStorage(GLenum target, GLeglImageOES image)
+{
+ Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
+ egl::Image *imageObject = static_cast<egl::Image *>(image);
+ ANGLE_CONTEXT_TRY(renderbuffer->setStorageEGLImageTarget(this, imageObject));
+}
+
+void Context::texStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
+{
+ UNIMPLEMENTED();
+}
+
+bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) const
+{
+ // Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation
+ // is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due
+ // to the fact that it is stored internally as a float, and so would require conversion
+ // if returned from Context::getIntegerv. Since this conversion is already implemented
+ // in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we
+ // place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling
+ // application.
+ switch (pname)
+ {
+ case GL_COMPRESSED_TEXTURE_FORMATS:
+ {
+ *type = GL_INT;
+ *numParams = static_cast<unsigned int>(getCaps().compressedTextureFormats.size());
+ return true;
+ }
+ case GL_SHADER_BINARY_FORMATS:
+ {
+ *type = GL_INT;
+ *numParams = static_cast<unsigned int>(getCaps().shaderBinaryFormats.size());
+ return true;
+ }
+
+ case GL_MAX_VERTEX_ATTRIBS:
+ case GL_MAX_VERTEX_UNIFORM_VECTORS:
+ case GL_MAX_VARYING_VECTORS:
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+ case GL_MAX_TEXTURE_IMAGE_UNITS:
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+ case GL_MAX_RENDERBUFFER_SIZE:
+ case GL_NUM_SHADER_BINARY_FORMATS:
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+ case GL_ARRAY_BUFFER_BINDING:
+ case GL_FRAMEBUFFER_BINDING: // GL_FRAMEBUFFER_BINDING now equivalent to
+ // GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
+ case GL_RENDERBUFFER_BINDING:
+ case GL_CURRENT_PROGRAM:
+ case GL_PACK_ALIGNMENT:
+ case GL_UNPACK_ALIGNMENT:
+ case GL_GENERATE_MIPMAP_HINT:
+ case GL_RED_BITS:
+ case GL_GREEN_BITS:
+ case GL_BLUE_BITS:
+ case GL_ALPHA_BITS:
+ case GL_DEPTH_BITS:
+ case GL_STENCIL_BITS:
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING:
+ case GL_CULL_FACE_MODE:
+ case GL_FRONT_FACE:
+ case GL_ACTIVE_TEXTURE:
+ case GL_STENCIL_FUNC:
+ case GL_STENCIL_VALUE_MASK:
+ case GL_STENCIL_REF:
+ case GL_STENCIL_FAIL:
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ case GL_STENCIL_BACK_FUNC:
+ case GL_STENCIL_BACK_VALUE_MASK:
+ case GL_STENCIL_BACK_REF:
+ case GL_STENCIL_BACK_FAIL:
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ case GL_DEPTH_FUNC:
+ case GL_BLEND_SRC_RGB:
+ case GL_BLEND_SRC_ALPHA:
+ case GL_BLEND_DST_RGB:
+ case GL_BLEND_DST_ALPHA:
+ case GL_BLEND_EQUATION_RGB:
+ case GL_BLEND_EQUATION_ALPHA:
+ case GL_STENCIL_WRITEMASK:
+ case GL_STENCIL_BACK_WRITEMASK:
+ case GL_STENCIL_CLEAR_VALUE:
+ case GL_SUBPIXEL_BITS:
+ case GL_MAX_TEXTURE_SIZE:
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
+ case GL_SAMPLE_BUFFERS:
+ case GL_SAMPLES:
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_CUBE_MAP:
+ case GL_RESET_NOTIFICATION_STRATEGY_EXT:
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
+ {
+ if (!getExtensions().packReverseRowOrder)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE:
+ case GL_TEXTURE_BINDING_RECTANGLE_ANGLE:
+ {
+ if (!getExtensions().textureRectangle)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ case GL_MAX_DRAW_BUFFERS_EXT:
+ case GL_MAX_COLOR_ATTACHMENTS_EXT:
+ {
+ if ((getClientMajorVersion() < 3) && !getExtensions().drawBuffers)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ case GL_MAX_VIEWPORT_DIMS:
+ {
+ *type = GL_INT;
+ *numParams = 2;
+ return true;
+ }
+ case GL_VIEWPORT:
+ case GL_SCISSOR_BOX:
+ {
+ *type = GL_INT;
+ *numParams = 4;
+ return true;
+ }
+ case GL_SHADER_COMPILER:
+ case GL_SAMPLE_COVERAGE_INVERT:
+ case GL_DEPTH_WRITEMASK:
+ case GL_CULL_FACE: // CULL_FACE through DITHER are natural to IsEnabled,
+ case GL_POLYGON_OFFSET_FILL: // but can be retrieved through the Get{Type}v queries.
+ case GL_SAMPLE_ALPHA_TO_COVERAGE: // For this purpose, they are treated here as
+ // bool-natural
+ case GL_SAMPLE_COVERAGE:
+ case GL_SCISSOR_TEST:
+ case GL_STENCIL_TEST:
+ case GL_DEPTH_TEST:
+ case GL_BLEND:
+ case GL_DITHER:
+ case GL_CONTEXT_ROBUST_ACCESS_EXT:
+ {
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ case GL_COLOR_WRITEMASK:
+ {
+ *type = GL_BOOL;
+ *numParams = 4;
+ return true;
+ }
+ case GL_POLYGON_OFFSET_FACTOR:
+ case GL_POLYGON_OFFSET_UNITS:
+ case GL_SAMPLE_COVERAGE_VALUE:
+ case GL_DEPTH_CLEAR_VALUE:
+ case GL_LINE_WIDTH:
+ {
+ *type = GL_FLOAT;
+ *numParams = 1;
+ return true;
+ }
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ case GL_DEPTH_RANGE:
+ {
+ *type = GL_FLOAT;
+ *numParams = 2;
+ return true;
+ }
+ case GL_COLOR_CLEAR_VALUE:
+ case GL_BLEND_COLOR:
+ {
+ *type = GL_FLOAT;
+ *numParams = 4;
+ return true;
+ }
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (!getExtensions().textureFilterAnisotropic)
+ {
+ return false;
+ }
+ *type = GL_FLOAT;
+ *numParams = 1;
+ return true;
+ case GL_TIMESTAMP_EXT:
+ if (!getExtensions().disjointTimerQuery)
+ {
+ return false;
+ }
+ *type = GL_INT_64_ANGLEX;
+ *numParams = 1;
+ return true;
+ case GL_GPU_DISJOINT_EXT:
+ if (!getExtensions().disjointTimerQuery)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_COVERAGE_MODULATION_CHROMIUM:
+ if (!getExtensions().framebufferMixedSamples)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_TEXTURE_BINDING_EXTERNAL_OES:
+ if (!getExtensions().eglStreamConsumerExternal && !getExtensions().eglImageExternal)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+
+ if (getExtensions().debug)
+ {
+ switch (pname)
+ {
+ case GL_DEBUG_LOGGED_MESSAGES:
+ case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH:
+ case GL_DEBUG_GROUP_STACK_DEPTH:
+ case GL_MAX_DEBUG_MESSAGE_LENGTH:
+ case GL_MAX_DEBUG_LOGGED_MESSAGES:
+ case GL_MAX_DEBUG_GROUP_STACK_DEPTH:
+ case GL_MAX_LABEL_LENGTH:
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+
+ case GL_DEBUG_OUTPUT_SYNCHRONOUS:
+ case GL_DEBUG_OUTPUT:
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getExtensions().multisampleCompatibility)
+ {
+ switch (pname)
+ {
+ case GL_MULTISAMPLE_EXT:
+ case GL_SAMPLE_ALPHA_TO_ONE_EXT:
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getExtensions().pathRendering)
+ {
+ switch (pname)
+ {
+ case GL_PATH_MODELVIEW_MATRIX_CHROMIUM:
+ case GL_PATH_PROJECTION_MATRIX_CHROMIUM:
+ *type = GL_FLOAT;
+ *numParams = 16;
+ return true;
+ }
+ }
+
+ if (getExtensions().bindGeneratesResource)
+ {
+ switch (pname)
+ {
+ case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getExtensions().clientArrays)
+ {
+ switch (pname)
+ {
+ case GL_CLIENT_ARRAYS_ANGLE:
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getExtensions().sRGBWriteControl)
+ {
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_SRGB_EXT:
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getExtensions().robustResourceInitialization &&
+ pname == GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE)
+ {
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+
+ if (getExtensions().programCacheControl && pname == GL_PROGRAM_CACHE_ENABLED_ANGLE)
+ {
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+
+ if (getExtensions().parallelShaderCompile && pname == GL_MAX_SHADER_COMPILER_THREADS_KHR)
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+
+ if (getExtensions().blendFuncExtended && pname == GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT)
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+
+ // Check for ES3.0+ parameter names which are also exposed as ES2 extensions
+ switch (pname)
+ {
+ // GL_DRAW_FRAMEBUFFER_BINDING_ANGLE equivalent to FRAMEBUFFER_BINDING
+ case GL_READ_FRAMEBUFFER_BINDING_ANGLE:
+ if ((getClientMajorVersion() < 3) && !getExtensions().framebufferBlit)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+
+ case GL_NUM_PROGRAM_BINARY_FORMATS_OES:
+ if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+
+ case GL_PROGRAM_BINARY_FORMATS_OES:
+ if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = static_cast<unsigned int>(getCaps().programBinaryFormats.size());
+ return true;
+
+ case GL_PACK_ROW_LENGTH:
+ case GL_PACK_SKIP_ROWS:
+ case GL_PACK_SKIP_PIXELS:
+ if ((getClientMajorVersion() < 3) && !getExtensions().packSubimage)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_UNPACK_ROW_LENGTH:
+ case GL_UNPACK_SKIP_ROWS:
+ case GL_UNPACK_SKIP_PIXELS:
+ if ((getClientMajorVersion() < 3) && !getExtensions().unpackSubimage)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_VERTEX_ARRAY_BINDING:
+ if ((getClientMajorVersion() < 3) && !getExtensions().vertexArrayObject)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_PIXEL_PACK_BUFFER_BINDING:
+ case GL_PIXEL_UNPACK_BUFFER_BINDING:
+ if ((getClientMajorVersion() < 3) && !getExtensions().pixelBufferObject)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_MAX_SAMPLES:
+ {
+ static_assert(GL_MAX_SAMPLES_ANGLE == GL_MAX_SAMPLES,
+ "GL_MAX_SAMPLES_ANGLE not equal to GL_MAX_SAMPLES");
+ if ((getClientMajorVersion() < 3) && !getExtensions().framebufferMultisample)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
+ if ((getClientMajorVersion() < 3) && !getExtensions().standardDerivatives)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ case GL_TEXTURE_BINDING_3D:
+ if ((getClientMajorVersion() < 3) && !getExtensions().texture3DOES)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_MAX_3D_TEXTURE_SIZE:
+ if ((getClientMajorVersion() < 3) && !getExtensions().texture3DOES)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+
+ if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
+ {
+ if ((getClientVersion() < Version(3, 0)) && !getExtensions().drawBuffers)
+ {
+ return false;
+ }
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+
+ if ((getExtensions().multiview2 || getExtensions().multiview) && pname == GL_MAX_VIEWS_OVR)
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+
+ if (getClientVersion() < Version(2, 0))
+ {
+ switch (pname)
+ {
+ case GL_ALPHA_TEST_FUNC:
+ case GL_CLIENT_ACTIVE_TEXTURE:
+ case GL_MATRIX_MODE:
+ case GL_MAX_TEXTURE_UNITS:
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ case GL_MAX_LIGHTS:
+ case GL_MAX_CLIP_PLANES:
+ case GL_VERTEX_ARRAY_STRIDE:
+ case GL_NORMAL_ARRAY_STRIDE:
+ case GL_COLOR_ARRAY_STRIDE:
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ case GL_VERTEX_ARRAY_SIZE:
+ case GL_COLOR_ARRAY_SIZE:
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ case GL_VERTEX_ARRAY_TYPE:
+ case GL_NORMAL_ARRAY_TYPE:
+ case GL_COLOR_ARRAY_TYPE:
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ case GL_VERTEX_ARRAY_BUFFER_BINDING:
+ case GL_NORMAL_ARRAY_BUFFER_BINDING:
+ case GL_COLOR_ARRAY_BUFFER_BINDING:
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+ case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+ case GL_POINT_SIZE_ARRAY_TYPE_OES:
+ case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+ case GL_SHADE_MODEL:
+ case GL_MODELVIEW_STACK_DEPTH:
+ case GL_PROJECTION_STACK_DEPTH:
+ case GL_TEXTURE_STACK_DEPTH:
+ case GL_LOGIC_OP_MODE:
+ case GL_BLEND_SRC:
+ case GL_BLEND_DST:
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ case GL_POINT_SMOOTH_HINT:
+ case GL_LINE_SMOOTH_HINT:
+ case GL_FOG_HINT:
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_ALPHA_TEST_REF:
+ case GL_FOG_DENSITY:
+ case GL_FOG_START:
+ case GL_FOG_END:
+ case GL_FOG_MODE:
+ case GL_POINT_SIZE:
+ case GL_POINT_SIZE_MIN:
+ case GL_POINT_SIZE_MAX:
+ case GL_POINT_FADE_THRESHOLD_SIZE:
+ *type = GL_FLOAT;
+ *numParams = 1;
+ return true;
+ case GL_SMOOTH_POINT_SIZE_RANGE:
+ case GL_SMOOTH_LINE_WIDTH_RANGE:
+ *type = GL_FLOAT;
+ *numParams = 2;
+ return true;
+ case GL_CURRENT_COLOR:
+ case GL_CURRENT_TEXTURE_COORDS:
+ case GL_LIGHT_MODEL_AMBIENT:
+ case GL_FOG_COLOR:
+ *type = GL_FLOAT;
+ *numParams = 4;
+ return true;
+ case GL_CURRENT_NORMAL:
+ case GL_POINT_DISTANCE_ATTENUATION:
+ *type = GL_FLOAT;
+ *numParams = 3;
+ return true;
+ case GL_MODELVIEW_MATRIX:
+ case GL_PROJECTION_MATRIX:
+ case GL_TEXTURE_MATRIX:
+ *type = GL_FLOAT;
+ *numParams = 16;
+ return true;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getClientVersion() < Version(3, 0))
+ {
+ return false;
+ }
+
+ // Check for ES3.0+ parameter names
+ switch (pname)
+ {
+ case GL_MAX_UNIFORM_BUFFER_BINDINGS:
+ case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
+ case GL_UNIFORM_BUFFER_BINDING:
+ case GL_TRANSFORM_FEEDBACK_BINDING:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ case GL_COPY_READ_BUFFER_BINDING:
+ case GL_COPY_WRITE_BUFFER_BINDING:
+ case GL_SAMPLER_BINDING:
+ case GL_READ_BUFFER:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_2D_ARRAY:
+ case GL_MAX_ARRAY_TEXTURE_LAYERS:
+ case GL_MAX_VERTEX_UNIFORM_BLOCKS:
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
+ case GL_MAX_COMBINED_UNIFORM_BLOCKS:
+ case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
+ case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
+ case GL_MAX_VARYING_COMPONENTS:
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+ case GL_MIN_PROGRAM_TEXEL_OFFSET:
+ case GL_MAX_PROGRAM_TEXEL_OFFSET:
+ 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:
+ case GL_UNPACK_IMAGE_HEIGHT:
+ case GL_UNPACK_SKIP_IMAGES:
+ {
+ *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:
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ case GL_RASTERIZER_DISCARD:
+ {
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+
+ case GL_MAX_TEXTURE_LOD_BIAS:
+ {
+ *type = GL_FLOAT;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getExtensions().requestExtension)
+ {
+ switch (pname)
+ {
+ case GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE:
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getExtensions().textureMultisample)
+ {
+ switch (pname)
+ {
+ case GL_MAX_COLOR_TEXTURE_SAMPLES_ANGLE:
+ case GL_MAX_INTEGER_SAMPLES_ANGLE:
+ case GL_MAX_DEPTH_TEXTURE_SAMPLES_ANGLE:
+ case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ANGLE:
+ case GL_MAX_SAMPLE_MASK_WORDS:
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ if (getClientVersion() < Version(3, 1))
+ {
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_ATOMIC_COUNTER_BUFFER_BINDING:
+ case GL_DRAW_INDIRECT_BUFFER_BINDING:
+ case GL_DISPATCH_INDIRECT_BUFFER_BINDING:
+ case GL_MAX_FRAMEBUFFER_WIDTH:
+ case GL_MAX_FRAMEBUFFER_HEIGHT:
+ case GL_MAX_FRAMEBUFFER_SAMPLES:
+ case GL_MAX_SAMPLE_MASK_WORDS:
+ case GL_MAX_COLOR_TEXTURE_SAMPLES:
+ case GL_MAX_DEPTH_TEXTURE_SAMPLES:
+ case GL_MAX_INTEGER_SAMPLES:
+ case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET:
+ case GL_MAX_VERTEX_ATTRIB_BINDINGS:
+ case GL_MAX_VERTEX_ATTRIB_STRIDE:
+ case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_VERTEX_ATOMIC_COUNTERS:
+ case GL_MAX_VERTEX_IMAGE_UNIFORMS:
+ case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
+ case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_FRAGMENT_ATOMIC_COUNTERS:
+ case GL_MAX_FRAGMENT_IMAGE_UNIFORMS:
+ case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
+ case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET:
+ case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET:
+ case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS:
+ case GL_MAX_COMPUTE_UNIFORM_BLOCKS:
+ case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS:
+ case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE:
+ case GL_MAX_COMPUTE_UNIFORM_COMPONENTS:
+ case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_COMPUTE_ATOMIC_COUNTERS:
+ case GL_MAX_COMPUTE_IMAGE_UNIFORMS:
+ case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS:
+ case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
+ case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
+ case GL_MAX_UNIFORM_LOCATIONS:
+ case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS:
+ case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE:
+ case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_COMBINED_ATOMIC_COUNTERS:
+ case GL_MAX_IMAGE_UNITS:
+ case GL_MAX_COMBINED_IMAGE_UNIFORMS:
+ case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS:
+ case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS:
+ case GL_SHADER_STORAGE_BUFFER_BINDING:
+ case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT:
+ case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
+ case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY:
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
+ *type = GL_INT_64_ANGLEX;
+ *numParams = 1;
+ return true;
+ case GL_SAMPLE_MASK:
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+
+ if (getExtensions().geometryShader)
+ {
+ switch (pname)
+ {
+ case GL_MAX_FRAMEBUFFER_LAYERS_EXT:
+ case GL_LAYER_PROVOKING_VERTEX_EXT:
+ case GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT:
+ case GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT:
+ case GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT:
+ case GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT:
+ case GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT:
+ case GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT:
+ case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT:
+ case GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT:
+ case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT:
+ case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT:
+ case GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT:
+ case GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT:
+ case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT:
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool Context::getIndexedQueryParameterInfo(GLenum target,
+ GLenum *type,
+ unsigned int *numParams) const
+{
+ if (getClientVersion() < Version(3, 0))
+ {
+ 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 true;
+ }
+ }
+
+ if (getClientVersion() < Version(3, 1))
+ {
+ return false;
+ }
+
+ switch (target)
+ {
+ case GL_IMAGE_BINDING_LAYERED:
+ {
+ *type = GL_BOOL;
+ *numParams = 1;
+ return true;
+ }
+ case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
+ case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
+ case GL_ATOMIC_COUNTER_BUFFER_BINDING:
+ case GL_SHADER_STORAGE_BUFFER_BINDING:
+ case GL_VERTEX_BINDING_BUFFER:
+ case GL_VERTEX_BINDING_DIVISOR:
+ case GL_VERTEX_BINDING_OFFSET:
+ case GL_VERTEX_BINDING_STRIDE:
+ case GL_SAMPLE_MASK_VALUE:
+ case GL_IMAGE_BINDING_NAME:
+ case GL_IMAGE_BINDING_LEVEL:
+ case GL_IMAGE_BINDING_LAYER:
+ case GL_IMAGE_BINDING_ACCESS:
+ case GL_IMAGE_BINDING_FORMAT:
+ {
+ *type = GL_INT;
+ *numParams = 1;
+ return true;
+ }
+ case GL_ATOMIC_COUNTER_BUFFER_START:
+ case GL_ATOMIC_COUNTER_BUFFER_SIZE:
+ case GL_SHADER_STORAGE_BUFFER_START:
+ case GL_SHADER_STORAGE_BUFFER_SIZE:
+ {
+ *type = GL_INT_64_ANGLEX;
+ *numParams = 1;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+Program *Context::getProgramNoResolveLink(GLuint handle) const
+{
+ return mState.mShaderProgramManager->getProgram(handle);
+}
+
+Shader *Context::getShader(GLuint handle) const
+{
+ return mState.mShaderProgramManager->getShader(handle);
+}
+
+const angle::FrontendFeatures &Context::getFrontendFeatures() const
+{
+ return mDisplay->getFrontendFeatures();
+}
+
+bool Context::isRenderbufferGenerated(GLuint renderbuffer) const
+{
+ return mState.mRenderbufferManager->isHandleGenerated(renderbuffer);
+}
+
+bool Context::isFramebufferGenerated(GLuint framebuffer) const
+{
+ return mState.mFramebufferManager->isHandleGenerated(framebuffer);
+}
+
+bool Context::isProgramPipelineGenerated(GLuint pipeline) const
+{
+ return mState.mProgramPipelineManager->isHandleGenerated(pipeline);
+}
+
+bool Context::usingDisplayTextureShareGroup() const
+{
+ return mDisplayTextureShareGroup;
+}
+
+GLenum Context::getConvertedRenderbufferFormat(GLenum internalformat) const
+{
+ return mState.mExtensions.webglCompatibility && mState.mClientVersion.major == 2 &&
+ internalformat == GL_DEPTH_STENCIL
+ ? GL_DEPTH24_STENCIL8
+ : internalformat;
+}
+
+void Context::maxShaderCompilerThreads(GLuint count)
+{
+ GLuint oldCount = mState.getMaxShaderCompilerThreads();
+ mState.setMaxShaderCompilerThreads(count);
+ // A count of zero specifies a request for no parallel compiling or linking.
+ if ((oldCount == 0 || count == 0) && (oldCount != 0 || count != 0))
+ {
+ mThreadPool = angle::WorkerThreadPool::Create(count > 0);
+ }
+ mThreadPool->setMaxThreads(count);
+ mImplementation->setMaxShaderCompilerThreads(count);
+}
+
+bool Context::isGLES1() const
+{
+ return mState.getClientVersion() < Version(2, 0);
+}
+
+void Context::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message)
+{
+ switch (index)
+ {
+ case kVertexArraySubjectIndex:
+ switch (message)
+ {
+ case angle::SubjectMessage::ContentsChanged:
+ mState.setObjectDirty(GL_VERTEX_ARRAY);
+ mStateCache.onVertexArrayBufferContentsChange(this);
+ break;
+ case angle::SubjectMessage::SubjectMapped:
+ case angle::SubjectMessage::SubjectUnmapped:
+ case angle::SubjectMessage::BindingChanged:
+ mStateCache.onVertexArrayBufferStateChange(this);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case kReadFramebufferSubjectIndex:
+ ASSERT(message == angle::SubjectMessage::DirtyBitsFlagged);
+ mState.setReadFramebufferDirty();
+ break;
+
+ case kDrawFramebufferSubjectIndex:
+ ASSERT(message == angle::SubjectMessage::DirtyBitsFlagged);
+ mState.setDrawFramebufferDirty();
+ mStateCache.onDrawFramebufferChange(this);
+ break;
+
+ default:
+ if (index < kTextureMaxSubjectIndex)
+ {
+ if (message != angle::SubjectMessage::ContentsChanged)
+ {
+ mState.onActiveTextureStateChange(this, index);
+ mStateCache.onActiveTextureChange(this);
+ }
+ }
+ else if (index < kUniformBufferMaxSubjectIndex)
+ {
+ mState.onUniformBufferStateChange(index - kUniformBuffer0SubjectIndex);
+ mStateCache.onUniformBufferStateChange(this);
+ }
+ else
+ {
+ ASSERT(index < kSamplerMaxSubjectIndex);
+ mState.setSamplerDirty(index - kSampler0SubjectIndex);
+ mState.onActiveTextureStateChange(this, index - kSampler0SubjectIndex);
+ }
+ break;
+ }
+}
+
+angle::Result Context::onProgramLink(Program *programObject)
+{
+ // Don't parallel link a program which is active in any GL contexts. With this assumption, we
+ // don't need to worry that:
+ // 1. Draw calls after link use the new executable code or the old one depending on the link
+ // result.
+ // 2. When a backend program, e.g., ProgramD3D is linking, other backend classes like
+ // StateManager11, Renderer11, etc., may have a chance to make unexpected calls to
+ // ProgramD3D.
+ if (programObject->isInUse())
+ {
+ programObject->resolveLink(this);
+ if (programObject->isLinked())
+ {
+ ANGLE_TRY(mState.onProgramExecutableChange(this, programObject));
+ }
+ mStateCache.onProgramExecutableChange(this);
+ }
+
+ return angle::Result::Continue;
+}
+
+egl::Error Context::setDefaultFramebuffer(egl::Surface *surface)
+{
+ ASSERT(mCurrentSurface == nullptr);
+
+ Framebuffer *newDefault = nullptr;
+ if (surface != nullptr)
+ {
+ ANGLE_TRY(surface->makeCurrent(this));
+ mCurrentSurface = surface;
+ newDefault = surface->createDefaultFramebuffer(this);
+ }
+ else
+ {
+ newDefault = new Framebuffer(mImplementation.get());
+ }
+
+ // Update default framebuffer, the binding of the previous default
+ // framebuffer (or lack of) will have a nullptr.
+ {
+ mState.mFramebufferManager->setDefaultFramebuffer(newDefault);
+ if (mState.getReadFramebuffer() == nullptr)
+ {
+ bindReadFramebuffer(0);
+ }
+ if (mState.getDrawFramebuffer() == nullptr)
+ {
+ bindDrawFramebuffer(0);
+ }
+ }
+
+ return egl::NoError();
+}
+
+egl::Error Context::unsetDefaultFramebuffer()
+{
+ gl::Framebuffer *defaultFramebuffer = mState.mFramebufferManager->getFramebuffer(0);
+
+ // Remove the default framebuffer
+ if (mState.getReadFramebuffer() == defaultFramebuffer)
+ {
+ mState.setReadFramebufferBinding(nullptr);
+ mReadFramebufferObserverBinding.bind(nullptr);
+ }
+
+ if (mState.getDrawFramebuffer() == defaultFramebuffer)
+ {
+ mState.setDrawFramebufferBinding(nullptr);
+ mDrawFramebufferObserverBinding.bind(nullptr);
+ }
+
+ if (defaultFramebuffer)
+ {
+ defaultFramebuffer->onDestroy(this);
+ delete defaultFramebuffer;
+ }
+
+ mState.mFramebufferManager->setDefaultFramebuffer(nullptr);
+
+ // Always unset the current surface, even if setIsCurrent fails.
+ egl::Surface *surface = mCurrentSurface;
+ mCurrentSurface = nullptr;
+ if (surface)
+ {
+ ANGLE_TRY(surface->unMakeCurrent(this));
+ }
+
+ return egl::NoError();
+}
+
+angle::FrameCapture *Context::getFrameCapture()
+{
+ return mDisplay->getFrameCapture();
+}
+
+// ErrorSet implementation.
+ErrorSet::ErrorSet(Context *context) : mContext(context) {}
+
+ErrorSet::~ErrorSet() = default;
+
+void ErrorSet::handleError(GLenum errorCode,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line)
+{
+ if (errorCode == GL_OUT_OF_MEMORY &&
+ mContext->getGraphicsResetStrategy() == GL_LOSE_CONTEXT_ON_RESET_EXT &&
+ mContext->getDisplay()->getFrontendFeatures().loseContextOnOutOfMemory.enabled)
+ {
+ mContext->markContextLost(GraphicsResetStatus::UnknownContextReset);
+ }
+
+ std::stringstream errorStream;
+ errorStream << "Error: " << gl::FmtHex(errorCode) << ", in " << file << ", " << function << ":"
+ << line << ". " << message;
+
+ std::string formattedMessage = errorStream.str();
+
+ // Process the error, but log it with WARN severity so it shows up in logs.
+ ASSERT(errorCode != GL_NO_ERROR);
+ mErrors.insert(errorCode);
+
+ mContext->getState().getDebug().insertMessage(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR,
+ errorCode, GL_DEBUG_SEVERITY_HIGH, message,
+ gl::LOG_WARN);
+}
+
+void ErrorSet::validationError(GLenum errorCode, const char *message)
+{
+ ASSERT(errorCode != GL_NO_ERROR);
+ mErrors.insert(errorCode);
+
+ mContext->getState().getDebug().insertMessage(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR,
+ errorCode, GL_DEBUG_SEVERITY_HIGH, message,
+ gl::LOG_INFO);
+}
+
+bool ErrorSet::empty() const
+{
+ return mErrors.empty();
+}
+
+GLenum ErrorSet::popError()
+{
+ ASSERT(!empty());
+ GLenum error = *mErrors.begin();
+ mErrors.erase(mErrors.begin());
+ return error;
+}
+
+// StateCache implementation.
+StateCache::StateCache()
+ : mCachedHasAnyEnabledClientAttrib(false),
+ mCachedNonInstancedVertexElementLimit(0),
+ mCachedInstancedVertexElementLimit(0),
+ mCachedBasicDrawStatesError(kInvalidPointer),
+ mCachedBasicDrawElementsError(kInvalidPointer),
+ mCachedTransformFeedbackActiveUnpaused(false)
+{}
+
+StateCache::~StateCache() = default;
+
+ANGLE_INLINE void StateCache::updateVertexElementLimits(Context *context)
+{
+ if (context->isBufferAccessValidationEnabled())
+ {
+ updateVertexElementLimitsImpl(context);
+ }
+}
+
+void StateCache::initialize(Context *context)
+{
+ updateValidDrawModes(context);
+ updateValidBindTextureTypes(context);
+ updateValidDrawElementsTypes(context);
+ updateBasicDrawStatesError();
+ updateBasicDrawElementsError();
+ updateVertexAttribTypesValidation(context);
+}
+
+void StateCache::updateActiveAttribsMask(Context *context)
+{
+ bool isGLES1 = context->isGLES1();
+ const State &glState = context->getState();
+
+ if (!isGLES1 && !glState.getProgram())
+ {
+ mCachedActiveBufferedAttribsMask = AttributesMask();
+ mCachedActiveClientAttribsMask = AttributesMask();
+ mCachedActiveDefaultAttribsMask = AttributesMask();
+ return;
+ }
+
+ AttributesMask activeAttribs = isGLES1 ? glState.gles1().getVertexArraysAttributeMask()
+ : glState.getProgram()->getActiveAttribLocationsMask();
+
+ const VertexArray *vao = glState.getVertexArray();
+ ASSERT(vao);
+
+ const AttributesMask &clientAttribs = vao->getClientAttribsMask();
+ const AttributesMask &enabledAttribs = vao->getEnabledAttributesMask();
+ const AttributesMask &activeEnabled = activeAttribs & enabledAttribs;
+
+ mCachedActiveClientAttribsMask = activeEnabled & clientAttribs;
+ mCachedActiveBufferedAttribsMask = activeEnabled & ~clientAttribs;
+ mCachedActiveDefaultAttribsMask = activeAttribs & ~enabledAttribs;
+ mCachedHasAnyEnabledClientAttrib = (clientAttribs & enabledAttribs).any();
+}
+
+void StateCache::updateVertexElementLimitsImpl(Context *context)
+{
+ ASSERT(context->isBufferAccessValidationEnabled());
+
+ const VertexArray *vao = context->getState().getVertexArray();
+
+ mCachedNonInstancedVertexElementLimit = std::numeric_limits<GLint64>::max();
+ mCachedInstancedVertexElementLimit = std::numeric_limits<GLint64>::max();
+
+ // VAO can be null on Context startup. If we make this computation lazier we could ASSERT.
+ // If there are no buffered attributes then we should not limit the draw call count.
+ if (!vao || !mCachedActiveBufferedAttribsMask.any())
+ {
+ return;
+ }
+
+ const auto &vertexAttribs = vao->getVertexAttributes();
+ const auto &vertexBindings = vao->getVertexBindings();
+
+ for (size_t attributeIndex : mCachedActiveBufferedAttribsMask)
+ {
+ const VertexAttribute &attrib = vertexAttribs[attributeIndex];
+
+ const VertexBinding &binding = vertexBindings[attrib.bindingIndex];
+ ASSERT(context->isGLES1() ||
+ context->getState().getProgram()->isAttribLocationActive(attributeIndex));
+
+ GLint64 limit = attrib.getCachedElementLimit();
+ if (binding.getDivisor() > 0)
+ {
+ mCachedInstancedVertexElementLimit =
+ std::min(mCachedInstancedVertexElementLimit, limit);
+ }
+ else
+ {
+ mCachedNonInstancedVertexElementLimit =
+ std::min(mCachedNonInstancedVertexElementLimit, limit);
+ }
+ }
+}
+
+void StateCache::updateBasicDrawStatesError()
+{
+ mCachedBasicDrawStatesError = kInvalidPointer;
+}
+
+void StateCache::updateBasicDrawElementsError()
+{
+ mCachedBasicDrawElementsError = kInvalidPointer;
+}
+
+intptr_t StateCache::getBasicDrawStatesErrorImpl(Context *context) const
+{
+ ASSERT(mCachedBasicDrawStatesError == kInvalidPointer);
+ mCachedBasicDrawStatesError = reinterpret_cast<intptr_t>(ValidateDrawStates(context));
+ return mCachedBasicDrawStatesError;
+}
+
+intptr_t StateCache::getBasicDrawElementsErrorImpl(Context *context) const
+{
+ ASSERT(mCachedBasicDrawElementsError == kInvalidPointer);
+ mCachedBasicDrawElementsError = reinterpret_cast<intptr_t>(ValidateDrawElementsStates(context));
+ return mCachedBasicDrawElementsError;
+}
+
+void StateCache::onVertexArrayBindingChange(Context *context)
+{
+ updateActiveAttribsMask(context);
+ updateVertexElementLimits(context);
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onProgramExecutableChange(Context *context)
+{
+ updateActiveAttribsMask(context);
+ updateVertexElementLimits(context);
+ updateBasicDrawStatesError();
+ updateValidDrawModes(context);
+}
+
+void StateCache::onVertexArrayFormatChange(Context *context)
+{
+ updateVertexElementLimits(context);
+}
+
+void StateCache::onVertexArrayBufferContentsChange(Context *context)
+{
+ updateVertexElementLimits(context);
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onVertexArrayStateChange(Context *context)
+{
+ updateActiveAttribsMask(context);
+ updateVertexElementLimits(context);
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onVertexArrayBufferStateChange(Context *context)
+{
+ updateBasicDrawStatesError();
+ updateBasicDrawElementsError();
+}
+
+void StateCache::onGLES1ClientStateChange(Context *context)
+{
+ updateActiveAttribsMask(context);
+}
+
+void StateCache::onDrawFramebufferChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onContextCapChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onStencilStateChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onDefaultVertexAttributeChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onActiveTextureChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onQueryChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onActiveTransformFeedbackChange(Context *context)
+{
+ updateTransformFeedbackActiveUnpaused(context);
+ updateBasicDrawStatesError();
+ updateBasicDrawElementsError();
+ updateValidDrawModes(context);
+}
+
+void StateCache::onUniformBufferStateChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::onColorMaskChange(Context *context)
+{
+ updateBasicDrawStatesError();
+}
+
+void StateCache::setValidDrawModes(bool pointsOK,
+ bool linesOK,
+ bool trisOK,
+ bool lineAdjOK,
+ bool triAdjOK)
+{
+ mCachedValidDrawModes[PrimitiveMode::Points] = pointsOK;
+ mCachedValidDrawModes[PrimitiveMode::Lines] = linesOK;
+ mCachedValidDrawModes[PrimitiveMode::LineStrip] = linesOK;
+ mCachedValidDrawModes[PrimitiveMode::LineLoop] = linesOK;
+ mCachedValidDrawModes[PrimitiveMode::Triangles] = trisOK;
+ mCachedValidDrawModes[PrimitiveMode::TriangleFan] = trisOK;
+ mCachedValidDrawModes[PrimitiveMode::TriangleStrip] = trisOK;
+ mCachedValidDrawModes[PrimitiveMode::LinesAdjacency] = lineAdjOK;
+ mCachedValidDrawModes[PrimitiveMode::LineStripAdjacency] = lineAdjOK;
+ mCachedValidDrawModes[PrimitiveMode::TrianglesAdjacency] = triAdjOK;
+ mCachedValidDrawModes[PrimitiveMode::TriangleStripAdjacency] = triAdjOK;
+}
+
+void StateCache::updateValidDrawModes(Context *context)
+{
+ const State &state = context->getState();
+ Program *program = state.getProgram();
+
+ if (mCachedTransformFeedbackActiveUnpaused)
+ {
+ TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
+
+ // ES Spec 3.0 validation text:
+ // When transform feedback is active and not paused, all geometric primitives generated must
+ // match the value of primitiveMode passed to BeginTransformFeedback. The error
+ // INVALID_OPERATION is generated by DrawArrays and DrawArraysInstanced if mode is not
+ // identical to primitiveMode. The error INVALID_OPERATION is also generated by
+ // DrawElements, DrawElementsInstanced, and DrawRangeElements while transform feedback is
+ // active and not paused, regardless of mode. Any primitive type may be used while transform
+ // feedback is paused.
+ if (!context->getExtensions().geometryShader)
+ {
+ mCachedValidDrawModes.fill(false);
+ mCachedValidDrawModes[curTransformFeedback->getPrimitiveMode()] = true;
+ return;
+ }
+
+ // EXT_geometry_shader validation text:
+ // When transform feedback is active and not paused, all geometric primitives generated must
+ // be compatible with the value of <primitiveMode> passed to BeginTransformFeedback. If a
+ // geometry shader is active, the type of primitive emitted by that shader is used instead
+ // of the <mode> parameter passed to drawing commands for the purposes of this error check.
+ // Any primitive type may be used while transform feedback is paused.
+ bool pointsOK = curTransformFeedback->getPrimitiveMode() == PrimitiveMode::Points;
+ bool linesOK = curTransformFeedback->getPrimitiveMode() == PrimitiveMode::Lines;
+ bool trisOK = curTransformFeedback->getPrimitiveMode() == PrimitiveMode::Triangles;
+
+ setValidDrawModes(pointsOK, linesOK, trisOK, false, false);
+ return;
+ }
+
+ if (!program || !program->hasLinkedShaderStage(ShaderType::Geometry))
+ {
+ mCachedValidDrawModes = kValidBasicDrawModes;
+ return;
+ }
+
+ ASSERT(program && program->hasLinkedShaderStage(ShaderType::Geometry));
+ PrimitiveMode gsMode = program->getGeometryShaderInputPrimitiveType();
+
+ bool pointsOK = gsMode == PrimitiveMode::Points;
+ bool linesOK = gsMode == PrimitiveMode::Lines;
+ bool trisOK = gsMode == PrimitiveMode::Triangles;
+ bool lineAdjOK = gsMode == PrimitiveMode::LinesAdjacency;
+ bool triAdjOK = gsMode == PrimitiveMode::TrianglesAdjacency;
+
+ setValidDrawModes(pointsOK, linesOK, trisOK, lineAdjOK, triAdjOK);
+}
+
+void StateCache::updateValidBindTextureTypes(Context *context)
+{
+ const Extensions &exts = context->getExtensions();
+ bool isGLES3 = context->getClientMajorVersion() >= 3;
+ bool isGLES31 = context->getClientVersion() >= Version(3, 1);
+
+ mCachedValidBindTextureTypes = {{
+ {TextureType::_2D, true},
+ {TextureType::_2DArray, isGLES3},
+ {TextureType::_2DMultisample, isGLES31 || exts.textureMultisample},
+ {TextureType::_2DMultisampleArray, exts.textureStorageMultisample2DArray},
+ {TextureType::_3D, isGLES3 || exts.texture3DOES},
+ {TextureType::External, exts.eglImageExternal || exts.eglStreamConsumerExternal},
+ {TextureType::Rectangle, exts.textureRectangle},
+ {TextureType::CubeMap, true},
+ }};
+}
+
+void StateCache::updateValidDrawElementsTypes(Context *context)
+{
+ bool supportsUint =
+ (context->getClientMajorVersion() >= 3 || context->getExtensions().elementIndexUint);
+
+ mCachedValidDrawElementsTypes = {{
+ {DrawElementsType::UnsignedByte, true},
+ {DrawElementsType::UnsignedShort, true},
+ {DrawElementsType::UnsignedInt, supportsUint},
+ }};
+}
+
+void StateCache::updateTransformFeedbackActiveUnpaused(Context *context)
+{
+ TransformFeedback *xfb = context->getState().getCurrentTransformFeedback();
+ mCachedTransformFeedbackActiveUnpaused = xfb && xfb->isActive() && !xfb->isPaused();
+}
+
+void StateCache::updateVertexAttribTypesValidation(Context *context)
+{
+ if (context->getClientMajorVersion() <= 2)
+ {
+ mCachedVertexAttribTypesValidation = {{
+ {VertexAttribType::Byte, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Short, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedByte, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedShort, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Float, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Fixed, VertexAttribTypeCase::Valid},
+ }};
+ }
+ else
+ {
+ mCachedVertexAttribTypesValidation = {{
+ {VertexAttribType::Byte, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Short, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Int, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedByte, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedShort, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedInt, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Float, VertexAttribTypeCase::Valid},
+ {VertexAttribType::HalfFloat, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Fixed, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Int2101010, VertexAttribTypeCase::ValidSize4Only},
+ {VertexAttribType::UnsignedInt2101010, VertexAttribTypeCase::ValidSize4Only},
+ }};
+
+ mCachedIntegerVertexAttribTypesValidation = {{
+ {VertexAttribType::Byte, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Short, VertexAttribTypeCase::Valid},
+ {VertexAttribType::Int, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedByte, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedShort, VertexAttribTypeCase::Valid},
+ {VertexAttribType::UnsignedInt, VertexAttribTypeCase::Valid},
+ }};
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Context.h b/gfx/angle/checkout/src/libANGLE/Context.h
new file mode 100644
index 0000000000..d51023edef
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context.h
@@ -0,0 +1,703 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Context.h: Defines the gl::Context class, managing all GL state and performing
+// rendering operations. It is the GLES2 specific implementation of EGLContext.
+
+#ifndef LIBANGLE_CONTEXT_H_
+#define LIBANGLE_CONTEXT_H_
+
+#include <set>
+#include <string>
+
+#include "angle_gl.h"
+#include "common/MemoryBuffer.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Context_gl_1_0_autogen.h"
+#include "libANGLE/Context_gl_1_1_autogen.h"
+#include "libANGLE/Context_gl_1_2_autogen.h"
+#include "libANGLE/Context_gl_1_3_autogen.h"
+#include "libANGLE/Context_gl_1_4_autogen.h"
+#include "libANGLE/Context_gl_1_5_autogen.h"
+#include "libANGLE/Context_gl_2_0_autogen.h"
+#include "libANGLE/Context_gl_2_1_autogen.h"
+#include "libANGLE/Context_gl_3_0_autogen.h"
+#include "libANGLE/Context_gl_3_1_autogen.h"
+#include "libANGLE/Context_gl_3_2_autogen.h"
+#include "libANGLE/Context_gl_3_3_autogen.h"
+#include "libANGLE/Context_gl_4_0_autogen.h"
+#include "libANGLE/Context_gl_4_1_autogen.h"
+#include "libANGLE/Context_gl_4_2_autogen.h"
+#include "libANGLE/Context_gl_4_3_autogen.h"
+#include "libANGLE/Context_gl_4_4_autogen.h"
+#include "libANGLE/Context_gl_4_5_autogen.h"
+#include "libANGLE/Context_gl_4_6_autogen.h"
+#include "libANGLE/Context_gles_1_0_autogen.h"
+#include "libANGLE/Context_gles_2_0_autogen.h"
+#include "libANGLE/Context_gles_3_0_autogen.h"
+#include "libANGLE/Context_gles_3_1_autogen.h"
+#include "libANGLE/Context_gles_ext_autogen.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/HandleAllocator.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/ResourceManager.h"
+#include "libANGLE/ResourceMap.h"
+#include "libANGLE/State.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/WorkerThread.h"
+#include "libANGLE/angletypes.h"
+
+namespace angle
+{
+class FrameCapture;
+struct FrontendFeatures;
+} // namespace angle
+
+namespace rx
+{
+class ContextImpl;
+class EGLImplFactory;
+} // namespace rx
+
+namespace egl
+{
+class AttributeMap;
+class Surface;
+struct Config;
+class Thread;
+} // namespace egl
+
+namespace gl
+{
+class Buffer;
+class Compiler;
+class FenceNV;
+class Framebuffer;
+class GLES1Renderer;
+class MemoryProgramCache;
+class MemoryObject;
+class Program;
+class ProgramPipeline;
+class Query;
+class Renderbuffer;
+class Sampler;
+class Semaphore;
+class Shader;
+class Sync;
+class Texture;
+class TransformFeedback;
+class VertexArray;
+struct VertexAttribute;
+
+class ErrorSet : angle::NonCopyable
+{
+ public:
+ explicit ErrorSet(Context *context);
+ ~ErrorSet();
+
+ bool empty() const;
+ GLenum popError();
+
+ void handleError(GLenum errorCode,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line);
+
+ void validationError(GLenum errorCode, const char *message);
+
+ private:
+ Context *mContext;
+ std::set<GLenum> mErrors;
+};
+
+enum class VertexAttribTypeCase
+{
+ Invalid = 0,
+ Valid = 1,
+ ValidSize4Only = 2,
+};
+
+// Helper class for managing cache variables and state changes.
+class StateCache final : angle::NonCopyable
+{
+ public:
+ StateCache();
+ ~StateCache();
+
+ void initialize(Context *context);
+
+ // Places that can trigger updateActiveAttribsMask:
+ // 1. onVertexArrayBindingChange.
+ // 2. onProgramExecutableChange.
+ // 3. onVertexArrayStateChange.
+ // 4. onGLES1ClientStateChange.
+ AttributesMask getActiveBufferedAttribsMask() const { return mCachedActiveBufferedAttribsMask; }
+ AttributesMask getActiveClientAttribsMask() const { return mCachedActiveClientAttribsMask; }
+ AttributesMask getActiveDefaultAttribsMask() const { return mCachedActiveDefaultAttribsMask; }
+ bool hasAnyEnabledClientAttrib() const { return mCachedHasAnyEnabledClientAttrib; }
+ bool hasAnyActiveClientAttrib() const { return mCachedActiveClientAttribsMask.any(); }
+
+ // Places that can trigger updateVertexElementLimits:
+ // 1. onVertexArrayBindingChange.
+ // 2. onProgramExecutableChange.
+ // 3. onVertexArrayFormatChange.
+ // 4. onVertexArrayBufferChange.
+ // 5. onVertexArrayStateChange.
+ GLint64 getNonInstancedVertexElementLimit() const
+ {
+ return mCachedNonInstancedVertexElementLimit;
+ }
+ GLint64 getInstancedVertexElementLimit() const { return mCachedInstancedVertexElementLimit; }
+
+ // Places that can trigger updateBasicDrawStatesError:
+ // 1. onVertexArrayBindingChange.
+ // 2. onProgramExecutableChange.
+ // 3. onVertexArrayBufferContentsChange.
+ // 4. onVertexArrayStateChange.
+ // 5. onVertexArrayBufferStateChange.
+ // 6. onDrawFramebufferChange.
+ // 7. onContextCapChange.
+ // 8. onStencilStateChange.
+ // 9. onDefaultVertexAttributeChange.
+ // 10. onActiveTextureChange.
+ // 11. onQueryChange.
+ // 12. onActiveTransformFeedbackChange.
+ // 13. onUniformBufferStateChange.
+ // 14. onColorMaskChange.
+ // 15. onBufferBindingChange.
+ bool hasBasicDrawStatesError(Context *context) const
+ {
+ if (mCachedBasicDrawStatesError == 0)
+ {
+ return false;
+ }
+ if (mCachedBasicDrawStatesError != kInvalidPointer)
+ {
+ return true;
+ }
+ return getBasicDrawStatesErrorImpl(context) != 0;
+ }
+
+ intptr_t getBasicDrawStatesError(Context *context) const
+ {
+ if (mCachedBasicDrawStatesError != kInvalidPointer)
+ {
+ return mCachedBasicDrawStatesError;
+ }
+
+ return getBasicDrawStatesErrorImpl(context);
+ }
+
+ // Places that can trigger updateBasicDrawElementsError:
+ // 1. onActiveTransformFeedbackChange.
+ // 2. onVertexArrayBufferStateChange.
+ // 3. onBufferBindingChange.
+ intptr_t getBasicDrawElementsError(Context *context) const
+ {
+ if (mCachedBasicDrawElementsError != kInvalidPointer)
+ {
+ return mCachedBasicDrawElementsError;
+ }
+
+ return getBasicDrawElementsErrorImpl(context);
+ }
+
+ // Places that can trigger updateValidDrawModes:
+ // 1. onProgramExecutableChange.
+ // 2. onActiveTransformFeedbackChange.
+ bool isValidDrawMode(PrimitiveMode primitiveMode) const
+ {
+ return mCachedValidDrawModes[primitiveMode];
+ }
+
+ // Cannot change except on Context/Extension init.
+ bool isValidBindTextureType(TextureType type) const
+ {
+ return mCachedValidBindTextureTypes[type];
+ }
+
+ // Cannot change except on Context/Extension init.
+ bool isValidDrawElementsType(DrawElementsType type) const
+ {
+ return mCachedValidDrawElementsTypes[type];
+ }
+
+ // Places that can trigger updateTransformFeedbackActiveUnpaused:
+ // 1. onActiveTransformFeedbackChange.
+ bool isTransformFeedbackActiveUnpaused() const
+ {
+ return mCachedTransformFeedbackActiveUnpaused;
+ }
+
+ // Cannot change except on Context/Extension init.
+ VertexAttribTypeCase getVertexAttribTypeValidation(VertexAttribType type) const
+ {
+ return mCachedVertexAttribTypesValidation[type];
+ }
+
+ VertexAttribTypeCase getIntegerVertexAttribTypeValidation(VertexAttribType type) const
+ {
+ return mCachedIntegerVertexAttribTypesValidation[type];
+ }
+
+ // State change notifications.
+ void onVertexArrayBindingChange(Context *context);
+ void onProgramExecutableChange(Context *context);
+ void onVertexArrayFormatChange(Context *context);
+ void onVertexArrayBufferContentsChange(Context *context);
+ void onVertexArrayStateChange(Context *context);
+ void onVertexArrayBufferStateChange(Context *context);
+ void onGLES1ClientStateChange(Context *context);
+ void onDrawFramebufferChange(Context *context);
+ void onContextCapChange(Context *context);
+ void onStencilStateChange(Context *context);
+ void onDefaultVertexAttributeChange(Context *context);
+ void onActiveTextureChange(Context *context);
+ void onQueryChange(Context *context);
+ void onActiveTransformFeedbackChange(Context *context);
+ void onUniformBufferStateChange(Context *context);
+ void onColorMaskChange(Context *context);
+ void onBufferBindingChange(Context *context);
+
+ private:
+ // Cache update functions.
+ void updateActiveAttribsMask(Context *context);
+ void updateVertexElementLimits(Context *context);
+ void updateVertexElementLimitsImpl(Context *context);
+ void updateValidDrawModes(Context *context);
+ void updateValidBindTextureTypes(Context *context);
+ void updateValidDrawElementsTypes(Context *context);
+ void updateBasicDrawStatesError();
+ void updateBasicDrawElementsError();
+ void updateTransformFeedbackActiveUnpaused(Context *context);
+ void updateVertexAttribTypesValidation(Context *context);
+
+ void setValidDrawModes(bool pointsOK, bool linesOK, bool trisOK, bool lineAdjOK, bool triAdjOK);
+
+ intptr_t getBasicDrawStatesErrorImpl(Context *context) const;
+ intptr_t getBasicDrawElementsErrorImpl(Context *context) const;
+
+ static constexpr intptr_t kInvalidPointer = 1;
+
+ AttributesMask mCachedActiveBufferedAttribsMask;
+ AttributesMask mCachedActiveClientAttribsMask;
+ AttributesMask mCachedActiveDefaultAttribsMask;
+ bool mCachedHasAnyEnabledClientAttrib;
+ GLint64 mCachedNonInstancedVertexElementLimit;
+ GLint64 mCachedInstancedVertexElementLimit;
+ mutable intptr_t mCachedBasicDrawStatesError;
+ mutable intptr_t mCachedBasicDrawElementsError;
+ bool mCachedTransformFeedbackActiveUnpaused;
+
+ // Reserve an extra slot at the end of these maps for invalid enum.
+ angle::PackedEnumMap<PrimitiveMode, bool, angle::EnumSize<PrimitiveMode>() + 1>
+ mCachedValidDrawModes;
+ angle::PackedEnumMap<TextureType, bool, angle::EnumSize<TextureType>() + 1>
+ mCachedValidBindTextureTypes;
+ angle::PackedEnumMap<DrawElementsType, bool, angle::EnumSize<DrawElementsType>() + 1>
+ mCachedValidDrawElementsTypes;
+ angle::PackedEnumMap<VertexAttribType,
+ VertexAttribTypeCase,
+ angle::EnumSize<VertexAttribType>() + 1>
+ mCachedVertexAttribTypesValidation;
+ angle::PackedEnumMap<VertexAttribType,
+ VertexAttribTypeCase,
+ angle::EnumSize<VertexAttribType>() + 1>
+ mCachedIntegerVertexAttribTypesValidation;
+};
+
+class Context final : public egl::LabeledObject, angle::NonCopyable, public angle::ObserverInterface
+{
+ public:
+ Context(egl::Display *display,
+ const egl::Config *config,
+ const Context *shareContext,
+ TextureManager *shareTextures,
+ MemoryProgramCache *memoryProgramCache,
+ const EGLenum clientType,
+ const egl::AttributeMap &attribs,
+ const egl::DisplayExtensions &displayExtensions,
+ const egl::ClientExtensions &clientExtensions);
+
+ egl::Error onDestroy(const egl::Display *display);
+ ~Context() override;
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ egl::Error makeCurrent(egl::Display *display, egl::Surface *surface);
+ egl::Error unMakeCurrent(const egl::Display *display);
+
+ // These create and destroy methods are merely pass-throughs to
+ // ResourceManager, which owns these object types
+ GLuint createBuffer();
+ GLuint createTexture();
+ GLuint createRenderbuffer();
+ GLuint createProgramPipeline();
+ GLuint createMemoryObject();
+ GLuint createSemaphore();
+
+ void deleteBuffer(GLuint buffer);
+ void deleteTexture(GLuint texture);
+ void deleteRenderbuffer(GLuint renderbuffer);
+ void deleteProgramPipeline(GLuint pipeline);
+ void deleteMemoryObject(GLuint memoryObject);
+ void deleteSemaphore(GLuint semaphore);
+
+ // CHROMIUM_path_rendering
+ bool isPathGenerated(GLuint path) const;
+
+ void bindReadFramebuffer(GLuint framebufferHandle);
+ void bindDrawFramebuffer(GLuint framebufferHandle);
+
+ Buffer *getBuffer(GLuint handle) const;
+ FenceNV *getFenceNV(GLuint handle);
+ Sync *getSync(GLsync handle) const;
+ ANGLE_INLINE Texture *getTexture(GLuint handle) const
+ {
+ return mState.mTextureManager->getTexture(handle);
+ }
+
+ Framebuffer *getFramebuffer(GLuint handle) const;
+ Renderbuffer *getRenderbuffer(GLuint handle) const;
+ VertexArray *getVertexArray(GLuint handle) const;
+ Sampler *getSampler(GLuint handle) const;
+ Query *getQuery(GLuint handle, bool create, QueryType type);
+ Query *getQuery(GLuint handle) const;
+ TransformFeedback *getTransformFeedback(GLuint handle) const;
+ ProgramPipeline *getProgramPipeline(GLuint handle) const;
+ MemoryObject *getMemoryObject(GLuint handle) const;
+ Semaphore *getSemaphore(GLuint handle) const;
+
+ Texture *getTextureByType(TextureType type) const;
+ Texture *getTextureByTarget(TextureTarget target) const;
+ Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
+
+ Compiler *getCompiler() const;
+
+ bool isVertexArrayGenerated(GLuint vertexArray);
+ bool isTransformFeedbackGenerated(GLuint vertexArray);
+
+ void getBooleanvImpl(GLenum pname, GLboolean *params);
+ void getFloatvImpl(GLenum pname, GLfloat *params);
+ void getIntegervImpl(GLenum pname, GLint *params);
+ void getInteger64vImpl(GLenum pname, GLint64 *params);
+ void getPointerv(GLenum pname, void **params) const;
+
+ // Framebuffers are owned by the Context, so these methods do not pass through
+ GLuint createFramebuffer();
+ void deleteFramebuffer(GLuint framebuffer);
+
+ bool hasActiveTransformFeedback(GLuint program) const;
+
+ // GL emulation: Interface to entry points
+ ANGLE_GL_1_0_CONTEXT_API
+ ANGLE_GL_1_1_CONTEXT_API
+ ANGLE_GL_1_2_CONTEXT_API
+ ANGLE_GL_1_3_CONTEXT_API
+ ANGLE_GL_1_4_CONTEXT_API
+ ANGLE_GL_1_5_CONTEXT_API
+ ANGLE_GL_2_0_CONTEXT_API
+ ANGLE_GL_2_1_CONTEXT_API
+ ANGLE_GL_3_0_CONTEXT_API
+ ANGLE_GL_3_1_CONTEXT_API
+ ANGLE_GL_3_2_CONTEXT_API
+ ANGLE_GL_3_3_CONTEXT_API
+ ANGLE_GL_4_0_CONTEXT_API
+ ANGLE_GL_4_1_CONTEXT_API
+ ANGLE_GL_4_2_CONTEXT_API
+ ANGLE_GL_4_3_CONTEXT_API
+ ANGLE_GL_4_4_CONTEXT_API
+ ANGLE_GL_4_5_CONTEXT_API
+ ANGLE_GL_4_6_CONTEXT_API
+
+ // GLES emulation: Interface to entry points
+ ANGLE_GLES_1_0_CONTEXT_API
+ ANGLE_GLES_2_0_CONTEXT_API
+ ANGLE_GLES_3_0_CONTEXT_API
+ ANGLE_GLES_3_1_CONTEXT_API
+ ANGLE_GLES_EXT_CONTEXT_API
+
+ // Consumes an error.
+ void handleError(GLenum errorCode,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line);
+
+ void validationError(GLenum errorCode, const char *message);
+
+ void markContextLost(GraphicsResetStatus status);
+
+ bool isContextLost() const { return mContextLost; }
+
+ GLenum getGraphicsResetStrategy() const { return mResetStrategy; }
+ bool isResetNotificationEnabled();
+
+ const egl::Config *getConfig() const;
+ EGLenum getClientType() const;
+ EGLenum getRenderBuffer() const;
+
+ const GLubyte *getString(GLenum name) const;
+ const GLubyte *getStringi(GLenum name, GLuint index) const;
+
+ size_t getExtensionStringCount() const;
+
+ bool isExtensionRequestable(const char *name);
+ size_t getRequestableExtensionStringCount() const;
+
+ rx::ContextImpl *getImplementation() const { return mImplementation.get(); }
+
+ ANGLE_NO_DISCARD bool getScratchBuffer(size_t requestedSizeBytes,
+ angle::MemoryBuffer **scratchBufferOut) const;
+ ANGLE_NO_DISCARD bool getZeroFilledBuffer(size_t requstedSizeBytes,
+ angle::MemoryBuffer **zeroBufferOut) const;
+ angle::ScratchBuffer *getScratchBuffer() const { return &mScratchBuffer; }
+
+ angle::Result prepareForDispatch();
+
+ MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; }
+
+ bool hasBeenCurrent() const { return mHasBeenCurrent; }
+ egl::Display *getDisplay() const { return mDisplay; }
+ egl::Surface *getCurrentDrawSurface() const { return mCurrentSurface; }
+ egl::Surface *getCurrentReadSurface() const { return mCurrentSurface; }
+
+ bool isRobustResourceInitEnabled() const { return mState.isRobustResourceInitEnabled(); }
+
+ bool isCurrentTransformFeedback(const TransformFeedback *tf) const;
+
+ bool isCurrentVertexArray(const VertexArray *va) const
+ {
+ return mState.isCurrentVertexArray(va);
+ }
+
+ const State &getState() const { return mState; }
+ GLint getClientMajorVersion() const { return mState.getClientMajorVersion(); }
+ GLint getClientMinorVersion() const { return mState.getClientMinorVersion(); }
+ const Version &getClientVersion() const { return mState.getClientVersion(); }
+ const Caps &getCaps() const { return mState.getCaps(); }
+ const TextureCapsMap &getTextureCaps() const { return mState.getTextureCaps(); }
+ const Extensions &getExtensions() const { return mState.getExtensions(); }
+ const Limitations &getLimitations() const { return mState.getLimitations(); }
+ bool skipValidation() const { return mSkipValidation; }
+ bool isGLES1() const;
+
+ // Specific methods needed for validation.
+ bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) const;
+ bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams) const;
+
+ ANGLE_INLINE Program *getProgramResolveLink(GLuint handle) const
+ {
+ Program *program = mState.mShaderProgramManager->getProgram(handle);
+ if (program)
+ {
+ program->resolveLink(this);
+ }
+ return program;
+ }
+
+ Program *getProgramNoResolveLink(GLuint handle) const;
+ Shader *getShader(GLuint handle) const;
+
+ ANGLE_INLINE bool isTextureGenerated(GLuint texture) const
+ {
+ return mState.mTextureManager->isHandleGenerated(texture);
+ }
+
+ ANGLE_INLINE bool isBufferGenerated(GLuint buffer) const
+ {
+ return mState.mBufferManager->isHandleGenerated(buffer);
+ }
+
+ bool isRenderbufferGenerated(GLuint renderbuffer) const;
+ bool isFramebufferGenerated(GLuint framebuffer) const;
+ bool isProgramPipelineGenerated(GLuint pipeline) const;
+
+ bool usingDisplayTextureShareGroup() const;
+
+ // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
+ GLenum getConvertedRenderbufferFormat(GLenum internalformat) const;
+
+ bool isWebGL() const { return mState.isWebGL(); }
+ bool isWebGL1() const { return mState.isWebGL1(); }
+
+ bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; }
+
+ // GLES1 emulation: Renderer level (for validation)
+ int vertexArrayIndex(ClientVertexArrayType type) const;
+ static int TexCoordArrayIndex(unsigned int unit);
+
+ // GL_KHR_parallel_shader_compile
+ std::shared_ptr<angle::WorkerThreadPool> getWorkerThreadPool() const { return mThreadPool; }
+
+ const StateCache &getStateCache() const { return mStateCache; }
+ StateCache &getStateCache() { return mStateCache; }
+
+ void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
+
+ void onSamplerUniformChange(size_t textureUnitIndex);
+
+ bool isBufferAccessValidationEnabled() const { return mBufferAccessValidationEnabled; }
+
+ const angle::FrontendFeatures &getFrontendFeatures() const;
+
+ angle::FrameCapture *getFrameCapture();
+
+ private:
+ void initialize();
+
+ bool noopDraw(PrimitiveMode mode, GLsizei count);
+ bool noopDrawInstanced(PrimitiveMode mode, GLsizei count, GLsizei instanceCount);
+
+ angle::Result prepareForDraw(PrimitiveMode mode);
+ angle::Result prepareForClear(GLbitfield mask);
+ angle::Result prepareForClearBuffer(GLenum buffer, GLint drawbuffer);
+ angle::Result syncState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask);
+ angle::Result syncDirtyBits();
+ angle::Result syncDirtyBits(const State::DirtyBits &bitMask);
+ angle::Result syncDirtyObjects(const State::DirtyObjects &objectMask);
+ angle::Result syncStateForReadPixels();
+ angle::Result syncStateForTexImage();
+ angle::Result syncStateForBlit();
+ angle::Result syncStateForPathOperation();
+
+ VertexArray *checkVertexArrayAllocation(GLuint vertexArrayHandle);
+ TransformFeedback *checkTransformFeedbackAllocation(GLuint transformFeedback);
+
+ angle::Result onProgramLink(Program *programObject);
+
+ void detachBuffer(Buffer *buffer);
+ void detachTexture(GLuint texture);
+ void detachFramebuffer(GLuint framebuffer);
+ void detachRenderbuffer(GLuint renderbuffer);
+ void detachVertexArray(GLuint vertexArray);
+ void detachTransformFeedback(GLuint transformFeedback);
+ void detachSampler(GLuint sampler);
+ void detachProgramPipeline(GLuint pipeline);
+
+ // A small helper method to facilitate using the ANGLE_CONTEXT_TRY macro.
+ void tryGenPaths(GLsizei range, GLuint *createdOut);
+
+ egl::Error setDefaultFramebuffer(egl::Surface *surface);
+ egl::Error unsetDefaultFramebuffer();
+
+ void initRendererString();
+ void initVersionStrings();
+ void initExtensionStrings();
+
+ Extensions generateSupportedExtensions() const;
+ void initCaps();
+ void updateCaps();
+
+ gl::LabeledObject *getLabeledObject(GLenum identifier, GLuint name) const;
+ gl::LabeledObject *getLabeledObjectFromPtr(const void *ptr) const;
+
+ void setUniform1iImpl(Program *program, GLint location, GLsizei count, const GLint *v);
+
+ State mState;
+ bool mSkipValidation;
+ bool mDisplayTextureShareGroup;
+
+ // Recorded errors
+ ErrorSet mErrors;
+
+ // Stores for each buffer binding type whether is it allowed to be used in this context.
+ angle::PackedEnumBitSet<BufferBinding> mValidBufferBindings;
+
+ std::unique_ptr<rx::ContextImpl> mImplementation;
+
+ EGLLabelKHR mLabel;
+
+ // Extensions supported by the implementation plus extensions that are implemented entirely
+ // within the frontend.
+ Extensions mSupportedExtensions;
+
+ // Shader compiler. Lazily initialized hence the mutable value.
+ mutable BindingPointer<Compiler> mCompiler;
+
+ const egl::Config *mConfig;
+
+ TextureMap mZeroTextures;
+
+ ResourceMap<FenceNV> mFenceNVMap;
+ HandleAllocator mFenceNVHandleAllocator;
+
+ ResourceMap<Query> mQueryMap;
+ HandleAllocator mQueryHandleAllocator;
+
+ ResourceMap<VertexArray> mVertexArrayMap;
+ HandleAllocator mVertexArrayHandleAllocator;
+
+ ResourceMap<TransformFeedback> mTransformFeedbackMap;
+ HandleAllocator mTransformFeedbackHandleAllocator;
+
+ const char *mVersionString;
+ const char *mShadingLanguageString;
+ const char *mRendererString;
+ const char *mExtensionString;
+ std::vector<const char *> mExtensionStrings;
+ const char *mRequestableExtensionString;
+ std::vector<const char *> mRequestableExtensionStrings;
+
+ // GLES1 renderer state
+ std::unique_ptr<GLES1Renderer> mGLES1Renderer;
+
+ // Current/lost context flags
+ bool mHasBeenCurrent;
+ bool mContextLost;
+ GraphicsResetStatus mResetStatus;
+ bool mContextLostForced;
+ GLenum mResetStrategy;
+ const bool mRobustAccess;
+ const bool mSurfacelessSupported;
+ const bool mExplicitContextAvailable;
+ egl::Surface *mCurrentSurface;
+ egl::Display *mDisplay;
+ const bool mWebGLContext;
+ bool mBufferAccessValidationEnabled;
+ const bool mExtensionsEnabled;
+ MemoryProgramCache *mMemoryProgramCache;
+
+ State::DirtyObjects mDrawDirtyObjects;
+ State::DirtyObjects mPathOperationDirtyObjects;
+
+ StateCache mStateCache;
+
+ State::DirtyBits mAllDirtyBits;
+ State::DirtyBits mTexImageDirtyBits;
+ State::DirtyObjects mTexImageDirtyObjects;
+ State::DirtyBits mReadPixelsDirtyBits;
+ State::DirtyObjects mReadPixelsDirtyObjects;
+ State::DirtyBits mClearDirtyBits;
+ State::DirtyObjects mClearDirtyObjects;
+ State::DirtyBits mBlitDirtyBits;
+ State::DirtyObjects mBlitDirtyObjects;
+ State::DirtyBits mComputeDirtyBits;
+ State::DirtyObjects mComputeDirtyObjects;
+ State::DirtyObjects mCopyImageDirtyObjects;
+
+ // Binding to container objects that use dependent state updates.
+ angle::ObserverBinding mVertexArrayObserverBinding;
+ angle::ObserverBinding mDrawFramebufferObserverBinding;
+ angle::ObserverBinding mReadFramebufferObserverBinding;
+ std::vector<angle::ObserverBinding> mUniformBufferObserverBindings;
+ std::vector<angle::ObserverBinding> mSamplerObserverBindings;
+
+ // Not really a property of context state. The size and contexts change per-api-call.
+ mutable angle::ScratchBuffer mScratchBuffer;
+ mutable angle::ScratchBuffer mZeroFilledBuffer;
+
+ std::shared_ptr<angle::WorkerThreadPool> mThreadPool;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_CONTEXT_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context.inl.h b/gfx/angle/checkout/src/libANGLE/Context.inl.h
new file mode 100644
index 0000000000..4738160c3f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context.inl.h
@@ -0,0 +1,135 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Context.inl.h: Defines inline functions of gl::Context class
+// Has to be included after libANGLE/Context.h when using one
+// of the defined functions
+
+#ifndef LIBANGLE_CONTEXT_INL_H_
+#define LIBANGLE_CONTEXT_INL_H_
+
+#include "libANGLE/GLES1Renderer.h"
+#include "libANGLE/renderer/ContextImpl.h"
+
+#define ANGLE_HANDLE_ERR(X) \
+ (void)(X); \
+ return;
+#define ANGLE_CONTEXT_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_HANDLE_ERR)
+
+namespace gl
+{
+constexpr angle::PackedEnumMap<PrimitiveMode, GLsizei> kMinimumPrimitiveCounts = {{
+ {PrimitiveMode::Points, 1},
+ {PrimitiveMode::Lines, 2},
+ {PrimitiveMode::LineLoop, 2},
+ {PrimitiveMode::LineStrip, 2},
+ {PrimitiveMode::Triangles, 3},
+ {PrimitiveMode::TriangleStrip, 3},
+ {PrimitiveMode::TriangleFan, 3},
+ {PrimitiveMode::LinesAdjacency, 2},
+ {PrimitiveMode::LineStripAdjacency, 2},
+ {PrimitiveMode::TrianglesAdjacency, 3},
+ {PrimitiveMode::TriangleStripAdjacency, 3},
+}};
+
+ANGLE_INLINE void MarkTransformFeedbackBufferUsage(const Context *context,
+ GLsizei count,
+ GLsizei instanceCount)
+{
+ if (context->getStateCache().isTransformFeedbackActiveUnpaused())
+ {
+ TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ transformFeedback->onVerticesDrawn(context, count, instanceCount);
+ }
+}
+
+// Return true if the draw is a no-op, else return false.
+// A no-op draw occurs if the count of vertices is less than the minimum required to
+// have a valid primitive for this mode (0 for points, 0-1 for lines, 0-2 for tris).
+ANGLE_INLINE bool Context::noopDraw(PrimitiveMode mode, GLsizei count)
+{
+ return count < kMinimumPrimitiveCounts[mode];
+}
+
+ANGLE_INLINE angle::Result Context::syncDirtyBits()
+{
+ const State::DirtyBits &dirtyBits = mState.getDirtyBits();
+ ANGLE_TRY(mImplementation->syncState(this, dirtyBits, mAllDirtyBits));
+ mState.clearDirtyBits();
+ return angle::Result::Continue;
+}
+
+ANGLE_INLINE angle::Result Context::syncDirtyBits(const State::DirtyBits &bitMask)
+{
+ const State::DirtyBits &dirtyBits = (mState.getDirtyBits() & bitMask);
+ ANGLE_TRY(mImplementation->syncState(this, dirtyBits, bitMask));
+ mState.clearDirtyBits(dirtyBits);
+ return angle::Result::Continue;
+}
+
+ANGLE_INLINE angle::Result Context::syncDirtyObjects(const State::DirtyObjects &objectMask)
+{
+ return mState.syncDirtyObjects(this, objectMask);
+}
+
+ANGLE_INLINE angle::Result Context::prepareForDraw(PrimitiveMode mode)
+{
+ if (mGLES1Renderer)
+ {
+ ANGLE_TRY(mGLES1Renderer->prepareForDraw(mode, this, &mState));
+ }
+
+ ANGLE_TRY(syncDirtyObjects(mDrawDirtyObjects));
+ ASSERT(!isRobustResourceInitEnabled() ||
+ !mState.getDrawFramebuffer()->hasResourceThatNeedsInit());
+ return syncDirtyBits();
+}
+
+ANGLE_INLINE void Context::drawArrays(PrimitiveMode mode, GLint first, GLsizei count)
+{
+ // No-op if count draws no primitives for given mode
+ if (noopDraw(mode, count))
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ ANGLE_CONTEXT_TRY(mImplementation->drawArrays(this, mode, first, count));
+ MarkTransformFeedbackBufferUsage(this, count, 1);
+}
+
+ANGLE_INLINE void Context::drawElements(PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices)
+{
+ // No-op if count draws no primitives for given mode
+ if (noopDraw(mode, count))
+ {
+ return;
+ }
+
+ ANGLE_CONTEXT_TRY(prepareForDraw(mode));
+ ANGLE_CONTEXT_TRY(mImplementation->drawElements(this, mode, count, type, indices));
+}
+
+ANGLE_INLINE void StateCache::onBufferBindingChange(Context *context)
+{
+ updateBasicDrawStatesError();
+ updateBasicDrawElementsError();
+}
+
+ANGLE_INLINE void Context::bindBuffer(BufferBinding target, GLuint buffer)
+{
+ Buffer *bufferObject =
+ mState.mBufferManager->checkBufferAllocation(mImplementation.get(), buffer);
+ mState.setBufferBinding(this, target, bufferObject);
+ mStateCache.onBufferBindingChange(this);
+}
+
+} // namespace gl
+
+#endif // LIBANGLE_CONTEXT_INL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl.cpp b/gfx/angle/checkout/src/libANGLE/Context_gl.cpp
new file mode 100644
index 0000000000..f3e753fb14
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl.cpp
@@ -0,0 +1,3860 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl.cpp: Implements the GL specific parts of Context.
+
+#include "Context.h"
+#include "common/debug.h"
+
+namespace gl
+{
+
+void Context::compressedTexImage1D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::compressedTexSubImage1D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getCompressedTexImage(GLenum target, GLint level, void *img)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::loadTransposeMatrixd(const GLdouble *m)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::loadTransposeMatrixf(const GLfloat *m)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multTransposeMatrixd(const GLdouble *m)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multTransposeMatrixf(const GLfloat *m)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1d(GLenum target, GLdouble s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1dv(GLenum target, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1f(GLenum target, GLfloat s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1fv(GLenum target, const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1i(GLenum target, GLint s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1iv(GLenum target, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1s(GLenum target, GLshort s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord1sv(GLenum target, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2d(GLenum target, GLdouble s, GLdouble t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2dv(GLenum target, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2fv(GLenum target, const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2i(GLenum target, GLint s, GLint t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2iv(GLenum target, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2s(GLenum target, GLshort s, GLshort t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord2sv(GLenum target, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3dv(GLenum target, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3fv(GLenum target, const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3i(GLenum target, GLint s, GLint t, GLint r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3iv(GLenum target, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord3sv(GLenum target, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord4dv(GLenum target, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord4fv(GLenum target, const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord4iv(GLenum target, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoord4sv(GLenum target, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getVertexAttribdv(GLuint index, GLenum pname, GLdouble *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib1d(GLuint index, GLdouble x)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib1dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib1s(GLuint index, GLshort x)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib1sv(GLuint index, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib2d(GLuint index, GLdouble x, GLdouble y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib2dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib2s(GLuint index, GLshort x, GLshort y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib2sv(GLuint index, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib3dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib3sv(GLuint index, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4Nbv(GLuint index, const GLbyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4Niv(GLuint index, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4Nsv(GLuint index, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4Nubv(GLuint index, const GLubyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4Nuiv(GLuint index, const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4Nusv(GLuint index, const GLushort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4bv(GLuint index, const GLbyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4iv(GLuint index, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4sv(GLuint index, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4ubv(GLuint index, const GLubyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4uiv(GLuint index, const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttrib4usv(GLuint index, const GLushort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::beginConditionalRender(GLuint id, GLenum mode)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clampColor(GLenum target, GLenum clamp)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::colorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::disablei(GLenum target, GLuint index)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::enablei(GLenum target, GLuint index)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::endConditionalRender()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::framebufferTexture1D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ UNIMPLEMENTED();
+}
+
+GLboolean Context::isEnabledi(GLenum target, GLuint index)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+void Context::vertexAttribI1i(GLuint index, GLint x)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI1iv(GLuint index, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI1ui(GLuint index, GLuint x)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI1uiv(GLuint index, const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI2i(GLuint index, GLint x, GLint y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI2iv(GLuint index, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI2ui(GLuint index, GLuint x, GLuint y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI2uiv(GLuint index, const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI3i(GLuint index, GLint x, GLint y, GLint z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI3iv(GLuint index, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI3uiv(GLuint index, const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI4bv(GLuint index, const GLbyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI4sv(GLuint index, const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI4ubv(GLuint index, const GLubyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribI4usv(GLuint index, const GLushort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getActiveUniformName(GLuint program,
+ GLuint uniformIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformName)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::primitiveRestartIndex(GLuint index)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texBuffer(GLenum target, GLenum internalformat, GLuint buffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::fogCoordPointer(GLenum type, GLsizei stride, const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::fogCoordd(GLdouble coord)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::fogCoorddv(const GLdouble *coord)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::fogCoordf(GLfloat coord)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::fogCoordfv(const GLfloat *coord)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pointParameteri(GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pointParameteriv(GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3b(GLbyte red, GLbyte green, GLbyte blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3bv(const GLbyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3d(GLdouble red, GLdouble green, GLdouble blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3f(GLfloat red, GLfloat green, GLfloat blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3i(GLint red, GLint green, GLint blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3s(GLshort red, GLshort green, GLshort blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3ubv(const GLubyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3ui(GLuint red, GLuint green, GLuint blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3uiv(const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3us(GLushort red, GLushort green, GLushort blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColor3usv(const GLushort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2d(GLdouble x, GLdouble y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2f(GLfloat x, GLfloat y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2i(GLint x, GLint y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2s(GLshort x, GLshort y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos2sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3d(GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3f(GLfloat x, GLfloat y, GLfloat z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3i(GLint x, GLint y, GLint z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3s(GLshort x, GLshort y, GLshort z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::windowPos3sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::accum(GLenum op, GLfloat value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::begin(GLenum mode)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bitmap(GLsizei width,
+ GLsizei height,
+ GLfloat xorig,
+ GLfloat yorig,
+ GLfloat xmove,
+ GLfloat ymove,
+ const GLubyte *bitmap)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::callList(GLuint list)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::callLists(GLsizei n, GLenum type, const void *lists)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearDepth(GLdouble depth)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearIndex(GLfloat c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clipPlane(GLenum plane, const GLdouble *equation)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3b(GLbyte red, GLbyte green, GLbyte blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3bv(const GLbyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3d(GLdouble red, GLdouble green, GLdouble blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3f(GLfloat red, GLfloat green, GLfloat blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3i(GLint red, GLint green, GLint blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3s(GLshort red, GLshort green, GLshort blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3ub(GLubyte red, GLubyte green, GLubyte blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3ubv(const GLubyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3ui(GLuint red, GLuint green, GLuint blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3uiv(const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3us(GLushort red, GLushort green, GLushort blue)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color3usv(const GLushort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4bv(const GLbyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4i(GLint red, GLint green, GLint blue, GLint alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4s(GLshort red, GLshort green, GLshort blue, GLshort alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4ubv(const GLubyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4uiv(const GLuint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4us(GLushort red, GLushort green, GLushort blue, GLushort alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::color4usv(const GLushort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::colorMaterial(GLenum face, GLenum mode)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::deleteLists(GLuint list, GLsizei range)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::depthRange(GLdouble n, GLdouble f)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawBuffer(GLenum buf)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawPixels(GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::edgeFlag(GLboolean flag)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::edgeFlagv(const GLboolean *flag)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::end()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::endList()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord1d(GLdouble u)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord1dv(const GLdouble *u)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord1f(GLfloat u)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord1fv(const GLfloat *u)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord2d(GLdouble u, GLdouble v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord2dv(const GLdouble *u)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord2f(GLfloat u, GLfloat v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalCoord2fv(const GLfloat *u)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalMesh1(GLenum mode, GLint i1, GLint i2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalPoint1(GLint i)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::evalPoint2(GLint i, GLint j)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::feedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::fogi(GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::fogiv(GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::frustum(GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar)
+{
+ UNIMPLEMENTED();
+}
+
+GLuint Context::genLists(GLsizei range)
+{
+ UNIMPLEMENTED();
+ return 0;
+}
+
+void Context::getClipPlane(GLenum plane, GLdouble *equation)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getDoublev(GLenum pname, GLdouble *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getLightiv(GLenum light, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getMapdv(GLenum target, GLenum query, GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getMapfv(GLenum target, GLenum query, GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getMapiv(GLenum target, GLenum query, GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getMaterialiv(GLenum face, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getPixelMapfv(GLenum map, GLfloat *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getPixelMapuiv(GLenum map, GLuint *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getPixelMapusv(GLenum map, GLushort *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getPolygonStipple(GLubyte *mask)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTexGendv(GLenum coord, GLenum pname, GLdouble *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexMask(GLuint mask)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexd(GLdouble c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexdv(const GLdouble *c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexf(GLfloat c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexfv(const GLfloat *c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexi(GLint c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexiv(const GLint *c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexs(GLshort c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexsv(const GLshort *c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::initNames()
+{
+ UNIMPLEMENTED();
+}
+
+GLboolean Context::isList(GLuint list)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+void Context::lightModeli(GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::lightModeliv(GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::lighti(GLenum light, GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::lightiv(GLenum light, GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::lineStipple(GLint factor, GLushort pattern)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::listBase(GLuint base)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::loadMatrixd(const GLdouble *m)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::loadName(GLuint name)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::map1d(GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint stride,
+ GLint order,
+ const GLdouble *points)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::map1f(GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint stride,
+ GLint order,
+ const GLfloat *points)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::map2d(GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint ustride,
+ GLint uorder,
+ GLdouble v1,
+ GLdouble v2,
+ GLint vstride,
+ GLint vorder,
+ const GLdouble *points)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::map2f(GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint ustride,
+ GLint uorder,
+ GLfloat v1,
+ GLfloat v2,
+ GLint vstride,
+ GLint vorder,
+ const GLfloat *points)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::mapGrid1d(GLint un, GLdouble u1, GLdouble u2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::mapGrid1f(GLint un, GLfloat u1, GLfloat u2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::mapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::mapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::materiali(GLenum face, GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::materialiv(GLenum face, GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multMatrixd(const GLdouble *m)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::newList(GLuint list, GLenum mode)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3b(GLbyte nx, GLbyte ny, GLbyte nz)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3bv(const GLbyte *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3d(GLdouble nx, GLdouble ny, GLdouble nz)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3i(GLint nx, GLint ny, GLint nz)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3s(GLshort nx, GLshort ny, GLshort nz)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normal3sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::ortho(GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::passThrough(GLfloat token)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pixelStoref(GLenum pname, GLfloat param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pixelTransferf(GLenum pname, GLfloat param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pixelTransferi(GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pixelZoom(GLfloat xfactor, GLfloat yfactor)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::polygonMode(GLenum face, GLenum mode)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::polygonStipple(const GLubyte *mask)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::popAttrib()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::popName()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pushAttrib(GLbitfield mask)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pushName(GLuint name)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2d(GLdouble x, GLdouble y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2f(GLfloat x, GLfloat y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2i(GLint x, GLint y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2s(GLshort x, GLshort y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos2sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3d(GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3f(GLfloat x, GLfloat y, GLfloat z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3i(GLint x, GLint y, GLint z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3s(GLshort x, GLshort y, GLshort z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos3sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4i(GLint x, GLint y, GLint z, GLint w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rasterPos4sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rectdv(const GLdouble *v1, const GLdouble *v2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rectfv(const GLfloat *v1, const GLfloat *v2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::recti(GLint x1, GLint y1, GLint x2, GLint y2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rectiv(const GLint *v1, const GLint *v2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::rectsv(const GLshort *v1, const GLshort *v2)
+{
+ UNIMPLEMENTED();
+}
+
+GLint Context::renderMode(GLenum mode)
+{
+ UNIMPLEMENTED();
+ return 0;
+}
+
+void Context::rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::scaled(GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::selectBuffer(GLsizei size, GLuint *buffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1d(GLdouble s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1f(GLfloat s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1i(GLint s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1s(GLshort s)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord1sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2d(GLdouble s, GLdouble t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2f(GLfloat s, GLfloat t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2i(GLint s, GLint t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2s(GLshort s, GLshort t)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord2sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3d(GLdouble s, GLdouble t, GLdouble r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3f(GLfloat s, GLfloat t, GLfloat r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3i(GLint s, GLint t, GLint r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3s(GLshort s, GLshort t, GLshort r)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord3sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4i(GLint s, GLint t, GLint r, GLint q)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4s(GLshort s, GLshort t, GLshort r, GLshort q)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoord4sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGend(GLenum coord, GLenum pname, GLdouble param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGendv(GLenum coord, GLenum pname, const GLdouble *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texImage1D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::translated(GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2d(GLdouble x, GLdouble y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2f(GLfloat x, GLfloat y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2i(GLint x, GLint y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2s(GLshort x, GLshort y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex2sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3d(GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3f(GLfloat x, GLfloat y, GLfloat z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3i(GLint x, GLint y, GLint z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3s(GLshort x, GLshort y, GLshort z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex3sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4dv(const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4fv(const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4i(GLint x, GLint y, GLint z, GLint w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4iv(const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertex4sv(const GLshort *v)
+{
+ UNIMPLEMENTED();
+}
+
+GLboolean Context::areTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+void Context::arrayElement(GLint i)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyTexImage1D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLint border)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyTexSubImage1D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::edgeFlagPointer(GLsizei stride, const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexPointer(GLenum type, GLsizei stride, const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexub(GLubyte c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::indexubv(const GLubyte *c)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::interleavedArrays(GLenum format, GLsizei stride, const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::popClientAttrib()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::prioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::pushClientAttrib(GLbitfield mask)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texSubImage1D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawElementsBaseVertex(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLint basevertex)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawElementsInstancedBaseVertex(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLint basevertex)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawRangeElementsBaseVertex(GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLint basevertex)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiDrawElementsBaseVertex(GLenum mode,
+ const GLsizei *count,
+ GLenum type,
+ const void *const *indices,
+ GLsizei drawcount,
+ const GLint *basevertex)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texImage2DMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texImage3DMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::colorP3ui(GLenum type, GLuint color)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::colorP3uiv(GLenum type, const GLuint *color)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::colorP4ui(GLenum type, GLuint color)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::colorP4uiv(GLenum type, const GLuint *color)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normalP3ui(GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::normalP3uiv(GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColorP3ui(GLenum type, GLuint color)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::secondaryColorP3uiv(GLenum type, const GLuint *color)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP1ui(GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP1uiv(GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP2ui(GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP2uiv(GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP3ui(GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP3uiv(GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP4ui(GLenum type, GLuint coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texCoordP4uiv(GLenum type, const GLuint *coords)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP1uiv(GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP2uiv(GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP3uiv(GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribP4uiv(GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexP2ui(GLenum type, GLuint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexP2uiv(GLenum type, const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexP3ui(GLenum type, GLuint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexP3uiv(GLenum type, const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexP4ui(GLenum type, GLuint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexP4uiv(GLenum type, const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::beginQueryIndexed(GLenum target, GLuint index, GLuint id)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::blendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::blendEquationi(GLuint buf, GLenum mode)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::blendFuncSeparatei(GLuint buf,
+ GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::blendFunci(GLuint buf, GLenum src, GLenum dst)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawTransformFeedback(GLenum mode, GLuint id)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::endQueryIndexed(GLenum target, GLuint index)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getActiveSubroutineName(GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *name)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getActiveSubroutineUniformName(GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *name)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getActiveSubroutineUniformiv(GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLenum pname,
+ GLint *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+GLuint Context::getSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name)
+{
+ UNIMPLEMENTED();
+ return 0;
+}
+
+GLint Context::getSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name)
+{
+ UNIMPLEMENTED();
+ return 0;
+}
+
+void Context::getUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getUniformdv(GLuint program, GLint location, GLdouble *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::minSampleShading(GLfloat value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::patchParameterfv(GLenum pname, const GLfloat *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::patchParameteri(GLenum pname, GLint value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform1d(GLint location, GLdouble x)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform1dv(GLint location, GLsizei count, const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform2d(GLint location, GLdouble x, GLdouble y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform2dv(GLint location, GLsizei count, const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform3dv(GLint location, GLsizei count, const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniform4dv(GLint location, GLsizei count, const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix2dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix2x3dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix2x4dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix3dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix3x2dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix3x4dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix4dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix4x2dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformMatrix4x3dv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::uniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::depthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::depthRangeIndexed(GLuint index, GLdouble n, GLdouble f)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getDoublei_v(GLenum target, GLuint index, GLdouble *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getFloati_v(GLenum target, GLuint index, GLfloat *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform1d(GLuint program, GLint location, GLdouble v0)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform1dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform2dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform3d(GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1,
+ GLdouble v2)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform3dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform4d(GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1,
+ GLdouble v2,
+ GLdouble v3)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniform4dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix2dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix2x3dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix2x4dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix3dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix3x2dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix3x4dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix4dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix4x2dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::programUniformMatrix4x3dv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::scissorArrayv(GLuint first, GLsizei count, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::scissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::scissorIndexedv(GLuint index, const GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL1d(GLuint index, GLdouble x)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL1dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL2d(GLuint index, GLdouble x, GLdouble y)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL2dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL3dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribL4dv(GLuint index, const GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribLPointer(GLuint index,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::viewportArrayv(GLuint first, GLsizei count, const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::viewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::viewportIndexedfv(GLuint index, const GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawArraysInstancedBaseInstance(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount,
+ GLuint baseinstance)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawElementsInstancedBaseInstance(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLuint baseinstance)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawElementsInstancedBaseVertexBaseInstance(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLint basevertex,
+ GLuint baseinstance)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::drawTransformFeedbackStreamInstanced(GLenum mode,
+ GLuint id,
+ GLuint stream,
+ GLsizei instancecount)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getActiveAtomicCounterBufferiv(GLuint program,
+ GLuint bufferIndex,
+ GLenum pname,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearBufferData(GLenum target,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearBufferSubData(GLenum target,
+ GLenum internalformat,
+ GLintptr offset,
+ GLsizeiptr size,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyImageSubData(GLuint srcName,
+ GLenum srcTarget,
+ GLint srcLevel,
+ GLint srcX,
+ GLint srcY,
+ GLint srcZ,
+ GLuint dstName,
+ GLenum dstTarget,
+ GLint dstLevel,
+ GLint dstX,
+ GLint dstY,
+ GLint dstZ,
+ GLsizei srcWidth,
+ GLsizei srcHeight,
+ GLsizei srcDepth)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getInternalformati64v(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint64 *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::invalidateBufferData(GLuint buffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::invalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::invalidateTexImage(GLuint texture, GLint level)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::invalidateTexSubImage(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiDrawArraysIndirect(GLenum mode,
+ const void *indirect,
+ GLsizei drawcount,
+ GLsizei stride)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiDrawElementsIndirect(GLenum mode,
+ GLenum type,
+ const void *indirect,
+ GLsizei drawcount,
+ GLsizei stride)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::shaderStorageBlockBinding(GLuint program,
+ GLuint storageBlockIndex,
+ GLuint storageBlockBinding)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texBufferRange(GLenum target,
+ GLenum internalformat,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureView(GLuint texture,
+ GLenum target,
+ GLuint origtexture,
+ GLenum internalformat,
+ GLuint minlevel,
+ GLuint numlevels,
+ GLuint minlayer,
+ GLuint numlayers)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexAttribLFormat(GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindBuffersRange(GLenum target,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizeiptr *sizes)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindTextures(GLuint first, GLsizei count, const GLuint *textures)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindVertexBuffers(GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizei *strides)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearTexImage(GLuint texture,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearTexSubImage(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::bindTextureUnit(GLuint unit, GLuint texture)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::blitNamedFramebuffer(GLuint readFramebuffer,
+ GLuint drawFramebuffer,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ UNIMPLEMENTED();
+}
+
+GLenum Context::checkNamedFramebufferStatus(GLuint framebuffer, GLenum target)
+{
+ UNIMPLEMENTED();
+ return 0;
+}
+
+void Context::clearNamedBufferData(GLuint buffer,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearNamedBufferSubData(GLuint buffer,
+ GLenum internalformat,
+ GLintptr offset,
+ GLsizeiptr size,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearNamedFramebufferfi(GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearNamedFramebufferfv(GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearNamedFramebufferiv(GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearNamedFramebufferuiv(GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clipControl(GLenum origin, GLenum depth)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::compressedTextureSubImage1D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::compressedTextureSubImage2D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::compressedTextureSubImage3D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyNamedBufferSubData(GLuint readBuffer,
+ GLuint writeBuffer,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyTextureSubImage1D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyTextureSubImage2D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::copyTextureSubImage3D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createBuffers(GLsizei n, GLuint *buffers)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createFramebuffers(GLsizei n, GLuint *framebuffers)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createProgramPipelines(GLsizei n, GLuint *pipelines)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createQueries(GLenum target, GLsizei n, GLuint *ids)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createSamplers(GLsizei n, GLuint *samplers)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createTextures(GLenum target, GLsizei n, GLuint *textures)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createTransformFeedbacks(GLsizei n, GLuint *ids)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::createVertexArrays(GLsizei n, GLuint *arrays)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::disableVertexArrayAttrib(GLuint vaobj, GLuint index)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::enableVertexArrayAttrib(GLuint vaobj, GLuint index)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::flushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::generateTextureMipmap(GLuint texture)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getCompressedTextureSubImage(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei bufSize,
+ void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getNamedBufferPointerv(GLuint buffer, GLenum pname, void **params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getNamedFramebufferAttachmentParameteriv(GLuint framebuffer,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureImage(GLuint texture,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureParameterIiv(GLuint texture, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTextureSubImage(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnColorTable(GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *table)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnConvolutionFilter(GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *image)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnHistogram(GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnMinmax(GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnPolygonStipple(GLsizei bufSize, GLubyte *pattern)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnSeparableFilter(GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei rowBufSize,
+ void *row,
+ GLsizei columnBufSize,
+ void *column,
+ void *span)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnTexImage(GLenum target,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::invalidateNamedFramebufferData(GLuint framebuffer,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::invalidateNamedFramebufferSubData(GLuint framebuffer,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ UNIMPLEMENTED();
+}
+
+void *Context::mapNamedBuffer(GLuint buffer, GLenum access)
+{
+ UNIMPLEMENTED();
+ return nullptr;
+}
+
+void *Context::mapNamedBufferRange(GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ UNIMPLEMENTED();
+ return nullptr;
+}
+
+void Context::namedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedBufferStorage(GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedFramebufferReadBuffer(GLuint framebuffer, GLenum src)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedFramebufferRenderbuffer(GLuint framebuffer,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedFramebufferTexture(GLuint framebuffer,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedFramebufferTextureLayer(GLuint framebuffer,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedRenderbufferStorage(GLuint renderbuffer,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::namedRenderbufferStorageMultisample(GLuint renderbuffer,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureBarrier()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureBuffer(GLuint texture, GLenum internalformat, GLuint buffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureBufferRange(GLuint texture,
+ GLenum internalformat,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureParameterf(GLuint texture, GLenum pname, GLfloat param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureParameterfv(GLuint texture, GLenum pname, const GLfloat *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureParameteri(GLuint texture, GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureParameteriv(GLuint texture, GLenum pname, const GLint *param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureStorage2D(GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureStorage2DMultisample(GLuint texture,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureStorage3D(GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureStorage3DMultisample(GLuint texture,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureSubImage1D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureSubImage2D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::textureSubImage3D(GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::transformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::transformFeedbackBufferRange(GLuint xfb,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ UNIMPLEMENTED();
+}
+
+GLboolean Context::unmapNamedBuffer(GLuint buffer)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+void Context::vertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexArrayAttribFormat(GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexArrayAttribIFormat(GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexArrayAttribLFormat(GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexArrayVertexBuffer(GLuint vaobj,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::vertexArrayVertexBuffers(GLuint vaobj,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizei *strides)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiDrawArraysIndirectCount(GLenum mode,
+ const void *indirect,
+ GLintptr drawcount,
+ GLsizei maxdrawcount,
+ GLsizei stride)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::multiDrawElementsIndirectCount(GLenum mode,
+ GLenum type,
+ const void *indirect,
+ GLintptr drawcount,
+ GLsizei maxdrawcount,
+ GLsizei stride)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::polygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::specializeShader(GLuint shader,
+ const GLchar *pEntryPoint,
+ GLuint numSpecializationConstants,
+ const GLuint *pConstantIndex,
+ const GLuint *pConstantValue)
+{
+ UNIMPLEMENTED();
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_1_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_1_0_autogen.h
new file mode 100644
index 0000000000..e384707ca1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_1_0_autogen.h
@@ -0,0 +1,254 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_1_0_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_1_0_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_1_0_AUTOGEN_H_
+
+#define ANGLE_GL_1_0_CONTEXT_API \
+ void accum(GLenum op, GLfloat value); \
+ void begin(GLenum mode); \
+ void bitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, \
+ GLfloat ymove, const GLubyte *bitmap); \
+ void callList(GLuint list); \
+ void callLists(GLsizei n, GLenum type, const void *lists); \
+ void clearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); \
+ void clearDepth(GLdouble depth); \
+ void clearIndex(GLfloat c); \
+ void clipPlane(GLenum plane, const GLdouble *equation); \
+ void color3b(GLbyte red, GLbyte green, GLbyte blue); \
+ void color3bv(const GLbyte *v); \
+ void color3d(GLdouble red, GLdouble green, GLdouble blue); \
+ void color3dv(const GLdouble *v); \
+ void color3f(GLfloat red, GLfloat green, GLfloat blue); \
+ void color3fv(const GLfloat *v); \
+ void color3i(GLint red, GLint green, GLint blue); \
+ void color3iv(const GLint *v); \
+ void color3s(GLshort red, GLshort green, GLshort blue); \
+ void color3sv(const GLshort *v); \
+ void color3ub(GLubyte red, GLubyte green, GLubyte blue); \
+ void color3ubv(const GLubyte *v); \
+ void color3ui(GLuint red, GLuint green, GLuint blue); \
+ void color3uiv(const GLuint *v); \
+ void color3us(GLushort red, GLushort green, GLushort blue); \
+ void color3usv(const GLushort *v); \
+ void color4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); \
+ void color4bv(const GLbyte *v); \
+ void color4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); \
+ void color4dv(const GLdouble *v); \
+ void color4fv(const GLfloat *v); \
+ void color4i(GLint red, GLint green, GLint blue, GLint alpha); \
+ void color4iv(const GLint *v); \
+ void color4s(GLshort red, GLshort green, GLshort blue, GLshort alpha); \
+ void color4sv(const GLshort *v); \
+ void color4ubv(const GLubyte *v); \
+ void color4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha); \
+ void color4uiv(const GLuint *v); \
+ void color4us(GLushort red, GLushort green, GLushort blue, GLushort alpha); \
+ void color4usv(const GLushort *v); \
+ void colorMaterial(GLenum face, GLenum mode); \
+ void copyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); \
+ void deleteLists(GLuint list, GLsizei range); \
+ void depthRange(GLdouble n, GLdouble f); \
+ void drawBuffer(GLenum buf); \
+ void drawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, \
+ const void *pixels); \
+ void edgeFlag(GLboolean flag); \
+ void edgeFlagv(const GLboolean *flag); \
+ void end(); \
+ void endList(); \
+ void evalCoord1d(GLdouble u); \
+ void evalCoord1dv(const GLdouble *u); \
+ void evalCoord1f(GLfloat u); \
+ void evalCoord1fv(const GLfloat *u); \
+ void evalCoord2d(GLdouble u, GLdouble v); \
+ void evalCoord2dv(const GLdouble *u); \
+ void evalCoord2f(GLfloat u, GLfloat v); \
+ void evalCoord2fv(const GLfloat *u); \
+ void evalMesh1(GLenum mode, GLint i1, GLint i2); \
+ void evalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); \
+ void evalPoint1(GLint i); \
+ void evalPoint2(GLint i, GLint j); \
+ void feedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer); \
+ void fogi(GLenum pname, GLint param); \
+ void fogiv(GLenum pname, const GLint *params); \
+ void frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, \
+ GLdouble zFar); \
+ GLuint genLists(GLsizei range); \
+ void getClipPlane(GLenum plane, GLdouble *equation); \
+ void getDoublev(GLenum pname, GLdouble *data); \
+ void getLightiv(GLenum light, GLenum pname, GLint *params); \
+ void getMapdv(GLenum target, GLenum query, GLdouble *v); \
+ void getMapfv(GLenum target, GLenum query, GLfloat *v); \
+ void getMapiv(GLenum target, GLenum query, GLint *v); \
+ void getMaterialiv(GLenum face, GLenum pname, GLint *params); \
+ void getPixelMapfv(GLenum map, GLfloat *values); \
+ void getPixelMapuiv(GLenum map, GLuint *values); \
+ void getPixelMapusv(GLenum map, GLushort *values); \
+ void getPolygonStipple(GLubyte *mask); \
+ void getTexGendv(GLenum coord, GLenum pname, GLdouble *params); \
+ void getTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); \
+ void indexMask(GLuint mask); \
+ void indexd(GLdouble c); \
+ void indexdv(const GLdouble *c); \
+ void indexf(GLfloat c); \
+ void indexfv(const GLfloat *c); \
+ void indexi(GLint c); \
+ void indexiv(const GLint *c); \
+ void indexs(GLshort c); \
+ void indexsv(const GLshort *c); \
+ void initNames(); \
+ GLboolean isList(GLuint list); \
+ void lightModeli(GLenum pname, GLint param); \
+ void lightModeliv(GLenum pname, const GLint *params); \
+ void lighti(GLenum light, GLenum pname, GLint param); \
+ void lightiv(GLenum light, GLenum pname, const GLint *params); \
+ void lineStipple(GLint factor, GLushort pattern); \
+ void listBase(GLuint base); \
+ void loadMatrixd(const GLdouble *m); \
+ void loadName(GLuint name); \
+ void map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, \
+ const GLdouble *points); \
+ void map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, \
+ const GLfloat *points); \
+ void map2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, \
+ GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); \
+ void map2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, \
+ GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); \
+ void mapGrid1d(GLint un, GLdouble u1, GLdouble u2); \
+ void mapGrid1f(GLint un, GLfloat u1, GLfloat u2); \
+ void mapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); \
+ void mapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); \
+ void materiali(GLenum face, GLenum pname, GLint param); \
+ void materialiv(GLenum face, GLenum pname, const GLint *params); \
+ void multMatrixd(const GLdouble *m); \
+ void newList(GLuint list, GLenum mode); \
+ void normal3b(GLbyte nx, GLbyte ny, GLbyte nz); \
+ void normal3bv(const GLbyte *v); \
+ void normal3d(GLdouble nx, GLdouble ny, GLdouble nz); \
+ void normal3dv(const GLdouble *v); \
+ void normal3fv(const GLfloat *v); \
+ void normal3i(GLint nx, GLint ny, GLint nz); \
+ void normal3iv(const GLint *v); \
+ void normal3s(GLshort nx, GLshort ny, GLshort nz); \
+ void normal3sv(const GLshort *v); \
+ void ortho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, \
+ GLdouble zFar); \
+ void passThrough(GLfloat token); \
+ void pixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values); \
+ void pixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values); \
+ void pixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values); \
+ void pixelStoref(GLenum pname, GLfloat param); \
+ void pixelTransferf(GLenum pname, GLfloat param); \
+ void pixelTransferi(GLenum pname, GLint param); \
+ void pixelZoom(GLfloat xfactor, GLfloat yfactor); \
+ void polygonMode(GLenum face, GLenum mode); \
+ void polygonStipple(const GLubyte *mask); \
+ void popAttrib(); \
+ void popName(); \
+ void pushAttrib(GLbitfield mask); \
+ void pushName(GLuint name); \
+ void rasterPos2d(GLdouble x, GLdouble y); \
+ void rasterPos2dv(const GLdouble *v); \
+ void rasterPos2f(GLfloat x, GLfloat y); \
+ void rasterPos2fv(const GLfloat *v); \
+ void rasterPos2i(GLint x, GLint y); \
+ void rasterPos2iv(const GLint *v); \
+ void rasterPos2s(GLshort x, GLshort y); \
+ void rasterPos2sv(const GLshort *v); \
+ void rasterPos3d(GLdouble x, GLdouble y, GLdouble z); \
+ void rasterPos3dv(const GLdouble *v); \
+ void rasterPos3f(GLfloat x, GLfloat y, GLfloat z); \
+ void rasterPos3fv(const GLfloat *v); \
+ void rasterPos3i(GLint x, GLint y, GLint z); \
+ void rasterPos3iv(const GLint *v); \
+ void rasterPos3s(GLshort x, GLshort y, GLshort z); \
+ void rasterPos3sv(const GLshort *v); \
+ void rasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); \
+ void rasterPos4dv(const GLdouble *v); \
+ void rasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); \
+ void rasterPos4fv(const GLfloat *v); \
+ void rasterPos4i(GLint x, GLint y, GLint z, GLint w); \
+ void rasterPos4iv(const GLint *v); \
+ void rasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); \
+ void rasterPos4sv(const GLshort *v); \
+ void rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); \
+ void rectdv(const GLdouble *v1, const GLdouble *v2); \
+ void rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); \
+ void rectfv(const GLfloat *v1, const GLfloat *v2); \
+ void recti(GLint x1, GLint y1, GLint x2, GLint y2); \
+ void rectiv(const GLint *v1, const GLint *v2); \
+ void rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2); \
+ void rectsv(const GLshort *v1, const GLshort *v2); \
+ GLint renderMode(GLenum mode); \
+ void rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); \
+ void scaled(GLdouble x, GLdouble y, GLdouble z); \
+ void selectBuffer(GLsizei size, GLuint *buffer); \
+ void texCoord1d(GLdouble s); \
+ void texCoord1dv(const GLdouble *v); \
+ void texCoord1f(GLfloat s); \
+ void texCoord1fv(const GLfloat *v); \
+ void texCoord1i(GLint s); \
+ void texCoord1iv(const GLint *v); \
+ void texCoord1s(GLshort s); \
+ void texCoord1sv(const GLshort *v); \
+ void texCoord2d(GLdouble s, GLdouble t); \
+ void texCoord2dv(const GLdouble *v); \
+ void texCoord2f(GLfloat s, GLfloat t); \
+ void texCoord2fv(const GLfloat *v); \
+ void texCoord2i(GLint s, GLint t); \
+ void texCoord2iv(const GLint *v); \
+ void texCoord2s(GLshort s, GLshort t); \
+ void texCoord2sv(const GLshort *v); \
+ void texCoord3d(GLdouble s, GLdouble t, GLdouble r); \
+ void texCoord3dv(const GLdouble *v); \
+ void texCoord3f(GLfloat s, GLfloat t, GLfloat r); \
+ void texCoord3fv(const GLfloat *v); \
+ void texCoord3i(GLint s, GLint t, GLint r); \
+ void texCoord3iv(const GLint *v); \
+ void texCoord3s(GLshort s, GLshort t, GLshort r); \
+ void texCoord3sv(const GLshort *v); \
+ void texCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q); \
+ void texCoord4dv(const GLdouble *v); \
+ void texCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q); \
+ void texCoord4fv(const GLfloat *v); \
+ void texCoord4i(GLint s, GLint t, GLint r, GLint q); \
+ void texCoord4iv(const GLint *v); \
+ void texCoord4s(GLshort s, GLshort t, GLshort r, GLshort q); \
+ void texCoord4sv(const GLshort *v); \
+ void texGend(GLenum coord, GLenum pname, GLdouble param); \
+ void texGendv(GLenum coord, GLenum pname, const GLdouble *params); \
+ void texImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, \
+ GLenum format, GLenum type, const void *pixels); \
+ void translated(GLdouble x, GLdouble y, GLdouble z); \
+ void vertex2d(GLdouble x, GLdouble y); \
+ void vertex2dv(const GLdouble *v); \
+ void vertex2f(GLfloat x, GLfloat y); \
+ void vertex2fv(const GLfloat *v); \
+ void vertex2i(GLint x, GLint y); \
+ void vertex2iv(const GLint *v); \
+ void vertex2s(GLshort x, GLshort y); \
+ void vertex2sv(const GLshort *v); \
+ void vertex3d(GLdouble x, GLdouble y, GLdouble z); \
+ void vertex3dv(const GLdouble *v); \
+ void vertex3f(GLfloat x, GLfloat y, GLfloat z); \
+ void vertex3fv(const GLfloat *v); \
+ void vertex3i(GLint x, GLint y, GLint z); \
+ void vertex3iv(const GLint *v); \
+ void vertex3s(GLshort x, GLshort y, GLshort z); \
+ void vertex3sv(const GLshort *v); \
+ void vertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); \
+ void vertex4dv(const GLdouble *v); \
+ void vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); \
+ void vertex4fv(const GLfloat *v); \
+ void vertex4i(GLint x, GLint y, GLint z, GLint w); \
+ void vertex4iv(const GLint *v); \
+ void vertex4s(GLshort x, GLshort y, GLshort z, GLshort w); \
+ void vertex4sv(const GLshort *v);
+
+#endif // ANGLE_CONTEXT_API_1_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_1_1_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_1_1_autogen.h
new file mode 100644
index 0000000000..67b77c1e10
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_1_1_autogen.h
@@ -0,0 +1,31 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_1_1_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_1_1_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_1_1_AUTOGEN_H_
+
+#define ANGLE_GL_1_1_CONTEXT_API \
+ GLboolean areTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences); \
+ void arrayElement(GLint i); \
+ void copyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, \
+ GLsizei width, GLint border); \
+ void copyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, \
+ GLsizei width); \
+ void edgeFlagPointer(GLsizei stride, const void *pointer); \
+ void indexPointer(GLenum type, GLsizei stride, const void *pointer); \
+ void indexub(GLubyte c); \
+ void indexubv(const GLubyte *c); \
+ void interleavedArrays(GLenum format, GLsizei stride, const void *pointer); \
+ void popClientAttrib(); \
+ void prioritizeTextures(GLsizei n, const GLuint *textures, const GLfloat *priorities); \
+ void pushClientAttrib(GLbitfield mask); \
+ void texSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, \
+ GLenum type, const void *pixels);
+
+#endif // ANGLE_CONTEXT_API_1_1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_1_2_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_1_2_autogen.h
new file mode 100644
index 0000000000..0684f744f8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_1_2_autogen.h
@@ -0,0 +1,15 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_1_2_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_1_2_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_1_2_AUTOGEN_H_
+
+#define ANGLE_GL_1_2_CONTEXT_API
+
+#endif // ANGLE_CONTEXT_API_1_2_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_1_3_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_1_3_autogen.h
new file mode 100644
index 0000000000..72eefb62b3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_1_3_autogen.h
@@ -0,0 +1,55 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_1_3_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_1_3_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_1_3_AUTOGEN_H_
+
+#define ANGLE_GL_1_3_CONTEXT_API \
+ void compressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, \
+ GLint border, GLsizei imageSize, const void *data); \
+ void compressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, \
+ GLenum format, GLsizei imageSize, const void *data); \
+ void getCompressedTexImage(GLenum target, GLint level, void *img); \
+ void loadTransposeMatrixd(const GLdouble *m); \
+ void loadTransposeMatrixf(const GLfloat *m); \
+ void multTransposeMatrixd(const GLdouble *m); \
+ void multTransposeMatrixf(const GLfloat *m); \
+ void multiTexCoord1d(GLenum target, GLdouble s); \
+ void multiTexCoord1dv(GLenum target, const GLdouble *v); \
+ void multiTexCoord1f(GLenum target, GLfloat s); \
+ void multiTexCoord1fv(GLenum target, const GLfloat *v); \
+ void multiTexCoord1i(GLenum target, GLint s); \
+ void multiTexCoord1iv(GLenum target, const GLint *v); \
+ void multiTexCoord1s(GLenum target, GLshort s); \
+ void multiTexCoord1sv(GLenum target, const GLshort *v); \
+ void multiTexCoord2d(GLenum target, GLdouble s, GLdouble t); \
+ void multiTexCoord2dv(GLenum target, const GLdouble *v); \
+ void multiTexCoord2f(GLenum target, GLfloat s, GLfloat t); \
+ void multiTexCoord2fv(GLenum target, const GLfloat *v); \
+ void multiTexCoord2i(GLenum target, GLint s, GLint t); \
+ void multiTexCoord2iv(GLenum target, const GLint *v); \
+ void multiTexCoord2s(GLenum target, GLshort s, GLshort t); \
+ void multiTexCoord2sv(GLenum target, const GLshort *v); \
+ void multiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r); \
+ void multiTexCoord3dv(GLenum target, const GLdouble *v); \
+ void multiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r); \
+ void multiTexCoord3fv(GLenum target, const GLfloat *v); \
+ void multiTexCoord3i(GLenum target, GLint s, GLint t, GLint r); \
+ void multiTexCoord3iv(GLenum target, const GLint *v); \
+ void multiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r); \
+ void multiTexCoord3sv(GLenum target, const GLshort *v); \
+ void multiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); \
+ void multiTexCoord4dv(GLenum target, const GLdouble *v); \
+ void multiTexCoord4fv(GLenum target, const GLfloat *v); \
+ void multiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q); \
+ void multiTexCoord4iv(GLenum target, const GLint *v); \
+ void multiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); \
+ void multiTexCoord4sv(GLenum target, const GLshort *v);
+
+#endif // ANGLE_CONTEXT_API_1_3_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_1_4_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_1_4_autogen.h
new file mode 100644
index 0000000000..13cf378358
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_1_4_autogen.h
@@ -0,0 +1,55 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_1_4_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_1_4_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_1_4_AUTOGEN_H_
+
+#define ANGLE_GL_1_4_CONTEXT_API \
+ void fogCoordPointer(GLenum type, GLsizei stride, const void *pointer); \
+ void fogCoordd(GLdouble coord); \
+ void fogCoorddv(const GLdouble *coord); \
+ void fogCoordf(GLfloat coord); \
+ void fogCoordfv(const GLfloat *coord); \
+ void pointParameteri(GLenum pname, GLint param); \
+ void pointParameteriv(GLenum pname, const GLint *params); \
+ void secondaryColor3b(GLbyte red, GLbyte green, GLbyte blue); \
+ void secondaryColor3bv(const GLbyte *v); \
+ void secondaryColor3d(GLdouble red, GLdouble green, GLdouble blue); \
+ void secondaryColor3dv(const GLdouble *v); \
+ void secondaryColor3f(GLfloat red, GLfloat green, GLfloat blue); \
+ void secondaryColor3fv(const GLfloat *v); \
+ void secondaryColor3i(GLint red, GLint green, GLint blue); \
+ void secondaryColor3iv(const GLint *v); \
+ void secondaryColor3s(GLshort red, GLshort green, GLshort blue); \
+ void secondaryColor3sv(const GLshort *v); \
+ void secondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue); \
+ void secondaryColor3ubv(const GLubyte *v); \
+ void secondaryColor3ui(GLuint red, GLuint green, GLuint blue); \
+ void secondaryColor3uiv(const GLuint *v); \
+ void secondaryColor3us(GLushort red, GLushort green, GLushort blue); \
+ void secondaryColor3usv(const GLushort *v); \
+ void secondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \
+ void windowPos2d(GLdouble x, GLdouble y); \
+ void windowPos2dv(const GLdouble *v); \
+ void windowPos2f(GLfloat x, GLfloat y); \
+ void windowPos2fv(const GLfloat *v); \
+ void windowPos2i(GLint x, GLint y); \
+ void windowPos2iv(const GLint *v); \
+ void windowPos2s(GLshort x, GLshort y); \
+ void windowPos2sv(const GLshort *v); \
+ void windowPos3d(GLdouble x, GLdouble y, GLdouble z); \
+ void windowPos3dv(const GLdouble *v); \
+ void windowPos3f(GLfloat x, GLfloat y, GLfloat z); \
+ void windowPos3fv(const GLfloat *v); \
+ void windowPos3i(GLint x, GLint y, GLint z); \
+ void windowPos3iv(const GLint *v); \
+ void windowPos3s(GLshort x, GLshort y, GLshort z); \
+ void windowPos3sv(const GLshort *v);
+
+#endif // ANGLE_CONTEXT_API_1_4_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_1_5_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_1_5_autogen.h
new file mode 100644
index 0000000000..84a70012ae
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_1_5_autogen.h
@@ -0,0 +1,16 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_1_5_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_1_5_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_1_5_AUTOGEN_H_
+
+#define ANGLE_GL_1_5_CONTEXT_API \
+ void getBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);
+
+#endif // ANGLE_CONTEXT_API_1_5_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_2_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_2_0_autogen.h
new file mode 100644
index 0000000000..0bf50f4b18
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_2_0_autogen.h
@@ -0,0 +1,44 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_2_0_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_2_0_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_2_0_AUTOGEN_H_
+
+#define ANGLE_GL_2_0_CONTEXT_API \
+ void getVertexAttribdv(GLuint index, GLenum pname, GLdouble *params); \
+ void vertexAttrib1d(GLuint index, GLdouble x); \
+ void vertexAttrib1dv(GLuint index, const GLdouble *v); \
+ void vertexAttrib1s(GLuint index, GLshort x); \
+ void vertexAttrib1sv(GLuint index, const GLshort *v); \
+ void vertexAttrib2d(GLuint index, GLdouble x, GLdouble y); \
+ void vertexAttrib2dv(GLuint index, const GLdouble *v); \
+ void vertexAttrib2s(GLuint index, GLshort x, GLshort y); \
+ void vertexAttrib2sv(GLuint index, const GLshort *v); \
+ void vertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z); \
+ void vertexAttrib3dv(GLuint index, const GLdouble *v); \
+ void vertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z); \
+ void vertexAttrib3sv(GLuint index, const GLshort *v); \
+ void vertexAttrib4Nbv(GLuint index, const GLbyte *v); \
+ void vertexAttrib4Niv(GLuint index, const GLint *v); \
+ void vertexAttrib4Nsv(GLuint index, const GLshort *v); \
+ void vertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); \
+ void vertexAttrib4Nubv(GLuint index, const GLubyte *v); \
+ void vertexAttrib4Nuiv(GLuint index, const GLuint *v); \
+ void vertexAttrib4Nusv(GLuint index, const GLushort *v); \
+ void vertexAttrib4bv(GLuint index, const GLbyte *v); \
+ void vertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); \
+ void vertexAttrib4dv(GLuint index, const GLdouble *v); \
+ void vertexAttrib4iv(GLuint index, const GLint *v); \
+ void vertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); \
+ void vertexAttrib4sv(GLuint index, const GLshort *v); \
+ void vertexAttrib4ubv(GLuint index, const GLubyte *v); \
+ void vertexAttrib4uiv(GLuint index, const GLuint *v); \
+ void vertexAttrib4usv(GLuint index, const GLushort *v);
+
+#endif // ANGLE_CONTEXT_API_2_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_2_1_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_2_1_autogen.h
new file mode 100644
index 0000000000..8444560b0b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_2_1_autogen.h
@@ -0,0 +1,15 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_2_1_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_2_1_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_2_1_AUTOGEN_H_
+
+#define ANGLE_GL_2_1_CONTEXT_API
+
+#endif // ANGLE_CONTEXT_API_2_1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_3_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_3_0_autogen.h
new file mode 100644
index 0000000000..bb0d2888c4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_3_0_autogen.h
@@ -0,0 +1,40 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_3_0_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_3_0_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_3_0_AUTOGEN_H_
+
+#define ANGLE_GL_3_0_CONTEXT_API \
+ void beginConditionalRender(GLuint id, GLenum mode); \
+ void clampColor(GLenum target, GLenum clamp); \
+ void colorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); \
+ void disablei(GLenum target, GLuint index); \
+ void enablei(GLenum target, GLuint index); \
+ void endConditionalRender(); \
+ void framebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, \
+ GLint level); \
+ GLboolean isEnabledi(GLenum target, GLuint index); \
+ void vertexAttribI1i(GLuint index, GLint x); \
+ void vertexAttribI1iv(GLuint index, const GLint *v); \
+ void vertexAttribI1ui(GLuint index, GLuint x); \
+ void vertexAttribI1uiv(GLuint index, const GLuint *v); \
+ void vertexAttribI2i(GLuint index, GLint x, GLint y); \
+ void vertexAttribI2iv(GLuint index, const GLint *v); \
+ void vertexAttribI2ui(GLuint index, GLuint x, GLuint y); \
+ void vertexAttribI2uiv(GLuint index, const GLuint *v); \
+ void vertexAttribI3i(GLuint index, GLint x, GLint y, GLint z); \
+ void vertexAttribI3iv(GLuint index, const GLint *v); \
+ void vertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z); \
+ void vertexAttribI3uiv(GLuint index, const GLuint *v); \
+ void vertexAttribI4bv(GLuint index, const GLbyte *v); \
+ void vertexAttribI4sv(GLuint index, const GLshort *v); \
+ void vertexAttribI4ubv(GLuint index, const GLubyte *v); \
+ void vertexAttribI4usv(GLuint index, const GLushort *v);
+
+#endif // ANGLE_CONTEXT_API_3_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_3_1_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_3_1_autogen.h
new file mode 100644
index 0000000000..0a235072c1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_3_1_autogen.h
@@ -0,0 +1,19 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_3_1_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_3_1_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_3_1_AUTOGEN_H_
+
+#define ANGLE_GL_3_1_CONTEXT_API \
+ void getActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, \
+ GLsizei *length, GLchar *uniformName); \
+ void primitiveRestartIndex(GLuint index); \
+ void texBuffer(GLenum target, GLenum internalformat, GLuint buffer);
+
+#endif // ANGLE_CONTEXT_API_3_1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_3_2_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_3_2_autogen.h
new file mode 100644
index 0000000000..074813b8cc
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_3_2_autogen.h
@@ -0,0 +1,30 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_3_2_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_3_2_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_3_2_AUTOGEN_H_
+
+#define ANGLE_GL_3_2_CONTEXT_API \
+ void drawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, \
+ GLint basevertex); \
+ void drawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, \
+ const void *indices, GLsizei instancecount, \
+ GLint basevertex); \
+ void drawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, \
+ GLenum type, const void *indices, GLint basevertex); \
+ void multiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, \
+ const void *const *indices, GLsizei drawcount, \
+ const GLint *basevertex); \
+ void texImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLboolean fixedsamplelocations); \
+ void texImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLsizei depth, \
+ GLboolean fixedsamplelocations);
+
+#endif // ANGLE_CONTEXT_API_3_2_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_3_3_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_3_3_autogen.h
new file mode 100644
index 0000000000..454dbb4a04
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_3_3_autogen.h
@@ -0,0 +1,53 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_3_3_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_3_3_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_3_3_AUTOGEN_H_
+
+#define ANGLE_GL_3_3_CONTEXT_API \
+ void colorP3ui(GLenum type, GLuint color); \
+ void colorP3uiv(GLenum type, const GLuint *color); \
+ void colorP4ui(GLenum type, GLuint color); \
+ void colorP4uiv(GLenum type, const GLuint *color); \
+ void multiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords); \
+ void multiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords); \
+ void multiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords); \
+ void multiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords); \
+ void multiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords); \
+ void multiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords); \
+ void multiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords); \
+ void multiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords); \
+ void normalP3ui(GLenum type, GLuint coords); \
+ void normalP3uiv(GLenum type, const GLuint *coords); \
+ void secondaryColorP3ui(GLenum type, GLuint color); \
+ void secondaryColorP3uiv(GLenum type, const GLuint *color); \
+ void texCoordP1ui(GLenum type, GLuint coords); \
+ void texCoordP1uiv(GLenum type, const GLuint *coords); \
+ void texCoordP2ui(GLenum type, GLuint coords); \
+ void texCoordP2uiv(GLenum type, const GLuint *coords); \
+ void texCoordP3ui(GLenum type, GLuint coords); \
+ void texCoordP3uiv(GLenum type, const GLuint *coords); \
+ void texCoordP4ui(GLenum type, GLuint coords); \
+ void texCoordP4uiv(GLenum type, const GLuint *coords); \
+ void vertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); \
+ void vertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); \
+ void vertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); \
+ void vertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); \
+ void vertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); \
+ void vertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); \
+ void vertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); \
+ void vertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); \
+ void vertexP2ui(GLenum type, GLuint value); \
+ void vertexP2uiv(GLenum type, const GLuint *value); \
+ void vertexP3ui(GLenum type, GLuint value); \
+ void vertexP3uiv(GLenum type, const GLuint *value); \
+ void vertexP4ui(GLenum type, GLuint value); \
+ void vertexP4uiv(GLenum type, const GLuint *value);
+
+#endif // ANGLE_CONTEXT_API_3_3_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_4_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_4_0_autogen.h
new file mode 100644
index 0000000000..dea23e99e7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_4_0_autogen.h
@@ -0,0 +1,66 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_4_0_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_4_0_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_4_0_AUTOGEN_H_
+
+#define ANGLE_GL_4_0_CONTEXT_API \
+ void beginQueryIndexed(GLenum target, GLuint index, GLuint id); \
+ void blendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha); \
+ void blendEquationi(GLuint buf, GLenum mode); \
+ void blendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, \
+ GLenum dstAlpha); \
+ void blendFunci(GLuint buf, GLenum src, GLenum dst); \
+ void drawTransformFeedback(GLenum mode, GLuint id); \
+ void drawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream); \
+ void endQueryIndexed(GLenum target, GLuint index); \
+ void getActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, \
+ GLsizei *length, GLchar *name); \
+ void getActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, \
+ GLsizei bufsize, GLsizei *length, GLchar *name); \
+ void getActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, \
+ GLenum pname, GLint *values); \
+ void getProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values); \
+ void getQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params); \
+ GLuint getSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name); \
+ GLint getSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name); \
+ void getUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params); \
+ void getUniformdv(GLuint program, GLint location, GLdouble *params); \
+ void minSampleShading(GLfloat value); \
+ void patchParameterfv(GLenum pname, const GLfloat *values); \
+ void patchParameteri(GLenum pname, GLint value); \
+ void uniform1d(GLint location, GLdouble x); \
+ void uniform1dv(GLint location, GLsizei count, const GLdouble *value); \
+ void uniform2d(GLint location, GLdouble x, GLdouble y); \
+ void uniform2dv(GLint location, GLsizei count, const GLdouble *value); \
+ void uniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z); \
+ void uniform3dv(GLint location, GLsizei count, const GLdouble *value); \
+ void uniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); \
+ void uniform4dv(GLint location, GLsizei count, const GLdouble *value); \
+ void uniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLdouble *value); \
+ void uniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);
+
+#endif // ANGLE_CONTEXT_API_4_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_4_1_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_4_1_autogen.h
new file mode 100644
index 0000000000..7a1eab25bf
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_4_1_autogen.h
@@ -0,0 +1,63 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_4_1_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_4_1_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_4_1_AUTOGEN_H_
+
+#define ANGLE_GL_4_1_CONTEXT_API \
+ void depthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v); \
+ void depthRangeIndexed(GLuint index, GLdouble n, GLdouble f); \
+ void getDoublei_v(GLenum target, GLuint index, GLdouble *data); \
+ void getFloati_v(GLenum target, GLuint index, GLfloat *data); \
+ void getVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params); \
+ void programUniform1d(GLuint program, GLint location, GLdouble v0); \
+ void programUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value); \
+ void programUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1); \
+ void programUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value); \
+ void programUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); \
+ void programUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value); \
+ void programUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, \
+ GLdouble v3); \
+ void programUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value); \
+ void programUniformMatrix2dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix3dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix4dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void programUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLdouble *value); \
+ void scissorArrayv(GLuint first, GLsizei count, const GLint *v); \
+ void scissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); \
+ void scissorIndexedv(GLuint index, const GLint *v); \
+ void vertexAttribL1d(GLuint index, GLdouble x); \
+ void vertexAttribL1dv(GLuint index, const GLdouble *v); \
+ void vertexAttribL2d(GLuint index, GLdouble x, GLdouble y); \
+ void vertexAttribL2dv(GLuint index, const GLdouble *v); \
+ void vertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z); \
+ void vertexAttribL3dv(GLuint index, const GLdouble *v); \
+ void vertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); \
+ void vertexAttribL4dv(GLuint index, const GLdouble *v); \
+ void vertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, \
+ const void *pointer); \
+ void viewportArrayv(GLuint first, GLsizei count, const GLfloat *v); \
+ void viewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); \
+ void viewportIndexedfv(GLuint index, const GLfloat *v);
+
+#endif // ANGLE_CONTEXT_API_4_1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_4_2_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_4_2_autogen.h
new file mode 100644
index 0000000000..f757634d24
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_4_2_autogen.h
@@ -0,0 +1,28 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_4_2_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_4_2_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_4_2_AUTOGEN_H_
+
+#define ANGLE_GL_4_2_CONTEXT_API \
+ void drawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, \
+ GLsizei instancecount, GLuint baseinstance); \
+ void drawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, \
+ const void *indices, GLsizei instancecount, \
+ GLuint baseinstance); \
+ void drawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, \
+ const void *indices, GLsizei instancecount, \
+ GLint basevertex, GLuint baseinstance); \
+ void drawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount); \
+ void drawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, \
+ GLsizei instancecount); \
+ void getActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, \
+ GLint *params);
+
+#endif // ANGLE_CONTEXT_API_4_2_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_4_3_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_4_3_autogen.h
new file mode 100644
index 0000000000..ca30802465
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_4_3_autogen.h
@@ -0,0 +1,41 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_4_3_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_4_3_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_4_3_AUTOGEN_H_
+
+#define ANGLE_GL_4_3_CONTEXT_API \
+ void clearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, \
+ const void *data); \
+ void clearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, \
+ GLsizeiptr size, GLenum format, GLenum type, const void *data); \
+ void copyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, \
+ GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, \
+ GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, \
+ GLsizei srcHeight, GLsizei srcDepth); \
+ void getInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, \
+ GLsizei bufSize, GLint64 *params); \
+ void invalidateBufferData(GLuint buffer); \
+ void invalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length); \
+ void invalidateTexImage(GLuint texture, GLint level); \
+ void invalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); \
+ void multiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, \
+ GLsizei stride); \
+ void multiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, \
+ GLsizei drawcount, GLsizei stride); \
+ void shaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, \
+ GLuint storageBlockBinding); \
+ void texBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, \
+ GLsizeiptr size); \
+ void textureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, \
+ GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); \
+ void vertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+
+#endif // ANGLE_CONTEXT_API_4_3_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_4_4_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_4_4_autogen.h
new file mode 100644
index 0000000000..d007e9bfd1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_4_4_autogen.h
@@ -0,0 +1,28 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_4_4_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_4_4_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_4_4_AUTOGEN_H_
+
+#define ANGLE_GL_4_4_CONTEXT_API \
+ void bindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers); \
+ void bindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, \
+ const GLintptr *offsets, const GLsizeiptr *sizes); \
+ void bindImageTextures(GLuint first, GLsizei count, const GLuint *textures); \
+ void bindSamplers(GLuint first, GLsizei count, const GLuint *samplers); \
+ void bindTextures(GLuint first, GLsizei count, const GLuint *textures); \
+ void bindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, \
+ const GLintptr *offsets, const GLsizei *strides); \
+ void bufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); \
+ void clearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data); \
+ void clearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, \
+ GLenum format, GLenum type, const void *data);
+
+#endif // ANGLE_CONTEXT_API_4_4_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_4_5_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_4_5_autogen.h
new file mode 100644
index 0000000000..073e79b16e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_4_5_autogen.h
@@ -0,0 +1,189 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_4_5_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_4_5_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_4_5_AUTOGEN_H_
+
+#define ANGLE_GL_4_5_CONTEXT_API \
+ void bindTextureUnit(GLuint unit, GLuint texture); \
+ void blitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, \
+ GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, \
+ GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); \
+ GLenum checkNamedFramebufferStatus(GLuint framebuffer, GLenum target); \
+ void clearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, \
+ const void *data); \
+ void clearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, \
+ GLsizeiptr size, GLenum format, GLenum type, const void *data); \
+ void clearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLint drawbuffer, \
+ GLfloat depth, GLint stencil); \
+ void clearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, \
+ const GLfloat *value); \
+ void clearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, \
+ const GLint *value); \
+ void clearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, \
+ const GLuint *value); \
+ void clipControl(GLenum origin, GLenum depth); \
+ void compressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, \
+ GLenum format, GLsizei imageSize, const void *data); \
+ void compressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLsizei width, GLsizei height, GLenum format, \
+ GLsizei imageSize, const void *data); \
+ void compressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, \
+ GLenum format, GLsizei imageSize, const void *data); \
+ void copyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, \
+ GLintptr writeOffset, GLsizeiptr size); \
+ void copyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, \
+ GLsizei width); \
+ void copyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, \
+ GLint y, GLsizei width, GLsizei height); \
+ void copyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); \
+ void createBuffers(GLsizei n, GLuint *buffers); \
+ void createFramebuffers(GLsizei n, GLuint *framebuffers); \
+ void createProgramPipelines(GLsizei n, GLuint *pipelines); \
+ void createQueries(GLenum target, GLsizei n, GLuint *ids); \
+ void createRenderbuffers(GLsizei n, GLuint *renderbuffers); \
+ void createSamplers(GLsizei n, GLuint *samplers); \
+ void createTextures(GLenum target, GLsizei n, GLuint *textures); \
+ void createTransformFeedbacks(GLsizei n, GLuint *ids); \
+ void createVertexArrays(GLsizei n, GLuint *arrays); \
+ void disableVertexArrayAttrib(GLuint vaobj, GLuint index); \
+ void enableVertexArrayAttrib(GLuint vaobj, GLuint index); \
+ void flushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length); \
+ void generateTextureMipmap(GLuint texture); \
+ void getCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels); \
+ void getCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, \
+ GLsizei bufSize, void *pixels); \
+ void getNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params); \
+ void getNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params); \
+ void getNamedBufferPointerv(GLuint buffer, GLenum pname, void **params); \
+ void getNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); \
+ void getNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, \
+ GLenum pname, GLint *params); \
+ void getNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param); \
+ void getNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params); \
+ void getQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); \
+ void getQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); \
+ void getQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); \
+ void getQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset); \
+ void getTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, \
+ void *pixels); \
+ void getTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params); \
+ void getTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params); \
+ void getTextureParameterIiv(GLuint texture, GLenum pname, GLint *params); \
+ void getTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params); \
+ void getTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params); \
+ void getTextureParameteriv(GLuint texture, GLenum pname, GLint *params); \
+ void getTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, \
+ GLenum format, GLenum type, GLsizei bufSize, void *pixels); \
+ void getTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param); \
+ void getTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param); \
+ void getTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param); \
+ void getVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); \
+ void getVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param); \
+ void getVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param); \
+ void getnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); \
+ void getnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels); \
+ void getnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, \
+ void *image); \
+ void getnHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, \
+ GLsizei bufSize, void *values); \
+ void getnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); \
+ void getnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); \
+ void getnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v); \
+ void getnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, \
+ void *values); \
+ void getnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values); \
+ void getnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values); \
+ void getnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values); \
+ void getnPolygonStipple(GLsizei bufSize, GLubyte *pattern); \
+ void getnSeparableFilter(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, \
+ void *row, GLsizei columnBufSize, void *column, void *span); \
+ void getnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, \
+ void *pixels); \
+ void getnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params); \
+ void getnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params); \
+ void invalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, \
+ const GLenum *attachments); \
+ void invalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, \
+ const GLenum *attachments, GLint x, GLint y, \
+ GLsizei width, GLsizei height); \
+ void *mapNamedBuffer(GLuint buffer, GLenum access); \
+ void *mapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, \
+ GLbitfield access); \
+ void namedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); \
+ void namedBufferStorage(GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); \
+ void namedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); \
+ void namedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf); \
+ void namedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs); \
+ void namedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param); \
+ void namedFramebufferReadBuffer(GLuint framebuffer, GLenum src); \
+ void namedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, \
+ GLenum renderbuffertarget, GLuint renderbuffer); \
+ void namedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, \
+ GLint level); \
+ void namedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, \
+ GLint level, GLint layer); \
+ void namedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, \
+ GLsizei height); \
+ void namedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, \
+ GLenum internalformat, GLsizei width, \
+ GLsizei height); \
+ void textureBarrier(); \
+ void textureBuffer(GLuint texture, GLenum internalformat, GLuint buffer); \
+ void textureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, \
+ GLsizeiptr size); \
+ void textureParameterIiv(GLuint texture, GLenum pname, const GLint *params); \
+ void textureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params); \
+ void textureParameterf(GLuint texture, GLenum pname, GLfloat param); \
+ void textureParameterfv(GLuint texture, GLenum pname, const GLfloat *param); \
+ void textureParameteri(GLuint texture, GLenum pname, GLint param); \
+ void textureParameteriv(GLuint texture, GLenum pname, const GLint *param); \
+ void textureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); \
+ void textureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, \
+ GLsizei height); \
+ void textureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, \
+ GLsizei width, GLsizei height, \
+ GLboolean fixedsamplelocations); \
+ void textureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, \
+ GLsizei height, GLsizei depth); \
+ void textureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLsizei depth, \
+ GLboolean fixedsamplelocations); \
+ void textureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, \
+ GLenum format, GLenum type, const void *pixels); \
+ void textureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLsizei width, GLsizei height, GLenum format, GLenum type, \
+ const void *pixels); \
+ void textureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, \
+ GLenum format, GLenum type, const void *pixels); \
+ void transformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer); \
+ void transformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, \
+ GLsizeiptr size); \
+ GLboolean unmapNamedBuffer(GLuint buffer); \
+ void vertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex); \
+ void vertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, \
+ GLboolean normalized, GLuint relativeoffset); \
+ void vertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, \
+ GLuint relativeoffset); \
+ void vertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, \
+ GLuint relativeoffset); \
+ void vertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor); \
+ void vertexArrayElementBuffer(GLuint vaobj, GLuint buffer); \
+ void vertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, \
+ GLintptr offset, GLsizei stride); \
+ void vertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, \
+ const GLuint *buffers, const GLintptr *offsets, \
+ const GLsizei *strides);
+
+#endif // ANGLE_CONTEXT_API_4_5_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gl_4_6_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gl_4_6_autogen.h
new file mode 100644
index 0000000000..9f1116e714
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gl_4_6_autogen.h
@@ -0,0 +1,23 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gl_4_6_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GL_4_6_AUTOGEN_H_
+#define ANGLE_CONTEXT_GL_4_6_AUTOGEN_H_
+
+#define ANGLE_GL_4_6_CONTEXT_API \
+ void multiDrawArraysIndirectCount(GLenum mode, const void *indirect, GLintptr drawcount, \
+ GLsizei maxdrawcount, GLsizei stride); \
+ void multiDrawElementsIndirectCount(GLenum mode, GLenum type, const void *indirect, \
+ GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); \
+ void polygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp); \
+ void specializeShader(GLuint shader, const GLchar *pEntryPoint, \
+ GLuint numSpecializationConstants, const GLuint *pConstantIndex, \
+ const GLuint *pConstantValue);
+
+#endif // ANGLE_CONTEXT_API_4_6_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_1_0.cpp b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0.cpp
new file mode 100644
index 0000000000..01bc7d0a8d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0.cpp
@@ -0,0 +1,725 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Context_gles_1_0.cpp: Implements the GLES1-specific parts of Context.
+
+#include "libANGLE/Context.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+#include "libANGLE/GLES1Renderer.h"
+#include "libANGLE/queryconversions.h"
+#include "libANGLE/queryutils.h"
+
+namespace
+{
+
+angle::Mat4 FixedMatrixToMat4(const GLfixed *m)
+{
+ angle::Mat4 matrixAsFloat;
+ GLfloat *floatData = matrixAsFloat.data();
+
+ for (int i = 0; i < 16; i++)
+ {
+ floatData[i] = gl::FixedToFloat(m[i]);
+ }
+
+ return matrixAsFloat;
+}
+
+} // namespace
+
+namespace gl
+{
+
+void Context::alphaFunc(AlphaTestFunc func, GLfloat ref)
+{
+ mState.gles1().setAlphaFunc(func, ref);
+}
+
+void Context::alphaFuncx(AlphaTestFunc func, GLfixed ref)
+{
+ mState.gles1().setAlphaFunc(func, FixedToFloat(ref));
+}
+
+void Context::clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clearDepthx(GLfixed depth)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::clientActiveTexture(GLenum texture)
+{
+ mState.gles1().setClientTextureUnit(texture - GL_TEXTURE0);
+ mStateCache.onGLES1ClientStateChange(this);
+}
+
+void Context::clipPlanef(GLenum p, const GLfloat *eqn)
+{
+ mState.gles1().setClipPlane(p - GL_CLIP_PLANE0, eqn);
+}
+
+void Context::clipPlanex(GLenum plane, const GLfixed *equation)
+{
+ const GLfloat equationf[4] = {
+ FixedToFloat(equation[0]),
+ FixedToFloat(equation[1]),
+ FixedToFloat(equation[2]),
+ FixedToFloat(equation[3]),
+ };
+
+ mState.gles1().setClipPlane(plane - GL_CLIP_PLANE0, equationf);
+}
+
+void Context::color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ mState.gles1().setCurrentColor({red, green, blue, alpha});
+}
+
+void Context::color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ mState.gles1().setCurrentColor(
+ {normalizedToFloat<uint8_t>(red), normalizedToFloat<uint8_t>(green),
+ normalizedToFloat<uint8_t>(blue), normalizedToFloat<uint8_t>(alpha)});
+}
+
+void Context::color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ mState.gles1().setCurrentColor(
+ {FixedToFloat(red), FixedToFloat(green), FixedToFloat(blue), FixedToFloat(alpha)});
+}
+
+void Context::colorPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
+{
+ vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Color), size, type, GL_FALSE,
+ stride, ptr);
+}
+
+void Context::depthRangex(GLfixed n, GLfixed f)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::disableClientState(ClientVertexArrayType clientState)
+{
+ mState.gles1().setClientStateEnabled(clientState, false);
+ disableVertexAttribArray(vertexArrayIndex(clientState));
+ mStateCache.onGLES1ClientStateChange(this);
+}
+
+void Context::enableClientState(ClientVertexArrayType clientState)
+{
+ mState.gles1().setClientStateEnabled(clientState, true);
+ enableVertexAttribArray(vertexArrayIndex(clientState));
+ mStateCache.onGLES1ClientStateChange(this);
+}
+
+void Context::fogf(GLenum pname, GLfloat param)
+{
+ SetFogParameters(&mState.gles1(), pname, &param);
+}
+
+void Context::fogfv(GLenum pname, const GLfloat *params)
+{
+ SetFogParameters(&mState.gles1(), pname, params);
+}
+
+void Context::fogx(GLenum pname, GLfixed param)
+{
+ if (GetFogParameterCount(pname) == 1)
+ {
+ GLfloat paramf = pname == GL_FOG_MODE ? ConvertToGLenum(param) : FixedToFloat(param);
+ fogf(pname, paramf);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+}
+
+void Context::fogxv(GLenum pname, const GLfixed *params)
+{
+ int paramCount = GetFogParameterCount(pname);
+
+ if (paramCount > 0)
+ {
+ GLfloat paramsf[4];
+ for (int i = 0; i < paramCount; i++)
+ {
+ paramsf[i] =
+ pname == GL_FOG_MODE ? ConvertToGLenum(params[i]) : FixedToFloat(params[i]);
+ }
+ fogfv(pname, paramsf);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+}
+
+void Context::frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f)
+{
+ mState.gles1().multMatrix(angle::Mat4::Frustum(l, r, b, t, n, f));
+}
+
+void Context::frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
+{
+ mState.gles1().multMatrix(angle::Mat4::Frustum(FixedToFloat(l), FixedToFloat(r),
+ FixedToFloat(b), FixedToFloat(t),
+ FixedToFloat(n), FixedToFloat(f)));
+}
+
+void Context::getClipPlanef(GLenum plane, GLfloat *equation)
+{
+ mState.gles1().getClipPlane(plane - GL_CLIP_PLANE0, equation);
+}
+
+void Context::getClipPlanex(GLenum plane, GLfixed *equation)
+{
+ GLfloat equationf[4] = {};
+
+ mState.gles1().getClipPlane(plane - GL_CLIP_PLANE0, equationf);
+
+ for (int i = 0; i < 4; i++)
+ {
+ equation[i] = FloatToFixed(equationf[i]);
+ }
+}
+
+void Context::getFixedv(GLenum pname, GLfixed *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getLightfv(GLenum light, LightParameter pname, GLfloat *params)
+{
+ GetLightParameters(&mState.gles1(), light, pname, params);
+}
+
+void Context::getLightxv(GLenum light, LightParameter pname, GLfixed *params)
+{
+ GLfloat paramsf[4];
+ getLightfv(light, pname, paramsf);
+
+ for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
+ {
+ params[i] = FloatToFixed(paramsf[i]);
+ }
+}
+
+void Context::getMaterialfv(GLenum face, MaterialParameter pname, GLfloat *params)
+{
+ GetMaterialParameters(&mState.gles1(), face, pname, params);
+}
+
+void Context::getMaterialxv(GLenum face, MaterialParameter pname, GLfixed *params)
+{
+ GLfloat paramsf[4];
+ getMaterialfv(face, pname, paramsf);
+
+ for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
+ {
+ params[i] = FloatToFixed(paramsf[i]);
+ }
+}
+
+void Context::getTexEnvfv(TextureEnvTarget target, TextureEnvParameter pname, GLfloat *params)
+{
+ GetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, params);
+}
+
+void Context::getTexEnviv(TextureEnvTarget target, TextureEnvParameter pname, GLint *params)
+{
+ GLfloat paramsf[4];
+ GetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
+ ConvertTextureEnvToInt(pname, paramsf, params);
+}
+
+void Context::getTexEnvxv(TextureEnvTarget target, TextureEnvParameter pname, GLfixed *params)
+{
+ GLfloat paramsf[4];
+ GetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
+ ConvertTextureEnvToFixed(pname, paramsf, params);
+}
+
+void Context::getTexParameterxv(TextureType target, GLenum pname, GLfixed *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::lightModelf(GLenum pname, GLfloat param)
+{
+ SetLightModelParameters(&mState.gles1(), pname, &param);
+}
+
+void Context::lightModelfv(GLenum pname, const GLfloat *params)
+{
+ SetLightModelParameters(&mState.gles1(), pname, params);
+}
+
+void Context::lightModelx(GLenum pname, GLfixed param)
+{
+ lightModelf(pname, FixedToFloat(param));
+}
+
+void Context::lightModelxv(GLenum pname, const GLfixed *param)
+{
+ GLfloat paramsf[4];
+
+ for (unsigned int i = 0; i < GetLightModelParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(param[i]);
+ }
+
+ lightModelfv(pname, paramsf);
+}
+
+void Context::lightf(GLenum light, LightParameter pname, GLfloat param)
+{
+ SetLightParameters(&mState.gles1(), light, pname, &param);
+}
+
+void Context::lightfv(GLenum light, LightParameter pname, const GLfloat *params)
+{
+ SetLightParameters(&mState.gles1(), light, pname, params);
+}
+
+void Context::lightx(GLenum light, LightParameter pname, GLfixed param)
+{
+ lightf(light, pname, FixedToFloat(param));
+}
+
+void Context::lightxv(GLenum light, LightParameter pname, const GLfixed *params)
+{
+ GLfloat paramsf[4];
+
+ for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(params[i]);
+ }
+
+ lightfv(light, pname, paramsf);
+}
+
+void Context::lineWidthx(GLfixed width)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::loadIdentity()
+{
+ mState.gles1().loadMatrix(angle::Mat4());
+}
+
+void Context::loadMatrixf(const GLfloat *m)
+{
+ mState.gles1().loadMatrix(angle::Mat4(m));
+}
+
+void Context::loadMatrixx(const GLfixed *m)
+{
+ mState.gles1().loadMatrix(FixedMatrixToMat4(m));
+}
+
+void Context::logicOp(LogicalOperation opcodePacked)
+{
+ mState.gles1().setLogicOp(opcodePacked);
+}
+
+void Context::materialf(GLenum face, MaterialParameter pname, GLfloat param)
+{
+ SetMaterialParameters(&mState.gles1(), face, pname, &param);
+}
+
+void Context::materialfv(GLenum face, MaterialParameter pname, const GLfloat *params)
+{
+ SetMaterialParameters(&mState.gles1(), face, pname, params);
+}
+
+void Context::materialx(GLenum face, MaterialParameter pname, GLfixed param)
+{
+ materialf(face, pname, FixedToFloat(param));
+}
+
+void Context::materialxv(GLenum face, MaterialParameter pname, const GLfixed *param)
+{
+ GLfloat paramsf[4];
+
+ for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(param[i]);
+ }
+
+ materialfv(face, pname, paramsf);
+}
+
+void Context::matrixMode(MatrixType mode)
+{
+ mState.gles1().setMatrixMode(mode);
+}
+
+void Context::multMatrixf(const GLfloat *m)
+{
+ mState.gles1().multMatrix(angle::Mat4(m));
+}
+
+void Context::multMatrixx(const GLfixed *m)
+{
+ mState.gles1().multMatrix(FixedMatrixToMat4(m));
+}
+
+void Context::multiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ unsigned int unit = target - GL_TEXTURE0;
+ ASSERT(target >= GL_TEXTURE0 && unit < getCaps().maxMultitextureUnits);
+ mState.gles1().setCurrentTextureCoords(unit, {s, t, r, q});
+}
+
+void Context::multiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+{
+ unsigned int unit = target - GL_TEXTURE0;
+ ASSERT(target >= GL_TEXTURE0 && unit < getCaps().maxMultitextureUnits);
+ mState.gles1().setCurrentTextureCoords(
+ unit, {FixedToFloat(s), FixedToFloat(t), FixedToFloat(r), FixedToFloat(q)});
+}
+
+void Context::normal3f(GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ mState.gles1().setCurrentNormal({nx, ny, nz});
+}
+
+void Context::normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
+{
+ mState.gles1().setCurrentNormal({FixedToFloat(nx), FixedToFloat(ny), FixedToFloat(nz)});
+}
+
+void Context::normalPointer(VertexAttribType type, GLsizei stride, const void *ptr)
+{
+ vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Normal), 3, type, GL_FALSE, stride,
+ ptr);
+}
+
+void Context::orthof(GLfloat left,
+ GLfloat right,
+ GLfloat bottom,
+ GLfloat top,
+ GLfloat zNear,
+ GLfloat zFar)
+{
+ mState.gles1().multMatrix(angle::Mat4::Ortho(left, right, bottom, top, zNear, zFar));
+}
+
+void Context::orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
+{
+ mState.gles1().multMatrix(angle::Mat4::Ortho(FixedToFloat(l), FixedToFloat(r), FixedToFloat(b),
+ FixedToFloat(t), FixedToFloat(n),
+ FixedToFloat(f)));
+}
+
+void Context::pointParameterf(PointParameter pname, GLfloat param)
+{
+ SetPointParameter(&mState.gles1(), pname, &param);
+}
+
+void Context::pointParameterfv(PointParameter pname, const GLfloat *params)
+{
+ SetPointParameter(&mState.gles1(), pname, params);
+}
+
+void Context::pointParameterx(PointParameter pname, GLfixed param)
+{
+ GLfloat paramf = FixedToFloat(param);
+ SetPointParameter(&mState.gles1(), pname, &paramf);
+}
+
+void Context::pointParameterxv(PointParameter pname, const GLfixed *params)
+{
+ GLfloat paramsf[4] = {};
+ for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(params[i]);
+ }
+ SetPointParameter(&mState.gles1(), pname, paramsf);
+}
+
+void Context::pointSize(GLfloat size)
+{
+ SetPointSize(&mState.gles1(), size);
+}
+
+void Context::pointSizex(GLfixed size)
+{
+ SetPointSize(&mState.gles1(), FixedToFloat(size));
+}
+
+void Context::polygonOffsetx(GLfixed factor, GLfixed units)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::popMatrix()
+{
+ mState.gles1().popMatrix();
+}
+
+void Context::pushMatrix()
+{
+ mState.gles1().pushMatrix();
+}
+
+void Context::rotatef(float angle, float x, float y, float z)
+{
+ mState.gles1().multMatrix(angle::Mat4::Rotate(angle, angle::Vector3(x, y, z)));
+}
+
+void Context::rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+{
+ mState.gles1().multMatrix(angle::Mat4::Rotate(
+ FixedToFloat(angle), angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
+}
+
+void Context::sampleCoveragex(GLclampx value, GLboolean invert)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::scalef(float x, float y, float z)
+{
+ mState.gles1().multMatrix(angle::Mat4::Scale(angle::Vector3(x, y, z)));
+}
+
+void Context::scalex(GLfixed x, GLfixed y, GLfixed z)
+{
+ mState.gles1().multMatrix(
+ angle::Mat4::Scale(angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
+}
+
+void Context::shadeModel(ShadingModel model)
+{
+ mState.gles1().setShadeModel(model);
+}
+
+void Context::texCoordPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
+{
+ vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::TextureCoord), size, type, GL_FALSE,
+ stride, ptr);
+}
+
+void Context::texEnvf(TextureEnvTarget target, TextureEnvParameter pname, GLfloat param)
+{
+ SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, &param);
+}
+
+void Context::texEnvfv(TextureEnvTarget target, TextureEnvParameter pname, const GLfloat *params)
+{
+ SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, params);
+}
+
+void Context::texEnvi(TextureEnvTarget target, TextureEnvParameter pname, GLint param)
+{
+ GLfloat paramsf[4] = {};
+ ConvertTextureEnvFromInt(pname, &param, paramsf);
+ SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
+}
+
+void Context::texEnviv(TextureEnvTarget target, TextureEnvParameter pname, const GLint *params)
+{
+ GLfloat paramsf[4] = {};
+ ConvertTextureEnvFromInt(pname, params, paramsf);
+ SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
+}
+
+void Context::texEnvx(TextureEnvTarget target, TextureEnvParameter pname, GLfixed param)
+{
+ GLfloat paramsf[4] = {};
+ ConvertTextureEnvFromFixed(pname, &param, paramsf);
+ SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
+}
+
+void Context::texEnvxv(TextureEnvTarget target, TextureEnvParameter pname, const GLfixed *params)
+{
+ GLfloat paramsf[4] = {};
+ ConvertTextureEnvFromFixed(pname, params, paramsf);
+ SetTextureEnv(mState.getActiveSampler(), &mState.gles1(), target, pname, paramsf);
+}
+
+void Context::texParameterx(TextureType target, GLenum pname, GLfixed param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texParameterxv(TextureType target, GLenum pname, const GLfixed *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::translatef(float x, float y, float z)
+{
+ mState.gles1().multMatrix(angle::Mat4::Translate(angle::Vector3(x, y, z)));
+}
+
+void Context::translatex(GLfixed x, GLfixed y, GLfixed z)
+{
+ mState.gles1().multMatrix(
+ angle::Mat4::Translate(angle::Vector3(FixedToFloat(x), FixedToFloat(y), FixedToFloat(z))));
+}
+
+void Context::vertexPointer(GLint size, VertexAttribType type, GLsizei stride, const void *ptr)
+{
+ vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::Vertex), size, type, GL_FALSE,
+ stride, ptr);
+}
+
+// GL_OES_draw_texture
+void Context::drawTexf(float x, float y, float z, float width, float height)
+{
+ mGLES1Renderer->drawTexture(this, &mState, x, y, z, width, height);
+}
+
+void Context::drawTexfv(const GLfloat *coords)
+{
+ mGLES1Renderer->drawTexture(this, &mState, coords[0], coords[1], coords[2], coords[3],
+ coords[4]);
+}
+
+void Context::drawTexi(GLint x, GLint y, GLint z, GLint width, GLint height)
+{
+ mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(x), static_cast<GLfloat>(y),
+ static_cast<GLfloat>(z), static_cast<GLfloat>(width),
+ static_cast<GLfloat>(height));
+}
+
+void Context::drawTexiv(const GLint *coords)
+{
+ mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(coords[0]),
+ static_cast<GLfloat>(coords[1]), static_cast<GLfloat>(coords[2]),
+ static_cast<GLfloat>(coords[3]), static_cast<GLfloat>(coords[4]));
+}
+
+void Context::drawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
+{
+ mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(x), static_cast<GLfloat>(y),
+ static_cast<GLfloat>(z), static_cast<GLfloat>(width),
+ static_cast<GLfloat>(height));
+}
+
+void Context::drawTexsv(const GLshort *coords)
+{
+ mGLES1Renderer->drawTexture(this, &mState, static_cast<GLfloat>(coords[0]),
+ static_cast<GLfloat>(coords[1]), static_cast<GLfloat>(coords[2]),
+ static_cast<GLfloat>(coords[3]), static_cast<GLfloat>(coords[4]));
+}
+
+void Context::drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
+{
+ mGLES1Renderer->drawTexture(this, &mState, FixedToFloat(x), FixedToFloat(y), FixedToFloat(z),
+ FixedToFloat(width), FixedToFloat(height));
+}
+
+void Context::drawTexxv(const GLfixed *coords)
+{
+ mGLES1Renderer->drawTexture(this, &mState, FixedToFloat(coords[0]), FixedToFloat(coords[1]),
+ FixedToFloat(coords[2]), FixedToFloat(coords[3]),
+ FixedToFloat(coords[4]));
+}
+
+// GL_OES_matrix_palette
+void Context::currentPaletteMatrix(GLuint matrixpaletteindex)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::loadPaletteFromModelViewMatrix()
+{
+ UNIMPLEMENTED();
+}
+
+void Context::matrixIndexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::weightPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ UNIMPLEMENTED();
+}
+
+// GL_OES_point_size_array
+void Context::pointSizePointer(VertexAttribType type, GLsizei stride, const void *ptr)
+{
+ vertexAttribPointer(vertexArrayIndex(ClientVertexArrayType::PointSize), 1, type, GL_FALSE,
+ stride, ptr);
+}
+
+// GL_OES_query_matrix
+GLbitfield Context::queryMatrixx(GLfixed *mantissa, GLint *exponent)
+{
+ UNIMPLEMENTED();
+ return 0;
+}
+
+// GL_OES_texture_cube_map
+void Context::getTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTexGeniv(GLenum coord, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::getTexGenxv(GLenum coord, GLenum pname, GLfixed *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGenf(GLenum coord, GLenum pname, GLfloat param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGenfv(GLenum coord, GLenum pname, const GLfloat *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGeni(GLenum coord, GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGeniv(GLenum coord, GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGenx(GLenum coord, GLenum pname, GLfixed param)
+{
+ UNIMPLEMENTED();
+}
+
+void Context::texGenxv(GLenum coord, GLenum pname, const GLint *params)
+{
+ UNIMPLEMENTED();
+}
+
+int Context::vertexArrayIndex(ClientVertexArrayType type) const
+{
+ return GLES1Renderer::VertexArrayIndex(type, mState.gles1());
+}
+
+// static
+int Context::TexCoordArrayIndex(unsigned int unit)
+{
+ return GLES1Renderer::TexCoordArrayIndex(unit);
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_1_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0_autogen.h
new file mode 100644
index 0000000000..ab7836a203
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0_autogen.h
@@ -0,0 +1,109 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gles_1_0_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GLES_1_0_AUTOGEN_H_
+#define ANGLE_CONTEXT_GLES_1_0_AUTOGEN_H_
+
+#define ANGLE_GLES_1_0_CONTEXT_API \
+ void alphaFunc(AlphaTestFunc funcPacked, GLfloat ref); \
+ void alphaFuncx(AlphaTestFunc funcPacked, GLfixed ref); \
+ void clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); \
+ void clearDepthx(GLfixed depth); \
+ void clientActiveTexture(GLenum texture); \
+ void clipPlanef(GLenum p, const GLfloat *eqn); \
+ void clipPlanex(GLenum plane, const GLfixed *equation); \
+ void color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); \
+ void color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); \
+ void color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); \
+ void colorPointer(GLint size, VertexAttribType typePacked, GLsizei stride, \
+ const void *pointer); \
+ void depthRangex(GLfixed n, GLfixed f); \
+ void disableClientState(ClientVertexArrayType arrayPacked); \
+ void enableClientState(ClientVertexArrayType arrayPacked); \
+ void fogf(GLenum pname, GLfloat param); \
+ void fogfv(GLenum pname, const GLfloat *params); \
+ void fogx(GLenum pname, GLfixed param); \
+ void fogxv(GLenum pname, const GLfixed *param); \
+ void frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); \
+ void frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); \
+ void getClipPlanef(GLenum plane, GLfloat *equation); \
+ void getClipPlanex(GLenum plane, GLfixed *equation); \
+ void getFixedv(GLenum pname, GLfixed *params); \
+ void getLightfv(GLenum light, LightParameter pnamePacked, GLfloat *params); \
+ void getLightxv(GLenum light, LightParameter pnamePacked, GLfixed *params); \
+ void getMaterialfv(GLenum face, MaterialParameter pnamePacked, GLfloat *params); \
+ void getMaterialxv(GLenum face, MaterialParameter pnamePacked, GLfixed *params); \
+ void getTexEnvfv(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, \
+ GLfloat *params); \
+ void getTexEnviv(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, \
+ GLint *params); \
+ void getTexEnvxv(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, \
+ GLfixed *params); \
+ void getTexParameterxv(TextureType targetPacked, GLenum pname, GLfixed *params); \
+ void lightModelf(GLenum pname, GLfloat param); \
+ void lightModelfv(GLenum pname, const GLfloat *params); \
+ void lightModelx(GLenum pname, GLfixed param); \
+ void lightModelxv(GLenum pname, const GLfixed *param); \
+ void lightf(GLenum light, LightParameter pnamePacked, GLfloat param); \
+ void lightfv(GLenum light, LightParameter pnamePacked, const GLfloat *params); \
+ void lightx(GLenum light, LightParameter pnamePacked, GLfixed param); \
+ void lightxv(GLenum light, LightParameter pnamePacked, const GLfixed *params); \
+ void lineWidthx(GLfixed width); \
+ void loadIdentity(); \
+ void loadMatrixf(const GLfloat *m); \
+ void loadMatrixx(const GLfixed *m); \
+ void logicOp(LogicalOperation opcodePacked); \
+ void materialf(GLenum face, MaterialParameter pnamePacked, GLfloat param); \
+ void materialfv(GLenum face, MaterialParameter pnamePacked, const GLfloat *params); \
+ void materialx(GLenum face, MaterialParameter pnamePacked, GLfixed param); \
+ void materialxv(GLenum face, MaterialParameter pnamePacked, const GLfixed *param); \
+ void matrixMode(MatrixType modePacked); \
+ void multMatrixf(const GLfloat *m); \
+ void multMatrixx(const GLfixed *m); \
+ void multiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); \
+ void multiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); \
+ void normal3f(GLfloat nx, GLfloat ny, GLfloat nz); \
+ void normal3x(GLfixed nx, GLfixed ny, GLfixed nz); \
+ void normalPointer(VertexAttribType typePacked, GLsizei stride, const void *pointer); \
+ void orthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); \
+ void orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); \
+ void pointParameterf(PointParameter pnamePacked, GLfloat param); \
+ void pointParameterfv(PointParameter pnamePacked, const GLfloat *params); \
+ void pointParameterx(PointParameter pnamePacked, GLfixed param); \
+ void pointParameterxv(PointParameter pnamePacked, const GLfixed *params); \
+ void pointSize(GLfloat size); \
+ void pointSizex(GLfixed size); \
+ void polygonOffsetx(GLfixed factor, GLfixed units); \
+ void popMatrix(); \
+ void pushMatrix(); \
+ void rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); \
+ void rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); \
+ void sampleCoveragex(GLclampx value, GLboolean invert); \
+ void scalef(GLfloat x, GLfloat y, GLfloat z); \
+ void scalex(GLfixed x, GLfixed y, GLfixed z); \
+ void shadeModel(ShadingModel modePacked); \
+ void texCoordPointer(GLint size, VertexAttribType typePacked, GLsizei stride, \
+ const void *pointer); \
+ void texEnvf(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, GLfloat param); \
+ void texEnvfv(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, \
+ const GLfloat *params); \
+ void texEnvi(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, GLint param); \
+ void texEnviv(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, \
+ const GLint *params); \
+ void texEnvx(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, GLfixed param); \
+ void texEnvxv(TextureEnvTarget targetPacked, TextureEnvParameter pnamePacked, \
+ const GLfixed *params); \
+ void texParameterx(TextureType targetPacked, GLenum pname, GLfixed param); \
+ void texParameterxv(TextureType targetPacked, GLenum pname, const GLfixed *params); \
+ void translatef(GLfloat x, GLfloat y, GLfloat z); \
+ void translatex(GLfixed x, GLfixed y, GLfixed z); \
+ void vertexPointer(GLint size, VertexAttribType typePacked, GLsizei stride, \
+ const void *pointer);
+
+#endif // ANGLE_CONTEXT_API_1_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_2_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gles_2_0_autogen.h
new file mode 100644
index 0000000000..2092853e16
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gles_2_0_autogen.h
@@ -0,0 +1,183 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gles_2_0_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GLES_2_0_AUTOGEN_H_
+#define ANGLE_CONTEXT_GLES_2_0_AUTOGEN_H_
+
+#define ANGLE_GLES_2_0_CONTEXT_API \
+ void activeTexture(GLenum texture); \
+ void attachShader(GLuint program, GLuint shader); \
+ void bindAttribLocation(GLuint program, GLuint index, const GLchar *name); \
+ void bindBuffer(BufferBinding targetPacked, GLuint buffer); \
+ void bindFramebuffer(GLenum target, GLuint framebuffer); \
+ void bindRenderbuffer(GLenum target, GLuint renderbuffer); \
+ void bindTexture(TextureType targetPacked, GLuint texture); \
+ void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); \
+ void blendEquation(GLenum mode); \
+ void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); \
+ void blendFunc(GLenum sfactor, GLenum dfactor); \
+ void blendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, \
+ GLenum dfactorAlpha); \
+ void bufferData(BufferBinding targetPacked, GLsizeiptr size, const void *data, \
+ BufferUsage usagePacked); \
+ void bufferSubData(BufferBinding targetPacked, GLintptr offset, GLsizeiptr size, \
+ const void *data); \
+ GLenum checkFramebufferStatus(GLenum target); \
+ void clear(GLbitfield mask); \
+ void clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); \
+ void clearDepthf(GLfloat d); \
+ void clearStencil(GLint s); \
+ void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); \
+ void compileShader(GLuint shader); \
+ void compressedTexImage2D(TextureTarget targetPacked, GLint level, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLint border, GLsizei imageSize, \
+ const void *data); \
+ void compressedTexSubImage2D(TextureTarget targetPacked, GLint level, GLint xoffset, \
+ GLint yoffset, GLsizei width, GLsizei height, GLenum format, \
+ GLsizei imageSize, const void *data); \
+ void copyTexImage2D(TextureTarget targetPacked, GLint level, GLenum internalformat, GLint x, \
+ GLint y, GLsizei width, GLsizei height, GLint border); \
+ void copyTexSubImage2D(TextureTarget targetPacked, GLint level, GLint xoffset, GLint yoffset, \
+ GLint x, GLint y, GLsizei width, GLsizei height); \
+ GLuint createProgram(); \
+ GLuint createShader(ShaderType typePacked); \
+ void cullFace(CullFaceMode modePacked); \
+ void deleteBuffers(GLsizei n, const GLuint *buffers); \
+ void deleteFramebuffers(GLsizei n, const GLuint *framebuffers); \
+ void deleteProgram(GLuint program); \
+ void deleteRenderbuffers(GLsizei n, const GLuint *renderbuffers); \
+ void deleteShader(GLuint shader); \
+ void deleteTextures(GLsizei n, const GLuint *textures); \
+ void depthFunc(GLenum func); \
+ void depthMask(GLboolean flag); \
+ void depthRangef(GLfloat n, GLfloat f); \
+ void detachShader(GLuint program, GLuint shader); \
+ void disable(GLenum cap); \
+ void disableVertexAttribArray(GLuint index); \
+ void drawArrays(PrimitiveMode modePacked, GLint first, GLsizei count); \
+ void drawElements(PrimitiveMode modePacked, GLsizei count, DrawElementsType typePacked, \
+ const void *indices); \
+ void enable(GLenum cap); \
+ void enableVertexAttribArray(GLuint index); \
+ void finish(); \
+ void flush(); \
+ void framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, \
+ GLuint renderbuffer); \
+ void framebufferTexture2D(GLenum target, GLenum attachment, TextureTarget textargetPacked, \
+ GLuint texture, GLint level); \
+ void frontFace(GLenum mode); \
+ void genBuffers(GLsizei n, GLuint *buffers); \
+ void genFramebuffers(GLsizei n, GLuint *framebuffers); \
+ void genRenderbuffers(GLsizei n, GLuint *renderbuffers); \
+ void genTextures(GLsizei n, GLuint *textures); \
+ void generateMipmap(TextureType targetPacked); \
+ void getActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, \
+ GLint *size, GLenum *type, GLchar *name); \
+ void getActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, \
+ GLint *size, GLenum *type, GLchar *name); \
+ void getAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); \
+ GLint getAttribLocation(GLuint program, const GLchar *name); \
+ void getBooleanv(GLenum pname, GLboolean *data); \
+ void getBufferParameteriv(BufferBinding targetPacked, GLenum pname, GLint *params); \
+ GLenum getError(); \
+ void getFloatv(GLenum pname, GLfloat *data); \
+ void getFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, \
+ GLint *params); \
+ void getIntegerv(GLenum pname, GLint *data); \
+ void getProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); \
+ void getProgramiv(GLuint program, GLenum pname, GLint *params); \
+ void getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params); \
+ void getShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); \
+ void getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, \
+ GLint *precision); \
+ void getShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); \
+ void getShaderiv(GLuint shader, GLenum pname, GLint *params); \
+ const GLubyte *getString(GLenum name); \
+ void getTexParameterfv(TextureType targetPacked, GLenum pname, GLfloat *params); \
+ void getTexParameteriv(TextureType targetPacked, GLenum pname, GLint *params); \
+ GLint getUniformLocation(GLuint program, const GLchar *name); \
+ void getUniformfv(GLuint program, GLint location, GLfloat *params); \
+ void getUniformiv(GLuint program, GLint location, GLint *params); \
+ void getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer); \
+ void getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params); \
+ void getVertexAttribiv(GLuint index, GLenum pname, GLint *params); \
+ void hint(GLenum target, GLenum mode); \
+ GLboolean isBuffer(GLuint buffer); \
+ GLboolean isEnabled(GLenum cap); \
+ GLboolean isFramebuffer(GLuint framebuffer); \
+ GLboolean isProgram(GLuint program); \
+ GLboolean isRenderbuffer(GLuint renderbuffer); \
+ GLboolean isShader(GLuint shader); \
+ GLboolean isTexture(GLuint texture); \
+ void lineWidth(GLfloat width); \
+ void linkProgram(GLuint program); \
+ void pixelStorei(GLenum pname, GLint param); \
+ void polygonOffset(GLfloat factor, GLfloat units); \
+ void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, \
+ void *pixels); \
+ void releaseShaderCompiler(); \
+ void renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); \
+ void sampleCoverage(GLfloat value, GLboolean invert); \
+ void scissor(GLint x, GLint y, GLsizei width, GLsizei height); \
+ void shaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, \
+ const void *binary, GLsizei length); \
+ void shaderSource(GLuint shader, GLsizei count, const GLchar *const *string, \
+ const GLint *length); \
+ void stencilFunc(GLenum func, GLint ref, GLuint mask); \
+ void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); \
+ void stencilMask(GLuint mask); \
+ void stencilMaskSeparate(GLenum face, GLuint mask); \
+ void stencilOp(GLenum fail, GLenum zfail, GLenum zpass); \
+ void stencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); \
+ void texImage2D(TextureTarget targetPacked, GLint level, GLint internalformat, GLsizei width, \
+ GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); \
+ void texParameterf(TextureType targetPacked, GLenum pname, GLfloat param); \
+ void texParameterfv(TextureType targetPacked, GLenum pname, const GLfloat *params); \
+ void texParameteri(TextureType targetPacked, GLenum pname, GLint param); \
+ void texParameteriv(TextureType targetPacked, GLenum pname, const GLint *params); \
+ void texSubImage2D(TextureTarget targetPacked, GLint level, GLint xoffset, GLint yoffset, \
+ GLsizei width, GLsizei height, GLenum format, GLenum type, \
+ const void *pixels); \
+ void uniform1f(GLint location, GLfloat v0); \
+ void uniform1fv(GLint location, GLsizei count, const GLfloat *value); \
+ void uniform1i(GLint location, GLint v0); \
+ void uniform1iv(GLint location, GLsizei count, const GLint *value); \
+ void uniform2f(GLint location, GLfloat v0, GLfloat v1); \
+ void uniform2fv(GLint location, GLsizei count, const GLfloat *value); \
+ void uniform2i(GLint location, GLint v0, GLint v1); \
+ void uniform2iv(GLint location, GLsizei count, const GLint *value); \
+ void uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); \
+ void uniform3fv(GLint location, GLsizei count, const GLfloat *value); \
+ void uniform3i(GLint location, GLint v0, GLint v1, GLint v2); \
+ void uniform3iv(GLint location, GLsizei count, const GLint *value); \
+ void uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); \
+ void uniform4fv(GLint location, GLsizei count, const GLfloat *value); \
+ void uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); \
+ void uniform4iv(GLint location, GLsizei count, const GLint *value); \
+ void uniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void uniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void uniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void useProgram(GLuint program); \
+ void validateProgram(GLuint program); \
+ void vertexAttrib1f(GLuint index, GLfloat x); \
+ void vertexAttrib1fv(GLuint index, const GLfloat *v); \
+ void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y); \
+ void vertexAttrib2fv(GLuint index, const GLfloat *v); \
+ void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); \
+ void vertexAttrib3fv(GLuint index, const GLfloat *v); \
+ void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); \
+ void vertexAttrib4fv(GLuint index, const GLfloat *v); \
+ void vertexAttribPointer(GLuint index, GLint size, VertexAttribType typePacked, \
+ GLboolean normalized, GLsizei stride, const void *pointer); \
+ void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
+
+#endif // ANGLE_CONTEXT_API_2_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_3_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gles_3_0_autogen.h
new file mode 100644
index 0000000000..0b1c5342bc
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gles_3_0_autogen.h
@@ -0,0 +1,159 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gles_3_0_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GLES_3_0_AUTOGEN_H_
+#define ANGLE_CONTEXT_GLES_3_0_AUTOGEN_H_
+
+#define ANGLE_GLES_3_0_CONTEXT_API \
+ void beginQuery(QueryType targetPacked, GLuint id); \
+ void beginTransformFeedback(PrimitiveMode primitiveModePacked); \
+ void bindBufferBase(BufferBinding targetPacked, GLuint index, GLuint buffer); \
+ void bindBufferRange(BufferBinding targetPacked, GLuint index, GLuint buffer, GLintptr offset, \
+ GLsizeiptr size); \
+ void bindSampler(GLuint unit, GLuint sampler); \
+ void bindTransformFeedback(GLenum target, GLuint id); \
+ void bindVertexArray(GLuint array); \
+ void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, \
+ GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); \
+ void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); \
+ void clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value); \
+ void clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value); \
+ void clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value); \
+ GLenum clientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); \
+ void compressedTexImage3D(TextureTarget targetPacked, GLint level, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLsizei depth, GLint border, \
+ GLsizei imageSize, const void *data); \
+ void compressedTexSubImage3D(TextureTarget targetPacked, GLint level, GLint xoffset, \
+ GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, \
+ GLsizei depth, GLenum format, GLsizei imageSize, \
+ const void *data); \
+ void copyBufferSubData(BufferBinding readTargetPacked, BufferBinding writeTargetPacked, \
+ GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); \
+ void copyTexSubImage3D(TextureTarget targetPacked, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); \
+ void deleteQueries(GLsizei n, const GLuint *ids); \
+ void deleteSamplers(GLsizei count, const GLuint *samplers); \
+ void deleteSync(GLsync sync); \
+ void deleteTransformFeedbacks(GLsizei n, const GLuint *ids); \
+ void deleteVertexArrays(GLsizei n, const GLuint *arrays); \
+ void drawArraysInstanced(PrimitiveMode modePacked, GLint first, GLsizei count, \
+ GLsizei instancecount); \
+ void drawBuffers(GLsizei n, const GLenum *bufs); \
+ void drawElementsInstanced(PrimitiveMode modePacked, GLsizei count, \
+ DrawElementsType typePacked, const void *indices, \
+ GLsizei instancecount); \
+ void drawRangeElements(PrimitiveMode modePacked, GLuint start, GLuint end, GLsizei count, \
+ DrawElementsType typePacked, const void *indices); \
+ void endQuery(QueryType targetPacked); \
+ void endTransformFeedback(); \
+ GLsync fenceSync(GLenum condition, GLbitfield flags); \
+ void flushMappedBufferRange(BufferBinding targetPacked, GLintptr offset, GLsizeiptr length); \
+ void framebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, \
+ GLint layer); \
+ void genQueries(GLsizei n, GLuint *ids); \
+ void genSamplers(GLsizei count, GLuint *samplers); \
+ void genTransformFeedbacks(GLsizei n, GLuint *ids); \
+ void genVertexArrays(GLsizei n, GLuint *arrays); \
+ void getActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, \
+ GLsizei *length, GLchar *uniformBlockName); \
+ void getActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, \
+ GLint *params); \
+ void getActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, \
+ GLenum pname, GLint *params); \
+ void getBufferParameteri64v(BufferBinding targetPacked, GLenum pname, GLint64 *params); \
+ void getBufferPointerv(BufferBinding targetPacked, GLenum pname, void **params); \
+ GLint getFragDataLocation(GLuint program, const GLchar *name); \
+ void getInteger64i_v(GLenum target, GLuint index, GLint64 *data); \
+ void getInteger64v(GLenum pname, GLint64 *data); \
+ void getIntegeri_v(GLenum target, GLuint index, GLint *data); \
+ void getInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, \
+ GLint *params); \
+ void getProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, \
+ void *binary); \
+ void getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params); \
+ void getQueryiv(QueryType targetPacked, GLenum pname, GLint *params); \
+ void getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params); \
+ void getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params); \
+ const GLubyte *getStringi(GLenum name, GLuint index); \
+ void getSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); \
+ void getTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, \
+ GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); \
+ GLuint getUniformBlockIndex(GLuint program, const GLchar *uniformBlockName); \
+ void getUniformIndices(GLuint program, GLsizei uniformCount, \
+ const GLchar *const *uniformNames, GLuint *uniformIndices); \
+ void getUniformuiv(GLuint program, GLint location, GLuint *params); \
+ void getVertexAttribIiv(GLuint index, GLenum pname, GLint *params); \
+ void getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params); \
+ void invalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments); \
+ void invalidateSubFramebuffer(GLenum target, GLsizei numAttachments, \
+ const GLenum *attachments, GLint x, GLint y, GLsizei width, \
+ GLsizei height); \
+ GLboolean isQuery(GLuint id); \
+ GLboolean isSampler(GLuint sampler); \
+ GLboolean isSync(GLsync sync); \
+ GLboolean isTransformFeedback(GLuint id); \
+ GLboolean isVertexArray(GLuint array); \
+ void *mapBufferRange(BufferBinding targetPacked, GLintptr offset, GLsizeiptr length, \
+ GLbitfield access); \
+ void pauseTransformFeedback(); \
+ void programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); \
+ void programParameteri(GLuint program, GLenum pname, GLint value); \
+ void readBuffer(GLenum src); \
+ void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, \
+ GLsizei width, GLsizei height); \
+ void resumeTransformFeedback(); \
+ void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param); \
+ void samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param); \
+ void samplerParameteri(GLuint sampler, GLenum pname, GLint param); \
+ void samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param); \
+ void texImage3D(TextureTarget targetPacked, GLint level, GLint internalformat, GLsizei width, \
+ GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, \
+ const void *pixels); \
+ void texStorage2D(TextureType targetPacked, GLsizei levels, GLenum internalformat, \
+ GLsizei width, GLsizei height); \
+ void texStorage3D(TextureType targetPacked, GLsizei levels, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLsizei depth); \
+ void texSubImage3D(TextureTarget targetPacked, GLint level, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, \
+ GLenum type, const void *pixels); \
+ void transformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const *varyings, \
+ GLenum bufferMode); \
+ void uniform1ui(GLint location, GLuint v0); \
+ void uniform1uiv(GLint location, GLsizei count, const GLuint *value); \
+ void uniform2ui(GLint location, GLuint v0, GLuint v1); \
+ void uniform2uiv(GLint location, GLsizei count, const GLuint *value); \
+ void uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2); \
+ void uniform3uiv(GLint location, GLsizei count, const GLuint *value); \
+ void uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); \
+ void uniform4uiv(GLint location, GLsizei count, const GLuint *value); \
+ void uniformBlockBinding(GLuint program, GLuint uniformBlockIndex, \
+ GLuint uniformBlockBinding); \
+ void uniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void uniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void uniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void uniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void uniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ void uniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, \
+ const GLfloat *value); \
+ GLboolean unmapBuffer(BufferBinding targetPacked); \
+ void vertexAttribDivisor(GLuint index, GLuint divisor); \
+ void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); \
+ void vertexAttribI4iv(GLuint index, const GLint *v); \
+ void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); \
+ void vertexAttribI4uiv(GLuint index, const GLuint *v); \
+ void vertexAttribIPointer(GLuint index, GLint size, VertexAttribType typePacked, \
+ GLsizei stride, const void *pointer); \
+ void waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
+
+#endif // ANGLE_CONTEXT_API_3_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_3_1_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gles_3_1_autogen.h
new file mode 100644
index 0000000000..69cc2788ef
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gles_3_1_autogen.h
@@ -0,0 +1,107 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gles_3_1_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GLES_3_1_AUTOGEN_H_
+#define ANGLE_CONTEXT_GLES_3_1_AUTOGEN_H_
+
+#define ANGLE_GLES_3_1_CONTEXT_API \
+ void activeShaderProgram(GLuint pipeline, GLuint program); \
+ void bindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, \
+ GLint layer, GLenum access, GLenum format); \
+ void bindProgramPipeline(GLuint pipeline); \
+ void bindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); \
+ GLuint createShaderProgramv(ShaderType typePacked, GLsizei count, \
+ const GLchar *const *strings); \
+ void deleteProgramPipelines(GLsizei n, const GLuint *pipelines); \
+ void dispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); \
+ void dispatchComputeIndirect(GLintptr indirect); \
+ void drawArraysIndirect(PrimitiveMode modePacked, const void *indirect); \
+ void drawElementsIndirect(PrimitiveMode modePacked, DrawElementsType typePacked, \
+ const void *indirect); \
+ void framebufferParameteri(GLenum target, GLenum pname, GLint param); \
+ void genProgramPipelines(GLsizei n, GLuint *pipelines); \
+ void getBooleani_v(GLenum target, GLuint index, GLboolean *data); \
+ void getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params); \
+ void getMultisamplefv(GLenum pname, GLuint index, GLfloat *val); \
+ void getProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, \
+ GLint *params); \
+ void getProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, \
+ GLchar *infoLog); \
+ void getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params); \
+ GLuint getProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name); \
+ GLint getProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name); \
+ void getProgramResourceName(GLuint program, GLenum programInterface, GLuint index, \
+ GLsizei bufSize, GLsizei *length, GLchar *name); \
+ void getProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, \
+ GLsizei propCount, const GLenum *props, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getTexLevelParameterfv(TextureTarget targetPacked, GLint level, GLenum pname, \
+ GLfloat *params); \
+ void getTexLevelParameteriv(TextureTarget targetPacked, GLint level, GLenum pname, \
+ GLint *params); \
+ GLboolean isProgramPipeline(GLuint pipeline); \
+ void memoryBarrier(GLbitfield barriers); \
+ void memoryBarrierByRegion(GLbitfield barriers); \
+ void programUniform1f(GLuint program, GLint location, GLfloat v0); \
+ void programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value); \
+ void programUniform1i(GLuint program, GLint location, GLint v0); \
+ void programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value); \
+ void programUniform1ui(GLuint program, GLint location, GLuint v0); \
+ void programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value); \
+ void programUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1); \
+ void programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value); \
+ void programUniform2i(GLuint program, GLint location, GLint v0, GLint v1); \
+ void programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value); \
+ void programUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1); \
+ void programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value); \
+ void programUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); \
+ void programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value); \
+ void programUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2); \
+ void programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value); \
+ void programUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); \
+ void programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value); \
+ void programUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, \
+ GLfloat v3); \
+ void programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value); \
+ void programUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); \
+ void programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value); \
+ void programUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, \
+ GLuint v3); \
+ void programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value); \
+ void programUniformMatrix2fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix3fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix4fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void programUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, \
+ GLboolean transpose, const GLfloat *value); \
+ void sampleMaski(GLuint maskNumber, GLbitfield mask); \
+ void texStorage2DMultisample(TextureType targetPacked, GLsizei samples, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLboolean fixedsamplelocations); \
+ void useProgramStages(GLuint pipeline, GLbitfield stages, GLuint program); \
+ void validateProgramPipeline(GLuint pipeline); \
+ void vertexAttribBinding(GLuint attribindex, GLuint bindingindex); \
+ void vertexAttribFormat(GLuint attribindex, GLint size, VertexAttribType typePacked, \
+ GLboolean normalized, GLuint relativeoffset); \
+ void vertexAttribIFormat(GLuint attribindex, GLint size, VertexAttribType typePacked, \
+ GLuint relativeoffset); \
+ void vertexBindingDivisor(GLuint bindingindex, GLuint divisor);
+
+#endif // ANGLE_CONTEXT_API_3_1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_ext_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gles_ext_autogen.h
new file mode 100644
index 0000000000..6ac1c54764
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Context_gles_ext_autogen.h
@@ -0,0 +1,412 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context_gles_ext_autogen.h: Creates a macro for interfaces in Context.
+
+#ifndef ANGLE_CONTEXT_GLES_EXT_AUTOGEN_H_
+#define ANGLE_CONTEXT_GLES_EXT_AUTOGEN_H_
+
+#define ANGLE_GLES_EXT_CONTEXT_API \
+ \
+ /* GLES1 Extensions */ \
+ \
+ /* GL_OES_draw_texture */ \
+ void drawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); \
+ void drawTexfv(const GLfloat *coords); \
+ void drawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); \
+ void drawTexiv(const GLint *coords); \
+ void drawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); \
+ void drawTexsv(const GLshort *coords); \
+ void drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); \
+ void drawTexxv(const GLfixed *coords); \
+ /* GL_OES_framebuffer_object */ \
+ /* GL_OES_matrix_palette */ \
+ void currentPaletteMatrix(GLuint matrixpaletteindex); \
+ void loadPaletteFromModelViewMatrix(); \
+ void matrixIndexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \
+ void weightPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \
+ /* GL_OES_point_size_array */ \
+ void pointSizePointer(VertexAttribType typePacked, GLsizei stride, const void *pointer); \
+ /* GL_OES_query_matrix */ \
+ GLbitfield queryMatrixx(GLfixed *mantissa, GLint *exponent); \
+ /* GL_OES_texture_cube_map */ \
+ void getTexGenfv(GLenum coord, GLenum pname, GLfloat *params); \
+ void getTexGeniv(GLenum coord, GLenum pname, GLint *params); \
+ void getTexGenxv(GLenum coord, GLenum pname, GLfixed *params); \
+ void texGenf(GLenum coord, GLenum pname, GLfloat param); \
+ void texGenfv(GLenum coord, GLenum pname, const GLfloat *params); \
+ void texGeni(GLenum coord, GLenum pname, GLint param); \
+ void texGeniv(GLenum coord, GLenum pname, const GLint *params); \
+ void texGenx(GLenum coord, GLenum pname, GLfixed param); \
+ void texGenxv(GLenum coord, GLenum pname, const GLfixed *params); \
+ \
+ /* ANGLE Extensions */ \
+ \
+ /* GL_ANGLE_copy_texture_3d */ \
+ void copyTexture3D(GLuint sourceId, GLint sourceLevel, TextureTarget destTargetPacked, \
+ GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, \
+ GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, \
+ GLboolean unpackUnmultiplyAlpha); \
+ void copySubTexture3D(GLuint sourceId, GLint sourceLevel, TextureTarget destTargetPacked, \
+ GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, \
+ GLint zoffset, GLint x, GLint y, GLint z, GLint width, GLint height, \
+ GLint depth, GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, \
+ GLboolean unpackUnmultiplyAlpha); \
+ /* GL_ANGLE_request_extension */ \
+ void requestExtension(const GLchar *name); \
+ /* GL_ANGLE_robust_client_memory */ \
+ void getBooleanvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *params); \
+ void getBufferParameterivRobust(BufferBinding targetPacked, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getFloatvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params); \
+ void getFramebufferAttachmentParameterivRobust(GLenum target, GLenum attachment, GLenum pname, \
+ GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getIntegervRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data); \
+ void getProgramivRobust(GLuint program, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getRenderbufferParameterivRobust(GLenum target, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getShaderivRobust(GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getTexParameterfvRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLfloat *params); \
+ void getTexParameterivRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getUniformfvRobust(GLuint program, GLint location, GLsizei bufSize, GLsizei *length, \
+ GLfloat *params); \
+ void getUniformivRobust(GLuint program, GLint location, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getVertexAttribfvRobust(GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLfloat *params); \
+ void getVertexAttribivRobust(GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getVertexAttribPointervRobust(GLuint index, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, void **pointer); \
+ void readPixelsRobust(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, \
+ GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, \
+ GLsizei *rows, void *pixels); \
+ void texImage2DRobust(TextureTarget targetPacked, GLint level, GLint internalformat, \
+ GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, \
+ GLsizei bufSize, const void *pixels); \
+ void texParameterfvRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ const GLfloat *params); \
+ void texParameterivRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ const GLint *params); \
+ void texSubImage2DRobust(TextureTarget targetPacked, GLint level, GLint xoffset, \
+ GLint yoffset, GLsizei width, GLsizei height, GLenum format, \
+ GLenum type, GLsizei bufSize, const void *pixels); \
+ void texImage3DRobust(TextureTarget targetPacked, GLint level, GLint internalformat, \
+ GLsizei width, GLsizei height, GLsizei depth, GLint border, \
+ GLenum format, GLenum type, GLsizei bufSize, const void *pixels); \
+ void texSubImage3DRobust(TextureTarget targetPacked, GLint level, GLint xoffset, \
+ GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, \
+ GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, \
+ const void *pixels); \
+ void compressedTexImage2DRobust( \
+ TextureTarget targetPacked, GLint level, GLenum internalformat, GLsizei width, \
+ GLsizei height, GLint border, GLsizei imageSize, GLsizei dataSize, const GLvoid *data); \
+ void compressedTexSubImage2DRobust( \
+ TextureTarget targetPacked, GLint level, GLsizei xoffset, GLsizei yoffset, GLsizei width, \
+ GLsizei height, GLenum format, GLsizei imageSize, GLsizei dataSize, const GLvoid *data); \
+ void compressedTexImage3DRobust(TextureTarget targetPacked, GLint level, \
+ GLenum internalformat, GLsizei width, GLsizei height, \
+ GLsizei depth, GLint border, GLsizei imageSize, \
+ GLsizei dataSize, const GLvoid *data); \
+ void compressedTexSubImage3DRobust(TextureTarget targetPacked, GLint level, GLint xoffset, \
+ GLint yoffset, GLint zoffset, GLsizei width, \
+ GLsizei height, GLsizei depth, GLenum format, \
+ GLsizei imageSize, GLsizei dataSize, const GLvoid *data); \
+ void getQueryivRobust(QueryType targetPacked, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getQueryObjectuivRobust(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLuint *params); \
+ void getBufferPointervRobust(BufferBinding targetPacked, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, void **params); \
+ void getIntegeri_vRobust(GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, \
+ GLint *data); \
+ void getInternalformativRobust(GLenum target, GLenum internalformat, GLenum pname, \
+ GLsizei bufSize, GLsizei *length, GLint *params); \
+ void getVertexAttribIivRobust(GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getVertexAttribIuivRobust(GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLuint *params); \
+ void getUniformuivRobust(GLuint program, GLint location, GLsizei bufSize, GLsizei *length, \
+ GLuint *params); \
+ void getActiveUniformBlockivRobust(GLuint program, GLuint uniformBlockIndex, GLenum pname, \
+ GLsizei bufSize, GLsizei *length, GLint *params); \
+ void getInteger64vRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data); \
+ void getInteger64i_vRobust(GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, \
+ GLint64 *data); \
+ void getBufferParameteri64vRobust(BufferBinding targetPacked, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint64 *params); \
+ void samplerParameterivRobust(GLuint sampler, GLuint pname, GLsizei bufSize, \
+ const GLint *param); \
+ void samplerParameterfvRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ const GLfloat *param); \
+ void getSamplerParameterivRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getSamplerParameterfvRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLfloat *params); \
+ void getFramebufferParameterivRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getProgramInterfaceivRobust(GLuint program, GLenum programInterface, GLenum pname, \
+ GLsizei bufSize, GLsizei *length, GLint *params); \
+ void getBooleani_vRobust(GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, \
+ GLboolean *data); \
+ void getMultisamplefvRobust(GLenum pname, GLuint index, GLsizei bufSize, GLsizei *length, \
+ GLfloat *val); \
+ void getTexLevelParameterivRobust(TextureTarget targetPacked, GLint level, GLenum pname, \
+ GLsizei bufSize, GLsizei *length, GLint *params); \
+ void getTexLevelParameterfvRobust(TextureTarget targetPacked, GLint level, GLenum pname, \
+ GLsizei bufSize, GLsizei *length, GLfloat *params); \
+ void getPointervRobustANGLERobust(GLenum pname, GLsizei bufSize, GLsizei *length, \
+ void **params); \
+ void readnPixelsRobust(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, \
+ GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, \
+ GLsizei *rows, void *data); \
+ void getnUniformfvRobust(GLuint program, GLint location, GLsizei bufSize, GLsizei *length, \
+ GLfloat *params); \
+ void getnUniformivRobust(GLuint program, GLint location, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getnUniformuivRobust(GLuint program, GLint location, GLsizei bufSize, GLsizei *length, \
+ GLuint *params); \
+ void texParameterIivRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ const GLint *params); \
+ void texParameterIuivRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ const GLuint *params); \
+ void getTexParameterIivRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getTexParameterIuivRobust(TextureType targetPacked, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLuint *params); \
+ void samplerParameterIivRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ const GLint *param); \
+ void samplerParameterIuivRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ const GLuint *param); \
+ void getSamplerParameterIivRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLint *params); \
+ void getSamplerParameterIuivRobust(GLuint sampler, GLenum pname, GLsizei bufSize, \
+ GLsizei *length, GLuint *params); \
+ void getQueryObjectivRobust(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLint *params); \
+ void getQueryObjecti64vRobust(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLint64 *params); \
+ void getQueryObjectui64vRobust(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, \
+ GLuint64 *params); \
+ /* GL_ANGLE_texture_external_update */ \
+ void texImage2DExternal(TextureTarget targetPacked, GLint level, GLint internalformat, \
+ GLsizei width, GLsizei height, GLint border, GLenum format, \
+ GLenum type); \
+ void invalidateTexture(TextureType targetPacked); \
+ /* GL_CHROMIUM_bind_uniform_location */ \
+ void bindUniformLocation(GLuint program, GLint location, const GLchar *name); \
+ /* GL_CHROMIUM_copy_compressed_texture */ \
+ void compressedCopyTexture(GLuint sourceId, GLuint destId); \
+ /* GL_CHROMIUM_copy_texture */ \
+ void copyTexture(GLuint sourceId, GLint sourceLevel, TextureTarget destTargetPacked, \
+ GLuint destId, GLint destLevel, GLint internalFormat, GLenum destType, \
+ GLboolean unpackFlipY, GLboolean unpackPremultiplyAlpha, \
+ GLboolean unpackUnmultiplyAlpha); \
+ void copySubTexture(GLuint sourceId, GLint sourceLevel, TextureTarget destTargetPacked, \
+ GLuint destId, GLint destLevel, GLint xoffset, GLint yoffset, GLint x, \
+ GLint y, GLint width, GLint height, GLboolean unpackFlipY, \
+ GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha); \
+ /* GL_CHROMIUM_framebuffer_mixed_samples */ \
+ void coverageModulation(GLenum components); \
+ void matrixLoadf(GLenum matrixMode, const GLfloat *matrix); \
+ void matrixLoadIdentity(GLenum matrixMode); \
+ /* GL_CHROMIUM_lose_context */ \
+ void loseContext(GraphicsResetStatus currentPacked, GraphicsResetStatus otherPacked); \
+ /* GL_CHROMIUM_path_rendering */ \
+ GLuint genPaths(GLsizei range); \
+ void deletePaths(GLuint first, GLsizei range); \
+ GLboolean isPath(GLuint path); \
+ void pathCommands(GLuint path, GLsizei numCommands, const GLubyte *commands, \
+ GLsizei numCoords, GLenum coordType, const void *coords); \
+ void pathParameterf(GLuint path, GLenum pname, GLfloat value); \
+ void pathParameteri(GLuint path, GLenum pname, GLint value); \
+ void getPathParameterfv(GLuint path, GLenum pname, GLfloat *value); \
+ void getPathParameteriv(GLuint path, GLenum pname, GLint *value); \
+ void pathStencilFunc(GLenum func, GLint ref, GLuint mask); \
+ void stencilFillPath(GLuint path, GLenum fillMode, GLuint mask); \
+ void stencilStrokePath(GLuint path, GLint reference, GLuint mask); \
+ void coverFillPath(GLuint path, GLenum coverMode); \
+ void coverStrokePath(GLuint path, GLenum coverMode); \
+ void stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); \
+ void stencilThenCoverStrokePath(GLuint path, GLint reference, GLuint mask, GLenum coverMode); \
+ void coverFillPathInstanced(GLsizei numPath, GLenum pathNameType, const void *paths, \
+ GLuint pathBase, GLenum coverMode, GLenum transformType, \
+ const GLfloat *transformValues); \
+ void coverStrokePathInstanced(GLsizei numPath, GLenum pathNameType, const void *paths, \
+ GLuint pathBase, GLenum coverMode, GLenum transformType, \
+ const GLfloat *transformValues); \
+ void stencilStrokePathInstanced(GLsizei numPath, GLenum pathNameType, const void *paths, \
+ GLuint pathBase, GLint reference, GLuint mask, \
+ GLenum transformType, const GLfloat *transformValues); \
+ void stencilFillPathInstanced(GLsizei numPaths, GLenum pathNameType, const void *paths, \
+ GLuint pathBase, GLenum fillMode, GLuint mask, \
+ GLenum transformType, const GLfloat *transformValues); \
+ void stencilThenCoverFillPathInstanced(GLsizei numPaths, GLenum pathNameType, \
+ const void *paths, GLuint pathBase, GLenum fillMode, \
+ GLuint mask, GLenum coverMode, GLenum transformType, \
+ const GLfloat *transformValues); \
+ void stencilThenCoverStrokePathInstanced(GLsizei numPaths, GLenum pathNameType, \
+ const void *paths, GLuint pathBase, GLint reference, \
+ GLuint mask, GLenum coverMode, GLenum transformType, \
+ const GLfloat *transformValues); \
+ void bindFragmentInputLocation(GLuint programs, GLint location, const GLchar *name); \
+ void programPathFragmentInputGen(GLuint program, GLint location, GLenum genMode, \
+ GLint components, const GLfloat *coeffs); \
+ \
+ /* GLES2+ Extensions */ \
+ \
+ /* GL_ANGLE_framebuffer_blit */ \
+ /* GL_ANGLE_framebuffer_multisample */ \
+ /* GL_ANGLE_instanced_arrays */ \
+ /* GL_ANGLE_multi_draw */ \
+ void multiDrawArrays(PrimitiveMode modePacked, const GLint *firsts, const GLsizei *counts, \
+ GLsizei drawcount); \
+ void multiDrawArraysInstanced(PrimitiveMode modePacked, const GLint *firsts, \
+ const GLsizei *counts, const GLsizei *instanceCounts, \
+ GLsizei drawcount); \
+ void multiDrawElements(PrimitiveMode modePacked, const GLsizei *counts, \
+ DrawElementsType typePacked, const GLvoid *const *indices, \
+ GLsizei drawcount); \
+ void multiDrawElementsInstanced(PrimitiveMode modePacked, const GLsizei *counts, \
+ DrawElementsType typePacked, const GLvoid *const *indices, \
+ const GLsizei *instanceCounts, GLsizei drawcount); \
+ /* GL_ANGLE_provoking_vertex */ \
+ void provokingVertex(ProvokingVertexConvention modePacked); \
+ /* GL_ANGLE_texture_multisample */ \
+ /* GL_ANGLE_translated_shader_source */ \
+ void getTranslatedShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, \
+ GLchar *source); \
+ /* GL_EXT_blend_func_extended */ \
+ void bindFragDataLocation(GLuint program, GLuint color, const GLchar *name); \
+ void bindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, \
+ const GLchar *name); \
+ GLint getFragDataIndex(GLuint program, const GLchar *name); \
+ GLint getProgramResourceLocationIndex(GLuint program, GLenum programInterface, \
+ const GLchar *name); \
+ /* GL_EXT_debug_marker */ \
+ void insertEventMarker(GLsizei length, const GLchar *marker); \
+ void popGroupMarker(); \
+ void pushGroupMarker(GLsizei length, const GLchar *marker); \
+ /* GL_EXT_discard_framebuffer */ \
+ void discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments); \
+ /* GL_EXT_disjoint_timer_query */ \
+ void getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params); \
+ void getQueryObjectiv(GLuint id, GLenum pname, GLint *params); \
+ void getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params); \
+ void queryCounter(GLuint id, QueryType targetPacked); \
+ /* GL_EXT_draw_buffers */ \
+ /* GL_EXT_geometry_shader */ \
+ void framebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level); \
+ /* GL_EXT_instanced_arrays */ \
+ /* GL_EXT_map_buffer_range */ \
+ /* GL_EXT_memory_object */ \
+ void bufferStorageMem(TextureType targetPacked, GLsizeiptr size, GLuint memory, \
+ GLuint64 offset); \
+ void createMemoryObjects(GLsizei n, GLuint *memoryObjects); \
+ void deleteMemoryObjects(GLsizei n, const GLuint *memoryObjects); \
+ void getMemoryObjectParameteriv(GLuint memoryObject, GLenum pname, GLint *params); \
+ void getUnsignedBytev(GLenum pname, GLubyte *data); \
+ void getUnsignedBytei_v(GLenum target, GLuint index, GLubyte *data); \
+ GLboolean isMemoryObject(GLuint memoryObject); \
+ void memoryObjectParameteriv(GLuint memoryObject, GLenum pname, const GLint *params); \
+ void texStorageMem2D(TextureType targetPacked, GLsizei levels, GLenum internalFormat, \
+ GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); \
+ void texStorageMem2DMultisample( \
+ TextureType targetPacked, GLsizei samples, GLenum internalFormat, GLsizei width, \
+ GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); \
+ void texStorageMem3D(TextureType targetPacked, GLsizei levels, GLenum internalFormat, \
+ GLsizei width, GLsizei height, GLsizei depth, GLuint memory, \
+ GLuint64 offset); \
+ void texStorageMem3DMultisample(TextureType targetPacked, GLsizei samples, \
+ GLenum internalFormat, GLsizei width, GLsizei height, \
+ GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, \
+ GLuint64 offset); \
+ /* GL_EXT_memory_object_fd */ \
+ void importMemoryFd(GLuint memory, GLuint64 size, HandleType handleTypePacked, GLint fd); \
+ /* GL_EXT_occlusion_query_boolean */ \
+ /* GL_EXT_robustness */ \
+ GLenum getGraphicsResetStatus(); \
+ void getnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); \
+ void getnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params); \
+ void readnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, \
+ GLsizei bufSize, void *data); \
+ /* GL_EXT_semaphore */ \
+ void deleteSemaphores(GLsizei n, const GLuint *semaphores); \
+ void genSemaphores(GLsizei n, GLuint *semaphores); \
+ void getSemaphoreParameterui64v(GLuint semaphore, GLenum pname, GLuint64 *params); \
+ GLboolean isSemaphore(GLuint semaphore); \
+ void semaphoreParameterui64v(GLuint semaphore, GLenum pname, const GLuint64 *params); \
+ void signalSemaphore(GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, \
+ GLuint numTextureBarriers, const GLuint *textures, \
+ const GLenum *dstLayouts); \
+ void waitSemaphore(GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, \
+ GLuint numTextureBarriers, const GLuint *textures, \
+ const GLenum *srcLayouts); \
+ /* GL_EXT_semaphore_fd */ \
+ void importSemaphoreFd(GLuint semaphore, HandleType handleTypePacked, GLint fd); \
+ /* GL_EXT_texture_storage */ \
+ void texStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); \
+ /* GL_KHR_debug */ \
+ void debugMessageCallback(GLDEBUGPROCKHR callback, const void *userParam); \
+ void debugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, \
+ const GLuint *ids, GLboolean enabled); \
+ void debugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, \
+ GLsizei length, const GLchar *buf); \
+ GLuint getDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, \
+ GLuint *ids, GLenum *severities, GLsizei *lengths, \
+ GLchar *messageLog); \
+ void getObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, \
+ GLchar *label); \
+ void getObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); \
+ void objectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label); \
+ void objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label); \
+ void popDebugGroup(); \
+ void pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message); \
+ /* GL_KHR_parallel_shader_compile */ \
+ void maxShaderCompilerThreads(GLuint count); \
+ /* GL_NV_fence */ \
+ void deleteFencesNV(GLsizei n, const GLuint *fences); \
+ void finishFenceNV(GLuint fence); \
+ void genFencesNV(GLsizei n, GLuint *fences); \
+ void getFenceivNV(GLuint fence, GLenum pname, GLint *params); \
+ GLboolean isFenceNV(GLuint fence); \
+ void setFenceNV(GLuint fence, GLenum condition); \
+ GLboolean testFenceNV(GLuint fence); \
+ /* GL_OES_EGL_image */ \
+ void eGLImageTargetRenderbufferStorage(GLenum target, GLeglImageOES image); \
+ void eGLImageTargetTexture2D(TextureType targetPacked, GLeglImageOES image); \
+ /* GL_OES_get_program_binary */ \
+ /* GL_OES_mapbuffer */ \
+ void *mapBuffer(BufferBinding targetPacked, GLenum access); \
+ /* GL_OES_texture_3D */ \
+ void framebufferTexture3D(GLenum target, GLenum attachment, TextureTarget textargetPacked, \
+ GLuint texture, GLint level, GLint zoffset); \
+ /* GL_OES_texture_border_clamp */ \
+ void getSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params); \
+ void getSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params); \
+ void getTexParameterIiv(TextureType targetPacked, GLenum pname, GLint *params); \
+ void getTexParameterIuiv(TextureType targetPacked, GLenum pname, GLuint *params); \
+ void samplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param); \
+ void samplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param); \
+ void texParameterIiv(TextureType targetPacked, GLenum pname, const GLint *params); \
+ void texParameterIuiv(TextureType targetPacked, GLenum pname, const GLuint *params); \
+ /* GL_OES_texture_storage_multisample_2d_array */ \
+ void texStorage3DMultisample(TextureType targetPacked, GLsizei samples, GLenum internalformat, \
+ GLsizei width, GLsizei height, GLsizei depth, \
+ GLboolean fixedsamplelocations); \
+ /* GL_OES_vertex_array_object */ \
+ /* GL_OVR_multiview */ \
+ void framebufferTextureMultiview(GLenum target, GLenum attachment, GLuint texture, \
+ GLint level, GLint baseViewIndex, GLsizei numViews); \
+ /* GL_OVR_multiview2 */
+
+#endif // ANGLE_CONTEXT_API_EXT_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Debug.cpp b/gfx/angle/checkout/src/libANGLE/Debug.cpp
new file mode 100644
index 0000000000..f4a857b716
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Debug.cpp
@@ -0,0 +1,473 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Debug.cpp: Defines debug state used for GL_KHR_debug
+
+#include "libANGLE/Debug.h"
+
+#include "common/debug.h"
+
+#include <algorithm>
+#include <tuple>
+
+namespace
+{
+const char *GLSeverityToString(GLenum severity)
+{
+ switch (severity)
+ {
+ case GL_DEBUG_SEVERITY_HIGH:
+ return "HIGH";
+ case GL_DEBUG_SEVERITY_MEDIUM:
+ return "MEDIUM";
+ case GL_DEBUG_SEVERITY_LOW:
+ return "LOW";
+ case GL_DEBUG_SEVERITY_NOTIFICATION:
+ default:
+ return "NOTIFICATION";
+ }
+}
+
+const char *EGLMessageTypeToString(egl::MessageType messageType)
+{
+ switch (messageType)
+ {
+ case egl::MessageType::Critical:
+ return "CRITICAL";
+ case egl::MessageType::Error:
+ return "ERROR";
+ case egl::MessageType::Warn:
+ return "WARNING";
+ case egl::MessageType::Info:
+ default:
+ return "INFO";
+ }
+}
+
+const char *GLMessageTypeToString(GLenum type)
+{
+ switch (type)
+ {
+ case GL_DEBUG_TYPE_ERROR:
+ return "error";
+ case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
+ return "deprecated behavior";
+ case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
+ return "undefined behavior";
+ case GL_DEBUG_TYPE_PORTABILITY:
+ return "portability";
+ case GL_DEBUG_TYPE_PERFORMANCE:
+ return "performance";
+ case GL_DEBUG_TYPE_MARKER:
+ return "marker";
+ case GL_DEBUG_TYPE_PUSH_GROUP:
+ return "start of group";
+ case GL_DEBUG_TYPE_POP_GROUP:
+ return "end of group";
+ case GL_DEBUG_TYPE_OTHER:
+ default:
+ return "other message";
+ }
+}
+} // namespace
+
+namespace gl
+{
+
+Debug::Control::Control() {}
+
+Debug::Control::~Control() {}
+
+Debug::Control::Control(const Control &other) = default;
+
+Debug::Group::Group() {}
+
+Debug::Group::~Group() {}
+
+Debug::Group::Group(const Group &other) = default;
+
+Debug::Debug(bool initialDebugState)
+ : mOutputEnabled(initialDebugState),
+ mCallbackFunction(nullptr),
+ mCallbackUserParam(nullptr),
+ mMessages(),
+ mMaxLoggedMessages(0),
+ mOutputSynchronous(false),
+ mGroups()
+{
+ pushDefaultGroup();
+}
+
+Debug::~Debug() {}
+
+void Debug::setMaxLoggedMessages(GLuint maxLoggedMessages)
+{
+ mMaxLoggedMessages = maxLoggedMessages;
+}
+
+void Debug::setOutputEnabled(bool enabled)
+{
+ mOutputEnabled = enabled;
+}
+
+bool Debug::isOutputEnabled() const
+{
+ return mOutputEnabled;
+}
+
+void Debug::setOutputSynchronous(bool synchronous)
+{
+ mOutputSynchronous = synchronous;
+}
+
+bool Debug::isOutputSynchronous() const
+{
+ return mOutputSynchronous;
+}
+
+void Debug::setCallback(GLDEBUGPROCKHR callback, const void *userParam)
+{
+ mCallbackFunction = callback;
+ mCallbackUserParam = userParam;
+}
+
+GLDEBUGPROCKHR Debug::getCallback() const
+{
+ return mCallbackFunction;
+}
+
+const void *Debug::getUserParam() const
+{
+ return mCallbackUserParam;
+}
+
+void Debug::insertMessage(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ const std::string &message,
+ gl::LogSeverity logSeverity) const
+{
+ std::string messageCopy(message);
+ insertMessage(source, type, id, severity, std::move(messageCopy), logSeverity);
+}
+
+void Debug::insertMessage(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ std::string &&message,
+ gl::LogSeverity logSeverity) const
+{
+ {
+ // output all messages to the debug log
+ const char *messageTypeString = GLMessageTypeToString(type);
+ const char *severityString = GLSeverityToString(severity);
+ std::ostringstream messageStream;
+ messageStream << "GL " << messageTypeString << ": " << severityString << ": " << message;
+ switch (logSeverity)
+ {
+ case gl::LOG_FATAL:
+ FATAL() << messageStream.str();
+ break;
+ case gl::LOG_ERR:
+ ERR() << messageStream.str();
+ break;
+ case gl::LOG_WARN:
+ WARN() << messageStream.str();
+ break;
+ case gl::LOG_INFO:
+ INFO() << messageStream.str();
+ break;
+ case gl::LOG_EVENT:
+ ANGLE_LOG(EVENT) << messageStream.str();
+ break;
+ }
+ }
+
+ if (!isMessageEnabled(source, type, id, severity))
+ {
+ return;
+ }
+
+ if (mCallbackFunction != nullptr)
+ {
+ // TODO(geofflang) Check the synchronous flag and potentially flush messages from another
+ // thread.
+ mCallbackFunction(source, type, id, severity, static_cast<GLsizei>(message.length()),
+ message.c_str(), mCallbackUserParam);
+ }
+ else
+ {
+ if (mMessages.size() >= mMaxLoggedMessages)
+ {
+ // Drop messages over the limit
+ return;
+ }
+
+ Message m;
+ m.source = source;
+ m.type = type;
+ m.id = id;
+ m.severity = severity;
+ m.message = std::move(message);
+
+ mMessages.push_back(std::move(m));
+ }
+}
+
+size_t Debug::getMessages(GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ size_t messageCount = 0;
+ size_t messageStringIndex = 0;
+ while (messageCount <= count && !mMessages.empty())
+ {
+ const Message &m = mMessages.front();
+
+ if (messageLog != nullptr)
+ {
+ // Check that this message can fit in the message buffer
+ if (messageStringIndex + m.message.length() + 1 > static_cast<size_t>(bufSize))
+ {
+ break;
+ }
+
+ std::copy(m.message.begin(), m.message.end(), messageLog + messageStringIndex);
+ messageStringIndex += m.message.length();
+
+ messageLog[messageStringIndex] = '\0';
+ messageStringIndex += 1;
+ }
+
+ if (sources != nullptr)
+ {
+ sources[messageCount] = m.source;
+ }
+
+ if (types != nullptr)
+ {
+ types[messageCount] = m.type;
+ }
+
+ if (ids != nullptr)
+ {
+ ids[messageCount] = m.id;
+ }
+
+ if (severities != nullptr)
+ {
+ severities[messageCount] = m.severity;
+ }
+
+ if (lengths != nullptr)
+ {
+ lengths[messageCount] = static_cast<GLsizei>(m.message.length());
+ }
+
+ mMessages.pop_front();
+
+ messageCount++;
+ }
+
+ return messageCount;
+}
+
+size_t Debug::getNextMessageLength() const
+{
+ return mMessages.empty() ? 0 : mMessages.front().message.length();
+}
+
+size_t Debug::getMessageCount() const
+{
+ return mMessages.size();
+}
+
+void Debug::setMessageControl(GLenum source,
+ GLenum type,
+ GLenum severity,
+ std::vector<GLuint> &&ids,
+ bool enabled)
+{
+ Control c;
+ c.source = source;
+ c.type = type;
+ c.severity = severity;
+ c.ids = std::move(ids);
+ c.enabled = enabled;
+
+ auto &controls = mGroups.back().controls;
+ controls.push_back(std::move(c));
+}
+
+void Debug::pushGroup(GLenum source, GLuint id, std::string &&message)
+{
+ insertMessage(source, GL_DEBUG_TYPE_PUSH_GROUP, id, GL_DEBUG_SEVERITY_NOTIFICATION,
+ std::string(message), gl::LOG_INFO);
+
+ Group g;
+ g.source = source;
+ g.id = id;
+ g.message = std::move(message);
+ mGroups.push_back(std::move(g));
+}
+
+void Debug::popGroup()
+{
+ // Make sure the default group is not about to be popped
+ ASSERT(mGroups.size() > 1);
+
+ Group g = mGroups.back();
+ mGroups.pop_back();
+
+ insertMessage(g.source, GL_DEBUG_TYPE_POP_GROUP, g.id, GL_DEBUG_SEVERITY_NOTIFICATION,
+ g.message, gl::LOG_INFO);
+}
+
+size_t Debug::getGroupStackDepth() const
+{
+ return mGroups.size();
+}
+
+bool Debug::isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const
+{
+ if (!mOutputEnabled)
+ {
+ return false;
+ }
+
+ for (auto groupIter = mGroups.rbegin(); groupIter != mGroups.rend(); groupIter++)
+ {
+ const auto &controls = groupIter->controls;
+ for (auto controlIter = controls.rbegin(); controlIter != controls.rend(); controlIter++)
+ {
+ const auto &control = *controlIter;
+
+ if (control.source != GL_DONT_CARE && control.source != source)
+ {
+ continue;
+ }
+
+ if (control.type != GL_DONT_CARE && control.type != type)
+ {
+ continue;
+ }
+
+ if (control.severity != GL_DONT_CARE && control.severity != severity)
+ {
+ continue;
+ }
+
+ if (!control.ids.empty() &&
+ std::find(control.ids.begin(), control.ids.end(), id) == control.ids.end())
+ {
+ continue;
+ }
+
+ return control.enabled;
+ }
+ }
+
+ return true;
+}
+
+void Debug::pushDefaultGroup()
+{
+ Group g;
+ g.source = GL_NONE;
+ g.id = 0;
+ g.message = "";
+
+ Control c0;
+ c0.source = GL_DONT_CARE;
+ c0.type = GL_DONT_CARE;
+ c0.severity = GL_DONT_CARE;
+ c0.enabled = true;
+ g.controls.push_back(std::move(c0));
+
+ Control c1;
+ c1.source = GL_DONT_CARE;
+ c1.type = GL_DONT_CARE;
+ c1.severity = GL_DEBUG_SEVERITY_LOW;
+ c1.enabled = false;
+ g.controls.push_back(std::move(c1));
+
+ mGroups.push_back(std::move(g));
+}
+} // namespace gl
+
+namespace egl
+{
+
+namespace
+{
+angle::PackedEnumBitSet<MessageType> GetDefaultMessageTypeBits()
+{
+ angle::PackedEnumBitSet<MessageType> result;
+ result.set(MessageType::Critical);
+ result.set(MessageType::Error);
+ return result;
+}
+} // anonymous namespace
+
+Debug::Debug() : mCallback(nullptr), mEnabledMessageTypes(GetDefaultMessageTypeBits()) {}
+
+void Debug::setCallback(EGLDEBUGPROCKHR callback, const AttributeMap &attribs)
+{
+ mCallback = callback;
+
+ const angle::PackedEnumBitSet<MessageType> defaultMessageTypes = GetDefaultMessageTypeBits();
+ if (mCallback != nullptr)
+ {
+ for (MessageType messageType : angle::AllEnums<MessageType>())
+ {
+ mEnabledMessageTypes[messageType] =
+ (attribs.getAsInt(egl::ToEGLenum(messageType), defaultMessageTypes[messageType]) ==
+ EGL_TRUE);
+ }
+ }
+}
+
+EGLDEBUGPROCKHR Debug::getCallback() const
+{
+ return mCallback;
+}
+
+bool Debug::isMessageTypeEnabled(MessageType type) const
+{
+ return mEnabledMessageTypes[type];
+}
+
+void Debug::insertMessage(EGLenum error,
+ const char *command,
+ MessageType messageType,
+ EGLLabelKHR threadLabel,
+ EGLLabelKHR objectLabel,
+ const std::string &message) const
+{
+ {
+ // output all messages to the debug log
+ const char *messageTypeString = EGLMessageTypeToString(messageType);
+ std::ostringstream messageStream;
+ messageStream << "EGL " << messageTypeString << ": " << command << ": " << message;
+ INFO() << messageStream.str();
+ }
+
+ // TODO(geofflang): Lock before checking the callback. http://anglebug.com/2464
+ if (mCallback && isMessageTypeEnabled(messageType))
+ {
+ mCallback(error, command, egl::ToEGLenum(messageType), threadLabel, objectLabel,
+ message.c_str());
+ }
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Debug.h b/gfx/angle/checkout/src/libANGLE/Debug.h
new file mode 100644
index 0000000000..2c39e8c791
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Debug.h
@@ -0,0 +1,165 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Debug.h: Defines debug state used for GL_KHR_debug
+
+#ifndef LIBANGLE_DEBUG_H_
+#define LIBANGLE_DEBUG_H_
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/AttributeMap.h"
+
+#include <deque>
+#include <string>
+#include <vector>
+
+namespace gl
+{
+class Context;
+
+class LabeledObject
+{
+ public:
+ virtual ~LabeledObject() {}
+ virtual void setLabel(const Context *context, const std::string &label) = 0;
+ virtual const std::string &getLabel() const = 0;
+};
+
+class Debug : angle::NonCopyable
+{
+ public:
+ Debug(bool initialDebugState);
+ ~Debug();
+
+ void setMaxLoggedMessages(GLuint maxLoggedMessages);
+
+ void setOutputEnabled(bool enabled);
+ bool isOutputEnabled() const;
+
+ void setOutputSynchronous(bool synchronous);
+ bool isOutputSynchronous() const;
+
+ void setCallback(GLDEBUGPROCKHR callback, const void *userParam);
+ GLDEBUGPROCKHR getCallback() const;
+ const void *getUserParam() const;
+
+ void insertMessage(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ const std::string &message,
+ gl::LogSeverity logSeverity) const;
+ void insertMessage(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ std::string &&message,
+ gl::LogSeverity logSeverity) const;
+
+ void setMessageControl(GLenum source,
+ GLenum type,
+ GLenum severity,
+ std::vector<GLuint> &&ids,
+ bool enabled);
+ size_t getMessages(GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog);
+ size_t getNextMessageLength() const;
+ size_t getMessageCount() const;
+
+ void pushGroup(GLenum source, GLuint id, std::string &&message);
+ void popGroup();
+ size_t getGroupStackDepth() const;
+
+ private:
+ bool isMessageEnabled(GLenum source, GLenum type, GLuint id, GLenum severity) const;
+
+ void pushDefaultGroup();
+
+ struct Message
+ {
+ GLenum source;
+ GLenum type;
+ GLuint id;
+ GLenum severity;
+ std::string message;
+ };
+
+ struct Control
+ {
+ Control();
+ ~Control();
+ Control(const Control &other);
+
+ GLenum source;
+ GLenum type;
+ GLenum severity;
+ std::vector<GLuint> ids;
+ bool enabled;
+ };
+
+ struct Group
+ {
+ Group();
+ ~Group();
+ Group(const Group &other);
+
+ GLenum source;
+ GLuint id;
+ std::string message;
+
+ std::vector<Control> controls;
+ };
+
+ bool mOutputEnabled;
+ GLDEBUGPROCKHR mCallbackFunction;
+ const void *mCallbackUserParam;
+ mutable std::deque<Message> mMessages;
+ GLuint mMaxLoggedMessages;
+ bool mOutputSynchronous;
+ std::vector<Group> mGroups;
+};
+} // namespace gl
+
+namespace egl
+{
+class LabeledObject
+{
+ public:
+ virtual ~LabeledObject() {}
+ virtual void setLabel(EGLLabelKHR label) = 0;
+ virtual EGLLabelKHR getLabel() const = 0;
+};
+
+class Debug : angle::NonCopyable
+{
+ public:
+ Debug();
+
+ void setCallback(EGLDEBUGPROCKHR callback, const AttributeMap &attribs);
+ EGLDEBUGPROCKHR getCallback() const;
+ bool isMessageTypeEnabled(MessageType type) const;
+
+ void insertMessage(EGLenum error,
+ const char *command,
+ MessageType messageType,
+ EGLLabelKHR threadLabel,
+ EGLLabelKHR objectLabel,
+ const std::string &message) const;
+
+ private:
+ EGLDEBUGPROCKHR mCallback;
+ angle::PackedEnumBitSet<MessageType> mEnabledMessageTypes;
+};
+} // namespace egl
+#endif // LIBANGLE_DEBUG_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Device.cpp b/gfx/angle/checkout/src/libANGLE/Device.cpp
new file mode 100644
index 0000000000..13ae4e618e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Device.cpp
@@ -0,0 +1,131 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Device.cpp: Implements the egl::Device class, representing the abstract
+// device. Implements EGLDevice.
+
+#include "libANGLE/Device.h"
+
+#include <iterator>
+
+#include <EGL/eglext.h>
+#include <platform/Platform.h>
+
+#include "common/debug.h"
+#include "common/platform.h"
+#include "libANGLE/renderer/DeviceImpl.h"
+
+#if defined(ANGLE_ENABLE_D3D11)
+# include "libANGLE/renderer/d3d/DeviceD3D.h"
+#endif
+
+namespace egl
+{
+
+template <typename T>
+static std::string GenerateExtensionsString(const T &extensions)
+{
+ std::vector<std::string> extensionsVector = extensions.getStrings();
+
+ std::ostringstream stream;
+ std::copy(extensionsVector.begin(), extensionsVector.end(),
+ std::ostream_iterator<std::string>(stream, " "));
+ return stream.str();
+}
+
+typedef std::set<egl::Device *> DeviceSet;
+static DeviceSet *GetDeviceSet()
+{
+ static DeviceSet devices;
+ return &devices;
+}
+
+// Static factory methods
+egl::Error Device::CreateDevice(EGLint deviceType, void *nativeDevice, Device **outDevice)
+{
+ *outDevice = nullptr;
+
+ std::unique_ptr<rx::DeviceImpl> newDeviceImpl;
+
+#if defined(ANGLE_ENABLE_D3D11)
+ if (deviceType == EGL_D3D11_DEVICE_ANGLE)
+ {
+ newDeviceImpl.reset(new rx::DeviceD3D(deviceType, nativeDevice));
+ }
+#endif
+
+ // Note that creating an EGL device from inputted D3D9 parameters isn't currently supported
+
+ if (newDeviceImpl == nullptr)
+ {
+ return EglBadAttribute();
+ }
+
+ ANGLE_TRY(newDeviceImpl->initialize());
+ *outDevice = new Device(nullptr, newDeviceImpl.release());
+
+ return NoError();
+}
+
+bool Device::IsValidDevice(const Device *device)
+{
+ const DeviceSet *deviceSet = GetDeviceSet();
+ return deviceSet->find(const_cast<Device *>(device)) != deviceSet->end();
+}
+
+Device::Device(Display *owningDisplay, rx::DeviceImpl *impl)
+ : mLabel(nullptr), mOwningDisplay(owningDisplay), mImplementation(impl)
+{
+ ASSERT(GetDeviceSet()->find(this) == GetDeviceSet()->end());
+ GetDeviceSet()->insert(this);
+ initDeviceExtensions();
+}
+
+Device::~Device()
+{
+ ASSERT(GetDeviceSet()->find(this) != GetDeviceSet()->end());
+ GetDeviceSet()->erase(this);
+}
+
+void Device::setLabel(EGLLabelKHR label)
+{
+ mLabel = label;
+}
+
+EGLLabelKHR Device::getLabel() const
+{
+ return mLabel;
+}
+
+Error Device::getDevice(EGLAttrib *value)
+{
+ void *nativeDevice = nullptr;
+ egl::Error error = getImplementation()->getDevice(&nativeDevice);
+ *value = reinterpret_cast<EGLAttrib>(nativeDevice);
+ return error;
+}
+
+EGLint Device::getType()
+{
+ return getImplementation()->getType();
+}
+
+void Device::initDeviceExtensions()
+{
+ mImplementation->generateExtensions(&mDeviceExtensions);
+ mDeviceExtensionString = GenerateExtensionsString(mDeviceExtensions);
+}
+
+const DeviceExtensions &Device::getExtensions() const
+{
+ return mDeviceExtensions;
+}
+
+const std::string &Device::getExtensionString() const
+{
+ return mDeviceExtensionString;
+}
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Device.h b/gfx/angle/checkout/src/libANGLE/Device.h
new file mode 100644
index 0000000000..1096e95a4d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Device.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Device.h: Implements the egl::Device class, representing the abstract
+// device. Implements EGLDevice.
+
+#ifndef LIBANGLE_DEVICE_H_
+#define LIBANGLE_DEVICE_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Error.h"
+
+#include <memory>
+
+namespace rx
+{
+class DeviceImpl;
+} // namespace rx
+
+namespace egl
+{
+class Device final : public LabeledObject, angle::NonCopyable
+{
+ public:
+ Device(Display *owningDisplay, rx::DeviceImpl *impl);
+ ~Device() override;
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ Error getDevice(EGLAttrib *value);
+ Display *getOwningDisplay() { return mOwningDisplay; }
+ EGLint getType();
+
+ const DeviceExtensions &getExtensions() const;
+ const std::string &getExtensionString() const;
+
+ rx::DeviceImpl *getImplementation() { return mImplementation.get(); }
+
+ static egl::Error CreateDevice(EGLint deviceType, void *nativeDevice, Device **outDevice);
+ static bool IsValidDevice(const Device *device);
+
+ private:
+ void initDeviceExtensions();
+
+ EGLLabelKHR mLabel;
+
+ Display *mOwningDisplay;
+ std::unique_ptr<rx::DeviceImpl> mImplementation;
+
+ DeviceExtensions mDeviceExtensions;
+ std::string mDeviceExtensionString;
+};
+} // namespace egl
+
+#endif // LIBANGLE_DEVICE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Display.cpp b/gfx/angle/checkout/src/libANGLE/Display.cpp
new file mode 100644
index 0000000000..687174b399
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Display.cpp
@@ -0,0 +1,1580 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Display.cpp: Implements the egl::Display class, representing the abstract
+// display on which graphics are drawn. Implements EGLDisplay.
+// [EGL 1.4] section 2.1.2 page 3.
+
+#include "libANGLE/Display.h"
+
+#include <algorithm>
+#include <iterator>
+#include <map>
+#include <sstream>
+#include <vector>
+
+#include <EGL/eglext.h>
+#include <platform/Platform.h>
+
+#include "common/android_util.h"
+#include "common/debug.h"
+#include "common/mathutil.h"
+#include "common/platform.h"
+#include "common/string_utils.h"
+#include "common/system_utils.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Device.h"
+#include "libANGLE/EGLSync.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/ResourceManager.h"
+#include "libANGLE/Stream.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Thread.h"
+#include "libANGLE/histogram_macros.h"
+#include "libANGLE/renderer/DeviceImpl.h"
+#include "libANGLE/renderer/DisplayImpl.h"
+#include "libANGLE/renderer/ImageImpl.h"
+#include "libANGLE/trace.h"
+
+#if ANGLE_CAPTURE_ENABLED
+# include "libANGLE/FrameCapture.h"
+#endif // ANGLE_CAPTURE_ENABLED
+
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+# include "libANGLE/renderer/d3d/DisplayD3D.h"
+#endif
+
+#if defined(ANGLE_ENABLE_OPENGL)
+# if defined(ANGLE_PLATFORM_WINDOWS)
+# include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
+# elif defined(ANGLE_USE_X11)
+# include "libANGLE/renderer/gl/glx/DisplayGLX.h"
+# elif defined(ANGLE_PLATFORM_APPLE)
+# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+# elif defined(ANGLE_USE_OZONE)
+# include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
+# elif defined(ANGLE_PLATFORM_ANDROID)
+# include "libANGLE/renderer/gl/egl/android/DisplayAndroid.h"
+# else
+# error Unsupported OpenGL platform.
+# endif
+#endif
+
+#if defined(ANGLE_ENABLE_NULL)
+# include "libANGLE/renderer/null/DisplayNULL.h"
+#endif // defined(ANGLE_ENABLE_NULL)
+
+#if defined(ANGLE_ENABLE_VULKAN)
+# if defined(ANGLE_PLATFORM_WINDOWS)
+# include "libANGLE/renderer/vulkan/win32/DisplayVkWin32.h"
+# elif defined(ANGLE_PLATFORM_LINUX)
+# include "libANGLE/renderer/vulkan/xcb/DisplayVkXcb.h"
+# elif defined(ANGLE_PLATFORM_ANDROID)
+# include "libANGLE/renderer/vulkan/android/DisplayVkAndroid.h"
+# elif defined(ANGLE_PLATFORM_FUCHSIA)
+# include "libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h"
+# else
+# error Unsupported Vulkan platform.
+# endif
+#endif // defined(ANGLE_ENABLE_VULKAN)
+
+namespace egl
+{
+
+namespace
+{
+
+typedef std::map<EGLNativeWindowType, Surface *> WindowSurfaceMap;
+// Get a map of all EGL window surfaces to validate that no window has more than one EGL surface
+// associated with it.
+static WindowSurfaceMap *GetWindowSurfaces()
+{
+ static WindowSurfaceMap windowSurfaces;
+ return &windowSurfaces;
+}
+
+typedef std::map<EGLNativeDisplayType, Display *> ANGLEPlatformDisplayMap;
+static ANGLEPlatformDisplayMap *GetANGLEPlatformDisplayMap()
+{
+ static ANGLEPlatformDisplayMap displays;
+ return &displays;
+}
+
+typedef std::map<Device *, Display *> DevicePlatformDisplayMap;
+static DevicePlatformDisplayMap *GetDevicePlatformDisplayMap()
+{
+ static DevicePlatformDisplayMap displays;
+ return &displays;
+}
+
+rx::DisplayImpl *CreateDisplayFromDevice(Device *eglDevice, const DisplayState &state)
+{
+ rx::DisplayImpl *impl = nullptr;
+
+ switch (eglDevice->getType())
+ {
+#if defined(ANGLE_ENABLE_D3D11)
+ case EGL_D3D11_DEVICE_ANGLE:
+ impl = new rx::DisplayD3D(state);
+ break;
+#endif
+#if defined(ANGLE_ENABLE_D3D9)
+ case EGL_D3D9_DEVICE_ANGLE:
+ // Currently the only way to get EGLDeviceEXT representing a D3D9 device
+ // is to retrieve one from an already-existing EGLDisplay.
+ // When eglGetPlatformDisplayEXT is called with a D3D9 EGLDeviceEXT,
+ // the already-existing display should be returned.
+ // Therefore this codepath to create a new display from the device
+ // should never be hit.
+ UNREACHABLE();
+ break;
+#endif
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ ASSERT(impl != nullptr);
+ return impl;
+}
+
+// On platforms with support for multiple back-ends, allow an environment variable to control
+// the default. This is useful to run angle with benchmarks without having to modify the
+// benchmark source. Possible values for this environment variable (ANGLE_DEFAULT_PLATFORM)
+// are: vulkan, gl, d3d11.
+EGLAttrib GetDisplayTypeFromEnvironment()
+{
+ std::string angleDefaultEnv = angle::GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM");
+ angle::ToLower(&angleDefaultEnv);
+
+#if defined(ANGLE_ENABLE_VULKAN)
+ if (angleDefaultEnv == "vulkan")
+ {
+ return EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
+ }
+#endif
+
+#if defined(ANGLE_ENABLE_OPENGL)
+ if (angleDefaultEnv == "gl")
+ {
+ return EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE;
+ }
+#endif
+
+#if defined(ANGLE_ENABLE_D3D11)
+ if (angleDefaultEnv == "d3d11")
+ {
+ return EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
+ }
+#endif
+
+ return EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
+}
+
+rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const DisplayState &state)
+{
+ rx::DisplayImpl *impl = nullptr;
+ EGLAttrib displayType =
+ attribMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
+
+ if (displayType == EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE)
+ {
+ displayType = GetDisplayTypeFromEnvironment();
+ }
+
+ switch (displayType)
+ {
+ case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+ // Default to D3D displays
+ impl = new rx::DisplayD3D(state);
+#elif defined(ANGLE_USE_X11)
+ impl = new rx::DisplayGLX(state);
+#elif defined(ANGLE_PLATFORM_APPLE)
+ impl = new rx::DisplayCGL(state);
+#elif defined(ANGLE_PLATFORM_FUCHSIA)
+ impl = new rx::DisplayVkFuchsia(state);
+#elif defined(ANGLE_USE_OZONE)
+ impl = new rx::DisplayOzone(state);
+#elif defined(ANGLE_PLATFORM_ANDROID)
+# if defined(ANGLE_ENABLE_VULKAN)
+ impl = new rx::DisplayVkAndroid(state);
+# else
+ impl = new rx::DisplayAndroid(state);
+# endif
+#else
+ // No display available
+ UNREACHABLE();
+#endif
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
+ case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+ impl = new rx::DisplayD3D(state);
+#else
+ // A D3D display was requested on a platform that doesn't support it
+ UNREACHABLE();
+#endif
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
+#if defined(ANGLE_ENABLE_OPENGL)
+# if defined(ANGLE_PLATFORM_WINDOWS)
+ impl = new rx::DisplayWGL(state);
+# elif defined(ANGLE_USE_X11)
+ impl = new rx::DisplayGLX(state);
+# elif defined(ANGLE_PLATFORM_APPLE)
+ impl = new rx::DisplayCGL(state);
+# elif defined(ANGLE_USE_OZONE)
+ // This might work but has never been tried, so disallow for now.
+ impl = nullptr;
+# elif defined(ANGLE_PLATFORM_ANDROID)
+ // No GL support on this platform, fail display creation.
+ impl = nullptr;
+# else
+# error Unsupported OpenGL platform.
+# endif
+#else
+ // No display available
+ UNREACHABLE();
+#endif // defined(ANGLE_ENABLE_OPENGL)
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
+#if defined(ANGLE_ENABLE_OPENGL)
+# if defined(ANGLE_PLATFORM_WINDOWS)
+ impl = new rx::DisplayWGL(state);
+# elif defined(ANGLE_USE_X11)
+ impl = new rx::DisplayGLX(state);
+# elif defined(ANGLE_USE_OZONE)
+ impl = new rx::DisplayOzone(state);
+# elif defined(ANGLE_PLATFORM_ANDROID)
+ impl = new rx::DisplayAndroid(state);
+# else
+ // No GLES support on this platform, fail display creation.
+ impl = nullptr;
+# endif
+#endif // defined(ANGLE_ENABLE_OPENGL)
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
+#if defined(ANGLE_ENABLE_VULKAN)
+# if defined(ANGLE_PLATFORM_WINDOWS)
+ impl = new rx::DisplayVkWin32(state);
+# elif defined(ANGLE_PLATFORM_LINUX)
+ impl = new rx::DisplayVkXcb(state);
+# elif defined(ANGLE_PLATFORM_ANDROID)
+ impl = new rx::DisplayVkAndroid(state);
+# elif defined(ANGLE_PLATFORM_FUCHSIA)
+ impl = new rx::DisplayVkFuchsia(state);
+# else
+# error Unsupported Vulkan platform.
+# endif
+#else
+ // No display available
+ UNREACHABLE();
+#endif // defined(ANGLE_ENABLE_VULKAN)
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
+#if defined(ANGLE_ENABLE_NULL)
+ impl = new rx::DisplayNULL(state);
+#else
+ // No display available
+ UNREACHABLE();
+#endif // defined(ANGLE_ENABLE_NULL)
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return impl;
+}
+
+void Display_logError(angle::PlatformMethods *platform, const char *errorMessage)
+{
+ gl::Trace(gl::LOG_ERR, errorMessage);
+}
+
+void Display_logWarning(angle::PlatformMethods *platform, const char *warningMessage)
+{
+ gl::Trace(gl::LOG_WARN, warningMessage);
+}
+
+void Display_logInfo(angle::PlatformMethods *platform, const char *infoMessage)
+{
+ // Uncomment to get info spam
+#if defined(ANGLE_ENABLE_DEBUG_TRACE)
+ gl::Trace(gl::LOG_INFO, infoMessage);
+#endif
+}
+
+const std::vector<std::string> EGLStringArrayToStringVector(const char **ary)
+{
+ std::vector<std::string> vec;
+ if (ary != nullptr)
+ {
+ for (; *ary != nullptr; ary++)
+ {
+ vec.push_back(std::string(*ary));
+ }
+ }
+ return vec;
+}
+
+void ANGLESetDefaultDisplayPlatform(angle::EGLDisplayType display)
+{
+ angle::PlatformMethods *platformMethods = ANGLEPlatformCurrent();
+
+ ANGLEResetDisplayPlatform(display);
+ platformMethods->logError = Display_logError;
+ platformMethods->logWarning = Display_logWarning;
+ platformMethods->logInfo = Display_logInfo;
+}
+
+} // anonymous namespace
+
+DisplayState::DisplayState() : label(nullptr) {}
+
+DisplayState::~DisplayState() {}
+
+// static
+Display *Display::GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay,
+ const AttributeMap &attribMap)
+{
+ Display *display = nullptr;
+
+ ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
+ const auto &iter = displays->find(nativeDisplay);
+ if (iter != displays->end())
+ {
+ display = iter->second;
+ }
+
+ if (display == nullptr)
+ {
+ // Validate the native display
+ if (!Display::isValidNativeDisplay(nativeDisplay))
+ {
+ return nullptr;
+ }
+
+ display = new Display(EGL_PLATFORM_ANGLE_ANGLE, nativeDisplay, nullptr);
+ displays->insert(std::make_pair(nativeDisplay, display));
+ }
+
+ // Apply new attributes if the display is not initialized yet.
+ if (!display->isInitialized())
+ {
+ rx::DisplayImpl *impl = CreateDisplayFromAttribs(attribMap, display->getState());
+ if (impl == nullptr)
+ {
+ // No valid display implementation for these attributes
+ return nullptr;
+ }
+
+ display->setAttributes(impl, attribMap);
+ }
+
+ return display;
+}
+
+// static
+Display *Display::GetExistingDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay)
+{
+ ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
+ const auto &iter = displays->find(nativeDisplay);
+
+ // Check that there is a matching display
+ if (iter == displays->end())
+ {
+ return nullptr;
+ }
+
+ return iter->second;
+}
+
+// static
+Display *Display::GetDisplayFromDevice(Device *device, const AttributeMap &attribMap)
+{
+ Display *display = nullptr;
+
+ ASSERT(Device::IsValidDevice(device));
+
+ ANGLEPlatformDisplayMap *anglePlatformDisplays = GetANGLEPlatformDisplayMap();
+ DevicePlatformDisplayMap *devicePlatformDisplays = GetDevicePlatformDisplayMap();
+
+ // First see if this eglDevice is in use by a Display created using ANGLE platform
+ for (auto &displayMapEntry : *anglePlatformDisplays)
+ {
+ egl::Display *iterDisplay = displayMapEntry.second;
+ if (iterDisplay->getDevice() == device)
+ {
+ display = iterDisplay;
+ }
+ }
+
+ if (display == nullptr)
+ {
+ // See if the eglDevice is in use by a Display created using the DEVICE platform
+ const auto &iter = devicePlatformDisplays->find(device);
+ if (iter != devicePlatformDisplays->end())
+ {
+ display = iter->second;
+ }
+ }
+
+ if (display == nullptr)
+ {
+ // Otherwise create a new Display
+ display = new Display(EGL_PLATFORM_DEVICE_EXT, 0, device);
+ devicePlatformDisplays->insert(std::make_pair(device, display));
+ }
+
+ // Apply new attributes if the display is not initialized yet.
+ if (!display->isInitialized())
+ {
+ rx::DisplayImpl *impl = CreateDisplayFromDevice(device, display->getState());
+ display->setAttributes(impl, attribMap);
+ }
+
+ return display;
+}
+
+Display::Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice)
+ : mImplementation(nullptr),
+ mDisplayId(displayId),
+ mAttributeMap(),
+ mConfigSet(),
+ mContextSet(),
+ mStreamSet(),
+ mInitialized(false),
+ mDeviceLost(false),
+ mCaps(),
+ mDisplayExtensions(),
+ mDisplayExtensionString(),
+ mVendorString(),
+ mDevice(eglDevice),
+ mSurface(nullptr),
+ mPlatform(platform),
+ mTextureManager(nullptr),
+ mBlobCache(gl::kDefaultMaxProgramCacheMemoryBytes),
+ mMemoryProgramCache(mBlobCache),
+ mGlobalTextureShareGroupUsers(0),
+ mFrameCapture(nullptr)
+{
+#if ANGLE_CAPTURE_ENABLED
+ mFrameCapture = new FrameCapture;
+#endif // ANGLE_CAPTURE_ENABLED
+}
+
+Display::~Display()
+{
+ // TODO(jmadill): When is this called?
+ // terminate();
+
+ if (mPlatform == EGL_PLATFORM_ANGLE_ANGLE)
+ {
+ ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
+ ANGLEPlatformDisplayMap::iterator iter = displays->find(mDisplayId);
+ if (iter != displays->end())
+ {
+ displays->erase(iter);
+ }
+ }
+ else if (mPlatform == EGL_PLATFORM_DEVICE_EXT)
+ {
+ DevicePlatformDisplayMap *displays = GetDevicePlatformDisplayMap();
+ DevicePlatformDisplayMap::iterator iter = displays->find(mDevice);
+ if (iter != displays->end())
+ {
+ displays->erase(iter);
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ SafeDelete(mDevice);
+ SafeDelete(mImplementation);
+
+#if ANGLE_CAPTURE_ENABLED
+ SafeDelete(mFrameCapture);
+#endif // ANGLE_CAPTURE_ENABLED
+}
+
+void Display::setLabel(EGLLabelKHR label)
+{
+ mState.label = label;
+}
+
+EGLLabelKHR Display::getLabel() const
+{
+ return mState.label;
+}
+
+void Display::setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap)
+{
+ ASSERT(!mInitialized);
+
+ ASSERT(impl != nullptr);
+ SafeDelete(mImplementation);
+ mImplementation = impl;
+
+ mAttributeMap = attribMap;
+
+ // TODO(jmadill): Store Platform in Display and init here.
+ const angle::PlatformMethods *platformMethods =
+ reinterpret_cast<const angle::PlatformMethods *>(
+ mAttributeMap.get(EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX, 0));
+ if (platformMethods != nullptr)
+ {
+ *ANGLEPlatformCurrent() = *platformMethods;
+ }
+ else
+ {
+ ANGLESetDefaultDisplayPlatform(this);
+ }
+
+ const char **featuresForceEnabled =
+ reinterpret_cast<const char **>(mAttributeMap.get(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE, 0));
+ const char **featuresForceDisabled =
+ reinterpret_cast<const char **>(mAttributeMap.get(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE, 0));
+ mState.featureOverridesEnabled = EGLStringArrayToStringVector(featuresForceEnabled);
+ mState.featureOverridesDisabled = EGLStringArrayToStringVector(featuresForceDisabled);
+}
+
+Error Display::initialize()
+{
+ ASSERT(mImplementation != nullptr);
+ mImplementation->setBlobCache(&mBlobCache);
+
+ gl::InitializeDebugAnnotations(&mAnnotator);
+
+ gl::InitializeDebugMutexIfNeeded();
+
+ SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.DisplayInitializeMS");
+ ANGLE_TRACE_EVENT0("gpu.angle", "egl::Display::initialize");
+
+ if (isInitialized())
+ {
+ return NoError();
+ }
+
+ Error error = mImplementation->initialize(this);
+ if (error.isError())
+ {
+ // Log extended error message here
+ ERR() << "ANGLE Display::initialize error " << error.getID() << ": " << error.getMessage();
+ return error;
+ }
+
+ mCaps = mImplementation->getCaps();
+
+ mConfigSet = mImplementation->generateConfigs();
+ if (mConfigSet.size() == 0)
+ {
+ mImplementation->terminate();
+ return EglNotInitialized();
+ }
+
+ // OpenGL ES1 is implemented in the frontend, explicitly add ES1 support to all configs
+ for (auto &config : mConfigSet)
+ {
+ // TODO(geofflang): Enable the conformant bit once we pass enough tests
+ // config.second.conformant |= EGL_OPENGL_ES_BIT;
+
+ config.second.renderableType |= EGL_OPENGL_ES_BIT;
+ }
+
+ initializeFrontendFeatures();
+
+ mFeatures.clear();
+ mFrontendFeatures.populateFeatureList(&mFeatures);
+ mImplementation->populateFeatureList(&mFeatures);
+
+ initDisplayExtensions();
+ initVendorString();
+
+ // Populate the Display's EGLDeviceEXT if the Display wasn't created using one
+ if (mPlatform != EGL_PLATFORM_DEVICE_EXT)
+ {
+ if (mDisplayExtensions.deviceQuery)
+ {
+ std::unique_ptr<rx::DeviceImpl> impl(mImplementation->createDevice());
+ ASSERT(impl != nullptr);
+ error = impl->initialize();
+ if (error.isError())
+ {
+ ERR() << "Failed to initialize display because device creation failed: "
+ << error.getMessage();
+ mImplementation->terminate();
+ return error;
+ }
+ mDevice = new Device(this, impl.release());
+ }
+ else
+ {
+ mDevice = nullptr;
+ }
+ }
+ else
+ {
+ // For EGL_PLATFORM_DEVICE_EXT, mDevice should always be populated using
+ // an external device
+ ASSERT(mDevice != nullptr);
+ }
+
+ mInitialized = true;
+
+ return NoError();
+}
+
+Error Display::terminate(const Thread *thread)
+{
+ if (!mInitialized)
+ {
+ return NoError();
+ }
+
+ mMemoryProgramCache.clear();
+ mBlobCache.setBlobCacheFuncs(nullptr, nullptr);
+
+ while (!mContextSet.empty())
+ {
+ ANGLE_TRY(destroyContext(thread, *mContextSet.begin()));
+ }
+
+ ANGLE_TRY(makeCurrent(thread, nullptr, nullptr, nullptr));
+
+ // The global texture manager should be deleted with the last context that uses it.
+ ASSERT(mGlobalTextureShareGroupUsers == 0 && mTextureManager == nullptr);
+
+ while (!mImageSet.empty())
+ {
+ destroyImage(*mImageSet.begin());
+ }
+
+ while (!mStreamSet.empty())
+ {
+ destroyStream(*mStreamSet.begin());
+ }
+
+ while (!mSyncSet.empty())
+ {
+ destroySync(*mSyncSet.begin());
+ }
+
+ while (!mState.surfaceSet.empty())
+ {
+ ANGLE_TRY(destroySurface(*mState.surfaceSet.begin()));
+ }
+
+ mConfigSet.clear();
+
+ if (mDevice != nullptr && mDevice->getOwningDisplay() != nullptr)
+ {
+ // Don't delete the device if it was created externally using eglCreateDeviceANGLE
+ // We also shouldn't set it to null in case eglInitialize() is called again later
+ SafeDelete(mDevice);
+ }
+
+ mImplementation->terminate();
+
+ mDeviceLost = false;
+
+ mInitialized = false;
+
+ gl::UninitializeDebugAnnotations();
+
+ // TODO(jmadill): Store Platform in Display and deinit here.
+ ANGLEResetDisplayPlatform(this);
+
+ return NoError();
+}
+
+std::vector<const Config *> Display::getConfigs(const egl::AttributeMap &attribs) const
+{
+ return mConfigSet.filter(attribs);
+}
+
+std::vector<const Config *> Display::chooseConfig(const egl::AttributeMap &attribs) const
+{
+ egl::AttributeMap attribsWithDefaults = AttributeMap();
+
+ // Insert default values for attributes that have either an Exact or Mask selection criteria,
+ // and a default value that matters (e.g. isn't EGL_DONT_CARE):
+ attribsWithDefaults.insert(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
+ attribsWithDefaults.insert(EGL_LEVEL, 0);
+ attribsWithDefaults.insert(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
+ attribsWithDefaults.insert(EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
+ attribsWithDefaults.insert(EGL_TRANSPARENT_TYPE, EGL_NONE);
+ if (getExtensions().pixelFormatFloat)
+ {
+ attribsWithDefaults.insert(EGL_COLOR_COMPONENT_TYPE_EXT,
+ EGL_COLOR_COMPONENT_TYPE_FIXED_EXT);
+ }
+
+ // Add the caller-specified values (Note: the poorly-named insert() method will replace any
+ // of the default values from above):
+ for (auto attribIter = attribs.begin(); attribIter != attribs.end(); attribIter++)
+ {
+ attribsWithDefaults.insert(attribIter->first, attribIter->second);
+ }
+
+ return mConfigSet.filter(attribsWithDefaults);
+}
+
+Error Display::createWindowSurface(const Config *configuration,
+ EGLNativeWindowType window,
+ const AttributeMap &attribs,
+ Surface **outSurface)
+{
+ if (mImplementation->testDeviceLost())
+ {
+ ANGLE_TRY(restoreLostDevice());
+ }
+
+ SurfacePointer surface(new WindowSurface(mImplementation, configuration, window, attribs),
+ this);
+ ANGLE_TRY(surface->initialize(this));
+
+ ASSERT(outSurface != nullptr);
+ *outSurface = surface.release();
+ mState.surfaceSet.insert(*outSurface);
+
+ WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
+ ASSERT(windowSurfaces && windowSurfaces->find(window) == windowSurfaces->end());
+ windowSurfaces->insert(std::make_pair(window, *outSurface));
+
+ mSurface = *outSurface;
+
+ return NoError();
+}
+
+Error Display::createPbufferSurface(const Config *configuration,
+ const AttributeMap &attribs,
+ Surface **outSurface)
+{
+ ASSERT(isInitialized());
+
+ if (mImplementation->testDeviceLost())
+ {
+ ANGLE_TRY(restoreLostDevice());
+ }
+
+ SurfacePointer surface(new PbufferSurface(mImplementation, configuration, attribs), this);
+ ANGLE_TRY(surface->initialize(this));
+
+ ASSERT(outSurface != nullptr);
+ *outSurface = surface.release();
+ mState.surfaceSet.insert(*outSurface);
+
+ return NoError();
+}
+
+Error Display::createPbufferFromClientBuffer(const Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const AttributeMap &attribs,
+ Surface **outSurface)
+{
+ ASSERT(isInitialized());
+
+ if (mImplementation->testDeviceLost())
+ {
+ ANGLE_TRY(restoreLostDevice());
+ }
+
+ SurfacePointer surface(
+ new PbufferSurface(mImplementation, configuration, buftype, clientBuffer, attribs), this);
+ ANGLE_TRY(surface->initialize(this));
+
+ ASSERT(outSurface != nullptr);
+ *outSurface = surface.release();
+ mState.surfaceSet.insert(*outSurface);
+
+ return NoError();
+}
+
+Error Display::createPixmapSurface(const Config *configuration,
+ NativePixmapType nativePixmap,
+ const AttributeMap &attribs,
+ Surface **outSurface)
+{
+ ASSERT(isInitialized());
+
+ if (mImplementation->testDeviceLost())
+ {
+ ANGLE_TRY(restoreLostDevice());
+ }
+
+ SurfacePointer surface(new PixmapSurface(mImplementation, configuration, nativePixmap, attribs),
+ this);
+ ANGLE_TRY(surface->initialize(this));
+
+ ASSERT(outSurface != nullptr);
+ *outSurface = surface.release();
+ mState.surfaceSet.insert(*outSurface);
+
+ return NoError();
+}
+
+Error Display::createImage(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attribs,
+ Image **outImage)
+{
+ ASSERT(isInitialized());
+
+ if (mImplementation->testDeviceLost())
+ {
+ ANGLE_TRY(restoreLostDevice());
+ }
+
+ egl::ImageSibling *sibling = nullptr;
+ if (IsTextureTarget(target))
+ {
+ sibling = context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
+ }
+ else if (IsRenderbufferTarget(target))
+ {
+ sibling = context->getRenderbuffer(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
+ }
+ else if (IsExternalImageTarget(target))
+ {
+ sibling = new ExternalImageSibling(mImplementation, context, target, buffer, attribs);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ ASSERT(sibling != nullptr);
+
+ angle::UniqueObjectPointer<Image, Display> imagePtr(
+ new Image(mImplementation, context, target, sibling, attribs), this);
+ ANGLE_TRY(imagePtr->initialize(this));
+
+ Image *image = imagePtr.release();
+
+ ASSERT(outImage != nullptr);
+ *outImage = image;
+
+ // Add this image to the list of all images and hold a ref to it.
+ image->addRef();
+ mImageSet.insert(image);
+
+ return NoError();
+}
+
+Error Display::createStream(const AttributeMap &attribs, Stream **outStream)
+{
+ ASSERT(isInitialized());
+
+ Stream *stream = new Stream(this, attribs);
+
+ ASSERT(stream != nullptr);
+ mStreamSet.insert(stream);
+
+ ASSERT(outStream != nullptr);
+ *outStream = stream;
+
+ return NoError();
+}
+
+Error Display::createContext(const Config *configuration,
+ const gl::Context *shareContext,
+ EGLenum clientType,
+ const AttributeMap &attribs,
+ gl::Context **outContext)
+{
+ ASSERT(isInitialized());
+
+ if (mImplementation->testDeviceLost())
+ {
+ ANGLE_TRY(restoreLostDevice());
+ }
+
+ // This display texture sharing will allow the first context to create the texture share group.
+ bool usingDisplayTextureShareGroup =
+ attribs.get(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE, EGL_FALSE) == EGL_TRUE;
+ gl::TextureManager *shareTextures = nullptr;
+
+ if (usingDisplayTextureShareGroup)
+ {
+ ASSERT((mTextureManager == nullptr) == (mGlobalTextureShareGroupUsers == 0));
+ if (mTextureManager == nullptr)
+ {
+ mTextureManager = new gl::TextureManager();
+ }
+
+ mGlobalTextureShareGroupUsers++;
+ shareTextures = mTextureManager;
+ }
+
+ gl::MemoryProgramCache *cachePointer = &mMemoryProgramCache;
+
+ // Check context creation attributes to see if we are using EGL_ANGLE_program_cache_control.
+ // If not, keep caching enabled for EGL_ANDROID_blob_cache, which can have its callbacks set
+ // at any time.
+ bool usesProgramCacheControl =
+ mAttributeMap.contains(EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE);
+ if (usesProgramCacheControl)
+ {
+ bool programCacheControlEnabled =
+ mAttributeMap.get(EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE, GL_FALSE);
+ // A program cache size of zero indicates it should be disabled.
+ if (!programCacheControlEnabled || mMemoryProgramCache.maxSize() == 0)
+ {
+ cachePointer = nullptr;
+ }
+ }
+
+ gl::Context *context =
+ new gl::Context(this, configuration, shareContext, shareTextures, cachePointer, clientType,
+ attribs, mDisplayExtensions, GetClientExtensions());
+
+ ASSERT(context != nullptr);
+ mContextSet.insert(context);
+
+ ASSERT(outContext != nullptr);
+ *outContext = context;
+ return NoError();
+}
+
+Error Display::createSync(const gl::Context *currentContext,
+ EGLenum type,
+ const AttributeMap &attribs,
+ Sync **outSync)
+{
+ ASSERT(isInitialized());
+
+ if (mImplementation->testDeviceLost())
+ {
+ ANGLE_TRY(restoreLostDevice());
+ }
+
+ angle::UniqueObjectPointer<egl::Sync, Display> syncPtr(new Sync(mImplementation, type, attribs),
+ this);
+
+ ANGLE_TRY(syncPtr->initialize(this, currentContext));
+
+ Sync *sync = syncPtr.release();
+
+ sync->addRef();
+ mSyncSet.insert(sync);
+
+ *outSync = sync;
+ return NoError();
+}
+
+Error Display::makeCurrent(const Thread *thread,
+ egl::Surface *drawSurface,
+ egl::Surface *readSurface,
+ gl::Context *context)
+{
+ if (!mInitialized)
+ {
+ return NoError();
+ }
+
+ gl::Context *previousContext = thread->getContext();
+ if (previousContext)
+ {
+ ANGLE_TRY(previousContext->unMakeCurrent(this));
+ }
+
+ ANGLE_TRY(mImplementation->makeCurrent(drawSurface, readSurface, context));
+
+ if (context != nullptr)
+ {
+ ASSERT(readSurface == drawSurface);
+ ANGLE_TRY(context->makeCurrent(this, drawSurface));
+ }
+
+ return NoError();
+}
+
+Error Display::restoreLostDevice()
+{
+ for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++)
+ {
+ if ((*ctx)->isResetNotificationEnabled())
+ {
+ // If reset notifications have been requested, application must delete all contexts
+ // first
+ return EglContextLost();
+ }
+ }
+
+ return mImplementation->restoreLostDevice(this);
+}
+
+Error Display::destroySurface(Surface *surface)
+{
+ if (surface->getType() == EGL_WINDOW_BIT)
+ {
+ WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
+ ASSERT(windowSurfaces);
+
+ bool surfaceRemoved = false;
+ for (WindowSurfaceMap::iterator iter = windowSurfaces->begin();
+ iter != windowSurfaces->end(); iter++)
+ {
+ if (iter->second == surface)
+ {
+ windowSurfaces->erase(iter);
+ surfaceRemoved = true;
+ break;
+ }
+ }
+
+ ASSERT(surfaceRemoved);
+ }
+
+ mState.surfaceSet.erase(surface);
+ ANGLE_TRY(surface->onDestroy(this));
+ return NoError();
+}
+
+void Display::destroyImage(egl::Image *image)
+{
+ auto iter = mImageSet.find(image);
+ ASSERT(iter != mImageSet.end());
+ (*iter)->release(this);
+ mImageSet.erase(iter);
+}
+
+void Display::destroyStream(egl::Stream *stream)
+{
+ mStreamSet.erase(stream);
+ SafeDelete(stream);
+}
+
+Error Display::destroyContext(const Thread *thread, gl::Context *context)
+{
+ gl::Context *currentContext = thread->getContext();
+ Surface *currentDrawSurface = thread->getCurrentDrawSurface();
+ Surface *currentReadSurface = thread->getCurrentReadSurface();
+ bool changeContextForDeletion = context != currentContext;
+
+ // Make the context being deleted current during it's deletion. This allows it to delete any
+ // resources it's holding.
+ if (changeContextForDeletion)
+ {
+ ANGLE_TRY(makeCurrent(thread, nullptr, nullptr, context));
+ }
+
+ if (context->usingDisplayTextureShareGroup())
+ {
+ ASSERT(mGlobalTextureShareGroupUsers >= 1 && mTextureManager != nullptr);
+ if (mGlobalTextureShareGroupUsers == 1)
+ {
+ // If this is the last context using the global share group, destroy the global texture
+ // manager so that the textures can be destroyed while a context still exists
+ mTextureManager->release(context);
+ mTextureManager = nullptr;
+ }
+ mGlobalTextureShareGroupUsers--;
+ }
+
+ ANGLE_TRY(context->onDestroy(this));
+ mContextSet.erase(context);
+ SafeDelete(context);
+
+ // Set the previous context back to current
+ if (changeContextForDeletion)
+ {
+ ANGLE_TRY(makeCurrent(thread, currentDrawSurface, currentReadSurface, currentContext));
+ }
+
+ return NoError();
+}
+
+void Display::destroySync(egl::Sync *sync)
+{
+ auto iter = mSyncSet.find(sync);
+ ASSERT(iter != mSyncSet.end());
+ (*iter)->release(this);
+ mSyncSet.erase(iter);
+}
+
+bool Display::isDeviceLost() const
+{
+ ASSERT(isInitialized());
+ return mDeviceLost;
+}
+
+bool Display::testDeviceLost()
+{
+ ASSERT(isInitialized());
+
+ if (!mDeviceLost && mImplementation->testDeviceLost())
+ {
+ notifyDeviceLost();
+ }
+
+ return mDeviceLost;
+}
+
+void Display::notifyDeviceLost()
+{
+ if (mDeviceLost)
+ {
+ return;
+ }
+
+ for (ContextSet::iterator context = mContextSet.begin(); context != mContextSet.end();
+ context++)
+ {
+ (*context)->markContextLost(gl::GraphicsResetStatus::UnknownContextReset);
+ }
+
+ mDeviceLost = true;
+}
+
+void Display::setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get)
+{
+ mBlobCache.setBlobCacheFuncs(set, get);
+ mImplementation->setBlobCacheFuncs(set, get);
+}
+
+// static
+EGLClientBuffer Display::GetNativeClientBuffer(const AHardwareBuffer *buffer)
+{
+ return angle::android::AHardwareBufferToClientBuffer(buffer);
+}
+
+Error Display::waitClient(const gl::Context *context)
+{
+ return mImplementation->waitClient(context);
+}
+
+Error Display::waitNative(const gl::Context *context, EGLint engine)
+{
+ return mImplementation->waitNative(context, engine);
+}
+
+const Caps &Display::getCaps() const
+{
+ return mCaps;
+}
+
+bool Display::isInitialized() const
+{
+ return mInitialized;
+}
+
+bool Display::isValidConfig(const Config *config) const
+{
+ return mConfigSet.contains(config);
+}
+
+bool Display::isValidContext(const gl::Context *context) const
+{
+ return mContextSet.find(const_cast<gl::Context *>(context)) != mContextSet.end();
+}
+
+bool Display::isValidSurface(const Surface *surface) const
+{
+ return mState.surfaceSet.find(const_cast<Surface *>(surface)) != mState.surfaceSet.end();
+}
+
+bool Display::isValidImage(const Image *image) const
+{
+ return mImageSet.find(const_cast<Image *>(image)) != mImageSet.end();
+}
+
+bool Display::isValidStream(const Stream *stream) const
+{
+ return mStreamSet.find(const_cast<Stream *>(stream)) != mStreamSet.end();
+}
+
+bool Display::isValidSync(const Sync *sync) const
+{
+ return mSyncSet.find(const_cast<Sync *>(sync)) != mSyncSet.end();
+}
+
+bool Display::hasExistingWindowSurface(EGLNativeWindowType window)
+{
+ WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
+ ASSERT(windowSurfaces);
+
+ return windowSurfaces->find(window) != windowSurfaces->end();
+}
+
+static ClientExtensions GenerateClientExtensions()
+{
+ ClientExtensions extensions;
+
+ extensions.clientExtensions = true;
+ extensions.platformBase = true;
+ extensions.platformANGLE = true;
+
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+ extensions.platformANGLED3D = true;
+ extensions.platformDevice = true;
+#endif
+
+#if defined(ANGLE_ENABLE_OPENGL)
+ extensions.platformANGLEOpenGL = true;
+
+ // Selecting context virtualization is currently only supported in the OpenGL backend.
+ extensions.platformANGLEContextVirtualization = true;
+#endif
+
+#if defined(ANGLE_ENABLE_NULL)
+ extensions.platformANGLENULL = true;
+#endif
+
+#if defined(ANGLE_ENABLE_D3D11)
+ extensions.deviceCreation = true;
+ extensions.deviceCreationD3D11 = true;
+ extensions.experimentalPresentPath = true;
+#endif
+
+#if defined(ANGLE_ENABLE_VULKAN)
+ extensions.platformANGLEVulkan = true;
+#endif
+
+#if defined(ANGLE_USE_X11)
+ extensions.x11Visual = true;
+#endif
+
+ extensions.clientGetAllProcAddresses = true;
+ extensions.debug = true;
+ extensions.explicitContext = true;
+ extensions.featureControlANGLE = true;
+
+ return extensions;
+}
+
+template <typename T>
+static std::string GenerateExtensionsString(const T &extensions)
+{
+ std::vector<std::string> extensionsVector = extensions.getStrings();
+
+ std::ostringstream stream;
+ std::copy(extensionsVector.begin(), extensionsVector.end(),
+ std::ostream_iterator<std::string>(stream, " "));
+ return stream.str();
+}
+
+// static
+const ClientExtensions &Display::GetClientExtensions()
+{
+ static const ClientExtensions clientExtensions = GenerateClientExtensions();
+ return clientExtensions;
+}
+
+// static
+const std::string &Display::GetClientExtensionString()
+{
+ static const std::string clientExtensionsString =
+ GenerateExtensionsString(GetClientExtensions());
+ return clientExtensionsString;
+}
+
+void Display::initDisplayExtensions()
+{
+ mDisplayExtensions = mImplementation->getExtensions();
+
+ // Some extensions are always available because they are implemented in the EGL layer.
+ mDisplayExtensions.createContext = true;
+ mDisplayExtensions.createContextNoError = true;
+ mDisplayExtensions.createContextWebGLCompatibility = true;
+ mDisplayExtensions.createContextBindGeneratesResource = true;
+ mDisplayExtensions.createContextClientArrays = true;
+ mDisplayExtensions.pixelFormatFloat = true;
+
+ // Force EGL_KHR_get_all_proc_addresses on.
+ mDisplayExtensions.getAllProcAddresses = true;
+
+ // Enable program cache control since it is not back-end dependent.
+ mDisplayExtensions.programCacheControl = true;
+
+ // Request extension is implemented in the ANGLE frontend
+ mDisplayExtensions.createContextExtensionsEnabled = true;
+
+ // Blob cache extension is provided by the ANGLE frontend
+ mDisplayExtensions.blobCache = true;
+
+ // The EGL_ANDROID_recordable extension is provided by the ANGLE frontend, and will always say
+ // that ANativeWindow is not recordable.
+ mDisplayExtensions.recordable = true;
+
+ // All backends support specific context versions
+ mDisplayExtensions.createContextBackwardsCompatible = true;
+
+ mDisplayExtensionString = GenerateExtensionsString(mDisplayExtensions);
+}
+
+bool Display::isValidNativeWindow(EGLNativeWindowType window) const
+{
+ return mImplementation->isValidNativeWindow(window);
+}
+
+Error Display::validateClientBuffer(const Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const AttributeMap &attribs) const
+{
+ return mImplementation->validateClientBuffer(configuration, buftype, clientBuffer, attribs);
+}
+
+Error Display::validateImageClientBuffer(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const
+{
+ return mImplementation->validateImageClientBuffer(context, target, clientBuffer, attribs);
+}
+
+bool Display::isValidDisplay(const egl::Display *display)
+{
+ const ANGLEPlatformDisplayMap *anglePlatformDisplayMap = GetANGLEPlatformDisplayMap();
+ for (const auto &displayPair : *anglePlatformDisplayMap)
+ {
+ if (displayPair.second == display)
+ {
+ return true;
+ }
+ }
+
+ const DevicePlatformDisplayMap *devicePlatformDisplayMap = GetDevicePlatformDisplayMap();
+ for (const auto &displayPair : *devicePlatformDisplayMap)
+ {
+ if (displayPair.second == display)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool Display::isValidNativeDisplay(EGLNativeDisplayType display)
+{
+ // TODO(jmadill): handle this properly
+ if (display == EGL_DEFAULT_DISPLAY)
+ {
+ return true;
+ }
+
+#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (display == EGL_SOFTWARE_DISPLAY_ANGLE || display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ display == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+ {
+ return true;
+ }
+ return (WindowFromDC(display) != nullptr);
+#else
+ return true;
+#endif
+}
+
+void Display::initVendorString()
+{
+ mVendorString = mImplementation->getVendorString();
+}
+
+void Display::initializeFrontendFeatures()
+{
+ // Enable on all Impls
+ mFrontendFeatures.loseContextOnOutOfMemory.enabled = true;
+ mFrontendFeatures.scalarizeVecAndMatConstructorArgs.enabled = true;
+
+ mImplementation->initializeFrontendFeatures(&mFrontendFeatures);
+
+ rx::OverrideFeaturesWithDisplayState(&mFrontendFeatures, mState);
+}
+
+const DisplayExtensions &Display::getExtensions() const
+{
+ return mDisplayExtensions;
+}
+
+const std::string &Display::getExtensionString() const
+{
+ return mDisplayExtensionString;
+}
+
+const std::string &Display::getVendorString() const
+{
+ return mVendorString;
+}
+
+Device *Display::getDevice() const
+{
+ return mDevice;
+}
+
+Surface *Display::getWGLSurface() const
+{
+ return mSurface;
+}
+
+gl::Version Display::getMaxSupportedESVersion() const
+{
+ return mImplementation->getMaxSupportedESVersion();
+}
+
+EGLint Display::programCacheGetAttrib(EGLenum attrib) const
+{
+ switch (attrib)
+ {
+ case EGL_PROGRAM_CACHE_KEY_LENGTH_ANGLE:
+ return static_cast<EGLint>(BlobCache::kKeyLength);
+
+ case EGL_PROGRAM_CACHE_SIZE_ANGLE:
+ return static_cast<EGLint>(mMemoryProgramCache.entryCount());
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+Error Display::programCacheQuery(EGLint index,
+ void *key,
+ EGLint *keysize,
+ void *binary,
+ EGLint *binarysize)
+{
+ ASSERT(index >= 0 && index < static_cast<EGLint>(mMemoryProgramCache.entryCount()));
+
+ const BlobCache::Key *programHash = nullptr;
+ BlobCache::Value programBinary;
+ // TODO(jmadill): Make this thread-safe.
+ bool result =
+ mMemoryProgramCache.getAt(static_cast<size_t>(index), &programHash, &programBinary);
+ if (!result)
+ {
+ return EglBadAccess() << "Program binary not accessible.";
+ }
+
+ ASSERT(keysize && binarysize);
+
+ if (key)
+ {
+ ASSERT(*keysize == static_cast<EGLint>(BlobCache::kKeyLength));
+ memcpy(key, programHash->data(), BlobCache::kKeyLength);
+ }
+
+ if (binary)
+ {
+ // Note: we check the size here instead of in the validation code, since we need to
+ // access the cache as atomically as possible. It's possible that the cache contents
+ // could change between the validation size check and the retrieval.
+ if (programBinary.size() > static_cast<size_t>(*binarysize))
+ {
+ return EglBadAccess() << "Program binary too large or changed during access.";
+ }
+
+ memcpy(binary, programBinary.data(), programBinary.size());
+ }
+
+ *binarysize = static_cast<EGLint>(programBinary.size());
+ *keysize = static_cast<EGLint>(BlobCache::kKeyLength);
+
+ return NoError();
+}
+
+Error Display::programCachePopulate(const void *key,
+ EGLint keysize,
+ const void *binary,
+ EGLint binarysize)
+{
+ ASSERT(keysize == static_cast<EGLint>(BlobCache::kKeyLength));
+
+ BlobCache::Key programHash;
+ memcpy(programHash.data(), key, BlobCache::kKeyLength);
+
+ mMemoryProgramCache.putBinary(programHash, reinterpret_cast<const uint8_t *>(binary),
+ static_cast<size_t>(binarysize));
+ return NoError();
+}
+
+EGLint Display::programCacheResize(EGLint limit, EGLenum mode)
+{
+ switch (mode)
+ {
+ case EGL_PROGRAM_CACHE_RESIZE_ANGLE:
+ {
+ size_t initialSize = mMemoryProgramCache.size();
+ mMemoryProgramCache.resize(static_cast<size_t>(limit));
+ return static_cast<EGLint>(initialSize);
+ }
+
+ case EGL_PROGRAM_CACHE_TRIM_ANGLE:
+ return static_cast<EGLint>(mMemoryProgramCache.trim(static_cast<size_t>(limit)));
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+const char *Display::queryStringi(const EGLint name, const EGLint index)
+{
+ const char *result = nullptr;
+ switch (name)
+ {
+ case EGL_FEATURE_NAME_ANGLE:
+ result = mFeatures[index]->name;
+ break;
+ case EGL_FEATURE_CATEGORY_ANGLE:
+ result = angle::FeatureCategoryToString(mFeatures[index]->category);
+ break;
+ case EGL_FEATURE_DESCRIPTION_ANGLE:
+ result = mFeatures[index]->description;
+ break;
+ case EGL_FEATURE_BUG_ANGLE:
+ result = mFeatures[index]->bug;
+ break;
+ case EGL_FEATURE_STATUS_ANGLE:
+ result = angle::FeatureStatusToString(mFeatures[index]->enabled);
+ break;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+ return result;
+}
+
+EGLAttrib Display::queryAttrib(const EGLint attribute)
+{
+ EGLAttrib value = 0;
+ switch (attribute)
+ {
+ case EGL_DEVICE_EXT:
+ value = reinterpret_cast<EGLAttrib>(mDevice);
+ break;
+
+ case EGL_FEATURE_COUNT_ANGLE:
+ value = mFeatures.size();
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ return value;
+}
+
+void Display::onPostSwap() const
+{
+#if ANGLE_CAPTURE_ENABLED
+ // Dump frame capture if enabled.
+ mFrameCapture->onEndFrame();
+#endif // ANGLE_CAPTURE_ENABLED
+}
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Display.h b/gfx/angle/checkout/src/libANGLE/Display.h
new file mode 100644
index 0000000000..e9ecfd4da8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Display.h
@@ -0,0 +1,280 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Display.h: Defines the egl::Display class, representing the abstract
+// display on which graphics are drawn. Implements EGLDisplay.
+// [EGL 1.4] section 2.1.2 page 3.
+
+#ifndef LIBANGLE_DISPLAY_H_
+#define LIBANGLE_DISPLAY_H_
+
+#include <set>
+#include <vector>
+
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/BlobCache.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/LoggingAnnotator.h"
+#include "libANGLE/MemoryProgramCache.h"
+#include "libANGLE/Version.h"
+#include "platform/Feature.h"
+#include "platform/FrontendFeatures.h"
+
+namespace angle
+{
+class FrameCapture;
+} // namespace angle
+
+namespace gl
+{
+class Context;
+class TextureManager;
+} // namespace gl
+
+namespace rx
+{
+class DisplayImpl;
+}
+
+namespace egl
+{
+class Device;
+class Image;
+class Stream;
+class Surface;
+class Sync;
+class Thread;
+
+using SurfaceSet = std::set<Surface *>;
+
+struct DisplayState final : private angle::NonCopyable
+{
+ DisplayState();
+ ~DisplayState();
+
+ EGLLabelKHR label;
+ SurfaceSet surfaceSet;
+ std::vector<std::string> featureOverridesEnabled;
+ std::vector<std::string> featureOverridesDisabled;
+};
+
+// Constant coded here as a sanity limit.
+constexpr EGLAttrib kProgramCacheSizeAbsoluteMax = 0x4000000;
+
+class Display final : public LabeledObject, angle::NonCopyable
+{
+ public:
+ ~Display() override;
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ Error initialize();
+ Error terminate(const Thread *thread);
+
+ static Display *GetDisplayFromDevice(Device *device, const AttributeMap &attribMap);
+ static Display *GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay,
+ const AttributeMap &attribMap);
+ static Display *GetExistingDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay);
+
+ static const ClientExtensions &GetClientExtensions();
+ static const std::string &GetClientExtensionString();
+
+ std::vector<const Config *> getConfigs(const AttributeMap &attribs) const;
+ std::vector<const Config *> chooseConfig(const AttributeMap &attribs) const;
+
+ Error createWindowSurface(const Config *configuration,
+ EGLNativeWindowType window,
+ const AttributeMap &attribs,
+ Surface **outSurface);
+ Error createPbufferSurface(const Config *configuration,
+ const AttributeMap &attribs,
+ Surface **outSurface);
+ Error createPbufferFromClientBuffer(const Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const AttributeMap &attribs,
+ Surface **outSurface);
+ Error createPixmapSurface(const Config *configuration,
+ NativePixmapType nativePixmap,
+ const AttributeMap &attribs,
+ Surface **outSurface);
+
+ Error createImage(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attribs,
+ Image **outImage);
+
+ Error createStream(const AttributeMap &attribs, Stream **outStream);
+
+ Error createContext(const Config *configuration,
+ const gl::Context *shareContext,
+ const EGLenum clientType,
+ const AttributeMap &attribs,
+ gl::Context **outContext);
+
+ Error createSync(const gl::Context *currentContext,
+ EGLenum type,
+ const AttributeMap &attribs,
+ Sync **outSync);
+
+ Error makeCurrent(const Thread *thread,
+ Surface *drawSurface,
+ Surface *readSurface,
+ gl::Context *context);
+
+ Error destroySurface(Surface *surface);
+ void destroyImage(Image *image);
+ void destroyStream(Stream *stream);
+ Error destroyContext(const Thread *thread, gl::Context *context);
+ void destroySync(Sync *sync);
+
+ bool isInitialized() const;
+ bool isValidConfig(const Config *config) const;
+ bool isValidContext(const gl::Context *context) const;
+ bool isValidSurface(const Surface *surface) const;
+ bool isValidImage(const Image *image) const;
+ bool isValidStream(const Stream *stream) const;
+ bool isValidSync(const Sync *sync) const;
+ bool isValidNativeWindow(EGLNativeWindowType window) const;
+
+ Error validateClientBuffer(const Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const AttributeMap &attribs) const;
+ Error validateImageClientBuffer(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const;
+
+ static bool isValidDisplay(const Display *display);
+ static bool isValidNativeDisplay(EGLNativeDisplayType display);
+ static bool hasExistingWindowSurface(EGLNativeWindowType window);
+
+ bool isDeviceLost() const;
+ bool testDeviceLost();
+ void notifyDeviceLost();
+
+ void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+ bool areBlobCacheFuncsSet() const { return mBlobCache.areBlobCacheFuncsSet(); }
+ BlobCache &getBlobCache() { return mBlobCache; }
+
+ static EGLClientBuffer GetNativeClientBuffer(const struct AHardwareBuffer *buffer);
+
+ Error waitClient(const gl::Context *context);
+ Error waitNative(const gl::Context *context, EGLint engine);
+
+ const Caps &getCaps() const;
+
+ const DisplayExtensions &getExtensions() const;
+ const std::string &getExtensionString() const;
+ const std::string &getVendorString() const;
+
+ EGLint programCacheGetAttrib(EGLenum attrib) const;
+ Error programCacheQuery(EGLint index,
+ void *key,
+ EGLint *keysize,
+ void *binary,
+ EGLint *binarysize);
+ Error programCachePopulate(const void *key,
+ EGLint keysize,
+ const void *binary,
+ EGLint binarysize);
+ EGLint programCacheResize(EGLint limit, EGLenum mode);
+
+ const AttributeMap &getAttributeMap() const { return mAttributeMap; }
+ EGLNativeDisplayType getNativeDisplayId() const { return mDisplayId; }
+
+ rx::DisplayImpl *getImplementation() const { return mImplementation; }
+ Device *getDevice() const;
+ Surface *getWGLSurface() const;
+ EGLenum getPlatform() const { return mPlatform; }
+
+ gl::Version getMaxSupportedESVersion() const;
+
+ const DisplayState &getState() const { return mState; }
+
+ typedef std::set<gl::Context *> ContextSet;
+ const ContextSet &getContextSet() { return mContextSet; }
+
+ const angle::FrontendFeatures &getFrontendFeatures() { return mFrontendFeatures; }
+
+ const angle::FeatureList &getFeatures() const { return mFeatures; }
+
+ const char *queryStringi(const EGLint name, const EGLint index);
+
+ EGLAttrib queryAttrib(const EGLint attribute);
+
+ angle::FrameCapture *getFrameCapture() { return mFrameCapture; }
+ void onPostSwap() const;
+
+ private:
+ Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice);
+
+ void setAttributes(rx::DisplayImpl *impl, const AttributeMap &attribMap);
+
+ Error restoreLostDevice();
+
+ void initDisplayExtensions();
+ void initVendorString();
+ void initializeFrontendFeatures();
+
+ DisplayState mState;
+ rx::DisplayImpl *mImplementation;
+
+ EGLNativeDisplayType mDisplayId;
+ AttributeMap mAttributeMap;
+
+ ConfigSet mConfigSet;
+
+ ContextSet mContextSet;
+
+ typedef std::set<Image *> ImageSet;
+ ImageSet mImageSet;
+
+ typedef std::set<Stream *> StreamSet;
+ StreamSet mStreamSet;
+
+ typedef std::set<Sync *> SyncSet;
+ SyncSet mSyncSet;
+
+ bool mInitialized;
+ bool mDeviceLost;
+
+ Caps mCaps;
+
+ DisplayExtensions mDisplayExtensions;
+ std::string mDisplayExtensionString;
+
+ std::string mVendorString;
+
+ Device *mDevice;
+ Surface *mSurface;
+ EGLenum mPlatform;
+ angle::LoggingAnnotator mAnnotator;
+
+ gl::TextureManager *mTextureManager;
+ BlobCache mBlobCache;
+ gl::MemoryProgramCache mMemoryProgramCache;
+ size_t mGlobalTextureShareGroupUsers;
+
+ angle::FrontendFeatures mFrontendFeatures;
+
+ angle::FeatureList mFeatures;
+
+ // Might want to revisit who owns this and has access in the future. Threaded use would mean
+ // it might make sense to use different captures for EGL and GLES contexts.
+ // Note: we use a raw pointer here so we can exclude frame capture sources from the build.
+ angle::FrameCapture *mFrameCapture;
+};
+
+} // namespace egl
+
+#endif // LIBANGLE_DISPLAY_H_
diff --git a/gfx/angle/checkout/src/libANGLE/EGLSync.cpp b/gfx/angle/checkout/src/libANGLE/EGLSync.cpp
new file mode 100644
index 0000000000..469b6eb4cf
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/EGLSync.cpp
@@ -0,0 +1,76 @@
+//
+// 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.
+//
+
+// EGLSync.cpp: Implements the egl::Sync class.
+
+#include "libANGLE/EGLSync.h"
+
+#include "angle_gl.h"
+
+#include "common/utilities.h"
+#include "libANGLE/renderer/EGLImplFactory.h"
+#include "libANGLE/renderer/EGLSyncImpl.h"
+
+namespace egl
+{
+
+Sync::Sync(rx::EGLImplFactory *factory, EGLenum type, const AttributeMap &attribs)
+ : mFence(factory->createSync(attribs)),
+ mLabel(nullptr),
+ mType(type),
+ mNativeFenceFD(
+ attribs.getAsInt(EGL_SYNC_NATIVE_FENCE_FD_ANDROID, EGL_NO_NATIVE_FENCE_FD_ANDROID))
+{}
+
+void Sync::onDestroy(const Display *display)
+{
+ ASSERT(mFence);
+ mFence->onDestroy(display);
+ mFence.reset();
+}
+
+Sync::~Sync() {}
+
+Error Sync::initialize(const Display *display, const gl::Context *context)
+{
+ return mFence->initialize(display, context, mType);
+}
+
+void Sync::setLabel(EGLLabelKHR label)
+{
+ mLabel = label;
+}
+
+EGLLabelKHR Sync::getLabel() const
+{
+ return mLabel;
+}
+
+Error Sync::clientWait(const Display *display,
+ const gl::Context *context,
+ EGLint flags,
+ EGLTime timeout,
+ EGLint *outResult)
+{
+ return mFence->clientWait(display, context, flags, timeout, outResult);
+}
+
+Error Sync::serverWait(const Display *display, const gl::Context *context, EGLint flags)
+{
+ return mFence->serverWait(display, context, flags);
+}
+
+Error Sync::getStatus(const Display *display, EGLint *outStatus) const
+{
+ return mFence->getStatus(display, outStatus);
+}
+
+Error Sync::dupNativeFenceFD(const Display *display, EGLint *result) const
+{
+ return mFence->dupNativeFenceFD(display, result);
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/EGLSync.h b/gfx/angle/checkout/src/libANGLE/EGLSync.h
new file mode 100644
index 0000000000..683ea374bd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/EGLSync.h
@@ -0,0 +1,70 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// EGLSync.h: Defines the egl::Sync classes, which support the EGL_KHR_fence_sync,
+// EGL_KHR_wait_sync and EGL 1.5 sync objects.
+
+#ifndef LIBANGLE_EGLSYNC_H_
+#define LIBANGLE_EGLSYNC_H_
+
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+
+#include "common/angleutils.h"
+
+namespace rx
+{
+class EGLImplFactory;
+class EGLSyncImpl;
+} // namespace rx
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace egl
+{
+class Sync final : public angle::RefCountObject<Display, angle::Result>, public LabeledObject
+{
+ public:
+ Sync(rx::EGLImplFactory *factory, EGLenum type, const AttributeMap &attribs);
+ ~Sync() override;
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ void onDestroy(const Display *display) override;
+
+ Error initialize(const Display *display, const gl::Context *context);
+ Error clientWait(const Display *display,
+ const gl::Context *context,
+ EGLint flags,
+ EGLTime timeout,
+ EGLint *outResult);
+ Error serverWait(const Display *display, const gl::Context *context, EGLint flags);
+ Error getStatus(const Display *display, EGLint *outStatus) const;
+
+ Error dupNativeFenceFD(const Display *display, EGLint *result) const;
+
+ EGLenum getType() const { return mType; }
+ EGLint getCondition() const { return mCondition; }
+ EGLint getNativeFenceFD() const { return mNativeFenceFD; }
+
+ private:
+ std::unique_ptr<rx::EGLSyncImpl> mFence;
+
+ EGLLabelKHR mLabel;
+
+ EGLenum mType;
+ static constexpr EGLint mCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
+ EGLint mNativeFenceFD;
+};
+
+} // namespace egl
+
+#endif // LIBANGLE_FENCE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Error.cpp b/gfx/angle/checkout/src/libANGLE/Error.cpp
new file mode 100644
index 0000000000..dbd1464f32
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Error.cpp
@@ -0,0 +1,67 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Error.cpp: Implements the egl::Error and gl::Error classes which encapsulate API errors
+// and optional error messages.
+
+#include "libANGLE/Error.h"
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+#include "common/utilities.h"
+
+#include <cstdarg>
+
+namespace
+{
+std::unique_ptr<std::string> EmplaceErrorString(std::string &&message)
+{
+ return message.empty() ? std::unique_ptr<std::string>()
+ : std::unique_ptr<std::string>(new std::string(std::move(message)));
+}
+} // anonymous namespace
+
+namespace egl
+{
+
+Error::Error(EGLint errorCode, std::string &&message)
+ : mCode(errorCode), mID(errorCode), mMessage(EmplaceErrorString(std::move(message)))
+{}
+
+Error::Error(EGLint errorCode, EGLint id, std::string &&message)
+ : mCode(errorCode), mID(id), mMessage(EmplaceErrorString(std::move(message)))
+{}
+
+void Error::createMessageString() const
+{
+ if (!mMessage)
+ {
+ mMessage.reset(new std::string(GetGenericErrorMessage(mCode)));
+ }
+}
+
+const std::string &Error::getMessage() const
+{
+ createMessageString();
+ return *mMessage;
+}
+
+std::ostream &operator<<(std::ostream &os, const Error &err)
+{
+ return gl::FmtHex(os, err.getCode());
+}
+} // namespace egl
+
+namespace angle
+{
+egl::Error ResultToEGL(Result result)
+{
+ if (result == Result::Continue)
+ return egl::NoError();
+
+ return egl::Error(EGL_BAD_ACCESS);
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libANGLE/Error.h b/gfx/angle/checkout/src/libANGLE/Error.h
new file mode 100644
index 0000000000..0c1fdbbda0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Error.h
@@ -0,0 +1,190 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Error.h: Defines the egl::Error and gl::Error classes which encapsulate API errors
+// and optional error messages.
+
+#ifndef LIBANGLE_ERROR_H_
+#define LIBANGLE_ERROR_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "common/debug.h"
+
+#include <memory>
+#include <ostream>
+#include <string>
+
+namespace angle
+{
+template <typename ErrorT, typename ErrorBaseT, ErrorBaseT NoErrorVal, typename CodeT, CodeT EnumT>
+class ErrorStreamBase : angle::NonCopyable
+{
+ public:
+ ErrorStreamBase() : mID(EnumT) {}
+ ErrorStreamBase(GLuint id) : mID(id) {}
+
+ template <typename T>
+ ErrorStreamBase &operator<<(T value)
+ {
+ mErrorStream << value;
+ return *this;
+ }
+
+ operator ErrorT() { return ErrorT(EnumT, mID, mErrorStream.str()); }
+
+ private:
+ GLuint mID;
+ std::ostringstream mErrorStream;
+};
+} // namespace angle
+
+namespace egl
+{
+class Error;
+} // namespace egl
+
+namespace egl
+{
+
+class ANGLE_NO_DISCARD Error final
+{
+ public:
+ explicit inline Error(EGLint errorCode);
+ Error(EGLint errorCode, std::string &&message);
+ Error(EGLint errorCode, EGLint id, std::string &&message);
+ inline Error(const Error &other);
+ inline Error(Error &&other);
+ inline ~Error() = default;
+
+ inline Error &operator=(const Error &other);
+ inline Error &operator=(Error &&other);
+
+ inline EGLint getCode() const;
+ inline EGLint getID() const;
+ inline bool isError() const;
+
+ const std::string &getMessage() const;
+
+ static inline Error NoError();
+
+ private:
+ void createMessageString() const;
+
+ friend std::ostream &operator<<(std::ostream &os, const Error &err);
+
+ EGLint mCode;
+ EGLint mID;
+ mutable std::unique_ptr<std::string> mMessage;
+};
+
+namespace priv
+{
+
+template <EGLint EnumT>
+using ErrorStream = angle::ErrorStreamBase<Error, EGLint, EGL_SUCCESS, EGLint, EnumT>;
+
+} // namespace priv
+
+using EglBadAccess = priv::ErrorStream<EGL_BAD_ACCESS>;
+using EglBadAlloc = priv::ErrorStream<EGL_BAD_ALLOC>;
+using EglBadAttribute = priv::ErrorStream<EGL_BAD_ATTRIBUTE>;
+using EglBadConfig = priv::ErrorStream<EGL_BAD_CONFIG>;
+using EglBadContext = priv::ErrorStream<EGL_BAD_CONTEXT>;
+using EglBadCurrentSurface = priv::ErrorStream<EGL_BAD_CURRENT_SURFACE>;
+using EglBadDevice = priv::ErrorStream<EGL_BAD_DEVICE_EXT>;
+using EglBadDisplay = priv::ErrorStream<EGL_BAD_DISPLAY>;
+using EglBadMatch = priv::ErrorStream<EGL_BAD_MATCH>;
+using EglBadNativeWindow = priv::ErrorStream<EGL_BAD_NATIVE_WINDOW>;
+using EglBadParameter = priv::ErrorStream<EGL_BAD_PARAMETER>;
+using EglBadState = priv::ErrorStream<EGL_BAD_STATE_KHR>;
+using EglBadStream = priv::ErrorStream<EGL_BAD_STREAM_KHR>;
+using EglBadSurface = priv::ErrorStream<EGL_BAD_SURFACE>;
+using EglContextLost = priv::ErrorStream<EGL_CONTEXT_LOST>;
+using EglNotInitialized = priv::ErrorStream<EGL_NOT_INITIALIZED>;
+
+inline Error NoError()
+{
+ return Error::NoError();
+}
+
+} // namespace egl
+
+#define ANGLE_CONCAT1(x, y) x##y
+#define ANGLE_CONCAT2(x, y) ANGLE_CONCAT1(x, y)
+#define ANGLE_LOCAL_VAR ANGLE_CONCAT2(_localVar, __LINE__)
+
+#define ANGLE_TRY_TEMPLATE(EXPR, FUNC) \
+ do \
+ { \
+ auto ANGLE_LOCAL_VAR = EXPR; \
+ if (ANGLE_UNLIKELY(IsError(ANGLE_LOCAL_VAR))) \
+ { \
+ FUNC(ANGLE_LOCAL_VAR); \
+ } \
+ } while (0)
+
+#define ANGLE_RETURN(X) return X;
+#define ANGLE_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_RETURN)
+
+// TODO(jmadill): Remove after EGL error refactor. http://anglebug.com/3041
+#define ANGLE_SWALLOW_ERR(EXPR) \
+ do \
+ { \
+ auto ANGLE_LOCAL_VAR = EXPR; \
+ if (ANGLE_UNLIKELY(IsError(ANGLE_LOCAL_VAR))) \
+ { \
+ ERR() << "Unhandled internal error: " << ANGLE_LOCAL_VAR; \
+ } \
+ } while (0)
+
+#undef ANGLE_LOCAL_VAR
+#undef ANGLE_CONCAT2
+#undef ANGLE_CONCAT1
+
+#define ANGLE_CHECK(CONTEXT, EXPR, MESSAGE, ERROR) \
+ do \
+ { \
+ if (ANGLE_UNLIKELY(!(EXPR))) \
+ { \
+ CONTEXT->handleError(ERROR, MESSAGE, __FILE__, ANGLE_FUNCTION, __LINE__); \
+ return angle::Result::Stop; \
+ } \
+ } while (0)
+
+namespace angle
+{
+// Result signals if calling code should continue running or early exit. A value of Stop can
+// either indicate an Error or a non-Error early exit condition such as a detected no-op.
+// Incomplete signals special cases that are neither success nor failure but require
+// special attention.
+enum class ANGLE_NO_DISCARD Result
+{
+ Continue,
+ Stop,
+ Incomplete,
+};
+
+// TODO(jmadill): Remove this when refactor is complete. http://anglebug.com/3041
+egl::Error ResultToEGL(Result result);
+} // namespace angle
+
+// TODO(jmadill): Remove this when refactor is complete. http://anglebug.com/3041
+inline bool IsError(angle::Result result)
+{
+ return result == angle::Result::Stop;
+}
+
+// TODO(jmadill): Remove this when refactor is complete. http://anglebug.com/3041
+inline bool IsError(const egl::Error &err)
+{
+ return err.isError();
+}
+
+#include "Error.inc"
+
+#endif // LIBANGLE_ERROR_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Error.inc b/gfx/angle/checkout/src/libANGLE/Error.inc
new file mode 100644
index 0000000000..169c401d8c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Error.inc
@@ -0,0 +1,91 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Error.inc: Inline definitions of egl::Error and gl::Error classes which encapsulate API errors
+// and optional error messages.
+
+#include "common/angleutils.h"
+
+#include <cstdarg>
+
+namespace egl
+{
+
+Error::Error(EGLint errorCode)
+ : mCode(errorCode),
+ mID(0)
+{
+}
+
+Error::Error(const Error &other)
+ : mCode(other.mCode),
+ mID(other.mID)
+{
+ if (other.mMessage)
+ {
+ createMessageString();
+ *mMessage = *(other.mMessage);
+ }
+}
+
+Error::Error(Error &&other)
+ : mCode(other.mCode),
+ mID(other.mID),
+ mMessage(std::move(other.mMessage))
+{
+}
+
+Error &Error::operator=(const Error &other)
+{
+ mCode = other.mCode;
+ mID = other.mID;
+
+ if (other.mMessage)
+ {
+ createMessageString();
+ *mMessage = *(other.mMessage);
+ }
+ else
+ {
+ mMessage.release();
+ }
+
+ return *this;
+}
+
+Error &Error::operator=(Error &&other)
+{
+ if (this != &other)
+ {
+ mCode = other.mCode;
+ mID = other.mID;
+ mMessage = std::move(other.mMessage);
+ }
+
+ return *this;
+}
+
+EGLint Error::getCode() const
+{
+ return mCode;
+}
+
+EGLint Error::getID() const
+{
+ return mID;
+}
+
+bool Error::isError() const
+{
+ return (mCode != EGL_SUCCESS);
+}
+
+// Static
+Error Error::NoError()
+{
+ return Error(EGL_SUCCESS);
+}
+
+}
diff --git a/gfx/angle/checkout/src/libANGLE/ErrorStrings.h b/gfx/angle/checkout/src/libANGLE/ErrorStrings.h
new file mode 100644
index 0000000000..5c9a577281
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ErrorStrings.h
@@ -0,0 +1,499 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ErrorStrings.h: Contains mapping of commonly used error messages
+
+#ifndef LIBANGLE_ERRORSTRINGS_H_
+#define LIBANGLE_ERRORSTRINGS_H_
+
+namespace gl
+{
+namespace err
+{
+#define MSG constexpr const char *
+
+// clang-format off
+MSG k3DDepthStencil = "Format cannot be GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL if target is GL_TEXTURE_3D";
+MSG kANGLECopyTexture3DUnavailable = "GL_ANGLE_copy_texture_3d extension not available.";
+MSG kAtomicCounterResourceName = "Active atomic counter resources are not assigned name strings.";
+MSG kAttributeZeroRequiresDivisorLimitation = "The current context doesn't support setting a non-zero divisor on the attribute with index zero. Please reorder the attributes in your vertex shader so that attribute zero can have a zero divisor.";
+MSG kBaseLevelNegative = "Base level must be at least 0.";
+MSG kBaseLevelNonZero = "Base level must be 0.";
+MSG kBaseLevelOutOfRange = "Texture base level out of range";
+MSG kBlitDepthOrStencilFormatMismatch = "Depth/stencil buffer format combination not allowed for blit.";
+MSG kBlitDimensionsOutOfRange = "BlitFramebuffer dimensions out of 32-bit integer range.";
+MSG kBlitExtensionDepthStencilWholeBufferBlit = "Only whole-buffer depth and stencil blits are supported by this extension.";
+MSG kBlitExtensionFormatMismatch = "Attempting to blit and the read and draw buffer formats don't match.";
+MSG kBlitExtensionFromInvalidAttachmentType = "Blits are only supported from 2D texture = renderbuffer or default framebuffer attachments in this extension.";
+MSG kBlitExtensionLinear = "Linear blit not supported in this extension.";
+MSG kBlitExtensionMultisampledDepthOrStencil = "Multisampled depth/stencil blit is not supported by this extension.";
+MSG kBlitExtensionMultisampledWholeBufferBlit = "Only whole-buffer blit is supported from a multisampled read buffer in this extension.";
+MSG kBlitExtensionNotAvailable = "Blit extension not available.";
+MSG kBlitExtensionScaleOrFlip = "Scaling and flipping in BlitFramebufferANGLE not supported by this implementation.";
+MSG kBlitExtensionToInvalidAttachmentType = "Blits are only supported to 2D texture = renderbuffer or default framebuffer attachments in this extension.";
+MSG kBlitFeedbackLoop = "Blit feedback loop: the read and draw framebuffers are the same.";
+MSG kBlitFramebufferMissing = "Read and draw framebuffers must both exist for a blit to succeed.";
+MSG kBlitFromMultiview = "Attempt to read from a multi-view framebuffer.";
+MSG kBlitIntegerWithLinearFilter = "Cannot use GL_LINEAR filter when blitting a integer framebuffer.";
+MSG kBlitInvalidFilter = "Invalid blit filter.";
+MSG kBlitInvalidMask = "Invalid blit mask.";
+MSG kBlitMissingColor = "Attempt to read from a missing color attachment of a complete framebuffer.";
+MSG kBlitMissingDepthOrStencil = "Attempt to read from a missing depth/stencil attachment of a complete framebuffer.";
+MSG kBlitMultisampledBoundsMismatch = "Attempt to blit from a multisampled framebuffer and the bounds don't match with the draw framebuffer.";
+MSG kBlitMultisampledFormatOrBoundsMismatch = "Attempt to blit from a multisampled framebuffer and the bounds or format of the color buffer don't match with the draw framebuffer.";
+MSG kBlitOnlyNearestForNonColor = "Only nearest filtering can be used when blitting buffers other than the color buffer.";
+MSG kBlitSameImageColor = "Read and write color attachments cannot be the same image.";
+MSG kBlitSameImageDepthOrStencil = "Read and write depth stencil attachments cannot be the same image.";
+MSG kBlitToMultiview = "Attempt to write to a multi-view framebuffer.";
+MSG kBlitTypeMismatchFixedOrFloat = "If the read buffer contains fixed-point or floating-point values = the draw buffer must as well.";
+MSG kBlitTypeMismatchFixedPoint = "If the read buffer contains fixed-point values = the draw buffer must as well.";
+MSG kBlitTypeMismatchSignedInteger = "If the read buffer contains signed integer values the draw buffer must as well.";
+MSG kBlitTypeMismatchUnsignedInteger = "If the read buffer contains unsigned integer values the draw buffer must as well.";
+MSG kBufferAlreadyMapped = "Buffer is already mapped.";
+MSG kBufferBoundForTransformFeedback = "Buffer is bound for transform feedback.";
+MSG kBufferMapped = "An active buffer is mapped";
+MSG kBufferNotBound = "A buffer must be bound.";
+MSG kBufferNotMappable = "Attempted to map buffer object zero.";
+MSG kBufferNotMapped = "Buffer is not mapped.";
+MSG kBufferOffsetOverflow = "Buffer offset overflow.";
+MSG kBufferPointerNotAvailable = "Can not get pointer for reserved buffer name zero.";
+MSG kCannotPopDefaultDebugGroup = "Cannot pop the default debug group.";
+MSG kClientDataInVertexArray = "Client data cannot be used with a non-default vertex array object.";
+MSG kColorNumberGreaterThanMaxDrawBuffers = "Color number for primary color greater than or equal to MAX_DRAW_BUFFERS";
+MSG kColorNumberGreaterThanMaxDualSourceDrawBuffers = "Color number for secondary color greater than or equal to MAX_DUAL_SOURCE_DRAW_BUFFERS";
+MSG kCompressedDataSizeTooSmall = "dataSize is too small";
+MSG kCompressedMismatch = "Compressed data is valid if-and-only-if the texture is compressed.";
+MSG kCompressedTextureDimensionsMustMatchData = "Compressed texture dimensions must exactly match the dimensions of the data passed in.";
+MSG kCompressedTexturesNotAttachable = "Compressed textures cannot be attached to a framebuffer.";
+MSG kConstantColorAlphaLimitation = "Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR not supported by this implementation.";
+MSG kContextLost = "Context has been lost.";
+MSG kCopyAlias = "The read and write copy regions alias memory.";
+MSG kCubemapFacesEqualDimensions = "Each cubemap face must have equal width and height.";
+MSG kCubemapIncomplete = "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size.";
+MSG kDataTypeNotAligned = "Data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type.";
+MSG kDefaultFramebuffer = "Default framebuffer is bound.";
+MSG kDefaultFramebufferInvalidAttachment = "Invalid attachment when the default framebuffer is bound.";
+MSG kDefaultFramebufferInvalidDrawBuffer = "Only NONE or BACK are valid draw buffers for the default framebuffer";
+MSG kDefaultFramebufferTarget = "It is invalid to change default FBO's attachments";
+MSG kDefaultVertexArray = "Default vertex array object is bound.";
+MSG kDestinationImmutable = "Destination texture cannot be immutable.";
+MSG kDestinationLevelNotDefined = "The destination level of the destination texture must be defined.";
+MSG kDestinationTextureTooSmall = "Destination texture too small.";
+MSG kDimensionsMustBePow2 = "Texture dimensions must be power-of-two.";
+MSG kDispatchIndirectBufferNotBound = "Dispatch indirect buffer must be bound.";
+MSG kDrawBufferMaskMismatch = "Active draw buffers with missing fragment shader outputs.";
+MSG kDrawBufferTypeMismatch = "Fragment shader output type does not match the bound framebuffer attachment type.";
+MSG kDrawFramebufferIncomplete = "Draw framebuffer is incomplete";
+MSG kDrawIndirectBufferNotBound = "Draw indirect buffer must be bound.";
+MSG kEGLImageCannotCreate2DMultisampled = "Cannot create a 2D texture from a multisampled EGL image.";
+MSG kEGLImageRenderbufferFormatNotSupported = "EGL image internal format is not supported as a renderbuffer.";
+MSG kEGLImageTextureFormatNotSupported = "EGL image internal format is not supported as a texture.";
+MSG kElementArrayBufferBoundForTransformFeedback = "It is undefined behavior to use an element array buffer that is bound for transform feedback.";
+MSG kElementArrayNoBufferOrPointer = "No element array buffer and no pointer.";
+MSG kEnumNotSupported = "Enum is not currently supported.";
+MSG kEnumRequiresGLES30 = "Enum requires GLES 3.0";
+MSG kEnumRequiresGLES31 = "Enum requires GLES 3.1";
+MSG kES31Required = "OpenGL ES 3.1 Required";
+MSG kES3Required = "OpenGL ES 3.0 Required.";
+MSG kExceedsComputeWorkGroupCountX = "num_groups_x cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[0]";
+MSG kExceedsComputeWorkGroupCountY = "num_groups_y cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[1]";
+MSG kExceedsComputeWorkGroupCountZ = "num_groups_z cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[2]";
+MSG kExceedsElementRange = "Element value exceeds element range.";
+MSG kExceedsFramebufferHeight = "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_HEIGHT.";
+MSG kExceedsFramebufferSamples = "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_SAMPLES.";
+MSG kExceedsFramebufferWidth = "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_WIDTH.";
+MSG kExceedsMaxColorAttachments = "Index is greater than the maximum supported color attachments";
+MSG kExceedsMaxDebugGroupStackDepth = "Cannot push more than GL_MAX_DEBUG_GROUP_STACK_DEPTH debug groups.";
+MSG kExceedsMaxDebugMessageLength = "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.";
+MSG kExceedsMaxDrawBuffers = "Draw buffer greater than MAX_DRAW_BUFFERS.";
+MSG kExceedsMaxElement = "Element value exceeds maximum element index.";
+MSG kExceedsMaxImageUnits = "Index must be within [0, MAX_IMAGE_UNITS).";
+MSG kExceedsMaxLabelLength = "Label length is larger than GL_MAX_LABEL_LENGTH.";
+MSG kExceedsMaxShaderStorageBufferBindings = "Index must be within [0, MAX_SHADER_STORAGE_BUFFER_BINDINGS).";
+MSG kExceedsMaxVertexAttribBindings = "Index must be within [0, MAX_VERTEX_ATTRIB_BINDINGS).";
+MSG kExceedsMaxVertexAttribStride = "Stride must be within [0, MAX_VERTEX_ATTRIB_STRIDE).";
+MSG kExceedsNumExtensions = "Index must be within [0, NUM_EXTENSIONS).";
+MSG kExceedsNumRequestableExtensions = "Index must be within [0, NUM_REQUESTABLE_EXTENSIONS_ANGLE).";
+MSG kExpectedProgramName = "Expected a program name = but found a shader name.";
+MSG kExpectedShaderName = "Expected a shader name = but found a program name.";
+MSG kExtensionNotEnabled = "Extension is not enabled.";
+MSG kExtensionNotRequestable = "Extension is not requestable.";
+MSG kExternalTextureNotSupported = "External texture extension not enabled";
+MSG kFeedbackLoop = "Feedback loop formed between Framebuffer and active Texture.";
+MSG kFixedNotInWebGL = "GL_FIXED is not supported in WebGL.";
+MSG kFormatNotRenderable = "Internal format is not renderable.";
+MSG kFragDataBindingIndexOutOfRange = "Fragment output color index must be zero or one.";
+MSG kFragmentInputTypeNotFloatingPoint = "Fragment input type is not a floating point scalar or vector.";
+MSG kFramebufferIncomplete = "Framebuffer is incomplete.";
+MSG kFramebufferIncompleteAttachment = "Attachment type must be compatible with attachment object.";
+MSG kFramebufferTextureInvalidLayer = "Layer invalid for framebuffer texture attachment.";
+MSG kFramebufferTextureInvalidMipLevel = "Mip level invalid for framebuffer texture attachment.";
+MSG kFramebufferTextureLayerIncorrectTextureType = "Texture is not a three-dimensional or two-dimensionsal array texture.";
+MSG kGenerateMipmapNotAllowed = "Texture format does not support mipmap generation.";
+MSG kGenerateMipmapZeroSize = "Cannot generate mipmaps for a zero-size texture in a WebGL context.";
+MSG kGeometryShaderExtensionNotEnabled = "GL_EXT_geometry_shader extension not enabled.";
+MSG kGLES1Only = "GLES1-only function.";
+MSG kImageSizeMustBeZero = "imageSize must be 0 if no texture data is provided.";
+MSG kImageSizeTooSmall = "imageSize is too small.";
+MSG kImmutableTextureBound = "The value of TEXTURE_IMMUTABLE_FORMAT for the texture currently bound to target on the active texture unit is true.";
+MSG kIncompatibleDrawModeAgainstGeometryShader = "Primitive mode is incompatible with the input primitive type of the geometry shader.";
+MSG kIndexExceedsActiveUniformBlockCount = "Index exceeds active uniform block count.";
+MSG kIndexExceedsMaxActiveUniform = "Index must be less than program active uniform count.";
+MSG kIndexExceedsMaxActiveUniformBlock = "Index must be less than program active uniform block count.";
+MSG kIndexExceedsMaxAtomicCounterBufferBindings = "Index must be less than MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.";
+MSG kIndexExceedsMaxDrawBuffer = "Index must be less than MAX_DRAW_BUFFERS.";
+MSG kIndexExceedsMaxTransformFeedbackAttribs = "Index must be less than MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.";
+MSG kIndexExceedsMaxUniformBufferBindings = "Index must be less than MAX_UNIFORM_BUFFER_BINDINGS.";
+MSG kIndexExceedsMaxVertexAttribute = "Index must be less than MAX_VERTEX_ATTRIBS.";
+MSG kIndexExceedsMaxWorkgroupDimensions = "Index must be less than the number of workgroup dimensions (3).";
+MSG kIndexExceedsSamples = "Index must be less than the value of SAMPLES.";
+MSG kIndexExceedsTransformFeedbackBufferBindings = "Index is greater than or equal to the number of TRANSFORM_FEEDBACK_BUFFER indexed binding points.";
+MSG kInsufficientBufferSize = "Insufficient buffer size.";
+MSG kInsufficientParams = "More parameters are required than were provided.";
+MSG kInsufficientVertexBufferSize = "Vertex buffer is not big enough for the draw call";
+MSG kIntegerOverflow = "Integer overflow.";
+MSG kInternalFormatRequiresTexture2DArray = "internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY.";
+MSG kInvalidAccessBits = "Invalid access bits.";
+MSG kInvalidAccessBitsFlush = "The explicit flushing bit may only be set if the buffer is mapped for writing.";
+MSG kInvalidAccessBitsRead = "Invalid access bits when mapping buffer for reading";
+MSG kInvalidAccessBitsReadWrite = "Need to map buffer for either reading or writing.";
+MSG kInvalidAttachment = "Invalid Attachment Type.";
+MSG kInvalidBindBufferSize = "Invalid buffer binding size.";
+MSG kInvalidBindUniformLocation = "Location must be less than (MAX_VERTEX_UNIFORM_VECTORS + MAX_FRAGMENT_UNIFORM_VECTORS) * 4";
+MSG kInvalidBlendEquation = "Invalid blend equation.";
+MSG kInvalidBlendFunction = "Invalid blend function.";
+MSG kInvalidBooleanValue = "Invalid boolean value. Must be GL_FALSE or GL_TRUE.";
+MSG kInvalidBorder = "Border must be 0.";
+MSG kInvalidBufferName = "name is not a valid buffer.";
+MSG kInvalidBufferTypes = "Invalid buffer target.";
+MSG kInvalidBufferUsage = "Invalid buffer usage enum.";
+MSG kInvalidClearMask = "Invalid mask bits.";
+MSG kInvalidClientState = "Invalid client vertex array type.";
+MSG kInvalidClipPlane = "Invalid clip plane.";
+MSG kInvalidCombinedImageUnit = "Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_COMBINED_IMAGE_UNITS)";
+MSG kInvalidComponents = "Invalid components.";
+MSG kInvalidCompressedFormat = "Not a valid compressed texture format.";
+MSG kInvalidCompressedImageSize = "Invalid compressed image size.";
+MSG kInvalidConstantColor = "CONSTANT_COLOR (or ONE_MINUS_CONSTANT_COLOR) and CONSTANT_ALPHA (or ONE_MINUS_CONSTANT_ALPHA) cannot be used together as source and destination factors in the blend function.";
+MSG kInvalidCopyCombination = "Invalid copy texture format combination.";
+MSG kInvalidCoverageComponents = "components is not one of GL_RGB, GL_RGBA, GL_ALPHA or GL_NONE.";
+MSG kInvalidCoverMode = "Invalid cover mode.";
+MSG kInvalidCullMode = "Cull mode not recognized.";
+MSG kInvalidDebugSeverity = "Invalid debug severity.";
+MSG kInvalidDebugSource = "Invalid debug source.";
+MSG kInvalidDebugSourceType = "If count is greater than zero, source and type cannot be GL_DONT_CARE.";
+MSG kInvalidDebugType = "Invalid debug type.";
+MSG kInvalidDefaultReadBuffer = "Read buffer must be GL_NONE or GL_BACK when reading from the default framebuffer.";
+MSG kInvalidDepthRange = "Near value cannot be greater than far.";
+MSG kInvalidDepthStencilDrawBuffer = "Draw buffer must be zero when using depth or stencil.";
+MSG kInvalidDestinationTexture = "Destination texture is not a valid texture object.";
+MSG kInvalidDestinationTextureType = "Invalid destination texture type.";
+MSG kInvalidDrawBuffer = "Invalid draw buffer.";
+MSG kInvalidDrawBufferCountForDefault = "The default framebuffer must have exactly one draw buffer.";
+MSG kInvalidDrawBufferValue = "Ith value does not match COLOR_ATTACHMENTi or NONE.";
+MSG kInvalidDrawMode = "Invalid draw mode.";
+MSG kInvalidDrawModeTransformFeedback = "Draw mode must match current transform feedback object's draw mode.";
+MSG kInvalidEGLImage = "EGL image is not valid.";
+MSG kInvalidElementRange = "Invalid element range.";
+MSG kInvalidFence = "Invalid fence object.";
+MSG kInvalidFenceCondition = "Invalid value for condition.";
+MSG kInvalidFenceState = "Fence must be set.";
+MSG kInvalidFillMode = "Invalid fill mode.";
+MSG kInvalidFilterTexture = "Texture only supports NEAREST and LINEAR filtering.";
+MSG kInvalidFlags = "Invalid value for flags.";
+MSG kInvalidFlushOutOfRange = "Flushed range does not fit into buffer mapping dimensions.";
+MSG kInvalidFlushTarget = "Attempted to flush a buffer not mapped for explicit flushing.";
+MSG kInvalidFlushZero = "Attempted to flush buffer object zero.";
+MSG kInvalidFogDensity = "Invalid fog density (must be nonnegative).";
+MSG kInvalidFogMode = "Invalid fog mode.";
+MSG kInvalidFogParameter = "Invalid fog parameter.";
+MSG kInvalidFormat = "Invalid format.";
+MSG kInvalidFormatCombination = "Invalid combination of format = type and internalFormat.";
+MSG kInvalidFragmentInputBinding = "No such binding.";
+MSG kInvalidFramebufferAttachmentParameter = "Invalid parameter name for framebuffer attachment.";
+MSG kInvalidFramebufferLayer = "Framebuffer layer cannot be less than 0 or greater than GL_MAX_FRAMEBUFFER_LAYERS_EXT.";
+MSG kInvalidFramebufferName = "name is not a valid framebuffer.";
+MSG kInvalidFramebufferTarget = "Invalid framebuffer target.";
+MSG kInvalidFramebufferTextureLevel = "Mipmap level must be 0 when attaching a texture.";
+MSG kInvalidHandleType = "Invalid handle type.";
+MSG kInvalidImageAccess = "access is not one of the supported tokens.";
+MSG kInvalidImageLayout = "Invalid image layout.";
+MSG kInvalidImageFormat = "format is not one of supported image unit formats.";
+MSG kInvalidIndentifier = "Invalid identifier.";
+MSG kInvalidIndirectOffset = "indirect must be a multiple of the size of uint in basic machine units.";
+MSG kInvalidInternalFormat = "Invalid internal format.";
+MSG kInvalidLight = "Invalid light.";
+MSG kInvalidLightModelParameter = "Invalid light model parameter.";
+MSG kInvalidLightParameter = "Invalid light parameter.";
+MSG kInvalidLogicOp = "Invalid logical operation.";
+MSG kInvalidMapPointerQuery = "GL_BUFFER_MAP_POINTER can only be queried with GetBufferPointerv.";
+MSG kInvalidMaterialFace = "Invalid material face.";
+MSG kInvalidMaterialParameter = "Invalid material parameter.";
+MSG kInvalidMatrixMode = "Invalid matrix mode.";
+MSG kInvalidMemoryBarrierBit = "Invalid memory barrier bit.";
+MSG kInvalidMipLevel = "Level of detail outside of range.";
+MSG kInvalidMipLevels = "Invalid level count.";
+MSG kInvalidMultisampledFramebufferOperation = "Invalid operation on multisampled framebuffer";
+MSG kInvalidMultitextureUnit = "Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)";
+MSG kInvalidName = "Invalid name.";
+MSG kInvalidNameCharacters = "Name contains invalid characters.";
+MSG kInvalidPathCoefficientsArray = "No coefficients array given.";
+MSG kInvalidPathCommand = "Invalid command.";
+MSG kInvalidPathCommandsArray = "No commands array given.";
+MSG kInvalidPathComponents = "Unexpected number of components";
+MSG kInvalidPathCoordinateType = "Invalid coordinate type.";
+MSG kInvalidPathEndCaps = "Invalid end caps.";
+MSG kInvalidPathGenMode = "Invalid gen mode.";
+MSG kInvalidPathJoinStyle = "Invalid join style.";
+MSG kInvalidPathMatrix = "Invalid matrix.";
+MSG kInvalidPathMiterLimit = "Invalid miter limit.";
+MSG kInvalidPathNameArray = "No path name array.";
+MSG kInvalidPathNameType = "Invalid path name type.";
+MSG kInvalidPathNumCommands = "Invalid number of commands.";
+MSG kInvalidPathNumCoords = "Invalid number of coordinates.";
+MSG kInvalidPathNumCoordsArray = "No coordinate array given.";
+MSG kInvalidPathNumPaths = "Invalid (negative) numPaths.";
+MSG kInvalidPathParameter = "Invalid path parameter.";
+MSG kInvalidPathStrokeWidth = "Invalid stroke width.";
+MSG kInvalidPathValueArray = "No value array.";
+MSG kInvalidPname = "Invalid pname.";
+MSG kInvalidPointerQuery = "Invalid pointer query.";
+MSG kInvalidPointParameter = "Invalid point parameter.";
+MSG kInvalidPointParameterValue = "Invalid point parameter value (must be non-negative).";
+MSG kInvalidPointSizeValue = "Invalid point size (must be positive).";
+MSG kInvalidPrecision = "Invalid or unsupported precision type.";
+MSG kInvalidPrimitiveMode = "Invalid primitive mode.";
+MSG kInvalidProgramBinaryFormat = "Program binary format is not valid.";
+MSG kInvalidProgramInterface = "Invalid program interface.";
+MSG kInvalidProgramName = "Program object expected.";
+MSG kInvalidProgramResourceIndex = "Invalid program resource index.";
+MSG kInvalidProgramResourceProperty = "Invalid program resource property.";
+MSG kInvalidProjectionMatrix = "Invalid projection matrix. Left/right = top/bottom = near/far intervals cannot be zero = and near/far cannot be less than zero.";
+MSG kInvalidPropCount = "Invalid propCount.";
+MSG kInvalidPropertyForProgramInterface = "Not an allowed program resource property for this program interface";
+MSG kInvalidProvokingVertex = "Invalid provoking vertex.";
+MSG kInvalidQueryId = "Invalid query Id.";
+MSG kInvalidQueryName = "name is not a valid query.";
+MSG kInvalidQueryTarget = "Invalid query target.";
+MSG kInvalidQueryType = "Invalid query type.";
+MSG kInvalidRange = "Invalid range.";
+MSG kInvalidReadBuffer = "Invalid read buffer";
+MSG kInvalidRenderbufferInternalFormat = "Invalid renderbuffer internalformat.";
+MSG kInvalidRenderbufferName = "name is not a valid renderbuffer.";
+MSG kInvalidRenderbufferTarget = "Invalid renderbuffer target.";
+MSG kInvalidRenderbufferTextureParameter = "Invalid parameter name for renderbuffer attachment.";
+MSG kInvalidRenderbufferWidthHeight = "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size.";
+MSG kInvalidResetStatus = "Reset status is not valid";
+MSG kInvalidSampleMaskNumber = "MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS.";
+MSG kInvalidSampler = "Sampler is not valid";
+MSG kInvalidSamplerName = "name is not a valid sampler.";
+MSG kInvalidShaderBinaryFormat = "Invalid shader binary format.";
+MSG kInvalidShaderName = "Shader object expected.";
+MSG kInvalidShaderType = "Invalid shader type.";
+MSG kInvalidShadingModel = "Invalid shading model.";
+MSG kInvalidSourceTexture = "Source texture is not a valid texture object.";
+MSG kInvalidSourceTextureInternalFormat = "Source texture internal format is invalid.";
+MSG kInvalidSourceTextureLevel = "Invalid source texture level.";
+MSG kInvalidSourceTextureSize = "Invalid source texture height or width.";
+MSG kInvalidSourceTextureType = "Source texture must be a valid texture type.";
+MSG kInvalidStencil = "Invalid stencil.";
+MSG kInvalidStencilBitMask = "Invalid stencil bit mask.";
+MSG kInvalidSyncPointer = "Not a valid sync pointer.";
+MSG kInvalidTarget = "Invalid target.";
+MSG kInvalidTextureCombine = "Invalid texture combine mode.";
+MSG kInvalidTextureCombineOp = "Invalid texture combine operand.";
+MSG kInvalidTextureCombineSrc = "Invalid texture combine source.";
+MSG kInvalidTextureEnvMode = "Invalid texture environment mode.";
+MSG kInvalidTextureEnvParameter = "Invalid texture environment parameter.";
+MSG kInvalidTextureEnvScale = "Invalid texture environment scale.";
+MSG kInvalidTextureEnvTarget = "Invalid texture environment target.";
+MSG kInvalidTextureFilterParam = "Texture filter not recognized.";
+MSG kInvalidTextureLevel = "Texture level does not exist.";
+MSG kInvalidTextureName = "Not a valid texture object name.";
+MSG kInvalidTextureRange = "Cannot be less than 0 or greater than maximum number of textures.";
+MSG kInvalidTextureTarget = "Invalid or unsupported texture target.";
+MSG kInvalidTextureType = "Texture has incompatible target.";
+MSG kInvalidTextureWrap = "Texture wrap mode not recognized.";
+MSG kInvalidTimeout = "Invalid value for timeout.";
+MSG kInvalidTransformation = "Invalid transformation.";
+MSG kInvalidTransformFeedbackAttribsCount = "Count exceeds MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.";
+MSG kInvalidTransformFeedbackName = "name is not a valid transform feedback.";
+MSG kInvalidType = "Invalid type.";
+MSG kInvalidUniformCount = "Only array uniforms may have count > 1.";
+MSG kInvalidUniformLocation = "Invalid uniform location";
+MSG kInvalidUnpackAlignment = "Unpack alignment must be 1 = 2 = 4 = or 8.";
+MSG kInvalidVaryingLocation = "Location exceeds max varying.";
+MSG kInvalidVertexArray = "Vertex array does not exist.";
+MSG kInvalidVertexArrayName = "name is not a valid vertex array.";
+MSG kInvalidVertexAttribSize2101010 = "Type is INT_2_10_10_10_REV or UNSIGNED_INT_2_10_10_10_REV and size is not 4.";
+MSG kInvalidVertexAttrSize = "Vertex attribute size must be 1 = 2 = 3 = or 4.";
+MSG kInvalidVertexPointerSize = "Size for built-in vertex attribute is outside allowed range.";
+MSG kInvalidVertexPointerStride = "Invalid stride for built-in vertex attribute.";
+MSG kInvalidVertexPointerType = "Invalid type for built-in vertex attribute.";
+MSG kInvalidWidth = "Invalid width.";
+MSG kInvalidWrapModeTexture = "Invalid wrap mode for texture type.";
+MSG kLengthZero = "Length must not be zero.";
+MSG kLevelNotZero = "Texture level must be zero.";
+MSG kLightParameterOutOfRange = "Light parameter out of range.";
+MSG kMapOutOfRange = "Mapped range does not fit into buffer dimensions.";
+MSG kMaterialParameterOutOfRange = "Material parameter out of range.";
+MSG kMatrixStackOverflow = "Current matrix stack is full.";
+MSG kMatrixStackUnderflow = "Current matrix stack has only a single matrix.";
+MSG kMaxActiveVariablesInterface = "MAX_NUM_ACTIVE_VARIABLES requires a buffer or block interface.";
+MSG kMismatchedFormat = "Format must match internal format.";
+MSG kMismatchedTargetAndFormat = "Invalid texture target and format combination.";
+MSG kMismatchedTypeAndFormat = "Invalid format and type combination.";
+MSG kMismatchedVariableProgram = "Variable is not part of the current program.";
+MSG kMissingName = "No name given.";
+MSG kMissingReadAttachment = "Missing read attachment.";
+MSG kMissingTexture = "No Texture is bound to the specified target.";
+MSG kMissingTextureName = "texture is not the name of an existing texture object.";
+MSG kMultisampleArrayExtensionRequired = "GL_ANGLE_texture_multisample_array not enabled.";
+MSG kMultisampleTextureExtensionOrES31Required = "GL_ANGLE_texture_multisample or GLES 3.1 required.";
+MSG kMultiviewActive = "The number of views in the active draw framebuffer is greater than 1.";
+MSG kMultiviewMismatch = "The number of views in the active program and draw framebuffer does not match.";
+MSG kMultiviewNotAvailable = "ANGLE_multiview is not available.";
+MSG kMultiviewReadFramebuffer = "The active read framebuffer object has multiview attachments.";
+MSG kMultiviewTimerQuery = "There is an active query for target GL_TIME_ELAPSED_EXT when the number of views in the active draw framebuffer is greater than 1.";
+MSG kMultiviewTransformFeedback = "There is an active transform feedback object when the number of views in the active draw framebuffer is greater than 1.";
+MSG kMultiviewViewsTooLarge = "numViews cannot be greater than GL_MAX_VIEWS_ANGLE.";
+MSG kMultiviewViewsTooSmall = "numViews cannot be less than 1.";
+MSG kMustHaveElementArrayBinding = "Must have element array buffer bound.";
+MSG kNameBeginsWithGL = "Attributes that begin with 'gl_' are not allowed.";
+MSG kNegativeAttachments = "Negative number of attachments.";
+MSG kNegativeBaseViewIndex = "Negative baseViewIndex.";
+MSG kNegativeBufferSize = "Negative buffer size.";
+MSG kNegativeBufSize = "Invalid bufSize.";
+MSG kNegativeCount = "Negative count.";
+MSG kNegativeHeightWidthDepth = "Cannot have negative height = width = or depth.";
+MSG kNegativeLayer = "Negative layer.";
+MSG kNegativeLength = "Negative length.";
+MSG kNegativeLevel = "Level is negative.";
+MSG kNegativeLocation = "Location cannot be less than 0.";
+MSG kNegativeMaxCount = "Negative maxcount.";
+MSG kNegativeOffset = "Negative offset.";
+MSG kNegativeParam = "param is negative.";
+MSG kNegativePrimcount = "Primcount must be greater than or equal to zero.";
+MSG kNegativeSize = "Negative size.";
+MSG kNegativeStart = "Cannot have negative start.";
+MSG kNegativeStride = "Cannot have negative stride.";
+MSG kNegativeXYZ = "x = y = or z cannot be negative.";
+MSG kNoActiveComputeShaderStage = "No active compute shader stage in this program.";
+MSG kNoActiveGeometryShaderStage = "No active geometry shader stage in this program.";
+MSG kNoActiveGraphicsShaderStage = "It is a undefined behaviour to render without vertex shader stage or fragment shader stage.";
+MSG kNoActiveProgramWithComputeShader = "No active program for the compute shader stage.";
+MSG kNoDefinedClearConversion = "No defined conversion between clear value and attachment format.";
+MSG kNonPositiveDrawTextureDimension = "Both width and height argument of drawn texture must be positive.";
+MSG kNoPathOrNoPathData = "No such path or path has no data.";
+MSG kNoProgramBinaryFormats = "No program binary formats supported.";
+MSG kNoReadFramebuffer = "No active read framebuffer.";
+MSG kNoSampleAlphaToCoveragesLimitation = "Current renderer doesn't support alpha-to-coverage.";
+MSG kNoSuchPath = "No such path object.";
+MSG kNoTransformArray = "No transform array given.";
+MSG kNoTransformFeedbackOutputVariables = "The active program has specified no output variables to record.";
+MSG kNoZeroDivisor = "At least one enabled attribute must have a divisor of zero.";
+MSG kNVFenceNotSupported = "GL_NV_fence is not supported";
+MSG kObjectNotGenerated = "Object cannot be used because it has not been generated.";
+MSG kOffsetAlignment = "offset must be a multiple of 4.";
+MSG kOffsetAndSizeAlignment = "Offset and size must be multiple of 4.";
+MSG kOffsetMustBeMultipleOfType = "Offset must be a multiple of the passed in datatype.";
+MSG kOffsetMustBeMultipleOfUint = "Offset must be a multiple of the size = in basic machine units = of uint";
+MSG kOffsetOverflow = "Offset overflows texture dimensions.";
+MSG kOtherQueryActive = "Other query is active.";
+MSG kOutsideOfBounds = "Parameter outside of bounds.";
+MSG kParamOverflow = "The provided parameters overflow with the provided buffer.";
+MSG kPixelDataNotNull = "Pixel data must be null.";
+MSG kPixelDataNull = "Pixel data cannot be null.";
+MSG kPixelPackBufferBoundForTransformFeedback = "It is undefined behavior to use a pixel pack buffer that is bound for transform feedback.";
+MSG kPixelUnpackBufferBoundForTransformFeedback = "It is undefined behavior to use a pixel unpack buffer that is bound for transform feedback.";
+MSG kPointSizeArrayExtensionNotEnabled = "GL_OES_point_size_array not enabled.";
+MSG kProgramDoesNotExist = "Program doesn't exist.";
+MSG kProgramInterfaceMustBeProgramOutput = "programInterface must be set to GL_PROGRAM_OUTPUT.";
+MSG kProgramNotBound = "A program must be bound.";
+MSG kProgramNotLinked = "Program not linked.";
+MSG kQueryActive = "Query is active.";
+MSG kQueryExtensionNotEnabled = "Query extension not enabled.";
+MSG kQueryInactive = "Query is not active.";
+MSG kQueryTargetMismatch = "Query type does not match target.";
+MSG kReadBufferNone = "Read buffer is GL_NONE.";
+MSG kReadBufferNotAttached = "Read buffer has no attachment.";
+MSG kRectangleTextureCompressed = "Rectangle texture cannot have a compressed format.";
+MSG kRelativeOffsetTooLarge = "relativeOffset cannot be greater than MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.";
+MSG kRenderableInternalFormat = "SizedInternalformat must be color-renderable = depth-renderable = or stencil-renderable.";
+MSG kRenderbufferNotBound = "A renderbuffer must be bound.";
+MSG kResourceMaxRenderbufferSize = "Desired resource size is greater than max renderbuffer size.";
+MSG kResourceMaxTextureSize = "Desired resource size is greater than max texture size.";
+MSG kSamplerFormatMismatch = "Mismatch between texture format and sampler type (signed/unsigned/float/shadow).";
+MSG kSamplerUniformValueOutOfRange = "Sampler uniform value out of range.";
+MSG kSamplesOutOfRange = "Samples must not be greater than maximum supported value for the format.";
+MSG kSamplesZero = "Samples may not be zero.";
+MSG kShaderAttachmentHasShader = "Shader attachment already has a shader.";
+MSG kShaderSourceInvalidCharacters = "Shader source contains invalid characters.";
+MSG kShaderStorageBufferOffsetAlignment = "Offset must be multiple of value of SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT.";
+MSG kShaderToDetachMustBeAttached = "Shader to be detached must be currently attached to the program.";
+MSG kSourceLevelNotDefined = "The source level of the source texture must be defined.";
+MSG kSourceTextureLevelZeroDefined = "Source texture must level 0 defined.";
+MSG kSourceTextureMustBeCompressed = "Source texture must have a compressed internal format.";
+MSG kSourceTextureTooSmall = "The specified dimensions are outside of the bounds of the texture.";
+MSG kStencilReferenceMaskOrMismatch = "Stencil reference and mask values must be the same for front facing and back facing triangles.";
+MSG kStrideExceedsWebGLLimit = "Stride is over the maximum stride allowed by WebGL.";
+MSG kStrideMustBeMultipleOfType = "Stride must be a multiple of the passed in datatype.";
+MSG kSyncMissing = "Sync object does not exist.";
+MSG kTargetMustBeTexture2DMultisampleArrayOES = "Target must be TEXTURE_2D_MULTISAMPLE_ARRAY_OES.";
+MSG kTextureFormatMismatch = "Passed in texture target and format must match the one originally used to define the texture.";
+MSG kTextureIsImmutable = "Texture is immutable.";
+MSG kTextureIsNotImmutable = "Texture is not immutable.";
+MSG kTextureNotBound = "A texture must be bound.";
+MSG kTextureNotPow2 = "The texture is a non-power-of-two texture.";
+MSG kTextureRectangleNotSupported = "Context does not support GL_ANGLE_texture_rectangle";
+MSG kTextureSizeTooSmall = "Texture dimensions must all be greater than zero.";
+MSG kTextureTargetMismatch = "Textarget must match the texture target type.";
+MSG kTextureTargetRequiresES31 = "Texture target requires at least OpenGL ES 3.1.";
+MSG kTextureTypeConflict = "Two textures of different types use the same sampler location.";
+MSG kTextureTypeMismatch = "Passed in texture type must match the one originally used to define the texture.";
+MSG kTextureWidthOrHeightOutOfRange = "Width and height must be less than or equal to GL_MAX_TEXTURE_SIZE.";
+MSG kTransfomFeedbackAlreadyActive = "Transform feedback is already active.";
+MSG kTransformFeedbackActiveDelete = "Attempt to delete an active transform feedback.";
+MSG kTransformFeedbackActiveDuringLink = "Cannot link program while program is associated with an active transform feedback object.";
+MSG kTransformFeedbackBufferDoubleBound = "A transform feedback buffer that would be written to is also bound to a non-transform-feedback target = which would cause undefined behavior.";
+MSG kTransformFeedbackBufferMultipleOutputs = "Transform feedback has a buffer bound to multiple outputs.";
+MSG kTransformFeedbackBufferTooSmall = "Not enough space in bound transform feedback buffers.";
+MSG kTransformFeedbackDoesNotExist = "Transform feedback object that does not exist.";
+MSG kTransformFeedbackNotActive = "No Transform Feedback object is active.";
+MSG kTransformFeedbackNotPaused = "The active Transform Feedback object is not paused.";
+MSG kTransformFeedbackPaused = "The active Transform Feedback object is paused.";
+MSG kTransformFeedbackProgramBinary = "Cannot change program binary while program is associated with an active transform feedback object.";
+MSG kTransformFeedbackTargetActive = "Target is TRANSFORM_FEEDBACK_BUFFER and transform feedback is currently active.";
+MSG kTransformFeedbackUseProgram = "Cannot change active program while transform feedback is unpaused.";
+MSG kTransformFeedbackVaryingIndexOutOfRange = "Index must be less than the transform feedback varying count in the program.";
+MSG kTypeNotUnsignedShortByte = "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported.";
+MSG kUniformBufferBoundForTransformFeedback = "It is undefined behavior to use an uniform buffer that is bound for transform feedback.";
+MSG kUniformBufferOffsetAlignment = "Offset must be multiple of value of UNIFORM_BUFFER_OFFSET_ALIGNMENT.";
+MSG kUniformBufferTooSmall = "It is undefined behaviour to use a uniform buffer that is too small.";
+MSG kUniformBufferUnbound = "It is undefined behaviour to have a used but unbound uniform buffer.";
+MSG kUniformSizeMismatch = "Uniform size does not match uniform method.";
+MSG kUniformTypeMismatch = "Uniform type does not match uniform method.";
+MSG kUnimplementedComputeShaderPrecision = "Compute shader precision not yet implemented.";
+MSG kUnknownParameter = "Unknown parameter value.";
+MSG kUnsizedInternalFormatUnsupported = "Internalformat is one of the unsupported unsized base internalformats.";
+MSG kUnsupportedDrawModeForTransformFeedback = "The draw command is unsupported when transform feedback is active and not paused.";
+MSG kUnsupportedFloatBlending = "GL_BLEND with floating-point color attachments requires the EXT_float_blend extension.";
+MSG kVertexArrayNoBuffer = "An enabled vertex array has no buffer.";
+MSG kVertexArrayNoBufferPointer = "An enabled vertex array has no buffer and no pointer.";
+MSG kVertexBufferBoundForTransformFeedback = "It is undefined behavior to use a vertex buffer that is bound for transform feedback.";
+MSG kVertexShaderTypeMismatch = "Vertex shader input type does not match the type of the bound vertex attribute.";
+MSG kViewportNegativeSize = "Viewport size cannot be negative.";
+MSG kViewsExceedMaxArrayLayers = "baseViewIndex+numViews cannot be greater than GL_MAX_ARRAY_TEXTURE_LAYERS.";
+MSG kWebgl2NameLengthLimitExceeded = "Location lengths must not be greater than 1024 characters.";
+MSG kWebglBindAttribLocationReservedPrefix = "Attributes that begin with 'webgl_' = or '_webgl_' are not allowed.";
+MSG kWebglNameLengthLimitExceeded = "Location name lengths must not be greater than 256 characters.";
+MSG kZeroBoundToTarget = "Zero is bound to target.";
+// clang-format on
+
+#undef MSG
+} // namespace err
+} // namespace gl
+#endif // LIBANGLE_ERRORSTRINGS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Fence.cpp b/gfx/angle/checkout/src/libANGLE/Fence.cpp
new file mode 100644
index 0000000000..50c6948fb6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Fence.cpp
@@ -0,0 +1,117 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence.cpp: Implements the gl::FenceNV and gl::Sync classes.
+
+#include "libANGLE/Fence.h"
+
+#include "angle_gl.h"
+
+#include "common/utilities.h"
+#include "libANGLE/renderer/FenceNVImpl.h"
+#include "libANGLE/renderer/SyncImpl.h"
+
+namespace gl
+{
+
+FenceNV::FenceNV(rx::FenceNVImpl *impl)
+ : mFence(impl), mIsSet(false), mStatus(GL_FALSE), mCondition(GL_NONE)
+{}
+
+FenceNV::~FenceNV()
+{
+ SafeDelete(mFence);
+}
+
+angle::Result FenceNV::set(const Context *context, GLenum condition)
+{
+ ANGLE_TRY(mFence->set(context, condition));
+
+ mCondition = condition;
+ mStatus = GL_FALSE;
+ mIsSet = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result FenceNV::test(const Context *context, GLboolean *outResult)
+{
+ // Flush the command buffer by default
+ ANGLE_TRY(mFence->test(context, &mStatus));
+
+ *outResult = mStatus;
+ return angle::Result::Continue;
+}
+
+angle::Result FenceNV::finish(const Context *context)
+{
+ ASSERT(mIsSet);
+
+ ANGLE_TRY(mFence->finish(context));
+
+ mStatus = GL_TRUE;
+
+ return angle::Result::Continue;
+}
+
+Sync::Sync(rx::SyncImpl *impl, GLuint id)
+ : RefCountObject(id),
+ mFence(impl),
+ mLabel(),
+ mCondition(GL_SYNC_GPU_COMMANDS_COMPLETE),
+ mFlags(0)
+{}
+
+void Sync::onDestroy(const Context *context)
+{
+ ASSERT(mFence);
+ mFence->onDestroy(context);
+}
+
+Sync::~Sync()
+{
+ SafeDelete(mFence);
+}
+
+void Sync::setLabel(const Context *context, const std::string &label)
+{
+ mLabel = label;
+}
+
+const std::string &Sync::getLabel() const
+{
+ return mLabel;
+}
+
+angle::Result Sync::set(const Context *context, GLenum condition, GLbitfield flags)
+{
+ ANGLE_TRY(mFence->set(context, condition, flags));
+
+ mCondition = condition;
+ mFlags = flags;
+ return angle::Result::Continue;
+}
+
+angle::Result Sync::clientWait(const Context *context,
+ GLbitfield flags,
+ GLuint64 timeout,
+ GLenum *outResult)
+{
+ ASSERT(mCondition != GL_NONE);
+ return mFence->clientWait(context, flags, timeout, outResult);
+}
+
+angle::Result Sync::serverWait(const Context *context, GLbitfield flags, GLuint64 timeout)
+{
+ return mFence->serverWait(context, flags, timeout);
+}
+
+angle::Result Sync::getStatus(const Context *context, GLint *outResult) const
+{
+ return mFence->getStatus(context, outResult);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Fence.h b/gfx/angle/checkout/src/libANGLE/Fence.h
new file mode 100644
index 0000000000..abd30bfbba
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Fence.h
@@ -0,0 +1,84 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence.h: Defines the gl::FenceNV and gl::Sync classes, which support the GL_NV_fence
+// extension and GLES3 sync objects.
+
+#ifndef LIBANGLE_FENCE_H_
+#define LIBANGLE_FENCE_H_
+
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+
+#include "common/angleutils.h"
+
+namespace rx
+{
+class FenceNVImpl;
+class SyncImpl;
+} // namespace rx
+
+namespace gl
+{
+
+class FenceNV final : angle::NonCopyable
+{
+ public:
+ explicit FenceNV(rx::FenceNVImpl *impl);
+ virtual ~FenceNV();
+
+ angle::Result set(const Context *context, GLenum condition);
+ angle::Result test(const Context *context, GLboolean *outResult);
+ angle::Result finish(const Context *context);
+
+ bool isSet() const { return mIsSet; }
+ GLboolean getStatus() const { return mStatus; }
+ GLenum getCondition() const { return mCondition; }
+
+ private:
+ rx::FenceNVImpl *mFence;
+
+ bool mIsSet;
+
+ GLboolean mStatus;
+ GLenum mCondition;
+};
+
+class Sync final : public RefCountObject, public LabeledObject
+{
+ public:
+ Sync(rx::SyncImpl *impl, GLuint id);
+ ~Sync() override;
+
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ angle::Result set(const Context *context, GLenum condition, GLbitfield flags);
+ angle::Result clientWait(const Context *context,
+ GLbitfield flags,
+ GLuint64 timeout,
+ GLenum *outResult);
+ angle::Result serverWait(const Context *context, GLbitfield flags, GLuint64 timeout);
+ angle::Result getStatus(const Context *context, GLint *outResult) const;
+
+ GLenum getCondition() const { return mCondition; }
+ GLbitfield getFlags() const { return mFlags; }
+
+ private:
+ rx::SyncImpl *mFence;
+
+ std::string mLabel;
+
+ GLenum mCondition;
+ GLbitfield mFlags;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_FENCE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/FrameCapture.h b/gfx/angle/checkout/src/libANGLE/FrameCapture.h
new file mode 100644
index 0000000000..e4702dbfb1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/FrameCapture.h
@@ -0,0 +1,166 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FrameCapture.h:
+// ANGLE Frame capture inteface.
+//
+
+#ifndef LIBANGLE_FRAME_CAPTURE_H_
+#define LIBANGLE_FRAME_CAPTURE_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/frame_capture_utils_autogen.h"
+
+#include <tuple>
+
+namespace angle
+{
+struct ParamCapture : angle::NonCopyable
+{
+ ParamCapture();
+ ParamCapture(const char *nameIn, ParamType typeIn);
+ ~ParamCapture();
+
+ ParamCapture(ParamCapture &&other);
+ ParamCapture &operator=(ParamCapture &&other);
+
+ std::string name;
+ ParamType type;
+ ParamValue value;
+ std::vector<std::vector<uint8_t>> data;
+ int arrayClientPointerIndex = -1;
+ size_t readBufferSize = 0;
+};
+
+class ParamBuffer final : angle::NonCopyable
+{
+ public:
+ ParamBuffer();
+ ~ParamBuffer();
+
+ ParamBuffer(ParamBuffer &&other);
+ ParamBuffer &operator=(ParamBuffer &&other);
+
+ template <typename T>
+ void addValueParam(const char *paramName, ParamType paramType, T paramValue);
+
+ ParamCapture &getParam(const char *paramName, ParamType paramType, int index);
+
+ void addParam(ParamCapture &&param);
+ bool hasClientArrayData() const { return mClientArrayDataParam != -1; }
+ ParamCapture &getClientArrayPointerParameter();
+ size_t getReadBufferSize() const { return mReadBufferSize; }
+
+ const std::vector<ParamCapture> &getParamCaptures() const { return mParamCaptures; }
+
+ private:
+ std::vector<ParamCapture> mParamCaptures;
+ int mClientArrayDataParam = -1;
+ size_t mReadBufferSize = 0;
+};
+
+struct CallCapture
+{
+ CallCapture(const char *nameIn, ParamBuffer &&paramsIn);
+ ~CallCapture();
+
+ CallCapture(CallCapture &&other);
+ CallCapture &operator=(CallCapture &&other);
+
+ std::string name;
+ ParamBuffer params;
+};
+
+class FrameCapture final : angle::NonCopyable
+{
+ public:
+ FrameCapture();
+ ~FrameCapture();
+
+ void captureCall(const gl::Context *context, CallCapture &&call);
+ void onEndFrame();
+ bool enabled() const;
+
+ private:
+ // <CallName, ParamName>
+ using Counter = std::tuple<std::string, std::string>;
+
+ void captureClientArraySnapshot(const gl::Context *context,
+ size_t vertexCount,
+ size_t instanceCount);
+
+ void writeCallReplay(const CallCapture &call,
+ std::ostream &out,
+ std::ostream &header,
+ std::vector<uint8_t> *binaryData);
+ void reset();
+ int getAndIncrementCounter(const std::string &callName, const std::string &paramName);
+ bool anyClientArray() const;
+ void saveCapturedFrameAsCpp();
+
+ std::vector<CallCapture> mCalls;
+ gl::AttribArray<int> mClientVertexArrayMap;
+ size_t mFrameIndex;
+ gl::AttribArray<size_t> mClientArraySizes;
+ std::map<Counter, int> mDataCounters;
+ size_t mReadBufferSize;
+};
+
+template <typename CaptureFuncT, typename ValidationFuncT, typename... ArgsT>
+void CaptureCallToFrameCapture(const char *entryPointName,
+ CaptureFuncT captureFunc,
+ ValidationFuncT validationFunc,
+ gl::Context *context,
+ ArgsT... captureParams)
+{
+ FrameCapture *frameCapture = context->getFrameCapture();
+ if (!frameCapture->enabled())
+ return;
+
+ bool isCallValid = validationFunc(context, captureParams...);
+ CallCapture call = captureFunc(context, isCallValid, captureParams...);
+ frameCapture->captureCall(context, std::move(call));
+}
+
+template <typename T>
+void ParamBuffer::addValueParam(const char *paramName, ParamType paramType, T paramValue)
+{
+ ParamCapture capture(paramName, paramType);
+ InitParamValue(paramType, paramValue, &capture.value);
+ mParamCaptures.emplace_back(std::move(capture));
+}
+
+std::ostream &operator<<(std::ostream &os, const ParamCapture &capture);
+
+// Pointer capture helpers.
+void CaptureMemory(const void *source, size_t size, ParamCapture *paramCapture);
+void CaptureString(const GLchar *str, ParamCapture *paramCapture);
+
+template <ParamType ParamT, typename T>
+void WriteParamValueToStream(std::ostream &os, T value);
+
+template <>
+void WriteParamValueToStream<ParamType::TGLboolean>(std::ostream &os, GLboolean value);
+
+template <>
+void WriteParamValueToStream<ParamType::TvoidConstPointer>(std::ostream &os, const void *value);
+
+template <>
+void WriteParamValueToStream<ParamType::TGLDEBUGPROCKHR>(std::ostream &os, GLDEBUGPROCKHR value);
+
+template <>
+void WriteParamValueToStream<ParamType::TGLDEBUGPROC>(std::ostream &os, GLDEBUGPROC value);
+
+// General fallback for any unspecific type.
+template <ParamType ParamT, typename T>
+void WriteParamValueToStream(std::ostream &os, T value)
+{
+ os << value;
+}
+} // namespace angle
+
+#endif // LIBANGLE_FRAME_CAPTURE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Framebuffer.cpp b/gfx/angle/checkout/src/libANGLE/Framebuffer.cpp
new file mode 100644
index 0000000000..64acc8a4cd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Framebuffer.cpp
@@ -0,0 +1,2383 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer.cpp: Implements the gl::Framebuffer class. Implements GL framebuffer
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
+
+#include "libANGLE/Framebuffer.h"
+
+#include "common/Optional.h"
+#include "common/bitset_utils.h"
+#include "common/utilities.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/FramebufferImpl.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/RenderbufferImpl.h"
+#include "libANGLE/renderer/SurfaceImpl.h"
+
+using namespace angle;
+
+namespace gl
+{
+
+namespace
+{
+
+bool CheckMultiviewStateMatchesForCompleteness(const FramebufferAttachment *firstAttachment,
+ const FramebufferAttachment *secondAttachment)
+{
+ ASSERT(firstAttachment && secondAttachment);
+ ASSERT(firstAttachment->isAttached() && secondAttachment->isAttached());
+
+ if (firstAttachment->getNumViews() != secondAttachment->getNumViews())
+ {
+ return false;
+ }
+ if (firstAttachment->getBaseViewIndex() != secondAttachment->getBaseViewIndex())
+ {
+ return false;
+ }
+ if (firstAttachment->isMultiview() != secondAttachment->isMultiview())
+ {
+ return false;
+ }
+ return true;
+}
+
+bool CheckAttachmentCompleteness(const Context *context, const FramebufferAttachment &attachment)
+{
+ ASSERT(attachment.isAttached());
+
+ const Extents &size = attachment.getSize();
+ if (size.width == 0 || size.height == 0)
+ {
+ return false;
+ }
+
+ if (!attachment.isRenderable(context))
+ {
+ return false;
+ }
+
+ if (attachment.type() == GL_TEXTURE)
+ {
+ // [EXT_geometry_shader] Section 9.4.1, "Framebuffer Completeness"
+ // If <image> is a three-dimensional texture or a two-dimensional array texture and the
+ // attachment is not layered, the selected layer is less than the depth or layer count,
+ // respectively, of the texture.
+ if (!attachment.isLayered())
+ {
+ if (attachment.layer() >= size.depth)
+ {
+ return false;
+ }
+ }
+ // If <image> is a three-dimensional texture or a two-dimensional array texture and the
+ // attachment is layered, the depth or layer count, respectively, of the texture is less
+ // than or equal to the value of MAX_FRAMEBUFFER_LAYERS_EXT.
+ else
+ {
+ if (static_cast<GLuint>(size.depth) >= context->getCaps().maxFramebufferLayers)
+ {
+ return false;
+ }
+ }
+
+ // ES3 specifies that cube map texture attachments must be cube complete.
+ // This language is missing from the ES2 spec, but we enforce it here because some
+ // desktop OpenGL drivers also enforce this validation.
+ // TODO(jmadill): Check if OpenGL ES2 drivers enforce cube completeness.
+ const Texture *texture = attachment.getTexture();
+ ASSERT(texture);
+ if (texture->getType() == TextureType::CubeMap &&
+ !texture->getTextureState().isCubeComplete())
+ {
+ return false;
+ }
+
+ if (!texture->getImmutableFormat())
+ {
+ GLuint attachmentMipLevel = static_cast<GLuint>(attachment.mipLevel());
+
+ // From the ES 3.0 spec, pg 213:
+ // If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is TEXTURE and the value of
+ // FRAMEBUFFER_ATTACHMENT_OBJECT_NAME does not name an immutable-format texture,
+ // then the value of FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL must be in the
+ // range[levelbase, q], where levelbase is the value of TEXTURE_BASE_LEVEL and q is
+ // the effective maximum texture level defined in the Mipmapping discussion of
+ // section 3.8.10.4.
+ if (attachmentMipLevel < texture->getBaseLevel() ||
+ attachmentMipLevel > texture->getMipmapMaxLevel())
+ {
+ return false;
+ }
+
+ // Form the ES 3.0 spec, pg 213/214:
+ // If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is TEXTURE and the value of
+ // FRAMEBUFFER_ATTACHMENT_OBJECT_NAME does not name an immutable-format texture and
+ // the value of FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL is not levelbase, then the
+ // texture must be mipmap complete, and if FRAMEBUFFER_ATTACHMENT_OBJECT_NAME names
+ // a cubemap texture, the texture must also be cube complete.
+ if (attachmentMipLevel != texture->getBaseLevel() && !texture->isMipmapComplete())
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool CheckAttachmentSampleCompleteness(const Context *context,
+ const FramebufferAttachment &attachment,
+ bool colorAttachment,
+ Optional<int> *samples,
+ Optional<bool> *fixedSampleLocations)
+{
+ ASSERT(attachment.isAttached());
+
+ if (attachment.type() == GL_TEXTURE)
+ {
+ const Texture *texture = attachment.getTexture();
+ ASSERT(texture);
+
+ const ImageIndex &attachmentImageIndex = attachment.getTextureImageIndex();
+ bool fixedSampleloc = texture->getAttachmentFixedSampleLocations(attachmentImageIndex);
+ if (fixedSampleLocations->valid() && fixedSampleloc != fixedSampleLocations->value())
+ {
+ return false;
+ }
+ else
+ {
+ *fixedSampleLocations = fixedSampleloc;
+ }
+ }
+
+ if (samples->valid())
+ {
+ if (attachment.getSamples() != samples->value())
+ {
+ if (colorAttachment)
+ {
+ // APPLE_framebuffer_multisample, which EXT_draw_buffers refers to, requires that
+ // all color attachments have the same number of samples for the FBO to be complete.
+ return false;
+ }
+ else
+ {
+ // CHROMIUM_framebuffer_mixed_samples allows a framebuffer to be considered complete
+ // when its depth or stencil samples are a multiple of the number of color samples.
+ if (!context->getExtensions().framebufferMixedSamples)
+ {
+ return false;
+ }
+
+ if ((attachment.getSamples() % std::max(samples->value(), 1)) != 0)
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ *samples = attachment.getSamples();
+ }
+
+ return true;
+}
+
+// Needed to index into the attachment arrays/bitsets.
+static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS) ==
+ Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX,
+ "Framebuffer Dirty bit mismatch");
+static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS) ==
+ Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT,
+ "Framebuffer Dirty bit mismatch");
+static_assert(static_cast<size_t>(IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS + 1) ==
+ Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT,
+ "Framebuffer Dirty bit mismatch");
+
+angle::Result InitAttachment(const Context *context, FramebufferAttachment *attachment)
+{
+ ASSERT(attachment->isAttached());
+ if (attachment->initState() == InitState::MayNeedInit)
+ {
+ ANGLE_TRY(attachment->initializeContents(context));
+ }
+ return angle::Result::Continue;
+}
+
+bool IsColorMaskedOut(const BlendState &blend)
+{
+ return (!blend.colorMaskRed && !blend.colorMaskGreen && !blend.colorMaskBlue &&
+ !blend.colorMaskAlpha);
+}
+
+bool IsDepthMaskedOut(const DepthStencilState &depthStencil)
+{
+ return !depthStencil.depthMask;
+}
+
+bool IsStencilMaskedOut(const DepthStencilState &depthStencil)
+{
+ return ((depthStencil.stencilMask & depthStencil.stencilWritemask) == 0);
+}
+
+bool IsClearBufferMaskedOut(const Context *context, GLenum buffer)
+{
+ switch (buffer)
+ {
+ case GL_COLOR:
+ return IsColorMaskedOut(context->getState().getBlendState());
+ case GL_DEPTH:
+ return IsDepthMaskedOut(context->getState().getDepthStencilState());
+ case GL_STENCIL:
+ return IsStencilMaskedOut(context->getState().getDepthStencilState());
+ case GL_DEPTH_STENCIL:
+ return IsDepthMaskedOut(context->getState().getDepthStencilState()) &&
+ IsStencilMaskedOut(context->getState().getDepthStencilState());
+ default:
+ UNREACHABLE();
+ return true;
+ }
+}
+
+} // anonymous namespace
+
+// This constructor is only used for default framebuffers.
+FramebufferState::FramebufferState()
+ : mId(0),
+ mLabel(),
+ mColorAttachments(1),
+ mDrawBufferStates(1, GL_BACK),
+ mReadBufferState(GL_BACK),
+ mDrawBufferTypeMask(),
+ mDefaultWidth(0),
+ mDefaultHeight(0),
+ mDefaultSamples(0),
+ mDefaultFixedSampleLocations(GL_FALSE),
+ mDefaultLayers(0),
+ mWebGLDepthStencilConsistent(true)
+{
+ ASSERT(mDrawBufferStates.size() > 0);
+ mEnabledDrawBuffers.set(0);
+}
+
+FramebufferState::FramebufferState(const Caps &caps, GLuint id)
+ : mId(id),
+ mLabel(),
+ mColorAttachments(caps.maxColorAttachments),
+ mDrawBufferStates(caps.maxDrawBuffers, GL_NONE),
+ mReadBufferState(GL_COLOR_ATTACHMENT0_EXT),
+ mDrawBufferTypeMask(),
+ mDefaultWidth(0),
+ mDefaultHeight(0),
+ mDefaultSamples(0),
+ mDefaultFixedSampleLocations(GL_FALSE),
+ mDefaultLayers(0),
+ mWebGLDepthStencilConsistent(true)
+{
+ ASSERT(mId != 0);
+ ASSERT(mDrawBufferStates.size() > 0);
+ mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
+}
+
+FramebufferState::~FramebufferState() {}
+
+const std::string &FramebufferState::getLabel()
+{
+ return mLabel;
+}
+
+const FramebufferAttachment *FramebufferState::getAttachment(const Context *context,
+ GLenum attachment) const
+{
+ if (attachment >= GL_COLOR_ATTACHMENT0 && attachment <= GL_COLOR_ATTACHMENT15)
+ {
+ return getColorAttachment(attachment - GL_COLOR_ATTACHMENT0);
+ }
+
+ // WebGL1 allows a developer to query for attachment parameters even when "inconsistant" (i.e.
+ // multiple conflicting attachment points) and requires us to return the framebuffer attachment
+ // associated with WebGL.
+ switch (attachment)
+ {
+ case GL_COLOR:
+ case GL_BACK:
+ return getColorAttachment(0);
+ case GL_DEPTH:
+ case GL_DEPTH_ATTACHMENT:
+ if (context->isWebGL1())
+ {
+ return getWebGLDepthAttachment();
+ }
+ else
+ {
+ return getDepthAttachment();
+ }
+ case GL_STENCIL:
+ case GL_STENCIL_ATTACHMENT:
+ if (context->isWebGL1())
+ {
+ return getWebGLStencilAttachment();
+ }
+ else
+ {
+ return getStencilAttachment();
+ }
+ case GL_DEPTH_STENCIL:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (context->isWebGL1())
+ {
+ return getWebGLDepthStencilAttachment();
+ }
+ else
+ {
+ return getDepthStencilAttachment();
+ }
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+size_t FramebufferState::getReadIndex() const
+{
+ ASSERT(mReadBufferState == GL_BACK ||
+ (mReadBufferState >= GL_COLOR_ATTACHMENT0 && mReadBufferState <= GL_COLOR_ATTACHMENT15));
+ size_t readIndex = (mReadBufferState == GL_BACK
+ ? 0
+ : static_cast<size_t>(mReadBufferState - GL_COLOR_ATTACHMENT0));
+ ASSERT(readIndex < mColorAttachments.size());
+ return readIndex;
+}
+
+const FramebufferAttachment *FramebufferState::getReadAttachment() const
+{
+ if (mReadBufferState == GL_NONE)
+ {
+ return nullptr;
+ }
+ size_t readIndex = getReadIndex();
+ return mColorAttachments[readIndex].isAttached() ? &mColorAttachments[readIndex] : nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getFirstNonNullAttachment() const
+{
+ auto *colorAttachment = getFirstColorAttachment();
+ if (colorAttachment)
+ {
+ return colorAttachment;
+ }
+ return getDepthOrStencilAttachment();
+}
+
+const FramebufferAttachment *FramebufferState::getFirstColorAttachment() const
+{
+ for (const FramebufferAttachment &colorAttachment : mColorAttachments)
+ {
+ if (colorAttachment.isAttached())
+ {
+ return &colorAttachment;
+ }
+ }
+
+ return nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getDepthOrStencilAttachment() const
+{
+ if (mDepthAttachment.isAttached())
+ {
+ return &mDepthAttachment;
+ }
+ if (mStencilAttachment.isAttached())
+ {
+ return &mStencilAttachment;
+ }
+ return nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getStencilOrDepthStencilAttachment() const
+{
+ if (mStencilAttachment.isAttached())
+ {
+ return &mStencilAttachment;
+ }
+ return getDepthStencilAttachment();
+}
+
+const FramebufferAttachment *FramebufferState::getColorAttachment(size_t colorAttachment) const
+{
+ ASSERT(colorAttachment < mColorAttachments.size());
+ return mColorAttachments[colorAttachment].isAttached() ? &mColorAttachments[colorAttachment]
+ : nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getDepthAttachment() const
+{
+ return mDepthAttachment.isAttached() ? &mDepthAttachment : nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getWebGLDepthAttachment() const
+{
+ return mWebGLDepthAttachment.isAttached() ? &mWebGLDepthAttachment : nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getWebGLDepthStencilAttachment() const
+{
+ return mWebGLDepthStencilAttachment.isAttached() ? &mWebGLDepthStencilAttachment : nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getStencilAttachment() const
+{
+ return mStencilAttachment.isAttached() ? &mStencilAttachment : nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getWebGLStencilAttachment() const
+{
+ return mWebGLStencilAttachment.isAttached() ? &mWebGLStencilAttachment : nullptr;
+}
+
+const FramebufferAttachment *FramebufferState::getDepthStencilAttachment() const
+{
+ // A valid depth-stencil attachment has the same resource bound to both the
+ // depth and stencil attachment points.
+ if (mDepthAttachment.isAttached() && mStencilAttachment.isAttached() &&
+ mDepthAttachment == mStencilAttachment)
+ {
+ return &mDepthAttachment;
+ }
+
+ return nullptr;
+}
+
+bool FramebufferState::attachmentsHaveSameDimensions() const
+{
+ Optional<Extents> attachmentSize;
+
+ auto hasMismatchedSize = [&attachmentSize](const FramebufferAttachment &attachment) {
+ if (!attachment.isAttached())
+ {
+ return false;
+ }
+
+ if (!attachmentSize.valid())
+ {
+ attachmentSize = attachment.getSize();
+ return false;
+ }
+
+ const auto &prevSize = attachmentSize.value();
+ const auto &curSize = attachment.getSize();
+ return (curSize.width != prevSize.width || curSize.height != prevSize.height);
+ };
+
+ for (const auto &attachment : mColorAttachments)
+ {
+ if (hasMismatchedSize(attachment))
+ {
+ return false;
+ }
+ }
+
+ if (hasMismatchedSize(mDepthAttachment))
+ {
+ return false;
+ }
+
+ return !hasMismatchedSize(mStencilAttachment);
+}
+
+bool FramebufferState::hasSeparateDepthAndStencilAttachments() const
+{
+ // if we have both a depth and stencil buffer, they must refer to the same object
+ // since we only support packed_depth_stencil and not separate depth and stencil
+ return (getDepthAttachment() != nullptr && getStencilAttachment() != nullptr &&
+ getDepthStencilAttachment() == nullptr);
+}
+
+const FramebufferAttachment *FramebufferState::getDrawBuffer(size_t drawBufferIdx) const
+{
+ ASSERT(drawBufferIdx < mDrawBufferStates.size());
+ if (mDrawBufferStates[drawBufferIdx] != GL_NONE)
+ {
+ // ES3 spec: "If the GL is bound to a draw framebuffer object, the ith buffer listed in bufs
+ // must be COLOR_ATTACHMENTi or NONE"
+ ASSERT(mDrawBufferStates[drawBufferIdx] == GL_COLOR_ATTACHMENT0 + drawBufferIdx ||
+ (drawBufferIdx == 0 && mDrawBufferStates[drawBufferIdx] == GL_BACK));
+
+ if (mDrawBufferStates[drawBufferIdx] == GL_BACK)
+ {
+ return getColorAttachment(0);
+ }
+ else
+ {
+ return getColorAttachment(mDrawBufferStates[drawBufferIdx] - GL_COLOR_ATTACHMENT0);
+ }
+ }
+ else
+ {
+ return nullptr;
+ }
+}
+
+size_t FramebufferState::getDrawBufferCount() const
+{
+ return mDrawBufferStates.size();
+}
+
+bool FramebufferState::colorAttachmentsAreUniqueImages() const
+{
+ for (size_t firstAttachmentIdx = 0; firstAttachmentIdx < mColorAttachments.size();
+ firstAttachmentIdx++)
+ {
+ const FramebufferAttachment &firstAttachment = mColorAttachments[firstAttachmentIdx];
+ if (!firstAttachment.isAttached())
+ {
+ continue;
+ }
+
+ for (size_t secondAttachmentIdx = firstAttachmentIdx + 1;
+ secondAttachmentIdx < mColorAttachments.size(); secondAttachmentIdx++)
+ {
+ const FramebufferAttachment &secondAttachment = mColorAttachments[secondAttachmentIdx];
+ if (!secondAttachment.isAttached())
+ {
+ continue;
+ }
+
+ if (firstAttachment == secondAttachment)
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool FramebufferState::hasDepth() const
+{
+ return (mDepthAttachment.isAttached() && mDepthAttachment.getDepthSize() > 0);
+}
+
+bool FramebufferState::hasStencil() const
+{
+ return (mStencilAttachment.isAttached() && mStencilAttachment.getStencilSize() > 0);
+}
+
+bool FramebufferState::isMultiview() const
+{
+ const FramebufferAttachment *attachment = getFirstNonNullAttachment();
+ if (attachment == nullptr)
+ {
+ return false;
+ }
+ return attachment->isMultiview();
+}
+
+int FramebufferState::getBaseViewIndex() const
+{
+ const FramebufferAttachment *attachment = getFirstNonNullAttachment();
+ if (attachment == nullptr)
+ {
+ return GL_NONE;
+ }
+ return attachment->getBaseViewIndex();
+}
+
+Box FramebufferState::getDimensions() const
+{
+ Extents extents = getExtents();
+ return Box(0, 0, 0, extents.width, extents.height, extents.depth);
+}
+
+Extents FramebufferState::getExtents() const
+{
+ ASSERT(attachmentsHaveSameDimensions());
+ ASSERT(getFirstNonNullAttachment() != nullptr);
+ return getFirstNonNullAttachment()->getSize();
+}
+
+Framebuffer::Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id)
+ : mState(caps, id),
+ mImpl(factory->createFramebuffer(mState)),
+ mCachedStatus(),
+ mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
+ mDirtyStencilAttachmentBinding(this, DIRTY_BIT_STENCIL_ATTACHMENT)
+{
+ ASSERT(mImpl != nullptr);
+ ASSERT(mState.mColorAttachments.size() == static_cast<size_t>(caps.maxColorAttachments));
+
+ for (uint32_t colorIndex = 0;
+ colorIndex < static_cast<uint32_t>(mState.mColorAttachments.size()); ++colorIndex)
+ {
+ mDirtyColorAttachmentBindings.emplace_back(this, DIRTY_BIT_COLOR_ATTACHMENT_0 + colorIndex);
+ }
+}
+
+Framebuffer::Framebuffer(const Context *context, egl::Surface *surface)
+ : mState(),
+ mImpl(surface->getImplementation()->createDefaultFramebuffer(context, mState)),
+ mCachedStatus(GL_FRAMEBUFFER_COMPLETE),
+ mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
+ mDirtyStencilAttachmentBinding(this, DIRTY_BIT_STENCIL_ATTACHMENT)
+{
+ ASSERT(mImpl != nullptr);
+ mDirtyColorAttachmentBindings.emplace_back(this, DIRTY_BIT_COLOR_ATTACHMENT_0);
+
+ setAttachmentImpl(context, GL_FRAMEBUFFER_DEFAULT, GL_BACK, ImageIndex(), surface,
+ FramebufferAttachment::kDefaultNumViews,
+ FramebufferAttachment::kDefaultBaseViewIndex, false);
+
+ if (surface->getConfig()->depthSize > 0)
+ {
+ setAttachmentImpl(context, GL_FRAMEBUFFER_DEFAULT, GL_DEPTH, ImageIndex(), surface,
+ FramebufferAttachment::kDefaultNumViews,
+ FramebufferAttachment::kDefaultBaseViewIndex, false);
+ }
+
+ if (surface->getConfig()->stencilSize > 0)
+ {
+ setAttachmentImpl(context, GL_FRAMEBUFFER_DEFAULT, GL_STENCIL, ImageIndex(), surface,
+ FramebufferAttachment::kDefaultNumViews,
+ FramebufferAttachment::kDefaultBaseViewIndex, false);
+ }
+ SetComponentTypeMask(getDrawbufferWriteType(0), 0, &mState.mDrawBufferTypeMask);
+
+ // Ensure the backend has a chance to synchronize its content for a new backbuffer.
+ mDirtyBits.set(DIRTY_BIT_COLOR_BUFFER_CONTENTS_0);
+}
+
+Framebuffer::Framebuffer(rx::GLImplFactory *factory)
+ : mState(),
+ mImpl(factory->createFramebuffer(mState)),
+ mCachedStatus(GL_FRAMEBUFFER_UNDEFINED_OES),
+ mDirtyDepthAttachmentBinding(this, DIRTY_BIT_DEPTH_ATTACHMENT),
+ mDirtyStencilAttachmentBinding(this, DIRTY_BIT_STENCIL_ATTACHMENT)
+{
+ mDirtyColorAttachmentBindings.emplace_back(this, DIRTY_BIT_COLOR_ATTACHMENT_0);
+ SetComponentTypeMask(getDrawbufferWriteType(0), 0, &mState.mDrawBufferTypeMask);
+}
+
+Framebuffer::~Framebuffer()
+{
+ SafeDelete(mImpl);
+}
+
+void Framebuffer::onDestroy(const Context *context)
+{
+ for (auto &attachment : mState.mColorAttachments)
+ {
+ attachment.detach(context);
+ }
+ mState.mDepthAttachment.detach(context);
+ mState.mStencilAttachment.detach(context);
+ mState.mWebGLDepthAttachment.detach(context);
+ mState.mWebGLStencilAttachment.detach(context);
+ mState.mWebGLDepthStencilAttachment.detach(context);
+
+ mImpl->destroy(context);
+}
+
+void Framebuffer::setLabel(const Context *context, const std::string &label)
+{
+ mState.mLabel = label;
+}
+
+const std::string &Framebuffer::getLabel() const
+{
+ return mState.mLabel;
+}
+
+bool Framebuffer::detachTexture(const Context *context, GLuint textureId)
+{
+ return detachResourceById(context, GL_TEXTURE, textureId);
+}
+
+bool Framebuffer::detachRenderbuffer(const Context *context, GLuint renderbufferId)
+{
+ return detachResourceById(context, GL_RENDERBUFFER, renderbufferId);
+}
+
+bool Framebuffer::detachResourceById(const Context *context, GLenum resourceType, GLuint resourceId)
+{
+ bool found = false;
+
+ for (size_t colorIndex = 0; colorIndex < mState.mColorAttachments.size(); ++colorIndex)
+ {
+ if (detachMatchingAttachment(context, &mState.mColorAttachments[colorIndex], resourceType,
+ resourceId))
+ {
+ found = true;
+ }
+ }
+
+ if (context->isWebGL1())
+ {
+ const std::array<FramebufferAttachment *, 3> attachments = {
+ {&mState.mWebGLDepthStencilAttachment, &mState.mWebGLDepthAttachment,
+ &mState.mWebGLStencilAttachment}};
+ for (FramebufferAttachment *attachment : attachments)
+ {
+ if (detachMatchingAttachment(context, attachment, resourceType, resourceId))
+ {
+ found = true;
+ }
+ }
+ }
+ else
+ {
+ if (detachMatchingAttachment(context, &mState.mDepthAttachment, resourceType, resourceId))
+ {
+ found = true;
+ }
+ if (detachMatchingAttachment(context, &mState.mStencilAttachment, resourceType, resourceId))
+ {
+ found = true;
+ }
+ }
+
+ return found;
+}
+
+bool Framebuffer::detachMatchingAttachment(const Context *context,
+ FramebufferAttachment *attachment,
+ GLenum matchType,
+ GLuint matchId)
+{
+ if (attachment->isAttached() && attachment->type() == matchType && attachment->id() == matchId)
+ {
+ // We go through resetAttachment to make sure that all the required bookkeeping will be done
+ // such as updating enabled draw buffer state.
+ resetAttachment(context, attachment->getBinding());
+ return true;
+ }
+
+ return false;
+}
+
+const FramebufferAttachment *Framebuffer::getColorAttachment(size_t colorAttachment) const
+{
+ return mState.getColorAttachment(colorAttachment);
+}
+
+const FramebufferAttachment *Framebuffer::getDepthAttachment() const
+{
+ return mState.getDepthAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getStencilAttachment() const
+{
+ return mState.getStencilAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getDepthStencilAttachment() const
+{
+ return mState.getDepthStencilAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getDepthOrStencilAttachment() const
+{
+ return mState.getDepthOrStencilAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getStencilOrDepthStencilAttachment() const
+{
+ return mState.getStencilOrDepthStencilAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getReadColorAttachment() const
+{
+ return mState.getReadAttachment();
+}
+
+GLenum Framebuffer::getReadColorAttachmentType() const
+{
+ const FramebufferAttachment *readAttachment = mState.getReadAttachment();
+ return (readAttachment != nullptr ? readAttachment->type() : GL_NONE);
+}
+
+const FramebufferAttachment *Framebuffer::getFirstColorAttachment() const
+{
+ return mState.getFirstColorAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getFirstNonNullAttachment() const
+{
+ return mState.getFirstNonNullAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getAttachment(const Context *context,
+ GLenum attachment) const
+{
+ return mState.getAttachment(context, attachment);
+}
+
+size_t Framebuffer::getDrawbufferStateCount() const
+{
+ return mState.mDrawBufferStates.size();
+}
+
+GLenum Framebuffer::getDrawBufferState(size_t drawBuffer) const
+{
+ ASSERT(drawBuffer < mState.mDrawBufferStates.size());
+ return mState.mDrawBufferStates[drawBuffer];
+}
+
+const std::vector<GLenum> &Framebuffer::getDrawBufferStates() const
+{
+ return mState.getDrawBufferStates();
+}
+
+void Framebuffer::setDrawBuffers(size_t count, const GLenum *buffers)
+{
+ auto &drawStates = mState.mDrawBufferStates;
+
+ ASSERT(count <= drawStates.size());
+ std::copy(buffers, buffers + count, drawStates.begin());
+ std::fill(drawStates.begin() + count, drawStates.end(), GL_NONE);
+ mDirtyBits.set(DIRTY_BIT_DRAW_BUFFERS);
+
+ mState.mEnabledDrawBuffers.reset();
+ mState.mDrawBufferTypeMask.reset();
+
+ for (size_t index = 0; index < count; ++index)
+ {
+ SetComponentTypeMask(getDrawbufferWriteType(index), index, &mState.mDrawBufferTypeMask);
+
+ if (drawStates[index] != GL_NONE && mState.mColorAttachments[index].isAttached())
+ {
+ mState.mEnabledDrawBuffers.set(index);
+ }
+ }
+}
+
+const FramebufferAttachment *Framebuffer::getDrawBuffer(size_t drawBuffer) const
+{
+ return mState.getDrawBuffer(drawBuffer);
+}
+
+ComponentType Framebuffer::getDrawbufferWriteType(size_t drawBuffer) const
+{
+ const FramebufferAttachment *attachment = mState.getDrawBuffer(drawBuffer);
+ if (attachment == nullptr)
+ {
+ return ComponentType::NoType;
+ }
+
+ GLenum componentType = attachment->getFormat().info->componentType;
+ switch (componentType)
+ {
+ case GL_INT:
+ return ComponentType::Int;
+ case GL_UNSIGNED_INT:
+ return ComponentType::UnsignedInt;
+
+ default:
+ return ComponentType::Float;
+ }
+}
+
+ComponentTypeMask Framebuffer::getDrawBufferTypeMask() const
+{
+ return mState.mDrawBufferTypeMask;
+}
+
+DrawBufferMask Framebuffer::getDrawBufferMask() const
+{
+ return mState.mEnabledDrawBuffers;
+}
+
+bool Framebuffer::hasEnabledDrawBuffer() const
+{
+ for (size_t drawbufferIdx = 0; drawbufferIdx < mState.mDrawBufferStates.size(); ++drawbufferIdx)
+ {
+ if (getDrawBuffer(drawbufferIdx) != nullptr)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+GLenum Framebuffer::getReadBufferState() const
+{
+ return mState.mReadBufferState;
+}
+
+void Framebuffer::setReadBuffer(GLenum buffer)
+{
+ ASSERT(buffer == GL_BACK || buffer == GL_NONE ||
+ (buffer >= GL_COLOR_ATTACHMENT0 &&
+ (buffer - GL_COLOR_ATTACHMENT0) < mState.mColorAttachments.size()));
+ mState.mReadBufferState = buffer;
+ mDirtyBits.set(DIRTY_BIT_READ_BUFFER);
+}
+
+size_t Framebuffer::getNumColorAttachments() const
+{
+ return mState.mColorAttachments.size();
+}
+
+bool Framebuffer::hasDepth() const
+{
+ return mState.hasDepth();
+}
+
+bool Framebuffer::hasStencil() const
+{
+ return mState.hasStencil();
+}
+
+bool Framebuffer::usingExtendedDrawBuffers() const
+{
+ for (size_t drawbufferIdx = 1; drawbufferIdx < mState.mDrawBufferStates.size(); ++drawbufferIdx)
+ {
+ if (getDrawBuffer(drawbufferIdx) != nullptr)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void Framebuffer::invalidateCompletenessCache()
+{
+ if (mState.mId != 0)
+ {
+ mCachedStatus.reset();
+ }
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Framebuffer::checkStatusImpl(const Context *context)
+{
+ ASSERT(!isDefault());
+ ASSERT(hasAnyDirtyBit() || !mCachedStatus.valid());
+
+ mCachedStatus = checkStatusWithGLFrontEnd(context);
+
+ if (mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE)
+ {
+ // We can skip syncState on several back-ends.
+ if (mImpl->shouldSyncStateBeforeCheckStatus())
+ {
+ angle::Result err = syncState(context);
+ if (err != angle::Result::Continue)
+ {
+ return 0;
+ }
+ }
+
+ if (!mImpl->checkStatus(context))
+ {
+ mCachedStatus = GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+ }
+
+ return mCachedStatus.value();
+}
+
+GLenum Framebuffer::checkStatusWithGLFrontEnd(const Context *context)
+{
+ const State &state = context->getState();
+
+ ASSERT(mState.mId != 0);
+
+ bool hasAttachments = false;
+ Optional<unsigned int> colorbufferSize;
+ Optional<int> samples;
+ Optional<bool> fixedSampleLocations;
+ bool hasRenderbuffer = false;
+
+ const FramebufferAttachment *firstAttachment = getFirstNonNullAttachment();
+
+ Optional<bool> isLayered;
+ Optional<TextureType> colorAttachmentsTextureType;
+
+ for (const FramebufferAttachment &colorAttachment : mState.mColorAttachments)
+ {
+ if (colorAttachment.isAttached())
+ {
+ if (!CheckAttachmentCompleteness(context, colorAttachment))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ const InternalFormat &format = *colorAttachment.getFormat().info;
+ if (format.depthBits > 0 || format.stencilBits > 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (!CheckAttachmentSampleCompleteness(context, colorAttachment, true, &samples,
+ &fixedSampleLocations))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ }
+
+ // 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 (state.getClientMajorVersion() < 3)
+ {
+ if (colorbufferSize.valid())
+ {
+ if (format.pixelBytes != colorbufferSize.value())
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+ }
+ else
+ {
+ colorbufferSize = format.pixelBytes;
+ }
+ }
+
+ if (!CheckMultiviewStateMatchesForCompleteness(firstAttachment, &colorAttachment))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR;
+ }
+
+ hasRenderbuffer = hasRenderbuffer || (colorAttachment.type() == GL_RENDERBUFFER);
+
+ if (!hasAttachments)
+ {
+ isLayered = colorAttachment.isLayered();
+ if (isLayered.value())
+ {
+ colorAttachmentsTextureType = colorAttachment.getTextureImageIndex().getType();
+ }
+ hasAttachments = true;
+ }
+ else
+ {
+ // [EXT_geometry_shader] section 9.4.1, "Framebuffer Completeness"
+ // If any framebuffer attachment is layered, all populated attachments
+ // must be layered. Additionally, all populated color attachments must
+ // be from textures of the same target. {FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT }
+ ASSERT(isLayered.valid());
+ if (isLayered.value() != colorAttachment.isLayered())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT;
+ }
+ else if (isLayered.value())
+ {
+ ASSERT(colorAttachmentsTextureType.valid());
+ if (colorAttachmentsTextureType.value() !=
+ colorAttachment.getTextureImageIndex().getType())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT;
+ }
+ }
+ }
+ }
+ }
+
+ const FramebufferAttachment &depthAttachment = mState.mDepthAttachment;
+ if (depthAttachment.isAttached())
+ {
+ if (!CheckAttachmentCompleteness(context, depthAttachment))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ const InternalFormat &format = *depthAttachment.getFormat().info;
+ if (format.depthBits == 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (!CheckAttachmentSampleCompleteness(context, depthAttachment, false, &samples,
+ &fixedSampleLocations))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ }
+
+ if (!CheckMultiviewStateMatchesForCompleteness(firstAttachment, &depthAttachment))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR;
+ }
+
+ hasRenderbuffer = hasRenderbuffer || (depthAttachment.type() == GL_RENDERBUFFER);
+
+ if (!hasAttachments)
+ {
+ isLayered = depthAttachment.isLayered();
+ hasAttachments = true;
+ }
+ else
+ {
+ // [EXT_geometry_shader] section 9.4.1, "Framebuffer Completeness"
+ // If any framebuffer attachment is layered, all populated attachments
+ // must be layered. {FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT }
+ ASSERT(isLayered.valid());
+ if (isLayered.value() != depthAttachment.isLayered())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT;
+ }
+ }
+ }
+
+ const FramebufferAttachment &stencilAttachment = mState.mStencilAttachment;
+ if (stencilAttachment.isAttached())
+ {
+ if (!CheckAttachmentCompleteness(context, stencilAttachment))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ const InternalFormat &format = *stencilAttachment.getFormat().info;
+ if (format.stencilBits == 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (!CheckAttachmentSampleCompleteness(context, stencilAttachment, false, &samples,
+ &fixedSampleLocations))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ }
+
+ if (!CheckMultiviewStateMatchesForCompleteness(firstAttachment, &stencilAttachment))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR;
+ }
+
+ hasRenderbuffer = hasRenderbuffer || (stencilAttachment.type() == GL_RENDERBUFFER);
+
+ if (!hasAttachments)
+ {
+ hasAttachments = true;
+ }
+ else
+ {
+ // [EXT_geometry_shader] section 9.4.1, "Framebuffer Completeness"
+ // If any framebuffer attachment is layered, all populated attachments
+ // must be layered.
+ // {FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT }
+ ASSERT(isLayered.valid());
+ if (isLayered.value() != stencilAttachment.isLayered())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT;
+ }
+ }
+ }
+
+ // Starting from ES 3.0 stencil and depth, if present, should be the same image
+ if (state.getClientMajorVersion() >= 3 && depthAttachment.isAttached() &&
+ stencilAttachment.isAttached() && stencilAttachment != depthAttachment)
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+
+ // Special additional validation for WebGL 1 DEPTH/STENCIL/DEPTH_STENCIL.
+ if (state.isWebGL1())
+ {
+ if (!mState.mWebGLDepthStencilConsistent)
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+
+ if (mState.mWebGLDepthStencilAttachment.isAttached())
+ {
+ if (mState.mWebGLDepthStencilAttachment.getDepthSize() == 0 ||
+ mState.mWebGLDepthStencilAttachment.getStencilSize() == 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+
+ if (!CheckMultiviewStateMatchesForCompleteness(firstAttachment,
+ &mState.mWebGLDepthStencilAttachment))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR;
+ }
+ }
+ else if (mState.mStencilAttachment.isAttached() &&
+ mState.mStencilAttachment.getDepthSize() > 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+ else if (mState.mDepthAttachment.isAttached() &&
+ mState.mDepthAttachment.getStencilSize() > 0)
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ }
+ }
+
+ // ES3.1(section 9.4) requires that if no image is attached to the framebuffer, and either the
+ // value of the framebuffer's FRAMEBUFFER_DEFAULT_WIDTH or FRAMEBUFFER_DEFAULT_HEIGHT parameters
+ // is zero, the framebuffer is considered incomplete.
+ GLint defaultWidth = mState.getDefaultWidth();
+ GLint defaultHeight = mState.getDefaultHeight();
+ if (!hasAttachments && (defaultWidth == 0 || defaultHeight == 0))
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
+ }
+
+ // In ES 2.0 and WebGL, all color attachments must have the same width and height.
+ // In ES 3.0, there is no such restriction.
+ if ((state.getClientMajorVersion() < 3 || state.getExtensions().webglCompatibility) &&
+ !mState.attachmentsHaveSameDimensions())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
+ }
+
+ // ES3.1(section 9.4) requires that if the attached images are a mix of renderbuffers and
+ // textures, the value of TEXTURE_FIXED_SAMPLE_LOCATIONS must be TRUE for all attached textures.
+ if (fixedSampleLocations.valid() && hasRenderbuffer && !fixedSampleLocations.value())
+ {
+ return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
+ }
+
+ // The WebGL conformance tests implicitly define that all framebuffer
+ // attachments must be unique. For example, the same level of a texture can
+ // not be attached to two different color attachments.
+ if (state.getExtensions().webglCompatibility)
+ {
+ if (!mState.colorAttachmentsAreUniqueImages())
+ {
+ return GL_FRAMEBUFFER_UNSUPPORTED;
+ }
+ }
+
+ return GL_FRAMEBUFFER_COMPLETE;
+}
+
+angle::Result Framebuffer::discard(const Context *context, size_t count, const GLenum *attachments)
+{
+ // Back-ends might make the contents of the FBO undefined. In WebGL 2.0, invalidate operations
+ // can be no-ops, so we should probably do that to ensure consistency.
+ // TODO(jmadill): WebGL behaviour, and robust resource init behaviour without WebGL.
+
+ return mImpl->discard(context, count, attachments);
+}
+
+angle::Result Framebuffer::invalidate(const Context *context,
+ size_t count,
+ const GLenum *attachments)
+{
+ // Back-ends might make the contents of the FBO undefined. In WebGL 2.0, invalidate operations
+ // can be no-ops, so we should probably do that to ensure consistency.
+ // TODO(jmadill): WebGL behaviour, and robust resource init behaviour without WebGL.
+
+ return mImpl->invalidate(context, count, attachments);
+}
+
+bool Framebuffer::partialClearNeedsInit(const Context *context,
+ bool color,
+ bool depth,
+ bool stencil)
+{
+ const auto &glState = context->getState();
+
+ if (!glState.isRobustResourceInitEnabled())
+ {
+ return false;
+ }
+
+ // Scissors can affect clearing.
+ // TODO(jmadill): Check for complete scissor overlap.
+ if (glState.isScissorTestEnabled())
+ {
+ return true;
+ }
+
+ // If colors masked, we must clear before we clear. Do a simple check.
+ // TODO(jmadill): Filter out unused color channels from the test.
+ if (color)
+ {
+ const auto &blend = glState.getBlendState();
+ if (!(blend.colorMaskRed && blend.colorMaskGreen && blend.colorMaskBlue &&
+ blend.colorMaskAlpha))
+ {
+ return true;
+ }
+ }
+
+ const auto &depthStencil = glState.getDepthStencilState();
+ if (stencil && (depthStencil.stencilMask != depthStencil.stencilWritemask ||
+ depthStencil.stencilBackMask != depthStencil.stencilBackWritemask))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+angle::Result Framebuffer::invalidateSub(const Context *context,
+ size_t count,
+ const GLenum *attachments,
+ const Rectangle &area)
+{
+ // Back-ends might make the contents of the FBO undefined. In WebGL 2.0, invalidate operations
+ // can be no-ops, so we should probably do that to ensure consistency.
+ // TODO(jmadill): Make a invalidate no-op in WebGL 2.0.
+
+ return mImpl->invalidateSub(context, count, attachments, area);
+}
+
+angle::Result Framebuffer::clear(const Context *context, GLbitfield mask)
+{
+ const auto &glState = context->getState();
+ if (glState.isRasterizerDiscardEnabled())
+ {
+ return angle::Result::Continue;
+ }
+
+ // Remove clear bits that are ineffective. An effective clear changes at least one fragment. If
+ // color/depth/stencil masks make the clear ineffective we skip it altogether.
+
+ // If all color channels are masked, don't attempt to clear color.
+ if (context->getState().getBlendState().allChannelsMasked())
+ {
+ mask &= ~GL_COLOR_BUFFER_BIT;
+ }
+
+ // If depth write is disabled, don't attempt to clear depth.
+ if (!context->getState().getDepthStencilState().depthMask)
+ {
+ mask &= ~GL_DEPTH_BUFFER_BIT;
+ }
+
+ // If all stencil bits are masked, don't attempt to clear stencil.
+ if (context->getState().getDepthStencilState().stencilWritemask == 0)
+ {
+ mask &= ~GL_STENCIL_BUFFER_BIT;
+ }
+
+ if (mask != 0)
+ {
+ ANGLE_TRY(mImpl->clear(context, mask));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::clearBufferfv(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *values)
+{
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
+ {
+ return angle::Result::Continue;
+ }
+
+ if (buffer == GL_DEPTH)
+ {
+ // If depth write is disabled, don't attempt to clear depth.
+ if (!context->getState().getDepthStencilState().depthMask)
+ {
+ return angle::Result::Continue;
+ }
+ }
+ else
+ {
+ // If all color channels are masked, don't attempt to clear color.
+ if (context->getState().getBlendState().allChannelsMasked())
+ {
+ return angle::Result::Continue;
+ }
+ }
+
+ ANGLE_TRY(mImpl->clearBufferfv(context, buffer, drawbuffer, values));
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::clearBufferuiv(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *values)
+{
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
+ {
+ return angle::Result::Continue;
+ }
+
+ // If all color channels are masked, don't attempt to clear color.
+ if (context->getState().getBlendState().allChannelsMasked())
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRY(mImpl->clearBufferuiv(context, buffer, drawbuffer, values));
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::clearBufferiv(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *values)
+{
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
+ {
+ return angle::Result::Continue;
+ }
+
+ if (buffer == GL_STENCIL)
+ {
+ // If all stencil bits are masked, don't attempt to clear stencil.
+ if (context->getState().getDepthStencilState().stencilWritemask == 0)
+ {
+ return angle::Result::Continue;
+ }
+ }
+ else
+ {
+ // If all color channels are masked, don't attempt to clear color.
+ if (context->getState().getBlendState().allChannelsMasked())
+ {
+ return angle::Result::Continue;
+ }
+ }
+
+ ANGLE_TRY(mImpl->clearBufferiv(context, buffer, drawbuffer, values));
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::clearBufferfi(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil)
+{
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
+ {
+ return angle::Result::Continue;
+ }
+
+ bool clearDepth = context->getState().getDepthStencilState().depthMask;
+ bool clearStencil = context->getState().getDepthStencilState().stencilWritemask != 0;
+
+ if (clearDepth && clearStencil)
+ {
+ ASSERT(buffer == GL_DEPTH_STENCIL);
+ ANGLE_TRY(mImpl->clearBufferfi(context, GL_DEPTH_STENCIL, drawbuffer, depth, stencil));
+ }
+ else if (clearDepth && !clearStencil)
+ {
+ ANGLE_TRY(mImpl->clearBufferfv(context, GL_DEPTH, drawbuffer, &depth));
+ }
+ else if (!clearDepth && clearStencil)
+ {
+ ANGLE_TRY(mImpl->clearBufferiv(context, GL_STENCIL, drawbuffer, &stencil));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::getImplementationColorReadFormat(const Context *context,
+ GLenum *formatOut)
+{
+ ANGLE_TRY(syncState(context));
+ *formatOut = mImpl->getImplementationColorReadFormat(context);
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::getImplementationColorReadType(const Context *context, GLenum *typeOut)
+{
+ ANGLE_TRY(syncState(context));
+ *typeOut = mImpl->getImplementationColorReadType(context);
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::readPixels(const Context *context,
+ const Rectangle &area,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ ANGLE_TRY(mImpl->readPixels(context, area, format, type, pixels));
+
+ Buffer *unpackBuffer = context->getState().getTargetBuffer(BufferBinding::PixelUnpack);
+ if (unpackBuffer)
+ {
+ unpackBuffer->onPixelPack();
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::blit(const Context *context,
+ const Rectangle &sourceArea,
+ const Rectangle &destArea,
+ GLbitfield mask,
+ GLenum filter)
+{
+ GLbitfield blitMask = mask;
+
+ // Note that blitting is called against draw framebuffer.
+ // See the code in gl::Context::blitFramebuffer.
+ if ((mask & GL_COLOR_BUFFER_BIT) && !hasEnabledDrawBuffer())
+ {
+ blitMask &= ~GL_COLOR_BUFFER_BIT;
+ }
+
+ if ((mask & GL_STENCIL_BUFFER_BIT) && mState.getStencilAttachment() == nullptr)
+ {
+ blitMask &= ~GL_STENCIL_BUFFER_BIT;
+ }
+
+ if ((mask & GL_DEPTH_BUFFER_BIT) && mState.getDepthAttachment() == nullptr)
+ {
+ blitMask &= ~GL_DEPTH_BUFFER_BIT;
+ }
+
+ if (!blitMask)
+ {
+ return angle::Result::Continue;
+ }
+
+ return mImpl->blit(context, sourceArea, destArea, blitMask, filter);
+}
+
+bool Framebuffer::isDefault() const
+{
+ return id() == 0;
+}
+
+int Framebuffer::getSamples(const Context *context)
+{
+ return (isComplete(context) ? getCachedSamples(context) : 0);
+}
+
+int Framebuffer::getCachedSamples(const Context *context) const
+{
+ ASSERT(mCachedStatus.valid() && mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE);
+
+ // For a complete framebuffer, all attachments must have the same sample count.
+ // In this case return the first nonzero sample size.
+ const auto *firstNonNullAttachment = mState.getFirstNonNullAttachment();
+ if (firstNonNullAttachment)
+ {
+ ASSERT(firstNonNullAttachment->isAttached());
+ return firstNonNullAttachment->getSamples();
+ }
+
+ // No attachments found.
+ return 0;
+}
+
+angle::Result Framebuffer::getSamplePosition(const Context *context,
+ size_t index,
+ GLfloat *xy) const
+{
+ ANGLE_TRY(mImpl->getSamplePosition(context, index, xy));
+ return angle::Result::Continue;
+}
+
+bool Framebuffer::hasValidDepthStencil() const
+{
+ return mState.getDepthStencilAttachment() != nullptr;
+}
+
+void Framebuffer::setAttachment(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource)
+{
+ setAttachment(context, type, binding, textureIndex, resource,
+ FramebufferAttachment::kDefaultNumViews,
+ FramebufferAttachment::kDefaultBaseViewIndex, false);
+}
+
+void Framebuffer::setAttachment(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview)
+{
+ // Context may be null in unit tests.
+ if (!context || !context->isWebGL1())
+ {
+ setAttachmentImpl(context, type, binding, textureIndex, resource, numViews, baseViewIndex,
+ isMultiview);
+ return;
+ }
+
+ switch (binding)
+ {
+ case GL_DEPTH_STENCIL:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ mState.mWebGLDepthStencilAttachment.attach(context, type, binding, textureIndex,
+ resource, numViews, baseViewIndex,
+ isMultiview);
+ break;
+ case GL_DEPTH:
+ case GL_DEPTH_ATTACHMENT:
+ mState.mWebGLDepthAttachment.attach(context, type, binding, textureIndex, resource,
+ numViews, baseViewIndex, isMultiview);
+ break;
+ case GL_STENCIL:
+ case GL_STENCIL_ATTACHMENT:
+ mState.mWebGLStencilAttachment.attach(context, type, binding, textureIndex, resource,
+ numViews, baseViewIndex, isMultiview);
+ break;
+ default:
+ setAttachmentImpl(context, type, binding, textureIndex, resource, numViews,
+ baseViewIndex, isMultiview);
+ return;
+ }
+
+ commitWebGL1DepthStencilIfConsistent(context, numViews, baseViewIndex, isMultiview);
+}
+
+void Framebuffer::setAttachmentMultiview(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLint baseViewIndex)
+{
+ setAttachment(context, type, binding, textureIndex, resource, numViews, baseViewIndex, true);
+}
+
+void Framebuffer::commitWebGL1DepthStencilIfConsistent(const Context *context,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview)
+{
+ int count = 0;
+
+ std::array<FramebufferAttachment *, 3> attachments = {{&mState.mWebGLDepthStencilAttachment,
+ &mState.mWebGLDepthAttachment,
+ &mState.mWebGLStencilAttachment}};
+ for (FramebufferAttachment *attachment : attachments)
+ {
+ if (attachment->isAttached())
+ {
+ count++;
+ }
+ }
+
+ mState.mWebGLDepthStencilConsistent = (count <= 1);
+ if (!mState.mWebGLDepthStencilConsistent)
+ {
+ // Inconsistent.
+ return;
+ }
+
+ auto getImageIndexIfTextureAttachment = [](const FramebufferAttachment &attachment) {
+ if (attachment.type() == GL_TEXTURE)
+ {
+ return attachment.getTextureImageIndex();
+ }
+ else
+ {
+ return ImageIndex();
+ }
+ };
+
+ if (mState.mWebGLDepthAttachment.isAttached())
+ {
+ const auto &depth = mState.mWebGLDepthAttachment;
+ setAttachmentImpl(context, depth.type(), GL_DEPTH_ATTACHMENT,
+ getImageIndexIfTextureAttachment(depth), depth.getResource(), numViews,
+ baseViewIndex, isMultiview);
+ setAttachmentImpl(context, GL_NONE, GL_STENCIL_ATTACHMENT, ImageIndex(), nullptr, numViews,
+ baseViewIndex, isMultiview);
+ }
+ else if (mState.mWebGLStencilAttachment.isAttached())
+ {
+ const auto &stencil = mState.mWebGLStencilAttachment;
+ setAttachmentImpl(context, GL_NONE, GL_DEPTH_ATTACHMENT, ImageIndex(), nullptr, numViews,
+ baseViewIndex, isMultiview);
+ setAttachmentImpl(context, stencil.type(), GL_STENCIL_ATTACHMENT,
+ getImageIndexIfTextureAttachment(stencil), stencil.getResource(),
+ numViews, baseViewIndex, isMultiview);
+ }
+ else if (mState.mWebGLDepthStencilAttachment.isAttached())
+ {
+ const auto &depthStencil = mState.mWebGLDepthStencilAttachment;
+ setAttachmentImpl(context, depthStencil.type(), GL_DEPTH_ATTACHMENT,
+ getImageIndexIfTextureAttachment(depthStencil),
+ depthStencil.getResource(), numViews, baseViewIndex, isMultiview);
+ setAttachmentImpl(context, depthStencil.type(), GL_STENCIL_ATTACHMENT,
+ getImageIndexIfTextureAttachment(depthStencil),
+ depthStencil.getResource(), numViews, baseViewIndex, isMultiview);
+ }
+ else
+ {
+ setAttachmentImpl(context, GL_NONE, GL_DEPTH_ATTACHMENT, ImageIndex(), nullptr, numViews,
+ baseViewIndex, isMultiview);
+ setAttachmentImpl(context, GL_NONE, GL_STENCIL_ATTACHMENT, ImageIndex(), nullptr, numViews,
+ baseViewIndex, isMultiview);
+ }
+}
+
+void Framebuffer::setAttachmentImpl(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview)
+{
+ switch (binding)
+ {
+ case GL_DEPTH_STENCIL:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ {
+ // ensure this is a legitimate depth+stencil format
+ FramebufferAttachmentObject *attachmentObj = resource;
+ if (resource)
+ {
+ const Format &format = resource->getAttachmentFormat(binding, textureIndex);
+ if (format.info->depthBits == 0 || format.info->stencilBits == 0)
+ {
+ // Attaching nullptr detaches the current attachment.
+ attachmentObj = nullptr;
+ }
+ }
+
+ updateAttachment(context, &mState.mDepthAttachment, DIRTY_BIT_DEPTH_ATTACHMENT,
+ &mDirtyDepthAttachmentBinding, type, binding, textureIndex,
+ attachmentObj, numViews, baseViewIndex, isMultiview);
+ updateAttachment(context, &mState.mStencilAttachment, DIRTY_BIT_STENCIL_ATTACHMENT,
+ &mDirtyStencilAttachmentBinding, type, binding, textureIndex,
+ attachmentObj, numViews, baseViewIndex, isMultiview);
+ break;
+ }
+
+ case GL_DEPTH:
+ case GL_DEPTH_ATTACHMENT:
+ updateAttachment(context, &mState.mDepthAttachment, DIRTY_BIT_DEPTH_ATTACHMENT,
+ &mDirtyDepthAttachmentBinding, type, binding, textureIndex, resource,
+ numViews, baseViewIndex, isMultiview);
+ break;
+
+ case GL_STENCIL:
+ case GL_STENCIL_ATTACHMENT:
+ updateAttachment(context, &mState.mStencilAttachment, DIRTY_BIT_STENCIL_ATTACHMENT,
+ &mDirtyStencilAttachmentBinding, type, binding, textureIndex, resource,
+ numViews, baseViewIndex, isMultiview);
+ break;
+
+ case GL_BACK:
+ updateAttachment(context, &mState.mColorAttachments[0], DIRTY_BIT_COLOR_ATTACHMENT_0,
+ &mDirtyColorAttachmentBindings[0], type, binding, textureIndex,
+ resource, numViews, baseViewIndex, isMultiview);
+ break;
+
+ default:
+ {
+ size_t colorIndex = binding - GL_COLOR_ATTACHMENT0;
+ ASSERT(colorIndex < mState.mColorAttachments.size());
+ size_t dirtyBit = DIRTY_BIT_COLOR_ATTACHMENT_0 + colorIndex;
+ updateAttachment(context, &mState.mColorAttachments[colorIndex], dirtyBit,
+ &mDirtyColorAttachmentBindings[colorIndex], type, binding,
+ textureIndex, resource, numViews, baseViewIndex, isMultiview);
+
+ if (!resource)
+ {
+ mColorAttachmentBits.reset(colorIndex);
+ mFloat32ColorAttachmentBits.reset(colorIndex);
+ }
+ else
+ {
+ mColorAttachmentBits.set(colorIndex);
+ updateFloat32ColorAttachmentBits(
+ colorIndex, resource->getAttachmentFormat(binding, textureIndex).info);
+ }
+
+ // TODO(jmadill): ASSERT instead of checking the attachment exists in
+ // formsRenderingFeedbackLoopWith
+ bool enabled = (type != GL_NONE && getDrawBufferState(colorIndex) != GL_NONE);
+ mState.mEnabledDrawBuffers.set(colorIndex, enabled);
+ SetComponentTypeMask(getDrawbufferWriteType(colorIndex), colorIndex,
+ &mState.mDrawBufferTypeMask);
+ }
+ break;
+ }
+}
+
+void Framebuffer::updateAttachment(const Context *context,
+ FramebufferAttachment *attachment,
+ size_t dirtyBit,
+ angle::ObserverBinding *onDirtyBinding,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview)
+{
+ attachment->attach(context, type, binding, textureIndex, resource, numViews, baseViewIndex,
+ isMultiview);
+ mDirtyBits.set(dirtyBit);
+ mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit);
+ onDirtyBinding->bind(resource);
+
+ invalidateCompletenessCache();
+}
+
+void Framebuffer::resetAttachment(const Context *context, GLenum binding)
+{
+ setAttachment(context, GL_NONE, binding, ImageIndex(), nullptr);
+}
+
+angle::Result Framebuffer::syncState(const Context *context)
+{
+ if (mDirtyBits.any())
+ {
+ mDirtyBitsGuard = mDirtyBits;
+ ANGLE_TRY(mImpl->syncState(context, mDirtyBits));
+ mDirtyBits.reset();
+ mDirtyBitsGuard.reset();
+ }
+ return angle::Result::Continue;
+}
+
+void Framebuffer::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message)
+{
+ if (message != angle::SubjectMessage::SubjectChanged)
+ {
+ // This can be triggered by SubImage calls for Textures.
+ if (message == angle::SubjectMessage::ContentsChanged)
+ {
+ mDirtyBits.set(DIRTY_BIT_COLOR_BUFFER_CONTENTS_0 + index);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+ return;
+ }
+
+ // This can be triggered by the GL back-end TextureGL class.
+ ASSERT(message == angle::SubjectMessage::DirtyBitsFlagged);
+ return;
+ }
+
+ ASSERT(!mDirtyBitsGuard.valid() || mDirtyBitsGuard.value().test(index));
+ mDirtyBits.set(index);
+
+ invalidateCompletenessCache();
+
+ FramebufferAttachment *attachment = getAttachmentFromSubjectIndex(index);
+
+ // Mark the appropriate init flag.
+ mState.mResourceNeedsInit.set(index, attachment->initState() == InitState::MayNeedInit);
+
+ // Update mFloat32ColorAttachmentBits Cache
+ if (index < DIRTY_BIT_COLOR_ATTACHMENT_MAX)
+ {
+ ASSERT(index != DIRTY_BIT_DEPTH_ATTACHMENT);
+ ASSERT(index != DIRTY_BIT_STENCIL_ATTACHMENT);
+ updateFloat32ColorAttachmentBits(index - DIRTY_BIT_COLOR_ATTACHMENT_0,
+ attachment->getFormat().info);
+ }
+}
+
+FramebufferAttachment *Framebuffer::getAttachmentFromSubjectIndex(angle::SubjectIndex index)
+{
+ switch (index)
+ {
+ case DIRTY_BIT_DEPTH_ATTACHMENT:
+ return &mState.mDepthAttachment;
+ case DIRTY_BIT_STENCIL_ATTACHMENT:
+ return &mState.mStencilAttachment;
+ default:
+ size_t colorIndex = (index - DIRTY_BIT_COLOR_ATTACHMENT_0);
+ ASSERT(colorIndex < mState.mColorAttachments.size());
+ return &mState.mColorAttachments[colorIndex];
+ }
+}
+
+bool Framebuffer::formsRenderingFeedbackLoopWith(const Context *context) const
+{
+ const State &state = context->getState();
+ const Program *program = state.getProgram();
+
+ // TODO(jmadill): Default framebuffer feedback loops.
+ if (mState.mId == 0)
+ {
+ return false;
+ }
+
+ const FramebufferAttachment *depth = getDepthAttachment();
+ const FramebufferAttachment *stencil = getStencilAttachment();
+
+ const bool checkDepth = depth && depth->type() == GL_TEXTURE;
+ // Skip the feedback loop check for stencil if depth/stencil point to the same resource.
+ const bool checkStencil =
+ (stencil && stencil->type() == GL_TEXTURE) && (!depth || *stencil != *depth);
+
+ const gl::ActiveTextureMask &activeTextures = program->getActiveSamplersMask();
+ const gl::ActiveTexturePointerArray &textures = state.getActiveTexturesCache();
+
+ for (size_t textureUnit : activeTextures)
+ {
+ Texture *texture = textures[textureUnit];
+
+ if (texture == nullptr)
+ {
+ continue;
+ }
+
+ // Depth and stencil attachment form feedback loops
+ // Regardless of if enabled or masked.
+ if (checkDepth)
+ {
+ if (texture->id() == depth->id())
+ {
+ return true;
+ }
+ }
+
+ if (checkStencil)
+ {
+ if (texture->id() == stencil->id())
+ {
+ return true;
+ }
+ }
+
+ // Check if any color attachment forms a feedback loop.
+ for (size_t drawIndex : mColorAttachmentBits)
+ {
+ const FramebufferAttachment &attachment = mState.mColorAttachments[drawIndex];
+ ASSERT(attachment.isAttached());
+
+ if (attachment.isTextureWithId(texture->id()))
+ {
+ // TODO(jmadill): Check for appropriate overlap.
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool Framebuffer::formsCopyingFeedbackLoopWith(GLuint copyTextureID,
+ GLint copyTextureLevel,
+ GLint copyTextureLayer) const
+{
+ if (mState.mId == 0)
+ {
+ // It seems impossible to form a texture copying feedback loop with the default FBO.
+ return false;
+ }
+
+ const FramebufferAttachment *readAttachment = getReadColorAttachment();
+ ASSERT(readAttachment);
+
+ if (readAttachment->isTextureWithId(copyTextureID))
+ {
+ const auto &imageIndex = readAttachment->getTextureImageIndex();
+ if (imageIndex.getLevelIndex() == copyTextureLevel)
+ {
+ // Check 3D/Array texture layers.
+ return !imageIndex.hasLayer() || copyTextureLayer == ImageIndex::kEntireLevel ||
+ imageIndex.getLayerIndex() == copyTextureLayer;
+ }
+ }
+ return false;
+}
+
+GLint Framebuffer::getDefaultWidth() const
+{
+ return mState.getDefaultWidth();
+}
+
+GLint Framebuffer::getDefaultHeight() const
+{
+ return mState.getDefaultHeight();
+}
+
+GLint Framebuffer::getDefaultSamples() const
+{
+ return mState.getDefaultSamples();
+}
+
+bool Framebuffer::getDefaultFixedSampleLocations() const
+{
+ return mState.getDefaultFixedSampleLocations();
+}
+
+GLint Framebuffer::getDefaultLayers() const
+{
+ return mState.getDefaultLayers();
+}
+
+void Framebuffer::setDefaultWidth(const Context *context, GLint defaultWidth)
+{
+ mState.mDefaultWidth = defaultWidth;
+ mDirtyBits.set(DIRTY_BIT_DEFAULT_WIDTH);
+ invalidateCompletenessCache();
+}
+
+void Framebuffer::setDefaultHeight(const Context *context, GLint defaultHeight)
+{
+ mState.mDefaultHeight = defaultHeight;
+ mDirtyBits.set(DIRTY_BIT_DEFAULT_HEIGHT);
+ invalidateCompletenessCache();
+}
+
+void Framebuffer::setDefaultSamples(const Context *context, GLint defaultSamples)
+{
+ mState.mDefaultSamples = defaultSamples;
+ mDirtyBits.set(DIRTY_BIT_DEFAULT_SAMPLES);
+ invalidateCompletenessCache();
+}
+
+void Framebuffer::setDefaultFixedSampleLocations(const Context *context,
+ bool defaultFixedSampleLocations)
+{
+ mState.mDefaultFixedSampleLocations = defaultFixedSampleLocations;
+ mDirtyBits.set(DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS);
+ invalidateCompletenessCache();
+}
+
+void Framebuffer::setDefaultLayers(GLint defaultLayers)
+{
+ mState.mDefaultLayers = defaultLayers;
+ mDirtyBits.set(DIRTY_BIT_DEFAULT_LAYERS);
+}
+
+GLsizei Framebuffer::getNumViews() const
+{
+ return mState.getNumViews();
+}
+
+GLint Framebuffer::getBaseViewIndex() const
+{
+ return mState.getBaseViewIndex();
+}
+
+bool Framebuffer::isMultiview() const
+{
+ return mState.isMultiview();
+}
+
+bool Framebuffer::readDisallowedByMultiview() const
+{
+ return (mState.isMultiview() && mState.getNumViews() > 1);
+}
+
+angle::Result Framebuffer::ensureClearAttachmentsInitialized(const Context *context,
+ GLbitfield mask)
+{
+ const auto &glState = context->getState();
+ if (!context->isRobustResourceInitEnabled() || glState.isRasterizerDiscardEnabled())
+ {
+ return angle::Result::Continue;
+ }
+
+ const BlendState &blend = glState.getBlendState();
+ const DepthStencilState &depthStencil = glState.getDepthStencilState();
+
+ bool color = (mask & GL_COLOR_BUFFER_BIT) != 0 && !IsColorMaskedOut(blend);
+ bool depth = (mask & GL_DEPTH_BUFFER_BIT) != 0 && !IsDepthMaskedOut(depthStencil);
+ bool stencil = (mask & GL_STENCIL_BUFFER_BIT) != 0 && !IsStencilMaskedOut(depthStencil);
+
+ if (!color && !depth && !stencil)
+ {
+ return angle::Result::Continue;
+ }
+
+ if (partialClearNeedsInit(context, color, depth, stencil))
+ {
+ ANGLE_TRY(ensureDrawAttachmentsInitialized(context));
+ }
+
+ // If the impl encounters an error during a a full (non-partial) clear, the attachments will
+ // still be marked initialized. This simplifies design, allowing this method to be called before
+ // the clear.
+ markDrawAttachmentsInitialized(color, depth, stencil);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer)
+{
+ if (!context->isRobustResourceInitEnabled() ||
+ context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
+ {
+ return angle::Result::Continue;
+ }
+
+ if (partialBufferClearNeedsInit(context, buffer))
+ {
+ ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer));
+ }
+
+ // If the impl encounters an error during a a full (non-partial) clear, the attachments will
+ // still be marked initialized. This simplifies design, allowing this method to be called before
+ // the clear.
+ markBufferInitialized(buffer, drawbuffer);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::ensureDrawAttachmentsInitialized(const Context *context)
+{
+ if (!context->isRobustResourceInitEnabled())
+ {
+ return angle::Result::Continue;
+ }
+
+ // Note: we don't actually filter by the draw attachment enum. Just init everything.
+ for (size_t bit : mState.mResourceNeedsInit)
+ {
+ switch (bit)
+ {
+ case DIRTY_BIT_DEPTH_ATTACHMENT:
+ ANGLE_TRY(InitAttachment(context, &mState.mDepthAttachment));
+ break;
+ case DIRTY_BIT_STENCIL_ATTACHMENT:
+ ANGLE_TRY(InitAttachment(context, &mState.mStencilAttachment));
+ break;
+ default:
+ ANGLE_TRY(InitAttachment(context, &mState.mColorAttachments[bit]));
+ break;
+ }
+ }
+
+ mState.mResourceNeedsInit.reset();
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer::ensureReadAttachmentsInitialized(const Context *context)
+{
+ ASSERT(context->isRobustResourceInitEnabled());
+
+ if (mState.mResourceNeedsInit.none())
+ {
+ return angle::Result::Continue;
+ }
+
+ if (mState.mReadBufferState != GL_NONE)
+ {
+ size_t readIndex = mState.getReadIndex();
+ if (mState.mResourceNeedsInit[readIndex])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mColorAttachments[readIndex]));
+ mState.mResourceNeedsInit.reset(readIndex);
+ }
+ }
+
+ // Conservatively init depth since it can be read by BlitFramebuffer.
+ if (hasDepth())
+ {
+ if (mState.mResourceNeedsInit[DIRTY_BIT_DEPTH_ATTACHMENT])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mDepthAttachment));
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_DEPTH_ATTACHMENT);
+ }
+ }
+
+ // Conservatively init stencil since it can be read by BlitFramebuffer.
+ if (hasStencil())
+ {
+ if (mState.mResourceNeedsInit[DIRTY_BIT_STENCIL_ATTACHMENT])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mStencilAttachment));
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_STENCIL_ATTACHMENT);
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+void Framebuffer::markDrawAttachmentsInitialized(bool color, bool depth, bool stencil)
+{
+ // Mark attachments as initialized.
+ if (color)
+ {
+ for (auto colorIndex : mState.mEnabledDrawBuffers)
+ {
+ auto &colorAttachment = mState.mColorAttachments[colorIndex];
+ ASSERT(colorAttachment.isAttached());
+ colorAttachment.setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(colorIndex);
+ }
+ }
+
+ if (depth && mState.mDepthAttachment.isAttached())
+ {
+ mState.mDepthAttachment.setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_DEPTH_ATTACHMENT);
+ }
+
+ if (stencil && mState.mStencilAttachment.isAttached())
+ {
+ mState.mStencilAttachment.setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_STENCIL_ATTACHMENT);
+ }
+}
+
+void Framebuffer::markBufferInitialized(GLenum bufferType, GLint bufferIndex)
+{
+ switch (bufferType)
+ {
+ case GL_COLOR:
+ {
+ ASSERT(bufferIndex < static_cast<GLint>(mState.mColorAttachments.size()));
+ if (mState.mColorAttachments[bufferIndex].isAttached())
+ {
+ mState.mColorAttachments[bufferIndex].setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(bufferIndex);
+ }
+ break;
+ }
+ case GL_DEPTH:
+ {
+ if (mState.mDepthAttachment.isAttached())
+ {
+ mState.mDepthAttachment.setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_DEPTH_ATTACHMENT);
+ }
+ break;
+ }
+ case GL_STENCIL:
+ {
+ if (mState.mStencilAttachment.isAttached())
+ {
+ mState.mStencilAttachment.setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_STENCIL_ATTACHMENT);
+ }
+ break;
+ }
+ case GL_DEPTH_STENCIL:
+ {
+ if (mState.mDepthAttachment.isAttached())
+ {
+ mState.mDepthAttachment.setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_DEPTH_ATTACHMENT);
+ }
+ if (mState.mStencilAttachment.isAttached())
+ {
+ mState.mStencilAttachment.setInitState(InitState::Initialized);
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_STENCIL_ATTACHMENT);
+ }
+ break;
+ }
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+Box Framebuffer::getDimensions() const
+{
+ return mState.getDimensions();
+}
+
+Extents Framebuffer::getExtents() const
+{
+ return mState.getExtents();
+}
+
+angle::Result Framebuffer::ensureBufferInitialized(const Context *context,
+ GLenum bufferType,
+ GLint bufferIndex)
+{
+ ASSERT(context->isRobustResourceInitEnabled());
+
+ if (mState.mResourceNeedsInit.none())
+ {
+ return angle::Result::Continue;
+ }
+
+ switch (bufferType)
+ {
+ case GL_COLOR:
+ {
+ ASSERT(bufferIndex < static_cast<GLint>(mState.mColorAttachments.size()));
+ if (mState.mResourceNeedsInit[bufferIndex])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mColorAttachments[bufferIndex]));
+ mState.mResourceNeedsInit.reset(bufferIndex);
+ }
+ break;
+ }
+ case GL_DEPTH:
+ {
+ if (mState.mResourceNeedsInit[DIRTY_BIT_DEPTH_ATTACHMENT])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mDepthAttachment));
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_DEPTH_ATTACHMENT);
+ }
+ break;
+ }
+ case GL_STENCIL:
+ {
+ if (mState.mResourceNeedsInit[DIRTY_BIT_STENCIL_ATTACHMENT])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mStencilAttachment));
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_STENCIL_ATTACHMENT);
+ }
+ break;
+ }
+ case GL_DEPTH_STENCIL:
+ {
+ if (mState.mResourceNeedsInit[DIRTY_BIT_DEPTH_ATTACHMENT])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mDepthAttachment));
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_DEPTH_ATTACHMENT);
+ }
+ if (mState.mResourceNeedsInit[DIRTY_BIT_STENCIL_ATTACHMENT])
+ {
+ ANGLE_TRY(InitAttachment(context, &mState.mStencilAttachment));
+ mState.mResourceNeedsInit.reset(DIRTY_BIT_STENCIL_ATTACHMENT);
+ }
+ break;
+ }
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return angle::Result::Continue;
+}
+
+bool Framebuffer::partialBufferClearNeedsInit(const Context *context, GLenum bufferType)
+{
+ if (!context->isRobustResourceInitEnabled() || mState.mResourceNeedsInit.none())
+ {
+ return false;
+ }
+
+ switch (bufferType)
+ {
+ case GL_COLOR:
+ return partialClearNeedsInit(context, true, false, false);
+ case GL_DEPTH:
+ return partialClearNeedsInit(context, false, true, false);
+ case GL_STENCIL:
+ return partialClearNeedsInit(context, false, false, true);
+ case GL_DEPTH_STENCIL:
+ return partialClearNeedsInit(context, false, true, true);
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Framebuffer.h b/gfx/angle/checkout/src/libANGLE/Framebuffer.h
new file mode 100644
index 0000000000..3d38cb2570
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Framebuffer.h
@@ -0,0 +1,445 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer.h: Defines the gl::Framebuffer class. Implements GL framebuffer
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
+
+#ifndef LIBANGLE_FRAMEBUFFER_H_
+#define LIBANGLE_FRAMEBUFFER_H_
+
+#include <vector>
+
+#include "common/FixedVector.h"
+#include "common/Optional.h"
+#include "common/angleutils.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Observer.h"
+#include "libANGLE/RefCountObject.h"
+
+namespace rx
+{
+class GLImplFactory;
+class FramebufferImpl;
+class RenderbufferImpl;
+class SurfaceImpl;
+} // namespace rx
+
+namespace egl
+{
+class Display;
+class Surface;
+} // namespace egl
+
+namespace gl
+{
+struct Caps;
+class Context;
+struct Extensions;
+class Framebuffer;
+class ImageIndex;
+struct Rectangle;
+class Renderbuffer;
+class State;
+class Texture;
+class TextureCapsMap;
+
+class FramebufferState final : angle::NonCopyable
+{
+ public:
+ FramebufferState();
+ explicit FramebufferState(const Caps &caps, GLuint id);
+ ~FramebufferState();
+
+ const std::string &getLabel();
+ size_t getReadIndex() const;
+
+ const FramebufferAttachment *getAttachment(const Context *context, GLenum attachment) const;
+ const FramebufferAttachment *getReadAttachment() const;
+ const FramebufferAttachment *getFirstNonNullAttachment() const;
+ const FramebufferAttachment *getFirstColorAttachment() const;
+ const FramebufferAttachment *getDepthOrStencilAttachment() const;
+ const FramebufferAttachment *getStencilOrDepthStencilAttachment() const;
+ const FramebufferAttachment *getColorAttachment(size_t colorAttachment) const;
+ const FramebufferAttachment *getDepthAttachment() const;
+ const FramebufferAttachment *getStencilAttachment() const;
+ const FramebufferAttachment *getDepthStencilAttachment() const;
+
+ const std::vector<GLenum> &getDrawBufferStates() const { return mDrawBufferStates; }
+ DrawBufferMask getEnabledDrawBuffers() const { return mEnabledDrawBuffers; }
+ GLenum getReadBufferState() const { return mReadBufferState; }
+ const std::vector<FramebufferAttachment> &getColorAttachments() const
+ {
+ return mColorAttachments;
+ }
+
+ bool attachmentsHaveSameDimensions() const;
+ bool hasSeparateDepthAndStencilAttachments() const;
+ bool colorAttachmentsAreUniqueImages() const;
+ Box getDimensions() const;
+ Extents getExtents() const;
+
+ const FramebufferAttachment *getDrawBuffer(size_t drawBufferIdx) const;
+ size_t getDrawBufferCount() const;
+
+ GLint getDefaultWidth() const { return mDefaultWidth; }
+ GLint getDefaultHeight() const { return mDefaultHeight; }
+ GLint getDefaultSamples() const { return mDefaultSamples; }
+ bool getDefaultFixedSampleLocations() const { return mDefaultFixedSampleLocations; }
+ GLint getDefaultLayers() const { return mDefaultLayers; }
+
+ bool hasDepth() const;
+ bool hasStencil() const;
+
+ bool isMultiview() const;
+
+ ANGLE_INLINE GLsizei getNumViews() const
+ {
+ const FramebufferAttachment *attachment = getFirstNonNullAttachment();
+ if (attachment == nullptr)
+ {
+ return FramebufferAttachment::kDefaultNumViews;
+ }
+ return attachment->getNumViews();
+ }
+
+ GLint getBaseViewIndex() const;
+
+ GLuint id() const { return mId; }
+
+ private:
+ const FramebufferAttachment *getWebGLDepthStencilAttachment() const;
+ const FramebufferAttachment *getWebGLDepthAttachment() const;
+ const FramebufferAttachment *getWebGLStencilAttachment() const;
+
+ friend class Framebuffer;
+
+ GLuint mId;
+ std::string mLabel;
+
+ std::vector<FramebufferAttachment> mColorAttachments;
+ FramebufferAttachment mDepthAttachment;
+ FramebufferAttachment mStencilAttachment;
+
+ std::vector<GLenum> mDrawBufferStates;
+ GLenum mReadBufferState;
+ DrawBufferMask mEnabledDrawBuffers;
+ ComponentTypeMask mDrawBufferTypeMask;
+
+ GLint mDefaultWidth;
+ GLint mDefaultHeight;
+ GLint mDefaultSamples;
+ bool mDefaultFixedSampleLocations;
+ GLint mDefaultLayers;
+
+ // It's necessary to store all this extra state so we can restore attachments
+ // when DEPTH_STENCIL/DEPTH/STENCIL is unbound in WebGL 1.
+ FramebufferAttachment mWebGLDepthStencilAttachment;
+ FramebufferAttachment mWebGLDepthAttachment;
+ FramebufferAttachment mWebGLStencilAttachment;
+ bool mWebGLDepthStencilConsistent;
+
+ // Tracks if we need to initialize the resources for each attachment.
+ angle::BitSet<IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS + 2> mResourceNeedsInit;
+};
+
+class Framebuffer final : public angle::ObserverInterface,
+ public LabeledObject,
+ public angle::Subject
+{
+ public:
+ // Constructor to build application-defined framebuffers
+ Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id);
+ // Constructor to build default framebuffers for a surface and context pair
+ Framebuffer(const Context *context, egl::Surface *surface);
+ // Constructor to build a fake default framebuffer when surfaceless
+ Framebuffer(rx::GLImplFactory *factory);
+
+ ~Framebuffer() override;
+ void onDestroy(const Context *context);
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ rx::FramebufferImpl *getImplementation() const { return mImpl; }
+
+ GLuint id() const { return mState.mId; }
+
+ void setAttachment(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource);
+ void setAttachmentMultiview(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLint baseViewIndex);
+ void resetAttachment(const Context *context, GLenum binding);
+
+ bool detachTexture(const Context *context, GLuint texture);
+ bool detachRenderbuffer(const Context *context, GLuint renderbuffer);
+
+ const FramebufferAttachment *getColorAttachment(size_t colorAttachment) const;
+ const FramebufferAttachment *getDepthAttachment() const;
+ const FramebufferAttachment *getStencilAttachment() const;
+ const FramebufferAttachment *getDepthStencilAttachment() const;
+ const FramebufferAttachment *getDepthOrStencilAttachment() const;
+ const FramebufferAttachment *getStencilOrDepthStencilAttachment() const;
+ const FramebufferAttachment *getReadColorAttachment() const;
+ GLenum getReadColorAttachmentType() const;
+ const FramebufferAttachment *getFirstColorAttachment() const;
+ const FramebufferAttachment *getFirstNonNullAttachment() const;
+
+ const FramebufferAttachment *getAttachment(const Context *context, GLenum attachment) const;
+ bool isMultiview() const;
+ bool readDisallowedByMultiview() const;
+ GLsizei getNumViews() const;
+ GLint getBaseViewIndex() const;
+ Extents getExtents() const;
+
+ size_t getDrawbufferStateCount() const;
+ GLenum getDrawBufferState(size_t drawBuffer) const;
+ const std::vector<GLenum> &getDrawBufferStates() const;
+ void setDrawBuffers(size_t count, const GLenum *buffers);
+ const FramebufferAttachment *getDrawBuffer(size_t drawBuffer) const;
+ ComponentType getDrawbufferWriteType(size_t drawBuffer) const;
+ ComponentTypeMask getDrawBufferTypeMask() const;
+ DrawBufferMask getDrawBufferMask() const;
+ bool hasEnabledDrawBuffer() const;
+
+ GLenum getReadBufferState() const;
+ void setReadBuffer(GLenum buffer);
+
+ size_t getNumColorAttachments() const;
+ bool hasDepth() const;
+ bool hasStencil() const;
+
+ bool usingExtendedDrawBuffers() const;
+
+ // This method calls checkStatus.
+ int getSamples(const Context *context);
+
+ angle::Result getSamplePosition(const Context *context, size_t index, GLfloat *xy) const;
+
+ GLint getDefaultWidth() const;
+ GLint getDefaultHeight() const;
+ GLint getDefaultSamples() const;
+ bool getDefaultFixedSampleLocations() const;
+ GLint getDefaultLayers() const;
+ void setDefaultWidth(const Context *context, GLint defaultWidth);
+ void setDefaultHeight(const Context *context, GLint defaultHeight);
+ void setDefaultSamples(const Context *context, GLint defaultSamples);
+ void setDefaultFixedSampleLocations(const Context *context, bool defaultFixedSampleLocations);
+ void setDefaultLayers(GLint defaultLayers);
+
+ void invalidateCompletenessCache();
+
+ ANGLE_INLINE GLenum checkStatus(const Context *context)
+ {
+ // The default framebuffer is always complete except when it is surfaceless in which
+ // case it is always unsupported.
+ ASSERT(mState.mId != 0 || mCachedStatus.valid());
+ if (mState.mId == 0 || (!hasAnyDirtyBit() && mCachedStatus.valid()))
+ {
+ return mCachedStatus.value();
+ }
+
+ return checkStatusImpl(context);
+ }
+
+ // For when we don't want to check completeness in getSamples().
+ int getCachedSamples(const Context *context) const;
+
+ // Helper for checkStatus == GL_FRAMEBUFFER_COMPLETE.
+ ANGLE_INLINE bool isComplete(const Context *context)
+ {
+ return (checkStatus(context) == GL_FRAMEBUFFER_COMPLETE);
+ }
+
+ bool hasValidDepthStencil() const;
+
+ angle::Result discard(const Context *context, size_t count, const GLenum *attachments);
+ angle::Result invalidate(const Context *context, size_t count, const GLenum *attachments);
+ angle::Result invalidateSub(const Context *context,
+ size_t count,
+ const GLenum *attachments,
+ const Rectangle &area);
+
+ angle::Result clear(const Context *context, GLbitfield mask);
+ angle::Result clearBufferfv(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *values);
+ angle::Result clearBufferuiv(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *values);
+ angle::Result clearBufferiv(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *values);
+ angle::Result clearBufferfi(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil);
+
+ // These two methods call syncState() internally.
+ angle::Result getImplementationColorReadFormat(const Context *context, GLenum *formatOut);
+ angle::Result getImplementationColorReadType(const Context *context, GLenum *typeOut);
+
+ angle::Result readPixels(const Context *context,
+ const Rectangle &area,
+ GLenum format,
+ GLenum type,
+ void *pixels);
+
+ angle::Result blit(const Context *context,
+ const Rectangle &sourceArea,
+ const Rectangle &destArea,
+ GLbitfield mask,
+ GLenum filter);
+ bool isDefault() const;
+
+ enum DirtyBitType : size_t
+ {
+ DIRTY_BIT_COLOR_ATTACHMENT_0,
+ DIRTY_BIT_COLOR_ATTACHMENT_MAX =
+ DIRTY_BIT_COLOR_ATTACHMENT_0 + IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS,
+ DIRTY_BIT_DEPTH_ATTACHMENT = DIRTY_BIT_COLOR_ATTACHMENT_MAX,
+ DIRTY_BIT_STENCIL_ATTACHMENT,
+ DIRTY_BIT_COLOR_BUFFER_CONTENTS_0,
+ DIRTY_BIT_COLOR_BUFFER_CONTENTS_MAX =
+ DIRTY_BIT_COLOR_BUFFER_CONTENTS_0 + IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS,
+ DIRTY_BIT_DEPTH_BUFFER_CONTENTS,
+ DIRTY_BIT_STENCIL_BUFFER_CONTENTS,
+ DIRTY_BIT_DRAW_BUFFERS,
+ DIRTY_BIT_READ_BUFFER,
+ DIRTY_BIT_DEFAULT_WIDTH,
+ DIRTY_BIT_DEFAULT_HEIGHT,
+ DIRTY_BIT_DEFAULT_SAMPLES,
+ DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS,
+ DIRTY_BIT_DEFAULT_LAYERS,
+ DIRTY_BIT_UNKNOWN,
+ DIRTY_BIT_MAX = DIRTY_BIT_UNKNOWN
+ };
+
+ using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
+ bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
+
+ bool hasActiveFloat32ColorAttachment() const
+ {
+ return (mFloat32ColorAttachmentBits & getDrawBufferMask()).any();
+ }
+
+ bool hasResourceThatNeedsInit() const { return mState.mResourceNeedsInit.any(); }
+
+ angle::Result syncState(const Context *context);
+
+ // Observer implementation
+ void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
+
+ bool formsRenderingFeedbackLoopWith(const Context *context) const;
+ bool formsCopyingFeedbackLoopWith(GLuint copyTextureID,
+ GLint copyTextureLevel,
+ GLint copyTextureLayer) const;
+
+ angle::Result ensureClearAttachmentsInitialized(const Context *context, GLbitfield mask);
+ angle::Result ensureClearBufferAttachmentsInitialized(const Context *context,
+ GLenum buffer,
+ GLint drawbuffer);
+ angle::Result ensureDrawAttachmentsInitialized(const Context *context);
+
+ // Conservatively initializes both read color and depth. Blit can access the depth buffer.
+ angle::Result ensureReadAttachmentsInitialized(const Context *context);
+ Box getDimensions() const;
+
+ private:
+ bool detachResourceById(const Context *context, GLenum resourceType, GLuint resourceId);
+ bool detachMatchingAttachment(const Context *context,
+ FramebufferAttachment *attachment,
+ GLenum matchType,
+ GLuint matchId);
+ GLenum checkStatusWithGLFrontEnd(const Context *context);
+ GLenum checkStatusImpl(const Context *context);
+ void setAttachment(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview);
+ void commitWebGL1DepthStencilIfConsistent(const Context *context,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview);
+ void setAttachmentImpl(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview);
+ void updateAttachment(const Context *context,
+ FramebufferAttachment *attachment,
+ size_t dirtyBit,
+ angle::ObserverBinding *onDirtyBinding,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview);
+
+ void markDrawAttachmentsInitialized(bool color, bool depth, bool stencil);
+ void markBufferInitialized(GLenum bufferType, GLint bufferIndex);
+ angle::Result ensureBufferInitialized(const Context *context,
+ GLenum bufferType,
+ GLint bufferIndex);
+
+ // Checks that we have a partially masked clear:
+ // * some color channels are masked out
+ // * some stencil values are masked out
+ // * scissor test partially overlaps the framebuffer
+ bool partialClearNeedsInit(const Context *context, bool color, bool depth, bool stencil);
+ bool partialBufferClearNeedsInit(const Context *context, GLenum bufferType);
+
+ FramebufferAttachment *getAttachmentFromSubjectIndex(angle::SubjectIndex index);
+
+ ANGLE_INLINE void updateFloat32ColorAttachmentBits(size_t index,
+ const gl::InternalFormat *format)
+ {
+ mFloat32ColorAttachmentBits.set(index, format->type == GL_FLOAT);
+ }
+
+ FramebufferState mState;
+ rx::FramebufferImpl *mImpl;
+
+ Optional<GLenum> mCachedStatus;
+ std::vector<angle::ObserverBinding> mDirtyColorAttachmentBindings;
+ angle::ObserverBinding mDirtyDepthAttachmentBinding;
+ angle::ObserverBinding mDirtyStencilAttachmentBinding;
+
+ DirtyBits mDirtyBits;
+ DrawBufferMask mFloat32ColorAttachmentBits;
+ DrawBufferMask mColorAttachmentBits;
+
+ // The dirty bits guard is checked when we get a dependent state change message. We verify that
+ // we don't set a dirty bit that isn't already set, when inside the dirty bits syncState.
+ Optional<DirtyBits> mDirtyBitsGuard;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_FRAMEBUFFER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp
new file mode 100644
index 0000000000..cad883dcc0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp
@@ -0,0 +1,317 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FramebufferAttachment.cpp: the gl::FramebufferAttachment class and its derived classes
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#include "libANGLE/FramebufferAttachment.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
+#include "libANGLE/renderer/FramebufferImpl.h"
+
+namespace gl
+{
+
+////// FramebufferAttachment::Target Implementation //////
+
+const GLsizei FramebufferAttachment::kDefaultNumViews = 1;
+const GLint FramebufferAttachment::kDefaultBaseViewIndex = 0;
+
+FramebufferAttachment::Target::Target() : mBinding(GL_NONE), mTextureIndex() {}
+
+FramebufferAttachment::Target::Target(GLenum binding, const ImageIndex &imageIndex)
+ : mBinding(binding), mTextureIndex(imageIndex)
+{}
+
+FramebufferAttachment::Target::Target(const Target &other)
+ : mBinding(other.mBinding), mTextureIndex(other.mTextureIndex)
+{}
+
+FramebufferAttachment::Target &FramebufferAttachment::Target::operator=(const Target &other)
+{
+ this->mBinding = other.mBinding;
+ this->mTextureIndex = other.mTextureIndex;
+ return *this;
+}
+
+////// FramebufferAttachment Implementation //////
+
+FramebufferAttachment::FramebufferAttachment()
+ : mType(GL_NONE),
+ mResource(nullptr),
+ mNumViews(kDefaultNumViews),
+ mIsMultiview(false),
+ mBaseViewIndex(kDefaultBaseViewIndex)
+{}
+
+FramebufferAttachment::FramebufferAttachment(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource)
+ : mResource(nullptr)
+{
+ attach(context, type, binding, textureIndex, resource, kDefaultNumViews, kDefaultBaseViewIndex,
+ false);
+}
+
+FramebufferAttachment::FramebufferAttachment(FramebufferAttachment &&other)
+ : FramebufferAttachment()
+{
+ *this = std::move(other);
+}
+
+FramebufferAttachment &FramebufferAttachment::operator=(FramebufferAttachment &&other)
+{
+ std::swap(mType, other.mType);
+ std::swap(mTarget, other.mTarget);
+ std::swap(mResource, other.mResource);
+ std::swap(mNumViews, other.mNumViews);
+ std::swap(mIsMultiview, other.mIsMultiview);
+ std::swap(mBaseViewIndex, other.mBaseViewIndex);
+ return *this;
+}
+
+FramebufferAttachment::~FramebufferAttachment()
+{
+ ASSERT(!isAttached());
+}
+
+void FramebufferAttachment::detach(const Context *context)
+{
+ mType = GL_NONE;
+ if (mResource != nullptr)
+ {
+ mResource->onDetach(context);
+ mResource = nullptr;
+ }
+ mNumViews = kDefaultNumViews;
+ mIsMultiview = false;
+ mBaseViewIndex = kDefaultBaseViewIndex;
+
+ // not technically necessary, could omit for performance
+ mTarget = Target();
+}
+
+void FramebufferAttachment::attach(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview)
+{
+ if (resource == nullptr)
+ {
+ detach(context);
+ return;
+ }
+
+ mType = type;
+ mTarget = Target(binding, textureIndex);
+ mNumViews = numViews;
+ mBaseViewIndex = baseViewIndex;
+ mIsMultiview = isMultiview;
+ resource->onAttach(context);
+
+ if (mResource != nullptr)
+ {
+ mResource->onDetach(context);
+ }
+
+ mResource = resource;
+}
+
+GLuint FramebufferAttachment::getRedSize() const
+{
+ return getFormat().info->redBits;
+}
+
+GLuint FramebufferAttachment::getGreenSize() const
+{
+ return getFormat().info->greenBits;
+}
+
+GLuint FramebufferAttachment::getBlueSize() const
+{
+ return getFormat().info->blueBits;
+}
+
+GLuint FramebufferAttachment::getAlphaSize() const
+{
+ return getFormat().info->alphaBits;
+}
+
+GLuint FramebufferAttachment::getDepthSize() const
+{
+ return getFormat().info->depthBits;
+}
+
+GLuint FramebufferAttachment::getStencilSize() const
+{
+ return getFormat().info->stencilBits;
+}
+
+GLenum FramebufferAttachment::getComponentType() const
+{
+ return getFormat().info->componentType;
+}
+
+GLenum FramebufferAttachment::getColorEncoding() const
+{
+ return getFormat().info->colorEncoding;
+}
+
+GLuint FramebufferAttachment::id() const
+{
+ return mResource->getId();
+}
+
+TextureTarget FramebufferAttachment::cubeMapFace() const
+{
+ ASSERT(mType == GL_TEXTURE);
+
+ const auto &index = mTarget.textureIndex();
+ return index.getType() == TextureType::CubeMap ? index.getTarget() : TextureTarget::InvalidEnum;
+}
+
+GLint FramebufferAttachment::mipLevel() const
+{
+ ASSERT(type() == GL_TEXTURE);
+ return mTarget.textureIndex().getLevelIndex();
+}
+
+GLint FramebufferAttachment::layer() const
+{
+ ASSERT(mType == GL_TEXTURE);
+
+ const gl::ImageIndex &index = mTarget.textureIndex();
+ return (index.has3DLayer() ? index.getLayerIndex() : 0);
+}
+
+bool FramebufferAttachment::isLayered() const
+{
+ return mTarget.textureIndex().isLayered();
+}
+
+bool FramebufferAttachment::isMultiview() const
+{
+ return mIsMultiview;
+}
+
+GLint FramebufferAttachment::getBaseViewIndex() const
+{
+ return mBaseViewIndex;
+}
+
+Texture *FramebufferAttachment::getTexture() const
+{
+ return rx::GetAs<Texture>(mResource);
+}
+
+Renderbuffer *FramebufferAttachment::getRenderbuffer() const
+{
+ return rx::GetAs<Renderbuffer>(mResource);
+}
+
+const egl::Surface *FramebufferAttachment::getSurface() const
+{
+ return rx::GetAs<egl::Surface>(mResource);
+}
+
+FramebufferAttachmentObject *FramebufferAttachment::getResource() const
+{
+ return mResource;
+}
+
+bool FramebufferAttachment::operator==(const FramebufferAttachment &other) const
+{
+ if (mResource != other.mResource || mType != other.mType || mNumViews != other.mNumViews ||
+ mIsMultiview != other.mIsMultiview || mBaseViewIndex != other.mBaseViewIndex)
+ {
+ return false;
+ }
+
+ if (mType == GL_TEXTURE && getTextureImageIndex() != other.getTextureImageIndex())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool FramebufferAttachment::operator!=(const FramebufferAttachment &other) const
+{
+ return !(*this == other);
+}
+
+InitState FramebufferAttachment::initState() const
+{
+ return mResource ? mResource->initState(mTarget.textureIndex()) : InitState::Initialized;
+}
+
+angle::Result FramebufferAttachment::initializeContents(const Context *context)
+{
+ ASSERT(mResource);
+ ANGLE_TRY(mResource->initializeContents(context, mTarget.textureIndex()));
+ setInitState(InitState::Initialized);
+ return angle::Result::Continue;
+}
+
+void FramebufferAttachment::setInitState(InitState initState) const
+{
+ ASSERT(mResource);
+ mResource->setInitState(mTarget.textureIndex(), initState);
+}
+
+////// FramebufferAttachmentObject Implementation //////
+
+FramebufferAttachmentObject::FramebufferAttachmentObject() {}
+
+FramebufferAttachmentObject::~FramebufferAttachmentObject() {}
+
+angle::Result FramebufferAttachmentObject::getAttachmentRenderTarget(
+ const Context *context,
+ GLenum binding,
+ const ImageIndex &imageIndex,
+ rx::FramebufferAttachmentRenderTarget **rtOut) const
+{
+ return getAttachmentImpl()->getAttachmentRenderTarget(context, binding, imageIndex, rtOut);
+}
+
+angle::Result FramebufferAttachmentObject::initializeContents(const Context *context,
+ const ImageIndex &imageIndex)
+{
+ ASSERT(context->isRobustResourceInitEnabled());
+
+ // Because gl::Texture cannot support tracking individual layer dirtiness, we only handle
+ // initializing entire mip levels for 2D array textures.
+ if (imageIndex.getType() == TextureType::_2DArray && imageIndex.hasLayer())
+ {
+ ImageIndex fullMipIndex =
+ ImageIndex::Make2DArray(imageIndex.getLevelIndex(), ImageIndex::kEntireLevel);
+ return getAttachmentImpl()->initializeContents(context, fullMipIndex);
+ }
+ else if (imageIndex.getType() == TextureType::_2DMultisampleArray && imageIndex.hasLayer())
+ {
+ ImageIndex fullMipIndex = ImageIndex::Make2DMultisampleArray(ImageIndex::kEntireLevel);
+ return getAttachmentImpl()->initializeContents(context, fullMipIndex);
+ }
+ else
+ {
+ return getAttachmentImpl()->initializeContents(context, imageIndex);
+ }
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h
new file mode 100644
index 0000000000..20c4d54aab
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h
@@ -0,0 +1,260 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FramebufferAttachment.h: Defines the wrapper class gl::FramebufferAttachment, as well as the
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#ifndef LIBANGLE_FRAMEBUFFERATTACHMENT_H_
+#define LIBANGLE_FRAMEBUFFERATTACHMENT_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/ImageIndex.h"
+#include "libANGLE/Observer.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
+
+namespace egl
+{
+class Surface;
+}
+
+namespace rx
+{
+// An implementation-specific object associated with an attachment.
+
+class FramebufferAttachmentRenderTarget : angle::NonCopyable
+{
+ public:
+ FramebufferAttachmentRenderTarget() {}
+ virtual ~FramebufferAttachmentRenderTarget() {}
+};
+
+class FramebufferAttachmentObjectImpl;
+} // namespace rx
+
+namespace gl
+{
+class FramebufferAttachmentObject;
+class Renderbuffer;
+class Texture;
+
+enum class InitState
+{
+ MayNeedInit,
+ Initialized,
+};
+
+// FramebufferAttachment implements a GL framebuffer attachment.
+// Attachments are "light" containers, which store pointers to ref-counted GL objects.
+// We support GL texture (2D/3D/Cube/2D array) and renderbuffer object attachments.
+// Note: Our old naming scheme used the term "Renderbuffer" for both GL renderbuffers and for
+// framebuffer attachments, which confused their usage.
+
+class FramebufferAttachment final
+{
+ public:
+ FramebufferAttachment();
+
+ FramebufferAttachment(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource);
+
+ FramebufferAttachment(FramebufferAttachment &&other);
+ FramebufferAttachment &operator=(FramebufferAttachment &&other);
+
+ ~FramebufferAttachment();
+
+ void detach(const Context *context);
+ void attach(const Context *context,
+ GLenum type,
+ GLenum binding,
+ const ImageIndex &textureIndex,
+ FramebufferAttachmentObject *resource,
+ GLsizei numViews,
+ GLuint baseViewIndex,
+ bool isMultiview);
+
+ // Helper methods
+ GLuint getRedSize() const;
+ GLuint getGreenSize() const;
+ GLuint getBlueSize() const;
+ GLuint getAlphaSize() const;
+ GLuint getDepthSize() const;
+ GLuint getStencilSize() const;
+ GLenum getComponentType() const;
+ GLenum getColorEncoding() const;
+
+ bool isTextureWithId(GLuint textureId) const
+ {
+ return mType == GL_TEXTURE && id() == textureId;
+ }
+ bool isRenderbufferWithId(GLuint renderbufferId) const
+ {
+ return mType == GL_RENDERBUFFER && id() == renderbufferId;
+ }
+
+ GLenum getBinding() const { return mTarget.binding(); }
+ GLuint id() const;
+
+ // These methods are only legal to call on Texture attachments
+ const ImageIndex &getTextureImageIndex() const;
+ TextureTarget cubeMapFace() const;
+ GLint mipLevel() const;
+ GLint layer() const;
+ bool isLayered() const;
+
+ GLsizei getNumViews() const { return mNumViews; }
+
+ bool isMultiview() const;
+ GLint getBaseViewIndex() const;
+
+ // The size of the underlying resource the attachment points to. The 'depth' value will
+ // correspond to a 3D texture depth or the layer count of a 2D array texture. For Surfaces and
+ // Renderbuffers, it will always be 1.
+ Extents getSize() const;
+ Format getFormat() const;
+ GLsizei getSamples() const;
+ GLenum type() const { return mType; }
+ bool isAttached() const { return mType != GL_NONE; }
+ bool isRenderable(const Context *context) const;
+
+ Renderbuffer *getRenderbuffer() const;
+ Texture *getTexture() const;
+ const egl::Surface *getSurface() const;
+ FramebufferAttachmentObject *getResource() const;
+ InitState initState() const;
+ angle::Result initializeContents(const Context *context);
+ void setInitState(InitState initState) const;
+
+ // "T" must be static_castable from FramebufferAttachmentRenderTarget
+ template <typename T>
+ angle::Result getRenderTarget(const Context *context, T **rtOut) const
+ {
+ static_assert(std::is_base_of<rx::FramebufferAttachmentRenderTarget, T>(),
+ "Invalid RenderTarget class.");
+ return getRenderTargetImpl(
+ context, reinterpret_cast<rx::FramebufferAttachmentRenderTarget **>(rtOut));
+ }
+
+ bool operator==(const FramebufferAttachment &other) const;
+ bool operator!=(const FramebufferAttachment &other) const;
+
+ static const GLsizei kDefaultNumViews;
+ static const GLint kDefaultBaseViewIndex;
+
+ private:
+ angle::Result getRenderTargetImpl(const Context *context,
+ rx::FramebufferAttachmentRenderTarget **rtOut) const;
+
+ // A framebuffer attachment points to one of three types of resources: Renderbuffers,
+ // Textures and egl::Surface. The "Target" struct indicates which part of the
+ // object an attachment references. For the three types:
+ // - a Renderbuffer has a unique renderable target, and needs no target index
+ // - a Texture has targets for every image and uses an ImageIndex
+ // - a Surface has targets for Color and Depth/Stencil, and uses the attachment binding
+ class Target
+ {
+ public:
+ Target();
+ Target(GLenum binding, const ImageIndex &imageIndex);
+ Target(const Target &other);
+ Target &operator=(const Target &other);
+
+ GLenum binding() const { return mBinding; }
+ const ImageIndex &textureIndex() const { return mTextureIndex; }
+
+ private:
+ GLenum mBinding;
+ ImageIndex mTextureIndex;
+ };
+
+ GLenum mType;
+ Target mTarget;
+ FramebufferAttachmentObject *mResource;
+ GLsizei mNumViews;
+ bool mIsMultiview;
+ GLint mBaseViewIndex;
+};
+
+// A base class for objects that FBO Attachments may point to.
+class FramebufferAttachmentObject : public angle::Subject
+{
+ public:
+ FramebufferAttachmentObject();
+ ~FramebufferAttachmentObject() override;
+
+ virtual Extents getAttachmentSize(const ImageIndex &imageIndex) const = 0;
+ virtual Format getAttachmentFormat(GLenum binding, const ImageIndex &imageIndex) const = 0;
+ virtual GLsizei getAttachmentSamples(const ImageIndex &imageIndex) const = 0;
+ virtual bool isRenderable(const Context *context,
+ GLenum binding,
+ const ImageIndex &imageIndex) const = 0;
+
+ virtual void onAttach(const Context *context) = 0;
+ virtual void onDetach(const Context *context) = 0;
+ virtual GLuint getId() const = 0;
+
+ // These are used for robust resource initialization.
+ virtual InitState initState(const ImageIndex &imageIndex) const = 0;
+ virtual void setInitState(const ImageIndex &imageIndex, InitState initState) = 0;
+
+ angle::Result getAttachmentRenderTarget(const Context *context,
+ GLenum binding,
+ const ImageIndex &imageIndex,
+ rx::FramebufferAttachmentRenderTarget **rtOut) const;
+
+ angle::Result initializeContents(const Context *context, const ImageIndex &imageIndex);
+
+ protected:
+ virtual rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const = 0;
+};
+
+inline const ImageIndex &FramebufferAttachment::getTextureImageIndex() const
+{
+ ASSERT(type() == GL_TEXTURE);
+ return mTarget.textureIndex();
+}
+
+inline Extents FramebufferAttachment::getSize() const
+{
+ ASSERT(mResource);
+ return mResource->getAttachmentSize(mTarget.textureIndex());
+}
+
+inline Format FramebufferAttachment::getFormat() const
+{
+ ASSERT(mResource);
+ return mResource->getAttachmentFormat(mTarget.binding(), mTarget.textureIndex());
+}
+
+inline GLsizei FramebufferAttachment::getSamples() const
+{
+ ASSERT(mResource);
+ return mResource->getAttachmentSamples(mTarget.textureIndex());
+}
+
+inline angle::Result FramebufferAttachment::getRenderTargetImpl(
+ const Context *context,
+ rx::FramebufferAttachmentRenderTarget **rtOut) const
+{
+ ASSERT(mResource);
+ return mResource->getAttachmentRenderTarget(context, mTarget.binding(), mTarget.textureIndex(),
+ rtOut);
+}
+
+inline bool FramebufferAttachment::isRenderable(const Context *context) const
+{
+ ASSERT(mResource);
+ return mResource->isRenderable(context, mTarget.binding(), mTarget.textureIndex());
+}
+
+} // namespace gl
+
+#endif // LIBANGLE_FRAMEBUFFERATTACHMENT_H_
diff --git a/gfx/angle/checkout/src/libANGLE/GLES1Renderer.cpp b/gfx/angle/checkout/src/libANGLE/GLES1Renderer.cpp
new file mode 100644
index 0000000000..4e7395ef0b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/GLES1Renderer.cpp
@@ -0,0 +1,884 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// GLES1Renderer.cpp: Implements the GLES1Renderer renderer.
+
+#include "libANGLE/GLES1Renderer.h"
+
+#include <string.h>
+#include <iterator>
+#include <sstream>
+#include <vector>
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Context.inl.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/ResourceManager.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/State.h"
+#include "libANGLE/renderer/ContextImpl.h"
+
+namespace
+{
+#include "libANGLE/GLES1Shaders.inc"
+} // anonymous namespace
+
+namespace gl
+{
+
+GLES1Renderer::GLES1Renderer() : mRendererProgramInitialized(false) {}
+
+void GLES1Renderer::onDestroy(Context *context, State *state)
+{
+ if (mRendererProgramInitialized)
+ {
+ (void)state->setProgram(context, 0);
+
+ mShaderPrograms->deleteProgram(context, mProgramState.program);
+ mShaderPrograms->release(context);
+ mShaderPrograms = nullptr;
+ mRendererProgramInitialized = false;
+ }
+}
+
+GLES1Renderer::~GLES1Renderer() = default;
+
+angle::Result GLES1Renderer::prepareForDraw(PrimitiveMode mode, Context *context, State *glState)
+{
+ ANGLE_TRY(initializeRendererProgram(context, glState));
+
+ GLES1State &gles1State = glState->gles1();
+
+ Program *programObject = getProgram(mProgramState.program);
+
+ GLES1UniformBuffers &uniformBuffers = mUniformBuffers;
+
+ // If anything is dirty in gles1 or the common parts of gles1/2, just redo these parts
+ // completely for now.
+
+ // Feature enables
+ {
+ setUniform1i(context, programObject, mProgramState.enableAlphaTestLoc,
+ glState->getEnableFeature(GL_ALPHA_TEST));
+ setUniform1i(context, programObject, mProgramState.enableLightingLoc,
+ glState->getEnableFeature(GL_LIGHTING));
+ setUniform1i(context, programObject, mProgramState.enableRescaleNormalLoc,
+ glState->getEnableFeature(GL_RESCALE_NORMAL));
+ setUniform1i(context, programObject, mProgramState.enableNormalizeLoc,
+ glState->getEnableFeature(GL_NORMALIZE));
+ setUniform1i(context, programObject, mProgramState.enableColorMaterialLoc,
+ glState->getEnableFeature(GL_COLOR_MATERIAL));
+ setUniform1i(context, programObject, mProgramState.fogEnableLoc,
+ glState->getEnableFeature(GL_FOG));
+
+ bool enableClipPlanes = false;
+ for (int i = 0; i < kClipPlaneCount; i++)
+ {
+ uniformBuffers.clipPlaneEnables[i] = glState->getEnableFeature(GL_CLIP_PLANE0 + i);
+ enableClipPlanes = enableClipPlanes || uniformBuffers.clipPlaneEnables[i];
+ }
+
+ setUniform1i(context, programObject, mProgramState.enableClipPlanesLoc, enableClipPlanes);
+ }
+
+ // Texture unit enables and format info
+ {
+ std::array<GLint, kTexUnitCount> &tex2DEnables = uniformBuffers.tex2DEnables;
+ std::array<GLint, kTexUnitCount> &texCubeEnables = uniformBuffers.texCubeEnables;
+
+ std::vector<int> tex2DFormats = {GL_RGBA, GL_RGBA, GL_RGBA, GL_RGBA};
+
+ Vec4Uniform *cropRectBuffer = uniformBuffers.texCropRects.data();
+
+ for (int i = 0; i < kTexUnitCount; i++)
+ {
+ // GL_OES_cube_map allows only one of TEXTURE_2D / TEXTURE_CUBE_MAP
+ // to be enabled per unit, thankfully. From the extension text:
+ //
+ // -- Section 3.8.10 "Texture Application"
+ //
+ // Replace the beginning sentences of the first paragraph (page 138)
+ // with:
+ //
+ // "Texturing is enabled or disabled using the generic Enable
+ // and Disable commands, respectively, with the symbolic constants
+ // TEXTURE_2D or TEXTURE_CUBE_MAP_OES to enable the two-dimensional or cube
+ // map texturing respectively. If the cube map texture and the two-
+ // dimensional texture are enabled, then cube map texturing is used. If
+ // texturing is disabled, a rasterized fragment is passed on unaltered to the
+ // next stage of the GL (although its texture coordinates may be discarded).
+ // Otherwise, a texture value is found according to the parameter values of
+ // the currently bound texture image of the appropriate dimensionality.
+
+ texCubeEnables[i] = gles1State.isTextureTargetEnabled(i, TextureType::CubeMap);
+ tex2DEnables[i] =
+ !texCubeEnables[i] && (gles1State.isTextureTargetEnabled(i, TextureType::_2D));
+
+ Texture *curr2DTexture = glState->getSamplerTexture(i, TextureType::_2D);
+ if (curr2DTexture)
+ {
+ tex2DFormats[i] = gl::GetUnsizedFormat(
+ curr2DTexture->getFormat(TextureTarget::_2D, 0).info->internalFormat);
+
+ const gl::Rectangle &cropRect = curr2DTexture->getCrop();
+
+ GLfloat textureWidth =
+ static_cast<GLfloat>(curr2DTexture->getWidth(TextureTarget::_2D, 0));
+ GLfloat textureHeight =
+ static_cast<GLfloat>(curr2DTexture->getHeight(TextureTarget::_2D, 0));
+
+ if (textureWidth > 0.0f && textureHeight > 0.0f)
+ {
+ cropRectBuffer[i][0] = cropRect.x / textureWidth;
+ cropRectBuffer[i][1] = cropRect.y / textureHeight;
+ cropRectBuffer[i][2] = cropRect.width / textureWidth;
+ cropRectBuffer[i][3] = cropRect.height / textureHeight;
+ }
+ }
+ }
+
+ setUniform1iv(context, programObject, mProgramState.enableTexture2DLoc, kTexUnitCount,
+ tex2DEnables.data());
+ setUniform1iv(context, programObject, mProgramState.enableTextureCubeMapLoc, kTexUnitCount,
+ texCubeEnables.data());
+
+ setUniform1iv(context, programObject, mProgramState.textureFormatLoc, kTexUnitCount,
+ tex2DFormats.data());
+
+ setUniform4fv(programObject, mProgramState.drawTextureNormalizedCropRectLoc, kTexUnitCount,
+ reinterpret_cast<GLfloat *>(cropRectBuffer));
+ }
+
+ // Client state / current vector enables
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_CLIENT_STATE_ENABLE) ||
+ gles1State.isDirty(GLES1State::DIRTY_GLES1_CURRENT_VECTOR))
+ {
+ if (!gles1State.isClientStateEnabled(ClientVertexArrayType::Normal))
+ {
+ const angle::Vector3 normal = gles1State.getCurrentNormal();
+ context->vertexAttrib3f(kNormalAttribIndex, normal.x(), normal.y(), normal.z());
+ }
+
+ if (!gles1State.isClientStateEnabled(ClientVertexArrayType::Color))
+ {
+ const ColorF color = gles1State.getCurrentColor();
+ context->vertexAttrib4f(kColorAttribIndex, color.red, color.green, color.blue,
+ color.alpha);
+ }
+
+ if (!gles1State.isClientStateEnabled(ClientVertexArrayType::PointSize))
+ {
+ GLfloat pointSize = gles1State.mPointParameters.pointSize;
+ context->vertexAttrib1f(kPointSizeAttribIndex, pointSize);
+ }
+
+ for (int i = 0; i < kTexUnitCount; i++)
+ {
+ if (!gles1State.mTexCoordArrayEnabled[i])
+ {
+ const TextureCoordF texcoord = gles1State.getCurrentTextureCoords(i);
+ context->vertexAttrib4f(kTextureCoordAttribIndexBase + i, texcoord.s, texcoord.t,
+ texcoord.r, texcoord.q);
+ }
+ }
+ }
+
+ // Matrices
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_MATRICES))
+ {
+ angle::Mat4 proj = gles1State.mProjectionMatrices.back();
+ setUniformMatrix4fv(programObject, mProgramState.projMatrixLoc, 1, GL_FALSE, proj.data());
+
+ angle::Mat4 modelview = gles1State.mModelviewMatrices.back();
+ setUniformMatrix4fv(programObject, mProgramState.modelviewMatrixLoc, 1, GL_FALSE,
+ modelview.data());
+
+ angle::Mat4 modelviewInvTr = modelview.transpose().inverse();
+ setUniformMatrix4fv(programObject, mProgramState.modelviewInvTrLoc, 1, GL_FALSE,
+ modelviewInvTr.data());
+
+ Mat4Uniform *textureMatrixBuffer = uniformBuffers.textureMatrices.data();
+
+ for (int i = 0; i < kTexUnitCount; i++)
+ {
+ angle::Mat4 textureMatrix = gles1State.mTextureMatrices[i].back();
+ memcpy(textureMatrixBuffer + i, textureMatrix.data(), sizeof(Mat4Uniform));
+ }
+
+ setUniformMatrix4fv(programObject, mProgramState.textureMatrixLoc, kTexUnitCount, GL_FALSE,
+ reinterpret_cast<float *>(uniformBuffers.textureMatrices.data()));
+ }
+
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_TEXTURE_ENVIRONMENT))
+ {
+ for (int i = 0; i < kTexUnitCount; i++)
+ {
+ const auto &env = gles1State.textureEnvironment(i);
+
+ uniformBuffers.texEnvModes[i] = ToGLenum(env.mode);
+ uniformBuffers.texCombineRgbs[i] = ToGLenum(env.combineRgb);
+ uniformBuffers.texCombineAlphas[i] = ToGLenum(env.combineAlpha);
+
+ uniformBuffers.texCombineSrc0Rgbs[i] = ToGLenum(env.src0Rgb);
+ uniformBuffers.texCombineSrc0Alphas[i] = ToGLenum(env.src0Alpha);
+ uniformBuffers.texCombineSrc1Rgbs[i] = ToGLenum(env.src1Rgb);
+ uniformBuffers.texCombineSrc1Alphas[i] = ToGLenum(env.src1Alpha);
+ uniformBuffers.texCombineSrc2Rgbs[i] = ToGLenum(env.src2Rgb);
+ uniformBuffers.texCombineSrc2Alphas[i] = ToGLenum(env.src2Alpha);
+
+ uniformBuffers.texCombineOp0Rgbs[i] = ToGLenum(env.op0Rgb);
+ uniformBuffers.texCombineOp0Alphas[i] = ToGLenum(env.op0Alpha);
+ uniformBuffers.texCombineOp1Rgbs[i] = ToGLenum(env.op1Rgb);
+ uniformBuffers.texCombineOp1Alphas[i] = ToGLenum(env.op1Alpha);
+ uniformBuffers.texCombineOp2Rgbs[i] = ToGLenum(env.op2Rgb);
+ uniformBuffers.texCombineOp2Alphas[i] = ToGLenum(env.op2Alpha);
+
+ uniformBuffers.texEnvColors[i][0] = env.color.red;
+ uniformBuffers.texEnvColors[i][1] = env.color.green;
+ uniformBuffers.texEnvColors[i][2] = env.color.blue;
+ uniformBuffers.texEnvColors[i][3] = env.color.alpha;
+
+ uniformBuffers.texEnvRgbScales[i] = env.rgbScale;
+ uniformBuffers.texEnvAlphaScales[i] = env.alphaScale;
+
+ uniformBuffers.pointSpriteCoordReplaces[i] = env.pointSpriteCoordReplace;
+ }
+
+ setUniform1iv(context, programObject, mProgramState.textureEnvModeLoc, kTexUnitCount,
+ uniformBuffers.texEnvModes.data());
+ setUniform1iv(context, programObject, mProgramState.combineRgbLoc, kTexUnitCount,
+ uniformBuffers.texCombineRgbs.data());
+ setUniform1iv(context, programObject, mProgramState.combineAlphaLoc, kTexUnitCount,
+ uniformBuffers.texCombineAlphas.data());
+
+ setUniform1iv(context, programObject, mProgramState.src0rgbLoc, kTexUnitCount,
+ uniformBuffers.texCombineSrc0Rgbs.data());
+ setUniform1iv(context, programObject, mProgramState.src0alphaLoc, kTexUnitCount,
+ uniformBuffers.texCombineSrc0Alphas.data());
+ setUniform1iv(context, programObject, mProgramState.src1rgbLoc, kTexUnitCount,
+ uniformBuffers.texCombineSrc1Rgbs.data());
+ setUniform1iv(context, programObject, mProgramState.src1alphaLoc, kTexUnitCount,
+ uniformBuffers.texCombineSrc1Alphas.data());
+ setUniform1iv(context, programObject, mProgramState.src2rgbLoc, kTexUnitCount,
+ uniformBuffers.texCombineSrc2Rgbs.data());
+ setUniform1iv(context, programObject, mProgramState.src2alphaLoc, kTexUnitCount,
+ uniformBuffers.texCombineSrc2Alphas.data());
+
+ setUniform1iv(context, programObject, mProgramState.op0rgbLoc, kTexUnitCount,
+ uniformBuffers.texCombineOp0Rgbs.data());
+ setUniform1iv(context, programObject, mProgramState.op0alphaLoc, kTexUnitCount,
+ uniformBuffers.texCombineOp0Alphas.data());
+ setUniform1iv(context, programObject, mProgramState.op1rgbLoc, kTexUnitCount,
+ uniformBuffers.texCombineOp1Rgbs.data());
+ setUniform1iv(context, programObject, mProgramState.op1alphaLoc, kTexUnitCount,
+ uniformBuffers.texCombineOp1Alphas.data());
+ setUniform1iv(context, programObject, mProgramState.op2rgbLoc, kTexUnitCount,
+ uniformBuffers.texCombineOp2Rgbs.data());
+ setUniform1iv(context, programObject, mProgramState.op2alphaLoc, kTexUnitCount,
+ uniformBuffers.texCombineOp2Alphas.data());
+
+ setUniform4fv(programObject, mProgramState.textureEnvColorLoc, kTexUnitCount,
+ reinterpret_cast<float *>(uniformBuffers.texEnvColors.data()));
+ setUniform1fv(programObject, mProgramState.rgbScaleLoc, kTexUnitCount,
+ uniformBuffers.texEnvRgbScales.data());
+ setUniform1fv(programObject, mProgramState.alphaScaleLoc, kTexUnitCount,
+ uniformBuffers.texEnvAlphaScales.data());
+
+ setUniform1iv(context, programObject, mProgramState.pointSpriteCoordReplaceLoc,
+ kTexUnitCount, uniformBuffers.pointSpriteCoordReplaces.data());
+ }
+
+ // Alpha test
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_ALPHA_TEST))
+ {
+ setUniform1i(context, programObject, mProgramState.alphaFuncLoc,
+ ToGLenum(gles1State.mAlphaTestFunc));
+ setUniform1f(programObject, mProgramState.alphaTestRefLoc, gles1State.mAlphaTestRef);
+ }
+
+ // Shading, materials, and lighting
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_SHADE_MODEL))
+ {
+ setUniform1i(context, programObject, mProgramState.shadeModelFlatLoc,
+ gles1State.mShadeModel == ShadingModel::Flat);
+ }
+
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_MATERIAL))
+ {
+ const auto &material = gles1State.mMaterial;
+
+ setUniform4fv(programObject, mProgramState.materialAmbientLoc, 1, material.ambient.data());
+ setUniform4fv(programObject, mProgramState.materialDiffuseLoc, 1, material.diffuse.data());
+ setUniform4fv(programObject, mProgramState.materialSpecularLoc, 1,
+ material.specular.data());
+ setUniform4fv(programObject, mProgramState.materialEmissiveLoc, 1,
+ material.emissive.data());
+ setUniform1f(programObject, mProgramState.materialSpecularExponentLoc,
+ material.specularExponent);
+ }
+
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_LIGHTS))
+ {
+ const auto &lightModel = gles1State.mLightModel;
+
+ setUniform4fv(programObject, mProgramState.lightModelSceneAmbientLoc, 1,
+ lightModel.color.data());
+
+ // TODO (lfy@google.com): Implement two-sided lighting model
+ // gl->uniform1i(mProgramState.lightModelTwoSidedLoc, lightModel.twoSided);
+
+ for (int i = 0; i < kLightCount; i++)
+ {
+ const auto &light = gles1State.mLights[i];
+ uniformBuffers.lightEnables[i] = light.enabled;
+ memcpy(uniformBuffers.lightAmbients.data() + i, light.ambient.data(),
+ sizeof(Vec4Uniform));
+ memcpy(uniformBuffers.lightDiffuses.data() + i, light.diffuse.data(),
+ sizeof(Vec4Uniform));
+ memcpy(uniformBuffers.lightSpeculars.data() + i, light.specular.data(),
+ sizeof(Vec4Uniform));
+ memcpy(uniformBuffers.lightPositions.data() + i, light.position.data(),
+ sizeof(Vec4Uniform));
+ memcpy(uniformBuffers.lightDirections.data() + i, light.direction.data(),
+ sizeof(Vec3Uniform));
+ uniformBuffers.spotlightExponents[i] = light.spotlightExponent;
+ uniformBuffers.spotlightCutoffAngles[i] = light.spotlightCutoffAngle;
+ uniformBuffers.attenuationConsts[i] = light.attenuationConst;
+ uniformBuffers.attenuationLinears[i] = light.attenuationLinear;
+ uniformBuffers.attenuationQuadratics[i] = light.attenuationQuadratic;
+ }
+
+ setUniform1iv(context, programObject, mProgramState.lightEnablesLoc, kLightCount,
+ uniformBuffers.lightEnables.data());
+ setUniform4fv(programObject, mProgramState.lightAmbientsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.lightAmbients.data()));
+ setUniform4fv(programObject, mProgramState.lightDiffusesLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.lightDiffuses.data()));
+ setUniform4fv(programObject, mProgramState.lightSpecularsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.lightSpeculars.data()));
+ setUniform4fv(programObject, mProgramState.lightPositionsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.lightPositions.data()));
+ setUniform3fv(programObject, mProgramState.lightDirectionsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.lightDirections.data()));
+ setUniform1fv(programObject, mProgramState.lightSpotlightExponentsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.spotlightExponents.data()));
+ setUniform1fv(programObject, mProgramState.lightSpotlightCutoffAnglesLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.spotlightCutoffAngles.data()));
+ setUniform1fv(programObject, mProgramState.lightAttenuationConstsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.attenuationConsts.data()));
+ setUniform1fv(programObject, mProgramState.lightAttenuationLinearsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.attenuationLinears.data()));
+ setUniform1fv(programObject, mProgramState.lightAttenuationQuadraticsLoc, kLightCount,
+ reinterpret_cast<float *>(uniformBuffers.attenuationQuadratics.data()));
+ }
+
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_FOG))
+ {
+ const FogParameters &fog = gles1State.fogParameters();
+ setUniform1i(context, programObject, mProgramState.fogModeLoc, ToGLenum(fog.mode));
+ setUniform1f(programObject, mProgramState.fogDensityLoc, fog.density);
+ setUniform1f(programObject, mProgramState.fogStartLoc, fog.start);
+ setUniform1f(programObject, mProgramState.fogEndLoc, fog.end);
+ setUniform4fv(programObject, mProgramState.fogColorLoc, 1, fog.color.data());
+ }
+
+ // Clip planes
+ if (gles1State.isDirty(GLES1State::DIRTY_GLES1_CLIP_PLANES))
+ {
+ bool enableClipPlanes = false;
+ for (int i = 0; i < kClipPlaneCount; i++)
+ {
+ uniformBuffers.clipPlaneEnables[i] = glState->getEnableFeature(GL_CLIP_PLANE0 + i);
+ enableClipPlanes = enableClipPlanes || uniformBuffers.clipPlaneEnables[i];
+ gles1State.getClipPlane(
+ i, reinterpret_cast<float *>(uniformBuffers.clipPlanes.data() + i));
+ }
+
+ setUniform1i(context, programObject, mProgramState.enableClipPlanesLoc, enableClipPlanes);
+ setUniform1iv(context, programObject, mProgramState.clipPlaneEnablesLoc, kClipPlaneCount,
+ uniformBuffers.clipPlaneEnables.data());
+ setUniform4fv(programObject, mProgramState.clipPlanesLoc, kClipPlaneCount,
+ reinterpret_cast<float *>(uniformBuffers.clipPlanes.data()));
+ }
+
+ // Point rasterization
+ {
+ const PointParameters &pointParams = gles1State.mPointParameters;
+
+ setUniform1i(context, programObject, mProgramState.pointRasterizationLoc,
+ mode == PrimitiveMode::Points);
+ setUniform1i(context, programObject, mProgramState.pointSpriteEnabledLoc,
+ glState->getEnableFeature(GL_POINT_SPRITE_OES));
+ setUniform1f(programObject, mProgramState.pointSizeMinLoc, pointParams.pointSizeMin);
+ setUniform1f(programObject, mProgramState.pointSizeMaxLoc, pointParams.pointSizeMax);
+ setUniform3fv(programObject, mProgramState.pointDistanceAttenuationLoc, 1,
+ pointParams.pointDistanceAttenuation.data());
+ }
+
+ // Draw texture
+ {
+ setUniform1i(context, programObject, mProgramState.enableDrawTextureLoc,
+ mDrawTextureEnabled ? 1 : 0);
+ setUniform4fv(programObject, mProgramState.drawTextureCoordsLoc, 1, mDrawTextureCoords);
+ setUniform2fv(programObject, mProgramState.drawTextureDimsLoc, 1, mDrawTextureDims);
+ }
+
+ gles1State.clearDirty();
+ // None of those are changes in sampler, so there is no need to set the GL_PROGRAM dirty.
+ // Otherwise, put the dirtying here.
+
+ return angle::Result::Continue;
+}
+
+// static
+int GLES1Renderer::VertexArrayIndex(ClientVertexArrayType type, const GLES1State &gles1)
+{
+ switch (type)
+ {
+ case ClientVertexArrayType::Vertex:
+ return kVertexAttribIndex;
+ case ClientVertexArrayType::Normal:
+ return kNormalAttribIndex;
+ case ClientVertexArrayType::Color:
+ return kColorAttribIndex;
+ case ClientVertexArrayType::PointSize:
+ return kPointSizeAttribIndex;
+ case ClientVertexArrayType::TextureCoord:
+ return kTextureCoordAttribIndexBase + gles1.getClientTextureUnit();
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+// static
+int GLES1Renderer::TexCoordArrayIndex(unsigned int unit)
+{
+ return kTextureCoordAttribIndexBase + unit;
+}
+
+void GLES1Renderer::drawTexture(Context *context,
+ State *glState,
+ float x,
+ float y,
+ float z,
+ float width,
+ float height)
+{
+
+ // get viewport
+ const gl::Rectangle &viewport = glState->getViewport();
+
+ // Translate from viewport to NDC for feeding the shader.
+ // Recenter, rescale. (e.g., [0, 0, 1080, 1920] -> [-1, -1, 1, 1])
+ float xNdc = scaleScreenCoordinateToNdc(x, static_cast<GLfloat>(viewport.width));
+ float yNdc = scaleScreenCoordinateToNdc(y, static_cast<GLfloat>(viewport.height));
+ float wNdc = scaleScreenDimensionToNdc(width, static_cast<GLfloat>(viewport.width));
+ float hNdc = scaleScreenDimensionToNdc(height, static_cast<GLfloat>(viewport.height));
+
+ float zNdc = 2.0f * clamp(z, 0.0f, 1.0f) - 1.0f;
+
+ mDrawTextureCoords[0] = xNdc;
+ mDrawTextureCoords[1] = yNdc;
+ mDrawTextureCoords[2] = zNdc;
+
+ mDrawTextureDims[0] = wNdc;
+ mDrawTextureDims[1] = hNdc;
+
+ mDrawTextureEnabled = true;
+
+ AttributesMask prevAttributesMask = glState->gles1().getVertexArraysAttributeMask();
+
+ setAttributesEnabled(context, glState, AttributesMask());
+
+ glState->gles1().setAllDirty();
+
+ context->drawArrays(PrimitiveMode::Triangles, 0, 6);
+
+ setAttributesEnabled(context, glState, prevAttributesMask);
+
+ mDrawTextureEnabled = false;
+}
+
+Shader *GLES1Renderer::getShader(GLuint handle) const
+{
+ return mShaderPrograms->getShader(handle);
+}
+
+Program *GLES1Renderer::getProgram(GLuint handle) const
+{
+ return mShaderPrograms->getProgram(handle);
+}
+
+angle::Result GLES1Renderer::compileShader(Context *context,
+ ShaderType shaderType,
+ const char *src,
+ GLuint *shaderOut)
+{
+ rx::ContextImpl *implementation = context->getImplementation();
+ const Limitations &limitations = implementation->getNativeLimitations();
+
+ GLuint shader = mShaderPrograms->createShader(implementation, limitations, shaderType);
+
+ Shader *shaderObject = getShader(shader);
+ ANGLE_CHECK(context, shaderObject, "Missing shader object", GL_INVALID_OPERATION);
+
+ shaderObject->setSource(1, &src, nullptr);
+ shaderObject->compile(context);
+
+ *shaderOut = shader;
+
+ if (!shaderObject->isCompiled())
+ {
+ GLint infoLogLength = shaderObject->getInfoLogLength();
+ std::vector<char> infoLog(infoLogLength, 0);
+ shaderObject->getInfoLog(infoLogLength - 1, nullptr, infoLog.data());
+
+ ERR() << "Internal GLES 1 shader compile failed. Info log: " << infoLog.data();
+ ANGLE_CHECK(context, false, "GLES1Renderer shader compile failed.", GL_INVALID_OPERATION);
+ return angle::Result::Stop;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result GLES1Renderer::linkProgram(Context *context,
+ State *glState,
+ GLuint vertexShader,
+ GLuint fragmentShader,
+ const std::unordered_map<GLint, std::string> &attribLocs,
+ GLuint *programOut)
+{
+ GLuint program = mShaderPrograms->createProgram(context->getImplementation());
+
+ Program *programObject = getProgram(program);
+ ANGLE_CHECK(context, programObject, "Missing program object", GL_INVALID_OPERATION);
+
+ *programOut = program;
+
+ programObject->attachShader(getShader(vertexShader));
+ programObject->attachShader(getShader(fragmentShader));
+
+ for (auto it : attribLocs)
+ {
+ GLint index = it.first;
+ const std::string &name = it.second;
+ programObject->bindAttributeLocation(index, name.c_str());
+ }
+
+ ANGLE_TRY(programObject->link(context));
+ programObject->resolveLink(context);
+
+ ANGLE_TRY(glState->onProgramExecutableChange(context, programObject));
+
+ if (!programObject->isLinked())
+ {
+ GLint infoLogLength = programObject->getInfoLogLength();
+ std::vector<char> infoLog(infoLogLength, 0);
+ programObject->getInfoLog(infoLogLength - 1, nullptr, infoLog.data());
+
+ ERR() << "Internal GLES 1 shader link failed. Info log: " << infoLog.data();
+ ANGLE_CHECK(context, false, "GLES1Renderer program link failed.", GL_INVALID_OPERATION);
+ return angle::Result::Stop;
+ }
+
+ programObject->detachShader(context, getShader(vertexShader));
+ programObject->detachShader(context, getShader(fragmentShader));
+
+ return angle::Result::Continue;
+}
+
+angle::Result GLES1Renderer::initializeRendererProgram(Context *context, State *glState)
+{
+ if (mRendererProgramInitialized)
+ {
+ return angle::Result::Continue;
+ }
+
+ mShaderPrograms = new ShaderProgramManager();
+
+ GLuint vertexShader;
+ GLuint fragmentShader;
+
+ ANGLE_TRY(compileShader(context, ShaderType::Vertex, kGLES1DrawVShader, &vertexShader));
+
+ std::stringstream fragmentStream;
+ fragmentStream << kGLES1DrawFShaderHeader;
+ fragmentStream << kGLES1DrawFShaderUniformDefs;
+ fragmentStream << kGLES1DrawFShaderFunctions;
+ fragmentStream << kGLES1DrawFShaderMultitexturing;
+ fragmentStream << kGLES1DrawFShaderMain;
+
+ ANGLE_TRY(compileShader(context, ShaderType::Fragment, fragmentStream.str().c_str(),
+ &fragmentShader));
+
+ std::unordered_map<GLint, std::string> attribLocs;
+
+ attribLocs[(GLint)kVertexAttribIndex] = "pos";
+ attribLocs[(GLint)kNormalAttribIndex] = "normal";
+ attribLocs[(GLint)kColorAttribIndex] = "color";
+ attribLocs[(GLint)kPointSizeAttribIndex] = "pointsize";
+
+ for (int i = 0; i < kTexUnitCount; i++)
+ {
+ std::stringstream ss;
+ ss << "texcoord" << i;
+ attribLocs[kTextureCoordAttribIndexBase + i] = ss.str();
+ }
+
+ ANGLE_TRY(linkProgram(context, glState, vertexShader, fragmentShader, attribLocs,
+ &mProgramState.program));
+
+ mShaderPrograms->deleteShader(context, vertexShader);
+ mShaderPrograms->deleteShader(context, fragmentShader);
+
+ Program *programObject = getProgram(mProgramState.program);
+
+ mProgramState.projMatrixLoc = programObject->getUniformLocation("projection");
+ mProgramState.modelviewMatrixLoc = programObject->getUniformLocation("modelview");
+ mProgramState.textureMatrixLoc = programObject->getUniformLocation("texture_matrix");
+ mProgramState.modelviewInvTrLoc = programObject->getUniformLocation("modelview_invtr");
+
+ for (int i = 0; i < kTexUnitCount; i++)
+ {
+ std::stringstream ss2d;
+ std::stringstream sscube;
+
+ ss2d << "tex_sampler" << i;
+ sscube << "tex_cube_sampler" << i;
+
+ mProgramState.tex2DSamplerLocs[i] = programObject->getUniformLocation(ss2d.str().c_str());
+ mProgramState.texCubeSamplerLocs[i] =
+ programObject->getUniformLocation(sscube.str().c_str());
+ }
+
+ mProgramState.enableTexture2DLoc = programObject->getUniformLocation("enable_texture_2d");
+ mProgramState.enableTextureCubeMapLoc =
+ programObject->getUniformLocation("enable_texture_cube_map");
+
+ mProgramState.textureFormatLoc = programObject->getUniformLocation("texture_format");
+ mProgramState.textureEnvModeLoc = programObject->getUniformLocation("texture_env_mode");
+ mProgramState.combineRgbLoc = programObject->getUniformLocation("combine_rgb");
+ mProgramState.combineAlphaLoc = programObject->getUniformLocation("combine_alpha");
+ mProgramState.src0rgbLoc = programObject->getUniformLocation("src0_rgb");
+ mProgramState.src0alphaLoc = programObject->getUniformLocation("src0_alpha");
+ mProgramState.src1rgbLoc = programObject->getUniformLocation("src1_rgb");
+ mProgramState.src1alphaLoc = programObject->getUniformLocation("src1_alpha");
+ mProgramState.src2rgbLoc = programObject->getUniformLocation("src2_rgb");
+ mProgramState.src2alphaLoc = programObject->getUniformLocation("src2_alpha");
+ mProgramState.op0rgbLoc = programObject->getUniformLocation("op0_rgb");
+ mProgramState.op0alphaLoc = programObject->getUniformLocation("op0_alpha");
+ mProgramState.op1rgbLoc = programObject->getUniformLocation("op1_rgb");
+ mProgramState.op1alphaLoc = programObject->getUniformLocation("op1_alpha");
+ mProgramState.op2rgbLoc = programObject->getUniformLocation("op2_rgb");
+ mProgramState.op2alphaLoc = programObject->getUniformLocation("op2_alpha");
+ mProgramState.textureEnvColorLoc = programObject->getUniformLocation("texture_env_color");
+ mProgramState.rgbScaleLoc = programObject->getUniformLocation("texture_env_rgb_scale");
+ mProgramState.alphaScaleLoc = programObject->getUniformLocation("texture_env_alpha_scale");
+ mProgramState.pointSpriteCoordReplaceLoc =
+ programObject->getUniformLocation("point_sprite_coord_replace");
+
+ mProgramState.enableAlphaTestLoc = programObject->getUniformLocation("enable_alpha_test");
+ mProgramState.alphaFuncLoc = programObject->getUniformLocation("alpha_func");
+ mProgramState.alphaTestRefLoc = programObject->getUniformLocation("alpha_test_ref");
+
+ mProgramState.shadeModelFlatLoc = programObject->getUniformLocation("shade_model_flat");
+ mProgramState.enableLightingLoc = programObject->getUniformLocation("enable_lighting");
+ mProgramState.enableRescaleNormalLoc =
+ programObject->getUniformLocation("enable_rescale_normal");
+ mProgramState.enableNormalizeLoc = programObject->getUniformLocation("enable_normalize");
+ mProgramState.enableColorMaterialLoc =
+ programObject->getUniformLocation("enable_color_material");
+
+ mProgramState.materialAmbientLoc = programObject->getUniformLocation("material_ambient");
+ mProgramState.materialDiffuseLoc = programObject->getUniformLocation("material_diffuse");
+ mProgramState.materialSpecularLoc = programObject->getUniformLocation("material_specular");
+ mProgramState.materialEmissiveLoc = programObject->getUniformLocation("material_emissive");
+ mProgramState.materialSpecularExponentLoc =
+ programObject->getUniformLocation("material_specular_exponent");
+
+ mProgramState.lightModelSceneAmbientLoc =
+ programObject->getUniformLocation("light_model_scene_ambient");
+ mProgramState.lightModelTwoSidedLoc =
+ programObject->getUniformLocation("light_model_two_sided");
+
+ mProgramState.lightEnablesLoc = programObject->getUniformLocation("light_enables");
+ mProgramState.lightAmbientsLoc = programObject->getUniformLocation("light_ambients");
+ mProgramState.lightDiffusesLoc = programObject->getUniformLocation("light_diffuses");
+ mProgramState.lightSpecularsLoc = programObject->getUniformLocation("light_speculars");
+ mProgramState.lightPositionsLoc = programObject->getUniformLocation("light_positions");
+ mProgramState.lightDirectionsLoc = programObject->getUniformLocation("light_directions");
+ mProgramState.lightSpotlightExponentsLoc =
+ programObject->getUniformLocation("light_spotlight_exponents");
+ mProgramState.lightSpotlightCutoffAnglesLoc =
+ programObject->getUniformLocation("light_spotlight_cutoff_angles");
+ mProgramState.lightAttenuationConstsLoc =
+ programObject->getUniformLocation("light_attenuation_consts");
+ mProgramState.lightAttenuationLinearsLoc =
+ programObject->getUniformLocation("light_attenuation_linears");
+ mProgramState.lightAttenuationQuadraticsLoc =
+ programObject->getUniformLocation("light_attenuation_quadratics");
+
+ mProgramState.fogEnableLoc = programObject->getUniformLocation("enable_fog");
+ mProgramState.fogModeLoc = programObject->getUniformLocation("fog_mode");
+ mProgramState.fogDensityLoc = programObject->getUniformLocation("fog_density");
+ mProgramState.fogStartLoc = programObject->getUniformLocation("fog_start");
+ mProgramState.fogEndLoc = programObject->getUniformLocation("fog_end");
+ mProgramState.fogColorLoc = programObject->getUniformLocation("fog_color");
+
+ mProgramState.enableClipPlanesLoc = programObject->getUniformLocation("enable_clip_planes");
+ mProgramState.clipPlaneEnablesLoc = programObject->getUniformLocation("clip_plane_enables");
+ mProgramState.clipPlanesLoc = programObject->getUniformLocation("clip_planes");
+
+ mProgramState.pointRasterizationLoc = programObject->getUniformLocation("point_rasterization");
+ mProgramState.pointSizeMinLoc = programObject->getUniformLocation("point_size_min");
+ mProgramState.pointSizeMaxLoc = programObject->getUniformLocation("point_size_max");
+ mProgramState.pointDistanceAttenuationLoc =
+ programObject->getUniformLocation("point_distance_attenuation");
+ mProgramState.pointSpriteEnabledLoc = programObject->getUniformLocation("point_sprite_enabled");
+
+ mProgramState.enableDrawTextureLoc = programObject->getUniformLocation("enable_draw_texture");
+ mProgramState.drawTextureCoordsLoc = programObject->getUniformLocation("draw_texture_coords");
+ mProgramState.drawTextureDimsLoc = programObject->getUniformLocation("draw_texture_dims");
+ mProgramState.drawTextureNormalizedCropRectLoc =
+ programObject->getUniformLocation("draw_texture_normalized_crop_rect");
+
+ ANGLE_TRY(glState->setProgram(context, programObject));
+
+ for (int i = 0; i < kTexUnitCount; i++)
+ {
+ setUniform1i(context, programObject, mProgramState.tex2DSamplerLocs[i], i);
+ setUniform1i(context, programObject, mProgramState.texCubeSamplerLocs[i],
+ i + kTexUnitCount);
+ }
+
+ glState->setObjectDirty(GL_PROGRAM);
+
+ mRendererProgramInitialized = true;
+ return angle::Result::Continue;
+}
+
+void GLES1Renderer::setUniform1i(Context *context, Program *programObject, GLint loc, GLint value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniform1iv(context, loc, 1, &value);
+}
+
+void GLES1Renderer::setUniform1iv(Context *context,
+ Program *programObject,
+ GLint loc,
+ GLint count,
+ const GLint *value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniform1iv(context, loc, count, value);
+}
+
+void GLES1Renderer::setUniformMatrix4fv(Program *programObject,
+ GLint loc,
+ GLint count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniformMatrix4fv(loc, count, transpose, value);
+}
+
+void GLES1Renderer::setUniform4fv(Program *programObject,
+ GLint loc,
+ GLint count,
+ const GLfloat *value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniform4fv(loc, count, value);
+}
+
+void GLES1Renderer::setUniform3fv(Program *programObject,
+ GLint loc,
+ GLint count,
+ const GLfloat *value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniform3fv(loc, count, value);
+}
+
+void GLES1Renderer::setUniform2fv(Program *programObject,
+ GLint loc,
+ GLint count,
+ const GLfloat *value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniform2fv(loc, count, value);
+}
+
+void GLES1Renderer::setUniform1f(Program *programObject, GLint loc, GLfloat value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniform1fv(loc, 1, &value);
+}
+
+void GLES1Renderer::setUniform1fv(Program *programObject,
+ GLint loc,
+ GLint count,
+ const GLfloat *value)
+{
+ if (loc == -1)
+ return;
+ programObject->setUniform1fv(loc, count, value);
+}
+
+void GLES1Renderer::setAttributesEnabled(Context *context, State *glState, AttributesMask mask)
+{
+ GLES1State &gles1 = glState->gles1();
+
+ ClientVertexArrayType nonTexcoordArrays[] = {
+ ClientVertexArrayType::Vertex,
+ ClientVertexArrayType::Normal,
+ ClientVertexArrayType::Color,
+ ClientVertexArrayType::PointSize,
+ };
+
+ for (const ClientVertexArrayType attrib : nonTexcoordArrays)
+ {
+ int index = VertexArrayIndex(attrib, glState->gles1());
+
+ if (mask.test(index))
+ {
+ gles1.setClientStateEnabled(attrib, true);
+ context->enableVertexAttribArray(index);
+ }
+ else
+ {
+ gles1.setClientStateEnabled(attrib, false);
+ context->disableVertexAttribArray(index);
+ }
+ }
+
+ for (unsigned int i = 0; i < kTexUnitCount; i++)
+ {
+ int index = TexCoordArrayIndex(i);
+
+ if (mask.test(index))
+ {
+ gles1.setTexCoordArrayEnabled(i, true);
+ context->enableVertexAttribArray(index);
+ }
+ else
+ {
+ gles1.setTexCoordArrayEnabled(i, false);
+ context->disableVertexAttribArray(index);
+ }
+ }
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/GLES1Renderer.h b/gfx/angle/checkout/src/libANGLE/GLES1Renderer.h
new file mode 100644
index 0000000000..f2b592adcb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/GLES1Renderer.h
@@ -0,0 +1,259 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// GLES1Renderer.h: Defines GLES1 emulation rendering operations on top of a GLES3
+// context. Used by Context.h.
+
+#ifndef LIBANGLE_GLES1_RENDERER_H_
+#define LIBANGLE_GLES1_RENDERER_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/angletypes.h"
+
+#include <memory>
+#include <string>
+#include <unordered_map>
+
+namespace gl
+{
+class Context;
+class GLES1State;
+class Program;
+class State;
+class Shader;
+class ShaderProgramManager;
+
+class GLES1Renderer final : angle::NonCopyable
+{
+ public:
+ GLES1Renderer();
+ ~GLES1Renderer();
+
+ void onDestroy(Context *context, State *state);
+
+ angle::Result prepareForDraw(PrimitiveMode mode, Context *context, State *glState);
+
+ static int VertexArrayIndex(ClientVertexArrayType type, const GLES1State &gles1);
+ static int TexCoordArrayIndex(unsigned int unit);
+
+ void drawTexture(Context *context,
+ State *glState,
+ float x,
+ float y,
+ float z,
+ float width,
+ float height);
+
+ static constexpr int kTexUnitCount = 4;
+
+ private:
+ using Mat4Uniform = float[16];
+ using Vec4Uniform = float[4];
+ using Vec3Uniform = float[3];
+
+ Shader *getShader(GLuint handle) const;
+ Program *getProgram(GLuint handle) const;
+
+ angle::Result compileShader(Context *context,
+ ShaderType shaderType,
+ const char *src,
+ GLuint *shaderOut);
+ angle::Result linkProgram(Context *context,
+ State *glState,
+ GLuint vshader,
+ GLuint fshader,
+ const std::unordered_map<GLint, std::string> &attribLocs,
+ GLuint *programOut);
+ angle::Result initializeRendererProgram(Context *context, State *glState);
+
+ void setUniform1i(Context *context, Program *programObject, GLint loc, GLint value);
+ void setUniform1iv(Context *context,
+ Program *programObject,
+ GLint loc,
+ GLint count,
+ const GLint *value);
+ void setUniformMatrix4fv(Program *programObject,
+ GLint loc,
+ GLint count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniform4fv(Program *programObject, GLint loc, GLint count, const GLfloat *value);
+ void setUniform3fv(Program *programObject, GLint loc, GLint count, const GLfloat *value);
+ void setUniform2fv(Program *programObject, GLint loc, GLint count, const GLfloat *value);
+ void setUniform1f(Program *programObject, GLint loc, GLfloat value);
+ void setUniform1fv(Program *programObject, GLint loc, GLint count, const GLfloat *value);
+
+ void setAttributesEnabled(Context *context, State *glState, AttributesMask mask);
+
+ static constexpr int kLightCount = 8;
+ static constexpr int kClipPlaneCount = 6;
+
+ static constexpr int kVertexAttribIndex = 0;
+ static constexpr int kNormalAttribIndex = 1;
+ static constexpr int kColorAttribIndex = 2;
+ static constexpr int kPointSizeAttribIndex = 3;
+ static constexpr int kTextureCoordAttribIndexBase = 4;
+
+ bool mRendererProgramInitialized;
+ ShaderProgramManager *mShaderPrograms;
+
+ struct GLES1ProgramState
+ {
+ GLuint program;
+
+ GLint projMatrixLoc;
+ GLint modelviewMatrixLoc;
+ GLint textureMatrixLoc;
+ GLint modelviewInvTrLoc;
+
+ // Texturing
+ GLint enableTexture2DLoc;
+ GLint enableTextureCubeMapLoc;
+ std::array<GLint, kTexUnitCount> tex2DSamplerLocs;
+ std::array<GLint, kTexUnitCount> texCubeSamplerLocs;
+
+ GLint textureFormatLoc;
+
+ GLint textureEnvModeLoc;
+ GLint combineRgbLoc;
+ GLint combineAlphaLoc;
+ GLint src0rgbLoc;
+ GLint src0alphaLoc;
+ GLint src1rgbLoc;
+ GLint src1alphaLoc;
+ GLint src2rgbLoc;
+ GLint src2alphaLoc;
+ GLint op0rgbLoc;
+ GLint op0alphaLoc;
+ GLint op1rgbLoc;
+ GLint op1alphaLoc;
+ GLint op2rgbLoc;
+ GLint op2alphaLoc;
+ GLint textureEnvColorLoc;
+ GLint rgbScaleLoc;
+ GLint alphaScaleLoc;
+ GLint pointSpriteCoordReplaceLoc;
+
+ // Alpha test
+ GLint enableAlphaTestLoc;
+ GLint alphaFuncLoc;
+ GLint alphaTestRefLoc;
+
+ // Shading, materials, and lighting
+ GLint shadeModelFlatLoc;
+ GLint enableLightingLoc;
+ GLint enableRescaleNormalLoc;
+ GLint enableNormalizeLoc;
+ GLint enableColorMaterialLoc;
+
+ GLint materialAmbientLoc;
+ GLint materialDiffuseLoc;
+ GLint materialSpecularLoc;
+ GLint materialEmissiveLoc;
+ GLint materialSpecularExponentLoc;
+
+ GLint lightModelSceneAmbientLoc;
+ GLint lightModelTwoSidedLoc;
+
+ GLint lightEnablesLoc;
+ GLint lightAmbientsLoc;
+ GLint lightDiffusesLoc;
+ GLint lightSpecularsLoc;
+ GLint lightPositionsLoc;
+ GLint lightDirectionsLoc;
+ GLint lightSpotlightExponentsLoc;
+ GLint lightSpotlightCutoffAnglesLoc;
+ GLint lightAttenuationConstsLoc;
+ GLint lightAttenuationLinearsLoc;
+ GLint lightAttenuationQuadraticsLoc;
+
+ // Fog
+ GLint fogEnableLoc;
+ GLint fogModeLoc;
+ GLint fogDensityLoc;
+ GLint fogStartLoc;
+ GLint fogEndLoc;
+ GLint fogColorLoc;
+
+ // Clip planes
+ GLint enableClipPlanesLoc;
+ GLint clipPlaneEnablesLoc;
+ GLint clipPlanesLoc;
+
+ // Point rasterization
+ GLint pointRasterizationLoc;
+ GLint pointSizeMinLoc;
+ GLint pointSizeMaxLoc;
+ GLint pointDistanceAttenuationLoc;
+ GLint pointSpriteEnabledLoc;
+
+ // Draw texture
+ GLint enableDrawTextureLoc;
+ GLint drawTextureCoordsLoc;
+ GLint drawTextureDimsLoc;
+ GLint drawTextureNormalizedCropRectLoc;
+ };
+
+ struct GLES1UniformBuffers
+ {
+ std::array<Mat4Uniform, kTexUnitCount> textureMatrices;
+ std::array<GLint, kTexUnitCount> tex2DEnables;
+ std::array<GLint, kTexUnitCount> texCubeEnables;
+
+ std::array<GLint, kTexUnitCount> texEnvModes;
+ std::array<GLint, kTexUnitCount> texCombineRgbs;
+ std::array<GLint, kTexUnitCount> texCombineAlphas;
+
+ std::array<GLint, kTexUnitCount> texCombineSrc0Rgbs;
+ std::array<GLint, kTexUnitCount> texCombineSrc0Alphas;
+ std::array<GLint, kTexUnitCount> texCombineSrc1Rgbs;
+ std::array<GLint, kTexUnitCount> texCombineSrc1Alphas;
+ std::array<GLint, kTexUnitCount> texCombineSrc2Rgbs;
+ std::array<GLint, kTexUnitCount> texCombineSrc2Alphas;
+ std::array<GLint, kTexUnitCount> texCombineOp0Rgbs;
+ std::array<GLint, kTexUnitCount> texCombineOp0Alphas;
+ std::array<GLint, kTexUnitCount> texCombineOp1Rgbs;
+ std::array<GLint, kTexUnitCount> texCombineOp1Alphas;
+ std::array<GLint, kTexUnitCount> texCombineOp2Rgbs;
+ std::array<GLint, kTexUnitCount> texCombineOp2Alphas;
+ std::array<Vec4Uniform, kTexUnitCount> texEnvColors;
+ std::array<GLfloat, kTexUnitCount> texEnvRgbScales;
+ std::array<GLfloat, kTexUnitCount> texEnvAlphaScales;
+ std::array<GLint, kTexUnitCount> pointSpriteCoordReplaces;
+
+ // Lighting
+ std::array<GLint, kLightCount> lightEnables;
+ std::array<Vec4Uniform, kLightCount> lightAmbients;
+ std::array<Vec4Uniform, kLightCount> lightDiffuses;
+ std::array<Vec4Uniform, kLightCount> lightSpeculars;
+ std::array<Vec4Uniform, kLightCount> lightPositions;
+ std::array<Vec3Uniform, kLightCount> lightDirections;
+ std::array<GLfloat, kLightCount> spotlightExponents;
+ std::array<GLfloat, kLightCount> spotlightCutoffAngles;
+ std::array<GLfloat, kLightCount> attenuationConsts;
+ std::array<GLfloat, kLightCount> attenuationLinears;
+ std::array<GLfloat, kLightCount> attenuationQuadratics;
+
+ // Clip planes
+ std::array<GLint, kClipPlaneCount> clipPlaneEnables;
+ std::array<Vec4Uniform, kClipPlaneCount> clipPlanes;
+
+ // Texture crop rectangles
+ std::array<Vec4Uniform, kTexUnitCount> texCropRects;
+ };
+
+ GLES1UniformBuffers mUniformBuffers;
+ GLES1ProgramState mProgramState;
+
+ bool mDrawTextureEnabled = false;
+ GLfloat mDrawTextureCoords[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ GLfloat mDrawTextureDims[2] = {0.0f, 0.0f};
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_GLES1_RENDERER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/GLES1Shaders.inc b/gfx/angle/checkout/src/libANGLE/GLES1Shaders.inc
new file mode 100644
index 0000000000..b9b5961cdc
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/GLES1Shaders.inc
@@ -0,0 +1,1110 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// GLES1Shaders.inc: Defines GLES1 emulation shader.
+
+constexpr char kGLES1DrawVShader[] = R"(#version 300 es
+precision highp float;
+
+#define kMaxTexUnits 4
+
+in vec4 pos;
+in vec3 normal;
+in vec4 color;
+in float pointsize;
+in vec4 texcoord0;
+in vec4 texcoord1;
+in vec4 texcoord2;
+in vec4 texcoord3;
+
+uniform mat4 projection;
+uniform mat4 modelview;
+uniform mat4 modelview_invtr;
+uniform mat4 texture_matrix[kMaxTexUnits];
+
+uniform bool enable_rescale_normal;
+uniform bool enable_normalize;
+
+// Point rasterization//////////////////////////////////////////////////////////
+
+uniform bool point_rasterization;
+uniform float point_size_min;
+uniform float point_size_max;
+uniform vec3 point_distance_attenuation;
+
+// GL_OES_draw_texture uniforms/////////////////////////////////////////////////
+
+uniform bool enable_draw_texture;
+uniform vec4 draw_texture_coords;
+uniform vec2 draw_texture_dims;
+uniform vec4 draw_texture_normalized_crop_rect[kMaxTexUnits];
+
+// Varyings/////////////////////////////////////////////////////////////////////
+
+out vec4 pos_varying;
+out vec3 normal_varying;
+out vec4 color_varying;
+flat out vec4 color_varying_flat;
+out vec4 texcoord0_varying;
+out vec4 texcoord1_varying;
+out vec4 texcoord2_varying;
+out vec4 texcoord3_varying;
+
+const vec4 drawTextureVertices[6] = vec4[](
+ vec4(0.0, 0.0, 0.0, 1.0),
+ vec4(1.0, 0.0, 0.0, 1.0),
+ vec4(1.0, 1.0, 0.0, 1.0),
+ vec4(0.0, 0.0, 0.0, 1.0),
+ vec4(1.0, 1.0, 0.0, 1.0),
+ vec4(0.0, 1.0, 0.0, 1.0));
+
+vec4 drawTexturePosition(int vertexId)
+{
+
+ float drawTexX = draw_texture_coords[0];
+ float drawTexY = draw_texture_coords[1];
+ float drawTexZ = draw_texture_coords[2];
+ float drawTexW = draw_texture_dims[0];
+ float drawTexH = draw_texture_dims[1];
+
+ return vec4(drawTexX, drawTexY, drawTexZ, 0.0) +
+ drawTextureVertices[vertexId] *
+ vec4(drawTexW, drawTexH, 1.0, 1.0);
+}
+
+vec4 drawTextureTexCoord(int vertexId, int textureUnit)
+{
+ float texCropU = draw_texture_normalized_crop_rect[textureUnit].x;
+ float texCropV = draw_texture_normalized_crop_rect[textureUnit].y;
+ float texCropW = draw_texture_normalized_crop_rect[textureUnit].z;
+ float texCropH = draw_texture_normalized_crop_rect[textureUnit].w;
+
+ return vec4(texCropU, texCropV, 0.0, 0.0) +
+ drawTextureVertices[vertexId] *
+ vec4(texCropW, texCropH, 0.0, 0.0);
+}
+
+vec4 calcWorldPosition(vec4 posInput)
+{
+ return modelview * posInput;
+}
+
+vec4 calcNdcFromWorldPosition(vec4 worldPos)
+{
+ return projection * worldPos;
+}
+
+float calcPointSize(vec4 ndcPos)
+{
+ float dist = length(ndcPos.z);
+ float attConst = point_distance_attenuation[0];
+ float attLinear = point_distance_attenuation[1];
+ float attQuad = point_distance_attenuation[2];
+ float attPart = attConst + attLinear * dist + attQuad * dist * dist;
+ float attPointSize = pointsize / pow(attPart, 0.5);
+
+ return clamp(attPointSize, point_size_min, point_size_max);
+}
+
+vec3 calcNormal(vec3 normalInput)
+{
+ mat3 mvInvTr3 = mat3(modelview_invtr);
+ vec3 result = mvInvTr3 * normalInput;
+
+ if (enable_rescale_normal)
+ {
+ float rescale = 1.0;
+ vec3 rescaleVec = vec3(mvInvTr3[2]);
+ float len = length(rescaleVec);
+ if (len > 0.0)
+ {
+ rescale = 1.0 / len;
+ }
+ result *= rescale;
+ }
+
+ if (enable_normalize)
+ {
+ result = normalize(result);
+ }
+
+ return result;
+}
+
+void main()
+{
+ color_varying = color;
+ color_varying_flat = color;
+
+ if (enable_draw_texture)
+ {
+ int vertexId = gl_VertexID;
+ vec4 posDrawTexture = drawTexturePosition(vertexId);
+
+ gl_Position = posDrawTexture;
+ pos_varying = posDrawTexture;
+
+ normal_varying = normal;
+
+ gl_PointSize = pointsize;
+
+ texcoord0_varying = drawTextureTexCoord(vertexId, 0);
+ texcoord1_varying = drawTextureTexCoord(vertexId, 1);
+ texcoord2_varying = drawTextureTexCoord(vertexId, 2);
+ texcoord3_varying = drawTextureTexCoord(vertexId, 3);
+ }
+ else
+ {
+ vec4 worldPos = calcWorldPosition(pos);
+ vec4 ndcPos = calcNdcFromWorldPosition(worldPos);
+
+ gl_Position = ndcPos;
+ pos_varying = worldPos;
+
+ normal_varying = calcNormal(normal);
+
+ // Avoid calculating point size stuff
+ // if we are not rendering points.
+ if (point_rasterization)
+ {
+ gl_PointSize = calcPointSize(ndcPos);
+ }
+ else
+ {
+ gl_PointSize = pointsize;
+ }
+
+ texcoord0_varying = texture_matrix[0] * texcoord0;
+ texcoord1_varying = texture_matrix[1] * texcoord1;
+ texcoord2_varying = texture_matrix[2] * texcoord2;
+ texcoord3_varying = texture_matrix[3] * texcoord3;
+ }
+}
+)";
+
+// version, flat,
+constexpr char kGLES1DrawFShaderHeader[] = R"(#version 300 es
+precision highp float;
+
+// Defines for GL constants
+#define kMaxLights 8
+#define kMaxTexUnits 4
+#define kMaxClipPlanes 6
+
+#define kModulate 0x2100
+#define kDecal 0x2101
+#define kCombine 0x8570
+#define kReplace 0x1E01
+#define kBlend 0x0BE2
+#define kAdd 0x0104
+
+#define kAddSigned 0x8574
+#define kInterpolate 0x8575
+#define kSubtract 0x84E7
+#define kDot3Rgb 0x86AE
+#define kDot3Rgba 0x86AF
+
+#define kAlpha 0x1906
+#define kRGB 0x1907
+#define kRGBA 0x1908
+#define kLuminance 0x1909
+#define kLuminanceAlpha 0x190A
+
+#define kTexture 0x1702
+#define kConstant 0x8576
+#define kPrimaryColor 0x8577
+#define kPrevious 0x8578
+
+#define kSrcColor 0x0300
+#define kOneMinusSrcColor 0x0301
+#define kSrcAlpha 0x0302
+#define kOneMinusSrcAlpha 0x0303
+
+#define kLinear 0x2601
+#define kExp 0x0800
+#define kExp2 0x0801
+
+#define kNever 0x0200
+#define kLess 0x0201
+#define kEqual 0x0202
+#define kLequal 0x0203
+#define kGreater 0x0204
+#define kNotequal 0x0205
+#define kGequal 0x0206
+#define kAlways 0x0207
+#define kZero 0x0
+#define kOne 0x1
+
+#define kClear 0x1500
+#define kAnd 0x1501
+#define kAnd_reverse 0x1502
+#define kCopy 0x1503
+#define kAnd_inverted 0x1504
+#define kNoop 0x1505
+#define kXor 0x1506
+#define kOr 0x1507
+#define kNor 0x1508
+#define kEquiv 0x1509
+#define kInvert 0x150A
+#define kOr_reverse 0x150B
+#define kCopy_inverted 0x150C
+#define kOr_inverted 0x150D
+#define kNand 0x150E
+#define kSet 0x150F)";
+
+constexpr char kGLES1DrawFShaderUniformDefs[] = R"(
+
+// Texture units ///////////////////////////////////////////////////////////////
+
+uniform bool enable_texture_2d[kMaxTexUnits];
+uniform bool enable_texture_cube_map[kMaxTexUnits];
+
+// These are not arrays because hw support for arrays
+// of samplers is rather lacking.
+
+uniform sampler2D tex_sampler0;
+uniform samplerCube tex_cube_sampler0;
+
+uniform sampler2D tex_sampler1;
+uniform samplerCube tex_cube_sampler1;
+
+uniform sampler2D tex_sampler2;
+uniform samplerCube tex_cube_sampler2;
+
+uniform sampler2D tex_sampler3;
+uniform samplerCube tex_cube_sampler3;
+
+uniform int texture_format[kMaxTexUnits];
+
+uniform int texture_env_mode[kMaxTexUnits];
+uniform int combine_rgb[kMaxTexUnits];
+uniform int combine_alpha[kMaxTexUnits];
+uniform int src0_rgb[kMaxTexUnits];
+uniform int src0_alpha[kMaxTexUnits];
+uniform int src1_rgb[kMaxTexUnits];
+uniform int src1_alpha[kMaxTexUnits];
+uniform int src2_rgb[kMaxTexUnits];
+uniform int src2_alpha[kMaxTexUnits];
+uniform int op0_rgb[kMaxTexUnits];
+uniform int op0_alpha[kMaxTexUnits];
+uniform int op1_rgb[kMaxTexUnits];
+uniform int op1_alpha[kMaxTexUnits];
+uniform int op2_rgb[kMaxTexUnits];
+uniform int op2_alpha[kMaxTexUnits];
+uniform vec4 texture_env_color[kMaxTexUnits];
+uniform float texture_env_rgb_scale[kMaxTexUnits];
+uniform float texture_env_alpha_scale[kMaxTexUnits];
+uniform bool point_sprite_coord_replace[kMaxTexUnits];
+
+// Vertex attributes////////////////////////////////////////////////////////////
+
+in vec4 pos_varying;
+in vec3 normal_varying;
+in vec4 color_varying;
+flat in vec4 color_varying_flat;
+in vec4 texcoord0_varying;
+in vec4 texcoord1_varying;
+in vec4 texcoord2_varying;
+in vec4 texcoord3_varying;
+
+// Alpha test///////////////////////////////////////////////////////////////////
+
+uniform bool enable_alpha_test;
+uniform int alpha_func;
+uniform float alpha_test_ref;
+
+// Shading: flat shading, lighting, and materials///////////////////////////////
+
+uniform bool shade_model_flat;
+uniform bool enable_lighting;
+uniform bool enable_color_material;
+
+uniform vec4 material_ambient;
+uniform vec4 material_diffuse;
+uniform vec4 material_specular;
+uniform vec4 material_emissive;
+uniform float material_specular_exponent;
+
+uniform vec4 light_model_scene_ambient;
+uniform bool light_model_two_sided;
+
+uniform bool light_enables[kMaxLights];
+uniform vec4 light_ambients[kMaxLights];
+uniform vec4 light_diffuses[kMaxLights];
+uniform vec4 light_speculars[kMaxLights];
+uniform vec4 light_positions[kMaxLights];
+uniform vec3 light_directions[kMaxLights];
+uniform float light_spotlight_exponents[kMaxLights];
+uniform float light_spotlight_cutoff_angles[kMaxLights];
+uniform float light_attenuation_consts[kMaxLights];
+uniform float light_attenuation_linears[kMaxLights];
+uniform float light_attenuation_quadratics[kMaxLights];
+
+// Fog /////////////////////////////////////////////////////////////////////////
+
+uniform bool enable_fog;
+uniform int fog_mode;
+uniform float fog_density;
+uniform float fog_start;
+uniform float fog_end;
+uniform vec4 fog_color;
+
+// User clip plane /////////////////////////////////////////////////////////////
+
+uniform bool enable_clip_planes;
+uniform bool clip_plane_enables[kMaxClipPlanes];
+uniform vec4 clip_planes[kMaxClipPlanes];
+
+// Point rasterization//////////////////////////////////////////////////////////
+
+uniform bool point_rasterization;
+uniform bool point_sprite_enabled;
+
+// GL_OES_draw_texture//////////////////////////////////////////////////////////
+
+uniform bool enable_draw_texture;
+
+// Outgoing fragment////////////////////////////////////////////////////////////
+
+out vec4 frag_color;
+)";
+
+constexpr char kGLES1DrawFShaderFunctions[] = R"(
+
+float posDot(vec3 a, vec3 b)
+{
+ return max(dot(a, b), 0.0);
+}
+
+vec4 doLighting(vec4 currentFragment)
+{
+ vec4 materialAmbientActual = material_ambient;
+ vec4 materialDiffuseActual = material_diffuse;
+
+ if (enable_color_material || enable_texture_2d[0] || enable_texture_cube_map[0])
+ {
+ materialAmbientActual = currentFragment;
+ materialDiffuseActual = currentFragment;
+ }
+
+ vec4 lightingResult = material_emissive + materialAmbientActual * light_model_scene_ambient;
+
+ for (int i = 0; i < kMaxLights; i++)
+ {
+
+ if (!light_enables[i])
+ continue;
+
+ vec4 lightAmbient = light_ambients[i];
+ vec4 lightDiffuse = light_diffuses[i];
+ vec4 lightSpecular = light_speculars[i];
+ vec4 lightPos = light_positions[i];
+ vec3 lightDir = light_directions[i];
+ float attConst = light_attenuation_consts[i];
+ float attLinear = light_attenuation_linears[i];
+ float attQuadratic = light_attenuation_quadratics[i];
+ float spotAngle = light_spotlight_cutoff_angles[i];
+ float spotExponent = light_spotlight_exponents[i];
+
+ vec3 toLight;
+ if (lightPos.w == 0.0)
+ {
+ toLight = lightPos.xyz;
+ }
+ else
+ {
+ toLight = (lightPos.xyz / lightPos.w - pos_varying.xyz);
+ }
+
+ float lightDist = length(toLight);
+ vec3 h = normalize(toLight) + vec3(0.0, 0.0, 1.0);
+ float ndotL = posDot(normal_varying, normalize(toLight));
+ float ndoth = posDot(normal_varying, normalize(h));
+
+ float specAtt;
+
+ if (ndotL != 0.0)
+ {
+ specAtt = 1.0;
+ }
+ else
+ {
+ specAtt = 0.0;
+ }
+
+ float att;
+
+ if (lightPos.w != 0.0)
+ {
+ float attDenom =
+ (attConst + attLinear * lightDist + attQuadratic * lightDist * lightDist);
+ att = 1.0 / attDenom;
+ }
+ else
+ {
+ att = 1.0;
+ }
+
+ float spot;
+
+ float spotAngleCos = cos(radians(spotAngle));
+ vec3 toSurfaceDir = -normalize(toLight);
+ float spotDot = posDot(toSurfaceDir, normalize(lightDir));
+
+ if (spotAngle == 180.0 || lightPos.w == 0.0)
+ {
+ spot = 1.0;
+ }
+ else
+ {
+ if (spotDot < spotAngleCos)
+ {
+ spot = 0.0;
+ }
+ else
+ {
+ spot = pow(spotDot, spotExponent);
+ }
+ }
+
+ vec4 contrib = materialAmbientActual * lightAmbient;
+ contrib += ndotL * materialDiffuseActual * lightDiffuse;
+ if (ndoth > 0.0 && material_specular_exponent > 0.0)
+ {
+ contrib += specAtt * pow(ndoth, material_specular_exponent) * material_specular *
+ lightSpecular;
+ }
+ else
+ {
+ if (ndoth > 0.0)
+ {
+ contrib += specAtt * material_specular * lightSpecular;
+ }
+ }
+ contrib *= att * spot;
+ lightingResult += contrib;
+ }
+
+ return lightingResult;
+}
+
+bool doAlphaTest(vec4 currentFragment)
+{
+ bool shouldPassAlpha = false;
+ float incAlpha = currentFragment.a;
+
+ switch (alpha_func)
+ {
+ case kNever:
+ shouldPassAlpha = false;
+ break;
+ case kLess:
+ shouldPassAlpha = incAlpha < alpha_test_ref;
+ break;
+ case kLequal:
+ shouldPassAlpha = incAlpha <= alpha_test_ref;
+ break;
+ case kEqual:
+ shouldPassAlpha = incAlpha == alpha_test_ref;
+ break;
+ case kGequal:
+ shouldPassAlpha = incAlpha >= alpha_test_ref;
+ break;
+ case kGreater:
+ shouldPassAlpha = incAlpha > alpha_test_ref;
+ break;
+ case kNotequal:
+ shouldPassAlpha = incAlpha != alpha_test_ref;
+ break;
+ case kAlways:
+ default:
+ shouldPassAlpha = true;
+ break;
+ }
+
+ return shouldPassAlpha;
+}
+
+bool doClipPlaneTest()
+{
+ bool res = true;
+
+ for (int i = 0; i < kMaxClipPlanes; i++)
+ {
+ if (clip_plane_enables[i])
+ {
+ float dist = dot(clip_planes[i].xyz, pos_varying.xyz) + clip_planes[i].w * pos_varying.w;
+ res = res && (dist >= 0.0);
+ }
+ }
+
+ return res;
+}
+
+vec4 doFog(vec4 currentFragment)
+{
+
+ float eyeDist = -pos_varying.z / pos_varying.w;
+ float f = 1.0;
+ switch (fog_mode)
+ {
+ case kExp:
+ f = exp(-fog_density * eyeDist);
+ break;
+ case kExp2:
+ f = exp(-(pow(fog_density * eyeDist, 2.0)));
+ break;
+ case kLinear:
+ f = (fog_end - eyeDist) / (fog_end - fog_start);
+ break;
+ default:
+ break;
+ }
+
+ vec4 result = f * currentFragment + (1.0 - f) * fog_color;
+ return result;
+}
+
+)";
+
+constexpr char kGLES1DrawFShaderMultitexturing[] = R"(
+
+bool isTextureUnitEnabled(int unit)
+{
+ return enable_texture_2d[unit] || enable_texture_cube_map[unit];
+}
+
+vec4 getTextureColor(int unit)
+{
+ vec4 res;
+
+ switch (unit)
+ {
+ case 0:
+ if (enable_texture_2d[0])
+ {
+ res = texture(tex_sampler0, texcoord0_varying.xy);
+ }
+ else if (enable_texture_cube_map[0])
+ {
+ res = texture(tex_cube_sampler0, texcoord0_varying.xyz);
+ }
+ break;
+ case 1:
+ if (enable_texture_2d[1])
+ {
+ res = texture(tex_sampler1, texcoord1_varying.xy);
+ }
+ else if (enable_texture_cube_map[1])
+ {
+ res = texture(tex_cube_sampler1, texcoord1_varying.xyz);
+ }
+ break;
+ case 2:
+ if (enable_texture_2d[2])
+ {
+ res = texture(tex_sampler2, texcoord2_varying.xy);
+ }
+ else if (enable_texture_cube_map[2])
+ {
+ res = texture(tex_cube_sampler2, texcoord2_varying.xyz);
+ }
+ break;
+ case 3:
+ if (enable_texture_2d[3])
+ {
+ res = texture(tex_sampler3, texcoord3_varying.xy);
+ }
+ else if (enable_texture_cube_map[3])
+ {
+ // TODO: Weird stuff happens
+ // res = texture(tex_cube_sampler3, texcoord3_varying.xyz);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}
+
+vec4 getPointSpriteTextureColor(int unit)
+{
+ vec4 res;
+
+ switch (unit)
+ {
+ case 0:
+ if (enable_texture_2d[0])
+ {
+ res = texture(tex_sampler0, gl_PointCoord.xy);
+ }
+ break;
+ case 1:
+ if (enable_texture_2d[1])
+ {
+ res = texture(tex_sampler1, gl_PointCoord.xy);
+ }
+ break;
+ case 2:
+ if (enable_texture_2d[2])
+ {
+ res = texture(tex_sampler2, gl_PointCoord.xy);
+ }
+ break;
+ case 3:
+ if (enable_texture_2d[3])
+ {
+ res = texture(tex_sampler3, gl_PointCoord.xy);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}
+
+vec3 textureCombineSrcnOpnRgb(int srcnRgb,
+ int opnRgb,
+ vec4 textureEnvColor,
+ vec4 vertexColor,
+ vec4 texturePrevColor,
+ vec4 textureColor)
+{
+ vec3 res;
+ vec4 op;
+
+ switch (srcnRgb)
+ {
+ case kTexture:
+ op = textureColor;
+ break;
+ case kConstant:
+ op = textureEnvColor;
+ break;
+ case kPrimaryColor:
+ op = vertexColor;
+ break;
+ case kPrevious:
+ op = texturePrevColor;
+ break;
+ default:
+ op = texturePrevColor;
+ break;
+ }
+
+ switch (opnRgb)
+ {
+ case kSrcColor:
+ res = op.rgb;
+ break;
+ case kOneMinusSrcColor:
+ res = 1.0 - op.rgb;
+ break;
+ case kSrcAlpha:
+ res = vec3(op.a, op.a, op.a);
+ break;
+ case kOneMinusSrcAlpha:
+ res = vec3(1.0 - op.a, 1.0 - op.a, 1.0 - op.a);
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}
+
+float textureCombineSrcnOpnAlpha(int srcn,
+ int opn,
+ vec4 textureEnvColor,
+ vec4 vertexColor,
+ vec4 texturePrevColor,
+ vec4 textureColor)
+{
+ float res;
+ vec4 op;
+
+ switch (srcn)
+ {
+ case kTexture:
+ op = textureColor;
+ break;
+ case kConstant:
+ op = textureEnvColor;
+ break;
+ case kPrimaryColor:
+ op = vertexColor;
+ break;
+ case kPrevious:
+ op = texturePrevColor;
+ break;
+ default:
+ op = texturePrevColor;
+ break;
+ }
+
+ switch (opn)
+ {
+ case kSrcAlpha:
+ res = op.a;
+ break;
+ case kOneMinusSrcAlpha:
+ res = 1.0 - op.a;
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}
+
+vec4 textureCombine(int combineRgb,
+ int combineAlpha,
+ int src0Rgb,
+ int src0Alpha,
+ int src1Rgb,
+ int src1Alpha,
+ int src2Rgb,
+ int src2Alpha,
+ int op0Rgb,
+ int op0Alpha,
+ int op1Rgb,
+ int op1Alpha,
+ int op2Rgb,
+ int op2Alpha,
+ vec4 textureEnvColor,
+ float rgbScale,
+ float alphaScale,
+ vec4 vertexColor,
+ vec4 texturePrevColor,
+ vec4 textureColor)
+{
+
+ vec3 resRgb;
+ float resAlpha;
+
+ vec3 arg0Rgb;
+ float arg0Alpha;
+ vec3 arg1Rgb;
+ float arg1Alpha;
+ vec3 arg2Rgb;
+ float arg2Alpha;
+ float dotVal;
+
+ arg0Rgb = textureCombineSrcnOpnRgb(src0Rgb, op0Rgb, textureEnvColor, vertexColor,
+ texturePrevColor, textureColor);
+ arg0Alpha = textureCombineSrcnOpnAlpha(src0Alpha, op0Alpha, textureEnvColor, vertexColor,
+ texturePrevColor, textureColor);
+
+ if (combineRgb != kReplace)
+ {
+ arg1Rgb = textureCombineSrcnOpnRgb(src1Rgb, op1Rgb, textureEnvColor, vertexColor,
+ texturePrevColor, textureColor);
+ }
+
+ if (combineAlpha != kReplace)
+ {
+ arg1Alpha = textureCombineSrcnOpnAlpha(src1Alpha, op1Alpha, textureEnvColor, vertexColor,
+ texturePrevColor, textureColor);
+ }
+
+ if (combineRgb == kInterpolate)
+ {
+ arg2Rgb = textureCombineSrcnOpnRgb(src2Rgb, op2Rgb, textureEnvColor, vertexColor,
+ texturePrevColor, textureColor);
+ }
+
+ if (combineAlpha == kInterpolate)
+ {
+ arg2Alpha = textureCombineSrcnOpnAlpha(src2Alpha, op2Alpha, textureEnvColor, vertexColor,
+ texturePrevColor, textureColor);
+ }
+
+ switch (combineRgb)
+ {
+ case kReplace:
+ resRgb = arg0Rgb;
+ break;
+ case kModulate:
+ resRgb = arg0Rgb * arg1Rgb;
+ break;
+ case kAdd:
+ resRgb = arg0Rgb + arg1Rgb;
+ break;
+ case kAddSigned:
+ resRgb = arg0Rgb + arg1Rgb - 0.5;
+ break;
+ case kInterpolate:
+ resRgb = arg0Rgb * arg2Rgb + arg1Rgb * (1.0 - arg2Rgb);
+ break;
+ case kSubtract:
+ resRgb = arg0Rgb - arg1Rgb;
+ break;
+ default:
+ break;
+ }
+
+ switch (combineAlpha)
+ {
+ case kReplace:
+ resAlpha = arg0Alpha;
+ break;
+ case kModulate:
+ resAlpha = arg0Alpha * arg1Alpha;
+ break;
+ case kAdd:
+ resAlpha = arg0Alpha + arg1Alpha;
+ break;
+ case kAddSigned:
+ resAlpha = arg0Alpha + arg1Alpha - 0.5;
+ break;
+ case kInterpolate:
+ resAlpha = arg0Alpha * arg2Alpha + arg1Alpha * (1.0 - arg2Alpha);
+ break;
+ case kSubtract:
+ resAlpha = arg0Alpha - arg1Alpha;
+ break;
+ default:
+ break;
+ }
+
+ if (combineRgb == kDot3Rgb || combineRgb == kDot3Rgba)
+ {
+ dotVal = 4.0 * dot(arg0Rgb - 0.5, arg1Rgb - 0.5);
+
+ if (combineRgb == kDot3Rgb)
+ {
+ return vec4(dotVal, dotVal, dotVal, resAlpha);
+ }
+ else
+ {
+ return vec4(dotVal, dotVal, dotVal, dotVal);
+ }
+ }
+ else
+ {
+ return vec4(resRgb, resAlpha);
+ }
+}
+
+vec4 textureFunction(int unit,
+ int texFormat,
+ int envMode,
+ int combineRgb,
+ int combineAlpha,
+ int src0Rgb,
+ int src0Alpha,
+ int src1Rgb,
+ int src1Alpha,
+ int src2Rgb,
+ int src2Alpha,
+ int op0Rgb,
+ int op0Alpha,
+ int op1Rgb,
+ int op1Alpha,
+ int op2Rgb,
+ int op2Alpha,
+ vec4 textureEnvColor,
+ float rgbScale,
+ float alphaScale,
+ vec4 vertexColor,
+ vec4 texturePrevColor,
+ vec4 textureColor)
+{
+
+ if (!isTextureUnitEnabled(unit))
+ {
+ return texturePrevColor;
+ }
+
+ vec4 res;
+
+ switch (envMode)
+ {
+ case kReplace:
+ switch (texFormat)
+ {
+ case kAlpha:
+ res.rgb = texturePrevColor.rgb;
+ res.a = textureColor.a;
+ break;
+ case kRGBA:
+ case kLuminanceAlpha:
+ res.rgba = textureColor.rgba;
+ break;
+ case kRGB:
+ case kLuminance:
+ default:
+ res.rgb = textureColor.rgb;
+ res.a = texturePrevColor.a;
+ break;
+ }
+ break;
+ case kModulate:
+ switch (texFormat)
+ {
+ case kAlpha:
+ res.rgb = texturePrevColor.rgb;
+ res.a = texturePrevColor.a * textureColor.a;
+ break;
+ case kRGBA:
+ case kLuminanceAlpha:
+ res.rgba = texturePrevColor.rgba * textureColor.rgba;
+ break;
+ case kRGB:
+ case kLuminance:
+ default:
+ res.rgb = texturePrevColor.rgb * textureColor.rgb;
+ res.a = texturePrevColor.a;
+ break;
+ }
+ break;
+ case kDecal:
+ switch (texFormat)
+ {
+ case kRGB:
+ res.rgb = textureColor.rgb;
+ res.a = texturePrevColor.a;
+ break;
+ case kRGBA:
+ res.rgb = texturePrevColor.rgb * (1.0 - textureColor.a) +
+ textureColor.rgb * textureColor.a;
+ res.a = texturePrevColor.a;
+ break;
+ case kAlpha:
+ case kLuminance:
+ case kLuminanceAlpha:
+ default:
+ res.rgb = texturePrevColor.rgb * textureColor.rgb;
+ res.a = texturePrevColor.a;
+ break;
+ }
+ break;
+ case kBlend:
+ switch (texFormat)
+ {
+ case kAlpha:
+ res.rgb = texturePrevColor.rgb;
+ res.a = textureColor.a * texturePrevColor.a;
+ break;
+ case kLuminance:
+ case kRGB:
+ res.rgb = texturePrevColor.rgb * (1.0 - textureColor.rgb) +
+ textureEnvColor.rgb * textureColor.rgb;
+ res.a = texturePrevColor.a;
+ break;
+ case kLuminanceAlpha:
+ case kRGBA:
+ default:
+ res.rgb = texturePrevColor.rgb * (1.0 - textureColor.rgb) +
+ textureEnvColor.rgb * textureColor.rgb;
+ res.a = textureColor.a * texturePrevColor.a;
+ break;
+ }
+ break;
+ case kAdd:
+ switch (texFormat)
+ {
+ case kAlpha:
+ res.rgb = texturePrevColor.rgb;
+ res.a = textureColor.a * texturePrevColor.a;
+ break;
+ case kLuminance:
+ case kRGB:
+ res.rgb = texturePrevColor.rgb + textureColor.rgb;
+ res.a = texturePrevColor.a;
+ break;
+ case kLuminanceAlpha:
+ case kRGBA:
+ default:
+ res.rgb = texturePrevColor.rgb + textureColor.rgb;
+ res.a = textureColor.a * texturePrevColor.a;
+ break;
+ }
+ break;
+ case kCombine:
+ res = textureCombine(combineRgb, combineAlpha, src0Rgb, src0Alpha, src1Rgb, src1Alpha,
+ src2Rgb, src2Alpha, op0Rgb, op0Alpha, op1Rgb, op1Alpha, op2Rgb,
+ op2Alpha, textureEnvColor, rgbScale, alphaScale, vertexColor,
+ texturePrevColor, textureColor);
+ res.rgb *= rgbScale;
+ res.a *= alphaScale;
+ break;
+ default:
+ break;
+ }
+
+ return clamp(res, 0.0, 1.0);
+}
+)";
+
+constexpr char kGLES1DrawFShaderMain[] = R"(
+void main()
+{
+ if (enable_clip_planes && !enable_draw_texture)
+ {
+ if (!doClipPlaneTest())
+ {
+ discard;
+ }
+ }
+
+ vec4 currentFragment;
+ vec4 vertex_color;
+
+ if (shade_model_flat)
+ {
+ vertex_color = color_varying_flat;
+ }
+ else
+ {
+ vertex_color = color_varying;
+ }
+
+ currentFragment = vertex_color;
+
+ vec4 texturePrevColor = currentFragment;
+
+ for (int i = 0; i < kMaxTexUnits; i++)
+ {
+ vec4 textureColor;
+
+ if (point_rasterization && point_sprite_enabled &&
+ point_sprite_coord_replace[i]) {
+ textureColor = getPointSpriteTextureColor(i);
+ } else {
+ textureColor = getTextureColor(i);
+ }
+
+ currentFragment = textureFunction(
+ i, texture_format[i], texture_env_mode[i], combine_rgb[i], combine_alpha[i],
+ src0_rgb[i], src0_alpha[i], src1_rgb[i], src1_alpha[i], src2_rgb[i], src2_alpha[i],
+ op0_rgb[i], op0_alpha[i], op1_rgb[i], op1_alpha[i], op2_rgb[i], op2_alpha[i],
+ texture_env_color[i], texture_env_rgb_scale[i], texture_env_alpha_scale[i],
+ vertex_color, texturePrevColor, textureColor);
+
+ texturePrevColor = currentFragment;
+ }
+
+ if (enable_lighting)
+ {
+ currentFragment = doLighting(currentFragment);
+ }
+
+ if (enable_fog)
+ {
+ currentFragment = doFog(currentFragment);
+ }
+
+ if (enable_alpha_test && !doAlphaTest(currentFragment))
+ {
+ discard;
+ }
+
+ frag_color = currentFragment;
+}
+)";
diff --git a/gfx/angle/checkout/src/libANGLE/GLES1State.cpp b/gfx/angle/checkout/src/libANGLE/GLES1State.cpp
new file mode 100644
index 0000000000..2ff2b3d53e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/GLES1State.cpp
@@ -0,0 +1,576 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// GLES1State.cpp: Implements the GLES1State class, tracking state
+// for GLES1 contexts.
+
+#include "libANGLE/GLES1State.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/GLES1Renderer.h"
+
+namespace gl
+{
+
+TextureCoordF::TextureCoordF() = default;
+
+TextureCoordF::TextureCoordF(float _s, float _t, float _r, float _q) : s(_s), t(_t), r(_r), q(_q) {}
+
+bool TextureCoordF::operator==(const TextureCoordF &other) const
+{
+ return s == other.s && t == other.t && r == other.r && q == other.q;
+}
+
+MaterialParameters::MaterialParameters() = default;
+
+LightModelParameters::LightModelParameters() = default;
+
+LightParameters::LightParameters() = default;
+
+LightParameters::LightParameters(const LightParameters &other) = default;
+
+FogParameters::FogParameters() = default;
+
+TextureEnvironmentParameters::TextureEnvironmentParameters() = default;
+
+TextureEnvironmentParameters::TextureEnvironmentParameters(
+ const TextureEnvironmentParameters &other) = default;
+
+PointParameters::PointParameters() = default;
+
+PointParameters::PointParameters(const PointParameters &other) = default;
+
+ClipPlaneParameters::ClipPlaneParameters() = default;
+
+ClipPlaneParameters::ClipPlaneParameters(bool enabled, const angle::Vector4 &equation)
+ : enabled(enabled), equation(equation)
+{}
+
+ClipPlaneParameters::ClipPlaneParameters(const ClipPlaneParameters &other) = default;
+
+GLES1State::GLES1State()
+ : mGLState(nullptr),
+ mVertexArrayEnabled(false),
+ mNormalArrayEnabled(false),
+ mColorArrayEnabled(false),
+ mPointSizeArrayEnabled(false),
+ mLineSmoothEnabled(false),
+ mPointSmoothEnabled(false),
+ mPointSpriteEnabled(false),
+ mAlphaTestEnabled(false),
+ mLogicOpEnabled(false),
+ mLightingEnabled(false),
+ mFogEnabled(false),
+ mRescaleNormalEnabled(false),
+ mNormalizeEnabled(false),
+ mColorMaterialEnabled(false),
+ mReflectionMapEnabled(false),
+ mCurrentColor({0.0f, 0.0f, 0.0f, 0.0f}),
+ mCurrentNormal({0.0f, 0.0f, 0.0f}),
+ mClientActiveTexture(0),
+ mMatrixMode(MatrixType::Modelview),
+ mShadeModel(ShadingModel::Smooth),
+ mAlphaTestFunc(AlphaTestFunc::AlwaysPass),
+ mAlphaTestRef(0.0f),
+ mLogicOp(LogicalOperation::Copy),
+ mLineSmoothHint(HintSetting::DontCare),
+ mPointSmoothHint(HintSetting::DontCare),
+ mPerspectiveCorrectionHint(HintSetting::DontCare),
+ mFogHint(HintSetting::DontCare)
+{}
+
+GLES1State::~GLES1State() = default;
+
+// Taken from the GLES 1.x spec which specifies all initial state values.
+void GLES1State::initialize(const Context *context, const State *state)
+{
+ mGLState = state;
+
+ const Caps &caps = context->getCaps();
+
+ mTexUnitEnables.resize(caps.maxMultitextureUnits);
+ for (auto &enables : mTexUnitEnables)
+ {
+ enables.reset();
+ }
+
+ mVertexArrayEnabled = false;
+ mNormalArrayEnabled = false;
+ mColorArrayEnabled = false;
+ mPointSizeArrayEnabled = false;
+ mTexCoordArrayEnabled.resize(caps.maxMultitextureUnits, false);
+
+ mLineSmoothEnabled = false;
+ mPointSmoothEnabled = false;
+ mPointSpriteEnabled = false;
+ mLogicOpEnabled = false;
+ mAlphaTestEnabled = false;
+ mLightingEnabled = false;
+ mFogEnabled = false;
+ mRescaleNormalEnabled = false;
+ mNormalizeEnabled = false;
+ mColorMaterialEnabled = false;
+ mReflectionMapEnabled = false;
+
+ mMatrixMode = MatrixType::Modelview;
+
+ mCurrentColor = {1.0f, 1.0f, 1.0f, 1.0f};
+ mCurrentNormal = {0.0f, 0.0f, 1.0f};
+ mCurrentTextureCoords.resize(caps.maxMultitextureUnits);
+ mClientActiveTexture = 0;
+
+ mTextureEnvironments.resize(caps.maxMultitextureUnits);
+
+ mModelviewMatrices.push_back(angle::Mat4());
+ mProjectionMatrices.push_back(angle::Mat4());
+ mTextureMatrices.resize(caps.maxMultitextureUnits);
+ for (auto &stack : mTextureMatrices)
+ {
+ stack.push_back(angle::Mat4());
+ }
+
+ mMaterial.ambient = {0.2f, 0.2f, 0.2f, 1.0f};
+ mMaterial.diffuse = {0.8f, 0.8f, 0.8f, 1.0f};
+ mMaterial.specular = {0.0f, 0.0f, 0.0f, 1.0f};
+ mMaterial.emissive = {0.0f, 0.0f, 0.0f, 1.0f};
+
+ mMaterial.specularExponent = 0.0f;
+
+ mLightModel.color = {0.2f, 0.2f, 0.2f, 1.0f};
+ mLightModel.twoSided = false;
+
+ mLights.resize(caps.maxLights);
+
+ // GL_LIGHT0 is special and has default state that avoids all-black renderings.
+ mLights[0].diffuse = {1.0f, 1.0f, 1.0f, 1.0f};
+ mLights[0].specular = {1.0f, 1.0f, 1.0f, 1.0f};
+
+ mFog.mode = FogMode::Exp;
+ mFog.density = 1.0f;
+ mFog.start = 0.0f;
+ mFog.end = 1.0f;
+
+ mFog.color = {0.0f, 0.0f, 0.0f, 0.0f};
+
+ mShadeModel = ShadingModel::Smooth;
+
+ mAlphaTestFunc = AlphaTestFunc::AlwaysPass;
+ mAlphaTestRef = 0.0f;
+
+ mLogicOp = LogicalOperation::Copy;
+
+ mClipPlanes.resize(caps.maxClipPlanes,
+ ClipPlaneParameters(false, angle::Vector4(0.0f, 0.0f, 0.0f, 0.0f)));
+
+ mLineSmoothHint = HintSetting::DontCare;
+ mPointSmoothHint = HintSetting::DontCare;
+ mPerspectiveCorrectionHint = HintSetting::DontCare;
+ mFogHint = HintSetting::DontCare;
+
+ // The user-specified point size, GL_POINT_SIZE_MAX,
+ // is initially equal to the implementation maximum.
+ mPointParameters.pointSizeMax = caps.maxAliasedPointSize;
+
+ mDirtyBits.set();
+}
+
+void GLES1State::setAlphaFunc(AlphaTestFunc func, GLfloat ref)
+{
+ setDirty(DIRTY_GLES1_ALPHA_TEST);
+ mAlphaTestFunc = func;
+ mAlphaTestRef = ref;
+}
+
+void GLES1State::setClientTextureUnit(unsigned int unit)
+{
+ setDirty(DIRTY_GLES1_CLIENT_ACTIVE_TEXTURE);
+ mClientActiveTexture = unit;
+}
+
+unsigned int GLES1State::getClientTextureUnit() const
+{
+ return mClientActiveTexture;
+}
+
+void GLES1State::setCurrentColor(const ColorF &color)
+{
+ setDirty(DIRTY_GLES1_CURRENT_VECTOR);
+ mCurrentColor = color;
+}
+
+const ColorF &GLES1State::getCurrentColor() const
+{
+ return mCurrentColor;
+}
+
+void GLES1State::setCurrentNormal(const angle::Vector3 &normal)
+{
+ setDirty(DIRTY_GLES1_CURRENT_VECTOR);
+ mCurrentNormal = normal;
+}
+
+const angle::Vector3 &GLES1State::getCurrentNormal() const
+{
+ return mCurrentNormal;
+}
+
+void GLES1State::setCurrentTextureCoords(unsigned int unit, const TextureCoordF &coords)
+{
+ setDirty(DIRTY_GLES1_CURRENT_VECTOR);
+ mCurrentTextureCoords[unit] = coords;
+}
+
+const TextureCoordF &GLES1State::getCurrentTextureCoords(unsigned int unit) const
+{
+ return mCurrentTextureCoords[unit];
+}
+
+void GLES1State::setMatrixMode(MatrixType mode)
+{
+ setDirty(DIRTY_GLES1_MATRICES);
+ mMatrixMode = mode;
+}
+
+MatrixType GLES1State::getMatrixMode() const
+{
+ return mMatrixMode;
+}
+
+GLint GLES1State::getCurrentMatrixStackDepth(GLenum queryType) const
+{
+ switch (queryType)
+ {
+ case GL_MODELVIEW_STACK_DEPTH:
+ return clampCast<GLint>(mModelviewMatrices.size());
+ case GL_PROJECTION_STACK_DEPTH:
+ return clampCast<GLint>(mProjectionMatrices.size());
+ case GL_TEXTURE_STACK_DEPTH:
+ return clampCast<GLint>(mTextureMatrices[mGLState->getActiveSampler()].size());
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+void GLES1State::pushMatrix()
+{
+ setDirty(DIRTY_GLES1_MATRICES);
+ auto &stack = currentMatrixStack();
+ stack.push_back(stack.back());
+}
+
+void GLES1State::popMatrix()
+{
+ setDirty(DIRTY_GLES1_MATRICES);
+ auto &stack = currentMatrixStack();
+ stack.pop_back();
+}
+
+GLES1State::MatrixStack &GLES1State::currentMatrixStack()
+{
+ setDirty(DIRTY_GLES1_MATRICES);
+ switch (mMatrixMode)
+ {
+ case MatrixType::Modelview:
+ return mModelviewMatrices;
+ case MatrixType::Projection:
+ return mProjectionMatrices;
+ case MatrixType::Texture:
+ return mTextureMatrices[mGLState->getActiveSampler()];
+ default:
+ UNREACHABLE();
+ return mModelviewMatrices;
+ }
+}
+
+const angle::Mat4 &GLES1State::getModelviewMatrix() const
+{
+ return mModelviewMatrices.back();
+}
+
+const GLES1State::MatrixStack &GLES1State::currentMatrixStack() const
+{
+ switch (mMatrixMode)
+ {
+ case MatrixType::Modelview:
+ return mModelviewMatrices;
+ case MatrixType::Projection:
+ return mProjectionMatrices;
+ case MatrixType::Texture:
+ return mTextureMatrices[mGLState->getActiveSampler()];
+ default:
+ UNREACHABLE();
+ return mModelviewMatrices;
+ }
+}
+
+void GLES1State::loadMatrix(const angle::Mat4 &m)
+{
+ setDirty(DIRTY_GLES1_MATRICES);
+ currentMatrixStack().back() = m;
+}
+
+void GLES1State::multMatrix(const angle::Mat4 &m)
+{
+ setDirty(DIRTY_GLES1_MATRICES);
+ angle::Mat4 currentMatrix = currentMatrixStack().back();
+ currentMatrixStack().back() = currentMatrix.product(m);
+}
+
+void GLES1State::setLogicOp(LogicalOperation opcodePacked)
+{
+ setDirty(DIRTY_GLES1_LOGIC_OP);
+ mLogicOp = opcodePacked;
+}
+
+void GLES1State::setClientStateEnabled(ClientVertexArrayType clientState, bool enable)
+{
+ setDirty(DIRTY_GLES1_CLIENT_STATE_ENABLE);
+ switch (clientState)
+ {
+ case ClientVertexArrayType::Vertex:
+ mVertexArrayEnabled = enable;
+ break;
+ case ClientVertexArrayType::Normal:
+ mNormalArrayEnabled = enable;
+ break;
+ case ClientVertexArrayType::Color:
+ mColorArrayEnabled = enable;
+ break;
+ case ClientVertexArrayType::PointSize:
+ mPointSizeArrayEnabled = enable;
+ break;
+ case ClientVertexArrayType::TextureCoord:
+ mTexCoordArrayEnabled[mClientActiveTexture] = enable;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void GLES1State::setTexCoordArrayEnabled(unsigned int unit, bool enable)
+{
+ setDirty(DIRTY_GLES1_CLIENT_STATE_ENABLE);
+ mTexCoordArrayEnabled[unit] = enable;
+}
+
+bool GLES1State::isClientStateEnabled(ClientVertexArrayType clientState) const
+{
+ switch (clientState)
+ {
+ case ClientVertexArrayType::Vertex:
+ return mVertexArrayEnabled;
+ case ClientVertexArrayType::Normal:
+ return mNormalArrayEnabled;
+ case ClientVertexArrayType::Color:
+ return mColorArrayEnabled;
+ case ClientVertexArrayType::PointSize:
+ return mPointSizeArrayEnabled;
+ case ClientVertexArrayType::TextureCoord:
+ return mTexCoordArrayEnabled[mClientActiveTexture];
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool GLES1State::isTexCoordArrayEnabled(unsigned int unit) const
+{
+ ASSERT(unit < mTexCoordArrayEnabled.size());
+ return mTexCoordArrayEnabled[unit];
+}
+
+bool GLES1State::isTextureTargetEnabled(unsigned int unit, const TextureType type) const
+{
+ return mTexUnitEnables[unit].test(type);
+}
+
+LightModelParameters &GLES1State::lightModelParameters()
+{
+ setDirty(DIRTY_GLES1_LIGHTS);
+ return mLightModel;
+}
+
+const LightModelParameters &GLES1State::lightModelParameters() const
+{
+ return mLightModel;
+}
+
+LightParameters &GLES1State::lightParameters(unsigned int light)
+{
+ setDirty(DIRTY_GLES1_LIGHTS);
+ return mLights[light];
+}
+
+const LightParameters &GLES1State::lightParameters(unsigned int light) const
+{
+ return mLights[light];
+}
+
+MaterialParameters &GLES1State::materialParameters()
+{
+ setDirty(DIRTY_GLES1_MATERIAL);
+ return mMaterial;
+}
+
+const MaterialParameters &GLES1State::materialParameters() const
+{
+ return mMaterial;
+}
+
+bool GLES1State::isColorMaterialEnabled() const
+{
+ return mColorMaterialEnabled;
+}
+
+void GLES1State::setShadeModel(ShadingModel model)
+{
+ setDirty(DIRTY_GLES1_SHADE_MODEL);
+ mShadeModel = model;
+}
+
+void GLES1State::setClipPlane(unsigned int plane, const GLfloat *equation)
+{
+ setDirty(DIRTY_GLES1_CLIP_PLANES);
+ assert(plane < mClipPlanes.size());
+ mClipPlanes[plane].equation[0] = equation[0];
+ mClipPlanes[plane].equation[1] = equation[1];
+ mClipPlanes[plane].equation[2] = equation[2];
+ mClipPlanes[plane].equation[3] = equation[3];
+}
+
+void GLES1State::getClipPlane(unsigned int plane, GLfloat *equation) const
+{
+ assert(plane < mClipPlanes.size());
+ equation[0] = mClipPlanes[plane].equation[0];
+ equation[1] = mClipPlanes[plane].equation[1];
+ equation[2] = mClipPlanes[plane].equation[2];
+ equation[3] = mClipPlanes[plane].equation[3];
+}
+
+FogParameters &GLES1State::fogParameters()
+{
+ setDirty(DIRTY_GLES1_FOG);
+ return mFog;
+}
+
+const FogParameters &GLES1State::fogParameters() const
+{
+ return mFog;
+}
+
+TextureEnvironmentParameters &GLES1State::textureEnvironment(unsigned int unit)
+{
+ setDirty(DIRTY_GLES1_TEXTURE_ENVIRONMENT);
+ assert(unit < mTextureEnvironments.size());
+ return mTextureEnvironments[unit];
+}
+
+const TextureEnvironmentParameters &GLES1State::textureEnvironment(unsigned int unit) const
+{
+ assert(unit < mTextureEnvironments.size());
+ return mTextureEnvironments[unit];
+}
+
+PointParameters &GLES1State::pointParameters()
+{
+ setDirty(DIRTY_GLES1_POINT_PARAMETERS);
+ return mPointParameters;
+}
+
+const PointParameters &GLES1State::pointParameters() const
+{
+ return mPointParameters;
+}
+
+AttributesMask GLES1State::getVertexArraysAttributeMask() const
+{
+ AttributesMask attribsMask;
+
+ ClientVertexArrayType nonTexcoordArrays[] = {
+ ClientVertexArrayType::Vertex,
+ ClientVertexArrayType::Normal,
+ ClientVertexArrayType::Color,
+ ClientVertexArrayType::PointSize,
+ };
+
+ for (const ClientVertexArrayType attrib : nonTexcoordArrays)
+ {
+ attribsMask.set(GLES1Renderer::VertexArrayIndex(attrib, *this),
+ isClientStateEnabled(attrib));
+ }
+
+ for (unsigned int i = 0; i < GLES1Renderer::kTexUnitCount; i++)
+ {
+ attribsMask.set(GLES1Renderer::TexCoordArrayIndex(i), isTexCoordArrayEnabled(i));
+ }
+
+ return attribsMask;
+}
+
+void GLES1State::setHint(GLenum target, GLenum mode)
+{
+ setDirty(DIRTY_GLES1_HINT_SETTING);
+ HintSetting setting = FromGLenum<HintSetting>(mode);
+ switch (target)
+ {
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ mPerspectiveCorrectionHint = setting;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ mPointSmoothHint = setting;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ mLineSmoothHint = setting;
+ break;
+ case GL_FOG_HINT:
+ mFogHint = setting;
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+GLenum GLES1State::getHint(GLenum target)
+{
+ switch (target)
+ {
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ return ToGLenum(mPerspectiveCorrectionHint);
+ case GL_POINT_SMOOTH_HINT:
+ return ToGLenum(mPointSmoothHint);
+ case GL_LINE_SMOOTH_HINT:
+ return ToGLenum(mLineSmoothHint);
+ case GL_FOG_HINT:
+ return ToGLenum(mFogHint);
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+void GLES1State::setDirty(DirtyGles1Type type)
+{
+ mDirtyBits.set(type);
+}
+
+void GLES1State::setAllDirty()
+{
+ mDirtyBits.set();
+}
+
+void GLES1State::clearDirty()
+{
+ mDirtyBits.reset();
+}
+
+bool GLES1State::isDirty(DirtyGles1Type type) const
+{
+ return mDirtyBits.test(type);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/GLES1State.h b/gfx/angle/checkout/src/libANGLE/GLES1State.h
new file mode 100644
index 0000000000..b52388bc4c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/GLES1State.h
@@ -0,0 +1,331 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// GLES1State.h: Defines the GLES1State class holding the state of
+// a GLES1 context.
+
+#ifndef LIBANGLE_GLES1STATE_H_
+#define LIBANGLE_GLES1STATE_H_
+
+#include <unordered_set>
+
+#include "common/FixedVector.h"
+#include "common/angleutils.h"
+#include "common/bitset_utils.h"
+#include "common/matrix_utils.h"
+#include "common/vector_utils.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/angletypes.h"
+
+namespace gl
+{
+
+// State types specific to GLES1 contexts, from the OpenGL ES 1.1 spec "State Tables" section
+struct TextureCoordF
+{
+ TextureCoordF();
+ TextureCoordF(float _s, float _t, float _r, float _q);
+ bool operator==(const TextureCoordF &other) const;
+
+ GLfloat s = 0.0f;
+ GLfloat t = 0.0f;
+ GLfloat r = 0.0f;
+ GLfloat q = 0.0f;
+};
+
+struct MaterialParameters
+{
+ MaterialParameters();
+
+ ColorF ambient;
+ ColorF diffuse;
+ ColorF specular;
+ ColorF emissive;
+ GLfloat specularExponent;
+};
+
+struct LightModelParameters
+{
+ LightModelParameters();
+
+ ColorF color;
+ bool twoSided;
+};
+
+struct LightParameters
+{
+ LightParameters();
+ LightParameters(const LightParameters &other);
+
+ bool enabled = false;
+ ColorF ambient = {0.0f, 0.0f, 0.0f, 1.0f};
+ ColorF diffuse = {0.0f, 0.0f, 0.0f, 1.0f};
+ ColorF specular = {0.0f, 0.0f, 0.0f, 1.0f};
+ angle::Vector4 position = {0.0f, 0.0f, 1.0f, 0.0f};
+ angle::Vector3 direction = {0.0f, 0.0f, -1.0f};
+ GLfloat spotlightExponent = 0.0f;
+ GLfloat spotlightCutoffAngle = 180.0f;
+ GLfloat attenuationConst = 1.0f;
+ GLfloat attenuationLinear = 0.0f;
+ GLfloat attenuationQuadratic = 0.0f;
+};
+
+struct FogParameters
+{
+ FogParameters();
+
+ FogMode mode;
+ GLfloat density;
+ GLfloat start;
+ GLfloat end;
+ ColorF color;
+};
+
+struct TextureEnvironmentParameters
+{
+ TextureEnvironmentParameters();
+ TextureEnvironmentParameters(const TextureEnvironmentParameters &other);
+
+ TextureEnvMode mode = TextureEnvMode::Modulate;
+ TextureCombine combineRgb = TextureCombine::Modulate;
+ TextureCombine combineAlpha = TextureCombine::Modulate;
+
+ TextureSrc src0Rgb = TextureSrc::Texture;
+ TextureSrc src0Alpha = TextureSrc::Texture;
+
+ TextureSrc src1Rgb = TextureSrc::Previous;
+ TextureSrc src1Alpha = TextureSrc::Previous;
+
+ TextureSrc src2Rgb = TextureSrc::Constant;
+ TextureSrc src2Alpha = TextureSrc::Constant;
+
+ TextureOp op0Rgb = TextureOp::SrcColor;
+ TextureOp op0Alpha = TextureOp::SrcAlpha;
+
+ TextureOp op1Rgb = TextureOp::SrcColor;
+ TextureOp op1Alpha = TextureOp::SrcAlpha;
+
+ TextureOp op2Rgb = TextureOp::SrcAlpha;
+ TextureOp op2Alpha = TextureOp::SrcAlpha;
+
+ ColorF color = {0.0f, 0.0f, 0.0f, 0.0f};
+ GLfloat rgbScale = 1.0f;
+ GLfloat alphaScale = 1.0f;
+
+ bool pointSpriteCoordReplace = false;
+};
+
+struct PointParameters
+{
+ PointParameters();
+ PointParameters(const PointParameters &other);
+
+ GLfloat pointSizeMin = 0.0f;
+ GLfloat pointSizeMax = 1.0f;
+ GLfloat pointFadeThresholdSize = 1.0f;
+ angle::Vector3 pointDistanceAttenuation = {1.0f, 0.0f, 0.0f};
+ GLfloat pointSize = 1.0f;
+};
+
+struct ClipPlaneParameters
+{
+ ClipPlaneParameters();
+ ClipPlaneParameters(bool enabled, const angle::Vector4 &equation);
+ ClipPlaneParameters(const ClipPlaneParameters &other);
+
+ bool enabled;
+ angle::Vector4 equation;
+};
+
+class Context;
+class GLES1Renderer;
+class State;
+
+class GLES1State final : angle::NonCopyable
+{
+ public:
+ GLES1State();
+ ~GLES1State();
+
+ void initialize(const Context *context, const State *state);
+
+ void setAlphaFunc(AlphaTestFunc func, GLfloat ref);
+ void setClientTextureUnit(unsigned int unit);
+ unsigned int getClientTextureUnit() const;
+
+ void setCurrentColor(const ColorF &color);
+ const ColorF &getCurrentColor() const;
+
+ void setCurrentNormal(const angle::Vector3 &normal);
+ const angle::Vector3 &getCurrentNormal() const;
+
+ void setCurrentTextureCoords(unsigned int unit, const TextureCoordF &coords);
+ const TextureCoordF &getCurrentTextureCoords(unsigned int unit) const;
+
+ void setMatrixMode(MatrixType mode);
+ MatrixType getMatrixMode() const;
+
+ GLint getCurrentMatrixStackDepth(GLenum param) const;
+
+ void pushMatrix();
+ void popMatrix();
+
+ using MatrixStack = angle::FixedVector<angle::Mat4, Caps::GlobalMatrixStackDepth>;
+ MatrixStack &currentMatrixStack();
+ const MatrixStack &currentMatrixStack() const;
+
+ const angle::Mat4 &getModelviewMatrix() const;
+
+ void loadMatrix(const angle::Mat4 &m);
+ void multMatrix(const angle::Mat4 &m);
+
+ void setLogicOp(LogicalOperation opcodePacked);
+
+ void setClientStateEnabled(ClientVertexArrayType clientState, bool enable);
+ void setTexCoordArrayEnabled(unsigned int unit, bool enable);
+ bool isClientStateEnabled(ClientVertexArrayType clientState) const;
+ bool isTexCoordArrayEnabled(unsigned int unit) const;
+ bool isTextureTargetEnabled(unsigned int unit, const TextureType type) const;
+
+ LightModelParameters &lightModelParameters();
+ const LightModelParameters &lightModelParameters() const;
+
+ LightParameters &lightParameters(unsigned int light);
+ const LightParameters &lightParameters(unsigned int light) const;
+
+ MaterialParameters &materialParameters();
+ const MaterialParameters &materialParameters() const;
+ bool isColorMaterialEnabled() const;
+
+ void setShadeModel(ShadingModel model);
+
+ void setClipPlane(unsigned int plane, const GLfloat *equation);
+ void getClipPlane(unsigned int plane, GLfloat *equation) const;
+
+ FogParameters &fogParameters();
+ const FogParameters &fogParameters() const;
+
+ TextureEnvironmentParameters &textureEnvironment(unsigned int unit);
+ const TextureEnvironmentParameters &textureEnvironment(unsigned int unit) const;
+
+ PointParameters &pointParameters();
+ const PointParameters &pointParameters() const;
+
+ AttributesMask getVertexArraysAttributeMask() const;
+
+ void setHint(GLenum target, GLenum mode);
+ GLenum getHint(GLenum target);
+
+ private:
+ friend class State;
+ friend class GLES1Renderer;
+
+ // Back pointer for reading from State.
+ const State *mGLState;
+
+ enum DirtyGles1Type
+ {
+ DIRTY_GLES1_TEXTURE_UNIT_ENABLE = 0,
+ DIRTY_GLES1_CLIENT_STATE_ENABLE,
+ DIRTY_GLES1_FEATURE_ENABLE,
+ DIRTY_GLES1_CURRENT_VECTOR,
+ DIRTY_GLES1_CLIENT_ACTIVE_TEXTURE,
+ DIRTY_GLES1_MATRICES,
+ DIRTY_GLES1_TEXTURE_ENVIRONMENT,
+ DIRTY_GLES1_MATERIAL,
+ DIRTY_GLES1_LIGHTS,
+ DIRTY_GLES1_FOG,
+ DIRTY_GLES1_SHADE_MODEL,
+ DIRTY_GLES1_POINT_PARAMETERS,
+ DIRTY_GLES1_ALPHA_TEST,
+ DIRTY_GLES1_LOGIC_OP,
+ DIRTY_GLES1_CLIP_PLANES,
+ DIRTY_GLES1_HINT_SETTING,
+ DIRTY_GLES1_MAX,
+ };
+ using DirtyBits = angle::BitSet<DIRTY_GLES1_MAX>;
+ DirtyBits mDirtyBits;
+
+ void setDirty(DirtyGles1Type type);
+ void setAllDirty();
+ void clearDirty();
+ bool isDirty(DirtyGles1Type type) const;
+
+ // All initial state values come from the
+ // OpenGL ES 1.1 spec.
+ std::vector<angle::PackedEnumBitSet<TextureType>> mTexUnitEnables;
+
+ // Table 6.4, 6.5 (IsEnabled)
+ bool mVertexArrayEnabled;
+ bool mNormalArrayEnabled;
+ bool mColorArrayEnabled;
+ bool mPointSizeArrayEnabled;
+ std::vector<bool> mTexCoordArrayEnabled;
+
+ // Table 6.7-6.16 (IsEnabled)
+ bool mLineSmoothEnabled;
+ bool mPointSmoothEnabled;
+ bool mPointSpriteEnabled;
+ bool mAlphaTestEnabled;
+ bool mLogicOpEnabled;
+ bool mLightingEnabled;
+ bool mFogEnabled;
+ bool mRescaleNormalEnabled;
+ bool mNormalizeEnabled;
+ bool mColorMaterialEnabled;
+ bool mReflectionMapEnabled;
+
+ // Table 6.3
+ ColorF mCurrentColor;
+ angle::Vector3 mCurrentNormal;
+ // Invariant: mCurrentTextureCoords size is == GL_MAX_TEXTURE_UNITS.
+ std::vector<TextureCoordF> mCurrentTextureCoords;
+
+ // Table 6.4
+ unsigned int mClientActiveTexture;
+
+ // Table 6.7
+ MatrixType mMatrixMode;
+ MatrixStack mProjectionMatrices;
+ MatrixStack mModelviewMatrices;
+ std::vector<MatrixStack> mTextureMatrices;
+
+ // Table 6.15
+ using TextureEnvironments = std::vector<TextureEnvironmentParameters>;
+ TextureEnvironments mTextureEnvironments;
+
+ // Table 6.9, 2.8
+ MaterialParameters mMaterial;
+ LightModelParameters mLightModel;
+
+ // Table 6.10
+ std::vector<LightParameters> mLights;
+
+ // Table 6.8
+ FogParameters mFog;
+ ShadingModel mShadeModel;
+
+ // Table 6.11
+ PointParameters mPointParameters;
+
+ // Table 6.16
+ AlphaTestFunc mAlphaTestFunc;
+ GLfloat mAlphaTestRef;
+ LogicalOperation mLogicOp;
+
+ // Table 6.7
+ std::vector<ClipPlaneParameters> mClipPlanes;
+
+ // Table 6.19
+ HintSetting mLineSmoothHint;
+ HintSetting mPointSmoothHint;
+ HintSetting mPerspectiveCorrectionHint;
+ HintSetting mFogHint;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_GLES1STATE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp b/gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp
new file mode 100644
index 0000000000..8b2b3024f7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp
@@ -0,0 +1,167 @@
+//
+// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// HandleAllocator.cpp: Implements the gl::HandleAllocator class, which is used
+// to allocate GL handles.
+
+#include "libANGLE/HandleAllocator.h"
+
+#include <algorithm>
+#include <functional>
+
+#include "common/debug.h"
+
+namespace gl
+{
+
+struct HandleAllocator::HandleRangeComparator
+{
+ bool operator()(const HandleRange &range, GLuint handle) const { return (range.end < handle); }
+};
+
+HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1), mLoggingEnabled(false)
+{
+ mUnallocatedList.push_back(HandleRange(1, std::numeric_limits<GLuint>::max()));
+}
+
+HandleAllocator::HandleAllocator(GLuint maximumHandleValue)
+ : mBaseValue(1), mNextValue(1), mLoggingEnabled(false)
+{
+ mUnallocatedList.push_back(HandleRange(1, maximumHandleValue));
+}
+
+HandleAllocator::~HandleAllocator() {}
+
+void HandleAllocator::setBaseHandle(GLuint value)
+{
+ ASSERT(mBaseValue == mNextValue);
+ mBaseValue = value;
+ mNextValue = value;
+}
+
+GLuint HandleAllocator::allocate()
+{
+ ASSERT(!mUnallocatedList.empty() || !mReleasedList.empty());
+
+ // Allocate from released list, logarithmic time for pop_heap.
+ if (!mReleasedList.empty())
+ {
+ std::pop_heap(mReleasedList.begin(), mReleasedList.end(), std::greater<GLuint>());
+ GLuint reusedHandle = mReleasedList.back();
+ mReleasedList.pop_back();
+
+ if (mLoggingEnabled)
+ {
+ WARN() << "HandleAllocator::allocate reusing " << reusedHandle << std::endl;
+ }
+
+ return reusedHandle;
+ }
+
+ // Allocate from unallocated list, constant time.
+ auto listIt = mUnallocatedList.begin();
+
+ GLuint freeListHandle = listIt->begin;
+ ASSERT(freeListHandle > 0);
+
+ if (listIt->begin == listIt->end)
+ {
+ mUnallocatedList.erase(listIt);
+ }
+ else
+ {
+ listIt->begin++;
+ }
+
+ if (mLoggingEnabled)
+ {
+ WARN() << "HandleAllocator::allocate allocating " << freeListHandle << std::endl;
+ }
+
+ return freeListHandle;
+}
+
+void HandleAllocator::release(GLuint handle)
+{
+ if (mLoggingEnabled)
+ {
+ WARN() << "HandleAllocator::release releasing " << handle << std::endl;
+ }
+
+ // Add to released list, logarithmic time for push_heap.
+ mReleasedList.push_back(handle);
+ std::push_heap(mReleasedList.begin(), mReleasedList.end(), std::greater<GLuint>());
+}
+
+void HandleAllocator::reserve(GLuint handle)
+{
+ if (mLoggingEnabled)
+ {
+ WARN() << "HandleAllocator::reserve reserving " << handle << std::endl;
+ }
+
+ // Clear from released list -- might be a slow operation.
+ if (!mReleasedList.empty())
+ {
+ auto releasedIt = std::find(mReleasedList.begin(), mReleasedList.end(), handle);
+ if (releasedIt != mReleasedList.end())
+ {
+ mReleasedList.erase(releasedIt);
+ std::make_heap(mReleasedList.begin(), mReleasedList.end(), std::greater<GLuint>());
+ return;
+ }
+ }
+
+ // Not in released list, reserve in the unallocated list.
+ auto boundIt = std::lower_bound(mUnallocatedList.begin(), mUnallocatedList.end(), handle,
+ HandleRangeComparator());
+
+ ASSERT(boundIt != mUnallocatedList.end());
+
+ GLuint begin = boundIt->begin;
+ GLuint end = boundIt->end;
+
+ if (handle == begin || handle == end)
+ {
+ if (begin == end)
+ {
+ mUnallocatedList.erase(boundIt);
+ }
+ else if (handle == begin)
+ {
+ boundIt->begin++;
+ }
+ else
+ {
+ ASSERT(handle == end);
+ boundIt->end--;
+ }
+ return;
+ }
+
+ ASSERT(begin < handle && handle < end);
+
+ // need to split the range
+ auto placementIt = mUnallocatedList.erase(boundIt);
+ placementIt = mUnallocatedList.insert(placementIt, HandleRange(handle + 1, end));
+ mUnallocatedList.insert(placementIt, HandleRange(begin, handle - 1));
+}
+
+void HandleAllocator::reset()
+{
+ mUnallocatedList.clear();
+ mUnallocatedList.push_back(HandleRange(1, std::numeric_limits<GLuint>::max()));
+ mReleasedList.clear();
+ mBaseValue = 1;
+ mNextValue = 1;
+}
+
+void HandleAllocator::enableLogging(bool enabled)
+{
+ mLoggingEnabled = enabled;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/HandleAllocator.h b/gfx/angle/checkout/src/libANGLE/HandleAllocator.h
new file mode 100644
index 0000000000..e76590f9b3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/HandleAllocator.h
@@ -0,0 +1,67 @@
+//
+// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// HandleAllocator.h: Defines the gl::HandleAllocator class, which is used to
+// allocate GL handles.
+
+#ifndef LIBANGLE_HANDLEALLOCATOR_H_
+#define LIBANGLE_HANDLEALLOCATOR_H_
+
+#include "common/angleutils.h"
+
+#include "angle_gl.h"
+
+namespace gl
+{
+
+class HandleAllocator final : angle::NonCopyable
+{
+ public:
+ // Maximum handle = MAX_UINT-1
+ HandleAllocator();
+ // Specify maximum handle value. Used for testing.
+ HandleAllocator(GLuint maximumHandleValue);
+
+ ~HandleAllocator();
+
+ void setBaseHandle(GLuint value);
+
+ GLuint allocate();
+ void release(GLuint handle);
+ void reserve(GLuint handle);
+ void reset();
+
+ void enableLogging(bool enabled);
+
+ private:
+ GLuint mBaseValue;
+ GLuint mNextValue;
+ typedef std::vector<GLuint> HandleList;
+ HandleList mFreeValues;
+
+ // Represents an inclusive range [begin, end]
+ struct HandleRange
+ {
+ HandleRange(GLuint beginIn, GLuint endIn) : begin(beginIn), end(endIn) {}
+
+ GLuint begin;
+ GLuint end;
+ };
+
+ struct HandleRangeComparator;
+
+ // The freelist consists of never-allocated handles, stored
+ // as ranges, and handles that were previously allocated and
+ // released, stored in a heap.
+ std::vector<HandleRange> mUnallocatedList;
+ std::vector<GLuint> mReleasedList;
+
+ bool mLoggingEnabled;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_HANDLEALLOCATOR_H_
diff --git a/gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.cpp b/gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.cpp
new file mode 100644
index 0000000000..f918907037
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.cpp
@@ -0,0 +1,227 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// HandleRangeAllocator.cpp : Implementation for HandleRangeAllocator.h
+
+#include "libANGLE/HandleRangeAllocator.h"
+
+#include <algorithm>
+#include <limits>
+#include <utility>
+
+#include "common/angleutils.h"
+#include "common/debug.h"
+
+namespace gl
+{
+
+const GLuint HandleRangeAllocator::kInvalidHandle = 0;
+
+HandleRangeAllocator::HandleRangeAllocator()
+{
+ // Simplify the code by making sure that lower_bound(id) never
+ // returns the beginning of the map, if id is valid (eg != kInvalidHandle).
+ mUsed.insert(std::make_pair(0u, 0u));
+}
+
+HandleRangeAllocator::~HandleRangeAllocator() {}
+
+GLuint HandleRangeAllocator::allocate()
+{
+ return allocateRange(1u);
+}
+
+GLuint HandleRangeAllocator::allocateAtOrAbove(GLuint wanted)
+{
+ if (wanted == 0u || wanted == 1u)
+ return allocateRange(1u);
+
+ auto current = mUsed.lower_bound(wanted);
+ auto next = current;
+ if (current == mUsed.end() || current->first > wanted)
+ {
+ current--;
+ }
+ else
+ {
+ next++;
+ }
+
+ GLuint firstId = current->first;
+ GLuint lastId = current->second;
+ ASSERT(wanted >= firstId);
+
+ if (wanted - 1u <= lastId)
+ {
+ // Append to current range.
+ lastId++;
+ if (lastId == 0)
+ {
+ // The increment overflowed.
+ return allocateRange(1u);
+ }
+
+ current->second = lastId;
+
+ if (next != mUsed.end() && next->first - 1u == lastId)
+ {
+ // Merge with next range.
+ current->second = next->second;
+ mUsed.erase(next);
+ }
+ return lastId;
+ }
+ else if (next != mUsed.end() && next->first - 1u == wanted)
+ {
+ // Prepend to next range.
+ GLuint lastExisting = next->second;
+ mUsed.erase(next);
+ mUsed.insert(std::make_pair(wanted, lastExisting));
+ return wanted;
+ }
+ mUsed.insert(std::make_pair(wanted, wanted));
+ return wanted;
+}
+
+GLuint HandleRangeAllocator::allocateRange(GLuint range)
+{
+ ASSERT(range != 0);
+
+ auto current = mUsed.begin();
+ auto next = current;
+
+ while (++next != mUsed.end())
+ {
+ if (next->first - current->second > range)
+ break;
+ current = next;
+ }
+ const GLuint firstId = current->second + 1u;
+ const GLuint lastId = firstId + range - 1u;
+
+ // deal with wraparound
+ if (firstId == 0u || lastId < firstId)
+ return kInvalidHandle;
+
+ current->second = lastId;
+
+ if (next != mUsed.end() && next->first - 1u == lastId)
+ {
+ // merge with next range
+ current->second = next->second;
+ mUsed.erase(next);
+ }
+ return firstId;
+}
+
+bool HandleRangeAllocator::markAsUsed(GLuint handle)
+{
+ ASSERT(handle);
+ auto current = mUsed.lower_bound(handle);
+ if (current != mUsed.end() && current->first == handle)
+ return false;
+
+ auto next = current;
+ --current;
+
+ if (current->second >= handle)
+ return false;
+
+ ASSERT(current->first < handle && current->second < handle);
+
+ if (current->second + 1u == handle)
+ {
+ // Append to current range.
+ current->second = handle;
+ if (next != mUsed.end() && next->first - 1u == handle)
+ {
+ // Merge with next range.
+ current->second = next->second;
+ mUsed.erase(next);
+ }
+ return true;
+ }
+ else if (next != mUsed.end() && next->first - 1u == handle)
+ {
+ // Prepend to next range.
+ GLuint lastExisting = next->second;
+ mUsed.erase(next);
+ mUsed.insert(std::make_pair(handle, lastExisting));
+ return true;
+ }
+
+ mUsed.insert(std::make_pair(handle, handle));
+ return true;
+}
+
+void HandleRangeAllocator::release(GLuint handle)
+{
+ releaseRange(handle, 1u);
+}
+
+void HandleRangeAllocator::releaseRange(GLuint first, GLuint range)
+{
+ if (range == 0u || (first == 0u && range == 1u))
+ return;
+
+ if (first == 0u)
+ {
+ first++;
+ range--;
+ }
+
+ GLuint last = first + range - 1u;
+ if (last < first)
+ last = std::numeric_limits<GLuint>::max();
+
+ while (true)
+ {
+ auto current = mUsed.lower_bound(last);
+ if (current == mUsed.end() || current->first > last)
+ --current;
+
+ if (current->second < first)
+ return;
+
+ if (current->first >= first)
+ {
+ const GLuint lastExisting = current->second;
+ mUsed.erase(current);
+ if (last < lastExisting)
+ {
+ mUsed.insert(std::make_pair(last + 1u, lastExisting));
+ }
+ }
+ else if (current->second <= last)
+ {
+ current->second = first - 1u;
+ }
+ else
+ {
+ ASSERT(current->first < first && current->second > last);
+ const GLuint lastExisting = current->second;
+ current->second = first - 1u;
+ mUsed.insert(std::make_pair(last + 1u, lastExisting));
+ }
+ }
+}
+
+bool HandleRangeAllocator::isUsed(GLuint handle) const
+{
+ if (handle == kInvalidHandle)
+ return false;
+
+ auto current = mUsed.lower_bound(handle);
+ if (current != mUsed.end())
+ {
+ if (current->first == handle)
+ return true;
+ }
+ --current;
+ return current->second >= handle;
+}
+
+} // namespace gl \ No newline at end of file
diff --git a/gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.h b/gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.h
new file mode 100644
index 0000000000..4d4b6f4f69
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/HandleRangeAllocator.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// HandleRangeAllocator.h: Defines the gl::HandleRangeAllocator class, which is used to
+// allocate contiguous ranges of GL path handles.
+
+#ifndef LIBANGLE_HANDLERANGEALLOCATOR_H_
+#define LIBANGLE_HANDLERANGEALLOCATOR_H_
+
+#include <map>
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+
+namespace gl
+{
+
+// Allocates contiguous ranges of path object handles.
+class HandleRangeAllocator final : angle::NonCopyable
+{
+ public:
+ static const GLuint kInvalidHandle;
+
+ HandleRangeAllocator();
+ ~HandleRangeAllocator();
+
+ // Allocates a new path handle.
+ GLuint allocate();
+
+ // Allocates a handle starting at or above the value of |wanted|.
+ // Note: may wrap if it starts near limit.
+ GLuint allocateAtOrAbove(GLuint wanted);
+
+ // Allocates |range| amount of contiguous paths.
+ // Returns the first id to |first_id| or |kInvalidHandle| if
+ // allocation failed.
+ GLuint allocateRange(GLuint range);
+
+ // Marks an id as used. Returns false if handle was already used.
+ bool markAsUsed(GLuint handle);
+
+ // Release handle.
+ void release(GLuint handle);
+
+ // Release a |range| amount of contiguous handles, starting from |first|
+ void releaseRange(GLuint first, GLuint range);
+
+ // Checks whether or not a resource ID is in use.
+ bool isUsed(GLuint handle) const;
+
+ private:
+ std::map<GLuint, GLuint> mUsed;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_HANDLERANGEALLOCATOR_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/libANGLE/Image.cpp b/gfx/angle/checkout/src/libANGLE/Image.cpp
new file mode 100644
index 0000000000..0a78adea1b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Image.cpp
@@ -0,0 +1,443 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image.cpp: Implements the egl::Image class representing the EGLimage object.
+
+#include "libANGLE/Image.h"
+
+#include "common/debug.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/EGLImplFactory.h"
+#include "libANGLE/renderer/ImageImpl.h"
+
+namespace egl
+{
+
+namespace
+{
+gl::ImageIndex GetImageIndex(EGLenum eglTarget, const egl::AttributeMap &attribs)
+{
+ if (!IsTextureTarget(eglTarget))
+ {
+ return gl::ImageIndex();
+ }
+
+ gl::TextureTarget target = egl_gl::EGLImageTargetToTextureTarget(eglTarget);
+ GLint mip = static_cast<GLint>(attribs.get(EGL_GL_TEXTURE_LEVEL_KHR, 0));
+ GLint layer = static_cast<GLint>(attribs.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0));
+
+ if (target == gl::TextureTarget::_3D)
+ {
+ return gl::ImageIndex::Make3D(mip, layer);
+ }
+ else
+ {
+ ASSERT(layer == 0);
+ return gl::ImageIndex::MakeFromTarget(target, mip, 1);
+ }
+}
+
+const Display *DisplayFromContext(const gl::Context *context)
+{
+ return (context ? context->getDisplay() : nullptr);
+}
+} // anonymous namespace
+
+ImageSibling::ImageSibling() : FramebufferAttachmentObject(), mSourcesOf(), mTargetOf() {}
+
+ImageSibling::~ImageSibling()
+{
+ // EGL images should hold a ref to their targets and siblings, a Texture should not be deletable
+ // while it is attached to an EGL image.
+ // Child class should orphan images before destruction.
+ ASSERT(mSourcesOf.empty());
+ ASSERT(mTargetOf.get() == nullptr);
+}
+
+void ImageSibling::setTargetImage(const gl::Context *context, egl::Image *imageTarget)
+{
+ ASSERT(imageTarget != nullptr);
+ mTargetOf.set(DisplayFromContext(context), imageTarget);
+ imageTarget->addTargetSibling(this);
+}
+
+angle::Result ImageSibling::orphanImages(const gl::Context *context)
+{
+ if (mTargetOf.get() != nullptr)
+ {
+ // Can't be a target and have sources.
+ ASSERT(mSourcesOf.empty());
+
+ ANGLE_TRY(mTargetOf->orphanSibling(context, this));
+ mTargetOf.set(DisplayFromContext(context), nullptr);
+ }
+ else
+ {
+ for (Image *sourceImage : mSourcesOf)
+ {
+ ANGLE_TRY(sourceImage->orphanSibling(context, this));
+ }
+ mSourcesOf.clear();
+ }
+
+ return angle::Result::Continue;
+}
+
+void ImageSibling::addImageSource(egl::Image *imageSource)
+{
+ ASSERT(imageSource != nullptr);
+ mSourcesOf.insert(imageSource);
+}
+
+void ImageSibling::removeImageSource(egl::Image *imageSource)
+{
+ ASSERT(mSourcesOf.find(imageSource) != mSourcesOf.end());
+ mSourcesOf.erase(imageSource);
+}
+
+bool ImageSibling::isEGLImageTarget() const
+{
+ return (mTargetOf.get() != nullptr);
+}
+
+gl::InitState ImageSibling::sourceEGLImageInitState() const
+{
+ ASSERT(isEGLImageTarget());
+ return mTargetOf->sourceInitState();
+}
+
+void ImageSibling::setSourceEGLImageInitState(gl::InitState initState) const
+{
+ ASSERT(isEGLImageTarget());
+ mTargetOf->setInitState(initState);
+}
+
+bool ImageSibling::isRenderable(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex) const
+{
+ ASSERT(isEGLImageTarget());
+ return mTargetOf->isRenderable(context);
+}
+
+void ImageSibling::notifySiblings(angle::SubjectMessage message)
+{
+ if (mTargetOf.get())
+ {
+ mTargetOf->notifySiblings(this, message);
+ }
+ for (Image *source : mSourcesOf)
+ {
+ source->notifySiblings(this, message);
+ }
+}
+
+ExternalImageSibling::ExternalImageSibling(rx::EGLImplFactory *factory,
+ const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attribs)
+ : mImplementation(factory->createExternalImageSibling(context, target, buffer, attribs))
+{}
+
+ExternalImageSibling::~ExternalImageSibling() = default;
+
+void ExternalImageSibling::onDestroy(const egl::Display *display)
+{
+ mImplementation->onDestroy(display);
+}
+
+Error ExternalImageSibling::initialize(const egl::Display *display)
+{
+ return mImplementation->initialize(display);
+}
+
+gl::Extents ExternalImageSibling::getAttachmentSize(const gl::ImageIndex &imageIndex) const
+{
+ return mImplementation->getSize();
+}
+
+gl::Format ExternalImageSibling::getAttachmentFormat(GLenum binding,
+ const gl::ImageIndex &imageIndex) const
+{
+ return mImplementation->getFormat();
+}
+
+GLsizei ExternalImageSibling::getAttachmentSamples(const gl::ImageIndex &imageIndex) const
+{
+ return mImplementation->getSamples();
+}
+
+bool ExternalImageSibling::isRenderable(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex) const
+{
+ return mImplementation->isRenderable(context);
+}
+
+bool ExternalImageSibling::isTextureable(const gl::Context *context) const
+{
+ return mImplementation->isTexturable(context);
+}
+
+void ExternalImageSibling::onAttach(const gl::Context *context) {}
+
+void ExternalImageSibling::onDetach(const gl::Context *context) {}
+
+GLuint ExternalImageSibling::getId() const
+{
+ UNREACHABLE();
+ return 0;
+}
+
+gl::InitState ExternalImageSibling::initState(const gl::ImageIndex &imageIndex) const
+{
+ return gl::InitState::Initialized;
+}
+
+void ExternalImageSibling::setInitState(const gl::ImageIndex &imageIndex, gl::InitState initState)
+{}
+
+rx::ExternalImageSiblingImpl *ExternalImageSibling::getImplementation() const
+{
+ return mImplementation.get();
+}
+
+rx::FramebufferAttachmentObjectImpl *ExternalImageSibling::getAttachmentImpl() const
+{
+ return mImplementation.get();
+}
+
+ImageState::ImageState(EGLenum target, ImageSibling *buffer, const AttributeMap &attribs)
+ : label(nullptr),
+ target(target),
+ imageIndex(GetImageIndex(target, attribs)),
+ source(buffer),
+ targets(),
+ format(GL_NONE),
+ size(),
+ samples(),
+ sourceType(target)
+{}
+
+ImageState::~ImageState() {}
+
+Image::Image(rx::EGLImplFactory *factory,
+ const gl::Context *context,
+ EGLenum target,
+ ImageSibling *buffer,
+ const AttributeMap &attribs)
+ : mState(target, buffer, attribs),
+ mImplementation(factory->createImage(mState, context, target, attribs)),
+ mOrphanedAndNeedsInit(false)
+{
+ ASSERT(mImplementation != nullptr);
+ ASSERT(buffer != nullptr);
+
+ mState.source->addImageSource(this);
+}
+
+void Image::onDestroy(const Display *display)
+{
+ // All targets should hold a ref to the egl image and it should not be deleted until there are
+ // no siblings left.
+ ASSERT(mState.targets.empty());
+
+ // Make sure the implementation gets a chance to clean up before we delete the source.
+ mImplementation->onDestroy(display);
+
+ // Tell the source that it is no longer used by this image
+ if (mState.source != nullptr)
+ {
+ mState.source->removeImageSource(this);
+
+ // If the source is an external object, delete it
+ if (IsExternalImageTarget(mState.sourceType))
+ {
+ ExternalImageSibling *externalSibling = rx::GetAs<ExternalImageSibling>(mState.source);
+ externalSibling->onDestroy(display);
+ delete externalSibling;
+ }
+
+ mState.source = nullptr;
+ }
+}
+
+Image::~Image()
+{
+ SafeDelete(mImplementation);
+}
+
+void Image::setLabel(EGLLabelKHR label)
+{
+ mState.label = label;
+}
+
+EGLLabelKHR Image::getLabel() const
+{
+ return mState.label;
+}
+
+void Image::addTargetSibling(ImageSibling *sibling)
+{
+ mState.targets.insert(sibling);
+}
+
+angle::Result Image::orphanSibling(const gl::Context *context, ImageSibling *sibling)
+{
+ ASSERT(sibling != nullptr);
+
+ // notify impl
+ ANGLE_TRY(mImplementation->orphan(context, sibling));
+
+ if (mState.source == sibling)
+ {
+ // The external source of an image cannot be redefined so it cannot be orpahend.
+ ASSERT(!IsExternalImageTarget(mState.sourceType));
+
+ // If the sibling is the source, it cannot be a target.
+ ASSERT(mState.targets.find(sibling) == mState.targets.end());
+ mState.source = nullptr;
+ mOrphanedAndNeedsInit =
+ (sibling->initState(mState.imageIndex) == gl::InitState::MayNeedInit);
+ }
+ else
+ {
+ mState.targets.erase(sibling);
+ }
+
+ return angle::Result::Continue;
+}
+
+const gl::Format &Image::getFormat() const
+{
+ return mState.format;
+}
+
+bool Image::isRenderable(const gl::Context *context) const
+{
+ if (IsTextureTarget(mState.sourceType))
+ {
+ return mState.format.info->textureAttachmentSupport(context->getClientVersion(),
+ context->getExtensions());
+ }
+ else if (IsRenderbufferTarget(mState.sourceType))
+ {
+ return mState.format.info->renderbufferSupport(context->getClientVersion(),
+ context->getExtensions());
+ }
+ else if (IsExternalImageTarget(mState.sourceType))
+ {
+ ASSERT(mState.source != nullptr);
+ return mState.source->isRenderable(context, GL_NONE, gl::ImageIndex());
+ }
+
+ UNREACHABLE();
+ return false;
+}
+
+bool Image::isTexturable(const gl::Context *context) const
+{
+ if (IsTextureTarget(mState.sourceType))
+ {
+ return mState.format.info->textureSupport(context->getClientVersion(),
+ context->getExtensions());
+ }
+ else if (IsRenderbufferTarget(mState.sourceType))
+ {
+ return true;
+ }
+ else if (IsExternalImageTarget(mState.sourceType))
+ {
+ ASSERT(mState.source != nullptr);
+ return rx::GetAs<ExternalImageSibling>(mState.source)->isTextureable(context);
+ }
+
+ UNREACHABLE();
+ return false;
+}
+
+size_t Image::getWidth() const
+{
+ return mState.size.width;
+}
+
+size_t Image::getHeight() const
+{
+ return mState.size.height;
+}
+
+size_t Image::getSamples() const
+{
+ return mState.samples;
+}
+
+rx::ImageImpl *Image::getImplementation() const
+{
+ return mImplementation;
+}
+
+Error Image::initialize(const Display *display)
+{
+ if (IsExternalImageTarget(mState.sourceType))
+ {
+ ANGLE_TRY(rx::GetAs<ExternalImageSibling>(mState.source)->initialize(display));
+ }
+
+ mState.format = mState.source->getAttachmentFormat(GL_NONE, mState.imageIndex);
+ mState.size = mState.source->getAttachmentSize(mState.imageIndex);
+ mState.samples = mState.source->getAttachmentSamples(mState.imageIndex);
+
+ return mImplementation->initialize(display);
+}
+
+bool Image::orphaned() const
+{
+ return (mState.source == nullptr);
+}
+
+gl::InitState Image::sourceInitState() const
+{
+ if (orphaned())
+ {
+ return mOrphanedAndNeedsInit ? gl::InitState::MayNeedInit : gl::InitState::Initialized;
+ }
+
+ return mState.source->initState(mState.imageIndex);
+}
+
+void Image::setInitState(gl::InitState initState)
+{
+ if (orphaned())
+ {
+ mOrphanedAndNeedsInit = false;
+ }
+
+ return mState.source->setInitState(mState.imageIndex, initState);
+}
+
+void Image::notifySiblings(const ImageSibling *notifier, angle::SubjectMessage message)
+{
+ if (mState.source && mState.source != notifier)
+ {
+ mState.source->onSubjectStateChange(rx::kTextureImageSiblingMessageIndex, message);
+ }
+
+ for (ImageSibling *target : mState.targets)
+ {
+ if (target != notifier)
+ {
+ target->onSubjectStateChange(rx::kTextureImageSiblingMessageIndex, message);
+ }
+ }
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Image.h b/gfx/angle/checkout/src/libANGLE/Image.h
new file mode 100644
index 0000000000..ecbb659147
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Image.h
@@ -0,0 +1,189 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image.h: Defines the egl::Image class representing the EGLimage object.
+
+#ifndef LIBANGLE_IMAGE_H_
+#define LIBANGLE_IMAGE_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/formatutils.h"
+
+#include <set>
+
+namespace rx
+{
+class EGLImplFactory;
+class ImageImpl;
+class ExternalImageSiblingImpl;
+
+// Used for distinguishing dirty bit messages from gl::Texture/rx::TexureImpl/gl::Image.
+constexpr size_t kTextureImageImplObserverMessageIndex = 0;
+constexpr size_t kTextureImageSiblingMessageIndex = 1;
+} // namespace rx
+
+namespace egl
+{
+class Image;
+class Display;
+
+// Only currently Renderbuffers and Textures can be bound with images. This makes the relationship
+// explicit, and also ensures that an image sibling can determine if it's been initialized or not,
+// which is important for the robust resource init extension with Textures and EGLImages.
+class ImageSibling : public gl::FramebufferAttachmentObject, public angle::ObserverInterface
+{
+ public:
+ ImageSibling();
+ ~ImageSibling() override;
+
+ bool isEGLImageTarget() const;
+ gl::InitState sourceEGLImageInitState() const;
+ void setSourceEGLImageInitState(gl::InitState initState) const;
+
+ bool isRenderable(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex) const override;
+
+ // ObserverInterface implementation
+ void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override
+ {
+ // default to no-op.
+ }
+
+ protected:
+ // Set the image target of this sibling
+ void setTargetImage(const gl::Context *context, egl::Image *imageTarget);
+
+ // Orphan all EGL image sources and targets
+ angle::Result orphanImages(const gl::Context *context);
+
+ void notifySiblings(angle::SubjectMessage message);
+
+ private:
+ friend class Image;
+
+ // Called from Image only to add a new source image
+ void addImageSource(egl::Image *imageSource);
+
+ // Called from Image only to remove a source image when the Image is being deleted
+ void removeImageSource(egl::Image *imageSource);
+
+ std::set<Image *> mSourcesOf;
+ BindingPointer<Image> mTargetOf;
+};
+
+// Wrapper for EGLImage sources that are not owned by ANGLE, these often have to do
+// platform-specific queries for format and size information.
+class ExternalImageSibling : public ImageSibling
+{
+ public:
+ ExternalImageSibling(rx::EGLImplFactory *factory,
+ const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attribs);
+ ~ExternalImageSibling() override;
+
+ void onDestroy(const egl::Display *display);
+
+ Error initialize(const Display *display);
+
+ gl::Extents getAttachmentSize(const gl::ImageIndex &imageIndex) const override;
+ gl::Format getAttachmentFormat(GLenum binding, const gl::ImageIndex &imageIndex) const override;
+ GLsizei getAttachmentSamples(const gl::ImageIndex &imageIndex) const override;
+ bool isRenderable(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex) const override;
+ bool isTextureable(const gl::Context *context) const;
+
+ void onAttach(const gl::Context *context) override;
+ void onDetach(const gl::Context *context) override;
+ GLuint getId() const override;
+
+ gl::InitState initState(const gl::ImageIndex &imageIndex) const override;
+ void setInitState(const gl::ImageIndex &imageIndex, gl::InitState initState) override;
+
+ rx::ExternalImageSiblingImpl *getImplementation() const;
+
+ protected:
+ rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override;
+
+ private:
+ std::unique_ptr<rx::ExternalImageSiblingImpl> mImplementation;
+};
+
+struct ImageState : private angle::NonCopyable
+{
+ ImageState(EGLenum target, ImageSibling *buffer, const AttributeMap &attribs);
+ ~ImageState();
+
+ EGLLabelKHR label;
+ EGLenum target;
+ gl::ImageIndex imageIndex;
+ ImageSibling *source;
+ std::set<ImageSibling *> targets;
+
+ gl::Format format;
+ gl::Extents size;
+ size_t samples;
+ EGLenum sourceType;
+};
+
+class Image final : public RefCountObject, public LabeledObject
+{
+ public:
+ Image(rx::EGLImplFactory *factory,
+ const gl::Context *context,
+ EGLenum target,
+ ImageSibling *buffer,
+ const AttributeMap &attribs);
+
+ void onDestroy(const Display *display) override;
+ ~Image() override;
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ const gl::Format &getFormat() const;
+ bool isRenderable(const gl::Context *context) const;
+ bool isTexturable(const gl::Context *context) const;
+ size_t getWidth() const;
+ size_t getHeight() const;
+ size_t getSamples() const;
+
+ Error initialize(const Display *display);
+
+ rx::ImageImpl *getImplementation() const;
+
+ bool orphaned() const;
+ gl::InitState sourceInitState() const;
+ void setInitState(gl::InitState initState);
+
+ private:
+ friend class ImageSibling;
+
+ // Called from ImageSibling only notify the image that a new target sibling exists for state
+ // tracking.
+ void addTargetSibling(ImageSibling *sibling);
+
+ // Called from ImageSibling only to notify the image that a sibling (source or target) has
+ // been respecified and state tracking should be updated.
+ angle::Result orphanSibling(const gl::Context *context, ImageSibling *sibling);
+
+ void notifySiblings(const ImageSibling *notifier, angle::SubjectMessage message);
+
+ ImageState mState;
+ rx::ImageImpl *mImplementation;
+ bool mOrphanedAndNeedsInit;
+};
+} // namespace egl
+
+#endif // LIBANGLE_IMAGE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/ImageIndex.cpp b/gfx/angle/checkout/src/libANGLE/ImageIndex.cpp
new file mode 100644
index 0000000000..bdeedcd9a5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ImageIndex.cpp
@@ -0,0 +1,365 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ImageIndex.cpp: Implementation for ImageIndex methods.
+
+#include "libANGLE/ImageIndex.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/angletypes.h"
+
+#include <tuple>
+
+namespace gl
+{
+namespace
+{
+GLint TextureTargetToLayer(TextureTarget target)
+{
+ switch (target)
+ {
+ case TextureTarget::CubeMapPositiveX:
+ return 0;
+ case TextureTarget::CubeMapNegativeX:
+ return 1;
+ case TextureTarget::CubeMapPositiveY:
+ return 2;
+ case TextureTarget::CubeMapNegativeY:
+ return 3;
+ case TextureTarget::CubeMapPositiveZ:
+ return 4;
+ case TextureTarget::CubeMapNegativeZ:
+ return 5;
+ case TextureTarget::External:
+ return ImageIndex::kEntireLevel;
+ case TextureTarget::Rectangle:
+ return ImageIndex::kEntireLevel;
+ case TextureTarget::_2D:
+ return ImageIndex::kEntireLevel;
+ case TextureTarget::_2DArray:
+ return ImageIndex::kEntireLevel;
+ case TextureTarget::_2DMultisample:
+ return ImageIndex::kEntireLevel;
+ case TextureTarget::_2DMultisampleArray:
+ return ImageIndex::kEntireLevel;
+ case TextureTarget::_3D:
+ return ImageIndex::kEntireLevel;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+TextureTarget TextureTypeToTarget(TextureType type, GLint layerIndex)
+{
+ if (type == TextureType::CubeMap)
+ {
+ // As GL_TEXTURE_CUBE_MAP cannot be a texture target in texImage*D APIs, so we don't allow
+ // an entire cube map to have a texture target.
+ ASSERT(layerIndex != ImageIndex::kEntireLevel);
+ return CubeFaceIndexToTextureTarget(layerIndex);
+ }
+ else
+ {
+ return NonCubeTextureTypeToTarget(type);
+ }
+}
+
+bool IsArrayTarget(TextureTarget target)
+{
+ switch (target)
+ {
+ case TextureTarget::_2DArray:
+ case TextureTarget::_2DMultisampleArray:
+ return true;
+ default:
+ return false;
+ }
+}
+} // anonymous namespace
+
+ImageIndex::ImageIndex()
+ : mType(TextureType::InvalidEnum), mLevelIndex(0), mLayerIndex(0), mLayerCount(kEntireLevel)
+{}
+
+ImageIndex::ImageIndex(const ImageIndex &other) = default;
+
+ImageIndex &ImageIndex::operator=(const ImageIndex &other) = default;
+
+bool ImageIndex::hasLayer() const
+{
+ return mLayerIndex != kEntireLevel;
+}
+
+bool ImageIndex::isLayered() const
+{
+ switch (mType)
+ {
+ case TextureType::_2DArray:
+ case TextureType::_2DMultisampleArray:
+ case TextureType::CubeMap:
+ case TextureType::_3D:
+ return mLayerIndex == kEntireLevel;
+ default:
+ return false;
+ }
+}
+
+bool ImageIndex::has3DLayer() const
+{
+ // It's quicker to check != CubeMap than calling usesTex3D, which checks multiple types. This
+ // ASSERT validates the check gives the same result.
+ ASSERT(!hasLayer() || ((mType != TextureType::CubeMap) == usesTex3D()));
+ return (hasLayer() && mType != TextureType::CubeMap);
+}
+
+bool ImageIndex::usesTex3D() const
+{
+ return mType == TextureType::_3D || mType == TextureType::_2DArray ||
+ mType == TextureType::_2DMultisampleArray;
+}
+
+TextureTarget ImageIndex::getTarget() const
+{
+ return TextureTypeToTarget(mType, mLayerIndex);
+}
+
+GLint ImageIndex::cubeMapFaceIndex() const
+{
+ ASSERT(mType == TextureType::CubeMap);
+ ASSERT(mLayerIndex == kEntireLevel || mLayerIndex < static_cast<GLint>(kCubeFaceCount));
+ return mLayerIndex;
+}
+
+bool ImageIndex::valid() const
+{
+ return mType != TextureType::InvalidEnum;
+}
+
+bool ImageIndex::isEntireLevelCubeMap() const
+{
+ return mType == TextureType::CubeMap && mLayerIndex == ImageIndex::kEntireLevel;
+}
+
+ImageIndex ImageIndex::Make2D(GLint levelIndex)
+{
+ return ImageIndex(TextureType::_2D, levelIndex, kEntireLevel, 1);
+}
+
+ImageIndex ImageIndex::MakeRectangle(GLint levelIndex)
+{
+ return ImageIndex(TextureType::Rectangle, levelIndex, kEntireLevel, 1);
+}
+
+ImageIndex ImageIndex::MakeCubeMapFace(TextureTarget target, GLint levelIndex)
+{
+ ASSERT(IsCubeMapFaceTarget(target));
+ return ImageIndex(TextureType::CubeMap, levelIndex, TextureTargetToLayer(target), 1);
+}
+
+ImageIndex ImageIndex::Make2DArray(GLint levelIndex, GLint layerIndex)
+{
+ return ImageIndex(TextureType::_2DArray, levelIndex, layerIndex, 1);
+}
+
+ImageIndex ImageIndex::Make2DArrayRange(GLint levelIndex, GLint layerIndex, GLint numLayers)
+{
+ return ImageIndex(TextureType::_2DArray, levelIndex, layerIndex, numLayers);
+}
+
+ImageIndex ImageIndex::Make3D(GLint levelIndex, GLint layerIndex)
+{
+ return ImageIndex(TextureType::_3D, levelIndex, layerIndex, 1);
+}
+
+ImageIndex ImageIndex::MakeFromTarget(TextureTarget target, GLint levelIndex, GLint depth)
+{
+ return ImageIndex(TextureTargetToType(target), levelIndex, TextureTargetToLayer(target),
+ IsArrayTarget(target) ? depth : 1);
+}
+
+ImageIndex ImageIndex::MakeFromType(TextureType type,
+ GLint levelIndex,
+ GLint layerIndex,
+ GLint layerCount)
+{
+ GLint overrideLayerCount =
+ (type == TextureType::CubeMap && layerIndex == kEntireLevel ? kCubeFaceCount : layerCount);
+ return ImageIndex(type, levelIndex, layerIndex, overrideLayerCount);
+}
+
+ImageIndex ImageIndex::Make2DMultisample()
+{
+ return ImageIndex(TextureType::_2DMultisample, 0, kEntireLevel, 1);
+}
+
+ImageIndex ImageIndex::Make2DMultisampleArray(GLint layerIndex)
+{
+ return ImageIndex(TextureType::_2DMultisampleArray, 0, layerIndex, 1);
+}
+
+ImageIndex ImageIndex::Make2DMultisampleArrayRange(GLint layerIndex, GLint numLayers)
+{
+ return ImageIndex(TextureType::_2DMultisampleArray, 0, layerIndex, numLayers);
+}
+
+bool ImageIndex::operator<(const ImageIndex &b) const
+{
+ return std::tie(mType, mLevelIndex, mLayerIndex, mLayerCount) <
+ std::tie(b.mType, b.mLevelIndex, b.mLayerIndex, b.mLayerCount);
+}
+
+bool ImageIndex::operator==(const ImageIndex &b) const
+{
+ return std::tie(mType, mLevelIndex, mLayerIndex, mLayerCount) ==
+ std::tie(b.mType, b.mLevelIndex, b.mLayerIndex, b.mLayerCount);
+}
+
+bool ImageIndex::operator!=(const ImageIndex &b) const
+{
+ return !(*this == b);
+}
+
+ImageIndex::ImageIndex(TextureType type, GLint levelIndex, GLint layerIndex, GLint layerCount)
+ : mType(type), mLevelIndex(levelIndex), mLayerIndex(layerIndex), mLayerCount(layerCount)
+{}
+
+ImageIndexIterator ImageIndex::getLayerIterator(GLint layerCount) const
+{
+ ASSERT(mType != TextureType::_2D && !hasLayer());
+ return ImageIndexIterator::MakeGeneric(mType, mLevelIndex, mLevelIndex + 1, 0, layerCount);
+}
+
+ImageIndexIterator::ImageIndexIterator(const ImageIndexIterator &other) = default;
+
+ImageIndexIterator ImageIndexIterator::Make2D(GLint minMip, GLint maxMip)
+{
+ return ImageIndexIterator(TextureType::_2D, Range<GLint>(minMip, maxMip),
+ Range<GLint>(ImageIndex::kEntireLevel, ImageIndex::kEntireLevel),
+ nullptr);
+}
+
+ImageIndexIterator ImageIndexIterator::MakeRectangle(GLint minMip, GLint maxMip)
+{
+ return ImageIndexIterator(TextureType::Rectangle, Range<GLint>(minMip, maxMip),
+ Range<GLint>(ImageIndex::kEntireLevel, ImageIndex::kEntireLevel),
+ nullptr);
+}
+
+ImageIndexIterator ImageIndexIterator::MakeCube(GLint minMip, GLint maxMip)
+{
+ return ImageIndexIterator(TextureType::CubeMap, Range<GLint>(minMip, maxMip),
+ Range<GLint>(0, 6), nullptr);
+}
+
+ImageIndexIterator ImageIndexIterator::Make3D(GLint minMip,
+ GLint maxMip,
+ GLint minLayer,
+ GLint maxLayer)
+{
+ return ImageIndexIterator(TextureType::_3D, Range<GLint>(minMip, maxMip),
+ Range<GLint>(minLayer, maxLayer), nullptr);
+}
+
+ImageIndexIterator ImageIndexIterator::Make2DArray(GLint minMip,
+ GLint maxMip,
+ const GLsizei *layerCounts)
+{
+ return ImageIndexIterator(TextureType::_2DArray, Range<GLint>(minMip, maxMip),
+ Range<GLint>(0, IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS),
+ layerCounts);
+}
+
+ImageIndexIterator ImageIndexIterator::Make2DMultisample()
+{
+ return ImageIndexIterator(TextureType::_2DMultisample, Range<GLint>(0, 1),
+ Range<GLint>(ImageIndex::kEntireLevel, ImageIndex::kEntireLevel),
+ nullptr);
+}
+
+ImageIndexIterator ImageIndexIterator::Make2DMultisampleArray(const GLsizei *layerCounts)
+{
+ return ImageIndexIterator(TextureType::_2DMultisampleArray, Range<GLint>(0, 1),
+ Range<GLint>(0, IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS),
+ layerCounts);
+}
+
+ImageIndexIterator ImageIndexIterator::MakeGeneric(TextureType type,
+ GLint minMip,
+ GLint maxMip,
+ GLint minLayer,
+ GLint maxLayer)
+{
+ if (type == TextureType::CubeMap)
+ {
+ return MakeCube(minMip, maxMip);
+ }
+
+ return ImageIndexIterator(type, Range<GLint>(minMip, maxMip), Range<GLint>(minLayer, maxLayer),
+ nullptr);
+}
+
+ImageIndexIterator::ImageIndexIterator(TextureType type,
+ const Range<GLint> &mipRange,
+ const Range<GLint> &layerRange,
+ const GLsizei *layerCounts)
+ : mMipRange(mipRange),
+ mLayerRange(layerRange),
+ mLayerCounts(layerCounts),
+ mCurrentIndex(type, mipRange.low(), layerRange.low(), 1)
+{}
+
+GLint ImageIndexIterator::maxLayer() const
+{
+ if (mLayerCounts)
+ {
+ ASSERT(mCurrentIndex.hasLayer());
+ return (mCurrentIndex.getLevelIndex() < mMipRange.high())
+ ? mLayerCounts[mCurrentIndex.getLevelIndex()]
+ : 0;
+ }
+ return mLayerRange.high();
+}
+
+ImageIndex ImageIndexIterator::next()
+{
+ ASSERT(hasNext());
+
+ // Make a copy of the current index to return
+ ImageIndex previousIndex = mCurrentIndex;
+
+ // Iterate layers in the inner loop for now. We can add switchable
+ // layer or mip iteration if we need it.
+
+ if (mCurrentIndex.hasLayer() && mCurrentIndex.getLayerIndex() < maxLayer() - 1)
+ {
+ mCurrentIndex.mLayerIndex++;
+ }
+ else if (mCurrentIndex.mLevelIndex < mMipRange.high() - 1)
+ {
+ mCurrentIndex.mLayerIndex = mLayerRange.low();
+ mCurrentIndex.mLevelIndex++;
+ }
+ else
+ {
+ mCurrentIndex = ImageIndex();
+ }
+
+ return previousIndex;
+}
+
+ImageIndex ImageIndexIterator::current() const
+{
+ return mCurrentIndex;
+}
+
+bool ImageIndexIterator::hasNext() const
+{
+ return mCurrentIndex.valid();
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/ImageIndex.h b/gfx/angle/checkout/src/libANGLE/ImageIndex.h
new file mode 100644
index 0000000000..fc785566f9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ImageIndex.h
@@ -0,0 +1,126 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ImageIndex.h: A helper struct for indexing into an Image array
+
+#ifndef LIBANGLE_IMAGE_INDEX_H_
+#define LIBANGLE_IMAGE_INDEX_H_
+
+#include "common/PackedEnums.h"
+#include "common/mathutil.h"
+
+#include "angle_gl.h"
+
+namespace gl
+{
+
+class ImageIndexIterator;
+
+class ImageIndex
+{
+ public:
+ ImageIndex();
+ ImageIndex(const ImageIndex &other);
+ ImageIndex &operator=(const ImageIndex &other);
+
+ TextureType getType() const { return mType; }
+ GLint getLevelIndex() const { return mLevelIndex; }
+ GLint getLayerIndex() const { return mLayerIndex; }
+ GLint getLayerCount() const { return mLayerCount; }
+
+ bool hasLayer() const;
+ bool has3DLayer() const;
+ bool usesTex3D() const;
+ GLint cubeMapFaceIndex() const;
+ bool valid() const;
+ // Note that you cannot use this function when the ImageIndex represents an entire level of cube
+ // map.
+ TextureTarget getTarget() const;
+
+ bool isLayered() const;
+ bool isEntireLevelCubeMap() const;
+
+ static ImageIndex Make2D(GLint levelIndex);
+ static ImageIndex MakeRectangle(GLint levelIndex);
+ static ImageIndex MakeCubeMapFace(TextureTarget target, GLint levelIndex);
+ static ImageIndex Make2DArray(GLint levelIndex, GLint layerIndex = kEntireLevel);
+ static ImageIndex Make2DArrayRange(GLint levelIndex, GLint layerIndex, GLint layerCount);
+ static ImageIndex Make3D(GLint levelIndex, GLint layerIndex = kEntireLevel);
+ static ImageIndex MakeFromTarget(TextureTarget target, GLint levelIndex, GLint depth);
+ static ImageIndex MakeFromType(TextureType type,
+ GLint levelIndex,
+ GLint layerIndex = kEntireLevel,
+ GLint layerCount = 1);
+ static ImageIndex Make2DMultisample();
+ static ImageIndex Make2DMultisampleArray(GLint layerIndex = kEntireLevel);
+ static ImageIndex Make2DMultisampleArrayRange(GLint layerIndex, GLint layerCount);
+
+ static constexpr GLint kEntireLevel = static_cast<GLint>(-1);
+
+ bool operator<(const ImageIndex &b) const;
+ bool operator==(const ImageIndex &b) const;
+ bool operator!=(const ImageIndex &b) const;
+
+ // Only valid for 3D/Cube textures with layers.
+ ImageIndexIterator getLayerIterator(GLint layerCount) const;
+
+ private:
+ friend class ImageIndexIterator;
+
+ ImageIndex(TextureType type, GLint leveIndex, GLint layerIndex, GLint layerCount);
+
+ TextureType mType;
+ GLint mLevelIndex;
+ GLint mLayerIndex;
+ GLint mLayerCount;
+};
+
+// To be used like this:
+//
+// ImageIndexIterator it = ...;
+// while (it.hasNext())
+// {
+// ImageIndex current = it.next();
+// }
+class ImageIndexIterator
+{
+ public:
+ ImageIndexIterator(const ImageIndexIterator &other);
+
+ static ImageIndexIterator Make2D(GLint minMip, GLint maxMip);
+ static ImageIndexIterator MakeRectangle(GLint minMip, GLint maxMip);
+ static ImageIndexIterator MakeCube(GLint minMip, GLint maxMip);
+ static ImageIndexIterator Make3D(GLint minMip, GLint maxMip, GLint minLayer, GLint maxLayer);
+ static ImageIndexIterator Make2DArray(GLint minMip, GLint maxMip, const GLsizei *layerCounts);
+ static ImageIndexIterator Make2DMultisample();
+ static ImageIndexIterator Make2DMultisampleArray(const GLsizei *layerCounts);
+ static ImageIndexIterator MakeGeneric(TextureType type,
+ GLint minMip,
+ GLint maxMip,
+ GLint minLayer,
+ GLint maxLayer);
+
+ ImageIndex next();
+ ImageIndex current() const;
+ bool hasNext() const;
+
+ private:
+ ImageIndexIterator(TextureType type,
+ const Range<GLint> &mipRange,
+ const Range<GLint> &layerRange,
+ const GLsizei *layerCounts);
+
+ GLint maxLayer() const;
+
+ const Range<GLint> mMipRange;
+ const Range<GLint> mLayerRange;
+ const GLsizei *const mLayerCounts;
+
+ ImageIndex mCurrentIndex;
+};
+} // namespace gl
+
+#endif // LIBANGLE_IMAGE_INDEX_H_
diff --git a/gfx/angle/checkout/src/libANGLE/IndexRangeCache.cpp b/gfx/angle/checkout/src/libANGLE/IndexRangeCache.cpp
new file mode 100644
index 0000000000..5540dc8a7c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/IndexRangeCache.cpp
@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexRangeCache.cpp: Defines the gl::IndexRangeCache class which stores information about
+// ranges of indices.
+
+#include "libANGLE/IndexRangeCache.h"
+
+#include "common/debug.h"
+#include "libANGLE/formatutils.h"
+
+namespace gl
+{
+
+IndexRangeCache::IndexRangeCache() {}
+
+IndexRangeCache::~IndexRangeCache() {}
+
+void IndexRangeCache::addRange(DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ const IndexRange &range)
+{
+ mIndexRangeCache[IndexRangeKey(type, offset, count, primitiveRestartEnabled)] = range;
+}
+
+bool IndexRangeCache::findRange(DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ IndexRange *outRange) const
+{
+ auto i = mIndexRangeCache.find(IndexRangeKey(type, offset, count, primitiveRestartEnabled));
+ if (i != mIndexRangeCache.end())
+ {
+ if (outRange)
+ {
+ *outRange = i->second;
+ }
+ return true;
+ }
+ else
+ {
+ if (outRange)
+ {
+ *outRange = IndexRange();
+ }
+ return false;
+ }
+}
+
+void IndexRangeCache::invalidateRange(size_t offset, size_t size)
+{
+ size_t invalidateStart = offset;
+ size_t invalidateEnd = offset + size;
+
+ auto i = mIndexRangeCache.begin();
+ while (i != mIndexRangeCache.end())
+ {
+ size_t rangeStart = i->first.offset;
+ size_t rangeEnd =
+ i->first.offset + (GetDrawElementsTypeSize(i->first.type) * i->first.count);
+
+ if (invalidateEnd < rangeStart || invalidateStart > rangeEnd)
+ {
+ ++i;
+ }
+ else
+ {
+ mIndexRangeCache.erase(i++);
+ }
+ }
+}
+
+void IndexRangeCache::clear()
+{
+ mIndexRangeCache.clear();
+}
+
+IndexRangeCache::IndexRangeKey::IndexRangeKey()
+ : IndexRangeCache::IndexRangeKey(DrawElementsType::InvalidEnum, 0, 0, false)
+{}
+
+IndexRangeCache::IndexRangeKey::IndexRangeKey(DrawElementsType type_,
+ size_t offset_,
+ size_t count_,
+ bool primitiveRestartEnabled_)
+ : type(type_), offset(offset_), count(count_), primitiveRestartEnabled(primitiveRestartEnabled_)
+{}
+
+bool IndexRangeCache::IndexRangeKey::operator<(const IndexRangeKey &rhs) const
+{
+ if (type != rhs.type)
+ {
+ return type < rhs.type;
+ }
+ if (offset != rhs.offset)
+ {
+ return offset < rhs.offset;
+ }
+ if (count != rhs.count)
+ {
+ return count < rhs.count;
+ }
+ if (primitiveRestartEnabled != rhs.primitiveRestartEnabled)
+ {
+ return primitiveRestartEnabled;
+ }
+ return false;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/IndexRangeCache.h b/gfx/angle/checkout/src/libANGLE/IndexRangeCache.h
new file mode 100644
index 0000000000..f53602d12f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/IndexRangeCache.h
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexRangeCache.h: Defines the gl::IndexRangeCache class which stores information about
+// ranges of indices.
+
+#ifndef LIBANGLE_INDEXRANGECACHE_H_
+#define LIBANGLE_INDEXRANGECACHE_H_
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+
+#include <map>
+
+namespace gl
+{
+
+class IndexRangeCache
+{
+ public:
+ IndexRangeCache();
+ ~IndexRangeCache();
+
+ void addRange(DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ const IndexRange &range);
+ bool findRange(DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ IndexRange *outRange) const;
+
+ void invalidateRange(size_t offset, size_t size);
+ void clear();
+
+ private:
+ struct IndexRangeKey
+ {
+ IndexRangeKey();
+ IndexRangeKey(DrawElementsType type, size_t offset, size_t count, bool primitiveRestart);
+
+ bool operator<(const IndexRangeKey &rhs) const;
+
+ DrawElementsType type;
+ size_t offset;
+ size_t count;
+ bool primitiveRestartEnabled;
+ };
+
+ typedef std::map<IndexRangeKey, IndexRange> IndexRangeMap;
+ IndexRangeMap mIndexRangeCache;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_INDEXRANGECACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/LoggingAnnotator.cpp b/gfx/angle/checkout/src/libANGLE/LoggingAnnotator.cpp
new file mode 100644
index 0000000000..b3721aceca
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/LoggingAnnotator.cpp
@@ -0,0 +1,63 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// LoggingAnnotator.cpp: DebugAnnotator implementing logging
+//
+
+#include "libANGLE/LoggingAnnotator.h"
+
+#include "libANGLE/trace.h"
+
+namespace angle
+{
+
+bool LoggingAnnotator::getStatus()
+{
+ return false;
+}
+
+void LoggingAnnotator::beginEvent(const char *eventName, const char *eventMessage)
+{
+ ANGLE_TRACE_EVENT_BEGIN0("gpu.angle", eventName);
+}
+
+void LoggingAnnotator::endEvent(const char *eventName)
+{
+ ANGLE_TRACE_EVENT_END0("gpu.angle", eventName);
+}
+
+void LoggingAnnotator::setMarker(const char *markerName)
+{
+ ANGLE_TRACE_EVENT_INSTANT0("gpu.angle", markerName);
+}
+
+void LoggingAnnotator::logMessage(const gl::LogMessage &msg) const
+{
+ auto *plat = ANGLEPlatformCurrent();
+ if (plat != nullptr)
+ {
+ switch (msg.getSeverity())
+ {
+ case gl::LOG_FATAL:
+ case gl::LOG_ERR:
+ plat->logError(plat, msg.getMessage().c_str());
+ break;
+ case gl::LOG_WARN:
+ plat->logWarning(plat, msg.getMessage().c_str());
+ break;
+ case gl::LOG_INFO:
+ plat->logInfo(plat, msg.getMessage().c_str());
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ gl::Trace(msg.getSeverity(), msg.getMessage().c_str());
+ }
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libANGLE/LoggingAnnotator.h b/gfx/angle/checkout/src/libANGLE/LoggingAnnotator.h
new file mode 100644
index 0000000000..9a4fbe429b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/LoggingAnnotator.h
@@ -0,0 +1,31 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// LoggingAnnotator.h: DebugAnnotator implementing logging
+//
+
+#ifndef LIBANGLE_LOGGINGANNOTATOR_H_
+#define LIBANGLE_LOGGINGANNOTATOR_H_
+
+#include "common/debug.h"
+
+namespace angle
+{
+
+class LoggingAnnotator : public gl::DebugAnnotator
+{
+ public:
+ LoggingAnnotator() {}
+ ~LoggingAnnotator() override {}
+ void beginEvent(const char *eventName, const char *eventMessage) override;
+ void endEvent(const char *eventName) override;
+ void setMarker(const char *markerName) override;
+ bool getStatus() override;
+ void logMessage(const gl::LogMessage &msg) const override;
+};
+
+} // namespace angle
+
+#endif // LIBANGLE_LOGGINGANNOTATOR_H_
diff --git a/gfx/angle/checkout/src/libANGLE/MemoryObject.cpp b/gfx/angle/checkout/src/libANGLE/MemoryObject.cpp
new file mode 100644
index 0000000000..fcb2e961b3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/MemoryObject.cpp
@@ -0,0 +1,36 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// MemoryObject.h: Implements the gl::MemoryObject class [EXT_external_objects]
+
+#include "libANGLE/MemoryObject.h"
+
+#include "common/angleutils.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/MemoryObjectImpl.h"
+
+namespace gl
+{
+
+MemoryObject::MemoryObject(rx::GLImplFactory *factory, GLuint id)
+ : RefCountObject(id), mImplementation(factory->createMemoryObject())
+{}
+
+MemoryObject::~MemoryObject() {}
+
+void MemoryObject::onDestroy(const Context *context)
+{
+ mImplementation->onDestroy(context);
+}
+
+angle::Result MemoryObject::importFd(Context *context,
+ GLuint64 size,
+ HandleType handleType,
+ GLint fd)
+{
+ return mImplementation->importFd(context, size, handleType, fd);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/MemoryObject.h b/gfx/angle/checkout/src/libANGLE/MemoryObject.h
new file mode 100644
index 0000000000..1bc1d40145
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/MemoryObject.h
@@ -0,0 +1,45 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// MemoryObject.h: Defines the gl::MemoryObject class [EXT_external_objects]
+
+#ifndef LIBANGLE_MEMORYOBJECT_H_
+#define LIBANGLE_MEMORYOBJECT_H_
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+
+namespace rx
+{
+class GLImplFactory;
+class MemoryObjectImpl;
+} // namespace rx
+
+namespace gl
+{
+class Context;
+
+class MemoryObject final : public RefCountObject
+{
+ public:
+ MemoryObject(rx::GLImplFactory *factory, GLuint id);
+ ~MemoryObject() override;
+
+ void onDestroy(const Context *context) override;
+
+ rx::MemoryObjectImpl *getImplementation() const { return mImplementation.get(); }
+
+ angle::Result importFd(Context *context, GLuint64 size, HandleType handleType, GLint fd);
+
+ private:
+ std::unique_ptr<rx::MemoryObjectImpl> mImplementation;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_MEMORYOBJECT_H_
diff --git a/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp b/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp
new file mode 100644
index 0000000000..3a927f648a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp
@@ -0,0 +1,256 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// MemoryProgramCache: Stores compiled and linked programs in memory so they don't
+// always have to be re-compiled. Can be used in conjunction with the platform
+// layer to warm up the cache from disk.
+
+#include "libANGLE/MemoryProgramCache.h"
+
+#include <GLSLANG/ShaderVars.h>
+#include <anglebase/sha1.h>
+
+#include "common/utilities.h"
+#include "common/version.h"
+#include "libANGLE/BinaryStream.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Uniform.h"
+#include "libANGLE/histogram_macros.h"
+#include "libANGLE/renderer/ProgramImpl.h"
+#include "platform/Platform.h"
+
+namespace gl
+{
+
+namespace
+{
+constexpr unsigned int kWarningLimit = 3;
+
+class HashStream final : angle::NonCopyable
+{
+ public:
+ std::string str() { return mStringStream.str(); }
+
+ template <typename T>
+ HashStream &operator<<(T value)
+ {
+ mStringStream << value << kSeparator;
+ return *this;
+ }
+
+ private:
+ static constexpr char kSeparator = ':';
+ std::ostringstream mStringStream;
+};
+
+HashStream &operator<<(HashStream &stream, const Shader *shader)
+{
+ if (shader)
+ {
+ stream << shader->getSourceString().c_str() << shader->getSourceString().length()
+ << shader->getCompilerResourcesString().c_str();
+ }
+ return stream;
+}
+
+HashStream &operator<<(HashStream &stream, const ProgramBindings &bindings)
+{
+ for (const auto &binding : bindings)
+ {
+ stream << binding.first << binding.second.location;
+ }
+ return stream;
+}
+
+HashStream &operator<<(HashStream &stream, const std::vector<std::string> &strings)
+{
+ for (const auto &str : strings)
+ {
+ stream << str;
+ }
+ return stream;
+}
+
+HashStream &operator<<(HashStream &stream, const std::vector<gl::VariableLocation> &locations)
+{
+ for (const auto &loc : locations)
+ {
+ stream << loc.index << loc.arrayIndex << loc.ignored;
+ }
+ return stream;
+}
+
+} // anonymous namespace
+
+MemoryProgramCache::MemoryProgramCache(egl::BlobCache &blobCache)
+ : mBlobCache(blobCache), mIssuedWarnings(0)
+{}
+
+MemoryProgramCache::~MemoryProgramCache() {}
+
+void MemoryProgramCache::ComputeHash(const Context *context,
+ const Program *program,
+ egl::BlobCache::Key *hashOut)
+{
+ // Compute the program hash. Start with the shader hashes and resource strings.
+ HashStream hashStream;
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ hashStream << program->getAttachedShader(shaderType);
+ }
+
+ // Add some ANGLE metadata and Context properties, such as version and back-end.
+ hashStream << ANGLE_COMMIT_HASH << context->getClientMajorVersion()
+ << context->getClientMinorVersion() << context->getString(GL_RENDERER);
+
+ // Hash pre-link program properties.
+ hashStream << program->getAttributeBindings() << program->getUniformLocationBindings()
+ << program->getFragmentInputBindings()
+ << program->getState().getTransformFeedbackVaryingNames()
+ << program->getState().getTransformFeedbackBufferMode()
+ << program->getState().getOutputLocations()
+ << program->getState().getSecondaryOutputLocations();
+
+ // Call the secure SHA hashing function.
+ const std::string &programKey = hashStream.str();
+ angle::base::SHA1HashBytes(reinterpret_cast<const unsigned char *>(programKey.c_str()),
+ programKey.length(), hashOut->data());
+}
+
+angle::Result MemoryProgramCache::getProgram(const Context *context,
+ Program *program,
+ egl::BlobCache::Key *hashOut)
+{
+ // If caching is effectively disabled, don't bother calculating the hash.
+ if (!mBlobCache.isCachingEnabled())
+ {
+ return angle::Result::Incomplete;
+ }
+
+ ComputeHash(context, program, hashOut);
+ egl::BlobCache::Value binaryProgram;
+ if (get(context, *hashOut, &binaryProgram))
+ {
+ angle::Result result = program->loadBinary(context, GL_PROGRAM_BINARY_ANGLE,
+ binaryProgram.data(), binaryProgram.size());
+ ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ProgramCache.LoadBinarySuccess",
+ result == angle::Result::Continue);
+ ANGLE_TRY(result);
+
+ if (result == angle::Result::Continue)
+ return angle::Result::Continue;
+
+ // Cache load failed, evict.
+ if (mIssuedWarnings++ < kWarningLimit)
+ {
+ WARN() << "Failed to load binary from cache.";
+
+ if (mIssuedWarnings == kWarningLimit)
+ {
+ WARN() << "Reaching warning limit for cache load failures, silencing "
+ "subsequent warnings.";
+ }
+ }
+ remove(*hashOut);
+ }
+ return angle::Result::Incomplete;
+}
+
+bool MemoryProgramCache::get(const Context *context,
+ const egl::BlobCache::Key &programHash,
+ egl::BlobCache::Value *programOut)
+{
+ return mBlobCache.get(context->getScratchBuffer(), programHash, programOut);
+}
+
+bool MemoryProgramCache::getAt(size_t index,
+ const egl::BlobCache::Key **hashOut,
+ egl::BlobCache::Value *programOut)
+{
+ return mBlobCache.getAt(index, hashOut, programOut);
+}
+
+void MemoryProgramCache::remove(const egl::BlobCache::Key &programHash)
+{
+ mBlobCache.remove(programHash);
+}
+
+void MemoryProgramCache::putProgram(const egl::BlobCache::Key &programHash,
+ const Context *context,
+ const Program *program)
+{
+ // If caching is effectively disabled, don't bother serializing the program.
+ if (!mBlobCache.isCachingEnabled())
+ {
+ return;
+ }
+
+ angle::MemoryBuffer serializedProgram;
+ program->serialize(context, &serializedProgram);
+
+ ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramBinarySizeBytes",
+ static_cast<int>(serializedProgram.size()));
+
+ // TODO(syoussefi): to be removed. Compatibility for Chrome until it supports
+ // EGL_ANDROID_blob_cache. http://anglebug.com/2516
+ auto *platform = ANGLEPlatformCurrent();
+ platform->cacheProgram(platform, programHash, serializedProgram.size(),
+ serializedProgram.data());
+
+ mBlobCache.put(programHash, std::move(serializedProgram));
+}
+
+void MemoryProgramCache::updateProgram(const Context *context, const Program *program)
+{
+ egl::BlobCache::Key programHash;
+ ComputeHash(context, program, &programHash);
+ putProgram(programHash, context, program);
+}
+
+void MemoryProgramCache::putBinary(const egl::BlobCache::Key &programHash,
+ const uint8_t *binary,
+ size_t length)
+{
+ // Copy the binary.
+ angle::MemoryBuffer newEntry;
+ newEntry.resize(length);
+ memcpy(newEntry.data(), binary, length);
+
+ // Store the binary.
+ mBlobCache.populate(programHash, std::move(newEntry));
+}
+
+void MemoryProgramCache::clear()
+{
+ mBlobCache.clear();
+ mIssuedWarnings = 0;
+}
+
+void MemoryProgramCache::resize(size_t maxCacheSizeBytes)
+{
+ mBlobCache.resize(maxCacheSizeBytes);
+}
+
+size_t MemoryProgramCache::entryCount() const
+{
+ return mBlobCache.entryCount();
+}
+
+size_t MemoryProgramCache::trim(size_t limit)
+{
+ return mBlobCache.trim(limit);
+}
+
+size_t MemoryProgramCache::size() const
+{
+ return mBlobCache.size();
+}
+
+size_t MemoryProgramCache::maxSize() const
+{
+ return mBlobCache.maxSize();
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.h b/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.h
new file mode 100644
index 0000000000..106fc243e8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.h
@@ -0,0 +1,91 @@
+//
+// Copyright 2017-2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// MemoryProgramCache: Stores compiled and linked programs in memory so they don't
+// always have to be re-compiled. Can be used in conjunction with the platform
+// layer to warm up the cache from disk.
+
+#ifndef LIBANGLE_MEMORY_PROGRAM_CACHE_H_
+#define LIBANGLE_MEMORY_PROGRAM_CACHE_H_
+
+#include <array>
+
+#include "common/MemoryBuffer.h"
+#include "libANGLE/BlobCache.h"
+#include "libANGLE/Error.h"
+
+namespace gl
+{
+class Context;
+class Program;
+class ProgramState;
+
+class MemoryProgramCache final : angle::NonCopyable
+{
+ public:
+ explicit MemoryProgramCache(egl::BlobCache &blobCache);
+ ~MemoryProgramCache();
+
+ static void ComputeHash(const Context *context,
+ const Program *program,
+ egl::BlobCache::Key *hashOut);
+
+ // Check if the cache contains a binary matching the specified program.
+ bool get(const Context *context,
+ const egl::BlobCache::Key &programHash,
+ egl::BlobCache::Value *programOut);
+
+ // For querying the contents of the cache.
+ bool getAt(size_t index,
+ const egl::BlobCache::Key **hashOut,
+ egl::BlobCache::Value *programOut);
+
+ // Evict a program from the binary cache.
+ void remove(const egl::BlobCache::Key &programHash);
+
+ // Helper method that serializes a program.
+ void putProgram(const egl::BlobCache::Key &programHash,
+ const Context *context,
+ const Program *program);
+
+ // Same as putProgram but computes the hash.
+ void updateProgram(const Context *context, const Program *program);
+
+ // Store a binary directly. TODO(syoussefi): deprecated. Will be removed once Chrome supports
+ // EGL_ANDROID_blob_cache. http://anglebug.com/2516
+ void putBinary(const egl::BlobCache::Key &programHash, const uint8_t *binary, size_t length);
+
+ // Check the cache, and deserialize and load the program if found. Evict existing hash if load
+ // fails.
+ angle::Result getProgram(const Context *context,
+ Program *program,
+ egl::BlobCache::Key *hashOut);
+
+ // Empty the cache.
+ void clear();
+
+ // Resize the cache. Discards current contents.
+ void resize(size_t maxCacheSizeBytes);
+
+ // Returns the number of entries in the cache.
+ size_t entryCount() const;
+
+ // Reduces the current cache size and returns the number of bytes freed.
+ size_t trim(size_t limit);
+
+ // Returns the current cache size in bytes.
+ size_t size() const;
+
+ // Returns the maximum cache size in bytes.
+ size_t maxSize() const;
+
+ private:
+ egl::BlobCache &mBlobCache;
+ unsigned int mIssuedWarnings;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_MEMORY_PROGRAM_CACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Observer.cpp b/gfx/angle/checkout/src/libANGLE/Observer.cpp
new file mode 100644
index 0000000000..8f20c46d7b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Observer.cpp
@@ -0,0 +1,101 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Observer:
+// Implements the Observer pattern for sending state change notifications
+// from Subject objects to dependent Observer objects.
+//
+// See design document:
+// https://docs.google.com/document/d/15Edfotqg6_l1skTEL8ADQudF_oIdNa7i8Po43k6jMd4/
+
+#include "libANGLE/Observer.h"
+
+#include <algorithm>
+
+#include "common/debug.h"
+
+namespace angle
+{
+namespace
+{} // anonymous namespace
+
+// Observer implementation.
+ObserverInterface::~ObserverInterface() = default;
+
+// Subject implementation.
+Subject::Subject() {}
+
+Subject::~Subject()
+{
+ resetObservers();
+}
+
+bool Subject::hasObservers() const
+{
+ return !mObservers.empty();
+}
+
+void Subject::onStateChange(SubjectMessage message) const
+{
+ if (mObservers.empty())
+ return;
+
+ for (const ObserverBindingBase *binding : mObservers)
+ {
+ binding->getObserver()->onSubjectStateChange(binding->getSubjectIndex(), message);
+ }
+}
+
+void Subject::resetObservers()
+{
+ for (angle::ObserverBindingBase *binding : mObservers)
+ {
+ binding->onSubjectReset();
+ }
+ mObservers.clear();
+}
+
+// ObserverBinding implementation.
+ObserverBinding::ObserverBinding(ObserverInterface *observer, SubjectIndex index)
+ : ObserverBindingBase(observer, index), mSubject(nullptr)
+{
+ ASSERT(observer);
+}
+
+ObserverBinding::~ObserverBinding()
+{
+ reset();
+}
+
+ObserverBinding::ObserverBinding(const ObserverBinding &other) = default;
+
+ObserverBinding &ObserverBinding::operator=(const ObserverBinding &other) = default;
+
+void ObserverBinding::bind(Subject *subject)
+{
+ ASSERT(getObserver());
+ if (mSubject)
+ {
+ mSubject->removeObserver(this);
+ }
+
+ mSubject = subject;
+
+ if (mSubject)
+ {
+ mSubject->addObserver(this);
+ }
+}
+
+void ObserverBinding::onStateChange(SubjectMessage message) const
+{
+ getObserver()->onSubjectStateChange(getSubjectIndex(), message);
+}
+
+void ObserverBinding::onSubjectReset()
+{
+ mSubject = nullptr;
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libANGLE/Observer.h b/gfx/angle/checkout/src/libANGLE/Observer.h
new file mode 100644
index 0000000000..b06e705b90
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Observer.h
@@ -0,0 +1,138 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Observer:
+// Implements the Observer pattern for sending state change notifications
+// from Subject objects to dependent Observer objects.
+//
+// See design document:
+// https://docs.google.com/document/d/15Edfotqg6_l1skTEL8ADQudF_oIdNa7i8Po43k6jMd4/
+
+#ifndef LIBANGLE_OBSERVER_H_
+#define LIBANGLE_OBSERVER_H_
+
+#include "common/FastVector.h"
+#include "common/angleutils.h"
+
+namespace angle
+{
+template <typename HaystackT, typename NeedleT>
+bool IsInContainer(const HaystackT &haystack, const NeedleT &needle)
+{
+ return std::find(haystack.begin(), haystack.end(), needle) != haystack.end();
+}
+
+using SubjectIndex = size_t;
+
+// Messages are used to distinguish different Subject events that get sent to a single Observer.
+// It could be possible to improve the handling by using different callback functions instead
+// of a single handler function. But in some cases we want to share a single binding between
+// Observer and Subject and handle different types of events.
+enum class SubjectMessage
+{
+ // Used by gl::VertexArray to notify gl::Context of a gl::Buffer binding count change. Triggers
+ // a validation cache update.
+ BindingChanged,
+
+ // Only the contents (pixels, bytes, etc) changed in this Subject. Distinct from the object
+ // storage.
+ ContentsChanged,
+
+ // Sent by gl::Sampler, gl::Texture, gl::Framebuffer and others to notifiy gl::Context. This
+ // flag indicates to call syncState before next use.
+ DirtyBitsFlagged,
+
+ // Generic state change message. Used in multiple places for different purposes.
+ SubjectChanged,
+
+ // Indicates a bound gl::Buffer is now mapped or unmapped. Passed from gl::Buffer, through
+ // gl::VertexArray, into gl::Context. Used to track validation.
+ SubjectMapped,
+ SubjectUnmapped,
+};
+
+// The observing class inherits from this interface class.
+class ObserverInterface
+{
+ public:
+ virtual ~ObserverInterface();
+ virtual void onSubjectStateChange(SubjectIndex index, SubjectMessage message) = 0;
+};
+
+class ObserverBindingBase
+{
+ public:
+ ObserverBindingBase(ObserverInterface *observer, SubjectIndex subjectIndex)
+ : mObserver(observer), mIndex(subjectIndex)
+ {}
+ virtual ~ObserverBindingBase() {}
+
+ ObserverInterface *getObserver() const { return mObserver; }
+ SubjectIndex getSubjectIndex() const { return mIndex; }
+
+ virtual void onSubjectReset() {}
+
+ private:
+ ObserverInterface *mObserver;
+ SubjectIndex mIndex;
+};
+
+// Maintains a list of observer bindings. Sends update messages to the observer.
+class Subject : NonCopyable
+{
+ public:
+ Subject();
+ virtual ~Subject();
+
+ void onStateChange(SubjectMessage message) const;
+ bool hasObservers() const;
+ void resetObservers();
+
+ ANGLE_INLINE void addObserver(ObserverBindingBase *observer)
+ {
+ ASSERT(!IsInContainer(mObservers, observer));
+ mObservers.push_back(observer);
+ }
+
+ ANGLE_INLINE void removeObserver(ObserverBindingBase *observer)
+ {
+ ASSERT(IsInContainer(mObservers, observer));
+ mObservers.remove_and_permute(observer);
+ }
+
+ private:
+ // Keep a short list of observers so we can allocate/free them quickly. But since we support
+ // unlimited bindings, have a spill-over list of that uses dynamic allocation.
+ static constexpr size_t kMaxFixedObservers = 8;
+ angle::FastVector<ObserverBindingBase *, kMaxFixedObservers> mObservers;
+};
+
+// Keeps a binding between a Subject and Observer, with a specific subject index.
+class ObserverBinding final : public ObserverBindingBase
+{
+ public:
+ ObserverBinding(ObserverInterface *observer, SubjectIndex index);
+ ~ObserverBinding() override;
+ ObserverBinding(const ObserverBinding &other);
+ ObserverBinding &operator=(const ObserverBinding &other);
+
+ void bind(Subject *subject);
+
+ ANGLE_INLINE void reset() { bind(nullptr); }
+
+ void onStateChange(SubjectMessage message) const;
+ void onSubjectReset() override;
+
+ ANGLE_INLINE const Subject *getSubject() const { return mSubject; }
+
+ ANGLE_INLINE void assignSubject(Subject *subject) { mSubject = subject; }
+
+ private:
+ Subject *mSubject;
+};
+
+} // namespace angle
+
+#endif // LIBANGLE_OBSERVER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Path.cpp b/gfx/angle/checkout/src/libANGLE/Path.cpp
new file mode 100644
index 0000000000..86adae743f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Path.cpp
@@ -0,0 +1,77 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Path.h: Defines the gl::Path class, representing CHROMIUM_path_rendering
+// path object.
+
+#include "libANGLE/Path.h"
+#include "libANGLE/renderer/PathImpl.h"
+
+#include "common/debug.h"
+#include "common/mathutil.h"
+
+namespace gl
+{
+
+Path::Path(rx::PathImpl *impl)
+ : mPath(impl),
+ mHasData(false),
+ mEndCaps(GL_FLAT_CHROMIUM),
+ mJoinStyle(GL_MITER_REVERT_CHROMIUM),
+ mStrokeWidth(1.0f),
+ mStrokeBound(0.2f),
+ mMiterLimit(4.0f)
+{}
+
+Path::~Path()
+{
+ delete mPath;
+}
+
+angle::Result Path::setCommands(GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords)
+{
+ ANGLE_TRY(mPath->setCommands(numCommands, commands, numCoords, coordType, coords));
+
+ mHasData = true;
+
+ return angle::Result::Continue;
+}
+
+void Path::setStrokeWidth(GLfloat width)
+{
+ mStrokeWidth = width;
+ mPath->setPathParameter(GL_PATH_STROKE_WIDTH_CHROMIUM, mStrokeWidth);
+}
+
+void Path::setStrokeBound(GLfloat bound)
+{
+ mStrokeBound = clamp(bound, 0.0f, 1.0f);
+ mPath->setPathParameter(GL_PATH_STROKE_BOUND_CHROMIUM, mStrokeBound);
+}
+
+void Path::setEndCaps(GLenum type)
+{
+ mEndCaps = type;
+ mPath->setPathParameter(GL_PATH_END_CAPS_CHROMIUM, static_cast<GLfloat>(type));
+}
+
+void Path::setJoinStyle(GLenum type)
+{
+ mJoinStyle = type;
+ mPath->setPathParameter(GL_PATH_JOIN_STYLE_CHROMIUM, static_cast<GLfloat>(type));
+}
+
+void Path::setMiterLimit(GLfloat value)
+{
+ mMiterLimit = value;
+ mPath->setPathParameter(GL_PATH_MITER_LIMIT_CHROMIUM, value);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Path.h b/gfx/angle/checkout/src/libANGLE/Path.h
new file mode 100644
index 0000000000..8fb714c4cd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Path.h
@@ -0,0 +1,71 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Path.h: Defines the gl::Path class, representing CHROMIUM_path_rendering
+// path object.
+
+#ifndef LIBANGLE_PATH_H_
+#define LIBANGLE_PATH_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+
+namespace rx
+{
+class PathImpl;
+}
+
+namespace gl
+{
+class Path final : angle::NonCopyable
+{
+ public:
+ Path(rx::PathImpl *impl);
+
+ ~Path();
+
+ angle::Result setCommands(GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords);
+
+ void setStrokeWidth(GLfloat width);
+ void setStrokeBound(GLfloat bound);
+ void setEndCaps(GLenum type);
+ void setJoinStyle(GLenum type);
+ void setMiterLimit(GLfloat value);
+
+ GLfloat getStrokeWidth() const { return mStrokeWidth; }
+ GLfloat getStrokeBound() const { return mStrokeBound; }
+ GLfloat getMiterLimit() const { return mMiterLimit; }
+ GLenum getEndCaps() const { return mEndCaps; }
+ GLenum getJoinStyle() const { return mJoinStyle; }
+
+ bool hasPathData() const { return mHasData; }
+
+ rx::PathImpl *getImplementation() const { return mPath; }
+
+ private:
+ rx::PathImpl *mPath;
+
+ // a Path object is not actually considered "a path"
+ // untill it has been specified with data. So we'll
+ // keep this flag to support this semantics.
+ bool mHasData;
+
+ GLenum mEndCaps;
+ GLenum mJoinStyle;
+ GLfloat mStrokeWidth;
+ GLfloat mStrokeBound;
+ GLfloat mMiterLimit;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_PATH_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/libANGLE/Platform.cpp b/gfx/angle/checkout/src/libANGLE/Platform.cpp
new file mode 100644
index 0000000000..6cbbd1e80d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Platform.cpp
@@ -0,0 +1,65 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Platform.cpp: Implementation methods for angle::Platform.
+
+#include <platform/Platform.h>
+
+#include <cstring>
+
+#include "common/debug.h"
+
+namespace
+{
+// TODO(jmadill): Make methods owned by egl::Display.
+angle::PlatformMethods g_platformMethods;
+} // anonymous namespace
+
+angle::PlatformMethods *ANGLEPlatformCurrent()
+{
+ return &g_platformMethods;
+}
+
+bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display,
+ const char *const methodNames[],
+ unsigned int methodNameCount,
+ void *context,
+ void *platformMethods)
+{
+ angle::PlatformMethods **platformMethodsOut =
+ reinterpret_cast<angle::PlatformMethods **>(platformMethods);
+
+ // We allow for a lower input count of impl platform methods if the subset is correct.
+ if (methodNameCount > angle::g_NumPlatformMethods)
+ {
+ ERR() << "Invalid platform method count: " << methodNameCount << ", expected "
+ << angle::g_NumPlatformMethods << ".";
+ return false;
+ }
+
+ for (unsigned int nameIndex = 0; nameIndex < methodNameCount; ++nameIndex)
+ {
+ const char *expectedName = angle::g_PlatformMethodNames[nameIndex];
+ const char *actualName = methodNames[nameIndex];
+ if (strcmp(expectedName, actualName) != 0)
+ {
+ ERR() << "Invalid platform method name: " << actualName << ", expected " << expectedName
+ << ".";
+ return false;
+ }
+ }
+
+ // TODO(jmadill): Store platform methods in display.
+ g_platformMethods.context = context;
+ *platformMethodsOut = &g_platformMethods;
+ return true;
+}
+
+void ANGLE_APIENTRY ANGLEResetDisplayPlatform(angle::EGLDisplayType display)
+{
+ // TODO(jmadill): Store platform methods in display.
+ g_platformMethods = angle::PlatformMethods();
+}
diff --git a/gfx/angle/checkout/src/libANGLE/Program.cpp b/gfx/angle/checkout/src/libANGLE/Program.cpp
new file mode 100644
index 0000000000..6dc5e97a72
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Program.cpp
@@ -0,0 +1,4966 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Program.cpp: Implements the gl::Program class. Implements GL program objects
+// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
+
+#include "libANGLE/Program.h"
+
+#include <algorithm>
+#include <utility>
+
+#include "common/bitset_utils.h"
+#include "common/debug.h"
+#include "common/platform.h"
+#include "common/string_utils.h"
+#include "common/utilities.h"
+#include "common/version.h"
+#include "compiler/translator/blocklayout.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/MemoryProgramCache.h"
+#include "libANGLE/ProgramLinkedResources.h"
+#include "libANGLE/ResourceManager.h"
+#include "libANGLE/Uniform.h"
+#include "libANGLE/VaryingPacking.h"
+#include "libANGLE/Version.h"
+#include "libANGLE/features.h"
+#include "libANGLE/histogram_macros.h"
+#include "libANGLE/queryconversions.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/ProgramImpl.h"
+#include "platform/FrontendFeatures.h"
+#include "platform/Platform.h"
+
+namespace gl
+{
+
+namespace
+{
+
+// This simplified cast function doesn't need to worry about advanced concepts like
+// depth range values, or casting to bool.
+template <typename DestT, typename SrcT>
+DestT UniformStateQueryCast(SrcT value);
+
+// From-Float-To-Integer Casts
+template <>
+GLint UniformStateQueryCast(GLfloat value)
+{
+ return clampCast<GLint>(roundf(value));
+}
+
+template <>
+GLuint UniformStateQueryCast(GLfloat value)
+{
+ return clampCast<GLuint>(roundf(value));
+}
+
+// From-Integer-to-Integer Casts
+template <>
+GLint UniformStateQueryCast(GLuint value)
+{
+ return clampCast<GLint>(value);
+}
+
+template <>
+GLuint UniformStateQueryCast(GLint value)
+{
+ return clampCast<GLuint>(value);
+}
+
+// From-Boolean-to-Anything Casts
+template <>
+GLfloat UniformStateQueryCast(GLboolean value)
+{
+ return (ConvertToBool(value) ? 1.0f : 0.0f);
+}
+
+template <>
+GLint UniformStateQueryCast(GLboolean value)
+{
+ return (ConvertToBool(value) ? 1 : 0);
+}
+
+template <>
+GLuint UniformStateQueryCast(GLboolean value)
+{
+ return (ConvertToBool(value) ? 1u : 0u);
+}
+
+// Default to static_cast
+template <typename DestT, typename SrcT>
+DestT UniformStateQueryCast(SrcT value)
+{
+ return static_cast<DestT>(value);
+}
+
+template <typename SrcT, typename DestT>
+void UniformStateQueryCastLoop(DestT *dataOut, const uint8_t *srcPointer, int components)
+{
+ for (int comp = 0; comp < components; ++comp)
+ {
+ // We only work with strides of 4 bytes for uniform components. (GLfloat/GLint)
+ // Don't use SrcT stride directly since GLboolean has a stride of 1 byte.
+ size_t offset = comp * 4;
+ const SrcT *typedSrcPointer = reinterpret_cast<const SrcT *>(&srcPointer[offset]);
+ dataOut[comp] = UniformStateQueryCast<DestT>(*typedSrcPointer);
+ }
+}
+
+template <typename VarT>
+GLuint GetResourceIndexFromName(const std::vector<VarT> &list, const std::string &name)
+{
+ std::string nameAsArrayName = name + "[0]";
+ for (size_t index = 0; index < list.size(); index++)
+ {
+ const VarT &resource = list[index];
+ if (resource.name == name || (resource.isArray() && resource.name == nameAsArrayName))
+ {
+ return static_cast<GLuint>(index);
+ }
+ }
+
+ return GL_INVALID_INDEX;
+}
+
+template <typename VarT>
+GLint GetVariableLocation(const std::vector<VarT> &list,
+ const std::vector<VariableLocation> &locationList,
+ const std::string &name)
+{
+ size_t nameLengthWithoutArrayIndex;
+ unsigned int arrayIndex = ParseArrayIndex(name, &nameLengthWithoutArrayIndex);
+
+ for (size_t location = 0u; location < locationList.size(); ++location)
+ {
+ const VariableLocation &variableLocation = locationList[location];
+ if (!variableLocation.used())
+ {
+ continue;
+ }
+
+ const VarT &variable = list[variableLocation.index];
+
+ // Array output variables may be bound out of order, so we need to ensure we only pick the
+ // first element if given the base name. Uniforms don't allow this behavior and some code
+ // seemingly depends on the opposite behavior, so only enable it for output variables.
+ if (angle::BeginsWith(variable.name, name) &&
+ (!std::is_base_of<sh::OutputVariable, VarT>::value || variableLocation.arrayIndex == 0))
+ {
+ if (name.length() == variable.name.length())
+ {
+ ASSERT(name == variable.name);
+ // GLES 3.1 November 2016 page 87.
+ // The string exactly matches the name of the active variable.
+ return static_cast<GLint>(location);
+ }
+ if (name.length() + 3u == variable.name.length() && variable.isArray())
+ {
+ ASSERT(name + "[0]" == variable.name);
+ // The string identifies the base name of an active array, where the string would
+ // exactly match the name of the variable if the suffix "[0]" were appended to the
+ // string.
+ return static_cast<GLint>(location);
+ }
+ }
+ if (variable.isArray() && variableLocation.arrayIndex == arrayIndex &&
+ nameLengthWithoutArrayIndex + 3u == variable.name.length() &&
+ angle::BeginsWith(variable.name, name, nameLengthWithoutArrayIndex))
+ {
+ ASSERT(name.substr(0u, nameLengthWithoutArrayIndex) + "[0]" == variable.name);
+ // The string identifies an active element of the array, where the string ends with the
+ // concatenation of the "[" character, an integer (with no "+" sign, extra leading
+ // zeroes, or whitespace) identifying an array element, and the "]" character, the
+ // integer is less than the number of active elements of the array variable, and where
+ // the string would exactly match the enumerated name of the array if the decimal
+ // integer were replaced with zero.
+ return static_cast<GLint>(location);
+ }
+ }
+
+ return -1;
+}
+
+void CopyStringToBuffer(GLchar *buffer,
+ const std::string &string,
+ GLsizei bufSize,
+ GLsizei *lengthOut)
+{
+ ASSERT(bufSize > 0);
+ size_t length = std::min<size_t>(bufSize - 1, string.length());
+ memcpy(buffer, string.c_str(), length);
+ buffer[length] = '\0';
+
+ if (lengthOut)
+ {
+ *lengthOut = length;
+ }
+}
+
+bool IncludeSameArrayElement(const std::set<std::string> &nameSet, const std::string &name)
+{
+ std::vector<unsigned int> subscripts;
+ std::string baseName = ParseResourceName(name, &subscripts);
+ for (const std::string &nameInSet : nameSet)
+ {
+ std::vector<unsigned int> arrayIndices;
+ std::string arrayName = ParseResourceName(nameInSet, &arrayIndices);
+ if (baseName == arrayName &&
+ (subscripts.empty() || arrayIndices.empty() || subscripts == arrayIndices))
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+std::string GetInterfaceBlockLimitName(ShaderType shaderType, sh::BlockType blockType)
+{
+ std::ostringstream stream;
+ stream << "GL_MAX_" << GetShaderTypeString(shaderType) << "_";
+
+ switch (blockType)
+ {
+ case sh::BlockType::BLOCK_UNIFORM:
+ stream << "UNIFORM_BUFFERS";
+ break;
+ case sh::BlockType::BLOCK_BUFFER:
+ stream << "SHADER_STORAGE_BLOCKS";
+ break;
+ default:
+ UNREACHABLE();
+ return "";
+ }
+
+ if (shaderType == ShaderType::Geometry)
+ {
+ stream << "_EXT";
+ }
+
+ return stream.str();
+}
+
+const char *GetInterfaceBlockTypeString(sh::BlockType blockType)
+{
+ switch (blockType)
+ {
+ case sh::BlockType::BLOCK_UNIFORM:
+ return "uniform block";
+ case sh::BlockType::BLOCK_BUFFER:
+ return "shader storage block";
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+void LogInterfaceBlocksExceedLimit(InfoLog &infoLog,
+ ShaderType shaderType,
+ sh::BlockType blockType,
+ GLuint limit)
+{
+ infoLog << GetShaderTypeString(shaderType) << " shader "
+ << GetInterfaceBlockTypeString(blockType) << " count exceeds "
+ << GetInterfaceBlockLimitName(shaderType, blockType) << " (" << limit << ")";
+}
+
+bool ValidateInterfaceBlocksCount(GLuint maxInterfaceBlocks,
+ const std::vector<sh::InterfaceBlock> &interfaceBlocks,
+ ShaderType shaderType,
+ sh::BlockType blockType,
+ GLuint *combinedInterfaceBlocksCount,
+ InfoLog &infoLog)
+{
+ GLuint blockCount = 0;
+ for (const sh::InterfaceBlock &block : interfaceBlocks)
+ {
+ if (IsActiveInterfaceBlock(block))
+ {
+ blockCount += std::max(block.arraySize, 1u);
+ if (blockCount > maxInterfaceBlocks)
+ {
+ LogInterfaceBlocksExceedLimit(infoLog, shaderType, blockType, maxInterfaceBlocks);
+ return false;
+ }
+ }
+ }
+
+ // [OpenGL ES 3.1] Chapter 7.6.2 Page 105:
+ // If a uniform block is used by multiple shader stages, each such use counts separately
+ // against this combined limit.
+ // [OpenGL ES 3.1] Chapter 7.8 Page 111:
+ // If a shader storage block in a program is referenced by multiple shaders, each such
+ // reference counts separately against this combined limit.
+ if (combinedInterfaceBlocksCount)
+ {
+ *combinedInterfaceBlocksCount += blockCount;
+ }
+
+ return true;
+}
+
+GLuint GetInterfaceBlockIndex(const std::vector<InterfaceBlock> &list, const std::string &name)
+{
+ std::vector<unsigned int> subscripts;
+ std::string baseName = ParseResourceName(name, &subscripts);
+
+ unsigned int numBlocks = static_cast<unsigned int>(list.size());
+ for (unsigned int blockIndex = 0; blockIndex < numBlocks; blockIndex++)
+ {
+ const auto &block = list[blockIndex];
+ if (block.name == baseName)
+ {
+ const bool arrayElementZero =
+ (subscripts.empty() && (!block.isArray || block.arrayElement == 0));
+ const bool arrayElementMatches =
+ (subscripts.size() == 1 && subscripts[0] == block.arrayElement);
+ if (arrayElementMatches || arrayElementZero)
+ {
+ return blockIndex;
+ }
+ }
+ }
+
+ return GL_INVALID_INDEX;
+}
+
+void GetInterfaceBlockName(const GLuint index,
+ const std::vector<InterfaceBlock> &list,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ ASSERT(index < list.size());
+
+ const auto &block = list[index];
+
+ if (bufSize > 0)
+ {
+ std::string blockName = block.name;
+
+ if (block.isArray)
+ {
+ blockName += ArrayString(block.arrayElement);
+ }
+ CopyStringToBuffer(name, blockName, bufSize, length);
+ }
+}
+
+void InitUniformBlockLinker(const ProgramState &state, UniformBlockLinker *blockLinker)
+{
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ Shader *shader = state.getAttachedShader(shaderType);
+ if (shader)
+ {
+ blockLinker->addShaderBlocks(shaderType, &shader->getUniformBlocks());
+ }
+ }
+}
+
+void InitShaderStorageBlockLinker(const ProgramState &state, ShaderStorageBlockLinker *blockLinker)
+{
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ Shader *shader = state.getAttachedShader(shaderType);
+ if (shader != nullptr)
+ {
+ blockLinker->addShaderBlocks(shaderType, &shader->getShaderStorageBlocks());
+ }
+ }
+}
+
+// Find the matching varying or field by name.
+const sh::ShaderVariable *FindVaryingOrField(const ProgramMergedVaryings &varyings,
+ const std::string &name)
+{
+ const sh::ShaderVariable *var = nullptr;
+ for (const auto &ref : varyings)
+ {
+ const sh::Varying *varying = ref.second.get();
+ if (varying->name == name)
+ {
+ var = varying;
+ break;
+ }
+ GLuint fieldIndex = 0;
+ var = FindShaderVarField(*varying, name, &fieldIndex);
+ if (var != nullptr)
+ {
+ break;
+ }
+ }
+ return var;
+}
+
+void AddParentPrefix(const std::string &parentName, std::string *mismatchedFieldName)
+{
+ ASSERT(mismatchedFieldName);
+ if (mismatchedFieldName->empty())
+ {
+ *mismatchedFieldName = parentName;
+ }
+ else
+ {
+ std::ostringstream stream;
+ stream << parentName << "." << *mismatchedFieldName;
+ *mismatchedFieldName = stream.str();
+ }
+}
+
+const char *GetLinkMismatchErrorString(LinkMismatchError linkError)
+{
+ switch (linkError)
+ {
+ case LinkMismatchError::TYPE_MISMATCH:
+ return "Type";
+ case LinkMismatchError::ARRAY_SIZE_MISMATCH:
+ return "Array size";
+ case LinkMismatchError::PRECISION_MISMATCH:
+ return "Precision";
+ case LinkMismatchError::STRUCT_NAME_MISMATCH:
+ return "Structure name";
+ case LinkMismatchError::FIELD_NUMBER_MISMATCH:
+ return "Field number";
+ case LinkMismatchError::FIELD_NAME_MISMATCH:
+ return "Field name";
+
+ case LinkMismatchError::INTERPOLATION_TYPE_MISMATCH:
+ return "Interpolation type";
+ case LinkMismatchError::INVARIANCE_MISMATCH:
+ return "Invariance";
+
+ case LinkMismatchError::BINDING_MISMATCH:
+ return "Binding layout qualifier";
+ case LinkMismatchError::LOCATION_MISMATCH:
+ return "Location layout qualifier";
+ case LinkMismatchError::OFFSET_MISMATCH:
+ return "Offset layout qualifier";
+ case LinkMismatchError::INSTANCE_NAME_MISMATCH:
+ return "Instance name qualifier";
+
+ case LinkMismatchError::LAYOUT_QUALIFIER_MISMATCH:
+ return "Layout qualifier";
+ case LinkMismatchError::MATRIX_PACKING_MISMATCH:
+ return "Matrix Packing";
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+LinkMismatchError LinkValidateInterfaceBlockFields(const sh::InterfaceBlockField &blockField1,
+ const sh::InterfaceBlockField &blockField2,
+ bool webglCompatibility,
+ std::string *mismatchedBlockFieldName)
+{
+ if (blockField1.name != blockField2.name)
+ {
+ return LinkMismatchError::FIELD_NAME_MISMATCH;
+ }
+
+ // If webgl, validate precision of UBO fields, otherwise don't. See Khronos bug 10287.
+ LinkMismatchError linkError = Program::LinkValidateVariablesBase(
+ blockField1, blockField2, webglCompatibility, true, mismatchedBlockFieldName);
+ if (linkError != LinkMismatchError::NO_MISMATCH)
+ {
+ AddParentPrefix(blockField1.name, mismatchedBlockFieldName);
+ return linkError;
+ }
+
+ if (blockField1.isRowMajorLayout != blockField2.isRowMajorLayout)
+ {
+ AddParentPrefix(blockField1.name, mismatchedBlockFieldName);
+ return LinkMismatchError::MATRIX_PACKING_MISMATCH;
+ }
+
+ return LinkMismatchError::NO_MISMATCH;
+}
+
+LinkMismatchError AreMatchingInterfaceBlocks(const sh::InterfaceBlock &interfaceBlock1,
+ const sh::InterfaceBlock &interfaceBlock2,
+ bool webglCompatibility,
+ std::string *mismatchedBlockFieldName)
+{
+ // validate blocks for the same member types
+ if (interfaceBlock1.fields.size() != interfaceBlock2.fields.size())
+ {
+ return LinkMismatchError::FIELD_NUMBER_MISMATCH;
+ }
+ if (interfaceBlock1.arraySize != interfaceBlock2.arraySize)
+ {
+ return LinkMismatchError::ARRAY_SIZE_MISMATCH;
+ }
+ if (interfaceBlock1.layout != interfaceBlock2.layout ||
+ interfaceBlock1.binding != interfaceBlock2.binding)
+ {
+ return LinkMismatchError::LAYOUT_QUALIFIER_MISMATCH;
+ }
+ if (interfaceBlock1.instanceName.empty() != interfaceBlock2.instanceName.empty())
+ {
+ return LinkMismatchError::INSTANCE_NAME_MISMATCH;
+ }
+ const unsigned int numBlockMembers = static_cast<unsigned int>(interfaceBlock1.fields.size());
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++)
+ {
+ const sh::InterfaceBlockField &member1 = interfaceBlock1.fields[blockMemberIndex];
+ const sh::InterfaceBlockField &member2 = interfaceBlock2.fields[blockMemberIndex];
+
+ LinkMismatchError linkError = LinkValidateInterfaceBlockFields(
+ member1, member2, webglCompatibility, mismatchedBlockFieldName);
+ if (linkError != LinkMismatchError::NO_MISMATCH)
+ {
+ return linkError;
+ }
+ }
+ return LinkMismatchError::NO_MISMATCH;
+}
+
+using ShaderInterfaceBlock = std::pair<ShaderType, const sh::InterfaceBlock *>;
+using InterfaceBlockMap = std::map<std::string, ShaderInterfaceBlock>;
+
+void InitializeInterfaceBlockMap(const std::vector<sh::InterfaceBlock> &interfaceBlocks,
+ ShaderType shaderType,
+ InterfaceBlockMap *linkedInterfaceBlocks)
+{
+ ASSERT(linkedInterfaceBlocks);
+
+ for (const sh::InterfaceBlock &interfaceBlock : interfaceBlocks)
+ {
+ (*linkedInterfaceBlocks)[interfaceBlock.name] = std::make_pair(shaderType, &interfaceBlock);
+ }
+}
+
+bool ValidateGraphicsInterfaceBlocksPerShader(
+ const std::vector<sh::InterfaceBlock> &interfaceBlocksToLink,
+ ShaderType shaderType,
+ bool webglCompatibility,
+ InterfaceBlockMap *linkedBlocks,
+ InfoLog &infoLog)
+{
+ ASSERT(linkedBlocks);
+
+ for (const sh::InterfaceBlock &block : interfaceBlocksToLink)
+ {
+ const auto &entry = linkedBlocks->find(block.name);
+ if (entry != linkedBlocks->end())
+ {
+ const sh::InterfaceBlock &linkedBlock = *(entry->second.second);
+ std::string mismatchedStructFieldName;
+ LinkMismatchError linkError = AreMatchingInterfaceBlocks(
+ block, linkedBlock, webglCompatibility, &mismatchedStructFieldName);
+ if (linkError != LinkMismatchError::NO_MISMATCH)
+ {
+ LogLinkMismatch(infoLog, block.name, GetInterfaceBlockTypeString(block.blockType),
+ linkError, mismatchedStructFieldName, entry->second.first,
+ shaderType);
+ return false;
+ }
+ }
+ else
+ {
+ (*linkedBlocks)[block.name] = std::make_pair(shaderType, &block);
+ }
+ }
+
+ return true;
+}
+
+bool ValidateInterfaceBlocksMatch(
+ GLuint numShadersHasInterfaceBlocks,
+ const ShaderMap<const std::vector<sh::InterfaceBlock> *> &shaderInterfaceBlocks,
+ InfoLog &infoLog,
+ bool webglCompatibility)
+{
+ if (numShadersHasInterfaceBlocks < 2u)
+ {
+ return true;
+ }
+
+ ASSERT(!shaderInterfaceBlocks[ShaderType::Compute]);
+
+ // Check that interface blocks defined in the graphics shaders are identical
+
+ InterfaceBlockMap linkedInterfaceBlocks;
+
+ bool interfaceBlockMapInitialized = false;
+ for (ShaderType shaderType : kAllGraphicsShaderTypes)
+ {
+ if (!shaderInterfaceBlocks[shaderType])
+ {
+ continue;
+ }
+
+ if (!interfaceBlockMapInitialized)
+ {
+ InitializeInterfaceBlockMap(*shaderInterfaceBlocks[shaderType], shaderType,
+ &linkedInterfaceBlocks);
+ interfaceBlockMapInitialized = true;
+ }
+ else if (!ValidateGraphicsInterfaceBlocksPerShader(*shaderInterfaceBlocks[shaderType],
+ shaderType, webglCompatibility,
+ &linkedInterfaceBlocks, infoLog))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void WriteShaderVar(BinaryOutputStream *stream, const sh::ShaderVariable &var)
+{
+ stream->writeInt(var.type);
+ stream->writeInt(var.precision);
+ stream->writeString(var.name);
+ stream->writeString(var.mappedName);
+ stream->writeIntVector(var.arraySizes);
+ stream->writeInt(var.staticUse);
+ stream->writeInt(var.active);
+ stream->writeString(var.structName);
+ stream->writeInt(var.hasParentArrayIndex() ? var.parentArrayIndex() : -1);
+ ASSERT(var.fields.empty());
+}
+
+void LoadShaderVar(BinaryInputStream *stream, sh::ShaderVariable *var)
+{
+ var->type = stream->readInt<GLenum>();
+ var->precision = stream->readInt<GLenum>();
+ var->name = stream->readString();
+ var->mappedName = stream->readString();
+ stream->readIntVector<unsigned int>(&var->arraySizes);
+ var->staticUse = stream->readBool();
+ var->active = stream->readBool();
+ var->structName = stream->readString();
+ var->setParentArrayIndex(stream->readInt<int>());
+}
+
+void WriteShaderVariableBuffer(BinaryOutputStream *stream, const ShaderVariableBuffer &var)
+{
+ stream->writeInt(var.binding);
+ stream->writeInt(var.dataSize);
+
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ stream->writeInt(var.isActive(shaderType));
+ }
+
+ stream->writeInt(var.memberIndexes.size());
+ for (unsigned int memberCounterIndex : var.memberIndexes)
+ {
+ stream->writeInt(memberCounterIndex);
+ }
+}
+
+void LoadShaderVariableBuffer(BinaryInputStream *stream, ShaderVariableBuffer *var)
+{
+ var->binding = stream->readInt<int>();
+ var->dataSize = stream->readInt<unsigned int>();
+
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ var->setActive(shaderType, stream->readBool());
+ }
+
+ unsigned int numMembers = stream->readInt<unsigned int>();
+ for (unsigned int blockMemberIndex = 0; blockMemberIndex < numMembers; blockMemberIndex++)
+ {
+ var->memberIndexes.push_back(stream->readInt<unsigned int>());
+ }
+}
+
+void WriteBufferVariable(BinaryOutputStream *stream, const BufferVariable &var)
+{
+ WriteShaderVar(stream, var);
+
+ stream->writeInt(var.bufferIndex);
+ WriteBlockMemberInfo(stream, var.blockInfo);
+ stream->writeInt(var.topLevelArraySize);
+
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ stream->writeInt(var.isActive(shaderType));
+ }
+}
+
+void LoadBufferVariable(BinaryInputStream *stream, BufferVariable *var)
+{
+ LoadShaderVar(stream, var);
+
+ var->bufferIndex = stream->readInt<int>();
+ LoadBlockMemberInfo(stream, &var->blockInfo);
+ var->topLevelArraySize = stream->readInt<int>();
+
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ var->setActive(shaderType, stream->readBool());
+ }
+}
+
+void WriteInterfaceBlock(BinaryOutputStream *stream, const InterfaceBlock &block)
+{
+ stream->writeString(block.name);
+ stream->writeString(block.mappedName);
+ stream->writeInt(block.isArray);
+ stream->writeInt(block.arrayElement);
+
+ WriteShaderVariableBuffer(stream, block);
+}
+
+void LoadInterfaceBlock(BinaryInputStream *stream, InterfaceBlock *block)
+{
+ block->name = stream->readString();
+ block->mappedName = stream->readString();
+ block->isArray = stream->readBool();
+ block->arrayElement = stream->readInt<unsigned int>();
+
+ LoadShaderVariableBuffer(stream, block);
+}
+
+size_t CountUniqueBlocks(const std::vector<InterfaceBlock> &blocks)
+{
+ size_t count = 0;
+ for (const InterfaceBlock &block : blocks)
+ {
+ if (!block.isArray || block.arrayElement == 0)
+ {
+ ++count;
+ }
+ }
+ return count;
+}
+} // anonymous namespace
+
+// Saves the linking context for later use in resolveLink().
+struct Program::LinkingState
+{
+ const Context *context;
+ std::unique_ptr<ProgramLinkedResources> resources;
+ egl::BlobCache::Key programHash;
+ std::unique_ptr<rx::LinkEvent> linkEvent;
+ bool linkingFromBinary;
+};
+
+const char *const g_fakepath = "C:\\fakepath";
+
+// InfoLog implementation.
+InfoLog::InfoLog() {}
+
+InfoLog::~InfoLog() {}
+
+size_t InfoLog::getLength() const
+{
+ if (!mLazyStream)
+ {
+ return 0;
+ }
+
+ const std::string &logString = mLazyStream->str();
+ return logString.empty() ? 0 : logString.length() + 1;
+}
+
+void InfoLog::getLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
+{
+ size_t index = 0;
+
+ if (bufSize > 0)
+ {
+ const std::string logString(str());
+
+ if (!logString.empty())
+ {
+ index = std::min(static_cast<size_t>(bufSize) - 1, logString.length());
+ memcpy(infoLog, logString.c_str(), index);
+ }
+
+ infoLog[index] = '\0';
+ }
+
+ if (length)
+ {
+ *length = static_cast<GLsizei>(index);
+ }
+}
+
+// append a santized message to the program info log.
+// The D3D compiler includes a fake file path in some of the warning or error
+// messages, so lets remove all occurrences of this fake file path from the log.
+void InfoLog::appendSanitized(const char *message)
+{
+ ensureInitialized();
+
+ std::string msg(message);
+
+ size_t found;
+ do
+ {
+ found = msg.find(g_fakepath);
+ if (found != std::string::npos)
+ {
+ msg.erase(found, strlen(g_fakepath));
+ }
+ } while (found != std::string::npos);
+
+ *mLazyStream << message << std::endl;
+}
+
+void InfoLog::reset()
+{
+ if (mLazyStream)
+ {
+ mLazyStream.reset(nullptr);
+ }
+}
+
+bool InfoLog::empty() const
+{
+ if (!mLazyStream)
+ {
+ return true;
+ }
+
+ return mLazyStream->rdbuf()->in_avail() == 0;
+}
+
+void LogLinkMismatch(InfoLog &infoLog,
+ const std::string &variableName,
+ const char *variableType,
+ LinkMismatchError linkError,
+ const std::string &mismatchedStructOrBlockFieldName,
+ ShaderType shaderType1,
+ ShaderType shaderType2)
+{
+ std::ostringstream stream;
+ stream << GetLinkMismatchErrorString(linkError) << "s of " << variableType << " '"
+ << variableName;
+
+ if (!mismatchedStructOrBlockFieldName.empty())
+ {
+ stream << "' member '" << variableName << "." << mismatchedStructOrBlockFieldName;
+ }
+
+ stream << "' differ between " << GetShaderTypeString(shaderType1) << " and "
+ << GetShaderTypeString(shaderType2) << " shaders.";
+
+ infoLog << stream.str();
+}
+
+bool IsActiveInterfaceBlock(const sh::InterfaceBlock &interfaceBlock)
+{
+ // Only 'packed' blocks are allowed to be considered inactive.
+ return interfaceBlock.active || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED;
+}
+
+void WriteBlockMemberInfo(BinaryOutputStream *stream, const sh::BlockMemberInfo &var)
+{
+ stream->writeInt(var.arrayStride);
+ stream->writeInt(var.isRowMajorMatrix);
+ stream->writeInt(var.matrixStride);
+ stream->writeInt(var.offset);
+ stream->writeInt(var.topLevelArrayStride);
+}
+
+void LoadBlockMemberInfo(BinaryInputStream *stream, sh::BlockMemberInfo *var)
+{
+ var->arrayStride = stream->readInt<int>();
+ var->isRowMajorMatrix = stream->readBool();
+ var->matrixStride = stream->readInt<int>();
+ var->offset = stream->readInt<int>();
+ var->topLevelArrayStride = stream->readInt<int>();
+}
+
+// VariableLocation implementation.
+VariableLocation::VariableLocation() : arrayIndex(0), index(kUnused), ignored(false) {}
+
+VariableLocation::VariableLocation(unsigned int arrayIndex, unsigned int index)
+ : arrayIndex(arrayIndex), index(index), ignored(false)
+{
+ ASSERT(arrayIndex != GL_INVALID_INDEX);
+}
+
+// SamplerBindings implementation.
+SamplerBinding::SamplerBinding(TextureType textureTypeIn,
+ SamplerFormat formatIn,
+ size_t elementCount,
+ bool unreferenced)
+ : textureType(textureTypeIn),
+ format(formatIn),
+ boundTextureUnits(elementCount, 0),
+ unreferenced(unreferenced)
+{}
+
+SamplerBinding::SamplerBinding(const SamplerBinding &other) = default;
+
+SamplerBinding::~SamplerBinding() = default;
+
+// ProgramBindings implementation.
+ProgramBindings::ProgramBindings() {}
+
+ProgramBindings::~ProgramBindings() {}
+
+void ProgramBindings::bindLocation(GLuint index, const std::string &name)
+{
+ mBindings[name] = ProgramBinding(index);
+
+ // EXT_blend_func_extended spec: "If it specifies the base name of an array,
+ // it identifies the resources associated with the first element of the array."
+ //
+ // Normalize array bindings so that "name" and "name[0]" map to the same entry.
+ // If this binding is of the form "name[0]", then mark the "name" binding as
+ // aliased but do not update it yet in case "name" is not actually an array.
+ size_t nameLengthWithoutArrayIndex;
+ unsigned int arrayIndex = ParseArrayIndex(name, &nameLengthWithoutArrayIndex);
+ if (arrayIndex == 0)
+ {
+ std::string baseName = name.substr(0u, nameLengthWithoutArrayIndex);
+ auto iter = mBindings.find(baseName);
+ if (iter != mBindings.end())
+ {
+ iter->second.aliased = true;
+ }
+ }
+}
+
+int ProgramBindings::getBindingByName(const std::string &name) const
+{
+ auto iter = mBindings.find(name);
+ return (iter != mBindings.end()) ? iter->second.location : -1;
+}
+
+int ProgramBindings::getBinding(const sh::VariableWithLocation &variable) const
+{
+ const std::string &name = variable.name;
+
+ // Check with the normalized array name if applicable.
+ if (variable.isArray())
+ {
+ size_t nameLengthWithoutArrayIndex;
+ unsigned int arrayIndex = ParseArrayIndex(name, &nameLengthWithoutArrayIndex);
+ if (arrayIndex == 0)
+ {
+ std::string baseName = name.substr(0u, nameLengthWithoutArrayIndex);
+ auto iter = mBindings.find(baseName);
+ // If "name" exists and is not aliased, that means it was modified more
+ // recently than its "name[0]" form and should be used instead of that.
+ if (iter != mBindings.end() && !iter->second.aliased)
+ {
+ return iter->second.location;
+ }
+ }
+ }
+
+ return getBindingByName(name);
+}
+
+ProgramBindings::const_iterator ProgramBindings::begin() const
+{
+ return mBindings.begin();
+}
+
+ProgramBindings::const_iterator ProgramBindings::end() const
+{
+ return mBindings.end();
+}
+
+// ImageBinding implementation.
+ImageBinding::ImageBinding(size_t count) : boundImageUnits(count, 0), unreferenced(false) {}
+ImageBinding::ImageBinding(GLuint imageUnit, size_t count, bool unreferenced)
+ : unreferenced(unreferenced)
+{
+ for (size_t index = 0; index < count; ++index)
+ {
+ boundImageUnits.push_back(imageUnit + static_cast<GLuint>(index));
+ }
+}
+
+ImageBinding::ImageBinding(const ImageBinding &other) = default;
+
+ImageBinding::~ImageBinding() = default;
+
+// ProgramState implementation.
+ProgramState::ProgramState()
+ : mLabel(),
+ mAttachedShaders{},
+ mTransformFeedbackBufferMode(GL_INTERLEAVED_ATTRIBS),
+ mMaxActiveAttribLocation(0),
+ mSamplerUniformRange(0, 0),
+ mImageUniformRange(0, 0),
+ mAtomicCounterUniformRange(0, 0),
+ mBinaryRetrieveableHint(false),
+ mNumViews(-1),
+ // [GL_EXT_geometry_shader] Table 20.22
+ mGeometryShaderInputPrimitiveType(PrimitiveMode::Triangles),
+ mGeometryShaderOutputPrimitiveType(PrimitiveMode::TriangleStrip),
+ mGeometryShaderInvocations(1),
+ mGeometryShaderMaxVertices(0),
+ mDrawIDLocation(-1),
+ mActiveSamplerRefCounts{}
+{
+ mComputeShaderLocalSize.fill(1);
+ mActiveSamplerTypes.fill(TextureType::InvalidEnum);
+}
+
+ProgramState::~ProgramState()
+{
+ ASSERT(!hasAttachedShader());
+}
+
+const std::string &ProgramState::getLabel()
+{
+ return mLabel;
+}
+
+Shader *ProgramState::getAttachedShader(ShaderType shaderType) const
+{
+ ASSERT(shaderType != ShaderType::InvalidEnum);
+ return mAttachedShaders[shaderType];
+}
+
+size_t ProgramState::getUniqueUniformBlockCount() const
+{
+ return CountUniqueBlocks(mUniformBlocks);
+}
+
+size_t ProgramState::getUniqueStorageBlockCount() const
+{
+ return CountUniqueBlocks(mShaderStorageBlocks);
+}
+
+GLuint ProgramState::getUniformIndexFromName(const std::string &name) const
+{
+ return GetResourceIndexFromName(mUniforms, name);
+}
+
+GLuint ProgramState::getBufferVariableIndexFromName(const std::string &name) const
+{
+ return GetResourceIndexFromName(mBufferVariables, name);
+}
+
+GLuint ProgramState::getUniformIndexFromLocation(GLint location) const
+{
+ ASSERT(location >= 0 && static_cast<size_t>(location) < mUniformLocations.size());
+ return mUniformLocations[location].index;
+}
+
+Optional<GLuint> ProgramState::getSamplerIndex(GLint location) const
+{
+ GLuint index = getUniformIndexFromLocation(location);
+ if (!isSamplerUniformIndex(index))
+ {
+ return Optional<GLuint>::Invalid();
+ }
+
+ return getSamplerIndexFromUniformIndex(index);
+}
+
+bool ProgramState::isSamplerUniformIndex(GLuint index) const
+{
+ return mSamplerUniformRange.contains(index);
+}
+
+GLuint ProgramState::getSamplerIndexFromUniformIndex(GLuint uniformIndex) const
+{
+ ASSERT(isSamplerUniformIndex(uniformIndex));
+ return uniformIndex - mSamplerUniformRange.low();
+}
+
+GLuint ProgramState::getUniformIndexFromSamplerIndex(GLuint samplerIndex) const
+{
+ ASSERT(samplerIndex < mSamplerUniformRange.length());
+ return samplerIndex + mSamplerUniformRange.low();
+}
+
+bool ProgramState::isImageUniformIndex(GLuint index) const
+{
+ return mImageUniformRange.contains(index);
+}
+
+GLuint ProgramState::getImageIndexFromUniformIndex(GLuint uniformIndex) const
+{
+ ASSERT(isImageUniformIndex(uniformIndex));
+ return uniformIndex - mImageUniformRange.low();
+}
+
+GLuint ProgramState::getUniformIndexFromImageIndex(GLuint imageIndex) const
+{
+ ASSERT(imageIndex < mImageUniformRange.length());
+ return imageIndex + mImageUniformRange.low();
+}
+
+GLuint ProgramState::getAttributeLocation(const std::string &name) const
+{
+ for (const sh::Attribute &attribute : mAttributes)
+ {
+ if (attribute.name == name)
+ {
+ return attribute.location;
+ }
+ }
+
+ return static_cast<GLuint>(-1);
+}
+
+bool ProgramState::hasAttachedShader() const
+{
+ for (const Shader *shader : mAttachedShaders)
+ {
+ if (shader)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+Program::Program(rx::GLImplFactory *factory, ShaderProgramManager *manager, GLuint handle)
+ : mProgram(factory->createProgram(mState)),
+ mValidated(false),
+ mLinked(false),
+ mLinkResolved(true),
+ mDeleteStatus(false),
+ mRefCount(0),
+ mResourceManager(manager),
+ mHandle(handle)
+{
+ ASSERT(mProgram);
+
+ unlink();
+}
+
+Program::~Program()
+{
+ ASSERT(!mProgram);
+}
+
+void Program::onDestroy(const Context *context)
+{
+ resolveLink(context);
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ if (mState.mAttachedShaders[shaderType])
+ {
+ mState.mAttachedShaders[shaderType]->release(context);
+ mState.mAttachedShaders[shaderType] = nullptr;
+ }
+ }
+
+ mProgram->destroy(context);
+
+ ASSERT(!mState.hasAttachedShader());
+ SafeDelete(mProgram);
+
+ delete this;
+}
+GLuint Program::id() const
+{
+ ASSERT(mLinkResolved);
+ return mHandle;
+}
+
+void Program::setLabel(const Context *context, const std::string &label)
+{
+ ASSERT(mLinkResolved);
+ mState.mLabel = label;
+}
+
+const std::string &Program::getLabel() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mLabel;
+}
+
+void Program::attachShader(Shader *shader)
+{
+ ASSERT(mLinkResolved);
+ ShaderType shaderType = shader->getType();
+ ASSERT(shaderType != ShaderType::InvalidEnum);
+
+ mState.mAttachedShaders[shaderType] = shader;
+ mState.mAttachedShaders[shaderType]->addRef();
+}
+
+void Program::detachShader(const Context *context, Shader *shader)
+{
+ ASSERT(mLinkResolved);
+ ShaderType shaderType = shader->getType();
+ ASSERT(shaderType != ShaderType::InvalidEnum);
+
+ ASSERT(mState.mAttachedShaders[shaderType] == shader);
+ shader->release(context);
+ mState.mAttachedShaders[shaderType] = nullptr;
+}
+
+int Program::getAttachedShadersCount() const
+{
+ ASSERT(mLinkResolved);
+ int numAttachedShaders = 0;
+ for (const Shader *shader : mState.mAttachedShaders)
+ {
+ if (shader)
+ {
+ ++numAttachedShaders;
+ }
+ }
+
+ return numAttachedShaders;
+}
+
+const Shader *Program::getAttachedShader(ShaderType shaderType) const
+{
+ ASSERT(mLinkResolved);
+ return mState.getAttachedShader(shaderType);
+}
+
+void Program::bindAttributeLocation(GLuint index, const char *name)
+{
+ ASSERT(mLinkResolved);
+ mAttributeBindings.bindLocation(index, name);
+}
+
+void Program::bindUniformLocation(GLuint index, const char *name)
+{
+ ASSERT(mLinkResolved);
+ mUniformLocationBindings.bindLocation(index, name);
+}
+
+void Program::bindFragmentInputLocation(GLint index, const char *name)
+{
+ ASSERT(mLinkResolved);
+ mFragmentInputBindings.bindLocation(index, name);
+}
+
+void Program::bindFragmentOutputLocation(GLuint index, const char *name)
+{
+ mFragmentOutputLocations.bindLocation(index, name);
+}
+
+void Program::bindFragmentOutputIndex(GLuint index, const char *name)
+{
+ mFragmentOutputIndexes.bindLocation(index, name);
+}
+
+BindingInfo Program::getFragmentInputBindingInfo(GLint index) const
+{
+ ASSERT(mLinkResolved);
+ BindingInfo ret;
+ ret.type = GL_NONE;
+ ret.valid = false;
+
+ Shader *fragmentShader = mState.getAttachedShader(ShaderType::Fragment);
+ ASSERT(fragmentShader);
+
+ // Find the actual fragment shader varying we're interested in
+ const std::vector<sh::Varying> &inputs = fragmentShader->getInputVaryings();
+
+ for (const auto &binding : mFragmentInputBindings)
+ {
+ if (binding.second.location != static_cast<GLuint>(index))
+ continue;
+
+ ret.valid = true;
+
+ size_t nameLengthWithoutArrayIndex;
+ unsigned int arrayIndex = ParseArrayIndex(binding.first, &nameLengthWithoutArrayIndex);
+
+ for (const auto &in : inputs)
+ {
+ if (in.name.length() == nameLengthWithoutArrayIndex &&
+ angle::BeginsWith(in.name, binding.first, nameLengthWithoutArrayIndex))
+ {
+ if (in.isArray())
+ {
+ // The client wants to bind either "name" or "name[0]".
+ // GL ES 3.1 spec refers to active array names with language such as:
+ // "if the string identifies the base name of an active array, where the
+ // string would exactly match the name of the variable if the suffix "[0]"
+ // were appended to the string".
+ if (arrayIndex == GL_INVALID_INDEX)
+ arrayIndex = 0;
+
+ ret.name = in.mappedName + "[" + ToString(arrayIndex) + "]";
+ }
+ else
+ {
+ ret.name = in.mappedName;
+ }
+ ret.type = in.type;
+ return ret;
+ }
+ }
+ }
+
+ return ret;
+}
+
+void Program::pathFragmentInputGen(GLint index,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ ASSERT(mLinkResolved);
+ // If the location is -1 then the command is silently ignored
+ if (index == -1)
+ return;
+
+ const auto &binding = getFragmentInputBindingInfo(index);
+
+ // If the input doesn't exist then then the command is silently ignored
+ // This could happen through optimization for example, the shader translator
+ // decides that a variable is not actually being used and optimizes it away.
+ if (binding.name.empty())
+ return;
+
+ mProgram->setPathFragmentInputGen(binding.name, genMode, components, coeffs);
+}
+
+// The attached shaders are checked for linking errors by matching up their variables.
+// Uniform, input and output variables get collected.
+// The code gets compiled into binaries.
+angle::Result Program::link(const Context *context)
+{
+ ASSERT(mLinkResolved);
+ const auto &data = context->getState();
+
+ auto *platform = ANGLEPlatformCurrent();
+ double startTime = platform->currentTime(platform);
+
+ unlink();
+ mInfoLog.reset();
+
+ // Validate we have properly attached shaders before checking the cache.
+ if (!linkValidateShaders(mInfoLog))
+ {
+ return angle::Result::Continue;
+ }
+
+ egl::BlobCache::Key programHash = {0};
+ MemoryProgramCache *cache = context->getMemoryProgramCache();
+
+ if (cache)
+ {
+ angle::Result cacheResult = cache->getProgram(context, this, &programHash);
+ ANGLE_TRY(cacheResult);
+
+ // Check explicitly for Continue, Incomplete means a cache miss
+ if (cacheResult == angle::Result::Continue)
+ {
+ // Succeeded in loading the binaries in the front-end, back end may still be loading
+ // asynchronously
+ double delta = platform->currentTime(platform) - startTime;
+ int us = static_cast<int>(delta * 1000000.0);
+ ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramCacheHitTimeUS", us);
+ return angle::Result::Continue;
+ }
+ }
+
+ // Cache load failed, fall through to normal linking.
+ unlink();
+
+ // Re-link shaders after the unlink call.
+ ASSERT(linkValidateShaders(mInfoLog));
+
+ std::unique_ptr<ProgramLinkedResources> resources;
+ if (mState.mAttachedShaders[ShaderType::Compute])
+ {
+ resources.reset(new ProgramLinkedResources(
+ 0, PackMode::ANGLE_RELAXED, &mState.mUniformBlocks, &mState.mUniforms,
+ &mState.mShaderStorageBlocks, &mState.mBufferVariables, &mState.mAtomicCounterBuffers));
+
+ GLuint combinedImageUniforms = 0u;
+ if (!linkUniforms(context->getCaps(), mInfoLog, mUniformLocationBindings,
+ &combinedImageUniforms, &resources->unusedUniforms))
+ {
+ return angle::Result::Continue;
+ }
+
+ GLuint combinedShaderStorageBlocks = 0u;
+ if (!linkInterfaceBlocks(context->getCaps(), context->getClientVersion(),
+ context->getExtensions().webglCompatibility, mInfoLog,
+ &combinedShaderStorageBlocks))
+ {
+ return angle::Result::Continue;
+ }
+
+ // [OpenGL ES 3.1] Chapter 8.22 Page 203:
+ // A link error will be generated if the sum of the number of active image uniforms used in
+ // all shaders, the number of active shader storage blocks, and the number of active
+ // fragment shader outputs exceeds the implementation-dependent value of
+ // MAX_COMBINED_SHADER_OUTPUT_RESOURCES.
+ if (combinedImageUniforms + combinedShaderStorageBlocks >
+ context->getCaps().maxCombinedShaderOutputResources)
+ {
+ mInfoLog
+ << "The sum of the number of active image uniforms, active shader storage blocks "
+ "and active fragment shader outputs exceeds "
+ "MAX_COMBINED_SHADER_OUTPUT_RESOURCES ("
+ << context->getCaps().maxCombinedShaderOutputResources << ")";
+ return angle::Result::Continue;
+ }
+
+ InitUniformBlockLinker(mState, &resources->uniformBlockLinker);
+ InitShaderStorageBlockLinker(mState, &resources->shaderStorageBlockLinker);
+ }
+ else
+ {
+ // Map the varyings to the register file
+ // In WebGL, we use a slightly different handling for packing variables.
+ gl::PackMode packMode = PackMode::ANGLE_RELAXED;
+ if (data.getLimitations().noFlexibleVaryingPacking)
+ {
+ // D3D9 pack mode is strictly more strict than WebGL, so takes priority.
+ packMode = PackMode::ANGLE_NON_CONFORMANT_D3D9;
+ }
+ else if (data.getExtensions().webglCompatibility)
+ {
+ packMode = PackMode::WEBGL_STRICT;
+ }
+
+ resources.reset(new ProgramLinkedResources(
+ data.getCaps().maxVaryingVectors, packMode, &mState.mUniformBlocks, &mState.mUniforms,
+ &mState.mShaderStorageBlocks, &mState.mBufferVariables, &mState.mAtomicCounterBuffers));
+
+ if (!linkAttributes(context, mInfoLog))
+ {
+ return angle::Result::Continue;
+ }
+
+ if (!linkVaryings(mInfoLog))
+ {
+ return angle::Result::Continue;
+ }
+
+ GLuint combinedImageUniforms = 0u;
+ if (!linkUniforms(context->getCaps(), mInfoLog, mUniformLocationBindings,
+ &combinedImageUniforms, &resources->unusedUniforms))
+ {
+ return angle::Result::Continue;
+ }
+
+ GLuint combinedShaderStorageBlocks = 0u;
+ if (!linkInterfaceBlocks(context->getCaps(), context->getClientVersion(),
+ context->getExtensions().webglCompatibility, mInfoLog,
+ &combinedShaderStorageBlocks))
+ {
+ return angle::Result::Continue;
+ }
+
+ if (!linkValidateGlobalNames(mInfoLog))
+ {
+ return angle::Result::Continue;
+ }
+
+ if (!linkOutputVariables(context->getCaps(), context->getExtensions(),
+ context->getClientVersion(), combinedImageUniforms,
+ combinedShaderStorageBlocks))
+ {
+ return angle::Result::Continue;
+ }
+
+ const auto &mergedVaryings = getMergedVaryings();
+
+ ASSERT(mState.mAttachedShaders[ShaderType::Vertex]);
+ mState.mNumViews = mState.mAttachedShaders[ShaderType::Vertex]->getNumViews();
+
+ InitUniformBlockLinker(mState, &resources->uniformBlockLinker);
+ InitShaderStorageBlockLinker(mState, &resources->shaderStorageBlockLinker);
+
+ if (!linkValidateTransformFeedback(context->getClientVersion(), mInfoLog, mergedVaryings,
+ context->getCaps()))
+ {
+ return angle::Result::Continue;
+ }
+
+ if (!resources->varyingPacking.collectAndPackUserVaryings(
+ mInfoLog, mergedVaryings, mState.getTransformFeedbackVaryingNames()))
+ {
+ return angle::Result::Continue;
+ }
+
+ gatherTransformFeedbackVaryings(mergedVaryings);
+ mState.updateTransformFeedbackStrides();
+ }
+
+ updateLinkedShaderStages();
+
+ mLinkingState.reset(new LinkingState());
+ mLinkingState->context = context;
+ mLinkingState->linkingFromBinary = false;
+ mLinkingState->programHash = programHash;
+ mLinkingState->linkEvent = mProgram->link(context, *resources, mInfoLog);
+ mLinkingState->resources = std::move(resources);
+ mLinkResolved = false;
+
+ return angle::Result::Continue;
+}
+
+bool Program::isLinking() const
+{
+ return (mLinkingState.get() && mLinkingState->linkEvent->isLinking());
+}
+
+void Program::resolveLinkImpl(const Context *context)
+{
+ ASSERT(mLinkingState.get());
+
+ angle::Result result = mLinkingState->linkEvent->wait(context);
+
+ mLinked = result == angle::Result::Continue;
+ mLinkResolved = true;
+ std::unique_ptr<LinkingState> linkingState = std::move(mLinkingState);
+ if (!mLinked)
+ {
+ return;
+ }
+
+ if (linkingState->linkingFromBinary)
+ {
+ // All internal Program state is already loaded from the binary.
+ return;
+ }
+
+ initInterfaceBlockBindings();
+
+ // According to GLES 3.0/3.1 spec for LinkProgram and UseProgram,
+ // Only successfully linked program can replace the executables.
+ ASSERT(mLinked);
+
+ // Mark implementation-specific unreferenced uniforms as ignored.
+ mProgram->markUnusedUniformLocations(&mState.mUniformLocations, &mState.mSamplerBindings,
+ &mState.mImageBindings);
+
+ // Must be called after markUnusedUniformLocations.
+ postResolveLink(context);
+
+ // TODO(syoussefi): this might need to be moved to postResolveLink() so it will be called from
+ // deserialize() as well. http://anglebug.com/3089
+ setUniformValuesFromBindingQualifiers();
+
+ // Save to the program cache.
+ auto *cache = linkingState->context->getMemoryProgramCache();
+ if (cache && (mState.mLinkedTransformFeedbackVaryings.empty() ||
+ !linkingState->context->getFrontendFeatures()
+ .disableProgramCachingForTransformFeedback.enabled))
+ {
+ cache->putProgram(linkingState->programHash, linkingState->context, this);
+ }
+}
+
+void Program::updateLinkedShaderStages()
+{
+ mState.mLinkedShaderStages.reset();
+
+ for (const Shader *shader : mState.mAttachedShaders)
+ {
+ if (shader)
+ {
+ mState.mLinkedShaderStages.set(shader->getType());
+ }
+ }
+}
+
+void ProgramState::updateTransformFeedbackStrides()
+{
+ if (mTransformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS)
+ {
+ mTransformFeedbackStrides.resize(1);
+ size_t totalSize = 0;
+ for (const TransformFeedbackVarying &varying : mLinkedTransformFeedbackVaryings)
+ {
+ totalSize += varying.size() * VariableExternalSize(varying.type);
+ }
+ mTransformFeedbackStrides[0] = static_cast<GLsizei>(totalSize);
+ }
+ else
+ {
+ mTransformFeedbackStrides.resize(mLinkedTransformFeedbackVaryings.size());
+ for (size_t i = 0; i < mLinkedTransformFeedbackVaryings.size(); i++)
+ {
+ TransformFeedbackVarying &varying = mLinkedTransformFeedbackVaryings[i];
+ mTransformFeedbackStrides[i] =
+ static_cast<GLsizei>(varying.size() * VariableExternalSize(varying.type));
+ }
+ }
+}
+
+void ProgramState::updateActiveSamplers()
+{
+ mActiveSamplerRefCounts.fill(0);
+
+ for (SamplerBinding &samplerBinding : mSamplerBindings)
+ {
+ if (samplerBinding.unreferenced)
+ continue;
+
+ for (GLint textureUnit : samplerBinding.boundTextureUnits)
+ {
+ if (++mActiveSamplerRefCounts[textureUnit] == 1)
+ {
+ mActiveSamplerTypes[textureUnit] = samplerBinding.textureType;
+ mActiveSamplerFormats[textureUnit] = samplerBinding.format;
+ }
+ else
+ {
+ if (mActiveSamplerTypes[textureUnit] != samplerBinding.textureType)
+ {
+ mActiveSamplerTypes[textureUnit] = TextureType::InvalidEnum;
+ }
+ if (mActiveSamplerFormats[textureUnit] != samplerBinding.format)
+ {
+ mActiveSamplerFormats[textureUnit] = SamplerFormat::InvalidEnum;
+ }
+ }
+ mActiveSamplersMask.set(textureUnit);
+ }
+ }
+}
+
+void ProgramState::updateActiveImages()
+{
+ for (ImageBinding &imageBinding : mImageBindings)
+ {
+ if (imageBinding.unreferenced)
+ continue;
+
+ for (GLint imageUnit : imageBinding.boundImageUnits)
+ {
+ mActiveImagesMask.set(imageUnit);
+ }
+ }
+}
+
+// Returns the program object to an unlinked state, before re-linking, or at destruction
+void Program::unlink()
+{
+ mState.mAttributes.clear();
+ mState.mAttributesTypeMask.reset();
+ mState.mAttributesMask.reset();
+ mState.mActiveAttribLocationsMask.reset();
+ mState.mMaxActiveAttribLocation = 0;
+ mState.mLinkedTransformFeedbackVaryings.clear();
+ mState.mUniforms.clear();
+ mState.mUniformLocations.clear();
+ mState.mUniformBlocks.clear();
+ mState.mActiveUniformBlockBindings.reset();
+ mState.mAtomicCounterBuffers.clear();
+ mState.mOutputVariables.clear();
+ mState.mOutputLocations.clear();
+ mState.mSecondaryOutputLocations.clear();
+ mState.mOutputVariableTypes.clear();
+ mState.mDrawBufferTypeMask.reset();
+ mState.mActiveOutputVariables.reset();
+ mState.mComputeShaderLocalSize.fill(1);
+ mState.mSamplerBindings.clear();
+ mState.mImageBindings.clear();
+ mState.mActiveImagesMask.reset();
+ mState.mNumViews = -1;
+ mState.mGeometryShaderInputPrimitiveType = PrimitiveMode::Triangles;
+ mState.mGeometryShaderOutputPrimitiveType = PrimitiveMode::TriangleStrip;
+ mState.mGeometryShaderInvocations = 1;
+ mState.mGeometryShaderMaxVertices = 0;
+ mState.mDrawIDLocation = -1;
+
+ mValidated = false;
+
+ mLinked = false;
+ mInfoLog.reset();
+}
+
+angle::Result Program::loadBinary(const Context *context,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length)
+{
+ ASSERT(mLinkResolved);
+ unlink();
+
+#if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED
+ return angle::Result::Continue;
+#else
+ ASSERT(binaryFormat == GL_PROGRAM_BINARY_ANGLE);
+ if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
+ {
+ mInfoLog << "Invalid program binary format.";
+ return angle::Result::Continue;
+ }
+
+ BinaryInputStream stream(binary, length);
+ ANGLE_TRY(deserialize(context, stream, mInfoLog));
+
+ // Currently we require the full shader text to compute the program hash.
+ // We could also store the binary in the internal program cache.
+
+ for (size_t uniformBlockIndex = 0; uniformBlockIndex < mState.mUniformBlocks.size();
+ ++uniformBlockIndex)
+ {
+ mDirtyBits.set(uniformBlockIndex);
+ }
+
+ mLinkingState.reset(new LinkingState());
+ mLinkingState->context = context;
+ mLinkingState->linkingFromBinary = true;
+ mLinkingState->linkEvent = mProgram->load(context, &stream, mInfoLog);
+ mLinkResolved = false;
+
+ return angle::Result::Continue;
+#endif // #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED
+}
+
+angle::Result Program::saveBinary(Context *context,
+ GLenum *binaryFormat,
+ void *binary,
+ GLsizei bufSize,
+ GLsizei *length) const
+{
+ ASSERT(mLinkResolved);
+ if (binaryFormat)
+ {
+ *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
+ }
+
+ angle::MemoryBuffer memoryBuf;
+ serialize(context, &memoryBuf);
+
+ GLsizei streamLength = static_cast<GLsizei>(memoryBuf.size());
+ const uint8_t *streamState = memoryBuf.data();
+
+ if (streamLength > bufSize)
+ {
+ if (length)
+ {
+ *length = 0;
+ }
+
+ // TODO: This should be moved to the validation layer but computing the size of the binary
+ // before saving it causes the save to happen twice. It may be possible to write the binary
+ // to a separate buffer, validate sizes and then copy it.
+ ANGLE_CHECK(context, false, "Insufficient buffer size", GL_INVALID_OPERATION);
+ }
+
+ if (binary)
+ {
+ char *ptr = reinterpret_cast<char *>(binary);
+
+ memcpy(ptr, streamState, streamLength);
+ ptr += streamLength;
+
+ ASSERT(ptr - streamLength == binary);
+ }
+
+ if (length)
+ {
+ *length = streamLength;
+ }
+
+ return angle::Result::Continue;
+}
+
+GLint Program::getBinaryLength(Context *context) const
+{
+ ASSERT(mLinkResolved);
+ if (!mLinked)
+ {
+ return 0;
+ }
+
+ GLint length;
+ angle::Result result =
+ saveBinary(context, nullptr, nullptr, std::numeric_limits<GLint>::max(), &length);
+ if (result != angle::Result::Continue)
+ {
+ return 0;
+ }
+
+ return length;
+}
+
+void Program::setBinaryRetrievableHint(bool retrievable)
+{
+ ASSERT(mLinkResolved);
+ // TODO(jmadill) : replace with dirty bits
+ mProgram->setBinaryRetrievableHint(retrievable);
+ mState.mBinaryRetrieveableHint = retrievable;
+}
+
+bool Program::getBinaryRetrievableHint() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mBinaryRetrieveableHint;
+}
+
+void Program::setSeparable(bool separable)
+{
+ ASSERT(mLinkResolved);
+ // TODO(yunchao) : replace with dirty bits
+ if (mState.mSeparable != separable)
+ {
+ mProgram->setSeparable(separable);
+ mState.mSeparable = separable;
+ }
+}
+
+bool Program::isSeparable() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mSeparable;
+}
+
+void Program::deleteSelf(const Context *context)
+{
+ ASSERT(mRefCount == 0 && mDeleteStatus);
+ mResourceManager->deleteProgram(context, mHandle);
+}
+
+unsigned int Program::getRefCount() const
+{
+ return mRefCount;
+}
+
+int Program::getInfoLogLength() const
+{
+ ASSERT(mLinkResolved);
+ return static_cast<int>(mInfoLog.getLength());
+}
+
+void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
+{
+ ASSERT(mLinkResolved);
+ return mInfoLog.getLog(bufSize, length, infoLog);
+}
+
+void Program::getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders) const
+{
+ ASSERT(mLinkResolved);
+ int total = 0;
+
+ for (const Shader *shader : mState.mAttachedShaders)
+ {
+ if (shader && (total < maxCount))
+ {
+ shaders[total] = shader->getHandle();
+ ++total;
+ }
+ }
+
+ if (count)
+ {
+ *count = total;
+ }
+}
+
+GLuint Program::getAttributeLocation(const std::string &name) const
+{
+ ASSERT(mLinkResolved);
+ return mState.getAttributeLocation(name);
+}
+
+bool Program::isAttribLocationActive(size_t attribLocation) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(attribLocation < mState.mActiveAttribLocationsMask.size());
+ return mState.mActiveAttribLocationsMask[attribLocation];
+}
+
+void Program::getActiveAttribute(GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ if (!mLinked)
+ {
+ if (bufsize > 0)
+ {
+ name[0] = '\0';
+ }
+
+ if (length)
+ {
+ *length = 0;
+ }
+
+ *type = GL_NONE;
+ *size = 1;
+ return;
+ }
+
+ ASSERT(index < mState.mAttributes.size());
+ const sh::Attribute &attrib = mState.mAttributes[index];
+
+ if (bufsize > 0)
+ {
+ CopyStringToBuffer(name, attrib.name, bufsize, length);
+ }
+
+ // Always a single 'type' instance
+ *size = 1;
+ *type = attrib.type;
+}
+
+GLint Program::getActiveAttributeCount() const
+{
+ ASSERT(mLinkResolved);
+ if (!mLinked)
+ {
+ return 0;
+ }
+
+ return static_cast<GLint>(mState.mAttributes.size());
+}
+
+GLint Program::getActiveAttributeMaxLength() const
+{
+ ASSERT(mLinkResolved);
+ if (!mLinked)
+ {
+ return 0;
+ }
+
+ size_t maxLength = 0;
+
+ for (const sh::Attribute &attrib : mState.mAttributes)
+ {
+ maxLength = std::max(attrib.name.length() + 1, maxLength);
+ }
+
+ return static_cast<GLint>(maxLength);
+}
+
+const std::vector<sh::Attribute> &Program::getAttributes() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mAttributes;
+}
+
+const std::vector<SamplerBinding> &Program::getSamplerBindings() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mSamplerBindings;
+}
+
+const sh::WorkGroupSize &Program::getComputeShaderLocalSize() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mComputeShaderLocalSize;
+}
+
+PrimitiveMode Program::getGeometryShaderInputPrimitiveType() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mGeometryShaderInputPrimitiveType;
+}
+PrimitiveMode Program::getGeometryShaderOutputPrimitiveType() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mGeometryShaderOutputPrimitiveType;
+}
+GLint Program::getGeometryShaderInvocations() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mGeometryShaderInvocations;
+}
+GLint Program::getGeometryShaderMaxVertices() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mGeometryShaderMaxVertices;
+}
+
+GLuint Program::getInputResourceIndex(const GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ return GetResourceIndexFromName(mState.mAttributes, std::string(name));
+}
+
+GLuint Program::getOutputResourceIndex(const GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ return GetResourceIndexFromName(mState.mOutputVariables, std::string(name));
+}
+
+size_t Program::getOutputResourceCount() const
+{
+ ASSERT(mLinkResolved);
+ return (mLinked ? mState.mOutputVariables.size() : 0);
+}
+
+const std::vector<GLenum> &Program::getOutputVariableTypes() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mOutputVariableTypes;
+}
+
+template <typename T>
+void Program::getResourceName(GLuint index,
+ const std::vector<T> &resources,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name) const
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (!mLinked)
+ {
+ if (bufSize > 0)
+ {
+ name[0] = '\0';
+ }
+ return;
+ }
+ ASSERT(index < resources.size());
+ const auto &resource = resources[index];
+
+ if (bufSize > 0)
+ {
+ CopyStringToBuffer(name, resource.name, bufSize, length);
+ }
+}
+
+void Program::getInputResourceName(GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ getResourceName(index, mState.mAttributes, bufSize, length, name);
+}
+
+void Program::getOutputResourceName(GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ getResourceName(index, mState.mOutputVariables, bufSize, length, name);
+}
+
+void Program::getUniformResourceName(GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ getResourceName(index, mState.mUniforms, bufSize, length, name);
+}
+
+void Program::getBufferVariableResourceName(GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ getResourceName(index, mState.mBufferVariables, bufSize, length, name);
+}
+
+const sh::Attribute &Program::getInputResource(GLuint index) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(index < mState.mAttributes.size());
+ return mState.mAttributes[index];
+}
+
+const sh::OutputVariable &Program::getOutputResource(GLuint index) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(index < mState.mOutputVariables.size());
+ return mState.mOutputVariables[index];
+}
+
+const ProgramBindings &Program::getAttributeBindings() const
+{
+ ASSERT(mLinkResolved);
+ return mAttributeBindings;
+}
+const ProgramBindings &Program::getUniformLocationBindings() const
+{
+ ASSERT(mLinkResolved);
+ return mUniformLocationBindings;
+}
+const ProgramBindings &Program::getFragmentInputBindings() const
+{
+ ASSERT(mLinkResolved);
+ return mFragmentInputBindings;
+}
+
+ComponentTypeMask Program::getDrawBufferTypeMask() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mDrawBufferTypeMask;
+}
+ComponentTypeMask Program::getAttributesTypeMask() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mAttributesTypeMask;
+}
+AttributesMask Program::getAttributesMask() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mAttributesMask;
+}
+
+const std::vector<GLsizei> &Program::getTransformFeedbackStrides() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mTransformFeedbackStrides;
+}
+
+GLint Program::getFragDataLocation(const std::string &name) const
+{
+ ASSERT(mLinkResolved);
+ GLint primaryLocation =
+ GetVariableLocation(mState.mOutputVariables, mState.mOutputLocations, name);
+ if (primaryLocation != -1)
+ {
+ return primaryLocation;
+ }
+ return GetVariableLocation(mState.mOutputVariables, mState.mSecondaryOutputLocations, name);
+}
+
+GLint Program::getFragDataIndex(const std::string &name) const
+{
+ ASSERT(mLinkResolved);
+ if (GetVariableLocation(mState.mOutputVariables, mState.mOutputLocations, name) != -1)
+ {
+ return 0;
+ }
+ if (GetVariableLocation(mState.mOutputVariables, mState.mSecondaryOutputLocations, name) != -1)
+ {
+ return 1;
+ }
+ return -1;
+}
+
+void Program::getActiveUniform(GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ if (mLinked)
+ {
+ // index must be smaller than getActiveUniformCount()
+ ASSERT(index < mState.mUniforms.size());
+ const LinkedUniform &uniform = mState.mUniforms[index];
+
+ if (bufsize > 0)
+ {
+ std::string string = uniform.name;
+ CopyStringToBuffer(name, string, bufsize, length);
+ }
+
+ *size = clampCast<GLint>(uniform.getBasicTypeElementCount());
+ *type = uniform.type;
+ }
+ else
+ {
+ if (bufsize > 0)
+ {
+ name[0] = '\0';
+ }
+
+ if (length)
+ {
+ *length = 0;
+ }
+
+ *size = 0;
+ *type = GL_NONE;
+ }
+}
+
+GLint Program::getActiveUniformCount() const
+{
+ ASSERT(mLinkResolved);
+ if (mLinked)
+ {
+ return static_cast<GLint>(mState.mUniforms.size());
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+size_t Program::getActiveBufferVariableCount() const
+{
+ ASSERT(mLinkResolved);
+ return mLinked ? mState.mBufferVariables.size() : 0;
+}
+
+GLint Program::getActiveUniformMaxLength() const
+{
+ ASSERT(mLinkResolved);
+ size_t maxLength = 0;
+
+ if (mLinked)
+ {
+ for (const LinkedUniform &uniform : mState.mUniforms)
+ {
+ if (!uniform.name.empty())
+ {
+ size_t length = uniform.name.length() + 1u;
+ if (uniform.isArray())
+ {
+ length += 3; // Counting in "[0]".
+ }
+ maxLength = std::max(length, maxLength);
+ }
+ }
+ }
+
+ return static_cast<GLint>(maxLength);
+}
+
+bool Program::isValidUniformLocation(GLint location) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(angle::IsValueInRangeForNumericType<GLint>(mState.mUniformLocations.size()));
+ return (location >= 0 && static_cast<size_t>(location) < mState.mUniformLocations.size() &&
+ mState.mUniformLocations[static_cast<size_t>(location)].used());
+}
+
+const LinkedUniform &Program::getUniformByLocation(GLint location) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(location >= 0 && static_cast<size_t>(location) < mState.mUniformLocations.size());
+ return mState.mUniforms[mState.getUniformIndexFromLocation(location)];
+}
+
+const VariableLocation &Program::getUniformLocation(GLint location) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(location >= 0 && static_cast<size_t>(location) < mState.mUniformLocations.size());
+ return mState.mUniformLocations[location];
+}
+
+const BufferVariable &Program::getBufferVariableByIndex(GLuint index) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(index < static_cast<size_t>(mState.mBufferVariables.size()));
+ return mState.mBufferVariables[index];
+}
+
+GLint Program::getUniformLocation(const std::string &name) const
+{
+ ASSERT(mLinkResolved);
+ return GetVariableLocation(mState.mUniforms, mState.mUniformLocations, name);
+}
+
+GLuint Program::getUniformIndex(const std::string &name) const
+{
+ ASSERT(mLinkResolved);
+ return mState.getUniformIndexFromName(name);
+}
+
+void Program::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 1, v);
+ mProgram->setUniform1fv(location, clampedCount, v);
+}
+
+void Program::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 2, v);
+ mProgram->setUniform2fv(location, clampedCount, v);
+}
+
+void Program::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 3, v);
+ mProgram->setUniform3fv(location, clampedCount, v);
+}
+
+void Program::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 4, v);
+ mProgram->setUniform4fv(location, clampedCount, v);
+}
+
+void Program::setUniform1iv(Context *context, GLint location, GLsizei count, const GLint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 1, v);
+
+ mProgram->setUniform1iv(location, clampedCount, v);
+
+ if (mState.isSamplerUniformIndex(locationInfo.index))
+ {
+ updateSamplerUniform(context, locationInfo, clampedCount, v);
+ }
+}
+
+void Program::setUniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 2, v);
+ mProgram->setUniform2iv(location, clampedCount, v);
+}
+
+void Program::setUniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 3, v);
+ mProgram->setUniform3iv(location, clampedCount, v);
+}
+
+void Program::setUniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 4, v);
+ mProgram->setUniform4iv(location, clampedCount, v);
+}
+
+void Program::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 1, v);
+ mProgram->setUniform1uiv(location, clampedCount, v);
+}
+
+void Program::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 2, v);
+ mProgram->setUniform2uiv(location, clampedCount, v);
+}
+
+void Program::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 3, v);
+ mProgram->setUniform3uiv(location, clampedCount, v);
+}
+
+void Program::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+ GLsizei clampedCount = clampUniformCount(locationInfo, count, 4, v);
+ mProgram->setUniform4uiv(location, clampedCount, v);
+}
+
+void Program::setUniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<2, 2>(location, count, transpose, v);
+ mProgram->setUniformMatrix2fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<3, 3>(location, count, transpose, v);
+ mProgram->setUniformMatrix3fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<4, 4>(location, count, transpose, v);
+ mProgram->setUniformMatrix4fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<2, 3>(location, count, transpose, v);
+ mProgram->setUniformMatrix2x3fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<2, 4>(location, count, transpose, v);
+ mProgram->setUniformMatrix2x4fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<3, 2>(location, count, transpose, v);
+ mProgram->setUniformMatrix3x2fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<3, 4>(location, count, transpose, v);
+ mProgram->setUniformMatrix3x4fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<4, 2>(location, count, transpose, v);
+ mProgram->setUniformMatrix4x2fv(location, clampedCount, transpose, v);
+}
+
+void Program::setUniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *v)
+{
+ ASSERT(mLinkResolved);
+ GLsizei clampedCount = clampMatrixUniformCount<4, 3>(location, count, transpose, v);
+ mProgram->setUniformMatrix4x3fv(location, clampedCount, transpose, v);
+}
+
+GLuint Program::getSamplerUniformBinding(const VariableLocation &uniformLocation) const
+{
+ ASSERT(mLinkResolved);
+ GLuint samplerIndex = mState.getSamplerIndexFromUniformIndex(uniformLocation.index);
+ const std::vector<GLuint> &boundTextureUnits =
+ mState.mSamplerBindings[samplerIndex].boundTextureUnits;
+ return boundTextureUnits[uniformLocation.arrayIndex];
+}
+
+void Program::getUniformfv(const Context *context, GLint location, GLfloat *v) const
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &uniformLocation = mState.getUniformLocations()[location];
+ const LinkedUniform &uniform = mState.getUniforms()[uniformLocation.index];
+
+ if (uniform.isSampler())
+ {
+ *v = static_cast<GLfloat>(getSamplerUniformBinding(uniformLocation));
+ return;
+ }
+
+ const GLenum nativeType = gl::VariableComponentType(uniform.type);
+ if (nativeType == GL_FLOAT)
+ {
+ mProgram->getUniformfv(context, location, v);
+ }
+ else
+ {
+ getUniformInternal(context, v, location, nativeType, VariableComponentCount(uniform.type));
+ }
+}
+
+void Program::getUniformiv(const Context *context, GLint location, GLint *v) const
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &uniformLocation = mState.getUniformLocations()[location];
+ const LinkedUniform &uniform = mState.getUniforms()[uniformLocation.index];
+
+ if (uniform.isSampler())
+ {
+ *v = static_cast<GLint>(getSamplerUniformBinding(uniformLocation));
+ return;
+ }
+
+ const GLenum nativeType = gl::VariableComponentType(uniform.type);
+ if (nativeType == GL_INT || nativeType == GL_BOOL)
+ {
+ mProgram->getUniformiv(context, location, v);
+ }
+ else
+ {
+ getUniformInternal(context, v, location, nativeType, VariableComponentCount(uniform.type));
+ }
+}
+
+void Program::getUniformuiv(const Context *context, GLint location, GLuint *v) const
+{
+ ASSERT(mLinkResolved);
+ const VariableLocation &uniformLocation = mState.getUniformLocations()[location];
+ const LinkedUniform &uniform = mState.getUniforms()[uniformLocation.index];
+
+ if (uniform.isSampler())
+ {
+ *v = getSamplerUniformBinding(uniformLocation);
+ return;
+ }
+
+ const GLenum nativeType = VariableComponentType(uniform.type);
+ if (nativeType == GL_UNSIGNED_INT)
+ {
+ mProgram->getUniformuiv(context, location, v);
+ }
+ else
+ {
+ getUniformInternal(context, v, location, nativeType, VariableComponentCount(uniform.type));
+ }
+}
+
+void Program::flagForDeletion()
+{
+ ASSERT(mLinkResolved);
+ mDeleteStatus = true;
+}
+
+bool Program::isFlaggedForDeletion() const
+{
+ ASSERT(mLinkResolved);
+ return mDeleteStatus;
+}
+
+void Program::validate(const Caps &caps)
+{
+ ASSERT(mLinkResolved);
+ mInfoLog.reset();
+
+ if (mLinked)
+ {
+ mValidated = ConvertToBool(mProgram->validate(caps, &mInfoLog));
+ }
+ else
+ {
+ mInfoLog << "Program has not been successfully linked.";
+ }
+}
+
+bool Program::validateSamplersImpl(InfoLog *infoLog, const Caps &caps)
+{
+ ASSERT(mLinkResolved);
+
+ // if any two active samplers in a program are of different types, but refer to the same
+ // texture image unit, and this is the current program, then ValidateProgram will fail, and
+ // DrawArrays and DrawElements will issue the INVALID_OPERATION error.
+ for (size_t textureUnit : mState.mActiveSamplersMask)
+ {
+ if (mState.mActiveSamplerTypes[textureUnit] == TextureType::InvalidEnum)
+ {
+ if (infoLog)
+ {
+ (*infoLog) << "Samplers of conflicting types refer to the same texture "
+ "image unit ("
+ << textureUnit << ").";
+ }
+
+ mCachedValidateSamplersResult = false;
+ return false;
+ }
+ }
+
+ mCachedValidateSamplersResult = true;
+ return true;
+}
+
+bool Program::isValidated() const
+{
+ ASSERT(mLinkResolved);
+ return mValidated;
+}
+
+void Program::getActiveUniformBlockName(const GLuint blockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *blockName) const
+{
+ ASSERT(mLinkResolved);
+ GetInterfaceBlockName(blockIndex, mState.mUniformBlocks, bufSize, length, blockName);
+}
+
+void Program::getActiveShaderStorageBlockName(const GLuint blockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *blockName) const
+{
+ ASSERT(mLinkResolved);
+ GetInterfaceBlockName(blockIndex, mState.mShaderStorageBlocks, bufSize, length, blockName);
+}
+
+template <typename T>
+GLint Program::getActiveInterfaceBlockMaxNameLength(const std::vector<T> &resources) const
+{
+ int maxLength = 0;
+
+ if (mLinked)
+ {
+ for (const T &resource : resources)
+ {
+ if (!resource.name.empty())
+ {
+ int length = static_cast<int>(resource.nameWithArrayIndex().length());
+ maxLength = std::max(length + 1, maxLength);
+ }
+ }
+ }
+
+ return maxLength;
+}
+
+GLint Program::getActiveUniformBlockMaxNameLength() const
+{
+ ASSERT(mLinkResolved);
+ return getActiveInterfaceBlockMaxNameLength(mState.mUniformBlocks);
+}
+
+GLint Program::getActiveShaderStorageBlockMaxNameLength() const
+{
+ ASSERT(mLinkResolved);
+ return getActiveInterfaceBlockMaxNameLength(mState.mShaderStorageBlocks);
+}
+
+GLuint Program::getUniformBlockIndex(const std::string &name) const
+{
+ ASSERT(mLinkResolved);
+ return GetInterfaceBlockIndex(mState.mUniformBlocks, name);
+}
+
+GLuint Program::getShaderStorageBlockIndex(const std::string &name) const
+{
+ ASSERT(mLinkResolved);
+ return GetInterfaceBlockIndex(mState.mShaderStorageBlocks, name);
+}
+
+const InterfaceBlock &Program::getUniformBlockByIndex(GLuint index) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(index < static_cast<GLuint>(mState.mUniformBlocks.size()));
+ return mState.mUniformBlocks[index];
+}
+
+const InterfaceBlock &Program::getShaderStorageBlockByIndex(GLuint index) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(index < static_cast<GLuint>(mState.mShaderStorageBlocks.size()));
+ return mState.mShaderStorageBlocks[index];
+}
+
+void Program::bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+ ASSERT(mLinkResolved);
+ mState.mUniformBlocks[uniformBlockIndex].binding = uniformBlockBinding;
+ mState.mActiveUniformBlockBindings.set(uniformBlockIndex, uniformBlockBinding != 0);
+ mDirtyBits.set(DIRTY_BIT_UNIFORM_BLOCK_BINDING_0 + uniformBlockIndex);
+}
+
+GLuint Program::getUniformBlockBinding(GLuint uniformBlockIndex) const
+{
+ ASSERT(mLinkResolved);
+ return mState.getUniformBlockBinding(uniformBlockIndex);
+}
+
+GLuint Program::getShaderStorageBlockBinding(GLuint shaderStorageBlockIndex) const
+{
+ ASSERT(mLinkResolved);
+ return mState.getShaderStorageBlockBinding(shaderStorageBlockIndex);
+}
+
+void Program::setTransformFeedbackVaryings(GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ ASSERT(mLinkResolved);
+ mState.mTransformFeedbackVaryingNames.resize(count);
+ for (GLsizei i = 0; i < count; i++)
+ {
+ mState.mTransformFeedbackVaryingNames[i] = varyings[i];
+ }
+
+ mState.mTransformFeedbackBufferMode = bufferMode;
+}
+
+void Program::getTransformFeedbackVarying(GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ if (mLinked)
+ {
+ ASSERT(index < mState.mLinkedTransformFeedbackVaryings.size());
+ const auto &var = mState.mLinkedTransformFeedbackVaryings[index];
+ std::string varName = var.nameWithArrayIndex();
+ GLsizei lastNameIdx = std::min(bufSize - 1, static_cast<GLsizei>(varName.length()));
+ if (length)
+ {
+ *length = lastNameIdx;
+ }
+ if (size)
+ {
+ *size = var.size();
+ }
+ if (type)
+ {
+ *type = var.type;
+ }
+ if (name)
+ {
+ memcpy(name, varName.c_str(), lastNameIdx);
+ name[lastNameIdx] = '\0';
+ }
+ }
+}
+
+GLsizei Program::getTransformFeedbackVaryingCount() const
+{
+ ASSERT(mLinkResolved);
+ if (mLinked)
+ {
+ return static_cast<GLsizei>(mState.mLinkedTransformFeedbackVaryings.size());
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLsizei Program::getTransformFeedbackVaryingMaxLength() const
+{
+ ASSERT(mLinkResolved);
+ if (mLinked)
+ {
+ GLsizei maxSize = 0;
+ for (const auto &var : mState.mLinkedTransformFeedbackVaryings)
+ {
+ maxSize =
+ std::max(maxSize, static_cast<GLsizei>(var.nameWithArrayIndex().length() + 1));
+ }
+
+ return maxSize;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+GLenum Program::getTransformFeedbackBufferMode() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mTransformFeedbackBufferMode;
+}
+
+bool Program::linkValidateShaders(InfoLog &infoLog)
+{
+ Shader *vertexShader = mState.mAttachedShaders[ShaderType::Vertex];
+ Shader *fragmentShader = mState.mAttachedShaders[ShaderType::Fragment];
+ Shader *computeShader = mState.mAttachedShaders[ShaderType::Compute];
+ Shader *geometryShader = mState.mAttachedShaders[ShaderType::Geometry];
+
+ bool isComputeShaderAttached = (computeShader != nullptr);
+ bool isGraphicsShaderAttached =
+ (vertexShader != nullptr || fragmentShader != nullptr || geometryShader != nullptr);
+ // Check whether we both have a compute and non-compute shaders attached.
+ // If there are of both types attached, then linking should fail.
+ // OpenGL ES 3.10, 7.3 Program Objects, under LinkProgram
+ if (isComputeShaderAttached == true && isGraphicsShaderAttached == true)
+ {
+ infoLog << "Both compute and graphics shaders are attached to the same program.";
+ return false;
+ }
+
+ if (computeShader)
+ {
+ if (!computeShader->isCompiled())
+ {
+ infoLog << "Attached compute shader is not compiled.";
+ return false;
+ }
+ ASSERT(computeShader->getType() == ShaderType::Compute);
+
+ mState.mComputeShaderLocalSize = computeShader->getWorkGroupSize();
+
+ // GLSL ES 3.10, 4.4.1.1 Compute Shader Inputs
+ // If the work group size is not specified, a link time error should occur.
+ if (!mState.mComputeShaderLocalSize.isDeclared())
+ {
+ infoLog << "Work group size is not specified.";
+ return false;
+ }
+ }
+ else
+ {
+ if (!fragmentShader || !fragmentShader->isCompiled())
+ {
+ infoLog << "No compiled fragment shader when at least one graphics shader is attached.";
+ return false;
+ }
+ ASSERT(fragmentShader->getType() == ShaderType::Fragment);
+
+ if (!vertexShader || !vertexShader->isCompiled())
+ {
+ infoLog << "No compiled vertex shader when at least one graphics shader is attached.";
+ return false;
+ }
+ ASSERT(vertexShader->getType() == ShaderType::Vertex);
+
+ int vertexShaderVersion = vertexShader->getShaderVersion();
+ if (fragmentShader->getShaderVersion() != vertexShaderVersion)
+ {
+ infoLog << "Fragment shader version does not match vertex shader version.";
+ return false;
+ }
+
+ if (geometryShader)
+ {
+ // [GL_EXT_geometry_shader] Chapter 7
+ // Linking can fail for a variety of reasons as specified in the OpenGL ES Shading
+ // Language Specification, as well as any of the following reasons:
+ // * One or more of the shader objects attached to <program> are not compiled
+ // successfully.
+ // * The shaders do not use the same shader language version.
+ // * <program> contains objects to form a geometry shader, and
+ // - <program> is not separable and contains no objects to form a vertex shader; or
+ // - the input primitive type, output primitive type, or maximum output vertex count
+ // is not specified in the compiled geometry shader object.
+ if (!geometryShader->isCompiled())
+ {
+ infoLog << "The attached geometry shader isn't compiled.";
+ return false;
+ }
+
+ if (geometryShader->getShaderVersion() != vertexShaderVersion)
+ {
+ mInfoLog << "Geometry shader version does not match vertex shader version.";
+ return false;
+ }
+ ASSERT(geometryShader->getType() == ShaderType::Geometry);
+
+ Optional<PrimitiveMode> inputPrimitive =
+ geometryShader->getGeometryShaderInputPrimitiveType();
+ if (!inputPrimitive.valid())
+ {
+ mInfoLog << "Input primitive type is not specified in the geometry shader.";
+ return false;
+ }
+
+ Optional<PrimitiveMode> outputPrimitive =
+ geometryShader->getGeometryShaderOutputPrimitiveType();
+ if (!outputPrimitive.valid())
+ {
+ mInfoLog << "Output primitive type is not specified in the geometry shader.";
+ return false;
+ }
+
+ Optional<GLint> maxVertices = geometryShader->getGeometryShaderMaxVertices();
+ if (!maxVertices.valid())
+ {
+ mInfoLog << "'max_vertices' is not specified in the geometry shader.";
+ return false;
+ }
+
+ mState.mGeometryShaderInputPrimitiveType = inputPrimitive.value();
+ mState.mGeometryShaderOutputPrimitiveType = outputPrimitive.value();
+ mState.mGeometryShaderMaxVertices = maxVertices.value();
+ mState.mGeometryShaderInvocations = geometryShader->getGeometryShaderInvocations();
+ }
+ }
+
+ return true;
+}
+
+GLuint Program::getTransformFeedbackVaryingResourceIndex(const GLchar *name) const
+{
+ ASSERT(mLinkResolved);
+ for (GLuint tfIndex = 0; tfIndex < mState.mLinkedTransformFeedbackVaryings.size(); ++tfIndex)
+ {
+ const auto &tf = mState.mLinkedTransformFeedbackVaryings[tfIndex];
+ if (tf.nameWithArrayIndex() == name)
+ {
+ return tfIndex;
+ }
+ }
+ return GL_INVALID_INDEX;
+}
+
+const TransformFeedbackVarying &Program::getTransformFeedbackVaryingResource(GLuint index) const
+{
+ ASSERT(mLinkResolved);
+ ASSERT(index < mState.mLinkedTransformFeedbackVaryings.size());
+ return mState.mLinkedTransformFeedbackVaryings[index];
+}
+
+bool Program::hasDrawIDUniform() const
+{
+ ASSERT(mLinkResolved);
+ return mState.mDrawIDLocation >= 0;
+}
+
+void Program::setDrawIDUniform(GLint drawid)
+{
+ ASSERT(mLinkResolved);
+ ASSERT(mState.mDrawIDLocation >= 0);
+ mProgram->setUniform1iv(mState.mDrawIDLocation, 1, &drawid);
+}
+
+bool Program::linkVaryings(InfoLog &infoLog) const
+{
+ Shader *previousShader = nullptr;
+ for (ShaderType shaderType : kAllGraphicsShaderTypes)
+ {
+ Shader *currentShader = mState.mAttachedShaders[shaderType];
+ if (!currentShader)
+ {
+ continue;
+ }
+
+ if (previousShader)
+ {
+ if (!linkValidateShaderInterfaceMatching(previousShader, currentShader, infoLog))
+ {
+ return false;
+ }
+ }
+ previousShader = currentShader;
+ }
+
+ if (!linkValidateBuiltInVaryings(infoLog))
+ {
+ return false;
+ }
+
+ if (!linkValidateFragmentInputBindings(infoLog))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+// [OpenGL ES 3.1] Chapter 7.4.1 "Shader Interface Matching" Page 91
+// TODO(jiawei.shao@intel.com): add validation on input/output blocks matching
+bool Program::linkValidateShaderInterfaceMatching(gl::Shader *generatingShader,
+ gl::Shader *consumingShader,
+ gl::InfoLog &infoLog) const
+{
+ ASSERT(generatingShader->getShaderVersion() == consumingShader->getShaderVersion());
+
+ const std::vector<sh::Varying> &outputVaryings = generatingShader->getOutputVaryings();
+ const std::vector<sh::Varying> &inputVaryings = consumingShader->getInputVaryings();
+
+ bool validateGeometryShaderInputs = consumingShader->getType() == ShaderType::Geometry;
+
+ for (const sh::Varying &input : inputVaryings)
+ {
+ bool matched = false;
+
+ // Built-in varyings obey special rules
+ if (input.isBuiltIn())
+ {
+ continue;
+ }
+
+ // An output variable is considered to match an input variable in the subsequent
+ // shader if:
+ // - the two variables match in name, type, and qualification; or
+ // - the two variables are declared with the same location qualifier and
+ // match in type and qualification.
+ for (const sh::Varying &output : outputVaryings)
+ {
+ bool namesMatch = input.name == output.name;
+ bool locationsMatch = (input.location != -1) && (input.location == output.location);
+
+ if (namesMatch || locationsMatch)
+ {
+ ASSERT(!output.isBuiltIn());
+
+ std::string mismatchedStructFieldName;
+ LinkMismatchError linkError =
+ LinkValidateVaryings(output, input, generatingShader->getShaderVersion(),
+ validateGeometryShaderInputs, &mismatchedStructFieldName);
+ if (linkError != LinkMismatchError::NO_MISMATCH)
+ {
+ LogLinkMismatch(infoLog, input.name, "varying", linkError,
+ mismatchedStructFieldName, generatingShader->getType(),
+ consumingShader->getType());
+ return false;
+ }
+
+ matched = true;
+ break;
+ }
+ }
+
+ // We permit unmatched, unreferenced varyings. Note that this specifically depends on
+ // whether the input is statically used - a statically used input should fail this test even
+ // if it is not active. GLSL ES 3.00.6 section 4.3.10.
+ if (!matched && input.staticUse)
+ {
+ infoLog << GetShaderTypeString(consumingShader->getType()) << " varying " << input.name
+ << " does not match any " << GetShaderTypeString(generatingShader->getType())
+ << " varying";
+ return false;
+ }
+ }
+
+ // TODO(jmadill): verify no unmatched output varyings?
+
+ return true;
+}
+
+bool Program::linkValidateFragmentInputBindings(gl::InfoLog &infoLog) const
+{
+ ASSERT(mState.mAttachedShaders[ShaderType::Fragment]);
+
+ std::map<GLuint, std::string> staticFragmentInputLocations;
+
+ const std::vector<sh::Varying> &fragmentInputVaryings =
+ mState.mAttachedShaders[ShaderType::Fragment]->getInputVaryings();
+ for (const sh::Varying &input : fragmentInputVaryings)
+ {
+ if (input.isBuiltIn() || !input.staticUse)
+ {
+ continue;
+ }
+
+ const auto inputBinding = mFragmentInputBindings.getBinding(input);
+ if (inputBinding == -1)
+ continue;
+
+ const auto it = staticFragmentInputLocations.find(inputBinding);
+ if (it == std::end(staticFragmentInputLocations))
+ {
+ staticFragmentInputLocations.insert(std::make_pair(inputBinding, input.name));
+ }
+ else
+ {
+ infoLog << "Binding for fragment input " << input.name << " conflicts with "
+ << it->second;
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Program::linkUniforms(const Caps &caps,
+ InfoLog &infoLog,
+ const ProgramBindings &uniformLocationBindings,
+ GLuint *combinedImageUniformsCount,
+ std::vector<UnusedUniform> *unusedUniforms)
+{
+ UniformLinker linker(mState);
+ if (!linker.link(caps, infoLog, uniformLocationBindings))
+ {
+ return false;
+ }
+
+ linker.getResults(&mState.mUniforms, unusedUniforms, &mState.mUniformLocations);
+
+ linkSamplerAndImageBindings(combinedImageUniformsCount);
+
+ if (!linkAtomicCounterBuffers())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+void Program::linkSamplerAndImageBindings(GLuint *combinedImageUniforms)
+{
+ ASSERT(combinedImageUniforms);
+
+ unsigned int high = static_cast<unsigned int>(mState.mUniforms.size());
+ unsigned int low = high;
+
+ for (auto counterIter = mState.mUniforms.rbegin();
+ counterIter != mState.mUniforms.rend() && counterIter->isAtomicCounter(); ++counterIter)
+ {
+ --low;
+ }
+
+ mState.mAtomicCounterUniformRange = RangeUI(low, high);
+
+ high = low;
+
+ for (auto imageIter = mState.mUniforms.rbegin();
+ imageIter != mState.mUniforms.rend() && imageIter->isImage(); ++imageIter)
+ {
+ --low;
+ }
+
+ mState.mImageUniformRange = RangeUI(low, high);
+ *combinedImageUniforms = 0u;
+ // If uniform is a image type, insert it into the mImageBindings array.
+ for (unsigned int imageIndex : mState.mImageUniformRange)
+ {
+ // ES3.1 (section 7.6.1) and GLSL ES3.1 (section 4.4.5), Uniform*i{v} commands
+ // cannot load values into a uniform defined as an image. if declare without a
+ // binding qualifier, any uniform image variable (include all elements of
+ // unbound image array) shoud be bound to unit zero.
+ auto &imageUniform = mState.mUniforms[imageIndex];
+ if (imageUniform.binding == -1)
+ {
+ mState.mImageBindings.emplace_back(
+ ImageBinding(imageUniform.getBasicTypeElementCount()));
+ }
+ else
+ {
+ mState.mImageBindings.emplace_back(
+ ImageBinding(imageUniform.binding, imageUniform.getBasicTypeElementCount(), false));
+ }
+
+ GLuint arraySize = imageUniform.isArray() ? imageUniform.arraySizes[0] : 1u;
+ *combinedImageUniforms += imageUniform.activeShaderCount() * arraySize;
+ }
+
+ high = low;
+
+ for (auto samplerIter = mState.mUniforms.rbegin() + mState.mImageUniformRange.length();
+ samplerIter != mState.mUniforms.rend() && samplerIter->isSampler(); ++samplerIter)
+ {
+ --low;
+ }
+
+ mState.mSamplerUniformRange = RangeUI(low, high);
+
+ // If uniform is a sampler type, insert it into the mSamplerBindings array.
+ for (unsigned int samplerIndex : mState.mSamplerUniformRange)
+ {
+ const auto &samplerUniform = mState.mUniforms[samplerIndex];
+ TextureType textureType = SamplerTypeToTextureType(samplerUniform.type);
+ unsigned int elementCount = samplerUniform.getBasicTypeElementCount();
+ SamplerFormat format = samplerUniform.typeInfo->samplerFormat;
+ mState.mSamplerBindings.emplace_back(textureType, format, elementCount, false);
+ }
+}
+
+bool Program::linkAtomicCounterBuffers()
+{
+ for (unsigned int index : mState.mAtomicCounterUniformRange)
+ {
+ auto &uniform = mState.mUniforms[index];
+ uniform.blockInfo.offset = uniform.offset;
+ uniform.blockInfo.arrayStride = (uniform.isArray() ? 4 : 0);
+ uniform.blockInfo.matrixStride = 0;
+ uniform.blockInfo.isRowMajorMatrix = false;
+
+ bool found = false;
+ for (unsigned int bufferIndex = 0; bufferIndex < mState.mAtomicCounterBuffers.size();
+ ++bufferIndex)
+ {
+ auto &buffer = mState.mAtomicCounterBuffers[bufferIndex];
+ if (buffer.binding == uniform.binding)
+ {
+ buffer.memberIndexes.push_back(index);
+ uniform.bufferIndex = bufferIndex;
+ found = true;
+ buffer.unionReferencesWith(uniform);
+ break;
+ }
+ }
+ if (!found)
+ {
+ AtomicCounterBuffer atomicCounterBuffer;
+ atomicCounterBuffer.binding = uniform.binding;
+ atomicCounterBuffer.memberIndexes.push_back(index);
+ atomicCounterBuffer.unionReferencesWith(uniform);
+ mState.mAtomicCounterBuffers.push_back(atomicCounterBuffer);
+ uniform.bufferIndex = static_cast<int>(mState.mAtomicCounterBuffers.size() - 1);
+ }
+ }
+ // TODO(jie.a.chen@intel.com): Count each atomic counter buffer to validate against
+ // gl_Max[Vertex|Fragment|Compute|Geometry|Combined]AtomicCounterBuffers.
+
+ return true;
+}
+
+// Assigns locations to all attributes from the bindings and program locations.
+bool Program::linkAttributes(const Context *context, InfoLog &infoLog)
+{
+ const Caps &caps = context->getCaps();
+ const Limitations &limitations = context->getLimitations();
+ bool webglCompatibility = context->getExtensions().webglCompatibility;
+
+ Shader *vertexShader = mState.getAttachedShader(ShaderType::Vertex);
+
+ int shaderVersion = vertexShader->getShaderVersion();
+
+ unsigned int usedLocations = 0;
+ if (shaderVersion >= 300)
+ {
+ // In GLSL ES 3.00.6, aliasing checks should be done with all declared attributes - see GLSL
+ // ES 3.00.6 section 12.46. Inactive attributes will be pruned after aliasing checks.
+ mState.mAttributes = vertexShader->getAllAttributes();
+ }
+ else
+ {
+ // In GLSL ES 1.00.17 we only do aliasing checks for active attributes.
+ mState.mAttributes = vertexShader->getActiveAttributes();
+ }
+ GLuint maxAttribs = caps.maxVertexAttributes;
+
+ std::vector<sh::Attribute *> usedAttribMap(maxAttribs, nullptr);
+
+ // Assign locations to attributes that have a binding location and check for attribute aliasing.
+ for (sh::Attribute &attribute : mState.mAttributes)
+ {
+ // GLSL ES 3.10 January 2016 section 4.3.4: Vertex shader inputs can't be arrays or
+ // structures, so we don't need to worry about adjusting their names or generating entries
+ // for each member/element (unlike uniforms for example).
+ ASSERT(!attribute.isArray() && !attribute.isStruct());
+
+ int bindingLocation = mAttributeBindings.getBinding(attribute);
+ if (attribute.location == -1 && bindingLocation != -1)
+ {
+ attribute.location = bindingLocation;
+ }
+
+ if (attribute.location != -1)
+ {
+ // Location is set by glBindAttribLocation or by location layout qualifier
+ const int regs = VariableRegisterCount(attribute.type);
+
+ if (static_cast<GLuint>(regs + attribute.location) > maxAttribs)
+ {
+ infoLog << "Attribute (" << attribute.name << ") at location " << attribute.location
+ << " is too big to fit";
+
+ return false;
+ }
+
+ for (int reg = 0; reg < regs; reg++)
+ {
+ const int regLocation = attribute.location + reg;
+ sh::ShaderVariable *linkedAttribute = usedAttribMap[regLocation];
+
+ // In GLSL ES 3.00.6 and in WebGL, attribute aliasing produces a link error.
+ // In non-WebGL GLSL ES 1.00.17, attribute aliasing is allowed with some
+ // restrictions - see GLSL ES 1.00.17 section 2.10.4, but ANGLE currently has a bug.
+ // In D3D 9 and 11, aliasing is not supported, so check a limitation.
+ if (linkedAttribute)
+ {
+ if (shaderVersion >= 300 || webglCompatibility ||
+ limitations.noVertexAttributeAliasing)
+ {
+ infoLog << "Attribute '" << attribute.name << "' aliases attribute '"
+ << linkedAttribute->name << "' at location " << regLocation;
+ return false;
+ }
+ }
+ else
+ {
+ usedAttribMap[regLocation] = &attribute;
+ }
+
+ usedLocations |= 1 << regLocation;
+ }
+ }
+ }
+
+ // Assign locations to attributes that don't have a binding location.
+ for (sh::Attribute &attribute : mState.mAttributes)
+ {
+ // Not set by glBindAttribLocation or by location layout qualifier
+ if (attribute.location == -1)
+ {
+ int regs = VariableRegisterCount(attribute.type);
+ int availableIndex = AllocateFirstFreeBits(&usedLocations, regs, maxAttribs);
+
+ if (availableIndex == -1 || static_cast<GLuint>(availableIndex + regs) > maxAttribs)
+ {
+ infoLog << "Too many attributes (" << attribute.name << ")";
+ return false;
+ }
+
+ attribute.location = availableIndex;
+ }
+ }
+
+ ASSERT(mState.mAttributesTypeMask.none());
+ ASSERT(mState.mAttributesMask.none());
+
+ // Prune inactive attributes. This step is only needed on shaderVersion >= 300 since on earlier
+ // shader versions we're only processing active attributes to begin with.
+ if (shaderVersion >= 300)
+ {
+ for (auto attributeIter = mState.mAttributes.begin();
+ attributeIter != mState.mAttributes.end();)
+ {
+ if (attributeIter->active)
+ {
+ ++attributeIter;
+ }
+ else
+ {
+ attributeIter = mState.mAttributes.erase(attributeIter);
+ }
+ }
+ }
+
+ for (const sh::Attribute &attribute : mState.mAttributes)
+ {
+ ASSERT(attribute.active);
+ ASSERT(attribute.location != -1);
+ unsigned int regs = static_cast<unsigned int>(VariableRegisterCount(attribute.type));
+
+ for (unsigned int r = 0; r < regs; r++)
+ {
+ unsigned int location = static_cast<unsigned int>(attribute.location) + r;
+ mState.mActiveAttribLocationsMask.set(location);
+ mState.mMaxActiveAttribLocation =
+ std::max(mState.mMaxActiveAttribLocation, location + 1);
+
+ // gl_VertexID and gl_InstanceID are active attributes but don't have a bound attribute.
+ if (!attribute.isBuiltIn())
+ {
+ ComponentType componentType =
+ GLenumToComponentType(VariableComponentType(attribute.type));
+
+ SetComponentTypeMask(componentType, location, &mState.mAttributesTypeMask);
+ mState.mAttributesMask.set(location);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool Program::linkInterfaceBlocks(const Caps &caps,
+ const Version &version,
+ bool webglCompatibility,
+ InfoLog &infoLog,
+ GLuint *combinedShaderStorageBlocksCount)
+{
+ ASSERT(combinedShaderStorageBlocksCount);
+
+ GLuint combinedUniformBlocksCount = 0u;
+ GLuint numShadersHasUniformBlocks = 0u;
+ ShaderMap<const std::vector<sh::InterfaceBlock> *> allShaderUniformBlocks = {};
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ Shader *shader = mState.mAttachedShaders[shaderType];
+ if (!shader)
+ {
+ continue;
+ }
+
+ const auto &uniformBlocks = shader->getUniformBlocks();
+ if (!uniformBlocks.empty())
+ {
+ if (!ValidateInterfaceBlocksCount(
+ caps.maxShaderUniformBlocks[shaderType], uniformBlocks, shaderType,
+ sh::BlockType::BLOCK_UNIFORM, &combinedUniformBlocksCount, infoLog))
+ {
+ return false;
+ }
+
+ allShaderUniformBlocks[shaderType] = &uniformBlocks;
+ ++numShadersHasUniformBlocks;
+ }
+ }
+
+ if (combinedUniformBlocksCount > caps.maxCombinedUniformBlocks)
+ {
+ infoLog << "The sum of the number of active uniform blocks exceeds "
+ "MAX_COMBINED_UNIFORM_BLOCKS ("
+ << caps.maxCombinedUniformBlocks << ").";
+ return false;
+ }
+
+ if (!ValidateInterfaceBlocksMatch(numShadersHasUniformBlocks, allShaderUniformBlocks, infoLog,
+ webglCompatibility))
+ {
+ return false;
+ }
+
+ if (version >= Version(3, 1))
+ {
+ *combinedShaderStorageBlocksCount = 0u;
+ GLuint numShadersHasShaderStorageBlocks = 0u;
+ ShaderMap<const std::vector<sh::InterfaceBlock> *> allShaderStorageBlocks = {};
+ for (ShaderType shaderType : AllShaderTypes())
+ {
+ Shader *shader = mState.mAttachedShaders[shaderType];
+ if (!shader)
+ {
+ continue;
+ }
+
+ const auto &shaderStorageBlocks = shader->getShaderStorageBlocks();
+ if (!shaderStorageBlocks.empty())
+ {
+ if (!ValidateInterfaceBlocksCount(
+ caps.maxShaderStorageBlocks[shaderType], shaderStorageBlocks, shaderType,
+ sh::BlockType::BLOCK_BUFFER, combinedShaderStorageBlocksCount, infoLog))
+ {
+ return false;
+ }
+
+ allShaderStorageBlocks[shaderType] = &shaderStorageBlocks;
+ ++numShadersHasShaderStorageBlocks;
+ }
+ }
+
+ if (*combinedShaderStorageBlocksCount > caps.maxCombinedShaderStorageBlocks)
+ {
+ infoLog << "The sum of the number of active shader storage blocks exceeds "
+ "MAX_COMBINED_SHADER_STORAGE_BLOCKS ("
+ << caps.maxCombinedShaderStorageBlocks << ").";
+ return false;
+ }
+
+ if (!ValidateInterfaceBlocksMatch(numShadersHasShaderStorageBlocks, allShaderStorageBlocks,
+ infoLog, webglCompatibility))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+LinkMismatchError Program::LinkValidateVariablesBase(const sh::ShaderVariable &variable1,
+ const sh::ShaderVariable &variable2,
+ bool validatePrecision,
+ bool validateArraySize,
+ std::string *mismatchedStructOrBlockMemberName)
+{
+ if (variable1.type != variable2.type)
+ {
+ return LinkMismatchError::TYPE_MISMATCH;
+ }
+ if (validateArraySize && variable1.arraySizes != variable2.arraySizes)
+ {
+ return LinkMismatchError::ARRAY_SIZE_MISMATCH;
+ }
+ if (validatePrecision && variable1.precision != variable2.precision)
+ {
+ return LinkMismatchError::PRECISION_MISMATCH;
+ }
+ if (variable1.structName != variable2.structName)
+ {
+ return LinkMismatchError::STRUCT_NAME_MISMATCH;
+ }
+
+ if (variable1.fields.size() != variable2.fields.size())
+ {
+ return LinkMismatchError::FIELD_NUMBER_MISMATCH;
+ }
+ const unsigned int numMembers = static_cast<unsigned int>(variable1.fields.size());
+ for (unsigned int memberIndex = 0; memberIndex < numMembers; memberIndex++)
+ {
+ const sh::ShaderVariable &member1 = variable1.fields[memberIndex];
+ const sh::ShaderVariable &member2 = variable2.fields[memberIndex];
+
+ if (member1.name != member2.name)
+ {
+ return LinkMismatchError::FIELD_NAME_MISMATCH;
+ }
+
+ LinkMismatchError linkErrorOnField = LinkValidateVariablesBase(
+ member1, member2, validatePrecision, true, mismatchedStructOrBlockMemberName);
+ if (linkErrorOnField != LinkMismatchError::NO_MISMATCH)
+ {
+ AddParentPrefix(member1.name, mismatchedStructOrBlockMemberName);
+ return linkErrorOnField;
+ }
+ }
+
+ return LinkMismatchError::NO_MISMATCH;
+}
+
+LinkMismatchError Program::LinkValidateVaryings(const sh::Varying &outputVarying,
+ const sh::Varying &inputVarying,
+ int shaderVersion,
+ bool validateGeometryShaderInputVarying,
+ std::string *mismatchedStructFieldName)
+{
+ if (validateGeometryShaderInputVarying)
+ {
+ // [GL_EXT_geometry_shader] Section 11.1gs.4.3:
+ // The OpenGL ES Shading Language doesn't support multi-dimensional arrays as shader inputs
+ // or outputs.
+ ASSERT(inputVarying.arraySizes.size() == 1u);
+
+ // Geometry shader input varyings are not treated as arrays, so a vertex array output
+ // varying cannot match a geometry shader input varying.
+ // [GL_EXT_geometry_shader] Section 7.4.1:
+ // Geometry shader per-vertex input variables and blocks are required to be declared as
+ // arrays, with each element representing input or output values for a single vertex of a
+ // multi-vertex primitive. For the purposes of interface matching, such variables and blocks
+ // are treated as though they were not declared as arrays.
+ if (outputVarying.isArray())
+ {
+ return LinkMismatchError::ARRAY_SIZE_MISMATCH;
+ }
+ }
+
+ // Skip the validation on the array sizes between a vertex output varying and a geometry input
+ // varying as it has been done before.
+ LinkMismatchError linkError =
+ LinkValidateVariablesBase(outputVarying, inputVarying, false,
+ !validateGeometryShaderInputVarying, mismatchedStructFieldName);
+ if (linkError != LinkMismatchError::NO_MISMATCH)
+ {
+ return linkError;
+ }
+
+ if (!sh::InterpolationTypesMatch(outputVarying.interpolation, inputVarying.interpolation))
+ {
+ return LinkMismatchError::INTERPOLATION_TYPE_MISMATCH;
+ }
+
+ if (shaderVersion == 100 && outputVarying.isInvariant != inputVarying.isInvariant)
+ {
+ return LinkMismatchError::INVARIANCE_MISMATCH;
+ }
+
+ return LinkMismatchError::NO_MISMATCH;
+}
+
+bool Program::linkValidateBuiltInVaryings(InfoLog &infoLog) const
+{
+ Shader *vertexShader = mState.mAttachedShaders[ShaderType::Vertex];
+ Shader *fragmentShader = mState.mAttachedShaders[ShaderType::Fragment];
+ const auto &vertexVaryings = vertexShader->getOutputVaryings();
+ const auto &fragmentVaryings = fragmentShader->getInputVaryings();
+ int shaderVersion = vertexShader->getShaderVersion();
+
+ if (shaderVersion != 100)
+ {
+ // Only ESSL 1.0 has restrictions on matching input and output invariance
+ return true;
+ }
+
+ bool glPositionIsInvariant = false;
+ bool glPointSizeIsInvariant = false;
+ bool glFragCoordIsInvariant = false;
+ bool glPointCoordIsInvariant = false;
+
+ for (const sh::Varying &varying : vertexVaryings)
+ {
+ if (!varying.isBuiltIn())
+ {
+ continue;
+ }
+ if (varying.name.compare("gl_Position") == 0)
+ {
+ glPositionIsInvariant = varying.isInvariant;
+ }
+ else if (varying.name.compare("gl_PointSize") == 0)
+ {
+ glPointSizeIsInvariant = varying.isInvariant;
+ }
+ }
+
+ for (const sh::Varying &varying : fragmentVaryings)
+ {
+ if (!varying.isBuiltIn())
+ {
+ continue;
+ }
+ if (varying.name.compare("gl_FragCoord") == 0)
+ {
+ glFragCoordIsInvariant = varying.isInvariant;
+ }
+ else if (varying.name.compare("gl_PointCoord") == 0)
+ {
+ glPointCoordIsInvariant = varying.isInvariant;
+ }
+ }
+
+ // There is some ambiguity in ESSL 1.00.17 paragraph 4.6.4 interpretation,
+ // for example, https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13842.
+ // Not requiring invariance to match is supported by:
+ // dEQP, WebGL CTS, Nexus 5X GLES
+ if (glFragCoordIsInvariant && !glPositionIsInvariant)
+ {
+ infoLog << "gl_FragCoord can only be declared invariant if and only if gl_Position is "
+ "declared invariant.";
+ return false;
+ }
+ if (glPointCoordIsInvariant && !glPointSizeIsInvariant)
+ {
+ infoLog << "gl_PointCoord can only be declared invariant if and only if gl_PointSize is "
+ "declared invariant.";
+ return false;
+ }
+
+ return true;
+}
+
+bool Program::linkValidateTransformFeedback(const Version &version,
+ InfoLog &infoLog,
+ const ProgramMergedVaryings &varyings,
+ const Caps &caps) const
+{
+
+ // Validate the tf names regardless of the actual program varyings.
+ std::set<std::string> uniqueNames;
+ for (const std::string &tfVaryingName : mState.mTransformFeedbackVaryingNames)
+ {
+ if (version < Version(3, 1) && tfVaryingName.find('[') != std::string::npos)
+ {
+ infoLog << "Capture of array elements is undefined and not supported.";
+ return false;
+ }
+ if (version >= Version(3, 1))
+ {
+ if (IncludeSameArrayElement(uniqueNames, tfVaryingName))
+ {
+ infoLog << "Two transform feedback varyings include the same array element ("
+ << tfVaryingName << ").";
+ return false;
+ }
+ }
+ else
+ {
+ if (uniqueNames.count(tfVaryingName) > 0)
+ {
+ infoLog << "Two transform feedback varyings specify the same output variable ("
+ << tfVaryingName << ").";
+ return false;
+ }
+ }
+ uniqueNames.insert(tfVaryingName);
+ }
+
+ // Validate against program varyings.
+ size_t totalComponents = 0;
+ for (const std::string &tfVaryingName : mState.mTransformFeedbackVaryingNames)
+ {
+ std::vector<unsigned int> subscripts;
+ std::string baseName = ParseResourceName(tfVaryingName, &subscripts);
+
+ const sh::ShaderVariable *var = FindVaryingOrField(varyings, baseName);
+ if (var == nullptr)
+ {
+ infoLog << "Transform feedback varying " << tfVaryingName
+ << " does not exist in the vertex shader.";
+ return false;
+ }
+
+ // Validate the matching variable.
+ if (var->isStruct())
+ {
+ infoLog << "Struct cannot be captured directly (" << baseName << ").";
+ return false;
+ }
+
+ size_t elementCount = 0;
+ size_t componentCount = 0;
+
+ if (var->isArray())
+ {
+ if (version < Version(3, 1))
+ {
+ infoLog << "Capture of arrays is undefined and not supported.";
+ return false;
+ }
+
+ // GLSL ES 3.10 section 4.3.6: A vertex output can't be an array of arrays.
+ ASSERT(!var->isArrayOfArrays());
+
+ if (!subscripts.empty() && subscripts[0] >= var->getOutermostArraySize())
+ {
+ infoLog << "Cannot capture outbound array element '" << tfVaryingName << "'.";
+ return false;
+ }
+ elementCount = (subscripts.empty() ? var->getOutermostArraySize() : 1);
+ }
+ else
+ {
+ if (!subscripts.empty())
+ {
+ infoLog << "Varying '" << baseName
+ << "' is not an array to be captured by element.";
+ return false;
+ }
+ elementCount = 1;
+ }
+
+ // TODO(jmadill): Investigate implementation limits on D3D11
+ componentCount = VariableComponentCount(var->type) * elementCount;
+ if (mState.mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &&
+ componentCount > caps.maxTransformFeedbackSeparateComponents)
+ {
+ infoLog << "Transform feedback varying " << tfVaryingName << " components ("
+ << componentCount << ") exceed the maximum separate components ("
+ << caps.maxTransformFeedbackSeparateComponents << ").";
+ return false;
+ }
+
+ totalComponents += componentCount;
+ if (mState.mTransformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS &&
+ totalComponents > caps.maxTransformFeedbackInterleavedComponents)
+ {
+ infoLog << "Transform feedback varying total components (" << totalComponents
+ << ") exceed the maximum interleaved components ("
+ << caps.maxTransformFeedbackInterleavedComponents << ").";
+ return false;
+ }
+ }
+ return true;
+}
+
+bool Program::linkValidateGlobalNames(InfoLog &infoLog) const
+{
+ const std::vector<sh::Attribute> &attributes =
+ mState.mAttachedShaders[ShaderType::Vertex]->getActiveAttributes();
+ std::unordered_map<std::string, const sh::Uniform *> uniformMap;
+ using BlockAndFieldPair =
+ std::pair<const sh::InterfaceBlock *, const sh::InterfaceBlockField *>;
+ std::unordered_map<std::string, std::vector<BlockAndFieldPair>> uniformBlockFieldMap;
+
+ for (ShaderType shaderType : kAllGraphicsShaderTypes)
+ {
+ Shader *shader = mState.mAttachedShaders[shaderType];
+ if (!shader)
+ {
+ continue;
+ }
+
+ // Build a map of Uniforms
+ const std::vector<sh::Uniform> uniforms = shader->getUniforms();
+ for (const auto &uniform : uniforms)
+ {
+ uniformMap[uniform.name] = &uniform;
+ }
+
+ // Build a map of Uniform Blocks
+ // This will also detect any field name conflicts between Uniform Blocks without instance
+ // names
+ const std::vector<sh::InterfaceBlock> &uniformBlocks = shader->getUniformBlocks();
+ for (const auto &uniformBlock : uniformBlocks)
+ {
+ // Only uniform blocks without an instance name can create a conflict with their field
+ // names
+ if (!uniformBlock.instanceName.empty())
+ {
+ continue;
+ }
+
+ for (const auto &field : uniformBlock.fields)
+ {
+ if (!uniformBlockFieldMap.count(field.name))
+ {
+ // First time we've seen this uniform block field name, so add the
+ // (Uniform Block, Field) pair immediately since there can't be a conflict yet
+ BlockAndFieldPair blockAndFieldPair(&uniformBlock, &field);
+ std::vector<BlockAndFieldPair> newUniformBlockList;
+ newUniformBlockList.push_back(blockAndFieldPair);
+ uniformBlockFieldMap[field.name] = newUniformBlockList;
+ continue;
+ }
+
+ // We've seen this name before.
+ // We need to check each of the uniform blocks that contain a field with this name
+ // to see if there's a conflict or not.
+ std::vector<BlockAndFieldPair> prevBlockFieldPairs =
+ uniformBlockFieldMap[field.name];
+ for (const auto prevBlockFieldPair : prevBlockFieldPairs)
+ {
+ const sh::InterfaceBlock *prevUniformBlock = prevBlockFieldPair.first;
+ const sh::InterfaceBlockField *prevUniformBlockField =
+ prevBlockFieldPair.second;
+
+ if (uniformBlock.isSameInterfaceBlockAtLinkTime(*prevUniformBlock))
+ {
+ // The same uniform block should, by definition, contain the same field name
+ continue;
+ }
+
+ // The uniform blocks don't match, so check if the necessary field properties
+ // also match
+ if ((field.name == prevUniformBlockField->name) &&
+ (field.type == prevUniformBlockField->type) &&
+ (field.precision == prevUniformBlockField->precision))
+ {
+ infoLog << "Name conflicts between uniform block field names: "
+ << field.name;
+ return false;
+ }
+ }
+
+ // No conflict, so record this pair
+ BlockAndFieldPair blockAndFieldPair(&uniformBlock, &field);
+ uniformBlockFieldMap[field.name].push_back(blockAndFieldPair);
+ }
+ }
+ }
+
+ // Validate no uniform names conflict with attribute names
+ for (const auto &attrib : attributes)
+ {
+ if (uniformMap.count(attrib.name))
+ {
+ infoLog << "Name conflicts between a uniform and an attribute: " << attrib.name;
+ return false;
+ }
+ }
+
+ // Validate no Uniform Block fields conflict with other Uniforms
+ for (const auto &uniformBlockField : uniformBlockFieldMap)
+ {
+ const std::string &fieldName = uniformBlockField.first;
+ if (uniformMap.count(fieldName))
+ {
+ infoLog << "Name conflicts between a uniform and a uniform block field: " << fieldName;
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void Program::gatherTransformFeedbackVaryings(const ProgramMergedVaryings &varyings)
+{
+ // Gather the linked varyings that are used for transform feedback, they should all exist.
+ mState.mLinkedTransformFeedbackVaryings.clear();
+ for (const std::string &tfVaryingName : mState.mTransformFeedbackVaryingNames)
+ {
+ std::vector<unsigned int> subscripts;
+ std::string baseName = ParseResourceName(tfVaryingName, &subscripts);
+ size_t subscript = GL_INVALID_INDEX;
+ if (!subscripts.empty())
+ {
+ subscript = subscripts.back();
+ }
+ for (const auto &ref : varyings)
+ {
+ const sh::Varying *varying = ref.second.get();
+ if (baseName == varying->name)
+ {
+ mState.mLinkedTransformFeedbackVaryings.emplace_back(
+ *varying, static_cast<GLuint>(subscript));
+ break;
+ }
+ else if (varying->isStruct())
+ {
+ GLuint fieldIndex = 0;
+ const auto *field = FindShaderVarField(*varying, tfVaryingName, &fieldIndex);
+ if (field != nullptr)
+ {
+ mState.mLinkedTransformFeedbackVaryings.emplace_back(*field, *varying);
+ break;
+ }
+ }
+ }
+ }
+}
+
+ProgramMergedVaryings Program::getMergedVaryings() const
+{
+ ProgramMergedVaryings merged;
+
+ for (const sh::Varying &varying :
+ mState.mAttachedShaders[ShaderType::Vertex]->getOutputVaryings())
+ {
+ merged[varying.name].vertex = &varying;
+ }
+
+ for (const sh::Varying &varying :
+ mState.mAttachedShaders[ShaderType::Fragment]->getInputVaryings())
+ {
+ merged[varying.name].fragment = &varying;
+ }
+
+ return merged;
+}
+
+bool CompareOutputVariable(const sh::OutputVariable &a, const sh::OutputVariable &b)
+{
+ return a.getArraySizeProduct() > b.getArraySizeProduct();
+}
+
+int Program::getOutputLocationForLink(const sh::OutputVariable &outputVariable) const
+{
+ if (outputVariable.location != -1)
+ {
+ return outputVariable.location;
+ }
+ int apiLocation = mFragmentOutputLocations.getBinding(outputVariable);
+ if (apiLocation != -1)
+ {
+ return apiLocation;
+ }
+ return -1;
+}
+
+bool Program::isOutputSecondaryForLink(const sh::OutputVariable &outputVariable) const
+{
+ if (outputVariable.index != -1)
+ {
+ ASSERT(outputVariable.index == 0 || outputVariable.index == 1);
+ return (outputVariable.index == 1);
+ }
+ int apiIndex = mFragmentOutputIndexes.getBinding(outputVariable);
+ if (apiIndex != -1)
+ {
+ // Index layout qualifier from the shader takes precedence, so the index from the API is
+ // checked only if the index was not set in the shader. This is not specified in the EXT
+ // spec, but is specified in desktop OpenGL specs.
+ return (apiIndex == 1);
+ }
+ // EXT_blend_func_extended: Outputs get index 0 by default.
+ return false;
+}
+
+namespace
+{
+
+bool FindUsedOutputLocation(std::vector<VariableLocation> &outputLocations,
+ unsigned int baseLocation,
+ unsigned int elementCount,
+ const std::vector<VariableLocation> &reservedLocations,
+ unsigned int variableIndex)
+{
+ if (baseLocation + elementCount > outputLocations.size())
+ {
+ elementCount =
+ baseLocation < outputLocations.size() ? outputLocations.size() - baseLocation : 0;
+ }
+ for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ const unsigned int location = baseLocation + elementIndex;
+ if (outputLocations[location].used())
+ {
+ VariableLocation locationInfo(elementIndex, variableIndex);
+ if (std::find(reservedLocations.begin(), reservedLocations.end(), locationInfo) ==
+ reservedLocations.end())
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void AssignOutputLocations(std::vector<VariableLocation> &outputLocations,
+ unsigned int baseLocation,
+ unsigned int elementCount,
+ const std::vector<VariableLocation> &reservedLocations,
+ unsigned int variableIndex)
+{
+ if (baseLocation + elementCount > outputLocations.size())
+ {
+ outputLocations.resize(baseLocation + elementCount);
+ }
+ for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ VariableLocation locationInfo(elementIndex, variableIndex);
+ if (std::find(reservedLocations.begin(), reservedLocations.end(), locationInfo) ==
+ reservedLocations.end())
+ {
+ const unsigned int location = baseLocation + elementIndex;
+ outputLocations[location] = locationInfo;
+ }
+ }
+}
+
+} // anonymous namespace
+
+bool Program::linkOutputVariables(const Caps &caps,
+ const Extensions &extensions,
+ const Version &version,
+ GLuint combinedImageUniformsCount,
+ GLuint combinedShaderStorageBlocksCount)
+{
+ Shader *fragmentShader = mState.mAttachedShaders[ShaderType::Fragment];
+ ASSERT(fragmentShader != nullptr);
+
+ ASSERT(mState.mOutputVariableTypes.empty());
+ ASSERT(mState.mActiveOutputVariables.none());
+ ASSERT(mState.mDrawBufferTypeMask.none());
+
+ const auto &outputVariables = fragmentShader->getActiveOutputVariables();
+ // Gather output variable types
+ for (const auto &outputVariable : outputVariables)
+ {
+ if (outputVariable.isBuiltIn() && outputVariable.name != "gl_FragColor" &&
+ outputVariable.name != "gl_FragData")
+ {
+ continue;
+ }
+
+ unsigned int baseLocation =
+ (outputVariable.location == -1 ? 0u
+ : static_cast<unsigned int>(outputVariable.location));
+
+ // GLSL ES 3.10 section 4.3.6: Output variables cannot be arrays of arrays or arrays of
+ // structures, so we may use getBasicTypeElementCount().
+ unsigned int elementCount = outputVariable.getBasicTypeElementCount();
+ for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++)
+ {
+ const unsigned int location = baseLocation + elementIndex;
+ if (location >= mState.mOutputVariableTypes.size())
+ {
+ mState.mOutputVariableTypes.resize(location + 1, GL_NONE);
+ }
+ ASSERT(location < mState.mActiveOutputVariables.size());
+ mState.mActiveOutputVariables.set(location);
+ mState.mOutputVariableTypes[location] = VariableComponentType(outputVariable.type);
+ ComponentType componentType =
+ GLenumToComponentType(mState.mOutputVariableTypes[location]);
+ SetComponentTypeMask(componentType, location, &mState.mDrawBufferTypeMask);
+ }
+ }
+
+ if (version >= ES_3_1)
+ {
+ // [OpenGL ES 3.1] Chapter 8.22 Page 203:
+ // A link error will be generated if the sum of the number of active image uniforms used in
+ // all shaders, the number of active shader storage blocks, and the number of active
+ // fragment shader outputs exceeds the implementation-dependent value of
+ // MAX_COMBINED_SHADER_OUTPUT_RESOURCES.
+ if (combinedImageUniformsCount + combinedShaderStorageBlocksCount +
+ mState.mActiveOutputVariables.count() >
+ caps.maxCombinedShaderOutputResources)
+ {
+ mInfoLog
+ << "The sum of the number of active image uniforms, active shader storage blocks "
+ "and active fragment shader outputs exceeds "
+ "MAX_COMBINED_SHADER_OUTPUT_RESOURCES ("
+ << caps.maxCombinedShaderOutputResources << ")";
+ return false;
+ }
+ }
+
+ // Skip this step for GLES2 shaders.
+ if (fragmentShader->getShaderVersion() == 100)
+ return true;
+
+ mState.mOutputVariables = outputVariables;
+ // TODO(jmadill): any caps validation here?
+
+ for (sh::OutputVariable &outputVariable : mState.mOutputVariables)
+ {
+ if (outputVariable.isArray())
+ {
+ // We're following the GLES 3.1 November 2016 spec section 7.3.1.1 Naming Active
+ // Resources and including [0] at the end of array variable names.
+ outputVariable.name += "[0]";
+ outputVariable.mappedName += "[0]";
+ }
+ }
+
+ // EXT_blend_func_extended doesn't specify anything related to binding specific elements of an
+ // output array in explicit terms.
+ //
+ // Assuming fragData is an output array, you can defend the position that:
+ // P1) you must support binding "fragData" because it's specified
+ // P2) you must support querying "fragData[x]" because it's specified
+ // P3) you must support binding "fragData[0]" because it's a frequently used pattern
+ //
+ // Then you can make the leap of faith:
+ // P4) you must support binding "fragData[x]" because you support "fragData[0]"
+ // P5) you must support binding "fragData[x]" because you support querying "fragData[x]"
+ //
+ // The spec brings in the "world of arrays" when it mentions binding the arrays and the
+ // automatic binding. Thus it must be interpreted that the thing is not undefined, rather you
+ // must infer the only possible interpretation (?). Note again: this need of interpretation
+ // might be completely off of what GL spec logic is.
+ //
+ // The other complexity is that unless you implement this feature, it's hard to understand what
+ // should happen when the client invokes the feature. You cannot add an additional error as it
+ // is not specified. One can ignore it, but obviously it creates the discrepancies...
+
+ std::vector<VariableLocation> reservedLocations;
+
+ // Process any output API bindings for arrays that don't alias to the first element.
+ for (const auto &binding : mFragmentOutputLocations)
+ {
+ size_t nameLengthWithoutArrayIndex;
+ unsigned int arrayIndex = ParseArrayIndex(binding.first, &nameLengthWithoutArrayIndex);
+ if (arrayIndex == 0 || arrayIndex == GL_INVALID_INDEX)
+ {
+ continue;
+ }
+ for (unsigned int outputVariableIndex = 0;
+ outputVariableIndex < mState.mOutputVariables.size(); outputVariableIndex++)
+ {
+ const sh::OutputVariable &outputVariable = mState.mOutputVariables[outputVariableIndex];
+ // Check that the binding corresponds to an output array and its array index fits.
+ if (outputVariable.isBuiltIn() || !outputVariable.isArray() ||
+ !angle::BeginsWith(outputVariable.name, binding.first,
+ nameLengthWithoutArrayIndex) ||
+ arrayIndex >= outputVariable.getOutermostArraySize())
+ {
+ continue;
+ }
+
+ // Get the API index that corresponds to this exact binding.
+ // This index may differ from the index used for the array's base.
+ auto &outputLocations = mFragmentOutputIndexes.getBindingByName(binding.first) == 1
+ ? mState.mSecondaryOutputLocations
+ : mState.mOutputLocations;
+ unsigned int location = binding.second.location;
+ VariableLocation locationInfo(arrayIndex, outputVariableIndex);
+ if (location >= outputLocations.size())
+ {
+ outputLocations.resize(location + 1);
+ }
+ if (outputLocations[location].used())
+ {
+ mInfoLog << "Location of variable " << outputVariable.name
+ << " conflicts with another variable.";
+ return false;
+ }
+ outputLocations[location] = locationInfo;
+
+ // Note the array binding location so that it can be skipped later.
+ reservedLocations.push_back(locationInfo);
+ }
+ }
+
+ // Reserve locations for output variables whose location is fixed in the shader or through the
+ // API. Otherwise, the remaining unallocated outputs will be processed later.
+ for (unsigned int outputVariableIndex = 0; outputVariableIndex < mState.mOutputVariables.size();
+ outputVariableIndex++)
+ {
+ const sh::OutputVariable &outputVariable = mState.mOutputVariables[outputVariableIndex];
+
+ // Don't store outputs for gl_FragDepth, gl_FragColor, etc.
+ if (outputVariable.isBuiltIn())
+ continue;
+
+ int fixedLocation = getOutputLocationForLink(outputVariable);
+ if (fixedLocation == -1)
+ {
+ // Here we're only reserving locations for variables whose location is fixed.
+ continue;
+ }
+ unsigned int baseLocation = static_cast<unsigned int>(fixedLocation);
+
+ auto &outputLocations = isOutputSecondaryForLink(outputVariable)
+ ? mState.mSecondaryOutputLocations
+ : mState.mOutputLocations;
+
+ // GLSL ES 3.10 section 4.3.6: Output variables cannot be arrays of arrays or arrays of
+ // structures, so we may use getBasicTypeElementCount().
+ unsigned int elementCount = outputVariable.getBasicTypeElementCount();
+ if (FindUsedOutputLocation(outputLocations, baseLocation, elementCount, reservedLocations,
+ outputVariableIndex))
+ {
+ mInfoLog << "Location of variable " << outputVariable.name
+ << " conflicts with another variable.";
+ return false;
+ }
+ AssignOutputLocations(outputLocations, baseLocation, elementCount, reservedLocations,
+ outputVariableIndex);
+ }
+
+ // Here we assign locations for the output variables that don't yet have them. Note that we're
+ // not necessarily able to fit the variables optimally, since then we might have to try
+ // different arrangements of output arrays. Now we just assign the locations in the order that
+ // we got the output variables. The spec isn't clear on what kind of algorithm is required for
+ // finding locations for the output variables, so this should be acceptable at least for now.
+ GLuint maxLocation = caps.maxDrawBuffers;
+ if (!mState.mSecondaryOutputLocations.empty())
+ {
+ // EXT_blend_func_extended: Program outputs will be validated against
+ // MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT if there's even one output with index one.
+ maxLocation = extensions.maxDualSourceDrawBuffers;
+ }
+
+ for (unsigned int outputVariableIndex = 0; outputVariableIndex < mState.mOutputVariables.size();
+ outputVariableIndex++)
+ {
+ const sh::OutputVariable &outputVariable = mState.mOutputVariables[outputVariableIndex];
+
+ // Don't store outputs for gl_FragDepth, gl_FragColor, etc.
+ if (outputVariable.isBuiltIn())
+ continue;
+
+ int fixedLocation = getOutputLocationForLink(outputVariable);
+ auto &outputLocations = isOutputSecondaryForLink(outputVariable)
+ ? mState.mSecondaryOutputLocations
+ : mState.mOutputLocations;
+ unsigned int baseLocation = 0;
+ unsigned int elementCount = outputVariable.getBasicTypeElementCount();
+ if (fixedLocation != -1)
+ {
+ // Secondary inputs might have caused the max location to drop below what has already
+ // been explicitly assigned locations. Check for any fixed locations above the max
+ // that should cause linking to fail.
+ baseLocation = static_cast<unsigned int>(fixedLocation);
+ }
+ else
+ {
+ // No fixed location, so try to fit the output in unassigned locations.
+ // Try baseLocations starting from 0 one at a time and see if the variable fits.
+ while (FindUsedOutputLocation(outputLocations, baseLocation, elementCount,
+ reservedLocations, outputVariableIndex))
+ {
+ baseLocation++;
+ }
+ AssignOutputLocations(outputLocations, baseLocation, elementCount, reservedLocations,
+ outputVariableIndex);
+ }
+
+ // Check for any elements assigned above the max location that are actually used.
+ if (baseLocation + elementCount > maxLocation &&
+ (baseLocation >= maxLocation ||
+ FindUsedOutputLocation(outputLocations, maxLocation,
+ baseLocation + elementCount - maxLocation, reservedLocations,
+ outputVariableIndex)))
+ {
+ // EXT_blend_func_extended: Linking can fail:
+ // "if the explicit binding assignments do not leave enough space for the linker to
+ // automatically assign a location for a varying out array, which requires multiple
+ // contiguous locations."
+ mInfoLog << "Could not fit output variable into available locations: "
+ << outputVariable.name;
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void Program::setUniformValuesFromBindingQualifiers()
+{
+ for (unsigned int samplerIndex : mState.mSamplerUniformRange)
+ {
+ const auto &samplerUniform = mState.mUniforms[samplerIndex];
+ if (samplerUniform.binding != -1)
+ {
+ GLint location = getUniformLocation(samplerUniform.name);
+ ASSERT(location != -1);
+ std::vector<GLint> boundTextureUnits;
+ for (unsigned int elementIndex = 0;
+ elementIndex < samplerUniform.getBasicTypeElementCount(); ++elementIndex)
+ {
+ boundTextureUnits.push_back(samplerUniform.binding + elementIndex);
+ }
+
+ // Here we pass nullptr to avoid a large chain of calls that need a non-const Context.
+ // We know it's safe not to notify the Context because this is only called after link.
+ setUniform1iv(nullptr, location, static_cast<GLsizei>(boundTextureUnits.size()),
+ boundTextureUnits.data());
+ }
+ }
+}
+
+void Program::initInterfaceBlockBindings()
+{
+ // Set initial bindings from shader.
+ for (unsigned int blockIndex = 0; blockIndex < mState.mUniformBlocks.size(); blockIndex++)
+ {
+ InterfaceBlock &uniformBlock = mState.mUniformBlocks[blockIndex];
+ bindUniformBlock(blockIndex, uniformBlock.binding);
+ }
+}
+
+void Program::updateSamplerUniform(Context *context,
+ const VariableLocation &locationInfo,
+ GLsizei clampedCount,
+ const GLint *v)
+{
+ ASSERT(mState.isSamplerUniformIndex(locationInfo.index));
+ GLuint samplerIndex = mState.getSamplerIndexFromUniformIndex(locationInfo.index);
+ SamplerBinding &samplerBinding = mState.mSamplerBindings[samplerIndex];
+ std::vector<GLuint> &boundTextureUnits = samplerBinding.boundTextureUnits;
+
+ if (samplerBinding.unreferenced)
+ return;
+
+ // Update the sampler uniforms.
+ for (GLsizei arrayIndex = 0; arrayIndex < clampedCount; ++arrayIndex)
+ {
+ GLint oldTextureUnit = boundTextureUnits[arrayIndex + locationInfo.arrayIndex];
+ GLint newTextureUnit = v[arrayIndex];
+
+ if (oldTextureUnit == newTextureUnit)
+ continue;
+
+ boundTextureUnits[arrayIndex + locationInfo.arrayIndex] = newTextureUnit;
+
+ // Update the reference counts.
+ uint32_t &oldRefCount = mState.mActiveSamplerRefCounts[oldTextureUnit];
+ uint32_t &newRefCount = mState.mActiveSamplerRefCounts[newTextureUnit];
+ ASSERT(oldRefCount > 0);
+ ASSERT(newRefCount < std::numeric_limits<uint32_t>::max());
+ oldRefCount--;
+ newRefCount++;
+
+ // Check for binding type change.
+ TextureType &newSamplerType = mState.mActiveSamplerTypes[newTextureUnit];
+ TextureType &oldSamplerType = mState.mActiveSamplerTypes[oldTextureUnit];
+ SamplerFormat &newSamplerFormat = mState.mActiveSamplerFormats[newTextureUnit];
+ SamplerFormat &oldSamplerFormat = mState.mActiveSamplerFormats[oldTextureUnit];
+
+ if (newRefCount == 1)
+ {
+ newSamplerType = samplerBinding.textureType;
+ newSamplerFormat = samplerBinding.format;
+ mState.mActiveSamplersMask.set(newTextureUnit);
+ }
+ else
+ {
+ if (newSamplerType != samplerBinding.textureType)
+ {
+ // Conflict detected. Ensure we reset it properly.
+ newSamplerType = TextureType::InvalidEnum;
+ }
+ if (newSamplerFormat != samplerBinding.format)
+ {
+ newSamplerFormat = SamplerFormat::InvalidEnum;
+ }
+ }
+
+ // Unset previously active sampler.
+ if (oldRefCount == 0)
+ {
+ oldSamplerType = TextureType::InvalidEnum;
+ oldSamplerFormat = SamplerFormat::InvalidEnum;
+ mState.mActiveSamplersMask.reset(oldTextureUnit);
+ }
+ else
+ {
+ if (oldSamplerType == TextureType::InvalidEnum ||
+ oldSamplerFormat == SamplerFormat::InvalidEnum)
+ {
+ // Previous conflict. Check if this new change fixed the conflict.
+ mState.setSamplerUniformTextureTypeAndFormat(oldTextureUnit);
+ }
+ }
+
+ // Notify context.
+ if (context)
+ {
+ context->onSamplerUniformChange(newTextureUnit);
+ context->onSamplerUniformChange(oldTextureUnit);
+ }
+ }
+
+ // Invalidate the validation cache.
+ mCachedValidateSamplersResult.reset();
+}
+
+void ProgramState::setSamplerUniformTextureTypeAndFormat(size_t textureUnitIndex)
+{
+ bool foundBinding = false;
+ TextureType foundType = TextureType::InvalidEnum;
+ SamplerFormat foundFormat = SamplerFormat::InvalidEnum;
+
+ for (const SamplerBinding &binding : mSamplerBindings)
+ {
+ if (binding.unreferenced)
+ continue;
+
+ // A conflict exists if samplers of different types are sourced by the same texture unit.
+ // We need to check all bound textures to detect this error case.
+ for (GLuint textureUnit : binding.boundTextureUnits)
+ {
+ if (textureUnit == textureUnitIndex)
+ {
+ if (!foundBinding)
+ {
+ foundBinding = true;
+ foundType = binding.textureType;
+ foundFormat = binding.format;
+ }
+ else
+ {
+ if (foundType != binding.textureType)
+ {
+ foundType = TextureType::InvalidEnum;
+ }
+ if (foundFormat != binding.format)
+ {
+ foundFormat = SamplerFormat::InvalidEnum;
+ }
+ }
+ }
+ }
+ }
+
+ mActiveSamplerTypes[textureUnitIndex] = foundType;
+ mActiveSamplerFormats[textureUnitIndex] = foundFormat;
+}
+
+template <typename T>
+GLsizei Program::clampUniformCount(const VariableLocation &locationInfo,
+ GLsizei count,
+ int vectorSize,
+ const T *v)
+{
+ if (count == 1)
+ return 1;
+
+ const LinkedUniform &linkedUniform = mState.mUniforms[locationInfo.index];
+
+ // OpenGL ES 3.0.4 spec pg 67: "Values for any array element that exceeds the highest array
+ // element index used, as reported by GetActiveUniform, will be ignored by the GL."
+ unsigned int remainingElements =
+ linkedUniform.getBasicTypeElementCount() - locationInfo.arrayIndex;
+ GLsizei maxElementCount =
+ static_cast<GLsizei>(remainingElements * linkedUniform.getElementComponents());
+
+ if (count * vectorSize > maxElementCount)
+ {
+ return maxElementCount / vectorSize;
+ }
+
+ return count;
+}
+
+template <size_t cols, size_t rows, typename T>
+GLsizei Program::clampMatrixUniformCount(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const T *v)
+{
+ const VariableLocation &locationInfo = mState.mUniformLocations[location];
+
+ if (!transpose)
+ {
+ return clampUniformCount(locationInfo, count, cols * rows, v);
+ }
+
+ const LinkedUniform &linkedUniform = mState.mUniforms[locationInfo.index];
+
+ // OpenGL ES 3.0.4 spec pg 67: "Values for any array element that exceeds the highest array
+ // element index used, as reported by GetActiveUniform, will be ignored by the GL."
+ unsigned int remainingElements =
+ linkedUniform.getBasicTypeElementCount() - locationInfo.arrayIndex;
+ return std::min(count, static_cast<GLsizei>(remainingElements));
+}
+
+// Driver differences mean that doing the uniform value cast ourselves gives consistent results.
+// EG: on NVIDIA drivers, it was observed that getUniformi for MAX_INT+1 returned MIN_INT.
+template <typename DestT>
+void Program::getUniformInternal(const Context *context,
+ DestT *dataOut,
+ GLint location,
+ GLenum nativeType,
+ int components) const
+{
+ switch (nativeType)
+ {
+ case GL_BOOL:
+ {
+ GLint tempValue[16] = {0};
+ mProgram->getUniformiv(context, location, tempValue);
+ UniformStateQueryCastLoop<GLboolean>(
+ dataOut, reinterpret_cast<const uint8_t *>(tempValue), components);
+ break;
+ }
+ case GL_INT:
+ {
+ GLint tempValue[16] = {0};
+ mProgram->getUniformiv(context, location, tempValue);
+ UniformStateQueryCastLoop<GLint>(dataOut, reinterpret_cast<const uint8_t *>(tempValue),
+ components);
+ break;
+ }
+ case GL_UNSIGNED_INT:
+ {
+ GLuint tempValue[16] = {0};
+ mProgram->getUniformuiv(context, location, tempValue);
+ UniformStateQueryCastLoop<GLuint>(dataOut, reinterpret_cast<const uint8_t *>(tempValue),
+ components);
+ break;
+ }
+ case GL_FLOAT:
+ {
+ GLfloat tempValue[16] = {0};
+ mProgram->getUniformfv(context, location, tempValue);
+ UniformStateQueryCastLoop<GLfloat>(
+ dataOut, reinterpret_cast<const uint8_t *>(tempValue), components);
+ break;
+ }
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+angle::Result Program::syncState(const Context *context)
+{
+ if (mDirtyBits.any())
+ {
+ ASSERT(mLinkResolved);
+ ANGLE_TRY(mProgram->syncState(context, mDirtyBits));
+ mDirtyBits.reset();
+ }
+
+ return angle::Result::Continue;
+}
+
+void Program::serialize(const Context *context, angle::MemoryBuffer *binaryOut) const
+{
+ BinaryOutputStream stream;
+
+ stream.writeBytes(reinterpret_cast<const unsigned char *>(ANGLE_COMMIT_HASH),
+ ANGLE_COMMIT_HASH_SIZE);
+
+ // nullptr context is supported when computing binary length.
+ if (context)
+ {
+ stream.writeInt(context->getClientVersion().major);
+ stream.writeInt(context->getClientVersion().minor);
+ }
+ else
+ {
+ stream.writeInt(2);
+ stream.writeInt(0);
+ }
+
+ const auto &computeLocalSize = mState.getComputeShaderLocalSize();
+
+ stream.writeInt(computeLocalSize[0]);
+ stream.writeInt(computeLocalSize[1]);
+ stream.writeInt(computeLocalSize[2]);
+
+ ASSERT(mState.mGeometryShaderInvocations >= 1 && mState.mGeometryShaderMaxVertices >= 0);
+ stream.writeEnum(mState.mGeometryShaderInputPrimitiveType);
+ stream.writeEnum(mState.mGeometryShaderOutputPrimitiveType);
+ stream.writeInt(mState.mGeometryShaderInvocations);
+ stream.writeInt(mState.mGeometryShaderMaxVertices);
+
+ stream.writeInt(mState.mNumViews);
+
+ stream.writeInt(mState.mMaxActiveAttribLocation);
+
+ static_assert(MAX_VERTEX_ATTRIBS * 2 <= sizeof(uint32_t) * 8,
+ "All bits of mAttributesTypeMask types and mask fit into 32 bits each");
+ stream.writeInt(static_cast<int>(mState.mAttributesTypeMask.to_ulong()));
+ stream.writeInt(static_cast<int>(mState.mAttributesMask.to_ulong()));
+
+ stream.writeInt(mState.getActiveAttribLocationsMask().to_ulong());
+
+ stream.writeInt(mState.getAttributes().size());
+ for (const sh::Attribute &attrib : mState.getAttributes())
+ {
+ WriteShaderVar(&stream, attrib);
+ stream.writeInt(attrib.location);
+ }
+
+ stream.writeInt(mState.getUniforms().size());
+ for (const LinkedUniform &uniform : mState.getUniforms())
+ {
+ WriteShaderVar(&stream, uniform);
+
+ // FIXME: referenced
+
+ stream.writeInt(uniform.bufferIndex);
+ WriteBlockMemberInfo(&stream, uniform.blockInfo);
+
+ // Active shader info
+ for (ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream.writeInt(uniform.isActive(shaderType));
+ }
+ }
+
+ stream.writeInt(mState.getUniformLocations().size());
+ for (const auto &variable : mState.getUniformLocations())
+ {
+ stream.writeInt(variable.arrayIndex);
+ stream.writeIntOrNegOne(variable.index);
+ stream.writeInt(variable.ignored);
+ }
+
+ stream.writeInt(mState.getUniformBlocks().size());
+ for (const InterfaceBlock &uniformBlock : mState.getUniformBlocks())
+ {
+ WriteInterfaceBlock(&stream, uniformBlock);
+ }
+
+ stream.writeInt(mState.getBufferVariables().size());
+ for (const BufferVariable &bufferVariable : mState.getBufferVariables())
+ {
+ WriteBufferVariable(&stream, bufferVariable);
+ }
+
+ stream.writeInt(mState.getShaderStorageBlocks().size());
+ for (const InterfaceBlock &shaderStorageBlock : mState.getShaderStorageBlocks())
+ {
+ WriteInterfaceBlock(&stream, shaderStorageBlock);
+ }
+
+ stream.writeInt(mState.mAtomicCounterBuffers.size());
+ for (const auto &atomicCounterBuffer : mState.mAtomicCounterBuffers)
+ {
+ WriteShaderVariableBuffer(&stream, atomicCounterBuffer);
+ }
+
+ // Warn the app layer if saving a binary with unsupported transform feedback.
+ if (!mState.getLinkedTransformFeedbackVaryings().empty() &&
+ context->getFrontendFeatures().disableProgramCachingForTransformFeedback.enabled)
+ {
+ WARN() << "Saving program binary with transform feedback, which is not supported on this "
+ "driver.";
+ }
+
+ stream.writeInt(mState.getLinkedTransformFeedbackVaryings().size());
+ for (const auto &var : mState.getLinkedTransformFeedbackVaryings())
+ {
+ stream.writeIntVector(var.arraySizes);
+ stream.writeInt(var.type);
+ stream.writeString(var.name);
+
+ stream.writeIntOrNegOne(var.arrayIndex);
+ }
+
+ stream.writeInt(mState.getTransformFeedbackBufferMode());
+
+ stream.writeInt(mState.getOutputVariables().size());
+ for (const sh::OutputVariable &output : mState.getOutputVariables())
+ {
+ WriteShaderVar(&stream, output);
+ stream.writeInt(output.location);
+ stream.writeInt(output.index);
+ }
+
+ stream.writeInt(mState.getOutputLocations().size());
+ for (const auto &outputVar : mState.getOutputLocations())
+ {
+ stream.writeInt(outputVar.arrayIndex);
+ stream.writeIntOrNegOne(outputVar.index);
+ stream.writeInt(outputVar.ignored);
+ }
+
+ stream.writeInt(mState.getSecondaryOutputLocations().size());
+ for (const auto &outputVar : mState.getSecondaryOutputLocations())
+ {
+ stream.writeInt(outputVar.arrayIndex);
+ stream.writeIntOrNegOne(outputVar.index);
+ stream.writeInt(outputVar.ignored);
+ }
+
+ stream.writeInt(mState.mOutputVariableTypes.size());
+ for (const auto &outputVariableType : mState.mOutputVariableTypes)
+ {
+ stream.writeInt(outputVariableType);
+ }
+
+ static_assert(
+ IMPLEMENTATION_MAX_DRAW_BUFFERS * 2 <= 8 * sizeof(uint32_t),
+ "All bits of mDrawBufferTypeMask and mActiveOutputVariables can be contained in 32 bits");
+ stream.writeInt(static_cast<int>(mState.mDrawBufferTypeMask.to_ulong()));
+ stream.writeInt(static_cast<int>(mState.mActiveOutputVariables.to_ulong()));
+
+ stream.writeInt(mState.getSamplerUniformRange().low());
+ stream.writeInt(mState.getSamplerUniformRange().high());
+
+ stream.writeInt(mState.getSamplerBindings().size());
+ for (const auto &samplerBinding : mState.getSamplerBindings())
+ {
+ stream.writeEnum(samplerBinding.textureType);
+ stream.writeEnum(samplerBinding.format);
+ stream.writeInt(samplerBinding.boundTextureUnits.size());
+ stream.writeInt(samplerBinding.unreferenced);
+ }
+
+ stream.writeInt(mState.getImageUniformRange().low());
+ stream.writeInt(mState.getImageUniformRange().high());
+
+ stream.writeInt(mState.getImageBindings().size());
+ for (const auto &imageBinding : mState.getImageBindings())
+ {
+ stream.writeInt(imageBinding.boundImageUnits.size());
+ for (size_t i = 0; i < imageBinding.boundImageUnits.size(); ++i)
+ {
+ stream.writeInt(imageBinding.boundImageUnits[i]);
+ }
+ }
+
+ stream.writeInt(mState.getAtomicCounterUniformRange().low());
+ stream.writeInt(mState.getAtomicCounterUniformRange().high());
+
+ stream.writeInt(mState.getLinkedShaderStages().to_ulong());
+
+ mProgram->save(context, &stream);
+
+ ASSERT(binaryOut);
+ binaryOut->resize(stream.length());
+ memcpy(binaryOut->data(), stream.data(), stream.length());
+}
+
+angle::Result Program::deserialize(const Context *context,
+ BinaryInputStream &stream,
+ InfoLog &infoLog)
+{
+ unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
+ stream.readBytes(commitString, ANGLE_COMMIT_HASH_SIZE);
+ if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) !=
+ 0)
+ {
+ infoLog << "Invalid program binary version.";
+ return angle::Result::Incomplete;
+ }
+
+ int majorVersion = stream.readInt<int>();
+ int minorVersion = stream.readInt<int>();
+ if (majorVersion != context->getClientMajorVersion() ||
+ minorVersion != context->getClientMinorVersion())
+ {
+ infoLog << "Cannot load program binaries across different ES context versions.";
+ return angle::Result::Incomplete;
+ }
+
+ mState.mComputeShaderLocalSize[0] = stream.readInt<int>();
+ mState.mComputeShaderLocalSize[1] = stream.readInt<int>();
+ mState.mComputeShaderLocalSize[2] = stream.readInt<int>();
+
+ mState.mGeometryShaderInputPrimitiveType = stream.readEnum<PrimitiveMode>();
+ mState.mGeometryShaderOutputPrimitiveType = stream.readEnum<PrimitiveMode>();
+ mState.mGeometryShaderInvocations = stream.readInt<int>();
+ mState.mGeometryShaderMaxVertices = stream.readInt<int>();
+
+ mState.mNumViews = stream.readInt<int>();
+
+ mState.mMaxActiveAttribLocation = stream.readInt<unsigned int>();
+
+ static_assert(MAX_VERTEX_ATTRIBS * 2 <= sizeof(uint32_t) * 8,
+ "All bits of mAttributesTypeMask types and mask fit into 32 bits each");
+ mState.mAttributesTypeMask = gl::ComponentTypeMask(stream.readInt<uint32_t>());
+ mState.mAttributesMask = stream.readInt<gl::AttributesMask>();
+
+ static_assert(MAX_VERTEX_ATTRIBS <= sizeof(unsigned long) * 8,
+ "Too many vertex attribs for mask");
+ mState.mActiveAttribLocationsMask = stream.readInt<gl::AttributesMask>();
+
+ unsigned int attribCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mAttributes.empty());
+ for (unsigned int attribIndex = 0; attribIndex < attribCount; ++attribIndex)
+ {
+ sh::Attribute attrib;
+ LoadShaderVar(&stream, &attrib);
+ attrib.location = stream.readInt<int>();
+ mState.mAttributes.push_back(attrib);
+ }
+
+ unsigned int uniformCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mUniforms.empty());
+ for (unsigned int uniformIndex = 0; uniformIndex < uniformCount; ++uniformIndex)
+ {
+ LinkedUniform uniform;
+ LoadShaderVar(&stream, &uniform);
+
+ uniform.bufferIndex = stream.readInt<int>();
+ LoadBlockMemberInfo(&stream, &uniform.blockInfo);
+
+ uniform.typeInfo = &GetUniformTypeInfo(uniform.type);
+
+ // Active shader info
+ for (ShaderType shaderType : gl::AllShaderTypes())
+ {
+ uniform.setActive(shaderType, stream.readBool());
+ }
+
+ mState.mUniforms.push_back(uniform);
+ }
+
+ const unsigned int uniformIndexCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mUniformLocations.empty());
+ for (unsigned int uniformIndexIndex = 0; uniformIndexIndex < uniformIndexCount;
+ uniformIndexIndex++)
+ {
+ VariableLocation variable;
+ stream.readInt(&variable.arrayIndex);
+ stream.readInt(&variable.index);
+ stream.readBool(&variable.ignored);
+
+ mState.mUniformLocations.push_back(variable);
+ }
+
+ unsigned int uniformBlockCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mUniformBlocks.empty());
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < uniformBlockCount;
+ ++uniformBlockIndex)
+ {
+ InterfaceBlock uniformBlock;
+ LoadInterfaceBlock(&stream, &uniformBlock);
+ mState.mUniformBlocks.push_back(uniformBlock);
+
+ mState.mActiveUniformBlockBindings.set(uniformBlockIndex, uniformBlock.binding != 0);
+ }
+
+ unsigned int bufferVariableCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mBufferVariables.empty());
+ for (unsigned int index = 0; index < bufferVariableCount; ++index)
+ {
+ BufferVariable bufferVariable;
+ LoadBufferVariable(&stream, &bufferVariable);
+ mState.mBufferVariables.push_back(bufferVariable);
+ }
+
+ unsigned int shaderStorageBlockCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mShaderStorageBlocks.empty());
+ for (unsigned int shaderStorageBlockIndex = 0;
+ shaderStorageBlockIndex < shaderStorageBlockCount; ++shaderStorageBlockIndex)
+ {
+ InterfaceBlock shaderStorageBlock;
+ LoadInterfaceBlock(&stream, &shaderStorageBlock);
+ mState.mShaderStorageBlocks.push_back(shaderStorageBlock);
+ }
+
+ unsigned int atomicCounterBufferCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mAtomicCounterBuffers.empty());
+ for (unsigned int bufferIndex = 0; bufferIndex < atomicCounterBufferCount; ++bufferIndex)
+ {
+ AtomicCounterBuffer atomicCounterBuffer;
+ LoadShaderVariableBuffer(&stream, &atomicCounterBuffer);
+
+ mState.mAtomicCounterBuffers.push_back(atomicCounterBuffer);
+ }
+
+ unsigned int transformFeedbackVaryingCount = stream.readInt<unsigned int>();
+
+ // Reject programs that use transform feedback varyings if the hardware cannot support them.
+ if (transformFeedbackVaryingCount > 0 &&
+ context->getFrontendFeatures().disableProgramCachingForTransformFeedback.enabled)
+ {
+ infoLog << "Current driver does not support transform feedback in binary programs.";
+ return angle::Result::Incomplete;
+ }
+
+ ASSERT(mState.mLinkedTransformFeedbackVaryings.empty());
+ for (unsigned int transformFeedbackVaryingIndex = 0;
+ transformFeedbackVaryingIndex < transformFeedbackVaryingCount;
+ ++transformFeedbackVaryingIndex)
+ {
+ sh::Varying varying;
+ stream.readIntVector<unsigned int>(&varying.arraySizes);
+ stream.readInt(&varying.type);
+ stream.readString(&varying.name);
+
+ GLuint arrayIndex = stream.readInt<GLuint>();
+
+ mState.mLinkedTransformFeedbackVaryings.emplace_back(varying, arrayIndex);
+ }
+
+ stream.readInt(&mState.mTransformFeedbackBufferMode);
+
+ unsigned int outputCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mOutputVariables.empty());
+ for (unsigned int outputIndex = 0; outputIndex < outputCount; ++outputIndex)
+ {
+ sh::OutputVariable output;
+ LoadShaderVar(&stream, &output);
+ output.location = stream.readInt<int>();
+ output.index = stream.readInt<int>();
+ mState.mOutputVariables.push_back(output);
+ }
+
+ unsigned int outputVarCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mOutputLocations.empty());
+ for (unsigned int outputIndex = 0; outputIndex < outputVarCount; ++outputIndex)
+ {
+ VariableLocation locationData;
+ stream.readInt(&locationData.arrayIndex);
+ stream.readInt(&locationData.index);
+ stream.readBool(&locationData.ignored);
+ mState.mOutputLocations.push_back(locationData);
+ }
+
+ unsigned int secondaryOutputVarCount = stream.readInt<unsigned int>();
+ ASSERT(mState.mSecondaryOutputLocations.empty());
+ for (unsigned int outputIndex = 0; outputIndex < secondaryOutputVarCount; ++outputIndex)
+ {
+ VariableLocation locationData;
+ stream.readInt(&locationData.arrayIndex);
+ stream.readInt(&locationData.index);
+ stream.readBool(&locationData.ignored);
+ mState.mSecondaryOutputLocations.push_back(locationData);
+ }
+
+ unsigned int outputTypeCount = stream.readInt<unsigned int>();
+ for (unsigned int outputIndex = 0; outputIndex < outputTypeCount; ++outputIndex)
+ {
+ mState.mOutputVariableTypes.push_back(stream.readInt<GLenum>());
+ }
+
+ static_assert(IMPLEMENTATION_MAX_DRAW_BUFFERS * 2 <= 8 * sizeof(uint32_t),
+ "All bits of mDrawBufferTypeMask and mActiveOutputVariables types and mask fit "
+ "into 32 bits each");
+ mState.mDrawBufferTypeMask = gl::ComponentTypeMask(stream.readInt<uint32_t>());
+ mState.mActiveOutputVariables = stream.readInt<gl::DrawBufferMask>();
+
+ unsigned int samplerRangeLow = stream.readInt<unsigned int>();
+ unsigned int samplerRangeHigh = stream.readInt<unsigned int>();
+ mState.mSamplerUniformRange = RangeUI(samplerRangeLow, samplerRangeHigh);
+ unsigned int samplerCount = stream.readInt<unsigned int>();
+ for (unsigned int samplerIndex = 0; samplerIndex < samplerCount; ++samplerIndex)
+ {
+ TextureType textureType = stream.readEnum<TextureType>();
+ SamplerFormat format = stream.readEnum<SamplerFormat>();
+ size_t bindingCount = stream.readInt<size_t>();
+ bool unreferenced = stream.readBool();
+ mState.mSamplerBindings.emplace_back(textureType, format, bindingCount, unreferenced);
+ }
+
+ unsigned int imageRangeLow = stream.readInt<unsigned int>();
+ unsigned int imageRangeHigh = stream.readInt<unsigned int>();
+ mState.mImageUniformRange = RangeUI(imageRangeLow, imageRangeHigh);
+ unsigned int imageBindingCount = stream.readInt<unsigned int>();
+ for (unsigned int imageIndex = 0; imageIndex < imageBindingCount; ++imageIndex)
+ {
+ unsigned int elementCount = stream.readInt<unsigned int>();
+ ImageBinding imageBinding(elementCount);
+ for (unsigned int i = 0; i < elementCount; ++i)
+ {
+ imageBinding.boundImageUnits[i] = stream.readInt<unsigned int>();
+ }
+ mState.mImageBindings.emplace_back(imageBinding);
+ }
+
+ unsigned int atomicCounterRangeLow = stream.readInt<unsigned int>();
+ unsigned int atomicCounterRangeHigh = stream.readInt<unsigned int>();
+ mState.mAtomicCounterUniformRange = RangeUI(atomicCounterRangeLow, atomicCounterRangeHigh);
+
+ static_assert(static_cast<unsigned long>(ShaderType::EnumCount) <= sizeof(unsigned long) * 8,
+ "Too many shader types");
+ mState.mLinkedShaderStages = ShaderBitSet(stream.readInt<uint8_t>());
+
+ if (!mState.mAttachedShaders[ShaderType::Compute])
+ {
+ mState.updateTransformFeedbackStrides();
+ }
+
+ postResolveLink(context);
+
+ return angle::Result::Continue;
+}
+
+void Program::postResolveLink(const gl::Context *context)
+{
+ mState.updateActiveSamplers();
+ mState.updateActiveImages();
+
+ if (context->getExtensions().multiDraw)
+ {
+ mState.mDrawIDLocation = getUniformLocation("gl_DrawID");
+ }
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Program.h b/gfx/angle/checkout/src/libANGLE/Program.h
new file mode 100644
index 0000000000..c1191f2159
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Program.h
@@ -0,0 +1,1070 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Program.h: Defines the gl::Program class. Implements GL program objects
+// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
+
+#ifndef LIBANGLE_PROGRAM_H_
+#define LIBANGLE_PROGRAM_H_
+
+#include <GLES2/gl2.h>
+#include <GLSLANG/ShaderVars.h>
+
+#include <array>
+#include <map>
+#include <set>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "common/Optional.h"
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+#include "libANGLE/Constants.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/Uniform.h"
+#include "libANGLE/angletypes.h"
+
+namespace rx
+{
+class GLImplFactory;
+class ProgramImpl;
+struct TranslatedAttribute;
+} // namespace rx
+
+namespace gl
+{
+class Buffer;
+class BinaryInputStream;
+class BinaryOutputStream;
+struct Caps;
+class Context;
+struct Extensions;
+class Framebuffer;
+class InfoLog;
+class Shader;
+class ShaderProgramManager;
+class State;
+struct UnusedUniform;
+struct Version;
+
+extern const char *const g_fakepath;
+
+enum class LinkMismatchError
+{
+ // Shared
+ NO_MISMATCH,
+ TYPE_MISMATCH,
+ ARRAY_SIZE_MISMATCH,
+ PRECISION_MISMATCH,
+ STRUCT_NAME_MISMATCH,
+ FIELD_NUMBER_MISMATCH,
+ FIELD_NAME_MISMATCH,
+
+ // Varying specific
+ INTERPOLATION_TYPE_MISMATCH,
+ INVARIANCE_MISMATCH,
+
+ // Uniform specific
+ BINDING_MISMATCH,
+ LOCATION_MISMATCH,
+ OFFSET_MISMATCH,
+ INSTANCE_NAME_MISMATCH,
+
+ // Interface block specific
+ LAYOUT_QUALIFIER_MISMATCH,
+ MATRIX_PACKING_MISMATCH
+};
+
+class InfoLog : angle::NonCopyable
+{
+ public:
+ InfoLog();
+ ~InfoLog();
+
+ size_t getLength() const;
+ void getLog(GLsizei bufSize, GLsizei *length, char *infoLog) const;
+
+ void appendSanitized(const char *message);
+ void reset();
+
+ // This helper class ensures we append a newline after writing a line.
+ class StreamHelper : angle::NonCopyable
+ {
+ public:
+ StreamHelper(StreamHelper &&rhs) : mStream(rhs.mStream) { rhs.mStream = nullptr; }
+
+ StreamHelper &operator=(StreamHelper &&rhs)
+ {
+ std::swap(mStream, rhs.mStream);
+ return *this;
+ }
+
+ ~StreamHelper()
+ {
+ // Write newline when destroyed on the stack
+ if (mStream)
+ {
+ (*mStream) << std::endl;
+ }
+ }
+
+ template <typename T>
+ StreamHelper &operator<<(const T &value)
+ {
+ (*mStream) << value;
+ return *this;
+ }
+
+ private:
+ friend class InfoLog;
+
+ StreamHelper(std::stringstream *stream) : mStream(stream) { ASSERT(stream); }
+
+ std::stringstream *mStream;
+ };
+
+ template <typename T>
+ StreamHelper operator<<(const T &value)
+ {
+ ensureInitialized();
+ StreamHelper helper(mLazyStream.get());
+ helper << value;
+ return helper;
+ }
+
+ std::string str() const { return mLazyStream ? mLazyStream->str() : ""; }
+
+ bool empty() const;
+
+ private:
+ void ensureInitialized()
+ {
+ if (!mLazyStream)
+ {
+ mLazyStream.reset(new std::stringstream());
+ }
+ }
+
+ std::unique_ptr<std::stringstream> mLazyStream;
+};
+
+void LogLinkMismatch(InfoLog &infoLog,
+ const std::string &variableName,
+ const char *variableType,
+ LinkMismatchError linkError,
+ const std::string &mismatchedStructOrBlockFieldName,
+ ShaderType shaderType1,
+ ShaderType shaderType2);
+
+bool IsActiveInterfaceBlock(const sh::InterfaceBlock &interfaceBlock);
+
+void WriteBlockMemberInfo(BinaryOutputStream *stream, const sh::BlockMemberInfo &var);
+void LoadBlockMemberInfo(BinaryInputStream *stream, sh::BlockMemberInfo *var);
+
+// Struct used for correlating uniforms/elements of uniform arrays to handles
+struct VariableLocation
+{
+ static constexpr unsigned int kUnused = GL_INVALID_INDEX;
+
+ VariableLocation();
+ VariableLocation(unsigned int arrayIndex, unsigned int index);
+
+ // If used is false, it means this location is only used to fill an empty space in an array,
+ // and there is no corresponding uniform variable for this location. It can also mean the
+ // uniform was optimized out by the implementation.
+ bool used() const { return (index != kUnused); }
+ void markUnused() { index = kUnused; }
+ void markIgnored() { ignored = true; }
+
+ bool operator==(const VariableLocation &other) const
+ {
+ return arrayIndex == other.arrayIndex && index == other.index;
+ }
+
+ // "arrayIndex" stores the index of the innermost GLSL array. It's zero for non-arrays.
+ unsigned int arrayIndex;
+ // "index" is an index of the variable. The variable contains the indices for other than the
+ // innermost GLSL arrays.
+ unsigned int index;
+
+ // If this location was bound to an unreferenced uniform. Setting data on this uniform is a
+ // no-op.
+ bool ignored;
+};
+
+// Information about a variable binding.
+// Currently used by CHROMIUM_path_rendering
+struct BindingInfo
+{
+ // The type of binding, for example GL_FLOAT_VEC3.
+ // This can be GL_NONE if the variable is optimized away.
+ GLenum type;
+
+ // This is the name of the variable in
+ // the translated shader program. Note that
+ // this can be empty in the case where the
+ // variable has been optimized away.
+ std::string name;
+
+ // True if the binding is valid, otherwise false.
+ bool valid;
+};
+
+// This small structure encapsulates binding sampler uniforms to active GL textures.
+struct SamplerBinding
+{
+ SamplerBinding(TextureType textureTypeIn,
+ SamplerFormat formatIn,
+ size_t elementCount,
+ bool unreferenced);
+ SamplerBinding(const SamplerBinding &other);
+ ~SamplerBinding();
+
+ // Necessary for retrieving active textures from the GL state.
+ TextureType textureType;
+
+ SamplerFormat format;
+
+ // List of all textures bound to this sampler, of type textureType.
+ std::vector<GLuint> boundTextureUnits;
+
+ // A note if this sampler is an unreferenced uniform.
+ bool unreferenced;
+};
+
+// A varying with tranform feedback enabled. If it's an array, either the whole array or one of its
+// elements specified by 'arrayIndex' can set to be enabled.
+struct TransformFeedbackVarying : public sh::Varying
+{
+ TransformFeedbackVarying(const sh::Varying &varyingIn, GLuint index)
+ : sh::Varying(varyingIn), arrayIndex(index)
+ {
+ ASSERT(!isArrayOfArrays());
+ }
+
+ TransformFeedbackVarying(const sh::ShaderVariable &field, const sh::Varying &parent)
+ : arrayIndex(GL_INVALID_INDEX)
+ {
+ sh::ShaderVariable *thisVar = this;
+ *thisVar = field;
+ interpolation = parent.interpolation;
+ isInvariant = parent.isInvariant;
+ name = parent.name + "." + name;
+ mappedName = parent.mappedName + "." + mappedName;
+ }
+
+ std::string nameWithArrayIndex() const
+ {
+ std::stringstream fullNameStr;
+ fullNameStr << name;
+ if (arrayIndex != GL_INVALID_INDEX)
+ {
+ fullNameStr << "[" << arrayIndex << "]";
+ }
+ return fullNameStr.str();
+ }
+ GLsizei size() const
+ {
+ return (isArray() && arrayIndex == GL_INVALID_INDEX ? getOutermostArraySize() : 1);
+ }
+
+ GLuint arrayIndex;
+};
+
+struct ImageBinding
+{
+ ImageBinding(size_t count);
+ ImageBinding(GLuint imageUnit, size_t count, bool unreferenced);
+ ImageBinding(const ImageBinding &other);
+ ~ImageBinding();
+
+ std::vector<GLuint> boundImageUnits;
+
+ // A note if this image unit is an unreferenced uniform.
+ bool unreferenced;
+};
+
+class ProgramState final : angle::NonCopyable
+{
+ public:
+ ProgramState();
+ ~ProgramState();
+
+ const std::string &getLabel();
+
+ Shader *getAttachedShader(ShaderType shaderType) const;
+ const gl::ShaderMap<Shader *> &getAttachedShaders() const { return mAttachedShaders; }
+ const std::vector<std::string> &getTransformFeedbackVaryingNames() const
+ {
+ return mTransformFeedbackVaryingNames;
+ }
+ GLint getTransformFeedbackBufferMode() const { return mTransformFeedbackBufferMode; }
+ GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const
+ {
+ ASSERT(uniformBlockIndex < mUniformBlocks.size());
+ return mUniformBlocks[uniformBlockIndex].binding;
+ }
+ GLuint getShaderStorageBlockBinding(GLuint blockIndex) const
+ {
+ ASSERT(blockIndex < mShaderStorageBlocks.size());
+ return mShaderStorageBlocks[blockIndex].binding;
+ }
+ const UniformBlockBindingMask &getActiveUniformBlockBindingsMask() const
+ {
+ return mActiveUniformBlockBindings;
+ }
+ const std::vector<sh::Attribute> &getAttributes() const { return mAttributes; }
+ const AttributesMask &getActiveAttribLocationsMask() const
+ {
+ return mActiveAttribLocationsMask;
+ }
+ const AttributesMask &getNonBuiltinAttribLocationsMask() const { return mAttributesMask; }
+ unsigned int getMaxActiveAttribLocation() const { return mMaxActiveAttribLocation; }
+ DrawBufferMask getActiveOutputVariables() const { return mActiveOutputVariables; }
+ const std::vector<sh::OutputVariable> &getOutputVariables() const { return mOutputVariables; }
+ const std::vector<VariableLocation> &getOutputLocations() const { return mOutputLocations; }
+ const std::vector<VariableLocation> &getSecondaryOutputLocations() const
+ {
+ return mSecondaryOutputLocations;
+ }
+ const std::vector<LinkedUniform> &getUniforms() const { return mUniforms; }
+ const std::vector<VariableLocation> &getUniformLocations() const { return mUniformLocations; }
+ const std::vector<InterfaceBlock> &getUniformBlocks() const { return mUniformBlocks; }
+ const std::vector<InterfaceBlock> &getShaderStorageBlocks() const
+ {
+ return mShaderStorageBlocks;
+ }
+ const std::vector<BufferVariable> &getBufferVariables() const { return mBufferVariables; }
+ const std::vector<SamplerBinding> &getSamplerBindings() const { return mSamplerBindings; }
+ const std::vector<ImageBinding> &getImageBindings() const { return mImageBindings; }
+ const sh::WorkGroupSize &getComputeShaderLocalSize() const { return mComputeShaderLocalSize; }
+ const RangeUI &getSamplerUniformRange() const { return mSamplerUniformRange; }
+ const RangeUI &getImageUniformRange() const { return mImageUniformRange; }
+ const RangeUI &getAtomicCounterUniformRange() const { return mAtomicCounterUniformRange; }
+ const ComponentTypeMask &getAttributesTypeMask() const { return mAttributesTypeMask; }
+
+ const std::vector<TransformFeedbackVarying> &getLinkedTransformFeedbackVaryings() const
+ {
+ return mLinkedTransformFeedbackVaryings;
+ }
+ const std::vector<GLsizei> &getTransformFeedbackStrides() const
+ {
+ return mTransformFeedbackStrides;
+ }
+ size_t getTransformFeedbackBufferCount() const { return mTransformFeedbackStrides.size(); }
+ const std::vector<AtomicCounterBuffer> &getAtomicCounterBuffers() const
+ {
+ return mAtomicCounterBuffers;
+ }
+
+ // Count the number of uniform and storage buffer declarations, counting arrays as one.
+ size_t getUniqueUniformBlockCount() const;
+ size_t getUniqueStorageBlockCount() const;
+
+ GLuint getUniformIndexFromName(const std::string &name) const;
+ GLuint getUniformIndexFromLocation(GLint location) const;
+ Optional<GLuint> getSamplerIndex(GLint location) const;
+ bool isSamplerUniformIndex(GLuint index) const;
+ GLuint getSamplerIndexFromUniformIndex(GLuint uniformIndex) const;
+ GLuint getUniformIndexFromSamplerIndex(GLuint samplerIndex) const;
+ bool isImageUniformIndex(GLuint index) const;
+ GLuint getImageIndexFromUniformIndex(GLuint uniformIndex) const;
+ GLuint getUniformIndexFromImageIndex(GLuint imageIndex) const;
+ GLuint getAttributeLocation(const std::string &name) const;
+
+ GLuint getBufferVariableIndexFromName(const std::string &name) const;
+
+ int getNumViews() const { return mNumViews; }
+ bool usesMultiview() const { return mNumViews != -1; }
+
+ const ShaderBitSet &getLinkedShaderStages() const { return mLinkedShaderStages; }
+ bool hasLinkedShaderStage(ShaderType shaderType) const
+ {
+ return mLinkedShaderStages[shaderType];
+ }
+ size_t getLinkedShaderStageCount() const { return mLinkedShaderStages.count(); }
+ bool isCompute() const { return hasLinkedShaderStage(ShaderType::Compute); }
+
+ bool hasAttachedShader() const;
+
+ const ActiveTextureMask &getActiveSamplersMask() const { return mActiveSamplersMask; }
+ SamplerFormat getSamplerFormatForTextureUnitIndex(size_t textureUnitIndex) const
+ {
+ return mActiveSamplerFormats[textureUnitIndex];
+ }
+
+ private:
+ friend class MemoryProgramCache;
+ friend class Program;
+
+ void updateTransformFeedbackStrides();
+ void updateActiveSamplers();
+ void updateActiveImages();
+
+ // Scans the sampler bindings for type conflicts with sampler 'textureUnitIndex'.
+ void setSamplerUniformTextureTypeAndFormat(size_t textureUnitIndex);
+
+ std::string mLabel;
+
+ sh::WorkGroupSize mComputeShaderLocalSize;
+
+ ShaderMap<Shader *> mAttachedShaders;
+
+ std::vector<std::string> mTransformFeedbackVaryingNames;
+ std::vector<TransformFeedbackVarying> mLinkedTransformFeedbackVaryings;
+ GLenum mTransformFeedbackBufferMode;
+
+ // For faster iteration on the blocks currently being bound.
+ UniformBlockBindingMask mActiveUniformBlockBindings;
+
+ std::vector<sh::Attribute> mAttributes;
+ angle::BitSet<MAX_VERTEX_ATTRIBS> mActiveAttribLocationsMask;
+ unsigned int mMaxActiveAttribLocation;
+ ComponentTypeMask mAttributesTypeMask;
+ // mAttributesMask is identical to mActiveAttribLocationsMask with built-in attributes removed.
+ AttributesMask mAttributesMask;
+
+ // Uniforms are sorted in order:
+ // 1. Non-opaque uniforms
+ // 2. Sampler uniforms
+ // 3. Image uniforms
+ // 4. Atomic counter uniforms
+ // 5. Uniform block uniforms
+ // This makes opaque uniform validation easier, since we don't need a separate list.
+ // For generating the entries and naming them we follow the spec: GLES 3.1 November 2016 section
+ // 7.3.1.1 Naming Active Resources. There's a separate entry for each struct member and each
+ // inner array of an array of arrays. Names and mapped names of uniforms that are arrays include
+ // [0] in the end. This makes implementation of queries simpler.
+ std::vector<LinkedUniform> mUniforms;
+
+ std::vector<VariableLocation> mUniformLocations;
+ std::vector<InterfaceBlock> mUniformBlocks;
+ std::vector<BufferVariable> mBufferVariables;
+ std::vector<InterfaceBlock> mShaderStorageBlocks;
+ std::vector<AtomicCounterBuffer> mAtomicCounterBuffers;
+ RangeUI mSamplerUniformRange;
+ RangeUI mImageUniformRange;
+ RangeUI mAtomicCounterUniformRange;
+
+ // An array of the samplers that are used by the program
+ std::vector<SamplerBinding> mSamplerBindings;
+
+ // An array of the images that are used by the program
+ std::vector<ImageBinding> mImageBindings;
+
+ // Names and mapped names of output variables that are arrays include [0] in the end, similarly
+ // to uniforms.
+ std::vector<sh::OutputVariable> mOutputVariables;
+ std::vector<VariableLocation> mOutputLocations;
+
+ // EXT_blend_func_extended secondary outputs (ones with index 1) in ESSL 3.00 shaders.
+ std::vector<VariableLocation> mSecondaryOutputLocations;
+
+ DrawBufferMask mActiveOutputVariables;
+
+ // Fragment output variable base types: FLOAT, INT, or UINT. Ordered by location.
+ std::vector<GLenum> mOutputVariableTypes;
+ ComponentTypeMask mDrawBufferTypeMask;
+
+ bool mBinaryRetrieveableHint;
+ bool mSeparable;
+ ShaderBitSet mLinkedShaderStages;
+
+ // ANGLE_multiview.
+ int mNumViews;
+
+ // GL_EXT_geometry_shader.
+ PrimitiveMode mGeometryShaderInputPrimitiveType;
+ PrimitiveMode mGeometryShaderOutputPrimitiveType;
+ int mGeometryShaderInvocations;
+ int mGeometryShaderMaxVertices;
+
+ // GL_ANGLE_multi_draw
+ int mDrawIDLocation;
+
+ // The size of the data written to each transform feedback buffer per vertex.
+ std::vector<GLsizei> mTransformFeedbackStrides;
+
+ // Cached mask of active samplers and sampler types.
+ ActiveTextureMask mActiveSamplersMask;
+ ActiveTextureArray<uint32_t> mActiveSamplerRefCounts;
+ ActiveTextureArray<TextureType> mActiveSamplerTypes;
+ ActiveTextureArray<SamplerFormat> mActiveSamplerFormats;
+
+ // Cached mask of active images.
+ ActiveTextureMask mActiveImagesMask;
+};
+
+struct ProgramBinding
+{
+ ProgramBinding() : location(GL_INVALID_INDEX), aliased(false) {}
+ ProgramBinding(GLuint index) : location(index), aliased(false) {}
+
+ GLuint location;
+ // Whether another binding was set that may potentially alias this.
+ bool aliased;
+};
+
+class ProgramBindings final : angle::NonCopyable
+{
+ public:
+ ProgramBindings();
+ ~ProgramBindings();
+
+ void bindLocation(GLuint index, const std::string &name);
+ int getBindingByName(const std::string &name) const;
+ int getBinding(const sh::VariableWithLocation &variable) const;
+
+ using const_iterator = std::unordered_map<std::string, ProgramBinding>::const_iterator;
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ private:
+ std::unordered_map<std::string, ProgramBinding> mBindings;
+};
+
+struct ProgramVaryingRef
+{
+ const sh::Varying *get() const { return vertex ? vertex : fragment; }
+
+ const sh::Varying *vertex = nullptr;
+ const sh::Varying *fragment = nullptr;
+};
+
+using ProgramMergedVaryings = std::map<std::string, ProgramVaryingRef>;
+
+class Program final : angle::NonCopyable, public LabeledObject
+{
+ public:
+ Program(rx::GLImplFactory *factory, ShaderProgramManager *manager, GLuint handle);
+ void onDestroy(const Context *context);
+
+ GLuint id() const;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ ANGLE_INLINE rx::ProgramImpl *getImplementation() const
+ {
+ ASSERT(mLinkResolved);
+ return mProgram;
+ }
+
+ void attachShader(Shader *shader);
+ void detachShader(const Context *context, Shader *shader);
+ int getAttachedShadersCount() const;
+
+ const Shader *getAttachedShader(ShaderType shaderType) const;
+
+ void bindAttributeLocation(GLuint index, const char *name);
+ void bindUniformLocation(GLuint index, const char *name);
+
+ // CHROMIUM_path_rendering
+ BindingInfo getFragmentInputBindingInfo(GLint index) const;
+ void bindFragmentInputLocation(GLint index, const char *name);
+ void pathFragmentInputGen(GLint index, GLenum genMode, GLint components, const GLfloat *coeffs);
+
+ // EXT_blend_func_extended
+ void bindFragmentOutputLocation(GLuint index, const char *name);
+ void bindFragmentOutputIndex(GLuint index, const char *name);
+
+ // KHR_parallel_shader_compile
+ // Try to link the program asynchrously. As a result, background threads may be launched to
+ // execute the linking tasks concurrently.
+ angle::Result link(const Context *context);
+
+ // Peek whether there is any running linking tasks.
+ bool isLinking() const;
+
+ bool isLinked() const
+ {
+ ASSERT(mLinkResolved);
+ return mLinked;
+ }
+
+ bool hasLinkedShaderStage(ShaderType shaderType) const
+ {
+ ASSERT(shaderType != ShaderType::InvalidEnum);
+ return mState.hasLinkedShaderStage(shaderType);
+ }
+ bool isCompute() const { return mState.isCompute(); }
+
+ angle::Result loadBinary(const Context *context,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length);
+ angle::Result saveBinary(Context *context,
+ GLenum *binaryFormat,
+ void *binary,
+ GLsizei bufSize,
+ GLsizei *length) const;
+ GLint getBinaryLength(Context *context) const;
+ void setBinaryRetrievableHint(bool retrievable);
+ bool getBinaryRetrievableHint() const;
+
+ void setSeparable(bool separable);
+ bool isSeparable() const;
+
+ int getInfoLogLength() const;
+ void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const;
+ void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders) const;
+
+ GLuint getAttributeLocation(const std::string &name) const;
+ bool isAttribLocationActive(size_t attribLocation) const;
+
+ void getActiveAttribute(GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name) const;
+ GLint getActiveAttributeCount() const;
+ GLint getActiveAttributeMaxLength() const;
+ const std::vector<sh::Attribute> &getAttributes() const;
+
+ GLint getFragDataLocation(const std::string &name) const;
+ size_t getOutputResourceCount() const;
+ const std::vector<GLenum> &getOutputVariableTypes() const;
+ DrawBufferMask getActiveOutputVariables() const
+ {
+ ASSERT(mLinkResolved);
+ return mState.mActiveOutputVariables;
+ }
+
+ // EXT_blend_func_extended
+ GLint getFragDataIndex(const std::string &name) const;
+
+ void getActiveUniform(GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name) const;
+ GLint getActiveUniformCount() const;
+ size_t getActiveBufferVariableCount() const;
+ GLint getActiveUniformMaxLength() const;
+ bool isValidUniformLocation(GLint location) const;
+ const LinkedUniform &getUniformByLocation(GLint location) const;
+ const VariableLocation &getUniformLocation(GLint location) const;
+
+ const std::vector<VariableLocation> &getUniformLocations() const
+ {
+ ASSERT(mLinkResolved);
+ return mState.mUniformLocations;
+ }
+
+ const LinkedUniform &getUniformByIndex(GLuint index) const
+ {
+ ASSERT(mLinkResolved);
+ ASSERT(index < static_cast<size_t>(mState.mUniforms.size()));
+ return mState.mUniforms[index];
+ }
+
+ const BufferVariable &getBufferVariableByIndex(GLuint index) const;
+
+ enum SetUniformResult
+ {
+ SamplerChanged,
+ NoSamplerChange,
+ };
+
+ GLint getUniformLocation(const std::string &name) const;
+ GLuint getUniformIndex(const std::string &name) const;
+ void setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
+ void setUniform1iv(Context *context, GLint location, GLsizei count, const GLint *v);
+ void setUniform2iv(GLint location, GLsizei count, const GLint *v);
+ void setUniform3iv(GLint location, GLsizei count, const GLint *v);
+ void setUniform4iv(GLint location, GLsizei count, const GLint *v);
+ void setUniform1uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
+ void setUniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ void setUniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+ void getUniformfv(const Context *context, GLint location, GLfloat *params) const;
+ void getUniformiv(const Context *context, GLint location, GLint *params) const;
+ void getUniformuiv(const Context *context, GLint location, GLuint *params) const;
+
+ void getActiveUniformBlockName(const GLuint blockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *blockName) const;
+ void getActiveShaderStorageBlockName(const GLuint blockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *blockName) const;
+
+ ANGLE_INLINE GLuint getActiveUniformBlockCount() const
+ {
+ ASSERT(mLinkResolved);
+ return static_cast<GLuint>(mState.mUniformBlocks.size());
+ }
+
+ ANGLE_INLINE GLuint getActiveAtomicCounterBufferCount() const
+ {
+ ASSERT(mLinkResolved);
+ return static_cast<GLuint>(mState.mAtomicCounterBuffers.size());
+ }
+
+ ANGLE_INLINE GLuint getActiveShaderStorageBlockCount() const
+ {
+ ASSERT(mLinkResolved);
+ return static_cast<GLuint>(mState.mShaderStorageBlocks.size());
+ }
+
+ GLint getActiveUniformBlockMaxNameLength() const;
+ GLint getActiveShaderStorageBlockMaxNameLength() const;
+
+ GLuint getUniformBlockIndex(const std::string &name) const;
+ GLuint getShaderStorageBlockIndex(const std::string &name) const;
+
+ void bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+ GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const;
+ GLuint getShaderStorageBlockBinding(GLuint shaderStorageBlockIndex) const;
+
+ const InterfaceBlock &getUniformBlockByIndex(GLuint index) const;
+ const InterfaceBlock &getShaderStorageBlockByIndex(GLuint index) const;
+
+ void setTransformFeedbackVaryings(GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode);
+ void getTransformFeedbackVarying(GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name) const;
+ GLsizei getTransformFeedbackVaryingCount() const;
+ GLsizei getTransformFeedbackVaryingMaxLength() const;
+ GLenum getTransformFeedbackBufferMode() const;
+ GLuint getTransformFeedbackVaryingResourceIndex(const GLchar *name) const;
+ const TransformFeedbackVarying &getTransformFeedbackVaryingResource(GLuint index) const;
+
+ bool hasDrawIDUniform() const;
+ void setDrawIDUniform(GLint drawid);
+
+ ANGLE_INLINE void addRef()
+ {
+ ASSERT(mLinkResolved);
+ mRefCount++;
+ }
+
+ ANGLE_INLINE void release(const Context *context)
+ {
+ ASSERT(mLinkResolved);
+ mRefCount--;
+
+ if (mRefCount == 0 && mDeleteStatus)
+ {
+ deleteSelf(context);
+ }
+ }
+
+ unsigned int getRefCount() const;
+ bool isInUse() const { return getRefCount() != 0; }
+ void flagForDeletion();
+ bool isFlaggedForDeletion() const;
+
+ void validate(const Caps &caps);
+ bool validateSamplers(InfoLog *infoLog, const Caps &caps)
+ {
+ // Skip cache if we're using an infolog, so we get the full error.
+ // Also skip the cache if the sample mapping has changed, or if we haven't ever validated.
+ if (infoLog == nullptr && mCachedValidateSamplersResult.valid())
+ {
+ return mCachedValidateSamplersResult.value();
+ }
+
+ return validateSamplersImpl(infoLog, caps);
+ }
+
+ bool isValidated() const;
+
+ const AttributesMask &getActiveAttribLocationsMask() const
+ {
+ ASSERT(mLinkResolved);
+ return mState.mActiveAttribLocationsMask;
+ }
+
+ const std::vector<SamplerBinding> &getSamplerBindings() const;
+ const std::vector<ImageBinding> &getImageBindings() const
+ {
+ ASSERT(mLinkResolved);
+ return mState.mImageBindings;
+ }
+ const sh::WorkGroupSize &getComputeShaderLocalSize() const;
+ PrimitiveMode getGeometryShaderInputPrimitiveType() const;
+ PrimitiveMode getGeometryShaderOutputPrimitiveType() const;
+ GLint getGeometryShaderInvocations() const;
+ GLint getGeometryShaderMaxVertices() const;
+
+ const ProgramState &getState() const
+ {
+ ASSERT(mLinkResolved);
+ return mState;
+ }
+
+ static LinkMismatchError LinkValidateVariablesBase(
+ const sh::ShaderVariable &variable1,
+ const sh::ShaderVariable &variable2,
+ bool validatePrecision,
+ bool validateArraySize,
+ std::string *mismatchedStructOrBlockMemberName);
+
+ GLuint getInputResourceIndex(const GLchar *name) const;
+ GLuint getOutputResourceIndex(const GLchar *name) const;
+ void getInputResourceName(GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name) const;
+ void getOutputResourceName(GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name) const;
+ void getUniformResourceName(GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name) const;
+ void getBufferVariableResourceName(GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name) const;
+ const sh::Attribute &getInputResource(GLuint index) const;
+ const sh::OutputVariable &getOutputResource(GLuint index) const;
+
+ const ProgramBindings &getAttributeBindings() const;
+ const ProgramBindings &getUniformLocationBindings() const;
+ const ProgramBindings &getFragmentInputBindings() const;
+
+ int getNumViews() const
+ {
+ ASSERT(mLinkResolved);
+ return mState.getNumViews();
+ }
+
+ bool usesMultiview() const { return mState.usesMultiview(); }
+
+ ComponentTypeMask getDrawBufferTypeMask() const;
+ ComponentTypeMask getAttributesTypeMask() const;
+ AttributesMask getAttributesMask() const;
+
+ const std::vector<GLsizei> &getTransformFeedbackStrides() const;
+
+ const ActiveTextureMask &getActiveSamplersMask() const { return mState.mActiveSamplersMask; }
+ const ActiveTextureMask &getActiveImagesMask() const { return mState.mActiveImagesMask; }
+
+ const ActiveTextureArray<TextureType> &getActiveSamplerTypes() const
+ {
+ return mState.mActiveSamplerTypes;
+ }
+
+ // Program dirty bits.
+ enum DirtyBitType
+ {
+ DIRTY_BIT_UNIFORM_BLOCK_BINDING_0,
+ DIRTY_BIT_UNIFORM_BLOCK_BINDING_MAX =
+ DIRTY_BIT_UNIFORM_BLOCK_BINDING_0 + IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS,
+
+ DIRTY_BIT_COUNT = DIRTY_BIT_UNIFORM_BLOCK_BINDING_MAX,
+ };
+
+ using DirtyBits = angle::BitSet<DIRTY_BIT_COUNT>;
+
+ angle::Result syncState(const Context *context);
+
+ // Try to resolve linking. Inlined to make sure its overhead is as low as possible.
+ void resolveLink(const Context *context)
+ {
+ if (!mLinkResolved)
+ {
+ resolveLinkImpl(context);
+ }
+ }
+
+ ANGLE_INLINE bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
+
+ // Writes a program's binary to the output memory buffer.
+ void serialize(const Context *context, angle::MemoryBuffer *binaryOut) const;
+
+ private:
+ struct LinkingState;
+
+ ~Program() override;
+
+ // Loads program state according to the specified binary blob.
+ angle::Result deserialize(const Context *context, BinaryInputStream &stream, InfoLog &infoLog);
+
+ void unlink();
+ void deleteSelf(const Context *context);
+
+ bool linkValidateShaders(InfoLog &infoLog);
+ bool linkAttributes(const Context *context, InfoLog &infoLog);
+ bool linkInterfaceBlocks(const Caps &caps,
+ const Version &version,
+ bool webglCompatibility,
+ InfoLog &infoLog,
+ GLuint *combinedShaderStorageBlocksCount);
+ bool linkVaryings(InfoLog &infoLog) const;
+
+ bool linkUniforms(const Caps &caps,
+ InfoLog &infoLog,
+ const ProgramBindings &uniformLocationBindings,
+ GLuint *combinedImageUniformsCount,
+ std::vector<UnusedUniform> *unusedUniforms);
+ void linkSamplerAndImageBindings(GLuint *combinedImageUniformsCount);
+ bool linkAtomicCounterBuffers();
+
+ void updateLinkedShaderStages();
+
+ static LinkMismatchError LinkValidateVaryings(const sh::Varying &outputVarying,
+ const sh::Varying &inputVarying,
+ int shaderVersion,
+ bool validateGeometryShaderInputVarying,
+ std::string *mismatchedStructFieldName);
+
+ bool linkValidateShaderInterfaceMatching(Shader *generatingShader,
+ Shader *consumingShader,
+ InfoLog &infoLog) const;
+
+ // Check for aliased path rendering input bindings (if any).
+ // If more than one binding refer statically to the same location the link must fail.
+ bool linkValidateFragmentInputBindings(InfoLog &infoLog) const;
+
+ bool linkValidateBuiltInVaryings(InfoLog &infoLog) const;
+ bool linkValidateTransformFeedback(const Version &version,
+ InfoLog &infoLog,
+ const ProgramMergedVaryings &linkedVaryings,
+ const Caps &caps) const;
+ bool linkValidateGlobalNames(InfoLog &infoLog) const;
+
+ void gatherTransformFeedbackVaryings(const ProgramMergedVaryings &varyings);
+
+ ProgramMergedVaryings getMergedVaryings() const;
+ int getOutputLocationForLink(const sh::OutputVariable &outputVariable) const;
+ bool isOutputSecondaryForLink(const sh::OutputVariable &outputVariable) const;
+ bool linkOutputVariables(const Caps &caps,
+ const Extensions &extensions,
+ const Version &version,
+ GLuint combinedImageUniformsCount,
+ GLuint combinedShaderStorageBlocksCount);
+
+ void setUniformValuesFromBindingQualifiers();
+
+ void initInterfaceBlockBindings();
+
+ // Both these function update the cached uniform values and return a modified "count"
+ // so that the uniform update doesn't overflow the uniform.
+ template <typename T>
+ GLsizei clampUniformCount(const VariableLocation &locationInfo,
+ GLsizei count,
+ int vectorSize,
+ const T *v);
+ template <size_t cols, size_t rows, typename T>
+ GLsizei clampMatrixUniformCount(GLint location, GLsizei count, GLboolean transpose, const T *v);
+
+ void updateSamplerUniform(Context *context,
+ const VariableLocation &locationInfo,
+ GLsizei clampedCount,
+ const GLint *v);
+
+ template <typename DestT>
+ void getUniformInternal(const Context *context,
+ DestT *dataOut,
+ GLint location,
+ GLenum nativeType,
+ int components) const;
+
+ template <typename T>
+ void getResourceName(GLuint index,
+ const std::vector<T> &resources,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name) const;
+
+ template <typename T>
+ GLint getActiveInterfaceBlockMaxNameLength(const std::vector<T> &resources) const;
+
+ GLuint getSamplerUniformBinding(const VariableLocation &uniformLocation) const;
+
+ bool validateSamplersImpl(InfoLog *infoLog, const Caps &caps);
+
+ // Block until linking is finished and resolve it.
+ void resolveLinkImpl(const gl::Context *context);
+
+ void postResolveLink(const gl::Context *context);
+
+ ProgramState mState;
+ rx::ProgramImpl *mProgram;
+
+ bool mValidated;
+
+ ProgramBindings mAttributeBindings;
+
+ // Note that this has nothing to do with binding layout qualifiers that can be set for some
+ // uniforms in GLES3.1+. It is used to pre-set the location of uniforms.
+ ProgramBindings mUniformLocationBindings;
+
+ // CHROMIUM_path_rendering
+ ProgramBindings mFragmentInputBindings;
+
+ // EXT_blend_func_extended
+ ProgramBindings mFragmentOutputLocations;
+ ProgramBindings mFragmentOutputIndexes;
+
+ bool mLinked;
+ bool mLinkResolved;
+ std::unique_ptr<LinkingState> mLinkingState;
+ bool mDeleteStatus; // Flag to indicate that the program can be deleted when no longer in use
+
+ unsigned int mRefCount;
+
+ ShaderProgramManager *mResourceManager;
+ const GLuint mHandle;
+
+ InfoLog mInfoLog;
+
+ // Cache for sampler validation
+ Optional<bool> mCachedValidateSamplersResult;
+
+ DirtyBits mDirtyBits;
+};
+} // namespace gl
+
+#endif // LIBANGLE_PROGRAM_H_
diff --git a/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp
new file mode 100644
index 0000000000..cd2086dc13
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp
@@ -0,0 +1,1331 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramLinkedResources.cpp: implements link-time checks for default block uniforms, and generates
+// uniform locations. Populates data structures related to uniforms so that they can be stored in
+// program state.
+
+#include "libANGLE/ProgramLinkedResources.h"
+
+#include "common/string_utils.h"
+#include "common/utilities.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/features.h"
+
+namespace gl
+{
+namespace
+{
+LinkedUniform *FindUniform(std::vector<LinkedUniform> &list, const std::string &name)
+{
+ for (LinkedUniform &uniform : list)
+ {
+ if (uniform.name == name)
+ return &uniform;
+ }
+
+ return nullptr;
+}
+
+template <typename VarT>
+void SetActive(std::vector<VarT> *list, const std::string &name, ShaderType shaderType, bool active)
+{
+ for (auto &variable : *list)
+ {
+ if (variable.name == name)
+ {
+ variable.setActive(shaderType, active);
+ return;
+ }
+ }
+}
+
+// GLSL ES Spec 3.00.3, section 4.3.5.
+LinkMismatchError LinkValidateUniforms(const sh::Uniform &uniform1,
+ const sh::Uniform &uniform2,
+ std::string *mismatchedStructFieldName)
+{
+#if ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION == ANGLE_ENABLED
+ const bool validatePrecision = true;
+#else
+ const bool validatePrecision = false;
+#endif
+
+ LinkMismatchError linkError = Program::LinkValidateVariablesBase(
+ uniform1, uniform2, validatePrecision, true, mismatchedStructFieldName);
+ if (linkError != LinkMismatchError::NO_MISMATCH)
+ {
+ return linkError;
+ }
+
+ // GLSL ES Spec 3.10.4, section 4.4.5.
+ if (uniform1.binding != -1 && uniform2.binding != -1 && uniform1.binding != uniform2.binding)
+ {
+ return LinkMismatchError::BINDING_MISMATCH;
+ }
+
+ // GLSL ES Spec 3.10.4, section 9.2.1.
+ if (uniform1.location != -1 && uniform2.location != -1 &&
+ uniform1.location != uniform2.location)
+ {
+ return LinkMismatchError::LOCATION_MISMATCH;
+ }
+ if (uniform1.offset != uniform2.offset)
+ {
+ return LinkMismatchError::OFFSET_MISMATCH;
+ }
+
+ return LinkMismatchError::NO_MISMATCH;
+}
+
+using ShaderUniform = std::pair<ShaderType, const sh::Uniform *>;
+
+bool ValidateGraphicsUniformsPerShader(Shader *shaderToLink,
+ bool extendLinkedUniforms,
+ std::map<std::string, ShaderUniform> *linkedUniforms,
+ InfoLog &infoLog)
+{
+ ASSERT(shaderToLink && linkedUniforms);
+
+ for (const sh::Uniform &uniform : shaderToLink->getUniforms())
+ {
+ const auto &entry = linkedUniforms->find(uniform.name);
+ if (entry != linkedUniforms->end())
+ {
+ const sh::Uniform &linkedUniform = *(entry->second.second);
+ std::string mismatchedStructFieldName;
+ LinkMismatchError linkError =
+ LinkValidateUniforms(uniform, linkedUniform, &mismatchedStructFieldName);
+ if (linkError != LinkMismatchError::NO_MISMATCH)
+ {
+ LogLinkMismatch(infoLog, uniform.name, "uniform", linkError,
+ mismatchedStructFieldName, entry->second.first,
+ shaderToLink->getType());
+ return false;
+ }
+ }
+ else if (extendLinkedUniforms)
+ {
+ (*linkedUniforms)[uniform.name] = std::make_pair(shaderToLink->getType(), &uniform);
+ }
+ }
+
+ return true;
+}
+
+GLuint GetMaximumShaderUniformVectors(ShaderType shaderType, const Caps &caps)
+{
+ switch (shaderType)
+ {
+ case ShaderType::Vertex:
+ return caps.maxVertexUniformVectors;
+ case ShaderType::Fragment:
+ return caps.maxFragmentUniformVectors;
+
+ case ShaderType::Compute:
+ case ShaderType::Geometry:
+ return caps.maxShaderUniformComponents[shaderType] / 4;
+
+ default:
+ UNREACHABLE();
+ return 0u;
+ }
+}
+
+enum class UniformType : uint8_t
+{
+ Variable = 0,
+ Sampler = 1,
+ Image = 2,
+ AtomicCounter = 3,
+
+ InvalidEnum = 4,
+ EnumCount = 4,
+};
+
+const char *GetUniformResourceNameString(UniformType uniformType)
+{
+ switch (uniformType)
+ {
+ case UniformType::Variable:
+ return "uniform";
+ case UniformType::Sampler:
+ return "texture image unit";
+ case UniformType::Image:
+ return "image uniform";
+ case UniformType::AtomicCounter:
+ return "atomic counter";
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+std::string GetUniformResourceLimitName(ShaderType shaderType, UniformType uniformType)
+{
+ // Special case: MAX_TEXTURE_IMAGE_UNITS (no "MAX_FRAGMENT_TEXTURE_IMAGE_UNITS")
+ if (shaderType == ShaderType::Fragment && uniformType == UniformType::Sampler)
+ {
+ return "MAX_TEXTURE_IMAGE_UNITS";
+ }
+
+ std::ostringstream ostream;
+ ostream << "MAX_" << GetShaderTypeString(shaderType) << "_";
+
+ switch (uniformType)
+ {
+ case UniformType::Variable:
+ // For vertex and fragment shaders, ES 2.0 only defines MAX_VERTEX_UNIFORM_VECTORS and
+ // MAX_FRAGMENT_UNIFORM_VECTORS ([OpenGL ES 2.0] Table 6.20).
+ if (shaderType == ShaderType::Vertex || shaderType == ShaderType::Fragment)
+ {
+ ostream << "UNIFORM_VECTORS";
+ break;
+ }
+ // For compute and geometry shaders, there are no definitions on
+ // "MAX_COMPUTE_UNIFORM_VECTORS" or "MAX_GEOMETRY_UNIFORM_VECTORS_EXT"
+ // ([OpenGL ES 3.1] Table 20.45, [EXT_geometry_shader] Table 20.43gs).
+ else
+ {
+ ostream << "UNIFORM_COMPONENTS";
+ }
+ break;
+ case UniformType::Sampler:
+ ostream << "TEXTURE_IMAGE_UNITS";
+ break;
+ case UniformType::Image:
+ ostream << "IMAGE_UNIFORMS";
+ break;
+ case UniformType::AtomicCounter:
+ ostream << "ATOMIC_COUNTERS";
+ break;
+ default:
+ UNREACHABLE();
+ return "";
+ }
+
+ if (shaderType == ShaderType::Geometry)
+ {
+ ostream << "_EXT";
+ }
+
+ return ostream.str();
+}
+
+void LogUniformsExceedLimit(ShaderType shaderType,
+ UniformType uniformType,
+ GLuint limit,
+ InfoLog &infoLog)
+{
+ infoLog << GetShaderTypeString(shaderType) << " shader "
+ << GetUniformResourceNameString(uniformType) << "s count exceeds "
+ << GetUniformResourceLimitName(shaderType, uniformType) << "(" << limit << ")";
+}
+
+// The purpose of this visitor is to capture the uniforms in a uniform block. Each new uniform is
+// added to "uniformsOut".
+class UniformBlockEncodingVisitor : public sh::VariableNameVisitor
+{
+ public:
+ UniformBlockEncodingVisitor(const GetBlockMemberInfoFunc &getMemberInfo,
+ const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ std::vector<LinkedUniform> *uniformsOut,
+ ShaderType shaderType,
+ int blockIndex)
+ : sh::VariableNameVisitor(namePrefix, mappedNamePrefix),
+ mGetMemberInfo(getMemberInfo),
+ mUniformsOut(uniformsOut),
+ mShaderType(shaderType),
+ mBlockIndex(blockIndex)
+ {}
+
+ void visitNamedVariable(const sh::ShaderVariable &variable,
+ bool isRowMajor,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ // If getBlockMemberInfo returns false, the variable is optimized out.
+ sh::BlockMemberInfo variableInfo;
+ if (!mGetMemberInfo(name, mappedName, &variableInfo))
+ return;
+
+ std::string nameWithArrayIndex = name;
+ std::string mappedNameWithArrayIndex = mappedName;
+
+ if (variable.isArray())
+ {
+ nameWithArrayIndex += "[0]";
+ mappedNameWithArrayIndex += "[0]";
+ }
+
+ if (mBlockIndex == -1)
+ {
+ SetActive(mUniformsOut, nameWithArrayIndex, mShaderType, variable.active);
+ return;
+ }
+
+ LinkedUniform newUniform(variable.type, variable.precision, nameWithArrayIndex,
+ variable.arraySizes, -1, -1, -1, mBlockIndex, variableInfo);
+ newUniform.mappedName = mappedNameWithArrayIndex;
+ newUniform.setActive(mShaderType, variable.active);
+
+ // Since block uniforms have no location, we don't need to store them in the uniform
+ // locations list.
+ mUniformsOut->push_back(newUniform);
+ }
+
+ private:
+ const GetBlockMemberInfoFunc &mGetMemberInfo;
+ std::vector<LinkedUniform> *mUniformsOut;
+ const ShaderType mShaderType;
+ const int mBlockIndex;
+};
+
+// The purpose of this visitor is to capture the buffer variables in a shader storage block. Each
+// new buffer variable is stored in "bufferVariablesOut".
+class ShaderStorageBlockVisitor : public sh::BlockEncoderVisitor
+{
+ public:
+ ShaderStorageBlockVisitor(const GetBlockMemberInfoFunc &getMemberInfo,
+ const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ std::vector<BufferVariable> *bufferVariablesOut,
+ ShaderType shaderType,
+ int blockIndex)
+ : sh::BlockEncoderVisitor(namePrefix, mappedNamePrefix, &mDummyEncoder),
+ mGetMemberInfo(getMemberInfo),
+ mBufferVariablesOut(bufferVariablesOut),
+ mShaderType(shaderType),
+ mBlockIndex(blockIndex)
+ {}
+
+ void visitNamedVariable(const sh::ShaderVariable &variable,
+ bool isRowMajor,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ if (mSkipEnabled)
+ return;
+
+ // If getBlockMemberInfo returns false, the variable is optimized out.
+ sh::BlockMemberInfo variableInfo;
+ if (!mGetMemberInfo(name, mappedName, &variableInfo))
+ return;
+
+ std::string nameWithArrayIndex = name;
+ std::string mappedNameWithArrayIndex = mappedName;
+
+ if (variable.isArray())
+ {
+ nameWithArrayIndex += "[0]";
+ mappedNameWithArrayIndex += "[0]";
+ }
+
+ if (mBlockIndex == -1)
+ {
+ SetActive(mBufferVariablesOut, nameWithArrayIndex, mShaderType, variable.active);
+ return;
+ }
+
+ BufferVariable newBufferVariable(variable.type, variable.precision, nameWithArrayIndex,
+ variable.arraySizes, mBlockIndex, variableInfo);
+ newBufferVariable.mappedName = mappedNameWithArrayIndex;
+ newBufferVariable.setActive(mShaderType, variable.active);
+
+ newBufferVariable.topLevelArraySize = mTopLevelArraySize;
+
+ mBufferVariablesOut->push_back(newBufferVariable);
+ }
+
+ private:
+ const GetBlockMemberInfoFunc &mGetMemberInfo;
+ std::vector<BufferVariable> *mBufferVariablesOut;
+ const ShaderType mShaderType;
+ const int mBlockIndex;
+ sh::DummyBlockEncoder mDummyEncoder;
+};
+
+struct ShaderUniformCount
+{
+ unsigned int vectorCount = 0;
+ unsigned int samplerCount = 0;
+ unsigned int imageCount = 0;
+ unsigned int atomicCounterCount = 0;
+};
+
+ShaderUniformCount &operator+=(ShaderUniformCount &lhs, const ShaderUniformCount &rhs)
+{
+ lhs.vectorCount += rhs.vectorCount;
+ lhs.samplerCount += rhs.samplerCount;
+ lhs.imageCount += rhs.imageCount;
+ lhs.atomicCounterCount += rhs.atomicCounterCount;
+ return lhs;
+}
+
+// The purpose of this visitor is to flatten struct and array uniforms into a list of singleton
+// uniforms. They are stored in separate lists by uniform type so they can be sorted in order.
+// Counts for each uniform category are stored and can be queried with "getCounts".
+class FlattenUniformVisitor : public sh::VariableNameVisitor
+{
+ public:
+ FlattenUniformVisitor(ShaderType shaderType,
+ const sh::Uniform &uniform,
+ std::vector<LinkedUniform> *uniforms,
+ std::vector<LinkedUniform> *samplerUniforms,
+ std::vector<LinkedUniform> *imageUniforms,
+ std::vector<LinkedUniform> *atomicCounterUniforms,
+ std::vector<UnusedUniform> *unusedUniforms)
+ : sh::VariableNameVisitor("", ""),
+ mShaderType(shaderType),
+ mMarkActive(uniform.active),
+ mMarkStaticUse(uniform.staticUse),
+ mBinding(uniform.binding),
+ mOffset(uniform.offset),
+ mLocation(uniform.location),
+ mUniforms(uniforms),
+ mSamplerUniforms(samplerUniforms),
+ mImageUniforms(imageUniforms),
+ mAtomicCounterUniforms(atomicCounterUniforms),
+ mUnusedUniforms(unusedUniforms)
+ {}
+
+ void visitNamedSampler(const sh::ShaderVariable &sampler,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ visitNamedVariable(sampler, false, name, mappedName);
+ }
+
+ void visitNamedVariable(const sh::ShaderVariable &variable,
+ bool isRowMajor,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ bool isSampler = IsSamplerType(variable.type);
+ bool isImage = IsImageType(variable.type);
+ bool isAtomicCounter = IsAtomicCounterType(variable.type);
+ std::vector<LinkedUniform> *uniformList = mUniforms;
+ if (isSampler)
+ {
+ uniformList = mSamplerUniforms;
+ }
+ else if (isImage)
+ {
+ uniformList = mImageUniforms;
+ }
+ else if (isAtomicCounter)
+ {
+ uniformList = mAtomicCounterUniforms;
+ }
+
+ std::string fullNameWithArrayIndex(name);
+ std::string fullMappedNameWithArrayIndex(mappedName);
+
+ if (variable.isArray())
+ {
+ // We're following the GLES 3.1 November 2016 spec section 7.3.1.1 Naming Active
+ // Resources and including [0] at the end of array variable names.
+ fullNameWithArrayIndex += "[0]";
+ fullMappedNameWithArrayIndex += "[0]";
+ }
+
+ LinkedUniform *existingUniform = FindUniform(*uniformList, fullNameWithArrayIndex);
+ if (existingUniform)
+ {
+ if (getBinding() != -1)
+ {
+ existingUniform->binding = getBinding();
+ }
+ if (getOffset() != -1)
+ {
+ existingUniform->offset = getOffset();
+ }
+ if (mLocation != -1)
+ {
+ existingUniform->location = mLocation;
+ }
+ if (mMarkActive)
+ {
+ existingUniform->active = true;
+ existingUniform->setActive(mShaderType, true);
+ }
+ if (mMarkStaticUse)
+ {
+ existingUniform->staticUse = true;
+ }
+ }
+ else
+ {
+ LinkedUniform linkedUniform(variable.type, variable.precision, fullNameWithArrayIndex,
+ variable.arraySizes, getBinding(), getOffset(), mLocation,
+ -1, sh::kDefaultBlockMemberInfo);
+ linkedUniform.mappedName = fullMappedNameWithArrayIndex;
+ linkedUniform.active = mMarkActive;
+ linkedUniform.staticUse = mMarkStaticUse;
+ if (variable.hasParentArrayIndex())
+ {
+ linkedUniform.setParentArrayIndex(variable.parentArrayIndex());
+ }
+ if (mMarkActive)
+ {
+ linkedUniform.setActive(mShaderType, true);
+ }
+ else
+ {
+ mUnusedUniforms->emplace_back(linkedUniform.name, linkedUniform.isSampler());
+ }
+
+ uniformList->push_back(linkedUniform);
+ }
+
+ unsigned int elementCount = variable.getBasicTypeElementCount();
+
+ // Samplers and images aren't "real" uniforms, so they don't count towards register usage.
+ // Likewise, don't count "real" uniforms towards opaque count.
+
+ if (!IsOpaqueType(variable.type))
+ {
+ mUniformCount.vectorCount += VariableRegisterCount(variable.type) * elementCount;
+ }
+
+ mUniformCount.samplerCount += (isSampler ? elementCount : 0);
+ mUniformCount.imageCount += (isImage ? elementCount : 0);
+ mUniformCount.atomicCounterCount += (isAtomicCounter ? elementCount : 0);
+
+ if (mLocation != -1)
+ {
+ mLocation += elementCount;
+ }
+ }
+
+ void enterStructAccess(const sh::ShaderVariable &structVar, bool isRowMajor) override
+ {
+ mStructStackSize++;
+ sh::VariableNameVisitor::enterStructAccess(structVar, isRowMajor);
+ }
+
+ void exitStructAccess(const sh::ShaderVariable &structVar, bool isRowMajor) override
+ {
+ mStructStackSize--;
+ sh::VariableNameVisitor::exitStructAccess(structVar, isRowMajor);
+ }
+
+ ShaderUniformCount getCounts() const { return mUniformCount; }
+
+ private:
+ int getBinding() const { return mStructStackSize == 0 ? mBinding : -1; }
+ int getOffset() const { return mStructStackSize == 0 ? mOffset : -1; }
+
+ ShaderType mShaderType;
+
+ // Active and StaticUse are given separately because they are tracked at struct granularity.
+ bool mMarkActive;
+ bool mMarkStaticUse;
+ int mBinding;
+ int mOffset;
+ int mLocation;
+ std::vector<LinkedUniform> *mUniforms;
+ std::vector<LinkedUniform> *mSamplerUniforms;
+ std::vector<LinkedUniform> *mImageUniforms;
+ std::vector<LinkedUniform> *mAtomicCounterUniforms;
+ std::vector<UnusedUniform> *mUnusedUniforms;
+ ShaderUniformCount mUniformCount;
+ unsigned int mStructStackSize = 0;
+};
+
+class InterfaceBlockInfo final : angle::NonCopyable
+{
+ public:
+ InterfaceBlockInfo(CustomBlockLayoutEncoderFactory *customEncoderFactory)
+ : mCustomEncoderFactory(customEncoderFactory)
+ {}
+
+ void getShaderBlockInfo(const std::vector<sh::InterfaceBlock> &interfaceBlocks);
+
+ bool getBlockSize(const std::string &name, const std::string &mappedName, size_t *sizeOut);
+ bool getBlockMemberInfo(const std::string &name,
+ const std::string &mappedName,
+ sh::BlockMemberInfo *infoOut);
+
+ private:
+ size_t getBlockInfo(const sh::InterfaceBlock &interfaceBlock);
+
+ std::map<std::string, size_t> mBlockSizes;
+ sh::BlockLayoutMap mBlockLayout;
+ // Based on the interface block layout, the std140 or std430 encoders are used. On some
+ // platforms (currently only D3D), there could be another non-standard encoder used.
+ CustomBlockLayoutEncoderFactory *mCustomEncoderFactory;
+};
+
+void InterfaceBlockInfo::getShaderBlockInfo(const std::vector<sh::InterfaceBlock> &interfaceBlocks)
+{
+ for (const sh::InterfaceBlock &interfaceBlock : interfaceBlocks)
+ {
+ if (!IsActiveInterfaceBlock(interfaceBlock))
+ continue;
+
+ if (mBlockSizes.count(interfaceBlock.name) > 0)
+ continue;
+
+ size_t dataSize = getBlockInfo(interfaceBlock);
+ mBlockSizes[interfaceBlock.name] = dataSize;
+ }
+}
+
+size_t InterfaceBlockInfo::getBlockInfo(const sh::InterfaceBlock &interfaceBlock)
+{
+ ASSERT(IsActiveInterfaceBlock(interfaceBlock));
+
+ // define member uniforms
+ sh::Std140BlockEncoder std140Encoder;
+ sh::Std430BlockEncoder std430Encoder;
+ sh::BlockLayoutEncoder *customEncoder = nullptr;
+ sh::BlockLayoutEncoder *encoder = nullptr;
+
+ if (interfaceBlock.layout == sh::BLOCKLAYOUT_STD140)
+ {
+ encoder = &std140Encoder;
+ }
+ else if (interfaceBlock.layout == sh::BLOCKLAYOUT_STD430)
+ {
+ encoder = &std430Encoder;
+ }
+ else if (mCustomEncoderFactory)
+ {
+ encoder = customEncoder = mCustomEncoderFactory->makeEncoder();
+ }
+ else
+ {
+ UNREACHABLE();
+ return 0;
+ }
+
+ sh::GetInterfaceBlockInfo(interfaceBlock.fields, interfaceBlock.fieldPrefix(), encoder,
+ &mBlockLayout);
+
+ size_t offset = encoder->getCurrentOffset();
+
+ SafeDelete(customEncoder);
+
+ return offset;
+}
+
+bool InterfaceBlockInfo::getBlockSize(const std::string &name,
+ const std::string &mappedName,
+ size_t *sizeOut)
+{
+ size_t nameLengthWithoutArrayIndex;
+ ParseArrayIndex(name, &nameLengthWithoutArrayIndex);
+ std::string baseName = name.substr(0u, nameLengthWithoutArrayIndex);
+ auto sizeIter = mBlockSizes.find(baseName);
+ if (sizeIter == mBlockSizes.end())
+ {
+ *sizeOut = 0;
+ return false;
+ }
+
+ *sizeOut = sizeIter->second;
+ return true;
+}
+
+bool InterfaceBlockInfo::getBlockMemberInfo(const std::string &name,
+ const std::string &mappedName,
+ sh::BlockMemberInfo *infoOut)
+{
+ auto infoIter = mBlockLayout.find(name);
+ if (infoIter == mBlockLayout.end())
+ {
+ *infoOut = sh::kDefaultBlockMemberInfo;
+ return false;
+ }
+
+ *infoOut = infoIter->second;
+ return true;
+}
+} // anonymous namespace
+
+UniformLinker::UniformLinker(const ProgramState &state) : mState(state) {}
+
+UniformLinker::~UniformLinker() = default;
+
+void UniformLinker::getResults(std::vector<LinkedUniform> *uniforms,
+ std::vector<UnusedUniform> *unusedUniforms,
+ std::vector<VariableLocation> *uniformLocations)
+{
+ uniforms->swap(mUniforms);
+ unusedUniforms->swap(mUnusedUniforms);
+ uniformLocations->swap(mUniformLocations);
+}
+
+bool UniformLinker::link(const Caps &caps,
+ InfoLog &infoLog,
+ const ProgramBindings &uniformLocationBindings)
+{
+ if (mState.getAttachedShader(ShaderType::Vertex) &&
+ mState.getAttachedShader(ShaderType::Fragment))
+ {
+ ASSERT(mState.getAttachedShader(ShaderType::Compute) == nullptr);
+ if (!validateGraphicsUniforms(infoLog))
+ {
+ return false;
+ }
+ }
+
+ // Flatten the uniforms list (nested fields) into a simple list (no nesting).
+ // Also check the maximum uniform vector and sampler counts.
+ if (!flattenUniformsAndCheckCaps(caps, infoLog))
+ {
+ return false;
+ }
+
+ if (!checkMaxCombinedAtomicCounters(caps, infoLog))
+ {
+ return false;
+ }
+
+ if (!indexUniforms(infoLog, uniformLocationBindings))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool UniformLinker::validateGraphicsUniforms(InfoLog &infoLog) const
+{
+ // Check that uniforms defined in the graphics shaders are identical
+ std::map<std::string, ShaderUniform> linkedUniforms;
+
+ for (const ShaderType shaderType : kAllGraphicsShaderTypes)
+ {
+ Shader *currentShader = mState.getAttachedShader(shaderType);
+ if (currentShader)
+ {
+ if (shaderType == ShaderType::Vertex)
+ {
+ for (const sh::Uniform &vertexUniform : currentShader->getUniforms())
+ {
+ linkedUniforms[vertexUniform.name] =
+ std::make_pair(ShaderType::Vertex, &vertexUniform);
+ }
+ }
+ else
+ {
+ bool isLastShader = (shaderType == ShaderType::Fragment);
+ if (!ValidateGraphicsUniformsPerShader(currentShader, !isLastShader,
+ &linkedUniforms, infoLog))
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+bool UniformLinker::indexUniforms(InfoLog &infoLog, const ProgramBindings &uniformLocationBindings)
+{
+ // Locations which have been allocated for an unused uniform.
+ std::set<GLuint> ignoredLocations;
+
+ int maxUniformLocation = -1;
+
+ // Gather uniform locations that have been set either using the bindUniformLocation API or by
+ // using a location layout qualifier and check conflicts between them.
+ if (!gatherUniformLocationsAndCheckConflicts(infoLog, uniformLocationBindings,
+ &ignoredLocations, &maxUniformLocation))
+ {
+ return false;
+ }
+
+ // Conflicts have been checked, now we can prune non-statically used uniforms. Code further down
+ // the line relies on only having statically used uniforms in mUniforms.
+ pruneUnusedUniforms();
+
+ // Gather uniforms that have their location pre-set and uniforms that don't yet have a location.
+ std::vector<VariableLocation> unlocatedUniforms;
+ std::map<GLuint, VariableLocation> preLocatedUniforms;
+
+ for (size_t uniformIndex = 0; uniformIndex < mUniforms.size(); uniformIndex++)
+ {
+ const LinkedUniform &uniform = mUniforms[uniformIndex];
+
+ if ((uniform.isBuiltIn() && !uniform.isEmulatedBuiltIn()) ||
+ IsAtomicCounterType(uniform.type))
+ {
+ continue;
+ }
+
+ int preSetLocation = uniformLocationBindings.getBinding(uniform);
+ int shaderLocation = uniform.location;
+
+ if (shaderLocation != -1)
+ {
+ preSetLocation = shaderLocation;
+ }
+
+ unsigned int elementCount = uniform.getBasicTypeElementCount();
+ for (unsigned int arrayIndex = 0; arrayIndex < elementCount; arrayIndex++)
+ {
+ VariableLocation location(arrayIndex, static_cast<unsigned int>(uniformIndex));
+
+ if ((arrayIndex == 0 && preSetLocation != -1) || shaderLocation != -1)
+ {
+ int elementLocation = preSetLocation + arrayIndex;
+ preLocatedUniforms[elementLocation] = location;
+ }
+ else
+ {
+ unlocatedUniforms.push_back(location);
+ }
+ }
+ }
+
+ // Make enough space for all uniforms, with pre-set locations or not.
+ mUniformLocations.resize(
+ std::max(unlocatedUniforms.size() + preLocatedUniforms.size() + ignoredLocations.size(),
+ static_cast<size_t>(maxUniformLocation + 1)));
+
+ // Assign uniforms with pre-set locations
+ for (const auto &uniform : preLocatedUniforms)
+ {
+ mUniformLocations[uniform.first] = uniform.second;
+ }
+
+ // Assign ignored uniforms
+ for (const auto &ignoredLocation : ignoredLocations)
+ {
+ mUniformLocations[ignoredLocation].markIgnored();
+ }
+
+ // Automatically assign locations for the rest of the uniforms
+ size_t nextUniformLocation = 0;
+ for (const auto &unlocatedUniform : unlocatedUniforms)
+ {
+ while (mUniformLocations[nextUniformLocation].used() ||
+ mUniformLocations[nextUniformLocation].ignored)
+ {
+ nextUniformLocation++;
+ }
+
+ ASSERT(nextUniformLocation < mUniformLocations.size());
+ mUniformLocations[nextUniformLocation] = unlocatedUniform;
+ nextUniformLocation++;
+ }
+
+ return true;
+}
+
+bool UniformLinker::gatherUniformLocationsAndCheckConflicts(
+ InfoLog &infoLog,
+ const ProgramBindings &uniformLocationBindings,
+ std::set<GLuint> *ignoredLocations,
+ int *maxUniformLocation)
+{
+ // All the locations where another uniform can't be located.
+ std::set<GLuint> reservedLocations;
+
+ for (const LinkedUniform &uniform : mUniforms)
+ {
+ if (uniform.isBuiltIn() && !uniform.isEmulatedBuiltIn())
+ {
+ continue;
+ }
+
+ int apiBoundLocation = uniformLocationBindings.getBinding(uniform);
+ int shaderLocation = uniform.location;
+
+ if (shaderLocation != -1)
+ {
+ unsigned int elementCount = uniform.getBasicTypeElementCount();
+
+ for (unsigned int arrayIndex = 0; arrayIndex < elementCount; arrayIndex++)
+ {
+ // GLSL ES 3.10 section 4.4.3
+ int elementLocation = shaderLocation + arrayIndex;
+ *maxUniformLocation = std::max(*maxUniformLocation, elementLocation);
+ if (reservedLocations.find(elementLocation) != reservedLocations.end())
+ {
+ infoLog << "Multiple uniforms bound to location " << elementLocation << ".";
+ return false;
+ }
+ reservedLocations.insert(elementLocation);
+ if (!uniform.active)
+ {
+ ignoredLocations->insert(elementLocation);
+ }
+ }
+ }
+ else if (apiBoundLocation != -1 && uniform.staticUse)
+ {
+ // Only the first location is reserved even if the uniform is an array.
+ *maxUniformLocation = std::max(*maxUniformLocation, apiBoundLocation);
+ if (reservedLocations.find(apiBoundLocation) != reservedLocations.end())
+ {
+ infoLog << "Multiple uniforms bound to location " << apiBoundLocation << ".";
+ return false;
+ }
+ reservedLocations.insert(apiBoundLocation);
+ if (!uniform.active)
+ {
+ ignoredLocations->insert(apiBoundLocation);
+ }
+ }
+ }
+
+ // Record the uniform locations that were bound using the API for uniforms that were not found
+ // from the shader. Other uniforms should not be assigned to those locations.
+ for (const auto &locationBinding : uniformLocationBindings)
+ {
+ GLuint location = locationBinding.second.location;
+ if (reservedLocations.find(location) == reservedLocations.end())
+ {
+ ignoredLocations->insert(location);
+ *maxUniformLocation = std::max(*maxUniformLocation, static_cast<int>(location));
+ }
+ }
+
+ return true;
+}
+
+void UniformLinker::pruneUnusedUniforms()
+{
+ auto uniformIter = mUniforms.begin();
+ while (uniformIter != mUniforms.end())
+ {
+ if (uniformIter->active)
+ {
+ ++uniformIter;
+ }
+ else
+ {
+ mUnusedUniforms.emplace_back(uniformIter->name, uniformIter->isSampler());
+ uniformIter = mUniforms.erase(uniformIter);
+ }
+ }
+}
+
+bool UniformLinker::flattenUniformsAndCheckCapsForShader(
+ Shader *shader,
+ const Caps &caps,
+ std::vector<LinkedUniform> &samplerUniforms,
+ std::vector<LinkedUniform> &imageUniforms,
+ std::vector<LinkedUniform> &atomicCounterUniforms,
+ std::vector<UnusedUniform> &unusedUniforms,
+ InfoLog &infoLog)
+{
+ ShaderUniformCount shaderUniformCount;
+ for (const sh::Uniform &uniform : shader->getUniforms())
+ {
+ FlattenUniformVisitor flattener(shader->getType(), uniform, &mUniforms, &samplerUniforms,
+ &imageUniforms, &atomicCounterUniforms, &unusedUniforms);
+ sh::TraverseShaderVariable(uniform, false, &flattener);
+
+ if (uniform.active)
+ {
+ shaderUniformCount += flattener.getCounts();
+ }
+ else
+ {
+ unusedUniforms.emplace_back(uniform.name, IsSamplerType(uniform.type));
+ }
+ }
+
+ ShaderType shaderType = shader->getType();
+
+ // TODO (jiawei.shao@intel.com): check whether we need finer-grained component counting
+ GLuint maxUniformVectorsCount = GetMaximumShaderUniformVectors(shaderType, caps);
+ if (shaderUniformCount.vectorCount > maxUniformVectorsCount)
+ {
+ GLuint maxUniforms = 0u;
+
+ // See comments in GetUniformResourceLimitName()
+ if (shaderType == ShaderType::Vertex || shaderType == ShaderType::Fragment)
+ {
+ maxUniforms = maxUniformVectorsCount;
+ }
+ else
+ {
+ maxUniforms = maxUniformVectorsCount * 4;
+ }
+
+ LogUniformsExceedLimit(shaderType, UniformType::Variable, maxUniforms, infoLog);
+ return false;
+ }
+
+ if (shaderUniformCount.samplerCount > caps.maxShaderTextureImageUnits[shaderType])
+ {
+ LogUniformsExceedLimit(shaderType, UniformType::Sampler,
+ caps.maxShaderTextureImageUnits[shaderType], infoLog);
+ return false;
+ }
+
+ if (shaderUniformCount.imageCount > caps.maxShaderImageUniforms[shaderType])
+ {
+ LogUniformsExceedLimit(shaderType, UniformType::Image,
+ caps.maxShaderImageUniforms[shaderType], infoLog);
+ return false;
+ }
+
+ if (shaderUniformCount.atomicCounterCount > caps.maxShaderAtomicCounters[shaderType])
+ {
+ LogUniformsExceedLimit(shaderType, UniformType::AtomicCounter,
+ caps.maxShaderAtomicCounters[shaderType], infoLog);
+ return false;
+ }
+
+ return true;
+}
+
+bool UniformLinker::flattenUniformsAndCheckCaps(const Caps &caps, InfoLog &infoLog)
+{
+ std::vector<LinkedUniform> samplerUniforms;
+ std::vector<LinkedUniform> imageUniforms;
+ std::vector<LinkedUniform> atomicCounterUniforms;
+ std::vector<UnusedUniform> unusedUniforms;
+
+ for (const ShaderType shaderType : AllShaderTypes())
+ {
+ Shader *shader = mState.getAttachedShader(shaderType);
+ if (!shader)
+ {
+ continue;
+ }
+
+ if (!flattenUniformsAndCheckCapsForShader(shader, caps, samplerUniforms, imageUniforms,
+ atomicCounterUniforms, unusedUniforms, infoLog))
+ {
+ return false;
+ }
+ }
+
+ mUniforms.insert(mUniforms.end(), samplerUniforms.begin(), samplerUniforms.end());
+ mUniforms.insert(mUniforms.end(), imageUniforms.begin(), imageUniforms.end());
+ mUniforms.insert(mUniforms.end(), atomicCounterUniforms.begin(), atomicCounterUniforms.end());
+ mUnusedUniforms.insert(mUnusedUniforms.end(), unusedUniforms.begin(), unusedUniforms.end());
+ return true;
+}
+
+bool UniformLinker::checkMaxCombinedAtomicCounters(const Caps &caps, InfoLog &infoLog)
+{
+ unsigned int atomicCounterCount = 0;
+ for (const auto &uniform : mUniforms)
+ {
+ if (IsAtomicCounterType(uniform.type) && uniform.active)
+ {
+ atomicCounterCount += uniform.getBasicTypeElementCount();
+ if (atomicCounterCount > caps.maxCombinedAtomicCounters)
+ {
+ infoLog << "atomic counter count exceeds MAX_COMBINED_ATOMIC_COUNTERS"
+ << caps.maxCombinedAtomicCounters << ").";
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+// InterfaceBlockLinker implementation.
+InterfaceBlockLinker::InterfaceBlockLinker(std::vector<InterfaceBlock> *blocksOut,
+ std::vector<std::string> *unusedInterfaceBlocksOut)
+ : mShaderBlocks({}), mBlocksOut(blocksOut), mUnusedInterfaceBlocksOut(unusedInterfaceBlocksOut)
+{}
+
+InterfaceBlockLinker::~InterfaceBlockLinker() {}
+
+void InterfaceBlockLinker::addShaderBlocks(ShaderType shaderType,
+ const std::vector<sh::InterfaceBlock> *blocks)
+{
+ mShaderBlocks[shaderType] = blocks;
+}
+
+void InterfaceBlockLinker::linkBlocks(const GetBlockSizeFunc &getBlockSize,
+ const GetBlockMemberInfoFunc &getMemberInfo) const
+{
+ ASSERT(mBlocksOut->empty());
+
+ std::set<std::string> visitedList;
+
+ for (const ShaderType shaderType : AllShaderTypes())
+ {
+ if (!mShaderBlocks[shaderType])
+ {
+ continue;
+ }
+
+ for (const sh::InterfaceBlock &block : *mShaderBlocks[shaderType])
+ {
+ if (!IsActiveInterfaceBlock(block))
+ {
+ mUnusedInterfaceBlocksOut->push_back(block.name);
+ continue;
+ }
+
+ if (visitedList.count(block.name) == 0)
+ {
+ defineInterfaceBlock(getBlockSize, getMemberInfo, block, shaderType);
+ visitedList.insert(block.name);
+ continue;
+ }
+
+ if (!block.active)
+ {
+ mUnusedInterfaceBlocksOut->push_back(block.name);
+ continue;
+ }
+
+ for (InterfaceBlock &priorBlock : *mBlocksOut)
+ {
+ if (block.name == priorBlock.name)
+ {
+ priorBlock.setActive(shaderType, true);
+
+ std::unique_ptr<sh::ShaderVariableVisitor> visitor(
+ getVisitor(getMemberInfo, block.fieldPrefix(), block.fieldMappedPrefix(),
+ shaderType, -1));
+
+ sh::TraverseShaderVariables(block.fields, false, visitor.get());
+ }
+ }
+ }
+ }
+}
+
+void InterfaceBlockLinker::defineInterfaceBlock(const GetBlockSizeFunc &getBlockSize,
+ const GetBlockMemberInfoFunc &getMemberInfo,
+ const sh::InterfaceBlock &interfaceBlock,
+ ShaderType shaderType) const
+{
+ size_t blockSize = 0;
+ std::vector<unsigned int> blockIndexes;
+
+ int blockIndex = static_cast<int>(mBlocksOut->size());
+ // Track the first and last block member index to determine the range of active block members in
+ // the block.
+ size_t firstBlockMemberIndex = getCurrentBlockMemberIndex();
+
+ std::unique_ptr<sh::ShaderVariableVisitor> visitor(
+ getVisitor(getMemberInfo, interfaceBlock.fieldPrefix(), interfaceBlock.fieldMappedPrefix(),
+ shaderType, blockIndex));
+ sh::TraverseShaderVariables(interfaceBlock.fields, false, visitor.get());
+
+ size_t lastBlockMemberIndex = getCurrentBlockMemberIndex();
+
+ for (size_t blockMemberIndex = firstBlockMemberIndex; blockMemberIndex < lastBlockMemberIndex;
+ ++blockMemberIndex)
+ {
+ blockIndexes.push_back(static_cast<unsigned int>(blockMemberIndex));
+ }
+
+ for (unsigned int arrayElement = 0; arrayElement < interfaceBlock.elementCount();
+ ++arrayElement)
+ {
+ std::string blockArrayName = interfaceBlock.name;
+ std::string blockMappedArrayName = interfaceBlock.mappedName;
+ if (interfaceBlock.isArray())
+ {
+ blockArrayName += ArrayString(arrayElement);
+ blockMappedArrayName += ArrayString(arrayElement);
+ }
+
+ // Don't define this block at all if it's not active in the implementation.
+ if (!getBlockSize(blockArrayName, blockMappedArrayName, &blockSize))
+ {
+ continue;
+ }
+
+ // ESSL 3.10 section 4.4.4 page 58:
+ // Any uniform or shader storage block declared without a binding qualifier is initially
+ // assigned to block binding point zero.
+ int blockBinding =
+ (interfaceBlock.binding == -1 ? 0 : interfaceBlock.binding + arrayElement);
+ InterfaceBlock block(interfaceBlock.name, interfaceBlock.mappedName,
+ interfaceBlock.isArray(), arrayElement, blockBinding);
+ block.memberIndexes = blockIndexes;
+ block.setActive(shaderType, interfaceBlock.active);
+
+ // Since all block elements in an array share the same active interface blocks, they
+ // will all be active once any block member is used. So, since interfaceBlock.name[0]
+ // was active, here we will add every block element in the array.
+ block.dataSize = static_cast<unsigned int>(blockSize);
+ mBlocksOut->push_back(block);
+ }
+}
+
+// UniformBlockLinker implementation.
+UniformBlockLinker::UniformBlockLinker(std::vector<InterfaceBlock> *blocksOut,
+ std::vector<LinkedUniform> *uniformsOut,
+ std::vector<std::string> *unusedInterfaceBlocksOut)
+ : InterfaceBlockLinker(blocksOut, unusedInterfaceBlocksOut), mUniformsOut(uniformsOut)
+{}
+
+UniformBlockLinker::~UniformBlockLinker() {}
+
+size_t UniformBlockLinker::getCurrentBlockMemberIndex() const
+{
+ return mUniformsOut->size();
+}
+
+sh::ShaderVariableVisitor *UniformBlockLinker::getVisitor(
+ const GetBlockMemberInfoFunc &getMemberInfo,
+ const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ ShaderType shaderType,
+ int blockIndex) const
+{
+ return new UniformBlockEncodingVisitor(getMemberInfo, namePrefix, mappedNamePrefix,
+ mUniformsOut, shaderType, blockIndex);
+}
+
+// ShaderStorageBlockLinker implementation.
+ShaderStorageBlockLinker::ShaderStorageBlockLinker(
+ std::vector<InterfaceBlock> *blocksOut,
+ std::vector<BufferVariable> *bufferVariablesOut,
+ std::vector<std::string> *unusedInterfaceBlocksOut)
+ : InterfaceBlockLinker(blocksOut, unusedInterfaceBlocksOut),
+ mBufferVariablesOut(bufferVariablesOut)
+{}
+
+ShaderStorageBlockLinker::~ShaderStorageBlockLinker() {}
+
+size_t ShaderStorageBlockLinker::getCurrentBlockMemberIndex() const
+{
+ return mBufferVariablesOut->size();
+}
+
+sh::ShaderVariableVisitor *ShaderStorageBlockLinker::getVisitor(
+ const GetBlockMemberInfoFunc &getMemberInfo,
+ const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ ShaderType shaderType,
+ int blockIndex) const
+{
+ return new ShaderStorageBlockVisitor(getMemberInfo, namePrefix, mappedNamePrefix,
+ mBufferVariablesOut, shaderType, blockIndex);
+}
+
+// AtomicCounterBufferLinker implementation.
+AtomicCounterBufferLinker::AtomicCounterBufferLinker(
+ std::vector<AtomicCounterBuffer> *atomicCounterBuffersOut)
+ : mAtomicCounterBuffersOut(atomicCounterBuffersOut)
+{}
+
+AtomicCounterBufferLinker::~AtomicCounterBufferLinker() {}
+
+void AtomicCounterBufferLinker::link(const std::map<int, unsigned int> &sizeMap) const
+{
+ for (auto &atomicCounterBuffer : *mAtomicCounterBuffersOut)
+ {
+ auto bufferSize = sizeMap.find(atomicCounterBuffer.binding);
+ ASSERT(bufferSize != sizeMap.end());
+ atomicCounterBuffer.dataSize = bufferSize->second;
+ }
+}
+
+ProgramLinkedResources::ProgramLinkedResources(
+ GLuint maxVaryingVectors,
+ PackMode packMode,
+ std::vector<InterfaceBlock> *uniformBlocksOut,
+ std::vector<LinkedUniform> *uniformsOut,
+ std::vector<InterfaceBlock> *shaderStorageBlocksOut,
+ std::vector<BufferVariable> *bufferVariablesOut,
+ std::vector<AtomicCounterBuffer> *atomicCounterBuffersOut)
+ : varyingPacking(maxVaryingVectors, packMode),
+ uniformBlockLinker(uniformBlocksOut, uniformsOut, &unusedInterfaceBlocks),
+ shaderStorageBlockLinker(shaderStorageBlocksOut, bufferVariablesOut, &unusedInterfaceBlocks),
+ atomicCounterBufferLinker(atomicCounterBuffersOut)
+{}
+
+ProgramLinkedResources::~ProgramLinkedResources() = default;
+
+void ProgramLinkedResourcesLinker::linkResources(const ProgramState &programState,
+ const ProgramLinkedResources &resources) const
+{
+ // Gather uniform interface block info.
+ InterfaceBlockInfo uniformBlockInfo(mCustomEncoderFactory);
+ for (const ShaderType shaderType : AllShaderTypes())
+ {
+ Shader *shader = programState.getAttachedShader(shaderType);
+ if (shader)
+ {
+ uniformBlockInfo.getShaderBlockInfo(shader->getUniformBlocks());
+ }
+ }
+
+ auto getUniformBlockSize = [&uniformBlockInfo](const std::string &name,
+ const std::string &mappedName, size_t *sizeOut) {
+ return uniformBlockInfo.getBlockSize(name, mappedName, sizeOut);
+ };
+
+ auto getUniformBlockMemberInfo = [&uniformBlockInfo](const std::string &name,
+ const std::string &mappedName,
+ sh::BlockMemberInfo *infoOut) {
+ return uniformBlockInfo.getBlockMemberInfo(name, mappedName, infoOut);
+ };
+
+ // Link uniform interface blocks.
+ resources.uniformBlockLinker.linkBlocks(getUniformBlockSize, getUniformBlockMemberInfo);
+
+ // Gather storage bufer interface block info.
+ InterfaceBlockInfo shaderStorageBlockInfo(mCustomEncoderFactory);
+ for (const ShaderType shaderType : AllShaderTypes())
+ {
+ Shader *shader = programState.getAttachedShader(shaderType);
+ if (shader)
+ {
+ shaderStorageBlockInfo.getShaderBlockInfo(shader->getShaderStorageBlocks());
+ }
+ }
+ auto getShaderStorageBlockSize = [&shaderStorageBlockInfo](const std::string &name,
+ const std::string &mappedName,
+ size_t *sizeOut) {
+ return shaderStorageBlockInfo.getBlockSize(name, mappedName, sizeOut);
+ };
+
+ auto getShaderStorageBlockMemberInfo = [&shaderStorageBlockInfo](const std::string &name,
+ const std::string &mappedName,
+ sh::BlockMemberInfo *infoOut) {
+ return shaderStorageBlockInfo.getBlockMemberInfo(name, mappedName, infoOut);
+ };
+
+ // Link storage buffer interface blocks.
+ resources.shaderStorageBlockLinker.linkBlocks(getShaderStorageBlockSize,
+ getShaderStorageBlockMemberInfo);
+
+ // Gather and link atomic counter buffer interface blocks.
+ std::map<int, unsigned int> sizeMap;
+ getAtomicCounterBufferSizeMap(programState, sizeMap);
+ resources.atomicCounterBufferLinker.link(sizeMap);
+}
+
+void ProgramLinkedResourcesLinker::getAtomicCounterBufferSizeMap(
+ const ProgramState &programState,
+ std::map<int, unsigned int> &sizeMapOut) const
+{
+ for (unsigned int index : programState.getAtomicCounterUniformRange())
+ {
+ const LinkedUniform &glUniform = programState.getUniforms()[index];
+
+ auto &bufferDataSize = sizeMapOut[glUniform.binding];
+
+ // Calculate the size of the buffer by finding the end of the last uniform with the same
+ // binding. The end of the uniform is calculated by finding the initial offset of the
+ // uniform and adding size of the uniform. For arrays, the size is the number of elements
+ // times the element size (should always by 4 for atomic_units).
+ unsigned dataOffset =
+ glUniform.offset + (glUniform.getBasicTypeElementCount() * glUniform.getElementSize());
+ if (dataOffset > bufferDataSize)
+ {
+ bufferDataSize = dataOffset;
+ }
+ }
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h
new file mode 100644
index 0000000000..35841f2750
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h
@@ -0,0 +1,247 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramLinkedResources.h: implements link-time checks for default block uniforms, and generates
+// uniform locations. Populates data structures related to uniforms so that they can be stored in
+// program state.
+
+#ifndef LIBANGLE_UNIFORMLINKER_H_
+#define LIBANGLE_UNIFORMLINKER_H_
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/VaryingPacking.h"
+
+#include <functional>
+
+namespace sh
+{
+class BlockLayoutEncoder;
+struct BlockMemberInfo;
+struct InterfaceBlock;
+struct ShaderVariable;
+class BlockEncoderVisitor;
+class ShaderVariableVisitor;
+struct Uniform;
+} // namespace sh
+
+namespace gl
+{
+struct BufferVariable;
+struct Caps;
+class Context;
+class InfoLog;
+struct InterfaceBlock;
+enum class LinkMismatchError;
+struct LinkedUniform;
+class ProgramState;
+class ProgramBindings;
+class Shader;
+struct ShaderVariableBuffer;
+struct UnusedUniform;
+struct VariableLocation;
+
+using AtomicCounterBuffer = ShaderVariableBuffer;
+
+class UniformLinker final : angle::NonCopyable
+{
+ public:
+ UniformLinker(const ProgramState &state);
+ ~UniformLinker();
+
+ bool link(const Caps &caps, InfoLog &infoLog, const ProgramBindings &uniformLocationBindings);
+
+ void getResults(std::vector<LinkedUniform> *uniforms,
+ std::vector<UnusedUniform> *unusedUniforms,
+ std::vector<VariableLocation> *uniformLocations);
+
+ private:
+ bool validateGraphicsUniforms(InfoLog &infoLog) const;
+
+ bool flattenUniformsAndCheckCapsForShader(Shader *shader,
+ const Caps &caps,
+ std::vector<LinkedUniform> &samplerUniforms,
+ std::vector<LinkedUniform> &imageUniforms,
+ std::vector<LinkedUniform> &atomicCounterUniforms,
+ std::vector<UnusedUniform> &unusedUniforms,
+ InfoLog &infoLog);
+
+ bool flattenUniformsAndCheckCaps(const Caps &caps, InfoLog &infoLog);
+ bool checkMaxCombinedAtomicCounters(const Caps &caps, InfoLog &infoLog);
+
+ bool indexUniforms(InfoLog &infoLog, const ProgramBindings &uniformLocationBindings);
+ bool gatherUniformLocationsAndCheckConflicts(InfoLog &infoLog,
+ const ProgramBindings &uniformLocationBindings,
+ std::set<GLuint> *ignoredLocations,
+ int *maxUniformLocation);
+ void pruneUnusedUniforms();
+
+ const ProgramState &mState;
+ std::vector<LinkedUniform> mUniforms;
+ std::vector<UnusedUniform> mUnusedUniforms;
+ std::vector<VariableLocation> mUniformLocations;
+};
+
+using GetBlockSizeFunc = std::function<
+ bool(const std::string &blockName, const std::string &blockMappedName, size_t *sizeOut)>;
+using GetBlockMemberInfoFunc = std::function<
+ bool(const std::string &name, const std::string &mappedName, sh::BlockMemberInfo *infoOut)>;
+
+// This class is intended to be used during the link step to store interface block information.
+// It is called by the Impl class during ProgramImpl::link so that it has access to the
+// real block size and layout.
+class InterfaceBlockLinker : angle::NonCopyable
+{
+ public:
+ virtual ~InterfaceBlockLinker();
+
+ // This is called once per shader stage. It stores a pointer to the block vector, so it's
+ // important that this class does not persist longer than the duration of Program::link.
+ void addShaderBlocks(ShaderType shader, const std::vector<sh::InterfaceBlock> *blocks);
+
+ // This is called once during a link operation, after all shader blocks are added.
+ void linkBlocks(const GetBlockSizeFunc &getBlockSize,
+ const GetBlockMemberInfoFunc &getMemberInfo) const;
+
+ protected:
+ InterfaceBlockLinker(std::vector<InterfaceBlock> *blocksOut,
+ std::vector<std::string> *unusedInterfaceBlocksOut);
+ void defineInterfaceBlock(const GetBlockSizeFunc &getBlockSize,
+ const GetBlockMemberInfoFunc &getMemberInfo,
+ const sh::InterfaceBlock &interfaceBlock,
+ ShaderType shaderType) const;
+
+ virtual size_t getCurrentBlockMemberIndex() const = 0;
+
+ ShaderMap<const std::vector<sh::InterfaceBlock> *> mShaderBlocks;
+
+ std::vector<InterfaceBlock> *mBlocksOut;
+ std::vector<std::string> *mUnusedInterfaceBlocksOut;
+
+ virtual sh::ShaderVariableVisitor *getVisitor(const GetBlockMemberInfoFunc &getMemberInfo,
+ const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ ShaderType shaderType,
+ int blockIndex) const = 0;
+};
+
+class UniformBlockLinker final : public InterfaceBlockLinker
+{
+ public:
+ UniformBlockLinker(std::vector<InterfaceBlock> *blocksOut,
+ std::vector<LinkedUniform> *uniformsOut,
+ std::vector<std::string> *unusedInterfaceBlocksOut);
+ ~UniformBlockLinker() override;
+
+ private:
+ size_t getCurrentBlockMemberIndex() const override;
+
+ sh::ShaderVariableVisitor *getVisitor(const GetBlockMemberInfoFunc &getMemberInfo,
+ const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ ShaderType shaderType,
+ int blockIndex) const override;
+
+ std::vector<LinkedUniform> *mUniformsOut;
+};
+
+class ShaderStorageBlockLinker final : public InterfaceBlockLinker
+{
+ public:
+ ShaderStorageBlockLinker(std::vector<InterfaceBlock> *blocksOut,
+ std::vector<BufferVariable> *bufferVariablesOut,
+ std::vector<std::string> *unusedInterfaceBlocksOut);
+ ~ShaderStorageBlockLinker() override;
+
+ private:
+ size_t getCurrentBlockMemberIndex() const override;
+
+ sh::ShaderVariableVisitor *getVisitor(const GetBlockMemberInfoFunc &getMemberInfo,
+ const std::string &namePrefix,
+ const std::string &mappedNamePrefix,
+ ShaderType shaderType,
+ int blockIndex) const override;
+
+ std::vector<BufferVariable> *mBufferVariablesOut;
+};
+
+class AtomicCounterBufferLinker final : angle::NonCopyable
+{
+ public:
+ AtomicCounterBufferLinker(std::vector<AtomicCounterBuffer> *atomicCounterBuffersOut);
+ ~AtomicCounterBufferLinker();
+
+ void link(const std::map<int, unsigned int> &sizeMap) const;
+
+ private:
+ std::vector<AtomicCounterBuffer> *mAtomicCounterBuffersOut;
+};
+
+// The link operation is responsible for finishing the link of uniform and interface blocks.
+// This way it can filter out unreferenced resources and still have access to the info.
+// TODO(jmadill): Integrate uniform linking/filtering as well as interface blocks.
+struct UnusedUniform
+{
+ UnusedUniform(std::string name, bool isSampler)
+ {
+ this->name = name;
+ this->isSampler = isSampler;
+ }
+
+ std::string name;
+ bool isSampler;
+};
+
+struct ProgramLinkedResources
+{
+ ProgramLinkedResources(GLuint maxVaryingVectors,
+ PackMode packMode,
+ std::vector<InterfaceBlock> *uniformBlocksOut,
+ std::vector<LinkedUniform> *uniformsOut,
+ std::vector<InterfaceBlock> *shaderStorageBlocksOut,
+ std::vector<BufferVariable> *bufferVariablesOut,
+ std::vector<AtomicCounterBuffer> *atomicCounterBuffersOut);
+ ~ProgramLinkedResources();
+
+ VaryingPacking varyingPacking;
+ UniformBlockLinker uniformBlockLinker;
+ ShaderStorageBlockLinker shaderStorageBlockLinker;
+ AtomicCounterBufferLinker atomicCounterBufferLinker;
+ std::vector<UnusedUniform> unusedUniforms;
+ std::vector<std::string> unusedInterfaceBlocks;
+};
+
+class CustomBlockLayoutEncoderFactory : angle::NonCopyable
+{
+ public:
+ virtual ~CustomBlockLayoutEncoderFactory() {}
+
+ virtual sh::BlockLayoutEncoder *makeEncoder() = 0;
+};
+
+// Used by the backends in Program*::linkResources to parse interface blocks and provide
+// information to ProgramLinkedResources' linkers.
+class ProgramLinkedResourcesLinker final : angle::NonCopyable
+{
+ public:
+ ProgramLinkedResourcesLinker(CustomBlockLayoutEncoderFactory *customEncoderFactory)
+ : mCustomEncoderFactory(customEncoderFactory)
+ {}
+
+ void linkResources(const ProgramState &programState,
+ const ProgramLinkedResources &resources) const;
+
+ private:
+ void getAtomicCounterBufferSizeMap(const ProgramState &programState,
+ std::map<int, unsigned int> &sizeMapOut) const;
+
+ CustomBlockLayoutEncoderFactory *mCustomEncoderFactory;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_UNIFORMLINKER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/ProgramPipeline.cpp b/gfx/angle/checkout/src/libANGLE/ProgramPipeline.cpp
new file mode 100644
index 0000000000..bacd2ed71b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ProgramPipeline.cpp
@@ -0,0 +1,57 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramPipeline.cpp: Implements the gl::ProgramPipeline class.
+// Implements GL program pipeline objects and related functionality.
+// [OpenGL ES 3.1] section 7.4 page 105.
+
+#include "libANGLE/ProgramPipeline.h"
+
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/ProgramPipelineImpl.h"
+
+namespace gl
+{
+
+ProgramPipelineState::ProgramPipelineState() : mLabel() {}
+
+ProgramPipelineState::~ProgramPipelineState() {}
+
+const std::string &ProgramPipelineState::getLabel() const
+{
+ return mLabel;
+}
+
+ProgramPipeline::ProgramPipeline(rx::GLImplFactory *factory, GLuint handle)
+ : RefCountObject(handle), mProgramPipeline(factory->createProgramPipeline(mState))
+{
+ ASSERT(mProgramPipeline);
+}
+
+ProgramPipeline::~ProgramPipeline()
+{
+ mProgramPipeline.release();
+}
+
+void ProgramPipeline::onDestroy(const Context *context) {}
+
+void ProgramPipeline::setLabel(const Context *context, const std::string &label)
+{
+ mState.mLabel = label;
+}
+
+const std::string &ProgramPipeline::getLabel() const
+{
+ return mState.mLabel;
+}
+
+rx::ProgramPipelineImpl *ProgramPipeline::getImplementation() const
+{
+ return mProgramPipeline.get();
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/ProgramPipeline.h b/gfx/angle/checkout/src/libANGLE/ProgramPipeline.h
new file mode 100644
index 0000000000..b32e7b9c79
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ProgramPipeline.h
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramPipeline.h: Defines the gl::ProgramPipeline class.
+// Implements GL program pipeline objects and related functionality.
+// [OpenGL ES 3.1] section 7.4 page 105.
+
+#ifndef LIBANGLE_PROGRAMPIPELINE_H_
+#define LIBANGLE_PROGRAMPIPELINE_H_
+
+#include <memory>
+
+#include "common/angleutils.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/RefCountObject.h"
+
+namespace rx
+{
+class GLImplFactory;
+class ProgramPipelineImpl;
+} // namespace rx
+
+namespace gl
+{
+class Context;
+class ProgramPipeline;
+
+class ProgramPipelineState final : angle::NonCopyable
+{
+ public:
+ ProgramPipelineState();
+ ~ProgramPipelineState();
+
+ const std::string &getLabel() const;
+
+ private:
+ friend class ProgramPipeline;
+
+ std::string mLabel;
+};
+
+class ProgramPipeline final : public RefCountObject, public LabeledObject
+{
+ public:
+ ProgramPipeline(rx::GLImplFactory *factory, GLuint handle);
+ ~ProgramPipeline() override;
+
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ rx::ProgramPipelineImpl *getImplementation() const;
+
+ private:
+ std::unique_ptr<rx::ProgramPipelineImpl> mProgramPipeline;
+
+ ProgramPipelineState mState;
+};
+} // namespace gl
+
+#endif // LIBANGLE_PROGRAMPIPELINE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Query.cpp b/gfx/angle/checkout/src/libANGLE/Query.cpp
new file mode 100644
index 0000000000..085656d328
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Query.cpp
@@ -0,0 +1,86 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query.cpp: Implements the gl::Query class
+
+#include "libANGLE/Query.h"
+#include "libANGLE/renderer/QueryImpl.h"
+
+namespace gl
+{
+Query::Query(rx::QueryImpl *impl, GLuint id) : RefCountObject(id), mQuery(impl), mLabel() {}
+
+Query::~Query()
+{
+ SafeDelete(mQuery);
+}
+
+void Query::onDestroy(const Context *context)
+{
+ ASSERT(mQuery);
+ mQuery->onDestroy(context);
+}
+
+void Query::setLabel(const Context *context, const std::string &label)
+{
+ mLabel = label;
+}
+
+const std::string &Query::getLabel() const
+{
+ return mLabel;
+}
+
+angle::Result Query::begin(const Context *context)
+{
+ return mQuery->begin(context);
+}
+
+angle::Result Query::end(const Context *context)
+{
+ return mQuery->end(context);
+}
+
+angle::Result Query::queryCounter(const Context *context)
+{
+ return mQuery->queryCounter(context);
+}
+
+angle::Result Query::getResult(const Context *context, GLint *params)
+{
+ return mQuery->getResult(context, params);
+}
+
+angle::Result Query::getResult(const Context *context, GLuint *params)
+{
+ return mQuery->getResult(context, params);
+}
+
+angle::Result Query::getResult(const Context *context, GLint64 *params)
+{
+ return mQuery->getResult(context, params);
+}
+
+angle::Result Query::getResult(const Context *context, GLuint64 *params)
+{
+ return mQuery->getResult(context, params);
+}
+
+angle::Result Query::isResultAvailable(const Context *context, bool *available)
+{
+ return mQuery->isResultAvailable(context, available);
+}
+
+QueryType Query::getType() const
+{
+ return mQuery->getType();
+}
+
+rx::QueryImpl *Query::getImplementation() const
+{
+ return mQuery;
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Query.h b/gfx/angle/checkout/src/libANGLE/Query.h
new file mode 100644
index 0000000000..a14b32220b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Query.h
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query.h: Defines the gl::Query class
+
+#ifndef LIBANGLE_QUERY_H_
+#define LIBANGLE_QUERY_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+
+#include "common/angleutils.h"
+
+#include "angle_gl.h"
+
+namespace rx
+{
+class QueryImpl;
+}
+
+namespace gl
+{
+
+class Query final : public RefCountObject, public LabeledObject
+{
+ public:
+ Query(rx::QueryImpl *impl, GLuint id);
+ ~Query() override;
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ angle::Result begin(const Context *context);
+ angle::Result end(const Context *context);
+ angle::Result queryCounter(const Context *context);
+ angle::Result getResult(const Context *context, GLint *params);
+ angle::Result getResult(const Context *context, GLuint *params);
+ angle::Result getResult(const Context *context, GLint64 *params);
+ angle::Result getResult(const Context *context, GLuint64 *params);
+ angle::Result isResultAvailable(const Context *context, bool *available);
+
+ QueryType getType() const;
+
+ rx::QueryImpl *getImplementation() const;
+
+ private:
+ rx::QueryImpl *mQuery;
+
+ std::string mLabel;
+};
+} // namespace gl
+
+#endif // LIBANGLE_QUERY_H_
diff --git a/gfx/angle/checkout/src/libANGLE/RefCountObject.h b/gfx/angle/checkout/src/libANGLE/RefCountObject.h
new file mode 100644
index 0000000000..158b636755
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/RefCountObject.h
@@ -0,0 +1,262 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RefCountObject.h: Defines the gl::RefCountObject base class that provides
+// lifecycle support for GL objects using the traditional BindObject scheme, but
+// that need to be reference counted for correct cross-context deletion.
+// (Concretely, textures, buffers and renderbuffers.)
+
+#ifndef LIBANGLE_REFCOUNTOBJECT_H_
+#define LIBANGLE_REFCOUNTOBJECT_H_
+
+#include "angle_gl.h"
+#include "common/debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/Observer.h"
+
+#include <cstddef>
+
+namespace angle
+{
+
+template <typename ContextT, typename ErrorT>
+class RefCountObject : angle::NonCopyable
+{
+ public:
+ using ContextType = ContextT;
+ using ErrorType = ErrorT;
+
+ RefCountObject() : mRefCount(0) {}
+
+ virtual void onDestroy(const ContextType *context) {}
+
+ void addRef() const { ++mRefCount; }
+
+ ANGLE_INLINE void release(const ContextType *context)
+ {
+ ASSERT(mRefCount > 0);
+ if (--mRefCount == 0)
+ {
+ onDestroy(context);
+ delete this;
+ }
+ }
+
+ size_t getRefCount() const { return mRefCount; }
+
+ protected:
+ virtual ~RefCountObject() { ASSERT(mRefCount == 0); }
+
+ mutable size_t mRefCount;
+};
+
+template <class ObjectType, typename ContextT, typename ErrorT = angle::Result>
+class BindingPointer
+{
+ public:
+ using ContextType = ContextT;
+ using ErrorType = ErrorT;
+
+ BindingPointer() : mObject(nullptr) {}
+
+ BindingPointer(ObjectType *object) : mObject(object)
+ {
+ if (mObject)
+ {
+ mObject->addRef();
+ }
+ }
+
+ BindingPointer(const BindingPointer &other) : mObject(other.mObject)
+ {
+ if (mObject)
+ {
+ mObject->addRef();
+ }
+ }
+
+ BindingPointer &operator=(BindingPointer &&other)
+ {
+ std::swap(mObject, other.mObject);
+ return *this;
+ }
+
+ virtual ~BindingPointer()
+ {
+ // Objects have to be released before the resource manager is destroyed, so they must be
+ // explicitly cleaned up.
+ ASSERT(mObject == nullptr);
+ }
+
+ void set(const ContextType *context, ObjectType *newObject)
+ {
+ // addRef first in case newObject == mObject and this is the last reference to it.
+ if (newObject != nullptr)
+ {
+ reinterpret_cast<RefCountObject<ContextType, ErrorType> *>(newObject)->addRef();
+ }
+
+ // Store the old pointer in a temporary so we can set the pointer before calling release.
+ // Otherwise the object could still be referenced when its destructor is called.
+ ObjectType *oldObject = mObject;
+ mObject = newObject;
+ if (oldObject != nullptr)
+ {
+ reinterpret_cast<RefCountObject<ContextType, ErrorType> *>(oldObject)->release(context);
+ }
+ }
+
+ void assign(ObjectType *object) { mObject = object; }
+
+ ObjectType *get() const { return mObject; }
+ ObjectType *operator->() const { return mObject; }
+
+ bool operator==(const BindingPointer &other) const { return mObject == other.mObject; }
+
+ bool operator!=(const BindingPointer &other) const { return !(*this == other); }
+
+ protected:
+ ANGLE_INLINE void setImpl(ObjectType *obj) { mObject = obj; }
+
+ private:
+ ObjectType *mObject;
+};
+} // namespace angle
+
+namespace gl
+{
+class Context;
+
+template <class ObjectType>
+class BindingPointer;
+
+using RefCountObjectNoID = angle::RefCountObject<Context, angle::Result>;
+
+class RefCountObject : public gl::RefCountObjectNoID
+{
+ public:
+ explicit RefCountObject(GLuint id) : mId(id) {}
+
+ GLuint id() const { return mId; }
+
+ protected:
+ ~RefCountObject() override {}
+
+ private:
+ GLuint mId;
+};
+
+template <class ObjectType>
+class BindingPointer : public angle::BindingPointer<ObjectType, Context>
+{
+ public:
+ using ContextType = typename angle::BindingPointer<ObjectType, Context>::ContextType;
+ using ErrorType = typename angle::BindingPointer<ObjectType, Context>::ErrorType;
+
+ BindingPointer() {}
+
+ BindingPointer(ObjectType *object) : angle::BindingPointer<ObjectType, Context>(object) {}
+
+ GLuint id() const
+ {
+ ObjectType *obj = this->get();
+ return obj ? obj->id() : 0;
+ }
+};
+
+template <class ObjectType>
+class OffsetBindingPointer : public BindingPointer<ObjectType>
+{
+ public:
+ using ContextType = typename BindingPointer<ObjectType>::ContextType;
+ using ErrorType = typename BindingPointer<ObjectType>::ErrorType;
+
+ OffsetBindingPointer() : mOffset(0), mSize(0) {}
+
+ void set(const ContextType *context, ObjectType *newObject, GLintptr offset, GLsizeiptr size)
+ {
+ set(context, newObject);
+ mOffset = offset;
+ mSize = size;
+ }
+
+ GLintptr getOffset() const { return mOffset; }
+ GLsizeiptr getSize() const { return mSize; }
+
+ bool operator==(const OffsetBindingPointer<ObjectType> &other) const
+ {
+ return this->get() == other.get() && mOffset == other.mOffset && mSize == other.mSize;
+ }
+
+ bool operator!=(const OffsetBindingPointer<ObjectType> &other) const
+ {
+ return !(*this == other);
+ }
+
+ void assign(ObjectType *object, GLintptr offset, GLsizeiptr size)
+ {
+ assign(object);
+ mOffset = offset;
+ mSize = size;
+ }
+
+ private:
+ // Delete the unparameterized functions. This forces an explicit offset and size.
+ using BindingPointer<ObjectType>::set;
+ using BindingPointer<ObjectType>::assign;
+
+ GLintptr mOffset;
+ GLsizeiptr mSize;
+};
+
+template <typename SubjectT>
+class SubjectBindingPointer : protected BindingPointer<SubjectT>, public angle::ObserverBindingBase
+{
+ public:
+ SubjectBindingPointer(angle::ObserverInterface *observer, angle::SubjectIndex index)
+ : ObserverBindingBase(observer, index)
+ {}
+ ~SubjectBindingPointer() {}
+ SubjectBindingPointer(const SubjectBindingPointer &other) = default;
+ SubjectBindingPointer &operator=(const SubjectBindingPointer &other) = default;
+
+ void bind(const Context *context, SubjectT *subject)
+ {
+ // AddRef first in case subject == get()
+ if (subject)
+ {
+ subject->addObserver(this);
+ subject->addRef();
+ }
+
+ if (get())
+ {
+ get()->removeObserver(this);
+ get()->release(context);
+ }
+
+ this->setImpl(subject);
+ }
+
+ using BindingPointer<SubjectT>::get;
+ using BindingPointer<SubjectT>::operator->;
+
+ friend class State;
+};
+} // namespace gl
+
+namespace egl
+{
+class Display;
+
+using RefCountObject = angle::RefCountObject<Display, Error>;
+
+template <class ObjectType>
+using BindingPointer = angle::BindingPointer<ObjectType, Display, Error>;
+
+} // namespace egl
+
+#endif // LIBANGLE_REFCOUNTOBJECT_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp b/gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp
new file mode 100644
index 0000000000..de073bfcd3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp
@@ -0,0 +1,283 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderbuffer.cpp: Implements the renderer-agnostic gl::Renderbuffer class,
+// GL renderbuffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#include "libANGLE/Renderbuffer.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+
+namespace gl
+{
+// RenderbufferState implementation.
+RenderbufferState::RenderbufferState()
+ : mWidth(0), mHeight(0), mFormat(GL_RGBA4), mSamples(0), mInitState(InitState::MayNeedInit)
+{}
+
+RenderbufferState::~RenderbufferState() {}
+
+GLsizei RenderbufferState::getWidth() const
+{
+ return mWidth;
+}
+
+GLsizei RenderbufferState::getHeight() const
+{
+ return mHeight;
+}
+
+const Format &RenderbufferState::getFormat() const
+{
+ return mFormat;
+}
+
+GLsizei RenderbufferState::getSamples() const
+{
+ return mSamples;
+}
+
+void RenderbufferState::update(GLsizei width,
+ GLsizei height,
+ const Format &format,
+ GLsizei samples,
+ InitState initState)
+{
+ mWidth = static_cast<GLsizei>(width);
+ mHeight = static_cast<GLsizei>(height);
+ mFormat = format;
+ mSamples = samples;
+ mInitState = InitState::MayNeedInit;
+}
+
+// Renderbuffer implementation.
+Renderbuffer::Renderbuffer(rx::GLImplFactory *implFactory, GLuint id)
+ : RefCountObject(id),
+ mState(),
+ mImplementation(implFactory->createRenderbuffer(mState)),
+ mLabel()
+{}
+
+void Renderbuffer::onDestroy(const Context *context)
+{
+ (void)(orphanImages(context));
+
+ if (mImplementation)
+ {
+ mImplementation->onDestroy(context);
+ }
+}
+
+Renderbuffer::~Renderbuffer() {}
+
+void Renderbuffer::setLabel(const Context *context, const std::string &label)
+{
+ mLabel = label;
+}
+
+const std::string &Renderbuffer::getLabel() const
+{
+ return mLabel;
+}
+
+angle::Result Renderbuffer::setStorage(const Context *context,
+ GLenum internalformat,
+ size_t width,
+ size_t height)
+{
+ ANGLE_TRY(orphanImages(context));
+ ANGLE_TRY(mImplementation->setStorage(context, internalformat, width, height));
+
+ mState.update(static_cast<GLsizei>(width), static_cast<GLsizei>(height), Format(internalformat),
+ 0, InitState::MayNeedInit);
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderbuffer::setStorageMultisample(const Context *context,
+ size_t samples,
+ GLenum internalformat,
+ size_t width,
+ size_t height)
+{
+ ANGLE_TRY(orphanImages(context));
+ ANGLE_TRY(
+ mImplementation->setStorageMultisample(context, samples, internalformat, width, height));
+
+ mState.update(static_cast<GLsizei>(width), static_cast<GLsizei>(height), Format(internalformat),
+ static_cast<GLsizei>(samples), InitState::MayNeedInit);
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderbuffer::setStorageEGLImageTarget(const Context *context, egl::Image *image)
+{
+ ANGLE_TRY(orphanImages(context));
+ ANGLE_TRY(mImplementation->setStorageEGLImageTarget(context, image));
+
+ setTargetImage(context, image);
+
+ mState.update(static_cast<GLsizei>(image->getWidth()), static_cast<GLsizei>(image->getHeight()),
+ Format(image->getFormat()), 0, image->sourceInitState());
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+
+ return angle::Result::Continue;
+}
+
+rx::RenderbufferImpl *Renderbuffer::getImplementation() const
+{
+ ASSERT(mImplementation);
+ return mImplementation.get();
+}
+
+GLsizei Renderbuffer::getWidth() const
+{
+ return mState.mWidth;
+}
+
+GLsizei Renderbuffer::getHeight() const
+{
+ return mState.mHeight;
+}
+
+const Format &Renderbuffer::getFormat() const
+{
+ return mState.mFormat;
+}
+
+GLsizei Renderbuffer::getSamples() const
+{
+ return mState.mSamples;
+}
+
+GLuint Renderbuffer::getRedSize() const
+{
+ return mState.mFormat.info->redBits;
+}
+
+GLuint Renderbuffer::getGreenSize() const
+{
+ return mState.mFormat.info->greenBits;
+}
+
+GLuint Renderbuffer::getBlueSize() const
+{
+ return mState.mFormat.info->blueBits;
+}
+
+GLuint Renderbuffer::getAlphaSize() const
+{
+ return mState.mFormat.info->alphaBits;
+}
+
+GLuint Renderbuffer::getDepthSize() const
+{
+ return mState.mFormat.info->depthBits;
+}
+
+GLuint Renderbuffer::getStencilSize() const
+{
+ return mState.mFormat.info->stencilBits;
+}
+
+GLint Renderbuffer::getMemorySize() const
+{
+ GLint implSize = mImplementation->getMemorySize();
+ if (implSize > 0)
+ {
+ return implSize;
+ }
+
+ // Assume allocated size is around width * height * samples * pixelBytes
+ angle::CheckedNumeric<GLint> size = 1;
+ size *= mState.mFormat.info->pixelBytes;
+ size *= mState.mWidth;
+ size *= mState.mHeight;
+ size *= std::max(mState.mSamples, 1);
+ return size.ValueOrDefault(std::numeric_limits<GLint>::max());
+}
+
+void Renderbuffer::onAttach(const Context *context)
+{
+ addRef();
+}
+
+void Renderbuffer::onDetach(const Context *context)
+{
+ release(context);
+}
+
+GLuint Renderbuffer::getId() const
+{
+ return id();
+}
+
+Extents Renderbuffer::getAttachmentSize(const gl::ImageIndex & /*imageIndex*/) const
+{
+ return Extents(mState.mWidth, mState.mHeight, 1);
+}
+
+Format Renderbuffer::getAttachmentFormat(GLenum /*binding*/,
+ const ImageIndex & /*imageIndex*/) const
+{
+ return getFormat();
+}
+GLsizei Renderbuffer::getAttachmentSamples(const ImageIndex & /*imageIndex*/) const
+{
+ return getSamples();
+}
+
+bool Renderbuffer::isRenderable(const Context *context,
+ GLenum binding,
+ const ImageIndex &imageIndex) const
+{
+ if (isEGLImageTarget())
+ {
+ return ImageSibling::isRenderable(context, binding, imageIndex);
+ }
+ return getFormat().info->renderbufferSupport(context->getClientVersion(),
+ context->getExtensions());
+}
+
+InitState Renderbuffer::initState(const gl::ImageIndex & /*imageIndex*/) const
+{
+ if (isEGLImageTarget())
+ {
+ return sourceEGLImageInitState();
+ }
+
+ return mState.mInitState;
+}
+
+void Renderbuffer::setInitState(const gl::ImageIndex & /*imageIndex*/, InitState initState)
+{
+ if (isEGLImageTarget())
+ {
+ setSourceEGLImageInitState(initState);
+ }
+ else
+ {
+ mState.mInitState = initState;
+ }
+}
+
+rx::FramebufferAttachmentObjectImpl *Renderbuffer::getAttachmentImpl() const
+{
+ return mImplementation.get();
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Renderbuffer.h b/gfx/angle/checkout/src/libANGLE/Renderbuffer.h
new file mode 100644
index 0000000000..d2cf07824f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Renderbuffer.h
@@ -0,0 +1,127 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderbuffer.h: Defines the renderer-agnostic container class gl::Renderbuffer.
+// Implements GL renderbuffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#ifndef LIBANGLE_RENDERBUFFER_H_
+#define LIBANGLE_RENDERBUFFER_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/RenderbufferImpl.h"
+
+namespace rx
+{
+class GLImplFactory;
+} // namespace rx
+
+namespace gl
+{
+// A GL renderbuffer object is usually used as a depth or stencil buffer attachment
+// for a framebuffer object. The renderbuffer itself is a distinct GL object, see
+// FramebufferAttachment and Framebuffer for how they are applied to an FBO via an
+// attachment point.
+
+class RenderbufferState final : angle::NonCopyable
+{
+ public:
+ RenderbufferState();
+ ~RenderbufferState();
+
+ GLsizei getWidth() const;
+ GLsizei getHeight() const;
+ const Format &getFormat() const;
+ GLsizei getSamples() const;
+
+ private:
+ friend class Renderbuffer;
+
+ void update(GLsizei width,
+ GLsizei height,
+ const Format &format,
+ GLsizei samples,
+ InitState initState);
+
+ GLsizei mWidth;
+ GLsizei mHeight;
+ Format mFormat;
+ GLsizei mSamples;
+
+ // For robust resource init.
+ InitState mInitState;
+};
+
+class Renderbuffer final : public RefCountObject, public egl::ImageSibling, public LabeledObject
+{
+ public:
+ Renderbuffer(rx::GLImplFactory *implFactory, GLuint id);
+ ~Renderbuffer() override;
+
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ angle::Result setStorage(const Context *context,
+ GLenum internalformat,
+ size_t width,
+ size_t height);
+ angle::Result setStorageMultisample(const Context *context,
+ size_t samples,
+ GLenum internalformat,
+ size_t width,
+ size_t height);
+ angle::Result setStorageEGLImageTarget(const Context *context, egl::Image *imageTarget);
+
+ rx::RenderbufferImpl *getImplementation() const;
+
+ GLsizei getWidth() const;
+ GLsizei getHeight() const;
+ const Format &getFormat() const;
+ GLsizei getSamples() const;
+ GLuint getRedSize() const;
+ GLuint getGreenSize() const;
+ GLuint getBlueSize() const;
+ GLuint getAlphaSize() const;
+ GLuint getDepthSize() const;
+ GLuint getStencilSize() const;
+
+ GLint getMemorySize() const;
+
+ // FramebufferAttachmentObject Impl
+ Extents getAttachmentSize(const ImageIndex &imageIndex) const override;
+ Format getAttachmentFormat(GLenum binding, const ImageIndex &imageIndex) const override;
+ GLsizei getAttachmentSamples(const ImageIndex &imageIndex) const override;
+ bool isRenderable(const Context *context,
+ GLenum binding,
+ const ImageIndex &imageIndex) const override;
+
+ void onAttach(const Context *context) override;
+ void onDetach(const Context *context) override;
+ GLuint getId() const override;
+
+ InitState initState(const ImageIndex &imageIndex) const override;
+ void setInitState(const ImageIndex &imageIndex, InitState initState) override;
+
+ private:
+ rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override;
+
+ RenderbufferState mState;
+ std::unique_ptr<rx::RenderbufferImpl> mImplementation;
+
+ std::string mLabel;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_RENDERBUFFER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/ResourceManager.cpp b/gfx/angle/checkout/src/libANGLE/ResourceManager.cpp
new file mode 100644
index 0000000000..133cfba483
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ResourceManager.cpp
@@ -0,0 +1,579 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ResourceManager.cpp: Implements the the ResourceManager classes, which handle allocation and
+// lifetime of GL objects.
+
+#include "libANGLE/ResourceManager.h"
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Fence.h"
+#include "libANGLE/MemoryObject.h"
+#include "libANGLE/Path.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/ProgramPipeline.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Sampler.h"
+#include "libANGLE/Semaphore.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/renderer/ContextImpl.h"
+
+namespace gl
+{
+
+namespace
+{
+
+template <typename ResourceType>
+GLuint AllocateEmptyObject(HandleAllocator *handleAllocator, ResourceMap<ResourceType> *objectMap)
+{
+ GLuint handle = handleAllocator->allocate();
+ objectMap->assign(handle, nullptr);
+ return handle;
+}
+
+} // anonymous namespace
+
+template <typename HandleAllocatorType>
+ResourceManagerBase<HandleAllocatorType>::ResourceManagerBase() : mRefCount(1)
+{}
+
+template <typename HandleAllocatorType>
+void ResourceManagerBase<HandleAllocatorType>::addRef()
+{
+ mRefCount++;
+}
+
+template <typename HandleAllocatorType>
+void ResourceManagerBase<HandleAllocatorType>::release(const Context *context)
+{
+ if (--mRefCount == 0)
+ {
+ reset(context);
+ delete this;
+ }
+}
+
+template <typename ResourceType, typename HandleAllocatorType, typename ImplT>
+TypedResourceManager<ResourceType, HandleAllocatorType, ImplT>::~TypedResourceManager()
+{
+ ASSERT(mObjectMap.empty());
+}
+
+template <typename ResourceType, typename HandleAllocatorType, typename ImplT>
+void TypedResourceManager<ResourceType, HandleAllocatorType, ImplT>::reset(const Context *context)
+{
+ this->mHandleAllocator.reset();
+ for (const auto &resource : mObjectMap)
+ {
+ if (resource.second)
+ {
+ ImplT::DeleteObject(context, resource.second);
+ }
+ }
+ mObjectMap.clear();
+}
+
+template <typename ResourceType, typename HandleAllocatorType, typename ImplT>
+void TypedResourceManager<ResourceType, HandleAllocatorType, ImplT>::deleteObject(
+ const Context *context,
+ GLuint handle)
+{
+ ResourceType *resource = nullptr;
+ if (!mObjectMap.erase(handle, &resource))
+ {
+ return;
+ }
+
+ // Requires an explicit this-> because of C++ template rules.
+ this->mHandleAllocator.release(handle);
+
+ if (resource)
+ {
+ ImplT::DeleteObject(context, resource);
+ }
+}
+
+template class ResourceManagerBase<HandleAllocator>;
+template class ResourceManagerBase<HandleRangeAllocator>;
+template class TypedResourceManager<Buffer, HandleAllocator, BufferManager>;
+template class TypedResourceManager<Texture, HandleAllocator, TextureManager>;
+template class TypedResourceManager<Renderbuffer, HandleAllocator, RenderbufferManager>;
+template class TypedResourceManager<Sampler, HandleAllocator, SamplerManager>;
+template class TypedResourceManager<Sync, HandleAllocator, SyncManager>;
+template class TypedResourceManager<Framebuffer, HandleAllocator, FramebufferManager>;
+template class TypedResourceManager<ProgramPipeline, HandleAllocator, ProgramPipelineManager>;
+
+// BufferManager Implementation.
+
+// static
+Buffer *BufferManager::AllocateNewObject(rx::GLImplFactory *factory, GLuint handle)
+{
+ Buffer *buffer = new Buffer(factory, handle);
+ buffer->addRef();
+ return buffer;
+}
+
+// static
+void BufferManager::DeleteObject(const Context *context, Buffer *buffer)
+{
+ buffer->release(context);
+}
+
+GLuint BufferManager::createBuffer()
+{
+ return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
+}
+
+Buffer *BufferManager::getBuffer(GLuint handle) const
+{
+ return mObjectMap.query(handle);
+}
+
+// ShaderProgramManager Implementation.
+
+ShaderProgramManager::ShaderProgramManager() {}
+
+ShaderProgramManager::~ShaderProgramManager()
+{
+ ASSERT(mPrograms.empty());
+ ASSERT(mShaders.empty());
+}
+
+void ShaderProgramManager::reset(const Context *context)
+{
+ while (!mPrograms.empty())
+ {
+ deleteProgram(context, mPrograms.begin()->first);
+ }
+ mPrograms.clear();
+ while (!mShaders.empty())
+ {
+ deleteShader(context, mShaders.begin()->first);
+ }
+ mShaders.clear();
+}
+
+GLuint ShaderProgramManager::createShader(rx::GLImplFactory *factory,
+ const gl::Limitations &rendererLimitations,
+ ShaderType type)
+{
+ ASSERT(type != ShaderType::InvalidEnum);
+ GLuint handle = mHandleAllocator.allocate();
+ mShaders.assign(handle, new Shader(this, factory, rendererLimitations, type, handle));
+ return handle;
+}
+
+void ShaderProgramManager::deleteShader(const Context *context, GLuint shader)
+{
+ deleteObject(context, &mShaders, shader);
+}
+
+Shader *ShaderProgramManager::getShader(GLuint handle) const
+{
+ return mShaders.query(handle);
+}
+
+GLuint ShaderProgramManager::createProgram(rx::GLImplFactory *factory)
+{
+ GLuint handle = mHandleAllocator.allocate();
+ mPrograms.assign(handle, new Program(factory, this, handle));
+ return handle;
+}
+
+void ShaderProgramManager::deleteProgram(const gl::Context *context, GLuint program)
+{
+ deleteObject(context, &mPrograms, program);
+}
+
+template <typename ObjectType>
+void ShaderProgramManager::deleteObject(const Context *context,
+ ResourceMap<ObjectType> *objectMap,
+ GLuint id)
+{
+ ObjectType *object = objectMap->query(id);
+ if (!object)
+ {
+ return;
+ }
+
+ if (object->getRefCount() == 0)
+ {
+ mHandleAllocator.release(id);
+ object->onDestroy(context);
+ objectMap->erase(id, &object);
+ }
+ else
+ {
+ object->flagForDeletion();
+ }
+}
+
+// TextureManager Implementation.
+
+// static
+Texture *TextureManager::AllocateNewObject(rx::GLImplFactory *factory,
+ GLuint handle,
+ TextureType type)
+{
+ Texture *texture = new Texture(factory, handle, type);
+ texture->addRef();
+ return texture;
+}
+
+// static
+void TextureManager::DeleteObject(const Context *context, Texture *texture)
+{
+ texture->release(context);
+}
+
+GLuint TextureManager::createTexture()
+{
+ return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
+}
+
+void TextureManager::signalAllTexturesDirty() const
+{
+ for (const auto &texture : mObjectMap)
+ {
+ if (texture.second)
+ {
+ // We don't know if the Texture needs init, but that's ok, since it will only force
+ // a re-check, and will not initialize the pixels if it's not needed.
+ texture.second->signalDirtyStorage(InitState::MayNeedInit);
+ }
+ }
+}
+
+void TextureManager::enableHandleAllocatorLogging()
+{
+ mHandleAllocator.enableLogging(true);
+}
+
+// RenderbufferManager Implementation.
+
+// static
+Renderbuffer *RenderbufferManager::AllocateNewObject(rx::GLImplFactory *factory, GLuint handle)
+{
+ Renderbuffer *renderbuffer = new Renderbuffer(factory, handle);
+ renderbuffer->addRef();
+ return renderbuffer;
+}
+
+// static
+void RenderbufferManager::DeleteObject(const Context *context, Renderbuffer *renderbuffer)
+{
+ renderbuffer->release(context);
+}
+
+GLuint RenderbufferManager::createRenderbuffer()
+{
+ return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
+}
+
+Renderbuffer *RenderbufferManager::getRenderbuffer(GLuint handle) const
+{
+ return mObjectMap.query(handle);
+}
+
+// SamplerManager Implementation.
+
+// static
+Sampler *SamplerManager::AllocateNewObject(rx::GLImplFactory *factory, GLuint handle)
+{
+ Sampler *sampler = new Sampler(factory, handle);
+ sampler->addRef();
+ return sampler;
+}
+
+// static
+void SamplerManager::DeleteObject(const Context *context, Sampler *sampler)
+{
+ sampler->release(context);
+}
+
+GLuint SamplerManager::createSampler()
+{
+ return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
+}
+
+Sampler *SamplerManager::getSampler(GLuint handle) const
+{
+ return mObjectMap.query(handle);
+}
+
+bool SamplerManager::isSampler(GLuint sampler) const
+{
+ return mObjectMap.contains(sampler);
+}
+
+// SyncManager Implementation.
+
+// static
+void SyncManager::DeleteObject(const Context *context, Sync *sync)
+{
+ sync->release(context);
+}
+
+GLuint SyncManager::createSync(rx::GLImplFactory *factory)
+{
+ GLuint handle = mHandleAllocator.allocate();
+ Sync *sync = new Sync(factory->createSync(), handle);
+ sync->addRef();
+ mObjectMap.assign(handle, sync);
+ return handle;
+}
+
+Sync *SyncManager::getSync(GLuint handle) const
+{
+ return mObjectMap.query(handle);
+}
+
+// PathManager Implementation.
+
+PathManager::PathManager() = default;
+
+angle::Result PathManager::createPaths(Context *context, GLsizei range, GLuint *createdOut)
+{
+ *createdOut = 0;
+
+ // Allocate client side handles.
+ const GLuint client = mHandleAllocator.allocateRange(static_cast<GLuint>(range));
+ if (client == HandleRangeAllocator::kInvalidHandle)
+ {
+ context->handleError(GL_OUT_OF_MEMORY, "Failed to allocate path handle range.", __FILE__,
+ ANGLE_FUNCTION, __LINE__);
+ return angle::Result::Stop;
+ }
+
+ const auto &paths = context->getImplementation()->createPaths(range);
+ if (paths.empty())
+ {
+ mHandleAllocator.releaseRange(client, range);
+ context->handleError(GL_OUT_OF_MEMORY, "Failed to allocate path objects.", __FILE__,
+ ANGLE_FUNCTION, __LINE__);
+ return angle::Result::Stop;
+ }
+
+ for (GLsizei i = 0; i < range; ++i)
+ {
+ rx::PathImpl *impl = paths[static_cast<unsigned>(i)];
+ const auto id = client + i;
+ mPaths.assign(id, new Path(impl));
+ }
+ *createdOut = client;
+ return angle::Result::Continue;
+}
+
+void PathManager::deletePaths(GLuint first, GLsizei range)
+{
+ for (GLsizei i = 0; i < range; ++i)
+ {
+ const auto id = first + i;
+ Path *p = nullptr;
+ if (!mPaths.erase(id, &p))
+ continue;
+ delete p;
+ }
+ mHandleAllocator.releaseRange(first, static_cast<GLuint>(range));
+}
+
+Path *PathManager::getPath(GLuint handle) const
+{
+ return mPaths.query(handle);
+}
+
+bool PathManager::hasPath(GLuint handle) const
+{
+ return mHandleAllocator.isUsed(handle);
+}
+
+PathManager::~PathManager()
+{
+ ASSERT(mPaths.empty());
+}
+
+void PathManager::reset(const Context *context)
+{
+ for (auto path : mPaths)
+ {
+ SafeDelete(path.second);
+ }
+ mPaths.clear();
+}
+
+// FramebufferManager Implementation.
+
+// static
+Framebuffer *FramebufferManager::AllocateNewObject(rx::GLImplFactory *factory,
+ GLuint handle,
+ const Caps &caps)
+{
+ return new Framebuffer(caps, factory, handle);
+}
+
+// static
+void FramebufferManager::DeleteObject(const Context *context, Framebuffer *framebuffer)
+{
+ framebuffer->onDestroy(context);
+ delete framebuffer;
+}
+
+GLuint FramebufferManager::createFramebuffer()
+{
+ return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
+}
+
+Framebuffer *FramebufferManager::getFramebuffer(GLuint handle) const
+{
+ return mObjectMap.query(handle);
+}
+
+void FramebufferManager::setDefaultFramebuffer(Framebuffer *framebuffer)
+{
+ ASSERT(framebuffer == nullptr || framebuffer->id() == 0);
+ mObjectMap.assign(0, framebuffer);
+}
+
+void FramebufferManager::invalidateFramebufferComplenessCache() const
+{
+ for (const auto &framebuffer : mObjectMap)
+ {
+ if (framebuffer.second)
+ {
+ framebuffer.second->invalidateCompletenessCache();
+ }
+ }
+}
+
+// ProgramPipelineManager Implementation.
+
+// static
+ProgramPipeline *ProgramPipelineManager::AllocateNewObject(rx::GLImplFactory *factory,
+ GLuint handle)
+{
+ ProgramPipeline *pipeline = new ProgramPipeline(factory, handle);
+ pipeline->addRef();
+ return pipeline;
+}
+
+// static
+void ProgramPipelineManager::DeleteObject(const Context *context, ProgramPipeline *pipeline)
+{
+ pipeline->release(context);
+}
+
+GLuint ProgramPipelineManager::createProgramPipeline()
+{
+ return AllocateEmptyObject(&mHandleAllocator, &mObjectMap);
+}
+
+ProgramPipeline *ProgramPipelineManager::getProgramPipeline(GLuint handle) const
+{
+ return mObjectMap.query(handle);
+}
+
+// MemoryObjectManager Implementation.
+
+MemoryObjectManager::MemoryObjectManager() {}
+
+MemoryObjectManager::~MemoryObjectManager()
+{
+ ASSERT(mMemoryObjects.empty());
+}
+
+void MemoryObjectManager::reset(const Context *context)
+{
+ while (!mMemoryObjects.empty())
+ {
+ deleteMemoryObject(context, mMemoryObjects.begin()->first);
+ }
+ mMemoryObjects.clear();
+}
+
+GLuint MemoryObjectManager::createMemoryObject(rx::GLImplFactory *factory)
+{
+ GLuint handle = mHandleAllocator.allocate();
+ MemoryObject *memoryObject = new MemoryObject(factory, handle);
+ memoryObject->addRef();
+ mMemoryObjects.assign(handle, memoryObject);
+ return handle;
+}
+
+void MemoryObjectManager::deleteMemoryObject(const Context *context, GLuint handle)
+{
+ MemoryObject *memoryObject = nullptr;
+ if (!mMemoryObjects.erase(handle, &memoryObject))
+ {
+ return;
+ }
+
+ // Requires an explicit this-> because of C++ template rules.
+ this->mHandleAllocator.release(handle);
+
+ if (memoryObject)
+ {
+ memoryObject->release(context);
+ }
+}
+
+MemoryObject *MemoryObjectManager::getMemoryObject(GLuint handle) const
+{
+ return mMemoryObjects.query(handle);
+}
+
+// SemaphoreManager Implementation.
+
+SemaphoreManager::SemaphoreManager() {}
+
+SemaphoreManager::~SemaphoreManager()
+{
+ ASSERT(mSemaphores.empty());
+}
+
+void SemaphoreManager::reset(const Context *context)
+{
+ while (!mSemaphores.empty())
+ {
+ deleteSemaphore(context, mSemaphores.begin()->first);
+ }
+ mSemaphores.clear();
+}
+
+GLuint SemaphoreManager::createSemaphore(rx::GLImplFactory *factory)
+{
+ GLuint handle = mHandleAllocator.allocate();
+ Semaphore *semaphore = new Semaphore(factory, handle);
+ semaphore->addRef();
+ mSemaphores.assign(handle, semaphore);
+ return handle;
+}
+
+void SemaphoreManager::deleteSemaphore(const Context *context, GLuint handle)
+{
+ Semaphore *semaphore = nullptr;
+ if (!mSemaphores.erase(handle, &semaphore))
+ {
+ return;
+ }
+
+ // Requires an explicit this-> because of C++ template rules.
+ this->mHandleAllocator.release(handle);
+
+ if (semaphore)
+ {
+ semaphore->release(context);
+ }
+}
+
+Semaphore *SemaphoreManager::getSemaphore(GLuint handle) const
+{
+ return mSemaphores.query(handle);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/ResourceManager.h b/gfx/angle/checkout/src/libANGLE/ResourceManager.h
new file mode 100644
index 0000000000..64998b8504
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ResourceManager.h
@@ -0,0 +1,347 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ResourceManager.h : Defines the ResourceManager classes, which handle allocation and lifetime of
+// GL objects.
+
+#ifndef LIBANGLE_RESOURCEMANAGER_H_
+#define LIBANGLE_RESOURCEMANAGER_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/HandleAllocator.h"
+#include "libANGLE/HandleRangeAllocator.h"
+#include "libANGLE/ResourceMap.h"
+
+namespace rx
+{
+class GLImplFactory;
+}
+
+namespace gl
+{
+class Buffer;
+struct Caps;
+class Context;
+class Sync;
+class Framebuffer;
+struct Limitations;
+class MemoryObject;
+class Path;
+class Program;
+class ProgramPipeline;
+class Renderbuffer;
+class Sampler;
+class Shader;
+class Semaphore;
+class Texture;
+
+template <typename HandleAllocatorType>
+class ResourceManagerBase : angle::NonCopyable
+{
+ public:
+ ResourceManagerBase();
+
+ void addRef();
+ void release(const Context *context);
+
+ protected:
+ virtual void reset(const Context *context) = 0;
+ virtual ~ResourceManagerBase() {}
+
+ HandleAllocatorType mHandleAllocator;
+
+ private:
+ size_t mRefCount;
+};
+
+template <typename ResourceType, typename HandleAllocatorType, typename ImplT>
+class TypedResourceManager : public ResourceManagerBase<HandleAllocatorType>
+{
+ public:
+ TypedResourceManager() {}
+
+ void deleteObject(const Context *context, GLuint handle);
+ ANGLE_INLINE bool isHandleGenerated(GLuint handle) const
+ {
+ // Zero is always assumed to have been generated implicitly.
+ return handle == 0 || mObjectMap.contains(handle);
+ }
+
+ protected:
+ ~TypedResourceManager() override;
+
+ // Inlined in the header for performance.
+ template <typename... ArgTypes>
+ ANGLE_INLINE ResourceType *checkObjectAllocation(rx::GLImplFactory *factory,
+ GLuint handle,
+ ArgTypes... args)
+ {
+ ResourceType *value = mObjectMap.query(handle);
+ if (value)
+ {
+ return value;
+ }
+
+ if (handle == 0)
+ {
+ return nullptr;
+ }
+
+ return checkObjectAllocationImpl(factory, handle, args...);
+ }
+
+ void reset(const Context *context) override;
+
+ ResourceMap<ResourceType> mObjectMap;
+
+ private:
+ template <typename... ArgTypes>
+ ResourceType *checkObjectAllocationImpl(rx::GLImplFactory *factory,
+ GLuint handle,
+ ArgTypes... args)
+ {
+ ResourceType *object = ImplT::AllocateNewObject(factory, handle, args...);
+
+ if (!mObjectMap.contains(handle))
+ {
+ this->mHandleAllocator.reserve(handle);
+ }
+ mObjectMap.assign(handle, object);
+
+ return object;
+ }
+};
+
+class BufferManager : public TypedResourceManager<Buffer, HandleAllocator, BufferManager>
+{
+ public:
+ GLuint createBuffer();
+ Buffer *getBuffer(GLuint handle) const;
+
+ ANGLE_INLINE Buffer *checkBufferAllocation(rx::GLImplFactory *factory, GLuint handle)
+ {
+ return checkObjectAllocation(factory, handle);
+ }
+
+ // TODO(jmadill): Investigate design which doesn't expose these methods publicly.
+ static Buffer *AllocateNewObject(rx::GLImplFactory *factory, GLuint handle);
+ static void DeleteObject(const Context *context, Buffer *buffer);
+
+ protected:
+ ~BufferManager() override {}
+};
+
+class ShaderProgramManager : public ResourceManagerBase<HandleAllocator>
+{
+ public:
+ ShaderProgramManager();
+
+ GLuint createShader(rx::GLImplFactory *factory,
+ const Limitations &rendererLimitations,
+ ShaderType type);
+ void deleteShader(const Context *context, GLuint shader);
+ Shader *getShader(GLuint handle) const;
+
+ GLuint createProgram(rx::GLImplFactory *factory);
+ void deleteProgram(const Context *context, GLuint program);
+
+ ANGLE_INLINE Program *getProgram(GLuint handle) const { return mPrograms.query(handle); }
+
+ protected:
+ ~ShaderProgramManager() override;
+
+ private:
+ template <typename ObjectType>
+ void deleteObject(const Context *context, ResourceMap<ObjectType> *objectMap, GLuint id);
+
+ void reset(const Context *context) override;
+
+ ResourceMap<Shader> mShaders;
+ ResourceMap<Program> mPrograms;
+};
+
+class TextureManager : public TypedResourceManager<Texture, HandleAllocator, TextureManager>
+{
+ public:
+ GLuint createTexture();
+ ANGLE_INLINE Texture *getTexture(GLuint handle) const
+ {
+ ASSERT(mObjectMap.query(0) == nullptr);
+ return mObjectMap.query(handle);
+ }
+
+ void signalAllTexturesDirty() const;
+
+ ANGLE_INLINE Texture *checkTextureAllocation(rx::GLImplFactory *factory,
+ GLuint handle,
+ TextureType type)
+ {
+ return checkObjectAllocation(factory, handle, type);
+ }
+
+ static Texture *AllocateNewObject(rx::GLImplFactory *factory, GLuint handle, TextureType type);
+ static void DeleteObject(const Context *context, Texture *texture);
+
+ void enableHandleAllocatorLogging();
+
+ protected:
+ ~TextureManager() override {}
+};
+
+class RenderbufferManager
+ : public TypedResourceManager<Renderbuffer, HandleAllocator, RenderbufferManager>
+{
+ public:
+ GLuint createRenderbuffer();
+ Renderbuffer *getRenderbuffer(GLuint handle) const;
+
+ Renderbuffer *checkRenderbufferAllocation(rx::GLImplFactory *factory, GLuint handle)
+ {
+ return checkObjectAllocation(factory, handle);
+ }
+
+ static Renderbuffer *AllocateNewObject(rx::GLImplFactory *factory, GLuint handle);
+ static void DeleteObject(const Context *context, Renderbuffer *renderbuffer);
+
+ protected:
+ ~RenderbufferManager() override {}
+};
+
+class SamplerManager : public TypedResourceManager<Sampler, HandleAllocator, SamplerManager>
+{
+ public:
+ GLuint createSampler();
+ Sampler *getSampler(GLuint handle) const;
+ bool isSampler(GLuint sampler) const;
+
+ Sampler *checkSamplerAllocation(rx::GLImplFactory *factory, GLuint handle)
+ {
+ return checkObjectAllocation(factory, handle);
+ }
+
+ static Sampler *AllocateNewObject(rx::GLImplFactory *factory, GLuint handle);
+ static void DeleteObject(const Context *context, Sampler *sampler);
+
+ protected:
+ ~SamplerManager() override {}
+};
+
+class SyncManager : public TypedResourceManager<Sync, HandleAllocator, SyncManager>
+{
+ public:
+ GLuint createSync(rx::GLImplFactory *factory);
+ Sync *getSync(GLuint handle) const;
+
+ static void DeleteObject(const Context *context, Sync *sync);
+
+ protected:
+ ~SyncManager() override {}
+};
+
+class PathManager : public ResourceManagerBase<HandleRangeAllocator>
+{
+ public:
+ PathManager();
+
+ angle::Result createPaths(Context *context, GLsizei range, GLuint *numCreated);
+ void deletePaths(GLuint first, GLsizei range);
+ Path *getPath(GLuint handle) const;
+ bool hasPath(GLuint handle) const;
+
+ protected:
+ ~PathManager() override;
+ void reset(const Context *context) override;
+
+ private:
+ ResourceMap<Path> mPaths;
+};
+
+class FramebufferManager
+ : public TypedResourceManager<Framebuffer, HandleAllocator, FramebufferManager>
+{
+ public:
+ GLuint createFramebuffer();
+ Framebuffer *getFramebuffer(GLuint handle) const;
+ void setDefaultFramebuffer(Framebuffer *framebuffer);
+
+ void invalidateFramebufferComplenessCache() const;
+
+ Framebuffer *checkFramebufferAllocation(rx::GLImplFactory *factory,
+ const Caps &caps,
+ GLuint handle)
+ {
+ return checkObjectAllocation<const Caps &>(factory, handle, caps);
+ }
+
+ static Framebuffer *AllocateNewObject(rx::GLImplFactory *factory,
+ GLuint handle,
+ const Caps &caps);
+ static void DeleteObject(const Context *context, Framebuffer *framebuffer);
+
+ protected:
+ ~FramebufferManager() override {}
+};
+
+class ProgramPipelineManager
+ : public TypedResourceManager<ProgramPipeline, HandleAllocator, ProgramPipelineManager>
+{
+ public:
+ GLuint createProgramPipeline();
+ ProgramPipeline *getProgramPipeline(GLuint handle) const;
+
+ ProgramPipeline *checkProgramPipelineAllocation(rx::GLImplFactory *factory, GLuint handle)
+ {
+ return checkObjectAllocation(factory, handle);
+ }
+
+ static ProgramPipeline *AllocateNewObject(rx::GLImplFactory *factory, GLuint handle);
+ static void DeleteObject(const Context *context, ProgramPipeline *pipeline);
+
+ protected:
+ ~ProgramPipelineManager() override {}
+};
+
+class MemoryObjectManager : public ResourceManagerBase<HandleAllocator>
+{
+ public:
+ MemoryObjectManager();
+
+ GLuint createMemoryObject(rx::GLImplFactory *factory);
+ void deleteMemoryObject(const Context *context, GLuint handle);
+ MemoryObject *getMemoryObject(GLuint handle) const;
+
+ protected:
+ ~MemoryObjectManager() override;
+
+ private:
+ void reset(const Context *context) override;
+
+ ResourceMap<MemoryObject> mMemoryObjects;
+};
+
+class SemaphoreManager : public ResourceManagerBase<HandleAllocator>
+{
+ public:
+ SemaphoreManager();
+
+ GLuint createSemaphore(rx::GLImplFactory *factory);
+ void deleteSemaphore(const Context *context, GLuint handle);
+ Semaphore *getSemaphore(GLuint handle) const;
+
+ protected:
+ ~SemaphoreManager() override;
+
+ private:
+ void reset(const Context *context) override;
+
+ ResourceMap<Semaphore> mSemaphores;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_RESOURCEMANAGER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/ResourceMap.h b/gfx/angle/checkout/src/libANGLE/ResourceMap.h
new file mode 100644
index 0000000000..b823f0665b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/ResourceMap.h
@@ -0,0 +1,319 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ResourceMap:
+// An optimized resource map which packs the first set of allocated objects into a
+// flat array, and then falls back to an unordered map for the higher handle values.
+//
+
+#ifndef LIBANGLE_RESOURCE_MAP_H_
+#define LIBANGLE_RESOURCE_MAP_H_
+
+#include "libANGLE/angletypes.h"
+
+namespace gl
+{
+
+template <typename ResourceType>
+class ResourceMap final : angle::NonCopyable
+{
+ public:
+ ResourceMap();
+ ~ResourceMap();
+
+ ANGLE_INLINE ResourceType *query(GLuint handle) const
+ {
+ if (handle < mFlatResourcesSize)
+ {
+ ResourceType *value = mFlatResources[handle];
+ return (value == InvalidPointer() ? nullptr : value);
+ }
+ auto it = mHashedResources.find(handle);
+ return (it == mHashedResources.end() ? nullptr : it->second);
+ }
+
+ // Returns true if the handle was reserved. Not necessarily if the resource is created.
+ bool contains(GLuint handle) const;
+
+ // Returns the element that was at this location.
+ bool erase(GLuint handle, ResourceType **resourceOut);
+
+ void assign(GLuint handle, ResourceType *resource);
+
+ // Clears the map.
+ void clear();
+
+ using IndexAndResource = std::pair<GLuint, ResourceType *>;
+ using HashMap = std::unordered_map<GLuint, ResourceType *>;
+
+ class Iterator final
+ {
+ public:
+ bool operator==(const Iterator &other) const;
+ bool operator!=(const Iterator &other) const;
+ Iterator &operator++();
+ const IndexAndResource *operator->() const;
+ const IndexAndResource &operator*() const;
+
+ private:
+ friend class ResourceMap;
+ Iterator(const ResourceMap &origin,
+ GLuint flatIndex,
+ typename HashMap::const_iterator hashIndex);
+ void updateValue();
+
+ const ResourceMap &mOrigin;
+ GLuint mFlatIndex;
+ typename HashMap::const_iterator mHashIndex;
+ IndexAndResource mValue;
+ };
+
+ // null values represent reserved handles.
+ Iterator begin() const;
+ Iterator end() const;
+ Iterator find(GLuint handle) const;
+
+ // Not a constant-time operation, should only be used for verification.
+ bool empty() const;
+
+ private:
+ friend class Iterator;
+
+ GLuint nextNonNullResource(size_t flatIndex) const;
+
+ // constexpr methods cannot contain reinterpret_cast, so we need a static method.
+ static ResourceType *InvalidPointer();
+ static constexpr intptr_t kInvalidPointer = static_cast<intptr_t>(-1);
+
+ // Start with 32 maximum elements in the map, which can grow.
+ static constexpr size_t kInitialFlatResourcesSize = 0x20;
+
+ // Experimental testing suggests that 16k is a reasonable upper limit.
+ static constexpr size_t kFlatResourcesLimit = 0x4000;
+
+ // Size of one map element.
+ static constexpr size_t kElementSize = sizeof(ResourceType *);
+
+ size_t mFlatResourcesSize;
+ ResourceType **mFlatResources;
+
+ // A map of GL objects indexed by object ID.
+ HashMap mHashedResources;
+};
+
+template <typename ResourceType>
+ResourceMap<ResourceType>::ResourceMap()
+ : mFlatResourcesSize(kInitialFlatResourcesSize),
+ mFlatResources(new ResourceType *[kInitialFlatResourcesSize]),
+ mHashedResources()
+{
+ memset(mFlatResources, kInvalidPointer, mFlatResourcesSize * kElementSize);
+}
+
+template <typename ResourceType>
+ResourceMap<ResourceType>::~ResourceMap()
+{
+ ASSERT(empty());
+ delete[] mFlatResources;
+}
+
+template <typename ResourceType>
+ANGLE_INLINE bool ResourceMap<ResourceType>::contains(GLuint handle) const
+{
+ if (handle < mFlatResourcesSize)
+ {
+ return (mFlatResources[handle] != InvalidPointer());
+ }
+ return (mHashedResources.find(handle) != mHashedResources.end());
+}
+
+template <typename ResourceType>
+bool ResourceMap<ResourceType>::erase(GLuint handle, ResourceType **resourceOut)
+{
+ if (handle < mFlatResourcesSize)
+ {
+ auto &value = mFlatResources[handle];
+ if (value == InvalidPointer())
+ {
+ return false;
+ }
+ *resourceOut = value;
+ value = InvalidPointer();
+ }
+ else
+ {
+ auto it = mHashedResources.find(handle);
+ if (it == mHashedResources.end())
+ {
+ return false;
+ }
+ *resourceOut = it->second;
+ mHashedResources.erase(it);
+ }
+ return true;
+}
+
+template <typename ResourceType>
+void ResourceMap<ResourceType>::assign(GLuint handle, ResourceType *resource)
+{
+ if (handle < kFlatResourcesLimit)
+ {
+ if (handle >= mFlatResourcesSize)
+ {
+ // Use power-of-two.
+ size_t newSize = mFlatResourcesSize;
+ while (newSize <= handle)
+ {
+ newSize *= 2;
+ }
+
+ ResourceType **oldResources = mFlatResources;
+
+ mFlatResources = new ResourceType *[newSize];
+ memset(&mFlatResources[mFlatResourcesSize], kInvalidPointer,
+ (newSize - mFlatResourcesSize) * kElementSize);
+ memcpy(mFlatResources, oldResources, mFlatResourcesSize * kElementSize);
+ mFlatResourcesSize = newSize;
+ delete[] oldResources;
+ }
+ ASSERT(mFlatResourcesSize > handle);
+ mFlatResources[handle] = resource;
+ }
+ else
+ {
+ mHashedResources[handle] = resource;
+ }
+}
+
+template <typename ResourceType>
+typename ResourceMap<ResourceType>::Iterator ResourceMap<ResourceType>::begin() const
+{
+ return Iterator(*this, nextNonNullResource(0), mHashedResources.begin());
+}
+
+template <typename ResourceType>
+typename ResourceMap<ResourceType>::Iterator ResourceMap<ResourceType>::end() const
+{
+ return Iterator(*this, static_cast<GLuint>(mFlatResourcesSize), mHashedResources.end());
+}
+
+template <typename ResourceType>
+typename ResourceMap<ResourceType>::Iterator ResourceMap<ResourceType>::find(GLuint handle) const
+{
+ if (handle < mFlatResourcesSize)
+ {
+ return (mFlatResources[handle] != InvalidPointer()
+ ? Iterator(handle, mHashedResources.begin())
+ : end());
+ }
+ else
+ {
+ return mHashedResources.find(handle);
+ }
+}
+
+template <typename ResourceType>
+bool ResourceMap<ResourceType>::empty() const
+{
+ return (begin() == end());
+}
+
+template <typename ResourceType>
+void ResourceMap<ResourceType>::clear()
+{
+ memset(mFlatResources, kInvalidPointer, kInitialFlatResourcesSize * kElementSize);
+ mFlatResourcesSize = kInitialFlatResourcesSize;
+ mHashedResources.clear();
+}
+
+template <typename ResourceType>
+GLuint ResourceMap<ResourceType>::nextNonNullResource(size_t flatIndex) const
+{
+ for (size_t index = flatIndex; index < mFlatResourcesSize; index++)
+ {
+ if (mFlatResources[index] != nullptr && mFlatResources[index] != InvalidPointer())
+ {
+ return static_cast<GLuint>(index);
+ }
+ }
+ return static_cast<GLuint>(mFlatResourcesSize);
+}
+
+template <typename ResourceType>
+// static
+ResourceType *ResourceMap<ResourceType>::InvalidPointer()
+{
+ return reinterpret_cast<ResourceType *>(kInvalidPointer);
+}
+
+template <typename ResourceType>
+ResourceMap<ResourceType>::Iterator::Iterator(
+ const ResourceMap &origin,
+ GLuint flatIndex,
+ typename ResourceMap<ResourceType>::HashMap::const_iterator hashIndex)
+ : mOrigin(origin), mFlatIndex(flatIndex), mHashIndex(hashIndex), mValue()
+{
+ updateValue();
+}
+
+template <typename ResourceType>
+bool ResourceMap<ResourceType>::Iterator::operator==(const Iterator &other) const
+{
+ return (mFlatIndex == other.mFlatIndex && mHashIndex == other.mHashIndex);
+}
+
+template <typename ResourceType>
+bool ResourceMap<ResourceType>::Iterator::operator!=(const Iterator &other) const
+{
+ return !(*this == other);
+}
+
+template <typename ResourceType>
+typename ResourceMap<ResourceType>::Iterator &ResourceMap<ResourceType>::Iterator::operator++()
+{
+ if (mFlatIndex < static_cast<GLuint>(mOrigin.mFlatResourcesSize))
+ {
+ mFlatIndex = mOrigin.nextNonNullResource(mFlatIndex + 1);
+ }
+ else
+ {
+ mHashIndex++;
+ }
+ updateValue();
+ return *this;
+}
+
+template <typename ResourceType>
+const typename ResourceMap<ResourceType>::IndexAndResource
+ *ResourceMap<ResourceType>::Iterator::operator->() const
+{
+ return &mValue;
+}
+
+template <typename ResourceType>
+const typename ResourceMap<ResourceType>::IndexAndResource
+ &ResourceMap<ResourceType>::Iterator::operator*() const
+{
+ return mValue;
+}
+
+template <typename ResourceType>
+void ResourceMap<ResourceType>::Iterator::updateValue()
+{
+ if (mFlatIndex < static_cast<GLuint>(mOrigin.mFlatResourcesSize))
+ {
+ mValue.first = mFlatIndex;
+ mValue.second = mOrigin.mFlatResources[mFlatIndex];
+ }
+ else if (mHashIndex != mOrigin.mHashedResources.end())
+ {
+ mValue.first = mHashIndex->first;
+ mValue.second = mHashIndex->second;
+ }
+}
+
+} // namespace gl
+
+#endif // LIBANGLE_RESOURCE_MAP_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Sampler.cpp b/gfx/angle/checkout/src/libANGLE/Sampler.cpp
new file mode 100644
index 0000000000..1862a0977c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Sampler.cpp
@@ -0,0 +1,187 @@
+//
+// 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 "libANGLE/Sampler.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/SamplerImpl.h"
+
+namespace gl
+{
+
+Sampler::Sampler(rx::GLImplFactory *factory, GLuint id)
+ : RefCountObject(id), mState(), mImpl(factory->createSampler(mState)), mLabel()
+{}
+
+Sampler::~Sampler()
+{
+ SafeDelete(mImpl);
+}
+
+void Sampler::onDestroy(const Context *context) {}
+
+void Sampler::setLabel(const Context *context, const std::string &label)
+{
+ mLabel = label;
+}
+
+const std::string &Sampler::getLabel() const
+{
+ return mLabel;
+}
+
+void Sampler::setMinFilter(const Context *context, GLenum minFilter)
+{
+ mState.setMinFilter(minFilter);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getMinFilter() const
+{
+ return mState.getMinFilter();
+}
+
+void Sampler::setMagFilter(const Context *context, GLenum magFilter)
+{
+ mState.setMagFilter(magFilter);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getMagFilter() const
+{
+ return mState.getMagFilter();
+}
+
+void Sampler::setWrapS(const Context *context, GLenum wrapS)
+{
+ mState.setWrapS(wrapS);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getWrapS() const
+{
+ return mState.getWrapS();
+}
+
+void Sampler::setWrapT(const Context *context, GLenum wrapT)
+{
+ mState.setWrapT(wrapT);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getWrapT() const
+{
+ return mState.getWrapT();
+}
+
+void Sampler::setWrapR(const Context *context, GLenum wrapR)
+{
+ mState.setWrapR(wrapR);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getWrapR() const
+{
+ return mState.getWrapR();
+}
+
+void Sampler::setMaxAnisotropy(const Context *context, float maxAnisotropy)
+{
+ mState.setMaxAnisotropy(maxAnisotropy);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+float Sampler::getMaxAnisotropy() const
+{
+ return mState.getMaxAnisotropy();
+}
+
+void Sampler::setMinLod(const Context *context, GLfloat minLod)
+{
+ mState.setMinLod(minLod);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLfloat Sampler::getMinLod() const
+{
+ return mState.getMinLod();
+}
+
+void Sampler::setMaxLod(const Context *context, GLfloat maxLod)
+{
+ mState.setMaxLod(maxLod);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLfloat Sampler::getMaxLod() const
+{
+ return mState.getMaxLod();
+}
+
+void Sampler::setCompareMode(const Context *context, GLenum compareMode)
+{
+ mState.setCompareMode(compareMode);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getCompareMode() const
+{
+ return mState.getCompareMode();
+}
+
+void Sampler::setCompareFunc(const Context *context, GLenum compareFunc)
+{
+ mState.setCompareFunc(compareFunc);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getCompareFunc() const
+{
+ return mState.getCompareFunc();
+}
+
+void Sampler::setSRGBDecode(const Context *context, GLenum sRGBDecode)
+{
+ mState.setSRGBDecode(sRGBDecode);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+GLenum Sampler::getSRGBDecode() const
+{
+ return mState.getSRGBDecode();
+}
+
+void Sampler::setBorderColor(const Context *context, const ColorGeneric &color)
+{
+ mState.setBorderColor(color);
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+const ColorGeneric &Sampler::getBorderColor() const
+{
+ return mState.getBorderColor();
+}
+
+const SamplerState &Sampler::getSamplerState() const
+{
+ return mState;
+}
+
+rx::SamplerImpl *Sampler::getImplementation() const
+{
+ return mImpl;
+}
+
+void Sampler::syncState(const Context *context)
+{
+ // TODO(jmadill): Use actual dirty bits for sampler.
+ mImpl->syncState(context);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Sampler.h b/gfx/angle/checkout/src/libANGLE/Sampler.h
new file mode 100644
index 0000000000..ba8c604cb1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Sampler.h
@@ -0,0 +1,89 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Sampler.h : Defines the Sampler class, which represents a GLES 3
+// sampler object. Sampler objects store some state needed to sample textures.
+
+#ifndef LIBANGLE_SAMPLER_H_
+#define LIBANGLE_SAMPLER_H_
+
+#include "libANGLE/Debug.h"
+#include "libANGLE/Observer.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/angletypes.h"
+
+namespace rx
+{
+class GLImplFactory;
+class SamplerImpl;
+} // namespace rx
+
+namespace gl
+{
+
+class Sampler final : public RefCountObject, public LabeledObject, public angle::Subject
+{
+ public:
+ Sampler(rx::GLImplFactory *factory, GLuint id);
+ ~Sampler() override;
+
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ void setMinFilter(const Context *context, GLenum minFilter);
+ GLenum getMinFilter() const;
+
+ void setMagFilter(const Context *context, GLenum magFilter);
+ GLenum getMagFilter() const;
+
+ void setWrapS(const Context *context, GLenum wrapS);
+ GLenum getWrapS() const;
+
+ void setWrapT(const Context *context, GLenum wrapT);
+ GLenum getWrapT() const;
+
+ void setWrapR(const Context *context, GLenum wrapR);
+ GLenum getWrapR() const;
+
+ void setMaxAnisotropy(const Context *context, float maxAnisotropy);
+ float getMaxAnisotropy() const;
+
+ void setMinLod(const Context *context, GLfloat minLod);
+ GLfloat getMinLod() const;
+
+ void setMaxLod(const Context *context, GLfloat maxLod);
+ GLfloat getMaxLod() const;
+
+ void setCompareMode(const Context *context, GLenum compareMode);
+ GLenum getCompareMode() const;
+
+ void setCompareFunc(const Context *context, GLenum compareFunc);
+ GLenum getCompareFunc() const;
+
+ void setSRGBDecode(const Context *context, GLenum sRGBDecode);
+ GLenum getSRGBDecode() const;
+
+ void setBorderColor(const Context *context, const ColorGeneric &color);
+ const ColorGeneric &getBorderColor() const;
+
+ const SamplerState &getSamplerState() const;
+
+ rx::SamplerImpl *getImplementation() const;
+
+ void syncState(const Context *context);
+
+ private:
+ SamplerState mState;
+ rx::SamplerImpl *mImpl;
+
+ std::string mLabel;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_SAMPLER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Semaphore.cpp b/gfx/angle/checkout/src/libANGLE/Semaphore.cpp
new file mode 100644
index 0000000000..a9f9114e89
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Semaphore.cpp
@@ -0,0 +1,47 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Semaphore.h: Implements the gl::Semaphore class [EXT_external_objects]
+
+#include "libANGLE/Semaphore.h"
+
+#include "common/angleutils.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/SemaphoreImpl.h"
+
+namespace gl
+{
+
+Semaphore::Semaphore(rx::GLImplFactory *factory, GLuint id)
+ : RefCountObject(id), mImplementation(factory->createSemaphore())
+{}
+
+Semaphore::~Semaphore() {}
+
+void Semaphore::onDestroy(const Context *context)
+{
+ mImplementation->onDestroy(context);
+}
+
+angle::Result Semaphore::importFd(Context *context, HandleType handleType, GLint fd)
+{
+ return mImplementation->importFd(context, handleType, fd);
+}
+
+angle::Result Semaphore::wait(Context *context,
+ const BufferBarrierVector &bufferBarriers,
+ const TextureBarrierVector &textureBarriers)
+{
+ return mImplementation->wait(context, bufferBarriers, textureBarriers);
+}
+
+angle::Result Semaphore::signal(Context *context,
+ const BufferBarrierVector &bufferBarriers,
+ const TextureBarrierVector &textureBarriers)
+{
+ return mImplementation->signal(context, bufferBarriers, textureBarriers);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Semaphore.h b/gfx/angle/checkout/src/libANGLE/Semaphore.h
new file mode 100644
index 0000000000..ece8fda450
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Semaphore.h
@@ -0,0 +1,56 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Semaphore.h: Defines the gl::Semaphore class [EXT_external_objects]
+
+#ifndef LIBANGLE_SEMAPHORE_H_
+#define LIBANGLE_SEMAPHORE_H_
+
+#include <memory>
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/angletypes.h"
+
+namespace rx
+{
+class GLImplFactory;
+class SemaphoreImpl;
+} // namespace rx
+
+namespace gl
+{
+class Context;
+
+class Semaphore final : public RefCountObject
+{
+ public:
+ Semaphore(rx::GLImplFactory *factory, GLuint id);
+ ~Semaphore() override;
+
+ void onDestroy(const Context *context) override;
+
+ rx::SemaphoreImpl *getImplementation() const { return mImplementation.get(); }
+
+ angle::Result importFd(Context *context, HandleType handleType, GLint fd);
+
+ angle::Result wait(Context *context,
+ const BufferBarrierVector &bufferBarriers,
+ const TextureBarrierVector &textureBarriers);
+
+ angle::Result signal(Context *context,
+ const BufferBarrierVector &bufferBarriers,
+ const TextureBarrierVector &textureBarriers);
+
+ private:
+ std::unique_ptr<rx::SemaphoreImpl> mImplementation;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_SEMAPHORE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Shader.cpp b/gfx/angle/checkout/src/libANGLE/Shader.cpp
new file mode 100644
index 0000000000..29f9097bf3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Shader.cpp
@@ -0,0 +1,682 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Shader.cpp: Implements the gl::Shader class and its derived classes
+// VertexShader and FragmentShader. Implements GL shader objects and related
+// functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section 3.8 page 84.
+
+#include "libANGLE/Shader.h"
+
+#include <functional>
+#include <sstream>
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/utilities.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Compiler.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ResourceManager.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/ShaderImpl.h"
+#include "platform/FrontendFeatures.h"
+
+namespace gl
+{
+
+namespace
+{
+template <typename VarT>
+std::vector<VarT> GetActiveShaderVariables(const std::vector<VarT> *variableList)
+{
+ ASSERT(variableList);
+ std::vector<VarT> result;
+ for (size_t varIndex = 0; varIndex < variableList->size(); varIndex++)
+ {
+ const VarT &var = variableList->at(varIndex);
+ if (var.active)
+ {
+ result.push_back(var);
+ }
+ }
+ return result;
+}
+
+template <typename VarT>
+const std::vector<VarT> &GetShaderVariables(const std::vector<VarT> *variableList)
+{
+ ASSERT(variableList);
+ return *variableList;
+}
+
+} // anonymous namespace
+
+// true if varying x has a higher priority in packing than y
+bool CompareShaderVar(const sh::ShaderVariable &x, const sh::ShaderVariable &y)
+{
+ if (x.type == y.type)
+ {
+ return x.getArraySizeProduct() > y.getArraySizeProduct();
+ }
+
+ // Special case for handling structs: we sort these to the end of the list
+ if (x.type == GL_NONE)
+ {
+ return false;
+ }
+
+ if (y.type == GL_NONE)
+ {
+ return true;
+ }
+
+ return gl::VariableSortOrder(x.type) < gl::VariableSortOrder(y.type);
+}
+
+const char *GetShaderTypeString(ShaderType type)
+{
+ switch (type)
+ {
+ case ShaderType::Vertex:
+ return "VERTEX";
+
+ case ShaderType::Fragment:
+ return "FRAGMENT";
+
+ case ShaderType::Compute:
+ return "COMPUTE";
+
+ case ShaderType::Geometry:
+ return "GEOMETRY";
+
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+class ScopedExit final : angle::NonCopyable
+{
+ public:
+ ScopedExit(std::function<void()> exit) : mExit(exit) {}
+ ~ScopedExit() { mExit(); }
+
+ private:
+ std::function<void()> mExit;
+};
+
+struct Shader::CompilingState
+{
+ std::shared_ptr<rx::WaitableCompileEvent> compileEvent;
+ ShCompilerInstance shCompilerInstance;
+};
+
+ShaderState::ShaderState(ShaderType shaderType)
+ : mLabel(),
+ mShaderType(shaderType),
+ mShaderVersion(100),
+ mNumViews(-1),
+ mGeometryShaderInvocations(1),
+ mCompileStatus(CompileStatus::NOT_COMPILED)
+{
+ mLocalSize.fill(-1);
+}
+
+ShaderState::~ShaderState() {}
+
+Shader::Shader(ShaderProgramManager *manager,
+ rx::GLImplFactory *implFactory,
+ const gl::Limitations &rendererLimitations,
+ ShaderType type,
+ GLuint handle)
+ : mState(type),
+ mImplementation(implFactory->createShader(mState)),
+ mRendererLimitations(rendererLimitations),
+ mHandle(handle),
+ mType(type),
+ mRefCount(0),
+ mDeleteStatus(false),
+ mResourceManager(manager),
+ mCurrentMaxComputeWorkGroupInvocations(0u)
+{
+ ASSERT(mImplementation);
+}
+
+void Shader::onDestroy(const gl::Context *context)
+{
+ resolveCompile();
+ mImplementation->destroy();
+ mBoundCompiler.set(context, nullptr);
+ mImplementation.reset(nullptr);
+ delete this;
+}
+
+Shader::~Shader()
+{
+ ASSERT(!mImplementation);
+}
+
+void Shader::setLabel(const Context *context, const std::string &label)
+{
+ mState.mLabel = label;
+}
+
+const std::string &Shader::getLabel() const
+{
+ return mState.mLabel;
+}
+
+GLuint Shader::getHandle() const
+{
+ return mHandle;
+}
+
+void Shader::setSource(GLsizei count, const char *const *string, const GLint *length)
+{
+ std::ostringstream stream;
+
+ for (int i = 0; i < count; i++)
+ {
+ if (length == nullptr || length[i] < 0)
+ {
+ stream.write(string[i], strlen(string[i]));
+ }
+ else
+ {
+ stream.write(string[i], length[i]);
+ }
+ }
+
+ mState.mSource = stream.str();
+}
+
+int Shader::getInfoLogLength()
+{
+ resolveCompile();
+ if (mInfoLog.empty())
+ {
+ return 0;
+ }
+
+ return (static_cast<int>(mInfoLog.length()) + 1);
+}
+
+void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
+{
+ resolveCompile();
+
+ int index = 0;
+
+ if (bufSize > 0)
+ {
+ index = std::min(bufSize - 1, static_cast<GLsizei>(mInfoLog.length()));
+ memcpy(infoLog, mInfoLog.c_str(), index);
+
+ infoLog[index] = '\0';
+ }
+
+ if (length)
+ {
+ *length = index;
+ }
+}
+
+int Shader::getSourceLength() const
+{
+ return mState.mSource.empty() ? 0 : (static_cast<int>(mState.mSource.length()) + 1);
+}
+
+int Shader::getTranslatedSourceLength()
+{
+ resolveCompile();
+
+ if (mState.mTranslatedSource.empty())
+ {
+ return 0;
+ }
+
+ return (static_cast<int>(mState.mTranslatedSource.length()) + 1);
+}
+
+int Shader::getTranslatedSourceWithDebugInfoLength()
+{
+ resolveCompile();
+
+ const std::string &debugInfo = mImplementation->getDebugInfo();
+ if (debugInfo.empty())
+ {
+ return 0;
+ }
+
+ return (static_cast<int>(debugInfo.length()) + 1);
+}
+
+// static
+void Shader::GetSourceImpl(const std::string &source,
+ GLsizei bufSize,
+ GLsizei *length,
+ char *buffer)
+{
+ int index = 0;
+
+ if (bufSize > 0)
+ {
+ index = std::min(bufSize - 1, static_cast<GLsizei>(source.length()));
+ memcpy(buffer, source.c_str(), index);
+
+ buffer[index] = '\0';
+ }
+
+ if (length)
+ {
+ *length = index;
+ }
+}
+
+void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer) const
+{
+ GetSourceImpl(mState.mSource, bufSize, length, buffer);
+}
+
+void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer)
+{
+ GetSourceImpl(getTranslatedSource(), bufSize, length, buffer);
+}
+
+const std::string &Shader::getTranslatedSource()
+{
+ resolveCompile();
+ return mState.mTranslatedSource;
+}
+
+void Shader::getTranslatedSourceWithDebugInfo(GLsizei bufSize, GLsizei *length, char *buffer)
+{
+ resolveCompile();
+ const std::string &debugInfo = mImplementation->getDebugInfo();
+ GetSourceImpl(debugInfo, bufSize, length, buffer);
+}
+
+void Shader::compile(const Context *context)
+{
+ resolveCompile();
+
+ mState.mTranslatedSource.clear();
+ mInfoLog.clear();
+ mState.mShaderVersion = 100;
+ mState.mInputVaryings.clear();
+ mState.mOutputVaryings.clear();
+ mState.mUniforms.clear();
+ mState.mUniformBlocks.clear();
+ mState.mShaderStorageBlocks.clear();
+ mState.mActiveAttributes.clear();
+ mState.mActiveOutputVariables.clear();
+ mState.mNumViews = -1;
+ mState.mGeometryShaderInputPrimitiveType.reset();
+ mState.mGeometryShaderOutputPrimitiveType.reset();
+ mState.mGeometryShaderMaxVertices.reset();
+ mState.mGeometryShaderInvocations = 1;
+
+ mState.mCompileStatus = CompileStatus::COMPILE_REQUESTED;
+ mBoundCompiler.set(context, context->getCompiler());
+
+ ShCompileOptions options = (SH_OBJECT_CODE | SH_VARIABLES | SH_EMULATE_GL_DRAW_ID);
+
+ // Add default options to WebGL shaders to prevent unexpected behavior during
+ // compilation.
+ if (context->getExtensions().webglCompatibility)
+ {
+ options |= SH_INIT_GL_POSITION;
+ options |= SH_LIMIT_CALL_STACK_DEPTH;
+ options |= SH_LIMIT_EXPRESSION_COMPLEXITY;
+ options |= SH_ENFORCE_PACKING_RESTRICTIONS;
+ options |= SH_INIT_SHARED_VARIABLES;
+ }
+
+ // Some targets (eg D3D11 Feature Level 9_3 and below) do not support non-constant loop
+ // indexes in fragment shaders. Shader compilation will fail. To provide a better error
+ // message we can instruct the compiler to pre-validate.
+ if (mRendererLimitations.shadersRequireIndexedLoopValidation)
+ {
+ options |= SH_VALIDATE_LOOP_INDEXING;
+ }
+
+ if (context->getFrontendFeatures().scalarizeVecAndMatConstructorArgs.enabled)
+ {
+ options |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
+ }
+
+ mCurrentMaxComputeWorkGroupInvocations = context->getCaps().maxComputeWorkGroupInvocations;
+
+ ASSERT(mBoundCompiler.get());
+ ShCompilerInstance compilerInstance = mBoundCompiler->getInstance(mState.mShaderType);
+ ShHandle compilerHandle = compilerInstance.getHandle();
+ ASSERT(compilerHandle);
+ mCompilerResourcesString = compilerInstance.getBuiltinResourcesString();
+
+ mCompilingState.reset(new CompilingState());
+ mCompilingState->shCompilerInstance = std::move(compilerInstance);
+ mCompilingState->compileEvent =
+ mImplementation->compile(context, &(mCompilingState->shCompilerInstance), options);
+}
+
+void Shader::resolveCompile()
+{
+ if (!mState.compilePending())
+ {
+ return;
+ }
+
+ ASSERT(mCompilingState.get());
+
+ mCompilingState->compileEvent->wait();
+
+ mInfoLog += mCompilingState->compileEvent->getInfoLog();
+
+ ScopedExit exit([this]() {
+ mBoundCompiler->putInstance(std::move(mCompilingState->shCompilerInstance));
+ mCompilingState->compileEvent.reset();
+ mCompilingState.reset();
+ });
+
+ ShHandle compilerHandle = mCompilingState->shCompilerInstance.getHandle();
+ if (!mCompilingState->compileEvent->getResult())
+ {
+ mInfoLog += sh::GetInfoLog(compilerHandle);
+ WARN() << std::endl << mInfoLog;
+ mState.mCompileStatus = CompileStatus::NOT_COMPILED;
+ return;
+ }
+
+ mState.mTranslatedSource = sh::GetObjectCode(compilerHandle);
+
+#if !defined(NDEBUG)
+ // Prefix translated shader with commented out un-translated shader.
+ // Useful in diagnostics tools which capture the shader source.
+ std::ostringstream shaderStream;
+ shaderStream << "// GLSL\n";
+ shaderStream << "//\n";
+
+ std::istringstream inputSourceStream(mState.mSource);
+ std::string line;
+ while (std::getline(inputSourceStream, line))
+ {
+ // Remove null characters from the source line
+ line.erase(std::remove(line.begin(), line.end(), '\0'), line.end());
+
+ shaderStream << "// " << line << std::endl;
+ }
+ shaderStream << "\n\n";
+ shaderStream << mState.mTranslatedSource;
+ mState.mTranslatedSource = shaderStream.str();
+#endif // !defined(NDEBUG)
+
+ // Gather the shader information
+ mState.mShaderVersion = sh::GetShaderVersion(compilerHandle);
+
+ mState.mUniforms = GetShaderVariables(sh::GetUniforms(compilerHandle));
+ mState.mUniformBlocks = GetShaderVariables(sh::GetUniformBlocks(compilerHandle));
+ mState.mShaderStorageBlocks = GetShaderVariables(sh::GetShaderStorageBlocks(compilerHandle));
+
+ switch (mState.mShaderType)
+ {
+ case ShaderType::Compute:
+ {
+ mState.mLocalSize = sh::GetComputeShaderLocalGroupSize(compilerHandle);
+ if (mState.mLocalSize.isDeclared())
+ {
+ angle::CheckedNumeric<uint32_t> checked_local_size_product(mState.mLocalSize[0]);
+ checked_local_size_product *= mState.mLocalSize[1];
+ checked_local_size_product *= mState.mLocalSize[2];
+
+ if (!checked_local_size_product.IsValid())
+ {
+ WARN() << std::endl
+ << "Integer overflow when computing the product of local_size_x, "
+ << "local_size_y and local_size_z.";
+ mState.mCompileStatus = CompileStatus::NOT_COMPILED;
+ return;
+ }
+ if (checked_local_size_product.ValueOrDie() >
+ mCurrentMaxComputeWorkGroupInvocations)
+ {
+ WARN() << std::endl
+ << "The total number of invocations within a work group exceeds "
+ << "MAX_COMPUTE_WORK_GROUP_INVOCATIONS.";
+ mState.mCompileStatus = CompileStatus::NOT_COMPILED;
+ return;
+ }
+ }
+ break;
+ }
+ case ShaderType::Vertex:
+ {
+ {
+ mState.mOutputVaryings = GetShaderVariables(sh::GetOutputVaryings(compilerHandle));
+ mState.mAllAttributes = GetShaderVariables(sh::GetAttributes(compilerHandle));
+ mState.mActiveAttributes = GetActiveShaderVariables(&mState.mAllAttributes);
+ mState.mNumViews = sh::GetVertexShaderNumViews(compilerHandle);
+ }
+ break;
+ }
+ case ShaderType::Fragment:
+ {
+ mState.mInputVaryings = GetShaderVariables(sh::GetInputVaryings(compilerHandle));
+ // TODO(jmadill): Figure out why we only sort in the FS, and if we need to.
+ std::sort(mState.mInputVaryings.begin(), mState.mInputVaryings.end(), CompareShaderVar);
+ mState.mActiveOutputVariables =
+ GetActiveShaderVariables(sh::GetOutputVariables(compilerHandle));
+ break;
+ }
+ case ShaderType::Geometry:
+ {
+ mState.mInputVaryings = GetShaderVariables(sh::GetInputVaryings(compilerHandle));
+ mState.mOutputVaryings = GetShaderVariables(sh::GetOutputVaryings(compilerHandle));
+
+ if (sh::HasValidGeometryShaderInputPrimitiveType(compilerHandle))
+ {
+ mState.mGeometryShaderInputPrimitiveType = FromGLenum<PrimitiveMode>(
+ sh::GetGeometryShaderInputPrimitiveType(compilerHandle));
+ }
+ if (sh::HasValidGeometryShaderOutputPrimitiveType(compilerHandle))
+ {
+ mState.mGeometryShaderOutputPrimitiveType = FromGLenum<PrimitiveMode>(
+ sh::GetGeometryShaderOutputPrimitiveType(compilerHandle));
+ }
+ if (sh::HasValidGeometryShaderMaxVertices(compilerHandle))
+ {
+ mState.mGeometryShaderMaxVertices =
+ sh::GetGeometryShaderMaxVertices(compilerHandle);
+ }
+ mState.mGeometryShaderInvocations = sh::GetGeometryShaderInvocations(compilerHandle);
+ break;
+ }
+ default:
+ UNREACHABLE();
+ }
+
+ ASSERT(!mState.mTranslatedSource.empty());
+
+ bool success = mCompilingState->compileEvent->postTranslate(&mInfoLog);
+ mState.mCompileStatus = success ? CompileStatus::COMPILED : CompileStatus::NOT_COMPILED;
+}
+
+void Shader::addRef()
+{
+ mRefCount++;
+}
+
+void Shader::release(const Context *context)
+{
+ mRefCount--;
+
+ if (mRefCount == 0 && mDeleteStatus)
+ {
+ mResourceManager->deleteShader(context, mHandle);
+ }
+}
+
+unsigned int Shader::getRefCount() const
+{
+ return mRefCount;
+}
+
+bool Shader::isFlaggedForDeletion() const
+{
+ return mDeleteStatus;
+}
+
+void Shader::flagForDeletion()
+{
+ mDeleteStatus = true;
+}
+
+bool Shader::isCompiled()
+{
+ resolveCompile();
+ return mState.mCompileStatus == CompileStatus::COMPILED;
+}
+
+bool Shader::isCompleted()
+{
+ return (!mState.compilePending() || mCompilingState->compileEvent->isReady());
+}
+
+int Shader::getShaderVersion()
+{
+ resolveCompile();
+ return mState.mShaderVersion;
+}
+
+const std::vector<sh::Varying> &Shader::getInputVaryings()
+{
+ resolveCompile();
+ return mState.getInputVaryings();
+}
+
+const std::vector<sh::Varying> &Shader::getOutputVaryings()
+{
+ resolveCompile();
+ return mState.getOutputVaryings();
+}
+
+const std::vector<sh::Uniform> &Shader::getUniforms()
+{
+ resolveCompile();
+ return mState.getUniforms();
+}
+
+const std::vector<sh::InterfaceBlock> &Shader::getUniformBlocks()
+{
+ resolveCompile();
+ return mState.getUniformBlocks();
+}
+
+const std::vector<sh::InterfaceBlock> &Shader::getShaderStorageBlocks()
+{
+ resolveCompile();
+ return mState.getShaderStorageBlocks();
+}
+
+const std::vector<sh::Attribute> &Shader::getActiveAttributes()
+{
+ resolveCompile();
+ return mState.getActiveAttributes();
+}
+
+const std::vector<sh::Attribute> &Shader::getAllAttributes()
+{
+ resolveCompile();
+ return mState.getAllAttributes();
+}
+
+const std::vector<sh::OutputVariable> &Shader::getActiveOutputVariables()
+{
+ resolveCompile();
+ return mState.getActiveOutputVariables();
+}
+
+std::string Shader::getTransformFeedbackVaryingMappedName(const std::string &tfVaryingName)
+{
+ // TODO(jiawei.shao@intel.com): support transform feedback on geometry shader.
+ ASSERT(mState.getShaderType() == ShaderType::Vertex);
+ const auto &varyings = getOutputVaryings();
+ auto bracketPos = tfVaryingName.find("[");
+ if (bracketPos != std::string::npos)
+ {
+ auto tfVaryingBaseName = tfVaryingName.substr(0, bracketPos);
+ for (const auto &varying : varyings)
+ {
+ if (varying.name == tfVaryingBaseName)
+ {
+ std::string mappedNameWithArrayIndex =
+ varying.mappedName + tfVaryingName.substr(bracketPos);
+ return mappedNameWithArrayIndex;
+ }
+ }
+ }
+ else
+ {
+ for (const auto &varying : varyings)
+ {
+ if (varying.name == tfVaryingName)
+ {
+ return varying.mappedName;
+ }
+ else if (varying.isStruct())
+ {
+ GLuint fieldIndex = 0;
+ const auto *field = FindShaderVarField(varying, tfVaryingName, &fieldIndex);
+ ASSERT(field != nullptr && !field->isStruct() && !field->isArray());
+ return varying.mappedName + "." + field->mappedName;
+ }
+ }
+ }
+ UNREACHABLE();
+ return std::string();
+}
+
+const sh::WorkGroupSize &Shader::getWorkGroupSize()
+{
+ resolveCompile();
+ return mState.mLocalSize;
+}
+
+int Shader::getNumViews()
+{
+ resolveCompile();
+ return mState.mNumViews;
+}
+
+Optional<PrimitiveMode> Shader::getGeometryShaderInputPrimitiveType()
+{
+ resolveCompile();
+ return mState.mGeometryShaderInputPrimitiveType;
+}
+
+Optional<PrimitiveMode> Shader::getGeometryShaderOutputPrimitiveType()
+{
+ resolveCompile();
+ return mState.mGeometryShaderOutputPrimitiveType;
+}
+
+int Shader::getGeometryShaderInvocations()
+{
+ resolveCompile();
+ return mState.mGeometryShaderInvocations;
+}
+
+Optional<GLint> Shader::getGeometryShaderMaxVertices()
+{
+ resolveCompile();
+ return mState.mGeometryShaderMaxVertices;
+}
+
+const std::string &Shader::getCompilerResourcesString() const
+{
+ return mCompilerResourcesString;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Shader.h b/gfx/angle/checkout/src/libANGLE/Shader.h
new file mode 100644
index 0000000000..c3d04dd54c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Shader.h
@@ -0,0 +1,227 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Shader.h: Defines the abstract gl::Shader class and its concrete derived
+// classes VertexShader and FragmentShader. Implements GL shader objects and
+// related functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section
+// 3.8 page 84.
+
+#ifndef LIBANGLE_SHADER_H_
+#define LIBANGLE_SHADER_H_
+
+#include <list>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include <GLSLANG/ShaderLang.h>
+#include "angle_gl.h"
+
+#include "common/Optional.h"
+#include "common/angleutils.h"
+#include "libANGLE/Compiler.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/angletypes.h"
+
+namespace rx
+{
+class GLImplFactory;
+class ShaderImpl;
+class ShaderSh;
+class WaitableCompileEvent;
+} // namespace rx
+
+namespace angle
+{
+class WaitableEvent;
+class WorkerThreadPool;
+} // namespace angle
+
+namespace gl
+{
+class CompileTask;
+class Context;
+struct Limitations;
+class ShaderProgramManager;
+class State;
+
+// We defer the compile until link time, or until properties are queried.
+enum class CompileStatus
+{
+ NOT_COMPILED,
+ COMPILE_REQUESTED,
+ COMPILED,
+};
+
+class ShaderState final : angle::NonCopyable
+{
+ public:
+ ShaderState(ShaderType shaderType);
+ ~ShaderState();
+
+ const std::string &getLabel() const { return mLabel; }
+
+ const std::string &getSource() const { return mSource; }
+ const std::string &getTranslatedSource() const { return mTranslatedSource; }
+
+ ShaderType getShaderType() const { return mShaderType; }
+ int getShaderVersion() const { return mShaderVersion; }
+
+ const std::vector<sh::Varying> &getInputVaryings() const { return mInputVaryings; }
+ const std::vector<sh::Varying> &getOutputVaryings() const { return mOutputVaryings; }
+ const std::vector<sh::Uniform> &getUniforms() const { return mUniforms; }
+ const std::vector<sh::InterfaceBlock> &getUniformBlocks() const { return mUniformBlocks; }
+ const std::vector<sh::InterfaceBlock> &getShaderStorageBlocks() const
+ {
+ return mShaderStorageBlocks;
+ }
+ const std::vector<sh::Attribute> &getActiveAttributes() const { return mActiveAttributes; }
+ const std::vector<sh::Attribute> &getAllAttributes() const { return mAllAttributes; }
+ const std::vector<sh::OutputVariable> &getActiveOutputVariables() const
+ {
+ return mActiveOutputVariables;
+ }
+
+ bool compilePending() const { return mCompileStatus == CompileStatus::COMPILE_REQUESTED; }
+
+ private:
+ friend class Shader;
+
+ std::string mLabel;
+
+ ShaderType mShaderType;
+ int mShaderVersion;
+ std::string mTranslatedSource;
+ std::string mSource;
+
+ sh::WorkGroupSize mLocalSize;
+
+ std::vector<sh::Varying> mInputVaryings;
+ std::vector<sh::Varying> mOutputVaryings;
+ std::vector<sh::Uniform> mUniforms;
+ std::vector<sh::InterfaceBlock> mUniformBlocks;
+ std::vector<sh::InterfaceBlock> mShaderStorageBlocks;
+ std::vector<sh::Attribute> mAllAttributes;
+ std::vector<sh::Attribute> mActiveAttributes;
+ std::vector<sh::OutputVariable> mActiveOutputVariables;
+
+ // ANGLE_multiview.
+ int mNumViews;
+
+ // Geometry Shader.
+ Optional<PrimitiveMode> mGeometryShaderInputPrimitiveType;
+ Optional<PrimitiveMode> mGeometryShaderOutputPrimitiveType;
+ Optional<GLint> mGeometryShaderMaxVertices;
+ int mGeometryShaderInvocations;
+
+ // Indicates if this shader has been successfully compiled
+ CompileStatus mCompileStatus;
+};
+
+class Shader final : angle::NonCopyable, public LabeledObject
+{
+ public:
+ Shader(ShaderProgramManager *manager,
+ rx::GLImplFactory *implFactory,
+ const gl::Limitations &rendererLimitations,
+ ShaderType type,
+ GLuint handle);
+
+ void onDestroy(const Context *context);
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ ShaderType getType() const { return mType; }
+ GLuint getHandle() const;
+
+ rx::ShaderImpl *getImplementation() const { return mImplementation.get(); }
+
+ void setSource(GLsizei count, const char *const *string, const GLint *length);
+ int getInfoLogLength();
+ void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
+ int getSourceLength() const;
+ const std::string &getSourceString() const { return mState.getSource(); }
+ void getSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
+ int getTranslatedSourceLength();
+ int getTranslatedSourceWithDebugInfoLength();
+ const std::string &getTranslatedSource();
+ void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer);
+ void getTranslatedSourceWithDebugInfo(GLsizei bufSize, GLsizei *length, char *buffer);
+
+ void compile(const Context *context);
+ bool isCompiled();
+ bool isCompleted();
+
+ void addRef();
+ void release(const Context *context);
+ unsigned int getRefCount() const;
+ bool isFlaggedForDeletion() const;
+ void flagForDeletion();
+
+ int getShaderVersion();
+
+ const std::vector<sh::Varying> &getInputVaryings();
+ const std::vector<sh::Varying> &getOutputVaryings();
+ const std::vector<sh::Uniform> &getUniforms();
+ const std::vector<sh::InterfaceBlock> &getUniformBlocks();
+ const std::vector<sh::InterfaceBlock> &getShaderStorageBlocks();
+ const std::vector<sh::Attribute> &getActiveAttributes();
+ const std::vector<sh::Attribute> &getAllAttributes();
+ const std::vector<sh::OutputVariable> &getActiveOutputVariables();
+
+ // Returns mapped name of a transform feedback varying. The original name may contain array
+ // brackets with an index inside, which will get copied to the mapped name. The varying must be
+ // known to be declared in the shader.
+ std::string getTransformFeedbackVaryingMappedName(const std::string &tfVaryingName);
+
+ const sh::WorkGroupSize &getWorkGroupSize();
+
+ int getNumViews();
+
+ Optional<PrimitiveMode> getGeometryShaderInputPrimitiveType();
+ Optional<PrimitiveMode> getGeometryShaderOutputPrimitiveType();
+ int getGeometryShaderInvocations();
+ Optional<GLint> getGeometryShaderMaxVertices();
+
+ const std::string &getCompilerResourcesString() const;
+
+ private:
+ struct CompilingState;
+
+ ~Shader() override;
+ static void GetSourceImpl(const std::string &source,
+ GLsizei bufSize,
+ GLsizei *length,
+ char *buffer);
+
+ void resolveCompile();
+
+ ShaderState mState;
+ std::unique_ptr<rx::ShaderImpl> mImplementation;
+ const gl::Limitations &mRendererLimitations;
+ const GLuint mHandle;
+ const ShaderType mType;
+ unsigned int mRefCount; // Number of program objects this shader is attached to
+ bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use
+ std::string mInfoLog;
+
+ // We keep a reference to the translator in order to defer compiles while preserving settings.
+ BindingPointer<Compiler> mBoundCompiler;
+ std::unique_ptr<CompilingState> mCompilingState;
+ std::string mCompilerResourcesString;
+
+ ShaderProgramManager *mResourceManager;
+
+ GLuint mCurrentMaxComputeWorkGroupInvocations;
+};
+
+bool CompareShaderVar(const sh::ShaderVariable &x, const sh::ShaderVariable &y);
+
+const char *GetShaderTypeString(ShaderType type);
+} // namespace gl
+
+#endif // LIBANGLE_SHADER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/SizedMRUCache.h b/gfx/angle/checkout/src/libANGLE/SizedMRUCache.h
new file mode 100644
index 0000000000..945622d003
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/SizedMRUCache.h
@@ -0,0 +1,159 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SizedMRUCache.h: A hashing map that stores blobs of sized, untyped data.
+
+#ifndef LIBANGLE_SIZED_MRU_CACHE_H_
+#define LIBANGLE_SIZED_MRU_CACHE_H_
+
+#include <anglebase/containers/mru_cache.h>
+
+namespace angle
+{
+
+template <typename Key, typename Value>
+class SizedMRUCache final : angle::NonCopyable
+{
+ public:
+ SizedMRUCache(size_t maximumTotalSize)
+ : mMaximumTotalSize(maximumTotalSize),
+ mCurrentSize(0),
+ mStore(SizedMRUCacheStore::NO_AUTO_EVICT)
+ {}
+
+ // Returns nullptr on failure.
+ const Value *put(const Key &key, Value &&value, size_t size)
+ {
+ if (size > mMaximumTotalSize)
+ {
+ return nullptr;
+ }
+
+ // Check for existing key.
+ eraseByKey(key);
+
+ auto retVal = mStore.Put(key, ValueAndSize(std::move(value), size));
+ mCurrentSize += size;
+
+ shrinkToSize(mMaximumTotalSize);
+
+ return &retVal->second.value;
+ }
+
+ bool get(const Key &key, const Value **valueOut)
+ {
+ const auto &iter = mStore.Get(key);
+ if (iter == mStore.end())
+ {
+ return false;
+ }
+ *valueOut = &iter->second.value;
+ return true;
+ }
+
+ bool getAt(size_t index, const Key **keyOut, const Value **valueOut)
+ {
+ if (index < mStore.size())
+ {
+ auto it = mStore.begin();
+ std::advance(it, index);
+ *keyOut = &it->first;
+ *valueOut = &it->second.value;
+ return true;
+ }
+ *valueOut = nullptr;
+ return false;
+ }
+
+ bool empty() const { return mStore.empty(); }
+
+ void clear()
+ {
+ mStore.Clear();
+ mCurrentSize = 0;
+ }
+
+ bool eraseByKey(const Key &key)
+ {
+ // Check for existing key.
+ auto existing = mStore.Peek(key);
+ if (existing != mStore.end())
+ {
+ mCurrentSize -= existing->second.size;
+ mStore.Erase(existing);
+ return true;
+ }
+
+ return false;
+ }
+
+ size_t entryCount() const { return mStore.size(); }
+
+ size_t size() const { return mCurrentSize; }
+
+ // Also discards the cache contents.
+ void resize(size_t maximumTotalSize)
+ {
+ clear();
+ mMaximumTotalSize = maximumTotalSize;
+ }
+
+ // Reduce current memory usage.
+ size_t shrinkToSize(size_t limit)
+ {
+ size_t initialSize = mCurrentSize;
+
+ while (mCurrentSize > limit)
+ {
+ ASSERT(!mStore.empty());
+ auto iter = mStore.rbegin();
+ mCurrentSize -= iter->second.size;
+ mStore.Erase(iter);
+ }
+
+ return (initialSize - mCurrentSize);
+ }
+
+ size_t maxSize() const { return mMaximumTotalSize; }
+
+ private:
+ struct ValueAndSize
+ {
+ ValueAndSize() : value(), size(0) {}
+ ValueAndSize(Value &&value, size_t size) : value(std::move(value)), size(size) {}
+ ValueAndSize(ValueAndSize &&other) : ValueAndSize() { *this = std::move(other); }
+ ValueAndSize &operator=(ValueAndSize &&other)
+ {
+ std::swap(value, other.value);
+ std::swap(size, other.size);
+ return *this;
+ }
+
+ Value value;
+ size_t size;
+ };
+
+ using SizedMRUCacheStore = base::HashingMRUCache<Key, ValueAndSize>;
+
+ size_t mMaximumTotalSize;
+ size_t mCurrentSize;
+ SizedMRUCacheStore mStore;
+};
+
+// Helper function used in a few places.
+template <typename T>
+void TrimCache(size_t maxStates, size_t gcLimit, const char *name, T *cache)
+{
+ const size_t kGarbageCollectionLimit = maxStates / 2 + gcLimit;
+
+ if (cache->size() >= kGarbageCollectionLimit)
+ {
+ WARN() << "Overflowed the " << name << " cache limit of " << (maxStates / 2)
+ << " elements, removing the least recently used to make room.";
+ cache->ShrinkToSize(maxStates / 2);
+ }
+}
+} // namespace angle
+#endif // LIBANGLE_SIZED_MRU_CACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/State.cpp b/gfx/angle/checkout/src/libANGLE/State.cpp
new file mode 100644
index 0000000000..9493ff8cb3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/State.cpp
@@ -0,0 +1,2870 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// State.cpp: Implements the State class, encapsulating raw GL state.
+
+#include "libANGLE/State.h"
+
+#include <string.h>
+#include <limits>
+
+#include "common/bitset_utils.h"
+#include "common/mathutil.h"
+#include "common/matrix_utils.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Query.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/queryconversions.h"
+#include "libANGLE/queryutils.h"
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/TextureImpl.h"
+
+namespace gl
+{
+
+namespace
+{
+bool GetAlternativeQueryType(QueryType type, QueryType *alternativeType)
+{
+ switch (type)
+ {
+ case QueryType::AnySamples:
+ *alternativeType = QueryType::AnySamplesConservative;
+ return true;
+ case QueryType::AnySamplesConservative:
+ *alternativeType = QueryType::AnySamples;
+ return true;
+ default:
+ return false;
+ }
+}
+
+// Mapping from a buffer binding type to a dirty bit type.
+constexpr angle::PackedEnumMap<BufferBinding, size_t> kBufferBindingDirtyBits = {{
+ {BufferBinding::AtomicCounter, State::DIRTY_BIT_ATOMIC_COUNTER_BUFFER_BINDING},
+ {BufferBinding::DispatchIndirect, State::DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING},
+ {BufferBinding::DrawIndirect, State::DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING},
+ {BufferBinding::PixelPack, State::DIRTY_BIT_PACK_BUFFER_BINDING},
+ {BufferBinding::PixelUnpack, State::DIRTY_BIT_UNPACK_BUFFER_BINDING},
+ {BufferBinding::ShaderStorage, State::DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING},
+ {BufferBinding::Uniform, State::DIRTY_BIT_UNIFORM_BUFFER_BINDINGS},
+}};
+
+// Returns a buffer binding function depending on if a dirty bit is set.
+template <BufferBinding Target>
+constexpr std::pair<BufferBinding, State::BufferBindingSetter> GetBufferBindingSetter()
+{
+ return std::make_pair(Target, kBufferBindingDirtyBits[Target] != 0
+ ? &State::setGenericBufferBindingWithBit<Target>
+ : &State::setGenericBufferBinding<Target>);
+}
+
+template <typename T>
+using ContextStateMember = T *(State::*);
+
+template <typename T>
+T *AllocateOrGetSharedResourceManager(const State *shareContextState, ContextStateMember<T> member)
+{
+ if (shareContextState)
+ {
+ T *resourceManager = (*shareContextState).*member;
+ resourceManager->addRef();
+ return resourceManager;
+ }
+ else
+ {
+ return new T();
+ }
+}
+
+TextureManager *AllocateOrGetSharedTextureManager(const State *shareContextState,
+ TextureManager *shareTextures,
+ ContextStateMember<TextureManager> member)
+{
+ if (shareContextState)
+ {
+ TextureManager *textureManager = (*shareContextState).*member;
+ ASSERT(shareTextures == nullptr || textureManager == shareTextures);
+ textureManager->addRef();
+ return textureManager;
+ }
+ else if (shareTextures)
+ {
+ TextureManager *textureManager = shareTextures;
+ textureManager->addRef();
+ return textureManager;
+ }
+ else
+ {
+ return new TextureManager();
+ }
+}
+} // namespace
+
+template <typename BindingT, typename... ArgsT>
+ANGLE_INLINE void UpdateNonTFBufferBinding(const Context *context,
+ BindingT *binding,
+ Buffer *buffer,
+ ArgsT... args)
+{
+ Buffer *oldBuffer = binding->get();
+ if (oldBuffer)
+ {
+ oldBuffer->onNonTFBindingChanged(-1);
+ oldBuffer->release(context);
+ }
+ binding->assign(buffer, args...);
+ if (buffer)
+ {
+ buffer->addRef();
+ buffer->onNonTFBindingChanged(1);
+ }
+}
+
+template <typename BindingT, typename... ArgsT>
+void UpdateTFBufferBinding(const Context *context, BindingT *binding, bool indexed, ArgsT... args)
+{
+ if (binding->get())
+ (*binding)->onTFBindingChanged(context, false, indexed);
+ binding->set(context, args...);
+ if (binding->get())
+ (*binding)->onTFBindingChanged(context, true, indexed);
+}
+
+void UpdateBufferBinding(const Context *context,
+ BindingPointer<Buffer> *binding,
+ Buffer *buffer,
+ BufferBinding target)
+{
+ if (target == BufferBinding::TransformFeedback)
+ {
+ UpdateTFBufferBinding(context, binding, false, buffer);
+ }
+ else
+ {
+ UpdateNonTFBufferBinding(context, binding, buffer);
+ }
+}
+
+void UpdateIndexedBufferBinding(const Context *context,
+ OffsetBindingPointer<Buffer> *binding,
+ Buffer *buffer,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ if (target == BufferBinding::TransformFeedback)
+ {
+ UpdateTFBufferBinding(context, binding, true, buffer, offset, size);
+ }
+ else
+ {
+ UpdateNonTFBufferBinding(context, binding, buffer, offset, size);
+ }
+}
+
+// These template functions must be defined before they are instantiated in kBufferSetters.
+template <BufferBinding Target>
+void State::setGenericBufferBindingWithBit(const Context *context, Buffer *buffer)
+{
+ UpdateNonTFBufferBinding(context, &mBoundBuffers[Target], buffer);
+ mDirtyBits.set(kBufferBindingDirtyBits[Target]);
+}
+
+template <BufferBinding Target>
+void State::setGenericBufferBinding(const Context *context, Buffer *buffer)
+{
+ UpdateNonTFBufferBinding(context, &mBoundBuffers[Target], buffer);
+}
+
+template <>
+void State::setGenericBufferBinding<BufferBinding::TransformFeedback>(const Context *context,
+ Buffer *buffer)
+{
+ UpdateTFBufferBinding(context, &mBoundBuffers[BufferBinding::TransformFeedback], false, buffer);
+}
+
+template <>
+void State::setGenericBufferBinding<BufferBinding::ElementArray>(const Context *context,
+ Buffer *buffer)
+{
+ Buffer *oldBuffer = mVertexArray->mState.mElementArrayBuffer.get();
+ if (oldBuffer)
+ {
+ oldBuffer->removeObserver(&mVertexArray->mState.mElementArrayBuffer);
+ oldBuffer->onNonTFBindingChanged(-1);
+ oldBuffer->release(context);
+ }
+ mVertexArray->mState.mElementArrayBuffer.assign(buffer);
+ if (buffer)
+ {
+ buffer->addObserver(&mVertexArray->mState.mElementArrayBuffer);
+ buffer->onNonTFBindingChanged(1);
+ buffer->addRef();
+ }
+ mVertexArray->mDirtyBits.set(VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER);
+ mVertexArray->mIndexRangeCache.invalidate();
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+}
+
+const angle::PackedEnumMap<BufferBinding, State::BufferBindingSetter> State::kBufferSetters = {{
+ GetBufferBindingSetter<BufferBinding::Array>(),
+ GetBufferBindingSetter<BufferBinding::AtomicCounter>(),
+ GetBufferBindingSetter<BufferBinding::CopyRead>(),
+ GetBufferBindingSetter<BufferBinding::CopyWrite>(),
+ GetBufferBindingSetter<BufferBinding::DispatchIndirect>(),
+ GetBufferBindingSetter<BufferBinding::DrawIndirect>(),
+ GetBufferBindingSetter<BufferBinding::ElementArray>(),
+ GetBufferBindingSetter<BufferBinding::PixelPack>(),
+ GetBufferBindingSetter<BufferBinding::PixelUnpack>(),
+ GetBufferBindingSetter<BufferBinding::ShaderStorage>(),
+ GetBufferBindingSetter<BufferBinding::TransformFeedback>(),
+ GetBufferBindingSetter<BufferBinding::Uniform>(),
+}};
+
+State::State(ContextID contextIn,
+ const State *shareContextState,
+ TextureManager *shareTextures,
+ const EGLenum clientType,
+ const Version &clientVersion,
+ bool debug,
+ bool bindGeneratesResource,
+ bool clientArraysEnabled,
+ bool robustResourceInit,
+ bool programBinaryCacheEnabled)
+ : mClientType(clientType),
+ mClientVersion(clientVersion),
+ mContext(contextIn),
+ mBufferManager(AllocateOrGetSharedResourceManager(shareContextState, &State::mBufferManager)),
+ mShaderProgramManager(
+ AllocateOrGetSharedResourceManager(shareContextState, &State::mShaderProgramManager)),
+ mTextureManager(AllocateOrGetSharedTextureManager(shareContextState,
+ shareTextures,
+ &State::mTextureManager)),
+ mRenderbufferManager(
+ AllocateOrGetSharedResourceManager(shareContextState, &State::mRenderbufferManager)),
+ mSamplerManager(
+ AllocateOrGetSharedResourceManager(shareContextState, &State::mSamplerManager)),
+ mSyncManager(AllocateOrGetSharedResourceManager(shareContextState, &State::mSyncManager)),
+ mPathManager(AllocateOrGetSharedResourceManager(shareContextState, &State::mPathManager)),
+ mFramebufferManager(new FramebufferManager()),
+ mProgramPipelineManager(new ProgramPipelineManager()),
+ mMemoryObjectManager(
+ AllocateOrGetSharedResourceManager(shareContextState, &State::mMemoryObjectManager)),
+ mSemaphoreManager(
+ AllocateOrGetSharedResourceManager(shareContextState, &State::mSemaphoreManager)),
+ mMaxDrawBuffers(0),
+ mMaxCombinedTextureImageUnits(0),
+ mDepthClearValue(0),
+ mStencilClearValue(0),
+ mScissorTest(false),
+ mSampleCoverage(false),
+ mSampleCoverageValue(0),
+ mSampleCoverageInvert(false),
+ mSampleMask(false),
+ mMaxSampleMaskWords(0),
+ mStencilRef(0),
+ mStencilBackRef(0),
+ mLineWidth(0),
+ mGenerateMipmapHint(GL_NONE),
+ mFragmentShaderDerivativeHint(GL_NONE),
+ mBindGeneratesResource(bindGeneratesResource),
+ mClientArraysEnabled(clientArraysEnabled),
+ mNearZ(0),
+ mFarZ(0),
+ mReadFramebuffer(nullptr),
+ mDrawFramebuffer(nullptr),
+ mProgram(nullptr),
+ mProvokingVertex(gl::ProvokingVertexConvention::LastVertexConvention),
+ mVertexArray(nullptr),
+ mActiveSampler(0),
+ mActiveTexturesCache{},
+ mTexturesIncompatibleWithSamplers(0),
+ mPrimitiveRestart(false),
+ mDebug(debug),
+ mMultiSampling(false),
+ mSampleAlphaToOne(false),
+ mFramebufferSRGB(true),
+ mRobustResourceInit(robustResourceInit),
+ mProgramBinaryCacheEnabled(programBinaryCacheEnabled),
+ mMaxShaderCompilerThreads(std::numeric_limits<GLuint>::max())
+{}
+
+State::~State() {}
+
+void State::initialize(Context *context)
+{
+ const Caps &caps = context->getCaps();
+ const Extensions &extensions = context->getExtensions();
+ const Extensions &nativeExtensions = context->getImplementation()->getNativeExtensions();
+ const Version &clientVersion = context->getClientVersion();
+
+ mMaxDrawBuffers = caps.maxDrawBuffers;
+ mMaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
+
+ setColorClearValue(0.0f, 0.0f, 0.0f, 0.0f);
+
+ mDepthClearValue = 1.0f;
+ mStencilClearValue = 0;
+
+ mScissorTest = false;
+ mScissor.x = 0;
+ mScissor.y = 0;
+ mScissor.width = 0;
+ mScissor.height = 0;
+
+ mBlendColor.red = 0;
+ mBlendColor.green = 0;
+ mBlendColor.blue = 0;
+ mBlendColor.alpha = 0;
+
+ mStencilRef = 0;
+ mStencilBackRef = 0;
+
+ mSampleCoverage = false;
+ mSampleCoverageValue = 1.0f;
+ mSampleCoverageInvert = false;
+
+ mMaxSampleMaskWords = caps.maxSampleMaskWords;
+ mSampleMask = false;
+ mSampleMaskValues.fill(~GLbitfield(0));
+
+ mGenerateMipmapHint = GL_DONT_CARE;
+ mFragmentShaderDerivativeHint = GL_DONT_CARE;
+
+ mLineWidth = 1.0f;
+
+ mViewport.x = 0;
+ mViewport.y = 0;
+ mViewport.width = 0;
+ mViewport.height = 0;
+ mNearZ = 0.0f;
+ mFarZ = 1.0f;
+
+ mBlend.colorMaskRed = true;
+ mBlend.colorMaskGreen = true;
+ mBlend.colorMaskBlue = true;
+ mBlend.colorMaskAlpha = true;
+
+ mActiveSampler = 0;
+
+ mVertexAttribCurrentValues.resize(caps.maxVertexAttributes);
+
+ // Set all indexes in state attributes type mask to float (default)
+ for (int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
+ {
+ SetComponentTypeMask(ComponentType::Float, i, &mCurrentValuesTypeMask);
+ }
+
+ mUniformBuffers.resize(caps.maxUniformBufferBindings);
+
+ mSamplerTextures[TextureType::_2D].resize(caps.maxCombinedTextureImageUnits);
+ mSamplerTextures[TextureType::CubeMap].resize(caps.maxCombinedTextureImageUnits);
+ if (clientVersion >= Version(3, 0) || nativeExtensions.texture3DOES)
+ {
+ mSamplerTextures[TextureType::_3D].resize(caps.maxCombinedTextureImageUnits);
+ }
+ if (clientVersion >= Version(3, 0))
+ {
+ mSamplerTextures[TextureType::_2DArray].resize(caps.maxCombinedTextureImageUnits);
+ }
+ if (clientVersion >= Version(3, 1) || nativeExtensions.textureMultisample)
+ {
+ mSamplerTextures[TextureType::_2DMultisample].resize(caps.maxCombinedTextureImageUnits);
+ }
+ if (clientVersion >= Version(3, 1))
+ {
+ mSamplerTextures[TextureType::_2DMultisampleArray].resize(
+ caps.maxCombinedTextureImageUnits);
+
+ mAtomicCounterBuffers.resize(caps.maxAtomicCounterBufferBindings);
+ mShaderStorageBuffers.resize(caps.maxShaderStorageBufferBindings);
+ mImageUnits.resize(caps.maxImageUnits);
+ }
+ if (nativeExtensions.textureRectangle)
+ {
+ mSamplerTextures[TextureType::Rectangle].resize(caps.maxCombinedTextureImageUnits);
+ }
+ if (nativeExtensions.eglImageExternal || nativeExtensions.eglStreamConsumerExternal)
+ {
+ mSamplerTextures[TextureType::External].resize(caps.maxCombinedTextureImageUnits);
+ }
+ mCompleteTextureBindings.reserve(caps.maxCombinedTextureImageUnits);
+ for (uint32_t textureIndex = 0; textureIndex < caps.maxCombinedTextureImageUnits;
+ ++textureIndex)
+ {
+ mCompleteTextureBindings.emplace_back(context, textureIndex);
+ }
+
+ mSamplers.resize(caps.maxCombinedTextureImageUnits);
+
+ for (QueryType type : angle::AllEnums<QueryType>())
+ {
+ mActiveQueries[type].set(context, nullptr);
+ }
+
+ mProgram = nullptr;
+
+ mReadFramebuffer = nullptr;
+ mDrawFramebuffer = nullptr;
+
+ mPrimitiveRestart = false;
+
+ mDebug.setMaxLoggedMessages(extensions.maxDebugLoggedMessages);
+
+ mMultiSampling = true;
+ mSampleAlphaToOne = false;
+
+ mCoverageModulation = GL_NONE;
+
+ angle::Matrix<GLfloat>::setToIdentity(mPathMatrixProj);
+ angle::Matrix<GLfloat>::setToIdentity(mPathMatrixMV);
+ mPathStencilFunc = GL_ALWAYS;
+ mPathStencilRef = 0;
+ mPathStencilMask = std::numeric_limits<GLuint>::max();
+
+ // GLES1 emulation: Initialize state for GLES1 if version
+ // applies
+ if (clientVersion < Version(2, 0))
+ {
+ mGLES1State.initialize(context, this);
+ }
+}
+
+void State::reset(const Context *context)
+{
+ for (auto &bindingVec : mSamplerTextures)
+ {
+ for (size_t textureIdx = 0; textureIdx < bindingVec.size(); textureIdx++)
+ {
+ bindingVec[textureIdx].set(context, nullptr);
+ }
+ }
+ for (size_t samplerIdx = 0; samplerIdx < mSamplers.size(); samplerIdx++)
+ {
+ mSamplers[samplerIdx].set(context, nullptr);
+ }
+
+ for (auto &imageUnit : mImageUnits)
+ {
+ imageUnit.texture.set(context, nullptr);
+ imageUnit.level = 0;
+ imageUnit.layered = false;
+ imageUnit.layer = 0;
+ imageUnit.access = GL_READ_ONLY;
+ imageUnit.format = GL_R32UI;
+ }
+
+ mRenderbuffer.set(context, nullptr);
+
+ for (auto type : angle::AllEnums<BufferBinding>())
+ {
+ UpdateBufferBinding(context, &mBoundBuffers[type], nullptr, type);
+ }
+
+ if (mProgram)
+ {
+ mProgram->release(context);
+ }
+ mProgram = nullptr;
+
+ mProgramPipeline.set(context, nullptr);
+
+ if (mTransformFeedback.get())
+ mTransformFeedback->onBindingChanged(context, false);
+ mTransformFeedback.set(context, nullptr);
+
+ for (QueryType type : angle::AllEnums<QueryType>())
+ {
+ mActiveQueries[type].set(context, nullptr);
+ }
+
+ for (auto &buf : mUniformBuffers)
+ {
+ UpdateIndexedBufferBinding(context, &buf, nullptr, BufferBinding::Uniform, 0, 0);
+ }
+
+ for (auto &buf : mAtomicCounterBuffers)
+ {
+ UpdateIndexedBufferBinding(context, &buf, nullptr, BufferBinding::AtomicCounter, 0, 0);
+ }
+
+ for (auto &buf : mShaderStorageBuffers)
+ {
+ UpdateIndexedBufferBinding(context, &buf, nullptr, BufferBinding::ShaderStorage, 0, 0);
+ }
+
+ angle::Matrix<GLfloat>::setToIdentity(mPathMatrixProj);
+ angle::Matrix<GLfloat>::setToIdentity(mPathMatrixMV);
+ mPathStencilFunc = GL_ALWAYS;
+ mPathStencilRef = 0;
+ mPathStencilMask = std::numeric_limits<GLuint>::max();
+
+ setAllDirtyBits();
+}
+
+ANGLE_INLINE void State::unsetActiveTextures(ActiveTextureMask textureMask)
+{
+ // Unset any relevant bound textures.
+ for (size_t textureIndex : mProgram->getActiveSamplersMask())
+ {
+ mActiveTexturesCache[textureIndex] = nullptr;
+ mCompleteTextureBindings[textureIndex].reset();
+ }
+}
+
+ANGLE_INLINE void State::updateActiveTextureState(const Context *context,
+ size_t textureIndex,
+ const Sampler *sampler,
+ Texture *texture)
+{
+ if (!texture || !texture->isSamplerComplete(context, sampler))
+ {
+ mActiveTexturesCache[textureIndex] = nullptr;
+ }
+ else
+ {
+ mActiveTexturesCache[textureIndex] = texture;
+
+ if (texture->hasAnyDirtyBit())
+ {
+ setTextureDirty(textureIndex);
+ }
+
+ if (mRobustResourceInit && texture->initState() == InitState::MayNeedInit)
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_TEXTURES_INIT);
+ }
+ }
+
+ if (texture && mProgram)
+ {
+ const SamplerState &samplerState =
+ sampler ? sampler->getSamplerState() : texture->getSamplerState();
+ mTexturesIncompatibleWithSamplers[textureIndex] =
+ !texture->getTextureState().compatibleWithSamplerFormat(
+ mProgram->getState().getSamplerFormatForTextureUnitIndex(textureIndex),
+ samplerState);
+ }
+ else
+ {
+ mTexturesIncompatibleWithSamplers[textureIndex] = false;
+ }
+
+ mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
+}
+
+ANGLE_INLINE void State::updateActiveTexture(const Context *context,
+ size_t textureIndex,
+ Texture *texture)
+{
+ const Sampler *sampler = mSamplers[textureIndex].get();
+
+ mCompleteTextureBindings[textureIndex].bind(texture);
+
+ if (!texture)
+ {
+ mActiveTexturesCache[textureIndex] = nullptr;
+ mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
+ return;
+ }
+
+ updateActiveTextureState(context, textureIndex, sampler, texture);
+}
+
+const RasterizerState &State::getRasterizerState() const
+{
+ return mRasterizer;
+}
+
+const DepthStencilState &State::getDepthStencilState() const
+{
+ return mDepthStencil;
+}
+
+void State::setColorClearValue(float red, float green, float blue, float alpha)
+{
+ mColorClearValue.red = red;
+ mColorClearValue.green = green;
+ mColorClearValue.blue = blue;
+ mColorClearValue.alpha = alpha;
+ mDirtyBits.set(DIRTY_BIT_CLEAR_COLOR);
+}
+
+void State::setDepthClearValue(float depth)
+{
+ mDepthClearValue = depth;
+ mDirtyBits.set(DIRTY_BIT_CLEAR_DEPTH);
+}
+
+void State::setStencilClearValue(int stencil)
+{
+ mStencilClearValue = stencil;
+ mDirtyBits.set(DIRTY_BIT_CLEAR_STENCIL);
+}
+
+void State::setColorMask(bool red, bool green, bool blue, bool alpha)
+{
+ mBlend.colorMaskRed = red;
+ mBlend.colorMaskGreen = green;
+ mBlend.colorMaskBlue = blue;
+ mBlend.colorMaskAlpha = alpha;
+ mDirtyBits.set(DIRTY_BIT_COLOR_MASK);
+}
+
+void State::setDepthMask(bool mask)
+{
+ mDepthStencil.depthMask = mask;
+ mDirtyBits.set(DIRTY_BIT_DEPTH_MASK);
+}
+
+void State::setRasterizerDiscard(bool enabled)
+{
+ mRasterizer.rasterizerDiscard = enabled;
+ mDirtyBits.set(DIRTY_BIT_RASTERIZER_DISCARD_ENABLED);
+}
+
+void State::setCullFace(bool enabled)
+{
+ mRasterizer.cullFace = enabled;
+ mDirtyBits.set(DIRTY_BIT_CULL_FACE_ENABLED);
+}
+
+void State::setCullMode(CullFaceMode mode)
+{
+ mRasterizer.cullMode = mode;
+ mDirtyBits.set(DIRTY_BIT_CULL_FACE);
+}
+
+void State::setFrontFace(GLenum front)
+{
+ mRasterizer.frontFace = front;
+ mDirtyBits.set(DIRTY_BIT_FRONT_FACE);
+}
+
+void State::setDepthTest(bool enabled)
+{
+ mDepthStencil.depthTest = enabled;
+ mDirtyBits.set(DIRTY_BIT_DEPTH_TEST_ENABLED);
+}
+
+void State::setDepthFunc(GLenum depthFunc)
+{
+ mDepthStencil.depthFunc = depthFunc;
+ mDirtyBits.set(DIRTY_BIT_DEPTH_FUNC);
+}
+
+void State::setDepthRange(float zNear, float zFar)
+{
+ if (mNearZ != zNear || mFarZ != zFar)
+ {
+ mNearZ = zNear;
+ mFarZ = zFar;
+ mDirtyBits.set(DIRTY_BIT_DEPTH_RANGE);
+ }
+}
+
+void State::setBlend(bool enabled)
+{
+ mBlend.blend = enabled;
+ mDirtyBits.set(DIRTY_BIT_BLEND_ENABLED);
+}
+
+void State::setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha)
+{
+ mBlend.sourceBlendRGB = sourceRGB;
+ mBlend.destBlendRGB = destRGB;
+ mBlend.sourceBlendAlpha = sourceAlpha;
+ mBlend.destBlendAlpha = destAlpha;
+ mDirtyBits.set(DIRTY_BIT_BLEND_FUNCS);
+}
+
+void State::setBlendColor(float red, float green, float blue, float alpha)
+{
+ mBlendColor.red = red;
+ mBlendColor.green = green;
+ mBlendColor.blue = blue;
+ mBlendColor.alpha = alpha;
+ mDirtyBits.set(DIRTY_BIT_BLEND_COLOR);
+}
+
+void State::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation)
+{
+ mBlend.blendEquationRGB = rgbEquation;
+ mBlend.blendEquationAlpha = alphaEquation;
+ mDirtyBits.set(DIRTY_BIT_BLEND_EQUATIONS);
+}
+
+void State::setStencilTest(bool enabled)
+{
+ mDepthStencil.stencilTest = enabled;
+ mDirtyBits.set(DIRTY_BIT_STENCIL_TEST_ENABLED);
+}
+
+void State::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask)
+{
+ mDepthStencil.stencilFunc = stencilFunc;
+ mStencilRef = gl::clamp(stencilRef, 0, std::numeric_limits<uint8_t>::max());
+ mDepthStencil.stencilMask = stencilMask;
+ mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT);
+}
+
+void State::setStencilBackParams(GLenum stencilBackFunc,
+ GLint stencilBackRef,
+ GLuint stencilBackMask)
+{
+ mDepthStencil.stencilBackFunc = stencilBackFunc;
+ mStencilBackRef = gl::clamp(stencilBackRef, 0, std::numeric_limits<uint8_t>::max());
+ mDepthStencil.stencilBackMask = stencilBackMask;
+ mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_BACK);
+}
+
+void State::setStencilWritemask(GLuint stencilWritemask)
+{
+ mDepthStencil.stencilWritemask = stencilWritemask;
+ mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_FRONT);
+}
+
+void State::setStencilBackWritemask(GLuint stencilBackWritemask)
+{
+ mDepthStencil.stencilBackWritemask = stencilBackWritemask;
+ mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_BACK);
+}
+
+void State::setStencilOperations(GLenum stencilFail,
+ GLenum stencilPassDepthFail,
+ GLenum stencilPassDepthPass)
+{
+ mDepthStencil.stencilFail = stencilFail;
+ mDepthStencil.stencilPassDepthFail = stencilPassDepthFail;
+ mDepthStencil.stencilPassDepthPass = stencilPassDepthPass;
+ mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_FRONT);
+}
+
+void State::setStencilBackOperations(GLenum stencilBackFail,
+ GLenum stencilBackPassDepthFail,
+ GLenum stencilBackPassDepthPass)
+{
+ mDepthStencil.stencilBackFail = stencilBackFail;
+ mDepthStencil.stencilBackPassDepthFail = stencilBackPassDepthFail;
+ mDepthStencil.stencilBackPassDepthPass = stencilBackPassDepthPass;
+ mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_BACK);
+}
+
+void State::setPolygonOffsetFill(bool enabled)
+{
+ mRasterizer.polygonOffsetFill = enabled;
+ mDirtyBits.set(DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED);
+}
+
+void State::setPolygonOffsetParams(GLfloat factor, GLfloat units)
+{
+ // An application can pass NaN values here, so handle this gracefully
+ mRasterizer.polygonOffsetFactor = factor != factor ? 0.0f : factor;
+ mRasterizer.polygonOffsetUnits = units != units ? 0.0f : units;
+ mDirtyBits.set(DIRTY_BIT_POLYGON_OFFSET);
+}
+
+void State::setSampleAlphaToCoverage(bool enabled)
+{
+ mBlend.sampleAlphaToCoverage = enabled;
+ mDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED);
+}
+
+void State::setSampleCoverage(bool enabled)
+{
+ mSampleCoverage = enabled;
+ mDirtyBits.set(DIRTY_BIT_SAMPLE_COVERAGE_ENABLED);
+}
+
+void State::setSampleCoverageParams(GLclampf value, bool invert)
+{
+ mSampleCoverageValue = value;
+ mSampleCoverageInvert = invert;
+ mDirtyBits.set(DIRTY_BIT_SAMPLE_COVERAGE);
+}
+
+void State::setSampleMaskEnabled(bool enabled)
+{
+ mSampleMask = enabled;
+ mDirtyBits.set(DIRTY_BIT_SAMPLE_MASK_ENABLED);
+}
+
+void State::setSampleMaskParams(GLuint maskNumber, GLbitfield mask)
+{
+ ASSERT(maskNumber < mMaxSampleMaskWords);
+ mSampleMaskValues[maskNumber] = mask;
+ // TODO(jmadill): Use a child dirty bit if we ever use more than two words.
+ mDirtyBits.set(DIRTY_BIT_SAMPLE_MASK);
+}
+
+void State::setSampleAlphaToOne(bool enabled)
+{
+ mSampleAlphaToOne = enabled;
+ mDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_ONE);
+}
+
+void State::setMultisampling(bool enabled)
+{
+ mMultiSampling = enabled;
+ mDirtyBits.set(DIRTY_BIT_MULTISAMPLING);
+}
+
+void State::setScissorTest(bool enabled)
+{
+ mScissorTest = enabled;
+ mDirtyBits.set(DIRTY_BIT_SCISSOR_TEST_ENABLED);
+}
+
+void State::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ mScissor.x = x;
+ mScissor.y = y;
+ mScissor.width = width;
+ mScissor.height = height;
+ mDirtyBits.set(DIRTY_BIT_SCISSOR);
+}
+
+void State::setDither(bool enabled)
+{
+ mBlend.dither = enabled;
+ mDirtyBits.set(DIRTY_BIT_DITHER_ENABLED);
+}
+
+void State::setPrimitiveRestart(bool enabled)
+{
+ mPrimitiveRestart = enabled;
+ mDirtyBits.set(DIRTY_BIT_PRIMITIVE_RESTART_ENABLED);
+}
+
+void State::setEnableFeature(GLenum feature, bool enabled)
+{
+ switch (feature)
+ {
+ case GL_MULTISAMPLE_EXT:
+ setMultisampling(enabled);
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_EXT:
+ setSampleAlphaToOne(enabled);
+ break;
+ case GL_CULL_FACE:
+ setCullFace(enabled);
+ break;
+ case GL_POLYGON_OFFSET_FILL:
+ setPolygonOffsetFill(enabled);
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ setSampleAlphaToCoverage(enabled);
+ break;
+ case GL_SAMPLE_COVERAGE:
+ setSampleCoverage(enabled);
+ break;
+ case GL_SCISSOR_TEST:
+ setScissorTest(enabled);
+ break;
+ case GL_STENCIL_TEST:
+ setStencilTest(enabled);
+ break;
+ case GL_DEPTH_TEST:
+ setDepthTest(enabled);
+ break;
+ case GL_BLEND:
+ setBlend(enabled);
+ break;
+ case GL_DITHER:
+ setDither(enabled);
+ break;
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ setPrimitiveRestart(enabled);
+ break;
+ case GL_RASTERIZER_DISCARD:
+ setRasterizerDiscard(enabled);
+ break;
+ case GL_SAMPLE_MASK:
+ setSampleMaskEnabled(enabled);
+ break;
+ case GL_DEBUG_OUTPUT_SYNCHRONOUS:
+ mDebug.setOutputSynchronous(enabled);
+ break;
+ case GL_DEBUG_OUTPUT:
+ mDebug.setOutputEnabled(enabled);
+ break;
+ case GL_FRAMEBUFFER_SRGB_EXT:
+ setFramebufferSRGB(enabled);
+ break;
+
+ // GLES1 emulation
+ case GL_ALPHA_TEST:
+ mGLES1State.mAlphaTestEnabled = enabled;
+ break;
+ case GL_TEXTURE_2D:
+ mGLES1State.mTexUnitEnables[mActiveSampler].set(TextureType::_2D, enabled);
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ mGLES1State.mTexUnitEnables[mActiveSampler].set(TextureType::CubeMap, enabled);
+ break;
+ case GL_LIGHTING:
+ mGLES1State.mLightingEnabled = enabled;
+ break;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ mGLES1State.mLights[feature - GL_LIGHT0].enabled = enabled;
+ break;
+ case GL_NORMALIZE:
+ mGLES1State.mNormalizeEnabled = enabled;
+ break;
+ case GL_RESCALE_NORMAL:
+ mGLES1State.mRescaleNormalEnabled = enabled;
+ break;
+ case GL_COLOR_MATERIAL:
+ mGLES1State.mColorMaterialEnabled = enabled;
+ break;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ mGLES1State.mClipPlanes[feature - GL_CLIP_PLANE0].enabled = enabled;
+ break;
+ case GL_FOG:
+ mGLES1State.mFogEnabled = enabled;
+ break;
+ case GL_POINT_SMOOTH:
+ mGLES1State.mPointSmoothEnabled = enabled;
+ break;
+ case GL_LINE_SMOOTH:
+ mGLES1State.mLineSmoothEnabled = enabled;
+ break;
+ case GL_POINT_SPRITE_OES:
+ mGLES1State.mPointSpriteEnabled = enabled;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ mGLES1State.mLogicOpEnabled = enabled;
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+bool State::getEnableFeature(GLenum feature) const
+{
+ switch (feature)
+ {
+ case GL_MULTISAMPLE_EXT:
+ return isMultisamplingEnabled();
+ case GL_SAMPLE_ALPHA_TO_ONE_EXT:
+ return isSampleAlphaToOneEnabled();
+ case GL_CULL_FACE:
+ return isCullFaceEnabled();
+ case GL_POLYGON_OFFSET_FILL:
+ return isPolygonOffsetFillEnabled();
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ return isSampleAlphaToCoverageEnabled();
+ case GL_SAMPLE_COVERAGE:
+ return isSampleCoverageEnabled();
+ case GL_SCISSOR_TEST:
+ return isScissorTestEnabled();
+ case GL_STENCIL_TEST:
+ return isStencilTestEnabled();
+ case GL_DEPTH_TEST:
+ return isDepthTestEnabled();
+ case GL_BLEND:
+ return isBlendEnabled();
+ case GL_DITHER:
+ return isDitherEnabled();
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ return isPrimitiveRestartEnabled();
+ case GL_RASTERIZER_DISCARD:
+ return isRasterizerDiscardEnabled();
+ case GL_SAMPLE_MASK:
+ return isSampleMaskEnabled();
+ case GL_DEBUG_OUTPUT_SYNCHRONOUS:
+ return mDebug.isOutputSynchronous();
+ case GL_DEBUG_OUTPUT:
+ return mDebug.isOutputEnabled();
+ case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
+ return isBindGeneratesResourceEnabled();
+ case GL_CLIENT_ARRAYS_ANGLE:
+ return areClientArraysEnabled();
+ case GL_FRAMEBUFFER_SRGB_EXT:
+ return getFramebufferSRGB();
+ case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ return mRobustResourceInit;
+ case GL_PROGRAM_CACHE_ENABLED_ANGLE:
+ return mProgramBinaryCacheEnabled;
+
+ // GLES1 emulation
+ case GL_ALPHA_TEST:
+ return mGLES1State.mAlphaTestEnabled;
+ case GL_VERTEX_ARRAY:
+ return mGLES1State.mVertexArrayEnabled;
+ case GL_NORMAL_ARRAY:
+ return mGLES1State.mNormalArrayEnabled;
+ case GL_COLOR_ARRAY:
+ return mGLES1State.mColorArrayEnabled;
+ case GL_POINT_SIZE_ARRAY_OES:
+ return mGLES1State.mPointSizeArrayEnabled;
+ case GL_TEXTURE_COORD_ARRAY:
+ return mGLES1State.mTexCoordArrayEnabled[mGLES1State.mClientActiveTexture];
+ case GL_TEXTURE_2D:
+ return mGLES1State.mTexUnitEnables[mActiveSampler].test(TextureType::_2D);
+ case GL_TEXTURE_CUBE_MAP:
+ return mGLES1State.mTexUnitEnables[mActiveSampler].test(TextureType::CubeMap);
+ case GL_LIGHTING:
+ return mGLES1State.mLightingEnabled;
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ return mGLES1State.mLights[feature - GL_LIGHT0].enabled;
+ case GL_NORMALIZE:
+ return mGLES1State.mNormalizeEnabled;
+ case GL_RESCALE_NORMAL:
+ return mGLES1State.mRescaleNormalEnabled;
+ case GL_COLOR_MATERIAL:
+ return mGLES1State.mColorMaterialEnabled;
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ return mGLES1State.mClipPlanes[feature - GL_CLIP_PLANE0].enabled;
+ case GL_FOG:
+ return mGLES1State.mFogEnabled;
+ case GL_POINT_SMOOTH:
+ return mGLES1State.mPointSmoothEnabled;
+ case GL_LINE_SMOOTH:
+ return mGLES1State.mLineSmoothEnabled;
+ case GL_POINT_SPRITE_OES:
+ return mGLES1State.mPointSpriteEnabled;
+ case GL_COLOR_LOGIC_OP:
+ return mGLES1State.mLogicOpEnabled;
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+void State::setLineWidth(GLfloat width)
+{
+ mLineWidth = width;
+ mDirtyBits.set(DIRTY_BIT_LINE_WIDTH);
+}
+
+void State::setGenerateMipmapHint(GLenum hint)
+{
+ mGenerateMipmapHint = hint;
+ mDirtyBits.set(DIRTY_BIT_GENERATE_MIPMAP_HINT);
+}
+
+void State::setFragmentShaderDerivativeHint(GLenum hint)
+{
+ mFragmentShaderDerivativeHint = hint;
+ mDirtyBits.set(DIRTY_BIT_SHADER_DERIVATIVE_HINT);
+ // TODO: Propagate the hint to shader translator so we can write
+ // ddx, ddx_coarse, or ddx_fine depending on the hint.
+ // Ignore for now. It is valid for implementations to ignore hint.
+}
+
+void State::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ mViewport.x = x;
+ mViewport.y = y;
+ mViewport.width = width;
+ mViewport.height = height;
+ mDirtyBits.set(DIRTY_BIT_VIEWPORT);
+}
+
+void State::setActiveSampler(unsigned int active)
+{
+ mActiveSampler = active;
+}
+
+void State::setSamplerTexture(const Context *context, TextureType type, Texture *texture)
+{
+ mSamplerTextures[type][mActiveSampler].set(context, texture);
+
+ if (mProgram && mProgram->getActiveSamplersMask()[mActiveSampler] &&
+ mProgram->getActiveSamplerTypes()[mActiveSampler] == type)
+ {
+ updateActiveTexture(context, mActiveSampler, texture);
+ }
+
+ mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
+}
+
+Texture *State::getTargetTexture(TextureType type) const
+{
+ return getSamplerTexture(static_cast<unsigned int>(mActiveSampler), type);
+}
+
+GLuint State::getSamplerTextureId(unsigned int sampler, TextureType type) const
+{
+ ASSERT(sampler < mSamplerTextures[type].size());
+ return mSamplerTextures[type][sampler].id();
+}
+
+void State::detachTexture(const Context *context, const TextureMap &zeroTextures, GLuint texture)
+{
+ // Textures have a detach method on State rather than a simple
+ // removeBinding, because the zero/null texture objects are managed
+ // separately, and don't have to go through the Context's maps or
+ // the ResourceManager.
+
+ // [OpenGL ES 2.0.24] section 3.8 page 84:
+ // If a texture object is deleted, it is as if all texture units which are bound to that texture
+ // object are rebound to texture object zero
+
+ for (TextureType type : angle::AllEnums<TextureType>())
+ {
+ TextureBindingVector &textureVector = mSamplerTextures[type];
+
+ for (size_t bindingIndex = 0; bindingIndex < textureVector.size(); ++bindingIndex)
+ {
+ BindingPointer<Texture> &binding = textureVector[bindingIndex];
+ if (binding.id() == texture)
+ {
+ // Zero textures are the "default" textures instead of NULL
+ Texture *zeroTexture = zeroTextures[type].get();
+ ASSERT(zeroTexture != nullptr);
+ if (mCompleteTextureBindings[bindingIndex].getSubject() == binding.get())
+ {
+ updateActiveTexture(context, bindingIndex, zeroTexture);
+ }
+ binding.set(context, zeroTexture);
+ }
+ }
+ }
+
+ for (auto &bindingImageUnit : mImageUnits)
+ {
+ if (bindingImageUnit.texture.id() == texture)
+ {
+ bindingImageUnit.texture.set(context, nullptr);
+ bindingImageUnit.level = 0;
+ bindingImageUnit.layered = false;
+ bindingImageUnit.layer = 0;
+ bindingImageUnit.access = GL_READ_ONLY;
+ bindingImageUnit.format = GL_R32UI;
+ break;
+ }
+ }
+
+ // [OpenGL ES 2.0.24] section 4.4 page 112:
+ // If a texture object is deleted while its image is attached to the currently bound
+ // framebuffer, then it is as if Texture2DAttachment had been called, with a texture of 0, for
+ // each attachment point to which this image was attached in the currently bound framebuffer.
+
+ if (mReadFramebuffer && mReadFramebuffer->detachTexture(context, texture))
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ }
+
+ if (mDrawFramebuffer && mDrawFramebuffer->detachTexture(context, texture))
+ {
+ setDrawFramebufferDirty();
+ }
+}
+
+void State::initializeZeroTextures(const Context *context, const TextureMap &zeroTextures)
+{
+ for (TextureType type : angle::AllEnums<TextureType>())
+ {
+ for (size_t textureUnit = 0; textureUnit < mSamplerTextures[type].size(); ++textureUnit)
+ {
+ mSamplerTextures[type][textureUnit].set(context, zeroTextures[type].get());
+ }
+ }
+}
+
+void State::invalidateTexture(TextureType type)
+{
+ mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS);
+}
+
+void State::setSamplerBinding(const Context *context, GLuint textureUnit, Sampler *sampler)
+{
+ mSamplers[textureUnit].set(context, sampler);
+ mDirtyBits.set(DIRTY_BIT_SAMPLER_BINDINGS);
+ // This is overly conservative as it assumes the sampler has never been bound.
+ setSamplerDirty(textureUnit);
+ onActiveTextureChange(context, textureUnit);
+ onActiveTextureStateChange(context, textureUnit);
+}
+
+void State::detachSampler(const Context *context, GLuint sampler)
+{
+ // [OpenGL ES 3.0.2] section 3.8.2 pages 123-124:
+ // If a sampler object that is currently bound to one or more texture units is
+ // deleted, it is as though BindSampler is called once for each texture unit to
+ // which the sampler is bound, with unit set to the texture unit and sampler set to zero.
+ for (size_t i = 0; i < mSamplers.size(); i++)
+ {
+ if (mSamplers[i].id() == sampler)
+ {
+ setSamplerBinding(context, i, nullptr);
+ }
+ }
+}
+
+void State::setRenderbufferBinding(const Context *context, Renderbuffer *renderbuffer)
+{
+ mRenderbuffer.set(context, renderbuffer);
+ mDirtyBits.set(DIRTY_BIT_RENDERBUFFER_BINDING);
+}
+
+void State::detachRenderbuffer(const Context *context, GLuint renderbuffer)
+{
+ // [OpenGL ES 2.0.24] section 4.4 page 109:
+ // If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though
+ // BindRenderbuffer had been executed with the target RENDERBUFFER and name of zero.
+
+ if (mRenderbuffer.id() == renderbuffer)
+ {
+ setRenderbufferBinding(context, nullptr);
+ }
+
+ // [OpenGL ES 2.0.24] section 4.4 page 111:
+ // If a renderbuffer object is deleted while its image is attached to the currently bound
+ // framebuffer, then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of
+ // 0, for each attachment point to which this image was attached in the currently bound
+ // framebuffer.
+
+ Framebuffer *readFramebuffer = mReadFramebuffer;
+ Framebuffer *drawFramebuffer = mDrawFramebuffer;
+
+ if (readFramebuffer && readFramebuffer->detachRenderbuffer(context, renderbuffer))
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ }
+
+ if (drawFramebuffer && drawFramebuffer != readFramebuffer)
+ {
+ if (drawFramebuffer->detachRenderbuffer(context, renderbuffer))
+ {
+ setDrawFramebufferDirty();
+ }
+ }
+}
+
+void State::setReadFramebufferBinding(Framebuffer *framebuffer)
+{
+ if (mReadFramebuffer == framebuffer)
+ return;
+
+ mReadFramebuffer = framebuffer;
+ mDirtyBits.set(DIRTY_BIT_READ_FRAMEBUFFER_BINDING);
+
+ if (mReadFramebuffer && mReadFramebuffer->hasAnyDirtyBit())
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ }
+}
+
+void State::setDrawFramebufferBinding(Framebuffer *framebuffer)
+{
+ if (mDrawFramebuffer == framebuffer)
+ return;
+
+ mDrawFramebuffer = framebuffer;
+ mDirtyBits.set(DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING);
+
+ if (mDrawFramebuffer)
+ {
+ if (mDrawFramebuffer->hasAnyDirtyBit())
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
+ }
+
+ if (mRobustResourceInit && mDrawFramebuffer->hasResourceThatNeedsInit())
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_DRAW_ATTACHMENTS);
+ }
+ }
+}
+
+Framebuffer *State::getTargetFramebuffer(GLenum target) const
+{
+ switch (target)
+ {
+ case GL_READ_FRAMEBUFFER_ANGLE:
+ return mReadFramebuffer;
+ case GL_DRAW_FRAMEBUFFER_ANGLE:
+ case GL_FRAMEBUFFER:
+ return mDrawFramebuffer;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+bool State::removeReadFramebufferBinding(GLuint framebuffer)
+{
+ if (mReadFramebuffer != nullptr && mReadFramebuffer->id() == framebuffer)
+ {
+ setReadFramebufferBinding(nullptr);
+ return true;
+ }
+
+ return false;
+}
+
+bool State::removeDrawFramebufferBinding(GLuint framebuffer)
+{
+ if (mReadFramebuffer != nullptr && mDrawFramebuffer->id() == framebuffer)
+ {
+ setDrawFramebufferBinding(nullptr);
+ return true;
+ }
+
+ return false;
+}
+
+void State::setVertexArrayBinding(const Context *context, VertexArray *vertexArray)
+{
+ if (mVertexArray == vertexArray)
+ return;
+ if (mVertexArray)
+ mVertexArray->onBindingChanged(context, -1);
+ mVertexArray = vertexArray;
+ if (vertexArray)
+ vertexArray->onBindingChanged(context, 1);
+ mDirtyBits.set(DIRTY_BIT_VERTEX_ARRAY_BINDING);
+
+ if (mVertexArray && mVertexArray->hasAnyDirtyBit())
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ }
+}
+
+bool State::removeVertexArrayBinding(const Context *context, GLuint vertexArray)
+{
+ if (mVertexArray && mVertexArray->id() == vertexArray)
+ {
+ mVertexArray->onBindingChanged(context, -1);
+ mVertexArray = nullptr;
+ mDirtyBits.set(DIRTY_BIT_VERTEX_ARRAY_BINDING);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ return true;
+ }
+
+ return false;
+}
+
+GLuint State::getVertexArrayId() const
+{
+ ASSERT(mVertexArray != nullptr);
+ return mVertexArray->id();
+}
+
+void State::bindVertexBuffer(const Context *context,
+ GLuint bindingIndex,
+ Buffer *boundBuffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ getVertexArray()->bindVertexBuffer(context, bindingIndex, boundBuffer, offset, stride);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+}
+
+void State::setVertexAttribFormat(GLuint attribIndex,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ bool pureInteger,
+ GLuint relativeOffset)
+{
+ getVertexArray()->setVertexAttribFormat(attribIndex, size, type, normalized, pureInteger,
+ relativeOffset);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+}
+
+void State::setVertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
+{
+ getVertexArray()->setVertexBindingDivisor(bindingIndex, divisor);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+}
+
+angle::Result State::setProgram(const Context *context, Program *newProgram)
+{
+ if (mProgram != newProgram)
+ {
+ if (mProgram)
+ {
+ unsetActiveTextures(mProgram->getActiveSamplersMask());
+ mProgram->release(context);
+ }
+
+ mProgram = newProgram;
+
+ if (mProgram)
+ {
+ newProgram->addRef();
+ ANGLE_TRY(onProgramExecutableChange(context, newProgram));
+ }
+
+ // Note that rendering is undefined if glUseProgram(0) is called. But ANGLE will generate
+ // an error if the app tries to draw in this case.
+
+ mDirtyBits.set(DIRTY_BIT_PROGRAM_BINDING);
+ }
+
+ return angle::Result::Continue;
+}
+
+void State::setTransformFeedbackBinding(const Context *context,
+ TransformFeedback *transformFeedback)
+{
+ if (transformFeedback == mTransformFeedback.get())
+ return;
+ if (mTransformFeedback.get())
+ mTransformFeedback->onBindingChanged(context, false);
+ mTransformFeedback.set(context, transformFeedback);
+ if (mTransformFeedback.get())
+ mTransformFeedback->onBindingChanged(context, true);
+ mDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING);
+}
+
+bool State::removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback)
+{
+ if (mTransformFeedback.id() == transformFeedback)
+ {
+ if (mTransformFeedback.get())
+ mTransformFeedback->onBindingChanged(context, false);
+ mTransformFeedback.set(context, nullptr);
+ return true;
+ }
+
+ return false;
+}
+
+void State::setProgramPipelineBinding(const Context *context, ProgramPipeline *pipeline)
+{
+ mProgramPipeline.set(context, pipeline);
+}
+
+void State::detachProgramPipeline(const Context *context, GLuint pipeline)
+{
+ mProgramPipeline.set(context, nullptr);
+}
+
+bool State::isQueryActive(QueryType type) const
+{
+ const Query *query = mActiveQueries[type].get();
+ if (query != nullptr)
+ {
+ return true;
+ }
+
+ QueryType alternativeType;
+ if (GetAlternativeQueryType(type, &alternativeType))
+ {
+ query = mActiveQueries[alternativeType].get();
+ return query != nullptr;
+ }
+
+ return false;
+}
+
+bool State::isQueryActive(Query *query) const
+{
+ for (auto &queryPointer : mActiveQueries)
+ {
+ if (queryPointer.get() == query)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void State::setActiveQuery(const Context *context, QueryType type, Query *query)
+{
+ mActiveQueries[type].set(context, query);
+}
+
+GLuint State::getActiveQueryId(QueryType type) const
+{
+ const Query *query = getActiveQuery(type);
+ return (query ? query->id() : 0u);
+}
+
+Query *State::getActiveQuery(QueryType type) const
+{
+ return mActiveQueries[type].get();
+}
+
+angle::Result State::setIndexedBufferBinding(const Context *context,
+ BufferBinding target,
+ GLuint index,
+ Buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ setBufferBinding(context, target, buffer);
+
+ switch (target)
+ {
+ case BufferBinding::TransformFeedback:
+ ANGLE_TRY(mTransformFeedback->bindIndexedBuffer(context, index, buffer, offset, size));
+ setBufferBinding(context, target, buffer);
+ break;
+ case BufferBinding::Uniform:
+ UpdateIndexedBufferBinding(context, &mUniformBuffers[index], buffer, target, offset,
+ size);
+ break;
+ case BufferBinding::AtomicCounter:
+ UpdateIndexedBufferBinding(context, &mAtomicCounterBuffers[index], buffer, target,
+ offset, size);
+ break;
+ case BufferBinding::ShaderStorage:
+ UpdateIndexedBufferBinding(context, &mShaderStorageBuffers[index], buffer, target,
+ offset, size);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return angle::Result::Continue;
+}
+
+const OffsetBindingPointer<Buffer> &State::getIndexedUniformBuffer(size_t index) const
+{
+ ASSERT(static_cast<size_t>(index) < mUniformBuffers.size());
+ return mUniformBuffers[index];
+}
+
+const OffsetBindingPointer<Buffer> &State::getIndexedAtomicCounterBuffer(size_t index) const
+{
+ ASSERT(static_cast<size_t>(index) < mAtomicCounterBuffers.size());
+ return mAtomicCounterBuffers[index];
+}
+
+const OffsetBindingPointer<Buffer> &State::getIndexedShaderStorageBuffer(size_t index) const
+{
+ ASSERT(static_cast<size_t>(index) < mShaderStorageBuffers.size());
+ return mShaderStorageBuffers[index];
+}
+
+angle::Result State::detachBuffer(Context *context, const Buffer *buffer)
+{
+ if (!buffer->isBound())
+ {
+ return angle::Result::Continue;
+ }
+ GLuint bufferName = buffer->id();
+ for (auto target : angle::AllEnums<BufferBinding>())
+ {
+ if (mBoundBuffers[target].id() == bufferName)
+ {
+ UpdateBufferBinding(context, &mBoundBuffers[target], nullptr, target);
+ }
+ }
+
+ TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
+ if (curTransformFeedback)
+ {
+ ANGLE_TRY(curTransformFeedback->detachBuffer(context, bufferName));
+ }
+
+ if (getVertexArray()->detachBuffer(context, bufferName))
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ context->getStateCache().onVertexArrayStateChange(context);
+ }
+
+ for (auto &buf : mUniformBuffers)
+ {
+ if (buf.id() == bufferName)
+ {
+ UpdateIndexedBufferBinding(context, &buf, nullptr, BufferBinding::Uniform, 0, 0);
+ }
+ }
+
+ for (auto &buf : mAtomicCounterBuffers)
+ {
+ if (buf.id() == bufferName)
+ {
+ UpdateIndexedBufferBinding(context, &buf, nullptr, BufferBinding::AtomicCounter, 0, 0);
+ }
+ }
+
+ for (auto &buf : mShaderStorageBuffers)
+ {
+ if (buf.id() == bufferName)
+ {
+ UpdateIndexedBufferBinding(context, &buf, nullptr, BufferBinding::ShaderStorage, 0, 0);
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+void State::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
+{
+ getVertexArray()->enableAttribute(attribNum, enabled);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+}
+
+void State::setVertexAttribf(GLuint index, const GLfloat values[4])
+{
+ ASSERT(static_cast<size_t>(index) < mVertexAttribCurrentValues.size());
+ mVertexAttribCurrentValues[index].setFloatValues(values);
+ mDirtyBits.set(DIRTY_BIT_CURRENT_VALUES);
+ mDirtyCurrentValues.set(index);
+ SetComponentTypeMask(ComponentType::Float, index, &mCurrentValuesTypeMask);
+}
+
+void State::setVertexAttribu(GLuint index, const GLuint values[4])
+{
+ ASSERT(static_cast<size_t>(index) < mVertexAttribCurrentValues.size());
+ mVertexAttribCurrentValues[index].setUnsignedIntValues(values);
+ mDirtyBits.set(DIRTY_BIT_CURRENT_VALUES);
+ mDirtyCurrentValues.set(index);
+ SetComponentTypeMask(ComponentType::UnsignedInt, index, &mCurrentValuesTypeMask);
+}
+
+void State::setVertexAttribi(GLuint index, const GLint values[4])
+{
+ ASSERT(static_cast<size_t>(index) < mVertexAttribCurrentValues.size());
+ mVertexAttribCurrentValues[index].setIntValues(values);
+ mDirtyBits.set(DIRTY_BIT_CURRENT_VALUES);
+ mDirtyCurrentValues.set(index);
+ SetComponentTypeMask(ComponentType::Int, index, &mCurrentValuesTypeMask);
+}
+
+void State::setVertexAttribDivisor(const Context *context, GLuint index, GLuint divisor)
+{
+ getVertexArray()->setVertexAttribDivisor(context, index, divisor);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+}
+
+const void *State::getVertexAttribPointer(unsigned int attribNum) const
+{
+ return getVertexArray()->getVertexAttribute(attribNum).pointer;
+}
+
+void State::setPackAlignment(GLint alignment)
+{
+ mPack.alignment = alignment;
+ mDirtyBits.set(DIRTY_BIT_PACK_STATE);
+}
+
+void State::setPackReverseRowOrder(bool reverseRowOrder)
+{
+ mPack.reverseRowOrder = reverseRowOrder;
+ mDirtyBits.set(DIRTY_BIT_PACK_STATE);
+}
+
+void State::setPackRowLength(GLint rowLength)
+{
+ mPack.rowLength = rowLength;
+ mDirtyBits.set(DIRTY_BIT_PACK_STATE);
+}
+
+void State::setPackSkipRows(GLint skipRows)
+{
+ mPack.skipRows = skipRows;
+ mDirtyBits.set(DIRTY_BIT_PACK_STATE);
+}
+
+void State::setPackSkipPixels(GLint skipPixels)
+{
+ mPack.skipPixels = skipPixels;
+ mDirtyBits.set(DIRTY_BIT_PACK_STATE);
+}
+
+void State::setUnpackAlignment(GLint alignment)
+{
+ mUnpack.alignment = alignment;
+ mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
+}
+
+void State::setUnpackRowLength(GLint rowLength)
+{
+ mUnpack.rowLength = rowLength;
+ mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
+}
+
+void State::setUnpackImageHeight(GLint imageHeight)
+{
+ mUnpack.imageHeight = imageHeight;
+ mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
+}
+
+void State::setUnpackSkipImages(GLint skipImages)
+{
+ mUnpack.skipImages = skipImages;
+ mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
+}
+
+void State::setUnpackSkipRows(GLint skipRows)
+{
+ mUnpack.skipRows = skipRows;
+ mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
+}
+
+void State::setUnpackSkipPixels(GLint skipPixels)
+{
+ mUnpack.skipPixels = skipPixels;
+ mDirtyBits.set(DIRTY_BIT_UNPACK_STATE);
+}
+
+void State::setCoverageModulation(GLenum components)
+{
+ mCoverageModulation = components;
+ mDirtyBits.set(DIRTY_BIT_COVERAGE_MODULATION);
+}
+
+void State::loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix)
+{
+ if (matrixMode == GL_PATH_MODELVIEW_CHROMIUM)
+ {
+ memcpy(mPathMatrixMV, matrix, 16 * sizeof(GLfloat));
+ mDirtyBits.set(DIRTY_BIT_PATH_RENDERING);
+ }
+ else if (matrixMode == GL_PATH_PROJECTION_CHROMIUM)
+ {
+ memcpy(mPathMatrixProj, matrix, 16 * sizeof(GLfloat));
+ mDirtyBits.set(DIRTY_BIT_PATH_RENDERING);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+}
+
+const GLfloat *State::getPathRenderingMatrix(GLenum which) const
+{
+ if (which == GL_PATH_MODELVIEW_MATRIX_CHROMIUM)
+ {
+ return mPathMatrixMV;
+ }
+ else if (which == GL_PATH_PROJECTION_MATRIX_CHROMIUM)
+ {
+ return mPathMatrixProj;
+ }
+
+ UNREACHABLE();
+ return nullptr;
+}
+
+void State::setPathStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ mPathStencilFunc = func;
+ mPathStencilRef = ref;
+ mPathStencilMask = mask;
+ mDirtyBits.set(DIRTY_BIT_PATH_RENDERING);
+}
+
+void State::setFramebufferSRGB(bool sRGB)
+{
+ mFramebufferSRGB = sRGB;
+ mDirtyBits.set(DIRTY_BIT_FRAMEBUFFER_SRGB);
+}
+
+void State::setMaxShaderCompilerThreads(GLuint count)
+{
+ mMaxShaderCompilerThreads = count;
+}
+
+void State::getBooleanv(GLenum pname, GLboolean *params)
+{
+ switch (pname)
+ {
+ case GL_SAMPLE_COVERAGE_INVERT:
+ *params = mSampleCoverageInvert;
+ break;
+ case GL_DEPTH_WRITEMASK:
+ *params = mDepthStencil.depthMask;
+ break;
+ case GL_COLOR_WRITEMASK:
+ params[0] = mBlend.colorMaskRed;
+ params[1] = mBlend.colorMaskGreen;
+ params[2] = mBlend.colorMaskBlue;
+ params[3] = mBlend.colorMaskAlpha;
+ break;
+ case GL_CULL_FACE:
+ *params = mRasterizer.cullFace;
+ break;
+ case GL_POLYGON_OFFSET_FILL:
+ *params = mRasterizer.polygonOffsetFill;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ *params = mBlend.sampleAlphaToCoverage;
+ break;
+ case GL_SAMPLE_COVERAGE:
+ *params = mSampleCoverage;
+ break;
+ case GL_SAMPLE_MASK:
+ *params = mSampleMask;
+ break;
+ case GL_SCISSOR_TEST:
+ *params = mScissorTest;
+ break;
+ case GL_STENCIL_TEST:
+ *params = mDepthStencil.stencilTest;
+ break;
+ case GL_DEPTH_TEST:
+ *params = mDepthStencil.depthTest;
+ break;
+ case GL_BLEND:
+ *params = mBlend.blend;
+ break;
+ case GL_DITHER:
+ *params = mBlend.dither;
+ break;
+ case GL_TRANSFORM_FEEDBACK_ACTIVE:
+ *params = getCurrentTransformFeedback()->isActive() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_TRANSFORM_FEEDBACK_PAUSED:
+ *params = getCurrentTransformFeedback()->isPaused() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ *params = mPrimitiveRestart;
+ break;
+ case GL_RASTERIZER_DISCARD:
+ *params = isRasterizerDiscardEnabled() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_DEBUG_OUTPUT_SYNCHRONOUS:
+ *params = mDebug.isOutputSynchronous() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_DEBUG_OUTPUT:
+ *params = mDebug.isOutputEnabled() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_MULTISAMPLE_EXT:
+ *params = mMultiSampling;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_EXT:
+ *params = mSampleAlphaToOne;
+ break;
+ case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
+ *params = isBindGeneratesResourceEnabled() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_CLIENT_ARRAYS_ANGLE:
+ *params = areClientArraysEnabled() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_FRAMEBUFFER_SRGB_EXT:
+ *params = getFramebufferSRGB() ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ *params = mRobustResourceInit ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_PROGRAM_CACHE_ENABLED_ANGLE:
+ *params = mProgramBinaryCacheEnabled ? GL_TRUE : GL_FALSE;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *params = IsLightModelTwoSided(&mGLES1State);
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void State::getFloatv(GLenum pname, GLfloat *params)
+{
+ // Please note: DEPTH_CLEAR_VALUE is included in our internal getFloatv implementation
+ // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
+ // GetIntegerv as its native query function. As it would require conversion in any
+ // case, this should make no difference to the calling application.
+ switch (pname)
+ {
+ case GL_LINE_WIDTH:
+ *params = mLineWidth;
+ break;
+ case GL_SAMPLE_COVERAGE_VALUE:
+ *params = mSampleCoverageValue;
+ break;
+ case GL_DEPTH_CLEAR_VALUE:
+ *params = mDepthClearValue;
+ break;
+ case GL_POLYGON_OFFSET_FACTOR:
+ *params = mRasterizer.polygonOffsetFactor;
+ break;
+ case GL_POLYGON_OFFSET_UNITS:
+ *params = mRasterizer.polygonOffsetUnits;
+ break;
+ case GL_DEPTH_RANGE:
+ params[0] = mNearZ;
+ params[1] = mFarZ;
+ break;
+ case GL_COLOR_CLEAR_VALUE:
+ params[0] = mColorClearValue.red;
+ params[1] = mColorClearValue.green;
+ params[2] = mColorClearValue.blue;
+ params[3] = mColorClearValue.alpha;
+ break;
+ case GL_BLEND_COLOR:
+ params[0] = mBlendColor.red;
+ params[1] = mBlendColor.green;
+ params[2] = mBlendColor.blue;
+ params[3] = mBlendColor.alpha;
+ break;
+ case GL_MULTISAMPLE_EXT:
+ *params = static_cast<GLfloat>(mMultiSampling);
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_EXT:
+ *params = static_cast<GLfloat>(mSampleAlphaToOne);
+ break;
+ case GL_COVERAGE_MODULATION_CHROMIUM:
+ params[0] = static_cast<GLfloat>(mCoverageModulation);
+ break;
+ case GL_ALPHA_TEST_REF:
+ *params = mGLES1State.mAlphaTestRef;
+ break;
+ case GL_CURRENT_COLOR:
+ {
+ const auto &color = mGLES1State.mCurrentColor;
+ params[0] = color.red;
+ params[1] = color.green;
+ params[2] = color.blue;
+ params[3] = color.alpha;
+ break;
+ }
+ case GL_CURRENT_NORMAL:
+ {
+ const auto &normal = mGLES1State.mCurrentNormal;
+ params[0] = normal[0];
+ params[1] = normal[1];
+ params[2] = normal[2];
+ break;
+ }
+ case GL_CURRENT_TEXTURE_COORDS:
+ {
+ const auto &texcoord = mGLES1State.mCurrentTextureCoords[mActiveSampler];
+ params[0] = texcoord.s;
+ params[1] = texcoord.t;
+ params[2] = texcoord.r;
+ params[3] = texcoord.q;
+ break;
+ }
+ case GL_MODELVIEW_MATRIX:
+ memcpy(params, mGLES1State.mModelviewMatrices.back().data(), 16 * sizeof(GLfloat));
+ break;
+ case GL_PROJECTION_MATRIX:
+ memcpy(params, mGLES1State.mProjectionMatrices.back().data(), 16 * sizeof(GLfloat));
+ break;
+ case GL_TEXTURE_MATRIX:
+ memcpy(params, mGLES1State.mTextureMatrices[mActiveSampler].back().data(),
+ 16 * sizeof(GLfloat));
+ break;
+ case GL_LIGHT_MODEL_AMBIENT:
+ GetLightModelParameters(&mGLES1State, pname, params);
+ break;
+ case GL_FOG_MODE:
+ case GL_FOG_DENSITY:
+ case GL_FOG_START:
+ case GL_FOG_END:
+ case GL_FOG_COLOR:
+ GetFogParameters(&mGLES1State, pname, params);
+ break;
+ case GL_POINT_SIZE:
+ GetPointSize(&mGLES1State, params);
+ break;
+ case GL_POINT_SIZE_MIN:
+ case GL_POINT_SIZE_MAX:
+ case GL_POINT_FADE_THRESHOLD_SIZE:
+ case GL_POINT_DISTANCE_ATTENUATION:
+ GetPointParameter(&mGLES1State, FromGLenum<PointParameter>(pname), params);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+angle::Result State::getIntegerv(const Context *context, GLenum pname, GLint *params)
+{
+ if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT)
+ {
+ size_t drawBuffer = (pname - GL_DRAW_BUFFER0_EXT);
+ ASSERT(drawBuffer < mMaxDrawBuffers);
+ Framebuffer *framebuffer = mDrawFramebuffer;
+ // The default framebuffer may have fewer draw buffer states than a user-created one. The
+ // user is always allowed to query up to GL_MAX_DRAWBUFFERS so just return GL_NONE here if
+ // the draw buffer is out of range for this framebuffer.
+ *params = drawBuffer < framebuffer->getDrawbufferStateCount()
+ ? framebuffer->getDrawBufferState(drawBuffer)
+ : GL_NONE;
+ return angle::Result::Continue;
+ }
+
+ // Please note: DEPTH_CLEAR_VALUE is not included in our internal getIntegerv implementation
+ // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
+ // GetIntegerv as its native query function. As it would require conversion in any
+ // case, this should make no difference to the calling application. You may find it in
+ // State::getFloatv.
+ switch (pname)
+ {
+ case GL_ARRAY_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::Array].id();
+ break;
+ case GL_DRAW_INDIRECT_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::DrawIndirect].id();
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING:
+ {
+ Buffer *elementArrayBuffer = getVertexArray()->getElementArrayBuffer();
+ *params = elementArrayBuffer ? elementArrayBuffer->id() : 0;
+ break;
+ }
+ case GL_DRAW_FRAMEBUFFER_BINDING:
+ static_assert(GL_DRAW_FRAMEBUFFER_BINDING == GL_DRAW_FRAMEBUFFER_BINDING_ANGLE,
+ "Enum mismatch");
+ *params = mDrawFramebuffer->id();
+ break;
+ case GL_READ_FRAMEBUFFER_BINDING:
+ static_assert(GL_READ_FRAMEBUFFER_BINDING == GL_READ_FRAMEBUFFER_BINDING_ANGLE,
+ "Enum mismatch");
+ *params = mReadFramebuffer->id();
+ break;
+ case GL_RENDERBUFFER_BINDING:
+ *params = mRenderbuffer.id();
+ break;
+ case GL_VERTEX_ARRAY_BINDING:
+ *params = mVertexArray->id();
+ break;
+ case GL_CURRENT_PROGRAM:
+ *params = mProgram ? mProgram->id() : 0;
+ break;
+ case GL_PACK_ALIGNMENT:
+ *params = mPack.alignment;
+ break;
+ case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
+ *params = mPack.reverseRowOrder;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ *params = mPack.rowLength;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ *params = mPack.skipRows;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ *params = mPack.skipPixels;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ *params = mUnpack.alignment;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ *params = mUnpack.rowLength;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ *params = mUnpack.imageHeight;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ *params = mUnpack.skipImages;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ *params = mUnpack.skipRows;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ *params = mUnpack.skipPixels;
+ break;
+ case GL_GENERATE_MIPMAP_HINT:
+ *params = mGenerateMipmapHint;
+ break;
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+ *params = mFragmentShaderDerivativeHint;
+ break;
+ case GL_ACTIVE_TEXTURE:
+ *params = (static_cast<GLint>(mActiveSampler) + GL_TEXTURE0);
+ break;
+ case GL_STENCIL_FUNC:
+ *params = mDepthStencil.stencilFunc;
+ break;
+ case GL_STENCIL_REF:
+ *params = mStencilRef;
+ break;
+ case GL_STENCIL_VALUE_MASK:
+ *params = CastMaskValue(mDepthStencil.stencilMask);
+ break;
+ case GL_STENCIL_BACK_FUNC:
+ *params = mDepthStencil.stencilBackFunc;
+ break;
+ case GL_STENCIL_BACK_REF:
+ *params = mStencilBackRef;
+ break;
+ case GL_STENCIL_BACK_VALUE_MASK:
+ *params = CastMaskValue(mDepthStencil.stencilBackMask);
+ break;
+ case GL_STENCIL_FAIL:
+ *params = mDepthStencil.stencilFail;
+ break;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *params = mDepthStencil.stencilPassDepthFail;
+ break;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *params = mDepthStencil.stencilPassDepthPass;
+ break;
+ case GL_STENCIL_BACK_FAIL:
+ *params = mDepthStencil.stencilBackFail;
+ break;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ *params = mDepthStencil.stencilBackPassDepthFail;
+ break;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ *params = mDepthStencil.stencilBackPassDepthPass;
+ break;
+ case GL_DEPTH_FUNC:
+ *params = mDepthStencil.depthFunc;
+ break;
+ case GL_BLEND_SRC_RGB:
+ *params = mBlend.sourceBlendRGB;
+ break;
+ case GL_BLEND_SRC_ALPHA:
+ *params = mBlend.sourceBlendAlpha;
+ break;
+ case GL_BLEND_DST_RGB:
+ *params = mBlend.destBlendRGB;
+ break;
+ case GL_BLEND_DST_ALPHA:
+ *params = mBlend.destBlendAlpha;
+ break;
+ case GL_BLEND_EQUATION_RGB:
+ *params = mBlend.blendEquationRGB;
+ break;
+ case GL_BLEND_EQUATION_ALPHA:
+ *params = mBlend.blendEquationAlpha;
+ break;
+ case GL_STENCIL_WRITEMASK:
+ *params = CastMaskValue(mDepthStencil.stencilWritemask);
+ break;
+ case GL_STENCIL_BACK_WRITEMASK:
+ *params = CastMaskValue(mDepthStencil.stencilBackWritemask);
+ break;
+ case GL_STENCIL_CLEAR_VALUE:
+ *params = mStencilClearValue;
+ break;
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+ ANGLE_TRY(mReadFramebuffer->getImplementationColorReadType(
+ context, reinterpret_cast<GLenum *>(params)));
+ break;
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+ ANGLE_TRY(mReadFramebuffer->getImplementationColorReadFormat(
+ context, reinterpret_cast<GLenum *>(params)));
+ break;
+ case GL_SAMPLE_BUFFERS:
+ case GL_SAMPLES:
+ {
+ Framebuffer *framebuffer = mDrawFramebuffer;
+ if (framebuffer->isComplete(context))
+ {
+ GLint samples = framebuffer->getSamples(context);
+ switch (pname)
+ {
+ case GL_SAMPLE_BUFFERS:
+ if (samples != 0)
+ {
+ *params = 1;
+ }
+ else
+ {
+ *params = 0;
+ }
+ break;
+ case GL_SAMPLES:
+ *params = samples;
+ break;
+ }
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_VIEWPORT:
+ params[0] = mViewport.x;
+ params[1] = mViewport.y;
+ params[2] = mViewport.width;
+ params[3] = mViewport.height;
+ break;
+ case GL_SCISSOR_BOX:
+ params[0] = mScissor.x;
+ params[1] = mScissor.y;
+ params[2] = mScissor.width;
+ params[3] = mScissor.height;
+ break;
+ case GL_CULL_FACE_MODE:
+ *params = ToGLenum(mRasterizer.cullMode);
+ break;
+ case GL_FRONT_FACE:
+ *params = mRasterizer.frontFace;
+ break;
+ case GL_RED_BITS:
+ case GL_GREEN_BITS:
+ case GL_BLUE_BITS:
+ case GL_ALPHA_BITS:
+ {
+ Framebuffer *framebuffer = getDrawFramebuffer();
+ const FramebufferAttachment *colorbuffer = framebuffer->getFirstColorAttachment();
+
+ if (colorbuffer)
+ {
+ switch (pname)
+ {
+ case GL_RED_BITS:
+ *params = colorbuffer->getRedSize();
+ break;
+ case GL_GREEN_BITS:
+ *params = colorbuffer->getGreenSize();
+ break;
+ case GL_BLUE_BITS:
+ *params = colorbuffer->getBlueSize();
+ break;
+ case GL_ALPHA_BITS:
+ *params = colorbuffer->getAlphaSize();
+ break;
+ }
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_DEPTH_BITS:
+ {
+ const Framebuffer *framebuffer = getDrawFramebuffer();
+ const FramebufferAttachment *depthbuffer = framebuffer->getDepthAttachment();
+
+ if (depthbuffer)
+ {
+ *params = depthbuffer->getDepthSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_STENCIL_BITS:
+ {
+ const Framebuffer *framebuffer = getDrawFramebuffer();
+ const FramebufferAttachment *stencilbuffer = framebuffer->getStencilAttachment();
+
+ if (stencilbuffer)
+ {
+ *params = stencilbuffer->getStencilSize();
+ }
+ else
+ {
+ *params = 0;
+ }
+ }
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params =
+ getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::_2D);
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_ANGLE:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
+ TextureType::Rectangle);
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
+ TextureType::CubeMap);
+ break;
+ case GL_TEXTURE_BINDING_3D:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params =
+ getSamplerTextureId(static_cast<unsigned int>(mActiveSampler), TextureType::_3D);
+ break;
+ case GL_TEXTURE_BINDING_2D_ARRAY:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
+ TextureType::_2DArray);
+ break;
+ case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
+ TextureType::_2DMultisample);
+ break;
+ case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
+ TextureType::_2DMultisampleArray);
+ break;
+ case GL_TEXTURE_BINDING_EXTERNAL_OES:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
+ TextureType::External);
+ break;
+ case GL_UNIFORM_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::Uniform].id();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BINDING:
+ *params = mTransformFeedback.id();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::TransformFeedback].id();
+ break;
+ case GL_COPY_READ_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::CopyRead].id();
+ break;
+ case GL_COPY_WRITE_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::CopyWrite].id();
+ break;
+ case GL_PIXEL_PACK_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::PixelPack].id();
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::PixelUnpack].id();
+ break;
+ case GL_READ_BUFFER:
+ *params = mReadFramebuffer->getReadBufferState();
+ break;
+ case GL_SAMPLER_BINDING:
+ ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
+ *params = getSamplerId(static_cast<GLuint>(mActiveSampler));
+ break;
+ case GL_DEBUG_LOGGED_MESSAGES:
+ *params = static_cast<GLint>(mDebug.getMessageCount());
+ break;
+ case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH:
+ *params = static_cast<GLint>(mDebug.getNextMessageLength());
+ break;
+ case GL_DEBUG_GROUP_STACK_DEPTH:
+ *params = static_cast<GLint>(mDebug.getGroupStackDepth());
+ break;
+ case GL_MULTISAMPLE_EXT:
+ *params = static_cast<GLint>(mMultiSampling);
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_EXT:
+ *params = static_cast<GLint>(mSampleAlphaToOne);
+ break;
+ case GL_COVERAGE_MODULATION_CHROMIUM:
+ *params = static_cast<GLint>(mCoverageModulation);
+ break;
+ case GL_ATOMIC_COUNTER_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::AtomicCounter].id();
+ break;
+ case GL_SHADER_STORAGE_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::ShaderStorage].id();
+ break;
+ case GL_DISPATCH_INDIRECT_BUFFER_BINDING:
+ *params = mBoundBuffers[BufferBinding::DispatchIndirect].id();
+ break;
+ case GL_ALPHA_TEST_FUNC:
+ *params = ToGLenum(mGLES1State.mAlphaTestFunc);
+ break;
+ case GL_CLIENT_ACTIVE_TEXTURE:
+ *params = mGLES1State.mClientActiveTexture + GL_TEXTURE0;
+ break;
+ case GL_MATRIX_MODE:
+ *params = ToGLenum(mGLES1State.mMatrixMode);
+ break;
+ case GL_SHADE_MODEL:
+ *params = ToGLenum(mGLES1State.mShadeModel);
+ break;
+ case GL_MODELVIEW_STACK_DEPTH:
+ case GL_PROJECTION_STACK_DEPTH:
+ case GL_TEXTURE_STACK_DEPTH:
+ *params = mGLES1State.getCurrentMatrixStackDepth(pname);
+ break;
+ case GL_LOGIC_OP_MODE:
+ *params = ToGLenum(mGLES1State.mLogicOp);
+ break;
+ case GL_BLEND_SRC:
+ *params = mBlend.sourceBlendRGB;
+ break;
+ case GL_BLEND_DST:
+ *params = mBlend.destBlendRGB;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ case GL_POINT_SMOOTH_HINT:
+ case GL_LINE_SMOOTH_HINT:
+ case GL_FOG_HINT:
+ *params = mGLES1State.getHint(pname);
+ break;
+
+ // GL_ANGLE_provoking_vertex
+ case GL_PROVOKING_VERTEX:
+ *params = ToGLenum(mProvokingVertex);
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return angle::Result::Continue;
+}
+
+void State::getPointerv(const Context *context, GLenum pname, void **params) const
+{
+ switch (pname)
+ {
+ case GL_DEBUG_CALLBACK_FUNCTION:
+ *params = reinterpret_cast<void *>(mDebug.getCallback());
+ break;
+ case GL_DEBUG_CALLBACK_USER_PARAM:
+ *params = const_cast<void *>(mDebug.getUserParam());
+ break;
+ case GL_VERTEX_ARRAY_POINTER:
+ case GL_NORMAL_ARRAY_POINTER:
+ case GL_COLOR_ARRAY_POINTER:
+ case GL_TEXTURE_COORD_ARRAY_POINTER:
+ case GL_POINT_SIZE_ARRAY_POINTER_OES:
+ QueryVertexAttribPointerv(getVertexArray()->getVertexAttribute(
+ context->vertexArrayIndex(ParamToVertexArrayType(pname))),
+ GL_VERTEX_ATTRIB_ARRAY_POINTER, params);
+ return;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void State::getIntegeri_v(GLenum target, GLuint index, GLint *data)
+{
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ ASSERT(static_cast<size_t>(index) < mTransformFeedback->getIndexedBufferCount());
+ *data = mTransformFeedback->getIndexedBuffer(index).id();
+ break;
+ case GL_UNIFORM_BUFFER_BINDING:
+ ASSERT(static_cast<size_t>(index) < mUniformBuffers.size());
+ *data = mUniformBuffers[index].id();
+ break;
+ case GL_ATOMIC_COUNTER_BUFFER_BINDING:
+ ASSERT(static_cast<size_t>(index) < mAtomicCounterBuffers.size());
+ *data = mAtomicCounterBuffers[index].id();
+ break;
+ case GL_SHADER_STORAGE_BUFFER_BINDING:
+ ASSERT(static_cast<size_t>(index) < mShaderStorageBuffers.size());
+ *data = mShaderStorageBuffers[index].id();
+ break;
+ case GL_VERTEX_BINDING_BUFFER:
+ ASSERT(static_cast<size_t>(index) < mVertexArray->getMaxBindings());
+ *data = mVertexArray->getVertexBinding(index).getBuffer().id();
+ break;
+ case GL_VERTEX_BINDING_DIVISOR:
+ ASSERT(static_cast<size_t>(index) < mVertexArray->getMaxBindings());
+ *data = mVertexArray->getVertexBinding(index).getDivisor();
+ break;
+ case GL_VERTEX_BINDING_OFFSET:
+ ASSERT(static_cast<size_t>(index) < mVertexArray->getMaxBindings());
+ *data = static_cast<GLuint>(mVertexArray->getVertexBinding(index).getOffset());
+ break;
+ case GL_VERTEX_BINDING_STRIDE:
+ ASSERT(static_cast<size_t>(index) < mVertexArray->getMaxBindings());
+ *data = mVertexArray->getVertexBinding(index).getStride();
+ break;
+ case GL_SAMPLE_MASK_VALUE:
+ ASSERT(static_cast<size_t>(index) < mSampleMaskValues.size());
+ *data = mSampleMaskValues[index];
+ break;
+ case GL_IMAGE_BINDING_NAME:
+ ASSERT(static_cast<size_t>(index) < mImageUnits.size());
+ *data = mImageUnits[index].texture.id();
+ break;
+ case GL_IMAGE_BINDING_LEVEL:
+ ASSERT(static_cast<size_t>(index) < mImageUnits.size());
+ *data = mImageUnits[index].level;
+ break;
+ case GL_IMAGE_BINDING_LAYER:
+ ASSERT(static_cast<size_t>(index) < mImageUnits.size());
+ *data = mImageUnits[index].layer;
+ break;
+ case GL_IMAGE_BINDING_ACCESS:
+ ASSERT(static_cast<size_t>(index) < mImageUnits.size());
+ *data = mImageUnits[index].access;
+ break;
+ case GL_IMAGE_BINDING_FORMAT:
+ ASSERT(static_cast<size_t>(index) < mImageUnits.size());
+ *data = mImageUnits[index].format;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void State::getInteger64i_v(GLenum target, GLuint index, GLint64 *data)
+{
+ switch (target)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ ASSERT(static_cast<size_t>(index) < mTransformFeedback->getIndexedBufferCount());
+ *data = mTransformFeedback->getIndexedBuffer(index).getOffset();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ ASSERT(static_cast<size_t>(index) < mTransformFeedback->getIndexedBufferCount());
+ *data = mTransformFeedback->getIndexedBuffer(index).getSize();
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ ASSERT(static_cast<size_t>(index) < mUniformBuffers.size());
+ *data = mUniformBuffers[index].getOffset();
+ break;
+ case GL_UNIFORM_BUFFER_SIZE:
+ ASSERT(static_cast<size_t>(index) < mUniformBuffers.size());
+ *data = mUniformBuffers[index].getSize();
+ break;
+ case GL_ATOMIC_COUNTER_BUFFER_START:
+ ASSERT(static_cast<size_t>(index) < mAtomicCounterBuffers.size());
+ *data = mAtomicCounterBuffers[index].getOffset();
+ break;
+ case GL_ATOMIC_COUNTER_BUFFER_SIZE:
+ ASSERT(static_cast<size_t>(index) < mAtomicCounterBuffers.size());
+ *data = mAtomicCounterBuffers[index].getSize();
+ break;
+ case GL_SHADER_STORAGE_BUFFER_START:
+ ASSERT(static_cast<size_t>(index) < mShaderStorageBuffers.size());
+ *data = mShaderStorageBuffers[index].getOffset();
+ break;
+ case GL_SHADER_STORAGE_BUFFER_SIZE:
+ ASSERT(static_cast<size_t>(index) < mShaderStorageBuffers.size());
+ *data = mShaderStorageBuffers[index].getSize();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void State::getBooleani_v(GLenum target, GLuint index, GLboolean *data)
+{
+ switch (target)
+ {
+ case GL_IMAGE_BINDING_LAYERED:
+ ASSERT(static_cast<size_t>(index) < mImageUnits.size());
+ *data = mImageUnits[index].layered;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+angle::Result State::syncTexturesInit(const Context *context)
+{
+ ASSERT(mRobustResourceInit);
+
+ if (!mProgram)
+ return angle::Result::Continue;
+
+ for (size_t textureUnitIndex : mProgram->getActiveSamplersMask())
+ {
+ Texture *texture = mActiveTexturesCache[textureUnitIndex];
+ if (texture)
+ {
+ ANGLE_TRY(texture->ensureInitialized(context));
+ }
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result State::syncImagesInit(const Context *context)
+{
+ ASSERT(mRobustResourceInit);
+ ASSERT(mProgram);
+ for (size_t imageUnitIndex : mProgram->getActiveImagesMask())
+ {
+ Texture *texture = mImageUnits[imageUnitIndex].texture.get();
+ if (texture)
+ {
+ ANGLE_TRY(texture->ensureInitialized(context));
+ }
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result State::syncReadAttachments(const Context *context)
+{
+ ASSERT(mReadFramebuffer);
+ ASSERT(mRobustResourceInit);
+ return mReadFramebuffer->ensureReadAttachmentsInitialized(context);
+}
+
+angle::Result State::syncDrawAttachments(const Context *context)
+{
+ ASSERT(mDrawFramebuffer);
+ ASSERT(mRobustResourceInit);
+ return mDrawFramebuffer->ensureDrawAttachmentsInitialized(context);
+}
+
+angle::Result State::syncReadFramebuffer(const Context *context)
+{
+ ASSERT(mReadFramebuffer);
+ return mReadFramebuffer->syncState(context);
+}
+
+angle::Result State::syncDrawFramebuffer(const Context *context)
+{
+ ASSERT(mDrawFramebuffer);
+ return mDrawFramebuffer->syncState(context);
+}
+
+angle::Result State::syncTextures(const Context *context)
+{
+ if (mDirtyTextures.none())
+ return angle::Result::Continue;
+
+ for (size_t textureIndex : mDirtyTextures)
+ {
+ Texture *texture = mActiveTexturesCache[textureIndex];
+ if (texture && texture->hasAnyDirtyBit())
+ {
+ ANGLE_TRY(texture->syncState(context));
+ }
+ }
+
+ mDirtyTextures.reset();
+ return angle::Result::Continue;
+}
+
+angle::Result State::syncSamplers(const Context *context)
+{
+ if (mDirtySamplers.none())
+ return angle::Result::Continue;
+
+ for (size_t samplerIndex : mDirtySamplers)
+ {
+ BindingPointer<Sampler> &sampler = mSamplers[samplerIndex];
+ if (sampler.get())
+ {
+ sampler->syncState(context);
+ }
+ }
+
+ mDirtySamplers.reset();
+
+ return angle::Result::Continue;
+}
+
+angle::Result State::syncVertexArray(const Context *context)
+{
+ ASSERT(mVertexArray);
+ return mVertexArray->syncState(context);
+}
+
+angle::Result State::syncProgram(const Context *context)
+{
+ return mProgram->syncState(context);
+}
+
+angle::Result State::syncDirtyObject(const Context *context, GLenum target)
+{
+ DirtyObjects localSet;
+
+ switch (target)
+ {
+ case GL_READ_FRAMEBUFFER:
+ localSet.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ break;
+ case GL_DRAW_FRAMEBUFFER:
+ localSet.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
+ break;
+ case GL_FRAMEBUFFER:
+ localSet.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ localSet.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
+ break;
+ case GL_VERTEX_ARRAY:
+ localSet.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ break;
+ case GL_TEXTURE:
+ localSet.set(DIRTY_OBJECT_TEXTURES);
+ break;
+ case GL_SAMPLER:
+ localSet.set(DIRTY_OBJECT_SAMPLERS);
+ break;
+ case GL_PROGRAM:
+ localSet.set(DIRTY_OBJECT_PROGRAM);
+ break;
+ }
+
+ return syncDirtyObjects(context, localSet);
+}
+
+void State::setObjectDirty(GLenum target)
+{
+ switch (target)
+ {
+ case GL_READ_FRAMEBUFFER:
+ mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ break;
+ case GL_DRAW_FRAMEBUFFER:
+ setDrawFramebufferDirty();
+ break;
+ case GL_FRAMEBUFFER:
+ mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ setDrawFramebufferDirty();
+ break;
+ case GL_VERTEX_ARRAY:
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ break;
+ case GL_PROGRAM:
+ mDirtyObjects.set(DIRTY_OBJECT_PROGRAM);
+ break;
+ default:
+ break;
+ }
+}
+
+angle::Result State::onProgramExecutableChange(const Context *context, Program *program)
+{
+ // OpenGL Spec:
+ // "If LinkProgram or ProgramBinary successfully re-links a program object
+ // that was already in use as a result of a previous call to UseProgram, then the
+ // generated executable code will be installed as part of the current rendering state."
+ ASSERT(program->isLinked());
+
+ mDirtyBits.set(DIRTY_BIT_PROGRAM_EXECUTABLE);
+
+ if (program->hasAnyDirtyBit())
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_PROGRAM);
+ }
+
+ // Set any bound textures.
+ const ActiveTextureTypeArray &textureTypes = program->getActiveSamplerTypes();
+ for (size_t textureIndex : program->getActiveSamplersMask())
+ {
+ TextureType type = textureTypes[textureIndex];
+
+ // This can happen if there is a conflicting texture type.
+ if (type == TextureType::InvalidEnum)
+ continue;
+
+ Texture *texture = mSamplerTextures[type][textureIndex].get();
+ updateActiveTexture(context, textureIndex, texture);
+ }
+
+ for (size_t imageUnitIndex : program->getActiveImagesMask())
+ {
+ Texture *image = mImageUnits[imageUnitIndex].texture.get();
+ if (!image)
+ continue;
+
+ if (image->hasAnyDirtyBit())
+ {
+ ANGLE_TRY(image->syncState(context));
+ }
+
+ if (mRobustResourceInit && image->initState() == InitState::MayNeedInit)
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_IMAGES_INIT);
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+void State::setTextureDirty(size_t textureUnitIndex)
+{
+ mDirtyObjects.set(DIRTY_OBJECT_TEXTURES);
+ mDirtyTextures.set(textureUnitIndex);
+}
+
+void State::setSamplerDirty(size_t samplerIndex)
+{
+ mDirtyObjects.set(DIRTY_OBJECT_SAMPLERS);
+ mDirtySamplers.set(samplerIndex);
+}
+
+void State::setImageUnit(const Context *context,
+ size_t unit,
+ Texture *texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format)
+{
+ mImageUnits[unit].texture.set(context, texture);
+ mImageUnits[unit].level = level;
+ mImageUnits[unit].layered = layered;
+ mImageUnits[unit].layer = layer;
+ mImageUnits[unit].access = access;
+ mImageUnits[unit].format = format;
+ mDirtyBits.set(DIRTY_BIT_IMAGE_BINDINGS);
+
+ onImageStateChange(context, unit);
+}
+
+// Handle a dirty texture event.
+void State::onActiveTextureChange(const Context *context, size_t textureUnit)
+{
+ if (mProgram)
+ {
+ TextureType type = mProgram->getActiveSamplerTypes()[textureUnit];
+ Texture *activeTexture = (type != TextureType::InvalidEnum)
+ ? mSamplerTextures[type][textureUnit].get()
+ : nullptr;
+ updateActiveTexture(context, textureUnit, activeTexture);
+ }
+}
+
+void State::onActiveTextureStateChange(const Context *context, size_t textureUnit)
+{
+ if (mProgram)
+ {
+ TextureType type = mProgram->getActiveSamplerTypes()[textureUnit];
+
+ Texture *activeTexture = (type != TextureType::InvalidEnum)
+ ? mSamplerTextures[type][textureUnit].get()
+ : nullptr;
+ const Sampler *sampler = mSamplers[textureUnit].get();
+ updateActiveTextureState(context, textureUnit, sampler, activeTexture);
+ }
+}
+
+void State::onImageStateChange(const Context *context, size_t unit)
+{
+ if (mProgram)
+ {
+ const ImageUnit &image = mImageUnits[unit];
+ ASSERT(image.texture.get());
+ if (mRobustResourceInit && image.texture->initState() == InitState::MayNeedInit)
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_IMAGES_INIT);
+ }
+ }
+}
+
+void State::onUniformBufferStateChange(size_t uniformBufferIndex)
+{
+ // This could be represented by a different dirty bit. Using the same one keeps it simple.
+ mDirtyBits.set(DIRTY_BIT_UNIFORM_BUFFER_BINDINGS);
+}
+
+AttributesMask State::getAndResetDirtyCurrentValues() const
+{
+ AttributesMask retVal = mDirtyCurrentValues;
+ mDirtyCurrentValues.reset();
+ return retVal;
+}
+
+constexpr State::DirtyObjectHandler State::kDirtyObjectHandlers[DIRTY_OBJECT_MAX];
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/State.h b/gfx/angle/checkout/src/libANGLE/State.h
new file mode 100644
index 0000000000..ee0fdb5c05
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/State.h
@@ -0,0 +1,906 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// State.h: Defines the State class, encapsulating raw GL state
+
+#ifndef LIBANGLE_STATE_H_
+#define LIBANGLE_STATE_H_
+
+#include <bitset>
+#include <memory>
+
+#include "common/Color.h"
+#include "common/angleutils.h"
+#include "common/bitset_utils.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/GLES1State.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/ProgramPipeline.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Sampler.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/TransformFeedback.h"
+#include "libANGLE/Version.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/angletypes.h"
+
+namespace gl
+{
+class BufferManager;
+struct Caps;
+class Context;
+class FramebufferManager;
+class MemoryObjectManager;
+class PathManager;
+class ProgramPipelineManager;
+class Query;
+class RenderbufferManager;
+class SamplerManager;
+class SemaphoreManager;
+class ShaderProgramManager;
+class SyncManager;
+class TextureManager;
+class VertexArray;
+
+static constexpr Version ES_2_0 = Version(2, 0);
+static constexpr Version ES_3_0 = Version(3, 0);
+static constexpr Version ES_3_1 = Version(3, 1);
+
+using ContextID = uintptr_t;
+
+class State : angle::NonCopyable
+{
+ public:
+ State(ContextID contextIn,
+ const State *shareContextState,
+ TextureManager *shareTextures,
+ const EGLenum clientType,
+ const Version &clientVersion,
+ bool debug,
+ bool bindGeneratesResource,
+ bool clientArraysEnabled,
+ bool robustResourceInit,
+ bool programBinaryCacheEnabled);
+ ~State();
+
+ void initialize(Context *context);
+ void reset(const Context *context);
+
+ // Getters
+ ContextID getContextID() const { return mContext; }
+ EGLenum getClientType() const { return mClientType; }
+ GLint getClientMajorVersion() const { return mClientVersion.major; }
+ GLint getClientMinorVersion() const { return mClientVersion.minor; }
+ const Version &getClientVersion() const { return mClientVersion; }
+ const Caps &getCaps() const { return mCaps; }
+ const TextureCapsMap &getTextureCaps() const { return mTextureCaps; }
+ const Extensions &getExtensions() const { return mExtensions; }
+ const Limitations &getLimitations() const { return mLimitations; }
+
+ bool isWebGL() const { return mExtensions.webglCompatibility; }
+
+ bool isWebGL1() const { return (isWebGL() && mClientVersion.major == 2); }
+
+ const TextureCaps &getTextureCap(GLenum internalFormat) const
+ {
+ return mTextureCaps.get(internalFormat);
+ }
+
+ // State chunk getters
+ const RasterizerState &getRasterizerState() const;
+ const BlendState &getBlendState() const { return mBlend; }
+ const DepthStencilState &getDepthStencilState() const;
+
+ // Clear behavior setters & state parameter block generation function
+ void setColorClearValue(float red, float green, float blue, float alpha);
+ void setDepthClearValue(float depth);
+ void setStencilClearValue(int stencil);
+
+ const ColorF &getColorClearValue() const { return mColorClearValue; }
+ float getDepthClearValue() const { return mDepthClearValue; }
+ int getStencilClearValue() const { return mStencilClearValue; }
+
+ // Write mask manipulation
+ void setColorMask(bool red, bool green, bool blue, bool alpha);
+ void setDepthMask(bool mask);
+
+ // Discard toggle & query
+ bool isRasterizerDiscardEnabled() const { return mRasterizer.rasterizerDiscard; }
+ void setRasterizerDiscard(bool enabled);
+
+ // Primitive restart
+ bool isPrimitiveRestartEnabled() const { return mPrimitiveRestart; }
+ void setPrimitiveRestart(bool enabled);
+
+ // Face culling state manipulation
+ bool isCullFaceEnabled() const { return mRasterizer.cullFace; }
+ void setCullFace(bool enabled);
+ void setCullMode(CullFaceMode mode);
+ void setFrontFace(GLenum front);
+
+ // Depth test state manipulation
+ bool isDepthTestEnabled() const { return mDepthStencil.depthTest; }
+ void setDepthTest(bool enabled);
+ void setDepthFunc(GLenum depthFunc);
+ void setDepthRange(float zNear, float zFar);
+ float getNearPlane() const { return mNearZ; }
+ float getFarPlane() const { return mFarZ; }
+
+ // Blend state manipulation
+ bool isBlendEnabled() const { return mBlend.blend; }
+ void setBlend(bool enabled);
+ void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
+ void setBlendColor(float red, float green, float blue, float alpha);
+ void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
+ const ColorF &getBlendColor() const { return mBlendColor; }
+
+ // Stencil state maniupulation
+ bool isStencilTestEnabled() const { return mDepthStencil.stencilTest; }
+ void setStencilTest(bool enabled);
+ void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
+ void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
+ void setStencilWritemask(GLuint stencilWritemask);
+ void setStencilBackWritemask(GLuint stencilBackWritemask);
+ void setStencilOperations(GLenum stencilFail,
+ GLenum stencilPassDepthFail,
+ GLenum stencilPassDepthPass);
+ void setStencilBackOperations(GLenum stencilBackFail,
+ GLenum stencilBackPassDepthFail,
+ GLenum stencilBackPassDepthPass);
+ GLint getStencilRef() const { return mStencilRef; }
+ GLint getStencilBackRef() const { return mStencilBackRef; }
+
+ // Depth bias/polygon offset state manipulation
+ bool isPolygonOffsetFillEnabled() const { return mRasterizer.polygonOffsetFill; }
+ void setPolygonOffsetFill(bool enabled);
+ void setPolygonOffsetParams(GLfloat factor, GLfloat units);
+
+ // Multisample coverage state manipulation
+ bool isSampleAlphaToCoverageEnabled() const { return mBlend.sampleAlphaToCoverage; }
+ void setSampleAlphaToCoverage(bool enabled);
+ bool isSampleCoverageEnabled() const { return mSampleCoverage; }
+ void setSampleCoverage(bool enabled);
+ void setSampleCoverageParams(GLclampf value, bool invert);
+ GLclampf getSampleCoverageValue() const { return mSampleCoverageValue; }
+ bool getSampleCoverageInvert() const { return mSampleCoverageInvert; }
+
+ // Multisample mask state manipulation.
+ bool isSampleMaskEnabled() const { return mSampleMask; }
+ void setSampleMaskEnabled(bool enabled);
+ void setSampleMaskParams(GLuint maskNumber, GLbitfield mask);
+ GLbitfield getSampleMaskWord(GLuint maskNumber) const
+ {
+ ASSERT(maskNumber < mMaxSampleMaskWords);
+ return mSampleMaskValues[maskNumber];
+ }
+ GLuint getMaxSampleMaskWords() const { return mMaxSampleMaskWords; }
+
+ // Multisampling/alpha to one manipulation.
+ void setSampleAlphaToOne(bool enabled);
+ bool isSampleAlphaToOneEnabled() const { return mSampleAlphaToOne; }
+ void setMultisampling(bool enabled);
+ bool isMultisamplingEnabled() const { return mMultiSampling; }
+
+ // Scissor test state toggle & query
+ bool isScissorTestEnabled() const { return mScissorTest; }
+ void setScissorTest(bool enabled);
+ void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
+ const Rectangle &getScissor() const { return mScissor; }
+
+ // Dither state toggle & query
+ bool isDitherEnabled() const { return mBlend.dither; }
+ void setDither(bool enabled);
+
+ // Generic state toggle & query
+ void setEnableFeature(GLenum feature, bool enabled);
+ bool getEnableFeature(GLenum feature) const;
+
+ // Line width state setter
+ void setLineWidth(GLfloat width);
+ float getLineWidth() const { return mLineWidth; }
+
+ // Hint setters
+ void setGenerateMipmapHint(GLenum hint);
+ void setFragmentShaderDerivativeHint(GLenum hint);
+
+ // GL_CHROMIUM_bind_generates_resource
+ bool isBindGeneratesResourceEnabled() const { return mBindGeneratesResource; }
+
+ // GL_ANGLE_client_arrays
+ bool areClientArraysEnabled() const { return mClientArraysEnabled; }
+
+ // Viewport state setter/getter
+ void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
+ const Rectangle &getViewport() const { return mViewport; }
+
+ // Texture binding & active texture unit manipulation
+ void setActiveSampler(unsigned int active);
+ unsigned int getActiveSampler() const { return static_cast<unsigned int>(mActiveSampler); }
+
+ void setSamplerTexture(const Context *context, TextureType type, Texture *texture);
+ Texture *getTargetTexture(TextureType type) const;
+
+ Texture *getSamplerTexture(unsigned int sampler, TextureType type) const
+ {
+ ASSERT(sampler < mSamplerTextures[type].size());
+ return mSamplerTextures[type][sampler].get();
+ }
+
+ GLuint getSamplerTextureId(unsigned int sampler, TextureType type) const;
+ void detachTexture(const Context *context, const TextureMap &zeroTextures, GLuint texture);
+ void initializeZeroTextures(const Context *context, const TextureMap &zeroTextures);
+
+ void invalidateTexture(TextureType type);
+
+ // Sampler object binding manipulation
+ void setSamplerBinding(const Context *context, GLuint textureUnit, Sampler *sampler);
+ GLuint getSamplerId(GLuint textureUnit) const
+ {
+ ASSERT(textureUnit < mSamplers.size());
+ return mSamplers[textureUnit].id();
+ }
+
+ Sampler *getSampler(GLuint textureUnit) const { return mSamplers[textureUnit].get(); }
+
+ using SamplerBindingVector = std::vector<BindingPointer<Sampler>>;
+ const SamplerBindingVector &getSamplers() const { return mSamplers; }
+
+ void detachSampler(const Context *context, GLuint sampler);
+
+ // Renderbuffer binding manipulation
+ void setRenderbufferBinding(const Context *context, Renderbuffer *renderbuffer);
+ GLuint getRenderbufferId() const { return mRenderbuffer.id(); }
+ Renderbuffer *getCurrentRenderbuffer() const { return mRenderbuffer.get(); }
+ void detachRenderbuffer(const Context *context, GLuint renderbuffer);
+
+ // Framebuffer binding manipulation
+ void setReadFramebufferBinding(Framebuffer *framebuffer);
+ void setDrawFramebufferBinding(Framebuffer *framebuffer);
+ Framebuffer *getTargetFramebuffer(GLenum target) const;
+ Framebuffer *getReadFramebuffer() const { return mReadFramebuffer; }
+ Framebuffer *getDrawFramebuffer() const { return mDrawFramebuffer; }
+
+ bool removeReadFramebufferBinding(GLuint framebuffer);
+ bool removeDrawFramebufferBinding(GLuint framebuffer);
+
+ // Vertex array object binding manipulation
+ void setVertexArrayBinding(const Context *context, VertexArray *vertexArray);
+ bool removeVertexArrayBinding(const Context *context, GLuint vertexArray);
+ GLuint getVertexArrayId() const;
+
+ VertexArray *getVertexArray() const
+ {
+ ASSERT(mVertexArray != nullptr);
+ return mVertexArray;
+ }
+
+ // Program binding manipulation
+ angle::Result setProgram(const Context *context, Program *newProgram);
+
+ Program *getProgram() const
+ {
+ ASSERT(!mProgram || !mProgram->isLinking());
+ return mProgram;
+ }
+
+ Program *getLinkedProgram(const Context *context) const
+ {
+ if (mProgram)
+ {
+ mProgram->resolveLink(context);
+ }
+ return mProgram;
+ }
+
+ // Transform feedback object (not buffer) binding manipulation
+ void setTransformFeedbackBinding(const Context *context, TransformFeedback *transformFeedback);
+ TransformFeedback *getCurrentTransformFeedback() const { return mTransformFeedback.get(); }
+
+ ANGLE_INLINE bool isTransformFeedbackActive() const
+ {
+ TransformFeedback *curTransformFeedback = mTransformFeedback.get();
+ return curTransformFeedback && curTransformFeedback->isActive();
+ }
+ ANGLE_INLINE bool isTransformFeedbackActiveUnpaused() const
+ {
+ TransformFeedback *curTransformFeedback = mTransformFeedback.get();
+ return curTransformFeedback && curTransformFeedback->isActive() &&
+ !curTransformFeedback->isPaused();
+ }
+
+ bool removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback);
+
+ // Query binding manipulation
+ bool isQueryActive(QueryType type) const;
+ bool isQueryActive(Query *query) const;
+ void setActiveQuery(const Context *context, QueryType type, Query *query);
+ GLuint getActiveQueryId(QueryType type) const;
+ Query *getActiveQuery(QueryType type) const;
+
+ // Program Pipeline binding manipulation
+ void setProgramPipelineBinding(const Context *context, ProgramPipeline *pipeline);
+ void detachProgramPipeline(const Context *context, GLuint pipeline);
+
+ //// Typed buffer binding point manipulation ////
+ ANGLE_INLINE void setBufferBinding(const Context *context, BufferBinding target, Buffer *buffer)
+ {
+ (this->*(kBufferSetters[target]))(context, buffer);
+ }
+
+ ANGLE_INLINE Buffer *getTargetBuffer(BufferBinding target) const
+ {
+ switch (target)
+ {
+ case BufferBinding::ElementArray:
+ return getVertexArray()->getElementArrayBuffer();
+ default:
+ return mBoundBuffers[target].get();
+ }
+ }
+
+ angle::Result setIndexedBufferBinding(const Context *context,
+ BufferBinding target,
+ GLuint index,
+ Buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+
+ const OffsetBindingPointer<Buffer> &getIndexedUniformBuffer(size_t index) const;
+ const OffsetBindingPointer<Buffer> &getIndexedAtomicCounterBuffer(size_t index) const;
+ const OffsetBindingPointer<Buffer> &getIndexedShaderStorageBuffer(size_t index) const;
+
+ // Detach a buffer from all bindings
+ angle::Result detachBuffer(Context *context, const Buffer *buffer);
+
+ // Vertex attrib manipulation
+ void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
+ void setVertexAttribf(GLuint index, const GLfloat values[4]);
+ void setVertexAttribu(GLuint index, const GLuint values[4]);
+ void setVertexAttribi(GLuint index, const GLint values[4]);
+
+ ANGLE_INLINE void setVertexAttribPointer(const Context *context,
+ unsigned int attribNum,
+ Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ GLsizei stride,
+ const void *pointer)
+ {
+ mVertexArray->setVertexAttribPointer(context, attribNum, boundBuffer, size, type,
+ normalized, stride, pointer);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ }
+
+ ANGLE_INLINE void setVertexAttribIPointer(const Context *context,
+ unsigned int attribNum,
+ Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+ {
+ mVertexArray->setVertexAttribIPointer(context, attribNum, boundBuffer, size, type, stride,
+ pointer);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ }
+
+ void setVertexAttribDivisor(const Context *context, GLuint index, GLuint divisor);
+ const VertexAttribCurrentValueData &getVertexAttribCurrentValue(size_t attribNum) const
+ {
+ ASSERT(attribNum < mVertexAttribCurrentValues.size());
+ return mVertexAttribCurrentValues[attribNum];
+ }
+
+ const std::vector<VertexAttribCurrentValueData> &getVertexAttribCurrentValues() const
+ {
+ return mVertexAttribCurrentValues;
+ }
+
+ const void *getVertexAttribPointer(unsigned int attribNum) const;
+
+ void bindVertexBuffer(const Context *context,
+ GLuint bindingIndex,
+ Buffer *boundBuffer,
+ GLintptr offset,
+ GLsizei stride);
+ void setVertexAttribFormat(GLuint attribIndex,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ bool pureInteger,
+ GLuint relativeOffset);
+
+ void setVertexAttribBinding(const Context *context, GLuint attribIndex, GLuint bindingIndex)
+ {
+ mVertexArray->setVertexAttribBinding(context, attribIndex, bindingIndex);
+ mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY);
+ }
+
+ void setVertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
+
+ // Pixel pack state manipulation
+ void setPackAlignment(GLint alignment);
+ GLint getPackAlignment() const { return mPack.alignment; }
+ void setPackReverseRowOrder(bool reverseRowOrder);
+ bool getPackReverseRowOrder() const { return mPack.reverseRowOrder; }
+ void setPackRowLength(GLint rowLength);
+ GLint getPackRowLength() const { return mPack.rowLength; }
+ void setPackSkipRows(GLint skipRows);
+ GLint getPackSkipRows() const { return mPack.skipRows; }
+ void setPackSkipPixels(GLint skipPixels);
+ GLint getPackSkipPixels() const { return mPack.skipPixels; }
+ const PixelPackState &getPackState() const { return mPack; }
+ PixelPackState &getPackState() { return mPack; }
+
+ // Pixel unpack state manipulation
+ void setUnpackAlignment(GLint alignment);
+ GLint getUnpackAlignment() const { return mUnpack.alignment; }
+ void setUnpackRowLength(GLint rowLength);
+ GLint getUnpackRowLength() const { return mUnpack.rowLength; }
+ void setUnpackImageHeight(GLint imageHeight);
+ GLint getUnpackImageHeight() const { return mUnpack.imageHeight; }
+ void setUnpackSkipImages(GLint skipImages);
+ GLint getUnpackSkipImages() const { return mUnpack.skipImages; }
+ void setUnpackSkipRows(GLint skipRows);
+ GLint getUnpackSkipRows() const { return mUnpack.skipRows; }
+ void setUnpackSkipPixels(GLint skipPixels);
+ GLint getUnpackSkipPixels() const { return mUnpack.skipPixels; }
+ const PixelUnpackState &getUnpackState() const { return mUnpack; }
+ PixelUnpackState &getUnpackState() { return mUnpack; }
+
+ // Debug state
+ const Debug &getDebug() const { return mDebug; }
+ Debug &getDebug() { return mDebug; }
+
+ // CHROMIUM_framebuffer_mixed_samples coverage modulation
+ void setCoverageModulation(GLenum components);
+ GLenum getCoverageModulation() const { return mCoverageModulation; }
+
+ // CHROMIUM_path_rendering
+ void loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix);
+ const GLfloat *getPathRenderingMatrix(GLenum which) const;
+ void setPathStencilFunc(GLenum func, GLint ref, GLuint mask);
+ GLenum getPathStencilFunc() const { return mPathStencilFunc; }
+ GLint getPathStencilRef() const { return mPathStencilRef; }
+ GLuint getPathStencilMask() const { return mPathStencilMask; }
+
+ // GL_EXT_sRGB_write_control
+ void setFramebufferSRGB(bool sRGB);
+ bool getFramebufferSRGB() const { return mFramebufferSRGB; }
+
+ // GL_KHR_parallel_shader_compile
+ void setMaxShaderCompilerThreads(GLuint count);
+ GLuint getMaxShaderCompilerThreads() const { return mMaxShaderCompilerThreads; }
+
+ // State query functions
+ void getBooleanv(GLenum pname, GLboolean *params);
+ void getFloatv(GLenum pname, GLfloat *params);
+ angle::Result getIntegerv(const Context *context, GLenum pname, GLint *params);
+ void getPointerv(const Context *context, GLenum pname, void **params) const;
+ void getIntegeri_v(GLenum target, GLuint index, GLint *data);
+ void getInteger64i_v(GLenum target, GLuint index, GLint64 *data);
+ void getBooleani_v(GLenum target, GLuint index, GLboolean *data);
+
+ bool isRobustResourceInitEnabled() const { return mRobustResourceInit; }
+
+ // Sets the dirty bit for the program executable.
+ angle::Result onProgramExecutableChange(const Context *context, Program *program);
+
+ enum DirtyBitType
+ {
+ // Note: process draw framebuffer binding first, so that other dirty bits whose effect
+ // depend on the current draw framebuffer are not processed while the old framebuffer is
+ // still bound.
+ DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING,
+ DIRTY_BIT_READ_FRAMEBUFFER_BINDING,
+ DIRTY_BIT_SCISSOR_TEST_ENABLED,
+ DIRTY_BIT_SCISSOR,
+ DIRTY_BIT_VIEWPORT,
+ DIRTY_BIT_DEPTH_RANGE,
+ DIRTY_BIT_BLEND_ENABLED,
+ DIRTY_BIT_BLEND_COLOR,
+ DIRTY_BIT_BLEND_FUNCS,
+ DIRTY_BIT_BLEND_EQUATIONS,
+ DIRTY_BIT_COLOR_MASK,
+ DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED,
+ DIRTY_BIT_SAMPLE_COVERAGE_ENABLED,
+ DIRTY_BIT_SAMPLE_COVERAGE,
+ DIRTY_BIT_SAMPLE_MASK_ENABLED,
+ DIRTY_BIT_SAMPLE_MASK,
+ DIRTY_BIT_DEPTH_TEST_ENABLED,
+ DIRTY_BIT_DEPTH_FUNC,
+ DIRTY_BIT_DEPTH_MASK,
+ DIRTY_BIT_STENCIL_TEST_ENABLED,
+ DIRTY_BIT_STENCIL_FUNCS_FRONT,
+ DIRTY_BIT_STENCIL_FUNCS_BACK,
+ DIRTY_BIT_STENCIL_OPS_FRONT,
+ DIRTY_BIT_STENCIL_OPS_BACK,
+ DIRTY_BIT_STENCIL_WRITEMASK_FRONT,
+ DIRTY_BIT_STENCIL_WRITEMASK_BACK,
+ DIRTY_BIT_CULL_FACE_ENABLED,
+ DIRTY_BIT_CULL_FACE,
+ DIRTY_BIT_FRONT_FACE,
+ DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED,
+ DIRTY_BIT_POLYGON_OFFSET,
+ DIRTY_BIT_RASTERIZER_DISCARD_ENABLED,
+ DIRTY_BIT_LINE_WIDTH,
+ DIRTY_BIT_PRIMITIVE_RESTART_ENABLED,
+ DIRTY_BIT_CLEAR_COLOR,
+ DIRTY_BIT_CLEAR_DEPTH,
+ DIRTY_BIT_CLEAR_STENCIL,
+ DIRTY_BIT_UNPACK_STATE,
+ DIRTY_BIT_UNPACK_BUFFER_BINDING,
+ DIRTY_BIT_PACK_STATE,
+ DIRTY_BIT_PACK_BUFFER_BINDING,
+ DIRTY_BIT_DITHER_ENABLED,
+ DIRTY_BIT_GENERATE_MIPMAP_HINT,
+ DIRTY_BIT_SHADER_DERIVATIVE_HINT,
+ DIRTY_BIT_RENDERBUFFER_BINDING,
+ DIRTY_BIT_VERTEX_ARRAY_BINDING,
+ DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING,
+ DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING,
+ // TODO(jmadill): Fine-grained dirty bits for each index.
+ DIRTY_BIT_PROGRAM_BINDING,
+ DIRTY_BIT_PROGRAM_EXECUTABLE,
+ // TODO(jmadill): Fine-grained dirty bits for each texture/sampler.
+ DIRTY_BIT_TEXTURE_BINDINGS,
+ DIRTY_BIT_SAMPLER_BINDINGS,
+ DIRTY_BIT_IMAGE_BINDINGS,
+ DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING,
+ DIRTY_BIT_UNIFORM_BUFFER_BINDINGS,
+ DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING,
+ DIRTY_BIT_ATOMIC_COUNTER_BUFFER_BINDING,
+ DIRTY_BIT_MULTISAMPLING,
+ DIRTY_BIT_SAMPLE_ALPHA_TO_ONE,
+ DIRTY_BIT_COVERAGE_MODULATION, // CHROMIUM_framebuffer_mixed_samples
+ DIRTY_BIT_PATH_RENDERING,
+ DIRTY_BIT_FRAMEBUFFER_SRGB, // GL_EXT_sRGB_write_control
+ DIRTY_BIT_CURRENT_VALUES,
+ DIRTY_BIT_PROVOKING_VERTEX,
+ DIRTY_BIT_INVALID,
+ DIRTY_BIT_MAX = DIRTY_BIT_INVALID,
+ };
+
+ static_assert(DIRTY_BIT_MAX <= 64, "State dirty bits must be capped at 64");
+
+ // TODO(jmadill): Consider storing dirty objects in a list instead of by binding.
+ enum DirtyObjectType
+ {
+ DIRTY_OBJECT_TEXTURES_INIT,
+ DIRTY_OBJECT_IMAGES_INIT,
+ DIRTY_OBJECT_READ_ATTACHMENTS,
+ DIRTY_OBJECT_DRAW_ATTACHMENTS,
+ DIRTY_OBJECT_READ_FRAMEBUFFER,
+ DIRTY_OBJECT_DRAW_FRAMEBUFFER,
+ DIRTY_OBJECT_VERTEX_ARRAY,
+ DIRTY_OBJECT_TEXTURES, // Top-level dirty bit. Also see mDirtyTextures.
+ DIRTY_OBJECT_SAMPLERS, // Top-level dirty bit. Also see mDirtySamplers.
+ DIRTY_OBJECT_PROGRAM,
+ DIRTY_OBJECT_UNKNOWN,
+ DIRTY_OBJECT_MAX = DIRTY_OBJECT_UNKNOWN,
+ };
+
+ using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
+ const DirtyBits &getDirtyBits() const { return mDirtyBits; }
+ void clearDirtyBits() { mDirtyBits.reset(); }
+ void clearDirtyBits(const DirtyBits &bitset) { mDirtyBits &= ~bitset; }
+ void setAllDirtyBits()
+ {
+ mDirtyBits.set();
+ mDirtyCurrentValues.set();
+ }
+
+ using DirtyObjects = angle::BitSet<DIRTY_OBJECT_MAX>;
+ void clearDirtyObjects() { mDirtyObjects.reset(); }
+ void setAllDirtyObjects() { mDirtyObjects.set(); }
+ angle::Result syncDirtyObjects(const Context *context, const DirtyObjects &bitset);
+ angle::Result syncDirtyObject(const Context *context, GLenum target);
+ void setObjectDirty(GLenum target);
+ void setTextureDirty(size_t textureUnitIndex);
+ void setSamplerDirty(size_t samplerIndex);
+
+ ANGLE_INLINE void setReadFramebufferDirty()
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER);
+ mDirtyObjects.set(DIRTY_OBJECT_READ_ATTACHMENTS);
+ }
+
+ ANGLE_INLINE void setDrawFramebufferDirty()
+ {
+ mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER);
+ mDirtyObjects.set(DIRTY_OBJECT_DRAW_ATTACHMENTS);
+ }
+
+ // This actually clears the current value dirty bits.
+ // TODO(jmadill): Pass mutable dirty bits into Impl.
+ AttributesMask getAndResetDirtyCurrentValues() const;
+
+ void setImageUnit(const Context *context,
+ size_t unit,
+ Texture *texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format);
+
+ const ImageUnit &getImageUnit(size_t unit) const { return mImageUnits[unit]; }
+ const ActiveTexturePointerArray &getActiveTexturesCache() const { return mActiveTexturesCache; }
+ ComponentTypeMask getCurrentValuesTypeMask() const { return mCurrentValuesTypeMask; }
+
+ // "onActiveTextureChange" is called when a texture binding changes.
+ void onActiveTextureChange(const Context *context, size_t textureUnit);
+
+ // "onActiveTextureStateChange" calls when the Texture itself changed but the binding did not.
+ void onActiveTextureStateChange(const Context *context, size_t textureUnit);
+
+ void onImageStateChange(const Context *context, size_t unit);
+
+ void onUniformBufferStateChange(size_t uniformBufferIndex);
+
+ bool isCurrentTransformFeedback(const TransformFeedback *tf) const
+ {
+ return tf == mTransformFeedback.get();
+ }
+ bool isCurrentVertexArray(const VertexArray *va) const { return va == mVertexArray; }
+
+ GLES1State &gles1() { return mGLES1State; }
+ const GLES1State &gles1() const { return mGLES1State; }
+
+ // Helpers for setting bound buffers. They should all have the same signature.
+ // Not meant to be called externally. Used for local helpers in State.cpp.
+ template <BufferBinding Target>
+ void setGenericBufferBindingWithBit(const Context *context, Buffer *buffer);
+
+ template <BufferBinding Target>
+ void setGenericBufferBinding(const Context *context, Buffer *buffer);
+
+ using BufferBindingSetter = void (State::*)(const Context *, Buffer *);
+
+ ANGLE_INLINE bool validateSamplerFormats() const
+ {
+ return (mTexturesIncompatibleWithSamplers & mProgram->getActiveSamplersMask()).none();
+ }
+
+ ProvokingVertexConvention getProvokingVertex() const { return mProvokingVertex; }
+ void setProvokingVertex(ProvokingVertexConvention val)
+ {
+ mDirtyBits.set(State::DIRTY_BIT_PROVOKING_VERTEX);
+ mProvokingVertex = val;
+ }
+
+ private:
+ friend class Context;
+
+ void unsetActiveTextures(ActiveTextureMask textureMask);
+ void updateActiveTexture(const Context *context, size_t textureIndex, Texture *texture);
+ void updateActiveTextureState(const Context *context,
+ size_t textureIndex,
+ const Sampler *sampler,
+ Texture *texture);
+
+ // Functions to synchronize dirty states
+ angle::Result syncTexturesInit(const Context *context);
+ angle::Result syncImagesInit(const Context *context);
+ angle::Result syncReadAttachments(const Context *context);
+ angle::Result syncDrawAttachments(const Context *context);
+ angle::Result syncReadFramebuffer(const Context *context);
+ angle::Result syncDrawFramebuffer(const Context *context);
+ angle::Result syncVertexArray(const Context *context);
+ angle::Result syncTextures(const Context *context);
+ angle::Result syncSamplers(const Context *context);
+ angle::Result syncProgram(const Context *context);
+
+ using DirtyObjectHandler = angle::Result (State::*)(const Context *context);
+ static constexpr DirtyObjectHandler kDirtyObjectHandlers[DIRTY_OBJECT_MAX] = {
+ &State::syncTexturesInit, &State::syncImagesInit, &State::syncReadAttachments,
+ &State::syncDrawAttachments, &State::syncReadFramebuffer, &State::syncDrawFramebuffer,
+ &State::syncVertexArray, &State::syncTextures, &State::syncSamplers,
+ &State::syncProgram,
+ };
+
+ // Robust init must happen before Framebuffer init for the Vulkan back-end.
+ static_assert(DIRTY_OBJECT_TEXTURES_INIT < DIRTY_OBJECT_DRAW_FRAMEBUFFER, "init order");
+ static_assert(DIRTY_OBJECT_IMAGES_INIT < DIRTY_OBJECT_DRAW_FRAMEBUFFER, "init order");
+ static_assert(DIRTY_OBJECT_DRAW_ATTACHMENTS < DIRTY_OBJECT_DRAW_FRAMEBUFFER, "init order");
+ static_assert(DIRTY_OBJECT_READ_ATTACHMENTS < DIRTY_OBJECT_READ_FRAMEBUFFER, "init order");
+
+ static_assert(DIRTY_OBJECT_TEXTURES_INIT == 0, "check DIRTY_OBJECT_TEXTURES_INIT index");
+ static_assert(DIRTY_OBJECT_IMAGES_INIT == 1, "check DIRTY_OBJECT_IMAGES_INIT index");
+ static_assert(DIRTY_OBJECT_READ_ATTACHMENTS == 2, "check DIRTY_OBJECT_READ_ATTACHMENTS index");
+ static_assert(DIRTY_OBJECT_DRAW_ATTACHMENTS == 3, "check DIRTY_OBJECT_DRAW_ATTACHMENTS index");
+ static_assert(DIRTY_OBJECT_READ_FRAMEBUFFER == 4, "check DIRTY_OBJECT_READ_FRAMEBUFFER index");
+ static_assert(DIRTY_OBJECT_DRAW_FRAMEBUFFER == 5, "check DIRTY_OBJECT_DRAW_FRAMEBUFFER index");
+ static_assert(DIRTY_OBJECT_VERTEX_ARRAY == 6, "check DIRTY_OBJECT_VERTEX_ARRAY index");
+ static_assert(DIRTY_OBJECT_TEXTURES == 7, "check DIRTY_OBJECT_TEXTURES index");
+ static_assert(DIRTY_OBJECT_SAMPLERS == 8, "check DIRTY_OBJECT_SAMPLERS index");
+ static_assert(DIRTY_OBJECT_PROGRAM == 9, "check DIRTY_OBJECT_PROGRAM index");
+
+ // Dispatch table for buffer update functions.
+ static const angle::PackedEnumMap<BufferBinding, BufferBindingSetter> kBufferSetters;
+
+ EGLenum mClientType;
+ Version mClientVersion;
+ ContextID mContext;
+
+ // Caps to use for validation
+ Caps mCaps;
+ TextureCapsMap mTextureCaps;
+ Extensions mExtensions;
+ Limitations mLimitations;
+
+ // Resource managers.
+ BufferManager *mBufferManager;
+ ShaderProgramManager *mShaderProgramManager;
+ TextureManager *mTextureManager;
+ RenderbufferManager *mRenderbufferManager;
+ SamplerManager *mSamplerManager;
+ SyncManager *mSyncManager;
+ PathManager *mPathManager;
+ FramebufferManager *mFramebufferManager;
+ ProgramPipelineManager *mProgramPipelineManager;
+ MemoryObjectManager *mMemoryObjectManager;
+ SemaphoreManager *mSemaphoreManager;
+
+ // Cached values from Context's caps
+ GLuint mMaxDrawBuffers;
+ GLuint mMaxCombinedTextureImageUnits;
+
+ ColorF mColorClearValue;
+ GLfloat mDepthClearValue;
+ int mStencilClearValue;
+
+ RasterizerState mRasterizer;
+ bool mScissorTest;
+ Rectangle mScissor;
+
+ BlendState mBlend;
+ ColorF mBlendColor;
+ bool mSampleCoverage;
+ GLfloat mSampleCoverageValue;
+ bool mSampleCoverageInvert;
+ bool mSampleMask;
+ GLuint mMaxSampleMaskWords;
+ std::array<GLbitfield, MAX_SAMPLE_MASK_WORDS> mSampleMaskValues;
+
+ DepthStencilState mDepthStencil;
+ GLint mStencilRef;
+ GLint mStencilBackRef;
+
+ GLfloat mLineWidth;
+
+ GLenum mGenerateMipmapHint;
+ GLenum mFragmentShaderDerivativeHint;
+
+ const bool mBindGeneratesResource;
+ const bool mClientArraysEnabled;
+
+ Rectangle mViewport;
+ float mNearZ;
+ float mFarZ;
+
+ Framebuffer *mReadFramebuffer;
+ Framebuffer *mDrawFramebuffer;
+ BindingPointer<Renderbuffer> mRenderbuffer;
+ Program *mProgram;
+ BindingPointer<ProgramPipeline> mProgramPipeline;
+
+ // GL_ANGLE_provoking_vertex
+ ProvokingVertexConvention mProvokingVertex;
+
+ using VertexAttribVector = std::vector<VertexAttribCurrentValueData>;
+ VertexAttribVector mVertexAttribCurrentValues; // From glVertexAttrib
+ VertexArray *mVertexArray;
+ ComponentTypeMask mCurrentValuesTypeMask;
+
+ // Texture and sampler bindings
+ size_t mActiveSampler; // Active texture unit selector - GL_TEXTURE0
+
+ using TextureBindingVector = std::vector<BindingPointer<Texture>>;
+ using TextureBindingMap = angle::PackedEnumMap<TextureType, TextureBindingVector>;
+ TextureBindingMap mSamplerTextures;
+
+ // Texture Completeness Caching
+ // ----------------------------
+ // The texture completeness cache uses dirty bits to avoid having to scan the list of textures
+ // each draw call. This gl::State class implements angle::Observer interface. When subject
+ // Textures have state changes, messages reach 'State' (also any observing Framebuffers) via the
+ // onSubjectStateChange method (above). This then invalidates the completeness cache.
+ //
+ // Note this requires that we also invalidate the completeness cache manually on events like
+ // re-binding textures/samplers or a change in the program. For more information see the
+ // Observer.h header and the design doc linked there.
+
+ // A cache of complete textures. nullptr indicates unbound or incomplete.
+ // Don't use BindingPointer because this cache is only valid within a draw call.
+ // Also stores a notification channel to the texture itself to handle texture change events.
+ ActiveTexturePointerArray mActiveTexturesCache;
+ std::vector<angle::ObserverBinding> mCompleteTextureBindings;
+
+ ActiveTextureMask mTexturesIncompatibleWithSamplers;
+
+ SamplerBindingVector mSamplers;
+
+ // It would be nice to merge the image and observer binding. Same for textures.
+ std::vector<ImageUnit> mImageUnits;
+
+ using ActiveQueryMap = angle::PackedEnumMap<QueryType, BindingPointer<Query>>;
+ ActiveQueryMap mActiveQueries;
+
+ // Stores the currently bound buffer for each binding point. It has an entry for the element
+ // array buffer but it should not be used. Instead this bind point is owned by the current
+ // vertex array object.
+ using BoundBufferMap = angle::PackedEnumMap<BufferBinding, BindingPointer<Buffer>>;
+ BoundBufferMap mBoundBuffers;
+
+ using BufferVector = std::vector<OffsetBindingPointer<Buffer>>;
+ BufferVector mUniformBuffers;
+ BufferVector mAtomicCounterBuffers;
+ BufferVector mShaderStorageBuffers;
+
+ BindingPointer<TransformFeedback> mTransformFeedback;
+
+ PixelUnpackState mUnpack;
+ PixelPackState mPack;
+
+ bool mPrimitiveRestart;
+
+ Debug mDebug;
+
+ bool mMultiSampling;
+ bool mSampleAlphaToOne;
+
+ GLenum mCoverageModulation;
+
+ // CHROMIUM_path_rendering
+ GLfloat mPathMatrixMV[16];
+ GLfloat mPathMatrixProj[16];
+ GLenum mPathStencilFunc;
+ GLint mPathStencilRef;
+ GLuint mPathStencilMask;
+
+ // GL_EXT_sRGB_write_control
+ bool mFramebufferSRGB;
+
+ // GL_ANGLE_robust_resource_intialization
+ const bool mRobustResourceInit;
+
+ // GL_ANGLE_program_cache_control
+ const bool mProgramBinaryCacheEnabled;
+
+ // GL_KHR_parallel_shader_compile
+ GLuint mMaxShaderCompilerThreads;
+
+ // GLES1 emulation: state specific to GLES1
+ GLES1State mGLES1State;
+
+ DirtyBits mDirtyBits;
+ DirtyObjects mDirtyObjects;
+ mutable AttributesMask mDirtyCurrentValues;
+ ActiveTextureMask mDirtyTextures;
+ ActiveTextureMask mDirtySamplers;
+ ImageUnitMask mDirtyImages;
+};
+
+ANGLE_INLINE angle::Result State::syncDirtyObjects(const Context *context,
+ const DirtyObjects &bitset)
+{
+ const DirtyObjects &dirtyObjects = mDirtyObjects & bitset;
+
+ for (size_t dirtyObject : dirtyObjects)
+ {
+ ANGLE_TRY((this->*kDirtyObjectHandlers[dirtyObject])(context));
+ }
+
+ mDirtyObjects &= ~dirtyObjects;
+ return angle::Result::Continue;
+}
+
+} // namespace gl
+
+#endif // LIBANGLE_STATE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Stream.cpp b/gfx/angle/checkout/src/libANGLE/Stream.cpp
new file mode 100644
index 0000000000..b7bc84c869
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Stream.cpp
@@ -0,0 +1,282 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Stream.cpp: Implements the egl::Stream class, representing the stream
+// where frames are streamed in. Implements EGLStreanKHR.
+
+#include "libANGLE/Stream.h"
+
+#include <EGL/eglext.h>
+#include <platform/Platform.h>
+
+#include "common/debug.h"
+#include "common/mathutil.h"
+#include "common/platform.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/renderer/DisplayImpl.h"
+#include "libANGLE/renderer/StreamProducerImpl.h"
+
+namespace egl
+{
+
+Stream::Stream(Display *display, const AttributeMap &attribs)
+ : mLabel(nullptr),
+ mDisplay(display),
+ mProducerImplementation(nullptr),
+ mState(EGL_STREAM_STATE_CREATED_KHR),
+ mProducerFrame(0),
+ mConsumerFrame(0),
+ mConsumerLatency(attribs.getAsInt(EGL_CONSUMER_LATENCY_USEC_KHR, 0)),
+ mConsumerAcquireTimeout(attribs.getAsInt(EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, 0)),
+ mPlaneCount(0),
+ mConsumerType(ConsumerType::NoConsumer),
+ mProducerType(ProducerType::NoProducer)
+{
+ for (auto &plane : mPlanes)
+ {
+ plane.textureUnit = -1;
+ plane.texture = nullptr;
+ }
+}
+
+Stream::~Stream()
+{
+ SafeDelete(mProducerImplementation);
+ for (auto &plane : mPlanes)
+ {
+ if (plane.texture != nullptr)
+ {
+ plane.texture->releaseStream();
+ }
+ }
+}
+
+void Stream::setLabel(EGLLabelKHR label)
+{
+ mLabel = label;
+}
+
+EGLLabelKHR Stream::getLabel() const
+{
+ return mLabel;
+}
+
+void Stream::setConsumerLatency(EGLint latency)
+{
+ mConsumerLatency = latency;
+}
+
+EGLint Stream::getConsumerLatency() const
+{
+ return mConsumerLatency;
+}
+
+EGLuint64KHR Stream::getProducerFrame() const
+{
+ return mProducerFrame;
+}
+
+EGLuint64KHR Stream::getConsumerFrame() const
+{
+ return mConsumerFrame;
+}
+
+EGLenum Stream::getState() const
+{
+ return mState;
+}
+
+void Stream::setConsumerAcquireTimeout(EGLint timeout)
+{
+ mConsumerAcquireTimeout = timeout;
+}
+
+EGLint Stream::getConsumerAcquireTimeout() const
+{
+ return mConsumerAcquireTimeout;
+}
+
+Stream::ProducerType Stream::getProducerType() const
+{
+ return mProducerType;
+}
+
+Stream::ConsumerType Stream::getConsumerType() const
+{
+ return mConsumerType;
+}
+
+EGLint Stream::getPlaneCount() const
+{
+ return mPlaneCount;
+}
+
+rx::StreamProducerImpl *Stream::getImplementation()
+{
+ return mProducerImplementation;
+}
+
+Error Stream::createConsumerGLTextureExternal(const AttributeMap &attributes, gl::Context *context)
+{
+ ASSERT(mState == EGL_STREAM_STATE_CREATED_KHR);
+ ASSERT(mConsumerType == ConsumerType::NoConsumer);
+ ASSERT(mProducerType == ProducerType::NoProducer);
+ ASSERT(context != nullptr);
+
+ const auto &glState = context->getState();
+ EGLenum bufferType = attributes.getAsInt(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
+ if (bufferType == EGL_RGB_BUFFER)
+ {
+ mPlanes[0].texture = glState.getTargetTexture(gl::TextureType::External);
+ ASSERT(mPlanes[0].texture != nullptr);
+ mPlanes[0].texture->bindStream(this);
+ mConsumerType = ConsumerType::GLTextureRGB;
+ mPlaneCount = 1;
+ }
+ else
+ {
+ mPlaneCount = attributes.getAsInt(EGL_YUV_NUMBER_OF_PLANES_EXT, 2);
+ ASSERT(mPlaneCount <= 3);
+ for (EGLint i = 0; i < mPlaneCount; i++)
+ {
+ // Fetch all the textures
+ mPlanes[i].textureUnit = attributes.getAsInt(EGL_YUV_PLANE0_TEXTURE_UNIT_NV + i, -1);
+ if (mPlanes[i].textureUnit != EGL_NONE)
+ {
+ mPlanes[i].texture =
+ glState.getSamplerTexture(mPlanes[i].textureUnit, gl::TextureType::External);
+ ASSERT(mPlanes[i].texture != nullptr);
+ }
+ }
+
+ // Bind them to the stream
+ for (EGLint i = 0; i < mPlaneCount; i++)
+ {
+ if (mPlanes[i].textureUnit != EGL_NONE)
+ {
+ mPlanes[i].texture->bindStream(this);
+ }
+ }
+ mConsumerType = ConsumerType::GLTextureYUV;
+ }
+
+ mContext = context;
+ mState = EGL_STREAM_STATE_CONNECTING_KHR;
+
+ return NoError();
+}
+
+Error Stream::createProducerD3D11Texture(const AttributeMap &attributes)
+{
+ ASSERT(mState == EGL_STREAM_STATE_CONNECTING_KHR);
+ ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
+ mConsumerType == ConsumerType::GLTextureYUV);
+ ASSERT(mProducerType == ProducerType::NoProducer);
+
+ mProducerImplementation =
+ mDisplay->getImplementation()->createStreamProducerD3DTexture(mConsumerType, attributes);
+ mProducerType = ProducerType::D3D11Texture;
+ mState = EGL_STREAM_STATE_EMPTY_KHR;
+
+ return NoError();
+}
+
+// Called when the consumer of this stream starts using the stream
+Error Stream::consumerAcquire(const gl::Context *context)
+{
+ ASSERT(mState == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR ||
+ mState == EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR);
+ ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
+ mConsumerType == ConsumerType::GLTextureYUV);
+ ASSERT(mProducerType == ProducerType::D3D11Texture);
+
+ mState = EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR;
+ mConsumerFrame++;
+
+ // Bind the planes to the gl textures
+ for (int i = 0; i < mPlaneCount; i++)
+ {
+ if (mPlanes[i].texture != nullptr)
+ {
+ ANGLE_TRY(ResultToEGL(mPlanes[i].texture->acquireImageFromStream(
+ context, mProducerImplementation->getGLFrameDescription(i))));
+ }
+ }
+
+ return NoError();
+}
+
+Error Stream::consumerRelease(const gl::Context *context)
+{
+ ASSERT(mState == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR ||
+ mState == EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR);
+ ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
+ mConsumerType == ConsumerType::GLTextureYUV);
+ ASSERT(mProducerType == ProducerType::D3D11Texture);
+
+ // Release the images
+ for (int i = 0; i < mPlaneCount; i++)
+ {
+ if (mPlanes[i].texture != nullptr)
+ {
+ ANGLE_TRY(ResultToEGL(mPlanes[i].texture->releaseImageFromStream(context)));
+ }
+ }
+
+ return NoError();
+}
+
+bool Stream::isConsumerBoundToContext(const gl::Context *context) const
+{
+ ASSERT(context != nullptr);
+ return (context == mContext);
+}
+
+Error Stream::validateD3D11Texture(void *texture, const AttributeMap &attributes) const
+{
+ ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
+ mConsumerType == ConsumerType::GLTextureYUV);
+ ASSERT(mProducerType == ProducerType::D3D11Texture);
+ ASSERT(mProducerImplementation != nullptr);
+
+ return mProducerImplementation->validateD3DTexture(texture, attributes);
+}
+
+Error Stream::postD3D11Texture(void *texture, const AttributeMap &attributes)
+{
+ ASSERT(mConsumerType == ConsumerType::GLTextureRGB ||
+ mConsumerType == ConsumerType::GLTextureYUV);
+ ASSERT(mProducerType == ProducerType::D3D11Texture);
+
+ mProducerImplementation->postD3DTexture(texture, attributes);
+ mProducerFrame++;
+
+ mState = EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR;
+
+ return NoError();
+}
+
+// This is called when a texture object associated with this stream is destroyed. Even if multiple
+// textures are bound, one being destroyed invalidates the stream, so all the remaining textures
+// will be released and the stream will be invalidated.
+void Stream::releaseTextures()
+{
+ for (auto &plane : mPlanes)
+ {
+ if (plane.texture != nullptr)
+ {
+ plane.texture->releaseStream();
+ plane.texture = nullptr;
+ }
+ }
+ mConsumerType = ConsumerType::NoConsumer;
+ mProducerType = ProducerType::NoProducer;
+ mState = EGL_STREAM_STATE_DISCONNECTED_KHR;
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Stream.h b/gfx/angle/checkout/src/libANGLE/Stream.h
new file mode 100644
index 0000000000..9157aa5184
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Stream.h
@@ -0,0 +1,149 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Stream.h: Defines the egl::Stream class, representing the stream
+// where frames are streamed in. Implements EGLStreanKHR.
+
+#ifndef LIBANGLE_STREAM_H_
+#define LIBANGLE_STREAM_H_
+
+#include <array>
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include "common/angleutils.h"
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/Debug.h"
+
+namespace rx
+{
+class StreamProducerImpl;
+}
+
+namespace gl
+{
+class Context;
+class Texture;
+} // namespace gl
+
+namespace egl
+{
+class Display;
+class Error;
+class Thread;
+
+class Stream final : public LabeledObject, angle::NonCopyable
+{
+ public:
+ Stream(Display *display, const AttributeMap &attribs);
+ ~Stream() override;
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ enum class ConsumerType
+ {
+ NoConsumer,
+ GLTextureRGB,
+ GLTextureYUV,
+ };
+
+ enum class ProducerType
+ {
+ NoProducer,
+ D3D11Texture,
+ };
+
+ // A GL texture interpretation of a part of a producer frame. For use with GL texture consumers
+ struct GLTextureDescription
+ {
+ unsigned int width;
+ unsigned int height;
+ unsigned int internalFormat;
+ unsigned int mipLevels;
+ };
+
+ EGLenum getState() const;
+
+ void setConsumerLatency(EGLint latency);
+ EGLint getConsumerLatency() const;
+
+ EGLuint64KHR getProducerFrame() const;
+ EGLuint64KHR getConsumerFrame() const;
+
+ void setConsumerAcquireTimeout(EGLint timeout);
+ EGLint getConsumerAcquireTimeout() const;
+
+ ConsumerType getConsumerType() const;
+ ProducerType getProducerType() const;
+
+ EGLint getPlaneCount() const;
+
+ rx::StreamProducerImpl *getImplementation();
+
+ // Consumer creation methods
+ Error createConsumerGLTextureExternal(const AttributeMap &attributes, gl::Context *context);
+
+ // Producer creation methods
+ Error createProducerD3D11Texture(const AttributeMap &attributes);
+
+ // Consumer methods
+ Error consumerAcquire(const gl::Context *context);
+ Error consumerRelease(const gl::Context *context);
+
+ // Some consumers are bound to GL contexts. This validates that a given context is bound to the
+ // stream's consumer
+ bool isConsumerBoundToContext(const gl::Context *context) const;
+
+ // Producer methods
+ Error validateD3D11Texture(void *texture, const AttributeMap &attributes) const;
+ Error postD3D11Texture(void *texture, const AttributeMap &attributes);
+
+ private:
+ EGLLabelKHR mLabel;
+
+ // Associated display
+ Display *mDisplay;
+
+ // Producer Implementation
+ rx::StreamProducerImpl *mProducerImplementation;
+
+ // Associated GL context. Note that this is a weak pointer used for validation purposes only,
+ // and should never be arbitrarily dereferenced without knowing the context still exists as it
+ // can become dangling at any time.
+ gl::Context *mContext;
+
+ // EGL defined attributes
+ EGLint mState;
+ EGLuint64KHR mProducerFrame;
+ EGLuint64KHR mConsumerFrame;
+ EGLint mConsumerLatency;
+
+ // EGL gltexture consumer attributes
+ EGLint mConsumerAcquireTimeout;
+
+ // EGL gltexture yuv consumer attributes
+ EGLint mPlaneCount;
+ struct PlaneTexture
+ {
+ EGLint textureUnit;
+ gl::Texture *texture;
+ };
+ // Texture units and textures for all the planes
+ std::array<PlaneTexture, 3> mPlanes;
+
+ // Consumer and producer types
+ ConsumerType mConsumerType;
+ ProducerType mProducerType;
+
+ // ANGLE-only method, used internally
+ friend class gl::Texture;
+ void releaseTextures();
+};
+} // namespace egl
+
+#endif // LIBANGLE_STREAM_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Surface.cpp b/gfx/angle/checkout/src/libANGLE/Surface.cpp
new file mode 100644
index 0000000000..e5a2cf110b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Surface.cpp
@@ -0,0 +1,584 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
+// such as the client area of a window, including any back buffers.
+// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
+
+#include "libANGLE/Surface.h"
+
+#include <EGL/eglext.h>
+
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/Thread.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/EGLImplFactory.h"
+#include "libANGLE/trace.h"
+
+namespace egl
+{
+
+SurfaceState::SurfaceState(const egl::Config *configIn, const AttributeMap &attributesIn)
+ : label(nullptr), config(configIn), attributes(attributesIn), timestampsEnabled(false)
+{}
+
+SurfaceState::~SurfaceState() = default;
+
+Surface::Surface(EGLint surfaceType,
+ const egl::Config *config,
+ const AttributeMap &attributes,
+ EGLenum buftype)
+ : FramebufferAttachmentObject(),
+ mState(config, attributes),
+ mImplementation(nullptr),
+ mRefCount(0),
+ mDestroyed(false),
+ mType(surfaceType),
+ mBuftype(buftype),
+ mPostSubBufferRequested(false),
+ mLargestPbuffer(false),
+ mGLColorspace(EGL_GL_COLORSPACE_LINEAR),
+ mVGAlphaFormat(EGL_VG_ALPHA_FORMAT_NONPRE),
+ mVGColorspace(EGL_VG_COLORSPACE_sRGB),
+ mMipmapTexture(false),
+ mMipmapLevel(0),
+ mHorizontalResolution(EGL_UNKNOWN),
+ mVerticalResolution(EGL_UNKNOWN),
+ mMultisampleResolve(EGL_MULTISAMPLE_RESOLVE_DEFAULT),
+ mFixedSize(false),
+ mFixedWidth(0),
+ mFixedHeight(0),
+ mTextureFormat(TextureFormat::NoTexture),
+ mTextureTarget(EGL_NO_TEXTURE),
+ // FIXME: Determine actual pixel aspect ratio
+ mPixelAspectRatio(static_cast<EGLint>(1.0 * EGL_DISPLAY_SCALING)),
+ mRenderBuffer(EGL_BACK_BUFFER),
+ mSwapBehavior(EGL_NONE),
+ mOrientation(0),
+ mTexture(nullptr),
+ mColorFormat(config->renderTargetFormat),
+ mDSFormat(config->depthStencilFormat),
+ mInitState(gl::InitState::Initialized)
+{
+ mPostSubBufferRequested =
+ (attributes.get(EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_FALSE) == EGL_TRUE);
+ mFlexibleSurfaceCompatibilityRequested =
+ (attributes.get(EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE, EGL_FALSE) == EGL_TRUE);
+
+ if (mType == EGL_PBUFFER_BIT)
+ {
+ mLargestPbuffer = (attributes.get(EGL_LARGEST_PBUFFER, EGL_FALSE) == EGL_TRUE);
+ }
+
+ mGLColorspace =
+ static_cast<EGLenum>(attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR));
+ mVGAlphaFormat =
+ static_cast<EGLenum>(attributes.get(EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_NONPRE));
+ mVGColorspace = static_cast<EGLenum>(attributes.get(EGL_VG_COLORSPACE, EGL_VG_COLORSPACE_sRGB));
+ mMipmapTexture = (attributes.get(EGL_MIPMAP_TEXTURE, EGL_FALSE) == EGL_TRUE);
+
+ mDirectComposition = (attributes.get(EGL_DIRECT_COMPOSITION_ANGLE, EGL_FALSE) == EGL_TRUE);
+
+ mRobustResourceInitialization =
+ (attributes.get(EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE, EGL_FALSE) == EGL_TRUE);
+ if (mRobustResourceInitialization)
+ {
+ mInitState = gl::InitState::MayNeedInit;
+ }
+
+ mFixedSize = (attributes.get(EGL_FIXED_SIZE_ANGLE, EGL_FALSE) == EGL_TRUE);
+ if (mFixedSize)
+ {
+ mFixedWidth = static_cast<size_t>(attributes.get(EGL_WIDTH, 0));
+ mFixedHeight = static_cast<size_t>(attributes.get(EGL_HEIGHT, 0));
+ }
+
+ if (mType != EGL_WINDOW_BIT)
+ {
+ mTextureFormat = attributes.getAsPackedEnum(EGL_TEXTURE_FORMAT, TextureFormat::NoTexture);
+ mTextureTarget = static_cast<EGLenum>(attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE));
+ }
+
+ mOrientation = static_cast<EGLint>(attributes.get(EGL_SURFACE_ORIENTATION_ANGLE, 0));
+}
+
+Surface::~Surface() {}
+
+rx::FramebufferAttachmentObjectImpl *Surface::getAttachmentImpl() const
+{
+ return mImplementation;
+}
+
+Error Surface::destroyImpl(const Display *display)
+{
+ if (mImplementation)
+ {
+ mImplementation->destroy(display);
+ }
+
+ ASSERT(!mTexture);
+
+ SafeDelete(mImplementation);
+
+ delete this;
+ return NoError();
+}
+
+void Surface::postSwap(const Display *display)
+{
+ if (mRobustResourceInitialization && mSwapBehavior != EGL_BUFFER_PRESERVED)
+ {
+ mInitState = gl::InitState::MayNeedInit;
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+ }
+
+ display->onPostSwap();
+}
+
+Error Surface::initialize(const Display *display)
+{
+ ANGLE_TRY(mImplementation->initialize(display));
+
+ // Initialized here since impl is nullptr in the constructor.
+ // Must happen after implementation initialize for Android.
+ mSwapBehavior = mImplementation->getSwapBehavior();
+
+ if (mBuftype == EGL_IOSURFACE_ANGLE)
+ {
+ GLenum internalFormat =
+ static_cast<GLenum>(mState.attributes.get(EGL_TEXTURE_INTERNAL_FORMAT_ANGLE));
+ GLenum type = static_cast<GLenum>(mState.attributes.get(EGL_TEXTURE_TYPE_ANGLE));
+ mColorFormat = gl::Format(internalFormat, type);
+ }
+ if (mBuftype == EGL_D3D_TEXTURE_ANGLE)
+ {
+ const angle::Format *colorFormat = mImplementation->getD3DTextureColorFormat();
+ ASSERT(colorFormat != nullptr);
+ GLenum internalFormat = colorFormat->fboImplementationInternalFormat;
+ mColorFormat = gl::Format(internalFormat, colorFormat->componentType);
+ mGLColorspace = EGL_GL_COLORSPACE_LINEAR;
+ if (mColorFormat.info->colorEncoding == GL_SRGB)
+ {
+ mGLColorspace = EGL_GL_COLORSPACE_SRGB;
+ }
+ }
+
+ if (mType == EGL_WINDOW_BIT && display->getExtensions().getFrameTimestamps)
+ {
+ mState.supportedCompositorTimings = mImplementation->getSupportedCompositorTimings();
+ mState.supportedTimestamps = mImplementation->getSupportedTimestamps();
+ }
+
+ return NoError();
+}
+
+Error Surface::makeCurrent(const gl::Context *context)
+{
+ ANGLE_TRY(mImplementation->makeCurrent(context));
+
+ mRefCount++;
+ return NoError();
+}
+
+Error Surface::unMakeCurrent(const gl::Context *context)
+{
+ ANGLE_TRY(mImplementation->unMakeCurrent(context));
+ return releaseRef(context->getDisplay());
+}
+
+Error Surface::releaseRef(const Display *display)
+{
+ ASSERT(mRefCount > 0);
+ mRefCount--;
+ if (mRefCount == 0 && mDestroyed)
+ {
+ ASSERT(display);
+ return destroyImpl(display);
+ }
+
+ return NoError();
+}
+
+Error Surface::onDestroy(const Display *display)
+{
+ mDestroyed = true;
+ if (mRefCount == 0)
+ {
+ return destroyImpl(display);
+ }
+ return NoError();
+}
+
+void Surface::setLabel(EGLLabelKHR label)
+{
+ mState.label = label;
+}
+
+EGLLabelKHR Surface::getLabel() const
+{
+ return mState.label;
+}
+
+EGLint Surface::getType() const
+{
+ return mType;
+}
+
+Error Surface::swap(const gl::Context *context)
+{
+ ANGLE_TRACE_EVENT0("gpu.angle", "egl::Surface::swap");
+
+ ANGLE_TRY(mImplementation->swap(context));
+ postSwap(context->getDisplay());
+ return NoError();
+}
+
+Error Surface::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects)
+{
+ ANGLE_TRY(mImplementation->swapWithDamage(context, rects, n_rects));
+ postSwap(context->getDisplay());
+ return NoError();
+}
+
+Error Surface::postSubBuffer(const gl::Context *context,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height)
+{
+ if (width == 0 || height == 0)
+ {
+ return egl::NoError();
+ }
+
+ return mImplementation->postSubBuffer(context, x, y, width, height);
+}
+
+Error Surface::setPresentationTime(EGLnsecsANDROID time)
+{
+ return mImplementation->setPresentationTime(time);
+}
+
+Error Surface::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+ return mImplementation->querySurfacePointerANGLE(attribute, value);
+}
+
+EGLint Surface::isPostSubBufferSupported() const
+{
+ return mPostSubBufferRequested && mImplementation->isPostSubBufferSupported();
+}
+
+void Surface::setSwapInterval(EGLint interval)
+{
+ mImplementation->setSwapInterval(interval);
+}
+
+void Surface::setMipmapLevel(EGLint level)
+{
+ // Level is set but ignored
+ UNIMPLEMENTED();
+ mMipmapLevel = level;
+}
+
+void Surface::setMultisampleResolve(EGLenum resolve)
+{
+ // Behaviour is set but ignored
+ UNIMPLEMENTED();
+ mMultisampleResolve = resolve;
+}
+
+void Surface::setSwapBehavior(EGLenum behavior)
+{
+ // Behaviour is set but ignored
+ UNIMPLEMENTED();
+ mSwapBehavior = behavior;
+}
+
+void Surface::setFixedWidth(EGLint width)
+{
+ mFixedWidth = width;
+ mImplementation->setFixedWidth(width);
+}
+
+void Surface::setFixedHeight(EGLint height)
+{
+ mFixedHeight = height;
+ mImplementation->setFixedHeight(height);
+}
+
+const Config *Surface::getConfig() const
+{
+ return mState.config;
+}
+
+EGLint Surface::getPixelAspectRatio() const
+{
+ return mPixelAspectRatio;
+}
+
+EGLenum Surface::getRenderBuffer() const
+{
+ return mRenderBuffer;
+}
+
+EGLenum Surface::getSwapBehavior() const
+{
+ return mSwapBehavior;
+}
+
+TextureFormat Surface::getTextureFormat() const
+{
+ return mTextureFormat;
+}
+
+EGLenum Surface::getTextureTarget() const
+{
+ return mTextureTarget;
+}
+
+bool Surface::getLargestPbuffer() const
+{
+ return mLargestPbuffer;
+}
+
+EGLenum Surface::getGLColorspace() const
+{
+ return mGLColorspace;
+}
+
+EGLenum Surface::getVGAlphaFormat() const
+{
+ return mVGAlphaFormat;
+}
+
+EGLenum Surface::getVGColorspace() const
+{
+ return mVGColorspace;
+}
+
+bool Surface::getMipmapTexture() const
+{
+ return mMipmapTexture;
+}
+
+EGLint Surface::getMipmapLevel() const
+{
+ return mMipmapLevel;
+}
+
+EGLint Surface::getHorizontalResolution() const
+{
+ return mHorizontalResolution;
+}
+
+EGLint Surface::getVerticalResolution() const
+{
+ return mVerticalResolution;
+}
+
+EGLenum Surface::getMultisampleResolve() const
+{
+ return mMultisampleResolve;
+}
+
+EGLint Surface::isFixedSize() const
+{
+ return mFixedSize;
+}
+
+EGLint Surface::getWidth() const
+{
+ return mFixedSize ? static_cast<EGLint>(mFixedWidth) : mImplementation->getWidth();
+}
+
+EGLint Surface::getHeight() const
+{
+ return mFixedSize ? static_cast<EGLint>(mFixedHeight) : mImplementation->getHeight();
+}
+
+Error Surface::bindTexImage(gl::Context *context, gl::Texture *texture, EGLint buffer)
+{
+ ASSERT(!mTexture);
+ ANGLE_TRY(mImplementation->bindTexImage(context, texture, buffer));
+
+ if (texture->bindTexImageFromSurface(context, this) == angle::Result::Stop)
+ {
+ return Error(EGL_BAD_SURFACE);
+ }
+ mTexture = texture;
+ mRefCount++;
+
+ return NoError();
+}
+
+Error Surface::releaseTexImage(const gl::Context *context, EGLint buffer)
+{
+ ASSERT(context);
+
+ ANGLE_TRY(mImplementation->releaseTexImage(context, buffer));
+
+ ASSERT(mTexture);
+ ANGLE_TRY(ResultToEGL(mTexture->releaseTexImageFromSurface(context)));
+
+ return releaseTexImageFromTexture(context);
+}
+
+Error Surface::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
+{
+ return mImplementation->getSyncValues(ust, msc, sbc);
+}
+
+Error Surface::releaseTexImageFromTexture(const gl::Context *context)
+{
+ ASSERT(mTexture);
+ mTexture = nullptr;
+ return releaseRef(context->getDisplay());
+}
+
+gl::Extents Surface::getAttachmentSize(const gl::ImageIndex & /*target*/) const
+{
+ return gl::Extents(getWidth(), getHeight(), 1);
+}
+
+gl::Format Surface::getAttachmentFormat(GLenum binding, const gl::ImageIndex &target) const
+{
+ return (binding == GL_BACK ? mColorFormat : mDSFormat);
+}
+
+GLsizei Surface::getAttachmentSamples(const gl::ImageIndex &target) const
+{
+ return getConfig()->samples;
+}
+
+bool Surface::isRenderable(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex) const
+{
+ return true;
+}
+
+GLuint Surface::getId() const
+{
+ UNREACHABLE();
+ return 0;
+}
+
+gl::Framebuffer *Surface::createDefaultFramebuffer(const gl::Context *context)
+{
+ return new gl::Framebuffer(context, this);
+}
+
+gl::InitState Surface::initState(const gl::ImageIndex & /*imageIndex*/) const
+{
+ return mInitState;
+}
+
+void Surface::setInitState(const gl::ImageIndex & /*imageIndex*/, gl::InitState initState)
+{
+ mInitState = initState;
+}
+
+void Surface::setTimestampsEnabled(bool enabled)
+{
+ mImplementation->setTimestampsEnabled(enabled);
+ mState.timestampsEnabled = enabled;
+}
+
+bool Surface::isTimestampsEnabled() const
+{
+ return mState.timestampsEnabled;
+}
+
+const SupportedCompositorTiming &Surface::getSupportedCompositorTimings() const
+{
+ return mState.supportedCompositorTimings;
+}
+
+Error Surface::getCompositorTiming(EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values) const
+{
+ return mImplementation->getCompositorTiming(numTimestamps, names, values);
+}
+
+Error Surface::getNextFrameId(EGLuint64KHR *frameId) const
+{
+ return mImplementation->getNextFrameId(frameId);
+}
+
+const SupportedTimestamps &Surface::getSupportedTimestamps() const
+{
+ return mState.supportedTimestamps;
+}
+
+Error Surface::getFrameTimestamps(EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values) const
+{
+ return mImplementation->getFrameTimestamps(frameId, numTimestamps, timestamps, values);
+}
+
+WindowSurface::WindowSurface(rx::EGLImplFactory *implFactory,
+ const egl::Config *config,
+ EGLNativeWindowType window,
+ const AttributeMap &attribs)
+ : Surface(EGL_WINDOW_BIT, config, attribs)
+{
+ mImplementation = implFactory->createWindowSurface(mState, window, attribs);
+}
+
+WindowSurface::~WindowSurface() {}
+
+PbufferSurface::PbufferSurface(rx::EGLImplFactory *implFactory,
+ const Config *config,
+ const AttributeMap &attribs)
+ : Surface(EGL_PBUFFER_BIT, config, attribs)
+{
+ mImplementation = implFactory->createPbufferSurface(mState, attribs);
+}
+
+PbufferSurface::PbufferSurface(rx::EGLImplFactory *implFactory,
+ const Config *config,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const AttributeMap &attribs)
+ : Surface(EGL_PBUFFER_BIT, config, attribs, buftype)
+{
+ mImplementation =
+ implFactory->createPbufferFromClientBuffer(mState, buftype, clientBuffer, attribs);
+}
+
+PbufferSurface::~PbufferSurface() {}
+
+PixmapSurface::PixmapSurface(rx::EGLImplFactory *implFactory,
+ const Config *config,
+ NativePixmapType nativePixmap,
+ const AttributeMap &attribs)
+ : Surface(EGL_PIXMAP_BIT, config, attribs)
+{
+ mImplementation = implFactory->createPixmapSurface(mState, nativePixmap, attribs);
+}
+
+PixmapSurface::~PixmapSurface() {}
+
+// SurfaceDeleter implementation.
+
+SurfaceDeleter::SurfaceDeleter(const Display *display) : mDisplay(display) {}
+
+SurfaceDeleter::~SurfaceDeleter() {}
+
+void SurfaceDeleter::operator()(Surface *surface)
+{
+ ANGLE_SWALLOW_ERR(surface->onDestroy(mDisplay));
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Surface.h b/gfx/angle/checkout/src/libANGLE/Surface.h
new file mode 100644
index 0000000000..6551dc2494
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Surface.h
@@ -0,0 +1,289 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Surface.h: Defines the egl::Surface class, representing a drawing surface
+// such as the client area of a window, including any back buffers.
+// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
+
+#ifndef LIBANGLE_SURFACE_H_
+#define LIBANGLE_SURFACE_H_
+
+#include <EGL/egl.h>
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/SurfaceImpl.h"
+
+namespace gl
+{
+class Context;
+class Framebuffer;
+class Texture;
+} // namespace gl
+
+namespace rx
+{
+class EGLImplFactory;
+}
+
+namespace egl
+{
+class Display;
+struct Config;
+
+using SupportedCompositorTiming = angle::PackedEnumBitSet<CompositorTiming>;
+using SupportedTimestamps = angle::PackedEnumBitSet<Timestamp>;
+
+struct SurfaceState final : private angle::NonCopyable
+{
+ SurfaceState(const egl::Config *configIn, const AttributeMap &attributesIn);
+ ~SurfaceState();
+
+ EGLLabelKHR label;
+ const egl::Config *config;
+ AttributeMap attributes;
+
+ bool timestampsEnabled;
+ SupportedCompositorTiming supportedCompositorTimings;
+ SupportedTimestamps supportedTimestamps;
+};
+
+class Surface : public LabeledObject, public gl::FramebufferAttachmentObject
+{
+ public:
+ rx::SurfaceImpl *getImplementation() const { return mImplementation; }
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ EGLint getType() const;
+
+ Error initialize(const Display *display);
+ Error makeCurrent(const gl::Context *context);
+ Error unMakeCurrent(const gl::Context *context);
+ Error swap(const gl::Context *context);
+ Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects);
+ Error postSubBuffer(const gl::Context *context,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height);
+ Error setPresentationTime(EGLnsecsANDROID time);
+ Error querySurfacePointerANGLE(EGLint attribute, void **value);
+ Error bindTexImage(gl::Context *context, gl::Texture *texture, EGLint buffer);
+ Error releaseTexImage(const gl::Context *context, EGLint buffer);
+
+ Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc);
+
+ EGLint isPostSubBufferSupported() const;
+
+ void setSwapInterval(EGLint interval);
+ Error onDestroy(const Display *display);
+
+ void setMipmapLevel(EGLint level);
+ void setMultisampleResolve(EGLenum resolve);
+ void setSwapBehavior(EGLenum behavior);
+
+ void setFixedWidth(EGLint width);
+ void setFixedHeight(EGLint height);
+
+ gl::Framebuffer *createDefaultFramebuffer(const gl::Context *context);
+
+ const Config *getConfig() const;
+
+ // width and height can change with client window resizing
+ EGLint getWidth() const;
+ EGLint getHeight() const;
+ EGLint getPixelAspectRatio() const;
+ EGLenum getRenderBuffer() const;
+ EGLenum getSwapBehavior() const;
+ TextureFormat getTextureFormat() const;
+ EGLenum getTextureTarget() const;
+ bool getLargestPbuffer() const;
+ EGLenum getGLColorspace() const;
+ EGLenum getVGAlphaFormat() const;
+ EGLenum getVGColorspace() const;
+ bool getMipmapTexture() const;
+ EGLint getMipmapLevel() const;
+ EGLint getHorizontalResolution() const;
+ EGLint getVerticalResolution() const;
+ EGLenum getMultisampleResolve() const;
+
+ gl::Texture *getBoundTexture() const { return mTexture; }
+
+ EGLint isFixedSize() const;
+
+ // FramebufferAttachmentObject implementation
+ gl::Extents getAttachmentSize(const gl::ImageIndex &imageIndex) const override;
+ gl::Format getAttachmentFormat(GLenum binding, const gl::ImageIndex &imageIndex) const override;
+ GLsizei getAttachmentSamples(const gl::ImageIndex &imageIndex) const override;
+ bool isRenderable(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex) const override;
+
+ void onAttach(const gl::Context *context) override {}
+ void onDetach(const gl::Context *context) override {}
+ GLuint getId() const override;
+
+ bool flexibleSurfaceCompatibilityRequested() const
+ {
+ return mFlexibleSurfaceCompatibilityRequested;
+ }
+ EGLint getOrientation() const { return mOrientation; }
+
+ bool directComposition() const { return mDirectComposition; }
+
+ gl::InitState initState(const gl::ImageIndex &imageIndex) const override;
+ void setInitState(const gl::ImageIndex &imageIndex, gl::InitState initState) override;
+
+ bool isRobustResourceInitEnabled() const { return mRobustResourceInitialization; }
+
+ const gl::Format &getBindTexImageFormat() const { return mColorFormat; }
+
+ // EGL_ANDROID_get_frame_timestamps entry points
+ void setTimestampsEnabled(bool enabled);
+ bool isTimestampsEnabled() const;
+
+ const SupportedCompositorTiming &getSupportedCompositorTimings() const;
+ Error getCompositorTiming(EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values) const;
+
+ Error getNextFrameId(EGLuint64KHR *frameId) const;
+ const SupportedTimestamps &getSupportedTimestamps() const;
+ Error getFrameTimestamps(EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values) const;
+
+ protected:
+ Surface(EGLint surfaceType,
+ const egl::Config *config,
+ const AttributeMap &attributes,
+ EGLenum buftype = EGL_NONE);
+ ~Surface() override;
+ rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override;
+
+ gl::Framebuffer *createDefaultFramebuffer(const Display *display);
+
+ // ANGLE-only method, used internally
+ friend class gl::Texture;
+ Error releaseTexImageFromTexture(const gl::Context *context);
+
+ SurfaceState mState;
+ rx::SurfaceImpl *mImplementation;
+ int mRefCount;
+ bool mDestroyed;
+
+ EGLint mType;
+ EGLenum mBuftype;
+
+ bool mPostSubBufferRequested;
+ bool mFlexibleSurfaceCompatibilityRequested;
+
+ bool mLargestPbuffer;
+ EGLenum mGLColorspace;
+ EGLenum mVGAlphaFormat;
+ EGLenum mVGColorspace;
+ bool mMipmapTexture;
+ EGLint mMipmapLevel;
+ EGLint mHorizontalResolution;
+ EGLint mVerticalResolution;
+ EGLenum mMultisampleResolve;
+
+ bool mFixedSize;
+ size_t mFixedWidth;
+ size_t mFixedHeight;
+
+ bool mDirectComposition;
+
+ bool mRobustResourceInitialization;
+
+ TextureFormat mTextureFormat;
+ EGLenum mTextureTarget;
+
+ EGLint mPixelAspectRatio; // Display aspect ratio
+ EGLenum mRenderBuffer; // Render buffer
+ EGLenum mSwapBehavior; // Buffer swap behavior
+
+ EGLint mOrientation;
+
+ // We don't use a binding pointer here. We don't ever want to own an orphaned texture. If a
+ // Texture is deleted the Surface is unbound in onDestroy.
+ gl::Texture *mTexture;
+
+ gl::Format mColorFormat;
+ gl::Format mDSFormat;
+
+ private:
+ Error destroyImpl(const Display *display);
+
+ void postSwap(const Display *display);
+ Error releaseRef(const Display *display);
+
+ gl::InitState mInitState;
+};
+
+class WindowSurface final : public Surface
+{
+ public:
+ WindowSurface(rx::EGLImplFactory *implFactory,
+ const Config *config,
+ EGLNativeWindowType window,
+ const AttributeMap &attribs);
+ ~WindowSurface() override;
+};
+
+class PbufferSurface final : public Surface
+{
+ public:
+ PbufferSurface(rx::EGLImplFactory *implFactory,
+ const Config *config,
+ const AttributeMap &attribs);
+ PbufferSurface(rx::EGLImplFactory *implFactory,
+ const Config *config,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const AttributeMap &attribs);
+
+ protected:
+ ~PbufferSurface() override;
+};
+
+class PixmapSurface final : public Surface
+{
+ public:
+ PixmapSurface(rx::EGLImplFactory *implFactory,
+ const Config *config,
+ NativePixmapType nativePixmap,
+ const AttributeMap &attribs);
+
+ protected:
+ ~PixmapSurface() override;
+};
+
+class SurfaceDeleter final
+{
+ public:
+ SurfaceDeleter(const Display *display);
+ ~SurfaceDeleter();
+ void operator()(Surface *surface);
+
+ private:
+ const Display *mDisplay;
+};
+
+using SurfacePointer = angle::UniqueObjectPointerBase<Surface, SurfaceDeleter>;
+
+} // namespace egl
+
+#endif // LIBANGLE_SURFACE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Texture.cpp b/gfx/angle/checkout/src/libANGLE/Texture.cpp
new file mode 100644
index 0000000000..52a5f482bc
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Texture.cpp
@@ -0,0 +1,1852 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Texture.cpp: Implements the gl::Texture class. [OpenGL ES 2.0.24] section 3.7 page 63.
+
+#include "libANGLE/Texture.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/State.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/TextureImpl.h"
+
+namespace gl
+{
+
+namespace
+{
+bool IsPointSampled(const SamplerState &samplerState)
+{
+ return (samplerState.getMagFilter() == GL_NEAREST &&
+ (samplerState.getMinFilter() == GL_NEAREST ||
+ samplerState.getMinFilter() == GL_NEAREST_MIPMAP_NEAREST));
+}
+
+size_t GetImageDescIndex(TextureTarget target, size_t level)
+{
+ return IsCubeMapFaceTarget(target) ? (level * 6 + CubeMapTextureTargetToFaceIndex(target))
+ : level;
+}
+
+InitState DetermineInitState(const Context *context, const uint8_t *pixels)
+{
+ // Can happen in tests.
+ if (!context || !context->isRobustResourceInitEnabled())
+ return InitState::Initialized;
+
+ const auto &glState = context->getState();
+ return (pixels == nullptr && glState.getTargetBuffer(gl::BufferBinding::PixelUnpack) == nullptr)
+ ? InitState::MayNeedInit
+ : InitState::Initialized;
+}
+} // namespace
+
+bool IsMipmapFiltered(const SamplerState &samplerState)
+{
+ switch (samplerState.getMinFilter())
+ {
+ 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;
+ }
+}
+
+SwizzleState::SwizzleState()
+ : swizzleRed(GL_RED), swizzleGreen(GL_GREEN), swizzleBlue(GL_BLUE), swizzleAlpha(GL_ALPHA)
+{}
+
+SwizzleState::SwizzleState(GLenum red, GLenum green, GLenum blue, GLenum alpha)
+ : swizzleRed(red), swizzleGreen(green), swizzleBlue(blue), swizzleAlpha(alpha)
+{}
+
+bool SwizzleState::swizzleRequired() const
+{
+ return swizzleRed != GL_RED || swizzleGreen != GL_GREEN || swizzleBlue != GL_BLUE ||
+ swizzleAlpha != GL_ALPHA;
+}
+
+bool SwizzleState::operator==(const SwizzleState &other) const
+{
+ return swizzleRed == other.swizzleRed && swizzleGreen == other.swizzleGreen &&
+ swizzleBlue == other.swizzleBlue && swizzleAlpha == other.swizzleAlpha;
+}
+
+bool SwizzleState::operator!=(const SwizzleState &other) const
+{
+ return !(*this == other);
+}
+
+TextureState::TextureState(TextureType type)
+ : mType(type),
+ mSamplerState(SamplerState::CreateDefaultForTarget(type)),
+ mBaseLevel(0),
+ mMaxLevel(1000),
+ mDepthStencilTextureMode(GL_DEPTH_COMPONENT),
+ mImmutableFormat(false),
+ mImmutableLevels(0),
+ mUsage(GL_NONE),
+ mImageDescs((IMPLEMENTATION_MAX_TEXTURE_LEVELS + 1) * (type == TextureType::CubeMap ? 6 : 1)),
+ mCropRect(0, 0, 0, 0),
+ mGenerateMipmapHint(GL_FALSE),
+ mInitState(InitState::MayNeedInit),
+ mCachedSamplerFormat(SamplerFormat::InvalidEnum),
+ mCachedSamplerCompareMode(GL_NONE),
+ mCachedSamplerFormatValid(false)
+{}
+
+TextureState::~TextureState() {}
+
+bool TextureState::swizzleRequired() const
+{
+ return mSwizzleState.swizzleRequired();
+}
+
+GLuint TextureState::getEffectiveBaseLevel() const
+{
+ if (mImmutableFormat)
+ {
+ // GLES 3.0.4 section 3.8.10
+ return std::min(mBaseLevel, mImmutableLevels - 1);
+ }
+ // Some classes use the effective base level to index arrays with level data. By clamping the
+ // effective base level to max levels these arrays need just one extra item to store properties
+ // that should be returned for all out-of-range base level values, instead of needing special
+ // handling for out-of-range base levels.
+ return std::min(mBaseLevel, static_cast<GLuint>(IMPLEMENTATION_MAX_TEXTURE_LEVELS));
+}
+
+GLuint TextureState::getEffectiveMaxLevel() const
+{
+ if (mImmutableFormat)
+ {
+ // GLES 3.0.4 section 3.8.10
+ GLuint clampedMaxLevel = std::max(mMaxLevel, getEffectiveBaseLevel());
+ clampedMaxLevel = std::min(clampedMaxLevel, mImmutableLevels - 1);
+ return clampedMaxLevel;
+ }
+ return mMaxLevel;
+}
+
+GLuint TextureState::getMipmapMaxLevel() const
+{
+ const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel());
+ GLuint expectedMipLevels = 0;
+ if (mType == TextureType::_3D)
+ {
+ const int maxDim = std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height),
+ baseImageDesc.size.depth);
+ expectedMipLevels = static_cast<GLuint>(log2(maxDim));
+ }
+ else
+ {
+ expectedMipLevels = static_cast<GLuint>(
+ log2(std::max(baseImageDesc.size.width, baseImageDesc.size.height)));
+ }
+
+ return std::min<GLuint>(getEffectiveBaseLevel() + expectedMipLevels, getEffectiveMaxLevel());
+}
+
+bool TextureState::setBaseLevel(GLuint baseLevel)
+{
+ if (mBaseLevel != baseLevel)
+ {
+ mBaseLevel = baseLevel;
+ return true;
+ }
+ return false;
+}
+
+bool TextureState::setMaxLevel(GLuint maxLevel)
+{
+ if (mMaxLevel != maxLevel)
+ {
+ mMaxLevel = maxLevel;
+ return true;
+ }
+
+ return false;
+}
+
+// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
+// According to [OpenGL ES 3.0.5] section 3.8.13 Texture Completeness page 160 any
+// per-level checks begin at the base-level.
+// For OpenGL ES2 the base level is always zero.
+bool TextureState::isCubeComplete() const
+{
+ ASSERT(mType == TextureType::CubeMap);
+
+ angle::EnumIterator<TextureTarget> face = kCubeMapTextureTargetMin;
+ const ImageDesc &baseImageDesc = getImageDesc(*face, getEffectiveBaseLevel());
+ if (baseImageDesc.size.width == 0 || baseImageDesc.size.width != baseImageDesc.size.height)
+ {
+ return false;
+ }
+
+ ++face;
+
+ for (; face != kAfterCubeMapTextureTargetMax; ++face)
+ {
+ const ImageDesc &faceImageDesc = getImageDesc(*face, getEffectiveBaseLevel());
+ if (faceImageDesc.size.width != baseImageDesc.size.width ||
+ faceImageDesc.size.height != baseImageDesc.size.height ||
+ !Format::SameSized(faceImageDesc.format, baseImageDesc.format))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+const ImageDesc &TextureState::getBaseLevelDesc() const
+{
+ ASSERT(mType != TextureType::CubeMap || isCubeComplete());
+ return getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel());
+}
+
+void TextureState::setCrop(const gl::Rectangle &rect)
+{
+ mCropRect = rect;
+}
+
+const gl::Rectangle &TextureState::getCrop() const
+{
+ return mCropRect;
+}
+
+void TextureState::setGenerateMipmapHint(GLenum hint)
+{
+ mGenerateMipmapHint = hint;
+}
+
+GLenum TextureState::getGenerateMipmapHint() const
+{
+ return mGenerateMipmapHint;
+}
+
+SamplerFormat TextureState::computeRequiredSamplerFormat(const SamplerState &samplerState) const
+{
+ const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel());
+ if ((baseImageDesc.format.info->format == GL_DEPTH_COMPONENT ||
+ baseImageDesc.format.info->format == GL_DEPTH_STENCIL) &&
+ samplerState.getCompareMode() != GL_NONE)
+ {
+ return SamplerFormat::Shadow;
+ }
+ else
+ {
+ switch (baseImageDesc.format.info->componentType)
+ {
+ case GL_UNSIGNED_NORMALIZED:
+ case GL_SIGNED_NORMALIZED:
+ case GL_FLOAT:
+ return SamplerFormat::Float;
+ case GL_INT:
+ return SamplerFormat::Signed;
+ case GL_UNSIGNED_INT:
+ return SamplerFormat::Unsigned;
+ default:
+ return SamplerFormat::InvalidEnum;
+ }
+ }
+}
+
+bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState,
+ const State &data) const
+{
+ if (mBaseLevel > mMaxLevel)
+ {
+ return false;
+ }
+ const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel());
+ if (baseImageDesc.size.width == 0 || baseImageDesc.size.height == 0 ||
+ baseImageDesc.size.depth == 0)
+ {
+ return false;
+ }
+ // The cases where the texture is incomplete because base level is out of range should be
+ // handled by the above condition.
+ ASSERT(mBaseLevel < IMPLEMENTATION_MAX_TEXTURE_LEVELS || mImmutableFormat);
+
+ if (mType == TextureType::CubeMap && baseImageDesc.size.width != baseImageDesc.size.height)
+ {
+ return false;
+ }
+
+ // According to es 3.1 spec, texture is justified as incomplete if sized internalformat is
+ // unfilterable(table 20.11) and filter is not GL_NEAREST(8.16). The default value of minFilter
+ // is NEAREST_MIPMAP_LINEAR and magFilter is LINEAR(table 20.11,). For multismaple texture,
+ // filter state of multisample texture is ignored(11.1.3.3). So it shouldn't be judged as
+ // incomplete texture. So, we ignore filtering for multisample texture completeness here.
+ if (!IsMultisampled(mType) &&
+ !baseImageDesc.format.info->filterSupport(data.getClientVersion(), data.getExtensions()) &&
+ !IsPointSampled(samplerState))
+ {
+ return false;
+ }
+ bool npotSupport = data.getExtensions().textureNPOT || data.getClientMajorVersion() >= 3;
+ if (!npotSupport)
+ {
+ if ((samplerState.getWrapS() != GL_CLAMP_TO_EDGE &&
+ samplerState.getWrapS() != GL_CLAMP_TO_BORDER && !isPow2(baseImageDesc.size.width)) ||
+ (samplerState.getWrapT() != GL_CLAMP_TO_EDGE &&
+ samplerState.getWrapT() != GL_CLAMP_TO_BORDER && !isPow2(baseImageDesc.size.height)))
+ {
+ return false;
+ }
+ }
+
+ if (mType != TextureType::_2DMultisample && IsMipmapFiltered(samplerState))
+ {
+ if (!npotSupport)
+ {
+ if (!isPow2(baseImageDesc.size.width) || !isPow2(baseImageDesc.size.height))
+ {
+ return false;
+ }
+ }
+
+ if (!computeMipmapCompleteness())
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (mType == TextureType::CubeMap && !isCubeComplete())
+ {
+ return false;
+ }
+ }
+
+ // From GL_OES_EGL_image_external_essl3: If state is present in a sampler object bound to a
+ // texture unit that would have been rejected by a call to TexParameter* for the texture bound
+ // to that unit, the behavior of the implementation is as if the texture were incomplete. For
+ // example, if TEXTURE_WRAP_S or TEXTURE_WRAP_T is set to anything but CLAMP_TO_EDGE on the
+ // sampler object bound to a texture unit and the texture bound to that unit is an external
+ // texture, the texture will be considered incomplete.
+ // Sampler object state which does not affect sampling for the type of texture bound to a
+ // texture unit, such as TEXTURE_WRAP_R for an external texture, does not affect completeness.
+ if (mType == TextureType::External)
+ {
+ if (samplerState.getWrapS() != GL_CLAMP_TO_EDGE ||
+ samplerState.getWrapT() != GL_CLAMP_TO_EDGE)
+ {
+ return false;
+ }
+
+ if (samplerState.getMinFilter() != GL_LINEAR && samplerState.getMinFilter() != GL_NEAREST)
+ {
+ return false;
+ }
+ }
+
+ // OpenGLES 3.0.2 spec section 3.8.13 states that a texture is not mipmap complete if:
+ // The internalformat specified for the texture arrays is a sized internal depth or
+ // depth and stencil format (see table 3.13), the value of TEXTURE_COMPARE_-
+ // MODE is NONE, and either the magnification filter is not NEAREST or the mini-
+ // fication filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST.
+ if (!IsMultisampled(mType) && baseImageDesc.format.info->depthBits > 0 &&
+ data.getClientMajorVersion() >= 3)
+ {
+ // Note: we restrict this validation to sized types. For the OES_depth_textures
+ // extension, due to some underspecification problems, we must allow linear filtering
+ // for legacy compatibility with WebGL 1.
+ // See http://crbug.com/649200
+ if (samplerState.getCompareMode() == GL_NONE && baseImageDesc.format.info->sized)
+ {
+ if ((samplerState.getMinFilter() != GL_NEAREST &&
+ samplerState.getMinFilter() != GL_NEAREST_MIPMAP_NEAREST) ||
+ samplerState.getMagFilter() != GL_NEAREST)
+ {
+ return false;
+ }
+ }
+ }
+
+ // OpenGLES 3.1 spec section 8.16 states that a texture is not mipmap complete if:
+ // The internalformat specified for the texture is DEPTH_STENCIL format, the value of
+ // DEPTH_STENCIL_TEXTURE_MODE is STENCIL_INDEX, and either the magnification filter is
+ // not NEAREST or the minification filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST.
+ // However, the ES 3.1 spec differs from the statement above, because it is incorrect.
+ // See the issue at https://github.com/KhronosGroup/OpenGL-API/issues/33.
+ // For multismaple texture, filter state of multisample texture is ignored(11.1.3.3).
+ // So it shouldn't be judged as incomplete texture. So, we ignore filtering for multisample
+ // texture completeness here.
+ if (!IsMultisampled(mType) && baseImageDesc.format.info->depthBits > 0 &&
+ mDepthStencilTextureMode == GL_STENCIL_INDEX)
+ {
+ if ((samplerState.getMinFilter() != GL_NEAREST &&
+ samplerState.getMinFilter() != GL_NEAREST_MIPMAP_NEAREST) ||
+ samplerState.getMagFilter() != GL_NEAREST)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TextureState::computeMipmapCompleteness() const
+{
+ const GLuint maxLevel = getMipmapMaxLevel();
+
+ for (GLuint level = getEffectiveBaseLevel(); level <= maxLevel; level++)
+ {
+ if (mType == TextureType::CubeMap)
+ {
+ for (TextureTarget face : AllCubeFaceTextureTargets())
+ {
+ if (!computeLevelCompleteness(face, level))
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ if (!computeLevelCompleteness(NonCubeTextureTypeToTarget(mType), level))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool TextureState::computeLevelCompleteness(TextureTarget target, size_t level) const
+{
+ ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+ if (mImmutableFormat)
+ {
+ return true;
+ }
+
+ const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel());
+ if (baseImageDesc.size.width == 0 || baseImageDesc.size.height == 0 ||
+ baseImageDesc.size.depth == 0)
+ {
+ return false;
+ }
+
+ const ImageDesc &levelImageDesc = getImageDesc(target, level);
+ if (levelImageDesc.size.width == 0 || levelImageDesc.size.height == 0 ||
+ levelImageDesc.size.depth == 0)
+ {
+ return false;
+ }
+
+ if (!Format::SameSized(levelImageDesc.format, baseImageDesc.format))
+ {
+ return false;
+ }
+
+ ASSERT(level >= getEffectiveBaseLevel());
+ const size_t relativeLevel = level - getEffectiveBaseLevel();
+ if (levelImageDesc.size.width != std::max(1, baseImageDesc.size.width >> relativeLevel))
+ {
+ return false;
+ }
+
+ if (levelImageDesc.size.height != std::max(1, baseImageDesc.size.height >> relativeLevel))
+ {
+ return false;
+ }
+
+ if (mType == TextureType::_3D)
+ {
+ if (levelImageDesc.size.depth != std::max(1, baseImageDesc.size.depth >> relativeLevel))
+ {
+ return false;
+ }
+ }
+ else if (mType == TextureType::_2DArray)
+ {
+ if (levelImageDesc.size.depth != baseImageDesc.size.depth)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+TextureTarget TextureState::getBaseImageTarget() const
+{
+ return mType == TextureType::CubeMap ? kCubeMapTextureTargetMin
+ : NonCubeTextureTypeToTarget(mType);
+}
+
+ImageDesc::ImageDesc()
+ : ImageDesc(Extents(0, 0, 0), Format::Invalid(), 0, GL_TRUE, InitState::Initialized)
+{}
+
+ImageDesc::ImageDesc(const Extents &size, const Format &format, const InitState initState)
+ : size(size), format(format), samples(0), fixedSampleLocations(GL_TRUE), initState(initState)
+{}
+
+ImageDesc::ImageDesc(const Extents &size,
+ const Format &format,
+ const GLsizei samples,
+ const bool fixedSampleLocations,
+ const InitState initState)
+ : size(size),
+ format(format),
+ samples(samples),
+ fixedSampleLocations(fixedSampleLocations),
+ initState(initState)
+{}
+
+GLint ImageDesc::getMemorySize() const
+{
+ // Assume allocated size is around width * height * depth * samples * pixelBytes
+ angle::CheckedNumeric<GLint> levelSize = 1;
+ levelSize *= format.info->pixelBytes;
+ levelSize *= size.width;
+ levelSize *= size.height;
+ levelSize *= size.depth;
+ levelSize *= std::max(samples, 1);
+ return levelSize.ValueOrDefault(std::numeric_limits<GLint>::max());
+}
+
+const ImageDesc &TextureState::getImageDesc(TextureTarget target, size_t level) const
+{
+ size_t descIndex = GetImageDescIndex(target, level);
+ ASSERT(descIndex < mImageDescs.size());
+ return mImageDescs[descIndex];
+}
+
+void TextureState::setImageDesc(TextureTarget target, size_t level, const ImageDesc &desc)
+{
+ size_t descIndex = GetImageDescIndex(target, level);
+ ASSERT(descIndex < mImageDescs.size());
+ mImageDescs[descIndex] = desc;
+ if (desc.initState == InitState::MayNeedInit)
+ {
+ mInitState = InitState::MayNeedInit;
+ }
+}
+
+// Note that an ImageIndex that represents an entire level of a cube map corresponds to 6
+// ImageDescs, so if the cube map is cube complete, we return the ImageDesc of the first cube
+// face, and we don't allow using this function when the cube map is not cube complete.
+const ImageDesc &TextureState::getImageDesc(const ImageIndex &imageIndex) const
+{
+ if (imageIndex.isEntireLevelCubeMap())
+ {
+ ASSERT(isCubeComplete());
+ const GLint levelIndex = imageIndex.getLevelIndex();
+ return getImageDesc(kCubeMapTextureTargetMin, levelIndex);
+ }
+
+ return getImageDesc(imageIndex.getTarget(), imageIndex.getLevelIndex());
+}
+
+void TextureState::setImageDescChain(GLuint baseLevel,
+ GLuint maxLevel,
+ Extents baseSize,
+ const Format &format,
+ InitState initState)
+{
+ for (GLuint level = baseLevel; level <= maxLevel; level++)
+ {
+ int relativeLevel = (level - baseLevel);
+ Extents levelSize(std::max<int>(baseSize.width >> relativeLevel, 1),
+ std::max<int>(baseSize.height >> relativeLevel, 1),
+ (mType == TextureType::_2DArray)
+ ? baseSize.depth
+ : std::max<int>(baseSize.depth >> relativeLevel, 1));
+ ImageDesc levelInfo(levelSize, format, initState);
+
+ if (mType == TextureType::CubeMap)
+ {
+ for (TextureTarget face : AllCubeFaceTextureTargets())
+ {
+ setImageDesc(face, level, levelInfo);
+ }
+ }
+ else
+ {
+ setImageDesc(NonCubeTextureTypeToTarget(mType), level, levelInfo);
+ }
+ }
+}
+
+void TextureState::setImageDescChainMultisample(Extents baseSize,
+ const Format &format,
+ GLsizei samples,
+ bool fixedSampleLocations,
+ InitState initState)
+{
+ ASSERT(mType == TextureType::_2DMultisample || mType == TextureType::_2DMultisampleArray);
+ ImageDesc levelInfo(baseSize, format, samples, fixedSampleLocations, initState);
+ setImageDesc(NonCubeTextureTypeToTarget(mType), 0, levelInfo);
+}
+
+void TextureState::clearImageDesc(TextureTarget target, size_t level)
+{
+ setImageDesc(target, level, ImageDesc());
+}
+
+void TextureState::clearImageDescs()
+{
+ for (size_t descIndex = 0; descIndex < mImageDescs.size(); descIndex++)
+ {
+ mImageDescs[descIndex] = ImageDesc();
+ }
+}
+
+Texture::Texture(rx::GLImplFactory *factory, GLuint id, TextureType type)
+ : RefCountObject(id),
+ mState(type),
+ mTexture(factory->createTexture(mState)),
+ mImplObserver(this, rx::kTextureImageImplObserverMessageIndex),
+ mLabel(),
+ mBoundSurface(nullptr),
+ mBoundStream(nullptr)
+{
+ mImplObserver.bind(mTexture);
+
+ // Initially assume the implementation is dirty.
+ mDirtyBits.set(DIRTY_BIT_IMPLEMENTATION);
+}
+
+void Texture::onDestroy(const Context *context)
+{
+ if (mBoundSurface)
+ {
+ ANGLE_SWALLOW_ERR(mBoundSurface->releaseTexImage(context, EGL_BACK_BUFFER));
+ mBoundSurface = nullptr;
+ }
+ if (mBoundStream)
+ {
+ mBoundStream->releaseTextures();
+ mBoundStream = nullptr;
+ }
+
+ (void)(orphanImages(context));
+
+ if (mTexture)
+ {
+ mTexture->onDestroy(context);
+ }
+}
+
+Texture::~Texture()
+{
+ SafeDelete(mTexture);
+}
+
+void Texture::setLabel(const Context *context, const std::string &label)
+{
+ mLabel = label;
+ signalDirtyState(DIRTY_BIT_LABEL);
+}
+
+const std::string &Texture::getLabel() const
+{
+ return mLabel;
+}
+
+void Texture::setSwizzleRed(const Context *context, GLenum swizzleRed)
+{
+ mState.mSwizzleState.swizzleRed = swizzleRed;
+ signalDirtyState(DIRTY_BIT_SWIZZLE_RED);
+}
+
+GLenum Texture::getSwizzleRed() const
+{
+ return mState.mSwizzleState.swizzleRed;
+}
+
+void Texture::setSwizzleGreen(const Context *context, GLenum swizzleGreen)
+{
+ mState.mSwizzleState.swizzleGreen = swizzleGreen;
+ signalDirtyState(DIRTY_BIT_SWIZZLE_GREEN);
+}
+
+GLenum Texture::getSwizzleGreen() const
+{
+ return mState.mSwizzleState.swizzleGreen;
+}
+
+void Texture::setSwizzleBlue(const Context *context, GLenum swizzleBlue)
+{
+ mState.mSwizzleState.swizzleBlue = swizzleBlue;
+ signalDirtyState(DIRTY_BIT_SWIZZLE_BLUE);
+}
+
+GLenum Texture::getSwizzleBlue() const
+{
+ return mState.mSwizzleState.swizzleBlue;
+}
+
+void Texture::setSwizzleAlpha(const Context *context, GLenum swizzleAlpha)
+{
+ mState.mSwizzleState.swizzleAlpha = swizzleAlpha;
+ signalDirtyState(DIRTY_BIT_SWIZZLE_ALPHA);
+}
+
+GLenum Texture::getSwizzleAlpha() const
+{
+ return mState.mSwizzleState.swizzleAlpha;
+}
+
+void Texture::setMinFilter(const Context *context, GLenum minFilter)
+{
+ mState.mSamplerState.setMinFilter(minFilter);
+ signalDirtyState(DIRTY_BIT_MIN_FILTER);
+}
+
+GLenum Texture::getMinFilter() const
+{
+ return mState.mSamplerState.getMinFilter();
+}
+
+void Texture::setMagFilter(const Context *context, GLenum magFilter)
+{
+ mState.mSamplerState.setMagFilter(magFilter);
+ signalDirtyState(DIRTY_BIT_MAG_FILTER);
+}
+
+GLenum Texture::getMagFilter() const
+{
+ return mState.mSamplerState.getMagFilter();
+}
+
+void Texture::setWrapS(const Context *context, GLenum wrapS)
+{
+ mState.mSamplerState.setWrapS(wrapS);
+ signalDirtyState(DIRTY_BIT_WRAP_S);
+}
+
+GLenum Texture::getWrapS() const
+{
+ return mState.mSamplerState.getWrapS();
+}
+
+void Texture::setWrapT(const Context *context, GLenum wrapT)
+{
+ mState.mSamplerState.setWrapT(wrapT);
+ signalDirtyState(DIRTY_BIT_WRAP_T);
+}
+
+GLenum Texture::getWrapT() const
+{
+ return mState.mSamplerState.getWrapT();
+}
+
+void Texture::setWrapR(const Context *context, GLenum wrapR)
+{
+ mState.mSamplerState.setWrapR(wrapR);
+ signalDirtyState(DIRTY_BIT_WRAP_R);
+}
+
+GLenum Texture::getWrapR() const
+{
+ return mState.mSamplerState.getWrapR();
+}
+
+void Texture::setMaxAnisotropy(const Context *context, float maxAnisotropy)
+{
+ mState.mSamplerState.setMaxAnisotropy(maxAnisotropy);
+ signalDirtyState(DIRTY_BIT_MAX_ANISOTROPY);
+}
+
+float Texture::getMaxAnisotropy() const
+{
+ return mState.mSamplerState.getMaxAnisotropy();
+}
+
+void Texture::setMinLod(const Context *context, GLfloat minLod)
+{
+ mState.mSamplerState.setMinLod(minLod);
+ signalDirtyState(DIRTY_BIT_MIN_LOD);
+}
+
+GLfloat Texture::getMinLod() const
+{
+ return mState.mSamplerState.getMinLod();
+}
+
+void Texture::setMaxLod(const Context *context, GLfloat maxLod)
+{
+ mState.mSamplerState.setMaxLod(maxLod);
+ signalDirtyState(DIRTY_BIT_MAX_LOD);
+}
+
+GLfloat Texture::getMaxLod() const
+{
+ return mState.mSamplerState.getMaxLod();
+}
+
+void Texture::setCompareMode(const Context *context, GLenum compareMode)
+{
+ mState.mSamplerState.setCompareMode(compareMode);
+ signalDirtyState(DIRTY_BIT_COMPARE_MODE);
+}
+
+GLenum Texture::getCompareMode() const
+{
+ return mState.mSamplerState.getCompareMode();
+}
+
+void Texture::setCompareFunc(const Context *context, GLenum compareFunc)
+{
+ mState.mSamplerState.setCompareFunc(compareFunc);
+ signalDirtyState(DIRTY_BIT_COMPARE_FUNC);
+}
+
+GLenum Texture::getCompareFunc() const
+{
+ return mState.mSamplerState.getCompareFunc();
+}
+
+void Texture::setSRGBDecode(const Context *context, GLenum sRGBDecode)
+{
+ mState.mSamplerState.setSRGBDecode(sRGBDecode);
+ signalDirtyState(DIRTY_BIT_SRGB_DECODE);
+}
+
+GLenum Texture::getSRGBDecode() const
+{
+ return mState.mSamplerState.getSRGBDecode();
+}
+
+const SamplerState &Texture::getSamplerState() const
+{
+ return mState.mSamplerState;
+}
+
+angle::Result Texture::setBaseLevel(const Context *context, GLuint baseLevel)
+{
+ if (mState.setBaseLevel(baseLevel))
+ {
+ ANGLE_TRY(mTexture->setBaseLevel(context, mState.getEffectiveBaseLevel()));
+ signalDirtyState(DIRTY_BIT_BASE_LEVEL);
+ }
+
+ return angle::Result::Continue;
+}
+
+GLuint Texture::getBaseLevel() const
+{
+ return mState.mBaseLevel;
+}
+
+void Texture::setMaxLevel(const Context *context, GLuint maxLevel)
+{
+ if (mState.setMaxLevel(maxLevel))
+ {
+ signalDirtyState(DIRTY_BIT_MAX_LEVEL);
+ }
+}
+
+GLuint Texture::getMaxLevel() const
+{
+ return mState.mMaxLevel;
+}
+
+void Texture::setDepthStencilTextureMode(const Context *context, GLenum mode)
+{
+ if (mState.mDepthStencilTextureMode != mode)
+ {
+ mState.mDepthStencilTextureMode = mode;
+ signalDirtyState(DIRTY_BIT_DEPTH_STENCIL_TEXTURE_MODE);
+ }
+}
+
+GLenum Texture::getDepthStencilTextureMode() const
+{
+ return mState.mDepthStencilTextureMode;
+}
+
+bool Texture::getImmutableFormat() const
+{
+ return mState.mImmutableFormat;
+}
+
+GLuint Texture::getImmutableLevels() const
+{
+ return mState.mImmutableLevels;
+}
+
+void Texture::setUsage(const Context *context, GLenum usage)
+{
+ mState.mUsage = usage;
+ signalDirtyState(DIRTY_BIT_USAGE);
+}
+
+GLenum Texture::getUsage() const
+{
+ return mState.mUsage;
+}
+
+const TextureState &Texture::getTextureState() const
+{
+ return mState;
+}
+
+size_t Texture::getWidth(TextureTarget target, size_t level) const
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+ return mState.getImageDesc(target, level).size.width;
+}
+
+size_t Texture::getHeight(TextureTarget target, size_t level) const
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+ return mState.getImageDesc(target, level).size.height;
+}
+
+size_t Texture::getDepth(TextureTarget target, size_t level) const
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+ return mState.getImageDesc(target, level).size.depth;
+}
+
+const Format &Texture::getFormat(TextureTarget target, size_t level) const
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+ return mState.getImageDesc(target, level).format;
+}
+
+GLsizei Texture::getSamples(TextureTarget target, size_t level) const
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+ return mState.getImageDesc(target, level).samples;
+}
+
+bool Texture::getFixedSampleLocations(TextureTarget target, size_t level) const
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+ return mState.getImageDesc(target, level).fixedSampleLocations;
+}
+
+GLuint Texture::getMipmapMaxLevel() const
+{
+ return mState.getMipmapMaxLevel();
+}
+
+bool Texture::isMipmapComplete() const
+{
+ return mState.computeMipmapCompleteness();
+}
+
+egl::Surface *Texture::getBoundSurface() const
+{
+ return mBoundSurface;
+}
+
+egl::Stream *Texture::getBoundStream() const
+{
+ return mBoundStream;
+}
+
+GLint Texture::getMemorySize() const
+{
+ GLint implSize = mTexture->getMemorySize();
+ if (implSize > 0)
+ {
+ return implSize;
+ }
+
+ angle::CheckedNumeric<GLint> size = 0;
+ for (const ImageDesc &imageDesc : mState.mImageDescs)
+ {
+ size += imageDesc.getMemorySize();
+ }
+ return size.ValueOrDefault(std::numeric_limits<GLint>::max());
+}
+
+GLint Texture::getLevelMemorySize(TextureTarget target, GLint level) const
+{
+ GLint implSize = mTexture->getLevelMemorySize(target, level);
+ if (implSize > 0)
+ {
+ return implSize;
+ }
+
+ return mState.getImageDesc(target, level).getMemorySize();
+}
+
+void Texture::signalDirtyStorage(InitState initState)
+{
+ mState.mInitState = initState;
+ invalidateCompletenessCache();
+ mState.mCachedSamplerFormatValid = false;
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+}
+
+void Texture::signalDirtyState(size_t dirtyBit)
+{
+ mDirtyBits.set(dirtyBit);
+ invalidateCompletenessCache();
+ mState.mCachedSamplerFormatValid = false;
+ onStateChange(angle::SubjectMessage::DirtyBitsFlagged);
+}
+
+angle::Result Texture::setImage(Context *context,
+ const PixelUnpackState &unpackState,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ const Extents &size,
+ GLenum format,
+ GLenum type,
+ const uint8_t *pixels)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, size.depth);
+
+ ANGLE_TRY(mTexture->setImage(context, index, internalFormat, size, format, type, unpackState,
+ pixels));
+
+ InitState initState = DetermineInitState(context, pixels);
+ mState.setImageDesc(target, level, ImageDesc(size, Format(internalFormat, type), initState));
+
+ ANGLE_TRY(handleMipmapGenerationHint(context, level));
+
+ signalDirtyStorage(initState);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setSubImage(Context *context,
+ const PixelUnpackState &unpackState,
+ Buffer *unpackBuffer,
+ TextureTarget target,
+ GLint level,
+ const Box &area,
+ GLenum format,
+ GLenum type,
+ const uint8_t *pixels)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+
+ ANGLE_TRY(ensureSubImageInitialized(context, target, level, area));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, area.depth);
+
+ ANGLE_TRY(mTexture->setSubImage(context, index, area, format, type, unpackState, unpackBuffer,
+ pixels));
+
+ ANGLE_TRY(handleMipmapGenerationHint(context, level));
+
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setCompressedImage(Context *context,
+ const PixelUnpackState &unpackState,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ const Extents &size,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, size.depth);
+
+ ANGLE_TRY(mTexture->setCompressedImage(context, index, internalFormat, size, unpackState,
+ imageSize, pixels));
+
+ InitState initState = DetermineInitState(context, pixels);
+ mState.setImageDesc(target, level, ImageDesc(size, Format(internalFormat), initState));
+ signalDirtyStorage(initState);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setCompressedSubImage(const Context *context,
+ const PixelUnpackState &unpackState,
+ TextureTarget target,
+ GLint level,
+ const Box &area,
+ GLenum format,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+
+ ANGLE_TRY(ensureSubImageInitialized(context, target, level, area));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, area.depth);
+
+ ANGLE_TRY(mTexture->setCompressedSubImage(context, index, area, format, unpackState, imageSize,
+ pixels));
+
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::copyImage(Context *context,
+ TextureTarget target,
+ GLint level,
+ const Rectangle &sourceArea,
+ GLenum internalFormat,
+ Framebuffer *source)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ // Use the source FBO size as the init image area.
+ Box destBox(0, 0, 0, sourceArea.width, sourceArea.height, 1);
+ ANGLE_TRY(ensureSubImageInitialized(context, target, level, destBox));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, 1);
+
+ ANGLE_TRY(mTexture->copyImage(context, index, sourceArea, internalFormat, source));
+
+ const InternalFormat &internalFormatInfo =
+ GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE);
+
+ mState.setImageDesc(target, level,
+ ImageDesc(Extents(sourceArea.width, sourceArea.height, 1),
+ Format(internalFormatInfo), InitState::Initialized));
+
+ ANGLE_TRY(handleMipmapGenerationHint(context, level));
+
+ // We need to initialize this texture only if the source attachment is not initialized.
+ signalDirtyStorage(InitState::Initialized);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::copySubImage(Context *context,
+ const ImageIndex &index,
+ const Offset &destOffset,
+ const Rectangle &sourceArea,
+ Framebuffer *source)
+{
+ ASSERT(TextureTargetToType(index.getTarget()) == mState.mType);
+
+ Box destBox(destOffset.x, destOffset.y, destOffset.z, sourceArea.width, sourceArea.height, 1);
+ ANGLE_TRY(
+ ensureSubImageInitialized(context, index.getTarget(), index.getLevelIndex(), destBox));
+
+ ANGLE_TRY(mTexture->copySubImage(context, index, destOffset, sourceArea, source));
+ ANGLE_TRY(handleMipmapGenerationHint(context, index.getLevelIndex()));
+
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::copyTexture(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ GLenum type,
+ GLint sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ Texture *source)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+ ASSERT(source->getType() != TextureType::CubeMap);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ // Initialize source texture.
+ // Note: we don't have a way to notify which portions of the image changed currently.
+ ANGLE_TRY(source->ensureInitialized(context));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, ImageIndex::kEntireLevel);
+
+ ANGLE_TRY(mTexture->copyTexture(context, index, internalFormat, type, sourceLevel, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source));
+
+ const auto &sourceDesc =
+ source->mState.getImageDesc(NonCubeTextureTypeToTarget(source->getType()), 0);
+ const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat, type);
+ mState.setImageDesc(
+ target, level,
+ ImageDesc(sourceDesc.size, Format(internalFormatInfo), InitState::Initialized));
+
+ signalDirtyStorage(InitState::Initialized);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::copySubTexture(const Context *context,
+ TextureTarget target,
+ GLint level,
+ const Offset &destOffset,
+ GLint sourceLevel,
+ const Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ Texture *source)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+
+ // Ensure source is initialized.
+ ANGLE_TRY(source->ensureInitialized(context));
+
+ Box destBox(destOffset.x, destOffset.y, destOffset.z, sourceBox.width, sourceBox.height,
+ sourceBox.depth);
+ ANGLE_TRY(ensureSubImageInitialized(context, target, level, destBox));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, sourceBox.depth);
+
+ ANGLE_TRY(mTexture->copySubTexture(context, index, destOffset, sourceLevel, sourceBox,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha,
+ source));
+
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::copyCompressedTexture(Context *context, const Texture *source)
+{
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ANGLE_TRY(mTexture->copyCompressedTexture(context, source));
+
+ ASSERT(source->getType() != TextureType::CubeMap && getType() != TextureType::CubeMap);
+ const auto &sourceDesc =
+ source->mState.getImageDesc(NonCubeTextureTypeToTarget(source->getType()), 0);
+ mState.setImageDesc(NonCubeTextureTypeToTarget(getType()), 0, sourceDesc);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setStorage(Context *context,
+ TextureType type,
+ GLsizei levels,
+ GLenum internalFormat,
+ const Extents &size)
+{
+ ASSERT(type == mState.mType);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ANGLE_TRY(mTexture->setStorage(context, type, levels, internalFormat, size));
+
+ mState.mImmutableFormat = true;
+ mState.mImmutableLevels = static_cast<GLuint>(levels);
+ mState.clearImageDescs();
+ mState.setImageDescChain(0, static_cast<GLuint>(levels - 1), size, Format(internalFormat),
+ InitState::MayNeedInit);
+
+ // Changing the texture to immutable can trigger a change in the base and max levels:
+ // GLES 3.0.4 section 3.8.10 pg 158:
+ // "For immutable-format textures, levelbase is clamped to the range[0;levels],levelmax is then
+ // clamped to the range[levelbase;levels].
+ mDirtyBits.set(DIRTY_BIT_BASE_LEVEL);
+ mDirtyBits.set(DIRTY_BIT_MAX_LEVEL);
+
+ signalDirtyStorage(InitState::MayNeedInit);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setImageExternal(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ const Extents &size,
+ GLenum format,
+ GLenum type)
+{
+ ASSERT(TextureTargetToType(target) == mState.mType);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ImageIndex index = ImageIndex::MakeFromTarget(target, level, size.depth);
+
+ ANGLE_TRY(mTexture->setImageExternal(context, index, internalFormat, size, format, type));
+
+ InitState initState = InitState::Initialized;
+ mState.setImageDesc(target, level, ImageDesc(size, Format(internalFormat, type), initState));
+
+ ANGLE_TRY(handleMipmapGenerationHint(context, level));
+
+ signalDirtyStorage(initState);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setStorageMultisample(Context *context,
+ TextureType type,
+ GLsizei samples,
+ GLint internalFormat,
+ const Extents &size,
+ bool fixedSampleLocations)
+{
+ ASSERT(type == mState.mType);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ANGLE_TRY(mTexture->setStorageMultisample(context, type, samples, internalFormat, size,
+ fixedSampleLocations));
+
+ mState.mImmutableFormat = true;
+ mState.mImmutableLevels = static_cast<GLuint>(1);
+ mState.clearImageDescs();
+ mState.setImageDescChainMultisample(size, Format(internalFormat), samples, fixedSampleLocations,
+ InitState::MayNeedInit);
+
+ signalDirtyStorage(InitState::MayNeedInit);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setStorageExternalMemory(Context *context,
+ TextureType type,
+ GLsizei levels,
+ GLenum internalFormat,
+ const Extents &size,
+ MemoryObject *memoryObject,
+ GLuint64 offset)
+{
+ ASSERT(type == mState.mType);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ANGLE_TRY(mTexture->setStorageExternalMemory(context, type, levels, internalFormat, size,
+ memoryObject, offset));
+
+ mState.mImmutableFormat = true;
+ mState.mImmutableLevels = static_cast<GLuint>(levels);
+ mState.clearImageDescs();
+ mState.setImageDescChain(0, static_cast<GLuint>(levels - 1), size, Format(internalFormat),
+ InitState::MayNeedInit);
+
+ // Changing the texture to immutable can trigger a change in the base and max levels:
+ // GLES 3.0.4 section 3.8.10 pg 158:
+ // "For immutable-format textures, levelbase is clamped to the range[0;levels],levelmax is then
+ // clamped to the range[levelbase;levels].
+ mDirtyBits.set(DIRTY_BIT_BASE_LEVEL);
+ mDirtyBits.set(DIRTY_BIT_MAX_LEVEL);
+
+ signalDirtyStorage(InitState::Initialized);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::generateMipmap(Context *context)
+{
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+
+ // EGL_KHR_gl_image states that images are only orphaned when generating mipmaps if the texture
+ // is not mip complete.
+ if (!isMipmapComplete())
+ {
+ ANGLE_TRY(orphanImages(context));
+ }
+
+ const GLuint baseLevel = mState.getEffectiveBaseLevel();
+ const GLuint maxLevel = mState.getMipmapMaxLevel();
+
+ if (maxLevel <= baseLevel)
+ {
+ return angle::Result::Continue;
+ }
+
+ if (hasAnyDirtyBit())
+ {
+ ANGLE_TRY(syncState(context));
+ }
+
+ // Clear the base image(s) immediately if needed
+ if (context->isRobustResourceInitEnabled())
+ {
+ ImageIndexIterator it =
+ ImageIndexIterator::MakeGeneric(mState.mType, baseLevel, baseLevel + 1,
+ ImageIndex::kEntireLevel, ImageIndex::kEntireLevel);
+ while (it.hasNext())
+ {
+ const ImageIndex index = it.next();
+ const ImageDesc &desc = mState.getImageDesc(index.getTarget(), index.getLevelIndex());
+
+ if (desc.initState == InitState::MayNeedInit)
+ {
+ ANGLE_TRY(initializeContents(context, index));
+ }
+ }
+ }
+
+ ANGLE_TRY(mTexture->generateMipmap(context));
+
+ // Propagate the format and size of the bsae mip to the smaller ones. Cube maps are guaranteed
+ // to have faces of the same size and format so any faces can be picked.
+ const ImageDesc &baseImageInfo = mState.getImageDesc(mState.getBaseImageTarget(), baseLevel);
+ mState.setImageDescChain(baseLevel, maxLevel, baseImageInfo.size, baseImageInfo.format,
+ InitState::Initialized);
+
+ signalDirtyStorage(InitState::Initialized);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::bindTexImageFromSurface(Context *context, egl::Surface *surface)
+{
+ ASSERT(surface);
+
+ if (mBoundSurface)
+ {
+ ANGLE_TRY(releaseTexImageFromSurface(context));
+ }
+
+ ANGLE_TRY(mTexture->bindTexImage(context, surface));
+ mBoundSurface = surface;
+
+ // Set the image info to the size and format of the surface
+ ASSERT(mState.mType == TextureType::_2D || mState.mType == TextureType::Rectangle);
+ Extents size(surface->getWidth(), surface->getHeight(), 1);
+ ImageDesc desc(size, surface->getBindTexImageFormat(), InitState::Initialized);
+ mState.setImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0, desc);
+ signalDirtyStorage(InitState::Initialized);
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::releaseTexImageFromSurface(const Context *context)
+{
+ ASSERT(mBoundSurface);
+ mBoundSurface = nullptr;
+ ANGLE_TRY(mTexture->releaseTexImage(context));
+
+ // Erase the image info for level 0
+ ASSERT(mState.mType == TextureType::_2D || mState.mType == TextureType::Rectangle);
+ mState.clearImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0);
+ signalDirtyStorage(InitState::Initialized);
+ return angle::Result::Continue;
+}
+
+void Texture::bindStream(egl::Stream *stream)
+{
+ ASSERT(stream);
+
+ // It should not be possible to bind a texture already bound to another stream
+ ASSERT(mBoundStream == nullptr);
+
+ mBoundStream = stream;
+
+ ASSERT(mState.mType == TextureType::External);
+}
+
+void Texture::releaseStream()
+{
+ ASSERT(mBoundStream);
+ mBoundStream = nullptr;
+}
+
+angle::Result Texture::acquireImageFromStream(const Context *context,
+ const egl::Stream::GLTextureDescription &desc)
+{
+ ASSERT(mBoundStream != nullptr);
+ ANGLE_TRY(mTexture->setImageExternal(context, mState.mType, mBoundStream, desc));
+
+ Extents size(desc.width, desc.height, 1);
+ mState.setImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0,
+ ImageDesc(size, Format(desc.internalFormat), InitState::Initialized));
+ signalDirtyStorage(InitState::Initialized);
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::releaseImageFromStream(const Context *context)
+{
+ ASSERT(mBoundStream != nullptr);
+ ANGLE_TRY(mTexture->setImageExternal(context, mState.mType, nullptr,
+ egl::Stream::GLTextureDescription()));
+
+ // Set to incomplete
+ mState.clearImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0);
+ signalDirtyStorage(InitState::Initialized);
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::releaseTexImageInternal(Context *context)
+{
+ if (mBoundSurface)
+ {
+ // Notify the surface
+ egl::Error eglErr = mBoundSurface->releaseTexImageFromTexture(context);
+ // TODO(jmadill): Remove this once refactor is complete. http://anglebug.com/3041
+ if (eglErr.isError())
+ {
+ context->handleError(GL_INVALID_OPERATION, "Error releasing tex image from texture",
+ __FILE__, ANGLE_FUNCTION, __LINE__);
+ }
+
+ // Then, call the same method as from the surface
+ ANGLE_TRY(releaseTexImageFromSurface(context));
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::setEGLImageTarget(Context *context,
+ TextureType type,
+ egl::Image *imageTarget)
+{
+ ASSERT(type == mState.mType);
+ ASSERT(type == TextureType::_2D || type == TextureType::External);
+
+ // Release from previous calls to eglBindTexImage, to avoid calling the Impl after
+ ANGLE_TRY(releaseTexImageInternal(context));
+ ANGLE_TRY(orphanImages(context));
+
+ ANGLE_TRY(mTexture->setEGLImageTarget(context, type, imageTarget));
+
+ setTargetImage(context, imageTarget);
+
+ Extents size(static_cast<int>(imageTarget->getWidth()),
+ static_cast<int>(imageTarget->getHeight()), 1);
+
+ auto initState = imageTarget->sourceInitState();
+
+ mState.clearImageDescs();
+ mState.setImageDesc(NonCubeTextureTypeToTarget(type), 0,
+ ImageDesc(size, imageTarget->getFormat(), initState));
+ signalDirtyStorage(initState);
+
+ return angle::Result::Continue;
+}
+
+Extents Texture::getAttachmentSize(const ImageIndex &imageIndex) const
+{
+ // As an ImageIndex that represents an entire level of a cube map corresponds to 6 ImageDescs,
+ // we only allow querying ImageDesc on a complete cube map, and this ImageDesc is exactly the
+ // one that belongs to the first face of the cube map.
+ if (imageIndex.isEntireLevelCubeMap())
+ {
+ // A cube map texture is cube complete if the following conditions all hold true:
+ // - The levelbase arrays of each of the six texture images making up the cube map have
+ // identical, positive, and square dimensions.
+ if (!mState.isCubeComplete())
+ {
+ return Extents();
+ }
+ }
+
+ return mState.getImageDesc(imageIndex).size;
+}
+
+Format Texture::getAttachmentFormat(GLenum /*binding*/, const ImageIndex &imageIndex) const
+{
+ // As an ImageIndex that represents an entire level of a cube map corresponds to 6 ImageDescs,
+ // we only allow querying ImageDesc on a complete cube map, and this ImageDesc is exactly the
+ // one that belongs to the first face of the cube map.
+ if (imageIndex.isEntireLevelCubeMap())
+ {
+ // A cube map texture is cube complete if the following conditions all hold true:
+ // - The levelbase arrays were each specified with the same effective internal format.
+ if (!mState.isCubeComplete())
+ {
+ return Format::Invalid();
+ }
+ }
+ return mState.getImageDesc(imageIndex).format;
+}
+
+GLsizei Texture::getAttachmentSamples(const ImageIndex &imageIndex) const
+{
+ // We do not allow querying TextureTarget by an ImageIndex that represents an entire level of a
+ // cube map (See comments in function TextureTypeToTarget() in ImageIndex.cpp).
+ if (imageIndex.isEntireLevelCubeMap())
+ {
+ return 0;
+ }
+
+ return getSamples(imageIndex.getTarget(), imageIndex.getLevelIndex());
+}
+
+bool Texture::isRenderable(const Context *context,
+ GLenum binding,
+ const ImageIndex &imageIndex) const
+{
+ if (isEGLImageTarget())
+ {
+ return ImageSibling::isRenderable(context, binding, imageIndex);
+ }
+ return getAttachmentFormat(binding, imageIndex)
+ .info->textureAttachmentSupport(context->getClientVersion(), context->getExtensions());
+}
+
+bool Texture::getAttachmentFixedSampleLocations(const ImageIndex &imageIndex) const
+{
+ // We do not allow querying TextureTarget by an ImageIndex that represents an entire level of a
+ // cube map (See comments in function TextureTypeToTarget() in ImageIndex.cpp).
+ if (imageIndex.isEntireLevelCubeMap())
+ {
+ return true;
+ }
+
+ // ES3.1 (section 9.4) requires that the value of TEXTURE_FIXED_SAMPLE_LOCATIONS should be
+ // the same for all attached textures.
+ return getFixedSampleLocations(imageIndex.getTarget(), imageIndex.getLevelIndex());
+}
+
+void Texture::setBorderColor(const Context *context, const ColorGeneric &color)
+{
+ mState.mSamplerState.setBorderColor(color);
+ signalDirtyState(DIRTY_BIT_BORDER_COLOR);
+}
+
+const ColorGeneric &Texture::getBorderColor() const
+{
+ return mState.mSamplerState.getBorderColor();
+}
+
+void Texture::setCrop(const gl::Rectangle &rect)
+{
+ mState.setCrop(rect);
+}
+
+const gl::Rectangle &Texture::getCrop() const
+{
+ return mState.getCrop();
+}
+
+void Texture::setGenerateMipmapHint(GLenum hint)
+{
+ mState.setGenerateMipmapHint(hint);
+}
+
+GLenum Texture::getGenerateMipmapHint() const
+{
+ return mState.getGenerateMipmapHint();
+}
+
+void Texture::onAttach(const Context *context)
+{
+ addRef();
+}
+
+void Texture::onDetach(const Context *context)
+{
+ release(context);
+}
+
+GLuint Texture::getId() const
+{
+ return id();
+}
+
+GLuint Texture::getNativeID() const
+{
+ return mTexture->getNativeID();
+}
+
+angle::Result Texture::syncState(const Context *context)
+{
+ ASSERT(hasAnyDirtyBit());
+ ANGLE_TRY(mTexture->syncState(context, mDirtyBits));
+ mDirtyBits.reset();
+ return angle::Result::Continue;
+}
+
+rx::FramebufferAttachmentObjectImpl *Texture::getAttachmentImpl() const
+{
+ return mTexture;
+}
+
+bool Texture::isSamplerComplete(const Context *context, const Sampler *optionalSampler)
+{
+ const auto &samplerState =
+ optionalSampler ? optionalSampler->getSamplerState() : mState.mSamplerState;
+ const auto &contextState = context->getState();
+
+ if (contextState.getContextID() != mCompletenessCache.context ||
+ !mCompletenessCache.samplerState.sameCompleteness(samplerState))
+ {
+ mCompletenessCache.context = context->getState().getContextID();
+ mCompletenessCache.samplerState = samplerState;
+ mCompletenessCache.samplerComplete =
+ mState.computeSamplerCompleteness(samplerState, contextState);
+ }
+
+ return mCompletenessCache.samplerComplete;
+}
+
+Texture::SamplerCompletenessCache::SamplerCompletenessCache()
+ : context(0), samplerState(), samplerComplete(false)
+{}
+
+void Texture::invalidateCompletenessCache() const
+{
+ mCompletenessCache.context = 0;
+}
+
+angle::Result Texture::ensureInitialized(const Context *context)
+{
+ if (!context->isRobustResourceInitEnabled() || mState.mInitState == InitState::Initialized)
+ {
+ return angle::Result::Continue;
+ }
+
+ bool anyDirty = false;
+
+ ImageIndexIterator it =
+ ImageIndexIterator::MakeGeneric(mState.mType, 0, IMPLEMENTATION_MAX_TEXTURE_LEVELS + 1,
+ ImageIndex::kEntireLevel, ImageIndex::kEntireLevel);
+ while (it.hasNext())
+ {
+ const ImageIndex index = it.next();
+ ImageDesc &desc =
+ mState.mImageDescs[GetImageDescIndex(index.getTarget(), index.getLevelIndex())];
+ if (desc.initState == InitState::MayNeedInit)
+ {
+ ASSERT(mState.mInitState == InitState::MayNeedInit);
+ ANGLE_TRY(initializeContents(context, index));
+ desc.initState = InitState::Initialized;
+ anyDirty = true;
+ }
+ }
+ if (anyDirty)
+ {
+ signalDirtyStorage(InitState::Initialized);
+ }
+ mState.mInitState = InitState::Initialized;
+
+ return angle::Result::Continue;
+}
+
+InitState Texture::initState(const ImageIndex &imageIndex) const
+{
+ // As an ImageIndex that represents an entire level of a cube map corresponds to 6 ImageDescs,
+ // we need to check all the related ImageDescs.
+ if (imageIndex.isEntireLevelCubeMap())
+ {
+ const GLint levelIndex = imageIndex.getLevelIndex();
+ for (TextureTarget cubeFaceTarget : AllCubeFaceTextureTargets())
+ {
+ if (mState.getImageDesc(cubeFaceTarget, levelIndex).initState == InitState::MayNeedInit)
+ {
+ return InitState::MayNeedInit;
+ }
+ }
+ return InitState::Initialized;
+ }
+
+ return mState.getImageDesc(imageIndex).initState;
+}
+
+void Texture::setInitState(const ImageIndex &imageIndex, InitState initState)
+{
+ // As an ImageIndex that represents an entire level of a cube map corresponds to 6 ImageDescs,
+ // we need to update all the related ImageDescs.
+ if (imageIndex.isEntireLevelCubeMap())
+ {
+ const GLint levelIndex = imageIndex.getLevelIndex();
+ for (TextureTarget cubeFaceTarget : AllCubeFaceTextureTargets())
+ {
+ setInitState(ImageIndex::MakeCubeMapFace(cubeFaceTarget, levelIndex), initState);
+ }
+ }
+ else
+ {
+ ImageDesc newDesc = mState.getImageDesc(imageIndex);
+ newDesc.initState = initState;
+ mState.setImageDesc(imageIndex.getTarget(), imageIndex.getLevelIndex(), newDesc);
+ }
+}
+
+angle::Result Texture::ensureSubImageInitialized(const Context *context,
+ TextureTarget target,
+ size_t level,
+ const gl::Box &area)
+{
+ if (!context->isRobustResourceInitEnabled() || mState.mInitState == InitState::Initialized)
+ {
+ return angle::Result::Continue;
+ }
+
+ // Pre-initialize the texture contents if necessary.
+ // TODO(jmadill): Check if area overlaps the entire texture.
+ ImageIndex imageIndex =
+ ImageIndex::MakeFromTarget(target, static_cast<GLint>(level), area.depth);
+ const auto &desc = mState.getImageDesc(imageIndex);
+ if (desc.initState == InitState::MayNeedInit)
+ {
+ ASSERT(mState.mInitState == InitState::MayNeedInit);
+ bool coversWholeImage = area.x == 0 && area.y == 0 && area.z == 0 &&
+ area.width == desc.size.width && area.height == desc.size.height &&
+ area.depth == desc.size.depth;
+ if (!coversWholeImage)
+ {
+ ANGLE_TRY(initializeContents(context, imageIndex));
+ }
+ setInitState(imageIndex, InitState::Initialized);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Texture::handleMipmapGenerationHint(Context *context, int level)
+{
+
+ if (getGenerateMipmapHint() == GL_TRUE && level == 0)
+ {
+ ANGLE_TRY(generateMipmap(context));
+ }
+
+ return angle::Result::Continue;
+}
+
+void Texture::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message)
+{
+ ASSERT(message == angle::SubjectMessage::SubjectChanged);
+ mDirtyBits.set(DIRTY_BIT_IMPLEMENTATION);
+ signalDirtyState(DIRTY_BIT_IMPLEMENTATION);
+
+ // Notify siblings that we are dirty.
+ if (index == rx::kTextureImageImplObserverMessageIndex)
+ {
+ notifySiblings(message);
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Texture.h b/gfx/angle/checkout/src/libANGLE/Texture.h
new file mode 100644
index 0000000000..31067a625c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Texture.h
@@ -0,0 +1,559 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Texture.h: Defines the gl::Texture class [OpenGL ES 2.0.24] section 3.7 page 63.
+
+#ifndef LIBANGLE_TEXTURE_H_
+#define LIBANGLE_TEXTURE_H_
+
+#include <map>
+#include <vector>
+
+#include "angle_gl.h"
+#include "common/Optional.h"
+#include "common/debug.h"
+#include "common/utilities.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/Observer.h"
+#include "libANGLE/Stream.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+
+namespace egl
+{
+class Surface;
+class Stream;
+} // namespace egl
+
+namespace rx
+{
+class GLImplFactory;
+class TextureImpl;
+class TextureGL;
+} // namespace rx
+
+namespace gl
+{
+class Framebuffer;
+class MemoryObject;
+class Sampler;
+class State;
+class Texture;
+
+bool IsMipmapFiltered(const SamplerState &samplerState);
+
+struct ImageDesc final
+{
+ ImageDesc();
+ ImageDesc(const Extents &size, const Format &format, const InitState initState);
+ ImageDesc(const Extents &size,
+ const Format &format,
+ const GLsizei samples,
+ const bool fixedSampleLocations,
+ const InitState initState);
+
+ ImageDesc(const ImageDesc &other) = default;
+ ImageDesc &operator=(const ImageDesc &other) = default;
+
+ GLint getMemorySize() const;
+
+ Extents size;
+ Format format;
+ GLsizei samples;
+ bool fixedSampleLocations;
+
+ // Needed for robust resource initialization.
+ InitState initState;
+};
+
+struct SwizzleState final
+{
+ SwizzleState();
+ SwizzleState(GLenum red, GLenum green, GLenum blue, GLenum alpha);
+ SwizzleState(const SwizzleState &other) = default;
+ SwizzleState &operator=(const SwizzleState &other) = default;
+
+ bool swizzleRequired() const;
+
+ bool operator==(const SwizzleState &other) const;
+ bool operator!=(const SwizzleState &other) const;
+
+ GLenum swizzleRed;
+ GLenum swizzleGreen;
+ GLenum swizzleBlue;
+ GLenum swizzleAlpha;
+};
+
+// State from Table 6.9 (state per texture object) in the OpenGL ES 3.0.2 spec.
+class TextureState final : private angle::NonCopyable
+{
+ public:
+ TextureState(TextureType type);
+ ~TextureState();
+
+ bool swizzleRequired() const;
+ GLuint getEffectiveBaseLevel() const;
+ GLuint getEffectiveMaxLevel() const;
+
+ // Returns the value called "q" in the GLES 3.0.4 spec section 3.8.10.
+ GLuint getMipmapMaxLevel() const;
+
+ // Returns true if base level changed.
+ bool setBaseLevel(GLuint baseLevel);
+ bool setMaxLevel(GLuint maxLevel);
+
+ bool isCubeComplete() const;
+
+ ANGLE_INLINE bool compatibleWithSamplerFormat(SamplerFormat format,
+ const SamplerState &samplerState) const
+ {
+ if (!mCachedSamplerFormatValid ||
+ mCachedSamplerCompareMode != samplerState.getCompareMode())
+ {
+ mCachedSamplerFormat = computeRequiredSamplerFormat(samplerState);
+ mCachedSamplerCompareMode = samplerState.getCompareMode();
+ mCachedSamplerFormatValid = true;
+ }
+ // Incomplete textures are compatible with any sampler format.
+ return mCachedSamplerFormat == SamplerFormat::InvalidEnum || format == mCachedSamplerFormat;
+ }
+
+ const ImageDesc &getImageDesc(TextureTarget target, size_t level) const;
+ const ImageDesc &getImageDesc(const ImageIndex &imageIndex) const;
+
+ TextureType getType() const { return mType; }
+ const SwizzleState &getSwizzleState() const { return mSwizzleState; }
+ const SamplerState &getSamplerState() const { return mSamplerState; }
+ GLenum getUsage() const { return mUsage; }
+ GLenum getDepthStencilTextureMode() const { return mDepthStencilTextureMode; }
+
+ // Returns the desc of the base level. Only valid for cube-complete/mip-complete textures.
+ const ImageDesc &getBaseLevelDesc() const;
+
+ // GLES1 emulation: For GL_OES_draw_texture
+ void setCrop(const gl::Rectangle &rect);
+ const gl::Rectangle &getCrop() const;
+
+ // GLES1 emulation: Auto-mipmap generation is a texparameter
+ void setGenerateMipmapHint(GLenum hint);
+ GLenum getGenerateMipmapHint() const;
+
+ private:
+ // Texture needs access to the ImageDesc functions.
+ friend class Texture;
+ // TODO(jmadill): Remove TextureGL from friends.
+ friend class rx::TextureGL;
+ friend bool operator==(const TextureState &a, const TextureState &b);
+
+ bool computeSamplerCompleteness(const SamplerState &samplerState, const State &data) const;
+ bool computeMipmapCompleteness() const;
+ bool computeLevelCompleteness(TextureTarget target, size_t level) const;
+ SamplerFormat computeRequiredSamplerFormat(const SamplerState &samplerState) const;
+
+ TextureTarget getBaseImageTarget() const;
+
+ void setImageDesc(TextureTarget target, size_t level, const ImageDesc &desc);
+ void setImageDescChain(GLuint baselevel,
+ GLuint maxLevel,
+ Extents baseSize,
+ const Format &format,
+ InitState initState);
+ void setImageDescChainMultisample(Extents baseSize,
+ const Format &format,
+ GLsizei samples,
+ bool fixedSampleLocations,
+ InitState initState);
+
+ void clearImageDesc(TextureTarget target, size_t level);
+ void clearImageDescs();
+
+ const TextureType mType;
+
+ SwizzleState mSwizzleState;
+
+ SamplerState mSamplerState;
+
+ GLuint mBaseLevel;
+ GLuint mMaxLevel;
+
+ GLenum mDepthStencilTextureMode;
+
+ bool mImmutableFormat;
+ GLuint mImmutableLevels;
+
+ // From GL_ANGLE_texture_usage
+ GLenum mUsage;
+
+ std::vector<ImageDesc> mImageDescs;
+
+ // GLES1 emulation: Texture crop rectangle
+ // For GL_OES_draw_texture
+ gl::Rectangle mCropRect;
+
+ // GLES1 emulation: Generate-mipmap hint per texture
+ GLenum mGenerateMipmapHint;
+
+ InitState mInitState;
+
+ mutable SamplerFormat mCachedSamplerFormat;
+ mutable GLenum mCachedSamplerCompareMode;
+ mutable bool mCachedSamplerFormatValid;
+};
+
+bool operator==(const TextureState &a, const TextureState &b);
+bool operator!=(const TextureState &a, const TextureState &b);
+
+class Texture final : public RefCountObject, public egl::ImageSibling, public LabeledObject
+{
+ public:
+ Texture(rx::GLImplFactory *factory, GLuint id, TextureType type);
+ ~Texture() override;
+
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ TextureType getType() const { return mState.mType; }
+
+ void setSwizzleRed(const Context *context, GLenum swizzleRed);
+ GLenum getSwizzleRed() const;
+
+ void setSwizzleGreen(const Context *context, GLenum swizzleGreen);
+ GLenum getSwizzleGreen() const;
+
+ void setSwizzleBlue(const Context *context, GLenum swizzleBlue);
+ GLenum getSwizzleBlue() const;
+
+ void setSwizzleAlpha(const Context *context, GLenum swizzleAlpha);
+ GLenum getSwizzleAlpha() const;
+
+ void setMinFilter(const Context *context, GLenum minFilter);
+ GLenum getMinFilter() const;
+
+ void setMagFilter(const Context *context, GLenum magFilter);
+ GLenum getMagFilter() const;
+
+ void setWrapS(const Context *context, GLenum wrapS);
+ GLenum getWrapS() const;
+
+ void setWrapT(const Context *context, GLenum wrapT);
+ GLenum getWrapT() const;
+
+ void setWrapR(const Context *context, GLenum wrapR);
+ GLenum getWrapR() const;
+
+ void setMaxAnisotropy(const Context *context, float maxAnisotropy);
+ float getMaxAnisotropy() const;
+
+ void setMinLod(const Context *context, GLfloat minLod);
+ GLfloat getMinLod() const;
+
+ void setMaxLod(const Context *context, GLfloat maxLod);
+ GLfloat getMaxLod() const;
+
+ void setCompareMode(const Context *context, GLenum compareMode);
+ GLenum getCompareMode() const;
+
+ void setCompareFunc(const Context *context, GLenum compareFunc);
+ GLenum getCompareFunc() const;
+
+ void setSRGBDecode(const Context *context, GLenum sRGBDecode);
+ GLenum getSRGBDecode() const;
+
+ const SamplerState &getSamplerState() const;
+
+ angle::Result setBaseLevel(const Context *context, GLuint baseLevel);
+ GLuint getBaseLevel() const;
+
+ void setMaxLevel(const Context *context, GLuint maxLevel);
+ GLuint getMaxLevel() const;
+
+ void setDepthStencilTextureMode(const Context *context, GLenum mode);
+ GLenum getDepthStencilTextureMode() const;
+
+ bool getImmutableFormat() const;
+
+ GLuint getImmutableLevels() const;
+
+ void setUsage(const Context *context, GLenum usage);
+ GLenum getUsage() const;
+
+ void setBorderColor(const Context *context, const ColorGeneric &color);
+ const ColorGeneric &getBorderColor() const;
+
+ const TextureState &getTextureState() const;
+
+ size_t getWidth(TextureTarget target, size_t level) const;
+ size_t getHeight(TextureTarget target, size_t level) const;
+ size_t getDepth(TextureTarget target, size_t level) const;
+ GLsizei getSamples(TextureTarget target, size_t level) const;
+ bool getFixedSampleLocations(TextureTarget target, size_t level) const;
+ const Format &getFormat(TextureTarget target, size_t level) const;
+
+ // Returns the value called "q" in the GLES 3.0.4 spec section 3.8.10.
+ GLuint getMipmapMaxLevel() const;
+
+ bool isMipmapComplete() const;
+
+ angle::Result setImage(Context *context,
+ const PixelUnpackState &unpackState,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ const Extents &size,
+ GLenum format,
+ GLenum type,
+ const uint8_t *pixels);
+ angle::Result setSubImage(Context *context,
+ const PixelUnpackState &unpackState,
+ Buffer *unpackBuffer,
+ TextureTarget target,
+ GLint level,
+ const Box &area,
+ GLenum format,
+ GLenum type,
+ const uint8_t *pixels);
+
+ angle::Result setCompressedImage(Context *context,
+ const PixelUnpackState &unpackState,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ const Extents &size,
+ size_t imageSize,
+ const uint8_t *pixels);
+ angle::Result setCompressedSubImage(const Context *context,
+ const PixelUnpackState &unpackState,
+ TextureTarget target,
+ GLint level,
+ const Box &area,
+ GLenum format,
+ size_t imageSize,
+ const uint8_t *pixels);
+
+ angle::Result copyImage(Context *context,
+ TextureTarget target,
+ GLint level,
+ const Rectangle &sourceArea,
+ GLenum internalFormat,
+ Framebuffer *source);
+ angle::Result copySubImage(Context *context,
+ const ImageIndex &index,
+ const Offset &destOffset,
+ const Rectangle &sourceArea,
+ Framebuffer *source);
+
+ angle::Result copyTexture(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ GLenum type,
+ GLint sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ Texture *source);
+ angle::Result copySubTexture(const Context *context,
+ TextureTarget target,
+ GLint level,
+ const Offset &destOffset,
+ GLint sourceLevel,
+ const Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ Texture *source);
+ angle::Result copyCompressedTexture(Context *context, const Texture *source);
+
+ angle::Result setStorage(Context *context,
+ TextureType type,
+ GLsizei levels,
+ GLenum internalFormat,
+ const Extents &size);
+
+ angle::Result setStorageMultisample(Context *context,
+ TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const Extents &size,
+ bool fixedSampleLocations);
+
+ angle::Result setStorageExternalMemory(Context *context,
+ TextureType type,
+ GLsizei levels,
+ GLenum internalFormat,
+ const Extents &size,
+ MemoryObject *memoryObject,
+ GLuint64 offset);
+
+ angle::Result setImageExternal(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalFormat,
+ const Extents &size,
+ GLenum format,
+ GLenum type);
+
+ angle::Result setEGLImageTarget(Context *context, TextureType type, egl::Image *imageTarget);
+
+ angle::Result generateMipmap(Context *context);
+
+ egl::Surface *getBoundSurface() const;
+ egl::Stream *getBoundStream() const;
+
+ GLint getMemorySize() const;
+ GLint getLevelMemorySize(TextureTarget target, GLint level) const;
+
+ void signalDirtyStorage(InitState initState);
+
+ bool isSamplerComplete(const Context *context, const Sampler *optionalSampler);
+
+ rx::TextureImpl *getImplementation() const { return mTexture; }
+
+ // FramebufferAttachmentObject implementation
+ Extents getAttachmentSize(const ImageIndex &imageIndex) const override;
+ Format getAttachmentFormat(GLenum binding, const ImageIndex &imageIndex) const override;
+ GLsizei getAttachmentSamples(const ImageIndex &imageIndex) const override;
+ bool isRenderable(const Context *context,
+ GLenum binding,
+ const ImageIndex &imageIndex) const override;
+
+ bool getAttachmentFixedSampleLocations(const ImageIndex &imageIndex) const;
+
+ // GLES1 emulation
+ void setCrop(const gl::Rectangle &rect);
+ const gl::Rectangle &getCrop() const;
+ void setGenerateMipmapHint(GLenum generate);
+ GLenum getGenerateMipmapHint() const;
+
+ void onAttach(const Context *context) override;
+ void onDetach(const Context *context) override;
+ GLuint getId() const override;
+ GLuint getNativeID() const;
+
+ // Needed for robust resource init.
+ angle::Result ensureInitialized(const Context *context);
+ InitState initState(const ImageIndex &imageIndex) const override;
+ InitState initState() const { return mState.mInitState; }
+ void setInitState(const ImageIndex &imageIndex, InitState initState) override;
+
+ enum DirtyBitType
+ {
+ // Sampler state
+ DIRTY_BIT_MIN_FILTER,
+ DIRTY_BIT_MAG_FILTER,
+ DIRTY_BIT_WRAP_S,
+ DIRTY_BIT_WRAP_T,
+ DIRTY_BIT_WRAP_R,
+ DIRTY_BIT_MAX_ANISOTROPY,
+ DIRTY_BIT_MIN_LOD,
+ DIRTY_BIT_MAX_LOD,
+ DIRTY_BIT_COMPARE_MODE,
+ DIRTY_BIT_COMPARE_FUNC,
+ DIRTY_BIT_SRGB_DECODE,
+ DIRTY_BIT_BORDER_COLOR,
+
+ // Texture state
+ DIRTY_BIT_SWIZZLE_RED,
+ DIRTY_BIT_SWIZZLE_GREEN,
+ DIRTY_BIT_SWIZZLE_BLUE,
+ DIRTY_BIT_SWIZZLE_ALPHA,
+ DIRTY_BIT_BASE_LEVEL,
+ DIRTY_BIT_MAX_LEVEL,
+ DIRTY_BIT_DEPTH_STENCIL_TEXTURE_MODE,
+
+ // Misc
+ DIRTY_BIT_LABEL,
+ DIRTY_BIT_USAGE,
+ DIRTY_BIT_IMPLEMENTATION,
+
+ DIRTY_BIT_COUNT,
+ };
+ using DirtyBits = angle::BitSet<DIRTY_BIT_COUNT>;
+
+ angle::Result syncState(const Context *context);
+ bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
+
+ // ObserverInterface implementation.
+ void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
+
+ private:
+ rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override;
+
+ // ANGLE-only method, used internally
+ friend class egl::Surface;
+ angle::Result bindTexImageFromSurface(Context *context, egl::Surface *surface);
+ angle::Result releaseTexImageFromSurface(const Context *context);
+
+ // ANGLE-only methods, used internally
+ friend class egl::Stream;
+ void bindStream(egl::Stream *stream);
+ void releaseStream();
+ angle::Result acquireImageFromStream(const Context *context,
+ const egl::Stream::GLTextureDescription &desc);
+ angle::Result releaseImageFromStream(const Context *context);
+
+ void invalidateCompletenessCache() const;
+ angle::Result releaseTexImageInternal(Context *context);
+
+ angle::Result ensureSubImageInitialized(const Context *context,
+ TextureTarget target,
+ size_t level,
+ const gl::Box &area);
+
+ angle::Result handleMipmapGenerationHint(Context *context, int level);
+
+ void signalDirtyState(size_t dirtyBit);
+
+ TextureState mState;
+ DirtyBits mDirtyBits;
+ rx::TextureImpl *mTexture;
+ angle::ObserverBinding mImplObserver;
+
+ std::string mLabel;
+
+ egl::Surface *mBoundSurface;
+ egl::Stream *mBoundStream;
+
+ struct SamplerCompletenessCache
+ {
+ SamplerCompletenessCache();
+
+ // Context used to generate this cache entry
+ ContextID context;
+
+ // All values that affect sampler completeness that are not stored within
+ // the texture itself
+ SamplerState samplerState;
+
+ // Result of the sampler completeness with the above parameters
+ bool samplerComplete;
+ };
+
+ mutable SamplerCompletenessCache mCompletenessCache;
+};
+
+inline bool operator==(const TextureState &a, const TextureState &b)
+{
+ return a.mSwizzleState == b.mSwizzleState && a.mSamplerState == b.mSamplerState &&
+ a.mBaseLevel == b.mBaseLevel && a.mMaxLevel == b.mMaxLevel &&
+ a.mImmutableFormat == b.mImmutableFormat && a.mImmutableLevels == b.mImmutableLevels &&
+ a.mUsage == b.mUsage;
+}
+
+inline bool operator!=(const TextureState &a, const TextureState &b)
+{
+ return !(a == b);
+}
+} // namespace gl
+
+#endif // LIBANGLE_TEXTURE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Thread.cpp b/gfx/angle/checkout/src/libANGLE/Thread.cpp
new file mode 100644
index 0000000000..d9789faf54
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Thread.cpp
@@ -0,0 +1,120 @@
+//
+// Copyright(c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Thread.cpp : Defines the Thread class which represents a global EGL thread.
+
+#include "libANGLE/Thread.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/ErrorStrings.h"
+
+namespace egl
+{
+
+Thread::Thread()
+ : mLabel(nullptr),
+ mError(EGL_SUCCESS),
+ mAPI(EGL_OPENGL_ES_API),
+ mContext(static_cast<gl::Context *>(EGL_NO_CONTEXT))
+{}
+
+void Thread::setLabel(EGLLabelKHR label)
+{
+ mLabel = label;
+}
+
+EGLLabelKHR Thread::getLabel() const
+{
+ return mLabel;
+}
+
+void Thread::setSuccess()
+{
+ mError = EGL_SUCCESS;
+}
+
+void Thread::setError(const Error &error,
+ const Debug *debug,
+ const char *command,
+ const LabeledObject *object)
+{
+ ASSERT(debug != nullptr);
+
+ mError = error.getCode();
+ if (error.isError() && !error.getMessage().empty())
+ {
+ debug->insertMessage(error.getCode(), command, ErrorCodeToMessageType(error.getCode()),
+ getLabel(), object ? object->getLabel() : nullptr, error.getMessage());
+ }
+}
+
+EGLint Thread::getError() const
+{
+ return mError;
+}
+
+void Thread::setAPI(EGLenum api)
+{
+ mAPI = api;
+}
+
+EGLenum Thread::getAPI() const
+{
+ return mAPI;
+}
+
+void Thread::setCurrent(gl::Context *context)
+{
+ mContext = context;
+}
+
+Surface *Thread::getCurrentDrawSurface() const
+{
+ if (mContext)
+ {
+ return mContext->getCurrentDrawSurface();
+ }
+ return nullptr;
+}
+
+Surface *Thread::getCurrentReadSurface() const
+{
+ if (mContext)
+ {
+ return mContext->getCurrentReadSurface();
+ }
+ return nullptr;
+}
+
+gl::Context *Thread::getContext() const
+{
+ return mContext;
+}
+
+gl::Context *Thread::getValidContext() const
+{
+ if (mContext && mContext->isContextLost())
+ {
+ mContext->handleError(GL_OUT_OF_MEMORY, gl::err::kContextLost, __FILE__, ANGLE_FUNCTION,
+ __LINE__);
+ return nullptr;
+ }
+
+ return mContext;
+}
+
+Display *Thread::getDisplay() const
+{
+ if (mContext)
+ {
+ return mContext->getDisplay();
+ }
+ return nullptr;
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/Thread.h b/gfx/angle/checkout/src/libANGLE/Thread.h
new file mode 100644
index 0000000000..5fbc8c4f4d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Thread.h
@@ -0,0 +1,62 @@
+//
+// Copyright(c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Thread.h : Defines the Thread class which represents a global EGL thread.
+
+#ifndef LIBANGLE_THREAD_H_
+#define LIBANGLE_THREAD_H_
+
+#include <EGL/egl.h>
+
+#include "libANGLE/Debug.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace egl
+{
+class Error;
+class Debug;
+class Display;
+class Surface;
+
+class Thread : public LabeledObject
+{
+ public:
+ Thread();
+
+ void setLabel(EGLLabelKHR label) override;
+ EGLLabelKHR getLabel() const override;
+
+ void setSuccess();
+ void setError(const Error &error,
+ const Debug *debug,
+ const char *command,
+ const LabeledObject *object);
+ EGLint getError() const;
+
+ void setAPI(EGLenum api);
+ EGLenum getAPI() const;
+
+ void setCurrent(gl::Context *context);
+ Surface *getCurrentDrawSurface() const;
+ Surface *getCurrentReadSurface() const;
+ gl::Context *getContext() const;
+ gl::Context *getValidContext() const;
+ Display *getDisplay() const;
+
+ private:
+ EGLLabelKHR mLabel;
+ EGLint mError;
+ EGLenum mAPI;
+ gl::Context *mContext;
+};
+
+} // namespace egl
+
+#endif // LIBANGLE_THREAD_H_
diff --git a/gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp b/gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp
new file mode 100644
index 0000000000..3222f14b8f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp
@@ -0,0 +1,322 @@
+//
+// 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 "libANGLE/TransformFeedback.h"
+
+#include "common/mathutil.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/State.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/TransformFeedbackImpl.h"
+
+#include <limits>
+
+namespace gl
+{
+
+angle::CheckedNumeric<GLsizeiptr> GetVerticesNeededForDraw(PrimitiveMode primitiveMode,
+ GLsizei count,
+ GLsizei primcount)
+{
+ if (count < 0 || primcount < 0)
+ {
+ return 0;
+ }
+ // Transform feedback only outputs complete primitives, so we need to round down to the nearest
+ // complete primitive before multiplying by the number of instances.
+ angle::CheckedNumeric<GLsizeiptr> checkedCount = count;
+ angle::CheckedNumeric<GLsizeiptr> checkedPrimcount = primcount;
+ switch (primitiveMode)
+ {
+ case PrimitiveMode::Triangles:
+ return checkedPrimcount * (checkedCount - checkedCount % 3);
+ case PrimitiveMode::Lines:
+ return checkedPrimcount * (checkedCount - checkedCount % 2);
+ case PrimitiveMode::Points:
+ return checkedPrimcount * checkedCount;
+ default:
+ UNREACHABLE();
+ return checkedPrimcount * checkedCount;
+ }
+}
+
+TransformFeedbackState::TransformFeedbackState(size_t maxIndexedBuffers)
+ : mLabel(),
+ mActive(false),
+ mPrimitiveMode(PrimitiveMode::InvalidEnum),
+ mPaused(false),
+ mVerticesDrawn(0),
+ mVertexCapacity(0),
+ mProgram(nullptr),
+ mIndexedBuffers(maxIndexedBuffers)
+{}
+
+TransformFeedbackState::~TransformFeedbackState() {}
+
+const OffsetBindingPointer<Buffer> &TransformFeedbackState::getIndexedBuffer(size_t idx) const
+{
+ return mIndexedBuffers[idx];
+}
+
+const std::vector<OffsetBindingPointer<Buffer>> &TransformFeedbackState::getIndexedBuffers() const
+{
+ return mIndexedBuffers;
+}
+
+GLsizeiptr TransformFeedbackState::getPrimitivesDrawn() const
+{
+ switch (mPrimitiveMode)
+ {
+ case gl::PrimitiveMode::Points:
+ return mVerticesDrawn;
+ case gl::PrimitiveMode::Lines:
+ return mVerticesDrawn / 2;
+ case gl::PrimitiveMode::Triangles:
+ return mVerticesDrawn / 3;
+ default:
+ return 0;
+ }
+}
+
+TransformFeedback::TransformFeedback(rx::GLImplFactory *implFactory, GLuint id, const Caps &caps)
+ : RefCountObject(id),
+ mState(caps.maxTransformFeedbackSeparateAttributes),
+ mImplementation(implFactory->createTransformFeedback(mState))
+{
+ ASSERT(mImplementation != nullptr);
+}
+
+void TransformFeedback::onDestroy(const Context *context)
+{
+ ASSERT(!context || !context->isCurrentTransformFeedback(this));
+ if (mState.mProgram)
+ {
+ mState.mProgram->release(context);
+ mState.mProgram = nullptr;
+ }
+
+ ASSERT(!mState.mProgram);
+ for (size_t i = 0; i < mState.mIndexedBuffers.size(); i++)
+ {
+ mState.mIndexedBuffers[i].set(context, nullptr, 0, 0);
+ }
+}
+
+TransformFeedback::~TransformFeedback()
+{
+ SafeDelete(mImplementation);
+}
+
+void TransformFeedback::setLabel(const Context *context, const std::string &label)
+{
+ mState.mLabel = label;
+}
+
+const std::string &TransformFeedback::getLabel() const
+{
+ return mState.mLabel;
+}
+
+angle::Result TransformFeedback::begin(const Context *context,
+ PrimitiveMode primitiveMode,
+ Program *program)
+{
+ ANGLE_TRY(mImplementation->begin(context, primitiveMode));
+ mState.mActive = true;
+ mState.mPrimitiveMode = primitiveMode;
+ mState.mPaused = false;
+ mState.mVerticesDrawn = 0;
+ bindProgram(context, program);
+
+ if (program)
+ {
+ // Compute the number of vertices we can draw before overflowing the bound buffers.
+ auto strides = program->getTransformFeedbackStrides();
+ ASSERT(strides.size() <= mState.mIndexedBuffers.size() && !strides.empty());
+ GLsizeiptr minCapacity = std::numeric_limits<GLsizeiptr>::max();
+ for (size_t index = 0; index < strides.size(); index++)
+ {
+ GLsizeiptr capacity =
+ GetBoundBufferAvailableSize(mState.mIndexedBuffers[index]) / strides[index];
+ minCapacity = std::min(minCapacity, capacity);
+ }
+ mState.mVertexCapacity = minCapacity;
+ }
+ else
+ {
+ mState.mVertexCapacity = 0;
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback::end(const Context *context)
+{
+ ANGLE_TRY(mImplementation->end(context));
+ mState.mActive = false;
+ mState.mPrimitiveMode = PrimitiveMode::InvalidEnum;
+ mState.mPaused = false;
+ mState.mVerticesDrawn = 0;
+ mState.mVertexCapacity = 0;
+ if (mState.mProgram)
+ {
+ mState.mProgram->release(context);
+ mState.mProgram = nullptr;
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback::pause(const Context *context)
+{
+ ANGLE_TRY(mImplementation->pause(context));
+ mState.mPaused = true;
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback::resume(const Context *context)
+{
+ ANGLE_TRY(mImplementation->resume(context));
+ mState.mPaused = false;
+ return angle::Result::Continue;
+}
+
+bool TransformFeedback::isPaused() const
+{
+ return mState.mPaused;
+}
+
+PrimitiveMode TransformFeedback::getPrimitiveMode() const
+{
+ return mState.mPrimitiveMode;
+}
+
+bool TransformFeedback::checkBufferSpaceForDraw(GLsizei count, GLsizei primcount) const
+{
+ auto vertices =
+ mState.mVerticesDrawn + GetVerticesNeededForDraw(mState.mPrimitiveMode, count, primcount);
+ return vertices.IsValid() && vertices.ValueOrDie() <= mState.mVertexCapacity;
+}
+
+void TransformFeedback::onVerticesDrawn(const Context *context, GLsizei count, GLsizei primcount)
+{
+ ASSERT(mState.mActive && !mState.mPaused);
+ // All draws should be validated with checkBufferSpaceForDraw so ValueOrDie should never fail.
+ mState.mVerticesDrawn =
+ (mState.mVerticesDrawn + GetVerticesNeededForDraw(mState.mPrimitiveMode, count, primcount))
+ .ValueOrDie();
+
+ for (auto &buffer : mState.mIndexedBuffers)
+ {
+ if (buffer.get() != nullptr)
+ {
+ buffer->onTransformFeedback();
+ }
+ }
+}
+
+void TransformFeedback::bindProgram(const Context *context, Program *program)
+{
+ if (mState.mProgram != program)
+ {
+ if (mState.mProgram != nullptr)
+ {
+ mState.mProgram->release(context);
+ }
+ mState.mProgram = program;
+ if (mState.mProgram != nullptr)
+ {
+ mState.mProgram->addRef();
+ }
+ }
+}
+
+bool TransformFeedback::hasBoundProgram(GLuint program) const
+{
+ return mState.mProgram != nullptr && mState.mProgram->id() == program;
+}
+
+angle::Result TransformFeedback::detachBuffer(const Context *context, GLuint bufferName)
+{
+ bool isBound = context->isCurrentTransformFeedback(this);
+ for (size_t index = 0; index < mState.mIndexedBuffers.size(); index++)
+ {
+ if (mState.mIndexedBuffers[index].id() == bufferName)
+ {
+ if (isBound)
+ {
+ mState.mIndexedBuffers[index]->onTFBindingChanged(context, false, true);
+ }
+ mState.mIndexedBuffers[index].set(context, nullptr, 0, 0);
+ ANGLE_TRY(
+ mImplementation->bindIndexedBuffer(context, index, mState.mIndexedBuffers[index]));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback::bindIndexedBuffer(const Context *context,
+ size_t index,
+ Buffer *buffer,
+ size_t offset,
+ size_t size)
+{
+ ASSERT(index < mState.mIndexedBuffers.size());
+ bool isBound = context && context->isCurrentTransformFeedback(this);
+ if (isBound && mState.mIndexedBuffers[index].get())
+ {
+ mState.mIndexedBuffers[index]->onTFBindingChanged(context, false, true);
+ }
+ mState.mIndexedBuffers[index].set(context, buffer, offset, size);
+ if (isBound && buffer)
+ {
+ buffer->onTFBindingChanged(context, true, true);
+ }
+
+ return mImplementation->bindIndexedBuffer(context, index, mState.mIndexedBuffers[index]);
+}
+
+const OffsetBindingPointer<Buffer> &TransformFeedback::getIndexedBuffer(size_t index) const
+{
+ ASSERT(index < mState.mIndexedBuffers.size());
+ return mState.mIndexedBuffers[index];
+}
+
+size_t TransformFeedback::getIndexedBufferCount() const
+{
+ return mState.mIndexedBuffers.size();
+}
+
+bool TransformFeedback::buffersBoundForOtherUse() const
+{
+ for (auto &buffer : mState.mIndexedBuffers)
+ {
+ if (buffer.get() && buffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+rx::TransformFeedbackImpl *TransformFeedback::getImplementation() const
+{
+ return mImplementation;
+}
+
+void TransformFeedback::onBindingChanged(const Context *context, bool bound)
+{
+ for (auto &buffer : mState.mIndexedBuffers)
+ {
+ if (buffer.get())
+ {
+ buffer->onTFBindingChanged(context, bound, true);
+ }
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/TransformFeedback.h b/gfx/angle/checkout/src/libANGLE/TransformFeedback.h
new file mode 100644
index 0000000000..a3eddf348c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/TransformFeedback.h
@@ -0,0 +1,119 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBANGLE_TRANSFORM_FEEDBACK_H_
+#define LIBANGLE_TRANSFORM_FEEDBACK_H_
+
+#include "libANGLE/RefCountObject.h"
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Debug.h"
+
+#include "angle_gl.h"
+
+namespace rx
+{
+class GLImplFactory;
+class TransformFeedbackImpl;
+class TransformFeedbackGL;
+} // namespace rx
+
+namespace gl
+{
+class Buffer;
+struct Caps;
+class Context;
+class Program;
+
+class TransformFeedbackState final : angle::NonCopyable
+{
+ public:
+ TransformFeedbackState(size_t maxIndexedBuffers);
+ ~TransformFeedbackState();
+
+ const OffsetBindingPointer<Buffer> &getIndexedBuffer(size_t idx) const;
+ const std::vector<OffsetBindingPointer<Buffer>> &getIndexedBuffers() const;
+ const Program *getBoundProgram() const { return mProgram; }
+ GLsizeiptr getVerticesDrawn() const { return mVerticesDrawn; }
+ GLsizeiptr getPrimitivesDrawn() const;
+
+ private:
+ friend class TransformFeedback;
+
+ std::string mLabel;
+
+ bool mActive;
+ PrimitiveMode mPrimitiveMode;
+ bool mPaused;
+ GLsizeiptr mVerticesDrawn;
+ GLsizeiptr mVertexCapacity;
+
+ Program *mProgram;
+
+ std::vector<OffsetBindingPointer<Buffer>> mIndexedBuffers;
+};
+
+class TransformFeedback final : public RefCountObject, public LabeledObject
+{
+ public:
+ TransformFeedback(rx::GLImplFactory *implFactory, GLuint id, const Caps &caps);
+ ~TransformFeedback() override;
+ void onDestroy(const Context *context) override;
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ angle::Result begin(const Context *context, PrimitiveMode primitiveMode, Program *program);
+ angle::Result end(const Context *context);
+ angle::Result pause(const Context *context);
+ angle::Result resume(const Context *context);
+
+ bool isActive() const { return mState.mActive; }
+
+ bool isPaused() const;
+ PrimitiveMode getPrimitiveMode() const;
+ // Validates that the vertices produced by a draw call will fit in the bound transform feedback
+ // buffers.
+ bool checkBufferSpaceForDraw(GLsizei count, GLsizei primcount) const;
+ // This must be called after each draw call when transform feedback is enabled to keep track of
+ // how many vertices have been written to the buffers. This information is needed by
+ // checkBufferSpaceForDraw because each draw call appends vertices to the buffers starting just
+ // after the last vertex of the previous draw call.
+ void onVerticesDrawn(const Context *context, GLsizei count, GLsizei primcount);
+
+ bool hasBoundProgram(GLuint program) const;
+
+ angle::Result bindIndexedBuffer(const Context *context,
+ size_t index,
+ Buffer *buffer,
+ size_t offset,
+ size_t size);
+ const OffsetBindingPointer<Buffer> &getIndexedBuffer(size_t index) const;
+ size_t getIndexedBufferCount() const;
+
+ GLsizeiptr getVerticesDrawn() const { return mState.getVerticesDrawn(); }
+ GLsizeiptr getPrimitivesDrawn() const { return mState.getPrimitivesDrawn(); }
+
+ // Returns true if any buffer bound to this object is also bound to another target.
+ bool buffersBoundForOtherUse() const;
+
+ angle::Result detachBuffer(const Context *context, GLuint bufferName);
+
+ rx::TransformFeedbackImpl *getImplementation() const;
+
+ void onBindingChanged(const Context *context, bool bound);
+
+ private:
+ void bindProgram(const Context *context, Program *program);
+
+ TransformFeedbackState mState;
+ rx::TransformFeedbackImpl *mImplementation;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_TRANSFORM_FEEDBACK_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Uniform.cpp b/gfx/angle/checkout/src/libANGLE/Uniform.cpp
new file mode 100644
index 0000000000..34cc487c62
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Uniform.cpp
@@ -0,0 +1,201 @@
+//
+// Copyright (c) 2010-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "libANGLE/Uniform.h"
+
+#include "common/utilities.h"
+
+#include <cstring>
+
+namespace gl
+{
+
+ActiveVariable::ActiveVariable() {}
+
+ActiveVariable::~ActiveVariable() {}
+
+ActiveVariable::ActiveVariable(const ActiveVariable &rhs) = default;
+ActiveVariable &ActiveVariable::operator=(const ActiveVariable &rhs) = default;
+
+void ActiveVariable::setActive(ShaderType shaderType, bool used)
+{
+ ASSERT(shaderType != ShaderType::InvalidEnum);
+ mActiveUseBits.set(shaderType, used);
+}
+
+void ActiveVariable::unionReferencesWith(const ActiveVariable &other)
+{
+ mActiveUseBits |= other.mActiveUseBits;
+}
+
+ShaderType ActiveVariable::getFirstShaderTypeWhereActive() const
+{
+ return static_cast<ShaderType>(ScanForward(mActiveUseBits.bits()));
+}
+
+GLuint ActiveVariable::activeShaderCount() const
+{
+ return static_cast<GLuint>(mActiveUseBits.count());
+}
+
+LinkedUniform::LinkedUniform()
+ : typeInfo(nullptr), bufferIndex(-1), blockInfo(sh::kDefaultBlockMemberInfo)
+{}
+
+LinkedUniform::LinkedUniform(GLenum typeIn,
+ GLenum precisionIn,
+ const std::string &nameIn,
+ const std::vector<unsigned int> &arraySizesIn,
+ const int bindingIn,
+ const int offsetIn,
+ const int locationIn,
+ const int bufferIndexIn,
+ const sh::BlockMemberInfo &blockInfoIn)
+ : typeInfo(&GetUniformTypeInfo(typeIn)), bufferIndex(bufferIndexIn), blockInfo(blockInfoIn)
+{
+ type = typeIn;
+ precision = precisionIn;
+ name = nameIn;
+ arraySizes = arraySizesIn;
+ binding = bindingIn;
+ offset = offsetIn;
+ location = locationIn;
+ ASSERT(!isArrayOfArrays());
+ ASSERT(!isArray() || !isStruct());
+}
+
+LinkedUniform::LinkedUniform(const sh::Uniform &uniform)
+ : sh::Uniform(uniform),
+ typeInfo(&GetUniformTypeInfo(type)),
+ bufferIndex(-1),
+ blockInfo(sh::kDefaultBlockMemberInfo)
+{
+ ASSERT(!isArrayOfArrays());
+ ASSERT(!isArray() || !isStruct());
+}
+
+LinkedUniform::LinkedUniform(const LinkedUniform &uniform)
+ : sh::Uniform(uniform),
+ ActiveVariable(uniform),
+ typeInfo(uniform.typeInfo),
+ bufferIndex(uniform.bufferIndex),
+ blockInfo(uniform.blockInfo)
+{}
+
+LinkedUniform &LinkedUniform::operator=(const LinkedUniform &uniform)
+{
+ sh::Uniform::operator =(uniform);
+ ActiveVariable::operator=(uniform);
+ typeInfo = uniform.typeInfo;
+ bufferIndex = uniform.bufferIndex;
+ blockInfo = uniform.blockInfo;
+ return *this;
+}
+
+LinkedUniform::~LinkedUniform() {}
+
+bool LinkedUniform::isInDefaultBlock() const
+{
+ return bufferIndex == -1;
+}
+
+bool LinkedUniform::isSampler() const
+{
+ return typeInfo->isSampler;
+}
+
+bool LinkedUniform::isImage() const
+{
+ return typeInfo->isImageType;
+}
+
+bool LinkedUniform::isAtomicCounter() const
+{
+ return IsAtomicCounterType(type);
+}
+
+bool LinkedUniform::isField() const
+{
+ return name.find('.') != std::string::npos;
+}
+
+size_t LinkedUniform::getElementSize() const
+{
+ return typeInfo->externalSize;
+}
+
+size_t LinkedUniform::getElementComponents() const
+{
+ return typeInfo->componentCount;
+}
+
+BufferVariable::BufferVariable()
+ : bufferIndex(-1), blockInfo(sh::kDefaultBlockMemberInfo), topLevelArraySize(-1)
+{}
+
+BufferVariable::BufferVariable(GLenum typeIn,
+ GLenum precisionIn,
+ const std::string &nameIn,
+ const std::vector<unsigned int> &arraySizesIn,
+ const int bufferIndexIn,
+ const sh::BlockMemberInfo &blockInfoIn)
+ : bufferIndex(bufferIndexIn), blockInfo(blockInfoIn), topLevelArraySize(-1)
+{
+ type = typeIn;
+ precision = precisionIn;
+ name = nameIn;
+ arraySizes = arraySizesIn;
+}
+
+BufferVariable::~BufferVariable() {}
+
+ShaderVariableBuffer::ShaderVariableBuffer() : binding(0), dataSize(0) {}
+
+ShaderVariableBuffer::ShaderVariableBuffer(const ShaderVariableBuffer &other) = default;
+
+ShaderVariableBuffer::~ShaderVariableBuffer() {}
+
+int ShaderVariableBuffer::numActiveVariables() const
+{
+ return static_cast<int>(memberIndexes.size());
+}
+
+InterfaceBlock::InterfaceBlock() : isArray(false), arrayElement(0) {}
+
+InterfaceBlock::InterfaceBlock(const std::string &nameIn,
+ const std::string &mappedNameIn,
+ bool isArrayIn,
+ unsigned int arrayElementIn,
+ int bindingIn)
+ : name(nameIn), mappedName(mappedNameIn), isArray(isArrayIn), arrayElement(arrayElementIn)
+{
+ binding = bindingIn;
+}
+
+std::string InterfaceBlock::nameWithArrayIndex() const
+{
+ std::stringstream fullNameStr;
+ fullNameStr << name;
+ if (isArray)
+ {
+ fullNameStr << "[" << arrayElement << "]";
+ }
+
+ return fullNameStr.str();
+}
+
+std::string InterfaceBlock::mappedNameWithArrayIndex() const
+{
+ std::stringstream fullNameStr;
+ fullNameStr << mappedName;
+ if (isArray)
+ {
+ fullNameStr << "[" << arrayElement << "]";
+ }
+
+ return fullNameStr.str();
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/Uniform.h b/gfx/angle/checkout/src/libANGLE/Uniform.h
new file mode 100644
index 0000000000..91ba17cd5e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Uniform.h
@@ -0,0 +1,133 @@
+//
+// Copyright (c) 2010-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBANGLE_UNIFORM_H_
+#define LIBANGLE_UNIFORM_H_
+
+#include <string>
+#include <vector>
+
+#include "angle_gl.h"
+#include "common/MemoryBuffer.h"
+#include "common/debug.h"
+#include "compiler/translator/blocklayout.h"
+#include "libANGLE/angletypes.h"
+
+namespace gl
+{
+struct UniformTypeInfo;
+
+struct ActiveVariable
+{
+ ActiveVariable();
+ ActiveVariable(const ActiveVariable &rhs);
+ virtual ~ActiveVariable();
+
+ ActiveVariable &operator=(const ActiveVariable &rhs);
+
+ ShaderType getFirstShaderTypeWhereActive() const;
+ void setActive(ShaderType shaderType, bool used);
+ void unionReferencesWith(const ActiveVariable &other);
+ bool isActive(ShaderType shaderType) const
+ {
+ ASSERT(shaderType != ShaderType::InvalidEnum);
+ return mActiveUseBits[shaderType];
+ }
+ ShaderBitSet activeShaders() const { return mActiveUseBits; }
+ GLuint activeShaderCount() const;
+
+ private:
+ ShaderBitSet mActiveUseBits;
+};
+
+// Helper struct representing a single shader uniform
+struct LinkedUniform : public sh::Uniform, public ActiveVariable
+{
+ LinkedUniform();
+ LinkedUniform(GLenum type,
+ GLenum precision,
+ const std::string &name,
+ const std::vector<unsigned int> &arraySizes,
+ const int binding,
+ const int offset,
+ const int location,
+ const int bufferIndex,
+ const sh::BlockMemberInfo &blockInfo);
+ LinkedUniform(const sh::Uniform &uniform);
+ LinkedUniform(const LinkedUniform &uniform);
+ LinkedUniform &operator=(const LinkedUniform &uniform);
+ ~LinkedUniform() override;
+
+ bool isSampler() const;
+ bool isImage() const;
+ bool isAtomicCounter() const;
+ bool isInDefaultBlock() const;
+ bool isField() const;
+ size_t getElementSize() const;
+ size_t getElementComponents() const;
+
+ const UniformTypeInfo *typeInfo;
+
+ // Identifies the containing buffer backed resource -- interface block or atomic counter buffer.
+ int bufferIndex;
+ sh::BlockMemberInfo blockInfo;
+};
+
+struct BufferVariable : public sh::ShaderVariable, public ActiveVariable
+{
+ BufferVariable();
+ BufferVariable(GLenum type,
+ GLenum precision,
+ const std::string &name,
+ const std::vector<unsigned int> &arraySizes,
+ const int bufferIndex,
+ const sh::BlockMemberInfo &blockInfo);
+ ~BufferVariable() override;
+
+ int bufferIndex;
+ sh::BlockMemberInfo blockInfo;
+
+ int topLevelArraySize;
+};
+
+// Parent struct for atomic counter, uniform block, and shader storage block buffer, which all
+// contain a group of shader variables, and have a GL buffer backed.
+struct ShaderVariableBuffer : public ActiveVariable
+{
+ ShaderVariableBuffer();
+ ShaderVariableBuffer(const ShaderVariableBuffer &other);
+ ~ShaderVariableBuffer() override;
+ int numActiveVariables() const;
+
+ int binding;
+ unsigned int dataSize;
+ std::vector<unsigned int> memberIndexes;
+};
+
+using AtomicCounterBuffer = ShaderVariableBuffer;
+
+// Helper struct representing a single shader interface block
+struct InterfaceBlock : public ShaderVariableBuffer
+{
+ InterfaceBlock();
+ InterfaceBlock(const std::string &nameIn,
+ const std::string &mappedNameIn,
+ bool isArrayIn,
+ unsigned int arrayElementIn,
+ int bindingIn);
+
+ std::string nameWithArrayIndex() const;
+ std::string mappedNameWithArrayIndex() const;
+
+ std::string name;
+ std::string mappedName;
+ bool isArray;
+ unsigned int arrayElement;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_UNIFORM_H_
diff --git a/gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp b/gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp
new file mode 100644
index 0000000000..ad6b3d16be
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp
@@ -0,0 +1,434 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// VaryingPacking:
+// Class which describes a mapping from varyings to registers, according
+// to the spec, or using custom packing algorithms. We also keep a register
+// allocation list for the D3D renderer.
+//
+
+#include "libANGLE/VaryingPacking.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/Shader.h"
+
+namespace gl
+{
+
+namespace
+{
+
+// true if varying x has a higher priority in packing than y
+bool ComparePackedVarying(const PackedVarying &x, const PackedVarying &y)
+{
+ // If the PackedVarying 'x' or 'y' to be compared is an array element, this clones an equivalent
+ // non-array shader variable 'vx' or 'vy' for actual comparison instead.
+ sh::ShaderVariable vx, vy;
+ const sh::ShaderVariable *px, *py;
+ if (x.isArrayElement())
+ {
+ vx = *x.varying;
+ vx.arraySizes.clear();
+ px = &vx;
+ }
+ else
+ {
+ px = x.varying;
+ }
+
+ if (y.isArrayElement())
+ {
+ vy = *y.varying;
+ vy.arraySizes.clear();
+ py = &vy;
+ }
+ else
+ {
+ py = y.varying;
+ }
+
+ return gl::CompareShaderVar(*px, *py);
+}
+
+} // anonymous namespace
+
+// Implementation of VaryingPacking
+VaryingPacking::VaryingPacking(GLuint maxVaryingVectors, PackMode packMode)
+ : mRegisterMap(maxVaryingVectors), mPackMode(packMode)
+{}
+
+VaryingPacking::~VaryingPacking() = default;
+
+// Packs varyings into generic varying registers, using the algorithm from
+// See [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
+// Also [OpenGL ES Shading Language 3.00 rev. 4] Section 11 page 119
+// Returns false if unsuccessful.
+bool VaryingPacking::packVarying(const PackedVarying &packedVarying)
+{
+ const sh::ShaderVariable &varying = *packedVarying.varying;
+
+ // "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."
+ // Here we are a bit more conservative and allow packing non-square matrices more tightly.
+ // Make sure we use transposed matrix types to count registers correctly.
+ ASSERT(!varying.isStruct());
+ GLenum transposedType = gl::TransposeMatrixType(varying.type);
+ unsigned int varyingRows = gl::VariableRowCount(transposedType);
+ unsigned int varyingColumns = gl::VariableColumnCount(transposedType);
+
+ // Special pack mode for D3D9. Each varying takes a full register, no sharing.
+ // TODO(jmadill): Implement more sophisticated component packing in D3D9.
+ if (mPackMode == PackMode::ANGLE_NON_CONFORMANT_D3D9)
+ {
+ varyingColumns = 4;
+ }
+
+ // "Variables of type mat2 occupies 2 complete rows."
+ // For non-WebGL contexts, we allow mat2 to occupy only two columns per row.
+ else if (mPackMode == PackMode::WEBGL_STRICT && varying.type == GL_FLOAT_MAT2)
+ {
+ varyingColumns = 4;
+ }
+
+ // "Arrays of size N are assumed to take N times the size of the base type"
+ // GLSL ES 3.10 section 4.3.6: Output variables cannot be arrays of arrays or arrays of
+ // structures, so we may use getBasicTypeElementCount().
+ const unsigned int elementCount = varying.getBasicTypeElementCount();
+ varyingRows *= (packedVarying.isArrayElement() ? 1 : elementCount);
+
+ unsigned int maxVaryingVectors = static_cast<unsigned int>(mRegisterMap.size());
+
+ // Fail if we are packing a single over-large varying.
+ if (varyingRows > maxVaryingVectors)
+ {
+ return false;
+ }
+
+ // "For 2, 3 and 4 component variables packing is started using the 1st column of the 1st row.
+ // Variables are then allocated to successive rows, aligning them to the 1st column."
+ if (varyingColumns >= 2 && varyingColumns <= 4)
+ {
+ for (unsigned int row = 0; row <= maxVaryingVectors - varyingRows; ++row)
+ {
+ if (isFree(row, 0, varyingRows, varyingColumns))
+ {
+ insert(row, 0, packedVarying);
+ return true;
+ }
+ }
+
+ // "For 2 component variables, when there are no spare rows, the strategy is switched to
+ // using the highest numbered row and the lowest numbered column where the variable will
+ // fit."
+ if (varyingColumns == 2)
+ {
+ for (unsigned int r = maxVaryingVectors - varyingRows + 1; r-- >= 1;)
+ {
+ if (isFree(r, 2, varyingRows, 2))
+ {
+ insert(r, 2, packedVarying);
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ // "1 component variables have their own packing rule. They are packed in order of size, largest
+ // first. Each variable is placed in the column that leaves the least amount of space in the
+ // column and aligned to the lowest available rows within that column."
+ ASSERT(varyingColumns == 1);
+ unsigned int contiguousSpace[4] = {0};
+ unsigned int bestContiguousSpace[4] = {0};
+ unsigned int totalSpace[4] = {0};
+
+ for (unsigned int row = 0; row < maxVaryingVectors; ++row)
+ {
+ for (unsigned int column = 0; column < 4; ++column)
+ {
+ if (mRegisterMap[row][column])
+ {
+ contiguousSpace[column] = 0;
+ }
+ else
+ {
+ contiguousSpace[column]++;
+ totalSpace[column]++;
+
+ if (contiguousSpace[column] > bestContiguousSpace[column])
+ {
+ bestContiguousSpace[column] = contiguousSpace[column];
+ }
+ }
+ }
+ }
+
+ unsigned int bestColumn = 0;
+ for (unsigned int column = 1; column < 4; ++column)
+ {
+ if (bestContiguousSpace[column] >= varyingRows &&
+ (bestContiguousSpace[bestColumn] < varyingRows ||
+ totalSpace[column] < totalSpace[bestColumn]))
+ {
+ bestColumn = column;
+ }
+ }
+
+ if (bestContiguousSpace[bestColumn] >= varyingRows)
+ {
+ for (unsigned int row = 0; row < maxVaryingVectors; row++)
+ {
+ if (isFree(row, bestColumn, varyingRows, 1))
+ {
+ for (unsigned int arrayIndex = 0; arrayIndex < varyingRows; ++arrayIndex)
+ {
+ // If varyingRows > 1, it must be an array.
+ PackedVaryingRegister registerInfo;
+ registerInfo.packedVarying = &packedVarying;
+ registerInfo.registerRow = row + arrayIndex;
+ registerInfo.registerColumn = bestColumn;
+ registerInfo.varyingArrayIndex =
+ (packedVarying.isArrayElement() ? packedVarying.arrayIndex : arrayIndex);
+ registerInfo.varyingRowIndex = 0;
+ // Do not record register info for builtins.
+ // TODO(jmadill): Clean this up.
+ if (!packedVarying.varying->isBuiltIn())
+ {
+ mRegisterList.push_back(registerInfo);
+ }
+ mRegisterMap[row + arrayIndex][bestColumn] = true;
+ }
+ break;
+ }
+ }
+ return true;
+ }
+
+ return false;
+}
+
+bool VaryingPacking::isFree(unsigned int registerRow,
+ unsigned int registerColumn,
+ unsigned int varyingRows,
+ unsigned int varyingColumns) const
+{
+ for (unsigned int row = 0; row < varyingRows; ++row)
+ {
+ ASSERT(registerRow + row < mRegisterMap.size());
+ for (unsigned int column = 0; column < varyingColumns; ++column)
+ {
+ ASSERT(registerColumn + column < 4);
+ if (mRegisterMap[registerRow + row][registerColumn + column])
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+void VaryingPacking::insert(unsigned int registerRow,
+ unsigned int registerColumn,
+ const PackedVarying &packedVarying)
+{
+ unsigned int varyingRows = 0;
+ unsigned int varyingColumns = 0;
+
+ const auto &varying = *packedVarying.varying;
+ ASSERT(!varying.isStruct());
+ GLenum transposedType = gl::TransposeMatrixType(varying.type);
+ varyingRows = gl::VariableRowCount(transposedType);
+ varyingColumns = gl::VariableColumnCount(transposedType);
+
+ PackedVaryingRegister registerInfo;
+ registerInfo.packedVarying = &packedVarying;
+ registerInfo.registerColumn = registerColumn;
+
+ // GLSL ES 3.10 section 4.3.6: Output variables cannot be arrays of arrays or arrays of
+ // structures, so we may use getBasicTypeElementCount().
+ const unsigned int arrayElementCount = varying.getBasicTypeElementCount();
+ for (unsigned int arrayElement = 0; arrayElement < arrayElementCount; ++arrayElement)
+ {
+ if (packedVarying.isArrayElement() && arrayElement != packedVarying.arrayIndex)
+ {
+ continue;
+ }
+ for (unsigned int varyingRow = 0; varyingRow < varyingRows; ++varyingRow)
+ {
+ registerInfo.registerRow = registerRow + (arrayElement * varyingRows) + varyingRow;
+ registerInfo.varyingRowIndex = varyingRow;
+ registerInfo.varyingArrayIndex = arrayElement;
+ // Do not record register info for builtins.
+ // TODO(jmadill): Clean this up.
+ if (!packedVarying.varying->isBuiltIn())
+ {
+ mRegisterList.push_back(registerInfo);
+ }
+
+ for (unsigned int columnIndex = 0; columnIndex < varyingColumns; ++columnIndex)
+ {
+ mRegisterMap[registerInfo.registerRow][registerColumn + columnIndex] = true;
+ }
+ }
+ }
+}
+
+bool VaryingPacking::collectAndPackUserVaryings(gl::InfoLog &infoLog,
+ const ProgramMergedVaryings &mergedVaryings,
+ const std::vector<std::string> &tfVaryings)
+{
+ std::set<std::string> uniqueFullNames;
+ mPackedVaryings.clear();
+
+ for (const auto &ref : mergedVaryings)
+ {
+ const sh::Varying *input = ref.second.vertex;
+ const sh::Varying *output = ref.second.fragment;
+
+ // Only pack statically used varyings that have a matched input or output, plus special
+ // builtins. Note that we pack all statically used user-defined varyings even if they are
+ // not active. GLES specs are a bit vague on whether it's allowed to only pack active
+ // varyings, though GLES 3.1 spec section 11.1.2.1 says that "device-dependent
+ // optimizations" may be used to make vertex shader outputs fit.
+ if ((input && output && output->staticUse) ||
+ (input && input->isBuiltIn() && input->active) ||
+ (output && output->isBuiltIn() && output->active))
+ {
+ const sh::Varying *varying = output ? output : input;
+
+ // Don't count gl_Position. Also don't count gl_PointSize for D3D9.
+ if (varying->name != "gl_Position" &&
+ !(varying->name == "gl_PointSize" &&
+ mPackMode == PackMode::ANGLE_NON_CONFORMANT_D3D9))
+ {
+ // Will get the vertex shader interpolation by default.
+ auto interpolation = ref.second.get()->interpolation;
+
+ // Note that we lose the vertex shader static use information here. The data for the
+ // variable is taken from the fragment shader.
+ if (varying->isStruct())
+ {
+ ASSERT(!varying->isArray());
+ for (GLuint fieldIndex = 0; fieldIndex < varying->fields.size(); ++fieldIndex)
+ {
+ const sh::ShaderVariable &field = varying->fields[fieldIndex];
+
+ ASSERT(!field.isStruct() && !field.isArray());
+ mPackedVaryings.emplace_back(field, interpolation, varying->name,
+ fieldIndex);
+ uniqueFullNames.insert(mPackedVaryings.back().fullName());
+ }
+ }
+ else
+ {
+ mPackedVaryings.emplace_back(*varying, interpolation);
+ uniqueFullNames.insert(mPackedVaryings.back().fullName());
+ }
+ continue;
+ }
+ }
+
+ // If the varying is not used in the VS, we know it is inactive.
+ if (!input)
+ {
+ mInactiveVaryingNames.push_back(ref.first);
+ continue;
+ }
+
+ // Keep Transform FB varyings in the merged list always.
+ for (const std::string &tfVarying : tfVaryings)
+ {
+ std::vector<unsigned int> subscripts;
+ std::string baseName = ParseResourceName(tfVarying, &subscripts);
+ size_t subscript = GL_INVALID_INDEX;
+ if (!subscripts.empty())
+ {
+ subscript = subscripts.back();
+ }
+ // Already packed for fragment shader.
+ if (uniqueFullNames.count(tfVarying) > 0 || uniqueFullNames.count(baseName) > 0)
+ {
+ continue;
+ }
+ if (input->isStruct())
+ {
+ GLuint fieldIndex = 0;
+ const sh::ShaderVariable *field =
+ FindShaderVarField(*input, tfVarying, &fieldIndex);
+ if (field != nullptr)
+ {
+ ASSERT(!field->isStruct() && !field->isArray());
+ mPackedVaryings.emplace_back(*field, input->interpolation, input->name,
+ fieldIndex);
+ mPackedVaryings.back().vertexOnly = true;
+ mPackedVaryings.back().arrayIndex = GL_INVALID_INDEX;
+ uniqueFullNames.insert(tfVarying);
+ }
+ }
+ // Array as a whole and array element conflict has already been checked in
+ // linkValidateTransformFeedback.
+ else if (baseName == input->name)
+ {
+ // only pack varyings that are not builtins.
+ if (tfVarying.compare(0, 3, "gl_") != 0)
+ {
+ mPackedVaryings.emplace_back(*input, input->interpolation);
+ mPackedVaryings.back().vertexOnly = true;
+ mPackedVaryings.back().arrayIndex = static_cast<GLuint>(subscript);
+ uniqueFullNames.insert(tfVarying);
+ }
+ // Continue to match next array element for 'input' if the current match is array
+ // element.
+ if (subscript == GL_INVALID_INDEX)
+ {
+ break;
+ }
+ }
+ }
+
+ if (uniqueFullNames.count(ref.first) == 0)
+ {
+ mInactiveVaryingNames.push_back(ref.first);
+ }
+ }
+
+ std::sort(mPackedVaryings.begin(), mPackedVaryings.end(), ComparePackedVarying);
+
+ return packUserVaryings(infoLog, mPackedVaryings);
+}
+
+// See comment on packVarying.
+bool VaryingPacking::packUserVaryings(gl::InfoLog &infoLog,
+ const std::vector<PackedVarying> &packedVaryings)
+{
+
+ // "Variables are packed into the registers one at a time so that they each occupy a contiguous
+ // subrectangle. No splitting of variables is permitted."
+ for (const PackedVarying &packedVarying : packedVaryings)
+ {
+ if (!packVarying(packedVarying))
+ {
+ infoLog << "Could not pack varying " << packedVarying.fullName();
+
+ // TODO(jmadill): Implement more sophisticated component packing in D3D9.
+ if (mPackMode == PackMode::ANGLE_NON_CONFORMANT_D3D9)
+ {
+ infoLog << "Note: Additional non-conformant packing restrictions are enforced on "
+ "D3D9.";
+ }
+
+ return false;
+ }
+ }
+
+ // Sort the packed register list
+ std::sort(mRegisterList.begin(), mRegisterList.end());
+
+ return true;
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/VaryingPacking.h b/gfx/angle/checkout/src/libANGLE/VaryingPacking.h
new file mode 100644
index 0000000000..0e2720899b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/VaryingPacking.h
@@ -0,0 +1,205 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// VaryingPacking:
+// Class which describes a mapping from varyings to registers, according
+// to the spec, or using custom packing algorithms. We also keep a register
+// allocation list for the D3D renderer.
+//
+
+#ifndef LIBANGLE_VARYINGPACKING_H_
+#define LIBANGLE_VARYINGPACKING_H_
+
+#include <GLSLANG/ShaderVars.h>
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+
+#include <map>
+
+namespace gl
+{
+class InfoLog;
+struct ProgramVaryingRef;
+
+using ProgramMergedVaryings = std::map<std::string, ProgramVaryingRef>;
+
+struct PackedVarying
+{
+ PackedVarying(const sh::ShaderVariable &varyingIn, sh::InterpolationType interpolationIn)
+ : PackedVarying(varyingIn, interpolationIn, "", false)
+ {}
+ PackedVarying(const sh::ShaderVariable &varyingIn,
+ sh::InterpolationType interpolationIn,
+ const std::string &parentStructNameIn,
+ GLuint fieldIndexIn)
+ : varying(&varyingIn),
+ vertexOnly(false),
+ interpolation(interpolationIn),
+ parentStructName(parentStructNameIn),
+ arrayIndex(GL_INVALID_INDEX),
+ fieldIndex(fieldIndexIn)
+ {}
+
+ bool isStructField() const { return !parentStructName.empty(); }
+
+ bool isArrayElement() const { return arrayIndex != GL_INVALID_INDEX; }
+
+ std::string fullName() const
+ {
+ std::stringstream fullNameStr;
+ if (isStructField())
+ {
+ fullNameStr << parentStructName << ".";
+ }
+
+ fullNameStr << varying->name;
+ if (arrayIndex != GL_INVALID_INDEX)
+ {
+ fullNameStr << "[" << arrayIndex << "]";
+ }
+ return fullNameStr.str();
+ }
+
+ const sh::ShaderVariable *varying;
+
+ // Transform feedback varyings can be only referenced in the VS.
+ bool vertexOnly;
+
+ // Cached so we can store sh::ShaderVariable to point to varying fields.
+ sh::InterpolationType interpolation;
+
+ // Struct name
+ std::string parentStructName;
+
+ GLuint arrayIndex;
+
+ // Field index in the struct. In Vulkan, this is used to assign a
+ // struct-typed varying location to the location of its first field.
+ GLuint fieldIndex;
+};
+
+struct PackedVaryingRegister final
+{
+ PackedVaryingRegister()
+ : packedVarying(nullptr),
+ varyingArrayIndex(0),
+ varyingRowIndex(0),
+ registerRow(0),
+ registerColumn(0)
+ {}
+
+ PackedVaryingRegister(const PackedVaryingRegister &) = default;
+ PackedVaryingRegister &operator=(const PackedVaryingRegister &) = default;
+
+ bool operator<(const PackedVaryingRegister &other) const
+ {
+ return sortOrder() < other.sortOrder();
+ }
+
+ unsigned int sortOrder() const
+ {
+ // TODO(jmadill): Handle interpolation types
+ return registerRow * 4 + registerColumn;
+ }
+
+ std::string tfVaryingName() const
+ {
+ if (packedVarying->isArrayElement() || packedVarying->isStructField())
+ {
+ return packedVarying->fullName();
+ }
+ else
+ {
+ return packedVarying->varying->name;
+ }
+ }
+
+ // Index to the array of varyings.
+ const PackedVarying *packedVarying;
+
+ // The array element of the packed varying.
+ unsigned int varyingArrayIndex;
+
+ // The row of the array element of the packed varying.
+ unsigned int varyingRowIndex;
+
+ // The register row to which we've assigned this packed varying.
+ unsigned int registerRow;
+
+ // The column of the register row into which we've packed this varying.
+ unsigned int registerColumn;
+};
+
+// Supported packing modes:
+enum class PackMode
+{
+ // We treat mat2 arrays as taking two full rows.
+ WEBGL_STRICT,
+
+ // We allow mat2 to take a 2x2 chunk.
+ ANGLE_RELAXED,
+
+ // Each varying takes a separate register. No register sharing.
+ ANGLE_NON_CONFORMANT_D3D9,
+};
+
+class VaryingPacking final : angle::NonCopyable
+{
+ public:
+ VaryingPacking(GLuint maxVaryingVectors, PackMode packMode);
+ ~VaryingPacking();
+
+ bool packUserVaryings(gl::InfoLog &infoLog, const std::vector<PackedVarying> &packedVaryings);
+
+ bool collectAndPackUserVaryings(gl::InfoLog &infoLog,
+ const ProgramMergedVaryings &mergedVaryings,
+ const std::vector<std::string> &tfVaryings);
+
+ struct Register
+ {
+ Register() { data[0] = data[1] = data[2] = data[3] = false; }
+
+ bool &operator[](unsigned int index) { return data[index]; }
+ bool operator[](unsigned int index) const { return data[index]; }
+
+ bool data[4];
+ };
+
+ Register &operator[](unsigned int index) { return mRegisterMap[index]; }
+ const Register &operator[](unsigned int index) const { return mRegisterMap[index]; }
+
+ const std::vector<PackedVaryingRegister> &getRegisterList() const { return mRegisterList; }
+ unsigned int getMaxSemanticIndex() const
+ {
+ return static_cast<unsigned int>(mRegisterList.size());
+ }
+
+ const std::vector<std::string> &getInactiveVaryingNames() const
+ {
+ return mInactiveVaryingNames;
+ }
+
+ private:
+ bool packVarying(const PackedVarying &packedVarying);
+ bool isFree(unsigned int registerRow,
+ unsigned int registerColumn,
+ unsigned int varyingRows,
+ unsigned int varyingColumns) const;
+ void insert(unsigned int registerRow,
+ unsigned int registerColumn,
+ const PackedVarying &packedVarying);
+
+ std::vector<Register> mRegisterMap;
+ std::vector<PackedVaryingRegister> mRegisterList;
+ std::vector<PackedVarying> mPackedVaryings;
+ std::vector<std::string> mInactiveVaryingNames;
+
+ PackMode mPackMode;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_VARYINGPACKING_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Version.h b/gfx/angle/checkout/src/libANGLE/Version.h
new file mode 100644
index 0000000000..ae58e31bbd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Version.h
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Version.h: Encapsulation of a GL version.
+
+#ifndef LIBANGLE_VERSION_H_
+#define LIBANGLE_VERSION_H_
+
+namespace gl
+{
+
+struct Version
+{
+ constexpr Version();
+ constexpr Version(unsigned int major, unsigned int minor);
+
+ unsigned int major;
+ unsigned int minor;
+};
+
+bool operator==(const Version &a, const Version &b);
+bool operator!=(const Version &a, const Version &b);
+bool operator>=(const Version &a, const Version &b);
+bool operator<=(const Version &a, const Version &b);
+bool operator<(const Version &a, const Version &b);
+bool operator>(const Version &a, const Version &b);
+} // namespace gl
+
+#include "Version.inc"
+
+#endif // LIBANGLE_VERSION_H_
diff --git a/gfx/angle/checkout/src/libANGLE/Version.inc b/gfx/angle/checkout/src/libANGLE/Version.inc
new file mode 100644
index 0000000000..21225e6c53
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/Version.inc
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Version.inc: Encapsulation of a GL version.
+
+#include <tuple>
+
+namespace gl
+{
+
+constexpr Version::Version()
+ : Version(0, 0)
+{
+}
+
+// Avoid conflicts with linux system defines
+#undef major
+#undef minor
+
+constexpr Version::Version(unsigned int major_, unsigned int minor_)
+ : major(major_),
+ minor(minor_)
+{
+}
+
+inline bool operator==(const Version &a, const Version &b)
+{
+ return std::tie(a.major, a.minor) == std::tie(b.major, b.minor);
+}
+
+inline bool operator!=(const Version &a, const Version &b)
+{
+ return std::tie(a.major, a.minor) != std::tie(b.major, b.minor);
+}
+
+inline bool operator>=(const Version &a, const Version &b)
+{
+ return std::tie(a.major, a.minor) >= std::tie(b.major, b.minor);
+}
+
+inline bool operator<=(const Version &a, const Version &b)
+{
+ return std::tie(a.major, a.minor) <= std::tie(b.major, b.minor);
+}
+
+inline bool operator<(const Version &a, const Version &b)
+{
+ return std::tie(a.major, a.minor) < std::tie(b.major, b.minor);
+}
+
+inline bool operator>(const Version &a, const Version &b)
+{
+ return std::tie(a.major, a.minor) > std::tie(b.major, b.minor);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/VertexArray.cpp b/gfx/angle/checkout/src/libANGLE/VertexArray.cpp
new file mode 100644
index 0000000000..e653399e6d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/VertexArray.cpp
@@ -0,0 +1,686 @@
+//
+// 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 "libANGLE/VertexArray.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/BufferImpl.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+#include "libANGLE/renderer/VertexArrayImpl.h"
+
+namespace gl
+{
+namespace
+{
+bool IsElementArrayBufferSubjectIndex(angle::SubjectIndex subjectIndex)
+{
+ return (subjectIndex == MAX_VERTEX_ATTRIBS);
+}
+
+constexpr angle::SubjectIndex kElementArrayBufferIndex = MAX_VERTEX_ATTRIBS;
+} // namespace
+
+// VertexArrayState implementation.
+VertexArrayState::VertexArrayState(VertexArray *vertexArray,
+ size_t maxAttribs,
+ size_t maxAttribBindings)
+ : mElementArrayBuffer(vertexArray, kElementArrayBufferIndex)
+{
+ ASSERT(maxAttribs <= maxAttribBindings);
+
+ for (size_t i = 0; i < maxAttribs; i++)
+ {
+ mVertexAttributes.emplace_back(static_cast<GLuint>(i));
+ mVertexBindings.emplace_back(static_cast<GLuint>(i));
+ }
+
+ // Initially all attributes start as "client" with no buffer bound.
+ mClientMemoryAttribsMask.set();
+}
+
+VertexArrayState::~VertexArrayState() {}
+
+bool VertexArrayState::hasEnabledNullPointerClientArray() const
+{
+ return (mNullPointerClientMemoryAttribsMask & mEnabledAttributesMask).any();
+}
+
+AttributesMask VertexArrayState::getBindingToAttributesMask(GLuint bindingIndex) const
+{
+ ASSERT(bindingIndex < MAX_VERTEX_ATTRIB_BINDINGS);
+ return mVertexBindings[bindingIndex].getBoundAttributesMask();
+}
+
+// Set an attribute using a new binding.
+void VertexArrayState::setAttribBinding(const Context *context,
+ size_t attribIndex,
+ GLuint newBindingIndex)
+{
+ ASSERT(attribIndex < MAX_VERTEX_ATTRIBS && newBindingIndex < MAX_VERTEX_ATTRIB_BINDINGS);
+
+ VertexAttribute &attrib = mVertexAttributes[attribIndex];
+
+ // Update the binding-attribute map.
+ const GLuint oldBindingIndex = attrib.bindingIndex;
+ ASSERT(oldBindingIndex != newBindingIndex);
+
+ VertexBinding &oldBinding = mVertexBindings[oldBindingIndex];
+ VertexBinding &newBinding = mVertexBindings[newBindingIndex];
+
+ ASSERT(oldBinding.getBoundAttributesMask().test(attribIndex) &&
+ !newBinding.getBoundAttributesMask().test(attribIndex));
+
+ oldBinding.resetBoundAttribute(attribIndex);
+ newBinding.setBoundAttribute(attribIndex);
+
+ // Set the attribute using the new binding.
+ attrib.bindingIndex = newBindingIndex;
+
+ if (context->isBufferAccessValidationEnabled())
+ {
+ attrib.updateCachedElementLimit(newBinding);
+ }
+
+ bool isMapped = newBinding.getBuffer().get() && newBinding.getBuffer()->isMapped();
+ mCachedMappedArrayBuffers.set(attribIndex, isMapped);
+ mCachedEnabledMappedArrayBuffers.set(attribIndex, isMapped && attrib.enabled);
+}
+
+// VertexArray implementation.
+VertexArray::VertexArray(rx::GLImplFactory *factory,
+ GLuint id,
+ size_t maxAttribs,
+ size_t maxAttribBindings)
+ : mId(id),
+ mState(this, maxAttribs, maxAttribBindings),
+ mVertexArray(factory->createVertexArray(mState)),
+ mBufferAccessValidationEnabled(false)
+{
+ for (size_t attribIndex = 0; attribIndex < maxAttribBindings; ++attribIndex)
+ {
+ mArrayBufferObserverBindings.emplace_back(this, attribIndex);
+ }
+}
+
+void VertexArray::onDestroy(const Context *context)
+{
+ bool isBound = context->isCurrentVertexArray(this);
+ for (VertexBinding &binding : mState.mVertexBindings)
+ {
+ if (isBound)
+ {
+ if (binding.getBuffer().get())
+ binding.getBuffer()->onNonTFBindingChanged(-1);
+ }
+ binding.setBuffer(context, nullptr);
+ }
+ if (isBound && mState.mElementArrayBuffer.get())
+ mState.mElementArrayBuffer->onNonTFBindingChanged(-1);
+ mState.mElementArrayBuffer.bind(context, nullptr);
+ mVertexArray->destroy(context);
+ SafeDelete(mVertexArray);
+ delete this;
+}
+
+VertexArray::~VertexArray()
+{
+ ASSERT(!mVertexArray);
+}
+
+void VertexArray::setLabel(const Context *context, const std::string &label)
+{
+ mState.mLabel = label;
+}
+
+const std::string &VertexArray::getLabel() const
+{
+ return mState.mLabel;
+}
+
+bool VertexArray::detachBuffer(const Context *context, GLuint bufferName)
+{
+ bool isBound = context->isCurrentVertexArray(this);
+ bool anyBufferDetached = false;
+ for (size_t bindingIndex = 0; bindingIndex < gl::MAX_VERTEX_ATTRIB_BINDINGS; ++bindingIndex)
+ {
+ VertexBinding &binding = mState.mVertexBindings[bindingIndex];
+ if (binding.getBuffer().id() == bufferName)
+ {
+ if (isBound)
+ {
+ if (binding.getBuffer().get())
+ binding.getBuffer()->onNonTFBindingChanged(-1);
+ }
+ binding.setBuffer(context, nullptr);
+ mArrayBufferObserverBindings[bindingIndex].reset();
+
+ if (context->getClientVersion() >= ES_3_1)
+ {
+ setDirtyBindingBit(bindingIndex, DIRTY_BINDING_BUFFER);
+ }
+ else
+ {
+ ASSERT(binding.getBoundAttributesMask() == AttributesMask(1ull << bindingIndex));
+ setDirtyAttribBit(bindingIndex, DIRTY_ATTRIB_POINTER);
+ }
+
+ anyBufferDetached = true;
+ mState.mClientMemoryAttribsMask |= binding.getBoundAttributesMask();
+ }
+ }
+
+ if (mState.mElementArrayBuffer.get() && mState.mElementArrayBuffer->id() == bufferName)
+ {
+ if (isBound && mState.mElementArrayBuffer.get())
+ mState.mElementArrayBuffer->onNonTFBindingChanged(-1);
+ mState.mElementArrayBuffer.bind(context, nullptr);
+ mDirtyBits.set(DIRTY_BIT_ELEMENT_ARRAY_BUFFER);
+ anyBufferDetached = true;
+ }
+
+ return anyBufferDetached;
+}
+
+const VertexAttribute &VertexArray::getVertexAttribute(size_t attribIndex) const
+{
+ ASSERT(attribIndex < getMaxAttribs());
+ return mState.mVertexAttributes[attribIndex];
+}
+
+const VertexBinding &VertexArray::getVertexBinding(size_t bindingIndex) const
+{
+ ASSERT(bindingIndex < getMaxBindings());
+ return mState.mVertexBindings[bindingIndex];
+}
+
+size_t VertexArray::GetVertexIndexFromDirtyBit(size_t dirtyBit)
+{
+ static_assert(gl::MAX_VERTEX_ATTRIBS == gl::MAX_VERTEX_ATTRIB_BINDINGS,
+ "The stride of vertex attributes should equal to that of vertex bindings.");
+ ASSERT(dirtyBit > DIRTY_BIT_ELEMENT_ARRAY_BUFFER);
+ return (dirtyBit - DIRTY_BIT_ATTRIB_0) % gl::MAX_VERTEX_ATTRIBS;
+}
+
+ANGLE_INLINE void VertexArray::setDirtyAttribBit(size_t attribIndex,
+ DirtyAttribBitType dirtyAttribBit)
+{
+ mDirtyBits.set(DIRTY_BIT_ATTRIB_0 + attribIndex);
+ mDirtyAttribBits[attribIndex].set(dirtyAttribBit);
+}
+
+ANGLE_INLINE void VertexArray::setDirtyBindingBit(size_t bindingIndex,
+ DirtyBindingBitType dirtyBindingBit)
+{
+ mDirtyBits.set(DIRTY_BIT_BINDING_0 + bindingIndex);
+ mDirtyBindingBits[bindingIndex].set(dirtyBindingBit);
+}
+
+ANGLE_INLINE void VertexArray::updateCachedBufferBindingSize(VertexBinding *binding)
+{
+ if (!mBufferAccessValidationEnabled)
+ return;
+
+ for (size_t boundAttribute : binding->getBoundAttributesMask())
+ {
+ mState.mVertexAttributes[boundAttribute].updateCachedElementLimit(*binding);
+ }
+}
+
+ANGLE_INLINE void VertexArray::updateCachedMappedArrayBuffers(
+ bool isMapped,
+ const AttributesMask &boundAttributesMask)
+{
+ if (isMapped)
+ {
+ mState.mCachedMappedArrayBuffers |= boundAttributesMask;
+ }
+ else
+ {
+ mState.mCachedMappedArrayBuffers &= ~boundAttributesMask;
+ }
+
+ mState.mCachedEnabledMappedArrayBuffers =
+ mState.mCachedMappedArrayBuffers & mState.mEnabledAttributesMask;
+}
+
+ANGLE_INLINE void VertexArray::updateCachedMappedArrayBuffersBinding(const VertexBinding &binding)
+{
+ const Buffer *buffer = binding.getBuffer().get();
+ return updateCachedMappedArrayBuffers(buffer && buffer->isMapped(),
+ binding.getBoundAttributesMask());
+}
+
+ANGLE_INLINE void VertexArray::updateCachedTransformFeedbackBindingValidation(size_t bindingIndex,
+ const Buffer *buffer)
+{
+ const bool hasConflict = buffer && buffer->isBoundForTransformFeedbackAndOtherUse();
+ mCachedTransformFeedbackConflictedBindingsMask.set(bindingIndex, hasConflict);
+}
+
+bool VertexArray::bindVertexBufferImpl(const Context *context,
+ size_t bindingIndex,
+ Buffer *boundBuffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ ASSERT(bindingIndex < getMaxBindings());
+ ASSERT(context->isCurrentVertexArray(this));
+
+ VertexBinding *binding = &mState.mVertexBindings[bindingIndex];
+
+ Buffer *oldBuffer = binding->getBuffer().get();
+
+ const bool sameBuffer = oldBuffer == boundBuffer;
+ const bool sameStride = static_cast<GLuint>(stride) == binding->getStride();
+ const bool sameOffset = offset == binding->getOffset();
+
+ if (sameBuffer && sameStride && sameOffset)
+ {
+ return false;
+ }
+
+ angle::ObserverBinding *observer = &mArrayBufferObserverBindings[bindingIndex];
+ observer->assignSubject(boundBuffer);
+
+ // Several nullptr checks are combined here for optimization purposes.
+ if (oldBuffer)
+ {
+ oldBuffer->onNonTFBindingChanged(-1);
+ oldBuffer->removeObserver(observer);
+ oldBuffer->release(context);
+ }
+
+ binding->assignBuffer(boundBuffer);
+ binding->setOffset(offset);
+ binding->setStride(stride);
+ updateCachedBufferBindingSize(binding);
+
+ // Update client memory attribute pointers. Affects all bound attributes.
+ if (boundBuffer)
+ {
+ boundBuffer->addRef();
+ boundBuffer->onNonTFBindingChanged(1);
+ boundBuffer->addObserver(observer);
+ mCachedTransformFeedbackConflictedBindingsMask.set(
+ bindingIndex, boundBuffer->isBoundForTransformFeedbackAndOtherUse());
+ mState.mClientMemoryAttribsMask &= ~binding->getBoundAttributesMask();
+ updateCachedMappedArrayBuffers(boundBuffer->isMapped(), binding->getBoundAttributesMask());
+ }
+ else
+ {
+ mCachedTransformFeedbackConflictedBindingsMask.set(bindingIndex, false);
+ mState.mClientMemoryAttribsMask |= binding->getBoundAttributesMask();
+ updateCachedMappedArrayBuffers(false, binding->getBoundAttributesMask());
+ }
+
+ return true;
+}
+
+void VertexArray::bindVertexBuffer(const Context *context,
+ size_t bindingIndex,
+ Buffer *boundBuffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ if (bindVertexBufferImpl(context, bindingIndex, boundBuffer, offset, stride))
+ {
+ setDirtyBindingBit(bindingIndex, DIRTY_BINDING_BUFFER);
+ }
+}
+
+void VertexArray::setVertexAttribBinding(const Context *context,
+ size_t attribIndex,
+ GLuint bindingIndex)
+{
+ ASSERT(attribIndex < getMaxAttribs() && bindingIndex < getMaxBindings());
+
+ if (mState.mVertexAttributes[attribIndex].bindingIndex != bindingIndex)
+ {
+ // In ES 3.0 contexts, the binding cannot change, hence the code below is unreachable.
+ ASSERT(context->getClientVersion() >= ES_3_1);
+
+ mState.setAttribBinding(context, attribIndex, bindingIndex);
+
+ setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_BINDING);
+
+ // Update client attribs mask.
+ bool hasBuffer = mState.mVertexBindings[bindingIndex].getBuffer().get() != nullptr;
+ mState.mClientMemoryAttribsMask.set(attribIndex, !hasBuffer);
+ }
+}
+
+void VertexArray::setVertexBindingDivisor(size_t bindingIndex, GLuint divisor)
+{
+ ASSERT(bindingIndex < getMaxBindings());
+
+ VertexBinding &binding = mState.mVertexBindings[bindingIndex];
+
+ binding.setDivisor(divisor);
+ setDirtyBindingBit(bindingIndex, DIRTY_BINDING_DIVISOR);
+
+ // Trigger updates in all bound attributes.
+ for (size_t attribIndex : binding.getBoundAttributesMask())
+ {
+ mState.mVertexAttributes[attribIndex].updateCachedElementLimit(binding);
+ }
+}
+
+ANGLE_INLINE bool VertexArray::setVertexAttribFormatImpl(VertexAttribute *attrib,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ bool pureInteger,
+ GLuint relativeOffset)
+{
+ angle::FormatID formatID = gl::GetVertexFormatID(type, normalized, size, pureInteger);
+
+ if (formatID != attrib->format->id || attrib->relativeOffset != relativeOffset)
+ {
+ attrib->relativeOffset = relativeOffset;
+ attrib->format = &angle::Format::Get(formatID);
+ return true;
+ }
+
+ return false;
+}
+
+void VertexArray::setVertexAttribFormat(size_t attribIndex,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ bool pureInteger,
+ GLuint relativeOffset)
+{
+ VertexAttribute &attrib = mState.mVertexAttributes[attribIndex];
+
+ ComponentType componentType = GetVertexAttributeComponentType(pureInteger, type);
+ SetComponentTypeMask(componentType, attribIndex, &mState.mVertexAttributesTypeMask);
+
+ if (setVertexAttribFormatImpl(&attrib, size, type, normalized, pureInteger, relativeOffset))
+ {
+ setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_FORMAT);
+ }
+
+ attrib.updateCachedElementLimit(mState.mVertexBindings[attrib.bindingIndex]);
+}
+
+void VertexArray::setVertexAttribDivisor(const Context *context, size_t attribIndex, GLuint divisor)
+{
+ ASSERT(attribIndex < getMaxAttribs());
+
+ setVertexAttribBinding(context, attribIndex, static_cast<GLuint>(attribIndex));
+ setVertexBindingDivisor(attribIndex, divisor);
+}
+
+void VertexArray::enableAttribute(size_t attribIndex, bool enabledState)
+{
+ ASSERT(attribIndex < getMaxAttribs());
+
+ VertexAttribute &attrib = mState.mVertexAttributes[attribIndex];
+
+ if (mState.mEnabledAttributesMask.test(attribIndex) == enabledState)
+ {
+ return;
+ }
+
+ attrib.enabled = enabledState;
+
+ setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_ENABLED);
+
+ // Update state cache
+ mState.mEnabledAttributesMask.set(attribIndex, enabledState);
+ mState.mCachedEnabledMappedArrayBuffers =
+ mState.mCachedMappedArrayBuffers & mState.mEnabledAttributesMask;
+}
+
+ANGLE_INLINE void VertexArray::setVertexAttribPointerImpl(const Context *context,
+ ComponentType componentType,
+ bool pureInteger,
+ size_t attribIndex,
+ Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ GLsizei stride,
+ const void *pointer)
+{
+ ASSERT(attribIndex < getMaxAttribs());
+
+ GLintptr offset = boundBuffer ? reinterpret_cast<GLintptr>(pointer) : 0;
+
+ VertexAttribute &attrib = mState.mVertexAttributes[attribIndex];
+
+ SetComponentTypeMask(componentType, attribIndex, &mState.mVertexAttributesTypeMask);
+
+ bool attribDirty = setVertexAttribFormatImpl(&attrib, size, type, normalized, pureInteger, 0);
+
+ if (attrib.bindingIndex != attribIndex)
+ {
+ setVertexAttribBinding(context, attribIndex, static_cast<GLuint>(attribIndex));
+ }
+
+ GLsizei effectiveStride =
+ stride != 0 ? stride : static_cast<GLsizei>(ComputeVertexAttributeTypeSize(attrib));
+
+ if (pointer != attrib.pointer || attrib.vertexAttribArrayStride != static_cast<GLuint>(stride))
+ {
+ attribDirty = true;
+ }
+
+ attrib.pointer = pointer;
+ attrib.vertexAttribArrayStride = stride;
+
+ // "Pointer buffer" dirty bit disabled because of a bug. http://anglebug.com/3256
+ bindVertexBufferImpl(context, attribIndex, boundBuffer, offset, effectiveStride);
+ setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_POINTER);
+ ANGLE_UNUSED_VARIABLE(attribDirty);
+
+ // if (bindVertexBufferImpl(context, attribIndex, boundBuffer, offset, effectiveStride) &&
+ // !attribDirty)
+ //{
+ // setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_POINTER_BUFFER);
+ //}
+ // else if (attribDirty)
+ //{
+ // setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_POINTER);
+ //}
+
+ mState.mNullPointerClientMemoryAttribsMask.set(attribIndex,
+ boundBuffer == nullptr && pointer == nullptr);
+}
+
+void VertexArray::setVertexAttribPointer(const Context *context,
+ size_t attribIndex,
+ gl::Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ GLsizei stride,
+ const void *pointer)
+{
+ setVertexAttribPointerImpl(context, ComponentType::Float, false, attribIndex, boundBuffer, size,
+ type, normalized, stride, pointer);
+}
+
+void VertexArray::setVertexAttribIPointer(const Context *context,
+ size_t attribIndex,
+ gl::Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ ComponentType componentType = GetVertexAttributeComponentType(true, type);
+ setVertexAttribPointerImpl(context, componentType, true, attribIndex, boundBuffer, size, type,
+ false, stride, pointer);
+}
+
+angle::Result VertexArray::syncState(const Context *context)
+{
+ if (mDirtyBits.any())
+ {
+ mDirtyBitsGuard = mDirtyBits;
+ ANGLE_TRY(
+ mVertexArray->syncState(context, mDirtyBits, &mDirtyAttribBits, &mDirtyBindingBits));
+ mDirtyBits.reset();
+ mDirtyBitsGuard.reset();
+
+ // The dirty bits should be reset in the back-end. To simplify ASSERTs only check attrib 0.
+ ASSERT(mDirtyAttribBits[0].none());
+ ASSERT(mDirtyBindingBits[0].none());
+ }
+ return angle::Result::Continue;
+}
+
+void VertexArray::onBindingChanged(const Context *context, int incr)
+{
+ if (mState.mElementArrayBuffer.get())
+ mState.mElementArrayBuffer->onNonTFBindingChanged(incr);
+ for (auto &binding : mState.mVertexBindings)
+ {
+ binding.onContainerBindingChanged(context, incr);
+ }
+}
+
+VertexArray::DirtyBitType VertexArray::getDirtyBitFromIndex(bool contentsChanged,
+ angle::SubjectIndex index) const
+{
+ if (IsElementArrayBufferSubjectIndex(index))
+ {
+ mIndexRangeCache.invalidate();
+ return contentsChanged ? DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA
+ : DIRTY_BIT_ELEMENT_ARRAY_BUFFER;
+ }
+ else
+ {
+ // Note: this currently just gets the top-level dirty bit.
+ ASSERT(index < mArrayBufferObserverBindings.size());
+ return static_cast<DirtyBitType>(
+ (contentsChanged ? DIRTY_BIT_BUFFER_DATA_0 : DIRTY_BIT_BINDING_0) + index);
+ }
+}
+
+void VertexArray::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message)
+{
+ switch (message)
+ {
+ case angle::SubjectMessage::ContentsChanged:
+ setDependentDirtyBit(true, index);
+ break;
+
+ case angle::SubjectMessage::SubjectChanged:
+ if (!IsElementArrayBufferSubjectIndex(index))
+ {
+ updateCachedBufferBindingSize(&mState.mVertexBindings[index]);
+ }
+ setDependentDirtyBit(false, index);
+ break;
+
+ case angle::SubjectMessage::BindingChanged:
+ if (!IsElementArrayBufferSubjectIndex(index))
+ {
+ const Buffer *buffer = mState.mVertexBindings[index].getBuffer().get();
+ updateCachedTransformFeedbackBindingValidation(index, buffer);
+ }
+ break;
+
+ case angle::SubjectMessage::SubjectMapped:
+ if (!IsElementArrayBufferSubjectIndex(index))
+ {
+ updateCachedMappedArrayBuffersBinding(mState.mVertexBindings[index]);
+ }
+ onStateChange(angle::SubjectMessage::SubjectMapped);
+ break;
+
+ case angle::SubjectMessage::SubjectUnmapped:
+ setDependentDirtyBit(true, index);
+
+ if (!IsElementArrayBufferSubjectIndex(index))
+ {
+ updateCachedMappedArrayBuffersBinding(mState.mVertexBindings[index]);
+ }
+ onStateChange(angle::SubjectMessage::SubjectUnmapped);
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void VertexArray::setDependentDirtyBit(bool contentsChanged, angle::SubjectIndex index)
+{
+ DirtyBitType dirtyBit = getDirtyBitFromIndex(contentsChanged, index);
+ ASSERT(!mDirtyBitsGuard.valid() || mDirtyBitsGuard.value().test(dirtyBit));
+ mDirtyBits.set(dirtyBit);
+ onStateChange(angle::SubjectMessage::ContentsChanged);
+}
+
+bool VertexArray::hasTransformFeedbackBindingConflict(const gl::Context *context) const
+{
+ // Fast check first.
+ if (!mCachedTransformFeedbackConflictedBindingsMask.any())
+ {
+ return false;
+ }
+
+ const AttributesMask &activeAttribues = context->getStateCache().getActiveBufferedAttribsMask();
+
+ // Slow check. We must ensure that the conflicting attributes are enabled/active.
+ for (size_t attribIndex : activeAttribues)
+ {
+ const VertexAttribute &attrib = mState.mVertexAttributes[attribIndex];
+ if (mCachedTransformFeedbackConflictedBindingsMask[attrib.bindingIndex])
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+angle::Result VertexArray::getIndexRangeImpl(const Context *context,
+ DrawElementsType type,
+ GLsizei indexCount,
+ const void *indices,
+ IndexRange *indexRangeOut) const
+{
+ Buffer *elementArrayBuffer = mState.mElementArrayBuffer.get();
+ if (!elementArrayBuffer)
+ {
+ *indexRangeOut = ComputeIndexRange(type, indices, indexCount,
+ context->getState().isPrimitiveRestartEnabled());
+ return angle::Result::Continue;
+ }
+
+ size_t offset = reinterpret_cast<uintptr_t>(indices);
+ ANGLE_TRY(elementArrayBuffer->getIndexRange(context, type, offset, indexCount,
+ context->getState().isPrimitiveRestartEnabled(),
+ indexRangeOut));
+
+ mIndexRangeCache.put(type, indexCount, offset, *indexRangeOut);
+ return angle::Result::Continue;
+}
+
+VertexArray::IndexRangeCache::IndexRangeCache() = default;
+
+void VertexArray::IndexRangeCache::put(DrawElementsType type,
+ GLsizei indexCount,
+ size_t offset,
+ const IndexRange &indexRange)
+{
+ ASSERT(type != DrawElementsType::InvalidEnum);
+
+ mTypeKey = type;
+ mIndexCountKey = indexCount;
+ mOffsetKey = offset;
+ mPayload = indexRange;
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/VertexArray.h b/gfx/angle/checkout/src/libANGLE/VertexArray.h
new file mode 100644
index 0000000000..cd8f4a58c9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/VertexArray.h
@@ -0,0 +1,383 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This class contains prototypes for representing GLES 3 Vertex Array Objects:
+//
+// The buffer objects that are to be used by the vertex stage of the GL are collected
+// together to form a vertex array object. All state related to the definition of data used
+// by the vertex processor is encapsulated in a vertex array object.
+//
+
+#ifndef LIBANGLE_VERTEXARRAY_H_
+#define LIBANGLE_VERTEXARRAY_H_
+
+#include "common/Optional.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Observer.h"
+#include "libANGLE/RefCountObject.h"
+#include "libANGLE/VertexAttribute.h"
+
+#include <vector>
+
+namespace rx
+{
+class GLImplFactory;
+class VertexArrayImpl;
+} // namespace rx
+
+namespace gl
+{
+class Buffer;
+
+class VertexArrayState final : angle::NonCopyable
+{
+ public:
+ VertexArrayState(VertexArray *vertexArray, size_t maxAttribs, size_t maxBindings);
+ ~VertexArrayState();
+
+ const std::string &getLabel() const { return mLabel; }
+
+ Buffer *getElementArrayBuffer() const { return mElementArrayBuffer.get(); }
+ size_t getMaxAttribs() const { return mVertexAttributes.size(); }
+ size_t getMaxBindings() const { return mVertexBindings.size(); }
+ const AttributesMask &getEnabledAttributesMask() const { return mEnabledAttributesMask; }
+ const std::vector<VertexAttribute> &getVertexAttributes() const { return mVertexAttributes; }
+ const VertexAttribute &getVertexAttribute(size_t attribIndex) const
+ {
+ return mVertexAttributes[attribIndex];
+ }
+ const std::vector<VertexBinding> &getVertexBindings() const { return mVertexBindings; }
+ const VertexBinding &getVertexBinding(size_t bindingIndex) const
+ {
+ return mVertexBindings[bindingIndex];
+ }
+ const VertexBinding &getBindingFromAttribIndex(size_t attribIndex) const
+ {
+ return mVertexBindings[mVertexAttributes[attribIndex].bindingIndex];
+ }
+ size_t getBindingIndexFromAttribIndex(size_t attribIndex) const
+ {
+ return mVertexAttributes[attribIndex].bindingIndex;
+ }
+
+ void setAttribBinding(const Context *context, size_t attribIndex, GLuint newBindingIndex);
+
+ // Extra validation performed on the Vertex Array.
+ bool hasEnabledNullPointerClientArray() const;
+
+ // Get all the attributes in an AttributesMask that are using the given binding.
+ AttributesMask getBindingToAttributesMask(GLuint bindingIndex) const;
+
+ private:
+ friend class VertexArray;
+ std::string mLabel;
+ std::vector<VertexAttribute> mVertexAttributes;
+ SubjectBindingPointer<Buffer> mElementArrayBuffer;
+ std::vector<VertexBinding> mVertexBindings;
+ AttributesMask mEnabledAttributesMask;
+ ComponentTypeMask mVertexAttributesTypeMask;
+
+ // This is a performance optimization for buffer binding. Allows element array buffer updates.
+ friend class State;
+
+ // From the GLES 3.1 spec:
+ // When a generic attribute array is sourced from client memory, the vertex attribute binding
+ // state is ignored. Thus we don't have to worry about binding state when using client memory
+ // attribs.
+ gl::AttributesMask mClientMemoryAttribsMask;
+ gl::AttributesMask mNullPointerClientMemoryAttribsMask;
+
+ // Used for validation cache. Indexed by attribute.
+ AttributesMask mCachedMappedArrayBuffers;
+ AttributesMask mCachedEnabledMappedArrayBuffers;
+};
+
+class VertexArray final : public angle::ObserverInterface,
+ public LabeledObject,
+ public angle::Subject
+{
+ public:
+ // Dirty bits for VertexArrays use a heirarchical design. At the top level, each attribute
+ // has a single dirty bit. Then an array of MAX_ATTRIBS dirty bits each has a dirty bit for
+ // enabled/pointer/format/binding. Bindings are handled similarly. Note that because the
+ // total number of dirty bits is 33, it will not be as fast on a 32-bit machine, which
+ // can't support the advanced 64-bit scanning intrinsics. We could consider packing the
+ // binding and attribute bits together if this becomes a problem.
+ //
+ // Special note on "DIRTY_ATTRIB_POINTER_BUFFER": this is a special case when the app
+ // calls glVertexAttribPointer but only changes a VBO and/or offset binding. This allows
+ // the Vulkan back-end to skip performing a pipeline change for performance.
+ enum DirtyBitType
+ {
+ DIRTY_BIT_ELEMENT_ARRAY_BUFFER,
+ DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA,
+
+ // Dirty bits for attributes.
+ DIRTY_BIT_ATTRIB_0,
+ DIRTY_BIT_ATTRIB_MAX = DIRTY_BIT_ATTRIB_0 + gl::MAX_VERTEX_ATTRIBS,
+
+ // Dirty bits for bindings.
+ DIRTY_BIT_BINDING_0 = DIRTY_BIT_ATTRIB_MAX,
+ DIRTY_BIT_BINDING_MAX = DIRTY_BIT_BINDING_0 + gl::MAX_VERTEX_ATTRIB_BINDINGS,
+
+ // We keep separate dirty bits for bound buffers whose data changed since last update.
+ DIRTY_BIT_BUFFER_DATA_0 = DIRTY_BIT_BINDING_MAX,
+ DIRTY_BIT_BUFFER_DATA_MAX = DIRTY_BIT_BUFFER_DATA_0 + gl::MAX_VERTEX_ATTRIB_BINDINGS,
+
+ DIRTY_BIT_UNKNOWN = DIRTY_BIT_BUFFER_DATA_MAX,
+ DIRTY_BIT_MAX = DIRTY_BIT_UNKNOWN,
+ };
+
+ // We want to keep the number of dirty bits within 64 to keep iteration times fast.
+ static_assert(DIRTY_BIT_MAX <= 64, "Too many vertex array dirty bits.");
+
+ enum DirtyAttribBitType
+ {
+ DIRTY_ATTRIB_ENABLED,
+ DIRTY_ATTRIB_POINTER,
+ DIRTY_ATTRIB_FORMAT,
+ DIRTY_ATTRIB_BINDING,
+ DIRTY_ATTRIB_POINTER_BUFFER,
+ DIRTY_ATTRIB_UNKNOWN,
+ DIRTY_ATTRIB_MAX = DIRTY_ATTRIB_UNKNOWN,
+ };
+
+ enum DirtyBindingBitType
+ {
+ DIRTY_BINDING_BUFFER,
+ DIRTY_BINDING_DIVISOR,
+ DIRTY_BINDING_UNKNOWN,
+ DIRTY_BINDING_MAX = DIRTY_BINDING_UNKNOWN,
+ };
+
+ using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
+ using DirtyAttribBits = angle::BitSet<DIRTY_ATTRIB_MAX>;
+ using DirtyBindingBits = angle::BitSet<DIRTY_BINDING_MAX>;
+ using DirtyAttribBitsArray = std::array<DirtyAttribBits, gl::MAX_VERTEX_ATTRIBS>;
+ using DirtyBindingBitsArray = std::array<DirtyBindingBits, gl::MAX_VERTEX_ATTRIB_BINDINGS>;
+
+ VertexArray(rx::GLImplFactory *factory, GLuint id, size_t maxAttribs, size_t maxAttribBindings);
+
+ void onDestroy(const Context *context);
+
+ GLuint id() const { return mId; }
+
+ void setLabel(const Context *context, const std::string &label) override;
+ const std::string &getLabel() const override;
+
+ const VertexBinding &getVertexBinding(size_t bindingIndex) const;
+ const VertexAttribute &getVertexAttribute(size_t attribIndex) const;
+ const VertexBinding &getBindingFromAttribIndex(size_t attribIndex) const
+ {
+ return mState.getBindingFromAttribIndex(attribIndex);
+ }
+
+ // Returns true if the function finds and detaches a bound buffer.
+ bool detachBuffer(const Context *context, GLuint bufferName);
+
+ void setVertexAttribDivisor(const Context *context, size_t index, GLuint divisor);
+ void enableAttribute(size_t attribIndex, bool enabledState);
+
+ void setVertexAttribPointer(const Context *context,
+ size_t attribIndex,
+ Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ GLsizei stride,
+ const void *pointer);
+
+ void setVertexAttribIPointer(const Context *context,
+ size_t attribIndex,
+ Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer);
+
+ void setVertexAttribFormat(size_t attribIndex,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ bool pureInteger,
+ GLuint relativeOffset);
+ void bindVertexBuffer(const Context *context,
+ size_t bindingIndex,
+ Buffer *boundBuffer,
+ GLintptr offset,
+ GLsizei stride);
+ void setVertexAttribBinding(const Context *context, size_t attribIndex, GLuint bindingIndex);
+ void setVertexBindingDivisor(size_t bindingIndex, GLuint divisor);
+
+ Buffer *getElementArrayBuffer() const { return mState.getElementArrayBuffer(); }
+ size_t getMaxAttribs() const { return mState.getMaxAttribs(); }
+ size_t getMaxBindings() const { return mState.getMaxBindings(); }
+
+ const std::vector<VertexAttribute> &getVertexAttributes() const
+ {
+ return mState.getVertexAttributes();
+ }
+ const std::vector<VertexBinding> &getVertexBindings() const
+ {
+ return mState.getVertexBindings();
+ }
+
+ rx::VertexArrayImpl *getImplementation() const { return mVertexArray; }
+
+ const AttributesMask &getEnabledAttributesMask() const
+ {
+ return mState.getEnabledAttributesMask();
+ }
+
+ gl::AttributesMask getClientAttribsMask() const { return mState.mClientMemoryAttribsMask; }
+
+ bool hasEnabledNullPointerClientArray() const
+ {
+ return mState.hasEnabledNullPointerClientArray();
+ }
+
+ bool hasMappedEnabledArrayBuffer() const
+ {
+ return mState.mCachedEnabledMappedArrayBuffers.any();
+ }
+
+ // Observer implementation
+ void onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message) override;
+
+ static size_t GetVertexIndexFromDirtyBit(size_t dirtyBit);
+
+ angle::Result syncState(const Context *context);
+ bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
+
+ ComponentTypeMask getAttributesTypeMask() const { return mState.mVertexAttributesTypeMask; }
+ AttributesMask getAttributesMask() const { return mState.mEnabledAttributesMask; }
+
+ void onBindingChanged(const Context *context, int incr);
+ bool hasTransformFeedbackBindingConflict(const gl::Context *context) const;
+
+ ANGLE_INLINE angle::Result getIndexRange(const Context *context,
+ DrawElementsType type,
+ GLsizei indexCount,
+ const void *indices,
+ IndexRange *indexRangeOut) const
+ {
+ Buffer *elementArrayBuffer = mState.mElementArrayBuffer.get();
+ if (elementArrayBuffer && mIndexRangeCache.get(type, indexCount, indices, indexRangeOut))
+ {
+ return angle::Result::Continue;
+ }
+
+ return getIndexRangeImpl(context, type, indexCount, indices, indexRangeOut);
+ }
+
+ void setBufferAccessValidationEnabled(bool enabled)
+ {
+ mBufferAccessValidationEnabled = enabled;
+ }
+
+ private:
+ ~VertexArray() override;
+
+ // This is a performance optimization for buffer binding. Allows element array buffer updates.
+ friend class State;
+
+ void setDirtyAttribBit(size_t attribIndex, DirtyAttribBitType dirtyAttribBit);
+ void setDirtyBindingBit(size_t bindingIndex, DirtyBindingBitType dirtyBindingBit);
+
+ DirtyBitType getDirtyBitFromIndex(bool contentsChanged, angle::SubjectIndex index) const;
+ void setDependentDirtyBit(bool contentsChanged, angle::SubjectIndex index);
+
+ // These are used to optimize draw call validation.
+ void updateCachedBufferBindingSize(VertexBinding *binding);
+ void updateCachedTransformFeedbackBindingValidation(size_t bindingIndex, const Buffer *buffer);
+ void updateCachedMappedArrayBuffers(bool isMapped, const AttributesMask &boundAttributesMask);
+ void updateCachedMappedArrayBuffersBinding(const VertexBinding &binding);
+
+ angle::Result getIndexRangeImpl(const Context *context,
+ DrawElementsType type,
+ GLsizei indexCount,
+ const void *indices,
+ IndexRange *indexRangeOut) const;
+
+ void setVertexAttribPointerImpl(const Context *context,
+ ComponentType componentType,
+ bool pureInteger,
+ size_t attribIndex,
+ Buffer *boundBuffer,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ GLsizei stride,
+ const void *pointer);
+
+ // These two functions return true if the state was dirty.
+ bool setVertexAttribFormatImpl(VertexAttribute *attrib,
+ GLint size,
+ VertexAttribType type,
+ bool normalized,
+ bool pureInteger,
+ GLuint relativeOffset);
+ bool bindVertexBufferImpl(const Context *context,
+ size_t bindingIndex,
+ Buffer *boundBuffer,
+ GLintptr offset,
+ GLsizei stride);
+
+ GLuint mId;
+
+ VertexArrayState mState;
+ DirtyBits mDirtyBits;
+ DirtyAttribBitsArray mDirtyAttribBits;
+ DirtyBindingBitsArray mDirtyBindingBits;
+ Optional<DirtyBits> mDirtyBitsGuard;
+
+ rx::VertexArrayImpl *mVertexArray;
+
+ std::vector<angle::ObserverBinding> mArrayBufferObserverBindings;
+
+ AttributesMask mCachedTransformFeedbackConflictedBindingsMask;
+
+ class IndexRangeCache final : angle::NonCopyable
+ {
+ public:
+ IndexRangeCache();
+
+ void invalidate() { mTypeKey = DrawElementsType::InvalidEnum; }
+
+ bool get(DrawElementsType type,
+ GLsizei indexCount,
+ const void *indices,
+ IndexRange *indexRangeOut)
+ {
+ size_t offset = reinterpret_cast<uintptr_t>(indices);
+ if (mTypeKey == type && mIndexCountKey == indexCount && mOffsetKey == offset)
+ {
+ *indexRangeOut = mPayload;
+ return true;
+ }
+
+ return false;
+ }
+
+ void put(DrawElementsType type,
+ GLsizei indexCount,
+ size_t offset,
+ const IndexRange &indexRange);
+
+ private:
+ DrawElementsType mTypeKey;
+ GLsizei mIndexCountKey;
+ size_t mOffsetKey;
+ IndexRange mPayload;
+ };
+
+ mutable IndexRangeCache mIndexRangeCache;
+ bool mBufferAccessValidationEnabled;
+};
+
+} // namespace gl
+
+#endif // LIBANGLE_VERTEXARRAY_H_
diff --git a/gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp b/gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp
new file mode 100644
index 0000000000..f525addbba
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp
@@ -0,0 +1,170 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Implementation of the state classes for mananging GLES 3.1 Vertex Array Objects.
+//
+
+#include "libANGLE/VertexAttribute.h"
+
+namespace gl
+{
+
+// [OpenGL ES 3.1] (November 3, 2016) Section 20 Page 361
+// Table 20.2: Vertex Array Object State
+VertexBinding::VertexBinding() : VertexBinding(0) {}
+
+VertexBinding::VertexBinding(GLuint boundAttribute) : mStride(16u), mDivisor(0), mOffset(0)
+{
+ mBoundAttributesMask.set(boundAttribute);
+}
+
+VertexBinding::VertexBinding(VertexBinding &&binding)
+{
+ *this = std::move(binding);
+}
+
+VertexBinding::~VertexBinding() {}
+
+VertexBinding &VertexBinding::operator=(VertexBinding &&binding)
+{
+ if (this != &binding)
+ {
+ mStride = binding.mStride;
+ mDivisor = binding.mDivisor;
+ mOffset = binding.mOffset;
+ mBoundAttributesMask = binding.mBoundAttributesMask;
+ std::swap(binding.mBuffer, mBuffer);
+ }
+ return *this;
+}
+
+void VertexBinding::onContainerBindingChanged(const Context *context, int incr) const
+{
+ if (mBuffer.get())
+ mBuffer->onNonTFBindingChanged(incr);
+}
+
+VertexAttribute::VertexAttribute(GLuint bindingIndex)
+ : enabled(false),
+ format(&angle::Format::Get(angle::FormatID::R32G32B32A32_FLOAT)),
+ pointer(nullptr),
+ relativeOffset(0),
+ vertexAttribArrayStride(0),
+ bindingIndex(bindingIndex),
+ mCachedElementLimit(0)
+{}
+
+VertexAttribute::VertexAttribute(VertexAttribute &&attrib)
+ : enabled(attrib.enabled),
+ format(attrib.format),
+ pointer(attrib.pointer),
+ relativeOffset(attrib.relativeOffset),
+ vertexAttribArrayStride(attrib.vertexAttribArrayStride),
+ bindingIndex(attrib.bindingIndex),
+ mCachedElementLimit(attrib.mCachedElementLimit)
+{}
+
+VertexAttribute &VertexAttribute::operator=(VertexAttribute &&attrib)
+{
+ if (this != &attrib)
+ {
+ enabled = attrib.enabled;
+ format = attrib.format;
+ pointer = attrib.pointer;
+ relativeOffset = attrib.relativeOffset;
+ vertexAttribArrayStride = attrib.vertexAttribArrayStride;
+ bindingIndex = attrib.bindingIndex;
+ mCachedElementLimit = attrib.mCachedElementLimit;
+ }
+ return *this;
+}
+
+void VertexAttribute::updateCachedElementLimit(const VertexBinding &binding)
+{
+ Buffer *buffer = binding.getBuffer().get();
+ if (!buffer)
+ {
+ mCachedElementLimit = 0;
+ return;
+ }
+
+ angle::CheckedNumeric<GLint64> bufferSize(buffer->getSize());
+ angle::CheckedNumeric<GLint64> bufferOffset(binding.getOffset());
+ angle::CheckedNumeric<GLint64> attribOffset(relativeOffset);
+ angle::CheckedNumeric<GLint64> attribSize(ComputeVertexAttributeTypeSize(*this));
+
+ // (buffer.size - buffer.offset - attrib.relativeOffset - attrib.size) / binding.stride
+ angle::CheckedNumeric<GLint64> elementLimit =
+ (bufferSize - bufferOffset - attribOffset - attribSize);
+
+ // Use the special integer overflow value if there was a math error.
+ if (!elementLimit.IsValid())
+ {
+ static_assert(kIntegerOverflow < 0, "Unexpected value");
+ mCachedElementLimit = kIntegerOverflow;
+ return;
+ }
+
+ mCachedElementLimit = elementLimit.ValueOrDie();
+ if (mCachedElementLimit < 0)
+ {
+ return;
+ }
+
+ if (binding.getStride() == 0)
+ {
+ // Special case for a zero stride. If we can fit one vertex we can fit infinite vertices.
+ mCachedElementLimit = std::numeric_limits<GLint64>::max();
+ return;
+ }
+
+ angle::CheckedNumeric<GLint64> bindingStride(binding.getStride());
+ elementLimit /= bindingStride;
+
+ if (binding.getDivisor() > 0)
+ {
+ // For instanced draws, the element count is floor(instanceCount - 1) / binding.divisor.
+ angle::CheckedNumeric<GLint64> bindingDivisor(binding.getDivisor());
+ elementLimit *= bindingDivisor;
+
+ // We account for the floor() part rounding by adding a rounding constant.
+ elementLimit += bindingDivisor - 1;
+ }
+
+ mCachedElementLimit = elementLimit.ValueOrDefault(kIntegerOverflow);
+}
+
+size_t ComputeVertexAttributeStride(const VertexAttribute &attrib, const VertexBinding &binding)
+{
+ // In ES 3.1, VertexAttribPointer will store the type size in the binding stride.
+ // Hence, rendering always uses the binding's stride.
+ return attrib.enabled ? binding.getStride() : 16u;
+}
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+GLintptr ComputeVertexAttributeOffset(const VertexAttribute &attrib, const VertexBinding &binding)
+{
+ return attrib.relativeOffset + binding.getOffset();
+}
+
+size_t ComputeVertexBindingElementCount(GLuint divisor, size_t drawCount, size_t instanceCount)
+{
+ // For instanced rendering, we draw "instanceDrawCount" sets of "vertexDrawCount" vertices.
+ //
+ // A vertex attribute with a positive divisor loads one instanced vertex for every set of
+ // non-instanced vertices, and the instanced vertex index advances once every "mDivisor"
+ // instances.
+ if (instanceCount > 0 && divisor > 0)
+ {
+ // When instanceDrawCount is not a multiple attrib.divisor, the division must round up.
+ // For instance, with 5 non-instanced vertices and a divisor equal to 3, we need 2 instanced
+ // vertices.
+ return (instanceCount + divisor - 1u) / divisor;
+ }
+
+ return drawCount;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/VertexAttribute.h b/gfx/angle/checkout/src/libANGLE/VertexAttribute.h
new file mode 100644
index 0000000000..b695a7cc7c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/VertexAttribute.h
@@ -0,0 +1,139 @@
+//
+// 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 structures about Generic Vertex Attribute.
+//
+
+#ifndef LIBANGLE_VERTEXATTRIBUTE_H_
+#define LIBANGLE_VERTEXATTRIBUTE_H_
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/Format.h"
+
+namespace gl
+{
+class VertexArray;
+
+//
+// Implementation of Generic Vertex Attribute Bindings for ES3.1. The members are intentionally made
+// private in order to hide implementation details.
+//
+class VertexBinding final : angle::NonCopyable
+{
+ public:
+ VertexBinding();
+ explicit VertexBinding(GLuint boundAttribute);
+ VertexBinding(VertexBinding &&binding);
+ ~VertexBinding();
+ VertexBinding &operator=(VertexBinding &&binding);
+
+ GLuint getStride() const { return mStride; }
+ void setStride(GLuint strideIn) { mStride = strideIn; }
+
+ GLuint getDivisor() const { return mDivisor; }
+ void setDivisor(GLuint divisorIn) { mDivisor = divisorIn; }
+
+ GLintptr getOffset() const { return mOffset; }
+ void setOffset(GLintptr offsetIn) { mOffset = offsetIn; }
+
+ const BindingPointer<Buffer> &getBuffer() const { return mBuffer; }
+
+ ANGLE_INLINE void setBuffer(const gl::Context *context, Buffer *bufferIn)
+ {
+ mBuffer.set(context, bufferIn);
+ }
+
+ // Skips ref counting for better inlined performance.
+ ANGLE_INLINE void assignBuffer(Buffer *bufferIn) { mBuffer.assign(bufferIn); }
+
+ void onContainerBindingChanged(const Context *context, int incr) const;
+
+ const AttributesMask &getBoundAttributesMask() const { return mBoundAttributesMask; }
+
+ void setBoundAttribute(size_t index) { mBoundAttributesMask.set(index); }
+
+ void resetBoundAttribute(size_t index) { mBoundAttributesMask.reset(index); }
+
+ private:
+ GLuint mStride;
+ GLuint mDivisor;
+ GLintptr mOffset;
+
+ BindingPointer<Buffer> mBuffer;
+
+ // Mapping from this binding to all of the attributes that are using this binding.
+ AttributesMask mBoundAttributesMask;
+};
+
+//
+// Implementation of Generic Vertex Attributes for ES3.1
+//
+struct VertexAttribute final : private angle::NonCopyable
+{
+ explicit VertexAttribute(GLuint bindingIndex);
+ VertexAttribute(VertexAttribute &&attrib);
+ VertexAttribute &operator=(VertexAttribute &&attrib);
+
+ // Called from VertexArray.
+ void updateCachedElementLimit(const VertexBinding &binding);
+ GLint64 getCachedElementLimit() const { return mCachedElementLimit; }
+
+ bool enabled; // For glEnable/DisableVertexAttribArray
+ const angle::Format *format;
+
+ const void *pointer;
+ GLuint relativeOffset;
+
+ GLuint vertexAttribArrayStride; // ONLY for queries of VERTEX_ATTRIB_ARRAY_STRIDE
+ GLuint bindingIndex;
+
+ // Special value for the cached element limit on the integer overflow case.
+ static constexpr GLint64 kIntegerOverflow = std::numeric_limits<GLint64>::min();
+
+ private:
+ // This is kept in sync by the VertexArray. It is used to optimize draw call validation.
+ GLint64 mCachedElementLimit;
+};
+
+ANGLE_INLINE size_t ComputeVertexAttributeTypeSize(const VertexAttribute &attrib)
+{
+ ASSERT(attrib.format);
+ return attrib.format->pixelBytes;
+}
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+size_t ComputeVertexAttributeStride(const VertexAttribute &attrib, const VertexBinding &binding);
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+GLintptr ComputeVertexAttributeOffset(const VertexAttribute &attrib, const VertexBinding &binding);
+
+size_t ComputeVertexBindingElementCount(GLuint divisor, size_t drawCount, size_t instanceCount);
+
+struct VertexAttribCurrentValueData
+{
+ union
+ {
+ GLfloat FloatValues[4];
+ GLint IntValues[4];
+ GLuint UnsignedIntValues[4];
+ } Values;
+ VertexAttribType Type;
+
+ VertexAttribCurrentValueData();
+
+ void setFloatValues(const GLfloat floatValues[4]);
+ void setIntValues(const GLint intValues[4]);
+ void setUnsignedIntValues(const GLuint unsignedIntValues[4]);
+};
+
+bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b);
+bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b);
+
+} // namespace gl
+
+#include "VertexAttribute.inc"
+
+#endif // LIBANGLE_VERTEXATTRIBUTE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/VertexAttribute.inc b/gfx/angle/checkout/src/libANGLE/VertexAttribute.inc
new file mode 100644
index 0000000000..ba0673eb63
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/VertexAttribute.inc
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// VertexAttribute.inc: Inline vertex attribute methods
+//
+
+namespace gl
+{
+
+inline VertexAttribCurrentValueData::VertexAttribCurrentValueData()
+ : Type(gl::VertexAttribType::Float)
+{
+ Values.FloatValues[0] = 0.0f;
+ Values.FloatValues[1] = 0.0f;
+ Values.FloatValues[2] = 0.0f;
+ Values.FloatValues[3] = 1.0f;
+}
+
+inline void VertexAttribCurrentValueData::setFloatValues(const GLfloat floatValues[4])
+{
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ Values.FloatValues[valueIndex] = floatValues[valueIndex];
+ }
+ Type = gl::VertexAttribType::Float;
+}
+
+inline void VertexAttribCurrentValueData::setIntValues(const GLint intValues[4])
+{
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ Values.IntValues[valueIndex] = intValues[valueIndex];
+ }
+ Type = gl::VertexAttribType::Int;
+}
+
+inline void VertexAttribCurrentValueData::setUnsignedIntValues(const GLuint unsignedIntValues[4])
+{
+ for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++)
+ {
+ Values.UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
+ }
+ Type = gl::VertexAttribType::UnsignedInt;
+}
+
+inline bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b)
+{
+ return (a.Type == b.Type && memcmp(&a.Values, &b.Values, sizeof(VertexAttribCurrentValueData::Values)) == 0);
+}
+
+inline bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b)
+{
+ return !(a == b);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/WorkerThread.cpp b/gfx/angle/checkout/src/libANGLE/WorkerThread.cpp
new file mode 100644
index 0000000000..0a96e9101b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/WorkerThread.cpp
@@ -0,0 +1,242 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// WorkerThread:
+// Task running thread for ANGLE, similar to a TaskRunner in Chromium.
+// Might be implemented differently depending on platform.
+//
+
+#include "libANGLE/WorkerThread.h"
+
+#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
+# include <condition_variable>
+# include <future>
+# include <mutex>
+# include <queue>
+# include <thread>
+#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
+
+namespace angle
+{
+
+WaitableEvent::WaitableEvent() = default;
+WaitableEvent::~WaitableEvent() = default;
+
+void WaitableEventDone::wait() {}
+
+bool WaitableEventDone::isReady()
+{
+ return true;
+}
+
+WorkerThreadPool::WorkerThreadPool() = default;
+WorkerThreadPool::~WorkerThreadPool() = default;
+
+class SingleThreadedWaitableEvent final : public WaitableEvent
+{
+ public:
+ SingleThreadedWaitableEvent() = default;
+ ~SingleThreadedWaitableEvent() override = default;
+
+ void wait() override;
+ bool isReady() override;
+};
+
+void SingleThreadedWaitableEvent::wait() {}
+
+bool SingleThreadedWaitableEvent::isReady()
+{
+ return true;
+}
+
+class SingleThreadedWorkerPool final : public WorkerThreadPool
+{
+ public:
+ std::shared_ptr<WaitableEvent> postWorkerTask(std::shared_ptr<Closure> task) override;
+ void setMaxThreads(size_t maxThreads) override;
+ bool isAsync() override;
+};
+
+// SingleThreadedWorkerPool implementation.
+std::shared_ptr<WaitableEvent> SingleThreadedWorkerPool::postWorkerTask(
+ std::shared_ptr<Closure> task)
+{
+ (*task)();
+ return std::make_shared<SingleThreadedWaitableEvent>();
+}
+
+void SingleThreadedWorkerPool::setMaxThreads(size_t maxThreads) {}
+
+bool SingleThreadedWorkerPool::isAsync()
+{
+ return false;
+}
+
+#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
+class AsyncWaitableEvent final : public WaitableEvent
+{
+ public:
+ AsyncWaitableEvent() : mIsPending(true) {}
+ ~AsyncWaitableEvent() override = default;
+
+ void wait() override;
+ bool isReady() override;
+
+ private:
+ friend class AsyncWorkerPool;
+ void setFuture(std::future<void> &&future);
+
+ // To block wait() when the task is stil in queue to be run.
+ // Also to protect the concurrent accesses from both main thread and
+ // background threads to the member fields.
+ std::mutex mMutex;
+
+ bool mIsPending;
+ std::condition_variable mCondition;
+ std::future<void> mFuture;
+};
+
+void AsyncWaitableEvent::setFuture(std::future<void> &&future)
+{
+ mFuture = std::move(future);
+}
+
+void AsyncWaitableEvent::wait()
+{
+ {
+ std::unique_lock<std::mutex> lock(mMutex);
+ mCondition.wait(lock, [this] { return !mIsPending; });
+ }
+
+ ASSERT(mFuture.valid());
+ mFuture.wait();
+}
+
+bool AsyncWaitableEvent::isReady()
+{
+ std::lock_guard<std::mutex> lock(mMutex);
+ if (mIsPending)
+ {
+ return false;
+ }
+ ASSERT(mFuture.valid());
+ return mFuture.wait_for(std::chrono::seconds(0)) == std::future_status::ready;
+}
+
+class AsyncWorkerPool final : public WorkerThreadPool
+{
+ public:
+ AsyncWorkerPool(size_t maxThreads) : mMaxThreads(maxThreads), mRunningThreads(0) {}
+ ~AsyncWorkerPool() override = default;
+
+ std::shared_ptr<WaitableEvent> postWorkerTask(std::shared_ptr<Closure> task) override;
+ void setMaxThreads(size_t maxThreads) override;
+ bool isAsync() override;
+
+ private:
+ void checkToRunPendingTasks();
+
+ // To protect the concurrent accesses from both main thread and background
+ // threads to the member fields.
+ std::mutex mMutex;
+
+ size_t mMaxThreads;
+ size_t mRunningThreads;
+ std::queue<std::pair<std::shared_ptr<AsyncWaitableEvent>, std::shared_ptr<Closure>>> mTaskQueue;
+};
+
+// AsyncWorkerPool implementation.
+std::shared_ptr<WaitableEvent> AsyncWorkerPool::postWorkerTask(std::shared_ptr<Closure> task)
+{
+ ASSERT(mMaxThreads > 0);
+
+ auto waitable = std::make_shared<AsyncWaitableEvent>();
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+ mTaskQueue.push(std::make_pair(waitable, task));
+ }
+ checkToRunPendingTasks();
+ return waitable;
+}
+
+void AsyncWorkerPool::setMaxThreads(size_t maxThreads)
+{
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+ mMaxThreads = (maxThreads == 0xFFFFFFFF ? std::thread::hardware_concurrency() : maxThreads);
+ }
+ checkToRunPendingTasks();
+}
+
+bool AsyncWorkerPool::isAsync()
+{
+ return true;
+}
+
+void AsyncWorkerPool::checkToRunPendingTasks()
+{
+ std::lock_guard<std::mutex> lock(mMutex);
+ while (mRunningThreads < mMaxThreads && !mTaskQueue.empty())
+ {
+ auto task = mTaskQueue.front();
+ mTaskQueue.pop();
+ auto waitable = task.first;
+ auto closure = task.second;
+
+ auto future = std::async(std::launch::async, [closure, this] {
+ (*closure)();
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+ ASSERT(mRunningThreads != 0);
+ --mRunningThreads;
+ }
+ checkToRunPendingTasks();
+ });
+
+ ++mRunningThreads;
+
+ {
+ std::lock_guard<std::mutex> waitableLock(waitable->mMutex);
+ waitable->mIsPending = false;
+ waitable->setFuture(std::move(future));
+ }
+ waitable->mCondition.notify_all();
+ }
+}
+#endif // (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
+
+// static
+std::shared_ptr<WorkerThreadPool> WorkerThreadPool::Create(bool multithreaded)
+{
+ std::shared_ptr<WorkerThreadPool> pool(nullptr);
+#if (ANGLE_STD_ASYNC_WORKERS == ANGLE_ENABLED)
+ if (multithreaded)
+ {
+ pool = std::shared_ptr<WorkerThreadPool>(static_cast<WorkerThreadPool *>(
+ new AsyncWorkerPool(std::thread::hardware_concurrency())));
+ }
+#endif
+ if (!pool)
+ {
+ return std::shared_ptr<WorkerThreadPool>(
+ static_cast<WorkerThreadPool *>(new SingleThreadedWorkerPool()));
+ }
+ return pool;
+}
+
+// static
+std::shared_ptr<WaitableEvent> WorkerThreadPool::PostWorkerTask(
+ std::shared_ptr<WorkerThreadPool> pool,
+ std::shared_ptr<Closure> task)
+{
+ std::shared_ptr<WaitableEvent> event = pool->postWorkerTask(task);
+ if (event.get())
+ {
+ event->setWorkerThreadPool(pool);
+ }
+ return event;
+}
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libANGLE/WorkerThread.h b/gfx/angle/checkout/src/libANGLE/WorkerThread.h
new file mode 100644
index 0000000000..b1f704f568
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/WorkerThread.h
@@ -0,0 +1,94 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// WorkerThread:
+// Asychronous tasks/threads for ANGLE, similar to a TaskRunner in Chromium.
+// Can be implemented as different targets, depending on platform.
+//
+
+#ifndef LIBANGLE_WORKER_THREAD_H_
+#define LIBANGLE_WORKER_THREAD_H_
+
+#include <array>
+#include <memory>
+#include <vector>
+
+#include "common/debug.h"
+#include "libANGLE/features.h"
+
+namespace angle
+{
+
+class WorkerThreadPool;
+
+// A callback function with no return value and no arguments.
+class Closure
+{
+ public:
+ virtual ~Closure() = default;
+ virtual void operator()() = 0;
+};
+
+// An event that we can wait on, useful for joining worker threads.
+class WaitableEvent : angle::NonCopyable
+{
+ public:
+ WaitableEvent();
+ virtual ~WaitableEvent();
+
+ // Waits indefinitely for the event to be signaled.
+ virtual void wait() = 0;
+
+ // Peeks whether the event is ready. If ready, wait() will not block.
+ virtual bool isReady() = 0;
+ void setWorkerThreadPool(std::shared_ptr<WorkerThreadPool> pool) { mPool = pool; }
+
+ template <size_t Count>
+ static void WaitMany(std::array<std::shared_ptr<WaitableEvent>, Count> *waitables)
+ {
+ ASSERT(Count > 0);
+ for (size_t index = 0; index < Count; ++index)
+ {
+ (*waitables)[index]->wait();
+ }
+ }
+
+ private:
+ std::shared_ptr<WorkerThreadPool> mPool;
+};
+
+// A dummy waitable event.
+class WaitableEventDone final : public WaitableEvent
+{
+ public:
+ void wait() override;
+ bool isReady() override;
+};
+
+// Request WorkerThreads from the WorkerThreadPool. Each pool can keep worker threads around so
+// we avoid the costly spin up and spin down time.
+class WorkerThreadPool : angle::NonCopyable
+{
+ public:
+ WorkerThreadPool();
+ virtual ~WorkerThreadPool();
+
+ static std::shared_ptr<WorkerThreadPool> Create(bool multithreaded);
+ static std::shared_ptr<WaitableEvent> PostWorkerTask(std::shared_ptr<WorkerThreadPool> pool,
+ std::shared_ptr<Closure> task);
+
+ virtual void setMaxThreads(size_t maxThreads) = 0;
+
+ virtual bool isAsync() = 0;
+
+ private:
+ // Returns an event to wait on for the task to finish.
+ // If the pool fails to create the task, returns null.
+ virtual std::shared_ptr<WaitableEvent> postWorkerTask(std::shared_ptr<Closure> task) = 0;
+};
+
+} // namespace angle
+
+#endif // LIBANGLE_WORKER_THREAD_H_
diff --git a/gfx/angle/checkout/src/libANGLE/angletypes.cpp b/gfx/angle/checkout/src/libANGLE/angletypes.cpp
new file mode 100644
index 0000000000..e8ea8f1548
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/angletypes.cpp
@@ -0,0 +1,389 @@
+//
+// 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 "libANGLE/angletypes.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/State.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/VertexAttribute.h"
+
+namespace gl
+{
+RasterizerState::RasterizerState()
+{
+ memset(this, 0, sizeof(RasterizerState));
+
+ rasterizerDiscard = false;
+ cullFace = false;
+ cullMode = CullFaceMode::Back;
+ frontFace = GL_CCW;
+ polygonOffsetFill = false;
+ polygonOffsetFactor = 0.0f;
+ polygonOffsetUnits = 0.0f;
+ pointDrawMode = false;
+ multiSample = false;
+}
+
+bool operator==(const RasterizerState &a, const RasterizerState &b)
+{
+ return memcmp(&a, &b, sizeof(RasterizerState)) == 0;
+}
+
+bool operator!=(const RasterizerState &a, const RasterizerState &b)
+{
+ return !(a == b);
+}
+
+BlendState::BlendState()
+{
+ memset(this, 0, sizeof(BlendState));
+
+ blend = false;
+ sourceBlendRGB = GL_ONE;
+ sourceBlendAlpha = GL_ONE;
+ destBlendRGB = GL_ZERO;
+ destBlendAlpha = GL_ZERO;
+ blendEquationRGB = GL_FUNC_ADD;
+ blendEquationAlpha = GL_FUNC_ADD;
+ sampleAlphaToCoverage = false;
+ dither = true;
+}
+
+BlendState::BlendState(const BlendState &other)
+{
+ memcpy(this, &other, sizeof(BlendState));
+}
+
+bool BlendState::allChannelsMasked() const
+{
+ return !colorMaskRed && !colorMaskGreen && !colorMaskBlue && !colorMaskAlpha;
+}
+
+bool operator==(const BlendState &a, const BlendState &b)
+{
+ return memcmp(&a, &b, sizeof(BlendState)) == 0;
+}
+
+bool operator!=(const BlendState &a, const BlendState &b)
+{
+ return !(a == b);
+}
+
+DepthStencilState::DepthStencilState()
+{
+ memset(this, 0, sizeof(DepthStencilState));
+
+ depthTest = false;
+ depthFunc = GL_LESS;
+ depthMask = true;
+ stencilTest = false;
+ stencilFunc = GL_ALWAYS;
+ stencilMask = static_cast<GLuint>(-1);
+ stencilWritemask = static_cast<GLuint>(-1);
+ stencilBackFunc = GL_ALWAYS;
+ stencilBackMask = static_cast<GLuint>(-1);
+ stencilBackWritemask = static_cast<GLuint>(-1);
+ stencilFail = GL_KEEP;
+ stencilPassDepthFail = GL_KEEP;
+ stencilPassDepthPass = GL_KEEP;
+ stencilBackFail = GL_KEEP;
+ stencilBackPassDepthFail = GL_KEEP;
+ stencilBackPassDepthPass = GL_KEEP;
+}
+
+DepthStencilState::DepthStencilState(const DepthStencilState &other)
+{
+ memcpy(this, &other, sizeof(DepthStencilState));
+}
+
+bool operator==(const DepthStencilState &a, const DepthStencilState &b)
+{
+ return memcmp(&a, &b, sizeof(DepthStencilState)) == 0;
+}
+
+bool operator!=(const DepthStencilState &a, const DepthStencilState &b)
+{
+ return !(a == b);
+}
+
+SamplerState::SamplerState()
+{
+ memset(this, 0, sizeof(SamplerState));
+
+ setMinFilter(GL_NEAREST_MIPMAP_LINEAR);
+ setMagFilter(GL_LINEAR);
+ setWrapS(GL_REPEAT);
+ setWrapT(GL_REPEAT);
+ setWrapR(GL_REPEAT);
+ setMaxAnisotropy(1.0f);
+ setMinLod(-1000.0f);
+ setMaxLod(1000.0f);
+ setCompareMode(GL_NONE);
+ setCompareFunc(GL_LEQUAL);
+ setSRGBDecode(GL_DECODE_EXT);
+}
+
+SamplerState::SamplerState(const SamplerState &other) = default;
+
+// static
+SamplerState SamplerState::CreateDefaultForTarget(TextureType type)
+{
+ SamplerState state;
+
+ // According to OES_EGL_image_external and ARB_texture_rectangle: For external textures, the
+ // default min filter is GL_LINEAR and the default s and t wrap modes are GL_CLAMP_TO_EDGE.
+ if (type == TextureType::External || type == TextureType::Rectangle)
+ {
+ state.mMinFilter = GL_LINEAR;
+ state.mWrapS = GL_CLAMP_TO_EDGE;
+ state.mWrapT = GL_CLAMP_TO_EDGE;
+ }
+
+ return state;
+}
+
+void SamplerState::setMinFilter(GLenum minFilter)
+{
+ mMinFilter = minFilter;
+ mCompleteness.typed.minFilter = static_cast<uint8_t>(FromGLenum<FilterMode>(minFilter));
+}
+
+void SamplerState::setMagFilter(GLenum magFilter)
+{
+ mMagFilter = magFilter;
+ mCompleteness.typed.magFilter = static_cast<uint8_t>(FromGLenum<FilterMode>(magFilter));
+}
+
+void SamplerState::setWrapS(GLenum wrapS)
+{
+ mWrapS = wrapS;
+ mCompleteness.typed.wrapS = static_cast<uint8_t>(FromGLenum<WrapMode>(wrapS));
+}
+
+void SamplerState::setWrapT(GLenum wrapT)
+{
+ mWrapT = wrapT;
+ updateWrapTCompareMode();
+}
+
+void SamplerState::setWrapR(GLenum wrapR)
+{
+ mWrapR = wrapR;
+}
+
+void SamplerState::setMaxAnisotropy(float maxAnisotropy)
+{
+ mMaxAnisotropy = maxAnisotropy;
+}
+
+void SamplerState::setMinLod(GLfloat minLod)
+{
+ mMinLod = minLod;
+}
+
+void SamplerState::setMaxLod(GLfloat maxLod)
+{
+ mMaxLod = maxLod;
+}
+
+void SamplerState::setCompareMode(GLenum compareMode)
+{
+ mCompareMode = compareMode;
+ updateWrapTCompareMode();
+}
+
+void SamplerState::setCompareFunc(GLenum compareFunc)
+{
+ mCompareFunc = compareFunc;
+}
+
+void SamplerState::setSRGBDecode(GLenum sRGBDecode)
+{
+ mSRGBDecode = sRGBDecode;
+}
+
+void SamplerState::setBorderColor(const ColorGeneric &color)
+{
+ mBorderColor = color;
+}
+
+void SamplerState::updateWrapTCompareMode()
+{
+ uint8_t wrap = static_cast<uint8_t>(FromGLenum<WrapMode>(mWrapT));
+ uint8_t compare = static_cast<uint8_t>(mCompareMode == GL_NONE ? 0x10 : 0x00);
+ mCompleteness.typed.wrapTCompareMode = wrap | compare;
+}
+
+ImageUnit::ImageUnit()
+ : texture(), level(0), layered(false), layer(0), access(GL_READ_ONLY), format(GL_R32UI)
+{}
+
+ImageUnit::ImageUnit(const ImageUnit &other) = default;
+
+ImageUnit::~ImageUnit() = default;
+
+static void MinMax(int a, int b, int *minimum, int *maximum)
+{
+ if (a < b)
+ {
+ *minimum = a;
+ *maximum = b;
+ }
+ else
+ {
+ *minimum = b;
+ *maximum = a;
+ }
+}
+
+Rectangle Rectangle::flip(bool flipX, bool flipY) const
+{
+ Rectangle flipped = *this;
+ if (flipX)
+ {
+ flipped.x = flipped.x + flipped.width;
+ flipped.width = -flipped.width;
+ }
+ if (flipY)
+ {
+ flipped.y = flipped.y + flipped.height;
+ flipped.height = -flipped.height;
+ }
+ return flipped;
+}
+
+Rectangle Rectangle::removeReversal() const
+{
+ return flip(isReversedX(), isReversedY());
+}
+
+bool Rectangle::encloses(const gl::Rectangle &inside) const
+{
+ return x0() <= inside.x0() && y0() <= inside.y0() && x1() >= inside.x1() && y1() >= inside.y1();
+}
+
+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)
+ {
+ return false;
+ }
+ 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;
+}
+
+bool Box::operator==(const Box &other) const
+{
+ return (x == other.x && y == other.y && z == other.z && width == other.width &&
+ height == other.height && depth == other.depth);
+}
+
+bool Box::operator!=(const Box &other) const
+{
+ return !(*this == other);
+}
+
+Rectangle Box::toRect() const
+{
+ ASSERT(z == 0 && depth == 1);
+ return Rectangle(x, y, width, height);
+}
+
+bool operator==(const Offset &a, const Offset &b)
+{
+ return a.x == b.x && a.y == b.y && a.z == b.z;
+}
+
+bool operator!=(const Offset &a, const Offset &b)
+{
+ return !(a == b);
+}
+
+bool operator==(const Extents &lhs, const Extents &rhs)
+{
+ return lhs.width == rhs.width && lhs.height == rhs.height && lhs.depth == rhs.depth;
+}
+
+bool operator!=(const Extents &lhs, const Extents &rhs)
+{
+ return !(lhs == rhs);
+}
+
+bool ValidateComponentTypeMasks(unsigned long outputTypes,
+ unsigned long inputTypes,
+ unsigned long outputMask,
+ unsigned long inputMask)
+{
+ static_assert(IMPLEMENTATION_MAX_DRAW_BUFFERS <= kMaxComponentTypeMaskIndex,
+ "Output/input masks should fit into 16 bits - 1 bit per draw buffer. The "
+ "corresponding type masks should fit into 32 bits - 2 bits per draw buffer.");
+ static_assert(MAX_VERTEX_ATTRIBS <= kMaxComponentTypeMaskIndex,
+ "Output/input masks should fit into 16 bits - 1 bit per attrib. The "
+ "corresponding type masks should fit into 32 bits - 2 bits per attrib.");
+
+ // For performance reasons, draw buffer and attribute type validation is done using bit masks.
+ // We store two bits representing the type split, with the low bit in the lower 16 bits of the
+ // variable, and the high bit in the upper 16 bits of the variable. This is done so we can AND
+ // with the elswewhere used DrawBufferMask or AttributeMask.
+
+ // OR the masks with themselves, shifted 16 bits. This is to match our split type bits.
+ outputMask |= (outputMask << kMaxComponentTypeMaskIndex);
+ inputMask |= (inputMask << kMaxComponentTypeMaskIndex);
+
+ // To validate:
+ // 1. Remove any indexes that are not enabled in the input (& inputMask)
+ // 2. Remove any indexes that exist in output, but not in input (& outputMask)
+ // 3. Use == to verify equality
+ return (outputTypes & inputMask) == ((inputTypes & outputMask) & inputMask);
+}
+
+GLsizeiptr GetBoundBufferAvailableSize(const OffsetBindingPointer<Buffer> &binding)
+{
+ Buffer *buffer = binding.get();
+ if (buffer)
+ {
+ if (binding.getSize() == 0)
+ return static_cast<GLsizeiptr>(buffer->getSize());
+ angle::CheckedNumeric<GLintptr> offset = binding.getOffset();
+ angle::CheckedNumeric<GLsizeiptr> size = binding.getSize();
+ angle::CheckedNumeric<GLsizeiptr> bufferSize = buffer->getSize();
+ auto end = offset + size;
+ auto clampedSize = size;
+ auto difference = end - bufferSize;
+ if (!difference.IsValid())
+ {
+ return 0;
+ }
+ if (difference.ValueOrDie() > 0)
+ {
+ clampedSize = size - difference;
+ }
+ return clampedSize.ValueOrDefault(0);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/angletypes.h b/gfx/angle/checkout/src/libANGLE/angletypes.h
new file mode 100644
index 0000000000..d859073fb6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/angletypes.h
@@ -0,0 +1,692 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// angletypes.h : Defines a variety of structures and enum types that are used throughout libGLESv2
+
+#ifndef LIBANGLE_ANGLETYPES_H_
+#define LIBANGLE_ANGLETYPES_H_
+
+#include "common/Color.h"
+#include "common/FixedVector.h"
+#include "common/PackedEnums.h"
+#include "common/bitset_utils.h"
+#include "common/vector_utils.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/RefCountObject.h"
+
+#include <inttypes.h>
+#include <stdint.h>
+
+#include <bitset>
+#include <map>
+#include <unordered_map>
+
+namespace gl
+{
+class Buffer;
+class Texture;
+
+struct Rectangle
+{
+ Rectangle() : x(0), y(0), width(0), height(0) {}
+ constexpr 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)
+ {}
+
+ int x0() const { return x; }
+ int y0() const { return y; }
+ int x1() const { return x + width; }
+ int y1() const { return y + height; }
+
+ bool isReversedX() const { return width < 0; }
+ bool isReversedY() const { return height < 0; }
+
+ // Returns a rectangle with the same area but flipped in X, Y, neither or both.
+ Rectangle flip(bool flipX, bool flipY) const;
+
+ // Returns a rectangle with the same area but with height and width guaranteed to be positive.
+ Rectangle removeReversal() const;
+
+ bool encloses(const gl::Rectangle &inside) const;
+
+ int x;
+ int y;
+ int width;
+ int height;
+};
+
+bool operator==(const Rectangle &a, const Rectangle &b);
+bool operator!=(const Rectangle &a, const Rectangle &b);
+
+bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *intersection);
+
+struct Offset
+{
+ constexpr Offset() : x(0), y(0), z(0) {}
+ constexpr Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) {}
+
+ int x;
+ int y;
+ int z;
+};
+
+constexpr Offset kOffsetZero(0, 0, 0);
+
+bool operator==(const Offset &a, const Offset &b);
+bool operator!=(const Offset &a, const Offset &b);
+
+struct Extents
+{
+ Extents() : width(0), height(0), depth(0) {}
+ Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) {}
+
+ Extents(const Extents &other) = default;
+ Extents &operator=(const Extents &other) = default;
+
+ bool empty() const { return (width * height * depth) == 0; }
+
+ int width;
+ int height;
+ int depth;
+};
+
+bool operator==(const Extents &lhs, const Extents &rhs);
+bool operator!=(const Extents &lhs, const Extents &rhs);
+
+struct Box
+{
+ Box() : x(0), y(0), z(0), width(0), height(0), depth(0) {}
+ Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in)
+ : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in)
+ {}
+ Box(const Offset &offset, const Extents &size)
+ : x(offset.x),
+ y(offset.y),
+ z(offset.z),
+ width(size.width),
+ height(size.height),
+ depth(size.depth)
+ {}
+ bool operator==(const Box &other) const;
+ bool operator!=(const Box &other) const;
+ Rectangle toRect() const;
+
+ int x;
+ int y;
+ int z;
+ int width;
+ int height;
+ int depth;
+};
+
+struct RasterizerState final
+{
+ // This will zero-initialize the struct, including padding.
+ RasterizerState();
+
+ bool cullFace;
+ CullFaceMode cullMode;
+ GLenum frontFace;
+
+ bool polygonOffsetFill;
+ GLfloat polygonOffsetFactor;
+ GLfloat polygonOffsetUnits;
+
+ bool pointDrawMode;
+ bool multiSample;
+
+ bool rasterizerDiscard;
+};
+
+bool operator==(const RasterizerState &a, const RasterizerState &b);
+bool operator!=(const RasterizerState &a, const RasterizerState &b);
+
+struct BlendState final
+{
+ // This will zero-initialize the struct, including padding.
+ BlendState();
+ BlendState(const BlendState &other);
+
+ bool allChannelsMasked() const;
+
+ bool blend;
+ GLenum sourceBlendRGB;
+ GLenum destBlendRGB;
+ GLenum sourceBlendAlpha;
+ GLenum destBlendAlpha;
+ GLenum blendEquationRGB;
+ GLenum blendEquationAlpha;
+
+ bool colorMaskRed;
+ bool colorMaskGreen;
+ bool colorMaskBlue;
+ bool colorMaskAlpha;
+
+ bool sampleAlphaToCoverage;
+
+ bool dither;
+};
+
+bool operator==(const BlendState &a, const BlendState &b);
+bool operator!=(const BlendState &a, const BlendState &b);
+
+struct DepthStencilState final
+{
+ // This will zero-initialize the struct, including padding.
+ DepthStencilState();
+ DepthStencilState(const DepthStencilState &other);
+
+ bool depthTest;
+ GLenum depthFunc;
+ bool depthMask;
+
+ bool stencilTest;
+ GLenum stencilFunc;
+ GLuint stencilMask;
+ GLenum stencilFail;
+ GLenum stencilPassDepthFail;
+ GLenum stencilPassDepthPass;
+ GLuint stencilWritemask;
+ GLenum stencilBackFunc;
+ GLuint stencilBackMask;
+ GLenum stencilBackFail;
+ GLenum stencilBackPassDepthFail;
+ GLenum stencilBackPassDepthPass;
+ GLuint stencilBackWritemask;
+};
+
+bool operator==(const DepthStencilState &a, const DepthStencilState &b);
+bool operator!=(const DepthStencilState &a, const DepthStencilState &b);
+
+// Packs a sampler state for completeness checks:
+// * minFilter: 5 values (3 bits)
+// * magFilter: 2 values (1 bit)
+// * wrapS: 3 values (2 bits)
+// * wrapT: 3 values (2 bits)
+// * compareMode: 1 bit (for == GL_NONE).
+// This makes a total of 9 bits. We can pack this easily into 32 bits:
+// * minFilter: 8 bits
+// * magFilter: 8 bits
+// * wrapS: 8 bits
+// * wrapT: 4 bits
+// * compareMode: 4 bits
+
+struct PackedSamplerCompleteness
+{
+ uint8_t minFilter;
+ uint8_t magFilter;
+ uint8_t wrapS;
+ uint8_t wrapTCompareMode;
+};
+
+static_assert(sizeof(PackedSamplerCompleteness) == sizeof(uint32_t), "Unexpected size");
+
+// State from Table 6.10 (state per sampler object)
+class SamplerState final
+{
+ public:
+ // This will zero-initialize the struct, including padding.
+ SamplerState();
+ SamplerState(const SamplerState &other);
+
+ static SamplerState CreateDefaultForTarget(TextureType type);
+
+ GLenum getMinFilter() const { return mMinFilter; }
+
+ void setMinFilter(GLenum minFilter);
+
+ GLenum getMagFilter() const { return mMagFilter; }
+
+ void setMagFilter(GLenum magFilter);
+
+ GLenum getWrapS() const { return mWrapS; }
+
+ void setWrapS(GLenum wrapS);
+
+ GLenum getWrapT() const { return mWrapT; }
+
+ void setWrapT(GLenum wrapT);
+
+ GLenum getWrapR() const { return mWrapR; }
+
+ void setWrapR(GLenum wrapR);
+
+ float getMaxAnisotropy() const { return mMaxAnisotropy; }
+
+ void setMaxAnisotropy(float maxAnisotropy);
+
+ GLfloat getMinLod() const { return mMinLod; }
+
+ void setMinLod(GLfloat minLod);
+
+ GLfloat getMaxLod() const { return mMaxLod; }
+
+ void setMaxLod(GLfloat maxLod);
+
+ GLenum getCompareMode() const { return mCompareMode; }
+
+ void setCompareMode(GLenum compareMode);
+
+ GLenum getCompareFunc() const { return mCompareFunc; }
+
+ void setCompareFunc(GLenum compareFunc);
+
+ GLenum getSRGBDecode() const { return mSRGBDecode; }
+
+ void setSRGBDecode(GLenum sRGBDecode);
+
+ void setBorderColor(const ColorGeneric &color);
+
+ const ColorGeneric &getBorderColor() const { return mBorderColor; }
+
+ bool sameCompleteness(const SamplerState &samplerState) const
+ {
+ return mCompleteness.packed == samplerState.mCompleteness.packed;
+ }
+
+ private:
+ void updateWrapTCompareMode();
+
+ GLenum mMinFilter;
+ GLenum mMagFilter;
+
+ GLenum mWrapS;
+ GLenum mWrapT;
+ GLenum mWrapR;
+
+ // From EXT_texture_filter_anisotropic
+ float mMaxAnisotropy;
+
+ GLfloat mMinLod;
+ GLfloat mMaxLod;
+
+ GLenum mCompareMode;
+ GLenum mCompareFunc;
+
+ GLenum mSRGBDecode;
+
+ ColorGeneric mBorderColor;
+
+ union Completeness
+ {
+ uint32_t packed;
+ PackedSamplerCompleteness typed;
+ };
+
+ Completeness mCompleteness;
+};
+
+bool operator==(const SamplerState &a, const SamplerState &b);
+bool operator!=(const SamplerState &a, const SamplerState &b);
+
+struct DrawArraysIndirectCommand
+{
+ GLuint count;
+ GLuint instanceCount;
+ GLuint first;
+ GLuint baseInstance;
+};
+static_assert(sizeof(DrawArraysIndirectCommand) == 16,
+ "Unexpected size of DrawArraysIndirectCommand");
+
+struct DrawElementsIndirectCommand
+{
+ GLuint count;
+ GLuint primCount;
+ GLuint firstIndex;
+ GLint baseVertex;
+ GLuint baseInstance;
+};
+static_assert(sizeof(DrawElementsIndirectCommand) == 20,
+ "Unexpected size of DrawElementsIndirectCommand");
+
+struct ImageUnit
+{
+ ImageUnit();
+ ImageUnit(const ImageUnit &other);
+ ~ImageUnit();
+
+ BindingPointer<Texture> texture;
+ GLint level;
+ GLboolean layered;
+ GLint layer;
+ GLenum access;
+ GLenum format;
+};
+
+using ImageUnitTextureTypeMap = std::map<unsigned int, gl::TextureType>;
+
+struct PixelStoreStateBase
+{
+ GLint alignment = 4;
+ GLint rowLength = 0;
+ GLint skipRows = 0;
+ GLint skipPixels = 0;
+ GLint imageHeight = 0;
+ GLint skipImages = 0;
+};
+
+struct PixelUnpackState : PixelStoreStateBase
+{};
+
+struct PixelPackState : PixelStoreStateBase
+{
+ bool reverseRowOrder = false;
+};
+
+// Used in Program and VertexArray.
+using AttributesMask = angle::BitSet<MAX_VERTEX_ATTRIBS>;
+
+// Used in Program
+using UniformBlockBindingMask = angle::BitSet<IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS>;
+
+// Used in Framebuffer / Program
+using DrawBufferMask = angle::BitSet<IMPLEMENTATION_MAX_DRAW_BUFFERS>;
+
+template <typename T>
+using TexLevelArray = std::array<T, IMPLEMENTATION_MAX_TEXTURE_LEVELS>;
+
+enum class ComponentType
+{
+ Float = 0,
+ Int = 1,
+ UnsignedInt = 2,
+ NoType = 3,
+ EnumCount = 4,
+ InvalidEnum = 4,
+};
+
+constexpr ComponentType GLenumToComponentType(GLenum componentType)
+{
+ switch (componentType)
+ {
+ case GL_FLOAT:
+ return ComponentType::Float;
+ case GL_INT:
+ return ComponentType::Int;
+ case GL_UNSIGNED_INT:
+ return ComponentType::UnsignedInt;
+ case GL_NONE:
+ return ComponentType::NoType;
+ default:
+ return ComponentType::InvalidEnum;
+ }
+}
+
+constexpr angle::PackedEnumMap<ComponentType, uint32_t> kComponentMasks = {{
+ {ComponentType::Float, 0x10001},
+ {ComponentType::Int, 0x00001},
+ {ComponentType::UnsignedInt, 0x10000},
+}};
+
+constexpr size_t kMaxComponentTypeMaskIndex = 16;
+using ComponentTypeMask = angle::BitSet<kMaxComponentTypeMaskIndex * 2>;
+
+ANGLE_INLINE void SetComponentTypeMask(ComponentType type, size_t index, ComponentTypeMask *mask)
+{
+ ASSERT(index <= kMaxComponentTypeMaskIndex);
+ *mask &= ~(0x10001 << index);
+ *mask |= kComponentMasks[type] << index;
+}
+
+ANGLE_INLINE ComponentType GetComponentTypeMask(const ComponentTypeMask &mask, size_t index)
+{
+ ASSERT(index <= kMaxComponentTypeMaskIndex);
+ uint32_t mask_bits = static_cast<uint32_t>((mask.to_ulong() >> index) & 0x10001);
+ switch (mask_bits)
+ {
+ case 0x10001:
+ return ComponentType::Float;
+ case 0x00001:
+ return ComponentType::Int;
+ case 0x10000:
+ return ComponentType::UnsignedInt;
+ default:
+ return ComponentType::InvalidEnum;
+ }
+}
+
+bool ValidateComponentTypeMasks(unsigned long outputTypes,
+ unsigned long inputTypes,
+ unsigned long outputMask,
+ unsigned long inputMask);
+
+using ContextID = uintptr_t;
+
+constexpr size_t kCubeFaceCount = 6;
+
+using TextureMap = angle::PackedEnumMap<TextureType, BindingPointer<Texture>>;
+
+// ShaderVector can contain one item per shader. It differs from ShaderMap in that the values are
+// not indexed by ShaderType.
+template <typename T>
+using ShaderVector = angle::FixedVector<T, static_cast<size_t>(ShaderType::EnumCount)>;
+
+template <typename T>
+using AttachmentArray = std::array<T, IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS>;
+
+template <typename T>
+using DrawBuffersArray = std::array<T, IMPLEMENTATION_MAX_DRAW_BUFFERS>;
+
+template <typename T>
+using DrawBuffersVector = angle::FixedVector<T, IMPLEMENTATION_MAX_DRAW_BUFFERS>;
+
+template <typename T>
+using AttribArray = std::array<T, MAX_VERTEX_ATTRIBS>;
+
+using ActiveTextureMask = angle::BitSet<IMPLEMENTATION_MAX_ACTIVE_TEXTURES>;
+
+template <typename T>
+using ActiveTextureArray = std::array<T, IMPLEMENTATION_MAX_ACTIVE_TEXTURES>;
+
+using ActiveTexturePointerArray = ActiveTextureArray<Texture *>;
+using ActiveTextureTypeArray = ActiveTextureArray<TextureType>;
+
+template <typename T>
+using UniformBuffersArray = std::array<T, IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS>;
+template <typename T>
+using StorageBuffersArray = std::array<T, IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS>;
+template <typename T>
+using AtomicCounterBuffersArray = std::array<T, IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS>;
+
+using ImageUnitMask = angle::BitSet<IMPLEMENTATION_MAX_IMAGE_UNITS>;
+
+using SupportedSampleSet = std::set<GLuint>;
+
+template <typename T>
+using TransformFeedbackBuffersArray =
+ std::array<T, gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS>;
+
+constexpr size_t kBarrierVectorDefaultSize = 16;
+using BufferBarrierVector = angle::FastVector<Buffer *, kBarrierVectorDefaultSize>;
+
+struct TextureAndLayout
+{
+ Texture *texture;
+ GLenum layout;
+};
+using TextureBarrierVector = angle::FastVector<TextureAndLayout, kBarrierVectorDefaultSize>;
+
+// OffsetBindingPointer.getSize() returns the size specified by the user, which may be larger than
+// the size of the bound buffer. This function reduces the returned size to fit the bound buffer if
+// necessary. Returns 0 if no buffer is bound or if integer overflow occurs.
+GLsizeiptr GetBoundBufferAvailableSize(const OffsetBindingPointer<Buffer> &binding);
+
+} // namespace gl
+
+namespace rx
+{
+// A macro that determines whether an object has a given runtime type.
+#if defined(__clang__)
+# if __has_feature(cxx_rtti)
+# define ANGLE_HAS_DYNAMIC_CAST 1
+# endif
+#elif !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && \
+ (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || \
+ defined(__GXX_RTTI))
+# define ANGLE_HAS_DYNAMIC_CAST 1
+#endif
+
+#ifdef ANGLE_HAS_DYNAMIC_CAST
+# define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast<type>(obj) != nullptr)
+# undef ANGLE_HAS_DYNAMIC_CAST
+#else
+# define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (obj != nullptr)
+#endif
+
+// Downcast a base implementation object (EG TextureImpl to TextureD3D)
+template <typename DestT, typename SrcT>
+inline DestT *GetAs(SrcT *src)
+{
+ ASSERT(ANGLE_HAS_DYNAMIC_TYPE(DestT *, src));
+ return static_cast<DestT *>(src);
+}
+
+template <typename DestT, typename SrcT>
+inline const DestT *GetAs(const SrcT *src)
+{
+ ASSERT(ANGLE_HAS_DYNAMIC_TYPE(const DestT *, src));
+ return static_cast<const DestT *>(src);
+}
+
+#undef ANGLE_HAS_DYNAMIC_TYPE
+
+// Downcast a GL object to an Impl (EG gl::Texture to rx::TextureD3D)
+template <typename DestT, typename SrcT>
+inline DestT *GetImplAs(SrcT *src)
+{
+ return GetAs<DestT>(src->getImplementation());
+}
+
+template <typename DestT, typename SrcT>
+inline DestT *SafeGetImplAs(SrcT *src)
+{
+ return src != nullptr ? GetAs<DestT>(src->getImplementation()) : nullptr;
+}
+
+} // namespace rx
+
+#include "angletypes.inc"
+
+namespace angle
+{
+// Zero-based for better array indexing
+enum FramebufferBinding
+{
+ FramebufferBindingRead = 0,
+ FramebufferBindingDraw,
+ FramebufferBindingSingletonMax,
+ FramebufferBindingBoth = FramebufferBindingSingletonMax,
+ FramebufferBindingMax,
+ FramebufferBindingUnknown = FramebufferBindingMax,
+};
+
+inline FramebufferBinding EnumToFramebufferBinding(GLenum enumValue)
+{
+ switch (enumValue)
+ {
+ case GL_READ_FRAMEBUFFER:
+ return FramebufferBindingRead;
+ case GL_DRAW_FRAMEBUFFER:
+ return FramebufferBindingDraw;
+ case GL_FRAMEBUFFER:
+ return FramebufferBindingBoth;
+ default:
+ UNREACHABLE();
+ return FramebufferBindingUnknown;
+ }
+}
+
+inline GLenum FramebufferBindingToEnum(FramebufferBinding binding)
+{
+ switch (binding)
+ {
+ case FramebufferBindingRead:
+ return GL_READ_FRAMEBUFFER;
+ case FramebufferBindingDraw:
+ return GL_DRAW_FRAMEBUFFER;
+ case FramebufferBindingBoth:
+ return GL_FRAMEBUFFER;
+ default:
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+template <typename ObjT, typename ContextT>
+class DestroyThenDelete
+{
+ public:
+ DestroyThenDelete(const ContextT *context) : mContext(context) {}
+
+ void operator()(ObjT *obj)
+ {
+ (void)(obj->onDestroy(mContext));
+ delete obj;
+ }
+
+ private:
+ const ContextT *mContext;
+};
+
+// Helper class for wrapping an onDestroy function.
+template <typename ObjT, typename DeleterT>
+class UniqueObjectPointerBase : angle::NonCopyable
+{
+ public:
+ template <typename ContextT>
+ UniqueObjectPointerBase(const ContextT *context) : mObject(nullptr), mDeleter(context)
+ {}
+
+ template <typename ContextT>
+ UniqueObjectPointerBase(ObjT *obj, const ContextT *context) : mObject(obj), mDeleter(context)
+ {}
+
+ ~UniqueObjectPointerBase()
+ {
+ if (mObject)
+ {
+ mDeleter(mObject);
+ }
+ }
+
+ ObjT *operator->() const { return mObject; }
+
+ ObjT *release()
+ {
+ auto obj = mObject;
+ mObject = nullptr;
+ return obj;
+ }
+
+ ObjT *get() const { return mObject; }
+
+ void reset(ObjT *obj)
+ {
+ if (mObject)
+ {
+ mDeleter(mObject);
+ }
+ mObject = obj;
+ }
+
+ private:
+ ObjT *mObject;
+ DeleterT mDeleter;
+};
+
+template <typename ObjT, typename ContextT>
+using UniqueObjectPointer = UniqueObjectPointerBase<ObjT, DestroyThenDelete<ObjT, ContextT>>;
+
+} // namespace angle
+
+namespace gl
+{
+class State;
+} // namespace gl
+
+#endif // LIBANGLE_ANGLETYPES_H_
diff --git a/gfx/angle/checkout/src/libANGLE/angletypes.inc b/gfx/angle/checkout/src/libANGLE/angletypes.inc
new file mode 100644
index 0000000000..67b9274b5d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/angletypes.inc
@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2012-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// angletypes.inc : Inline definitions of some functions from angletypes.h
+
+namespace gl
+{
+
+inline bool operator==(const Rectangle &a, const Rectangle &b)
+{
+ return a.x == b.x &&
+ a.y == b.y &&
+ a.width == b.width &&
+ a.height == b.height;
+}
+
+inline bool operator!=(const Rectangle &a, const Rectangle &b)
+{
+ return !(a == b);
+}
+
+inline bool operator==(const SamplerState &a, const SamplerState &b)
+{
+ return memcmp(&a, &b, sizeof(SamplerState)) == 0;
+}
+
+inline bool operator!=(const SamplerState &a, const SamplerState &b)
+{
+ return !(a == b);
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/capture_gles_1_0_autogen.h b/gfx/angle/checkout/src/libANGLE/capture_gles_1_0_autogen.h
new file mode 100644
index 0000000000..781ca301ef
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/capture_gles_1_0_autogen.h
@@ -0,0 +1,603 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// capture_gles_1_0_autogen.h:
+// Capture functions for the OpenGL ES 1.0 entry points.
+
+#ifndef LIBANGLE_CAPTURE_GLES_1_0_AUTOGEN_H_
+#define LIBANGLE_CAPTURE_GLES_1_0_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/FrameCapture.h"
+
+namespace gl
+{
+class Context;
+
+// Method Captures
+
+angle::CallCapture CaptureAlphaFunc(const Context *context,
+ bool isCallValid,
+ AlphaTestFunc funcPacked,
+ GLfloat ref);
+angle::CallCapture CaptureAlphaFuncx(const Context *context,
+ bool isCallValid,
+ AlphaTestFunc funcPacked,
+ GLfixed ref);
+angle::CallCapture CaptureClearColorx(const Context *context,
+ bool isCallValid,
+ GLfixed red,
+ GLfixed green,
+ GLfixed blue,
+ GLfixed alpha);
+angle::CallCapture CaptureClearDepthx(const Context *context, bool isCallValid, GLfixed depth);
+angle::CallCapture CaptureClientActiveTexture(const Context *context,
+ bool isCallValid,
+ GLenum texture);
+angle::CallCapture CaptureClipPlanef(const Context *context,
+ bool isCallValid,
+ GLenum p,
+ const GLfloat *eqn);
+angle::CallCapture CaptureClipPlanex(const Context *context,
+ bool isCallValid,
+ GLenum plane,
+ const GLfixed *equation);
+angle::CallCapture CaptureColor4f(const Context *context,
+ bool isCallValid,
+ GLfloat red,
+ GLfloat green,
+ GLfloat blue,
+ GLfloat alpha);
+angle::CallCapture CaptureColor4ub(const Context *context,
+ bool isCallValid,
+ GLubyte red,
+ GLubyte green,
+ GLubyte blue,
+ GLubyte alpha);
+angle::CallCapture CaptureColor4x(const Context *context,
+ bool isCallValid,
+ GLfixed red,
+ GLfixed green,
+ GLfixed blue,
+ GLfixed alpha);
+angle::CallCapture CaptureColorPointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+angle::CallCapture CaptureDepthRangex(const Context *context,
+ bool isCallValid,
+ GLfixed n,
+ GLfixed f);
+angle::CallCapture CaptureDisableClientState(const Context *context,
+ bool isCallValid,
+ ClientVertexArrayType arrayPacked);
+angle::CallCapture CaptureEnableClientState(const Context *context,
+ bool isCallValid,
+ ClientVertexArrayType arrayPacked);
+angle::CallCapture CaptureFogf(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfloat param);
+angle::CallCapture CaptureFogfv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfloat *params);
+angle::CallCapture CaptureFogx(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfixed param);
+angle::CallCapture CaptureFogxv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfixed *param);
+angle::CallCapture CaptureFrustumf(const Context *context,
+ bool isCallValid,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f);
+angle::CallCapture CaptureFrustumx(const Context *context,
+ bool isCallValid,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f);
+angle::CallCapture CaptureGetClipPlanef(const Context *context,
+ bool isCallValid,
+ GLenum plane,
+ GLfloat *equation);
+angle::CallCapture CaptureGetClipPlanex(const Context *context,
+ bool isCallValid,
+ GLenum plane,
+ GLfixed *equation);
+angle::CallCapture CaptureGetFixedv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfixed *params);
+angle::CallCapture CaptureGetLightfv(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfloat *params);
+angle::CallCapture CaptureGetLightxv(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfixed *params);
+angle::CallCapture CaptureGetMaterialfv(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfloat *params);
+angle::CallCapture CaptureGetMaterialxv(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfixed *params);
+angle::CallCapture CaptureGetPointerv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ void **params);
+angle::CallCapture CaptureGetTexEnvfv(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfloat *params);
+angle::CallCapture CaptureGetTexEnviv(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLint *params);
+angle::CallCapture CaptureGetTexEnvxv(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfixed *params);
+angle::CallCapture CaptureGetTexParameterxv(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfixed *params);
+angle::CallCapture CaptureLightModelf(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfloat param);
+angle::CallCapture CaptureLightModelfv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfloat *params);
+angle::CallCapture CaptureLightModelx(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfixed param);
+angle::CallCapture CaptureLightModelxv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfixed *param);
+angle::CallCapture CaptureLightf(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfloat param);
+angle::CallCapture CaptureLightfv(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ const GLfloat *params);
+angle::CallCapture CaptureLightx(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfixed param);
+angle::CallCapture CaptureLightxv(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ const GLfixed *params);
+angle::CallCapture CaptureLineWidthx(const Context *context, bool isCallValid, GLfixed width);
+angle::CallCapture CaptureLoadIdentity(const Context *context, bool isCallValid);
+angle::CallCapture CaptureLoadMatrixf(const Context *context, bool isCallValid, const GLfloat *m);
+angle::CallCapture CaptureLoadMatrixx(const Context *context, bool isCallValid, const GLfixed *m);
+angle::CallCapture CaptureLogicOp(const Context *context,
+ bool isCallValid,
+ LogicalOperation opcodePacked);
+angle::CallCapture CaptureMaterialf(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfloat param);
+angle::CallCapture CaptureMaterialfv(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ const GLfloat *params);
+angle::CallCapture CaptureMaterialx(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfixed param);
+angle::CallCapture CaptureMaterialxv(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ const GLfixed *param);
+angle::CallCapture CaptureMatrixMode(const Context *context,
+ bool isCallValid,
+ MatrixType modePacked);
+angle::CallCapture CaptureMultMatrixf(const Context *context, bool isCallValid, const GLfloat *m);
+angle::CallCapture CaptureMultMatrixx(const Context *context, bool isCallValid, const GLfixed *m);
+angle::CallCapture CaptureMultiTexCoord4f(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLfloat s,
+ GLfloat t,
+ GLfloat r,
+ GLfloat q);
+angle::CallCapture CaptureMultiTexCoord4x(const Context *context,
+ bool isCallValid,
+ GLenum texture,
+ GLfixed s,
+ GLfixed t,
+ GLfixed r,
+ GLfixed q);
+angle::CallCapture CaptureNormal3f(const Context *context,
+ bool isCallValid,
+ GLfloat nx,
+ GLfloat ny,
+ GLfloat nz);
+angle::CallCapture CaptureNormal3x(const Context *context,
+ bool isCallValid,
+ GLfixed nx,
+ GLfixed ny,
+ GLfixed nz);
+angle::CallCapture CaptureNormalPointer(const Context *context,
+ bool isCallValid,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+angle::CallCapture CaptureOrthof(const Context *context,
+ bool isCallValid,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f);
+angle::CallCapture CaptureOrthox(const Context *context,
+ bool isCallValid,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f);
+angle::CallCapture CapturePointParameterf(const Context *context,
+ bool isCallValid,
+ PointParameter pnamePacked,
+ GLfloat param);
+angle::CallCapture CapturePointParameterfv(const Context *context,
+ bool isCallValid,
+ PointParameter pnamePacked,
+ const GLfloat *params);
+angle::CallCapture CapturePointParameterx(const Context *context,
+ bool isCallValid,
+ PointParameter pnamePacked,
+ GLfixed param);
+angle::CallCapture CapturePointParameterxv(const Context *context,
+ bool isCallValid,
+ PointParameter pnamePacked,
+ const GLfixed *params);
+angle::CallCapture CapturePointSize(const Context *context, bool isCallValid, GLfloat size);
+angle::CallCapture CapturePointSizex(const Context *context, bool isCallValid, GLfixed size);
+angle::CallCapture CapturePolygonOffsetx(const Context *context,
+ bool isCallValid,
+ GLfixed factor,
+ GLfixed units);
+angle::CallCapture CapturePopMatrix(const Context *context, bool isCallValid);
+angle::CallCapture CapturePushMatrix(const Context *context, bool isCallValid);
+angle::CallCapture CaptureRotatef(const Context *context,
+ bool isCallValid,
+ GLfloat angle,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+angle::CallCapture CaptureRotatex(const Context *context,
+ bool isCallValid,
+ GLfixed angle,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z);
+angle::CallCapture CaptureSampleCoveragex(const Context *context,
+ bool isCallValid,
+ GLclampx value,
+ GLboolean invert);
+angle::CallCapture CaptureScalef(const Context *context,
+ bool isCallValid,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+angle::CallCapture CaptureScalex(const Context *context,
+ bool isCallValid,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z);
+angle::CallCapture CaptureShadeModel(const Context *context,
+ bool isCallValid,
+ ShadingModel modePacked);
+angle::CallCapture CaptureTexCoordPointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+angle::CallCapture CaptureTexEnvf(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfloat param);
+angle::CallCapture CaptureTexEnvfv(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLfloat *params);
+angle::CallCapture CaptureTexEnvi(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLint param);
+angle::CallCapture CaptureTexEnviv(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLint *params);
+angle::CallCapture CaptureTexEnvx(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfixed param);
+angle::CallCapture CaptureTexEnvxv(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLfixed *params);
+angle::CallCapture CaptureTexParameterx(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfixed param);
+angle::CallCapture CaptureTexParameterxv(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLfixed *params);
+angle::CallCapture CaptureTranslatef(const Context *context,
+ bool isCallValid,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+angle::CallCapture CaptureTranslatex(const Context *context,
+ bool isCallValid,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z);
+angle::CallCapture CaptureVertexPointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+
+// Parameter Captures
+
+void CaptureClipPlanef_eqn(const Context *context,
+ bool isCallValid,
+ GLenum p,
+ const GLfloat *eqn,
+ angle::ParamCapture *paramCapture);
+void CaptureClipPlanex_equation(const Context *context,
+ bool isCallValid,
+ GLenum plane,
+ const GLfixed *equation,
+ angle::ParamCapture *paramCapture);
+void CaptureColorPointer_pointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+void CaptureFogfv_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureFogxv_param(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfixed *param,
+ angle::ParamCapture *paramCapture);
+void CaptureGetClipPlanef_equation(const Context *context,
+ bool isCallValid,
+ GLenum plane,
+ GLfloat *equation,
+ angle::ParamCapture *paramCapture);
+void CaptureGetClipPlanex_equation(const Context *context,
+ bool isCallValid,
+ GLenum plane,
+ GLfixed *equation,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFixedv_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetLightfv_params(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetLightxv_params(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetMaterialfv_params(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetMaterialxv_params(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetPointerv_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexEnvfv_params(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexEnviv_params(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexEnvxv_params(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterxv_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureLightModelfv_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureLightModelxv_param(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ const GLfixed *param,
+ angle::ParamCapture *paramCapture);
+void CaptureLightfv_params(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureLightxv_params(const Context *context,
+ bool isCallValid,
+ GLenum light,
+ LightParameter pnamePacked,
+ const GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureLoadMatrixf_m(const Context *context,
+ bool isCallValid,
+ const GLfloat *m,
+ angle::ParamCapture *paramCapture);
+void CaptureLoadMatrixx_m(const Context *context,
+ bool isCallValid,
+ const GLfixed *m,
+ angle::ParamCapture *paramCapture);
+void CaptureMaterialfv_params(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureMaterialxv_param(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ const GLfixed *param,
+ angle::ParamCapture *paramCapture);
+void CaptureMultMatrixf_m(const Context *context,
+ bool isCallValid,
+ const GLfloat *m,
+ angle::ParamCapture *paramCapture);
+void CaptureMultMatrixx_m(const Context *context,
+ bool isCallValid,
+ const GLfixed *m,
+ angle::ParamCapture *paramCapture);
+void CaptureNormalPointer_pointer(const Context *context,
+ bool isCallValid,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+void CapturePointParameterfv_params(const Context *context,
+ bool isCallValid,
+ PointParameter pnamePacked,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CapturePointParameterxv_params(const Context *context,
+ bool isCallValid,
+ PointParameter pnamePacked,
+ const GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexCoordPointer_pointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+void CaptureTexEnvfv_params(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexEnviv_params(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexEnvxv_params(const Context *context,
+ bool isCallValid,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterxv_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexPointer_pointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+} // namespace gl
+
+#endif // LIBANGLE_CAPTURE_GLES_1_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/capture_gles_2_0_autogen.h b/gfx/angle/checkout/src/libANGLE/capture_gles_2_0_autogen.h
new file mode 100644
index 0000000000..e4f975edf5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/capture_gles_2_0_autogen.h
@@ -0,0 +1,1168 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// capture_gles_2_0_autogen.h:
+// Capture functions for the OpenGL ES 2.0 entry points.
+
+#ifndef LIBANGLE_CAPTURE_GLES_2_0_AUTOGEN_H_
+#define LIBANGLE_CAPTURE_GLES_2_0_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/FrameCapture.h"
+
+namespace gl
+{
+class Context;
+
+// Method Captures
+
+angle::CallCapture CaptureActiveTexture(const Context *context, bool isCallValid, GLenum texture);
+angle::CallCapture CaptureAttachShader(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint shader);
+angle::CallCapture CaptureBindAttribLocation(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ const GLchar *name);
+angle::CallCapture CaptureBindBuffer(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLuint buffer);
+angle::CallCapture CaptureBindFramebuffer(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint framebuffer);
+angle::CallCapture CaptureBindRenderbuffer(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint renderbuffer);
+angle::CallCapture CaptureBindTexture(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLuint texture);
+angle::CallCapture CaptureBlendColor(const Context *context,
+ bool isCallValid,
+ GLfloat red,
+ GLfloat green,
+ GLfloat blue,
+ GLfloat alpha);
+angle::CallCapture CaptureBlendEquation(const Context *context, bool isCallValid, GLenum mode);
+angle::CallCapture CaptureBlendEquationSeparate(const Context *context,
+ bool isCallValid,
+ GLenum modeRGB,
+ GLenum modeAlpha);
+angle::CallCapture CaptureBlendFunc(const Context *context,
+ bool isCallValid,
+ GLenum sfactor,
+ GLenum dfactor);
+angle::CallCapture CaptureBlendFuncSeparate(const Context *context,
+ bool isCallValid,
+ GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha);
+angle::CallCapture CaptureBufferData(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLsizeiptr size,
+ const void *data,
+ BufferUsage usagePacked);
+angle::CallCapture CaptureBufferSubData(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data);
+angle::CallCapture CaptureCheckFramebufferStatus(const Context *context,
+ bool isCallValid,
+ GLenum target);
+angle::CallCapture CaptureClear(const Context *context, bool isCallValid, GLbitfield mask);
+angle::CallCapture CaptureClearColor(const Context *context,
+ bool isCallValid,
+ GLfloat red,
+ GLfloat green,
+ GLfloat blue,
+ GLfloat alpha);
+angle::CallCapture CaptureClearDepthf(const Context *context, bool isCallValid, GLfloat d);
+angle::CallCapture CaptureClearStencil(const Context *context, bool isCallValid, GLint s);
+angle::CallCapture CaptureColorMask(const Context *context,
+ bool isCallValid,
+ GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha);
+angle::CallCapture CaptureCompileShader(const Context *context, bool isCallValid, GLuint shader);
+angle::CallCapture CaptureCompressedTexImage2D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+angle::CallCapture CaptureCompressedTexSubImage2D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+angle::CallCapture CaptureCopyTexImage2D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border);
+angle::CallCapture CaptureCopyTexSubImage2D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureCreateProgram(const Context *context, bool isCallValid);
+angle::CallCapture CaptureCreateShader(const Context *context,
+ bool isCallValid,
+ ShaderType typePacked);
+angle::CallCapture CaptureCullFace(const Context *context,
+ bool isCallValid,
+ CullFaceMode modePacked);
+angle::CallCapture CaptureDeleteBuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *buffers);
+angle::CallCapture CaptureDeleteFramebuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *framebuffers);
+angle::CallCapture CaptureDeleteProgram(const Context *context, bool isCallValid, GLuint program);
+angle::CallCapture CaptureDeleteRenderbuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *renderbuffers);
+angle::CallCapture CaptureDeleteShader(const Context *context, bool isCallValid, GLuint shader);
+angle::CallCapture CaptureDeleteTextures(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *textures);
+angle::CallCapture CaptureDepthFunc(const Context *context, bool isCallValid, GLenum func);
+angle::CallCapture CaptureDepthMask(const Context *context, bool isCallValid, GLboolean flag);
+angle::CallCapture CaptureDepthRangef(const Context *context,
+ bool isCallValid,
+ GLfloat n,
+ GLfloat f);
+angle::CallCapture CaptureDetachShader(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint shader);
+angle::CallCapture CaptureDisable(const Context *context, bool isCallValid, GLenum cap);
+angle::CallCapture CaptureDisableVertexAttribArray(const Context *context,
+ bool isCallValid,
+ GLuint index);
+angle::CallCapture CaptureDrawArrays(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLint first,
+ GLsizei count);
+angle::CallCapture CaptureDrawElements(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices);
+angle::CallCapture CaptureEnable(const Context *context, bool isCallValid, GLenum cap);
+angle::CallCapture CaptureEnableVertexAttribArray(const Context *context,
+ bool isCallValid,
+ GLuint index);
+angle::CallCapture CaptureFinish(const Context *context, bool isCallValid);
+angle::CallCapture CaptureFlush(const Context *context, bool isCallValid);
+angle::CallCapture CaptureFramebufferRenderbuffer(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+angle::CallCapture CaptureFramebufferTexture2D(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level);
+angle::CallCapture CaptureFrontFace(const Context *context, bool isCallValid, GLenum mode);
+angle::CallCapture CaptureGenBuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *buffers);
+angle::CallCapture CaptureGenFramebuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *framebuffers);
+angle::CallCapture CaptureGenRenderbuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *renderbuffers);
+angle::CallCapture CaptureGenTextures(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *textures);
+angle::CallCapture CaptureGenerateMipmap(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked);
+angle::CallCapture CaptureGetActiveAttrib(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+angle::CallCapture CaptureGetActiveUniform(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+angle::CallCapture CaptureGetAttachedShaders(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders);
+angle::CallCapture CaptureGetAttribLocation(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name);
+angle::CallCapture CaptureGetBooleanv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLboolean *data);
+angle::CallCapture CaptureGetBufferParameteriv(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetError(const Context *context, bool isCallValid);
+angle::CallCapture CaptureGetFloatv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfloat *data);
+angle::CallCapture CaptureGetFramebufferAttachmentParameteriv(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetIntegerv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLint *data);
+angle::CallCapture CaptureGetProgramInfoLog(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+angle::CallCapture CaptureGetProgramiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetRenderbufferParameteriv(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetShaderInfoLog(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+angle::CallCapture CaptureGetShaderPrecisionFormat(const Context *context,
+ bool isCallValid,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision);
+angle::CallCapture CaptureGetShaderSource(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source);
+angle::CallCapture CaptureGetShaderiv(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetString(const Context *context, bool isCallValid, GLenum name);
+angle::CallCapture CaptureGetTexParameterfv(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfloat *params);
+angle::CallCapture CaptureGetTexParameteriv(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetUniformLocation(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name);
+angle::CallCapture CaptureGetUniformfv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLfloat *params);
+angle::CallCapture CaptureGetUniformiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLint *params);
+angle::CallCapture CaptureGetVertexAttribPointerv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ void **pointer);
+angle::CallCapture CaptureGetVertexAttribfv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLfloat *params);
+angle::CallCapture CaptureGetVertexAttribiv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureHint(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum mode);
+angle::CallCapture CaptureIsBuffer(const Context *context, bool isCallValid, GLuint buffer);
+angle::CallCapture CaptureIsEnabled(const Context *context, bool isCallValid, GLenum cap);
+angle::CallCapture CaptureIsFramebuffer(const Context *context,
+ bool isCallValid,
+ GLuint framebuffer);
+angle::CallCapture CaptureIsProgram(const Context *context, bool isCallValid, GLuint program);
+angle::CallCapture CaptureIsRenderbuffer(const Context *context,
+ bool isCallValid,
+ GLuint renderbuffer);
+angle::CallCapture CaptureIsShader(const Context *context, bool isCallValid, GLuint shader);
+angle::CallCapture CaptureIsTexture(const Context *context, bool isCallValid, GLuint texture);
+angle::CallCapture CaptureLineWidth(const Context *context, bool isCallValid, GLfloat width);
+angle::CallCapture CaptureLinkProgram(const Context *context, bool isCallValid, GLuint program);
+angle::CallCapture CapturePixelStorei(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLint param);
+angle::CallCapture CapturePolygonOffset(const Context *context,
+ bool isCallValid,
+ GLfloat factor,
+ GLfloat units);
+angle::CallCapture CaptureReadPixels(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels);
+angle::CallCapture CaptureReleaseShaderCompiler(const Context *context, bool isCallValid);
+angle::CallCapture CaptureRenderbufferStorage(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureSampleCoverage(const Context *context,
+ bool isCallValid,
+ GLfloat value,
+ GLboolean invert);
+angle::CallCapture CaptureScissor(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureShaderBinary(const Context *context,
+ bool isCallValid,
+ GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length);
+angle::CallCapture CaptureShaderSource(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length);
+angle::CallCapture CaptureStencilFunc(const Context *context,
+ bool isCallValid,
+ GLenum func,
+ GLint ref,
+ GLuint mask);
+angle::CallCapture CaptureStencilFuncSeparate(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ GLenum func,
+ GLint ref,
+ GLuint mask);
+angle::CallCapture CaptureStencilMask(const Context *context, bool isCallValid, GLuint mask);
+angle::CallCapture CaptureStencilMaskSeparate(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ GLuint mask);
+angle::CallCapture CaptureStencilOp(const Context *context,
+ bool isCallValid,
+ GLenum fail,
+ GLenum zfail,
+ GLenum zpass);
+angle::CallCapture CaptureStencilOpSeparate(const Context *context,
+ bool isCallValid,
+ GLenum face,
+ GLenum sfail,
+ GLenum dpfail,
+ GLenum dppass);
+angle::CallCapture CaptureTexImage2D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+angle::CallCapture CaptureTexParameterf(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfloat param);
+angle::CallCapture CaptureTexParameterfv(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLfloat *params);
+angle::CallCapture CaptureTexParameteri(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint param);
+angle::CallCapture CaptureTexParameteriv(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params);
+angle::CallCapture CaptureTexSubImage2D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+angle::CallCapture CaptureUniform1f(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLfloat v0);
+angle::CallCapture CaptureUniform1fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureUniform1i(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLint v0);
+angle::CallCapture CaptureUniform1iv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureUniform2f(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1);
+angle::CallCapture CaptureUniform2fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureUniform2i(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLint v0,
+ GLint v1);
+angle::CallCapture CaptureUniform2iv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureUniform3f(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2);
+angle::CallCapture CaptureUniform3fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureUniform3i(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2);
+angle::CallCapture CaptureUniform3iv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureUniform4f(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3);
+angle::CallCapture CaptureUniform4fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureUniform4i(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3);
+angle::CallCapture CaptureUniform4iv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureUniformMatrix2fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUniformMatrix3fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUniformMatrix4fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUseProgram(const Context *context, bool isCallValid, GLuint program);
+angle::CallCapture CaptureValidateProgram(const Context *context, bool isCallValid, GLuint program);
+angle::CallCapture CaptureVertexAttrib1f(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLfloat x);
+angle::CallCapture CaptureVertexAttrib1fv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v);
+angle::CallCapture CaptureVertexAttrib2f(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLfloat x,
+ GLfloat y);
+angle::CallCapture CaptureVertexAttrib2fv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v);
+angle::CallCapture CaptureVertexAttrib3f(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+angle::CallCapture CaptureVertexAttrib3fv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v);
+angle::CallCapture CaptureVertexAttrib4f(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w);
+angle::CallCapture CaptureVertexAttrib4fv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v);
+angle::CallCapture CaptureVertexAttribPointer(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLint size,
+ VertexAttribType typePacked,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer);
+angle::CallCapture CaptureViewport(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+
+// Parameter Captures
+
+void CaptureBindAttribLocation_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureBufferData_data(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLsizeiptr size,
+ const void *data,
+ BufferUsage usagePacked,
+ angle::ParamCapture *paramCapture);
+void CaptureBufferSubData_data(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexImage2D_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexSubImage2D_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteBuffers_buffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *buffers,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteFramebuffers_framebuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *framebuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteRenderbuffers_renderbuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *renderbuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteTextures_textures(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *textures,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawElements_indices(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ angle::ParamCapture *paramCapture);
+void CaptureGenBuffers_buffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *buffers,
+ angle::ParamCapture *paramCapture);
+void CaptureGenFramebuffers_framebuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *framebuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureGenRenderbuffers_renderbuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *renderbuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureGenTextures_textures(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *textures,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveAttrib_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveAttrib_size(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveAttrib_type(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveAttrib_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniform_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniform_size(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniform_type(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniform_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetAttachedShaders_count(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders,
+ angle::ParamCapture *paramCapture);
+void CaptureGetAttachedShaders_shaders(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders,
+ angle::ParamCapture *paramCapture);
+void CaptureGetAttribLocation_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBooleanv_data(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLboolean *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferParameteriv_params(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFloatv_data(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLfloat *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFramebufferAttachmentParameteriv_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetIntegerv_data(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLint *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramInfoLog_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramInfoLog_infoLog(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramiv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetRenderbufferParameteriv_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderInfoLog_length(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderInfoLog_infoLog(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderPrecisionFormat_range(const Context *context,
+ bool isCallValid,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderPrecisionFormat_precision(const Context *context,
+ bool isCallValid,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderSource_length(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderSource_source(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderiv_params(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterfv_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameteriv_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformLocation_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformfv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformiv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribPointerv_pointer(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ void **pointer,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribfv_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribiv_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureReadPixels_pixels(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureShaderBinary_shaders(const Context *context,
+ bool isCallValid,
+ GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length,
+ angle::ParamCapture *paramCapture);
+void CaptureShaderBinary_binary(const Context *context,
+ bool isCallValid,
+ GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length,
+ angle::ParamCapture *paramCapture);
+void CaptureShaderSource_string(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length,
+ angle::ParamCapture *paramCapture);
+void CaptureShaderSource_length(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length,
+ angle::ParamCapture *paramCapture);
+void CaptureTexImage2D_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterfv_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameteriv_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexSubImage2D_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform1fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform1iv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform2fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform2iv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform3fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform3iv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform4fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform4iv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix2fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix3fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix4fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttrib1fv_v(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttrib2fv_v(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttrib3fv_v(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttrib4fv_v(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLfloat *v,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttribPointer_pointer(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLint size,
+ VertexAttribType typePacked,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+} // namespace gl
+
+#endif // LIBANGLE_CAPTURE_GLES_2_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/capture_gles_3_0_autogen.h b/gfx/angle/checkout/src/libANGLE/capture_gles_3_0_autogen.h
new file mode 100644
index 0000000000..5d4513188d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/capture_gles_3_0_autogen.h
@@ -0,0 +1,1058 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// capture_gles_3_0_autogen.h:
+// Capture functions for the OpenGL ES 3.0 entry points.
+
+#ifndef LIBANGLE_CAPTURE_GLES_3_0_AUTOGEN_H_
+#define LIBANGLE_CAPTURE_GLES_3_0_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/FrameCapture.h"
+
+namespace gl
+{
+class Context;
+
+// Method Captures
+
+angle::CallCapture CaptureBeginQuery(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLuint id);
+angle::CallCapture CaptureBeginTransformFeedback(const Context *context,
+ bool isCallValid,
+ PrimitiveMode primitiveModePacked);
+angle::CallCapture CaptureBindBufferBase(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLuint index,
+ GLuint buffer);
+angle::CallCapture CaptureBindBufferRange(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+angle::CallCapture CaptureBindSampler(const Context *context,
+ bool isCallValid,
+ GLuint unit,
+ GLuint sampler);
+angle::CallCapture CaptureBindTransformFeedback(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint id);
+angle::CallCapture CaptureBindVertexArray(const Context *context, bool isCallValid, GLuint array);
+angle::CallCapture CaptureBlitFramebuffer(const Context *context,
+ bool isCallValid,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+angle::CallCapture CaptureClearBufferfi(const Context *context,
+ bool isCallValid,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil);
+angle::CallCapture CaptureClearBufferfv(const Context *context,
+ bool isCallValid,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value);
+angle::CallCapture CaptureClearBufferiv(const Context *context,
+ bool isCallValid,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value);
+angle::CallCapture CaptureClearBufferuiv(const Context *context,
+ bool isCallValid,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value);
+angle::CallCapture CaptureClientWaitSync(const Context *context,
+ bool isCallValid,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout);
+angle::CallCapture CaptureCompressedTexImage3D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+angle::CallCapture CaptureCompressedTexSubImage3D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+angle::CallCapture CaptureCopyBufferSubData(const Context *context,
+ bool isCallValid,
+ BufferBinding readTargetPacked,
+ BufferBinding writeTargetPacked,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size);
+angle::CallCapture CaptureCopyTexSubImage3D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureDeleteQueries(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *ids);
+angle::CallCapture CaptureDeleteSamplers(const Context *context,
+ bool isCallValid,
+ GLsizei count,
+ const GLuint *samplers);
+angle::CallCapture CaptureDeleteSync(const Context *context, bool isCallValid, GLsync sync);
+angle::CallCapture CaptureDeleteTransformFeedbacks(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *ids);
+angle::CallCapture CaptureDeleteVertexArrays(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *arrays);
+angle::CallCapture CaptureDrawArraysInstanced(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount);
+angle::CallCapture CaptureDrawBuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLenum *bufs);
+angle::CallCapture CaptureDrawElementsInstanced(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei instancecount);
+angle::CallCapture CaptureDrawRangeElements(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices);
+angle::CallCapture CaptureEndQuery(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked);
+angle::CallCapture CaptureEndTransformFeedback(const Context *context, bool isCallValid);
+angle::CallCapture CaptureFenceSync(const Context *context,
+ bool isCallValid,
+ GLenum condition,
+ GLbitfield flags);
+angle::CallCapture CaptureFlushMappedBufferRange(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length);
+angle::CallCapture CaptureFramebufferTextureLayer(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer);
+angle::CallCapture CaptureGenQueries(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *ids);
+angle::CallCapture CaptureGenSamplers(const Context *context,
+ bool isCallValid,
+ GLsizei count,
+ GLuint *samplers);
+angle::CallCapture CaptureGenTransformFeedbacks(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *ids);
+angle::CallCapture CaptureGenVertexArrays(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *arrays);
+angle::CallCapture CaptureGetActiveUniformBlockName(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName);
+angle::CallCapture CaptureGetActiveUniformBlockiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetActiveUniformsiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetBufferParameteri64v(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLint64 *params);
+angle::CallCapture CaptureGetBufferPointerv(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ void **params);
+angle::CallCapture CaptureGetFragDataLocation(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name);
+angle::CallCapture CaptureGetInteger64i_v(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLint64 *data);
+angle::CallCapture CaptureGetInteger64v(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLint64 *data);
+angle::CallCapture CaptureGetIntegeri_v(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLint *data);
+angle::CallCapture CaptureGetInternalformativ(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params);
+angle::CallCapture CaptureGetProgramBinary(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+angle::CallCapture CaptureGetQueryObjectuiv(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLuint *params);
+angle::CallCapture CaptureGetQueryiv(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetSamplerParameterfv(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat *params);
+angle::CallCapture CaptureGetSamplerParameteriv(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetStringi(const Context *context,
+ bool isCallValid,
+ GLenum name,
+ GLuint index);
+angle::CallCapture CaptureGetSynciv(const Context *context,
+ bool isCallValid,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values);
+angle::CallCapture CaptureGetTransformFeedbackVarying(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name);
+angle::CallCapture CaptureGetUniformBlockIndex(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *uniformBlockName);
+angle::CallCapture CaptureGetUniformIndices(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices);
+angle::CallCapture CaptureGetUniformuiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLuint *params);
+angle::CallCapture CaptureGetVertexAttribIiv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetVertexAttribIuiv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLuint *params);
+angle::CallCapture CaptureInvalidateFramebuffer(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+angle::CallCapture CaptureInvalidateSubFramebuffer(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureIsQuery(const Context *context, bool isCallValid, GLuint id);
+angle::CallCapture CaptureIsSampler(const Context *context, bool isCallValid, GLuint sampler);
+angle::CallCapture CaptureIsSync(const Context *context, bool isCallValid, GLsync sync);
+angle::CallCapture CaptureIsTransformFeedback(const Context *context, bool isCallValid, GLuint id);
+angle::CallCapture CaptureIsVertexArray(const Context *context, bool isCallValid, GLuint array);
+angle::CallCapture CaptureMapBufferRange(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+angle::CallCapture CapturePauseTransformFeedback(const Context *context, bool isCallValid);
+angle::CallCapture CaptureProgramBinary(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length);
+angle::CallCapture CaptureProgramParameteri(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum pname,
+ GLint value);
+angle::CallCapture CaptureReadBuffer(const Context *context, bool isCallValid, GLenum src);
+angle::CallCapture CaptureRenderbufferStorageMultisample(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureResumeTransformFeedback(const Context *context, bool isCallValid);
+angle::CallCapture CaptureSamplerParameterf(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat param);
+angle::CallCapture CaptureSamplerParameterfv(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLfloat *param);
+angle::CallCapture CaptureSamplerParameteri(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLint param);
+angle::CallCapture CaptureSamplerParameteriv(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param);
+angle::CallCapture CaptureTexImage3D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+angle::CallCapture CaptureTexStorage2D(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureTexStorage3D(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+angle::CallCapture CaptureTexSubImage3D(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+angle::CallCapture CaptureTransformFeedbackVaryings(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode);
+angle::CallCapture CaptureUniform1ui(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLuint v0);
+angle::CallCapture CaptureUniform1uiv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureUniform2ui(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLuint v0,
+ GLuint v1);
+angle::CallCapture CaptureUniform2uiv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureUniform3ui(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2);
+angle::CallCapture CaptureUniform3uiv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureUniform4ui(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3);
+angle::CallCapture CaptureUniform4uiv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureUniformBlockBinding(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding);
+angle::CallCapture CaptureUniformMatrix2x3fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUniformMatrix2x4fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUniformMatrix3x2fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUniformMatrix3x4fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUniformMatrix4x2fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUniformMatrix4x3fv(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureUnmapBuffer(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked);
+angle::CallCapture CaptureVertexAttribDivisor(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLuint divisor);
+angle::CallCapture CaptureVertexAttribI4i(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint w);
+angle::CallCapture CaptureVertexAttribI4iv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLint *v);
+angle::CallCapture CaptureVertexAttribI4ui(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLuint x,
+ GLuint y,
+ GLuint z,
+ GLuint w);
+angle::CallCapture CaptureVertexAttribI4uiv(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLuint *v);
+angle::CallCapture CaptureVertexAttribIPointer(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+angle::CallCapture CaptureWaitSync(const Context *context,
+ bool isCallValid,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout);
+
+// Parameter Captures
+
+void CaptureClearBufferfv_value(const Context *context,
+ bool isCallValid,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureClearBufferiv_value(const Context *context,
+ bool isCallValid,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureClearBufferuiv_value(const Context *context,
+ bool isCallValid,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexImage3D_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexSubImage3D_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteQueries_ids(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *ids,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteSamplers_samplers(const Context *context,
+ bool isCallValid,
+ GLsizei count,
+ const GLuint *samplers,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteTransformFeedbacks_ids(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *ids,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteVertexArrays_arrays(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *arrays,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawBuffers_bufs(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLenum *bufs,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawElementsInstanced_indices(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei instancecount,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawRangeElements_indices(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ angle::ParamCapture *paramCapture);
+void CaptureGenQueries_ids(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *ids,
+ angle::ParamCapture *paramCapture);
+void CaptureGenSamplers_samplers(const Context *context,
+ bool isCallValid,
+ GLsizei count,
+ GLuint *samplers,
+ angle::ParamCapture *paramCapture);
+void CaptureGenTransformFeedbacks_ids(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *ids,
+ angle::ParamCapture *paramCapture);
+void CaptureGenVertexArrays_arrays(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *arrays,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniformBlockName_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniformBlockName_uniformBlockName(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniformBlockiv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniformsiv_uniformIndices(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniformsiv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferParameteri64v_params(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferPointerv_params(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFragDataLocation_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInteger64i_v_data(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLint64 *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInteger64v_data(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLint64 *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetIntegeri_v_data(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLint *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInternalformativ_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramBinary_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramBinary_binaryFormat(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramBinary_binary(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectuiv_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryiv_params(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterfv_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameteriv_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSynciv_length(const Context *context,
+ bool isCallValid,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSynciv_values(const Context *context,
+ bool isCallValid,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTransformFeedbackVarying_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTransformFeedbackVarying_size(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTransformFeedbackVarying_type(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTransformFeedbackVarying_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformBlockIndex_uniformBlockName(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *uniformBlockName,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformIndices_uniformNames(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformIndices_uniformIndices(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformuiv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribIiv_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribIuiv_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureInvalidateFramebuffer_attachments(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ angle::ParamCapture *paramCapture);
+void CaptureInvalidateSubFramebuffer_attachments(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramBinary_binary(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameterfv_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLfloat *param,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameteriv_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param,
+ angle::ParamCapture *paramCapture);
+void CaptureTexImage3D_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTexSubImage3D_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTransformFeedbackVaryings_varyings(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform1uiv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform2uiv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform3uiv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniform4uiv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix2x3fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix2x4fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix3x2fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix3x4fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix4x2fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureUniformMatrix4x3fv_value(const Context *context,
+ bool isCallValid,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttribI4iv_v(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLint *v,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttribI4uiv_v(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ const GLuint *v,
+ angle::ParamCapture *paramCapture);
+void CaptureVertexAttribIPointer_pointer(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+} // namespace gl
+
+#endif // LIBANGLE_CAPTURE_GLES_3_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/capture_gles_3_1_autogen.h b/gfx/angle/checkout/src/libANGLE/capture_gles_3_1_autogen.h
new file mode 100644
index 0000000000..bab0035720
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/capture_gles_3_1_autogen.h
@@ -0,0 +1,725 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// capture_gles_3_1_autogen.h:
+// Capture functions for the OpenGL ES 3.1 entry points.
+
+#ifndef LIBANGLE_CAPTURE_GLES_3_1_AUTOGEN_H_
+#define LIBANGLE_CAPTURE_GLES_3_1_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/FrameCapture.h"
+
+namespace gl
+{
+class Context;
+
+// Method Captures
+
+angle::CallCapture CaptureActiveShaderProgram(const Context *context,
+ bool isCallValid,
+ GLuint pipeline,
+ GLuint program);
+angle::CallCapture CaptureBindImageTexture(const Context *context,
+ bool isCallValid,
+ GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format);
+angle::CallCapture CaptureBindProgramPipeline(const Context *context,
+ bool isCallValid,
+ GLuint pipeline);
+angle::CallCapture CaptureBindVertexBuffer(const Context *context,
+ bool isCallValid,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride);
+angle::CallCapture CaptureCreateShaderProgramv(const Context *context,
+ bool isCallValid,
+ ShaderType typePacked,
+ GLsizei count,
+ const GLchar *const *strings);
+angle::CallCapture CaptureDeleteProgramPipelines(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *pipelines);
+angle::CallCapture CaptureDispatchCompute(const Context *context,
+ bool isCallValid,
+ GLuint num_groups_x,
+ GLuint num_groups_y,
+ GLuint num_groups_z);
+angle::CallCapture CaptureDispatchComputeIndirect(const Context *context,
+ bool isCallValid,
+ GLintptr indirect);
+angle::CallCapture CaptureDrawArraysIndirect(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const void *indirect);
+angle::CallCapture CaptureDrawElementsIndirect(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ DrawElementsType typePacked,
+ const void *indirect);
+angle::CallCapture CaptureFramebufferParameteri(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLint param);
+angle::CallCapture CaptureGenProgramPipelines(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *pipelines);
+angle::CallCapture CaptureGetBooleani_v(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLboolean *data);
+angle::CallCapture CaptureGetFramebufferParameteriv(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetMultisamplefv(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val);
+angle::CallCapture CaptureGetProgramInterfaceiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetProgramPipelineInfoLog(const Context *context,
+ bool isCallValid,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+angle::CallCapture CaptureGetProgramPipelineiv(const Context *context,
+ bool isCallValid,
+ GLuint pipeline,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetProgramResourceIndex(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+angle::CallCapture CaptureGetProgramResourceLocation(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+angle::CallCapture CaptureGetProgramResourceName(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name);
+angle::CallCapture CaptureGetProgramResourceiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetTexLevelParameterfv(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+angle::CallCapture CaptureGetTexLevelParameteriv(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureIsProgramPipeline(const Context *context,
+ bool isCallValid,
+ GLuint pipeline);
+angle::CallCapture CaptureMemoryBarrier(const Context *context,
+ bool isCallValid,
+ GLbitfield barriers);
+angle::CallCapture CaptureMemoryBarrierByRegion(const Context *context,
+ bool isCallValid,
+ GLbitfield barriers);
+angle::CallCapture CaptureProgramUniform1f(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLfloat v0);
+angle::CallCapture CaptureProgramUniform1fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniform1i(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLint v0);
+angle::CallCapture CaptureProgramUniform1iv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureProgramUniform1ui(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLuint v0);
+angle::CallCapture CaptureProgramUniform1uiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureProgramUniform2f(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1);
+angle::CallCapture CaptureProgramUniform2fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniform2i(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1);
+angle::CallCapture CaptureProgramUniform2iv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureProgramUniform2ui(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1);
+angle::CallCapture CaptureProgramUniform2uiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureProgramUniform3f(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2);
+angle::CallCapture CaptureProgramUniform3fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniform3i(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2);
+angle::CallCapture CaptureProgramUniform3iv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureProgramUniform3ui(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2);
+angle::CallCapture CaptureProgramUniform3uiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureProgramUniform4f(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3);
+angle::CallCapture CaptureProgramUniform4fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniform4i(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3);
+angle::CallCapture CaptureProgramUniform4iv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+angle::CallCapture CaptureProgramUniform4ui(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3);
+angle::CallCapture CaptureProgramUniform4uiv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+angle::CallCapture CaptureProgramUniformMatrix2fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix2x3fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix2x4fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix3fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix3x2fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix3x4fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix4fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix4x2fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureProgramUniformMatrix4x3fv(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+angle::CallCapture CaptureSampleMaski(const Context *context,
+ bool isCallValid,
+ GLuint maskNumber,
+ GLbitfield mask);
+angle::CallCapture CaptureTexStorage2DMultisample(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+angle::CallCapture CaptureUseProgramStages(const Context *context,
+ bool isCallValid,
+ GLuint pipeline,
+ GLbitfield stages,
+ GLuint program);
+angle::CallCapture CaptureValidateProgramPipeline(const Context *context,
+ bool isCallValid,
+ GLuint pipeline);
+angle::CallCapture CaptureVertexAttribBinding(const Context *context,
+ bool isCallValid,
+ GLuint attribindex,
+ GLuint bindingindex);
+angle::CallCapture CaptureVertexAttribFormat(const Context *context,
+ bool isCallValid,
+ GLuint attribindex,
+ GLint size,
+ VertexAttribType typePacked,
+ GLboolean normalized,
+ GLuint relativeoffset);
+angle::CallCapture CaptureVertexAttribIFormat(const Context *context,
+ bool isCallValid,
+ GLuint attribindex,
+ GLint size,
+ VertexAttribType typePacked,
+ GLuint relativeoffset);
+angle::CallCapture CaptureVertexBindingDivisor(const Context *context,
+ bool isCallValid,
+ GLuint bindingindex,
+ GLuint divisor);
+
+// Parameter Captures
+
+void CaptureCreateShaderProgramv_strings(const Context *context,
+ bool isCallValid,
+ ShaderType typePacked,
+ GLsizei count,
+ const GLchar *const *strings,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteProgramPipelines_pipelines(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *pipelines,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawArraysIndirect_indirect(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const void *indirect,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawElementsIndirect_indirect(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ DrawElementsType typePacked,
+ const void *indirect,
+ angle::ParamCapture *paramCapture);
+void CaptureGenProgramPipelines_pipelines(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *pipelines,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBooleani_v_data(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLboolean *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFramebufferParameteriv_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetMultisamplefv_val(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramInterfaceiv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramPipelineInfoLog_length(const Context *context,
+ bool isCallValid,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramPipelineInfoLog_infoLog(const Context *context,
+ bool isCallValid,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramPipelineiv_params(const Context *context,
+ bool isCallValid,
+ GLuint pipeline,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceIndex_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceLocation_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceName_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceName_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceiv_props(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceiv_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceiv_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameterfv_params(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameteriv_params(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform1fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform1iv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform1uiv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform2fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform2iv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform2uiv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform3fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform3iv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform3uiv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform4fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform4iv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniform4uiv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix2fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix2x3fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix2x4fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix3fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix3x2fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix3x4fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix4fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix4x2fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramUniformMatrix4x3fv_value(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value,
+ angle::ParamCapture *paramCapture);
+} // namespace gl
+
+#endif // LIBANGLE_CAPTURE_GLES_3_1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/capture_gles_ext_autogen.h b/gfx/angle/checkout/src/libANGLE/capture_gles_ext_autogen.h
new file mode 100644
index 0000000000..9a25c988e3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/capture_gles_ext_autogen.h
@@ -0,0 +1,3681 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// capture_gles_ext_autogen.h:
+// Capture functions for the OpenGL ES extension entry points.
+
+#ifndef LIBANGLE_CAPTURE_GLES_ext_AUTOGEN_H_
+#define LIBANGLE_CAPTURE_GLES_ext_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/FrameCapture.h"
+
+namespace gl
+{
+class Context;
+
+// Method Captures
+
+// GL_ANGLE_copy_texture_3d
+angle::CallCapture CaptureCopyTexture3DANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+angle::CallCapture CaptureCopySubTexture3DANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+
+// GL_ANGLE_framebuffer_blit
+angle::CallCapture CaptureBlitFramebufferANGLE(const Context *context,
+ bool isCallValid,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+
+// GL_ANGLE_framebuffer_multisample
+angle::CallCapture CaptureRenderbufferStorageMultisampleANGLE(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+
+// GL_ANGLE_instanced_arrays
+angle::CallCapture CaptureDrawArraysInstancedANGLE(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+angle::CallCapture CaptureDrawElementsInstancedANGLE(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei primcount);
+angle::CallCapture CaptureVertexAttribDivisorANGLE(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLuint divisor);
+
+// GL_ANGLE_multi_draw
+angle::CallCapture CaptureMultiDrawArraysANGLE(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount);
+angle::CallCapture CaptureMultiDrawArraysInstancedANGLE(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+angle::CallCapture CaptureMultiDrawElementsANGLE(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ GLsizei drawcount);
+angle::CallCapture CaptureMultiDrawElementsInstancedANGLE(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+
+// GL_ANGLE_provoking_vertex
+angle::CallCapture CaptureProvokingVertexANGLE(const Context *context,
+ bool isCallValid,
+ ProvokingVertexConvention modePacked);
+
+// GL_ANGLE_request_extension
+angle::CallCapture CaptureRequestExtensionANGLE(const Context *context,
+ bool isCallValid,
+ const GLchar *name);
+
+// GL_ANGLE_robust_client_memory
+angle::CallCapture CaptureGetBooleanvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params);
+angle::CallCapture CaptureGetBufferParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetFloatvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+angle::CallCapture CaptureGetFramebufferAttachmentParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetIntegervRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+angle::CallCapture CaptureGetProgramivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetRenderbufferParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetShaderivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetTexParameterfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+angle::CallCapture CaptureGetTexParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetUniformfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+angle::CallCapture CaptureGetUniformivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetVertexAttribfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+angle::CallCapture CaptureGetVertexAttribivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetVertexAttribPointervRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer);
+angle::CallCapture CaptureReadPixelsRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels);
+angle::CallCapture CaptureTexImage2DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+angle::CallCapture CaptureTexParameterfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params);
+angle::CallCapture CaptureTexParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+angle::CallCapture CaptureTexSubImage2DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+angle::CallCapture CaptureTexImage3DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+angle::CallCapture CaptureTexSubImage3DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+angle::CallCapture CaptureCompressedTexImage2DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+angle::CallCapture CaptureCompressedTexSubImage2DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+angle::CallCapture CaptureCompressedTexImage3DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+angle::CallCapture CaptureCompressedTexSubImage3DRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+angle::CallCapture CaptureGetQueryivRobustANGLE(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetQueryObjectuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+angle::CallCapture CaptureGetBufferPointervRobustANGLE(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+angle::CallCapture CaptureGetIntegeri_vRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+angle::CallCapture CaptureGetInternalformativRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetVertexAttribIivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetVertexAttribIuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+angle::CallCapture CaptureGetUniformuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+angle::CallCapture CaptureGetActiveUniformBlockivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetInteger64vRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+angle::CallCapture CaptureGetInteger64i_vRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+angle::CallCapture CaptureGetBufferParameteri64vRobustANGLE(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+angle::CallCapture CaptureSamplerParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param);
+angle::CallCapture CaptureSamplerParameterfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param);
+angle::CallCapture CaptureGetSamplerParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetSamplerParameterfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+angle::CallCapture CaptureGetFramebufferParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetProgramInterfaceivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetBooleani_vRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data);
+angle::CallCapture CaptureGetMultisamplefvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val);
+angle::CallCapture CaptureGetTexLevelParameterivRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetTexLevelParameterfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+angle::CallCapture CaptureGetPointervRobustANGLERobustANGLE(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+angle::CallCapture CaptureReadnPixelsRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data);
+angle::CallCapture CaptureGetnUniformfvRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+angle::CallCapture CaptureGetnUniformivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetnUniformuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+angle::CallCapture CaptureTexParameterIivRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+angle::CallCapture CaptureTexParameterIuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params);
+angle::CallCapture CaptureGetTexParameterIivRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetTexParameterIuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+angle::CallCapture CaptureSamplerParameterIivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param);
+angle::CallCapture CaptureSamplerParameterIuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param);
+angle::CallCapture CaptureGetSamplerParameterIivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetSamplerParameterIuivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+angle::CallCapture CaptureGetQueryObjectivRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+angle::CallCapture CaptureGetQueryObjecti64vRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+angle::CallCapture CaptureGetQueryObjectui64vRobustANGLE(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params);
+
+// GL_ANGLE_texture_external_update
+angle::CallCapture CaptureTexImage2DExternalANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type);
+angle::CallCapture CaptureInvalidateTextureANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked);
+
+// GL_ANGLE_texture_multisample
+angle::CallCapture CaptureTexStorage2DMultisampleANGLE(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+angle::CallCapture CaptureGetTexLevelParameterivANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetTexLevelParameterfvANGLE(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+angle::CallCapture CaptureGetMultisamplefvANGLE(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val);
+angle::CallCapture CaptureSampleMaskiANGLE(const Context *context,
+ bool isCallValid,
+ GLuint maskNumber,
+ GLbitfield mask);
+
+// GL_ANGLE_translated_shader_source
+angle::CallCapture CaptureGetTranslatedShaderSourceANGLE(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source);
+
+// GL_CHROMIUM_bind_uniform_location
+angle::CallCapture CaptureBindUniformLocationCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ const GLchar *name);
+
+// GL_CHROMIUM_copy_compressed_texture
+angle::CallCapture CaptureCompressedCopyTextureCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint sourceId,
+ GLuint destId);
+
+// GL_CHROMIUM_copy_texture
+angle::CallCapture CaptureCopyTextureCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+angle::CallCapture CaptureCopySubTextureCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+
+// GL_CHROMIUM_framebuffer_mixed_samples
+angle::CallCapture CaptureCoverageModulationCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLenum components);
+angle::CallCapture CaptureMatrixLoadfCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLenum matrixMode,
+ const GLfloat *matrix);
+angle::CallCapture CaptureMatrixLoadIdentityCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLenum matrixMode);
+
+// GL_CHROMIUM_lose_context
+angle::CallCapture CaptureLoseContextCHROMIUM(const Context *context,
+ bool isCallValid,
+ GraphicsResetStatus currentPacked,
+ GraphicsResetStatus otherPacked);
+
+// GL_CHROMIUM_path_rendering
+angle::CallCapture CaptureGenPathsCHROMIUM(const Context *context, bool isCallValid, GLsizei range);
+angle::CallCapture CaptureDeletePathsCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint first,
+ GLsizei range);
+angle::CallCapture CaptureIsPathCHROMIUM(const Context *context, bool isCallValid, GLuint path);
+angle::CallCapture CapturePathCommandsCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords);
+angle::CallCapture CapturePathParameterfCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum pname,
+ GLfloat value);
+angle::CallCapture CapturePathParameteriCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum pname,
+ GLint value);
+angle::CallCapture CaptureGetPathParameterfvCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum pname,
+ GLfloat *value);
+angle::CallCapture CaptureGetPathParameterivCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum pname,
+ GLint *value);
+angle::CallCapture CapturePathStencilFuncCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLenum func,
+ GLint ref,
+ GLuint mask);
+angle::CallCapture CaptureStencilFillPathCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask);
+angle::CallCapture CaptureStencilStrokePathCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLint reference,
+ GLuint mask);
+angle::CallCapture CaptureCoverFillPathCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum coverMode);
+angle::CallCapture CaptureCoverStrokePathCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum coverMode);
+angle::CallCapture CaptureStencilThenCoverFillPathCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode);
+angle::CallCapture CaptureStencilThenCoverStrokePathCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode);
+angle::CallCapture CaptureCoverFillPathInstancedCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+angle::CallCapture CaptureCoverStrokePathInstancedCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+angle::CallCapture CaptureStencilStrokePathInstancedCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+angle::CallCapture CaptureStencilFillPathInstancedCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+angle::CallCapture CaptureStencilThenCoverFillPathInstancedCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+angle::CallCapture CaptureStencilThenCoverStrokePathInstancedCHROMIUM(
+ const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+angle::CallCapture CaptureBindFragmentInputLocationCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint programs,
+ GLint location,
+ const GLchar *name);
+angle::CallCapture CaptureProgramPathFragmentInputGenCHROMIUM(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs);
+
+// GL_EXT_blend_func_extended
+angle::CallCapture CaptureBindFragDataLocationEXT(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint color,
+ const GLchar *name);
+angle::CallCapture CaptureBindFragDataLocationIndexedEXT(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name);
+angle::CallCapture CaptureGetFragDataIndexEXT(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name);
+angle::CallCapture CaptureGetProgramResourceLocationIndexEXT(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+
+// GL_EXT_debug_marker
+angle::CallCapture CaptureInsertEventMarkerEXT(const Context *context,
+ bool isCallValid,
+ GLsizei length,
+ const GLchar *marker);
+angle::CallCapture CapturePopGroupMarkerEXT(const Context *context, bool isCallValid);
+angle::CallCapture CapturePushGroupMarkerEXT(const Context *context,
+ bool isCallValid,
+ GLsizei length,
+ const GLchar *marker);
+
+// GL_EXT_discard_framebuffer
+angle::CallCapture CaptureDiscardFramebufferEXT(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+
+// GL_EXT_disjoint_timer_query
+angle::CallCapture CaptureBeginQueryEXT(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLuint id);
+angle::CallCapture CaptureDeleteQueriesEXT(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *ids);
+angle::CallCapture CaptureEndQueryEXT(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked);
+angle::CallCapture CaptureGenQueriesEXT(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *ids);
+angle::CallCapture CaptureGetQueryObjecti64vEXT(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLint64 *params);
+angle::CallCapture CaptureGetQueryObjectivEXT(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetQueryObjectui64vEXT(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLuint64 *params);
+angle::CallCapture CaptureGetQueryObjectuivEXT(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLuint *params);
+angle::CallCapture CaptureGetQueryivEXT(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureIsQueryEXT(const Context *context, bool isCallValid, GLuint id);
+angle::CallCapture CaptureQueryCounterEXT(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ QueryType targetPacked);
+
+// GL_EXT_draw_buffers
+angle::CallCapture CaptureDrawBuffersEXT(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLenum *bufs);
+
+// GL_EXT_geometry_shader
+angle::CallCapture CaptureFramebufferTextureEXT(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level);
+
+// GL_EXT_instanced_arrays
+angle::CallCapture CaptureDrawArraysInstancedEXT(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLint start,
+ GLsizei count,
+ GLsizei primcount);
+angle::CallCapture CaptureDrawElementsInstancedEXT(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei primcount);
+angle::CallCapture CaptureVertexAttribDivisorEXT(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLuint divisor);
+
+// GL_EXT_map_buffer_range
+angle::CallCapture CaptureFlushMappedBufferRangeEXT(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length);
+angle::CallCapture CaptureMapBufferRangeEXT(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+
+// GL_EXT_memory_object
+angle::CallCapture CaptureBufferStorageMemEXT(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset);
+angle::CallCapture CaptureCreateMemoryObjectsEXT(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *memoryObjects);
+angle::CallCapture CaptureDeleteMemoryObjectsEXT(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *memoryObjects);
+angle::CallCapture CaptureGetMemoryObjectParameterivEXT(const Context *context,
+ bool isCallValid,
+ GLuint memoryObject,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetUnsignedBytevEXT(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLubyte *data);
+angle::CallCapture CaptureGetUnsignedBytei_vEXT(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLubyte *data);
+angle::CallCapture CaptureIsMemoryObjectEXT(const Context *context,
+ bool isCallValid,
+ GLuint memoryObject);
+angle::CallCapture CaptureMemoryObjectParameterivEXT(const Context *context,
+ bool isCallValid,
+ GLuint memoryObject,
+ GLenum pname,
+ const GLint *params);
+angle::CallCapture CaptureTexStorageMem2DEXT(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset);
+angle::CallCapture CaptureTexStorageMem2DMultisampleEXT(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+angle::CallCapture CaptureTexStorageMem3DEXT(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset);
+angle::CallCapture CaptureTexStorageMem3DMultisampleEXT(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+
+// GL_EXT_memory_object_fd
+angle::CallCapture CaptureImportMemoryFdEXT(const Context *context,
+ bool isCallValid,
+ GLuint memory,
+ GLuint64 size,
+ HandleType handleTypePacked,
+ GLint fd);
+
+// GL_EXT_occlusion_query_boolean
+
+// GL_EXT_robustness
+angle::CallCapture CaptureGetGraphicsResetStatusEXT(const Context *context, bool isCallValid);
+angle::CallCapture CaptureGetnUniformfvEXT(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params);
+angle::CallCapture CaptureGetnUniformivEXT(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params);
+angle::CallCapture CaptureReadnPixelsEXT(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data);
+
+// GL_EXT_semaphore
+angle::CallCapture CaptureDeleteSemaphoresEXT(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *semaphores);
+angle::CallCapture CaptureGenSemaphoresEXT(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *semaphores);
+angle::CallCapture CaptureGetSemaphoreParameterui64vEXT(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params);
+angle::CallCapture CaptureIsSemaphoreEXT(const Context *context,
+ bool isCallValid,
+ GLuint semaphore);
+angle::CallCapture CaptureSemaphoreParameterui64vEXT(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params);
+angle::CallCapture CaptureSignalSemaphoreEXT(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts);
+angle::CallCapture CaptureWaitSemaphoreEXT(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts);
+
+// GL_EXT_semaphore_fd
+angle::CallCapture CaptureImportSemaphoreFdEXT(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ HandleType handleTypePacked,
+ GLint fd);
+
+// GL_EXT_texture_storage
+angle::CallCapture CaptureTexStorage1DEXT(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width);
+angle::CallCapture CaptureTexStorage2DEXT(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureTexStorage3DEXT(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+
+// GL_KHR_debug
+angle::CallCapture CaptureDebugMessageCallbackKHR(const Context *context,
+ bool isCallValid,
+ GLDEBUGPROCKHR callback,
+ const void *userParam);
+angle::CallCapture CaptureDebugMessageControlKHR(const Context *context,
+ bool isCallValid,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled);
+angle::CallCapture CaptureDebugMessageInsertKHR(const Context *context,
+ bool isCallValid,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf);
+angle::CallCapture CaptureGetDebugMessageLogKHR(const Context *context,
+ bool isCallValid,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog);
+angle::CallCapture CaptureGetObjectLabelKHR(const Context *context,
+ bool isCallValid,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+angle::CallCapture CaptureGetObjectPtrLabelKHR(const Context *context,
+ bool isCallValid,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+angle::CallCapture CaptureGetPointervKHR(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ void **params);
+angle::CallCapture CaptureObjectLabelKHR(const Context *context,
+ bool isCallValid,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label);
+angle::CallCapture CaptureObjectPtrLabelKHR(const Context *context,
+ bool isCallValid,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label);
+angle::CallCapture CapturePopDebugGroupKHR(const Context *context, bool isCallValid);
+angle::CallCapture CapturePushDebugGroupKHR(const Context *context,
+ bool isCallValid,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message);
+
+// GL_KHR_parallel_shader_compile
+angle::CallCapture CaptureMaxShaderCompilerThreadsKHR(const Context *context,
+ bool isCallValid,
+ GLuint count);
+
+// GL_NV_fence
+angle::CallCapture CaptureDeleteFencesNV(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *fences);
+angle::CallCapture CaptureFinishFenceNV(const Context *context, bool isCallValid, GLuint fence);
+angle::CallCapture CaptureGenFencesNV(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *fences);
+angle::CallCapture CaptureGetFenceivNV(const Context *context,
+ bool isCallValid,
+ GLuint fence,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureIsFenceNV(const Context *context, bool isCallValid, GLuint fence);
+angle::CallCapture CaptureSetFenceNV(const Context *context,
+ bool isCallValid,
+ GLuint fence,
+ GLenum condition);
+angle::CallCapture CaptureTestFenceNV(const Context *context, bool isCallValid, GLuint fence);
+
+// GL_OES_EGL_image
+angle::CallCapture CaptureEGLImageTargetRenderbufferStorageOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLeglImageOES image);
+angle::CallCapture CaptureEGLImageTargetTexture2DOES(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLeglImageOES image);
+
+// GL_OES_draw_texture
+angle::CallCapture CaptureDrawTexfOES(const Context *context,
+ bool isCallValid,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat width,
+ GLfloat height);
+angle::CallCapture CaptureDrawTexfvOES(const Context *context,
+ bool isCallValid,
+ const GLfloat *coords);
+angle::CallCapture CaptureDrawTexiOES(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height);
+angle::CallCapture CaptureDrawTexivOES(const Context *context,
+ bool isCallValid,
+ const GLint *coords);
+angle::CallCapture CaptureDrawTexsOES(const Context *context,
+ bool isCallValid,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort width,
+ GLshort height);
+angle::CallCapture CaptureDrawTexsvOES(const Context *context,
+ bool isCallValid,
+ const GLshort *coords);
+angle::CallCapture CaptureDrawTexxOES(const Context *context,
+ bool isCallValid,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z,
+ GLfixed width,
+ GLfixed height);
+angle::CallCapture CaptureDrawTexxvOES(const Context *context,
+ bool isCallValid,
+ const GLfixed *coords);
+
+// GL_OES_framebuffer_object
+angle::CallCapture CaptureBindFramebufferOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint framebuffer);
+angle::CallCapture CaptureBindRenderbufferOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint renderbuffer);
+angle::CallCapture CaptureCheckFramebufferStatusOES(const Context *context,
+ bool isCallValid,
+ GLenum target);
+angle::CallCapture CaptureDeleteFramebuffersOES(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *framebuffers);
+angle::CallCapture CaptureDeleteRenderbuffersOES(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *renderbuffers);
+angle::CallCapture CaptureFramebufferRenderbufferOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+angle::CallCapture CaptureFramebufferTexture2DOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level);
+angle::CallCapture CaptureGenFramebuffersOES(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *framebuffers);
+angle::CallCapture CaptureGenRenderbuffersOES(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *renderbuffers);
+angle::CallCapture CaptureGenerateMipmapOES(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked);
+angle::CallCapture CaptureGetFramebufferAttachmentParameterivOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetRenderbufferParameterivOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureIsFramebufferOES(const Context *context,
+ bool isCallValid,
+ GLuint framebuffer);
+angle::CallCapture CaptureIsRenderbufferOES(const Context *context,
+ bool isCallValid,
+ GLuint renderbuffer);
+angle::CallCapture CaptureRenderbufferStorageOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+
+// GL_OES_get_program_binary
+angle::CallCapture CaptureGetProgramBinaryOES(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+angle::CallCapture CaptureProgramBinaryOES(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length);
+
+// GL_OES_mapbuffer
+angle::CallCapture CaptureGetBufferPointervOES(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ void **params);
+angle::CallCapture CaptureMapBufferOES(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum access);
+angle::CallCapture CaptureUnmapBufferOES(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked);
+
+// GL_OES_matrix_palette
+angle::CallCapture CaptureCurrentPaletteMatrixOES(const Context *context,
+ bool isCallValid,
+ GLuint matrixpaletteindex);
+angle::CallCapture CaptureLoadPaletteFromModelViewMatrixOES(const Context *context,
+ bool isCallValid);
+angle::CallCapture CaptureMatrixIndexPointerOES(const Context *context,
+ bool isCallValid,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+angle::CallCapture CaptureWeightPointerOES(const Context *context,
+ bool isCallValid,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+
+// GL_OES_point_size_array
+angle::CallCapture CapturePointSizePointerOES(const Context *context,
+ bool isCallValid,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+
+// GL_OES_query_matrix
+angle::CallCapture CaptureQueryMatrixxOES(const Context *context,
+ bool isCallValid,
+ GLfixed *mantissa,
+ GLint *exponent);
+
+// GL_OES_texture_3D
+angle::CallCapture CaptureCompressedTexImage3DOES(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+angle::CallCapture CaptureCompressedTexSubImage3DOES(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+angle::CallCapture CaptureCopyTexSubImage3DOES(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+angle::CallCapture CaptureFramebufferTexture3DOES(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level,
+ GLint zoffset);
+angle::CallCapture CaptureTexImage3DOES(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+angle::CallCapture CaptureTexSubImage3DOES(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+
+// GL_OES_texture_border_clamp
+angle::CallCapture CaptureGetSamplerParameterIivOES(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetSamplerParameterIuivOES(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params);
+angle::CallCapture CaptureGetTexParameterIivOES(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetTexParameterIuivOES(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLuint *params);
+angle::CallCapture CaptureSamplerParameterIivOES(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param);
+angle::CallCapture CaptureSamplerParameterIuivOES(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param);
+angle::CallCapture CaptureTexParameterIivOES(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params);
+angle::CallCapture CaptureTexParameterIuivOES(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLuint *params);
+
+// GL_OES_texture_cube_map
+angle::CallCapture CaptureGetTexGenfvOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLfloat *params);
+angle::CallCapture CaptureGetTexGenivOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLint *params);
+angle::CallCapture CaptureGetTexGenxvOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLfixed *params);
+angle::CallCapture CaptureTexGenfOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLfloat param);
+angle::CallCapture CaptureTexGenfvOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ const GLfloat *params);
+angle::CallCapture CaptureTexGeniOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLint param);
+angle::CallCapture CaptureTexGenivOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ const GLint *params);
+angle::CallCapture CaptureTexGenxOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLfixed param);
+angle::CallCapture CaptureTexGenxvOES(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ const GLfixed *params);
+
+// GL_OES_texture_storage_multisample_2d_array
+angle::CallCapture CaptureTexStorage3DMultisampleOES(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations);
+
+// GL_OES_vertex_array_object
+angle::CallCapture CaptureBindVertexArrayOES(const Context *context,
+ bool isCallValid,
+ GLuint array);
+angle::CallCapture CaptureDeleteVertexArraysOES(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *arrays);
+angle::CallCapture CaptureGenVertexArraysOES(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *arrays);
+angle::CallCapture CaptureIsVertexArrayOES(const Context *context, bool isCallValid, GLuint array);
+
+// GL_OVR_multiview
+angle::CallCapture CaptureFramebufferTextureMultiviewOVR(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews);
+
+// GL_OVR_multiview2
+
+// Parameter Captures
+
+void CaptureDrawElementsInstancedANGLE_indices(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei primcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawArraysANGLE_firsts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawArraysANGLE_counts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawArraysInstancedANGLE_firsts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawArraysInstancedANGLE_counts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawArraysInstancedANGLE_instanceCounts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawElementsANGLE_counts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawElementsANGLE_indices(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawElementsInstancedANGLE_counts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawElementsInstancedANGLE_indices(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureMultiDrawElementsInstancedANGLE_instanceCounts(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount,
+ angle::ParamCapture *paramCapture);
+void CaptureRequestExtensionANGLE_name(const Context *context,
+ bool isCallValid,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBooleanvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBooleanvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferParameterivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferParameterivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFloatvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFloatvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFramebufferAttachmentParameterivRobustANGLE_length(
+ const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFramebufferAttachmentParameterivRobustANGLE_params(
+ const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetIntegervRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetIntegervRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetRenderbufferParameterivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetRenderbufferParameterivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetShaderivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterfvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterfvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformfvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformfvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribfvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribfvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribPointervRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribPointervRobustANGLE_pointer(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer,
+ angle::ParamCapture *paramCapture);
+void CaptureReadPixelsRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureReadPixelsRobustANGLE_columns(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureReadPixelsRobustANGLE_rows(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureReadPixelsRobustANGLE_pixels(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTexImage2DRobustANGLE_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterfvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexSubImage2DRobustANGLE_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTexImage3DRobustANGLE_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTexSubImage3DRobustANGLE_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexImage2DRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexSubImage2DRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexImage3DRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexSubImage3DRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectuivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectuivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferPointervRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferPointervRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetIntegeri_vRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetIntegeri_vRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInternalformativRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInternalformativRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribIivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribIivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribIuivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetVertexAttribIuivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformuivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUniformuivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniformBlockivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetActiveUniformBlockivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInteger64vRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInteger64vRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInteger64i_vRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetInteger64i_vRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferParameteri64vRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferParameteri64vRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameterivRobustANGLE_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameterfvRobustANGLE_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterfvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterfvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFramebufferParameterivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFramebufferParameterivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramInterfaceivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramInterfaceivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBooleani_vRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBooleani_vRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetMultisamplefvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val,
+ angle::ParamCapture *paramCapture);
+void CaptureGetMultisamplefvRobustANGLE_val(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameterivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameterivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameterfvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameterfvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetPointervRobustANGLERobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetPointervRobustANGLERobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureReadnPixelsRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureReadnPixelsRobustANGLE_columns(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureReadnPixelsRobustANGLE_rows(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureReadnPixelsRobustANGLE_data(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformfvRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformfvRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformuivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformuivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterIivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterIuivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterIivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterIivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterIuivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterIuivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameterIivRobustANGLE_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameterIuivRobustANGLE_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterIivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterIivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterIuivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterIuivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectivRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectivRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjecti64vRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjecti64vRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectui64vRobustANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectui64vRobustANGLE_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameterivANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexLevelParameterfvANGLE_params(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetMultisamplefvANGLE_val(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTranslatedShaderSourceANGLE_length(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTranslatedShaderSourceANGLE_source(const Context *context,
+ bool isCallValid,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source,
+ angle::ParamCapture *paramCapture);
+void CaptureBindUniformLocationCHROMIUM_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureMatrixLoadfCHROMIUM_matrix(const Context *context,
+ bool isCallValid,
+ GLenum matrixMode,
+ const GLfloat *matrix,
+ angle::ParamCapture *paramCapture);
+void CapturePathCommandsCHROMIUM_commands(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords,
+ angle::ParamCapture *paramCapture);
+void CapturePathCommandsCHROMIUM_coords(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords,
+ angle::ParamCapture *paramCapture);
+void CaptureGetPathParameterfvCHROMIUM_value(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum pname,
+ GLfloat *value,
+ angle::ParamCapture *paramCapture);
+void CaptureGetPathParameterivCHROMIUM_value(const Context *context,
+ bool isCallValid,
+ GLuint path,
+ GLenum pname,
+ GLint *value,
+ angle::ParamCapture *paramCapture);
+void CaptureCoverFillPathInstancedCHROMIUM_paths(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureCoverFillPathInstancedCHROMIUM_transformValues(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureCoverStrokePathInstancedCHROMIUM_paths(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureCoverStrokePathInstancedCHROMIUM_transformValues(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilStrokePathInstancedCHROMIUM_paths(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilStrokePathInstancedCHROMIUM_transformValues(const Context *context,
+ bool isCallValid,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilFillPathInstancedCHROMIUM_paths(const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilFillPathInstancedCHROMIUM_transformValues(const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilThenCoverFillPathInstancedCHROMIUM_paths(const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilThenCoverFillPathInstancedCHROMIUM_transformValues(
+ const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilThenCoverStrokePathInstancedCHROMIUM_paths(const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureStencilThenCoverStrokePathInstancedCHROMIUM_transformValues(
+ const Context *context,
+ bool isCallValid,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues,
+ angle::ParamCapture *paramCapture);
+void CaptureBindFragmentInputLocationCHROMIUM_name(const Context *context,
+ bool isCallValid,
+ GLuint programs,
+ GLint location,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramPathFragmentInputGenCHROMIUM_coeffs(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs,
+ angle::ParamCapture *paramCapture);
+void CaptureBindFragDataLocationEXT_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint color,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureBindFragDataLocationIndexedEXT_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFragDataIndexEXT_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramResourceLocationIndexEXT_name(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name,
+ angle::ParamCapture *paramCapture);
+void CaptureInsertEventMarkerEXT_marker(const Context *context,
+ bool isCallValid,
+ GLsizei length,
+ const GLchar *marker,
+ angle::ParamCapture *paramCapture);
+void CapturePushGroupMarkerEXT_marker(const Context *context,
+ bool isCallValid,
+ GLsizei length,
+ const GLchar *marker,
+ angle::ParamCapture *paramCapture);
+void CaptureDiscardFramebufferEXT_attachments(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteQueriesEXT_ids(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *ids,
+ angle::ParamCapture *paramCapture);
+void CaptureGenQueriesEXT_ids(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *ids,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjecti64vEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectivEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectui64vEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLuint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryObjectuivEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint id,
+ GLenum pname,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetQueryivEXT_params(const Context *context,
+ bool isCallValid,
+ QueryType targetPacked,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawBuffersEXT_bufs(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLenum *bufs,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawElementsInstancedEXT_indices(const Context *context,
+ bool isCallValid,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei primcount,
+ angle::ParamCapture *paramCapture);
+void CaptureCreateMemoryObjectsEXT_memoryObjects(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *memoryObjects,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteMemoryObjectsEXT_memoryObjects(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *memoryObjects,
+ angle::ParamCapture *paramCapture);
+void CaptureGetMemoryObjectParameterivEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint memoryObject,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUnsignedBytevEXT_data(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ GLubyte *data,
+ angle::ParamCapture *paramCapture);
+void CaptureGetUnsignedBytei_vEXT_data(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLuint index,
+ GLubyte *data,
+ angle::ParamCapture *paramCapture);
+void CaptureMemoryObjectParameterivEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint memoryObject,
+ GLenum pname,
+ const GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformfvEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetnUniformivEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureReadnPixelsEXT_data(const Context *context,
+ bool isCallValid,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteSemaphoresEXT_semaphores(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *semaphores,
+ angle::ParamCapture *paramCapture);
+void CaptureGenSemaphoresEXT_semaphores(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *semaphores,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSemaphoreParameterui64vEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureSemaphoreParameterui64vEXT_params(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params,
+ angle::ParamCapture *paramCapture);
+void CaptureSignalSemaphoreEXT_buffers(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts,
+ angle::ParamCapture *paramCapture);
+void CaptureSignalSemaphoreEXT_textures(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts,
+ angle::ParamCapture *paramCapture);
+void CaptureSignalSemaphoreEXT_dstLayouts(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts,
+ angle::ParamCapture *paramCapture);
+void CaptureWaitSemaphoreEXT_buffers(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts,
+ angle::ParamCapture *paramCapture);
+void CaptureWaitSemaphoreEXT_textures(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts,
+ angle::ParamCapture *paramCapture);
+void CaptureWaitSemaphoreEXT_srcLayouts(const Context *context,
+ bool isCallValid,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts,
+ angle::ParamCapture *paramCapture);
+void CaptureDebugMessageCallbackKHR_userParam(const Context *context,
+ bool isCallValid,
+ GLDEBUGPROCKHR callback,
+ const void *userParam,
+ angle::ParamCapture *paramCapture);
+void CaptureDebugMessageControlKHR_ids(const Context *context,
+ bool isCallValid,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled,
+ angle::ParamCapture *paramCapture);
+void CaptureDebugMessageInsertKHR_buf(const Context *context,
+ bool isCallValid,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf,
+ angle::ParamCapture *paramCapture);
+void CaptureGetDebugMessageLogKHR_sources(const Context *context,
+ bool isCallValid,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetDebugMessageLogKHR_types(const Context *context,
+ bool isCallValid,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetDebugMessageLogKHR_ids(const Context *context,
+ bool isCallValid,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetDebugMessageLogKHR_severities(const Context *context,
+ bool isCallValid,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetDebugMessageLogKHR_lengths(const Context *context,
+ bool isCallValid,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetDebugMessageLogKHR_messageLog(const Context *context,
+ bool isCallValid,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog,
+ angle::ParamCapture *paramCapture);
+void CaptureGetObjectLabelKHR_length(const Context *context,
+ bool isCallValid,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CaptureGetObjectLabelKHR_label(const Context *context,
+ bool isCallValid,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CaptureGetObjectPtrLabelKHR_ptr(const Context *context,
+ bool isCallValid,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CaptureGetObjectPtrLabelKHR_length(const Context *context,
+ bool isCallValid,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CaptureGetObjectPtrLabelKHR_label(const Context *context,
+ bool isCallValid,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CaptureGetPointervKHR_params(const Context *context,
+ bool isCallValid,
+ GLenum pname,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureObjectLabelKHR_label(const Context *context,
+ bool isCallValid,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CaptureObjectPtrLabelKHR_ptr(const Context *context,
+ bool isCallValid,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CaptureObjectPtrLabelKHR_label(const Context *context,
+ bool isCallValid,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label,
+ angle::ParamCapture *paramCapture);
+void CapturePushDebugGroupKHR_message(const Context *context,
+ bool isCallValid,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteFencesNV_fences(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *fences,
+ angle::ParamCapture *paramCapture);
+void CaptureGenFencesNV_fences(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *fences,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFenceivNV_params(const Context *context,
+ bool isCallValid,
+ GLuint fence,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawTexfvOES_coords(const Context *context,
+ bool isCallValid,
+ const GLfloat *coords,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawTexivOES_coords(const Context *context,
+ bool isCallValid,
+ const GLint *coords,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawTexsvOES_coords(const Context *context,
+ bool isCallValid,
+ const GLshort *coords,
+ angle::ParamCapture *paramCapture);
+void CaptureDrawTexxvOES_coords(const Context *context,
+ bool isCallValid,
+ const GLfixed *coords,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteFramebuffersOES_framebuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *framebuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteRenderbuffersOES_renderbuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *renderbuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureGenFramebuffersOES_framebuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *framebuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureGenRenderbuffersOES_renderbuffers(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *renderbuffers,
+ angle::ParamCapture *paramCapture);
+void CaptureGetFramebufferAttachmentParameterivOES_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetRenderbufferParameterivOES_params(const Context *context,
+ bool isCallValid,
+ GLenum target,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramBinaryOES_length(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramBinaryOES_binaryFormat(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary,
+ angle::ParamCapture *paramCapture);
+void CaptureGetProgramBinaryOES_binary(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary,
+ angle::ParamCapture *paramCapture);
+void CaptureProgramBinaryOES_binary(const Context *context,
+ bool isCallValid,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length,
+ angle::ParamCapture *paramCapture);
+void CaptureGetBufferPointervOES_params(const Context *context,
+ bool isCallValid,
+ BufferBinding targetPacked,
+ GLenum pname,
+ void **params,
+ angle::ParamCapture *paramCapture);
+void CaptureMatrixIndexPointerOES_pointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+void CaptureWeightPointerOES_pointer(const Context *context,
+ bool isCallValid,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+void CapturePointSizePointerOES_pointer(const Context *context,
+ bool isCallValid,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer,
+ angle::ParamCapture *paramCapture);
+void CaptureQueryMatrixxOES_mantissa(const Context *context,
+ bool isCallValid,
+ GLfixed *mantissa,
+ GLint *exponent,
+ angle::ParamCapture *paramCapture);
+void CaptureQueryMatrixxOES_exponent(const Context *context,
+ bool isCallValid,
+ GLfixed *mantissa,
+ GLint *exponent,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexImage3DOES_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureCompressedTexSubImage3DOES_data(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data,
+ angle::ParamCapture *paramCapture);
+void CaptureTexImage3DOES_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureTexSubImage3DOES_pixels(const Context *context,
+ bool isCallValid,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterIivOES_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetSamplerParameterIuivOES_params(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterIivOES_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexParameterIuivOES_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameterIivOES_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param,
+ angle::ParamCapture *paramCapture);
+void CaptureSamplerParameterIuivOES_param(const Context *context,
+ bool isCallValid,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterIivOES_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexParameterIuivOES_params(const Context *context,
+ bool isCallValid,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLuint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexGenfvOES_params(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexGenivOES_params(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureGetTexGenxvOES_params(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexGenfvOES_params(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ const GLfloat *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexGenivOES_params(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ const GLint *params,
+ angle::ParamCapture *paramCapture);
+void CaptureTexGenxvOES_params(const Context *context,
+ bool isCallValid,
+ GLenum coord,
+ GLenum pname,
+ const GLfixed *params,
+ angle::ParamCapture *paramCapture);
+void CaptureDeleteVertexArraysOES_arrays(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ const GLuint *arrays,
+ angle::ParamCapture *paramCapture);
+void CaptureGenVertexArraysOES_arrays(const Context *context,
+ bool isCallValid,
+ GLsizei n,
+ GLuint *arrays,
+ angle::ParamCapture *paramCapture);
+} // namespace gl
+
+#endif // LIBANGLE_CAPTURE_GLES_ext_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h b/gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h
new file mode 100644
index 0000000000..f791e82a1c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h
@@ -0,0 +1,1366 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_enum_autogen.h:
+// Defines the GL/GLES entry points enumeration.
+
+#ifndef LIBANGLE_ENTRYPOINTSENUM_AUTOGEN_H_
+#define LIBANGLE_ENTRYPOINTSENUM_AUTOGEN_H_
+
+namespace gl
+{
+enum class EntryPoint
+{
+ Accum,
+ ActiveShaderProgram,
+ ActiveTexture,
+ AlphaFunc,
+ AlphaFuncx,
+ AreTexturesResident,
+ ArrayElement,
+ AttachShader,
+ Begin,
+ BeginConditionalRender,
+ BeginQuery,
+ BeginQueryEXT,
+ BeginQueryIndexed,
+ BeginTransformFeedback,
+ BindAttribLocation,
+ BindBuffer,
+ BindBufferBase,
+ BindBufferRange,
+ BindBuffersBase,
+ BindBuffersRange,
+ BindFragDataLocation,
+ BindFragDataLocationEXT,
+ BindFragDataLocationIndexed,
+ BindFragDataLocationIndexedEXT,
+ BindFragmentInputLocationCHROMIUM,
+ BindFramebuffer,
+ BindFramebufferOES,
+ BindImageTexture,
+ BindImageTextures,
+ BindProgramPipeline,
+ BindRenderbuffer,
+ BindRenderbufferOES,
+ BindSampler,
+ BindSamplers,
+ BindTexture,
+ BindTextureUnit,
+ BindTextures,
+ BindTransformFeedback,
+ BindUniformLocationCHROMIUM,
+ BindVertexArray,
+ BindVertexArrayOES,
+ BindVertexBuffer,
+ BindVertexBuffers,
+ Bitmap,
+ BlendColor,
+ BlendEquation,
+ BlendEquationSeparate,
+ BlendEquationSeparatei,
+ BlendEquationi,
+ BlendFunc,
+ BlendFuncSeparate,
+ BlendFuncSeparatei,
+ BlendFunci,
+ BlitFramebuffer,
+ BlitFramebufferANGLE,
+ BlitNamedFramebuffer,
+ BufferData,
+ BufferStorage,
+ BufferStorageMemEXT,
+ BufferSubData,
+ CallList,
+ CallLists,
+ CheckFramebufferStatus,
+ CheckFramebufferStatusOES,
+ CheckNamedFramebufferStatus,
+ ClampColor,
+ Clear,
+ ClearAccum,
+ ClearBufferData,
+ ClearBufferSubData,
+ ClearBufferfi,
+ ClearBufferfv,
+ ClearBufferiv,
+ ClearBufferuiv,
+ ClearColor,
+ ClearColorx,
+ ClearDepth,
+ ClearDepthf,
+ ClearDepthx,
+ ClearIndex,
+ ClearNamedBufferData,
+ ClearNamedBufferSubData,
+ ClearNamedFramebufferfi,
+ ClearNamedFramebufferfv,
+ ClearNamedFramebufferiv,
+ ClearNamedFramebufferuiv,
+ ClearStencil,
+ ClearTexImage,
+ ClearTexSubImage,
+ ClientActiveTexture,
+ ClientWaitSync,
+ ClipControl,
+ ClipPlane,
+ ClipPlanef,
+ ClipPlanex,
+ Color3b,
+ Color3bv,
+ Color3d,
+ Color3dv,
+ Color3f,
+ Color3fv,
+ Color3i,
+ Color3iv,
+ Color3s,
+ Color3sv,
+ Color3ub,
+ Color3ubv,
+ Color3ui,
+ Color3uiv,
+ Color3us,
+ Color3usv,
+ Color4b,
+ Color4bv,
+ Color4d,
+ Color4dv,
+ Color4f,
+ Color4fv,
+ Color4i,
+ Color4iv,
+ Color4s,
+ Color4sv,
+ Color4ub,
+ Color4ubv,
+ Color4ui,
+ Color4uiv,
+ Color4us,
+ Color4usv,
+ Color4x,
+ ColorMask,
+ ColorMaski,
+ ColorMaterial,
+ ColorP3ui,
+ ColorP3uiv,
+ ColorP4ui,
+ ColorP4uiv,
+ ColorPointer,
+ CompileShader,
+ CompressedCopyTextureCHROMIUM,
+ CompressedTexImage1D,
+ CompressedTexImage2D,
+ CompressedTexImage2DRobustANGLE,
+ CompressedTexImage3D,
+ CompressedTexImage3DOES,
+ CompressedTexImage3DRobustANGLE,
+ CompressedTexSubImage1D,
+ CompressedTexSubImage2D,
+ CompressedTexSubImage2DRobustANGLE,
+ CompressedTexSubImage3D,
+ CompressedTexSubImage3DOES,
+ CompressedTexSubImage3DRobustANGLE,
+ CompressedTextureSubImage1D,
+ CompressedTextureSubImage2D,
+ CompressedTextureSubImage3D,
+ CopyBufferSubData,
+ CopyImageSubData,
+ CopyNamedBufferSubData,
+ CopyPixels,
+ CopySubTexture3DANGLE,
+ CopySubTextureCHROMIUM,
+ CopyTexImage1D,
+ CopyTexImage2D,
+ CopyTexSubImage1D,
+ CopyTexSubImage2D,
+ CopyTexSubImage3D,
+ CopyTexSubImage3DOES,
+ CopyTexture3DANGLE,
+ CopyTextureCHROMIUM,
+ CopyTextureSubImage1D,
+ CopyTextureSubImage2D,
+ CopyTextureSubImage3D,
+ CoverFillPathCHROMIUM,
+ CoverFillPathInstancedCHROMIUM,
+ CoverStrokePathCHROMIUM,
+ CoverStrokePathInstancedCHROMIUM,
+ CoverageModulationCHROMIUM,
+ CreateBuffers,
+ CreateFramebuffers,
+ CreateMemoryObjectsEXT,
+ CreateProgram,
+ CreateProgramPipelines,
+ CreateQueries,
+ CreateRenderbuffers,
+ CreateSamplers,
+ CreateShader,
+ CreateShaderProgramv,
+ CreateTextures,
+ CreateTransformFeedbacks,
+ CreateVertexArrays,
+ CullFace,
+ CurrentPaletteMatrixOES,
+ DebugMessageCallback,
+ DebugMessageCallbackKHR,
+ DebugMessageControl,
+ DebugMessageControlKHR,
+ DebugMessageInsert,
+ DebugMessageInsertKHR,
+ DeleteBuffers,
+ DeleteFencesNV,
+ DeleteFramebuffers,
+ DeleteFramebuffersOES,
+ DeleteLists,
+ DeleteMemoryObjectsEXT,
+ DeletePathsCHROMIUM,
+ DeleteProgram,
+ DeleteProgramPipelines,
+ DeleteQueries,
+ DeleteQueriesEXT,
+ DeleteRenderbuffers,
+ DeleteRenderbuffersOES,
+ DeleteSamplers,
+ DeleteSemaphoresEXT,
+ DeleteShader,
+ DeleteSync,
+ DeleteTextures,
+ DeleteTransformFeedbacks,
+ DeleteVertexArrays,
+ DeleteVertexArraysOES,
+ DepthFunc,
+ DepthMask,
+ DepthRange,
+ DepthRangeArrayv,
+ DepthRangeIndexed,
+ DepthRangef,
+ DepthRangex,
+ DetachShader,
+ Disable,
+ DisableClientState,
+ DisableVertexArrayAttrib,
+ DisableVertexAttribArray,
+ Disablei,
+ DiscardFramebufferEXT,
+ DispatchCompute,
+ DispatchComputeIndirect,
+ DrawArrays,
+ DrawArraysIndirect,
+ DrawArraysInstanced,
+ DrawArraysInstancedANGLE,
+ DrawArraysInstancedBaseInstance,
+ DrawArraysInstancedEXT,
+ DrawBuffer,
+ DrawBuffers,
+ DrawBuffersEXT,
+ DrawElements,
+ DrawElementsBaseVertex,
+ DrawElementsIndirect,
+ DrawElementsInstanced,
+ DrawElementsInstancedANGLE,
+ DrawElementsInstancedBaseInstance,
+ DrawElementsInstancedBaseVertex,
+ DrawElementsInstancedBaseVertexBaseInstance,
+ DrawElementsInstancedEXT,
+ DrawPixels,
+ DrawRangeElements,
+ DrawRangeElementsBaseVertex,
+ DrawTexfOES,
+ DrawTexfvOES,
+ DrawTexiOES,
+ DrawTexivOES,
+ DrawTexsOES,
+ DrawTexsvOES,
+ DrawTexxOES,
+ DrawTexxvOES,
+ DrawTransformFeedback,
+ DrawTransformFeedbackInstanced,
+ DrawTransformFeedbackStream,
+ DrawTransformFeedbackStreamInstanced,
+ EGLImageTargetRenderbufferStorageOES,
+ EGLImageTargetTexture2DOES,
+ EdgeFlag,
+ EdgeFlagPointer,
+ EdgeFlagv,
+ Enable,
+ EnableClientState,
+ EnableVertexArrayAttrib,
+ EnableVertexAttribArray,
+ Enablei,
+ End,
+ EndConditionalRender,
+ EndList,
+ EndQuery,
+ EndQueryEXT,
+ EndQueryIndexed,
+ EndTransformFeedback,
+ EvalCoord1d,
+ EvalCoord1dv,
+ EvalCoord1f,
+ EvalCoord1fv,
+ EvalCoord2d,
+ EvalCoord2dv,
+ EvalCoord2f,
+ EvalCoord2fv,
+ EvalMesh1,
+ EvalMesh2,
+ EvalPoint1,
+ EvalPoint2,
+ FeedbackBuffer,
+ FenceSync,
+ Finish,
+ FinishFenceNV,
+ Flush,
+ FlushMappedBufferRange,
+ FlushMappedBufferRangeEXT,
+ FlushMappedNamedBufferRange,
+ FogCoordPointer,
+ FogCoordd,
+ FogCoorddv,
+ FogCoordf,
+ FogCoordfv,
+ Fogf,
+ Fogfv,
+ Fogi,
+ Fogiv,
+ Fogx,
+ Fogxv,
+ FramebufferParameteri,
+ FramebufferRenderbuffer,
+ FramebufferRenderbufferOES,
+ FramebufferTexture,
+ FramebufferTexture1D,
+ FramebufferTexture2D,
+ FramebufferTexture2DOES,
+ FramebufferTexture3D,
+ FramebufferTexture3DOES,
+ FramebufferTextureEXT,
+ FramebufferTextureLayer,
+ FramebufferTextureMultiviewOVR,
+ FrontFace,
+ Frustum,
+ Frustumf,
+ Frustumx,
+ GenBuffers,
+ GenFencesNV,
+ GenFramebuffers,
+ GenFramebuffersOES,
+ GenLists,
+ GenPathsCHROMIUM,
+ GenProgramPipelines,
+ GenQueries,
+ GenQueriesEXT,
+ GenRenderbuffers,
+ GenRenderbuffersOES,
+ GenSamplers,
+ GenSemaphoresEXT,
+ GenTextures,
+ GenTransformFeedbacks,
+ GenVertexArrays,
+ GenVertexArraysOES,
+ GenerateMipmap,
+ GenerateMipmapOES,
+ GenerateTextureMipmap,
+ GetActiveAtomicCounterBufferiv,
+ GetActiveAttrib,
+ GetActiveSubroutineName,
+ GetActiveSubroutineUniformName,
+ GetActiveSubroutineUniformiv,
+ GetActiveUniform,
+ GetActiveUniformBlockName,
+ GetActiveUniformBlockiv,
+ GetActiveUniformBlockivRobustANGLE,
+ GetActiveUniformName,
+ GetActiveUniformsiv,
+ GetAttachedShaders,
+ GetAttribLocation,
+ GetBooleani_v,
+ GetBooleani_vRobustANGLE,
+ GetBooleanv,
+ GetBooleanvRobustANGLE,
+ GetBufferParameteri64v,
+ GetBufferParameteri64vRobustANGLE,
+ GetBufferParameteriv,
+ GetBufferParameterivRobustANGLE,
+ GetBufferPointerv,
+ GetBufferPointervOES,
+ GetBufferPointervRobustANGLE,
+ GetBufferSubData,
+ GetClipPlane,
+ GetClipPlanef,
+ GetClipPlanex,
+ GetCompressedTexImage,
+ GetCompressedTextureImage,
+ GetCompressedTextureSubImage,
+ GetDebugMessageLog,
+ GetDebugMessageLogKHR,
+ GetDoublei_v,
+ GetDoublev,
+ GetError,
+ GetFenceivNV,
+ GetFixedv,
+ GetFloati_v,
+ GetFloatv,
+ GetFloatvRobustANGLE,
+ GetFragDataIndex,
+ GetFragDataIndexEXT,
+ GetFragDataLocation,
+ GetFramebufferAttachmentParameteriv,
+ GetFramebufferAttachmentParameterivOES,
+ GetFramebufferAttachmentParameterivRobustANGLE,
+ GetFramebufferParameteriv,
+ GetFramebufferParameterivRobustANGLE,
+ GetGraphicsResetStatus,
+ GetGraphicsResetStatusEXT,
+ GetInteger64i_v,
+ GetInteger64i_vRobustANGLE,
+ GetInteger64v,
+ GetInteger64vRobustANGLE,
+ GetIntegeri_v,
+ GetIntegeri_vRobustANGLE,
+ GetIntegerv,
+ GetIntegervRobustANGLE,
+ GetInternalformati64v,
+ GetInternalformativ,
+ GetInternalformativRobustANGLE,
+ GetLightfv,
+ GetLightiv,
+ GetLightxv,
+ GetMapdv,
+ GetMapfv,
+ GetMapiv,
+ GetMaterialfv,
+ GetMaterialiv,
+ GetMaterialxv,
+ GetMemoryObjectParameterivEXT,
+ GetMultisamplefv,
+ GetMultisamplefvANGLE,
+ GetMultisamplefvRobustANGLE,
+ GetNamedBufferParameteri64v,
+ GetNamedBufferParameteriv,
+ GetNamedBufferPointerv,
+ GetNamedBufferSubData,
+ GetNamedFramebufferAttachmentParameteriv,
+ GetNamedFramebufferParameteriv,
+ GetNamedRenderbufferParameteriv,
+ GetObjectLabel,
+ GetObjectLabelKHR,
+ GetObjectPtrLabel,
+ GetObjectPtrLabelKHR,
+ GetPathParameterfvCHROMIUM,
+ GetPathParameterivCHROMIUM,
+ GetPixelMapfv,
+ GetPixelMapuiv,
+ GetPixelMapusv,
+ GetPointerv,
+ GetPointervKHR,
+ GetPointervRobustANGLERobustANGLE,
+ GetPolygonStipple,
+ GetProgramBinary,
+ GetProgramBinaryOES,
+ GetProgramInfoLog,
+ GetProgramInterfaceiv,
+ GetProgramInterfaceivRobustANGLE,
+ GetProgramPipelineInfoLog,
+ GetProgramPipelineiv,
+ GetProgramResourceIndex,
+ GetProgramResourceLocation,
+ GetProgramResourceLocationIndex,
+ GetProgramResourceLocationIndexEXT,
+ GetProgramResourceName,
+ GetProgramResourceiv,
+ GetProgramStageiv,
+ GetProgramiv,
+ GetProgramivRobustANGLE,
+ GetQueryBufferObjecti64v,
+ GetQueryBufferObjectiv,
+ GetQueryBufferObjectui64v,
+ GetQueryBufferObjectuiv,
+ GetQueryIndexediv,
+ GetQueryObjecti64v,
+ GetQueryObjecti64vEXT,
+ GetQueryObjecti64vRobustANGLE,
+ GetQueryObjectiv,
+ GetQueryObjectivEXT,
+ GetQueryObjectivRobustANGLE,
+ GetQueryObjectui64v,
+ GetQueryObjectui64vEXT,
+ GetQueryObjectui64vRobustANGLE,
+ GetQueryObjectuiv,
+ GetQueryObjectuivEXT,
+ GetQueryObjectuivRobustANGLE,
+ GetQueryiv,
+ GetQueryivEXT,
+ GetQueryivRobustANGLE,
+ GetRenderbufferParameteriv,
+ GetRenderbufferParameterivOES,
+ GetRenderbufferParameterivRobustANGLE,
+ GetSamplerParameterIiv,
+ GetSamplerParameterIivOES,
+ GetSamplerParameterIivRobustANGLE,
+ GetSamplerParameterIuiv,
+ GetSamplerParameterIuivOES,
+ GetSamplerParameterIuivRobustANGLE,
+ GetSamplerParameterfv,
+ GetSamplerParameterfvRobustANGLE,
+ GetSamplerParameteriv,
+ GetSamplerParameterivRobustANGLE,
+ GetSemaphoreParameterui64vEXT,
+ GetShaderInfoLog,
+ GetShaderPrecisionFormat,
+ GetShaderSource,
+ GetShaderiv,
+ GetShaderivRobustANGLE,
+ GetString,
+ GetStringi,
+ GetSubroutineIndex,
+ GetSubroutineUniformLocation,
+ GetSynciv,
+ GetTexEnvfv,
+ GetTexEnviv,
+ GetTexEnvxv,
+ GetTexGendv,
+ GetTexGenfv,
+ GetTexGenfvOES,
+ GetTexGeniv,
+ GetTexGenivOES,
+ GetTexGenxvOES,
+ GetTexImage,
+ GetTexLevelParameterfv,
+ GetTexLevelParameterfvANGLE,
+ GetTexLevelParameterfvRobustANGLE,
+ GetTexLevelParameteriv,
+ GetTexLevelParameterivANGLE,
+ GetTexLevelParameterivRobustANGLE,
+ GetTexParameterIiv,
+ GetTexParameterIivOES,
+ GetTexParameterIivRobustANGLE,
+ GetTexParameterIuiv,
+ GetTexParameterIuivOES,
+ GetTexParameterIuivRobustANGLE,
+ GetTexParameterfv,
+ GetTexParameterfvRobustANGLE,
+ GetTexParameteriv,
+ GetTexParameterivRobustANGLE,
+ GetTexParameterxv,
+ GetTextureImage,
+ GetTextureLevelParameterfv,
+ GetTextureLevelParameteriv,
+ GetTextureParameterIiv,
+ GetTextureParameterIuiv,
+ GetTextureParameterfv,
+ GetTextureParameteriv,
+ GetTextureSubImage,
+ GetTransformFeedbackVarying,
+ GetTransformFeedbacki64_v,
+ GetTransformFeedbacki_v,
+ GetTransformFeedbackiv,
+ GetTranslatedShaderSourceANGLE,
+ GetUniformBlockIndex,
+ GetUniformIndices,
+ GetUniformLocation,
+ GetUniformSubroutineuiv,
+ GetUniformdv,
+ GetUniformfv,
+ GetUniformfvRobustANGLE,
+ GetUniformiv,
+ GetUniformivRobustANGLE,
+ GetUniformuiv,
+ GetUniformuivRobustANGLE,
+ GetUnsignedBytei_vEXT,
+ GetUnsignedBytevEXT,
+ GetVertexArrayIndexed64iv,
+ GetVertexArrayIndexediv,
+ GetVertexArrayiv,
+ GetVertexAttribIiv,
+ GetVertexAttribIivRobustANGLE,
+ GetVertexAttribIuiv,
+ GetVertexAttribIuivRobustANGLE,
+ GetVertexAttribLdv,
+ GetVertexAttribPointerv,
+ GetVertexAttribPointervRobustANGLE,
+ GetVertexAttribdv,
+ GetVertexAttribfv,
+ GetVertexAttribfvRobustANGLE,
+ GetVertexAttribiv,
+ GetVertexAttribivRobustANGLE,
+ GetnColorTable,
+ GetnCompressedTexImage,
+ GetnConvolutionFilter,
+ GetnHistogram,
+ GetnMapdv,
+ GetnMapfv,
+ GetnMapiv,
+ GetnMinmax,
+ GetnPixelMapfv,
+ GetnPixelMapuiv,
+ GetnPixelMapusv,
+ GetnPolygonStipple,
+ GetnSeparableFilter,
+ GetnTexImage,
+ GetnUniformdv,
+ GetnUniformfv,
+ GetnUniformfvEXT,
+ GetnUniformfvRobustANGLE,
+ GetnUniformiv,
+ GetnUniformivEXT,
+ GetnUniformivRobustANGLE,
+ GetnUniformuiv,
+ GetnUniformuivRobustANGLE,
+ Hint,
+ ImportMemoryFdEXT,
+ ImportSemaphoreFdEXT,
+ IndexMask,
+ IndexPointer,
+ Indexd,
+ Indexdv,
+ Indexf,
+ Indexfv,
+ Indexi,
+ Indexiv,
+ Indexs,
+ Indexsv,
+ Indexub,
+ Indexubv,
+ InitNames,
+ InsertEventMarkerEXT,
+ InterleavedArrays,
+ Invalid,
+ InvalidateBufferData,
+ InvalidateBufferSubData,
+ InvalidateFramebuffer,
+ InvalidateNamedFramebufferData,
+ InvalidateNamedFramebufferSubData,
+ InvalidateSubFramebuffer,
+ InvalidateTexImage,
+ InvalidateTexSubImage,
+ InvalidateTextureANGLE,
+ IsBuffer,
+ IsEnabled,
+ IsEnabledi,
+ IsFenceNV,
+ IsFramebuffer,
+ IsFramebufferOES,
+ IsList,
+ IsMemoryObjectEXT,
+ IsPathCHROMIUM,
+ IsProgram,
+ IsProgramPipeline,
+ IsQuery,
+ IsQueryEXT,
+ IsRenderbuffer,
+ IsRenderbufferOES,
+ IsSampler,
+ IsSemaphoreEXT,
+ IsShader,
+ IsSync,
+ IsTexture,
+ IsTransformFeedback,
+ IsVertexArray,
+ IsVertexArrayOES,
+ LightModelf,
+ LightModelfv,
+ LightModeli,
+ LightModeliv,
+ LightModelx,
+ LightModelxv,
+ Lightf,
+ Lightfv,
+ Lighti,
+ Lightiv,
+ Lightx,
+ Lightxv,
+ LineStipple,
+ LineWidth,
+ LineWidthx,
+ LinkProgram,
+ ListBase,
+ LoadIdentity,
+ LoadMatrixd,
+ LoadMatrixf,
+ LoadMatrixx,
+ LoadName,
+ LoadPaletteFromModelViewMatrixOES,
+ LoadTransposeMatrixd,
+ LoadTransposeMatrixf,
+ LogicOp,
+ LoseContextCHROMIUM,
+ Map1d,
+ Map1f,
+ Map2d,
+ Map2f,
+ MapBuffer,
+ MapBufferOES,
+ MapBufferRange,
+ MapBufferRangeEXT,
+ MapGrid1d,
+ MapGrid1f,
+ MapGrid2d,
+ MapGrid2f,
+ MapNamedBuffer,
+ MapNamedBufferRange,
+ Materialf,
+ Materialfv,
+ Materiali,
+ Materialiv,
+ Materialx,
+ Materialxv,
+ MatrixIndexPointerOES,
+ MatrixLoadIdentityCHROMIUM,
+ MatrixLoadfCHROMIUM,
+ MatrixMode,
+ MaxShaderCompilerThreadsKHR,
+ MemoryBarrier,
+ MemoryBarrierByRegion,
+ MemoryObjectParameterivEXT,
+ MinSampleShading,
+ MultMatrixd,
+ MultMatrixf,
+ MultMatrixx,
+ MultTransposeMatrixd,
+ MultTransposeMatrixf,
+ MultiDrawArrays,
+ MultiDrawArraysANGLE,
+ MultiDrawArraysIndirect,
+ MultiDrawArraysIndirectCount,
+ MultiDrawArraysInstancedANGLE,
+ MultiDrawElements,
+ MultiDrawElementsANGLE,
+ MultiDrawElementsBaseVertex,
+ MultiDrawElementsIndirect,
+ MultiDrawElementsIndirectCount,
+ MultiDrawElementsInstancedANGLE,
+ MultiTexCoord1d,
+ MultiTexCoord1dv,
+ MultiTexCoord1f,
+ MultiTexCoord1fv,
+ MultiTexCoord1i,
+ MultiTexCoord1iv,
+ MultiTexCoord1s,
+ MultiTexCoord1sv,
+ MultiTexCoord2d,
+ MultiTexCoord2dv,
+ MultiTexCoord2f,
+ MultiTexCoord2fv,
+ MultiTexCoord2i,
+ MultiTexCoord2iv,
+ MultiTexCoord2s,
+ MultiTexCoord2sv,
+ MultiTexCoord3d,
+ MultiTexCoord3dv,
+ MultiTexCoord3f,
+ MultiTexCoord3fv,
+ MultiTexCoord3i,
+ MultiTexCoord3iv,
+ MultiTexCoord3s,
+ MultiTexCoord3sv,
+ MultiTexCoord4d,
+ MultiTexCoord4dv,
+ MultiTexCoord4f,
+ MultiTexCoord4fv,
+ MultiTexCoord4i,
+ MultiTexCoord4iv,
+ MultiTexCoord4s,
+ MultiTexCoord4sv,
+ MultiTexCoord4x,
+ MultiTexCoordP1ui,
+ MultiTexCoordP1uiv,
+ MultiTexCoordP2ui,
+ MultiTexCoordP2uiv,
+ MultiTexCoordP3ui,
+ MultiTexCoordP3uiv,
+ MultiTexCoordP4ui,
+ MultiTexCoordP4uiv,
+ NamedBufferData,
+ NamedBufferStorage,
+ NamedBufferSubData,
+ NamedFramebufferDrawBuffer,
+ NamedFramebufferDrawBuffers,
+ NamedFramebufferParameteri,
+ NamedFramebufferReadBuffer,
+ NamedFramebufferRenderbuffer,
+ NamedFramebufferTexture,
+ NamedFramebufferTextureLayer,
+ NamedRenderbufferStorage,
+ NamedRenderbufferStorageMultisample,
+ NewList,
+ Normal3b,
+ Normal3bv,
+ Normal3d,
+ Normal3dv,
+ Normal3f,
+ Normal3fv,
+ Normal3i,
+ Normal3iv,
+ Normal3s,
+ Normal3sv,
+ Normal3x,
+ NormalP3ui,
+ NormalP3uiv,
+ NormalPointer,
+ ObjectLabel,
+ ObjectLabelKHR,
+ ObjectPtrLabel,
+ ObjectPtrLabelKHR,
+ Ortho,
+ Orthof,
+ Orthox,
+ PassThrough,
+ PatchParameterfv,
+ PatchParameteri,
+ PathCommandsCHROMIUM,
+ PathParameterfCHROMIUM,
+ PathParameteriCHROMIUM,
+ PathStencilFuncCHROMIUM,
+ PauseTransformFeedback,
+ PixelMapfv,
+ PixelMapuiv,
+ PixelMapusv,
+ PixelStoref,
+ PixelStorei,
+ PixelTransferf,
+ PixelTransferi,
+ PixelZoom,
+ PointParameterf,
+ PointParameterfv,
+ PointParameteri,
+ PointParameteriv,
+ PointParameterx,
+ PointParameterxv,
+ PointSize,
+ PointSizePointerOES,
+ PointSizex,
+ PolygonMode,
+ PolygonOffset,
+ PolygonOffsetClamp,
+ PolygonOffsetx,
+ PolygonStipple,
+ PopAttrib,
+ PopClientAttrib,
+ PopDebugGroup,
+ PopDebugGroupKHR,
+ PopGroupMarkerEXT,
+ PopMatrix,
+ PopName,
+ PrimitiveRestartIndex,
+ PrioritizeTextures,
+ ProgramBinary,
+ ProgramBinaryOES,
+ ProgramParameteri,
+ ProgramPathFragmentInputGenCHROMIUM,
+ ProgramUniform1d,
+ ProgramUniform1dv,
+ ProgramUniform1f,
+ ProgramUniform1fv,
+ ProgramUniform1i,
+ ProgramUniform1iv,
+ ProgramUniform1ui,
+ ProgramUniform1uiv,
+ ProgramUniform2d,
+ ProgramUniform2dv,
+ ProgramUniform2f,
+ ProgramUniform2fv,
+ ProgramUniform2i,
+ ProgramUniform2iv,
+ ProgramUniform2ui,
+ ProgramUniform2uiv,
+ ProgramUniform3d,
+ ProgramUniform3dv,
+ ProgramUniform3f,
+ ProgramUniform3fv,
+ ProgramUniform3i,
+ ProgramUniform3iv,
+ ProgramUniform3ui,
+ ProgramUniform3uiv,
+ ProgramUniform4d,
+ ProgramUniform4dv,
+ ProgramUniform4f,
+ ProgramUniform4fv,
+ ProgramUniform4i,
+ ProgramUniform4iv,
+ ProgramUniform4ui,
+ ProgramUniform4uiv,
+ ProgramUniformMatrix2dv,
+ ProgramUniformMatrix2fv,
+ ProgramUniformMatrix2x3dv,
+ ProgramUniformMatrix2x3fv,
+ ProgramUniformMatrix2x4dv,
+ ProgramUniformMatrix2x4fv,
+ ProgramUniformMatrix3dv,
+ ProgramUniformMatrix3fv,
+ ProgramUniformMatrix3x2dv,
+ ProgramUniformMatrix3x2fv,
+ ProgramUniformMatrix3x4dv,
+ ProgramUniformMatrix3x4fv,
+ ProgramUniformMatrix4dv,
+ ProgramUniformMatrix4fv,
+ ProgramUniformMatrix4x2dv,
+ ProgramUniformMatrix4x2fv,
+ ProgramUniformMatrix4x3dv,
+ ProgramUniformMatrix4x3fv,
+ ProvokingVertex,
+ ProvokingVertexANGLE,
+ PushAttrib,
+ PushClientAttrib,
+ PushDebugGroup,
+ PushDebugGroupKHR,
+ PushGroupMarkerEXT,
+ PushMatrix,
+ PushName,
+ QueryCounter,
+ QueryCounterEXT,
+ QueryMatrixxOES,
+ RasterPos2d,
+ RasterPos2dv,
+ RasterPos2f,
+ RasterPos2fv,
+ RasterPos2i,
+ RasterPos2iv,
+ RasterPos2s,
+ RasterPos2sv,
+ RasterPos3d,
+ RasterPos3dv,
+ RasterPos3f,
+ RasterPos3fv,
+ RasterPos3i,
+ RasterPos3iv,
+ RasterPos3s,
+ RasterPos3sv,
+ RasterPos4d,
+ RasterPos4dv,
+ RasterPos4f,
+ RasterPos4fv,
+ RasterPos4i,
+ RasterPos4iv,
+ RasterPos4s,
+ RasterPos4sv,
+ ReadBuffer,
+ ReadPixels,
+ ReadPixelsRobustANGLE,
+ ReadnPixels,
+ ReadnPixelsEXT,
+ ReadnPixelsRobustANGLE,
+ Rectd,
+ Rectdv,
+ Rectf,
+ Rectfv,
+ Recti,
+ Rectiv,
+ Rects,
+ Rectsv,
+ ReleaseShaderCompiler,
+ RenderMode,
+ RenderbufferStorage,
+ RenderbufferStorageMultisample,
+ RenderbufferStorageMultisampleANGLE,
+ RenderbufferStorageOES,
+ RequestExtensionANGLE,
+ ResumeTransformFeedback,
+ Rotated,
+ Rotatef,
+ Rotatex,
+ SampleCoverage,
+ SampleCoveragex,
+ SampleMaski,
+ SampleMaskiANGLE,
+ SamplerParameterIiv,
+ SamplerParameterIivOES,
+ SamplerParameterIivRobustANGLE,
+ SamplerParameterIuiv,
+ SamplerParameterIuivOES,
+ SamplerParameterIuivRobustANGLE,
+ SamplerParameterf,
+ SamplerParameterfv,
+ SamplerParameterfvRobustANGLE,
+ SamplerParameteri,
+ SamplerParameteriv,
+ SamplerParameterivRobustANGLE,
+ Scaled,
+ Scalef,
+ Scalex,
+ Scissor,
+ ScissorArrayv,
+ ScissorIndexed,
+ ScissorIndexedv,
+ SecondaryColor3b,
+ SecondaryColor3bv,
+ SecondaryColor3d,
+ SecondaryColor3dv,
+ SecondaryColor3f,
+ SecondaryColor3fv,
+ SecondaryColor3i,
+ SecondaryColor3iv,
+ SecondaryColor3s,
+ SecondaryColor3sv,
+ SecondaryColor3ub,
+ SecondaryColor3ubv,
+ SecondaryColor3ui,
+ SecondaryColor3uiv,
+ SecondaryColor3us,
+ SecondaryColor3usv,
+ SecondaryColorP3ui,
+ SecondaryColorP3uiv,
+ SecondaryColorPointer,
+ SelectBuffer,
+ SemaphoreParameterui64vEXT,
+ SetFenceNV,
+ ShadeModel,
+ ShaderBinary,
+ ShaderSource,
+ ShaderStorageBlockBinding,
+ SignalSemaphoreEXT,
+ SpecializeShader,
+ StencilFillPathCHROMIUM,
+ StencilFillPathInstancedCHROMIUM,
+ StencilFunc,
+ StencilFuncSeparate,
+ StencilMask,
+ StencilMaskSeparate,
+ StencilOp,
+ StencilOpSeparate,
+ StencilStrokePathCHROMIUM,
+ StencilStrokePathInstancedCHROMIUM,
+ StencilThenCoverFillPathCHROMIUM,
+ StencilThenCoverFillPathInstancedCHROMIUM,
+ StencilThenCoverStrokePathCHROMIUM,
+ StencilThenCoverStrokePathInstancedCHROMIUM,
+ TestFenceNV,
+ TexBuffer,
+ TexBufferRange,
+ TexCoord1d,
+ TexCoord1dv,
+ TexCoord1f,
+ TexCoord1fv,
+ TexCoord1i,
+ TexCoord1iv,
+ TexCoord1s,
+ TexCoord1sv,
+ TexCoord2d,
+ TexCoord2dv,
+ TexCoord2f,
+ TexCoord2fv,
+ TexCoord2i,
+ TexCoord2iv,
+ TexCoord2s,
+ TexCoord2sv,
+ TexCoord3d,
+ TexCoord3dv,
+ TexCoord3f,
+ TexCoord3fv,
+ TexCoord3i,
+ TexCoord3iv,
+ TexCoord3s,
+ TexCoord3sv,
+ TexCoord4d,
+ TexCoord4dv,
+ TexCoord4f,
+ TexCoord4fv,
+ TexCoord4i,
+ TexCoord4iv,
+ TexCoord4s,
+ TexCoord4sv,
+ TexCoordP1ui,
+ TexCoordP1uiv,
+ TexCoordP2ui,
+ TexCoordP2uiv,
+ TexCoordP3ui,
+ TexCoordP3uiv,
+ TexCoordP4ui,
+ TexCoordP4uiv,
+ TexCoordPointer,
+ TexEnvf,
+ TexEnvfv,
+ TexEnvi,
+ TexEnviv,
+ TexEnvx,
+ TexEnvxv,
+ TexGend,
+ TexGendv,
+ TexGenf,
+ TexGenfOES,
+ TexGenfv,
+ TexGenfvOES,
+ TexGeni,
+ TexGeniOES,
+ TexGeniv,
+ TexGenivOES,
+ TexGenxOES,
+ TexGenxvOES,
+ TexImage1D,
+ TexImage2D,
+ TexImage2DExternalANGLE,
+ TexImage2DMultisample,
+ TexImage2DRobustANGLE,
+ TexImage3D,
+ TexImage3DMultisample,
+ TexImage3DOES,
+ TexImage3DRobustANGLE,
+ TexParameterIiv,
+ TexParameterIivOES,
+ TexParameterIivRobustANGLE,
+ TexParameterIuiv,
+ TexParameterIuivOES,
+ TexParameterIuivRobustANGLE,
+ TexParameterf,
+ TexParameterfv,
+ TexParameterfvRobustANGLE,
+ TexParameteri,
+ TexParameteriv,
+ TexParameterivRobustANGLE,
+ TexParameterx,
+ TexParameterxv,
+ TexStorage1D,
+ TexStorage1DEXT,
+ TexStorage2D,
+ TexStorage2DEXT,
+ TexStorage2DMultisample,
+ TexStorage2DMultisampleANGLE,
+ TexStorage3D,
+ TexStorage3DEXT,
+ TexStorage3DMultisample,
+ TexStorage3DMultisampleOES,
+ TexStorageMem2DEXT,
+ TexStorageMem2DMultisampleEXT,
+ TexStorageMem3DEXT,
+ TexStorageMem3DMultisampleEXT,
+ TexSubImage1D,
+ TexSubImage2D,
+ TexSubImage2DRobustANGLE,
+ TexSubImage3D,
+ TexSubImage3DOES,
+ TexSubImage3DRobustANGLE,
+ TextureBarrier,
+ TextureBuffer,
+ TextureBufferRange,
+ TextureParameterIiv,
+ TextureParameterIuiv,
+ TextureParameterf,
+ TextureParameterfv,
+ TextureParameteri,
+ TextureParameteriv,
+ TextureStorage1D,
+ TextureStorage2D,
+ TextureStorage2DMultisample,
+ TextureStorage3D,
+ TextureStorage3DMultisample,
+ TextureSubImage1D,
+ TextureSubImage2D,
+ TextureSubImage3D,
+ TextureView,
+ TransformFeedbackBufferBase,
+ TransformFeedbackBufferRange,
+ TransformFeedbackVaryings,
+ Translated,
+ Translatef,
+ Translatex,
+ Uniform1d,
+ Uniform1dv,
+ Uniform1f,
+ Uniform1fv,
+ Uniform1i,
+ Uniform1iv,
+ Uniform1ui,
+ Uniform1uiv,
+ Uniform2d,
+ Uniform2dv,
+ Uniform2f,
+ Uniform2fv,
+ Uniform2i,
+ Uniform2iv,
+ Uniform2ui,
+ Uniform2uiv,
+ Uniform3d,
+ Uniform3dv,
+ Uniform3f,
+ Uniform3fv,
+ Uniform3i,
+ Uniform3iv,
+ Uniform3ui,
+ Uniform3uiv,
+ Uniform4d,
+ Uniform4dv,
+ Uniform4f,
+ Uniform4fv,
+ Uniform4i,
+ Uniform4iv,
+ Uniform4ui,
+ Uniform4uiv,
+ UniformBlockBinding,
+ UniformMatrix2dv,
+ UniformMatrix2fv,
+ UniformMatrix2x3dv,
+ UniformMatrix2x3fv,
+ UniformMatrix2x4dv,
+ UniformMatrix2x4fv,
+ UniformMatrix3dv,
+ UniformMatrix3fv,
+ UniformMatrix3x2dv,
+ UniformMatrix3x2fv,
+ UniformMatrix3x4dv,
+ UniformMatrix3x4fv,
+ UniformMatrix4dv,
+ UniformMatrix4fv,
+ UniformMatrix4x2dv,
+ UniformMatrix4x2fv,
+ UniformMatrix4x3dv,
+ UniformMatrix4x3fv,
+ UniformSubroutinesuiv,
+ UnmapBuffer,
+ UnmapBufferOES,
+ UnmapNamedBuffer,
+ UseProgram,
+ UseProgramStages,
+ ValidateProgram,
+ ValidateProgramPipeline,
+ Vertex2d,
+ Vertex2dv,
+ Vertex2f,
+ Vertex2fv,
+ Vertex2i,
+ Vertex2iv,
+ Vertex2s,
+ Vertex2sv,
+ Vertex3d,
+ Vertex3dv,
+ Vertex3f,
+ Vertex3fv,
+ Vertex3i,
+ Vertex3iv,
+ Vertex3s,
+ Vertex3sv,
+ Vertex4d,
+ Vertex4dv,
+ Vertex4f,
+ Vertex4fv,
+ Vertex4i,
+ Vertex4iv,
+ Vertex4s,
+ Vertex4sv,
+ VertexArrayAttribBinding,
+ VertexArrayAttribFormat,
+ VertexArrayAttribIFormat,
+ VertexArrayAttribLFormat,
+ VertexArrayBindingDivisor,
+ VertexArrayElementBuffer,
+ VertexArrayVertexBuffer,
+ VertexArrayVertexBuffers,
+ VertexAttrib1d,
+ VertexAttrib1dv,
+ VertexAttrib1f,
+ VertexAttrib1fv,
+ VertexAttrib1s,
+ VertexAttrib1sv,
+ VertexAttrib2d,
+ VertexAttrib2dv,
+ VertexAttrib2f,
+ VertexAttrib2fv,
+ VertexAttrib2s,
+ VertexAttrib2sv,
+ VertexAttrib3d,
+ VertexAttrib3dv,
+ VertexAttrib3f,
+ VertexAttrib3fv,
+ VertexAttrib3s,
+ VertexAttrib3sv,
+ VertexAttrib4Nbv,
+ VertexAttrib4Niv,
+ VertexAttrib4Nsv,
+ VertexAttrib4Nub,
+ VertexAttrib4Nubv,
+ VertexAttrib4Nuiv,
+ VertexAttrib4Nusv,
+ VertexAttrib4bv,
+ VertexAttrib4d,
+ VertexAttrib4dv,
+ VertexAttrib4f,
+ VertexAttrib4fv,
+ VertexAttrib4iv,
+ VertexAttrib4s,
+ VertexAttrib4sv,
+ VertexAttrib4ubv,
+ VertexAttrib4uiv,
+ VertexAttrib4usv,
+ VertexAttribBinding,
+ VertexAttribDivisor,
+ VertexAttribDivisorANGLE,
+ VertexAttribDivisorEXT,
+ VertexAttribFormat,
+ VertexAttribI1i,
+ VertexAttribI1iv,
+ VertexAttribI1ui,
+ VertexAttribI1uiv,
+ VertexAttribI2i,
+ VertexAttribI2iv,
+ VertexAttribI2ui,
+ VertexAttribI2uiv,
+ VertexAttribI3i,
+ VertexAttribI3iv,
+ VertexAttribI3ui,
+ VertexAttribI3uiv,
+ VertexAttribI4bv,
+ VertexAttribI4i,
+ VertexAttribI4iv,
+ VertexAttribI4sv,
+ VertexAttribI4ubv,
+ VertexAttribI4ui,
+ VertexAttribI4uiv,
+ VertexAttribI4usv,
+ VertexAttribIFormat,
+ VertexAttribIPointer,
+ VertexAttribL1d,
+ VertexAttribL1dv,
+ VertexAttribL2d,
+ VertexAttribL2dv,
+ VertexAttribL3d,
+ VertexAttribL3dv,
+ VertexAttribL4d,
+ VertexAttribL4dv,
+ VertexAttribLFormat,
+ VertexAttribLPointer,
+ VertexAttribP1ui,
+ VertexAttribP1uiv,
+ VertexAttribP2ui,
+ VertexAttribP2uiv,
+ VertexAttribP3ui,
+ VertexAttribP3uiv,
+ VertexAttribP4ui,
+ VertexAttribP4uiv,
+ VertexAttribPointer,
+ VertexBindingDivisor,
+ VertexP2ui,
+ VertexP2uiv,
+ VertexP3ui,
+ VertexP3uiv,
+ VertexP4ui,
+ VertexP4uiv,
+ VertexPointer,
+ Viewport,
+ ViewportArrayv,
+ ViewportIndexedf,
+ ViewportIndexedfv,
+ WaitSemaphoreEXT,
+ WaitSync,
+ WeightPointerOES,
+ WindowPos2d,
+ WindowPos2dv,
+ WindowPos2f,
+ WindowPos2fv,
+ WindowPos2i,
+ WindowPos2iv,
+ WindowPos2s,
+ WindowPos2sv,
+ WindowPos3d,
+ WindowPos3dv,
+ WindowPos3f,
+ WindowPos3fv,
+ WindowPos3i,
+ WindowPos3iv,
+ WindowPos3s,
+ WindowPos3sv
+};
+} // namespace gl
+#endif // LIBANGLE_ENTRY_POINTS_ENUM_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/entry_points_utils.h b/gfx/angle/checkout/src/libANGLE/entry_points_utils.h
new file mode 100644
index 0000000000..0a7b090fe2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/entry_points_utils.h
@@ -0,0 +1,95 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_point_utils:
+// These helpers are used in GL/GLES entry point routines.
+
+#ifndef LIBANGLE_ENTRY_POINT_UTILS_H_
+#define LIBANGLE_ENTRY_POINT_UTILS_H_
+
+#include "angle_gl.h"
+#include "common/Optional.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+#include "libANGLE/entry_points_enum_autogen.h"
+
+namespace gl
+{
+// A template struct for determining the default value to return for each entry point.
+template <EntryPoint EP, typename ReturnType>
+struct DefaultReturnValue;
+
+// Default return values for each basic return type.
+template <EntryPoint EP>
+struct DefaultReturnValue<EP, GLint>
+{
+ static constexpr GLint kValue = -1;
+};
+
+// This doubles as the GLenum return value.
+template <EntryPoint EP>
+struct DefaultReturnValue<EP, GLuint>
+{
+ static constexpr GLuint kValue = 0;
+};
+
+template <EntryPoint EP>
+struct DefaultReturnValue<EP, GLboolean>
+{
+ static constexpr GLboolean kValue = GL_FALSE;
+};
+
+// Catch-all rules for pointer types.
+template <EntryPoint EP, typename PointerType>
+struct DefaultReturnValue<EP, const PointerType *>
+{
+ static constexpr const PointerType *kValue = nullptr;
+};
+
+template <EntryPoint EP, typename PointerType>
+struct DefaultReturnValue<EP, PointerType *>
+{
+ static constexpr PointerType *kValue = nullptr;
+};
+
+// Overloaded to return invalid index
+template <>
+struct DefaultReturnValue<EntryPoint::GetUniformBlockIndex, GLuint>
+{
+ static constexpr GLuint kValue = GL_INVALID_INDEX;
+};
+
+// Specialized enum error value.
+template <>
+struct DefaultReturnValue<EntryPoint::ClientWaitSync, GLenum>
+{
+ static constexpr GLenum kValue = GL_WAIT_FAILED;
+};
+
+// glTestFenceNV should still return TRUE for an invalid fence.
+template <>
+struct DefaultReturnValue<EntryPoint::TestFenceNV, GLboolean>
+{
+ static constexpr GLboolean kValue = GL_TRUE;
+};
+
+template <EntryPoint EP, typename ReturnType>
+constexpr ANGLE_INLINE ReturnType GetDefaultReturnValue()
+{
+ return DefaultReturnValue<EP, ReturnType>::kValue;
+}
+
+#if ANGLE_CAPTURE_ENABLED
+# define ANGLE_CAPTURE(Func, ...) \
+ CaptureCallToFrameCapture("gl" ANGLE_STRINGIFY(Func), Capture##Func, Validate##Func, \
+ __VA_ARGS__)
+#else
+# define ANGLE_CAPTURE(...)
+#endif // ANGLE_CAPTURE_ENABLED
+
+} // namespace gl
+
+#endif // LIBANGLE_ENTRY_POINT_UTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp
new file mode 100644
index 0000000000..0fbb7dfd52
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp
@@ -0,0 +1,171 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_copy_conversion_table.py using data from es3_copy_conversion_formats.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// format_map:
+// Determining the sized internal format from a (format,type) pair.
+// Also check es3 format combinations for validity.
+
+#include "angle_gl.h"
+#include "common/debug.h"
+
+namespace gl
+{
+
+bool ValidES3CopyConversion(GLenum textureFormat, GLenum framebufferFormat)
+{
+ switch (textureFormat)
+ {
+ case GL_ALPHA:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ case GL_RGBA:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_BGRA_EXT:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_LUMINANCE:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ case GL_RED:
+ case GL_RG:
+ case GL_RGB:
+ case GL_RGBA:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_LUMINANCE_ALPHA:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ case GL_RGBA:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RED:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ case GL_RED:
+ case GL_RG:
+ case GL_RGB:
+ case GL_RGBA:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RED_INTEGER:
+ switch (framebufferFormat)
+ {
+ case GL_RED_INTEGER:
+ case GL_RGBA_INTEGER:
+ case GL_RGB_INTEGER:
+ case GL_RG_INTEGER:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RG:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ case GL_RG:
+ case GL_RGB:
+ case GL_RGBA:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGB:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ case GL_RGB:
+ case GL_RGBA:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGBA:
+ switch (framebufferFormat)
+ {
+ case GL_BGRA_EXT:
+ case GL_RGBA:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGBA_INTEGER:
+ switch (framebufferFormat)
+ {
+ case GL_RGBA_INTEGER:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGB_INTEGER:
+ switch (framebufferFormat)
+ {
+ case GL_RGBA_INTEGER:
+ case GL_RGB_INTEGER:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RG_INTEGER:
+ switch (framebufferFormat)
+ {
+ case GL_RGBA_INTEGER:
+ case GL_RGB_INTEGER:
+ case GL_RG_INTEGER:
+ return true;
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/features.h b/gfx/angle/checkout/src/libANGLE/features.h
new file mode 100644
index 0000000000..dfec608422
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/features.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBANGLE_FEATURES_H_
+#define LIBANGLE_FEATURES_H_
+
+#include "common/platform.h"
+
+#define ANGLE_DISABLED 0
+#define ANGLE_ENABLED 1
+
+// Feature defaults
+
+// Direct3D9EX
+// The "Debug This Pixel..." feature in PIX often fails when using the
+// D3D9Ex interfaces. In order to get debug pixel to work on a Vista/Win 7
+// machine, define "ANGLE_D3D9EX=0" in your project file.
+#if !defined(ANGLE_D3D9EX)
+# define ANGLE_D3D9EX ANGLE_ENABLED
+#endif
+
+// Vsync
+// ENABLED allows Vsync to be configured at runtime
+// DISABLED disallows Vsync
+#if !defined(ANGLE_VSYNC)
+# define ANGLE_VSYNC ANGLE_ENABLED
+#endif
+
+// Program binary loading
+#if !defined(ANGLE_PROGRAM_BINARY_LOAD)
+# define ANGLE_PROGRAM_BINARY_LOAD ANGLE_ENABLED
+#endif
+
+// Append HLSL assembly to shader debug info. Defaults to enabled in Debug and off in Release.
+#if !defined(ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO)
+# if !defined(NDEBUG)
+# define ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO ANGLE_ENABLED
+# else
+# define ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO ANGLE_DISABLED
+# endif // !defined(NDEBUG)
+#endif // !defined(ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO)
+
+// Program link validation of precisions for uniforms. This feature was
+// requested by developers to allow non-conformant shaders to be used which
+// contain mismatched precisions.
+// ENABLED validate that precision for uniforms match between vertex and fragment shaders
+// DISABLED allow precision for uniforms to differ between vertex and fragment shaders
+#if !defined(ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION)
+# define ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION ANGLE_ENABLED
+#endif
+
+// Controls if our threading code uses std::async or falls back to single-threaded operations.
+#if !defined(ANGLE_STD_ASYNC_WORKERS)
+# define ANGLE_STD_ASYNC_WORKERS ANGLE_ENABLED
+#endif // !defined(ANGLE_STD_ASYNC_WORKERS)
+
+#endif // LIBANGLE_FEATURES_H_
diff --git a/gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp b/gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp
new file mode 100644
index 0000000000..f88a2c8c7c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp
@@ -0,0 +1,1610 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_format_map.py using data from format_map_data.json.
+// ES3 format info from es3_format_type_combinations.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// format_map:
+// Determining the sized internal format from a (format,type) pair.
+// Also check es3 format combinations for validity.
+
+#include "angle_gl.h"
+#include "common/debug.h"
+
+namespace gl
+{
+
+GLenum GetSizedFormatInternal(GLenum format, GLenum type)
+{
+ switch (format)
+ {
+ case GL_ALPHA:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return GL_ALPHA32F_EXT;
+ case GL_HALF_FLOAT:
+ return GL_ALPHA16F_EXT;
+ case GL_HALF_FLOAT_OES:
+ return GL_ALPHA16F_EXT;
+ case GL_UNSIGNED_BYTE:
+ return GL_ALPHA8_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_BGRA8_EXT;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ return GL_BGR5_A1_ANGLEX;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ return GL_BGRA4_ANGLEX;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return GL_BGR565_ANGLEX;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_RGBA_BPTC_UNORM_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_DEPTH_COMPONENT:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return GL_DEPTH_COMPONENT32F;
+ case GL_UNSIGNED_INT:
+ return GL_DEPTH_COMPONENT32_OES;
+ case GL_UNSIGNED_SHORT:
+ return GL_DEPTH_COMPONENT16;
+ default:
+ break;
+ }
+ break;
+
+ case GL_DEPTH_STENCIL:
+ switch (type)
+ {
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ return GL_DEPTH32F_STENCIL8;
+ case GL_UNSIGNED_INT_24_8:
+ return GL_DEPTH24_STENCIL8;
+ default:
+ break;
+ }
+ break;
+
+ case GL_LUMINANCE:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return GL_LUMINANCE32F_EXT;
+ case GL_HALF_FLOAT:
+ return GL_LUMINANCE16F_EXT;
+ case GL_HALF_FLOAT_OES:
+ return GL_LUMINANCE16F_EXT;
+ case GL_UNSIGNED_BYTE:
+ return GL_LUMINANCE8_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_LUMINANCE_ALPHA:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return GL_LUMINANCE_ALPHA32F_EXT;
+ case GL_HALF_FLOAT:
+ return GL_LUMINANCE_ALPHA16F_EXT;
+ case GL_HALF_FLOAT_OES:
+ return GL_LUMINANCE_ALPHA16F_EXT;
+ case GL_UNSIGNED_BYTE:
+ return GL_LUMINANCE8_ALPHA8_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RED:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_R8_SNORM;
+ case GL_FLOAT:
+ return GL_R32F;
+ case GL_HALF_FLOAT:
+ return GL_R16F;
+ case GL_HALF_FLOAT_OES:
+ return GL_R16F;
+ case GL_SHORT:
+ return GL_R16_SNORM_EXT;
+ case GL_UNSIGNED_BYTE:
+ return GL_R8;
+ case GL_UNSIGNED_SHORT:
+ return GL_R16_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RED_INTEGER:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_R8I;
+ case GL_INT:
+ return GL_R32I;
+ case GL_SHORT:
+ return GL_R16I;
+ case GL_UNSIGNED_BYTE:
+ return GL_R8UI;
+ case GL_UNSIGNED_INT:
+ return GL_R32UI;
+ case GL_UNSIGNED_SHORT:
+ return GL_R16UI;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RG:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_RG8_SNORM;
+ case GL_FLOAT:
+ return GL_RG32F;
+ case GL_HALF_FLOAT:
+ return GL_RG16F;
+ case GL_HALF_FLOAT_OES:
+ return GL_RG16F;
+ case GL_SHORT:
+ return GL_RG16_SNORM_EXT;
+ case GL_UNSIGNED_BYTE:
+ return GL_RG8;
+ case GL_UNSIGNED_SHORT:
+ return GL_RG16_EXT;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGB:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_RGB8_SNORM;
+ case GL_FLOAT:
+ return GL_RGB32F;
+ case GL_HALF_FLOAT:
+ return GL_RGB16F;
+ case GL_HALF_FLOAT_OES:
+ return GL_RGB16F;
+ case GL_SHORT:
+ return GL_RGB16_SNORM_EXT;
+ case GL_UNSIGNED_BYTE:
+ return GL_RGB8;
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ return GL_R11F_G11F_B10F;
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ return GL_RGB9_E5;
+ case GL_UNSIGNED_SHORT:
+ return GL_RGB16_EXT;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return GL_RGB565;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_RGBA8_SNORM;
+ case GL_FLOAT:
+ return GL_RGBA32F;
+ case GL_HALF_FLOAT:
+ return GL_RGBA16F;
+ case GL_HALF_FLOAT_OES:
+ return GL_RGBA16F;
+ case GL_SHORT:
+ return GL_RGBA16_SNORM_EXT;
+ case GL_UNSIGNED_BYTE:
+ return GL_RGBA8;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return GL_RGB10_A2;
+ case GL_UNSIGNED_SHORT:
+ return GL_RGBA16_EXT;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ return GL_RGBA4;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return GL_RGB5_A1;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGBA_INTEGER:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_RGBA8I;
+ case GL_INT:
+ return GL_RGBA32I;
+ case GL_SHORT:
+ return GL_RGBA16I;
+ case GL_UNSIGNED_BYTE:
+ return GL_RGBA8UI;
+ case GL_UNSIGNED_INT:
+ return GL_RGBA32UI;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return GL_RGB10_A2UI;
+ case GL_UNSIGNED_SHORT:
+ return GL_RGBA16UI;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGB_INTEGER:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_RGB8I;
+ case GL_INT:
+ return GL_RGB32I;
+ case GL_SHORT:
+ return GL_RGB16I;
+ case GL_UNSIGNED_BYTE:
+ return GL_RGB8UI;
+ case GL_UNSIGNED_INT:
+ return GL_RGB32UI;
+ case GL_UNSIGNED_SHORT:
+ return GL_RGB16UI;
+ default:
+ break;
+ }
+ break;
+
+ case GL_RG_INTEGER:
+ switch (type)
+ {
+ case GL_BYTE:
+ return GL_RG8I;
+ case GL_INT:
+ return GL_RG32I;
+ case GL_SHORT:
+ return GL_RG16I;
+ case GL_UNSIGNED_BYTE:
+ return GL_RG8UI;
+ case GL_UNSIGNED_INT:
+ return GL_RG32UI;
+ case GL_UNSIGNED_SHORT:
+ return GL_RG16UI;
+ default:
+ break;
+ }
+ break;
+
+ case GL_SRGB_ALPHA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_SRGB8_ALPHA8;
+ default:
+ break;
+ }
+ break;
+
+ case GL_SRGB_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_SRGB8;
+ default:
+ break;
+ }
+ break;
+
+ case GL_STENCIL:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return GL_STENCIL_INDEX8;
+ default:
+ break;
+ }
+ break;
+
+ case GL_NONE:
+ return GL_NONE;
+
+ default:
+ break;
+ }
+
+ return GL_NONE;
+}
+
+bool ValidES3Format(GLenum format)
+{
+ switch (format)
+ {
+ case GL_ALPHA:
+ case GL_BGRA_EXT:
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RED:
+ case GL_RED_INTEGER:
+ case GL_RG:
+ case GL_RGB:
+ case GL_RGBA:
+ case GL_RGBA_INTEGER:
+ case GL_RGB_INTEGER:
+ case GL_RG_INTEGER:
+ case GL_SRGB_ALPHA_EXT:
+ case GL_SRGB_EXT:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidES3Type(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ case GL_FLOAT:
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ case GL_HALF_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ case GL_INT:
+ case GL_SHORT:
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ case GL_UNSIGNED_INT_24_8:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat)
+{
+ ASSERT(ValidES3Format(format) && ValidES3Type(type));
+
+ switch (format)
+ {
+ case GL_RGB_INTEGER:
+ switch (type)
+ {
+ case GL_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB32I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB16UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB16I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB8UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB8I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB32UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGBA_INTEGER:
+ switch (type)
+ {
+ case GL_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA32I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA16UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB10_A2UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA16I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA8UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA8I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA32UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGB:
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ {
+ switch (internalFormat)
+ {
+ case GL_R11F_G11F_B10F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB16_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB16_SNORM_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB:
+ case GL_RGB8:
+ case GL_RGB565:
+ case GL_SRGB8:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT_5_6_5:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB:
+ case GL_RGB565:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT_OES:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB:
+ case GL_RGB16F:
+ case GL_R11F_G11F_B10F:
+ case GL_RGB9_E5:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB16F:
+ case GL_R11F_G11F_B10F:
+ case GL_RGB9_E5:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB:
+ case GL_RGB32F:
+ case GL_RGB16F:
+ case GL_R11F_G11F_B10F:
+ case GL_RGB9_E5:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB8_SNORM:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB9_E5:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_LUMINANCE_ALPHA:
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE_ALPHA16F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE_ALPHA32F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE8_ALPHA8_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT_OES:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE_ALPHA16F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_ALPHA:
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_ALPHA:
+ case GL_ALPHA16F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_ALPHA:
+ case GL_ALPHA32F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_ALPHA:
+ case GL_ALPHA8_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT_OES:
+ {
+ switch (internalFormat)
+ {
+ case GL_ALPHA:
+ case GL_ALPHA16F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA16_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGB10_A2:
+ case GL_RGB5_A1:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA16_SNORM_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA:
+ case GL_RGBA4:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA:
+ case GL_RGBA8:
+ case GL_RGB5_A1:
+ case GL_RGBA4:
+ case GL_SRGB8_ALPHA8:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT_OES:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA:
+ case GL_RGBA16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA:
+ case GL_RGBA32F:
+ case GL_RGBA16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA8_SNORM:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ {
+ switch (internalFormat)
+ {
+ case GL_RGBA:
+ case GL_RGB5_A1:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_LUMINANCE:
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE:
+ case GL_LUMINANCE16F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE:
+ case GL_LUMINANCE32F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE:
+ case GL_LUMINANCE8_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT_OES:
+ {
+ switch (internalFormat)
+ {
+ case GL_LUMINANCE:
+ case GL_LUMINANCE16F_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_RG_INTEGER:
+ switch (type)
+ {
+ case GL_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG32I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG16UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG16I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG8UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG8I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG32UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_RED_INTEGER:
+ switch (type)
+ {
+ case GL_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_R32I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_R16UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_R16I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_R8UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_R8I:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_R32UI:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_RED:
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_R16_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_R16_SNORM_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RED:
+ case GL_R32F:
+ case GL_R16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT_OES:
+ {
+ switch (internalFormat)
+ {
+ case GL_RED:
+ case GL_R16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RED:
+ case GL_R16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RED:
+ case GL_R8:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_R8_SNORM:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_DEPTH_COMPONENT:
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ {
+ switch (internalFormat)
+ {
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH_COMPONENT16:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_INT_24_8:
+ {
+ switch (internalFormat)
+ {
+ case GL_DEPTH_COMPONENT32_OES:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_DEPTH_COMPONENT32F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT16:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_DEPTH_STENCIL:
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_24_8:
+ {
+ switch (internalFormat)
+ {
+ case GL_DEPTH_STENCIL:
+ case GL_DEPTH24_STENCIL8:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ {
+ switch (internalFormat)
+ {
+ case GL_DEPTH32F_STENCIL8:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_SRGB_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_SRGB_EXT:
+ case GL_SRGB8:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_SRGB_ALPHA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_SRGB_ALPHA_EXT:
+ case GL_SRGB8_ALPHA8_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_RG:
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG16_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SHORT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG16_SNORM_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG:
+ case GL_RG32F:
+ case GL_RG16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT_OES:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG:
+ case GL_RG16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_HALF_FLOAT:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG:
+ case GL_RG16F:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG:
+ case GL_RG8:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_RG8_SNORM:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ case GL_BGRA_EXT:
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ {
+ switch (internalFormat)
+ {
+ case GL_BGRA4_ANGLEX:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_BYTE:
+ {
+ switch (internalFormat)
+ {
+ case GL_BGRA8_EXT:
+ case GL_BGRA4_ANGLEX:
+ case GL_BGR5_A1_ANGLEX:
+ case GL_BGRA_EXT:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ {
+ switch (internalFormat)
+ {
+ case GL_BGR5_A1_ANGLEX:
+ return true;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return false;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/formatutils.cpp b/gfx/angle/checkout/src/libANGLE/formatutils.cpp
new file mode 100644
index 0000000000..6533eb81d1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/formatutils.cpp
@@ -0,0 +1,2294 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils.cpp: Queries for GL image formats.
+
+#include "libANGLE/formatutils.h"
+
+#include "common/mathutil.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+
+using namespace angle;
+
+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.
+GLenum GetSizedFormatInternal(GLenum format, GLenum type);
+
+namespace
+{
+using InternalFormatInfoMap =
+ std::unordered_map<GLenum, std::unordered_map<GLenum, InternalFormat>>;
+
+bool CheckedMathResult(const CheckedNumeric<GLuint> &value, GLuint *resultOut)
+{
+ if (!value.IsValid())
+ {
+ return false;
+ }
+ else
+ {
+ *resultOut = value.ValueOrDie();
+ return true;
+ }
+}
+
+constexpr uint32_t PackTypeInfo(GLuint bytes, bool specialized)
+{
+ // static_assert within constexpr requires c++17
+ // static_assert(isPow2(bytes));
+ return bytes | (rx::Log2(bytes) << 8) | (specialized << 16);
+}
+
+} // anonymous namespace
+
+FormatType::FormatType() : format(GL_NONE), type(GL_NONE) {}
+
+FormatType::FormatType(GLenum format_, GLenum type_) : format(format_), type(type_) {}
+
+bool FormatType::operator<(const FormatType &other) const
+{
+ if (format != other.format)
+ return format < other.format;
+ return type < other.type;
+}
+
+bool operator<(const Type &a, const Type &b)
+{
+ return memcmp(&a, &b, sizeof(Type)) < 0;
+}
+
+// Information about internal formats
+static bool AlwaysSupported(const Version &, const Extensions &)
+{
+ return true;
+}
+
+static bool NeverSupported(const Version &, const Extensions &)
+{
+ return false;
+}
+
+template <GLuint minCoreGLMajorVersion, GLuint minCoreGLMinorVersion>
+static bool RequireES(const Version &clientVersion, const Extensions &)
+{
+ return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion);
+}
+
+// Pointer to a boolean memeber of the Extensions struct
+typedef bool(Extensions::*ExtensionBool);
+
+// Check support for a single extension
+template <ExtensionBool bool1>
+static bool RequireExt(const Version &, const Extensions &extensions)
+{
+ return extensions.*bool1;
+}
+
+// Check for a minimum client version or a single extension
+template <GLuint minCoreGLMajorVersion, GLuint minCoreGLMinorVersion, ExtensionBool bool1>
+static bool RequireESOrExt(const Version &clientVersion, const Extensions &extensions)
+{
+ return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion) ||
+ extensions.*bool1;
+}
+
+// Check for a minimum client version or two extensions
+template <GLuint minCoreGLMajorVersion,
+ GLuint minCoreGLMinorVersion,
+ ExtensionBool bool1,
+ ExtensionBool bool2>
+static bool RequireESOrExtAndExt(const Version &clientVersion, const Extensions &extensions)
+{
+ return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion) ||
+ (extensions.*bool1 && extensions.*bool2);
+}
+
+// Check for a minimum client version or at least one of two extensions
+template <GLuint minCoreGLMajorVersion,
+ GLuint minCoreGLMinorVersion,
+ ExtensionBool bool1,
+ ExtensionBool bool2>
+static bool RequireESOrExtOrExt(const Version &clientVersion, const Extensions &extensions)
+{
+ return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion) ||
+ extensions.*bool1 || extensions.*bool2;
+}
+
+// Check support for two extensions
+template <ExtensionBool bool1, ExtensionBool bool2>
+static bool RequireExtAndExt(const Version &, const Extensions &extensions)
+{
+ return extensions.*bool1 && extensions.*bool2;
+}
+
+// Check support for either of two extensions
+template <ExtensionBool bool1, ExtensionBool bool2>
+static bool RequireExtOrExt(const Version &, const Extensions &extensions)
+{
+ return extensions.*bool1 || extensions.*bool2;
+}
+
+// Check support for any of three extensions
+template <ExtensionBool bool1, ExtensionBool bool2, ExtensionBool bool3>
+static bool RequireExtOrExtOrExt(const Version &, const Extensions &extensions)
+{
+ return extensions.*bool1 || extensions.*bool2 || extensions.*bool3;
+}
+
+// R8, RG8
+static bool SizedRGSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ return clientVersion >= Version(3, 0) || (extensions.textureStorage && extensions.textureRG);
+}
+
+// R16F, RG16F with HALF_FLOAT_OES type
+static bool SizedHalfFloatOESRGSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ return extensions.textureStorage && extensions.textureHalfFloat && extensions.textureRG;
+}
+
+static bool SizedHalfFloatOESRGTextureAttachmentSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ return SizedHalfFloatOESRGSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat;
+}
+
+// R16F, RG16F with either HALF_FLOAT_OES or HALF_FLOAT types
+static bool SizedHalfFloatRGSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ // HALF_FLOAT
+ if (clientVersion >= Version(3, 0))
+ {
+ return true;
+ }
+ // HALF_FLOAT_OES
+ else
+ {
+ return SizedHalfFloatOESRGSupport(clientVersion, extensions);
+ }
+}
+
+static bool SizedHalfFloatRGTextureAttachmentSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ // HALF_FLOAT
+ if (clientVersion >= Version(3, 0))
+ {
+ return extensions.colorBufferFloat;
+ }
+ // HALF_FLOAT_OES
+ else
+ {
+ return SizedHalfFloatOESRGTextureAttachmentSupport(clientVersion, extensions);
+ }
+}
+
+static bool SizedHalfFloatRGRenderbufferSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ return (clientVersion >= Version(3, 0) ||
+ (extensions.textureHalfFloat && extensions.textureRG)) &&
+ (extensions.colorBufferFloat || extensions.colorBufferHalfFloat);
+}
+
+// RGB16F, RGBA16F with HALF_FLOAT_OES type
+static bool SizedHalfFloatOESSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ return extensions.textureStorage && extensions.textureHalfFloat;
+}
+
+static bool SizedHalfFloatOESTextureAttachmentSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ return SizedHalfFloatOESSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat;
+}
+
+// RGB16F, RGBA16F with either HALF_FLOAT_OES or HALF_FLOAT types
+static bool SizedHalfFloatSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ // HALF_FLOAT
+ if (clientVersion >= Version(3, 0))
+ {
+ return true;
+ }
+ // HALF_FLOAT_OES
+ else
+ {
+ return SizedHalfFloatOESSupport(clientVersion, extensions);
+ }
+}
+
+static bool SizedHalfFloatFilterSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ // HALF_FLOAT
+ if (clientVersion >= Version(3, 0))
+ {
+ return true;
+ }
+ // HALF_FLOAT_OES
+ else
+ {
+ return extensions.textureHalfFloatLinear;
+ }
+}
+
+static bool SizedHalfFloatRGBTextureAttachmentSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ // HALF_FLOAT
+ if (clientVersion >= Version(3, 0))
+ {
+ // It is unclear how EXT_color_buffer_half_float applies to ES3.0 and above, however,
+ // dEQP GLES3 es3fFboColorbufferTests.cpp verifies that texture attachment of GL_RGB16F
+ // is possible, so assume that all GLES implementations support it.
+ return extensions.colorBufferHalfFloat;
+ }
+ // HALF_FLOAT_OES
+ else
+ {
+ return SizedHalfFloatOESTextureAttachmentSupport(clientVersion, extensions);
+ }
+}
+
+static bool SizedHalfFloatRGBRenderbufferSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ return (clientVersion >= Version(3, 0) || extensions.textureHalfFloat) &&
+ extensions.colorBufferHalfFloat;
+}
+
+static bool SizedHalfFloatRGBATextureAttachmentSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ // HALF_FLOAT
+ if (clientVersion >= Version(3, 0))
+ {
+ return extensions.colorBufferFloat;
+ }
+ // HALF_FLOAT_OES
+ else
+ {
+ return SizedHalfFloatOESTextureAttachmentSupport(clientVersion, extensions);
+ }
+}
+
+static bool SizedHalfFloatRGBARenderbufferSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ return (clientVersion >= Version(3, 0) || extensions.textureHalfFloat) &&
+ (extensions.colorBufferFloat || extensions.colorBufferHalfFloat);
+}
+
+// R32F, RG32F
+static bool SizedFloatRGSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ return clientVersion >= Version(3, 0) ||
+ (extensions.textureStorage && extensions.textureFloat && extensions.textureRG);
+}
+
+// RGB32F
+static bool SizedFloatRGBSupport(const Version &clientVersion, const Extensions &extensions)
+{
+ return clientVersion >= Version(3, 0) ||
+ (extensions.textureStorage && extensions.textureFloat) || extensions.colorBufferFloatRGB;
+}
+
+// RGBA32F
+static bool SizedFloatRGBASupport(const Version &clientVersion, const Extensions &extensions)
+{
+ return clientVersion >= Version(3, 0) ||
+ (extensions.textureStorage && extensions.textureFloat) ||
+ extensions.colorBufferFloatRGBA;
+}
+
+static bool SizedFloatRGBARenderableSupport(const Version &clientVersion,
+ const Extensions &extensions)
+{
+ // This logic is the same for both Renderbuffers and TextureAttachment.
+ return extensions.colorBufferFloatRGBA || // ES2
+ extensions.colorBufferFloat; // ES3
+}
+
+InternalFormat::InternalFormat()
+ : internalFormat(GL_NONE),
+ sized(false),
+ sizedInternalFormat(GL_NONE),
+ redBits(0),
+ greenBits(0),
+ blueBits(0),
+ luminanceBits(0),
+ alphaBits(0),
+ sharedBits(0),
+ depthBits(0),
+ stencilBits(0),
+ pixelBytes(0),
+ componentCount(0),
+ compressed(false),
+ compressedBlockWidth(0),
+ compressedBlockHeight(0),
+ compressedBlockDepth(0),
+ format(GL_NONE),
+ type(GL_NONE),
+ componentType(GL_NONE),
+ colorEncoding(GL_NONE),
+ textureSupport(NeverSupported),
+ filterSupport(NeverSupported),
+ textureAttachmentSupport(NeverSupported),
+ renderbufferSupport(NeverSupported)
+{}
+
+InternalFormat::InternalFormat(const InternalFormat &other) = default;
+
+bool InternalFormat::isLUMA() const
+{
+ return ((redBits + greenBits + blueBits + depthBits + stencilBits) == 0 &&
+ (luminanceBits + alphaBits) > 0);
+}
+
+GLenum InternalFormat::getReadPixelsFormat() const
+{
+ return format;
+}
+
+GLenum InternalFormat::getReadPixelsType(const Version &version) const
+{
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ if (version < Version(3, 0))
+ {
+ // The internal format may have a type of GL_HALF_FLOAT but when exposing this type
+ // as the IMPLEMENTATION_READ_TYPE, only HALF_FLOAT_OES is allowed by
+ // OES_texture_half_float. HALF_FLOAT becomes core in ES3 and is acceptable to use
+ // as an IMPLEMENTATION_READ_TYPE.
+ return GL_HALF_FLOAT_OES;
+ }
+ else
+ {
+ return GL_HALF_FLOAT;
+ }
+
+ default:
+ return type;
+ }
+}
+
+bool InternalFormat::isRequiredRenderbufferFormat(const Version &version) const
+{
+ // GLES 3.0.5 section 4.4.2.2:
+ // "Implementations are required to support the same internal formats for renderbuffers as the
+ // required formats for textures enumerated in section 3.8.3.1, with the exception of the color
+ // formats labelled "texture-only"."
+ if (!sized || compressed)
+ {
+ return false;
+ }
+
+ // Luma formats.
+ if (isLUMA())
+ {
+ return false;
+ }
+
+ // Depth/stencil formats.
+ if (depthBits > 0 || stencilBits > 0)
+ {
+ // GLES 2.0.25 table 4.5.
+ // GLES 3.0.5 section 3.8.3.1.
+ // GLES 3.1 table 8.14.
+
+ // Required formats in all versions.
+ switch (internalFormat)
+ {
+ case GL_DEPTH_COMPONENT16:
+ case GL_STENCIL_INDEX8:
+ // Note that STENCIL_INDEX8 is not mentioned in GLES 3.0.5 section 3.8.3.1, but it
+ // is in section 4.4.2.2.
+ return true;
+ default:
+ break;
+ }
+ if (version.major < 3)
+ {
+ return false;
+ }
+ // Required formats in GLES 3.0 and up.
+ switch (internalFormat)
+ {
+ case GL_DEPTH_COMPONENT32F:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH32F_STENCIL8:
+ case GL_DEPTH24_STENCIL8:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ // RGBA formats.
+ // GLES 2.0.25 table 4.5.
+ // GLES 3.0.5 section 3.8.3.1.
+ // GLES 3.1 table 8.13.
+
+ // Required formats in all versions.
+ switch (internalFormat)
+ {
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGB565:
+ return true;
+ default:
+ break;
+ }
+ if (version.major < 3)
+ {
+ return false;
+ }
+
+ if (format == GL_BGRA_EXT)
+ {
+ return false;
+ }
+
+ switch (componentType)
+ {
+ case GL_SIGNED_NORMALIZED:
+ case GL_FLOAT:
+ return false;
+ case GL_UNSIGNED_INT:
+ case GL_INT:
+ // Integer RGB formats are not required renderbuffer formats.
+ if (alphaBits == 0 && blueBits != 0)
+ {
+ return false;
+ }
+ // All integer R and RG formats are required.
+ // Integer RGBA formats including RGB10_A2_UI are required.
+ return true;
+ case GL_UNSIGNED_NORMALIZED:
+ if (internalFormat == GL_SRGB8)
+ {
+ return false;
+ }
+ return true;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return false;
+#endif
+ }
+}
+
+bool InternalFormat::isInt() const
+{
+ return componentType == GL_INT || componentType == GL_UNSIGNED_INT;
+}
+
+Format::Format(GLenum internalFormat) : Format(GetSizedInternalFormatInfo(internalFormat)) {}
+
+Format::Format(const InternalFormat &internalFormat) : info(&internalFormat) {}
+
+Format::Format(GLenum internalFormat, GLenum type)
+ : info(&GetInternalFormatInfo(internalFormat, type))
+{}
+
+Format::Format(const Format &other) = default;
+Format &Format::operator=(const Format &other) = default;
+
+bool Format::valid() const
+{
+ return info->internalFormat != GL_NONE;
+}
+
+// static
+bool Format::SameSized(const Format &a, const Format &b)
+{
+ return a.info->sizedInternalFormat == b.info->sizedInternalFormat;
+}
+
+static GLenum EquivalentBlitInternalFormat(GLenum internalformat)
+{
+ // BlitFramebuffer works if the color channels are identically
+ // sized, even if there is a swizzle (for example, blitting from a
+ // multisampled RGBA8 renderbuffer to a BGRA8 texture). This could
+ // be expanded and/or autogenerated if that is found necessary.
+ if (internalformat == GL_BGRA8_EXT)
+ return GL_RGBA8;
+ return internalformat;
+}
+
+// static
+bool Format::EquivalentForBlit(const Format &a, const Format &b)
+{
+ return (EquivalentBlitInternalFormat(a.info->sizedInternalFormat) ==
+ EquivalentBlitInternalFormat(b.info->sizedInternalFormat));
+}
+
+// static
+Format Format::Invalid()
+{
+ static Format invalid(GL_NONE, GL_NONE);
+ return invalid;
+}
+
+std::ostream &operator<<(std::ostream &os, const Format &fmt)
+{
+ // TODO(ynovikov): return string representation when available
+ return FmtHex(os, fmt.info->sizedInternalFormat);
+}
+
+bool InternalFormat::operator==(const InternalFormat &other) const
+{
+ // We assume all internal formats are unique if they have the same internal format and type
+ return internalFormat == other.internalFormat && type == other.type;
+}
+
+bool InternalFormat::operator!=(const InternalFormat &other) const
+{
+ return !(*this == other);
+}
+
+void InsertFormatInfo(InternalFormatInfoMap *map, const InternalFormat &formatInfo)
+{
+ ASSERT(!formatInfo.sized || (*map).count(formatInfo.internalFormat) == 0);
+ ASSERT((*map)[formatInfo.internalFormat].count(formatInfo.type) == 0);
+ (*map)[formatInfo.internalFormat][formatInfo.type] = formatInfo;
+}
+
+void AddRGBAFormat(InternalFormatInfoMap *map,
+ GLenum internalFormat,
+ bool sized,
+ GLuint red,
+ GLuint green,
+ GLuint blue,
+ GLuint alpha,
+ GLuint shared,
+ GLenum format,
+ GLenum type,
+ GLenum componentType,
+ bool srgb,
+ InternalFormat::SupportCheckFunction textureSupport,
+ InternalFormat::SupportCheckFunction filterSupport,
+ InternalFormat::SupportCheckFunction textureAttachmentSupport,
+ InternalFormat::SupportCheckFunction renderbufferSupport)
+{
+ InternalFormat formatInfo;
+ formatInfo.internalFormat = internalFormat;
+ formatInfo.sized = sized;
+ formatInfo.sizedInternalFormat =
+ sized ? internalFormat : GetSizedFormatInternal(internalFormat, type);
+ formatInfo.redBits = red;
+ formatInfo.greenBits = green;
+ formatInfo.blueBits = blue;
+ formatInfo.alphaBits = alpha;
+ formatInfo.sharedBits = shared;
+ formatInfo.pixelBytes = (red + green + blue + alpha + shared) / 8;
+ formatInfo.componentCount =
+ ((red > 0) ? 1 : 0) + ((green > 0) ? 1 : 0) + ((blue > 0) ? 1 : 0) + ((alpha > 0) ? 1 : 0);
+ formatInfo.format = format;
+ formatInfo.type = type;
+ formatInfo.componentType = componentType;
+ formatInfo.colorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
+ formatInfo.textureSupport = textureSupport;
+ formatInfo.filterSupport = filterSupport;
+ formatInfo.textureAttachmentSupport = textureAttachmentSupport;
+ formatInfo.renderbufferSupport = renderbufferSupport;
+
+ InsertFormatInfo(map, formatInfo);
+}
+
+static void AddLUMAFormat(InternalFormatInfoMap *map,
+ GLenum internalFormat,
+ bool sized,
+ GLuint luminance,
+ GLuint alpha,
+ GLenum format,
+ GLenum type,
+ GLenum componentType,
+ InternalFormat::SupportCheckFunction textureSupport,
+ InternalFormat::SupportCheckFunction filterSupport,
+ InternalFormat::SupportCheckFunction textureAttachmentSupport,
+ InternalFormat::SupportCheckFunction renderbufferSupport)
+{
+ InternalFormat formatInfo;
+ formatInfo.internalFormat = internalFormat;
+ formatInfo.sized = sized;
+ formatInfo.sizedInternalFormat =
+ sized ? internalFormat : GetSizedFormatInternal(internalFormat, type);
+ formatInfo.luminanceBits = luminance;
+ formatInfo.alphaBits = alpha;
+ formatInfo.pixelBytes = (luminance + alpha) / 8;
+ formatInfo.componentCount = ((luminance > 0) ? 1 : 0) + ((alpha > 0) ? 1 : 0);
+ formatInfo.format = format;
+ formatInfo.type = type;
+ formatInfo.componentType = componentType;
+ formatInfo.colorEncoding = GL_LINEAR;
+ formatInfo.textureSupport = textureSupport;
+ formatInfo.filterSupport = filterSupport;
+ formatInfo.textureAttachmentSupport = textureAttachmentSupport;
+ formatInfo.renderbufferSupport = renderbufferSupport;
+
+ InsertFormatInfo(map, formatInfo);
+}
+
+void AddDepthStencilFormat(InternalFormatInfoMap *map,
+ GLenum internalFormat,
+ bool sized,
+ GLuint depthBits,
+ GLuint stencilBits,
+ GLuint unusedBits,
+ GLenum format,
+ GLenum type,
+ GLenum componentType,
+ InternalFormat::SupportCheckFunction textureSupport,
+ InternalFormat::SupportCheckFunction filterSupport,
+ InternalFormat::SupportCheckFunction textureAttachmentSupport,
+ InternalFormat::SupportCheckFunction renderbufferSupport)
+{
+ InternalFormat formatInfo;
+ formatInfo.internalFormat = internalFormat;
+ formatInfo.sized = sized;
+ formatInfo.sizedInternalFormat =
+ sized ? internalFormat : GetSizedFormatInternal(internalFormat, type);
+ formatInfo.depthBits = depthBits;
+ formatInfo.stencilBits = stencilBits;
+ formatInfo.pixelBytes = (depthBits + stencilBits + unusedBits) / 8;
+ formatInfo.componentCount = ((depthBits > 0) ? 1 : 0) + ((stencilBits > 0) ? 1 : 0);
+ formatInfo.format = format;
+ formatInfo.type = type;
+ formatInfo.componentType = componentType;
+ formatInfo.colorEncoding = GL_LINEAR;
+ formatInfo.textureSupport = textureSupport;
+ formatInfo.filterSupport = filterSupport;
+ formatInfo.textureAttachmentSupport = textureAttachmentSupport;
+ formatInfo.renderbufferSupport = renderbufferSupport;
+
+ InsertFormatInfo(map, formatInfo);
+}
+
+void AddCompressedFormat(InternalFormatInfoMap *map,
+ GLenum internalFormat,
+ GLuint compressedBlockWidth,
+ GLuint compressedBlockHeight,
+ GLuint compressedBlockDepth,
+ GLuint compressedBlockSize,
+ GLuint componentCount,
+ bool srgb,
+ InternalFormat::SupportCheckFunction textureSupport,
+ InternalFormat::SupportCheckFunction filterSupport,
+ InternalFormat::SupportCheckFunction textureAttachmentSupport,
+ InternalFormat::SupportCheckFunction renderbufferSupport)
+{
+ InternalFormat formatInfo;
+ formatInfo.internalFormat = internalFormat;
+ formatInfo.sized = true;
+ formatInfo.sizedInternalFormat = internalFormat;
+ formatInfo.compressedBlockWidth = compressedBlockWidth;
+ formatInfo.compressedBlockHeight = compressedBlockHeight;
+ formatInfo.compressedBlockDepth = compressedBlockDepth;
+ formatInfo.pixelBytes = compressedBlockSize / 8;
+ formatInfo.componentCount = componentCount;
+ formatInfo.format = internalFormat;
+ formatInfo.type = GL_UNSIGNED_BYTE;
+ formatInfo.componentType = GL_UNSIGNED_NORMALIZED;
+ formatInfo.colorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
+ formatInfo.compressed = true;
+ formatInfo.textureSupport = textureSupport;
+ formatInfo.filterSupport = filterSupport;
+ formatInfo.textureAttachmentSupport = textureAttachmentSupport;
+ formatInfo.renderbufferSupport = renderbufferSupport;
+
+ InsertFormatInfo(map, formatInfo);
+}
+
+// Notes:
+// 1. "Texture supported" includes all the means by which texture can be created, however,
+// GL_EXT_texture_storage in ES2 is a special case, when only glTexStorage* is allowed.
+// The assumption is that ES2 validation will not check textureSupport for sized formats.
+//
+// 2. Sized half float types are a combination of GL_HALF_FLOAT and GL_HALF_FLOAT_OES support,
+// due to a limitation that only one type for sized formats is allowed.
+//
+// TODO(ynovikov): http://anglebug.com/2846 Verify support fields of BGRA, depth, stencil
+// and compressed formats. Perform texturable check as part of filterable and attachment checks.
+static InternalFormatInfoMap BuildInternalFormatInfoMap()
+{
+ InternalFormatInfoMap map;
+
+ // From ES 3.0.1 spec, table 3.12
+ map[GL_NONE][GL_NONE] = InternalFormat();
+
+ // clang-format off
+
+ // | Internal format |sized| R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddRGBAFormat(&map, GL_R8, true, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, SizedRGSupport, AlwaysSupported, SizedRGSupport, RequireESOrExt<3, 0, &Extensions::textureRG> );
+ AddRGBAFormat(&map, GL_R8_SNORM, true, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RG8, true, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, SizedRGSupport, AlwaysSupported, SizedRGSupport, RequireESOrExt<3, 0, &Extensions::textureRG> );
+ AddRGBAFormat(&map, GL_RG8_SNORM, true, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB8, true, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureStorage>, AlwaysSupported, RequireESOrExt<3, 0, &Extensions::textureStorage>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8> );
+ AddRGBAFormat(&map, GL_RGB8_SNORM, true, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB565, true, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureStorage>, AlwaysSupported, RequireESOrExt<3, 0, &Extensions::textureStorage>, RequireES<2, 0> );
+ AddRGBAFormat(&map, GL_RGBA4, true, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureStorage>, AlwaysSupported, RequireESOrExt<3, 0, &Extensions::textureStorage>, RequireES<2, 0> );
+ AddRGBAFormat(&map, GL_RGB5_A1, true, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureStorage>, AlwaysSupported, RequireESOrExt<3, 0, &Extensions::textureStorage>, RequireES<2, 0> );
+ AddRGBAFormat(&map, GL_RGBA8, true, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureStorage>, AlwaysSupported, RequireESOrExt<3, 0, &Extensions::textureStorage>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8> );
+ AddRGBAFormat(&map, GL_RGBA8_SNORM, true, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB10_A2, true, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, RequireES<3, 0>, AlwaysSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RGB10_A2UI, true, 10, 10, 10, 2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_SRGB8, true, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireES<3, 0>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_SRGB8_ALPHA8, true, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireES<3, 0>, AlwaysSupported, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::sRGB> );
+ AddRGBAFormat(&map, GL_R11F_G11F_B10F, true, 11, 11, 10, 0, 0, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FLOAT, false, RequireES<3, 0>, AlwaysSupported, RequireExt<&Extensions::colorBufferFloat>, RequireExt<&Extensions::colorBufferFloat> );
+ AddRGBAFormat(&map, GL_RGB9_E5, true, 9, 9, 9, 0, 5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT, false, RequireES<3, 0>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_R8I, true, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_R8UI, true, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_R16I, true, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_R16UI, true, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_R32I, true, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_R32UI, true, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RG8I, true, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RG8UI, true, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RG16I, true, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RG16UI, true, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RG32I, true, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RG32UI, true, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RGB8I, true, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB8UI, true, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB16I, true, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB16UI, true, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB32I, true, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB32UI, true, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGBA8I, true, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RGBA8UI, true, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RGBA16I, true, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RGBA16UI, true, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RGBA32I, true, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+ AddRGBAFormat(&map, GL_RGBA32UI, true, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, RequireES<3, 0>, RequireES<3, 0> );
+
+ AddRGBAFormat(&map, GL_BGRA8_EXT, true, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>);
+ AddRGBAFormat(&map, GL_BGRA4_ANGLEX, true, 4, 4, 4, 4, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>);
+ AddRGBAFormat(&map, GL_BGR5_A1_ANGLEX, true, 5, 5, 5, 1, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>);
+
+ // Special format that is used for D3D textures that are used within ANGLE via the
+ // EGL_ANGLE_d3d_texture_client_buffer extension. We don't allow uploading texture images with
+ // this format, but textures in this format can be created from D3D textures, and filtering them
+ // and rendering to them is allowed.
+ AddRGBAFormat(&map, GL_BGRA8_SRGB_ANGLEX, true, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, NeverSupported, AlwaysSupported, AlwaysSupported, AlwaysSupported );
+
+ // Special format which is not really supported, so always false for all supports.
+ AddRGBAFormat(&map, GL_BGRX8_ANGLEX, true, 8, 8, 8, 0, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_BGR565_ANGLEX, true, 5, 6, 5, 1, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported );
+
+ // Floating point formats
+ // | Internal format |sized| R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ // It's not possible to have two entries per sized format.
+ // E.g. for GL_RG16F, one with GL_HALF_FLOAT type and the other with GL_HALF_FLOAT_OES type.
+ // So, GL_HALF_FLOAT type formats conditions are merged with GL_HALF_FLOAT_OES type conditions.
+ AddRGBAFormat(&map, GL_R16F, true, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, SizedHalfFloatRGSupport, SizedHalfFloatFilterSupport, SizedHalfFloatRGTextureAttachmentSupport, SizedHalfFloatRGRenderbufferSupport );
+ AddRGBAFormat(&map, GL_RG16F, true, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, SizedHalfFloatRGSupport, SizedHalfFloatFilterSupport, SizedHalfFloatRGTextureAttachmentSupport, SizedHalfFloatRGRenderbufferSupport );
+ AddRGBAFormat(&map, GL_RGB16F, true, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, SizedHalfFloatSupport, SizedHalfFloatFilterSupport, SizedHalfFloatRGBTextureAttachmentSupport, SizedHalfFloatRGBRenderbufferSupport );
+ AddRGBAFormat(&map, GL_RGBA16F, true, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, SizedHalfFloatSupport, SizedHalfFloatFilterSupport, SizedHalfFloatRGBATextureAttachmentSupport, SizedHalfFloatRGBARenderbufferSupport );
+ AddRGBAFormat(&map, GL_R32F, true, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, SizedFloatRGSupport, RequireExt<&Extensions::textureFloatLinear>, RequireExt<&Extensions::colorBufferFloat>, RequireExt<&Extensions::colorBufferFloat>);
+ AddRGBAFormat(&map, GL_RG32F, true, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, SizedFloatRGSupport, RequireExt<&Extensions::textureFloatLinear>, RequireExt<&Extensions::colorBufferFloat>, RequireExt<&Extensions::colorBufferFloat>);
+ AddRGBAFormat(&map, GL_RGB32F, true, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, SizedFloatRGBSupport, RequireExt<&Extensions::textureFloatLinear>, RequireExt<&Extensions::colorBufferFloatRGB>, NeverSupported );
+ AddRGBAFormat(&map, GL_RGBA32F, true, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, SizedFloatRGBASupport, RequireExt<&Extensions::textureFloatLinear>, SizedFloatRGBARenderableSupport, SizedFloatRGBARenderableSupport );
+
+ // ANGLE Depth stencil formats
+ // | Internal format |sized| D |S | X | Format | Type | Component type | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT16, true, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, RequireESOrExtOrExt<3, 0, &Extensions::depthTextureANGLE, &Extensions::depthTextureOES>, RequireES<1, 0>, RequireES<1, 0> );
+ AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT24, true, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextureANGLE>, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depth24OES> );
+ AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32F, true, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextureANGLE>, RequireES<3, 0>, RequireES<3, 0> );
+ AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32_OES, true, 32, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireExtOrExtOrExt<&Extensions::depthTextureANGLE, &Extensions::depthTextureOES, &Extensions::depth32>, AlwaysSupported, RequireExtOrExtOrExt<&Extensions::depthTextureANGLE, &Extensions::depthTextureOES, &Extensions::depth32>, RequireExtOrExtOrExt<&Extensions::depthTextureANGLE, &Extensions::depthTextureOES, &Extensions::depth32>);
+ AddDepthStencilFormat(&map, GL_DEPTH24_STENCIL8, true, 24, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_NORMALIZED, RequireESOrExt<3, 0, &Extensions::depthTextureANGLE>, AlwaysSupported, RequireESOrExtOrExt<3, 0, &Extensions::depthTextureANGLE, &Extensions::packedDepthStencil>, RequireESOrExtOrExt<3, 0, &Extensions::depthTextureANGLE, &Extensions::packedDepthStencil>);
+ AddDepthStencilFormat(&map, GL_DEPTH32F_STENCIL8, true, 32, 8, 24, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT, RequireES<3, 0>, AlwaysSupported, RequireES<3, 0>, RequireES<3, 0> );
+ // STENCIL_INDEX8 is special-cased, see around the bottom of the list.
+
+ // Luminance alpha formats
+ // | Internal format |sized| L | A | Format | Type | Component type | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddLUMAFormat(&map, GL_ALPHA8_EXT, true, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE8_EXT, true, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE8_ALPHA8_EXT, true, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_ALPHA16F_EXT, true, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE16F_EXT, true, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE_ALPHA16F_EXT, true, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_ALPHA32F_EXT, true, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE32F_EXT, true, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE_ALPHA32F_EXT, true, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+
+ // Compressed formats, From ES 3.0.1 spec, table 3.16
+ // | Internal format |W |H |D | BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddCompressedFormat(&map, GL_COMPRESSED_R11_EAC, 4, 4, 1, 64, 1, false, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedEACR11UnsignedTexture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_R11_EAC, 4, 4, 1, 64, 1, false, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedEACR11SignedTexture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RG11_EAC, 4, 4, 1, 128, 2, false, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedEACRG11UnsignedTexture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SIGNED_RG11_EAC, 4, 4, 1, 128, 2, false, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedEACRG11SignedTexture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGB8_ETC2, 4, 4, 1, 64, 3, false, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedETC2RGB8Texture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ETC2, 4, 4, 1, 64, 3, true, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedETC2sRGB8Texture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 1, 64, 3, false, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedETC2PunchthroughARGB8Texture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 4, 4, 1, 64, 3, true, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedETC2PunchthroughAsRGB8AlphaTexture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, 4, 4, 1, 128, 4, false, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedETC2RGBA8Texture>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 4, 4, 1, 128, 4, true, RequireESOrExtOrExt<3, 0, &Extensions::compressedTextureETC, &Extensions::compressedETC2sRGB8Alpha8Texture>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From GL_EXT_texture_compression_dxt1
+ // | Internal format |W |H |D | BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddCompressedFormat(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 1, 64, 3, false, RequireExt<&Extensions::textureCompressionDXT1>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 4, 4, 1, 64, 4, false, RequireExt<&Extensions::textureCompressionDXT1>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From GL_ANGLE_texture_compression_dxt3
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionDXT3>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From GL_ANGLE_texture_compression_dxt5
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionDXT5>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From GL_OES_compressed_ETC1_RGB8_texture
+ AddCompressedFormat(&map, GL_ETC1_RGB8_OES, 4, 4, 1, 64, 3, false, RequireExt<&Extensions::compressedETC1RGB8Texture>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From GL_EXT_texture_compression_s3tc_srgb
+ // | Internal format |W |H |D | BS |CC|SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, 4, 4, 1, 64, 3, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 4, 4, 1, 64, 4, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 4, 4, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 4, 4, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionS3TCsRGB>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From GL_KHR_texture_compression_astc_ldr and KHR_texture_compression_astc_hdr and GL_OES_texture_compression_astc
+ // | Internal format | W | H |D | BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, 5, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, 5, 5, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, 6, 5, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, 6, 6, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, 8, 5, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, 8, 6, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, 8, 8, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, 10, 5, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, 10, 6, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, 10, 8, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, 10, 10, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, 12, 10, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, 12, 12, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, 4, 4, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, 5, 4, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, 5, 5, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, 6, 5, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, 6, 6, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, 8, 5, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, 8, 6, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, 8, 8, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, 10, 5, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, 10, 6, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, 10, 8, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, 10, 10, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, 12, 10, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, 12, 12, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCLDRKHR>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_3x3x3_OES, 3, 3, 3, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_4x3x3_OES, 4, 3, 3, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_4x4x3_OES, 4, 4, 3, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_4x4x4_OES, 4, 4, 4, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_5x4x4_OES, 5, 4, 4, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_5x5x4_OES, 5, 5, 4, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_5x5x5_OES, 5, 5, 5, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_6x5x5_OES, 6, 5, 5, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_6x6x5_OES, 6, 6, 5, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_ASTC_6x6x6_OES, 6, 6, 6, 128, 4, false, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES, 3, 3, 3, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES, 4, 3, 3, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES, 4, 4, 3, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES, 4, 4, 4, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES, 5, 4, 4, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES, 5, 5, 4, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES, 5, 5, 5, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES, 6, 5, 5, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES, 6, 6, 5, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES, 6, 6, 6, 128, 4, true, RequireExt<&Extensions::textureCompressionASTCOES>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From EXT_texture_compression_bptc
+ // | Internal format | W | H |D | BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddCompressedFormat(&map, GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, 4, 4, 1, 128, 4, true, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, 4, 4, 1, 128, 4, false, RequireExt<&Extensions::textureCompressionBPTC>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // For STENCIL_INDEX8 we chose a normalized component type for the following reasons:
+ // - Multisampled buffer are disallowed for non-normalized integer component types and we want to support it for STENCIL_INDEX8
+ // - All other stencil formats (all depth-stencil) are either float or normalized
+ // - It affects only validation of internalformat in RenderbufferStorageMultisample.
+ // | Internal format |sized|D |S |X | Format | Type | Component type | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, true, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, NeverSupported, RequireES<1, 0>, RequireES<1, 0>);
+
+ // From GL_ANGLE_lossy_etc_decode
+ // | Internal format |W |H |D |BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddCompressedFormat(&map, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, 4, 4, 1, 64, 3, false, RequireExt<&Extensions::lossyETCDecode>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 1, 64, 3, false, RequireExt<&Extensions::lossyETCDecode>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 1, 64, 3, true, RequireExt<&Extensions::lossyETCDecode>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 1, 64, 3, false, RequireExt<&Extensions::lossyETCDecode>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddCompressedFormat(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE, 4, 4, 1, 64, 3, true, RequireExt<&Extensions::lossyETCDecode>, AlwaysSupported, NeverSupported, NeverSupported);
+
+ // From GL_EXT_texture_norm16
+ // | Internal format |sized| R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddRGBAFormat(&map, GL_R16_EXT, true, 16, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, RequireExt<&Extensions::textureNorm16>, RequireExt<&Extensions::textureNorm16>);
+ AddRGBAFormat(&map, GL_R16_SNORM_EXT, true, 16, 0, 0, 0, 0, GL_RED, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RG16_EXT, true, 16, 16, 0, 0, 0, GL_RG, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, RequireExt<&Extensions::textureNorm16>, RequireExt<&Extensions::textureNorm16>);
+ AddRGBAFormat(&map, GL_RG16_SNORM_EXT, true, 16, 16, 0, 0, 0, GL_RG, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB16_EXT, true, 16, 16, 16, 0, 0, GL_RGB, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGB16_SNORM_EXT, true, 16, 16, 16, 0, 0, GL_RGB, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, NeverSupported, NeverSupported );
+ AddRGBAFormat(&map, GL_RGBA16_EXT, true, 16, 16, 16, 16, 0, GL_RGBA, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, RequireExt<&Extensions::textureNorm16>, RequireExt<&Extensions::textureNorm16>);
+ AddRGBAFormat(&map, GL_RGBA16_SNORM_EXT, true, 16, 16, 16, 16, 0, GL_RGBA, GL_SHORT, GL_SIGNED_NORMALIZED, false, RequireExt<&Extensions::textureNorm16>, AlwaysSupported, NeverSupported, NeverSupported );
+
+ // Unsized formats
+ // | Internal format |sized | R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureRG>, AlwaysSupported, RequireExt<&Extensions::textureRG>, NeverSupported);
+ AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG, false, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureRG>, AlwaysSupported, RequireExt<&Extensions::textureRG>, NeverSupported);
+ AddRGBAFormat(&map, GL_RG, false, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, RequireES<2, 0>, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, RequireES<2, 0>, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, RequireES<2, 0>, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, RequireES<2, 0>, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, RequireES<2, 0>, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_SRGB, false, 8, 8, 8, 0, 0, GL_SRGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGB>, AlwaysSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_SRGB_ALPHA_EXT, false, 8, 8, 8, 8, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGB>, AlwaysSupported, RequireExt<&Extensions::sRGB>, NeverSupported);
+ AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported, RequireExt<&Extensions::textureFormatBGRA8888>, NeverSupported);
+
+ // Unsized integer formats
+ // |Internal format |sized | R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddRGBAFormat(&map, GL_RED_INTEGER, false, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RED_INTEGER, false, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RED_INTEGER, false, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RED_INTEGER, false, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RED_INTEGER, false, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RED_INTEGER, false, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG_INTEGER, false, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG_INTEGER, false, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG_INTEGER, false, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG_INTEGER, false, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG_INTEGER, false, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG_INTEGER, false, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB_INTEGER, false, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB_INTEGER, false, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB_INTEGER, false, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB_INTEGER, false, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB_INTEGER, false, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB_INTEGER, false, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 10, 10, 10, 2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported, NeverSupported);
+
+ // Unsized floating point formats
+ // |Internal format |sized | R | G | B | A |S | Format | Type | Comp | SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireExtAndExt<&Extensions::textureHalfFloat, &Extensions::textureRG>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireExtAndExt<&Extensions::textureHalfFloat, &Extensions::textureRG>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireExt<&Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, RequireExtAndExt<&Extensions::colorBufferHalfFloat, &Extensions::webglCompatibility>, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireExt<&Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, RequireExt<&Extensions::colorBufferHalfFloat>, NeverSupported);
+ AddRGBAFormat(&map, GL_RED, false, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, RequireExtAndExt<&Extensions::textureFloat, &Extensions::textureRG>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RG, false, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, RequireExtAndExt<&Extensions::textureFloat, &Extensions::textureRG>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, RequireExt<&Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 9, 9, 9, 0, 5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 11, 11, 10, 0, 0, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported, NeverSupported);
+ AddRGBAFormat(&map, GL_RGBA, false, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, RequireExt<&Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+
+ // Unsized luminance alpha formats
+ // | Internal format |sized | L | A | Format | Type | Component type | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddLUMAFormat(&map, GL_ALPHA, false, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported, AlwaysSupported, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE, false, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported, AlwaysSupported, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported, AlwaysSupported, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_ALPHA, false, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE, false, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, RequireExt<&Extensions::textureHalfFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_ALPHA, false, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE, false, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+ AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, RequireExt<&Extensions::textureFloatLinear>, NeverSupported, NeverSupported);
+
+ // Unsized depth stencil formats
+ // | Internal format |sized | D |S | X | Format | Type | Component type | Texture supported | Filterable | Texture attachment | Renderbuffer |
+ AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, AlwaysSupported, RequireES<1, 0>, RequireES<1, 0> );
+ AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, AlwaysSupported, RequireES<1, 0>, RequireES<1, 0> );
+ AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<1, 0>, AlwaysSupported, RequireES<1, 0>, RequireES<1, 0> );
+ AddDepthStencilFormat(&map, GL_DEPTH_STENCIL, false, 24, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_NORMALIZED, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, AlwaysSupported, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>);
+ AddDepthStencilFormat(&map, GL_DEPTH_STENCIL, false, 32, 8, 24, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, AlwaysSupported, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>);
+ AddDepthStencilFormat(&map, GL_STENCIL, false, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, NeverSupported , RequireES<1, 0>, RequireES<1, 0> );
+ // clang-format on
+
+ return map;
+}
+
+static const InternalFormatInfoMap &GetInternalFormatMap()
+{
+ static const InternalFormatInfoMap formatMap = BuildInternalFormatInfoMap();
+ return formatMap;
+}
+
+static FormatSet BuildAllSizedInternalFormatSet()
+{
+ FormatSet result;
+
+ for (const auto &internalFormat : GetInternalFormatMap())
+ {
+ for (const auto &type : internalFormat.second)
+ {
+ if (type.second.sized)
+ {
+ // TODO(jmadill): Fix this hack.
+ if (internalFormat.first == GL_BGR565_ANGLEX)
+ continue;
+
+ result.insert(internalFormat.first);
+ }
+ }
+ }
+
+ return result;
+}
+
+uint32_t GetPackedTypeInfo(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_BYTE:
+ {
+ static constexpr uint32_t kPacked = PackTypeInfo(1, false);
+ return kPacked;
+ }
+ case GL_UNSIGNED_SHORT:
+ case GL_SHORT:
+ case GL_HALF_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ {
+ static constexpr uint32_t kPacked = PackTypeInfo(2, false);
+ return kPacked;
+ }
+ case GL_UNSIGNED_INT:
+ case GL_INT:
+ case GL_FLOAT:
+ {
+ static constexpr uint32_t kPacked = PackTypeInfo(4, false);
+ return kPacked;
+ }
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ {
+ static constexpr uint32_t kPacked = PackTypeInfo(2, true);
+ return kPacked;
+ }
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_24_8:
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ {
+ ASSERT(GL_UNSIGNED_INT_24_8_OES == GL_UNSIGNED_INT_24_8);
+ static constexpr uint32_t kPacked = PackTypeInfo(4, true);
+ return kPacked;
+ }
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ {
+ static constexpr uint32_t kPacked = PackTypeInfo(8, true);
+ return kPacked;
+ }
+ default:
+ {
+ return 0;
+ }
+ }
+}
+
+const InternalFormat &GetSizedInternalFormatInfo(GLenum internalFormat)
+{
+ static const InternalFormat defaultInternalFormat;
+ const InternalFormatInfoMap &formatMap = GetInternalFormatMap();
+ auto iter = formatMap.find(internalFormat);
+
+ // Sized internal formats only have one type per entry
+ if (iter == formatMap.end() || iter->second.size() != 1)
+ {
+ return defaultInternalFormat;
+ }
+
+ const InternalFormat &internalFormatInfo = iter->second.begin()->second;
+ if (!internalFormatInfo.sized)
+ {
+ return defaultInternalFormat;
+ }
+
+ return internalFormatInfo;
+}
+
+const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, GLenum type)
+{
+ static const InternalFormat defaultInternalFormat;
+ const InternalFormatInfoMap &formatMap = GetInternalFormatMap();
+
+ auto internalFormatIter = formatMap.find(internalFormat);
+ if (internalFormatIter == formatMap.end())
+ {
+ return defaultInternalFormat;
+ }
+
+ // If the internal format is sized, simply return it without the type check.
+ if (internalFormatIter->second.size() == 1 && internalFormatIter->second.begin()->second.sized)
+ {
+ return internalFormatIter->second.begin()->second;
+ }
+
+ auto typeIter = internalFormatIter->second.find(type);
+ if (typeIter == internalFormatIter->second.end())
+ {
+ return defaultInternalFormat;
+ }
+
+ return typeIter->second;
+}
+
+GLuint InternalFormat::computePixelBytes(GLenum formatType) const
+{
+ const auto &typeInfo = GetTypeInfo(formatType);
+ GLuint components = typeInfo.specialInterpretation ? 1u : componentCount;
+ return components * typeInfo.bytes;
+}
+
+bool InternalFormat::computeRowPitch(GLenum formatType,
+ GLsizei width,
+ GLint alignment,
+ GLint rowLength,
+ GLuint *resultOut) const
+{
+ // Compressed images do not use pack/unpack parameters.
+ if (compressed)
+ {
+ ASSERT(rowLength == 0);
+ return computeCompressedImageSize(Extents(width, 1, 1), resultOut);
+ }
+
+ CheckedNumeric<GLuint> checkedWidth(rowLength > 0 ? rowLength : width);
+ CheckedNumeric<GLuint> checkedRowBytes = checkedWidth * computePixelBytes(formatType);
+
+ ASSERT(alignment > 0 && isPow2(alignment));
+ CheckedNumeric<GLuint> checkedAlignment(alignment);
+ auto aligned = rx::roundUp(checkedRowBytes, checkedAlignment);
+ return CheckedMathResult(aligned, resultOut);
+}
+
+bool InternalFormat::computeDepthPitch(GLsizei height,
+ GLint imageHeight,
+ GLuint rowPitch,
+ GLuint *resultOut) const
+{
+ CheckedNumeric<GLuint> pixelsHeight(imageHeight > 0 ? static_cast<GLuint>(imageHeight)
+ : static_cast<GLuint>(height));
+
+ CheckedNumeric<GLuint> rowCount;
+ if (compressed)
+ {
+ CheckedNumeric<GLuint> checkedBlockHeight(compressedBlockHeight);
+ rowCount = (pixelsHeight + checkedBlockHeight - 1u) / checkedBlockHeight;
+ }
+ else
+ {
+ rowCount = pixelsHeight;
+ }
+
+ CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
+
+ return CheckedMathResult(checkedRowPitch * rowCount, resultOut);
+}
+
+bool InternalFormat::computeDepthPitch(GLenum formatType,
+ GLsizei width,
+ GLsizei height,
+ GLint alignment,
+ GLint rowLength,
+ GLint imageHeight,
+ GLuint *resultOut) const
+{
+ GLuint rowPitch = 0;
+ if (!computeRowPitch(formatType, width, alignment, rowLength, &rowPitch))
+ {
+ return false;
+ }
+ return computeDepthPitch(height, imageHeight, rowPitch, resultOut);
+}
+
+bool InternalFormat::computeCompressedImageSize(const Extents &size, GLuint *resultOut) const
+{
+ CheckedNumeric<GLuint> checkedWidth(size.width);
+ CheckedNumeric<GLuint> checkedHeight(size.height);
+ CheckedNumeric<GLuint> checkedDepth(size.depth);
+ CheckedNumeric<GLuint> checkedBlockWidth(compressedBlockWidth);
+ CheckedNumeric<GLuint> checkedBlockHeight(compressedBlockHeight);
+
+ ASSERT(compressed);
+ auto numBlocksWide = (checkedWidth + checkedBlockWidth - 1u) / checkedBlockWidth;
+ auto numBlocksHigh = (checkedHeight + checkedBlockHeight - 1u) / checkedBlockHeight;
+ auto bytes = numBlocksWide * numBlocksHigh * pixelBytes * checkedDepth;
+ return CheckedMathResult(bytes, resultOut);
+}
+
+bool InternalFormat::computeSkipBytes(GLenum formatType,
+ GLuint rowPitch,
+ GLuint depthPitch,
+ const PixelStoreStateBase &state,
+ bool is3D,
+ GLuint *resultOut) const
+{
+ CheckedNumeric<GLuint> checkedRowPitch(rowPitch);
+ CheckedNumeric<GLuint> checkedDepthPitch(depthPitch);
+ CheckedNumeric<GLuint> checkedSkipImages(static_cast<GLuint>(state.skipImages));
+ CheckedNumeric<GLuint> checkedSkipRows(static_cast<GLuint>(state.skipRows));
+ CheckedNumeric<GLuint> checkedSkipPixels(static_cast<GLuint>(state.skipPixels));
+ CheckedNumeric<GLuint> checkedPixelBytes(computePixelBytes(formatType));
+ auto checkedSkipImagesBytes = checkedSkipImages * checkedDepthPitch;
+ if (!is3D)
+ {
+ checkedSkipImagesBytes = 0;
+ }
+ auto skipBytes = checkedSkipImagesBytes + checkedSkipRows * checkedRowPitch +
+ checkedSkipPixels * checkedPixelBytes;
+ return CheckedMathResult(skipBytes, resultOut);
+}
+
+bool InternalFormat::computePackUnpackEndByte(GLenum formatType,
+ const Extents &size,
+ const PixelStoreStateBase &state,
+ bool is3D,
+ GLuint *resultOut) const
+{
+ GLuint rowPitch = 0;
+ if (!computeRowPitch(formatType, size.width, state.alignment, state.rowLength, &rowPitch))
+ {
+ return false;
+ }
+
+ GLuint depthPitch = 0;
+ if (is3D && !computeDepthPitch(size.height, state.imageHeight, rowPitch, &depthPitch))
+ {
+ return false;
+ }
+
+ CheckedNumeric<GLuint> checkedCopyBytes(0);
+ if (compressed)
+ {
+ GLuint copyBytes = 0;
+ if (!computeCompressedImageSize(size, &copyBytes))
+ {
+ return false;
+ }
+ checkedCopyBytes = copyBytes;
+ }
+ else if (size.height != 0 && (!is3D || size.depth != 0))
+ {
+ CheckedNumeric<GLuint> bytes = computePixelBytes(formatType);
+ checkedCopyBytes += size.width * bytes;
+
+ CheckedNumeric<GLuint> heightMinusOne = size.height - 1;
+ checkedCopyBytes += heightMinusOne * rowPitch;
+
+ if (is3D)
+ {
+ CheckedNumeric<GLuint> depthMinusOne = size.depth - 1;
+ checkedCopyBytes += depthMinusOne * depthPitch;
+ }
+ }
+
+ GLuint skipBytes = 0;
+ if (!computeSkipBytes(formatType, rowPitch, depthPitch, state, is3D, &skipBytes))
+ {
+ return false;
+ }
+
+ CheckedNumeric<GLuint> endByte = checkedCopyBytes + CheckedNumeric<GLuint>(skipBytes);
+
+ return CheckedMathResult(endByte, resultOut);
+}
+
+GLenum GetUnsizedFormat(GLenum internalFormat)
+{
+ auto sizedFormatInfo = GetSizedInternalFormatInfo(internalFormat);
+ if (sizedFormatInfo.internalFormat != GL_NONE)
+ {
+ return sizedFormatInfo.format;
+ }
+
+ return internalFormat;
+}
+
+const FormatSet &GetAllSizedInternalFormats()
+{
+ static FormatSet formatSet = BuildAllSizedInternalFormatSet();
+ return formatSet;
+}
+
+AttributeType GetAttributeType(GLenum enumValue)
+{
+ switch (enumValue)
+ {
+ case GL_FLOAT:
+ return ATTRIBUTE_FLOAT;
+ case GL_FLOAT_VEC2:
+ return ATTRIBUTE_VEC2;
+ case GL_FLOAT_VEC3:
+ return ATTRIBUTE_VEC3;
+ case GL_FLOAT_VEC4:
+ return ATTRIBUTE_VEC4;
+ case GL_INT:
+ return ATTRIBUTE_INT;
+ case GL_INT_VEC2:
+ return ATTRIBUTE_IVEC2;
+ case GL_INT_VEC3:
+ return ATTRIBUTE_IVEC3;
+ case GL_INT_VEC4:
+ return ATTRIBUTE_IVEC4;
+ case GL_UNSIGNED_INT:
+ return ATTRIBUTE_UINT;
+ case GL_UNSIGNED_INT_VEC2:
+ return ATTRIBUTE_UVEC2;
+ case GL_UNSIGNED_INT_VEC3:
+ return ATTRIBUTE_UVEC3;
+ case GL_UNSIGNED_INT_VEC4:
+ return ATTRIBUTE_UVEC4;
+ case GL_FLOAT_MAT2:
+ return ATTRIBUTE_MAT2;
+ case GL_FLOAT_MAT3:
+ return ATTRIBUTE_MAT3;
+ case GL_FLOAT_MAT4:
+ return ATTRIBUTE_MAT4;
+ case GL_FLOAT_MAT2x3:
+ return ATTRIBUTE_MAT2x3;
+ case GL_FLOAT_MAT2x4:
+ return ATTRIBUTE_MAT2x4;
+ case GL_FLOAT_MAT3x2:
+ return ATTRIBUTE_MAT3x2;
+ case GL_FLOAT_MAT3x4:
+ return ATTRIBUTE_MAT3x4;
+ case GL_FLOAT_MAT4x2:
+ return ATTRIBUTE_MAT4x2;
+ case GL_FLOAT_MAT4x3:
+ return ATTRIBUTE_MAT4x3;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return ATTRIBUTE_FLOAT;
+#endif
+ }
+}
+
+angle::FormatID GetVertexFormatID(VertexAttribType type,
+ GLboolean normalized,
+ GLuint components,
+ bool pureInteger)
+{
+ switch (type)
+ {
+ case VertexAttribType::Byte:
+ switch (components)
+ {
+ case 1:
+ if (pureInteger)
+ return angle::FormatID::R8_SINT;
+ if (normalized)
+ return angle::FormatID::R8_SNORM;
+ return angle::FormatID::R8_SSCALED;
+ case 2:
+ if (pureInteger)
+ return angle::FormatID::R8G8_SINT;
+ if (normalized)
+ return angle::FormatID::R8G8_SNORM;
+ return angle::FormatID::R8G8_SSCALED;
+ case 3:
+ if (pureInteger)
+ return angle::FormatID::R8G8B8_SINT;
+ if (normalized)
+ return angle::FormatID::R8G8B8_SNORM;
+ return angle::FormatID::R8G8B8_SSCALED;
+ case 4:
+ if (pureInteger)
+ return angle::FormatID::R8G8B8A8_SINT;
+ if (normalized)
+ return angle::FormatID::R8G8B8A8_SNORM;
+ return angle::FormatID::R8G8B8A8_SSCALED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::UnsignedByte:
+ switch (components)
+ {
+ case 1:
+ if (pureInteger)
+ return angle::FormatID::R8_UINT;
+ if (normalized)
+ return angle::FormatID::R8_UNORM;
+ return angle::FormatID::R8_USCALED;
+ case 2:
+ if (pureInteger)
+ return angle::FormatID::R8G8_UINT;
+ if (normalized)
+ return angle::FormatID::R8G8_UNORM;
+ return angle::FormatID::R8G8_USCALED;
+ case 3:
+ if (pureInteger)
+ return angle::FormatID::R8G8B8_UINT;
+ if (normalized)
+ return angle::FormatID::R8G8B8_UNORM;
+ return angle::FormatID::R8G8B8_USCALED;
+ case 4:
+ if (pureInteger)
+ return angle::FormatID::R8G8B8A8_UINT;
+ if (normalized)
+ return angle::FormatID::R8G8B8A8_UNORM;
+ return angle::FormatID::R8G8B8A8_USCALED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::Short:
+ switch (components)
+ {
+ case 1:
+ if (pureInteger)
+ return angle::FormatID::R16_SINT;
+ if (normalized)
+ return angle::FormatID::R16_SNORM;
+ return angle::FormatID::R16_SSCALED;
+ case 2:
+ if (pureInteger)
+ return angle::FormatID::R16G16_SINT;
+ if (normalized)
+ return angle::FormatID::R16G16_SNORM;
+ return angle::FormatID::R16G16_SSCALED;
+ case 3:
+ if (pureInteger)
+ return angle::FormatID::R16G16B16_SINT;
+ if (normalized)
+ return angle::FormatID::R16G16B16_SNORM;
+ return angle::FormatID::R16G16B16_SSCALED;
+ case 4:
+ if (pureInteger)
+ return angle::FormatID::R16G16B16A16_SINT;
+ if (normalized)
+ return angle::FormatID::R16G16B16A16_SNORM;
+ return angle::FormatID::R16G16B16A16_SSCALED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::UnsignedShort:
+ switch (components)
+ {
+ case 1:
+ if (pureInteger)
+ return angle::FormatID::R16_UINT;
+ if (normalized)
+ return angle::FormatID::R16_UNORM;
+ return angle::FormatID::R16_USCALED;
+ case 2:
+ if (pureInteger)
+ return angle::FormatID::R16G16_UINT;
+ if (normalized)
+ return angle::FormatID::R16G16_UNORM;
+ return angle::FormatID::R16G16_USCALED;
+ case 3:
+ if (pureInteger)
+ return angle::FormatID::R16G16B16_UINT;
+ if (normalized)
+ return angle::FormatID::R16G16B16_UNORM;
+ return angle::FormatID::R16G16B16_USCALED;
+ case 4:
+ if (pureInteger)
+ return angle::FormatID::R16G16B16A16_UINT;
+ if (normalized)
+ return angle::FormatID::R16G16B16A16_UNORM;
+ return angle::FormatID::R16G16B16A16_USCALED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::Int:
+ switch (components)
+ {
+ case 1:
+ if (pureInteger)
+ return angle::FormatID::R32_SINT;
+ if (normalized)
+ return angle::FormatID::R32_SNORM;
+ return angle::FormatID::R32_SSCALED;
+ case 2:
+ if (pureInteger)
+ return angle::FormatID::R32G32_SINT;
+ if (normalized)
+ return angle::FormatID::R32G32_SNORM;
+ return angle::FormatID::R32G32_SSCALED;
+ case 3:
+ if (pureInteger)
+ return angle::FormatID::R32G32B32_SINT;
+ if (normalized)
+ return angle::FormatID::R32G32B32_SNORM;
+ return angle::FormatID::R32G32B32_SSCALED;
+ case 4:
+ if (pureInteger)
+ return angle::FormatID::R32G32B32A32_SINT;
+ if (normalized)
+ return angle::FormatID::R32G32B32A32_SNORM;
+ return angle::FormatID::R32G32B32A32_SSCALED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::UnsignedInt:
+ switch (components)
+ {
+ case 1:
+ if (pureInteger)
+ return angle::FormatID::R32_UINT;
+ if (normalized)
+ return angle::FormatID::R32_UNORM;
+ return angle::FormatID::R32_USCALED;
+ case 2:
+ if (pureInteger)
+ return angle::FormatID::R32G32_UINT;
+ if (normalized)
+ return angle::FormatID::R32G32_UNORM;
+ return angle::FormatID::R32G32_USCALED;
+ case 3:
+ if (pureInteger)
+ return angle::FormatID::R32G32B32_UINT;
+ if (normalized)
+ return angle::FormatID::R32G32B32_UNORM;
+ return angle::FormatID::R32G32B32_USCALED;
+ case 4:
+ if (pureInteger)
+ return angle::FormatID::R32G32B32A32_UINT;
+ if (normalized)
+ return angle::FormatID::R32G32B32A32_UNORM;
+ return angle::FormatID::R32G32B32A32_USCALED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::Float:
+ switch (components)
+ {
+ case 1:
+ return angle::FormatID::R32_FLOAT;
+ case 2:
+ return angle::FormatID::R32G32_FLOAT;
+ case 3:
+ return angle::FormatID::R32G32B32_FLOAT;
+ case 4:
+ return angle::FormatID::R32G32B32A32_FLOAT;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::HalfFloat:
+ switch (components)
+ {
+ case 1:
+ return angle::FormatID::R16_FLOAT;
+ case 2:
+ return angle::FormatID::R16G16_FLOAT;
+ case 3:
+ return angle::FormatID::R16G16B16_FLOAT;
+ case 4:
+ return angle::FormatID::R16G16B16A16_FLOAT;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::Fixed:
+ switch (components)
+ {
+ case 1:
+ return angle::FormatID::R32_FIXED;
+ case 2:
+ return angle::FormatID::R32G32_FIXED;
+ case 3:
+ return angle::FormatID::R32G32B32_FIXED;
+ case 4:
+ return angle::FormatID::R32G32B32A32_FIXED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+ case VertexAttribType::Int2101010:
+ if (pureInteger)
+ return angle::FormatID::R10G10B10A2_SINT;
+ if (normalized)
+ return angle::FormatID::R10G10B10A2_SNORM;
+ return angle::FormatID::R10G10B10A2_SSCALED;
+ case VertexAttribType::UnsignedInt2101010:
+ if (pureInteger)
+ return angle::FormatID::R10G10B10A2_UINT;
+ if (normalized)
+ return angle::FormatID::R10G10B10A2_UNORM;
+ return angle::FormatID::R10G10B10A2_USCALED;
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return angle::FormatID::NONE;
+#endif
+ }
+}
+
+angle::FormatID GetVertexFormatID(const VertexAttribute &attrib, VertexAttribType currentValueType)
+{
+ if (!attrib.enabled)
+ {
+ return GetCurrentValueFormatID(currentValueType);
+ }
+ return attrib.format->id;
+}
+
+angle::FormatID GetCurrentValueFormatID(VertexAttribType currentValueType)
+{
+ switch (currentValueType)
+ {
+ case VertexAttribType::Float:
+ return angle::FormatID::R32G32B32A32_FLOAT;
+ case VertexAttribType::Int:
+ return angle::FormatID::R32G32B32A32_SINT;
+ case VertexAttribType::UnsignedInt:
+ return angle::FormatID::R32G32B32A32_UINT;
+ default:
+ UNREACHABLE();
+ return angle::FormatID::NONE;
+ }
+}
+
+const VertexFormat &GetVertexFormatFromID(angle::FormatID vertexFormatID)
+{
+ switch (vertexFormatID)
+ {
+ case angle::FormatID::R8_SSCALED:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R8_SNORM:
+ {
+ static const VertexFormat format(GL_BYTE, GL_TRUE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R8G8_SSCALED:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R8G8_SNORM:
+ {
+ static const VertexFormat format(GL_BYTE, GL_TRUE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8_SSCALED:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8_SNORM:
+ {
+ static const VertexFormat format(GL_BYTE, GL_TRUE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8A8_SSCALED:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8A8_SNORM:
+ {
+ static const VertexFormat format(GL_BYTE, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R8_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R8_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R8G8_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R8G8_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8A8_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R8G8B8A8_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R16_SSCALED:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R16_SNORM:
+ {
+ static const VertexFormat format(GL_SHORT, GL_TRUE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R16G16_SSCALED:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R16G16_SNORM:
+ {
+ static const VertexFormat format(GL_SHORT, GL_TRUE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16_SSCALED:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16_SNORM:
+ {
+ static const VertexFormat format(GL_SHORT, GL_TRUE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16A16_SSCALED:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16A16_SNORM:
+ {
+ static const VertexFormat format(GL_SHORT, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R16_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R16_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R16G16_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R16G16_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16A16_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16A16_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R32_SSCALED:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R32_SNORM:
+ {
+ static const VertexFormat format(GL_INT, GL_TRUE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R32G32_SSCALED:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R32G32_SNORM:
+ {
+ static const VertexFormat format(GL_INT, GL_TRUE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_SSCALED:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_SNORM:
+ {
+ static const VertexFormat format(GL_INT, GL_TRUE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_SSCALED:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_SNORM:
+ {
+ static const VertexFormat format(GL_INT, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R32_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R32_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R32G32_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R32G32_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R8_SINT:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 1, true);
+ return format;
+ }
+ case angle::FormatID::R8G8_SINT:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 2, true);
+ return format;
+ }
+ case angle::FormatID::R8G8B8_SINT:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 3, true);
+ return format;
+ }
+ case angle::FormatID::R8G8B8A8_SINT:
+ {
+ static const VertexFormat format(GL_BYTE, GL_FALSE, 4, true);
+ return format;
+ }
+ case angle::FormatID::R8_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 1, true);
+ return format;
+ }
+ case angle::FormatID::R8G8_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 2, true);
+ return format;
+ }
+ case angle::FormatID::R8G8B8_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 3, true);
+ return format;
+ }
+ case angle::FormatID::R8G8B8A8_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_BYTE, GL_FALSE, 4, true);
+ return format;
+ }
+ case angle::FormatID::R16_SINT:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 1, true);
+ return format;
+ }
+ case angle::FormatID::R16G16_SINT:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 2, true);
+ return format;
+ }
+ case angle::FormatID::R16G16B16_SINT:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 3, true);
+ return format;
+ }
+ case angle::FormatID::R16G16B16A16_SINT:
+ {
+ static const VertexFormat format(GL_SHORT, GL_FALSE, 4, true);
+ return format;
+ }
+ case angle::FormatID::R16_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 1, true);
+ return format;
+ }
+ case angle::FormatID::R16G16_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 2, true);
+ return format;
+ }
+ case angle::FormatID::R16G16B16_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 3, true);
+ return format;
+ }
+ case angle::FormatID::R16G16B16A16_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_SHORT, GL_FALSE, 4, true);
+ return format;
+ }
+ case angle::FormatID::R32_SINT:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 1, true);
+ return format;
+ }
+ case angle::FormatID::R32G32_SINT:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 2, true);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_SINT:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 3, true);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_SINT:
+ {
+ static const VertexFormat format(GL_INT, GL_FALSE, 4, true);
+ return format;
+ }
+ case angle::FormatID::R32_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 1, true);
+ return format;
+ }
+ case angle::FormatID::R32G32_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 2, true);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 3, true);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT, GL_FALSE, 4, true);
+ return format;
+ }
+ case angle::FormatID::R32_FIXED:
+ {
+ static const VertexFormat format(GL_FIXED, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R32G32_FIXED:
+ {
+ static const VertexFormat format(GL_FIXED, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_FIXED:
+ {
+ static const VertexFormat format(GL_FIXED, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_FIXED:
+ {
+ static const VertexFormat format(GL_FIXED, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R16_FLOAT:
+ {
+ static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R16G16_FLOAT:
+ {
+ static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16_FLOAT:
+ {
+ static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R16G16B16A16_FLOAT:
+ {
+ static const VertexFormat format(GL_HALF_FLOAT, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R32_FLOAT:
+ {
+ static const VertexFormat format(GL_FLOAT, GL_FALSE, 1, false);
+ return format;
+ }
+ case angle::FormatID::R32G32_FLOAT:
+ {
+ static const VertexFormat format(GL_FLOAT, GL_FALSE, 2, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32_FLOAT:
+ {
+ static const VertexFormat format(GL_FLOAT, GL_FALSE, 3, false);
+ return format;
+ }
+ case angle::FormatID::R32G32B32A32_FLOAT:
+ {
+ static const VertexFormat format(GL_FLOAT, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R10G10B10A2_SSCALED:
+ {
+ static const VertexFormat format(GL_INT_2_10_10_10_REV, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R10G10B10A2_USCALED:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT_2_10_10_10_REV, GL_FALSE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R10G10B10A2_SNORM:
+ {
+ static const VertexFormat format(GL_INT_2_10_10_10_REV, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R10G10B10A2_UNORM:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE, 4, false);
+ return format;
+ }
+ case angle::FormatID::R10G10B10A2_SINT:
+ {
+ static const VertexFormat format(GL_INT_2_10_10_10_REV, GL_FALSE, 4, true);
+ return format;
+ }
+ case angle::FormatID::R10G10B10A2_UINT:
+ {
+ static const VertexFormat format(GL_UNSIGNED_INT_2_10_10_10_REV, GL_FALSE, 4, true);
+ return format;
+ }
+ default:
+ {
+ static const VertexFormat format(GL_NONE, GL_FALSE, 0, false);
+ return format;
+ }
+ }
+}
+
+size_t GetVertexFormatSize(angle::FormatID vertexFormatID)
+{
+ switch (vertexFormatID)
+ {
+ case angle::FormatID::R8_SSCALED:
+ case angle::FormatID::R8_SNORM:
+ case angle::FormatID::R8_USCALED:
+ case angle::FormatID::R8_UNORM:
+ case angle::FormatID::R8_SINT:
+ case angle::FormatID::R8_UINT:
+ return 1;
+
+ case angle::FormatID::R8G8_SSCALED:
+ case angle::FormatID::R8G8_SNORM:
+ case angle::FormatID::R8G8_USCALED:
+ case angle::FormatID::R8G8_UNORM:
+ case angle::FormatID::R8G8_SINT:
+ case angle::FormatID::R8G8_UINT:
+ case angle::FormatID::R16_SSCALED:
+ case angle::FormatID::R16_SNORM:
+ case angle::FormatID::R16_USCALED:
+ case angle::FormatID::R16_UNORM:
+ case angle::FormatID::R16_SINT:
+ case angle::FormatID::R16_UINT:
+ case angle::FormatID::R16_FLOAT:
+ return 2;
+
+ case angle::FormatID::R8G8B8_SSCALED:
+ case angle::FormatID::R8G8B8_SNORM:
+ case angle::FormatID::R8G8B8_USCALED:
+ case angle::FormatID::R8G8B8_UNORM:
+ case angle::FormatID::R8G8B8_SINT:
+ case angle::FormatID::R8G8B8_UINT:
+ return 3;
+
+ case angle::FormatID::R8G8B8A8_SSCALED:
+ case angle::FormatID::R8G8B8A8_SNORM:
+ case angle::FormatID::R8G8B8A8_USCALED:
+ case angle::FormatID::R8G8B8A8_UNORM:
+ case angle::FormatID::R8G8B8A8_SINT:
+ case angle::FormatID::R8G8B8A8_UINT:
+ case angle::FormatID::R16G16_SSCALED:
+ case angle::FormatID::R16G16_SNORM:
+ case angle::FormatID::R16G16_USCALED:
+ case angle::FormatID::R16G16_UNORM:
+ case angle::FormatID::R16G16_SINT:
+ case angle::FormatID::R16G16_UINT:
+ case angle::FormatID::R32_SSCALED:
+ case angle::FormatID::R32_SNORM:
+ case angle::FormatID::R32_USCALED:
+ case angle::FormatID::R32_UNORM:
+ case angle::FormatID::R32_SINT:
+ case angle::FormatID::R32_UINT:
+ case angle::FormatID::R16G16_FLOAT:
+ case angle::FormatID::R32_FIXED:
+ case angle::FormatID::R32_FLOAT:
+ case angle::FormatID::R10G10B10A2_SSCALED:
+ case angle::FormatID::R10G10B10A2_USCALED:
+ case angle::FormatID::R10G10B10A2_SNORM:
+ case angle::FormatID::R10G10B10A2_UNORM:
+ case angle::FormatID::R10G10B10A2_SINT:
+ case angle::FormatID::R10G10B10A2_UINT:
+ return 4;
+
+ case angle::FormatID::R16G16B16_SSCALED:
+ case angle::FormatID::R16G16B16_SNORM:
+ case angle::FormatID::R16G16B16_USCALED:
+ case angle::FormatID::R16G16B16_UNORM:
+ case angle::FormatID::R16G16B16_SINT:
+ case angle::FormatID::R16G16B16_UINT:
+ case angle::FormatID::R16G16B16_FLOAT:
+ return 6;
+
+ case angle::FormatID::R16G16B16A16_SSCALED:
+ case angle::FormatID::R16G16B16A16_SNORM:
+ case angle::FormatID::R16G16B16A16_USCALED:
+ case angle::FormatID::R16G16B16A16_UNORM:
+ case angle::FormatID::R16G16B16A16_SINT:
+ case angle::FormatID::R16G16B16A16_UINT:
+ case angle::FormatID::R32G32_SSCALED:
+ case angle::FormatID::R32G32_SNORM:
+ case angle::FormatID::R32G32_USCALED:
+ case angle::FormatID::R32G32_UNORM:
+ case angle::FormatID::R32G32_SINT:
+ case angle::FormatID::R32G32_UINT:
+ case angle::FormatID::R16G16B16A16_FLOAT:
+ case angle::FormatID::R32G32_FIXED:
+ case angle::FormatID::R32G32_FLOAT:
+ return 8;
+
+ case angle::FormatID::R32G32B32_SSCALED:
+ case angle::FormatID::R32G32B32_SNORM:
+ case angle::FormatID::R32G32B32_USCALED:
+ case angle::FormatID::R32G32B32_UNORM:
+ case angle::FormatID::R32G32B32_SINT:
+ case angle::FormatID::R32G32B32_UINT:
+ case angle::FormatID::R32G32B32_FIXED:
+ case angle::FormatID::R32G32B32_FLOAT:
+ return 12;
+
+ case angle::FormatID::R32G32B32A32_SSCALED:
+ case angle::FormatID::R32G32B32A32_SNORM:
+ case angle::FormatID::R32G32B32A32_USCALED:
+ case angle::FormatID::R32G32B32A32_UNORM:
+ case angle::FormatID::R32G32B32A32_SINT:
+ case angle::FormatID::R32G32B32A32_UINT:
+ case angle::FormatID::R32G32B32A32_FIXED:
+ case angle::FormatID::R32G32B32A32_FLOAT:
+ return 16;
+
+ case angle::FormatID::NONE:
+ default:
+ UNREACHABLE();
+#if !UNREACHABLE_IS_NORETURN
+ return 0;
+#endif
+ }
+}
+
+bool ValidES3InternalFormat(GLenum internalFormat)
+{
+ const InternalFormatInfoMap &formatMap = GetInternalFormatMap();
+ return internalFormat != GL_NONE && formatMap.find(internalFormat) != formatMap.end();
+}
+
+VertexFormat::VertexFormat(GLenum typeIn,
+ GLboolean normalizedIn,
+ GLuint componentsIn,
+ bool pureIntegerIn)
+ : type(typeIn), normalized(normalizedIn), components(componentsIn), pureInteger(pureIntegerIn)
+{
+ // float -> !normalized
+ ASSERT(!(type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_FIXED) ||
+ normalized == GL_FALSE);
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/formatutils.h b/gfx/angle/checkout/src/libANGLE/formatutils.h
new file mode 100644
index 0000000000..3c29e156d3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/formatutils.h
@@ -0,0 +1,303 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils.h: Queries for GL image formats.
+
+#ifndef LIBANGLE_FORMATUTILS_H_
+#define LIBANGLE_FORMATUTILS_H_
+
+#include <stdint.h>
+#include <cstddef>
+#include <ostream>
+
+#include "angle_gl.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/Version.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/angletypes.h"
+
+namespace gl
+{
+struct VertexAttribute;
+
+struct FormatType final
+{
+ FormatType();
+ FormatType(GLenum format_, GLenum type_);
+ FormatType(const FormatType &other) = default;
+ FormatType &operator=(const FormatType &other) = default;
+
+ bool operator<(const FormatType &other) const;
+
+ GLenum format;
+ GLenum type;
+};
+
+struct Type
+{
+ Type() : bytes(0), bytesShift(0), specialInterpretation(0) {}
+
+ explicit Type(uint32_t packedTypeInfo)
+ : bytes(packedTypeInfo & 0xff),
+ bytesShift((packedTypeInfo >> 8) & 0xff),
+ specialInterpretation((packedTypeInfo >> 16) & 1)
+ {}
+
+ GLuint bytes;
+ GLuint bytesShift; // Bit shift by this value to effectively divide/multiply by "bytes" in a
+ // more optimal way
+ bool specialInterpretation;
+};
+
+uint32_t GetPackedTypeInfo(GLenum type);
+
+ANGLE_INLINE const Type GetTypeInfo(GLenum type)
+{
+ return Type(GetPackedTypeInfo(type));
+}
+
+// This helpers use tricks based on the assumption that the type has certain values.
+static_assert(static_cast<GLuint>(DrawElementsType::UnsignedByte) == 0, "Please update this code.");
+static_assert(static_cast<GLuint>(DrawElementsType::UnsignedShort) == 1,
+ "Please update this code.");
+static_assert(static_cast<GLuint>(DrawElementsType::UnsignedInt) == 2, "Please update this code.");
+ANGLE_INLINE GLuint GetDrawElementsTypeSize(DrawElementsType type)
+{
+ return (1 << static_cast<GLuint>(type));
+}
+
+ANGLE_INLINE GLuint GetDrawElementsTypeShift(DrawElementsType type)
+{
+ return static_cast<GLuint>(type);
+}
+
+// Information about an OpenGL internal format. Can be keyed on the internalFormat and type
+// members.
+struct InternalFormat
+{
+ InternalFormat();
+ InternalFormat(const InternalFormat &other);
+
+ GLuint computePixelBytes(GLenum formatType) const;
+
+ ANGLE_NO_DISCARD bool computeRowPitch(GLenum formatType,
+ GLsizei width,
+ GLint alignment,
+ GLint rowLength,
+ GLuint *resultOut) const;
+ ANGLE_NO_DISCARD bool computeDepthPitch(GLsizei height,
+ GLint imageHeight,
+ GLuint rowPitch,
+ GLuint *resultOut) const;
+ ANGLE_NO_DISCARD bool computeDepthPitch(GLenum formatType,
+ GLsizei width,
+ GLsizei height,
+ GLint alignment,
+ GLint rowLength,
+ GLint imageHeight,
+ GLuint *resultOut) const;
+
+ ANGLE_NO_DISCARD bool computeCompressedImageSize(const Extents &size, GLuint *resultOut) const;
+
+ ANGLE_NO_DISCARD bool computeSkipBytes(GLenum formatType,
+ GLuint rowPitch,
+ GLuint depthPitch,
+ const PixelStoreStateBase &state,
+ bool is3D,
+ GLuint *resultOut) const;
+
+ ANGLE_NO_DISCARD bool computePackUnpackEndByte(GLenum formatType,
+ const Extents &size,
+ const PixelStoreStateBase &state,
+ bool is3D,
+ GLuint *resultOut) const;
+
+ bool isLUMA() const;
+ GLenum getReadPixelsFormat() const;
+ GLenum getReadPixelsType(const Version &version) const;
+
+ // Return true if the format is a required renderbuffer format in the given version of the core
+ // spec. Note that it isn't always clear whether all the rules that apply to core required
+ // renderbuffer formats also apply to additional formats added by extensions. Because of this
+ // extension formats are conservatively not included.
+ bool isRequiredRenderbufferFormat(const Version &version) const;
+
+ bool isInt() const;
+
+ bool operator==(const InternalFormat &other) const;
+ bool operator!=(const InternalFormat &other) const;
+
+ GLenum internalFormat;
+
+ bool sized;
+ GLenum sizedInternalFormat;
+
+ GLuint redBits;
+ GLuint greenBits;
+ GLuint blueBits;
+
+ GLuint luminanceBits;
+
+ GLuint alphaBits;
+ GLuint sharedBits;
+
+ GLuint depthBits;
+ GLuint stencilBits;
+
+ GLuint pixelBytes;
+
+ GLuint componentCount;
+
+ bool compressed;
+ GLuint compressedBlockWidth;
+ GLuint compressedBlockHeight;
+ GLuint compressedBlockDepth;
+
+ GLenum format;
+ GLenum type;
+
+ GLenum componentType;
+ GLenum colorEncoding;
+
+ typedef bool (*SupportCheckFunction)(const Version &, const Extensions &);
+ SupportCheckFunction textureSupport;
+ SupportCheckFunction filterSupport;
+ SupportCheckFunction textureAttachmentSupport; // glFramebufferTexture2D
+ SupportCheckFunction renderbufferSupport; // glFramebufferRenderbuffer
+};
+
+// A "Format" wraps an InternalFormat struct, querying it from either a sized internal format or
+// unsized internal format and type.
+// TODO(geofflang): Remove this, it doesn't add any more information than the InternalFormat object.
+struct Format
+{
+ // Sized types only.
+ explicit Format(GLenum internalFormat);
+
+ // Sized or unsized types.
+ explicit Format(const InternalFormat &internalFormat);
+ Format(GLenum internalFormat, GLenum type);
+
+ Format(const Format &other);
+ Format &operator=(const Format &other);
+
+ bool valid() const;
+
+ static Format Invalid();
+ static bool SameSized(const Format &a, const Format &b);
+ static bool EquivalentForBlit(const Format &a, const Format &b);
+
+ friend std::ostream &operator<<(std::ostream &os, const Format &fmt);
+
+ // This is the sized info.
+ const InternalFormat *info;
+};
+
+const InternalFormat &GetSizedInternalFormatInfo(GLenum internalFormat);
+const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, GLenum type);
+
+// Strip sizing information from an internal format. Doesn't necessarily validate that the internal
+// format is valid.
+GLenum GetUnsizedFormat(GLenum internalFormat);
+
+typedef std::set<GLenum> FormatSet;
+const FormatSet &GetAllSizedInternalFormats();
+
+// From the ESSL 3.00.4 spec:
+// Vertex shader inputs can only be float, floating-point vectors, matrices, signed and unsigned
+// integers and integer vectors. Vertex shader inputs cannot be arrays or structures.
+
+enum AttributeType
+{
+ ATTRIBUTE_FLOAT,
+ ATTRIBUTE_VEC2,
+ ATTRIBUTE_VEC3,
+ ATTRIBUTE_VEC4,
+ ATTRIBUTE_INT,
+ ATTRIBUTE_IVEC2,
+ ATTRIBUTE_IVEC3,
+ ATTRIBUTE_IVEC4,
+ ATTRIBUTE_UINT,
+ ATTRIBUTE_UVEC2,
+ ATTRIBUTE_UVEC3,
+ ATTRIBUTE_UVEC4,
+ ATTRIBUTE_MAT2,
+ ATTRIBUTE_MAT3,
+ ATTRIBUTE_MAT4,
+ ATTRIBUTE_MAT2x3,
+ ATTRIBUTE_MAT2x4,
+ ATTRIBUTE_MAT3x2,
+ ATTRIBUTE_MAT3x4,
+ ATTRIBUTE_MAT4x2,
+ ATTRIBUTE_MAT4x3,
+};
+
+AttributeType GetAttributeType(GLenum enumValue);
+
+typedef std::vector<angle::FormatID> InputLayout;
+
+struct VertexFormat : private angle::NonCopyable
+{
+ VertexFormat(GLenum typeIn, GLboolean normalizedIn, GLuint componentsIn, bool pureIntegerIn);
+
+ GLenum type;
+ GLboolean normalized;
+ GLuint components;
+ bool pureInteger;
+};
+
+angle::FormatID GetVertexFormatID(VertexAttribType type,
+ GLboolean normalized,
+ GLuint components,
+ bool pureInteger);
+
+angle::FormatID GetVertexFormatID(const VertexAttribute &attrib, VertexAttribType currentValueType);
+angle::FormatID GetCurrentValueFormatID(VertexAttribType currentValueType);
+const VertexFormat &GetVertexFormatFromID(angle::FormatID vertexFormatID);
+size_t GetVertexFormatSize(angle::FormatID vertexFormatID);
+
+// Check if an internal format is ever valid in ES3. Makes no checks about support for a specific
+// context.
+bool ValidES3InternalFormat(GLenum internalFormat);
+
+// Implemented in format_map_autogen.cpp
+bool ValidES3Format(GLenum format);
+bool ValidES3Type(GLenum type);
+bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat);
+
+// Implemented in es3_copy_conversion_table_autogen.cpp
+bool ValidES3CopyConversion(GLenum textureFormat, GLenum framebufferFormat);
+
+ANGLE_INLINE ComponentType GetVertexAttributeComponentType(bool pureInteger, VertexAttribType type)
+{
+ if (pureInteger)
+ {
+ switch (type)
+ {
+ case VertexAttribType::Byte:
+ case VertexAttribType::Short:
+ case VertexAttribType::Int:
+ return ComponentType::Int;
+
+ case VertexAttribType::UnsignedByte:
+ case VertexAttribType::UnsignedShort:
+ case VertexAttribType::UnsignedInt:
+ return ComponentType::UnsignedInt;
+
+ default:
+ UNREACHABLE();
+ return ComponentType::NoType;
+ }
+ }
+ else
+ {
+ return ComponentType::Float;
+ }
+}
+} // namespace gl
+
+#endif // LIBANGLE_FORMATUTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/frame_capture_utils_autogen.h b/gfx/angle/checkout/src/libANGLE/frame_capture_utils_autogen.h
new file mode 100644
index 0000000000..c92c232798
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/frame_capture_utils_autogen.h
@@ -0,0 +1,953 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// frame_capture_utils_autogen.h:
+// ANGLE Frame capture types and helper functions.
+
+#ifndef LIBANGLE_FRAME_CAPTURE_UTILS_AUTOGEN_H_
+#define LIBANGLE_FRAME_CAPTURE_UTILS_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace angle
+{
+enum class ParamType
+{
+ TAlphaTestFunc,
+ TBufferBinding,
+ TBufferUsage,
+ TClientVertexArrayType,
+ TCullFaceMode,
+ TDrawElementsType,
+ TGLDEBUGPROC,
+ TGLDEBUGPROCKHR,
+ TGLbitfield,
+ TGLboolean,
+ TGLbooleanConstPointer,
+ TGLbooleanPointer,
+ TGLbyte,
+ TGLbyteConstPointer,
+ TGLcharConstPointer,
+ TGLcharConstPointerPointer,
+ TGLcharPointer,
+ TGLclampx,
+ TGLdouble,
+ TGLdoubleConstPointer,
+ TGLdoublePointer,
+ TGLeglImageOES,
+ TGLenum,
+ TGLenumConstPointer,
+ TGLenumPointer,
+ TGLfixed,
+ TGLfixedConstPointer,
+ TGLfixedPointer,
+ TGLfloat,
+ TGLfloatConstPointer,
+ TGLfloatPointer,
+ TGLint,
+ TGLint64Pointer,
+ TGLintConstPointer,
+ TGLintPointer,
+ TGLintptr,
+ TGLintptrConstPointer,
+ TGLshort,
+ TGLshortConstPointer,
+ TGLsizei,
+ TGLsizeiConstPointer,
+ TGLsizeiPointer,
+ TGLsizeiptr,
+ TGLsizeiptrConstPointer,
+ TGLsync,
+ TGLubyte,
+ TGLubyteConstPointer,
+ TGLubytePointer,
+ TGLuint,
+ TGLuint64,
+ TGLuint64ConstPointer,
+ TGLuint64Pointer,
+ TGLuintConstPointer,
+ TGLuintPointer,
+ TGLushort,
+ TGLushortConstPointer,
+ TGLushortPointer,
+ TGLvoidConstPointer,
+ TGLvoidConstPointerPointer,
+ TGraphicsResetStatus,
+ THandleType,
+ TLightParameter,
+ TLogicalOperation,
+ TMaterialParameter,
+ TMatrixType,
+ TPointParameter,
+ TPrimitiveMode,
+ TProvokingVertexConvention,
+ TQueryType,
+ TShaderType,
+ TShadingModel,
+ TTextureEnvParameter,
+ TTextureEnvTarget,
+ TTextureTarget,
+ TTextureType,
+ TVertexAttribType,
+ TvoidConstPointer,
+ TvoidConstPointerPointer,
+ TvoidPointer,
+ TvoidPointerPointer,
+};
+
+union ParamValue
+{
+ gl::AlphaTestFunc AlphaTestFuncVal;
+ gl::BufferBinding BufferBindingVal;
+ gl::BufferUsage BufferUsageVal;
+ gl::ClientVertexArrayType ClientVertexArrayTypeVal;
+ gl::CullFaceMode CullFaceModeVal;
+ gl::DrawElementsType DrawElementsTypeVal;
+ GLDEBUGPROC GLDEBUGPROCVal;
+ GLDEBUGPROCKHR GLDEBUGPROCKHRVal;
+ GLbitfield GLbitfieldVal;
+ GLboolean GLbooleanVal;
+ const GLboolean *GLbooleanConstPointerVal;
+ GLboolean *GLbooleanPointerVal;
+ GLbyte GLbyteVal;
+ const GLbyte *GLbyteConstPointerVal;
+ const GLchar *GLcharConstPointerVal;
+ const GLchar *const *GLcharConstPointerPointerVal;
+ GLchar *GLcharPointerVal;
+ GLclampx GLclampxVal;
+ GLdouble GLdoubleVal;
+ const GLdouble *GLdoubleConstPointerVal;
+ GLdouble *GLdoublePointerVal;
+ GLeglImageOES GLeglImageOESVal;
+ GLenum GLenumVal;
+ const GLenum *GLenumConstPointerVal;
+ GLenum *GLenumPointerVal;
+ GLfixed GLfixedVal;
+ const GLfixed *GLfixedConstPointerVal;
+ GLfixed *GLfixedPointerVal;
+ GLfloat GLfloatVal;
+ const GLfloat *GLfloatConstPointerVal;
+ GLfloat *GLfloatPointerVal;
+ GLint GLintVal;
+ GLint64 *GLint64PointerVal;
+ const GLint *GLintConstPointerVal;
+ GLint *GLintPointerVal;
+ GLintptr GLintptrVal;
+ const GLintptr *GLintptrConstPointerVal;
+ GLshort GLshortVal;
+ const GLshort *GLshortConstPointerVal;
+ GLsizei GLsizeiVal;
+ const GLsizei *GLsizeiConstPointerVal;
+ GLsizei *GLsizeiPointerVal;
+ GLsizeiptr GLsizeiptrVal;
+ const GLsizeiptr *GLsizeiptrConstPointerVal;
+ GLsync GLsyncVal;
+ GLubyte GLubyteVal;
+ const GLubyte *GLubyteConstPointerVal;
+ GLubyte *GLubytePointerVal;
+ GLuint GLuintVal;
+ GLuint64 GLuint64Val;
+ const GLuint64 *GLuint64ConstPointerVal;
+ GLuint64 *GLuint64PointerVal;
+ const GLuint *GLuintConstPointerVal;
+ GLuint *GLuintPointerVal;
+ GLushort GLushortVal;
+ const GLushort *GLushortConstPointerVal;
+ GLushort *GLushortPointerVal;
+ const GLvoid *GLvoidConstPointerVal;
+ const GLvoid *const *GLvoidConstPointerPointerVal;
+ gl::GraphicsResetStatus GraphicsResetStatusVal;
+ gl::HandleType HandleTypeVal;
+ gl::LightParameter LightParameterVal;
+ gl::LogicalOperation LogicalOperationVal;
+ gl::MaterialParameter MaterialParameterVal;
+ gl::MatrixType MatrixTypeVal;
+ gl::PointParameter PointParameterVal;
+ gl::PrimitiveMode PrimitiveModeVal;
+ gl::ProvokingVertexConvention ProvokingVertexConventionVal;
+ gl::QueryType QueryTypeVal;
+ gl::ShaderType ShaderTypeVal;
+ gl::ShadingModel ShadingModelVal;
+ gl::TextureEnvParameter TextureEnvParameterVal;
+ gl::TextureEnvTarget TextureEnvTargetVal;
+ gl::TextureTarget TextureTargetVal;
+ gl::TextureType TextureTypeVal;
+ gl::VertexAttribType VertexAttribTypeVal;
+ const void *voidConstPointerVal;
+ const void *const *voidConstPointerPointerVal;
+ void *voidPointerVal;
+ void **voidPointerPointerVal;
+};
+
+template <ParamType PType, typename T>
+void SetParamVal(T valueIn, ParamValue *valueOut);
+
+template <>
+inline void SetParamVal<ParamType::TAlphaTestFunc>(gl::AlphaTestFunc valueIn, ParamValue *valueOut)
+{
+ valueOut->AlphaTestFuncVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TBufferBinding>(gl::BufferBinding valueIn, ParamValue *valueOut)
+{
+ valueOut->BufferBindingVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TBufferUsage>(gl::BufferUsage valueIn, ParamValue *valueOut)
+{
+ valueOut->BufferUsageVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TClientVertexArrayType>(gl::ClientVertexArrayType valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->ClientVertexArrayTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TCullFaceMode>(gl::CullFaceMode valueIn, ParamValue *valueOut)
+{
+ valueOut->CullFaceModeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TDrawElementsType>(gl::DrawElementsType valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->DrawElementsTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLDEBUGPROC>(GLDEBUGPROC valueIn, ParamValue *valueOut)
+{
+ valueOut->GLDEBUGPROCVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLDEBUGPROCKHR>(GLDEBUGPROCKHR valueIn, ParamValue *valueOut)
+{
+ valueOut->GLDEBUGPROCKHRVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLbitfield>(GLbitfield valueIn, ParamValue *valueOut)
+{
+ valueOut->GLbitfieldVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLboolean>(GLboolean valueIn, ParamValue *valueOut)
+{
+ valueOut->GLbooleanVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLbooleanConstPointer>(const GLboolean *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLbooleanConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLbooleanPointer>(GLboolean *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLbooleanPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLbyte>(GLbyte valueIn, ParamValue *valueOut)
+{
+ valueOut->GLbyteVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLbyteConstPointer>(const GLbyte *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLbyteConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLcharConstPointer>(const GLchar *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLcharConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLcharConstPointerPointer>(const GLchar *const *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLcharConstPointerPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLcharPointer>(GLchar *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLcharPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLclampx>(GLclampx valueIn, ParamValue *valueOut)
+{
+ valueOut->GLclampxVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLdouble>(GLdouble valueIn, ParamValue *valueOut)
+{
+ valueOut->GLdoubleVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLdoubleConstPointer>(const GLdouble *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLdoubleConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLdoublePointer>(GLdouble *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLdoublePointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLeglImageOES>(GLeglImageOES valueIn, ParamValue *valueOut)
+{
+ valueOut->GLeglImageOESVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLenum>(GLenum valueIn, ParamValue *valueOut)
+{
+ valueOut->GLenumVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLenumConstPointer>(const GLenum *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLenumConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLenumPointer>(GLenum *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLenumPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLfixed>(GLfixed valueIn, ParamValue *valueOut)
+{
+ valueOut->GLfixedVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLfixedConstPointer>(const GLfixed *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLfixedConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLfixedPointer>(GLfixed *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLfixedPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLfloat>(GLfloat valueIn, ParamValue *valueOut)
+{
+ valueOut->GLfloatVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLfloatConstPointer>(const GLfloat *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLfloatConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLfloatPointer>(GLfloat *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLfloatPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLint>(GLint valueIn, ParamValue *valueOut)
+{
+ valueOut->GLintVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLint64Pointer>(GLint64 *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLint64PointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLintConstPointer>(const GLint *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLintConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLintPointer>(GLint *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLintPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLintptr>(GLintptr valueIn, ParamValue *valueOut)
+{
+ valueOut->GLintptrVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLintptrConstPointer>(const GLintptr *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLintptrConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLshort>(GLshort valueIn, ParamValue *valueOut)
+{
+ valueOut->GLshortVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLshortConstPointer>(const GLshort *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLshortConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLsizei>(GLsizei valueIn, ParamValue *valueOut)
+{
+ valueOut->GLsizeiVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLsizeiConstPointer>(const GLsizei *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLsizeiConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLsizeiPointer>(GLsizei *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLsizeiPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLsizeiptr>(GLsizeiptr valueIn, ParamValue *valueOut)
+{
+ valueOut->GLsizeiptrVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLsizeiptrConstPointer>(const GLsizeiptr *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLsizeiptrConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLsync>(GLsync valueIn, ParamValue *valueOut)
+{
+ valueOut->GLsyncVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLubyte>(GLubyte valueIn, ParamValue *valueOut)
+{
+ valueOut->GLubyteVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLubyteConstPointer>(const GLubyte *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLubyteConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLubytePointer>(GLubyte *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLubytePointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLuint>(GLuint valueIn, ParamValue *valueOut)
+{
+ valueOut->GLuintVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLuint64>(GLuint64 valueIn, ParamValue *valueOut)
+{
+ valueOut->GLuint64Val = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLuint64ConstPointer>(const GLuint64 *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLuint64ConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLuint64Pointer>(GLuint64 *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLuint64PointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLuintConstPointer>(const GLuint *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLuintConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLuintPointer>(GLuint *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLuintPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLushort>(GLushort valueIn, ParamValue *valueOut)
+{
+ valueOut->GLushortVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLushortConstPointer>(const GLushort *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLushortConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLushortPointer>(GLushort *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLushortPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLvoidConstPointer>(const GLvoid *valueIn, ParamValue *valueOut)
+{
+ valueOut->GLvoidConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGLvoidConstPointerPointer>(const GLvoid *const *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GLvoidConstPointerPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TGraphicsResetStatus>(gl::GraphicsResetStatus valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->GraphicsResetStatusVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::THandleType>(gl::HandleType valueIn, ParamValue *valueOut)
+{
+ valueOut->HandleTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TLightParameter>(gl::LightParameter valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->LightParameterVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TLogicalOperation>(gl::LogicalOperation valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->LogicalOperationVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TMaterialParameter>(gl::MaterialParameter valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->MaterialParameterVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TMatrixType>(gl::MatrixType valueIn, ParamValue *valueOut)
+{
+ valueOut->MatrixTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TPointParameter>(gl::PointParameter valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->PointParameterVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TPrimitiveMode>(gl::PrimitiveMode valueIn, ParamValue *valueOut)
+{
+ valueOut->PrimitiveModeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TProvokingVertexConvention>(
+ gl::ProvokingVertexConvention valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->ProvokingVertexConventionVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TQueryType>(gl::QueryType valueIn, ParamValue *valueOut)
+{
+ valueOut->QueryTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TShaderType>(gl::ShaderType valueIn, ParamValue *valueOut)
+{
+ valueOut->ShaderTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TShadingModel>(gl::ShadingModel valueIn, ParamValue *valueOut)
+{
+ valueOut->ShadingModelVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TTextureEnvParameter>(gl::TextureEnvParameter valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->TextureEnvParameterVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TTextureEnvTarget>(gl::TextureEnvTarget valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->TextureEnvTargetVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TTextureTarget>(gl::TextureTarget valueIn, ParamValue *valueOut)
+{
+ valueOut->TextureTargetVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TTextureType>(gl::TextureType valueIn, ParamValue *valueOut)
+{
+ valueOut->TextureTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TVertexAttribType>(gl::VertexAttribType valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->VertexAttribTypeVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TvoidConstPointer>(const void *valueIn, ParamValue *valueOut)
+{
+ valueOut->voidConstPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TvoidConstPointerPointer>(const void *const *valueIn,
+ ParamValue *valueOut)
+{
+ valueOut->voidConstPointerPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TvoidPointer>(void *valueIn, ParamValue *valueOut)
+{
+ valueOut->voidPointerVal = valueIn;
+}
+
+template <>
+inline void SetParamVal<ParamType::TvoidPointerPointer>(void **valueIn, ParamValue *valueOut)
+{
+ valueOut->voidPointerPointerVal = valueIn;
+}
+
+template <ParamType PType, typename T>
+void SetParamVal(T valueIn, ParamValue *valueOut)
+{
+ UNREACHABLE();
+}
+
+template <typename T>
+void InitParamValue(ParamType paramType, T valueIn, ParamValue *valueOut)
+{
+ switch (paramType)
+ {
+ case ParamType::TAlphaTestFunc:
+ SetParamVal<ParamType::TAlphaTestFunc>(valueIn, valueOut);
+ break;
+ case ParamType::TBufferBinding:
+ SetParamVal<ParamType::TBufferBinding>(valueIn, valueOut);
+ break;
+ case ParamType::TBufferUsage:
+ SetParamVal<ParamType::TBufferUsage>(valueIn, valueOut);
+ break;
+ case ParamType::TClientVertexArrayType:
+ SetParamVal<ParamType::TClientVertexArrayType>(valueIn, valueOut);
+ break;
+ case ParamType::TCullFaceMode:
+ SetParamVal<ParamType::TCullFaceMode>(valueIn, valueOut);
+ break;
+ case ParamType::TDrawElementsType:
+ SetParamVal<ParamType::TDrawElementsType>(valueIn, valueOut);
+ break;
+ case ParamType::TGLDEBUGPROC:
+ SetParamVal<ParamType::TGLDEBUGPROC>(valueIn, valueOut);
+ break;
+ case ParamType::TGLDEBUGPROCKHR:
+ SetParamVal<ParamType::TGLDEBUGPROCKHR>(valueIn, valueOut);
+ break;
+ case ParamType::TGLbitfield:
+ SetParamVal<ParamType::TGLbitfield>(valueIn, valueOut);
+ break;
+ case ParamType::TGLboolean:
+ SetParamVal<ParamType::TGLboolean>(valueIn, valueOut);
+ break;
+ case ParamType::TGLbooleanConstPointer:
+ SetParamVal<ParamType::TGLbooleanConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLbooleanPointer:
+ SetParamVal<ParamType::TGLbooleanPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLbyte:
+ SetParamVal<ParamType::TGLbyte>(valueIn, valueOut);
+ break;
+ case ParamType::TGLbyteConstPointer:
+ SetParamVal<ParamType::TGLbyteConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLcharConstPointer:
+ SetParamVal<ParamType::TGLcharConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLcharConstPointerPointer:
+ SetParamVal<ParamType::TGLcharConstPointerPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLcharPointer:
+ SetParamVal<ParamType::TGLcharPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLclampx:
+ SetParamVal<ParamType::TGLclampx>(valueIn, valueOut);
+ break;
+ case ParamType::TGLdouble:
+ SetParamVal<ParamType::TGLdouble>(valueIn, valueOut);
+ break;
+ case ParamType::TGLdoubleConstPointer:
+ SetParamVal<ParamType::TGLdoubleConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLdoublePointer:
+ SetParamVal<ParamType::TGLdoublePointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLeglImageOES:
+ SetParamVal<ParamType::TGLeglImageOES>(valueIn, valueOut);
+ break;
+ case ParamType::TGLenum:
+ SetParamVal<ParamType::TGLenum>(valueIn, valueOut);
+ break;
+ case ParamType::TGLenumConstPointer:
+ SetParamVal<ParamType::TGLenumConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLenumPointer:
+ SetParamVal<ParamType::TGLenumPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLfixed:
+ SetParamVal<ParamType::TGLfixed>(valueIn, valueOut);
+ break;
+ case ParamType::TGLfixedConstPointer:
+ SetParamVal<ParamType::TGLfixedConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLfixedPointer:
+ SetParamVal<ParamType::TGLfixedPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLfloat:
+ SetParamVal<ParamType::TGLfloat>(valueIn, valueOut);
+ break;
+ case ParamType::TGLfloatConstPointer:
+ SetParamVal<ParamType::TGLfloatConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLfloatPointer:
+ SetParamVal<ParamType::TGLfloatPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLint:
+ SetParamVal<ParamType::TGLint>(valueIn, valueOut);
+ break;
+ case ParamType::TGLint64Pointer:
+ SetParamVal<ParamType::TGLint64Pointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLintConstPointer:
+ SetParamVal<ParamType::TGLintConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLintPointer:
+ SetParamVal<ParamType::TGLintPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLintptr:
+ SetParamVal<ParamType::TGLintptr>(valueIn, valueOut);
+ break;
+ case ParamType::TGLintptrConstPointer:
+ SetParamVal<ParamType::TGLintptrConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLshort:
+ SetParamVal<ParamType::TGLshort>(valueIn, valueOut);
+ break;
+ case ParamType::TGLshortConstPointer:
+ SetParamVal<ParamType::TGLshortConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLsizei:
+ SetParamVal<ParamType::TGLsizei>(valueIn, valueOut);
+ break;
+ case ParamType::TGLsizeiConstPointer:
+ SetParamVal<ParamType::TGLsizeiConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLsizeiPointer:
+ SetParamVal<ParamType::TGLsizeiPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLsizeiptr:
+ SetParamVal<ParamType::TGLsizeiptr>(valueIn, valueOut);
+ break;
+ case ParamType::TGLsizeiptrConstPointer:
+ SetParamVal<ParamType::TGLsizeiptrConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLsync:
+ SetParamVal<ParamType::TGLsync>(valueIn, valueOut);
+ break;
+ case ParamType::TGLubyte:
+ SetParamVal<ParamType::TGLubyte>(valueIn, valueOut);
+ break;
+ case ParamType::TGLubyteConstPointer:
+ SetParamVal<ParamType::TGLubyteConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLubytePointer:
+ SetParamVal<ParamType::TGLubytePointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLuint:
+ SetParamVal<ParamType::TGLuint>(valueIn, valueOut);
+ break;
+ case ParamType::TGLuint64:
+ SetParamVal<ParamType::TGLuint64>(valueIn, valueOut);
+ break;
+ case ParamType::TGLuint64ConstPointer:
+ SetParamVal<ParamType::TGLuint64ConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLuint64Pointer:
+ SetParamVal<ParamType::TGLuint64Pointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLuintConstPointer:
+ SetParamVal<ParamType::TGLuintConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLuintPointer:
+ SetParamVal<ParamType::TGLuintPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLushort:
+ SetParamVal<ParamType::TGLushort>(valueIn, valueOut);
+ break;
+ case ParamType::TGLushortConstPointer:
+ SetParamVal<ParamType::TGLushortConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLushortPointer:
+ SetParamVal<ParamType::TGLushortPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLvoidConstPointer:
+ SetParamVal<ParamType::TGLvoidConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGLvoidConstPointerPointer:
+ SetParamVal<ParamType::TGLvoidConstPointerPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TGraphicsResetStatus:
+ SetParamVal<ParamType::TGraphicsResetStatus>(valueIn, valueOut);
+ break;
+ case ParamType::THandleType:
+ SetParamVal<ParamType::THandleType>(valueIn, valueOut);
+ break;
+ case ParamType::TLightParameter:
+ SetParamVal<ParamType::TLightParameter>(valueIn, valueOut);
+ break;
+ case ParamType::TLogicalOperation:
+ SetParamVal<ParamType::TLogicalOperation>(valueIn, valueOut);
+ break;
+ case ParamType::TMaterialParameter:
+ SetParamVal<ParamType::TMaterialParameter>(valueIn, valueOut);
+ break;
+ case ParamType::TMatrixType:
+ SetParamVal<ParamType::TMatrixType>(valueIn, valueOut);
+ break;
+ case ParamType::TPointParameter:
+ SetParamVal<ParamType::TPointParameter>(valueIn, valueOut);
+ break;
+ case ParamType::TPrimitiveMode:
+ SetParamVal<ParamType::TPrimitiveMode>(valueIn, valueOut);
+ break;
+ case ParamType::TProvokingVertexConvention:
+ SetParamVal<ParamType::TProvokingVertexConvention>(valueIn, valueOut);
+ break;
+ case ParamType::TQueryType:
+ SetParamVal<ParamType::TQueryType>(valueIn, valueOut);
+ break;
+ case ParamType::TShaderType:
+ SetParamVal<ParamType::TShaderType>(valueIn, valueOut);
+ break;
+ case ParamType::TShadingModel:
+ SetParamVal<ParamType::TShadingModel>(valueIn, valueOut);
+ break;
+ case ParamType::TTextureEnvParameter:
+ SetParamVal<ParamType::TTextureEnvParameter>(valueIn, valueOut);
+ break;
+ case ParamType::TTextureEnvTarget:
+ SetParamVal<ParamType::TTextureEnvTarget>(valueIn, valueOut);
+ break;
+ case ParamType::TTextureTarget:
+ SetParamVal<ParamType::TTextureTarget>(valueIn, valueOut);
+ break;
+ case ParamType::TTextureType:
+ SetParamVal<ParamType::TTextureType>(valueIn, valueOut);
+ break;
+ case ParamType::TVertexAttribType:
+ SetParamVal<ParamType::TVertexAttribType>(valueIn, valueOut);
+ break;
+ case ParamType::TvoidConstPointer:
+ SetParamVal<ParamType::TvoidConstPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TvoidConstPointerPointer:
+ SetParamVal<ParamType::TvoidConstPointerPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TvoidPointer:
+ SetParamVal<ParamType::TvoidPointer>(valueIn, valueOut);
+ break;
+ case ParamType::TvoidPointerPointer:
+ SetParamVal<ParamType::TvoidPointerPointer>(valueIn, valueOut);
+ break;
+ }
+}
+
+void WriteParamTypeToStream(std::ostream &os, ParamType paramType, const ParamValue &paramValue);
+const char *ParamTypeToString(ParamType paramType);
+} // namespace angle
+
+#endif // LIBANGLE_FRAME_CAPTURE_UTILS_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/histogram_macros.h b/gfx/angle/checkout/src/libANGLE/histogram_macros.h
new file mode 100644
index 0000000000..d9718c2771
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/histogram_macros.h
@@ -0,0 +1,110 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// histogram_macros.h:
+// Helpers for making histograms, to keep consistency with Chromium's
+// histogram_macros.h.
+
+#ifndef LIBANGLE_HISTOGRAM_MACROS_H_
+#define LIBANGLE_HISTOGRAM_MACROS_H_
+
+#include <platform/Platform.h>
+
+#define ANGLE_HISTOGRAM_TIMES(name, sample) ANGLE_HISTOGRAM_CUSTOM_TIMES(name, sample, 1, 10000, 50)
+
+#define ANGLE_HISTOGRAM_MEDIUM_TIMES(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_TIMES(name, sample, 10, 180000, 50)
+
+// Use this macro when times can routinely be much longer than 10 seconds.
+#define ANGLE_HISTOGRAM_LONG_TIMES(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_TIMES(name, sample, 1, 3600000, 50)
+
+// Use this macro when times can routinely be much longer than 10 seconds and
+// you want 100 buckets.
+#define ANGLE_HISTOGRAM_LONG_TIMES_100(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_TIMES(name, sample, 1, 3600000, 100)
+
+// For folks that need real specific times, use this to select a precise range
+// of times you want plotted, and the number of buckets you want used.
+#define ANGLE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
+ ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count)
+
+#define ANGLE_HISTOGRAM_COUNTS(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000000, 50)
+
+#define ANGLE_HISTOGRAM_COUNTS_100(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 100, 50)
+
+#define ANGLE_HISTOGRAM_COUNTS_10000(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 10000, 50)
+
+#define ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
+ ANGLEPlatformCurrent()->histogramCustomCounts(ANGLEPlatformCurrent(), name, sample, min, max, \
+ bucket_count)
+
+#define ANGLE_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \
+ ANGLE_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
+
+#define ANGLE_HISTOGRAM_BOOLEAN(name, sample) \
+ ANGLEPlatformCurrent()->histogramBoolean(ANGLEPlatformCurrent(), name, sample)
+
+#define ANGLE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
+ ANGLEPlatformCurrent()->histogramEnumeration(ANGLEPlatformCurrent(), name, sample, \
+ boundary_value)
+
+#define ANGLE_HISTOGRAM_MEMORY_KB(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1000, 500000, 50)
+
+#define ANGLE_HISTOGRAM_MEMORY_MB(name, sample) \
+ ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000, 50)
+
+#define ANGLE_HISTOGRAM_SPARSE_SLOWLY(name, sample) \
+ ANGLEPlatformCurrent()->histogramSparse(ANGLEPlatformCurrent(), name, sample)
+
+// Scoped class which logs its time on this earth as a UMA statistic. This is
+// recommended for when you want a histogram which measures the time it takes
+// for a method to execute. This measures up to 10 seconds.
+#define SCOPED_ANGLE_HISTOGRAM_TIMER(name) \
+ SCOPED_ANGLE_HISTOGRAM_TIMER_EXPANDER(name, false, __COUNTER__)
+
+// Similar scoped histogram timer, but this uses ANGLE_HISTOGRAM_LONG_TIMES_100,
+// which measures up to an hour, and uses 100 buckets. This is more expensive
+// to store, so only use if this often takes >10 seconds.
+#define SCOPED_ANGLE_HISTOGRAM_LONG_TIMER(name) \
+ SCOPED_ANGLE_HISTOGRAM_TIMER_EXPANDER(name, true, __COUNTER__)
+
+// This nested macro is necessary to expand __COUNTER__ to an actual value.
+#define SCOPED_ANGLE_HISTOGRAM_TIMER_EXPANDER(name, is_long, key) \
+ SCOPED_ANGLE_HISTOGRAM_TIMER_UNIQUE(name, is_long, key)
+
+#define SCOPED_ANGLE_HISTOGRAM_TIMER_UNIQUE(name, is_long, key) \
+ class ScopedHistogramTimer##key \
+ { \
+ public: \
+ ScopedHistogramTimer##key() \
+ : constructed_(ANGLEPlatformCurrent()->currentTime(ANGLEPlatformCurrent())) \
+ {} \
+ ~ScopedHistogramTimer##key() \
+ { \
+ if (constructed_ == 0) \
+ return; \
+ auto *platform = ANGLEPlatformCurrent(); \
+ double elapsed = platform->currentTime(platform) - constructed_; \
+ int elapsedMS = static_cast<int>(elapsed * 1000.0); \
+ if (is_long) \
+ { \
+ ANGLE_HISTOGRAM_LONG_TIMES_100(name, elapsedMS); \
+ } \
+ else \
+ { \
+ ANGLE_HISTOGRAM_TIMES(name, elapsedMS); \
+ } \
+ } \
+ \
+ private: \
+ double constructed_; \
+ } scoped_histogram_timer_##key
+
+#endif // LIBANGLE_HISTOGRAM_MACROS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/queryconversions.cpp b/gfx/angle/checkout/src/libANGLE/queryconversions.cpp
new file mode 100644
index 0000000000..0deae8a0bf
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/queryconversions.cpp
@@ -0,0 +1,300 @@
+//
+// 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 "libANGLE/queryconversions.h"
+
+#include <vector>
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+
+namespace gl
+{
+
+namespace
+{
+
+GLint64 ExpandFloatToInteger(GLfloat value)
+{
+ return static_cast<GLint64>((static_cast<double>(0xFFFFFFFFULL) * value - 1.0) / 2.0);
+}
+
+template <typename QueryT, typename NativeT>
+QueryT CastFromStateValueToInt(GLenum pname, NativeT value)
+{
+ GLenum nativeType = GLTypeToGLenum<NativeT>::value;
+
+ if (nativeType == GL_FLOAT)
+ {
+ // RGBA color values and DepthRangeF values are converted to integer using Equation 2.4 from
+ // Table 4.5
+ switch (pname)
+ {
+ case GL_DEPTH_RANGE:
+ case GL_COLOR_CLEAR_VALUE:
+ case GL_DEPTH_CLEAR_VALUE:
+ case GL_BLEND_COLOR:
+ // GLES1 emulation:
+ // Also, several GLES1.x values need to be converted to integer with
+ // ExpandFloatToInteger rather than rounding. See GLES 1.1 spec 6.1.2 "Data
+ // Conversions".
+ case GL_ALPHA_TEST_REF:
+ case GL_CURRENT_COLOR:
+ return clampCast<QueryT>(ExpandFloatToInteger(static_cast<GLfloat>(value)));
+ default:
+ return clampCast<QueryT>(std::round(value));
+ }
+ }
+
+ return clampCast<QueryT>(value);
+}
+
+template <typename NativeT, typename QueryT>
+NativeT CastQueryValueToInt(GLenum pname, QueryT value)
+{
+ GLenum queryType = GLTypeToGLenum<QueryT>::value;
+
+ if (queryType == GL_FLOAT)
+ {
+ return static_cast<NativeT>(std::round(value));
+ }
+
+ return static_cast<NativeT>(value);
+}
+
+} // anonymous namespace
+
+GLint CastMaskValue(GLuint value)
+{
+ return clampCast<GLint>(value);
+}
+
+template <typename QueryT, typename InternalT>
+QueryT CastFromGLintStateValue(GLenum pname, InternalT value)
+{
+ return CastFromStateValue<QueryT, GLint>(pname, clampCast<GLint, InternalT>(value));
+}
+
+template GLfloat CastFromGLintStateValue<GLfloat, GLenum>(GLenum pname, GLenum value);
+template GLint CastFromGLintStateValue<GLint, GLenum>(GLenum pname, GLenum value);
+template GLint64 CastFromGLintStateValue<GLint64, GLenum>(GLenum pname, GLenum value);
+template GLuint CastFromGLintStateValue<GLuint, GLenum>(GLenum pname, GLenum value);
+template GLuint CastFromGLintStateValue<GLuint, GLint>(GLenum pname, GLint value);
+template GLfloat CastFromGLintStateValue<GLfloat, GLint>(GLenum pname, GLint value);
+template GLint CastFromGLintStateValue<GLint, GLint>(GLenum pname, GLint value);
+template GLfloat CastFromGLintStateValue<GLfloat, bool>(GLenum pname, bool value);
+template GLuint CastFromGLintStateValue<GLuint, bool>(GLenum pname, bool value);
+template GLint CastFromGLintStateValue<GLint, bool>(GLenum pname, bool value);
+
+template <typename QueryT, typename NativeT>
+QueryT CastFromStateValue(GLenum pname, NativeT value)
+{
+ GLenum queryType = GLTypeToGLenum<QueryT>::value;
+
+ switch (queryType)
+ {
+ case GL_INT:
+ case GL_INT_64_ANGLEX:
+ case GL_UNSIGNED_INT:
+ case GL_UINT_64_ANGLEX:
+ return CastFromStateValueToInt<QueryT, NativeT>(pname, value);
+ case GL_FLOAT:
+ return static_cast<QueryT>(value);
+ case GL_BOOL:
+ return static_cast<QueryT>(value == static_cast<NativeT>(0) ? GL_FALSE : GL_TRUE);
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+template GLint CastFromStateValue<GLint, GLint>(GLenum pname, GLint value);
+template GLint CastFromStateValue<GLint, GLint64>(GLenum pname, GLint64 value);
+template GLint64 CastFromStateValue<GLint64, GLint>(GLenum pname, GLint value);
+template GLint64 CastFromStateValue<GLint64, GLint64>(GLenum pname, GLint64 value);
+template GLfloat CastFromStateValue<GLfloat, GLint>(GLenum pname, GLint value);
+template GLfloat CastFromStateValue<GLfloat, GLuint>(GLenum pname, GLuint value);
+template GLfloat CastFromStateValue<GLfloat, GLfloat>(GLenum pname, GLfloat value);
+template GLint CastFromStateValue<GLint, GLfloat>(GLenum pname, GLfloat value);
+template GLuint CastFromStateValue<GLuint, GLfloat>(GLenum pname, GLfloat value);
+template GLuint CastFromStateValue<GLuint, GLint>(GLenum pname, GLint value);
+template GLuint CastFromStateValue<GLuint, GLuint>(GLenum pname, GLuint value);
+template GLint CastFromStateValue<GLint, GLboolean>(GLenum pname, GLboolean value);
+template GLint64 CastFromStateValue<GLint64, GLboolean>(GLenum pname, GLboolean value);
+template GLint CastFromStateValue<GLint, GLuint>(GLenum pname, GLuint value);
+template GLint64 CastFromStateValue<GLint64, GLuint>(GLenum pname, GLuint value);
+template GLuint64 CastFromStateValue<GLuint64, GLuint>(GLenum pname, GLuint value);
+
+template <typename NativeT, typename QueryT>
+NativeT CastQueryValueTo(GLenum pname, QueryT value)
+{
+ GLenum nativeType = GLTypeToGLenum<NativeT>::value;
+
+ switch (nativeType)
+ {
+ case GL_INT:
+ case GL_INT_64_ANGLEX:
+ case GL_UNSIGNED_INT:
+ case GL_UINT_64_ANGLEX:
+ return CastQueryValueToInt<NativeT, QueryT>(pname, value);
+ case GL_FLOAT:
+ return static_cast<NativeT>(value);
+ case GL_BOOL:
+ return static_cast<NativeT>(value == static_cast<QueryT>(0) ? GL_FALSE : GL_TRUE);
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+template GLint CastQueryValueTo<GLint, GLfloat>(GLenum pname, GLfloat value);
+template GLboolean CastQueryValueTo<GLboolean, GLint>(GLenum pname, GLint value);
+template GLint CastQueryValueTo<GLint, GLint>(GLenum pname, GLint value);
+template GLint CastQueryValueTo<GLint, GLuint>(GLenum pname, GLuint value);
+template GLfloat CastQueryValueTo<GLfloat, GLint>(GLenum pname, GLint value);
+template GLfloat CastQueryValueTo<GLfloat, GLuint>(GLenum pname, GLuint value);
+template GLfloat CastQueryValueTo<GLfloat, GLfloat>(GLenum pname, GLfloat value);
+template GLuint CastQueryValueTo<GLuint, GLint>(GLenum pname, GLint value);
+template GLuint CastQueryValueTo<GLuint, GLuint>(GLenum pname, GLuint value);
+template GLuint CastQueryValueTo<GLuint, GLfloat>(GLenum pname, GLfloat value);
+
+template <typename QueryT>
+void CastStateValues(Context *context,
+ GLenum nativeType,
+ GLenum pname,
+ unsigned int numParams,
+ QueryT *outParams)
+{
+ if (nativeType == GL_INT)
+ {
+ std::vector<GLint> intParams(numParams, 0);
+ context->getIntegervImpl(pname, intParams.data());
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastFromStateValue<QueryT>(pname, intParams[i]);
+ }
+ }
+ else if (nativeType == GL_BOOL)
+ {
+ std::vector<GLboolean> boolParams(numParams, GL_FALSE);
+ context->getBooleanvImpl(pname, boolParams.data());
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] =
+ (boolParams[i] == GL_FALSE ? static_cast<QueryT>(0) : static_cast<QueryT>(1));
+ }
+ }
+ else if (nativeType == GL_FLOAT)
+ {
+ std::vector<GLfloat> floatParams(numParams, 0.0f);
+ context->getFloatvImpl(pname, floatParams.data());
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastFromStateValue<QueryT>(pname, floatParams[i]);
+ }
+ }
+ else if (nativeType == GL_INT_64_ANGLEX)
+ {
+ std::vector<GLint64> int64Params(numParams, 0);
+ context->getInteger64v(pname, int64Params.data());
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastFromStateValue<QueryT>(pname, int64Params[i]);
+ }
+ }
+ 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, uint64
+
+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 *);
+
+template <typename QueryT>
+void CastIndexedStateValues(Context *context,
+ GLenum nativeType,
+ GLenum pname,
+ GLuint index,
+ unsigned int numParams,
+ QueryT *outParams)
+{
+ if (nativeType == GL_INT)
+ {
+ std::vector<GLint> intParams(numParams, 0);
+ context->getIntegeri_v(pname, index, intParams.data());
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastFromStateValue<QueryT>(pname, intParams[i]);
+ }
+ }
+ else if (nativeType == GL_BOOL)
+ {
+ std::vector<GLboolean> boolParams(numParams, GL_FALSE);
+ context->getBooleani_v(pname, index, boolParams.data());
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] =
+ (boolParams[i] == GL_FALSE ? static_cast<QueryT>(0) : static_cast<QueryT>(1));
+ }
+ }
+ else if (nativeType == GL_INT_64_ANGLEX)
+ {
+ std::vector<GLint64> int64Params(numParams, 0);
+ context->getInteger64i_v(pname, index, int64Params.data());
+
+ for (unsigned int i = 0; i < numParams; ++i)
+ {
+ outParams[i] = CastFromStateValue<QueryT>(pname, int64Params[i]);
+ }
+ }
+ else
+ UNREACHABLE();
+}
+
+template void CastIndexedStateValues<GLboolean>(Context *,
+ GLenum,
+ GLenum,
+ GLuint index,
+ unsigned int,
+ GLboolean *);
+template void CastIndexedStateValues<GLint>(Context *,
+ GLenum,
+ GLenum,
+ GLuint index,
+ unsigned int,
+ GLint *);
+template void CastIndexedStateValues<GLuint>(Context *,
+ GLenum,
+ GLenum,
+ GLuint index,
+ unsigned int,
+ GLuint *);
+template void CastIndexedStateValues<GLfloat>(Context *,
+ GLenum,
+ GLenum,
+ GLuint index,
+ unsigned int,
+ GLfloat *);
+template void CastIndexedStateValues<GLint64>(Context *,
+ GLenum,
+ GLenum,
+ GLuint index,
+ unsigned int,
+ GLint64 *);
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/queryconversions.h b/gfx/angle/checkout/src/libANGLE/queryconversions.h
new file mode 100644
index 0000000000..efb2ffd568
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/queryconversions.h
@@ -0,0 +1,138 @@
+//
+// 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
+
+#ifndef LIBANGLE_QUERY_CONVERSIONS_H_
+#define LIBANGLE_QUERY_CONVERSIONS_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+
+namespace gl
+{
+class Context;
+
+// 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 CastFromStateValue and CastQueryValueTo, where it eliminates
+// duplicate parameters.
+
+template <typename GLType>
+struct GLTypeToGLenum
+{
+ // static constexpr GLenum value;
+};
+
+template <>
+struct GLTypeToGLenum<GLint>
+{
+ static constexpr GLenum value = GL_INT;
+};
+template <>
+struct GLTypeToGLenum<GLuint>
+{
+ static constexpr GLenum value = GL_UNSIGNED_INT;
+};
+template <>
+struct GLTypeToGLenum<GLboolean>
+{
+ static constexpr GLenum value = GL_BOOL;
+};
+template <>
+struct GLTypeToGLenum<GLint64>
+{
+ static constexpr GLenum value = GL_INT_64_ANGLEX;
+};
+template <>
+struct GLTypeToGLenum<GLuint64>
+{
+ static constexpr GLenum value = GL_UINT_64_ANGLEX;
+};
+template <>
+struct GLTypeToGLenum<GLfloat>
+{
+ static constexpr GLenum value = GL_FLOAT;
+};
+
+GLint CastMaskValue(GLuint value);
+
+template <typename QueryT, typename InternalT>
+QueryT CastFromGLintStateValue(GLenum pname, InternalT value);
+
+template <typename QueryT, typename NativeT>
+QueryT CastFromStateValue(GLenum pname, NativeT value);
+
+template <typename NativeT, typename QueryT>
+NativeT CastQueryValueTo(GLenum pname, QueryT value);
+
+template <typename ParamType>
+GLenum ConvertToGLenum(GLenum pname, ParamType param)
+{
+ return static_cast<GLenum>(CastQueryValueTo<GLuint>(pname, param));
+}
+
+template <typename ParamType>
+GLenum ConvertToGLenum(ParamType param)
+{
+ return ConvertToGLenum(GL_NONE, param);
+}
+
+template <typename OutType>
+OutType ConvertGLenum(GLenum param)
+{
+ return static_cast<OutType>(param);
+}
+
+template <typename InType, typename OutType>
+void ConvertGLenumValue(InType param, OutType *out)
+{
+ *out = ConvertGLenum<OutType>(static_cast<GLenum>(param));
+}
+
+template <typename PackedEnumType, typename OutType>
+void ConvertPackedEnum(PackedEnumType param, OutType *out)
+{
+ *out = static_cast<OutType>(ToGLenum(param));
+}
+
+template <typename ParamType>
+GLint ConvertToGLint(ParamType param)
+{
+ return CastQueryValueTo<GLint>(GL_NONE, param);
+}
+
+template <typename ParamType>
+bool ConvertToBool(ParamType param)
+{
+ return param != GL_FALSE;
+}
+
+template <typename ParamType>
+GLboolean ConvertToGLBoolean(ParamType param)
+{
+ return param ? GL_TRUE : GL_FALSE;
+}
+
+// The GL state query API types are: bool, int, uint, float, int64, uint64
+template <typename QueryT>
+void CastStateValues(Context *context,
+ GLenum nativeType,
+ GLenum pname,
+ unsigned int numParams,
+ QueryT *outParams);
+
+// The GL state query API types are: bool, int, uint, float, int64, uint64
+template <typename QueryT>
+void CastIndexedStateValues(Context *context,
+ GLenum nativeType,
+ GLenum pname,
+ GLuint index,
+ unsigned int numParams,
+ QueryT *outParams);
+} // namespace gl
+
+#endif // LIBANGLE_QUERY_CONVERSIONS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/queryutils.cpp b/gfx/angle/checkout/src/libANGLE/queryutils.cpp
new file mode 100644
index 0000000000..89747fb53b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/queryutils.cpp
@@ -0,0 +1,3070 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// queryutils.cpp: Utilities for querying values from GL objects
+
+#include "libANGLE/queryutils.h"
+
+#include "common/utilities.h"
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/EGLSync.h"
+#include "libANGLE/Fence.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/GLES1State.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Sampler.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/Uniform.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/queryconversions.h"
+
+namespace gl
+{
+
+namespace
+{
+
+template <bool isPureInteger>
+ColorGeneric ConvertToColor(const GLfloat *params)
+{
+ if (isPureInteger)
+ {
+ UNREACHABLE();
+ return ColorGeneric(ColorI());
+ }
+ else
+ {
+ return ColorGeneric(ColorF::fromData(params));
+ }
+}
+
+template <bool isPureInteger>
+ColorGeneric ConvertToColor(const GLint *params)
+{
+ if (isPureInteger)
+ {
+ return ColorGeneric(ColorI(params[0], params[1], params[2], params[3]));
+ }
+ else
+ {
+ return ColorGeneric(ColorF(normalizedToFloat(params[0]), normalizedToFloat(params[1]),
+ normalizedToFloat(params[2]), normalizedToFloat(params[3])));
+ }
+}
+
+template <bool isPureInteger>
+ColorGeneric ConvertToColor(const GLuint *params)
+{
+ if (isPureInteger)
+ {
+ return ColorGeneric(ColorUI(params[0], params[1], params[2], params[3]));
+ }
+ else
+ {
+ UNREACHABLE();
+ return ColorGeneric(ColorF());
+ }
+}
+
+template <bool isPureInteger>
+void ConvertFromColor(const ColorGeneric &color, GLfloat *outParams)
+{
+ if (isPureInteger)
+ {
+ UNREACHABLE();
+ }
+ else
+ {
+ ASSERT(color.type == ColorGeneric::Type::Float);
+ color.colorF.writeData(outParams);
+ }
+}
+
+template <bool isPureInteger>
+void ConvertFromColor(const ColorGeneric &color, GLint *outParams)
+{
+ if (isPureInteger)
+ {
+ ASSERT(color.type == ColorGeneric::Type::Int);
+ outParams[0] = color.colorI.red;
+ outParams[1] = color.colorI.green;
+ outParams[2] = color.colorI.blue;
+ outParams[3] = color.colorI.alpha;
+ }
+ else
+ {
+ ASSERT(color.type == ColorGeneric::Type::Float);
+ outParams[0] = floatToNormalized<GLint>(color.colorF.red);
+ outParams[1] = floatToNormalized<GLint>(color.colorF.green);
+ outParams[2] = floatToNormalized<GLint>(color.colorF.blue);
+ outParams[3] = floatToNormalized<GLint>(color.colorF.alpha);
+ }
+}
+
+template <bool isPureInteger>
+void ConvertFromColor(const ColorGeneric &color, GLuint *outParams)
+{
+ if (isPureInteger)
+ {
+ ASSERT(color.type == ColorGeneric::Type::UInt);
+ outParams[0] = color.colorUI.red;
+ outParams[1] = color.colorUI.green;
+ outParams[2] = color.colorUI.blue;
+ outParams[3] = color.colorUI.alpha;
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+}
+
+template <typename ParamType>
+void QueryTexLevelParameterBase(const Texture *texture,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ ParamType *params)
+{
+ ASSERT(texture != nullptr);
+ const InternalFormat *info = texture->getTextureState().getImageDesc(target, level).format.info;
+
+ switch (pname)
+ {
+ case GL_TEXTURE_RED_TYPE:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, info->redBits ? info->componentType : GL_NONE);
+ break;
+ case GL_TEXTURE_GREEN_TYPE:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, info->greenBits ? info->componentType : GL_NONE);
+ break;
+ case GL_TEXTURE_BLUE_TYPE:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, info->blueBits ? info->componentType : GL_NONE);
+ break;
+ case GL_TEXTURE_ALPHA_TYPE:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, info->alphaBits ? info->componentType : GL_NONE);
+ break;
+ case GL_TEXTURE_DEPTH_TYPE:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, info->depthBits ? info->componentType : GL_NONE);
+ break;
+ case GL_TEXTURE_RED_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, info->redBits);
+ break;
+ case GL_TEXTURE_GREEN_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, info->greenBits);
+ break;
+ case GL_TEXTURE_BLUE_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, info->blueBits);
+ break;
+ case GL_TEXTURE_ALPHA_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, info->alphaBits);
+ break;
+ case GL_TEXTURE_DEPTH_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, info->depthBits);
+ break;
+ case GL_TEXTURE_STENCIL_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, info->stencilBits);
+ break;
+ case GL_TEXTURE_SHARED_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, info->sharedBits);
+ break;
+ case GL_TEXTURE_INTERNAL_FORMAT:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, info->internalFormat ? info->internalFormat : GL_RGBA);
+ break;
+ case GL_TEXTURE_WIDTH:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, static_cast<uint32_t>(texture->getWidth(target, level)));
+ break;
+ case GL_TEXTURE_HEIGHT:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, static_cast<uint32_t>(texture->getHeight(target, level)));
+ break;
+ case GL_TEXTURE_DEPTH:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, static_cast<uint32_t>(texture->getDepth(target, level)));
+ break;
+ case GL_TEXTURE_SAMPLES:
+ *params = CastFromStateValue<ParamType>(pname, texture->getSamples(target, level));
+ break;
+ case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
+ *params = CastFromStateValue<ParamType>(
+ pname, static_cast<GLint>(texture->getFixedSampleLocations(target, level)));
+ break;
+ case GL_TEXTURE_COMPRESSED:
+ *params = CastFromStateValue<ParamType>(pname, static_cast<GLint>(info->compressed));
+ break;
+ case GL_MEMORY_SIZE_ANGLE:
+ *params =
+ CastFromStateValue<ParamType>(pname, texture->getLevelMemorySize(target, level));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+template <bool isPureInteger, typename ParamType>
+void QueryTexParameterBase(const Texture *texture, GLenum pname, ParamType *params)
+{
+ ASSERT(texture != nullptr);
+
+ switch (pname)
+ {
+ case GL_TEXTURE_MAG_FILTER:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getMagFilter());
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getMinFilter());
+ break;
+ case GL_TEXTURE_WRAP_S:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getWrapS());
+ break;
+ case GL_TEXTURE_WRAP_T:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getWrapT());
+ break;
+ case GL_TEXTURE_WRAP_R:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getWrapR());
+ break;
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getImmutableFormat());
+ break;
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getImmutableLevels());
+ break;
+ case GL_TEXTURE_USAGE_ANGLE:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getUsage());
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ *params = CastFromStateValue<ParamType>(pname, texture->getMaxAnisotropy());
+ break;
+ case GL_TEXTURE_SWIZZLE_R:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getSwizzleRed());
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getSwizzleGreen());
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getSwizzleBlue());
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getSwizzleAlpha());
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getBaseLevel());
+ break;
+ case GL_TEXTURE_MAX_LEVEL:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getMaxLevel());
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ *params = CastFromStateValue<ParamType>(pname, texture->getMinLod());
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ *params = CastFromStateValue<ParamType>(pname, texture->getMaxLod());
+ break;
+ case GL_TEXTURE_COMPARE_MODE:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getCompareMode());
+ break;
+ case GL_TEXTURE_COMPARE_FUNC:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getCompareFunc());
+ break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getSRGBDecode());
+ break;
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ *params =
+ CastFromGLintStateValue<ParamType>(pname, texture->getDepthStencilTextureMode());
+ break;
+ case GL_TEXTURE_CROP_RECT_OES:
+ {
+ const gl::Rectangle &crop = texture->getCrop();
+ params[0] = CastFromGLintStateValue<ParamType>(pname, crop.x);
+ params[1] = CastFromGLintStateValue<ParamType>(pname, crop.y);
+ params[2] = CastFromGLintStateValue<ParamType>(pname, crop.width);
+ params[3] = CastFromGLintStateValue<ParamType>(pname, crop.height);
+ break;
+ }
+ case GL_GENERATE_MIPMAP:
+ *params = CastFromGLintStateValue<ParamType>(pname, texture->getGenerateMipmapHint());
+ break;
+ case GL_MEMORY_SIZE_ANGLE:
+ *params = CastFromStateValue<ParamType>(pname, texture->getMemorySize());
+ break;
+ case GL_TEXTURE_BORDER_COLOR:
+ ConvertFromColor<isPureInteger>(texture->getBorderColor(), params);
+ break;
+ case GL_TEXTURE_NATIVE_ID_ANGLE:
+ *params = CastFromStateValue<ParamType>(pname, texture->getNativeID());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+template <bool isPureInteger, typename ParamType>
+void SetTexParameterBase(Context *context, Texture *texture, GLenum pname, const ParamType *params)
+{
+ ASSERT(texture != nullptr);
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S:
+ texture->setWrapS(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_WRAP_T:
+ texture->setWrapT(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_WRAP_R:
+ texture->setWrapR(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ texture->setMinFilter(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ texture->setMagFilter(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_USAGE_ANGLE:
+ texture->setUsage(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ texture->setMaxAnisotropy(context, CastQueryValueTo<GLfloat>(pname, params[0]));
+ break;
+ case GL_TEXTURE_COMPARE_MODE:
+ texture->setCompareMode(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_COMPARE_FUNC:
+ texture->setCompareFunc(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_SWIZZLE_R:
+ texture->setSwizzleRed(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_SWIZZLE_G:
+ texture->setSwizzleGreen(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_SWIZZLE_B:
+ texture->setSwizzleBlue(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_SWIZZLE_A:
+ texture->setSwizzleAlpha(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_BASE_LEVEL:
+ {
+ (void)(texture->setBaseLevel(
+ context, clampCast<GLuint>(CastQueryValueTo<GLint>(pname, params[0]))));
+ break;
+ }
+ case GL_TEXTURE_MAX_LEVEL:
+ texture->setMaxLevel(context,
+ clampCast<GLuint>(CastQueryValueTo<GLint>(pname, params[0])));
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ texture->setMinLod(context, CastQueryValueTo<GLfloat>(pname, params[0]));
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ texture->setMaxLod(context, CastQueryValueTo<GLfloat>(pname, params[0]));
+ break;
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ texture->setDepthStencilTextureMode(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ texture->setSRGBDecode(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_CROP_RECT_OES:
+ texture->setCrop(gl::Rectangle(CastQueryValueTo<GLint>(pname, params[0]),
+ CastQueryValueTo<GLint>(pname, params[1]),
+ CastQueryValueTo<GLint>(pname, params[2]),
+ CastQueryValueTo<GLint>(pname, params[3])));
+ break;
+ case GL_GENERATE_MIPMAP:
+ texture->setGenerateMipmapHint(ConvertToGLenum(params[0]));
+ break;
+ case GL_TEXTURE_BORDER_COLOR:
+ texture->setBorderColor(context, ConvertToColor<isPureInteger>(params));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+template <bool isPureInteger, typename ParamType>
+void QuerySamplerParameterBase(const Sampler *sampler, GLenum pname, ParamType *params)
+{
+ switch (pname)
+ {
+ case GL_TEXTURE_MIN_FILTER:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getMinFilter());
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getMagFilter());
+ break;
+ case GL_TEXTURE_WRAP_S:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getWrapS());
+ break;
+ case GL_TEXTURE_WRAP_T:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getWrapT());
+ break;
+ case GL_TEXTURE_WRAP_R:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getWrapR());
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ *params = CastFromStateValue<ParamType>(pname, sampler->getMaxAnisotropy());
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ *params = CastFromStateValue<ParamType>(pname, sampler->getMinLod());
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ *params = CastFromStateValue<ParamType>(pname, sampler->getMaxLod());
+ break;
+ case GL_TEXTURE_COMPARE_MODE:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getCompareMode());
+ break;
+ case GL_TEXTURE_COMPARE_FUNC:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getCompareFunc());
+ break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ *params = CastFromGLintStateValue<ParamType>(pname, sampler->getSRGBDecode());
+ break;
+ case GL_TEXTURE_BORDER_COLOR:
+ ConvertFromColor<isPureInteger>(sampler->getBorderColor(), params);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+template <bool isPureInteger, typename ParamType>
+void SetSamplerParameterBase(Context *context,
+ Sampler *sampler,
+ GLenum pname,
+ const ParamType *params)
+{
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S:
+ sampler->setWrapS(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_WRAP_T:
+ sampler->setWrapT(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_WRAP_R:
+ sampler->setWrapR(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_MIN_FILTER:
+ sampler->setMinFilter(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ sampler->setMagFilter(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ sampler->setMaxAnisotropy(context, CastQueryValueTo<GLfloat>(pname, params[0]));
+ break;
+ case GL_TEXTURE_COMPARE_MODE:
+ sampler->setCompareMode(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_COMPARE_FUNC:
+ sampler->setCompareFunc(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_MIN_LOD:
+ sampler->setMinLod(context, CastQueryValueTo<GLfloat>(pname, params[0]));
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ sampler->setMaxLod(context, CastQueryValueTo<GLfloat>(pname, params[0]));
+ break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ sampler->setSRGBDecode(context, ConvertToGLenum(pname, params[0]));
+ break;
+ case GL_TEXTURE_BORDER_COLOR:
+ sampler->setBorderColor(context, ConvertToColor<isPureInteger>(params));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ sampler->onStateChange(angle::SubjectMessage::ContentsChanged);
+}
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+template <typename ParamType, typename CurrentDataType, size_t CurrentValueCount>
+void QueryVertexAttribBase(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const CurrentDataType (&currentValueData)[CurrentValueCount],
+ GLenum pname,
+ ParamType *params)
+{
+ switch (pname)
+ {
+ case GL_CURRENT_VERTEX_ATTRIB:
+ for (size_t i = 0; i < CurrentValueCount; ++i)
+ {
+ params[i] = CastFromStateValue<ParamType>(pname, currentValueData[i]);
+ }
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ *params = CastFromStateValue<ParamType>(pname, static_cast<GLint>(attrib.enabled));
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ *params = CastFromGLintStateValue<ParamType>(pname, attrib.format->channelCount);
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ *params = CastFromGLintStateValue<ParamType>(pname, attrib.vertexAttribArrayStride);
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ *params = CastFromGLintStateValue<ParamType>(
+ pname, gl::ToGLenum(attrib.format->vertexAttribType));
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ *params =
+ CastFromStateValue<ParamType>(pname, static_cast<GLint>(attrib.format->isNorm()));
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ *params = CastFromGLintStateValue<ParamType>(pname, binding.getBuffer().id());
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+ *params = CastFromStateValue<ParamType>(pname, binding.getDivisor());
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ *params = CastFromGLintStateValue<ParamType>(pname, attrib.format->isPureInt());
+ break;
+ case GL_VERTEX_ATTRIB_BINDING:
+ *params = CastFromGLintStateValue<ParamType>(pname, attrib.bindingIndex);
+ break;
+ case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
+ *params = CastFromGLintStateValue<ParamType>(pname, attrib.relativeOffset);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+template <typename ParamType>
+void QueryBufferParameterBase(const Buffer *buffer, GLenum pname, ParamType *params)
+{
+ ASSERT(buffer != nullptr);
+
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ *params = CastFromGLintStateValue<ParamType>(pname, ToGLenum(buffer->getUsage()));
+ break;
+ case GL_BUFFER_SIZE:
+ *params = CastFromStateValue<ParamType>(pname, buffer->getSize());
+ break;
+ case GL_BUFFER_ACCESS_FLAGS:
+ *params = CastFromGLintStateValue<ParamType>(pname, buffer->getAccessFlags());
+ break;
+ case GL_BUFFER_ACCESS_OES:
+ *params = CastFromGLintStateValue<ParamType>(pname, buffer->getAccess());
+ break;
+ case GL_BUFFER_MAPPED:
+ *params = CastFromStateValue<ParamType>(pname, buffer->isMapped());
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *params = CastFromStateValue<ParamType>(pname, buffer->getMapOffset());
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *params = CastFromStateValue<ParamType>(pname, buffer->getMapLength());
+ break;
+ case GL_MEMORY_SIZE_ANGLE:
+ *params = CastFromStateValue<ParamType>(pname, buffer->getMemorySize());
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+GLint GetCommonVariableProperty(const sh::ShaderVariable &var, GLenum prop)
+{
+ switch (prop)
+ {
+ case GL_TYPE:
+ return clampCast<GLint>(var.type);
+
+ case GL_ARRAY_SIZE:
+ // Queryable variables are guaranteed not to be arrays of arrays or arrays of structs,
+ // see GLES 3.1 spec section 7.3.1.1 page 77.
+ return clampCast<GLint>(var.getBasicTypeElementCount());
+
+ case GL_NAME_LENGTH:
+ // ES31 spec p84: This counts the terminating null char.
+ return clampCast<GLint>(var.name.size() + 1u);
+
+ default:
+ UNREACHABLE();
+ return GL_INVALID_VALUE;
+ }
+}
+
+GLint GetInputResourceProperty(const Program *program, GLuint index, GLenum prop)
+{
+ const auto &attribute = program->getInputResource(index);
+ switch (prop)
+ {
+ case GL_TYPE:
+ case GL_ARRAY_SIZE:
+ case GL_NAME_LENGTH:
+ return GetCommonVariableProperty(attribute, prop);
+
+ case GL_LOCATION:
+ return program->getAttributeLocation(attribute.name);
+
+ case GL_REFERENCED_BY_VERTEX_SHADER:
+ return 1;
+
+ case GL_REFERENCED_BY_FRAGMENT_SHADER:
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return GL_INVALID_VALUE;
+ }
+}
+
+GLint GetOutputResourceProperty(const Program *program, GLuint index, const GLenum prop)
+{
+ const auto &outputVariable = program->getOutputResource(index);
+ switch (prop)
+ {
+ case GL_TYPE:
+ case GL_ARRAY_SIZE:
+ case GL_NAME_LENGTH:
+ return GetCommonVariableProperty(outputVariable, prop);
+
+ case GL_LOCATION:
+ return program->getFragDataLocation(outputVariable.name);
+
+ case GL_LOCATION_INDEX_EXT:
+ // EXT_blend_func_extended
+ return program->getFragDataIndex(outputVariable.name);
+
+ case GL_REFERENCED_BY_FRAGMENT_SHADER:
+ return 1;
+
+ case GL_REFERENCED_BY_VERTEX_SHADER:
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return GL_INVALID_VALUE;
+ }
+}
+
+GLint GetTransformFeedbackVaryingResourceProperty(const Program *program,
+ GLuint index,
+ const GLenum prop)
+{
+ const auto &tfVariable = program->getTransformFeedbackVaryingResource(index);
+ switch (prop)
+ {
+ case GL_TYPE:
+ return clampCast<GLint>(tfVariable.type);
+
+ case GL_ARRAY_SIZE:
+ return clampCast<GLint>(tfVariable.size());
+
+ case GL_NAME_LENGTH:
+ return clampCast<GLint>(tfVariable.nameWithArrayIndex().size() + 1);
+
+ default:
+ UNREACHABLE();
+ return GL_INVALID_VALUE;
+ }
+}
+
+GLint QueryProgramInterfaceActiveResources(const Program *program, GLenum programInterface)
+{
+ switch (programInterface)
+ {
+ case GL_PROGRAM_INPUT:
+ return clampCast<GLint>(program->getAttributes().size());
+
+ case GL_PROGRAM_OUTPUT:
+ return clampCast<GLint>(program->getState().getOutputVariables().size());
+
+ case GL_UNIFORM:
+ return clampCast<GLint>(program->getState().getUniforms().size());
+
+ case GL_UNIFORM_BLOCK:
+ return clampCast<GLint>(program->getState().getUniformBlocks().size());
+
+ case GL_ATOMIC_COUNTER_BUFFER:
+ return clampCast<GLint>(program->getState().getAtomicCounterBuffers().size());
+
+ case GL_BUFFER_VARIABLE:
+ return clampCast<GLint>(program->getState().getBufferVariables().size());
+
+ case GL_SHADER_STORAGE_BLOCK:
+ return clampCast<GLint>(program->getState().getShaderStorageBlocks().size());
+
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ return clampCast<GLint>(program->getTransformFeedbackVaryingCount());
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+template <typename T, typename M>
+GLint FindMaxSize(const std::vector<T> &resources, M member)
+{
+ GLint max = 0;
+ for (const T &resource : resources)
+ {
+ max = std::max(max, clampCast<GLint>((resource.*member).size()));
+ }
+ return max;
+}
+
+GLint QueryProgramInterfaceMaxNameLength(const Program *program, GLenum programInterface)
+{
+ GLint maxNameLength = 0;
+ switch (programInterface)
+ {
+ case GL_PROGRAM_INPUT:
+ maxNameLength = FindMaxSize(program->getAttributes(), &sh::Attribute::name);
+ break;
+
+ case GL_PROGRAM_OUTPUT:
+ maxNameLength =
+ FindMaxSize(program->getState().getOutputVariables(), &sh::OutputVariable::name);
+ break;
+
+ case GL_UNIFORM:
+ maxNameLength = FindMaxSize(program->getState().getUniforms(), &LinkedUniform::name);
+ break;
+
+ case GL_UNIFORM_BLOCK:
+ return program->getActiveUniformBlockMaxNameLength();
+
+ case GL_BUFFER_VARIABLE:
+ maxNameLength =
+ FindMaxSize(program->getState().getBufferVariables(), &BufferVariable::name);
+ break;
+
+ case GL_SHADER_STORAGE_BLOCK:
+ return program->getActiveShaderStorageBlockMaxNameLength();
+
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ return clampCast<GLint>(program->getTransformFeedbackVaryingMaxLength());
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+ // This length includes an extra character for the null terminator.
+ return (maxNameLength == 0 ? 0 : maxNameLength + 1);
+}
+
+GLint QueryProgramInterfaceMaxNumActiveVariables(const Program *program, GLenum programInterface)
+{
+ switch (programInterface)
+ {
+ case GL_UNIFORM_BLOCK:
+ return FindMaxSize(program->getState().getUniformBlocks(),
+ &InterfaceBlock::memberIndexes);
+ case GL_ATOMIC_COUNTER_BUFFER:
+ return FindMaxSize(program->getState().getAtomicCounterBuffers(),
+ &AtomicCounterBuffer::memberIndexes);
+
+ case GL_SHADER_STORAGE_BLOCK:
+ return FindMaxSize(program->getState().getShaderStorageBlocks(),
+ &InterfaceBlock::memberIndexes);
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLenum GetUniformPropertyEnum(GLenum prop)
+{
+ switch (prop)
+ {
+ case GL_UNIFORM_TYPE:
+ return GL_TYPE;
+ case GL_UNIFORM_SIZE:
+ return GL_ARRAY_SIZE;
+ case GL_UNIFORM_NAME_LENGTH:
+ return GL_NAME_LENGTH;
+ case GL_UNIFORM_BLOCK_INDEX:
+ return GL_BLOCK_INDEX;
+ case GL_UNIFORM_OFFSET:
+ return GL_OFFSET;
+ case GL_UNIFORM_ARRAY_STRIDE:
+ return GL_ARRAY_STRIDE;
+ case GL_UNIFORM_MATRIX_STRIDE:
+ return GL_MATRIX_STRIDE;
+ case GL_UNIFORM_IS_ROW_MAJOR:
+ return GL_IS_ROW_MAJOR;
+
+ default:
+ return prop;
+ }
+}
+
+GLenum GetUniformBlockPropertyEnum(GLenum prop)
+{
+ switch (prop)
+ {
+ case GL_UNIFORM_BLOCK_BINDING:
+ return GL_BUFFER_BINDING;
+
+ case GL_UNIFORM_BLOCK_DATA_SIZE:
+ return GL_BUFFER_DATA_SIZE;
+
+ case GL_UNIFORM_BLOCK_NAME_LENGTH:
+ return GL_NAME_LENGTH;
+
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+ return GL_NUM_ACTIVE_VARIABLES;
+
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+ return GL_ACTIVE_VARIABLES;
+
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+ return GL_REFERENCED_BY_VERTEX_SHADER;
+
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+ return GL_REFERENCED_BY_FRAGMENT_SHADER;
+
+ default:
+ return prop;
+ }
+}
+
+void GetShaderVariableBufferResourceProperty(const ShaderVariableBuffer &buffer,
+ GLenum pname,
+ GLint *params,
+ GLsizei bufSize,
+ GLsizei *outputPosition)
+
+{
+ switch (pname)
+ {
+ case GL_BUFFER_BINDING:
+ params[(*outputPosition)++] = buffer.binding;
+ break;
+ case GL_BUFFER_DATA_SIZE:
+ params[(*outputPosition)++] = clampCast<GLint>(buffer.dataSize);
+ break;
+ case GL_NUM_ACTIVE_VARIABLES:
+ params[(*outputPosition)++] = buffer.numActiveVariables();
+ break;
+ case GL_ACTIVE_VARIABLES:
+ for (size_t memberIndex = 0;
+ memberIndex < buffer.memberIndexes.size() && *outputPosition < bufSize;
+ ++memberIndex)
+ {
+ params[(*outputPosition)++] = clampCast<GLint>(buffer.memberIndexes[memberIndex]);
+ }
+ break;
+ case GL_REFERENCED_BY_VERTEX_SHADER:
+ params[(*outputPosition)++] = static_cast<GLint>(buffer.isActive(ShaderType::Vertex));
+ break;
+ case GL_REFERENCED_BY_FRAGMENT_SHADER:
+ params[(*outputPosition)++] = static_cast<GLint>(buffer.isActive(ShaderType::Fragment));
+ break;
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ params[(*outputPosition)++] = static_cast<GLint>(buffer.isActive(ShaderType::Compute));
+ break;
+ case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
+ params[(*outputPosition)++] = static_cast<GLint>(buffer.isActive(ShaderType::Geometry));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void GetInterfaceBlockResourceProperty(const InterfaceBlock &block,
+ GLenum pname,
+ GLint *params,
+ GLsizei bufSize,
+ GLsizei *outputPosition)
+{
+ if (pname == GL_NAME_LENGTH)
+ {
+ params[(*outputPosition)++] = clampCast<GLint>(block.nameWithArrayIndex().size() + 1);
+ return;
+ }
+ GetShaderVariableBufferResourceProperty(block, pname, params, bufSize, outputPosition);
+}
+
+void GetUniformBlockResourceProperty(const Program *program,
+ GLuint blockIndex,
+ GLenum pname,
+ GLint *params,
+ GLsizei bufSize,
+ GLsizei *outputPosition)
+
+{
+ ASSERT(*outputPosition < bufSize);
+ const auto &block = program->getUniformBlockByIndex(blockIndex);
+ GetInterfaceBlockResourceProperty(block, pname, params, bufSize, outputPosition);
+}
+
+void GetShaderStorageBlockResourceProperty(const Program *program,
+ GLuint blockIndex,
+ GLenum pname,
+ GLint *params,
+ GLsizei bufSize,
+ GLsizei *outputPosition)
+
+{
+ ASSERT(*outputPosition < bufSize);
+ const auto &block = program->getShaderStorageBlockByIndex(blockIndex);
+ GetInterfaceBlockResourceProperty(block, pname, params, bufSize, outputPosition);
+}
+
+void GetAtomicCounterBufferResourceProperty(const Program *program,
+ GLuint index,
+ GLenum pname,
+ GLint *params,
+ GLsizei bufSize,
+ GLsizei *outputPosition)
+
+{
+ ASSERT(*outputPosition < bufSize);
+ const auto &buffer = program->getState().getAtomicCounterBuffers()[index];
+ GetShaderVariableBufferResourceProperty(buffer, pname, params, bufSize, outputPosition);
+}
+
+bool IsTextureEnvEnumParameter(TextureEnvParameter pname)
+{
+ switch (pname)
+ {
+ case TextureEnvParameter::Mode:
+ case TextureEnvParameter::CombineRgb:
+ case TextureEnvParameter::CombineAlpha:
+ case TextureEnvParameter::Src0Rgb:
+ case TextureEnvParameter::Src1Rgb:
+ case TextureEnvParameter::Src2Rgb:
+ case TextureEnvParameter::Src0Alpha:
+ case TextureEnvParameter::Src1Alpha:
+ case TextureEnvParameter::Src2Alpha:
+ case TextureEnvParameter::Op0Rgb:
+ case TextureEnvParameter::Op1Rgb:
+ case TextureEnvParameter::Op2Rgb:
+ case TextureEnvParameter::Op0Alpha:
+ case TextureEnvParameter::Op1Alpha:
+ case TextureEnvParameter::Op2Alpha:
+ case TextureEnvParameter::PointCoordReplace:
+ return true;
+ default:
+ return false;
+ }
+}
+
+} // anonymous namespace
+
+void QueryFramebufferAttachmentParameteriv(const Context *context,
+ const Framebuffer *framebuffer,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ ASSERT(framebuffer);
+
+ const FramebufferAttachment *attachmentObject = framebuffer->getAttachment(context, attachment);
+
+ if (attachmentObject == nullptr)
+ {
+ // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
+ // is NONE, then querying any other pname will generate INVALID_ENUM.
+
+ // ES 3.0.2 spec pg 235 states that if the attachment type is none,
+ // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
+ // INVALID_OPERATION for all other pnames
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = GL_NONE;
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ *params = 0;
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return;
+ }
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = attachmentObject->type();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ *params = attachmentObject->id();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ *params = attachmentObject->mipLevel();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ {
+ TextureTarget face = attachmentObject->cubeMapFace();
+ if (face != TextureTarget::InvalidEnum)
+ {
+ *params = ToGLenum(attachmentObject->cubeMapFace());
+ }
+ else
+ {
+ // This happens when the attachment isn't a texture cube map face
+ *params = GL_NONE;
+ }
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ *params = attachmentObject->getRedSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ *params = attachmentObject->getGreenSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ *params = attachmentObject->getBlueSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ *params = attachmentObject->getAlphaSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ *params = attachmentObject->getDepthSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ *params = attachmentObject->getStencilSize();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ *params = attachmentObject->getComponentType();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ *params = attachmentObject->getColorEncoding();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ *params = attachmentObject->layer();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR:
+ *params = attachmentObject->getNumViews();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR:
+ *params = attachmentObject->getBaseViewIndex();
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT:
+ *params = attachmentObject->isLayered();
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params)
+{
+ QueryBufferParameterBase(buffer, pname, params);
+}
+
+void QueryBufferParameteri64v(const Buffer *buffer, GLenum pname, GLint64 *params)
+{
+ QueryBufferParameterBase(buffer, pname, params);
+}
+
+void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params)
+{
+ switch (pname)
+ {
+ case GL_BUFFER_MAP_POINTER:
+ *params = buffer->getMapPointer();
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryProgramiv(Context *context, const Program *program, GLenum pname, GLint *params)
+{
+ ASSERT(program != nullptr || pname == GL_COMPLETION_STATUS_KHR);
+
+ switch (pname)
+ {
+ case GL_DELETE_STATUS:
+ *params = program->isFlaggedForDeletion();
+ return;
+ case GL_LINK_STATUS:
+ *params = program->isLinked();
+ return;
+ case GL_COMPLETION_STATUS_KHR:
+ if (context->isContextLost())
+ {
+ *params = GL_TRUE;
+ }
+ else
+ {
+ *params = program->isLinking() ? GL_FALSE : GL_TRUE;
+ }
+ return;
+ case GL_VALIDATE_STATUS:
+ *params = program->isValidated();
+ return;
+ case GL_INFO_LOG_LENGTH:
+ *params = program->getInfoLogLength();
+ return;
+ case GL_ATTACHED_SHADERS:
+ *params = program->getAttachedShadersCount();
+ return;
+ case GL_ACTIVE_ATTRIBUTES:
+ *params = program->getActiveAttributeCount();
+ return;
+ case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ *params = program->getActiveAttributeMaxLength();
+ return;
+ case GL_ACTIVE_UNIFORMS:
+ *params = program->getActiveUniformCount();
+ return;
+ case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+ *params = program->getActiveUniformMaxLength();
+ return;
+ case GL_PROGRAM_BINARY_LENGTH_OES:
+ *params = context->getCaps().programBinaryFormats.empty()
+ ? 0
+ : program->getBinaryLength(context);
+ return;
+ case GL_ACTIVE_UNIFORM_BLOCKS:
+ *params = program->getActiveUniformBlockCount();
+ return;
+ case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+ *params = program->getActiveUniformBlockMaxNameLength();
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ *params = program->getTransformFeedbackBufferMode();
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ *params = clampCast<GLint>(program->getTransformFeedbackVaryingCount());
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ *params = program->getTransformFeedbackVaryingMaxLength();
+ break;
+ case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
+ *params = program->getBinaryRetrievableHint();
+ break;
+ case GL_PROGRAM_SEPARABLE:
+ *params = program->isSeparable();
+ break;
+ case GL_COMPUTE_WORK_GROUP_SIZE:
+ {
+ const sh::WorkGroupSize &localSize = program->getComputeShaderLocalSize();
+ params[0] = localSize[0];
+ params[1] = localSize[1];
+ params[2] = localSize[2];
+ }
+ break;
+ case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS:
+ *params = program->getActiveAtomicCounterBufferCount();
+ break;
+ case GL_GEOMETRY_LINKED_INPUT_TYPE_EXT:
+ *params = ToGLenum(program->getGeometryShaderInputPrimitiveType());
+ break;
+ case GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT:
+ *params = ToGLenum(program->getGeometryShaderOutputPrimitiveType());
+ break;
+ case GL_GEOMETRY_LINKED_VERTICES_OUT_EXT:
+ *params = program->getGeometryShaderMaxVertices();
+ break;
+ case GL_GEOMETRY_SHADER_INVOCATIONS_EXT:
+ *params = program->getGeometryShaderInvocations();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryRenderbufferiv(const Context *context,
+ const Renderbuffer *renderbuffer,
+ GLenum pname,
+ GLint *params)
+{
+ ASSERT(renderbuffer != nullptr);
+
+ switch (pname)
+ {
+ case GL_RENDERBUFFER_WIDTH:
+ *params = renderbuffer->getWidth();
+ break;
+ case GL_RENDERBUFFER_HEIGHT:
+ *params = renderbuffer->getHeight();
+ break;
+ case GL_RENDERBUFFER_INTERNAL_FORMAT:
+ // Special case the WebGL 1 DEPTH_STENCIL format.
+ if (context->isWebGL1() &&
+ renderbuffer->getFormat().info->internalFormat == GL_DEPTH24_STENCIL8)
+ {
+ *params = GL_DEPTH_STENCIL;
+ }
+ else
+ {
+ *params = renderbuffer->getFormat().info->internalFormat;
+ }
+ break;
+ case GL_RENDERBUFFER_RED_SIZE:
+ *params = renderbuffer->getRedSize();
+ break;
+ case GL_RENDERBUFFER_GREEN_SIZE:
+ *params = renderbuffer->getGreenSize();
+ break;
+ case GL_RENDERBUFFER_BLUE_SIZE:
+ *params = renderbuffer->getBlueSize();
+ break;
+ case GL_RENDERBUFFER_ALPHA_SIZE:
+ *params = renderbuffer->getAlphaSize();
+ break;
+ case GL_RENDERBUFFER_DEPTH_SIZE:
+ *params = renderbuffer->getDepthSize();
+ break;
+ case GL_RENDERBUFFER_STENCIL_SIZE:
+ *params = renderbuffer->getStencilSize();
+ break;
+ case GL_RENDERBUFFER_SAMPLES_ANGLE:
+ *params = renderbuffer->getSamples();
+ break;
+ case GL_MEMORY_SIZE_ANGLE:
+ *params = renderbuffer->getMemorySize();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryShaderiv(const Context *context, Shader *shader, GLenum pname, GLint *params)
+{
+ ASSERT(shader != nullptr || pname == GL_COMPLETION_STATUS_KHR);
+
+ switch (pname)
+ {
+ case GL_SHADER_TYPE:
+ *params = static_cast<GLint>(ToGLenum(shader->getType()));
+ return;
+ case GL_DELETE_STATUS:
+ *params = shader->isFlaggedForDeletion();
+ return;
+ case GL_COMPILE_STATUS:
+ *params = shader->isCompiled() ? GL_TRUE : GL_FALSE;
+ return;
+ case GL_COMPLETION_STATUS_KHR:
+ if (context->isContextLost())
+ {
+ *params = GL_TRUE;
+ }
+ else
+ {
+ *params = shader->isCompleted() ? GL_TRUE : GL_FALSE;
+ }
+ return;
+ case GL_INFO_LOG_LENGTH:
+ *params = shader->getInfoLogLength();
+ return;
+ case GL_SHADER_SOURCE_LENGTH:
+ *params = shader->getSourceLength();
+ return;
+ case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
+ *params = shader->getTranslatedSourceWithDebugInfoLength();
+ return;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryTexLevelParameterfv(const Texture *texture,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ QueryTexLevelParameterBase(texture, target, level, pname, params);
+}
+
+void QueryTexLevelParameteriv(const Texture *texture,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ QueryTexLevelParameterBase(texture, target, level, pname, params);
+}
+
+void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params)
+{
+ QueryTexParameterBase<false>(texture, pname, params);
+}
+
+void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params)
+{
+ QueryTexParameterBase<false>(texture, pname, params);
+}
+
+void QueryTexParameterIiv(const Texture *texture, GLenum pname, GLint *params)
+{
+ QueryTexParameterBase<true>(texture, pname, params);
+}
+
+void QueryTexParameterIuiv(const Texture *texture, GLenum pname, GLuint *params)
+{
+ QueryTexParameterBase<true>(texture, pname, params);
+}
+
+void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params)
+{
+ QuerySamplerParameterBase<false>(sampler, pname, params);
+}
+
+void QuerySamplerParameteriv(const Sampler *sampler, GLenum pname, GLint *params)
+{
+ QuerySamplerParameterBase<false>(sampler, pname, params);
+}
+
+void QuerySamplerParameterIiv(const Sampler *sampler, GLenum pname, GLint *params)
+{
+ QuerySamplerParameterBase<true>(sampler, pname, params);
+}
+
+void QuerySamplerParameterIuiv(const Sampler *sampler, GLenum pname, GLuint *params)
+{
+ QuerySamplerParameterBase<true>(sampler, pname, params);
+}
+
+void QueryVertexAttribfv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLfloat *params)
+{
+ QueryVertexAttribBase(attrib, binding, currentValueData.Values.FloatValues, pname, params);
+}
+
+void QueryVertexAttribiv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLint *params)
+{
+ QueryVertexAttribBase(attrib, binding, currentValueData.Values.FloatValues, pname, params);
+}
+
+void QueryVertexAttribPointerv(const VertexAttribute &attrib, GLenum pname, void **pointer)
+{
+ switch (pname)
+ {
+ case GL_VERTEX_ATTRIB_ARRAY_POINTER:
+ *pointer = const_cast<void *>(attrib.pointer);
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryVertexAttribIiv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLint *params)
+{
+ QueryVertexAttribBase(attrib, binding, currentValueData.Values.IntValues, pname, params);
+}
+
+void QueryVertexAttribIuiv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLuint *params)
+{
+ QueryVertexAttribBase(attrib, binding, currentValueData.Values.UnsignedIntValues, pname,
+ params);
+}
+
+void QueryActiveUniformBlockiv(const Program *program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params)
+{
+ GLenum prop = GetUniformBlockPropertyEnum(pname);
+ QueryProgramResourceiv(program, GL_UNIFORM_BLOCK, uniformBlockIndex, 1, &prop,
+ std::numeric_limits<GLsizei>::max(), nullptr, params);
+}
+
+void QueryInternalFormativ(const TextureCaps &format, GLenum pname, GLsizei bufSize, GLint *params)
+{
+ switch (pname)
+ {
+ case GL_NUM_SAMPLE_COUNTS:
+ if (bufSize != 0)
+ {
+ *params = clampCast<GLint>(format.sampleCounts.size());
+ }
+ break;
+
+ case GL_SAMPLES:
+ {
+ size_t returnCount = std::min<size_t>(bufSize, format.sampleCounts.size());
+ auto sampleReverseIt = format.sampleCounts.rbegin();
+ for (size_t sampleIndex = 0; sampleIndex < returnCount; ++sampleIndex)
+ {
+ params[sampleIndex] = *sampleReverseIt++;
+ }
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryFramebufferParameteriv(const Framebuffer *framebuffer, GLenum pname, GLint *params)
+{
+ ASSERT(framebuffer);
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_DEFAULT_WIDTH:
+ *params = framebuffer->getDefaultWidth();
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_HEIGHT:
+ *params = framebuffer->getDefaultHeight();
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
+ *params = framebuffer->getDefaultSamples();
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
+ *params = ConvertToGLBoolean(framebuffer->getDefaultFixedSampleLocations());
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
+ *params = framebuffer->getDefaultLayers();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+angle::Result QuerySynciv(const Context *context,
+ const Sync *sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values)
+{
+ ASSERT(sync != nullptr || pname == GL_SYNC_STATUS);
+
+ // All queries return one value, exit early if the buffer can't fit anything.
+ if (bufSize < 1)
+ {
+ if (length != nullptr)
+ {
+ *length = 0;
+ }
+ return angle::Result::Continue;
+ }
+
+ switch (pname)
+ {
+ case GL_OBJECT_TYPE:
+ *values = clampCast<GLint>(GL_SYNC_FENCE);
+ break;
+ case GL_SYNC_CONDITION:
+ *values = clampCast<GLint>(sync->getCondition());
+ break;
+ case GL_SYNC_FLAGS:
+ *values = clampCast<GLint>(sync->getFlags());
+ break;
+ case GL_SYNC_STATUS:
+ if (context->isContextLost())
+ {
+ *values = GL_SIGNALED;
+ }
+ else
+ {
+ ANGLE_TRY(sync->getStatus(context, values));
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ if (length != nullptr)
+ {
+ *length = 1;
+ }
+
+ return angle::Result::Continue;
+}
+
+void SetTexParameterf(Context *context, Texture *texture, GLenum pname, GLfloat param)
+{
+ SetTexParameterBase<false>(context, texture, pname, &param);
+}
+
+void SetTexParameterfv(Context *context, Texture *texture, GLenum pname, const GLfloat *params)
+{
+ SetTexParameterBase<false>(context, texture, pname, params);
+}
+
+void SetTexParameteri(Context *context, Texture *texture, GLenum pname, GLint param)
+{
+ SetTexParameterBase<false>(context, texture, pname, &param);
+}
+
+void SetTexParameteriv(Context *context, Texture *texture, GLenum pname, const GLint *params)
+{
+ SetTexParameterBase<false>(context, texture, pname, params);
+}
+
+void SetTexParameterIiv(Context *context, Texture *texture, GLenum pname, const GLint *params)
+{
+ SetTexParameterBase<true>(context, texture, pname, params);
+}
+
+void SetTexParameterIuiv(Context *context, Texture *texture, GLenum pname, const GLuint *params)
+{
+ SetTexParameterBase<true>(context, texture, pname, params);
+}
+
+void SetSamplerParameterf(Context *context, Sampler *sampler, GLenum pname, GLfloat param)
+{
+ SetSamplerParameterBase<false>(context, sampler, pname, &param);
+}
+
+void SetSamplerParameterfv(Context *context, Sampler *sampler, GLenum pname, const GLfloat *params)
+{
+ SetSamplerParameterBase<false>(context, sampler, pname, params);
+}
+
+void SetSamplerParameteri(Context *context, Sampler *sampler, GLenum pname, GLint param)
+{
+ SetSamplerParameterBase<false>(context, sampler, pname, &param);
+}
+
+void SetSamplerParameteriv(Context *context, Sampler *sampler, GLenum pname, const GLint *params)
+{
+ SetSamplerParameterBase<false>(context, sampler, pname, params);
+}
+
+void SetSamplerParameterIiv(Context *context, Sampler *sampler, GLenum pname, const GLint *params)
+{
+ SetSamplerParameterBase<true>(context, sampler, pname, params);
+}
+
+void SetSamplerParameterIuiv(Context *context, Sampler *sampler, GLenum pname, const GLuint *params)
+{
+ SetSamplerParameterBase<true>(context, sampler, pname, params);
+}
+
+void SetFramebufferParameteri(const Context *context,
+ Framebuffer *framebuffer,
+ GLenum pname,
+ GLint param)
+{
+ ASSERT(framebuffer);
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_DEFAULT_WIDTH:
+ framebuffer->setDefaultWidth(context, param);
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_HEIGHT:
+ framebuffer->setDefaultHeight(context, param);
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
+ framebuffer->setDefaultSamples(context, param);
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
+ framebuffer->setDefaultFixedSampleLocations(context, ConvertToBool(param));
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
+ framebuffer->setDefaultLayers(param);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void SetProgramParameteri(Program *program, GLenum pname, GLint value)
+{
+ ASSERT(program);
+
+ switch (pname)
+ {
+ case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
+ program->setBinaryRetrievableHint(ConvertToBool(value));
+ break;
+ case GL_PROGRAM_SEPARABLE:
+ program->setSeparable(ConvertToBool(value));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+GLint GetUniformResourceProperty(const Program *program, GLuint index, const GLenum prop)
+{
+ const auto &uniform = program->getUniformByIndex(index);
+ GLenum resourceProp = GetUniformPropertyEnum(prop);
+ switch (resourceProp)
+ {
+ case GL_TYPE:
+ case GL_ARRAY_SIZE:
+ case GL_NAME_LENGTH:
+ return GetCommonVariableProperty(uniform, resourceProp);
+
+ case GL_LOCATION:
+ return program->getUniformLocation(uniform.name);
+
+ case GL_BLOCK_INDEX:
+ return (uniform.isAtomicCounter() ? -1 : uniform.bufferIndex);
+
+ case GL_OFFSET:
+ return uniform.blockInfo.offset;
+
+ case GL_ARRAY_STRIDE:
+ return uniform.blockInfo.arrayStride;
+
+ case GL_MATRIX_STRIDE:
+ return uniform.blockInfo.matrixStride;
+
+ case GL_IS_ROW_MAJOR:
+ return static_cast<GLint>(uniform.blockInfo.isRowMajorMatrix);
+
+ case GL_REFERENCED_BY_VERTEX_SHADER:
+ return uniform.isActive(ShaderType::Vertex);
+
+ case GL_REFERENCED_BY_FRAGMENT_SHADER:
+ return uniform.isActive(ShaderType::Fragment);
+
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ return uniform.isActive(ShaderType::Compute);
+
+ case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
+ return uniform.isActive(ShaderType::Geometry);
+
+ case GL_ATOMIC_COUNTER_BUFFER_INDEX:
+ return (uniform.isAtomicCounter() ? uniform.bufferIndex : -1);
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLint GetBufferVariableResourceProperty(const Program *program, GLuint index, const GLenum prop)
+{
+ const auto &bufferVariable = program->getBufferVariableByIndex(index);
+ switch (prop)
+ {
+ case GL_TYPE:
+ case GL_ARRAY_SIZE:
+ case GL_NAME_LENGTH:
+ return GetCommonVariableProperty(bufferVariable, prop);
+
+ case GL_BLOCK_INDEX:
+ return bufferVariable.bufferIndex;
+
+ case GL_OFFSET:
+ return bufferVariable.blockInfo.offset;
+
+ case GL_ARRAY_STRIDE:
+ return bufferVariable.blockInfo.arrayStride;
+
+ case GL_MATRIX_STRIDE:
+ return bufferVariable.blockInfo.matrixStride;
+
+ case GL_IS_ROW_MAJOR:
+ return static_cast<GLint>(bufferVariable.blockInfo.isRowMajorMatrix);
+
+ case GL_REFERENCED_BY_VERTEX_SHADER:
+ return bufferVariable.isActive(ShaderType::Vertex);
+
+ case GL_REFERENCED_BY_FRAGMENT_SHADER:
+ return bufferVariable.isActive(ShaderType::Fragment);
+
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ return bufferVariable.isActive(ShaderType::Compute);
+
+ case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
+ return bufferVariable.isActive(ShaderType::Geometry);
+
+ case GL_TOP_LEVEL_ARRAY_SIZE:
+ return bufferVariable.topLevelArraySize;
+
+ case GL_TOP_LEVEL_ARRAY_STRIDE:
+ return bufferVariable.blockInfo.topLevelArrayStride;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLuint QueryProgramResourceIndex(const Program *program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ switch (programInterface)
+ {
+ case GL_PROGRAM_INPUT:
+ return program->getInputResourceIndex(name);
+
+ case GL_PROGRAM_OUTPUT:
+ return program->getOutputResourceIndex(name);
+
+ case GL_UNIFORM:
+ return program->getState().getUniformIndexFromName(name);
+
+ case GL_BUFFER_VARIABLE:
+ return program->getState().getBufferVariableIndexFromName(name);
+
+ case GL_SHADER_STORAGE_BLOCK:
+ return program->getShaderStorageBlockIndex(name);
+
+ case GL_UNIFORM_BLOCK:
+ return program->getUniformBlockIndex(name);
+
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ return program->getTransformFeedbackVaryingResourceIndex(name);
+
+ default:
+ UNREACHABLE();
+ return GL_INVALID_INDEX;
+ }
+}
+
+void QueryProgramResourceName(const Program *program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ switch (programInterface)
+ {
+ case GL_PROGRAM_INPUT:
+ program->getInputResourceName(index, bufSize, length, name);
+ break;
+
+ case GL_PROGRAM_OUTPUT:
+ program->getOutputResourceName(index, bufSize, length, name);
+ break;
+
+ case GL_UNIFORM:
+ program->getUniformResourceName(index, bufSize, length, name);
+ break;
+
+ case GL_BUFFER_VARIABLE:
+ program->getBufferVariableResourceName(index, bufSize, length, name);
+ break;
+
+ case GL_SHADER_STORAGE_BLOCK:
+ program->getActiveShaderStorageBlockName(index, bufSize, length, name);
+ break;
+
+ case GL_UNIFORM_BLOCK:
+ program->getActiveUniformBlockName(index, bufSize, length, name);
+ break;
+
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ program->getTransformFeedbackVarying(index, bufSize, length, nullptr, nullptr, name);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+}
+
+GLint QueryProgramResourceLocation(const Program *program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ switch (programInterface)
+ {
+ case GL_PROGRAM_INPUT:
+ return program->getAttributeLocation(name);
+
+ case GL_PROGRAM_OUTPUT:
+ return program->getFragDataLocation(name);
+
+ case GL_UNIFORM:
+ return program->getUniformLocation(name);
+
+ default:
+ UNREACHABLE();
+ return -1;
+ }
+}
+
+void QueryProgramResourceiv(const Program *program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!program->isLinked())
+ {
+ if (length != nullptr)
+ {
+ *length = 0;
+ }
+ return;
+ }
+
+ GLsizei pos = 0;
+ for (GLsizei i = 0; i < propCount; i++)
+ {
+ switch (programInterface)
+ {
+ case GL_PROGRAM_INPUT:
+ params[i] = GetInputResourceProperty(program, index, props[i]);
+ ++pos;
+ break;
+
+ case GL_PROGRAM_OUTPUT:
+ params[i] = GetOutputResourceProperty(program, index, props[i]);
+ ++pos;
+ break;
+
+ case GL_UNIFORM:
+ params[i] = GetUniformResourceProperty(program, index, props[i]);
+ ++pos;
+ break;
+
+ case GL_BUFFER_VARIABLE:
+ params[i] = GetBufferVariableResourceProperty(program, index, props[i]);
+ ++pos;
+ break;
+
+ case GL_UNIFORM_BLOCK:
+ GetUniformBlockResourceProperty(program, index, props[i], params, bufSize, &pos);
+ break;
+
+ case GL_SHADER_STORAGE_BLOCK:
+ GetShaderStorageBlockResourceProperty(program, index, props[i], params, bufSize,
+ &pos);
+ break;
+
+ case GL_ATOMIC_COUNTER_BUFFER:
+ GetAtomicCounterBufferResourceProperty(program, index, props[i], params, bufSize,
+ &pos);
+ break;
+
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ params[i] = GetTransformFeedbackVaryingResourceProperty(program, index, props[i]);
+ ++pos;
+ break;
+
+ default:
+ UNREACHABLE();
+ params[i] = GL_INVALID_VALUE;
+ }
+ if (pos == bufSize)
+ {
+ // Most properties return one value, but GL_ACTIVE_VARIABLES returns an array of values.
+ // This checks not to break buffer bounds for such case.
+ break;
+ }
+ }
+
+ if (length != nullptr)
+ {
+ *length = pos;
+ }
+}
+
+void QueryProgramInterfaceiv(const Program *program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params)
+{
+ switch (pname)
+ {
+ case GL_ACTIVE_RESOURCES:
+ *params = QueryProgramInterfaceActiveResources(program, programInterface);
+ break;
+
+ case GL_MAX_NAME_LENGTH:
+ *params = QueryProgramInterfaceMaxNameLength(program, programInterface);
+ break;
+
+ case GL_MAX_NUM_ACTIVE_VARIABLES:
+ *params = QueryProgramInterfaceMaxNumActiveVariables(program, programInterface);
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+}
+
+ClientVertexArrayType ParamToVertexArrayType(GLenum param)
+{
+ switch (param)
+ {
+ case GL_VERTEX_ARRAY:
+ case GL_VERTEX_ARRAY_BUFFER_BINDING:
+ case GL_VERTEX_ARRAY_STRIDE:
+ case GL_VERTEX_ARRAY_SIZE:
+ case GL_VERTEX_ARRAY_TYPE:
+ case GL_VERTEX_ARRAY_POINTER:
+ return ClientVertexArrayType::Vertex;
+ case GL_NORMAL_ARRAY:
+ case GL_NORMAL_ARRAY_BUFFER_BINDING:
+ case GL_NORMAL_ARRAY_STRIDE:
+ case GL_NORMAL_ARRAY_TYPE:
+ case GL_NORMAL_ARRAY_POINTER:
+ return ClientVertexArrayType::Normal;
+ case GL_COLOR_ARRAY:
+ case GL_COLOR_ARRAY_BUFFER_BINDING:
+ case GL_COLOR_ARRAY_STRIDE:
+ case GL_COLOR_ARRAY_SIZE:
+ case GL_COLOR_ARRAY_TYPE:
+ case GL_COLOR_ARRAY_POINTER:
+ return ClientVertexArrayType::Color;
+ case GL_POINT_SIZE_ARRAY_OES:
+ case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+ case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+ case GL_POINT_SIZE_ARRAY_TYPE_OES:
+ case GL_POINT_SIZE_ARRAY_POINTER_OES:
+ return ClientVertexArrayType::PointSize;
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ case GL_TEXTURE_COORD_ARRAY_POINTER:
+ return ClientVertexArrayType::TextureCoord;
+ default:
+ UNREACHABLE();
+ return ClientVertexArrayType::InvalidEnum;
+ }
+}
+
+void SetLightModelParameters(GLES1State *state, GLenum pname, const GLfloat *params)
+{
+ LightModelParameters &lightModel = state->lightModelParameters();
+
+ switch (pname)
+ {
+ case GL_LIGHT_MODEL_AMBIENT:
+ lightModel.color = ColorF::fromData(params);
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ lightModel.twoSided = *params == 1.0f ? true : false;
+ break;
+ default:
+ break;
+ }
+}
+
+void GetLightModelParameters(const GLES1State *state, GLenum pname, GLfloat *params)
+{
+ const LightModelParameters &lightModel = state->lightModelParameters();
+
+ switch (pname)
+ {
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *params = lightModel.twoSided ? 1.0f : 0.0f;
+ break;
+ case GL_LIGHT_MODEL_AMBIENT:
+ lightModel.color.writeData(params);
+ break;
+ default:
+ break;
+ }
+}
+
+bool IsLightModelTwoSided(const GLES1State *state)
+{
+ return state->lightModelParameters().twoSided;
+}
+
+void SetLightParameters(GLES1State *state,
+ GLenum light,
+ LightParameter pname,
+ const GLfloat *params)
+{
+ uint32_t lightIndex = light - GL_LIGHT0;
+
+ LightParameters &lightParams = state->lightParameters(lightIndex);
+
+ switch (pname)
+ {
+ case LightParameter::Ambient:
+ lightParams.ambient = ColorF::fromData(params);
+ break;
+ case LightParameter::Diffuse:
+ lightParams.diffuse = ColorF::fromData(params);
+ break;
+ case LightParameter::Specular:
+ lightParams.specular = ColorF::fromData(params);
+ break;
+ case LightParameter::Position:
+ {
+ angle::Mat4 mv = state->getModelviewMatrix();
+ angle::Vector4 transformedPos =
+ mv.product(angle::Vector4(params[0], params[1], params[2], params[3]));
+ lightParams.position[0] = transformedPos[0];
+ lightParams.position[1] = transformedPos[1];
+ lightParams.position[2] = transformedPos[2];
+ lightParams.position[3] = transformedPos[3];
+ }
+ break;
+ case LightParameter::SpotDirection:
+ {
+ angle::Mat4 mv = state->getModelviewMatrix();
+ angle::Vector4 transformedPos =
+ mv.product(angle::Vector4(params[0], params[1], params[2], 0.0f));
+ lightParams.direction[0] = transformedPos[0];
+ lightParams.direction[1] = transformedPos[1];
+ lightParams.direction[2] = transformedPos[2];
+ }
+ break;
+ case LightParameter::SpotExponent:
+ lightParams.spotlightExponent = *params;
+ break;
+ case LightParameter::SpotCutoff:
+ lightParams.spotlightCutoffAngle = *params;
+ break;
+ case LightParameter::ConstantAttenuation:
+ lightParams.attenuationConst = *params;
+ break;
+ case LightParameter::LinearAttenuation:
+ lightParams.attenuationLinear = *params;
+ break;
+ case LightParameter::QuadraticAttenuation:
+ lightParams.attenuationQuadratic = *params;
+ break;
+ default:
+ return;
+ }
+}
+
+void GetLightParameters(const GLES1State *state,
+ GLenum light,
+ LightParameter pname,
+ GLfloat *params)
+{
+ uint32_t lightIndex = light - GL_LIGHT0;
+ const LightParameters &lightParams = state->lightParameters(lightIndex);
+
+ switch (pname)
+ {
+ case LightParameter::Ambient:
+ lightParams.ambient.writeData(params);
+ break;
+ case LightParameter::Diffuse:
+ lightParams.diffuse.writeData(params);
+ break;
+ case LightParameter::Specular:
+ lightParams.specular.writeData(params);
+ break;
+ case LightParameter::Position:
+ memcpy(params, lightParams.position.data(), 4 * sizeof(GLfloat));
+ break;
+ case LightParameter::SpotDirection:
+ memcpy(params, lightParams.direction.data(), 3 * sizeof(GLfloat));
+ break;
+ case LightParameter::SpotExponent:
+ *params = lightParams.spotlightExponent;
+ break;
+ case LightParameter::SpotCutoff:
+ *params = lightParams.spotlightCutoffAngle;
+ break;
+ case LightParameter::ConstantAttenuation:
+ *params = lightParams.attenuationConst;
+ break;
+ case LightParameter::LinearAttenuation:
+ *params = lightParams.attenuationLinear;
+ break;
+ case LightParameter::QuadraticAttenuation:
+ *params = lightParams.attenuationQuadratic;
+ break;
+ default:
+ break;
+ }
+}
+
+void SetMaterialParameters(GLES1State *state,
+ GLenum face,
+ MaterialParameter pname,
+ const GLfloat *params)
+{
+ MaterialParameters &material = state->materialParameters();
+ switch (pname)
+ {
+ case MaterialParameter::Ambient:
+ material.ambient = ColorF::fromData(params);
+ break;
+ case MaterialParameter::Diffuse:
+ material.diffuse = ColorF::fromData(params);
+ break;
+ case MaterialParameter::AmbientAndDiffuse:
+ material.ambient = ColorF::fromData(params);
+ material.diffuse = ColorF::fromData(params);
+ break;
+ case MaterialParameter::Specular:
+ material.specular = ColorF::fromData(params);
+ break;
+ case MaterialParameter::Emission:
+ material.emissive = ColorF::fromData(params);
+ break;
+ case MaterialParameter::Shininess:
+ material.specularExponent = *params;
+ break;
+ default:
+ return;
+ }
+}
+
+void GetMaterialParameters(const GLES1State *state,
+ GLenum face,
+ MaterialParameter pname,
+ GLfloat *params)
+{
+ const ColorF &currentColor = state->getCurrentColor();
+ const MaterialParameters &material = state->materialParameters();
+ const bool colorMaterialEnabled = state->isColorMaterialEnabled();
+
+ switch (pname)
+ {
+ case MaterialParameter::Ambient:
+ if (colorMaterialEnabled)
+ {
+ currentColor.writeData(params);
+ }
+ else
+ {
+ material.ambient.writeData(params);
+ }
+ break;
+ case MaterialParameter::Diffuse:
+ if (colorMaterialEnabled)
+ {
+ currentColor.writeData(params);
+ }
+ else
+ {
+ material.diffuse.writeData(params);
+ }
+ break;
+ case MaterialParameter::Specular:
+ material.specular.writeData(params);
+ break;
+ case MaterialParameter::Emission:
+ material.emissive.writeData(params);
+ break;
+ case MaterialParameter::Shininess:
+ *params = material.specularExponent;
+ break;
+ default:
+ return;
+ }
+}
+
+unsigned int GetLightModelParameterCount(GLenum pname)
+{
+ switch (pname)
+ {
+ case GL_LIGHT_MODEL_AMBIENT:
+ return 4;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+unsigned int GetLightParameterCount(LightParameter pname)
+{
+ switch (pname)
+ {
+ case LightParameter::Ambient:
+ case LightParameter::Diffuse:
+ case LightParameter::Specular:
+ case LightParameter::Position:
+ return 4;
+ case LightParameter::SpotDirection:
+ return 3;
+ case LightParameter::SpotExponent:
+ case LightParameter::SpotCutoff:
+ case LightParameter::ConstantAttenuation:
+ case LightParameter::LinearAttenuation:
+ case LightParameter::QuadraticAttenuation:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+unsigned int GetMaterialParameterCount(MaterialParameter pname)
+{
+ switch (pname)
+ {
+ case MaterialParameter::Ambient:
+ case MaterialParameter::Diffuse:
+ case MaterialParameter::Specular:
+ case MaterialParameter::Emission:
+ return 4;
+ case MaterialParameter::Shininess:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+void SetFogParameters(GLES1State *state, GLenum pname, const GLfloat *params)
+{
+ FogParameters &fog = state->fogParameters();
+ switch (pname)
+ {
+ case GL_FOG_MODE:
+ fog.mode = FromGLenum<FogMode>(static_cast<GLenum>(params[0]));
+ break;
+ case GL_FOG_DENSITY:
+ fog.density = params[0];
+ break;
+ case GL_FOG_START:
+ fog.start = params[0];
+ break;
+ case GL_FOG_END:
+ fog.end = params[0];
+ break;
+ case GL_FOG_COLOR:
+ fog.color = ColorF::fromData(params);
+ break;
+ default:
+ return;
+ }
+}
+
+void GetFogParameters(const GLES1State *state, GLenum pname, GLfloat *params)
+{
+ const FogParameters &fog = state->fogParameters();
+ switch (pname)
+ {
+ case GL_FOG_MODE:
+ params[0] = static_cast<GLfloat>(ToGLenum(fog.mode));
+ break;
+ case GL_FOG_DENSITY:
+ params[0] = fog.density;
+ break;
+ case GL_FOG_START:
+ params[0] = fog.start;
+ break;
+ case GL_FOG_END:
+ params[0] = fog.end;
+ break;
+ case GL_FOG_COLOR:
+ fog.color.writeData(params);
+ break;
+ default:
+ return;
+ }
+}
+
+unsigned int GetFogParameterCount(GLenum pname)
+{
+ switch (pname)
+ {
+ case GL_FOG_MODE:
+ case GL_FOG_DENSITY:
+ case GL_FOG_START:
+ case GL_FOG_END:
+ return 1;
+ case GL_FOG_COLOR:
+ return 4;
+ default:
+ return 0;
+ }
+}
+
+unsigned int GetTextureEnvParameterCount(TextureEnvParameter pname)
+{
+ switch (pname)
+ {
+ case TextureEnvParameter::Mode:
+ case TextureEnvParameter::CombineRgb:
+ case TextureEnvParameter::CombineAlpha:
+ case TextureEnvParameter::Src0Rgb:
+ case TextureEnvParameter::Src1Rgb:
+ case TextureEnvParameter::Src2Rgb:
+ case TextureEnvParameter::Src0Alpha:
+ case TextureEnvParameter::Src1Alpha:
+ case TextureEnvParameter::Src2Alpha:
+ case TextureEnvParameter::Op0Rgb:
+ case TextureEnvParameter::Op1Rgb:
+ case TextureEnvParameter::Op2Rgb:
+ case TextureEnvParameter::Op0Alpha:
+ case TextureEnvParameter::Op1Alpha:
+ case TextureEnvParameter::Op2Alpha:
+ case TextureEnvParameter::RgbScale:
+ case TextureEnvParameter::AlphaScale:
+ case TextureEnvParameter::PointCoordReplace:
+ return 1;
+ case TextureEnvParameter::Color:
+ return 4;
+ default:
+ return 0;
+ }
+}
+
+void ConvertTextureEnvFromInt(TextureEnvParameter pname, const GLint *input, GLfloat *output)
+{
+ if (IsTextureEnvEnumParameter(pname))
+ {
+ ConvertGLenumValue(input[0], output);
+ return;
+ }
+
+ switch (pname)
+ {
+ case TextureEnvParameter::RgbScale:
+ case TextureEnvParameter::AlphaScale:
+ output[0] = static_cast<GLfloat>(input[0]);
+ break;
+ case TextureEnvParameter::Color:
+ for (int i = 0; i < 4; i++)
+ {
+ output[i] = input[i] / 255.0f;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void ConvertTextureEnvFromFixed(TextureEnvParameter pname, const GLfixed *input, GLfloat *output)
+{
+ if (IsTextureEnvEnumParameter(pname))
+ {
+ ConvertGLenumValue(input[0], output);
+ return;
+ }
+
+ switch (pname)
+ {
+ case TextureEnvParameter::RgbScale:
+ case TextureEnvParameter::AlphaScale:
+ output[0] = FixedToFloat(input[0]);
+ break;
+ case TextureEnvParameter::Color:
+ for (int i = 0; i < 4; i++)
+ {
+ output[i] = FixedToFloat(input[i]);
+ }
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void ConvertTextureEnvToInt(TextureEnvParameter pname, const GLfloat *input, GLint *output)
+{
+ if (IsTextureEnvEnumParameter(pname))
+ {
+ ConvertGLenumValue(input[0], output);
+ return;
+ }
+
+ switch (pname)
+ {
+ case TextureEnvParameter::RgbScale:
+ case TextureEnvParameter::AlphaScale:
+ output[0] = static_cast<GLint>(input[0]);
+ break;
+ case TextureEnvParameter::Color:
+ for (int i = 0; i < 4; i++)
+ {
+ output[i] = static_cast<GLint>(input[i] * 255.0f);
+ }
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void ConvertTextureEnvToFixed(TextureEnvParameter pname, const GLfloat *input, GLfixed *output)
+{
+ if (IsTextureEnvEnumParameter(pname))
+ {
+ ConvertGLenumValue(input[0], output);
+ return;
+ }
+
+ switch (pname)
+ {
+ case TextureEnvParameter::RgbScale:
+ case TextureEnvParameter::AlphaScale:
+ output[0] = FloatToFixed(input[0]);
+ break;
+ case TextureEnvParameter::Color:
+ for (int i = 0; i < 4; i++)
+ {
+ output[i] = FloatToFixed(input[i]);
+ }
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void SetTextureEnv(unsigned int unit,
+ GLES1State *state,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ const GLfloat *params)
+{
+ TextureEnvironmentParameters &env = state->textureEnvironment(unit);
+ GLenum asEnum = ConvertToGLenum(params[0]);
+
+ switch (target)
+ {
+ case TextureEnvTarget::Env:
+ switch (pname)
+ {
+ case TextureEnvParameter::Mode:
+ env.mode = FromGLenum<TextureEnvMode>(asEnum);
+ break;
+ case TextureEnvParameter::CombineRgb:
+ env.combineRgb = FromGLenum<TextureCombine>(asEnum);
+ break;
+ case TextureEnvParameter::CombineAlpha:
+ env.combineAlpha = FromGLenum<TextureCombine>(asEnum);
+ break;
+ case TextureEnvParameter::Src0Rgb:
+ env.src0Rgb = FromGLenum<TextureSrc>(asEnum);
+ break;
+ case TextureEnvParameter::Src1Rgb:
+ env.src1Rgb = FromGLenum<TextureSrc>(asEnum);
+ break;
+ case TextureEnvParameter::Src2Rgb:
+ env.src2Rgb = FromGLenum<TextureSrc>(asEnum);
+ break;
+ case TextureEnvParameter::Src0Alpha:
+ env.src0Alpha = FromGLenum<TextureSrc>(asEnum);
+ break;
+ case TextureEnvParameter::Src1Alpha:
+ env.src1Alpha = FromGLenum<TextureSrc>(asEnum);
+ break;
+ case TextureEnvParameter::Src2Alpha:
+ env.src2Alpha = FromGLenum<TextureSrc>(asEnum);
+ break;
+ case TextureEnvParameter::Op0Rgb:
+ env.op0Rgb = FromGLenum<TextureOp>(asEnum);
+ break;
+ case TextureEnvParameter::Op1Rgb:
+ env.op1Rgb = FromGLenum<TextureOp>(asEnum);
+ break;
+ case TextureEnvParameter::Op2Rgb:
+ env.op2Rgb = FromGLenum<TextureOp>(asEnum);
+ break;
+ case TextureEnvParameter::Op0Alpha:
+ env.op0Alpha = FromGLenum<TextureOp>(asEnum);
+ break;
+ case TextureEnvParameter::Op1Alpha:
+ env.op1Alpha = FromGLenum<TextureOp>(asEnum);
+ break;
+ case TextureEnvParameter::Op2Alpha:
+ env.op2Alpha = FromGLenum<TextureOp>(asEnum);
+ break;
+ case TextureEnvParameter::Color:
+ env.color = ColorF::fromData(params);
+ break;
+ case TextureEnvParameter::RgbScale:
+ env.rgbScale = params[0];
+ break;
+ case TextureEnvParameter::AlphaScale:
+ env.alphaScale = params[0];
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ break;
+ case TextureEnvTarget::PointSprite:
+ switch (pname)
+ {
+ case TextureEnvParameter::PointCoordReplace:
+ env.pointSpriteCoordReplace = static_cast<bool>(params[0]);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void GetTextureEnv(unsigned int unit,
+ const GLES1State *state,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLfloat *params)
+{
+ const TextureEnvironmentParameters &env = state->textureEnvironment(unit);
+
+ switch (target)
+ {
+ case TextureEnvTarget::Env:
+ switch (pname)
+ {
+ case TextureEnvParameter::Mode:
+ ConvertPackedEnum(env.mode, params);
+ break;
+ case TextureEnvParameter::CombineRgb:
+ ConvertPackedEnum(env.combineRgb, params);
+ break;
+ case TextureEnvParameter::CombineAlpha:
+ ConvertPackedEnum(env.combineAlpha, params);
+ break;
+ case TextureEnvParameter::Src0Rgb:
+ ConvertPackedEnum(env.src0Rgb, params);
+ break;
+ case TextureEnvParameter::Src1Rgb:
+ ConvertPackedEnum(env.src1Rgb, params);
+ break;
+ case TextureEnvParameter::Src2Rgb:
+ ConvertPackedEnum(env.src2Rgb, params);
+ break;
+ case TextureEnvParameter::Src0Alpha:
+ ConvertPackedEnum(env.src0Alpha, params);
+ break;
+ case TextureEnvParameter::Src1Alpha:
+ ConvertPackedEnum(env.src1Alpha, params);
+ break;
+ case TextureEnvParameter::Src2Alpha:
+ ConvertPackedEnum(env.src2Alpha, params);
+ break;
+ case TextureEnvParameter::Op0Rgb:
+ ConvertPackedEnum(env.op0Rgb, params);
+ break;
+ case TextureEnvParameter::Op1Rgb:
+ ConvertPackedEnum(env.op1Rgb, params);
+ break;
+ case TextureEnvParameter::Op2Rgb:
+ ConvertPackedEnum(env.op2Rgb, params);
+ break;
+ case TextureEnvParameter::Op0Alpha:
+ ConvertPackedEnum(env.op0Alpha, params);
+ break;
+ case TextureEnvParameter::Op1Alpha:
+ ConvertPackedEnum(env.op1Alpha, params);
+ break;
+ case TextureEnvParameter::Op2Alpha:
+ ConvertPackedEnum(env.op2Alpha, params);
+ break;
+ case TextureEnvParameter::Color:
+ env.color.writeData(params);
+ break;
+ case TextureEnvParameter::RgbScale:
+ *params = env.rgbScale;
+ break;
+ case TextureEnvParameter::AlphaScale:
+ *params = env.alphaScale;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ break;
+ case TextureEnvTarget::PointSprite:
+ switch (pname)
+ {
+ case TextureEnvParameter::PointCoordReplace:
+ *params = static_cast<GLfloat>(env.pointSpriteCoordReplace);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+unsigned int GetPointParameterCount(PointParameter pname)
+{
+ switch (pname)
+ {
+ case PointParameter::PointSizeMin:
+ case PointParameter::PointSizeMax:
+ case PointParameter::PointFadeThresholdSize:
+ return 1;
+ case PointParameter::PointDistanceAttenuation:
+ return 3;
+ default:
+ return 0;
+ }
+}
+
+void SetPointParameter(GLES1State *state, PointParameter pname, const GLfloat *params)
+{
+
+ PointParameters &pointParams = state->pointParameters();
+
+ switch (pname)
+ {
+ case PointParameter::PointSizeMin:
+ pointParams.pointSizeMin = params[0];
+ break;
+ case PointParameter::PointSizeMax:
+ pointParams.pointSizeMax = params[0];
+ break;
+ case PointParameter::PointFadeThresholdSize:
+ pointParams.pointFadeThresholdSize = params[0];
+ break;
+ case PointParameter::PointDistanceAttenuation:
+ for (unsigned int i = 0; i < 3; i++)
+ {
+ pointParams.pointDistanceAttenuation[i] = params[i];
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+void GetPointParameter(const GLES1State *state, PointParameter pname, GLfloat *params)
+{
+ const PointParameters &pointParams = state->pointParameters();
+
+ switch (pname)
+ {
+ case PointParameter::PointSizeMin:
+ params[0] = pointParams.pointSizeMin;
+ break;
+ case PointParameter::PointSizeMax:
+ params[0] = pointParams.pointSizeMax;
+ break;
+ case PointParameter::PointFadeThresholdSize:
+ params[0] = pointParams.pointFadeThresholdSize;
+ break;
+ case PointParameter::PointDistanceAttenuation:
+ for (unsigned int i = 0; i < 3; i++)
+ {
+ params[i] = pointParams.pointDistanceAttenuation[i];
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+void SetPointSize(GLES1State *state, GLfloat size)
+{
+ PointParameters &params = state->pointParameters();
+ params.pointSize = size;
+}
+
+void GetPointSize(GLES1State *state, GLfloat *sizeOut)
+{
+ const PointParameters &params = state->pointParameters();
+ *sizeOut = params.pointSize;
+}
+
+unsigned int GetTexParameterCount(GLenum pname)
+{
+ switch (pname)
+ {
+ case GL_TEXTURE_CROP_RECT_OES:
+ case GL_TEXTURE_BORDER_COLOR:
+ return 4;
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_USAGE_ANGLE:
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ case GL_TEXTURE_SWIZZLE_R:
+ case GL_TEXTURE_SWIZZLE_G:
+ case GL_TEXTURE_SWIZZLE_B:
+ case GL_TEXTURE_SWIZZLE_A:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ case GL_TEXTURE_NATIVE_ID_ANGLE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+} // namespace gl
+
+namespace egl
+{
+
+void QueryConfigAttrib(const Config *config, EGLint attribute, EGLint *value)
+{
+ ASSERT(config != nullptr);
+ switch (attribute)
+ {
+ case EGL_BUFFER_SIZE:
+ *value = config->bufferSize;
+ break;
+ case EGL_ALPHA_SIZE:
+ *value = config->alphaSize;
+ break;
+ case EGL_BLUE_SIZE:
+ *value = config->blueSize;
+ break;
+ case EGL_GREEN_SIZE:
+ *value = config->greenSize;
+ break;
+ case EGL_RED_SIZE:
+ *value = config->redSize;
+ break;
+ case EGL_DEPTH_SIZE:
+ *value = config->depthSize;
+ break;
+ case EGL_STENCIL_SIZE:
+ *value = config->stencilSize;
+ break;
+ case EGL_CONFIG_CAVEAT:
+ *value = config->configCaveat;
+ break;
+ case EGL_CONFIG_ID:
+ *value = config->configID;
+ break;
+ case EGL_LEVEL:
+ *value = config->level;
+ break;
+ case EGL_NATIVE_RENDERABLE:
+ *value = config->nativeRenderable;
+ break;
+ case EGL_NATIVE_VISUAL_ID:
+ *value = config->nativeVisualID;
+ break;
+ case EGL_NATIVE_VISUAL_TYPE:
+ *value = config->nativeVisualType;
+ break;
+ case EGL_SAMPLES:
+ *value = config->samples;
+ break;
+ case EGL_SAMPLE_BUFFERS:
+ *value = config->sampleBuffers;
+ break;
+ case EGL_SURFACE_TYPE:
+ *value = config->surfaceType;
+ break;
+ case EGL_TRANSPARENT_TYPE:
+ *value = config->transparentType;
+ break;
+ case EGL_TRANSPARENT_BLUE_VALUE:
+ *value = config->transparentBlueValue;
+ break;
+ case EGL_TRANSPARENT_GREEN_VALUE:
+ *value = config->transparentGreenValue;
+ break;
+ case EGL_TRANSPARENT_RED_VALUE:
+ *value = config->transparentRedValue;
+ break;
+ case EGL_BIND_TO_TEXTURE_RGB:
+ *value = config->bindToTextureRGB;
+ break;
+ case EGL_BIND_TO_TEXTURE_RGBA:
+ *value = config->bindToTextureRGBA;
+ break;
+ case EGL_MIN_SWAP_INTERVAL:
+ *value = config->minSwapInterval;
+ break;
+ case EGL_MAX_SWAP_INTERVAL:
+ *value = config->maxSwapInterval;
+ break;
+ case EGL_LUMINANCE_SIZE:
+ *value = config->luminanceSize;
+ break;
+ case EGL_ALPHA_MASK_SIZE:
+ *value = config->alphaMaskSize;
+ break;
+ case EGL_COLOR_BUFFER_TYPE:
+ *value = config->colorBufferType;
+ break;
+ case EGL_RENDERABLE_TYPE:
+ *value = config->renderableType;
+ break;
+ case EGL_MATCH_NATIVE_PIXMAP:
+ *value = false;
+ UNIMPLEMENTED();
+ break;
+ case EGL_CONFORMANT:
+ *value = config->conformant;
+ break;
+ case EGL_MAX_PBUFFER_WIDTH:
+ *value = config->maxPBufferWidth;
+ break;
+ case EGL_MAX_PBUFFER_HEIGHT:
+ *value = config->maxPBufferHeight;
+ break;
+ case EGL_MAX_PBUFFER_PIXELS:
+ *value = config->maxPBufferPixels;
+ break;
+ case EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE:
+ *value = config->optimalOrientation;
+ break;
+ case EGL_COLOR_COMPONENT_TYPE_EXT:
+ *value = config->colorComponentType;
+ break;
+ case EGL_RECORDABLE_ANDROID:
+ *value = config->recordable;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QueryContextAttrib(const gl::Context *context, EGLint attribute, EGLint *value)
+{
+ switch (attribute)
+ {
+ case EGL_CONFIG_ID:
+ *value = context->getConfig()->configID;
+ break;
+ case EGL_CONTEXT_CLIENT_TYPE:
+ *value = context->getClientType();
+ break;
+ case EGL_CONTEXT_CLIENT_VERSION:
+ *value = context->getClientMajorVersion();
+ break;
+ case EGL_RENDER_BUFFER:
+ *value = context->getRenderBuffer();
+ break;
+ case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ *value = context->isRobustResourceInitEnabled();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value)
+{
+ switch (attribute)
+ {
+ case EGL_GL_COLORSPACE:
+ *value = surface->getGLColorspace();
+ break;
+ case EGL_VG_ALPHA_FORMAT:
+ *value = surface->getVGAlphaFormat();
+ break;
+ case EGL_VG_COLORSPACE:
+ *value = surface->getVGColorspace();
+ break;
+ case EGL_CONFIG_ID:
+ *value = surface->getConfig()->configID;
+ break;
+ case EGL_HEIGHT:
+ *value = surface->getHeight();
+ break;
+ case EGL_HORIZONTAL_RESOLUTION:
+ *value = surface->getHorizontalResolution();
+ break;
+ case EGL_LARGEST_PBUFFER:
+ // The EGL spec states that value is not written if the surface is not a pbuffer
+ if (surface->getType() == EGL_PBUFFER_BIT)
+ {
+ *value = surface->getLargestPbuffer();
+ }
+ break;
+ case EGL_MIPMAP_TEXTURE:
+ // The EGL spec states that value is not written if the surface is not a pbuffer
+ if (surface->getType() == EGL_PBUFFER_BIT)
+ {
+ *value = surface->getMipmapTexture();
+ }
+ break;
+ case EGL_MIPMAP_LEVEL:
+ // The EGL spec states that value is not written if the surface is not a pbuffer
+ if (surface->getType() == EGL_PBUFFER_BIT)
+ {
+ *value = surface->getMipmapLevel();
+ }
+ break;
+ case EGL_MULTISAMPLE_RESOLVE:
+ *value = surface->getMultisampleResolve();
+ break;
+ case EGL_PIXEL_ASPECT_RATIO:
+ *value = surface->getPixelAspectRatio();
+ break;
+ case EGL_RENDER_BUFFER:
+ *value = surface->getRenderBuffer();
+ break;
+ case EGL_SWAP_BEHAVIOR:
+ *value = surface->getSwapBehavior();
+ break;
+ case EGL_TEXTURE_FORMAT:
+ // The EGL spec states that value is not written if the surface is not a pbuffer
+ if (surface->getType() == EGL_PBUFFER_BIT)
+ {
+ *value = ToEGLenum(surface->getTextureFormat());
+ }
+ break;
+ case EGL_TEXTURE_TARGET:
+ // The EGL spec states that value is not written if the surface is not a pbuffer
+ if (surface->getType() == EGL_PBUFFER_BIT)
+ {
+ *value = surface->getTextureTarget();
+ }
+ break;
+ case EGL_VERTICAL_RESOLUTION:
+ *value = surface->getVerticalResolution();
+ break;
+ case EGL_WIDTH:
+ *value = surface->getWidth();
+ break;
+ case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
+ *value = surface->isPostSubBufferSupported();
+ break;
+ case EGL_FIXED_SIZE_ANGLE:
+ *value = surface->isFixedSize();
+ break;
+ case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
+ *value = surface->flexibleSurfaceCompatibilityRequested();
+ break;
+ case EGL_SURFACE_ORIENTATION_ANGLE:
+ *value = surface->getOrientation();
+ break;
+ case EGL_DIRECT_COMPOSITION_ANGLE:
+ *value = surface->directComposition();
+ break;
+ case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ *value = surface->isRobustResourceInitEnabled();
+ break;
+ case EGL_TIMESTAMPS_ANDROID:
+ *value = surface->isTimestampsEnabled();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+void SetSurfaceAttrib(Surface *surface, EGLint attribute, EGLint value)
+{
+ switch (attribute)
+ {
+ case EGL_MIPMAP_LEVEL:
+ surface->setMipmapLevel(value);
+ break;
+ case EGL_MULTISAMPLE_RESOLVE:
+ surface->setMultisampleResolve(value);
+ break;
+ case EGL_SWAP_BEHAVIOR:
+ surface->setSwapBehavior(value);
+ break;
+ case EGL_WIDTH:
+ surface->setFixedWidth(value);
+ break;
+ case EGL_HEIGHT:
+ surface->setFixedHeight(value);
+ break;
+ case EGL_TIMESTAMPS_ANDROID:
+ surface->setTimestampsEnabled(value != EGL_FALSE);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+Error GetSyncAttrib(Display *display, Sync *sync, EGLint attribute, EGLint *value)
+{
+ switch (attribute)
+ {
+ case EGL_SYNC_TYPE_KHR:
+ *value = sync->getType();
+ return NoError();
+
+ case EGL_SYNC_STATUS_KHR:
+ return sync->getStatus(display, value);
+
+ case EGL_SYNC_CONDITION_KHR:
+ *value = sync->getCondition();
+ return NoError();
+
+ default:
+ break;
+ }
+
+ UNREACHABLE();
+ return NoError();
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/queryutils.h b/gfx/angle/checkout/src/libANGLE/queryutils.h
new file mode 100644
index 0000000000..8bfe3b20eb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/queryutils.h
@@ -0,0 +1,248 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// queryutils.h: Utilities for querying values from GL objects
+
+#ifndef LIBANGLE_QUERYUTILS_H_
+#define LIBANGLE_QUERYUTILS_H_
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+
+#include <EGL/egl.h>
+
+namespace gl
+{
+class Buffer;
+class Context;
+class Sync;
+class Framebuffer;
+class GLES1State;
+class Program;
+class Renderbuffer;
+class Sampler;
+class Shader;
+class Texture;
+struct TextureCaps;
+struct UniformBlock;
+struct VertexAttribute;
+class VertexBinding;
+struct VertexAttribCurrentValueData;
+
+void QueryFramebufferAttachmentParameteriv(const Context *context,
+ const Framebuffer *framebuffer,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params);
+void QueryBufferParameteri64v(const Buffer *buffer, GLenum pname, GLint64 *params);
+void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params);
+void QueryProgramiv(Context *context, const Program *program, GLenum pname, GLint *params);
+void QueryRenderbufferiv(const Context *context,
+ const Renderbuffer *renderbuffer,
+ GLenum pname,
+ GLint *params);
+void QueryShaderiv(const Context *context, Shader *shader, GLenum pname, GLint *params);
+void QueryTexLevelParameterfv(const Texture *texture,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+void QueryTexLevelParameteriv(const Texture *texture,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+void QueryTexParameterfv(const Texture *texture, GLenum pname, GLfloat *params);
+void QueryTexParameteriv(const Texture *texture, GLenum pname, GLint *params);
+void QueryTexParameterIiv(const Texture *texture, GLenum pname, GLint *params);
+void QueryTexParameterIuiv(const Texture *texture, GLenum pname, GLuint *params);
+void QuerySamplerParameterfv(const Sampler *sampler, GLenum pname, GLfloat *params);
+void QuerySamplerParameteriv(const Sampler *sampler, GLenum pname, GLint *params);
+void QuerySamplerParameterIiv(const Sampler *sampler, GLenum pname, GLint *params);
+void QuerySamplerParameterIuiv(const Sampler *sampler, GLenum pname, GLuint *params);
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using the following
+// functions.
+void QueryVertexAttribfv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLfloat *params);
+
+void QueryVertexAttribiv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLint *params);
+
+void QueryVertexAttribPointerv(const VertexAttribute &attrib, GLenum pname, void **pointer);
+
+void QueryVertexAttribIiv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLint *params);
+
+void QueryVertexAttribIuiv(const VertexAttribute &attrib,
+ const VertexBinding &binding,
+ const VertexAttribCurrentValueData &currentValueData,
+ GLenum pname,
+ GLuint *params);
+
+void QueryActiveUniformBlockiv(const Program *program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params);
+
+void QueryInternalFormativ(const TextureCaps &format, GLenum pname, GLsizei bufSize, GLint *params);
+
+void QueryFramebufferParameteriv(const Framebuffer *framebuffer, GLenum pname, GLint *params);
+
+angle::Result QuerySynciv(const Context *context,
+ const Sync *sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values);
+
+void SetTexParameterf(Context *context, Texture *texture, GLenum pname, GLfloat param);
+void SetTexParameterfv(Context *context, Texture *texture, GLenum pname, const GLfloat *params);
+void SetTexParameteri(Context *context, Texture *texture, GLenum pname, GLint param);
+void SetTexParameteriv(Context *context, Texture *texture, GLenum pname, const GLint *params);
+void SetTexParameterIiv(Context *context, Texture *texture, GLenum pname, const GLint *params);
+void SetTexParameterIuiv(Context *context, Texture *texture, GLenum pname, const GLuint *params);
+
+void SetSamplerParameterf(Context *context, Sampler *sampler, GLenum pname, GLfloat param);
+void SetSamplerParameterfv(Context *context, Sampler *sampler, GLenum pname, const GLfloat *params);
+void SetSamplerParameteri(Context *context, Sampler *sampler, GLenum pname, GLint param);
+void SetSamplerParameteriv(Context *context, Sampler *sampler, GLenum pname, const GLint *params);
+void SetSamplerParameterIiv(Context *context, Sampler *sampler, GLenum pname, const GLint *params);
+void SetSamplerParameterIuiv(Context *context,
+ Sampler *sampler,
+ GLenum pname,
+ const GLuint *params);
+
+void SetFramebufferParameteri(const Context *context,
+ Framebuffer *framebuffer,
+ GLenum pname,
+ GLint param);
+
+void SetProgramParameteri(Program *program, GLenum pname, GLint value);
+
+GLint GetUniformResourceProperty(const Program *program, GLuint index, const GLenum prop);
+
+GLuint QueryProgramResourceIndex(const Program *program,
+ GLenum programInterface,
+ const GLchar *name);
+
+void QueryProgramResourceName(const Program *program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name);
+
+GLint QueryProgramResourceLocation(const Program *program,
+ GLenum programInterface,
+ const GLchar *name);
+void QueryProgramResourceiv(const Program *program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+
+void QueryProgramInterfaceiv(const Program *program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params);
+// GLES1 emulation
+
+ClientVertexArrayType ParamToVertexArrayType(GLenum param);
+
+void SetLightParameters(GLES1State *state,
+ GLenum light,
+ LightParameter pname,
+ const GLfloat *params);
+void GetLightParameters(const GLES1State *state,
+ GLenum light,
+ LightParameter pname,
+ GLfloat *params);
+
+void SetLightModelParameters(GLES1State *state, GLenum pname, const GLfloat *params);
+void GetLightModelParameters(const GLES1State *state, GLenum pname, GLfloat *params);
+bool IsLightModelTwoSided(const GLES1State *state);
+
+void SetMaterialParameters(GLES1State *state,
+ GLenum face,
+ MaterialParameter pname,
+ const GLfloat *params);
+void GetMaterialParameters(const GLES1State *state,
+ GLenum face,
+ MaterialParameter pname,
+ GLfloat *params);
+
+unsigned int GetLightModelParameterCount(GLenum pname);
+unsigned int GetLightParameterCount(LightParameter pname);
+unsigned int GetMaterialParameterCount(MaterialParameter pname);
+
+void SetFogParameters(GLES1State *state, GLenum pname, const GLfloat *params);
+void GetFogParameters(const GLES1State *state, GLenum pname, GLfloat *params);
+unsigned int GetFogParameterCount(GLenum pname);
+
+unsigned int GetTextureEnvParameterCount(TextureEnvParameter pname);
+
+void ConvertTextureEnvFromInt(TextureEnvParameter pname, const GLint *input, GLfloat *output);
+void ConvertTextureEnvFromFixed(TextureEnvParameter pname, const GLfixed *input, GLfloat *output);
+void ConvertTextureEnvToInt(TextureEnvParameter pname, const GLfloat *input, GLint *output);
+void ConvertTextureEnvToFixed(TextureEnvParameter pname, const GLfloat *input, GLfixed *output);
+
+void SetTextureEnv(unsigned int unit,
+ GLES1State *state,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ const GLfloat *params);
+void GetTextureEnv(unsigned int unit,
+ const GLES1State *state,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLfloat *params);
+
+unsigned int GetPointParameterCount(PointParameter pname);
+
+void SetPointParameter(GLES1State *state, PointParameter pname, const GLfloat *params);
+void GetPointParameter(const GLES1State *state, PointParameter pname, GLfloat *params);
+
+void SetPointSize(GLES1State *state, GLfloat size);
+void GetPointSize(GLES1State *state, GLfloat *sizeOut);
+
+unsigned int GetTexParameterCount(GLenum pname);
+
+} // namespace gl
+
+namespace egl
+{
+struct Config;
+class Display;
+class Surface;
+class Sync;
+
+void QueryConfigAttrib(const Config *config, EGLint attribute, EGLint *value);
+
+void QueryContextAttrib(const gl::Context *context, EGLint attribute, EGLint *value);
+
+void QuerySurfaceAttrib(const Surface *surface, EGLint attribute, EGLint *value);
+void SetSurfaceAttrib(Surface *surface, EGLint attribute, EGLint value);
+Error GetSyncAttrib(Display *display, Sync *sync, EGLint attribute, EGLint *value);
+
+} // namespace egl
+
+#endif // LIBANGLE_QUERYUTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h
new file mode 100644
index 0000000000..77b773741c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h
@@ -0,0 +1,82 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferImpl.h: Defines the abstract rx::BufferImpl class.
+
+#ifndef LIBANGLE_RENDERER_BUFFERIMPL_H_
+#define LIBANGLE_RENDERER_BUFFERIMPL_H_
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/Observer.h"
+
+#include <stdint.h>
+
+namespace gl
+{
+class BufferState;
+class Context;
+} // namespace gl
+
+namespace rx
+{
+// We use two set of Subject messages. The CONTENTS_CHANGED message is signaled whenever data
+// changes, to trigger re-translation or other events. Some buffers only need to be updated when the
+// underlying driver object changes - this is notified via the STORAGE_CHANGED message.
+class BufferImpl : public angle::Subject
+{
+ public:
+ BufferImpl(const gl::BufferState &state) : mState(state) {}
+ ~BufferImpl() override {}
+ virtual void destroy(const gl::Context *context) {}
+
+ virtual angle::Result setData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ gl::BufferUsage usage) = 0;
+ virtual angle::Result setSubData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ size_t offset) = 0;
+ virtual angle::Result copySubData(const gl::Context *context,
+ BufferImpl *source,
+ GLintptr sourceOffset,
+ GLintptr destOffset,
+ GLsizeiptr size) = 0;
+ virtual angle::Result map(const gl::Context *context, GLenum access, void **mapPtr) = 0;
+ virtual angle::Result mapRange(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ void **mapPtr) = 0;
+ virtual angle::Result unmap(const gl::Context *context, GLboolean *result) = 0;
+
+ virtual angle::Result getIndexRange(const gl::Context *context,
+ gl::DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ gl::IndexRange *outRange) = 0;
+
+ // Override if accurate native memory size information is available
+ virtual GLint64 getMemorySize() const;
+
+ protected:
+ const gl::BufferState &mState;
+};
+
+inline GLint64 BufferImpl::getMemorySize() const
+{
+ return 0;
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_BUFFERIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/CompilerImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/CompilerImpl.h
new file mode 100644
index 0000000000..1683a453de
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/CompilerImpl.h
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// CompilerImpl.h: Defines the rx::CompilerImpl class, an implementation interface
+// for the gl::Compiler object.
+
+#include "GLSLANG/ShaderLang.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+
+#ifndef LIBANGLE_RENDERER_COMPILERIMPL_H_
+# define LIBANGLE_RENDERER_COMPILERIMPL_H_
+
+namespace rx
+{
+
+class CompilerImpl : angle::NonCopyable
+{
+ public:
+ CompilerImpl() {}
+ virtual ~CompilerImpl() {}
+
+ // TODO(jmadill): Expose translator built-in resources init method.
+ virtual ShShaderOutput getTranslatorOutputType() const = 0;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_COMPILERIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.cpp
new file mode 100644
index 0000000000..f1f29f5cfa
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.cpp
@@ -0,0 +1,138 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ContextImpl:
+// Implementation-specific functionality associated with a GL Context.
+//
+
+#include "libANGLE/renderer/ContextImpl.h"
+
+#include "libANGLE/Context.h"
+
+namespace rx
+{
+ContextImpl::ContextImpl(const gl::State &state, gl::ErrorSet *errorSet)
+ : mState(state), mMemoryProgramCache(nullptr), mErrors(errorSet)
+{}
+
+ContextImpl::~ContextImpl() {}
+
+void ContextImpl::stencilFillPath(const gl::Path *path, GLenum fillMode, GLuint mask)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::stencilStrokePath(const gl::Path *path, GLint reference, GLuint mask)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::coverFillPath(const gl::Path *path, GLenum coverMode)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::coverStrokePath(const gl::Path *path, GLenum coverMode)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::stencilThenCoverFillPath(const gl::Path *path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::stencilThenCoverStrokePath(const gl::Path *path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::coverFillPathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ UNREACHABLE();
+}
+
+void ContextImpl::invalidateTexture(gl::TextureType target)
+{
+ UNREACHABLE();
+}
+
+angle::Result ContextImpl::onUnMakeCurrent(const gl::Context *context)
+{
+ return angle::Result::Continue;
+}
+
+void ContextImpl::setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache)
+{
+ mMemoryProgramCache = memoryProgramCache;
+}
+
+void ContextImpl::handleError(GLenum errorCode,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line)
+{
+ std::stringstream errorStream;
+ errorStream << "Internal error: " << gl::FmtHex(errorCode) << ": " << message;
+ mErrors->handleError(errorCode, errorStream.str().c_str(), file, function, line);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.h
new file mode 100644
index 0000000000..c71bdd651e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/ContextImpl.h
@@ -0,0 +1,207 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ContextImpl:
+// Implementation-specific functionality associated with a GL Context.
+//
+
+#ifndef LIBANGLE_RENDERER_CONTEXTIMPL_H_
+#define LIBANGLE_RENDERER_CONTEXTIMPL_H_
+
+#include <vector>
+
+#include "common/angleutils.h"
+#include "libANGLE/State.h"
+#include "libANGLE/renderer/GLImplFactory.h"
+
+namespace gl
+{
+class ErrorSet;
+class MemoryProgramCache;
+class Path;
+class Semaphore;
+struct Workarounds;
+} // namespace gl
+
+namespace rx
+{
+class ContextImpl : public GLImplFactory
+{
+ public:
+ ContextImpl(const gl::State &state, gl::ErrorSet *errorSet);
+ ~ContextImpl() override;
+
+ virtual void onDestroy(const gl::Context *context) {}
+
+ virtual angle::Result initialize() = 0;
+
+ // Flush and finish.
+ virtual angle::Result flush(const gl::Context *context) = 0;
+ virtual angle::Result finish(const gl::Context *context) = 0;
+
+ // Drawing methods.
+ virtual angle::Result drawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count) = 0;
+ virtual angle::Result drawArraysInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instanceCount) = 0;
+
+ virtual angle::Result drawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices) = 0;
+ virtual angle::Result drawElementsInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances) = 0;
+ virtual angle::Result drawRangeElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices) = 0;
+
+ virtual angle::Result drawArraysIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ const void *indirect) = 0;
+ virtual angle::Result drawElementsIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType type,
+ const void *indirect) = 0;
+
+ // CHROMIUM_path_rendering path drawing methods.
+ virtual void stencilFillPath(const gl::Path *path, GLenum fillMode, GLuint mask);
+ virtual void stencilStrokePath(const gl::Path *path, GLint reference, GLuint mask);
+ virtual void coverFillPath(const gl::Path *path, GLenum coverMode);
+ virtual void coverStrokePath(const gl::Path *path, GLenum coverMode);
+ virtual void stencilThenCoverFillPath(const gl::Path *path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode);
+
+ virtual void stencilThenCoverStrokePath(const gl::Path *path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode);
+
+ virtual void coverFillPathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ virtual void coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ virtual void stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ virtual void stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ virtual void stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ virtual void stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
+ GLenum coverMode,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+
+ // Device loss
+ virtual gl::GraphicsResetStatus getResetStatus() = 0;
+
+ // Vendor and description strings.
+ virtual std::string getVendorString() const = 0;
+ virtual std::string getRendererDescription() const = 0;
+
+ // EXT_debug_marker
+ virtual void insertEventMarker(GLsizei length, const char *marker) = 0;
+ virtual void pushGroupMarker(GLsizei length, const char *marker) = 0;
+ virtual void popGroupMarker() = 0;
+
+ // KHR_debug
+ virtual void pushDebugGroup(GLenum source, GLuint id, const std::string &message) = 0;
+ virtual void popDebugGroup() = 0;
+
+ // KHR_parallel_shader_compile
+ virtual void setMaxShaderCompilerThreads(GLuint count) {}
+
+ // GL_ANGLE_texture_storage_external
+ virtual void invalidateTexture(gl::TextureType target);
+
+ // State sync with dirty bits.
+ virtual angle::Result syncState(const gl::Context *context,
+ const gl::State::DirtyBits &dirtyBits,
+ const gl::State::DirtyBits &bitMask) = 0;
+
+ // Disjoint timer queries
+ virtual GLint getGPUDisjoint() = 0;
+ virtual GLint64 getTimestamp() = 0;
+
+ // Context switching
+ virtual angle::Result onMakeCurrent(const gl::Context *context) = 0;
+ virtual angle::Result onUnMakeCurrent(const gl::Context *context);
+
+ // Native capabilities, unmodified by gl::Context.
+ virtual gl::Caps getNativeCaps() const = 0;
+ virtual const gl::TextureCapsMap &getNativeTextureCaps() const = 0;
+ virtual const gl::Extensions &getNativeExtensions() const = 0;
+ virtual const gl::Limitations &getNativeLimitations() const = 0;
+
+ virtual angle::Result dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ) = 0;
+ virtual angle::Result dispatchComputeIndirect(const gl::Context *context,
+ GLintptr indirect) = 0;
+
+ virtual angle::Result memoryBarrier(const gl::Context *context, GLbitfield barriers) = 0;
+ virtual angle::Result memoryBarrierByRegion(const gl::Context *context,
+ GLbitfield barriers) = 0;
+
+ const gl::State &getState() { return mState; }
+ int getClientMajorVersion() const { return mState.getClientMajorVersion(); }
+ int getClientMinorVersion() const { return mState.getClientMinorVersion(); }
+ const gl::Caps &getCaps() const { return mState.getCaps(); }
+ const gl::TextureCapsMap &getTextureCaps() const { return mState.getTextureCaps(); }
+ const gl::Extensions &getExtensions() const { return mState.getExtensions(); }
+ const gl::Limitations &getLimitations() const { return mState.getLimitations(); }
+
+ // A common GL driver behaviour is to trigger dynamic shader recompilation on a draw call,
+ // based on the current render states. We store a mutable pointer to the program cache so
+ // on draw calls we can store the refreshed shaders in the cache.
+ void setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache);
+
+ void handleError(GLenum errorCode,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line);
+
+ protected:
+ const gl::State &mState;
+ gl::MemoryProgramCache *mMemoryProgramCache;
+ gl::ErrorSet *mErrors;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_CONTEXTIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.cpp
new file mode 100644
index 0000000000..840a89fb4c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.cpp
@@ -0,0 +1,18 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DeviceImpl.cpp: Implementation methods of egl::Device
+
+#include "libANGLE/renderer/DeviceImpl.h"
+
+namespace rx
+{
+
+DeviceImpl::DeviceImpl() {}
+
+DeviceImpl::~DeviceImpl() {}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.h
new file mode 100644
index 0000000000..353bb978be
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/DeviceImpl.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DeviceImpl.h: Implementation methods of egl::Device
+
+#ifndef LIBANGLE_RENDERER_DEVICEIMPL_H_
+#define LIBANGLE_RENDERER_DEVICEIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Error.h"
+
+namespace egl
+{
+class Device;
+}
+
+namespace rx
+{
+class DeviceImpl : angle::NonCopyable
+{
+ public:
+ DeviceImpl();
+ virtual ~DeviceImpl();
+
+ virtual egl::Error initialize() = 0;
+
+ virtual egl::Error getDevice(void **outValue) = 0;
+ virtual EGLint getType() = 0;
+ virtual void generateExtensions(egl::DeviceExtensions *outExtensions) const = 0;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_DEVICEIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.cpp
new file mode 100644
index 0000000000..da32d47486
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.cpp
@@ -0,0 +1,66 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DisplayImpl.cpp: Implementation methods of egl::Display
+
+#include "libANGLE/renderer/DisplayImpl.h"
+
+#include "libANGLE/Display.h"
+#include "libANGLE/Surface.h"
+
+namespace rx
+{
+
+DisplayImpl::DisplayImpl(const egl::DisplayState &state)
+ : mState(state), mExtensionsInitialized(false), mCapsInitialized(false), mBlobCache(nullptr)
+{}
+
+DisplayImpl::~DisplayImpl()
+{
+ ASSERT(mState.surfaceSet.empty());
+}
+
+const egl::DisplayExtensions &DisplayImpl::getExtensions() const
+{
+ if (!mExtensionsInitialized)
+ {
+ generateExtensions(&mExtensions);
+ mExtensionsInitialized = true;
+ }
+
+ return mExtensions;
+}
+
+egl::Error DisplayImpl::validateClientBuffer(const egl::Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const
+{
+ UNREACHABLE();
+ return egl::EglBadDisplay() << "DisplayImpl::validateClientBuffer unimplemented.";
+}
+
+egl::Error DisplayImpl::validateImageClientBuffer(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const
+{
+ UNREACHABLE();
+ return egl::EglBadDisplay() << "DisplayImpl::validateImageClientBuffer unimplemented.";
+}
+
+const egl::Caps &DisplayImpl::getCaps() const
+{
+ if (!mCapsInitialized)
+ {
+ generateCaps(&mCaps);
+ mCapsInitialized = true;
+ }
+
+ return mCaps;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.h
new file mode 100644
index 0000000000..06a5a7d426
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/DisplayImpl.h
@@ -0,0 +1,123 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DisplayImpl.h: Implementation methods of egl::Display
+
+#ifndef LIBANGLE_RENDERER_DISPLAYIMPL_H_
+#define LIBANGLE_RENDERER_DISPLAYIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/Stream.h"
+#include "libANGLE/Version.h"
+#include "libANGLE/renderer/EGLImplFactory.h"
+#include "platform/Feature.h"
+
+#include <set>
+#include <vector>
+
+namespace angle
+{
+struct FrontendFeatures;
+} // namespace angle
+
+namespace egl
+{
+class AttributeMap;
+class BlobCache;
+class Display;
+struct DisplayState;
+struct Config;
+class Surface;
+class ImageSibling;
+class Thread;
+} // namespace egl
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace rx
+{
+class SurfaceImpl;
+class ImageImpl;
+struct ConfigDesc;
+class DeviceImpl;
+class StreamProducerImpl;
+
+class DisplayImpl : public EGLImplFactory
+{
+ public:
+ DisplayImpl(const egl::DisplayState &state);
+ ~DisplayImpl() override;
+
+ virtual egl::Error initialize(egl::Display *display) = 0;
+ virtual void terminate() = 0;
+
+ virtual egl::Error makeCurrent(egl::Surface *drawSurface,
+ egl::Surface *readSurface,
+ gl::Context *context) = 0;
+
+ virtual egl::ConfigSet generateConfigs() = 0;
+
+ virtual bool testDeviceLost() = 0;
+ virtual egl::Error restoreLostDevice(const egl::Display *display) = 0;
+
+ virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0;
+ virtual egl::Error validateClientBuffer(const egl::Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const;
+ virtual egl::Error validateImageClientBuffer(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const;
+
+ virtual std::string getVendorString() const = 0;
+
+ virtual DeviceImpl *createDevice() = 0;
+
+ virtual egl::Error waitClient(const gl::Context *context) = 0;
+ virtual egl::Error waitNative(const gl::Context *context, EGLint engine) = 0;
+ virtual gl::Version getMaxSupportedESVersion() const = 0;
+ virtual gl::Version getMaxConformantESVersion() const = 0;
+ const egl::Caps &getCaps() const;
+
+ virtual void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) {}
+
+ const egl::DisplayExtensions &getExtensions() const;
+
+ void setBlobCache(egl::BlobCache *blobCache) { mBlobCache = blobCache; }
+ egl::BlobCache *getBlobCache() const { return mBlobCache; }
+
+ virtual void initializeFrontendFeatures(angle::FrontendFeatures *features) const {}
+
+ virtual void populateFeatureList(angle::FeatureList *features) = 0;
+
+ const egl::DisplayState &getState() const { return mState; }
+
+ protected:
+ const egl::DisplayState &mState;
+
+ private:
+ virtual void generateExtensions(egl::DisplayExtensions *outExtensions) const = 0;
+ virtual void generateCaps(egl::Caps *outCaps) const = 0;
+
+ mutable bool mExtensionsInitialized;
+ mutable egl::DisplayExtensions mExtensions;
+
+ mutable bool mCapsInitialized;
+ mutable egl::Caps mCaps;
+
+ egl::BlobCache *mBlobCache;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_DISPLAYIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/EGLImplFactory.h b/gfx/angle/checkout/src/libANGLE/renderer/EGLImplFactory.h
new file mode 100644
index 0000000000..3748953ba2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/EGLImplFactory.h
@@ -0,0 +1,99 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// EGLImplFactory.h:
+// Factory interface for EGL Impl objects.
+//
+
+#ifndef LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
+#define LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
+
+#include "libANGLE/Stream.h"
+
+namespace egl
+{
+class AttributeMap;
+struct Config;
+class ImageSibling;
+struct ImageState;
+struct SurfaceState;
+} // namespace egl
+
+namespace gl
+{
+class Context;
+class ErrorSet;
+class State;
+} // namespace gl
+
+namespace rx
+{
+class ContextImpl;
+class EGLSyncImpl;
+class ImageImpl;
+class ExternalImageSiblingImpl;
+class SurfaceImpl;
+
+class EGLImplFactory : angle::NonCopyable
+{
+ public:
+ EGLImplFactory() {}
+ virtual ~EGLImplFactory() {}
+
+ virtual SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
+ EGLNativeWindowType window,
+ const egl::AttributeMap &attribs) = 0;
+ virtual SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
+ const egl::AttributeMap &attribs) = 0;
+ virtual SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) = 0;
+ virtual SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
+ NativePixmapType nativePixmap,
+ const egl::AttributeMap &attribs) = 0;
+
+ virtual ImageImpl *createImage(const egl::ImageState &state,
+ const gl::Context *context,
+ EGLenum target,
+ const egl::AttributeMap &attribs) = 0;
+
+ virtual ContextImpl *createContext(const gl::State &state,
+ gl::ErrorSet *errorSet,
+ const egl::Config *configuration,
+ const gl::Context *shareContext,
+ const egl::AttributeMap &attribs) = 0;
+
+ virtual StreamProducerImpl *createStreamProducerD3DTexture(
+ egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs) = 0;
+
+ virtual ExternalImageSiblingImpl *createExternalImageSibling(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs);
+
+ virtual EGLSyncImpl *createSync(const egl::AttributeMap &attribs);
+};
+
+inline ExternalImageSiblingImpl *EGLImplFactory::createExternalImageSibling(
+ const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs)
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+inline EGLSyncImpl *EGLImplFactory::createSync(const egl::AttributeMap &attribs)
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/EGLSyncImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/EGLSyncImpl.h
new file mode 100644
index 0000000000..5992c4841e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/EGLSyncImpl.h
@@ -0,0 +1,55 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// EGLSyncImpl.h: Defines the rx::EGLSyncImpl class.
+
+#ifndef LIBANGLE_RENDERER_EGLSYNCIMPL_H_
+#define LIBANGLE_RENDERER_EGLSYNCIMPL_H_
+
+#include "libANGLE/Error.h"
+
+#include "common/angleutils.h"
+
+#include "angle_gl.h"
+
+namespace egl
+{
+class Display;
+} // namespace egl
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace rx
+{
+class EGLSyncImpl : angle::NonCopyable
+{
+ public:
+ EGLSyncImpl() {}
+ virtual ~EGLSyncImpl() {}
+
+ virtual void onDestroy(const egl::Display *display) {}
+
+ virtual egl::Error initialize(const egl::Display *display,
+ const gl::Context *context,
+ EGLenum type) = 0;
+ virtual egl::Error clientWait(const egl::Display *display,
+ const gl::Context *context,
+ EGLint flags,
+ EGLTime timeout,
+ EGLint *outResult) = 0;
+ virtual egl::Error serverWait(const egl::Display *display,
+ const gl::Context *context,
+ EGLint flags) = 0;
+ virtual egl::Error getStatus(const egl::Display *display, EGLint *outStatus) = 0;
+
+ virtual egl::Error dupNativeFenceFD(const egl::Display *display, EGLint *result) const = 0;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_EGLSYNCIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/FenceNVImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/FenceNVImpl.h
new file mode 100644
index 0000000000..eaa055749c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/FenceNVImpl.h
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FenceNVImpl.h: Defines the rx::FenceNVImpl class.
+
+#ifndef LIBANGLE_RENDERER_FENCENVIMPL_H_
+#define LIBANGLE_RENDERER_FENCENVIMPL_H_
+
+#include "libANGLE/Error.h"
+
+#include "common/angleutils.h"
+
+#include "angle_gl.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace rx
+{
+class FenceNVImpl : angle::NonCopyable
+{
+ public:
+ FenceNVImpl() {}
+ virtual ~FenceNVImpl() {}
+
+ virtual angle::Result set(const gl::Context *context, GLenum condition) = 0;
+ virtual angle::Result test(const gl::Context *context, GLboolean *outFinished) = 0;
+ virtual angle::Result finish(const gl::Context *context) = 0;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_FENCENVIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/Format.h b/gfx/angle/checkout/src/libANGLE/renderer/Format.h
new file mode 100644
index 0000000000..edf8f1e62b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/Format.h
@@ -0,0 +1,214 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Format:
+// A universal description of typed GPU storage. Across multiple
+// renderer back-ends, there are common formats and some distinct
+// permutations, this enum encapsulates them all. Formats apply to
+// textures, but could also apply to any typed data.
+
+#ifndef LIBANGLE_RENDERER_FORMAT_H_
+#define LIBANGLE_RENDERER_FORMAT_H_
+
+#include "libANGLE/renderer/FormatID_autogen.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace angle
+{
+enum class FormatID;
+
+extern const Format gFormatInfoTable[];
+
+struct Format final : private angle::NonCopyable
+{
+ inline constexpr Format(FormatID id,
+ GLenum glFormat,
+ GLenum fboFormat,
+ rx::MipGenerationFunction mipGen,
+ const rx::FastCopyFunctionMap &fastCopyFunctions,
+ rx::PixelReadFunction colorRead,
+ rx::PixelWriteFunction colorWrite,
+ GLenum componentType,
+ GLuint redBits,
+ GLuint greenBits,
+ GLuint blueBits,
+ GLuint alphaBits,
+ GLuint luminanceBits,
+ GLuint depthBits,
+ GLuint stencilBits,
+ GLuint pixelBytes,
+ GLuint componentAlignmentMask,
+ bool isBlock,
+ bool isFixed,
+ bool isScaled,
+ gl::VertexAttribType vertexAttribType);
+
+ static const Format &Get(FormatID id) { return gFormatInfoTable[static_cast<int>(id)]; }
+
+ static FormatID InternalFormatToID(GLenum internalFormat);
+
+ constexpr bool hasDepthOrStencilBits() const;
+ constexpr bool isLUMA() const;
+
+ constexpr bool isSint() const;
+ constexpr bool isUint() const;
+ constexpr bool isSnorm() const;
+ constexpr bool isUnorm() const;
+ constexpr bool isFloat() const;
+
+ constexpr bool isInt() const { return isSint() || isUint(); }
+ constexpr bool isNorm() const { return isSnorm() || isUnorm(); }
+ constexpr bool isPureInt() const { return isInt() && !isScaled; }
+
+ bool operator==(const Format &other) const { return this->id == other.id; }
+
+ FormatID id;
+
+ // The closest matching GL internal format for the storage this format uses. Note that this
+ // may be a different internal format than the one this ANGLE format is used for.
+ GLenum glInternalFormat;
+
+ // The format we should report to the GL layer when querying implementation formats from a FBO.
+ // This might not be the same as the glInternalFormat, since some DXGI formats don't have
+ // matching GL format enums, like BGRA4, BGR5A1 and B5G6R6.
+ GLenum fboImplementationInternalFormat;
+
+ rx::MipGenerationFunction mipGenerationFunction;
+ rx::PixelReadFunction pixelReadFunction;
+ rx::PixelWriteFunction pixelWriteFunction;
+
+ // A map from a gl::FormatType to a fast pixel copy function for this format.
+ const rx::FastCopyFunctionMap &fastCopyFunctions;
+
+ GLenum componentType;
+
+ GLuint redBits;
+ GLuint greenBits;
+ GLuint blueBits;
+ GLuint alphaBits;
+ GLuint luminanceBits;
+ GLuint depthBits;
+ GLuint stencilBits;
+
+ GLuint pixelBytes;
+
+ // For 1-byte components, is MAX_UINT. For 2-byte, is 0x1. For 4-byte, is 0x3. For all others,
+ // 0x0.
+ GLuint componentAlignmentMask;
+
+ GLuint channelCount;
+
+ bool isBlock;
+ bool isFixed;
+ bool isScaled;
+
+ // For vertex formats only. Returns the "type" value for glVertexAttribPointer etc.
+ gl::VertexAttribType vertexAttribType;
+};
+
+constexpr GLuint GetChannelCount(GLuint redBits,
+ GLuint greenBits,
+ GLuint blueBits,
+ GLuint alphaBits,
+ GLuint luminanceBits,
+ GLuint depthBits,
+ GLuint stencilBits)
+{
+ return (redBits > 0 ? 1 : 0) + (greenBits > 0 ? 1 : 0) + (blueBits > 0 ? 1 : 0) +
+ (alphaBits > 0 ? 1 : 0) + (luminanceBits > 0 ? 1 : 0) + (depthBits > 0 ? 1 : 0) +
+ (stencilBits > 0 ? 1 : 0);
+}
+
+constexpr Format::Format(FormatID id,
+ GLenum glFormat,
+ GLenum fboFormat,
+ rx::MipGenerationFunction mipGen,
+ const rx::FastCopyFunctionMap &fastCopyFunctions,
+ rx::PixelReadFunction colorRead,
+ rx::PixelWriteFunction colorWrite,
+ GLenum componentType,
+ GLuint redBits,
+ GLuint greenBits,
+ GLuint blueBits,
+ GLuint alphaBits,
+ GLuint luminanceBits,
+ GLuint depthBits,
+ GLuint stencilBits,
+ GLuint pixelBytes,
+ GLuint componentAlignmentMask,
+ bool isBlock,
+ bool isFixed,
+ bool isScaled,
+ gl::VertexAttribType vertexAttribType)
+ : id(id),
+ glInternalFormat(glFormat),
+ fboImplementationInternalFormat(fboFormat),
+ mipGenerationFunction(mipGen),
+ pixelReadFunction(colorRead),
+ pixelWriteFunction(colorWrite),
+ fastCopyFunctions(fastCopyFunctions),
+ componentType(componentType),
+ redBits(redBits),
+ greenBits(greenBits),
+ blueBits(blueBits),
+ alphaBits(alphaBits),
+ luminanceBits(luminanceBits),
+ depthBits(depthBits),
+ stencilBits(stencilBits),
+ pixelBytes(pixelBytes),
+ componentAlignmentMask(componentAlignmentMask),
+ channelCount(GetChannelCount(redBits,
+ greenBits,
+ blueBits,
+ alphaBits,
+ luminanceBits,
+ depthBits,
+ stencilBits)),
+ isBlock(isBlock),
+ isFixed(isFixed),
+ isScaled(isScaled),
+ vertexAttribType(vertexAttribType)
+{}
+
+constexpr bool Format::hasDepthOrStencilBits() const
+{
+ return depthBits > 0 || stencilBits > 0;
+}
+
+constexpr bool Format::isLUMA() const
+{
+ // There's no format with G or B without R
+ ASSERT(redBits > 0 || (greenBits == 0 && blueBits == 0));
+ return redBits == 0 && (luminanceBits > 0 || alphaBits > 0);
+}
+
+constexpr bool Format::isSint() const
+{
+ return componentType == GL_INT;
+}
+
+constexpr bool Format::isUint() const
+{
+ return componentType == GL_UNSIGNED_INT;
+}
+
+constexpr bool Format::isSnorm() const
+{
+ return componentType == GL_SIGNED_NORMALIZED;
+}
+
+constexpr bool Format::isUnorm() const
+{
+ return componentType == GL_UNSIGNED_NORMALIZED;
+}
+
+constexpr bool Format::isFloat() const
+{
+ return componentType == GL_FLOAT;
+}
+
+} // namespace angle
+
+#endif // LIBANGLE_RENDERER_FORMAT_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/FormatID_autogen.h b/gfx/angle/checkout/src/libANGLE/renderer/FormatID_autogen.h
new file mode 100644
index 0000000000..1652004d06
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/FormatID_autogen.h
@@ -0,0 +1,223 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_angle_format_table.py using data from angle_format_data.json
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ANGLE format enumeration.
+
+#ifndef LIBANGLE_RENDERER_FORMATID_H_
+#define LIBANGLE_RENDERER_FORMATID_H_
+
+#include <cstdint>
+
+namespace angle
+{
+
+enum class FormatID
+{
+ NONE,
+ A16_FLOAT,
+ A1R5G5B5_UNORM,
+ A32_FLOAT,
+ A8_UNORM,
+ ASTC_10x10_SRGB_BLOCK,
+ ASTC_10x10_UNORM_BLOCK,
+ ASTC_10x5_SRGB_BLOCK,
+ ASTC_10x5_UNORM_BLOCK,
+ ASTC_10x6_SRGB_BLOCK,
+ ASTC_10x6_UNORM_BLOCK,
+ ASTC_10x8_SRGB_BLOCK,
+ ASTC_10x8_UNORM_BLOCK,
+ ASTC_12x10_SRGB_BLOCK,
+ ASTC_12x10_UNORM_BLOCK,
+ ASTC_12x12_SRGB_BLOCK,
+ ASTC_12x12_UNORM_BLOCK,
+ ASTC_3x3x3_UNORM_BLOCK,
+ ASTC_3x3x3_UNORM_SRGB_BLOCK,
+ ASTC_4x3x3_UNORM_BLOCK,
+ ASTC_4x3x3_UNORM_SRGB_BLOCK,
+ ASTC_4x4_SRGB_BLOCK,
+ ASTC_4x4_UNORM_BLOCK,
+ ASTC_4x4x3_UNORM_BLOCK,
+ ASTC_4x4x3_UNORM_SRGB_BLOCK,
+ ASTC_4x4x4_UNORM_BLOCK,
+ ASTC_4x4x4_UNORM_SRGB_BLOCK,
+ ASTC_5x4_SRGB_BLOCK,
+ ASTC_5x4_UNORM_BLOCK,
+ ASTC_5x4x4_UNORM_BLOCK,
+ ASTC_5x4x4_UNORM_SRGB_BLOCK,
+ ASTC_5x5_SRGB_BLOCK,
+ ASTC_5x5_UNORM_BLOCK,
+ ASTC_5x5x4_UNORM_BLOCK,
+ ASTC_5x5x4_UNORM_SRGB_BLOCK,
+ ASTC_5x5x5_UNORM_BLOCK,
+ ASTC_5x5x5_UNORM_SRGB_BLOCK,
+ ASTC_6x5_SRGB_BLOCK,
+ ASTC_6x5_UNORM_BLOCK,
+ ASTC_6x5x5_UNORM_BLOCK,
+ ASTC_6x5x5_UNORM_SRGB_BLOCK,
+ ASTC_6x6_SRGB_BLOCK,
+ ASTC_6x6_UNORM_BLOCK,
+ ASTC_6x6x5_UNORM_BLOCK,
+ ASTC_6x6x5_UNORM_SRGB_BLOCK,
+ ASTC_6x6x6_UNORM_BLOCK,
+ ASTC_6x6x6_UNORM_SRGB_BLOCK,
+ ASTC_8x5_SRGB_BLOCK,
+ ASTC_8x5_UNORM_BLOCK,
+ ASTC_8x6_SRGB_BLOCK,
+ ASTC_8x6_UNORM_BLOCK,
+ ASTC_8x8_SRGB_BLOCK,
+ ASTC_8x8_UNORM_BLOCK,
+ B4G4R4A4_UNORM,
+ B5G5R5A1_UNORM,
+ B5G6R5_UNORM,
+ B8G8R8A8_TYPELESS,
+ B8G8R8A8_TYPELESS_SRGB,
+ B8G8R8A8_UNORM,
+ B8G8R8A8_UNORM_SRGB,
+ B8G8R8X8_UNORM,
+ BC1_RGBA_UNORM_BLOCK,
+ BC1_RGBA_UNORM_SRGB_BLOCK,
+ BC1_RGB_UNORM_BLOCK,
+ BC1_RGB_UNORM_SRGB_BLOCK,
+ BC2_RGBA_UNORM_BLOCK,
+ BC2_RGBA_UNORM_SRGB_BLOCK,
+ BC3_RGBA_UNORM_BLOCK,
+ BC3_RGBA_UNORM_SRGB_BLOCK,
+ BPTC_RGBA_UNORM_BLOCK,
+ BPTC_RGB_SIGNED_FLOAT_BLOCK,
+ BPTC_RGB_UNSIGNED_FLOAT_BLOCK,
+ BPTC_SRGB_ALPHA_UNORM_BLOCK,
+ D16_UNORM,
+ D24_UNORM_S8_UINT,
+ D24_UNORM_X8_UINT,
+ D32_FLOAT,
+ D32_FLOAT_S8X24_UINT,
+ D32_UNORM,
+ EAC_R11G11_SNORM_BLOCK,
+ EAC_R11G11_UNORM_BLOCK,
+ EAC_R11_SNORM_BLOCK,
+ EAC_R11_UNORM_BLOCK,
+ ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK,
+ ETC1_R8G8B8_UNORM_BLOCK,
+ ETC2_R8G8B8A1_SRGB_BLOCK,
+ ETC2_R8G8B8A1_UNORM_BLOCK,
+ ETC2_R8G8B8A8_SRGB_BLOCK,
+ ETC2_R8G8B8A8_UNORM_BLOCK,
+ ETC2_R8G8B8_SRGB_BLOCK,
+ ETC2_R8G8B8_UNORM_BLOCK,
+ L16A16_FLOAT,
+ L16_FLOAT,
+ L32A32_FLOAT,
+ L32_FLOAT,
+ L8A8_UNORM,
+ L8_UNORM,
+ R10G10B10A2_SINT,
+ R10G10B10A2_SNORM,
+ R10G10B10A2_SSCALED,
+ R10G10B10A2_UINT,
+ R10G10B10A2_UNORM,
+ R10G10B10A2_USCALED,
+ R11G11B10_FLOAT,
+ R16G16B16A16_FLOAT,
+ R16G16B16A16_SINT,
+ R16G16B16A16_SNORM,
+ R16G16B16A16_SSCALED,
+ R16G16B16A16_UINT,
+ R16G16B16A16_UNORM,
+ R16G16B16A16_USCALED,
+ R16G16B16_FLOAT,
+ R16G16B16_SINT,
+ R16G16B16_SNORM,
+ R16G16B16_SSCALED,
+ R16G16B16_UINT,
+ R16G16B16_UNORM,
+ R16G16B16_USCALED,
+ R16G16_FLOAT,
+ R16G16_SINT,
+ R16G16_SNORM,
+ R16G16_SSCALED,
+ R16G16_UINT,
+ R16G16_UNORM,
+ R16G16_USCALED,
+ R16_FLOAT,
+ R16_SINT,
+ R16_SNORM,
+ R16_SSCALED,
+ R16_UINT,
+ R16_UNORM,
+ R16_USCALED,
+ R32G32B32A32_FIXED,
+ R32G32B32A32_FLOAT,
+ R32G32B32A32_SINT,
+ R32G32B32A32_SNORM,
+ R32G32B32A32_SSCALED,
+ R32G32B32A32_UINT,
+ R32G32B32A32_UNORM,
+ R32G32B32A32_USCALED,
+ R32G32B32_FIXED,
+ R32G32B32_FLOAT,
+ R32G32B32_SINT,
+ R32G32B32_SNORM,
+ R32G32B32_SSCALED,
+ R32G32B32_UINT,
+ R32G32B32_UNORM,
+ R32G32B32_USCALED,
+ R32G32_FIXED,
+ R32G32_FLOAT,
+ R32G32_SINT,
+ R32G32_SNORM,
+ R32G32_SSCALED,
+ R32G32_UINT,
+ R32G32_UNORM,
+ R32G32_USCALED,
+ R32_FIXED,
+ R32_FLOAT,
+ R32_SINT,
+ R32_SNORM,
+ R32_SSCALED,
+ R32_UINT,
+ R32_UNORM,
+ R32_USCALED,
+ R4G4B4A4_UNORM,
+ R5G5B5A1_UNORM,
+ R5G6B5_UNORM,
+ R8G8B8A8_SINT,
+ R8G8B8A8_SNORM,
+ R8G8B8A8_SSCALED,
+ R8G8B8A8_TYPELESS,
+ R8G8B8A8_TYPELESS_SRGB,
+ R8G8B8A8_UINT,
+ R8G8B8A8_UNORM,
+ R8G8B8A8_UNORM_SRGB,
+ R8G8B8A8_USCALED,
+ R8G8B8_SINT,
+ R8G8B8_SNORM,
+ R8G8B8_SSCALED,
+ R8G8B8_UINT,
+ R8G8B8_UNORM,
+ R8G8B8_UNORM_SRGB,
+ R8G8B8_USCALED,
+ R8G8_SINT,
+ R8G8_SNORM,
+ R8G8_SSCALED,
+ R8G8_UINT,
+ R8G8_UNORM,
+ R8G8_USCALED,
+ R8_SINT,
+ R8_SNORM,
+ R8_SSCALED,
+ R8_UINT,
+ R8_UNORM,
+ R8_USCALED,
+ R9G9B9E5_SHAREDEXP,
+ S8_UINT
+};
+
+constexpr uint32_t kNumANGLEFormats = 197;
+
+} // namespace angle
+
+#endif // LIBANGLE_RENDERER_FORMATID_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp
new file mode 100644
index 0000000000..00ecc3a79e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp
@@ -0,0 +1,639 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_angle_format_table.py using data from angle_format_data.json
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ANGLE Format table:
+// Queries for typed format information from the ANGLE format enum.
+
+#include "libANGLE/renderer/Format.h"
+
+#include "image_util/copyimage.h"
+#include "image_util/generatemip.h"
+#include "image_util/loadimage.h"
+
+namespace angle
+{
+
+static constexpr rx::FastCopyFunctionMap::Entry BGRAEntry = {angle::FormatID::R8G8B8A8_UNORM,
+ CopyBGRA8ToRGBA8};
+static constexpr rx::FastCopyFunctionMap BGRACopyFunctions = {&BGRAEntry, 1};
+static constexpr rx::FastCopyFunctionMap NoCopyFunctions;
+
+const Format gFormatInfoTable[] = {
+ // clang-format off
+ { FormatID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::A16_FLOAT, GL_ALPHA16F_EXT, GL_ALPHA16F_EXT, GenerateMip<A16F>, NoCopyFunctions, ReadColor<A16F, GLfloat>, WriteColor<A16F, GLfloat>, GL_FLOAT, 0, 0, 0, 16, 0, 0, 0, 2, 1, false, false, false, gl::VertexAttribType::Float },
+ { FormatID::A1R5G5B5_UNORM, GL_A1RGB5_ANGLEX, GL_A1RGB5_ANGLEX, GenerateMip<A1R5G5B5>, NoCopyFunctions, ReadColor<A1R5G5B5, GLfloat>, WriteColor<A1R5G5B5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::A32_FLOAT, GL_ALPHA32F_EXT, GL_ALPHA32F_EXT, GenerateMip<A32F>, NoCopyFunctions, ReadColor<A32F, GLfloat>, WriteColor<A32F, GLfloat>, GL_FLOAT, 0, 0, 0, 32, 0, 0, 0, 4, 3, false, false, false, gl::VertexAttribType::Float },
+ { FormatID::A8_UNORM, GL_ALPHA8_EXT, GL_ALPHA8_EXT, GenerateMip<A8>, NoCopyFunctions, ReadColor<A8, GLfloat>, WriteColor<A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 0, 0, 0, 1, 0, false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_10x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_12x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_12x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_12x12_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_12x12_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_3x3x3_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_3x3x3_OES, GL_COMPRESSED_RGBA_ASTC_3x3x3_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_3x3x3_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x3x3_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_4x3x3_OES, GL_COMPRESSED_RGBA_ASTC_4x3x3_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x3x3_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x4x3_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_4x4x3_OES, GL_COMPRESSED_RGBA_ASTC_4x4x3_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x4x3_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x4x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_4x4x4_OES, GL_COMPRESSED_RGBA_ASTC_4x4x4_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_4x4x4_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x4x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x4x4_OES, GL_COMPRESSED_RGBA_ASTC_5x4x4_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x4x4_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x5x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x5x4_OES, GL_COMPRESSED_RGBA_ASTC_5x5x4_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x5x4_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x5x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x5x5_OES, GL_COMPRESSED_RGBA_ASTC_5x5x5_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_5x5x5_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x5x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x5x5_OES, GL_COMPRESSED_RGBA_ASTC_6x5x5_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x5x5_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x6x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x6x5_OES, GL_COMPRESSED_RGBA_ASTC_6x6x5_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x6x5_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x6x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x6x6_OES, GL_COMPRESSED_RGBA_ASTC_6x6x6_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_6x6x6_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_8x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_8x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_8x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_8x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_8x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ASTC_8x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::B4G4R4A4_UNORM, GL_BGRA4_ANGLEX, GL_RGBA4, GenerateMip<A4R4G4B4>, NoCopyFunctions, ReadColor<A4R4G4B4, GLfloat>, WriteColor<A4R4G4B4, GLfloat>, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::B5G5R5A1_UNORM, GL_BGR5_A1_ANGLEX, GL_RGB5_A1, GenerateMip<A1R5G5B5>, NoCopyFunctions, ReadColor<A1R5G5B5, GLfloat>, WriteColor<A1R5G5B5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::B5G6R5_UNORM, GL_BGR565_ANGLEX, GL_RGB565, GenerateMip<B5G6R5>, NoCopyFunctions, ReadColor<B5G6R5, GLfloat>, WriteColor<B5G6R5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::B8G8R8A8_TYPELESS, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, NoCopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::B8G8R8A8_TYPELESS_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip<B8G8R8A8>, NoCopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::B8G8R8A8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, BGRACopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::B8G8R8A8_UNORM_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip<B8G8R8A8>, NoCopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::B8G8R8X8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip<B8G8R8X8>, NoCopyFunctions, ReadColor<B8G8R8X8, GLfloat>, WriteColor<B8G8R8X8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::BC1_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 8, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BC1_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 8, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BC1_RGB_UNORM_BLOCK, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 8, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BC1_RGB_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 8, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BC2_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BC2_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BC3_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BC3_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BPTC_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::Float },
+ { FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::Float },
+ { FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, 16, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::D16_UNORM, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, nullptr, NoCopyFunctions, ReadDepthStencil<D16>, WriteDepthStencil<D16>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 16, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, nullptr, NoCopyFunctions, ReadDepthStencil<D24S8>, WriteDepthStencil<D24S8>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 24, 8, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::D24_UNORM_X8_UINT, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT24, nullptr, NoCopyFunctions, ReadDepthStencil<D24>, WriteDepthStencil<D24>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 24, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, nullptr, NoCopyFunctions, ReadDepthStencil<D32F>, WriteDepthStencil<D32F>, GL_FLOAT, 0, 0, 0, 0, 0, 32, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
+ { FormatID::D32_FLOAT_S8X24_UINT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, nullptr, NoCopyFunctions, ReadDepthStencil<D32FS8>, WriteDepthStencil<D32FS8>, GL_FLOAT, 0, 0, 0, 0, 0, 32, 8, 8, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
+ { FormatID::D32_UNORM, GL_DEPTH_COMPONENT32_OES, GL_DEPTH_COMPONENT32_OES, nullptr, NoCopyFunctions, ReadDepthStencil<D32>, WriteDepthStencil<D32>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 32, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::EAC_R11G11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_RG11_EAC, GL_COMPRESSED_SIGNED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0, 0, 16, 0, true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::EAC_R11G11_UNORM_BLOCK, GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0, 0, 16, 0, true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::EAC_R11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0, 0, 8, 0, true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::EAC_R11_UNORM_BLOCK, GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0, 0, 8, 0, true, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 8, 0, true, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::ETC1_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_OES, GL_ETC1_RGB8_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 8, 0, true, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::ETC2_R8G8B8A1_SRGB_BLOCK, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0, 0, 8, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::Byte },
+ { FormatID::ETC2_R8G8B8A1_UNORM_BLOCK, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0, 0, 8, std::numeric_limits<GLuint>::max(), true, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::ETC2_R8G8B8A8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 16, 0, true, false, false, gl::VertexAttribType::Byte },
+ { FormatID::ETC2_R8G8B8A8_UNORM_BLOCK, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_COMPRESSED_RGBA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 16, 0, true, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::ETC2_R8G8B8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ETC2, GL_COMPRESSED_SRGB8_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 8, 0, true, false, false, gl::VertexAttribType::Byte },
+ { FormatID::ETC2_R8G8B8_UNORM_BLOCK, GL_COMPRESSED_RGB8_ETC2, GL_COMPRESSED_RGB8_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 8, 0, true, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::L16A16_FLOAT, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA16F_EXT, GenerateMip<L16A16F>, NoCopyFunctions, ReadColor<L16A16F, GLfloat>, WriteColor<L16A16F, GLfloat>, GL_FLOAT, 0, 0, 0, 16, 16, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
+ { FormatID::L16_FLOAT, GL_LUMINANCE16F_EXT, GL_LUMINANCE16F_EXT, GenerateMip<L16F>, NoCopyFunctions, ReadColor<L16F, GLfloat>, WriteColor<L16F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 16, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
+ { FormatID::L32A32_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA32F_EXT, GenerateMip<L32A32F>, NoCopyFunctions, ReadColor<L32A32F, GLfloat>, WriteColor<L32A32F, GLfloat>, GL_FLOAT, 0, 0, 0, 32, 32, 0, 0, 8, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
+ { FormatID::L32_FLOAT, GL_LUMINANCE32F_EXT, GL_LUMINANCE32F_EXT, GenerateMip<L32F>, NoCopyFunctions, ReadColor<L32F, GLfloat>, WriteColor<L32F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 32, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
+ { FormatID::L8A8_UNORM, GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE8_ALPHA8_EXT, GenerateMip<L8A8>, NoCopyFunctions, ReadColor<L8A8, GLfloat>, WriteColor<L8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 8, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::L8_UNORM, GL_LUMINANCE8_EXT, GL_LUMINANCE8_EXT, GenerateMip<L8>, NoCopyFunctions, ReadColor<L8, GLfloat>, WriteColor<L8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 8, 0, 0, 1, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::R10G10B10A2_SINT, GL_RGB10_A2_SINT_ANGLEX, GL_RGB10_A2_SINT_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLint>, WriteColor<R10G10B10A2S, GLint>, GL_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Int2101010 },
+ { FormatID::R10G10B10A2_SNORM, GL_RGB10_A2_SNORM_ANGLEX, GL_RGB10_A2_SNORM_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLfloat>, WriteColor<R10G10B10A2S, GLfloat>, GL_SIGNED_NORMALIZED, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Int2101010 },
+ { FormatID::R10G10B10A2_SSCALED, GL_RGB10_A2_SSCALED_ANGLEX, GL_RGB10_A2_SSCALED_ANGLEX, GenerateMip<R10G10B10A2S>, NoCopyFunctions, ReadColor<R10G10B10A2S, GLint>, WriteColor<R10G10B10A2S, GLint>, GL_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, true, gl::VertexAttribType::Int2101010 },
+ { FormatID::R10G10B10A2_UINT, GL_RGB10_A2UI, GL_RGB10_A2UI, GenerateMip<R10G10B10A2>, NoCopyFunctions, ReadColor<R10G10B10A2, GLuint>, WriteColor<R10G10B10A2, GLuint>, GL_UNSIGNED_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::UnsignedInt2101010 },
+ { FormatID::R10G10B10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, GenerateMip<R10G10B10A2>, NoCopyFunctions, ReadColor<R10G10B10A2, GLfloat>, WriteColor<R10G10B10A2, GLfloat>, GL_UNSIGNED_NORMALIZED, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::UnsignedInt2101010 },
+ { FormatID::R10G10B10A2_USCALED, GL_RGB10_A2_USCALED_ANGLEX, GL_RGB10_A2_USCALED_ANGLEX, GenerateMip<R10G10B10A2>, NoCopyFunctions, ReadColor<R10G10B10A2, GLuint>, WriteColor<R10G10B10A2, GLuint>, GL_UNSIGNED_INT, 10, 10, 10, 2, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, true, gl::VertexAttribType::UnsignedInt2101010 },
+ { FormatID::R11G11B10_FLOAT, GL_R11F_G11F_B10F, GL_R11F_G11F_B10F, GenerateMip<R11G11B10F>, NoCopyFunctions, ReadColor<R11G11B10F, GLfloat>, WriteColor<R11G11B10F, GLfloat>, GL_FLOAT, 11, 11, 10, 0, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::Float },
+ { FormatID::R16G16B16A16_FLOAT, GL_RGBA16F, GL_RGBA16F, GenerateMip<R16G16B16A16F>, NoCopyFunctions, ReadColor<R16G16B16A16F, GLfloat>, WriteColor<R16G16B16A16F, GLfloat>, GL_FLOAT, 16, 16, 16, 16, 0, 0, 0, 8, 1, false, false, false, gl::VertexAttribType::HalfFloat },
+ { FormatID::R16G16B16A16_SINT, GL_RGBA16I, GL_RGBA16I, GenerateMip<R16G16B16A16S>, NoCopyFunctions, ReadColor<R16G16B16A16S, GLint>, WriteColor<R16G16B16A16S, GLint>, GL_INT, 16, 16, 16, 16, 0, 0, 0, 8, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16G16B16A16_SNORM, GL_RGBA16_SNORM_EXT, GL_RGBA16_SNORM_EXT, GenerateMip<R16G16B16A16S>, NoCopyFunctions, ReadColor<R16G16B16A16S, GLfloat>, WriteColor<R16G16B16A16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0, 0, 8, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16G16B16A16_SSCALED, GL_RGBA16_SSCALED_ANGLEX, GL_RGBA16_SSCALED_ANGLEX, GenerateMip<R16G16B16A16S>, NoCopyFunctions, ReadColor<R16G16B16A16S, GLint>, WriteColor<R16G16B16A16S, GLint>, GL_INT, 16, 16, 16, 16, 0, 0, 0, 8, 1, false, false, true, gl::VertexAttribType::Short },
+ { FormatID::R16G16B16A16_UINT, GL_RGBA16UI, GL_RGBA16UI, GenerateMip<R16G16B16A16>, NoCopyFunctions, ReadColor<R16G16B16A16, GLuint>, WriteColor<R16G16B16A16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 16, 0, 0, 0, 8, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16B16A16_UNORM, GL_RGBA16_EXT, GL_RGBA16_EXT, GenerateMip<R16G16B16A16>, NoCopyFunctions, ReadColor<R16G16B16A16, GLfloat>, WriteColor<R16G16B16A16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0, 0, 8, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16B16A16_USCALED, GL_RGBA16_USCALED_ANGLEX, GL_RGBA16_USCALED_ANGLEX, GenerateMip<R16G16B16A16>, NoCopyFunctions, ReadColor<R16G16B16A16, GLuint>, WriteColor<R16G16B16A16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 16, 0, 0, 0, 8, 1, false, false, true, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16B16_FLOAT, GL_RGB16F, GL_RGB16F, GenerateMip<R16G16B16F>, NoCopyFunctions, ReadColor<R16G16B16F, GLfloat>, WriteColor<R16G16B16F, GLfloat>, GL_FLOAT, 16, 16, 16, 0, 0, 0, 0, 6, 1, false, false, false, gl::VertexAttribType::HalfFloat },
+ { FormatID::R16G16B16_SINT, GL_RGB16I, GL_RGB16I, GenerateMip<R16G16B16S>, NoCopyFunctions, ReadColor<R16G16B16S, GLint>, WriteColor<R16G16B16S, GLint>, GL_INT, 16, 16, 16, 0, 0, 0, 0, 6, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16G16B16_SNORM, GL_RGB16_SNORM_EXT, GL_RGB16_SNORM_EXT, GenerateMip<R16G16B16S>, NoCopyFunctions, ReadColor<R16G16B16S, GLfloat>, WriteColor<R16G16B16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0, 0, 6, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16G16B16_SSCALED, GL_RGB16_SSCALED_ANGLEX, GL_RGB16_SSCALED_ANGLEX, GenerateMip<R16G16B16S>, NoCopyFunctions, ReadColor<R16G16B16S, GLint>, WriteColor<R16G16B16S, GLint>, GL_INT, 16, 16, 16, 0, 0, 0, 0, 6, 1, false, false, true, gl::VertexAttribType::Short },
+ { FormatID::R16G16B16_UINT, GL_RGB16UI, GL_RGB16UI, GenerateMip<R16G16B16>, NoCopyFunctions, ReadColor<R16G16B16, GLuint>, WriteColor<R16G16B16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 0, 0, 0, 0, 6, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16B16_UNORM, GL_RGB16_EXT, GL_RGB16_EXT, GenerateMip<R16G16B16>, NoCopyFunctions, ReadColor<R16G16B16, GLfloat>, WriteColor<R16G16B16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0, 0, 6, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16B16_USCALED, GL_RGB16_USCALED_ANGLEX, GL_RGB16_USCALED_ANGLEX, GenerateMip<R16G16B16>, NoCopyFunctions, ReadColor<R16G16B16, GLuint>, WriteColor<R16G16B16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 0, 0, 0, 0, 6, 1, false, false, true, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16_FLOAT, GL_RG16F, GL_RG16F, GenerateMip<R16G16F>, NoCopyFunctions, ReadColor<R16G16F, GLfloat>, WriteColor<R16G16F, GLfloat>, GL_FLOAT, 16, 16, 0, 0, 0, 0, 0, 4, 1, false, false, false, gl::VertexAttribType::HalfFloat },
+ { FormatID::R16G16_SINT, GL_RG16I, GL_RG16I, GenerateMip<R16G16S>, NoCopyFunctions, ReadColor<R16G16S, GLint>, WriteColor<R16G16S, GLint>, GL_INT, 16, 16, 0, 0, 0, 0, 0, 4, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16G16_SNORM, GL_RG16_SNORM_EXT, GL_RG16_SNORM_EXT, GenerateMip<R16G16S>, NoCopyFunctions, ReadColor<R16G16S, GLfloat>, WriteColor<R16G16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0, 0, 4, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16G16_SSCALED, GL_RG16_SSCALED_ANGLEX, GL_RG16_SSCALED_ANGLEX, GenerateMip<R16G16S>, NoCopyFunctions, ReadColor<R16G16S, GLint>, WriteColor<R16G16S, GLint>, GL_INT, 16, 16, 0, 0, 0, 0, 0, 4, 1, false, false, true, gl::VertexAttribType::Short },
+ { FormatID::R16G16_UINT, GL_RG16UI, GL_RG16UI, GenerateMip<R16G16>, NoCopyFunctions, ReadColor<R16G16, GLuint>, WriteColor<R16G16, GLuint>, GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0, 0, 4, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16_UNORM, GL_RG16_EXT, GL_RG16_EXT, GenerateMip<R16G16>, NoCopyFunctions, ReadColor<R16G16, GLfloat>, WriteColor<R16G16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0, 0, 4, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16G16_USCALED, GL_RG16_USCALED_ANGLEX, GL_RG16_USCALED_ANGLEX, GenerateMip<R16G16>, NoCopyFunctions, ReadColor<R16G16, GLuint>, WriteColor<R16G16, GLuint>, GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0, 0, 4, 1, false, false, true, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16_FLOAT, GL_R16F, GL_R16F, GenerateMip<R16F>, NoCopyFunctions, ReadColor<R16F, GLfloat>, WriteColor<R16F, GLfloat>, GL_FLOAT, 16, 0, 0, 0, 0, 0, 0, 2, 1, false, false, false, gl::VertexAttribType::HalfFloat },
+ { FormatID::R16_SINT, GL_R16I, GL_R16I, GenerateMip<R16S>, NoCopyFunctions, ReadColor<R16S, GLint>, WriteColor<R16S, GLint>, GL_INT, 16, 0, 0, 0, 0, 0, 0, 2, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16_SNORM, GL_R16_SNORM_EXT, GL_R16_SNORM_EXT, GenerateMip<R16S>, NoCopyFunctions, ReadColor<R16S, GLfloat>, WriteColor<R16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0, 0, 2, 1, false, false, false, gl::VertexAttribType::Short },
+ { FormatID::R16_SSCALED, GL_R16_SSCALED_ANGLEX, GL_R16_SSCALED_ANGLEX, GenerateMip<R16S>, NoCopyFunctions, ReadColor<R16S, GLint>, WriteColor<R16S, GLint>, GL_INT, 16, 0, 0, 0, 0, 0, 0, 2, 1, false, false, true, gl::VertexAttribType::Short },
+ { FormatID::R16_UINT, GL_R16UI, GL_R16UI, GenerateMip<R16>, NoCopyFunctions, ReadColor<R16, GLuint>, WriteColor<R16, GLuint>, GL_UNSIGNED_INT, 16, 0, 0, 0, 0, 0, 0, 2, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16_UNORM, GL_R16_EXT, GL_R16_EXT, GenerateMip<R16>, NoCopyFunctions, ReadColor<R16, GLfloat>, WriteColor<R16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0, 0, 2, 1, false, false, false, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R16_USCALED, GL_R16_USCALED_ANGLEX, GL_R16_USCALED_ANGLEX, GenerateMip<R16>, NoCopyFunctions, ReadColor<R16, GLuint>, WriteColor<R16, GLuint>, GL_UNSIGNED_INT, 16, 0, 0, 0, 0, 0, 0, 2, 1, false, false, true, gl::VertexAttribType::UnsignedShort },
+ { FormatID::R32G32B32A32_FIXED, GL_RGBA32_FIXED_ANGLEX, GL_RGBA32_FIXED_ANGLEX, GenerateMip<R32G32B32A32F>, NoCopyFunctions, ReadColor<R32G32B32A32F, GLfloat>, WriteColor<R32G32B32A32F, GLfloat>, GL_FLOAT, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, true, false, gl::VertexAttribType::Fixed },
+ { FormatID::R32G32B32A32_FLOAT, GL_RGBA32F, GL_RGBA32F, GenerateMip<R32G32B32A32F>, NoCopyFunctions, ReadColor<R32G32B32A32F, GLfloat>, WriteColor<R32G32B32A32F, GLfloat>, GL_FLOAT, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, false, false, gl::VertexAttribType::Float },
+ { FormatID::R32G32B32A32_SINT, GL_RGBA32I, GL_RGBA32I, GenerateMip<R32G32B32A32S>, NoCopyFunctions, ReadColor<R32G32B32A32S, GLint>, WriteColor<R32G32B32A32S, GLint>, GL_INT, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32G32B32A32_SNORM, GL_RGBA32_SNORM_ANGLEX, GL_RGBA32_SNORM_ANGLEX, GenerateMip<R32G32B32A32S>, NoCopyFunctions, ReadColor<R32G32B32A32S, GLfloat>, WriteColor<R32G32B32A32S, GLfloat>, GL_SIGNED_NORMALIZED, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32G32B32A32_SSCALED, GL_RGBA32_SSCALED_ANGLEX, GL_RGBA32_SSCALED_ANGLEX, GenerateMip<R32G32B32A32S>, NoCopyFunctions, ReadColor<R32G32B32A32S, GLint>, WriteColor<R32G32B32A32S, GLint>, GL_INT, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, false, true, gl::VertexAttribType::Int },
+ { FormatID::R32G32B32A32_UINT, GL_RGBA32UI, GL_RGBA32UI, GenerateMip<R32G32B32A32>, NoCopyFunctions, ReadColor<R32G32B32A32, GLuint>, WriteColor<R32G32B32A32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32B32A32_UNORM, GL_RGBA32_UNORM_ANGLEX, GL_RGBA32_UNORM_ANGLEX, GenerateMip<R32G32B32A32>, NoCopyFunctions, ReadColor<R32G32B32A32, GLfloat>, WriteColor<R32G32B32A32, GLfloat>, GL_UNSIGNED_NORMALIZED, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32B32A32_USCALED, GL_RGBA32_USCALED_ANGLEX, GL_RGBA32_USCALED_ANGLEX, GenerateMip<R32G32B32A32>, NoCopyFunctions, ReadColor<R32G32B32A32, GLuint>, WriteColor<R32G32B32A32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 32, 0, 0, 0, 16, 3, false, false, true, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32B32_FIXED, GL_RGB32_FIXED_ANGLEX, GL_RGB32_FIXED_ANGLEX, GenerateMip<R32G32B32F>, NoCopyFunctions, ReadColor<R32G32B32F, GLfloat>, WriteColor<R32G32B32F, GLfloat>, GL_FLOAT, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, true, false, gl::VertexAttribType::Fixed },
+ { FormatID::R32G32B32_FLOAT, GL_RGB32F, GL_RGB32F, GenerateMip<R32G32B32F>, NoCopyFunctions, ReadColor<R32G32B32F, GLfloat>, WriteColor<R32G32B32F, GLfloat>, GL_FLOAT, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, false, false, gl::VertexAttribType::Float },
+ { FormatID::R32G32B32_SINT, GL_RGB32I, GL_RGB32I, GenerateMip<R32G32B32S>, NoCopyFunctions, ReadColor<R32G32B32S, GLint>, WriteColor<R32G32B32S, GLint>, GL_INT, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32G32B32_SNORM, GL_RGB32_SNORM_ANGLEX, GL_RGB32_SNORM_ANGLEX, GenerateMip<R32G32B32S>, NoCopyFunctions, ReadColor<R32G32B32S, GLfloat>, WriteColor<R32G32B32S, GLfloat>, GL_SIGNED_NORMALIZED, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32G32B32_SSCALED, GL_RGB32_SSCALED_ANGLEX, GL_RGB32_SSCALED_ANGLEX, GenerateMip<R32G32B32S>, NoCopyFunctions, ReadColor<R32G32B32S, GLint>, WriteColor<R32G32B32S, GLint>, GL_INT, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, false, true, gl::VertexAttribType::Int },
+ { FormatID::R32G32B32_UINT, GL_RGB32UI, GL_RGB32UI, GenerateMip<R32G32B32>, NoCopyFunctions, ReadColor<R32G32B32, GLuint>, WriteColor<R32G32B32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32B32_UNORM, GL_RGB32_UNORM_ANGLEX, GL_RGB32_UNORM_ANGLEX, GenerateMip<R32G32B32>, NoCopyFunctions, ReadColor<R32G32B32, GLfloat>, WriteColor<R32G32B32, GLfloat>, GL_UNSIGNED_NORMALIZED, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32B32_USCALED, GL_RGB32_USCALED_ANGLEX, GL_RGB32_USCALED_ANGLEX, GenerateMip<R32G32B32>, NoCopyFunctions, ReadColor<R32G32B32, GLuint>, WriteColor<R32G32B32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0, 0, 12, 3, false, false, true, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32_FIXED, GL_RG32_FIXED_ANGLEX, GL_RG32_FIXED_ANGLEX, GenerateMip<R32G32F>, NoCopyFunctions, ReadColor<R32G32F, GLfloat>, WriteColor<R32G32F, GLfloat>, GL_FLOAT, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, true, false, gl::VertexAttribType::Fixed },
+ { FormatID::R32G32_FLOAT, GL_RG32F, GL_RG32F, GenerateMip<R32G32F>, NoCopyFunctions, ReadColor<R32G32F, GLfloat>, WriteColor<R32G32F, GLfloat>, GL_FLOAT, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, false, false, gl::VertexAttribType::Float },
+ { FormatID::R32G32_SINT, GL_RG32I, GL_RG32I, GenerateMip<R32G32S>, NoCopyFunctions, ReadColor<R32G32S, GLint>, WriteColor<R32G32S, GLint>, GL_INT, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32G32_SNORM, GL_RG32_SNORM_ANGLEX, GL_RG32_SNORM_ANGLEX, GenerateMip<R32G32S>, NoCopyFunctions, ReadColor<R32G32S, GLfloat>, WriteColor<R32G32S, GLfloat>, GL_SIGNED_NORMALIZED, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32G32_SSCALED, GL_RG32_SSCALED_ANGLEX, GL_RG32_SSCALED_ANGLEX, GenerateMip<R32G32S>, NoCopyFunctions, ReadColor<R32G32S, GLint>, WriteColor<R32G32S, GLint>, GL_INT, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, false, true, gl::VertexAttribType::Int },
+ { FormatID::R32G32_UINT, GL_RG32UI, GL_RG32UI, GenerateMip<R32G32>, NoCopyFunctions, ReadColor<R32G32, GLuint>, WriteColor<R32G32, GLuint>, GL_UNSIGNED_INT, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32_UNORM, GL_RG32_UNORM_ANGLEX, GL_RG32_UNORM_ANGLEX, GenerateMip<R32G32>, NoCopyFunctions, ReadColor<R32G32, GLfloat>, WriteColor<R32G32, GLfloat>, GL_UNSIGNED_NORMALIZED, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32G32_USCALED, GL_RG32_USCALED_ANGLEX, GL_RG32_USCALED_ANGLEX, GenerateMip<R32G32>, NoCopyFunctions, ReadColor<R32G32, GLuint>, WriteColor<R32G32, GLuint>, GL_UNSIGNED_INT, 32, 32, 0, 0, 0, 0, 0, 8, 3, false, false, true, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32_FIXED, GL_R32_FIXED_ANGLEX, GL_R32_FIXED_ANGLEX, GenerateMip<R32F>, NoCopyFunctions, ReadColor<R32F, GLfloat>, WriteColor<R32F, GLfloat>, GL_FLOAT, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, true, false, gl::VertexAttribType::Fixed },
+ { FormatID::R32_FLOAT, GL_R32F, GL_R32F, GenerateMip<R32F>, NoCopyFunctions, ReadColor<R32F, GLfloat>, WriteColor<R32F, GLfloat>, GL_FLOAT, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, false, false, gl::VertexAttribType::Float },
+ { FormatID::R32_SINT, GL_R32I, GL_R32I, GenerateMip<R32S>, NoCopyFunctions, ReadColor<R32S, GLint>, WriteColor<R32S, GLint>, GL_INT, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32_SNORM, GL_R32_SNORM_ANGLEX, GL_R32_SNORM_ANGLEX, GenerateMip<R32S>, NoCopyFunctions, ReadColor<R32S, GLfloat>, WriteColor<R32S, GLfloat>, GL_SIGNED_NORMALIZED, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, false, false, gl::VertexAttribType::Int },
+ { FormatID::R32_SSCALED, GL_R32_SSCALED_ANGLEX, GL_R32_SSCALED_ANGLEX, GenerateMip<R32S>, NoCopyFunctions, ReadColor<R32S, GLint>, WriteColor<R32S, GLint>, GL_INT, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, false, true, gl::VertexAttribType::Int },
+ { FormatID::R32_UINT, GL_R32UI, GL_R32UI, GenerateMip<R32>, NoCopyFunctions, ReadColor<R32, GLuint>, WriteColor<R32, GLuint>, GL_UNSIGNED_INT, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32_UNORM, GL_R32_UNORM_ANGLEX, GL_R32_UNORM_ANGLEX, GenerateMip<R32>, NoCopyFunctions, ReadColor<R32, GLfloat>, WriteColor<R32, GLfloat>, GL_UNSIGNED_NORMALIZED, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, false, false, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R32_USCALED, GL_R32_USCALED_ANGLEX, GL_R32_USCALED_ANGLEX, GenerateMip<R32>, NoCopyFunctions, ReadColor<R32, GLuint>, WriteColor<R32, GLuint>, GL_UNSIGNED_INT, 32, 0, 0, 0, 0, 0, 0, 4, 3, false, false, true, gl::VertexAttribType::UnsignedInt },
+ { FormatID::R4G4B4A4_UNORM, GL_RGBA4, GL_RGBA4, GenerateMip<R4G4B4A4>, NoCopyFunctions, ReadColor<R4G4B4A4, GLfloat>, WriteColor<R4G4B4A4, GLfloat>, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::R5G5B5A1_UNORM, GL_RGB5_A1, GL_RGB5_A1, GenerateMip<R5G5B5A1>, NoCopyFunctions, ReadColor<R5G5B5A1, GLfloat>, WriteColor<R5G5B5A1, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::R5G6B5_UNORM, GL_RGB565, GL_RGB565, GenerateMip<R5G6B5>, NoCopyFunctions, ReadColor<R5G6B5, GLfloat>, WriteColor<R5G6B5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0, 0, 2, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::R8G8B8A8_SINT, GL_RGBA8I, GL_RGBA8I, GenerateMip<R8G8B8A8S>, NoCopyFunctions, ReadColor<R8G8B8A8S, GLint>, WriteColor<R8G8B8A8S, GLint>, GL_INT, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8A8_SNORM, GL_RGBA8_SNORM, GL_RGBA8_SNORM, GenerateMip<R8G8B8A8S>, NoCopyFunctions, ReadColor<R8G8B8A8S, GLfloat>, WriteColor<R8G8B8A8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8A8_SSCALED, GL_RGBA8_SSCALED_ANGLEX, GL_RGBA8_SSCALED_ANGLEX, GenerateMip<R8G8B8A8S>, NoCopyFunctions, ReadColor<R8G8B8A8S, GLint>, WriteColor<R8G8B8A8S, GLint>, GL_INT, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, true, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8A8_TYPELESS, GL_RGBA8, GL_RGBA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, WriteColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8B8A8_TYPELESS_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, WriteColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8A8_UINT, GL_RGBA8UI, GL_RGBA8UI, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLuint>, WriteColor<R8G8B8A8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, WriteColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8B8A8_UNORM_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip<R8G8B8A8SRGB>, NoCopyFunctions, ReadColor<R8G8B8A8SRGB, GLfloat>, WriteColor<R8G8B8A8SRGB, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8A8_USCALED, GL_RGBA8_USCALED_ANGLEX, GL_RGBA8_USCALED_ANGLEX, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLuint>, WriteColor<R8G8B8A8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 8, 0, 0, 0, 4, 0, false, false, true, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8B8_SINT, GL_RGB8I, GL_RGB8I, GenerateMip<R8G8B8S>, NoCopyFunctions, ReadColor<R8G8B8S, GLint>, WriteColor<R8G8B8S, GLint>, GL_INT, 8, 8, 8, 0, 0, 0, 0, 3, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8_SNORM, GL_RGB8_SNORM, GL_RGB8_SNORM, GenerateMip<R8G8B8S>, NoCopyFunctions, ReadColor<R8G8B8S, GLfloat>, WriteColor<R8G8B8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 3, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8_SSCALED, GL_RGB8_SSCALED_ANGLEX, GL_RGB8_SSCALED_ANGLEX, GenerateMip<R8G8B8S>, NoCopyFunctions, ReadColor<R8G8B8S, GLint>, WriteColor<R8G8B8S, GLint>, GL_INT, 8, 8, 8, 0, 0, 0, 0, 3, 0, false, false, true, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8_UINT, GL_RGB8UI, GL_RGB8UI, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLuint>, WriteColor<R8G8B8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 0, 0, 0, 0, 3, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8B8_UNORM, GL_RGB8, GL_RGB8, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLfloat>, WriteColor<R8G8B8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 3, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8B8_UNORM_SRGB, GL_SRGB8, GL_SRGB8, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLfloat>, WriteColor<R8G8B8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 3, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8B8_USCALED, GL_RGB8_USCALED_ANGLEX, GL_RGB8_USCALED_ANGLEX, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLuint>, WriteColor<R8G8B8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 0, 0, 0, 0, 3, 0, false, false, true, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8_SINT, GL_RG8I, GL_RG8I, GenerateMip<R8G8S>, NoCopyFunctions, ReadColor<R8G8S, GLint>, WriteColor<R8G8S, GLint>, GL_INT, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8_SNORM, GL_RG8_SNORM, GL_RG8_SNORM, GenerateMip<R8G8S>, NoCopyFunctions, ReadColor<R8G8S, GLfloat>, WriteColor<R8G8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8G8_SSCALED, GL_RG8_SSCALED_ANGLEX, GL_RG8_SSCALED_ANGLEX, GenerateMip<R8G8S>, NoCopyFunctions, ReadColor<R8G8S, GLint>, WriteColor<R8G8S, GLint>, GL_INT, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, true, gl::VertexAttribType::Byte },
+ { FormatID::R8G8_UINT, GL_RG8UI, GL_RG8UI, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLuint>, WriteColor<R8G8, GLuint>, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8_UNORM, GL_RG8, GL_RG8, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLfloat>, WriteColor<R8G8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8G8_USCALED, GL_RG8_USCALED_ANGLEX, GL_RG8_USCALED_ANGLEX, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLuint>, WriteColor<R8G8, GLuint>, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0, 0, 2, 0, false, false, true, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8_SINT, GL_R8I, GL_R8I, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLint>, WriteColor<R8S, GLint>, GL_INT, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8_SNORM, GL_R8_SNORM, GL_R8_SNORM, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLfloat>, WriteColor<R8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, false, gl::VertexAttribType::Byte },
+ { FormatID::R8_SSCALED, GL_R8_SSCALED_ANGLEX, GL_R8_SSCALED_ANGLEX, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLint>, WriteColor<R8S, GLint>, GL_INT, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, true, gl::VertexAttribType::Byte },
+ { FormatID::R8_UINT, GL_R8UI, GL_R8UI, GenerateMip<R8>, NoCopyFunctions, ReadColor<R8, GLuint>, WriteColor<R8, GLuint>, GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8_UNORM, GL_R8, GL_R8, GenerateMip<R8>, NoCopyFunctions, ReadColor<R8, GLfloat>, WriteColor<R8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, false, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R8_USCALED, GL_R8_USCALED_ANGLEX, GL_R8_USCALED_ANGLEX, GenerateMip<R8>, NoCopyFunctions, ReadColor<R8, GLuint>, WriteColor<R8, GLuint>, GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0, 0, 1, 0, false, false, true, gl::VertexAttribType::UnsignedByte },
+ { FormatID::R9G9B9E5_SHAREDEXP, GL_RGB9_E5, GL_RGB9_E5, GenerateMip<R9G9B9E5>, NoCopyFunctions, ReadColor<R9G9B9E5, GLfloat>, WriteColor<R9G9B9E5, GLfloat>, GL_FLOAT, 9, 9, 9, 0, 0, 0, 0, 4, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ { FormatID::S8_UINT, GL_STENCIL_INDEX8, GL_STENCIL_INDEX8, nullptr, NoCopyFunctions, ReadDepthStencil<S8>, WriteDepthStencil<S8>, GL_UNSIGNED_INT, 0, 0, 0, 0, 0, 0, 8, 1, std::numeric_limits<GLuint>::max(), false, false, false, gl::VertexAttribType::InvalidEnum },
+ // clang-format on
+};
+
+// static
+FormatID Format::InternalFormatToID(GLenum internalFormat)
+{
+ switch (internalFormat)
+ {
+ case GL_A1RGB5_ANGLEX:
+ return FormatID::A1R5G5B5_UNORM;
+ case GL_ALPHA16F_EXT:
+ return FormatID::A16_FLOAT;
+ case GL_ALPHA32F_EXT:
+ return FormatID::A32_FLOAT;
+ case GL_ALPHA8_EXT:
+ return FormatID::A8_UNORM;
+ case GL_BGR565_ANGLEX:
+ return FormatID::B5G6R5_UNORM;
+ case GL_BGR5_A1_ANGLEX:
+ return FormatID::B5G5R5A1_UNORM;
+ case GL_BGRA4_ANGLEX:
+ return FormatID::B4G4R4A4_UNORM;
+ case GL_BGRA8_EXT:
+ return FormatID::B8G8R8A8_UNORM;
+ case GL_BGRA8_SRGB_ANGLEX:
+ return FormatID::B8G8R8A8_UNORM_SRGB;
+ case GL_BGRA8_TYPELESS_ANGLEX:
+ return FormatID::B8G8R8A8_TYPELESS;
+ case GL_BGRA8_TYPELESS_SRGB_ANGLEX:
+ return FormatID::B8G8R8A8_TYPELESS_SRGB;
+ case GL_BGRX8_ANGLEX:
+ return FormatID::B8G8R8X8_UNORM;
+ case GL_COMPRESSED_R11_EAC:
+ return FormatID::EAC_R11_UNORM_BLOCK;
+ case GL_COMPRESSED_RG11_EAC:
+ return FormatID::EAC_R11G11_UNORM_BLOCK;
+ case GL_COMPRESSED_RGB8_ETC2:
+ return FormatID::ETC2_R8G8B8_UNORM_BLOCK;
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ return FormatID::ETC2_R8G8B8A1_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA8_ETC2_EAC:
+ return FormatID::ETC2_R8G8B8A8_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
+ return FormatID::ASTC_10x10_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
+ return FormatID::ASTC_10x5_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
+ return FormatID::ASTC_10x6_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
+ return FormatID::ASTC_10x8_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
+ return FormatID::ASTC_12x10_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
+ return FormatID::ASTC_12x12_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES:
+ return FormatID::ASTC_3x3x3_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES:
+ return FormatID::ASTC_4x3x3_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
+ return FormatID::ASTC_4x4_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES:
+ return FormatID::ASTC_4x4x3_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES:
+ return FormatID::ASTC_4x4x4_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
+ return FormatID::ASTC_5x4_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES:
+ return FormatID::ASTC_5x4x4_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
+ return FormatID::ASTC_5x5_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES:
+ return FormatID::ASTC_5x5x4_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES:
+ return FormatID::ASTC_5x5x5_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
+ return FormatID::ASTC_6x5_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES:
+ return FormatID::ASTC_6x5x5_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
+ return FormatID::ASTC_6x6_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES:
+ return FormatID::ASTC_6x6x5_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES:
+ return FormatID::ASTC_6x6x6_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
+ return FormatID::ASTC_8x5_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
+ return FormatID::ASTC_8x6_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
+ return FormatID::ASTC_8x8_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
+ return FormatID::BPTC_RGBA_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return FormatID::BC1_RGBA_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ return FormatID::BC2_RGBA_UNORM_BLOCK;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ return FormatID::BC3_RGBA_UNORM_BLOCK;
+ case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT:
+ return FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK;
+ case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
+ return FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return FormatID::BC1_RGB_UNORM_BLOCK;
+ case GL_COMPRESSED_SIGNED_R11_EAC:
+ return FormatID::EAC_R11_SNORM_BLOCK;
+ case GL_COMPRESSED_SIGNED_RG11_EAC:
+ return FormatID::EAC_R11G11_SNORM_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+ return FormatID::ASTC_10x10_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+ return FormatID::ASTC_10x5_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+ return FormatID::ASTC_10x6_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+ return FormatID::ASTC_10x8_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+ return FormatID::ASTC_12x10_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+ return FormatID::ASTC_12x12_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES:
+ return FormatID::ASTC_3x3x3_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES:
+ return FormatID::ASTC_4x3x3_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+ return FormatID::ASTC_4x4_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES:
+ return FormatID::ASTC_4x4x3_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES:
+ return FormatID::ASTC_4x4x4_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+ return FormatID::ASTC_5x4_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES:
+ return FormatID::ASTC_5x4x4_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+ return FormatID::ASTC_5x5_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES:
+ return FormatID::ASTC_5x5x4_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES:
+ return FormatID::ASTC_5x5x5_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+ return FormatID::ASTC_6x5_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES:
+ return FormatID::ASTC_6x5x5_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+ return FormatID::ASTC_6x6_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES:
+ return FormatID::ASTC_6x6x5_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES:
+ return FormatID::ASTC_6x6x6_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+ return FormatID::ASTC_8x5_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+ return FormatID::ASTC_8x6_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+ return FormatID::ASTC_8x8_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+ return FormatID::ETC2_R8G8B8A8_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_ETC2:
+ return FormatID::ETC2_R8G8B8_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ return FormatID::ETC2_R8G8B8A1_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
+ return FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ return FormatID::BC1_RGBA_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ return FormatID::BC2_RGBA_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ return FormatID::BC3_RGBA_UNORM_SRGB_BLOCK;
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ return FormatID::BC1_RGB_UNORM_SRGB_BLOCK;
+ case GL_DEPTH24_STENCIL8:
+ return FormatID::D24_UNORM_S8_UINT;
+ case GL_DEPTH32F_STENCIL8:
+ return FormatID::D32_FLOAT_S8X24_UINT;
+ case GL_DEPTH_COMPONENT16:
+ return FormatID::D16_UNORM;
+ case GL_DEPTH_COMPONENT24:
+ return FormatID::D24_UNORM_X8_UINT;
+ case GL_DEPTH_COMPONENT32F:
+ return FormatID::D32_FLOAT;
+ case GL_DEPTH_COMPONENT32_OES:
+ return FormatID::D32_UNORM;
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ return FormatID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK;
+ case GL_ETC1_RGB8_OES:
+ return FormatID::ETC1_R8G8B8_UNORM_BLOCK;
+ case GL_LUMINANCE16F_EXT:
+ return FormatID::L16_FLOAT;
+ case GL_LUMINANCE32F_EXT:
+ return FormatID::L32_FLOAT;
+ case GL_LUMINANCE8_ALPHA8_EXT:
+ return FormatID::L8A8_UNORM;
+ case GL_LUMINANCE8_EXT:
+ return FormatID::L8_UNORM;
+ case GL_LUMINANCE_ALPHA16F_EXT:
+ return FormatID::L16A16_FLOAT;
+ case GL_LUMINANCE_ALPHA32F_EXT:
+ return FormatID::L32A32_FLOAT;
+ case GL_NONE:
+ return FormatID::NONE;
+ case GL_R11F_G11F_B10F:
+ return FormatID::R11G11B10_FLOAT;
+ case GL_R16F:
+ return FormatID::R16_FLOAT;
+ case GL_R16I:
+ return FormatID::R16_SINT;
+ case GL_R16UI:
+ return FormatID::R16_UINT;
+ case GL_R16_EXT:
+ return FormatID::R16_UNORM;
+ case GL_R16_SNORM_EXT:
+ return FormatID::R16_SNORM;
+ case GL_R16_SSCALED_ANGLEX:
+ return FormatID::R16_SSCALED;
+ case GL_R16_USCALED_ANGLEX:
+ return FormatID::R16_USCALED;
+ case GL_R32F:
+ return FormatID::R32_FLOAT;
+ case GL_R32I:
+ return FormatID::R32_SINT;
+ case GL_R32UI:
+ return FormatID::R32_UINT;
+ case GL_R32_FIXED_ANGLEX:
+ return FormatID::R32_FIXED;
+ case GL_R32_SNORM_ANGLEX:
+ return FormatID::R32_SNORM;
+ case GL_R32_SSCALED_ANGLEX:
+ return FormatID::R32_SSCALED;
+ case GL_R32_UNORM_ANGLEX:
+ return FormatID::R32_UNORM;
+ case GL_R32_USCALED_ANGLEX:
+ return FormatID::R32_USCALED;
+ case GL_R8:
+ return FormatID::R8_UNORM;
+ case GL_R8I:
+ return FormatID::R8_SINT;
+ case GL_R8UI:
+ return FormatID::R8_UINT;
+ case GL_R8_SNORM:
+ return FormatID::R8_SNORM;
+ case GL_R8_SSCALED_ANGLEX:
+ return FormatID::R8_SSCALED;
+ case GL_R8_USCALED_ANGLEX:
+ return FormatID::R8_USCALED;
+ case GL_RG16F:
+ return FormatID::R16G16_FLOAT;
+ case GL_RG16I:
+ return FormatID::R16G16_SINT;
+ case GL_RG16UI:
+ return FormatID::R16G16_UINT;
+ case GL_RG16_EXT:
+ return FormatID::R16G16_UNORM;
+ case GL_RG16_SNORM_EXT:
+ return FormatID::R16G16_SNORM;
+ case GL_RG16_SSCALED_ANGLEX:
+ return FormatID::R16G16_SSCALED;
+ case GL_RG16_USCALED_ANGLEX:
+ return FormatID::R16G16_USCALED;
+ case GL_RG32F:
+ return FormatID::R32G32_FLOAT;
+ case GL_RG32I:
+ return FormatID::R32G32_SINT;
+ case GL_RG32UI:
+ return FormatID::R32G32_UINT;
+ case GL_RG32_FIXED_ANGLEX:
+ return FormatID::R32G32_FIXED;
+ case GL_RG32_SNORM_ANGLEX:
+ return FormatID::R32G32_SNORM;
+ case GL_RG32_SSCALED_ANGLEX:
+ return FormatID::R32G32_SSCALED;
+ case GL_RG32_UNORM_ANGLEX:
+ return FormatID::R32G32_UNORM;
+ case GL_RG32_USCALED_ANGLEX:
+ return FormatID::R32G32_USCALED;
+ case GL_RG8:
+ return FormatID::R8G8_UNORM;
+ case GL_RG8I:
+ return FormatID::R8G8_SINT;
+ case GL_RG8UI:
+ return FormatID::R8G8_UINT;
+ case GL_RG8_SNORM:
+ return FormatID::R8G8_SNORM;
+ case GL_RG8_SSCALED_ANGLEX:
+ return FormatID::R8G8_SSCALED;
+ case GL_RG8_USCALED_ANGLEX:
+ return FormatID::R8G8_USCALED;
+ case GL_RGB:
+ return FormatID::R8G8B8_UNORM;
+ case GL_RGB10_A2:
+ return FormatID::R10G10B10A2_UNORM;
+ case GL_RGB10_A2UI:
+ return FormatID::R10G10B10A2_UINT;
+ case GL_RGB10_A2_SINT_ANGLEX:
+ return FormatID::R10G10B10A2_SINT;
+ case GL_RGB10_A2_SNORM_ANGLEX:
+ return FormatID::R10G10B10A2_SNORM;
+ case GL_RGB10_A2_SSCALED_ANGLEX:
+ return FormatID::R10G10B10A2_SSCALED;
+ case GL_RGB10_A2_USCALED_ANGLEX:
+ return FormatID::R10G10B10A2_USCALED;
+ case GL_RGB16F:
+ return FormatID::R16G16B16_FLOAT;
+ case GL_RGB16I:
+ return FormatID::R16G16B16_SINT;
+ case GL_RGB16UI:
+ return FormatID::R16G16B16_UINT;
+ case GL_RGB16_EXT:
+ return FormatID::R16G16B16_UNORM;
+ case GL_RGB16_SNORM_EXT:
+ return FormatID::R16G16B16_SNORM;
+ case GL_RGB16_SSCALED_ANGLEX:
+ return FormatID::R16G16B16_SSCALED;
+ case GL_RGB16_USCALED_ANGLEX:
+ return FormatID::R16G16B16_USCALED;
+ case GL_RGB32F:
+ return FormatID::R32G32B32_FLOAT;
+ case GL_RGB32I:
+ return FormatID::R32G32B32_SINT;
+ case GL_RGB32UI:
+ return FormatID::R32G32B32_UINT;
+ case GL_RGB32_FIXED_ANGLEX:
+ return FormatID::R32G32B32_FIXED;
+ case GL_RGB32_SNORM_ANGLEX:
+ return FormatID::R32G32B32_SNORM;
+ case GL_RGB32_SSCALED_ANGLEX:
+ return FormatID::R32G32B32_SSCALED;
+ case GL_RGB32_UNORM_ANGLEX:
+ return FormatID::R32G32B32_UNORM;
+ case GL_RGB32_USCALED_ANGLEX:
+ return FormatID::R32G32B32_USCALED;
+ case GL_RGB565:
+ return FormatID::R5G6B5_UNORM;
+ case GL_RGB5_A1:
+ return FormatID::R5G5B5A1_UNORM;
+ case GL_RGB8:
+ return FormatID::R8G8B8_UNORM;
+ case GL_RGB8I:
+ return FormatID::R8G8B8_SINT;
+ case GL_RGB8UI:
+ return FormatID::R8G8B8_UINT;
+ case GL_RGB8_SNORM:
+ return FormatID::R8G8B8_SNORM;
+ case GL_RGB8_SSCALED_ANGLEX:
+ return FormatID::R8G8B8_SSCALED;
+ case GL_RGB8_USCALED_ANGLEX:
+ return FormatID::R8G8B8_USCALED;
+ case GL_RGB9_E5:
+ return FormatID::R9G9B9E5_SHAREDEXP;
+ case GL_RGBA:
+ return FormatID::R8G8B8A8_UNORM;
+ case GL_RGBA16F:
+ return FormatID::R16G16B16A16_FLOAT;
+ case GL_RGBA16I:
+ return FormatID::R16G16B16A16_SINT;
+ case GL_RGBA16UI:
+ return FormatID::R16G16B16A16_UINT;
+ case GL_RGBA16_EXT:
+ return FormatID::R16G16B16A16_UNORM;
+ case GL_RGBA16_SNORM_EXT:
+ return FormatID::R16G16B16A16_SNORM;
+ case GL_RGBA16_SSCALED_ANGLEX:
+ return FormatID::R16G16B16A16_SSCALED;
+ case GL_RGBA16_USCALED_ANGLEX:
+ return FormatID::R16G16B16A16_USCALED;
+ case GL_RGBA32F:
+ return FormatID::R32G32B32A32_FLOAT;
+ case GL_RGBA32I:
+ return FormatID::R32G32B32A32_SINT;
+ case GL_RGBA32UI:
+ return FormatID::R32G32B32A32_UINT;
+ case GL_RGBA32_FIXED_ANGLEX:
+ return FormatID::R32G32B32A32_FIXED;
+ case GL_RGBA32_SNORM_ANGLEX:
+ return FormatID::R32G32B32A32_SNORM;
+ case GL_RGBA32_SSCALED_ANGLEX:
+ return FormatID::R32G32B32A32_SSCALED;
+ case GL_RGBA32_UNORM_ANGLEX:
+ return FormatID::R32G32B32A32_UNORM;
+ case GL_RGBA32_USCALED_ANGLEX:
+ return FormatID::R32G32B32A32_USCALED;
+ case GL_RGBA4:
+ return FormatID::R4G4B4A4_UNORM;
+ case GL_RGBA8:
+ return FormatID::R8G8B8A8_UNORM;
+ case GL_RGBA8I:
+ return FormatID::R8G8B8A8_SINT;
+ case GL_RGBA8UI:
+ return FormatID::R8G8B8A8_UINT;
+ case GL_RGBA8_SNORM:
+ return FormatID::R8G8B8A8_SNORM;
+ case GL_RGBA8_SSCALED_ANGLEX:
+ return FormatID::R8G8B8A8_SSCALED;
+ case GL_RGBA8_TYPELESS_ANGLEX:
+ return FormatID::R8G8B8A8_TYPELESS;
+ case GL_RGBA8_TYPELESS_SRGB_ANGLEX:
+ return FormatID::R8G8B8A8_TYPELESS_SRGB;
+ case GL_RGBA8_USCALED_ANGLEX:
+ return FormatID::R8G8B8A8_USCALED;
+ case GL_SRGB8:
+ return FormatID::R8G8B8_UNORM_SRGB;
+ case GL_SRGB8_ALPHA8:
+ return FormatID::R8G8B8A8_UNORM_SRGB;
+ case GL_STENCIL_INDEX8:
+ return FormatID::S8_UINT;
+ default:
+ return FormatID::NONE;
+ }
+}
+
+const Format *GetFormatInfoTable()
+{
+ return gFormatInfoTable;
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h
new file mode 100644
index 0000000000..2f618c4c46
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h
@@ -0,0 +1,61 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// FramebufferAttachmentObjectImpl.h:
+// Common ancenstor for all implementations of FBO attachable-objects.
+// This means Surfaces, Textures and Renderbuffers.
+//
+
+#ifndef LIBANGLE_RENDERER_FRAMEBUFFER_ATTACHMENT_OBJECT_IMPL_H_
+#define LIBANGLE_RENDERER_FRAMEBUFFER_ATTACHMENT_OBJECT_IMPL_H_
+
+#include "libANGLE/ImageIndex.h"
+#include "libANGLE/Observer.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace rx
+{
+class FramebufferAttachmentRenderTarget;
+
+class FramebufferAttachmentObjectImpl : angle::NonCopyable
+{
+ public:
+ FramebufferAttachmentObjectImpl() {}
+ virtual ~FramebufferAttachmentObjectImpl() {}
+
+ virtual angle::Result getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut);
+
+ virtual angle::Result initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex);
+};
+
+inline angle::Result FramebufferAttachmentObjectImpl::getAttachmentRenderTarget(
+ const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut)
+{
+ UNIMPLEMENTED();
+ return angle::Result::Stop;
+}
+
+inline angle::Result FramebufferAttachmentObjectImpl::initializeContents(
+ const gl::Context *context,
+ const gl::ImageIndex &imageIndex)
+{
+ UNIMPLEMENTED();
+ return angle::Result::Stop;
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_FRAMEBUFFER_ATTACHMENT_OBJECT_IMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h
new file mode 100644
index 0000000000..b6db04831a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h
@@ -0,0 +1,108 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FramebufferImpl.h: Defines the abstract rx::FramebufferImpl class.
+
+#ifndef LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
+#define LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/Framebuffer.h"
+
+namespace gl
+{
+class State;
+class Framebuffer;
+class FramebufferAttachment;
+struct Rectangle;
+} // namespace gl
+
+namespace rx
+{
+class DisplayImpl;
+
+class FramebufferImpl : angle::NonCopyable
+{
+ public:
+ explicit FramebufferImpl(const gl::FramebufferState &state) : mState(state) {}
+ virtual ~FramebufferImpl() {}
+ virtual void destroy(const gl::Context *context) {}
+
+ virtual angle::Result discard(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments) = 0;
+ virtual angle::Result invalidate(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments) = 0;
+ virtual angle::Result invalidateSub(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ const gl::Rectangle &area) = 0;
+
+ virtual angle::Result clear(const gl::Context *context, GLbitfield mask) = 0;
+ virtual angle::Result clearBufferfv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *values) = 0;
+ virtual angle::Result clearBufferuiv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *values) = 0;
+ virtual angle::Result clearBufferiv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *values) = 0;
+ virtual angle::Result clearBufferfi(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil) = 0;
+
+ virtual GLenum getImplementationColorReadFormat(const gl::Context *context) const = 0;
+ virtual GLenum getImplementationColorReadType(const gl::Context *context) const = 0;
+ virtual angle::Result readPixels(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ void *pixels) = 0;
+
+ virtual angle::Result blit(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ GLbitfield mask,
+ GLenum filter) = 0;
+
+ virtual bool checkStatus(const gl::Context *context) const = 0;
+
+ virtual angle::Result syncState(const gl::Context *context,
+ const gl::Framebuffer::DirtyBits &dirtyBits) = 0;
+
+ virtual angle::Result getSamplePosition(const gl::Context *context,
+ size_t index,
+ GLfloat *xy) const = 0;
+
+ // Special configuration option for checkStatus(). Some back-ends don't require a syncState
+ // before calling checkStatus. In practice the GL back-end is the only config that needs
+ // syncState because it depends on the behaviour of the driver. Allowing the Vulkan and
+ // D3D back-ends to skip syncState lets us do more work in the syncState call.
+ virtual bool shouldSyncStateBeforeCheckStatus() const;
+
+ const gl::FramebufferState &getState() const { return mState; }
+
+ protected:
+ const gl::FramebufferState &mState;
+};
+
+inline bool FramebufferImpl::shouldSyncStateBeforeCheckStatus() const
+{
+ return false;
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/GLImplFactory.h b/gfx/angle/checkout/src/libANGLE/renderer/GLImplFactory.h
new file mode 100644
index 0000000000..2f989cc35f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/GLImplFactory.h
@@ -0,0 +1,103 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// GLImplFactory.h:
+// Factory interface for OpenGL ES Impl objects.
+//
+
+#ifndef LIBANGLE_RENDERER_GLIMPLFACTORY_H_
+#define LIBANGLE_RENDERER_GLIMPLFACTORY_H_
+
+#include <vector>
+
+#include "angle_gl.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/ProgramPipeline.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/TransformFeedback.h"
+#include "libANGLE/VertexArray.h"
+
+namespace gl
+{
+class State;
+} // namespace gl
+
+namespace rx
+{
+class BufferImpl;
+class CompilerImpl;
+class ContextImpl;
+class FenceNVImpl;
+class SyncImpl;
+class FramebufferImpl;
+class MemoryObjectImpl;
+class PathImpl;
+class ProgramImpl;
+class ProgramPipelineImpl;
+class QueryImpl;
+class RenderbufferImpl;
+class SamplerImpl;
+class SemaphoreImpl;
+class ShaderImpl;
+class TextureImpl;
+class TransformFeedbackImpl;
+class VertexArrayImpl;
+
+class GLImplFactory : angle::NonCopyable
+{
+ public:
+ GLImplFactory() {}
+ virtual ~GLImplFactory() {}
+
+ // Shader creation
+ virtual CompilerImpl *createCompiler() = 0;
+ virtual ShaderImpl *createShader(const gl::ShaderState &data) = 0;
+ virtual ProgramImpl *createProgram(const gl::ProgramState &data) = 0;
+
+ // Framebuffer creation
+ virtual FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) = 0;
+
+ // Texture creation
+ virtual TextureImpl *createTexture(const gl::TextureState &state) = 0;
+
+ // Renderbuffer creation
+ virtual RenderbufferImpl *createRenderbuffer(const gl::RenderbufferState &state) = 0;
+
+ // Buffer creation
+ virtual BufferImpl *createBuffer(const gl::BufferState &state) = 0;
+
+ // Vertex Array creation
+ virtual VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) = 0;
+
+ // Query and Fence creation
+ virtual QueryImpl *createQuery(gl::QueryType type) = 0;
+ virtual FenceNVImpl *createFenceNV() = 0;
+ virtual SyncImpl *createSync() = 0;
+
+ // Transform Feedback creation
+ virtual TransformFeedbackImpl *createTransformFeedback(
+ const gl::TransformFeedbackState &state) = 0;
+
+ // Sampler object creation
+ virtual SamplerImpl *createSampler(const gl::SamplerState &state) = 0;
+
+ // Program Pipeline object creation
+ virtual ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) = 0;
+
+ virtual std::vector<PathImpl *> createPaths(GLsizei range) = 0;
+
+ // Memory object creation
+ virtual MemoryObjectImpl *createMemoryObject() = 0;
+
+ // Semaphore creation
+ virtual SemaphoreImpl *createSemaphore() = 0;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_GLIMPLFACTORY_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ImageImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/ImageImpl.h
new file mode 100644
index 0000000000..6d2e6e5337
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/ImageImpl.h
@@ -0,0 +1,62 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ImageImpl.h: Defines the rx::ImageImpl class representing the EGLimage object.
+
+#ifndef LIBANGLE_RENDERER_IMAGEIMPL_H_
+#define LIBANGLE_RENDERER_IMAGEIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace egl
+{
+class Display;
+class ImageSibling;
+struct ImageState;
+} // namespace egl
+
+namespace rx
+{
+class ExternalImageSiblingImpl : public FramebufferAttachmentObjectImpl
+{
+ public:
+ ~ExternalImageSiblingImpl() override {}
+
+ virtual egl::Error initialize(const egl::Display *display) = 0;
+ virtual void onDestroy(const egl::Display *display) {}
+
+ virtual gl::Format getFormat() const = 0;
+ virtual bool isRenderable(const gl::Context *context) const = 0;
+ virtual bool isTexturable(const gl::Context *context) const = 0;
+ virtual gl::Extents getSize() const = 0;
+ virtual size_t getSamples() const = 0;
+};
+
+class ImageImpl : angle::NonCopyable
+{
+ public:
+ ImageImpl(const egl::ImageState &state) : mState(state) {}
+ virtual ~ImageImpl() {}
+ virtual void onDestroy(const egl::Display *display) {}
+
+ virtual egl::Error initialize(const egl::Display *display) = 0;
+
+ virtual angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) = 0;
+
+ protected:
+ const egl::ImageState &mState;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_IMAGEIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/MemoryObjectImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/MemoryObjectImpl.h
new file mode 100644
index 0000000000..edec118453
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/MemoryObjectImpl.h
@@ -0,0 +1,40 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// MemoryObjectImpl.h: Implements the rx::MemoryObjectImpl class [EXT_external_objects]
+
+#ifndef LIBANGLE_RENDERER_MEMORYOBJECTIMPL_H_
+#define LIBANGLE_RENDERER_MEMORYOBJECTIMPL_H_
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+
+namespace gl
+{
+class Context;
+class MemoryObject;
+} // namespace gl
+
+namespace rx
+{
+
+class MemoryObjectImpl : angle::NonCopyable
+{
+ public:
+ virtual ~MemoryObjectImpl() {}
+
+ virtual void onDestroy(const gl::Context *context) = 0;
+
+ virtual angle::Result importFd(gl::Context *context,
+ GLuint64 size,
+ gl::HandleType handleType,
+ GLint fd) = 0;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_MEMORYOBJECTIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/PathImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/PathImpl.h
new file mode 100644
index 0000000000..5460d76606
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/PathImpl.h
@@ -0,0 +1,36 @@
+//
+// Copyright (c) 2002-2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// PathImpl.h: Defines the Path implementation interface for
+// CHROMIUM_path_rendering path objects.
+
+#ifndef LIBANGLE_RENDERER_PATHIMPL_H_
+#define LIBANGLE_RENDERER_PATHIMPL_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+
+namespace rx
+{
+
+class PathImpl : angle::NonCopyable
+{
+ public:
+ virtual ~PathImpl() {}
+
+ virtual angle::Result setCommands(GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords) = 0;
+
+ virtual void setPathParameter(GLenum pname, GLfloat value) = 0;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_PATHIMPL_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h
new file mode 100644
index 0000000000..2bc0704001
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h
@@ -0,0 +1,180 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramImpl.h: Defines the abstract rx::ProgramImpl class.
+
+#ifndef LIBANGLE_RENDERER_PROGRAMIMPL_H_
+#define LIBANGLE_RENDERER_PROGRAMIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/BinaryStream.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/Shader.h"
+
+#include <map>
+
+namespace gl
+{
+class Context;
+struct ProgramLinkedResources;
+} // namespace gl
+
+namespace sh
+{
+struct BlockMemberInfo;
+}
+
+namespace rx
+{
+
+// Provides a mechanism to access the result of asynchronous linking.
+class LinkEvent : angle::NonCopyable
+{
+ public:
+ virtual ~LinkEvent() {}
+
+ // Please be aware that these methods may be called under a gl::Context other
+ // than the one where the LinkEvent was created.
+ //
+ // Waits until the linking is actually done. Returns true if the linking
+ // succeeded, false otherwise.
+ virtual angle::Result wait(const gl::Context *context) = 0;
+ // Peeks whether the linking is still ongoing.
+ virtual bool isLinking() = 0;
+};
+
+// Wraps an already done linking.
+class LinkEventDone final : public LinkEvent
+{
+ public:
+ LinkEventDone(angle::Result result) : mResult(result) {}
+ angle::Result wait(const gl::Context *context) override;
+ bool isLinking() override;
+
+ private:
+ angle::Result mResult;
+};
+
+inline angle::Result LinkEventDone::wait(const gl::Context *context)
+{
+ return mResult;
+}
+inline bool LinkEventDone::isLinking()
+{
+ return false;
+}
+
+class ProgramImpl : angle::NonCopyable
+{
+ public:
+ ProgramImpl(const gl::ProgramState &state) : mState(state) {}
+ virtual ~ProgramImpl() {}
+ virtual void destroy(const gl::Context *context) {}
+
+ virtual std::unique_ptr<LinkEvent> load(const gl::Context *context,
+ gl::BinaryInputStream *stream,
+ gl::InfoLog &infoLog) = 0;
+ virtual void save(const gl::Context *context, gl::BinaryOutputStream *stream) = 0;
+ virtual void setBinaryRetrievableHint(bool retrievable) = 0;
+ virtual void setSeparable(bool separable) = 0;
+
+ virtual std::unique_ptr<LinkEvent> link(const gl::Context *context,
+ const gl::ProgramLinkedResources &resources,
+ gl::InfoLog &infoLog) = 0;
+ virtual GLboolean validate(const gl::Caps &caps, gl::InfoLog *infoLog) = 0;
+
+ virtual void setUniform1fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+ virtual void setUniform2fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+ virtual void setUniform3fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+ virtual void setUniform4fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+ virtual void setUniform1iv(GLint location, GLsizei count, const GLint *v) = 0;
+ virtual void setUniform2iv(GLint location, GLsizei count, const GLint *v) = 0;
+ virtual void setUniform3iv(GLint location, GLsizei count, const GLint *v) = 0;
+ virtual void setUniform4iv(GLint location, GLsizei count, const GLint *v) = 0;
+ virtual void setUniform1uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+ virtual void setUniform2uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+ virtual void setUniform3uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+ virtual void setUniform4uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+ virtual void setUniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+ virtual void setUniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) = 0;
+
+ // Done in the back-end to avoid having to keep a system copy of uniform data.
+ virtual void getUniformfv(const gl::Context *context,
+ GLint location,
+ GLfloat *params) const = 0;
+ virtual void getUniformiv(const gl::Context *context, GLint location, GLint *params) const = 0;
+ virtual void getUniformuiv(const gl::Context *context,
+ GLint location,
+ GLuint *params) const = 0;
+
+ // CHROMIUM_path_rendering
+ // Set parameters to control fragment shader input variable interpolation
+ virtual void setPathFragmentInputGen(const std::string &inputName,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs) = 0;
+
+ // Implementation-specific method for ignoring unreferenced uniforms. Some implementations may
+ // perform more extensive analysis and ignore some locations that ANGLE doesn't detect as
+ // unreferenced. This method is not required to be overriden by a back-end.
+ virtual void markUnusedUniformLocations(std::vector<gl::VariableLocation> *uniformLocations,
+ std::vector<gl::SamplerBinding> *samplerBindings,
+ std::vector<gl::ImageBinding> *imageBindings)
+ {}
+
+ const gl::ProgramState &getState() const { return mState; }
+
+ virtual angle::Result syncState(const gl::Context *context,
+ const gl::Program::DirtyBits &dirtyBits);
+
+ protected:
+ const gl::ProgramState &mState;
+};
+
+inline angle::Result ProgramImpl::syncState(const gl::Context *context,
+ const gl::Program::DirtyBits &dirtyBits)
+{
+ return angle::Result::Continue;
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_PROGRAMIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ProgramPipelineImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/ProgramPipelineImpl.h
new file mode 100644
index 0000000000..242e9260f1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/ProgramPipelineImpl.h
@@ -0,0 +1,32 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramPipelineImpl.h: Defines the abstract rx::ProgramPipelineImpl class.
+
+#ifndef LIBANGLE_RENDERER_PROGRAMPIPELINEIMPL_H_
+#define LIBANGLE_RENDERER_PROGRAMPIPELINEIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/ProgramPipeline.h"
+
+namespace rx
+{
+class ContextImpl;
+
+class ProgramPipelineImpl : public angle::NonCopyable
+{
+ public:
+ ProgramPipelineImpl(const gl::ProgramPipelineState &state) : mState(state) {}
+ virtual ~ProgramPipelineImpl() {}
+ virtual void destroy(const ContextImpl *contextImpl) {}
+
+ protected:
+ const gl::ProgramPipelineState &mState;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_PROGRAMPIPELINEIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.cpp
new file mode 100644
index 0000000000..18c74abc08
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.cpp
@@ -0,0 +1,16 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// QueryImpl.cpp: Defines the abstract rx::QueryImpl classes.
+
+#include "libANGLE/renderer/QueryImpl.h"
+
+namespace rx
+{
+
+void QueryImpl::onDestroy(const gl::Context *context) {}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.h
new file mode 100644
index 0000000000..cbe7fa39fb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/QueryImpl.h
@@ -0,0 +1,47 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// QueryImpl.h: Defines the abstract rx::QueryImpl class.
+
+#ifndef LIBANGLE_RENDERER_QUERYIMPL_H_
+#define LIBANGLE_RENDERER_QUERYIMPL_H_
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace rx
+{
+class QueryImpl : angle::NonCopyable
+{
+ public:
+ explicit QueryImpl(gl::QueryType type) : mType(type) {}
+ virtual ~QueryImpl() {}
+
+ virtual void onDestroy(const gl::Context *context);
+
+ virtual angle::Result begin(const gl::Context *context) = 0;
+ virtual angle::Result end(const gl::Context *context) = 0;
+ virtual angle::Result queryCounter(const gl::Context *context) = 0;
+ virtual angle::Result getResult(const gl::Context *context, GLint *params) = 0;
+ virtual angle::Result getResult(const gl::Context *context, GLuint *params) = 0;
+ virtual angle::Result getResult(const gl::Context *context, GLint64 *params) = 0;
+ virtual angle::Result getResult(const gl::Context *context, GLuint64 *params) = 0;
+ virtual angle::Result isResultAvailable(const gl::Context *context, bool *available) = 0;
+
+ gl::QueryType getType() const { return mType; }
+
+ private:
+ gl::QueryType mType;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_QUERYIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/RenderTargetCache.h b/gfx/angle/checkout/src/libANGLE/renderer/RenderTargetCache.h
new file mode 100644
index 0000000000..e70ebf9ef8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/RenderTargetCache.h
@@ -0,0 +1,162 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// RenderTargetCache:
+// The RenderTargetCache pattern is used in the D3D9, D3D11 and Vulkan back-ends. It is a
+// cache of the various back-end objects (RenderTargets) associated with each Framebuffer
+// attachment, be they Textures, Renderbuffers, or Surfaces. The cache is updated in Framebuffer's
+// syncState method.
+//
+
+#ifndef LIBANGLE_RENDERER_RENDER_TARGET_CACHE_H_
+#define LIBANGLE_RENDERER_RENDER_TARGET_CACHE_H_
+
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+
+namespace rx
+{
+
+template <typename RenderTargetT>
+class RenderTargetCache final : angle::NonCopyable
+{
+ public:
+ RenderTargetCache();
+ ~RenderTargetCache();
+
+ // Update all RenderTargets from the dirty bits.
+ angle::Result update(const gl::Context *context,
+ const gl::FramebufferState &state,
+ const gl::Framebuffer::DirtyBits &dirtyBits);
+
+ // Update individual RenderTargets.
+ angle::Result updateColorRenderTarget(const gl::Context *context,
+ const gl::FramebufferState &state,
+ size_t colorIndex);
+ angle::Result updateDepthStencilRenderTarget(const gl::Context *context,
+ const gl::FramebufferState &state);
+
+ using RenderTargetArray = gl::AttachmentArray<RenderTargetT *>;
+
+ const RenderTargetArray &getColors() const;
+ RenderTargetT *getDepthStencil() const;
+
+ RenderTargetT *getColorRead(const gl::FramebufferState &state) const;
+
+ private:
+ angle::Result updateCachedRenderTarget(const gl::Context *context,
+ const gl::FramebufferAttachment *attachment,
+ RenderTargetT **cachedRenderTarget);
+
+ gl::AttachmentArray<RenderTargetT *> mColorRenderTargets;
+ // We only support a single Depth/Stencil RenderTarget currently.
+ RenderTargetT *mDepthStencilRenderTarget;
+};
+
+template <typename RenderTargetT>
+RenderTargetCache<RenderTargetT>::RenderTargetCache()
+ : mColorRenderTargets{{nullptr}}, mDepthStencilRenderTarget(nullptr)
+{}
+
+template <typename RenderTargetT>
+RenderTargetCache<RenderTargetT>::~RenderTargetCache()
+{}
+
+template <typename RenderTargetT>
+angle::Result RenderTargetCache<RenderTargetT>::update(const gl::Context *context,
+ const gl::FramebufferState &state,
+ const gl::Framebuffer::DirtyBits &dirtyBits)
+{
+ for (auto dirtyBit : dirtyBits)
+ {
+ switch (dirtyBit)
+ {
+ case gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT:
+ case gl::Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT:
+ ANGLE_TRY(updateDepthStencilRenderTarget(context, state));
+ break;
+ case gl::Framebuffer::DIRTY_BIT_DRAW_BUFFERS:
+ case gl::Framebuffer::DIRTY_BIT_READ_BUFFER:
+ case gl::Framebuffer::DIRTY_BIT_DEFAULT_WIDTH:
+ case gl::Framebuffer::DIRTY_BIT_DEFAULT_HEIGHT:
+ case gl::Framebuffer::DIRTY_BIT_DEFAULT_SAMPLES:
+ case gl::Framebuffer::DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS:
+ break;
+ default:
+ {
+ static_assert(gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 == 0, "FB dirty bits");
+ if (dirtyBit < gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX)
+ {
+ size_t colorIndex = static_cast<size_t>(
+ dirtyBit - gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0);
+ ANGLE_TRY(updateColorRenderTarget(context, state, colorIndex));
+ }
+ break;
+ }
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+template <typename RenderTargetT>
+const gl::AttachmentArray<RenderTargetT *> &RenderTargetCache<RenderTargetT>::getColors() const
+{
+ return mColorRenderTargets;
+}
+
+template <typename RenderTargetT>
+RenderTargetT *RenderTargetCache<RenderTargetT>::getDepthStencil() const
+{
+ return mDepthStencilRenderTarget;
+}
+
+template <typename RenderTargetT>
+angle::Result RenderTargetCache<RenderTargetT>::updateColorRenderTarget(
+ const gl::Context *context,
+ const gl::FramebufferState &state,
+ size_t colorIndex)
+{
+ return updateCachedRenderTarget(context, state.getColorAttachment(colorIndex),
+ &mColorRenderTargets[colorIndex]);
+}
+
+template <typename RenderTargetT>
+angle::Result RenderTargetCache<RenderTargetT>::updateDepthStencilRenderTarget(
+ const gl::Context *context,
+ const gl::FramebufferState &state)
+{
+ return updateCachedRenderTarget(context, state.getDepthOrStencilAttachment(),
+ &mDepthStencilRenderTarget);
+}
+
+template <typename RenderTargetT>
+angle::Result RenderTargetCache<RenderTargetT>::updateCachedRenderTarget(
+ const gl::Context *context,
+ const gl::FramebufferAttachment *attachment,
+ RenderTargetT **cachedRenderTarget)
+{
+ RenderTargetT *newRenderTarget = nullptr;
+ if (attachment)
+ {
+ ASSERT(attachment->isAttached());
+ ANGLE_TRY(attachment->getRenderTarget(context, &newRenderTarget));
+ }
+ *cachedRenderTarget = newRenderTarget;
+ return angle::Result::Continue;
+}
+
+template <typename RenderTargetT>
+RenderTargetT *RenderTargetCache<RenderTargetT>::getColorRead(
+ const gl::FramebufferState &state) const
+{
+ ASSERT(mColorRenderTargets[state.getReadIndex()] &&
+ state.getReadIndex() < mColorRenderTargets.size());
+ return mColorRenderTargets[state.getReadIndex()];
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_RENDER_TARGET_CACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/RenderbufferImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/RenderbufferImpl.h
new file mode 100644
index 0000000000..11ad88cb75
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/RenderbufferImpl.h
@@ -0,0 +1,63 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderbufferImpl.h: Defines the abstract class gl::RenderbufferImpl
+
+#ifndef LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
+#define LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
+
+namespace gl
+{
+class RenderbufferState;
+} // namespace gl
+
+namespace egl
+{
+class Image;
+} // namespace egl
+
+namespace rx
+{
+
+class RenderbufferImpl : public FramebufferAttachmentObjectImpl
+{
+ public:
+ RenderbufferImpl(const gl::RenderbufferState &state) : mState(state) {}
+ ~RenderbufferImpl() override {}
+ virtual void onDestroy(const gl::Context *context) {}
+
+ virtual angle::Result setStorage(const gl::Context *context,
+ GLenum internalformat,
+ size_t width,
+ size_t height) = 0;
+ virtual angle::Result setStorageMultisample(const gl::Context *context,
+ size_t samples,
+ GLenum internalformat,
+ size_t width,
+ size_t height) = 0;
+ virtual angle::Result setStorageEGLImageTarget(const gl::Context *context,
+ egl::Image *image) = 0;
+
+ // Override if accurate native memory size information is available
+ virtual GLint getMemorySize() const;
+
+ protected:
+ const gl::RenderbufferState &mState;
+};
+
+inline GLint RenderbufferImpl::getMemorySize() const
+{
+ return 0;
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/SamplerImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/SamplerImpl.h
new file mode 100644
index 0000000000..b813d02b52
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/SamplerImpl.h
@@ -0,0 +1,39 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SamplerImpl.h: Defines the abstract rx::SamplerImpl class.
+
+#ifndef LIBANGLE_RENDERER_SAMPLERIMPL_H_
+#define LIBANGLE_RENDERER_SAMPLERIMPL_H_
+
+#include "common/angleutils.h"
+
+namespace gl
+{
+class Context;
+class SamplerState;
+} // namespace gl
+
+namespace rx
+{
+
+class SamplerImpl : angle::NonCopyable
+{
+ public:
+ SamplerImpl(const gl::SamplerState &state) : mState(state) {}
+ virtual ~SamplerImpl() {}
+
+ virtual void syncState(const gl::Context *context)
+ {
+ // Default implementation: no-op.
+ }
+
+ protected:
+ const gl::SamplerState &mState;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_SAMPLERIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/SemaphoreImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/SemaphoreImpl.h
new file mode 100644
index 0000000000..059ea157b7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/SemaphoreImpl.h
@@ -0,0 +1,46 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// SemaphoreImpl.h: Implements the rx::SemaphoreImpl class [EXT_external_objects]
+
+#ifndef LIBANGLE_RENDERER_SEMAPHOREIMPL_H_
+#define LIBANGLE_RENDERER_SEMAPHOREIMPL_H_
+
+#include "angle_gl.h"
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/angletypes.h"
+
+namespace gl
+{
+class Context;
+class Semaphore;
+} // namespace gl
+
+namespace rx
+{
+
+class SemaphoreImpl : angle::NonCopyable
+{
+ public:
+ virtual ~SemaphoreImpl() {}
+
+ virtual void onDestroy(const gl::Context *context) = 0;
+
+ virtual angle::Result importFd(gl::Context *context, gl::HandleType handleType, GLint fd) = 0;
+
+ virtual angle::Result wait(gl::Context *context,
+ const gl::BufferBarrierVector &bufferBarriers,
+ const gl::TextureBarrierVector &textureBarriers) = 0;
+
+ virtual angle::Result signal(gl::Context *context,
+ const gl::BufferBarrierVector &bufferBarriers,
+ const gl::TextureBarrierVector &textureBarriers) = 0;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_SEMAPHOREIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.cpp
new file mode 100644
index 0000000000..f828ef1358
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.cpp
@@ -0,0 +1,94 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderImpl.cpp: Implementation methods of ShaderImpl
+
+#include "libANGLE/renderer/ShaderImpl.h"
+
+#include "libANGLE/Context.h"
+
+namespace rx
+{
+
+WaitableCompileEvent::WaitableCompileEvent(std::shared_ptr<angle::WaitableEvent> waitableEvent)
+ : mWaitableEvent(waitableEvent)
+{}
+
+WaitableCompileEvent::~WaitableCompileEvent()
+{
+ mWaitableEvent.reset();
+}
+
+void WaitableCompileEvent::wait()
+{
+ mWaitableEvent->wait();
+}
+
+bool WaitableCompileEvent::isReady()
+{
+ return mWaitableEvent->isReady();
+}
+
+const std::string &WaitableCompileEvent::getInfoLog()
+{
+ return mInfoLog;
+}
+
+class TranslateTask : public angle::Closure
+{
+ public:
+ TranslateTask(ShHandle handle, ShCompileOptions options, const std::string &source)
+ : mHandle(handle), mOptions(options), mSource(source), mResult(false)
+ {}
+
+ void operator()() override
+ {
+ const char *source = mSource.c_str();
+ mResult = sh::Compile(mHandle, &source, 1, mOptions);
+ }
+
+ bool getResult() { return mResult; }
+
+ ShHandle getHandle() { return mHandle; }
+
+ private:
+ ShHandle mHandle;
+ ShCompileOptions mOptions;
+ std::string mSource;
+ bool mResult;
+};
+
+class WaitableCompileEventImpl final : public WaitableCompileEvent
+{
+ public:
+ WaitableCompileEventImpl(std::shared_ptr<angle::WaitableEvent> waitableEvent,
+ std::shared_ptr<TranslateTask> translateTask)
+ : WaitableCompileEvent(waitableEvent), mTranslateTask(translateTask)
+ {}
+
+ bool getResult() override { return mTranslateTask->getResult(); }
+
+ bool postTranslate(std::string *infoLog) override { return true; }
+
+ private:
+ std::shared_ptr<TranslateTask> mTranslateTask;
+};
+
+std::shared_ptr<WaitableCompileEvent> ShaderImpl::compileImpl(
+ const gl::Context *context,
+ gl::ShCompilerInstance *compilerInstance,
+ const std::string &source,
+ ShCompileOptions compileOptions)
+{
+ auto workerThreadPool = context->getWorkerThreadPool();
+ auto translateTask =
+ std::make_shared<TranslateTask>(compilerInstance->getHandle(), compileOptions, source);
+
+ return std::make_shared<WaitableCompileEventImpl>(
+ angle::WorkerThreadPool::PostWorkerTask(workerThreadPool, translateTask), translateTask);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.h
new file mode 100644
index 0000000000..7ec7ae7681
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/ShaderImpl.h
@@ -0,0 +1,75 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderImpl.h: Defines the abstract rx::ShaderImpl class.
+
+#ifndef LIBANGLE_RENDERER_SHADERIMPL_H_
+#define LIBANGLE_RENDERER_SHADERIMPL_H_
+
+#include <functional>
+
+#include "common/angleutils.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/WorkerThread.h"
+
+namespace gl
+{
+class ShCompilerInstance;
+} // namespace gl
+
+namespace rx
+{
+
+using UpdateShaderStateFunctor = std::function<void(bool compiled, ShHandle handle)>;
+class WaitableCompileEvent : public angle::WaitableEvent
+{
+ public:
+ WaitableCompileEvent(std::shared_ptr<angle::WaitableEvent> waitableEvent);
+ ~WaitableCompileEvent() override;
+
+ void wait() override;
+
+ bool isReady() override;
+
+ virtual bool getResult() = 0;
+
+ virtual bool postTranslate(std::string *infoLog) = 0;
+
+ const std::string &getInfoLog();
+
+ protected:
+ std::shared_ptr<angle::WaitableEvent> mWaitableEvent;
+ std::string mInfoLog;
+};
+
+class ShaderImpl : angle::NonCopyable
+{
+ public:
+ ShaderImpl(const gl::ShaderState &data) : mData(data) {}
+ virtual ~ShaderImpl() {}
+
+ virtual void destroy() {}
+
+ virtual std::shared_ptr<WaitableCompileEvent> compile(const gl::Context *context,
+ gl::ShCompilerInstance *compilerInstance,
+ ShCompileOptions options) = 0;
+
+ virtual std::string getDebugInfo() const = 0;
+
+ const gl::ShaderState &getData() const { return mData; }
+
+ protected:
+ std::shared_ptr<WaitableCompileEvent> compileImpl(const gl::Context *context,
+ gl::ShCompilerInstance *compilerInstance,
+ const std::string &source,
+ ShCompileOptions compileOptions);
+
+ const gl::ShaderState &mData;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_SHADERIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/StreamProducerImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/StreamProducerImpl.h
new file mode 100644
index 0000000000..caeef7b6fe
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/StreamProducerImpl.h
@@ -0,0 +1,40 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// StreamProducerImpl.h: Defines the abstract rx::StreamProducerImpl class.
+
+#ifndef LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
+#define LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Stream.h"
+
+namespace rx
+{
+
+class StreamProducerImpl : angle::NonCopyable
+{
+ public:
+ explicit StreamProducerImpl() {}
+ virtual ~StreamProducerImpl() {}
+
+ // Validates the ability for the producer to accept an arbitrary pointer to a frame. All
+ // pointers should be validated through this function before being used to produce a frame.
+ virtual egl::Error validateD3DTexture(void *pointer,
+ const egl::AttributeMap &attributes) const = 0;
+
+ // Constructs a frame from an arbitrary external pointer that points to producer specific frame
+ // data. Replaces the internal frame with the new one.
+ virtual void postD3DTexture(void *pointer, const egl::AttributeMap &attributes) = 0;
+
+ // Returns an OpenGL texture interpretation of some frame attributes for the purpose of
+ // constructing an OpenGL texture from a frame. Depending on the producer and consumer, some
+ // frames may have multiple "planes" with different OpenGL texture representations.
+ virtual egl::Stream::GLTextureDescription getGLFrameDescription(int planeIndex) = 0;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.cpp
new file mode 100644
index 0000000000..3abc3550b9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.cpp
@@ -0,0 +1,96 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SurfaceImpl.cpp: Implementation of Surface stub method class
+
+#include "libANGLE/renderer/SurfaceImpl.h"
+
+namespace rx
+{
+
+SurfaceImpl::SurfaceImpl(const egl::SurfaceState &state) : mState(state) {}
+
+SurfaceImpl::~SurfaceImpl() {}
+
+egl::Error SurfaceImpl::makeCurrent(const gl::Context *context)
+{
+ return egl::NoError();
+}
+
+egl::Error SurfaceImpl::unMakeCurrent(const gl::Context *context)
+{
+ return egl::NoError();
+}
+
+egl::Error SurfaceImpl::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects)
+{
+ UNREACHABLE();
+ return egl::EglBadSurface() << "swapWithDamage implementation missing.";
+}
+
+egl::Error SurfaceImpl::setPresentationTime(EGLnsecsANDROID time)
+{
+ UNREACHABLE();
+ return egl::EglBadSurface() << "setPresentationTime implementation missing.";
+}
+
+void SurfaceImpl::setFixedWidth(EGLint width)
+{
+ UNREACHABLE();
+}
+
+void SurfaceImpl::setFixedHeight(EGLint height)
+{
+ UNREACHABLE();
+}
+
+void SurfaceImpl::setTimestampsEnabled(bool enabled)
+{
+ UNREACHABLE();
+}
+
+const angle::Format *SurfaceImpl::getD3DTextureColorFormat() const
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+egl::SupportedCompositorTimings SurfaceImpl::getSupportedCompositorTimings() const
+{
+ UNREACHABLE();
+ return egl::SupportedCompositorTimings();
+}
+
+egl::Error SurfaceImpl::getCompositorTiming(EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values) const
+{
+ UNREACHABLE();
+ return egl::EglBadDisplay();
+}
+
+egl::Error SurfaceImpl::getNextFrameId(EGLuint64KHR *frameId) const
+{
+ UNREACHABLE();
+ return egl::EglBadDisplay();
+}
+
+egl::SupportedTimestamps SurfaceImpl::getSupportedTimestamps() const
+{
+ UNREACHABLE();
+ return egl::SupportedTimestamps();
+}
+
+egl::Error SurfaceImpl::getFrameTimestamps(EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values) const
+{
+ UNREACHABLE();
+ return egl::EglBadDisplay();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.h
new file mode 100644
index 0000000000..e0121cdafe
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/SurfaceImpl.h
@@ -0,0 +1,105 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SurfaceImpl.h: Implementation methods of egl::Surface
+
+#ifndef LIBANGLE_RENDERER_SURFACEIMPL_H_
+#define LIBANGLE_RENDERER_SURFACEIMPL_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
+
+namespace angle
+{
+struct Format;
+}
+
+namespace gl
+{
+class Context;
+class FramebufferState;
+} // namespace gl
+
+namespace egl
+{
+class Display;
+struct Config;
+struct SurfaceState;
+class Thread;
+
+using SupportedTimestamps = angle::PackedEnumBitSet<Timestamp>;
+using SupportedCompositorTimings = angle::PackedEnumBitSet<CompositorTiming>;
+} // namespace egl
+
+namespace rx
+{
+class FramebufferImpl;
+
+class SurfaceImpl : public FramebufferAttachmentObjectImpl
+{
+ public:
+ SurfaceImpl(const egl::SurfaceState &surfaceState);
+ ~SurfaceImpl() override;
+ virtual void destroy(const egl::Display *display) {}
+
+ virtual egl::Error initialize(const egl::Display *display) = 0;
+ virtual FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
+ const gl::FramebufferState &state) = 0;
+ virtual egl::Error makeCurrent(const gl::Context *context);
+ virtual egl::Error unMakeCurrent(const gl::Context *context);
+ virtual egl::Error swap(const gl::Context *context) = 0;
+ virtual egl::Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects);
+ virtual egl::Error postSubBuffer(const gl::Context *context,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height) = 0;
+ virtual egl::Error setPresentationTime(EGLnsecsANDROID time);
+ virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0;
+ virtual egl::Error bindTexImage(const gl::Context *context,
+ gl::Texture *texture,
+ EGLint buffer) = 0;
+ virtual egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) = 0;
+ virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0;
+ virtual void setSwapInterval(EGLint interval) = 0;
+ virtual void setFixedWidth(EGLint width);
+ virtual void setFixedHeight(EGLint height);
+
+ // width and height can change with client window resizing
+ virtual EGLint getWidth() const = 0;
+ virtual EGLint getHeight() const = 0;
+
+ virtual EGLint isPostSubBufferSupported() const = 0;
+ virtual EGLint getSwapBehavior() const = 0;
+
+ // Used to query color format from pbuffers created from D3D textures.
+ virtual const angle::Format *getD3DTextureColorFormat() const;
+
+ // EGL_ANDROID_get_frame_timestamps
+ virtual void setTimestampsEnabled(bool enabled);
+ virtual egl::SupportedCompositorTimings getSupportedCompositorTimings() const;
+ virtual egl::Error getCompositorTiming(EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values) const;
+ virtual egl::Error getNextFrameId(EGLuint64KHR *frameId) const;
+ virtual egl::SupportedTimestamps getSupportedTimestamps() const;
+ virtual egl::Error getFrameTimestamps(EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values) const;
+
+ protected:
+ const egl::SurfaceState &mState;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_SURFACEIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/SyncImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/SyncImpl.h
new file mode 100644
index 0000000000..58338bdbb2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/SyncImpl.h
@@ -0,0 +1,45 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SyncImpl.h: Defines the rx::SyncImpl class.
+
+#ifndef LIBANGLE_RENDERER_FENCESYNCIMPL_H_
+#define LIBANGLE_RENDERER_FENCESYNCIMPL_H_
+
+#include "libANGLE/Error.h"
+
+#include "common/angleutils.h"
+
+#include "angle_gl.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace rx
+{
+class SyncImpl : angle::NonCopyable
+{
+ public:
+ SyncImpl() {}
+ virtual ~SyncImpl() {}
+
+ virtual void onDestroy(const gl::Context *context) {}
+
+ virtual angle::Result set(const gl::Context *context, GLenum condition, GLbitfield flags) = 0;
+ virtual angle::Result clientWait(const gl::Context *context,
+ GLbitfield flags,
+ GLuint64 timeout,
+ GLenum *outResult) = 0;
+ virtual angle::Result serverWait(const gl::Context *context,
+ GLbitfield flags,
+ GLuint64 timeout) = 0;
+ virtual angle::Result getStatus(const gl::Context *context, GLint *outResult) = 0;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_FENCESYNCIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp
new file mode 100644
index 0000000000..0b5cd0427f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp
@@ -0,0 +1,111 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureImpl.cpp: Defines the abstract rx::TextureImpl classes.
+
+#include "libANGLE/renderer/TextureImpl.h"
+
+namespace rx
+{
+TextureImpl::TextureImpl(const gl::TextureState &state) : mState(state) {}
+
+TextureImpl::~TextureImpl() {}
+
+void TextureImpl::onDestroy(const gl::Context *context) {}
+
+angle::Result TextureImpl::copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+angle::Result TextureImpl::copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+angle::Result TextureImpl::copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+angle::Result TextureImpl::copy3DTexture(const gl::Context *context,
+ gl::TextureTarget target,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ size_t destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+angle::Result TextureImpl::copy3DSubTexture(const gl::Context *context,
+ const gl::TextureTarget target,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ size_t destLevel,
+ const gl::Box &srcBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+angle::Result TextureImpl::setImageExternal(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+GLint TextureImpl::getMemorySize() const
+{
+ return 0;
+}
+
+GLint TextureImpl::getLevelMemorySize(gl::TextureTarget target, GLint level)
+{
+ return 0;
+}
+
+GLint TextureImpl::getNativeID() const
+{
+ UNREACHABLE();
+ return 0;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h
new file mode 100644
index 0000000000..2dcf0bd33c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h
@@ -0,0 +1,197 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureImpl.h: Defines the abstract rx::TextureImpl classes.
+
+#ifndef LIBANGLE_RENDERER_TEXTUREIMPL_H_
+#define LIBANGLE_RENDERER_TEXTUREIMPL_H_
+
+#include <stdint.h>
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/ImageIndex.h"
+#include "libANGLE/Stream.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
+
+namespace egl
+{
+class Surface;
+class Image;
+} // namespace egl
+
+namespace gl
+{
+struct Box;
+struct Extents;
+struct Offset;
+struct Rectangle;
+class Framebuffer;
+class MemoryObject;
+struct PixelUnpackState;
+class TextureState;
+} // namespace gl
+
+namespace rx
+{
+class ContextImpl;
+
+class TextureImpl : public FramebufferAttachmentObjectImpl, public angle::Subject
+{
+ public:
+ TextureImpl(const gl::TextureState &state);
+ ~TextureImpl() override;
+
+ virtual void onDestroy(const gl::Context *context);
+
+ virtual angle::Result setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels) = 0;
+ virtual angle::Result setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels) = 0;
+
+ virtual angle::Result setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) = 0;
+ virtual angle::Result setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) = 0;
+
+ virtual angle::Result copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source) = 0;
+ virtual angle::Result copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source) = 0;
+
+ virtual angle::Result copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source);
+ virtual angle::Result copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source);
+
+ virtual angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source);
+
+ virtual angle::Result copy3DTexture(const gl::Context *context,
+ gl::TextureTarget target,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ size_t destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source);
+ virtual angle::Result copy3DSubTexture(const gl::Context *context,
+ const gl::TextureTarget target,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ size_t destLevel,
+ const gl::Box &srcBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source);
+
+ virtual angle::Result setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size) = 0;
+
+ virtual angle::Result setStorageMultisample(const gl::Context *context,
+ gl::TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const gl::Extents &size,
+ bool fixedSampleLocations) = 0;
+
+ virtual angle::Result setStorageExternalMemory(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ gl::MemoryObject *memoryObject,
+ GLuint64 offset) = 0;
+
+ virtual angle::Result setImageExternal(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type);
+
+ virtual angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) = 0;
+
+ virtual angle::Result setImageExternal(const gl::Context *context,
+ gl::TextureType type,
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc) = 0;
+
+ virtual angle::Result generateMipmap(const gl::Context *context) = 0;
+
+ virtual angle::Result setBaseLevel(const gl::Context *context, GLuint baseLevel) = 0;
+
+ virtual angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) = 0;
+ virtual angle::Result releaseTexImage(const gl::Context *context) = 0;
+
+ // Override if accurate native memory size information is available
+ virtual GLint getMemorySize() const;
+ virtual GLint getLevelMemorySize(gl::TextureTarget target, GLint level);
+
+ virtual GLint getNativeID() const;
+
+ virtual angle::Result syncState(const gl::Context *context,
+ const gl::Texture::DirtyBits &dirtyBits) = 0;
+
+ protected:
+ const gl::TextureState &mState;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_TEXTUREIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/TransformFeedbackImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/TransformFeedbackImpl.h
new file mode 100644
index 0000000000..ca9657e048
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/TransformFeedbackImpl.h
@@ -0,0 +1,39 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TransformFeedbackImpl.h: Defines the abstract rx::TransformFeedbackImpl class.
+
+#ifndef LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
+#define LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/TransformFeedback.h"
+
+namespace rx
+{
+
+class TransformFeedbackImpl : angle::NonCopyable
+{
+ public:
+ TransformFeedbackImpl(const gl::TransformFeedbackState &state) : mState(state) {}
+ virtual ~TransformFeedbackImpl() {}
+
+ virtual angle::Result begin(const gl::Context *context, gl::PrimitiveMode primitiveMode) = 0;
+ virtual angle::Result end(const gl::Context *context) = 0;
+ virtual angle::Result pause(const gl::Context *context) = 0;
+ virtual angle::Result resume(const gl::Context *context) = 0;
+
+ virtual angle::Result bindIndexedBuffer(
+ const gl::Context *context,
+ size_t index,
+ const gl::OffsetBindingPointer<gl::Buffer> &binding) = 0;
+
+ protected:
+ const gl::TransformFeedbackState &mState;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h
new file mode 100644
index 0000000000..71e0f7acd2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h
@@ -0,0 +1,62 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexAttribImpl.h: Defines the abstract rx::VertexAttribImpl class.
+
+#ifndef LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
+#define LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/VertexArray.h"
+
+// This is a helper X macro for iterating over all dirty attribs/bindings. Useful for dirty bits.
+static_assert(gl::MAX_VERTEX_ATTRIBS == 16, "Invalid max vertex attribs");
+static_assert(gl::MAX_VERTEX_ATTRIB_BINDINGS == 16, "Invalid max vertex bindings");
+#define ANGLE_VERTEX_INDEX_CASES(FUNC) \
+ FUNC(0) \
+ FUNC(1) \
+ FUNC(2) \
+ FUNC(3) \
+ FUNC(4) \
+ FUNC(5) FUNC(6) FUNC(7) FUNC(8) FUNC(9) FUNC(10) FUNC(11) FUNC(12) FUNC(13) FUNC(14) FUNC(15)
+
+namespace rx
+{
+class ContextImpl;
+
+class VertexArrayImpl : angle::NonCopyable
+{
+ public:
+ VertexArrayImpl(const gl::VertexArrayState &state) : mState(state) {}
+
+ // It's up to the implementation to reset the attrib and binding dirty bits.
+ // This is faster than the front-end having to clear all the bits after they have been scanned.
+ virtual angle::Result syncState(const gl::Context *context,
+ const gl::VertexArray::DirtyBits &dirtyBits,
+ gl::VertexArray::DirtyAttribBitsArray *attribBits,
+ gl::VertexArray::DirtyBindingBitsArray *bindingBits);
+
+ virtual void destroy(const gl::Context *context) {}
+ virtual ~VertexArrayImpl() {}
+
+ const gl::VertexArrayState &getState() const { return mState; }
+
+ protected:
+ const gl::VertexArrayState &mState;
+};
+
+inline angle::Result VertexArrayImpl::syncState(const gl::Context *context,
+ const gl::VertexArray::DirtyBits &dirtyBits,
+ gl::VertexArray::DirtyAttribBitsArray *attribBits,
+ gl::VertexArray::DirtyBindingBitsArray *bindingBits)
+{
+ return angle::Result::Continue;
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/copyvertex.h b/gfx/angle/checkout/src/libANGLE/renderer/copyvertex.h
new file mode 100644
index 0000000000..988e590f3b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/copyvertex.h
@@ -0,0 +1,57 @@
+//
+// Copyright (c) 2013-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// copyvertex.h: Defines vertex buffer copying and conversion functions
+
+#ifndef LIBANGLE_RENDERER_COPYVERTEX_H_
+#define LIBANGLE_RENDERER_COPYVERTEX_H_
+
+#include "common/mathutil.h"
+
+namespace rx
+{
+
+using VertexCopyFunction = void (*)(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output);
+
+// 'alphaDefaultValueBits' gives the default value for the alpha channel (4th component)
+template <typename T,
+ size_t inputComponentCount,
+ size_t outputComponentCount,
+ uint32_t alphaDefaultValueBits>
+void CopyNativeVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template <size_t inputComponentCount, size_t outputComponentCount>
+void Copy8SintTo16SintVertexData(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output);
+
+template <size_t componentCount>
+void Copy8SnormTo16SnormVertexData(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output);
+
+template <size_t inputComponentCount, size_t outputComponentCount>
+void Copy32FixedTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template <typename T, size_t inputComponentCount, size_t outputComponentCount, bool normalized>
+void CopyTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template <bool isSigned, bool normalized, bool toFloat>
+void CopyXYZ10W2ToXYZW32FVertexData(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output);
+
+} // namespace rx
+
+#include "copyvertex.inc.h"
+
+#endif // LIBANGLE_RENDERER_COPYVERTEX_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/copyvertex.inc.h b/gfx/angle/checkout/src/libANGLE/renderer/copyvertex.inc.h
new file mode 100644
index 0000000000..16c82adcf2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/copyvertex.inc.h
@@ -0,0 +1,479 @@
+//
+// Copyright (c) 2014-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// copyvertex.inc.h: Implementation of vertex buffer copying and conversion functions
+
+namespace rx
+{
+
+template <typename T,
+ size_t inputComponentCount,
+ size_t outputComponentCount,
+ uint32_t alphaDefaultValueBits>
+inline void CopyNativeVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+ const size_t attribSize = sizeof(T) * inputComponentCount;
+
+ if (attribSize == stride && inputComponentCount == outputComponentCount)
+ {
+ memcpy(output, input, count * attribSize);
+ return;
+ }
+
+ if (inputComponentCount == outputComponentCount)
+ {
+ for (size_t i = 0; i < count; i++)
+ {
+ const T *offsetInput = reinterpret_cast<const T *>(input + (i * stride));
+ T *offsetOutput = reinterpret_cast<T *>(output) + i * outputComponentCount;
+
+ memcpy(offsetOutput, offsetInput, attribSize);
+ }
+ return;
+ }
+
+ const T defaultAlphaValue = gl::bitCast<T>(alphaDefaultValueBits);
+ const size_t lastNonAlphaOutputComponent = std::min<size_t>(outputComponentCount, 3);
+
+ for (size_t i = 0; i < count; i++)
+ {
+ const T *offsetInput = reinterpret_cast<const T *>(input + (i * stride));
+ T *offsetOutput = reinterpret_cast<T *>(output) + i * outputComponentCount;
+
+ memcpy(offsetOutput, offsetInput, attribSize);
+
+ if (inputComponentCount < lastNonAlphaOutputComponent)
+ {
+ // Set the remaining G/B channels to 0.
+ size_t numComponents = (lastNonAlphaOutputComponent - inputComponentCount);
+ memset(&offsetOutput[inputComponentCount], 0, numComponents * sizeof(T));
+ }
+
+ if (inputComponentCount < outputComponentCount && outputComponentCount == 4)
+ {
+ // Set the remaining alpha channel to the defaultAlphaValue.
+ offsetOutput[3] = defaultAlphaValue;
+ }
+ }
+}
+
+template <size_t inputComponentCount, size_t outputComponentCount>
+inline void Copy8SintTo16SintVertexData(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output)
+{
+ const size_t lastNonAlphaOutputComponent = std::min<size_t>(outputComponentCount, 3);
+
+ for (size_t i = 0; i < count; i++)
+ {
+ const GLbyte *offsetInput = reinterpret_cast<const GLbyte *>(input + i * stride);
+ GLshort *offsetOutput = reinterpret_cast<GLshort *>(output) + i * outputComponentCount;
+
+ for (size_t j = 0; j < inputComponentCount; j++)
+ {
+ offsetOutput[j] = static_cast<GLshort>(offsetInput[j]);
+ }
+
+ for (size_t j = inputComponentCount; j < lastNonAlphaOutputComponent; j++)
+ {
+ // Set remaining G/B channels to 0.
+ offsetOutput[j] = 0;
+ }
+
+ if (inputComponentCount < outputComponentCount && outputComponentCount == 4)
+ {
+ // On integer formats, we must set the Alpha channel to 1 if it's unused.
+ offsetOutput[3] = 1;
+ }
+ }
+}
+
+template <size_t inputComponentCount, size_t outputComponentCount>
+inline void Copy8SnormTo16SnormVertexData(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output)
+{
+ for (size_t i = 0; i < count; i++)
+ {
+ const GLbyte *offsetInput = reinterpret_cast<const GLbyte *>(input + i * stride);
+ GLshort *offsetOutput = reinterpret_cast<GLshort *>(output) + i * outputComponentCount;
+
+ for (size_t j = 0; j < inputComponentCount; j++)
+ {
+ // The original GLbyte value ranges from -128 to +127 (INT8_MAX).
+ // When converted to GLshort, the value must be scaled to between -32768 and +32767
+ // (INT16_MAX).
+ if (offsetInput[j] > 0)
+ {
+ offsetOutput[j] =
+ offsetInput[j] << 8 | offsetInput[j] << 1 | ((offsetInput[j] & 0x40) >> 6);
+ }
+ else
+ {
+ offsetOutput[j] = offsetInput[j] << 8;
+ }
+ }
+
+ for (size_t j = inputComponentCount; j < std::min<size_t>(outputComponentCount, 3); j++)
+ {
+ // Set remaining G/B channels to 0.
+ offsetOutput[j] = 0;
+ }
+
+ if (inputComponentCount < outputComponentCount && outputComponentCount == 4)
+ {
+ // On normalized formats, we must set the Alpha channel to the max value if it's unused.
+ offsetOutput[3] = INT16_MAX;
+ }
+ }
+}
+
+template <size_t inputComponentCount, size_t outputComponentCount>
+inline void Copy32FixedTo32FVertexData(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output)
+{
+ static const float divisor = 1.0f / (1 << 16);
+
+ for (size_t i = 0; i < count; i++)
+ {
+ const uint8_t *offsetInput = input + i * stride;
+ float *offsetOutput = reinterpret_cast<float *>(output) + i * outputComponentCount;
+
+ // GLfixed access must be 4-byte aligned on arm32, input and stride sometimes are not
+ if (reinterpret_cast<uintptr_t>(offsetInput) % sizeof(GLfixed) == 0)
+ {
+ for (size_t j = 0; j < inputComponentCount; j++)
+ {
+ offsetOutput[j] =
+ static_cast<float>(reinterpret_cast<const GLfixed *>(offsetInput)[j]) * divisor;
+ }
+ }
+ else
+ {
+ for (size_t j = 0; j < inputComponentCount; j++)
+ {
+ GLfixed alignedInput;
+ memcpy(&alignedInput, offsetInput + j * sizeof(GLfixed), sizeof(GLfixed));
+ offsetOutput[j] = static_cast<float>(alignedInput) * divisor;
+ }
+ }
+
+ // 4-component output formats would need special padding in the alpha channel.
+ static_assert(!(inputComponentCount < 4 && outputComponentCount == 4),
+ "An inputComponentCount less than 4 and an outputComponentCount equal to 4 "
+ "is not supported.");
+
+ for (size_t j = inputComponentCount; j < outputComponentCount; j++)
+ {
+ offsetOutput[j] = 0.0f;
+ }
+ }
+}
+
+template <typename T, size_t inputComponentCount, size_t outputComponentCount, bool normalized>
+inline void CopyTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+ typedef std::numeric_limits<T> NL;
+
+ for (size_t i = 0; i < count; i++)
+ {
+ const T *offsetInput = reinterpret_cast<const T *>(input + (stride * i));
+ float *offsetOutput = reinterpret_cast<float *>(output) + i * outputComponentCount;
+
+ for (size_t j = 0; j < inputComponentCount; 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]);
+ }
+ }
+
+ // This would require special padding.
+ static_assert(!(inputComponentCount < 4 && outputComponentCount == 4),
+ "An inputComponentCount less than 4 and an outputComponentCount equal to 4 "
+ "is not supported.");
+
+ for (size_t j = inputComponentCount; j < outputComponentCount; j++)
+ {
+ offsetOutput[j] = 0.0f;
+ }
+ }
+}
+
+namespace priv
+{
+
+template <bool isSigned, bool normalized, bool toFloat>
+static inline void CopyPackedRGB(uint32_t data, uint8_t *output)
+{
+ const uint32_t rgbSignMask = 0x200; // 1 set at the 9 bit
+ const uint32_t negativeMask = 0xFFFFFC00; // All bits from 10 to 31 set to 1
+
+ if (toFloat)
+ {
+ GLfloat *floatOutput = reinterpret_cast<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 int32_t maxValue = 0x1FF; // 1 set in bits 0 through 8
+ const int32_t minValue = 0xFFFFFE01; // Inverse of maxValue
+
+ // A 10-bit two's complement number has the possibility of being minValue - 1 but
+ // OpenGL's normalization rules dictate that it should be clamped to minValue in
+ // this case.
+ if (finalValue < minValue)
+ {
+ finalValue = minValue;
+ }
+
+ const int32_t halfRange = (maxValue - minValue) >> 1;
+ *floatOutput = ((finalValue - minValue) / halfRange) - 1.0f;
+ }
+ else
+ {
+ *floatOutput = finalValue;
+ }
+ }
+ else
+ {
+ if (normalized)
+ {
+ const uint32_t maxValue = 0x3FF; // 1 set in bits 0 through 9
+ *floatOutput = static_cast<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 = static_cast<GLshort>(data | negativeMask);
+ }
+ else
+ {
+ *intOutput = static_cast<GLshort>(data);
+ }
+ }
+ else
+ {
+ GLushort *uintOutput = reinterpret_cast<GLushort *>(output);
+ *uintOutput = static_cast<GLushort>(data);
+ }
+ }
+}
+
+template <bool isSigned, bool normalized, bool toFloat>
+inline void CopyPackedAlpha(uint32_t data, uint8_t *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();
+ }
+ }
+ }
+}
+
+} // namespace priv
+
+template <bool isSigned, bool normalized, bool toFloat>
+inline void CopyXYZ10W2ToXYZW32FVertexData(const uint8_t *input,
+ size_t stride,
+ size_t count,
+ uint8_t *output)
+{
+ const size_t outputComponentSize = toFloat ? 4 : 2;
+ const size_t componentCount = 4;
+
+ const uint32_t rgbMask = 0x3FF; // 1 set in bits 0 through 9
+ const size_t redShift = 0; // red is bits 0 through 9
+ const size_t greenShift = 10; // green is bits 10 through 19
+ const size_t blueShift = 20; // blue is bits 20 through 29
+
+ const uint32_t alphaMask = 0x3; // 1 set in bits 0 and 1
+ const size_t alphaShift = 30; // Alpha is the 30 and 31 bits
+
+ for (size_t i = 0; i < count; i++)
+ {
+ GLuint packedValue = *reinterpret_cast<const GLuint *>(input + (i * stride));
+ uint8_t *offsetOutput = output + (i * outputComponentSize * componentCount);
+
+ priv::CopyPackedRGB<isSigned, normalized, toFloat>(
+ (packedValue >> redShift) & rgbMask, offsetOutput + (0 * outputComponentSize));
+ priv::CopyPackedRGB<isSigned, normalized, toFloat>(
+ (packedValue >> greenShift) & rgbMask, offsetOutput + (1 * outputComponentSize));
+ priv::CopyPackedRGB<isSigned, normalized, toFloat>(
+ (packedValue >> blueShift) & rgbMask, offsetOutput + (2 * outputComponentSize));
+ priv::CopyPackedAlpha<isSigned, normalized, toFloat>(
+ (packedValue >> alphaShift) & alphaMask, offsetOutput + (3 * outputComponentSize));
+ }
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp
new file mode 100644
index 0000000000..464bd6d4a8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp
@@ -0,0 +1,191 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferD3D.cpp Defines common functionality between the Buffer9 and Buffer11 classes.
+
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libANGLE/renderer/d3d/IndexBuffer.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/VertexBuffer.h"
+
+namespace rx
+{
+
+unsigned int BufferD3D::mNextSerial = 1;
+
+BufferD3D::BufferD3D(const gl::BufferState &state, BufferFactoryD3D *factory)
+ : BufferImpl(state),
+ mFactory(factory),
+ mStaticIndexBuffer(nullptr),
+ mStaticBufferCacheTotalSize(0),
+ mStaticVertexBufferOutOfDate(false),
+ mUnmodifiedDataUse(0),
+ mUsage(D3DBufferUsage::STATIC)
+{
+ updateSerial();
+}
+
+BufferD3D::~BufferD3D()
+{
+ SafeDelete(mStaticIndexBuffer);
+}
+
+void BufferD3D::emptyStaticBufferCache()
+{
+ mStaticVertexBuffers.clear();
+ mStaticBufferCacheTotalSize = 0;
+}
+
+void BufferD3D::updateSerial()
+{
+ mSerial = mNextSerial++;
+}
+
+void BufferD3D::updateD3DBufferUsage(const gl::Context *context, gl::BufferUsage usage)
+{
+ switch (usage)
+ {
+ case gl::BufferUsage::StaticCopy:
+ case gl::BufferUsage::StaticDraw:
+ case gl::BufferUsage::StaticRead:
+ case gl::BufferUsage::DynamicCopy:
+ case gl::BufferUsage::DynamicRead:
+ case gl::BufferUsage::StreamCopy:
+ case gl::BufferUsage::StreamRead:
+ mUsage = D3DBufferUsage::STATIC;
+ initializeStaticData(context);
+ break;
+
+ case gl::BufferUsage::DynamicDraw:
+ case gl::BufferUsage::StreamDraw:
+ mUsage = D3DBufferUsage::DYNAMIC;
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+void BufferD3D::initializeStaticData(const gl::Context *context)
+{
+ if (mStaticVertexBuffers.empty())
+ {
+ StaticVertexBufferInterface *newStaticBuffer = new StaticVertexBufferInterface(mFactory);
+ mStaticVertexBuffers.push_back(
+ std::unique_ptr<StaticVertexBufferInterface>(newStaticBuffer));
+ }
+ if (!mStaticIndexBuffer)
+ {
+ mStaticIndexBuffer = new StaticIndexBufferInterface(mFactory);
+ }
+}
+
+StaticIndexBufferInterface *BufferD3D::getStaticIndexBuffer()
+{
+ return mStaticIndexBuffer;
+}
+
+StaticVertexBufferInterface *BufferD3D::getStaticVertexBuffer(const gl::VertexAttribute &attribute,
+ const gl::VertexBinding &binding)
+{
+ if (mStaticVertexBuffers.empty())
+ {
+ // Early out if there aren't any static buffers at all
+ return nullptr;
+ }
+
+ // Early out, the attribute can be added to mStaticVertexBuffer.
+ if (mStaticVertexBuffers.size() == 1 && mStaticVertexBuffers[0]->empty())
+ {
+ return mStaticVertexBuffers[0].get();
+ }
+
+ // Cache size limiting: track the total allocated buffer sizes.
+ size_t currentTotalSize = 0;
+
+ // At this point, see if any of the existing static buffers contains the attribute data
+ // If there is a cached static buffer that already contains the attribute, then return it
+ for (const auto &staticBuffer : mStaticVertexBuffers)
+ {
+ if (staticBuffer->matchesAttribute(attribute, binding))
+ {
+ return staticBuffer.get();
+ }
+
+ currentTotalSize += staticBuffer->getBufferSize();
+ }
+
+ // Cache size limiting: Clean-up threshold is four times the base buffer size, with a minimum.
+ ASSERT(getSize() < std::numeric_limits<size_t>::max() / 4u);
+ size_t sizeThreshold = std::max(getSize() * 4u, static_cast<size_t>(0x1000u));
+
+ // If we're past the threshold, clear the buffer cache. Note that this will release buffers
+ // that are currenly bound, and in an edge case can even translate the same attribute twice
+ // in the same draw call. It will not delete currently bound buffers, however, because they
+ // are ref counted.
+ if (currentTotalSize > sizeThreshold)
+ {
+ emptyStaticBufferCache();
+ }
+
+ // At this point, we must create a new static buffer for the attribute data.
+ StaticVertexBufferInterface *newStaticBuffer = new StaticVertexBufferInterface(mFactory);
+ newStaticBuffer->setAttribute(attribute, binding);
+ mStaticVertexBuffers.push_back(std::unique_ptr<StaticVertexBufferInterface>(newStaticBuffer));
+ return newStaticBuffer;
+}
+
+void BufferD3D::invalidateStaticData(const gl::Context *context)
+{
+ emptyStaticBufferCache();
+
+ if (mStaticIndexBuffer && mStaticIndexBuffer->getBufferSize() != 0)
+ {
+ SafeDelete(mStaticIndexBuffer);
+ }
+
+ // If the buffer was created with a static usage then we recreate the static
+ // buffers so that they are populated the next time we use this buffer.
+ if (mUsage == D3DBufferUsage::STATIC)
+ {
+ initializeStaticData(context);
+ }
+
+ mUnmodifiedDataUse = 0;
+}
+
+// Creates static buffers if sufficient used data has been left unmodified
+void BufferD3D::promoteStaticUsage(const gl::Context *context, size_t dataSize)
+{
+ if (mUsage == D3DBufferUsage::DYNAMIC)
+ {
+ // Note: This is not a safe math operation. 'dataSize' can come from the app.
+ mUnmodifiedDataUse += dataSize;
+
+ if (mUnmodifiedDataUse > 3 * getSize())
+ {
+ updateD3DBufferUsage(context, gl::BufferUsage::StaticDraw);
+ }
+ }
+}
+
+angle::Result BufferD3D::getIndexRange(const gl::Context *context,
+ gl::DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ gl::IndexRange *outRange)
+{
+ const uint8_t *data = nullptr;
+ ANGLE_TRY(getData(context, &data));
+
+ *outRange = gl::ComputeIndexRange(type, data + offset, count, primitiveRestartEnabled);
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h
new file mode 100644
index 0000000000..19ea78c6eb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h
@@ -0,0 +1,89 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// BufferD3D.h: Defines the rx::BufferD3D class, an implementation of BufferImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_BUFFERD3D_H_
+#define LIBANGLE_RENDERER_D3D_BUFFERD3D_H_
+
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/BufferImpl.h"
+
+#include <stdint.h>
+#include <vector>
+
+namespace gl
+{
+struct VertexAttribute;
+class VertexBinding;
+} // namespace gl
+
+namespace rx
+{
+class BufferFactoryD3D;
+class StaticIndexBufferInterface;
+class StaticVertexBufferInterface;
+
+enum class D3DBufferUsage
+{
+ STATIC,
+ DYNAMIC,
+};
+
+class BufferD3D : public BufferImpl
+{
+ public:
+ BufferD3D(const gl::BufferState &state, BufferFactoryD3D *factory);
+ ~BufferD3D() override;
+
+ unsigned int getSerial() const { return mSerial; }
+
+ virtual size_t getSize() const = 0;
+ virtual bool supportsDirectBinding() const = 0;
+ virtual angle::Result markTransformFeedbackUsage(const gl::Context *context) = 0;
+ virtual angle::Result getData(const gl::Context *context, const uint8_t **outData) = 0;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using this
+ // function.
+ StaticVertexBufferInterface *getStaticVertexBuffer(const gl::VertexAttribute &attribute,
+ const gl::VertexBinding &binding);
+ StaticIndexBufferInterface *getStaticIndexBuffer();
+
+ virtual void initializeStaticData(const gl::Context *context);
+ virtual void invalidateStaticData(const gl::Context *context);
+
+ void promoteStaticUsage(const gl::Context *context, size_t dataSize);
+
+ angle::Result getIndexRange(const gl::Context *context,
+ gl::DrawElementsType type,
+ size_t offset,
+ size_t count,
+ bool primitiveRestartEnabled,
+ gl::IndexRange *outRange) override;
+
+ BufferFactoryD3D *getFactory() const { return mFactory; }
+ D3DBufferUsage getUsage() const { return mUsage; }
+
+ protected:
+ void updateSerial();
+ void updateD3DBufferUsage(const gl::Context *context, gl::BufferUsage usage);
+ void emptyStaticBufferCache();
+
+ BufferFactoryD3D *mFactory;
+ unsigned int mSerial;
+ static unsigned int mNextSerial;
+
+ std::vector<std::unique_ptr<StaticVertexBufferInterface>> mStaticVertexBuffers;
+ StaticIndexBufferInterface *mStaticIndexBuffer;
+ unsigned int mStaticBufferCacheTotalSize;
+ unsigned int mStaticVertexBufferOutOfDate;
+ size_t mUnmodifiedDataUse;
+ D3DBufferUsage mUsage;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_BUFFERD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.cpp
new file mode 100644
index 0000000000..4656cf4d80
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.cpp
@@ -0,0 +1,24 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// CompilerD3D:
+// Implementation of the D3D compiler methods.
+//
+
+#include "libANGLE/renderer/d3d/CompilerD3D.h"
+
+namespace rx
+{
+
+CompilerD3D::CompilerD3D(ShShaderOutput translatorOutputType)
+ : mTranslatorOutputType(translatorOutputType)
+{}
+
+ShShaderOutput CompilerD3D::getTranslatorOutputType() const
+{
+ return mTranslatorOutputType;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.h
new file mode 100644
index 0000000000..bc4ad267b8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/CompilerD3D.h
@@ -0,0 +1,32 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// CompilerD3D.h: Defines the rx::CompilerD3D class, an implementation of rx::CompilerImpl.
+
+#ifndef LIBANGLE_RENDERER_COMPILERD3D_H_
+#define LIBANGLE_RENDERER_COMPILERD3D_H_
+
+#include "libANGLE/renderer/CompilerImpl.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+
+class CompilerD3D : public CompilerImpl
+{
+ public:
+ CompilerD3D(ShShaderOutput translatorOutputType);
+ ~CompilerD3D() override {}
+
+ ShShaderOutput getTranslatorOutputType() const override;
+
+ private:
+ ShShaderOutput mTranslatorOutputType;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_COMPILERD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ContextD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ContextD3D.h
new file mode 100644
index 0000000000..d563672e67
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ContextD3D.h
@@ -0,0 +1,24 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ContextD3D: Shared common class for Context9 and Context11.
+
+#ifndef LIBANGLE_RENDERER_CONTEXTD3D_H_
+#define LIBANGLE_RENDERER_CONTEXTD3D_H_
+
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+class ContextD3D : public ContextImpl, public d3d::Context
+{
+ public:
+ ContextD3D(const gl::State &state, gl::ErrorSet *errorSet) : ContextImpl(state, errorSet) {}
+ ~ContextD3D() override {}
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_CONTEXTD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.cpp
new file mode 100644
index 0000000000..ba5cf532d4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.cpp
@@ -0,0 +1,82 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DeviceD3D.cpp: D3D implementation of egl::Device
+
+#include "libANGLE/renderer/d3d/DeviceD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+#include "libANGLE/Device.h"
+#include "libANGLE/Display.h"
+
+#include <EGL/eglext.h>
+
+namespace rx
+{
+
+DeviceD3D::DeviceD3D(GLint deviceType, void *nativeDevice)
+ : mDevice(nativeDevice), mDeviceType(deviceType), mIsInitialized(false)
+{}
+
+DeviceD3D::~DeviceD3D()
+{
+#if defined(ANGLE_ENABLE_D3D11)
+ if (mIsInitialized && mDeviceType == EGL_D3D11_DEVICE_ANGLE)
+ {
+ // DeviceD3D holds a ref to an externally-sourced D3D11 device. We must release it.
+ ID3D11Device *device = static_cast<ID3D11Device *>(mDevice);
+ device->Release();
+ }
+#endif
+}
+
+egl::Error DeviceD3D::getDevice(void **outValue)
+{
+ ASSERT(mIsInitialized);
+ *outValue = mDevice;
+ return egl::NoError();
+}
+
+egl::Error DeviceD3D::initialize()
+{
+ ASSERT(!mIsInitialized);
+
+#if defined(ANGLE_ENABLE_D3D11)
+ if (mDeviceType == EGL_D3D11_DEVICE_ANGLE)
+ {
+ // Validate the device
+ IUnknown *iunknown = static_cast<IUnknown *>(mDevice);
+
+ ID3D11Device *d3dDevice = nullptr;
+ HRESULT hr =
+ iunknown->QueryInterface(__uuidof(ID3D11Device), reinterpret_cast<void **>(&d3dDevice));
+ if (FAILED(hr))
+ {
+ return egl::EglBadAttribute() << "Invalid D3D device passed into EGLDeviceEXT";
+ }
+
+ // The QI to ID3D11Device adds a ref to the D3D11 device.
+ // Deliberately don't release the ref here, so that the DeviceD3D holds a ref to the
+ // D3D11 device.
+ }
+#endif
+
+ mIsInitialized = true;
+
+ return egl::NoError();
+}
+
+EGLint DeviceD3D::getType()
+{
+ return mDeviceType;
+}
+
+void DeviceD3D::generateExtensions(egl::DeviceExtensions *outExtensions) const
+{
+ outExtensions->deviceD3D = true;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.h
new file mode 100644
index 0000000000..7c0ceb732b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DeviceD3D.h
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DeviceD3D.h: D3D implementation of egl::Device
+
+#ifndef LIBANGLE_RENDERER_D3D_DEVICED3D_H_
+#define LIBANGLE_RENDERER_D3D_DEVICED3D_H_
+
+#include "libANGLE/Device.h"
+#include "libANGLE/renderer/DeviceImpl.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+class DeviceD3D : public DeviceImpl
+{
+ public:
+ DeviceD3D(EGLint deviceType, void *nativeDevice);
+ ~DeviceD3D() override;
+
+ egl::Error initialize() override;
+ egl::Error getDevice(void **outValue) override;
+ EGLint getType() override;
+ void generateExtensions(egl::DeviceExtensions *outExtensions) const override;
+
+ private:
+ void *mDevice;
+ EGLint mDeviceType;
+ bool mIsInitialized;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_DEVICED3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.cpp
new file mode 100644
index 0000000000..1970daf62d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.cpp
@@ -0,0 +1,414 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DisplayD3D.cpp: D3D implementation of egl::Display
+
+#include "libANGLE/renderer/d3d/DisplayD3D.h"
+
+#include <EGL/eglext.h>
+
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Thread.h"
+#include "libANGLE/histogram_macros.h"
+#include "libANGLE/renderer/d3d/DeviceD3D.h"
+#include "libANGLE/renderer/d3d/EGLImageD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/SurfaceD3D.h"
+#include "libANGLE/renderer/d3d/SwapChainD3D.h"
+
+#if defined(ANGLE_ENABLE_D3D9)
+# include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#endif // ANGLE_ENABLE_D3D9
+
+#if defined(ANGLE_ENABLE_D3D11)
+# include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#endif // ANGLE_ENABLE_D3D11
+
+#if !defined(ANGLE_DEFAULT_D3D11)
+// Enables use of the Direct3D 11 API for a default display, when available
+# define ANGLE_DEFAULT_D3D11 1
+#endif
+
+namespace rx
+{
+
+typedef RendererD3D *(*CreateRendererD3DFunction)(egl::Display *);
+
+template <typename RendererType>
+static RendererD3D *CreateTypedRendererD3D(egl::Display *display)
+{
+ return new RendererType(display);
+}
+
+egl::Error CreateRendererD3D(egl::Display *display, RendererD3D **outRenderer)
+{
+ ASSERT(outRenderer != nullptr);
+
+ std::vector<CreateRendererD3DFunction> rendererCreationFunctions;
+
+ if (display->getPlatform() == EGL_PLATFORM_ANGLE_ANGLE)
+ {
+ const auto &attribMap = display->getAttributeMap();
+ EGLNativeDisplayType nativeDisplay = display->getNativeDisplayId();
+
+ EGLint requestedDisplayType = static_cast<EGLint>(
+ attribMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE));
+
+#if defined(ANGLE_ENABLE_D3D11)
+ if (nativeDisplay == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ nativeDisplay == EGL_D3D11_ONLY_DISPLAY_ANGLE ||
+ requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ rendererCreationFunctions.push_back(CreateTypedRendererD3D<Renderer11>);
+ }
+#endif
+
+#if defined(ANGLE_ENABLE_D3D9)
+ if (nativeDisplay == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+ requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE)
+ {
+ rendererCreationFunctions.push_back(CreateTypedRendererD3D<Renderer9>);
+ }
+#endif
+
+ if (nativeDisplay != EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE &&
+ nativeDisplay != EGL_D3D11_ONLY_DISPLAY_ANGLE &&
+ requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE)
+ {
+ // The default display is requested, try the D3D9 and D3D11 renderers, order them using
+ // the definition of ANGLE_DEFAULT_D3D11
+#if ANGLE_DEFAULT_D3D11
+# if defined(ANGLE_ENABLE_D3D11)
+ rendererCreationFunctions.push_back(CreateTypedRendererD3D<Renderer11>);
+# endif
+# if defined(ANGLE_ENABLE_D3D9)
+ rendererCreationFunctions.push_back(CreateTypedRendererD3D<Renderer9>);
+# endif
+#else
+# if defined(ANGLE_ENABLE_D3D9)
+ rendererCreationFunctions.push_back(CreateTypedRendererD3D<Renderer9>);
+# endif
+# if defined(ANGLE_ENABLE_D3D11)
+ rendererCreationFunctions.push_back(CreateTypedRendererD3D<Renderer11>);
+# endif
+#endif
+ }
+ }
+ else if (display->getPlatform() == EGL_PLATFORM_DEVICE_EXT)
+ {
+#if defined(ANGLE_ENABLE_D3D11)
+ if (display->getDevice()->getType() == EGL_D3D11_DEVICE_ANGLE)
+ {
+ rendererCreationFunctions.push_back(CreateTypedRendererD3D<Renderer11>);
+ }
+#endif
+ }
+ else
+ {
+ UNIMPLEMENTED();
+ }
+
+ for (size_t i = 0; i < rendererCreationFunctions.size(); i++)
+ {
+ RendererD3D *renderer = rendererCreationFunctions[i](display);
+ egl::Error result = renderer->initialize();
+
+#if defined(ANGLE_ENABLE_D3D11)
+ if (renderer->getRendererClass() == RENDERER_D3D11)
+ {
+ ASSERT(result.getID() >= 0 && result.getID() < NUM_D3D11_INIT_ERRORS);
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3D11InitializeResult", result.getID(),
+ NUM_D3D11_INIT_ERRORS);
+ }
+#endif
+
+#if defined(ANGLE_ENABLE_D3D9)
+ if (renderer->getRendererClass() == RENDERER_D3D9)
+ {
+ ASSERT(result.getID() >= 0 && result.getID() < NUM_D3D9_INIT_ERRORS);
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3D9InitializeResult", result.getID(),
+ NUM_D3D9_INIT_ERRORS);
+ }
+#endif
+
+ if (!result.isError())
+ {
+ *outRenderer = renderer;
+ return result;
+ }
+
+ // Failed to create the renderer, try the next
+ SafeDelete(renderer);
+ }
+
+ return egl::EglNotInitialized() << "No available renderers.";
+}
+
+DisplayD3D::DisplayD3D(const egl::DisplayState &state) : DisplayImpl(state), mRenderer(nullptr) {}
+
+SurfaceImpl *DisplayD3D::createWindowSurface(const egl::SurfaceState &state,
+ EGLNativeWindowType window,
+ const egl::AttributeMap &attribs)
+{
+ ASSERT(mRenderer != nullptr);
+ return new WindowSurfaceD3D(state, mRenderer, mDisplay, window, attribs);
+}
+
+SurfaceImpl *DisplayD3D::createPbufferSurface(const egl::SurfaceState &state,
+ const egl::AttributeMap &attribs)
+{
+ ASSERT(mRenderer != nullptr);
+ return new PbufferSurfaceD3D(state, mRenderer, mDisplay, 0, nullptr, attribs);
+}
+
+SurfaceImpl *DisplayD3D::createPbufferFromClientBuffer(const egl::SurfaceState &state,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs)
+{
+ ASSERT(mRenderer != nullptr);
+ return new PbufferSurfaceD3D(state, mRenderer, mDisplay, buftype, clientBuffer, attribs);
+}
+
+SurfaceImpl *DisplayD3D::createPixmapSurface(const egl::SurfaceState &state,
+ NativePixmapType nativePixmap,
+ const egl::AttributeMap &attribs)
+{
+ UNIMPLEMENTED();
+ return nullptr;
+}
+
+ImageImpl *DisplayD3D::createImage(const egl::ImageState &state,
+ const gl::Context *context,
+ EGLenum target,
+ const egl::AttributeMap &attribs)
+{
+ return new EGLImageD3D(state, target, attribs, mRenderer);
+}
+
+DeviceImpl *DisplayD3D::createDevice()
+{
+ return mRenderer->createEGLDevice();
+}
+
+rx::ContextImpl *DisplayD3D::createContext(const gl::State &state,
+ gl::ErrorSet *errorSet,
+ const egl::Config *configuration,
+ const gl::Context *shareContext,
+ const egl::AttributeMap &attribs)
+{
+ ASSERT(mRenderer != nullptr);
+ return mRenderer->createContext(state, errorSet);
+}
+
+StreamProducerImpl *DisplayD3D::createStreamProducerD3DTexture(
+ egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs)
+{
+ ASSERT(mRenderer != nullptr);
+ return mRenderer->createStreamProducerD3DTexture(consumerType, attribs);
+}
+
+ExternalImageSiblingImpl *DisplayD3D::createExternalImageSibling(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs)
+{
+ ASSERT(mRenderer != nullptr);
+ return mRenderer->createExternalImageSibling(context, target, buffer, attribs);
+}
+
+egl::Error DisplayD3D::makeCurrent(egl::Surface *drawSurface,
+ egl::Surface *readSurface,
+ gl::Context *context)
+{
+ return egl::NoError();
+}
+
+egl::Error DisplayD3D::initialize(egl::Display *display)
+{
+ ASSERT(mRenderer == nullptr && display != nullptr);
+ mDisplay = display;
+ ANGLE_TRY(CreateRendererD3D(display, &mRenderer));
+ return egl::NoError();
+}
+
+void DisplayD3D::terminate()
+{
+ SafeDelete(mRenderer);
+}
+
+egl::ConfigSet DisplayD3D::generateConfigs()
+{
+ ASSERT(mRenderer != nullptr);
+ return mRenderer->generateConfigs();
+}
+
+bool DisplayD3D::testDeviceLost()
+{
+ ASSERT(mRenderer != nullptr);
+ return mRenderer->testDeviceLost();
+}
+
+egl::Error DisplayD3D::restoreLostDevice(const egl::Display *display)
+{
+ // Release surface resources to make the Reset() succeed
+ for (egl::Surface *surface : mState.surfaceSet)
+ {
+ ASSERT(!surface->getBoundTexture());
+ SurfaceD3D *surfaceD3D = GetImplAs<SurfaceD3D>(surface);
+ surfaceD3D->releaseSwapChain();
+ }
+
+ if (!mRenderer->resetDevice())
+ {
+ return egl::EglBadAlloc();
+ }
+
+ // Restore any surfaces that may have been lost
+ for (const egl::Surface *surface : mState.surfaceSet)
+ {
+ SurfaceD3D *surfaceD3D = GetImplAs<SurfaceD3D>(surface);
+
+ ANGLE_TRY(surfaceD3D->resetSwapChain(display));
+ }
+
+ return egl::NoError();
+}
+
+bool DisplayD3D::isValidNativeWindow(EGLNativeWindowType window) const
+{
+ return mRenderer->isValidNativeWindow(window);
+}
+
+egl::Error DisplayD3D::validateClientBuffer(const egl::Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const
+{
+ switch (buftype)
+ {
+ case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+ return mRenderer->validateShareHandle(configuration, static_cast<HANDLE>(clientBuffer),
+ attribs);
+
+ case EGL_D3D_TEXTURE_ANGLE:
+ return mRenderer->getD3DTextureInfo(configuration,
+ static_cast<IUnknown *>(clientBuffer), nullptr,
+ nullptr, nullptr, nullptr);
+
+ default:
+ return DisplayImpl::validateClientBuffer(configuration, buftype, clientBuffer, attribs);
+ }
+}
+
+egl::Error DisplayD3D::validateImageClientBuffer(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const
+{
+ switch (target)
+ {
+ case EGL_D3D11_TEXTURE_ANGLE:
+ {
+ return mRenderer->getD3DTextureInfo(nullptr, static_cast<IUnknown *>(clientBuffer),
+ nullptr, nullptr, nullptr, nullptr);
+ }
+
+ default:
+ return DisplayImpl::validateImageClientBuffer(context, target, clientBuffer, attribs);
+ }
+}
+
+void DisplayD3D::generateExtensions(egl::DisplayExtensions *outExtensions) const
+{
+ mRenderer->generateDisplayExtensions(outExtensions);
+}
+
+std::string DisplayD3D::getVendorString() const
+{
+ std::string vendorString = "Google Inc.";
+ if (mRenderer)
+ {
+ vendorString += " " + mRenderer->getVendorString();
+ }
+
+ return vendorString;
+}
+
+void DisplayD3D::generateCaps(egl::Caps *outCaps) const
+{
+ // Display must be initialized to generate caps
+ ASSERT(mRenderer != nullptr);
+
+ outCaps->textureNPOT = mRenderer->getNativeExtensions().textureNPOT;
+}
+
+egl::Error DisplayD3D::waitClient(const gl::Context *context)
+{
+ for (egl::Surface *surface : mState.surfaceSet)
+ {
+ SurfaceD3D *surfaceD3D = GetImplAs<SurfaceD3D>(surface);
+ ANGLE_TRY(surfaceD3D->checkForOutOfDateSwapChain(this));
+ }
+
+ return egl::NoError();
+}
+
+egl::Error DisplayD3D::waitNative(const gl::Context *context, EGLint engine)
+{
+ egl::Surface *drawSurface = context->getCurrentDrawSurface();
+ egl::Surface *readSurface = context->getCurrentReadSurface();
+
+ if (drawSurface != nullptr)
+ {
+ SurfaceD3D *drawSurfaceD3D = GetImplAs<SurfaceD3D>(drawSurface);
+ ANGLE_TRY(drawSurfaceD3D->checkForOutOfDateSwapChain(this));
+ }
+
+ if (readSurface != nullptr)
+ {
+ SurfaceD3D *readSurfaceD3D = GetImplAs<SurfaceD3D>(readSurface);
+ ANGLE_TRY(readSurfaceD3D->checkForOutOfDateSwapChain(this));
+ }
+
+ return egl::NoError();
+}
+
+gl::Version DisplayD3D::getMaxSupportedESVersion() const
+{
+ return mRenderer->getMaxSupportedESVersion();
+}
+
+gl::Version DisplayD3D::getMaxConformantESVersion() const
+{
+ return mRenderer->getMaxConformantESVersion();
+}
+
+void DisplayD3D::handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line)
+{
+ ASSERT(FAILED(hr));
+
+ std::stringstream errorStream;
+ errorStream << "Internal D3D11 error: " << gl::FmtHR(hr) << ", in " << file << ", " << function
+ << ":" << line << ". " << message;
+
+ mStoredErrorString = errorStream.str();
+}
+
+void DisplayD3D::populateFeatureList(angle::FeatureList *features)
+{
+ mRenderer->getFeatures().populateFeatureList(features);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.h
new file mode 100644
index 0000000000..e7594dc05f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DisplayD3D.h
@@ -0,0 +1,110 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// DisplayD3D.h: D3D implementation of egl::Display
+
+#ifndef LIBANGLE_RENDERER_D3D_DISPLAYD3D_H_
+#define LIBANGLE_RENDERER_D3D_DISPLAYD3D_H_
+
+#include "libANGLE/Device.h"
+#include "libANGLE/renderer/DisplayImpl.h"
+
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+class DisplayD3D : public DisplayImpl, public d3d::Context
+{
+ public:
+ DisplayD3D(const egl::DisplayState &state);
+
+ egl::Error initialize(egl::Display *display) override;
+ void terminate() override;
+
+ // Surface creation
+ SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
+ EGLNativeWindowType window,
+ const egl::AttributeMap &attribs) override;
+ SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
+ const egl::AttributeMap &attribs) override;
+ SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) override;
+ SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
+ NativePixmapType nativePixmap,
+ const egl::AttributeMap &attribs) override;
+
+ ImageImpl *createImage(const egl::ImageState &state,
+ const gl::Context *context,
+ EGLenum target,
+ const egl::AttributeMap &attribs) override;
+
+ ContextImpl *createContext(const gl::State &state,
+ gl::ErrorSet *errorSet,
+ const egl::Config *configuration,
+ const gl::Context *shareContext,
+ const egl::AttributeMap &attribs) override;
+
+ StreamProducerImpl *createStreamProducerD3DTexture(egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs) override;
+
+ ExternalImageSiblingImpl *createExternalImageSibling(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs) override;
+
+ egl::Error makeCurrent(egl::Surface *drawSurface,
+ egl::Surface *readSurface,
+ gl::Context *context) override;
+
+ egl::ConfigSet generateConfigs() override;
+
+ bool testDeviceLost() override;
+ egl::Error restoreLostDevice(const egl::Display *display) override;
+
+ bool isValidNativeWindow(EGLNativeWindowType window) const override;
+ egl::Error validateClientBuffer(const egl::Config *configuration,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const override;
+ egl::Error validateImageClientBuffer(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs) const override;
+
+ DeviceImpl *createDevice() override;
+
+ std::string getVendorString() const override;
+
+ egl::Error waitClient(const gl::Context *context) override;
+ egl::Error waitNative(const gl::Context *context, EGLint engine) override;
+ gl::Version getMaxSupportedESVersion() const override;
+ gl::Version getMaxConformantESVersion() const override;
+
+ void handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line) override;
+
+ const std::string &getStoredErrorString() const { return mStoredErrorString; }
+
+ void populateFeatureList(angle::FeatureList *features) override;
+
+ private:
+ void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
+ void generateCaps(egl::Caps *outCaps) const override;
+
+ egl::Display *mDisplay;
+
+ rx::RendererD3D *mRenderer;
+ std::string mStoredErrorString;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_DISPLAYD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
new file mode 100644
index 0000000000..4aeacc553f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
@@ -0,0 +1,1435 @@
+//
+// 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 "libANGLE/renderer/d3d/DynamicHLSL.h"
+
+#include "common/string_utils.h"
+#include "common/utilities.h"
+#include "compiler/translator/blocklayoutHLSL.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/VaryingPacking.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+
+using namespace gl;
+
+namespace rx
+{
+
+namespace
+{
+
+const char *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";
+ }
+}
+
+void HLSLComponentTypeString(std::ostringstream &ostream, GLenum componentType, int componentCount)
+{
+ ostream << HLSLComponentTypeString(componentType);
+ if (componentCount > 1)
+ {
+ ostream << componentCount;
+ }
+}
+
+const char *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";
+ }
+}
+
+void HLSLTypeString(std::ostringstream &ostream, GLenum type)
+{
+ if (gl::IsMatrixType(type))
+ {
+ ostream << HLSLMatrixTypeString(type);
+ return;
+ }
+
+ HLSLComponentTypeString(ostream, gl::VariableComponentType(type),
+ gl::VariableComponentCount(type));
+}
+
+const PixelShaderOutputVariable *FindOutputAtLocation(
+ const std::vector<PixelShaderOutputVariable> &outputVariables,
+ unsigned int location,
+ size_t index = 0)
+{
+ for (auto &outputVar : outputVariables)
+ {
+ if (outputVar.outputLocation == location && outputVar.outputIndex == index)
+ {
+ return &outputVar;
+ }
+ }
+
+ return nullptr;
+}
+
+void WriteArrayString(std::ostringstream &strstr, unsigned int i)
+{
+ static_assert(GL_INVALID_INDEX == UINT_MAX,
+ "GL_INVALID_INDEX must be equal to the max unsigned int.");
+ if (i == UINT_MAX)
+ {
+ return;
+ }
+
+ strstr << "[";
+ strstr << i;
+ strstr << "]";
+}
+
+constexpr const char *VERTEX_ATTRIBUTE_STUB_STRING = "@@ VERTEX ATTRIBUTES @@";
+constexpr const char *VERTEX_OUTPUT_STUB_STRING = "@@ VERTEX OUTPUT @@";
+constexpr const char *PIXEL_OUTPUT_STUB_STRING = "@@ PIXEL OUTPUT @@";
+constexpr const char *PIXEL_MAIN_PARAMETERS_STUB_STRING = "@@ PIXEL MAIN PARAMETERS @@";
+constexpr const char *MAIN_PROLOGUE_STUB_STRING = "@@ MAIN PROLOGUE @@";
+} // anonymous namespace
+
+// BuiltinInfo implementation
+
+BuiltinInfo::BuiltinInfo() = default;
+BuiltinInfo::~BuiltinInfo() = default;
+
+// DynamicHLSL implementation
+
+DynamicHLSL::DynamicHLSL(RendererD3D *const renderer) : mRenderer(renderer) {}
+
+std::string DynamicHLSL::generateVertexShaderForInputLayout(
+ const std::string &sourceShader,
+ const InputLayout &inputLayout,
+ const std::vector<sh::Attribute> &shaderAttributes) const
+{
+ std::ostringstream structStream;
+ std::ostringstream initStream;
+
+ structStream << "struct VS_INPUT\n"
+ << "{\n";
+
+ int semanticIndex = 0;
+ unsigned int inputIndex = 0;
+
+ // If gl_PointSize is used in the shader then pointsprites rendering is expected.
+ // If the renderer does not support Geometry shaders then Instanced PointSprite emulation
+ // must be used.
+ bool usesPointSize = sourceShader.find("GL_USES_POINT_SIZE") != std::string::npos;
+ bool useInstancedPointSpriteEmulation =
+ usesPointSize && mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled;
+
+ // Instanced PointSprite emulation requires additional entries in the
+ // VS_INPUT structure to support the vertices that make up the quad vertices.
+ // These values must be in sync with the cooresponding values added during inputlayout creation
+ // in InputLayoutCache::applyVertexBuffers().
+ //
+ // The additional entries must appear first in the VS_INPUT layout because
+ // Windows Phone 8 era devices require per vertex data to physically come
+ // before per instance data in the shader.
+ if (useInstancedPointSpriteEmulation)
+ {
+ structStream << " float3 spriteVertexPos : SPRITEPOSITION0;\n"
+ << " float2 spriteTexCoord : SPRITETEXCOORD0;\n";
+ }
+
+ for (size_t attributeIndex = 0; attributeIndex < shaderAttributes.size(); ++attributeIndex)
+ {
+ const sh::Attribute &shaderAttribute = shaderAttributes[attributeIndex];
+ if (!shaderAttribute.name.empty())
+ {
+ ASSERT(inputIndex < MAX_VERTEX_ATTRIBS);
+ angle::FormatID vertexFormatID =
+ inputIndex < inputLayout.size() ? inputLayout[inputIndex] : angle::FormatID::NONE;
+
+ // HLSL code for input structure
+ if (IsMatrixType(shaderAttribute.type))
+ {
+ // Matrix types are always transposed
+ structStream << " "
+ << HLSLMatrixTypeString(TransposeMatrixType(shaderAttribute.type));
+ }
+ else
+ {
+ GLenum componentType = mRenderer->getVertexComponentType(vertexFormatID);
+
+ if (shaderAttribute.name == "gl_InstanceID" ||
+ shaderAttribute.name == "gl_VertexID")
+ {
+ // The input types of the instance ID and vertex ID in HLSL (uint) differs from
+ // the ones in ESSL (int).
+ structStream << " uint";
+ }
+ else
+ {
+ structStream << " ";
+ HLSLComponentTypeString(structStream, componentType,
+ VariableComponentCount(shaderAttribute.type));
+ }
+ }
+
+ structStream << " " << DecorateVariable(shaderAttribute.name) << " : ";
+
+ if (shaderAttribute.name == "gl_InstanceID")
+ {
+ structStream << "SV_InstanceID";
+ }
+ else if (shaderAttribute.name == "gl_VertexID")
+ {
+ structStream << "SV_VertexID";
+ }
+ else
+ {
+ structStream << "TEXCOORD" << semanticIndex;
+ semanticIndex += VariableRegisterCount(shaderAttribute.type);
+ }
+
+ structStream << ";\n";
+
+ // HLSL code for initialization
+ initStream << " " << 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(vertexFormatID) & VERTEX_CONVERT_GPU) != 0)
+ {
+ GenerateAttributeConversionHLSL(vertexFormatID, shaderAttribute, initStream);
+ }
+ else
+ {
+ initStream << "input." << DecorateVariable(shaderAttribute.name);
+ }
+
+ if (shaderAttribute.name == "gl_VertexID")
+ {
+ // dx_VertexID contains the firstVertex offset
+ initStream << " + dx_VertexID";
+ }
+
+ initStream << ";\n";
+
+ inputIndex += VariableRowCount(TransposeMatrixType(shaderAttribute.type));
+ }
+ }
+
+ structStream << "};\n"
+ "\n"
+ "void initAttributes(VS_INPUT input)\n"
+ "{\n"
+ << initStream.str() << "}\n";
+
+ std::string vertexHLSL(sourceShader);
+
+ bool success =
+ angle::ReplaceSubstring(&vertexHLSL, VERTEX_ATTRIBUTE_STUB_STRING, structStream.str());
+ ASSERT(success);
+
+ return vertexHLSL;
+}
+
+std::string DynamicHLSL::generatePixelShaderForOutputSignature(
+ const std::string &sourceShader,
+ const std::vector<PixelShaderOutputVariable> &outputVariables,
+ bool usesFragDepth,
+ const std::vector<GLenum> &outputLayout) const
+{
+ const int shaderModel = mRenderer->getMajorShaderModel();
+ std::string targetSemantic = (shaderModel >= 4) ? "SV_TARGET" : "COLOR";
+ std::string depthSemantic = (shaderModel >= 4) ? "SV_Depth" : "DEPTH";
+
+ std::ostringstream declarationStream;
+ std::ostringstream copyStream;
+
+ declarationStream << "struct PS_OUTPUT\n"
+ "{\n";
+
+ size_t numOutputs = outputLayout.size();
+
+ // Workaround for HLSL 3.x: We can't do a depth/stencil only render, the runtime will complain.
+ if (numOutputs == 0 && (shaderModel == 3 || !mRenderer->getShaderModelSuffix().empty()))
+ {
+ numOutputs = 1u;
+ }
+ const PixelShaderOutputVariable defaultOutput(GL_FLOAT_VEC4, "dummy", "float4(0, 0, 0, 1)", 0,
+ 0);
+ size_t outputIndex = 0;
+
+ for (size_t layoutIndex = 0; layoutIndex < numOutputs; ++layoutIndex)
+ {
+ GLenum binding = outputLayout.empty() ? GL_COLOR_ATTACHMENT0 : outputLayout[layoutIndex];
+
+ if (binding != GL_NONE)
+ {
+ unsigned int location = (binding - GL_COLOR_ATTACHMENT0);
+ outputIndex =
+ layoutIndex > 0 && binding == outputLayout[layoutIndex - 1] ? outputIndex + 1 : 0;
+
+ const PixelShaderOutputVariable *outputVariable =
+ outputLayout.empty() ? &defaultOutput
+ : FindOutputAtLocation(outputVariables, location, outputIndex);
+
+ // OpenGL ES 3.0 spec $4.2.1
+ // If [...] not all user-defined output variables are written, the values of fragment
+ // colors corresponding to unwritten variables are similarly undefined.
+ if (outputVariable)
+ {
+ declarationStream << " ";
+ HLSLTypeString(declarationStream, outputVariable->type);
+ declarationStream << " " << outputVariable->name << " : " << targetSemantic
+ << static_cast<int>(layoutIndex) << ";\n";
+
+ copyStream << " output." << outputVariable->name << " = "
+ << outputVariable->source << ";\n";
+ }
+ }
+ }
+
+ if (usesFragDepth)
+ {
+ declarationStream << " float gl_Depth : " << depthSemantic << ";\n";
+ copyStream << " output.gl_Depth = gl_Depth; \n";
+ }
+
+ declarationStream << "};\n"
+ "\n"
+ "PS_OUTPUT generateOutput()\n"
+ "{\n"
+ " PS_OUTPUT output;\n"
+ << copyStream.str()
+ << " return output;\n"
+ "}\n";
+
+ std::string pixelHLSL(sourceShader);
+
+ bool success =
+ angle::ReplaceSubstring(&pixelHLSL, PIXEL_OUTPUT_STUB_STRING, declarationStream.str());
+ ASSERT(success);
+
+ return pixelHLSL;
+}
+
+std::string DynamicHLSL::generateComputeShaderForImage2DBindSignature(
+ const d3d::Context *context,
+ ProgramD3D &programD3D,
+ const gl::ProgramState &programData,
+ std::vector<sh::Uniform> &image2DUniforms,
+ const gl::ImageUnitTextureTypeMap &image2DBindLayout) const
+{
+ std::string computeHLSL(
+ programData.getAttachedShader(ShaderType::Compute)->getTranslatedSource());
+
+ if (image2DUniforms.empty())
+ {
+ return computeHLSL;
+ }
+
+ return GenerateComputeShaderForImage2DBindSignature(context, programD3D, programData,
+ image2DUniforms, image2DBindLayout);
+}
+
+void DynamicHLSL::generateVaryingLinkHLSL(const VaryingPacking &varyingPacking,
+ const BuiltinInfo &builtins,
+ bool programUsesPointSize,
+ std::ostringstream &hlslStream) const
+{
+ ASSERT(builtins.dxPosition.enabled);
+ hlslStream << "{\n"
+ << " float4 dx_Position : " << builtins.dxPosition.str() << ";\n";
+
+ if (builtins.glPosition.enabled)
+ {
+ hlslStream << " float4 gl_Position : " << builtins.glPosition.str() << ";\n";
+ }
+
+ if (builtins.glFragCoord.enabled)
+ {
+ hlslStream << " float4 gl_FragCoord : " << builtins.glFragCoord.str() << ";\n";
+ }
+
+ if (builtins.glPointCoord.enabled)
+ {
+ hlslStream << " float2 gl_PointCoord : " << builtins.glPointCoord.str() << ";\n";
+ }
+
+ if (builtins.glPointSize.enabled)
+ {
+ hlslStream << " float gl_PointSize : " << builtins.glPointSize.str() << ";\n";
+ }
+
+ if (builtins.glViewIDOVR.enabled)
+ {
+ hlslStream << " nointerpolation uint gl_ViewID_OVR : " << builtins.glViewIDOVR.str()
+ << ";\n";
+ }
+
+ std::string varyingSemantic =
+ GetVaryingSemantic(mRenderer->getMajorShaderModel(), programUsesPointSize);
+
+ const auto &registerInfos = varyingPacking.getRegisterList();
+ for (GLuint registerIndex = 0u; registerIndex < registerInfos.size(); ++registerIndex)
+ {
+ const PackedVaryingRegister &registerInfo = registerInfos[registerIndex];
+ const auto &varying = *registerInfo.packedVarying->varying;
+ ASSERT(!varying.isStruct());
+
+ // TODO: Add checks to ensure D3D interpolation modifiers don't result in too many
+ // registers being used.
+ // For example, if there are N registers, and we have N vec3 varyings and 1 float
+ // varying, then D3D will pack them into N registers.
+ // If the float varying has the 'nointerpolation' modifier on it then we would need
+ // N + 1 registers, and D3D compilation will fail.
+
+ switch (registerInfo.packedVarying->interpolation)
+ {
+ case sh::INTERPOLATION_SMOOTH:
+ hlslStream << " ";
+ break;
+ case sh::INTERPOLATION_FLAT:
+ hlslStream << " nointerpolation ";
+ break;
+ case sh::INTERPOLATION_CENTROID:
+ hlslStream << " centroid ";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ GLenum transposedType = gl::TransposeMatrixType(varying.type);
+ GLenum componentType = gl::VariableComponentType(transposedType);
+ int columnCount = gl::VariableColumnCount(transposedType);
+ HLSLComponentTypeString(hlslStream, componentType, columnCount);
+ hlslStream << " v" << registerIndex << " : " << varyingSemantic << registerIndex << ";\n";
+ }
+
+ // Note that the following outputs need to be declared after the others. They are not included
+ // in pixel shader inputs even when they are in vertex/geometry shader outputs, and the pixel
+ // shader input struct must be a prefix of the vertex/geometry shader output struct.
+
+ if (builtins.glViewportIndex.enabled)
+ {
+ hlslStream << " nointerpolation uint gl_ViewportIndex : "
+ << builtins.glViewportIndex.str() << ";\n";
+ }
+
+ if (builtins.glLayer.enabled)
+ {
+ hlslStream << " nointerpolation uint gl_Layer : " << builtins.glLayer.str() << ";\n";
+ }
+
+ hlslStream << "};\n";
+}
+
+void DynamicHLSL::generateShaderLinkHLSL(const gl::Caps &caps,
+ const gl::ProgramState &programData,
+ const ProgramD3DMetadata &programMetadata,
+ const VaryingPacking &varyingPacking,
+ const BuiltinVaryingsD3D &builtinsD3D,
+ gl::ShaderMap<std::string> *shaderHLSL) const
+{
+ ASSERT(shaderHLSL);
+ ASSERT((*shaderHLSL)[gl::ShaderType::Vertex].empty() &&
+ (*shaderHLSL)[gl::ShaderType::Fragment].empty());
+
+ gl::Shader *vertexShaderGL = programData.getAttachedShader(ShaderType::Vertex);
+ gl::Shader *fragmentShaderGL = programData.getAttachedShader(ShaderType::Fragment);
+ const ShaderD3D *fragmentShader = GetImplAs<ShaderD3D>(fragmentShaderGL);
+ const int shaderModel = mRenderer->getMajorShaderModel();
+
+ // usesViewScale() isn't supported in the D3D9 renderer
+ ASSERT(shaderModel >= 4 || !programMetadata.usesViewScale());
+
+ bool useInstancedPointSpriteEmulation =
+ programMetadata.usesPointSize() &&
+ mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled;
+
+ // Validation done in the compiler
+ ASSERT(!fragmentShader->usesFragColor() || !fragmentShader->usesFragData());
+
+ std::ostringstream vertexStream;
+ vertexStream << "struct VS_OUTPUT\n";
+ const auto &vertexBuiltins = builtinsD3D[gl::ShaderType::Vertex];
+ generateVaryingLinkHLSL(varyingPacking, vertexBuiltins, builtinsD3D.usesPointSize(),
+ vertexStream);
+
+ // Instanced PointSprite emulation requires additional entries originally generated in the
+ // GeometryShader HLSL. These include pointsize clamp values.
+ if (useInstancedPointSpriteEmulation)
+ {
+ vertexStream << "static float minPointSize = " << static_cast<int>(caps.minAliasedPointSize)
+ << ".0f;\n"
+ << "static float maxPointSize = " << static_cast<int>(caps.maxAliasedPointSize)
+ << ".0f;\n";
+ }
+
+ std::ostringstream vertexGenerateOutput;
+ vertexGenerateOutput << "VS_OUTPUT generateOutput(VS_INPUT input)\n"
+ << "{\n"
+ << " VS_OUTPUT output;\n";
+
+ if (vertexBuiltins.glPosition.enabled)
+ {
+ vertexGenerateOutput << " output.gl_Position = gl_Position;\n";
+ }
+
+ if (vertexBuiltins.glViewIDOVR.enabled)
+ {
+ vertexGenerateOutput << " output.gl_ViewID_OVR = ViewID_OVR;\n";
+ }
+ if (programMetadata.hasANGLEMultiviewEnabled() && programMetadata.canSelectViewInVertexShader())
+ {
+ ASSERT(vertexBuiltins.glViewportIndex.enabled && vertexBuiltins.glLayer.enabled);
+ vertexGenerateOutput << " if (multiviewSelectViewportIndex)\n"
+ << " {\n"
+ << " output.gl_ViewportIndex = ViewID_OVR;\n"
+ << " } else {\n"
+ << " output.gl_ViewportIndex = 0;\n"
+ << " output.gl_Layer = ViewID_OVR;\n"
+ << " }\n";
+ }
+
+ // On D3D9 or D3D11 Feature Level 9, we need to emulate large viewports using dx_ViewAdjust.
+ if (shaderModel >= 4 && mRenderer->getShaderModelSuffix() == "")
+ {
+ vertexGenerateOutput << " output.dx_Position.x = gl_Position.x;\n";
+
+ if (programMetadata.usesViewScale())
+ {
+ // This code assumes that dx_ViewScale.y = -1.0f when rendering to texture, and +1.0f
+ // when rendering to the default framebuffer. No other values are valid.
+ vertexGenerateOutput << " output.dx_Position.y = dx_ViewScale.y * gl_Position.y;\n";
+ }
+ else
+ {
+ vertexGenerateOutput << " output.dx_Position.y = - gl_Position.y;\n";
+ }
+
+ vertexGenerateOutput
+ << " output.dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
+ << " output.dx_Position.w = gl_Position.w;\n";
+ }
+ else
+ {
+ vertexGenerateOutput << " output.dx_Position.x = gl_Position.x * dx_ViewAdjust.z + "
+ "dx_ViewAdjust.x * gl_Position.w;\n";
+
+ // If usesViewScale() is true and we're using the D3D11 renderer via Feature Level 9_*,
+ // then we need to multiply the gl_Position.y by the viewScale.
+ // usesViewScale() isn't supported when using the D3D9 renderer.
+ if (programMetadata.usesViewScale() &&
+ (shaderModel >= 4 && mRenderer->getShaderModelSuffix() != ""))
+ {
+ vertexGenerateOutput << " output.dx_Position.y = dx_ViewScale.y * (gl_Position.y * "
+ "dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n";
+ }
+ else
+ {
+ vertexGenerateOutput
+ << " output.dx_Position.y = -(gl_Position.y * dx_ViewAdjust.w + "
+ "dx_ViewAdjust.y * gl_Position.w);\n";
+ }
+
+ vertexGenerateOutput
+ << " output.dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n"
+ << " output.dx_Position.w = gl_Position.w;\n";
+ }
+
+ // We don't need to output gl_PointSize if we use are emulating point sprites via instancing.
+ if (vertexBuiltins.glPointSize.enabled)
+ {
+ vertexGenerateOutput << " output.gl_PointSize = gl_PointSize;\n";
+ }
+
+ if (vertexBuiltins.glFragCoord.enabled)
+ {
+ vertexGenerateOutput << " output.gl_FragCoord = gl_Position;\n";
+ }
+
+ const auto &registerInfos = varyingPacking.getRegisterList();
+ for (GLuint registerIndex = 0u; registerIndex < registerInfos.size(); ++registerIndex)
+ {
+ const PackedVaryingRegister &registerInfo = registerInfos[registerIndex];
+ const auto &packedVarying = *registerInfo.packedVarying;
+ const auto &varying = *packedVarying.varying;
+ ASSERT(!varying.isStruct());
+
+ vertexGenerateOutput << " output.v" << registerIndex << " = ";
+
+ if (packedVarying.isStructField())
+ {
+ vertexGenerateOutput << DecorateVariable(packedVarying.parentStructName) << ".";
+ }
+
+ vertexGenerateOutput << DecorateVariable(varying.name);
+
+ if (varying.isArray())
+ {
+ WriteArrayString(vertexGenerateOutput, registerInfo.varyingArrayIndex);
+ }
+
+ if (VariableRowCount(varying.type) > 1)
+ {
+ WriteArrayString(vertexGenerateOutput, registerInfo.varyingRowIndex);
+ }
+
+ vertexGenerateOutput << ";\n";
+ }
+
+ // Instanced PointSprite emulation requires additional entries to calculate
+ // the final output vertex positions of the quad that represents each sprite.
+ if (useInstancedPointSpriteEmulation)
+ {
+ vertexGenerateOutput
+ << "\n"
+ << " gl_PointSize = clamp(gl_PointSize, minPointSize, maxPointSize);\n";
+
+ vertexGenerateOutput
+ << " output.dx_Position.x += (input.spriteVertexPos.x * gl_PointSize / "
+ "(dx_ViewCoords.x*2)) * output.dx_Position.w;";
+
+ if (programMetadata.usesViewScale())
+ {
+ // Multiply by ViewScale to invert the rendering when appropriate
+ vertexGenerateOutput
+ << " output.dx_Position.y += (-dx_ViewScale.y * "
+ "input.spriteVertexPos.y * gl_PointSize / (dx_ViewCoords.y*2)) * "
+ "output.dx_Position.w;";
+ }
+ else
+ {
+ vertexGenerateOutput
+ << " output.dx_Position.y += (input.spriteVertexPos.y * gl_PointSize / "
+ "(dx_ViewCoords.y*2)) * output.dx_Position.w;";
+ }
+
+ vertexGenerateOutput
+ << " output.dx_Position.z += input.spriteVertexPos.z * output.dx_Position.w;\n";
+
+ if (programMetadata.usesPointCoord())
+ {
+ vertexGenerateOutput << "\n"
+ << " output.gl_PointCoord = input.spriteTexCoord;\n";
+ }
+ }
+
+ // Renderers that enable instanced pointsprite emulation require the vertex shader output member
+ // gl_PointCoord to be set to a default value if used without gl_PointSize. 0.5,0.5 is the same
+ // default value used in the generated pixel shader.
+ if (programMetadata.usesInsertedPointCoordValue())
+ {
+ ASSERT(!useInstancedPointSpriteEmulation);
+ vertexGenerateOutput << "\n"
+ << " output.gl_PointCoord = float2(0.5, 0.5);\n";
+ }
+
+ vertexGenerateOutput << "\n"
+ << " return output;\n"
+ << "}";
+
+ std::string vertexSource = vertexShaderGL->getTranslatedSource();
+ angle::ReplaceSubstring(&vertexSource, std::string(MAIN_PROLOGUE_STUB_STRING),
+ " initAttributes(input);\n");
+ angle::ReplaceSubstring(&vertexSource, std::string(VERTEX_OUTPUT_STUB_STRING),
+ vertexGenerateOutput.str());
+ vertexStream << vertexSource;
+
+ const auto &pixelBuiltins = builtinsD3D[gl::ShaderType::Fragment];
+
+ std::ostringstream pixelStream;
+ pixelStream << "struct PS_INPUT\n";
+ generateVaryingLinkHLSL(varyingPacking, pixelBuiltins, builtinsD3D.usesPointSize(),
+ pixelStream);
+ pixelStream << "\n";
+
+ std::ostringstream pixelPrologue;
+ if (fragmentShader->usesViewID())
+ {
+ ASSERT(pixelBuiltins.glViewIDOVR.enabled);
+ pixelPrologue << " ViewID_OVR = input.gl_ViewID_OVR;\n";
+ }
+
+ if (pixelBuiltins.glFragCoord.enabled)
+ {
+ pixelPrologue << " float rhw = 1.0 / input.gl_FragCoord.w;\n";
+
+ // Certain Shader Models (4_0+ and 3_0) allow reading from dx_Position in the pixel shader.
+ // Other Shader Models (4_0_level_9_3 and 2_x) don't support this, so we emulate it using
+ // dx_ViewCoords.
+ if (shaderModel >= 4 && mRenderer->getShaderModelSuffix() == "")
+ {
+ pixelPrologue << " gl_FragCoord.x = input.dx_Position.x;\n"
+ << " gl_FragCoord.y = input.dx_Position.y;\n";
+ }
+ else if (shaderModel == 3)
+ {
+ pixelPrologue << " gl_FragCoord.x = input.dx_Position.x + 0.5;\n"
+ << " gl_FragCoord.y = input.dx_Position.y + 0.5;\n";
+ }
+ else
+ {
+ // dx_ViewCoords contains the viewport width/2, height/2, center.x and center.y. See
+ // Renderer::setViewport()
+ pixelPrologue
+ << " 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";
+ }
+
+ if (programMetadata.usesViewScale())
+ {
+ // For Feature Level 9_3 and below, we need to correct gl_FragCoord.y to account
+ // for dx_ViewScale. On Feature Level 10_0+, gl_FragCoord.y is calculated above using
+ // dx_ViewCoords and is always correct irrespective of dx_ViewScale's value.
+ // NOTE: usesViewScale() can only be true on D3D11 (i.e. Shader Model 4.0+).
+ if (shaderModel >= 4 && mRenderer->getShaderModelSuffix() == "")
+ {
+ // Some assumptions:
+ // - dx_ViewScale.y = -1.0f when rendering to texture
+ // - dx_ViewScale.y = +1.0f when rendering to the default framebuffer
+ // - gl_FragCoord.y has been set correctly above.
+ //
+ // When rendering to the backbuffer, the code inverts gl_FragCoord's y coordinate.
+ // This involves subtracting the y coordinate from the height of the area being
+ // rendered to.
+ //
+ // First we calculate the height of the area being rendered to:
+ // render_area_height = (2.0f / (1.0f - input.gl_FragCoord.y * rhw)) *
+ // gl_FragCoord.y
+ //
+ // Note that when we're rendering to default FB, we want our output to be
+ // equivalent to:
+ // "gl_FragCoord.y = render_area_height - gl_FragCoord.y"
+ //
+ // When we're rendering to a texture, we want our output to be equivalent to:
+ // "gl_FragCoord.y = gl_FragCoord.y;"
+ //
+ // If we set scale_factor = ((1.0f + dx_ViewScale.y) / 2.0f), then notice that
+ // - When rendering to default FB: scale_factor = 1.0f
+ // - When rendering to texture: scale_factor = 0.0f
+ //
+ // Therefore, we can get our desired output by setting:
+ // "gl_FragCoord.y = scale_factor * render_area_height - dx_ViewScale.y *
+ // gl_FragCoord.y"
+ //
+ // Simplifying, this becomes:
+ pixelPrologue
+ << " gl_FragCoord.y = (1.0f + dx_ViewScale.y) * gl_FragCoord.y /"
+ "(1.0f - input.gl_FragCoord.y * rhw) - dx_ViewScale.y * gl_FragCoord.y;\n";
+ }
+ }
+
+ pixelPrologue << " gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_DepthFront.x + "
+ "dx_DepthFront.y;\n"
+ << " gl_FragCoord.w = rhw;\n";
+ }
+
+ if (pixelBuiltins.glPointCoord.enabled && shaderModel >= 3)
+ {
+ pixelPrologue << " gl_PointCoord.x = input.gl_PointCoord.x;\n"
+ << " gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n";
+ }
+
+ if (fragmentShader->usesFrontFacing())
+ {
+ if (shaderModel <= 3)
+ {
+ pixelPrologue << " gl_FrontFacing = (vFace * dx_DepthFront.z >= 0.0);\n";
+ }
+ else
+ {
+ pixelPrologue << " gl_FrontFacing = isFrontFace;\n";
+ }
+ }
+
+ for (GLuint registerIndex = 0u; registerIndex < registerInfos.size(); ++registerIndex)
+ {
+ const PackedVaryingRegister &registerInfo = registerInfos[registerIndex];
+ const auto &packedVarying = *registerInfo.packedVarying;
+ const auto &varying = *packedVarying.varying;
+ ASSERT(!varying.isBuiltIn() && !varying.isStruct());
+
+ // Don't reference VS-only transform feedback varyings in the PS. Note that we're relying on
+ // that the active flag is set according to usage in the fragment shader.
+ if (packedVarying.vertexOnly || !varying.active)
+ continue;
+
+ pixelPrologue << " ";
+
+ if (packedVarying.isStructField())
+ {
+ pixelPrologue << DecorateVariable(packedVarying.parentStructName) << ".";
+ }
+
+ pixelPrologue << DecorateVariable(varying.name);
+
+ if (varying.isArray())
+ {
+ WriteArrayString(pixelPrologue, registerInfo.varyingArrayIndex);
+ }
+
+ GLenum transposedType = TransposeMatrixType(varying.type);
+ if (VariableRowCount(transposedType) > 1)
+ {
+ WriteArrayString(pixelPrologue, registerInfo.varyingRowIndex);
+ }
+
+ pixelPrologue << " = input.v" << registerIndex;
+
+ switch (VariableColumnCount(transposedType))
+ {
+ case 1:
+ pixelPrologue << ".x";
+ break;
+ case 2:
+ pixelPrologue << ".xy";
+ break;
+ case 3:
+ pixelPrologue << ".xyz";
+ break;
+ case 4:
+ break;
+ default:
+ UNREACHABLE();
+ }
+ pixelPrologue << ";\n";
+ }
+
+ std::string pixelSource = fragmentShaderGL->getTranslatedSource();
+
+ if (fragmentShader->usesFrontFacing())
+ {
+ if (shaderModel >= 4)
+ {
+ angle::ReplaceSubstring(&pixelSource, std::string(PIXEL_MAIN_PARAMETERS_STUB_STRING),
+ "PS_INPUT input, bool isFrontFace : SV_IsFrontFace");
+ }
+ else
+ {
+ angle::ReplaceSubstring(&pixelSource, std::string(PIXEL_MAIN_PARAMETERS_STUB_STRING),
+ "PS_INPUT input, float vFace : VFACE");
+ }
+ }
+ else
+ {
+ angle::ReplaceSubstring(&pixelSource, std::string(PIXEL_MAIN_PARAMETERS_STUB_STRING),
+ "PS_INPUT input");
+ }
+
+ angle::ReplaceSubstring(&pixelSource, std::string(MAIN_PROLOGUE_STUB_STRING),
+ pixelPrologue.str());
+ pixelStream << pixelSource;
+
+ (*shaderHLSL)[gl::ShaderType::Vertex] = vertexStream.str();
+ (*shaderHLSL)[gl::ShaderType::Fragment] = pixelStream.str();
+}
+
+std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &varyingPacking,
+ const BuiltinVaryingsD3D &builtinsD3D,
+ const bool hasANGLEMultiviewEnabled,
+ const bool selectViewInVS) const
+{
+ ASSERT(mRenderer->getMajorShaderModel() >= 4);
+
+ std::ostringstream preambleStream;
+
+ const auto &vertexBuiltins = builtinsD3D[gl::ShaderType::Vertex];
+
+ preambleStream << "struct GS_INPUT\n";
+ generateVaryingLinkHLSL(varyingPacking, vertexBuiltins, builtinsD3D.usesPointSize(),
+ preambleStream);
+ preambleStream << "\n"
+ << "struct GS_OUTPUT\n";
+ generateVaryingLinkHLSL(varyingPacking, builtinsD3D[gl::ShaderType::Geometry],
+ builtinsD3D.usesPointSize(), preambleStream);
+ preambleStream
+ << "\n"
+ << "void copyVertex(inout GS_OUTPUT output, GS_INPUT input, GS_INPUT flatinput)\n"
+ << "{\n"
+ << " output.gl_Position = input.gl_Position;\n";
+
+ if (vertexBuiltins.glPointSize.enabled)
+ {
+ preambleStream << " output.gl_PointSize = input.gl_PointSize;\n";
+ }
+
+ if (hasANGLEMultiviewEnabled)
+ {
+ preambleStream << " output.gl_ViewID_OVR = input.gl_ViewID_OVR;\n";
+ if (selectViewInVS)
+ {
+ ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled &&
+ builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
+
+ // If the view is already selected in the VS, then we just pass the gl_ViewportIndex and
+ // gl_Layer to the output.
+ preambleStream << " output.gl_ViewportIndex = input.gl_ViewportIndex;\n"
+ << " output.gl_Layer = input.gl_Layer;\n";
+ }
+ }
+
+ const auto &registerInfos = varyingPacking.getRegisterList();
+ for (GLuint registerIndex = 0u; registerIndex < registerInfos.size(); ++registerIndex)
+ {
+ const PackedVaryingRegister &varyingRegister = registerInfos[registerIndex];
+ preambleStream << " output.v" << registerIndex << " = ";
+ if (varyingRegister.packedVarying->interpolation == sh::INTERPOLATION_FLAT)
+ {
+ preambleStream << "flat";
+ }
+ preambleStream << "input.v" << registerIndex << "; \n";
+ }
+
+ if (vertexBuiltins.glFragCoord.enabled)
+ {
+ preambleStream << " output.gl_FragCoord = input.gl_FragCoord;\n";
+ }
+
+ // Only write the dx_Position if we aren't using point sprites
+ preambleStream << "#ifndef ANGLE_POINT_SPRITE_SHADER\n"
+ << " output.dx_Position = input.dx_Position;\n"
+ << "#endif // ANGLE_POINT_SPRITE_SHADER\n"
+ << "}\n";
+
+ if (hasANGLEMultiviewEnabled && !selectViewInVS)
+ {
+ ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled &&
+ builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
+
+ // According to the HLSL reference, using SV_RenderTargetArrayIndex is only valid if the
+ // render target is an array resource. Because of this we do not write to gl_Layer if we are
+ // taking the side-by-side code path. We still select the viewport index in the layered code
+ // path as that is always valid. See:
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/bb509647(v=vs.85).aspx
+ preambleStream << "\n"
+ << "void selectView(inout GS_OUTPUT output, GS_INPUT input)\n"
+ << "{\n"
+ << " if (multiviewSelectViewportIndex)\n"
+ << " {\n"
+ << " output.gl_ViewportIndex = input.gl_ViewID_OVR;\n"
+ << " } else {\n"
+ << " output.gl_ViewportIndex = 0;\n"
+ << " output.gl_Layer = input.gl_ViewID_OVR;\n"
+ << " }\n"
+ << "}\n";
+ }
+
+ return preambleStream.str();
+}
+
+std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
+ gl::PrimitiveMode primitiveType,
+ const gl::ProgramState &programData,
+ const bool useViewScale,
+ const bool hasANGLEMultiviewEnabled,
+ const bool selectViewInVS,
+ const bool pointSpriteEmulation,
+ const std::string &preambleString) const
+{
+ ASSERT(mRenderer->getMajorShaderModel() >= 4);
+
+ std::stringstream shaderStream;
+
+ const bool pointSprites = (primitiveType == gl::PrimitiveMode::Points) && pointSpriteEmulation;
+ const bool usesPointCoord = preambleString.find("gl_PointCoord") != std::string::npos;
+
+ const char *inputPT = nullptr;
+ const char *outputPT = nullptr;
+ int inputSize = 0;
+ int maxVertexOutput = 0;
+
+ switch (primitiveType)
+ {
+ case gl::PrimitiveMode::Points:
+ inputPT = "point";
+ inputSize = 1;
+
+ if (pointSprites)
+ {
+ outputPT = "Triangle";
+ maxVertexOutput = 4;
+ }
+ else
+ {
+ outputPT = "Point";
+ maxVertexOutput = 1;
+ }
+
+ break;
+
+ case gl::PrimitiveMode::Lines:
+ case gl::PrimitiveMode::LineStrip:
+ case gl::PrimitiveMode::LineLoop:
+ inputPT = "line";
+ outputPT = "Line";
+ inputSize = 2;
+ maxVertexOutput = 2;
+ break;
+
+ case gl::PrimitiveMode::Triangles:
+ case gl::PrimitiveMode::TriangleStrip:
+ case gl::PrimitiveMode::TriangleFan:
+ inputPT = "triangle";
+ outputPT = "Triangle";
+ inputSize = 3;
+ maxVertexOutput = 3;
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ if (pointSprites || hasANGLEMultiviewEnabled)
+ {
+ shaderStream << "cbuffer DriverConstants : register(b0)\n"
+ "{\n";
+
+ if (pointSprites)
+ {
+ shaderStream << " float4 dx_ViewCoords : packoffset(c1);\n";
+ if (useViewScale)
+ {
+ shaderStream << " float2 dx_ViewScale : packoffset(c3);\n";
+ }
+ }
+
+ if (hasANGLEMultiviewEnabled)
+ {
+ // We have to add a value which we can use to keep track of which multi-view code path
+ // is to be selected in the GS.
+ shaderStream << " float multiviewSelectViewportIndex : packoffset(c3.z);\n";
+ }
+
+ shaderStream << "};\n\n";
+ }
+
+ if (pointSprites)
+ {
+ shaderStream << "#define ANGLE_POINT_SPRITE_SHADER\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 = "
+ << static_cast<int>(caps.minAliasedPointSize)
+ << ".0f;\n"
+ "static float maxPointSize = "
+ << static_cast<int>(caps.maxAliasedPointSize) << ".0f;\n"
+ << "\n";
+ }
+
+ shaderStream << preambleString << "\n"
+ << "[maxvertexcount(" << maxVertexOutput << ")]\n"
+ << "void main(" << inputPT << " GS_INPUT input[" << inputSize << "], ";
+
+ if (primitiveType == gl::PrimitiveMode::TriangleStrip)
+ {
+ shaderStream << "uint primitiveID : SV_PrimitiveID, ";
+ }
+
+ shaderStream << " inout " << outputPT << "Stream<GS_OUTPUT> outStream)\n"
+ << "{\n"
+ << " GS_OUTPUT output = (GS_OUTPUT)0;\n";
+
+ if (primitiveType == gl::PrimitiveMode::TriangleStrip)
+ {
+ shaderStream << " uint lastVertexIndex = (primitiveID % 2 == 0 ? 2 : 1);\n";
+ }
+ else
+ {
+ shaderStream << " uint lastVertexIndex = " << (inputSize - 1) << ";\n";
+ }
+
+ for (int vertexIndex = 0; vertexIndex < inputSize; ++vertexIndex)
+ {
+ shaderStream << " copyVertex(output, input[" << vertexIndex
+ << "], input[lastVertexIndex]);\n";
+ if (hasANGLEMultiviewEnabled && !selectViewInVS)
+ {
+ shaderStream << " selectView(output, input[" << vertexIndex << "]);\n";
+ }
+ if (!pointSprites)
+ {
+ ASSERT(inputSize == maxVertexOutput);
+ shaderStream << " outStream.Append(output);\n";
+ }
+ }
+
+ if (pointSprites)
+ {
+ shaderStream << "\n"
+ " float4 dx_Position = input[0].dx_Position;\n"
+ " float gl_PointSize = clamp(input[0].gl_PointSize, minPointSize, "
+ "maxPointSize);\n"
+ " float2 viewportScale = float2(1.0f / dx_ViewCoords.x, 1.0f / "
+ "dx_ViewCoords.y) * dx_Position.w;\n";
+
+ for (int corner = 0; corner < 4; corner++)
+ {
+ if (useViewScale)
+ {
+ shaderStream << " \n"
+ " output.dx_Position = dx_Position + float4(1.0f, "
+ "-dx_ViewScale.y, 1.0f, 1.0f)"
+ " * float4(pointSpriteCorners["
+ << corner << "] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n";
+ }
+ else
+ {
+ shaderStream << "\n"
+ " output.dx_Position = dx_Position + float4(pointSpriteCorners["
+ << corner << "] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n";
+ }
+
+ if (usesPointCoord)
+ {
+ shaderStream << " output.gl_PointCoord = pointSpriteTexcoords[" << corner
+ << "];\n";
+ }
+
+ shaderStream << " outStream.Append(output);\n";
+ }
+ }
+
+ shaderStream << " \n"
+ " outStream.RestartStrip();\n"
+ "}\n";
+
+ return shaderStream.str();
+}
+
+// static
+void DynamicHLSL::GenerateAttributeConversionHLSL(angle::FormatID vertexFormatID,
+ const sh::ShaderVariable &shaderAttrib,
+ std::ostringstream &outStream)
+{
+ // Matrix
+ if (IsMatrixType(shaderAttrib.type))
+ {
+ outStream << "transpose(input." << DecorateVariable(shaderAttrib.name) << ")";
+ return;
+ }
+
+ GLenum shaderComponentType = VariableComponentType(shaderAttrib.type);
+ int shaderComponentCount = VariableComponentCount(shaderAttrib.type);
+ const gl::VertexFormat &vertexFormat = gl::GetVertexFormatFromID(vertexFormatID);
+
+ // Perform integer to float conversion (if necessary)
+ if (shaderComponentType == GL_FLOAT && vertexFormat.type != GL_FLOAT)
+ {
+ // TODO: normalization for 32-bit integer formats
+ ASSERT(!vertexFormat.normalized && !vertexFormat.pureInteger);
+ outStream << "float" << shaderComponentCount << "(input."
+ << DecorateVariable(shaderAttrib.name) << ")";
+ return;
+ }
+
+ // No conversion necessary
+ outStream << "input." << DecorateVariable(shaderAttrib.name);
+}
+
+void DynamicHLSL::getPixelShaderOutputKey(const gl::State &data,
+ const gl::ProgramState &programData,
+ const ProgramD3DMetadata &metadata,
+ std::vector<PixelShaderOutputVariable> *outPixelShaderKey)
+{
+ // 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
+ bool broadcast = metadata.usesBroadcast(data);
+ const unsigned int numRenderTargets =
+ (broadcast || metadata.usesMultipleFragmentOuts() ? data.getCaps().maxDrawBuffers : 1);
+
+ if (metadata.getMajorShaderVersion() < 300)
+ {
+ for (unsigned int renderTargetIndex = 0; renderTargetIndex < numRenderTargets;
+ renderTargetIndex++)
+ {
+ PixelShaderOutputVariable outputKeyVariable;
+ outputKeyVariable.type = GL_FLOAT_VEC4;
+ outputKeyVariable.name = "gl_Color" + Str(renderTargetIndex);
+ outputKeyVariable.source =
+ broadcast ? "gl_Color[0]" : "gl_Color[" + Str(renderTargetIndex) + "]";
+ outputKeyVariable.outputLocation = renderTargetIndex;
+
+ outPixelShaderKey->push_back(outputKeyVariable);
+ }
+
+ if (metadata.usesSecondaryColor())
+ {
+ for (unsigned int secondaryIndex = 0;
+ secondaryIndex < data.getExtensions().maxDualSourceDrawBuffers; secondaryIndex++)
+ {
+ PixelShaderOutputVariable outputKeyVariable;
+ outputKeyVariable.type = GL_FLOAT_VEC4;
+ outputKeyVariable.name = "gl_SecondaryColor" + Str(secondaryIndex);
+ outputKeyVariable.source = "gl_SecondaryColor[" + Str(secondaryIndex) + "]";
+ outputKeyVariable.outputLocation = secondaryIndex;
+ outputKeyVariable.outputIndex = 1;
+
+ outPixelShaderKey->push_back(outputKeyVariable);
+ }
+ }
+ }
+ else
+ {
+ const auto &shaderOutputVars =
+ metadata.getFragmentShader()->getData().getActiveOutputVariables();
+
+ for (size_t outputLocationIndex = 0u;
+ outputLocationIndex < programData.getOutputLocations().size(); ++outputLocationIndex)
+ {
+ const VariableLocation &outputLocation =
+ programData.getOutputLocations().at(outputLocationIndex);
+ if (!outputLocation.used())
+ {
+ continue;
+ }
+ const sh::ShaderVariable &outputVariable = shaderOutputVars[outputLocation.index];
+ const std::string &variableName = "out_" + outputVariable.name;
+
+ // Fragment outputs can't be arrays of arrays. ESSL 3.10 section 4.3.6.
+ const std::string &elementString =
+ (outputVariable.isArray() ? Str(outputLocation.arrayIndex) : "");
+
+ ASSERT(outputVariable.active);
+
+ PixelShaderOutputVariable outputKeyVariable;
+ outputKeyVariable.type = outputVariable.type;
+ outputKeyVariable.name = variableName + elementString;
+ outputKeyVariable.source =
+ variableName +
+ (outputVariable.isArray() ? ArrayString(outputLocation.arrayIndex) : "");
+ outputKeyVariable.outputLocation = outputLocationIndex;
+
+ outPixelShaderKey->push_back(outputKeyVariable);
+ }
+
+ // Now generate any secondary outputs...
+ for (size_t outputLocationIndex = 0u;
+ outputLocationIndex < programData.getSecondaryOutputLocations().size();
+ ++outputLocationIndex)
+ {
+ const VariableLocation &outputLocation =
+ programData.getSecondaryOutputLocations().at(outputLocationIndex);
+ if (!outputLocation.used())
+ {
+ continue;
+ }
+ const sh::ShaderVariable &outputVariable = shaderOutputVars[outputLocation.index];
+ const std::string &variableName = "out_" + outputVariable.name;
+
+ // Fragment outputs can't be arrays of arrays. ESSL 3.10 section 4.3.6.
+ const std::string &elementString =
+ (outputVariable.isArray() ? Str(outputLocation.arrayIndex) : "");
+
+ ASSERT(outputVariable.active);
+
+ PixelShaderOutputVariable outputKeyVariable;
+ outputKeyVariable.type = outputVariable.type;
+ outputKeyVariable.name = variableName + elementString;
+ outputKeyVariable.source =
+ variableName +
+ (outputVariable.isArray() ? ArrayString(outputLocation.arrayIndex) : "");
+ outputKeyVariable.outputLocation = outputLocationIndex;
+ outputKeyVariable.outputIndex = 1;
+
+ outPixelShaderKey->push_back(outputKeyVariable);
+ }
+ }
+}
+
+// BuiltinVarying Implementation.
+BuiltinVarying::BuiltinVarying() : enabled(false), index(0), systemValue(false) {}
+
+std::string BuiltinVarying::str() const
+{
+ return (systemValue ? semantic : (semantic + Str(index)));
+}
+
+void BuiltinVarying::enableSystem(const std::string &systemValueSemantic)
+{
+ enabled = true;
+ semantic = systemValueSemantic;
+ systemValue = true;
+}
+
+void BuiltinVarying::enable(const std::string &semanticVal, unsigned int indexVal)
+{
+ enabled = true;
+ semantic = semanticVal;
+ index = indexVal;
+}
+
+// BuiltinVaryingsD3D Implementation.
+BuiltinVaryingsD3D::BuiltinVaryingsD3D(const ProgramD3DMetadata &metadata,
+ const VaryingPacking &packing)
+{
+ updateBuiltins(gl::ShaderType::Vertex, metadata, packing);
+ updateBuiltins(gl::ShaderType::Fragment, metadata, packing);
+ int shaderModel = metadata.getRendererMajorShaderModel();
+ if (shaderModel >= 4)
+ {
+ updateBuiltins(gl::ShaderType::Geometry, metadata, packing);
+ }
+ // In shader model >= 4, some builtins need to be the same in vertex and pixel shaders - input
+ // struct needs to be a prefix of output struct.
+ ASSERT(shaderModel < 4 || mBuiltinInfo[gl::ShaderType::Vertex].glPosition.enabled ==
+ mBuiltinInfo[gl::ShaderType::Fragment].glPosition.enabled);
+ ASSERT(shaderModel < 4 || mBuiltinInfo[gl::ShaderType::Vertex].glFragCoord.enabled ==
+ mBuiltinInfo[gl::ShaderType::Fragment].glFragCoord.enabled);
+ ASSERT(shaderModel < 4 || mBuiltinInfo[gl::ShaderType::Vertex].glPointCoord.enabled ==
+ mBuiltinInfo[gl::ShaderType::Fragment].glPointCoord.enabled);
+ ASSERT(shaderModel < 4 || mBuiltinInfo[gl::ShaderType::Vertex].glPointSize.enabled ==
+ mBuiltinInfo[gl::ShaderType::Fragment].glPointSize.enabled);
+ ASSERT(shaderModel < 4 || mBuiltinInfo[gl::ShaderType::Vertex].glViewIDOVR.enabled ==
+ mBuiltinInfo[gl::ShaderType::Fragment].glViewIDOVR.enabled);
+}
+
+BuiltinVaryingsD3D::~BuiltinVaryingsD3D() = default;
+
+void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType,
+ const ProgramD3DMetadata &metadata,
+ const VaryingPacking &packing)
+{
+ const std::string &userSemantic = GetVaryingSemantic(metadata.getRendererMajorShaderModel(),
+ metadata.usesSystemValuePointSize());
+
+ // Note that when enabling builtins only for specific shader stages in shader model >= 4, the
+ // code needs to ensure that the input struct of the shader stage is a prefix of the output
+ // struct of the previous stage.
+
+ unsigned int reservedSemanticIndex = packing.getMaxSemanticIndex();
+
+ BuiltinInfo *builtins = &mBuiltinInfo[shaderType];
+
+ if (metadata.getRendererMajorShaderModel() >= 4)
+ {
+ builtins->dxPosition.enableSystem("SV_Position");
+ }
+ else if (shaderType == gl::ShaderType::Fragment)
+ {
+ builtins->dxPosition.enableSystem("VPOS");
+ }
+ else
+ {
+ builtins->dxPosition.enableSystem("POSITION");
+ }
+
+ if (metadata.usesTransformFeedbackGLPosition())
+ {
+ builtins->glPosition.enable(userSemantic, reservedSemanticIndex++);
+ }
+
+ if (metadata.usesFragCoord())
+ {
+ builtins->glFragCoord.enable(userSemantic, reservedSemanticIndex++);
+ }
+
+ if (shaderType == gl::ShaderType::Vertex ? metadata.addsPointCoordToVertexShader()
+ : metadata.usesPointCoord())
+ {
+ // SM3 reserves the TEXCOORD semantic for point sprite texcoords (gl_PointCoord)
+ // In D3D11 we manually compute gl_PointCoord in the GS.
+ if (metadata.getRendererMajorShaderModel() >= 4)
+ {
+ builtins->glPointCoord.enable(userSemantic, reservedSemanticIndex++);
+ }
+ else
+ {
+ builtins->glPointCoord.enable("TEXCOORD", 0);
+ }
+ }
+
+ if (metadata.hasANGLEMultiviewEnabled())
+ {
+ // Although it is possible to compute gl_ViewID_OVR from the value of
+ // SV_ViewportArrayIndex or SV_RenderTargetArrayIndex and the multi-view state in the
+ // driver constant buffer, it is easier and cleaner to always pass it as a varying.
+ builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++);
+
+ if (shaderType == gl::ShaderType::Vertex)
+ {
+ if (metadata.canSelectViewInVertexShader())
+ {
+ builtins->glViewportIndex.enableSystem("SV_ViewportArrayIndex");
+ builtins->glLayer.enableSystem("SV_RenderTargetArrayIndex");
+ }
+ }
+
+ if (shaderType == gl::ShaderType::Geometry)
+ {
+ // gl_Layer and gl_ViewportIndex are necessary so that we can write to either based on
+ // the multiview state in the driver constant buffer.
+ builtins->glViewportIndex.enableSystem("SV_ViewportArrayIndex");
+ builtins->glLayer.enableSystem("SV_RenderTargetArrayIndex");
+ }
+ }
+
+ // Special case: do not include PSIZE semantic in HLSL 3 pixel shaders
+ if (metadata.usesSystemValuePointSize() &&
+ (shaderType != gl::ShaderType::Fragment || metadata.getRendererMajorShaderModel() >= 4))
+ {
+ builtins->glPointSize.enableSystem("PSIZE");
+ }
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h
new file mode 100644
index 0000000000..bbf379efe1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h
@@ -0,0 +1,205 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DynamicHLSL.h: Interface for link and run-time HLSL generation
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
+#define LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
+
+#include <map>
+#include <vector>
+
+#include "angle_gl.h"
+#include "common/angleutils.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/DynamicImage2DHLSL.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace sh
+{
+struct Attribute;
+struct ShaderVariable;
+} // namespace sh
+
+namespace gl
+{
+class InfoLog;
+struct VariableLocation;
+class VaryingPacking;
+struct VertexAttribute;
+} // namespace gl
+
+namespace rx
+{
+class ProgramD3DMetadata;
+class ShaderD3D;
+
+// This class needs to match OutputHLSL::decorate
+class DecorateVariable final : angle::NonCopyable
+{
+ public:
+ explicit DecorateVariable(const std::string &str) : mName(str) {}
+ const std::string &getName() const { return mName; }
+
+ private:
+ const std::string &mName;
+};
+
+inline std::ostream &operator<<(std::ostream &o, const DecorateVariable &dv)
+{
+ if (dv.getName().compare(0, 3, "gl_") != 0)
+ {
+ o << "_";
+ }
+ o << dv.getName();
+ return o;
+}
+
+struct PixelShaderOutputVariable
+{
+ PixelShaderOutputVariable() {}
+ PixelShaderOutputVariable(GLenum typeIn,
+ const std::string &nameIn,
+ const std::string &sourceIn,
+ size_t outputLocationIn,
+ size_t outputIndexIn)
+ : type(typeIn),
+ name(nameIn),
+ source(sourceIn),
+ outputLocation(outputLocationIn),
+ outputIndex(outputIndexIn)
+ {}
+
+ GLenum type = GL_NONE;
+ std::string name;
+ std::string source;
+ size_t outputLocation = 0;
+ size_t outputIndex = 0;
+};
+
+struct BuiltinVarying final : private angle::NonCopyable
+{
+ BuiltinVarying();
+
+ std::string str() const;
+ void enableSystem(const std::string &systemValueSemantic);
+ void enable(const std::string &semanticVal, unsigned int indexVal);
+
+ bool enabled;
+ std::string semantic;
+ unsigned int index;
+ bool systemValue;
+};
+
+struct BuiltinInfo
+{
+ BuiltinInfo();
+ ~BuiltinInfo();
+
+ BuiltinVarying dxPosition;
+ BuiltinVarying glPosition;
+ BuiltinVarying glFragCoord;
+ BuiltinVarying glPointCoord;
+ BuiltinVarying glPointSize;
+ BuiltinVarying glViewIDOVR;
+ BuiltinVarying glViewportIndex;
+ BuiltinVarying glLayer;
+};
+
+inline std::string GetVaryingSemantic(int majorShaderModel, bool programUsesPointSize)
+{
+ // SM3 reserves the TEXCOORD semantic for point sprite texcoords (gl_PointCoord)
+ // In D3D11 we manually compute gl_PointCoord in the GS.
+ return ((programUsesPointSize && majorShaderModel < 4) ? "COLOR" : "TEXCOORD");
+}
+
+class BuiltinVaryingsD3D
+{
+ public:
+ BuiltinVaryingsD3D(const ProgramD3DMetadata &metadata, const gl::VaryingPacking &packing);
+ ~BuiltinVaryingsD3D();
+
+ bool usesPointSize() const { return mBuiltinInfo[gl::ShaderType::Vertex].glPointSize.enabled; }
+
+ const BuiltinInfo &operator[](gl::ShaderType shaderType) const
+ {
+ return mBuiltinInfo[shaderType];
+ }
+ BuiltinInfo &operator[](gl::ShaderType shaderType) { return mBuiltinInfo[shaderType]; }
+
+ private:
+ void updateBuiltins(gl::ShaderType shaderType,
+ const ProgramD3DMetadata &metadata,
+ const gl::VaryingPacking &packing);
+
+ gl::ShaderMap<BuiltinInfo> mBuiltinInfo;
+};
+
+class DynamicHLSL : angle::NonCopyable
+{
+ public:
+ explicit DynamicHLSL(RendererD3D *const renderer);
+
+ std::string generateVertexShaderForInputLayout(
+ const std::string &sourceShader,
+ const gl::InputLayout &inputLayout,
+ const std::vector<sh::Attribute> &shaderAttributes) const;
+ std::string generatePixelShaderForOutputSignature(
+ const std::string &sourceShader,
+ const std::vector<PixelShaderOutputVariable> &outputVariables,
+ bool usesFragDepth,
+ const std::vector<GLenum> &outputLayout) const;
+ std::string generateComputeShaderForImage2DBindSignature(
+ const d3d::Context *context,
+ ProgramD3D &programD3D,
+ const gl::ProgramState &programData,
+ std::vector<sh::Uniform> &image2DUniforms,
+ const gl::ImageUnitTextureTypeMap &image2DBindLayout) const;
+ void generateShaderLinkHLSL(const gl::Caps &caps,
+ const gl::ProgramState &programData,
+ const ProgramD3DMetadata &programMetadata,
+ const gl::VaryingPacking &varyingPacking,
+ const BuiltinVaryingsD3D &builtinsD3D,
+ gl::ShaderMap<std::string> *shaderHLSL) const;
+
+ std::string generateGeometryShaderPreamble(const gl::VaryingPacking &varyingPacking,
+ const BuiltinVaryingsD3D &builtinsD3D,
+ const bool hasANGLEMultiviewEnabled,
+ const bool selectViewInVS) const;
+
+ std::string generateGeometryShaderHLSL(const gl::Caps &caps,
+ gl::PrimitiveMode primitiveType,
+ const gl::ProgramState &programData,
+ const bool useViewScale,
+ const bool hasANGLEMultiviewEnabled,
+ const bool selectViewInVS,
+ const bool pointSpriteEmulation,
+ const std::string &preambleString) const;
+
+ void getPixelShaderOutputKey(const gl::State &data,
+ const gl::ProgramState &programData,
+ const ProgramD3DMetadata &metadata,
+ std::vector<PixelShaderOutputVariable> *outPixelShaderKey);
+
+ private:
+ RendererD3D *const mRenderer;
+
+ void generateVaryingLinkHLSL(const gl::VaryingPacking &varyingPacking,
+ const BuiltinInfo &builtins,
+ bool programUsesPointSize,
+ std::ostringstream &hlslStream) const;
+
+ static void GenerateAttributeConversionHLSL(angle::FormatID vertexFormatID,
+ const sh::ShaderVariable &shaderAttrib,
+ std::ostringstream &outStream);
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp
new file mode 100644
index 0000000000..7027549325
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp
@@ -0,0 +1,920 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DynamicImage2DHLSL.cpp: Implementation for link and run-time HLSL generation
+//
+
+#include "libANGLE/renderer/d3d/DynamicImage2DHLSL.h"
+
+#include "common/string_utils.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+
+using namespace gl;
+
+namespace rx
+{
+
+namespace
+{
+
+enum Image2DHLSLGroup
+{
+ IMAGE2D_R_FLOAT4,
+ IMAGE2D_MIN = IMAGE2D_R_FLOAT4,
+ IMAGE2D_R_UNORM,
+ IMAGE2D_R_SNORM,
+ IMAGE2D_R_UINT4,
+ IMAGE2D_R_INT4,
+ IMAGE2D_W_FLOAT4,
+ IMAGE2D_W_UNORM,
+ IMAGE2D_W_SNORM,
+ IMAGE2D_W_UINT4,
+ IMAGE2D_W_INT4,
+ IMAGE2D_UNKNOWN,
+ IMAGE2D_MAX = IMAGE2D_UNKNOWN
+};
+
+enum Image2DMethod
+{
+ IMAGE2DSIZE,
+ IMAGE2DLOAD,
+ IMAGE2DSTORE
+};
+
+Image2DHLSLGroup image2DHLSLGroup(const sh::Uniform &uniform)
+{
+ GLenum format = uniform.imageUnitFormat;
+ bool readonly = uniform.readonly;
+ switch (uniform.type)
+ {
+ case GL_IMAGE_2D:
+ {
+ switch (format)
+ {
+ case GL_RGBA32F:
+ case GL_RGBA16F:
+ case GL_R32F:
+ return readonly ? IMAGE2D_R_FLOAT4 : IMAGE2D_W_FLOAT4;
+ case GL_RGBA8:
+ return readonly ? IMAGE2D_R_UNORM : IMAGE2D_W_UNORM;
+ case GL_RGBA8_SNORM:
+ return readonly ? IMAGE2D_R_SNORM : IMAGE2D_W_SNORM;
+ default:
+ UNREACHABLE();
+ return IMAGE2D_UNKNOWN;
+ }
+ }
+ case GL_INT_IMAGE_2D:
+ {
+ switch (format)
+ {
+ case GL_RGBA32I:
+ case GL_RGBA16I:
+ case GL_RGBA8I:
+ case GL_R32I:
+ return readonly ? IMAGE2D_R_INT4 : IMAGE2D_W_INT4;
+ default:
+ UNREACHABLE();
+ return IMAGE2D_UNKNOWN;
+ }
+ }
+ case GL_UNSIGNED_INT_IMAGE_2D:
+ {
+ switch (format)
+ {
+ case GL_RGBA32UI:
+ case GL_RGBA16UI:
+ case GL_RGBA8UI:
+ case GL_R32UI:
+ return readonly ? IMAGE2D_R_UINT4 : IMAGE2D_W_UINT4;
+ default:
+ UNREACHABLE();
+ return IMAGE2D_UNKNOWN;
+ }
+ }
+ default:
+ UNREACHABLE();
+ return IMAGE2D_UNKNOWN;
+ }
+}
+
+std::string Image2DHLSLGroupSuffix(Image2DHLSLGroup group)
+{
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ return "2D";
+ case IMAGE2D_R_UNORM:
+ return "2D_unorm_float4_";
+ case IMAGE2D_R_SNORM:
+ return "2D_snorm_float4_";
+ case IMAGE2D_R_UINT4:
+ return "2D_uint4_";
+ case IMAGE2D_R_INT4:
+ return "2D_int4_";
+ case IMAGE2D_W_FLOAT4:
+ return "RW2D_float4_";
+ case IMAGE2D_W_UNORM:
+ return "RW2D_unorm_float4_";
+ case IMAGE2D_W_SNORM:
+ return "RW2D_snorm_float4_";
+ case IMAGE2D_W_UINT4:
+ return "RW2D_uint4_";
+ case IMAGE2D_W_INT4:
+ return "RW2D_int4_";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown group type>";
+}
+
+std::string Image2DHLSLTextureString(Image2DHLSLGroup group, gl::TextureType type)
+{
+ std::string textureString;
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_R_INT4:
+ break;
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ case IMAGE2D_W_UINT4:
+ case IMAGE2D_W_INT4:
+ textureString += "RW";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ textureString += "Texture";
+
+ switch (type)
+ {
+ case gl::TextureType::_2D:
+ textureString += "2D";
+ break;
+ case gl::TextureType::_3D:
+ textureString += "3D";
+ break;
+ case gl::TextureType::_2DArray:
+ textureString += "2DArray";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_W_FLOAT4:
+ textureString += "<float4>";
+ break;
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_W_UNORM:
+ textureString += "<unorm float4>";
+ break;
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_W_SNORM:
+ textureString += "<snorm float4>";
+ break;
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_W_UINT4:
+ textureString += "<uint4>";
+ break;
+ case IMAGE2D_R_INT4:
+ case IMAGE2D_W_INT4:
+ textureString += "<int4>";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return textureString;
+}
+
+std::string Image2DHLSLGroupOffsetPrefix(Image2DHLSLGroup group)
+{
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_R_INT4:
+ return "readonlyImageIndexOffset";
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ case IMAGE2D_W_UINT4:
+ case IMAGE2D_W_INT4:
+ return "imageIndexOffset";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown group type>";
+}
+
+std::string Image2DHLSLGroupDeclarationPrefix(Image2DHLSLGroup group)
+{
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_R_INT4:
+ return "readonlyImages";
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ case IMAGE2D_W_UINT4:
+ case IMAGE2D_W_INT4:
+ return "images";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown group type>";
+}
+
+std::string Image2DHLSLGroupRegisterSuffix(Image2DHLSLGroup group)
+{
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_R_INT4:
+ return "t";
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ case IMAGE2D_W_UINT4:
+ case IMAGE2D_W_INT4:
+ return "u";
+ default:
+ UNREACHABLE();
+ }
+
+ return "<unknown group type>";
+}
+
+std::string Image2DHLSLGroupFunctionName(Image2DHLSLGroup group, Image2DMethod method)
+{
+ std::string name = "gl_image";
+ name += Image2DHLSLGroupSuffix(group);
+ switch (method)
+ {
+ case IMAGE2DSIZE:
+ name += "Size";
+ break;
+ case IMAGE2DLOAD:
+ name += "Load";
+ break;
+ case IMAGE2DSTORE:
+ name += "Store";
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return name;
+}
+
+std::string getImage2DGroupReturnType(Image2DHLSLGroup group, Image2DMethod method)
+{
+ switch (method)
+ {
+ case IMAGE2DSIZE:
+ return "int2";
+ case IMAGE2DLOAD:
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ return "float4";
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_W_UINT4:
+ return "uint4";
+ case IMAGE2D_R_INT4:
+ case IMAGE2D_W_INT4:
+ return "int4";
+ default:
+ UNREACHABLE();
+ return "unknown group type";
+ }
+ case IMAGE2DSTORE:
+ return "void";
+ default:
+ UNREACHABLE();
+ return "unknown image method";
+ }
+}
+
+std::string getImageMetadata(Image2DHLSLGroup group)
+{
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_R_INT4:
+ return "readonlyImageMetadata[imageIndex - readonlyImageIndexStart]";
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ case IMAGE2D_W_UINT4:
+ case IMAGE2D_W_INT4:
+ return "imageMetadata[imageIndex - imageIndexStart]";
+ default:
+ UNREACHABLE();
+ return "unknown image method";
+ }
+}
+
+void OutputImage2DFunctionArgumentList(std::ostringstream &out,
+ Image2DHLSLGroup group,
+ Image2DMethod method)
+{
+ out << "uint imageIndex";
+
+ if (method == IMAGE2DLOAD || method == IMAGE2DSTORE)
+ {
+ out << ", int2 p";
+ if (method == IMAGE2DSTORE)
+ {
+ switch (group)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ out << ", float4 data";
+ break;
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_W_UINT4:
+ out << ", uint4 data";
+ break;
+ case IMAGE2D_R_INT4:
+ case IMAGE2D_W_INT4:
+ out << ", int4 data";
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+}
+
+void OutputImage2DSizeFunction(std::ostringstream &out,
+ Image2DHLSLGroup textureGroup,
+ unsigned int totalCount,
+ unsigned int texture2DCount,
+ unsigned int texture3DCount,
+ unsigned int texture2DArrayCount,
+ const std::string &offsetStr,
+ const std::string &declarationStr,
+ bool getDimensionsIgnoresBaseLevel)
+{
+ out << getImage2DGroupReturnType(textureGroup, IMAGE2DSIZE) << " "
+ << Image2DHLSLGroupFunctionName(textureGroup, IMAGE2DSIZE) << "(";
+ OutputImage2DFunctionArgumentList(out, textureGroup, IMAGE2DSIZE);
+ out << ")\n"
+ "{\n";
+ out << " uint width, height;\n";
+
+ if (texture2DCount > 0)
+ {
+ if (texture2DCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "2D;\n";
+ if (getDimensionsIgnoresBaseLevel)
+ {
+ out << " uint levelCount;\n";
+ out << " const uint level = " << getImageMetadata(textureGroup) << ".level;\n";
+ out << " " << declarationStr
+ << "2D[index].GetDimensions(level, width, height, levelCount);\n";
+ }
+ else
+ {
+ out << " " << declarationStr << "2D[index].GetDimensions(width, height);\n";
+ }
+ }
+ else
+ {
+ out << " if (imageIndex >= " << offsetStr << "2D && imageIndex < " << offsetStr
+ << "2D + " << texture2DCount << ")\n";
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "2D;\n";
+ out << " " << declarationStr << "2D[index].GetDimensions(width, height);\n";
+ out << " }\n";
+ }
+ }
+
+ if (texture3DCount > 0)
+ {
+ if (texture3DCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "3D;\n";
+ out << " uint depth;\n";
+ out << " " << declarationStr << "3D[index].GetDimensions(width, height, depth);\n";
+ }
+ else
+ {
+ if (texture2DArrayCount == 0)
+ {
+ out << " else\n";
+ }
+ else
+ {
+ if (texture2DCount == 0)
+ {
+ out << " if ";
+ }
+ else
+ {
+ out << " else if";
+ }
+ out << "(imageIndex >= " << offsetStr << "3D && imageIndex < " << offsetStr
+ << "3D + " << texture3DCount << ")\n";
+ }
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "3D;\n";
+ out << " uint depth;\n";
+ out << " " << declarationStr
+ << "3D[index].GetDimensions(width, height, depth);\n";
+ out << " }\n";
+ }
+ }
+
+ if (texture2DArrayCount > 0)
+ {
+ if (texture2DArrayCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "2DArray;\n";
+ out << " uint depth;\n";
+ out << " " << declarationStr
+ << "2DArray[index].GetDimensions(width, height, depth);\n";
+ }
+ else
+ {
+ out << " else\n";
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "2DArray;\n";
+ out << " uint depth;\n";
+ out << " " << declarationStr
+ << "2DArray[index].GetDimensions(width, height, depth);\n";
+ out << " }\n";
+ }
+ }
+ out << " return int2(width, height);\n";
+
+ out << "}\n";
+}
+
+void OutputImage2DLoadFunction(std::ostringstream &out,
+ Image2DHLSLGroup textureGroup,
+ unsigned int totalCount,
+ unsigned int texture2DCount,
+ unsigned int texture3DCount,
+ unsigned int texture2DArrayCount,
+ const std::string &offsetStr,
+ const std::string &declarationStr)
+{
+ out << getImage2DGroupReturnType(textureGroup, IMAGE2DLOAD) << " "
+ << Image2DHLSLGroupFunctionName(textureGroup, IMAGE2DLOAD) << "(";
+ OutputImage2DFunctionArgumentList(out, textureGroup, IMAGE2DLOAD);
+ out << ")\n"
+ "{\n";
+
+ out << " " << getImage2DGroupReturnType(textureGroup, IMAGE2DLOAD) << " result;\n";
+
+ if (texture2DCount > 0)
+ {
+ if (texture2DCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "2D;\n";
+ out << " result = " << declarationStr << "2D[index][uint2(p.x, p.y)];\n";
+ }
+ else
+ {
+ out << " if (imageIndex >= " << offsetStr << "2D && imageIndex < " << offsetStr
+ << "2D + " << texture2DCount << ")\n";
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "2D;\n";
+ out << " result = " << declarationStr << "2D[index][uint2(p.x, p.y)];\n";
+ out << " }\n";
+ }
+ }
+
+ if (texture3DCount > 0)
+ {
+ if (texture3DCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "3D;\n";
+ out << " result = " << declarationStr << "3D[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)];\n";
+ }
+ else
+ {
+ if (texture2DArrayCount == 0)
+ {
+ out << " else\n";
+ }
+ else
+ {
+ if (texture2DCount == 0)
+ {
+ out << " if ";
+ }
+ else
+ {
+ out << " else if";
+ }
+ out << "(imageIndex >= " << offsetStr << "3D && imageIndex < " << offsetStr
+ << "3D + " << texture3DCount << ")\n";
+ }
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "3D;\n";
+ out << " result = " << declarationStr << "3D[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)];\n";
+ out << " }\n";
+ }
+ }
+
+ if (texture2DArrayCount > 0)
+ {
+ if (texture2DArrayCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "2DArray;\n";
+ out << " result = " << declarationStr << "2DArray[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)];\n";
+ }
+ else
+ {
+ out << " else\n";
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "2DArray;\n";
+ out << " result = " << declarationStr << "2DArray[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)];\n";
+ out << " }\n";
+ }
+ }
+
+ out << " return result;\n";
+ out << "}\n";
+}
+
+void OutputImage2DStoreFunction(std::ostringstream &out,
+ Image2DHLSLGroup textureGroup,
+ unsigned int totalCount,
+ unsigned int texture2DCount,
+ unsigned int texture3DCount,
+ unsigned int texture2DArrayCount,
+ const std::string &offsetStr,
+ const std::string &declarationStr)
+{
+ out << getImage2DGroupReturnType(textureGroup, IMAGE2DSTORE) << " "
+ << Image2DHLSLGroupFunctionName(textureGroup, IMAGE2DSTORE) << "(";
+ OutputImage2DFunctionArgumentList(out, textureGroup, IMAGE2DSTORE);
+ out << ")\n"
+ "{\n";
+
+ if (texture2DCount > 0)
+ {
+ if (texture2DCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "2D;\n";
+ out << " " << declarationStr << "2D[index][uint2(p.x, p.y)] = data;\n";
+ }
+ else
+ {
+ out << " if (imageIndex >= " << offsetStr << "2D && imageIndex < " << offsetStr
+ << "2D + " << texture2DCount << ")\n";
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "2D;\n";
+ out << " " << declarationStr << "2D[index][uint2(p.x, p.y)] = data;\n";
+ out << " }\n";
+ }
+ }
+
+ if (texture3DCount > 0)
+ {
+ if (texture3DCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "3D;\n";
+ out << " " << declarationStr << "3D[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)] = data;\n";
+ }
+ else
+ {
+ if (texture2DArrayCount == 0)
+ {
+ out << " else\n";
+ }
+ else
+ {
+ if (texture2DCount == 0)
+ {
+ out << " if ";
+ }
+ else
+ {
+ out << " else if";
+ }
+ out << "(imageIndex >= " << offsetStr << "3D && imageIndex < " << offsetStr
+ << "3D + " << texture3DCount << ")\n";
+ }
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "3D;\n";
+ out << " " << declarationStr << "3D[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)] = data;\n";
+ out << " }\n";
+ }
+ }
+
+ if (texture2DArrayCount > 0)
+ {
+ if (texture2DArrayCount == totalCount)
+ {
+ out << " const uint index = imageIndex - " << offsetStr << "2DArray;\n";
+ out << " " << declarationStr << "2DArray[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)] = data;\n";
+ }
+ else
+ {
+ out << " else\n";
+ out << " {\n";
+ out << " const uint index = imageIndex - " << offsetStr << "2DArray;\n";
+ out << " " << declarationStr << "2DArray[index][uint3(p.x, p.y, "
+ << getImageMetadata(textureGroup) << ".layer)] = data;\n";
+ out << " }\n";
+ }
+ }
+
+ out << "}\n";
+}
+
+unsigned int *GetImage2DRegisterIndex(Image2DHLSLGroup textureGroup,
+ unsigned int *groupTextureRegisterIndex,
+ unsigned int *groupRWTextureRegisterIndex)
+{
+ switch (textureGroup)
+ {
+ case IMAGE2D_R_FLOAT4:
+ case IMAGE2D_R_UNORM:
+ case IMAGE2D_R_SNORM:
+ case IMAGE2D_R_UINT4:
+ case IMAGE2D_R_INT4:
+ return groupTextureRegisterIndex;
+ case IMAGE2D_W_FLOAT4:
+ case IMAGE2D_W_UNORM:
+ case IMAGE2D_W_SNORM:
+ case IMAGE2D_W_UINT4:
+ case IMAGE2D_W_INT4:
+ return groupRWTextureRegisterIndex;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+void OutputHLSLImage2DUniformGroup(ProgramD3D &programD3D,
+ const gl::ProgramState &programData,
+ gl::ShaderType shaderType,
+ std::ostringstream &out,
+ const Image2DHLSLGroup textureGroup,
+ const std::vector<sh::Uniform> &group,
+ const gl::ImageUnitTextureTypeMap &image2DBindLayout,
+ unsigned int *groupTextureRegisterIndex,
+ unsigned int *groupRWTextureRegisterIndex,
+ unsigned int *image2DTexture3D,
+ unsigned int *image2DTexture2DArray,
+ unsigned int *image2DTexture2D)
+{
+ if (group.empty())
+ {
+ return;
+ }
+
+ unsigned int texture2DCount = 0, texture3DCount = 0, texture2DArrayCount = 0;
+ for (const sh::Uniform &uniform : group)
+ {
+ if (!programD3D.hasNamedUniform(uniform.name))
+ {
+ continue;
+ }
+ for (unsigned int index = 0; index < uniform.getArraySizeProduct(); index++)
+ {
+ switch (image2DBindLayout.at(uniform.binding + index))
+ {
+ case gl::TextureType::_2D:
+ texture2DCount++;
+ break;
+ case gl::TextureType::_3D:
+ texture3DCount++;
+ break;
+ case gl::TextureType::_2DArray:
+ case gl::TextureType::CubeMap:
+ texture2DArrayCount++;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ }
+
+ unsigned int totalCount = texture2DCount + texture3DCount + texture2DArrayCount;
+ unsigned int *image2DRegisterIndex = GetImage2DRegisterIndex(
+ textureGroup, groupTextureRegisterIndex, groupRWTextureRegisterIndex);
+ unsigned int texture2DRegisterIndex = *image2DRegisterIndex;
+ unsigned int texture3DRegisterIndex = texture2DRegisterIndex + texture2DCount;
+ unsigned int texture2DArrayRegisterIndex = texture3DRegisterIndex + texture3DCount;
+ *image2DRegisterIndex += totalCount;
+
+ std::string offsetStr =
+ Image2DHLSLGroupOffsetPrefix(textureGroup) + Image2DHLSLGroupSuffix(textureGroup);
+ std::string declarationStr =
+ Image2DHLSLGroupDeclarationPrefix(textureGroup) + Image2DHLSLGroupSuffix(textureGroup);
+ std::string registerStr = Image2DHLSLGroupRegisterSuffix(textureGroup);
+ if (texture2DCount > 0)
+ {
+ out << "static const uint " << offsetStr << "2D = " << texture2DRegisterIndex << ";\n";
+ out << "uniform " << Image2DHLSLTextureString(textureGroup, gl::TextureType::_2D) << " "
+ << declarationStr << "2D[" << texture2DCount << "]"
+ << " : register(" << registerStr << texture2DRegisterIndex << ");\n";
+ }
+ if (texture3DCount > 0)
+ {
+ out << "static const uint " << offsetStr << "3D = " << texture3DRegisterIndex << ";\n";
+ out << "uniform " << Image2DHLSLTextureString(textureGroup, gl::TextureType::_3D) << " "
+ << declarationStr << "3D[" << texture3DCount << "]"
+ << " : register(" << registerStr << texture3DRegisterIndex << ");\n";
+ }
+ if (texture2DArrayCount > 0)
+ {
+ out << "static const uint " << offsetStr << "2DArray = " << texture2DArrayRegisterIndex
+ << ";\n";
+ out << "uniform " << Image2DHLSLTextureString(textureGroup, gl::TextureType::_2DArray)
+ << " " << declarationStr << "2DArray[" << texture2DArrayCount << "]"
+ << " : register(" << registerStr << texture2DArrayRegisterIndex << ");\n";
+ }
+ for (const sh::Uniform &uniform : group)
+ {
+ if (!programD3D.hasNamedUniform(uniform.name))
+ {
+ continue;
+ }
+
+ out << "static const uint " << DecorateVariable(uniform.name)
+ << ArrayIndexString(uniform.arraySizes) << " = {";
+ for (unsigned int index = 0; index < uniform.getArraySizeProduct(); index++)
+ {
+ if (index > 0)
+ {
+ out << ", ";
+ }
+ switch (image2DBindLayout.at(uniform.binding + index))
+ {
+ case gl::TextureType::_2D:
+ {
+ out << texture2DRegisterIndex;
+ programD3D.assignImage2DRegisters(texture2DRegisterIndex,
+ uniform.binding + index, uniform.readonly);
+ texture2DRegisterIndex++;
+ break;
+ }
+ case gl::TextureType::_3D:
+ {
+ out << texture3DRegisterIndex;
+ programD3D.assignImage2DRegisters(texture3DRegisterIndex,
+ uniform.binding + index, uniform.readonly);
+ texture3DRegisterIndex++;
+ break;
+ }
+ case gl::TextureType::_2DArray:
+ case gl::TextureType::CubeMap:
+ {
+ out << texture2DArrayRegisterIndex;
+ programD3D.assignImage2DRegisters(texture2DArrayRegisterIndex,
+ uniform.binding + index, uniform.readonly);
+ texture2DArrayRegisterIndex++;
+ break;
+ }
+ default:
+ UNREACHABLE();
+ }
+ }
+ out << "};\n";
+ }
+
+ gl::Shader *shaderGL = programData.getAttachedShader(shaderType);
+ const ShaderD3D *shaderD3D = GetImplAs<ShaderD3D>(shaderGL);
+ const bool getDimensionsIgnoresBaseLevel = programD3D.usesGetDimensionsIgnoresBaseLevel();
+
+ if (shaderD3D->useImage2DFunction(Image2DHLSLGroupFunctionName(textureGroup, IMAGE2DSIZE)))
+ {
+ OutputImage2DSizeFunction(out, textureGroup, totalCount, texture2DCount, texture3DCount,
+ texture2DArrayCount, offsetStr, declarationStr,
+ getDimensionsIgnoresBaseLevel);
+ }
+ if (shaderD3D->useImage2DFunction(Image2DHLSLGroupFunctionName(textureGroup, IMAGE2DLOAD)))
+ {
+ OutputImage2DLoadFunction(out, textureGroup, totalCount, texture2DCount, texture3DCount,
+ texture2DArrayCount, offsetStr, declarationStr);
+ }
+ if (shaderD3D->useImage2DFunction(Image2DHLSLGroupFunctionName(textureGroup, IMAGE2DSTORE)))
+ {
+ OutputImage2DStoreFunction(out, textureGroup, totalCount, texture2DCount, texture3DCount,
+ texture2DArrayCount, offsetStr, declarationStr);
+ }
+}
+
+// kImage2DFunctionString must be the same as outputHLSL.
+constexpr const char kImage2DFunctionString[] = "// @@ IMAGE2D DECLARATION FUNCTION STRING @@";
+} // anonymous namespace
+
+std::string generateShaderForImage2DBindSignature(
+ const d3d::Context *context,
+ ProgramD3D &programD3D,
+ const gl::ProgramState &programData,
+ gl::ShaderType shaderType,
+ std::vector<sh::Uniform> &image2DUniforms,
+ const gl::ImageUnitTextureTypeMap &image2DBindLayout)
+{
+ std::vector<std::vector<sh::Uniform>> groupedImage2DUniforms(IMAGE2D_MAX + 1);
+ unsigned int image2DTexture2DCount = 0, image2DTexture3DCount = 0,
+ image2DTexture2DArrayCount = 0;
+ for (sh::Uniform &image2D : image2DUniforms)
+ {
+ for (unsigned int index = 0; index < image2D.getArraySizeProduct(); index++)
+ {
+ // Any image variable declared without a binding qualifier is initially bound to unit
+ // zero.
+ if (image2D.binding == -1)
+ {
+ image2D.binding = 0;
+ }
+ switch (image2DBindLayout.at(image2D.binding + index))
+ {
+ case gl::TextureType::_2D:
+ image2DTexture2DCount++;
+ break;
+ case gl::TextureType::_3D:
+ image2DTexture3DCount++;
+ break;
+ case gl::TextureType::_2DArray:
+ case gl::TextureType::CubeMap:
+ image2DTexture2DArrayCount++;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ Image2DHLSLGroup group = image2DHLSLGroup(image2D);
+ groupedImage2DUniforms[group].push_back(image2D);
+ }
+
+ gl::Shader *shaderGL = programData.getAttachedShader(shaderType);
+ const ShaderD3D *shaderD3D = GetImplAs<ShaderD3D>(shaderGL);
+ unsigned int groupTextureRegisterIndex = shaderD3D->getReadonlyImage2DRegisterIndex();
+ unsigned int groupRWTextureRegisterIndex = shaderD3D->getImage2DRegisterIndex();
+ unsigned int image2DTexture3DIndex = 0;
+ unsigned int image2DTexture2DArrayIndex = image2DTexture3DCount;
+ unsigned int image2DTexture2DIndex = image2DTexture3DCount + image2DTexture2DArrayCount;
+ std::ostringstream out;
+
+ for (int groupId = IMAGE2D_MIN; groupId < IMAGE2D_MAX; ++groupId)
+ {
+ OutputHLSLImage2DUniformGroup(programD3D, programData, shaderType, out,
+ Image2DHLSLGroup(groupId), groupedImage2DUniforms[groupId],
+ image2DBindLayout, &groupTextureRegisterIndex,
+ &groupRWTextureRegisterIndex, &image2DTexture3DIndex,
+ &image2DTexture2DArrayIndex, &image2DTexture2DIndex);
+ }
+
+ std::string shaderHLSL(programData.getAttachedShader(shaderType)->getTranslatedSource());
+ bool success = angle::ReplaceSubstring(&shaderHLSL, kImage2DFunctionString, out.str());
+ ASSERT(success);
+
+ return shaderHLSL;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.h
new file mode 100644
index 0000000000..761730176d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.h
@@ -0,0 +1,39 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DynamicImage2DHLSL.h: Interface for link and run-time HLSL generation
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_DYNAMICIMAGE2DHLSL_H_
+#define LIBANGLE_RENDERER_D3D_DYNAMICIMAGE2DHLSL_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+std::string generateShaderForImage2DBindSignature(
+ const d3d::Context *context,
+ ProgramD3D &programD3D,
+ const gl::ProgramState &programData,
+ gl::ShaderType shaderType,
+ std::vector<sh::Uniform> &image2DUniforms,
+ const gl::ImageUnitTextureTypeMap &image2DBindLayout);
+
+inline std::string GenerateComputeShaderForImage2DBindSignature(
+ const d3d::Context *context,
+ ProgramD3D &programD3D,
+ const gl::ProgramState &programData,
+ std::vector<sh::Uniform> &image2DUniforms,
+ const gl::ImageUnitTextureTypeMap &image2DBindLayout)
+{
+ return generateShaderForImage2DBindSignature(context, programD3D, programData,
+ gl::ShaderType::Compute, image2DUniforms,
+ image2DBindLayout);
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp
new file mode 100644
index 0000000000..0a6e9efcba
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp
@@ -0,0 +1,90 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// EGLImageD3D.cpp: Implements the rx::EGLImageD3D class, the D3D implementation of EGL images
+
+#include "libANGLE/renderer/d3d/EGLImageD3D.h"
+
+#include "common/debug.h"
+#include "common/utilities.h"
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/TextureStorage.h"
+
+#include <EGL/eglext.h>
+
+namespace rx
+{
+
+EGLImageD3D::EGLImageD3D(const egl::ImageState &state,
+ EGLenum target,
+ const egl::AttributeMap &attribs,
+ RendererD3D *renderer)
+ : ImageImpl(state), mRenderer(renderer), mRenderTarget(nullptr)
+{
+ ASSERT(renderer != nullptr);
+}
+
+EGLImageD3D::~EGLImageD3D()
+{
+ SafeDelete(mRenderTarget);
+}
+
+egl::Error EGLImageD3D::initialize(const egl::Display *display)
+{
+ return egl::NoError();
+}
+
+angle::Result EGLImageD3D::orphan(const gl::Context *context, egl::ImageSibling *sibling)
+{
+ if (sibling == mState.source)
+ {
+ ANGLE_TRY(copyToLocalRendertarget(context));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result EGLImageD3D::getRenderTarget(const gl::Context *context,
+ RenderTargetD3D **outRT) const
+{
+ if (mState.source != nullptr)
+ {
+ ASSERT(!mRenderTarget);
+ FramebufferAttachmentRenderTarget *rt = nullptr;
+ ANGLE_TRY(
+ mState.source->getAttachmentRenderTarget(context, GL_NONE, mState.imageIndex, &rt));
+ *outRT = static_cast<RenderTargetD3D *>(rt);
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mRenderTarget);
+ *outRT = mRenderTarget;
+ return angle::Result::Continue;
+}
+
+angle::Result EGLImageD3D::copyToLocalRendertarget(const gl::Context *context)
+{
+ ASSERT(mState.source != nullptr);
+ ASSERT(mRenderTarget == nullptr);
+
+ RenderTargetD3D *curRenderTarget = nullptr;
+ ANGLE_TRY(getRenderTarget(context, &curRenderTarget));
+
+ // Invalidate FBOs with this Image attached. Only currently applies to D3D11.
+ for (egl::ImageSibling *target : mState.targets)
+ {
+ target->onStateChange(angle::SubjectMessage::SubjectChanged);
+ }
+
+ return mRenderer->createRenderTargetCopy(context, curRenderTarget, &mRenderTarget);
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.h
new file mode 100644
index 0000000000..0470274699
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.h
@@ -0,0 +1,55 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// EGLImageD3D.h: Defines the rx::EGLImageD3D class, the D3D implementation of EGL images
+
+#ifndef LIBANGLE_RENDERER_D3D_EGLIMAGED3D_H_
+#define LIBANGLE_RENDERER_D3D_EGLIMAGED3D_H_
+
+#include "libANGLE/renderer/ImageImpl.h"
+
+namespace gl
+{
+class Context;
+}
+
+namespace egl
+{
+class AttributeMap;
+}
+
+namespace rx
+{
+class FramebufferAttachmentObjectImpl;
+class TextureD3D;
+class RenderbufferD3D;
+class RendererD3D;
+class RenderTargetD3D;
+
+class EGLImageD3D final : public ImageImpl
+{
+ public:
+ EGLImageD3D(const egl::ImageState &state,
+ EGLenum target,
+ const egl::AttributeMap &attribs,
+ RendererD3D *renderer);
+ ~EGLImageD3D() override;
+
+ egl::Error initialize(const egl::Display *display) override;
+
+ angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
+
+ angle::Result getRenderTarget(const gl::Context *context, RenderTargetD3D **outRT) const;
+
+ private:
+ angle::Result copyToLocalRendertarget(const gl::Context *context);
+
+ RendererD3D *mRenderer;
+ RenderTargetD3D *mRenderTarget;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_EGLIMAGED3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
new file mode 100644
index 0000000000..8c1300ce34
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -0,0 +1,433 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FramebufferD3D.cpp: Implements the DefaultAttachmentD3D and FramebufferD3D classes.
+
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+
+#include "common/bitset_utils.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/SurfaceD3D.h"
+#include "libANGLE/renderer/d3d/SwapChainD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+
+namespace rx
+{
+
+namespace
+{
+
+ClearParameters GetClearParameters(const gl::State &state, GLbitfield mask)
+{
+ ClearParameters clearParams;
+ memset(&clearParams, 0, sizeof(ClearParameters));
+
+ const auto &blendState = state.getBlendState();
+
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = false;
+ }
+ clearParams.colorF = state.getColorClearValue();
+ clearParams.colorType = GL_FLOAT;
+ clearParams.colorMaskRed = blendState.colorMaskRed;
+ clearParams.colorMaskGreen = blendState.colorMaskGreen;
+ clearParams.colorMaskBlue = blendState.colorMaskBlue;
+ clearParams.colorMaskAlpha = blendState.colorMaskAlpha;
+ clearParams.clearDepth = false;
+ clearParams.depthValue = state.getDepthClearValue();
+ clearParams.clearStencil = false;
+ clearParams.stencilValue = state.getStencilClearValue();
+ clearParams.stencilWriteMask = state.getDepthStencilState().stencilWritemask;
+ clearParams.scissorEnabled = state.isScissorTestEnabled();
+ clearParams.scissor = state.getScissor();
+
+ const gl::Framebuffer *framebufferObject = state.getDrawFramebuffer();
+ if (mask & GL_COLOR_BUFFER_BIT)
+ {
+ if (framebufferObject->hasEnabledDrawBuffer())
+ {
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = true;
+ }
+ }
+ }
+
+ if (mask & GL_DEPTH_BUFFER_BIT)
+ {
+ if (state.getDepthStencilState().depthMask &&
+ framebufferObject->getDepthAttachment() != nullptr)
+ {
+ clearParams.clearDepth = true;
+ }
+ }
+
+ if (mask & GL_STENCIL_BUFFER_BIT)
+ {
+ if (framebufferObject->getStencilAttachment() != nullptr &&
+ framebufferObject->getStencilAttachment()->getStencilSize() > 0)
+ {
+ clearParams.clearStencil = true;
+ }
+ }
+
+ return clearParams;
+}
+} // namespace
+
+ClearParameters::ClearParameters() = default;
+
+ClearParameters::ClearParameters(const ClearParameters &other) = default;
+
+FramebufferD3D::FramebufferD3D(const gl::FramebufferState &data, RendererD3D *renderer)
+ : FramebufferImpl(data), mRenderer(renderer), mDummyAttachment()
+{}
+
+FramebufferD3D::~FramebufferD3D() {}
+
+angle::Result FramebufferD3D::clear(const gl::Context *context, GLbitfield mask)
+{
+ ClearParameters clearParams = GetClearParameters(context->getState(), mask);
+ return clearImpl(context, clearParams);
+}
+
+angle::Result FramebufferD3D::clearBufferfv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *values)
+{
+ // glClearBufferfv can be called to clear the color buffer or depth buffer
+ ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+
+ if (buffer == GL_COLOR)
+ {
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorF = gl::ColorF(values[0], values[1], values[2], values[3]);
+ clearParams.colorType = GL_FLOAT;
+ }
+
+ if (buffer == GL_DEPTH)
+ {
+ clearParams.clearDepth = true;
+ clearParams.depthValue = values[0];
+ }
+
+ return clearImpl(context, clearParams);
+}
+
+angle::Result FramebufferD3D::clearBufferuiv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *values)
+{
+ // glClearBufferuiv can only be called to clear a color buffer
+ ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorUI = gl::ColorUI(values[0], values[1], values[2], values[3]);
+ clearParams.colorType = GL_UNSIGNED_INT;
+
+ return clearImpl(context, clearParams);
+}
+
+angle::Result FramebufferD3D::clearBufferiv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *values)
+{
+ // glClearBufferiv can be called to clear the color buffer or stencil buffer
+ ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+
+ if (buffer == GL_COLOR)
+ {
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
+ }
+ clearParams.colorI = gl::ColorI(values[0], values[1], values[2], values[3]);
+ clearParams.colorType = GL_INT;
+ }
+
+ if (buffer == GL_STENCIL)
+ {
+ clearParams.clearStencil = true;
+ clearParams.stencilValue = values[0];
+ }
+
+ return clearImpl(context, clearParams);
+}
+
+angle::Result FramebufferD3D::clearBufferfi(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil)
+{
+ // glClearBufferfi can only be called to clear a depth stencil buffer
+ ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+ clearParams.clearDepth = true;
+ clearParams.depthValue = depth;
+ clearParams.clearStencil = true;
+ clearParams.stencilValue = stencil;
+
+ return clearImpl(context, clearParams);
+}
+
+GLenum FramebufferD3D::getImplementationColorReadFormat(const gl::Context *context) const
+{
+ const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment();
+
+ if (readAttachment == nullptr)
+ {
+ return GL_NONE;
+ }
+
+ RenderTargetD3D *attachmentRenderTarget = nullptr;
+ angle::Result error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
+ if (error != angle::Result::Continue)
+ {
+ return GL_NONE;
+ }
+
+ GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
+ const gl::InternalFormat &implementationFormatInfo =
+ gl::GetSizedInternalFormatInfo(implementationFormat);
+
+ return implementationFormatInfo.getReadPixelsFormat();
+}
+
+GLenum FramebufferD3D::getImplementationColorReadType(const gl::Context *context) const
+{
+ const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment();
+
+ if (readAttachment == nullptr)
+ {
+ return GL_NONE;
+ }
+
+ RenderTargetD3D *attachmentRenderTarget = nullptr;
+ angle::Result error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
+ if (error != angle::Result::Continue)
+ {
+ return GL_NONE;
+ }
+
+ GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
+ const gl::InternalFormat &implementationFormatInfo =
+ gl::GetSizedInternalFormatInfo(implementationFormat);
+
+ return implementationFormatInfo.getReadPixelsType(context->getClientVersion());
+}
+
+angle::Result FramebufferD3D::readPixels(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ // Clip read area to framebuffer.
+ const gl::Extents fbSize = getState().getReadAttachment()->getSize();
+ const gl::Rectangle fbRect(0, 0, fbSize.width, fbSize.height);
+ gl::Rectangle clippedArea;
+ if (!ClipRectangle(area, fbRect, &clippedArea))
+ {
+ // nothing to read
+ return angle::Result::Continue;
+ }
+
+ const gl::PixelPackState &packState = context->getState().getPackState();
+
+ const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(format, type);
+
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+
+ GLuint outputPitch = 0;
+ ANGLE_CHECK_GL_MATH(contextD3D,
+ sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment,
+ packState.rowLength, &outputPitch));
+
+ GLuint outputSkipBytes = 0;
+ ANGLE_CHECK_GL_MATH(contextD3D, sizedFormatInfo.computeSkipBytes(
+ type, outputPitch, 0, packState, false, &outputSkipBytes));
+ outputSkipBytes += (clippedArea.x - area.x) * sizedFormatInfo.pixelBytes +
+ (clippedArea.y - area.y) * outputPitch;
+
+ return readPixelsImpl(context, clippedArea, format, type, outputPitch, packState,
+ static_cast<uint8_t *>(pixels) + outputSkipBytes);
+}
+
+angle::Result FramebufferD3D::blit(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ GLbitfield mask,
+ GLenum filter)
+{
+ const auto &glState = context->getState();
+ const gl::Framebuffer *sourceFramebuffer = glState.getReadFramebuffer();
+ const gl::Rectangle *scissor = glState.isScissorTestEnabled() ? &glState.getScissor() : nullptr;
+ ANGLE_TRY(blitImpl(context, sourceArea, destArea, scissor, (mask & GL_COLOR_BUFFER_BIT) != 0,
+ (mask & GL_DEPTH_BUFFER_BIT) != 0, (mask & GL_STENCIL_BUFFER_BIT) != 0,
+ filter, sourceFramebuffer));
+
+ return angle::Result::Continue;
+}
+
+bool FramebufferD3D::checkStatus(const gl::Context *context) const
+{
+ // if we have both a depth and stencil buffer, they must refer to the same object
+ // since we only support packed_depth_stencil and not separate depth and stencil
+ if (mState.hasSeparateDepthAndStencilAttachments())
+ {
+ return false;
+ }
+
+ // D3D11 does not allow for overlapping RenderTargetViews.
+ // If WebGL compatibility is enabled, this has already been checked at a higher level.
+ ASSERT(!context->getExtensions().webglCompatibility ||
+ mState.colorAttachmentsAreUniqueImages());
+ if (!context->getExtensions().webglCompatibility)
+ {
+ if (!mState.colorAttachmentsAreUniqueImages())
+ {
+ return false;
+ }
+ }
+
+ // D3D requires all render targets to have the same dimensions.
+ if (!mState.attachmentsHaveSameDimensions())
+ {
+ return false;
+ }
+
+ return true;
+}
+
+angle::Result FramebufferD3D::syncState(const gl::Context *context,
+ const gl::Framebuffer::DirtyBits &dirtyBits)
+{
+ if (!mColorAttachmentsForRender.valid())
+ {
+ return angle::Result::Continue;
+ }
+
+ for (auto dirtyBit : dirtyBits)
+ {
+ if ((dirtyBit >= gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 &&
+ dirtyBit < gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX) ||
+ dirtyBit == gl::Framebuffer::DIRTY_BIT_DRAW_BUFFERS)
+ {
+ mColorAttachmentsForRender.reset();
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const gl::Context *context)
+{
+ gl::DrawBufferMask activeProgramOutputs =
+ context->getState().getProgram()->getActiveOutputVariables();
+
+ if (mColorAttachmentsForRender.valid() && mCurrentActiveProgramOutputs == activeProgramOutputs)
+ {
+ return mColorAttachmentsForRender.value();
+ }
+
+ // Does not actually free memory
+ gl::AttachmentList colorAttachmentsForRender;
+
+ const auto &colorAttachments = mState.getColorAttachments();
+ const auto &drawBufferStates = mState.getDrawBufferStates();
+ const auto &features = mRenderer->getFeatures();
+
+ for (size_t attachmentIndex = 0; attachmentIndex < colorAttachments.size(); ++attachmentIndex)
+ {
+ GLenum drawBufferState = drawBufferStates[attachmentIndex];
+ const gl::FramebufferAttachment &colorAttachment = colorAttachments[attachmentIndex];
+
+ if (colorAttachment.isAttached() && drawBufferState != GL_NONE &&
+ activeProgramOutputs[attachmentIndex])
+ {
+ ASSERT(drawBufferState == GL_BACK ||
+ drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + attachmentIndex));
+ colorAttachmentsForRender.push_back(&colorAttachment);
+ }
+ else if (!features.mrtPerfWorkaround.enabled)
+ {
+ colorAttachmentsForRender.push_back(nullptr);
+ }
+ }
+
+ // When rendering with no render target on D3D, two bugs lead to incorrect behavior on Intel
+ // drivers < 4815. The rendering samples always pass neglecting discard statements in pixel
+ // shader. We add a dummy texture as render target in such case.
+ if (mRenderer->getFeatures().addDummyTextureNoRenderTarget.enabled &&
+ colorAttachmentsForRender.empty() && activeProgramOutputs.any())
+ {
+ static_assert(static_cast<size_t>(activeProgramOutputs.size()) <= 32,
+ "Size of active program outputs should less or equal than 32.");
+ const GLuint activeProgramLocation = static_cast<GLuint>(
+ gl::ScanForward(static_cast<uint32_t>(activeProgramOutputs.bits())));
+
+ if (mDummyAttachment.isAttached() &&
+ (mDummyAttachment.getBinding() - GL_COLOR_ATTACHMENT0) == activeProgramLocation)
+ {
+ colorAttachmentsForRender.push_back(&mDummyAttachment);
+ }
+ else
+ {
+ // Remove dummy attachment to prevents us from leaking it, and the program may require
+ // it to be attached to a new binding point.
+ if (mDummyAttachment.isAttached())
+ {
+ mDummyAttachment.detach(context);
+ }
+
+ gl::Texture *dummyTex = nullptr;
+ // TODO(Jamie): Handle error if dummy texture can't be created.
+ (void)mRenderer->getIncompleteTexture(context, gl::TextureType::_2D, &dummyTex);
+ if (dummyTex)
+ {
+
+ gl::ImageIndex index = gl::ImageIndex::Make2D(0);
+ mDummyAttachment = gl::FramebufferAttachment(
+ context, GL_TEXTURE, GL_COLOR_ATTACHMENT0_EXT + activeProgramLocation, index,
+ dummyTex);
+ colorAttachmentsForRender.push_back(&mDummyAttachment);
+ }
+ }
+ }
+
+ mColorAttachmentsForRender = std::move(colorAttachmentsForRender);
+ mCurrentActiveProgramOutputs = activeProgramOutputs;
+
+ return mColorAttachmentsForRender.value();
+}
+
+void FramebufferD3D::destroy(const gl::Context *context)
+{
+ if (mDummyAttachment.isAttached())
+ {
+ mDummyAttachment.detach(context);
+ }
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h
new file mode 100644
index 0000000000..6e024ac700
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h
@@ -0,0 +1,139 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// FramebufferD3D.h: Defines the DefaultAttachmentD3D and FramebufferD3D classes.
+
+#ifndef LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
+#define LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
+
+#include <cstdint>
+#include <vector>
+
+#include "common/Color.h"
+#include "common/Optional.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/FramebufferImpl.h"
+
+namespace gl
+{
+class FramebufferAttachment;
+struct PixelPackState;
+
+typedef std::vector<const FramebufferAttachment *> AttachmentList;
+} // namespace gl
+
+namespace rx
+{
+class RendererD3D;
+class RenderTargetD3D;
+
+struct ClearParameters
+{
+ ClearParameters();
+ ClearParameters(const ClearParameters &other);
+
+ bool clearColor[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
+ gl::ColorF colorF;
+ gl::ColorI colorI;
+ gl::ColorUI colorUI;
+ GLenum colorType;
+ bool colorMaskRed;
+ bool colorMaskGreen;
+ bool colorMaskBlue;
+ bool colorMaskAlpha;
+
+ bool clearDepth;
+ float depthValue;
+
+ bool clearStencil;
+ GLint stencilValue;
+ GLuint stencilWriteMask;
+
+ bool scissorEnabled;
+ gl::Rectangle scissor;
+};
+
+class FramebufferD3D : public FramebufferImpl
+{
+ public:
+ FramebufferD3D(const gl::FramebufferState &data, RendererD3D *renderer);
+ ~FramebufferD3D() override;
+
+ angle::Result clear(const gl::Context *context, GLbitfield mask) override;
+ angle::Result clearBufferfv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *values) override;
+ angle::Result clearBufferuiv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *values) override;
+ angle::Result clearBufferiv(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *values) override;
+ angle::Result clearBufferfi(const gl::Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil) override;
+
+ GLenum getImplementationColorReadFormat(const gl::Context *context) const override;
+ GLenum getImplementationColorReadType(const gl::Context *context) const override;
+ angle::Result readPixels(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ void *pixels) override;
+
+ angle::Result blit(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ GLbitfield mask,
+ GLenum filter) override;
+
+ bool checkStatus(const gl::Context *context) const override;
+
+ angle::Result syncState(const gl::Context *context,
+ const gl::Framebuffer::DirtyBits &dirtyBits) override;
+
+ const gl::AttachmentList &getColorAttachmentsForRender(const gl::Context *context);
+
+ void destroy(const gl::Context *context) override;
+
+ private:
+ virtual angle::Result clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams) = 0;
+
+ virtual angle::Result readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels) = 0;
+
+ virtual angle::Result blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer) = 0;
+
+ virtual GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const = 0;
+
+ RendererD3D *mRenderer;
+ Optional<gl::AttachmentList> mColorAttachmentsForRender;
+ gl::DrawBufferMask mCurrentActiveProgramOutputs;
+
+ gl::FramebufferAttachment mDummyAttachment;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
new file mode 100644
index 0000000000..4fb5cd42a0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
@@ -0,0 +1,389 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "libANGLE/renderer/d3d/HLSLCompiler.h"
+
+#include <sstream>
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/features.h"
+#include "libANGLE/histogram_macros.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+#include "libANGLE/trace.h"
+
+namespace
+{
+#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
+# ifdef CREATE_COMPILER_FLAG_INFO
+# undef CREATE_COMPILER_FLAG_INFO
+# endif
+
+# define CREATE_COMPILER_FLAG_INFO(flag) \
+ { \
+ flag, #flag \
+ }
+
+struct CompilerFlagInfo
+{
+ UINT mFlag;
+ const char *mName;
+};
+
+CompilerFlagInfo CompilerFlagInfos[] = {
+ // NOTE: The data below is copied from d3dcompiler.h
+ // If something changes there it should be changed here as well
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_DEBUG), // (1 << 0)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_SKIP_VALIDATION), // (1 << 1)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_SKIP_OPTIMIZATION), // (1 << 2)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PACK_MATRIX_ROW_MAJOR), // (1 << 3)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR), // (1 << 4)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PARTIAL_PRECISION), // (1 << 5)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT), // (1 << 6)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT), // (1 << 7)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_NO_PRESHADER), // (1 << 8)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_AVOID_FLOW_CONTROL), // (1 << 9)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PREFER_FLOW_CONTROL), // (1 << 10)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_ENABLE_STRICTNESS), // (1 << 11)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY), // (1 << 12)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_IEEE_STRICTNESS), // (1 << 13)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL0), // (1 << 14)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL1), // 0
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL2), // ((1 << 14) | (1 << 15))
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL3), // (1 << 15)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_RESERVED16), // (1 << 16)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_RESERVED17), // (1 << 17)
+ CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_WARNINGS_ARE_ERRORS) // (1 << 18)
+};
+
+# undef CREATE_COMPILER_FLAG_INFO
+
+bool IsCompilerFlagSet(UINT mask, UINT flag)
+{
+ bool isFlagSet = IsMaskFlagSet(mask, flag);
+
+ switch (flag)
+ {
+ case D3DCOMPILE_OPTIMIZATION_LEVEL0:
+ return isFlagSet && !IsMaskFlagSet(mask, UINT(D3DCOMPILE_OPTIMIZATION_LEVEL3));
+
+ case D3DCOMPILE_OPTIMIZATION_LEVEL1:
+ return (mask & D3DCOMPILE_OPTIMIZATION_LEVEL2) == UINT(0);
+
+ case D3DCOMPILE_OPTIMIZATION_LEVEL3:
+ return isFlagSet && !IsMaskFlagSet(mask, UINT(D3DCOMPILE_OPTIMIZATION_LEVEL0));
+
+ default:
+ return isFlagSet;
+ }
+}
+#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
+
+constexpr char kOldCompilerLibrary[] = "d3dcompiler_old.dll";
+
+enum D3DCompilerLoadLibraryResult
+{
+ D3DCompilerDefaultLibrarySuccess,
+ D3DCompilerOldLibrarySuccess,
+ D3DCompilerFailure,
+ D3DCompilerEnumBoundary,
+};
+} // anonymous namespace
+
+namespace rx
+{
+
+CompileConfig::CompileConfig() : flags(0), name() {}
+
+CompileConfig::CompileConfig(UINT flags, const std::string &name) : flags(flags), name(name) {}
+
+HLSLCompiler::HLSLCompiler()
+ : mInitialized(false),
+ mD3DCompilerModule(nullptr),
+ mD3DCompileFunc(nullptr),
+ mD3DDisassembleFunc(nullptr)
+{}
+
+HLSLCompiler::~HLSLCompiler()
+{
+ release();
+}
+
+angle::Result HLSLCompiler::ensureInitialized(d3d::Context *context)
+{
+ if (mInitialized)
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRACE_EVENT0("gpu.angle", "HLSLCompiler::initialize");
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+# if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
+ // Find a D3DCompiler module that had already been loaded based on a predefined list of
+ // versions.
+ static const char *d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;
+
+ for (size_t i = 0; i < ArraySize(d3dCompilerNames); ++i)
+ {
+ if (GetModuleHandleExA(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 = LoadLibraryA(D3DCOMPILER_DLL_A);
+
+ if (mD3DCompilerModule)
+ {
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3DCompilerLoadLibraryResult",
+ D3DCompilerDefaultLibrarySuccess, D3DCompilerEnumBoundary);
+ }
+ else
+ {
+ WARN() << "Failed to load HLSL compiler library. Using 'old' DLL.";
+ mD3DCompilerModule = LoadLibraryA(kOldCompilerLibrary);
+ if (mD3DCompilerModule)
+ {
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3DCompilerLoadLibraryResult",
+ D3DCompilerOldLibrarySuccess, D3DCompilerEnumBoundary);
+ }
+ }
+ }
+
+ if (!mD3DCompilerModule)
+ {
+ DWORD lastError = GetLastError();
+ ERR() << "D3D Compiler LoadLibrary failed. GetLastError=" << lastError;
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3DCompilerLoadLibraryResult", D3DCompilerFailure,
+ D3DCompilerEnumBoundary);
+ ANGLE_TRY_HR(context, E_OUTOFMEMORY, "LoadLibrary failed to load D3D Compiler DLL.");
+ }
+
+ mD3DCompileFunc =
+ reinterpret_cast<pD3DCompile>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));
+ ASSERT(mD3DCompileFunc);
+
+ mD3DDisassembleFunc =
+ reinterpret_cast<pD3DDisassemble>(GetProcAddress(mD3DCompilerModule, "D3DDisassemble"));
+ ASSERT(mD3DDisassembleFunc);
+
+#else
+ // D3D Shader compiler is linked already into this module, so the export
+ // can be directly assigned.
+ mD3DCompilerModule = nullptr;
+ mD3DCompileFunc = reinterpret_cast<pD3DCompile>(D3DCompile);
+ mD3DDisassembleFunc = reinterpret_cast<pD3DDisassemble>(D3DDisassemble);
+#endif
+
+ ANGLE_CHECK_HR(context, mD3DCompileFunc, "Error finding D3DCompile entry point.",
+ E_OUTOFMEMORY);
+
+ mInitialized = true;
+ return angle::Result::Continue;
+}
+
+void HLSLCompiler::release()
+{
+ if (mInitialized)
+ {
+ FreeLibrary(mD3DCompilerModule);
+ mD3DCompilerModule = nullptr;
+ mD3DCompileFunc = nullptr;
+ mD3DDisassembleFunc = nullptr;
+ mInitialized = false;
+ }
+}
+
+angle::Result HLSLCompiler::compileToBinary(d3d::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &hlsl,
+ const std::string &profile,
+ const std::vector<CompileConfig> &configs,
+ const D3D_SHADER_MACRO *overrideMacros,
+ ID3DBlob **outCompiledBlob,
+ std::string *outDebugInfo)
+{
+ ASSERT(mInitialized);
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ ASSERT(mD3DCompilerModule);
+#endif
+ ASSERT(mD3DCompileFunc);
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (gl::DebugAnnotationsActive())
+ {
+ std::string sourcePath = getTempPath();
+ std::ostringstream stream;
+ stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl;
+ std::string sourceText = stream.str();
+ writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
+ }
+#endif
+
+ const D3D_SHADER_MACRO *macros = overrideMacros ? overrideMacros : nullptr;
+
+ for (size_t i = 0; i < configs.size(); ++i)
+ {
+ ID3DBlob *errorMessage = nullptr;
+ ID3DBlob *binary = nullptr;
+ HRESULT result = S_OK;
+
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "D3DCompile");
+ SCOPED_ANGLE_HISTOGRAM_TIMER("GPU.ANGLE.D3DCompileMS");
+ result = mD3DCompileFunc(hlsl.c_str(), hlsl.length(), gl::g_fakepath, macros, nullptr,
+ "main", profile.c_str(), configs[i].flags, 0, &binary,
+ &errorMessage);
+ }
+
+ if (errorMessage)
+ {
+ std::string message = static_cast<const char *>(errorMessage->GetBufferPointer());
+ SafeRelease(errorMessage);
+
+ infoLog.appendSanitized(message.c_str());
+
+ // This produces unbelievable amounts of spam in about:gpu.
+ // WARN() << std::endl << hlsl;
+
+ WARN() << std::endl << message;
+
+ if (macros != nullptr)
+ {
+ constexpr const char *kLoopRelatedErrors[] = {
+ // "can't unroll loops marked with loop attribute"
+ "error X3531:",
+
+ // "cannot have gradient operations inside loops with divergent flow control",
+ // even though it is counter-intuitive to disable unrolling for this error, some
+ // very long shaders have trouble deciding which loops to unroll and turning off
+ // forced unrolls allows them to compile properly.
+ "error X4014:",
+
+ // "array index out of bounds", loop unrolling can result in invalid array
+ // access if the indices become constant, causing loops that may never be
+ // executed to generate compilation errors
+ "error X3504:",
+ };
+
+ bool hasLoopRelatedError = false;
+ for (const char *errorType : kLoopRelatedErrors)
+ {
+ if (message.find(errorType) != std::string::npos)
+ {
+ hasLoopRelatedError = true;
+ break;
+ }
+ }
+
+ if (hasLoopRelatedError)
+ {
+ // Disable [loop] and [flatten]
+ macros = nullptr;
+
+ // Retry without changing compiler flags
+ i--;
+ continue;
+ }
+ }
+ }
+
+ if (SUCCEEDED(result))
+ {
+ *outCompiledBlob = binary;
+
+ (*outDebugInfo) +=
+ "// COMPILER INPUT HLSL BEGIN\n\n" + hlsl + "\n// COMPILER INPUT HLSL END\n";
+
+#if ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
+ (*outDebugInfo) += "\n\n// ASSEMBLY BEGIN\n\n";
+ (*outDebugInfo) += "// Compiler configuration: " + configs[i].name + "\n// Flags:\n";
+ for (size_t fIx = 0; fIx < ArraySize(CompilerFlagInfos); ++fIx)
+ {
+ if (IsCompilerFlagSet(configs[i].flags, CompilerFlagInfos[fIx].mFlag))
+ {
+ (*outDebugInfo) += std::string("// ") + CompilerFlagInfos[fIx].mName + "\n";
+ }
+ }
+
+ (*outDebugInfo) += "// Macros:\n";
+ if (macros == nullptr)
+ {
+ (*outDebugInfo) += "// - : -\n";
+ }
+ else
+ {
+ for (const D3D_SHADER_MACRO *mIt = macros; mIt->Name != nullptr; ++mIt)
+ {
+ (*outDebugInfo) +=
+ std::string("// ") + mIt->Name + " : " + mIt->Definition + "\n";
+ }
+ }
+
+ std::string disassembly;
+ ANGLE_TRY(disassembleBinary(context, binary, &disassembly));
+ (*outDebugInfo) += "\n" + disassembly + "\n// ASSEMBLY END\n";
+#endif // ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO == ANGLE_ENABLED
+ return angle::Result::Continue;
+ }
+
+ if (result == E_OUTOFMEMORY)
+ {
+ *outCompiledBlob = nullptr;
+ ANGLE_TRY_HR(context, result, "HLSL compiler had an unexpected failure");
+ }
+
+ infoLog << "Warning: D3D shader compilation failed with " << configs[i].name << " flags. ("
+ << profile << ")";
+
+ if (i + 1 < configs.size())
+ {
+ infoLog << " Retrying with " << configs[i + 1].name;
+ }
+ }
+
+ // None of the configurations succeeded in compiling this shader but the compiler is still
+ // intact
+ *outCompiledBlob = nullptr;
+ return angle::Result::Continue;
+}
+
+angle::Result HLSLCompiler::disassembleBinary(d3d::Context *context,
+ ID3DBlob *shaderBinary,
+ std::string *disassemblyOut)
+{
+ ANGLE_TRY(ensureInitialized(context));
+
+ // Retrieve disassembly
+ UINT flags = D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS | D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING;
+ ID3DBlob *disassembly = nullptr;
+ pD3DDisassemble disassembleFunc = reinterpret_cast<pD3DDisassemble>(mD3DDisassembleFunc);
+ LPCVOID buffer = shaderBinary->GetBufferPointer();
+ SIZE_T bufSize = shaderBinary->GetBufferSize();
+ HRESULT result = disassembleFunc(buffer, bufSize, flags, "", &disassembly);
+
+ if (SUCCEEDED(result))
+ {
+ *disassemblyOut = std::string(static_cast<const char *>(disassembly->GetBufferPointer()));
+ }
+ else
+ {
+ *disassemblyOut = "";
+ }
+
+ SafeRelease(disassembly);
+
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.h
new file mode 100644
index 0000000000..3d93752089
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/HLSLCompiler.h
@@ -0,0 +1,74 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// HLSLCompiler: Wrapper for the D3DCompiler DLL.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_HLSLCOMPILER_H_
+#define LIBANGLE_RENDERER_D3D_HLSLCOMPILER_H_
+
+#include "libANGLE/Error.h"
+
+#include "common/angleutils.h"
+#include "common/platform.h"
+
+#include <string>
+#include <vector>
+
+namespace gl
+{
+class InfoLog;
+} // namespace gl
+
+namespace rx
+{
+namespace d3d
+{
+class Context;
+} // namespace d3d
+
+struct CompileConfig
+{
+ UINT flags;
+ std::string name;
+
+ CompileConfig();
+ CompileConfig(UINT flags, const std::string &name);
+};
+
+class HLSLCompiler : angle::NonCopyable
+{
+ public:
+ HLSLCompiler();
+ ~HLSLCompiler();
+
+ void release();
+
+ // Attempt to compile a HLSL shader using the supplied configurations, may output a NULL
+ // compiled blob even if no GL errors are returned.
+ angle::Result compileToBinary(d3d::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &hlsl,
+ const std::string &profile,
+ const std::vector<CompileConfig> &configs,
+ const D3D_SHADER_MACRO *overrideMacros,
+ ID3DBlob **outCompiledBlob,
+ std::string *outDebugInfo);
+
+ angle::Result disassembleBinary(d3d::Context *context,
+ ID3DBlob *shaderBinary,
+ std::string *disassemblyOut);
+ angle::Result ensureInitialized(d3d::Context *context);
+
+ private:
+ bool mInitialized;
+ HMODULE mD3DCompilerModule;
+ pD3DCompile mD3DCompileFunc;
+ pD3DDisassemble mD3DDisassembleFunc;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_HLSLCOMPILER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp
new file mode 100644
index 0000000000..40e6f89f5c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp
@@ -0,0 +1,56 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image.h: Implements the rx::Image class, an abstract base class for the
+// renderer-specific classes which will define the interface to the underlying
+// surfaces or resources.
+
+#include "libANGLE/renderer/d3d/ImageD3D.h"
+
+namespace rx
+{
+
+ImageD3D::ImageD3D()
+ : mWidth(0),
+ mHeight(0),
+ mDepth(0),
+ mInternalFormat(GL_NONE),
+ mRenderable(false),
+ mType(gl::TextureType::InvalidEnum),
+ mDirty(false)
+{}
+
+angle::Result ImageD3D::setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result ImageD3D::setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result ImageD3D::setManagedSurface3D(const gl::Context *context,
+ TextureStorage *storage,
+ int level)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result ImageD3D::setManagedSurface2DArray(const gl::Context *context,
+ TextureStorage *storage,
+ int layer,
+ int level)
+{
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h
new file mode 100644
index 0000000000..70b1e12e76
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h
@@ -0,0 +1,108 @@
+//
+// Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ImageD3D.h: Defines the rx::ImageD3D class, an abstract base class for the
+// renderer-specific classes which will define the interface to the underlying
+// surfaces or resources.
+
+#ifndef LIBANGLE_RENDERER_D3D_IMAGED3D_H_
+#define LIBANGLE_RENDERER_D3D_IMAGED3D_H_
+
+#include "common/debug.h"
+
+#include "common/PackedEnums.h"
+#include "libANGLE/Error.h"
+
+namespace gl
+{
+class Context;
+class Framebuffer;
+class ImageIndex;
+struct Box;
+struct Extents;
+struct Offset;
+struct Rectangle;
+struct PixelUnpackState;
+} // namespace gl
+
+namespace rx
+{
+class TextureStorage;
+class RendererD3D;
+class RenderTargetD3D;
+
+class ImageD3D : angle::NonCopyable
+{
+ public:
+ ImageD3D();
+ virtual ~ImageD3D() {}
+
+ GLsizei getWidth() const { return mWidth; }
+ GLsizei getHeight() const { return mHeight; }
+ GLsizei getDepth() const { return mDepth; }
+ GLenum getInternalFormat() const { return mInternalFormat; }
+ gl::TextureType getType() const { return mType; }
+ bool isRenderableFormat() const { return mRenderable; }
+
+ void markDirty() { mDirty = true; }
+ void markClean() { mDirty = false; }
+ virtual bool isDirty() const = 0;
+
+ virtual bool redefine(gl::TextureType type,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease) = 0;
+
+ virtual angle::Result loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages) = 0;
+ virtual angle::Result loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input) = 0;
+
+ virtual angle::Result setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level);
+ virtual angle::Result setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level);
+ virtual angle::Result setManagedSurface3D(const gl::Context *context,
+ TextureStorage *storage,
+ int level);
+ virtual angle::Result setManagedSurface2DArray(const gl::Context *context,
+ TextureStorage *storage,
+ int layer,
+ int level);
+ virtual angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box &region) = 0;
+
+ virtual angle::Result copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source) = 0;
+ virtual angle::Result copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source) = 0;
+
+ protected:
+ GLsizei mWidth;
+ GLsizei mHeight;
+ GLsizei mDepth;
+ GLenum mInternalFormat;
+ bool mRenderable;
+ gl::TextureType mType;
+
+ bool mDirty;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_IMAGED3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.cpp
new file mode 100644
index 0000000000..96ec8dc7fa
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.cpp
@@ -0,0 +1,183 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexBuffer.cpp: Defines the abstract IndexBuffer class and IndexBufferInterface
+// class with derivations, classes that perform graphics API agnostic index buffer operations.
+
+#include "libANGLE/renderer/d3d/IndexBuffer.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+
+namespace rx
+{
+
+unsigned int IndexBuffer::mNextSerial = 1;
+
+IndexBuffer::IndexBuffer()
+{
+ updateSerial();
+}
+
+IndexBuffer::~IndexBuffer() {}
+
+unsigned int IndexBuffer::getSerial() const
+{
+ return mSerial;
+}
+
+void IndexBuffer::updateSerial()
+{
+ mSerial = mNextSerial++;
+}
+
+IndexBufferInterface::IndexBufferInterface(BufferFactoryD3D *factory, bool dynamic)
+{
+ mIndexBuffer = factory->createIndexBuffer();
+
+ mDynamic = dynamic;
+ mWritePosition = 0;
+}
+
+IndexBufferInterface::~IndexBufferInterface()
+{
+ if (mIndexBuffer)
+ {
+ delete mIndexBuffer;
+ }
+}
+
+gl::DrawElementsType IndexBufferInterface::getIndexType() const
+{
+ return mIndexBuffer->getIndexType();
+}
+
+unsigned int IndexBufferInterface::getBufferSize() const
+{
+ return mIndexBuffer->getBufferSize();
+}
+
+unsigned int IndexBufferInterface::getSerial() const
+{
+ return mIndexBuffer->getSerial();
+}
+
+angle::Result IndexBufferInterface::mapBuffer(const gl::Context *context,
+ unsigned int size,
+ void **outMappedMemory,
+ unsigned int *streamOffset)
+{
+ // Protect against integer overflow
+ bool check = (mWritePosition + size < mWritePosition);
+ ANGLE_CHECK(GetImplAs<ContextD3D>(context), !check,
+ "Mapping of internal index buffer would cause an integer overflow.",
+ GL_OUT_OF_MEMORY);
+
+ angle::Result error = mIndexBuffer->mapBuffer(context, mWritePosition, size, outMappedMemory);
+ if (error == angle::Result::Stop)
+ {
+ if (outMappedMemory)
+ {
+ *outMappedMemory = nullptr;
+ }
+ return error;
+ }
+
+ if (streamOffset)
+ {
+ *streamOffset = mWritePosition;
+ }
+
+ mWritePosition += size;
+ return angle::Result::Continue;
+}
+
+angle::Result IndexBufferInterface::unmapBuffer(const gl::Context *context)
+{
+ return mIndexBuffer->unmapBuffer(context);
+}
+
+IndexBuffer *IndexBufferInterface::getIndexBuffer() const
+{
+ return mIndexBuffer;
+}
+
+unsigned int IndexBufferInterface::getWritePosition() const
+{
+ return mWritePosition;
+}
+
+void IndexBufferInterface::setWritePosition(unsigned int writePosition)
+{
+ mWritePosition = writePosition;
+}
+
+angle::Result IndexBufferInterface::discard(const gl::Context *context)
+{
+ return mIndexBuffer->discard(context);
+}
+
+angle::Result IndexBufferInterface::setBufferSize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType)
+{
+ if (mIndexBuffer->getBufferSize() == 0)
+ {
+ return mIndexBuffer->initialize(context, bufferSize, indexType, mDynamic);
+ }
+ else
+ {
+ return mIndexBuffer->setSize(context, bufferSize, indexType);
+ }
+}
+
+StreamingIndexBufferInterface::StreamingIndexBufferInterface(BufferFactoryD3D *factory)
+ : IndexBufferInterface(factory, true)
+{}
+
+StreamingIndexBufferInterface::~StreamingIndexBufferInterface() {}
+
+angle::Result StreamingIndexBufferInterface::reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ gl::DrawElementsType indexType)
+{
+ unsigned int curBufferSize = getBufferSize();
+ unsigned int writePos = getWritePosition();
+ if (size > curBufferSize)
+ {
+ ANGLE_TRY(setBufferSize(context, std::max(size, 2 * curBufferSize), indexType));
+ setWritePosition(0);
+ }
+ else if (writePos + size > curBufferSize || writePos + size < writePos)
+ {
+ ANGLE_TRY(discard(context));
+ setWritePosition(0);
+ }
+
+ return angle::Result::Continue;
+}
+
+StaticIndexBufferInterface::StaticIndexBufferInterface(BufferFactoryD3D *factory)
+ : IndexBufferInterface(factory, false)
+{}
+
+StaticIndexBufferInterface::~StaticIndexBufferInterface() {}
+
+angle::Result StaticIndexBufferInterface::reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ gl::DrawElementsType indexType)
+{
+ unsigned int curSize = getBufferSize();
+ if (curSize == 0)
+ {
+ return setBufferSize(context, size, indexType);
+ }
+
+ ASSERT(curSize >= size && indexType == getIndexType());
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.h
new file mode 100644
index 0000000000..e21bca2420
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexBuffer.h
@@ -0,0 +1,125 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexBuffer.h: Defines the abstract IndexBuffer class and IndexBufferInterface
+// class with derivations, classes that perform graphics API agnostic index buffer operations.
+
+#ifndef LIBANGLE_RENDERER_D3D_INDEXBUFFER_H_
+#define LIBANGLE_RENDERER_D3D_INDEXBUFFER_H_
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace rx
+{
+class BufferFactoryD3D;
+
+class IndexBuffer : angle::NonCopyable
+{
+ public:
+ IndexBuffer();
+ virtual ~IndexBuffer();
+
+ virtual angle::Result initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType,
+ bool dynamic) = 0;
+
+ virtual angle::Result mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory) = 0;
+ virtual angle::Result unmapBuffer(const gl::Context *context) = 0;
+
+ virtual angle::Result discard(const gl::Context *context) = 0;
+
+ virtual gl::DrawElementsType getIndexType() const = 0;
+ virtual unsigned int getBufferSize() const = 0;
+ virtual angle::Result setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType) = 0;
+
+ unsigned int getSerial() const;
+
+ protected:
+ void updateSerial();
+
+ private:
+ unsigned int mSerial;
+ static unsigned int mNextSerial;
+};
+
+class IndexBufferInterface : angle::NonCopyable
+{
+ public:
+ IndexBufferInterface(BufferFactoryD3D *factory, bool dynamic);
+ virtual ~IndexBufferInterface();
+
+ virtual angle::Result reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ gl::DrawElementsType indexType) = 0;
+
+ gl::DrawElementsType getIndexType() const;
+ unsigned int getBufferSize() const;
+
+ unsigned int getSerial() const;
+
+ angle::Result mapBuffer(const gl::Context *context,
+ unsigned int size,
+ void **outMappedMemory,
+ unsigned int *streamOffset);
+ angle::Result unmapBuffer(const gl::Context *context);
+
+ IndexBuffer *getIndexBuffer() const;
+
+ protected:
+ unsigned int getWritePosition() const;
+ void setWritePosition(unsigned int writePosition);
+
+ angle::Result discard(const gl::Context *context);
+
+ angle::Result setBufferSize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType);
+
+ private:
+ IndexBuffer *mIndexBuffer;
+
+ unsigned int mWritePosition;
+ bool mDynamic;
+};
+
+class StreamingIndexBufferInterface : public IndexBufferInterface
+{
+ public:
+ explicit StreamingIndexBufferInterface(BufferFactoryD3D *factory);
+ ~StreamingIndexBufferInterface() override;
+
+ angle::Result reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ gl::DrawElementsType indexType) override;
+};
+
+class StaticIndexBufferInterface : public IndexBufferInterface
+{
+ public:
+ explicit StaticIndexBufferInterface(BufferFactoryD3D *factory);
+ ~StaticIndexBufferInterface() override;
+
+ angle::Result reserveBufferSpace(const gl::Context *context,
+ unsigned int size,
+ gl::DrawElementsType indexType) override;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_INDEXBUFFER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp
new file mode 100644
index 0000000000..9ce4cb66a4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp
@@ -0,0 +1,318 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexDataManager.cpp: Defines the IndexDataManager, a class that
+// runs the Buffer translation process for index buffers.
+
+#include "libANGLE/renderer/d3d/IndexDataManager.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+#include "libANGLE/renderer/d3d/IndexBuffer.h"
+
+namespace rx
+{
+
+namespace
+{
+
+template <typename InputT, typename DestT>
+void ConvertIndexArray(const void *input,
+ gl::DrawElementsType sourceType,
+ void *output,
+ gl::DrawElementsType destinationType,
+ GLsizei count,
+ bool usePrimitiveRestartFixedIndex)
+{
+ const InputT *in = static_cast<const InputT *>(input);
+ DestT *out = static_cast<DestT *>(output);
+
+ if (usePrimitiveRestartFixedIndex)
+ {
+ InputT srcRestartIndex = static_cast<InputT>(gl::GetPrimitiveRestartIndex(sourceType));
+ DestT destRestartIndex = static_cast<DestT>(gl::GetPrimitiveRestartIndex(destinationType));
+ for (GLsizei i = 0; i < count; i++)
+ {
+ out[i] = (in[i] == srcRestartIndex ? destRestartIndex : static_cast<DestT>(in[i]));
+ }
+ }
+ else
+ {
+ for (GLsizei i = 0; i < count; i++)
+ {
+ out[i] = static_cast<DestT>(in[i]);
+ }
+ }
+}
+
+void ConvertIndices(gl::DrawElementsType sourceType,
+ gl::DrawElementsType destinationType,
+ const void *input,
+ GLsizei count,
+ void *output,
+ bool usePrimitiveRestartFixedIndex)
+{
+ if (sourceType == destinationType)
+ {
+ const GLuint dstTypeSize = gl::GetDrawElementsTypeSize(destinationType);
+ memcpy(output, input, count * dstTypeSize);
+ return;
+ }
+
+ if (sourceType == gl::DrawElementsType::UnsignedByte)
+ {
+ ASSERT(destinationType == gl::DrawElementsType::UnsignedShort);
+ ConvertIndexArray<GLubyte, GLushort>(input, sourceType, output, destinationType, count,
+ usePrimitiveRestartFixedIndex);
+ }
+ else if (sourceType == gl::DrawElementsType::UnsignedShort)
+ {
+ ASSERT(destinationType == gl::DrawElementsType::UnsignedInt);
+ ConvertIndexArray<GLushort, GLuint>(input, sourceType, output, destinationType, count,
+ usePrimitiveRestartFixedIndex);
+ }
+ else
+ UNREACHABLE();
+}
+
+angle::Result StreamInIndexBuffer(const gl::Context *context,
+ IndexBufferInterface *buffer,
+ const void *data,
+ unsigned int count,
+ gl::DrawElementsType srcType,
+ gl::DrawElementsType dstType,
+ bool usePrimitiveRestartFixedIndex,
+ unsigned int *offset)
+{
+ const GLuint dstTypeBytesShift = gl::GetDrawElementsTypeShift(dstType);
+
+ bool check = (count > (std::numeric_limits<unsigned int>::max() >> dstTypeBytesShift));
+ ANGLE_CHECK(GetImplAs<ContextD3D>(context), !check,
+ "Reserving indices exceeds the maximum buffer size.", GL_OUT_OF_MEMORY);
+
+ unsigned int bufferSizeRequired = count << dstTypeBytesShift;
+ ANGLE_TRY(buffer->reserveBufferSpace(context, bufferSizeRequired, dstType));
+
+ void *output = nullptr;
+ ANGLE_TRY(buffer->mapBuffer(context, bufferSizeRequired, &output, offset));
+
+ ConvertIndices(srcType, dstType, data, count, output, usePrimitiveRestartFixedIndex);
+
+ ANGLE_TRY(buffer->unmapBuffer(context));
+ return angle::Result::Continue;
+}
+} // anonymous namespace
+
+// IndexDataManager implementation.
+IndexDataManager::IndexDataManager(BufferFactoryD3D *factory)
+ : mFactory(factory), mStreamingBufferShort(), mStreamingBufferInt()
+{}
+
+IndexDataManager::~IndexDataManager() {}
+
+void IndexDataManager::deinitialize()
+{
+ mStreamingBufferShort.reset();
+ mStreamingBufferInt.reset();
+}
+
+// This function translates a GL-style indices into DX-style indices, with their description
+// returned in translated.
+// GL can specify vertex data in immediate mode (pointer to CPU array of indices), which is not
+// possible in DX and requires streaming (Case 1). If the GL indices are specified with a buffer
+// (Case 2), in a format supported by DX (subcase a) then all is good.
+// When we have a buffer with an unsupported format (subcase b) then we need to do some translation:
+// we will start by falling back to streaming, and after a while will start using a static
+// translated copy of the index buffer.
+angle::Result IndexDataManager::prepareIndexData(const gl::Context *context,
+ gl::DrawElementsType srcType,
+ gl::DrawElementsType dstType,
+ GLsizei count,
+ gl::Buffer *glBuffer,
+ const void *indices,
+ TranslatedIndexData *translated)
+{
+ GLuint srcTypeBytes = gl::GetDrawElementsTypeSize(srcType);
+ GLuint srcTypeShift = gl::GetDrawElementsTypeShift(srcType);
+ GLuint dstTypeShift = gl::GetDrawElementsTypeShift(dstType);
+
+ BufferD3D *buffer = glBuffer ? GetImplAs<BufferD3D>(glBuffer) : nullptr;
+
+ translated->indexType = dstType;
+ translated->srcIndexData.srcBuffer = buffer;
+ translated->srcIndexData.srcIndices = indices;
+ translated->srcIndexData.srcIndexType = srcType;
+ translated->srcIndexData.srcCount = count;
+
+ // Context can be nullptr in perf tests.
+ bool primitiveRestartFixedIndexEnabled =
+ context ? context->getState().isPrimitiveRestartEnabled() : false;
+
+ // Case 1: the indices are passed by pointer, which forces the streaming of index data
+ if (glBuffer == nullptr)
+ {
+ translated->storage = nullptr;
+ return streamIndexData(context, indices, count, srcType, dstType,
+ primitiveRestartFixedIndexEnabled, translated);
+ }
+
+ // Case 2: the indices are already in a buffer
+ unsigned int offset = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(indices));
+ ASSERT(srcTypeBytes * static_cast<unsigned int>(count) + offset <= buffer->getSize());
+
+ bool offsetAligned = IsOffsetAligned(srcType, offset);
+
+ // Case 2a: the buffer can be used directly
+ if (offsetAligned && buffer->supportsDirectBinding() && dstType == srcType)
+ {
+ translated->storage = buffer;
+ translated->indexBuffer = nullptr;
+ translated->serial = buffer->getSerial();
+ translated->startIndex = (offset >> srcTypeShift);
+ translated->startOffset = offset;
+ return angle::Result::Continue;
+ }
+
+ translated->storage = nullptr;
+
+ // Case 2b: use a static translated copy or fall back to streaming
+ StaticIndexBufferInterface *staticBuffer = buffer->getStaticIndexBuffer();
+
+ bool staticBufferInitialized = staticBuffer && staticBuffer->getBufferSize() != 0;
+ bool staticBufferUsable =
+ staticBuffer && offsetAligned && staticBuffer->getIndexType() == dstType;
+
+ if (staticBufferInitialized && !staticBufferUsable)
+ {
+ buffer->invalidateStaticData(context);
+ staticBuffer = nullptr;
+ }
+
+ if (staticBuffer == nullptr || !offsetAligned)
+ {
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(buffer->getData(context, &bufferData));
+ ASSERT(bufferData != nullptr);
+
+ ANGLE_TRY(streamIndexData(context, bufferData + offset, count, srcType, dstType,
+ primitiveRestartFixedIndexEnabled, translated));
+ buffer->promoteStaticUsage(context, count << srcTypeShift);
+ }
+ else
+ {
+ if (!staticBufferInitialized)
+ {
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(buffer->getData(context, &bufferData));
+ ASSERT(bufferData != nullptr);
+
+ unsigned int convertCount =
+ static_cast<unsigned int>(buffer->getSize()) >> srcTypeShift;
+ ANGLE_TRY(StreamInIndexBuffer(context, staticBuffer, bufferData, convertCount, srcType,
+ dstType, primitiveRestartFixedIndexEnabled, nullptr));
+ }
+ ASSERT(offsetAligned && staticBuffer->getIndexType() == dstType);
+
+ translated->indexBuffer = staticBuffer->getIndexBuffer();
+ translated->serial = staticBuffer->getSerial();
+ translated->startIndex = (offset >> srcTypeShift);
+ translated->startOffset = (offset >> srcTypeShift) << dstTypeShift;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result IndexDataManager::streamIndexData(const gl::Context *context,
+ const void *data,
+ unsigned int count,
+ gl::DrawElementsType srcType,
+ gl::DrawElementsType dstType,
+ bool usePrimitiveRestartFixedIndex,
+ TranslatedIndexData *translated)
+{
+ const GLuint dstTypeShift = gl::GetDrawElementsTypeShift(dstType);
+
+ IndexBufferInterface *indexBuffer = nullptr;
+ ANGLE_TRY(getStreamingIndexBuffer(context, dstType, &indexBuffer));
+ ASSERT(indexBuffer != nullptr);
+
+ unsigned int offset;
+ ANGLE_TRY(StreamInIndexBuffer(context, indexBuffer, data, count, srcType, dstType,
+ usePrimitiveRestartFixedIndex, &offset));
+
+ translated->indexBuffer = indexBuffer->getIndexBuffer();
+ translated->serial = indexBuffer->getSerial();
+ translated->startIndex = (offset >> dstTypeShift);
+ translated->startOffset = offset;
+
+ return angle::Result::Continue;
+}
+
+angle::Result IndexDataManager::getStreamingIndexBuffer(const gl::Context *context,
+ gl::DrawElementsType destinationIndexType,
+ IndexBufferInterface **outBuffer)
+{
+ ASSERT(outBuffer);
+ ASSERT(destinationIndexType == gl::DrawElementsType::UnsignedShort ||
+ destinationIndexType == gl::DrawElementsType::UnsignedInt);
+
+ auto &streamingBuffer = (destinationIndexType == gl::DrawElementsType::UnsignedInt)
+ ? mStreamingBufferInt
+ : mStreamingBufferShort;
+
+ if (!streamingBuffer)
+ {
+ StreamingBuffer newBuffer(new StreamingIndexBufferInterface(mFactory));
+ ANGLE_TRY(newBuffer->reserveBufferSpace(context, INITIAL_INDEX_BUFFER_SIZE,
+ destinationIndexType));
+ streamingBuffer = std::move(newBuffer);
+ }
+
+ *outBuffer = streamingBuffer.get();
+ return angle::Result::Continue;
+}
+
+angle::Result GetIndexTranslationDestType(const gl::Context *context,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ bool usePrimitiveRestartWorkaround,
+ gl::DrawElementsType *destTypeOut)
+{
+ // Avoid D3D11's primitive restart index value
+ // see http://msdn.microsoft.com/en-us/library/windows/desktop/bb205124(v=vs.85).aspx
+ if (usePrimitiveRestartWorkaround)
+ {
+ // Conservatively assume we need to translate the indices for draw indirect.
+ // This is a bit of a trick. We assume the count for an indirect draw is zero.
+ if (indexCount == 0)
+ {
+ *destTypeOut = gl::DrawElementsType::UnsignedInt;
+ return angle::Result::Continue;
+ }
+
+ gl::IndexRange indexRange;
+ ANGLE_TRY(context->getState().getVertexArray()->getIndexRange(
+ context, indexType, indexCount, indices, &indexRange));
+ if (indexRange.end == gl::GetPrimitiveRestartIndex(indexType))
+ {
+ *destTypeOut = gl::DrawElementsType::UnsignedInt;
+ return angle::Result::Continue;
+ }
+ }
+
+ *destTypeOut = (indexType == gl::DrawElementsType::UnsignedInt)
+ ? gl::DrawElementsType::UnsignedInt
+ : gl::DrawElementsType::UnsignedShort;
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h
new file mode 100644
index 0000000000..874580e590
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h
@@ -0,0 +1,112 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexDataManager.h: Defines the IndexDataManager, a class that
+// runs the Buffer translation process for index buffers.
+
+#ifndef LIBANGLE_INDEXDATAMANAGER_H_
+#define LIBANGLE_INDEXDATAMANAGER_H_
+
+#include <GLES2/gl2.h>
+
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace
+{
+enum
+{
+ INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint)
+};
+}
+
+namespace gl
+{
+class Buffer;
+}
+
+namespace rx
+{
+class IndexBufferInterface;
+class StaticIndexBufferInterface;
+class StreamingIndexBufferInterface;
+class IndexBuffer;
+class BufferD3D;
+class RendererD3D;
+
+struct SourceIndexData
+{
+ BufferD3D *srcBuffer;
+ const void *srcIndices;
+ unsigned int srcCount;
+ gl::DrawElementsType srcIndexType;
+ bool srcIndicesChanged;
+};
+
+struct TranslatedIndexData
+{
+ unsigned int startIndex;
+ unsigned int startOffset; // In bytes
+
+ IndexBuffer *indexBuffer;
+ BufferD3D *storage;
+ gl::DrawElementsType indexType;
+ unsigned int serial;
+
+ SourceIndexData srcIndexData;
+};
+
+class IndexDataManager : angle::NonCopyable
+{
+ public:
+ explicit IndexDataManager(BufferFactoryD3D *factory);
+ virtual ~IndexDataManager();
+
+ void deinitialize();
+
+ angle::Result prepareIndexData(const gl::Context *context,
+ gl::DrawElementsType srcType,
+ gl::DrawElementsType dstType,
+ GLsizei count,
+ gl::Buffer *glBuffer,
+ const void *indices,
+ TranslatedIndexData *translated);
+
+ private:
+ angle::Result streamIndexData(const gl::Context *context,
+ const void *data,
+ unsigned int count,
+ gl::DrawElementsType srcType,
+ gl::DrawElementsType dstType,
+ bool usePrimitiveRestartFixedIndex,
+ TranslatedIndexData *translated);
+ angle::Result getStreamingIndexBuffer(const gl::Context *context,
+ gl::DrawElementsType destinationIndexType,
+ IndexBufferInterface **outBuffer);
+
+ using StreamingBuffer = std::unique_ptr<StreamingIndexBufferInterface>;
+
+ BufferFactoryD3D *const mFactory;
+ std::unique_ptr<StreamingIndexBufferInterface> mStreamingBufferShort;
+ std::unique_ptr<StreamingIndexBufferInterface> mStreamingBufferInt;
+};
+
+angle::Result GetIndexTranslationDestType(const gl::Context *context,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ bool usePrimitiveRestartWorkaround,
+ gl::DrawElementsType *destTypeOut);
+
+ANGLE_INLINE bool IsOffsetAligned(gl::DrawElementsType elementType, unsigned int offset)
+{
+ return (offset % gl::GetDrawElementsTypeSize(elementType) == 0);
+}
+} // namespace rx
+
+#endif // LIBANGLE_INDEXDATAMANAGER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp
new file mode 100644
index 0000000000..373bebce53
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp
@@ -0,0 +1,19 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// NativeWindowD3D.cpp: Defines NativeWindowD3D, a class for managing and performing operations on
+// an EGLNativeWindowType for the D3D renderers.
+
+#include "libANGLE/renderer/d3d/NativeWindowD3D.h"
+
+namespace rx
+{
+
+NativeWindowD3D::NativeWindowD3D(EGLNativeWindowType window) : mWindow(window) {}
+
+NativeWindowD3D::~NativeWindowD3D() {}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.h
new file mode 100644
index 0000000000..e253fd814b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// NativeWindowD3D.h: Defines NativeWindowD3D, a class for managing and performing operations on an
+// EGLNativeWindowType for the D3D renderers.
+
+#ifndef LIBANGLE_RENDERER_D3D_NATIVEWINDOWD3D_H_
+#define LIBANGLE_RENDERER_D3D_NATIVEWINDOWD3D_H_
+
+#include "common/debug.h"
+#include "common/platform.h"
+
+#include <EGL/eglplatform.h>
+#include "libANGLE/Config.h"
+
+namespace rx
+{
+class NativeWindowD3D : angle::NonCopyable
+{
+ public:
+ NativeWindowD3D(EGLNativeWindowType window);
+ virtual ~NativeWindowD3D();
+
+ virtual bool initialize() = 0;
+ virtual bool getClientRect(LPRECT rect) const = 0;
+ virtual bool isIconic() const = 0;
+
+ inline EGLNativeWindowType getNativeWindow() const { return mWindow; }
+
+ private:
+ EGLNativeWindowType mWindow;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_NATIVEWINDOWD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp
new file mode 100644
index 0000000000..753518d855
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -0,0 +1,3206 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramD3D.cpp: Defines the rx::ProgramD3D class which implements rx::ProgramImpl.
+
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+
+#include "common/MemoryBuffer.h"
+#include "common/bitset_utils.h"
+#include "common/string_utils.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/ProgramLinkedResources.h"
+#include "libANGLE/Uniform.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/features.h"
+#include "libANGLE/queryconversions.h"
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+#include "libANGLE/renderer/d3d/DynamicHLSL.h"
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+#include "libANGLE/renderer/d3d/ShaderExecutableD3D.h"
+#include "libANGLE/renderer/d3d/VertexDataManager.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+using namespace angle;
+
+namespace rx
+{
+
+namespace
+{
+
+void GetDefaultInputLayoutFromShader(gl::Shader *vertexShader, gl::InputLayout *inputLayoutOut)
+{
+ inputLayoutOut->clear();
+
+ for (const sh::Attribute &shaderAttr : vertexShader->getActiveAttributes())
+ {
+ if (shaderAttr.type != GL_NONE)
+ {
+ GLenum transposedType = gl::TransposeMatrixType(shaderAttr.type);
+
+ for (size_t rowIndex = 0;
+ static_cast<int>(rowIndex) < gl::VariableRowCount(transposedType); ++rowIndex)
+ {
+ GLenum componentType = gl::VariableComponentType(transposedType);
+ GLuint components = static_cast<GLuint>(gl::VariableColumnCount(transposedType));
+ bool pureInt = (componentType != GL_FLOAT);
+
+ gl::VertexAttribType attribType =
+ gl::FromGLenum<gl::VertexAttribType>(componentType);
+
+ angle::FormatID defaultID =
+ gl::GetVertexFormatID(attribType, GL_FALSE, components, pureInt);
+
+ inputLayoutOut->push_back(defaultID);
+ }
+ }
+ }
+}
+
+size_t GetMaxOutputIndex(const std::vector<PixelShaderOutputVariable> &shaderOutputVars,
+ size_t location)
+{
+ size_t maxIndex = 0;
+ for (auto &outputVar : shaderOutputVars)
+ {
+ if (outputVar.outputLocation == location)
+ {
+ maxIndex = std::max(maxIndex, outputVar.outputIndex);
+ }
+ }
+ return maxIndex;
+}
+
+void GetDefaultOutputLayoutFromShader(
+ const std::vector<PixelShaderOutputVariable> &shaderOutputVars,
+ std::vector<GLenum> *outputLayoutOut)
+{
+ outputLayoutOut->clear();
+
+ if (!shaderOutputVars.empty())
+ {
+ size_t location = shaderOutputVars[0].outputLocation;
+ size_t maxIndex = GetMaxOutputIndex(shaderOutputVars, location);
+ outputLayoutOut->assign(maxIndex + 1,
+ GL_COLOR_ATTACHMENT0 + static_cast<unsigned int>(location));
+ }
+}
+
+void GetDefaultImage2DBindLayoutFromComputeShader(const std::vector<sh::Uniform> &image2DUniforms,
+ gl::ImageUnitTextureTypeMap *image2DBindLayout)
+{
+ image2DBindLayout->clear();
+
+ for (const sh::Uniform &image2D : image2DUniforms)
+ {
+ if (gl::IsImage2DType(image2D.type))
+ {
+ if (image2D.binding == -1)
+ {
+ image2DBindLayout->insert(std::make_pair(0, gl::TextureType::_2D));
+ }
+ else
+ {
+ for (unsigned int index = 0; index < image2D.getArraySizeProduct(); index++)
+ {
+ image2DBindLayout->insert(
+ std::make_pair(image2D.binding + index, gl::TextureType::_2D));
+ }
+ }
+ }
+ }
+}
+
+gl::PrimitiveMode GetGeometryShaderTypeFromDrawMode(gl::PrimitiveMode drawMode)
+{
+ switch (drawMode)
+ {
+ // Uses the point sprite geometry shader.
+ case gl::PrimitiveMode::Points:
+ return gl::PrimitiveMode::Points;
+
+ // All line drawing uses the same geometry shader.
+ case gl::PrimitiveMode::Lines:
+ case gl::PrimitiveMode::LineStrip:
+ case gl::PrimitiveMode::LineLoop:
+ return gl::PrimitiveMode::Lines;
+
+ // The triangle fan primitive is emulated with strips in D3D11.
+ case gl::PrimitiveMode::Triangles:
+ case gl::PrimitiveMode::TriangleFan:
+ return gl::PrimitiveMode::Triangles;
+
+ // Special case for triangle strips.
+ case gl::PrimitiveMode::TriangleStrip:
+ return gl::PrimitiveMode::TriangleStrip;
+
+ default:
+ UNREACHABLE();
+ return gl::PrimitiveMode::InvalidEnum;
+ }
+}
+
+bool HasFlatInterpolationVarying(const std::vector<sh::Varying> &varyings)
+{
+ // Note: this assumes nested structs can only be packed with one interpolation.
+ for (const auto &varying : varyings)
+ {
+ if (varying.interpolation == sh::INTERPOLATION_FLAT)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool FindFlatInterpolationVaryingPerShader(gl::Shader *shader)
+{
+ ASSERT(shader);
+ switch (shader->getType())
+ {
+ case gl::ShaderType::Vertex:
+ return HasFlatInterpolationVarying(shader->getOutputVaryings());
+ case gl::ShaderType::Fragment:
+ return HasFlatInterpolationVarying(shader->getInputVaryings());
+ case gl::ShaderType::Geometry:
+ return HasFlatInterpolationVarying(shader->getInputVaryings()) ||
+ HasFlatInterpolationVarying(shader->getOutputVaryings());
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool FindFlatInterpolationVarying(const gl::ShaderMap<gl::Shader *> &shaders)
+{
+ for (gl::ShaderType shaderType : gl::kAllGraphicsShaderTypes)
+ {
+ gl::Shader *shader = shaders[shaderType];
+ if (!shader)
+ {
+ continue;
+ }
+
+ if (FindFlatInterpolationVaryingPerShader(shader))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Helper class that gathers uniform info from the default uniform block.
+class UniformEncodingVisitorD3D : public sh::BlockEncoderVisitor
+{
+ public:
+ UniformEncodingVisitorD3D(gl::ShaderType shaderType,
+ HLSLRegisterType registerType,
+ sh::BlockLayoutEncoder *encoder,
+ D3DUniformMap *uniformMapOut)
+ : sh::BlockEncoderVisitor("", "", encoder),
+ mShaderType(shaderType),
+ mRegisterType(registerType),
+ mUniformMapOut(uniformMapOut)
+ {}
+
+ void visitNamedSampler(const sh::ShaderVariable &sampler,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ auto uniformMapEntry = mUniformMapOut->find(name);
+ if (uniformMapEntry == mUniformMapOut->end())
+ {
+ (*mUniformMapOut)[name] =
+ new D3DUniform(sampler.type, mRegisterType, name, sampler.arraySizes, true);
+ }
+ }
+
+ void encodeVariable(const sh::ShaderVariable &variable,
+ const sh::BlockMemberInfo &variableInfo,
+ const std::string &name,
+ const std::string &mappedName) override
+ {
+ auto uniformMapEntry = mUniformMapOut->find(name);
+ D3DUniform *d3dUniform = nullptr;
+
+ if (uniformMapEntry != mUniformMapOut->end())
+ {
+ d3dUniform = uniformMapEntry->second;
+ }
+ else
+ {
+ d3dUniform =
+ new D3DUniform(variable.type, mRegisterType, name, variable.arraySizes, true);
+ (*mUniformMapOut)[name] = d3dUniform;
+ }
+
+ d3dUniform->registerElement = static_cast<unsigned int>(
+ sh::BlockLayoutEncoder::GetBlockRegisterElement(variableInfo));
+ unsigned int reg =
+ static_cast<unsigned int>(sh::BlockLayoutEncoder::GetBlockRegister(variableInfo));
+
+ ASSERT(mShaderType != gl::ShaderType::InvalidEnum);
+ d3dUniform->mShaderRegisterIndexes[mShaderType] = reg;
+ }
+
+ private:
+ gl::ShaderType mShaderType;
+ HLSLRegisterType mRegisterType;
+ D3DUniformMap *mUniformMapOut;
+};
+
+class HLSLBlockLayoutEncoderFactory : public gl::CustomBlockLayoutEncoderFactory
+{
+ public:
+ sh::BlockLayoutEncoder *makeEncoder() override
+ {
+ return new sh::HLSLBlockEncoder(sh::HLSLBlockEncoder::ENCODE_PACKED, false);
+ }
+};
+} // anonymous namespace
+
+// D3DUniform Implementation
+
+D3DUniform::D3DUniform(GLenum type,
+ HLSLRegisterType reg,
+ const std::string &nameIn,
+ const std::vector<unsigned int> &arraySizesIn,
+ bool defaultBlock)
+ : typeInfo(gl::GetUniformTypeInfo(type)),
+ name(nameIn),
+ arraySizes(arraySizesIn),
+ mShaderData({}),
+ regType(reg),
+ registerCount(0),
+ registerElement(0)
+{
+ mShaderRegisterIndexes.fill(GL_INVALID_INDEX);
+
+ // 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 (defaultBlock)
+ {
+ // Use the row count as register count, will work for non-square matrices.
+ registerCount = typeInfo.rowCount * getArraySizeProduct();
+ }
+}
+
+D3DUniform::~D3DUniform() {}
+
+unsigned int D3DUniform::getArraySizeProduct() const
+{
+ return gl::ArraySizeProduct(arraySizes);
+}
+
+const uint8_t *D3DUniform::getDataPtrToElement(size_t elementIndex) const
+{
+ ASSERT((!isArray() && elementIndex == 0) ||
+ (isArray() && elementIndex < getArraySizeProduct()));
+
+ if (isSampler())
+ {
+ return reinterpret_cast<const uint8_t *>(&mSamplerData[elementIndex]);
+ }
+
+ return firstNonNullData() + (elementIndex > 0 ? (typeInfo.internalSize * elementIndex) : 0u);
+}
+
+bool D3DUniform::isSampler() const
+{
+ return typeInfo.isSampler;
+}
+
+bool D3DUniform::isImage() const
+{
+ return typeInfo.isImageType;
+}
+
+bool D3DUniform::isImage2D() const
+{
+ return gl::IsImage2DType(typeInfo.type);
+}
+
+bool D3DUniform::isReferencedByShader(gl::ShaderType shaderType) const
+{
+ return mShaderRegisterIndexes[shaderType] != GL_INVALID_INDEX;
+}
+
+const uint8_t *D3DUniform::firstNonNullData() const
+{
+ if (!mSamplerData.empty())
+ {
+ return reinterpret_cast<const uint8_t *>(mSamplerData.data());
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (mShaderData[shaderType])
+ {
+ return mShaderData[shaderType];
+ }
+ }
+
+ UNREACHABLE();
+ return nullptr;
+}
+
+// D3DInterfaceBlock Implementation
+D3DInterfaceBlock::D3DInterfaceBlock()
+{
+ mShaderRegisterIndexes.fill(GL_INVALID_INDEX);
+}
+
+D3DInterfaceBlock::D3DInterfaceBlock(const D3DInterfaceBlock &other) = default;
+
+// D3DVarying Implementation
+
+D3DVarying::D3DVarying() : semanticIndex(0), componentCount(0), outputSlot(0) {}
+
+D3DVarying::D3DVarying(const std::string &semanticNameIn,
+ unsigned int semanticIndexIn,
+ unsigned int componentCountIn,
+ unsigned int outputSlotIn)
+ : semanticName(semanticNameIn),
+ semanticIndex(semanticIndexIn),
+ componentCount(componentCountIn),
+ outputSlot(outputSlotIn)
+{}
+
+// ProgramD3DMetadata Implementation
+
+ProgramD3DMetadata::ProgramD3DMetadata(RendererD3D *renderer,
+ const gl::ShaderMap<const ShaderD3D *> &attachedShaders)
+ : mRendererMajorShaderModel(renderer->getMajorShaderModel()),
+ mShaderModelSuffix(renderer->getShaderModelSuffix()),
+ mUsesInstancedPointSpriteEmulation(
+ renderer->getFeatures().useInstancedPointSpriteEmulation.enabled),
+ mUsesViewScale(renderer->presentPathFastEnabled()),
+ mCanSelectViewInVertexShader(renderer->canSelectViewInVertexShader()),
+ mAttachedShaders(attachedShaders)
+{}
+
+ProgramD3DMetadata::~ProgramD3DMetadata() = default;
+
+int ProgramD3DMetadata::getRendererMajorShaderModel() const
+{
+ return mRendererMajorShaderModel;
+}
+
+bool ProgramD3DMetadata::usesBroadcast(const gl::State &data) const
+{
+ return (mAttachedShaders[gl::ShaderType::Fragment]->usesFragColor() &&
+ mAttachedShaders[gl::ShaderType::Fragment]->usesMultipleRenderTargets() &&
+ data.getClientMajorVersion() < 3);
+}
+
+bool ProgramD3DMetadata::usesSecondaryColor() const
+{
+ return mAttachedShaders[gl::ShaderType::Fragment]->usesSecondaryColor();
+}
+
+bool ProgramD3DMetadata::usesFragDepth() const
+{
+ return mAttachedShaders[gl::ShaderType::Fragment]->usesFragDepth();
+}
+
+bool ProgramD3DMetadata::usesPointCoord() const
+{
+ return mAttachedShaders[gl::ShaderType::Fragment]->usesPointCoord();
+}
+
+bool ProgramD3DMetadata::usesFragCoord() const
+{
+ return mAttachedShaders[gl::ShaderType::Fragment]->usesFragCoord();
+}
+
+bool ProgramD3DMetadata::usesPointSize() const
+{
+ return mAttachedShaders[gl::ShaderType::Vertex]->usesPointSize();
+}
+
+bool ProgramD3DMetadata::usesInsertedPointCoordValue() const
+{
+ return (!usesPointSize() || !mUsesInstancedPointSpriteEmulation) && usesPointCoord() &&
+ mRendererMajorShaderModel >= 4;
+}
+
+bool ProgramD3DMetadata::usesViewScale() const
+{
+ return mUsesViewScale;
+}
+
+bool ProgramD3DMetadata::hasANGLEMultiviewEnabled() const
+{
+ return mAttachedShaders[gl::ShaderType::Vertex]->hasANGLEMultiviewEnabled();
+}
+
+bool ProgramD3DMetadata::usesVertexID() const
+{
+ return mAttachedShaders[gl::ShaderType::Vertex]->usesVertexID();
+}
+
+bool ProgramD3DMetadata::usesViewID() const
+{
+ return mAttachedShaders[gl::ShaderType::Fragment]->usesViewID();
+}
+
+bool ProgramD3DMetadata::canSelectViewInVertexShader() const
+{
+ return mCanSelectViewInVertexShader;
+}
+
+bool ProgramD3DMetadata::addsPointCoordToVertexShader() const
+{
+ // PointSprite emulation requiress that gl_PointCoord is present in the vertex shader
+ // VS_OUTPUT structure to ensure compatibility with the generated PS_INPUT of the pixel shader.
+ // Even with a geometry shader, the app can render triangles or lines and reference
+ // gl_PointCoord in the fragment shader, requiring us to provide a dummy value. For
+ // simplicity, we always add this to the vertex shader when the fragment shader
+ // references gl_PointCoord, even if we could skip it in the geometry shader.
+ return (mUsesInstancedPointSpriteEmulation && usesPointCoord()) ||
+ usesInsertedPointCoordValue();
+}
+
+bool ProgramD3DMetadata::usesTransformFeedbackGLPosition() const
+{
+ // gl_Position only needs to be outputted from the vertex shader if transform feedback is
+ // active. This isn't supported on D3D11 Feature Level 9_3, so we don't output gl_Position from
+ // the vertex shader in this case. This saves us 1 output vector.
+ return !(mRendererMajorShaderModel >= 4 && mShaderModelSuffix != "");
+}
+
+bool ProgramD3DMetadata::usesSystemValuePointSize() const
+{
+ return !mUsesInstancedPointSpriteEmulation && usesPointSize();
+}
+
+bool ProgramD3DMetadata::usesMultipleFragmentOuts() const
+{
+ return mAttachedShaders[gl::ShaderType::Fragment]->usesMultipleRenderTargets();
+}
+
+GLint ProgramD3DMetadata::getMajorShaderVersion() const
+{
+ return mAttachedShaders[gl::ShaderType::Vertex]->getData().getShaderVersion();
+}
+
+const ShaderD3D *ProgramD3DMetadata::getFragmentShader() const
+{
+ return mAttachedShaders[gl::ShaderType::Fragment];
+}
+
+// ProgramD3D::GetExecutableTask class
+class ProgramD3D::GetExecutableTask : public Closure, public d3d::Context
+{
+ public:
+ GetExecutableTask(ProgramD3D *program) : mProgram(program) {}
+
+ virtual angle::Result run() = 0;
+
+ void operator()() override { mResult = run(); }
+
+ angle::Result getResult() const { return mResult; }
+ const gl::InfoLog &getInfoLog() const { return mInfoLog; }
+ ShaderExecutableD3D *getExecutable() { return mExecutable; }
+
+ void handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line) override
+ {
+ mStoredHR = hr;
+ mStoredMessage = message;
+ mStoredFile = file;
+ mStoredFunction = function;
+ mStoredLine = line;
+ }
+
+ void popError(d3d::Context *context)
+ {
+ ASSERT(mStoredFile);
+ ASSERT(mStoredFunction);
+ context->handleResult(mStoredHR, mStoredMessage.c_str(), mStoredFile, mStoredFunction,
+ mStoredLine);
+ }
+
+ protected:
+ ProgramD3D *mProgram = nullptr;
+ angle::Result mResult = angle::Result::Continue;
+ gl::InfoLog mInfoLog;
+ ShaderExecutableD3D *mExecutable = nullptr;
+ HRESULT mStoredHR = S_OK;
+ std::string mStoredMessage;
+ const char *mStoredFile = nullptr;
+ const char *mStoredFunction = nullptr;
+ unsigned int mStoredLine = 0;
+};
+
+// ProgramD3D Implementation
+
+ProgramD3D::VertexExecutable::VertexExecutable(const gl::InputLayout &inputLayout,
+ const Signature &signature,
+ ShaderExecutableD3D *shaderExecutable)
+ : mInputs(inputLayout), mSignature(signature), mShaderExecutable(shaderExecutable)
+{}
+
+ProgramD3D::VertexExecutable::~VertexExecutable()
+{
+ SafeDelete(mShaderExecutable);
+}
+
+// static
+ProgramD3D::VertexExecutable::HLSLAttribType ProgramD3D::VertexExecutable::GetAttribType(
+ GLenum type)
+{
+ switch (type)
+ {
+ case GL_INT:
+ return HLSLAttribType::SIGNED_INT;
+ case GL_UNSIGNED_INT:
+ return HLSLAttribType::UNSIGNED_INT;
+ case GL_SIGNED_NORMALIZED:
+ case GL_UNSIGNED_NORMALIZED:
+ case GL_FLOAT:
+ return HLSLAttribType::FLOAT;
+ default:
+ UNREACHABLE();
+ return HLSLAttribType::FLOAT;
+ }
+}
+
+// static
+void ProgramD3D::VertexExecutable::getSignature(RendererD3D *renderer,
+ const gl::InputLayout &inputLayout,
+ Signature *signatureOut)
+{
+ signatureOut->assign(inputLayout.size(), HLSLAttribType::FLOAT);
+
+ for (size_t index = 0; index < inputLayout.size(); ++index)
+ {
+ angle::FormatID vertexFormatID = inputLayout[index];
+ if (vertexFormatID == angle::FormatID::NONE)
+ continue;
+
+ VertexConversionType conversionType = renderer->getVertexConversionType(vertexFormatID);
+ if ((conversionType & VERTEX_CONVERT_GPU) == 0)
+ continue;
+
+ GLenum componentType = renderer->getVertexComponentType(vertexFormatID);
+ (*signatureOut)[index] = GetAttribType(componentType);
+ }
+}
+
+bool ProgramD3D::VertexExecutable::matchesSignature(const Signature &signature) const
+{
+ size_t limit = std::max(mSignature.size(), signature.size());
+ for (size_t index = 0; index < limit; ++index)
+ {
+ // treat undefined indexes as FLOAT
+ auto a = index < signature.size() ? signature[index] : HLSLAttribType::FLOAT;
+ auto b = index < mSignature.size() ? mSignature[index] : HLSLAttribType::FLOAT;
+ if (a != b)
+ return false;
+ }
+
+ return true;
+}
+
+ProgramD3D::PixelExecutable::PixelExecutable(const std::vector<GLenum> &outputSignature,
+ ShaderExecutableD3D *shaderExecutable)
+ : mOutputSignature(outputSignature), mShaderExecutable(shaderExecutable)
+{}
+
+ProgramD3D::PixelExecutable::~PixelExecutable()
+{
+ SafeDelete(mShaderExecutable);
+}
+
+ProgramD3D::ComputeExecutable::ComputeExecutable(
+ const gl::ImageUnitTextureTypeMap &signature,
+ std::unique_ptr<ShaderExecutableD3D> shaderExecutable)
+ : mSignature(signature), mShaderExecutable(std::move(shaderExecutable))
+{}
+
+ProgramD3D::ComputeExecutable::~ComputeExecutable() {}
+
+ProgramD3D::Sampler::Sampler()
+ : active(false), logicalTextureUnit(0), textureType(gl::TextureType::_2D)
+{}
+
+ProgramD3D::Image::Image() : active(false), logicalImageUnit(0) {}
+
+unsigned int ProgramD3D::mCurrentSerial = 1;
+
+ProgramD3D::ProgramD3D(const gl::ProgramState &state, RendererD3D *renderer)
+ : ProgramImpl(state),
+ mRenderer(renderer),
+ mDynamicHLSL(nullptr),
+ mUsesPointSize(false),
+ mUsesFlatInterpolation(false),
+ mUsedShaderSamplerRanges({}),
+ mDirtySamplerMapping(true),
+ mUsedComputeImageRange(0, 0),
+ mUsedComputeReadonlyImageRange(0, 0),
+ mUsedComputeAtomicCounterRange(0, 0),
+ mSerial(issueSerial())
+{
+ mDynamicHLSL = new DynamicHLSL(renderer);
+}
+
+ProgramD3D::~ProgramD3D()
+{
+ reset();
+ SafeDelete(mDynamicHLSL);
+}
+
+bool ProgramD3D::usesPointSpriteEmulation() const
+{
+ return mUsesPointSize && mRenderer->getMajorShaderModel() >= 4;
+}
+
+bool ProgramD3D::usesGeometryShaderForPointSpriteEmulation() const
+{
+ return usesPointSpriteEmulation() && !usesInstancedPointSpriteEmulation();
+}
+
+bool ProgramD3D::usesGetDimensionsIgnoresBaseLevel() const
+{
+ return mRenderer->getFeatures().getDimensionsIgnoresBaseLevel.enabled;
+}
+
+bool ProgramD3D::usesGeometryShader(const gl::State &state, const gl::PrimitiveMode drawMode) const
+{
+ if (mHasANGLEMultiviewEnabled && !mRenderer->canSelectViewInVertexShader())
+ {
+ return true;
+ }
+ if (drawMode != gl::PrimitiveMode::Points)
+ {
+ if (!mUsesFlatInterpolation)
+ {
+ return false;
+ }
+ return state.getProvokingVertex() == gl::ProvokingVertexConvention::LastVertexConvention;
+ }
+ return usesGeometryShaderForPointSpriteEmulation();
+}
+
+bool ProgramD3D::usesInstancedPointSpriteEmulation() const
+{
+ return mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled;
+}
+
+GLint ProgramD3D::getSamplerMapping(gl::ShaderType type,
+ unsigned int samplerIndex,
+ const gl::Caps &caps) const
+{
+ GLint logicalTextureUnit = -1;
+
+ ASSERT(type != gl::ShaderType::InvalidEnum);
+
+ ASSERT(samplerIndex < caps.maxShaderTextureImageUnits[type]);
+
+ const auto &samplers = mShaderSamplers[type];
+ if (samplerIndex < samplers.size() && samplers[samplerIndex].active)
+ {
+ logicalTextureUnit = samplers[samplerIndex].logicalTextureUnit;
+ }
+
+ if (logicalTextureUnit >= 0 &&
+ logicalTextureUnit < static_cast<GLint>(caps.maxCombinedTextureImageUnits))
+ {
+ return logicalTextureUnit;
+ }
+
+ return -1;
+}
+
+// Returns the texture type for a given Direct3D 9 sampler type and
+// index (0-15 for the pixel shader and 0-3 for the vertex shader).
+gl::TextureType ProgramD3D::getSamplerTextureType(gl::ShaderType type,
+ unsigned int samplerIndex) const
+{
+ ASSERT(type != gl::ShaderType::InvalidEnum);
+
+ const auto &samplers = mShaderSamplers[type];
+ ASSERT(samplerIndex < samplers.size());
+ ASSERT(samplers[samplerIndex].active);
+
+ return samplers[samplerIndex].textureType;
+}
+
+gl::RangeUI ProgramD3D::getUsedSamplerRange(gl::ShaderType type) const
+{
+ ASSERT(type != gl::ShaderType::InvalidEnum);
+ return mUsedShaderSamplerRanges[type];
+}
+
+ProgramD3D::SamplerMapping ProgramD3D::updateSamplerMapping()
+{
+ if (!mDirtySamplerMapping)
+ {
+ return SamplerMapping::WasClean;
+ }
+
+ mDirtySamplerMapping = false;
+
+ // Retrieve sampler uniform values
+ for (const D3DUniform *d3dUniform : mD3DUniforms)
+ {
+ if (!d3dUniform->isSampler())
+ continue;
+
+ int count = d3dUniform->getArraySizeProduct();
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (!d3dUniform->isReferencedByShader(shaderType))
+ {
+ continue;
+ }
+
+ unsigned int firstIndex = d3dUniform->mShaderRegisterIndexes[shaderType];
+
+ std::vector<Sampler> &samplers = mShaderSamplers[shaderType];
+ for (int i = 0; i < count; i++)
+ {
+ unsigned int samplerIndex = firstIndex + i;
+
+ if (samplerIndex < samplers.size())
+ {
+ ASSERT(samplers[samplerIndex].active);
+ samplers[samplerIndex].logicalTextureUnit = d3dUniform->mSamplerData[i];
+ }
+ }
+ }
+ }
+
+ return SamplerMapping::WasDirty;
+}
+
+GLint ProgramD3D::getImageMapping(gl::ShaderType type,
+ unsigned int imageIndex,
+ bool readonly,
+ const gl::Caps &caps) const
+{
+ GLint logicalImageUnit = -1;
+ ASSERT(imageIndex < caps.maxImageUnits);
+ switch (type)
+ {
+ case gl::ShaderType::Compute:
+ if (readonly && imageIndex < mReadonlyImagesCS.size() &&
+ mReadonlyImagesCS[imageIndex].active)
+ {
+ logicalImageUnit = mReadonlyImagesCS[imageIndex].logicalImageUnit;
+ }
+ else if (imageIndex < mImagesCS.size() && mImagesCS[imageIndex].active)
+ {
+ logicalImageUnit = mImagesCS[imageIndex].logicalImageUnit;
+ }
+ break;
+ // TODO(xinghua.cao@intel.com): add image mapping for vertex shader and pixel shader.
+ default:
+ UNREACHABLE();
+ }
+
+ if (logicalImageUnit >= 0 && logicalImageUnit < static_cast<GLint>(caps.maxImageUnits))
+ {
+ return logicalImageUnit;
+ }
+
+ return -1;
+}
+
+gl::RangeUI ProgramD3D::getUsedImageRange(gl::ShaderType type, bool readonly) const
+{
+ switch (type)
+ {
+ case gl::ShaderType::Compute:
+ return readonly ? mUsedComputeReadonlyImageRange : mUsedComputeImageRange;
+ // TODO(xinghua.cao@intel.com): add real image range of vertex shader and pixel shader.
+ case gl::ShaderType::Vertex:
+ case gl::ShaderType::Fragment:
+ return {0, 0};
+ default:
+ UNREACHABLE();
+ return {0, 0};
+ }
+}
+
+class ProgramD3D::LoadBinaryTask : public ProgramD3D::GetExecutableTask
+{
+ public:
+ LoadBinaryTask(ProgramD3D *program, gl::BinaryInputStream *stream, gl::InfoLog &infoLog)
+ : ProgramD3D::GetExecutableTask(program), mProgram(program), mInfoLog(infoLog)
+ {
+ ASSERT(mProgram);
+ ASSERT(stream);
+
+ // Copy the remaining data from the stream locally so that the client can't modify it when
+ // loading off thread.
+ size_t dataSize = stream->remainingSize();
+ mDataCopySucceeded = mStreamData.resize(dataSize);
+ if (mDataCopySucceeded)
+ {
+ memcpy(mStreamData.data(), stream->data() + stream->offset(), dataSize);
+ }
+ }
+
+ angle::Result run() override
+ {
+ if (!mDataCopySucceeded)
+ {
+ mInfoLog << "Failed to copy program binary data to local buffer.";
+ return angle::Result::Incomplete;
+ }
+
+ gl::BinaryInputStream stream(mStreamData.data(), mStreamData.size());
+ return mProgram->loadBinaryShaderExecutables(this, &stream, mInfoLog);
+ }
+
+ private:
+ ProgramD3D *mProgram;
+ gl::InfoLog &mInfoLog;
+
+ bool mDataCopySucceeded;
+ angle::MemoryBuffer mStreamData;
+};
+
+class ProgramD3D::LoadBinaryLinkEvent final : public LinkEvent
+{
+ public:
+ LoadBinaryLinkEvent(std::shared_ptr<WorkerThreadPool> workerPool,
+ ProgramD3D *program,
+ gl::BinaryInputStream *stream,
+ gl::InfoLog &infoLog)
+ : mTask(std::make_shared<ProgramD3D::LoadBinaryTask>(program, stream, infoLog)),
+ mWaitableEvent(angle::WorkerThreadPool::PostWorkerTask(workerPool, mTask))
+ {}
+
+ angle::Result wait(const gl::Context *context) override
+ {
+ mWaitableEvent->wait();
+
+ // Continue and Incomplete are not errors. For Stop, pass the error to the ContextD3D.
+ if (mTask->getResult() != angle::Result::Stop)
+ {
+ return angle::Result::Continue;
+ }
+
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+ mTask->popError(contextD3D);
+ return angle::Result::Stop;
+ }
+
+ bool isLinking() override { return !mWaitableEvent->isReady(); }
+
+ private:
+ std::shared_ptr<ProgramD3D::LoadBinaryTask> mTask;
+ std::shared_ptr<WaitableEvent> mWaitableEvent;
+};
+
+std::unique_ptr<rx::LinkEvent> ProgramD3D::load(const gl::Context *context,
+ gl::BinaryInputStream *stream,
+ gl::InfoLog &infoLog)
+{
+
+ // TODO(jmadill): Use Renderer from contextImpl.
+
+ reset();
+
+ DeviceIdentifier binaryDeviceIdentifier = {0};
+ stream->readBytes(reinterpret_cast<unsigned char *>(&binaryDeviceIdentifier),
+ sizeof(DeviceIdentifier));
+
+ DeviceIdentifier identifier = mRenderer->getAdapterIdentifier();
+ if (memcmp(&identifier, &binaryDeviceIdentifier, sizeof(DeviceIdentifier)) != 0)
+ {
+ infoLog << "Invalid program binary, device configuration has changed.";
+ return std::make_unique<LinkEventDone>(angle::Result::Incomplete);
+ }
+
+ int compileFlags = stream->readInt<int>();
+ if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+ {
+ infoLog << "Mismatched compilation flags.";
+ return std::make_unique<LinkEventDone>(angle::Result::Incomplete);
+ }
+
+ for (int &index : mAttribLocationToD3DSemantic)
+ {
+ stream->readInt(&index);
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ const unsigned int samplerCount = stream->readInt<unsigned int>();
+ for (unsigned int i = 0; i < samplerCount; ++i)
+ {
+ Sampler sampler;
+ stream->readBool(&sampler.active);
+ stream->readInt(&sampler.logicalTextureUnit);
+ stream->readEnum(&sampler.textureType);
+ mShaderSamplers[shaderType].push_back(sampler);
+ }
+
+ unsigned int samplerRangeLow, samplerRangeHigh;
+ stream->readInt(&samplerRangeLow);
+ stream->readInt(&samplerRangeHigh);
+ mUsedShaderSamplerRanges[shaderType] = gl::RangeUI(samplerRangeLow, samplerRangeHigh);
+ }
+
+ const unsigned int csImageCount = stream->readInt<unsigned int>();
+ for (unsigned int i = 0; i < csImageCount; ++i)
+ {
+ Image image;
+ stream->readBool(&image.active);
+ stream->readInt(&image.logicalImageUnit);
+ mImagesCS.push_back(image);
+ }
+
+ const unsigned int csReadonlyImageCount = stream->readInt<unsigned int>();
+ for (unsigned int i = 0; i < csReadonlyImageCount; ++i)
+ {
+ Image image;
+ stream->readBool(&image.active);
+ stream->readInt(&image.logicalImageUnit);
+ mReadonlyImagesCS.push_back(image);
+ }
+
+ unsigned int computeImageRangeLow, computeImageRangeHigh, computeReadonlyImageRangeLow,
+ computeReadonlyImageRangeHigh;
+ stream->readInt(&computeImageRangeLow);
+ stream->readInt(&computeImageRangeHigh);
+ stream->readInt(&computeReadonlyImageRangeLow);
+ stream->readInt(&computeReadonlyImageRangeHigh);
+ mUsedComputeImageRange = gl::RangeUI(computeImageRangeLow, computeImageRangeHigh);
+ mUsedComputeReadonlyImageRange =
+ gl::RangeUI(computeReadonlyImageRangeLow, computeReadonlyImageRangeHigh);
+
+ unsigned int atomicCounterRangeLow, atomicCounterRangeHigh;
+ stream->readInt(&atomicCounterRangeLow);
+ stream->readInt(&atomicCounterRangeHigh);
+ mUsedComputeAtomicCounterRange = gl::RangeUI(atomicCounterRangeLow, atomicCounterRangeHigh);
+
+ const unsigned int shaderStorageBlockCount = stream->readInt<unsigned int>();
+ if (stream->error())
+ {
+ infoLog << "Invalid program binary.";
+ return std::make_unique<LinkEventDone>(angle::Result::Incomplete);
+ }
+
+ ASSERT(mD3DShaderStorageBlocks.empty());
+ for (unsigned int blockIndex = 0; blockIndex < shaderStorageBlockCount; ++blockIndex)
+ {
+ D3DInterfaceBlock shaderStorageBlock;
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->readInt(&shaderStorageBlock.mShaderRegisterIndexes[shaderType]);
+ }
+ mD3DShaderStorageBlocks.push_back(shaderStorageBlock);
+ }
+
+ for (unsigned int ii = 0; ii < gl::IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS; ++ii)
+ {
+ unsigned int index = stream->readInt<unsigned int>();
+ mComputeAtomicCounterBufferRegisterIndices[ii] = index;
+ }
+
+ const unsigned int uniformCount = stream->readInt<unsigned int>();
+ if (stream->error())
+ {
+ infoLog << "Invalid program binary.";
+ return std::make_unique<LinkEventDone>(angle::Result::Incomplete);
+ }
+
+ const auto &linkedUniforms = mState.getUniforms();
+ ASSERT(mD3DUniforms.empty());
+ for (unsigned int uniformIndex = 0; uniformIndex < uniformCount; uniformIndex++)
+ {
+ const gl::LinkedUniform &linkedUniform = linkedUniforms[uniformIndex];
+
+ D3DUniform *d3dUniform =
+ new D3DUniform(linkedUniform.type, HLSLRegisterType::None, linkedUniform.name,
+ linkedUniform.arraySizes, linkedUniform.isInDefaultBlock());
+ stream->readInt<HLSLRegisterType>(&d3dUniform->regType);
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->readInt(&d3dUniform->mShaderRegisterIndexes[shaderType]);
+ }
+ stream->readInt(&d3dUniform->registerCount);
+ stream->readInt(&d3dUniform->registerElement);
+
+ mD3DUniforms.push_back(d3dUniform);
+ }
+
+ const unsigned int blockCount = stream->readInt<unsigned int>();
+ if (stream->error())
+ {
+ infoLog << "Invalid program binary.";
+ return std::make_unique<LinkEventDone>(angle::Result::Incomplete);
+ }
+
+ ASSERT(mD3DUniformBlocks.empty());
+ for (unsigned int blockIndex = 0; blockIndex < blockCount; ++blockIndex)
+ {
+ D3DInterfaceBlock uniformBlock;
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->readInt(&uniformBlock.mShaderRegisterIndexes[shaderType]);
+ }
+ mD3DUniformBlocks.push_back(uniformBlock);
+ }
+
+ const unsigned int streamOutVaryingCount = stream->readInt<unsigned int>();
+ mStreamOutVaryings.resize(streamOutVaryingCount);
+ for (unsigned int varyingIndex = 0; varyingIndex < streamOutVaryingCount; ++varyingIndex)
+ {
+ D3DVarying *varying = &mStreamOutVaryings[varyingIndex];
+
+ stream->readString(&varying->semanticName);
+ stream->readInt(&varying->semanticIndex);
+ stream->readInt(&varying->componentCount);
+ stream->readInt(&varying->outputSlot);
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->readString(&mShaderHLSL[shaderType]);
+ stream->readBytes(reinterpret_cast<unsigned char *>(&mShaderWorkarounds[shaderType]),
+ sizeof(angle::CompilerWorkaroundsD3D));
+ }
+
+ stream->readBool(&mUsesFragDepth);
+ stream->readBool(&mHasANGLEMultiviewEnabled);
+ stream->readBool(&mUsesVertexID);
+ stream->readBool(&mUsesViewID);
+ stream->readBool(&mUsesPointSize);
+ stream->readBool(&mUsesFlatInterpolation);
+
+ const size_t pixelShaderKeySize = stream->readInt<unsigned int>();
+ mPixelShaderKey.resize(pixelShaderKeySize);
+ for (size_t pixelShaderKeyIndex = 0; pixelShaderKeyIndex < pixelShaderKeySize;
+ pixelShaderKeyIndex++)
+ {
+ stream->readInt(&mPixelShaderKey[pixelShaderKeyIndex].type);
+ stream->readString(&mPixelShaderKey[pixelShaderKeyIndex].name);
+ stream->readString(&mPixelShaderKey[pixelShaderKeyIndex].source);
+ stream->readInt(&mPixelShaderKey[pixelShaderKeyIndex].outputLocation);
+ stream->readInt(&mPixelShaderKey[pixelShaderKeyIndex].outputIndex);
+ }
+
+ stream->readString(&mGeometryShaderPreamble);
+
+ return std::make_unique<LoadBinaryLinkEvent>(context->getWorkerThreadPool(), this, stream,
+ infoLog);
+}
+
+angle::Result ProgramD3D::loadBinaryShaderExecutables(d3d::Context *contextD3D,
+ gl::BinaryInputStream *stream,
+ gl::InfoLog &infoLog)
+{
+ const unsigned char *binary = reinterpret_cast<const unsigned char *>(stream->data());
+
+ bool separateAttribs = (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS);
+
+ const unsigned int vertexShaderCount = stream->readInt<unsigned int>();
+ for (unsigned int vertexShaderIndex = 0; vertexShaderIndex < vertexShaderCount;
+ vertexShaderIndex++)
+ {
+ size_t inputLayoutSize = stream->readInt<size_t>();
+ gl::InputLayout inputLayout(inputLayoutSize, angle::FormatID::NONE);
+
+ for (size_t inputIndex = 0; inputIndex < inputLayoutSize; inputIndex++)
+ {
+ inputLayout[inputIndex] = stream->readInt<angle::FormatID>();
+ }
+
+ unsigned int vertexShaderSize = stream->readInt<unsigned int>();
+ const unsigned char *vertexShaderFunction = binary + stream->offset();
+
+ ShaderExecutableD3D *shaderExecutable = nullptr;
+
+ ANGLE_TRY(mRenderer->loadExecutable(contextD3D, vertexShaderFunction, vertexShaderSize,
+ gl::ShaderType::Vertex, mStreamOutVaryings,
+ separateAttribs, &shaderExecutable));
+
+ if (!shaderExecutable)
+ {
+ infoLog << "Could not create vertex shader.";
+ return angle::Result::Incomplete;
+ }
+
+ // generated converted input layout
+ VertexExecutable::Signature signature;
+ VertexExecutable::getSignature(mRenderer, inputLayout, &signature);
+
+ // add new binary
+ mVertexExecutables.push_back(std::unique_ptr<VertexExecutable>(
+ new VertexExecutable(inputLayout, signature, shaderExecutable)));
+
+ stream->skip(vertexShaderSize);
+ }
+
+ const size_t pixelShaderCount = stream->readInt<unsigned int>();
+ for (size_t pixelShaderIndex = 0; pixelShaderIndex < pixelShaderCount; pixelShaderIndex++)
+ {
+ const size_t outputCount = stream->readInt<unsigned int>();
+ std::vector<GLenum> outputs(outputCount);
+ for (size_t outputIndex = 0; outputIndex < outputCount; outputIndex++)
+ {
+ stream->readInt(&outputs[outputIndex]);
+ }
+
+ const size_t pixelShaderSize = stream->readInt<unsigned int>();
+ const unsigned char *pixelShaderFunction = binary + stream->offset();
+ ShaderExecutableD3D *shaderExecutable = nullptr;
+
+ ANGLE_TRY(mRenderer->loadExecutable(contextD3D, pixelShaderFunction, pixelShaderSize,
+ gl::ShaderType::Fragment, mStreamOutVaryings,
+ separateAttribs, &shaderExecutable));
+
+ if (!shaderExecutable)
+ {
+ infoLog << "Could not create pixel shader.";
+ return angle::Result::Incomplete;
+ }
+
+ // add new binary
+ mPixelExecutables.push_back(
+ std::unique_ptr<PixelExecutable>(new PixelExecutable(outputs, shaderExecutable)));
+
+ stream->skip(pixelShaderSize);
+ }
+
+ for (auto &geometryExe : mGeometryExecutables)
+ {
+ unsigned int geometryShaderSize = stream->readInt<unsigned int>();
+ if (geometryShaderSize == 0)
+ {
+ continue;
+ }
+
+ const unsigned char *geometryShaderFunction = binary + stream->offset();
+
+ ShaderExecutableD3D *geometryExecutable = nullptr;
+ ANGLE_TRY(mRenderer->loadExecutable(contextD3D, geometryShaderFunction, geometryShaderSize,
+ gl::ShaderType::Geometry, mStreamOutVaryings,
+ separateAttribs, &geometryExecutable));
+
+ if (!geometryExecutable)
+ {
+ infoLog << "Could not create geometry shader.";
+ return angle::Result::Incomplete;
+ }
+
+ geometryExe.reset(geometryExecutable);
+
+ stream->skip(geometryShaderSize);
+ }
+
+ const size_t computeShaderCount = stream->readInt<unsigned int>();
+ for (size_t computeShaderIndex = 0; computeShaderIndex < computeShaderCount;
+ computeShaderIndex++)
+ {
+ const size_t signatureCount = stream->readInt<unsigned int>();
+ gl::ImageUnitTextureTypeMap signatures;
+ for (size_t signatureIndex = 0; signatureIndex < signatureCount; signatureIndex++)
+ {
+ unsigned int imageUint;
+ gl::TextureType textureType;
+ stream->readInt<unsigned int>(&imageUint);
+ stream->readInt<gl::TextureType>(&textureType);
+ signatures.insert(std::pair<unsigned int, gl::TextureType>(imageUint, textureType));
+ }
+
+ const size_t computeShaderSize = stream->readInt<unsigned int>();
+ const unsigned char *computeShaderFunction = binary + stream->offset();
+
+ ShaderExecutableD3D *computeExecutable = nullptr;
+ ANGLE_TRY(mRenderer->loadExecutable(contextD3D, computeShaderFunction, computeShaderSize,
+ gl::ShaderType::Compute, std::vector<D3DVarying>(),
+ false, &computeExecutable));
+
+ if (!computeExecutable)
+ {
+ infoLog << "Could not create compute shader.";
+ return angle::Result::Incomplete;
+ }
+
+ // add new binary
+ mComputeExecutables.push_back(std::unique_ptr<ComputeExecutable>(new ComputeExecutable(
+ signatures, std::unique_ptr<ShaderExecutableD3D>(computeExecutable))));
+
+ stream->skip(computeShaderSize);
+ }
+
+ const size_t bindLayoutCount = stream->readInt<unsigned int>();
+ for (size_t bindLayoutIndex = 0; bindLayoutIndex < bindLayoutCount; bindLayoutIndex++)
+ {
+ mComputeShaderImage2DBindLayoutCache.insert(std::pair<unsigned int, gl::TextureType>(
+ stream->readInt<unsigned int>(), gl::TextureType::_2D));
+ }
+
+ initializeUniformStorage(mState.getLinkedShaderStages());
+
+ dirtyAllUniforms();
+
+ return angle::Result::Continue;
+}
+
+void ProgramD3D::save(const gl::Context *context, gl::BinaryOutputStream *stream)
+{
+ // Output the DeviceIdentifier before we output any shader code
+ // When we load the binary again later, we can validate the device identifier before trying to
+ // compile any HLSL
+ DeviceIdentifier binaryIdentifier = mRenderer->getAdapterIdentifier();
+ stream->writeBytes(reinterpret_cast<unsigned char *>(&binaryIdentifier),
+ sizeof(DeviceIdentifier));
+
+ stream->writeInt(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
+
+ for (int d3dSemantic : mAttribLocationToD3DSemantic)
+ {
+ stream->writeInt(d3dSemantic);
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->writeInt(mShaderSamplers[shaderType].size());
+ for (unsigned int i = 0; i < mShaderSamplers[shaderType].size(); ++i)
+ {
+ stream->writeInt(mShaderSamplers[shaderType][i].active);
+ stream->writeInt(mShaderSamplers[shaderType][i].logicalTextureUnit);
+ stream->writeEnum(mShaderSamplers[shaderType][i].textureType);
+ }
+
+ stream->writeInt(mUsedShaderSamplerRanges[shaderType].low());
+ stream->writeInt(mUsedShaderSamplerRanges[shaderType].high());
+ }
+
+ stream->writeInt(mImagesCS.size());
+ for (unsigned int i = 0; i < mImagesCS.size(); ++i)
+ {
+ stream->writeInt(mImagesCS[i].active);
+ stream->writeInt(mImagesCS[i].logicalImageUnit);
+ }
+
+ stream->writeInt(mReadonlyImagesCS.size());
+ for (unsigned int i = 0; i < mReadonlyImagesCS.size(); ++i)
+ {
+ stream->writeInt(mReadonlyImagesCS[i].active);
+ stream->writeInt(mReadonlyImagesCS[i].logicalImageUnit);
+ }
+
+ stream->writeInt(mUsedComputeImageRange.low());
+ stream->writeInt(mUsedComputeImageRange.high());
+ stream->writeInt(mUsedComputeReadonlyImageRange.low());
+ stream->writeInt(mUsedComputeReadonlyImageRange.high());
+ stream->writeInt(mUsedComputeAtomicCounterRange.low());
+ stream->writeInt(mUsedComputeAtomicCounterRange.high());
+
+ stream->writeInt(mD3DShaderStorageBlocks.size());
+ for (const D3DInterfaceBlock &shaderStorageBlock : mD3DShaderStorageBlocks)
+ {
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->writeIntOrNegOne(shaderStorageBlock.mShaderRegisterIndexes[shaderType]);
+ }
+ }
+
+ for (unsigned int ii = 0; ii < gl::IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS; ++ii)
+ {
+ stream->writeInt(mComputeAtomicCounterBufferRegisterIndices[ii]);
+ }
+
+ stream->writeInt(mD3DUniforms.size());
+ for (const D3DUniform *uniform : mD3DUniforms)
+ {
+ // Type, name and arraySize are redundant, so aren't stored in the binary.
+ stream->writeInt(static_cast<unsigned int>(uniform->regType));
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->writeIntOrNegOne(uniform->mShaderRegisterIndexes[shaderType]);
+ }
+ stream->writeInt(uniform->registerCount);
+ stream->writeInt(uniform->registerElement);
+ }
+
+ stream->writeInt(mD3DUniformBlocks.size());
+ for (const D3DInterfaceBlock &uniformBlock : mD3DUniformBlocks)
+ {
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->writeIntOrNegOne(uniformBlock.mShaderRegisterIndexes[shaderType]);
+ }
+ }
+
+ stream->writeInt(mStreamOutVaryings.size());
+ for (const auto &varying : mStreamOutVaryings)
+ {
+ stream->writeString(varying.semanticName);
+ stream->writeInt(varying.semanticIndex);
+ stream->writeInt(varying.componentCount);
+ stream->writeInt(varying.outputSlot);
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ stream->writeString(mShaderHLSL[shaderType]);
+ stream->writeBytes(reinterpret_cast<unsigned char *>(&mShaderWorkarounds[shaderType]),
+ sizeof(angle::CompilerWorkaroundsD3D));
+ }
+
+ stream->writeInt(mUsesFragDepth);
+ stream->writeInt(mHasANGLEMultiviewEnabled);
+ stream->writeInt(mUsesVertexID);
+ stream->writeInt(mUsesViewID);
+ stream->writeInt(mUsesPointSize);
+ stream->writeInt(mUsesFlatInterpolation);
+
+ const std::vector<PixelShaderOutputVariable> &pixelShaderKey = mPixelShaderKey;
+ stream->writeInt(pixelShaderKey.size());
+ for (size_t pixelShaderKeyIndex = 0; pixelShaderKeyIndex < pixelShaderKey.size();
+ pixelShaderKeyIndex++)
+ {
+ const PixelShaderOutputVariable &variable = pixelShaderKey[pixelShaderKeyIndex];
+ stream->writeInt(variable.type);
+ stream->writeString(variable.name);
+ stream->writeString(variable.source);
+ stream->writeInt(variable.outputLocation);
+ stream->writeInt(variable.outputIndex);
+ }
+
+ stream->writeString(mGeometryShaderPreamble);
+
+ stream->writeInt(mVertexExecutables.size());
+ for (size_t vertexExecutableIndex = 0; vertexExecutableIndex < mVertexExecutables.size();
+ vertexExecutableIndex++)
+ {
+ VertexExecutable *vertexExecutable = mVertexExecutables[vertexExecutableIndex].get();
+
+ const auto &inputLayout = vertexExecutable->inputs();
+ stream->writeInt(inputLayout.size());
+
+ for (size_t inputIndex = 0; inputIndex < inputLayout.size(); inputIndex++)
+ {
+ stream->writeInt(static_cast<unsigned int>(inputLayout[inputIndex]));
+ }
+
+ size_t vertexShaderSize = vertexExecutable->shaderExecutable()->getLength();
+ stream->writeInt(vertexShaderSize);
+
+ const uint8_t *vertexBlob = vertexExecutable->shaderExecutable()->getFunction();
+ stream->writeBytes(vertexBlob, vertexShaderSize);
+ }
+
+ stream->writeInt(mPixelExecutables.size());
+ for (size_t pixelExecutableIndex = 0; pixelExecutableIndex < mPixelExecutables.size();
+ pixelExecutableIndex++)
+ {
+ PixelExecutable *pixelExecutable = mPixelExecutables[pixelExecutableIndex].get();
+
+ const std::vector<GLenum> outputs = pixelExecutable->outputSignature();
+ stream->writeInt(outputs.size());
+ for (size_t outputIndex = 0; outputIndex < outputs.size(); outputIndex++)
+ {
+ stream->writeInt(outputs[outputIndex]);
+ }
+
+ size_t pixelShaderSize = pixelExecutable->shaderExecutable()->getLength();
+ stream->writeInt(pixelShaderSize);
+
+ const uint8_t *pixelBlob = pixelExecutable->shaderExecutable()->getFunction();
+ stream->writeBytes(pixelBlob, pixelShaderSize);
+ }
+
+ for (auto const &geometryExecutable : mGeometryExecutables)
+ {
+ if (!geometryExecutable)
+ {
+ stream->writeInt(0);
+ continue;
+ }
+
+ size_t geometryShaderSize = geometryExecutable->getLength();
+ stream->writeInt(geometryShaderSize);
+ stream->writeBytes(geometryExecutable->getFunction(), geometryShaderSize);
+ }
+
+ stream->writeInt(mComputeExecutables.size());
+ for (size_t computeExecutableIndex = 0; computeExecutableIndex < mComputeExecutables.size();
+ computeExecutableIndex++)
+ {
+ ComputeExecutable *computeExecutable = mComputeExecutables[computeExecutableIndex].get();
+
+ const gl::ImageUnitTextureTypeMap signatures = computeExecutable->signature();
+ stream->writeInt(signatures.size());
+ for (const auto &signature : signatures)
+ {
+ stream->writeInt(signature.first);
+ stream->writeInt(static_cast<unsigned int>(signature.second));
+ }
+
+ size_t computeShaderSize = computeExecutable->shaderExecutable()->getLength();
+ stream->writeInt(computeShaderSize);
+
+ const uint8_t *computeBlob = computeExecutable->shaderExecutable()->getFunction();
+ stream->writeBytes(computeBlob, computeShaderSize);
+ }
+
+ stream->writeInt(mComputeShaderImage2DBindLayoutCache.size());
+ for (auto &image2DBindLayout : mComputeShaderImage2DBindLayoutCache)
+ {
+ stream->writeInt(image2DBindLayout.first);
+ }
+}
+
+void ProgramD3D::setBinaryRetrievableHint(bool /* retrievable */) {}
+
+void ProgramD3D::setSeparable(bool /* separable */) {}
+
+angle::Result ProgramD3D::getPixelExecutableForCachedOutputLayout(
+ d3d::Context *context,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog)
+{
+ if (mCachedPixelExecutableIndex.valid())
+ {
+ *outExecutable = mPixelExecutables[mCachedPixelExecutableIndex.value()]->shaderExecutable();
+ return angle::Result::Continue;
+ }
+
+ std::string finalPixelHLSL = mDynamicHLSL->generatePixelShaderForOutputSignature(
+ mShaderHLSL[gl::ShaderType::Fragment], mPixelShaderKey, mUsesFragDepth,
+ mPixelShaderOutputLayoutCache);
+
+ // Generate new pixel executable
+ ShaderExecutableD3D *pixelExecutable = nullptr;
+
+ gl::InfoLog tempInfoLog;
+ gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
+
+ ANGLE_TRY(mRenderer->compileToExecutable(
+ context, *currentInfoLog, finalPixelHLSL, gl::ShaderType::Fragment, mStreamOutVaryings,
+ (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS),
+ mShaderWorkarounds[gl::ShaderType::Fragment], &pixelExecutable));
+
+ if (pixelExecutable)
+ {
+ mPixelExecutables.push_back(std::unique_ptr<PixelExecutable>(
+ new PixelExecutable(mPixelShaderOutputLayoutCache, pixelExecutable)));
+ mCachedPixelExecutableIndex = mPixelExecutables.size() - 1;
+ }
+ else if (!infoLog)
+ {
+ ERR() << "Error compiling dynamic pixel executable:" << std::endl
+ << tempInfoLog.str() << std::endl;
+ }
+
+ *outExecutable = pixelExecutable;
+ return angle::Result::Continue;
+}
+
+angle::Result ProgramD3D::getVertexExecutableForCachedInputLayout(
+ d3d::Context *context,
+ ShaderExecutableD3D **outExectuable,
+ gl::InfoLog *infoLog)
+{
+ if (mCachedVertexExecutableIndex.valid())
+ {
+ *outExectuable =
+ mVertexExecutables[mCachedVertexExecutableIndex.value()]->shaderExecutable();
+ return angle::Result::Continue;
+ }
+
+ // Generate new dynamic layout with attribute conversions
+ std::string finalVertexHLSL = mDynamicHLSL->generateVertexShaderForInputLayout(
+ mShaderHLSL[gl::ShaderType::Vertex], mCachedInputLayout, mState.getAttributes());
+
+ // Generate new vertex executable
+ ShaderExecutableD3D *vertexExecutable = nullptr;
+
+ gl::InfoLog tempInfoLog;
+ gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
+
+ ANGLE_TRY(mRenderer->compileToExecutable(
+ context, *currentInfoLog, finalVertexHLSL, gl::ShaderType::Vertex, mStreamOutVaryings,
+ (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS),
+ mShaderWorkarounds[gl::ShaderType::Vertex], &vertexExecutable));
+
+ if (vertexExecutable)
+ {
+ mVertexExecutables.push_back(std::unique_ptr<VertexExecutable>(
+ new VertexExecutable(mCachedInputLayout, mCachedVertexSignature, vertexExecutable)));
+ mCachedVertexExecutableIndex = mVertexExecutables.size() - 1;
+ }
+ else if (!infoLog)
+ {
+ ERR() << "Error compiling dynamic vertex executable:" << std::endl
+ << tempInfoLog.str() << std::endl;
+ }
+
+ *outExectuable = vertexExecutable;
+ return angle::Result::Continue;
+}
+
+angle::Result ProgramD3D::getGeometryExecutableForPrimitiveType(d3d::Context *context,
+ const gl::State &state,
+ gl::PrimitiveMode drawMode,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog)
+{
+ if (outExecutable)
+ {
+ *outExecutable = nullptr;
+ }
+
+ // Return a null shader if the current rendering doesn't use a geometry shader
+ if (!usesGeometryShader(state, drawMode))
+ {
+ return angle::Result::Continue;
+ }
+
+ gl::PrimitiveMode geometryShaderType = GetGeometryShaderTypeFromDrawMode(drawMode);
+
+ if (mGeometryExecutables[geometryShaderType])
+ {
+ if (outExecutable)
+ {
+ *outExecutable = mGeometryExecutables[geometryShaderType].get();
+ }
+ return angle::Result::Continue;
+ }
+ const gl::Caps &caps = state.getCaps();
+ std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(
+ caps, geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
+ mHasANGLEMultiviewEnabled, mRenderer->canSelectViewInVertexShader(),
+ usesGeometryShaderForPointSpriteEmulation(), mGeometryShaderPreamble);
+
+ gl::InfoLog tempInfoLog;
+ gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
+
+ ShaderExecutableD3D *geometryExecutable = nullptr;
+ angle::Result result = mRenderer->compileToExecutable(
+ context, *currentInfoLog, geometryHLSL, gl::ShaderType::Geometry, mStreamOutVaryings,
+ (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS),
+ angle::CompilerWorkaroundsD3D(), &geometryExecutable);
+
+ if (!infoLog && result == angle::Result::Stop)
+ {
+ ERR() << "Error compiling dynamic geometry executable:" << std::endl
+ << tempInfoLog.str() << std::endl;
+ }
+
+ if (geometryExecutable != nullptr)
+ {
+ mGeometryExecutables[geometryShaderType].reset(geometryExecutable);
+ }
+
+ if (outExecutable)
+ {
+ *outExecutable = mGeometryExecutables[geometryShaderType].get();
+ }
+ return result;
+}
+
+class ProgramD3D::GetVertexExecutableTask : public ProgramD3D::GetExecutableTask
+{
+ public:
+ GetVertexExecutableTask(ProgramD3D *program) : GetExecutableTask(program) {}
+ angle::Result run() override
+ {
+ mProgram->updateCachedInputLayoutFromShader();
+
+ ANGLE_TRY(mProgram->getVertexExecutableForCachedInputLayout(this, &mExecutable, &mInfoLog));
+
+ return angle::Result::Continue;
+ }
+};
+
+void ProgramD3D::updateCachedInputLayoutFromShader()
+{
+ GetDefaultInputLayoutFromShader(mState.getAttachedShader(gl::ShaderType::Vertex),
+ &mCachedInputLayout);
+ VertexExecutable::getSignature(mRenderer, mCachedInputLayout, &mCachedVertexSignature);
+ updateCachedVertexExecutableIndex();
+}
+
+class ProgramD3D::GetPixelExecutableTask : public ProgramD3D::GetExecutableTask
+{
+ public:
+ GetPixelExecutableTask(ProgramD3D *program) : GetExecutableTask(program) {}
+ angle::Result run() override
+ {
+ mProgram->updateCachedOutputLayoutFromShader();
+
+ ANGLE_TRY(mProgram->getPixelExecutableForCachedOutputLayout(this, &mExecutable, &mInfoLog));
+
+ return angle::Result::Continue;
+ }
+};
+
+void ProgramD3D::updateCachedOutputLayoutFromShader()
+{
+ GetDefaultOutputLayoutFromShader(mPixelShaderKey, &mPixelShaderOutputLayoutCache);
+ updateCachedPixelExecutableIndex();
+}
+
+void ProgramD3D::updateCachedImage2DBindLayoutFromComputeShader()
+{
+ GetDefaultImage2DBindLayoutFromComputeShader(mImage2DUniforms,
+ &mComputeShaderImage2DBindLayoutCache);
+ updateCachedComputeExecutableIndex();
+}
+
+class ProgramD3D::GetGeometryExecutableTask : public ProgramD3D::GetExecutableTask
+{
+ public:
+ GetGeometryExecutableTask(ProgramD3D *program, const gl::State &state)
+ : GetExecutableTask(program), mState(state)
+ {}
+
+ angle::Result run() override
+ {
+ // Auto-generate the geometry shader here, if we expect to be using point rendering in
+ // D3D11.
+ if (mProgram->usesGeometryShader(mState, gl::PrimitiveMode::Points))
+ {
+ ANGLE_TRY(mProgram->getGeometryExecutableForPrimitiveType(
+ this, mState, gl::PrimitiveMode::Points, &mExecutable, &mInfoLog));
+ }
+
+ return angle::Result::Continue;
+ }
+
+ private:
+ const gl::State &mState;
+};
+
+class ProgramD3D::GetComputeExecutableTask : public ProgramD3D::GetExecutableTask
+{
+ public:
+ GetComputeExecutableTask(ProgramD3D *program) : GetExecutableTask(program) {}
+ angle::Result run() override
+ {
+ mProgram->updateCachedImage2DBindLayoutFromComputeShader();
+ ShaderExecutableD3D *computeExecutable = nullptr;
+ ANGLE_TRY(mProgram->getComputeExecutableForImage2DBindLayout(this, &computeExecutable,
+ &mInfoLog));
+
+ return computeExecutable ? angle::Result::Continue : angle::Result::Incomplete;
+ }
+};
+
+// The LinkEvent implementation for linking a rendering(VS, FS, GS) program.
+class ProgramD3D::GraphicsProgramLinkEvent final : public LinkEvent
+{
+ public:
+ GraphicsProgramLinkEvent(gl::InfoLog &infoLog,
+ std::shared_ptr<WorkerThreadPool> workerPool,
+ std::shared_ptr<ProgramD3D::GetVertexExecutableTask> vertexTask,
+ std::shared_ptr<ProgramD3D::GetPixelExecutableTask> pixelTask,
+ std::shared_ptr<ProgramD3D::GetGeometryExecutableTask> geometryTask,
+ bool useGS,
+ const ShaderD3D *vertexShader,
+ const ShaderD3D *fragmentShader)
+ : mInfoLog(infoLog),
+ mVertexTask(vertexTask),
+ mPixelTask(pixelTask),
+ mGeometryTask(geometryTask),
+ mWaitEvents({{std::shared_ptr<WaitableEvent>(
+ angle::WorkerThreadPool::PostWorkerTask(workerPool, mVertexTask)),
+ std::shared_ptr<WaitableEvent>(
+ angle::WorkerThreadPool::PostWorkerTask(workerPool, mPixelTask)),
+ std::shared_ptr<WaitableEvent>(
+ angle::WorkerThreadPool::PostWorkerTask(workerPool, mGeometryTask))}}),
+ mUseGS(useGS),
+ mVertexShader(vertexShader),
+ mFragmentShader(fragmentShader)
+ {}
+
+ angle::Result wait(const gl::Context *context) override
+ {
+ WaitableEvent::WaitMany(&mWaitEvents);
+
+ ANGLE_TRY(checkTask(context, mVertexTask.get()));
+ ANGLE_TRY(checkTask(context, mPixelTask.get()));
+ ANGLE_TRY(checkTask(context, mGeometryTask.get()));
+
+ if (mVertexTask->getResult() == angle::Result::Incomplete ||
+ mPixelTask->getResult() == angle::Result::Incomplete ||
+ mGeometryTask->getResult() == angle::Result::Incomplete)
+ {
+ return angle::Result::Incomplete;
+ }
+
+ ShaderExecutableD3D *defaultVertexExecutable = mVertexTask->getExecutable();
+ ShaderExecutableD3D *defaultPixelExecutable = mPixelTask->getExecutable();
+ ShaderExecutableD3D *pointGS = mGeometryTask->getExecutable();
+
+ if (mUseGS && pointGS)
+ {
+ // Geometry shaders are currently only used internally, so there is no corresponding
+ // shader object at the interface level. For now the geometry shader debug info is
+ // prepended to the vertex shader.
+ mVertexShader->appendDebugInfo("// GEOMETRY SHADER BEGIN\n\n");
+ mVertexShader->appendDebugInfo(pointGS->getDebugInfo());
+ mVertexShader->appendDebugInfo("\nGEOMETRY SHADER END\n\n\n");
+ }
+
+ if (defaultVertexExecutable)
+ {
+ mVertexShader->appendDebugInfo(defaultVertexExecutable->getDebugInfo());
+ }
+
+ if (defaultPixelExecutable)
+ {
+ mFragmentShader->appendDebugInfo(defaultPixelExecutable->getDebugInfo());
+ }
+
+ bool isLinked = (defaultVertexExecutable && defaultPixelExecutable && (!mUseGS || pointGS));
+ if (!isLinked)
+ {
+ mInfoLog << "Failed to create D3D Shaders";
+ }
+ return isLinked ? angle::Result::Continue : angle::Result::Incomplete;
+ }
+
+ bool isLinking() override
+ {
+ for (auto &event : mWaitEvents)
+ {
+ if (!event->isReady())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private:
+ angle::Result checkTask(const gl::Context *context, ProgramD3D::GetExecutableTask *task)
+ {
+ if (!task->getInfoLog().empty())
+ {
+ mInfoLog << task->getInfoLog().str();
+ }
+
+ // Continue and Incomplete are not errors. For Stop, pass the error to the ContextD3D.
+ if (task->getResult() != angle::Result::Stop)
+ {
+ return angle::Result::Continue;
+ }
+
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+ task->popError(contextD3D);
+ return angle::Result::Stop;
+ }
+
+ gl::InfoLog &mInfoLog;
+ std::shared_ptr<ProgramD3D::GetVertexExecutableTask> mVertexTask;
+ std::shared_ptr<ProgramD3D::GetPixelExecutableTask> mPixelTask;
+ std::shared_ptr<ProgramD3D::GetGeometryExecutableTask> mGeometryTask;
+ std::array<std::shared_ptr<WaitableEvent>, 3> mWaitEvents;
+ bool mUseGS;
+ const ShaderD3D *mVertexShader;
+ const ShaderD3D *mFragmentShader;
+};
+
+// The LinkEvent implementation for linking a computing program.
+class ProgramD3D::ComputeProgramLinkEvent final : public LinkEvent
+{
+ public:
+ ComputeProgramLinkEvent(gl::InfoLog &infoLog,
+ std::shared_ptr<ProgramD3D::GetComputeExecutableTask> computeTask,
+ std::shared_ptr<WaitableEvent> event)
+ : mInfoLog(infoLog), mComputeTask(computeTask), mWaitEvent(event)
+ {}
+
+ bool isLinking() override { return !mWaitEvent->isReady(); }
+
+ angle::Result wait(const gl::Context *context) override
+ {
+ mWaitEvent->wait();
+
+ angle::Result result = mComputeTask->getResult();
+ if (result != angle::Result::Continue)
+ {
+ mInfoLog << "Failed to create D3D compute shader.";
+ }
+ return result;
+ }
+
+ private:
+ gl::InfoLog &mInfoLog;
+ std::shared_ptr<ProgramD3D::GetComputeExecutableTask> mComputeTask;
+ std::shared_ptr<WaitableEvent> mWaitEvent;
+};
+
+std::unique_ptr<LinkEvent> ProgramD3D::compileProgramExecutables(const gl::Context *context,
+ gl::InfoLog &infoLog)
+{
+ // Ensure the compiler is initialized to avoid race conditions.
+ angle::Result result = mRenderer->ensureHLSLCompilerInitialized(GetImplAs<ContextD3D>(context));
+ if (result != angle::Result::Continue)
+ {
+ return std::make_unique<LinkEventDone>(result);
+ }
+
+ auto vertexTask = std::make_shared<GetVertexExecutableTask>(this);
+ auto pixelTask = std::make_shared<GetPixelExecutableTask>(this);
+ auto geometryTask = std::make_shared<GetGeometryExecutableTask>(this, context->getState());
+ bool useGS = usesGeometryShader(context->getState(), gl::PrimitiveMode::Points);
+ const ShaderD3D *vertexShaderD3D =
+ GetImplAs<ShaderD3D>(mState.getAttachedShader(gl::ShaderType::Vertex));
+ const ShaderD3D *fragmentShaderD3D =
+ GetImplAs<ShaderD3D>(mState.getAttachedShader(gl::ShaderType::Fragment));
+
+ return std::make_unique<GraphicsProgramLinkEvent>(infoLog, context->getWorkerThreadPool(),
+ vertexTask, pixelTask, geometryTask, useGS,
+ vertexShaderD3D, fragmentShaderD3D);
+}
+
+std::unique_ptr<LinkEvent> ProgramD3D::compileComputeExecutable(const gl::Context *context,
+ gl::InfoLog &infoLog)
+{
+ // Ensure the compiler is initialized to avoid race conditions.
+ angle::Result result = mRenderer->ensureHLSLCompilerInitialized(GetImplAs<ContextD3D>(context));
+ if (result != angle::Result::Continue)
+ {
+ return std::make_unique<LinkEventDone>(result);
+ }
+ auto computeTask = std::make_shared<GetComputeExecutableTask>(this);
+
+ std::shared_ptr<WaitableEvent> waitableEvent;
+
+ // TODO(jie.a.chen@intel.com): Fix the flaky bug.
+ // http://anglebug.com/3349
+ bool compileInParallel = false;
+ if (!compileInParallel)
+ {
+ (*computeTask)();
+ waitableEvent = std::make_shared<WaitableEventDone>();
+ }
+ else
+ {
+ waitableEvent =
+ WorkerThreadPool::PostWorkerTask(context->getWorkerThreadPool(), computeTask);
+ }
+
+ return std::make_unique<ComputeProgramLinkEvent>(infoLog, computeTask, waitableEvent);
+}
+
+angle::Result ProgramD3D::getComputeExecutableForImage2DBindLayout(
+ d3d::Context *context,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog)
+{
+ if (mCachedComputeExecutableIndex.valid())
+ {
+ *outExecutable =
+ mComputeExecutables[mCachedComputeExecutableIndex.value()]->shaderExecutable();
+ return angle::Result::Continue;
+ }
+
+ std::string finalComputeHLSL = mDynamicHLSL->generateComputeShaderForImage2DBindSignature(
+ context, *this, mState, mImage2DUniforms, mComputeShaderImage2DBindLayoutCache);
+
+ // Generate new compute executable
+ ShaderExecutableD3D *computeExecutable = nullptr;
+
+ gl::InfoLog tempInfoLog;
+ gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
+
+ ANGLE_TRY(mRenderer->compileToExecutable(
+ context, *currentInfoLog, finalComputeHLSL, gl::ShaderType::Compute,
+ std::vector<D3DVarying>(), false, angle::CompilerWorkaroundsD3D(), &computeExecutable));
+
+ if (computeExecutable)
+ {
+ mComputeExecutables.push_back(std::unique_ptr<ComputeExecutable>(
+ new ComputeExecutable(mComputeShaderImage2DBindLayoutCache,
+ std::unique_ptr<ShaderExecutableD3D>(computeExecutable))));
+ mCachedComputeExecutableIndex = mComputeExecutables.size() - 1;
+ }
+ else if (!infoLog)
+ {
+ ERR() << "Error compiling dynamic compute executable:" << std::endl
+ << tempInfoLog.str() << std::endl;
+ }
+ *outExecutable = computeExecutable;
+
+ return angle::Result::Continue;
+}
+
+std::unique_ptr<LinkEvent> ProgramD3D::link(const gl::Context *context,
+ const gl::ProgramLinkedResources &resources,
+ gl::InfoLog &infoLog)
+{
+ const auto &data = context->getState();
+
+ reset();
+
+ gl::Shader *computeShader = mState.getAttachedShader(gl::ShaderType::Compute);
+ if (computeShader)
+ {
+ mShaderSamplers[gl::ShaderType::Compute].resize(
+ data.getCaps().maxShaderTextureImageUnits[gl::ShaderType::Compute]);
+ mImagesCS.resize(data.getCaps().maxImageUnits);
+ mReadonlyImagesCS.resize(data.getCaps().maxImageUnits);
+
+ mShaderUniformsDirty.set(gl::ShaderType::Compute);
+
+ linkResources(resources);
+
+ for (const sh::Uniform &uniform : computeShader->getUniforms())
+ {
+ if (gl::IsImageType(uniform.type) && gl::IsImage2DType(uniform.type))
+ {
+ mImage2DUniforms.push_back(uniform);
+ }
+ }
+
+ defineUniformsAndAssignRegisters();
+
+ return compileComputeExecutable(context, infoLog);
+ }
+ else
+ {
+ gl::ShaderMap<const ShaderD3D *> shadersD3D = {};
+ for (gl::ShaderType shaderType : gl::kAllGraphicsShaderTypes)
+ {
+ if (mState.getAttachedShader(shaderType))
+ {
+ shadersD3D[shaderType] = GetImplAs<ShaderD3D>(mState.getAttachedShader(shaderType));
+
+ mShaderSamplers[shaderType].resize(
+ data.getCaps().maxShaderTextureImageUnits[shaderType]);
+
+ shadersD3D[shaderType]->generateWorkarounds(&mShaderWorkarounds[shaderType]);
+
+ mShaderUniformsDirty.set(shaderType);
+ }
+ }
+
+ if (mRenderer->getNativeLimitations().noFrontFacingSupport)
+ {
+ if (shadersD3D[gl::ShaderType::Fragment]->usesFrontFacing())
+ {
+ infoLog << "The current renderer doesn't support gl_FrontFacing";
+ return std::make_unique<LinkEventDone>(angle::Result::Incomplete);
+ }
+ }
+
+ ProgramD3DMetadata metadata(mRenderer, shadersD3D);
+ BuiltinVaryingsD3D builtins(metadata, resources.varyingPacking);
+
+ mDynamicHLSL->generateShaderLinkHLSL(context->getCaps(), mState, metadata,
+ resources.varyingPacking, builtins, &mShaderHLSL);
+
+ mUsesPointSize = shadersD3D[gl::ShaderType::Vertex]->usesPointSize();
+ mDynamicHLSL->getPixelShaderOutputKey(data, mState, metadata, &mPixelShaderKey);
+ mUsesFragDepth = metadata.usesFragDepth();
+ mUsesVertexID = metadata.usesVertexID();
+ mUsesViewID = metadata.usesViewID();
+ mHasANGLEMultiviewEnabled = metadata.hasANGLEMultiviewEnabled();
+
+ // Cache if we use flat shading
+ mUsesFlatInterpolation = FindFlatInterpolationVarying(mState.getAttachedShaders());
+
+ if (mRenderer->getMajorShaderModel() >= 4)
+ {
+ mGeometryShaderPreamble = mDynamicHLSL->generateGeometryShaderPreamble(
+ resources.varyingPacking, builtins, mHasANGLEMultiviewEnabled,
+ metadata.canSelectViewInVertexShader());
+ }
+
+ initAttribLocationsToD3DSemantic();
+
+ defineUniformsAndAssignRegisters();
+
+ gatherTransformFeedbackVaryings(resources.varyingPacking, builtins[gl::ShaderType::Vertex]);
+
+ linkResources(resources);
+
+ return compileProgramExecutables(context, infoLog);
+ }
+}
+
+GLboolean ProgramD3D::validate(const gl::Caps & /*caps*/, gl::InfoLog * /*infoLog*/)
+{
+ // TODO(jmadill): Do something useful here?
+ return GL_TRUE;
+}
+
+void ProgramD3D::initializeShaderStorageBlocks()
+{
+ if (mState.getShaderStorageBlocks().empty())
+ {
+ return;
+ }
+
+ ASSERT(mD3DShaderStorageBlocks.empty());
+
+ // Assign registers and update sizes.
+ gl::ShaderMap<const ShaderD3D *> shadersD3D = {};
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ shadersD3D[shaderType] = SafeGetImplAs<ShaderD3D>(mState.getAttachedShader(shaderType));
+ }
+
+ for (const gl::InterfaceBlock &shaderStorageBlock : mState.getShaderStorageBlocks())
+ {
+ unsigned int shaderStorageBlockElement =
+ shaderStorageBlock.isArray ? shaderStorageBlock.arrayElement : 0;
+
+ D3DInterfaceBlock d3dShaderStorageBlock;
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (shaderStorageBlock.isActive(shaderType))
+ {
+ ASSERT(shadersD3D[shaderType]);
+ unsigned int baseRegister =
+ shadersD3D[shaderType]->getShaderStorageBlockRegister(shaderStorageBlock.name);
+ d3dShaderStorageBlock.mShaderRegisterIndexes[shaderType] =
+ baseRegister + shaderStorageBlockElement;
+ }
+ }
+
+ mD3DShaderStorageBlocks.push_back(d3dShaderStorageBlock);
+ }
+}
+
+void ProgramD3D::initializeUniformBlocks()
+{
+ if (mState.getUniformBlocks().empty())
+ {
+ return;
+ }
+
+ ASSERT(mD3DUniformBlocks.empty());
+
+ // Assign registers and update sizes.
+ gl::ShaderMap<const ShaderD3D *> shadersD3D = {};
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ shadersD3D[shaderType] = SafeGetImplAs<ShaderD3D>(mState.getAttachedShader(shaderType));
+ }
+
+ for (const gl::InterfaceBlock &uniformBlock : mState.getUniformBlocks())
+ {
+ unsigned int uniformBlockElement = uniformBlock.isArray ? uniformBlock.arrayElement : 0;
+
+ D3DInterfaceBlock d3dUniformBlock;
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (uniformBlock.isActive(shaderType))
+ {
+ ASSERT(shadersD3D[shaderType]);
+ unsigned int baseRegister =
+ shadersD3D[shaderType]->getUniformBlockRegister(uniformBlock.name);
+ d3dUniformBlock.mShaderRegisterIndexes[shaderType] =
+ baseRegister + uniformBlockElement;
+ }
+ }
+
+ mD3DUniformBlocks.push_back(d3dUniformBlock);
+ }
+}
+
+void ProgramD3D::initializeUniformStorage(const gl::ShaderBitSet &availableShaderStages)
+{
+ // Compute total default block size
+ gl::ShaderMap<unsigned int> shaderRegisters = {};
+ for (const D3DUniform *d3dUniform : mD3DUniforms)
+ {
+ if (d3dUniform->isSampler())
+ {
+ continue;
+ }
+
+ for (gl::ShaderType shaderType : availableShaderStages)
+ {
+ if (d3dUniform->isReferencedByShader(shaderType))
+ {
+ shaderRegisters[shaderType] = std::max(
+ shaderRegisters[shaderType],
+ d3dUniform->mShaderRegisterIndexes[shaderType] + d3dUniform->registerCount);
+ }
+ }
+ }
+
+ // We only reset uniform storages for the shader stages available in the program (attached
+ // shaders in ProgramD3D::link() and linkedShaderStages in ProgramD3D::load()).
+ for (gl::ShaderType shaderType : availableShaderStages)
+ {
+ mShaderUniformStorages[shaderType].reset(
+ mRenderer->createUniformStorage(shaderRegisters[shaderType] * 16u));
+ }
+
+ // Iterate the uniforms again to assign data pointers to default block uniforms.
+ for (D3DUniform *d3dUniform : mD3DUniforms)
+ {
+ if (d3dUniform->isSampler())
+ {
+ d3dUniform->mSamplerData.resize(d3dUniform->getArraySizeProduct(), 0);
+ continue;
+ }
+
+ for (gl::ShaderType shaderType : availableShaderStages)
+ {
+ if (d3dUniform->isReferencedByShader(shaderType))
+ {
+ d3dUniform->mShaderData[shaderType] =
+ mShaderUniformStorages[shaderType]->getDataPointer(
+ d3dUniform->mShaderRegisterIndexes[shaderType],
+ d3dUniform->registerElement);
+ }
+ }
+ }
+}
+
+void ProgramD3D::updateUniformBufferCache(
+ const gl::Caps &caps,
+ const gl::ShaderMap<unsigned int> &reservedShaderRegisterIndexes)
+{
+ if (mState.getUniformBlocks().empty())
+ {
+ return;
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ mShaderUBOCaches[shaderType].clear();
+ }
+
+ for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < mD3DUniformBlocks.size();
+ uniformBlockIndex++)
+ {
+ const D3DInterfaceBlock &uniformBlock = mD3DUniformBlocks[uniformBlockIndex];
+ GLuint blockBinding = mState.getUniformBlockBinding(uniformBlockIndex);
+
+ // Unnecessary to apply an unreferenced standard or shared UBO
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (!uniformBlock.activeInShader(shaderType))
+ {
+ continue;
+ }
+
+ unsigned int registerIndex = uniformBlock.mShaderRegisterIndexes[shaderType] -
+ reservedShaderRegisterIndexes[shaderType];
+ ASSERT(registerIndex < caps.maxShaderUniformBlocks[shaderType]);
+
+ std::vector<int> &shaderUBOcache = mShaderUBOCaches[shaderType];
+ if (shaderUBOcache.size() <= registerIndex)
+ {
+ shaderUBOcache.resize(registerIndex + 1, -1);
+ }
+
+ ASSERT(shaderUBOcache[registerIndex] == -1);
+ shaderUBOcache[registerIndex] = blockBinding;
+ }
+ }
+}
+
+unsigned int ProgramD3D::getAtomicCounterBufferRegisterIndex(GLuint binding,
+ gl::ShaderType shaderType) const
+{
+ if (shaderType != gl::ShaderType::Compute)
+ {
+ // Implement atomic counters for non-compute shaders
+ // http://anglebug.com/1729
+ UNIMPLEMENTED();
+ }
+ return mComputeAtomicCounterBufferRegisterIndices[binding];
+}
+
+unsigned int ProgramD3D::getShaderStorageBufferRegisterIndex(GLuint blockIndex,
+ gl::ShaderType shaderType) const
+{
+ return mD3DShaderStorageBlocks[blockIndex].mShaderRegisterIndexes[shaderType];
+}
+
+const std::vector<GLint> &ProgramD3D::getShaderUniformBufferCache(gl::ShaderType shaderType) const
+{
+ return mShaderUBOCaches[shaderType];
+}
+
+void ProgramD3D::dirtyAllUniforms()
+{
+ mShaderUniformsDirty = mState.getLinkedShaderStages();
+}
+
+void ProgramD3D::markUniformsClean()
+{
+ mShaderUniformsDirty.reset();
+}
+
+void ProgramD3D::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ setUniformInternal(location, count, v, GL_FLOAT);
+}
+
+void ProgramD3D::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ setUniformInternal(location, count, v, GL_FLOAT_VEC2);
+}
+
+void ProgramD3D::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ setUniformInternal(location, count, v, GL_FLOAT_VEC3);
+}
+
+void ProgramD3D::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+ setUniformInternal(location, count, v, GL_FLOAT_VEC4);
+}
+
+void ProgramD3D::setUniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<2, 2>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<3, 3>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<4, 4>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<2, 3>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<3, 2>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<2, 4>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<4, 2>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<3, 4>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ setUniformMatrixfvInternal<4, 3>(location, count, transpose, value);
+}
+
+void ProgramD3D::setUniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+ setUniformInternal(location, count, v, GL_INT);
+}
+
+void ProgramD3D::setUniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+ setUniformInternal(location, count, v, GL_INT_VEC2);
+}
+
+void ProgramD3D::setUniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+ setUniformInternal(location, count, v, GL_INT_VEC3);
+}
+
+void ProgramD3D::setUniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+ setUniformInternal(location, count, v, GL_INT_VEC4);
+}
+
+void ProgramD3D::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ setUniformInternal(location, count, v, GL_UNSIGNED_INT);
+}
+
+void ProgramD3D::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ setUniformInternal(location, count, v, GL_UNSIGNED_INT_VEC2);
+}
+
+void ProgramD3D::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ setUniformInternal(location, count, v, GL_UNSIGNED_INT_VEC3);
+}
+
+void ProgramD3D::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
+{
+ setUniformInternal(location, count, v, GL_UNSIGNED_INT_VEC4);
+}
+
+void ProgramD3D::defineUniformsAndAssignRegisters()
+{
+ D3DUniformMap uniformMap;
+
+ gl::ShaderBitSet attachedShaders;
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ gl::Shader *shader = mState.getAttachedShader(shaderType);
+ if (shader)
+ {
+ for (const sh::Uniform &uniform : shader->getUniforms())
+ {
+ if (uniform.active)
+ {
+ defineUniformBase(shader, uniform, &uniformMap);
+ }
+ }
+
+ attachedShaders.set(shader->getType());
+ }
+ }
+
+ // Initialize the D3DUniform list to mirror the indexing of the GL layer.
+ for (const gl::LinkedUniform &glUniform : mState.getUniforms())
+ {
+ if (!glUniform.isInDefaultBlock())
+ continue;
+
+ std::string name = glUniform.name;
+ if (glUniform.isArray())
+ {
+ // In the program state, array uniform names include [0] as in the program resource
+ // spec. Here we don't include it.
+ // TODO(oetuaho@nvidia.com): consider using the same uniform naming here as in the GL
+ // layer.
+ ASSERT(angle::EndsWith(name, "[0]"));
+ name.resize(name.length() - 3);
+ }
+ auto mapEntry = uniformMap.find(name);
+ ASSERT(mapEntry != uniformMap.end());
+ mD3DUniforms.push_back(mapEntry->second);
+ }
+
+ assignAllSamplerRegisters();
+ assignAllAtomicCounterRegisters();
+ // Samplers and readonly images share shader input resource slot, adjust low value of
+ // readonly image range.
+ mUsedComputeReadonlyImageRange =
+ gl::RangeUI(mUsedShaderSamplerRanges[gl::ShaderType::Compute].high(),
+ mUsedShaderSamplerRanges[gl::ShaderType::Compute].high());
+ // Atomic counter buffers and non-readonly images share input resource slots
+ mUsedComputeImageRange =
+ gl::RangeUI(mUsedComputeAtomicCounterRange.high(), mUsedComputeAtomicCounterRange.high());
+ assignAllImageRegisters();
+ initializeUniformStorage(attachedShaders);
+}
+
+void ProgramD3D::defineUniformBase(const gl::Shader *shader,
+ const sh::Uniform &uniform,
+ D3DUniformMap *uniformMap)
+{
+ sh::DummyBlockEncoder dummyEncoder;
+
+ // Samplers get their registers assigned in assignAllSamplerRegisters, and images get their
+ // registers assigned in assignAllImageRegisters.
+ if (gl::IsSamplerType(uniform.type))
+ {
+ UniformEncodingVisitorD3D visitor(shader->getType(), HLSLRegisterType::Texture,
+ &dummyEncoder, uniformMap);
+ sh::TraverseShaderVariable(uniform, false, &visitor);
+ return;
+ }
+
+ if (gl::IsImageType(uniform.type))
+ {
+ if (uniform.readonly)
+ {
+ UniformEncodingVisitorD3D visitor(shader->getType(), HLSLRegisterType::Texture,
+ &dummyEncoder, uniformMap);
+ sh::TraverseShaderVariable(uniform, false, &visitor);
+ }
+ else
+ {
+ UniformEncodingVisitorD3D visitor(shader->getType(),
+ HLSLRegisterType::UnorderedAccessView, &dummyEncoder,
+ uniformMap);
+ sh::TraverseShaderVariable(uniform, false, &visitor);
+ }
+ mImageBindingMap[uniform.name] = uniform.binding;
+ return;
+ }
+
+ if (uniform.isBuiltIn() && !uniform.isEmulatedBuiltIn())
+ {
+ UniformEncodingVisitorD3D visitor(shader->getType(), HLSLRegisterType::None, &dummyEncoder,
+ uniformMap);
+ sh::TraverseShaderVariable(uniform, false, &visitor);
+ return;
+ }
+ else if (gl::IsAtomicCounterType(uniform.type))
+ {
+ UniformEncodingVisitorD3D visitor(shader->getType(), HLSLRegisterType::UnorderedAccessView,
+ &dummyEncoder, uniformMap);
+ sh::TraverseShaderVariable(uniform, false, &visitor);
+ mAtomicBindingMap[uniform.name] = uniform.binding;
+ return;
+ }
+
+ const ShaderD3D *shaderD3D = GetImplAs<ShaderD3D>(shader);
+ unsigned int startRegister = shaderD3D->getUniformRegister(uniform.name);
+ ShShaderOutput outputType = shaderD3D->getCompilerOutputType();
+ sh::HLSLBlockEncoder encoder(sh::HLSLBlockEncoder::GetStrategyFor(outputType), true);
+ encoder.skipRegisters(startRegister);
+
+ UniformEncodingVisitorD3D visitor(shader->getType(), HLSLRegisterType::None, &encoder,
+ uniformMap);
+ sh::TraverseShaderVariable(uniform, false, &visitor);
+}
+
+bool ProgramD3D::hasNamedUniform(const std::string &name)
+{
+ for (D3DUniform *d3dUniform : mD3DUniforms)
+ {
+ if (d3dUniform->name == name)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Assume count is already clamped.
+template <typename T>
+void ProgramD3D::setUniformImpl(const gl::VariableLocation &locationInfo,
+ GLsizei count,
+ const T *v,
+ uint8_t *targetData,
+ GLenum uniformType)
+{
+ D3DUniform *targetUniform = mD3DUniforms[locationInfo.index];
+ const int components = targetUniform->typeInfo.componentCount;
+ const unsigned int arrayElementOffset = locationInfo.arrayIndex;
+
+ if (targetUniform->typeInfo.type == uniformType)
+ {
+ T *dest = reinterpret_cast<T *>(targetData) + arrayElementOffset * 4;
+ const T *source = v;
+
+ for (GLint i = 0; i < count; i++, dest += 4, source += components)
+ {
+ memcpy(dest, source, components * sizeof(T));
+ }
+ }
+ else
+ {
+ ASSERT(targetUniform->typeInfo.type == gl::VariableBoolVectorType(uniformType));
+ GLint *boolParams = reinterpret_cast<GLint *>(targetData) + arrayElementOffset * 4;
+
+ for (GLint i = 0; i < count; i++)
+ {
+ GLint *dest = boolParams + (i * 4);
+ const T *source = v + (i * components);
+
+ for (int c = 0; c < components; c++)
+ {
+ dest[c] = (source[c] == static_cast<T>(0)) ? GL_FALSE : GL_TRUE;
+ }
+ }
+ }
+}
+
+template <typename T>
+void ProgramD3D::setUniformInternal(GLint location, GLsizei count, const T *v, GLenum uniformType)
+{
+ const gl::VariableLocation &locationInfo = mState.getUniformLocations()[location];
+ D3DUniform *targetUniform = mD3DUniforms[locationInfo.index];
+
+ if (targetUniform->typeInfo.isSampler)
+ {
+ ASSERT(uniformType == GL_INT);
+ size_t size = count * sizeof(T);
+ GLint *dest = &targetUniform->mSamplerData[locationInfo.arrayIndex];
+ if (memcmp(dest, v, size) != 0)
+ {
+ memcpy(dest, v, size);
+ mDirtySamplerMapping = true;
+ }
+ return;
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (targetUniform->mShaderData[shaderType])
+ {
+ setUniformImpl(locationInfo, count, v, targetUniform->mShaderData[shaderType],
+ uniformType);
+ mShaderUniformsDirty.set(shaderType);
+ }
+ }
+}
+
+template <int cols, int rows>
+void ProgramD3D::setUniformMatrixfvInternal(GLint location,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ D3DUniform *targetUniform = getD3DUniformFromLocation(location);
+ const gl::VariableLocation &uniformLocation = mState.getUniformLocations()[location];
+ unsigned int arrayElementOffset = uniformLocation.arrayIndex;
+ unsigned int elementCount = targetUniform->getArraySizeProduct();
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (targetUniform->mShaderData[shaderType])
+ {
+ if (SetFloatUniformMatrixHLSL<cols, rows>::Run(arrayElementOffset, elementCount,
+ countIn, transpose, value,
+ targetUniform->mShaderData[shaderType]))
+ {
+ mShaderUniformsDirty.set(shaderType);
+ }
+ }
+ }
+}
+
+void ProgramD3D::assignAllSamplerRegisters()
+{
+ for (size_t uniformIndex = 0; uniformIndex < mD3DUniforms.size(); ++uniformIndex)
+ {
+ if (mD3DUniforms[uniformIndex]->isSampler())
+ {
+ assignSamplerRegisters(uniformIndex);
+ }
+ }
+}
+
+void ProgramD3D::assignSamplerRegisters(size_t uniformIndex)
+{
+ D3DUniform *d3dUniform = mD3DUniforms[uniformIndex];
+ ASSERT(d3dUniform->isSampler());
+ // If the uniform is an array of arrays, then we have separate entries for each inner array in
+ // mD3DUniforms. However, the sampler register info is stored in the shader only for the
+ // outermost array.
+ std::vector<unsigned int> subscripts;
+ const std::string baseName = gl::ParseResourceName(d3dUniform->name, &subscripts);
+ unsigned int registerOffset =
+ mState.getUniforms()[uniformIndex].parentArrayIndex() * d3dUniform->getArraySizeProduct();
+
+ bool hasUniform = false;
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ if (!mState.getAttachedShader(shaderType))
+ {
+ continue;
+ }
+
+ const ShaderD3D *shaderD3D = GetImplAs<ShaderD3D>(mState.getAttachedShader(shaderType));
+ if (shaderD3D->hasUniform(baseName))
+ {
+ d3dUniform->mShaderRegisterIndexes[shaderType] =
+ shaderD3D->getUniformRegister(baseName) + registerOffset;
+ ASSERT(d3dUniform->mShaderRegisterIndexes[shaderType] != GL_INVALID_VALUE);
+
+ AssignSamplers(d3dUniform->mShaderRegisterIndexes[shaderType], d3dUniform->typeInfo,
+ d3dUniform->getArraySizeProduct(), mShaderSamplers[shaderType],
+ &mUsedShaderSamplerRanges[shaderType]);
+ hasUniform = true;
+ }
+ }
+
+ ASSERT(hasUniform);
+}
+
+// static
+void ProgramD3D::AssignSamplers(unsigned int startSamplerIndex,
+ const gl::UniformTypeInfo &typeInfo,
+ unsigned int samplerCount,
+ std::vector<Sampler> &outSamplers,
+ gl::RangeUI *outUsedRange)
+{
+ unsigned int samplerIndex = startSamplerIndex;
+ unsigned int low = outUsedRange->low();
+ unsigned int high = outUsedRange->high();
+
+ do
+ {
+ ASSERT(samplerIndex < outSamplers.size());
+ Sampler *sampler = &outSamplers[samplerIndex];
+ sampler->active = true;
+ sampler->textureType = gl::FromGLenum<gl::TextureType>(typeInfo.textureType);
+ sampler->logicalTextureUnit = 0;
+ low = std::min(samplerIndex, low);
+ high = std::max(samplerIndex + 1, high);
+ samplerIndex++;
+ } while (samplerIndex < startSamplerIndex + samplerCount);
+
+ ASSERT(low < high);
+ *outUsedRange = gl::RangeUI(low, high);
+}
+
+void ProgramD3D::assignAllImageRegisters()
+{
+ for (size_t uniformIndex = 0; uniformIndex < mD3DUniforms.size(); ++uniformIndex)
+ {
+ if (mD3DUniforms[uniformIndex]->isImage() && !mD3DUniforms[uniformIndex]->isImage2D())
+ {
+ assignImageRegisters(uniformIndex);
+ }
+ }
+}
+
+void ProgramD3D::assignAllAtomicCounterRegisters()
+{
+ if (mAtomicBindingMap.empty())
+ {
+ return;
+ }
+ gl::ShaderType shaderType = gl::ShaderType::Compute;
+ const gl::Shader *computeShader = mState.getAttachedShader(shaderType);
+ if (computeShader)
+ {
+ const ShaderD3D *computeShaderD3D = GetImplAs<ShaderD3D>(computeShader);
+ auto &registerIndices = mComputeAtomicCounterBufferRegisterIndices;
+ unsigned int firstRegister = GL_INVALID_VALUE;
+ unsigned int lastRegister = 0;
+ for (auto &atomicBinding : mAtomicBindingMap)
+ {
+ ASSERT(computeShaderD3D->hasUniform(atomicBinding.first));
+ unsigned int currentRegister =
+ computeShaderD3D->getUniformRegister(atomicBinding.first);
+ ASSERT(currentRegister != GL_INVALID_INDEX);
+ const int kBinding = atomicBinding.second;
+
+ registerIndices[kBinding] = currentRegister;
+
+ firstRegister = std::min(firstRegister, currentRegister);
+ lastRegister = std::max(lastRegister, currentRegister);
+ }
+ ASSERT(firstRegister != GL_INVALID_VALUE);
+ ASSERT(lastRegister != GL_INVALID_VALUE);
+ mUsedComputeAtomicCounterRange = gl::RangeUI(firstRegister, lastRegister + 1);
+ }
+ else
+ {
+ // Implement atomic counters for non-compute shaders
+ // http://anglebug.com/1729
+ UNIMPLEMENTED();
+ }
+}
+
+void ProgramD3D::assignImageRegisters(size_t uniformIndex)
+{
+ D3DUniform *d3dUniform = mD3DUniforms[uniformIndex];
+ ASSERT(d3dUniform->isImage());
+ // If the uniform is an array of arrays, then we have separate entries for each inner array in
+ // mD3DUniforms. However, the image register info is stored in the shader only for the
+ // outermost array.
+ std::vector<unsigned int> subscripts;
+ const std::string baseName = gl::ParseResourceName(d3dUniform->name, &subscripts);
+ unsigned int registerOffset =
+ mState.getUniforms()[uniformIndex].parentArrayIndex() * d3dUniform->getArraySizeProduct();
+
+ const gl::Shader *computeShader = mState.getAttachedShader(gl::ShaderType::Compute);
+ if (computeShader)
+ {
+ const ShaderD3D *computeShaderD3D =
+ GetImplAs<ShaderD3D>(mState.getAttachedShader(gl::ShaderType::Compute));
+ ASSERT(computeShaderD3D->hasUniform(baseName));
+ d3dUniform->mShaderRegisterIndexes[gl::ShaderType::Compute] =
+ computeShaderD3D->getUniformRegister(baseName) + registerOffset;
+ ASSERT(d3dUniform->mShaderRegisterIndexes[gl::ShaderType::Compute] != GL_INVALID_INDEX);
+ auto bindingIter = mImageBindingMap.find(baseName);
+ ASSERT(bindingIter != mImageBindingMap.end());
+ if (d3dUniform->regType == HLSLRegisterType::Texture)
+ {
+ AssignImages(d3dUniform->mShaderRegisterIndexes[gl::ShaderType::Compute],
+ bindingIter->second, d3dUniform->getArraySizeProduct(), mReadonlyImagesCS,
+ &mUsedComputeReadonlyImageRange);
+ }
+ else if (d3dUniform->regType == HLSLRegisterType::UnorderedAccessView)
+ {
+ AssignImages(d3dUniform->mShaderRegisterIndexes[gl::ShaderType::Compute],
+ bindingIter->second, d3dUniform->getArraySizeProduct(), mImagesCS,
+ &mUsedComputeImageRange);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ // TODO(xinghua.cao@intel.com): Implement image variables in vertex shader and pixel shader.
+ UNIMPLEMENTED();
+ }
+}
+
+// static
+void ProgramD3D::AssignImages(unsigned int startImageIndex,
+ int startLogicalImageUnit,
+ unsigned int imageCount,
+ std::vector<Image> &outImages,
+ gl::RangeUI *outUsedRange)
+{
+ unsigned int imageIndex = startImageIndex;
+ unsigned int low = outUsedRange->low();
+ unsigned int high = outUsedRange->high();
+
+ // If declare without a binding qualifier, any uniform image variable (include all elements of
+ // unbound image array) shoud be bound to unit zero.
+ if (startLogicalImageUnit == -1)
+ {
+ ASSERT(imageIndex < outImages.size());
+ Image *image = &outImages[imageIndex];
+ image->active = true;
+ image->logicalImageUnit = 0;
+ low = std::min(imageIndex, low);
+ high = std::max(imageIndex + 1, high);
+ ASSERT(low < high);
+ *outUsedRange = gl::RangeUI(low, high);
+ return;
+ }
+
+ unsigned int logcalImageUnit = startLogicalImageUnit;
+ do
+ {
+ ASSERT(imageIndex < outImages.size());
+ Image *image = &outImages[imageIndex];
+ image->active = true;
+ image->logicalImageUnit = logcalImageUnit;
+ low = std::min(imageIndex, low);
+ high = std::max(imageIndex + 1, high);
+ imageIndex++;
+ logcalImageUnit++;
+ } while (imageIndex < startImageIndex + imageCount);
+
+ ASSERT(low < high);
+ *outUsedRange = gl::RangeUI(low, high);
+}
+
+void ProgramD3D::assignImage2DRegisters(unsigned int startImageIndex,
+ int startLogicalImageUnit,
+ bool readonly)
+{
+ if (readonly)
+ {
+ AssignImages(startImageIndex, startLogicalImageUnit, 1, mReadonlyImagesCS,
+ &mUsedComputeReadonlyImageRange);
+ }
+ else
+ {
+ AssignImages(startImageIndex, startLogicalImageUnit, 1, mImagesCS, &mUsedComputeImageRange);
+ }
+}
+
+void ProgramD3D::reset()
+{
+ mVertexExecutables.clear();
+ mPixelExecutables.clear();
+ mComputeExecutables.clear();
+
+ for (auto &geometryExecutable : mGeometryExecutables)
+ {
+ geometryExecutable.reset(nullptr);
+ }
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ mShaderHLSL[shaderType].clear();
+ }
+
+ mUsesFragDepth = false;
+ mHasANGLEMultiviewEnabled = false;
+ mUsesVertexID = false;
+ mUsesViewID = false;
+ mPixelShaderKey.clear();
+ mUsesPointSize = false;
+ mUsesFlatInterpolation = false;
+
+ SafeDeleteContainer(mD3DUniforms);
+ mD3DUniformBlocks.clear();
+ mD3DShaderStorageBlocks.clear();
+ mComputeAtomicCounterBufferRegisterIndices.fill({});
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ mShaderUniformStorages[shaderType].reset();
+ mShaderSamplers[shaderType].clear();
+ }
+
+ mImagesCS.clear();
+ mReadonlyImagesCS.clear();
+
+ mUsedShaderSamplerRanges.fill({0, 0});
+ mUsedComputeAtomicCounterRange = {0, 0};
+ mDirtySamplerMapping = true;
+ mUsedComputeImageRange = {0, 0};
+ mUsedComputeReadonlyImageRange = {0, 0};
+
+ mAttribLocationToD3DSemantic.fill(-1);
+
+ mStreamOutVaryings.clear();
+
+ mGeometryShaderPreamble.clear();
+
+ markUniformsClean();
+
+ mCachedPixelExecutableIndex.reset();
+ mCachedVertexExecutableIndex.reset();
+}
+
+unsigned int ProgramD3D::getSerial() const
+{
+ return mSerial;
+}
+
+unsigned int ProgramD3D::issueSerial()
+{
+ return mCurrentSerial++;
+}
+
+void ProgramD3D::initAttribLocationsToD3DSemantic()
+{
+ gl::Shader *vertexShader = mState.getAttachedShader(gl::ShaderType::Vertex);
+ ASSERT(vertexShader != nullptr);
+
+ // Init semantic index
+ int semanticIndex = 0;
+ for (const sh::Attribute &attribute : vertexShader->getActiveAttributes())
+ {
+ int regCount = gl::VariableRegisterCount(attribute.type);
+ GLuint location = mState.getAttributeLocation(attribute.name);
+ ASSERT(location != std::numeric_limits<GLuint>::max());
+
+ for (int reg = 0; reg < regCount; ++reg)
+ {
+ mAttribLocationToD3DSemantic[location + reg] = semanticIndex++;
+ }
+ }
+}
+
+void ProgramD3D::updateCachedInputLayout(Serial associatedSerial, const gl::State &state)
+{
+ if (mCurrentVertexArrayStateSerial == associatedSerial)
+ {
+ return;
+ }
+
+ mCurrentVertexArrayStateSerial = associatedSerial;
+ mCachedInputLayout.clear();
+
+ const auto &vertexAttributes = state.getVertexArray()->getVertexAttributes();
+
+ for (size_t locationIndex : mState.getActiveAttribLocationsMask())
+ {
+ int d3dSemantic = mAttribLocationToD3DSemantic[locationIndex];
+
+ if (d3dSemantic != -1)
+ {
+ if (mCachedInputLayout.size() < static_cast<size_t>(d3dSemantic + 1))
+ {
+ mCachedInputLayout.resize(d3dSemantic + 1, angle::FormatID::NONE);
+ }
+ mCachedInputLayout[d3dSemantic] =
+ GetVertexFormatID(vertexAttributes[locationIndex],
+ state.getVertexAttribCurrentValue(locationIndex).Type);
+ }
+ }
+
+ VertexExecutable::getSignature(mRenderer, mCachedInputLayout, &mCachedVertexSignature);
+
+ updateCachedVertexExecutableIndex();
+}
+
+void ProgramD3D::updateCachedOutputLayout(const gl::Context *context,
+ const gl::Framebuffer *framebuffer)
+{
+ mPixelShaderOutputLayoutCache.clear();
+
+ FramebufferD3D *fboD3D = GetImplAs<FramebufferD3D>(framebuffer);
+ const auto &colorbuffers = fboD3D->getColorAttachmentsForRender(context);
+
+ for (size_t colorAttachment = 0; colorAttachment < colorbuffers.size(); ++colorAttachment)
+ {
+ const gl::FramebufferAttachment *colorbuffer = colorbuffers[colorAttachment];
+
+ if (colorbuffer)
+ {
+ auto binding = colorbuffer->getBinding() == GL_BACK ? GL_COLOR_ATTACHMENT0
+ : colorbuffer->getBinding();
+ size_t maxIndex = binding != GL_NONE ? GetMaxOutputIndex(mPixelShaderKey,
+ binding - GL_COLOR_ATTACHMENT0)
+ : 0;
+ mPixelShaderOutputLayoutCache.insert(mPixelShaderOutputLayoutCache.end(), maxIndex + 1,
+ binding);
+ }
+ else
+ {
+ mPixelShaderOutputLayoutCache.push_back(GL_NONE);
+ }
+ }
+
+ updateCachedPixelExecutableIndex();
+}
+
+void ProgramD3D::updateCachedComputeImage2DBindLayout(const gl::Context *context)
+{
+ const auto &glState = context->getState();
+ for (auto &image2DBindLayout : mComputeShaderImage2DBindLayoutCache)
+ {
+ const gl::ImageUnit &imageUnit = glState.getImageUnit(image2DBindLayout.first);
+ if (imageUnit.texture.get())
+ {
+ image2DBindLayout.second = imageUnit.texture->getType();
+ }
+ else
+ {
+ image2DBindLayout.second = gl::TextureType::_2D;
+ }
+ }
+
+ updateCachedComputeExecutableIndex();
+}
+
+void ProgramD3D::gatherTransformFeedbackVaryings(const gl::VaryingPacking &varyingPacking,
+ const BuiltinInfo &builtins)
+{
+ const std::string &varyingSemantic =
+ GetVaryingSemantic(mRenderer->getMajorShaderModel(), usesPointSize());
+
+ // Gather the linked varyings that are used for transform feedback, they should all exist.
+ mStreamOutVaryings.clear();
+
+ const auto &tfVaryingNames = mState.getTransformFeedbackVaryingNames();
+ for (unsigned int outputSlot = 0; outputSlot < static_cast<unsigned int>(tfVaryingNames.size());
+ ++outputSlot)
+ {
+ const auto &tfVaryingName = tfVaryingNames[outputSlot];
+ if (tfVaryingName == "gl_Position")
+ {
+ if (builtins.glPosition.enabled)
+ {
+ mStreamOutVaryings.emplace_back(builtins.glPosition.semantic,
+ builtins.glPosition.index, 4, outputSlot);
+ }
+ }
+ else if (tfVaryingName == "gl_FragCoord")
+ {
+ if (builtins.glFragCoord.enabled)
+ {
+ mStreamOutVaryings.emplace_back(builtins.glFragCoord.semantic,
+ builtins.glFragCoord.index, 4, outputSlot);
+ }
+ }
+ else if (tfVaryingName == "gl_PointSize")
+ {
+ if (builtins.glPointSize.enabled)
+ {
+ mStreamOutVaryings.emplace_back("PSIZE", 0, 1, outputSlot);
+ }
+ }
+ else
+ {
+ const auto &registerInfos = varyingPacking.getRegisterList();
+ for (GLuint registerIndex = 0u; registerIndex < registerInfos.size(); ++registerIndex)
+ {
+ const auto &registerInfo = registerInfos[registerIndex];
+ const auto &varying = *registerInfo.packedVarying->varying;
+ GLenum transposedType = gl::TransposeMatrixType(varying.type);
+ int componentCount = gl::VariableColumnCount(transposedType);
+ ASSERT(!varying.isBuiltIn() && !varying.isStruct());
+
+ // There can be more than one register assigned to a particular varying, and each
+ // register needs its own stream out entry.
+ if (registerInfo.tfVaryingName() == tfVaryingName)
+ {
+ mStreamOutVaryings.emplace_back(varyingSemantic, registerIndex, componentCount,
+ outputSlot);
+ }
+ }
+ }
+ }
+}
+
+D3DUniform *ProgramD3D::getD3DUniformFromLocation(GLint location)
+{
+ return mD3DUniforms[mState.getUniformLocations()[location].index];
+}
+
+const D3DUniform *ProgramD3D::getD3DUniformFromLocation(GLint location) const
+{
+ return mD3DUniforms[mState.getUniformLocations()[location].index];
+}
+
+void ProgramD3D::setPathFragmentInputGen(const std::string &inputName,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ UNREACHABLE();
+}
+
+bool ProgramD3D::hasVertexExecutableForCachedInputLayout()
+{
+ return mCachedVertexExecutableIndex.valid();
+}
+
+bool ProgramD3D::hasGeometryExecutableForPrimitiveType(const gl::State &state,
+ gl::PrimitiveMode drawMode)
+{
+ if (!usesGeometryShader(state, drawMode))
+ {
+ // No shader necessary mean we have the required (null) executable.
+ return true;
+ }
+
+ gl::PrimitiveMode geometryShaderType = GetGeometryShaderTypeFromDrawMode(drawMode);
+ return mGeometryExecutables[geometryShaderType].get() != nullptr;
+}
+
+bool ProgramD3D::hasPixelExecutableForCachedOutputLayout()
+{
+ return mCachedPixelExecutableIndex.valid();
+}
+
+bool ProgramD3D::hasComputeExecutableForCachedImage2DBindLayout()
+{
+ return mCachedComputeExecutableIndex.valid();
+}
+
+template <typename DestT>
+void ProgramD3D::getUniformInternal(GLint location, DestT *dataOut) const
+{
+ const gl::VariableLocation &locationInfo = mState.getUniformLocations()[location];
+ const gl::LinkedUniform &uniform = mState.getUniforms()[locationInfo.index];
+
+ const D3DUniform *targetUniform = getD3DUniformFromLocation(location);
+ const uint8_t *srcPointer = targetUniform->getDataPtrToElement(locationInfo.arrayIndex);
+
+ if (gl::IsMatrixType(uniform.type))
+ {
+ GetMatrixUniform(uniform.type, dataOut, reinterpret_cast<const DestT *>(srcPointer), true);
+ }
+ else
+ {
+ memcpy(dataOut, srcPointer, uniform.getElementSize());
+ }
+}
+
+void ProgramD3D::getUniformfv(const gl::Context *context, GLint location, GLfloat *params) const
+{
+ getUniformInternal(location, params);
+}
+
+void ProgramD3D::getUniformiv(const gl::Context *context, GLint location, GLint *params) const
+{
+ getUniformInternal(location, params);
+}
+
+void ProgramD3D::getUniformuiv(const gl::Context *context, GLint location, GLuint *params) const
+{
+ getUniformInternal(location, params);
+}
+
+void ProgramD3D::updateCachedVertexExecutableIndex()
+{
+ mCachedVertexExecutableIndex.reset();
+ for (size_t executableIndex = 0; executableIndex < mVertexExecutables.size(); executableIndex++)
+ {
+ if (mVertexExecutables[executableIndex]->matchesSignature(mCachedVertexSignature))
+ {
+ mCachedVertexExecutableIndex = executableIndex;
+ break;
+ }
+ }
+}
+
+void ProgramD3D::updateCachedPixelExecutableIndex()
+{
+ mCachedPixelExecutableIndex.reset();
+ for (size_t executableIndex = 0; executableIndex < mPixelExecutables.size(); executableIndex++)
+ {
+ if (mPixelExecutables[executableIndex]->matchesSignature(mPixelShaderOutputLayoutCache))
+ {
+ mCachedPixelExecutableIndex = executableIndex;
+ break;
+ }
+ }
+}
+
+void ProgramD3D::updateCachedComputeExecutableIndex()
+{
+ mCachedComputeExecutableIndex.reset();
+ for (size_t executableIndex = 0; executableIndex < mComputeExecutables.size();
+ executableIndex++)
+ {
+ if (mComputeExecutables[executableIndex]->matchesSignature(
+ mComputeShaderImage2DBindLayoutCache))
+ {
+ mCachedComputeExecutableIndex = executableIndex;
+ break;
+ }
+ }
+}
+
+void ProgramD3D::linkResources(const gl::ProgramLinkedResources &resources)
+{
+ HLSLBlockLayoutEncoderFactory hlslEncoderFactory;
+ gl::ProgramLinkedResourcesLinker linker(&hlslEncoderFactory);
+
+ linker.linkResources(mState, resources);
+
+ initializeUniformBlocks();
+ initializeShaderStorageBlocks();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h
new file mode 100644
index 0000000000..d8d4800122
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h
@@ -0,0 +1,580 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ProgramD3D.h: Defines the rx::ProgramD3D class which implements rx::ProgramImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_PROGRAMD3D_H_
+#define LIBANGLE_RENDERER_D3D_PROGRAMD3D_H_
+
+#include <string>
+#include <vector>
+
+#include "compiler/translator/blocklayoutHLSL.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/ProgramImpl.h"
+#include "libANGLE/renderer/d3d/DynamicHLSL.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "platform/FeaturesD3D.h"
+
+namespace rx
+{
+class RendererD3D;
+class UniformStorageD3D;
+class ShaderExecutableD3D;
+
+#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+// WARNING: D3DCOMPILE_OPTIMIZATION_LEVEL3 may lead to a DX9 shader compiler hang.
+// It should only be used selectively to work around specific bugs.
+# define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL1
+#endif
+
+enum class HLSLRegisterType : uint8_t
+{
+ None = 0,
+ Texture = 1,
+ UnorderedAccessView = 2
+};
+
+// Helper struct representing a single shader uniform
+// TODO(jmadill): Make uniform blocks shared between all programs, so we don't need separate
+// register indices.
+struct D3DUniform : private angle::NonCopyable
+{
+ D3DUniform(GLenum type,
+ HLSLRegisterType reg,
+ const std::string &nameIn,
+ const std::vector<unsigned int> &arraySizesIn,
+ bool defaultBlock);
+ ~D3DUniform();
+
+ bool isSampler() const;
+ bool isImage() const;
+ bool isImage2D() const;
+ bool isArray() const { return !arraySizes.empty(); }
+ unsigned int getArraySizeProduct() const;
+ bool isReferencedByShader(gl::ShaderType shaderType) const;
+
+ const uint8_t *firstNonNullData() const;
+ const uint8_t *getDataPtrToElement(size_t elementIndex) const;
+
+ // Duplicated from the GL layer
+ const gl::UniformTypeInfo &typeInfo;
+ std::string name; // Names of arrays don't include [0], unlike at the GL layer.
+ std::vector<unsigned int> arraySizes;
+
+ // Pointer to a system copies of the data. Separate pointers for each uniform storage type.
+ gl::ShaderMap<uint8_t *> mShaderData;
+
+ // Register information.
+ HLSLRegisterType regType;
+ gl::ShaderMap<unsigned int> mShaderRegisterIndexes;
+ unsigned int registerCount;
+
+ // 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;
+
+ // Special buffer for sampler values.
+ std::vector<GLint> mSamplerData;
+};
+
+struct D3DInterfaceBlock
+{
+ D3DInterfaceBlock();
+ D3DInterfaceBlock(const D3DInterfaceBlock &other);
+
+ bool activeInShader(gl::ShaderType shaderType) const
+ {
+ return mShaderRegisterIndexes[shaderType] != GL_INVALID_INDEX;
+ }
+
+ gl::ShaderMap<unsigned int> mShaderRegisterIndexes;
+};
+
+struct D3DVarying final
+{
+ D3DVarying();
+ D3DVarying(const std::string &semanticNameIn,
+ unsigned int semanticIndexIn,
+ unsigned int componentCountIn,
+ unsigned int outputSlotIn);
+
+ D3DVarying(const D3DVarying &) = default;
+ D3DVarying &operator=(const D3DVarying &) = default;
+
+ std::string semanticName;
+ unsigned int semanticIndex;
+ unsigned int componentCount;
+ unsigned int outputSlot;
+};
+
+class ProgramD3DMetadata final : angle::NonCopyable
+{
+ public:
+ ProgramD3DMetadata(RendererD3D *renderer,
+ const gl::ShaderMap<const ShaderD3D *> &attachedShaders);
+ ~ProgramD3DMetadata();
+
+ int getRendererMajorShaderModel() const;
+ bool usesBroadcast(const gl::State &data) const;
+ bool usesSecondaryColor() const;
+ bool usesFragDepth() const;
+ bool usesPointCoord() const;
+ bool usesFragCoord() const;
+ bool usesPointSize() const;
+ bool usesInsertedPointCoordValue() const;
+ bool usesViewScale() const;
+ bool hasANGLEMultiviewEnabled() const;
+ bool usesVertexID() const;
+ bool usesViewID() const;
+ bool canSelectViewInVertexShader() const;
+ bool addsPointCoordToVertexShader() const;
+ bool usesTransformFeedbackGLPosition() const;
+ bool usesSystemValuePointSize() const;
+ bool usesMultipleFragmentOuts() const;
+ GLint getMajorShaderVersion() const;
+ const ShaderD3D *getFragmentShader() const;
+
+ private:
+ const int mRendererMajorShaderModel;
+ const std::string mShaderModelSuffix;
+ const bool mUsesInstancedPointSpriteEmulation;
+ const bool mUsesViewScale;
+ const bool mCanSelectViewInVertexShader;
+ const gl::ShaderMap<const ShaderD3D *> mAttachedShaders;
+};
+
+using D3DUniformMap = std::map<std::string, D3DUniform *>;
+
+class ProgramD3D : public ProgramImpl
+{
+ public:
+ ProgramD3D(const gl::ProgramState &data, RendererD3D *renderer);
+ ~ProgramD3D() override;
+
+ const std::vector<PixelShaderOutputVariable> &getPixelShaderKey() { return mPixelShaderKey; }
+
+ GLint getSamplerMapping(gl::ShaderType type,
+ unsigned int samplerIndex,
+ const gl::Caps &caps) const;
+ gl::TextureType getSamplerTextureType(gl::ShaderType type, unsigned int samplerIndex) const;
+ gl::RangeUI getUsedSamplerRange(gl::ShaderType type) const;
+
+ enum SamplerMapping
+ {
+ WasDirty,
+ WasClean,
+ };
+
+ SamplerMapping updateSamplerMapping();
+
+ GLint getImageMapping(gl::ShaderType type,
+ unsigned int imageIndex,
+ bool readonly,
+ const gl::Caps &caps) const;
+ gl::RangeUI getUsedImageRange(gl::ShaderType type, bool readonly) const;
+
+ bool usesPointSize() const { return mUsesPointSize; }
+ bool usesPointSpriteEmulation() const;
+ bool usesGeometryShader(const gl::State &state, gl::PrimitiveMode drawMode) const;
+ bool usesGeometryShaderForPointSpriteEmulation() const;
+ bool usesGetDimensionsIgnoresBaseLevel() const;
+ bool usesInstancedPointSpriteEmulation() const;
+
+ std::unique_ptr<LinkEvent> load(const gl::Context *context,
+ gl::BinaryInputStream *stream,
+ gl::InfoLog &infoLog) override;
+ void save(const gl::Context *context, gl::BinaryOutputStream *stream) override;
+ void setBinaryRetrievableHint(bool retrievable) override;
+ void setSeparable(bool separable) override;
+
+ angle::Result getVertexExecutableForCachedInputLayout(d3d::Context *context,
+ ShaderExecutableD3D **outExectuable,
+ gl::InfoLog *infoLog);
+ angle::Result getGeometryExecutableForPrimitiveType(d3d::Context *errContext,
+ const gl::State &state,
+ gl::PrimitiveMode drawMode,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog);
+ angle::Result getPixelExecutableForCachedOutputLayout(d3d::Context *context,
+ ShaderExecutableD3D **outExectuable,
+ gl::InfoLog *infoLog);
+ angle::Result getComputeExecutableForImage2DBindLayout(d3d::Context *context,
+ ShaderExecutableD3D **outExecutable,
+ gl::InfoLog *infoLog);
+ std::unique_ptr<LinkEvent> link(const gl::Context *context,
+ const gl::ProgramLinkedResources &resources,
+ gl::InfoLog &infoLog) override;
+ GLboolean validate(const gl::Caps &caps, gl::InfoLog *infoLog) override;
+
+ void setPathFragmentInputGen(const std::string &inputName,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs) override;
+
+ void updateUniformBufferCache(const gl::Caps &caps,
+ const gl::ShaderMap<unsigned int> &reservedShaderRegisterIndexes);
+
+ unsigned int getAtomicCounterBufferRegisterIndex(GLuint binding,
+ gl::ShaderType shaderType) const;
+
+ unsigned int getShaderStorageBufferRegisterIndex(GLuint blockIndex,
+ gl::ShaderType shaderType) const;
+ const std::vector<GLint> &getShaderUniformBufferCache(gl::ShaderType shaderType) const;
+
+ void dirtyAllUniforms();
+
+ void setUniform1fv(GLint location, GLsizei count, const GLfloat *v) override;
+ void setUniform2fv(GLint location, GLsizei count, const GLfloat *v) override;
+ void setUniform3fv(GLint location, GLsizei count, const GLfloat *v) override;
+ void setUniform4fv(GLint location, GLsizei count, const GLfloat *v) override;
+ void setUniform1iv(GLint location, GLsizei count, const GLint *v) override;
+ void setUniform2iv(GLint location, GLsizei count, const GLint *v) override;
+ void setUniform3iv(GLint location, GLsizei count, const GLint *v) override;
+ void setUniform4iv(GLint location, GLsizei count, const GLint *v) override;
+ void setUniform1uiv(GLint location, GLsizei count, const GLuint *v) override;
+ void setUniform2uiv(GLint location, GLsizei count, const GLuint *v) override;
+ void setUniform3uiv(GLint location, GLsizei count, const GLuint *v) override;
+ void setUniform4uiv(GLint location, GLsizei count, const GLuint *v) override;
+ void setUniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+ void setUniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value) override;
+
+ void getUniformfv(const gl::Context *context, GLint location, GLfloat *params) const override;
+ void getUniformiv(const gl::Context *context, GLint location, GLint *params) const override;
+ void getUniformuiv(const gl::Context *context, GLint location, GLuint *params) const override;
+
+ UniformStorageD3D *getShaderUniformStorage(gl::ShaderType shaderType) const
+ {
+ return mShaderUniformStorages[shaderType].get();
+ }
+
+ unsigned int getSerial() const;
+
+ const AttribIndexArray &getAttribLocationToD3DSemantics() const
+ {
+ return mAttribLocationToD3DSemantic;
+ }
+
+ void updateCachedInputLayout(Serial associatedSerial, const gl::State &state);
+ void updateCachedOutputLayout(const gl::Context *context, const gl::Framebuffer *framebuffer);
+ void updateCachedComputeImage2DBindLayout(const gl::Context *context);
+
+ bool isSamplerMappingDirty() { return mDirtySamplerMapping; }
+
+ // Checks if we need to recompile certain shaders.
+ bool hasVertexExecutableForCachedInputLayout();
+ bool hasGeometryExecutableForPrimitiveType(const gl::State &state, gl::PrimitiveMode drawMode);
+ bool hasPixelExecutableForCachedOutputLayout();
+ bool hasComputeExecutableForCachedImage2DBindLayout();
+
+ bool anyShaderUniformsDirty() const { return mShaderUniformsDirty.any(); }
+
+ bool areShaderUniformsDirty(gl::ShaderType shaderType) const
+ {
+ return mShaderUniformsDirty[shaderType];
+ }
+ const std::vector<D3DUniform *> &getD3DUniforms() const { return mD3DUniforms; }
+ void markUniformsClean();
+
+ const gl::ProgramState &getState() const { return mState; }
+
+ bool hasShaderStage(gl::ShaderType shaderType) const
+ {
+ return mState.getLinkedShaderStages()[shaderType];
+ }
+
+ void assignImage2DRegisters(unsigned int startImageIndex,
+ int startLogicalImageUnit,
+ bool readonly);
+ bool hasNamedUniform(const std::string &name);
+
+ bool usesVertexID() const { return mUsesVertexID; }
+
+ private:
+ // These forward-declared tasks are used for multi-thread shader compiles.
+ class GetExecutableTask;
+ class GetVertexExecutableTask;
+ class GetPixelExecutableTask;
+ class GetGeometryExecutableTask;
+ class GetComputeExecutableTask;
+ class GraphicsProgramLinkEvent;
+ class ComputeProgramLinkEvent;
+
+ class LoadBinaryTask;
+ class LoadBinaryLinkEvent;
+
+ class VertexExecutable
+ {
+ public:
+ enum HLSLAttribType
+ {
+ FLOAT,
+ UNSIGNED_INT,
+ SIGNED_INT,
+ };
+
+ typedef std::vector<HLSLAttribType> Signature;
+
+ VertexExecutable(const gl::InputLayout &inputLayout,
+ const Signature &signature,
+ ShaderExecutableD3D *shaderExecutable);
+ ~VertexExecutable();
+
+ bool matchesSignature(const Signature &signature) const;
+ static void getSignature(RendererD3D *renderer,
+ const gl::InputLayout &inputLayout,
+ Signature *signatureOut);
+
+ const gl::InputLayout &inputs() const { return mInputs; }
+ const Signature &signature() const { return mSignature; }
+ ShaderExecutableD3D *shaderExecutable() const { return mShaderExecutable; }
+
+ private:
+ static HLSLAttribType GetAttribType(GLenum type);
+
+ gl::InputLayout mInputs;
+ Signature mSignature;
+ ShaderExecutableD3D *mShaderExecutable;
+ };
+
+ class PixelExecutable
+ {
+ public:
+ PixelExecutable(const std::vector<GLenum> &outputSignature,
+ ShaderExecutableD3D *shaderExecutable);
+ ~PixelExecutable();
+
+ bool matchesSignature(const std::vector<GLenum> &signature) const
+ {
+ return mOutputSignature == signature;
+ }
+
+ const std::vector<GLenum> &outputSignature() const { return mOutputSignature; }
+ ShaderExecutableD3D *shaderExecutable() const { return mShaderExecutable; }
+
+ private:
+ std::vector<GLenum> mOutputSignature;
+ ShaderExecutableD3D *mShaderExecutable;
+ };
+
+ class ComputeExecutable
+ {
+ public:
+ ComputeExecutable(const gl::ImageUnitTextureTypeMap &signature,
+ std::unique_ptr<ShaderExecutableD3D> shaderExecutable);
+ ~ComputeExecutable();
+
+ bool matchesSignature(const gl::ImageUnitTextureTypeMap &signature) const
+ {
+ return mSignature == signature;
+ }
+
+ const gl::ImageUnitTextureTypeMap &signature() const { return mSignature; }
+ ShaderExecutableD3D *shaderExecutable() const { return mShaderExecutable.get(); }
+
+ private:
+ gl::ImageUnitTextureTypeMap mSignature;
+ std::unique_ptr<ShaderExecutableD3D> mShaderExecutable;
+ };
+
+ struct Sampler
+ {
+ Sampler();
+
+ bool active;
+ GLint logicalTextureUnit;
+ gl::TextureType textureType;
+ };
+
+ struct Image
+ {
+ Image();
+ bool active;
+ GLint logicalImageUnit;
+ };
+
+ void initializeUniformStorage(const gl::ShaderBitSet &availableShaderStages);
+
+ void defineUniformsAndAssignRegisters();
+ void defineUniformBase(const gl::Shader *shader,
+ const sh::Uniform &uniform,
+ D3DUniformMap *uniformMap);
+ void assignAllSamplerRegisters();
+ void assignSamplerRegisters(size_t uniformIndex);
+
+ static void AssignSamplers(unsigned int startSamplerIndex,
+ const gl::UniformTypeInfo &typeInfo,
+ unsigned int samplerCount,
+ std::vector<Sampler> &outSamplers,
+ gl::RangeUI *outUsedRange);
+
+ void assignAllImageRegisters();
+ void assignAllAtomicCounterRegisters();
+ void assignImageRegisters(size_t uniformIndex);
+ static void AssignImages(unsigned int startImageIndex,
+ int startLogicalImageUnit,
+ unsigned int imageCount,
+ std::vector<Image> &outImages,
+ gl::RangeUI *outUsedRange);
+
+ template <typename DestT>
+ void getUniformInternal(GLint location, DestT *dataOut) const;
+
+ template <typename T>
+ void setUniformImpl(const gl::VariableLocation &locationInfo,
+ GLsizei count,
+ const T *v,
+ uint8_t *targetData,
+ GLenum uniformType);
+
+ template <typename T>
+ void setUniformInternal(GLint location, GLsizei count, const T *v, GLenum uniformType);
+
+ template <int cols, int rows>
+ void setUniformMatrixfvInternal(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+ std::unique_ptr<LinkEvent> compileProgramExecutables(const gl::Context *context,
+ gl::InfoLog &infoLog);
+ std::unique_ptr<LinkEvent> compileComputeExecutable(const gl::Context *context,
+ gl::InfoLog &infoLog);
+
+ angle::Result loadBinaryShaderExecutables(d3d::Context *contextD3D,
+ gl::BinaryInputStream *stream,
+ gl::InfoLog &infoLog);
+
+ void gatherTransformFeedbackVaryings(const gl::VaryingPacking &varyings,
+ const BuiltinInfo &builtins);
+ D3DUniform *getD3DUniformFromLocation(GLint location);
+ const D3DUniform *getD3DUniformFromLocation(GLint location) const;
+
+ void initAttribLocationsToD3DSemantic();
+
+ void reset();
+ void initializeUniformBlocks();
+ void initializeShaderStorageBlocks();
+
+ void updateCachedInputLayoutFromShader();
+ void updateCachedOutputLayoutFromShader();
+ void updateCachedImage2DBindLayoutFromComputeShader();
+ void updateCachedVertexExecutableIndex();
+ void updateCachedPixelExecutableIndex();
+ void updateCachedComputeExecutableIndex();
+
+ void linkResources(const gl::ProgramLinkedResources &resources);
+
+ RendererD3D *mRenderer;
+ DynamicHLSL *mDynamicHLSL;
+
+ std::vector<std::unique_ptr<VertexExecutable>> mVertexExecutables;
+ std::vector<std::unique_ptr<PixelExecutable>> mPixelExecutables;
+ angle::PackedEnumMap<gl::PrimitiveMode, std::unique_ptr<ShaderExecutableD3D>>
+ mGeometryExecutables;
+ std::vector<std::unique_ptr<ComputeExecutable>> mComputeExecutables;
+
+ gl::ShaderMap<std::string> mShaderHLSL;
+ gl::ShaderMap<angle::CompilerWorkaroundsD3D> mShaderWorkarounds;
+
+ bool mUsesFragDepth;
+ bool mHasANGLEMultiviewEnabled;
+ bool mUsesVertexID;
+ bool mUsesViewID;
+ std::vector<PixelShaderOutputVariable> mPixelShaderKey;
+
+ // Common code for all dynamic geometry shaders. Consists mainly of the GS input and output
+ // structures, built from the linked varying info. We store the string itself instead of the
+ // packed varyings for simplicity.
+ std::string mGeometryShaderPreamble;
+
+ bool mUsesPointSize;
+ bool mUsesFlatInterpolation;
+
+ gl::ShaderMap<std::unique_ptr<UniformStorageD3D>> mShaderUniformStorages;
+
+ gl::ShaderMap<std::vector<Sampler>> mShaderSamplers;
+ gl::ShaderMap<gl::RangeUI> mUsedShaderSamplerRanges;
+ bool mDirtySamplerMapping;
+
+ std::vector<Image> mImagesCS;
+ std::vector<Image> mReadonlyImagesCS;
+ gl::RangeUI mUsedComputeImageRange;
+ gl::RangeUI mUsedComputeReadonlyImageRange;
+ gl::RangeUI mUsedComputeAtomicCounterRange;
+
+ // Cache for pixel shader output layout to save reallocations.
+ std::vector<GLenum> mPixelShaderOutputLayoutCache;
+ Optional<size_t> mCachedPixelExecutableIndex;
+
+ AttribIndexArray mAttribLocationToD3DSemantic;
+
+ unsigned int mSerial;
+
+ gl::ShaderMap<std::vector<int>> mShaderUBOCaches;
+ VertexExecutable::Signature mCachedVertexSignature;
+ gl::InputLayout mCachedInputLayout;
+ Optional<size_t> mCachedVertexExecutableIndex;
+
+ std::vector<D3DVarying> mStreamOutVaryings;
+ std::vector<D3DUniform *> mD3DUniforms;
+ std::map<std::string, int> mImageBindingMap;
+ std::map<std::string, int> mAtomicBindingMap;
+ std::vector<D3DInterfaceBlock> mD3DUniformBlocks;
+ std::vector<D3DInterfaceBlock> mD3DShaderStorageBlocks;
+ std::array<unsigned int, gl::IMPLEMENTATION_MAX_ATOMIC_COUNTER_BUFFERS>
+ mComputeAtomicCounterBufferRegisterIndices;
+
+ std::vector<sh::Uniform> mImage2DUniforms;
+ gl::ImageUnitTextureTypeMap mComputeShaderImage2DBindLayoutCache;
+ Optional<size_t> mCachedComputeExecutableIndex;
+
+ gl::ShaderBitSet mShaderUniformsDirty;
+
+ static unsigned int issueSerial();
+ static unsigned int mCurrentSerial;
+
+ Serial mCurrentVertexArrayStateSerial;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_PROGRAMD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp
new file mode 100644
index 0000000000..f8606c1f28
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp
@@ -0,0 +1,31 @@
+//
+// Copyright (c) 2012-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTargetD3D.cpp: Implements serial handling for rx::RenderTargetD3D
+
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+
+namespace rx
+{
+unsigned int RenderTargetD3D::mCurrentSerial = 1;
+
+RenderTargetD3D::RenderTargetD3D() : mSerial(issueSerials(1)) {}
+
+RenderTargetD3D::~RenderTargetD3D() {}
+
+unsigned int RenderTargetD3D::getSerial() const
+{
+ return mSerial;
+}
+
+unsigned int RenderTargetD3D::issueSerials(unsigned int count)
+{
+ unsigned int firstSerial = mCurrentSerial;
+ mCurrentSerial += count;
+ return firstSerial;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h
new file mode 100644
index 0000000000..8442df7262
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2012-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTargetD3D.h: Defines an abstract wrapper class to manage IDirect3DSurface9
+// and ID3D11View objects belonging to renderbuffers and renderable textures.
+
+#ifndef LIBANGLE_RENDERER_D3D_RENDERTARGETD3D_H_
+#define LIBANGLE_RENDERER_D3D_RENDERTARGETD3D_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/angletypes.h"
+
+namespace rx
+{
+
+class RenderTargetD3D : public FramebufferAttachmentRenderTarget
+{
+ public:
+ RenderTargetD3D();
+ ~RenderTargetD3D() override;
+
+ virtual GLsizei getWidth() const = 0;
+ virtual GLsizei getHeight() const = 0;
+ virtual GLsizei getDepth() const = 0;
+ virtual GLenum getInternalFormat() const = 0;
+ virtual GLsizei getSamples() const = 0;
+ gl::Extents getExtents() const { return gl::Extents(getWidth(), getHeight(), getDepth()); }
+ bool isMultisampled() const { return getSamples() > 0; }
+
+ virtual unsigned int getSerial() const;
+ static unsigned int issueSerials(unsigned int count);
+
+ private:
+ const unsigned int mSerial;
+ static unsigned int mCurrentSerial;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_RENDERTARGETD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
new file mode 100644
index 0000000000..a91a7be9b2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp
@@ -0,0 +1,117 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderbufferD3d.cpp: Implements the RenderbufferD3D class, a specialization of RenderbufferImpl
+
+#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+#include "libANGLE/renderer/d3d/EGLImageD3D.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+RenderbufferD3D::RenderbufferD3D(const gl::RenderbufferState &state, RendererD3D *renderer)
+ : RenderbufferImpl(state), mRenderer(renderer), mRenderTarget(nullptr), mImage(nullptr)
+{}
+
+RenderbufferD3D::~RenderbufferD3D()
+{
+ SafeDelete(mRenderTarget);
+ mImage = nullptr;
+}
+
+void RenderbufferD3D::onDestroy(const gl::Context *context)
+{
+ SafeDelete(mRenderTarget);
+}
+
+angle::Result RenderbufferD3D::setStorage(const gl::Context *context,
+ GLenum internalformat,
+ size_t width,
+ size_t height)
+{
+ return setStorageMultisample(context, 0, internalformat, width, height);
+}
+
+angle::Result RenderbufferD3D::setStorageMultisample(const gl::Context *context,
+ size_t samples,
+ GLenum internalformat,
+ size_t width,
+ size_t height)
+{
+ // If the renderbuffer parameters are queried, the calling function
+ // will expect one of the valid renderbuffer formats for use in
+ // glRenderbufferStorage, but we should create depth and stencil buffers
+ // as DEPTH24_STENCIL8
+ GLenum creationFormat = internalformat;
+ if (internalformat == GL_DEPTH_COMPONENT16 || internalformat == GL_STENCIL_INDEX8)
+ {
+ creationFormat = GL_DEPTH24_STENCIL8_OES;
+ }
+
+ // ANGLE_framebuffer_multisample states GL_OUT_OF_MEMORY is generated on a failure to create
+ // the specified storage.
+ // Because ES 3.0 already knows the exact number of supported samples, it would already have
+ // been validated and generated GL_INVALID_VALUE.
+ const gl::TextureCaps &formatCaps = mRenderer->getNativeTextureCaps().get(creationFormat);
+ ANGLE_CHECK_GL_ALLOC(GetImplAs<ContextD3D>(context), samples <= formatCaps.getMaxSamples());
+
+ RenderTargetD3D *newRT = nullptr;
+ ANGLE_TRY(mRenderer->createRenderTarget(context, static_cast<int>(width),
+ static_cast<int>(height), creationFormat,
+ static_cast<GLsizei>(samples), &newRT));
+
+ SafeDelete(mRenderTarget);
+ mImage = nullptr;
+ mRenderTarget = newRT;
+
+ return angle::Result::Continue;
+}
+
+angle::Result RenderbufferD3D::setStorageEGLImageTarget(const gl::Context *context,
+ egl::Image *image)
+{
+ mImage = GetImplAs<EGLImageD3D>(image);
+ SafeDelete(mRenderTarget);
+
+ return angle::Result::Continue;
+}
+
+angle::Result RenderbufferD3D::getRenderTarget(const gl::Context *context,
+ RenderTargetD3D **outRenderTarget)
+{
+ if (mImage)
+ {
+ return mImage->getRenderTarget(context, outRenderTarget);
+ }
+ else
+ {
+ *outRenderTarget = mRenderTarget;
+ return angle::Result::Continue;
+ }
+}
+
+angle::Result RenderbufferD3D::getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut)
+{
+ return getRenderTarget(context, reinterpret_cast<RenderTargetD3D **>(rtOut));
+}
+
+angle::Result RenderbufferD3D::initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex)
+{
+ RenderTargetD3D *renderTarget = nullptr;
+ ANGLE_TRY(getRenderTarget(context, &renderTarget));
+ return mRenderer->initRenderTarget(context, renderTarget);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.h
new file mode 100644
index 0000000000..e84f3998f2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.h
@@ -0,0 +1,60 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderbufferD3d.h: Defines the RenderbufferD3D class which implements RenderbufferImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_RENDERBUFFERD3D_H_
+#define LIBANGLE_RENDERER_D3D_RENDERBUFFERD3D_H_
+
+#include "angle_gl.h"
+
+#include "common/angleutils.h"
+#include "libANGLE/renderer/RenderbufferImpl.h"
+
+namespace rx
+{
+class EGLImageD3D;
+class RendererD3D;
+class RenderTargetD3D;
+class SwapChainD3D;
+
+class RenderbufferD3D : public RenderbufferImpl
+{
+ public:
+ RenderbufferD3D(const gl::RenderbufferState &state, RendererD3D *renderer);
+ ~RenderbufferD3D() override;
+
+ void onDestroy(const gl::Context *context) override;
+
+ angle::Result setStorage(const gl::Context *context,
+ GLenum internalformat,
+ size_t width,
+ size_t height) override;
+ angle::Result setStorageMultisample(const gl::Context *context,
+ size_t samples,
+ GLenum internalformat,
+ size_t width,
+ size_t height) override;
+ angle::Result setStorageEGLImageTarget(const gl::Context *context, egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context, RenderTargetD3D **outRenderTarget);
+ angle::Result getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut) override;
+
+ angle::Result initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex) override;
+
+ private:
+ RendererD3D *mRenderer;
+ RenderTargetD3D *mRenderTarget;
+ EGLImageD3D *mImage;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_RENDERBUFFERD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp
new file mode 100644
index 0000000000..fa464763c3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp
@@ -0,0 +1,250 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RendererD3D.cpp: Implementation of the base D3D Renderer.
+
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+#include "common/MemoryBuffer.h"
+#include "common/debug.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/ImageIndex.h"
+#include "libANGLE/ResourceManager.h"
+#include "libANGLE/State.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/TextureImpl.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/DeviceD3D.h"
+#include "libANGLE/renderer/d3d/DisplayD3D.h"
+#include "libANGLE/renderer/d3d/IndexDataManager.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/SamplerD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+
+namespace rx
+{
+
+RendererD3D::RendererD3D(egl::Display *display)
+ : mDisplay(display),
+ mPresentPathFastEnabled(false),
+ mCapsInitialized(false),
+ mFeaturesInitialized(false),
+ mDisjoint(false),
+ mDeviceLost(false)
+{}
+
+RendererD3D::~RendererD3D() {}
+
+bool RendererD3D::skipDraw(const gl::State &glState, gl::PrimitiveMode drawMode)
+{
+ if (drawMode == gl::PrimitiveMode::Points)
+ {
+ bool usesPointSize = GetImplAs<ProgramD3D>(glState.getProgram())->usesPointSize();
+
+ // ProgramBinary assumes non-point rendering if gl_PointSize isn't written,
+ // which affects varying interpolation. Since the value of gl_PointSize is
+ // undefined when not written, just skip drawing to avoid unexpected results.
+ if (!usesPointSize && !glState.isTransformFeedbackActiveUnpaused())
+ {
+ // Notify developers of risking undefined behavior.
+ WARN() << "Point rendering without writing to gl_PointSize.";
+ return true;
+ }
+ }
+ else if (gl::IsTriangleMode(drawMode))
+ {
+ if (glState.getRasterizerState().cullFace &&
+ glState.getRasterizerState().cullMode == gl::CullFaceMode::FrontAndBack)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+gl::GraphicsResetStatus RendererD3D::getResetStatus()
+{
+ if (!mDeviceLost)
+ {
+ if (testDeviceLost())
+ {
+ mDeviceLost = true;
+ notifyDeviceLost();
+ return gl::GraphicsResetStatus::UnknownContextReset;
+ }
+ return gl::GraphicsResetStatus::NoError;
+ }
+
+ if (testDeviceResettable())
+ {
+ return gl::GraphicsResetStatus::NoError;
+ }
+
+ return gl::GraphicsResetStatus::UnknownContextReset;
+}
+
+void RendererD3D::notifyDeviceLost()
+{
+ mDisplay->notifyDeviceLost();
+}
+
+std::string RendererD3D::getVendorString() const
+{
+ LUID adapterLuid = {0};
+
+ if (getLUID(&adapterLuid))
+ {
+ char adapterLuidString[64];
+ sprintf_s(adapterLuidString, sizeof(adapterLuidString), "(adapter LUID: %08x%08x)",
+ adapterLuid.HighPart, adapterLuid.LowPart);
+ return std::string(adapterLuidString);
+ }
+
+ return std::string("");
+}
+
+void RendererD3D::setGPUDisjoint()
+{
+ mDisjoint = true;
+}
+
+GLint RendererD3D::getGPUDisjoint()
+{
+ bool disjoint = mDisjoint;
+
+ // Disjoint flag is cleared when read
+ mDisjoint = false;
+
+ return disjoint;
+}
+
+GLint64 RendererD3D::getTimestamp()
+{
+ // D3D has no way to get an actual timestamp reliably so 0 is returned
+ return 0;
+}
+
+void RendererD3D::ensureCapsInitialized() const
+{
+ if (!mCapsInitialized)
+ {
+ generateCaps(&mNativeCaps, &mNativeTextureCaps, &mNativeExtensions, &mNativeLimitations);
+ mCapsInitialized = true;
+ }
+}
+
+const gl::Caps &RendererD3D::getNativeCaps() const
+{
+ ensureCapsInitialized();
+ return mNativeCaps;
+}
+
+const gl::TextureCapsMap &RendererD3D::getNativeTextureCaps() const
+{
+ ensureCapsInitialized();
+ return mNativeTextureCaps;
+}
+
+const gl::Extensions &RendererD3D::getNativeExtensions() const
+{
+ ensureCapsInitialized();
+ return mNativeExtensions;
+}
+
+const gl::Limitations &RendererD3D::getNativeLimitations() const
+{
+ ensureCapsInitialized();
+ return mNativeLimitations;
+}
+
+Serial RendererD3D::generateSerial()
+{
+ return mSerialFactory.generate();
+}
+
+bool InstancedPointSpritesActive(ProgramD3D *programD3D, gl::PrimitiveMode mode)
+{
+ return programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation() &&
+ mode == gl::PrimitiveMode::Points;
+}
+
+angle::Result RendererD3D::initRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget)
+{
+ return clearRenderTarget(context, renderTarget, gl::ColorF(0, 0, 0, 0), 1, 0);
+}
+
+const angle::FeaturesD3D &RendererD3D::getFeatures() const
+{
+ if (!mFeaturesInitialized)
+ {
+ initializeFeatures(&mFeatures);
+ mFeaturesInitialized = true;
+ }
+
+ return mFeatures;
+}
+
+unsigned int GetBlendSampleMask(const gl::State &glState, int samples)
+{
+ unsigned int mask = 0;
+ if (glState.isSampleCoverageEnabled())
+ {
+ GLfloat coverageValue = glState.getSampleCoverageValue();
+ if (coverageValue != 0)
+ {
+ float threshold = 0.5f;
+
+ for (int i = 0; i < samples; ++i)
+ {
+ mask <<= 1;
+
+ if ((i + 1) * coverageValue >= threshold)
+ {
+ threshold += 1.0f;
+ mask |= 1;
+ }
+ }
+ }
+
+ bool coverageInvert = glState.getSampleCoverageInvert();
+ if (coverageInvert)
+ {
+ mask = ~mask;
+ }
+ }
+ else
+ {
+ mask = 0xFFFFFFFF;
+ }
+
+ if (glState.isSampleMaskEnabled())
+ {
+ mask &= glState.getSampleMaskWord(0);
+ }
+
+ return mask;
+}
+
+GLenum DefaultGLErrorCode(HRESULT hr)
+{
+ switch (hr)
+ {
+ case D3DERR_OUTOFVIDEOMEMORY:
+ case E_OUTOFMEMORY:
+ return GL_OUT_OF_MEMORY;
+ default:
+ return GL_INVALID_OPERATION;
+ }
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h
new file mode 100644
index 0000000000..68cedaa602
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h
@@ -0,0 +1,440 @@
+
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RendererD3D.h: Defines a back-end specific class for the DirectX renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
+#define LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
+
+#include <array>
+
+#include "common/Color.h"
+#include "common/MemoryBuffer.h"
+#include "common/debug.h"
+#include "libANGLE/Device.h"
+#include "libANGLE/State.h"
+#include "libANGLE/Version.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/VertexDataManager.h"
+#include "libANGLE/renderer/d3d/formatutilsD3D.h"
+#include "libANGLE/renderer/renderer_utils.h"
+#include "platform/FeaturesD3D.h"
+
+namespace egl
+{
+class ConfigSet;
+}
+
+namespace gl
+{
+class ErrorSet;
+class FramebufferState;
+class InfoLog;
+class Texture;
+struct LinkedVarying;
+} // namespace gl
+
+namespace rx
+{
+class ContextImpl;
+struct D3DUniform;
+struct D3DVarying;
+class DeviceD3D;
+class EGLImageD3D;
+class FramebufferImpl;
+class ImageD3D;
+class IndexBuffer;
+class NativeWindowD3D;
+class ProgramD3D;
+class RenderTargetD3D;
+class ShaderExecutableD3D;
+class SwapChainD3D;
+class TextureStorage;
+struct TranslatedIndexData;
+class UniformStorageD3D;
+class VertexBuffer;
+
+struct DeviceIdentifier
+{
+ UINT VendorId;
+ UINT DeviceId;
+ UINT SubSysId;
+ UINT Revision;
+ UINT FeatureLevel;
+};
+
+enum RendererClass
+{
+ RENDERER_D3D11,
+ RENDERER_D3D9
+};
+
+// A d3d::Context wraps error handling.
+namespace d3d
+{
+class Context : angle::NonCopyable
+{
+ public:
+ Context() {}
+ virtual ~Context() {}
+
+ virtual void handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line) = 0;
+};
+} // namespace d3d
+
+// ANGLE_TRY for HRESULT errors.
+#define ANGLE_TRY_HR(CONTEXT, EXPR, MESSAGE) \
+ do \
+ { \
+ auto ANGLE_LOCAL_VAR = (EXPR); \
+ if (ANGLE_UNLIKELY(FAILED(ANGLE_LOCAL_VAR))) \
+ { \
+ CONTEXT->handleResult(ANGLE_LOCAL_VAR, MESSAGE, __FILE__, ANGLE_FUNCTION, __LINE__); \
+ return angle::Result::Stop; \
+ } \
+ } while (0)
+
+#define ANGLE_CHECK_HR(CONTEXT, EXPR, MESSAGE, ERROR) \
+ do \
+ { \
+ if (ANGLE_UNLIKELY(!(EXPR))) \
+ { \
+ CONTEXT->handleResult(ERROR, MESSAGE, __FILE__, ANGLE_FUNCTION, __LINE__); \
+ return angle::Result::Stop; \
+ } \
+ } while (0)
+
+#define ANGLE_HR_UNREACHABLE(context) \
+ UNREACHABLE(); \
+ ANGLE_CHECK_HR(context, false, "Unreachble code reached.", E_FAIL)
+
+// Check if the device is lost every 10 failures to get the query data
+constexpr unsigned int kPollingD3DDeviceLostCheckFrequency = 10;
+
+// Useful for unit testing
+class BufferFactoryD3D : angle::NonCopyable
+{
+ public:
+ BufferFactoryD3D() {}
+ virtual ~BufferFactoryD3D() {}
+
+ virtual VertexBuffer *createVertexBuffer() = 0;
+ virtual IndexBuffer *createIndexBuffer() = 0;
+
+ // TODO(jmadill): add VertexFormatCaps
+ virtual VertexConversionType getVertexConversionType(angle::FormatID vertexFormatID) const = 0;
+ virtual GLenum getVertexComponentType(angle::FormatID vertexFormatID) const = 0;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using this
+ // function.
+ virtual angle::Result getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const = 0;
+};
+
+using AttribIndexArray = gl::AttribArray<int>;
+
+class RendererD3D : public BufferFactoryD3D
+{
+ public:
+ explicit RendererD3D(egl::Display *display);
+ ~RendererD3D() override;
+
+ virtual egl::Error initialize() = 0;
+
+ virtual egl::ConfigSet generateConfigs() = 0;
+ virtual void generateDisplayExtensions(egl::DisplayExtensions *outExtensions) const = 0;
+
+ virtual ContextImpl *createContext(const gl::State &state, gl::ErrorSet *errorSet) = 0;
+
+ std::string getVendorString() const;
+
+ virtual int getMinorShaderModel() const = 0;
+ virtual std::string getShaderModelSuffix() const = 0;
+
+ // Direct3D Specific methods
+ virtual DeviceIdentifier getAdapterIdentifier() const = 0;
+
+ virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0;
+ virtual NativeWindowD3D *createNativeWindow(EGLNativeWindowType window,
+ const egl::Config *config,
+ const egl::AttributeMap &attribs) const = 0;
+
+ virtual SwapChainD3D *createSwapChain(NativeWindowD3D *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation,
+ EGLint samples) = 0;
+ virtual egl::Error getD3DTextureInfo(const egl::Config *configuration,
+ IUnknown *d3dTexture,
+ EGLint *width,
+ EGLint *height,
+ EGLint *samples,
+ const angle::Format **angleFormat) const = 0;
+ virtual egl::Error validateShareHandle(const egl::Config *config,
+ HANDLE shareHandle,
+ const egl::AttributeMap &attribs) const = 0;
+
+ virtual int getMajorShaderModel() const = 0;
+
+ const angle::FeaturesD3D &getFeatures() const;
+
+ // Pixel operations
+ virtual angle::Result copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) = 0;
+ virtual angle::Result copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level) = 0;
+ virtual angle::Result copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) = 0;
+ virtual angle::Result copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) = 0;
+
+ virtual angle::Result copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ gl::TextureTarget srcTarget,
+ const gl::Box &sourceBox,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) = 0;
+ virtual angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel) = 0;
+
+ // RenderTarget creation
+ virtual angle::Result createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT) = 0;
+ virtual angle::Result createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT) = 0;
+
+ // Shader operations
+ virtual angle::Result loadExecutable(d3d::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable) = 0;
+ virtual angle::Result compileToExecutable(d3d::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable) = 0;
+ virtual angle::Result ensureHLSLCompilerInitialized(d3d::Context *context) = 0;
+
+ virtual UniformStorageD3D *createUniformStorage(size_t storageSize) = 0;
+
+ // Image operations
+ virtual ImageD3D *createImage() = 0;
+ virtual ExternalImageSiblingImpl *createExternalImageSibling(
+ const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs) = 0;
+ virtual angle::Result generateMipmap(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source) = 0;
+ virtual angle::Result generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState) = 0;
+ virtual angle::Result copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Box &sourceBox,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) = 0;
+ virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) = 0;
+ virtual TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
+ RenderTargetD3D *renderTargetD3D) = 0;
+ virtual TextureStorage *createTextureStorageExternal(
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc) = 0;
+ virtual TextureStorage *createTextureStorage2D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ bool hintLevelZeroOnly) = 0;
+ virtual TextureStorage *createTextureStorageCube(GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly) = 0;
+ virtual TextureStorage *createTextureStorage3D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels) = 0;
+ virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels) = 0;
+ virtual TextureStorage *createTextureStorage2DMultisample(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ int samples,
+ bool fixedSampleLocations) = 0;
+ virtual TextureStorage *createTextureStorage2DMultisampleArray(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels,
+ int samples,
+ bool fixedSampleLocations) = 0;
+
+ // Buffer-to-texture and Texture-to-buffer copies
+ virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const = 0;
+ virtual angle::Result fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea) = 0;
+
+ // Device lost
+ gl::GraphicsResetStatus getResetStatus();
+ void notifyDeviceLost();
+ virtual bool resetDevice() = 0;
+ virtual bool testDeviceLost() = 0;
+ virtual bool testDeviceResettable() = 0;
+
+ virtual RendererClass getRendererClass() const = 0;
+ virtual void *getD3DDevice() = 0;
+
+ void setGPUDisjoint();
+
+ GLint getGPUDisjoint();
+ GLint64 getTimestamp();
+
+ virtual angle::Result clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue) = 0;
+
+ virtual DeviceImpl *createEGLDevice() = 0;
+
+ bool presentPathFastEnabled() const { return mPresentPathFastEnabled; }
+
+ // Stream creation
+ virtual StreamProducerImpl *createStreamProducerD3DTexture(
+ egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs) = 0;
+
+ const gl::Caps &getNativeCaps() const;
+ const gl::TextureCapsMap &getNativeTextureCaps() const;
+ const gl::Extensions &getNativeExtensions() const;
+ const gl::Limitations &getNativeLimitations() const;
+
+ // Necessary hack for default framebuffers in D3D.
+ virtual FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) = 0;
+
+ virtual gl::Version getMaxSupportedESVersion() const = 0;
+ virtual gl::Version getMaxConformantESVersion() const = 0;
+
+ angle::Result initRenderTarget(const gl::Context *context, RenderTargetD3D *renderTarget);
+
+ virtual angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut) = 0;
+
+ Serial generateSerial();
+
+ virtual bool canSelectViewInVertexShader() const = 0;
+
+ protected:
+ virtual bool getLUID(LUID *adapterLuid) const = 0;
+ virtual void generateCaps(gl::Caps *outCaps,
+ gl::TextureCapsMap *outTextureCaps,
+ gl::Extensions *outExtensions,
+ gl::Limitations *outLimitations) const = 0;
+
+ bool skipDraw(const gl::State &glState, gl::PrimitiveMode drawMode);
+
+ egl::Display *mDisplay;
+
+ bool mPresentPathFastEnabled;
+
+ private:
+ void ensureCapsInitialized() const;
+
+ virtual void initializeFeatures(angle::FeaturesD3D *features) const = 0;
+
+ mutable bool mCapsInitialized;
+ mutable gl::Caps mNativeCaps;
+ mutable gl::TextureCapsMap mNativeTextureCaps;
+ mutable gl::Extensions mNativeExtensions;
+ mutable gl::Limitations mNativeLimitations;
+
+ mutable bool mFeaturesInitialized;
+ mutable angle::FeaturesD3D mFeatures;
+
+ bool mDisjoint;
+ bool mDeviceLost;
+
+ SerialFactory mSerialFactory;
+};
+
+unsigned int GetBlendSampleMask(const gl::State &glState, int samples);
+bool InstancedPointSpritesActive(ProgramD3D *programD3D, gl::PrimitiveMode mode);
+GLenum DefaultGLErrorCode(HRESULT hr);
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/SamplerD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SamplerD3D.h
new file mode 100644
index 0000000000..dbb5036081
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SamplerD3D.h
@@ -0,0 +1,25 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SamplerD3D.h: Defines the rx::SamplerD3D class, an implementation of SamplerImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_
+#define LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_
+
+#include "libANGLE/renderer/SamplerImpl.h"
+
+namespace rx
+{
+
+class SamplerD3D : public SamplerImpl
+{
+ public:
+ SamplerD3D(const gl::SamplerState &state) : SamplerImpl(state) {}
+ ~SamplerD3D() override {}
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_SAMPLERD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp
new file mode 100644
index 0000000000..5c5373edae
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp
@@ -0,0 +1,351 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderD3D.cpp: Defines the rx::ShaderD3D class which implements rx::ShaderImpl.
+
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Compiler.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/features.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+
+class TranslateTaskD3D : public angle::Closure
+{
+ public:
+ TranslateTaskD3D(ShHandle handle,
+ ShCompileOptions options,
+ const std::string &source,
+ const std::string &sourcePath)
+ : mHandle(handle),
+ mOptions(options),
+ mSource(source),
+ mSourcePath(sourcePath),
+ mResult(false)
+ {}
+
+ void operator()() override
+ {
+ std::vector<const char *> srcStrings;
+ if (!mSourcePath.empty())
+ {
+ srcStrings.push_back(mSourcePath.c_str());
+ }
+ srcStrings.push_back(mSource.c_str());
+
+ mResult = sh::Compile(mHandle, &srcStrings[0], srcStrings.size(), mOptions);
+ }
+
+ bool getResult() { return mResult; }
+
+ private:
+ ShHandle mHandle;
+ ShCompileOptions mOptions;
+ std::string mSource;
+ std::string mSourcePath;
+ bool mResult;
+};
+
+using PostTranslateFunctor =
+ std::function<bool(gl::ShCompilerInstance *compiler, std::string *infoLog)>;
+
+class WaitableCompileEventD3D final : public WaitableCompileEvent
+{
+ public:
+ WaitableCompileEventD3D(std::shared_ptr<angle::WaitableEvent> waitableEvent,
+ gl::ShCompilerInstance *compilerInstance,
+ PostTranslateFunctor &&postTranslateFunctor,
+ std::shared_ptr<TranslateTaskD3D> translateTask)
+ : WaitableCompileEvent(waitableEvent),
+ mCompilerInstance(compilerInstance),
+ mPostTranslateFunctor(std::move(postTranslateFunctor)),
+ mTranslateTask(translateTask)
+ {}
+
+ bool getResult() override { return mTranslateTask->getResult(); }
+
+ bool postTranslate(std::string *infoLog) override
+ {
+ return mPostTranslateFunctor(mCompilerInstance, infoLog);
+ }
+
+ private:
+ gl::ShCompilerInstance *mCompilerInstance;
+ PostTranslateFunctor mPostTranslateFunctor;
+ std::shared_ptr<TranslateTaskD3D> mTranslateTask;
+};
+
+ShaderD3D::ShaderD3D(const gl::ShaderState &data,
+ const angle::FeaturesD3D &features,
+ const gl::Extensions &extensions)
+ : ShaderImpl(data), mAdditionalOptions(0)
+{
+ uncompile();
+
+ if (features.expandIntegerPowExpressions.enabled)
+ {
+ mAdditionalOptions |= SH_EXPAND_SELECT_HLSL_INTEGER_POW_EXPRESSIONS;
+ }
+
+ if (features.getDimensionsIgnoresBaseLevel.enabled)
+ {
+ mAdditionalOptions |= SH_HLSL_GET_DIMENSIONS_IGNORES_BASE_LEVEL;
+ }
+
+ if (features.preAddTexelFetchOffsets.enabled)
+ {
+ mAdditionalOptions |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH;
+ }
+ if (features.rewriteUnaryMinusOperator.enabled)
+ {
+ mAdditionalOptions |= SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR;
+ }
+ if (features.emulateIsnanFloat.enabled)
+ {
+ mAdditionalOptions |= SH_EMULATE_ISNAN_FLOAT_FUNCTION;
+ }
+ if (features.skipVSConstantRegisterZero.enabled &&
+ mData.getShaderType() == gl::ShaderType::Vertex)
+ {
+ mAdditionalOptions |= SH_SKIP_D3D_CONSTANT_REGISTER_ZERO;
+ }
+ if (features.forceAtomicValueResolution.enabled)
+ {
+ mAdditionalOptions |= SH_FORCE_ATOMIC_VALUE_RESOLUTION;
+ }
+ if (extensions.multiview || extensions.multiview2)
+ {
+ mAdditionalOptions |= SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW;
+ }
+}
+
+ShaderD3D::~ShaderD3D() {}
+
+std::string ShaderD3D::getDebugInfo() const
+{
+ if (mDebugInfo.empty())
+ {
+ return "";
+ }
+
+ return mDebugInfo + std::string("\n// ") + gl::GetShaderTypeString(mData.getShaderType()) +
+ " SHADER END\n";
+}
+
+// initialize/clean up previous state
+void ShaderD3D::uncompile()
+{
+ // set by compileToHLSL
+ mCompilerOutputType = SH_ESSL_OUTPUT;
+
+ mUsesMultipleRenderTargets = false;
+ mUsesFragColor = false;
+ mUsesFragData = false;
+ mUsesSecondaryColor = false;
+ mUsesFragCoord = false;
+ mUsesFrontFacing = false;
+ mUsesPointSize = false;
+ mUsesPointCoord = false;
+ mUsesDepthRange = false;
+ mUsesFragDepth = false;
+ mHasANGLEMultiviewEnabled = false;
+ mUsesVertexID = false;
+ mUsesViewID = false;
+ mUsesDiscardRewriting = false;
+ mUsesNestedBreak = false;
+ mRequiresIEEEStrictCompiling = false;
+
+ mDebugInfo.clear();
+}
+
+void ShaderD3D::generateWorkarounds(angle::CompilerWorkaroundsD3D *workarounds) const
+{
+ if (mUsesDiscardRewriting)
+ {
+ // ANGLE issue 486:
+ // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by
+ // disabling optimization
+ workarounds->skipOptimization = true;
+ }
+ else if (mUsesNestedBreak)
+ {
+ // ANGLE issue 603:
+ // Work-around a D3D9 compiler bug that presents itself when using break in a nested loop,
+ // by maximizing optimization We want to keep the use of
+ // ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION minimal to prevent hangs, so usesDiscard takes
+ // precedence
+ workarounds->useMaxOptimization = true;
+ }
+
+ if (mRequiresIEEEStrictCompiling)
+ {
+ // IEEE Strictness for D3D compiler needs to be enabled for NaNs to work.
+ workarounds->enableIEEEStrictness = true;
+ }
+}
+
+unsigned int ShaderD3D::getUniformRegister(const std::string &uniformName) const
+{
+ ASSERT(mUniformRegisterMap.count(uniformName) > 0);
+ return mUniformRegisterMap.find(uniformName)->second;
+}
+
+unsigned int ShaderD3D::getUniformBlockRegister(const std::string &blockName) const
+{
+ ASSERT(mUniformBlockRegisterMap.count(blockName) > 0);
+ return mUniformBlockRegisterMap.find(blockName)->second;
+}
+
+unsigned int ShaderD3D::getShaderStorageBlockRegister(const std::string &blockName) const
+{
+ ASSERT(mShaderStorageBlockRegisterMap.count(blockName) > 0);
+ return mShaderStorageBlockRegisterMap.find(blockName)->second;
+}
+
+ShShaderOutput ShaderD3D::getCompilerOutputType() const
+{
+ return mCompilerOutputType;
+}
+
+bool ShaderD3D::useImage2DFunction(const std::string &functionName) const
+{
+ if (mUsedImage2DFunctionNames.empty())
+ {
+ return false;
+ }
+
+ return mUsedImage2DFunctionNames.find(functionName) != mUsedImage2DFunctionNames.end();
+}
+
+const std::map<std::string, unsigned int> &GetUniformRegisterMap(
+ const std::map<std::string, unsigned int> *uniformRegisterMap)
+{
+ ASSERT(uniformRegisterMap);
+ return *uniformRegisterMap;
+}
+
+const std::set<std::string> &GetUsedImage2DFunctionNames(
+ const std::set<std::string> *usedImage2DFunctionNames)
+{
+ ASSERT(usedImage2DFunctionNames);
+ return *usedImage2DFunctionNames;
+}
+
+std::shared_ptr<WaitableCompileEvent> ShaderD3D::compile(const gl::Context *context,
+ gl::ShCompilerInstance *compilerInstance,
+ ShCompileOptions options)
+{
+ std::string sourcePath;
+ uncompile();
+
+ ShCompileOptions additionalOptions = 0;
+
+ const std::string &source = mData.getSource();
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (gl::DebugAnnotationsActive())
+ {
+ sourcePath = getTempPath();
+ writeFile(sourcePath.c_str(), source.c_str(), source.length());
+ additionalOptions |= SH_LINE_DIRECTIVES | SH_SOURCE_PATH;
+ }
+#endif
+
+ additionalOptions |= mAdditionalOptions;
+
+ options |= additionalOptions;
+
+ auto postTranslateFunctor = [this](gl::ShCompilerInstance *compiler, std::string *infoLog) {
+ // TODO(jmadill): We shouldn't need to cache this.
+ mCompilerOutputType = compiler->getShaderOutputType();
+
+ const std::string &translatedSource = mData.getTranslatedSource();
+
+ mUsesMultipleRenderTargets = translatedSource.find("GL_USES_MRT") != std::string::npos;
+ mUsesFragColor = translatedSource.find("GL_USES_FRAG_COLOR") != std::string::npos;
+ mUsesFragData = translatedSource.find("GL_USES_FRAG_DATA") != std::string::npos;
+ mUsesSecondaryColor = translatedSource.find("GL_USES_SECONDARY_COLOR") != std::string::npos;
+ mUsesFragCoord = translatedSource.find("GL_USES_FRAG_COORD") != std::string::npos;
+ mUsesFrontFacing = translatedSource.find("GL_USES_FRONT_FACING") != std::string::npos;
+ mUsesPointSize = translatedSource.find("GL_USES_POINT_SIZE") != std::string::npos;
+ mUsesPointCoord = translatedSource.find("GL_USES_POINT_COORD") != std::string::npos;
+ mUsesDepthRange = translatedSource.find("GL_USES_DEPTH_RANGE") != std::string::npos;
+ mUsesFragDepth = translatedSource.find("GL_USES_FRAG_DEPTH") != std::string::npos;
+ mHasANGLEMultiviewEnabled =
+ translatedSource.find("GL_ANGLE_MULTIVIEW_ENABLED") != std::string::npos;
+ mUsesVertexID = translatedSource.find("GL_USES_VERTEX_ID") != std::string::npos;
+ mUsesViewID = translatedSource.find("GL_USES_VIEW_ID") != std::string::npos;
+ mUsesDiscardRewriting =
+ translatedSource.find("ANGLE_USES_DISCARD_REWRITING") != std::string::npos;
+ mUsesNestedBreak = translatedSource.find("ANGLE_USES_NESTED_BREAK") != std::string::npos;
+ mRequiresIEEEStrictCompiling =
+ translatedSource.find("ANGLE_REQUIRES_IEEE_STRICT_COMPILING") != std::string::npos;
+
+ ShHandle compilerHandle = compiler->getHandle();
+
+ mUniformRegisterMap = GetUniformRegisterMap(sh::GetUniformRegisterMap(compilerHandle));
+ mReadonlyImage2DRegisterIndex = sh::GetReadonlyImage2DRegisterIndex(compilerHandle);
+ mImage2DRegisterIndex = sh::GetImage2DRegisterIndex(compilerHandle);
+ mUsedImage2DFunctionNames =
+ GetUsedImage2DFunctionNames(sh::GetUsedImage2DFunctionNames(compilerHandle));
+
+ for (const sh::InterfaceBlock &interfaceBlock : mData.getUniformBlocks())
+ {
+ if (interfaceBlock.active)
+ {
+ unsigned int index = static_cast<unsigned int>(-1);
+ bool blockRegisterResult =
+ sh::GetUniformBlockRegister(compilerHandle, interfaceBlock.name, &index);
+ ASSERT(blockRegisterResult);
+
+ mUniformBlockRegisterMap[interfaceBlock.name] = index;
+ }
+ }
+
+ for (const sh::InterfaceBlock &interfaceBlock : mData.getShaderStorageBlocks())
+ {
+ if (interfaceBlock.active)
+ {
+ unsigned int index = static_cast<unsigned int>(-1);
+ bool blockRegisterResult =
+ sh::GetShaderStorageBlockRegister(compilerHandle, interfaceBlock.name, &index);
+ ASSERT(blockRegisterResult);
+
+ mShaderStorageBlockRegisterMap[interfaceBlock.name] = index;
+ }
+ }
+
+ mDebugInfo +=
+ std::string("// ") + gl::GetShaderTypeString(mData.getShaderType()) + " SHADER BEGIN\n";
+ mDebugInfo += "\n// GLSL BEGIN\n\n" + mData.getSource() + "\n\n// GLSL END\n\n\n";
+ mDebugInfo +=
+ "// INITIAL HLSL BEGIN\n\n" + translatedSource + "\n// INITIAL HLSL END\n\n\n";
+ // Successive steps will append more info
+ return true;
+ };
+
+ auto workerThreadPool = context->getWorkerThreadPool();
+ auto translateTask = std::make_shared<TranslateTaskD3D>(compilerInstance->getHandle(), options,
+ source, sourcePath);
+
+ return std::make_shared<WaitableCompileEventD3D>(
+ angle::WorkerThreadPool::PostWorkerTask(workerThreadPool, translateTask), compilerInstance,
+ std::move(postTranslateFunctor), translateTask);
+}
+
+bool ShaderD3D::hasUniform(const std::string &name) const
+{
+ return mUniformRegisterMap.find(name) != mUniformRegisterMap.end();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.h
new file mode 100644
index 0000000000..f1557da39b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.h
@@ -0,0 +1,111 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderD3D.h: Defines the rx::ShaderD3D class which implements rx::ShaderImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_SHADERD3D_H_
+#define LIBANGLE_RENDERER_D3D_SHADERD3D_H_
+
+#include "libANGLE/renderer/ShaderImpl.h"
+
+#include <map>
+
+namespace angle
+{
+struct CompilerWorkaroundsD3D;
+struct FeaturesD3D;
+} // namespace angle
+
+namespace gl
+{
+struct Extensions;
+}
+
+namespace rx
+{
+class DynamicHLSL;
+class RendererD3D;
+struct D3DUniform;
+
+class ShaderD3D : public ShaderImpl
+{
+ public:
+ ShaderD3D(const gl::ShaderState &data,
+ const angle::FeaturesD3D &features,
+ const gl::Extensions &extensions);
+ ~ShaderD3D() override;
+
+ std::shared_ptr<WaitableCompileEvent> compile(const gl::Context *context,
+ gl::ShCompilerInstance *compilerInstance,
+ ShCompileOptions options) override;
+
+ std::string getDebugInfo() const override;
+
+ // D3D-specific methods
+ void uncompile();
+
+ bool hasUniform(const std::string &name) const;
+
+ // Query regular uniforms with their name. Query sampler fields of structs with field selection
+ // using dot (.) operator.
+ unsigned int getUniformRegister(const std::string &uniformName) const;
+
+ unsigned int getUniformBlockRegister(const std::string &blockName) const;
+ unsigned int getShaderStorageBlockRegister(const std::string &blockName) const;
+ unsigned int getReadonlyImage2DRegisterIndex() const { return mReadonlyImage2DRegisterIndex; }
+ unsigned int getImage2DRegisterIndex() const { return mImage2DRegisterIndex; }
+ bool useImage2DFunction(const std::string &functionName) const;
+ void appendDebugInfo(const std::string &info) const { mDebugInfo += info; }
+
+ void generateWorkarounds(angle::CompilerWorkaroundsD3D *workarounds) const;
+
+ bool usesMultipleRenderTargets() const { return mUsesMultipleRenderTargets; }
+ bool usesFragColor() const { return mUsesFragColor; }
+ bool usesFragData() const { return mUsesFragData; }
+ bool usesSecondaryColor() const { return mUsesSecondaryColor; }
+ bool usesFragCoord() const { return mUsesFragCoord; }
+ bool usesFrontFacing() const { return mUsesFrontFacing; }
+ bool usesPointSize() const { return mUsesPointSize; }
+ bool usesPointCoord() const { return mUsesPointCoord; }
+ bool usesDepthRange() const { return mUsesDepthRange; }
+ bool usesFragDepth() const { return mUsesFragDepth; }
+ bool usesVertexID() const { return mUsesVertexID; }
+ bool usesViewID() const { return mUsesViewID; }
+ bool hasANGLEMultiviewEnabled() const { return mHasANGLEMultiviewEnabled; }
+
+ ShShaderOutput getCompilerOutputType() const;
+
+ private:
+ bool mUsesMultipleRenderTargets;
+ bool mUsesFragColor;
+ bool mUsesFragData;
+ bool mUsesSecondaryColor;
+ bool mUsesFragCoord;
+ bool mUsesFrontFacing;
+ bool mUsesPointSize;
+ bool mUsesPointCoord;
+ bool mUsesDepthRange;
+ bool mUsesFragDepth;
+ bool mHasANGLEMultiviewEnabled;
+ bool mUsesVertexID;
+ bool mUsesViewID;
+ bool mUsesDiscardRewriting;
+ bool mUsesNestedBreak;
+ bool mRequiresIEEEStrictCompiling;
+
+ ShShaderOutput mCompilerOutputType;
+ mutable std::string mDebugInfo;
+ std::map<std::string, unsigned int> mUniformRegisterMap;
+ std::map<std::string, unsigned int> mUniformBlockRegisterMap;
+ std::map<std::string, unsigned int> mShaderStorageBlockRegisterMap;
+ unsigned int mReadonlyImage2DRegisterIndex;
+ unsigned int mImage2DRegisterIndex;
+ std::set<std::string> mUsedImage2DFunctionNames;
+ ShCompileOptions mAdditionalOptions;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_SHADERD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp
new file mode 100644
index 0000000000..ae8f35c3c5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp
@@ -0,0 +1,67 @@
+//
+// Copyright (c) 2012-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderExecutable.cpp: Implements a class to contain D3D shader executable
+// implementation details.
+
+#include "libANGLE/renderer/d3d/ShaderExecutableD3D.h"
+
+#include "common/angleutils.h"
+
+namespace rx
+{
+
+ShaderExecutableD3D::ShaderExecutableD3D(const void *function, size_t length)
+ : mFunctionBuffer(length)
+{
+ memcpy(mFunctionBuffer.data(), function, length);
+}
+
+ShaderExecutableD3D::~ShaderExecutableD3D() {}
+
+const uint8_t *ShaderExecutableD3D::getFunction() const
+{
+ return mFunctionBuffer.data();
+}
+
+size_t ShaderExecutableD3D::getLength() const
+{
+ return mFunctionBuffer.size();
+}
+
+const std::string &ShaderExecutableD3D::getDebugInfo() const
+{
+ return mDebugInfo;
+}
+
+void ShaderExecutableD3D::appendDebugInfo(const std::string &info)
+{
+ mDebugInfo += info;
+}
+
+UniformStorageD3D::UniformStorageD3D(size_t initialSize) : mUniformData()
+{
+ bool result = mUniformData.resize(initialSize);
+ ASSERT(result);
+
+ // Uniform data is zero-initialized by default.
+ mUniformData.fill(0);
+}
+
+UniformStorageD3D::~UniformStorageD3D() {}
+
+size_t UniformStorageD3D::size() const
+{
+ return mUniformData.size();
+}
+
+uint8_t *UniformStorageD3D::getDataPointer(unsigned int registerIndex, unsigned int registerElement)
+{
+ size_t offset = ((registerIndex * 4 + registerElement) * sizeof(float));
+ return mUniformData.data() + offset;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h
new file mode 100644
index 0000000000..12179ac0b9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h
@@ -0,0 +1,57 @@
+//
+// Copyright (c) 2012-2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderExecutable.h: Defines a class to contain D3D shader executable
+// implementation details.
+
+#ifndef LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_
+#define LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_
+
+#include "common/MemoryBuffer.h"
+#include "common/debug.h"
+
+#include <cstdint>
+#include <vector>
+
+namespace rx
+{
+
+class ShaderExecutableD3D : angle::NonCopyable
+{
+ public:
+ ShaderExecutableD3D(const void *function, size_t length);
+ virtual ~ShaderExecutableD3D();
+
+ const uint8_t *getFunction() const;
+
+ size_t getLength() const;
+
+ const std::string &getDebugInfo() const;
+
+ void appendDebugInfo(const std::string &info);
+
+ private:
+ std::vector<uint8_t> mFunctionBuffer;
+ std::string mDebugInfo;
+};
+
+class UniformStorageD3D : angle::NonCopyable
+{
+ public:
+ UniformStorageD3D(size_t initialSize);
+ virtual ~UniformStorageD3D();
+
+ size_t size() const;
+
+ uint8_t *getDataPointer(unsigned int registerIndex, unsigned int registerElement);
+
+ private:
+ angle::MemoryBuffer mUniformData;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
new file mode 100644
index 0000000000..98d67675ce
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
@@ -0,0 +1,488 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SurfaceD3D.cpp: D3D implementation of an EGL surface
+
+#include "libANGLE/renderer/d3d/SurfaceD3D.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/renderer/Format.h"
+#include "libANGLE/renderer/d3d/DisplayD3D.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/SwapChainD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+
+#include <EGL/eglext.h>
+#include <tchar.h>
+#include <algorithm>
+
+namespace rx
+{
+
+SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state,
+ RendererD3D *renderer,
+ egl::Display *display,
+ EGLNativeWindowType window,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs)
+ : SurfaceImpl(state),
+ mRenderer(renderer),
+ mDisplay(display),
+ mFixedSize(window == nullptr || attribs.get(EGL_FIXED_SIZE_ANGLE, EGL_FALSE) == EGL_TRUE),
+ mFixedWidth(0),
+ mFixedHeight(0),
+ mOrientation(static_cast<EGLint>(attribs.get(EGL_SURFACE_ORIENTATION_ANGLE, 0))),
+ mRenderTargetFormat(state.config->renderTargetFormat),
+ mDepthStencilFormat(state.config->depthStencilFormat),
+ mColorFormat(nullptr),
+ mSwapChain(nullptr),
+ mSwapIntervalDirty(true),
+ mNativeWindow(renderer->createNativeWindow(window, state.config, attribs)),
+ mWidth(static_cast<EGLint>(attribs.get(EGL_WIDTH, 0))),
+ mHeight(static_cast<EGLint>(attribs.get(EGL_HEIGHT, 0))),
+ mSwapInterval(1),
+ mShareHandle(0),
+ mD3DTexture(nullptr),
+ mBuftype(buftype)
+{
+ if (window != nullptr && !mFixedSize)
+ {
+ mWidth = -1;
+ mHeight = -1;
+ }
+
+ if (mFixedSize)
+ {
+ mFixedWidth = mWidth;
+ mFixedHeight = mHeight;
+ }
+
+ switch (buftype)
+ {
+ case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+ mShareHandle = static_cast<HANDLE>(clientBuffer);
+ break;
+
+ case EGL_D3D_TEXTURE_ANGLE:
+ mD3DTexture = static_cast<IUnknown *>(clientBuffer);
+ ASSERT(mD3DTexture != nullptr);
+ mD3DTexture->AddRef();
+ break;
+
+ default:
+ break;
+ }
+}
+
+SurfaceD3D::~SurfaceD3D()
+{
+ releaseSwapChain();
+ SafeDelete(mNativeWindow);
+ SafeRelease(mD3DTexture);
+}
+
+void SurfaceD3D::releaseSwapChain()
+{
+ SafeDelete(mSwapChain);
+}
+
+egl::Error SurfaceD3D::initialize(const egl::Display *display)
+{
+ if (mNativeWindow->getNativeWindow())
+ {
+ if (!mNativeWindow->initialize())
+ {
+ return egl::EglBadSurface();
+ }
+ }
+
+ if (mBuftype == EGL_D3D_TEXTURE_ANGLE)
+ {
+ ANGLE_TRY(mRenderer->getD3DTextureInfo(mState.config, mD3DTexture, &mFixedWidth,
+ &mFixedHeight, nullptr, &mColorFormat));
+ if (mState.attributes.contains(EGL_GL_COLORSPACE))
+ {
+ if (mColorFormat->id != angle::FormatID::R8G8B8A8_TYPELESS &&
+ mColorFormat->id != angle::FormatID::B8G8R8A8_TYPELESS)
+ {
+ return egl::EglBadMatch()
+ << "EGL_GL_COLORSPACE may only be specified for TYPELESS textures";
+ }
+ }
+ if (mColorFormat->id == angle::FormatID::R8G8B8A8_TYPELESS)
+ {
+ EGLAttrib colorspace =
+ mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
+ if (colorspace == EGL_GL_COLORSPACE_SRGB)
+ {
+ mColorFormat = &angle::Format::Get(angle::FormatID::R8G8B8A8_TYPELESS_SRGB);
+ }
+ }
+ if (mColorFormat->id == angle::FormatID::B8G8R8A8_TYPELESS)
+ {
+ EGLAttrib colorspace =
+ mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
+ if (colorspace == EGL_GL_COLORSPACE_SRGB)
+ {
+ mColorFormat = &angle::Format::Get(angle::FormatID::B8G8R8A8_TYPELESS_SRGB);
+ }
+ }
+ mRenderTargetFormat = mColorFormat->fboImplementationInternalFormat;
+ }
+
+ ANGLE_TRY(resetSwapChain(display));
+ return egl::NoError();
+}
+
+FramebufferImpl *SurfaceD3D::createDefaultFramebuffer(const gl::Context *context,
+ const gl::FramebufferState &data)
+{
+ return mRenderer->createDefaultFramebuffer(data);
+}
+
+egl::Error SurfaceD3D::bindTexImage(const gl::Context *, gl::Texture *, EGLint)
+{
+ return egl::NoError();
+}
+
+egl::Error SurfaceD3D::releaseTexImage(const gl::Context *, EGLint)
+{
+ return egl::NoError();
+}
+
+egl::Error SurfaceD3D::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
+{
+ return mSwapChain->getSyncValues(ust, msc, sbc);
+}
+
+egl::Error SurfaceD3D::resetSwapChain(const egl::Display *display)
+{
+ ASSERT(!mSwapChain);
+
+ int width;
+ int height;
+
+ if (!mFixedSize)
+ {
+ RECT windowRect;
+ if (!mNativeWindow->getClientRect(&windowRect))
+ {
+ ASSERT(false);
+
+ return egl::EglBadSurface() << "Could not retrieve the window dimensions";
+ }
+
+ width = windowRect.right - windowRect.left;
+ height = windowRect.bottom - windowRect.top;
+ }
+ else
+ {
+ // non-window surface - size is determined at creation
+ width = mFixedWidth;
+ height = mFixedHeight;
+ }
+
+ mSwapChain =
+ mRenderer->createSwapChain(mNativeWindow, mShareHandle, mD3DTexture, mRenderTargetFormat,
+ mDepthStencilFormat, mOrientation, mState.config->samples);
+ if (!mSwapChain)
+ {
+ return egl::EglBadAlloc();
+ }
+
+ // This is a bit risky to pass the proxy context here, but it can happen at almost any time.
+ DisplayD3D *displayD3D = GetImplAs<DisplayD3D>(display);
+ egl::Error error = resetSwapChain(displayD3D, width, height);
+ if (error.isError())
+ {
+ SafeDelete(mSwapChain);
+ return error;
+ }
+
+ return egl::NoError();
+}
+
+egl::Error SurfaceD3D::resizeSwapChain(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight)
+{
+ ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
+ ASSERT(mSwapChain);
+
+ EGLint status =
+ mSwapChain->resize(displayD3D, std::max(1, backbufferWidth), std::max(1, backbufferHeight));
+
+ if (status == EGL_CONTEXT_LOST)
+ {
+ mDisplay->notifyDeviceLost();
+ return egl::Error(status);
+ }
+ else if (status != EGL_SUCCESS)
+ {
+ return egl::Error(status);
+ }
+
+ mWidth = backbufferWidth;
+ mHeight = backbufferHeight;
+
+ return egl::NoError();
+}
+
+egl::Error SurfaceD3D::resetSwapChain(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight)
+{
+ ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0);
+ ASSERT(mSwapChain);
+
+ EGLint status = mSwapChain->reset(displayD3D, std::max(1, backbufferWidth),
+ std::max(1, backbufferHeight), mSwapInterval);
+
+ if (status == EGL_CONTEXT_LOST)
+ {
+ mRenderer->notifyDeviceLost();
+ return egl::Error(status);
+ }
+ else if (status != EGL_SUCCESS)
+ {
+ return egl::Error(status);
+ }
+
+ mWidth = backbufferWidth;
+ mHeight = backbufferHeight;
+ mSwapIntervalDirty = false;
+
+ return egl::NoError();
+}
+
+egl::Error SurfaceD3D::swapRect(DisplayD3D *displayD3D,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height)
+{
+ if (!mSwapChain)
+ {
+ return egl::NoError();
+ }
+
+ if (x + width > mWidth)
+ {
+ width = mWidth - x;
+ }
+
+ if (y + height > mHeight)
+ {
+ height = mHeight - y;
+ }
+
+ if (width != 0 && height != 0)
+ {
+ EGLint status = mSwapChain->swapRect(displayD3D, x, y, width, height);
+
+ if (status == EGL_CONTEXT_LOST)
+ {
+ mRenderer->notifyDeviceLost();
+ return egl::Error(status);
+ }
+ else if (status != EGL_SUCCESS)
+ {
+ return egl::Error(status);
+ }
+ }
+
+ ANGLE_TRY(checkForOutOfDateSwapChain(displayD3D));
+
+ return egl::NoError();
+}
+
+egl::Error SurfaceD3D::checkForOutOfDateSwapChain(DisplayD3D *displayD3D)
+{
+ RECT client;
+ int clientWidth = getWidth();
+ int clientHeight = getHeight();
+ bool sizeDirty = false;
+ if (!mFixedSize && !mNativeWindow->isIconic())
+ {
+ // The window is automatically resized to 150x22 when it's minimized, but the swapchain
+ // shouldn't be resized because that's not a useful size to render to.
+ if (!mNativeWindow->getClientRect(&client))
+ {
+ UNREACHABLE();
+ return egl::NoError();
+ }
+
+ // 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();
+ }
+ else if (mFixedSize)
+ {
+ clientWidth = mFixedWidth;
+ clientHeight = mFixedHeight;
+ sizeDirty = mFixedWidth != getWidth() || mFixedHeight != getHeight();
+ }
+
+ if (mSwapIntervalDirty)
+ {
+ ANGLE_TRY(resetSwapChain(displayD3D, clientWidth, clientHeight));
+ }
+ else if (sizeDirty)
+ {
+ ANGLE_TRY(resizeSwapChain(displayD3D, clientWidth, clientHeight));
+ }
+
+ return egl::NoError();
+}
+
+egl::Error SurfaceD3D::swap(const gl::Context *context)
+{
+ DisplayD3D *displayD3D = GetImplAs<DisplayD3D>(context->getDisplay());
+ return swapRect(displayD3D, 0, 0, mWidth, mHeight);
+}
+
+egl::Error SurfaceD3D::postSubBuffer(const gl::Context *context,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height)
+{
+ DisplayD3D *displayD3D = GetImplAs<DisplayD3D>(context->getDisplay());
+ return swapRect(displayD3D, x, y, width, height);
+}
+
+rx::SwapChainD3D *SurfaceD3D::getSwapChain() const
+{
+ return mSwapChain;
+}
+
+void SurfaceD3D::setSwapInterval(EGLint interval)
+{
+ if (mSwapInterval == interval)
+ {
+ return;
+ }
+
+ mSwapInterval = interval;
+ mSwapIntervalDirty = true;
+}
+
+void SurfaceD3D::setFixedWidth(EGLint width)
+{
+ mFixedWidth = width;
+}
+
+void SurfaceD3D::setFixedHeight(EGLint height)
+{
+ mFixedHeight = height;
+}
+
+EGLint SurfaceD3D::getWidth() const
+{
+ return mWidth;
+}
+
+EGLint SurfaceD3D::getHeight() const
+{
+ return mHeight;
+}
+
+EGLint SurfaceD3D::isPostSubBufferSupported() const
+{
+ // post sub buffer is always possible on D3D surfaces
+ return EGL_TRUE;
+}
+
+EGLint SurfaceD3D::getSwapBehavior() const
+{
+ return EGL_BUFFER_PRESERVED;
+}
+
+egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+ if (attribute == EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE)
+ {
+ *value = mSwapChain->getShareHandle();
+ }
+ else if (attribute == EGL_DXGI_KEYED_MUTEX_ANGLE)
+ {
+ *value = mSwapChain->getKeyedMutex();
+ }
+ else
+ UNREACHABLE();
+
+ return egl::NoError();
+}
+
+const angle::Format *SurfaceD3D::getD3DTextureColorFormat() const
+{
+ return mColorFormat;
+}
+
+angle::Result SurfaceD3D::getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut)
+{
+ if (binding == GL_BACK)
+ {
+ *rtOut = mSwapChain->getColorRenderTarget();
+ }
+ else
+ {
+ *rtOut = mSwapChain->getDepthStencilRenderTarget();
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result SurfaceD3D::initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex)
+{
+ if (mState.config->renderTargetFormat != GL_NONE)
+ {
+ ANGLE_TRY(mRenderer->initRenderTarget(context, mSwapChain->getColorRenderTarget()));
+ }
+ if (mState.config->depthStencilFormat != GL_NONE)
+ {
+ ANGLE_TRY(mRenderer->initRenderTarget(context, mSwapChain->getDepthStencilRenderTarget()));
+ }
+ return angle::Result::Continue;
+}
+
+WindowSurfaceD3D::WindowSurfaceD3D(const egl::SurfaceState &state,
+ RendererD3D *renderer,
+ egl::Display *display,
+ EGLNativeWindowType window,
+ const egl::AttributeMap &attribs)
+ : SurfaceD3D(state, renderer, display, window, 0, static_cast<EGLClientBuffer>(0), attribs)
+{}
+
+WindowSurfaceD3D::~WindowSurfaceD3D() {}
+
+PbufferSurfaceD3D::PbufferSurfaceD3D(const egl::SurfaceState &state,
+ RendererD3D *renderer,
+ egl::Display *display,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs)
+ : SurfaceD3D(state,
+ renderer,
+ display,
+ static_cast<EGLNativeWindowType>(0),
+ buftype,
+ clientBuffer,
+ attribs)
+{}
+
+PbufferSurfaceD3D::~PbufferSurfaceD3D() {}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.h
new file mode 100644
index 0000000000..e725cda9f2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SurfaceD3D.h
@@ -0,0 +1,139 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SurfaceD3D.h: D3D implementation of an EGL surface
+
+#ifndef LIBANGLE_RENDERER_D3D_SURFACED3D_H_
+#define LIBANGLE_RENDERER_D3D_SURFACED3D_H_
+
+#include "libANGLE/renderer/SurfaceImpl.h"
+#include "libANGLE/renderer/d3d/NativeWindowD3D.h"
+
+namespace egl
+{
+class Surface;
+}
+
+namespace rx
+{
+class DisplayD3D;
+class SwapChainD3D;
+class RendererD3D;
+
+class SurfaceD3D : public SurfaceImpl
+{
+ public:
+ ~SurfaceD3D() override;
+ void releaseSwapChain();
+
+ egl::Error initialize(const egl::Display *display) override;
+ FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
+ const gl::FramebufferState &state) override;
+
+ egl::Error swap(const gl::Context *context) override;
+ egl::Error postSubBuffer(const gl::Context *context,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height) override;
+ egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
+ egl::Error bindTexImage(const gl::Context *context,
+ gl::Texture *texture,
+ EGLint buffer) override;
+ egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
+ egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
+ void setSwapInterval(EGLint interval) override;
+ void setFixedWidth(EGLint width) override;
+ void setFixedHeight(EGLint height) override;
+
+ EGLint getWidth() const override;
+ EGLint getHeight() const override;
+
+ EGLint isPostSubBufferSupported() const override;
+ EGLint getSwapBehavior() const override;
+
+ // D3D implementations
+ SwapChainD3D *getSwapChain() const;
+
+ egl::Error resetSwapChain(const egl::Display *display);
+
+ egl::Error checkForOutOfDateSwapChain(DisplayD3D *displayD3D);
+
+ angle::Result getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut) override;
+ angle::Result initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex) override;
+
+ const angle::Format *getD3DTextureColorFormat() const override;
+
+ protected:
+ SurfaceD3D(const egl::SurfaceState &state,
+ RendererD3D *renderer,
+ egl::Display *display,
+ EGLNativeWindowType window,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs);
+
+ egl::Error swapRect(DisplayD3D *displayD3D, EGLint x, EGLint y, EGLint width, EGLint height);
+ egl::Error resetSwapChain(DisplayD3D *displayD3D, int backbufferWidth, int backbufferHeight);
+ egl::Error resizeSwapChain(DisplayD3D *displayD3D, int backbufferWidth, int backbufferHeight);
+
+ RendererD3D *mRenderer;
+ egl::Display *mDisplay;
+
+ bool mFixedSize;
+ GLint mFixedWidth;
+ GLint mFixedHeight;
+ GLint mOrientation;
+
+ GLenum mRenderTargetFormat;
+ GLenum mDepthStencilFormat;
+ const angle::Format *mColorFormat;
+
+ SwapChainD3D *mSwapChain;
+ bool mSwapIntervalDirty;
+
+ NativeWindowD3D *mNativeWindow; // Handler for the Window that the surface is created for.
+ EGLint mWidth;
+ EGLint mHeight;
+
+ EGLint mSwapInterval;
+
+ HANDLE mShareHandle;
+ IUnknown *mD3DTexture;
+
+ EGLenum mBuftype;
+};
+
+class WindowSurfaceD3D : public SurfaceD3D
+{
+ public:
+ WindowSurfaceD3D(const egl::SurfaceState &state,
+ RendererD3D *renderer,
+ egl::Display *display,
+ EGLNativeWindowType window,
+ const egl::AttributeMap &attribs);
+ ~WindowSurfaceD3D() override;
+};
+
+class PbufferSurfaceD3D : public SurfaceD3D
+{
+ public:
+ PbufferSurfaceD3D(const egl::SurfaceState &state,
+ RendererD3D *renderer,
+ egl::Display *display,
+ EGLenum buftype,
+ EGLClientBuffer clientBuffer,
+ const egl::AttributeMap &attribs);
+ ~PbufferSurfaceD3D() override;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_SURFACED3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.cpp
new file mode 100644
index 0000000000..de8534c3da
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.cpp
@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SwapChainD3D.cpp: Defines a back-end specific class that hides the details of the
+// implementation-specific swapchain.
+
+#include "libANGLE/renderer/d3d/SwapChainD3D.h"
+
+namespace rx
+{
+
+SwapChainD3D::SwapChainD3D(HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat)
+ : mOffscreenRenderTargetFormat(backBufferFormat),
+ mDepthBufferFormat(depthBufferFormat),
+ mShareHandle(shareHandle),
+ mD3DTexture(d3dTexture)
+{
+ if (mD3DTexture)
+ {
+ mD3DTexture->AddRef();
+ }
+}
+
+SwapChainD3D::~SwapChainD3D()
+{
+ SafeRelease(mD3DTexture);
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.h
new file mode 100644
index 0000000000..443cadd680
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/SwapChainD3D.h
@@ -0,0 +1,83 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SwapChainD3D.h: Defines a back-end specific class that hides the details of the
+// implementation-specific swapchain.
+
+#ifndef LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_
+#define LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
+
+#include "common/angleutils.h"
+#include "common/platform.h"
+#include "libANGLE/Error.h"
+
+#if !defined(ANGLE_FORCE_VSYNC_OFF)
+# define ANGLE_FORCE_VSYNC_OFF 0
+#endif
+
+namespace gl
+{
+class Context;
+} // namespace gl
+
+namespace egl
+{
+class Display;
+} // namespace egl
+
+namespace rx
+{
+class DisplayD3D;
+class RenderTargetD3D;
+
+class SwapChainD3D : angle::NonCopyable
+{
+ public:
+ SwapChainD3D(HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat);
+ virtual ~SwapChainD3D();
+
+ virtual EGLint resize(DisplayD3D *displayD3D,
+ EGLint backbufferWidth,
+ EGLint backbufferSize) = 0;
+ virtual EGLint reset(DisplayD3D *displayD3D,
+ EGLint backbufferWidth,
+ EGLint backbufferHeight,
+ EGLint swapInterval) = 0;
+ virtual EGLint swapRect(DisplayD3D *displayD3D,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height) = 0;
+ virtual void recreate() = 0;
+
+ virtual RenderTargetD3D *getColorRenderTarget() = 0;
+ virtual RenderTargetD3D *getDepthStencilRenderTarget() = 0;
+
+ GLenum getRenderTargetInternalFormat() const { return mOffscreenRenderTargetFormat; }
+ GLenum getDepthBufferInternalFormat() const { return mDepthBufferFormat; }
+
+ HANDLE getShareHandle() { return mShareHandle; }
+ virtual void *getKeyedMutex() = 0;
+
+ virtual egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) = 0;
+
+ protected:
+ const GLenum mOffscreenRenderTargetFormat;
+ const GLenum mDepthBufferFormat;
+
+ HANDLE mShareHandle;
+ IUnknown *mD3DTexture;
+};
+
+} // namespace rx
+#endif // LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp
new file mode 100644
index 0000000000..fbbb0d832f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -0,0 +1,4213 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureD3D.cpp: Implementations of the Texture interfaces shared betweeen the D3D backends.
+
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/BufferImpl.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+#include "libANGLE/renderer/d3d/EGLImageD3D.h"
+#include "libANGLE/renderer/d3d/ImageD3D.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/SurfaceD3D.h"
+#include "libANGLE/renderer/d3d/TextureStorage.h"
+
+namespace rx
+{
+
+namespace
+{
+
+angle::Result GetUnpackPointer(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset,
+ const uint8_t **pointerOut)
+{
+ if (unpackBuffer)
+ {
+ // Do a CPU readback here, if we have an unpack buffer bound and the fast GPU path is not
+ // supported
+ ptrdiff_t offset = reinterpret_cast<ptrdiff_t>(pixels);
+
+ // TODO: this is the only place outside of renderer that asks for a buffers raw data.
+ // This functionality should be moved into renderer and the getData method of BufferImpl
+ // removed.
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(unpackBuffer);
+ ASSERT(bufferD3D);
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(bufferD3D->getData(context, &bufferData));
+ *pointerOut = bufferData + offset;
+ }
+ else
+ {
+ *pointerOut = pixels;
+ }
+
+ // Offset the pointer for 2D array layer (if it's valid)
+ if (*pointerOut != nullptr)
+ {
+ *pointerOut += layerOffset;
+ }
+
+ return angle::Result::Continue;
+}
+
+bool IsRenderTargetUsage(GLenum usage)
+{
+ return (usage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+}
+} // namespace
+
+TextureD3D::TextureD3D(const gl::TextureState &state, RendererD3D *renderer)
+ : TextureImpl(state),
+ mRenderer(renderer),
+ mDirtyImages(true),
+ mImmutable(false),
+ mTexStorage(nullptr),
+ mBaseLevel(0)
+{}
+
+TextureD3D::~TextureD3D()
+{
+ ASSERT(!mTexStorage);
+}
+
+angle::Result TextureD3D::getNativeTexture(const gl::Context *context, TextureStorage **outStorage)
+{
+ // ensure the underlying texture is created
+ ANGLE_TRY(initializeStorage(context, false));
+
+ if (mTexStorage)
+ {
+ ANGLE_TRY(updateStorage(context));
+ }
+
+ ASSERT(outStorage);
+
+ *outStorage = mTexStorage;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::getImageAndSyncFromStorage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D **outImage)
+{
+ ImageD3D *image = getImage(index);
+ if (mTexStorage && mTexStorage->isRenderTarget())
+ {
+ ANGLE_TRY(image->copyFromTexStorage(context, index, mTexStorage));
+ mDirtyImages = true;
+ }
+ *outImage = image;
+ return angle::Result::Continue;
+}
+
+GLint TextureD3D::getLevelZeroWidth() const
+{
+ ASSERT(gl::CountLeadingZeros(static_cast<uint32_t>(getBaseLevelWidth())) > getBaseLevel());
+ return getBaseLevelWidth() << mBaseLevel;
+}
+
+GLint TextureD3D::getLevelZeroHeight() const
+{
+ ASSERT(gl::CountLeadingZeros(static_cast<uint32_t>(getBaseLevelHeight())) > getBaseLevel());
+ return getBaseLevelHeight() << mBaseLevel;
+}
+
+GLint TextureD3D::getLevelZeroDepth() const
+{
+ return getBaseLevelDepth();
+}
+
+GLint TextureD3D::getBaseLevelWidth() const
+{
+ const ImageD3D *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getWidth() : 0);
+}
+
+GLint TextureD3D::getBaseLevelHeight() const
+{
+ const ImageD3D *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getHeight() : 0);
+}
+
+GLint TextureD3D::getBaseLevelDepth() const
+{
+ const ImageD3D *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 TextureD3D::getBaseLevelInternalFormat() const
+{
+ const ImageD3D *baseImage = getBaseLevelImage();
+ return (baseImage ? baseImage->getInternalFormat() : GL_NONE);
+}
+
+angle::Result TextureD3D::setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::setStorageMultisample(const gl::Context *context,
+ gl::TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const gl::Extents &size,
+ bool fixedSampleLocations)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::setStorageExternalMemory(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ gl::MemoryObject *memoryObject,
+ GLuint64 offset)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+bool TextureD3D::couldUseSetData() const
+{
+ if (!mRenderer->getFeatures().setDataFasterThanImageUpload.enabled)
+ {
+ return false;
+ }
+
+ if (!mRenderer->getFeatures().setDataFasterThanImageUploadOn128bitFormats.enabled)
+ {
+ gl::InternalFormat internalFormat =
+ gl::GetSizedInternalFormatInfo(getBaseLevelInternalFormat());
+ return internalFormat.pixelBytes < 16;
+ }
+
+ return true;
+}
+
+bool TextureD3D::shouldUseSetData(const ImageD3D *image) const
+{
+ if (!couldUseSetData())
+ {
+ return false;
+ }
+
+ if (image->isDirty())
+ {
+ return false;
+ }
+
+ gl::InternalFormat internalFormat = gl::GetSizedInternalFormatInfo(image->getInternalFormat());
+
+ // We can only handle full updates for depth-stencil textures, so to avoid complications
+ // disable them entirely.
+ if (internalFormat.depthBits > 0 || internalFormat.stencilBits > 0)
+ {
+ return false;
+ }
+
+ // TODO(jmadill): Handle compressed internal formats
+ return (mTexStorage && !internalFormat.compressed);
+}
+
+angle::Result TextureD3D::setImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
+{
+ ImageD3D *image = getImage(index);
+ gl::Buffer *unpackBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
+ ASSERT(image);
+
+ // No-op
+ if (image->getWidth() == 0 || image->getHeight() == 0 || image->getDepth() == 0)
+ {
+ return angle::Result::Continue;
+ }
+
+ // 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 uint8_t *pixelData = nullptr;
+ ANGLE_TRY(GetUnpackPointer(context, unpack, unpackBuffer, pixels, layerOffset, &pixelData));
+
+ if (pixelData != nullptr)
+ {
+ if (shouldUseSetData(image))
+ {
+ ANGLE_TRY(
+ mTexStorage->setData(context, index, image, nullptr, type, unpack, pixelData));
+ }
+ else
+ {
+ gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(),
+ image->getDepth());
+ ANGLE_TRY(image->loadData(context, fullImageArea, unpack, type, pixelData,
+ index.usesTex3D()));
+ }
+
+ mDirtyImages = true;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::subImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
+{
+ // CPU readback & copy where direct GPU copy is not supported
+ const uint8_t *pixelData = nullptr;
+ ANGLE_TRY(GetUnpackPointer(context, unpack, unpackBuffer, pixels, layerOffset, &pixelData));
+
+ if (pixelData != nullptr)
+ {
+ ImageD3D *image = getImage(index);
+ ASSERT(image);
+
+ if (shouldUseSetData(image))
+ {
+ return mTexStorage->setData(context, index, image, &area, type, unpack, pixelData);
+ }
+
+ ANGLE_TRY(image->loadData(context, area, unpack, type, pixelData, index.usesTex3D()));
+ ANGLE_TRY(commitRegion(context, index, area));
+ mDirtyImages = true;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::setCompressedImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
+{
+ ImageD3D *image = getImage(index);
+ ASSERT(image);
+
+ if (image->getWidth() == 0 || image->getHeight() == 0 || image->getDepth() == 0)
+ {
+ return angle::Result::Continue;
+ }
+
+ // 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 uint8_t *pixelData = nullptr;
+ gl::Buffer *unpackBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
+ ANGLE_TRY(GetUnpackPointer(context, unpack, unpackBuffer, pixels, layerOffset, &pixelData));
+
+ if (pixelData != nullptr)
+ {
+ gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
+ ANGLE_TRY(image->loadCompressedData(context, fullImageArea, pixelData));
+
+ mDirtyImages = true;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::subImageCompressed(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset)
+{
+ const uint8_t *pixelData = nullptr;
+ gl::Buffer *unpackBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
+ ANGLE_TRY(GetUnpackPointer(context, unpack, unpackBuffer, pixels, layerOffset, &pixelData));
+
+ if (pixelData != nullptr)
+ {
+ ImageD3D *image = getImage(index);
+ ASSERT(image);
+
+ ANGLE_TRY(image->loadCompressedData(context, area, pixelData));
+
+ mDirtyImages = true;
+ }
+
+ return angle::Result::Continue;
+}
+
+bool TextureD3D::isFastUnpackable(const gl::Buffer *unpackBuffer, GLenum sizedInternalFormat)
+{
+ return unpackBuffer != nullptr &&
+ mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat);
+}
+
+angle::Result TextureD3D::fastUnpackPixels(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ const gl::Box &destArea,
+ GLenum sizedInternalFormat,
+ GLenum type,
+ RenderTargetD3D *destRenderTarget)
+{
+ bool check = (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 ||
+ unpack.skipImages != 0);
+ ANGLE_CHECK(GetImplAs<ContextD3D>(context), !check,
+ "Unimplemented pixel store parameters in fastUnpackPixels", GL_INVALID_OPERATION);
+
+ // No-op
+ if (destArea.width <= 0 && destArea.height <= 0 && destArea.depth <= 0)
+ {
+ return angle::Result::Continue;
+ }
+
+ // 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));
+
+ uintptr_t offset = reinterpret_cast<uintptr_t>(pixels);
+
+ ANGLE_TRY(mRenderer->fastCopyBufferToTexture(context, unpack, static_cast<unsigned int>(offset),
+ destRenderTarget, sizedInternalFormat, type,
+ destArea));
+
+ return angle::Result::Continue;
+}
+
+GLint TextureD3D::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
+{
+ if ((gl::isPow2(width) && gl::isPow2(height) && gl::isPow2(depth)) ||
+ mRenderer->getNativeExtensions().textureNPOT)
+ {
+ // Maximum number of levels
+ return gl::log2(std::max(std::max(width, height), depth)) + 1;
+ }
+ else
+ {
+ // OpenGL ES 2.0 without GL_OES_texture_npot does not permit NPOT mipmaps.
+ return 1;
+ }
+}
+
+TextureStorage *TextureD3D::getStorage()
+{
+ ASSERT(mTexStorage);
+ return mTexStorage;
+}
+
+ImageD3D *TextureD3D::getBaseLevelImage() const
+{
+ if (mBaseLevel >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ return nullptr;
+ }
+ return getImage(getImageIndex(mBaseLevel, 0));
+}
+
+angle::Result TextureD3D::setImageExternal(const gl::Context *context,
+ gl::TextureType type,
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc)
+{
+ // Only external images can accept external textures
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::generateMipmap(const gl::Context *context)
+{
+ const GLuint baseLevel = mState.getEffectiveBaseLevel();
+ const GLuint maxLevel = mState.getMipmapMaxLevel();
+ ASSERT(maxLevel > baseLevel); // Should be checked before calling this.
+
+ if (mTexStorage && mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ // Switch to using the mipmapped texture.
+ TextureStorage *textureStorage = nullptr;
+ ANGLE_TRY(getNativeTexture(context, &textureStorage));
+ ANGLE_TRY(textureStorage->useLevelZeroWorkaroundTexture(context, false));
+ }
+
+ // Set up proper mipmap chain in our Image array.
+ ANGLE_TRY(initMipmapImages(context));
+
+ if (mTexStorage && mTexStorage->supportsNativeMipmapFunction())
+ {
+ ANGLE_TRY(updateStorage(context));
+
+ // Generate the mipmap chain using the ad-hoc DirectX function.
+ ANGLE_TRY(mRenderer->generateMipmapUsingD3D(context, mTexStorage, mState));
+ }
+ else
+ {
+ // Generate the mipmap chain, one level at a time.
+ ANGLE_TRY(generateMipmapUsingImages(context, maxLevel));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::generateMipmapUsingImages(const gl::Context *context,
+ const GLuint maxLevel)
+{
+ // We know that all layers have the same dimension, for the texture to be complete
+ GLint layerCount = static_cast<GLint>(getLayerCount(mBaseLevel));
+
+ // When making mipmaps with the setData workaround enabled, the texture storage has
+ // the image data already. For non-render-target storage, we have to pull it out into
+ // an image layer.
+ if (mTexStorage && couldUseSetData())
+ {
+ if (!mTexStorage->isRenderTarget())
+ {
+ // Copy from the storage mip 0 to Image mip 0
+ for (GLint layer = 0; layer < layerCount; ++layer)
+ {
+ gl::ImageIndex srcIndex = getImageIndex(mBaseLevel, layer);
+
+ ImageD3D *image = getImage(srcIndex);
+ ANGLE_TRY(image->copyFromTexStorage(context, srcIndex, mTexStorage));
+ }
+ }
+ else
+ {
+ ANGLE_TRY(updateStorage(context));
+ }
+ }
+
+ // TODO: Decouple this from zeroMaxLodWorkaround. This is a 9_3 restriction, unrelated to
+ // zeroMaxLodWorkaround. The restriction is because Feature Level 9_3 can't create SRVs on
+ // individual levels of the texture. As a result, even if the storage is a rendertarget, we
+ // can't use the GPU to generate the mipmaps without further work. The D3D9 renderer works
+ // around this by copying each level of the texture into its own single-layer GPU texture (in
+ // Blit9::boxFilter). Feature Level 9_3 could do something similar, or it could continue to use
+ // CPU-side mipmap generation, or something else.
+ bool renderableStorage = (mTexStorage && mTexStorage->isRenderTarget() &&
+ !(mRenderer->getFeatures().zeroMaxLodWorkaround.enabled));
+
+ for (GLint layer = 0; layer < layerCount; ++layer)
+ {
+ for (GLuint mip = mBaseLevel + 1; mip <= maxLevel; ++mip)
+ {
+ ASSERT(getLayerCount(mip) == layerCount);
+
+ gl::ImageIndex sourceIndex = getImageIndex(mip - 1, layer);
+ gl::ImageIndex destIndex = getImageIndex(mip, layer);
+
+ if (renderableStorage)
+ {
+ // GPU-side mipmapping
+ ANGLE_TRY(mTexStorage->generateMipmap(context, sourceIndex, destIndex));
+ }
+ else
+ {
+ // CPU-side mipmapping
+ ANGLE_TRY(
+ mRenderer->generateMipmap(context, getImage(destIndex), getImage(sourceIndex)));
+ }
+ }
+ }
+
+ mDirtyImages = true;
+
+ if (mTexStorage)
+ {
+ ANGLE_TRY(updateStorage(context));
+ }
+
+ return angle::Result::Continue;
+}
+
+bool TextureD3D::isBaseImageZeroSize() const
+{
+ ImageD3D *baseImage = getBaseLevelImage();
+
+ if (!baseImage || baseImage->getWidth() <= 0 || baseImage->getHeight() <= 0)
+ {
+ return true;
+ }
+
+ if (baseImage->getType() == gl::TextureType::_3D && baseImage->getDepth() <= 0)
+ {
+ return true;
+ }
+
+ if (baseImage->getType() == gl::TextureType::_2DArray && getLayerCount(getBaseLevel()) <= 0)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+angle::Result TextureD3D::ensureRenderTarget(const gl::Context *context)
+{
+ ANGLE_TRY(initializeStorage(context, true));
+
+ // initializeStorage can fail with NoError if the texture is not complete. This is not
+ // an error for incomplete sampling, but it is a big problem for rendering.
+ if (!mTexStorage)
+ {
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Stop;
+ }
+
+ if (!isBaseImageZeroSize())
+ {
+ ASSERT(mTexStorage);
+ if (!mTexStorage->isRenderTarget())
+ {
+ TexStoragePointer newRenderTargetStorage(context);
+ ANGLE_TRY(createCompleteStorage(true, &newRenderTargetStorage));
+
+ ANGLE_TRY(mTexStorage->copyToStorage(context, newRenderTargetStorage.get()));
+ ANGLE_TRY(setCompleteTexStorage(context, newRenderTargetStorage.get()));
+ newRenderTargetStorage.release();
+ // If this texture is used in compute shader, we should invalidate this texture so that
+ // the UAV/SRV is rebound again with this new texture storage in next dispatch call.
+ mTexStorage->invalidateTextures();
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+bool TextureD3D::canCreateRenderTargetForImage(const gl::ImageIndex &index) const
+{
+ if (index.getType() == gl::TextureType::_2DMultisample ||
+ index.getType() == gl::TextureType::_2DMultisampleArray)
+ {
+ ASSERT(index.getType() != gl::TextureType::_2DMultisampleArray || index.hasLayer());
+ return true;
+ }
+
+ ImageD3D *image = getImage(index);
+ ASSERT(image);
+ bool levelsComplete = (isImageComplete(index) && isImageComplete(getImageIndex(0, 0)));
+ return (image->isRenderableFormat() && levelsComplete);
+}
+
+angle::Result TextureD3D::commitRegion(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &region)
+{
+ if (mTexStorage)
+ {
+ ASSERT(isValidIndex(index));
+ ImageD3D *image = getImage(index);
+ ANGLE_TRY(image->copyToStorage(context, mTexStorage, index, region));
+ image->markClean();
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut)
+{
+ RenderTargetD3D *rtD3D = nullptr;
+ ANGLE_TRY(getRenderTarget(context, imageIndex, &rtD3D));
+ *rtOut = static_cast<FramebufferAttachmentRenderTarget *>(rtD3D);
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::setBaseLevel(const gl::Context *context, GLuint baseLevel)
+{
+ const int oldStorageWidth = std::max(1, getLevelZeroWidth());
+ const int oldStorageHeight = std::max(1, getLevelZeroHeight());
+ const int oldStorageDepth = std::max(1, getLevelZeroDepth());
+ const int oldStorageFormat = getBaseLevelInternalFormat();
+ mBaseLevel = baseLevel;
+
+ // When the base level changes, the texture storage might not be valid anymore, since it could
+ // have been created based on the dimensions of the previous specified level range.
+ const int newStorageWidth = std::max(1, getLevelZeroWidth());
+ const int newStorageHeight = std::max(1, getLevelZeroHeight());
+ const int newStorageDepth = std::max(1, getLevelZeroDepth());
+ const int newStorageFormat = getBaseLevelInternalFormat();
+ if (mTexStorage &&
+ (newStorageWidth != oldStorageWidth || newStorageHeight != oldStorageHeight ||
+ newStorageDepth != oldStorageDepth || newStorageFormat != oldStorageFormat))
+ {
+ markAllImagesDirty();
+ ANGLE_TRY(releaseTexStorage(context));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::syncState(const gl::Context *context,
+ const gl::Texture::DirtyBits &dirtyBits)
+{
+ // This could be improved using dirty bits.
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D::releaseTexStorage(const gl::Context *context)
+{
+ if (!mTexStorage)
+ {
+ return angle::Result::Continue;
+ }
+
+ auto err = mTexStorage->onDestroy(context);
+ SafeDelete(mTexStorage);
+ return err;
+}
+
+void TextureD3D::onDestroy(const gl::Context *context)
+{
+ (void)releaseTexStorage(context);
+}
+
+angle::Result TextureD3D::initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex)
+{
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+ gl::ImageIndex index = imageIndex;
+
+ // Special case for D3D11 3D textures. We can't create render targets for individual layers of a
+ // 3D texture, so force the clear to the entire mip. There shouldn't ever be a case where we
+ // would lose existing data.
+ if (index.getType() == gl::TextureType::_3D)
+ {
+ index = gl::ImageIndex::Make3D(index.getLevelIndex(), gl::ImageIndex::kEntireLevel);
+ }
+ else if (index.getType() == gl::TextureType::_2DArray && !index.hasLayer())
+ {
+ std::array<GLint, gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS> tempLayerCounts;
+
+ GLint levelIndex = index.getLevelIndex();
+ tempLayerCounts[levelIndex] = getLayerCount(levelIndex);
+ gl::ImageIndexIterator iterator =
+ gl::ImageIndexIterator::Make2DArray(levelIndex, levelIndex + 1, tempLayerCounts.data());
+ while (iterator.hasNext())
+ {
+ ANGLE_TRY(initializeContents(context, iterator.next()));
+ }
+ return angle::Result::Continue;
+ }
+ else if (index.getType() == gl::TextureType::_2DMultisampleArray && !index.hasLayer())
+ {
+ std::array<GLint, gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS> tempLayerCounts;
+
+ ASSERT(index.getLevelIndex() == 0);
+ tempLayerCounts[0] = getLayerCount(0);
+ gl::ImageIndexIterator iterator =
+ gl::ImageIndexIterator::Make2DMultisampleArray(tempLayerCounts.data());
+ while (iterator.hasNext())
+ {
+ ANGLE_TRY(initializeContents(context, iterator.next()));
+ }
+ return angle::Result::Continue;
+ }
+
+ // Force image clean.
+ ImageD3D *image = getImage(index);
+ if (image)
+ {
+ image->markClean();
+ }
+
+ // Fast path: can use a render target clear.
+ // We don't use the fast path with the zero max lod workaround because it would introduce a race
+ // between the rendertarget and the staging images.
+ const angle::FeaturesD3D &features = mRenderer->getFeatures();
+ bool shouldUseClear = (image == nullptr);
+ if (canCreateRenderTargetForImage(index) && !features.zeroMaxLodWorkaround.enabled &&
+ (shouldUseClear || features.allowClearForRobustResourceInit.enabled))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(mTexStorage);
+ RenderTargetD3D *renderTarget = nullptr;
+ ANGLE_TRY(mTexStorage->getRenderTarget(context, index, &renderTarget));
+ ANGLE_TRY(mRenderer->initRenderTarget(context, renderTarget));
+ return angle::Result::Continue;
+ }
+
+ ASSERT(image != nullptr);
+
+ // Slow path: non-renderable texture or the texture levels aren't set up.
+ const auto &formatInfo = gl::GetSizedInternalFormatInfo(image->getInternalFormat());
+
+ GLuint imageBytes = 0;
+ ANGLE_CHECK_GL_MATH(contextD3D, formatInfo.computeRowPitch(formatInfo.type, image->getWidth(),
+ 1, 0, &imageBytes));
+ imageBytes *= image->getHeight() * image->getDepth();
+
+ gl::PixelUnpackState zeroDataUnpackState;
+ zeroDataUnpackState.alignment = 1;
+
+ angle::MemoryBuffer *zeroBuffer = nullptr;
+ ANGLE_CHECK_GL_ALLOC(contextD3D, context->getZeroFilledBuffer(imageBytes, &zeroBuffer));
+
+ if (shouldUseSetData(image))
+ {
+ ANGLE_TRY(mTexStorage->setData(context, index, image, nullptr, formatInfo.type,
+ zeroDataUnpackState, zeroBuffer->data()));
+ }
+ else
+ {
+ gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
+ ANGLE_TRY(image->loadData(context, fullImageArea, zeroDataUnpackState, formatInfo.type,
+ zeroBuffer->data(), false));
+
+ // Force an update to the tex storage so we avoid problems with subImage and dirty regions.
+ if (mTexStorage)
+ {
+ ANGLE_TRY(commitRegion(context, index, fullImageArea));
+ image->markClean();
+ }
+ else
+ {
+ mDirtyImages = true;
+ }
+ }
+ return angle::Result::Continue;
+}
+
+TextureD3D_2D::TextureD3D_2D(const gl::TextureState &state, RendererD3D *renderer)
+ : TextureD3D(state, renderer)
+{
+ mEGLImageTarget = false;
+ for (auto &image : mImageArray)
+ {
+ image.reset(renderer->createImage());
+ }
+}
+
+void TextureD3D_2D::onDestroy(const gl::Context *context)
+{
+ // Delete the Images before the TextureStorage. Images might be relying on the TextureStorage
+ // for some of their data. If TextureStorage is deleted before the Images, then their data will
+ // be wastefully copied back from the GPU before we delete the Images.
+ for (auto &image : mImageArray)
+ {
+ image.reset();
+ }
+ return TextureD3D::onDestroy(context);
+}
+
+TextureD3D_2D::~TextureD3D_2D() {}
+
+ImageD3D *TextureD3D_2D::getImage(int level, int layer) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(layer == 0);
+ return mImageArray[level].get();
+}
+
+ImageD3D *TextureD3D_2D::getImage(const gl::ImageIndex &index) const
+{
+ ASSERT(index.getLevelIndex() < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(!index.hasLayer());
+ ASSERT(index.getType() == gl::TextureType::_2D);
+ return mImageArray[index.getLevelIndex()].get();
+}
+
+GLsizei TextureD3D_2D::getLayerCount(int level) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ return 1;
+}
+
+GLsizei TextureD3D_2D::getWidth(GLint level) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[level]->getWidth();
+ else
+ return 0;
+}
+
+GLsizei TextureD3D_2D::getHeight(GLint level) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[level]->getHeight();
+ else
+ return 0;
+}
+
+GLenum TextureD3D_2D::getInternalFormat(GLint level) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[level]->getInternalFormat();
+ else
+ return GL_NONE;
+}
+
+bool TextureD3D_2D::isDepth(GLint level) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level)).depthBits > 0;
+}
+
+bool TextureD3D_2D::isSRGB(GLint level) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level)).colorEncoding == GL_SRGB;
+}
+
+angle::Result TextureD3D_2D::setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D && size.depth == 1);
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+
+ bool fastUnpacked = false;
+
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormatInfo.sizedInternalFormat,
+ size, false));
+
+ // Attempt a fast gpu copy of the pixel data to the surface
+ gl::Buffer *unpackBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
+ if (isFastUnpackable(unpackBuffer, internalFormatInfo.sizedInternalFormat) &&
+ isLevelComplete(index.getLevelIndex()))
+ {
+ // Will try to create RT storage if it does not exist
+ RenderTargetD3D *destRenderTarget = nullptr;
+ ANGLE_TRY(getRenderTarget(context, index, &destRenderTarget));
+
+ gl::Box destArea(0, 0, 0, getWidth(index.getLevelIndex()), getHeight(index.getLevelIndex()),
+ 1);
+
+ ANGLE_TRY(fastUnpackPixels(context, unpack, pixels, destArea,
+ internalFormatInfo.sizedInternalFormat, type, destRenderTarget));
+
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[index.getLevelIndex()]->markClean();
+
+ fastUnpacked = true;
+ }
+
+ if (!fastUnpacked)
+ {
+ ANGLE_TRY(setImageImpl(context, index, type, unpack, pixels, 0));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D && area.depth == 1 && area.z == 0);
+
+ GLenum mipFormat = getInternalFormat(index.getLevelIndex());
+ if (isFastUnpackable(unpackBuffer, mipFormat) && isLevelComplete(index.getLevelIndex()))
+ {
+ RenderTargetD3D *renderTarget = nullptr;
+ ANGLE_TRY(getRenderTarget(context, index, &renderTarget));
+ ASSERT(!mImageArray[index.getLevelIndex()]->isDirty());
+
+ return fastUnpackPixels(context, unpack, pixels, area, mipFormat, type, renderTarget);
+ }
+ else
+ {
+ return TextureD3D::subImage(context, index, area, format, type, unpack, unpackBuffer,
+ pixels, 0);
+ }
+}
+
+angle::Result TextureD3D_2D::setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D && size.depth == 1);
+
+ // compressed formats don't have separate sized internal formats-- we can just use the
+ // compressed format directly
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormat, size, false));
+
+ return setCompressedImageImpl(context, index, unpack, pixels, 0);
+}
+
+angle::Result TextureD3D_2D::setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D && area.depth == 1 && area.z == 0);
+ ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0));
+
+ return commitRegion(context, index, area);
+}
+
+angle::Result TextureD3D_2D::copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D);
+
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE);
+ gl::Extents sourceExtents(sourceArea.width, sourceArea.height, 1);
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormatInfo.sizedInternalFormat,
+ sourceExtents, false));
+
+ gl::Extents fbSize = source->getReadColorAttachment()->getSize();
+
+ // Does the read area extend beyond the framebuffer?
+ bool outside = sourceArea.x < 0 || sourceArea.y < 0 ||
+ sourceArea.x + sourceArea.width > fbSize.width ||
+ sourceArea.y + sourceArea.height > fbSize.height;
+
+ // WebGL requires that pixels that would be outside the framebuffer are treated as zero values,
+ // so clear the mip level to 0 prior to making the copy if any pixel would be sampled outside.
+ // Same thing for robust resource init.
+ if (outside &&
+ (context->getExtensions().webglCompatibility || context->isRobustResourceInitEnabled()))
+ {
+ ANGLE_TRY(initializeContents(context, index));
+ }
+
+ gl::Rectangle clippedArea;
+ if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height), &clippedArea))
+ {
+ // Empty source area, nothing to do.
+ return angle::Result::Continue;
+ }
+
+ gl::Offset destOffset(clippedArea.x - sourceArea.x, clippedArea.y - sourceArea.y, 0);
+
+ // If the zero max LOD workaround is active, then we can't sample from individual layers of the
+ // framebuffer in shaders, so we should use the non-rendering copy path.
+ if (!canCreateRenderTargetForImage(index) ||
+ mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ANGLE_TRY(mImageArray[index.getLevelIndex()]->copyFromFramebuffer(context, destOffset,
+ clippedArea, source));
+ mDirtyImages = true;
+ }
+ else
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+
+ if (clippedArea.width != 0 && clippedArea.height != 0 &&
+ isValidLevel(index.getLevelIndex()))
+ {
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyImage2D(context, source, clippedArea, internalFormat,
+ destOffset, mTexStorage, index.getLevelIndex()));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D && destOffset.z == 0);
+
+ gl::Extents fbSize = source->getReadColorAttachment()->getSize();
+ gl::Rectangle clippedArea;
+ if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height), &clippedArea))
+ {
+ return angle::Result::Continue;
+ }
+ const gl::Offset clippedOffset(destOffset.x + clippedArea.x - sourceArea.x,
+ destOffset.y + clippedArea.y - sourceArea.y, 0);
+
+ // 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)
+
+ // If the zero max LOD workaround is active, then we can't sample from individual layers of the
+ // framebuffer in shaders, so we should use the non-rendering copy path.
+ if (!canCreateRenderTargetForImage(index) ||
+ mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ANGLE_TRY(mImageArray[index.getLevelIndex()]->copyFromFramebuffer(context, clippedOffset,
+ clippedArea, source));
+ mDirtyImages = true;
+ }
+ else
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+
+ if (isValidLevel(index.getLevelIndex()))
+ {
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyImage2D(context, source, clippedArea,
+ gl::GetUnsizedFormat(getBaseLevelInternalFormat()),
+ clippedOffset, mTexStorage, index.getLevelIndex()));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D);
+
+ gl::TextureType sourceType = source->getType();
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+ gl::Extents size(
+ static_cast<int>(source->getWidth(NonCubeTextureTypeToTarget(sourceType), sourceLevel)),
+ static_cast<int>(source->getHeight(NonCubeTextureTypeToTarget(sourceType), sourceLevel)),
+ 1);
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormatInfo.sizedInternalFormat,
+ size, false));
+
+ gl::Box sourceBox(0, 0, 0, size.width, size.height, 1);
+ gl::Offset destOffset(0, 0, 0);
+
+ if (!isSRGB(index.getLevelIndex()) && canCreateRenderTargetForImage(index))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidLevel(index.getLevelIndex()));
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_2D, sourceBox,
+ internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ gl::ImageIndex sourceImageIndex = gl::ImageIndex::Make2D(static_cast<GLint>(sourceLevel));
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+ ImageD3D *sourceImage = nullptr;
+ ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage));
+
+ ImageD3D *destImage = nullptr;
+ ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage));
+
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceBox, destOffset,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(destOffset, size);
+ ANGLE_TRY(commitRegion(context, index, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2D);
+
+ if (!isSRGB(index.getLevelIndex()) && canCreateRenderTargetForImage(index))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidLevel(index.getLevelIndex()));
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetSizedInternalFormatInfo(getInternalFormat(index.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_2D, sourceBox,
+ internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ gl::ImageIndex sourceImageIndex = gl::ImageIndex::Make2D(static_cast<GLint>(sourceLevel));
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+ ImageD3D *sourceImage = nullptr;
+ ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage));
+
+ ImageD3D *destImage = nullptr;
+ ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage));
+
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceBox, destOffset,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(destOffset.x, destOffset.y, 0, sourceBox.width, sourceBox.height, 1);
+ ANGLE_TRY(commitRegion(context, index, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source)
+{
+ gl::TextureTarget sourceTarget = NonCubeTextureTypeToTarget(source->getType());
+ GLint sourceLevel = 0;
+
+ GLint destLevel = 0;
+
+ GLenum sizedInternalFormat =
+ source->getFormat(sourceTarget, sourceLevel).info->sizedInternalFormat;
+ gl::Extents size(static_cast<int>(source->getWidth(sourceTarget, sourceLevel)),
+ static_cast<int>(source->getHeight(sourceTarget, sourceLevel)), 1);
+ ANGLE_TRY(redefineImage(context, destLevel, sizedInternalFormat, size, false));
+
+ ANGLE_TRY(initializeStorage(context, false));
+ ASSERT(mTexStorage);
+
+ ANGLE_TRY(
+ mRenderer->copyCompressedTexture(context, source, sourceLevel, mTexStorage, destLevel));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size)
+{
+ ASSERT(type == gl::TextureType::_2D && size.depth == 1);
+
+ for (size_t level = 0; level < levels; level++)
+ {
+ gl::Extents levelSize(std::max(1, size.width >> level), std::max(1, size.height >> level),
+ 1);
+ ANGLE_TRY(redefineImage(context, level, internalFormat, levelSize, true));
+ }
+
+ for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ ANGLE_TRY(redefineImage(context, level, GL_NONE, gl::Extents(0, 0, 1), true));
+ }
+
+ // TODO(geofflang): Verify storage creation had no errors
+ bool renderTarget = IsRenderTargetUsage(mState.getUsage());
+ TexStoragePointer storage(context);
+ storage.reset(mRenderer->createTextureStorage2D(internalFormat, renderTarget, size.width,
+ size.height, static_cast<int>(levels), false));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ANGLE_TRY(updateStorage(context));
+
+ mImmutable = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::bindTexImage(const gl::Context *context, egl::Surface *surface)
+{
+ GLenum internalformat = surface->getConfig()->renderTargetFormat;
+
+ gl::Extents size(surface->getWidth(), surface->getHeight(), 1);
+ ANGLE_TRY(redefineImage(context, 0, internalformat, size, true));
+
+ ANGLE_TRY(releaseTexStorage(context));
+
+ SurfaceD3D *surfaceD3D = GetImplAs<SurfaceD3D>(surface);
+ ASSERT(surfaceD3D);
+
+ mTexStorage = mRenderer->createTextureStorage2D(surfaceD3D->getSwapChain());
+ mEGLImageTarget = false;
+
+ mDirtyImages = false;
+ mImageArray[0]->markClean();
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::releaseTexImage(const gl::Context *context)
+{
+ if (mTexStorage)
+ {
+ ANGLE_TRY(releaseTexStorage(context));
+ }
+
+ for (int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ ANGLE_TRY(redefineImage(context, i, GL_NONE, gl::Extents(0, 0, 1), true));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image)
+{
+ EGLImageD3D *eglImaged3d = GetImplAs<EGLImageD3D>(image);
+
+ // Set the properties of the base mip level from the EGL image
+ const auto &format = image->getFormat();
+ gl::Extents size(static_cast<int>(image->getWidth()), static_cast<int>(image->getHeight()), 1);
+ ANGLE_TRY(redefineImage(context, 0, format.info->sizedInternalFormat, size, true));
+
+ // Clear all other images.
+ for (size_t level = 1; level < mImageArray.size(); level++)
+ {
+ ANGLE_TRY(redefineImage(context, level, GL_NONE, gl::Extents(0, 0, 1), true));
+ }
+
+ ANGLE_TRY(releaseTexStorage(context));
+ mImageArray[0]->markClean();
+
+ // Pass in the RenderTargetD3D here: createTextureStorage can't generate an error.
+ RenderTargetD3D *renderTargetD3D = nullptr;
+ ANGLE_TRY(eglImaged3d->getRenderTarget(context, &renderTargetD3D));
+
+ mTexStorage = mRenderer->createTextureStorageEGLImage(eglImaged3d, renderTargetD3D);
+ mEGLImageTarget = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::initMipmapImages(const gl::Context *context)
+{
+ const GLuint baseLevel = mState.getEffectiveBaseLevel();
+ const GLuint maxLevel = mState.getMipmapMaxLevel();
+ // Purge array levels baseLevel + 1 through q and reset them to represent the generated mipmap
+ // levels.
+ for (GLuint level = baseLevel + 1; level <= maxLevel; level++)
+ {
+ gl::Extents levelSize(std::max(getLevelZeroWidth() >> level, 1),
+ std::max(getLevelZeroHeight() >> level, 1), 1);
+
+ ANGLE_TRY(redefineImage(context, level, getBaseLevelInternalFormat(), levelSize, false));
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(!index.hasLayer());
+
+ // ensure the underlying texture is created
+ ANGLE_TRY(ensureRenderTarget(context));
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+
+ return mTexStorage->getRenderTarget(context, index, outRT);
+}
+
+bool TextureD3D_2D::isValidLevel(int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : false);
+}
+
+bool TextureD3D_2D::isLevelComplete(int level) const
+{
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ GLsizei width = getLevelZeroWidth();
+ GLsizei height = getLevelZeroHeight();
+
+ if (width <= 0 || height <= 0)
+ {
+ return false;
+ }
+
+ // The base image level is complete if the width and height are positive
+ if (level == static_cast<int>(getBaseLevel()))
+ {
+ return true;
+ }
+
+ ASSERT(level >= 0 && level <= static_cast<int>(mImageArray.size()) &&
+ mImageArray[level] != nullptr);
+ ImageD3D *image = mImageArray[level].get();
+
+ if (image->getInternalFormat() != getBaseLevelInternalFormat())
+ {
+ return false;
+ }
+
+ if (image->getWidth() != std::max(1, width >> level))
+ {
+ return false;
+ }
+
+ if (image->getHeight() != std::max(1, height >> level))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool TextureD3D_2D::isImageComplete(const gl::ImageIndex &index) const
+{
+ return isLevelComplete(index.getLevelIndex());
+}
+
+// Constructs a native texture resource from the texture images
+angle::Result TextureD3D_2D::initializeStorage(const gl::Context *context, bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return angle::Result::Continue;
+ }
+
+ // do not attempt to create storage for nonexistant data
+ if (!isLevelComplete(getBaseLevel()))
+ {
+ return angle::Result::Continue;
+ }
+
+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
+
+ TexStoragePointer storage(context);
+ ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ ANGLE_TRY(updateStorage(context));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
+{
+ GLsizei width = getLevelZeroWidth();
+ GLsizei height = getLevelZeroHeight();
+ GLenum internalFormat = getBaseLevelInternalFormat();
+
+ ASSERT(width > 0 && height > 0);
+
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(width, height, 1));
+
+ bool hintLevelZeroOnly = false;
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ // If any of the CPU images (levels >= 1) are dirty, then the textureStorage2D should use
+ // the mipped texture to begin with. Otherwise, it should use the level-zero-only texture.
+ hintLevelZeroOnly = true;
+ for (int level = 1; level < levels && hintLevelZeroOnly; level++)
+ {
+ hintLevelZeroOnly = !(mImageArray[level]->isDirty() && isLevelComplete(level));
+ }
+ }
+
+ // TODO(geofflang): Determine if the texture creation succeeded
+ outStorage->reset(mRenderer->createTextureStorage2D(internalFormat, renderTarget, width, height,
+ levels, hintLevelZeroOnly));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
+{
+ if (newCompleteTexStorage && newCompleteTexStorage->isManaged())
+ {
+ for (int level = 0; level < newCompleteTexStorage->getLevelCount(); level++)
+ {
+ ANGLE_TRY(
+ mImageArray[level]->setManagedSurface2D(context, newCompleteTexStorage, level));
+ }
+ }
+
+ ANGLE_TRY(releaseTexStorage(context));
+ mTexStorage = newCompleteTexStorage;
+
+ mDirtyImages = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::updateStorage(const gl::Context *context)
+{
+ if (!mDirtyImages)
+ {
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mTexStorage != nullptr);
+ GLint storageLevels = mTexStorage->getLevelCount();
+ for (int level = 0; level < storageLevels; level++)
+ {
+ if (mImageArray[level]->isDirty() && isLevelComplete(level))
+ {
+ ANGLE_TRY(updateStorageLevel(context, level));
+ }
+ }
+
+ mDirtyImages = false;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::updateStorageLevel(const gl::Context *context, int level)
+{
+ ASSERT(level <= static_cast<int>(mImageArray.size()) && mImageArray[level] != nullptr);
+ ASSERT(isLevelComplete(level));
+
+ if (mImageArray[level]->isDirty())
+ {
+ gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+ gl::Box region(0, 0, 0, getWidth(level), getHeight(level), 1);
+ ANGLE_TRY(commitRegion(context, index, region));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2D::redefineImage(const gl::Context *context,
+ size_t level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
+{
+ ASSERT(size.depth == 1);
+
+ // If there currently is a corresponding storage texture image, it has these parameters
+ const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
+ const int storageHeight = std::max(1, getLevelZeroHeight() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ mImageArray[level]->redefine(gl::TextureType::_2D, internalformat, size, forceRelease);
+ mDirtyImages = mDirtyImages || mImageArray[level]->isDirty();
+
+ if (mTexStorage)
+ {
+ const size_t storageLevels = mTexStorage->getLevelCount();
+
+ // If the storage was from an EGL image, copy it back into local images to preserve it
+ // while orphaning
+ if (level != 0 && mEGLImageTarget)
+ {
+ ANGLE_TRY(mImageArray[0]->copyFromTexStorage(context, gl::ImageIndex::Make2D(0),
+ mTexStorage));
+ }
+
+ if ((level >= storageLevels && storageLevels != 0) || size.width != storageWidth ||
+ size.height != storageHeight ||
+ internalformat != storageFormat) // Discard mismatched storage
+ {
+ ANGLE_TRY(releaseTexStorage(context));
+ markAllImagesDirty();
+ }
+ }
+
+ // Can't be an EGL image target after being redefined
+ mEGLImageTarget = false;
+
+ return angle::Result::Continue;
+}
+
+gl::ImageIndexIterator TextureD3D_2D::imageIterator() const
+{
+ return gl::ImageIndexIterator::Make2D(0, mTexStorage->getLevelCount());
+}
+
+gl::ImageIndex TextureD3D_2D::getImageIndex(GLint mip, GLint /*layer*/) const
+{
+ // "layer" does not apply to 2D Textures.
+ return gl::ImageIndex::Make2D(mip);
+}
+
+bool TextureD3D_2D::isValidIndex(const gl::ImageIndex &index) const
+{
+ return (mTexStorage && index.getType() == gl::TextureType::_2D && index.getLevelIndex() >= 0 &&
+ index.getLevelIndex() < mTexStorage->getLevelCount());
+}
+
+void TextureD3D_2D::markAllImagesDirty()
+{
+ for (size_t i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mImageArray[i]->markDirty();
+ }
+ mDirtyImages = true;
+}
+
+TextureD3D_Cube::TextureD3D_Cube(const gl::TextureState &state, RendererD3D *renderer)
+ : TextureD3D(state, renderer)
+{
+ for (auto &face : mImageArray)
+ {
+ for (auto &image : face)
+ {
+ image.reset(renderer->createImage());
+ }
+ }
+}
+
+void TextureD3D_Cube::onDestroy(const gl::Context *context)
+{
+ // Delete the Images before the TextureStorage. Images might be relying on the TextureStorage
+ // for some of their data. If TextureStorage is deleted before the Images, then their data will
+ // be wastefully copied back from the GPU before we delete the Images.
+ for (auto &face : mImageArray)
+ {
+ for (auto &image : face)
+ {
+ image.reset();
+ }
+ }
+ return TextureD3D::onDestroy(context);
+}
+
+TextureD3D_Cube::~TextureD3D_Cube() {}
+
+ImageD3D *TextureD3D_Cube::getImage(int level, int layer) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(layer >= 0 && static_cast<size_t>(layer) < gl::kCubeFaceCount);
+ return mImageArray[layer][level].get();
+}
+
+ImageD3D *TextureD3D_Cube::getImage(const gl::ImageIndex &index) const
+{
+ ASSERT(index.getLevelIndex() < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(gl::IsCubeMapFaceTarget(index.getTarget()));
+ return mImageArray[index.cubeMapFaceIndex()][index.getLevelIndex()].get();
+}
+
+GLsizei TextureD3D_Cube::getLayerCount(int level) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ return gl::kCubeFaceCount;
+}
+
+GLenum TextureD3D_Cube::getInternalFormat(GLint level, GLint layer) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[layer][level]->getInternalFormat();
+ else
+ return GL_NONE;
+}
+
+bool TextureD3D_Cube::isDepth(GLint level, GLint layer) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level, layer)).depthBits > 0;
+}
+
+bool TextureD3D_Cube::isSRGB(GLint level, GLint layer) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level, layer)).colorEncoding == GL_SRGB;
+}
+
+angle::Result TextureD3D_Cube::setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
+{
+ ASSERT(size.depth == 1);
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+ ANGLE_TRY(redefineImage(context, index.cubeMapFaceIndex(), index.getLevelIndex(),
+ internalFormatInfo.sizedInternalFormat, size, false));
+
+ return setImageImpl(context, index, type, unpack, pixels, 0);
+}
+
+angle::Result TextureD3D_Cube::setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels)
+{
+ ASSERT(area.depth == 1 && area.z == 0);
+ return TextureD3D::subImage(context, index, area, format, type, unpack, unpackBuffer, pixels,
+ 0);
+}
+
+angle::Result TextureD3D_Cube::setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(size.depth == 1);
+
+ // compressed formats don't have separate sized internal formats-- we can just use the
+ // compressed format directly
+ ANGLE_TRY(redefineImage(context, index.cubeMapFaceIndex(), index.getLevelIndex(),
+ internalFormat, size, false));
+
+ return setCompressedImageImpl(context, index, unpack, pixels, 0);
+}
+
+angle::Result TextureD3D_Cube::setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(area.depth == 1 && area.z == 0);
+
+ ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0));
+ return commitRegion(context, index, area);
+}
+
+angle::Result TextureD3D_Cube::copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source)
+{
+ GLint faceIndex = index.cubeMapFaceIndex();
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE);
+
+ gl::Extents size(sourceArea.width, sourceArea.height, 1);
+ ANGLE_TRY(redefineImage(context, faceIndex, index.getLevelIndex(),
+ internalFormatInfo.sizedInternalFormat, size, false));
+
+ gl::Extents fbSize = source->getReadColorAttachment()->getSize();
+
+ // Does the read area extend beyond the framebuffer?
+ bool outside = sourceArea.x < 0 || sourceArea.y < 0 ||
+ sourceArea.x + sourceArea.width > fbSize.width ||
+ sourceArea.y + sourceArea.height > fbSize.height;
+
+ // WebGL requires that pixels that would be outside the framebuffer are treated as zero values,
+ // so clear the mip level to 0 prior to making the copy if any pixel would be sampled outside.
+ // Same thing for robust resource init.
+ if (outside &&
+ (context->getExtensions().webglCompatibility || context->isRobustResourceInitEnabled()))
+ {
+ ANGLE_TRY(initializeContents(context, index));
+ }
+
+ gl::Rectangle clippedArea;
+ if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height), &clippedArea))
+ {
+ // Empty source area, nothing to do.
+ return angle::Result::Continue;
+ }
+
+ gl::Offset destOffset(clippedArea.x - sourceArea.x, clippedArea.y - sourceArea.y, 0);
+
+ // If the zero max LOD workaround is active, then we can't sample from individual layers of the
+ // framebuffer in shaders, so we should use the non-rendering copy path.
+ if (!canCreateRenderTargetForImage(index) ||
+ mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ANGLE_TRY(mImageArray[faceIndex][index.getLevelIndex()]->copyFromFramebuffer(
+ context, destOffset, clippedArea, source));
+ mDirtyImages = true;
+ }
+ else
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+
+ ASSERT(size.width == size.height);
+
+ if (size.width > 0 && isValidFaceLevel(faceIndex, index.getLevelIndex()))
+ {
+ ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyImageCube(context, source, clippedArea, internalFormat,
+ destOffset, mTexStorage, index.getTarget(),
+ index.getLevelIndex()));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source)
+{
+ gl::Extents fbSize = source->getReadColorAttachment()->getSize();
+ gl::Rectangle clippedArea;
+ if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height), &clippedArea))
+ {
+ return angle::Result::Continue;
+ }
+ const gl::Offset clippedOffset(destOffset.x + clippedArea.x - sourceArea.x,
+ destOffset.y + clippedArea.y - sourceArea.y, 0);
+
+ GLint faceIndex = index.cubeMapFaceIndex();
+
+ // If the zero max LOD workaround is active, then we can't sample from individual layers of the
+ // framebuffer in shaders, so we should use the non-rendering copy path.
+ if (!canCreateRenderTargetForImage(index) ||
+ mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ANGLE_TRY(mImageArray[faceIndex][index.getLevelIndex()]->copyFromFramebuffer(
+ context, clippedOffset, clippedArea, source));
+ mDirtyImages = true;
+ }
+ else
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ if (isValidFaceLevel(faceIndex, index.getLevelIndex()))
+ {
+ ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyImageCube(
+ context, source, clippedArea, gl::GetUnsizedFormat(getBaseLevelInternalFormat()),
+ clippedOffset, mTexStorage, index.getTarget(), index.getLevelIndex()));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(gl::IsCubeMapFaceTarget(index.getTarget()));
+
+ gl::TextureTarget sourceTarget = NonCubeTextureTypeToTarget(source->getType());
+
+ GLint faceIndex = index.cubeMapFaceIndex();
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+ gl::Extents size(static_cast<int>(source->getWidth(sourceTarget, sourceLevel)),
+ static_cast<int>(source->getHeight(sourceTarget, sourceLevel)), 1);
+ ANGLE_TRY(redefineImage(context, faceIndex, index.getLevelIndex(),
+ internalFormatInfo.sizedInternalFormat, size, false));
+
+ gl::Box sourceBox(0, 0, 0, size.width, size.height, 1);
+ gl::Offset destOffset(0, 0, 0);
+
+ if (!isSRGB(index.getLevelIndex(), faceIndex) && canCreateRenderTargetForImage(index))
+ {
+
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidFaceLevel(faceIndex, index.getLevelIndex()));
+ ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.getLevelIndex()));
+
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_2D, sourceBox,
+ internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ gl::ImageIndex sourceImageIndex = gl::ImageIndex::Make2D(static_cast<GLint>(sourceLevel));
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+ ImageD3D *sourceImage = nullptr;
+ ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage));
+
+ ImageD3D *destImage = nullptr;
+ ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage));
+
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceBox, destOffset,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(destOffset, size);
+ ANGLE_TRY(commitRegion(context, index, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(gl::IsCubeMapFaceTarget(index.getTarget()));
+
+ GLint faceIndex = index.cubeMapFaceIndex();
+
+ if (!isSRGB(index.getLevelIndex(), faceIndex) && canCreateRenderTargetForImage(index))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidFaceLevel(faceIndex, index.getLevelIndex()));
+ ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.getLevelIndex()));
+
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetSizedInternalFormatInfo(getInternalFormat(index.getLevelIndex(), faceIndex));
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_2D, sourceBox,
+ internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ gl::ImageIndex sourceImageIndex = gl::ImageIndex::Make2D(static_cast<GLint>(sourceLevel));
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+ ImageD3D *sourceImage = nullptr;
+ ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage));
+
+ ImageD3D *destImage = nullptr;
+ ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage));
+
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceBox, destOffset,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(destOffset.x, destOffset.y, 0, sourceBox.width, sourceBox.height, 1);
+ ANGLE_TRY(commitRegion(context, index, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size)
+{
+ ASSERT(size.width == size.height);
+ ASSERT(size.depth == 1);
+
+ for (size_t level = 0; level < levels; level++)
+ {
+ GLsizei mipSize = std::max(1, size.width >> level);
+ for (size_t faceIndex = 0; faceIndex < gl::kCubeFaceCount; faceIndex++)
+ {
+ mImageArray[faceIndex][level]->redefine(gl::TextureType::CubeMap, internalFormat,
+ gl::Extents(mipSize, mipSize, 1), true);
+ }
+ }
+
+ for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ for (size_t faceIndex = 0; faceIndex < gl::kCubeFaceCount; faceIndex++)
+ {
+ mImageArray[faceIndex][level]->redefine(gl::TextureType::CubeMap, GL_NONE,
+ gl::Extents(0, 0, 0), true);
+ }
+ }
+
+ // TODO(geofflang): Verify storage creation had no errors
+ bool renderTarget = IsRenderTargetUsage(mState.getUsage());
+
+ TexStoragePointer storage(context);
+ storage.reset(mRenderer->createTextureStorageCube(internalFormat, renderTarget, size.width,
+ static_cast<int>(levels), false));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ANGLE_TRY(updateStorage(context));
+
+ mImmutable = true;
+
+ return angle::Result::Continue;
+}
+
+// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
+bool TextureD3D_Cube::isCubeComplete() const
+{
+ int baseWidth = getBaseLevelWidth();
+ int baseHeight = getBaseLevelHeight();
+ GLenum baseFormat = getBaseLevelInternalFormat();
+
+ if (baseWidth <= 0 || baseWidth != baseHeight)
+ {
+ return false;
+ }
+
+ for (size_t faceIndex = 1; faceIndex < gl::kCubeFaceCount; faceIndex++)
+ {
+ const ImageD3D &faceBaseImage = *mImageArray[faceIndex][getBaseLevel()];
+
+ if (faceBaseImage.getWidth() != baseWidth || faceBaseImage.getHeight() != baseHeight ||
+ faceBaseImage.getInternalFormat() != baseFormat)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+angle::Result TextureD3D_Cube::bindTexImage(const gl::Context *context, egl::Surface *surface)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::releaseTexImage(const gl::Context *context)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::initMipmapImages(const gl::Context *context)
+{
+ const GLuint baseLevel = mState.getEffectiveBaseLevel();
+ const GLuint maxLevel = mState.getMipmapMaxLevel();
+ // Purge array levels baseLevel + 1 through q and reset them to represent the generated mipmap
+ // levels.
+ for (size_t faceIndex = 0; faceIndex < gl::kCubeFaceCount; faceIndex++)
+ {
+ for (GLuint level = baseLevel + 1; level <= maxLevel; level++)
+ {
+ int faceLevelSize =
+ (std::max(mImageArray[faceIndex][baseLevel]->getWidth() >> (level - baseLevel), 1));
+ ANGLE_TRY(redefineImage(context, faceIndex, level,
+ mImageArray[faceIndex][baseLevel]->getInternalFormat(),
+ gl::Extents(faceLevelSize, faceLevelSize, 1), false));
+ }
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(gl::IsCubeMapFaceTarget(index.getTarget()));
+
+ // ensure the underlying texture is created
+ ANGLE_TRY(ensureRenderTarget(context));
+ ANGLE_TRY(updateStorageFaceLevel(context, index.cubeMapFaceIndex(), index.getLevelIndex()));
+
+ return mTexStorage->getRenderTarget(context, index, outRT);
+}
+
+angle::Result TextureD3D_Cube::initializeStorage(const gl::Context *context, bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return angle::Result::Continue;
+ }
+
+ // do not attempt to create storage for nonexistant data
+ if (!isFaceLevelComplete(0, getBaseLevel()))
+ {
+ return angle::Result::Continue;
+ }
+
+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
+
+ TexStoragePointer storage(context);
+ ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ ANGLE_TRY(updateStorage(context));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
+{
+ GLsizei size = getLevelZeroWidth();
+
+ ASSERT(size > 0);
+
+ // use existing storage level count, when previously specified by TexStorage*D
+ GLint levels = (mTexStorage ? mTexStorage->getLevelCount() : creationLevels(size, size, 1));
+
+ bool hintLevelZeroOnly = false;
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ // If any of the CPU images (levels >= 1) are dirty, then the textureStorage should use the
+ // mipped texture to begin with. Otherwise, it should use the level-zero-only texture.
+ hintLevelZeroOnly = true;
+ for (size_t faceIndex = 0; faceIndex < gl::kCubeFaceCount && hintLevelZeroOnly; faceIndex++)
+ {
+ for (int level = 1; level < levels && hintLevelZeroOnly; level++)
+ {
+ hintLevelZeroOnly = !(mImageArray[faceIndex][level]->isDirty() &&
+ isFaceLevelComplete(faceIndex, level));
+ }
+ }
+ }
+
+ // TODO (geofflang): detect if storage creation succeeded
+ outStorage->reset(mRenderer->createTextureStorageCube(
+ getBaseLevelInternalFormat(), renderTarget, size, levels, hintLevelZeroOnly));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
+{
+ if (newCompleteTexStorage && newCompleteTexStorage->isManaged())
+ {
+ for (size_t faceIndex = 0; faceIndex < gl::kCubeFaceCount; faceIndex++)
+ {
+ for (int level = 0; level < newCompleteTexStorage->getLevelCount(); level++)
+ {
+ ANGLE_TRY(mImageArray[faceIndex][level]->setManagedSurfaceCube(
+ context, newCompleteTexStorage, faceIndex, level));
+ }
+ }
+ }
+
+ ANGLE_TRY(releaseTexStorage(context));
+ mTexStorage = newCompleteTexStorage;
+
+ mDirtyImages = true;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::updateStorage(const gl::Context *context)
+{
+ if (!mDirtyImages)
+ {
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mTexStorage != nullptr);
+ GLint storageLevels = mTexStorage->getLevelCount();
+ for (size_t face = 0; face < gl::kCubeFaceCount; face++)
+ {
+ for (int level = 0; level < storageLevels; level++)
+ {
+ if (mImageArray[face][level]->isDirty() && isFaceLevelComplete(face, level))
+ {
+ ANGLE_TRY(updateStorageFaceLevel(context, face, level));
+ }
+ }
+ }
+
+ mDirtyImages = false;
+ return angle::Result::Continue;
+}
+
+bool TextureD3D_Cube::isValidFaceLevel(int faceIndex, int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : 0);
+}
+
+bool TextureD3D_Cube::isFaceLevelComplete(int faceIndex, int level) const
+{
+ if (getBaseLevel() >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ return false;
+ }
+ ASSERT(level >= 0 && static_cast<size_t>(faceIndex) < gl::kCubeFaceCount &&
+ level < static_cast<int>(mImageArray[faceIndex].size()) &&
+ mImageArray[faceIndex][level] != nullptr);
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ int levelZeroSize = getLevelZeroWidth();
+
+ if (levelZeroSize <= 0)
+ {
+ return false;
+ }
+
+ // Check that non-zero levels are consistent with the base level.
+ const ImageD3D *faceLevelImage = mImageArray[faceIndex][level].get();
+
+ if (faceLevelImage->getInternalFormat() != getBaseLevelInternalFormat())
+ {
+ return false;
+ }
+
+ if (faceLevelImage->getWidth() != std::max(1, levelZeroSize >> level))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool TextureD3D_Cube::isImageComplete(const gl::ImageIndex &index) const
+{
+ return isFaceLevelComplete(index.cubeMapFaceIndex(), index.getLevelIndex());
+}
+
+angle::Result TextureD3D_Cube::updateStorageFaceLevel(const gl::Context *context,
+ int faceIndex,
+ int level)
+{
+ ASSERT(level >= 0 && static_cast<size_t>(faceIndex) < gl::kCubeFaceCount &&
+ level < static_cast<int>(mImageArray[faceIndex].size()) &&
+ mImageArray[faceIndex][level] != nullptr);
+ ImageD3D *image = mImageArray[faceIndex][level].get();
+
+ if (image->isDirty())
+ {
+ gl::TextureTarget faceTarget = gl::CubeFaceIndexToTextureTarget(faceIndex);
+ gl::ImageIndex index = gl::ImageIndex::MakeCubeMapFace(faceTarget, level);
+ gl::Box region(0, 0, 0, image->getWidth(), image->getHeight(), 1);
+ ANGLE_TRY(commitRegion(context, index, region));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_Cube::redefineImage(const gl::Context *context,
+ int faceIndex,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
+{
+ // If there currently is a corresponding storage texture image, it has these parameters
+ const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
+ const int storageHeight = std::max(1, getLevelZeroHeight() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ mImageArray[faceIndex][level]->redefine(gl::TextureType::CubeMap, internalformat, size,
+ forceRelease);
+ mDirtyImages = mDirtyImages || mImageArray[faceIndex][level]->isDirty();
+
+ if (mTexStorage)
+ {
+ const int storageLevels = mTexStorage->getLevelCount();
+
+ if ((level >= storageLevels && storageLevels != 0) || size.width != storageWidth ||
+ size.height != storageHeight ||
+ internalformat != storageFormat) // Discard mismatched storage
+ {
+ markAllImagesDirty();
+ ANGLE_TRY(releaseTexStorage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+gl::ImageIndexIterator TextureD3D_Cube::imageIterator() const
+{
+ return gl::ImageIndexIterator::MakeCube(0, mTexStorage->getLevelCount());
+}
+
+gl::ImageIndex TextureD3D_Cube::getImageIndex(GLint mip, GLint layer) const
+{
+ // The "layer" of the image index corresponds to the cube face
+ return gl::ImageIndex::MakeCubeMapFace(gl::CubeFaceIndexToTextureTarget(layer), mip);
+}
+
+bool TextureD3D_Cube::isValidIndex(const gl::ImageIndex &index) const
+{
+ return (mTexStorage && index.getType() == gl::TextureType::CubeMap &&
+ gl::IsCubeMapFaceTarget(index.getTarget()) && index.getLevelIndex() >= 0 &&
+ index.getLevelIndex() < mTexStorage->getLevelCount());
+}
+
+void TextureD3D_Cube::markAllImagesDirty()
+{
+ for (int dirtyLevel = 0; dirtyLevel < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; dirtyLevel++)
+ {
+ for (size_t dirtyFace = 0; dirtyFace < gl::kCubeFaceCount; dirtyFace++)
+ {
+ mImageArray[dirtyFace][dirtyLevel]->markDirty();
+ }
+ }
+ mDirtyImages = true;
+}
+
+TextureD3D_3D::TextureD3D_3D(const gl::TextureState &state, RendererD3D *renderer)
+ : TextureD3D(state, renderer)
+{
+ for (int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+ {
+ mImageArray[i].reset(renderer->createImage());
+ }
+}
+
+void TextureD3D_3D::onDestroy(const gl::Context *context)
+{
+ // Delete the Images before the TextureStorage. Images might be relying on the TextureStorage
+ // for some of their data. If TextureStorage is deleted before the Images, then their data will
+ // be wastefully copied back from the GPU before we delete the Images.
+ for (auto &image : mImageArray)
+ {
+ image.reset();
+ }
+ return TextureD3D::onDestroy(context);
+}
+
+TextureD3D_3D::~TextureD3D_3D() {}
+
+ImageD3D *TextureD3D_3D::getImage(int level, int layer) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(layer == 0);
+ return mImageArray[level].get();
+}
+
+ImageD3D *TextureD3D_3D::getImage(const gl::ImageIndex &index) const
+{
+ ASSERT(index.getLevelIndex() < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(!index.hasLayer());
+ ASSERT(index.getType() == gl::TextureType::_3D);
+ return mImageArray[index.getLevelIndex()].get();
+}
+
+GLsizei TextureD3D_3D::getLayerCount(int level) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ return 1;
+}
+
+GLsizei TextureD3D_3D::getWidth(GLint level) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[level]->getWidth();
+ else
+ return 0;
+}
+
+GLsizei TextureD3D_3D::getHeight(GLint level) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[level]->getHeight();
+ else
+ return 0;
+}
+
+GLsizei TextureD3D_3D::getDepth(GLint level) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[level]->getDepth();
+ else
+ return 0;
+}
+
+GLenum TextureD3D_3D::getInternalFormat(GLint level) const
+{
+ if (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ return mImageArray[level]->getInternalFormat();
+ else
+ return GL_NONE;
+}
+
+bool TextureD3D_3D::isDepth(GLint level) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level)).depthBits > 0;
+}
+
+bool TextureD3D_3D::isSRGB(GLint level) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level)).colorEncoding == GL_SRGB;
+}
+
+angle::Result TextureD3D_3D::setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_3D);
+ const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormatInfo.sizedInternalFormat,
+ size, false));
+
+ bool fastUnpacked = false;
+
+ // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
+ gl::Buffer *unpackBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
+ if (isFastUnpackable(unpackBuffer, internalFormatInfo.sizedInternalFormat) && !size.empty() &&
+ isLevelComplete(index.getLevelIndex()))
+ {
+ // Will try to create RT storage if it does not exist
+ RenderTargetD3D *destRenderTarget = nullptr;
+ ANGLE_TRY(getRenderTarget(context, index, &destRenderTarget));
+
+ gl::Box destArea(0, 0, 0, getWidth(index.getLevelIndex()), getHeight(index.getLevelIndex()),
+ getDepth(index.getLevelIndex()));
+
+ ANGLE_TRY(fastUnpackPixels(context, unpack, pixels, destArea,
+ internalFormatInfo.sizedInternalFormat, type, destRenderTarget));
+
+ // Ensure we don't overwrite our newly initialized data
+ mImageArray[index.getLevelIndex()]->markClean();
+
+ fastUnpacked = true;
+ }
+
+ if (!fastUnpacked)
+ {
+ ANGLE_TRY(setImageImpl(context, index, type, unpack, pixels, 0));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_3D);
+
+ // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
+ GLenum mipFormat = getInternalFormat(index.getLevelIndex());
+ if (isFastUnpackable(unpackBuffer, mipFormat) && isLevelComplete(index.getLevelIndex()))
+ {
+ RenderTargetD3D *destRenderTarget = nullptr;
+ ANGLE_TRY(getRenderTarget(context, index, &destRenderTarget));
+ ASSERT(!mImageArray[index.getLevelIndex()]->isDirty());
+
+ return fastUnpackPixels(context, unpack, pixels, area, mipFormat, type, destRenderTarget);
+ }
+ else
+ {
+ return TextureD3D::subImage(context, index, area, format, type, unpack, unpackBuffer,
+ pixels, 0);
+ }
+}
+
+angle::Result TextureD3D_3D::setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_3D);
+
+ // compressed formats don't have separate sized internal formats-- we can just use the
+ // compressed format directly
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormat, size, false));
+
+ return setCompressedImageImpl(context, index, unpack, pixels, 0);
+}
+
+angle::Result TextureD3D_3D::setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_3D);
+
+ ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0));
+ return commitRegion(context, index, area);
+}
+
+angle::Result TextureD3D_3D::copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_3D);
+
+ gl::Extents fbSize = source->getReadColorAttachment()->getSize();
+ gl::Rectangle clippedSourceArea;
+ if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
+ &clippedSourceArea))
+ {
+ return angle::Result::Continue;
+ }
+ const gl::Offset clippedDestOffset(destOffset.x + clippedSourceArea.x - sourceArea.x,
+ destOffset.y + clippedSourceArea.y - sourceArea.y,
+ destOffset.z);
+
+ // Currently, copying directly to the storage is not possible because it's not possible to
+ // create an SRV from a single layer of a 3D texture. Instead, make sure the image is up to
+ // date before the copy and then copy back to the storage afterwards if needed.
+ // TODO: Investigate 3D blits in D3D11.
+
+ bool syncTexStorage = mTexStorage && isLevelComplete(index.getLevelIndex());
+ if (syncTexStorage)
+ {
+ ANGLE_TRY(
+ mImageArray[index.getLevelIndex()]->copyFromTexStorage(context, index, mTexStorage));
+ }
+ ANGLE_TRY(mImageArray[index.getLevelIndex()]->copyFromFramebuffer(context, clippedDestOffset,
+ clippedSourceArea, source));
+ mDirtyImages = true;
+
+ if (syncTexStorage)
+ {
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_3D);
+
+ gl::TextureType sourceType = source->getType();
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+ gl::Extents size(
+ static_cast<int>(source->getWidth(NonCubeTextureTypeToTarget(sourceType), sourceLevel)),
+ static_cast<int>(source->getHeight(NonCubeTextureTypeToTarget(sourceType), sourceLevel)),
+ static_cast<int>(source->getDepth(NonCubeTextureTypeToTarget(sourceType), sourceLevel)));
+
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormatInfo.sizedInternalFormat,
+ size, false));
+
+ gl::Box sourceBox(0, 0, 0, size.width, size.height, size.depth);
+ gl::Offset destOffset(0, 0, 0);
+ gl::ImageIndex destIndex = gl::ImageIndex::Make3D(static_cast<GLint>(index.getLevelIndex()));
+
+ if (!isSRGB(index.getLevelIndex()) && canCreateRenderTargetForImage(destIndex))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidLevel(index.getLevelIndex()));
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_3D, sourceBox,
+ internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ gl::ImageIndex sourceIndex = gl::ImageIndex::Make3D(static_cast<GLint>(sourceLevel));
+ ImageD3D *sourceImage = nullptr;
+ ImageD3D *destImage = nullptr;
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+
+ ANGLE_TRY(getImageAndSyncFromStorage(context, destIndex, &destImage));
+ ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceIndex, &sourceImage));
+
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceBox, destOffset,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(0, 0, 0, sourceBox.width, sourceBox.height, sourceBox.depth);
+ ANGLE_TRY(commitRegion(context, destIndex, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+angle::Result TextureD3D_3D::copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_3D);
+
+ gl::ImageIndex destIndex = gl::ImageIndex::Make3D(static_cast<GLint>(index.getLevelIndex()));
+
+ if (!isSRGB(index.getLevelIndex()) && canCreateRenderTargetForImage(destIndex))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidLevel(index.getLevelIndex()));
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetSizedInternalFormatInfo(getInternalFormat(index.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_3D, sourceBox,
+ internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ gl::ImageIndex sourceImageIndex = gl::ImageIndex::Make3D(static_cast<GLint>(sourceLevel));
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+ ImageD3D *sourceImage = nullptr;
+ ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage));
+
+ ImageD3D *destImage = nullptr;
+ ANGLE_TRY(getImageAndSyncFromStorage(context, destIndex, &destImage));
+
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceBox, destOffset,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha));
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(destOffset.x, destOffset.y, destOffset.z, sourceBox.width,
+ sourceBox.height, sourceBox.depth);
+ ANGLE_TRY(commitRegion(context, destIndex, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size)
+{
+ ASSERT(type == gl::TextureType::_3D);
+
+ for (size_t level = 0; level < levels; level++)
+ {
+ gl::Extents levelSize(std::max(1, size.width >> level), std::max(1, size.height >> level),
+ std::max(1, size.depth >> level));
+ mImageArray[level]->redefine(gl::TextureType::_3D, internalFormat, levelSize, true);
+ }
+
+ for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ mImageArray[level]->redefine(gl::TextureType::_3D, GL_NONE, gl::Extents(0, 0, 0), true);
+ }
+
+ // TODO(geofflang): Verify storage creation had no errors
+ bool renderTarget = IsRenderTargetUsage(mState.getUsage());
+ TexStoragePointer storage(context);
+ storage.reset(mRenderer->createTextureStorage3D(internalFormat, renderTarget, size.width,
+ size.height, size.depth,
+ static_cast<int>(levels)));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ANGLE_TRY(updateStorage(context));
+
+ mImmutable = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::bindTexImage(const gl::Context *context, egl::Surface *surface)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::releaseTexImage(const gl::Context *context)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::initMipmapImages(const gl::Context *context)
+{
+ const GLuint baseLevel = mState.getEffectiveBaseLevel();
+ const GLuint maxLevel = mState.getMipmapMaxLevel();
+ // Purge array levels baseLevel + 1 through q and reset them to represent the generated mipmap
+ // levels.
+ for (GLuint level = baseLevel + 1; level <= maxLevel; level++)
+ {
+ gl::Extents levelSize(std::max(getLevelZeroWidth() >> level, 1),
+ std::max(getLevelZeroHeight() >> level, 1),
+ std::max(getLevelZeroDepth() >> level, 1));
+ ANGLE_TRY(redefineImage(context, level, getBaseLevelInternalFormat(), levelSize, false));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ // ensure the underlying texture is created
+ ANGLE_TRY(ensureRenderTarget(context));
+
+ if (index.hasLayer())
+ {
+ ANGLE_TRY(updateStorage(context));
+ }
+ else
+ {
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+ }
+
+ return mTexStorage->getRenderTarget(context, index, outRT);
+}
+
+angle::Result TextureD3D_3D::initializeStorage(const gl::Context *context, bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return angle::Result::Continue;
+ }
+
+ // do not attempt to create storage for nonexistant data
+ if (!isLevelComplete(getBaseLevel()))
+ {
+ return angle::Result::Continue;
+ }
+
+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
+
+ TexStoragePointer storage(context);
+ ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ ANGLE_TRY(updateStorage(context));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
+{
+ GLsizei width = getLevelZeroWidth();
+ GLsizei height = getLevelZeroHeight();
+ GLsizei depth = getLevelZeroDepth();
+ GLenum internalFormat = getBaseLevelInternalFormat();
+
+ 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));
+
+ // TODO: Verify creation of the storage succeeded
+ outStorage->reset(mRenderer->createTextureStorage3D(internalFormat, renderTarget, width, height,
+ depth, levels));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
+{
+ ANGLE_TRY(releaseTexStorage(context));
+ mTexStorage = newCompleteTexStorage;
+ mDirtyImages = true;
+
+ // We do not support managed 3D storage, as that is D3D9/ES2-only
+ ASSERT(!mTexStorage->isManaged());
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::updateStorage(const gl::Context *context)
+{
+ if (!mDirtyImages)
+ {
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mTexStorage != nullptr);
+ GLint storageLevels = mTexStorage->getLevelCount();
+ for (int level = 0; level < storageLevels; level++)
+ {
+ if (mImageArray[level]->isDirty() && isLevelComplete(level))
+ {
+ ANGLE_TRY(updateStorageLevel(context, level));
+ }
+ }
+
+ mDirtyImages = false;
+ return angle::Result::Continue;
+}
+
+bool TextureD3D_3D::isValidLevel(int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : 0);
+}
+
+bool TextureD3D_3D::isLevelComplete(int level) const
+{
+ ASSERT(level >= 0 && level < static_cast<int>(mImageArray.size()) &&
+ mImageArray[level] != nullptr);
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ GLsizei width = getLevelZeroWidth();
+ GLsizei height = getLevelZeroHeight();
+ GLsizei depth = getLevelZeroDepth();
+
+ if (width <= 0 || height <= 0 || depth <= 0)
+ {
+ return false;
+ }
+
+ if (level == static_cast<int>(getBaseLevel()))
+ {
+ return true;
+ }
+
+ ImageD3D *levelImage = mImageArray[level].get();
+
+ 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;
+}
+
+bool TextureD3D_3D::isImageComplete(const gl::ImageIndex &index) const
+{
+ return isLevelComplete(index.getLevelIndex());
+}
+
+angle::Result TextureD3D_3D::updateStorageLevel(const gl::Context *context, int level)
+{
+ ASSERT(level >= 0 && level < static_cast<int>(mImageArray.size()) &&
+ mImageArray[level] != nullptr);
+ ASSERT(isLevelComplete(level));
+
+ if (mImageArray[level]->isDirty())
+ {
+ gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+ gl::Box region(0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
+ ANGLE_TRY(commitRegion(context, index, region));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_3D::redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
+{
+ // If there currently is a corresponding storage texture image, it has these parameters
+ const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
+ const int storageHeight = std::max(1, getLevelZeroHeight() >> level);
+ const int storageDepth = std::max(1, getLevelZeroDepth() >> level);
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ mImageArray[level]->redefine(gl::TextureType::_3D, internalformat, size, forceRelease);
+ mDirtyImages = mDirtyImages || mImageArray[level]->isDirty();
+
+ if (mTexStorage)
+ {
+ const int storageLevels = mTexStorage->getLevelCount();
+
+ if ((level >= storageLevels && storageLevels != 0) || size.width != storageWidth ||
+ size.height != storageHeight || size.depth != storageDepth ||
+ internalformat != storageFormat) // Discard mismatched storage
+ {
+ markAllImagesDirty();
+ ANGLE_TRY(releaseTexStorage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+gl::ImageIndexIterator TextureD3D_3D::imageIterator() const
+{
+ return gl::ImageIndexIterator::Make3D(0, mTexStorage->getLevelCount(),
+ gl::ImageIndex::kEntireLevel,
+ gl::ImageIndex::kEntireLevel);
+}
+
+gl::ImageIndex TextureD3D_3D::getImageIndex(GLint mip, GLint /*layer*/) const
+{
+ // The "layer" here does not apply to 3D images. We use one Image per mip.
+ return gl::ImageIndex::Make3D(mip);
+}
+
+bool TextureD3D_3D::isValidIndex(const gl::ImageIndex &index) const
+{
+ return (mTexStorage && index.getType() == gl::TextureType::_3D && index.getLevelIndex() >= 0 &&
+ index.getLevelIndex() < mTexStorage->getLevelCount());
+}
+
+void TextureD3D_3D::markAllImagesDirty()
+{
+ for (int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mImageArray[i]->markDirty();
+ }
+ mDirtyImages = true;
+}
+
+GLint TextureD3D_3D::getLevelZeroDepth() const
+{
+ ASSERT(gl::CountLeadingZeros(static_cast<uint32_t>(getBaseLevelDepth())) > getBaseLevel());
+ return getBaseLevelDepth() << getBaseLevel();
+}
+
+TextureD3D_2DArray::TextureD3D_2DArray(const gl::TextureState &state, RendererD3D *renderer)
+ : TextureD3D(state, renderer)
+{
+ for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
+ {
+ mLayerCounts[level] = 0;
+ mImageArray[level] = nullptr;
+ }
+}
+
+void TextureD3D_2DArray::onDestroy(const gl::Context *context)
+{
+ // Delete the Images before the TextureStorage. Images might be relying on the TextureStorage
+ // for some of their data. If TextureStorage is deleted before the Images, then their data will
+ // be wastefully copied back from the GPU before we delete the Images.
+ deleteImages();
+ return TextureD3D::onDestroy(context);
+}
+
+TextureD3D_2DArray::~TextureD3D_2DArray() {}
+
+ImageD3D *TextureD3D_2DArray::getImage(int level, int layer) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT((layer == 0 && mLayerCounts[level] == 0) || layer < mLayerCounts[level]);
+ return (mImageArray[level] ? mImageArray[level][layer] : nullptr);
+}
+
+ImageD3D *TextureD3D_2DArray::getImage(const gl::ImageIndex &index) const
+{
+ ASSERT(index.getLevelIndex() < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(index.hasLayer());
+ ASSERT((index.getLayerIndex() == 0 && mLayerCounts[index.getLevelIndex()] == 0) ||
+ index.getLayerIndex() < mLayerCounts[index.getLevelIndex()]);
+ ASSERT(index.getType() == gl::TextureType::_2DArray);
+ return (mImageArray[index.getLevelIndex()]
+ ? mImageArray[index.getLevelIndex()][index.getLayerIndex()]
+ : nullptr);
+}
+
+GLsizei TextureD3D_2DArray::getLayerCount(int level) const
+{
+ ASSERT(level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ return mLayerCounts[level];
+}
+
+GLsizei TextureD3D_2DArray::getWidth(GLint level) const
+{
+ return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0)
+ ? mImageArray[level][0]->getWidth()
+ : 0;
+}
+
+GLsizei TextureD3D_2DArray::getHeight(GLint level) const
+{
+ return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0)
+ ? mImageArray[level][0]->getHeight()
+ : 0;
+}
+
+GLenum TextureD3D_2DArray::getInternalFormat(GLint level) const
+{
+ return (level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS && mLayerCounts[level] > 0)
+ ? mImageArray[level][0]->getInternalFormat()
+ : GL_NONE;
+}
+
+bool TextureD3D_2DArray::isDepth(GLint level) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level)).depthBits > 0;
+}
+
+bool TextureD3D_2DArray::isSRGB(GLint level) const
+{
+ return gl::GetSizedInternalFormatInfo(getInternalFormat(level)).colorEncoding == GL_SRGB;
+}
+
+angle::Result TextureD3D_2DArray::setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2DArray);
+
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+
+ ANGLE_TRY(
+ redefineImage(context, index.getLevelIndex(), formatInfo.sizedInternalFormat, size, false));
+
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+
+ GLuint inputDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(contextD3D, formatInfo.computeDepthPitch(
+ type, size.width, size.height, unpack.alignment,
+ unpack.rowLength, unpack.imageHeight, &inputDepthPitch));
+
+ for (int i = 0; i < size.depth; i++)
+ {
+ const ptrdiff_t layerOffset = (inputDepthPitch * i);
+ gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.getLevelIndex(), i);
+ ANGLE_TRY(setImageImpl(context, layerIndex, type, unpack, pixels, layerOffset));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels)
+{
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+
+ ASSERT(index.getTarget() == gl::TextureTarget::_2DArray);
+ const gl::InternalFormat &formatInfo =
+ gl::GetInternalFormatInfo(getInternalFormat(index.getLevelIndex()), type);
+ GLuint inputDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(contextD3D, formatInfo.computeDepthPitch(
+ type, area.width, area.height, unpack.alignment,
+ unpack.rowLength, unpack.imageHeight, &inputDepthPitch));
+
+ for (int i = 0; i < area.depth; i++)
+ {
+ int layer = area.z + i;
+ const ptrdiff_t layerOffset = (inputDepthPitch * i);
+
+ gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1);
+
+ gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.getLevelIndex(), layer);
+ ANGLE_TRY(TextureD3D::subImage(context, layerIndex, layerArea, format, type, unpack,
+ unpackBuffer, pixels, layerOffset));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2DArray);
+
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+
+ // compressed formats don't have separate sized internal formats-- we can just use the
+ // compressed format directly
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormat, size, false));
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat);
+ GLuint inputDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(
+ contextD3D, formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height, 1, 0, 0,
+ &inputDepthPitch));
+
+ for (int i = 0; i < size.depth; i++)
+ {
+ const ptrdiff_t layerOffset = (inputDepthPitch * i);
+
+ gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.getLevelIndex(), i);
+ ANGLE_TRY(setCompressedImageImpl(context, layerIndex, unpack, pixels, layerOffset));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2DArray);
+
+ ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(format);
+ GLuint inputDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(
+ contextD3D, formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0, 0,
+ &inputDepthPitch));
+
+ for (int i = 0; i < area.depth; i++)
+ {
+ int layer = area.z + i;
+ const ptrdiff_t layerOffset = (inputDepthPitch * i);
+
+ gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1);
+
+ gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.getLevelIndex(), layer);
+ ANGLE_TRY(TextureD3D::subImageCompressed(context, layerIndex, layerArea, format, unpack,
+ pixels, layerOffset));
+ ANGLE_TRY(commitRegion(context, layerIndex, layerArea));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2DArray);
+
+ gl::Extents fbSize = source->getReadColorAttachment()->getSize();
+ gl::Rectangle clippedSourceArea;
+ if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
+ &clippedSourceArea))
+ {
+ return angle::Result::Continue;
+ }
+ const gl::Offset clippedDestOffset(destOffset.x + clippedSourceArea.x - sourceArea.x,
+ destOffset.y + clippedSourceArea.y - sourceArea.y,
+ destOffset.z);
+
+ if (!canCreateRenderTargetForImage(index))
+ {
+ gl::Offset destLayerOffset(clippedDestOffset.x, clippedDestOffset.y, 0);
+ ANGLE_TRY(mImageArray[index.getLevelIndex()][clippedDestOffset.z]->copyFromFramebuffer(
+ context, destLayerOffset, clippedSourceArea, source));
+ mDirtyImages = true;
+ }
+ else
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+
+ if (isValidLevel(index.getLevelIndex()))
+ {
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+ ANGLE_TRY(
+ mRenderer->copyImage2DArray(context, source, clippedSourceArea,
+ gl::GetUnsizedFormat(getInternalFormat(getBaseLevel())),
+ clippedDestOffset, mTexStorage, index.getLevelIndex()));
+ }
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2DArray);
+
+ gl::TextureType sourceType = source->getType();
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+ gl::Extents size(
+ static_cast<int>(source->getWidth(NonCubeTextureTypeToTarget(sourceType), sourceLevel)),
+ static_cast<int>(source->getHeight(NonCubeTextureTypeToTarget(sourceType), sourceLevel)),
+ static_cast<int>(source->getDepth(NonCubeTextureTypeToTarget(sourceType), sourceLevel)));
+
+ ANGLE_TRY(redefineImage(context, index.getLevelIndex(), internalFormatInfo.sizedInternalFormat,
+ size, false));
+
+ gl::Box sourceBox(0, 0, 0, size.width, size.height, size.depth);
+ gl::Offset destOffset(0, 0, 0);
+
+ gl::ImageIndex destIndex =
+ gl::ImageIndex::Make2DArrayRange(index.getLevelIndex(), 0, size.depth);
+
+ if (!isSRGB(index.getLevelIndex()) &&
+ canCreateRenderTargetForImage(
+ gl::ImageIndex::Make2DArrayRange(index.getLevelIndex(), 0, size.depth)))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidLevel(index.getLevelIndex()));
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_2DArray,
+ sourceBox, internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ for (int i = 0; i < size.depth; i++)
+ {
+ gl::ImageIndex currentSourceDepthIndex =
+ gl::ImageIndex::Make2DArray(static_cast<GLint>(sourceLevel), i);
+ gl::ImageIndex currentDestDepthIndex =
+ gl::ImageIndex::Make2DArray(static_cast<GLint>(index.getLevelIndex()), i);
+ ImageD3D *sourceImage = nullptr;
+ ImageD3D *destImage = nullptr;
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+
+ ANGLE_TRY(getImageAndSyncFromStorage(context, currentDestDepthIndex, &destImage));
+ ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, currentSourceDepthIndex,
+ &sourceImage));
+ gl::Box imageBox(sourceBox.x, sourceBox.y, 0, sourceBox.width, sourceBox.height, 1);
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, imageBox, destOffset,
+ unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(destOffset.x, destOffset.y, destOffset.z, sourceBox.width,
+ sourceBox.height, sourceBox.depth);
+ ANGLE_TRY(commitRegion(context, destIndex, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source)
+{
+ ASSERT(index.getTarget() == gl::TextureTarget::_2DArray);
+
+ gl::ImageIndex destIndex = gl::ImageIndex::Make2DArrayRange(
+ static_cast<GLint>(index.getLevelIndex()), destOffset.z, sourceBox.depth - destOffset.z);
+
+ if (!isSRGB(destIndex.getLevelIndex()) && canCreateRenderTargetForImage(destIndex))
+ {
+ ANGLE_TRY(ensureRenderTarget(context));
+ ASSERT(isValidLevel(destIndex.getLevelIndex()));
+ ANGLE_TRY(updateStorageLevel(context, destIndex.getLevelIndex()));
+
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetSizedInternalFormatInfo(getInternalFormat(destIndex.getLevelIndex()));
+ ANGLE_TRY(mRenderer->copyTexture(
+ context, source, static_cast<GLint>(sourceLevel), gl::TextureTarget::_2DArray,
+ sourceBox, internalFormatInfo.format, internalFormatInfo.type, destOffset, mTexStorage,
+ index.getTarget(), index.getLevelIndex(), unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+ else
+ {
+ for (int i = 0; i < sourceBox.depth; i++)
+ {
+ gl::ImageIndex currentSourceIndex =
+ gl::ImageIndex::Make2DArray(static_cast<GLint>(sourceLevel), i + sourceBox.z);
+ gl::ImageIndex currentDestIndex = gl::ImageIndex::Make2DArray(
+ static_cast<GLint>(index.getLevelIndex()), i + destOffset.z);
+
+ gl::Box currentLayerBox(sourceBox.x, sourceBox.y, 0, sourceBox.width, sourceBox.height,
+ 1);
+
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+ ImageD3D *sourceImage = nullptr;
+ ANGLE_TRY(
+ sourceD3D->getImageAndSyncFromStorage(context, currentSourceIndex, &sourceImage));
+
+ ImageD3D *destImage = nullptr;
+ ANGLE_TRY(getImageAndSyncFromStorage(context, currentDestIndex, &destImage));
+
+ ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, currentLayerBox,
+ destOffset, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+
+ mDirtyImages = true;
+
+ gl::Box destRegion(destOffset.x, destOffset.y, destOffset.z, sourceBox.width,
+ sourceBox.height, sourceBox.depth);
+ ANGLE_TRY(commitRegion(context, destIndex, destRegion));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size)
+{
+ ASSERT(type == gl::TextureType::_2DArray);
+
+ deleteImages();
+
+ for (size_t level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ gl::Extents levelLayerSize(std::max(1, size.width >> level),
+ std::max(1, size.height >> level), 1);
+
+ mLayerCounts[level] = (level < levels ? size.depth : 0);
+
+ if (mLayerCounts[level] > 0)
+ {
+ // Create new images for this level
+ mImageArray[level] = new ImageD3D *[mLayerCounts[level]];
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer] = mRenderer->createImage();
+ mImageArray[level][layer]->redefine(gl::TextureType::_2DArray, internalFormat,
+ levelLayerSize, true);
+ }
+ }
+ }
+
+ // TODO(geofflang): Verify storage creation had no errors
+ bool renderTarget = IsRenderTargetUsage(mState.getUsage());
+ TexStoragePointer storage(context);
+ storage.reset(mRenderer->createTextureStorage2DArray(internalFormat, renderTarget, size.width,
+ size.height, size.depth,
+ static_cast<int>(levels)));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ANGLE_TRY(updateStorage(context));
+
+ mImmutable = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::bindTexImage(const gl::Context *context, egl::Surface *surface)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::releaseTexImage(const gl::Context *context)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::initMipmapImages(const gl::Context *context)
+{
+ const GLuint baseLevel = mState.getEffectiveBaseLevel();
+ const GLuint maxLevel = mState.getMipmapMaxLevel();
+ int baseWidth = getLevelZeroWidth();
+ int baseHeight = getLevelZeroHeight();
+ int baseDepth = getLayerCount(getBaseLevel());
+ GLenum baseFormat = getBaseLevelInternalFormat();
+
+ // Purge array levels baseLevel + 1 through q and reset them to represent the generated mipmap
+ // levels.
+ for (GLuint level = baseLevel + 1u; level <= maxLevel; level++)
+ {
+ ASSERT((baseWidth >> level) > 0 || (baseHeight >> level) > 0);
+ gl::Extents levelLayerSize(std::max(baseWidth >> level, 1),
+ std::max(baseHeight >> level, 1), baseDepth);
+ ANGLE_TRY(redefineImage(context, level, baseFormat, levelLayerSize, false));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ // ensure the underlying texture is created
+ ANGLE_TRY(ensureRenderTarget(context));
+ ANGLE_TRY(updateStorageLevel(context, index.getLevelIndex()));
+ return mTexStorage->getRenderTarget(context, index, outRT);
+}
+
+angle::Result TextureD3D_2DArray::initializeStorage(const gl::Context *context, bool renderTarget)
+{
+ // Only initialize the first time this texture is used as a render target or shader resource
+ if (mTexStorage)
+ {
+ return angle::Result::Continue;
+ }
+
+ // do not attempt to create storage for nonexistant data
+ if (!isLevelComplete(getBaseLevel()))
+ {
+ return angle::Result::Continue;
+ }
+
+ bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
+
+ TexStoragePointer storage(context);
+ ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ ASSERT(mTexStorage);
+
+ // flush image data to the storage
+ ANGLE_TRY(updateStorage(context));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
+{
+ GLsizei width = getLevelZeroWidth();
+ GLsizei height = getLevelZeroHeight();
+ GLsizei depth = getLayerCount(getBaseLevel());
+ GLenum internalFormat = getBaseLevelInternalFormat();
+
+ 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));
+
+ // TODO(geofflang): Verify storage creation succeeds
+ outStorage->reset(mRenderer->createTextureStorage2DArray(internalFormat, renderTarget, width,
+ height, depth, levels));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
+{
+ ANGLE_TRY(releaseTexStorage(context));
+ mTexStorage = newCompleteTexStorage;
+ mDirtyImages = true;
+
+ // We do not support managed 2D array storage, as managed storage is ES2/D3D9 only
+ ASSERT(!mTexStorage->isManaged());
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DArray::updateStorage(const gl::Context *context)
+{
+ if (!mDirtyImages)
+ {
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mTexStorage != nullptr);
+ GLint storageLevels = mTexStorage->getLevelCount();
+ for (int level = 0; level < storageLevels; level++)
+ {
+ if (isLevelComplete(level))
+ {
+ ANGLE_TRY(updateStorageLevel(context, level));
+ }
+ }
+
+ mDirtyImages = false;
+ return angle::Result::Continue;
+}
+
+bool TextureD3D_2DArray::isValidLevel(int level) const
+{
+ return (mTexStorage ? (level >= 0 && level < mTexStorage->getLevelCount()) : 0);
+}
+
+bool TextureD3D_2DArray::isLevelComplete(int level) const
+{
+ ASSERT(level >= 0 && level < (int)ArraySize(mImageArray));
+
+ if (isImmutable())
+ {
+ return true;
+ }
+
+ GLsizei width = getLevelZeroWidth();
+ GLsizei height = getLevelZeroHeight();
+
+ if (width <= 0 || height <= 0)
+ {
+ return false;
+ }
+
+ // Layers check needs to happen after the above checks, otherwise out-of-range base level may be
+ // queried.
+ GLsizei layers = getLayerCount(getBaseLevel());
+
+ if (layers <= 0)
+ {
+ return false;
+ }
+
+ if (level == static_cast<int>(getBaseLevel()))
+ {
+ return true;
+ }
+
+ if (getInternalFormat(level) != getInternalFormat(getBaseLevel()))
+ {
+ return false;
+ }
+
+ if (getWidth(level) != std::max(1, width >> level))
+ {
+ return false;
+ }
+
+ if (getHeight(level) != std::max(1, height >> level))
+ {
+ return false;
+ }
+
+ if (getLayerCount(level) != layers)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool TextureD3D_2DArray::isImageComplete(const gl::ImageIndex &index) const
+{
+ return isLevelComplete(index.getLevelIndex());
+}
+
+angle::Result TextureD3D_2DArray::updateStorageLevel(const gl::Context *context, int level)
+{
+ ASSERT(level >= 0 && level < static_cast<int>(ArraySize(mLayerCounts)));
+ ASSERT(isLevelComplete(level));
+
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ ASSERT(mImageArray[level] != nullptr && mImageArray[level][layer] != nullptr);
+ if (mImageArray[level][layer]->isDirty())
+ {
+ gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
+ gl::Box region(0, 0, 0, getWidth(level), getHeight(level), 1);
+ ANGLE_TRY(commitRegion(context, index, region));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+void TextureD3D_2DArray::deleteImages()
+{
+ for (int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
+ {
+ for (int layer = 0; layer < mLayerCounts[level]; ++layer)
+ {
+ delete mImageArray[level][layer];
+ }
+ delete[] mImageArray[level];
+ mImageArray[level] = nullptr;
+ mLayerCounts[level] = 0;
+ }
+}
+
+angle::Result TextureD3D_2DArray::redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
+{
+ // If there currently is a corresponding storage texture image, it has these parameters
+ const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
+ const int storageHeight = std::max(1, getLevelZeroHeight() >> level);
+ const GLuint baseLevel = getBaseLevel();
+ const GLenum storageFormat = getBaseLevelInternalFormat();
+
+ int storageDepth = 0;
+ if (baseLevel < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ storageDepth = getLayerCount(baseLevel);
+ }
+
+ // Only reallocate the layers if the size doesn't match
+ if (size.depth != mLayerCounts[level])
+ {
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ SafeDelete(mImageArray[level][layer]);
+ }
+ SafeDeleteArray(mImageArray[level]);
+ mLayerCounts[level] = size.depth;
+
+ if (size.depth > 0)
+ {
+ mImageArray[level] = new ImageD3D *[size.depth];
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer] = mRenderer->createImage();
+ }
+ }
+ }
+
+ if (size.depth > 0)
+ {
+ for (int layer = 0; layer < mLayerCounts[level]; layer++)
+ {
+ mImageArray[level][layer]->redefine(gl::TextureType::_2DArray, internalformat,
+ gl::Extents(size.width, size.height, 1),
+ forceRelease);
+ mDirtyImages = mDirtyImages || mImageArray[level][layer]->isDirty();
+ }
+ }
+
+ if (mTexStorage)
+ {
+ const int storageLevels = mTexStorage->getLevelCount();
+
+ if ((level >= storageLevels && storageLevels != 0) || size.width != storageWidth ||
+ size.height != storageHeight || size.depth != storageDepth ||
+ internalformat != storageFormat) // Discard mismatched storage
+ {
+ markAllImagesDirty();
+ ANGLE_TRY(releaseTexStorage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+gl::ImageIndexIterator TextureD3D_2DArray::imageIterator() const
+{
+ return gl::ImageIndexIterator::Make2DArray(0, mTexStorage->getLevelCount(), mLayerCounts);
+}
+
+gl::ImageIndex TextureD3D_2DArray::getImageIndex(GLint mip, GLint layer) const
+{
+ return gl::ImageIndex::Make2DArray(mip, layer);
+}
+
+bool TextureD3D_2DArray::isValidIndex(const gl::ImageIndex &index) const
+{
+ // Check for having a storage and the right type of index
+ if (!mTexStorage || index.getType() != gl::TextureType::_2DArray)
+ {
+ return false;
+ }
+
+ // Check the mip index
+ if (index.getLevelIndex() < 0 || index.getLevelIndex() >= mTexStorage->getLevelCount())
+ {
+ return false;
+ }
+
+ // Check the layer index
+ return (!index.hasLayer() || (index.getLayerIndex() >= 0 &&
+ index.getLayerIndex() < mLayerCounts[index.getLevelIndex()]));
+}
+
+void TextureD3D_2DArray::markAllImagesDirty()
+{
+ for (int dirtyLevel = 0; dirtyLevel < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; dirtyLevel++)
+ {
+ for (int dirtyLayer = 0; dirtyLayer < mLayerCounts[dirtyLevel]; dirtyLayer++)
+ {
+ mImageArray[dirtyLevel][dirtyLayer]->markDirty();
+ }
+ }
+ mDirtyImages = true;
+}
+
+TextureD3DImmutableBase::TextureD3DImmutableBase(const gl::TextureState &state,
+ RendererD3D *renderer)
+ : TextureD3D(state, renderer)
+{}
+
+TextureD3DImmutableBase::~TextureD3DImmutableBase() {}
+
+ImageD3D *TextureD3DImmutableBase::getImage(const gl::ImageIndex &index) const
+{
+ return nullptr;
+}
+
+angle::Result TextureD3DImmutableBase::setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3DImmutableBase::setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3DImmutableBase::setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3DImmutableBase::setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3DImmutableBase::copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3DImmutableBase::copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3DImmutableBase::bindTexImage(const gl::Context *context,
+ egl::Surface *surface)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3DImmutableBase::releaseTexImage(const gl::Context *context)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+TextureD3D_External::TextureD3D_External(const gl::TextureState &state, RendererD3D *renderer)
+ : TextureD3DImmutableBase(state, renderer)
+{}
+
+TextureD3D_External::~TextureD3D_External() {}
+
+GLsizei TextureD3D_External::getLayerCount(int level) const
+{
+ return 1;
+}
+
+angle::Result TextureD3D_External::setImageExternal(const gl::Context *context,
+ gl::TextureType type,
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc)
+{
+ ASSERT(type == gl::TextureType::External);
+
+ ANGLE_TRY(releaseTexStorage(context));
+
+ // If the stream is null, the external image is unbound and we release the storage
+ if (stream != nullptr)
+ {
+ mTexStorage = mRenderer->createTextureStorageExternal(stream, desc);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_External::setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image)
+{
+ EGLImageD3D *eglImaged3d = GetImplAs<EGLImageD3D>(image);
+
+ // Pass in the RenderTargetD3D here: createTextureStorage can't generate an error.
+ RenderTargetD3D *renderTargetD3D = nullptr;
+ ANGLE_TRY(eglImaged3d->getRenderTarget(context, &renderTargetD3D));
+
+ ANGLE_TRY(releaseTexStorage(context));
+ mTexStorage = mRenderer->createTextureStorageEGLImage(eglImaged3d, renderTargetD3D);
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_External::initMipmapImages(const gl::Context *context)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureD3D_External::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+bool TextureD3D_External::isImageComplete(const gl::ImageIndex &index) const
+{
+ return (index.getLevelIndex() == 0) ? (mTexStorage != nullptr) : false;
+}
+
+angle::Result TextureD3D_External::initializeStorage(const gl::Context *context, bool renderTarget)
+{
+ // Texture storage is created when an external image is bound
+ ASSERT(mTexStorage);
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_External::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
+{
+ UNREACHABLE();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_External::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
+{
+ UNREACHABLE();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_External::updateStorage(const gl::Context *context)
+{
+ // Texture storage does not need to be updated since it is already loaded with the latest
+ // external image
+ ASSERT(mTexStorage);
+ return angle::Result::Continue;
+}
+
+gl::ImageIndexIterator TextureD3D_External::imageIterator() const
+{
+ return gl::ImageIndexIterator::Make2D(0, mTexStorage->getLevelCount());
+}
+
+gl::ImageIndex TextureD3D_External::getImageIndex(GLint mip, GLint /*layer*/) const
+{
+ // "layer" does not apply to 2D Textures.
+ return gl::ImageIndex::Make2D(mip);
+}
+
+bool TextureD3D_External::isValidIndex(const gl::ImageIndex &index) const
+{
+ return (mTexStorage && index.getType() == gl::TextureType::External &&
+ index.getLevelIndex() == 0);
+}
+
+void TextureD3D_External::markAllImagesDirty()
+{
+ UNREACHABLE();
+}
+
+TextureD3D_2DMultisample::TextureD3D_2DMultisample(const gl::TextureState &state,
+ RendererD3D *renderer)
+ : TextureD3DImmutableBase(state, renderer)
+{}
+
+TextureD3D_2DMultisample::~TextureD3D_2DMultisample() {}
+
+angle::Result TextureD3D_2DMultisample::setStorageMultisample(const gl::Context *context,
+ gl::TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const gl::Extents &size,
+ bool fixedSampleLocations)
+{
+ ASSERT(type == gl::TextureType::_2DMultisample && size.depth == 1);
+
+ // We allocate storage immediately instead of doing it lazily like other TextureD3D classes do.
+ // This requires less state in this class.
+ TexStoragePointer storage(context);
+ storage.reset(mRenderer->createTextureStorage2DMultisample(internalformat, size.width,
+ size.height, static_cast<int>(0),
+ samples, fixedSampleLocations));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ mImmutable = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisample::setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisample::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(!index.hasLayer());
+
+ // ensure the underlying texture is created
+ ANGLE_TRY(ensureRenderTarget(context));
+
+ return mTexStorage->getRenderTarget(context, index, outRT);
+}
+
+gl::ImageIndexIterator TextureD3D_2DMultisample::imageIterator() const
+{
+ return gl::ImageIndexIterator::Make2DMultisample();
+}
+
+gl::ImageIndex TextureD3D_2DMultisample::getImageIndex(GLint mip, GLint layer) const
+{
+ return gl::ImageIndex::Make2DMultisample();
+}
+
+bool TextureD3D_2DMultisample::isValidIndex(const gl::ImageIndex &index) const
+{
+ return (mTexStorage && index.getType() == gl::TextureType::_2DMultisample &&
+ index.getLevelIndex() == 0);
+}
+
+GLsizei TextureD3D_2DMultisample::getLayerCount(int level) const
+{
+ return 1;
+}
+
+void TextureD3D_2DMultisample::markAllImagesDirty() {}
+
+angle::Result TextureD3D_2DMultisample::initializeStorage(const gl::Context *context,
+ bool renderTarget)
+{
+ // initializeStorage should only be called in a situation where the texture already has storage
+ // associated with it (storage is created in setStorageMultisample).
+ ASSERT(mTexStorage);
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisample::createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const
+{
+ UNREACHABLE();
+ outStorage->reset(mTexStorage);
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisample::setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
+{
+ // These textures are immutable, so this should only be ever called once.
+ ASSERT(!mTexStorage);
+ mTexStorage = newCompleteTexStorage;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisample::updateStorage(const gl::Context *context)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisample::initMipmapImages(const gl::Context *context)
+{
+ UNREACHABLE();
+ return angle::Result::Continue;
+}
+
+bool TextureD3D_2DMultisample::isImageComplete(const gl::ImageIndex &index) const
+{
+ return true;
+}
+
+TextureD3D_2DMultisampleArray::TextureD3D_2DMultisampleArray(const gl::TextureState &state,
+ RendererD3D *renderer)
+ : TextureD3DImmutableBase(state, renderer)
+{}
+
+TextureD3D_2DMultisampleArray::~TextureD3D_2DMultisampleArray() {}
+
+angle::Result TextureD3D_2DMultisampleArray::setStorageMultisample(const gl::Context *context,
+ gl::TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const gl::Extents &size,
+ bool fixedSampleLocations)
+{
+ ASSERT(type == gl::TextureType::_2DMultisampleArray);
+
+ mLayerCount = size.depth;
+
+ TexStoragePointer storage(context);
+ storage.reset(mRenderer->createTextureStorage2DMultisampleArray(
+ internalformat, size.width, size.height, size.depth, static_cast<int>(0), samples,
+ fixedSampleLocations));
+
+ ANGLE_TRY(setCompleteTexStorage(context, storage.get()));
+ storage.release();
+
+ mImmutable = true;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisampleArray::setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<ContextD3D>(context));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisampleArray::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ // ensure the underlying texture is created
+ ANGLE_TRY(ensureRenderTarget(context));
+
+ return mTexStorage->getRenderTarget(context, index, outRT);
+}
+
+gl::ImageIndexIterator TextureD3D_2DMultisampleArray::imageIterator() const
+{
+ return gl::ImageIndexIterator::Make2DMultisampleArray(&mLayerCount);
+}
+
+gl::ImageIndex TextureD3D_2DMultisampleArray::getImageIndex(GLint mip, GLint layer) const
+{
+ return gl::ImageIndex::Make2DMultisampleArray(layer);
+}
+
+bool TextureD3D_2DMultisampleArray::isValidIndex(const gl::ImageIndex &index) const
+{
+ return (mTexStorage && index.getType() == gl::TextureType::_2DMultisampleArray &&
+ index.getLevelIndex() == 0);
+}
+
+GLsizei TextureD3D_2DMultisampleArray::getLayerCount(int level) const
+{
+ return mLayerCount;
+}
+
+void TextureD3D_2DMultisampleArray::markAllImagesDirty() {}
+
+angle::Result TextureD3D_2DMultisampleArray::initializeStorage(const gl::Context *context,
+ bool renderTarget)
+{
+ // initializeStorage should only be called in a situation where the texture already has storage
+ // associated with it (storage is created in setStorageMultisample).
+ ASSERT(mTexStorage);
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisampleArray::createCompleteStorage(
+ bool renderTarget,
+ TexStoragePointer *outStorage) const
+{
+ UNREACHABLE();
+ outStorage->reset(mTexStorage);
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisampleArray::setCompleteTexStorage(
+ const gl::Context *context,
+ TextureStorage *newCompleteTexStorage)
+{
+ // These textures are immutable, so this should only be ever called once.
+ ASSERT(!mTexStorage);
+ mTexStorage = newCompleteTexStorage;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisampleArray::updateStorage(const gl::Context *context)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result TextureD3D_2DMultisampleArray::initMipmapImages(const gl::Context *context)
+{
+ UNIMPLEMENTED();
+ return angle::Result::Continue;
+}
+
+bool TextureD3D_2DMultisampleArray::isImageComplete(const gl::ImageIndex &index) const
+{
+ return true;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h
new file mode 100644
index 0000000000..c1055d802c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h
@@ -0,0 +1,909 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureD3D.h: Implementations of the Texture interfaces shared betweeen the D3D backends.
+
+#ifndef LIBANGLE_RENDERER_D3D_TEXTURED3D_H_
+#define LIBANGLE_RENDERER_D3D_TEXTURED3D_H_
+
+#include "common/Color.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Stream.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/TextureImpl.h"
+#include "libANGLE/renderer/d3d/TextureStorage.h"
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace rx
+{
+class EGLImageD3D;
+class ImageD3D;
+class RendererD3D;
+class RenderTargetD3D;
+class TextureStorage;
+
+class TextureD3D : public TextureImpl
+{
+ public:
+ TextureD3D(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D() override;
+
+ void onDestroy(const gl::Context *context) override;
+
+ angle::Result getNativeTexture(const gl::Context *context, TextureStorage **outStorage);
+
+ bool hasDirtyImages() const { return mDirtyImages; }
+ void resetDirty() { mDirtyImages = false; }
+
+ virtual ImageD3D *getImage(const gl::ImageIndex &index) const = 0;
+ virtual GLsizei getLayerCount(int level) const = 0;
+
+ angle::Result getImageAndSyncFromStorage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D **outImage);
+
+ GLint getBaseLevelWidth() const;
+ GLint getBaseLevelHeight() const;
+ GLenum getBaseLevelInternalFormat() const;
+
+ angle::Result setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size) override;
+
+ angle::Result setStorageMultisample(const gl::Context *context,
+ gl::TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const gl::Extents &size,
+ bool fixedSampleLocations) override;
+
+ angle::Result setStorageExternalMemory(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ gl::MemoryObject *memoryObject,
+ GLuint64 offset) override;
+
+ bool isImmutable() const { return mImmutable; }
+
+ virtual angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) = 0;
+
+ // Returns an iterator over all "Images" for this particular Texture.
+ virtual gl::ImageIndexIterator imageIterator() const = 0;
+
+ // Returns an ImageIndex for a particular "Image". 3D Textures do not have images for
+ // slices of their depth texures, so 3D textures ignore the layer parameter.
+ virtual gl::ImageIndex getImageIndex(GLint mip, GLint layer) const = 0;
+ virtual bool isValidIndex(const gl::ImageIndex &index) const = 0;
+
+ angle::Result setImageExternal(const gl::Context *context,
+ gl::TextureType type,
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc) override;
+ angle::Result generateMipmap(const gl::Context *context) override;
+ TextureStorage *getStorage();
+ ImageD3D *getBaseLevelImage() const;
+
+ angle::Result getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut) override;
+
+ angle::Result setBaseLevel(const gl::Context *context, GLuint baseLevel) override;
+
+ angle::Result syncState(const gl::Context *context,
+ const gl::Texture::DirtyBits &dirtyBits) override;
+
+ angle::Result initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex) override;
+
+ protected:
+ angle::Result setImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset);
+ angle::Result subImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset);
+ angle::Result setCompressedImageImpl(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset);
+ angle::Result subImageCompressed(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ ptrdiff_t layerOffset);
+ bool isFastUnpackable(const gl::Buffer *unpackBuffer, GLenum sizedInternalFormat);
+ angle::Result fastUnpackPixels(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels,
+ const gl::Box &destArea,
+ GLenum sizedInternalFormat,
+ GLenum type,
+ RenderTargetD3D *destRenderTarget);
+
+ GLint getLevelZeroWidth() const;
+ GLint getLevelZeroHeight() const;
+ virtual GLint getLevelZeroDepth() const;
+
+ GLint creationLevels(GLsizei width, GLsizei height, GLsizei depth) const;
+ virtual angle::Result initMipmapImages(const gl::Context *context) = 0;
+ bool isBaseImageZeroSize() const;
+ virtual bool isImageComplete(const gl::ImageIndex &index) const = 0;
+
+ bool canCreateRenderTargetForImage(const gl::ImageIndex &index) const;
+ angle::Result ensureRenderTarget(const gl::Context *context);
+
+ virtual angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const = 0;
+ virtual angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) = 0;
+ angle::Result commitRegion(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &region);
+
+ angle::Result releaseTexStorage(const gl::Context *context);
+
+ GLuint getBaseLevel() const { return mBaseLevel; }
+
+ virtual void markAllImagesDirty() = 0;
+
+ GLint getBaseLevelDepth() const;
+
+ RendererD3D *mRenderer;
+
+ bool mDirtyImages;
+
+ bool mImmutable;
+ TextureStorage *mTexStorage;
+
+ private:
+ virtual angle::Result initializeStorage(const gl::Context *context, bool renderTarget) = 0;
+
+ virtual angle::Result updateStorage(const gl::Context *context) = 0;
+
+ bool couldUseSetData() const;
+ bool shouldUseSetData(const ImageD3D *image) const;
+
+ angle::Result generateMipmapUsingImages(const gl::Context *context, const GLuint maxLevel);
+
+ GLuint mBaseLevel;
+};
+
+class TextureD3D_2D : public TextureD3D
+{
+ public:
+ TextureD3D_2D(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D_2D() override;
+
+ void onDestroy(const gl::Context *context) override;
+
+ ImageD3D *getImage(int level, int layer) const;
+ ImageD3D *getImage(const gl::ImageIndex &index) const override;
+ GLsizei getLayerCount(int level) const override;
+
+ GLsizei getWidth(GLint level) const;
+ GLsizei getHeight(GLint level) const;
+ GLenum getInternalFormat(GLint level) const;
+ bool isDepth(GLint level) const;
+ bool isSRGB(GLint level) const;
+
+ angle::Result setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels) override;
+ angle::Result setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels) override;
+
+ angle::Result setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+ angle::Result setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+
+ angle::Result copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source) override;
+ angle::Result copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source) override;
+
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+ angle::Result copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+ angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source) override;
+
+ angle::Result setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size) override;
+
+ angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) override;
+ angle::Result releaseTexImage(const gl::Context *context) override;
+
+ angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ gl::ImageIndexIterator imageIterator() const override;
+ gl::ImageIndex getImageIndex(GLint mip, GLint layer) const override;
+ bool isValidIndex(const gl::ImageIndex &index) const override;
+
+ protected:
+ void markAllImagesDirty() override;
+
+ private:
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
+
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
+
+ bool isValidLevel(int level) const;
+ bool isLevelComplete(int level) const;
+ bool isImageComplete(const gl::ImageIndex &index) const override;
+
+ angle::Result updateStorageLevel(const gl::Context *context, int level);
+
+ angle::Result redefineImage(const gl::Context *context,
+ size_t level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
+
+ bool mEGLImageTarget;
+ gl::TexLevelArray<std::unique_ptr<ImageD3D>> mImageArray;
+};
+
+class TextureD3D_Cube : public TextureD3D
+{
+ public:
+ TextureD3D_Cube(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D_Cube() override;
+
+ void onDestroy(const gl::Context *context) override;
+
+ ImageD3D *getImage(int level, int layer) const;
+ ImageD3D *getImage(const gl::ImageIndex &index) const override;
+ GLsizei getLayerCount(int level) const override;
+
+ GLenum getInternalFormat(GLint level, GLint layer) const;
+ bool isDepth(GLint level, GLint layer) const;
+ bool isSRGB(GLint level, GLint layer) const;
+
+ angle::Result setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels) override;
+ angle::Result setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels) override;
+
+ angle::Result setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+ angle::Result setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+
+ angle::Result copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source) override;
+ angle::Result copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source) override;
+
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+ angle::Result copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+
+ angle::Result setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size) override;
+
+ angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) override;
+ angle::Result releaseTexImage(const gl::Context *context) override;
+
+ angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ gl::ImageIndexIterator imageIterator() const override;
+ gl::ImageIndex getImageIndex(GLint mip, GLint layer) const override;
+ bool isValidIndex(const gl::ImageIndex &index) const override;
+
+ protected:
+ void markAllImagesDirty() override;
+
+ private:
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
+
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
+
+ bool isValidFaceLevel(int faceIndex, int level) const;
+ bool isFaceLevelComplete(int faceIndex, int level) const;
+ bool isCubeComplete() const;
+ bool isImageComplete(const gl::ImageIndex &index) const override;
+ angle::Result updateStorageFaceLevel(const gl::Context *context, int faceIndex, int level);
+
+ angle::Result redefineImage(const gl::Context *context,
+ int faceIndex,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
+
+ std::array<gl::TexLevelArray<std::unique_ptr<ImageD3D>>, 6> mImageArray;
+};
+
+class TextureD3D_3D : public TextureD3D
+{
+ public:
+ TextureD3D_3D(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D_3D() override;
+
+ void onDestroy(const gl::Context *context) override;
+
+ ImageD3D *getImage(int level, int layer) const;
+ ImageD3D *getImage(const gl::ImageIndex &index) const override;
+ GLsizei getLayerCount(int level) const override;
+
+ GLsizei getWidth(GLint level) const;
+ GLsizei getHeight(GLint level) const;
+ GLsizei getDepth(GLint level) const;
+ GLenum getInternalFormat(GLint level) const;
+ bool isDepth(GLint level) const;
+ bool isSRGB(GLint level) const;
+
+ angle::Result setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels) override;
+ angle::Result setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels) override;
+
+ angle::Result setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+ angle::Result setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+
+ angle::Result copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source) override;
+ angle::Result copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source) override;
+
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+ angle::Result copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+
+ angle::Result setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size) override;
+
+ angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) override;
+ angle::Result releaseTexImage(const gl::Context *context) override;
+
+ angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ gl::ImageIndexIterator imageIterator() const override;
+ gl::ImageIndex getImageIndex(GLint mip, GLint layer) const override;
+ bool isValidIndex(const gl::ImageIndex &index) const override;
+
+ protected:
+ void markAllImagesDirty() override;
+ GLint getLevelZeroDepth() const override;
+
+ private:
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
+
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
+
+ bool isValidLevel(int level) const;
+ bool isLevelComplete(int level) const;
+ bool isImageComplete(const gl::ImageIndex &index) const override;
+ angle::Result updateStorageLevel(const gl::Context *context, int level);
+
+ angle::Result redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
+
+ gl::TexLevelArray<std::unique_ptr<ImageD3D>> mImageArray;
+};
+
+class TextureD3D_2DArray : public TextureD3D
+{
+ public:
+ TextureD3D_2DArray(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D_2DArray() override;
+
+ void onDestroy(const gl::Context *context) override;
+
+ virtual ImageD3D *getImage(int level, int layer) const;
+ ImageD3D *getImage(const gl::ImageIndex &index) const override;
+ GLsizei getLayerCount(int level) const override;
+
+ GLsizei getWidth(GLint level) const;
+ GLsizei getHeight(GLint level) const;
+ GLenum getInternalFormat(GLint level) const;
+ bool isDepth(GLint level) const;
+
+ angle::Result setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels) override;
+ angle::Result setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels) override;
+
+ angle::Result setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+ angle::Result setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+
+ angle::Result copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source) override;
+ angle::Result copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source) override;
+
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ GLenum type,
+ size_t sourceLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+ angle::Result copySubTexture(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ size_t sourceLevel,
+ const gl::Box &sourceBox,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const gl::Texture *source) override;
+
+ angle::Result setStorage(const gl::Context *context,
+ gl::TextureType type,
+ size_t levels,
+ GLenum internalFormat,
+ const gl::Extents &size) override;
+
+ angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) override;
+ angle::Result releaseTexImage(const gl::Context *context) override;
+
+ angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ gl::ImageIndexIterator imageIterator() const override;
+ gl::ImageIndex getImageIndex(GLint mip, GLint layer) const override;
+ bool isValidIndex(const gl::ImageIndex &index) const override;
+
+ protected:
+ void markAllImagesDirty() override;
+
+ private:
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
+
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
+
+ bool isValidLevel(int level) const;
+ bool isLevelComplete(int level) const;
+ bool isImageComplete(const gl::ImageIndex &index) const override;
+ bool isSRGB(GLint level) const;
+ angle::Result updateStorageLevel(const gl::Context *context, int level);
+
+ void deleteImages();
+ angle::Result redefineImage(const gl::Context *context,
+ GLint level,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease);
+
+ // Storing images as an array of single depth textures since D3D11 treats each array level of a
+ // Texture2D object as a separate subresource. Each layer would have to be looped over
+ // to update all the texture layers since they cannot all be updated at once and it makes the
+ // most sense for the Image class to not have to worry about layer subresource as well as mip
+ // subresources.
+ GLsizei mLayerCounts[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+ ImageD3D **mImageArray[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+// Base class for immutable textures. These don't support manipulation of individual texture images.
+class TextureD3DImmutableBase : public TextureD3D
+{
+ public:
+ TextureD3DImmutableBase(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3DImmutableBase() override;
+
+ ImageD3D *getImage(const gl::ImageIndex &index) const override;
+ angle::Result setImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixels) override;
+ angle::Result setSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ gl::Buffer *unpackBuffer,
+ const uint8_t *pixels) override;
+
+ angle::Result setCompressedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ GLenum internalFormat,
+ const gl::Extents &size,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+ angle::Result setCompressedSubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Box &area,
+ GLenum format,
+ const gl::PixelUnpackState &unpack,
+ size_t imageSize,
+ const uint8_t *pixels) override;
+
+ angle::Result copyImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Rectangle &sourceArea,
+ GLenum internalFormat,
+ gl::Framebuffer *source) override;
+ angle::Result copySubImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ gl::Framebuffer *source) override;
+
+ angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) override;
+ angle::Result releaseTexImage(const gl::Context *context) override;
+};
+
+class TextureD3D_External : public TextureD3DImmutableBase
+{
+ public:
+ TextureD3D_External(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D_External() override;
+
+ GLsizei getLayerCount(int level) const override;
+
+ angle::Result setImageExternal(const gl::Context *context,
+ gl::TextureType type,
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc) override;
+
+ angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ gl::ImageIndexIterator imageIterator() const override;
+ gl::ImageIndex getImageIndex(GLint mip, GLint layer) const override;
+ bool isValidIndex(const gl::ImageIndex &index) const override;
+
+ protected:
+ void markAllImagesDirty() override;
+
+ private:
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
+
+ angle::Result updateStorage(const gl::Context *context) override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
+
+ bool isImageComplete(const gl::ImageIndex &index) const override;
+};
+
+class TextureD3D_2DMultisample : public TextureD3DImmutableBase
+{
+ public:
+ TextureD3D_2DMultisample(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D_2DMultisample() override;
+
+ angle::Result setStorageMultisample(const gl::Context *context,
+ gl::TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const gl::Extents &size,
+ bool fixedSampleLocations) override;
+
+ angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ gl::ImageIndexIterator imageIterator() const override;
+ gl::ImageIndex getImageIndex(GLint mip, GLint layer) const override;
+ bool isValidIndex(const gl::ImageIndex &index) const override;
+
+ GLsizei getLayerCount(int level) const override;
+
+ protected:
+ void markAllImagesDirty() override;
+
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
+
+ angle::Result updateStorage(const gl::Context *context) override;
+
+ private:
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
+
+ bool isImageComplete(const gl::ImageIndex &index) const override;
+};
+
+class TextureD3D_2DMultisampleArray : public TextureD3DImmutableBase
+{
+ public:
+ TextureD3D_2DMultisampleArray(const gl::TextureState &data, RendererD3D *renderer);
+ ~TextureD3D_2DMultisampleArray() override;
+
+ angle::Result setStorageMultisample(const gl::Context *context,
+ gl::TextureType type,
+ GLsizei samples,
+ GLint internalformat,
+ const gl::Extents &size,
+ bool fixedSampleLocations) override;
+
+ angle::Result setEGLImageTarget(const gl::Context *context,
+ gl::TextureType type,
+ egl::Image *image) override;
+
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ gl::ImageIndexIterator imageIterator() const override;
+ gl::ImageIndex getImageIndex(GLint mip, GLint layer) const override;
+ bool isValidIndex(const gl::ImageIndex &index) const override;
+
+ GLsizei getLayerCount(int level) const override;
+
+ protected:
+ void markAllImagesDirty() override;
+
+ angle::Result setCompleteTexStorage(const gl::Context *context,
+ TextureStorage *newCompleteTexStorage) override;
+
+ angle::Result updateStorage(const gl::Context *context) override;
+
+ private:
+ angle::Result initializeStorage(const gl::Context *context, bool renderTarget) override;
+ angle::Result createCompleteStorage(bool renderTarget,
+ TexStoragePointer *outTexStorage) const override;
+ angle::Result initMipmapImages(const gl::Context *context) override;
+
+ bool isImageComplete(const gl::ImageIndex &index) const override;
+
+ GLsizei mLayerCount;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_TEXTURED3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h
new file mode 100644
index 0000000000..708ab56550
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h
@@ -0,0 +1,94 @@
+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage.h: Defines the abstract rx::TextureStorage class.
+
+#ifndef LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
+#define LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
+
+#include "common/debug.h"
+#include "libANGLE/angletypes.h"
+
+#include <GLES2/gl2.h>
+#include <stdint.h>
+
+namespace gl
+{
+class Context;
+class ImageIndex;
+struct Box;
+struct PixelUnpackState;
+} // namespace gl
+
+namespace angle
+{
+class Subject;
+} // namespace angle
+
+namespace rx
+{
+class SwapChainD3D;
+class RenderTargetD3D;
+class ImageD3D;
+
+class TextureStorage : angle::NonCopyable
+{
+ public:
+ TextureStorage() {}
+ virtual ~TextureStorage() {}
+
+ virtual angle::Result onDestroy(const gl::Context *context);
+
+ virtual int getTopLevel() const = 0;
+ virtual bool isRenderTarget() const = 0;
+ virtual bool isManaged() const = 0;
+ virtual bool supportsNativeMipmapFunction() const = 0;
+ virtual int getLevelCount() const = 0;
+
+ virtual angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) = 0;
+ virtual angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) = 0;
+
+ virtual angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage) = 0;
+ virtual angle::Result setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData) = 0;
+
+ // This is a no-op for most implementations of TextureStorage. Some (e.g. TextureStorage11_2D)
+ // might override it.
+ virtual angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture);
+
+ virtual void invalidateTextures() {}
+
+ protected:
+ const angle::Subject *mSubject;
+};
+
+inline angle::Result TextureStorage::onDestroy(const gl::Context *context)
+{
+ return angle::Result::Continue;
+}
+
+inline angle::Result TextureStorage::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture)
+{
+ return angle::Result::Continue;
+}
+
+using TexStoragePointer = angle::UniqueObjectPointer<TextureStorage, gl::Context>;
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp
new file mode 100644
index 0000000000..7ad5080062
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp
@@ -0,0 +1,293 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer.cpp: Defines the abstract VertexBuffer class and VertexBufferInterface
+// class with derivations, classes that perform graphics API agnostic vertex buffer operations.
+
+#include "libANGLE/renderer/d3d/VertexBuffer.h"
+
+#include "common/mathutil.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+
+namespace rx
+{
+
+// VertexBuffer Implementation
+unsigned int VertexBuffer::mNextSerial = 1;
+
+VertexBuffer::VertexBuffer() : mRefCount(1)
+{
+ updateSerial();
+}
+
+VertexBuffer::~VertexBuffer() {}
+
+void VertexBuffer::updateSerial()
+{
+ mSerial = mNextSerial++;
+}
+
+unsigned int VertexBuffer::getSerial() const
+{
+ return mSerial;
+}
+
+void VertexBuffer::addRef()
+{
+ mRefCount++;
+}
+
+void VertexBuffer::release()
+{
+ ASSERT(mRefCount > 0);
+ mRefCount--;
+
+ if (mRefCount == 0)
+ {
+ delete this;
+ }
+}
+
+// VertexBufferInterface Implementation
+VertexBufferInterface::VertexBufferInterface(BufferFactoryD3D *factory, bool dynamic)
+ : mFactory(factory), mVertexBuffer(factory->createVertexBuffer()), mDynamic(dynamic)
+{}
+
+VertexBufferInterface::~VertexBufferInterface()
+{
+ if (mVertexBuffer)
+ {
+ mVertexBuffer->release();
+ mVertexBuffer = nullptr;
+ }
+}
+
+unsigned int VertexBufferInterface::getSerial() const
+{
+ ASSERT(mVertexBuffer);
+ return mVertexBuffer->getSerial();
+}
+
+unsigned int VertexBufferInterface::getBufferSize() const
+{
+ ASSERT(mVertexBuffer);
+ return mVertexBuffer->getBufferSize();
+}
+
+angle::Result VertexBufferInterface::setBufferSize(const gl::Context *context, unsigned int size)
+{
+ ASSERT(mVertexBuffer);
+ if (mVertexBuffer->getBufferSize() == 0)
+ {
+ return mVertexBuffer->initialize(context, size, mDynamic);
+ }
+
+ return mVertexBuffer->setBufferSize(context, size);
+}
+
+angle::Result VertexBufferInterface::getSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *spaceInBytesOut) const
+{
+ unsigned int spaceRequired = 0;
+ ANGLE_TRY(mFactory->getVertexSpaceRequired(context, attrib, binding, count, instances,
+ &spaceRequired));
+
+ // Align to 16-byte boundary
+ unsigned int alignedSpaceRequired = roundUp(spaceRequired, 16u);
+ ANGLE_CHECK_GL_ALLOC(GetImplAs<ContextD3D>(context), alignedSpaceRequired >= spaceRequired);
+
+ *spaceInBytesOut = alignedSpaceRequired;
+ return angle::Result::Continue;
+}
+
+angle::Result VertexBufferInterface::discard(const gl::Context *context)
+{
+ ASSERT(mVertexBuffer);
+ return mVertexBuffer->discard(context);
+}
+
+VertexBuffer *VertexBufferInterface::getVertexBuffer() const
+{
+ ASSERT(mVertexBuffer);
+ return mVertexBuffer;
+}
+
+// StreamingVertexBufferInterface Implementation
+StreamingVertexBufferInterface::StreamingVertexBufferInterface(BufferFactoryD3D *factory)
+ : VertexBufferInterface(factory, true), mWritePosition(0), mReservedSpace(0)
+{}
+
+angle::Result StreamingVertexBufferInterface::initialize(const gl::Context *context,
+ std::size_t initialSize)
+{
+ return setBufferSize(context, static_cast<unsigned int>(initialSize));
+}
+
+void StreamingVertexBufferInterface::reset()
+{
+ if (mVertexBuffer)
+ {
+ mVertexBuffer->release();
+ mVertexBuffer = mFactory->createVertexBuffer();
+ }
+}
+
+StreamingVertexBufferInterface::~StreamingVertexBufferInterface() {}
+
+angle::Result StreamingVertexBufferInterface::reserveSpace(const gl::Context *context,
+ unsigned int size)
+{
+ unsigned int curBufferSize = getBufferSize();
+ if (size > curBufferSize)
+ {
+ ANGLE_TRY(setBufferSize(context, std::max(size, 3 * curBufferSize / 2)));
+ mWritePosition = 0;
+ }
+ else if (mWritePosition + size > curBufferSize)
+ {
+ ANGLE_TRY(discard(context));
+ mWritePosition = 0;
+ }
+
+ mReservedSpace = size;
+ return angle::Result::Continue;
+}
+
+angle::Result StreamingVertexBufferInterface::storeDynamicAttribute(
+ const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ gl::VertexAttribType currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int *outStreamOffset,
+ const uint8_t *sourceData)
+{
+ unsigned int spaceRequired = 0;
+ ANGLE_TRY(getSpaceRequired(context, attrib, binding, count, instances, &spaceRequired));
+
+ // Protect against integer overflow
+ angle::CheckedNumeric<unsigned int> checkedPosition(mWritePosition);
+ checkedPosition += spaceRequired;
+ ANGLE_CHECK_GL_ALLOC(GetImplAs<ContextD3D>(context), checkedPosition.IsValid());
+
+ mReservedSpace = 0;
+
+ ANGLE_TRY(mVertexBuffer->storeVertexAttributes(context, attrib, binding, currentValueType,
+ start, count, instances, mWritePosition,
+ sourceData));
+
+ if (outStreamOffset)
+ {
+ *outStreamOffset = mWritePosition;
+ }
+
+ mWritePosition += spaceRequired;
+
+ return angle::Result::Continue;
+}
+
+angle::Result StreamingVertexBufferInterface::reserveVertexSpace(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances)
+{
+ unsigned int requiredSpace = 0;
+ ANGLE_TRY(mFactory->getVertexSpaceRequired(context, attrib, binding, count, instances,
+ &requiredSpace));
+
+ // Align to 16-byte boundary
+ auto alignedRequiredSpace = rx::CheckedRoundUp(requiredSpace, 16u);
+ alignedRequiredSpace += mReservedSpace;
+
+ // Protect against integer overflow
+ ANGLE_CHECK_GL_ALLOC(GetImplAs<ContextD3D>(context), alignedRequiredSpace.IsValid());
+
+ ANGLE_TRY(reserveSpace(context, alignedRequiredSpace.ValueOrDie()));
+
+ return angle::Result::Continue;
+}
+
+// StaticVertexBufferInterface Implementation
+StaticVertexBufferInterface::AttributeSignature::AttributeSignature()
+ : formatID(angle::FormatID::NONE), stride(0), offset(0)
+{}
+
+bool StaticVertexBufferInterface::AttributeSignature::matchesAttribute(
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding) const
+{
+ size_t attribStride = ComputeVertexAttributeStride(attrib, binding);
+
+ if (formatID != attrib.format->id || static_cast<GLuint>(stride) != attribStride)
+ {
+ return false;
+ }
+
+ size_t attribOffset =
+ (static_cast<size_t>(ComputeVertexAttributeOffset(attrib, binding)) % attribStride);
+ return (offset == attribOffset);
+}
+
+void StaticVertexBufferInterface::AttributeSignature::set(const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding)
+{
+ formatID = attrib.format->id;
+ offset = stride = static_cast<GLuint>(ComputeVertexAttributeStride(attrib, binding));
+ offset = static_cast<size_t>(ComputeVertexAttributeOffset(attrib, binding)) %
+ ComputeVertexAttributeStride(attrib, binding);
+}
+
+StaticVertexBufferInterface::StaticVertexBufferInterface(BufferFactoryD3D *factory)
+ : VertexBufferInterface(factory, false)
+{}
+
+StaticVertexBufferInterface::~StaticVertexBufferInterface() {}
+
+bool StaticVertexBufferInterface::matchesAttribute(const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding) const
+{
+ return mSignature.matchesAttribute(attrib, binding);
+}
+
+void StaticVertexBufferInterface::setAttribute(const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding)
+{
+ return mSignature.set(attrib, binding);
+}
+
+angle::Result StaticVertexBufferInterface::storeStaticAttribute(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLint start,
+ GLsizei count,
+ GLsizei instances,
+ const uint8_t *sourceData)
+{
+ unsigned int spaceRequired = 0;
+ ANGLE_TRY(getSpaceRequired(context, attrib, binding, count, instances, &spaceRequired));
+ ANGLE_TRY(setBufferSize(context, spaceRequired));
+
+ ASSERT(attrib.enabled);
+ ANGLE_TRY(mVertexBuffer->storeVertexAttributes(context, attrib, binding,
+ gl::VertexAttribType::InvalidEnum, start, count,
+ instances, 0, sourceData));
+
+ mSignature.set(attrib, binding);
+ mVertexBuffer->hintUnmapResource();
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h
new file mode 100644
index 0000000000..6c5e1e3f3e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h
@@ -0,0 +1,186 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer.h: Defines the abstract VertexBuffer class and VertexBufferInterface
+// class with derivations, classes that perform graphics API agnostic vertex buffer operations.
+
+#ifndef LIBANGLE_RENDERER_D3D_VERTEXBUFFER_H_
+#define LIBANGLE_RENDERER_D3D_VERTEXBUFFER_H_
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/renderer/Format.h"
+
+#include <GLES2/gl2.h>
+
+#include <cstddef>
+#include <cstdint>
+#include <vector>
+
+namespace gl
+{
+class Context;
+struct VertexAttribute;
+class VertexBinding;
+struct VertexAttribCurrentValueData;
+} // namespace gl
+
+namespace rx
+{
+class BufferFactoryD3D;
+
+// Use a ref-counting scheme with self-deletion on release. We do this so that we can more
+// easily manage the static buffer cache, without deleting currently bound buffers.
+class VertexBuffer : angle::NonCopyable
+{
+ public:
+ VertexBuffer();
+
+ virtual angle::Result initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage) = 0;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using this
+ // function.
+ virtual angle::Result storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ gl::VertexAttribType currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData) = 0;
+
+ virtual unsigned int getBufferSize() const = 0;
+ virtual angle::Result setBufferSize(const gl::Context *context, unsigned int size) = 0;
+ virtual angle::Result discard(const gl::Context *context) = 0;
+
+ unsigned int getSerial() const;
+
+ // This may be overridden (e.g. by VertexBuffer11) if necessary.
+ virtual void hintUnmapResource() {}
+
+ // Reference counting.
+ void addRef();
+ void release();
+
+ protected:
+ void updateSerial();
+ virtual ~VertexBuffer();
+
+ private:
+ unsigned int mSerial;
+ static unsigned int mNextSerial;
+ unsigned int mRefCount;
+};
+
+class VertexBufferInterface : angle::NonCopyable
+{
+ public:
+ VertexBufferInterface(BufferFactoryD3D *factory, bool dynamic);
+ virtual ~VertexBufferInterface();
+
+ unsigned int getBufferSize() const;
+ bool empty() const { return getBufferSize() == 0; }
+
+ unsigned int getSerial() const;
+
+ VertexBuffer *getVertexBuffer() const;
+
+ protected:
+ angle::Result discard(const gl::Context *context);
+
+ angle::Result setBufferSize(const gl::Context *context, unsigned int size);
+
+ angle::Result getSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *spaceInBytesOut) const;
+ BufferFactoryD3D *const mFactory;
+ VertexBuffer *mVertexBuffer;
+ bool mDynamic;
+};
+
+class StreamingVertexBufferInterface : public VertexBufferInterface
+{
+ public:
+ StreamingVertexBufferInterface(BufferFactoryD3D *factory);
+ ~StreamingVertexBufferInterface() override;
+
+ angle::Result initialize(const gl::Context *context, std::size_t initialSize);
+ void reset();
+
+ angle::Result storeDynamicAttribute(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ gl::VertexAttribType currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int *outStreamOffset,
+ const uint8_t *sourceData);
+
+ angle::Result reserveVertexSpace(const gl::Context *context,
+ const gl::VertexAttribute &attribute,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances);
+
+ private:
+ angle::Result reserveSpace(const gl::Context *context, unsigned int size);
+
+ unsigned int mWritePosition;
+ unsigned int mReservedSpace;
+};
+
+class StaticVertexBufferInterface : public VertexBufferInterface
+{
+ public:
+ explicit StaticVertexBufferInterface(BufferFactoryD3D *factory);
+ ~StaticVertexBufferInterface() override;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using these
+ // functions.
+ angle::Result storeStaticAttribute(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ GLint start,
+ GLsizei count,
+ GLsizei instances,
+ const uint8_t *sourceData);
+
+ bool matchesAttribute(const gl::VertexAttribute &attribute,
+ const gl::VertexBinding &binding) const;
+
+ void setAttribute(const gl::VertexAttribute &attribute, const gl::VertexBinding &binding);
+
+ private:
+ class AttributeSignature final : angle::NonCopyable
+ {
+ public:
+ AttributeSignature();
+
+ bool matchesAttribute(const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding) const;
+
+ void set(const gl::VertexAttribute &attrib, const gl::VertexBinding &binding);
+
+ private:
+ angle::FormatID formatID;
+ GLuint stride;
+ size_t offset;
+ };
+
+ AttributeSignature mSignature;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_VERTEXBUFFER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp
new file mode 100644
index 0000000000..7ccc2dc394
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -0,0 +1,674 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexDataManager.h: Defines the VertexDataManager, a class that
+// runs the Buffer translation process.
+
+#include "libANGLE/renderer/d3d/VertexDataManager.h"
+
+#include "common/bitset_utils.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/State.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+#include "libANGLE/renderer/d3d/VertexBuffer.h"
+
+using namespace angle;
+
+namespace rx
+{
+namespace
+{
+enum
+{
+ INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024
+};
+// This has to be at least 4k or else it fails on ATI cards.
+enum
+{
+ CONSTANT_VERTEX_BUFFER_SIZE = 4096
+};
+
+// Warning: ensure the binding matches attrib.bindingIndex before using these functions.
+int64_t GetMaxAttributeByteOffsetForDraw(const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ int64_t elementCount)
+{
+ CheckedNumeric<int64_t> stride = ComputeVertexAttributeStride(attrib, binding);
+ CheckedNumeric<int64_t> offset = ComputeVertexAttributeOffset(attrib, binding);
+ CheckedNumeric<int64_t> size = ComputeVertexAttributeTypeSize(attrib);
+
+ ASSERT(elementCount > 0);
+
+ CheckedNumeric<int64_t> result =
+ stride * (CheckedNumeric<int64_t>(elementCount) - 1) + size + offset;
+ return result.ValueOrDefault(std::numeric_limits<int64_t>::max());
+}
+
+// Warning: ensure the binding matches attrib.bindingIndex before using these functions.
+int ElementsInBuffer(const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ unsigned int size)
+{
+ // Size cannot be larger than a GLsizei
+ if (size > static_cast<unsigned int>(std::numeric_limits<int>::max()))
+ {
+ size = static_cast<unsigned int>(std::numeric_limits<int>::max());
+ }
+
+ GLsizei stride = static_cast<GLsizei>(ComputeVertexAttributeStride(attrib, binding));
+ GLsizei offset = static_cast<GLsizei>(ComputeVertexAttributeOffset(attrib, binding));
+ return (size - offset % stride +
+ (stride - static_cast<GLsizei>(ComputeVertexAttributeTypeSize(attrib)))) /
+ stride;
+}
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+bool DirectStoragePossible(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding)
+{
+ // Current value attribs may not use direct storage.
+ if (!attrib.enabled)
+ {
+ return false;
+ }
+
+ gl::Buffer *buffer = binding.getBuffer().get();
+ if (!buffer)
+ {
+ return false;
+ }
+
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
+ ASSERT(bufferD3D);
+ if (!bufferD3D->supportsDirectBinding())
+ {
+ return false;
+ }
+
+ // Alignment restrictions: In D3D, vertex data must be aligned to the format stride, or to a
+ // 4-byte boundary, whichever is smaller. (Undocumented, and experimentally confirmed)
+ size_t alignment = 4;
+
+ // TODO(jmadill): add VertexFormatCaps
+ BufferFactoryD3D *factory = bufferD3D->getFactory();
+
+ angle::FormatID vertexFormatID = attrib.format->id;
+
+ // CPU-converted vertex data must be converted (naturally).
+ if ((factory->getVertexConversionType(vertexFormatID) & VERTEX_CONVERT_CPU) != 0)
+ {
+ return false;
+ }
+
+ if (attrib.format->vertexAttribType != gl::VertexAttribType::Float)
+ {
+ unsigned int elementSize = 0;
+ angle::Result error =
+ factory->getVertexSpaceRequired(context, attrib, binding, 1, 0, &elementSize);
+ ASSERT(error == angle::Result::Continue);
+ alignment = std::min<size_t>(elementSize, 4);
+ }
+
+ GLintptr offset = ComputeVertexAttributeOffset(attrib, binding);
+ // Final alignment check - unaligned data must be converted.
+ return (static_cast<size_t>(ComputeVertexAttributeStride(attrib, binding)) % alignment == 0) &&
+ (static_cast<size_t>(offset) % alignment == 0);
+}
+} // anonymous namespace
+
+TranslatedAttribute::TranslatedAttribute()
+ : active(false),
+ attribute(nullptr),
+ binding(nullptr),
+ currentValueType(gl::VertexAttribType::InvalidEnum),
+ baseOffset(0),
+ usesFirstVertexOffset(false),
+ stride(0),
+ vertexBuffer(),
+ storage(nullptr),
+ serial(0),
+ divisor(0)
+{}
+
+TranslatedAttribute::TranslatedAttribute(const TranslatedAttribute &other) = default;
+
+angle::Result TranslatedAttribute::computeOffset(const gl::Context *context,
+ GLint startVertex,
+ unsigned int *offsetOut) const
+{
+ if (!usesFirstVertexOffset)
+ {
+ *offsetOut = baseOffset;
+ return angle::Result::Continue;
+ }
+
+ CheckedNumeric<unsigned int> offset(baseOffset);
+ CheckedNumeric<unsigned int> checkedStride(stride);
+
+ offset += checkedStride * static_cast<unsigned int>(startVertex);
+ ANGLE_CHECK_GL_MATH(GetImplAs<ContextD3D>(context), offset.IsValid());
+ *offsetOut = offset.ValueOrDie();
+ return angle::Result::Continue;
+}
+
+// Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
+VertexStorageType ClassifyAttributeStorage(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding)
+{
+ // If attribute is disabled, we use the current value.
+ if (!attrib.enabled)
+ {
+ return VertexStorageType::CURRENT_VALUE;
+ }
+
+ // If specified with immediate data, we must use dynamic storage.
+ gl::Buffer *buffer = binding.getBuffer().get();
+ if (!buffer)
+ {
+ return VertexStorageType::DYNAMIC;
+ }
+
+ // Check if the buffer supports direct storage.
+ if (DirectStoragePossible(context, attrib, binding))
+ {
+ return VertexStorageType::DIRECT;
+ }
+
+ // Otherwise the storage is static or dynamic.
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
+ ASSERT(bufferD3D);
+ switch (bufferD3D->getUsage())
+ {
+ case D3DBufferUsage::DYNAMIC:
+ return VertexStorageType::DYNAMIC;
+ case D3DBufferUsage::STATIC:
+ return VertexStorageType::STATIC;
+ default:
+ UNREACHABLE();
+ return VertexStorageType::UNKNOWN;
+ }
+}
+
+VertexDataManager::CurrentValueState::CurrentValueState(BufferFactoryD3D *factory)
+ : buffer(new StreamingVertexBufferInterface(factory)), offset(0)
+{
+ data.Values.FloatValues[0] = std::numeric_limits<float>::quiet_NaN();
+ data.Values.FloatValues[1] = std::numeric_limits<float>::quiet_NaN();
+ data.Values.FloatValues[2] = std::numeric_limits<float>::quiet_NaN();
+ data.Values.FloatValues[3] = std::numeric_limits<float>::quiet_NaN();
+ data.Type = gl::VertexAttribType::Float;
+}
+
+VertexDataManager::CurrentValueState::CurrentValueState(CurrentValueState &&other)
+{
+ std::swap(buffer, other.buffer);
+ std::swap(data, other.data);
+ std::swap(offset, other.offset);
+}
+
+VertexDataManager::CurrentValueState::~CurrentValueState() {}
+
+VertexDataManager::VertexDataManager(BufferFactoryD3D *factory)
+ : mFactory(factory), mStreamingBuffer(factory)
+{
+ for (int currentValueIndex = 0; currentValueIndex < gl::MAX_VERTEX_ATTRIBS; ++currentValueIndex)
+ {
+ mCurrentValueCache.emplace_back(factory);
+ }
+}
+
+VertexDataManager::~VertexDataManager() {}
+
+angle::Result VertexDataManager::initialize(const gl::Context *context)
+{
+ return mStreamingBuffer.initialize(context, INITIAL_STREAM_BUFFER_SIZE);
+}
+
+void VertexDataManager::deinitialize()
+{
+ mStreamingBuffer.reset();
+ mCurrentValueCache.clear();
+}
+
+angle::Result VertexDataManager::prepareVertexData(
+ const gl::Context *context,
+ GLint start,
+ GLsizei count,
+ std::vector<TranslatedAttribute> *translatedAttribs,
+ GLsizei instances)
+{
+ const gl::State &state = context->getState();
+ const gl::VertexArray *vertexArray = state.getVertexArray();
+ const auto &vertexAttributes = vertexArray->getVertexAttributes();
+ const auto &vertexBindings = vertexArray->getVertexBindings();
+
+ mDynamicAttribsMaskCache.reset();
+ const gl::Program *program = state.getProgram();
+
+ translatedAttribs->clear();
+
+ for (size_t attribIndex = 0; attribIndex < vertexAttributes.size(); ++attribIndex)
+ {
+ // Skip attrib locations the program doesn't use.
+ if (!program->isAttribLocationActive(attribIndex))
+ continue;
+
+ const auto &attrib = vertexAttributes[attribIndex];
+ const auto &binding = vertexBindings[attrib.bindingIndex];
+
+ // Resize automatically puts in empty attribs
+ translatedAttribs->resize(attribIndex + 1);
+
+ TranslatedAttribute *translated = &(*translatedAttribs)[attribIndex];
+ auto currentValueData = state.getVertexAttribCurrentValue(attribIndex);
+
+ // Record the attribute now
+ translated->active = true;
+ translated->attribute = &attrib;
+ translated->binding = &binding;
+ translated->currentValueType = currentValueData.Type;
+ translated->divisor = binding.getDivisor();
+
+ switch (ClassifyAttributeStorage(context, attrib, binding))
+ {
+ case VertexStorageType::STATIC:
+ {
+ // Store static attribute.
+ ANGLE_TRY(StoreStaticAttrib(context, translated));
+ break;
+ }
+ case VertexStorageType::DYNAMIC:
+ // Dynamic attributes must be handled together.
+ mDynamicAttribsMaskCache.set(attribIndex);
+ break;
+ case VertexStorageType::DIRECT:
+ // Update translated data for direct attributes.
+ StoreDirectAttrib(context, translated);
+ break;
+ case VertexStorageType::CURRENT_VALUE:
+ {
+ ANGLE_TRY(storeCurrentValue(context, currentValueData, translated, attribIndex));
+ break;
+ }
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+
+ if (mDynamicAttribsMaskCache.none())
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRY(storeDynamicAttribs(context, translatedAttribs, mDynamicAttribsMaskCache, start,
+ count, instances));
+
+ PromoteDynamicAttribs(context, *translatedAttribs, mDynamicAttribsMaskCache, count);
+
+ return angle::Result::Continue;
+}
+
+// static
+void VertexDataManager::StoreDirectAttrib(const gl::Context *context,
+ TranslatedAttribute *directAttrib)
+{
+ ASSERT(directAttrib->attribute && directAttrib->binding);
+ const auto &attrib = *directAttrib->attribute;
+ const auto &binding = *directAttrib->binding;
+
+ gl::Buffer *buffer = binding.getBuffer().get();
+ ASSERT(buffer);
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
+
+ ASSERT(DirectStoragePossible(context, attrib, binding));
+ directAttrib->vertexBuffer.set(nullptr);
+ directAttrib->storage = bufferD3D;
+ directAttrib->serial = bufferD3D->getSerial();
+ directAttrib->stride = static_cast<unsigned int>(ComputeVertexAttributeStride(attrib, binding));
+ directAttrib->baseOffset =
+ static_cast<unsigned int>(ComputeVertexAttributeOffset(attrib, binding));
+
+ // Instanced vertices do not apply the 'start' offset
+ directAttrib->usesFirstVertexOffset = (binding.getDivisor() == 0);
+}
+
+// static
+angle::Result VertexDataManager::StoreStaticAttrib(const gl::Context *context,
+ TranslatedAttribute *translated)
+{
+ ASSERT(translated->attribute && translated->binding);
+ const auto &attrib = *translated->attribute;
+ const auto &binding = *translated->binding;
+
+ gl::Buffer *buffer = binding.getBuffer().get();
+ ASSERT(buffer && attrib.enabled && !DirectStoragePossible(context, attrib, binding));
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
+
+ // Compute source data pointer
+ const uint8_t *sourceData = nullptr;
+ const int offset = static_cast<int>(ComputeVertexAttributeOffset(attrib, binding));
+
+ ANGLE_TRY(bufferD3D->getData(context, &sourceData));
+
+ if (sourceData)
+ {
+ sourceData += offset;
+ }
+
+ unsigned int streamOffset = 0;
+
+ translated->storage = nullptr;
+ ANGLE_TRY(bufferD3D->getFactory()->getVertexSpaceRequired(context, attrib, binding, 1, 0,
+ &translated->stride));
+
+ auto *staticBuffer = bufferD3D->getStaticVertexBuffer(attrib, binding);
+ ASSERT(staticBuffer);
+
+ if (staticBuffer->empty())
+ {
+ // Convert the entire buffer
+ int totalCount =
+ ElementsInBuffer(attrib, binding, static_cast<unsigned int>(bufferD3D->getSize()));
+ int startIndex = offset / static_cast<int>(ComputeVertexAttributeStride(attrib, binding));
+
+ if (totalCount > 0)
+ {
+ ANGLE_TRY(staticBuffer->storeStaticAttribute(context, attrib, binding, -startIndex,
+ totalCount, 0, sourceData));
+ }
+ }
+
+ unsigned int firstElementOffset =
+ (static_cast<unsigned int>(offset) /
+ static_cast<unsigned int>(ComputeVertexAttributeStride(attrib, binding))) *
+ translated->stride;
+
+ VertexBuffer *vertexBuffer = staticBuffer->getVertexBuffer();
+
+ CheckedNumeric<unsigned int> checkedOffset(streamOffset);
+ checkedOffset += firstElementOffset;
+
+ ANGLE_CHECK_GL_MATH(GetImplAs<ContextD3D>(context), checkedOffset.IsValid());
+
+ translated->vertexBuffer.set(vertexBuffer);
+ translated->serial = vertexBuffer->getSerial();
+ translated->baseOffset = streamOffset + firstElementOffset;
+
+ // Instanced vertices do not apply the 'start' offset
+ translated->usesFirstVertexOffset = (binding.getDivisor() == 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result VertexDataManager::storeDynamicAttribs(
+ const gl::Context *context,
+ std::vector<TranslatedAttribute> *translatedAttribs,
+ const gl::AttributesMask &dynamicAttribsMask,
+ GLint start,
+ size_t count,
+ GLsizei instances)
+{
+ // Instantiating this class will ensure the streaming buffer is never left mapped.
+ class StreamingBufferUnmapper final : NonCopyable
+ {
+ public:
+ StreamingBufferUnmapper(StreamingVertexBufferInterface *streamingBuffer)
+ : mStreamingBuffer(streamingBuffer)
+ {
+ ASSERT(mStreamingBuffer);
+ }
+ ~StreamingBufferUnmapper() { mStreamingBuffer->getVertexBuffer()->hintUnmapResource(); }
+
+ private:
+ StreamingVertexBufferInterface *mStreamingBuffer;
+ };
+
+ // Will trigger unmapping on return.
+ StreamingBufferUnmapper localUnmapper(&mStreamingBuffer);
+
+ // Reserve the required space for the dynamic buffers.
+ for (auto attribIndex : dynamicAttribsMask)
+ {
+ const auto &dynamicAttrib = (*translatedAttribs)[attribIndex];
+ ANGLE_TRY(reserveSpaceForAttrib(context, dynamicAttrib, start, count, instances));
+ }
+
+ // Store dynamic attributes
+ for (auto attribIndex : dynamicAttribsMask)
+ {
+ auto *dynamicAttrib = &(*translatedAttribs)[attribIndex];
+ ANGLE_TRY(storeDynamicAttrib(context, dynamicAttrib, start, count, instances));
+ }
+
+ return angle::Result::Continue;
+}
+
+void VertexDataManager::PromoteDynamicAttribs(
+ const gl::Context *context,
+ const std::vector<TranslatedAttribute> &translatedAttribs,
+ const gl::AttributesMask &dynamicAttribsMask,
+ size_t count)
+{
+ for (auto attribIndex : dynamicAttribsMask)
+ {
+ const auto &dynamicAttrib = translatedAttribs[attribIndex];
+ ASSERT(dynamicAttrib.attribute && dynamicAttrib.binding);
+ const auto &binding = *dynamicAttrib.binding;
+
+ gl::Buffer *buffer = binding.getBuffer().get();
+ if (buffer)
+ {
+ // Note: this multiplication can overflow. It should not be a security problem.
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
+ size_t typeSize = ComputeVertexAttributeTypeSize(*dynamicAttrib.attribute);
+ bufferD3D->promoteStaticUsage(context, count * typeSize);
+ }
+ }
+}
+
+angle::Result VertexDataManager::reserveSpaceForAttrib(const gl::Context *context,
+ const TranslatedAttribute &translatedAttrib,
+ GLint start,
+ size_t count,
+ GLsizei instances)
+{
+ ASSERT(translatedAttrib.attribute && translatedAttrib.binding);
+ const auto &attrib = *translatedAttrib.attribute;
+ const auto &binding = *translatedAttrib.binding;
+
+ ASSERT(!DirectStoragePossible(context, attrib, binding));
+
+ gl::Buffer *buffer = binding.getBuffer().get();
+ BufferD3D *bufferD3D = buffer ? GetImplAs<BufferD3D>(buffer) : nullptr;
+ ASSERT(!bufferD3D || bufferD3D->getStaticVertexBuffer(attrib, binding) == nullptr);
+
+ size_t totalCount = gl::ComputeVertexBindingElementCount(binding.getDivisor(), count,
+ static_cast<size_t>(instances));
+ // TODO(jiajia.qin@intel.com): force the index buffer to clamp any out of range indices instead
+ // of invalid operation here.
+ if (bufferD3D)
+ {
+ // Vertices do not apply the 'start' offset when the divisor is non-zero even when doing
+ // a non-instanced draw call
+ GLint firstVertexIndex = binding.getDivisor() > 0 ? 0 : start;
+ int64_t maxVertexCount =
+ static_cast<int64_t>(firstVertexIndex) + static_cast<int64_t>(totalCount);
+
+ int64_t maxByte = GetMaxAttributeByteOffsetForDraw(attrib, binding, maxVertexCount);
+
+ ASSERT(bufferD3D->getSize() <= static_cast<size_t>(std::numeric_limits<int64_t>::max()));
+ ANGLE_CHECK(GetImplAs<ContextD3D>(context),
+ maxByte <= static_cast<int64_t>(bufferD3D->getSize()),
+ "Vertex buffer is not big enough for the draw call.", GL_INVALID_OPERATION);
+ }
+ return mStreamingBuffer.reserveVertexSpace(context, attrib, binding, totalCount, instances);
+}
+
+angle::Result VertexDataManager::storeDynamicAttrib(const gl::Context *context,
+ TranslatedAttribute *translated,
+ GLint start,
+ size_t count,
+ GLsizei instances)
+{
+ ASSERT(translated->attribute && translated->binding);
+ const auto &attrib = *translated->attribute;
+ const auto &binding = *translated->binding;
+
+ gl::Buffer *buffer = binding.getBuffer().get();
+ ASSERT(buffer || attrib.pointer);
+ ASSERT(attrib.enabled);
+
+ BufferD3D *storage = buffer ? GetImplAs<BufferD3D>(buffer) : nullptr;
+
+ // Instanced vertices do not apply the 'start' offset
+ GLint firstVertexIndex = (binding.getDivisor() > 0 ? 0 : start);
+
+ // Compute source data pointer
+ const uint8_t *sourceData = nullptr;
+
+ if (buffer)
+ {
+ ANGLE_TRY(storage->getData(context, &sourceData));
+ sourceData += static_cast<int>(ComputeVertexAttributeOffset(attrib, binding));
+ }
+ else
+ {
+ // Attributes using client memory ignore the VERTEX_ATTRIB_BINDING state.
+ // https://www.opengl.org/registry/specs/ARB/vertex_attrib_binding.txt
+ sourceData = static_cast<const uint8_t *>(attrib.pointer);
+ }
+
+ unsigned int streamOffset = 0;
+
+ translated->storage = nullptr;
+ ANGLE_TRY(
+ mFactory->getVertexSpaceRequired(context, attrib, binding, 1, 0, &translated->stride));
+
+ size_t totalCount = gl::ComputeVertexBindingElementCount(binding.getDivisor(), count,
+ static_cast<size_t>(instances));
+
+ ANGLE_TRY(mStreamingBuffer.storeDynamicAttribute(
+ context, attrib, binding, translated->currentValueType, firstVertexIndex,
+ static_cast<GLsizei>(totalCount), instances, &streamOffset, sourceData));
+
+ VertexBuffer *vertexBuffer = mStreamingBuffer.getVertexBuffer();
+
+ translated->vertexBuffer.set(vertexBuffer);
+ translated->serial = vertexBuffer->getSerial();
+ translated->baseOffset = streamOffset;
+ translated->usesFirstVertexOffset = false;
+
+ return angle::Result::Continue;
+}
+
+angle::Result VertexDataManager::storeCurrentValue(
+ const gl::Context *context,
+ const gl::VertexAttribCurrentValueData &currentValue,
+ TranslatedAttribute *translated,
+ size_t attribIndex)
+{
+ CurrentValueState *cachedState = &mCurrentValueCache[attribIndex];
+ StreamingVertexBufferInterface &buffer = *cachedState->buffer;
+
+ if (buffer.getBufferSize() == 0)
+ {
+ ANGLE_TRY(buffer.initialize(context, CONSTANT_VERTEX_BUFFER_SIZE));
+ }
+
+ if (cachedState->data != currentValue)
+ {
+ ASSERT(translated->attribute && translated->binding);
+ const auto &attrib = *translated->attribute;
+ const auto &binding = *translated->binding;
+
+ ANGLE_TRY(buffer.reserveVertexSpace(context, attrib, binding, 1, 0));
+
+ const uint8_t *sourceData =
+ reinterpret_cast<const uint8_t *>(currentValue.Values.FloatValues);
+ unsigned int streamOffset;
+ ANGLE_TRY(buffer.storeDynamicAttribute(context, attrib, binding, currentValue.Type, 0, 1, 0,
+ &streamOffset, sourceData));
+
+ buffer.getVertexBuffer()->hintUnmapResource();
+
+ cachedState->data = currentValue;
+ cachedState->offset = streamOffset;
+ }
+
+ translated->vertexBuffer.set(buffer.getVertexBuffer());
+
+ translated->storage = nullptr;
+ translated->serial = buffer.getSerial();
+ translated->divisor = 0;
+ translated->stride = 0;
+ translated->baseOffset = static_cast<unsigned int>(cachedState->offset);
+ translated->usesFirstVertexOffset = false;
+
+ return angle::Result::Continue;
+}
+
+// VertexBufferBinding implementation
+VertexBufferBinding::VertexBufferBinding() : mBoundVertexBuffer(nullptr) {}
+
+VertexBufferBinding::VertexBufferBinding(const VertexBufferBinding &other)
+ : mBoundVertexBuffer(other.mBoundVertexBuffer)
+{
+ if (mBoundVertexBuffer)
+ {
+ mBoundVertexBuffer->addRef();
+ }
+}
+
+VertexBufferBinding::~VertexBufferBinding()
+{
+ if (mBoundVertexBuffer)
+ {
+ mBoundVertexBuffer->release();
+ }
+}
+
+VertexBufferBinding &VertexBufferBinding::operator=(const VertexBufferBinding &other)
+{
+ mBoundVertexBuffer = other.mBoundVertexBuffer;
+ if (mBoundVertexBuffer)
+ {
+ mBoundVertexBuffer->addRef();
+ }
+ return *this;
+}
+
+void VertexBufferBinding::set(VertexBuffer *vertexBuffer)
+{
+ if (mBoundVertexBuffer == vertexBuffer)
+ return;
+
+ if (mBoundVertexBuffer)
+ {
+ mBoundVertexBuffer->release();
+ }
+ if (vertexBuffer)
+ {
+ vertexBuffer->addRef();
+ }
+
+ mBoundVertexBuffer = vertexBuffer;
+}
+
+VertexBuffer *VertexBufferBinding::get() const
+{
+ return mBoundVertexBuffer;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h
new file mode 100644
index 0000000000..faa5bdbc24
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h
@@ -0,0 +1,160 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexDataManager.h: Defines the VertexDataManager, a class that
+// runs the Buffer translation process.
+
+#ifndef LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
+#define LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/VertexBuffer.h"
+
+namespace gl
+{
+class State;
+struct VertexAttribute;
+class VertexBinding;
+struct VertexAttribCurrentValueData;
+} // namespace gl
+
+namespace rx
+{
+class BufferD3D;
+class BufferFactoryD3D;
+class StreamingVertexBufferInterface;
+class VertexBuffer;
+
+class VertexBufferBinding final
+{
+ public:
+ VertexBufferBinding();
+ VertexBufferBinding(const VertexBufferBinding &other);
+ ~VertexBufferBinding();
+
+ void set(VertexBuffer *vertexBuffer);
+ VertexBuffer *get() const;
+ VertexBufferBinding &operator=(const VertexBufferBinding &other);
+
+ private:
+ VertexBuffer *mBoundVertexBuffer;
+};
+
+struct TranslatedAttribute
+{
+ TranslatedAttribute();
+ TranslatedAttribute(const TranslatedAttribute &other);
+
+ // Computes the correct offset from baseOffset, usesFirstVertexOffset, stride and startVertex.
+ // Can throw an error on integer overflow.
+ angle::Result computeOffset(const gl::Context *context,
+ GLint startVertex,
+ unsigned int *offsetOut) const;
+
+ bool active;
+
+ const gl::VertexAttribute *attribute;
+ const gl::VertexBinding *binding;
+ gl::VertexAttribType currentValueType;
+ unsigned int baseOffset;
+ bool usesFirstVertexOffset;
+ unsigned int stride; // 0 means not to advance the read pointer at all
+
+ VertexBufferBinding vertexBuffer;
+ BufferD3D *storage;
+ unsigned int serial;
+ unsigned int divisor;
+};
+
+enum class VertexStorageType
+{
+ UNKNOWN,
+ STATIC, // Translate the vertex data once and re-use it.
+ DYNAMIC, // Translate the data every frame into a ring buffer.
+ DIRECT, // Bind a D3D buffer directly without any translation.
+ CURRENT_VALUE, // Use a single value for the attribute.
+};
+
+// Given a vertex attribute, return the type of storage it will use.
+VertexStorageType ClassifyAttributeStorage(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding);
+
+class VertexDataManager : angle::NonCopyable
+{
+ public:
+ VertexDataManager(BufferFactoryD3D *factory);
+ virtual ~VertexDataManager();
+
+ angle::Result initialize(const gl::Context *context);
+ void deinitialize();
+
+ angle::Result prepareVertexData(const gl::Context *context,
+ GLint start,
+ GLsizei count,
+ std::vector<TranslatedAttribute> *translatedAttribs,
+ GLsizei instances);
+
+ static void StoreDirectAttrib(const gl::Context *context, TranslatedAttribute *directAttrib);
+
+ static angle::Result StoreStaticAttrib(const gl::Context *context,
+ TranslatedAttribute *translated);
+
+ angle::Result storeDynamicAttribs(const gl::Context *context,
+ std::vector<TranslatedAttribute> *translatedAttribs,
+ const gl::AttributesMask &dynamicAttribsMask,
+ GLint start,
+ size_t count,
+ GLsizei instances);
+
+ // Promote static usage of dynamic buffers.
+ static void PromoteDynamicAttribs(const gl::Context *context,
+ const std::vector<TranslatedAttribute> &translatedAttribs,
+ const gl::AttributesMask &dynamicAttribsMask,
+ size_t count);
+
+ angle::Result storeCurrentValue(const gl::Context *context,
+ const gl::VertexAttribCurrentValueData &currentValue,
+ TranslatedAttribute *translated,
+ size_t attribIndex);
+
+ private:
+ struct CurrentValueState final : angle::NonCopyable
+ {
+ CurrentValueState(BufferFactoryD3D *factory);
+ CurrentValueState(CurrentValueState &&other);
+ ~CurrentValueState();
+
+ std::unique_ptr<StreamingVertexBufferInterface> buffer;
+ gl::VertexAttribCurrentValueData data;
+ size_t offset;
+ };
+
+ angle::Result reserveSpaceForAttrib(const gl::Context *context,
+ const TranslatedAttribute &translatedAttrib,
+ GLint start,
+ size_t count,
+ GLsizei instances);
+
+ angle::Result storeDynamicAttrib(const gl::Context *context,
+ TranslatedAttribute *translated,
+ GLint start,
+ size_t count,
+ GLsizei instances);
+
+ BufferFactoryD3D *const mFactory;
+
+ StreamingVertexBufferInterface mStreamingBuffer;
+ std::vector<CurrentValueState> mCurrentValueCache;
+ gl::AttributesMask mDynamicAttribsMaskCache;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
new file mode 100644
index 0000000000..6878ce8f91
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
@@ -0,0 +1,1944 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit11.cpp: Texture copy utility class.
+
+#include "libANGLE/renderer/d3d/d3d11/Blit11.h"
+
+#include <float.h>
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+#include "libANGLE/trace.h"
+
+namespace rx
+{
+
+namespace
+{
+
+// Include inline shaders in the anonymous namespace to make sure no symbols are exported
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h"
+
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h"
+
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepth11_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_vs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvestencil11_ps.h"
+
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h"
+
+void StretchedBlitNearest_RowByRow(const gl::Box &sourceArea,
+ const gl::Box &destArea,
+ const gl::Rectangle &clippedDestArea,
+ const gl::Extents &sourceSize,
+ unsigned int sourceRowPitch,
+ unsigned int destRowPitch,
+ size_t pixelSize,
+ const uint8_t *sourceData,
+ uint8_t *destData)
+{
+ int srcHeightSubOne = (sourceArea.height - 1);
+ size_t copySize = pixelSize * destArea.width;
+ size_t srcOffset = sourceArea.x * pixelSize;
+ size_t destOffset = destArea.x * pixelSize;
+
+ for (int y = clippedDestArea.y; y < clippedDestArea.y + clippedDestArea.height; y++)
+ {
+ float yPerc = static_cast<float>(y - destArea.y) / (destArea.height - 1);
+
+ // Interpolate using the original source rectangle to determine which row to sample from
+ // while clamping to the edges
+ unsigned int readRow = static_cast<unsigned int>(
+ gl::clamp(sourceArea.y + floor(yPerc * srcHeightSubOne + 0.5f), 0, srcHeightSubOne));
+ unsigned int writeRow = y;
+
+ const uint8_t *sourceRow = sourceData + readRow * sourceRowPitch + srcOffset;
+ uint8_t *destRow = destData + writeRow * destRowPitch + destOffset;
+ memcpy(destRow, sourceRow, copySize);
+ }
+}
+
+void StretchedBlitNearest_PixelByPixel(const gl::Box &sourceArea,
+ const gl::Box &destArea,
+ const gl::Rectangle &clippedDestArea,
+ const gl::Extents &sourceSize,
+ unsigned int sourceRowPitch,
+ unsigned int destRowPitch,
+ ptrdiff_t readOffset,
+ ptrdiff_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ const uint8_t *sourceData,
+ uint8_t *destData)
+{
+ auto xMax = clippedDestArea.x + clippedDestArea.width;
+ auto yMax = clippedDestArea.y + clippedDestArea.height;
+
+ for (int writeRow = clippedDestArea.y; writeRow < yMax; writeRow++)
+ {
+ // Interpolate using the original source rectangle to determine which row to sample from
+ // while clamping to the edges
+ float yPerc = static_cast<float>(writeRow - destArea.y) / (destArea.height - 1);
+ float yRounded = floor(yPerc * (sourceArea.height - 1) + 0.5f);
+ unsigned int readRow =
+ static_cast<unsigned int>(gl::clamp(sourceArea.y + yRounded, 0, sourceSize.height - 1));
+
+ for (int writeColumn = clippedDestArea.x; writeColumn < xMax; writeColumn++)
+ {
+ // Interpolate the original source rectangle to determine which column to sample
+ // from while clamping to the edges
+ float xPerc = static_cast<float>(writeColumn - destArea.x) / (destArea.width - 1);
+ float xRounded = floor(xPerc * (sourceArea.width - 1) + 0.5f);
+ unsigned int readColumn = static_cast<unsigned int>(
+ gl::clamp(sourceArea.x + xRounded, 0, sourceSize.height - 1));
+
+ const uint8_t *sourcePixel =
+ sourceData + readRow * sourceRowPitch + readColumn * srcPixelStride + readOffset;
+
+ uint8_t *destPixel =
+ destData + writeRow * destRowPitch + writeColumn * destPixelStride + writeOffset;
+
+ memcpy(destPixel, sourcePixel, copySize);
+ }
+ }
+}
+
+void StretchedBlitNearest(const gl::Box &sourceArea,
+ const gl::Box &destArea,
+ const gl::Rectangle &clipRect,
+ const gl::Extents &sourceSize,
+ unsigned int sourceRowPitch,
+ unsigned int destRowPitch,
+ ptrdiff_t readOffset,
+ ptrdiff_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ const uint8_t *sourceData,
+ uint8_t *destData)
+{
+ gl::Rectangle clippedDestArea(destArea.x, destArea.y, destArea.width, destArea.height);
+ gl::ClipRectangle(clippedDestArea, clipRect, &clippedDestArea);
+
+ // Determine if entire rows can be copied at once instead of each individual pixel. There
+ // must be no out of bounds lookups, whole rows copies, and no scale.
+ if (sourceArea.width == clippedDestArea.width && sourceArea.x >= 0 &&
+ sourceArea.x + sourceArea.width <= sourceSize.width && copySize == srcPixelStride &&
+ copySize == destPixelStride)
+ {
+ StretchedBlitNearest_RowByRow(sourceArea, destArea, clippedDestArea, sourceSize,
+ sourceRowPitch, destRowPitch, srcPixelStride, sourceData,
+ destData);
+ }
+ else
+ {
+ StretchedBlitNearest_PixelByPixel(sourceArea, destArea, clippedDestArea, sourceSize,
+ sourceRowPitch, destRowPitch, readOffset, writeOffset,
+ copySize, srcPixelStride, destPixelStride, sourceData,
+ destData);
+ }
+}
+
+using DepthStencilLoader = void(const float *, uint8_t *);
+
+void LoadDepth16(const float *source, uint8_t *dest)
+{
+ uint32_t convertedDepth = gl::floatToNormalized<16, uint32_t>(source[0]);
+ memcpy(dest, &convertedDepth, 2u);
+}
+
+void LoadDepth24(const float *source, uint8_t *dest)
+{
+ uint32_t convertedDepth = gl::floatToNormalized<24, uint32_t>(source[0]);
+ memcpy(dest, &convertedDepth, 3u);
+}
+
+void LoadStencilHelper(const float *source, uint8_t *dest)
+{
+ uint32_t convertedStencil = gl::getShiftedData<8, 0>(static_cast<uint32_t>(source[1]));
+ memcpy(dest, &convertedStencil, 1u);
+}
+
+void LoadStencil8(const float *source, uint8_t *dest)
+{
+ // STENCIL_INDEX8 is implemented with D24S8, with the depth bits unused. Writes zero for safety.
+ float zero = 0.0f;
+ LoadDepth24(&zero, &dest[0]);
+ LoadStencilHelper(source, &dest[3]);
+}
+
+void LoadDepth24Stencil8(const float *source, uint8_t *dest)
+{
+ LoadDepth24(source, &dest[0]);
+ LoadStencilHelper(source, &dest[3]);
+}
+
+void LoadDepth32F(const float *source, uint8_t *dest)
+{
+ memcpy(dest, source, sizeof(float));
+}
+
+void LoadDepth32FStencil8(const float *source, uint8_t *dest)
+{
+ LoadDepth32F(source, &dest[0]);
+ LoadStencilHelper(source, &dest[4]);
+}
+
+template <DepthStencilLoader loader>
+void CopyDepthStencil(const gl::Box &sourceArea,
+ const gl::Box &destArea,
+ const gl::Rectangle &clippedDestArea,
+ const gl::Extents &sourceSize,
+ unsigned int sourceRowPitch,
+ unsigned int destRowPitch,
+ ptrdiff_t readOffset,
+ ptrdiff_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ const uint8_t *sourceData,
+ uint8_t *destData)
+{
+ // No stretching or subregions are supported, only full blits.
+ ASSERT(sourceArea == destArea);
+ ASSERT(sourceSize.width == sourceArea.width && sourceSize.height == sourceArea.height &&
+ sourceSize.depth == 1);
+ ASSERT(clippedDestArea.width == sourceSize.width &&
+ clippedDestArea.height == sourceSize.height);
+ ASSERT(readOffset == 0 && writeOffset == 0);
+ ASSERT(destArea.x == 0 && destArea.y == 0);
+
+ for (int row = 0; row < destArea.height; ++row)
+ {
+ for (int column = 0; column < destArea.width; ++column)
+ {
+ ptrdiff_t offset = row * sourceRowPitch + column * srcPixelStride;
+ const float *sourcePixel = reinterpret_cast<const float *>(sourceData + offset);
+
+ uint8_t *destPixel = destData + row * destRowPitch + column * destPixelStride;
+
+ loader(sourcePixel, destPixel);
+ }
+ }
+}
+
+void Depth32FStencil8ToDepth32F(const float *source, float *dest)
+{
+ *dest = *source;
+}
+
+void Depth24Stencil8ToDepth32F(const uint32_t *source, float *dest)
+{
+ uint32_t normDepth = source[0] & 0x00FFFFFF;
+ float floatDepth = gl::normalizedToFloat<24>(normDepth);
+ *dest = floatDepth;
+}
+
+void BlitD24S8ToD32F(const gl::Box &sourceArea,
+ const gl::Box &destArea,
+ const gl::Rectangle &clippedDestArea,
+ const gl::Extents &sourceSize,
+ unsigned int sourceRowPitch,
+ unsigned int destRowPitch,
+ ptrdiff_t readOffset,
+ ptrdiff_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ const uint8_t *sourceData,
+ uint8_t *destData)
+{
+ // No stretching or subregions are supported, only full blits.
+ ASSERT(sourceArea == destArea);
+ ASSERT(sourceSize.width == sourceArea.width && sourceSize.height == sourceArea.height &&
+ sourceSize.depth == 1);
+ ASSERT(clippedDestArea.width == sourceSize.width &&
+ clippedDestArea.height == sourceSize.height);
+ ASSERT(readOffset == 0 && writeOffset == 0);
+ ASSERT(destArea.x == 0 && destArea.y == 0);
+
+ for (int row = 0; row < destArea.height; ++row)
+ {
+ for (int column = 0; column < destArea.width; ++column)
+ {
+ ptrdiff_t offset = row * sourceRowPitch + column * srcPixelStride;
+ const uint32_t *sourcePixel = reinterpret_cast<const uint32_t *>(sourceData + offset);
+
+ float *destPixel =
+ reinterpret_cast<float *>(destData + row * destRowPitch + column * destPixelStride);
+
+ Depth24Stencil8ToDepth32F(sourcePixel, destPixel);
+ }
+ }
+}
+
+void BlitD32FS8ToD32F(const gl::Box &sourceArea,
+ const gl::Box &destArea,
+ const gl::Rectangle &clippedDestArea,
+ const gl::Extents &sourceSize,
+ unsigned int sourceRowPitch,
+ unsigned int destRowPitch,
+ ptrdiff_t readOffset,
+ ptrdiff_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ const uint8_t *sourceData,
+ uint8_t *destData)
+{
+ // No stretching or subregions are supported, only full blits.
+ ASSERT(sourceArea == destArea);
+ ASSERT(sourceSize.width == sourceArea.width && sourceSize.height == sourceArea.height &&
+ sourceSize.depth == 1);
+ ASSERT(clippedDestArea.width == sourceSize.width &&
+ clippedDestArea.height == sourceSize.height);
+ ASSERT(readOffset == 0 && writeOffset == 0);
+ ASSERT(destArea.x == 0 && destArea.y == 0);
+
+ for (int row = 0; row < destArea.height; ++row)
+ {
+ for (int column = 0; column < destArea.width; ++column)
+ {
+ ptrdiff_t offset = row * sourceRowPitch + column * srcPixelStride;
+ const float *sourcePixel = reinterpret_cast<const float *>(sourceData + offset);
+ float *destPixel =
+ reinterpret_cast<float *>(destData + row * destRowPitch + column * destPixelStride);
+
+ Depth32FStencil8ToDepth32F(sourcePixel, destPixel);
+ }
+ }
+}
+
+Blit11::BlitConvertFunction *GetCopyDepthStencilFunction(GLenum internalFormat)
+{
+ switch (internalFormat)
+ {
+ case GL_DEPTH_COMPONENT16:
+ return &CopyDepthStencil<LoadDepth16>;
+ case GL_DEPTH_COMPONENT24:
+ return &CopyDepthStencil<LoadDepth24>;
+ case GL_DEPTH_COMPONENT32F:
+ return &CopyDepthStencil<LoadDepth32F>;
+ case GL_STENCIL_INDEX8:
+ return &CopyDepthStencil<LoadStencil8>;
+ case GL_DEPTH24_STENCIL8:
+ return &CopyDepthStencil<LoadDepth24Stencil8>;
+ case GL_DEPTH32F_STENCIL8:
+ return &CopyDepthStencil<LoadDepth32FStencil8>;
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+inline void GenerateVertexCoords(const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ float *x1,
+ float *y1,
+ float *x2,
+ float *y2,
+ float *u1,
+ float *v1,
+ float *u2,
+ float *v2)
+{
+ *x1 = (destArea.x / float(destSize.width)) * 2.0f - 1.0f;
+ *y1 = ((destSize.height - destArea.y - destArea.height) / float(destSize.height)) * 2.0f - 1.0f;
+ *x2 = ((destArea.x + destArea.width) / float(destSize.width)) * 2.0f - 1.0f;
+ *y2 = ((destSize.height - destArea.y) / float(destSize.height)) * 2.0f - 1.0f;
+
+ *u1 = sourceArea.x / float(sourceSize.width);
+ *v1 = sourceArea.y / float(sourceSize.height);
+ *u2 = (sourceArea.x + sourceArea.width) / float(sourceSize.width);
+ *v2 = (sourceArea.y + sourceArea.height) / float(sourceSize.height);
+}
+
+void Write2DVertices(const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ void *outVertices,
+ unsigned int *outStride,
+ unsigned int *outVertexCount,
+ D3D11_PRIMITIVE_TOPOLOGY *outTopology)
+{
+ float x1, y1, x2, y2, u1, v1, u2, v2;
+ GenerateVertexCoords(sourceArea, sourceSize, destArea, destSize, &x1, &y1, &x2, &y2, &u1, &v1,
+ &u2, &v2);
+
+ d3d11::PositionTexCoordVertex *vertices =
+ static_cast<d3d11::PositionTexCoordVertex *>(outVertices);
+
+ 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);
+
+ *outStride = sizeof(d3d11::PositionTexCoordVertex);
+ *outVertexCount = 4;
+ *outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
+}
+
+void Write3DVertices(const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ void *outVertices,
+ unsigned int *outStride,
+ unsigned int *outVertexCount,
+ D3D11_PRIMITIVE_TOPOLOGY *outTopology)
+{
+ ASSERT(sourceSize.depth > 0 && destSize.depth > 0);
+
+ float x1, y1, x2, y2, u1, v1, u2, v2;
+ GenerateVertexCoords(sourceArea, sourceSize, destArea, destSize, &x1, &y1, &x2, &y2, &u1, &v1,
+ &u2, &v2);
+
+ d3d11::PositionLayerTexCoord3DVertex *vertices =
+ static_cast<d3d11::PositionLayerTexCoord3DVertex *>(outVertices);
+
+ for (int i = 0; i < destSize.depth; i++)
+ {
+ float readDepth = (float)i / std::max(destSize.depth - 1, 1);
+
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 0], x1, y1, i, u1, v2, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 1], x1, y2, i, u1, v1, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 2], x2, y1, i, u2, v2, readDepth);
+
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 3], x1, y2, i, u1, v1, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 4], x2, y2, i, u2, v1, readDepth);
+ d3d11::SetPositionLayerTexCoord3DVertex(&vertices[i * 6 + 5], x2, y1, i, u2, v2, readDepth);
+ }
+
+ *outStride = sizeof(d3d11::PositionLayerTexCoord3DVertex);
+ *outVertexCount = destSize.depth * 6;
+ *outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+}
+
+unsigned int GetSwizzleIndex(GLenum swizzle)
+{
+ unsigned int colorIndex = 0;
+
+ switch (swizzle)
+ {
+ case GL_RED:
+ colorIndex = 0;
+ break;
+ case GL_GREEN:
+ colorIndex = 1;
+ break;
+ case GL_BLUE:
+ colorIndex = 2;
+ break;
+ case GL_ALPHA:
+ colorIndex = 3;
+ break;
+ case GL_ZERO:
+ colorIndex = 4;
+ break;
+ case GL_ONE:
+ colorIndex = 5;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return colorIndex;
+}
+
+D3D11_BLEND_DESC GetAlphaMaskBlendStateDesc()
+{
+ D3D11_BLEND_DESC desc;
+ memset(&desc, 0, sizeof(desc));
+ desc.RenderTarget[0].BlendEnable = TRUE;
+ desc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
+ desc.RenderTarget[0].DestBlend = D3D11_BLEND_ZERO;
+ desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
+ desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO;
+ desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
+ desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
+ desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_RED |
+ D3D11_COLOR_WRITE_ENABLE_GREEN |
+ D3D11_COLOR_WRITE_ENABLE_BLUE;
+ return desc;
+}
+
+D3D11_INPUT_ELEMENT_DESC quad2DLayout[] = {
+ {"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},
+};
+
+D3D11_INPUT_ELEMENT_DESC quad3DLayout[] = {
+ {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+ {"LAYER", 0, DXGI_FORMAT_R32_UINT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0},
+ {"TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
+};
+
+DXGI_FORMAT GetStencilSRVFormat(const d3d11::Format &formatSet)
+{
+ switch (formatSet.texFormat)
+ {
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ return DXGI_FORMAT_X32_TYPELESS_G8X24_UINT;
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ return DXGI_FORMAT_X24_TYPELESS_G8_UINT;
+ default:
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+} // namespace
+
+#include "libANGLE/renderer/d3d/d3d11/Blit11Helper_autogen.inc"
+
+Blit11::Shader::Shader() = default;
+
+Blit11::Shader::Shader(Shader &&other) = default;
+
+Blit11::Shader::~Shader() = default;
+
+Blit11::Shader &Blit11::Shader::operator=(Blit11::Shader &&other) = default;
+
+Blit11::Blit11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mResourcesInitialized(false),
+ mVertexBuffer(),
+ mPointSampler(),
+ mLinearSampler(),
+ mScissorEnabledRasterizerState(),
+ mScissorDisabledRasterizerState(),
+ mDepthStencilState(),
+ mQuad2DIL(quad2DLayout,
+ ArraySize(quad2DLayout),
+ g_VS_Passthrough2D,
+ ArraySize(g_VS_Passthrough2D),
+ "Blit11 2D input layout"),
+ mQuad2DVS(g_VS_Passthrough2D, ArraySize(g_VS_Passthrough2D), "Blit11 2D vertex shader"),
+ mDepthPS(g_PS_PassthroughDepth2D,
+ ArraySize(g_PS_PassthroughDepth2D),
+ "Blit11 2D depth pixel shader"),
+ mQuad3DIL(quad3DLayout,
+ ArraySize(quad3DLayout),
+ g_VS_Passthrough3D,
+ ArraySize(g_VS_Passthrough3D),
+ "Blit11 3D input layout"),
+ mQuad3DVS(g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), "Blit11 3D vertex shader"),
+ mQuad3DGS(g_GS_Passthrough3D, ArraySize(g_GS_Passthrough3D), "Blit11 3D geometry shader"),
+ mAlphaMaskBlendState(GetAlphaMaskBlendStateDesc(), "Blit11 Alpha Mask Blend"),
+ mSwizzleCB(),
+ mResolveDepthStencilVS(g_VS_ResolveDepthStencil,
+ ArraySize(g_VS_ResolveDepthStencil),
+ "Blit11::mResolveDepthStencilVS"),
+ mResolveDepthPS(g_PS_ResolveDepth, ArraySize(g_PS_ResolveDepth), "Blit11::mResolveDepthPS"),
+ mResolveDepthStencilPS(g_PS_ResolveDepthStencil,
+ ArraySize(g_PS_ResolveDepthStencil),
+ "Blit11::mResolveDepthStencilPS"),
+ mResolveStencilPS(g_PS_ResolveStencil,
+ ArraySize(g_PS_ResolveStencil),
+ "Blit11::mResolveStencilPS"),
+ mStencilSRV(),
+ mResolvedDepthStencilRTView()
+{}
+
+Blit11::~Blit11() {}
+
+angle::Result Blit11::initResources(const gl::Context *context)
+{
+ if (mResourcesInitialized)
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRACE_EVENT0("gpu.angle", "Blit11::initResources");
+
+ D3D11_BUFFER_DESC vbDesc;
+ vbDesc.ByteWidth =
+ static_cast<unsigned int>(std::max(sizeof(d3d11::PositionLayerTexCoord3DVertex),
+ sizeof(d3d11::PositionTexCoordVertex)) *
+ 6 * mRenderer->getNativeCaps().max3DTextureSize);
+ vbDesc.Usage = D3D11_USAGE_DYNAMIC;
+ vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ vbDesc.MiscFlags = 0;
+ vbDesc.StructureByteStride = 0;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, vbDesc, &mVertexBuffer));
+ mVertexBuffer.setDebugName("Blit11 vertex buffer");
+
+ D3D11_SAMPLER_DESC pointSamplerDesc;
+ pointSamplerDesc.Filter = D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR;
+ pointSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+ pointSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+ pointSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+ pointSamplerDesc.MipLODBias = 0.0f;
+ pointSamplerDesc.MaxAnisotropy = 0;
+ pointSamplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+ pointSamplerDesc.BorderColor[0] = 0.0f;
+ pointSamplerDesc.BorderColor[1] = 0.0f;
+ pointSamplerDesc.BorderColor[2] = 0.0f;
+ pointSamplerDesc.BorderColor[3] = 0.0f;
+ pointSamplerDesc.MinLOD = 0.0f;
+ pointSamplerDesc.MaxLOD = FLT_MAX;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, pointSamplerDesc, &mPointSampler));
+ mPointSampler.setDebugName("Blit11 point sampler");
+
+ D3D11_SAMPLER_DESC linearSamplerDesc;
+ linearSamplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
+ linearSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+ linearSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+ linearSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+ linearSamplerDesc.MipLODBias = 0.0f;
+ linearSamplerDesc.MaxAnisotropy = 0;
+ linearSamplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+ linearSamplerDesc.BorderColor[0] = 0.0f;
+ linearSamplerDesc.BorderColor[1] = 0.0f;
+ linearSamplerDesc.BorderColor[2] = 0.0f;
+ linearSamplerDesc.BorderColor[3] = 0.0f;
+ linearSamplerDesc.MinLOD = 0.0f;
+ linearSamplerDesc.MaxLOD = FLT_MAX;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, linearSamplerDesc, &mLinearSampler));
+ mLinearSampler.setDebugName("Blit11 linear sampler");
+
+ // Use a rasterizer state that will not cull so that inverted quads will not be culled
+ D3D11_RASTERIZER_DESC rasterDesc;
+ rasterDesc.FillMode = D3D11_FILL_SOLID;
+ rasterDesc.CullMode = D3D11_CULL_NONE;
+ rasterDesc.FrontCounterClockwise = FALSE;
+ rasterDesc.DepthBias = 0;
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
+ rasterDesc.DepthBiasClamp = 0.0f;
+ rasterDesc.DepthClipEnable = TRUE;
+ rasterDesc.MultisampleEnable = FALSE;
+ rasterDesc.AntialiasedLineEnable = FALSE;
+
+ rasterDesc.ScissorEnable = TRUE;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rasterDesc, &mScissorEnabledRasterizerState));
+ mScissorEnabledRasterizerState.setDebugName("Blit11 scissoring rasterizer state");
+
+ rasterDesc.ScissorEnable = FALSE;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rasterDesc, &mScissorDisabledRasterizerState));
+ mScissorDisabledRasterizerState.setDebugName("Blit11 no scissoring rasterizer state");
+
+ D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
+ depthStencilDesc.DepthEnable = TRUE;
+ depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ depthStencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.StencilEnable = FALSE;
+ depthStencilDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+ depthStencilDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+ depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, depthStencilDesc, &mDepthStencilState));
+ mDepthStencilState.setDebugName("Blit11 depth stencil state");
+
+ D3D11_BUFFER_DESC swizzleBufferDesc;
+ swizzleBufferDesc.ByteWidth = sizeof(unsigned int) * 4;
+ swizzleBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ swizzleBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ swizzleBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ swizzleBufferDesc.MiscFlags = 0;
+ swizzleBufferDesc.StructureByteStride = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, swizzleBufferDesc, &mSwizzleCB));
+ mSwizzleCB.setDebugName("Blit11 swizzle constant buffer");
+
+ mResourcesInitialized = true;
+
+ return angle::Result::Continue;
+}
+
+// static
+Blit11::SwizzleShaderType Blit11::GetSwizzleShaderType(GLenum type,
+ D3D11_SRV_DIMENSION dimensionality)
+{
+ switch (dimensionality)
+ {
+ case D3D11_SRV_DIMENSION_TEXTURE2D:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return SWIZZLESHADER_2D_FLOAT;
+ case GL_UNSIGNED_INT:
+ return SWIZZLESHADER_2D_UINT;
+ case GL_INT:
+ return SWIZZLESHADER_2D_INT;
+ default:
+ UNREACHABLE();
+ return SWIZZLESHADER_INVALID;
+ }
+ case D3D11_SRV_DIMENSION_TEXTURECUBE:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return SWIZZLESHADER_CUBE_FLOAT;
+ case GL_UNSIGNED_INT:
+ return SWIZZLESHADER_CUBE_UINT;
+ case GL_INT:
+ return SWIZZLESHADER_CUBE_INT;
+ default:
+ UNREACHABLE();
+ return SWIZZLESHADER_INVALID;
+ }
+ case D3D11_SRV_DIMENSION_TEXTURE3D:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return SWIZZLESHADER_3D_FLOAT;
+ case GL_UNSIGNED_INT:
+ return SWIZZLESHADER_3D_UINT;
+ case GL_INT:
+ return SWIZZLESHADER_3D_INT;
+ default:
+ UNREACHABLE();
+ return SWIZZLESHADER_INVALID;
+ }
+ case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
+ switch (type)
+ {
+ case GL_FLOAT:
+ return SWIZZLESHADER_ARRAY_FLOAT;
+ case GL_UNSIGNED_INT:
+ return SWIZZLESHADER_ARRAY_UINT;
+ case GL_INT:
+ return SWIZZLESHADER_ARRAY_INT;
+ default:
+ UNREACHABLE();
+ return SWIZZLESHADER_INVALID;
+ }
+ default:
+ UNREACHABLE();
+ return SWIZZLESHADER_INVALID;
+ }
+}
+
+angle::Result Blit11::getShaderSupport(const gl::Context *context,
+ const Shader &shader,
+ Blit11::ShaderSupport *supportOut)
+{
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ switch (shader.dimension)
+ {
+ case SHADER_2D:
+ {
+ ANGLE_TRY(mQuad2DIL.resolve(context11, mRenderer));
+ ANGLE_TRY(mQuad2DVS.resolve(context11, mRenderer));
+ supportOut->inputLayout = &mQuad2DIL.getObj();
+ supportOut->vertexShader = &mQuad2DVS.getObj();
+ supportOut->geometryShader = nullptr;
+ supportOut->vertexWriteFunction = Write2DVertices;
+ break;
+ }
+ case SHADER_3D:
+ case SHADER_2DARRAY:
+ {
+ ANGLE_TRY(mQuad3DIL.resolve(context11, mRenderer));
+ ANGLE_TRY(mQuad3DVS.resolve(context11, mRenderer));
+ ANGLE_TRY(mQuad3DGS.resolve(context11, mRenderer));
+ supportOut->inputLayout = &mQuad3DIL.getObj();
+ supportOut->vertexShader = &mQuad3DVS.getObj();
+ supportOut->geometryShader = &mQuad3DGS.getObj();
+ supportOut->vertexWriteFunction = Write3DVertices;
+ break;
+ }
+ default:
+ UNREACHABLE();
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::swizzleTexture(const gl::Context *context,
+ const d3d11::SharedSRV &source,
+ const d3d11::RenderTargetView &dest,
+ const gl::Extents &size,
+ const gl::SwizzleState &swizzleTarget)
+{
+ ANGLE_TRY(initResources(context));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
+ source.get()->GetDesc(&sourceSRVDesc);
+
+ GLenum componentType = d3d11::GetComponentType(sourceSRVDesc.Format);
+ if (componentType == GL_NONE)
+ {
+ // We're swizzling the depth component of a depth-stencil texture.
+ switch (sourceSRVDesc.Format)
+ {
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ componentType = GL_UNSIGNED_NORMALIZED;
+ break;
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ componentType = GL_FLOAT;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+
+ GLenum shaderType = GL_NONE;
+ switch (componentType)
+ {
+ case GL_UNSIGNED_NORMALIZED:
+ case GL_SIGNED_NORMALIZED:
+ case GL_FLOAT:
+ shaderType = GL_FLOAT;
+ break;
+ case GL_INT:
+ shaderType = GL_INT;
+ break;
+ case GL_UNSIGNED_INT:
+ shaderType = GL_UNSIGNED_INT;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ const Shader *shader = nullptr;
+ ANGLE_TRY(getSwizzleShader(context, shaderType, sourceSRVDesc.ViewDimension, &shader));
+
+ // Set vertices
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ANGLE_TRY(mRenderer->mapResource(context, mVertexBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
+ &mappedResource));
+
+ ShaderSupport support;
+ ANGLE_TRY(getShaderSupport(context, *shader, &support));
+
+ UINT stride = 0;
+ UINT drawCount = 0;
+ D3D11_PRIMITIVE_TOPOLOGY topology;
+
+ gl::Box area(0, 0, 0, size.width, size.height, size.depth);
+ support.vertexWriteFunction(area, size, area, size, mappedResource.pData, &stride, &drawCount,
+ &topology);
+
+ deviceContext->Unmap(mVertexBuffer.get(), 0);
+
+ // Set constant buffer
+ ANGLE_TRY(mRenderer->mapResource(context, mSwizzleCB.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
+ &mappedResource));
+
+ unsigned int *swizzleIndices = static_cast<unsigned int *>(mappedResource.pData);
+ swizzleIndices[0] = GetSwizzleIndex(swizzleTarget.swizzleRed);
+ swizzleIndices[1] = GetSwizzleIndex(swizzleTarget.swizzleGreen);
+ swizzleIndices[2] = GetSwizzleIndex(swizzleTarget.swizzleBlue);
+ swizzleIndices[3] = GetSwizzleIndex(swizzleTarget.swizzleAlpha);
+
+ deviceContext->Unmap(mSwizzleCB.get(), 0);
+
+ StateManager11 *stateManager = mRenderer->getStateManager();
+
+ // Apply vertex buffer
+ stateManager->setSingleVertexBuffer(&mVertexBuffer, stride, 0);
+
+ // Apply constant buffer
+ stateManager->setPixelConstantBuffer(0, &mSwizzleCB);
+
+ // Apply state
+ stateManager->setSimpleBlendState(nullptr);
+ stateManager->setDepthStencilState(nullptr, 0xFFFFFFFF);
+ stateManager->setRasterizerState(&mScissorDisabledRasterizerState);
+
+ // Apply shaders
+ stateManager->setInputLayout(support.inputLayout);
+ stateManager->setPrimitiveTopology(topology);
+
+ stateManager->setDrawShaders(support.vertexShader, support.geometryShader,
+ &shader->pixelShader);
+
+ // Apply render target
+ stateManager->setRenderTarget(dest.get(), nullptr);
+
+ // Set the viewport
+ stateManager->setSimpleViewport(size);
+
+ // Apply textures and sampler
+ stateManager->setSimplePixelTextureAndSampler(source, mPointSampler);
+
+ // Draw the quad
+ deviceContext->Draw(drawCount, 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::copyTexture(const gl::Context *context,
+ const d3d11::SharedSRV &source,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ GLenum sourceFormat,
+ const d3d11::RenderTargetView &dest,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ GLenum destFormat,
+ GLenum destTypeForDownsampling,
+ GLenum filter,
+ bool maskOffAlpha,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
+{
+ ANGLE_TRY(initResources(context));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // Determine if the source format is a signed integer format, the destFormat will already
+ // be GL_XXXX_INTEGER but it does not tell us if it is signed or unsigned.
+ D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
+ source.get()->GetDesc(&sourceSRVDesc);
+
+ GLenum componentType = d3d11::GetComponentType(sourceSRVDesc.Format);
+
+ ASSERT(componentType != GL_NONE);
+ ASSERT(componentType != GL_SIGNED_NORMALIZED);
+ bool isSrcSigned = (componentType == GL_INT);
+
+ D3D11_RENDER_TARGET_VIEW_DESC destRTVDesc;
+ dest.get()->GetDesc(&destRTVDesc);
+
+ GLenum destComponentType = d3d11::GetComponentType(destRTVDesc.Format);
+
+ ASSERT(componentType != GL_NONE);
+ bool isDestSigned = (destComponentType == GL_INT);
+
+ ShaderDimension dimension = SHADER_INVALID;
+
+ switch (sourceSRVDesc.ViewDimension)
+ {
+ case D3D11_SRV_DIMENSION_TEXTURE2D:
+ dimension = SHADER_2D;
+ break;
+ case D3D11_SRV_DIMENSION_TEXTURE3D:
+ dimension = SHADER_3D;
+ break;
+ case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
+ dimension = SHADER_2DARRAY;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ const Shader *shader = nullptr;
+
+ ANGLE_TRY(getBlitShader(context, destFormat, sourceFormat, isSrcSigned, isDestSigned,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha, destTypeForDownsampling,
+ dimension, &shader));
+
+ ShaderSupport support;
+ ANGLE_TRY(getShaderSupport(context, *shader, &support));
+
+ // Set vertices
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ANGLE_TRY(mRenderer->mapResource(context, mVertexBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
+ &mappedResource));
+
+ UINT stride = 0;
+ UINT drawCount = 0;
+ D3D11_PRIMITIVE_TOPOLOGY topology;
+
+ support.vertexWriteFunction(sourceArea, sourceSize, destArea, destSize, mappedResource.pData,
+ &stride, &drawCount, &topology);
+
+ deviceContext->Unmap(mVertexBuffer.get(), 0);
+
+ StateManager11 *stateManager = mRenderer->getStateManager();
+
+ // Apply vertex buffer
+ stateManager->setSingleVertexBuffer(&mVertexBuffer, stride, 0);
+
+ // Apply state
+ if (maskOffAlpha)
+ {
+ ANGLE_TRY(mAlphaMaskBlendState.resolve(GetImplAs<Context11>(context), mRenderer));
+ stateManager->setSimpleBlendState(&mAlphaMaskBlendState.getObj());
+ }
+ else
+ {
+ stateManager->setSimpleBlendState(nullptr);
+ }
+ stateManager->setDepthStencilState(nullptr, 0xFFFFFFFF);
+
+ if (scissor)
+ {
+ stateManager->setSimpleScissorRect(*scissor);
+ stateManager->setRasterizerState(&mScissorEnabledRasterizerState);
+ }
+ else
+ {
+ stateManager->setRasterizerState(&mScissorDisabledRasterizerState);
+ }
+
+ // Apply shaders
+ stateManager->setInputLayout(support.inputLayout);
+ stateManager->setPrimitiveTopology(topology);
+
+ stateManager->setDrawShaders(support.vertexShader, support.geometryShader,
+ &shader->pixelShader);
+
+ // Apply render target
+ stateManager->setRenderTarget(dest.get(), nullptr);
+
+ // Set the viewport
+ stateManager->setSimpleViewport(destSize);
+
+ // Apply texture and sampler
+ switch (filter)
+ {
+ case GL_NEAREST:
+ stateManager->setSimplePixelTextureAndSampler(source, mPointSampler);
+ break;
+ case GL_LINEAR:
+ stateManager->setSimplePixelTextureAndSampler(source, mLinearSampler);
+ break;
+
+ default:
+ UNREACHABLE();
+ ANGLE_TRY_HR(GetImplAs<Context11>(context), E_FAIL,
+ "Internal error, unknown blit filter mode.");
+ }
+
+ // Draw the quad
+ deviceContext->Draw(drawCount, 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::copyStencil(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor)
+{
+ return copyDepthStencilImpl(context, source, sourceSubresource, sourceArea, sourceSize, dest,
+ destSubresource, destArea, destSize, scissor, true);
+}
+
+angle::Result Blit11::copyDepth(const gl::Context *context,
+ const d3d11::SharedSRV &source,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const d3d11::DepthStencilView &dest,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor)
+{
+ ANGLE_TRY(initResources(context));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // Set vertices
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ANGLE_TRY(mRenderer->mapResource(context, mVertexBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
+ &mappedResource));
+
+ UINT stride = 0;
+ UINT drawCount = 0;
+ D3D11_PRIMITIVE_TOPOLOGY topology;
+
+ Write2DVertices(sourceArea, sourceSize, destArea, destSize, mappedResource.pData, &stride,
+ &drawCount, &topology);
+
+ deviceContext->Unmap(mVertexBuffer.get(), 0);
+
+ StateManager11 *stateManager = mRenderer->getStateManager();
+
+ // Apply vertex buffer
+ stateManager->setSingleVertexBuffer(&mVertexBuffer, stride, 0);
+
+ // Apply state
+ stateManager->setSimpleBlendState(nullptr);
+ stateManager->setDepthStencilState(&mDepthStencilState, 0xFFFFFFFF);
+
+ if (scissor)
+ {
+ stateManager->setSimpleScissorRect(*scissor);
+ stateManager->setRasterizerState(&mScissorEnabledRasterizerState);
+ }
+ else
+ {
+ stateManager->setRasterizerState(&mScissorDisabledRasterizerState);
+ }
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(mQuad2DIL.resolve(context11, mRenderer));
+ ANGLE_TRY(mQuad2DVS.resolve(context11, mRenderer));
+ ANGLE_TRY(mDepthPS.resolve(context11, mRenderer));
+
+ // Apply shaders
+ stateManager->setInputLayout(&mQuad2DIL.getObj());
+ stateManager->setPrimitiveTopology(topology);
+
+ stateManager->setDrawShaders(&mQuad2DVS.getObj(), nullptr, &mDepthPS.getObj());
+
+ // Apply render target
+ stateManager->setRenderTarget(nullptr, dest.get());
+
+ // Set the viewport
+ stateManager->setSimpleViewport(destSize);
+
+ // Apply texture and sampler
+ stateManager->setSimplePixelTextureAndSampler(source, mPointSampler);
+
+ // Draw the quad
+ deviceContext->Draw(drawCount, 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::copyDepthStencil(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor)
+{
+ return copyDepthStencilImpl(context, source, sourceSubresource, sourceArea, sourceSize, dest,
+ destSubresource, destArea, destSize, scissor, false);
+}
+
+angle::Result Blit11::copyDepthStencilImpl(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ bool stencilOnly)
+{
+ auto srcDXGIFormat = source.getFormat();
+ const auto &srcSizeInfo = d3d11::GetDXGIFormatSizeInfo(srcDXGIFormat);
+ unsigned int srcPixelSize = srcSizeInfo.pixelBytes;
+ unsigned int copyOffset = 0;
+ unsigned int copySize = srcPixelSize;
+ auto destDXGIFormat = dest.getFormat();
+ const auto &destSizeInfo = d3d11::GetDXGIFormatSizeInfo(destDXGIFormat);
+ unsigned int destPixelSize = destSizeInfo.pixelBytes;
+
+ ASSERT(srcDXGIFormat == destDXGIFormat || destDXGIFormat == DXGI_FORMAT_R32_TYPELESS);
+
+ if (stencilOnly)
+ {
+ const auto &srcFormat = source.getFormatSet().format();
+
+ // Stencil channel should be right after the depth channel. Some views to depth/stencil
+ // resources have red channel for depth, in which case the depth channel bit width is in
+ // redBits.
+ ASSERT((srcFormat.redBits != 0) != (srcFormat.depthBits != 0));
+ GLuint depthBits = srcFormat.redBits + srcFormat.depthBits;
+ // Known formats have either 24 or 32 bits of depth.
+ ASSERT(depthBits == 24 || depthBits == 32);
+ copyOffset = depthBits / 8;
+
+ // Stencil is assumed to be 8-bit - currently this is true for all possible formats.
+ copySize = 1;
+ }
+
+ if (srcDXGIFormat != destDXGIFormat)
+ {
+ if (srcDXGIFormat == DXGI_FORMAT_R24G8_TYPELESS)
+ {
+ ASSERT(sourceArea == destArea && sourceSize == destSize && scissor == nullptr);
+ return copyAndConvert(context, source, sourceSubresource, sourceArea, sourceSize, dest,
+ destSubresource, destArea, destSize, scissor, copyOffset,
+ copyOffset, copySize, srcPixelSize, destPixelSize,
+ BlitD24S8ToD32F);
+ }
+ ASSERT(srcDXGIFormat == DXGI_FORMAT_R32G8X24_TYPELESS);
+ return copyAndConvert(context, source, sourceSubresource, sourceArea, sourceSize, dest,
+ destSubresource, destArea, destSize, scissor, copyOffset, copyOffset,
+ copySize, srcPixelSize, destPixelSize, BlitD32FS8ToD32F);
+ }
+
+ return copyAndConvert(context, source, sourceSubresource, sourceArea, sourceSize, dest,
+ destSubresource, destArea, destSize, scissor, copyOffset, copyOffset,
+ copySize, srcPixelSize, destPixelSize, StretchedBlitNearest);
+}
+
+angle::Result Blit11::copyAndConvertImpl(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &destStaging,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ size_t readOffset,
+ size_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ BlitConvertFunction *convertFunction)
+{
+ ANGLE_TRY(initResources(context));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ TextureHelper11 sourceStaging;
+ ANGLE_TRY(mRenderer->createStagingTexture(context, ResourceType::Texture2D,
+ source.getFormatSet(), sourceSize,
+ StagingAccess::READ, &sourceStaging));
+
+ deviceContext->CopySubresourceRegion(sourceStaging.get(), 0, 0, 0, 0, source.get(),
+ sourceSubresource, nullptr);
+
+ D3D11_MAPPED_SUBRESOURCE sourceMapping;
+ ANGLE_TRY(
+ mRenderer->mapResource(context, sourceStaging.get(), 0, D3D11_MAP_READ, 0, &sourceMapping));
+
+ D3D11_MAPPED_SUBRESOURCE destMapping;
+ angle::Result error =
+ mRenderer->mapResource(context, destStaging.get(), 0, D3D11_MAP_WRITE, 0, &destMapping);
+ if (error == angle::Result::Stop)
+ {
+ deviceContext->Unmap(sourceStaging.get(), 0);
+ return error;
+ }
+
+ // Clip dest area to the destination size
+ gl::Rectangle clipRect = gl::Rectangle(0, 0, destSize.width, destSize.height);
+
+ // Clip dest area to the scissor
+ if (scissor)
+ {
+ if (!gl::ClipRectangle(clipRect, *scissor, &clipRect))
+ {
+ return angle::Result::Continue;
+ }
+ }
+
+ convertFunction(sourceArea, destArea, clipRect, sourceSize, sourceMapping.RowPitch,
+ destMapping.RowPitch, readOffset, writeOffset, copySize, srcPixelStride,
+ destPixelStride, static_cast<const uint8_t *>(sourceMapping.pData),
+ static_cast<uint8_t *>(destMapping.pData));
+
+ deviceContext->Unmap(sourceStaging.get(), 0);
+ deviceContext->Unmap(destStaging.get(), 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::copyAndConvert(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ size_t readOffset,
+ size_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ BlitConvertFunction *convertFunction)
+{
+ ANGLE_TRY(initResources(context));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // HACK: Create the destination staging buffer as a read/write texture so
+ // ID3D11DevicContext::UpdateSubresource can be called
+ // using it's mapped data as a source
+ TextureHelper11 destStaging;
+ ANGLE_TRY(mRenderer->createStagingTexture(context, ResourceType::Texture2D, dest.getFormatSet(),
+ destSize, StagingAccess::READ_WRITE, &destStaging));
+
+ deviceContext->CopySubresourceRegion(destStaging.get(), 0, 0, 0, 0, dest.get(), destSubresource,
+ nullptr);
+
+ ANGLE_TRY(copyAndConvertImpl(context, source, sourceSubresource, sourceArea, sourceSize,
+ destStaging, destArea, destSize, scissor, readOffset, writeOffset,
+ copySize, srcPixelStride, destPixelStride, convertFunction));
+
+ // Work around timeouts/TDRs in older NVIDIA drivers.
+ if (mRenderer->getFeatures().depthStencilBlitExtraCopy.enabled)
+ {
+ D3D11_MAPPED_SUBRESOURCE mapped;
+ ANGLE_TRY(
+ mRenderer->mapResource(context, destStaging.get(), 0, D3D11_MAP_READ, 0, &mapped));
+ deviceContext->UpdateSubresource(dest.get(), destSubresource, nullptr, mapped.pData,
+ mapped.RowPitch, mapped.DepthPitch);
+ deviceContext->Unmap(destStaging.get(), 0);
+ }
+ else
+ {
+ deviceContext->CopySubresourceRegion(dest.get(), destSubresource, 0, 0, 0,
+ destStaging.get(), 0, nullptr);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::addBlitShaderToMap(const gl::Context *context,
+ BlitShaderType blitShaderType,
+ ShaderDimension dimension,
+ const ShaderData &shaderData,
+ const char *name)
+{
+ ASSERT(mBlitShaderMap.find(blitShaderType) == mBlitShaderMap.end());
+
+ d3d11::PixelShader ps;
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), shaderData, &ps));
+ ps.setDebugName(name);
+
+ Shader shader;
+ shader.dimension = dimension;
+ shader.pixelShader = std::move(ps);
+
+ mBlitShaderMap[blitShaderType] = std::move(shader);
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::addSwizzleShaderToMap(const gl::Context *context,
+ SwizzleShaderType swizzleShaderType,
+ ShaderDimension dimension,
+ const ShaderData &shaderData,
+ const char *name)
+{
+ ASSERT(mSwizzleShaderMap.find(swizzleShaderType) == mSwizzleShaderMap.end());
+
+ d3d11::PixelShader ps;
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), shaderData, &ps));
+ ps.setDebugName(name);
+
+ Shader shader;
+ shader.dimension = dimension;
+ shader.pixelShader = std::move(ps);
+
+ mSwizzleShaderMap[swizzleShaderType] = std::move(shader);
+ return angle::Result::Continue;
+}
+
+void Blit11::clearShaderMap()
+{
+ mBlitShaderMap.clear();
+ mSwizzleShaderMap.clear();
+}
+
+Blit11::BlitShaderOperation Blit11::getBlitShaderOperation(GLenum destinationFormat,
+ GLenum sourceFormat,
+ bool isSrcSigned,
+ bool isDestSigned,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ GLenum destTypeForDownsampling)
+{
+ bool floatToIntBlit =
+ !gl::IsIntegerFormat(sourceFormat) && gl::IsIntegerFormat(destinationFormat);
+
+ if (isSrcSigned)
+ {
+ ASSERT(!unpackPremultiplyAlpha && !unpackUnmultiplyAlpha);
+ switch (destinationFormat)
+ {
+ case GL_RGBA_INTEGER:
+ return RGBAI;
+ case GL_RGB_INTEGER:
+ return RGBI;
+ case GL_RG_INTEGER:
+ return RGI;
+ case GL_RED_INTEGER:
+ return RI;
+ default:
+ UNREACHABLE();
+ return OPERATION_INVALID;
+ }
+ }
+ else if (isDestSigned)
+ {
+ ASSERT(floatToIntBlit);
+
+ switch (destinationFormat)
+ {
+ case GL_RGBA_INTEGER:
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBAF_TOI;
+ }
+ else
+ {
+ return unpackPremultiplyAlpha ? RGBAF_TOI_PREMULTIPLY : RGBAF_TOI_UNMULTIPLY;
+ }
+ break;
+ case GL_RGB_INTEGER:
+ case GL_RG_INTEGER:
+ case GL_RED_INTEGER:
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBF_TOI;
+ }
+ else
+ {
+ return unpackPremultiplyAlpha ? RGBF_TOI_PREMULTIPLY : RGBF_TOI_UNMULTIPLY;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ return OPERATION_INVALID;
+ }
+ }
+ else
+ {
+ // Check for the downsample formats first
+ switch (destTypeForDownsampling)
+ {
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ ASSERT(destinationFormat == GL_RGBA && !floatToIntBlit);
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBAF_4444;
+ }
+ else if (unpackPremultiplyAlpha)
+ {
+ return RGBAF_4444_PREMULTIPLY;
+ }
+ else
+ {
+ return RGBAF_4444_UNMULTIPLY;
+ }
+
+ case GL_UNSIGNED_SHORT_5_6_5:
+ ASSERT(destinationFormat == GL_RGB && !floatToIntBlit);
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBF_565;
+ }
+ else
+ {
+ return unpackPremultiplyAlpha ? RGBF_565_PREMULTIPLY : RGBF_565_UNMULTIPLY;
+ }
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBAF_5551;
+ }
+ else
+ {
+ return unpackPremultiplyAlpha ? RGBAF_5551_PREMULTIPLY : RGBAF_5551_UNMULTIPLY;
+ }
+
+ default:
+ // By default, use the regular passthrough/multiply/unmultiply shaders. The above
+ // shaders are only needed for some emulated texture formats.
+ break;
+ }
+
+ if (unpackPremultiplyAlpha != unpackUnmultiplyAlpha || floatToIntBlit)
+ {
+ switch (destinationFormat)
+ {
+ case GL_RGBA:
+ case GL_BGRA_EXT:
+ ASSERT(!floatToIntBlit);
+ return unpackPremultiplyAlpha ? RGBAF_PREMULTIPLY : RGBAF_UNMULTIPLY;
+ case GL_RGB:
+ case GL_RG:
+ case GL_RED:
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBF_TOUI;
+ }
+ else
+ {
+ return unpackPremultiplyAlpha ? RGBF_PREMULTIPLY : RGBF_UNMULTIPLY;
+ }
+ case GL_RGBA_INTEGER:
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBAF_TOUI;
+ }
+ else
+ {
+ return unpackPremultiplyAlpha ? RGBAF_TOUI_PREMULTIPLY
+ : RGBAF_TOUI_UNMULTIPLY;
+ }
+ case GL_RGB_INTEGER:
+ case GL_RG_INTEGER:
+ case GL_RED_INTEGER:
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha)
+ {
+ return RGBF_TOUI;
+ }
+ else
+ {
+ return unpackPremultiplyAlpha ? RGBF_TOUI_PREMULTIPLY
+ : RGBF_TOUI_UNMULTIPLY;
+ }
+ case GL_LUMINANCE:
+ ASSERT(!floatToIntBlit);
+ return unpackPremultiplyAlpha ? LUMAF_PREMULTIPLY : LUMAF_UNMULTIPLY;
+
+ case GL_LUMINANCE_ALPHA:
+ ASSERT(!floatToIntBlit);
+ return unpackPremultiplyAlpha ? LUMAALPHAF_PREMULTIPLY : LUMAALPHAF_UNMULTIPLY;
+ case GL_ALPHA:
+ return ALPHA;
+ default:
+ UNREACHABLE();
+ return OPERATION_INVALID;
+ }
+ }
+ else
+ {
+ switch (destinationFormat)
+ {
+ case GL_RGBA:
+ return RGBAF;
+ case GL_RGBA_INTEGER:
+ return RGBAUI;
+ case GL_BGRA_EXT:
+ return BGRAF;
+ case GL_RGB:
+ return RGBF;
+ case GL_RGB_INTEGER:
+ return RGBUI;
+ case GL_RG:
+ return RGF;
+ case GL_RG_INTEGER:
+ return RGUI;
+ case GL_RED:
+ return RF;
+ case GL_RED_INTEGER:
+ return RUI;
+ case GL_ALPHA:
+ return ALPHA;
+ case GL_LUMINANCE:
+ return LUMA;
+ case GL_LUMINANCE_ALPHA:
+ return LUMAALPHA;
+ default:
+ UNREACHABLE();
+ return OPERATION_INVALID;
+ }
+ }
+ }
+}
+
+angle::Result Blit11::getBlitShader(const gl::Context *context,
+ GLenum destFormat,
+ GLenum sourceFormat,
+ bool isSrcSigned,
+ bool isDestSigned,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ GLenum destTypeForDownsampling,
+ ShaderDimension dimension,
+ const Shader **shader)
+{
+ BlitShaderOperation blitShaderOperation = OPERATION_INVALID;
+
+ blitShaderOperation = getBlitShaderOperation(destFormat, sourceFormat, isSrcSigned,
+ isDestSigned, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha, destTypeForDownsampling);
+
+ BlitShaderType blitShaderType = BLITSHADER_INVALID;
+
+ blitShaderType = getBlitShaderType(blitShaderOperation, dimension);
+
+ ANGLE_CHECK_HR(GetImplAs<Context11>(context), blitShaderType != BLITSHADER_INVALID,
+ "Internal blit shader type mismatch", E_FAIL);
+
+ auto blitShaderIt = mBlitShaderMap.find(blitShaderType);
+ if (blitShaderIt != mBlitShaderMap.end())
+ {
+ *shader = &blitShaderIt->second;
+ return angle::Result::Continue;
+ }
+
+ ASSERT(dimension == SHADER_2D || mRenderer->isES3Capable());
+
+ ANGLE_TRY(mapBlitShader(context, blitShaderType));
+
+ blitShaderIt = mBlitShaderMap.find(blitShaderType);
+ ASSERT(blitShaderIt != mBlitShaderMap.end());
+ *shader = &blitShaderIt->second;
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::getSwizzleShader(const gl::Context *context,
+ GLenum type,
+ D3D11_SRV_DIMENSION viewDimension,
+ const Shader **shader)
+{
+ SwizzleShaderType swizzleShaderType = GetSwizzleShaderType(type, viewDimension);
+
+ ANGLE_CHECK_HR(GetImplAs<Context11>(context), swizzleShaderType != SWIZZLESHADER_INVALID,
+ "Swizzle shader type not found", E_FAIL);
+
+ auto swizzleShaderIt = mSwizzleShaderMap.find(swizzleShaderType);
+ if (swizzleShaderIt != mSwizzleShaderMap.end())
+ {
+ *shader = &swizzleShaderIt->second;
+ return angle::Result::Continue;
+ }
+
+ // Swizzling shaders (OpenGL ES 3+)
+ ASSERT(mRenderer->isES3Capable());
+
+ switch (swizzleShaderType)
+ {
+ case SWIZZLESHADER_2D_FLOAT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_2D,
+ ShaderData(g_PS_SwizzleF2D),
+ "Blit11 2D F swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_2D_UINT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_2D,
+ ShaderData(g_PS_SwizzleUI2D),
+ "Blit11 2D UI swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_2D_INT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_2D,
+ ShaderData(g_PS_SwizzleI2D),
+ "Blit11 2D I swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_CUBE_FLOAT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleF2DArray),
+ "Blit11 2D Cube F swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_CUBE_UINT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleUI2DArray),
+ "Blit11 2D Cube UI swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_CUBE_INT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleI2DArray),
+ "Blit11 2D Cube I swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_3D_FLOAT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleF3D),
+ "Blit11 3D F swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_3D_UINT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleUI3D),
+ "Blit11 3D UI swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_3D_INT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleI3D),
+ "Blit11 3D I swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_ARRAY_FLOAT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleF2DArray),
+ "Blit11 2D Array F swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_ARRAY_UINT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleUI2DArray),
+ "Blit11 2D Array UI swizzle pixel shader"));
+ break;
+ case SWIZZLESHADER_ARRAY_INT:
+ ANGLE_TRY(addSwizzleShaderToMap(context, swizzleShaderType, SHADER_3D,
+ ShaderData(g_PS_SwizzleI2DArray),
+ "Blit11 2D Array I swizzle pixel shader"));
+ break;
+ default:
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ }
+
+ swizzleShaderIt = mSwizzleShaderMap.find(swizzleShaderType);
+ ASSERT(swizzleShaderIt != mSwizzleShaderMap.end());
+ *shader = &swizzleShaderIt->second;
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::resolveDepth(const gl::Context *context,
+ RenderTarget11 *depth,
+ TextureHelper11 *textureOut)
+{
+ ANGLE_TRY(initResources(context));
+
+ // Multisampled depth stencil SRVs are not available in feature level 10.0
+ ASSERT(mRenderer->getRenderer11DeviceCaps().featureLevel > D3D_FEATURE_LEVEL_10_0);
+
+ const auto &extents = depth->getExtents();
+ auto *deviceContext = mRenderer->getDeviceContext();
+ auto *stateManager = mRenderer->getStateManager();
+
+ ANGLE_TRY(initResolveDepthOnly(context, depth->getFormatSet(), extents));
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(mResolveDepthStencilVS.resolve(context11, mRenderer));
+ ANGLE_TRY(mResolveDepthPS.resolve(context11, mRenderer));
+
+ // Apply the necessary state changes to the D3D11 immediate device context.
+ stateManager->setInputLayout(nullptr);
+ stateManager->setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ stateManager->setDrawShaders(&mResolveDepthStencilVS.getObj(), nullptr,
+ &mResolveDepthPS.getObj());
+ stateManager->setRasterizerState(nullptr);
+ stateManager->setDepthStencilState(&mDepthStencilState, 0xFFFFFFFF);
+ stateManager->setRenderTargets(nullptr, 0, mResolvedDepthDSView.get());
+ stateManager->setSimpleBlendState(nullptr);
+ stateManager->setSimpleViewport(extents);
+
+ // Set the viewport
+ stateManager->setShaderResourceShared(gl::ShaderType::Fragment, 0,
+ &depth->getShaderResourceView(context));
+
+ // Trigger the blit on the GPU.
+ deviceContext->Draw(6, 0);
+
+ *textureOut = mResolvedDepth;
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::initResolveDepthOnly(const gl::Context *context,
+ const d3d11::Format &format,
+ const gl::Extents &extents)
+{
+ if (mResolvedDepth.valid() && extents == mResolvedDepth.getExtents() &&
+ format.texFormat == mResolvedDepth.getFormat())
+ {
+ return angle::Result::Continue;
+ }
+
+ D3D11_TEXTURE2D_DESC textureDesc;
+ textureDesc.Width = extents.width;
+ textureDesc.Height = extents.height;
+ textureDesc.MipLevels = 1;
+ textureDesc.ArraySize = 1;
+ textureDesc.Format = format.texFormat;
+ textureDesc.SampleDesc.Count = 1;
+ textureDesc.SampleDesc.Quality = 0;
+ textureDesc.Usage = D3D11_USAGE_DEFAULT;
+ textureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
+ textureDesc.CPUAccessFlags = 0;
+ textureDesc.MiscFlags = 0;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(mRenderer->allocateTexture(context11, textureDesc, format, &mResolvedDepth));
+ mResolvedDepth.setDebugName("Blit11::mResolvedDepth");
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Flags = 0;
+ dsvDesc.Format = format.dsvFormat;
+ dsvDesc.Texture2D.MipSlice = 0;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, dsvDesc, mResolvedDepth.get(),
+ &mResolvedDepthDSView));
+ mResolvedDepthDSView.setDebugName("Blit11::mResolvedDepthDSView");
+
+ // Possibly D3D11 bug or undefined behaviour: Clear the DSV so that our first render
+ // works as expected. Otherwise the results of the first use seem to be incorrect.
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->ClearDepthStencilView(mResolvedDepthDSView.get(), D3D11_CLEAR_DEPTH, 1.0f, 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::initResolveDepthStencil(const gl::Context *context,
+ const gl::Extents &extents)
+{
+ // Check if we need to recreate depth stencil view
+ if (mResolvedDepthStencil.valid() && extents == mResolvedDepthStencil.getExtents())
+ {
+ ASSERT(mResolvedDepthStencil.getFormat() == DXGI_FORMAT_R32G32_FLOAT);
+ return angle::Result::Continue;
+ }
+
+ if (mResolvedDepthStencil.valid())
+ {
+ releaseResolveDepthStencilResources();
+ }
+
+ const auto &formatSet = d3d11::Format::Get(GL_RG32F, mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE2D_DESC textureDesc;
+ textureDesc.Width = extents.width;
+ textureDesc.Height = extents.height;
+ textureDesc.MipLevels = 1;
+ textureDesc.ArraySize = 1;
+ textureDesc.Format = formatSet.texFormat;
+ textureDesc.SampleDesc.Count = 1;
+ textureDesc.SampleDesc.Quality = 0;
+ textureDesc.Usage = D3D11_USAGE_DEFAULT;
+ textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET;
+ textureDesc.CPUAccessFlags = 0;
+ textureDesc.MiscFlags = 0;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(
+ mRenderer->allocateTexture(context11, textureDesc, formatSet, &mResolvedDepthStencil));
+ mResolvedDepthStencil.setDebugName("Blit11::mResolvedDepthStencil");
+
+ ANGLE_TRY(mRenderer->allocateResourceNoDesc(context11, mResolvedDepthStencil.get(),
+ &mResolvedDepthStencilRTView));
+ mResolvedDepthStencilRTView.setDebugName("Blit11::mResolvedDepthStencilRTView");
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit11::resolveStencil(const gl::Context *context,
+ RenderTarget11 *depthStencil,
+ bool alsoDepth,
+ TextureHelper11 *textureOut)
+{
+ ANGLE_TRY(initResources(context));
+
+ // Multisampled depth stencil SRVs are not available in feature level 10.0
+ ASSERT(mRenderer->getRenderer11DeviceCaps().featureLevel > D3D_FEATURE_LEVEL_10_0);
+
+ const auto &extents = depthStencil->getExtents();
+
+ ANGLE_TRY(initResolveDepthStencil(context, extents));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ auto *stateManager = mRenderer->getStateManager();
+ ID3D11Resource *stencilResource = depthStencil->getTexture().get();
+
+ // Check if we need to re-create the stencil SRV.
+ if (mStencilSRV.valid())
+ {
+ ID3D11Resource *priorResource = nullptr;
+ mStencilSRV.get()->GetResource(&priorResource);
+
+ if (stencilResource != priorResource)
+ {
+ mStencilSRV.reset();
+ }
+
+ SafeRelease(priorResource);
+ }
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (!mStencilSRV.valid())
+ {
+ D3D11_SHADER_RESOURCE_VIEW_DESC srViewDesc;
+ srViewDesc.Format = GetStencilSRVFormat(depthStencil->getFormatSet());
+ srViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(context11, srViewDesc, stencilResource, &mStencilSRV));
+ mStencilSRV.setDebugName("Blit11::mStencilSRV");
+ }
+
+ // Notify the Renderer that all state should be invalidated.
+ ANGLE_TRY(mResolveDepthStencilVS.resolve(context11, mRenderer));
+
+ // Resolving the depth buffer works by sampling the depth in the shader using a SRV, then
+ // writing to the resolved depth buffer using SV_Depth. We can't use this method for stencil
+ // because SV_StencilRef isn't supported until HLSL 5.1/D3D11.3.
+ const d3d11::PixelShader *pixelShader = nullptr;
+ if (alsoDepth)
+ {
+ ANGLE_TRY(mResolveDepthStencilPS.resolve(context11, mRenderer));
+ pixelShader = &mResolveDepthStencilPS.getObj();
+ }
+ else
+ {
+ ANGLE_TRY(mResolveStencilPS.resolve(context11, mRenderer));
+ pixelShader = &mResolveStencilPS.getObj();
+ }
+
+ // Apply the necessary state changes to the D3D11 immediate device context.
+ stateManager->setInputLayout(nullptr);
+ stateManager->setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ stateManager->setDrawShaders(&mResolveDepthStencilVS.getObj(), nullptr, pixelShader);
+ stateManager->setRasterizerState(nullptr);
+ stateManager->setDepthStencilState(nullptr, 0xFFFFFFFF);
+ stateManager->setRenderTarget(mResolvedDepthStencilRTView.get(), nullptr);
+ stateManager->setSimpleBlendState(nullptr);
+
+ // Set the viewport
+ stateManager->setSimpleViewport(extents);
+ stateManager->setShaderResourceShared(gl::ShaderType::Fragment, 0,
+ &depthStencil->getShaderResourceView(context));
+ stateManager->setShaderResource(gl::ShaderType::Fragment, 1, &mStencilSRV);
+
+ // Trigger the blit on the GPU.
+ deviceContext->Draw(6, 0);
+
+ gl::Box copyBox(0, 0, 0, extents.width, extents.height, 1);
+
+ ANGLE_TRY(mRenderer->createStagingTexture(context, ResourceType::Texture2D,
+ depthStencil->getFormatSet(), extents,
+ StagingAccess::READ_WRITE, textureOut));
+
+ const auto &copyFunction = GetCopyDepthStencilFunction(depthStencil->getInternalFormat());
+ const auto &dsFormatSet = depthStencil->getFormatSet();
+ const auto &dsDxgiInfo = d3d11::GetDXGIFormatSizeInfo(dsFormatSet.texFormat);
+
+ ANGLE_TRY(copyAndConvertImpl(context, mResolvedDepthStencil, 0, copyBox, extents, *textureOut,
+ copyBox, extents, nullptr, 0, 0, 0, 8u, dsDxgiInfo.pixelBytes,
+ copyFunction));
+
+ return angle::Result::Continue;
+}
+
+void Blit11::releaseResolveDepthStencilResources()
+{
+ mStencilSRV.reset();
+ mResolvedDepthStencilRTView.reset();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.h
new file mode 100644
index 0000000000..47ef453831
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.h
@@ -0,0 +1,300 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit11.cpp: Texture copy utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#include <map>
+
+namespace rx
+{
+class Renderer11;
+
+class Blit11 : angle::NonCopyable
+{
+ public:
+ explicit Blit11(Renderer11 *renderer);
+ ~Blit11();
+
+ angle::Result swizzleTexture(const gl::Context *context,
+ const d3d11::SharedSRV &source,
+ const d3d11::RenderTargetView &dest,
+ const gl::Extents &size,
+ const gl::SwizzleState &swizzleTarget);
+
+ // Set destTypeForDownsampling to GL_NONE to skip downsampling
+ angle::Result copyTexture(const gl::Context *context,
+ const d3d11::SharedSRV &source,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ GLenum sourceFormat,
+ const d3d11::RenderTargetView &dest,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ GLenum destFormat,
+ GLenum destTypeForDownsampling,
+ GLenum filter,
+ bool maskOffAlpha,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha);
+
+ angle::Result copyStencil(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor);
+
+ angle::Result copyDepth(const gl::Context *context,
+ const d3d11::SharedSRV &source,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const d3d11::DepthStencilView &dest,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor);
+
+ angle::Result copyDepthStencil(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor);
+
+ angle::Result resolveDepth(const gl::Context *context,
+ RenderTarget11 *depth,
+ TextureHelper11 *textureOut);
+
+ angle::Result resolveStencil(const gl::Context *context,
+ RenderTarget11 *depthStencil,
+ bool alsoDepth,
+ TextureHelper11 *textureOut);
+
+ using BlitConvertFunction = void(const gl::Box &sourceArea,
+ const gl::Box &destArea,
+ const gl::Rectangle &clipRect,
+ const gl::Extents &sourceSize,
+ unsigned int sourceRowPitch,
+ unsigned int destRowPitch,
+ ptrdiff_t readOffset,
+ ptrdiff_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ const uint8_t *sourceData,
+ uint8_t *destData);
+
+ private:
+ enum BlitShaderOperation : unsigned int;
+ enum BlitShaderType : unsigned int;
+ enum SwizzleShaderType
+ {
+ SWIZZLESHADER_INVALID,
+ SWIZZLESHADER_2D_FLOAT,
+ SWIZZLESHADER_2D_UINT,
+ SWIZZLESHADER_2D_INT,
+ SWIZZLESHADER_CUBE_FLOAT,
+ SWIZZLESHADER_CUBE_UINT,
+ SWIZZLESHADER_CUBE_INT,
+ SWIZZLESHADER_3D_FLOAT,
+ SWIZZLESHADER_3D_UINT,
+ SWIZZLESHADER_3D_INT,
+ SWIZZLESHADER_ARRAY_FLOAT,
+ SWIZZLESHADER_ARRAY_UINT,
+ SWIZZLESHADER_ARRAY_INT,
+ };
+
+ typedef void (*WriteVertexFunction)(const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ void *outVertices,
+ unsigned int *outStride,
+ unsigned int *outVertexCount,
+ D3D11_PRIMITIVE_TOPOLOGY *outTopology);
+
+ enum ShaderDimension
+ {
+ SHADER_INVALID,
+ SHADER_2D,
+ SHADER_3D,
+ SHADER_2DARRAY
+ };
+
+ struct Shader
+ {
+ Shader();
+ Shader(Shader &&other);
+ ~Shader();
+ Shader &operator=(Shader &&other);
+
+ ShaderDimension dimension;
+ d3d11::PixelShader pixelShader;
+ };
+
+ struct ShaderSupport
+ {
+ const d3d11::InputLayout *inputLayout;
+ const d3d11::VertexShader *vertexShader;
+ const d3d11::GeometryShader *geometryShader;
+ WriteVertexFunction vertexWriteFunction;
+ };
+
+ angle::Result initResources(const gl::Context *context);
+
+ angle::Result getShaderSupport(const gl::Context *context,
+ const Shader &shader,
+ ShaderSupport *supportOut);
+
+ static BlitShaderOperation getBlitShaderOperation(GLenum destinationFormat,
+ GLenum sourceFormat,
+ bool isSrcSigned,
+ bool isDestSigned,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ GLenum destTypeForDownsampling);
+
+ static BlitShaderType getBlitShaderType(BlitShaderOperation operation,
+ ShaderDimension dimension);
+
+ static SwizzleShaderType GetSwizzleShaderType(GLenum type, D3D11_SRV_DIMENSION dimensionality);
+
+ angle::Result copyDepthStencilImpl(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ bool stencilOnly);
+
+ angle::Result copyAndConvertImpl(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &destStaging,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ size_t readOffset,
+ size_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ BlitConvertFunction *convertFunction);
+
+ angle::Result copyAndConvert(const gl::Context *context,
+ const TextureHelper11 &source,
+ unsigned int sourceSubresource,
+ const gl::Box &sourceArea,
+ const gl::Extents &sourceSize,
+ const TextureHelper11 &dest,
+ unsigned int destSubresource,
+ const gl::Box &destArea,
+ const gl::Extents &destSize,
+ const gl::Rectangle *scissor,
+ size_t readOffset,
+ size_t writeOffset,
+ size_t copySize,
+ size_t srcPixelStride,
+ size_t destPixelStride,
+ BlitConvertFunction *convertFunction);
+
+ angle::Result mapBlitShader(const gl::Context *context, BlitShaderType blitShaderType);
+ angle::Result addBlitShaderToMap(const gl::Context *context,
+ BlitShaderType blitShaderType,
+ ShaderDimension dimension,
+ const ShaderData &shaderData,
+ const char *name);
+
+ angle::Result getBlitShader(const gl::Context *context,
+ GLenum destFormat,
+ GLenum sourceFormat,
+ bool isSrcSigned,
+ bool isDestSigned,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ GLenum destTypeForDownsampling,
+ ShaderDimension dimension,
+ const Shader **shaderOut);
+ angle::Result getSwizzleShader(const gl::Context *context,
+ GLenum type,
+ D3D11_SRV_DIMENSION viewDimension,
+ const Shader **shaderOut);
+
+ angle::Result addSwizzleShaderToMap(const gl::Context *context,
+ SwizzleShaderType swizzleShaderType,
+ ShaderDimension dimension,
+ const ShaderData &shaderData,
+ const char *name);
+
+ void clearShaderMap();
+ void releaseResolveDepthStencilResources();
+ angle::Result initResolveDepthOnly(const gl::Context *context,
+ const d3d11::Format &format,
+ const gl::Extents &extents);
+ angle::Result initResolveDepthStencil(const gl::Context *context, const gl::Extents &extents);
+
+ Renderer11 *mRenderer;
+
+ std::map<BlitShaderType, Shader> mBlitShaderMap;
+ std::map<SwizzleShaderType, Shader> mSwizzleShaderMap;
+
+ bool mResourcesInitialized;
+ d3d11::Buffer mVertexBuffer;
+ d3d11::SamplerState mPointSampler;
+ d3d11::SamplerState mLinearSampler;
+ d3d11::RasterizerState mScissorEnabledRasterizerState;
+ d3d11::RasterizerState mScissorDisabledRasterizerState;
+ d3d11::DepthStencilState mDepthStencilState;
+
+ d3d11::LazyInputLayout mQuad2DIL;
+ d3d11::LazyShader<ID3D11VertexShader> mQuad2DVS;
+ d3d11::LazyShader<ID3D11PixelShader> mDepthPS;
+
+ d3d11::LazyInputLayout mQuad3DIL;
+ d3d11::LazyShader<ID3D11VertexShader> mQuad3DVS;
+ d3d11::LazyShader<ID3D11GeometryShader> mQuad3DGS;
+
+ d3d11::LazyBlendState mAlphaMaskBlendState;
+
+ d3d11::Buffer mSwizzleCB;
+
+ d3d11::LazyShader<ID3D11VertexShader> mResolveDepthStencilVS;
+ d3d11::LazyShader<ID3D11PixelShader> mResolveDepthPS;
+ d3d11::LazyShader<ID3D11PixelShader> mResolveDepthStencilPS;
+ d3d11::LazyShader<ID3D11PixelShader> mResolveStencilPS;
+ d3d11::ShaderResourceView mStencilSRV;
+ TextureHelper11 mResolvedDepthStencil;
+ d3d11::RenderTargetView mResolvedDepthStencilRTView;
+ TextureHelper11 mResolvedDepth;
+ d3d11::DepthStencilView mResolvedDepthDSView;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11Helper_autogen.inc b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11Helper_autogen.inc
new file mode 100644
index 0000000000..566270049b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11Helper_autogen.inc
@@ -0,0 +1,1575 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_blit11helper.py.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Blit11Helper_autogen.inc:
+// Defines and retrieves blitshaders for the D3D11 backend.
+
+namespace
+{
+// Include inline shaders in the anonymous namespace to make sure no symbols are exported
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrougha2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_4444_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d_565_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_5551_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_4444_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d_565_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_5551_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_3d_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darray11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darray11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2darray11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2darray11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayi11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayi11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayi11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayui11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayi11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_4444_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray_565_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_5551_11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2darray_ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2darray_ps.h"
+} // namespace
+
+enum Blit11::BlitShaderOperation : unsigned int
+{
+ RGBAF,
+ BGRAF,
+ RGBF,
+ RGF,
+ RF,
+ ALPHA,
+ LUMA,
+ LUMAALPHA,
+ RGBAUI,
+ RGBAI,
+ RGBUI,
+ RGBI,
+ RGUI,
+ RGI,
+ RUI,
+ RI,
+ RGBAF_PREMULTIPLY,
+ RGBAF_UNMULTIPLY,
+ RGBF_PREMULTIPLY,
+ RGBF_UNMULTIPLY,
+ RGBAF_TOUI,
+ RGBAF_TOUI_PREMULTIPLY,
+ RGBAF_TOUI_UNMULTIPLY,
+ RGBF_TOUI,
+ RGBF_TOUI_PREMULTIPLY,
+ RGBF_TOUI_UNMULTIPLY,
+ RGBAF_TOI,
+ RGBAF_TOI_PREMULTIPLY,
+ RGBAF_TOI_UNMULTIPLY,
+ RGBF_TOI,
+ RGBF_TOI_PREMULTIPLY,
+ RGBF_TOI_UNMULTIPLY,
+ LUMAF_PREMULTIPLY,
+ LUMAF_UNMULTIPLY,
+ LUMAALPHAF_PREMULTIPLY,
+ LUMAALPHAF_UNMULTIPLY,
+ RGBAF_4444,
+ RGBAF_4444_PREMULTIPLY,
+ RGBAF_4444_UNMULTIPLY,
+ RGBF_565,
+ RGBF_565_PREMULTIPLY,
+ RGBF_565_UNMULTIPLY,
+ RGBAF_5551,
+ RGBAF_5551_PREMULTIPLY,
+ RGBAF_5551_UNMULTIPLY,
+ OPERATION_INVALID
+};
+
+enum Blit11::BlitShaderType : unsigned int
+{
+ BLITSHADER_2D_RGBAF,
+ BLITSHADER_2D_BGRAF,
+ BLITSHADER_2D_RGBF,
+ BLITSHADER_2D_RGF,
+ BLITSHADER_2D_RF,
+ BLITSHADER_2D_ALPHA,
+ BLITSHADER_2D_LUMA,
+ BLITSHADER_2D_LUMAALPHA,
+ BLITSHADER_2D_RGBAUI,
+ BLITSHADER_2D_RGBAI,
+ BLITSHADER_2D_RGBUI,
+ BLITSHADER_2D_RGBI,
+ BLITSHADER_2D_RGUI,
+ BLITSHADER_2D_RGI,
+ BLITSHADER_2D_RUI,
+ BLITSHADER_2D_RI,
+ BLITSHADER_2D_RGBAF_PREMULTIPLY,
+ BLITSHADER_2D_RGBAF_UNMULTIPLY,
+ BLITSHADER_2D_RGBF_PREMULTIPLY,
+ BLITSHADER_2D_RGBF_UNMULTIPLY,
+ BLITSHADER_2D_RGBAF_TOUI,
+ BLITSHADER_2D_RGBAF_TOUI_PREMULTIPLY,
+ BLITSHADER_2D_RGBAF_TOUI_UNMULTIPLY,
+ BLITSHADER_2D_RGBF_TOUI,
+ BLITSHADER_2D_RGBF_TOUI_PREMULTIPLY,
+ BLITSHADER_2D_RGBF_TOUI_UNMULTIPLY,
+ BLITSHADER_2D_LUMAF_PREMULTIPLY,
+ BLITSHADER_2D_LUMAF_UNMULTIPLY,
+ BLITSHADER_2D_LUMAALPHAF_PREMULTIPLY,
+ BLITSHADER_2D_LUMAALPHAF_UNMULTIPLY,
+ BLITSHADER_2D_RGBAF_4444,
+ BLITSHADER_2D_RGBAF_4444_PREMULTIPLY,
+ BLITSHADER_2D_RGBAF_4444_UNMULTIPLY,
+ BLITSHADER_2D_RGBF_565,
+ BLITSHADER_2D_RGBF_565_PREMULTIPLY,
+ BLITSHADER_2D_RGBF_565_UNMULTIPLY,
+ BLITSHADER_2D_RGBAF_5551,
+ BLITSHADER_2D_RGBAF_5551_PREMULTIPLY,
+ BLITSHADER_2D_RGBAF_5551_UNMULTIPLY,
+ BLITSHADER_3D_RGBAF,
+ BLITSHADER_3D_BGRAF,
+ BLITSHADER_3D_RGBF,
+ BLITSHADER_3D_RGF,
+ BLITSHADER_3D_RF,
+ BLITSHADER_3D_ALPHA,
+ BLITSHADER_3D_LUMA,
+ BLITSHADER_3D_LUMAALPHA,
+ BLITSHADER_3D_RGBAUI,
+ BLITSHADER_3D_RGBAI,
+ BLITSHADER_3D_RGBUI,
+ BLITSHADER_3D_RGBI,
+ BLITSHADER_3D_RGUI,
+ BLITSHADER_3D_RGI,
+ BLITSHADER_3D_RUI,
+ BLITSHADER_3D_RI,
+ BLITSHADER_3D_RGBAF_PREMULTIPLY,
+ BLITSHADER_3D_RGBAF_UNMULTIPLY,
+ BLITSHADER_3D_RGBF_PREMULTIPLY,
+ BLITSHADER_3D_RGBF_UNMULTIPLY,
+ BLITSHADER_3D_RGBAF_TOUI,
+ BLITSHADER_3D_RGBAF_TOUI_PREMULTIPLY,
+ BLITSHADER_3D_RGBAF_TOUI_UNMULTIPLY,
+ BLITSHADER_3D_RGBF_TOUI,
+ BLITSHADER_3D_RGBF_TOUI_PREMULTIPLY,
+ BLITSHADER_3D_RGBF_TOUI_UNMULTIPLY,
+ BLITSHADER_3D_RGBAF_TOI,
+ BLITSHADER_3D_RGBAF_TOI_PREMULTIPLY,
+ BLITSHADER_3D_RGBAF_TOI_UNMULTIPLY,
+ BLITSHADER_3D_RGBF_TOI,
+ BLITSHADER_3D_RGBF_TOI_PREMULTIPLY,
+ BLITSHADER_3D_RGBF_TOI_UNMULTIPLY,
+ BLITSHADER_3D_LUMAF_PREMULTIPLY,
+ BLITSHADER_3D_LUMAF_UNMULTIPLY,
+ BLITSHADER_3D_LUMAALPHAF_PREMULTIPLY,
+ BLITSHADER_3D_LUMAALPHAF_UNMULTIPLY,
+ BLITSHADER_3D_RGBAF_4444,
+ BLITSHADER_3D_RGBAF_4444_PREMULTIPLY,
+ BLITSHADER_3D_RGBAF_4444_UNMULTIPLY,
+ BLITSHADER_3D_RGBF_565,
+ BLITSHADER_3D_RGBF_565_PREMULTIPLY,
+ BLITSHADER_3D_RGBF_565_UNMULTIPLY,
+ BLITSHADER_3D_RGBAF_5551,
+ BLITSHADER_3D_RGBAF_5551_PREMULTIPLY,
+ BLITSHADER_3D_RGBAF_5551_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF,
+ BLITSHADER_2DARRAY_BGRAF,
+ BLITSHADER_2DARRAY_RGBF,
+ BLITSHADER_2DARRAY_RGF,
+ BLITSHADER_2DARRAY_RF,
+ BLITSHADER_2DARRAY_ALPHA,
+ BLITSHADER_2DARRAY_LUMA,
+ BLITSHADER_2DARRAY_LUMAALPHA,
+ BLITSHADER_2DARRAY_RGBAUI,
+ BLITSHADER_2DARRAY_RGBAI,
+ BLITSHADER_2DARRAY_RGBUI,
+ BLITSHADER_2DARRAY_RGBI,
+ BLITSHADER_2DARRAY_RGUI,
+ BLITSHADER_2DARRAY_RGI,
+ BLITSHADER_2DARRAY_RUI,
+ BLITSHADER_2DARRAY_RI,
+ BLITSHADER_2DARRAY_RGBAF_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_TOUI,
+ BLITSHADER_2DARRAY_RGBAF_TOUI_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_TOUI_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_TOUI,
+ BLITSHADER_2DARRAY_RGBF_TOUI_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_TOUI_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_TOI,
+ BLITSHADER_2DARRAY_RGBAF_TOI_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_TOI_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_TOI,
+ BLITSHADER_2DARRAY_RGBF_TOI_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_TOI_UNMULTIPLY,
+ BLITSHADER_2DARRAY_LUMAF_PREMULTIPLY,
+ BLITSHADER_2DARRAY_LUMAF_UNMULTIPLY,
+ BLITSHADER_2DARRAY_LUMAALPHAF_PREMULTIPLY,
+ BLITSHADER_2DARRAY_LUMAALPHAF_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_4444,
+ BLITSHADER_2DARRAY_RGBAF_4444_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_4444_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_565,
+ BLITSHADER_2DARRAY_RGBF_565_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBF_565_UNMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_5551,
+ BLITSHADER_2DARRAY_RGBAF_5551_PREMULTIPLY,
+ BLITSHADER_2DARRAY_RGBAF_5551_UNMULTIPLY,
+ BLITSHADER_INVALID
+};
+
+Blit11::BlitShaderType Blit11::getBlitShaderType(BlitShaderOperation operation, ShaderDimension dimension)
+{
+ switch(operation)
+ {
+ case RGBAF:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case BGRAF:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_BGRAF;
+ case SHADER_3D:
+ return BLITSHADER_3D_BGRAF;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_BGRAF;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGF:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGF;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGF;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGF;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RF:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RF;
+ case SHADER_3D:
+ return BLITSHADER_3D_RF;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RF;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case ALPHA:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_ALPHA;
+ case SHADER_3D:
+ return BLITSHADER_3D_ALPHA;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_ALPHA;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case LUMA:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_LUMA;
+ case SHADER_3D:
+ return BLITSHADER_3D_LUMA;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_LUMA;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case LUMAALPHA:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_LUMAALPHA;
+ case SHADER_3D:
+ return BLITSHADER_3D_LUMAALPHA;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_LUMAALPHA;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAUI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAUI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAUI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAUI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBUI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBUI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBUI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBUI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGUI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGUI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGUI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGUI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RUI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RUI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RUI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RUI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_TOUI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_TOUI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_TOUI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_TOUI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_TOUI_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_TOUI_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_TOUI_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_TOUI_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_TOUI_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_TOUI_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_TOUI_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_TOUI_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_TOUI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_TOUI;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_TOUI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_TOUI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_TOUI_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_TOUI_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_TOUI_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_TOUI_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_TOUI_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_TOUI_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_TOUI_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_TOUI_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_TOI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_INVALID;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_TOI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_TOI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_TOI_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_INVALID;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_TOI_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_TOI_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_TOI_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_INVALID;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_TOI_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_TOI_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_TOI:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_INVALID;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_TOI;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_TOI;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_TOI_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_INVALID;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_TOI_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_TOI_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_TOI_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_INVALID;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_TOI_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_TOI_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case LUMAF_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_LUMAF_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_LUMAF_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_LUMAF_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case LUMAF_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_LUMAF_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_LUMAF_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_LUMAF_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case LUMAALPHAF_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_LUMAALPHAF_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_LUMAALPHAF_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_LUMAALPHAF_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case LUMAALPHAF_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_LUMAALPHAF_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_LUMAALPHAF_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_LUMAALPHAF_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_4444:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_4444;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_4444;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_4444;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_4444_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_4444_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_4444_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_4444_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_4444_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_4444_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_4444_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_4444_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_565:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_565;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_565;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_565;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_565_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_565_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_565_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_565_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBF_565_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBF_565_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBF_565_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBF_565_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_5551:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_5551;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_5551;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_5551;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_5551_PREMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_5551_PREMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_5551_PREMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_5551_PREMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ case RGBAF_5551_UNMULTIPLY:
+ switch (dimension)
+ {
+ case SHADER_2D:
+ return BLITSHADER_2D_RGBAF_5551_UNMULTIPLY;
+ case SHADER_3D:
+ return BLITSHADER_3D_RGBAF_5551_UNMULTIPLY;
+ case SHADER_2DARRAY:
+ return BLITSHADER_2DARRAY_RGBAF_5551_UNMULTIPLY;
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+ default:
+ UNREACHABLE();
+ return BLITSHADER_INVALID;
+ }
+}
+
+angle::Result Blit11::mapBlitShader(const gl::Context *context,
+ BlitShaderType blitShaderType)
+{
+ switch(blitShaderType)
+ {
+ case BLITSHADER_2D_RGBAF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGBA2D),
+ "Blit11 2D PassthroughRGBA2D pixel shader"));
+ break;
+ case BLITSHADER_2D_BGRAF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGBA2D),
+ "Blit11 2D PassthroughRGBA2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGB2D),
+ "Blit11 2D PassthroughRGB2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRG2D),
+ "Blit11 2D PassthroughRG2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughR2D),
+ "Blit11 2D PassthroughR2D pixel shader"));
+ break;
+ case BLITSHADER_2D_ALPHA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughA2D),
+ "Blit11 2D PassthroughA2D pixel shader"));
+ break;
+ case BLITSHADER_2D_LUMA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughLum2D),
+ "Blit11 2D PassthroughLum2D pixel shader"));
+ break;
+ case BLITSHADER_2D_LUMAALPHA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughLumAlpha2D),
+ "Blit11 2D PassthroughLumAlpha2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGBA2DUI),
+ "Blit11 2D PassthroughRGBA2DUI pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGBA2DI),
+ "Blit11 2D PassthroughRGBA2DI pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGB2DUI),
+ "Blit11 2D PassthroughRGB2DUI pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGB2DI),
+ "Blit11 2D PassthroughRGB2DI pixel shader"));
+ break;
+ case BLITSHADER_2D_RGUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRG2DUI),
+ "Blit11 2D PassthroughRG2DUI pixel shader"));
+ break;
+ case BLITSHADER_2D_RGI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRG2DI),
+ "Blit11 2D PassthroughRG2DI pixel shader"));
+ break;
+ case BLITSHADER_2D_RUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughR2DUI),
+ "Blit11 2D PassthroughR2DUI pixel shader"));
+ break;
+ case BLITSHADER_2D_RI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughR2DI),
+ "Blit11 2D PassthroughR2DI pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_PM_RGBA_2D),
+ "Blit11 2D FtoF PM RGBA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_UM_RGBA_2D),
+ "Blit11 2D FtoF UM RGBA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_PM_RGB_2D),
+ "Blit11 2D FtoF PM RGB 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_UM_RGB_2D),
+ "Blit11 2D FtoF UM RGB 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_TOUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoU_PT_RGBA_2D),
+ "Blit11 2D FtoU PT RGBA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_TOUI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoU_PM_RGBA_2D),
+ "Blit11 2D FtoU PM RGBA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_TOUI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoU_UM_RGBA_2D),
+ "Blit11 2D FtoU UM RGBA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_TOUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoU_PT_RGB_2D),
+ "Blit11 2D FtoU PT RGB 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_TOUI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoU_PM_RGB_2D),
+ "Blit11 2D FtoU PM RGB 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_TOUI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoU_UM_RGB_2D),
+ "Blit11 2D FtoU UM RGB 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_LUMAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_PM_LUMA_2D),
+ "Blit11 2D FtoF PM LUMA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_LUMAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_UM_LUMA_2D),
+ "Blit11 2D FtoF UM LUMA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_LUMAALPHAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_PM_LUMAALPHA_2D),
+ "Blit11 2D FtoF PM LUMAALPHA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_LUMAALPHAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_UM_LUMAALPHA_2D),
+ "Blit11 2D FtoF UM LUMAALPHA 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_4444:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGBA2D_4444),
+ "Blit11 2D PassthroughRGBA2D 4444 pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_4444_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_PM_RGBA_4444_2D),
+ "Blit11 2D FtoF PM RGBA 4444 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_4444_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_UM_RGBA_4444_2D),
+ "Blit11 2D FtoF UM RGBA 4444 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_565:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGB2D_565),
+ "Blit11 2D PassthroughRGB2D 565 pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_565_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_PM_RGB_565_2D),
+ "Blit11 2D FtoF PM RGB 565 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBF_565_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_UM_RGB_565_2D),
+ "Blit11 2D FtoF UM RGB 565 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_5551:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_PassthroughRGBA2D_5551),
+ "Blit11 2D PassthroughRGBA2D 5551 pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_5551_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_PM_RGBA_5551_2D),
+ "Blit11 2D FtoF PM RGBA 5551 2D pixel shader"));
+ break;
+ case BLITSHADER_2D_RGBAF_5551_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2D,
+ ShaderData(g_PS_FtoF_UM_RGBA_5551_2D),
+ "Blit11 2D FtoF UM RGBA 5551 2D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGBA3D),
+ "Blit11 3D PassthroughRGBA3D pixel shader"));
+ break;
+ case BLITSHADER_3D_BGRAF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGBA3D),
+ "Blit11 3D PassthroughRGBA3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGB3D),
+ "Blit11 3D PassthroughRGB3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRG3D),
+ "Blit11 3D PassthroughRG3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughR3D),
+ "Blit11 3D PassthroughR3D pixel shader"));
+ break;
+ case BLITSHADER_3D_ALPHA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGBA3D),
+ "Blit11 3D PassthroughRGBA3D pixel shader"));
+ break;
+ case BLITSHADER_3D_LUMA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughLum3D),
+ "Blit11 3D PassthroughLum3D pixel shader"));
+ break;
+ case BLITSHADER_3D_LUMAALPHA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughLumAlpha3D),
+ "Blit11 3D PassthroughLumAlpha3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGBA3DUI),
+ "Blit11 3D PassthroughRGBA3DUI pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGBA3DI),
+ "Blit11 3D PassthroughRGBA3DI pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGB3DUI),
+ "Blit11 3D PassthroughRGB3DUI pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGB3DI),
+ "Blit11 3D PassthroughRGB3DI pixel shader"));
+ break;
+ case BLITSHADER_3D_RGUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRG3DUI),
+ "Blit11 3D PassthroughRG3DUI pixel shader"));
+ break;
+ case BLITSHADER_3D_RGI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRG3DI),
+ "Blit11 3D PassthroughRG3DI pixel shader"));
+ break;
+ case BLITSHADER_3D_RUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughR3DUI),
+ "Blit11 3D PassthroughR3DUI pixel shader"));
+ break;
+ case BLITSHADER_3D_RI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughR3DI),
+ "Blit11 3D PassthroughR3DI pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_PM_RGBA_3D),
+ "Blit11 3D FtoF PM RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_UM_RGBA_3D),
+ "Blit11 3D FtoF UM RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_PM_RGB_3D),
+ "Blit11 3D FtoF PM RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_UM_RGB_3D),
+ "Blit11 3D FtoF UM RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_TOUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoU_PT_RGBA_3D),
+ "Blit11 3D FtoU PT RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_TOUI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoU_PM_RGBA_3D),
+ "Blit11 3D FtoU PM RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_TOUI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoU_UM_RGBA_3D),
+ "Blit11 3D FtoU UM RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_TOUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoU_PT_RGB_3D),
+ "Blit11 3D FtoU PT RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_TOUI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoU_PM_RGB_3D),
+ "Blit11 3D FtoU PM RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_TOUI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoU_UM_RGB_3D),
+ "Blit11 3D FtoU UM RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_TOI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoI_PT_RGBA_3D),
+ "Blit11 3D FtoI PT RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_TOI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoI_PM_RGBA_3D),
+ "Blit11 3D FtoI PM RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_TOI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoI_UM_RGBA_3D),
+ "Blit11 3D FtoI UM RGBA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_TOI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoI_PT_RGB_3D),
+ "Blit11 3D FtoI PT RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_TOI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoI_PM_RGB_3D),
+ "Blit11 3D FtoI PM RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_TOI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoI_UM_RGB_3D),
+ "Blit11 3D FtoI UM RGB 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_LUMAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_PM_LUMA_3D),
+ "Blit11 3D FtoF PM LUMA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_LUMAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_UM_LUMA_3D),
+ "Blit11 3D FtoF UM LUMA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_LUMAALPHAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_PM_LUMAALPHA_3D),
+ "Blit11 3D FtoF PM LUMAALPHA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_LUMAALPHAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_UM_LUMAALPHA_3D),
+ "Blit11 3D FtoF UM LUMAALPHA 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_4444:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGBA3D_4444),
+ "Blit11 3D PassthroughRGBA3D 4444 pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_4444_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_PM_RGBA_4444_3D),
+ "Blit11 3D FtoF PM RGBA 4444 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_4444_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_UM_RGBA_4444_3D),
+ "Blit11 3D FtoF UM RGBA 4444 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_565:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGB3D_565),
+ "Blit11 3D PassthroughRGB3D 565 pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_565_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_PM_RGB_565_3D),
+ "Blit11 3D FtoF PM RGB 565 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBF_565_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_UM_RGB_565_3D),
+ "Blit11 3D FtoF UM RGB 565 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_5551:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_PassthroughRGBA3D_5551),
+ "Blit11 3D PassthroughRGBA3D 5551 pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_5551_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_PM_RGBA_5551_3D),
+ "Blit11 3D FtoF PM RGBA 5551 3D pixel shader"));
+ break;
+ case BLITSHADER_3D_RGBAF_5551_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_3D,
+ ShaderData(g_PS_FtoF_UM_RGBA_5551_3D),
+ "Blit11 3D FtoF UM RGBA 5551 3D pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGBA2DArray),
+ "Blit11 2DArray PassthroughRGBA2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_BGRAF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGBA2DArray),
+ "Blit11 2DArray PassthroughRGBA2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGB2DArray),
+ "Blit11 2DArray PassthroughRGB2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRG2DArray),
+ "Blit11 2DArray PassthroughRG2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RF:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughR2DArray),
+ "Blit11 2DArray PassthroughR2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_ALPHA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGBA2DArray),
+ "Blit11 2DArray PassthroughRGBA2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_LUMA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughLum2DArray),
+ "Blit11 2DArray PassthroughLum2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_LUMAALPHA:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughLumAlpha2DArray),
+ "Blit11 2DArray PassthroughLumAlpha2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGBA2DArrayUI),
+ "Blit11 2DArray PassthroughRGBA2DArrayUI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGBA2DArrayI),
+ "Blit11 2DArray PassthroughRGBA2DArrayI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGB2DArrayUI),
+ "Blit11 2DArray PassthroughRGB2DArrayUI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGB2DArrayI),
+ "Blit11 2DArray PassthroughRGB2DArrayI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRG2DArrayUI),
+ "Blit11 2DArray PassthroughRG2DArrayUI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRG2DArrayI),
+ "Blit11 2DArray PassthroughRG2DArrayI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughR2DArrayUI),
+ "Blit11 2DArray PassthroughR2DArrayUI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughR2DArrayI),
+ "Blit11 2DArray PassthroughR2DArrayI pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_PM_RGBA_2DArray),
+ "Blit11 2DArray FtoF PM RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_UM_RGBA_2DArray),
+ "Blit11 2DArray FtoF UM RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_PM_RGB_2DArray),
+ "Blit11 2DArray FtoF PM RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_UM_RGB_2DArray),
+ "Blit11 2DArray FtoF UM RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_TOUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoU_PT_RGBA_2DArray),
+ "Blit11 2DArray FtoU PT RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_TOUI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoU_PM_RGBA_2DArray),
+ "Blit11 2DArray FtoU PM RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_TOUI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoU_UM_RGBA_2DArray),
+ "Blit11 2DArray FtoU UM RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_TOUI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoU_PT_RGB_2DArray),
+ "Blit11 2DArray FtoU PT RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_TOUI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoU_PM_RGB_2DArray),
+ "Blit11 2DArray FtoU PM RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_TOUI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoU_UM_RGB_2DArray),
+ "Blit11 2DArray FtoU UM RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_TOI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoI_PT_RGBA_2DArray),
+ "Blit11 2DArray FtoI PT RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_TOI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoI_PM_RGBA_2DArray),
+ "Blit11 2DArray FtoI PM RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_TOI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoI_UM_RGBA_2DArray),
+ "Blit11 2DArray FtoI UM RGBA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_TOI:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoI_PT_RGB_2DArray),
+ "Blit11 2DArray FtoI PT RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_TOI_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoI_PM_RGB_2DArray),
+ "Blit11 2DArray FtoI PM RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_TOI_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoI_UM_RGB_2DArray),
+ "Blit11 2DArray FtoI UM RGB 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_LUMAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_PM_LUMA_2DArray),
+ "Blit11 2DArray FtoF PM LUMA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_LUMAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_UM_LUMA_2DArray),
+ "Blit11 2DArray FtoF UM LUMA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_LUMAALPHAF_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_PM_LUMAALPHA_2DArray),
+ "Blit11 2DArray FtoF PM LUMAALPHA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_LUMAALPHAF_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_UM_LUMAALPHA_2DArray),
+ "Blit11 2DArray FtoF UM LUMAALPHA 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_4444:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGBA2DArray_4444),
+ "Blit11 2DArray PassthroughRGBA2DArray 4444 pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_4444_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_PM_RGBA_4444_2DArray),
+ "Blit11 2DArray FtoF PM RGBA 4444 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_4444_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_UM_RGBA_4444_2DArray),
+ "Blit11 2DArray FtoF UM RGBA 4444 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_565:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGB2DArray_565),
+ "Blit11 2DArray PassthroughRGB2DArray 565 pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_565_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_PM_RGB_565_2DArray),
+ "Blit11 2DArray FtoF PM RGB 565 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBF_565_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_UM_RGB_565_2DArray),
+ "Blit11 2DArray FtoF UM RGB 565 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_5551:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_PassthroughRGBA2DArray_5551),
+ "Blit11 2DArray PassthroughRGBA2DArray 5551 pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_5551_PREMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_PM_RGBA_5551_2DArray),
+ "Blit11 2DArray FtoF PM RGBA 5551 2DArray pixel shader"));
+ break;
+ case BLITSHADER_2DARRAY_RGBAF_5551_UNMULTIPLY:
+ ANGLE_TRY(addBlitShaderToMap(context, blitShaderType, SHADER_2DARRAY,
+ ShaderData(g_PS_FtoF_UM_RGBA_5551_2DArray),
+ "Blit11 2DArray FtoF UM RGBA 5551 2DArray pixel shader"));
+ break;
+ default:
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ }
+
+ return angle::Result::Continue;
+}
+
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
new file mode 100644
index 0000000000..bbb034be5b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
@@ -0,0 +1,1677 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer11.cpp Defines the Buffer11 class.
+
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+
+#include <memory>
+
+#include "common/MemoryBuffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/IndexDataManager.h"
+#include "libANGLE/renderer/d3d/VertexDataManager.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace rx
+{
+
+namespace
+{
+
+template <typename T>
+GLuint ReadIndexValueFromIndices(const uint8_t *data, size_t index)
+{
+ return reinterpret_cast<const T *>(data)[index];
+}
+typedef GLuint (*ReadIndexValueFunction)(const uint8_t *data, size_t index);
+
+enum class CopyResult
+{
+ RECREATED,
+ NOT_RECREATED,
+};
+
+void CalculateConstantBufferParams(GLintptr offset,
+ GLsizeiptr size,
+ UINT *outFirstConstant,
+ UINT *outNumConstants)
+{
+ // The offset must be aligned to 256 bytes (should have been enforced by glBindBufferRange).
+ ASSERT(offset % 256 == 0);
+
+ // firstConstant and numConstants are expressed in constants of 16-bytes. Furthermore they must
+ // be a multiple of 16 constants.
+ *outFirstConstant = static_cast<UINT>(offset / 16);
+
+ // The GL size is not required to be aligned to a 256 bytes boundary.
+ // Round the size up to a 256 bytes boundary then express the results in constants of 16-bytes.
+ *outNumConstants = static_cast<UINT>(rx::roundUp(size, static_cast<GLsizeiptr>(256)) / 16);
+
+ // Since the size is rounded up, firstConstant + numConstants may be bigger than the actual size
+ // of the buffer. This behaviour is explictly allowed according to the documentation on
+ // ID3D11DeviceContext1::PSSetConstantBuffers1
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx
+}
+
+} // anonymous namespace
+
+namespace gl_d3d11
+{
+
+D3D11_MAP GetD3DMapTypeFromBits(BufferUsage usage, GLbitfield access)
+{
+ bool readBit = ((access & GL_MAP_READ_BIT) != 0);
+ bool writeBit = ((access & GL_MAP_WRITE_BIT) != 0);
+
+ ASSERT(readBit || writeBit);
+
+ // Note : we ignore the discard bit, because in D3D11, staging buffers
+ // don't accept the map-discard flag (discard only works for DYNAMIC usage)
+
+ if (readBit && !writeBit)
+ {
+ return D3D11_MAP_READ;
+ }
+ else if (writeBit && !readBit)
+ {
+ // Special case for uniform storage - we only allow full buffer updates.
+ return usage == BUFFER_USAGE_UNIFORM ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE;
+ }
+ else if (writeBit && readBit)
+ {
+ return D3D11_MAP_READ_WRITE;
+ }
+ else
+ {
+ UNREACHABLE();
+ return D3D11_MAP_READ;
+ }
+}
+} // namespace gl_d3d11
+
+// Each instance of Buffer11::BufferStorage is specialized for a class of D3D binding points
+// - vertex/transform feedback buffers
+// - index buffers
+// - pixel unpack buffers
+// - uniform buffers
+class Buffer11::BufferStorage : angle::NonCopyable
+{
+ public:
+ virtual ~BufferStorage() {}
+
+ DataRevision getDataRevision() const { return mRevision; }
+ BufferUsage getUsage() const { return mUsage; }
+ size_t getSize() const { return mBufferSize; }
+ void setDataRevision(DataRevision rev) { mRevision = rev; }
+
+ virtual bool isCPUAccessible(GLbitfield access) const = 0;
+
+ virtual bool isGPUAccessible() const = 0;
+
+ virtual angle::Result copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut) = 0;
+ virtual angle::Result resize(const gl::Context *context, size_t size, bool preserveData) = 0;
+
+ virtual angle::Result map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut) = 0;
+ virtual void unmap() = 0;
+
+ angle::Result setData(const gl::Context *context,
+ const uint8_t *data,
+ size_t offset,
+ size_t size);
+
+ protected:
+ BufferStorage(Renderer11 *renderer, BufferUsage usage);
+
+ Renderer11 *mRenderer;
+ DataRevision mRevision;
+ const BufferUsage mUsage;
+ size_t mBufferSize;
+};
+
+// A native buffer storage represents an underlying D3D11 buffer for a particular
+// type of storage.
+class Buffer11::NativeStorage : public Buffer11::BufferStorage
+{
+ public:
+ NativeStorage(Renderer11 *renderer, BufferUsage usage, const angle::Subject *onStorageChanged);
+ ~NativeStorage() override;
+
+ bool isCPUAccessible(GLbitfield access) const override;
+
+ bool isGPUAccessible() const override { return true; }
+
+ const d3d11::Buffer &getBuffer() const { return mBuffer; }
+ angle::Result copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut) override;
+ angle::Result resize(const gl::Context *context, size_t size, bool preserveData) override;
+
+ angle::Result map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut) override;
+ void unmap() override;
+
+ angle::Result getSRVForFormat(const gl::Context *context,
+ DXGI_FORMAT srvFormat,
+ const d3d11::ShaderResourceView **srvOut);
+ angle::Result getRawUAV(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ d3d11::UnorderedAccessView **uavOut);
+
+ private:
+ static void FillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
+ Renderer11 *renderer,
+ BufferUsage usage,
+ unsigned int bufferSize);
+ void clearSRVs();
+ void clearUAVs();
+
+ d3d11::Buffer mBuffer;
+ const angle::Subject *mOnStorageChanged;
+ std::map<DXGI_FORMAT, d3d11::ShaderResourceView> mBufferResourceViews;
+ std::map<std::pair<unsigned int, unsigned int>, d3d11::UnorderedAccessView> mBufferRawUAVs;
+};
+
+// A emulated indexed buffer storage represents an underlying D3D11 buffer for data
+// that has been expanded to match the indices list used. This storage is only
+// used for FL9_3 pointsprite rendering emulation.
+class Buffer11::EmulatedIndexedStorage : public Buffer11::BufferStorage
+{
+ public:
+ EmulatedIndexedStorage(Renderer11 *renderer);
+ ~EmulatedIndexedStorage() override;
+
+ bool isCPUAccessible(GLbitfield access) const override { return true; }
+
+ bool isGPUAccessible() const override { return false; }
+
+ angle::Result getBuffer(const gl::Context *context,
+ SourceIndexData *indexInfo,
+ const TranslatedAttribute &attribute,
+ GLint startVertex,
+ const d3d11::Buffer **bufferOut);
+
+ angle::Result copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut) override;
+
+ angle::Result resize(const gl::Context *context, size_t size, bool preserveData) override;
+
+ angle::Result map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut) override;
+ void unmap() override;
+
+ private:
+ d3d11::Buffer mBuffer; // contains expanded data for use by D3D
+ angle::MemoryBuffer mMemoryBuffer; // original data (not expanded)
+ angle::MemoryBuffer mIndicesMemoryBuffer; // indices data
+};
+
+// Pack storage represents internal storage for pack buffers. We implement pack buffers
+// as CPU memory, tied to a staging texture, for asynchronous texture readback.
+class Buffer11::PackStorage : public Buffer11::BufferStorage
+{
+ public:
+ explicit PackStorage(Renderer11 *renderer);
+ ~PackStorage() override;
+
+ bool isCPUAccessible(GLbitfield access) const override { return true; }
+
+ bool isGPUAccessible() const override { return false; }
+
+ angle::Result copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut) override;
+ angle::Result resize(const gl::Context *context, size_t size, bool preserveData) override;
+
+ angle::Result map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut) override;
+ void unmap() override;
+
+ angle::Result packPixels(const gl::Context *context,
+ const gl::FramebufferAttachment &readAttachment,
+ const PackPixelsParams &params);
+
+ private:
+ angle::Result flushQueuedPackCommand(const gl::Context *context);
+
+ TextureHelper11 mStagingTexture;
+ angle::MemoryBuffer mMemoryBuffer;
+ std::unique_ptr<PackPixelsParams> mQueuedPackCommand;
+ PackPixelsParams mPackParams;
+ bool mDataModified;
+};
+
+// System memory storage stores a CPU memory buffer with our buffer data.
+// For dynamic data, it's much faster to update the CPU memory buffer than
+// it is to update a D3D staging buffer and read it back later.
+class Buffer11::SystemMemoryStorage : public Buffer11::BufferStorage
+{
+ public:
+ explicit SystemMemoryStorage(Renderer11 *renderer);
+ ~SystemMemoryStorage() override {}
+
+ bool isCPUAccessible(GLbitfield access) const override { return true; }
+
+ bool isGPUAccessible() const override { return false; }
+
+ angle::Result copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut) override;
+ angle::Result resize(const gl::Context *context, size_t size, bool preserveData) override;
+
+ angle::Result map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut) override;
+ void unmap() override;
+
+ angle::MemoryBuffer *getSystemCopy() { return &mSystemCopy; }
+
+ protected:
+ angle::MemoryBuffer mSystemCopy;
+};
+
+Buffer11::Buffer11(const gl::BufferState &state, Renderer11 *renderer)
+ : BufferD3D(state, renderer),
+ mRenderer(renderer),
+ mSize(0),
+ mMappedStorage(nullptr),
+ mBufferStorages({}),
+ mLatestBufferStorage(nullptr),
+ mDeallocThresholds({}),
+ mIdleness({}),
+ mConstantBufferStorageAdditionalSize(0),
+ mMaxConstantBufferLruCount(0)
+{}
+
+Buffer11::~Buffer11()
+{
+ for (BufferStorage *&storage : mBufferStorages)
+ {
+ SafeDelete(storage);
+ }
+
+ for (auto &p : mConstantBufferRangeStoragesCache)
+ {
+ SafeDelete(p.second.storage);
+ }
+
+ mRenderer->onBufferDelete(this);
+}
+
+angle::Result Buffer11::setData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ gl::BufferUsage usage)
+{
+ updateD3DBufferUsage(context, usage);
+ return setSubData(context, target, data, size, 0);
+}
+
+angle::Result Buffer11::getData(const gl::Context *context, const uint8_t **outData)
+{
+ if (mSize == 0)
+ {
+ // TODO(http://anglebug.com/2840): This ensures that we don't crash or assert in robust
+ // buffer access behavior mode if there are buffers without any data. However, technically
+ // it should still be possible to draw, with fetches from this buffer returning zero.
+ return angle::Result::Stop;
+ }
+
+ SystemMemoryStorage *systemMemoryStorage = nullptr;
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_SYSTEM_MEMORY, &systemMemoryStorage));
+
+ ASSERT(systemMemoryStorage->getSize() >= mSize);
+
+ *outData = systemMemoryStorage->getSystemCopy()->data();
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::setSubData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ size_t offset)
+{
+ size_t requiredSize = size + offset;
+
+ if (data && size > 0)
+ {
+ // Use system memory storage for dynamic buffers.
+ // Try using a constant storage for constant buffers
+ BufferStorage *writeBuffer = nullptr;
+ if (target == gl::BufferBinding::Uniform)
+ {
+ // If we are a very large uniform buffer, keep system memory storage around so that we
+ // aren't forced to read back from a constant buffer. We also check the workaround for
+ // Intel - this requires us to use system memory so we don't end up having to copy from
+ // a constant buffer to a staging buffer.
+ // TODO(jmadill): Use Context caps.
+ if (offset == 0 && size >= mSize &&
+ size <= static_cast<UINT>(mRenderer->getNativeCaps().maxUniformBlockSize) &&
+ !mRenderer->getFeatures().useSystemMemoryForConstantBuffers.enabled)
+ {
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_UNIFORM, &writeBuffer));
+ }
+ else
+ {
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_SYSTEM_MEMORY, &writeBuffer));
+ }
+ }
+ else if (supportsDirectBinding())
+ {
+ ANGLE_TRY(getStagingStorage(context, &writeBuffer));
+ }
+ else
+ {
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_SYSTEM_MEMORY, &writeBuffer));
+ }
+
+ ASSERT(writeBuffer);
+
+ // Explicitly resize the staging buffer, preserving data if the new data will not
+ // completely fill the buffer
+ if (writeBuffer->getSize() < requiredSize)
+ {
+ bool preserveData = (offset > 0);
+ ANGLE_TRY(writeBuffer->resize(context, requiredSize, preserveData));
+ }
+
+ ANGLE_TRY(writeBuffer->setData(context, static_cast<const uint8_t *>(data), offset, size));
+ onStorageUpdate(writeBuffer);
+ }
+
+ mSize = std::max(mSize, requiredSize);
+ invalidateStaticData(context);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::copySubData(const gl::Context *context,
+ BufferImpl *source,
+ GLintptr sourceOffset,
+ GLintptr destOffset,
+ GLsizeiptr size)
+{
+ Buffer11 *sourceBuffer = GetAs<Buffer11>(source);
+ ASSERT(sourceBuffer != nullptr);
+
+ BufferStorage *copyDest = nullptr;
+ ANGLE_TRY(getLatestBufferStorage(context, &copyDest));
+
+ if (!copyDest)
+ {
+ ANGLE_TRY(getStagingStorage(context, &copyDest));
+ }
+
+ BufferStorage *copySource = nullptr;
+ ANGLE_TRY(sourceBuffer->getLatestBufferStorage(context, &copySource));
+
+ if (!copySource)
+ {
+ ANGLE_TRY(sourceBuffer->getStagingStorage(context, &copySource));
+ }
+
+ ASSERT(copySource && copyDest);
+
+ // A staging buffer is needed if there is no cpu-cpu or gpu-gpu copy path avaiable.
+ if (!copyDest->isGPUAccessible() && !copySource->isCPUAccessible(GL_MAP_READ_BIT))
+ {
+ ANGLE_TRY(sourceBuffer->getStagingStorage(context, &copySource));
+ }
+ else if (!copySource->isGPUAccessible() && !copyDest->isCPUAccessible(GL_MAP_WRITE_BIT))
+ {
+ ANGLE_TRY(getStagingStorage(context, &copyDest));
+ }
+
+ // D3D11 does not allow overlapped copies until 11.1, and only if the
+ // device supports D3D11_FEATURE_DATA_D3D11_OPTIONS::CopyWithOverlap
+ // Get around this via a different source buffer
+ if (copySource == copyDest)
+ {
+ if (copySource->getUsage() == BUFFER_USAGE_STAGING)
+ {
+ ANGLE_TRY(
+ getBufferStorage(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK, &copySource));
+ }
+ else
+ {
+ ANGLE_TRY(getStagingStorage(context, &copySource));
+ }
+ }
+
+ CopyResult copyResult = CopyResult::NOT_RECREATED;
+ ANGLE_TRY(copyDest->copyFromStorage(context, copySource, sourceOffset, size, destOffset,
+ &copyResult));
+ onStorageUpdate(copyDest);
+
+ mSize = std::max<size_t>(mSize, destOffset + size);
+ invalidateStaticData(context);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::map(const gl::Context *context, GLenum access, void **mapPtr)
+{
+ // GL_OES_mapbuffer uses an enum instead of a bitfield for it's access, convert to a bitfield
+ // and call mapRange.
+ ASSERT(access == GL_WRITE_ONLY_OES);
+ return mapRange(context, 0, mSize, GL_MAP_WRITE_BIT, mapPtr);
+}
+
+angle::Result Buffer11::mapRange(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ void **mapPtr)
+{
+ ASSERT(!mMappedStorage);
+
+ BufferStorage *latestStorage = nullptr;
+ ANGLE_TRY(getLatestBufferStorage(context, &latestStorage));
+
+ if (latestStorage && (latestStorage->getUsage() == BUFFER_USAGE_PIXEL_PACK ||
+ latestStorage->getUsage() == BUFFER_USAGE_STAGING))
+ {
+ // Latest storage is mappable.
+ mMappedStorage = latestStorage;
+ }
+ else
+ {
+ // Fall back to using the staging buffer if the latest storage does not exist or is not
+ // CPU-accessible.
+ ANGLE_TRY(getStagingStorage(context, &mMappedStorage));
+ }
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_GL_ALLOC(context11, mMappedStorage);
+
+ if ((access & GL_MAP_WRITE_BIT) > 0)
+ {
+ // Update the data revision immediately, since the data might be changed at any time
+ onStorageUpdate(mMappedStorage);
+ invalidateStaticData(context);
+ }
+
+ uint8_t *mappedBuffer = nullptr;
+ ANGLE_TRY(mMappedStorage->map(context, offset, length, access, &mappedBuffer));
+ ASSERT(mappedBuffer);
+
+ *mapPtr = static_cast<void *>(mappedBuffer);
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::unmap(const gl::Context *context, GLboolean *result)
+{
+ ASSERT(mMappedStorage);
+ mMappedStorage->unmap();
+ mMappedStorage = nullptr;
+
+ // TODO: detect if we had corruption. if so, return false.
+ *result = GL_TRUE;
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::markTransformFeedbackUsage(const gl::Context *context)
+{
+ ANGLE_TRY(markBufferUsage(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK));
+ return angle::Result::Continue;
+}
+
+void Buffer11::updateDeallocThreshold(BufferUsage usage)
+{
+ // The following strategy was tuned on the Oort online benchmark (http://oortonline.gl/)
+ // as well as a custom microbenchmark (IndexConversionPerfTest.Run/index_range_d3d11)
+
+ // First readback: 8 unmodified uses before we free buffer memory.
+ // After that, double the threshold each time until we reach the max.
+ if (mDeallocThresholds[usage] == 0)
+ {
+ mDeallocThresholds[usage] = 8;
+ }
+ else if (mDeallocThresholds[usage] < std::numeric_limits<unsigned int>::max() / 2u)
+ {
+ mDeallocThresholds[usage] *= 2u;
+ }
+ else
+ {
+ mDeallocThresholds[usage] = std::numeric_limits<unsigned int>::max();
+ }
+}
+
+// Free the storage if we decide it isn't being used very often.
+angle::Result Buffer11::checkForDeallocation(const gl::Context *context, BufferUsage usage)
+{
+ mIdleness[usage]++;
+
+ BufferStorage *&storage = mBufferStorages[usage];
+ if (storage != nullptr && mIdleness[usage] > mDeallocThresholds[usage])
+ {
+ BufferStorage *latestStorage = nullptr;
+ ANGLE_TRY(getLatestBufferStorage(context, &latestStorage));
+ if (latestStorage != storage)
+ {
+ SafeDelete(storage);
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+// Keep system memory when we are using it for the canonical version of data.
+bool Buffer11::canDeallocateSystemMemory() const
+{
+ // Must keep system memory on Intel.
+ if (mRenderer->getFeatures().useSystemMemoryForConstantBuffers.enabled)
+ {
+ return false;
+ }
+
+ return (!mBufferStorages[BUFFER_USAGE_UNIFORM] ||
+ mSize <= mRenderer->getNativeCaps().maxUniformBlockSize);
+}
+
+void Buffer11::markBufferUsage(BufferUsage usage)
+{
+ mIdleness[usage] = 0;
+}
+
+angle::Result Buffer11::markBufferUsage(const gl::Context *context, BufferUsage usage)
+{
+ BufferStorage *bufferStorage = nullptr;
+ ANGLE_TRY(getBufferStorage(context, usage, &bufferStorage));
+
+ if (bufferStorage)
+ {
+ onStorageUpdate(bufferStorage);
+ }
+
+ invalidateStaticData(context);
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::garbageCollection(const gl::Context *context, BufferUsage currentUsage)
+{
+ if (currentUsage != BUFFER_USAGE_SYSTEM_MEMORY && canDeallocateSystemMemory())
+ {
+ ANGLE_TRY(checkForDeallocation(context, BUFFER_USAGE_SYSTEM_MEMORY));
+ }
+
+ if (currentUsage != BUFFER_USAGE_STAGING)
+ {
+ ANGLE_TRY(checkForDeallocation(context, BUFFER_USAGE_STAGING));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::getBuffer(const gl::Context *context,
+ BufferUsage usage,
+ ID3D11Buffer **bufferOut)
+{
+ NativeStorage *storage = nullptr;
+ ANGLE_TRY(getBufferStorage(context, usage, &storage));
+ *bufferOut = storage->getBuffer().get();
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::getEmulatedIndexedBuffer(const gl::Context *context,
+ SourceIndexData *indexInfo,
+ const TranslatedAttribute &attribute,
+ GLint startVertex,
+ ID3D11Buffer **bufferOut)
+{
+ ASSERT(indexInfo);
+
+ EmulatedIndexedStorage *emulatedStorage = nullptr;
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_EMULATED_INDEXED_VERTEX, &emulatedStorage));
+
+ const d3d11::Buffer *nativeBuffer = nullptr;
+ ANGLE_TRY(
+ emulatedStorage->getBuffer(context, indexInfo, attribute, startVertex, &nativeBuffer));
+ *bufferOut = nativeBuffer->get();
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::getConstantBufferRange(const gl::Context *context,
+ GLintptr offset,
+ GLsizeiptr size,
+ const d3d11::Buffer **bufferOut,
+ UINT *firstConstantOut,
+ UINT *numConstantsOut)
+{
+ NativeStorage *bufferStorage = nullptr;
+
+ if (offset == 0 || mRenderer->getRenderer11DeviceCaps().supportsConstantBufferOffsets)
+ {
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_UNIFORM, &bufferStorage));
+ CalculateConstantBufferParams(offset, size, firstConstantOut, numConstantsOut);
+ }
+ else
+ {
+ ANGLE_TRY(getConstantBufferRangeStorage(context, offset, size, &bufferStorage));
+ *firstConstantOut = 0;
+ *numConstantsOut = 0;
+ }
+
+ *bufferOut = &bufferStorage->getBuffer();
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::markRawBufferUsage(const gl::Context *context)
+{
+ ANGLE_TRY(markBufferUsage(context, BUFFER_USAGE_RAW_UAV));
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::getRawUAVRange(const gl::Context *context,
+ GLintptr offset,
+ GLsizeiptr size,
+ d3d11::UnorderedAccessView **uavOut)
+{
+ NativeStorage *nativeStorage = nullptr;
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_RAW_UAV, &nativeStorage));
+
+ return nativeStorage->getRawUAV(context, static_cast<unsigned int>(offset),
+ static_cast<unsigned int>(size), uavOut);
+}
+
+angle::Result Buffer11::getSRV(const gl::Context *context,
+ DXGI_FORMAT srvFormat,
+ const d3d11::ShaderResourceView **srvOut)
+{
+ NativeStorage *nativeStorage = nullptr;
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_PIXEL_UNPACK, &nativeStorage));
+ return nativeStorage->getSRVForFormat(context, srvFormat, srvOut);
+}
+
+angle::Result Buffer11::packPixels(const gl::Context *context,
+ const gl::FramebufferAttachment &readAttachment,
+ const PackPixelsParams &params)
+{
+ PackStorage *packStorage = nullptr;
+ ANGLE_TRY(getBufferStorage(context, BUFFER_USAGE_PIXEL_PACK, &packStorage));
+
+ ASSERT(packStorage);
+ ANGLE_TRY(packStorage->packPixels(context, readAttachment, params));
+ onStorageUpdate(packStorage);
+
+ return angle::Result::Continue;
+}
+
+size_t Buffer11::getTotalCPUBufferMemoryBytes() const
+{
+ size_t allocationSize = 0;
+
+ BufferStorage *staging = mBufferStorages[BUFFER_USAGE_STAGING];
+ allocationSize += staging ? staging->getSize() : 0;
+
+ BufferStorage *sysMem = mBufferStorages[BUFFER_USAGE_SYSTEM_MEMORY];
+ allocationSize += sysMem ? sysMem->getSize() : 0;
+
+ return allocationSize;
+}
+
+template <typename StorageOutT>
+angle::Result Buffer11::getBufferStorage(const gl::Context *context,
+ BufferUsage usage,
+ StorageOutT **storageOut)
+{
+ ASSERT(0 <= usage && usage < BUFFER_USAGE_COUNT);
+ BufferStorage *&newStorage = mBufferStorages[usage];
+
+ if (!newStorage)
+ {
+ newStorage = allocateStorage(usage);
+ }
+
+ markBufferUsage(usage);
+
+ // resize buffer
+ if (newStorage->getSize() < mSize)
+ {
+ ANGLE_TRY(newStorage->resize(context, mSize, true));
+ }
+
+ ASSERT(newStorage);
+
+ ANGLE_TRY(updateBufferStorage(context, newStorage, 0, mSize));
+ ANGLE_TRY(garbageCollection(context, usage));
+
+ *storageOut = GetAs<StorageOutT>(newStorage);
+ return angle::Result::Continue;
+}
+
+Buffer11::BufferStorage *Buffer11::allocateStorage(BufferUsage usage)
+{
+ updateDeallocThreshold(usage);
+ switch (usage)
+ {
+ case BUFFER_USAGE_PIXEL_PACK:
+ return new PackStorage(mRenderer);
+ case BUFFER_USAGE_SYSTEM_MEMORY:
+ return new SystemMemoryStorage(mRenderer);
+ case BUFFER_USAGE_EMULATED_INDEXED_VERTEX:
+ return new EmulatedIndexedStorage(mRenderer);
+ case BUFFER_USAGE_INDEX:
+ case BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK:
+ return new NativeStorage(mRenderer, usage, this);
+ default:
+ return new NativeStorage(mRenderer, usage, nullptr);
+ }
+}
+
+angle::Result Buffer11::getConstantBufferRangeStorage(const gl::Context *context,
+ GLintptr offset,
+ GLsizeiptr size,
+ Buffer11::NativeStorage **storageOut)
+{
+ BufferStorage *newStorage;
+
+ {
+ // Keep the cacheEntry in a limited scope because it may be invalidated later in the code if
+ // we need to reclaim some space.
+ ConstantBufferCacheEntry *cacheEntry = &mConstantBufferRangeStoragesCache[offset];
+
+ if (!cacheEntry->storage)
+ {
+ cacheEntry->storage = allocateStorage(BUFFER_USAGE_UNIFORM);
+ cacheEntry->lruCount = ++mMaxConstantBufferLruCount;
+ }
+
+ cacheEntry->lruCount = ++mMaxConstantBufferLruCount;
+ newStorage = cacheEntry->storage;
+ }
+
+ markBufferUsage(BUFFER_USAGE_UNIFORM);
+
+ if (newStorage->getSize() < static_cast<size_t>(size))
+ {
+ size_t maximumAllowedAdditionalSize = 2 * getSize();
+
+ size_t sizeDelta = size - newStorage->getSize();
+
+ while (mConstantBufferStorageAdditionalSize + sizeDelta > maximumAllowedAdditionalSize)
+ {
+ auto iter = std::min_element(std::begin(mConstantBufferRangeStoragesCache),
+ std::end(mConstantBufferRangeStoragesCache),
+ [](const ConstantBufferCache::value_type &a,
+ const ConstantBufferCache::value_type &b) {
+ return a.second.lruCount < b.second.lruCount;
+ });
+
+ ASSERT(iter->second.storage != newStorage);
+ ASSERT(mConstantBufferStorageAdditionalSize >= iter->second.storage->getSize());
+
+ mConstantBufferStorageAdditionalSize -= iter->second.storage->getSize();
+ SafeDelete(iter->second.storage);
+ mConstantBufferRangeStoragesCache.erase(iter);
+ }
+
+ ANGLE_TRY(newStorage->resize(context, size, false));
+ mConstantBufferStorageAdditionalSize += sizeDelta;
+
+ // We don't copy the old data when resizing the constant buffer because the data may be
+ // out-of-date therefore we reset the data revision and let updateBufferStorage() handle the
+ // copy.
+ newStorage->setDataRevision(0);
+ }
+
+ ANGLE_TRY(updateBufferStorage(context, newStorage, offset, size));
+ ANGLE_TRY(garbageCollection(context, BUFFER_USAGE_UNIFORM));
+ *storageOut = GetAs<NativeStorage>(newStorage);
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::updateBufferStorage(const gl::Context *context,
+ BufferStorage *storage,
+ size_t sourceOffset,
+ size_t storageSize)
+{
+ BufferStorage *latestBuffer = nullptr;
+ ANGLE_TRY(getLatestBufferStorage(context, &latestBuffer));
+
+ ASSERT(storage);
+
+ if (!latestBuffer)
+ {
+ onStorageUpdate(storage);
+ return angle::Result::Continue;
+ }
+
+ if (latestBuffer->getDataRevision() <= storage->getDataRevision())
+ {
+ return angle::Result::Continue;
+ }
+
+ // Copy through a staging buffer if we're copying from or to a non-staging, mappable
+ // buffer storage. This is because we can't map a GPU buffer, and copy CPU
+ // data directly. If we're already using a staging buffer we're fine.
+ if (latestBuffer->getUsage() != BUFFER_USAGE_STAGING &&
+ storage->getUsage() != BUFFER_USAGE_STAGING &&
+ (!latestBuffer->isCPUAccessible(GL_MAP_READ_BIT) ||
+ !storage->isCPUAccessible(GL_MAP_WRITE_BIT)))
+ {
+ NativeStorage *stagingBuffer = nullptr;
+ ANGLE_TRY(getStagingStorage(context, &stagingBuffer));
+
+ CopyResult copyResult = CopyResult::NOT_RECREATED;
+ ANGLE_TRY(stagingBuffer->copyFromStorage(context, latestBuffer, 0, latestBuffer->getSize(),
+ 0, &copyResult));
+ onCopyStorage(stagingBuffer, latestBuffer);
+
+ latestBuffer = stagingBuffer;
+ }
+
+ CopyResult copyResult = CopyResult::NOT_RECREATED;
+ ANGLE_TRY(
+ storage->copyFromStorage(context, latestBuffer, sourceOffset, storageSize, 0, &copyResult));
+ // If the D3D buffer has been recreated, we should update our serial.
+ if (copyResult == CopyResult::RECREATED)
+ {
+ updateSerial();
+ }
+ onCopyStorage(storage, latestBuffer);
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::getLatestBufferStorage(const gl::Context *context,
+ Buffer11::BufferStorage **storageOut) const
+{
+ // resize buffer
+ if (mLatestBufferStorage && mLatestBufferStorage->getSize() < mSize)
+ {
+ ANGLE_TRY(mLatestBufferStorage->resize(context, mSize, true));
+ }
+
+ *storageOut = mLatestBufferStorage;
+ return angle::Result::Continue;
+}
+
+template <typename StorageOutT>
+angle::Result Buffer11::getStagingStorage(const gl::Context *context, StorageOutT **storageOut)
+{
+ return getBufferStorage(context, BUFFER_USAGE_STAGING, storageOut);
+}
+
+size_t Buffer11::getSize() const
+{
+ return mSize;
+}
+
+bool Buffer11::supportsDirectBinding() const
+{
+ // Do not support direct buffers for dynamic data. The streaming buffer
+ // offers better performance for data which changes every frame.
+ return (mUsage == D3DBufferUsage::STATIC);
+}
+
+void Buffer11::initializeStaticData(const gl::Context *context)
+{
+ BufferD3D::initializeStaticData(context);
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+}
+
+void Buffer11::invalidateStaticData(const gl::Context *context)
+{
+ BufferD3D::invalidateStaticData(context);
+ onStateChange(angle::SubjectMessage::SubjectChanged);
+}
+
+void Buffer11::onCopyStorage(BufferStorage *dest, BufferStorage *source)
+{
+ ASSERT(source && mLatestBufferStorage);
+ dest->setDataRevision(source->getDataRevision());
+
+ // Only update the latest buffer storage if our usage index is lower. See comment in header.
+ if (dest->getUsage() < mLatestBufferStorage->getUsage())
+ {
+ mLatestBufferStorage = dest;
+ }
+}
+
+void Buffer11::onStorageUpdate(BufferStorage *updatedStorage)
+{
+ updatedStorage->setDataRevision(updatedStorage->getDataRevision() + 1);
+ mLatestBufferStorage = updatedStorage;
+}
+
+// Buffer11::BufferStorage implementation
+
+Buffer11::BufferStorage::BufferStorage(Renderer11 *renderer, BufferUsage usage)
+ : mRenderer(renderer), mRevision(0), mUsage(usage), mBufferSize(0)
+{}
+
+angle::Result Buffer11::BufferStorage::setData(const gl::Context *context,
+ const uint8_t *data,
+ size_t offset,
+ size_t size)
+{
+ ASSERT(isCPUAccessible(GL_MAP_WRITE_BIT));
+
+ // Uniform storage can have a different internal size than the buffer size. Ensure we don't
+ // overflow.
+ size_t mapSize = std::min(size, mBufferSize - offset);
+
+ uint8_t *writePointer = nullptr;
+ ANGLE_TRY(map(context, offset, mapSize, GL_MAP_WRITE_BIT, &writePointer));
+
+ memcpy(writePointer, data, mapSize);
+
+ unmap();
+
+ return angle::Result::Continue;
+}
+
+// Buffer11::NativeStorage implementation
+
+Buffer11::NativeStorage::NativeStorage(Renderer11 *renderer,
+ BufferUsage usage,
+ const angle::Subject *onStorageChanged)
+ : BufferStorage(renderer, usage), mBuffer(), mOnStorageChanged(onStorageChanged)
+{}
+
+Buffer11::NativeStorage::~NativeStorage()
+{
+ clearSRVs();
+ clearUAVs();
+}
+
+bool Buffer11::NativeStorage::isCPUAccessible(GLbitfield access) const
+{
+ if ((access & GL_MAP_READ_BIT) != 0)
+ {
+ // Read is more exclusive than write mappability.
+ return (mUsage == BUFFER_USAGE_STAGING);
+ }
+ ASSERT((access & GL_MAP_WRITE_BIT) != 0);
+ return (mUsage == BUFFER_USAGE_STAGING || mUsage == BUFFER_USAGE_UNIFORM);
+}
+
+// Returns true if it recreates the direct buffer
+angle::Result Buffer11::NativeStorage::copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut)
+{
+ size_t requiredSize = destOffset + size;
+
+ // (Re)initialize D3D buffer if needed
+ bool preserveData = (destOffset > 0);
+ if (!mBuffer.valid() || mBufferSize < requiredSize)
+ {
+ ANGLE_TRY(resize(context, requiredSize, preserveData));
+ *resultOut = CopyResult::RECREATED;
+ }
+ else
+ {
+ *resultOut = CopyResult::NOT_RECREATED;
+ }
+
+ size_t clampedSize = size;
+ if (mUsage == BUFFER_USAGE_UNIFORM)
+ {
+ clampedSize = std::min(clampedSize, mBufferSize - destOffset);
+ }
+
+ if (clampedSize == 0)
+ {
+ return angle::Result::Continue;
+ }
+
+ if (source->getUsage() == BUFFER_USAGE_PIXEL_PACK ||
+ source->getUsage() == BUFFER_USAGE_SYSTEM_MEMORY)
+ {
+ ASSERT(source->isCPUAccessible(GL_MAP_READ_BIT) && isCPUAccessible(GL_MAP_WRITE_BIT));
+
+ // Uniform buffers must be mapped with write/discard.
+ ASSERT(!(preserveData && mUsage == BUFFER_USAGE_UNIFORM));
+
+ uint8_t *sourcePointer = nullptr;
+ ANGLE_TRY(source->map(context, sourceOffset, clampedSize, GL_MAP_READ_BIT, &sourcePointer));
+
+ auto err = setData(context, sourcePointer, destOffset, clampedSize);
+ source->unmap();
+ ANGLE_TRY(err);
+ }
+ else
+ {
+ D3D11_BOX srcBox;
+ srcBox.left = static_cast<unsigned int>(sourceOffset);
+ srcBox.right = static_cast<unsigned int>(sourceOffset + clampedSize);
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ const d3d11::Buffer *sourceBuffer = &GetAs<NativeStorage>(source)->getBuffer();
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->CopySubresourceRegion(mBuffer.get(), 0,
+ static_cast<unsigned int>(destOffset), 0, 0,
+ sourceBuffer->get(), 0, &srcBox);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::NativeStorage::resize(const gl::Context *context,
+ size_t size,
+ bool preserveData)
+{
+ if (size == 0)
+ {
+ mBuffer.reset();
+ mBufferSize = 0;
+ return angle::Result::Continue;
+ }
+
+ D3D11_BUFFER_DESC bufferDesc;
+ FillBufferDesc(&bufferDesc, mRenderer, mUsage, static_cast<unsigned int>(size));
+
+ d3d11::Buffer newBuffer;
+ ANGLE_TRY(
+ mRenderer->allocateResource(SafeGetImplAs<Context11>(context), bufferDesc, &newBuffer));
+ newBuffer.setDebugName("Buffer11::NativeStorage");
+
+ if (mBuffer.valid() && preserveData)
+ {
+ // We don't call resize if the buffer is big enough already.
+ ASSERT(mBufferSize <= size);
+
+ D3D11_BOX srcBox;
+ srcBox.left = 0;
+ srcBox.right = static_cast<unsigned int>(mBufferSize);
+ srcBox.top = 0;
+ srcBox.bottom = 1;
+ srcBox.front = 0;
+ srcBox.back = 1;
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->CopySubresourceRegion(newBuffer.get(), 0, 0, 0, 0, mBuffer.get(), 0,
+ &srcBox);
+ }
+
+ // No longer need the old buffer
+ mBuffer = std::move(newBuffer);
+
+ mBufferSize = bufferDesc.ByteWidth;
+
+ // Free the SRVs.
+ clearSRVs();
+
+ // Free the UAVs.
+ clearUAVs();
+
+ // Notify that the storage has changed.
+ if (mOnStorageChanged)
+ {
+ mOnStorageChanged->onStateChange(angle::SubjectMessage::SubjectChanged);
+ }
+
+ return angle::Result::Continue;
+}
+
+// static
+void Buffer11::NativeStorage::FillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
+ Renderer11 *renderer,
+ BufferUsage usage,
+ unsigned int bufferSize)
+{
+ bufferDesc->ByteWidth = bufferSize;
+ bufferDesc->MiscFlags = 0;
+ bufferDesc->StructureByteStride = 0;
+
+ switch (usage)
+ {
+ 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:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_VERTEX_BUFFER;
+
+ if (renderer->isES3Capable())
+ {
+ bufferDesc->BindFlags |= D3D11_BIND_STREAM_OUTPUT;
+ }
+
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_INDEX:
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ case BUFFER_USAGE_INDIRECT:
+ bufferDesc->MiscFlags = D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS;
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->BindFlags = 0;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ 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);
+
+ // Note: it seems that D3D11 allows larger buffers on some platforms, but not all.
+ // (Windows 10 seems to allow larger constant buffers, but not Windows 7)
+ bufferDesc->ByteWidth =
+ std::min<UINT>(bufferDesc->ByteWidth,
+ static_cast<UINT>(renderer->getNativeCaps().maxUniformBlockSize));
+ break;
+
+ case BUFFER_USAGE_RAW_UAV:
+ bufferDesc->MiscFlags = D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS;
+ bufferDesc->BindFlags = D3D11_BIND_UNORDERED_ACCESS;
+ bufferDesc->Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc->CPUAccessFlags = 0;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+}
+
+angle::Result Buffer11::NativeStorage::map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut)
+{
+ ASSERT(isCPUAccessible(access));
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ D3D11_MAP d3dMapType = gl_d3d11::GetD3DMapTypeFromBits(mUsage, access);
+ UINT d3dMapFlag = ((access & GL_MAP_UNSYNCHRONIZED_BIT) != 0 ? D3D11_MAP_FLAG_DO_NOT_WAIT : 0);
+
+ ANGLE_TRY(
+ mRenderer->mapResource(context, mBuffer.get(), 0, d3dMapType, d3dMapFlag, &mappedResource));
+ ASSERT(mappedResource.pData);
+ *mapPointerOut = static_cast<uint8_t *>(mappedResource.pData) + offset;
+ return angle::Result::Continue;
+}
+
+void Buffer11::NativeStorage::unmap()
+{
+ ASSERT(isCPUAccessible(GL_MAP_WRITE_BIT) || isCPUAccessible(GL_MAP_READ_BIT));
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ context->Unmap(mBuffer.get(), 0);
+}
+
+angle::Result Buffer11::NativeStorage::getSRVForFormat(const gl::Context *context,
+ DXGI_FORMAT srvFormat,
+ const d3d11::ShaderResourceView **srvOut)
+{
+ auto bufferSRVIt = mBufferResourceViews.find(srvFormat);
+
+ if (bufferSRVIt != mBufferResourceViews.end())
+ {
+ *srvOut = &bufferSRVIt->second;
+ return angle::Result::Continue;
+ }
+
+ const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(srvFormat);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC bufferSRVDesc;
+ bufferSRVDesc.Buffer.ElementOffset = 0;
+ bufferSRVDesc.Buffer.ElementWidth = static_cast<UINT>(mBufferSize) / dxgiFormatInfo.pixelBytes;
+ bufferSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
+ bufferSRVDesc.Format = srvFormat;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), bufferSRVDesc,
+ mBuffer.get(), &mBufferResourceViews[srvFormat]));
+
+ *srvOut = &mBufferResourceViews[srvFormat];
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::NativeStorage::getRawUAV(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ d3d11::UnorderedAccessView **uavOut)
+{
+ ASSERT(offset + size <= mBufferSize);
+
+ auto bufferRawUAV = mBufferRawUAVs.find({offset, size});
+ if (bufferRawUAV != mBufferRawUAVs.end())
+ {
+ *uavOut = &bufferRawUAV->second;
+ return angle::Result::Continue;
+ }
+
+ D3D11_UNORDERED_ACCESS_VIEW_DESC bufferUAVDesc;
+
+ // DXGI_FORMAT_R32_TYPELESS uses 4 bytes per element
+ constexpr int kBytesToElement = 4;
+ bufferUAVDesc.Buffer.FirstElement = offset / kBytesToElement;
+ bufferUAVDesc.Buffer.NumElements = size / kBytesToElement;
+ bufferUAVDesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW;
+ bufferUAVDesc.Format = DXGI_FORMAT_R32_TYPELESS; // Format must be DXGI_FORMAT_R32_TYPELESS,
+ // when creating Raw Unordered Access View
+ bufferUAVDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), bufferUAVDesc,
+ mBuffer.get(), &mBufferRawUAVs[{offset, size}]));
+ *uavOut = &mBufferRawUAVs[{offset, size}];
+ return angle::Result::Continue;
+}
+
+void Buffer11::NativeStorage::clearSRVs()
+{
+ mBufferResourceViews.clear();
+}
+
+void Buffer11::NativeStorage::clearUAVs()
+{
+ mBufferRawUAVs.clear();
+}
+
+// Buffer11::EmulatedIndexStorage implementation
+
+Buffer11::EmulatedIndexedStorage::EmulatedIndexedStorage(Renderer11 *renderer)
+ : BufferStorage(renderer, BUFFER_USAGE_EMULATED_INDEXED_VERTEX), mBuffer()
+{}
+
+Buffer11::EmulatedIndexedStorage::~EmulatedIndexedStorage() {}
+
+angle::Result Buffer11::EmulatedIndexedStorage::getBuffer(const gl::Context *context,
+ SourceIndexData *indexInfo,
+ const TranslatedAttribute &attribute,
+ GLint startVertex,
+ const d3d11::Buffer **bufferOut)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ // If a change in the indices applied from the last draw call is detected, then the emulated
+ // indexed buffer needs to be invalidated. After invalidation, the change detected flag should
+ // be cleared to avoid unnecessary recreation of the buffer.
+ if (!mBuffer.valid() || indexInfo->srcIndicesChanged)
+ {
+ mBuffer.reset();
+
+ // Copy the source index data. This ensures that the lifetime of the indices pointer
+ // stays with this storage until the next time we invalidate.
+ size_t indicesDataSize = 0;
+ switch (indexInfo->srcIndexType)
+ {
+ case gl::DrawElementsType::UnsignedInt:
+ indicesDataSize = sizeof(GLuint) * indexInfo->srcCount;
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ indicesDataSize = sizeof(GLushort) * indexInfo->srcCount;
+ break;
+ case gl::DrawElementsType::UnsignedByte:
+ indicesDataSize = sizeof(GLubyte) * indexInfo->srcCount;
+ break;
+ default:
+ indicesDataSize = sizeof(GLushort) * indexInfo->srcCount;
+ break;
+ }
+
+ ANGLE_CHECK_GL_ALLOC(context11, mIndicesMemoryBuffer.resize(indicesDataSize));
+
+ memcpy(mIndicesMemoryBuffer.data(), indexInfo->srcIndices, indicesDataSize);
+
+ indexInfo->srcIndicesChanged = false;
+ }
+
+ if (!mBuffer.valid())
+ {
+ unsigned int offset = 0;
+ ANGLE_TRY(attribute.computeOffset(context, startVertex, &offset));
+
+ // Expand the memory storage upon request and cache the results.
+ unsigned int expandedDataSize =
+ static_cast<unsigned int>((indexInfo->srcCount * attribute.stride) + offset);
+ angle::MemoryBuffer expandedData;
+ ANGLE_CHECK_GL_ALLOC(context11, expandedData.resize(expandedDataSize));
+
+ // Clear the contents of the allocated buffer
+ ZeroMemory(expandedData.data(), expandedDataSize);
+
+ uint8_t *curr = expandedData.data();
+ const uint8_t *ptr = static_cast<const uint8_t *>(indexInfo->srcIndices);
+
+ // Ensure that we start in the correct place for the emulated data copy operation to
+ // maintain offset behaviors.
+ curr += offset;
+
+ ReadIndexValueFunction readIndexValue = ReadIndexValueFromIndices<GLushort>;
+
+ switch (indexInfo->srcIndexType)
+ {
+ case gl::DrawElementsType::UnsignedInt:
+ readIndexValue = ReadIndexValueFromIndices<GLuint>;
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ readIndexValue = ReadIndexValueFromIndices<GLushort>;
+ break;
+ case gl::DrawElementsType::UnsignedByte:
+ readIndexValue = ReadIndexValueFromIndices<GLubyte>;
+ break;
+ default:
+ UNREACHABLE();
+ return angle::Result::Stop;
+ }
+
+ // Iterate over the cached index data and copy entries indicated into the emulated buffer.
+ for (GLuint i = 0; i < indexInfo->srcCount; i++)
+ {
+ GLuint idx = readIndexValue(ptr, i);
+ memcpy(curr, mMemoryBuffer.data() + (attribute.stride * idx), attribute.stride);
+ curr += attribute.stride;
+ }
+
+ // Finally, initialize the emulated indexed native storage object with the newly copied data
+ // and free the temporary buffers used.
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = expandedDataSize;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+ bufferDesc.Usage = D3D11_USAGE_DEFAULT;
+ bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc.CPUAccessFlags = 0;
+
+ D3D11_SUBRESOURCE_DATA subResourceData = {expandedData.data(), 0, 0};
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), bufferDesc,
+ &subResourceData, &mBuffer));
+ mBuffer.setDebugName("Buffer11::EmulatedIndexedStorage");
+ }
+
+ *bufferOut = &mBuffer;
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::EmulatedIndexedStorage::copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut)
+{
+ ASSERT(source->isCPUAccessible(GL_MAP_READ_BIT));
+ uint8_t *sourceData = nullptr;
+ ANGLE_TRY(source->map(context, sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
+ ASSERT(destOffset + size <= mMemoryBuffer.size());
+ memcpy(mMemoryBuffer.data() + destOffset, sourceData, size);
+ source->unmap();
+ *resultOut = CopyResult::RECREATED;
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::EmulatedIndexedStorage::resize(const gl::Context *context,
+ size_t size,
+ bool preserveData)
+{
+ if (mMemoryBuffer.size() < size)
+ {
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_GL_ALLOC(context11, mMemoryBuffer.resize(size));
+ mBufferSize = size;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::EmulatedIndexedStorage::map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut)
+{
+ ASSERT(!mMemoryBuffer.empty() && offset + length <= mMemoryBuffer.size());
+ *mapPointerOut = mMemoryBuffer.data() + offset;
+ return angle::Result::Continue;
+}
+
+void Buffer11::EmulatedIndexedStorage::unmap()
+{
+ // No-op
+}
+
+// Buffer11::PackStorage implementation
+
+Buffer11::PackStorage::PackStorage(Renderer11 *renderer)
+ : BufferStorage(renderer, BUFFER_USAGE_PIXEL_PACK), mStagingTexture(), mDataModified(false)
+{}
+
+Buffer11::PackStorage::~PackStorage() {}
+
+angle::Result Buffer11::PackStorage::copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut)
+{
+ ANGLE_TRY(flushQueuedPackCommand(context));
+
+ // For all use cases of pack buffers, we must copy through a readable buffer.
+ ASSERT(source->isCPUAccessible(GL_MAP_READ_BIT));
+ uint8_t *sourceData = nullptr;
+ ANGLE_TRY(source->map(context, sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
+ ASSERT(destOffset + size <= mMemoryBuffer.size());
+ memcpy(mMemoryBuffer.data() + destOffset, sourceData, size);
+ source->unmap();
+ *resultOut = CopyResult::NOT_RECREATED;
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::PackStorage::resize(const gl::Context *context,
+ size_t size,
+ bool preserveData)
+{
+ if (size != mBufferSize)
+ {
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_GL_ALLOC(context11, mMemoryBuffer.resize(size));
+ mBufferSize = size;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::PackStorage::map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut)
+{
+ ASSERT(offset + length <= getSize());
+ // TODO: fast path
+ // We might be able to optimize out one or more memcpy calls by detecting when
+ // and if D3D packs the staging texture memory identically to how we would fill
+ // the pack buffer according to the current pack state.
+
+ ANGLE_TRY(flushQueuedPackCommand(context));
+
+ mDataModified = (mDataModified || (access & GL_MAP_WRITE_BIT) != 0);
+
+ *mapPointerOut = mMemoryBuffer.data() + offset;
+ return angle::Result::Continue;
+}
+
+void Buffer11::PackStorage::unmap()
+{
+ // No-op
+}
+
+angle::Result Buffer11::PackStorage::packPixels(const gl::Context *context,
+ const gl::FramebufferAttachment &readAttachment,
+ const PackPixelsParams &params)
+{
+ ANGLE_TRY(flushQueuedPackCommand(context));
+
+ RenderTarget11 *renderTarget = nullptr;
+ ANGLE_TRY(readAttachment.getRenderTarget(context, &renderTarget));
+
+ const TextureHelper11 &srcTexture = renderTarget->getTexture();
+ ASSERT(srcTexture.valid());
+ unsigned int srcSubresource = renderTarget->getSubresourceIndex();
+
+ mQueuedPackCommand.reset(new PackPixelsParams(params));
+
+ gl::Extents srcTextureSize(params.area.width, params.area.height, 1);
+ if (!mStagingTexture.get() || mStagingTexture.getFormat() != srcTexture.getFormat() ||
+ mStagingTexture.getExtents() != srcTextureSize)
+ {
+ ANGLE_TRY(mRenderer->createStagingTexture(context, srcTexture.getTextureType(),
+ srcTexture.getFormatSet(), srcTextureSize,
+ StagingAccess::READ, &mStagingTexture));
+ }
+
+ // ReadPixels from multisampled FBOs isn't supported in current GL
+ ASSERT(srcTexture.getSampleCount() <= 1);
+
+ 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;
+
+ // Select the correct layer from a 3D attachment
+ srcBox.front = 0;
+ if (mStagingTexture.is3D())
+ {
+ srcBox.front = static_cast<UINT>(readAttachment.layer());
+ }
+ srcBox.back = srcBox.front + 1;
+
+ // Asynchronous copy
+ immediateContext->CopySubresourceRegion(mStagingTexture.get(), 0, 0, 0, 0, srcTexture.get(),
+ srcSubresource, &srcBox);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::PackStorage::flushQueuedPackCommand(const gl::Context *context)
+{
+ ASSERT(mMemoryBuffer.size() > 0);
+
+ if (mQueuedPackCommand)
+ {
+ ANGLE_TRY(mRenderer->packPixels(context, mStagingTexture, *mQueuedPackCommand,
+ mMemoryBuffer.data()));
+ mQueuedPackCommand.reset(nullptr);
+ }
+
+ return angle::Result::Continue;
+}
+
+// Buffer11::SystemMemoryStorage implementation
+
+Buffer11::SystemMemoryStorage::SystemMemoryStorage(Renderer11 *renderer)
+ : Buffer11::BufferStorage(renderer, BUFFER_USAGE_SYSTEM_MEMORY)
+{}
+
+angle::Result Buffer11::SystemMemoryStorage::copyFromStorage(const gl::Context *context,
+ BufferStorage *source,
+ size_t sourceOffset,
+ size_t size,
+ size_t destOffset,
+ CopyResult *resultOut)
+{
+ ASSERT(source->isCPUAccessible(GL_MAP_READ_BIT));
+ uint8_t *sourceData = nullptr;
+ ANGLE_TRY(source->map(context, sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
+ ASSERT(destOffset + size <= mSystemCopy.size());
+ memcpy(mSystemCopy.data() + destOffset, sourceData, size);
+ source->unmap();
+ *resultOut = CopyResult::RECREATED;
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::SystemMemoryStorage::resize(const gl::Context *context,
+ size_t size,
+ bool preserveData)
+{
+ if (mSystemCopy.size() < size)
+ {
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_GL_ALLOC(context11, mSystemCopy.resize(size));
+ mBufferSize = size;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer11::SystemMemoryStorage::map(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ uint8_t **mapPointerOut)
+{
+ ASSERT(!mSystemCopy.empty() && offset + length <= mSystemCopy.size());
+ *mapPointerOut = mSystemCopy.data() + offset;
+ return angle::Result::Continue;
+}
+
+void Buffer11::SystemMemoryStorage::unmap()
+{
+ // No-op
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
new file mode 100644
index 0000000000..bcf8826bad
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
@@ -0,0 +1,200 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer11.h: Defines the rx::Buffer11 class which implements rx::BufferImpl via rx::BufferD3D.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
+
+#include <array>
+#include <map>
+
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace gl
+{
+class FramebufferAttachment;
+}
+
+namespace rx
+{
+struct PackPixelsParams;
+class Renderer11;
+struct SourceIndexData;
+struct TranslatedAttribute;
+
+// The order of this enum governs priority of 'getLatestBufferStorage'.
+enum BufferUsage
+{
+ BUFFER_USAGE_SYSTEM_MEMORY,
+ BUFFER_USAGE_STAGING,
+ BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK,
+ BUFFER_USAGE_INDEX,
+ BUFFER_USAGE_INDIRECT,
+ BUFFER_USAGE_PIXEL_UNPACK,
+ BUFFER_USAGE_PIXEL_PACK,
+ BUFFER_USAGE_UNIFORM,
+ BUFFER_USAGE_EMULATED_INDEXED_VERTEX,
+ BUFFER_USAGE_RAW_UAV,
+
+ BUFFER_USAGE_COUNT,
+};
+
+typedef size_t DataRevision;
+
+class Buffer11 : public BufferD3D
+{
+ public:
+ Buffer11(const gl::BufferState &state, Renderer11 *renderer);
+ ~Buffer11() override;
+
+ angle::Result getBuffer(const gl::Context *context,
+ BufferUsage usage,
+ ID3D11Buffer **bufferOut);
+ angle::Result getEmulatedIndexedBuffer(const gl::Context *context,
+ SourceIndexData *indexInfo,
+ const TranslatedAttribute &attribute,
+ GLint startVertex,
+ ID3D11Buffer **bufferOut);
+ angle::Result getConstantBufferRange(const gl::Context *context,
+ GLintptr offset,
+ GLsizeiptr size,
+ const d3d11::Buffer **bufferOut,
+ UINT *firstConstantOut,
+ UINT *numConstantsOut);
+ angle::Result getSRV(const gl::Context *context,
+ DXGI_FORMAT srvFormat,
+ const d3d11::ShaderResourceView **srvOut);
+ angle::Result getRawUAVRange(const gl::Context *context,
+ GLintptr offset,
+ GLsizeiptr size,
+ d3d11::UnorderedAccessView **uavOut);
+
+ angle::Result markRawBufferUsage(const gl::Context *context);
+ bool isMapped() const { return mMappedStorage != nullptr; }
+ angle::Result packPixels(const gl::Context *context,
+ const gl::FramebufferAttachment &readAttachment,
+ const PackPixelsParams &params);
+ size_t getTotalCPUBufferMemoryBytes() const;
+
+ // BufferD3D implementation
+ size_t getSize() const override;
+ bool supportsDirectBinding() const override;
+ angle::Result getData(const gl::Context *context, const uint8_t **outData) override;
+ void initializeStaticData(const gl::Context *context) override;
+ void invalidateStaticData(const gl::Context *context) override;
+
+ // BufferImpl implementation
+ angle::Result setData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ gl::BufferUsage usage) override;
+ angle::Result setSubData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ size_t offset) override;
+ angle::Result copySubData(const gl::Context *context,
+ BufferImpl *source,
+ GLintptr sourceOffset,
+ GLintptr destOffset,
+ GLsizeiptr size) override;
+ angle::Result map(const gl::Context *context, GLenum access, void **mapPtr) override;
+ angle::Result mapRange(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ void **mapPtr) override;
+ angle::Result unmap(const gl::Context *context, GLboolean *result) override;
+ angle::Result markTransformFeedbackUsage(const gl::Context *context) override;
+
+ private:
+ class BufferStorage;
+ class EmulatedIndexedStorage;
+ class NativeStorage;
+ class PackStorage;
+ class SystemMemoryStorage;
+
+ struct ConstantBufferCacheEntry
+ {
+ ConstantBufferCacheEntry() : storage(nullptr), lruCount(0) {}
+
+ BufferStorage *storage;
+ unsigned int lruCount;
+ };
+
+ void markBufferUsage(BufferUsage usage);
+ angle::Result markBufferUsage(const gl::Context *context, BufferUsage usage);
+ angle::Result garbageCollection(const gl::Context *context, BufferUsage currentUsage);
+
+ angle::Result updateBufferStorage(const gl::Context *context,
+ BufferStorage *storage,
+ size_t sourceOffset,
+ size_t storageSize);
+
+ angle::Result getNativeStorageForUAV(const gl::Context *context,
+ Buffer11::NativeStorage **storageOut);
+
+ template <typename StorageOutT>
+ angle::Result getBufferStorage(const gl::Context *context,
+ BufferUsage usage,
+ StorageOutT **storageOut);
+
+ template <typename StorageOutT>
+ angle::Result getStagingStorage(const gl::Context *context, StorageOutT **storageOut);
+
+ angle::Result getLatestBufferStorage(const gl::Context *context,
+ BufferStorage **storageOut) const;
+
+ angle::Result getConstantBufferRangeStorage(const gl::Context *context,
+ GLintptr offset,
+ GLsizeiptr size,
+ NativeStorage **storageOut);
+
+ BufferStorage *allocateStorage(BufferUsage usage);
+ void updateDeallocThreshold(BufferUsage usage);
+
+ // Free the storage if we decide it isn't being used very often.
+ angle::Result checkForDeallocation(const gl::Context *context, BufferUsage usage);
+
+ // For some cases of uniform buffer storage, we can't deallocate system memory storage.
+ bool canDeallocateSystemMemory() const;
+
+ // Updates data revisions and latest storage.
+ void onCopyStorage(BufferStorage *dest, BufferStorage *source);
+ void onStorageUpdate(BufferStorage *updatedStorage);
+
+ Renderer11 *mRenderer;
+ size_t mSize;
+
+ BufferStorage *mMappedStorage;
+
+ // Buffer storages are sorted by usage. It's important that the latest buffer storage picks
+ // the lowest usage in the case where two storages are tied on data revision - this ensures
+ // we never do anything dangerous like map a uniform buffer over a staging or system memory
+ // copy.
+ std::array<BufferStorage *, BUFFER_USAGE_COUNT> mBufferStorages;
+ BufferStorage *mLatestBufferStorage;
+
+ // These two arrays are used to track when to free unused storage.
+ std::array<unsigned int, BUFFER_USAGE_COUNT> mDeallocThresholds;
+ std::array<unsigned int, BUFFER_USAGE_COUNT> mIdleness;
+
+ // Cache of D3D11 constant buffer for specific ranges of buffer data.
+ // This is used to emulate UBO ranges on 11.0 devices.
+ // Constant buffers are indexed by there start offset.
+ typedef std::map<GLintptr /*offset*/, ConstantBufferCacheEntry> ConstantBufferCache;
+ ConstantBufferCache mConstantBufferRangeStoragesCache;
+ size_t mConstantBufferStorageAdditionalSize;
+ unsigned int mMaxConstantBufferLruCount;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
new file mode 100644
index 0000000000..ec23b515d2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
@@ -0,0 +1,804 @@
+
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Clear11.cpp: Framebuffer clear utility class.
+
+#include "libANGLE/renderer/d3d/d3d11/Clear11.h"
+
+#include <algorithm>
+
+#include "libANGLE/Context.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/trace.h"
+
+// Precompiled shaders
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11_fl9vs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewgs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewvs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11vs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/cleardepth11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps1.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps2.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps3.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps4.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps5.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps6.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps7.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps8.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps1.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps2.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps3.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps4.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps5.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps6.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps7.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps8.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps1.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps2.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps3.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps4.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps5.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps6.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps7.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps8.h"
+
+namespace rx
+{
+
+namespace
+{
+constexpr uint32_t g_ConstantBufferSize = sizeof(RtvDsvClearInfo<float>);
+constexpr uint32_t g_VertexSize = sizeof(d3d11::PositionVertex);
+
+// Updates color, depth and alpha components of cached CB if necessary.
+// Returns true if any constants are updated, false otherwise.
+template <typename T>
+bool UpdateDataCache(RtvDsvClearInfo<T> *dataCache,
+ const gl::Color<T> &color,
+ const float *zValue,
+ const uint32_t numRtvs,
+ const uint8_t writeMask)
+{
+ bool cacheDirty = false;
+
+ if (numRtvs > 0)
+ {
+ const bool writeRGB = (writeMask & ~D3D11_COLOR_WRITE_ENABLE_ALPHA) != 0;
+ if (writeRGB && memcmp(&dataCache->r, &color.red, sizeof(T) * 3) != 0)
+ {
+ dataCache->r = color.red;
+ dataCache->g = color.green;
+ dataCache->b = color.blue;
+ cacheDirty = true;
+ }
+
+ const bool writeAlpha = (writeMask & D3D11_COLOR_WRITE_ENABLE_ALPHA) != 0;
+ if (writeAlpha && (dataCache->a != color.alpha))
+ {
+ dataCache->a = color.alpha;
+ cacheDirty = true;
+ }
+ }
+
+ if (zValue)
+ {
+ const float clampedZValue = gl::clamp01(*zValue);
+
+ if (clampedZValue != dataCache->z)
+ {
+ dataCache->z = clampedZValue;
+ cacheDirty = true;
+ }
+ }
+
+ return cacheDirty;
+}
+
+} // anonymous namespace
+
+#define CLEARPS(Index) \
+ d3d11::LazyShader<ID3D11PixelShader>(g_PS_Clear##Index, ArraySize(g_PS_Clear##Index), \
+ "Clear11 PS " ANGLE_STRINGIFY(Index))
+
+Clear11::ShaderManager::ShaderManager()
+ : mIl9(),
+ mVs9(g_VS_Clear_FL9, ArraySize(g_VS_Clear_FL9), "Clear11 VS FL9"),
+ mPsFloat9(g_PS_ClearFloat_FL9, ArraySize(g_PS_ClearFloat_FL9), "Clear11 PS FloatFL9"),
+ mVs(g_VS_Clear, ArraySize(g_VS_Clear), "Clear11 VS"),
+ mVsMultiview(g_VS_Multiview_Clear, ArraySize(g_VS_Multiview_Clear), "Clear11 VS Multiview"),
+ mGsMultiview(g_GS_Multiview_Clear, ArraySize(g_GS_Multiview_Clear), "Clear11 GS Multiview"),
+ mPsDepth(g_PS_ClearDepth, ArraySize(g_PS_ClearDepth), "Clear11 PS Depth"),
+ mPsFloat{{CLEARPS(Float1), CLEARPS(Float2), CLEARPS(Float3), CLEARPS(Float4), CLEARPS(Float5),
+ CLEARPS(Float6), CLEARPS(Float7), CLEARPS(Float8)}},
+ mPsUInt{{CLEARPS(Uint1), CLEARPS(Uint2), CLEARPS(Uint3), CLEARPS(Uint4), CLEARPS(Uint5),
+ CLEARPS(Uint6), CLEARPS(Uint7), CLEARPS(Uint8)}},
+ mPsSInt{{CLEARPS(Sint1), CLEARPS(Sint2), CLEARPS(Sint3), CLEARPS(Sint4), CLEARPS(Sint5),
+ CLEARPS(Sint6), CLEARPS(Sint7), CLEARPS(Sint8)}}
+{}
+
+#undef CLEARPS
+
+Clear11::ShaderManager::~ShaderManager() {}
+
+angle::Result Clear11::ShaderManager::getShadersAndLayout(const gl::Context *context,
+ Renderer11 *renderer,
+ const INT clearType,
+ const uint32_t numRTs,
+ const bool hasLayeredLayout,
+ const d3d11::InputLayout **il,
+ const d3d11::VertexShader **vs,
+ const d3d11::GeometryShader **gs,
+ const d3d11::PixelShader **ps)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (renderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ ASSERT(clearType == GL_FLOAT);
+
+ ANGLE_TRY(mVs9.resolve(context11, renderer));
+ ANGLE_TRY(mPsFloat9.resolve(context11, renderer));
+
+ if (!mIl9.valid())
+ {
+ const D3D11_INPUT_ELEMENT_DESC ilDesc[] = {
+ {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}};
+
+ InputElementArray ilDescArray(ilDesc);
+ ShaderData vertexShader(g_VS_Clear_FL9);
+
+ ANGLE_TRY(renderer->allocateResource(context11, ilDescArray, &vertexShader, &mIl9));
+ }
+
+ *vs = &mVs9.getObj();
+ *gs = nullptr;
+ *il = &mIl9;
+ *ps = &mPsFloat9.getObj();
+ return angle::Result::Continue;
+ }
+
+ if (!hasLayeredLayout)
+ {
+ ANGLE_TRY(mVs.resolve(context11, renderer));
+ *vs = &mVs.getObj();
+ *gs = nullptr;
+ }
+ else
+ {
+ // For layered framebuffers we have to use the multi-view versions of the VS and GS.
+ ANGLE_TRY(mVsMultiview.resolve(context11, renderer));
+ ANGLE_TRY(mGsMultiview.resolve(context11, renderer));
+ *vs = &mVsMultiview.getObj();
+ *gs = &mGsMultiview.getObj();
+ }
+
+ *il = nullptr;
+
+ if (numRTs == 0)
+ {
+ ANGLE_TRY(mPsDepth.resolve(context11, renderer));
+ *ps = &mPsDepth.getObj();
+ return angle::Result::Continue;
+ }
+
+ switch (clearType)
+ {
+ case GL_FLOAT:
+ ANGLE_TRY(mPsFloat[numRTs - 1].resolve(context11, renderer));
+ *ps = &mPsFloat[numRTs - 1].getObj();
+ break;
+ case GL_UNSIGNED_INT:
+ ANGLE_TRY(mPsUInt[numRTs - 1].resolve(context11, renderer));
+ *ps = &mPsUInt[numRTs - 1].getObj();
+ break;
+ case GL_INT:
+ ANGLE_TRY(mPsSInt[numRTs - 1].resolve(context11, renderer));
+ *ps = &mPsSInt[numRTs - 1].getObj();
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return angle::Result::Continue;
+}
+
+Clear11::Clear11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mResourcesInitialized(false),
+ mScissorEnabledRasterizerState(),
+ mScissorDisabledRasterizerState(),
+ mShaderManager(),
+ mConstantBuffer(),
+ mVertexBuffer(),
+ mShaderData({})
+{}
+
+Clear11::~Clear11() {}
+
+angle::Result Clear11::ensureResourcesInitialized(const gl::Context *context)
+{
+ if (mResourcesInitialized)
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRACE_EVENT0("gpu.angle", "Clear11::ensureResourcesInitialized");
+
+ static_assert((sizeof(RtvDsvClearInfo<float>) == sizeof(RtvDsvClearInfo<int>)),
+ "Size of rx::RtvDsvClearInfo<float> is not equal to rx::RtvDsvClearInfo<int>");
+
+ static_assert(
+ (sizeof(RtvDsvClearInfo<float>) == sizeof(RtvDsvClearInfo<uint32_t>)),
+ "Size of rx::RtvDsvClearInfo<float> is not equal to rx::RtvDsvClearInfo<uint32_t>");
+
+ static_assert((sizeof(RtvDsvClearInfo<float>) % 16 == 0),
+ "The size of RtvDsvClearInfo<float> should be a multiple of 16bytes.");
+
+ // Create Rasterizer States
+ D3D11_RASTERIZER_DESC rsDesc;
+ rsDesc.FillMode = D3D11_FILL_SOLID;
+ rsDesc.CullMode = D3D11_CULL_NONE;
+ rsDesc.FrontCounterClockwise = FALSE;
+ rsDesc.DepthBias = 0;
+ rsDesc.DepthBiasClamp = 0.0f;
+ rsDesc.SlopeScaledDepthBias = 0.0f;
+ rsDesc.DepthClipEnable = TRUE;
+ rsDesc.ScissorEnable = FALSE;
+ rsDesc.MultisampleEnable = FALSE;
+ rsDesc.AntialiasedLineEnable = FALSE;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, rsDesc, &mScissorDisabledRasterizerState));
+ mScissorDisabledRasterizerState.setDebugName("Clear11 Rasterizer State with scissor disabled");
+
+ rsDesc.ScissorEnable = TRUE;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rsDesc, &mScissorEnabledRasterizerState));
+ mScissorEnabledRasterizerState.setDebugName("Clear11 Rasterizer State with scissor enabled");
+
+ // Initialize Depthstencil state with defaults
+ mDepthStencilStateKey.depthTest = false;
+ mDepthStencilStateKey.depthMask = false;
+ mDepthStencilStateKey.depthFunc = GL_ALWAYS;
+ mDepthStencilStateKey.stencilWritemask = static_cast<GLuint>(-1);
+ mDepthStencilStateKey.stencilBackWritemask = static_cast<GLuint>(-1);
+ mDepthStencilStateKey.stencilBackMask = 0;
+ mDepthStencilStateKey.stencilTest = false;
+ mDepthStencilStateKey.stencilMask = 0;
+ mDepthStencilStateKey.stencilFail = GL_REPLACE;
+ mDepthStencilStateKey.stencilPassDepthFail = GL_REPLACE;
+ mDepthStencilStateKey.stencilPassDepthPass = GL_REPLACE;
+ mDepthStencilStateKey.stencilFunc = GL_ALWAYS;
+ mDepthStencilStateKey.stencilBackFail = GL_REPLACE;
+ mDepthStencilStateKey.stencilBackPassDepthFail = GL_REPLACE;
+ mDepthStencilStateKey.stencilBackPassDepthPass = GL_REPLACE;
+ mDepthStencilStateKey.stencilBackFunc = GL_ALWAYS;
+
+ // Initialize BlendStateKey with defaults
+ mBlendStateKey.blendState.blend = false;
+ mBlendStateKey.blendState.sourceBlendRGB = GL_ONE;
+ mBlendStateKey.blendState.sourceBlendAlpha = GL_ONE;
+ mBlendStateKey.blendState.destBlendRGB = GL_ZERO;
+ mBlendStateKey.blendState.destBlendAlpha = GL_ZERO;
+ mBlendStateKey.blendState.blendEquationRGB = GL_FUNC_ADD;
+ mBlendStateKey.blendState.blendEquationAlpha = GL_FUNC_ADD;
+ mBlendStateKey.blendState.sampleAlphaToCoverage = false;
+ mBlendStateKey.blendState.dither = true;
+
+ mResourcesInitialized = true;
+ return angle::Result::Continue;
+}
+
+bool Clear11::useVertexBuffer() const
+{
+ return (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3);
+}
+
+angle::Result Clear11::ensureConstantBufferCreated(const gl::Context *context)
+{
+ if (mConstantBuffer.valid())
+ {
+ return angle::Result::Continue;
+ }
+
+ // Create constant buffer for color & depth data
+
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = g_ConstantBufferSize;
+ bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+
+ D3D11_SUBRESOURCE_DATA initialData;
+ initialData.pSysMem = &mShaderData;
+ initialData.SysMemPitch = g_ConstantBufferSize;
+ initialData.SysMemSlicePitch = g_ConstantBufferSize;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), bufferDesc, &initialData,
+ &mConstantBuffer));
+ mConstantBuffer.setDebugName("Clear11 Constant Buffer");
+ return angle::Result::Continue;
+}
+
+angle::Result Clear11::ensureVertexBufferCreated(const gl::Context *context)
+{
+ ASSERT(useVertexBuffer());
+
+ if (mVertexBuffer.valid())
+ {
+ return angle::Result::Continue;
+ }
+
+ // Create vertex buffer with vertices for a quad covering the entire surface
+
+ static_assert((sizeof(d3d11::PositionVertex) % 16) == 0,
+ "d3d11::PositionVertex should be a multiple of 16 bytes");
+ const d3d11::PositionVertex vbData[6] = {{-1.0f, 1.0f, 0.0f, 1.0f}, {1.0f, -1.0f, 0.0f, 1.0f},
+ {-1.0f, -1.0f, 0.0f, 1.0f}, {-1.0f, 1.0f, 0.0f, 1.0f},
+ {1.0f, 1.0f, 0.0f, 1.0f}, {1.0f, -1.0f, 0.0f, 1.0f}};
+
+ const UINT vbSize = sizeof(vbData);
+
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = vbSize;
+ bufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
+ bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc.CPUAccessFlags = 0;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+
+ D3D11_SUBRESOURCE_DATA initialData;
+ initialData.pSysMem = vbData;
+ initialData.SysMemPitch = vbSize;
+ initialData.SysMemSlicePitch = initialData.SysMemPitch;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), bufferDesc, &initialData,
+ &mVertexBuffer));
+ mVertexBuffer.setDebugName("Clear11 Vertex Buffer");
+ return angle::Result::Continue;
+}
+
+angle::Result Clear11::clearFramebuffer(const gl::Context *context,
+ const ClearParameters &clearParams,
+ const gl::FramebufferState &fboData)
+{
+ ANGLE_TRY(ensureResourcesInitialized(context));
+
+ // Iterate over the color buffers which require clearing and determine if they can be
+ // cleared with ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView.
+ // This requires:
+ // 1) The render target is being cleared to a float value (will be cast to integer when clearing
+ // integer render targets as expected but does not work the other way around)
+ // 2) The format of the render target has no color channels that are currently masked out.
+ // Clear the easy-to-clear buffers on the spot and accumulate the ones that require special
+ // work.
+ //
+ // If these conditions are met, and:
+ // - No scissored clear is needed, then clear using ID3D11DeviceContext::ClearRenderTargetView.
+ // - A scissored clear is needed then clear using ID3D11DeviceContext1::ClearView if available.
+ // Otherwise perform a shader based clear.
+ //
+ // Also determine if the DSV can be cleared withID3D11DeviceContext::ClearDepthStencilView by
+ // checking if the stencil write mask covers the entire stencil.
+ //
+ // To clear the remaining buffers, a shader based clear is performed:
+ // - The appropriate ShaderManagers (VS & PS) for the clearType is set
+ // - A CB containing the clear color and Z values is bound
+ // - An IL and VB are bound (for FL93 and below)
+ // - ScissorRect/Raststate/Viewport set as required
+ // - Blendstate set containing appropriate colorMasks
+ // - DepthStencilState set with appropriate parameters for a z or stencil clear if required
+ // - Color and/or Z buffers to be cleared are bound
+ // - Primitive covering entire clear area is drawn
+
+ gl::Extents framebufferSize;
+
+ const auto *depthStencilAttachment = fboData.getDepthOrStencilAttachment();
+ if (depthStencilAttachment != nullptr)
+ {
+ framebufferSize = depthStencilAttachment->getSize();
+ }
+ else
+ {
+ const gl::FramebufferAttachment *colorAttachment = fboData.getFirstColorAttachment();
+ ASSERT(colorAttachment);
+ framebufferSize = colorAttachment->getSize();
+ }
+
+ bool needScissoredClear = false;
+ D3D11_RECT scissorRect;
+ if (clearParams.scissorEnabled)
+ {
+ if (clearParams.scissor.x >= framebufferSize.width ||
+ clearParams.scissor.y >= framebufferSize.height || clearParams.scissor.width == 0 ||
+ clearParams.scissor.height == 0)
+ {
+ // The check assumes that the viewport offsets are not negative as according to the
+ // OVR_multiview2 spec.
+ // Scissor rect is outside the renderbuffer or is an empty rect.
+ return angle::Result::Continue;
+ }
+
+ if (clearParams.scissor.x + clearParams.scissor.width <= 0 ||
+ clearParams.scissor.y + clearParams.scissor.height <= 0)
+ {
+ // Scissor rect is outside the renderbuffer.
+ return angle::Result::Continue;
+ }
+ needScissoredClear =
+ clearParams.scissor.x > 0 || clearParams.scissor.y > 0 ||
+ clearParams.scissor.x + clearParams.scissor.width < framebufferSize.width ||
+ clearParams.scissor.y + clearParams.scissor.height < framebufferSize.height;
+
+ if (needScissoredClear)
+ {
+ // Apply viewport offsets to compute the final scissor rectangles.
+ // Even in multiview all layers share the same viewport and scissor.
+ scissorRect.left = clearParams.scissor.x;
+ scissorRect.right = scissorRect.left + clearParams.scissor.width;
+ scissorRect.top = clearParams.scissor.y;
+ scissorRect.bottom = scissorRect.top + clearParams.scissor.height;
+ }
+ }
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
+
+ std::array<ID3D11RenderTargetView *, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT> rtvs;
+ std::array<uint8_t, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT> rtvMasks = {};
+
+ uint32_t numRtvs = 0;
+ const uint8_t colorMask =
+ gl_d3d11::ConvertColorMask(clearParams.colorMaskRed, clearParams.colorMaskGreen,
+ clearParams.colorMaskBlue, clearParams.colorMaskAlpha);
+
+ const auto &colorAttachments = fboData.getColorAttachments();
+ for (auto colorAttachmentIndex : fboData.getEnabledDrawBuffers())
+ {
+ const gl::FramebufferAttachment &attachment = colorAttachments[colorAttachmentIndex];
+
+ if (!clearParams.clearColor[colorAttachmentIndex])
+ {
+ continue;
+ }
+
+ RenderTarget11 *renderTarget = nullptr;
+ ANGLE_TRY(attachment.getRenderTarget(context, &renderTarget));
+
+ const gl::InternalFormat &formatInfo = *attachment.getFormat().info;
+
+ if (clearParams.colorType == GL_FLOAT &&
+ !(formatInfo.componentType == GL_FLOAT ||
+ formatInfo.componentType == GL_UNSIGNED_NORMALIZED ||
+ formatInfo.componentType == GL_SIGNED_NORMALIZED))
+ {
+ WARN() << "It is undefined behaviour to clear a render buffer which is not "
+ "normalized fixed point or floating-point to floating point values (color "
+ "attachment "
+ << colorAttachmentIndex << " has internal format " << attachment.getFormat()
+ << ").";
+ }
+
+ if ((formatInfo.redBits == 0 || !clearParams.colorMaskRed) &&
+ (formatInfo.greenBits == 0 || !clearParams.colorMaskGreen) &&
+ (formatInfo.blueBits == 0 || !clearParams.colorMaskBlue) &&
+ (formatInfo.alphaBits == 0 || !clearParams.colorMaskAlpha))
+ {
+ // Every channel either does not exist in the render target or is masked out
+ continue;
+ }
+
+ const auto &framebufferRTV = renderTarget->getRenderTargetView();
+ ASSERT(framebufferRTV.valid());
+
+ bool canClearView = true;
+ if (mRenderer->getFeatures().emulateClearViewAfterDualSourceBlending.enabled) {
+ // Check the current state to see if we were using dual source blending
+ auto isDualSource = [](auto blend) { switch (blend) {
+ case D3D11_BLEND_SRC1_COLOR:
+ case D3D11_BLEND_INV_SRC1_COLOR:
+ case D3D11_BLEND_SRC1_ALPHA:
+ case D3D11_BLEND_INV_SRC1_ALPHA:
+ return true;
+ default:
+ return false;
+ }};
+ FLOAT blendFactor[4];
+ UINT sampleMask;
+ ID3D11BlendState *blendState;
+ D3D11_BLEND_DESC blendDesc;
+ deviceContext->OMGetBlendState(&blendState, blendFactor, &sampleMask);
+ if (blendState) {
+ blendState->GetDesc(&blendDesc);
+ // You can only use dual source blending on slot 0 so only check there
+ if (isDualSource(blendDesc.RenderTarget[0].SrcBlend) ||
+ isDualSource(blendDesc.RenderTarget[0].DestBlend) ||
+ isDualSource(blendDesc.RenderTarget[0].SrcBlendAlpha) ||
+ isDualSource(blendDesc.RenderTarget[0].DestBlendAlpha)) {
+ canClearView = false;
+ }
+ }
+ }
+
+ if ((!(mRenderer->getRenderer11DeviceCaps().supportsClearView && canClearView) && needScissoredClear) ||
+ clearParams.colorType != GL_FLOAT ||
+ (formatInfo.redBits > 0 && !clearParams.colorMaskRed) ||
+ (formatInfo.greenBits > 0 && !clearParams.colorMaskGreen) ||
+ (formatInfo.blueBits > 0 && !clearParams.colorMaskBlue) ||
+ (formatInfo.alphaBits > 0 && !clearParams.colorMaskAlpha))
+ {
+ rtvs[numRtvs] = framebufferRTV.get();
+ rtvMasks[numRtvs] = gl_d3d11::GetColorMask(formatInfo) & colorMask;
+ numRtvs++;
+ }
+ else
+ {
+ // ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView is
+ // possible
+
+ const auto &nativeFormat = renderTarget->getFormatSet().format();
+
+ // Check if the actual format has a channel that the internal format does not and
+ // set them to the default values
+ float clearValues[4] = {
+ ((formatInfo.redBits == 0 && nativeFormat.redBits > 0) ? 0.0f
+ : clearParams.colorF.red),
+ ((formatInfo.greenBits == 0 && nativeFormat.greenBits > 0)
+ ? 0.0f
+ : clearParams.colorF.green),
+ ((formatInfo.blueBits == 0 && nativeFormat.blueBits > 0) ? 0.0f
+ : clearParams.colorF.blue),
+ ((formatInfo.alphaBits == 0 && nativeFormat.alphaBits > 0)
+ ? 1.0f
+ : clearParams.colorF.alpha),
+ };
+
+ if (formatInfo.alphaBits == 1)
+ {
+ // Some drivers do not correctly handle calling Clear() on a format with 1-bit
+ // alpha. They can incorrectly round all non-zero values up to 1.0f. Note that
+ // WARP does not do this. We should handle the rounding for them instead.
+ clearValues[3] = (clearParams.colorF.alpha >= 0.5f) ? 1.0f : 0.0f;
+ }
+
+ if (needScissoredClear)
+ {
+ // We shouldn't reach here if deviceContext1 is unavailable.
+ ASSERT(deviceContext1);
+ deviceContext1->ClearView(framebufferRTV.get(), clearValues, &scissorRect, 1);
+ if (mRenderer->getFeatures().callClearTwice.enabled)
+ {
+ deviceContext1->ClearView(framebufferRTV.get(), clearValues, &scissorRect, 1);
+ }
+ }
+ else
+ {
+ deviceContext->ClearRenderTargetView(framebufferRTV.get(), clearValues);
+ if (mRenderer->getFeatures().callClearTwice.enabled)
+ {
+ deviceContext->ClearRenderTargetView(framebufferRTV.get(), clearValues);
+ }
+ }
+ }
+ }
+
+ ID3D11DepthStencilView *dsv = nullptr;
+
+ if (clearParams.clearDepth || clearParams.clearStencil)
+ {
+ RenderTarget11 *depthStencilRenderTarget = nullptr;
+
+ ASSERT(depthStencilAttachment != nullptr);
+ ANGLE_TRY(depthStencilAttachment->getRenderTarget(context, &depthStencilRenderTarget));
+
+ dsv = depthStencilRenderTarget->getDepthStencilView().get();
+ ASSERT(dsv != nullptr);
+
+ const auto &nativeFormat = depthStencilRenderTarget->getFormatSet().format();
+ const auto *stencilAttachment = fboData.getStencilAttachment();
+
+ uint32_t stencilUnmasked =
+ (stencilAttachment != nullptr) ? (1 << nativeFormat.stencilBits) - 1 : 0;
+ bool needMaskedStencilClear =
+ clearParams.clearStencil &&
+ (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
+
+ if (!needScissoredClear && !needMaskedStencilClear)
+ {
+ const UINT clearFlags = (clearParams.clearDepth ? D3D11_CLEAR_DEPTH : 0) |
+ (clearParams.clearStencil ? D3D11_CLEAR_STENCIL : 0);
+ const FLOAT depthClear = gl::clamp01(clearParams.depthValue);
+ const UINT8 stencilClear = clearParams.stencilValue & 0xFF;
+
+ deviceContext->ClearDepthStencilView(dsv, clearFlags, depthClear, stencilClear);
+
+ dsv = nullptr;
+ }
+ }
+
+ if (numRtvs == 0 && dsv == nullptr)
+ {
+ return angle::Result::Continue;
+ }
+
+ // Clear the remaining render targets and depth stencil in one pass by rendering a quad:
+ //
+ // IA/VS: Vertices containing position and color members are passed through to the next stage.
+ // The vertex position has XY coordinates equal to clip extents and a Z component equal to the
+ // Z clear value. The vertex color contains the clear color.
+ //
+ // Rasterizer: Viewport scales the VS output over the entire surface and depending on whether
+ // or not scissoring is enabled the appropriate scissor rect and rasterizerState with or without
+ // the scissor test enabled is set as well.
+ //
+ // DepthStencilTest: DepthTesting, DepthWrites, StencilMask and StencilWrites will be enabled or
+ // disabled or set depending on what the input depthStencil clear parameters are. Since the PS
+ // is not writing out depth or rejecting pixels, this should happen prior to the PS stage.
+ //
+ // PS: Will write out the color values passed through from the previous stage to all outputs.
+ //
+ // OM: BlendState will perform the required color masking and output to RTV(s).
+
+ //
+ // ======================================================================================
+ //
+ // Luckily, the gl spec (ES 3.0.2 pg 183) states that the results of clearing a render-
+ // buffer that is not normalized fixed point or floating point with floating point values
+ // are undefined so we can just write floats to them and D3D11 will bit cast them to
+ // integers.
+ //
+ // Also, we don't have to worry about attempting to clear a normalized fixed/floating point
+ // buffer with integer values because there is no gl API call which would allow it,
+ // glClearBuffer* calls only clear a single renderbuffer at a time which is verified to
+ // be a compatible clear type.
+
+ ASSERT(numRtvs <= mRenderer->getNativeCaps().maxDrawBuffers);
+
+ // Setup BlendStateKey parameters
+ mBlendStateKey.blendState.colorMaskRed = clearParams.colorMaskRed;
+ mBlendStateKey.blendState.colorMaskGreen = clearParams.colorMaskGreen;
+ mBlendStateKey.blendState.colorMaskBlue = clearParams.colorMaskBlue;
+ mBlendStateKey.blendState.colorMaskAlpha = clearParams.colorMaskAlpha;
+ mBlendStateKey.rtvMax = numRtvs;
+ memcpy(mBlendStateKey.rtvMasks, &rtvMasks[0], sizeof(mBlendStateKey.rtvMasks));
+
+ // Get BlendState
+ const d3d11::BlendState *blendState = nullptr;
+ ANGLE_TRY(mRenderer->getBlendState(context, mBlendStateKey, &blendState));
+
+ const d3d11::DepthStencilState *dsState = nullptr;
+ const float *zValue = nullptr;
+
+ if (dsv)
+ {
+ // Setup DepthStencilStateKey
+ mDepthStencilStateKey.depthTest = clearParams.clearDepth;
+ mDepthStencilStateKey.depthMask = clearParams.clearDepth;
+ mDepthStencilStateKey.stencilWritemask = clearParams.stencilWriteMask;
+ mDepthStencilStateKey.stencilTest = clearParams.clearStencil;
+
+ // Get DepthStencilState
+ ANGLE_TRY(mRenderer->getDepthStencilState(context, mDepthStencilStateKey, &dsState));
+ zValue = clearParams.clearDepth ? &clearParams.depthValue : nullptr;
+ }
+
+ bool dirtyCb = false;
+
+ // Compare the input color/z values against the CB cache and update it if necessary
+ switch (clearParams.colorType)
+ {
+ case GL_FLOAT:
+ dirtyCb = UpdateDataCache(&mShaderData, clearParams.colorF, zValue, numRtvs, colorMask);
+ break;
+ case GL_UNSIGNED_INT:
+ dirtyCb = UpdateDataCache(reinterpret_cast<RtvDsvClearInfo<uint32_t> *>(&mShaderData),
+ clearParams.colorUI, zValue, numRtvs, colorMask);
+ break;
+ case GL_INT:
+ dirtyCb = UpdateDataCache(reinterpret_cast<RtvDsvClearInfo<int> *>(&mShaderData),
+ clearParams.colorI, zValue, numRtvs, colorMask);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ ANGLE_TRY(ensureConstantBufferCreated(context));
+
+ if (dirtyCb)
+ {
+ // Update the constant buffer with the updated cache contents
+ // TODO(Shahmeer): Consider using UpdateSubresource1 D3D11_COPY_DISCARD where possible.
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ANGLE_TRY(mRenderer->mapResource(context, mConstantBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD,
+ 0, &mappedResource));
+
+ memcpy(mappedResource.pData, &mShaderData, g_ConstantBufferSize);
+ deviceContext->Unmap(mConstantBuffer.get(), 0);
+ }
+
+ auto *stateManager = mRenderer->getStateManager();
+
+ // Set the viewport to be the same size as the framebuffer.
+ stateManager->setSimpleViewport(framebufferSize);
+
+ // Apply state
+ stateManager->setSimpleBlendState(blendState);
+
+ const UINT stencilValue = clearParams.stencilValue & 0xFF;
+ stateManager->setDepthStencilState(dsState, stencilValue);
+
+ if (needScissoredClear)
+ {
+ stateManager->setRasterizerState(&mScissorEnabledRasterizerState);
+ }
+ else
+ {
+ stateManager->setRasterizerState(&mScissorDisabledRasterizerState);
+ }
+
+ // Get Shaders
+ const d3d11::VertexShader *vs = nullptr;
+ const d3d11::GeometryShader *gs = nullptr;
+ const d3d11::InputLayout *il = nullptr;
+ const d3d11::PixelShader *ps = nullptr;
+ const bool hasLayeredLayout = (fboData.isMultiview());
+ ANGLE_TRY(mShaderManager.getShadersAndLayout(context, mRenderer, clearParams.colorType, numRtvs,
+ hasLayeredLayout, &il, &vs, &gs, &ps));
+
+ // Apply Shaders
+ stateManager->setDrawShaders(vs, gs, ps);
+ stateManager->setPixelConstantBuffer(0, &mConstantBuffer);
+
+ // Bind IL & VB if needed
+ stateManager->setIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0);
+ stateManager->setInputLayout(il);
+
+ if (useVertexBuffer())
+ {
+ ANGLE_TRY(ensureVertexBufferCreated(context));
+ stateManager->setSingleVertexBuffer(&mVertexBuffer, g_VertexSize, 0);
+ }
+ else
+ {
+ stateManager->setSingleVertexBuffer(nullptr, 0, 0);
+ }
+
+ stateManager->setPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+
+ // Apply render targets
+ stateManager->setRenderTargets(&rtvs[0], numRtvs, dsv);
+
+ if (needScissoredClear)
+ {
+ stateManager->setScissorRectD3D(scissorRect);
+ }
+ // Draw the fullscreen quad.
+ if (!hasLayeredLayout)
+ {
+ deviceContext->Draw(6, 0);
+ }
+ else
+ {
+ ASSERT(hasLayeredLayout);
+ deviceContext->DrawInstanced(6, static_cast<UINT>(fboData.getNumViews()), 0, 0);
+ }
+
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.h
new file mode 100644
index 0000000000..feca4159c5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.h
@@ -0,0 +1,102 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Clear11.h: Framebuffer clear utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
+
+#include <map>
+#include <vector>
+
+#include "libANGLE/Error.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+class Renderer11;
+class RenderTarget11;
+struct ClearParameters;
+
+template <typename T>
+struct RtvDsvClearInfo
+{
+ T r, g, b, a;
+ float z;
+ float c1padding[3];
+};
+
+class Clear11 : angle::NonCopyable
+{
+ public:
+ explicit Clear11(Renderer11 *renderer);
+ ~Clear11();
+
+ // Clears the framebuffer with the supplied clear parameters, assumes that the framebuffer is
+ // currently applied.
+ angle::Result clearFramebuffer(const gl::Context *context,
+ const ClearParameters &clearParams,
+ const gl::FramebufferState &fboData);
+
+ private:
+ class ShaderManager final : angle::NonCopyable
+ {
+ public:
+ ShaderManager();
+ ~ShaderManager();
+ angle::Result getShadersAndLayout(const gl::Context *context,
+ Renderer11 *renderer,
+ const INT clearType,
+ const uint32_t numRTs,
+ const bool hasLayeredLayout,
+ const d3d11::InputLayout **il,
+ const d3d11::VertexShader **vs,
+ const d3d11::GeometryShader **gs,
+ const d3d11::PixelShader **ps);
+
+ private:
+ constexpr static size_t kNumShaders = D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+ d3d11::InputLayout mIl9;
+ d3d11::LazyShader<ID3D11VertexShader> mVs9;
+ d3d11::LazyShader<ID3D11PixelShader> mPsFloat9;
+ d3d11::LazyShader<ID3D11VertexShader> mVs;
+ d3d11::LazyShader<ID3D11VertexShader> mVsMultiview;
+ d3d11::LazyShader<ID3D11GeometryShader> mGsMultiview;
+ d3d11::LazyShader<ID3D11PixelShader> mPsDepth;
+ std::array<d3d11::LazyShader<ID3D11PixelShader>, kNumShaders> mPsFloat;
+ std::array<d3d11::LazyShader<ID3D11PixelShader>, kNumShaders> mPsUInt;
+ std::array<d3d11::LazyShader<ID3D11PixelShader>, kNumShaders> mPsSInt;
+ };
+
+ bool useVertexBuffer() const;
+ angle::Result ensureConstantBufferCreated(const gl::Context *context);
+ angle::Result ensureVertexBufferCreated(const gl::Context *context);
+ angle::Result ensureResourcesInitialized(const gl::Context *context);
+
+ Renderer11 *mRenderer;
+ bool mResourcesInitialized;
+
+ // States
+ d3d11::RasterizerState mScissorEnabledRasterizerState;
+ d3d11::RasterizerState mScissorDisabledRasterizerState;
+ gl::DepthStencilState mDepthStencilStateKey;
+ d3d11::BlendStateKey mBlendStateKey;
+
+ // Shaders and shader resources
+ ShaderManager mShaderManager;
+ d3d11::Buffer mConstantBuffer;
+ d3d11::Buffer mVertexBuffer;
+
+ // Buffer data and draw parameters
+ RtvDsvClearInfo<float> mShaderData;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
new file mode 100644
index 0000000000..bdb7781ae3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
@@ -0,0 +1,684 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context11:
+// D3D11-specific functionality associated with a GL Context.
+//
+
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+
+#include "common/string_utils.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/MemoryProgramCache.h"
+#include "libANGLE/renderer/d3d/CompilerD3D.h"
+#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
+#include "libANGLE/renderer/d3d/SamplerD3D.h"
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Fence11.h"
+#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Program11.h"
+#include "libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/StateManager11.h"
+#include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h"
+#include "libANGLE/renderer/d3d/d3d11/VertexArray11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+
+namespace
+{
+ANGLE_INLINE bool DrawCallHasDynamicAttribs(const gl::Context *context)
+{
+ VertexArray11 *vertexArray11 = GetImplAs<VertexArray11>(context->getState().getVertexArray());
+ return vertexArray11->hasActiveDynamicAttrib(context);
+}
+
+bool DrawCallHasStreamingVertexArrays(const gl::Context *context, gl::PrimitiveMode mode)
+{
+ // Direct drawing doesn't support dynamic attribute storage since it needs the first and count
+ // to translate when applyVertexBuffer. GL_LINE_LOOP and GL_TRIANGLE_FAN are not supported
+ // either since we need to simulate them in D3D.
+ if (DrawCallHasDynamicAttribs(context) || mode == gl::PrimitiveMode::LineLoop ||
+ mode == gl::PrimitiveMode::TriangleFan)
+ {
+ return true;
+ }
+
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(context->getState().getProgram());
+ if (InstancedPointSpritesActive(programD3D, mode))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool DrawCallHasStreamingElementArray(const gl::Context *context, gl::DrawElementsType srcType)
+{
+ const gl::State &glState = context->getState();
+ gl::Buffer *elementArrayBuffer = glState.getVertexArray()->getElementArrayBuffer();
+
+ bool primitiveRestartWorkaround =
+ UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), srcType);
+ const gl::DrawElementsType dstType =
+ (srcType == gl::DrawElementsType::UnsignedInt || primitiveRestartWorkaround)
+ ? gl::DrawElementsType::UnsignedInt
+ : gl::DrawElementsType::UnsignedShort;
+
+ // Not clear where the offset comes from here.
+ switch (ClassifyIndexStorage(glState, elementArrayBuffer, srcType, dstType, 0))
+ {
+ case IndexStorageType::Dynamic:
+ return true;
+ case IndexStorageType::Direct:
+ return false;
+ case IndexStorageType::Static:
+ {
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(elementArrayBuffer);
+ StaticIndexBufferInterface *staticBuffer = bufferD3D->getStaticIndexBuffer();
+ return (staticBuffer->getBufferSize() == 0 || staticBuffer->getIndexType() != dstType);
+ }
+ default:
+ UNREACHABLE();
+ return true;
+ }
+}
+
+template <typename IndirectBufferT>
+angle::Result ReadbackIndirectBuffer(const gl::Context *context,
+ const void *indirect,
+ const IndirectBufferT **bufferPtrOut)
+{
+ const gl::State &glState = context->getState();
+ gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect);
+ ASSERT(drawIndirectBuffer);
+ Buffer11 *storage = GetImplAs<Buffer11>(drawIndirectBuffer);
+ uintptr_t offset = reinterpret_cast<uintptr_t>(indirect);
+
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(storage->getData(context, &bufferData));
+ ASSERT(bufferData);
+
+ *bufferPtrOut = reinterpret_cast<const IndirectBufferT *>(bufferData + offset);
+ return angle::Result::Continue;
+}
+} // anonymous namespace
+
+Context11::Context11(const gl::State &state, gl::ErrorSet *errorSet, Renderer11 *renderer)
+ : ContextD3D(state, errorSet), mRenderer(renderer)
+{}
+
+Context11::~Context11() {}
+
+angle::Result Context11::initialize()
+{
+ return angle::Result::Continue;
+}
+
+void Context11::onDestroy(const gl::Context *context)
+{
+ mIncompleteTextures.onDestroy(context);
+}
+
+CompilerImpl *Context11::createCompiler()
+{
+ if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ return new CompilerD3D(SH_HLSL_4_0_FL9_3_OUTPUT);
+ }
+ else
+ {
+ return new CompilerD3D(SH_HLSL_4_1_OUTPUT);
+ }
+}
+
+ShaderImpl *Context11::createShader(const gl::ShaderState &data)
+{
+ return new ShaderD3D(data, mRenderer->getFeatures(), mRenderer->getNativeExtensions());
+}
+
+ProgramImpl *Context11::createProgram(const gl::ProgramState &data)
+{
+ return new Program11(data, mRenderer);
+}
+
+FramebufferImpl *Context11::createFramebuffer(const gl::FramebufferState &data)
+{
+ return new Framebuffer11(data, mRenderer);
+}
+
+TextureImpl *Context11::createTexture(const gl::TextureState &state)
+{
+ switch (state.getType())
+ {
+ case gl::TextureType::_2D:
+ return new TextureD3D_2D(state, mRenderer);
+ case gl::TextureType::CubeMap:
+ return new TextureD3D_Cube(state, mRenderer);
+ case gl::TextureType::_3D:
+ return new TextureD3D_3D(state, mRenderer);
+ case gl::TextureType::_2DArray:
+ return new TextureD3D_2DArray(state, mRenderer);
+ case gl::TextureType::External:
+ return new TextureD3D_External(state, mRenderer);
+ case gl::TextureType::_2DMultisample:
+ return new TextureD3D_2DMultisample(state, mRenderer);
+ case gl::TextureType::_2DMultisampleArray:
+ return new TextureD3D_2DMultisampleArray(state, mRenderer);
+ default:
+ UNREACHABLE();
+ }
+
+ return nullptr;
+}
+
+RenderbufferImpl *Context11::createRenderbuffer(const gl::RenderbufferState &state)
+{
+ return new RenderbufferD3D(state, mRenderer);
+}
+
+BufferImpl *Context11::createBuffer(const gl::BufferState &state)
+{
+ Buffer11 *buffer = new Buffer11(state, mRenderer);
+ mRenderer->onBufferCreate(buffer);
+ return buffer;
+}
+
+VertexArrayImpl *Context11::createVertexArray(const gl::VertexArrayState &data)
+{
+ return new VertexArray11(data);
+}
+
+QueryImpl *Context11::createQuery(gl::QueryType type)
+{
+ return new Query11(mRenderer, type);
+}
+
+FenceNVImpl *Context11::createFenceNV()
+{
+ return new FenceNV11(mRenderer);
+}
+
+SyncImpl *Context11::createSync()
+{
+ return new Sync11(mRenderer);
+}
+
+TransformFeedbackImpl *Context11::createTransformFeedback(const gl::TransformFeedbackState &state)
+{
+ return new TransformFeedback11(state, mRenderer);
+}
+
+SamplerImpl *Context11::createSampler(const gl::SamplerState &state)
+{
+ return new SamplerD3D(state);
+}
+
+ProgramPipelineImpl *Context11::createProgramPipeline(const gl::ProgramPipelineState &data)
+{
+ return new ProgramPipeline11(data);
+}
+
+std::vector<PathImpl *> Context11::createPaths(GLsizei)
+{
+ return std::vector<PathImpl *>();
+}
+
+MemoryObjectImpl *Context11::createMemoryObject()
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+SemaphoreImpl *Context11::createSemaphore()
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+angle::Result Context11::flush(const gl::Context *context)
+{
+ return mRenderer->flush(this);
+}
+
+angle::Result Context11::finish(const gl::Context *context)
+{
+ return mRenderer->finish(this);
+}
+
+angle::Result Context11::drawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count)
+{
+ ASSERT(count > 0);
+ ANGLE_TRY(mRenderer->getStateManager()->updateState(
+ context, mode, first, count, gl::DrawElementsType::InvalidEnum, nullptr, 0, 0));
+ return mRenderer->drawArrays(context, mode, first, count, 0);
+}
+
+angle::Result Context11::drawArraysInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instanceCount)
+{
+ ASSERT(count > 0);
+ ANGLE_TRY(mRenderer->getStateManager()->updateState(
+ context, mode, first, count, gl::DrawElementsType::InvalidEnum, nullptr, instanceCount, 0));
+ return mRenderer->drawArrays(context, mode, first, count, instanceCount);
+}
+
+ANGLE_INLINE angle::Result Context11::drawElementsImpl(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ GLsizei instanceCount)
+{
+ ASSERT(indexCount > 0);
+
+ if (DrawCallHasDynamicAttribs(context))
+ {
+ gl::IndexRange indexRange;
+ ANGLE_TRY(context->getState().getVertexArray()->getIndexRange(
+ context, indexType, indexCount, indices, &indexRange));
+ ANGLE_TRY(mRenderer->getStateManager()->updateState(
+ context, mode, indexRange.start, indexCount, indexType, indices, instanceCount, 0));
+ return mRenderer->drawElements(context, mode, indexRange.start, indexCount, indexType,
+ indices, instanceCount);
+ }
+ else
+ {
+ ANGLE_TRY(mRenderer->getStateManager()->updateState(context, mode, 0, indexCount, indexType,
+ indices, instanceCount, 0));
+ return mRenderer->drawElements(context, mode, 0, indexCount, indexType, indices,
+ instanceCount);
+ }
+}
+
+angle::Result Context11::drawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices)
+{
+ return drawElementsImpl(context, mode, count, type, indices, 0);
+}
+
+angle::Result Context11::drawElementsInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances)
+{
+ return drawElementsImpl(context, mode, count, type, indices, instances);
+}
+
+angle::Result Context11::drawRangeElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices)
+{
+ return drawElementsImpl(context, mode, count, type, indices, 0);
+}
+
+angle::Result Context11::drawArraysIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ const void *indirect)
+{
+ if (DrawCallHasStreamingVertexArrays(context, mode))
+ {
+ const gl::DrawArraysIndirectCommand *cmd = nullptr;
+ ANGLE_TRY(ReadbackIndirectBuffer(context, indirect, &cmd));
+
+ ANGLE_TRY(mRenderer->getStateManager()->updateState(context, mode, cmd->first, cmd->count,
+ gl::DrawElementsType::InvalidEnum,
+ nullptr, cmd->instanceCount, 0));
+ return mRenderer->drawArrays(context, mode, cmd->first, cmd->count, cmd->instanceCount);
+ }
+ else
+ {
+ ANGLE_TRY(mRenderer->getStateManager()->updateState(
+ context, mode, 0, 0, gl::DrawElementsType::InvalidEnum, nullptr, 0, 0));
+ return mRenderer->drawArraysIndirect(context, indirect);
+ }
+}
+
+angle::Result Context11::drawElementsIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType type,
+ const void *indirect)
+{
+ if (DrawCallHasStreamingVertexArrays(context, mode) ||
+ DrawCallHasStreamingElementArray(context, type))
+ {
+ const gl::DrawElementsIndirectCommand *cmd = nullptr;
+ ANGLE_TRY(ReadbackIndirectBuffer(context, indirect, &cmd));
+
+ const GLuint typeBytes = gl::GetDrawElementsTypeSize(type);
+ const void *indices =
+ reinterpret_cast<const void *>(static_cast<uintptr_t>(cmd->firstIndex * typeBytes));
+
+ // We must explicitly resolve the index range for the slow-path indirect drawElements to
+ // make sure we are using the correct 'baseVertex'. This parameter does not exist for the
+ // direct drawElements.
+ gl::IndexRange indexRange;
+ ANGLE_TRY(context->getState().getVertexArray()->getIndexRange(context, type, cmd->count,
+ indices, &indexRange));
+
+ GLint startVertex;
+ ANGLE_TRY(ComputeStartVertex(GetImplAs<Context11>(context), indexRange, cmd->baseVertex,
+ &startVertex));
+
+ ANGLE_TRY(mRenderer->getStateManager()->updateState(context, mode, startVertex, cmd->count,
+ type, indices, cmd->primCount,
+ cmd->baseVertex));
+ return mRenderer->drawElements(context, mode, indexRange.start, cmd->count, type, indices,
+ cmd->primCount);
+ }
+ else
+ {
+ ANGLE_TRY(
+ mRenderer->getStateManager()->updateState(context, mode, 0, 0, type, nullptr, 0, 0));
+ return mRenderer->drawElementsIndirect(context, indirect);
+ }
+}
+
+gl::GraphicsResetStatus Context11::getResetStatus()
+{
+ return mRenderer->getResetStatus();
+}
+
+std::string Context11::getVendorString() const
+{
+ return mRenderer->getVendorString();
+}
+
+std::string Context11::getRendererDescription() const
+{
+ return mRenderer->getRendererDescription();
+}
+
+void Context11::insertEventMarker(GLsizei length, const char *marker)
+{
+ mRenderer->getAnnotator()->setMarker(marker);
+}
+
+void Context11::pushGroupMarker(GLsizei length, const char *marker)
+{
+ mRenderer->getAnnotator()->beginEvent(marker, marker);
+ mMarkerStack.push(std::string(marker));
+}
+
+void Context11::popGroupMarker()
+{
+ const char *marker = nullptr;
+ if (!mMarkerStack.empty())
+ {
+ marker = mMarkerStack.top().c_str();
+ mMarkerStack.pop();
+ mRenderer->getAnnotator()->endEvent(marker);
+ }
+}
+
+void Context11::pushDebugGroup(GLenum source, GLuint id, const std::string &message)
+{
+ // Fall through to the EXT_debug_marker functions
+ pushGroupMarker(message.size(), message.c_str());
+}
+
+void Context11::popDebugGroup()
+{
+ // Fall through to the EXT_debug_marker functions
+ popGroupMarker();
+}
+
+angle::Result Context11::syncState(const gl::Context *context,
+ const gl::State::DirtyBits &dirtyBits,
+ const gl::State::DirtyBits &bitMask)
+{
+ mRenderer->getStateManager()->syncState(context, dirtyBits);
+ return angle::Result::Continue;
+}
+
+GLint Context11::getGPUDisjoint()
+{
+ return mRenderer->getGPUDisjoint();
+}
+
+GLint64 Context11::getTimestamp()
+{
+ return mRenderer->getTimestamp();
+}
+
+angle::Result Context11::onMakeCurrent(const gl::Context *context)
+{
+ return mRenderer->getStateManager()->onMakeCurrent(context);
+}
+
+gl::Caps Context11::getNativeCaps() const
+{
+ gl::Caps caps = mRenderer->getNativeCaps();
+
+ // For pixel shaders, the render targets and unordered access views share the same resource
+ // slots, so the maximum number of fragment shader outputs depends on the current context
+ // version:
+ // - If current context is ES 3.0 and below, we use D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT(8)
+ // as the value of max draw buffers because UAVs are not used.
+ // - If current context is ES 3.1 and the feature level is 11_0, the RTVs and UAVs share 8
+ // slots. As ES 3.1 requires at least 1 atomic counter buffer in compute shaders, the value
+ // of max combined shader output resources is limited to 7, thus only 7 RTV slots can be
+ // used simultaneously.
+ // - If current context is ES 3.1 and the feature level is 11_1, the RTVs and UAVs share 64
+ // slots. Currently we allocate 60 slots for combined shader output resources, so we can use
+ // at most D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT(8) RTVs simultaneously.
+ if (mState.getClientVersion() >= gl::ES_3_1 &&
+ mRenderer->getRenderer11DeviceCaps().featureLevel == D3D_FEATURE_LEVEL_11_0)
+ {
+ caps.maxDrawBuffers = caps.maxCombinedShaderOutputResources;
+ caps.maxColorAttachments = caps.maxCombinedShaderOutputResources;
+ }
+
+ return caps;
+}
+
+const gl::TextureCapsMap &Context11::getNativeTextureCaps() const
+{
+ return mRenderer->getNativeTextureCaps();
+}
+
+const gl::Extensions &Context11::getNativeExtensions() const
+{
+ return mRenderer->getNativeExtensions();
+}
+
+const gl::Limitations &Context11::getNativeLimitations() const
+{
+ return mRenderer->getNativeLimitations();
+}
+
+angle::Result Context11::dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ)
+{
+ return mRenderer->dispatchCompute(context, numGroupsX, numGroupsY, numGroupsZ);
+}
+
+angle::Result Context11::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect)
+{
+ return mRenderer->dispatchComputeIndirect(context, indirect);
+}
+
+angle::Result Context11::triggerDrawCallProgramRecompilation(const gl::Context *context,
+ gl::PrimitiveMode drawMode)
+{
+ const auto &glState = context->getState();
+ const auto *va11 = GetImplAs<VertexArray11>(glState.getVertexArray());
+ const auto *drawFBO = glState.getDrawFramebuffer();
+ gl::Program *program = glState.getProgram();
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
+
+ programD3D->updateCachedInputLayout(va11->getCurrentStateSerial(), glState);
+ programD3D->updateCachedOutputLayout(context, drawFBO);
+
+ bool recompileVS = !programD3D->hasVertexExecutableForCachedInputLayout();
+ bool recompileGS = !programD3D->hasGeometryExecutableForPrimitiveType(glState, drawMode);
+ bool recompilePS = !programD3D->hasPixelExecutableForCachedOutputLayout();
+
+ if (!recompileVS && !recompileGS && !recompilePS)
+ {
+ return angle::Result::Continue;
+ }
+
+ // Load the compiler if necessary and recompile the programs.
+ ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(this));
+
+ gl::InfoLog infoLog;
+
+ if (recompileVS)
+ {
+ ShaderExecutableD3D *vertexExe = nullptr;
+ ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(this, &vertexExe, &infoLog));
+ if (!programD3D->hasVertexExecutableForCachedInputLayout())
+ {
+ ASSERT(infoLog.getLength() > 0);
+ ERR() << "Error compiling dynamic vertex executable: " << infoLog.str();
+ ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic vertex executable");
+ }
+ }
+
+ if (recompileGS)
+ {
+ ShaderExecutableD3D *geometryExe = nullptr;
+ ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(this, glState, drawMode,
+ &geometryExe, &infoLog));
+ if (!programD3D->hasGeometryExecutableForPrimitiveType(glState, drawMode))
+ {
+ ASSERT(infoLog.getLength() > 0);
+ ERR() << "Error compiling dynamic geometry executable: " << infoLog.str();
+ ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic geometry executable");
+ }
+ }
+
+ if (recompilePS)
+ {
+ ShaderExecutableD3D *pixelExe = nullptr;
+ ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(this, &pixelExe, &infoLog));
+ if (!programD3D->hasPixelExecutableForCachedOutputLayout())
+ {
+ ASSERT(infoLog.getLength() > 0);
+ ERR() << "Error compiling dynamic pixel executable: " << infoLog.str();
+ ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic pixel executable");
+ }
+ }
+
+ // Refresh the program cache entry.
+ if (mMemoryProgramCache)
+ {
+ mMemoryProgramCache->updateProgram(context, program);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Context11::triggerDispatchCallProgramRecompilation(const gl::Context *context)
+{
+ const auto &glState = context->getState();
+ gl::Program *program = glState.getProgram();
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
+
+ programD3D->updateCachedComputeImage2DBindLayout(context);
+
+ bool recompileCS = !programD3D->hasComputeExecutableForCachedImage2DBindLayout();
+
+ if (!recompileCS)
+ {
+ return angle::Result::Continue;
+ }
+
+ // Load the compiler if necessary and recompile the programs.
+ ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(this));
+
+ gl::InfoLog infoLog;
+
+ ShaderExecutableD3D *computeExe = nullptr;
+ ANGLE_TRY(programD3D->getComputeExecutableForImage2DBindLayout(this, &computeExe, &infoLog));
+ if (!programD3D->hasComputeExecutableForCachedImage2DBindLayout())
+ {
+ ASSERT(infoLog.getLength() > 0);
+ ERR() << "Dynamic recompilation error log: " << infoLog.str();
+ ANGLE_TRY_HR(this, E_FAIL, "Error compiling dynamic compute executable");
+ }
+
+ // Refresh the program cache entry.
+ if (mMemoryProgramCache)
+ {
+ mMemoryProgramCache->updateProgram(context, program);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Context11::memoryBarrier(const gl::Context *context, GLbitfield barriers)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result Context11::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result Context11::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
+{
+ return mIncompleteTextures.getIncompleteTexture(context, type, this, textureOut);
+}
+
+angle::Result Context11::initializeMultisampleTextureToBlack(const gl::Context *context,
+ gl::Texture *glTexture)
+{
+ ASSERT(glTexture->getType() == gl::TextureType::_2DMultisample);
+ TextureD3D *textureD3D = GetImplAs<TextureD3D>(glTexture);
+ gl::ImageIndex index = gl::ImageIndex::Make2DMultisample();
+ RenderTargetD3D *renderTarget = nullptr;
+ ANGLE_TRY(textureD3D->getRenderTarget(context, index, &renderTarget));
+ return mRenderer->clearRenderTarget(context, renderTarget, gl::ColorF(0.0f, 0.0f, 0.0f, 1.0f),
+ 1.0f, 0);
+}
+
+void Context11::handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line)
+{
+ ASSERT(FAILED(hr));
+
+ if (d3d11::isDeviceLostError(hr))
+ {
+ mRenderer->notifyDeviceLost();
+ }
+
+ GLenum glErrorCode = DefaultGLErrorCode(hr);
+
+ std::stringstream errorStream;
+ errorStream << "Internal D3D11 error: " << gl::FmtHR(hr) << ": " << message;
+
+ mErrors->handleError(glErrorCode, errorStream.str().c_str(), file, function, line);
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h
new file mode 100644
index 0000000000..4a1bb0efc7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h
@@ -0,0 +1,190 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context11:
+// D3D11-specific functionality associated with a GL Context.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_CONTEXT11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_CONTEXT11_H_
+
+#include <stack>
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+
+namespace rx
+{
+class Renderer11;
+
+class Context11 : public ContextD3D, public MultisampleTextureInitializer
+{
+ public:
+ Context11(const gl::State &state, gl::ErrorSet *errorSet, Renderer11 *renderer);
+ ~Context11() override;
+
+ angle::Result initialize() override;
+ void onDestroy(const gl::Context *context) override;
+
+ // Shader creation
+ CompilerImpl *createCompiler() override;
+ ShaderImpl *createShader(const gl::ShaderState &data) override;
+ ProgramImpl *createProgram(const gl::ProgramState &data) override;
+
+ // Framebuffer creation
+ FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override;
+
+ // Texture creation
+ TextureImpl *createTexture(const gl::TextureState &state) override;
+
+ // Renderbuffer creation
+ RenderbufferImpl *createRenderbuffer(const gl::RenderbufferState &state) override;
+
+ // Buffer creation
+ BufferImpl *createBuffer(const gl::BufferState &state) override;
+
+ // Vertex Array creation
+ VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) override;
+
+ // Query and Fence creation
+ QueryImpl *createQuery(gl::QueryType type) override;
+ FenceNVImpl *createFenceNV() override;
+ SyncImpl *createSync() override;
+
+ // Transform Feedback creation
+ TransformFeedbackImpl *createTransformFeedback(
+ const gl::TransformFeedbackState &state) override;
+
+ // Sampler object creation
+ SamplerImpl *createSampler(const gl::SamplerState &state) override;
+
+ // Program Pipeline object creation
+ ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
+
+ // Path object creation.
+ std::vector<PathImpl *> createPaths(GLsizei) override;
+
+ // Memory object creation.
+ MemoryObjectImpl *createMemoryObject() override;
+
+ // Semaphore creation.
+ SemaphoreImpl *createSemaphore() override;
+
+ // Flush and finish.
+ angle::Result flush(const gl::Context *context) override;
+ angle::Result finish(const gl::Context *context) override;
+
+ // Drawing methods.
+ angle::Result drawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count) override;
+ angle::Result drawArraysInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instanceCount) override;
+
+ angle::Result drawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices) override;
+ angle::Result drawElementsInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances) override;
+ angle::Result drawRangeElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices) override;
+ angle::Result drawArraysIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ const void *indirect) override;
+ angle::Result drawElementsIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType type,
+ const void *indirect) override;
+
+ // Device loss
+ gl::GraphicsResetStatus getResetStatus() override;
+
+ // Vendor and description strings.
+ std::string getVendorString() const override;
+ std::string getRendererDescription() const override;
+
+ // EXT_debug_marker
+ void insertEventMarker(GLsizei length, const char *marker) override;
+ void pushGroupMarker(GLsizei length, const char *marker) override;
+ void popGroupMarker() override;
+
+ // KHR_debug
+ void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
+ void popDebugGroup() override;
+
+ // State sync with dirty bits.
+ angle::Result syncState(const gl::Context *context,
+ const gl::State::DirtyBits &dirtyBits,
+ const gl::State::DirtyBits &bitMask) override;
+
+ // Disjoint timer queries
+ GLint getGPUDisjoint() override;
+ GLint64 getTimestamp() override;
+
+ // Context switching
+ angle::Result onMakeCurrent(const gl::Context *context) override;
+
+ // Caps queries
+ gl::Caps getNativeCaps() const override;
+ const gl::TextureCapsMap &getNativeTextureCaps() const override;
+ const gl::Extensions &getNativeExtensions() const override;
+ const gl::Limitations &getNativeLimitations() const override;
+
+ Renderer11 *getRenderer() const { return mRenderer; }
+
+ angle::Result dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ) override;
+ angle::Result dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) override;
+
+ angle::Result memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
+ angle::Result memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
+
+ angle::Result triggerDrawCallProgramRecompilation(const gl::Context *context,
+ gl::PrimitiveMode drawMode);
+ angle::Result triggerDispatchCallProgramRecompilation(const gl::Context *context);
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut);
+
+ angle::Result initializeMultisampleTextureToBlack(const gl::Context *context,
+ gl::Texture *glTexture) override;
+
+ void handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line) override;
+
+ private:
+ angle::Result drawElementsImpl(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ GLsizei instanceCount);
+
+ Renderer11 *mRenderer;
+ IncompleteTextureSet mIncompleteTextures;
+ std::stack<std::string> mMarkerStack;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_CONTEXT11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp
new file mode 100644
index 0000000000..8a5a944cd2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp
@@ -0,0 +1,86 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DebugAnnotator11.cpp: D3D11 helpers for adding trace annotations.
+//
+
+#include "libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h"
+
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#include <versionhelpers.h>
+
+namespace rx
+{
+
+DebugAnnotator11::DebugAnnotator11() {}
+
+DebugAnnotator11::~DebugAnnotator11() {}
+
+void DebugAnnotator11::beginEvent(const char *eventName, const char *eventMessage)
+{
+ angle::LoggingAnnotator::beginEvent(eventName, eventMessage);
+ if (mUserDefinedAnnotation != nullptr)
+ {
+ std::mbstate_t state = std::mbstate_t();
+ std::mbsrtowcs(mWCharMessage, &eventMessage, kMaxMessageLength, &state);
+ std::lock_guard<std::mutex> lock(mAnnotationMutex);
+ mUserDefinedAnnotation->BeginEvent(mWCharMessage);
+ }
+}
+
+void DebugAnnotator11::endEvent(const char *eventName)
+{
+ angle::LoggingAnnotator::endEvent(eventName);
+ if (mUserDefinedAnnotation != nullptr)
+ {
+ std::lock_guard<std::mutex> lock(mAnnotationMutex);
+ mUserDefinedAnnotation->EndEvent();
+ }
+}
+
+void DebugAnnotator11::setMarker(const char *markerName)
+{
+ angle::LoggingAnnotator::setMarker(markerName);
+ if (mUserDefinedAnnotation != nullptr)
+ {
+ std::mbstate_t state = std::mbstate_t();
+ std::mbsrtowcs(mWCharMessage, &markerName, kMaxMessageLength, &state);
+ std::lock_guard<std::mutex> lock(mAnnotationMutex);
+ mUserDefinedAnnotation->SetMarker(mWCharMessage);
+ }
+}
+
+bool DebugAnnotator11::getStatus()
+{
+ if (mUserDefinedAnnotation != nullptr)
+ {
+ std::lock_guard<std::mutex> lock(mAnnotationMutex);
+ return !!(mUserDefinedAnnotation->GetStatus());
+ }
+
+ return false;
+}
+
+void DebugAnnotator11::initialize(ID3D11DeviceContext *context)
+{
+ // ID3DUserDefinedAnnotation.GetStatus only works on Windows10 or greater.
+ // Returning true unconditionally from DebugAnnotator11::getStatus() means
+ // writing out all compiled shaders to temporary files even if debugging
+ // tools are not attached. See rx::ShaderD3D::prepareSourceAndReturnOptions.
+ // If you want debug annotations, you must use Windows 10.
+ if (IsWindows10OrGreater())
+ {
+ mUserDefinedAnnotation.Attach(
+ d3d11::DynamicCastComObject<ID3DUserDefinedAnnotation>(context));
+ }
+}
+
+void DebugAnnotator11::release()
+{
+ mUserDefinedAnnotation.Reset();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h
new file mode 100644
index 0000000000..6d71617585
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h
@@ -0,0 +1,40 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DebugAnnotator11.h: D3D11 helpers for adding trace annotations.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
+
+#include "libANGLE/LoggingAnnotator.h"
+
+#include <mutex>
+
+namespace rx
+{
+
+class DebugAnnotator11 : public angle::LoggingAnnotator
+{
+ public:
+ DebugAnnotator11();
+ ~DebugAnnotator11() override;
+ void initialize(ID3D11DeviceContext *context);
+ void release();
+ void beginEvent(const char *eventName, const char *eventMessage) override;
+ void endEvent(const char *eventName) override;
+ void setMarker(const char *markerName) override;
+ bool getStatus() override;
+
+ private:
+ angle::ComPtr<ID3DUserDefinedAnnotation> mUserDefinedAnnotation;
+ static constexpr size_t kMaxMessageLength = 256;
+ wchar_t mWCharMessage[kMaxMessageLength];
+ std::mutex mAnnotationMutex;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp
new file mode 100644
index 0000000000..adeeb5aa14
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp
@@ -0,0 +1,151 @@
+//
+// Copyright 2019 The ANGLE Project 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 "libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+namespace rx
+{
+ExternalImageSiblingImpl11::ExternalImageSiblingImpl11(Renderer11 *renderer, EGLClientBuffer buffer)
+ : mRenderer(renderer),
+ mBuffer(buffer),
+ mFormat(GL_NONE),
+ mIsRenderable(false),
+ mIsTexturable(false),
+ mSamples(0)
+{}
+
+ExternalImageSiblingImpl11::~ExternalImageSiblingImpl11() {}
+
+egl::Error ExternalImageSiblingImpl11::initialize(const egl::Display *display)
+{
+ EGLint width, height, samples = 0;
+ const angle::Format *format = nullptr;
+ ANGLE_TRY(mRenderer->getD3DTextureInfo(nullptr, static_cast<IUnknown *>(mBuffer), &width,
+ &height, &samples, &format));
+ mFormat = gl::Format(format->glInternalFormat);
+ mSize = gl::Extents(width, height, 1);
+ mSamples = static_cast<size_t>(samples);
+
+ ID3D11Texture2D *texture =
+ d3d11::DynamicCastComObject<ID3D11Texture2D>(static_cast<IUnknown *>(mBuffer));
+ ASSERT(texture != nullptr);
+ // TextureHelper11 will release texture on destruction.
+ mTexture.set(texture, d3d11::Format::Get(format->glInternalFormat,
+ mRenderer->getRenderer11DeviceCaps()));
+ D3D11_TEXTURE2D_DESC textureDesc = {};
+ mTexture.getDesc(&textureDesc);
+
+ IDXGIResource *resource = d3d11::DynamicCastComObject<IDXGIResource>(mTexture.get());
+ ASSERT(resource != nullptr);
+ DXGI_USAGE resourceUsage = 0;
+ resource->GetUsage(&resourceUsage);
+ SafeRelease(resource);
+
+ mIsRenderable = (textureDesc.BindFlags & D3D11_BIND_RENDER_TARGET) &&
+ (resourceUsage & DXGI_USAGE_RENDER_TARGET_OUTPUT) &&
+ !(resourceUsage & DXGI_USAGE_READ_ONLY);
+
+ mIsTexturable = (textureDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE) &&
+ (resourceUsage & DXGI_USAGE_SHADER_INPUT);
+
+ return egl::NoError();
+}
+
+gl::Format ExternalImageSiblingImpl11::getFormat() const
+{
+ return mFormat;
+}
+
+bool ExternalImageSiblingImpl11::isRenderable(const gl::Context *context) const
+{
+ return mIsRenderable;
+}
+
+bool ExternalImageSiblingImpl11::isTexturable(const gl::Context *context) const
+{
+ return mIsTexturable;
+}
+
+gl::Extents ExternalImageSiblingImpl11::getSize() const
+{
+ return mSize;
+}
+
+size_t ExternalImageSiblingImpl11::getSamples() const
+{
+ return mSamples;
+}
+
+angle::Result ExternalImageSiblingImpl11::getAttachmentRenderTarget(
+ const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut)
+{
+ ANGLE_TRY(createRenderTarget(context));
+ *rtOut = mRenderTarget.get();
+ return angle::Result::Continue;
+}
+
+angle::Result ExternalImageSiblingImpl11::initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex)
+{
+ UNREACHABLE();
+ return angle::Result::Stop;
+}
+
+angle::Result ExternalImageSiblingImpl11::createRenderTarget(const gl::Context *context)
+{
+ if (mRenderTarget)
+ return angle::Result::Continue;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+ const d3d11::Format &formatInfo = mTexture.getFormatSet();
+
+ d3d11::RenderTargetView rtv;
+ if (mIsRenderable)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = formatInfo.rtvFormat;
+ rtvDesc.ViewDimension =
+ mSamples == 0 ? D3D11_RTV_DIMENSION_TEXTURE2D : D3D11_RTV_DIMENSION_TEXTURE2DMS;
+ rtvDesc.Texture2D.MipSlice = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, rtvDesc, mTexture.get(), &rtv));
+ rtv.setDebugName("getAttachmentRenderTarget.RTV");
+ }
+
+ d3d11::SharedSRV srv;
+ if (mIsTexturable)
+ {
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = formatInfo.srvFormat;
+ srvDesc.ViewDimension =
+ mSamples == 0 ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ srvDesc.Texture2D.MostDetailedMip = 0;
+ srvDesc.Texture2D.MipLevels = 1;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, srvDesc, mTexture.get(), &srv));
+ srv.setDebugName("getAttachmentRenderTarget.SRV");
+ }
+ d3d11::SharedSRV blitSrv = srv.makeCopy();
+
+ mRenderTarget = std::make_unique<TextureRenderTarget11>(
+ std::move(rtv), mTexture, std::move(srv), std::move(blitSrv), formatInfo.internalFormat,
+ formatInfo, mSize.width, mSize.height, 1, 1);
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.h
new file mode 100644
index 0000000000..874461a0b7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.h
@@ -0,0 +1,59 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_EXTERNALIMAGESIBLINGIMPL11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_EXTERNALIMAGESIBLINGIMPL11_H_
+
+#include "libANGLE/renderer/ImageImpl.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+
+class Renderer11;
+class RenderTargetD3D;
+
+class ExternalImageSiblingImpl11 : public ExternalImageSiblingImpl
+{
+ public:
+ ExternalImageSiblingImpl11(Renderer11 *renderer, EGLClientBuffer clientBuffer);
+ ~ExternalImageSiblingImpl11() override;
+
+ // ExternalImageSiblingImpl interface
+ egl::Error initialize(const egl::Display *display) override;
+ gl::Format getFormat() const override;
+ bool isRenderable(const gl::Context *context) const override;
+ bool isTexturable(const gl::Context *context) const override;
+ gl::Extents getSize() const override;
+ size_t getSamples() const override;
+
+ // FramebufferAttachmentObjectImpl interface
+ angle::Result getAttachmentRenderTarget(const gl::Context *context,
+ GLenum binding,
+ const gl::ImageIndex &imageIndex,
+ FramebufferAttachmentRenderTarget **rtOut) override;
+ angle::Result initializeContents(const gl::Context *context,
+ const gl::ImageIndex &imageIndex) override;
+
+ private:
+ angle::Result createRenderTarget(const gl::Context *context);
+
+ Renderer11 *mRenderer;
+ EGLClientBuffer mBuffer;
+ TextureHelper11 mTexture;
+
+ gl::Format mFormat;
+ bool mIsRenderable;
+ bool mIsTexturable;
+ gl::Extents mSize;
+ size_t mSamples;
+
+ std::unique_ptr<RenderTargetD3D> mRenderTarget;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_EXTERNALIMAGESIBLINGIMPL11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
new file mode 100644
index 0000000000..0926b4a185
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
@@ -0,0 +1,234 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence11.cpp: Defines the rx::FenceNV11 and rx::Sync11 classes which implement
+// rx::FenceNVImpl and rx::SyncImpl.
+
+#include "libANGLE/renderer/d3d/d3d11/Fence11.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+
+namespace rx
+{
+
+//
+// Template helpers for set and test operations.
+//
+
+template <class FenceClass>
+angle::Result FenceSetHelper(const gl::Context *context, FenceClass *fence)
+{
+ if (!fence->mQuery)
+ {
+ D3D11_QUERY_DESC queryDesc;
+ queryDesc.Query = D3D11_QUERY_EVENT;
+ queryDesc.MiscFlags = 0;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+ HRESULT result = fence->mRenderer->getDevice()->CreateQuery(&queryDesc, &fence->mQuery);
+ ANGLE_TRY_HR(context11, result, "Failed to create event query");
+ }
+
+ fence->mRenderer->getDeviceContext()->End(fence->mQuery);
+ return angle::Result::Continue;
+}
+
+template <class FenceClass>
+angle::Result FenceTestHelper(const gl::Context *context,
+ FenceClass *fence,
+ bool flushCommandBuffer,
+ GLboolean *outFinished)
+{
+ ASSERT(fence->mQuery);
+
+ UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH);
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+ HRESULT result =
+ fence->mRenderer->getDeviceContext()->GetData(fence->mQuery, nullptr, 0, getDataFlags);
+ ANGLE_TRY_HR(context11, result, "Failed to get query data");
+
+ ASSERT(result == S_OK || result == S_FALSE);
+ *outFinished = ((result == S_OK) ? GL_TRUE : GL_FALSE);
+ return angle::Result::Continue;
+}
+
+//
+// FenceNV11
+//
+
+FenceNV11::FenceNV11(Renderer11 *renderer) : FenceNVImpl(), mRenderer(renderer), mQuery(nullptr) {}
+
+FenceNV11::~FenceNV11()
+{
+ SafeRelease(mQuery);
+}
+
+angle::Result FenceNV11::set(const gl::Context *context, GLenum condition)
+{
+ return FenceSetHelper(context, this);
+}
+
+angle::Result FenceNV11::test(const gl::Context *context, GLboolean *outFinished)
+{
+ return FenceTestHelper(context, this, true, outFinished);
+}
+
+angle::Result FenceNV11::finish(const gl::Context *context)
+{
+ GLboolean finished = GL_FALSE;
+
+ int loopCount = 0;
+ while (finished != GL_TRUE)
+ {
+ loopCount++;
+ ANGLE_TRY(FenceTestHelper(context, this, true, &finished));
+
+ bool checkDeviceLost = (loopCount % kPollingD3DDeviceLostCheckFrequency) == 0;
+ if (checkDeviceLost && mRenderer->testDeviceLost())
+ {
+ ANGLE_TRY_HR(GetImplAs<Context11>(context), DXGI_ERROR_DRIVER_INTERNAL_ERROR,
+ "Device was lost while querying result of an event query.");
+ }
+
+ ScheduleYield();
+ }
+
+ return angle::Result::Continue;
+}
+
+//
+// Sync11
+//
+
+// 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.
+
+Sync11::Sync11(Renderer11 *renderer) : SyncImpl(), mRenderer(renderer), mQuery(nullptr)
+{
+ LARGE_INTEGER counterFreqency = {};
+ BOOL success = QueryPerformanceFrequency(&counterFreqency);
+ ASSERT(success);
+
+ mCounterFrequency = counterFreqency.QuadPart;
+}
+
+Sync11::~Sync11()
+{
+ SafeRelease(mQuery);
+}
+
+angle::Result Sync11::set(const gl::Context *context, GLenum condition, GLbitfield flags)
+{
+ ASSERT(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0);
+ return FenceSetHelper(context, this);
+}
+
+angle::Result Sync11::clientWait(const gl::Context *context,
+ GLbitfield flags,
+ GLuint64 timeout,
+ GLenum *outResult)
+{
+ ASSERT(outResult);
+
+ bool flushCommandBuffer = ((flags & GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
+
+ *outResult = GL_WAIT_FAILED;
+
+ GLboolean result = GL_FALSE;
+ ANGLE_TRY(FenceTestHelper(context, this, flushCommandBuffer, &result));
+
+ if (result == GL_TRUE)
+ {
+ *outResult = GL_ALREADY_SIGNALED;
+ return angle::Result::Continue;
+ }
+
+ if (timeout == 0)
+ {
+ *outResult = GL_TIMEOUT_EXPIRED;
+ return angle::Result::Continue;
+ }
+
+ LARGE_INTEGER currentCounter = {};
+ BOOL success = QueryPerformanceCounter(&currentCounter);
+ ASSERT(success);
+
+ LONGLONG timeoutInSeconds = static_cast<LONGLONG>(timeout / 1000000000ull);
+ LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
+
+ // Extremely unlikely, but if mCounterFrequency is large enough, endCounter can wrap
+ if (endCounter < currentCounter.QuadPart)
+ {
+ endCounter = MAXLONGLONG;
+ }
+
+ int loopCount = 0;
+ while (currentCounter.QuadPart < endCounter && !result)
+ {
+ loopCount++;
+ ScheduleYield();
+ success = QueryPerformanceCounter(&currentCounter);
+ ASSERT(success);
+
+ *outResult = GL_WAIT_FAILED;
+
+ ANGLE_TRY(FenceTestHelper(context, this, flushCommandBuffer, &result));
+
+ bool checkDeviceLost = (loopCount % kPollingD3DDeviceLostCheckFrequency) == 0;
+ if (checkDeviceLost && mRenderer->testDeviceLost())
+ {
+ *outResult = GL_WAIT_FAILED;
+ ANGLE_TRY_HR(GetImplAs<Context11>(context), DXGI_ERROR_DRIVER_INTERNAL_ERROR,
+ "Device was lost while querying result of an event query.");
+ }
+ }
+
+ if (currentCounter.QuadPart >= endCounter)
+ {
+ *outResult = GL_TIMEOUT_EXPIRED;
+ }
+ else
+ {
+ *outResult = GL_CONDITION_SATISFIED;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Sync11::serverWait(const gl::Context *context, GLbitfield flags, GLuint64 timeout)
+{
+ // Because our API is currently designed to be called from a single thread, we don't need to do
+ // extra work for a server-side fence. GPU commands issued after the fence is created will
+ // always be processed after the fence is signaled.
+ return angle::Result::Continue;
+}
+
+angle::Result Sync11::getStatus(const gl::Context *context, GLint *outResult)
+{
+ GLboolean result = GL_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.
+ *outResult = GL_SIGNALED;
+ ANGLE_TRY(FenceTestHelper(context, this, false, &result));
+
+ *outResult = (result ? GL_SIGNALED : GL_UNSIGNALED);
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.h
new file mode 100644
index 0000000000..036ec58dac
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.h
@@ -0,0 +1,75 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence11.h: Defines the rx::FenceNV11 and rx::Sync11 classes which implement rx::FenceNVImpl
+// and rx::SyncImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_FENCE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_FENCE11_H_
+
+#include "libANGLE/renderer/FenceNVImpl.h"
+#include "libANGLE/renderer/SyncImpl.h"
+
+namespace rx
+{
+class Renderer11;
+
+class FenceNV11 : public FenceNVImpl
+{
+ public:
+ explicit FenceNV11(Renderer11 *renderer);
+ ~FenceNV11() override;
+
+ angle::Result set(const gl::Context *context, GLenum condition) override;
+ angle::Result test(const gl::Context *context, GLboolean *outFinished) override;
+ angle::Result finish(const gl::Context *context) override;
+
+ private:
+ template <class T>
+ friend angle::Result FenceSetHelper(const gl::Context *context, T *fence);
+ template <class T>
+ friend angle::Result FenceTestHelper(const gl::Context *context,
+ T *fence,
+ bool flushCommandBuffer,
+ GLboolean *outFinished);
+
+ Renderer11 *mRenderer;
+ ID3D11Query *mQuery;
+};
+
+class Sync11 : public SyncImpl
+{
+ public:
+ explicit Sync11(Renderer11 *renderer);
+ ~Sync11() override;
+
+ angle::Result set(const gl::Context *context, GLenum condition, GLbitfield flags) override;
+ angle::Result clientWait(const gl::Context *context,
+ GLbitfield flags,
+ GLuint64 timeout,
+ GLenum *outResult) override;
+ angle::Result serverWait(const gl::Context *context,
+ GLbitfield flags,
+ GLuint64 timeout) override;
+ angle::Result getStatus(const gl::Context *context, GLint *outResult) override;
+
+ private:
+ template <class T>
+ friend angle::Result FenceSetHelper(const gl::Context *context, T *fence);
+ template <class T>
+ friend angle::Result FenceTestHelper(const gl::Context *context,
+ T *fence,
+ bool flushCommandBuffer,
+ GLboolean *outFinished);
+
+ Renderer11 *mRenderer;
+ ID3D11Query *mQuery;
+ LONGLONG mCounterFrequency;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_FENCE11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
new file mode 100644
index 0000000000..6d8b99d7b7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
@@ -0,0 +1,424 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer11.cpp: Implements the Framebuffer11 class.
+
+#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
+
+#include "common/bitset_utils.h"
+#include "common/debug.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Clear11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+using namespace angle;
+
+namespace rx
+{
+
+namespace
+{
+angle::Result MarkAttachmentsDirty(const gl::Context *context,
+ const gl::FramebufferAttachment *attachment)
+{
+ if (attachment->type() == GL_TEXTURE)
+ {
+ gl::Texture *texture = attachment->getTexture();
+
+ TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
+
+ TextureStorage *texStorage = nullptr;
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &texStorage));
+
+ if (texStorage)
+ {
+ TextureStorage11 *texStorage11 = GetAs<TextureStorage11>(texStorage);
+ ASSERT(texStorage11);
+
+ texStorage11->markLevelDirty(attachment->mipLevel());
+ }
+ }
+
+ return angle::Result::Continue;
+}
+} // anonymous namespace
+
+Framebuffer11::Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer)
+ : FramebufferD3D(data, renderer), mRenderer(renderer)
+{
+ ASSERT(mRenderer != nullptr);
+}
+
+Framebuffer11::~Framebuffer11() {}
+
+angle::Result Framebuffer11::markAttachmentsDirty(const gl::Context *context) const
+{
+ const auto &colorAttachments = mState.getColorAttachments();
+ for (size_t drawBuffer : mState.getEnabledDrawBuffers())
+ {
+ const gl::FramebufferAttachment &colorAttachment = colorAttachments[drawBuffer];
+ ASSERT(colorAttachment.isAttached());
+ ANGLE_TRY(MarkAttachmentsDirty(context, &colorAttachment));
+ }
+
+ const gl::FramebufferAttachment *dsAttachment = mState.getDepthOrStencilAttachment();
+ if (dsAttachment)
+ {
+ ANGLE_TRY(MarkAttachmentsDirty(context, dsAttachment));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer11::clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams)
+{
+ Clear11 *clearer = mRenderer->getClearer();
+
+ const gl::FramebufferAttachment *colorAttachment = mState.getFirstColorAttachment();
+ if (clearParams.scissorEnabled == true && colorAttachment != nullptr &&
+ UsePresentPathFast(mRenderer, colorAttachment))
+ {
+ // If the current framebuffer is using the default colorbuffer, and present path fast is
+ // active, and the scissor rect is enabled, then we should invert the scissor rect
+ // vertically
+ ClearParameters presentPathFastClearParams = clearParams;
+ gl::Extents framebufferSize = colorAttachment->getSize();
+ presentPathFastClearParams.scissor.y = framebufferSize.height -
+ presentPathFastClearParams.scissor.y -
+ presentPathFastClearParams.scissor.height;
+ ANGLE_TRY(clearer->clearFramebuffer(context, presentPathFastClearParams, mState));
+ }
+ else
+ {
+ ANGLE_TRY(clearer->clearFramebuffer(context, clearParams, mState));
+ }
+
+ ANGLE_TRY(markAttachmentsDirty(context));
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer11::invalidate(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments)
+{
+ return invalidateBase(context, count, attachments, false);
+}
+
+angle::Result Framebuffer11::discard(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments)
+{
+ return invalidateBase(context, count, attachments, true);
+}
+
+angle::Result Framebuffer11::invalidateBase(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ bool useEXTBehavior) const
+{
+ ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
+
+ if (!deviceContext1)
+ {
+ // DiscardView() is only supported on ID3D11DeviceContext1
+ return angle::Result::Continue;
+ }
+
+ bool foundDepth = false;
+ bool foundStencil = false;
+
+ for (size_t i = 0; i < count; ++i)
+ {
+ switch (attachments[i])
+ {
+ // Handle depth and stencil attachments. Defer discarding until later.
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ foundDepth = true;
+ foundStencil = true;
+ break;
+ case GL_DEPTH_EXT:
+ case GL_DEPTH_ATTACHMENT:
+ foundDepth = true;
+ break;
+ case GL_STENCIL_EXT:
+ case GL_STENCIL_ATTACHMENT:
+ foundStencil = true;
+ break;
+ default:
+ {
+ // Handle color attachments
+ ASSERT((attachments[i] >= GL_COLOR_ATTACHMENT0 &&
+ attachments[i] <= GL_COLOR_ATTACHMENT15) ||
+ (attachments[i] == GL_COLOR));
+
+ size_t colorIndex =
+ (attachments[i] == GL_COLOR ? 0u : (attachments[i] - GL_COLOR_ATTACHMENT0));
+ const gl::FramebufferAttachment *colorAttachment =
+ mState.getColorAttachment(colorIndex);
+ if (colorAttachment)
+ {
+ ANGLE_TRY(invalidateAttachment(context, colorAttachment));
+ }
+ break;
+ }
+ }
+ }
+
+ bool discardDepth = false;
+ bool discardStencil = false;
+
+ // The D3D11 renderer uses the same view for depth and stencil buffers, so we must be careful.
+ if (useEXTBehavior)
+ {
+ // In the extension, if the app discards only one of the depth and stencil attachments, but
+ // those are backed by the same packed_depth_stencil buffer, then both images become
+ // undefined.
+ discardDepth = foundDepth;
+
+ // Don't bother discarding the stencil buffer if the depth buffer will already do it
+ discardStencil = foundStencil && (!discardDepth || mState.getDepthAttachment() == nullptr);
+ }
+ else
+ {
+ // In ES 3.0.4, if a specified attachment has base internal format DEPTH_STENCIL but the
+ // attachments list does not include DEPTH_STENCIL_ATTACHMENT or both DEPTH_ATTACHMENT and
+ // STENCIL_ATTACHMENT, then only the specified portion of every pixel in the subregion of
+ // pixels of the DEPTH_STENCIL buffer may be invalidated, and the other portion must be
+ // preserved.
+ discardDepth = (foundDepth && foundStencil) ||
+ (foundDepth && (mState.getStencilAttachment() == nullptr));
+ discardStencil = (foundStencil && (mState.getDepthAttachment() == nullptr));
+ }
+
+ if (discardDepth && mState.getDepthAttachment())
+ {
+ ANGLE_TRY(invalidateAttachment(context, mState.getDepthAttachment()));
+ }
+
+ if (discardStencil && mState.getStencilAttachment())
+ {
+ ANGLE_TRY(invalidateAttachment(context, mState.getStencilAttachment()));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer11::invalidateSub(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ const gl::Rectangle &area)
+{
+ // A no-op implementation conforms to the spec, so don't call UNIMPLEMENTED()
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer11::invalidateAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment *attachment) const
+{
+ ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
+ ASSERT(deviceContext1);
+ ASSERT(attachment && attachment->isAttached());
+
+ RenderTarget11 *renderTarget = nullptr;
+ ANGLE_TRY(attachment->getRenderTarget(context, &renderTarget));
+ const auto &rtv = renderTarget->getRenderTargetView();
+
+ if (rtv.valid())
+ {
+ deviceContext1->DiscardView(rtv.get());
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer11::readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels)
+{
+ const gl::FramebufferAttachment *readAttachment = mState.getReadAttachment();
+ ASSERT(readAttachment);
+
+ gl::Buffer *packBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelPack);
+ if (packBuffer != nullptr)
+ {
+ Buffer11 *packBufferStorage = GetImplAs<Buffer11>(packBuffer);
+ const angle::Format &angleFormat = GetFormatFromFormatType(format, type);
+ PackPixelsParams packParams(area, angleFormat, static_cast<GLuint>(outputPitch),
+ pack.reverseRowOrder, packBuffer,
+ reinterpret_cast<ptrdiff_t>(pixels));
+
+ return packBufferStorage->packPixels(context, *readAttachment, packParams);
+ }
+
+ return mRenderer->readFromAttachment(context, *readAttachment, area, format, type,
+ static_cast<GLuint>(outputPitch), pack, pixels);
+}
+
+angle::Result Framebuffer11::blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer)
+{
+ if (blitRenderTarget)
+ {
+ const gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getReadColorAttachment();
+ ASSERT(readBuffer);
+
+ RenderTargetD3D *readRenderTarget = nullptr;
+ ANGLE_TRY(readBuffer->getRenderTarget(context, &readRenderTarget));
+ ASSERT(readRenderTarget);
+
+ const auto &colorAttachments = mState.getColorAttachments();
+ const auto &drawBufferStates = mState.getDrawBufferStates();
+
+ for (size_t colorAttachment = 0; colorAttachment < colorAttachments.size();
+ colorAttachment++)
+ {
+ const gl::FramebufferAttachment &drawBuffer = colorAttachments[colorAttachment];
+
+ if (drawBuffer.isAttached() && drawBufferStates[colorAttachment] != GL_NONE)
+ {
+ RenderTargetD3D *drawRenderTarget = nullptr;
+ ANGLE_TRY(drawBuffer.getRenderTarget(context, &drawRenderTarget));
+ ASSERT(drawRenderTarget);
+
+ const bool invertColorSource = UsePresentPathFast(mRenderer, readBuffer);
+ gl::Rectangle actualSourceArea = sourceArea;
+ if (invertColorSource)
+ {
+ RenderTarget11 *readRenderTarget11 = GetAs<RenderTarget11>(readRenderTarget);
+ actualSourceArea.y = readRenderTarget11->getHeight() - sourceArea.y;
+ actualSourceArea.height = -sourceArea.height;
+ }
+
+ const bool invertColorDest = UsePresentPathFast(mRenderer, &drawBuffer);
+ gl::Rectangle actualDestArea = destArea;
+ if (invertColorDest)
+ {
+ RenderTarget11 *drawRenderTarget11 = GetAs<RenderTarget11>(drawRenderTarget);
+ actualDestArea.y = drawRenderTarget11->getHeight() - destArea.y;
+ actualDestArea.height = -destArea.height;
+ }
+
+ ANGLE_TRY(mRenderer->blitRenderbufferRect(
+ context, actualSourceArea, actualDestArea, readRenderTarget, drawRenderTarget,
+ filter, scissor, blitRenderTarget, false, false));
+ }
+ }
+ }
+
+ if (blitDepth || blitStencil)
+ {
+ const gl::FramebufferAttachment *readBuffer =
+ sourceFramebuffer->getDepthOrStencilAttachment();
+ ASSERT(readBuffer);
+ RenderTargetD3D *readRenderTarget = nullptr;
+ ANGLE_TRY(readBuffer->getRenderTarget(context, &readRenderTarget));
+ ASSERT(readRenderTarget);
+
+ const bool invertSource = UsePresentPathFast(mRenderer, readBuffer);
+ gl::Rectangle actualSourceArea = sourceArea;
+ if (invertSource)
+ {
+ RenderTarget11 *readRenderTarget11 = GetAs<RenderTarget11>(readRenderTarget);
+ actualSourceArea.y = readRenderTarget11->getHeight() - sourceArea.y;
+ actualSourceArea.height = -sourceArea.height;
+ }
+
+ const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
+ ASSERT(drawBuffer);
+ RenderTargetD3D *drawRenderTarget = nullptr;
+ ANGLE_TRY(drawBuffer->getRenderTarget(context, &drawRenderTarget));
+ ASSERT(drawRenderTarget);
+
+ bool invertDest = UsePresentPathFast(mRenderer, drawBuffer);
+ gl::Rectangle actualDestArea = destArea;
+ if (invertDest)
+ {
+ RenderTarget11 *drawRenderTarget11 = GetAs<RenderTarget11>(drawRenderTarget);
+ actualDestArea.y = drawRenderTarget11->getHeight() - destArea.y;
+ actualDestArea.height = -destArea.height;
+ }
+
+ ANGLE_TRY(mRenderer->blitRenderbufferRect(context, actualSourceArea, actualDestArea,
+ readRenderTarget, drawRenderTarget, filter,
+ scissor, false, blitDepth, blitStencil));
+ }
+
+ ANGLE_TRY(markAttachmentsDirty(context));
+ return angle::Result::Continue;
+}
+
+GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
+{
+ RenderTarget11 *renderTarget11 = GetAs<RenderTarget11>(renderTarget);
+ return renderTarget11->getFormatSet().format().fboImplementationInternalFormat;
+}
+
+angle::Result Framebuffer11::syncState(const gl::Context *context,
+ const gl::Framebuffer::DirtyBits &dirtyBits)
+{
+ ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits));
+ ANGLE_TRY(FramebufferD3D::syncState(context, dirtyBits));
+
+ // Call this last to allow the state manager to take advantage of the cached render targets.
+ mRenderer->getStateManager()->invalidateRenderTarget();
+
+ // Call this to syncViewport for framebuffer default parameters.
+ if (mState.getDefaultWidth() != 0 || mState.getDefaultHeight() != 0)
+ {
+ mRenderer->getStateManager()->invalidateViewport(context);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer11::getSamplePosition(const gl::Context *context,
+ size_t index,
+ GLfloat *xy) const
+{
+ const gl::FramebufferAttachment *attachment = mState.getFirstNonNullAttachment();
+ ASSERT(attachment);
+ GLsizei sampleCount = attachment->getSamples();
+
+ d3d11_gl::GetSamplePosition(sampleCount, index, xy);
+ return angle::Result::Continue;
+}
+
+RenderTarget11 *Framebuffer11::getFirstRenderTarget() const
+{
+ for (auto *renderTarget : mRenderTargetCache.getColors())
+ {
+ if (renderTarget)
+ {
+ return renderTarget;
+ }
+ }
+
+ return mRenderTargetCache.getDepthStencil();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
new file mode 100644
index 0000000000..8516d7dcf2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
@@ -0,0 +1,96 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer11.h: Defines the Framebuffer11 class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
+
+#include "libANGLE/Observer.h"
+#include "libANGLE/renderer/RenderTargetCache.h"
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+class Renderer11;
+
+class Framebuffer11 : public FramebufferD3D
+{
+ public:
+ Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer);
+ ~Framebuffer11() override;
+
+ angle::Result discard(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments) override;
+ angle::Result invalidate(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments) override;
+ angle::Result invalidateSub(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ const gl::Rectangle &area) override;
+
+ // Invalidate the cached swizzles of all bound texture attachments.
+ angle::Result markAttachmentsDirty(const gl::Context *context) const;
+
+ angle::Result syncState(const gl::Context *context,
+ const gl::Framebuffer::DirtyBits &dirtyBits) override;
+
+ const gl::AttachmentArray<RenderTarget11 *> &getCachedColorRenderTargets() const
+ {
+ return mRenderTargetCache.getColors();
+ }
+ const RenderTarget11 *getCachedDepthStencilRenderTarget() const
+ {
+ return mRenderTargetCache.getDepthStencil();
+ }
+
+ RenderTarget11 *getFirstRenderTarget() const;
+
+ angle::Result getSamplePosition(const gl::Context *context,
+ size_t index,
+ GLfloat *xy) const override;
+
+ private:
+ angle::Result clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams) override;
+
+ angle::Result readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels) override;
+
+ angle::Result blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer) override;
+
+ angle::Result invalidateBase(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ bool useEXTBehavior) const;
+ angle::Result invalidateAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment *attachment) const;
+
+ GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
+
+ Renderer11 *const mRenderer;
+ RenderTargetCache<RenderTarget11> mRenderTargetCache;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
new file mode 100644
index 0000000000..7595c55048
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
@@ -0,0 +1,674 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image11.h: Implements the rx::Image11 class, which acts as the interface to
+// the actual underlying resources of a Texture
+
+#include "libANGLE/renderer/d3d/d3d11/Image11.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+namespace rx
+{
+
+Image11::Image11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mDXGIFormat(DXGI_FORMAT_UNKNOWN),
+ mStagingTexture(),
+ mStagingSubresource(0),
+ mRecoverFromStorage(false),
+ mAssociatedStorage(nullptr),
+ mAssociatedImageIndex(),
+ mRecoveredFromStorageCount(0)
+{}
+
+Image11::~Image11()
+{
+ disassociateStorage();
+ releaseStagingTexture();
+}
+
+// static
+angle::Result Image11::GenerateMipmap(const gl::Context *context,
+ Image11 *dest,
+ Image11 *src,
+ const Renderer11DeviceCaps &rendererCaps)
+{
+ ASSERT(src->getDXGIFormat() == dest->getDXGIFormat());
+ ASSERT(src->getWidth() == 1 || src->getWidth() / 2 == dest->getWidth());
+ ASSERT(src->getHeight() == 1 || src->getHeight() / 2 == dest->getHeight());
+
+ D3D11_MAPPED_SUBRESOURCE destMapped;
+ ANGLE_TRY(dest->map(context, D3D11_MAP_WRITE, &destMapped));
+ d3d11::ScopedUnmapper<Image11> destRAII(dest);
+
+ D3D11_MAPPED_SUBRESOURCE srcMapped;
+ ANGLE_TRY(src->map(context, D3D11_MAP_READ, &srcMapped));
+ d3d11::ScopedUnmapper<Image11> srcRAII(src);
+
+ const uint8_t *sourceData = static_cast<const uint8_t *>(srcMapped.pData);
+ uint8_t *destData = static_cast<uint8_t *>(destMapped.pData);
+
+ auto mipGenerationFunction =
+ d3d11::Format::Get(src->getInternalFormat(), rendererCaps).format().mipGenerationFunction;
+ mipGenerationFunction(src->getWidth(), src->getHeight(), src->getDepth(), sourceData,
+ srcMapped.RowPitch, srcMapped.DepthPitch, destData, destMapped.RowPitch,
+ destMapped.DepthPitch);
+
+ dest->markDirty();
+
+ return angle::Result::Continue;
+}
+
+// static
+angle::Result Image11::CopyImage(const gl::Context *context,
+ Image11 *dest,
+ Image11 *source,
+ const gl::Box &sourceBox,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const Renderer11DeviceCaps &rendererCaps)
+{
+ D3D11_MAPPED_SUBRESOURCE destMapped;
+ ANGLE_TRY(dest->map(context, D3D11_MAP_WRITE, &destMapped));
+ d3d11::ScopedUnmapper<Image11> destRAII(dest);
+
+ D3D11_MAPPED_SUBRESOURCE srcMapped;
+ ANGLE_TRY(source->map(context, D3D11_MAP_READ, &srcMapped));
+ d3d11::ScopedUnmapper<Image11> sourceRAII(source);
+
+ const auto &sourceFormat =
+ d3d11::Format::Get(source->getInternalFormat(), rendererCaps).format();
+ GLuint sourcePixelBytes =
+ gl::GetSizedInternalFormatInfo(sourceFormat.fboImplementationInternalFormat).pixelBytes;
+
+ GLenum destUnsizedFormat = gl::GetUnsizedFormat(dest->getInternalFormat());
+ const auto &destFormat = d3d11::Format::Get(dest->getInternalFormat(), rendererCaps).format();
+ const auto &destFormatInfo =
+ gl::GetSizedInternalFormatInfo(destFormat.fboImplementationInternalFormat);
+ GLuint destPixelBytes = destFormatInfo.pixelBytes;
+
+ const uint8_t *sourceData = static_cast<const uint8_t *>(srcMapped.pData) +
+ sourceBox.x * sourcePixelBytes + sourceBox.y * srcMapped.RowPitch +
+ sourceBox.z * srcMapped.DepthPitch;
+ uint8_t *destData = static_cast<uint8_t *>(destMapped.pData) + destOffset.x * destPixelBytes +
+ destOffset.y * destMapped.RowPitch + destOffset.z * destMapped.DepthPitch;
+
+ CopyImageCHROMIUM(sourceData, srcMapped.RowPitch, sourcePixelBytes, srcMapped.DepthPitch,
+ sourceFormat.pixelReadFunction, destData, destMapped.RowPitch, destPixelBytes,
+ destMapped.DepthPitch, destFormat.pixelWriteFunction, destUnsizedFormat,
+ destFormatInfo.componentType, sourceBox.width, sourceBox.height,
+ sourceBox.depth, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ dest->markDirty();
+
+ return angle::Result::Continue;
+}
+
+bool Image11::isDirty() const
+{
+ // If mDirty is true AND mStagingTexture doesn't exist AND mStagingTexture doesn't need to be
+ // recovered from TextureStorage AND the texture doesn't require init data (i.e. a blank new
+ // texture will suffice) AND robust resource initialization is not enabled then isDirty should
+ // still return false.
+ if (mDirty && !mStagingTexture.valid() && !mRecoverFromStorage)
+ {
+ const Renderer11DeviceCaps &deviceCaps = mRenderer->getRenderer11DeviceCaps();
+ const auto &formatInfo = d3d11::Format::Get(mInternalFormat, deviceCaps);
+ if (formatInfo.dataInitializerFunction == nullptr)
+ {
+ return false;
+ }
+ }
+
+ return mDirty;
+}
+
+angle::Result Image11::copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box &region)
+{
+ TextureStorage11 *storage11 = GetAs<TextureStorage11>(storage);
+
+ // If an app's behavior results in an Image11 copying its data to/from to a TextureStorage
+ // multiple times, then we should just keep the staging texture around to prevent the copying
+ // from impacting perf. We allow the Image11 to copy its data to/from TextureStorage once. This
+ // accounts for an app making a late call to glGenerateMipmap.
+ bool attemptToReleaseStagingTexture = (mRecoveredFromStorageCount < 2);
+
+ if (attemptToReleaseStagingTexture)
+ {
+ // If another image is relying on this Storage for its data, then we must let it recover its
+ // data before we overwrite it.
+ ANGLE_TRY(storage11->releaseAssociatedImage(context, index, this));
+ }
+
+ const TextureHelper11 *stagingTexture = nullptr;
+ unsigned int stagingSubresourceIndex = 0;
+ ANGLE_TRY(getStagingTexture(context, &stagingTexture, &stagingSubresourceIndex));
+ ANGLE_TRY(storage11->updateSubresourceLevel(context, *stagingTexture, stagingSubresourceIndex,
+ index, region));
+
+ // Once the image data has been copied into the Storage, we can release it locally.
+ if (attemptToReleaseStagingTexture)
+ {
+ storage11->associateImage(this, index);
+ releaseStagingTexture();
+ mRecoverFromStorage = true;
+ mAssociatedStorage = storage11;
+ mAssociatedImageIndex = index;
+ }
+
+ return angle::Result::Continue;
+}
+
+void Image11::verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const
+{
+ ASSERT(mAssociatedStorage == textureStorage);
+}
+
+angle::Result Image11::recoverFromAssociatedStorage(const gl::Context *context)
+{
+ if (mRecoverFromStorage)
+ {
+ ANGLE_TRY(createStagingTexture(context));
+
+ mAssociatedStorage->verifyAssociatedImageValid(mAssociatedImageIndex, this);
+
+ // CopySubResource from the Storage to the Staging texture
+ gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
+ ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(
+ context, mStagingTexture, mStagingSubresource, mAssociatedImageIndex, region));
+ mRecoveredFromStorageCount += 1;
+
+ // Reset all the recovery parameters, even if the texture storage association is broken.
+ disassociateStorage();
+ }
+
+ return angle::Result::Continue;
+}
+
+void Image11::disassociateStorage()
+{
+ if (mRecoverFromStorage)
+ {
+ // Make the texturestorage release the Image11 too
+ mAssociatedStorage->disassociateImage(mAssociatedImageIndex, this);
+
+ mRecoverFromStorage = false;
+ mAssociatedStorage = nullptr;
+ mAssociatedImageIndex = gl::ImageIndex();
+ }
+}
+
+bool Image11::redefine(gl::TextureType type,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
+{
+ if (mWidth != size.width || mHeight != size.height || mInternalFormat != internalformat ||
+ forceRelease)
+ {
+ // End the association with the TextureStorage, since that data will be out of date.
+ // Also reset mRecoveredFromStorageCount since this Image is getting completely redefined.
+ disassociateStorage();
+ mRecoveredFromStorageCount = 0;
+
+ mWidth = size.width;
+ mHeight = size.height;
+ mDepth = size.depth;
+ mInternalFormat = internalformat;
+ mType = type;
+
+ // compute the d3d format that will be used
+ const d3d11::Format &formatInfo =
+ d3d11::Format::Get(internalformat, mRenderer->getRenderer11DeviceCaps());
+ mDXGIFormat = formatInfo.texFormat;
+ mRenderable = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
+
+ releaseStagingTexture();
+ mDirty = (formatInfo.dataInitializerFunction != nullptr);
+
+ return true;
+ }
+
+ return false;
+}
+
+DXGI_FORMAT Image11::getDXGIFormat() const
+{
+ // this should only happen if the image hasn't been redefined first
+ // which would be a bug by the caller
+ ASSERT(mDXGIFormat != DXGI_FORMAT_UNKNOWN);
+
+ return mDXGIFormat;
+}
+
+// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as
+// format/type at input
+// into the target pixel rectangle.
+angle::Result Image11::loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
+ GLuint inputRowPitch = 0;
+ ANGLE_CHECK_GL_MATH(context11, formatInfo.computeRowPitch(type, area.width, unpack.alignment,
+ unpack.rowLength, &inputRowPitch));
+ GLuint inputDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(context11, formatInfo.computeDepthPitch(area.height, unpack.imageHeight,
+ inputRowPitch, &inputDepthPitch));
+ GLuint inputSkipBytes = 0;
+ ANGLE_CHECK_GL_MATH(context11,
+ formatInfo.computeSkipBytes(type, inputRowPitch, inputDepthPitch, unpack,
+ applySkipImages, &inputSkipBytes));
+
+ const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
+ GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
+
+ const d3d11::Format &d3dFormatInfo =
+ d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
+ LoadImageFunction loadFunction = d3dFormatInfo.getLoadFunctions()(type).loadFunction;
+
+ D3D11_MAPPED_SUBRESOURCE mappedImage;
+ ANGLE_TRY(map(context, D3D11_MAP_WRITE, &mappedImage));
+
+ uint8_t *offsetMappedData = (static_cast<uint8_t *>(mappedImage.pData) +
+ (area.y * mappedImage.RowPitch + area.x * outputPixelSize +
+ area.z * mappedImage.DepthPitch));
+ loadFunction(area.width, area.height, area.depth,
+ static_cast<const uint8_t *>(input) + inputSkipBytes, inputRowPitch,
+ inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
+
+ unmap();
+
+ return angle::Result::Continue;
+}
+
+angle::Result Image11::loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
+ GLuint inputRowPitch = 0;
+ ANGLE_CHECK_GL_MATH(
+ context11, formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0, &inputRowPitch));
+ GLuint inputDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(
+ context11, formatInfo.computeDepthPitch(area.height, 0, inputRowPitch, &inputDepthPitch));
+
+ const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
+ GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
+ GLuint outputBlockWidth = dxgiFormatInfo.blockWidth;
+ GLuint outputBlockHeight = dxgiFormatInfo.blockHeight;
+
+ ASSERT(area.x % outputBlockWidth == 0);
+ ASSERT(area.y % outputBlockHeight == 0);
+
+ const d3d11::Format &d3dFormatInfo =
+ d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
+ LoadImageFunction loadFunction =
+ d3dFormatInfo.getLoadFunctions()(GL_UNSIGNED_BYTE).loadFunction;
+
+ D3D11_MAPPED_SUBRESOURCE mappedImage;
+ ANGLE_TRY(map(context, D3D11_MAP_WRITE, &mappedImage));
+
+ uint8_t *offsetMappedData =
+ static_cast<uint8_t *>(mappedImage.pData) +
+ ((area.y / outputBlockHeight) * mappedImage.RowPitch +
+ (area.x / outputBlockWidth) * outputPixelSize + area.z * mappedImage.DepthPitch);
+
+ loadFunction(area.width, area.height, area.depth, static_cast<const uint8_t *>(input),
+ inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch,
+ mappedImage.DepthPitch);
+
+ unmap();
+
+ return angle::Result::Continue;
+}
+
+angle::Result Image11::copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source)
+{
+ TextureStorage11 *storage11 = GetAs<TextureStorage11>(source);
+
+ const TextureHelper11 *textureHelper = nullptr;
+ ANGLE_TRY(storage11->getResource(context, &textureHelper));
+
+ UINT subresourceIndex = 0;
+ ANGLE_TRY(storage11->getSubresourceIndex(context, imageIndex, &subresourceIndex));
+
+ gl::Box sourceBox(0, 0, 0, mWidth, mHeight, mDepth);
+ return copyWithoutConversion(context, gl::Offset(), sourceBox, *textureHelper,
+ subresourceIndex);
+}
+
+angle::Result Image11::copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *sourceFBO)
+{
+ const gl::FramebufferAttachment *srcAttachment = sourceFBO->getReadColorAttachment();
+ ASSERT(srcAttachment);
+
+ GLenum sourceInternalFormat = srcAttachment->getFormat().info->sizedInternalFormat;
+ const auto &d3d11Format =
+ d3d11::Format::Get(sourceInternalFormat, mRenderer->getRenderer11DeviceCaps());
+
+ if (d3d11Format.texFormat == mDXGIFormat && sourceInternalFormat == mInternalFormat)
+ {
+ RenderTarget11 *rt11 = nullptr;
+ ANGLE_TRY(srcAttachment->getRenderTarget(context, &rt11));
+ ASSERT(rt11->getTexture().get());
+
+ TextureHelper11 textureHelper = rt11->getTexture();
+ unsigned int sourceSubResource = rt11->getSubresourceIndex();
+
+ gl::Box sourceBox(sourceArea.x, sourceArea.y, 0, sourceArea.width, sourceArea.height, 1);
+ return copyWithoutConversion(context, destOffset, sourceBox, textureHelper,
+ sourceSubResource);
+ }
+
+ // This format requires conversion, so we must copy the texture to staging and manually convert
+ // via readPixels
+ D3D11_MAPPED_SUBRESOURCE mappedImage;
+ ANGLE_TRY(map(context, D3D11_MAP_WRITE, &mappedImage));
+
+ // determine the offset coordinate into the destination buffer
+ const auto &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
+ GLsizei rowOffset = dxgiFormatInfo.pixelBytes * destOffset.x;
+
+ uint8_t *dataOffset = static_cast<uint8_t *>(mappedImage.pData) +
+ mappedImage.RowPitch * destOffset.y + rowOffset +
+ destOffset.z * mappedImage.DepthPitch;
+
+ const gl::InternalFormat &destFormatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
+ const auto &destD3D11Format =
+ d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
+
+ auto loadFunction = destD3D11Format.getLoadFunctions()(destFormatInfo.type);
+ angle::Result result = angle::Result::Continue;
+ if (loadFunction.requiresConversion)
+ {
+ size_t bufferSize = destFormatInfo.pixelBytes * sourceArea.width * sourceArea.height;
+ angle::MemoryBuffer *memoryBuffer = nullptr;
+ result = mRenderer->getScratchMemoryBuffer(GetImplAs<Context11>(context), bufferSize,
+ &memoryBuffer);
+
+ if (result == angle::Result::Continue)
+ {
+ GLuint memoryBufferRowPitch = destFormatInfo.pixelBytes * sourceArea.width;
+
+ result = mRenderer->readFromAttachment(
+ context, *srcAttachment, sourceArea, destFormatInfo.format, destFormatInfo.type,
+ memoryBufferRowPitch, gl::PixelPackState(), memoryBuffer->data());
+
+ loadFunction.loadFunction(sourceArea.width, sourceArea.height, 1, memoryBuffer->data(),
+ memoryBufferRowPitch, 0, dataOffset, mappedImage.RowPitch,
+ mappedImage.DepthPitch);
+ }
+ }
+ else
+ {
+ result = mRenderer->readFromAttachment(
+ context, *srcAttachment, sourceArea, destFormatInfo.format, destFormatInfo.type,
+ mappedImage.RowPitch, gl::PixelPackState(), dataOffset);
+ }
+
+ unmap();
+ mDirty = true;
+
+ return result;
+}
+
+angle::Result Image11::copyWithoutConversion(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Box &sourceArea,
+ const TextureHelper11 &textureHelper,
+ UINT sourceSubResource)
+{
+ // No conversion needed-- use copyback fastpath
+ const TextureHelper11 *stagingTexture = nullptr;
+ unsigned int stagingSubresourceIndex = 0;
+ ANGLE_TRY(getStagingTexture(context, &stagingTexture, &stagingSubresourceIndex));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ const gl::Extents &extents = textureHelper.getExtents();
+
+ D3D11_BOX srcBox;
+ srcBox.left = sourceArea.x;
+ srcBox.right = sourceArea.x + sourceArea.width;
+ srcBox.top = sourceArea.y;
+ srcBox.bottom = sourceArea.y + sourceArea.height;
+ srcBox.front = sourceArea.z;
+ srcBox.back = sourceArea.z + sourceArea.depth;
+
+ if (textureHelper.is2D() && textureHelper.getSampleCount() > 1)
+ {
+ D3D11_TEXTURE2D_DESC resolveDesc;
+ resolveDesc.Width = extents.width;
+ resolveDesc.Height = extents.height;
+ resolveDesc.MipLevels = 1;
+ resolveDesc.ArraySize = 1;
+ resolveDesc.Format = textureHelper.getFormat();
+ resolveDesc.SampleDesc.Count = 1;
+ resolveDesc.SampleDesc.Quality = 0;
+ resolveDesc.Usage = D3D11_USAGE_DEFAULT;
+ resolveDesc.BindFlags = 0;
+ resolveDesc.CPUAccessFlags = 0;
+ resolveDesc.MiscFlags = 0;
+
+ d3d11::Texture2D resolveTex;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), resolveDesc, &resolveTex));
+
+ deviceContext->ResolveSubresource(resolveTex.get(), 0, textureHelper.get(),
+ sourceSubResource, textureHelper.getFormat());
+
+ deviceContext->CopySubresourceRegion(stagingTexture->get(), stagingSubresourceIndex,
+ destOffset.x, destOffset.y, destOffset.z,
+ resolveTex.get(), 0, &srcBox);
+ }
+ else
+ {
+ deviceContext->CopySubresourceRegion(stagingTexture->get(), stagingSubresourceIndex,
+ destOffset.x, destOffset.y, destOffset.z,
+ textureHelper.get(), sourceSubResource, &srcBox);
+ }
+
+ mDirty = true;
+ return angle::Result::Continue;
+}
+
+angle::Result Image11::getStagingTexture(const gl::Context *context,
+ const TextureHelper11 **outStagingTexture,
+ unsigned int *outSubresourceIndex)
+{
+ ANGLE_TRY(createStagingTexture(context));
+
+ *outStagingTexture = &mStagingTexture;
+ *outSubresourceIndex = mStagingSubresource;
+ return angle::Result::Continue;
+}
+
+void Image11::releaseStagingTexture()
+{
+ mStagingTexture.reset();
+ mStagingTextureSubresourceVerifier.reset();
+}
+
+angle::Result Image11::createStagingTexture(const gl::Context *context)
+{
+ if (mStagingTexture.valid())
+ {
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mWidth > 0 && mHeight > 0 && mDepth > 0);
+
+ const DXGI_FORMAT dxgiFormat = getDXGIFormat();
+ const auto &formatInfo =
+ d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
+
+ int lodOffset = 1;
+ GLsizei width = mWidth;
+ GLsizei height = mHeight;
+
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, dxgiFormat, &width, &height, &lodOffset);
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ switch (mType)
+ {
+ case gl::TextureType::_3D:
+ {
+ D3D11_TEXTURE3D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.Depth = mDepth;
+ desc.MipLevels = lodOffset + 1;
+ desc.Format = dxgiFormat;
+ desc.Usage = D3D11_USAGE_STAGING;
+ desc.BindFlags = 0;
+ desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ desc.MiscFlags = 0;
+
+ if (formatInfo.dataInitializerFunction != nullptr)
+ {
+ gl::TexLevelArray<D3D11_SUBRESOURCE_DATA> initialData;
+ ANGLE_TRY(d3d11::GenerateInitialTextureData(
+ context, mInternalFormat, mRenderer->getRenderer11DeviceCaps(), width, height,
+ mDepth, lodOffset + 1, &initialData));
+
+ ANGLE_TRY(mRenderer->allocateTexture(context11, desc, formatInfo,
+ initialData.data(), &mStagingTexture));
+ }
+ else
+ {
+ ANGLE_TRY(
+ mRenderer->allocateTexture(context11, desc, formatInfo, &mStagingTexture));
+ }
+
+ mStagingTexture.setDebugName("Image11::StagingTexture3D");
+ mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
+ mStagingTextureSubresourceVerifier.setDesc(desc);
+ }
+ break;
+
+ case gl::TextureType::_2D:
+ case gl::TextureType::_2DArray:
+ case gl::TextureType::CubeMap:
+ {
+ 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 (formatInfo.dataInitializerFunction != nullptr)
+ {
+ gl::TexLevelArray<D3D11_SUBRESOURCE_DATA> initialData;
+ ANGLE_TRY(d3d11::GenerateInitialTextureData(
+ context, mInternalFormat, mRenderer->getRenderer11DeviceCaps(), width, height,
+ 1, lodOffset + 1, &initialData));
+
+ ANGLE_TRY(mRenderer->allocateTexture(context11, desc, formatInfo,
+ initialData.data(), &mStagingTexture));
+ }
+ else
+ {
+ ANGLE_TRY(
+ mRenderer->allocateTexture(context11, desc, formatInfo, &mStagingTexture));
+ }
+
+ mStagingTexture.setDebugName("Image11::StagingTexture2D");
+ mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
+ mStagingTextureSubresourceVerifier.setDesc(desc);
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ mDirty = false;
+ return angle::Result::Continue;
+}
+
+angle::Result Image11::map(const gl::Context *context,
+ D3D11_MAP mapType,
+ D3D11_MAPPED_SUBRESOURCE *map)
+{
+ // We must recover from the TextureStorage if necessary, even for D3D11_MAP_WRITE.
+ ANGLE_TRY(recoverFromAssociatedStorage(context));
+
+ const TextureHelper11 *stagingTexture = nullptr;
+ unsigned int subresourceIndex = 0;
+ ANGLE_TRY(getStagingTexture(context, &stagingTexture, &subresourceIndex));
+
+ ASSERT(stagingTexture && stagingTexture->valid());
+
+ ANGLE_TRY(
+ mRenderer->mapResource(context, stagingTexture->get(), subresourceIndex, mapType, 0, map));
+
+ if (!mStagingTextureSubresourceVerifier.wrap(mapType, map))
+ {
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->Unmap(mStagingTexture.get(), mStagingSubresource);
+ Context11 *context11 = GetImplAs<Context11>(context);
+ context11->handleError(GL_OUT_OF_MEMORY,
+ "Failed to allocate staging texture mapping verifier buffer.",
+ __FILE__, ANGLE_FUNCTION, __LINE__);
+ return angle::Result::Stop;
+ }
+
+ mDirty = true;
+
+ return angle::Result::Continue;
+}
+
+void Image11::unmap()
+{
+ if (mStagingTexture.valid())
+ {
+ mStagingTextureSubresourceVerifier.unwrap();
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->Unmap(mStagingTexture.get(), mStagingSubresource);
+ }
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h
new file mode 100644
index 0000000000..784de16401
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h
@@ -0,0 +1,127 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image11.h: Defines the rx::Image11 class, which acts as the interface to
+// the actual underlying resources of a Texture
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
+
+#include "common/debug.h"
+#include "libANGLE/ImageIndex.h"
+#include "libANGLE/renderer/d3d/ImageD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace d3d11
+{
+template <typename T>
+class ScopedUnmapper;
+} // namespace d3d11
+
+namespace rx
+{
+class Renderer11;
+class TextureHelper11;
+class TextureStorage11;
+struct Renderer11DeviceCaps;
+
+class Image11 : public ImageD3D
+{
+ public:
+ Image11(Renderer11 *renderer);
+ ~Image11() override;
+
+ static angle::Result GenerateMipmap(const gl::Context *context,
+ Image11 *dest,
+ Image11 *src,
+ const Renderer11DeviceCaps &rendererCaps);
+ static angle::Result CopyImage(const gl::Context *context,
+ Image11 *dest,
+ Image11 *source,
+ const gl::Box &sourceBox,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha,
+ const Renderer11DeviceCaps &rendererCaps);
+
+ bool isDirty() const override;
+
+ angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box &region) override;
+
+ bool redefine(gl::TextureType type,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease) override;
+
+ DXGI_FORMAT getDXGIFormat() const;
+
+ angle::Result loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages) override;
+ angle::Result loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input) override;
+
+ angle::Result copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source) override;
+ angle::Result copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source) override;
+
+ angle::Result recoverFromAssociatedStorage(const gl::Context *context);
+ void verifyAssociatedStorageValid(TextureStorage11 *textureStorage) const;
+ void disassociateStorage();
+
+ protected:
+ template <typename T>
+ friend class d3d11::ScopedUnmapper;
+ angle::Result map(const gl::Context *context, D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
+ void unmap();
+
+ private:
+ angle::Result copyWithoutConversion(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Box &sourceArea,
+ const TextureHelper11 &textureHelper,
+ UINT sourceSubResource);
+
+ angle::Result getStagingTexture(const gl::Context *context,
+ const TextureHelper11 **outStagingTexture,
+ unsigned int *outSubresourceIndex);
+ angle::Result createStagingTexture(const gl::Context *context);
+ void releaseStagingTexture();
+
+ Renderer11 *mRenderer;
+
+ DXGI_FORMAT mDXGIFormat;
+ TextureHelper11 mStagingTexture;
+ unsigned int mStagingSubresource;
+ MappedSubresourceVerifier11 mStagingTextureSubresourceVerifier;
+
+ bool mRecoverFromStorage;
+ TextureStorage11 *mAssociatedStorage;
+ gl::ImageIndex mAssociatedImageIndex;
+ unsigned int mRecoveredFromStorageCount;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp
new file mode 100644
index 0000000000..cf4eecc659
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp
@@ -0,0 +1,160 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexBuffer11.cpp: Defines the D3D11 IndexBuffer implementation.
+
+#include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+
+IndexBuffer11::IndexBuffer11(Renderer11 *const renderer)
+ : mRenderer(renderer),
+ mBuffer(),
+ mBufferSize(0),
+ mIndexType(gl::DrawElementsType::InvalidEnum),
+ mDynamicUsage(false)
+{}
+
+IndexBuffer11::~IndexBuffer11() {}
+
+angle::Result IndexBuffer11::initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType,
+ bool dynamic)
+{
+ mBuffer.reset();
+
+ updateSerial();
+
+ if (bufferSize > 0)
+ {
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = bufferSize;
+ bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), bufferDesc, &mBuffer));
+
+ if (dynamic)
+ {
+ mBuffer.setDebugName("IndexBuffer11 (dynamic)");
+ }
+ else
+ {
+ mBuffer.setDebugName("IndexBuffer11 (static)");
+ }
+ }
+
+ mBufferSize = bufferSize;
+ mIndexType = indexType;
+ mDynamicUsage = dynamic;
+
+ return angle::Result::Continue;
+}
+
+angle::Result IndexBuffer11::mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_HR(context11, mBuffer.valid(), "Internal index buffer is not initialized.",
+ E_OUTOFMEMORY);
+
+ // Check for integer overflows and out-out-bounds map requests
+ bool outOfBounds = (offset + size < offset || offset + size > mBufferSize);
+ ANGLE_CHECK_HR(context11, !outOfBounds, "Index buffer map range is not inside the buffer.",
+ E_OUTOFMEMORY);
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ANGLE_TRY(mRenderer->mapResource(context, mBuffer.get(), 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0,
+ &mappedResource));
+
+ *outMappedMemory = static_cast<char *>(mappedResource.pData) + offset;
+ return angle::Result::Continue;
+}
+
+angle::Result IndexBuffer11::unmapBuffer(const gl::Context *context)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_HR(context11, mBuffer.valid(), "Internal index buffer is not initialized.",
+ E_OUTOFMEMORY);
+
+ ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
+ dxContext->Unmap(mBuffer.get(), 0);
+ return angle::Result::Continue;
+}
+
+gl::DrawElementsType IndexBuffer11::getIndexType() const
+{
+ return mIndexType;
+}
+
+unsigned int IndexBuffer11::getBufferSize() const
+{
+ return mBufferSize;
+}
+
+angle::Result IndexBuffer11::setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType)
+{
+ if (bufferSize > mBufferSize || indexType != mIndexType)
+ {
+ return initialize(context, bufferSize, indexType, mDynamicUsage);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result IndexBuffer11::discard(const gl::Context *context)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_CHECK_HR(context11, mBuffer.valid(), "Internal index buffer is not initialized.",
+ E_OUTOFMEMORY);
+
+ ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ANGLE_TRY(mRenderer->mapResource(context, mBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
+ &mappedResource));
+
+ dxContext->Unmap(mBuffer.get(), 0);
+
+ return angle::Result::Continue;
+}
+
+DXGI_FORMAT IndexBuffer11::getIndexFormat() const
+{
+ switch (mIndexType)
+ {
+ case gl::DrawElementsType::UnsignedByte:
+ return DXGI_FORMAT_R16_UINT;
+ case gl::DrawElementsType::UnsignedShort:
+ return DXGI_FORMAT_R16_UINT;
+ case gl::DrawElementsType::UnsignedInt:
+ return DXGI_FORMAT_R32_UINT;
+ default:
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+const d3d11::Buffer &IndexBuffer11::getBuffer() const
+{
+ return mBuffer;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h
new file mode 100644
index 0000000000..8f6f0e6585
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h
@@ -0,0 +1,58 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// IndexBuffer11.h: Defines the D3D11 IndexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
+
+#include "libANGLE/renderer/d3d/IndexBuffer.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+
+namespace rx
+{
+class Renderer11;
+
+class IndexBuffer11 : public IndexBuffer
+{
+ public:
+ explicit IndexBuffer11(Renderer11 *const renderer);
+ ~IndexBuffer11() override;
+
+ angle::Result initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType,
+ bool dynamic) override;
+
+ angle::Result mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory) override;
+ angle::Result unmapBuffer(const gl::Context *context) override;
+
+ gl::DrawElementsType getIndexType() const override;
+ unsigned int getBufferSize() const override;
+ angle::Result setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType) override;
+
+ angle::Result discard(const gl::Context *context) override;
+
+ DXGI_FORMAT getIndexFormat() const;
+ const d3d11::Buffer &getBuffer() const;
+
+ private:
+ Renderer11 *const mRenderer;
+
+ d3d11::Buffer mBuffer;
+ unsigned int mBufferSize;
+ gl::DrawElementsType mIndexType;
+ bool mDynamicUsage;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
new file mode 100644
index 0000000000..3f343d5fa0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
@@ -0,0 +1,313 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// InputLayoutCache.cpp: Defines InputLayoutCache, a class that builds and caches
+// D3D11 input layouts.
+
+#include "libANGLE/renderer/d3d/d3d11/InputLayoutCache.h"
+
+#include "common/bitset_utils.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/renderer/d3d/IndexDataManager.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/VertexDataManager.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h"
+#include "libANGLE/renderer/d3d/d3d11/VertexArray11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+
+namespace rx
+{
+
+namespace
+{
+
+GLenum GetGLSLAttributeType(const std::vector<sh::Attribute> &shaderAttributes, size_t index)
+{
+ // Count matrices differently
+ for (const sh::Attribute &attrib : shaderAttributes)
+ {
+ if (attrib.location == -1)
+ {
+ continue;
+ }
+
+ GLenum transposedType = gl::TransposeMatrixType(attrib.type);
+ int rows = gl::VariableRowCount(transposedType);
+ int intIndex = static_cast<int>(index);
+
+ if (intIndex >= attrib.location && intIndex < attrib.location + rows)
+ {
+ return transposedType;
+ }
+ }
+
+ UNREACHABLE();
+ return GL_NONE;
+}
+
+struct PackedAttribute
+{
+ uint8_t attribType;
+ uint8_t semanticIndex;
+ uint8_t vertexFormatType;
+ uint8_t dummyPadding;
+ uint32_t divisor;
+};
+
+} // anonymous namespace
+
+PackedAttributeLayout::PackedAttributeLayout() : numAttributes(0), flags(0), attributeData({}) {}
+
+PackedAttributeLayout::PackedAttributeLayout(const PackedAttributeLayout &other) = default;
+
+void PackedAttributeLayout::addAttributeData(GLenum glType,
+ UINT semanticIndex,
+ angle::FormatID vertexFormatID,
+ unsigned int divisor)
+{
+ gl::AttributeType attribType = gl::GetAttributeType(glType);
+
+ PackedAttribute packedAttrib;
+ packedAttrib.attribType = static_cast<uint8_t>(attribType);
+ packedAttrib.semanticIndex = static_cast<uint8_t>(semanticIndex);
+ packedAttrib.vertexFormatType = static_cast<uint8_t>(vertexFormatID);
+ packedAttrib.dummyPadding = 0u;
+ packedAttrib.divisor = static_cast<uint32_t>(divisor);
+
+ ASSERT(static_cast<gl::AttributeType>(packedAttrib.attribType) == attribType);
+ ASSERT(static_cast<UINT>(packedAttrib.semanticIndex) == semanticIndex);
+ ASSERT(static_cast<angle::FormatID>(packedAttrib.vertexFormatType) == vertexFormatID);
+ ASSERT(static_cast<unsigned int>(packedAttrib.divisor) == divisor);
+
+ static_assert(sizeof(uint64_t) == sizeof(PackedAttribute),
+ "PackedAttributes must be 64-bits exactly.");
+
+ attributeData[numAttributes++] = gl::bitCast<uint64_t>(packedAttrib);
+}
+
+bool PackedAttributeLayout::operator==(const PackedAttributeLayout &other) const
+{
+ return (numAttributes == other.numAttributes) && (flags == other.flags) &&
+ (attributeData == other.attributeData);
+}
+
+InputLayoutCache::InputLayoutCache() : mLayoutCache(kDefaultCacheSize * 2) {}
+
+InputLayoutCache::~InputLayoutCache() {}
+
+void InputLayoutCache::clear()
+{
+ mLayoutCache.Clear();
+}
+
+angle::Result InputLayoutCache::getInputLayout(
+ Context11 *context11,
+ const gl::State &state,
+ const std::vector<const TranslatedAttribute *> &currentAttributes,
+ const AttribIndexArray &sortedSemanticIndices,
+ gl::PrimitiveMode mode,
+ GLsizei vertexCount,
+ GLsizei instances,
+ const d3d11::InputLayout **inputLayoutOut)
+{
+ gl::Program *program = state.getProgram();
+ const auto &shaderAttributes = program->getAttributes();
+ PackedAttributeLayout layout;
+
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
+ bool programUsesInstancedPointSprites =
+ programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation();
+ bool instancedPointSpritesActive =
+ programUsesInstancedPointSprites && (mode == gl::PrimitiveMode::Points);
+
+ if (programUsesInstancedPointSprites)
+ {
+ layout.flags |= PackedAttributeLayout::FLAG_USES_INSTANCED_SPRITES;
+ }
+
+ if (instancedPointSpritesActive)
+ {
+ layout.flags |= PackedAttributeLayout::FLAG_INSTANCED_SPRITES_ACTIVE;
+ }
+
+ if (instances > 0)
+ {
+ layout.flags |= PackedAttributeLayout::FLAG_INSTANCED_RENDERING_ACTIVE;
+ }
+
+ const auto &attribs = state.getVertexArray()->getVertexAttributes();
+ const auto &bindings = state.getVertexArray()->getVertexBindings();
+ const auto &locationToSemantic = programD3D->getAttribLocationToD3DSemantics();
+ int divisorMultiplier = program->usesMultiview() ? program->getNumViews() : 1;
+
+ for (size_t attribIndex : program->getActiveAttribLocationsMask())
+ {
+ // Record the type of the associated vertex shader vector in our key
+ // This will prevent mismatched vertex shaders from using the same input layout
+ GLenum glslElementType = GetGLSLAttributeType(shaderAttributes, attribIndex);
+
+ const auto &attrib = attribs[attribIndex];
+ const auto &binding = bindings[attrib.bindingIndex];
+ int d3dSemantic = locationToSemantic[attribIndex];
+
+ const auto &currentValue =
+ state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex));
+ angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, currentValue.Type);
+
+ layout.addAttributeData(glslElementType, d3dSemantic, vertexFormatID,
+ binding.getDivisor() * divisorMultiplier);
+ }
+
+ if (layout.numAttributes > 0 || layout.flags != 0)
+ {
+ auto it = mLayoutCache.Get(layout);
+ if (it != mLayoutCache.end())
+ {
+ *inputLayoutOut = &it->second;
+ }
+ else
+ {
+ angle::TrimCache(mLayoutCache.max_size() / 2, kGCLimit, "input layout", &mLayoutCache);
+
+ d3d11::InputLayout newInputLayout;
+ ANGLE_TRY(createInputLayout(context11, sortedSemanticIndices, currentAttributes, mode,
+ vertexCount, instances, &newInputLayout));
+
+ auto insertIt = mLayoutCache.Put(layout, std::move(newInputLayout));
+ *inputLayoutOut = &insertIt->second;
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result InputLayoutCache::createInputLayout(
+ Context11 *context11,
+ const AttribIndexArray &sortedSemanticIndices,
+ const std::vector<const TranslatedAttribute *> &currentAttributes,
+ gl::PrimitiveMode mode,
+ GLsizei vertexCount,
+ GLsizei instances,
+ d3d11::InputLayout *inputLayoutOut)
+{
+ Renderer11 *renderer = context11->getRenderer();
+ ProgramD3D *programD3D = renderer->getStateManager()->getProgramD3D();
+ D3D_FEATURE_LEVEL featureLevel = renderer->getRenderer11DeviceCaps().featureLevel;
+
+ bool programUsesInstancedPointSprites =
+ programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation();
+
+ unsigned int inputElementCount = 0;
+ gl::AttribArray<D3D11_INPUT_ELEMENT_DESC> inputElements;
+
+ for (size_t attribIndex = 0; attribIndex < currentAttributes.size(); ++attribIndex)
+ {
+ const auto &attrib = *currentAttributes[attribIndex];
+ const int sortedIndex = sortedSemanticIndices[attribIndex];
+
+ D3D11_INPUT_CLASSIFICATION inputClass =
+ attrib.divisor > 0 ? D3D11_INPUT_PER_INSTANCE_DATA : D3D11_INPUT_PER_VERTEX_DATA;
+
+ angle::FormatID vertexFormatID =
+ gl::GetVertexFormatID(*attrib.attribute, attrib.currentValueType);
+ const auto &vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormatID, featureLevel);
+
+ auto *inputElement = &inputElements[inputElementCount];
+
+ inputElement->SemanticName = "TEXCOORD";
+ inputElement->SemanticIndex = sortedIndex;
+ inputElement->Format = vertexFormatInfo.nativeFormat;
+ inputElement->InputSlot = static_cast<UINT>(attribIndex);
+ inputElement->AlignedByteOffset = 0;
+ inputElement->InputSlotClass = inputClass;
+ inputElement->InstanceDataStepRate = attrib.divisor;
+
+ inputElementCount++;
+ }
+
+ // Instanced PointSprite emulation requires additional entries in the
+ // inputlayout to support the vertices that make up the pointsprite quad.
+ // We do this even if mode != GL_POINTS, since the shader signature has these inputs, and the
+ // input layout must match the shader
+ if (programUsesInstancedPointSprites)
+ {
+ // On 9_3, we must ensure that slot 0 contains non-instanced data.
+ // If slot 0 currently contains instanced data then we swap it with a non-instanced element.
+ // Note that instancing is only available on 9_3 via ANGLE_instanced_arrays, since 9_3
+ // doesn't support OpenGL ES 3.0.
+ // As per the spec for ANGLE_instanced_arrays, not all attributes can be instanced
+ // simultaneously, so a non-instanced element must exist.
+
+ UINT numIndicesPerInstance = 0;
+ if (instances > 0)
+ {
+ // This requires that the index range is resolved.
+ // Note: Vertex indexes can be arbitrarily large.
+ numIndicesPerInstance = gl::clampCast<UINT>(vertexCount);
+ }
+
+ for (size_t elementIndex = 0; elementIndex < inputElementCount; ++elementIndex)
+ {
+ // If rendering points and instanced pointsprite emulation is being used, the
+ // inputClass is required to be configured as per instance data
+ if (mode == gl::PrimitiveMode::Points)
+ {
+ inputElements[elementIndex].InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
+ inputElements[elementIndex].InstanceDataStepRate = 1;
+ if (numIndicesPerInstance > 0 && currentAttributes[elementIndex]->divisor > 0)
+ {
+ inputElements[elementIndex].InstanceDataStepRate = numIndicesPerInstance;
+ }
+ }
+ inputElements[elementIndex].InputSlot++;
+ }
+
+ inputElements[inputElementCount].SemanticName = "SPRITEPOSITION";
+ inputElements[inputElementCount].SemanticIndex = 0;
+ inputElements[inputElementCount].Format = DXGI_FORMAT_R32G32B32_FLOAT;
+ inputElements[inputElementCount].InputSlot = 0;
+ inputElements[inputElementCount].AlignedByteOffset = 0;
+ inputElements[inputElementCount].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
+ inputElements[inputElementCount].InstanceDataStepRate = 0;
+ inputElementCount++;
+
+ inputElements[inputElementCount].SemanticName = "SPRITETEXCOORD";
+ inputElements[inputElementCount].SemanticIndex = 0;
+ inputElements[inputElementCount].Format = DXGI_FORMAT_R32G32_FLOAT;
+ inputElements[inputElementCount].InputSlot = 0;
+ inputElements[inputElementCount].AlignedByteOffset = sizeof(float) * 3;
+ inputElements[inputElementCount].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
+ inputElements[inputElementCount].InstanceDataStepRate = 0;
+ inputElementCount++;
+ }
+
+ ShaderExecutableD3D *shader = nullptr;
+ ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(context11, &shader, nullptr));
+
+ ShaderExecutableD3D *shader11 = GetAs<ShaderExecutable11>(shader);
+
+ InputElementArray inputElementArray(inputElements.data(), inputElementCount);
+ ShaderData vertexShaderData(shader11->getFunction(), shader11->getLength());
+
+ ANGLE_TRY(renderer->allocateResource(context11, inputElementArray, &vertexShaderData,
+ inputLayoutOut));
+ return angle::Result::Continue;
+}
+
+void InputLayoutCache::setCacheSize(size_t newCacheSize)
+{
+ // Forces a reset of the cache.
+ LayoutCache newCache(newCacheSize);
+ mLayoutCache.Swap(newCache);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h
new file mode 100644
index 0000000000..3d62ecd3d0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h
@@ -0,0 +1,123 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// InputLayoutCache.h: Defines InputLayoutCache, a class that builds and caches
+// D3D11 input layouts.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
+
+#include <GLES2/gl2.h>
+
+#include <cstddef>
+
+#include <array>
+#include <map>
+
+#include "common/angleutils.h"
+#include "libANGLE/Constants.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/SizedMRUCache.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+
+namespace rx
+{
+struct PackedAttributeLayout
+{
+ PackedAttributeLayout();
+ PackedAttributeLayout(const PackedAttributeLayout &other);
+
+ void addAttributeData(GLenum glType,
+ UINT semanticIndex,
+ angle::FormatID vertexFormatID,
+ unsigned int divisor);
+
+ bool operator==(const PackedAttributeLayout &other) const;
+
+ enum Flags
+ {
+ FLAG_USES_INSTANCED_SPRITES = 0x1,
+ FLAG_INSTANCED_SPRITES_ACTIVE = 0x2,
+ FLAG_INSTANCED_RENDERING_ACTIVE = 0x4,
+ };
+
+ uint32_t numAttributes;
+ uint32_t flags;
+ gl::AttribArray<uint64_t> attributeData;
+};
+} // namespace rx
+
+namespace std
+{
+template <>
+struct hash<rx::PackedAttributeLayout>
+{
+ size_t operator()(const rx::PackedAttributeLayout &value) const
+ {
+ return angle::ComputeGenericHash(value);
+ }
+};
+} // namespace std
+
+namespace gl
+{
+class Program;
+} // namespace gl
+
+namespace rx
+{
+class Context11;
+struct TranslatedAttribute;
+struct TranslatedIndexData;
+struct SourceIndexData;
+class ProgramD3D;
+class Renderer11;
+
+class InputLayoutCache : angle::NonCopyable
+{
+ public:
+ InputLayoutCache();
+ ~InputLayoutCache();
+
+ void clear();
+
+ // Useful for testing
+ void setCacheSize(size_t newCacheSize);
+
+ angle::Result getInputLayout(Context11 *context,
+ const gl::State &state,
+ const std::vector<const TranslatedAttribute *> &currentAttributes,
+ const AttribIndexArray &sortedSemanticIndices,
+ gl::PrimitiveMode mode,
+ GLsizei vertexCount,
+ GLsizei instances,
+ const d3d11::InputLayout **inputLayoutOut);
+
+ private:
+ angle::Result createInputLayout(
+ Context11 *context11,
+ const AttribIndexArray &sortedSemanticIndices,
+ const std::vector<const TranslatedAttribute *> &currentAttributes,
+ gl::PrimitiveMode mode,
+ GLsizei vertexCount,
+ GLsizei instances,
+ d3d11::InputLayout *inputLayoutOut);
+
+ // Starting cache size.
+ static constexpr size_t kDefaultCacheSize = 1024;
+
+ // The cache tries to clean up this many states at once.
+ static constexpr size_t kGCLimit = 128;
+
+ using LayoutCache = angle::base::HashingMRUCache<PackedAttributeLayout, d3d11::InputLayout>;
+ LayoutCache mLayoutCache;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.cpp
new file mode 100644
index 0000000000..d0f6906f1e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.cpp
@@ -0,0 +1,119 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// MappedSubresourceVerifier11.cpp: Implements the
+// rx::MappedSubresourceVerifier11 class, a simple wrapper to D3D11 Texture2D
+// mapped memory so that ASAN and MSAN can catch memory errors done with a
+// pointer to the mapped texture memory.
+
+#include "libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h"
+
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+
+namespace rx
+{
+
+#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || defined(ANGLE_ENABLE_ASSERTS)
+
+namespace
+{
+
+# if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)
+constexpr bool kUseWrap = true;
+# else
+constexpr bool kUseWrap = false;
+# endif
+
+size_t getPitchCount(const D3D11_TEXTURE2D_DESC &desc)
+{
+ const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(desc.Format);
+ ASSERT(desc.Height % dxgiFormatInfo.blockHeight == 0);
+ return desc.Height / dxgiFormatInfo.blockHeight;
+}
+
+} // namespace
+
+MappedSubresourceVerifier11::MappedSubresourceVerifier11() = default;
+
+MappedSubresourceVerifier11::~MappedSubresourceVerifier11()
+{
+ ASSERT(!mOrigData);
+ ASSERT(!mWrapData.size());
+}
+
+void MappedSubresourceVerifier11::setDesc(const D3D11_TEXTURE2D_DESC &desc)
+{
+ ASSERT(desc.CPUAccessFlags & (D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE));
+ ASSERT(desc.Width);
+ ASSERT(desc.Height);
+ ASSERT(!mOrigData);
+ ASSERT(!mWrapData.size());
+ ASSERT(!mPitchType);
+ ASSERT(!mPitchCount);
+ mPitchType = &D3D11_MAPPED_SUBRESOURCE::RowPitch;
+ mPitchCount = getPitchCount(desc);
+}
+
+void MappedSubresourceVerifier11::setDesc(const D3D11_TEXTURE3D_DESC &desc)
+{
+ ASSERT(desc.CPUAccessFlags & (D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE));
+ ASSERT(desc.Width);
+ ASSERT(desc.Height);
+ ASSERT(desc.Depth);
+ ASSERT(!mOrigData);
+ ASSERT(!mWrapData.size());
+ ASSERT(!mPitchType);
+ ASSERT(!mPitchCount);
+ mPitchType = &D3D11_MAPPED_SUBRESOURCE::DepthPitch;
+ mPitchCount = desc.Depth;
+}
+
+void MappedSubresourceVerifier11::reset()
+{
+ ASSERT(!mOrigData);
+ ASSERT(!mWrapData.size());
+ mPitchType = nullptr;
+ mPitchCount = 0;
+}
+
+bool MappedSubresourceVerifier11::wrap(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
+{
+ ASSERT(map && map->pData);
+ ASSERT(mapType == D3D11_MAP_READ || mapType == D3D11_MAP_WRITE ||
+ mapType == D3D11_MAP_READ_WRITE);
+ ASSERT(mPitchCount);
+
+ if (kUseWrap)
+ {
+ if (!mWrapData.resize(mPitchCount * map->*mPitchType))
+ return false;
+ }
+
+ mOrigData = reinterpret_cast<uint8_t *>(map->pData);
+
+ if (kUseWrap)
+ {
+ std::copy(mOrigData, mOrigData + mWrapData.size(), mWrapData.data());
+ map->pData = mWrapData.data();
+ }
+ return true;
+}
+
+void MappedSubresourceVerifier11::unwrap()
+{
+ ASSERT(mPitchCount);
+ ASSERT(mOrigData);
+ if (kUseWrap)
+ {
+ std::copy(mWrapData.data(), mWrapData.data() + mWrapData.size(), mOrigData);
+ mWrapData = angle::MemoryBuffer();
+ }
+ mOrigData = nullptr;
+}
+
+#endif
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h
new file mode 100644
index 0000000000..f0fc70eb85
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h
@@ -0,0 +1,63 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// MappedSubresourceVerifier11.h: Defines the rx::MappedSubresourceVerifier11
+// class, a simple wrapper to D3D11 Texture2D mapped memory so that ASAN
+// MSAN can catch memory errors done with a pointer to the mapped texture
+// memory.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_MAPPED_SUBRESOURCE_VERIFIER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_MAPPED_SUBRESOURCE_VERIFIER11_H_
+
+#include "common/MemoryBuffer.h"
+#include "common/angleutils.h"
+
+namespace rx
+{
+
+class MappedSubresourceVerifier11 final : angle::NonCopyable
+{
+ public:
+ MappedSubresourceVerifier11();
+ ~MappedSubresourceVerifier11();
+
+ void setDesc(const D3D11_TEXTURE2D_DESC &desc);
+ void setDesc(const D3D11_TEXTURE3D_DESC &desc);
+ void reset();
+
+ bool wrap(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
+ void unwrap();
+
+ private:
+#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || defined(ANGLE_ENABLE_ASSERTS)
+ UINT D3D11_MAPPED_SUBRESOURCE::*mPitchType = nullptr;
+ size_t mPitchCount = 0;
+ angle::MemoryBuffer mWrapData;
+ uint8_t *mOrigData = nullptr;
+#endif
+};
+
+#if !(defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || defined(ANGLE_ENABLE_ASSERTS))
+
+inline MappedSubresourceVerifier11::MappedSubresourceVerifier11() = default;
+inline MappedSubresourceVerifier11::~MappedSubresourceVerifier11() = default;
+
+inline void MappedSubresourceVerifier11::setDesc(const D3D11_TEXTURE2D_DESC &desc) {}
+inline void MappedSubresourceVerifier11::setDesc(const D3D11_TEXTURE3D_DESC &desc) {}
+inline void MappedSubresourceVerifier11::reset() {}
+
+inline bool MappedSubresourceVerifier11::wrap(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
+{
+ return true;
+}
+
+inline void MappedSubresourceVerifier11::unwrap() {}
+
+#endif
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_MAPPED_SUBRESOURCE_VERIFIER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h
new file mode 100644
index 0000000000..4bf14a97a8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/NativeWindow11.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// NativeWindow11.h: Defines NativeWindow11, a class for managing and performing operations on an
+// EGLNativeWindowType for the D3D11 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW11_H_
+
+#include "common/debug.h"
+#include "common/platform.h"
+
+#include "libANGLE/Config.h"
+#include "libANGLE/renderer/d3d/NativeWindowD3D.h"
+
+namespace rx
+{
+
+class NativeWindow11 : public NativeWindowD3D
+{
+ public:
+ NativeWindow11(EGLNativeWindowType window) : NativeWindowD3D(window) {}
+
+ virtual HRESULT createSwapChain(ID3D11Device *device,
+ IDXGIFactory *factory,
+ DXGI_FORMAT format,
+ UINT width,
+ UINT height,
+ UINT samples,
+ IDXGISwapChain **swapChain) = 0;
+ virtual void commitChange() = 0;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp
new file mode 100644
index 0000000000..2d96cdab52
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp
@@ -0,0 +1,270 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// PixelTransfer11.cpp:
+// Implementation for buffer-to-texture and texture-to-buffer copies.
+// Used to implement pixel transfers from unpack and to pack buffers.
+//
+
+#include "libANGLE/renderer/d3d/d3d11/PixelTransfer11.h"
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+// Precompiled shaders
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h"
+
+namespace rx
+{
+
+PixelTransfer11::PixelTransfer11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mResourcesLoaded(false),
+ mBufferToTextureVS(),
+ mBufferToTextureGS(),
+ mParamsConstantBuffer(),
+ mCopyRasterizerState(),
+ mCopyDepthStencilState()
+{}
+
+PixelTransfer11::~PixelTransfer11() {}
+
+angle::Result PixelTransfer11::loadResources(const gl::Context *context)
+{
+ if (mResourcesLoaded)
+ {
+ return angle::Result::Continue;
+ }
+
+ D3D11_RASTERIZER_DESC rasterDesc;
+ rasterDesc.FillMode = D3D11_FILL_SOLID;
+ rasterDesc.CullMode = D3D11_CULL_NONE;
+ rasterDesc.FrontCounterClockwise = FALSE;
+ rasterDesc.DepthBias = 0;
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
+ rasterDesc.DepthBiasClamp = 0.0f;
+ rasterDesc.DepthClipEnable = TRUE;
+ rasterDesc.ScissorEnable = FALSE;
+ rasterDesc.MultisampleEnable = FALSE;
+ rasterDesc.AntialiasedLineEnable = FALSE;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, rasterDesc, &mCopyRasterizerState));
+
+ D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
+ depthStencilDesc.DepthEnable = true;
+ depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ depthStencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.StencilEnable = FALSE;
+ depthStencilDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+ depthStencilDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+ depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+ depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, depthStencilDesc, &mCopyDepthStencilState));
+
+ D3D11_BUFFER_DESC constantBufferDesc = {0};
+ constantBufferDesc.ByteWidth = roundUp<UINT>(sizeof(CopyShaderParams), 32u);
+ constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ constantBufferDesc.MiscFlags = 0;
+ constantBufferDesc.StructureByteStride = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, constantBufferDesc, &mParamsConstantBuffer));
+ mParamsConstantBuffer.setDebugName("PixelTransfer11 constant buffer");
+
+ // init shaders
+ ANGLE_TRY(mRenderer->allocateResource(context11, ShaderData(g_VS_BufferToTexture),
+ &mBufferToTextureVS));
+ mBufferToTextureVS.setDebugName("BufferToTexture VS");
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, ShaderData(g_GS_BufferToTexture),
+ &mBufferToTextureGS));
+ mBufferToTextureGS.setDebugName("BufferToTexture GS");
+
+ ANGLE_TRY(buildShaderMap(context));
+
+ StructZero(&mParamsData);
+
+ mResourcesLoaded = true;
+
+ return angle::Result::Continue;
+}
+
+void PixelTransfer11::setBufferToTextureCopyParams(const gl::Box &destArea,
+ const gl::Extents &destSize,
+ GLenum internalFormat,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ CopyShaderParams *parametersOut)
+{
+ StructZero(parametersOut);
+
+ float texelCenterX = 0.5f / static_cast<float>(destSize.width);
+ float texelCenterY = 0.5f / static_cast<float>(destSize.height);
+
+ unsigned int bytesPerPixel = gl::GetSizedInternalFormatInfo(internalFormat).pixelBytes;
+ unsigned int alignmentBytes = static_cast<unsigned int>(unpack.alignment);
+ unsigned int alignmentPixels =
+ (alignmentBytes <= bytesPerPixel ? 1 : alignmentBytes / bytesPerPixel);
+
+ parametersOut->FirstPixelOffset = offset / bytesPerPixel;
+ parametersOut->PixelsPerRow =
+ static_cast<unsigned int>((unpack.rowLength > 0) ? unpack.rowLength : destArea.width);
+ parametersOut->RowStride = roundUp(parametersOut->PixelsPerRow, alignmentPixels);
+ parametersOut->RowsPerSlice = static_cast<unsigned int>(destArea.height);
+ parametersOut->PositionOffset[0] =
+ texelCenterX + (destArea.x / float(destSize.width)) * 2.0f - 1.0f;
+ parametersOut->PositionOffset[1] =
+ texelCenterY + ((destSize.height - destArea.y - 1) / float(destSize.height)) * 2.0f - 1.0f;
+ parametersOut->PositionScale[0] = 2.0f / static_cast<float>(destSize.width);
+ parametersOut->PositionScale[1] = -2.0f / static_cast<float>(destSize.height);
+ parametersOut->FirstSlice = destArea.z;
+}
+
+angle::Result PixelTransfer11::copyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea)
+{
+ ANGLE_TRY(loadResources(context));
+
+ gl::Extents destSize = destRenderTarget->getExtents();
+
+ ASSERT(destArea.x >= 0 && destArea.x + destArea.width <= destSize.width && destArea.y >= 0 &&
+ destArea.y + destArea.height <= destSize.height && destArea.z >= 0 &&
+ destArea.z + destArea.depth <= destSize.depth);
+
+ const gl::Buffer &sourceBuffer =
+ *context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack);
+
+ ASSERT(mRenderer->supportsFastCopyBufferToTexture(destinationFormat));
+
+ const d3d11::PixelShader *pixelShader = findBufferToTexturePS(destinationFormat);
+ ASSERT(pixelShader);
+
+ // The SRV must be in the proper read format, which may be different from the destination format
+ // EG: for half float data, we can load full precision floats with implicit conversion
+ GLenum unsizedFormat = gl::GetUnsizedFormat(destinationFormat);
+ const gl::InternalFormat &sourceglFormatInfo =
+ gl::GetInternalFormatInfo(unsizedFormat, sourcePixelsType);
+
+ const d3d11::Format &sourceFormatInfo = d3d11::Format::Get(
+ sourceglFormatInfo.sizedInternalFormat, mRenderer->getRenderer11DeviceCaps());
+ DXGI_FORMAT srvFormat = sourceFormatInfo.srvFormat;
+ ASSERT(srvFormat != DXGI_FORMAT_UNKNOWN);
+ Buffer11 *bufferStorage11 = GetAs<Buffer11>(sourceBuffer.getImplementation());
+ const d3d11::ShaderResourceView *bufferSRV = nullptr;
+ ANGLE_TRY(bufferStorage11->getSRV(context, srvFormat, &bufferSRV));
+ ASSERT(bufferSRV != nullptr);
+
+ const d3d11::RenderTargetView &textureRTV =
+ GetAs<RenderTarget11>(destRenderTarget)->getRenderTargetView();
+ ASSERT(textureRTV.valid());
+
+ CopyShaderParams shaderParams;
+ setBufferToTextureCopyParams(destArea, destSize, sourceglFormatInfo.sizedInternalFormat, unpack,
+ offset, &shaderParams);
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // Are we doing a 2D or 3D copy?
+ const auto *geometryShader = ((destSize.depth > 1) ? &mBufferToTextureGS : nullptr);
+ StateManager11 *stateManager = mRenderer->getStateManager();
+
+ stateManager->setDrawShaders(&mBufferToTextureVS, geometryShader, pixelShader);
+ stateManager->setShaderResource(gl::ShaderType::Fragment, 0, bufferSRV);
+ stateManager->setInputLayout(nullptr);
+ stateManager->setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
+
+ stateManager->setSingleVertexBuffer(nullptr, 0, 0);
+ stateManager->setSimpleBlendState(nullptr);
+ stateManager->setDepthStencilState(&mCopyDepthStencilState, 0xFFFFFFFF);
+ stateManager->setRasterizerState(&mCopyRasterizerState);
+
+ stateManager->setRenderTarget(textureRTV.get(), nullptr);
+
+ if (!StructEquals(mParamsData, shaderParams))
+ {
+ d3d11::SetBufferData(deviceContext, mParamsConstantBuffer.get(), shaderParams);
+ mParamsData = shaderParams;
+ }
+
+ stateManager->setVertexConstantBuffer(0, &mParamsConstantBuffer);
+
+ // Set the viewport
+ stateManager->setSimpleViewport(destSize);
+
+ UINT numPixels = (destArea.width * destArea.height * destArea.depth);
+ deviceContext->Draw(numPixels, 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result PixelTransfer11::buildShaderMap(const gl::Context *context)
+{
+ d3d11::PixelShader bufferToTextureFloat;
+ d3d11::PixelShader bufferToTextureInt;
+ d3d11::PixelShader bufferToTextureUint;
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, ShaderData(g_PS_BufferToTexture_4F),
+ &bufferToTextureFloat));
+ ANGLE_TRY(mRenderer->allocateResource(context11, ShaderData(g_PS_BufferToTexture_4I),
+ &bufferToTextureInt));
+ ANGLE_TRY(mRenderer->allocateResource(context11, ShaderData(g_PS_BufferToTexture_4UI),
+ &bufferToTextureUint));
+
+ bufferToTextureFloat.setDebugName("BufferToTexture RGBA ps");
+ bufferToTextureInt.setDebugName("BufferToTexture RGBA-I ps");
+ bufferToTextureUint.setDebugName("BufferToTexture RGBA-UI ps");
+
+ mBufferToTexturePSMap[GL_FLOAT] = std::move(bufferToTextureFloat);
+ mBufferToTexturePSMap[GL_INT] = std::move(bufferToTextureInt);
+ mBufferToTexturePSMap[GL_UNSIGNED_INT] = std::move(bufferToTextureUint);
+
+ return angle::Result::Continue;
+}
+
+const d3d11::PixelShader *PixelTransfer11::findBufferToTexturePS(GLenum internalFormat) const
+{
+ GLenum componentType = gl::GetSizedInternalFormatInfo(internalFormat).componentType;
+ if (componentType == GL_SIGNED_NORMALIZED || componentType == GL_UNSIGNED_NORMALIZED)
+ {
+ componentType = GL_FLOAT;
+ }
+
+ auto shaderMapIt = mBufferToTexturePSMap.find(componentType);
+ return (shaderMapIt == mBufferToTexturePSMap.end() ? nullptr : &shaderMapIt->second);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h
new file mode 100644
index 0000000000..49f4a3a816
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h
@@ -0,0 +1,96 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// PixelTransfer11.h:
+// Buffer-to-Texture and Texture-to-Buffer data transfers.
+// Used to implement pixel unpack and pixel pack buffers in ES3.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_PIXELTRANSFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_PIXELTRANSFER11_H_
+
+#include <GLES2/gl2.h>
+
+#include <map>
+
+#include "common/platform.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+
+namespace gl
+{
+
+class Buffer;
+struct Box;
+struct Extents;
+struct PixelUnpackState;
+
+} // namespace gl
+
+namespace rx
+{
+class Renderer11;
+class RenderTargetD3D;
+
+class PixelTransfer11
+{
+ public:
+ explicit PixelTransfer11(Renderer11 *renderer);
+ ~PixelTransfer11();
+
+ // unpack: the source buffer is stored in the unpack state, and buffer strides
+ // offset: the start of the data within the unpack buffer
+ // destRenderTarget: individual slice/layer of a target texture
+ // destinationFormat/sourcePixelsType: determines shaders + shader parameters
+ // destArea: the sub-section of destRenderTarget to copy to
+ angle::Result copyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea);
+
+ private:
+ struct CopyShaderParams
+ {
+ unsigned int FirstPixelOffset;
+ unsigned int PixelsPerRow;
+ unsigned int RowStride;
+ unsigned int RowsPerSlice;
+ float PositionOffset[2];
+ float PositionScale[2];
+ int TexLocationOffset[2];
+ int TexLocationScale[2];
+ unsigned int FirstSlice;
+ };
+
+ static void setBufferToTextureCopyParams(const gl::Box &destArea,
+ const gl::Extents &destSize,
+ GLenum internalFormat,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ CopyShaderParams *parametersOut);
+
+ angle::Result loadResources(const gl::Context *context);
+ angle::Result buildShaderMap(const gl::Context *context);
+ const d3d11::PixelShader *findBufferToTexturePS(GLenum internalFormat) const;
+
+ Renderer11 *mRenderer;
+
+ bool mResourcesLoaded;
+ std::map<GLenum, d3d11::PixelShader> mBufferToTexturePSMap;
+ d3d11::VertexShader mBufferToTextureVS;
+ d3d11::GeometryShader mBufferToTextureGS;
+ d3d11::Buffer mParamsConstantBuffer;
+ CopyShaderParams mParamsData;
+
+ d3d11::RasterizerState mCopyRasterizerState;
+ d3d11::DepthStencilState mCopyDepthStencilState;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_PIXELTRANSFER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.cpp
new file mode 100644
index 0000000000..510065ccd6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.cpp
@@ -0,0 +1,34 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Program11: D3D11 implementation of an OpenGL Program.
+
+#include "libANGLE/renderer/d3d/d3d11/Program11.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/StateManager11.h"
+
+namespace rx
+{
+Program11::Program11(const gl::ProgramState &programState, Renderer11 *renderer)
+ : ProgramD3D(programState, renderer)
+{}
+
+Program11::~Program11() = default;
+
+angle::Result Program11::syncState(const gl::Context *context,
+ const gl::Program::DirtyBits &dirtyBits)
+{
+ Renderer11 *renderer11 = GetImplAs<Context11>(context)->getRenderer();
+ StateManager11 *stateManager = renderer11->getStateManager();
+
+ // This single flag should be replace by individual dirtyness.
+ stateManager->invalidateProgramUniformBuffers();
+
+ return angle::Result::Continue;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.h
new file mode 100644
index 0000000000..71d06037ba
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Program11.h
@@ -0,0 +1,28 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Program11: D3D11 implementation of an OpenGL Program.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_PROGRAM11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_PROGRAM11_H_
+
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+
+namespace rx
+{
+class Renderer11;
+
+class Program11 : public ProgramD3D
+{
+ public:
+ Program11(const gl::ProgramState &programState, Renderer11 *renderer11);
+ ~Program11() override;
+
+ angle::Result syncState(const gl::Context *context,
+ const gl::Program::DirtyBits &dirtyBits) override;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_PROGRAM11_H_ \ No newline at end of file
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp
new file mode 100644
index 0000000000..2790809dde
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp
@@ -0,0 +1,21 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ProgramPipelineNULL.cpp:
+// Implements the class methods for ProgramPipeline11.
+//
+
+#include "libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h"
+
+namespace rx
+{
+
+ProgramPipeline11::ProgramPipeline11(const gl::ProgramPipelineState &state)
+ : ProgramPipelineImpl(state)
+{}
+
+ProgramPipeline11::~ProgramPipeline11() {}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h
new file mode 100644
index 0000000000..cf838eec05
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h
@@ -0,0 +1,27 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ProgramPipeline11.h:
+// Defines the class interface for ProgramPipeline11, implementing ProgramPipelineImpl.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_PROGRAMPIPELINE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_PROGRAMPIPELINE11_H_
+
+#include "libANGLE/renderer/ProgramPipelineImpl.h"
+
+namespace rx
+{
+
+class ProgramPipeline11 : public ProgramPipelineImpl
+{
+ public:
+ ProgramPipeline11(const gl::ProgramPipelineState &state);
+ ~ProgramPipeline11() override;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_PROGRAMPIPELINE11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
new file mode 100644
index 0000000000..c83fc89a4c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
@@ -0,0 +1,357 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query11.cpp: Defines the rx::Query11 class which implements rx::QueryImpl.
+
+#include "libANGLE/renderer/d3d/d3d11/Query11.h"
+
+#include <GLES2/gl2ext.h>
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace
+{
+
+GLuint64 MergeQueryResults(gl::QueryType type, GLuint64 currentResult, GLuint64 newResult)
+{
+ switch (type)
+ {
+ case gl::QueryType::AnySamples:
+ case gl::QueryType::AnySamplesConservative:
+ return (currentResult == GL_TRUE || newResult == GL_TRUE) ? GL_TRUE : GL_FALSE;
+
+ case gl::QueryType::TransformFeedbackPrimitivesWritten:
+ return currentResult + newResult;
+
+ case gl::QueryType::TimeElapsed:
+ return currentResult + newResult;
+
+ case gl::QueryType::Timestamp:
+ return newResult;
+
+ case gl::QueryType::CommandsCompleted:
+ return newResult;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+} // anonymous namespace
+
+namespace rx
+{
+
+Query11::QueryState::QueryState()
+ : getDataAttemptCount(0), query(), beginTimestamp(), endTimestamp(), finished(false)
+{}
+
+Query11::QueryState::~QueryState() {}
+
+Query11::Query11(Renderer11 *renderer, gl::QueryType type)
+ : QueryImpl(type), mResult(0), mResultSum(0), mRenderer(renderer)
+{
+ mActiveQuery = std::unique_ptr<QueryState>(new QueryState());
+}
+
+Query11::~Query11()
+{
+ mRenderer->getStateManager()->onDeleteQueryObject(this);
+}
+
+angle::Result Query11::begin(const gl::Context *context)
+{
+ mResultSum = 0;
+ mRenderer->getStateManager()->onBeginQuery(this);
+ return resume(GetImplAs<Context11>(context));
+}
+
+angle::Result Query11::end(const gl::Context *context)
+{
+ return pause(GetImplAs<Context11>(context));
+}
+
+angle::Result Query11::queryCounter(const gl::Context *context)
+{
+ // This doesn't do anything for D3D11 as we don't support timestamps
+ ASSERT(getType() == gl::QueryType::Timestamp);
+ mResultSum = 0;
+ mPendingQueries.push_back(std::unique_ptr<QueryState>(new QueryState()));
+ return angle::Result::Continue;
+}
+
+template <typename T>
+angle::Result Query11::getResultBase(Context11 *context11, T *params)
+{
+ ASSERT(!mActiveQuery->query.valid());
+ ANGLE_TRY(flush(context11, true));
+ ASSERT(mPendingQueries.empty());
+ *params = static_cast<T>(mResultSum);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Query11::getResult(const gl::Context *context, GLint *params)
+{
+ return getResultBase(GetImplAs<Context11>(context), params);
+}
+
+angle::Result Query11::getResult(const gl::Context *context, GLuint *params)
+{
+ return getResultBase(GetImplAs<Context11>(context), params);
+}
+
+angle::Result Query11::getResult(const gl::Context *context, GLint64 *params)
+{
+ return getResultBase(GetImplAs<Context11>(context), params);
+}
+
+angle::Result Query11::getResult(const gl::Context *context, GLuint64 *params)
+{
+ return getResultBase(GetImplAs<Context11>(context), params);
+}
+
+angle::Result Query11::isResultAvailable(const gl::Context *context, bool *available)
+{
+ ANGLE_TRY(flush(GetImplAs<Context11>(context), false));
+
+ *available = mPendingQueries.empty();
+ return angle::Result::Continue;
+}
+
+angle::Result Query11::pause(Context11 *context11)
+{
+ if (mActiveQuery->query.valid())
+ {
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ gl::QueryType type = getType();
+
+ // If we are doing time elapsed query the end timestamp
+ if (type == gl::QueryType::TimeElapsed)
+ {
+ context->End(mActiveQuery->endTimestamp.get());
+ }
+
+ context->End(mActiveQuery->query.get());
+
+ mPendingQueries.push_back(std::move(mActiveQuery));
+ mActiveQuery = std::unique_ptr<QueryState>(new QueryState());
+ }
+
+ return flush(context11, false);
+}
+
+angle::Result Query11::resume(Context11 *context11)
+{
+ if (!mActiveQuery->query.valid())
+ {
+ ANGLE_TRY(flush(context11, false));
+
+ gl::QueryType type = getType();
+ D3D11_QUERY d3dQueryType = gl_d3d11::ConvertQueryType(type);
+
+ D3D11_QUERY_DESC queryDesc;
+ queryDesc.Query = d3dQueryType;
+ queryDesc.MiscFlags = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, queryDesc, &mActiveQuery->query));
+
+ // If we are doing time elapsed we also need a query to actually query the timestamp
+ if (type == gl::QueryType::TimeElapsed)
+ {
+ D3D11_QUERY_DESC desc;
+ desc.Query = D3D11_QUERY_TIMESTAMP;
+ desc.MiscFlags = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, desc, &mActiveQuery->beginTimestamp));
+ ANGLE_TRY(mRenderer->allocateResource(context11, desc, &mActiveQuery->endTimestamp));
+ }
+
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+
+ if (d3dQueryType != D3D11_QUERY_EVENT)
+ {
+ context->Begin(mActiveQuery->query.get());
+ }
+
+ // If we are doing time elapsed, query the begin timestamp
+ if (type == gl::QueryType::TimeElapsed)
+ {
+ context->End(mActiveQuery->beginTimestamp.get());
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Query11::flush(Context11 *context11, bool force)
+{
+ while (!mPendingQueries.empty())
+ {
+ QueryState *query = mPendingQueries.front().get();
+
+ do
+ {
+ ANGLE_TRY(testQuery(context11, query));
+ if (!query->finished && !force)
+ {
+ return angle::Result::Continue;
+ }
+ } while (!query->finished);
+
+ mResultSum = MergeQueryResults(getType(), mResultSum, mResult);
+ mPendingQueries.pop_front();
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Query11::testQuery(Context11 *context11, QueryState *queryState)
+{
+ if (!queryState->finished)
+ {
+ ID3D11DeviceContext *context = mRenderer->getDeviceContext();
+ switch (getType())
+ {
+ case gl::QueryType::AnySamples:
+ case gl::QueryType::AnySamplesConservative:
+ {
+ ASSERT(queryState->query.valid());
+ UINT64 numPixels = 0;
+ HRESULT result =
+ context->GetData(queryState->query.get(), &numPixels, sizeof(numPixels), 0);
+ ANGLE_TRY_HR(context11, result, "Failed to get the data of an internal query");
+
+ if (result == S_OK)
+ {
+ queryState->finished = true;
+ mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
+ }
+ }
+ break;
+
+ case gl::QueryType::TransformFeedbackPrimitivesWritten:
+ {
+ ASSERT(queryState->query.valid());
+ D3D11_QUERY_DATA_SO_STATISTICS soStats = {0};
+ HRESULT result =
+ context->GetData(queryState->query.get(), &soStats, sizeof(soStats), 0);
+ ANGLE_TRY_HR(context11, result, "Failed to get the data of an internal query");
+
+ if (result == S_OK)
+ {
+ queryState->finished = true;
+ mResult = static_cast<GLuint64>(soStats.NumPrimitivesWritten);
+ }
+ }
+ break;
+
+ case gl::QueryType::TimeElapsed:
+ {
+ ASSERT(queryState->query.valid());
+ ASSERT(queryState->beginTimestamp.valid());
+ ASSERT(queryState->endTimestamp.valid());
+ D3D11_QUERY_DATA_TIMESTAMP_DISJOINT timeStats = {0};
+ HRESULT result =
+ context->GetData(queryState->query.get(), &timeStats, sizeof(timeStats), 0);
+ ANGLE_TRY_HR(context11, result, "Failed to get the data of an internal query");
+
+ if (result == S_OK)
+ {
+ UINT64 beginTime = 0;
+ HRESULT beginRes = context->GetData(queryState->beginTimestamp.get(),
+ &beginTime, sizeof(UINT64), 0);
+ ANGLE_TRY_HR(context11, beginRes,
+ "Failed to get the data of an internal query");
+
+ UINT64 endTime = 0;
+ HRESULT endRes = context->GetData(queryState->endTimestamp.get(), &endTime,
+ sizeof(UINT64), 0);
+ ANGLE_TRY_HR(context11, endRes, "Failed to get the data of an internal query");
+
+ if (beginRes == S_OK && endRes == S_OK)
+ {
+ queryState->finished = true;
+ if (timeStats.Disjoint)
+ {
+ mRenderer->setGPUDisjoint();
+ }
+ static_assert(sizeof(UINT64) == sizeof(unsigned long long),
+ "D3D UINT64 isn't 64 bits");
+
+ angle::CheckedNumeric<UINT64> checkedTime(endTime);
+ checkedTime -= beginTime;
+ checkedTime *= 1000000000ull;
+ checkedTime /= timeStats.Frequency;
+ if (checkedTime.IsValid())
+ {
+ mResult = checkedTime.ValueOrDie();
+ }
+ else
+ {
+ mResult = std::numeric_limits<GLuint64>::max() / timeStats.Frequency;
+ // If an overflow does somehow occur, there is no way the elapsed time
+ // is accurate, so we generate a disjoint event
+ mRenderer->setGPUDisjoint();
+ }
+ }
+ }
+ }
+ break;
+
+ case gl::QueryType::Timestamp:
+ {
+ // D3D11 doesn't support GL timestamp queries as D3D timestamps are not guaranteed
+ // to have any sort of continuity outside of a disjoint timestamp query block, which
+ // GL depends on
+ ASSERT(!queryState->query.valid());
+ mResult = 0;
+ queryState->finished = true;
+ }
+ break;
+
+ case gl::QueryType::CommandsCompleted:
+ {
+ ASSERT(queryState->query.valid());
+ BOOL completed = 0;
+ HRESULT result =
+ context->GetData(queryState->query.get(), &completed, sizeof(completed), 0);
+ ANGLE_TRY_HR(context11, result, "Failed to get the data of an internal query");
+
+ if (result == S_OK)
+ {
+ queryState->finished = true;
+ ASSERT(completed == TRUE);
+ mResult = (completed == TRUE) ? GL_TRUE : GL_FALSE;
+ }
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ queryState->getDataAttemptCount++;
+ bool checkDeviceLost =
+ (queryState->getDataAttemptCount % kPollingD3DDeviceLostCheckFrequency) == 0;
+ if (!queryState->finished && checkDeviceLost && mRenderer->testDeviceLost())
+ {
+ mRenderer->notifyDeviceLost();
+ ANGLE_TRY_HR(context11, E_OUTOFMEMORY,
+ "Failed to test get query result, device is lost.");
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.h
new file mode 100644
index 0000000000..911be0c77e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Query11.h
@@ -0,0 +1,71 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query11.h: Defines the rx::Query11 class which implements rx::QueryImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_
+
+#include <deque>
+
+#include "libANGLE/renderer/QueryImpl.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+
+namespace rx
+{
+class Context11;
+class Renderer11;
+
+class Query11 : public QueryImpl
+{
+ public:
+ Query11(Renderer11 *renderer, gl::QueryType type);
+ ~Query11() override;
+
+ angle::Result begin(const gl::Context *context) override;
+ angle::Result end(const gl::Context *context) override;
+ angle::Result queryCounter(const gl::Context *context) override;
+ angle::Result getResult(const gl::Context *context, GLint *params) override;
+ angle::Result getResult(const gl::Context *context, GLuint *params) override;
+ angle::Result getResult(const gl::Context *context, GLint64 *params) override;
+ angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
+ angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
+
+ angle::Result pause(Context11 *context11);
+ angle::Result resume(Context11 *context11);
+
+ private:
+ struct QueryState final : private angle::NonCopyable
+ {
+ QueryState();
+ ~QueryState();
+
+ unsigned int getDataAttemptCount;
+
+ d3d11::Query query;
+ d3d11::Query beginTimestamp;
+ d3d11::Query endTimestamp;
+ bool finished;
+ };
+
+ angle::Result flush(Context11 *context11, bool force);
+ angle::Result testQuery(Context11 *context11, QueryState *queryState);
+
+ template <typename T>
+ angle::Result getResultBase(Context11 *context11, T *params);
+
+ GLuint64 mResult;
+ GLuint64 mResultSum;
+
+ Renderer11 *mRenderer;
+
+ std::unique_ptr<QueryState> mActiveQuery;
+ std::deque<std::unique_ptr<QueryState>> mPendingQueries;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
new file mode 100644
index 0000000000..f086930940
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
@@ -0,0 +1,284 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderStateCache.cpp: Defines rx::RenderStateCache, a cache of Direct3D render
+// state objects.
+
+#include "libANGLE/renderer/d3d/d3d11/RenderStateCache.h"
+
+#include <float.h>
+
+#include "common/Color.h"
+#include "common/debug.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+using namespace gl_d3d11;
+
+RenderStateCache::RenderStateCache()
+ : mBlendStateCache(kMaxStates),
+ mRasterizerStateCache(kMaxStates),
+ mDepthStencilStateCache(kMaxStates),
+ mSamplerStateCache(kMaxStates)
+{}
+
+RenderStateCache::~RenderStateCache() {}
+
+void RenderStateCache::clear()
+{
+ mBlendStateCache.Clear();
+ mRasterizerStateCache.Clear();
+ mDepthStencilStateCache.Clear();
+ mSamplerStateCache.Clear();
+}
+
+// static
+d3d11::BlendStateKey RenderStateCache::GetBlendStateKey(const gl::Context *context,
+ Framebuffer11 *framebuffer11,
+ const gl::BlendState &blendState)
+{
+ d3d11::BlendStateKey key;
+ const gl::AttachmentList &colorbuffers = framebuffer11->getColorAttachmentsForRender(context);
+ const UINT8 blendStateMask =
+ gl_d3d11::ConvertColorMask(blendState.colorMaskRed, blendState.colorMaskGreen,
+ blendState.colorMaskBlue, blendState.colorMaskAlpha);
+
+ key.blendState = blendState;
+
+ for (size_t i = 0; i < colorbuffers.size(); i++)
+ {
+ const gl::FramebufferAttachment *attachment = colorbuffers[i];
+
+ if (attachment)
+ {
+ key.rtvMax = static_cast<uint32_t>(i) + 1;
+ key.rtvMasks[i] =
+ (gl_d3d11::GetColorMask(*attachment->getFormat().info)) & blendStateMask;
+ }
+ }
+
+ return key;
+}
+
+angle::Result RenderStateCache::getBlendState(const gl::Context *context,
+ Renderer11 *renderer,
+ const d3d11::BlendStateKey &key,
+ const d3d11::BlendState **outBlendState)
+{
+ auto keyIter = mBlendStateCache.Get(key);
+ if (keyIter != mBlendStateCache.end())
+ {
+ *outBlendState = &keyIter->second;
+ return angle::Result::Continue;
+ }
+
+ TrimCache(kMaxStates, kGCLimit, "blend state", &mBlendStateCache);
+
+ // Create a new blend state and insert it into the cache
+ D3D11_BLEND_DESC blendDesc;
+ D3D11_RENDER_TARGET_BLEND_DESC &rtDesc0 = blendDesc.RenderTarget[0];
+ const gl::BlendState &blendState = key.blendState;
+
+ blendDesc.AlphaToCoverageEnable = blendState.sampleAlphaToCoverage;
+ blendDesc.IndependentBlendEnable = key.rtvMax > 1 ? TRUE : FALSE;
+
+ rtDesc0 = {};
+
+ if (blendState.blend)
+ {
+ rtDesc0.BlendEnable = true;
+ rtDesc0.SrcBlend = gl_d3d11::ConvertBlendFunc(blendState.sourceBlendRGB, false);
+ rtDesc0.DestBlend = gl_d3d11::ConvertBlendFunc(blendState.destBlendRGB, false);
+ rtDesc0.BlendOp = gl_d3d11::ConvertBlendOp(blendState.blendEquationRGB);
+ rtDesc0.SrcBlendAlpha = gl_d3d11::ConvertBlendFunc(blendState.sourceBlendAlpha, true);
+ rtDesc0.DestBlendAlpha = gl_d3d11::ConvertBlendFunc(blendState.destBlendAlpha, true);
+ rtDesc0.BlendOpAlpha = gl_d3d11::ConvertBlendOp(blendState.blendEquationAlpha);
+ }
+
+ rtDesc0.RenderTargetWriteMask = key.rtvMasks[0];
+
+ for (unsigned int i = 1; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+ {
+ blendDesc.RenderTarget[i] = rtDesc0;
+ blendDesc.RenderTarget[i].RenderTargetWriteMask = key.rtvMasks[i];
+ }
+
+ d3d11::BlendState d3dBlendState;
+ ANGLE_TRY(renderer->allocateResource(GetImplAs<Context11>(context), blendDesc, &d3dBlendState));
+ const auto &iter = mBlendStateCache.Put(key, std::move(d3dBlendState));
+
+ *outBlendState = &iter->second;
+
+ return angle::Result::Continue;
+}
+
+angle::Result RenderStateCache::getRasterizerState(const gl::Context *context,
+ Renderer11 *renderer,
+ const gl::RasterizerState &rasterState,
+ bool scissorEnabled,
+ ID3D11RasterizerState **outRasterizerState)
+{
+ d3d11::RasterizerStateKey key;
+ key.rasterizerState = rasterState;
+ key.scissorEnabled = scissorEnabled ? 1 : 0;
+
+ auto keyIter = mRasterizerStateCache.Get(key);
+ if (keyIter != mRasterizerStateCache.end())
+ {
+ *outRasterizerState = keyIter->second.get();
+ return angle::Result::Continue;
+ }
+
+ TrimCache(kMaxStates, kGCLimit, "rasterizer state", &mRasterizerStateCache);
+
+ D3D11_CULL_MODE cullMode =
+ gl_d3d11::ConvertCullMode(rasterState.cullFace, rasterState.cullMode);
+
+ // Disable culling if drawing points
+ if (rasterState.pointDrawMode)
+ {
+ cullMode = D3D11_CULL_NONE;
+ }
+
+ D3D11_RASTERIZER_DESC rasterDesc;
+ rasterDesc.FillMode = D3D11_FILL_SOLID;
+ rasterDesc.CullMode = cullMode;
+ rasterDesc.FrontCounterClockwise = (rasterState.frontFace == GL_CCW) ? FALSE : TRUE;
+ rasterDesc.DepthBiasClamp = 0.0f; // MSDN documentation of DepthBiasClamp implies a value of
+ // zero will preform no clamping, must be tested though.
+ rasterDesc.DepthClipEnable = TRUE;
+ rasterDesc.ScissorEnable = scissorEnabled ? TRUE : FALSE;
+ rasterDesc.MultisampleEnable = rasterState.multiSample;
+ rasterDesc.AntialiasedLineEnable = FALSE;
+
+ if (rasterState.polygonOffsetFill)
+ {
+ rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor;
+ rasterDesc.DepthBias = (INT)rasterState.polygonOffsetUnits;
+ }
+ else
+ {
+ rasterDesc.SlopeScaledDepthBias = 0.0f;
+ rasterDesc.DepthBias = 0;
+ }
+
+ d3d11::RasterizerState dx11RasterizerState;
+ ANGLE_TRY(renderer->allocateResource(GetImplAs<Context11>(context), rasterDesc,
+ &dx11RasterizerState));
+ *outRasterizerState = dx11RasterizerState.get();
+ mRasterizerStateCache.Put(key, std::move(dx11RasterizerState));
+
+ return angle::Result::Continue;
+}
+
+angle::Result RenderStateCache::getDepthStencilState(const gl::Context *context,
+ Renderer11 *renderer,
+ const gl::DepthStencilState &glState,
+ const d3d11::DepthStencilState **outDSState)
+{
+ auto keyIter = mDepthStencilStateCache.Get(glState);
+ if (keyIter != mDepthStencilStateCache.end())
+ {
+ *outDSState = &keyIter->second;
+ return angle::Result::Continue;
+ }
+
+ TrimCache(kMaxStates, kGCLimit, "depth stencil state", &mDepthStencilStateCache);
+
+ D3D11_DEPTH_STENCIL_DESC dsDesc = {0};
+ dsDesc.DepthEnable = glState.depthTest ? TRUE : FALSE;
+ dsDesc.DepthWriteMask = ConvertDepthMask(glState.depthMask);
+ dsDesc.DepthFunc = ConvertComparison(glState.depthFunc);
+ dsDesc.StencilEnable = glState.stencilTest ? TRUE : FALSE;
+ dsDesc.StencilReadMask = ConvertStencilMask(glState.stencilMask);
+ dsDesc.StencilWriteMask = ConvertStencilMask(glState.stencilWritemask);
+ dsDesc.FrontFace.StencilFailOp = ConvertStencilOp(glState.stencilFail);
+ dsDesc.FrontFace.StencilDepthFailOp = ConvertStencilOp(glState.stencilPassDepthFail);
+ dsDesc.FrontFace.StencilPassOp = ConvertStencilOp(glState.stencilPassDepthPass);
+ dsDesc.FrontFace.StencilFunc = ConvertComparison(glState.stencilFunc);
+ dsDesc.BackFace.StencilFailOp = ConvertStencilOp(glState.stencilBackFail);
+ dsDesc.BackFace.StencilDepthFailOp = ConvertStencilOp(glState.stencilBackPassDepthFail);
+ dsDesc.BackFace.StencilPassOp = ConvertStencilOp(glState.stencilBackPassDepthPass);
+ dsDesc.BackFace.StencilFunc = ConvertComparison(glState.stencilBackFunc);
+
+ d3d11::DepthStencilState dx11DepthStencilState;
+ ANGLE_TRY(
+ renderer->allocateResource(GetImplAs<Context11>(context), dsDesc, &dx11DepthStencilState));
+ const auto &iter = mDepthStencilStateCache.Put(glState, std::move(dx11DepthStencilState));
+
+ *outDSState = &iter->second;
+
+ return angle::Result::Continue;
+}
+
+angle::Result RenderStateCache::getSamplerState(const gl::Context *context,
+ Renderer11 *renderer,
+ const gl::SamplerState &samplerState,
+ ID3D11SamplerState **outSamplerState)
+{
+ auto keyIter = mSamplerStateCache.Get(samplerState);
+ if (keyIter != mSamplerStateCache.end())
+ {
+ *outSamplerState = keyIter->second.get();
+ return angle::Result::Continue;
+ }
+
+ TrimCache(kMaxStates, kGCLimit, "sampler state", &mSamplerStateCache);
+
+ const auto &featureLevel = renderer->getRenderer11DeviceCaps().featureLevel;
+
+ D3D11_SAMPLER_DESC samplerDesc;
+ samplerDesc.Filter =
+ gl_d3d11::ConvertFilter(samplerState.getMinFilter(), samplerState.getMagFilter(),
+ samplerState.getMaxAnisotropy(), samplerState.getCompareMode());
+ samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.getWrapS());
+ samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.getWrapT());
+ samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.getWrapR());
+ samplerDesc.MipLODBias = 0;
+ samplerDesc.MaxAnisotropy =
+ gl_d3d11::ConvertMaxAnisotropy(samplerState.getMaxAnisotropy(), featureLevel);
+ samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.getCompareFunc());
+ angle::ColorF borderColor;
+ if (samplerState.getBorderColor().type == angle::ColorGeneric::Type::Float)
+ {
+ borderColor = samplerState.getBorderColor().colorF;
+ }
+ samplerDesc.BorderColor[0] = borderColor.red;
+ samplerDesc.BorderColor[1] = borderColor.green;
+ samplerDesc.BorderColor[2] = borderColor.blue;
+ samplerDesc.BorderColor[3] = borderColor.alpha;
+ samplerDesc.MinLOD = samplerState.getMinLod();
+ samplerDesc.MaxLOD = samplerState.getMaxLod();
+
+ if (featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ // Check that maxLOD is nearly FLT_MAX (1000.0f is the default), since 9_3 doesn't support
+ // anything other than FLT_MAX. Note that Feature Level 9_* only supports GL ES 2.0, so the
+ // consumer of ANGLE can't modify the Max LOD themselves.
+ ASSERT(samplerState.getMaxLod() >= 999.9f);
+
+ // Now just set MaxLOD to FLT_MAX. Other parts of the renderer (e.g. the non-zero max LOD
+ // workaround) should take account of this.
+ samplerDesc.MaxLOD = FLT_MAX;
+ }
+
+ d3d11::SamplerState dx11SamplerState;
+ ANGLE_TRY(
+ renderer->allocateResource(GetImplAs<Context11>(context), samplerDesc, &dx11SamplerState));
+ *outSamplerState = dx11SamplerState.get();
+ mSamplerStateCache.Put(samplerState, std::move(dx11SamplerState));
+
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h
new file mode 100644
index 0000000000..8db74d66b3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h
@@ -0,0 +1,123 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderStateCache.h: Defines rx::RenderStateCache, a cache of Direct3D render
+// state objects.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERSTATECACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERSTATECACHE_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/SizedMRUCache.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#include <unordered_map>
+
+namespace std
+{
+template <>
+struct hash<rx::d3d11::BlendStateKey>
+{
+ size_t operator()(const rx::d3d11::BlendStateKey &key) const
+ {
+ return angle::ComputeGenericHash(key);
+ }
+};
+
+template <>
+struct hash<rx::d3d11::RasterizerStateKey>
+{
+ size_t operator()(const rx::d3d11::RasterizerStateKey &key) const
+ {
+ return angle::ComputeGenericHash(key);
+ }
+};
+
+template <>
+struct hash<gl::DepthStencilState>
+{
+ size_t operator()(const gl::DepthStencilState &key) const
+ {
+ return angle::ComputeGenericHash(key);
+ }
+};
+
+template <>
+struct hash<gl::SamplerState>
+{
+ size_t operator()(const gl::SamplerState &key) const { return angle::ComputeGenericHash(key); }
+};
+} // namespace std
+
+namespace rx
+{
+class Framebuffer11;
+class Renderer11;
+
+class RenderStateCache : angle::NonCopyable
+{
+ public:
+ RenderStateCache();
+ virtual ~RenderStateCache();
+
+ void clear();
+
+ static d3d11::BlendStateKey GetBlendStateKey(const gl::Context *context,
+ Framebuffer11 *framebuffer11,
+ const gl::BlendState &blendState);
+ angle::Result getBlendState(const gl::Context *context,
+ Renderer11 *renderer,
+ const d3d11::BlendStateKey &key,
+ const d3d11::BlendState **outBlendState);
+ angle::Result getRasterizerState(const gl::Context *context,
+ Renderer11 *renderer,
+ const gl::RasterizerState &rasterState,
+ bool scissorEnabled,
+ ID3D11RasterizerState **outRasterizerState);
+ angle::Result getDepthStencilState(const gl::Context *context,
+ Renderer11 *renderer,
+ const gl::DepthStencilState &dsState,
+ const d3d11::DepthStencilState **outDSState);
+ angle::Result getSamplerState(const gl::Context *context,
+ Renderer11 *renderer,
+ const gl::SamplerState &samplerState,
+ ID3D11SamplerState **outSamplerState);
+
+ private:
+ // MSDN's documentation of ID3D11Device::CreateBlendState, ID3D11Device::CreateRasterizerState,
+ // ID3D11Device::CreateDepthStencilState and ID3D11Device::CreateSamplerState claims the maximum
+ // number of unique states of each type an application can create is 4096
+ // TODO(ShahmeerEsmail): Revisit the cache sizes to make sure they are appropriate for most
+ // scenarios.
+ static constexpr unsigned int kMaxStates = 4096;
+
+ // The cache tries to clean up this many states at once.
+ static constexpr unsigned int kGCLimit = 128;
+
+ // Blend state cache
+ using BlendStateMap = angle::base::HashingMRUCache<d3d11::BlendStateKey, d3d11::BlendState>;
+ BlendStateMap mBlendStateCache;
+
+ // Rasterizer state cache
+ using RasterizerStateMap =
+ angle::base::HashingMRUCache<d3d11::RasterizerStateKey, d3d11::RasterizerState>;
+ RasterizerStateMap mRasterizerStateCache;
+
+ // Depth stencil state cache
+ using DepthStencilStateMap =
+ angle::base::HashingMRUCache<gl::DepthStencilState, d3d11::DepthStencilState>;
+ DepthStencilStateMap mDepthStencilStateCache;
+
+ // Sample state cache
+ using SamplerStateMap = angle::base::HashingMRUCache<gl::SamplerState, d3d11::SamplerState>;
+ SamplerStateMap mSamplerStateCache;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERSTATECACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp
new file mode 100644
index 0000000000..be204f857d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp
@@ -0,0 +1,394 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
+// retained by Renderbuffers.
+
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/SwapChain11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+namespace rx
+{
+
+namespace
+{
+bool GetTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, unsigned int *samples)
+{
+ 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;
+}
+
+unsigned int GetRTVSubresourceIndex(ID3D11Resource *resource, ID3D11RenderTargetView *view)
+{
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ view->GetDesc(&rtvDesc);
+
+ unsigned int mipSlice = 0;
+ unsigned int arraySlice = 0;
+
+ switch (rtvDesc.ViewDimension)
+ {
+ case D3D11_RTV_DIMENSION_TEXTURE1D:
+ mipSlice = rtvDesc.Texture1D.MipSlice;
+ arraySlice = 0;
+ break;
+
+ case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
+ mipSlice = rtvDesc.Texture1DArray.MipSlice;
+ arraySlice = rtvDesc.Texture1DArray.FirstArraySlice;
+ break;
+
+ case D3D11_RTV_DIMENSION_TEXTURE2D:
+ mipSlice = rtvDesc.Texture2D.MipSlice;
+ arraySlice = 0;
+ break;
+
+ case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
+ mipSlice = rtvDesc.Texture2DArray.MipSlice;
+ arraySlice = rtvDesc.Texture2DArray.FirstArraySlice;
+ break;
+
+ case D3D11_RTV_DIMENSION_TEXTURE2DMS:
+ mipSlice = 0;
+ arraySlice = 0;
+ break;
+
+ case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
+ mipSlice = 0;
+ arraySlice = rtvDesc.Texture2DMSArray.FirstArraySlice;
+ break;
+
+ case D3D11_RTV_DIMENSION_TEXTURE3D:
+ mipSlice = rtvDesc.Texture3D.MipSlice;
+ arraySlice = 0;
+ break;
+
+ case D3D11_RTV_DIMENSION_UNKNOWN:
+ case D3D11_RTV_DIMENSION_BUFFER:
+ UNIMPLEMENTED();
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ unsigned int mipLevels, samples;
+ GetTextureProperties(resource, &mipLevels, &samples);
+
+ return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
+}
+
+unsigned int GetDSVSubresourceIndex(ID3D11Resource *resource, ID3D11DepthStencilView *view)
+{
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ view->GetDesc(&dsvDesc);
+
+ unsigned int mipSlice = 0;
+ unsigned int arraySlice = 0;
+
+ switch (dsvDesc.ViewDimension)
+ {
+ case D3D11_DSV_DIMENSION_TEXTURE1D:
+ mipSlice = dsvDesc.Texture1D.MipSlice;
+ arraySlice = 0;
+ break;
+
+ case D3D11_DSV_DIMENSION_TEXTURE1DARRAY:
+ mipSlice = dsvDesc.Texture1DArray.MipSlice;
+ arraySlice = dsvDesc.Texture1DArray.FirstArraySlice;
+ break;
+
+ case D3D11_DSV_DIMENSION_TEXTURE2D:
+ mipSlice = dsvDesc.Texture2D.MipSlice;
+ arraySlice = 0;
+ break;
+
+ case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
+ mipSlice = dsvDesc.Texture2DArray.MipSlice;
+ arraySlice = dsvDesc.Texture2DArray.FirstArraySlice;
+ break;
+
+ case D3D11_DSV_DIMENSION_TEXTURE2DMS:
+ mipSlice = 0;
+ arraySlice = 0;
+ break;
+
+ case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
+ mipSlice = 0;
+ arraySlice = dsvDesc.Texture2DMSArray.FirstArraySlice;
+ break;
+
+ case D3D11_DSV_DIMENSION_UNKNOWN:
+ UNIMPLEMENTED();
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ unsigned int mipLevels, samples;
+ GetTextureProperties(resource, &mipLevels, &samples);
+
+ return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
+}
+
+GLenum GetSurfaceRTFormat(bool depth, SwapChain11 *swapChain)
+{
+ return (depth ? swapChain->getDepthBufferInternalFormat()
+ : swapChain->getRenderTargetInternalFormat());
+}
+
+const d3d11::Format &GetSurfaceFormatSet(bool depth, SwapChain11 *swapChain, Renderer11 *renderer)
+{
+ return d3d11::Format::Get(GetSurfaceRTFormat(depth, swapChain),
+ renderer->getRenderer11DeviceCaps());
+}
+
+} // anonymous namespace
+
+RenderTarget11::RenderTarget11(const d3d11::Format &formatSet) : mFormatSet(formatSet) {}
+
+RenderTarget11::~RenderTarget11() {}
+
+TextureRenderTarget11::TextureRenderTarget11(d3d11::RenderTargetView &&rtv,
+ const TextureHelper11 &resource,
+ const d3d11::SharedSRV &srv,
+ const d3d11::SharedSRV &blitSRV,
+ GLenum internalFormat,
+ const d3d11::Format &formatSet,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei samples)
+ : RenderTarget11(formatSet),
+ mWidth(width),
+ mHeight(height),
+ mDepth(depth),
+ mInternalFormat(internalFormat),
+ mSamples(samples),
+ mSubresourceIndex(0),
+ mTexture(resource),
+ mRenderTarget(std::move(rtv)),
+ mDepthStencil(),
+ mShaderResource(srv.makeCopy()),
+ mBlitShaderResource(blitSRV.makeCopy())
+{
+ if (mRenderTarget.valid() && mTexture.valid())
+ {
+ mSubresourceIndex = GetRTVSubresourceIndex(mTexture.get(), mRenderTarget.get());
+ }
+ ASSERT(mFormatSet.formatID != angle::FormatID::NONE || mWidth == 0 || mHeight == 0);
+}
+
+TextureRenderTarget11::TextureRenderTarget11(d3d11::DepthStencilView &&dsv,
+ const TextureHelper11 &resource,
+ const d3d11::SharedSRV &srv,
+ GLenum internalFormat,
+ const d3d11::Format &formatSet,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei samples)
+ : RenderTarget11(formatSet),
+ mWidth(width),
+ mHeight(height),
+ mDepth(depth),
+ mInternalFormat(internalFormat),
+ mSamples(samples),
+ mSubresourceIndex(0),
+ mTexture(resource),
+ mRenderTarget(),
+ mDepthStencil(std::move(dsv)),
+ mShaderResource(srv.makeCopy()),
+ mBlitShaderResource()
+{
+ if (mDepthStencil.valid() && mTexture.valid())
+ {
+ mSubresourceIndex = GetDSVSubresourceIndex(mTexture.get(), mDepthStencil.get());
+ }
+ ASSERT(mFormatSet.formatID != angle::FormatID::NONE || mWidth == 0 || mHeight == 0);
+}
+
+TextureRenderTarget11::~TextureRenderTarget11() {}
+
+const TextureHelper11 &TextureRenderTarget11::getTexture() const
+{
+ return mTexture;
+}
+
+const d3d11::RenderTargetView &TextureRenderTarget11::getRenderTargetView() const
+{
+ return mRenderTarget;
+}
+
+const d3d11::DepthStencilView &TextureRenderTarget11::getDepthStencilView() const
+{
+ return mDepthStencil;
+}
+
+const d3d11::SharedSRV &TextureRenderTarget11::getShaderResourceView(
+ const gl::Context *context) const
+{
+ return mShaderResource;
+}
+
+const d3d11::SharedSRV &TextureRenderTarget11::getBlitShaderResourceView(
+ const gl::Context *context) const
+{
+ return mBlitShaderResource;
+}
+
+GLsizei TextureRenderTarget11::getWidth() const
+{
+ return mWidth;
+}
+
+GLsizei TextureRenderTarget11::getHeight() const
+{
+ return mHeight;
+}
+
+GLsizei TextureRenderTarget11::getDepth() const
+{
+ return mDepth;
+}
+
+GLenum TextureRenderTarget11::getInternalFormat() const
+{
+ return mInternalFormat;
+}
+
+GLsizei TextureRenderTarget11::getSamples() const
+{
+ return mSamples;
+}
+
+unsigned int TextureRenderTarget11::getSubresourceIndex() const
+{
+ return mSubresourceIndex;
+}
+
+SurfaceRenderTarget11::SurfaceRenderTarget11(SwapChain11 *swapChain,
+ Renderer11 *renderer,
+ bool depth)
+ : RenderTarget11(GetSurfaceFormatSet(depth, swapChain, renderer)),
+ mSwapChain(swapChain),
+ mDepth(depth)
+{
+ ASSERT(mSwapChain);
+}
+
+SurfaceRenderTarget11::~SurfaceRenderTarget11() {}
+
+GLsizei SurfaceRenderTarget11::getWidth() const
+{
+ return mSwapChain->getWidth();
+}
+
+GLsizei SurfaceRenderTarget11::getHeight() const
+{
+ return mSwapChain->getHeight();
+}
+
+GLsizei SurfaceRenderTarget11::getDepth() const
+{
+ return 1;
+}
+
+GLenum SurfaceRenderTarget11::getInternalFormat() const
+{
+ return GetSurfaceRTFormat(mDepth, mSwapChain);
+}
+
+GLsizei SurfaceRenderTarget11::getSamples() const
+{
+ return mSwapChain->getSamples();
+}
+
+const TextureHelper11 &SurfaceRenderTarget11::getTexture() const
+{
+ return (mDepth ? mSwapChain->getDepthStencilTexture() : mSwapChain->getOffscreenTexture());
+}
+
+const d3d11::RenderTargetView &SurfaceRenderTarget11::getRenderTargetView() const
+{
+ ASSERT(!mDepth);
+ return mSwapChain->getRenderTarget();
+}
+
+const d3d11::DepthStencilView &SurfaceRenderTarget11::getDepthStencilView() const
+{
+ ASSERT(mDepth);
+ return mSwapChain->getDepthStencil();
+}
+
+const d3d11::SharedSRV &SurfaceRenderTarget11::getShaderResourceView(
+ const gl::Context *context) const
+{
+ return (mDepth ? mSwapChain->getDepthStencilShaderResource()
+ : mSwapChain->getRenderTargetShaderResource(GetImplAs<Context11>(context)));
+}
+
+const d3d11::SharedSRV &SurfaceRenderTarget11::getBlitShaderResourceView(
+ const gl::Context *context) const
+{
+ // The SurfaceRenderTargetView format should always be such that the normal SRV works for blits.
+ return getShaderResourceView(context);
+}
+
+unsigned int SurfaceRenderTarget11::getSubresourceIndex() const
+{
+ return 0;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h
new file mode 100644
index 0000000000..a492411fb0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h
@@ -0,0 +1,127 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTarget11.h: Defines a DX11-specific wrapper for ID3D11View pointers
+// retained by Renderbuffers.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERTARGET11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERTARGET11_H_
+
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+namespace rx
+{
+class SwapChain11;
+class Renderer11;
+
+class RenderTarget11 : public RenderTargetD3D
+{
+ public:
+ RenderTarget11(const d3d11::Format &formatSet);
+ ~RenderTarget11() override;
+
+ virtual const TextureHelper11 &getTexture() const = 0;
+ virtual const d3d11::RenderTargetView &getRenderTargetView() const = 0;
+ virtual const d3d11::DepthStencilView &getDepthStencilView() const = 0;
+ virtual const d3d11::SharedSRV &getShaderResourceView(const gl::Context *context) const = 0;
+ virtual const d3d11::SharedSRV &getBlitShaderResourceView(const gl::Context *context) const = 0;
+
+ virtual unsigned int getSubresourceIndex() const = 0;
+
+ const d3d11::Format &getFormatSet() const { return mFormatSet; }
+
+ protected:
+ const d3d11::Format &mFormatSet;
+};
+
+class TextureRenderTarget11 : public RenderTarget11
+{
+ public:
+ // TextureRenderTarget11 takes ownership of any D3D11 resources it is given and will AddRef them
+ TextureRenderTarget11(d3d11::RenderTargetView &&rtv,
+ const TextureHelper11 &resource,
+ const d3d11::SharedSRV &srv,
+ const d3d11::SharedSRV &blitSRV,
+ GLenum internalFormat,
+ const d3d11::Format &formatSet,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei samples);
+ TextureRenderTarget11(d3d11::DepthStencilView &&dsv,
+ const TextureHelper11 &resource,
+ const d3d11::SharedSRV &srv,
+ GLenum internalFormat,
+ const d3d11::Format &formatSet,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei samples);
+ ~TextureRenderTarget11() override;
+
+ GLsizei getWidth() const override;
+ GLsizei getHeight() const override;
+ GLsizei getDepth() const override;
+ GLenum getInternalFormat() const override;
+ GLsizei getSamples() const override;
+
+ const TextureHelper11 &getTexture() const override;
+ const d3d11::RenderTargetView &getRenderTargetView() const override;
+ const d3d11::DepthStencilView &getDepthStencilView() const override;
+ const d3d11::SharedSRV &getShaderResourceView(const gl::Context *context) const override;
+ const d3d11::SharedSRV &getBlitShaderResourceView(const gl::Context *context) const override;
+
+ unsigned int getSubresourceIndex() const override;
+
+ private:
+ GLsizei mWidth;
+ GLsizei mHeight;
+ GLsizei mDepth;
+ GLenum mInternalFormat;
+ GLsizei mSamples;
+
+ unsigned int mSubresourceIndex;
+ TextureHelper11 mTexture;
+ d3d11::RenderTargetView mRenderTarget;
+ d3d11::DepthStencilView mDepthStencil;
+ d3d11::SharedSRV mShaderResource;
+
+ // Shader resource view to use with internal blit shaders. Not set for depth/stencil render
+ // targets.
+ d3d11::SharedSRV mBlitShaderResource;
+};
+
+class SurfaceRenderTarget11 : public RenderTarget11
+{
+ public:
+ SurfaceRenderTarget11(SwapChain11 *swapChain, Renderer11 *renderer, bool depth);
+ ~SurfaceRenderTarget11() override;
+
+ GLsizei getWidth() const override;
+ GLsizei getHeight() const override;
+ GLsizei getDepth() const override;
+ GLenum getInternalFormat() const override;
+ GLsizei getSamples() const override;
+
+ const TextureHelper11 &getTexture() const override;
+ const d3d11::RenderTargetView &getRenderTargetView() const override;
+ const d3d11::DepthStencilView &getDepthStencilView() const override;
+ const d3d11::SharedSRV &getShaderResourceView(const gl::Context *context) const override;
+ const d3d11::SharedSRV &getBlitShaderResourceView(const gl::Context *context) const override;
+
+ unsigned int getSubresourceIndex() const override;
+
+ private:
+ SwapChain11 *mSwapChain;
+ bool mDepth;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERTARGET11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
new file mode 100644
index 0000000000..1af0aff1be
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -0,0 +1,3987 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderer11.cpp: Implements a back-end specific class for the D3D11 renderer.
+
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+
+#include <EGL/eglext.h>
+#include <versionhelpers.h>
+#include <sstream>
+
+#include "common/tls.h"
+#include "common/utilities.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/State.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/histogram_macros.h"
+#include "libANGLE/renderer/d3d/CompilerD3D.h"
+#include "libANGLE/renderer/d3d/DeviceD3D.h"
+#include "libANGLE/renderer/d3d/DisplayD3D.h"
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+#include "libANGLE/renderer/d3d/IndexDataManager.h"
+#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+#include "libANGLE/renderer/d3d/SurfaceD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/VertexDataManager.h"
+#include "libANGLE/renderer/d3d/d3d11/Blit11.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Clear11.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.h"
+#include "libANGLE/renderer/d3d/d3d11/Fence11.h"
+#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Image11.h"
+#include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/PixelTransfer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Program11.h"
+#include "libANGLE/renderer/d3d/d3d11/Query11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h"
+#include "libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.h"
+#include "libANGLE/renderer/d3d/d3d11/SwapChain11.h"
+#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
+#include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h"
+#include "libANGLE/renderer/d3d/d3d11/Trim11.h"
+#include "libANGLE/renderer/d3d/d3d11/VertexArray11.h"
+#include "libANGLE/renderer/d3d/d3d11/VertexBuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+#include "libANGLE/renderer/renderer_utils.h"
+#include "libANGLE/trace.h"
+
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+# include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h"
+#else
+# include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h"
+# include "libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h"
+#endif
+
+// Enable ANGLE_SKIP_DXGI_1_2_CHECK if there is not a possibility of using cross-process
+// HWNDs or the Windows 7 Platform Update (KB2670838) is expected to be installed.
+#ifndef ANGLE_SKIP_DXGI_1_2_CHECK
+# define ANGLE_SKIP_DXGI_1_2_CHECK 0
+#endif
+
+namespace rx
+{
+
+namespace
+{
+
+enum
+{
+ MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16
+};
+
+enum ANGLEFeatureLevel
+{
+ ANGLE_FEATURE_LEVEL_INVALID,
+ ANGLE_FEATURE_LEVEL_9_3,
+ ANGLE_FEATURE_LEVEL_10_0,
+ ANGLE_FEATURE_LEVEL_10_1,
+ ANGLE_FEATURE_LEVEL_11_0,
+ ANGLE_FEATURE_LEVEL_11_1,
+ NUM_ANGLE_FEATURE_LEVELS
+};
+
+ANGLEFeatureLevel GetANGLEFeatureLevel(D3D_FEATURE_LEVEL d3dFeatureLevel)
+{
+ switch (d3dFeatureLevel)
+ {
+ case D3D_FEATURE_LEVEL_9_3:
+ return ANGLE_FEATURE_LEVEL_9_3;
+ case D3D_FEATURE_LEVEL_10_0:
+ return ANGLE_FEATURE_LEVEL_10_0;
+ case D3D_FEATURE_LEVEL_10_1:
+ return ANGLE_FEATURE_LEVEL_10_1;
+ case D3D_FEATURE_LEVEL_11_0:
+ return ANGLE_FEATURE_LEVEL_11_0;
+ case D3D_FEATURE_LEVEL_11_1:
+ return ANGLE_FEATURE_LEVEL_11_1;
+ default:
+ return ANGLE_FEATURE_LEVEL_INVALID;
+ }
+}
+
+void SetLineLoopIndices(GLuint *dest, size_t count)
+{
+ for (size_t i = 0; i < count; i++)
+ {
+ dest[i] = static_cast<GLuint>(i);
+ }
+ dest[count] = 0;
+}
+
+template <typename T>
+void CopyLineLoopIndices(const void *indices, GLuint *dest, size_t count)
+{
+ const T *srcPtr = static_cast<const T *>(indices);
+ for (size_t i = 0; i < count; ++i)
+ {
+ dest[i] = static_cast<GLuint>(srcPtr[i]);
+ }
+ dest[count] = static_cast<GLuint>(srcPtr[0]);
+}
+
+void SetTriangleFanIndices(GLuint *destPtr, size_t numTris)
+{
+ for (size_t i = 0; i < numTris; i++)
+ {
+ destPtr[i * 3 + 0] = 0;
+ destPtr[i * 3 + 1] = static_cast<GLuint>(i) + 1;
+ destPtr[i * 3 + 2] = static_cast<GLuint>(i) + 2;
+ }
+}
+
+void GetLineLoopIndices(const void *indices,
+ gl::DrawElementsType indexType,
+ GLuint count,
+ bool usePrimitiveRestartFixedIndex,
+ std::vector<GLuint> *bufferOut)
+{
+ if (indexType != gl::DrawElementsType::InvalidEnum && usePrimitiveRestartFixedIndex)
+ {
+ size_t indexCount = GetLineLoopWithRestartIndexCount(indexType, count,
+ static_cast<const uint8_t *>(indices));
+ bufferOut->resize(indexCount);
+ switch (indexType)
+ {
+ case gl::DrawElementsType::UnsignedByte:
+ CopyLineLoopIndicesWithRestart<GLubyte, GLuint>(
+ count, static_cast<const uint8_t *>(indices),
+ reinterpret_cast<uint8_t *>(bufferOut->data()));
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ CopyLineLoopIndicesWithRestart<GLushort, GLuint>(
+ count, static_cast<const uint8_t *>(indices),
+ reinterpret_cast<uint8_t *>(bufferOut->data()));
+ break;
+ case gl::DrawElementsType::UnsignedInt:
+ CopyLineLoopIndicesWithRestart<GLuint, GLuint>(
+ count, static_cast<const uint8_t *>(indices),
+ reinterpret_cast<uint8_t *>(bufferOut->data()));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ return;
+ }
+
+ // For non-primitive-restart draws, the index count is static.
+ bufferOut->resize(static_cast<size_t>(count) + 1);
+
+ switch (indexType)
+ {
+ // Non-indexed draw
+ case gl::DrawElementsType::InvalidEnum:
+ SetLineLoopIndices(&(*bufferOut)[0], count);
+ break;
+ case gl::DrawElementsType::UnsignedByte:
+ CopyLineLoopIndices<GLubyte>(indices, &(*bufferOut)[0], count);
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ CopyLineLoopIndices<GLushort>(indices, &(*bufferOut)[0], count);
+ break;
+ case gl::DrawElementsType::UnsignedInt:
+ CopyLineLoopIndices<GLuint>(indices, &(*bufferOut)[0], count);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+template <typename T>
+void CopyTriangleFanIndices(const void *indices, GLuint *destPtr, size_t numTris)
+{
+ const T *srcPtr = static_cast<const T *>(indices);
+
+ for (size_t i = 0; i < numTris; i++)
+ {
+ destPtr[i * 3 + 0] = static_cast<GLuint>(srcPtr[0]);
+ destPtr[i * 3 + 1] = static_cast<GLuint>(srcPtr[i + 1]);
+ destPtr[i * 3 + 2] = static_cast<GLuint>(srcPtr[i + 2]);
+ }
+}
+
+template <typename T>
+void CopyTriangleFanIndicesWithRestart(const void *indices,
+ GLuint indexCount,
+ gl::DrawElementsType indexType,
+ std::vector<GLuint> *bufferOut)
+{
+ GLuint restartIndex = gl::GetPrimitiveRestartIndex(indexType);
+ GLuint d3dRestartIndex = gl::GetPrimitiveRestartIndex(gl::DrawElementsType::UnsignedInt);
+ const T *srcPtr = static_cast<const T *>(indices);
+ Optional<GLuint> vertexA;
+ Optional<GLuint> vertexB;
+
+ bufferOut->clear();
+
+ for (size_t indexIdx = 0; indexIdx < indexCount; ++indexIdx)
+ {
+ GLuint value = static_cast<GLuint>(srcPtr[indexIdx]);
+
+ if (value == restartIndex)
+ {
+ bufferOut->push_back(d3dRestartIndex);
+ vertexA.reset();
+ vertexB.reset();
+ }
+ else
+ {
+ if (!vertexA.valid())
+ {
+ vertexA = value;
+ }
+ else if (!vertexB.valid())
+ {
+ vertexB = value;
+ }
+ else
+ {
+ bufferOut->push_back(vertexA.value());
+ bufferOut->push_back(vertexB.value());
+ bufferOut->push_back(value);
+ vertexB = value;
+ }
+ }
+ }
+}
+
+void GetTriFanIndices(const void *indices,
+ gl::DrawElementsType indexType,
+ GLuint count,
+ bool usePrimitiveRestartFixedIndex,
+ std::vector<GLuint> *bufferOut)
+{
+ if (indexType != gl::DrawElementsType::InvalidEnum && usePrimitiveRestartFixedIndex)
+ {
+ switch (indexType)
+ {
+ case gl::DrawElementsType::UnsignedByte:
+ CopyTriangleFanIndicesWithRestart<GLubyte>(indices, count, indexType, bufferOut);
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ CopyTriangleFanIndicesWithRestart<GLushort>(indices, count, indexType, bufferOut);
+ break;
+ case gl::DrawElementsType::UnsignedInt:
+ CopyTriangleFanIndicesWithRestart<GLuint>(indices, count, indexType, bufferOut);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ return;
+ }
+
+ // For non-primitive-restart draws, the index count is static.
+ GLuint numTris = count - 2;
+ bufferOut->resize(numTris * 3);
+
+ switch (indexType)
+ {
+ // Non-indexed draw
+ case gl::DrawElementsType::InvalidEnum:
+ SetTriangleFanIndices(&(*bufferOut)[0], numTris);
+ break;
+ case gl::DrawElementsType::UnsignedByte:
+ CopyTriangleFanIndices<GLubyte>(indices, &(*bufferOut)[0], numTris);
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ CopyTriangleFanIndices<GLushort>(indices, &(*bufferOut)[0], numTris);
+ break;
+ case gl::DrawElementsType::UnsignedInt:
+ CopyTriangleFanIndices<GLuint>(indices, &(*bufferOut)[0], numTris);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+bool IsArrayRTV(ID3D11RenderTargetView *rtv)
+{
+ D3D11_RENDER_TARGET_VIEW_DESC desc;
+ rtv->GetDesc(&desc);
+ if (desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE1DARRAY &&
+ desc.Texture1DArray.ArraySize > 1)
+ return true;
+ if (desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DARRAY &&
+ desc.Texture2DArray.ArraySize > 1)
+ return true;
+ if (desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY &&
+ desc.Texture2DMSArray.ArraySize > 1)
+ return true;
+ return false;
+}
+
+GLsizei GetAdjustedInstanceCount(const ProgramD3D *program, GLsizei instanceCount)
+{
+ if (!program->getState().usesMultiview())
+ {
+ return instanceCount;
+ }
+ if (instanceCount == 0)
+ {
+ return program->getState().getNumViews();
+ }
+ return program->getState().getNumViews() * instanceCount;
+}
+
+const uint32_t ScratchMemoryBufferLifetime = 1000;
+
+void PopulateFormatDeviceCaps(ID3D11Device *device,
+ DXGI_FORMAT format,
+ UINT *outSupport,
+ UINT *outMaxSamples)
+{
+ if (FAILED(device->CheckFormatSupport(format, outSupport)))
+ {
+ *outSupport = 0;
+ }
+
+ *outMaxSamples = 0;
+ for (UINT sampleCount = 2; sampleCount <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; sampleCount *= 2)
+ {
+ UINT qualityCount = 0;
+ if (FAILED(device->CheckMultisampleQualityLevels(format, sampleCount, &qualityCount)) ||
+ qualityCount == 0)
+ {
+ break;
+ }
+
+ *outMaxSamples = sampleCount;
+ }
+}
+
+} // anonymous namespace
+
+Renderer11DeviceCaps::Renderer11DeviceCaps() = default;
+
+Renderer11::Renderer11(egl::Display *display)
+ : RendererD3D(display),
+ mCreateDebugDevice(false),
+ mStateCache(),
+ mStateManager(this),
+ mLastHistogramUpdateTime(
+ ANGLEPlatformCurrent()->monotonicallyIncreasingTime(ANGLEPlatformCurrent())),
+ mDebug(nullptr),
+ mScratchMemoryBuffer(ScratchMemoryBufferLifetime)
+{
+ mLineLoopIB = nullptr;
+ mTriangleFanIB = nullptr;
+
+ mBlit = nullptr;
+ mPixelTransfer = nullptr;
+
+ mClear = nullptr;
+
+ mTrim = nullptr;
+
+ mRenderer11DeviceCaps.supportsClearView = false;
+ mRenderer11DeviceCaps.supportsConstantBufferOffsets = false;
+ mRenderer11DeviceCaps.supportsVpRtIndexWriteFromVertexShader = false;
+ mRenderer11DeviceCaps.supportsDXGI1_2 = false;
+ mRenderer11DeviceCaps.allowES3OnFL10_0 = false;
+ mRenderer11DeviceCaps.B5G6R5support = 0;
+ mRenderer11DeviceCaps.B4G4R4A4support = 0;
+ mRenderer11DeviceCaps.B5G5R5A1support = 0;
+
+ mD3d11Module = nullptr;
+ mDxgiModule = nullptr;
+ mDCompModule = nullptr;
+ mCreatedWithDeviceEXT = false;
+
+ mDevice = nullptr;
+ mDeviceContext = nullptr;
+ mDeviceContext1 = nullptr;
+ mDeviceContext3 = nullptr;
+ mDxgiAdapter = nullptr;
+ mDxgiFactory = nullptr;
+
+ ZeroMemory(&mAdapterDescription, sizeof(mAdapterDescription));
+
+ const auto &attributes = mDisplay->getAttributeMap();
+
+ if (mDisplay->getPlatform() == EGL_PLATFORM_ANGLE_ANGLE)
+ {
+ EGLint requestedMajorVersion = static_cast<EGLint>(
+ attributes.get(EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, EGL_DONT_CARE));
+ EGLint requestedMinorVersion = static_cast<EGLint>(
+ attributes.get(EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, EGL_DONT_CARE));
+
+ if (requestedMajorVersion == EGL_DONT_CARE || requestedMajorVersion >= 11)
+ {
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
+ {
+ // This could potentially lead to failed context creation if done on a system
+ // without the platform update which installs DXGI 1.2. Currently, for Chrome users
+ // D3D11 contexts are only created if the platform update is available, so this
+ // should not cause any issues.
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_11_1);
+ }
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 0)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_11_0);
+ }
+ }
+
+ if (requestedMajorVersion == EGL_DONT_CARE || requestedMajorVersion >= 10)
+ {
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_10_1);
+ }
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 0)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_10_0);
+ }
+ }
+
+ if (requestedMajorVersion == 9 && requestedMinorVersion == 3)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+ }
+
+ EGLint requestedDeviceType = static_cast<EGLint>(attributes.get(
+ EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE));
+ switch (requestedDeviceType)
+ {
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
+ mRequestedDriverType = D3D_DRIVER_TYPE_HARDWARE;
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE:
+ mRequestedDriverType = D3D_DRIVER_TYPE_WARP;
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
+ mRequestedDriverType = D3D_DRIVER_TYPE_REFERENCE;
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
+ mRequestedDriverType = D3D_DRIVER_TYPE_NULL;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ mCreateDebugDevice = ShouldUseDebugLayers(attributes);
+ }
+ else if (mDisplay->getPlatform() == EGL_PLATFORM_DEVICE_EXT)
+ {
+ ASSERT(mDisplay->getDevice() != nullptr);
+ mCreatedWithDeviceEXT = true;
+
+ // Also set EGL_PLATFORM_ANGLE_ANGLE variables, in case they're used elsewhere in ANGLE
+ // mAvailableFeatureLevels defaults to empty
+ mRequestedDriverType = D3D_DRIVER_TYPE_UNKNOWN;
+ }
+
+ const EGLenum presentPath = static_cast<EGLenum>(attributes.get(
+ EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE, EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE));
+ mPresentPathFastEnabled = (presentPath == EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE);
+}
+
+Renderer11::~Renderer11()
+{
+ release();
+}
+
+#ifndef __d3d11_1_h__
+# define D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET ((D3D11_MESSAGE_ID)3146081)
+#endif
+
+egl::Error Renderer11::initialize()
+{
+ HRESULT result = S_OK;
+
+ ANGLE_TRY(initializeD3DDevice());
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+# if !ANGLE_SKIP_DXGI_1_2_CHECK
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (DXGICheck)");
+ // In order to create a swap chain for an HWND owned by another process, DXGI 1.2 is
+ // required.
+ // The easiest way to check is to query for a IDXGIDevice2.
+ bool requireDXGI1_2 = false;
+ HWND hwnd = WindowFromDC(mDisplay->getNativeDisplayId());
+ if (hwnd)
+ {
+ DWORD currentProcessId = GetCurrentProcessId();
+ DWORD wndProcessId;
+ GetWindowThreadProcessId(hwnd, &wndProcessId);
+ requireDXGI1_2 = (currentProcessId != wndProcessId);
+ }
+ else
+ {
+ requireDXGI1_2 = true;
+ }
+
+ if (requireDXGI1_2)
+ {
+ IDXGIDevice2 *dxgiDevice2 = nullptr;
+ result = mDevice->QueryInterface(__uuidof(IDXGIDevice2), (void **)&dxgiDevice2);
+ if (FAILED(result))
+ {
+ return egl::EglNotInitialized(D3D11_INIT_INCOMPATIBLE_DXGI)
+ << "DXGI 1.2 required to present to HWNDs owned by another process.";
+ }
+ SafeRelease(dxgiDevice2);
+ }
+ }
+# endif
+#endif
+
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (ComQueries)");
+ // Cast the DeviceContext to a DeviceContext1 and DeviceContext3.
+ // This could fail on Windows 7 without the Platform Update.
+ // Don't error in this case- just don't use mDeviceContext1 or mDeviceContext3.
+ mDeviceContext1 = d3d11::DynamicCastComObject<ID3D11DeviceContext1>(mDeviceContext);
+ mDeviceContext3 = d3d11::DynamicCastComObject<ID3D11DeviceContext3>(mDeviceContext);
+
+ IDXGIDevice *dxgiDevice = nullptr;
+ result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void **)&dxgiDevice);
+
+ if (FAILED(result))
+ {
+ return egl::EglNotInitialized(D3D11_INIT_OTHER_ERROR) << "Could not query DXGI device.";
+ }
+
+ result = dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void **)&mDxgiAdapter);
+
+ if (FAILED(result))
+ {
+ return egl::EglNotInitialized(D3D11_INIT_OTHER_ERROR)
+ << "Could not retrieve DXGI adapter";
+ }
+
+ SafeRelease(dxgiDevice);
+
+ IDXGIAdapter2 *dxgiAdapter2 = d3d11::DynamicCastComObject<IDXGIAdapter2>(mDxgiAdapter);
+
+ // On D3D_FEATURE_LEVEL_9_*, IDXGIAdapter::GetDesc returns "Software Adapter" for the
+ // description string.
+ // If DXGI1.2 is available then IDXGIAdapter2::GetDesc2 can be used to get the actual
+ // hardware values.
+ if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3 && dxgiAdapter2 != nullptr)
+ {
+ DXGI_ADAPTER_DESC2 adapterDesc2 = {};
+ result = dxgiAdapter2->GetDesc2(&adapterDesc2);
+ if (SUCCEEDED(result))
+ {
+ // Copy the contents of the DXGI_ADAPTER_DESC2 into mAdapterDescription (a
+ // DXGI_ADAPTER_DESC).
+ memcpy(mAdapterDescription.Description, adapterDesc2.Description,
+ sizeof(mAdapterDescription.Description));
+ mAdapterDescription.VendorId = adapterDesc2.VendorId;
+ mAdapterDescription.DeviceId = adapterDesc2.DeviceId;
+ mAdapterDescription.SubSysId = adapterDesc2.SubSysId;
+ mAdapterDescription.Revision = adapterDesc2.Revision;
+ mAdapterDescription.DedicatedVideoMemory = adapterDesc2.DedicatedVideoMemory;
+ mAdapterDescription.DedicatedSystemMemory = adapterDesc2.DedicatedSystemMemory;
+ mAdapterDescription.SharedSystemMemory = adapterDesc2.SharedSystemMemory;
+ mAdapterDescription.AdapterLuid = adapterDesc2.AdapterLuid;
+ }
+ }
+ else
+ {
+ result = mDxgiAdapter->GetDesc(&mAdapterDescription);
+ }
+
+ SafeRelease(dxgiAdapter2);
+
+ if (FAILED(result))
+ {
+ return egl::EglNotInitialized(D3D11_INIT_OTHER_ERROR)
+ << "Could not read DXGI adaptor description.";
+ }
+
+ memset(mDescription, 0, sizeof(mDescription));
+ wcstombs(mDescription, mAdapterDescription.Description, sizeof(mDescription) - 1);
+
+ result = mDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void **)&mDxgiFactory);
+
+ if (!mDxgiFactory || FAILED(result))
+ {
+ return egl::EglNotInitialized(D3D11_INIT_OTHER_ERROR)
+ << "Could not create DXGI factory.";
+ }
+ }
+
+ // Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
+ if (mCreateDebugDevice)
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (HideWarnings)");
+ ID3D11InfoQueue *infoQueue;
+ result = mDevice->QueryInterface(__uuidof(ID3D11InfoQueue), (void **)&infoQueue);
+
+ if (SUCCEEDED(result))
+ {
+ D3D11_MESSAGE_ID hideMessages[] = {
+ D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET,
+
+ // Robust access behaviour makes out of bounds messages safe
+ D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL,
+ };
+
+ D3D11_INFO_QUEUE_FILTER filter = {};
+ filter.DenyList.NumIDs = static_cast<unsigned int>(ArraySize(hideMessages));
+ filter.DenyList.pIDList = hideMessages;
+
+ infoQueue->AddStorageFilterEntries(&filter);
+ SafeRelease(infoQueue);
+ }
+ }
+
+#if !defined(NDEBUG)
+ mDebug = d3d11::DynamicCastComObject<ID3D11Debug>(mDevice);
+#endif
+
+ ANGLE_TRY(initializeDevice());
+
+ return egl::NoError();
+}
+
+HRESULT Renderer11::callD3D11CreateDevice(PFN_D3D11_CREATE_DEVICE createDevice, bool debug)
+{
+ return createDevice(
+ nullptr, mRequestedDriverType, nullptr, debug ? D3D11_CREATE_DEVICE_DEBUG : 0,
+ mAvailableFeatureLevels.data(), static_cast<unsigned int>(mAvailableFeatureLevels.size()),
+ D3D11_SDK_VERSION, &mDevice, &(mRenderer11DeviceCaps.featureLevel), &mDeviceContext);
+}
+
+egl::Error Renderer11::initializeD3DDevice()
+{
+ HRESULT result = S_OK;
+
+ if (!mCreatedWithDeviceEXT)
+ {
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = nullptr;
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (Load DLLs)");
+ mDxgiModule = LoadLibrary(TEXT("dxgi.dll"));
+ mD3d11Module = LoadLibrary(TEXT("d3d11.dll"));
+ mDCompModule = LoadLibrary(TEXT("dcomp.dll"));
+
+ if (mD3d11Module == nullptr || mDxgiModule == nullptr)
+ {
+ return egl::EglNotInitialized(D3D11_INIT_MISSING_DEP)
+ << "Could not load D3D11 or DXGI library.";
+ }
+
+ // create the D3D11 device
+ ASSERT(mDevice == nullptr);
+ D3D11CreateDevice = reinterpret_cast<PFN_D3D11_CREATE_DEVICE>(
+ GetProcAddress(mD3d11Module, "D3D11CreateDevice"));
+
+ if (D3D11CreateDevice == nullptr)
+ {
+ return egl::EglNotInitialized(D3D11_INIT_MISSING_DEP)
+ << "Could not retrieve D3D11CreateDevice address.";
+ }
+ }
+#endif
+
+ if (mCreateDebugDevice)
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "D3D11CreateDevice (Debug)");
+ result = callD3D11CreateDevice(D3D11CreateDevice, true);
+
+ if (result == E_INVALIDARG && mAvailableFeatureLevels.size() > 1u &&
+ mAvailableFeatureLevels[0] == D3D_FEATURE_LEVEL_11_1)
+ {
+ // On older Windows platforms, D3D11.1 is not supported which returns E_INVALIDARG.
+ // Try again without passing D3D_FEATURE_LEVEL_11_1 in case we have other feature
+ // levels to fall back on.
+ mAvailableFeatureLevels.erase(mAvailableFeatureLevels.begin());
+ result = callD3D11CreateDevice(D3D11CreateDevice, true);
+ }
+
+ if (!mDevice || FAILED(result))
+ {
+ WARN() << "Failed creating Debug D3D11 device - falling back to release runtime.";
+ }
+ }
+
+ if (!mDevice || FAILED(result))
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "D3D11CreateDevice");
+
+ result = callD3D11CreateDevice(D3D11CreateDevice, false);
+
+ if (result == E_INVALIDARG && mAvailableFeatureLevels.size() > 1u &&
+ mAvailableFeatureLevels[0] == D3D_FEATURE_LEVEL_11_1)
+ {
+ // On older Windows platforms, D3D11.1 is not supported which returns E_INVALIDARG.
+ // Try again without passing D3D_FEATURE_LEVEL_11_1 in case we have other feature
+ // levels to fall back on.
+ mAvailableFeatureLevels.erase(mAvailableFeatureLevels.begin());
+ result = callD3D11CreateDevice(D3D11CreateDevice, false);
+ }
+
+ // Cleanup done by destructor
+ if (!mDevice || FAILED(result))
+ {
+ ANGLE_HISTOGRAM_SPARSE_SLOWLY("GPU.ANGLE.D3D11CreateDeviceError",
+ static_cast<int>(result));
+ return egl::EglNotInitialized(D3D11_INIT_CREATEDEVICE_ERROR)
+ << "Could not create D3D11 device.";
+ }
+ }
+ }
+ else
+ {
+ DeviceD3D *deviceD3D = GetImplAs<DeviceD3D>(mDisplay->getDevice());
+ ASSERT(deviceD3D != nullptr);
+
+ // We should use the inputted D3D11 device instead
+ void *device = nullptr;
+ ANGLE_TRY(deviceD3D->getDevice(&device));
+
+ ID3D11Device *d3dDevice = static_cast<ID3D11Device *>(device);
+ if (FAILED(d3dDevice->GetDeviceRemovedReason()))
+ {
+ return egl::EglNotInitialized() << "Inputted D3D11 device has been lost.";
+ }
+
+ if (d3dDevice->GetFeatureLevel() < D3D_FEATURE_LEVEL_9_3)
+ {
+ return egl::EglNotInitialized()
+ << "Inputted D3D11 device must be Feature Level 9_3 or greater.";
+ }
+
+ // The Renderer11 adds a ref to the inputted D3D11 device, like D3D11CreateDevice does.
+ mDevice = d3dDevice;
+ mDevice->AddRef();
+ mDevice->GetImmediateContext(&mDeviceContext);
+ mRenderer11DeviceCaps.featureLevel = mDevice->GetFeatureLevel();
+ }
+
+ mResourceManager11.setAllocationsInitialized(mCreateDebugDevice);
+
+ d3d11::SetDebugName(mDeviceContext, "DeviceContext");
+
+ mAnnotator.initialize(mDeviceContext);
+ gl::InitializeDebugAnnotations(&mAnnotator);
+
+ return egl::NoError();
+}
+
+// do any one-time device initialization
+// NOTE: this is also needed after a device lost/reset
+// to reset the scene status and ensure the default states are reset.
+egl::Error Renderer11::initializeDevice()
+{
+ ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initializeDevice");
+
+ populateRenderer11DeviceCaps();
+
+ mStateCache.clear();
+
+ ASSERT(!mBlit);
+ mBlit = new Blit11(this);
+
+ ASSERT(!mClear);
+ mClear = new Clear11(this);
+
+ const auto &attributes = mDisplay->getAttributeMap();
+ // If automatic trim is enabled, DXGIDevice3::Trim( ) is called for the application
+ // automatically when an application is suspended by the OS. This feature is currently
+ // only supported for Windows Store applications.
+ EGLint enableAutoTrim = static_cast<EGLint>(
+ attributes.get(EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_FALSE));
+
+ if (enableAutoTrim == EGL_TRUE)
+ {
+ ASSERT(!mTrim);
+ mTrim = new Trim11(this);
+ }
+
+ ASSERT(!mPixelTransfer);
+ mPixelTransfer = new PixelTransfer11(this);
+
+ // Gather stats on DXGI and D3D feature level
+ ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.SupportsDXGI1_2", mRenderer11DeviceCaps.supportsDXGI1_2);
+
+ ANGLEFeatureLevel angleFeatureLevel = GetANGLEFeatureLevel(mRenderer11DeviceCaps.featureLevel);
+
+ // We don't actually request a 11_1 device, because of complications with the platform
+ // update. Instead we check if the mDeviceContext1 pointer cast succeeded.
+ // Note: we should support D3D11_0 always, but we aren't guaranteed to be at FL11_0
+ // because the app can specify a lower version (such as 9_3) on Display creation.
+ if (mDeviceContext1 != nullptr)
+ {
+ angleFeatureLevel = ANGLE_FEATURE_LEVEL_11_1;
+ }
+
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3D11FeatureLevel", angleFeatureLevel,
+ NUM_ANGLE_FEATURE_LEVELS);
+
+ return egl::NoError();
+}
+
+void Renderer11::populateRenderer11DeviceCaps()
+{
+ HRESULT hr = S_OK;
+
+ LARGE_INTEGER version;
+ hr = mDxgiAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &version);
+ if (FAILED(hr))
+ {
+ mRenderer11DeviceCaps.driverVersion.reset();
+ ERR() << "Error querying driver version from DXGI Adapter.";
+ }
+ else
+ {
+ mRenderer11DeviceCaps.driverVersion = version;
+ }
+
+ if (mDeviceContext1)
+ {
+ D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11Options;
+ HRESULT result = mDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &d3d11Options,
+ sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS));
+ if (SUCCEEDED(result))
+ {
+ mRenderer11DeviceCaps.supportsClearView = (d3d11Options.ClearView != FALSE);
+ mRenderer11DeviceCaps.supportsConstantBufferOffsets =
+ (d3d11Options.ConstantBufferOffsetting != FALSE);
+ }
+ }
+
+ if (mDeviceContext3)
+ {
+ D3D11_FEATURE_DATA_D3D11_OPTIONS3 d3d11Options3;
+ HRESULT result = mDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS3, &d3d11Options3,
+ sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS3));
+ if (SUCCEEDED(result))
+ {
+ mRenderer11DeviceCaps.supportsVpRtIndexWriteFromVertexShader =
+ (d3d11Options3.VPAndRTArrayIndexFromAnyShaderFeedingRasterizer == TRUE);
+ }
+ }
+
+ mRenderer11DeviceCaps.supportsMultisampledDepthStencilSRVs =
+ mRenderer11DeviceCaps.featureLevel > D3D_FEATURE_LEVEL_10_0;
+
+ if (getFeatures().disableB5G6R5Support.enabled)
+ {
+ mRenderer11DeviceCaps.B5G6R5support = 0;
+ mRenderer11DeviceCaps.B5G6R5maxSamples = 0;
+ }
+ else
+ {
+ PopulateFormatDeviceCaps(mDevice, DXGI_FORMAT_B5G6R5_UNORM,
+ &mRenderer11DeviceCaps.B5G6R5support,
+ &mRenderer11DeviceCaps.B5G6R5maxSamples);
+ }
+
+ if (getFeatures().allowES3OnFL10_0.enabled)
+ {
+ mRenderer11DeviceCaps.allowES3OnFL10_0 = true;
+ }
+
+ PopulateFormatDeviceCaps(mDevice, DXGI_FORMAT_B4G4R4A4_UNORM,
+ &mRenderer11DeviceCaps.B4G4R4A4support,
+ &mRenderer11DeviceCaps.B4G4R4A4maxSamples);
+ PopulateFormatDeviceCaps(mDevice, DXGI_FORMAT_B5G5R5A1_UNORM,
+ &mRenderer11DeviceCaps.B5G5R5A1support,
+ &mRenderer11DeviceCaps.B5G5R5A1maxSamples);
+
+ IDXGIAdapter2 *dxgiAdapter2 = d3d11::DynamicCastComObject<IDXGIAdapter2>(mDxgiAdapter);
+ mRenderer11DeviceCaps.supportsDXGI1_2 = (dxgiAdapter2 != nullptr);
+ SafeRelease(dxgiAdapter2);
+}
+
+gl::SupportedSampleSet Renderer11::generateSampleSetForEGLConfig(
+ const gl::TextureCaps &colorBufferFormatCaps,
+ const gl::TextureCaps &depthStencilBufferFormatCaps) const
+{
+ gl::SupportedSampleSet sampleCounts;
+
+ // Generate a new set from the set intersection of sample counts between the color and depth
+ // format caps.
+ std::set_intersection(colorBufferFormatCaps.sampleCounts.begin(),
+ colorBufferFormatCaps.sampleCounts.end(),
+ depthStencilBufferFormatCaps.sampleCounts.begin(),
+ depthStencilBufferFormatCaps.sampleCounts.end(),
+ std::inserter(sampleCounts, sampleCounts.begin()));
+
+ // Format of GL_NONE results in no supported sample counts.
+ // Add back the color sample counts to the supported sample set.
+ if (depthStencilBufferFormatCaps.sampleCounts.empty())
+ {
+ sampleCounts = colorBufferFormatCaps.sampleCounts;
+ }
+ else if (colorBufferFormatCaps.sampleCounts.empty())
+ {
+ // Likewise, add back the depth sample counts to the supported sample set.
+ sampleCounts = depthStencilBufferFormatCaps.sampleCounts;
+ }
+
+ // Always support 0 samples
+ sampleCounts.insert(0);
+
+ return sampleCounts;
+}
+
+egl::ConfigSet Renderer11::generateConfigs()
+{
+ std::vector<GLenum> colorBufferFormats;
+
+ // 32-bit supported formats
+ colorBufferFormats.push_back(GL_BGRA8_EXT);
+ colorBufferFormats.push_back(GL_RGBA8_OES);
+
+ // 24-bit supported formats
+ colorBufferFormats.push_back(GL_RGB8_OES);
+
+ if (mRenderer11DeviceCaps.featureLevel >= D3D_FEATURE_LEVEL_10_0)
+ {
+ // Additional high bit depth formats added in D3D 10.0
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/bb173064.aspx
+ colorBufferFormats.push_back(GL_RGBA16F);
+ colorBufferFormats.push_back(GL_RGB10_A2);
+ }
+
+ if (!mPresentPathFastEnabled)
+ {
+ // 16-bit supported formats
+ // These aren't valid D3D11 swapchain formats, so don't expose them as configs
+ // if present path fast is active
+ colorBufferFormats.push_back(GL_RGBA4);
+ colorBufferFormats.push_back(GL_RGB5_A1);
+ colorBufferFormats.push_back(GL_RGB565);
+ }
+
+ static const GLenum depthStencilBufferFormats[] = {
+ GL_NONE, GL_DEPTH24_STENCIL8_OES, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT16,
+ GL_STENCIL_INDEX8,
+ };
+
+ const gl::Caps &rendererCaps = getNativeCaps();
+ const gl::TextureCapsMap &rendererTextureCaps = getNativeTextureCaps();
+
+ const EGLint optimalSurfaceOrientation =
+ mPresentPathFastEnabled ? 0 : EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE;
+
+ egl::ConfigSet configs;
+ for (GLenum colorBufferInternalFormat : colorBufferFormats)
+ {
+ const gl::TextureCaps &colorBufferFormatCaps =
+ rendererTextureCaps.get(colorBufferInternalFormat);
+ if (!colorBufferFormatCaps.renderbuffer)
+ {
+ ASSERT(!colorBufferFormatCaps.textureAttachment);
+ continue;
+ }
+
+ for (GLenum depthStencilBufferInternalFormat : depthStencilBufferFormats)
+ {
+ const gl::TextureCaps &depthStencilBufferFormatCaps =
+ rendererTextureCaps.get(depthStencilBufferInternalFormat);
+ if (!depthStencilBufferFormatCaps.renderbuffer &&
+ depthStencilBufferInternalFormat != GL_NONE)
+ {
+ ASSERT(!depthStencilBufferFormatCaps.textureAttachment);
+ continue;
+ }
+
+ const gl::InternalFormat &colorBufferFormatInfo =
+ gl::GetSizedInternalFormatInfo(colorBufferInternalFormat);
+ const gl::InternalFormat &depthStencilBufferFormatInfo =
+ gl::GetSizedInternalFormatInfo(depthStencilBufferInternalFormat);
+ const gl::Version &maxVersion = getMaxSupportedESVersion();
+
+ const gl::SupportedSampleSet sampleCounts =
+ generateSampleSetForEGLConfig(colorBufferFormatCaps, depthStencilBufferFormatCaps);
+
+ for (GLuint sampleCount : sampleCounts)
+ {
+ egl::Config config;
+ config.renderTargetFormat = colorBufferInternalFormat;
+ config.depthStencilFormat = depthStencilBufferInternalFormat;
+ config.bufferSize = colorBufferFormatInfo.pixelBytes * 8;
+ config.redSize = colorBufferFormatInfo.redBits;
+ config.greenSize = colorBufferFormatInfo.greenBits;
+ config.blueSize = colorBufferFormatInfo.blueBits;
+ config.luminanceSize = colorBufferFormatInfo.luminanceBits;
+ config.alphaSize = colorBufferFormatInfo.alphaBits;
+ config.alphaMaskSize = 0;
+ config.bindToTextureRGB =
+ ((colorBufferFormatInfo.format == GL_RGB) && (sampleCount <= 1));
+ config.bindToTextureRGBA = (((colorBufferFormatInfo.format == GL_RGBA) ||
+ (colorBufferFormatInfo.format == GL_BGRA_EXT)) &&
+ (sampleCount <= 1));
+ config.colorBufferType = EGL_RGB_BUFFER;
+ config.configCaveat = EGL_NONE;
+ config.configID = static_cast<EGLint>(configs.size() + 1);
+
+ // PresentPathFast may not be conformant
+ config.conformant = 0;
+ if (!mPresentPathFastEnabled)
+ {
+ // Can only support a conformant ES2 with feature level greater than 10.0.
+ if (mRenderer11DeviceCaps.featureLevel >= D3D_FEATURE_LEVEL_10_0)
+ {
+ config.conformant |= EGL_OPENGL_ES2_BIT;
+ }
+
+ // We can only support conformant ES3 on FL 10.1+
+ if (maxVersion.major >= 3)
+ {
+ config.conformant |= EGL_OPENGL_ES3_BIT_KHR;
+ }
+ }
+
+ config.depthSize = depthStencilBufferFormatInfo.depthBits;
+ config.level = 0;
+ config.matchNativePixmap = EGL_NONE;
+ config.maxPBufferWidth = rendererCaps.max2DTextureSize;
+ config.maxPBufferHeight = rendererCaps.max2DTextureSize;
+ config.maxPBufferPixels =
+ rendererCaps.max2DTextureSize * rendererCaps.max2DTextureSize;
+ config.maxSwapInterval = 4;
+ config.minSwapInterval = 0;
+ config.nativeRenderable = EGL_FALSE;
+ config.nativeVisualID = 0;
+ config.nativeVisualType = EGL_NONE;
+
+ // Can't support ES3 at all without feature level 10.1
+ config.renderableType = EGL_OPENGL_ES2_BIT;
+ if (maxVersion.major >= 3)
+ {
+ config.renderableType |= EGL_OPENGL_ES3_BIT_KHR;
+ }
+
+ config.sampleBuffers = (sampleCount == 0) ? 0 : 1;
+ config.samples = sampleCount;
+ config.stencilSize = depthStencilBufferFormatInfo.stencilBits;
+ config.surfaceType =
+ EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+ config.transparentType = EGL_NONE;
+ config.transparentRedValue = 0;
+ config.transparentGreenValue = 0;
+ config.transparentBlueValue = 0;
+ config.optimalOrientation = optimalSurfaceOrientation;
+ config.colorComponentType = gl_egl::GLComponentTypeToEGLColorComponentType(
+ colorBufferFormatInfo.componentType);
+
+ configs.add(config);
+ }
+ }
+ }
+
+ ASSERT(configs.size() > 0);
+ return configs;
+}
+
+void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions) const
+{
+ outExtensions->createContextRobustness = true;
+
+ if (getShareHandleSupport())
+ {
+ outExtensions->d3dShareHandleClientBuffer = true;
+ outExtensions->surfaceD3DTexture2DShareHandle = true;
+ }
+ outExtensions->d3dTextureClientBuffer = true;
+ outExtensions->imageD3D11Texture = true;
+
+ outExtensions->keyedMutex = true;
+ outExtensions->querySurfacePointer = true;
+ outExtensions->windowFixedSize = true;
+
+ // If present path fast is active then the surface orientation extension isn't supported
+ outExtensions->surfaceOrientation = !mPresentPathFastEnabled;
+
+ // D3D11 does not support present with dirty rectangles until DXGI 1.2.
+ outExtensions->postSubBuffer = mRenderer11DeviceCaps.supportsDXGI1_2;
+
+ outExtensions->deviceQuery = true;
+
+ outExtensions->image = true;
+ outExtensions->imageBase = true;
+ outExtensions->glTexture2DImage = true;
+ outExtensions->glTextureCubemapImage = true;
+ outExtensions->glRenderbufferImage = true;
+
+ outExtensions->stream = true;
+ outExtensions->streamConsumerGLTexture = true;
+ outExtensions->streamConsumerGLTextureYUV = true;
+ outExtensions->streamProducerD3DTexture = true;
+
+ outExtensions->flexibleSurfaceCompatibility = true;
+ outExtensions->directComposition = !!mDCompModule;
+
+ // Contexts are virtualized so textures can be shared globally
+ outExtensions->displayTextureShareGroup = true;
+
+ // getSyncValues requires direct composition.
+ outExtensions->getSyncValues = outExtensions->directComposition;
+
+ // D3D11 can be used without a swap chain
+ outExtensions->surfacelessContext = true;
+
+ // All D3D feature levels support robust resource init
+ outExtensions->robustResourceInitialization = true;
+
+ // Compositor Native Window capabilies require WinVer >= 1803
+ if (CompositorNativeWindow11::IsSupportedWinRelease())
+ {
+ outExtensions->windowsUIComposition = true;
+ }
+}
+
+angle::Result Renderer11::flush(Context11 *context11)
+{
+ mDeviceContext->Flush();
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::finish(Context11 *context11)
+{
+ if (!mSyncQuery.valid())
+ {
+ D3D11_QUERY_DESC queryDesc;
+ queryDesc.Query = D3D11_QUERY_EVENT;
+ queryDesc.MiscFlags = 0;
+
+ ANGLE_TRY(allocateResource(context11, queryDesc, &mSyncQuery));
+ }
+
+ mDeviceContext->End(mSyncQuery.get());
+
+ HRESULT result = S_OK;
+ unsigned int attempt = 0;
+ do
+ {
+ unsigned int flushFrequency = 100;
+ UINT flags = (attempt % flushFrequency == 0) ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH;
+ attempt++;
+
+ result = mDeviceContext->GetData(mSyncQuery.get(), nullptr, 0, flags);
+ ANGLE_TRY_HR(context11, result, "Failed to get event query data");
+
+ if (result == S_FALSE)
+ {
+ // Keep polling, but allow other threads to do something useful first
+ ScheduleYield();
+ }
+
+ // Attempt is incremented before checking if we should test for device loss so that device
+ // loss is not checked on the first iteration
+ bool checkDeviceLost = (attempt % kPollingD3DDeviceLostCheckFrequency) == 0;
+ if (checkDeviceLost && testDeviceLost())
+ {
+ mDisplay->notifyDeviceLost();
+ ANGLE_CHECK(context11, false, "Device was lost while waiting for sync.",
+ GL_OUT_OF_MEMORY);
+ }
+ } while (result == S_FALSE);
+
+ return angle::Result::Continue;
+}
+
+bool Renderer11::isValidNativeWindow(EGLNativeWindowType window) const
+{
+ static_assert(sizeof(ABI::Windows::UI::Composition::SpriteVisual *) == sizeof(HWND),
+ "Pointer size must match Window Handle size");
+
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+ return NativeWindow11WinRT::IsValidNativeWindow(window);
+#else
+ if (NativeWindow11Win32::IsValidNativeWindow(window))
+ {
+ return true;
+ }
+
+ return CompositorNativeWindow11::IsValidNativeWindow(window);
+#endif
+}
+
+NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
+ const egl::Config *config,
+ const egl::AttributeMap &attribs) const
+{
+ auto useWinUiComp = window != nullptr && !NativeWindow11Win32::IsValidNativeWindow(window);
+
+ if (useWinUiComp)
+ {
+ return new CompositorNativeWindow11(window, config->alphaSize > 0);
+ }
+ else
+ {
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+ UNUSED_VARIABLE(attribs);
+ return new NativeWindow11WinRT(window, config->alphaSize > 0);
+#else
+ return new NativeWindow11Win32(
+ window, config->alphaSize > 0,
+ attribs.get(EGL_DIRECT_COMPOSITION_ANGLE, EGL_FALSE) == EGL_TRUE);
+#endif
+ }
+}
+
+egl::Error Renderer11::getD3DTextureInfo(const egl::Config *configuration,
+ IUnknown *d3dTexture,
+ EGLint *width,
+ EGLint *height,
+ EGLint *samples,
+ const angle::Format **angleFormat) const
+{
+ ID3D11Texture2D *texture = d3d11::DynamicCastComObject<ID3D11Texture2D>(d3dTexture);
+ if (texture == nullptr)
+ {
+ return egl::EglBadParameter() << "client buffer is not a ID3D11Texture2D";
+ }
+
+ ID3D11Device *textureDevice = nullptr;
+ texture->GetDevice(&textureDevice);
+ if (textureDevice != mDevice)
+ {
+ SafeRelease(texture);
+ return egl::EglBadParameter() << "Texture's device does not match.";
+ }
+ SafeRelease(textureDevice);
+
+ D3D11_TEXTURE2D_DESC desc = {0};
+ texture->GetDesc(&desc);
+ SafeRelease(texture);
+
+ if (width)
+ {
+ *width = static_cast<EGLint>(desc.Width);
+ }
+ if (height)
+ {
+ *height = static_cast<EGLint>(desc.Height);
+ }
+
+ EGLint sampleCount = static_cast<EGLint>(desc.SampleDesc.Count);
+ if (configuration && (configuration->samples != sampleCount))
+ {
+ // Both the texture and EGL config sample count may not be the same when multi-sampling
+ // is disabled. The EGL sample count can be 0 but a D3D texture is always 1. Therefore,
+ // we must only check for a invalid match when the EGL config is non-zero or the texture is
+ // not one.
+ if (configuration->samples != 0 || sampleCount != 1)
+ {
+ return egl::EglBadParameter() << "Texture's sample count does not match.";
+ }
+ }
+ if (samples)
+ {
+ // EGL samples 0 corresponds to D3D11 sample count 1.
+ *samples = sampleCount != 1 ? sampleCount : 0;
+ }
+
+ // From table egl.restrictions in EGL_ANGLE_d3d_texture_client_buffer.
+ switch (desc.Format)
+ {
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ break;
+
+ default:
+ return egl::EglBadParameter()
+ << "Unknown client buffer texture format: " << desc.Format;
+ }
+
+ if (angleFormat)
+ {
+ *angleFormat = &d3d11_angle::GetFormat(desc.Format);
+ }
+
+ return egl::NoError();
+}
+
+egl::Error Renderer11::validateShareHandle(const egl::Config *config,
+ HANDLE shareHandle,
+ const egl::AttributeMap &attribs) const
+{
+ if (shareHandle == nullptr)
+ {
+ return egl::EglBadParameter() << "NULL share handle.";
+ }
+
+ ID3D11Resource *tempResource11 = nullptr;
+ HRESULT result = mDevice->OpenSharedResource(shareHandle, __uuidof(ID3D11Resource),
+ (void **)&tempResource11);
+ if (FAILED(result))
+ {
+ return egl::EglBadParameter() << "Failed to open share handle, " << gl::FmtHR(result);
+ }
+
+ ID3D11Texture2D *texture2D = d3d11::DynamicCastComObject<ID3D11Texture2D>(tempResource11);
+ SafeRelease(tempResource11);
+
+ if (texture2D == nullptr)
+ {
+ return egl::EglBadParameter()
+ << "Failed to query ID3D11Texture2D object from share handle.";
+ }
+
+ D3D11_TEXTURE2D_DESC desc = {0};
+ texture2D->GetDesc(&desc);
+ SafeRelease(texture2D);
+
+ EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
+ EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
+ ASSERT(width != 0 && height != 0);
+
+ const d3d11::Format &backbufferFormatInfo =
+ d3d11::Format::Get(config->renderTargetFormat, getRenderer11DeviceCaps());
+
+ if (desc.Width != static_cast<UINT>(width) || desc.Height != static_cast<UINT>(height) ||
+ desc.Format != backbufferFormatInfo.texFormat || desc.MipLevels != 1 || desc.ArraySize != 1)
+ {
+ return egl::EglBadParameter() << "Invalid texture parameters in share handle texture.";
+ }
+
+ return egl::NoError();
+}
+
+SwapChainD3D *Renderer11::createSwapChain(NativeWindowD3D *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation,
+ EGLint samples)
+{
+ return new SwapChain11(this, GetAs<NativeWindow11>(nativeWindow), shareHandle, d3dTexture,
+ backBufferFormat, depthBufferFormat, orientation, samples);
+}
+
+void *Renderer11::getD3DDevice()
+{
+ return mDevice;
+}
+
+angle::Result Renderer11::drawWithGeometryShaderAndTransformFeedback(Context11 *context11,
+ gl::PrimitiveMode mode,
+ UINT instanceCount,
+ UINT vertexCount)
+{
+ const gl::State &glState = context11->getState();
+ ProgramD3D *programD3D = mStateManager.getProgramD3D();
+
+ // Since we use a geometry if-and-only-if we rewrite vertex streams, transform feedback
+ // won't get the correct output. To work around this, draw with *only* the stream out
+ // first (no pixel shader) to feed the stream out buffers and then draw again with the
+ // geometry shader + pixel shader to rasterize the primitives.
+ mStateManager.setPixelShader(nullptr);
+
+ if (instanceCount > 0)
+ {
+ mDeviceContext->DrawInstanced(vertexCount, instanceCount, 0, 0);
+ }
+ else
+ {
+ mDeviceContext->Draw(vertexCount, 0);
+ }
+
+ rx::ShaderExecutableD3D *pixelExe = nullptr;
+ ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(context11, &pixelExe, nullptr));
+
+ // Skip the draw call if rasterizer discard is enabled (or no fragment shader).
+ if (!pixelExe || glState.getRasterizerState().rasterizerDiscard)
+ {
+ return angle::Result::Continue;
+ }
+
+ mStateManager.setPixelShader(&GetAs<ShaderExecutable11>(pixelExe)->getPixelShader());
+
+ // Retrieve the geometry shader.
+ rx::ShaderExecutableD3D *geometryExe = nullptr;
+ ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context11, glState, mode,
+ &geometryExe, nullptr));
+
+ mStateManager.setGeometryShader(&GetAs<ShaderExecutable11>(geometryExe)->getGeometryShader());
+
+ if (instanceCount > 0)
+ {
+ mDeviceContext->DrawInstanced(vertexCount, instanceCount, 0, 0);
+ }
+ else
+ {
+ mDeviceContext->Draw(vertexCount, 0);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::drawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint firstVertex,
+ GLsizei vertexCount,
+ GLsizei instanceCount)
+{
+ if (mStateManager.getCullEverything())
+ {
+ return angle::Result::Continue;
+ }
+
+ ProgramD3D *programD3D = mStateManager.getProgramD3D();
+ GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(programD3D, instanceCount);
+
+ // Note: vertex indexes can be arbitrarily large.
+ UINT clampedVertexCount = gl::GetClampedVertexCount<UINT>(vertexCount);
+
+ const auto &glState = context->getState();
+ if (glState.getCurrentTransformFeedback() && glState.isTransformFeedbackActiveUnpaused())
+ {
+ ANGLE_TRY(markTransformFeedbackUsage(context));
+
+ if (programD3D->usesGeometryShader(glState, mode))
+ {
+ return drawWithGeometryShaderAndTransformFeedback(
+ GetImplAs<Context11>(context), mode, adjustedInstanceCount, clampedVertexCount);
+ }
+ }
+
+ switch (mode)
+ {
+ case gl::PrimitiveMode::LineLoop:
+ return drawLineLoop(context, clampedVertexCount, gl::DrawElementsType::InvalidEnum,
+ nullptr, 0, adjustedInstanceCount);
+ case gl::PrimitiveMode::TriangleFan:
+ return drawTriangleFan(context, clampedVertexCount, gl::DrawElementsType::InvalidEnum,
+ nullptr, 0, adjustedInstanceCount);
+ case gl::PrimitiveMode::Points:
+ if (getFeatures().useInstancedPointSpriteEmulation.enabled)
+ {
+ // This code should not be reachable by multi-view programs.
+ ASSERT(programD3D->getState().usesMultiview() == false);
+
+ // If the shader is writing to gl_PointSize, then pointsprites are being rendered.
+ // Emulating instanced point sprites for FL9_3 requires the topology to be
+ // D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST and DrawIndexedInstanced is called instead.
+ if (adjustedInstanceCount == 0)
+ {
+ mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0);
+ return angle::Result::Continue;
+ }
+
+ // If pointsprite emulation is used with glDrawArraysInstanced then we need to take
+ // a less efficent code path. Instanced rendering of emulated pointsprites requires
+ // a loop to draw each batch of points. An offset into the instanced data buffer is
+ // calculated and applied on each iteration to ensure all instances are rendered
+ // correctly. Each instance being rendered requires the inputlayout cache to reapply
+ // buffers and offsets.
+ for (GLsizei i = 0; i < instanceCount; i++)
+ {
+ ANGLE_TRY(mStateManager.updateVertexOffsetsForPointSpritesEmulation(
+ context, firstVertex, i));
+ mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0);
+ }
+
+ // This required by updateVertexOffsets... above but is outside of the loop for
+ // speed.
+ mStateManager.invalidateVertexBuffer();
+ return angle::Result::Continue;
+ }
+ break;
+ default:
+ break;
+ }
+
+ // "Normal" draw case.
+ if (adjustedInstanceCount == 0)
+ {
+ mDeviceContext->Draw(clampedVertexCount, 0);
+ }
+ else
+ {
+ mDeviceContext->DrawInstanced(clampedVertexCount, adjustedInstanceCount, 0, 0);
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::drawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint startVertex,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ GLsizei instanceCount)
+{
+ if (mStateManager.getCullEverything())
+ {
+ return angle::Result::Continue;
+ }
+
+ // Transform feedback is not allowed for DrawElements, this error should have been caught at the
+ // API validation layer.
+ const gl::State &glState = context->getState();
+ ASSERT(!glState.isTransformFeedbackActiveUnpaused());
+
+ // If this draw call is coming from an indirect call, offset by the indirect call's base vertex.
+ // No base vertex parameter exists for a normal drawElements, so params.baseVertex will be zero.
+ int baseVertex = -startVertex;
+
+ const ProgramD3D *programD3D = mStateManager.getProgramD3D();
+ GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(programD3D, instanceCount);
+
+ if (mode == gl::PrimitiveMode::LineLoop)
+ {
+ return drawLineLoop(context, indexCount, indexType, indices, baseVertex,
+ adjustedInstanceCount);
+ }
+
+ if (mode == gl::PrimitiveMode::TriangleFan)
+ {
+ return drawTriangleFan(context, indexCount, indexType, indices, baseVertex,
+ adjustedInstanceCount);
+ }
+
+ if (mode != gl::PrimitiveMode::Points || !programD3D->usesInstancedPointSpriteEmulation())
+ {
+ if (adjustedInstanceCount == 0)
+ {
+ mDeviceContext->DrawIndexed(indexCount, 0, baseVertex);
+ }
+ else
+ {
+ mDeviceContext->DrawIndexedInstanced(indexCount, adjustedInstanceCount, 0, baseVertex,
+ 0);
+ }
+ return angle::Result::Continue;
+ }
+
+ // This code should not be reachable by multi-view programs.
+ ASSERT(programD3D->getState().usesMultiview() == false);
+
+ // If the shader is writing to gl_PointSize, then pointsprites are being rendered.
+ // Emulating instanced point sprites for FL9_3 requires the topology to be
+ // D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST and DrawIndexedInstanced is called instead.
+ //
+ // The count parameter passed to drawElements represents the total number of instances to be
+ // rendered. Each instance is referenced by the bound index buffer from the the caller.
+ //
+ // Indexed pointsprite emulation replicates data for duplicate entries found in the index
+ // buffer. This is not an efficent rendering mechanism and is only used on downlevel renderers
+ // that do not support geometry shaders.
+ if (instanceCount == 0)
+ {
+ mDeviceContext->DrawIndexedInstanced(6, indexCount, 0, 0, 0);
+ return angle::Result::Continue;
+ }
+
+ // If pointsprite emulation is used with glDrawElementsInstanced then we need to take a less
+ // efficent code path. Instanced rendering of emulated pointsprites requires a loop to draw each
+ // batch of points. An offset into the instanced data buffer is calculated and applied on each
+ // iteration to ensure all instances are rendered correctly.
+ gl::IndexRange indexRange;
+ ANGLE_TRY(glState.getVertexArray()->getIndexRange(context, indexType, indexCount, indices,
+ &indexRange));
+
+ UINT clampedVertexCount = gl::clampCast<UINT>(indexRange.vertexCount());
+
+ // Each instance being rendered requires the inputlayout cache to reapply buffers and offsets.
+ for (GLsizei i = 0; i < instanceCount; i++)
+ {
+ ANGLE_TRY(
+ mStateManager.updateVertexOffsetsForPointSpritesEmulation(context, startVertex, i));
+ mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0);
+ }
+ mStateManager.invalidateVertexBuffer();
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::drawArraysIndirect(const gl::Context *context, const void *indirect)
+{
+ if (mStateManager.getCullEverything())
+ {
+ return angle::Result::Continue;
+ }
+
+ const gl::State &glState = context->getState();
+ ASSERT(!glState.isTransformFeedbackActiveUnpaused());
+
+ gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect);
+ ASSERT(drawIndirectBuffer);
+ Buffer11 *storage = GetImplAs<Buffer11>(drawIndirectBuffer);
+
+ uintptr_t offset = reinterpret_cast<uintptr_t>(indirect);
+
+ ID3D11Buffer *buffer = nullptr;
+ ANGLE_TRY(storage->getBuffer(context, BUFFER_USAGE_INDIRECT, &buffer));
+ mDeviceContext->DrawInstancedIndirect(buffer, static_cast<unsigned int>(offset));
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::drawElementsIndirect(const gl::Context *context, const void *indirect)
+{
+ if (mStateManager.getCullEverything())
+ {
+ return angle::Result::Continue;
+ }
+
+ const gl::State &glState = context->getState();
+ ASSERT(!glState.isTransformFeedbackActiveUnpaused());
+
+ gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect);
+ ASSERT(drawIndirectBuffer);
+ Buffer11 *storage = GetImplAs<Buffer11>(drawIndirectBuffer);
+ uintptr_t offset = reinterpret_cast<uintptr_t>(indirect);
+
+ ID3D11Buffer *buffer = nullptr;
+ ANGLE_TRY(storage->getBuffer(context, BUFFER_USAGE_INDIRECT, &buffer));
+ mDeviceContext->DrawIndexedInstancedIndirect(buffer, static_cast<unsigned int>(offset));
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::drawLineLoop(const gl::Context *context,
+ GLuint count,
+ gl::DrawElementsType type,
+ const void *indexPointer,
+ int baseVertex,
+ int instances)
+{
+ const gl::State &glState = context->getState();
+ gl::VertexArray *vao = glState.getVertexArray();
+ gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
+
+ const void *indices = indexPointer;
+
+ // Get the raw indices for an indexed draw
+ if (type != gl::DrawElementsType::InvalidEnum && elementArrayBuffer)
+ {
+ BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
+
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(storage->getData(context, &bufferData));
+
+ indices = bufferData + offset;
+ }
+
+ if (!mLineLoopIB)
+ {
+ mLineLoopIB = new StreamingIndexBufferInterface(this);
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, INITIAL_INDEX_BUFFER_SIZE,
+ gl::DrawElementsType::UnsignedInt));
+ }
+
+ // Checked by Renderer11::applyPrimitiveType
+ bool indexCheck = static_cast<unsigned int>(count) + 1 >
+ (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int));
+ ANGLE_CHECK(GetImplAs<Context11>(context), !indexCheck,
+ "Failed to create a 32-bit looping index buffer for "
+ "GL_LINE_LOOP, too many indices required.",
+ GL_OUT_OF_MEMORY);
+
+ GetLineLoopIndices(indices, type, static_cast<GLuint>(count),
+ glState.isPrimitiveRestartEnabled(), &mScratchIndexDataBuffer);
+
+ unsigned int spaceNeeded =
+ static_cast<unsigned int>(sizeof(GLuint) * mScratchIndexDataBuffer.size());
+ ANGLE_TRY(
+ mLineLoopIB->reserveBufferSpace(context, spaceNeeded, gl::DrawElementsType::UnsignedInt));
+
+ void *mappedMemory = nullptr;
+ unsigned int offset;
+ ANGLE_TRY(mLineLoopIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
+
+ // Copy over the converted index data.
+ memcpy(mappedMemory, &mScratchIndexDataBuffer[0],
+ sizeof(GLuint) * mScratchIndexDataBuffer.size());
+
+ ANGLE_TRY(mLineLoopIB->unmapBuffer(context));
+
+ IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(mLineLoopIB->getIndexBuffer());
+ const d3d11::Buffer &d3dIndexBuffer = indexBuffer->getBuffer();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+
+ mStateManager.setIndexBuffer(d3dIndexBuffer.get(), indexFormat, offset);
+
+ UINT indexCount = static_cast<UINT>(mScratchIndexDataBuffer.size());
+
+ if (instances > 0)
+ {
+ mDeviceContext->DrawIndexedInstanced(indexCount, instances, 0, baseVertex, 0);
+ }
+ else
+ {
+ mDeviceContext->DrawIndexed(indexCount, 0, baseVertex);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::drawTriangleFan(const gl::Context *context,
+ GLuint count,
+ gl::DrawElementsType type,
+ const void *indices,
+ int baseVertex,
+ int instances)
+{
+ const gl::State &glState = context->getState();
+ gl::VertexArray *vao = glState.getVertexArray();
+ gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
+
+ const void *indexPointer = indices;
+
+ // Get the raw indices for an indexed draw
+ if (type != gl::DrawElementsType::InvalidEnum && elementArrayBuffer)
+ {
+ BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
+
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(storage->getData(context, &bufferData));
+
+ indexPointer = bufferData + offset;
+ }
+
+ if (!mTriangleFanIB)
+ {
+ mTriangleFanIB = new StreamingIndexBufferInterface(this);
+ ANGLE_TRY(mTriangleFanIB->reserveBufferSpace(context, INITIAL_INDEX_BUFFER_SIZE,
+ gl::DrawElementsType::UnsignedInt));
+ }
+
+ // Checked by Renderer11::applyPrimitiveType
+ ASSERT(count >= 3);
+
+ const GLuint numTris = count - 2;
+
+ bool indexCheck =
+ (numTris > std::numeric_limits<unsigned int>::max() / (sizeof(unsigned int) * 3));
+ ANGLE_CHECK(GetImplAs<Context11>(context), !indexCheck,
+ "Failed to create a scratch index buffer for GL_TRIANGLE_FAN, "
+ "too many indices required.",
+ GL_OUT_OF_MEMORY);
+
+ GetTriFanIndices(indexPointer, type, count, glState.isPrimitiveRestartEnabled(),
+ &mScratchIndexDataBuffer);
+
+ const unsigned int spaceNeeded =
+ static_cast<unsigned int>(mScratchIndexDataBuffer.size() * sizeof(unsigned int));
+ ANGLE_TRY(mTriangleFanIB->reserveBufferSpace(context, spaceNeeded,
+ gl::DrawElementsType::UnsignedInt));
+
+ void *mappedMemory = nullptr;
+ unsigned int offset;
+ ANGLE_TRY(mTriangleFanIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
+
+ memcpy(mappedMemory, &mScratchIndexDataBuffer[0], spaceNeeded);
+
+ ANGLE_TRY(mTriangleFanIB->unmapBuffer(context));
+
+ IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(mTriangleFanIB->getIndexBuffer());
+ const d3d11::Buffer &d3dIndexBuffer = indexBuffer->getBuffer();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+
+ mStateManager.setIndexBuffer(d3dIndexBuffer.get(), indexFormat, offset);
+
+ UINT indexCount = static_cast<UINT>(mScratchIndexDataBuffer.size());
+
+ if (instances > 0)
+ {
+ mDeviceContext->DrawIndexedInstanced(indexCount, instances, 0, baseVertex, 0);
+ }
+ else
+ {
+ mDeviceContext->DrawIndexed(indexCount, 0, baseVertex);
+ }
+
+ return angle::Result::Continue;
+}
+
+void Renderer11::releaseDeviceResources()
+{
+ mStateManager.deinitialize();
+ mStateCache.clear();
+
+ SafeDelete(mLineLoopIB);
+ SafeDelete(mTriangleFanIB);
+ SafeDelete(mBlit);
+ SafeDelete(mClear);
+ SafeDelete(mTrim);
+ SafeDelete(mPixelTransfer);
+
+ mSyncQuery.reset();
+
+ mCachedResolveTexture.reset();
+}
+
+// set notify to true to broadcast a message to all contexts of the device loss
+bool Renderer11::testDeviceLost()
+{
+ bool isLost = false;
+
+ if (!mDevice)
+ {
+ return true;
+ }
+
+ // GetRemovedReason is used to test if the device is removed
+ HRESULT result = mDevice->GetDeviceRemovedReason();
+ isLost = d3d11::isDeviceLostError(result);
+
+ if (isLost)
+ {
+ ERR() << "The D3D11 device was removed, " << gl::FmtHR(result);
+ }
+
+ return isLost;
+}
+
+bool Renderer11::testDeviceResettable()
+{
+ // determine if the device is resettable by creating a dummy device
+ PFN_D3D11_CREATE_DEVICE D3D11CreateDevice =
+ (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
+
+ if (D3D11CreateDevice == nullptr)
+ {
+ return false;
+ }
+
+ ID3D11Device *dummyDevice;
+ D3D_FEATURE_LEVEL dummyFeatureLevel;
+ ID3D11DeviceContext *dummyContext;
+ UINT flags = (mCreateDebugDevice ? D3D11_CREATE_DEVICE_DEBUG : 0);
+
+ ASSERT(mRequestedDriverType != D3D_DRIVER_TYPE_UNKNOWN);
+ HRESULT result = D3D11CreateDevice(
+ nullptr, mRequestedDriverType, nullptr, flags, mAvailableFeatureLevels.data(),
+ static_cast<unsigned int>(mAvailableFeatureLevels.size()), D3D11_SDK_VERSION, &dummyDevice,
+ &dummyFeatureLevel, &dummyContext);
+
+ if (!mDevice || FAILED(result))
+ {
+ return false;
+ }
+
+ SafeRelease(dummyContext);
+ SafeRelease(dummyDevice);
+
+ return true;
+}
+
+void Renderer11::release()
+{
+ mScratchMemoryBuffer.clear();
+
+ mAnnotator.release();
+ gl::UninitializeDebugAnnotations();
+
+ releaseDeviceResources();
+
+ SafeRelease(mDxgiFactory);
+ SafeRelease(mDxgiAdapter);
+
+ SafeRelease(mDeviceContext3);
+ SafeRelease(mDeviceContext1);
+
+ if (mDeviceContext)
+ {
+ mDeviceContext->ClearState();
+ mDeviceContext->Flush();
+ SafeRelease(mDeviceContext);
+ }
+
+ SafeRelease(mDevice);
+ SafeRelease(mDebug);
+
+ if (mD3d11Module)
+ {
+ FreeLibrary(mD3d11Module);
+ mD3d11Module = nullptr;
+ }
+
+ if (mDxgiModule)
+ {
+ FreeLibrary(mDxgiModule);
+ mDxgiModule = nullptr;
+ }
+
+ if (mDCompModule)
+ {
+ FreeLibrary(mDCompModule);
+ mDCompModule = nullptr;
+ }
+
+ mCompiler.release();
+
+ mSupportsShareHandles.reset();
+}
+
+bool Renderer11::resetDevice()
+{
+ // recreate everything
+ release();
+ egl::Error result = initialize();
+
+ if (result.isError())
+ {
+ ERR() << "Could not reinitialize D3D11 device: " << result;
+ return false;
+ }
+
+ return true;
+}
+
+std::string Renderer11::getRendererDescription() const
+{
+ std::ostringstream rendererString;
+
+ rendererString << mDescription;
+ rendererString << " Direct3D11";
+
+ rendererString << " vs_" << getMajorShaderModel() << "_" << getMinorShaderModel()
+ << getShaderModelSuffix();
+ rendererString << " ps_" << getMajorShaderModel() << "_" << getMinorShaderModel()
+ << getShaderModelSuffix();
+
+ return rendererString.str();
+}
+
+DeviceIdentifier Renderer11::getAdapterIdentifier() const
+{
+ // Don't use the AdapterLuid here, since that doesn't persist across reboot.
+ DeviceIdentifier deviceIdentifier = {0};
+ deviceIdentifier.VendorId = mAdapterDescription.VendorId;
+ deviceIdentifier.DeviceId = mAdapterDescription.DeviceId;
+ deviceIdentifier.SubSysId = mAdapterDescription.SubSysId;
+ deviceIdentifier.Revision = mAdapterDescription.Revision;
+ deviceIdentifier.FeatureLevel = static_cast<UINT>(mRenderer11DeviceCaps.featureLevel);
+
+ return deviceIdentifier;
+}
+
+unsigned int Renderer11::getReservedVertexUniformVectors() const
+{
+ // Driver uniforms are stored in a separate constant buffer
+ return d3d11_gl::GetReservedVertexUniformVectors(mRenderer11DeviceCaps.featureLevel);
+}
+
+unsigned int Renderer11::getReservedFragmentUniformVectors() const
+{
+ // Driver uniforms are stored in a separate constant buffer
+ return d3d11_gl::GetReservedFragmentUniformVectors(mRenderer11DeviceCaps.featureLevel);
+}
+
+gl::ShaderMap<unsigned int> Renderer11::getReservedShaderUniformBuffers() const
+{
+ gl::ShaderMap<unsigned int> shaderReservedUniformBuffers = {};
+
+ // we reserve one buffer for the application uniforms, and one for driver uniforms
+ shaderReservedUniformBuffers[gl::ShaderType::Vertex] = 2;
+ shaderReservedUniformBuffers[gl::ShaderType::Fragment] = 2;
+
+ return shaderReservedUniformBuffers;
+}
+
+d3d11::ANGLED3D11DeviceType Renderer11::getDeviceType() const
+{
+ if (mCreatedWithDeviceEXT)
+ {
+ return d3d11::GetDeviceType(mDevice);
+ }
+
+ if ((mRequestedDriverType == D3D_DRIVER_TYPE_SOFTWARE) ||
+ (mRequestedDriverType == D3D_DRIVER_TYPE_REFERENCE) ||
+ (mRequestedDriverType == D3D_DRIVER_TYPE_NULL))
+ {
+ return d3d11::ANGLE_D3D11_DEVICE_TYPE_SOFTWARE_REF_OR_NULL;
+ }
+
+ if (mRequestedDriverType == D3D_DRIVER_TYPE_WARP)
+ {
+ return d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP;
+ }
+
+ return d3d11::ANGLE_D3D11_DEVICE_TYPE_HARDWARE;
+}
+
+bool Renderer11::getShareHandleSupport() const
+{
+ if (mSupportsShareHandles.valid())
+ {
+ return mSupportsShareHandles.value();
+ }
+
+ // We only currently support share handles with BGRA surfaces, because
+ // chrome needs BGRA. Once chrome fixes this, we should always support them.
+ if (!getNativeExtensions().textureFormatBGRA8888)
+ {
+ mSupportsShareHandles = false;
+ return false;
+ }
+
+ // PIX doesn't seem to support using share handles, so disable them.
+ if (gl::DebugAnnotationsActive())
+ {
+ mSupportsShareHandles = false;
+ return false;
+ }
+
+ // Also disable share handles on Feature Level 9_3, since it doesn't support share handles on
+ // RGBA8 textures/swapchains.
+ if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ mSupportsShareHandles = false;
+ return false;
+ }
+
+ // Find out which type of D3D11 device the Renderer11 is using
+ d3d11::ANGLED3D11DeviceType deviceType = getDeviceType();
+ if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_UNKNOWN)
+ {
+ mSupportsShareHandles = false;
+ return false;
+ }
+
+ if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_SOFTWARE_REF_OR_NULL)
+ {
+ // Software/Reference/NULL devices don't support share handles
+ mSupportsShareHandles = false;
+ return false;
+ }
+
+ if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
+ {
+#ifndef ANGLE_ENABLE_WINDOWS_STORE
+ if (!IsWindows8OrGreater())
+ {
+ // WARP on Windows 7 doesn't support shared handles
+ mSupportsShareHandles = false;
+ return false;
+ }
+#endif // ANGLE_ENABLE_WINDOWS_STORE
+
+ // WARP on Windows 8.0+ supports shared handles when shared with another WARP device
+ // TODO: allow applications to query for HARDWARE or WARP-specific share handles,
+ // to prevent them trying to use a WARP share handle with an a HW device (or
+ // vice-versa)
+ // e.g. by creating EGL_D3D11_[HARDWARE/WARP]_DEVICE_SHARE_HANDLE_ANGLE
+ mSupportsShareHandles = true;
+ return true;
+ }
+
+ ASSERT(mCreatedWithDeviceEXT || mRequestedDriverType == D3D_DRIVER_TYPE_HARDWARE);
+ mSupportsShareHandles = true;
+ return true;
+}
+
+int Renderer11::getMajorShaderModel() const
+{
+ switch (mRenderer11DeviceCaps.featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_SHADER_MAJOR_VERSION; // 5
+ case D3D_FEATURE_LEVEL_10_1:
+ return D3D10_1_SHADER_MAJOR_VERSION; // 4
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_SHADER_MAJOR_VERSION; // 4
+ case D3D_FEATURE_LEVEL_9_3:
+ return D3D10_SHADER_MAJOR_VERSION; // 4
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+int Renderer11::getMinorShaderModel() const
+{
+ switch (mRenderer11DeviceCaps.featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_SHADER_MINOR_VERSION; // 0
+ case D3D_FEATURE_LEVEL_10_1:
+ return D3D10_1_SHADER_MINOR_VERSION; // 1
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_SHADER_MINOR_VERSION; // 0
+ case D3D_FEATURE_LEVEL_9_3:
+ return D3D10_SHADER_MINOR_VERSION; // 0
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::string Renderer11::getShaderModelSuffix() const
+{
+ switch (mRenderer11DeviceCaps.featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return "";
+ case D3D_FEATURE_LEVEL_10_1:
+ return "";
+ case D3D_FEATURE_LEVEL_10_0:
+ return "";
+ case D3D_FEATURE_LEVEL_9_3:
+ return "_level_9_3";
+ default:
+ UNREACHABLE();
+ return "";
+ }
+}
+
+angle::Result Renderer11::copyImageInternal(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ RenderTargetD3D *destRenderTarget)
+{
+ const gl::FramebufferAttachment *colorAttachment = framebuffer->getReadColorAttachment();
+ ASSERT(colorAttachment);
+
+ RenderTarget11 *sourceRenderTarget = nullptr;
+ ANGLE_TRY(colorAttachment->getRenderTarget(context, &sourceRenderTarget));
+ ASSERT(sourceRenderTarget);
+
+ const d3d11::RenderTargetView &dest =
+ GetAs<RenderTarget11>(destRenderTarget)->getRenderTargetView();
+ ASSERT(dest.valid());
+
+ gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents sourceSize(sourceRenderTarget->getWidth(), sourceRenderTarget->getHeight(), 1);
+
+ const bool invertSource = UsePresentPathFast(this, colorAttachment);
+ if (invertSource)
+ {
+ sourceArea.y = sourceSize.height - sourceRect.y;
+ sourceArea.height = -sourceArea.height;
+ }
+
+ gl::Box destArea(destOffset.x, destOffset.y, 0, sourceRect.width, sourceRect.height, 1);
+ gl::Extents destSize(destRenderTarget->getWidth(), destRenderTarget->getHeight(), 1);
+
+ // Use nearest filtering because source and destination are the same size for the direct copy.
+ // Convert to the unsized format before calling copyTexture.
+ GLenum sourceFormat = colorAttachment->getFormat().info->format;
+ if (sourceRenderTarget->getTexture().is2D() && sourceRenderTarget->isMultisampled())
+ {
+ TextureHelper11 tex;
+ ANGLE_TRY(resolveMultisampledTexture(context, sourceRenderTarget,
+ colorAttachment->getDepthSize(),
+ colorAttachment->getStencilSize(), &tex));
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC viewDesc;
+ viewDesc.Format = sourceRenderTarget->getFormatSet().srvFormat;
+ viewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ viewDesc.Texture2D.MipLevels = 1;
+ viewDesc.Texture2D.MostDetailedMip = 0;
+
+ d3d11::SharedSRV readSRV;
+ ANGLE_TRY(allocateResource(GetImplAs<Context11>(context), viewDesc, tex.get(), &readSRV));
+ ASSERT(readSRV.valid());
+
+ ANGLE_TRY(mBlit->copyTexture(context, readSRV, sourceArea, sourceSize, sourceFormat, dest,
+ destArea, destSize, nullptr, gl::GetUnsizedFormat(destFormat),
+ GL_NONE, GL_NEAREST, false, false, false));
+
+ return angle::Result::Continue;
+ }
+
+ ASSERT(!sourceRenderTarget->isMultisampled());
+
+ const d3d11::SharedSRV &source = sourceRenderTarget->getBlitShaderResourceView(context);
+ ASSERT(source.valid());
+
+ ANGLE_TRY(mBlit->copyTexture(context, source, sourceArea, sourceSize, sourceFormat, dest,
+ destArea, destSize, nullptr, gl::GetUnsizedFormat(destFormat),
+ GL_NONE, GL_NEAREST, false, false, false));
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
+{
+ TextureStorage11_2D *storage11 = GetAs<TextureStorage11_2D>(storage);
+ ASSERT(storage11);
+
+ gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+ RenderTargetD3D *destRenderTarget = nullptr;
+ ANGLE_TRY(storage11->getRenderTarget(context, index, &destRenderTarget));
+ ASSERT(destRenderTarget);
+
+ ANGLE_TRY(copyImageInternal(context, framebuffer, sourceRect, destFormat, destOffset,
+ destRenderTarget));
+
+ storage11->markLevelDirty(level);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level)
+{
+ TextureStorage11_Cube *storage11 = GetAs<TextureStorage11_Cube>(storage);
+ ASSERT(storage11);
+
+ gl::ImageIndex index = gl::ImageIndex::MakeCubeMapFace(target, level);
+ RenderTargetD3D *destRenderTarget = nullptr;
+ ANGLE_TRY(storage11->getRenderTarget(context, index, &destRenderTarget));
+ ASSERT(destRenderTarget);
+
+ ANGLE_TRY(copyImageInternal(context, framebuffer, sourceRect, destFormat, destOffset,
+ destRenderTarget));
+
+ storage11->markLevelDirty(level);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
+{
+ TextureStorage11_3D *storage11 = GetAs<TextureStorage11_3D>(storage);
+ ASSERT(storage11);
+
+ gl::ImageIndex index = gl::ImageIndex::Make3D(level, destOffset.z);
+ RenderTargetD3D *destRenderTarget = nullptr;
+ ANGLE_TRY(storage11->getRenderTarget(context, index, &destRenderTarget));
+ ASSERT(destRenderTarget);
+
+ ANGLE_TRY(copyImageInternal(context, framebuffer, sourceRect, destFormat, destOffset,
+ destRenderTarget));
+
+ storage11->markLevelDirty(level);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
+{
+ TextureStorage11_2DArray *storage11 = GetAs<TextureStorage11_2DArray>(storage);
+ ASSERT(storage11);
+
+ gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z);
+ RenderTargetD3D *destRenderTarget = nullptr;
+ ANGLE_TRY(storage11->getRenderTarget(context, index, &destRenderTarget));
+ ASSERT(destRenderTarget);
+
+ ANGLE_TRY(copyImageInternal(context, framebuffer, sourceRect, destFormat, destOffset,
+ destRenderTarget));
+ storage11->markLevelDirty(level);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ gl::TextureTarget srcTarget,
+ const gl::Box &sourceBox,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
+{
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+
+ TextureStorage *sourceStorage = nullptr;
+ ANGLE_TRY(sourceD3D->getNativeTexture(context, &sourceStorage));
+
+ TextureStorage11 *sourceStorage11 = GetAs<TextureStorage11>(sourceStorage);
+ ASSERT(sourceStorage11);
+
+ TextureStorage11 *destStorage11 = GetAs<TextureStorage11>(storage);
+ ASSERT(destStorage11);
+
+ // Check for fast path where a CopySubresourceRegion can be used.
+ if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha && !unpackFlipY &&
+ source->getFormat(srcTarget, sourceLevel).info->format == destFormat &&
+ sourceStorage11->getFormatSet().internalFormat ==
+ destStorage11->getFormatSet().internalFormat)
+ {
+ const TextureHelper11 *sourceResource = nullptr;
+ ANGLE_TRY(sourceStorage11->getResource(context, &sourceResource));
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(destStorage11->getResource(context, &destResource));
+
+ if (srcTarget == gl::TextureTarget::_2D || srcTarget == gl::TextureTarget::_3D)
+ {
+ gl::ImageIndex sourceIndex = gl::ImageIndex::MakeFromTarget(srcTarget, sourceLevel, 1);
+
+ UINT sourceSubresource = 0;
+ ANGLE_TRY(
+ sourceStorage11->getSubresourceIndex(context, sourceIndex, &sourceSubresource));
+
+ gl::ImageIndex destIndex = gl::ImageIndex::MakeFromTarget(destTarget, destLevel, 1);
+
+ UINT destSubresource = 0;
+ ANGLE_TRY(destStorage11->getSubresourceIndex(context, destIndex, &destSubresource));
+
+ D3D11_BOX d3dBox{static_cast<UINT>(sourceBox.x),
+ static_cast<UINT>(sourceBox.y),
+ static_cast<UINT>(sourceBox.z),
+ static_cast<UINT>(sourceBox.x + sourceBox.width),
+ static_cast<UINT>(sourceBox.y + sourceBox.height),
+ static_cast<UINT>(sourceBox.z + sourceBox.depth)};
+
+ mDeviceContext->CopySubresourceRegion(
+ destResource->get(), destSubresource, destOffset.x, destOffset.y, destOffset.z,
+ sourceResource->get(), sourceSubresource, &d3dBox);
+ }
+ else if (srcTarget == gl::TextureTarget::_2DArray)
+ {
+
+ D3D11_BOX d3dBox{static_cast<UINT>(sourceBox.x),
+ static_cast<UINT>(sourceBox.y),
+ 0,
+ static_cast<UINT>(sourceBox.x + sourceBox.width),
+ static_cast<UINT>(sourceBox.y + sourceBox.height),
+ 1u};
+
+ for (int i = 0; i < sourceBox.depth; i++)
+ {
+ gl::ImageIndex srcIndex = gl::ImageIndex::Make2DArray(sourceLevel, i + sourceBox.z);
+ UINT sourceSubresource = 0;
+ ANGLE_TRY(
+ sourceStorage11->getSubresourceIndex(context, srcIndex, &sourceSubresource));
+
+ gl::ImageIndex dIndex = gl::ImageIndex::Make2DArray(destLevel, i + destOffset.z);
+ UINT destSubresource = 0;
+ ANGLE_TRY(destStorage11->getSubresourceIndex(context, dIndex, &destSubresource));
+
+ mDeviceContext->CopySubresourceRegion(
+ destResource->get(), destSubresource, destOffset.x, destOffset.y, 0,
+ sourceResource->get(), sourceSubresource, &d3dBox);
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ const d3d11::SharedSRV *sourceSRV = nullptr;
+ ANGLE_TRY(sourceStorage11->getSRVLevels(context, sourceLevel, sourceLevel, &sourceSRV));
+
+ gl::Extents sourceSize(static_cast<int>(source->getWidth(
+ NonCubeTextureTypeToTarget(source->getType()), sourceLevel)),
+ static_cast<int>(source->getHeight(
+ NonCubeTextureTypeToTarget(source->getType()), sourceLevel)),
+ static_cast<int>(source->getDepth(
+ NonCubeTextureTypeToTarget(source->getType()), sourceLevel)));
+
+ gl::ImageIndex destIndex;
+ if (destTarget == gl::TextureTarget::_2D || destTarget == gl::TextureTarget::_3D ||
+ gl::IsCubeMapFaceTarget(destTarget))
+ {
+ destIndex = gl::ImageIndex::MakeFromTarget(destTarget, destLevel, 1);
+ }
+ else if (destTarget == gl::TextureTarget::_2DArray)
+ {
+ destIndex = gl::ImageIndex::Make2DArrayRange(destLevel, 0, sourceSize.depth);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ RenderTargetD3D *destRenderTargetD3D = nullptr;
+ ANGLE_TRY(destStorage11->getRenderTarget(context, destIndex, &destRenderTargetD3D));
+
+ RenderTarget11 *destRenderTarget11 = GetAs<RenderTarget11>(destRenderTargetD3D);
+
+ const d3d11::RenderTargetView &destRTV = destRenderTarget11->getRenderTargetView();
+ ASSERT(destRTV.valid());
+
+ gl::Box sourceArea(sourceBox.x, sourceBox.y, sourceBox.z, sourceBox.width, sourceBox.height,
+ sourceBox.depth);
+
+ if (unpackFlipY)
+ {
+ sourceArea.y += sourceArea.height;
+ sourceArea.height = -sourceArea.height;
+ }
+
+ gl::Box destArea(destOffset.x, destOffset.y, destOffset.z, sourceBox.width,
+ sourceBox.height, sourceBox.depth);
+
+ gl::Extents destSize(destRenderTarget11->getWidth(), destRenderTarget11->getHeight(),
+ sourceBox.depth);
+
+ // Use nearest filtering because source and destination are the same size for the direct
+ // copy
+ GLenum sourceFormat = source->getFormat(srcTarget, sourceLevel).info->format;
+ ANGLE_TRY(mBlit->copyTexture(context, *sourceSRV, sourceArea, sourceSize, sourceFormat,
+ destRTV, destArea, destSize, nullptr, destFormat, destType,
+ GL_NEAREST, false, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha));
+ }
+
+ destStorage11->markLevelDirty(destLevel);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel)
+{
+ TextureStorage11_2D *destStorage11 = GetAs<TextureStorage11_2D>(storage);
+ ASSERT(destStorage11);
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(destStorage11->getResource(context, &destResource));
+
+ gl::ImageIndex destIndex = gl::ImageIndex::Make2D(destLevel);
+ UINT destSubresource = 0;
+ ANGLE_TRY(destStorage11->getSubresourceIndex(context, destIndex, &destSubresource));
+
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+ ASSERT(sourceD3D);
+
+ TextureStorage *sourceStorage = nullptr;
+ ANGLE_TRY(sourceD3D->getNativeTexture(context, &sourceStorage));
+
+ TextureStorage11_2D *sourceStorage11 = GetAs<TextureStorage11_2D>(sourceStorage);
+ ASSERT(sourceStorage11);
+
+ const TextureHelper11 *sourceResource = nullptr;
+ ANGLE_TRY(sourceStorage11->getResource(context, &sourceResource));
+
+ gl::ImageIndex sourceIndex = gl::ImageIndex::Make2D(sourceLevel);
+ UINT sourceSubresource = 0;
+ ANGLE_TRY(sourceStorage11->getSubresourceIndex(context, sourceIndex, &sourceSubresource));
+
+ mDeviceContext->CopySubresourceRegion(destResource->get(), destSubresource, 0, 0, 0,
+ sourceResource->get(), sourceSubresource, nullptr);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT)
+{
+ const d3d11::Format &formatInfo = d3d11::Format::Get(format, mRenderer11DeviceCaps);
+
+ const gl::TextureCaps &textureCaps = getNativeTextureCaps().get(format);
+ GLuint supportedSamples = textureCaps.getNearestSamples(samples);
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (width > 0 && height > 0)
+ {
+ // Create texture resource
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = 1;
+ desc.ArraySize = 1;
+ desc.Format = formatInfo.texFormat;
+ desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ // If a rendertarget or depthstencil format exists for this texture format,
+ // we'll flag it to allow binding that way. Shader resource views are a little
+ // more complicated.
+ bool bindRTV = false, bindDSV = false, bindSRV = false;
+ bindRTV = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
+ bindDSV = (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
+ bindSRV = (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN);
+
+ bool isMultisampledDepthStencil = bindDSV && desc.SampleDesc.Count > 1;
+ if (isMultisampledDepthStencil &&
+ !mRenderer11DeviceCaps.supportsMultisampledDepthStencilSRVs)
+ {
+ bindSRV = false;
+ }
+
+ desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) |
+ (bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) |
+ (bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0);
+
+ // The format must be either an RTV or a DSV
+ ASSERT(bindRTV != bindDSV);
+
+ TextureHelper11 texture;
+ ANGLE_TRY(allocateTexture(context11, desc, formatInfo, &texture));
+ texture.setDebugName("createRenderTarget.Texture");
+
+ d3d11::SharedSRV srv;
+ d3d11::SharedSRV blitSRV;
+ if (bindSRV)
+ {
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = formatInfo.srvFormat;
+ srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D
+ : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ srvDesc.Texture2D.MostDetailedMip = 0;
+ srvDesc.Texture2D.MipLevels = 1;
+
+ ANGLE_TRY(allocateResource(context11, srvDesc, texture.get(), &srv));
+ srv.setDebugName("createRenderTarget.SRV");
+
+ if (formatInfo.blitSRVFormat != formatInfo.srvFormat)
+ {
+ D3D11_SHADER_RESOURCE_VIEW_DESC blitSRVDesc;
+ blitSRVDesc.Format = formatInfo.blitSRVFormat;
+ blitSRVDesc.ViewDimension = (supportedSamples == 0)
+ ? D3D11_SRV_DIMENSION_TEXTURE2D
+ : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ blitSRVDesc.Texture2D.MostDetailedMip = 0;
+ blitSRVDesc.Texture2D.MipLevels = 1;
+
+ ANGLE_TRY(allocateResource(context11, blitSRVDesc, texture.get(), &blitSRV));
+ blitSRV.setDebugName("createRenderTarget.BlitSRV");
+ }
+ else
+ {
+ blitSRV = srv.makeCopy();
+ }
+ }
+
+ if (bindDSV)
+ {
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = formatInfo.dsvFormat;
+ dsvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_DSV_DIMENSION_TEXTURE2D
+ : D3D11_DSV_DIMENSION_TEXTURE2DMS;
+ dsvDesc.Texture2D.MipSlice = 0;
+ dsvDesc.Flags = 0;
+
+ d3d11::DepthStencilView dsv;
+ ANGLE_TRY(allocateResource(context11, dsvDesc, texture.get(), &dsv));
+ dsv.setDebugName("createRenderTarget.DSV");
+
+ *outRT = new TextureRenderTarget11(std::move(dsv), texture, srv, format, formatInfo,
+ width, height, 1, supportedSamples);
+ }
+ else if (bindRTV)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = formatInfo.rtvFormat;
+ rtvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_RTV_DIMENSION_TEXTURE2D
+ : D3D11_RTV_DIMENSION_TEXTURE2DMS;
+ rtvDesc.Texture2D.MipSlice = 0;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(allocateResource(context11, rtvDesc, texture.get(), &rtv));
+ rtv.setDebugName("createRenderTarget.RTV");
+
+ if (formatInfo.dataInitializerFunction != nullptr)
+ {
+ const float clearValues[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+ mDeviceContext->ClearRenderTargetView(rtv.get(), clearValues);
+ }
+
+ *outRT = new TextureRenderTarget11(std::move(rtv), texture, srv, blitSRV, format,
+ formatInfo, width, height, 1, supportedSamples);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ *outRT = new TextureRenderTarget11(d3d11::RenderTargetView(), TextureHelper11(),
+ d3d11::SharedSRV(), d3d11::SharedSRV(), format,
+ d3d11::Format::Get(GL_NONE, mRenderer11DeviceCaps),
+ width, height, 1, supportedSamples);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(source != nullptr);
+
+ RenderTargetD3D *newRT = nullptr;
+ ANGLE_TRY(createRenderTarget(context, source->getWidth(), source->getHeight(),
+ source->getInternalFormat(), source->getSamples(), &newRT));
+
+ RenderTarget11 *source11 = GetAs<RenderTarget11>(source);
+ RenderTarget11 *dest11 = GetAs<RenderTarget11>(newRT);
+
+ mDeviceContext->CopySubresourceRegion(dest11->getTexture().get(), dest11->getSubresourceIndex(),
+ 0, 0, 0, source11->getTexture().get(),
+ source11->getSubresourceIndex(), nullptr);
+ *outRT = newRT;
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::loadExecutable(d3d::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable)
+{
+ ShaderData shaderData(function, length);
+
+ switch (type)
+ {
+ case gl::ShaderType::Vertex:
+ {
+ d3d11::VertexShader vertexShader;
+ d3d11::GeometryShader streamOutShader;
+ ANGLE_TRY(allocateResource(context, shaderData, &vertexShader));
+
+ if (!streamOutVaryings.empty())
+ {
+ std::vector<D3D11_SO_DECLARATION_ENTRY> soDeclaration;
+ soDeclaration.reserve(streamOutVaryings.size());
+
+ for (const auto &streamOutVarying : streamOutVaryings)
+ {
+ D3D11_SO_DECLARATION_ENTRY entry = {0};
+ entry.Stream = 0;
+ entry.SemanticName = streamOutVarying.semanticName.c_str();
+ entry.SemanticIndex = streamOutVarying.semanticIndex;
+ entry.StartComponent = 0;
+ entry.ComponentCount = static_cast<BYTE>(streamOutVarying.componentCount);
+ entry.OutputSlot = static_cast<BYTE>(
+ (separatedOutputBuffers ? streamOutVarying.outputSlot : 0));
+ soDeclaration.push_back(entry);
+ }
+
+ ANGLE_TRY(allocateResource(context, shaderData, &soDeclaration, &streamOutShader));
+ }
+
+ *outExecutable = new ShaderExecutable11(function, length, std::move(vertexShader),
+ std::move(streamOutShader));
+ }
+ break;
+ case gl::ShaderType::Fragment:
+ {
+ d3d11::PixelShader pixelShader;
+ ANGLE_TRY(allocateResource(context, shaderData, &pixelShader));
+ *outExecutable = new ShaderExecutable11(function, length, std::move(pixelShader));
+ }
+ break;
+ case gl::ShaderType::Geometry:
+ {
+ d3d11::GeometryShader geometryShader;
+ ANGLE_TRY(allocateResource(context, shaderData, &geometryShader));
+ *outExecutable = new ShaderExecutable11(function, length, std::move(geometryShader));
+ }
+ break;
+ case gl::ShaderType::Compute:
+ {
+ d3d11::ComputeShader computeShader;
+ ANGLE_TRY(allocateResource(context, shaderData, &computeShader));
+ *outExecutable = new ShaderExecutable11(function, length, std::move(computeShader));
+ }
+ break;
+ default:
+ ANGLE_HR_UNREACHABLE(context);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::compileToExecutable(d3d::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable)
+{
+ std::stringstream profileStream;
+
+ switch (type)
+ {
+ case gl::ShaderType::Vertex:
+ profileStream << "vs";
+ break;
+ case gl::ShaderType::Fragment:
+ profileStream << "ps";
+ break;
+ case gl::ShaderType::Geometry:
+ profileStream << "gs";
+ break;
+ case gl::ShaderType::Compute:
+ profileStream << "cs";
+ break;
+ default:
+ ANGLE_HR_UNREACHABLE(context);
+ }
+
+ profileStream << "_" << getMajorShaderModel() << "_" << getMinorShaderModel()
+ << getShaderModelSuffix();
+ std::string profile = profileStream.str();
+
+ UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2;
+
+ if (gl::DebugAnnotationsActive())
+ {
+#ifndef NDEBUG
+ flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+#endif
+
+ flags |= D3DCOMPILE_DEBUG;
+ }
+
+ if (workarounds.enableIEEEStrictness)
+ flags |= D3DCOMPILE_IEEE_STRICTNESS;
+
+ // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders
+ // when it would otherwise pass with alternative options.
+ // Try the default flags first and if compilation fails, try some alternatives.
+ std::vector<CompileConfig> configs;
+ configs.push_back(CompileConfig(flags, "default"));
+ configs.push_back(CompileConfig(flags | D3DCOMPILE_SKIP_VALIDATION, "skip validation"));
+ configs.push_back(CompileConfig(flags | D3DCOMPILE_SKIP_OPTIMIZATION, "skip optimization"));
+
+ if (getMajorShaderModel() == 4 && getShaderModelSuffix() != "")
+ {
+ // Some shaders might cause a "blob content mismatch between level9 and d3d10 shader".
+ // e.g. dEQP-GLES2.functional.shaders.struct.local.loop_nested_struct_array_*.
+ // Using the [unroll] directive works around this, as does this D3DCompile flag.
+ configs.push_back(
+ CompileConfig(flags | D3DCOMPILE_AVOID_FLOW_CONTROL, "avoid flow control"));
+ }
+
+ D3D_SHADER_MACRO loopMacros[] = {{"ANGLE_ENABLE_LOOP_FLATTEN", "1"}, {0, 0}};
+
+ // TODO(jmadill): Use ComPtr?
+ ID3DBlob *binary = nullptr;
+ std::string debugInfo;
+ ANGLE_TRY(mCompiler.compileToBinary(context, infoLog, shaderHLSL, profile, configs, loopMacros,
+ &binary, &debugInfo));
+
+ // It's possible that binary is NULL if the compiler failed in all configurations. Set the
+ // executable to NULL and return GL_NO_ERROR to signify that there was a link error but the
+ // internal state is still OK.
+ if (!binary)
+ {
+ *outExectuable = nullptr;
+ return angle::Result::Continue;
+ }
+
+ angle::Result error = loadExecutable(
+ context, static_cast<const uint8_t *>(binary->GetBufferPointer()), binary->GetBufferSize(),
+ type, streamOutVaryings, separatedOutputBuffers, outExectuable);
+
+ SafeRelease(binary);
+ if (error == angle::Result::Stop)
+ {
+ return error;
+ }
+
+ if (!debugInfo.empty())
+ {
+ (*outExectuable)->appendDebugInfo(debugInfo);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::ensureHLSLCompilerInitialized(d3d::Context *context)
+{
+ return mCompiler.ensureInitialized(context);
+}
+
+UniformStorageD3D *Renderer11::createUniformStorage(size_t storageSize)
+{
+ return new UniformStorage11(storageSize);
+}
+
+VertexBuffer *Renderer11::createVertexBuffer()
+{
+ return new VertexBuffer11(this);
+}
+
+IndexBuffer *Renderer11::createIndexBuffer()
+{
+ return new IndexBuffer11(this);
+}
+
+StreamProducerImpl *Renderer11::createStreamProducerD3DTexture(
+ egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs)
+{
+ return new StreamProducerD3DTexture(this);
+}
+
+bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
+{
+ ASSERT(getNativeExtensions().pixelBufferObject);
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetSizedInternalFormatInfo(internalFormat);
+ const d3d11::Format &d3d11FormatInfo =
+ d3d11::Format::Get(internalFormat, mRenderer11DeviceCaps);
+
+ // sRGB formats do not work with D3D11 buffer SRVs
+ if (internalFormatInfo.colorEncoding == GL_SRGB)
+ {
+ return false;
+ }
+
+ // We cannot support direct copies to non-color-renderable formats
+ if (d3d11FormatInfo.rtvFormat == DXGI_FORMAT_UNKNOWN)
+ {
+ return false;
+ }
+
+ // We skip all 3-channel formats since sometimes format support is missing
+ if (internalFormatInfo.componentCount == 3)
+ {
+ return false;
+ }
+
+ // We don't support formats which we can't represent without conversion
+ if (d3d11FormatInfo.format().glInternalFormat != internalFormat)
+ {
+ return false;
+ }
+
+ // Buffer SRV creation for this format was not working on Windows 10.
+ if (d3d11FormatInfo.texFormat == DXGI_FORMAT_B5G5R5A1_UNORM)
+ {
+ return false;
+ }
+
+ // This format is not supported as a buffer SRV.
+ if (d3d11FormatInfo.texFormat == DXGI_FORMAT_A8_UNORM)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+angle::Result Renderer11::fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea)
+{
+ ASSERT(supportsFastCopyBufferToTexture(destinationFormat));
+ return mPixelTransfer->copyBufferToTexture(context, unpack, offset, destRenderTarget,
+ destinationFormat, sourcePixelsType, destArea);
+}
+
+ImageD3D *Renderer11::createImage()
+{
+ return new Image11(this);
+}
+
+ExternalImageSiblingImpl *Renderer11::createExternalImageSibling(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs)
+{
+ switch (target)
+ {
+ case EGL_D3D11_TEXTURE_ANGLE:
+ return new ExternalImageSiblingImpl11(this, buffer);
+
+ default:
+ UNREACHABLE();
+ return nullptr;
+ }
+}
+
+angle::Result Renderer11::generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *src)
+{
+ Image11 *dest11 = GetAs<Image11>(dest);
+ Image11 *src11 = GetAs<Image11>(src);
+ return Image11::GenerateMipmap(context, dest11, src11, mRenderer11DeviceCaps);
+}
+
+angle::Result Renderer11::generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState)
+{
+ TextureStorage11 *storage11 = GetAs<TextureStorage11>(storage);
+
+ ASSERT(storage11->isRenderTarget());
+ ASSERT(storage11->supportsNativeMipmapFunction());
+
+ const d3d11::SharedSRV *srv = nullptr;
+ ANGLE_TRY(storage11->getSRVLevels(context, textureState.getEffectiveBaseLevel(),
+ textureState.getEffectiveMaxLevel(), &srv));
+
+ mDeviceContext->GenerateMips(srv->get());
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Box &sourceBox,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
+{
+ Image11 *dest11 = GetAs<Image11>(dest);
+ Image11 *src11 = GetAs<Image11>(source);
+ return Image11::CopyImage(context, dest11, src11, sourceBox, destOffset, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha, mRenderer11DeviceCaps);
+}
+
+TextureStorage *Renderer11::createTextureStorage2D(SwapChainD3D *swapChain)
+{
+ SwapChain11 *swapChain11 = GetAs<SwapChain11>(swapChain);
+ return new TextureStorage11_2D(this, swapChain11);
+}
+
+TextureStorage *Renderer11::createTextureStorageEGLImage(EGLImageD3D *eglImage,
+ RenderTargetD3D *renderTargetD3D)
+{
+ return new TextureStorage11_EGLImage(this, eglImage, GetAs<RenderTarget11>(renderTargetD3D));
+}
+
+TextureStorage *Renderer11::createTextureStorageExternal(
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc)
+{
+ return new TextureStorage11_External(this, stream, desc);
+}
+
+TextureStorage *Renderer11::createTextureStorage2D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ bool hintLevelZeroOnly)
+{
+ return new TextureStorage11_2D(this, internalformat, renderTarget, width, height, levels,
+ hintLevelZeroOnly);
+}
+
+TextureStorage *Renderer11::createTextureStorageCube(GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly)
+{
+ return new TextureStorage11_Cube(this, internalformat, renderTarget, size, levels,
+ hintLevelZeroOnly);
+}
+
+TextureStorage *Renderer11::createTextureStorage3D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels)
+{
+ return new TextureStorage11_3D(this, internalformat, renderTarget, width, height, depth,
+ levels);
+}
+
+TextureStorage *Renderer11::createTextureStorage2DArray(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels)
+{
+ return new TextureStorage11_2DArray(this, internalformat, renderTarget, width, height, depth,
+ levels);
+}
+
+TextureStorage *Renderer11::createTextureStorage2DMultisample(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ int samples,
+ bool fixedSampleLocations)
+{
+ return new TextureStorage11_2DMultisample(this, internalformat, width, height, levels, samples,
+ fixedSampleLocations);
+}
+
+TextureStorage *Renderer11::createTextureStorage2DMultisampleArray(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels,
+ int samples,
+ bool fixedSampleLocations)
+{
+ return new TextureStorage11_2DMultisampleArray(this, internalformat, width, height, depth,
+ levels, samples, fixedSampleLocations);
+}
+
+angle::Result Renderer11::readFromAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment &srcAttachment,
+ const gl::Rectangle &sourceArea,
+ GLenum format,
+ GLenum type,
+ GLuint outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixelsOut)
+{
+ ASSERT(sourceArea.width >= 0);
+ ASSERT(sourceArea.height >= 0);
+
+ const bool invertTexture = UsePresentPathFast(this, &srcAttachment);
+
+ RenderTarget11 *rt11 = nullptr;
+ ANGLE_TRY(srcAttachment.getRenderTarget(context, &rt11));
+ ASSERT(rt11->getTexture().valid());
+
+ const TextureHelper11 &textureHelper = rt11->getTexture();
+ unsigned int sourceSubResource = rt11->getSubresourceIndex();
+
+ const gl::Extents &texSize = textureHelper.getExtents();
+
+ gl::Rectangle actualArea = sourceArea;
+ bool reverseRowOrder = pack.reverseRowOrder;
+ if (invertTexture)
+ {
+ actualArea.y = texSize.height - actualArea.y - actualArea.height;
+ reverseRowOrder = !reverseRowOrder;
+ }
+
+ // 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(actualArea.x, 0, texSize.width);
+ safeArea.y = gl::clamp(actualArea.y, 0, texSize.height);
+ safeArea.width =
+ gl::clamp(actualArea.width + std::min(actualArea.x, 0), 0, texSize.width - safeArea.x);
+ safeArea.height =
+ gl::clamp(actualArea.height + std::min(actualArea.y, 0), 0, texSize.height - safeArea.y);
+
+ ASSERT(safeArea.x >= 0 && safeArea.y >= 0);
+ ASSERT(safeArea.x + safeArea.width <= texSize.width);
+ ASSERT(safeArea.y + safeArea.height <= texSize.height);
+
+ if (safeArea.width == 0 || safeArea.height == 0)
+ {
+ // no work to do
+ return angle::Result::Continue;
+ }
+
+ gl::Extents safeSize(safeArea.width, safeArea.height, 1);
+ TextureHelper11 stagingHelper;
+ ANGLE_TRY(createStagingTexture(context, textureHelper.getTextureType(),
+ textureHelper.getFormatSet(), safeSize, StagingAccess::READ,
+ &stagingHelper));
+ stagingHelper.setDebugName("readFromAttachment::stagingHelper");
+
+ TextureHelper11 resolvedTextureHelper;
+
+ // "srcTexture" usually points to the source texture.
+ // For 2D multisampled textures, it points to the multisampled resolve texture.
+ const TextureHelper11 *srcTexture = &textureHelper;
+
+ if (textureHelper.is2D() && textureHelper.getSampleCount() > 1)
+ {
+ D3D11_TEXTURE2D_DESC resolveDesc;
+ resolveDesc.Width = static_cast<UINT>(texSize.width);
+ resolveDesc.Height = static_cast<UINT>(texSize.height);
+ resolveDesc.MipLevels = 1;
+ resolveDesc.ArraySize = 1;
+ resolveDesc.Format = textureHelper.getFormat();
+ resolveDesc.SampleDesc.Count = 1;
+ resolveDesc.SampleDesc.Quality = 0;
+ resolveDesc.Usage = D3D11_USAGE_DEFAULT;
+ resolveDesc.BindFlags = 0;
+ resolveDesc.CPUAccessFlags = 0;
+ resolveDesc.MiscFlags = 0;
+
+ ANGLE_TRY(allocateTexture(GetImplAs<Context11>(context), resolveDesc,
+ textureHelper.getFormatSet(), &resolvedTextureHelper));
+ resolvedTextureHelper.setDebugName("readFromAttachment::resolvedTextureHelper");
+
+ mDeviceContext->ResolveSubresource(resolvedTextureHelper.get(), 0, textureHelper.get(),
+ sourceSubResource, textureHelper.getFormat());
+
+ sourceSubResource = 0;
+ srcTexture = &resolvedTextureHelper;
+ }
+
+ D3D11_BOX srcBox;
+ 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);
+
+ // Select the correct layer from a 3D attachment
+ srcBox.front = 0;
+ if (textureHelper.is3D())
+ {
+ srcBox.front = static_cast<UINT>(srcAttachment.layer());
+ }
+ srcBox.back = srcBox.front + 1;
+
+ mDeviceContext->CopySubresourceRegion(stagingHelper.get(), 0, 0, 0, 0, srcTexture->get(),
+ sourceSubResource, &srcBox);
+
+ const angle::Format &angleFormat = GetFormatFromFormatType(format, type);
+ gl::Buffer *packBuffer = context->getState().getTargetBuffer(gl::BufferBinding::PixelPack);
+
+ PackPixelsParams packParams(safeArea, angleFormat, outputPitch, reverseRowOrder, packBuffer, 0);
+ return packPixels(context, stagingHelper, packParams, pixelsOut);
+}
+
+angle::Result Renderer11::packPixels(const gl::Context *context,
+ const TextureHelper11 &textureHelper,
+ const PackPixelsParams &params,
+ uint8_t *pixelsOut)
+{
+ ID3D11Resource *readResource = textureHelper.get();
+
+ D3D11_MAPPED_SUBRESOURCE mapping;
+ ANGLE_TRY(mapResource(context, readResource, 0, D3D11_MAP_READ, 0, &mapping));
+
+ uint8_t *source = static_cast<uint8_t *>(mapping.pData);
+ int inputPitch = static_cast<int>(mapping.RowPitch);
+
+ const auto &formatInfo = textureHelper.getFormatSet();
+ ASSERT(formatInfo.format().glInternalFormat != GL_NONE);
+
+ PackPixels(params, formatInfo.format(), inputPitch, source, pixelsOut);
+
+ mDeviceContext->Unmap(readResource, 0);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::blitRenderbufferRect(const gl::Context *context,
+ const gl::Rectangle &readRectIn,
+ const gl::Rectangle &drawRectIn,
+ RenderTargetD3D *readRenderTarget,
+ RenderTargetD3D *drawRenderTarget,
+ GLenum filter,
+ const gl::Rectangle *scissor,
+ bool colorBlit,
+ bool depthBlit,
+ bool stencilBlit)
+{
+ // Since blitRenderbufferRect is called for each render buffer that needs to be blitted,
+ // it should never be the case that both color and depth/stencil need to be blitted at
+ // at the same time.
+ ASSERT(colorBlit != (depthBlit || stencilBlit));
+
+ RenderTarget11 *drawRenderTarget11 = GetAs<RenderTarget11>(drawRenderTarget);
+ ASSERT(drawRenderTarget11);
+
+ const TextureHelper11 &drawTexture = drawRenderTarget11->getTexture();
+ unsigned int drawSubresource = drawRenderTarget11->getSubresourceIndex();
+
+ RenderTarget11 *readRenderTarget11 = GetAs<RenderTarget11>(readRenderTarget);
+ ASSERT(readRenderTarget11);
+
+ TextureHelper11 readTexture;
+ unsigned int readSubresource = 0;
+ d3d11::SharedSRV readSRV;
+
+ if (readRenderTarget->isMultisampled())
+ {
+ ANGLE_TRY(resolveMultisampledTexture(context, readRenderTarget11, depthBlit, stencilBlit,
+ &readTexture));
+
+ if (!stencilBlit)
+ {
+ const auto &readFormatSet = readTexture.getFormatSet();
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC viewDesc;
+ viewDesc.Format = readFormatSet.srvFormat;
+ viewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ viewDesc.Texture2D.MipLevels = 1;
+ viewDesc.Texture2D.MostDetailedMip = 0;
+
+ ANGLE_TRY(allocateResource(GetImplAs<Context11>(context), viewDesc, readTexture.get(),
+ &readSRV));
+ }
+ }
+ else
+ {
+ ASSERT(readRenderTarget11);
+ readTexture = readRenderTarget11->getTexture();
+ readSubresource = readRenderTarget11->getSubresourceIndex();
+ readSRV = readRenderTarget11->getBlitShaderResourceView(context).makeCopy();
+ if (!readSRV.valid())
+ {
+ ASSERT(depthBlit || stencilBlit);
+ readSRV = readRenderTarget11->getShaderResourceView(context).makeCopy();
+ }
+ ASSERT(readSRV.valid());
+ }
+
+ // Stencil blits don't use shaders.
+ ASSERT(readSRV.valid() || stencilBlit);
+
+ const gl::Extents readSize(readRenderTarget->getWidth(), readRenderTarget->getHeight(), 1);
+ const gl::Extents drawSize(drawRenderTarget->getWidth(), drawRenderTarget->getHeight(), 1);
+
+ // From the spec:
+ // "The actual region taken from the read framebuffer is limited to the intersection of the
+ // source buffers being transferred, which may include the color buffer selected by the read
+ // buffer, the depth buffer, and / or the stencil buffer depending on mask."
+ // This means negative x and y are out of bounds, and not to be read from. We handle this here
+ // by internally scaling the read and draw rectangles.
+
+ // Remove reversal from readRect to simplify further operations.
+ gl::Rectangle readRect = readRectIn;
+ gl::Rectangle drawRect = drawRectIn;
+ if (readRect.isReversedX())
+ {
+ readRect.x = readRect.x + readRect.width;
+ readRect.width = -readRect.width;
+ drawRect.x = drawRect.x + drawRect.width;
+ drawRect.width = -drawRect.width;
+ }
+ if (readRect.isReversedY())
+ {
+ readRect.y = readRect.y + readRect.height;
+ readRect.height = -readRect.height;
+ drawRect.y = drawRect.y + drawRect.height;
+ drawRect.height = -drawRect.height;
+ }
+
+ gl::Rectangle readBounds(0, 0, readSize.width, readSize.height);
+ gl::Rectangle inBoundsReadRect;
+ if (!gl::ClipRectangle(readRect, readBounds, &inBoundsReadRect))
+ {
+ return angle::Result::Continue;
+ }
+
+ {
+ // Calculate the drawRect that corresponds to inBoundsReadRect.
+ auto readToDrawX = [&drawRect, &readRect](int readOffset) {
+ double readToDrawScale =
+ static_cast<double>(drawRect.width) / static_cast<double>(readRect.width);
+ return static_cast<int>(
+ round(static_cast<double>(readOffset - readRect.x) * readToDrawScale) + drawRect.x);
+ };
+ auto readToDrawY = [&drawRect, &readRect](int readOffset) {
+ double readToDrawScale =
+ static_cast<double>(drawRect.height) / static_cast<double>(readRect.height);
+ return static_cast<int>(
+ round(static_cast<double>(readOffset - readRect.y) * readToDrawScale) + drawRect.y);
+ };
+
+ gl::Rectangle drawRectMatchingInBoundsReadRect;
+ drawRectMatchingInBoundsReadRect.x = readToDrawX(inBoundsReadRect.x);
+ drawRectMatchingInBoundsReadRect.y = readToDrawY(inBoundsReadRect.y);
+ drawRectMatchingInBoundsReadRect.width =
+ readToDrawX(inBoundsReadRect.x1()) - drawRectMatchingInBoundsReadRect.x;
+ drawRectMatchingInBoundsReadRect.height =
+ readToDrawY(inBoundsReadRect.y1()) - drawRectMatchingInBoundsReadRect.y;
+ drawRect = drawRectMatchingInBoundsReadRect;
+ readRect = inBoundsReadRect;
+ }
+
+ bool scissorNeeded = false;
+ if (scissor)
+ {
+ gl::Rectangle scissoredDrawRect;
+ if (!gl::ClipRectangle(drawRect, *scissor, &scissoredDrawRect))
+ {
+ return angle::Result::Continue;
+ }
+ scissorNeeded = scissoredDrawRect != drawRect;
+ }
+
+ const auto &destFormatInfo =
+ gl::GetSizedInternalFormatInfo(drawRenderTarget->getInternalFormat());
+ const auto &srcFormatInfo =
+ gl::GetSizedInternalFormatInfo(readRenderTarget->getInternalFormat());
+ const auto &formatSet = drawRenderTarget11->getFormatSet();
+ const auto &nativeFormat = formatSet.format();
+
+ // Some blits require masking off emulated texture channels. eg: from RGBA8 to RGB8, we
+ // emulate RGB8 with RGBA8, so we need to mask off the alpha channel when we copy.
+
+ gl::Color<bool> colorMask;
+ colorMask.red =
+ (srcFormatInfo.redBits > 0) && (destFormatInfo.redBits == 0) && (nativeFormat.redBits > 0);
+ colorMask.green = (srcFormatInfo.greenBits > 0) && (destFormatInfo.greenBits == 0) &&
+ (nativeFormat.greenBits > 0);
+ colorMask.blue = (srcFormatInfo.blueBits > 0) && (destFormatInfo.blueBits == 0) &&
+ (nativeFormat.blueBits > 0);
+ colorMask.alpha = (srcFormatInfo.alphaBits > 0) && (destFormatInfo.alphaBits == 0) &&
+ (nativeFormat.alphaBits > 0);
+
+ // We only currently support masking off the alpha channel.
+ bool colorMaskingNeeded = colorMask.alpha;
+ ASSERT(!colorMask.red && !colorMask.green && !colorMask.blue);
+
+ bool wholeBufferCopy = !scissorNeeded && !colorMaskingNeeded && 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;
+
+ bool stretchRequired = readRect.width != drawRect.width || readRect.height != drawRect.height;
+
+ ASSERT(!readRect.isReversedX() && !readRect.isReversedY());
+ bool reversalRequired = drawRect.isReversedX() || drawRect.isReversedY();
+
+ 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 partialDSBlit =
+ (nativeFormat.depthBits > 0 && depthBlit) != (nativeFormat.stencilBits > 0 && stencilBlit);
+
+ if (readRenderTarget11->getFormatSet().formatID ==
+ drawRenderTarget11->getFormatSet().formatID &&
+ !stretchRequired && !outOfBounds && !reversalRequired && !partialDSBlit &&
+ !colorMaskingNeeded && (!(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 ? nullptr : &readBox;
+
+ mDeviceContext->CopySubresourceRegion(drawTexture.get(), drawSubresource, dstX, dstY, 0,
+ readTexture.get(), readSubresource, pSrcBox);
+ }
+ 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)
+ {
+ ANGLE_TRY(mBlit->copyDepthStencil(context, readTexture, readSubresource, readArea,
+ readSize, drawTexture, drawSubresource, drawArea,
+ drawSize, scissor));
+ }
+ else if (depthBlit)
+ {
+ const d3d11::DepthStencilView &drawDSV = drawRenderTarget11->getDepthStencilView();
+ ASSERT(readSRV.valid());
+ ANGLE_TRY(mBlit->copyDepth(context, readSRV, readArea, readSize, drawDSV, drawArea,
+ drawSize, scissor));
+ }
+ else if (stencilBlit)
+ {
+ ANGLE_TRY(mBlit->copyStencil(context, readTexture, readSubresource, readArea, readSize,
+ drawTexture, drawSubresource, drawArea, drawSize,
+ scissor));
+ }
+ else
+ {
+ const d3d11::RenderTargetView &drawRTV = drawRenderTarget11->getRenderTargetView();
+
+ // We don't currently support masking off any other channel than alpha
+ bool maskOffAlpha = colorMaskingNeeded && colorMask.alpha;
+ ASSERT(readSRV.valid());
+ ANGLE_TRY(mBlit->copyTexture(context, readSRV, readArea, readSize, srcFormatInfo.format,
+ drawRTV, drawArea, drawSize, scissor,
+ destFormatInfo.format, GL_NONE, filter, maskOffAlpha,
+ false, false));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+bool Renderer11::isES3Capable() const
+{
+ return (d3d11_gl::GetMaximumClientVersion(mRenderer11DeviceCaps).major > 2);
+}
+
+RendererClass Renderer11::getRendererClass() const
+{
+ return RENDERER_D3D11;
+}
+
+void Renderer11::onSwap()
+{
+ // Send histogram updates every half hour
+ const double kHistogramUpdateInterval = 30 * 60;
+
+ auto *platform = ANGLEPlatformCurrent();
+ const double currentTime = platform->monotonicallyIncreasingTime(platform);
+ const double timeSinceLastUpdate = currentTime - mLastHistogramUpdateTime;
+
+ if (timeSinceLastUpdate > kHistogramUpdateInterval)
+ {
+ updateHistograms();
+ mLastHistogramUpdateTime = currentTime;
+ }
+}
+
+void Renderer11::updateHistograms()
+{
+ // Update the buffer CPU memory histogram
+ {
+ size_t sizeSum = 0;
+ for (const Buffer11 *buffer : mAliveBuffers)
+ {
+ sizeSum += buffer->getTotalCPUBufferMemoryBytes();
+ }
+ const int kOneMegaByte = 1024 * 1024;
+ ANGLE_HISTOGRAM_MEMORY_MB("GPU.ANGLE.Buffer11CPUMemoryMB",
+ static_cast<int>(sizeSum) / kOneMegaByte);
+ }
+}
+
+void Renderer11::onBufferCreate(const Buffer11 *created)
+{
+ mAliveBuffers.insert(created);
+}
+
+void Renderer11::onBufferDelete(const Buffer11 *deleted)
+{
+ mAliveBuffers.erase(deleted);
+}
+
+angle::Result Renderer11::resolveMultisampledTexture(const gl::Context *context,
+ RenderTarget11 *renderTarget,
+ bool depth,
+ bool stencil,
+ TextureHelper11 *textureOut)
+{
+ if (depth && !stencil)
+ {
+ return mBlit->resolveDepth(context, renderTarget, textureOut);
+ }
+
+ if (stencil)
+ {
+ return mBlit->resolveStencil(context, renderTarget, depth, textureOut);
+ }
+
+ const auto &formatSet = renderTarget->getFormatSet();
+
+ ASSERT(renderTarget->isMultisampled());
+ const d3d11::SharedSRV &sourceSRV = renderTarget->getShaderResourceView(context);
+ D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
+ sourceSRV.get()->GetDesc(&sourceSRVDesc);
+ ASSERT(sourceSRVDesc.ViewDimension == D3D_SRV_DIMENSION_TEXTURE2DMS ||
+ sourceSRVDesc.ViewDimension == D3D_SRV_DIMENSION_TEXTURE2DMSARRAY);
+
+ if (!mCachedResolveTexture.valid() ||
+ mCachedResolveTexture.getExtents().width != renderTarget->getWidth() ||
+ mCachedResolveTexture.getExtents().height != renderTarget->getHeight() ||
+ mCachedResolveTexture.getFormat() != formatSet.texFormat)
+ {
+ D3D11_TEXTURE2D_DESC resolveDesc;
+ resolveDesc.Width = renderTarget->getWidth();
+ resolveDesc.Height = renderTarget->getHeight();
+ resolveDesc.MipLevels = 1;
+ resolveDesc.ArraySize = 1;
+ resolveDesc.Format = formatSet.texFormat;
+ resolveDesc.SampleDesc.Count = 1;
+ resolveDesc.SampleDesc.Quality = 0;
+ resolveDesc.Usage = D3D11_USAGE_DEFAULT;
+ resolveDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ resolveDesc.CPUAccessFlags = 0;
+ resolveDesc.MiscFlags = 0;
+
+ ANGLE_TRY(allocateTexture(GetImplAs<Context11>(context), resolveDesc, formatSet,
+ &mCachedResolveTexture));
+ }
+
+ mDeviceContext->ResolveSubresource(mCachedResolveTexture.get(), 0,
+ renderTarget->getTexture().get(),
+ renderTarget->getSubresourceIndex(), formatSet.texFormat);
+ *textureOut = mCachedResolveTexture;
+ return angle::Result::Continue;
+}
+
+bool Renderer11::getLUID(LUID *adapterLuid) const
+{
+ adapterLuid->HighPart = 0;
+ adapterLuid->LowPart = 0;
+
+ if (!mDxgiAdapter)
+ {
+ return false;
+ }
+
+ DXGI_ADAPTER_DESC adapterDesc;
+ if (FAILED(mDxgiAdapter->GetDesc(&adapterDesc)))
+ {
+ return false;
+ }
+
+ *adapterLuid = adapterDesc.AdapterLuid;
+ return true;
+}
+
+VertexConversionType Renderer11::getVertexConversionType(angle::FormatID vertexFormatID) const
+{
+ return d3d11::GetVertexFormatInfo(vertexFormatID, mRenderer11DeviceCaps.featureLevel)
+ .conversionType;
+}
+
+GLenum Renderer11::getVertexComponentType(angle::FormatID vertexFormatID) const
+{
+ const auto &format =
+ d3d11::GetVertexFormatInfo(vertexFormatID, mRenderer11DeviceCaps.featureLevel);
+ return d3d11::GetComponentType(format.nativeFormat);
+}
+
+angle::Result Renderer11::getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const
+{
+ if (!attrib.enabled)
+ {
+ *bytesRequiredOut = 16u;
+ return angle::Result::Continue;
+ }
+
+ unsigned int elementCount = 0;
+ const unsigned int divisor = binding.getDivisor();
+ if (instances == 0 || divisor == 0)
+ {
+ // This could be a clipped cast.
+ elementCount = gl::clampCast<unsigned int>(count);
+ }
+ else
+ {
+ // Round up to divisor, if possible
+ elementCount = UnsignedCeilDivide(static_cast<unsigned int>(instances), divisor);
+ }
+
+ ASSERT(elementCount > 0);
+
+ const D3D_FEATURE_LEVEL featureLevel = mRenderer11DeviceCaps.featureLevel;
+ const d3d11::VertexFormat &vertexFormatInfo =
+ d3d11::GetVertexFormatInfo(attrib.format->id, featureLevel);
+ const d3d11::DXGIFormatSize &dxgiFormatInfo =
+ d3d11::GetDXGIFormatSizeInfo(vertexFormatInfo.nativeFormat);
+ unsigned int elementSize = dxgiFormatInfo.pixelBytes;
+ bool check = (elementSize > std::numeric_limits<unsigned int>::max() / elementCount);
+ ANGLE_CHECK(GetImplAs<Context11>(context), !check,
+ "New vertex buffer size would result in an overflow.", GL_OUT_OF_MEMORY);
+
+ *bytesRequiredOut = elementSize * elementCount;
+ return angle::Result::Continue;
+}
+
+void Renderer11::generateCaps(gl::Caps *outCaps,
+ gl::TextureCapsMap *outTextureCaps,
+ gl::Extensions *outExtensions,
+ gl::Limitations *outLimitations) const
+{
+ d3d11_gl::GenerateCaps(mDevice, mDeviceContext, mRenderer11DeviceCaps, getFeatures(), outCaps,
+ outTextureCaps, outExtensions, outLimitations);
+}
+
+void Renderer11::initializeFeatures(angle::FeaturesD3D *features) const
+{
+ d3d11::InitializeFeatures(mRenderer11DeviceCaps, mAdapterDescription, features);
+ OverrideFeaturesWithDisplayState(features, mDisplay->getState());
+}
+
+DeviceImpl *Renderer11::createEGLDevice()
+{
+ return new DeviceD3D(EGL_D3D11_DEVICE_ANGLE, mDevice);
+}
+
+ContextImpl *Renderer11::createContext(const gl::State &state, gl::ErrorSet *errorSet)
+{
+ return new Context11(state, errorSet, this);
+}
+
+FramebufferImpl *Renderer11::createDefaultFramebuffer(const gl::FramebufferState &state)
+{
+ return new Framebuffer11(state, this);
+}
+
+angle::Result Renderer11::getScratchMemoryBuffer(Context11 *context11,
+ size_t requestedSize,
+ angle::MemoryBuffer **bufferOut)
+{
+ ANGLE_CHECK_GL_ALLOC(context11, mScratchMemoryBuffer.get(requestedSize, bufferOut));
+ return angle::Result::Continue;
+}
+
+gl::Version Renderer11::getMaxSupportedESVersion() const
+{
+ return d3d11_gl::GetMaximumClientVersion(mRenderer11DeviceCaps);
+}
+
+gl::Version Renderer11::getMaxConformantESVersion() const
+{
+ // 3.1 support is in progress.
+ return std::min(getMaxSupportedESVersion(), gl::Version(3, 0));
+}
+
+gl::DebugAnnotator *Renderer11::getAnnotator()
+{
+ return &mAnnotator;
+}
+
+angle::Result Renderer11::dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ)
+{
+ const gl::State &glState = context->getState();
+ const gl::Program *program = glState.getProgram();
+ if (program->getActiveShaderStorageBlockCount() > 0 ||
+ program->getActiveAtomicCounterBufferCount() > 0)
+ {
+ ANGLE_TRY(markRawBufferUsage(context));
+ }
+
+ ANGLE_TRY(mStateManager.updateStateForCompute(context, numGroupsX, numGroupsY, numGroupsZ));
+ mDeviceContext->Dispatch(numGroupsX, numGroupsY, numGroupsZ);
+
+ return angle::Result::Continue;
+}
+angle::Result Renderer11::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect)
+{
+ const auto &glState = context->getState();
+ const gl::Program *program = glState.getProgram();
+ if (program->getActiveShaderStorageBlockCount() > 0 ||
+ program->getActiveAtomicCounterBufferCount() > 0)
+ {
+ ANGLE_TRY(markRawBufferUsage(context));
+ }
+
+ auto *dispatchIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DispatchIndirect);
+ ASSERT(dispatchIndirectBuffer);
+
+ Buffer11 *storage = GetImplAs<Buffer11>(dispatchIndirectBuffer);
+ const uint8_t *bufferData = nullptr;
+ // TODO(jie.a.chen@intel.com): num_groups_x,y,z have to be written into the driver constant
+ // buffer for the built-in variable gl_NumWorkGroups. There is an opportunity for optimization
+ // to use GPU->GPU copy instead.
+ // http://anglebug.com/2807
+ ANGLE_TRY(storage->getData(context, &bufferData));
+ const GLuint *groups = reinterpret_cast<const GLuint *>(bufferData + indirect);
+ ANGLE_TRY(mStateManager.updateStateForCompute(context, groups[0], groups[1], groups[2]));
+
+ ID3D11Buffer *buffer = nullptr;
+ ANGLE_TRY(storage->getBuffer(context, BUFFER_USAGE_INDIRECT, &buffer));
+
+ mDeviceContext->DispatchIndirect(buffer, static_cast<UINT>(indirect));
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::createStagingTexture(const gl::Context *context,
+ ResourceType textureType,
+ const d3d11::Format &formatSet,
+ const gl::Extents &size,
+ StagingAccess readAndWriteAccess,
+ TextureHelper11 *textureOut)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (textureType == ResourceType::Texture2D)
+ {
+ D3D11_TEXTURE2D_DESC stagingDesc;
+ stagingDesc.Width = size.width;
+ stagingDesc.Height = size.height;
+ stagingDesc.MipLevels = 1;
+ stagingDesc.ArraySize = 1;
+ stagingDesc.Format = formatSet.texFormat;
+ 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;
+
+ if (readAndWriteAccess == StagingAccess::READ_WRITE)
+ {
+ stagingDesc.CPUAccessFlags |= D3D11_CPU_ACCESS_WRITE;
+ }
+
+ ANGLE_TRY(allocateTexture(context11, stagingDesc, formatSet, textureOut));
+ return angle::Result::Continue;
+ }
+ ASSERT(textureType == ResourceType::Texture3D);
+
+ D3D11_TEXTURE3D_DESC stagingDesc;
+ stagingDesc.Width = size.width;
+ stagingDesc.Height = size.height;
+ stagingDesc.Depth = 1;
+ stagingDesc.MipLevels = 1;
+ stagingDesc.Format = formatSet.texFormat;
+ stagingDesc.Usage = D3D11_USAGE_STAGING;
+ stagingDesc.BindFlags = 0;
+ stagingDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+ stagingDesc.MiscFlags = 0;
+
+ ANGLE_TRY(allocateTexture(context11, stagingDesc, formatSet, textureOut));
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::allocateTexture(d3d::Context *context,
+ const D3D11_TEXTURE2D_DESC &desc,
+ const d3d11::Format &format,
+ const D3D11_SUBRESOURCE_DATA *initData,
+ TextureHelper11 *textureOut)
+{
+ d3d11::Texture2D texture;
+ ANGLE_TRY(mResourceManager11.allocate(context, this, &desc, initData, &texture));
+ textureOut->init(std::move(texture), desc, format);
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::allocateTexture(d3d::Context *context,
+ const D3D11_TEXTURE3D_DESC &desc,
+ const d3d11::Format &format,
+ const D3D11_SUBRESOURCE_DATA *initData,
+ TextureHelper11 *textureOut)
+{
+ d3d11::Texture3D texture;
+ ANGLE_TRY(mResourceManager11.allocate(context, this, &desc, initData, &texture));
+ textureOut->init(std::move(texture), desc, format);
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::getBlendState(const gl::Context *context,
+ const d3d11::BlendStateKey &key,
+ const d3d11::BlendState **outBlendState)
+{
+ return mStateCache.getBlendState(context, this, key, outBlendState);
+}
+
+angle::Result Renderer11::getRasterizerState(const gl::Context *context,
+ const gl::RasterizerState &rasterState,
+ bool scissorEnabled,
+ ID3D11RasterizerState **outRasterizerState)
+{
+ return mStateCache.getRasterizerState(context, this, rasterState, scissorEnabled,
+ outRasterizerState);
+}
+
+angle::Result Renderer11::getDepthStencilState(const gl::Context *context,
+ const gl::DepthStencilState &dsState,
+ const d3d11::DepthStencilState **outDSState)
+{
+ return mStateCache.getDepthStencilState(context, this, dsState, outDSState);
+}
+
+angle::Result Renderer11::getSamplerState(const gl::Context *context,
+ const gl::SamplerState &samplerState,
+ ID3D11SamplerState **outSamplerState)
+{
+ return mStateCache.getSamplerState(context, this, samplerState, outSamplerState);
+}
+
+angle::Result Renderer11::clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue)
+{
+ RenderTarget11 *rt11 = GetAs<RenderTarget11>(renderTarget);
+
+ if (rt11->getFormatSet().dsvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ ASSERT(rt11->getDepthStencilView().valid());
+
+ const auto &format = rt11->getFormatSet();
+ const UINT clearFlags = (format.format().depthBits > 0 ? D3D11_CLEAR_DEPTH : 0) |
+ (format.format().stencilBits ? D3D11_CLEAR_STENCIL : 0);
+ mDeviceContext->ClearDepthStencilView(rt11->getDepthStencilView().get(), clearFlags,
+ clearDepthValue,
+ static_cast<UINT8>(clearStencilValue));
+ return angle::Result::Continue;
+ }
+
+ ASSERT(rt11->getRenderTargetView().valid());
+ ID3D11RenderTargetView *rtv = rt11->getRenderTargetView().get();
+
+ // There are complications with some types of RTV and FL 9_3 with ClearRenderTargetView.
+ // See https://msdn.microsoft.com/en-us/library/windows/desktop/ff476388(v=vs.85).aspx
+ ASSERT(mRenderer11DeviceCaps.featureLevel > D3D_FEATURE_LEVEL_9_3 || !IsArrayRTV(rtv));
+
+ const auto &d3d11Format = rt11->getFormatSet();
+ const auto &glFormat = gl::GetSizedInternalFormatInfo(renderTarget->getInternalFormat());
+
+ gl::ColorF safeClearColor = clearColorValue;
+
+ if (d3d11Format.format().alphaBits > 0 && glFormat.alphaBits == 0)
+ {
+ safeClearColor.alpha = 1.0f;
+ }
+
+ mDeviceContext->ClearRenderTargetView(rtv, &safeClearColor.red);
+ return angle::Result::Continue;
+}
+
+bool Renderer11::canSelectViewInVertexShader() const
+{
+ return !getFeatures().selectViewInGeometryShader.enabled &&
+ getRenderer11DeviceCaps().supportsVpRtIndexWriteFromVertexShader;
+}
+
+angle::Result Renderer11::mapResource(const gl::Context *context,
+ ID3D11Resource *resource,
+ UINT subResource,
+ D3D11_MAP mapType,
+ UINT mapFlags,
+ D3D11_MAPPED_SUBRESOURCE *mappedResource)
+{
+ HRESULT hr = mDeviceContext->Map(resource, subResource, mapType, mapFlags, mappedResource);
+ ANGLE_TRY_HR(GetImplAs<Context11>(context), hr, "Failed to map D3D11 resource.");
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::markRawBufferUsage(const gl::Context *context)
+{
+ const gl::State &glState = context->getState();
+ const gl::Program *program = glState.getProgram();
+ for (size_t blockIndex = 0; blockIndex < program->getActiveShaderStorageBlockCount();
+ blockIndex++)
+ {
+ GLuint binding = program->getShaderStorageBlockBinding(static_cast<GLuint>(blockIndex));
+ const auto &shaderStorageBuffer = glState.getIndexedShaderStorageBuffer(binding);
+ if (shaderStorageBuffer.get() != nullptr)
+ {
+ Buffer11 *bufferStorage = GetImplAs<Buffer11>(shaderStorageBuffer.get());
+ ANGLE_TRY(bufferStorage->markRawBufferUsage(context));
+ }
+ }
+
+ for (const auto &atomicCounterBuffer : program->getState().getAtomicCounterBuffers())
+ {
+ GLuint binding = atomicCounterBuffer.binding;
+ const auto &buffer = glState.getIndexedAtomicCounterBuffer(binding);
+
+ if (buffer.get() != nullptr)
+ {
+ Buffer11 *bufferStorage = GetImplAs<Buffer11>(buffer.get());
+ ANGLE_TRY(bufferStorage->markRawBufferUsage(context));
+ }
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::markTransformFeedbackUsage(const gl::Context *context)
+{
+ const gl::State &glState = context->getState();
+ const gl::TransformFeedback *transformFeedback = glState.getCurrentTransformFeedback();
+ for (size_t i = 0; i < transformFeedback->getIndexedBufferCount(); i++)
+ {
+ const gl::OffsetBindingPointer<gl::Buffer> &binding =
+ transformFeedback->getIndexedBuffer(i);
+ if (binding.get() != nullptr)
+ {
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(binding.get());
+ ANGLE_TRY(bufferD3D->markTransformFeedbackUsage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer11::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
+{
+ return GetImplAs<Context11>(context)->getIncompleteTexture(context, type, textureOut);
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
new file mode 100644
index 0000000000..86b392785a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
@@ -0,0 +1,626 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderer11.h: Defines a back-end specific class for the D3D11 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_H_
+
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/HLSLCompiler.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderStateCache.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+#include "libANGLE/renderer/d3d/d3d11/StateManager11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace gl
+{
+class FramebufferAttachment;
+class ImageIndex;
+} // namespace gl
+
+namespace rx
+{
+class Blit11;
+class Buffer11;
+class Clear11;
+class Context11;
+class IndexDataManager;
+struct PackPixelsParams;
+class PixelTransfer11;
+class RenderTarget11;
+class StreamingIndexBufferInterface;
+class Trim11;
+class VertexDataManager;
+
+struct Renderer11DeviceCaps
+{
+ Renderer11DeviceCaps();
+
+ D3D_FEATURE_LEVEL featureLevel;
+ bool supportsDXGI1_2; // Support for DXGI 1.2
+ bool supportsClearView; // Support for ID3D11DeviceContext1::ClearView
+ bool supportsConstantBufferOffsets; // Support for Constant buffer offset
+ bool supportsVpRtIndexWriteFromVertexShader; // VP/RT can be selected in the Vertex Shader
+ // stage.
+ bool supportsMultisampledDepthStencilSRVs; // D3D feature level 10.0 no longer allows creation
+ // of textures with both the bind SRV and DSV flags
+ // when multisampled. Textures will need to be
+ // resolved before reading. crbug.com/656989
+ bool allowES3OnFL10_0;
+ UINT B5G6R5support; // Bitfield of D3D11_FORMAT_SUPPORT values for DXGI_FORMAT_B5G6R5_UNORM
+ UINT B5G6R5maxSamples; // Maximum number of samples supported by DXGI_FORMAT_B5G6R5_UNORM
+ UINT B4G4R4A4support; // Bitfield of D3D11_FORMAT_SUPPORT values for DXGI_FORMAT_B4G4R4A4_UNORM
+ UINT B4G4R4A4maxSamples; // Maximum number of samples supported by DXGI_FORMAT_B4G4R4A4_UNORM
+ UINT B5G5R5A1support; // Bitfield of D3D11_FORMAT_SUPPORT values for DXGI_FORMAT_B5G5R5A1_UNORM
+ UINT B5G5R5A1maxSamples; // Maximum number of samples supported by DXGI_FORMAT_B5G5R5A1_UNORM
+ Optional<LARGE_INTEGER> driverVersion; // Four-part driver version number.
+};
+
+enum
+{
+ MAX_VERTEX_UNIFORM_VECTORS_D3D11 = 1024,
+ MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 = 1024
+};
+
+// Possible reasons RendererD3D initialize can fail
+enum D3D11InitError
+{
+ // The renderer loaded successfully
+ D3D11_INIT_SUCCESS = 0,
+ // Failed to load the ANGLE & D3D compiler libraries
+ D3D11_INIT_COMPILER_ERROR,
+ // Failed to load a necessary DLL (non-compiler)
+ D3D11_INIT_MISSING_DEP,
+ // CreateDevice returned E_INVALIDARG
+ D3D11_INIT_CREATEDEVICE_INVALIDARG,
+ // CreateDevice failed with an error other than invalid arg
+ D3D11_INIT_CREATEDEVICE_ERROR,
+ // DXGI 1.2 required but not found
+ D3D11_INIT_INCOMPATIBLE_DXGI,
+ // Other initialization error
+ D3D11_INIT_OTHER_ERROR,
+ // CreateDevice returned E_FAIL
+ D3D11_INIT_CREATEDEVICE_FAIL,
+ // CreateDevice returned E_NOTIMPL
+ D3D11_INIT_CREATEDEVICE_NOTIMPL,
+ // CreateDevice returned E_OUTOFMEMORY
+ D3D11_INIT_CREATEDEVICE_OUTOFMEMORY,
+ // CreateDevice returned DXGI_ERROR_INVALID_CALL
+ D3D11_INIT_CREATEDEVICE_INVALIDCALL,
+ // CreateDevice returned DXGI_ERROR_SDK_COMPONENT_MISSING
+ D3D11_INIT_CREATEDEVICE_COMPONENTMISSING,
+ // CreateDevice returned DXGI_ERROR_WAS_STILL_DRAWING
+ D3D11_INIT_CREATEDEVICE_WASSTILLDRAWING,
+ // CreateDevice returned DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
+ D3D11_INIT_CREATEDEVICE_NOTAVAILABLE,
+ // CreateDevice returned DXGI_ERROR_DEVICE_HUNG
+ D3D11_INIT_CREATEDEVICE_DEVICEHUNG,
+ // CreateDevice returned NULL
+ D3D11_INIT_CREATEDEVICE_NULL,
+ NUM_D3D11_INIT_ERRORS
+};
+
+class Renderer11 : public RendererD3D
+{
+ public:
+ explicit Renderer11(egl::Display *display);
+ ~Renderer11() override;
+
+ egl::Error initialize() override;
+ bool resetDevice() override;
+
+ egl::ConfigSet generateConfigs() override;
+ void generateDisplayExtensions(egl::DisplayExtensions *outExtensions) const override;
+
+ ContextImpl *createContext(const gl::State &state, gl::ErrorSet *errorSet) override;
+
+ angle::Result flush(Context11 *context11);
+ angle::Result finish(Context11 *context11);
+
+ bool isValidNativeWindow(EGLNativeWindowType window) const override;
+ NativeWindowD3D *createNativeWindow(EGLNativeWindowType window,
+ const egl::Config *config,
+ const egl::AttributeMap &attribs) const override;
+
+ SwapChainD3D *createSwapChain(NativeWindowD3D *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation,
+ EGLint samples) override;
+ egl::Error getD3DTextureInfo(const egl::Config *configuration,
+ IUnknown *d3dTexture,
+ EGLint *width,
+ EGLint *height,
+ EGLint *samples,
+ const angle::Format **angleFormat) const override;
+ egl::Error validateShareHandle(const egl::Config *config,
+ HANDLE shareHandle,
+ const egl::AttributeMap &attribs) const override;
+
+ // lost device
+ bool testDeviceLost() override;
+ bool testDeviceResettable() override;
+
+ std::string getRendererDescription() const;
+ DeviceIdentifier getAdapterIdentifier() const override;
+
+ unsigned int getReservedVertexUniformVectors() const;
+ unsigned int getReservedFragmentUniformVectors() const;
+ gl::ShaderMap<unsigned int> getReservedShaderUniformBuffers() const;
+
+ bool getShareHandleSupport() const;
+
+ int getMajorShaderModel() const override;
+ int getMinorShaderModel() const override;
+ std::string getShaderModelSuffix() const override;
+
+ // Pixel operations
+ angle::Result copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level) override;
+ angle::Result copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ gl::TextureTarget srcTarget,
+ const gl::Box &sourceBox,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
+ angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel) override;
+
+ // RenderTarget creation
+ angle::Result createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT) override;
+ angle::Result createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT) override;
+
+ // Shader operations
+ angle::Result loadExecutable(d3d::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable) override;
+ angle::Result compileToExecutable(d3d::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable) override;
+ angle::Result ensureHLSLCompilerInitialized(d3d::Context *context) override;
+
+ UniformStorageD3D *createUniformStorage(size_t storageSize) override;
+
+ // Image operations
+ ImageD3D *createImage() override;
+ ExternalImageSiblingImpl *createExternalImageSibling(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source) override;
+ angle::Result generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState) override;
+ angle::Result copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Box &sourceBox,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
+
+ TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) override;
+ TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
+ RenderTargetD3D *renderTargetD3D) override;
+ TextureStorage *createTextureStorageExternal(
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc) override;
+ TextureStorage *createTextureStorage2D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ bool hintLevelZeroOnly) override;
+ TextureStorage *createTextureStorageCube(GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly) override;
+ TextureStorage *createTextureStorage3D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels) override;
+ TextureStorage *createTextureStorage2DArray(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels) override;
+ TextureStorage *createTextureStorage2DMultisample(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ int samples,
+ bool fixedSampleLocations) override;
+ TextureStorage *createTextureStorage2DMultisampleArray(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels,
+ int samples,
+ bool fixedSampleLocations) override;
+
+ VertexBuffer *createVertexBuffer() override;
+ IndexBuffer *createIndexBuffer() override;
+
+ // Stream Creation
+ StreamProducerImpl *createStreamProducerD3DTexture(egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs) override;
+
+ // D3D11-renderer specific methods
+ ID3D11Device *getDevice() { return mDevice; }
+ void *getD3DDevice() override;
+ ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; }
+ ID3D11DeviceContext1 *getDeviceContext1IfSupported() { return mDeviceContext1; }
+ IDXGIFactory *getDxgiFactory() { return mDxgiFactory; }
+
+ angle::Result getBlendState(const gl::Context *context,
+ const d3d11::BlendStateKey &key,
+ const d3d11::BlendState **outBlendState);
+ angle::Result getRasterizerState(const gl::Context *context,
+ const gl::RasterizerState &rasterState,
+ bool scissorEnabled,
+ ID3D11RasterizerState **outRasterizerState);
+ angle::Result getDepthStencilState(const gl::Context *context,
+ const gl::DepthStencilState &dsState,
+ const d3d11::DepthStencilState **outDSState);
+ angle::Result getSamplerState(const gl::Context *context,
+ const gl::SamplerState &samplerState,
+ ID3D11SamplerState **outSamplerState);
+
+ Blit11 *getBlitter() { return mBlit; }
+ Clear11 *getClearer() { return mClear; }
+ gl::DebugAnnotator *getAnnotator();
+
+ // Buffer-to-texture and Texture-to-buffer copies
+ bool supportsFastCopyBufferToTexture(GLenum internalFormat) const override;
+ angle::Result fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea) override;
+
+ angle::Result packPixels(const gl::Context *context,
+ const TextureHelper11 &textureHelper,
+ const PackPixelsParams &params,
+ uint8_t *pixelsOut);
+
+ bool getLUID(LUID *adapterLuid) const override;
+ VertexConversionType getVertexConversionType(angle::FormatID vertexFormatID) const override;
+ GLenum getVertexComponentType(angle::FormatID vertexFormatID) const override;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using this
+ // function.
+ angle::Result getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const override;
+
+ angle::Result readFromAttachment(const gl::Context *context,
+ const gl::FramebufferAttachment &srcAttachment,
+ const gl::Rectangle &sourceArea,
+ GLenum format,
+ GLenum type,
+ GLuint outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels);
+
+ angle::Result blitRenderbufferRect(const gl::Context *context,
+ const gl::Rectangle &readRect,
+ const gl::Rectangle &drawRect,
+ RenderTargetD3D *readRenderTarget,
+ RenderTargetD3D *drawRenderTarget,
+ GLenum filter,
+ const gl::Rectangle *scissor,
+ bool colorBlit,
+ bool depthBlit,
+ bool stencilBlit);
+
+ bool isES3Capable() const;
+ const Renderer11DeviceCaps &getRenderer11DeviceCaps() const { return mRenderer11DeviceCaps; }
+
+ RendererClass getRendererClass() const override;
+ StateManager11 *getStateManager() { return &mStateManager; }
+
+ void onSwap();
+ void onBufferCreate(const Buffer11 *created);
+ void onBufferDelete(const Buffer11 *deleted);
+
+ DeviceImpl *createEGLDevice() override;
+
+ angle::Result drawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint firstVertex,
+ GLsizei vertexCount,
+ GLsizei instanceCount);
+ angle::Result drawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint startVertex,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ GLsizei instanceCount);
+ angle::Result drawArraysIndirect(const gl::Context *context, const void *indirect);
+ angle::Result drawElementsIndirect(const gl::Context *context, const void *indirect);
+
+ // Necessary hack for default framebuffers in D3D.
+ FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
+
+ angle::Result getScratchMemoryBuffer(Context11 *context11,
+ size_t requestedSize,
+ angle::MemoryBuffer **bufferOut);
+
+ gl::Version getMaxSupportedESVersion() const override;
+ gl::Version getMaxConformantESVersion() const override;
+
+ angle::Result dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ);
+ angle::Result dispatchComputeIndirect(const gl::Context *context, GLintptr indirect);
+
+ angle::Result createStagingTexture(const gl::Context *context,
+ ResourceType textureType,
+ const d3d11::Format &formatSet,
+ const gl::Extents &size,
+ StagingAccess readAndWriteAccess,
+ TextureHelper11 *textureOut);
+
+ template <typename DescT, typename ResourceT>
+ angle::Result allocateResource(d3d::Context *context, const DescT &desc, ResourceT *resourceOut)
+ {
+ return mResourceManager11.allocate(context, this, &desc, nullptr, resourceOut);
+ }
+
+ template <typename DescT, typename InitDataT, typename ResourceT>
+ angle::Result allocateResource(d3d::Context *context,
+ const DescT &desc,
+ InitDataT *initData,
+ ResourceT *resourceOut)
+ {
+ return mResourceManager11.allocate(context, this, &desc, initData, resourceOut);
+ }
+
+ template <typename InitDataT, typename ResourceT>
+ angle::Result allocateResourceNoDesc(d3d::Context *context,
+ InitDataT *initData,
+ ResourceT *resourceOut)
+ {
+ return mResourceManager11.allocate(context, this, nullptr, initData, resourceOut);
+ }
+
+ template <typename DescT>
+ angle::Result allocateTexture(d3d::Context *context,
+ const DescT &desc,
+ const d3d11::Format &format,
+ TextureHelper11 *textureOut)
+ {
+ return allocateTexture(context, desc, format, nullptr, textureOut);
+ }
+
+ angle::Result allocateTexture(d3d::Context *context,
+ const D3D11_TEXTURE2D_DESC &desc,
+ const d3d11::Format &format,
+ const D3D11_SUBRESOURCE_DATA *initData,
+ TextureHelper11 *textureOut);
+
+ angle::Result allocateTexture(d3d::Context *context,
+ const D3D11_TEXTURE3D_DESC &desc,
+ const d3d11::Format &format,
+ const D3D11_SUBRESOURCE_DATA *initData,
+ TextureHelper11 *textureOut);
+
+ angle::Result clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue) override;
+
+ bool canSelectViewInVertexShader() const override;
+
+ angle::Result mapResource(const gl::Context *context,
+ ID3D11Resource *resource,
+ UINT subResource,
+ D3D11_MAP mapType,
+ UINT mapFlags,
+ D3D11_MAPPED_SUBRESOURCE *mappedResource);
+
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut) override;
+
+ private:
+ void generateCaps(gl::Caps *outCaps,
+ gl::TextureCapsMap *outTextureCaps,
+ gl::Extensions *outExtensions,
+ gl::Limitations *outLimitations) const override;
+
+ void initializeFeatures(angle::FeaturesD3D *features) const override;
+
+ angle::Result drawLineLoop(const gl::Context *context,
+ GLuint count,
+ gl::DrawElementsType type,
+ const void *indices,
+ int baseVertex,
+ int instances);
+ angle::Result drawTriangleFan(const gl::Context *context,
+ GLuint count,
+ gl::DrawElementsType type,
+ const void *indices,
+ int baseVertex,
+ int instances);
+
+ angle::Result resolveMultisampledTexture(const gl::Context *context,
+ RenderTarget11 *renderTarget,
+ bool depth,
+ bool stencil,
+ TextureHelper11 *textureOut);
+
+ void populateRenderer11DeviceCaps();
+
+ void updateHistograms();
+
+ angle::Result copyImageInternal(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ RenderTargetD3D *destRenderTarget);
+
+ gl::SupportedSampleSet generateSampleSetForEGLConfig(
+ const gl::TextureCaps &colorBufferFormatCaps,
+ const gl::TextureCaps &depthStencilBufferFormatCaps) const;
+
+ HRESULT callD3D11CreateDevice(PFN_D3D11_CREATE_DEVICE createDevice, bool debug);
+ egl::Error initializeD3DDevice();
+ egl::Error initializeDevice();
+ void releaseDeviceResources();
+ void release();
+
+ d3d11::ANGLED3D11DeviceType getDeviceType() const;
+
+ // Make sure that the raw buffer is the latest buffer.
+ angle::Result markRawBufferUsage(const gl::Context *context);
+ angle::Result markTransformFeedbackUsage(const gl::Context *context);
+ angle::Result drawWithGeometryShaderAndTransformFeedback(Context11 *context11,
+ gl::PrimitiveMode mode,
+ UINT instanceCount,
+ UINT vertexCount);
+
+ HMODULE mD3d11Module;
+ HMODULE mDxgiModule;
+ HMODULE mDCompModule;
+ std::vector<D3D_FEATURE_LEVEL> mAvailableFeatureLevels;
+ D3D_DRIVER_TYPE mRequestedDriverType;
+ bool mCreateDebugDevice;
+ bool mCreatedWithDeviceEXT;
+
+ HLSLCompiler mCompiler;
+
+ RenderStateCache mStateCache;
+
+ StateManager11 mStateManager;
+
+ StreamingIndexBufferInterface *mLineLoopIB;
+ StreamingIndexBufferInterface *mTriangleFanIB;
+
+ // Texture copy resources
+ Blit11 *mBlit;
+ PixelTransfer11 *mPixelTransfer;
+
+ // Masked clear resources
+ Clear11 *mClear;
+
+ // Perform trim for D3D resources
+ Trim11 *mTrim;
+
+ // Sync query
+ d3d11::Query mSyncQuery;
+
+ // Created objects state tracking
+ std::set<const Buffer11 *> mAliveBuffers;
+
+ double mLastHistogramUpdateTime;
+
+ ID3D11Device *mDevice;
+ Renderer11DeviceCaps mRenderer11DeviceCaps;
+ ID3D11DeviceContext *mDeviceContext;
+ ID3D11DeviceContext1 *mDeviceContext1;
+ ID3D11DeviceContext3 *mDeviceContext3;
+ IDXGIAdapter *mDxgiAdapter;
+ DXGI_ADAPTER_DESC mAdapterDescription;
+ char mDescription[128];
+ IDXGIFactory *mDxgiFactory;
+ ID3D11Debug *mDebug;
+
+ std::vector<GLuint> mScratchIndexDataBuffer;
+
+ angle::ScratchBuffer mScratchMemoryBuffer;
+
+ DebugAnnotator11 mAnnotator;
+
+ mutable Optional<bool> mSupportsShareHandles;
+ ResourceManager11 mResourceManager11;
+
+ TextureHelper11 mCachedResolveTexture;
+};
+
+} // namespace rx
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp
new file mode 100644
index 0000000000..2506200afa
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp
@@ -0,0 +1,552 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ResourceManager11:
+// Centralized point of allocation for all D3D11 Resources.
+
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+
+#include "common/debug.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+
+namespace rx
+{
+
+namespace
+{
+
+constexpr uint8_t kDebugInitTextureDataValue = 0x48;
+constexpr FLOAT kDebugColorInitClearValue[4] = {0.3f, 0.5f, 0.7f, 0.5f};
+constexpr FLOAT kDebugDepthInitValue = 0.2f;
+constexpr UINT8 kDebugStencilInitValue = 3;
+
+// A hard limit on buffer size. This works around a problem in the NVIDIA drivers where buffer sizes
+// close to MAX_UINT would give undefined results. The limit of MAX_UINT/2 should be generous enough
+// for almost any demanding application.
+constexpr UINT kMaximumBufferSizeHardLimit = std::numeric_limits<UINT>::max() >> 1;
+
+uint64_t ComputeMippedMemoryUsage(unsigned int width,
+ unsigned int height,
+ unsigned int depth,
+ uint64_t pixelSize,
+ unsigned int mipLevels)
+{
+ uint64_t sizeSum = 0;
+
+ for (unsigned int level = 0; level < mipLevels; ++level)
+ {
+ unsigned int mipWidth = std::max(width >> level, 1u);
+ unsigned int mipHeight = std::max(height >> level, 1u);
+ unsigned int mipDepth = std::max(depth >> level, 1u);
+ sizeSum += static_cast<uint64_t>(mipWidth * mipHeight * mipDepth) * pixelSize;
+ }
+
+ return sizeSum;
+}
+
+uint64_t ComputeMemoryUsage(const D3D11_TEXTURE2D_DESC *desc)
+{
+ ASSERT(desc);
+ uint64_t pixelBytes =
+ static_cast<uint64_t>(d3d11::GetDXGIFormatSizeInfo(desc->Format).pixelBytes);
+ return ComputeMippedMemoryUsage(desc->Width, desc->Height, 1, pixelBytes, desc->MipLevels);
+}
+
+uint64_t ComputeMemoryUsage(const D3D11_TEXTURE3D_DESC *desc)
+{
+ ASSERT(desc);
+ uint64_t pixelBytes =
+ static_cast<uint64_t>(d3d11::GetDXGIFormatSizeInfo(desc->Format).pixelBytes);
+ return ComputeMippedMemoryUsage(desc->Width, desc->Height, desc->Depth, pixelBytes,
+ desc->MipLevels);
+}
+
+uint64_t ComputeMemoryUsage(const D3D11_BUFFER_DESC *desc)
+{
+ ASSERT(desc);
+ return static_cast<uint64_t>(desc->ByteWidth);
+}
+
+template <typename T>
+uint64_t ComputeMemoryUsage(const T *desc)
+{
+ return 0;
+}
+
+template <ResourceType ResourceT>
+uint64_t ComputeGenericMemoryUsage(ID3D11DeviceChild *genericResource)
+{
+ auto *typedResource = static_cast<GetD3D11Type<ResourceT> *>(genericResource);
+ GetDescType<ResourceT> desc;
+ typedResource->GetDesc(&desc);
+ return ComputeMemoryUsage(&desc);
+}
+
+uint64_t ComputeGenericMemoryUsage(ResourceType resourceType, ID3D11DeviceChild *resource)
+{
+ switch (resourceType)
+ {
+ case ResourceType::Texture2D:
+ return ComputeGenericMemoryUsage<ResourceType::Texture2D>(resource);
+ case ResourceType::Texture3D:
+ return ComputeGenericMemoryUsage<ResourceType::Texture3D>(resource);
+ case ResourceType::Buffer:
+ return ComputeGenericMemoryUsage<ResourceType::Buffer>(resource);
+
+ default:
+ return 0;
+ }
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_BLEND_DESC *desc,
+ void * /*initData*/,
+ ID3D11BlendState **blendState)
+{
+ return device->CreateBlendState(desc, blendState);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_BUFFER_DESC *desc,
+ const D3D11_SUBRESOURCE_DATA *initData,
+ ID3D11Buffer **buffer)
+{
+ // Force buffers to be limited to a fixed max size.
+ if (desc->ByteWidth > kMaximumBufferSizeHardLimit)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ return device->CreateBuffer(desc, initData, buffer);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const ShaderData *desc,
+ void * /*initData*/,
+ ID3D11ComputeShader **resourceOut)
+{
+ return device->CreateComputeShader(desc->get(), desc->size(), nullptr, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_DEPTH_STENCIL_DESC *desc,
+ void * /*initData*/,
+ ID3D11DepthStencilState **resourceOut)
+{
+ return device->CreateDepthStencilState(desc, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_DEPTH_STENCIL_VIEW_DESC *desc,
+ ID3D11Resource *resource,
+ ID3D11DepthStencilView **resourceOut)
+{
+ return device->CreateDepthStencilView(resource, desc, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const ShaderData *desc,
+ const std::vector<D3D11_SO_DECLARATION_ENTRY> *initData,
+ ID3D11GeometryShader **resourceOut)
+{
+ if (initData)
+ {
+ return device->CreateGeometryShaderWithStreamOutput(
+ desc->get(), desc->size(), initData->data(), static_cast<UINT>(initData->size()),
+ nullptr, 0, 0, nullptr, resourceOut);
+ }
+ else
+ {
+ return device->CreateGeometryShader(desc->get(), desc->size(), nullptr, resourceOut);
+ }
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const InputElementArray *desc,
+ const ShaderData *initData,
+ ID3D11InputLayout **resourceOut)
+{
+ return device->CreateInputLayout(desc->get(), static_cast<UINT>(desc->size()), initData->get(),
+ initData->size(), resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const ShaderData *desc,
+ void * /*initData*/,
+ ID3D11PixelShader **resourceOut)
+{
+ return device->CreatePixelShader(desc->get(), desc->size(), nullptr, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_QUERY_DESC *desc,
+ void * /*initData*/,
+ ID3D11Query **resourceOut)
+{
+ return device->CreateQuery(desc, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_RASTERIZER_DESC *desc,
+ void * /*initData*/,
+ ID3D11RasterizerState **rasterizerState)
+{
+ return device->CreateRasterizerState(desc, rasterizerState);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_RENDER_TARGET_VIEW_DESC *desc,
+ ID3D11Resource *resource,
+ ID3D11RenderTargetView **renderTargetView)
+{
+ return device->CreateRenderTargetView(resource, desc, renderTargetView);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_SAMPLER_DESC *desc,
+ void * /*initData*/,
+ ID3D11SamplerState **resourceOut)
+{
+ return device->CreateSamplerState(desc, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_SHADER_RESOURCE_VIEW_DESC *desc,
+ ID3D11Resource *resource,
+ ID3D11ShaderResourceView **resourceOut)
+{
+ return device->CreateShaderResourceView(resource, desc, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_UNORDERED_ACCESS_VIEW_DESC *desc,
+ ID3D11Resource *resource,
+ ID3D11UnorderedAccessView **resourceOut)
+{
+ return device->CreateUnorderedAccessView(resource, desc, resourceOut);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_TEXTURE2D_DESC *desc,
+ const D3D11_SUBRESOURCE_DATA *initData,
+ ID3D11Texture2D **texture)
+{
+ return device->CreateTexture2D(desc, initData, texture);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const D3D11_TEXTURE3D_DESC *desc,
+ const D3D11_SUBRESOURCE_DATA *initData,
+ ID3D11Texture3D **texture)
+{
+ return device->CreateTexture3D(desc, initData, texture);
+}
+
+HRESULT CreateResource(ID3D11Device *device,
+ const ShaderData *desc,
+ void * /*initData*/,
+ ID3D11VertexShader **resourceOut)
+{
+ return device->CreateVertexShader(desc->get(), desc->size(), nullptr, resourceOut);
+}
+
+DXGI_FORMAT GetTypedDepthStencilFormat(DXGI_FORMAT dxgiFormat)
+{
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_R16_TYPELESS:
+ return DXGI_FORMAT_D16_UNORM;
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ return DXGI_FORMAT_D24_UNORM_S8_UINT;
+ case DXGI_FORMAT_R32_TYPELESS:
+ return DXGI_FORMAT_D32_FLOAT;
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
+ default:
+ return dxgiFormat;
+ }
+}
+
+template <typename DescT, typename ResourceT>
+angle::Result ClearResource(d3d::Context *context,
+ Renderer11 *renderer,
+ const DescT *desc,
+ ResourceT *texture)
+{
+ // No-op.
+ return angle::Result::Continue;
+}
+
+template <>
+angle::Result ClearResource(d3d::Context *context,
+ Renderer11 *renderer,
+ const D3D11_TEXTURE2D_DESC *desc,
+ ID3D11Texture2D *texture)
+{
+ ID3D11DeviceContext *deviceContext = renderer->getDeviceContext();
+
+ if ((desc->BindFlags & D3D11_BIND_DEPTH_STENCIL) != 0)
+ {
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Flags = 0;
+ dsvDesc.Format = GetTypedDepthStencilFormat(desc->Format);
+
+ const auto &format = d3d11_angle::GetFormat(dsvDesc.Format);
+ UINT clearFlags = (format.depthBits > 0 ? D3D11_CLEAR_DEPTH : 0) |
+ (format.stencilBits > 0 ? D3D11_CLEAR_STENCIL : 0);
+
+ // Must process each mip level individually.
+ for (UINT mipLevel = 0; mipLevel < desc->MipLevels; ++mipLevel)
+ {
+ if (desc->SampleDesc.Count == 0)
+ {
+ dsvDesc.Texture2D.MipSlice = mipLevel;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+ }
+ else
+ {
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS;
+ }
+
+ d3d11::DepthStencilView dsv;
+ ANGLE_TRY(renderer->allocateResource(context, dsvDesc, texture, &dsv));
+
+ deviceContext->ClearDepthStencilView(dsv.get(), clearFlags, kDebugDepthInitValue,
+ kDebugStencilInitValue);
+ }
+ }
+ else
+ {
+ ASSERT((desc->BindFlags & D3D11_BIND_RENDER_TARGET) != 0);
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(renderer->allocateResourceNoDesc(context, texture, &rtv));
+
+ deviceContext->ClearRenderTargetView(rtv.get(), kDebugColorInitClearValue);
+ }
+
+ return angle::Result::Continue;
+}
+
+template <>
+angle::Result ClearResource(d3d::Context *context,
+ Renderer11 *renderer,
+ const D3D11_TEXTURE3D_DESC *desc,
+ ID3D11Texture3D *texture)
+{
+ ID3D11DeviceContext *deviceContext = renderer->getDeviceContext();
+
+ ASSERT((desc->BindFlags & D3D11_BIND_DEPTH_STENCIL) == 0);
+ ASSERT((desc->BindFlags & D3D11_BIND_RENDER_TARGET) != 0);
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(renderer->allocateResourceNoDesc(context, texture, &rtv));
+
+ deviceContext->ClearRenderTargetView(rtv.get(), kDebugColorInitClearValue);
+ return angle::Result::Continue;
+}
+
+#define ANGLE_RESOURCE_STRINGIFY_OP(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) \
+ "Error allocating " #RESTYPE,
+
+constexpr std::array<const char *, NumResourceTypes> kResourceTypeErrors = {
+ {ANGLE_RESOURCE_TYPE_OP(Stringify, ANGLE_RESOURCE_STRINGIFY_OP)}};
+static_assert(kResourceTypeErrors[NumResourceTypes - 1] != nullptr,
+ "All members must be initialized.");
+
+} // anonymous namespace
+
+// ResourceManager11 Implementation.
+ResourceManager11::ResourceManager11() : mInitializeAllocations(false)
+{
+ for (auto &count : mAllocatedResourceCounts)
+ {
+ count = 0;
+ }
+ for (auto &memorySize : mAllocatedResourceDeviceMemory)
+ {
+ memorySize = 0;
+ }
+}
+
+ResourceManager11::~ResourceManager11()
+{
+ for (size_t count : mAllocatedResourceCounts)
+ {
+ ASSERT(count == 0);
+ }
+
+ for (uint64_t memorySize : mAllocatedResourceDeviceMemory)
+ {
+ ASSERT(memorySize == 0);
+ }
+}
+
+template <typename T>
+angle::Result ResourceManager11::allocate(d3d::Context *context,
+ Renderer11 *renderer,
+ const GetDescFromD3D11<T> *desc,
+ GetInitDataFromD3D11<T> *initData,
+ Resource11<T> *resourceOut)
+{
+ ID3D11Device *device = renderer->getDevice();
+ T *resource = nullptr;
+
+ GetInitDataFromD3D11<T> *shadowInitData = initData;
+ if (!shadowInitData && mInitializeAllocations)
+ {
+ shadowInitData = createInitDataIfNeeded<T>(desc);
+ }
+
+ HRESULT hr = CreateResource(device, desc, shadowInitData, &resource);
+ ANGLE_TRY_HR(context, hr, kResourceTypeErrors[ResourceTypeIndex<T>()]);
+
+ if (!shadowInitData && mInitializeAllocations)
+ {
+ ANGLE_TRY(ClearResource(context, renderer, desc, resource));
+ }
+
+ ASSERT(resource);
+ incrResource(GetResourceTypeFromD3D11<T>(), ComputeMemoryUsage(desc));
+ *resourceOut = std::move(Resource11<T>(resource, this));
+ return angle::Result::Continue;
+}
+
+void ResourceManager11::incrResource(ResourceType resourceType, uint64_t memorySize)
+{
+ size_t typeIndex = ResourceTypeIndex(resourceType);
+
+ mAllocatedResourceCounts[typeIndex]++;
+ mAllocatedResourceDeviceMemory[typeIndex] += memorySize;
+
+ // This checks for integer overflow.
+ ASSERT(mAllocatedResourceCounts[typeIndex] > 0);
+ ASSERT(mAllocatedResourceDeviceMemory[typeIndex] >= memorySize);
+}
+
+void ResourceManager11::decrResource(ResourceType resourceType, uint64_t memorySize)
+{
+ size_t typeIndex = ResourceTypeIndex(resourceType);
+
+ ASSERT(mAllocatedResourceCounts[typeIndex] > 0);
+ mAllocatedResourceCounts[typeIndex]--;
+ ASSERT(mAllocatedResourceDeviceMemory[typeIndex] >= memorySize);
+ mAllocatedResourceDeviceMemory[typeIndex] -= memorySize;
+}
+
+void ResourceManager11::onReleaseGeneric(ResourceType resourceType, ID3D11DeviceChild *resource)
+{
+ ASSERT(resource);
+ decrResource(resourceType, ComputeGenericMemoryUsage(resourceType, resource));
+}
+
+template <>
+const D3D11_SUBRESOURCE_DATA *ResourceManager11::createInitDataIfNeeded<ID3D11Texture2D>(
+ const D3D11_TEXTURE2D_DESC *desc)
+{
+ ASSERT(desc);
+
+ if ((desc->BindFlags & (D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_RENDER_TARGET)) != 0)
+ {
+ // This will be done using ClearView methods.
+ return nullptr;
+ }
+
+ size_t requiredSize = static_cast<size_t>(ComputeMemoryUsage(desc));
+ if (mZeroMemory.size() < requiredSize)
+ {
+ mZeroMemory.resize(requiredSize);
+ mZeroMemory.fill(kDebugInitTextureDataValue);
+ }
+
+ const auto &formatSizeInfo = d3d11::GetDXGIFormatSizeInfo(desc->Format);
+
+ UINT subresourceCount = desc->MipLevels * desc->ArraySize;
+ if (mShadowInitData.size() < subresourceCount)
+ {
+ mShadowInitData.resize(subresourceCount);
+ }
+
+ for (UINT mipLevel = 0; mipLevel < desc->MipLevels; ++mipLevel)
+ {
+ for (UINT arrayIndex = 0; arrayIndex < desc->ArraySize; ++arrayIndex)
+ {
+ UINT subresourceIndex = D3D11CalcSubresource(mipLevel, arrayIndex, desc->MipLevels);
+ D3D11_SUBRESOURCE_DATA *data = &mShadowInitData[subresourceIndex];
+
+ UINT levelWidth = std::max(desc->Width >> mipLevel, 1u);
+ UINT levelHeight = std::max(desc->Height >> mipLevel, 1u);
+
+ data->SysMemPitch = levelWidth * formatSizeInfo.pixelBytes;
+ data->SysMemSlicePitch = data->SysMemPitch * levelHeight;
+ data->pSysMem = mZeroMemory.data();
+ }
+ }
+
+ return mShadowInitData.data();
+}
+
+template <>
+const D3D11_SUBRESOURCE_DATA *ResourceManager11::createInitDataIfNeeded<ID3D11Texture3D>(
+ const D3D11_TEXTURE3D_DESC *desc)
+{
+ ASSERT(desc);
+
+ if ((desc->BindFlags & D3D11_BIND_RENDER_TARGET) != 0)
+ {
+ // This will be done using ClearView methods.
+ return nullptr;
+ }
+
+ size_t requiredSize = static_cast<size_t>(ComputeMemoryUsage(desc));
+ if (mZeroMemory.size() < requiredSize)
+ {
+ mZeroMemory.resize(requiredSize);
+ mZeroMemory.fill(kDebugInitTextureDataValue);
+ }
+
+ const auto &formatSizeInfo = d3d11::GetDXGIFormatSizeInfo(desc->Format);
+
+ UINT subresourceCount = desc->MipLevels;
+ if (mShadowInitData.size() < subresourceCount)
+ {
+ mShadowInitData.resize(subresourceCount);
+ }
+
+ for (UINT mipLevel = 0; mipLevel < desc->MipLevels; ++mipLevel)
+ {
+ UINT subresourceIndex = D3D11CalcSubresource(mipLevel, 0, desc->MipLevels);
+ D3D11_SUBRESOURCE_DATA *data = &mShadowInitData[subresourceIndex];
+
+ UINT levelWidth = std::max(desc->Width >> mipLevel, 1u);
+ UINT levelHeight = std::max(desc->Height >> mipLevel, 1u);
+
+ data->SysMemPitch = levelWidth * formatSizeInfo.pixelBytes;
+ data->SysMemSlicePitch = data->SysMemPitch * levelHeight;
+ data->pSysMem = mZeroMemory.data();
+ }
+
+ return mShadowInitData.data();
+}
+
+template <typename T>
+GetInitDataFromD3D11<T> *ResourceManager11::createInitDataIfNeeded(const GetDescFromD3D11<T> *desc)
+{
+ // No-op.
+ return nullptr;
+}
+
+void ResourceManager11::setAllocationsInitialized(bool initialize)
+{
+ mInitializeAllocations = initialize;
+}
+
+#define ANGLE_INSTANTIATE_OP(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) \
+ \
+ template angle::Result ResourceManager11::allocate( \
+ d3d::Context *, Renderer11 *, const DESCTYPE *, INITDATATYPE *, Resource11<D3D11TYPE> *);
+
+ANGLE_RESOURCE_TYPE_OP(Instantitate, ANGLE_INSTANTIATE_OP)
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h
new file mode 100644
index 0000000000..e794c358e9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.h
@@ -0,0 +1,381 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// ResourceManager11:
+// Centralized point of allocation for all D3D11 Resources.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RESOURCEFACTORY11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RESOURCEFACTORY11_H_
+
+#include <array>
+#include <atomic>
+#include <memory>
+
+#include "common/MemoryBuffer.h"
+#include "common/angleutils.h"
+#include "common/debug.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace rx
+{
+// These two methods are declared here to prevent circular includes.
+namespace d3d11
+{
+HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
+
+template <typename T>
+HRESULT SetDebugName(angle::ComPtr<T> &resource, const char *name)
+{
+ return SetDebugName(resource.Get(), name);
+}
+} // namespace d3d11
+
+namespace d3d
+{
+class Context;
+} // namespace d3d
+
+class Renderer11;
+class ResourceManager11;
+template <typename T>
+class SharedResource11;
+class TextureHelper11;
+
+using InputElementArray = WrappedArray<D3D11_INPUT_ELEMENT_DESC>;
+using ShaderData = WrappedArray<uint8_t>;
+
+// Format: ResourceType, D3D11 type, DESC type, init data type.
+#define ANGLE_RESOURCE_TYPE_OP(NAME, OP) \
+ OP(NAME, BlendState, ID3D11BlendState, D3D11_BLEND_DESC, void) \
+ OP(NAME, Buffer, ID3D11Buffer, D3D11_BUFFER_DESC, const D3D11_SUBRESOURCE_DATA) \
+ OP(NAME, ComputeShader, ID3D11ComputeShader, ShaderData, void) \
+ OP(NAME, DepthStencilState, ID3D11DepthStencilState, D3D11_DEPTH_STENCIL_DESC, void) \
+ OP(NAME, DepthStencilView, ID3D11DepthStencilView, D3D11_DEPTH_STENCIL_VIEW_DESC, \
+ ID3D11Resource) \
+ OP(NAME, GeometryShader, ID3D11GeometryShader, ShaderData, \
+ const std::vector<D3D11_SO_DECLARATION_ENTRY>) \
+ OP(NAME, InputLayout, ID3D11InputLayout, InputElementArray, const ShaderData) \
+ OP(NAME, PixelShader, ID3D11PixelShader, ShaderData, void) \
+ OP(NAME, Query, ID3D11Query, D3D11_QUERY_DESC, void) \
+ OP(NAME, RasterizerState, ID3D11RasterizerState, D3D11_RASTERIZER_DESC, void) \
+ OP(NAME, RenderTargetView, ID3D11RenderTargetView, D3D11_RENDER_TARGET_VIEW_DESC, \
+ ID3D11Resource) \
+ OP(NAME, SamplerState, ID3D11SamplerState, D3D11_SAMPLER_DESC, void) \
+ OP(NAME, ShaderResourceView, ID3D11ShaderResourceView, D3D11_SHADER_RESOURCE_VIEW_DESC, \
+ ID3D11Resource) \
+ OP(NAME, UnorderedAccessView, ID3D11UnorderedAccessView, D3D11_UNORDERED_ACCESS_VIEW_DESC, \
+ ID3D11Resource) \
+ OP(NAME, Texture2D, ID3D11Texture2D, D3D11_TEXTURE2D_DESC, const D3D11_SUBRESOURCE_DATA) \
+ OP(NAME, Texture3D, ID3D11Texture3D, D3D11_TEXTURE3D_DESC, const D3D11_SUBRESOURCE_DATA) \
+ OP(NAME, VertexShader, ID3D11VertexShader, ShaderData, void)
+
+#define ANGLE_RESOURCE_TYPE_LIST(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) RESTYPE,
+
+enum class ResourceType
+{
+ ANGLE_RESOURCE_TYPE_OP(List, ANGLE_RESOURCE_TYPE_LIST) Last
+};
+
+#undef ANGLE_RESOURCE_TYPE_LIST
+
+constexpr size_t ResourceTypeIndex(ResourceType resourceType)
+{
+ return static_cast<size_t>(resourceType);
+}
+
+constexpr size_t NumResourceTypes = ResourceTypeIndex(ResourceType::Last);
+
+#define ANGLE_RESOURCE_TYPE_TO_D3D11(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) \
+ \
+ template <> \
+ struct NAME<ResourceType::RESTYPE> \
+ { \
+ using Value = D3D11TYPE; \
+ };
+
+#define ANGLE_RESOURCE_TYPE_TO_DESC(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) \
+ \
+ template <> \
+ struct NAME<ResourceType::RESTYPE> \
+ { \
+ using Value = DESCTYPE; \
+ };
+
+#define ANGLE_RESOURCE_TYPE_TO_INIT_DATA(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) \
+ \
+ template <> \
+ struct NAME<ResourceType::RESTYPE> \
+ { \
+ using Value = INITDATATYPE; \
+ };
+
+#define ANGLE_RESOURCE_TYPE_TO_TYPE(NAME, OP) \
+ template <ResourceType Param> \
+ struct NAME; \
+ ANGLE_RESOURCE_TYPE_OP(NAME, OP) \
+ \
+ template <ResourceType Param> \
+ struct NAME \
+ {}; \
+ \
+ template <ResourceType Param> \
+ using Get##NAME = typename NAME<Param>::Value;
+
+ANGLE_RESOURCE_TYPE_TO_TYPE(D3D11Type, ANGLE_RESOURCE_TYPE_TO_D3D11)
+ANGLE_RESOURCE_TYPE_TO_TYPE(DescType, ANGLE_RESOURCE_TYPE_TO_DESC)
+ANGLE_RESOURCE_TYPE_TO_TYPE(InitDataType, ANGLE_RESOURCE_TYPE_TO_INIT_DATA)
+
+#undef ANGLE_RESOURCE_TYPE_TO_D3D11
+#undef ANGLE_RESOURCE_TYPE_TO_DESC
+#undef ANGLE_RESOURCE_TYPE_TO_INIT_DATA
+#undef ANGLE_RESOURCE_TYPE_TO_TYPE
+
+#define ANGLE_TYPE_TO_RESOURCE_TYPE(NAME, OP) \
+ template <typename Param> \
+ struct NAME; \
+ ANGLE_RESOURCE_TYPE_OP(NAME, OP) \
+ \
+ template <typename Param> \
+ struct NAME \
+ {}; \
+ \
+ template <typename Param> \
+ constexpr ResourceType Get##NAME() \
+ { \
+ return NAME<Param>::Value; \
+ }
+
+#define ANGLE_D3D11_TO_RESOURCE_TYPE(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) \
+ \
+ template <> \
+ struct NAME<D3D11TYPE> \
+ { \
+ static constexpr ResourceType Value = ResourceType::RESTYPE; \
+ };
+
+ANGLE_TYPE_TO_RESOURCE_TYPE(ResourceTypeFromD3D11, ANGLE_D3D11_TO_RESOURCE_TYPE)
+
+#undef ANGLE_D3D11_TO_RESOURCE_TYPE
+#undef ANGLE_TYPE_TO_RESOURCE_TYPE
+
+template <typename T>
+using GetDescFromD3D11 = GetDescType<ResourceTypeFromD3D11<T>::Value>;
+
+template <typename T>
+using GetInitDataFromD3D11 = GetInitDataType<ResourceTypeFromD3D11<T>::Value>;
+
+template <typename T>
+constexpr size_t ResourceTypeIndex()
+{
+ return static_cast<size_t>(GetResourceTypeFromD3D11<T>());
+}
+
+template <typename T>
+struct TypedData
+{
+ TypedData() {}
+ ~TypedData();
+
+ T *object = nullptr;
+ ResourceManager11 *manager = nullptr;
+};
+
+// Smart pointer type. Wraps the resource and a factory for safe deletion.
+template <typename T, template <class> class Pointer, typename DataT>
+class Resource11Base : angle::NonCopyable
+{
+ public:
+ T *get() const { return mData->object; }
+ T *const *getPointer() const { return &mData->object; }
+
+ void setDebugName(const char *name) { d3d11::SetDebugName(mData->object, name); }
+
+ void set(T *object)
+ {
+ ASSERT(!valid());
+ mData->object = object;
+ }
+
+ bool valid() const { return (mData->object != nullptr); }
+
+ void reset()
+ {
+ if (valid())
+ mData.reset(new DataT());
+ }
+
+ ResourceSerial getSerial() const
+ {
+ return ResourceSerial(reinterpret_cast<uintptr_t>(mData->object));
+ }
+
+ protected:
+ friend class TextureHelper11;
+
+ Resource11Base() : mData(new DataT()) {}
+
+ Resource11Base(Resource11Base &&movedObj) : mData(new DataT())
+ {
+ std::swap(mData, movedObj.mData);
+ }
+
+ virtual ~Resource11Base() { mData.reset(); }
+
+ Resource11Base &operator=(Resource11Base &&movedObj)
+ {
+ std::swap(mData, movedObj.mData);
+ return *this;
+ }
+
+ Pointer<DataT> mData;
+};
+
+template <typename T>
+using UniquePtr = typename std::unique_ptr<T, std::default_delete<T>>;
+
+template <typename ResourceT>
+class Resource11 : public Resource11Base<ResourceT, UniquePtr, TypedData<ResourceT>>
+{
+ public:
+ Resource11() {}
+ Resource11(Resource11 &&other)
+ : Resource11Base<ResourceT, UniquePtr, TypedData<ResourceT>>(std::move(other))
+ {}
+ Resource11 &operator=(Resource11 &&other)
+ {
+ std::swap(this->mData, other.mData);
+ return *this;
+ }
+
+ private:
+ template <typename T>
+ friend class SharedResource11;
+ friend class ResourceManager11;
+
+ Resource11(ResourceT *object, ResourceManager11 *manager)
+ {
+ this->mData->object = object;
+ this->mData->manager = manager;
+ }
+};
+
+template <typename T>
+class SharedResource11 : public Resource11Base<T, std::shared_ptr, TypedData<T>>
+{
+ public:
+ SharedResource11() {}
+ SharedResource11(SharedResource11 &&movedObj)
+ : Resource11Base<T, std::shared_ptr, TypedData<T>>(std::move(movedObj))
+ {}
+
+ SharedResource11 &operator=(SharedResource11 &&other)
+ {
+ std::swap(this->mData, other.mData);
+ return *this;
+ }
+
+ SharedResource11 makeCopy() const
+ {
+ SharedResource11 copy;
+ copy.mData = this->mData;
+ return std::move(copy);
+ }
+
+ private:
+ friend class ResourceManager11;
+ SharedResource11(Resource11<T> &&obj) : Resource11Base<T, std::shared_ptr, TypedData<T>>()
+ {
+ std::swap(this->mData->manager, obj.mData->manager);
+
+ // Can't use std::swap because of ID3D11Resource.
+ auto temp = this->mData->object;
+ this->mData->object = obj.mData->object;
+ obj.mData->object = static_cast<T *>(temp);
+ }
+};
+
+class ResourceManager11 final : angle::NonCopyable
+{
+ public:
+ ResourceManager11();
+ ~ResourceManager11();
+
+ template <typename T>
+ angle::Result allocate(d3d::Context *context,
+ Renderer11 *renderer,
+ const GetDescFromD3D11<T> *desc,
+ GetInitDataFromD3D11<T> *initData,
+ Resource11<T> *resourceOut);
+
+ template <typename T>
+ angle::Result allocate(d3d::Context *context,
+ Renderer11 *renderer,
+ const GetDescFromD3D11<T> *desc,
+ GetInitDataFromD3D11<T> *initData,
+ SharedResource11<T> *sharedRes)
+ {
+ Resource11<T> res;
+ ANGLE_TRY(allocate(context, renderer, desc, initData, &res));
+ *sharedRes = std::move(res);
+ return angle::Result::Continue;
+ }
+
+ template <typename T>
+ void onRelease(T *resource)
+ {
+ onReleaseGeneric(GetResourceTypeFromD3D11<T>(), resource);
+ }
+
+ void onReleaseGeneric(ResourceType resourceType, ID3D11DeviceChild *resource);
+
+ void setAllocationsInitialized(bool initialize);
+
+ private:
+ void incrResource(ResourceType resourceType, uint64_t memorySize);
+ void decrResource(ResourceType resourceType, uint64_t memorySize);
+
+ template <typename T>
+ GetInitDataFromD3D11<T> *createInitDataIfNeeded(const GetDescFromD3D11<T> *desc);
+
+ bool mInitializeAllocations;
+
+ std::array<std::atomic_size_t, NumResourceTypes> mAllocatedResourceCounts;
+ std::array<std::atomic_uint64_t, NumResourceTypes> mAllocatedResourceDeviceMemory;
+ angle::MemoryBuffer mZeroMemory;
+
+ std::vector<D3D11_SUBRESOURCE_DATA> mShadowInitData;
+};
+
+template <typename ResourceT>
+TypedData<ResourceT>::~TypedData()
+{
+ if (object)
+ {
+ // We can have a nullptr factory when holding passed-in resources.
+ if (manager)
+ {
+ manager->onRelease(object);
+ }
+ object->Release();
+ }
+}
+
+#define ANGLE_RESOURCE_TYPE_CLASS(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) \
+ using RESTYPE = Resource11<D3D11TYPE>;
+
+namespace d3d11
+{
+ANGLE_RESOURCE_TYPE_OP(ClassList, ANGLE_RESOURCE_TYPE_CLASS)
+
+using SharedSRV = SharedResource11<ID3D11ShaderResourceView>;
+using SharedUAV = SharedResource11<ID3D11UnorderedAccessView>;
+} // namespace d3d11
+
+#undef ANGLE_RESOURCE_TYPE_CLASS
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RESOURCEFACTORY11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
new file mode 100644
index 0000000000..af910e1464
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
@@ -0,0 +1,116 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderExecutable11.cpp: Implements a D3D11-specific class to contain shader
+// executable implementation details.
+
+#include "libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+
+namespace rx
+{
+
+ShaderExecutable11::ShaderExecutable11(const void *function,
+ size_t length,
+ d3d11::PixelShader &&executable)
+ : ShaderExecutableD3D(function, length),
+ mPixelExecutable(std::move(executable)),
+ mVertexExecutable(),
+ mGeometryExecutable(),
+ mStreamOutExecutable(),
+ mComputeExecutable()
+{}
+
+ShaderExecutable11::ShaderExecutable11(const void *function,
+ size_t length,
+ d3d11::VertexShader &&executable,
+ d3d11::GeometryShader &&streamOut)
+ : ShaderExecutableD3D(function, length),
+ mPixelExecutable(),
+ mVertexExecutable(std::move(executable)),
+ mGeometryExecutable(),
+ mStreamOutExecutable(std::move(streamOut)),
+ mComputeExecutable()
+{}
+
+ShaderExecutable11::ShaderExecutable11(const void *function,
+ size_t length,
+ d3d11::GeometryShader &&executable)
+ : ShaderExecutableD3D(function, length),
+ mPixelExecutable(),
+ mVertexExecutable(),
+ mGeometryExecutable(std::move(executable)),
+ mStreamOutExecutable(),
+ mComputeExecutable()
+{}
+
+ShaderExecutable11::ShaderExecutable11(const void *function,
+ size_t length,
+ d3d11::ComputeShader &&executable)
+ : ShaderExecutableD3D(function, length),
+ mPixelExecutable(),
+ mVertexExecutable(),
+ mGeometryExecutable(),
+ mStreamOutExecutable(),
+ mComputeExecutable(std::move(executable))
+{}
+
+ShaderExecutable11::~ShaderExecutable11() {}
+
+const d3d11::VertexShader &ShaderExecutable11::getVertexShader() const
+{
+ return mVertexExecutable;
+}
+
+const d3d11::PixelShader &ShaderExecutable11::getPixelShader() const
+{
+ return mPixelExecutable;
+}
+
+const d3d11::GeometryShader &ShaderExecutable11::getGeometryShader() const
+{
+ return mGeometryExecutable;
+}
+
+const d3d11::GeometryShader &ShaderExecutable11::getStreamOutShader() const
+{
+ return mStreamOutExecutable;
+}
+
+const d3d11::ComputeShader &ShaderExecutable11::getComputeShader() const
+{
+ return mComputeExecutable;
+}
+
+UniformStorage11::UniformStorage11(size_t initialSize)
+ : UniformStorageD3D(initialSize), mConstantBuffer()
+{}
+
+UniformStorage11::~UniformStorage11() {}
+
+angle::Result UniformStorage11::getConstantBuffer(const gl::Context *context,
+ Renderer11 *renderer,
+ const d3d11::Buffer **bufferOut)
+{
+ if (size() > 0 && !mConstantBuffer.valid())
+ {
+ D3D11_BUFFER_DESC desc = {0};
+ desc.ByteWidth = static_cast<unsigned int>(size());
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+
+ ANGLE_TRY(
+ renderer->allocateResource(GetImplAs<Context11>(context), desc, &mConstantBuffer));
+ }
+
+ *bufferOut = &mConstantBuffer;
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h
new file mode 100644
index 0000000000..e2892a44d7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h
@@ -0,0 +1,64 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderExecutable11.h: Defines a D3D11-specific class to contain shader
+// executable implementation details.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_SHADEREXECUTABLE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_SHADEREXECUTABLE11_H_
+
+#include "libANGLE/renderer/d3d/ShaderExecutableD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+
+namespace rx
+{
+class Renderer11;
+class UniformStorage11;
+
+class ShaderExecutable11 : public ShaderExecutableD3D
+{
+ public:
+ ShaderExecutable11(const void *function, size_t length, d3d11::PixelShader &&executable);
+ ShaderExecutable11(const void *function,
+ size_t length,
+ d3d11::VertexShader &&executable,
+ d3d11::GeometryShader &&streamOut);
+ ShaderExecutable11(const void *function, size_t length, d3d11::GeometryShader &&executable);
+ ShaderExecutable11(const void *function, size_t length, d3d11::ComputeShader &&executable);
+
+ ~ShaderExecutable11() override;
+
+ const d3d11::PixelShader &getPixelShader() const;
+ const d3d11::VertexShader &getVertexShader() const;
+ const d3d11::GeometryShader &getGeometryShader() const;
+ const d3d11::GeometryShader &getStreamOutShader() const;
+ const d3d11::ComputeShader &getComputeShader() const;
+
+ private:
+ d3d11::PixelShader mPixelExecutable;
+ d3d11::VertexShader mVertexExecutable;
+ d3d11::GeometryShader mGeometryExecutable;
+ d3d11::GeometryShader mStreamOutExecutable;
+ d3d11::ComputeShader mComputeExecutable;
+};
+
+class UniformStorage11 : public UniformStorageD3D
+{
+ public:
+ UniformStorage11(size_t initialSize);
+ ~UniformStorage11() override;
+
+ angle::Result getConstantBuffer(const gl::Context *context,
+ Renderer11 *renderer,
+ const d3d11::Buffer **bufferOut);
+
+ private:
+ d3d11::Buffer mConstantBuffer;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_SHADEREXECUTABLE11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
new file mode 100644
index 0000000000..8306cb3ee8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
@@ -0,0 +1,3940 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// StateManager11.cpp: Defines a class for caching D3D11 state
+
+#include "libANGLE/renderer/d3d/d3d11/StateManager11.h"
+
+#include "common/angleutils.h"
+#include "common/bitset_utils.h"
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Query.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/renderer/d3d/DisplayD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h"
+#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
+#include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h"
+#include "libANGLE/renderer/d3d/d3d11/VertexArray11.h"
+#include "libANGLE/renderer/d3d/d3d11/VertexBuffer11.h"
+
+namespace rx
+{
+
+namespace
+{
+bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOURCE_VIEW_DESC desc)
+{
+ unsigned mipLevel = index.getLevelIndex();
+ gl::TextureType textureType = index.getType();
+
+ switch (desc.ViewDimension)
+ {
+ case D3D11_SRV_DIMENSION_TEXTURE2D:
+ {
+ bool allLevels = (desc.Texture2D.MipLevels == std::numeric_limits<UINT>::max());
+ unsigned int maxSrvMip = desc.Texture2D.MipLevels + desc.Texture2D.MostDetailedMip;
+ maxSrvMip = allLevels ? INT_MAX : maxSrvMip;
+
+ unsigned mipMin = index.getLevelIndex();
+ unsigned mipMax = INT_MAX;
+
+ return textureType == gl::TextureType::_2D &&
+ gl::RangeUI(mipMin, mipMax)
+ .intersects(gl::RangeUI(desc.Texture2D.MostDetailedMip, maxSrvMip));
+ }
+
+ case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
+ {
+ GLint layerIndex = index.getLayerIndex();
+
+ bool allLevels = (desc.Texture2DArray.MipLevels == std::numeric_limits<UINT>::max());
+ unsigned int maxSrvMip =
+ desc.Texture2DArray.MipLevels + desc.Texture2DArray.MostDetailedMip;
+ maxSrvMip = allLevels ? INT_MAX : maxSrvMip;
+
+ unsigned maxSlice = desc.Texture2DArray.FirstArraySlice + desc.Texture2DArray.ArraySize;
+
+ // Cube maps can be mapped to Texture2DArray SRVs
+ return (textureType == gl::TextureType::_2DArray ||
+ textureType == gl::TextureType::CubeMap) &&
+ desc.Texture2DArray.MostDetailedMip <= mipLevel && mipLevel < maxSrvMip &&
+ desc.Texture2DArray.FirstArraySlice <= static_cast<UINT>(layerIndex) &&
+ static_cast<UINT>(layerIndex) < maxSlice;
+ }
+
+ case D3D11_SRV_DIMENSION_TEXTURECUBE:
+ {
+ bool allLevels = (desc.TextureCube.MipLevels == std::numeric_limits<UINT>::max());
+ unsigned int maxSrvMip = desc.TextureCube.MipLevels + desc.TextureCube.MostDetailedMip;
+ maxSrvMip = allLevels ? INT_MAX : maxSrvMip;
+
+ return textureType == gl::TextureType::CubeMap &&
+ desc.TextureCube.MostDetailedMip <= mipLevel && mipLevel < maxSrvMip;
+ }
+
+ case D3D11_SRV_DIMENSION_TEXTURE3D:
+ {
+ bool allLevels = (desc.Texture3D.MipLevels == std::numeric_limits<UINT>::max());
+ unsigned int maxSrvMip = desc.Texture3D.MipLevels + desc.Texture3D.MostDetailedMip;
+ maxSrvMip = allLevels ? INT_MAX : maxSrvMip;
+
+ return textureType == gl::TextureType::_3D &&
+ desc.Texture3D.MostDetailedMip <= mipLevel && mipLevel < maxSrvMip;
+ }
+ default:
+ // We only handle the cases corresponding to valid image indexes
+ UNIMPLEMENTED();
+ }
+
+ return false;
+}
+
+bool ImageIndexConflictsWithUAV(const gl::ImageIndex &index, D3D11_UNORDERED_ACCESS_VIEW_DESC desc)
+{
+ unsigned mipLevel = index.getLevelIndex();
+ gl::TextureType textureType = index.getType();
+
+ switch (desc.ViewDimension)
+ {
+ case D3D11_UAV_DIMENSION_TEXTURE2D:
+ {
+ return textureType == gl::TextureType::_2D && mipLevel == desc.Texture2D.MipSlice;
+ }
+
+ case D3D11_UAV_DIMENSION_TEXTURE2DARRAY:
+ {
+ GLint layerIndex = index.getLayerIndex();
+ unsigned mipSlice = desc.Texture2DArray.MipSlice;
+ unsigned firstArraySlice = desc.Texture2DArray.FirstArraySlice;
+ unsigned lastArraySlice = firstArraySlice + desc.Texture2DArray.ArraySize;
+
+ return (textureType == gl::TextureType::_2DArray ||
+ textureType == gl::TextureType::CubeMap) &&
+ (mipLevel == mipSlice && gl::RangeUI(firstArraySlice, lastArraySlice)
+ .contains(static_cast<UINT>(layerIndex)));
+ }
+
+ case D3D11_UAV_DIMENSION_TEXTURE3D:
+ {
+ GLint layerIndex = index.getLayerIndex();
+ unsigned mipSlice = desc.Texture3D.MipSlice;
+ unsigned firstWSlice = desc.Texture3D.FirstWSlice;
+ unsigned lastWSlice = firstWSlice + desc.Texture3D.WSize;
+
+ return textureType == gl::TextureType::_3D &&
+ (mipLevel == mipSlice &&
+ gl::RangeUI(firstWSlice, lastWSlice).contains(static_cast<UINT>(layerIndex)));
+ }
+ default:
+ return false;
+ }
+}
+
+// Does *not* increment the resource ref count!!
+ID3D11Resource *GetViewResource(ID3D11View *view)
+{
+ ID3D11Resource *resource = nullptr;
+ ASSERT(view);
+ view->GetResource(&resource);
+ resource->Release();
+ return resource;
+}
+
+int GetWrapBits(GLenum wrap)
+{
+ switch (wrap)
+ {
+ case GL_CLAMP_TO_EDGE:
+ return 0x0;
+ case GL_REPEAT:
+ return 0x1;
+ case GL_MIRRORED_REPEAT:
+ return 0x2;
+ case GL_CLAMP_TO_BORDER:
+ return 0x3;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+Optional<size_t> FindFirstNonInstanced(
+ const std::vector<const TranslatedAttribute *> &currentAttributes)
+{
+ for (size_t index = 0; index < currentAttributes.size(); ++index)
+ {
+ if (currentAttributes[index]->divisor == 0)
+ {
+ return Optional<size_t>(index);
+ }
+ }
+
+ return Optional<size_t>::Invalid();
+}
+
+void SortAttributesByLayout(const ProgramD3D &programD3D,
+ const std::vector<TranslatedAttribute> &vertexArrayAttribs,
+ const std::vector<TranslatedAttribute> &currentValueAttribs,
+ AttribIndexArray *sortedD3DSemanticsOut,
+ std::vector<const TranslatedAttribute *> *sortedAttributesOut)
+{
+ sortedAttributesOut->clear();
+
+ const AttribIndexArray &locationToSemantic = programD3D.getAttribLocationToD3DSemantics();
+
+ for (auto locationIndex : programD3D.getState().getActiveAttribLocationsMask())
+ {
+ int d3dSemantic = locationToSemantic[locationIndex];
+ if (sortedAttributesOut->size() <= static_cast<size_t>(d3dSemantic))
+ {
+ sortedAttributesOut->resize(d3dSemantic + 1);
+ }
+
+ (*sortedD3DSemanticsOut)[d3dSemantic] = d3dSemantic;
+
+ const auto *arrayAttrib = &vertexArrayAttribs[locationIndex];
+ if (arrayAttrib->attribute && arrayAttrib->attribute->enabled)
+ {
+ (*sortedAttributesOut)[d3dSemantic] = arrayAttrib;
+ }
+ else
+ {
+ ASSERT(currentValueAttribs[locationIndex].attribute);
+ (*sortedAttributesOut)[d3dSemantic] = &currentValueAttribs[locationIndex];
+ }
+ }
+}
+
+void UpdateUniformBuffer(ID3D11DeviceContext *deviceContext,
+ UniformStorage11 *storage,
+ const d3d11::Buffer *buffer)
+{
+ deviceContext->UpdateSubresource(buffer->get(), 0, nullptr, storage->getDataPointer(0, 0), 0,
+ 0);
+}
+
+size_t GetReservedBufferCount(bool usesPointSpriteEmulation)
+{
+ return usesPointSpriteEmulation ? 1 : 0;
+}
+
+bool CullsEverything(const gl::State &glState)
+{
+ return (glState.getRasterizerState().cullFace &&
+ glState.getRasterizerState().cullMode == gl::CullFaceMode::FrontAndBack);
+}
+} // anonymous namespace
+
+// StateManager11::ViewCache Implementation.
+template <typename ViewType, typename DescType>
+StateManager11::ViewCache<ViewType, DescType>::ViewCache() : mHighestUsedView(0)
+{}
+
+template <typename ViewType, typename DescType>
+StateManager11::ViewCache<ViewType, DescType>::~ViewCache()
+{}
+
+template <typename ViewType, typename DescType>
+void StateManager11::ViewCache<ViewType, DescType>::update(size_t resourceIndex, ViewType *view)
+{
+ ASSERT(resourceIndex < mCurrentViews.size());
+ ViewRecord<DescType> *record = &mCurrentViews[resourceIndex];
+
+ record->view = reinterpret_cast<uintptr_t>(view);
+ if (view)
+ {
+ record->resource = reinterpret_cast<uintptr_t>(GetViewResource(view));
+ view->GetDesc(&record->desc);
+ mHighestUsedView = std::max(resourceIndex + 1, mHighestUsedView);
+ }
+ else
+ {
+ record->resource = 0;
+
+ if (resourceIndex + 1 == mHighestUsedView)
+ {
+ do
+ {
+ --mHighestUsedView;
+ } while (mHighestUsedView > 0 && mCurrentViews[mHighestUsedView].view == 0);
+ }
+ }
+}
+
+template <typename ViewType, typename DescType>
+void StateManager11::ViewCache<ViewType, DescType>::clear()
+{
+ if (mCurrentViews.empty())
+ {
+ return;
+ }
+
+ memset(&mCurrentViews[0], 0, sizeof(ViewRecord<DescType>) * mCurrentViews.size());
+ mHighestUsedView = 0;
+}
+
+StateManager11::SRVCache *StateManager11::getSRVCache(gl::ShaderType shaderType)
+{
+ ASSERT(shaderType != gl::ShaderType::InvalidEnum);
+ return &mCurShaderSRVs[shaderType];
+}
+
+// ShaderConstants11 implementation
+ShaderConstants11::ShaderConstants11() : mNumActiveShaderSamplers({})
+{
+ mShaderConstantsDirty.set();
+}
+
+ShaderConstants11::~ShaderConstants11() {}
+
+void ShaderConstants11::init(const gl::Caps &caps)
+{
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ mShaderSamplerMetadata[shaderType].resize(caps.maxShaderTextureImageUnits[shaderType]);
+ mShaderReadonlyImageMetadata[shaderType].resize(caps.maxShaderImageUniforms[shaderType]);
+ mShaderImageMetadata[shaderType].resize(caps.maxShaderImageUniforms[shaderType]);
+ }
+}
+
+size_t ShaderConstants11::GetShaderConstantsStructSize(gl::ShaderType shaderType)
+{
+ switch (shaderType)
+ {
+ case gl::ShaderType::Vertex:
+ return sizeof(Vertex);
+ case gl::ShaderType::Fragment:
+ return sizeof(Pixel);
+ case gl::ShaderType::Compute:
+ return sizeof(Compute);
+
+ // TODO(jiawei.shao@intel.com): return geometry shader constant struct size
+ case gl::ShaderType::Geometry:
+ return 0u;
+
+ default:
+ UNREACHABLE();
+ return 0u;
+ }
+}
+
+size_t ShaderConstants11::getRequiredBufferSize(gl::ShaderType shaderType) const
+{
+ ASSERT(shaderType != gl::ShaderType::InvalidEnum);
+ return GetShaderConstantsStructSize(shaderType) +
+ mShaderSamplerMetadata[shaderType].size() * sizeof(SamplerMetadata) +
+ mShaderImageMetadata[shaderType].size() * sizeof(ImageMetadata) +
+ mShaderReadonlyImageMetadata[shaderType].size() * sizeof(ImageMetadata);
+}
+
+void ShaderConstants11::markDirty()
+{
+ mShaderConstantsDirty.set();
+ mNumActiveShaderSamplers.fill(0);
+}
+
+bool ShaderConstants11::updateSamplerMetadata(SamplerMetadata *data,
+ const gl::Texture &texture,
+ const gl::SamplerState &samplerState)
+{
+ bool dirty = false;
+ unsigned int baseLevel = texture.getTextureState().getEffectiveBaseLevel();
+ gl::TextureTarget target = (texture.getType() == gl::TextureType::CubeMap)
+ ? gl::kCubeMapTextureTargetMin
+ : gl::NonCubeTextureTypeToTarget(texture.getType());
+ GLenum sizedFormat = texture.getFormat(target, baseLevel).info->sizedInternalFormat;
+ if (data->baseLevel != static_cast<int>(baseLevel))
+ {
+ data->baseLevel = static_cast<int>(baseLevel);
+ dirty = true;
+ }
+
+ // Some metadata is needed only for integer textures. We avoid updating the constant buffer
+ // unnecessarily by changing the data only in case the texture is an integer texture and
+ // the values have changed.
+ bool needIntegerTextureMetadata = false;
+ // internalFormatBits == 0 means a 32-bit texture in the case of integer textures.
+ int internalFormatBits = 0;
+ switch (sizedFormat)
+ {
+ case GL_RGBA32I:
+ case GL_RGBA32UI:
+ case GL_RGB32I:
+ case GL_RGB32UI:
+ case GL_RG32I:
+ case GL_RG32UI:
+ case GL_R32I:
+ case GL_R32UI:
+ needIntegerTextureMetadata = true;
+ break;
+ case GL_RGBA16I:
+ case GL_RGBA16UI:
+ case GL_RGB16I:
+ case GL_RGB16UI:
+ case GL_RG16I:
+ case GL_RG16UI:
+ case GL_R16I:
+ case GL_R16UI:
+ needIntegerTextureMetadata = true;
+ internalFormatBits = 16;
+ break;
+ case GL_RGBA8I:
+ case GL_RGBA8UI:
+ case GL_RGB8I:
+ case GL_RGB8UI:
+ case GL_RG8I:
+ case GL_RG8UI:
+ case GL_R8I:
+ case GL_R8UI:
+ needIntegerTextureMetadata = true;
+ internalFormatBits = 8;
+ break;
+ case GL_RGB10_A2UI:
+ needIntegerTextureMetadata = true;
+ internalFormatBits = 10;
+ break;
+ default:
+ break;
+ }
+ if (needIntegerTextureMetadata)
+ {
+ if (data->internalFormatBits != internalFormatBits)
+ {
+ data->internalFormatBits = internalFormatBits;
+ dirty = true;
+ }
+ // Pack the wrap values into one integer so we can fit all the metadata in two 4-integer
+ // vectors.
+ GLenum wrapS = samplerState.getWrapS();
+ GLenum wrapT = samplerState.getWrapT();
+ GLenum wrapR = samplerState.getWrapR();
+ int wrapModes = GetWrapBits(wrapS) | (GetWrapBits(wrapT) << 2) | (GetWrapBits(wrapR) << 4);
+ if (data->wrapModes != wrapModes)
+ {
+ data->wrapModes = wrapModes;
+ dirty = true;
+ }
+
+ const angle::ColorGeneric &borderColor(samplerState.getBorderColor());
+ constexpr int kBlack[4] = {0};
+ const void *const intBorderColor = (borderColor.type == angle::ColorGeneric::Type::Float)
+ ? kBlack
+ : borderColor.colorI.data();
+ ASSERT(static_cast<const void *>(borderColor.colorI.data()) ==
+ static_cast<const void *>(borderColor.colorUI.data()));
+ if (memcmp(data->intBorderColor, intBorderColor, sizeof(data->intBorderColor)) != 0)
+ {
+ memcpy(data->intBorderColor, intBorderColor, sizeof(data->intBorderColor));
+ dirty = true;
+ }
+ }
+
+ return dirty;
+}
+
+bool ShaderConstants11::updateImageMetadata(ImageMetadata *data, const gl::ImageUnit &imageUnit)
+{
+ bool dirty = false;
+
+ if (data->layer != static_cast<int>(imageUnit.layer))
+ {
+ data->layer = static_cast<int>(imageUnit.layer);
+ dirty = true;
+ }
+
+ if (data->level != static_cast<unsigned int>(imageUnit.level))
+ {
+ data->level = static_cast<unsigned int>(imageUnit.level);
+ dirty = true;
+ }
+
+ return dirty;
+}
+
+void ShaderConstants11::setComputeWorkGroups(GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ)
+{
+ mCompute.numWorkGroups[0] = numGroupsX;
+ mCompute.numWorkGroups[1] = numGroupsY;
+ mCompute.numWorkGroups[2] = numGroupsZ;
+ mShaderConstantsDirty.set(gl::ShaderType::Compute);
+}
+
+void ShaderConstants11::setMultiviewWriteToViewportIndex(GLfloat index)
+{
+ mVertex.multiviewWriteToViewportIndex = index;
+ mPixel.multiviewWriteToViewportIndex = index;
+ mShaderConstantsDirty.set(gl::ShaderType::Vertex);
+ mShaderConstantsDirty.set(gl::ShaderType::Fragment);
+}
+
+void ShaderConstants11::onViewportChange(const gl::Rectangle &glViewport,
+ const D3D11_VIEWPORT &dxViewport,
+ bool is9_3,
+ bool presentPathFast)
+{
+ mShaderConstantsDirty.set(gl::ShaderType::Vertex);
+ mShaderConstantsDirty.set(gl::ShaderType::Fragment);
+
+ // On Feature Level 9_*, we must emulate large and/or negative viewports in the shaders
+ // using viewAdjust (like the D3D9 renderer).
+ if (is9_3)
+ {
+ mVertex.viewAdjust[0] = static_cast<float>((glViewport.width - dxViewport.Width) +
+ 2 * (glViewport.x - dxViewport.TopLeftX)) /
+ dxViewport.Width;
+ mVertex.viewAdjust[1] = static_cast<float>((glViewport.height - dxViewport.Height) +
+ 2 * (glViewport.y - dxViewport.TopLeftY)) /
+ dxViewport.Height;
+ mVertex.viewAdjust[2] = static_cast<float>(glViewport.width) / dxViewport.Width;
+ mVertex.viewAdjust[3] = static_cast<float>(glViewport.height) / dxViewport.Height;
+ }
+
+ mPixel.viewCoords[0] = glViewport.width * 0.5f;
+ mPixel.viewCoords[1] = glViewport.height * 0.5f;
+ mPixel.viewCoords[2] = glViewport.x + (glViewport.width * 0.5f);
+ mPixel.viewCoords[3] = glViewport.y + (glViewport.height * 0.5f);
+
+ // Instanced pointsprite emulation requires ViewCoords to be defined in the
+ // the vertex shader.
+ mVertex.viewCoords[0] = mPixel.viewCoords[0];
+ mVertex.viewCoords[1] = mPixel.viewCoords[1];
+ mVertex.viewCoords[2] = mPixel.viewCoords[2];
+ mVertex.viewCoords[3] = mPixel.viewCoords[3];
+
+ const float zNear = dxViewport.MinDepth;
+ const float zFar = dxViewport.MaxDepth;
+
+ mPixel.depthFront[0] = (zFar - zNear) * 0.5f;
+ mPixel.depthFront[1] = (zNear + zFar) * 0.5f;
+
+ mVertex.depthRange[0] = zNear;
+ mVertex.depthRange[1] = zFar;
+ mVertex.depthRange[2] = zFar - zNear;
+
+ mPixel.depthRange[0] = zNear;
+ mPixel.depthRange[1] = zFar;
+ mPixel.depthRange[2] = zFar - zNear;
+
+ mPixel.viewScale[0] = 1.0f;
+ mPixel.viewScale[1] = presentPathFast ? 1.0f : -1.0f;
+ // Updates to the multiviewWriteToViewportIndex member are to be handled whenever the draw
+ // framebuffer's layout is changed.
+
+ mVertex.viewScale[0] = mPixel.viewScale[0];
+ mVertex.viewScale[1] = mPixel.viewScale[1];
+}
+
+// Update the ShaderConstants with a new first vertex and return whether the update dirties them.
+ANGLE_INLINE bool ShaderConstants11::onFirstVertexChange(GLint firstVertex)
+{
+ uint32_t newFirstVertex = static_cast<uint32_t>(firstVertex);
+ bool firstVertexDirty = (mVertex.firstVertex != newFirstVertex);
+ if (firstVertexDirty)
+ {
+ mVertex.firstVertex = newFirstVertex;
+ mShaderConstantsDirty.set(gl::ShaderType::Vertex);
+ }
+ return firstVertexDirty;
+}
+
+void ShaderConstants11::onSamplerChange(gl::ShaderType shaderType,
+ unsigned int samplerIndex,
+ const gl::Texture &texture,
+ const gl::SamplerState &samplerState)
+{
+ ASSERT(shaderType != gl::ShaderType::InvalidEnum);
+ if (updateSamplerMetadata(&mShaderSamplerMetadata[shaderType][samplerIndex], texture,
+ samplerState))
+ {
+ mNumActiveShaderSamplers[shaderType] = 0;
+ }
+}
+
+void ShaderConstants11::onImageChange(gl::ShaderType shaderType,
+ unsigned int imageIndex,
+ const gl::ImageUnit &imageUnit)
+{
+ ASSERT(shaderType != gl::ShaderType::InvalidEnum);
+ if (imageUnit.access == GL_READ_ONLY)
+ {
+ if (updateImageMetadata(&mShaderReadonlyImageMetadata[shaderType][imageIndex], imageUnit))
+ {
+ mNumActiveShaderReadonlyImages[shaderType] = 0;
+ }
+ }
+ else
+ {
+ if (updateImageMetadata(&mShaderImageMetadata[shaderType][imageIndex], imageUnit))
+ {
+ mNumActiveShaderImages[shaderType] = 0;
+ }
+ }
+}
+
+angle::Result ShaderConstants11::updateBuffer(const gl::Context *context,
+ Renderer11 *renderer,
+ gl::ShaderType shaderType,
+ const ProgramD3D &programD3D,
+ const d3d11::Buffer &driverConstantBuffer)
+{
+ // Re-upload the sampler meta-data if the current program uses more samplers
+ // than we previously uploaded.
+ const int numSamplers = programD3D.getUsedSamplerRange(shaderType).length();
+ const int numReadonlyImages = programD3D.getUsedImageRange(shaderType, true).length();
+ const int numImages = programD3D.getUsedImageRange(shaderType, false).length();
+
+ const bool dirty = mShaderConstantsDirty[shaderType] ||
+ (mNumActiveShaderSamplers[shaderType] < numSamplers) ||
+ (mNumActiveShaderReadonlyImages[shaderType] < numReadonlyImages) ||
+ (mNumActiveShaderImages[shaderType] < numImages);
+
+ const size_t dataSize = GetShaderConstantsStructSize(shaderType);
+ const uint8_t *samplerData =
+ reinterpret_cast<const uint8_t *>(mShaderSamplerMetadata[shaderType].data());
+ const size_t samplerDataSize = sizeof(SamplerMetadata) * numSamplers;
+ const uint8_t *readonlyImageData =
+ reinterpret_cast<const uint8_t *>(mShaderReadonlyImageMetadata[shaderType].data());
+ const size_t readonlyImageDataSize = sizeof(ImageMetadata) * numReadonlyImages;
+ const uint8_t *imageData =
+ reinterpret_cast<const uint8_t *>(mShaderImageMetadata[shaderType].data());
+ const size_t imageDataSize = sizeof(ImageMetadata) * numImages;
+
+ mNumActiveShaderSamplers[shaderType] = numSamplers;
+ mNumActiveShaderReadonlyImages[shaderType] = numReadonlyImages;
+ mNumActiveShaderImages[shaderType] = numImages;
+ mShaderConstantsDirty.set(shaderType, false);
+
+ const uint8_t *data = nullptr;
+ switch (shaderType)
+ {
+ case gl::ShaderType::Vertex:
+ data = reinterpret_cast<const uint8_t *>(&mVertex);
+ break;
+ case gl::ShaderType::Fragment:
+ data = reinterpret_cast<const uint8_t *>(&mPixel);
+ break;
+ case gl::ShaderType::Compute:
+ data = reinterpret_cast<const uint8_t *>(&mCompute);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ ASSERT(driverConstantBuffer.valid());
+
+ if (!dirty)
+ {
+ return angle::Result::Continue;
+ }
+
+ // Previous buffer contents are discarded, so we need to refresh the whole buffer.
+ D3D11_MAPPED_SUBRESOURCE mapping = {0};
+ ANGLE_TRY(renderer->mapResource(context, driverConstantBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD,
+ 0, &mapping));
+
+ memcpy(mapping.pData, data, dataSize);
+ memcpy(static_cast<uint8_t *>(mapping.pData) + dataSize, samplerData,
+ sizeof(SamplerMetadata) * numSamplers);
+
+ memcpy(static_cast<uint8_t *>(mapping.pData) + dataSize + samplerDataSize, readonlyImageData,
+ readonlyImageDataSize);
+ memcpy(
+ static_cast<uint8_t *>(mapping.pData) + dataSize + samplerDataSize + readonlyImageDataSize,
+ imageData, imageDataSize);
+ renderer->getDeviceContext()->Unmap(driverConstantBuffer.get(), 0);
+
+ return angle::Result::Continue;
+}
+
+StateManager11::StateManager11(Renderer11 *renderer)
+ : mRenderer(renderer),
+ mInternalDirtyBits(),
+ mCurBlendColor(0, 0, 0, 0),
+ mCurSampleMask(0),
+ mCurStencilRef(0),
+ mCurStencilBackRef(0),
+ mCurStencilSize(0),
+ mCurScissorEnabled(false),
+ mCurScissorRect(),
+ mCurViewport(),
+ mCurNear(0.0f),
+ mCurFar(0.0f),
+ mViewportBounds(),
+ mRenderTargetIsDirty(true),
+ mCurPresentPathFastEnabled(false),
+ mCurPresentPathFastColorBufferHeight(0),
+ mDirtyCurrentValueAttribs(),
+ mCurrentValueAttribs(),
+ mCurrentInputLayout(),
+ mDirtyVertexBufferRange(gl::MAX_VERTEX_ATTRIBS, 0),
+ mCurrentPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_UNDEFINED),
+ mLastAppliedDrawMode(gl::PrimitiveMode::InvalidEnum),
+ mCullEverything(false),
+ mDirtySwizzles(false),
+ mAppliedIB(nullptr),
+ mAppliedIBFormat(DXGI_FORMAT_UNKNOWN),
+ mAppliedIBOffset(0),
+ mIndexBufferIsDirty(false),
+ mVertexDataManager(renderer),
+ mIndexDataManager(renderer),
+ mIsMultiviewEnabled(false),
+ mEmptySerial(mRenderer->generateSerial()),
+ mProgramD3D(nullptr),
+ mVertexArray11(nullptr),
+ mFramebuffer11(nullptr)
+{
+ mCurBlendState.blend = false;
+ mCurBlendState.sourceBlendRGB = GL_ONE;
+ mCurBlendState.destBlendRGB = GL_ZERO;
+ mCurBlendState.sourceBlendAlpha = GL_ONE;
+ mCurBlendState.destBlendAlpha = GL_ZERO;
+ mCurBlendState.blendEquationRGB = GL_FUNC_ADD;
+ mCurBlendState.blendEquationAlpha = GL_FUNC_ADD;
+ mCurBlendState.colorMaskRed = true;
+ mCurBlendState.colorMaskBlue = true;
+ mCurBlendState.colorMaskGreen = true;
+ mCurBlendState.colorMaskAlpha = true;
+ mCurBlendState.sampleAlphaToCoverage = false;
+ mCurBlendState.dither = false;
+
+ mCurDepthStencilState.depthTest = false;
+ mCurDepthStencilState.depthFunc = GL_LESS;
+ mCurDepthStencilState.depthMask = true;
+ mCurDepthStencilState.stencilTest = false;
+ mCurDepthStencilState.stencilMask = true;
+ mCurDepthStencilState.stencilFail = GL_KEEP;
+ mCurDepthStencilState.stencilPassDepthFail = GL_KEEP;
+ mCurDepthStencilState.stencilPassDepthPass = GL_KEEP;
+ mCurDepthStencilState.stencilWritemask = static_cast<GLuint>(-1);
+ mCurDepthStencilState.stencilBackFunc = GL_ALWAYS;
+ mCurDepthStencilState.stencilBackMask = static_cast<GLuint>(-1);
+ mCurDepthStencilState.stencilBackFail = GL_KEEP;
+ mCurDepthStencilState.stencilBackPassDepthFail = GL_KEEP;
+ mCurDepthStencilState.stencilBackPassDepthPass = GL_KEEP;
+ mCurDepthStencilState.stencilBackWritemask = static_cast<GLuint>(-1);
+
+ mCurRasterState.rasterizerDiscard = false;
+ mCurRasterState.cullFace = false;
+ mCurRasterState.cullMode = gl::CullFaceMode::Back;
+ mCurRasterState.frontFace = GL_CCW;
+ mCurRasterState.polygonOffsetFill = false;
+ mCurRasterState.polygonOffsetFactor = 0.0f;
+ mCurRasterState.polygonOffsetUnits = 0.0f;
+ mCurRasterState.pointDrawMode = false;
+ mCurRasterState.multiSample = false;
+
+ // Start with all internal dirty bits set except DIRTY_BIT_COMPUTE_SRVUAV_STATE and
+ // DIRTY_BIT_GRAPHICS_SRVUAV_STATE.
+ mInternalDirtyBits.set();
+ mInternalDirtyBits.reset(DIRTY_BIT_GRAPHICS_SRVUAV_STATE);
+ mInternalDirtyBits.reset(DIRTY_BIT_COMPUTE_SRVUAV_STATE);
+
+ mGraphicsDirtyBitsMask.set();
+ mGraphicsDirtyBitsMask.reset(DIRTY_BIT_COMPUTE_SRVUAV_STATE);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_PROGRAM_UNIFORMS);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_DRIVER_UNIFORMS);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_PROGRAM_ATOMIC_COUNTER_BUFFERS);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_PROGRAM_SHADER_STORAGE_BUFFERS);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_SHADERS);
+ mComputeDirtyBitsMask.set(DIRTY_BIT_COMPUTE_SRVUAV_STATE);
+
+ // Initially all current value attributes must be updated on first use.
+ mDirtyCurrentValueAttribs.set();
+
+ mCurrentVertexBuffers.fill(nullptr);
+ mCurrentVertexStrides.fill(std::numeric_limits<UINT>::max());
+ mCurrentVertexOffsets.fill(std::numeric_limits<UINT>::max());
+}
+
+StateManager11::~StateManager11() {}
+
+template <typename SRVType>
+void StateManager11::setShaderResourceInternal(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const SRVType *srv)
+{
+ auto *currentSRVs = getSRVCache(shaderType);
+ ASSERT(static_cast<size_t>(resourceSlot) < currentSRVs->size());
+ const ViewRecord<D3D11_SHADER_RESOURCE_VIEW_DESC> &record = (*currentSRVs)[resourceSlot];
+
+ if (record.view != reinterpret_cast<uintptr_t>(srv))
+ {
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ ID3D11ShaderResourceView *srvPtr = srv ? srv->get() : nullptr;
+ if (srvPtr)
+ {
+ uintptr_t resource = reinterpret_cast<uintptr_t>(GetViewResource(srvPtr));
+ unsetConflictingUAVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Compute,
+ resource, nullptr);
+ }
+
+ switch (shaderType)
+ {
+ case gl::ShaderType::Vertex:
+ deviceContext->VSSetShaderResources(resourceSlot, 1, &srvPtr);
+ break;
+ case gl::ShaderType::Fragment:
+ deviceContext->PSSetShaderResources(resourceSlot, 1, &srvPtr);
+ break;
+ case gl::ShaderType::Compute:
+ {
+ if (srvPtr)
+ {
+ uintptr_t resource = reinterpret_cast<uintptr_t>(GetViewResource(srvPtr));
+ unsetConflictingRTVs(resource);
+ }
+ deviceContext->CSSetShaderResources(resourceSlot, 1, &srvPtr);
+ break;
+ }
+ default:
+ UNREACHABLE();
+ }
+
+ currentSRVs->update(resourceSlot, srvPtr);
+ }
+}
+
+template <typename UAVType>
+void StateManager11::setUnorderedAccessViewInternal(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const UAVType *uav)
+{
+ ASSERT(shaderType == gl::ShaderType::Compute);
+ ASSERT(static_cast<size_t>(resourceSlot) < mCurComputeUAVs.size());
+ const ViewRecord<D3D11_UNORDERED_ACCESS_VIEW_DESC> &record = mCurComputeUAVs[resourceSlot];
+
+ if (record.view != reinterpret_cast<uintptr_t>(uav))
+ {
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ ID3D11UnorderedAccessView *uavPtr = uav ? uav->get() : nullptr;
+ // We need to make sure that resource being set to UnorderedAccessView slot |resourceSlot|
+ // is not bound on SRV.
+ if (uavPtr)
+ {
+ uintptr_t resource = reinterpret_cast<uintptr_t>(GetViewResource(uavPtr));
+ unsetConflictingSRVs(gl::PipelineType::ComputePipeline, gl::ShaderType::Vertex,
+ resource, nullptr, false);
+ unsetConflictingSRVs(gl::PipelineType::ComputePipeline, gl::ShaderType::Fragment,
+ resource, nullptr, false);
+ unsetConflictingSRVs(gl::PipelineType::ComputePipeline, gl::ShaderType::Compute,
+ resource, nullptr, false);
+ }
+ deviceContext->CSSetUnorderedAccessViews(resourceSlot, 1, &uavPtr, nullptr);
+
+ mCurComputeUAVs.update(resourceSlot, uavPtr);
+ }
+}
+
+void StateManager11::updateStencilSizeIfChanged(bool depthStencilInitialized,
+ unsigned int stencilSize)
+{
+ if (!depthStencilInitialized || stencilSize != mCurStencilSize)
+ {
+ mCurStencilSize = stencilSize;
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+}
+
+void StateManager11::checkPresentPath(const gl::Context *context)
+{
+ if (!mRenderer->presentPathFastEnabled())
+ return;
+
+ const auto *framebuffer = context->getState().getDrawFramebuffer();
+ const auto *firstColorAttachment = framebuffer->getFirstColorAttachment();
+ const bool presentPathFastActive = UsePresentPathFast(mRenderer, firstColorAttachment);
+
+ const int colorBufferHeight = firstColorAttachment ? firstColorAttachment->getSize().height : 0;
+
+ if ((mCurPresentPathFastEnabled != presentPathFastActive) ||
+ (presentPathFastActive && (colorBufferHeight != mCurPresentPathFastColorBufferHeight)))
+ {
+ mCurPresentPathFastEnabled = presentPathFastActive;
+ mCurPresentPathFastColorBufferHeight = colorBufferHeight;
+
+ // Scissor rect may need to be vertically inverted
+ mInternalDirtyBits.set(DIRTY_BIT_SCISSOR_STATE);
+
+ // Cull Mode may need to be inverted
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+
+ // Viewport may need to be vertically inverted
+ invalidateViewport(context);
+ }
+}
+
+angle::Result StateManager11::updateStateForCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ)
+{
+ mShaderConstants.setComputeWorkGroups(numGroupsX, numGroupsY, numGroupsZ);
+
+ if (mProgramD3D->updateSamplerMapping() == ProgramD3D::SamplerMapping::WasDirty)
+ {
+ invalidateTexturesAndSamplers();
+ }
+
+ if (mDirtySwizzles)
+ {
+ ANGLE_TRY(generateSwizzlesForShader(context, gl::ShaderType::Compute));
+ mDirtySwizzles = false;
+ }
+
+ if (mProgramD3D->anyShaderUniformsDirty())
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_UNIFORMS);
+ }
+
+ auto dirtyBitsCopy = mInternalDirtyBits & mComputeDirtyBitsMask;
+ mInternalDirtyBits &= ~mComputeDirtyBitsMask;
+
+ for (auto iter = dirtyBitsCopy.begin(), end = dirtyBitsCopy.end(); iter != end; ++iter)
+ {
+ switch (*iter)
+ {
+ case DIRTY_BIT_COMPUTE_SRVUAV_STATE:
+ // Avoid to call syncTexturesForCompute function two times.
+ iter.resetLaterBit(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
+ ANGLE_TRY(syncTexturesForCompute(context));
+ break;
+ case DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE:
+ ANGLE_TRY(syncTexturesForCompute(context));
+ break;
+ case DIRTY_BIT_PROGRAM_UNIFORMS:
+ case DIRTY_BIT_DRIVER_UNIFORMS:
+ ANGLE_TRY(applyComputeUniforms(context, mProgramD3D));
+ break;
+ case DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS:
+ ANGLE_TRY(syncUniformBuffers(context));
+ break;
+ case DIRTY_BIT_PROGRAM_ATOMIC_COUNTER_BUFFERS:
+ ANGLE_TRY(syncAtomicCounterBuffers(context));
+ break;
+ case DIRTY_BIT_PROGRAM_SHADER_STORAGE_BUFFERS:
+ ANGLE_TRY(syncShaderStorageBuffers(context));
+ break;
+ case DIRTY_BIT_SHADERS:
+ ANGLE_TRY(syncProgramForCompute(context));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+void StateManager11::syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits)
+{
+ if (!dirtyBits.any())
+ {
+ return;
+ }
+
+ const gl::State &state = context->getState();
+
+ for (size_t dirtyBit : dirtyBits)
+ {
+ switch (dirtyBit)
+ {
+ case gl::State::DIRTY_BIT_BLEND_EQUATIONS:
+ {
+ const gl::BlendState &blendState = state.getBlendState();
+ if (blendState.blendEquationRGB != mCurBlendState.blendEquationRGB ||
+ blendState.blendEquationAlpha != mCurBlendState.blendEquationAlpha)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_BLEND_FUNCS:
+ {
+ const gl::BlendState &blendState = state.getBlendState();
+ if (blendState.sourceBlendRGB != mCurBlendState.sourceBlendRGB ||
+ blendState.destBlendRGB != mCurBlendState.destBlendRGB ||
+ blendState.sourceBlendAlpha != mCurBlendState.sourceBlendAlpha ||
+ blendState.destBlendAlpha != mCurBlendState.destBlendAlpha)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_BLEND_ENABLED:
+ if (state.getBlendState().blend != mCurBlendState.blend)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED:
+ if (state.getBlendState().sampleAlphaToCoverage !=
+ mCurBlendState.sampleAlphaToCoverage)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DITHER_ENABLED:
+ if (state.getBlendState().dither != mCurBlendState.dither)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_COLOR_MASK:
+ {
+ const gl::BlendState &blendState = state.getBlendState();
+ if (blendState.colorMaskRed != mCurBlendState.colorMaskRed ||
+ blendState.colorMaskGreen != mCurBlendState.colorMaskGreen ||
+ blendState.colorMaskBlue != mCurBlendState.colorMaskBlue ||
+ blendState.colorMaskAlpha != mCurBlendState.colorMaskAlpha)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_BLEND_COLOR:
+ if (state.getBlendColor() != mCurBlendColor)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DEPTH_MASK:
+ if (state.getDepthStencilState().depthMask != mCurDepthStencilState.depthMask)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DEPTH_TEST_ENABLED:
+ if (state.getDepthStencilState().depthTest != mCurDepthStencilState.depthTest)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DEPTH_FUNC:
+ if (state.getDepthStencilState().depthFunc != mCurDepthStencilState.depthFunc)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_TEST_ENABLED:
+ if (state.getDepthStencilState().stencilTest != mCurDepthStencilState.stencilTest)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_FUNCS_FRONT:
+ {
+ const gl::DepthStencilState &depthStencil = state.getDepthStencilState();
+ if (depthStencil.stencilFunc != mCurDepthStencilState.stencilFunc ||
+ depthStencil.stencilMask != mCurDepthStencilState.stencilMask ||
+ state.getStencilRef() != mCurStencilRef)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_STENCIL_FUNCS_BACK:
+ {
+ const gl::DepthStencilState &depthStencil = state.getDepthStencilState();
+ if (depthStencil.stencilBackFunc != mCurDepthStencilState.stencilBackFunc ||
+ depthStencil.stencilBackMask != mCurDepthStencilState.stencilBackMask ||
+ state.getStencilBackRef() != mCurStencilBackRef)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT:
+ if (state.getDepthStencilState().stencilWritemask !=
+ mCurDepthStencilState.stencilWritemask)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_BACK:
+ if (state.getDepthStencilState().stencilBackWritemask !=
+ mCurDepthStencilState.stencilBackWritemask)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_OPS_FRONT:
+ {
+ const gl::DepthStencilState &depthStencil = state.getDepthStencilState();
+ if (depthStencil.stencilFail != mCurDepthStencilState.stencilFail ||
+ depthStencil.stencilPassDepthFail !=
+ mCurDepthStencilState.stencilPassDepthFail ||
+ depthStencil.stencilPassDepthPass != mCurDepthStencilState.stencilPassDepthPass)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_STENCIL_OPS_BACK:
+ {
+ const gl::DepthStencilState &depthStencil = state.getDepthStencilState();
+ if (depthStencil.stencilBackFail != mCurDepthStencilState.stencilBackFail ||
+ depthStencil.stencilBackPassDepthFail !=
+ mCurDepthStencilState.stencilBackPassDepthFail ||
+ depthStencil.stencilBackPassDepthPass !=
+ mCurDepthStencilState.stencilBackPassDepthPass)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_CULL_FACE_ENABLED:
+ if (state.getRasterizerState().cullFace != mCurRasterState.cullFace)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+ mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
+ }
+ break;
+ case gl::State::DIRTY_BIT_CULL_FACE:
+ if (state.getRasterizerState().cullMode != mCurRasterState.cullMode)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+ mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
+ }
+ break;
+ case gl::State::DIRTY_BIT_FRONT_FACE:
+ if (state.getRasterizerState().frontFace != mCurRasterState.frontFace)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+ mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
+ }
+ break;
+ case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED:
+ if (state.getRasterizerState().polygonOffsetFill !=
+ mCurRasterState.polygonOffsetFill)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_POLYGON_OFFSET:
+ {
+ const gl::RasterizerState &rasterState = state.getRasterizerState();
+ if (rasterState.polygonOffsetFactor != mCurRasterState.polygonOffsetFactor ||
+ rasterState.polygonOffsetUnits != mCurRasterState.polygonOffsetUnits)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_RASTERIZER_DISCARD_ENABLED:
+ if (state.getRasterizerState().rasterizerDiscard !=
+ mCurRasterState.rasterizerDiscard)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+
+ // Enabling/disabling rasterizer discard affects the pixel shader.
+ invalidateShaders();
+ }
+ break;
+ case gl::State::DIRTY_BIT_SCISSOR:
+ if (state.getScissor() != mCurScissorRect)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_SCISSOR_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_SCISSOR_TEST_ENABLED:
+ if (state.isScissorTestEnabled() != mCurScissorEnabled)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_SCISSOR_STATE);
+ // Rasterizer state update needs mCurScissorsEnabled and updates when it changes
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DEPTH_RANGE:
+ invalidateViewport(context);
+ break;
+ case gl::State::DIRTY_BIT_VIEWPORT:
+ if (state.getViewport() != mCurViewport)
+ {
+ invalidateViewport(context);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING:
+ invalidateRenderTarget();
+ if (mIsMultiviewEnabled)
+ {
+ handleMultiviewDrawFramebufferChange(context);
+ }
+ mFramebuffer11 = GetImplAs<Framebuffer11>(state.getDrawFramebuffer());
+ break;
+ case gl::State::DIRTY_BIT_VERTEX_ARRAY_BINDING:
+ invalidateVertexBuffer();
+ // Force invalidate the current value attributes, since the VertexArray11 keeps an
+ // internal cache of TranslatedAttributes, and they CurrentValue attributes are
+ // owned by the StateManager11/Context.
+ mDirtyCurrentValueAttribs.set();
+ // Invalidate the cached index buffer.
+ invalidateIndexBuffer();
+ mVertexArray11 = GetImplAs<VertexArray11>(state.getVertexArray());
+ break;
+ case gl::State::DIRTY_BIT_UNIFORM_BUFFER_BINDINGS:
+ invalidateProgramUniformBuffers();
+ break;
+ case gl::State::DIRTY_BIT_ATOMIC_COUNTER_BUFFER_BINDING:
+ invalidateProgramAtomicCounterBuffers();
+ break;
+ case gl::State::DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING:
+ invalidateProgramShaderStorageBuffers();
+ break;
+ case gl::State::DIRTY_BIT_TEXTURE_BINDINGS:
+ invalidateTexturesAndSamplers();
+ break;
+ case gl::State::DIRTY_BIT_SAMPLER_BINDINGS:
+ invalidateTexturesAndSamplers();
+ break;
+ case gl::State::DIRTY_BIT_IMAGE_BINDINGS:
+ // TODO(jie.a.chen@intel.com): More fine-grained update.
+ // Currently images are updated together with textures and samplers. It would be
+ // better to update them separately.
+ // http://anglebug.com/2814
+ invalidateTexturesAndSamplers();
+ break;
+ case gl::State::DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING:
+ invalidateTransformFeedback();
+ break;
+ case gl::State::DIRTY_BIT_PROGRAM_BINDING:
+ mProgramD3D = GetImplAs<ProgramD3D>(state.getProgram());
+ break;
+ case gl::State::DIRTY_BIT_PROGRAM_EXECUTABLE:
+ {
+ invalidateShaders();
+ invalidateTexturesAndSamplers();
+ invalidateProgramUniforms();
+ invalidateProgramUniformBuffers();
+ invalidateProgramAtomicCounterBuffers();
+ invalidateProgramShaderStorageBuffers();
+ invalidateDriverUniforms();
+ const gl::Program *program = state.getProgram();
+ if (!program || !program->hasLinkedShaderStage(gl::ShaderType::Compute))
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
+ invalidateVertexBuffer();
+ invalidateRenderTarget();
+ // If OVR_multiview2 is enabled, the attribute divisor has to be updated for
+ // each binding. When using compute, there could be no vertex array.
+ if (mIsMultiviewEnabled && mVertexArray11)
+ {
+ ASSERT(mProgramD3D);
+ ASSERT(mVertexArray11 == GetImplAs<VertexArray11>(state.getVertexArray()));
+ const gl::ProgramState &programState = mProgramD3D->getState();
+ int numViews =
+ programState.usesMultiview() ? programState.getNumViews() : 1;
+ mVertexArray11->markAllAttributeDivisorsForAdjustment(numViews);
+ }
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_CURRENT_VALUES:
+ {
+ for (auto attribIndex : state.getAndResetDirtyCurrentValues())
+ {
+ invalidateCurrentValueAttrib(attribIndex);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_PROVOKING_VERTEX:
+ invalidateShaders();
+ break;
+ default:
+ break;
+ }
+ }
+
+ // TODO(jmadill): Input layout and vertex buffer state.
+}
+
+void StateManager11::handleMultiviewDrawFramebufferChange(const gl::Context *context)
+{
+ const auto &glState = context->getState();
+ const gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
+ ASSERT(drawFramebuffer != nullptr);
+
+ if (drawFramebuffer->isMultiview())
+ {
+ // Because the base view index is applied as an offset to the 2D texture array when the
+ // RTV is created, we just have to pass a boolean to select which code path is to be
+ // used.
+ mShaderConstants.setMultiviewWriteToViewportIndex(0.0f);
+ }
+}
+
+angle::Result StateManager11::syncBlendState(const gl::Context *context,
+ const gl::BlendState &blendState,
+ const gl::ColorF &blendColor,
+ unsigned int sampleMask)
+{
+ const d3d11::BlendState *dxBlendState = nullptr;
+ const d3d11::BlendStateKey &key =
+ RenderStateCache::GetBlendStateKey(context, mFramebuffer11, blendState);
+
+ ANGLE_TRY(mRenderer->getBlendState(context, key, &dxBlendState));
+
+ ASSERT(dxBlendState != nullptr);
+
+ float blendColors[4] = {0.0f};
+ if (blendState.sourceBlendRGB != GL_CONSTANT_ALPHA &&
+ blendState.sourceBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA &&
+ blendState.destBlendRGB != GL_CONSTANT_ALPHA &&
+ blendState.destBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA)
+ {
+ blendColors[0] = blendColor.red;
+ blendColors[1] = blendColor.green;
+ blendColors[2] = blendColor.blue;
+ blendColors[3] = blendColor.alpha;
+ }
+ else
+ {
+ blendColors[0] = blendColor.alpha;
+ blendColors[1] = blendColor.alpha;
+ blendColors[2] = blendColor.alpha;
+ blendColors[3] = blendColor.alpha;
+ }
+
+ mRenderer->getDeviceContext()->OMSetBlendState(dxBlendState->get(), blendColors, sampleMask);
+
+ mCurBlendState = blendState;
+ mCurBlendColor = blendColor;
+ mCurSampleMask = sampleMask;
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncDepthStencilState(const gl::Context *context)
+{
+ const gl::State &glState = context->getState();
+
+ mCurDepthStencilState = glState.getDepthStencilState();
+ mCurStencilRef = glState.getStencilRef();
+ mCurStencilBackRef = glState.getStencilBackRef();
+
+ // get the maximum size of the stencil ref
+ unsigned int maxStencil = 0;
+ if (mCurDepthStencilState.stencilTest && mCurStencilSize > 0)
+ {
+ maxStencil = (1 << mCurStencilSize) - 1;
+ }
+ ASSERT((mCurDepthStencilState.stencilWritemask & maxStencil) ==
+ (mCurDepthStencilState.stencilBackWritemask & maxStencil));
+ ASSERT(gl::clamp(mCurStencilRef, 0, static_cast<int>(maxStencil)) ==
+ gl::clamp(mCurStencilBackRef, 0, static_cast<int>(maxStencil)));
+ ASSERT((mCurDepthStencilState.stencilMask & maxStencil) ==
+ (mCurDepthStencilState.stencilBackMask & maxStencil));
+
+ gl::DepthStencilState modifiedGLState = glState.getDepthStencilState();
+
+ ASSERT(mCurDisableDepth.valid() && mCurDisableStencil.valid());
+
+ if (mCurDisableDepth.value())
+ {
+ modifiedGLState.depthTest = false;
+ modifiedGLState.depthMask = false;
+ }
+
+ if (mCurDisableStencil.value())
+ {
+ modifiedGLState.stencilTest = false;
+ }
+ if (!modifiedGLState.stencilTest)
+ {
+ modifiedGLState.stencilWritemask = 0;
+ modifiedGLState.stencilBackWritemask = 0;
+ }
+
+ // If STENCIL_TEST is disabled in glState, stencil testing and writing should be disabled.
+ // Verify that's true in the modifiedGLState so it is propagated to d3dState.
+ ASSERT(glState.getDepthStencilState().stencilTest ||
+ (!modifiedGLState.stencilTest && modifiedGLState.stencilWritemask == 0 &&
+ modifiedGLState.stencilBackWritemask == 0));
+
+ const d3d11::DepthStencilState *d3dState = nullptr;
+ ANGLE_TRY(mRenderer->getDepthStencilState(context, modifiedGLState, &d3dState));
+ ASSERT(d3dState);
+
+ // Max D3D11 stencil reference value is 0xFF,
+ // corresponding to the max 8 bits in a stencil buffer
+ // GL specifies we should clamp the ref value to the
+ // nearest bit depth when doing stencil ops
+ static_assert(D3D11_DEFAULT_STENCIL_READ_MASK == 0xFF,
+ "Unexpected value of D3D11_DEFAULT_STENCIL_READ_MASK");
+ static_assert(D3D11_DEFAULT_STENCIL_WRITE_MASK == 0xFF,
+ "Unexpected value of D3D11_DEFAULT_STENCIL_WRITE_MASK");
+ UINT dxStencilRef = static_cast<UINT>(gl::clamp(mCurStencilRef, 0, 0xFF));
+
+ mRenderer->getDeviceContext()->OMSetDepthStencilState(d3dState->get(), dxStencilRef);
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncRasterizerState(const gl::Context *context,
+ gl::PrimitiveMode mode)
+{
+ // TODO: Remove pointDrawMode and multiSample from gl::RasterizerState.
+ gl::RasterizerState rasterState = context->getState().getRasterizerState();
+ rasterState.pointDrawMode = (mode == gl::PrimitiveMode::Points);
+ rasterState.multiSample = mCurRasterState.multiSample;
+
+ ID3D11RasterizerState *dxRasterState = nullptr;
+
+ if (mCurPresentPathFastEnabled)
+ {
+ gl::RasterizerState modifiedRasterState = rasterState;
+
+ // If prseent path fast is active then we need invert the front face state.
+ // This ensures that both gl_FrontFacing is correct, and front/back culling
+ // is performed correctly.
+ if (modifiedRasterState.frontFace == GL_CCW)
+ {
+ modifiedRasterState.frontFace = GL_CW;
+ }
+ else
+ {
+ ASSERT(modifiedRasterState.frontFace == GL_CW);
+ modifiedRasterState.frontFace = GL_CCW;
+ }
+
+ ANGLE_TRY(mRenderer->getRasterizerState(context, modifiedRasterState, mCurScissorEnabled,
+ &dxRasterState));
+ }
+ else
+ {
+ ANGLE_TRY(mRenderer->getRasterizerState(context, rasterState, mCurScissorEnabled,
+ &dxRasterState));
+ }
+
+ mRenderer->getDeviceContext()->RSSetState(dxRasterState);
+
+ mCurRasterState = rasterState;
+
+ return angle::Result::Continue;
+}
+
+void StateManager11::syncScissorRectangle(const gl::Rectangle &scissor, bool enabled)
+{
+ int modifiedScissorY = scissor.y;
+ if (mCurPresentPathFastEnabled)
+ {
+ modifiedScissorY = mCurPresentPathFastColorBufferHeight - scissor.height - scissor.y;
+ }
+
+ if (enabled)
+ {
+ D3D11_RECT rect;
+ int x = scissor.x;
+ int y = modifiedScissorY;
+ rect.left = std::max(0, x);
+ rect.top = std::max(0, y);
+ rect.right = x + std::max(0, scissor.width);
+ rect.bottom = y + std::max(0, scissor.height);
+ mRenderer->getDeviceContext()->RSSetScissorRects(1, &rect);
+ }
+
+ mCurScissorRect = scissor;
+ mCurScissorEnabled = enabled;
+}
+
+void StateManager11::syncViewport(const gl::Context *context)
+{
+ const auto &glState = context->getState();
+ gl::Framebuffer *framebuffer = glState.getDrawFramebuffer();
+ float actualZNear = gl::clamp01(glState.getNearPlane());
+ float actualZFar = gl::clamp01(glState.getFarPlane());
+
+ const auto &caps = context->getCaps();
+ int dxMaxViewportBoundsX = static_cast<int>(caps.maxViewportWidth);
+ int dxMaxViewportBoundsY = static_cast<int>(caps.maxViewportHeight);
+ int dxMinViewportBoundsX = -dxMaxViewportBoundsX;
+ int dxMinViewportBoundsY = -dxMaxViewportBoundsY;
+
+ bool is9_3 = mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3;
+
+ if (is9_3)
+ {
+ // Feature Level 9 viewports shouldn't exceed the dimensions of the rendertarget.
+ dxMaxViewportBoundsX = static_cast<int>(mViewportBounds.width);
+ dxMaxViewportBoundsY = static_cast<int>(mViewportBounds.height);
+ dxMinViewportBoundsX = 0;
+ dxMinViewportBoundsY = 0;
+ }
+
+ const auto &viewport = glState.getViewport();
+
+ int dxViewportTopLeftX = 0;
+ int dxViewportTopLeftY = 0;
+ int dxViewportWidth = 0;
+ int dxViewportHeight = 0;
+
+ dxViewportTopLeftX = gl::clamp(viewport.x, dxMinViewportBoundsX, dxMaxViewportBoundsX);
+ dxViewportTopLeftY = gl::clamp(viewport.y, dxMinViewportBoundsY, dxMaxViewportBoundsY);
+ dxViewportWidth = gl::clamp(viewport.width, 0, dxMaxViewportBoundsX - dxViewportTopLeftX);
+ dxViewportHeight = gl::clamp(viewport.height, 0, dxMaxViewportBoundsY - dxViewportTopLeftY);
+
+ D3D11_VIEWPORT dxViewport;
+ dxViewport.TopLeftX = static_cast<float>(dxViewportTopLeftX);
+ if (mCurPresentPathFastEnabled)
+ {
+ // When present path fast is active and we're rendering to framebuffer 0, we must invert
+ // the viewport in Y-axis.
+ // NOTE: We delay the inversion until right before the call to RSSetViewports, and leave
+ // dxViewportTopLeftY unchanged. This allows us to calculate viewAdjust below using the
+ // unaltered dxViewportTopLeftY value.
+ dxViewport.TopLeftY = static_cast<float>(mCurPresentPathFastColorBufferHeight -
+ dxViewportTopLeftY - dxViewportHeight);
+ }
+ else
+ {
+ dxViewport.TopLeftY = static_cast<float>(dxViewportTopLeftY);
+ }
+
+ // The es 3.1 spec section 9.2 states that, "If there are no attachments, rendering
+ // will be limited to a rectangle having a lower left of (0, 0) and an upper right of
+ // (width, height), where width and height are the framebuffer object's default width
+ // and height." See http://anglebug.com/1594
+ // If the Framebuffer has no color attachment and the default width or height is smaller
+ // than the current viewport, use the smaller of the two sizes.
+ // If framebuffer default width or height is 0, the params should not set.
+ if (!framebuffer->getFirstNonNullAttachment() &&
+ (framebuffer->getDefaultWidth() || framebuffer->getDefaultHeight()))
+ {
+ dxViewport.Width =
+ static_cast<GLfloat>(std::min(viewport.width, framebuffer->getDefaultWidth()));
+ dxViewport.Height =
+ static_cast<GLfloat>(std::min(viewport.height, framebuffer->getDefaultHeight()));
+ }
+ else
+ {
+ dxViewport.Width = static_cast<float>(dxViewportWidth);
+ dxViewport.Height = static_cast<float>(dxViewportHeight);
+ }
+ dxViewport.MinDepth = actualZNear;
+ dxViewport.MaxDepth = actualZFar;
+
+ mRenderer->getDeviceContext()->RSSetViewports(1, &dxViewport);
+
+ mCurViewport = viewport;
+ mCurNear = actualZNear;
+ mCurFar = actualZFar;
+
+ const D3D11_VIEWPORT adjustViewport = {static_cast<FLOAT>(dxViewportTopLeftX),
+ static_cast<FLOAT>(dxViewportTopLeftY),
+ static_cast<FLOAT>(dxViewportWidth),
+ static_cast<FLOAT>(dxViewportHeight),
+ actualZNear,
+ actualZFar};
+ mShaderConstants.onViewportChange(viewport, adjustViewport, is9_3, mCurPresentPathFastEnabled);
+}
+
+void StateManager11::invalidateRenderTarget()
+{
+ mRenderTargetIsDirty = true;
+}
+
+void StateManager11::processFramebufferInvalidation(const gl::Context *context)
+{
+ ASSERT(mRenderTargetIsDirty);
+ ASSERT(context);
+
+ mInternalDirtyBits.set(DIRTY_BIT_RENDER_TARGET);
+
+ // The pixel shader is dependent on the output layout.
+ invalidateShaders();
+
+ // The D3D11 blend state is heavily dependent on the current render target.
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+
+ gl::Framebuffer *fbo = context->getState().getDrawFramebuffer();
+ ASSERT(fbo);
+
+ // Disable the depth test/depth write if we are using a stencil-only attachment.
+ // This is because ANGLE emulates stencil-only with D24S8 on D3D11 - we should neither read
+ // nor write to the unused depth part of this emulated texture.
+ bool disableDepth = (!fbo->hasDepth() && fbo->hasStencil());
+
+ // Similarly we disable the stencil portion of the DS attachment if the app only binds depth.
+ bool disableStencil = (fbo->hasDepth() && !fbo->hasStencil());
+
+ if (!mCurDisableDepth.valid() || disableDepth != mCurDisableDepth.value() ||
+ !mCurDisableStencil.valid() || disableStencil != mCurDisableStencil.value())
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+ mCurDisableDepth = disableDepth;
+ mCurDisableStencil = disableStencil;
+ }
+
+ bool multiSample = (fbo->getCachedSamples(context) != 0);
+ if (multiSample != mCurRasterState.multiSample)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+ mCurRasterState.multiSample = multiSample;
+ }
+
+ checkPresentPath(context);
+
+ if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ const auto *firstAttachment = fbo->getFirstNonNullAttachment();
+ if (firstAttachment)
+ {
+ const auto &size = firstAttachment->getSize();
+ if (mViewportBounds.width != size.width || mViewportBounds.height != size.height)
+ {
+ mViewportBounds = gl::Extents(size.width, size.height, 1);
+ invalidateViewport(context);
+ }
+ }
+ }
+}
+
+void StateManager11::invalidateBoundViews()
+{
+ for (SRVCache &curShaderSRV : mCurShaderSRVs)
+ {
+ curShaderSRV.clear();
+ }
+
+ invalidateRenderTarget();
+}
+
+void StateManager11::invalidateVertexBuffer()
+{
+ unsigned int limit = std::min<unsigned int>(mRenderer->getNativeCaps().maxVertexAttributes,
+ gl::MAX_VERTEX_ATTRIBS);
+ mDirtyVertexBufferRange = gl::RangeUI(0, limit);
+ invalidateInputLayout();
+ invalidateShaders();
+ mInternalDirtyBits.set(DIRTY_BIT_CURRENT_VALUE_ATTRIBS);
+}
+
+void StateManager11::invalidateViewport(const gl::Context *context)
+{
+ mInternalDirtyBits.set(DIRTY_BIT_VIEWPORT_STATE);
+
+ // Viewport affects the driver constants.
+ invalidateDriverUniforms();
+}
+
+void StateManager11::invalidateTexturesAndSamplers()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
+ invalidateSwizzles();
+
+ // Texture state affects the driver uniforms (base level, etc).
+ invalidateDriverUniforms();
+}
+
+void StateManager11::invalidateSwizzles()
+{
+ mDirtySwizzles = true;
+}
+
+void StateManager11::invalidateProgramUniforms()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_UNIFORMS);
+}
+
+void StateManager11::invalidateDriverUniforms()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_DRIVER_UNIFORMS);
+}
+
+void StateManager11::invalidateProgramUniformBuffers()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS);
+}
+
+void StateManager11::invalidateProgramAtomicCounterBuffers()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_ATOMIC_COUNTER_BUFFERS);
+}
+
+void StateManager11::invalidateProgramShaderStorageBuffers()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_SHADER_STORAGE_BUFFERS);
+}
+
+void StateManager11::invalidateConstantBuffer(unsigned int slot)
+{
+ if (slot == d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER)
+ {
+ invalidateDriverUniforms();
+ }
+ else if (slot == d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DEFAULT_UNIFORM_BLOCK)
+ {
+ invalidateProgramUniforms();
+ }
+ else
+ {
+ invalidateProgramUniformBuffers();
+ }
+}
+
+void StateManager11::invalidateShaders()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_SHADERS);
+}
+
+void StateManager11::invalidateTransformFeedback()
+{
+ // Transform feedback affects the stream-out geometry shader.
+ invalidateShaders();
+ mInternalDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK);
+ // syncPrimitiveTopology checks the transform feedback state.
+ mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
+}
+
+void StateManager11::invalidateInputLayout()
+{
+ mInternalDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS_AND_INPUT_LAYOUT);
+}
+
+void StateManager11::invalidateIndexBuffer()
+{
+ mIndexBufferIsDirty = true;
+}
+
+void StateManager11::setRenderTarget(ID3D11RenderTargetView *rtv, ID3D11DepthStencilView *dsv)
+{
+ if (rtv)
+ {
+ unsetConflictingView(gl::PipelineType::GraphicsPipeline, rtv, true);
+ }
+
+ if (dsv)
+ {
+ unsetConflictingView(gl::PipelineType::GraphicsPipeline, dsv, true);
+ }
+
+ mRenderer->getDeviceContext()->OMSetRenderTargets(1, &rtv, dsv);
+ mCurRTVs.clear();
+ mCurRTVs.update(0, rtv);
+ mInternalDirtyBits.set(DIRTY_BIT_RENDER_TARGET);
+}
+
+void StateManager11::setRenderTargets(ID3D11RenderTargetView **rtvs,
+ UINT numRTVs,
+ ID3D11DepthStencilView *dsv)
+{
+ for (UINT rtvIndex = 0; rtvIndex < numRTVs; ++rtvIndex)
+ {
+ unsetConflictingView(gl::PipelineType::GraphicsPipeline, rtvs[rtvIndex], true);
+ }
+
+ if (dsv)
+ {
+ unsetConflictingView(gl::PipelineType::GraphicsPipeline, dsv, true);
+ }
+
+ mRenderer->getDeviceContext()->OMSetRenderTargets(numRTVs, (numRTVs > 0) ? rtvs : nullptr, dsv);
+ mCurRTVs.clear();
+ for (UINT i = 0; i < numRTVs; i++)
+ {
+ mCurRTVs.update(i, rtvs[i]);
+ }
+ mInternalDirtyBits.set(DIRTY_BIT_RENDER_TARGET);
+}
+
+void StateManager11::onBeginQuery(Query11 *query)
+{
+ mCurrentQueries.insert(query);
+}
+
+void StateManager11::onDeleteQueryObject(Query11 *query)
+{
+ mCurrentQueries.erase(query);
+}
+
+angle::Result StateManager11::onMakeCurrent(const gl::Context *context)
+{
+ ANGLE_TRY(ensureInitialized(context));
+
+ const gl::State &state = context->getState();
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ for (Query11 *query : mCurrentQueries)
+ {
+ ANGLE_TRY(query->pause(context11));
+ }
+ mCurrentQueries.clear();
+
+ for (gl::QueryType type : angle::AllEnums<gl::QueryType>())
+ {
+ gl::Query *query = state.getActiveQuery(type);
+ if (query != nullptr)
+ {
+ Query11 *query11 = GetImplAs<Query11>(query);
+ ANGLE_TRY(query11->resume(context11));
+ mCurrentQueries.insert(query11);
+ }
+ }
+
+ // Reset the cache objects.
+ mProgramD3D = nullptr;
+ mVertexArray11 = nullptr;
+ mFramebuffer11 = nullptr;
+
+ return angle::Result::Continue;
+}
+
+void StateManager11::unsetConflictingView(gl::PipelineType pipeline,
+ ID3D11View *view,
+ bool isRenderTarget)
+{
+ uintptr_t resource = reinterpret_cast<uintptr_t>(GetViewResource(view));
+
+ unsetConflictingSRVs(pipeline, gl::ShaderType::Vertex, resource, nullptr, isRenderTarget);
+ unsetConflictingSRVs(pipeline, gl::ShaderType::Fragment, resource, nullptr, isRenderTarget);
+ unsetConflictingSRVs(pipeline, gl::ShaderType::Compute, resource, nullptr, isRenderTarget);
+ unsetConflictingUAVs(pipeline, gl::ShaderType::Compute, resource, nullptr);
+}
+
+void StateManager11::unsetConflictingSRVs(gl::PipelineType pipeline,
+ gl::ShaderType shaderType,
+ uintptr_t resource,
+ const gl::ImageIndex *index,
+ bool isRenderTarget)
+{
+ auto *currentSRVs = getSRVCache(shaderType);
+ gl::PipelineType conflictPipeline = gl::GetPipelineType(shaderType);
+ bool foundOne = false;
+ size_t count = std::min(currentSRVs->size(), currentSRVs->highestUsed());
+ for (size_t resourceIndex = 0; resourceIndex < count; ++resourceIndex)
+ {
+ auto &record = (*currentSRVs)[resourceIndex];
+
+ if (record.view && record.resource == resource &&
+ (!index || ImageIndexConflictsWithSRV(*index, record.desc)))
+ {
+ setShaderResourceInternal<d3d11::ShaderResourceView>(
+ shaderType, static_cast<UINT>(resourceIndex), nullptr);
+ foundOne = true;
+ }
+ }
+
+ if (foundOne && (pipeline != conflictPipeline || isRenderTarget))
+ {
+ switch (conflictPipeline)
+ {
+ case gl::PipelineType::GraphicsPipeline:
+ mInternalDirtyBits.set(DIRTY_BIT_GRAPHICS_SRVUAV_STATE);
+ break;
+ case gl::PipelineType::ComputePipeline:
+ mInternalDirtyBits.set(DIRTY_BIT_COMPUTE_SRVUAV_STATE);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+}
+
+void StateManager11::unsetConflictingUAVs(gl::PipelineType pipeline,
+ gl::ShaderType shaderType,
+ uintptr_t resource,
+ const gl::ImageIndex *index)
+{
+ ASSERT(shaderType == gl::ShaderType::Compute);
+ bool foundOne = false;
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ size_t count = std::min(mCurComputeUAVs.size(), mCurComputeUAVs.highestUsed());
+ for (size_t resourceIndex = 0; resourceIndex < count; ++resourceIndex)
+ {
+ auto &record = mCurComputeUAVs[resourceIndex];
+
+ if (record.view && record.resource == resource &&
+ (!index || ImageIndexConflictsWithUAV(*index, record.desc)))
+ {
+ deviceContext->CSSetUnorderedAccessViews(resourceIndex, 1, &mNullUAVs[0], nullptr);
+ mCurComputeUAVs.update(resourceIndex, nullptr);
+ foundOne = true;
+ }
+ }
+
+ if (foundOne && pipeline == gl::PipelineType::GraphicsPipeline)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_COMPUTE_SRVUAV_STATE);
+ }
+}
+
+void StateManager11::unsetConflictingRTVs(uintptr_t resource)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ size_t count = std::min(mCurRTVs.size(), mCurRTVs.highestUsed());
+ for (size_t resourceIndex = 0; resourceIndex < count; ++resourceIndex)
+ {
+ auto &record = mCurRTVs[resourceIndex];
+
+ if (record.view && record.resource == resource)
+ {
+ deviceContext->OMSetRenderTargets(0, nullptr, nullptr);
+ mCurRTVs.clear();
+ mInternalDirtyBits.set(DIRTY_BIT_RENDER_TARGET);
+ return;
+ }
+ }
+}
+
+void StateManager11::unsetConflictingAttachmentResources(
+ const gl::FramebufferAttachment &attachment,
+ ID3D11Resource *resource)
+{
+ // Unbind render target SRVs from the shader here to prevent D3D11 warnings.
+ if (attachment.type() == GL_TEXTURE)
+ {
+ uintptr_t resourcePtr = reinterpret_cast<uintptr_t>(resource);
+ const gl::ImageIndex &index = attachment.getTextureImageIndex();
+ // The index doesn't need to be corrected for the small compressed texture workaround
+ // because a rendertarget is never compressed.
+ unsetConflictingSRVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Vertex,
+ resourcePtr, &index, false);
+ unsetConflictingSRVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Fragment,
+ resourcePtr, &index, false);
+ unsetConflictingSRVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Compute,
+ resourcePtr, &index, false);
+ unsetConflictingUAVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Compute,
+ resourcePtr, &index);
+ }
+ else if (attachment.type() == GL_FRAMEBUFFER_DEFAULT)
+ {
+ uintptr_t resourcePtr = reinterpret_cast<uintptr_t>(resource);
+ unsetConflictingSRVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Vertex,
+ resourcePtr, nullptr, false);
+ unsetConflictingSRVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Fragment,
+ resourcePtr, nullptr, false);
+ unsetConflictingSRVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Compute,
+ resourcePtr, nullptr, false);
+ unsetConflictingUAVs(gl::PipelineType::GraphicsPipeline, gl::ShaderType::Compute,
+ resourcePtr, nullptr);
+ }
+}
+
+angle::Result StateManager11::ensureInitialized(const gl::Context *context)
+{
+ Renderer11 *renderer = GetImplAs<Context11>(context)->getRenderer();
+
+ const gl::Caps &caps = renderer->getNativeCaps();
+ const gl::Extensions &extensions = renderer->getNativeExtensions();
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ const GLuint maxShaderTextureImageUnits = caps.maxShaderTextureImageUnits[shaderType];
+
+ mCurShaderSRVs[shaderType].initialize(maxShaderTextureImageUnits);
+ mForceSetShaderSamplerStates[shaderType].resize(maxShaderTextureImageUnits, true);
+ mCurShaderSamplerStates[shaderType].resize(maxShaderTextureImageUnits);
+ }
+ mCurRTVs.initialize(caps.maxColorAttachments);
+ mCurComputeUAVs.initialize(caps.maxImageUnits);
+
+ // Initialize cached NULL SRV block
+ mNullSRVs.resize(caps.maxShaderTextureImageUnits[gl::ShaderType::Fragment], nullptr);
+
+ mNullUAVs.resize(caps.maxImageUnits, nullptr);
+
+ mCurrentValueAttribs.resize(caps.maxVertexAttributes);
+
+ mShaderConstants.init(caps);
+
+ mIsMultiviewEnabled = extensions.multiview || extensions.multiview2;
+
+ ANGLE_TRY(mVertexDataManager.initialize(context));
+
+ mCurrentAttributes.reserve(gl::MAX_VERTEX_ATTRIBS);
+
+ return angle::Result::Continue;
+}
+
+void StateManager11::deinitialize()
+{
+ mCurrentValueAttribs.clear();
+ mInputLayoutCache.clear();
+ mVertexDataManager.deinitialize();
+ mIndexDataManager.deinitialize();
+
+ for (d3d11::Buffer &ShaderDriverConstantBuffer : mShaderDriverConstantBuffers)
+ {
+ ShaderDriverConstantBuffer.reset();
+ }
+
+ mPointSpriteVertexBuffer.reset();
+ mPointSpriteIndexBuffer.reset();
+}
+
+// Applies the render target surface, depth stencil surface, viewport rectangle and
+// scissor rectangle to the renderer
+angle::Result StateManager11::syncFramebuffer(const gl::Context *context)
+{
+ // Check for zero-sized default framebuffer, which is a special case.
+ // in this case we do not wish to modify any state and just silently return false.
+ // this will not report any gl error but will cause the calling method to return.
+ if (mFramebuffer11->getState().id() == 0)
+ {
+ RenderTarget11 *firstRT = mFramebuffer11->getFirstRenderTarget();
+ const gl::Extents &size = firstRT->getExtents();
+ if (size.empty())
+ {
+ return angle::Result::Continue;
+ }
+ }
+
+ RTVArray framebufferRTVs = {{}};
+ const auto &colorRTs = mFramebuffer11->getCachedColorRenderTargets();
+
+ size_t appliedRTIndex = 0;
+ bool skipInactiveRTs = mRenderer->getFeatures().mrtPerfWorkaround.enabled;
+ const auto &drawStates = mFramebuffer11->getState().getDrawBufferStates();
+ gl::DrawBufferMask activeProgramOutputs = mProgramD3D->getState().getActiveOutputVariables();
+ UINT maxExistingRT = 0;
+ const auto &colorAttachments = mFramebuffer11->getState().getColorAttachments();
+
+ for (size_t rtIndex = 0; rtIndex < colorRTs.size(); ++rtIndex)
+ {
+ const RenderTarget11 *renderTarget = colorRTs[rtIndex];
+
+ // Skip inactive rendertargets if the workaround is enabled.
+ if (skipInactiveRTs &&
+ (!renderTarget || drawStates[rtIndex] == GL_NONE || !activeProgramOutputs[rtIndex]))
+ {
+ continue;
+ }
+
+ if (renderTarget)
+ {
+ framebufferRTVs[appliedRTIndex] = renderTarget->getRenderTargetView().get();
+ ASSERT(framebufferRTVs[appliedRTIndex]);
+ maxExistingRT = static_cast<UINT>(appliedRTIndex) + 1;
+
+ // Unset conflicting texture SRVs
+ const gl::FramebufferAttachment &attachment = colorAttachments[rtIndex];
+ ASSERT(attachment.isAttached());
+ unsetConflictingAttachmentResources(attachment, renderTarget->getTexture().get());
+ }
+
+ appliedRTIndex++;
+ }
+
+ // Get the depth stencil buffers
+ ID3D11DepthStencilView *framebufferDSV = nullptr;
+ const auto *depthStencilRenderTarget = mFramebuffer11->getCachedDepthStencilRenderTarget();
+ if (depthStencilRenderTarget)
+ {
+ framebufferDSV = depthStencilRenderTarget->getDepthStencilView().get();
+ ASSERT(framebufferDSV);
+
+ // Unset conflicting texture SRVs
+ const gl::FramebufferAttachment *attachment =
+ mFramebuffer11->getState().getDepthOrStencilAttachment();
+ ASSERT(attachment);
+ unsetConflictingAttachmentResources(*attachment,
+ depthStencilRenderTarget->getTexture().get());
+ }
+
+ ASSERT(maxExistingRT <= static_cast<UINT>(context->getCaps().maxDrawBuffers));
+
+ // Apply the render target and depth stencil
+ mRenderer->getDeviceContext()->OMSetRenderTargets(maxExistingRT, framebufferRTVs.data(),
+ framebufferDSV);
+ mCurRTVs.clear();
+ for (UINT i = 0; i < maxExistingRT; i++)
+ {
+ mCurRTVs.update(i, framebufferRTVs[i]);
+ }
+ return angle::Result::Continue;
+}
+
+void StateManager11::invalidateCurrentValueAttrib(size_t attribIndex)
+{
+ mDirtyCurrentValueAttribs.set(attribIndex);
+ mInternalDirtyBits.set(DIRTY_BIT_CURRENT_VALUE_ATTRIBS);
+ invalidateInputLayout();
+ invalidateShaders();
+}
+
+angle::Result StateManager11::syncCurrentValueAttribs(
+ const gl::Context *context,
+ const std::vector<gl::VertexAttribCurrentValueData> &currentValues)
+{
+ const auto &activeAttribsMask = mProgramD3D->getState().getActiveAttribLocationsMask();
+ const auto &dirtyActiveAttribs = (activeAttribsMask & mDirtyCurrentValueAttribs);
+
+ if (!dirtyActiveAttribs.any())
+ {
+ return angle::Result::Continue;
+ }
+
+ const auto &vertexAttributes = mVertexArray11->getState().getVertexAttributes();
+ const auto &vertexBindings = mVertexArray11->getState().getVertexBindings();
+ mDirtyCurrentValueAttribs = (mDirtyCurrentValueAttribs & ~dirtyActiveAttribs);
+
+ for (auto attribIndex : dirtyActiveAttribs)
+ {
+ if (vertexAttributes[attribIndex].enabled)
+ continue;
+
+ const auto *attrib = &vertexAttributes[attribIndex];
+ const auto &currentValue = currentValues[attribIndex];
+ TranslatedAttribute *currentValueAttrib = &mCurrentValueAttribs[attribIndex];
+ currentValueAttrib->currentValueType = currentValue.Type;
+ currentValueAttrib->attribute = attrib;
+ currentValueAttrib->binding = &vertexBindings[attrib->bindingIndex];
+
+ mDirtyVertexBufferRange.extend(static_cast<unsigned int>(attribIndex));
+
+ ANGLE_TRY(mVertexDataManager.storeCurrentValue(context, currentValue, currentValueAttrib,
+ static_cast<size_t>(attribIndex)));
+ }
+
+ return angle::Result::Continue;
+}
+
+void StateManager11::setInputLayout(const d3d11::InputLayout *inputLayout)
+{
+ if (setInputLayoutInternal(inputLayout))
+ {
+ invalidateInputLayout();
+ }
+}
+
+bool StateManager11::setInputLayoutInternal(const d3d11::InputLayout *inputLayout)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ if (inputLayout == nullptr)
+ {
+ if (!mCurrentInputLayout.empty())
+ {
+ deviceContext->IASetInputLayout(nullptr);
+ mCurrentInputLayout.clear();
+ return true;
+ }
+ }
+ else if (inputLayout->getSerial() != mCurrentInputLayout)
+ {
+ deviceContext->IASetInputLayout(inputLayout->get());
+ mCurrentInputLayout = inputLayout->getSerial();
+ return true;
+ }
+
+ return false;
+}
+
+bool StateManager11::queueVertexBufferChange(size_t bufferIndex,
+ ID3D11Buffer *buffer,
+ UINT stride,
+ UINT offset)
+{
+ if (buffer != mCurrentVertexBuffers[bufferIndex] ||
+ stride != mCurrentVertexStrides[bufferIndex] ||
+ offset != mCurrentVertexOffsets[bufferIndex])
+ {
+ mDirtyVertexBufferRange.extend(static_cast<unsigned int>(bufferIndex));
+
+ mCurrentVertexBuffers[bufferIndex] = buffer;
+ mCurrentVertexStrides[bufferIndex] = stride;
+ mCurrentVertexOffsets[bufferIndex] = offset;
+ return true;
+ }
+
+ return false;
+}
+
+void StateManager11::applyVertexBufferChanges()
+{
+ if (mDirtyVertexBufferRange.empty())
+ {
+ return;
+ }
+
+ ASSERT(mDirtyVertexBufferRange.high() <= gl::MAX_VERTEX_ATTRIBS);
+
+ UINT start = static_cast<UINT>(mDirtyVertexBufferRange.low());
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->IASetVertexBuffers(start, static_cast<UINT>(mDirtyVertexBufferRange.length()),
+ &mCurrentVertexBuffers[start], &mCurrentVertexStrides[start],
+ &mCurrentVertexOffsets[start]);
+
+ mDirtyVertexBufferRange = gl::RangeUI(gl::MAX_VERTEX_ATTRIBS, 0);
+}
+
+void StateManager11::setSingleVertexBuffer(const d3d11::Buffer *buffer, UINT stride, UINT offset)
+{
+ ID3D11Buffer *native = buffer ? buffer->get() : nullptr;
+ if (queueVertexBufferChange(0, native, stride, offset))
+ {
+ invalidateInputLayout();
+ applyVertexBufferChanges();
+ }
+}
+
+angle::Result StateManager11::updateState(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLsizei instanceCount,
+ GLint baseVertex)
+{
+ const gl::State &glState = context->getState();
+
+ // TODO(jmadill): Use dirty bits.
+ if (mRenderTargetIsDirty)
+ {
+ processFramebufferInvalidation(context);
+ mRenderTargetIsDirty = false;
+ }
+
+ // TODO(jmadill): Use dirty bits.
+ if (mProgramD3D->updateSamplerMapping() == ProgramD3D::SamplerMapping::WasDirty)
+ {
+ invalidateTexturesAndSamplers();
+ }
+
+ // TODO(jmadill): Use dirty bits.
+ if (mProgramD3D->anyShaderUniformsDirty())
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_UNIFORMS);
+ }
+
+ // Swizzling can cause internal state changes with blit shaders.
+ if (mDirtySwizzles)
+ {
+ ANGLE_TRY(generateSwizzles(context));
+ mDirtySwizzles = false;
+ }
+
+ ANGLE_TRY(mFramebuffer11->markAttachmentsDirty(context));
+
+ // TODO(jiawei.shao@intel.com): This can be recomputed only on framebuffer or multisample mask
+ // state changes.
+ RenderTarget11 *firstRT = mFramebuffer11->getFirstRenderTarget();
+ int samples = (firstRT ? firstRT->getSamples() : 0);
+ unsigned int sampleMask = GetBlendSampleMask(glState, samples);
+ if (sampleMask != mCurSampleMask)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+ }
+
+ ANGLE_TRY(mVertexArray11->syncStateForDraw(context, firstVertex, vertexOrIndexCount,
+ indexTypeOrInvalid, indices, instanceCount,
+ baseVertex));
+
+ // Changes in the draw call can affect the vertex buffer translations.
+ if (!mLastFirstVertex.valid() || mLastFirstVertex.value() != firstVertex)
+ {
+ mLastFirstVertex = firstVertex;
+ invalidateInputLayout();
+ }
+
+ // The ShaderConstants only need to be updated when the program uses vertexID
+ if (mProgramD3D->usesVertexID())
+ {
+ if (mShaderConstants.onFirstVertexChange(firstVertex))
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_DRIVER_UNIFORMS);
+ }
+ }
+
+ if (indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum)
+ {
+ ANGLE_TRY(applyIndexBuffer(context, vertexOrIndexCount, indexTypeOrInvalid, indices));
+ }
+
+ if (mLastAppliedDrawMode != mode)
+ {
+ mLastAppliedDrawMode = mode;
+ mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
+
+ bool pointDrawMode = (mode == gl::PrimitiveMode::Points);
+ if (pointDrawMode != mCurRasterState.pointDrawMode)
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+
+ // Changing from points to not points (or vice-versa) affects the geometry shader.
+ invalidateShaders();
+ }
+ }
+
+ auto dirtyBitsCopy = mInternalDirtyBits & mGraphicsDirtyBitsMask;
+ mInternalDirtyBits &= ~mGraphicsDirtyBitsMask;
+
+ for (auto iter = dirtyBitsCopy.begin(), end = dirtyBitsCopy.end(); iter != end; ++iter)
+ {
+ switch (*iter)
+ {
+ case DIRTY_BIT_RENDER_TARGET:
+ ANGLE_TRY(syncFramebuffer(context));
+ break;
+ case DIRTY_BIT_VIEWPORT_STATE:
+ syncViewport(context);
+ break;
+ case DIRTY_BIT_SCISSOR_STATE:
+ syncScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
+ break;
+ case DIRTY_BIT_RASTERIZER_STATE:
+ ANGLE_TRY(syncRasterizerState(context, mode));
+ break;
+ case DIRTY_BIT_BLEND_STATE:
+ ANGLE_TRY(syncBlendState(context, glState.getBlendState(), glState.getBlendColor(),
+ sampleMask));
+ break;
+ case DIRTY_BIT_DEPTH_STENCIL_STATE:
+ ANGLE_TRY(syncDepthStencilState(context));
+ break;
+ case DIRTY_BIT_GRAPHICS_SRVUAV_STATE:
+ iter.resetLaterBit(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
+ ANGLE_TRY(syncTextures(context));
+ break;
+ case DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE:
+ // TODO(jmadill): More fine-grained update.
+ ANGLE_TRY(syncTextures(context));
+ break;
+ case DIRTY_BIT_PROGRAM_UNIFORMS:
+ ANGLE_TRY(applyUniforms(context));
+ break;
+ case DIRTY_BIT_DRIVER_UNIFORMS:
+ // This must happen after viewport sync; the viewport affects builtin uniforms.
+ ANGLE_TRY(applyDriverUniforms(context));
+ break;
+ case DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS:
+ ANGLE_TRY(syncUniformBuffers(context));
+ break;
+ case DIRTY_BIT_PROGRAM_ATOMIC_COUNTER_BUFFERS:
+ // TODO(jie.a.chen@intel.com): http://anglebug.com/1729
+ break;
+ case DIRTY_BIT_PROGRAM_SHADER_STORAGE_BUFFERS:
+ // TODO(jie.a.chen@intel.com): http://anglebug.com/1951
+ break;
+ case DIRTY_BIT_SHADERS:
+ ANGLE_TRY(syncProgram(context, mode));
+ break;
+ case DIRTY_BIT_CURRENT_VALUE_ATTRIBS:
+ ANGLE_TRY(syncCurrentValueAttribs(context, glState.getVertexAttribCurrentValues()));
+ break;
+ case DIRTY_BIT_TRANSFORM_FEEDBACK:
+ ANGLE_TRY(syncTransformFeedbackBuffers(context));
+ break;
+ case DIRTY_BIT_VERTEX_BUFFERS_AND_INPUT_LAYOUT:
+ ANGLE_TRY(syncVertexBuffersAndInputLayout(context, mode, firstVertex,
+ vertexOrIndexCount, indexTypeOrInvalid,
+ instanceCount));
+ break;
+ case DIRTY_BIT_PRIMITIVE_TOPOLOGY:
+ syncPrimitiveTopology(glState, mode);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+
+ // Check that we haven't set any dirty bits in the flushing of the dirty bits loop, except
+ // DIRTY_BIT_COMPUTE_SRVUAV_STATE dirty bit.
+ ASSERT((mInternalDirtyBits & mGraphicsDirtyBitsMask).none());
+
+ return angle::Result::Continue;
+}
+
+void StateManager11::setShaderResourceShared(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const d3d11::SharedSRV *srv)
+{
+ setShaderResourceInternal(shaderType, resourceSlot, srv);
+
+ // TODO(jmadill): Narrower dirty region.
+ mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
+}
+
+void StateManager11::setShaderResource(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const d3d11::ShaderResourceView *srv)
+{
+ setShaderResourceInternal(shaderType, resourceSlot, srv);
+
+ // TODO(jmadill): Narrower dirty region.
+ mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
+}
+
+void StateManager11::setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology)
+{
+ if (setPrimitiveTopologyInternal(primitiveTopology))
+ {
+ mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
+ }
+}
+
+bool StateManager11::setPrimitiveTopologyInternal(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology)
+{
+ if (primitiveTopology != mCurrentPrimitiveTopology)
+ {
+ mRenderer->getDeviceContext()->IASetPrimitiveTopology(primitiveTopology);
+ mCurrentPrimitiveTopology = primitiveTopology;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void StateManager11::setDrawShaders(const d3d11::VertexShader *vertexShader,
+ const d3d11::GeometryShader *geometryShader,
+ const d3d11::PixelShader *pixelShader)
+{
+ setVertexShader(vertexShader);
+ setGeometryShader(geometryShader);
+ setPixelShader(pixelShader);
+}
+
+void StateManager11::setVertexShader(const d3d11::VertexShader *shader)
+{
+ ResourceSerial serial = shader ? shader->getSerial() : ResourceSerial(0);
+
+ if (serial != mAppliedShaders[gl::ShaderType::Vertex])
+ {
+ ID3D11VertexShader *appliedShader = shader ? shader->get() : nullptr;
+ mRenderer->getDeviceContext()->VSSetShader(appliedShader, nullptr, 0);
+ mAppliedShaders[gl::ShaderType::Vertex] = serial;
+ invalidateShaders();
+ }
+}
+
+void StateManager11::setGeometryShader(const d3d11::GeometryShader *shader)
+{
+ ResourceSerial serial = shader ? shader->getSerial() : ResourceSerial(0);
+
+ if (serial != mAppliedShaders[gl::ShaderType::Geometry])
+ {
+ ID3D11GeometryShader *appliedShader = shader ? shader->get() : nullptr;
+ mRenderer->getDeviceContext()->GSSetShader(appliedShader, nullptr, 0);
+ mAppliedShaders[gl::ShaderType::Geometry] = serial;
+ invalidateShaders();
+ }
+}
+
+void StateManager11::setPixelShader(const d3d11::PixelShader *shader)
+{
+ ResourceSerial serial = shader ? shader->getSerial() : ResourceSerial(0);
+
+ if (serial != mAppliedShaders[gl::ShaderType::Fragment])
+ {
+ ID3D11PixelShader *appliedShader = shader ? shader->get() : nullptr;
+ mRenderer->getDeviceContext()->PSSetShader(appliedShader, nullptr, 0);
+ mAppliedShaders[gl::ShaderType::Fragment] = serial;
+ invalidateShaders();
+ }
+}
+
+void StateManager11::setComputeShader(const d3d11::ComputeShader *shader)
+{
+ ResourceSerial serial = shader ? shader->getSerial() : ResourceSerial(0);
+
+ if (serial != mAppliedShaders[gl::ShaderType::Compute])
+ {
+ ID3D11ComputeShader *appliedShader = shader ? shader->get() : nullptr;
+ mRenderer->getDeviceContext()->CSSetShader(appliedShader, nullptr, 0);
+ mAppliedShaders[gl::ShaderType::Compute] = serial;
+ invalidateShaders();
+ }
+}
+
+void StateManager11::setVertexConstantBuffer(unsigned int slot, const d3d11::Buffer *buffer)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ auto &currentSerial = mCurrentConstantBufferVS[slot];
+
+ mCurrentConstantBufferVSOffset[slot] = 0;
+ mCurrentConstantBufferVSSize[slot] = 0;
+
+ if (buffer)
+ {
+ if (currentSerial != buffer->getSerial())
+ {
+ deviceContext->VSSetConstantBuffers(slot, 1, buffer->getPointer());
+ currentSerial = buffer->getSerial();
+ invalidateConstantBuffer(slot);
+ }
+ }
+ else
+ {
+ if (!currentSerial.empty())
+ {
+ ID3D11Buffer *nullBuffer = nullptr;
+ deviceContext->VSSetConstantBuffers(slot, 1, &nullBuffer);
+ currentSerial.clear();
+ invalidateConstantBuffer(slot);
+ }
+ }
+}
+
+void StateManager11::setPixelConstantBuffer(unsigned int slot, const d3d11::Buffer *buffer)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ auto &currentSerial = mCurrentConstantBufferPS[slot];
+
+ mCurrentConstantBufferPSOffset[slot] = 0;
+ mCurrentConstantBufferPSSize[slot] = 0;
+
+ if (buffer)
+ {
+ if (currentSerial != buffer->getSerial())
+ {
+ deviceContext->PSSetConstantBuffers(slot, 1, buffer->getPointer());
+ currentSerial = buffer->getSerial();
+ invalidateConstantBuffer(slot);
+ }
+ }
+ else
+ {
+ if (!currentSerial.empty())
+ {
+ ID3D11Buffer *nullBuffer = nullptr;
+ deviceContext->PSSetConstantBuffers(slot, 1, &nullBuffer);
+ currentSerial.clear();
+ invalidateConstantBuffer(slot);
+ }
+ }
+}
+
+void StateManager11::setDepthStencilState(const d3d11::DepthStencilState *depthStencilState,
+ UINT stencilRef)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ if (depthStencilState)
+ {
+ deviceContext->OMSetDepthStencilState(depthStencilState->get(), stencilRef);
+ }
+ else
+ {
+ deviceContext->OMSetDepthStencilState(nullptr, stencilRef);
+ }
+
+ mInternalDirtyBits.set(DIRTY_BIT_DEPTH_STENCIL_STATE);
+}
+
+void StateManager11::setSimpleBlendState(const d3d11::BlendState *blendState)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ if (blendState)
+ {
+ deviceContext->OMSetBlendState(blendState->get(), nullptr, 0xFFFFFFFF);
+ }
+ else
+ {
+ deviceContext->OMSetBlendState(nullptr, nullptr, 0xFFFFFFFF);
+ }
+
+ mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE);
+}
+
+void StateManager11::setRasterizerState(const d3d11::RasterizerState *rasterizerState)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ if (rasterizerState)
+ {
+ deviceContext->RSSetState(rasterizerState->get());
+ }
+ else
+ {
+ deviceContext->RSSetState(nullptr);
+ }
+
+ mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
+}
+
+void StateManager11::setSimpleViewport(const gl::Extents &extents)
+{
+ setSimpleViewport(extents.width, extents.height);
+}
+
+void StateManager11::setSimpleViewport(int width, int height)
+{
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+ viewport.Width = static_cast<FLOAT>(width);
+ viewport.Height = static_cast<FLOAT>(height);
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+
+ mRenderer->getDeviceContext()->RSSetViewports(1, &viewport);
+ mInternalDirtyBits.set(DIRTY_BIT_VIEWPORT_STATE);
+}
+
+void StateManager11::setSimplePixelTextureAndSampler(const d3d11::SharedSRV &srv,
+ const d3d11::SamplerState &samplerState)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ setShaderResourceInternal(gl::ShaderType::Fragment, 0, &srv);
+ deviceContext->PSSetSamplers(0, 1, samplerState.getPointer());
+
+ mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
+ mForceSetShaderSamplerStates[gl::ShaderType::Fragment][0] = true;
+}
+
+void StateManager11::setSimpleScissorRect(const gl::Rectangle &glRect)
+{
+ D3D11_RECT scissorRect;
+ scissorRect.left = glRect.x;
+ scissorRect.right = glRect.x + glRect.width;
+ scissorRect.top = glRect.y;
+ scissorRect.bottom = glRect.y + glRect.height;
+ setScissorRectD3D(scissorRect);
+}
+
+void StateManager11::setScissorRectD3D(const D3D11_RECT &d3dRect)
+{
+ mRenderer->getDeviceContext()->RSSetScissorRects(1, &d3dRect);
+ mInternalDirtyBits.set(DIRTY_BIT_SCISSOR_STATE);
+}
+
+angle::Result StateManager11::syncTextures(const gl::Context *context)
+{
+ ANGLE_TRY(applyTexturesForSRVs(context, gl::ShaderType::Vertex));
+ ANGLE_TRY(applyTexturesForSRVs(context, gl::ShaderType::Fragment));
+ if (mProgramD3D->hasShaderStage(gl::ShaderType::Geometry))
+ {
+ ANGLE_TRY(applyTexturesForSRVs(context, gl::ShaderType::Geometry));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::setSamplerState(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture,
+ const gl::SamplerState &samplerState)
+{
+#if !defined(NDEBUG)
+ // Storage should exist, texture should be complete. Only verified in Debug.
+ TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
+ TextureStorage *storage = nullptr;
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &storage));
+ ASSERT(storage);
+#endif // !defined(NDEBUG)
+
+ auto *deviceContext = mRenderer->getDeviceContext();
+
+ ASSERT(static_cast<unsigned int>(index) <
+ mRenderer->getNativeCaps().maxShaderTextureImageUnits[type]);
+
+ if (mForceSetShaderSamplerStates[type][index] ||
+ memcmp(&samplerState, &mCurShaderSamplerStates[type][index], sizeof(gl::SamplerState)) != 0)
+ {
+ ID3D11SamplerState *dxSamplerState = nullptr;
+ ANGLE_TRY(mRenderer->getSamplerState(context, samplerState, &dxSamplerState));
+
+ ASSERT(dxSamplerState != nullptr);
+
+ switch (type)
+ {
+ case gl::ShaderType::Vertex:
+ deviceContext->VSSetSamplers(index, 1, &dxSamplerState);
+ break;
+ case gl::ShaderType::Fragment:
+ deviceContext->PSSetSamplers(index, 1, &dxSamplerState);
+ break;
+ case gl::ShaderType::Compute:
+ deviceContext->CSSetSamplers(index, 1, &dxSamplerState);
+ break;
+ case gl::ShaderType::Geometry:
+ deviceContext->GSSetSamplers(index, 1, &dxSamplerState);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ mCurShaderSamplerStates[type][index] = samplerState;
+ }
+
+ mForceSetShaderSamplerStates[type][index] = false;
+
+ // Sampler metadata that's passed to shaders in uniforms is stored separately from rest of the
+ // sampler state since having it in contiguous memory makes it possible to memcpy to a constant
+ // buffer, and it doesn't affect the state set by
+ // PSSetSamplers/VSSetSamplers/CSSetSamplers/GSSetSamplers.
+ mShaderConstants.onSamplerChange(type, index, *texture, samplerState);
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::setTextureForSampler(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture,
+ const gl::SamplerState &sampler)
+{
+ const d3d11::SharedSRV *textureSRV = nullptr;
+
+ if (texture)
+ {
+ TextureD3D *textureImpl = GetImplAs<TextureD3D>(texture);
+
+ TextureStorage *texStorage = nullptr;
+ ANGLE_TRY(textureImpl->getNativeTexture(context, &texStorage));
+
+ // Texture should be complete and have a storage
+ ASSERT(texStorage);
+
+ TextureStorage11 *storage11 = GetAs<TextureStorage11>(texStorage);
+
+ ANGLE_TRY(
+ storage11->getSRVForSampler(context, texture->getTextureState(), sampler, &textureSRV));
+
+ // If we get an invalid SRV here, something went wrong in the texture class and we're
+ // unexpectedly missing the shader resource view.
+ ASSERT(textureSRV->valid());
+
+ textureImpl->resetDirty();
+ }
+
+ ASSERT((type == gl::ShaderType::Fragment &&
+ static_cast<unsigned int>(index) <
+ mRenderer->getNativeCaps().maxShaderTextureImageUnits[gl::ShaderType::Fragment]) ||
+ (type == gl::ShaderType::Vertex &&
+ static_cast<unsigned int>(index) <
+ mRenderer->getNativeCaps().maxShaderTextureImageUnits[gl::ShaderType::Vertex]) ||
+ (type == gl::ShaderType::Compute &&
+ static_cast<unsigned int>(index) <
+ mRenderer->getNativeCaps().maxShaderTextureImageUnits[gl::ShaderType::Compute]));
+
+ setShaderResourceInternal(type, index, textureSRV);
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::setImageState(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ const gl::ImageUnit &imageUnit)
+{
+ ASSERT(static_cast<unsigned int>(index) <
+ mRenderer->getNativeCaps().maxShaderImageUniforms[type]);
+
+ mShaderConstants.onImageChange(type, index, imageUnit);
+
+ return angle::Result::Continue;
+}
+
+// For each Direct3D sampler of either the pixel or vertex stage,
+// looks up the corresponding OpenGL texture image unit and texture type,
+// and sets the texture and its addressing/filtering state (or NULL when inactive).
+// Sampler mapping needs to be up-to-date on the program object before this is called.
+angle::Result StateManager11::applyTexturesForSRVs(const gl::Context *context,
+ gl::ShaderType shaderType)
+{
+ const auto &glState = context->getState();
+ const auto &caps = context->getCaps();
+
+ ASSERT(!mProgramD3D->isSamplerMappingDirty());
+
+ // TODO(jmadill): Use the Program's sampler bindings.
+ const gl::ActiveTexturePointerArray &completeTextures = glState.getActiveTexturesCache();
+
+ const gl::RangeUI samplerRange = mProgramD3D->getUsedSamplerRange(shaderType);
+ for (unsigned int samplerIndex = samplerRange.low(); samplerIndex < samplerRange.high();
+ samplerIndex++)
+ {
+ GLint textureUnit = mProgramD3D->getSamplerMapping(shaderType, samplerIndex, caps);
+ ASSERT(textureUnit != -1);
+ gl::Texture *texture = completeTextures[textureUnit];
+
+ // A nullptr texture indicates incomplete.
+ if (texture)
+ {
+ gl::Sampler *samplerObject = glState.getSampler(textureUnit);
+
+ const gl::SamplerState &samplerState =
+ samplerObject ? samplerObject->getSamplerState() : texture->getSamplerState();
+
+ ANGLE_TRY(setSamplerState(context, shaderType, samplerIndex, texture, samplerState));
+ ANGLE_TRY(
+ setTextureForSampler(context, shaderType, samplerIndex, texture, samplerState));
+ }
+ else
+ {
+ gl::TextureType textureType =
+ mProgramD3D->getSamplerTextureType(shaderType, samplerIndex);
+
+ // Texture is not sampler complete or it is in use by the framebuffer. Bind the
+ // incomplete texture.
+ gl::Texture *incompleteTexture = nullptr;
+ ANGLE_TRY(mRenderer->getIncompleteTexture(context, textureType, &incompleteTexture));
+ ANGLE_TRY(setSamplerState(context, shaderType, samplerIndex, incompleteTexture,
+ incompleteTexture->getSamplerState()));
+ ANGLE_TRY(setTextureForSampler(context, shaderType, samplerIndex, incompleteTexture,
+ incompleteTexture->getSamplerState()));
+ }
+ }
+
+ const gl::RangeUI readonlyImageRange = mProgramD3D->getUsedImageRange(shaderType, true);
+ for (unsigned int readonlyImageIndex = readonlyImageRange.low();
+ readonlyImageIndex < readonlyImageRange.high(); readonlyImageIndex++)
+ {
+ GLint imageUnitIndex =
+ mProgramD3D->getImageMapping(shaderType, readonlyImageIndex, true, caps);
+ ASSERT(imageUnitIndex != -1);
+ const gl::ImageUnit &imageUnit = glState.getImageUnit(imageUnitIndex);
+ if (!imageUnit.layered)
+ {
+ ANGLE_TRY(setImageState(context, gl::ShaderType::Compute,
+ readonlyImageIndex - readonlyImageRange.low(), imageUnit));
+ invalidateProgramUniforms();
+ }
+ ANGLE_TRY(setTextureForImage(context, shaderType, readonlyImageIndex, true, imageUnit));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyTexturesForUAVs(const gl::Context *context,
+ gl::ShaderType shaderType)
+{
+ ASSERT(shaderType == gl::ShaderType::Compute);
+ const auto &glState = context->getState();
+ const auto &caps = context->getCaps();
+
+ const gl::RangeUI imageRange = mProgramD3D->getUsedImageRange(shaderType, false);
+ for (unsigned int imageIndex = imageRange.low(); imageIndex < imageRange.high(); imageIndex++)
+ {
+ GLint imageUnitIndex = mProgramD3D->getImageMapping(shaderType, imageIndex, false, caps);
+ ASSERT(imageUnitIndex != -1);
+ const gl::ImageUnit &imageUnit = glState.getImageUnit(imageUnitIndex);
+ if (!imageUnit.layered)
+ {
+ ANGLE_TRY(setImageState(context, gl::ShaderType::Compute, imageIndex - imageRange.low(),
+ imageUnit));
+ invalidateProgramUniforms();
+ }
+ ANGLE_TRY(setTextureForImage(context, shaderType, imageIndex, false, imageUnit));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncTexturesForCompute(const gl::Context *context)
+{
+ ANGLE_TRY(applyTexturesForUAVs(context, gl::ShaderType::Compute));
+ ANGLE_TRY(applyTexturesForSRVs(context, gl::ShaderType::Compute));
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::setTextureForImage(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ bool readonly,
+ const gl::ImageUnit &imageUnit)
+{
+ TextureD3D *textureImpl = nullptr;
+ if (!imageUnit.texture.get())
+ {
+ // The texture is used in shader. However, there is no resource binding to it. We
+ // should clear the corresponding UAV/SRV in case the previous view type is a buffer not a
+ // texture. Otherwise, below error will be reported. The Unordered Access View dimension
+ // declared in the shader code (TEXTURE2D) does not match the view type bound to slot 0
+ // of the Compute Shader unit (BUFFER).
+ if (readonly)
+ {
+ setShaderResourceInternal<d3d11::ShaderResourceView>(type, static_cast<UINT>(index),
+ nullptr);
+ }
+ else
+ {
+ setUnorderedAccessViewInternal<d3d11::UnorderedAccessView>(
+ type, static_cast<UINT>(index), nullptr);
+ }
+ return angle::Result::Continue;
+ }
+
+ textureImpl = GetImplAs<TextureD3D>(imageUnit.texture.get());
+ TextureStorage *texStorage = nullptr;
+ ANGLE_TRY(textureImpl->getNativeTexture(context, &texStorage));
+ // Texture should be complete and have a storage
+ ASSERT(texStorage);
+ TextureStorage11 *storage11 = GetAs<TextureStorage11>(texStorage);
+
+ if (readonly)
+ {
+ const d3d11::SharedSRV *textureSRV = nullptr;
+ ANGLE_TRY(storage11->getSRVForImage(context, imageUnit, &textureSRV));
+ // If we get an invalid SRV here, something went wrong in the texture class and we're
+ // unexpectedly missing the shader resource view.
+ ASSERT(textureSRV->valid());
+ ASSERT((static_cast<unsigned int>(index) < mRenderer->getNativeCaps().maxImageUnits));
+ setShaderResourceInternal(type, index, textureSRV);
+ }
+ else
+ {
+ const d3d11::SharedUAV *textureUAV = nullptr;
+ ANGLE_TRY(storage11->getUAVForImage(context, imageUnit, &textureUAV));
+ // If we get an invalid UAV here, something went wrong in the texture class and we're
+ // unexpectedly missing the unordered access view.
+ ASSERT(textureUAV->valid());
+ ASSERT((static_cast<unsigned int>(index) < mRenderer->getNativeCaps().maxImageUnits));
+ setUnorderedAccessViewInternal(type, index, textureUAV);
+ }
+
+ textureImpl->resetDirty();
+ return angle::Result::Continue;
+}
+
+// Things that affect a program's dirtyness:
+// 1. Directly changing the program executable -> triggered in StateManager11::syncState.
+// 2. The vertex attribute layout -> triggered in VertexArray11::syncState/signal.
+// 3. The fragment shader's rendertargets -> triggered in Framebuffer11::syncState/signal.
+// 4. Enabling/disabling rasterizer discard. -> triggered in StateManager11::syncState.
+// 5. Enabling/disabling transform feedback. -> checked in StateManager11::updateState.
+// 6. An internal shader was used. -> triggered in StateManager11::set*Shader.
+// 7. Drawing with/without point sprites. -> checked in StateManager11::updateState.
+// TODO(jmadill): Use dirty bits for transform feedback.
+angle::Result StateManager11::syncProgram(const gl::Context *context, gl::PrimitiveMode drawMode)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_TRY(context11->triggerDrawCallProgramRecompilation(context, drawMode));
+
+ const auto &glState = context->getState();
+
+ mProgramD3D->updateCachedInputLayout(mVertexArray11->getCurrentStateSerial(), glState);
+
+ // Binaries must be compiled before the sync.
+ ASSERT(mProgramD3D->hasVertexExecutableForCachedInputLayout());
+ ASSERT(mProgramD3D->hasGeometryExecutableForPrimitiveType(glState, drawMode));
+ ASSERT(mProgramD3D->hasPixelExecutableForCachedOutputLayout());
+
+ ShaderExecutableD3D *vertexExe = nullptr;
+ ANGLE_TRY(mProgramD3D->getVertexExecutableForCachedInputLayout(context11, &vertexExe, nullptr));
+
+ ShaderExecutableD3D *pixelExe = nullptr;
+ ANGLE_TRY(mProgramD3D->getPixelExecutableForCachedOutputLayout(context11, &pixelExe, nullptr));
+
+ ShaderExecutableD3D *geometryExe = nullptr;
+ ANGLE_TRY(mProgramD3D->getGeometryExecutableForPrimitiveType(context11, glState, drawMode,
+ &geometryExe, nullptr));
+
+ const d3d11::VertexShader *vertexShader =
+ (vertexExe ? &GetAs<ShaderExecutable11>(vertexExe)->getVertexShader() : nullptr);
+
+ // Skip pixel shader if we're doing rasterizer discard.
+ const d3d11::PixelShader *pixelShader = nullptr;
+ if (!glState.getRasterizerState().rasterizerDiscard)
+ {
+ pixelShader = (pixelExe ? &GetAs<ShaderExecutable11>(pixelExe)->getPixelShader() : nullptr);
+ }
+
+ const d3d11::GeometryShader *geometryShader = nullptr;
+ if (glState.isTransformFeedbackActiveUnpaused())
+ {
+ geometryShader =
+ (vertexExe ? &GetAs<ShaderExecutable11>(vertexExe)->getStreamOutShader() : nullptr);
+ }
+ else
+ {
+ geometryShader =
+ (geometryExe ? &GetAs<ShaderExecutable11>(geometryExe)->getGeometryShader() : nullptr);
+ }
+
+ setDrawShaders(vertexShader, geometryShader, pixelShader);
+
+ // Explicitly clear the shaders dirty bit.
+ mInternalDirtyBits.reset(DIRTY_BIT_SHADERS);
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncProgramForCompute(const gl::Context *context)
+{
+ Context11 *context11 = GetImplAs<Context11>(context);
+ ANGLE_TRY(context11->triggerDispatchCallProgramRecompilation(context));
+
+ mProgramD3D->updateCachedComputeImage2DBindLayout(context);
+
+ // Binaries must be compiled before the sync.
+ ASSERT(mProgramD3D->hasComputeExecutableForCachedImage2DBindLayout());
+
+ ShaderExecutableD3D *computeExe = nullptr;
+ ANGLE_TRY(
+ mProgramD3D->getComputeExecutableForImage2DBindLayout(context11, &computeExe, nullptr));
+
+ const d3d11::ComputeShader *computeShader =
+ (computeExe ? &GetAs<ShaderExecutable11>(computeExe)->getComputeShader() : nullptr);
+ setComputeShader(computeShader);
+ // Explicitly clear the shaders dirty bit.
+ mInternalDirtyBits.reset(DIRTY_BIT_SHADERS);
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncVertexBuffersAndInputLayout(
+ const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ GLsizei instanceCount)
+{
+ const auto &vertexArrayAttribs = mVertexArray11->getTranslatedAttribs();
+
+ // Sort the attributes according to ensure we re-use similar input layouts.
+ AttribIndexArray sortedSemanticIndices;
+ SortAttributesByLayout(*mProgramD3D, vertexArrayAttribs, mCurrentValueAttribs,
+ &sortedSemanticIndices, &mCurrentAttributes);
+
+ D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel;
+
+ // If we are using FL 9_3, make sure the first attribute is not instanced
+ if (featureLevel <= D3D_FEATURE_LEVEL_9_3 && !mCurrentAttributes.empty())
+ {
+ if (mCurrentAttributes[0]->divisor > 0)
+ {
+ Optional<size_t> firstNonInstancedIndex = FindFirstNonInstanced(mCurrentAttributes);
+ if (firstNonInstancedIndex.valid())
+ {
+ size_t index = firstNonInstancedIndex.value();
+ std::swap(mCurrentAttributes[0], mCurrentAttributes[index]);
+ std::swap(sortedSemanticIndices[0], sortedSemanticIndices[index]);
+ }
+ }
+ }
+
+ // Update the applied input layout by querying the cache.
+ const gl::State &state = context->getState();
+ const d3d11::InputLayout *inputLayout = nullptr;
+ ANGLE_TRY(mInputLayoutCache.getInputLayout(GetImplAs<Context11>(context), state,
+ mCurrentAttributes, sortedSemanticIndices, mode,
+ vertexOrIndexCount, instanceCount, &inputLayout));
+ setInputLayoutInternal(inputLayout);
+
+ // Update the applied vertex buffers.
+ ANGLE_TRY(applyVertexBuffers(context, mode, indexTypeOrInvalid, firstVertex));
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyVertexBuffers(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType indexTypeOrInvalid,
+ GLint firstVertex)
+{
+ bool programUsesInstancedPointSprites =
+ mProgramD3D->usesPointSize() && mProgramD3D->usesInstancedPointSpriteEmulation();
+ bool instancedPointSpritesActive =
+ programUsesInstancedPointSprites && (mode == gl::PrimitiveMode::Points);
+
+ // Note that if we use instance emulation, we reserve the first buffer slot.
+ size_t reservedBuffers = GetReservedBufferCount(programUsesInstancedPointSprites);
+
+ for (size_t attribIndex = 0; attribIndex < (gl::MAX_VERTEX_ATTRIBS - reservedBuffers);
+ ++attribIndex)
+ {
+ ID3D11Buffer *buffer = nullptr;
+ UINT vertexStride = 0;
+ UINT vertexOffset = 0;
+
+ if (attribIndex < mCurrentAttributes.size())
+ {
+ const TranslatedAttribute &attrib = *mCurrentAttributes[attribIndex];
+ Buffer11 *bufferStorage = attrib.storage ? GetAs<Buffer11>(attrib.storage) : nullptr;
+
+ // If indexed pointsprite emulation is active, then we need to take a less efficent code
+ // path. Emulated indexed pointsprite rendering requires that the vertex buffers match
+ // exactly to the indices passed by the caller. This could expand or shrink the vertex
+ // buffer depending on the number of points indicated by the index list or how many
+ // duplicates are found on the index list.
+ if (bufferStorage == nullptr)
+ {
+ ASSERT(attrib.vertexBuffer.get());
+ buffer = GetAs<VertexBuffer11>(attrib.vertexBuffer.get())->getBuffer().get();
+ }
+ else if (instancedPointSpritesActive &&
+ indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum)
+ {
+ ASSERT(mVertexArray11->isCachedIndexInfoValid());
+ TranslatedIndexData indexInfo = mVertexArray11->getCachedIndexInfo();
+ if (indexInfo.srcIndexData.srcBuffer != nullptr)
+ {
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(indexInfo.srcIndexData.srcBuffer->getData(context, &bufferData));
+ ASSERT(bufferData != nullptr);
+
+ ptrdiff_t offset =
+ reinterpret_cast<ptrdiff_t>(indexInfo.srcIndexData.srcIndices);
+ indexInfo.srcIndexData.srcBuffer = nullptr;
+ indexInfo.srcIndexData.srcIndices = bufferData + offset;
+ }
+
+ ANGLE_TRY(bufferStorage->getEmulatedIndexedBuffer(context, &indexInfo.srcIndexData,
+ attrib, firstVertex, &buffer));
+
+ mVertexArray11->updateCachedIndexInfo(indexInfo);
+ }
+ else
+ {
+ ANGLE_TRY(bufferStorage->getBuffer(
+ context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK, &buffer));
+ }
+
+ vertexStride = attrib.stride;
+ ANGLE_TRY(attrib.computeOffset(context, firstVertex, &vertexOffset));
+ }
+
+ size_t bufferIndex = reservedBuffers + attribIndex;
+
+ queueVertexBufferChange(bufferIndex, buffer, vertexStride, vertexOffset);
+ }
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ // Instanced PointSprite emulation requires two additional ID3D11Buffers. A vertex buffer needs
+ // to be created and added to the list of current buffers, strides and offsets collections.
+ // This buffer contains the vertices for a single PointSprite quad.
+ // An index buffer also needs to be created and applied because rendering instanced data on
+ // D3D11 FL9_3 requires DrawIndexedInstanced() to be used. Shaders that contain gl_PointSize and
+ // used without the GL_POINTS rendering mode require a vertex buffer because some drivers cannot
+ // handle missing vertex data and will TDR the system.
+ if (programUsesInstancedPointSprites)
+ {
+ constexpr UINT kPointSpriteVertexStride = sizeof(float) * 5;
+
+ if (!mPointSpriteVertexBuffer.valid())
+ {
+ static constexpr float kPointSpriteVertices[] = {
+ // Position | TexCoord
+ -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, /* v0 */
+ -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, /* v1 */
+ 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, /* v2 */
+ 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, /* v3 */
+ -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, /* v4 */
+ 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, /* v5 */
+ };
+
+ D3D11_SUBRESOURCE_DATA vertexBufferData = {kPointSpriteVertices, 0, 0};
+ D3D11_BUFFER_DESC vertexBufferDesc;
+ vertexBufferDesc.ByteWidth = sizeof(kPointSpriteVertices);
+ vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ vertexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
+ vertexBufferDesc.CPUAccessFlags = 0;
+ vertexBufferDesc.MiscFlags = 0;
+ vertexBufferDesc.StructureByteStride = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, vertexBufferDesc, &vertexBufferData,
+ &mPointSpriteVertexBuffer));
+ }
+
+ // Set the stride to 0 if GL_POINTS mode is not being used to instruct the driver to avoid
+ // indexing into the vertex buffer.
+ UINT stride = instancedPointSpritesActive ? kPointSpriteVertexStride : 0;
+ queueVertexBufferChange(0, mPointSpriteVertexBuffer.get(), stride, 0);
+
+ if (!mPointSpriteIndexBuffer.valid())
+ {
+ // Create an index buffer and set it for pointsprite rendering
+ static constexpr unsigned short kPointSpriteIndices[] = {
+ 0, 1, 2, 3, 4, 5,
+ };
+
+ D3D11_SUBRESOURCE_DATA indexBufferData = {kPointSpriteIndices, 0, 0};
+ D3D11_BUFFER_DESC indexBufferDesc;
+ indexBufferDesc.ByteWidth = sizeof(kPointSpriteIndices);
+ indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+ indexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
+ indexBufferDesc.CPUAccessFlags = 0;
+ indexBufferDesc.MiscFlags = 0;
+ indexBufferDesc.StructureByteStride = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(context11, indexBufferDesc, &indexBufferData,
+ &mPointSpriteIndexBuffer));
+ }
+
+ if (instancedPointSpritesActive)
+ {
+ // The index buffer is applied here because Instanced PointSprite emulation uses the a
+ // non-indexed rendering path in ANGLE (DrawArrays). This means that applyIndexBuffer()
+ // on the renderer will not be called and setting this buffer here ensures that the
+ // rendering path will contain the correct index buffers.
+ syncIndexBuffer(mPointSpriteIndexBuffer.get(), DXGI_FORMAT_R16_UINT, 0);
+ }
+ }
+
+ applyVertexBufferChanges();
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyIndexBuffer(const gl::Context *context,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices)
+{
+ if (!mIndexBufferIsDirty)
+ {
+ // No streaming or index buffer application necessary.
+ return angle::Result::Continue;
+ }
+
+ gl::DrawElementsType destElementType = mVertexArray11->getCachedDestinationIndexType();
+ gl::Buffer *elementArrayBuffer = mVertexArray11->getState().getElementArrayBuffer();
+
+ TranslatedIndexData indexInfo;
+ ANGLE_TRY(mIndexDataManager.prepareIndexData(context, indexType, destElementType, indexCount,
+ elementArrayBuffer, indices, &indexInfo));
+
+ ID3D11Buffer *buffer = nullptr;
+ DXGI_FORMAT bufferFormat = (indexInfo.indexType == gl::DrawElementsType::UnsignedInt)
+ ? DXGI_FORMAT_R32_UINT
+ : DXGI_FORMAT_R16_UINT;
+
+ if (indexInfo.storage)
+ {
+ Buffer11 *storage = GetAs<Buffer11>(indexInfo.storage);
+ ANGLE_TRY(storage->getBuffer(context, BUFFER_USAGE_INDEX, &buffer));
+ }
+ else
+ {
+ IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(indexInfo.indexBuffer);
+ buffer = indexBuffer->getBuffer().get();
+ }
+
+ // Track dirty indices in the index range cache.
+ indexInfo.srcIndexData.srcIndicesChanged =
+ syncIndexBuffer(buffer, bufferFormat, indexInfo.startOffset);
+
+ mIndexBufferIsDirty = false;
+
+ mVertexArray11->updateCachedIndexInfo(indexInfo);
+ return angle::Result::Continue;
+}
+
+void StateManager11::setIndexBuffer(ID3D11Buffer *buffer,
+ DXGI_FORMAT indexFormat,
+ unsigned int offset)
+{
+ if (syncIndexBuffer(buffer, indexFormat, offset))
+ {
+ invalidateIndexBuffer();
+ }
+}
+
+bool StateManager11::syncIndexBuffer(ID3D11Buffer *buffer,
+ DXGI_FORMAT indexFormat,
+ unsigned int offset)
+{
+ if (buffer != mAppliedIB || indexFormat != mAppliedIBFormat || offset != mAppliedIBOffset)
+ {
+ mRenderer->getDeviceContext()->IASetIndexBuffer(buffer, indexFormat, offset);
+
+ mAppliedIB = buffer;
+ mAppliedIBFormat = indexFormat;
+ mAppliedIBOffset = offset;
+ return true;
+ }
+
+ return false;
+}
+
+// Vertex buffer is invalidated outside this function.
+angle::Result StateManager11::updateVertexOffsetsForPointSpritesEmulation(
+ const gl::Context *context,
+ GLint startVertex,
+ GLsizei emulatedInstanceId)
+{
+ size_t reservedBuffers = GetReservedBufferCount(true);
+ for (size_t attribIndex = 0; attribIndex < mCurrentAttributes.size(); ++attribIndex)
+ {
+ const auto &attrib = *mCurrentAttributes[attribIndex];
+ size_t bufferIndex = reservedBuffers + attribIndex;
+
+ if (attrib.divisor > 0)
+ {
+ unsigned int offset = 0;
+ ANGLE_TRY(attrib.computeOffset(context, startVertex, &offset));
+ offset += (attrib.stride * (emulatedInstanceId / attrib.divisor));
+ if (offset != mCurrentVertexOffsets[bufferIndex])
+ {
+ invalidateInputLayout();
+ mDirtyVertexBufferRange.extend(static_cast<unsigned int>(bufferIndex));
+ mCurrentVertexOffsets[bufferIndex] = offset;
+ }
+ }
+ }
+
+ applyVertexBufferChanges();
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::generateSwizzle(const gl::Context *context, gl::Texture *texture)
+{
+ if (!texture)
+ {
+ return angle::Result::Continue;
+ }
+
+ TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
+ ASSERT(textureD3D);
+
+ TextureStorage *texStorage = nullptr;
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &texStorage));
+
+ if (texStorage)
+ {
+ TextureStorage11 *storage11 = GetAs<TextureStorage11>(texStorage);
+ const gl::TextureState &textureState = texture->getTextureState();
+ ANGLE_TRY(storage11->generateSwizzles(context, textureState.getSwizzleState()));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::generateSwizzlesForShader(const gl::Context *context,
+ gl::ShaderType type)
+{
+ const gl::State &glState = context->getState();
+ const gl::RangeUI samplerRange = mProgramD3D->getUsedSamplerRange(type);
+
+ for (unsigned int i = samplerRange.low(); i < samplerRange.high(); i++)
+ {
+ gl::TextureType textureType = mProgramD3D->getSamplerTextureType(type, i);
+ GLint textureUnit = mProgramD3D->getSamplerMapping(type, i, context->getCaps());
+ if (textureUnit != -1)
+ {
+ gl::Texture *texture = glState.getSamplerTexture(textureUnit, textureType);
+ ASSERT(texture);
+ if (texture->getTextureState().swizzleRequired())
+ {
+ ANGLE_TRY(generateSwizzle(context, texture));
+ }
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::generateSwizzles(const gl::Context *context)
+{
+ ANGLE_TRY(generateSwizzlesForShader(context, gl::ShaderType::Vertex));
+ ANGLE_TRY(generateSwizzlesForShader(context, gl::ShaderType::Fragment));
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyUniformsForShader(const gl::Context *context,
+ gl::ShaderType shaderType)
+{
+ UniformStorage11 *shaderUniformStorage =
+ GetAs<UniformStorage11>(mProgramD3D->getShaderUniformStorage(shaderType));
+ ASSERT(shaderUniformStorage);
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ const d3d11::Buffer *shaderConstantBuffer = nullptr;
+ ANGLE_TRY(shaderUniformStorage->getConstantBuffer(context, mRenderer, &shaderConstantBuffer));
+
+ if (shaderUniformStorage->size() > 0 && mProgramD3D->areShaderUniformsDirty(shaderType))
+ {
+ UpdateUniformBuffer(deviceContext, shaderUniformStorage, shaderConstantBuffer);
+ }
+
+ unsigned int slot = d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DEFAULT_UNIFORM_BLOCK;
+
+ switch (shaderType)
+ {
+ case gl::ShaderType::Vertex:
+ if (mCurrentConstantBufferVS[slot] != shaderConstantBuffer->getSerial())
+ {
+ deviceContext->VSSetConstantBuffers(slot, 1, shaderConstantBuffer->getPointer());
+ mCurrentConstantBufferVS[slot] = shaderConstantBuffer->getSerial();
+ mCurrentConstantBufferVSOffset[slot] = 0;
+ mCurrentConstantBufferVSSize[slot] = 0;
+ }
+ break;
+
+ case gl::ShaderType::Fragment:
+ if (mCurrentConstantBufferPS[slot] != shaderConstantBuffer->getSerial())
+ {
+ deviceContext->PSSetConstantBuffers(slot, 1, shaderConstantBuffer->getPointer());
+ mCurrentConstantBufferPS[slot] = shaderConstantBuffer->getSerial();
+ mCurrentConstantBufferPSOffset[slot] = 0;
+ mCurrentConstantBufferPSSize[slot] = 0;
+ }
+ break;
+
+ // TODO(jiawei.shao@intel.com): apply geometry shader uniforms
+ case gl::ShaderType::Geometry:
+ UNIMPLEMENTED();
+ break;
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyUniforms(const gl::Context *context)
+{
+ ANGLE_TRY(applyUniformsForShader(context, gl::ShaderType::Vertex));
+ ANGLE_TRY(applyUniformsForShader(context, gl::ShaderType::Fragment));
+ if (mProgramD3D->hasShaderStage(gl::ShaderType::Geometry))
+ {
+ ANGLE_TRY(applyUniformsForShader(context, gl::ShaderType::Geometry));
+ }
+
+ mProgramD3D->markUniformsClean();
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyDriverUniformsForShader(const gl::Context *context,
+ gl::ShaderType shaderType)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ d3d11::Buffer &shaderDriverConstantBuffer = mShaderDriverConstantBuffers[shaderType];
+ if (!shaderDriverConstantBuffer.valid())
+ {
+ size_t requiredSize = mShaderConstants.getRequiredBufferSize(shaderType);
+
+ D3D11_BUFFER_DESC constantBufferDescription = {0};
+ d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize);
+ ANGLE_TRY(mRenderer->allocateResource(
+ GetImplAs<Context11>(context), constantBufferDescription, &shaderDriverConstantBuffer));
+
+ ID3D11Buffer *driverConstants = shaderDriverConstantBuffer.get();
+ switch (shaderType)
+ {
+ case gl::ShaderType::Vertex:
+ deviceContext->VSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
+ &driverConstants);
+ break;
+
+ case gl::ShaderType::Fragment:
+ deviceContext->PSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
+ &driverConstants);
+ break;
+
+ case gl::ShaderType::Geometry:
+ deviceContext->GSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
+ &driverConstants);
+ break;
+
+ default:
+ UNREACHABLE();
+ return angle::Result::Continue;
+ }
+ }
+
+ // Sampler metadata and driver constants need to coexist in the same constant buffer to
+ // conserve constant buffer slots. We update both in the constant buffer if needed.
+ ANGLE_TRY(mShaderConstants.updateBuffer(context, mRenderer, shaderType, *mProgramD3D,
+ shaderDriverConstantBuffer));
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyDriverUniforms(const gl::Context *context)
+{
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ ANGLE_TRY(applyDriverUniformsForShader(context, gl::ShaderType::Vertex));
+ ANGLE_TRY(applyDriverUniformsForShader(context, gl::ShaderType::Fragment));
+ if (mProgramD3D->hasShaderStage(gl::ShaderType::Geometry))
+ {
+ ANGLE_TRY(applyDriverUniformsForShader(context, gl::ShaderType::Geometry));
+ }
+
+ // needed for the point sprite geometry shader
+ // GSSetConstantBuffers triggers device removal on 9_3, so we should only call it for ES3.
+ if (mRenderer->isES3Capable())
+ {
+ d3d11::Buffer &driverConstantBufferPS =
+ mShaderDriverConstantBuffers[gl::ShaderType::Fragment];
+ if (mCurrentGeometryConstantBuffer != driverConstantBufferPS.getSerial())
+ {
+ ASSERT(driverConstantBufferPS.valid());
+ deviceContext->GSSetConstantBuffers(0, 1, driverConstantBufferPS.getPointer());
+ mCurrentGeometryConstantBuffer = driverConstantBufferPS.getSerial();
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::applyComputeUniforms(const gl::Context *context,
+ ProgramD3D *programD3D)
+{
+ UniformStorage11 *computeUniformStorage =
+ GetAs<UniformStorage11>(programD3D->getShaderUniformStorage(gl::ShaderType::Compute));
+ ASSERT(computeUniformStorage);
+
+ const d3d11::Buffer *constantBuffer = nullptr;
+ ANGLE_TRY(computeUniformStorage->getConstantBuffer(context, mRenderer, &constantBuffer));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ if (computeUniformStorage->size() > 0 &&
+ programD3D->areShaderUniformsDirty(gl::ShaderType::Compute))
+ {
+ UpdateUniformBuffer(deviceContext, computeUniformStorage, constantBuffer);
+ programD3D->markUniformsClean();
+ }
+
+ if (mCurrentComputeConstantBuffer != constantBuffer->getSerial())
+ {
+ deviceContext->CSSetConstantBuffers(
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DEFAULT_UNIFORM_BLOCK, 1,
+ constantBuffer->getPointer());
+ mCurrentComputeConstantBuffer = constantBuffer->getSerial();
+ }
+
+ if (!mShaderDriverConstantBuffers[gl::ShaderType::Compute].valid())
+ {
+ size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::ShaderType::Compute);
+
+ D3D11_BUFFER_DESC constantBufferDescription = {0};
+ d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize);
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), constantBufferDescription,
+ &mShaderDriverConstantBuffers[gl::ShaderType::Compute]));
+ ID3D11Buffer *buffer = mShaderDriverConstantBuffers[gl::ShaderType::Compute].get();
+ deviceContext->CSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
+ &buffer);
+ }
+
+ ANGLE_TRY(mShaderConstants.updateBuffer(context, mRenderer, gl::ShaderType::Compute,
+ *programD3D,
+ mShaderDriverConstantBuffers[gl::ShaderType::Compute]));
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncUniformBuffersForShader(const gl::Context *context,
+ gl::ShaderType shaderType)
+{
+ gl::ShaderMap<unsigned int> shaderReservedUBOs = mRenderer->getReservedShaderUniformBuffers();
+
+ const auto &glState = context->getState();
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
+
+ const auto &shaderUniformBuffers = mProgramD3D->getShaderUniformBufferCache(shaderType);
+ const unsigned int reservedUBOs = shaderReservedUBOs[shaderType];
+
+ for (size_t bufferIndex = 0; bufferIndex < shaderUniformBuffers.size(); ++bufferIndex)
+ {
+ const GLint binding = shaderUniformBuffers[bufferIndex];
+ if (binding == -1)
+ {
+ continue;
+ }
+
+ const auto &uniformBuffer = glState.getIndexedUniformBuffer(binding);
+ const GLintptr uniformBufferOffset = uniformBuffer.getOffset();
+ const GLsizeiptr uniformBufferSize = uniformBuffer.getSize();
+
+ if (uniformBuffer.get() == nullptr)
+ {
+ continue;
+ }
+
+ Buffer11 *bufferStorage = GetImplAs<Buffer11>(uniformBuffer.get());
+ const d3d11::Buffer *constantBuffer = nullptr;
+ UINT firstConstant = 0;
+ UINT numConstants = 0;
+
+ ANGLE_TRY(bufferStorage->getConstantBufferRange(context, uniformBufferOffset,
+ uniformBufferSize, &constantBuffer,
+ &firstConstant, &numConstants));
+ ASSERT(constantBuffer);
+
+ const unsigned int appliedIndex = reservedUBOs + static_cast<unsigned int>(bufferIndex);
+ switch (shaderType)
+ {
+ case gl::ShaderType::Vertex:
+ {
+ if (mCurrentConstantBufferVS[bufferIndex] == constantBuffer->getSerial() &&
+ mCurrentConstantBufferVSOffset[bufferIndex] == uniformBufferOffset &&
+ mCurrentConstantBufferVSSize[bufferIndex] == uniformBufferSize)
+ {
+ continue;
+ }
+
+ if (firstConstant != 0 && uniformBufferSize != 0)
+ {
+ ASSERT(numConstants != 0);
+ deviceContext1->VSSetConstantBuffers1(appliedIndex, 1,
+ constantBuffer->getPointer(),
+ &firstConstant, &numConstants);
+ }
+ else
+ {
+ deviceContext->VSSetConstantBuffers(appliedIndex, 1,
+ constantBuffer->getPointer());
+ }
+
+ mCurrentConstantBufferVS[appliedIndex] = constantBuffer->getSerial();
+ mCurrentConstantBufferVSOffset[appliedIndex] = uniformBufferOffset;
+ mCurrentConstantBufferVSSize[appliedIndex] = uniformBufferSize;
+ break;
+ }
+
+ case gl::ShaderType::Fragment:
+ {
+ if (mCurrentConstantBufferPS[bufferIndex] == constantBuffer->getSerial() &&
+ mCurrentConstantBufferPSOffset[bufferIndex] == uniformBufferOffset &&
+ mCurrentConstantBufferPSSize[bufferIndex] == uniformBufferSize)
+ {
+ continue;
+ }
+
+ if (firstConstant != 0 && uniformBufferSize != 0)
+ {
+ deviceContext1->PSSetConstantBuffers1(appliedIndex, 1,
+ constantBuffer->getPointer(),
+ &firstConstant, &numConstants);
+ }
+ else
+ {
+ deviceContext->PSSetConstantBuffers(appliedIndex, 1,
+ constantBuffer->getPointer());
+ }
+
+ mCurrentConstantBufferPS[appliedIndex] = constantBuffer->getSerial();
+ mCurrentConstantBufferPSOffset[appliedIndex] = uniformBufferOffset;
+ mCurrentConstantBufferPSSize[appliedIndex] = uniformBufferSize;
+ break;
+ }
+
+ case gl::ShaderType::Compute:
+ {
+ if (mCurrentConstantBufferCS[bufferIndex] == constantBuffer->getSerial() &&
+ mCurrentConstantBufferCSOffset[bufferIndex] == uniformBufferOffset &&
+ mCurrentConstantBufferCSSize[bufferIndex] == uniformBufferSize)
+ {
+ continue;
+ }
+
+ if (firstConstant != 0 && uniformBufferSize != 0)
+ {
+ deviceContext1->CSSetConstantBuffers1(appliedIndex, 1,
+ constantBuffer->getPointer(),
+ &firstConstant, &numConstants);
+ }
+ else
+ {
+ deviceContext->CSSetConstantBuffers(appliedIndex, 1,
+ constantBuffer->getPointer());
+ }
+
+ mCurrentConstantBufferCS[appliedIndex] = constantBuffer->getSerial();
+ mCurrentConstantBufferCSOffset[appliedIndex] = uniformBufferOffset;
+ mCurrentConstantBufferCSSize[appliedIndex] = uniformBufferSize;
+ break;
+ }
+
+ // TODO(jiawei.shao@intel.com): update geometry shader uniform buffers.
+ case gl::ShaderType::Geometry:
+ UNIMPLEMENTED();
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncShaderStorageBuffersForShader(const gl::Context *context,
+ gl::ShaderType shaderType)
+{
+ const gl::State &glState = context->getState();
+ const gl::Program *program = glState.getProgram();
+ angle::FixedVector<Buffer11 *, gl::IMPLEMENTATION_MAX_SHADER_STORAGE_BUFFER_BINDINGS>
+ previouslyBound;
+ for (size_t blockIndex = 0; blockIndex < program->getActiveShaderStorageBlockCount();
+ blockIndex++)
+ {
+ GLuint binding = program->getShaderStorageBlockBinding(static_cast<GLuint>(blockIndex));
+ const unsigned int registerIndex = mProgramD3D->getShaderStorageBufferRegisterIndex(
+ static_cast<GLuint>(blockIndex), shaderType);
+ // It means this block is active but not statically used.
+ if (registerIndex == GL_INVALID_INDEX)
+ {
+ continue;
+ }
+ const auto &shaderStorageBuffer = glState.getIndexedShaderStorageBuffer(binding);
+ if (shaderStorageBuffer.get() == nullptr)
+ {
+ // We didn't see a driver error like atomic buffer did. But theoretically, the same
+ // thing should be done.
+ setUnorderedAccessViewInternal<d3d11::UnorderedAccessView>(shaderType, registerIndex,
+ nullptr);
+ continue;
+ }
+
+ Buffer11 *bufferStorage = GetImplAs<Buffer11>(shaderStorageBuffer.get());
+ if (std::find(previouslyBound.begin(), previouslyBound.end(), bufferStorage) !=
+ previouslyBound.end())
+ {
+ // D3D11 doesn't support binding a buffer multiple times
+ // http://anglebug.com/3032
+ ERR() << "Writing to multiple blocks on the same buffer is not allowed.";
+ return angle::Result::Stop;
+ }
+ previouslyBound.push_back(bufferStorage);
+
+ d3d11::UnorderedAccessView *uavPtr = nullptr;
+ GLsizeiptr viewSize = 0;
+ // Bindings only have a valid size if bound using glBindBufferRange
+ if (shaderStorageBuffer.getSize() > 0)
+ {
+ viewSize = shaderStorageBuffer.getSize();
+ }
+ // We use the buffer size for glBindBufferBase
+ else
+ {
+ viewSize = bufferStorage->getSize();
+ }
+ ANGLE_TRY(bufferStorage->getRawUAVRange(context, shaderStorageBuffer.getOffset(), viewSize,
+ &uavPtr));
+
+ switch (shaderType)
+ {
+ case gl::ShaderType::Compute:
+ {
+ setUnorderedAccessViewInternal(shaderType, registerIndex, uavPtr);
+ break;
+ }
+
+ case gl::ShaderType::Vertex:
+ case gl::ShaderType::Fragment:
+ case gl::ShaderType::Geometry:
+ UNIMPLEMENTED();
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncUniformBuffers(const gl::Context *context)
+{
+ gl::ShaderMap<unsigned int> shaderReservedUBOs = mRenderer->getReservedShaderUniformBuffers();
+ mProgramD3D->updateUniformBufferCache(context->getCaps(), shaderReservedUBOs);
+
+ if (mProgramD3D->hasShaderStage(gl::ShaderType::Compute))
+ {
+ ANGLE_TRY(syncUniformBuffersForShader(context, gl::ShaderType::Compute));
+ }
+ else
+ {
+ ANGLE_TRY(syncUniformBuffersForShader(context, gl::ShaderType::Vertex));
+ ANGLE_TRY(syncUniformBuffersForShader(context, gl::ShaderType::Fragment));
+ if (mProgramD3D->hasShaderStage(gl::ShaderType::Geometry))
+ {
+ ANGLE_TRY(syncUniformBuffersForShader(context, gl::ShaderType::Geometry));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncAtomicCounterBuffers(const gl::Context *context)
+{
+ if (mProgramD3D->hasShaderStage(gl::ShaderType::Compute))
+ {
+ ANGLE_TRY(syncAtomicCounterBuffersForShader(context, gl::ShaderType::Compute));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncAtomicCounterBuffersForShader(const gl::Context *context,
+ gl::ShaderType shaderType)
+{
+ const gl::State &glState = context->getState();
+ const gl::Program *program = glState.getProgram();
+ for (const auto &atomicCounterBuffer : program->getState().getAtomicCounterBuffers())
+ {
+ GLuint binding = atomicCounterBuffer.binding;
+ const auto &buffer = glState.getIndexedAtomicCounterBuffer(binding);
+ const unsigned int registerIndex =
+ mProgramD3D->getAtomicCounterBufferRegisterIndex(binding, shaderType);
+ ASSERT(registerIndex != GL_INVALID_INDEX);
+ if (buffer.get() == nullptr)
+ {
+ // The atomic counter is used in shader. However, there is no buffer binding to it. We
+ // should clear the corresponding UAV in case the previous view type is a texture not a
+ // buffer. Otherwise, below error will be reported. The Unordered Access View dimension
+ // declared in the shader code (BUFFER) does not match the view type bound to slot 0
+ // of the Compute Shader unit (TEXTURE2D).
+ setUnorderedAccessViewInternal<d3d11::UnorderedAccessView>(shaderType, registerIndex,
+ nullptr);
+ continue;
+ }
+
+ Buffer11 *bufferStorage = GetImplAs<Buffer11>(buffer.get());
+ // TODO(enrico.galli@intel.com): Check to make sure that we aren't binding the same buffer
+ // multiple times, as this is unsupported by D3D11. http://anglebug.com/3141
+
+ // Bindings only have a valid size if bound using glBindBufferRange. Therefore, we use the
+ // buffer size for glBindBufferBase
+ GLsizeiptr viewSize = (buffer.getSize() > 0) ? buffer.getSize() : bufferStorage->getSize();
+ d3d11::UnorderedAccessView *uavPtr = nullptr;
+ ANGLE_TRY(bufferStorage->getRawUAVRange(context, buffer.getOffset(), viewSize, &uavPtr));
+
+ if (shaderType == gl::ShaderType::Compute)
+ {
+ setUnorderedAccessViewInternal(shaderType, registerIndex, uavPtr);
+ }
+ else
+ {
+ // Atomic Shaders on non-compute shaders are currently unimplemented
+ // http://anglebug.com/1729
+ UNIMPLEMENTED();
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncShaderStorageBuffers(const gl::Context *context)
+{
+ if (mProgramD3D->hasShaderStage(gl::ShaderType::Compute))
+ {
+ ANGLE_TRY(syncShaderStorageBuffersForShader(context, gl::ShaderType::Compute));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result StateManager11::syncTransformFeedbackBuffers(const gl::Context *context)
+{
+ const auto &glState = context->getState();
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // If transform feedback is not active, unbind all buffers
+ if (!glState.isTransformFeedbackActiveUnpaused())
+ {
+ if (mAppliedTFSerial != mEmptySerial)
+ {
+ deviceContext->SOSetTargets(0, nullptr, nullptr);
+ mAppliedTFSerial = mEmptySerial;
+ }
+ return angle::Result::Continue;
+ }
+
+ gl::TransformFeedback *transformFeedback = glState.getCurrentTransformFeedback();
+ TransformFeedback11 *tf11 = GetImplAs<TransformFeedback11>(transformFeedback);
+ if (mAppliedTFSerial == tf11->getSerial() && !tf11->isDirty())
+ {
+ return angle::Result::Continue;
+ }
+
+ const std::vector<ID3D11Buffer *> *soBuffers = nullptr;
+ ANGLE_TRY(tf11->getSOBuffers(context, &soBuffers));
+ const std::vector<UINT> &soOffsets = tf11->getSOBufferOffsets();
+
+ deviceContext->SOSetTargets(tf11->getNumSOBuffers(), soBuffers->data(), soOffsets.data());
+
+ mAppliedTFSerial = tf11->getSerial();
+ tf11->onApply();
+
+ return angle::Result::Continue;
+}
+
+void StateManager11::syncPrimitiveTopology(const gl::State &glState,
+ gl::PrimitiveMode currentDrawMode)
+{
+ D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
+ // Don't cull everything by default, this also resets if we were previously culling
+ mCullEverything = false;
+
+ switch (currentDrawMode)
+ {
+ case gl::PrimitiveMode::Points:
+ {
+ bool usesPointSize = mProgramD3D->usesPointSize();
+
+ // ProgramBinary assumes non-point rendering if gl_PointSize isn't written,
+ // which affects varying interpolation. Since the value of gl_PointSize is
+ // undefined when not written, just skip drawing to avoid unexpected results.
+ if (!usesPointSize && !glState.isTransformFeedbackActiveUnpaused())
+ {
+ // Notify developers of risking undefined behavior.
+ WARN() << "Point rendering without writing to gl_PointSize.";
+ mCullEverything = true;
+ return;
+ }
+
+ // If instanced pointsprites are enabled and the shader uses gl_PointSize, the topology
+ // must be D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST.
+ if (usesPointSize && mRenderer->getFeatures().useInstancedPointSpriteEmulation.enabled)
+ {
+ primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+ }
+ else
+ {
+ primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
+ }
+ break;
+ }
+ case gl::PrimitiveMode::Lines:
+ primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINELIST;
+ break;
+ case gl::PrimitiveMode::LineLoop:
+ primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
+ break;
+ case gl::PrimitiveMode::LineStrip:
+ primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
+ break;
+ case gl::PrimitiveMode::Triangles:
+ primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+ mCullEverything = CullsEverything(glState);
+ break;
+ case gl::PrimitiveMode::TriangleStrip:
+ primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
+ mCullEverything = CullsEverything(glState);
+ break;
+ // emulate fans via rewriting index buffer
+ case gl::PrimitiveMode::TriangleFan:
+ primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+ mCullEverything = CullsEverything(glState);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ setPrimitiveTopologyInternal(primitiveTopology);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h
new file mode 100644
index 0000000000..45f3849aa7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h
@@ -0,0 +1,640 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// StateManager11.h: Defines a class for caching D3D11 state
+
+#ifndef LIBANGLE_RENDERER_D3D11_STATEMANAGER11_H_
+#define LIBANGLE_RENDERER_D3D11_STATEMANAGER11_H_
+
+#include <array>
+
+#include "libANGLE/State.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/IndexDataManager.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/InputLayoutCache.h"
+#include "libANGLE/renderer/d3d/d3d11/Query11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+class Buffer11;
+class DisplayD3D;
+class Framebuffer11;
+struct RenderTargetDesc;
+struct Renderer11DeviceCaps;
+class VertexArray11;
+
+class ShaderConstants11 : angle::NonCopyable
+{
+ public:
+ ShaderConstants11();
+ ~ShaderConstants11();
+
+ void init(const gl::Caps &caps);
+ size_t getRequiredBufferSize(gl::ShaderType shaderType) const;
+ void markDirty();
+
+ void setComputeWorkGroups(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ);
+ void setMultiviewWriteToViewportIndex(GLfloat index);
+ void onViewportChange(const gl::Rectangle &glViewport,
+ const D3D11_VIEWPORT &dxViewport,
+ bool is9_3,
+ bool presentPathFast);
+ bool onFirstVertexChange(GLint firstVertex);
+ void onImageLayerChange(gl::ShaderType shaderType, unsigned int imageIndex, int layer);
+ void onSamplerChange(gl::ShaderType shaderType,
+ unsigned int samplerIndex,
+ const gl::Texture &texture,
+ const gl::SamplerState &samplerState);
+ void onImageChange(gl::ShaderType shaderType,
+ unsigned int imageIndex,
+ const gl::ImageUnit &imageUnit);
+
+ angle::Result updateBuffer(const gl::Context *context,
+ Renderer11 *renderer,
+ gl::ShaderType shaderType,
+ const ProgramD3D &programD3D,
+ const d3d11::Buffer &driverConstantBuffer);
+
+ private:
+ struct Vertex
+ {
+ Vertex()
+ : depthRange{.0f},
+ viewAdjust{.0f},
+ viewCoords{.0f},
+ viewScale{.0f},
+ multiviewWriteToViewportIndex{.0f},
+ firstVertex{0}
+ {}
+
+ float depthRange[4];
+ float viewAdjust[4];
+ float viewCoords[4];
+ float viewScale[2];
+ // multiviewWriteToViewportIndex is used to select either the side-by-side or layered
+ // code-path in the GS. It's value, if set, is either 0.0f or 1.0f. The value is updated
+ // whenever a multi-view draw framebuffer is made active.
+ float multiviewWriteToViewportIndex;
+
+ uint32_t firstVertex;
+ };
+
+ struct Pixel
+ {
+ Pixel()
+ : depthRange{.0f},
+ viewCoords{.0f},
+ depthFront{.0f},
+ viewScale{.0f},
+ multiviewWriteToViewportIndex(0),
+ padding(0)
+ {}
+
+ float depthRange[4];
+ float viewCoords[4];
+ float depthFront[4];
+ float viewScale[2];
+ // multiviewWriteToViewportIndex is used to select either the side-by-side or layered
+ // code-path in the GS. It's value, if set, is either 0.0f or 1.0f. The value is updated
+ // whenever a multi-view draw framebuffer is made active.
+ float multiviewWriteToViewportIndex;
+
+ // Added here to manually pad the struct.
+ float padding;
+ };
+
+ struct Compute
+ {
+ Compute() : numWorkGroups{0u}, padding(0u) {}
+ unsigned int numWorkGroups[3];
+ unsigned int padding; // This just pads the struct to 16 bytes
+ };
+
+ struct SamplerMetadata
+ {
+ SamplerMetadata()
+ : baseLevel(0), internalFormatBits(0), wrapModes(0), padding(0), intBorderColor{0}
+ {}
+
+ int baseLevel;
+ int internalFormatBits;
+ int wrapModes;
+ int padding; // This just pads the struct to 32 bytes
+ int intBorderColor[4];
+ };
+
+ static_assert(sizeof(SamplerMetadata) == 32u,
+ "Sampler metadata struct must be two 4-vec --> 32 bytes.");
+
+ struct ImageMetadata
+ {
+ ImageMetadata() : layer(0), level(0), padding{0} {}
+
+ int layer;
+ unsigned int level;
+ int padding[2]; // This just pads the struct to 16 bytes
+ };
+ static_assert(sizeof(ImageMetadata) == 16u,
+ "Image metadata struct must be one 4-vec --> 16 bytes.");
+
+ static size_t GetShaderConstantsStructSize(gl::ShaderType shaderType);
+
+ // Return true if dirty.
+ bool updateSamplerMetadata(SamplerMetadata *data,
+ const gl::Texture &texture,
+ const gl::SamplerState &samplerState);
+
+ // Return true if dirty.
+ bool updateImageMetadata(ImageMetadata *data, const gl::ImageUnit &imageUnit);
+
+ Vertex mVertex;
+ Pixel mPixel;
+ Compute mCompute;
+ gl::ShaderBitSet mShaderConstantsDirty;
+
+ gl::ShaderMap<std::vector<SamplerMetadata>> mShaderSamplerMetadata;
+ gl::ShaderMap<int> mNumActiveShaderSamplers;
+ gl::ShaderMap<std::vector<ImageMetadata>> mShaderReadonlyImageMetadata;
+ gl::ShaderMap<int> mNumActiveShaderReadonlyImages;
+ gl::ShaderMap<std::vector<ImageMetadata>> mShaderImageMetadata;
+ gl::ShaderMap<int> mNumActiveShaderImages;
+};
+
+class StateManager11 final : angle::NonCopyable
+{
+ public:
+ StateManager11(Renderer11 *renderer);
+ ~StateManager11();
+
+ void deinitialize();
+
+ void syncState(const gl::Context *context, const gl::State::DirtyBits &dirtyBits);
+
+ angle::Result updateStateForCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ);
+
+ void updateStencilSizeIfChanged(bool depthStencilInitialized, unsigned int stencilSize);
+
+ // These invalidations methods are called externally.
+
+ // Called from TextureStorage11.
+ void invalidateBoundViews();
+
+ // Called from VertexArray11::updateVertexAttribStorage.
+ void invalidateCurrentValueAttrib(size_t attribIndex);
+
+ // Checks are done on a framebuffer state change to trigger other state changes.
+ // The Context is allowed to be nullptr for these methods, when called in EGL init code.
+ void invalidateRenderTarget();
+
+ // Called by instanced point sprite emulation.
+ void invalidateVertexBuffer();
+
+ // Called by Framebuffer11::syncState for the default sized viewport.
+ void invalidateViewport(const gl::Context *context);
+
+ // Called by TextureStorage11::markLevelDirty.
+ void invalidateSwizzles();
+
+ // Called by the Framebuffer11 and VertexArray11.
+ void invalidateShaders();
+
+ // Called by the Program on Uniform Buffer change. Also called internally.
+ void invalidateProgramUniformBuffers();
+
+ // Called by TransformFeedback11.
+ void invalidateTransformFeedback();
+
+ // Called by VertexArray11.
+ void invalidateInputLayout();
+
+ // Called by VertexArray11 element array buffer sync.
+ void invalidateIndexBuffer();
+
+ // Called by TextureStorage11. Also called internally.
+ void invalidateTexturesAndSamplers();
+
+ void setRenderTarget(ID3D11RenderTargetView *rtv, ID3D11DepthStencilView *dsv);
+ void setRenderTargets(ID3D11RenderTargetView **rtvs, UINT numRtvs, ID3D11DepthStencilView *dsv);
+
+ void onBeginQuery(Query11 *query);
+ void onDeleteQueryObject(Query11 *query);
+ angle::Result onMakeCurrent(const gl::Context *context);
+
+ void setInputLayout(const d3d11::InputLayout *inputLayout);
+
+ void setSingleVertexBuffer(const d3d11::Buffer *buffer, UINT stride, UINT offset);
+
+ angle::Result updateState(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLsizei instanceCount,
+ GLint baseVertex);
+
+ void setShaderResourceShared(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const d3d11::SharedSRV *srv);
+ void setShaderResource(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const d3d11::ShaderResourceView *srv);
+ void setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology);
+
+ void setDrawShaders(const d3d11::VertexShader *vertexShader,
+ const d3d11::GeometryShader *geometryShader,
+ const d3d11::PixelShader *pixelShader);
+ void setVertexShader(const d3d11::VertexShader *shader);
+ void setGeometryShader(const d3d11::GeometryShader *shader);
+ void setPixelShader(const d3d11::PixelShader *shader);
+ void setComputeShader(const d3d11::ComputeShader *shader);
+ void setVertexConstantBuffer(unsigned int slot, const d3d11::Buffer *buffer);
+ void setPixelConstantBuffer(unsigned int slot, const d3d11::Buffer *buffer);
+ void setDepthStencilState(const d3d11::DepthStencilState *depthStencilState, UINT stencilRef);
+ void setSimpleBlendState(const d3d11::BlendState *blendState);
+ void setRasterizerState(const d3d11::RasterizerState *rasterizerState);
+ void setSimpleViewport(const gl::Extents &viewportExtents);
+ void setSimpleViewport(int width, int height);
+ void setSimplePixelTextureAndSampler(const d3d11::SharedSRV &srv,
+ const d3d11::SamplerState &samplerState);
+ void setSimpleScissorRect(const gl::Rectangle &glRect);
+ void setScissorRectD3D(const D3D11_RECT &d3dRect);
+
+ void setIndexBuffer(ID3D11Buffer *buffer, DXGI_FORMAT indexFormat, unsigned int offset);
+
+ angle::Result updateVertexOffsetsForPointSpritesEmulation(const gl::Context *context,
+ GLint startVertex,
+ GLsizei emulatedInstanceId);
+
+ // TODO(jmadill): Should be private.
+ angle::Result applyComputeUniforms(const gl::Context *context, ProgramD3D *programD3D);
+
+ // Only used in testing.
+ InputLayoutCache *getInputLayoutCache() { return &mInputLayoutCache; }
+
+ bool getCullEverything() const { return mCullEverything; }
+ VertexDataManager *getVertexDataManager() { return &mVertexDataManager; }
+
+ ProgramD3D *getProgramD3D() const { return mProgramD3D; }
+
+ private:
+ angle::Result ensureInitialized(const gl::Context *context);
+
+ template <typename SRVType>
+ void setShaderResourceInternal(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const SRVType *srv);
+ template <typename UAVType>
+ void setUnorderedAccessViewInternal(gl::ShaderType shaderType,
+ UINT resourceSlot,
+ const UAVType *uav);
+
+ void unsetConflictingView(gl::PipelineType pipeline, ID3D11View *view, bool isRenderTarget);
+ void unsetConflictingSRVs(gl::PipelineType pipeline,
+ gl::ShaderType shaderType,
+ uintptr_t resource,
+ const gl::ImageIndex *index,
+ bool isRenderTarget);
+ void unsetConflictingUAVs(gl::PipelineType pipeline,
+ gl::ShaderType shaderType,
+ uintptr_t resource,
+ const gl::ImageIndex *index);
+ void unsetConflictingRTVs(uintptr_t resource);
+
+ void unsetConflictingAttachmentResources(const gl::FramebufferAttachment &attachment,
+ ID3D11Resource *resource);
+
+ angle::Result syncBlendState(const gl::Context *context,
+ const gl::BlendState &blendState,
+ const gl::ColorF &blendColor,
+ unsigned int sampleMask);
+
+ angle::Result syncDepthStencilState(const gl::Context *context);
+
+ angle::Result syncRasterizerState(const gl::Context *context, gl::PrimitiveMode mode);
+
+ void syncScissorRectangle(const gl::Rectangle &scissor, bool enabled);
+
+ void syncViewport(const gl::Context *context);
+
+ void checkPresentPath(const gl::Context *context);
+
+ angle::Result syncFramebuffer(const gl::Context *context);
+ angle::Result syncProgram(const gl::Context *context, gl::PrimitiveMode drawMode);
+ angle::Result syncProgramForCompute(const gl::Context *context);
+
+ angle::Result syncTextures(const gl::Context *context);
+ angle::Result applyTexturesForSRVs(const gl::Context *context, gl::ShaderType shaderType);
+ angle::Result applyTexturesForUAVs(const gl::Context *context, gl::ShaderType shaderType);
+ angle::Result syncTexturesForCompute(const gl::Context *context);
+
+ angle::Result setSamplerState(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture,
+ const gl::SamplerState &sampler);
+ angle::Result setTextureForSampler(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture,
+ const gl::SamplerState &sampler);
+ angle::Result setImageState(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ const gl::ImageUnit &imageUnit);
+ angle::Result setTextureForImage(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ bool readonly,
+ const gl::ImageUnit &imageUnit);
+
+ void handleMultiviewDrawFramebufferChange(const gl::Context *context);
+
+ angle::Result syncCurrentValueAttribs(
+ const gl::Context *context,
+ const std::vector<gl::VertexAttribCurrentValueData> &currentValues);
+
+ angle::Result generateSwizzle(const gl::Context *context, gl::Texture *texture);
+ angle::Result generateSwizzlesForShader(const gl::Context *context, gl::ShaderType type);
+ angle::Result generateSwizzles(const gl::Context *context);
+
+ angle::Result applyDriverUniforms(const gl::Context *context);
+ angle::Result applyDriverUniformsForShader(const gl::Context *context,
+ gl::ShaderType shaderType);
+ angle::Result applyUniforms(const gl::Context *context);
+ angle::Result applyUniformsForShader(const gl::Context *context, gl::ShaderType shaderType);
+
+ angle::Result syncShaderStorageBuffersForShader(const gl::Context *context,
+ gl::ShaderType shaderType);
+
+ angle::Result syncUniformBuffers(const gl::Context *context);
+ angle::Result syncUniformBuffersForShader(const gl::Context *context,
+ gl::ShaderType shaderType);
+ angle::Result syncAtomicCounterBuffers(const gl::Context *context);
+ angle::Result syncAtomicCounterBuffersForShader(const gl::Context *context,
+ gl::ShaderType shaderType);
+ angle::Result syncShaderStorageBuffers(const gl::Context *context);
+ angle::Result syncTransformFeedbackBuffers(const gl::Context *context);
+
+ // These are currently only called internally.
+ void invalidateDriverUniforms();
+ void invalidateProgramUniforms();
+ void invalidateConstantBuffer(unsigned int slot);
+ void invalidateProgramAtomicCounterBuffers();
+ void invalidateProgramShaderStorageBuffers();
+
+ // Called by the Framebuffer11 directly.
+ void processFramebufferInvalidation(const gl::Context *context);
+
+ bool syncIndexBuffer(ID3D11Buffer *buffer, DXGI_FORMAT indexFormat, unsigned int offset);
+ angle::Result syncVertexBuffersAndInputLayout(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ GLsizei instanceCount);
+
+ bool setInputLayoutInternal(const d3d11::InputLayout *inputLayout);
+
+ angle::Result applyVertexBuffers(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType indexTypeOrInvalid,
+ GLint firstVertex);
+ // TODO(jmadill): Migrate to d3d11::Buffer.
+ bool queueVertexBufferChange(size_t bufferIndex,
+ ID3D11Buffer *buffer,
+ UINT stride,
+ UINT offset);
+ void applyVertexBufferChanges();
+ bool setPrimitiveTopologyInternal(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology);
+ void syncPrimitiveTopology(const gl::State &glState, gl::PrimitiveMode currentDrawMode);
+
+ // Not handled by an internal dirty bit because it isn't synced on drawArrays calls.
+ angle::Result applyIndexBuffer(const gl::Context *context,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices);
+
+ enum DirtyBitType
+ {
+ DIRTY_BIT_RENDER_TARGET,
+ DIRTY_BIT_VIEWPORT_STATE,
+ DIRTY_BIT_SCISSOR_STATE,
+ DIRTY_BIT_RASTERIZER_STATE,
+ DIRTY_BIT_BLEND_STATE,
+ DIRTY_BIT_DEPTH_STENCIL_STATE,
+ // DIRTY_BIT_SHADERS and DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE should be dealt before
+ // DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS for update image layers.
+ DIRTY_BIT_SHADERS,
+ // DIRTY_BIT_GRAPHICS_SRVUAV_STATE and DIRTY_BIT_COMPUTE_SRVUAV_STATE should be lower
+ // bits than DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE.
+ DIRTY_BIT_GRAPHICS_SRVUAV_STATE,
+ DIRTY_BIT_COMPUTE_SRVUAV_STATE,
+ DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE,
+ DIRTY_BIT_PROGRAM_UNIFORMS,
+ DIRTY_BIT_DRIVER_UNIFORMS,
+ DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS,
+ DIRTY_BIT_PROGRAM_ATOMIC_COUNTER_BUFFERS,
+ DIRTY_BIT_PROGRAM_SHADER_STORAGE_BUFFERS,
+ DIRTY_BIT_CURRENT_VALUE_ATTRIBS,
+ DIRTY_BIT_TRANSFORM_FEEDBACK,
+ DIRTY_BIT_VERTEX_BUFFERS_AND_INPUT_LAYOUT,
+ DIRTY_BIT_PRIMITIVE_TOPOLOGY,
+ DIRTY_BIT_INVALID,
+ DIRTY_BIT_MAX = DIRTY_BIT_INVALID,
+ };
+
+ using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
+
+ Renderer11 *mRenderer;
+
+ // Internal dirty bits.
+ DirtyBits mInternalDirtyBits;
+ DirtyBits mGraphicsDirtyBitsMask;
+ DirtyBits mComputeDirtyBitsMask;
+
+ // Blend State
+ gl::BlendState mCurBlendState;
+ gl::ColorF mCurBlendColor;
+ unsigned int mCurSampleMask;
+
+ // Currently applied depth stencil state
+ gl::DepthStencilState mCurDepthStencilState;
+ int mCurStencilRef;
+ int mCurStencilBackRef;
+ unsigned int mCurStencilSize;
+ Optional<bool> mCurDisableDepth;
+ Optional<bool> mCurDisableStencil;
+
+ // Currently applied rasterizer state
+ gl::RasterizerState mCurRasterState;
+
+ // Currently applied scissor rectangle state
+ bool mCurScissorEnabled;
+ gl::Rectangle mCurScissorRect;
+
+ // Currently applied viewport state
+ gl::Rectangle mCurViewport;
+ float mCurNear;
+ float mCurFar;
+
+ // Things needed in viewport state
+ ShaderConstants11 mShaderConstants;
+
+ // Render target variables
+ gl::Extents mViewportBounds;
+ bool mRenderTargetIsDirty;
+
+ // EGL_ANGLE_experimental_present_path variables
+ bool mCurPresentPathFastEnabled;
+ int mCurPresentPathFastColorBufferHeight;
+
+ // Queries that are currently active in this state
+ std::set<Query11 *> mCurrentQueries;
+
+ // Currently applied textures
+ template <typename DescType>
+ struct ViewRecord
+ {
+ uintptr_t view;
+ uintptr_t resource;
+ DescType desc;
+ };
+
+ // A cache of current Views that also tracks the highest 'used' (non-NULL) View.
+ // We might want to investigate a more robust approach that is also fast when there's
+ // a large gap between used Views (e.g. if View 0 and 7 are non-NULL, this approach will
+ // waste time on Views 1-6.)
+ template <typename ViewType, typename DescType>
+ class ViewCache : angle::NonCopyable
+ {
+ public:
+ ViewCache();
+ ~ViewCache();
+
+ void initialize(size_t size) { mCurrentViews.resize(size); }
+
+ size_t size() const { return mCurrentViews.size(); }
+ size_t highestUsed() const { return mHighestUsedView; }
+
+ const ViewRecord<DescType> &operator[](size_t index) const { return mCurrentViews[index]; }
+ void clear();
+ void update(size_t resourceIndex, ViewType *view);
+
+ private:
+ std::vector<ViewRecord<DescType>> mCurrentViews;
+ size_t mHighestUsedView;
+ };
+
+ using SRVCache = ViewCache<ID3D11ShaderResourceView, D3D11_SHADER_RESOURCE_VIEW_DESC>;
+ using UAVCache = ViewCache<ID3D11UnorderedAccessView, D3D11_UNORDERED_ACCESS_VIEW_DESC>;
+ using RTVCache = ViewCache<ID3D11RenderTargetView, D3D11_RENDER_TARGET_VIEW_DESC>;
+ gl::ShaderMap<SRVCache> mCurShaderSRVs;
+ UAVCache mCurComputeUAVs;
+ RTVCache mCurRTVs;
+
+ SRVCache *getSRVCache(gl::ShaderType shaderType);
+
+ // A block of NULL pointers, cached so we don't re-allocate every draw call
+ std::vector<ID3D11ShaderResourceView *> mNullSRVs;
+ std::vector<ID3D11UnorderedAccessView *> mNullUAVs;
+
+ // Current translations of "Current-Value" data - owned by Context, not VertexArray.
+ gl::AttributesMask mDirtyCurrentValueAttribs;
+ std::vector<TranslatedAttribute> mCurrentValueAttribs;
+
+ // Current applied input layout.
+ ResourceSerial mCurrentInputLayout;
+
+ // Current applied vertex states.
+ // TODO(jmadill): Figure out how to use ResourceSerial here.
+ gl::AttribArray<ID3D11Buffer *> mCurrentVertexBuffers;
+ gl::AttribArray<UINT> mCurrentVertexStrides;
+ gl::AttribArray<UINT> mCurrentVertexOffsets;
+ gl::RangeUI mDirtyVertexBufferRange;
+
+ // Currently applied primitive topology
+ D3D11_PRIMITIVE_TOPOLOGY mCurrentPrimitiveTopology;
+ gl::PrimitiveMode mLastAppliedDrawMode;
+ bool mCullEverything;
+
+ // Currently applied shaders
+ gl::ShaderMap<ResourceSerial> mAppliedShaders;
+
+ // Currently applied sampler states
+ gl::ShaderMap<std::vector<bool>> mForceSetShaderSamplerStates;
+ gl::ShaderMap<std::vector<gl::SamplerState>> mCurShaderSamplerStates;
+
+ // Special dirty bit for swizzles. Since they use internal shaders, must be done in a pre-pass.
+ bool mDirtySwizzles;
+
+ // Currently applied index buffer
+ ID3D11Buffer *mAppliedIB;
+ DXGI_FORMAT mAppliedIBFormat;
+ unsigned int mAppliedIBOffset;
+ bool mIndexBufferIsDirty;
+
+ // Vertex, index and input layouts
+ VertexDataManager mVertexDataManager;
+ IndexDataManager mIndexDataManager;
+ InputLayoutCache mInputLayoutCache;
+ std::vector<const TranslatedAttribute *> mCurrentAttributes;
+ Optional<GLint> mLastFirstVertex;
+
+ // ANGLE_multiview.
+ bool mIsMultiviewEnabled;
+
+ // Driver Constants.
+ gl::ShaderMap<d3d11::Buffer> mShaderDriverConstantBuffers;
+
+ ResourceSerial mCurrentComputeConstantBuffer;
+ ResourceSerial mCurrentGeometryConstantBuffer;
+
+ d3d11::Buffer mPointSpriteVertexBuffer;
+ d3d11::Buffer mPointSpriteIndexBuffer;
+
+ template <typename T>
+ using VertexConstantBufferArray =
+ std::array<T, gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS>;
+
+ VertexConstantBufferArray<ResourceSerial> mCurrentConstantBufferVS;
+ VertexConstantBufferArray<GLintptr> mCurrentConstantBufferVSOffset;
+ VertexConstantBufferArray<GLsizeiptr> mCurrentConstantBufferVSSize;
+
+ template <typename T>
+ using FragmentConstantBufferArray =
+ std::array<T, gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS>;
+
+ FragmentConstantBufferArray<ResourceSerial> mCurrentConstantBufferPS;
+ FragmentConstantBufferArray<GLintptr> mCurrentConstantBufferPSOffset;
+ FragmentConstantBufferArray<GLsizeiptr> mCurrentConstantBufferPSSize;
+
+ template <typename T>
+ using ComputeConstantBufferArray =
+ std::array<T, gl::IMPLEMENTATION_MAX_COMPUTE_SHADER_UNIFORM_BUFFERS>;
+
+ ComputeConstantBufferArray<ResourceSerial> mCurrentConstantBufferCS;
+ ComputeConstantBufferArray<GLintptr> mCurrentConstantBufferCSOffset;
+ ComputeConstantBufferArray<GLsizeiptr> mCurrentConstantBufferCSSize;
+
+ // Currently applied transform feedback buffers
+ Serial mAppliedTFSerial;
+
+ Serial mEmptySerial;
+
+ // These objects are cached to avoid having to query the impls.
+ ProgramD3D *mProgramD3D;
+ VertexArray11 *mVertexArray11;
+ Framebuffer11 *mFramebuffer11;
+};
+
+} // namespace rx
+#endif // LIBANGLE_RENDERER_D3D11_STATEMANAGER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.cpp
new file mode 100644
index 0000000000..24fa9ff2c8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.cpp
@@ -0,0 +1,162 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// StreamProducerD3DTexture.cpp: Implements the stream producer for D3D11 textures
+
+#include "libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.h"
+
+#include "common/utilities.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#include <array>
+
+namespace rx
+{
+
+namespace
+{
+
+egl::Error GetGLDescFromTex(ID3D11Texture2D *const tex,
+ const UINT planeIndex,
+ egl::Stream::GLTextureDescription *const out)
+{
+ if (!tex)
+ return egl::EglBadParameter() << "Texture is null";
+
+ D3D11_TEXTURE2D_DESC desc;
+ tex->GetDesc(&desc);
+
+ if (desc.Width < 1 || desc.Height < 1)
+ return egl::EglBadParameter() << "Width or height < 1";
+
+ out->width = desc.Width;
+ out->height = desc.Height;
+ out->mipLevels = 0;
+
+ std::array<uint32_t, 2> planeFormats = {};
+ switch (desc.Format)
+ {
+ case DXGI_FORMAT_NV12:
+ planeFormats = {GL_R8, GL_RG8};
+ break;
+
+ case DXGI_FORMAT_P010:
+ case DXGI_FORMAT_P016:
+ planeFormats = {GL_R16_EXT, GL_RG16_EXT};
+ break;
+
+ case DXGI_FORMAT_R8_UNORM:
+ planeFormats = {GL_R8};
+ break;
+ case DXGI_FORMAT_R8G8_UNORM:
+ planeFormats[0] = GL_RG8;
+ break;
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ planeFormats[0] = GL_RGBA8;
+ break;
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ planeFormats[0] = GL_BGRA8_EXT;
+ break;
+
+ case DXGI_FORMAT_R16_UNORM:
+ planeFormats[0] = GL_R16_EXT;
+ break;
+ case DXGI_FORMAT_R16G16_UNORM:
+ planeFormats[0] = GL_RG16_EXT;
+ break;
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ planeFormats[0] = GL_RGBA16_EXT;
+ break;
+
+ default:
+ return egl::EglBadParameter() << "Unsupported format";
+ }
+
+ if (planeFormats[1]) // If we have YUV planes, expect 4:2:0.
+ {
+ if ((desc.Width % 2) != 0 || (desc.Height % 2) != 0)
+ return egl::EglBadParameter() << "YUV 4:2:0 textures must have even width and height.";
+ }
+ if (planeIndex > 0)
+ {
+ out->width /= 2;
+ out->height /= 2;
+ }
+
+ out->internalFormat = 0;
+ if (planeIndex < planeFormats.size())
+ {
+ out->internalFormat = planeFormats[planeIndex];
+ }
+ if (!out->internalFormat)
+ return egl::EglBadParameter() << "Plane out of range";
+
+ return egl::NoError();
+}
+
+} // namespace
+
+StreamProducerD3DTexture::StreamProducerD3DTexture(Renderer11 *renderer)
+ : mRenderer(renderer), mTexture(nullptr), mArraySlice(0), mPlaneOffset(0)
+{}
+
+StreamProducerD3DTexture::~StreamProducerD3DTexture()
+{
+ SafeRelease(mTexture);
+}
+
+egl::Error StreamProducerD3DTexture::validateD3DTexture(void *pointer,
+ const egl::AttributeMap &attributes) const
+{
+ ID3D11Texture2D *textureD3D = static_cast<ID3D11Texture2D *>(pointer);
+
+ // Check that the texture originated from our device
+ ID3D11Device *device;
+ textureD3D->GetDevice(&device);
+ if (device != mRenderer->getDevice())
+ {
+ return egl::EglBadParameter() << "Texture not created on ANGLE D3D device";
+ }
+
+ const auto planeId = static_cast<UINT>(attributes.get(EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG, 0));
+ egl::Stream::GLTextureDescription unused;
+ return GetGLDescFromTex(textureD3D, planeId, &unused);
+}
+
+void StreamProducerD3DTexture::postD3DTexture(void *pointer, const egl::AttributeMap &attributes)
+{
+ ASSERT(pointer != nullptr);
+ ID3D11Texture2D *textureD3D = static_cast<ID3D11Texture2D *>(pointer);
+
+ // Release the previous texture if there is one
+ SafeRelease(mTexture);
+
+ mTexture = textureD3D;
+ mTexture->AddRef();
+ mPlaneOffset = static_cast<UINT>(attributes.get(EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG, 0));
+ mArraySlice = static_cast<UINT>(attributes.get(EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE, 0));
+}
+
+egl::Stream::GLTextureDescription StreamProducerD3DTexture::getGLFrameDescription(int planeIndex)
+{
+ const auto planeOffsetIndex = static_cast<UINT>(planeIndex + mPlaneOffset);
+ egl::Stream::GLTextureDescription ret;
+ ANGLE_SWALLOW_ERR(GetGLDescFromTex(mTexture, planeOffsetIndex, &ret));
+ return ret;
+}
+
+ID3D11Texture2D *StreamProducerD3DTexture::getD3DTexture()
+{
+ return mTexture;
+}
+
+UINT StreamProducerD3DTexture::getArraySlice()
+{
+ return mArraySlice;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.h
new file mode 100644
index 0000000000..5c4bcb266c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.h
@@ -0,0 +1,44 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// StreamProducerD3DTexture.h: Interface for a D3D11 texture stream producer
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_STREAM11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_STREAM11_H_
+
+#include "libANGLE/renderer/StreamProducerImpl.h"
+
+namespace rx
+{
+class Renderer11;
+
+class StreamProducerD3DTexture : public StreamProducerImpl
+{
+ public:
+ StreamProducerD3DTexture(Renderer11 *renderer);
+ ~StreamProducerD3DTexture() override;
+
+ egl::Error validateD3DTexture(void *pointer,
+ const egl::AttributeMap &attributes) const override;
+ void postD3DTexture(void *pointer, const egl::AttributeMap &attributes) override;
+ egl::Stream::GLTextureDescription getGLFrameDescription(int planeIndex) override;
+
+ // Gets a pointer to the internal D3D texture
+ ID3D11Texture2D *getD3DTexture();
+
+ // Gets the slice index for the D3D texture that the frame is in
+ UINT getArraySlice();
+
+ private:
+ Renderer11 *mRenderer;
+
+ ID3D11Texture2D *mTexture;
+ UINT mArraySlice;
+ UINT mPlaneOffset;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_STREAM11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
new file mode 100644
index 0000000000..023e2059ee
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
@@ -0,0 +1,1085 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SwapChain11.cpp: Implements a back-end specific class for the D3D11 swap chain.
+
+#include "libANGLE/renderer/d3d/d3d11/SwapChain11.h"
+
+#include <EGL/eglext.h>
+
+#include "libANGLE/features.h"
+#include "libANGLE/renderer/d3d/DisplayD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/NativeWindow11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+#include "libANGLE/trace.h"
+
+// Precompiled shaders
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h"
+#include "libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvecolor2dps.h"
+
+#ifdef ANGLE_ENABLE_KEYEDMUTEX
+# define ANGLE_RESOURCE_SHARE_TYPE D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
+#else
+# define ANGLE_RESOURCE_SHARE_TYPE D3D11_RESOURCE_MISC_SHARED
+#endif
+
+namespace rx
+{
+
+namespace
+{
+// To avoid overflow in QPC to Microseconds calculations, since we multiply
+// by kMicrosecondsPerSecond, then the QPC value should not exceed
+// (2^63 - 1) / 1E6. If it exceeds that threshold, we divide then multiply.
+static constexpr int64_t kQPCOverflowThreshold = 0x8637BD05AF7;
+static constexpr int64_t kMicrosecondsPerSecond = 1000000;
+
+bool NeedsOffscreenTexture(Renderer11 *renderer, NativeWindow11 *nativeWindow, EGLint orientation)
+{
+ // We don't need an offscreen texture if either orientation = INVERT_Y,
+ // or present path fast is enabled and we're not rendering onto an offscreen surface.
+ return orientation != EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE &&
+ !(renderer->presentPathFastEnabled() && nativeWindow->getNativeWindow());
+}
+} // anonymous namespace
+
+SwapChain11::SwapChain11(Renderer11 *renderer,
+ NativeWindow11 *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation,
+ EGLint samples)
+ : SwapChainD3D(shareHandle, d3dTexture, backBufferFormat, depthBufferFormat),
+ mRenderer(renderer),
+ mWidth(-1),
+ mHeight(-1),
+ mOrientation(orientation),
+ mAppCreatedShareHandle(mShareHandle != nullptr),
+ mSwapInterval(0),
+ mPassThroughResourcesInit(false),
+ mNativeWindow(nativeWindow),
+ mFirstSwap(true),
+ mSwapChain(nullptr),
+ mSwapChain1(nullptr),
+ mKeyedMutex(nullptr),
+ mBackBufferTexture(),
+ mBackBufferRTView(),
+ mBackBufferSRView(),
+ mNeedsOffscreenTexture(NeedsOffscreenTexture(renderer, nativeWindow, orientation)),
+ mOffscreenTexture(),
+ mOffscreenRTView(),
+ mOffscreenSRView(),
+ mNeedsOffscreenTextureCopy(false),
+ mOffscreenTextureCopyForSRV(),
+ mDepthStencilTexture(),
+ mDepthStencilDSView(),
+ mDepthStencilSRView(),
+ mQuadVB(),
+ mPassThroughSampler(),
+ mPassThroughIL(),
+ mPassThroughVS(),
+ mPassThroughOrResolvePS(),
+ mPassThroughRS(),
+ mColorRenderTarget(this, renderer, false),
+ mDepthStencilRenderTarget(this, renderer, true),
+ mEGLSamples(samples)
+{
+ // Sanity check that if present path fast is active then we're using the default orientation
+ ASSERT(!mRenderer->presentPathFastEnabled() || orientation == 0);
+
+ // Get the performance counter
+ LARGE_INTEGER counterFreqency = {};
+ BOOL success = QueryPerformanceFrequency(&counterFreqency);
+ ASSERT(success);
+
+ mQPCFrequency = counterFreqency.QuadPart;
+}
+
+SwapChain11::~SwapChain11()
+{
+ release();
+}
+
+void SwapChain11::release()
+{
+ // TODO(jmadill): Should probably signal that the RenderTarget is dirty.
+
+ SafeRelease(mSwapChain1);
+ SafeRelease(mSwapChain);
+ SafeRelease(mKeyedMutex);
+ mBackBufferTexture.reset();
+ mBackBufferRTView.reset();
+ mBackBufferSRView.reset();
+ mOffscreenTexture.reset();
+ mOffscreenRTView.reset();
+ mOffscreenSRView.reset();
+ mDepthStencilTexture.reset();
+ mDepthStencilDSView.reset();
+ mDepthStencilSRView.reset();
+ mQuadVB.reset();
+ mPassThroughSampler.reset();
+ mPassThroughIL.reset();
+ mPassThroughVS.reset();
+ mPassThroughOrResolvePS.reset();
+ mPassThroughRS.reset();
+
+ if (!mAppCreatedShareHandle)
+ {
+ mShareHandle = nullptr;
+ }
+}
+
+void SwapChain11::releaseOffscreenColorBuffer()
+{
+ mOffscreenTexture.reset();
+ mOffscreenRTView.reset();
+ mOffscreenSRView.reset();
+ mNeedsOffscreenTextureCopy = false;
+ mOffscreenTextureCopyForSRV.reset();
+}
+
+void SwapChain11::releaseOffscreenDepthBuffer()
+{
+ mDepthStencilTexture.reset();
+ mDepthStencilDSView.reset();
+ mDepthStencilSRView.reset();
+}
+
+EGLint SwapChain11::resetOffscreenBuffers(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight)
+{
+ if (mNeedsOffscreenTexture)
+ {
+ EGLint result = resetOffscreenColorBuffer(displayD3D, backbufferWidth, backbufferHeight);
+ if (result != EGL_SUCCESS)
+ {
+ return result;
+ }
+ }
+
+ EGLint result = resetOffscreenDepthBuffer(displayD3D, backbufferWidth, backbufferHeight);
+ if (result != EGL_SUCCESS)
+ {
+ return result;
+ }
+
+ mWidth = backbufferWidth;
+ mHeight = backbufferHeight;
+
+ return EGL_SUCCESS;
+}
+
+EGLint SwapChain11::resetOffscreenColorBuffer(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight)
+{
+ ASSERT(mNeedsOffscreenTexture);
+
+ ANGLE_TRACE_EVENT0("gpu.angle", "SwapChain11::resetOffscreenTexture");
+ ID3D11Device *device = mRenderer->getDevice();
+
+ ASSERT(device != nullptr);
+
+ // D3D11 does not allow zero size textures
+ ASSERT(backbufferWidth >= 1);
+ ASSERT(backbufferHeight >= 1);
+
+ // Preserve the render target content
+ TextureHelper11 previousOffscreenTexture(std::move(mOffscreenTexture));
+ const int previousWidth = mWidth;
+ const int previousHeight = mHeight;
+
+ releaseOffscreenColorBuffer();
+
+ const d3d11::Format &backbufferFormatInfo =
+ d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
+ D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
+
+ // If the app passed in a share handle or D3D texture, open the resource
+ // See EGL_ANGLE_d3d_share_handle_client_buffer and EGL_ANGLE_d3d_texture_client_buffer
+ if (mAppCreatedShareHandle || mD3DTexture != nullptr)
+ {
+ if (mAppCreatedShareHandle)
+ {
+ ID3D11Resource *tempResource11;
+ HRESULT result = device->OpenSharedResource(mShareHandle, __uuidof(ID3D11Resource),
+ (void **)&tempResource11);
+ if (FAILED(result))
+ {
+ ERR() << "Could not open shared handle. " << gl::FmtHR(result);
+ release();
+ return EGL_BAD_SURFACE;
+ }
+
+ mOffscreenTexture.set(d3d11::DynamicCastComObject<ID3D11Texture2D>(tempResource11),
+ backbufferFormatInfo);
+ SafeRelease(tempResource11);
+ }
+ else if (mD3DTexture != nullptr)
+ {
+ mOffscreenTexture.set(d3d11::DynamicCastComObject<ID3D11Texture2D>(mD3DTexture),
+ backbufferFormatInfo);
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ ASSERT(mOffscreenTexture.valid());
+ mOffscreenTexture.getDesc(&offscreenTextureDesc);
+
+ // Fail if the offscreen texture is not renderable.
+ if ((offscreenTextureDesc.BindFlags & D3D11_BIND_RENDER_TARGET) == 0)
+ {
+ ERR() << "Could not use provided offscreen texture, texture not renderable.";
+ release();
+ return EGL_BAD_SURFACE;
+ }
+ }
+ else
+ {
+ const bool useSharedResource =
+ !mNativeWindow->getNativeWindow() && mRenderer->getShareHandleSupport();
+
+ offscreenTextureDesc.Width = backbufferWidth;
+ offscreenTextureDesc.Height = backbufferHeight;
+ offscreenTextureDesc.Format = backbufferFormatInfo.texFormat;
+ offscreenTextureDesc.MipLevels = 1;
+ offscreenTextureDesc.ArraySize = 1;
+ offscreenTextureDesc.SampleDesc.Count = getD3DSamples();
+ offscreenTextureDesc.SampleDesc.Quality = 0;
+ offscreenTextureDesc.Usage = D3D11_USAGE_DEFAULT;
+ offscreenTextureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
+ offscreenTextureDesc.CPUAccessFlags = 0;
+ offscreenTextureDesc.MiscFlags = useSharedResource ? ANGLE_RESOURCE_SHARE_TYPE : 0;
+
+ angle::Result result = mRenderer->allocateTexture(displayD3D, offscreenTextureDesc,
+ backbufferFormatInfo, &mOffscreenTexture);
+ if (result == angle::Result::Stop)
+ {
+ ERR() << "Could not create offscreen texture, " << displayD3D->getStoredErrorString();
+ release();
+ return EGL_BAD_ALLOC;
+ }
+
+ mOffscreenTexture.setDebugName("Offscreen back buffer texture");
+
+ // EGL_ANGLE_surface_d3d_texture_2d_share_handle requires that we store a share handle for
+ // the client
+ if (useSharedResource)
+ {
+ IDXGIResource *offscreenTextureResource = nullptr;
+ HRESULT hr = mOffscreenTexture.get()->QueryInterface(
+ __uuidof(IDXGIResource), (void **)&offscreenTextureResource);
+
+ // Fall back to no share handle on failure
+ if (FAILED(hr))
+ {
+ ERR() << "Could not query offscreen texture resource, " << gl::FmtHR(hr);
+ }
+ else
+ {
+ hr = offscreenTextureResource->GetSharedHandle(&mShareHandle);
+ SafeRelease(offscreenTextureResource);
+
+ if (FAILED(hr))
+ {
+ mShareHandle = nullptr;
+ ERR() << "Could not get offscreen texture shared handle, " << gl::FmtHR(hr);
+ }
+ }
+ }
+ }
+
+ // This may return null if the original texture was created without a keyed mutex.
+ mKeyedMutex = d3d11::DynamicCastComObject<IDXGIKeyedMutex>(mOffscreenTexture.get());
+
+ D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc;
+ offscreenRTVDesc.Format = backbufferFormatInfo.rtvFormat;
+ offscreenRTVDesc.ViewDimension =
+ (mEGLSamples <= 1) ? D3D11_RTV_DIMENSION_TEXTURE2D : D3D11_RTV_DIMENSION_TEXTURE2DMS;
+ offscreenRTVDesc.Texture2D.MipSlice = 0;
+
+ angle::Result result = mRenderer->allocateResource(displayD3D, offscreenRTVDesc,
+ mOffscreenTexture.get(), &mOffscreenRTView);
+ ASSERT(result != angle::Result::Stop);
+ mOffscreenRTView.setDebugName("Offscreen back buffer render target");
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC offscreenSRVDesc;
+ offscreenSRVDesc.Format = backbufferFormatInfo.srvFormat;
+ offscreenSRVDesc.ViewDimension =
+ (mEGLSamples <= 1) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ offscreenSRVDesc.Texture2D.MostDetailedMip = 0;
+ offscreenSRVDesc.Texture2D.MipLevels = static_cast<UINT>(-1);
+
+ if (offscreenTextureDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE)
+ {
+ result = mRenderer->allocateResource(displayD3D, offscreenSRVDesc, mOffscreenTexture.get(),
+ &mOffscreenSRView);
+ ASSERT(result != angle::Result::Stop);
+ mOffscreenSRView.setDebugName("Offscreen back buffer shader resource");
+ }
+ else
+ {
+ // Special case for external textures that cannot support sampling. Since internally we
+ // assume our SwapChain is always readable, we make a copy texture that is compatible.
+ mNeedsOffscreenTextureCopy = true;
+ }
+
+ if (previousOffscreenTexture.valid())
+ {
+ D3D11_BOX sourceBox = {0};
+ sourceBox.left = 0;
+ sourceBox.right = std::min(previousWidth, backbufferWidth);
+ sourceBox.top = std::max(previousHeight - backbufferHeight, 0);
+ sourceBox.bottom = previousHeight;
+ sourceBox.front = 0;
+ sourceBox.back = 1;
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ const int yoffset = std::max(backbufferHeight - previousHeight, 0);
+ deviceContext->CopySubresourceRegion(mOffscreenTexture.get(), 0, 0, yoffset, 0,
+ previousOffscreenTexture.get(), 0, &sourceBox);
+
+ if (mSwapChain)
+ {
+ swapRect(displayD3D, 0, 0, backbufferWidth, backbufferHeight);
+ }
+ }
+
+ return EGL_SUCCESS;
+}
+
+EGLint SwapChain11::resetOffscreenDepthBuffer(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight)
+{
+ releaseOffscreenDepthBuffer();
+
+ if (mDepthBufferFormat != GL_NONE)
+ {
+ const d3d11::Format &depthBufferFormatInfo =
+ d3d11::Format::Get(mDepthBufferFormat, mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE2D_DESC depthStencilTextureDesc;
+ depthStencilTextureDesc.Width = backbufferWidth;
+ depthStencilTextureDesc.Height = backbufferHeight;
+ depthStencilTextureDesc.Format = depthBufferFormatInfo.texFormat;
+ depthStencilTextureDesc.MipLevels = 1;
+ depthStencilTextureDesc.ArraySize = 1;
+ depthStencilTextureDesc.SampleDesc.Count = getD3DSamples();
+ depthStencilTextureDesc.Usage = D3D11_USAGE_DEFAULT;
+ depthStencilTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
+
+ // If there is a multisampled offscreen color texture, the offscreen depth-stencil texture
+ // must also have the same quality value.
+ if (mOffscreenTexture.valid() && getD3DSamples() > 1)
+ {
+ D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
+ mOffscreenTexture.getDesc(&offscreenTextureDesc);
+ depthStencilTextureDesc.SampleDesc.Quality = offscreenTextureDesc.SampleDesc.Quality;
+ }
+ else
+ {
+ depthStencilTextureDesc.SampleDesc.Quality = 0;
+ }
+
+ // Only create an SRV if it is supported
+ bool depthStencilSRV =
+ depthBufferFormatInfo.srvFormat != DXGI_FORMAT_UNKNOWN &&
+ (mRenderer->getRenderer11DeviceCaps().supportsMultisampledDepthStencilSRVs ||
+ depthStencilTextureDesc.SampleDesc.Count <= 1);
+ if (depthStencilSRV)
+ {
+ depthStencilTextureDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ }
+
+ depthStencilTextureDesc.CPUAccessFlags = 0;
+ depthStencilTextureDesc.MiscFlags = 0;
+
+ angle::Result result = mRenderer->allocateTexture(
+ displayD3D, depthStencilTextureDesc, depthBufferFormatInfo, &mDepthStencilTexture);
+ if (result == angle::Result::Stop)
+ {
+ ERR() << "Could not create depthstencil surface for new swap chain, "
+ << displayD3D->getStoredErrorString();
+ release();
+ return EGL_BAD_ALLOC;
+ }
+ mDepthStencilTexture.setDebugName("Offscreen depth stencil texture");
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilDesc;
+ depthStencilDesc.Format = depthBufferFormatInfo.dsvFormat;
+ depthStencilDesc.ViewDimension =
+ (mEGLSamples <= 1) ? D3D11_DSV_DIMENSION_TEXTURE2D : D3D11_DSV_DIMENSION_TEXTURE2DMS;
+ depthStencilDesc.Flags = 0;
+ depthStencilDesc.Texture2D.MipSlice = 0;
+
+ result = mRenderer->allocateResource(displayD3D, depthStencilDesc,
+ mDepthStencilTexture.get(), &mDepthStencilDSView);
+ ASSERT(result != angle::Result::Stop);
+ mDepthStencilDSView.setDebugName("Offscreen depth stencil view");
+
+ if (depthStencilSRV)
+ {
+ D3D11_SHADER_RESOURCE_VIEW_DESC depthStencilSRVDesc;
+ depthStencilSRVDesc.Format = depthBufferFormatInfo.srvFormat;
+ depthStencilSRVDesc.ViewDimension = (mEGLSamples <= 1)
+ ? D3D11_SRV_DIMENSION_TEXTURE2D
+ : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ depthStencilSRVDesc.Texture2D.MostDetailedMip = 0;
+ depthStencilSRVDesc.Texture2D.MipLevels = static_cast<UINT>(-1);
+
+ result = mRenderer->allocateResource(displayD3D, depthStencilSRVDesc,
+ mDepthStencilTexture.get(), &mDepthStencilSRView);
+ ASSERT(result != angle::Result::Stop);
+ mDepthStencilSRView.setDebugName("Offscreen depth stencil shader resource");
+ }
+ }
+
+ return EGL_SUCCESS;
+}
+
+EGLint SwapChain11::resize(DisplayD3D *displayD3D, EGLint backbufferWidth, EGLint backbufferHeight)
+{
+ ANGLE_TRACE_EVENT0("gpu.angle", "SwapChain11::resize");
+ ID3D11Device *device = mRenderer->getDevice();
+
+ if (device == nullptr)
+ {
+ return EGL_BAD_ACCESS;
+ }
+
+ // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+ if (backbufferWidth < 1 || backbufferHeight < 1)
+ {
+ return EGL_SUCCESS;
+ }
+
+ // Don't resize unnecessarily
+ if (mWidth == backbufferWidth && mHeight == backbufferHeight)
+ {
+ return EGL_SUCCESS;
+ }
+
+ // Can only call resize if we have already created our swap buffer and resources
+ ASSERT(mSwapChain && mBackBufferTexture.valid() && mBackBufferRTView.valid() &&
+ mBackBufferSRView.valid());
+
+ mBackBufferTexture.reset();
+ mBackBufferRTView.reset();
+ mBackBufferSRView.reset();
+
+ // Resize swap chain
+ DXGI_SWAP_CHAIN_DESC desc;
+ HRESULT hr = mSwapChain->GetDesc(&desc);
+ if (FAILED(hr))
+ {
+ ERR() << "Error reading swap chain description, " << gl::FmtHR(hr);
+ release();
+ return EGL_BAD_ALLOC;
+ }
+
+ hr = mSwapChain->ResizeBuffers(desc.BufferCount, backbufferWidth, backbufferHeight,
+ getSwapChainNativeFormat(), 0);
+
+ if (FAILED(hr))
+ {
+ ERR() << "Error resizing swap chain buffers, " << gl::FmtHR(hr);
+ release();
+
+ if (d3d11::isDeviceLostError(hr))
+ {
+ return EGL_CONTEXT_LOST;
+ }
+ else
+ {
+ return EGL_BAD_ALLOC;
+ }
+ }
+
+ ID3D11Texture2D *backbufferTexture = nullptr;
+ hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D),
+ reinterpret_cast<void **>(&backbufferTexture));
+ ASSERT(SUCCEEDED(hr));
+ if (SUCCEEDED(hr))
+ {
+ const auto &format =
+ d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
+ mBackBufferTexture.set(backbufferTexture, format);
+ mBackBufferTexture.setDebugName("Back buffer texture");
+
+ angle::Result result = mRenderer->allocateResourceNoDesc(
+ displayD3D, mBackBufferTexture.get(), &mBackBufferRTView);
+ ASSERT(result != angle::Result::Stop);
+ mBackBufferRTView.setDebugName("Back buffer render target");
+
+ result = mRenderer->allocateResourceNoDesc(displayD3D, mBackBufferTexture.get(),
+ &mBackBufferSRView);
+ ASSERT(result != angle::Result::Stop);
+ mBackBufferSRView.setDebugName("Back buffer shader resource");
+ }
+
+ mFirstSwap = true;
+
+ return resetOffscreenBuffers(displayD3D, backbufferWidth, backbufferHeight);
+}
+
+DXGI_FORMAT SwapChain11::getSwapChainNativeFormat() const
+{
+ // Return a render target format for offscreen rendering is supported by IDXGISwapChain.
+ // MSDN https://msdn.microsoft.com/en-us/library/windows/desktop/bb173064(v=vs.85).aspx
+ switch (mOffscreenRenderTargetFormat)
+ {
+ case GL_RGBA8:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGB8:
+ case GL_RGB565:
+ return DXGI_FORMAT_R8G8B8A8_UNORM;
+
+ case GL_BGRA8_EXT:
+ return DXGI_FORMAT_B8G8R8A8_UNORM;
+
+ case GL_RGB10_A2:
+ return DXGI_FORMAT_R10G10B10A2_UNORM;
+
+ case GL_RGBA16F:
+ return DXGI_FORMAT_R16G16B16A16_FLOAT;
+
+ default:
+ UNREACHABLE();
+ return DXGI_FORMAT_UNKNOWN;
+ }
+}
+
+EGLint SwapChain11::reset(DisplayD3D *displayD3D,
+ EGLint backbufferWidth,
+ EGLint backbufferHeight,
+ EGLint swapInterval)
+{
+ mSwapInterval = static_cast<unsigned int>(swapInterval);
+ if (mSwapInterval > 4)
+ {
+ // IDXGISwapChain::Present documentation states that valid sync intervals are in the [0,4]
+ // range
+ return EGL_BAD_PARAMETER;
+ }
+
+ // If the swap chain already exists, just resize
+ if (mSwapChain != nullptr)
+ {
+ return resize(displayD3D, backbufferWidth, backbufferHeight);
+ }
+
+ ANGLE_TRACE_EVENT0("gpu.angle", "SwapChain11::reset");
+ ID3D11Device *device = mRenderer->getDevice();
+
+ if (device == nullptr)
+ {
+ return EGL_BAD_ACCESS;
+ }
+
+ // Release specific resources to free up memory for the new render target, while the
+ // old render target still exists for the purpose of preserving its contents.
+ SafeRelease(mSwapChain1);
+ SafeRelease(mSwapChain);
+ mBackBufferTexture.reset();
+ mBackBufferRTView.reset();
+
+ // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+ if (backbufferWidth < 1 || backbufferHeight < 1)
+ {
+ releaseOffscreenColorBuffer();
+ return EGL_SUCCESS;
+ }
+
+ if (mNativeWindow->getNativeWindow())
+ {
+ HRESULT hr = mNativeWindow->createSwapChain(
+ device, mRenderer->getDxgiFactory(), getSwapChainNativeFormat(), backbufferWidth,
+ backbufferHeight, mNeedsOffscreenTexture ? 1 : getD3DSamples(), &mSwapChain);
+
+ if (FAILED(hr))
+ {
+ ERR() << "Could not create additional swap chains or offscreen surfaces, "
+ << gl::FmtHR(hr);
+ release();
+
+ if (d3d11::isDeviceLostError(hr))
+ {
+ return EGL_CONTEXT_LOST;
+ }
+ else
+ {
+ return EGL_BAD_ALLOC;
+ }
+ }
+
+ if (mRenderer->getRenderer11DeviceCaps().supportsDXGI1_2)
+ {
+ mSwapChain1 = d3d11::DynamicCastComObject<IDXGISwapChain1>(mSwapChain);
+ }
+
+ ID3D11Texture2D *backbufferTex = nullptr;
+ hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D),
+ reinterpret_cast<LPVOID *>(&backbufferTex));
+ ASSERT(SUCCEEDED(hr));
+ const auto &format =
+ d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
+ mBackBufferTexture.set(backbufferTex, format);
+ mBackBufferTexture.setDebugName("Back buffer texture");
+
+ angle::Result result = mRenderer->allocateResourceNoDesc(
+ displayD3D, mBackBufferTexture.get(), &mBackBufferRTView);
+ ASSERT(result != angle::Result::Stop);
+ mBackBufferRTView.setDebugName("Back buffer render target");
+
+ result = mRenderer->allocateResourceNoDesc(displayD3D, mBackBufferTexture.get(),
+ &mBackBufferSRView);
+ ASSERT(result != angle::Result::Stop);
+ mBackBufferSRView.setDebugName("Back buffer shader resource view");
+ }
+
+ mFirstSwap = true;
+
+ return resetOffscreenBuffers(displayD3D, backbufferWidth, backbufferHeight);
+}
+
+angle::Result SwapChain11::initPassThroughResources(DisplayD3D *displayD3D)
+{
+ if (mPassThroughResourcesInit)
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRACE_EVENT0("gpu.angle", "SwapChain11::initPassThroughResources");
+ ID3D11Device *device = mRenderer->getDevice();
+
+ ASSERT(device != nullptr);
+
+ // Make sure our resources are all not allocated, when we create
+ ASSERT(!mQuadVB.valid() && !mPassThroughSampler.valid());
+ ASSERT(!mPassThroughIL.valid() && !mPassThroughVS.valid() && !mPassThroughOrResolvePS.valid());
+
+ 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;
+
+ ANGLE_TRY(mRenderer->allocateResource(displayD3D, vbDesc, &mQuadVB));
+ mQuadVB.setDebugName("Swap chain quad vertex buffer");
+
+ D3D11_SAMPLER_DESC samplerDesc;
+ samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
+ samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+ samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+ samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+ samplerDesc.MipLODBias = 0.0f;
+ samplerDesc.MaxAnisotropy = 0;
+ samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+ samplerDesc.BorderColor[0] = 0.0f;
+ samplerDesc.BorderColor[1] = 0.0f;
+ samplerDesc.BorderColor[2] = 0.0f;
+ samplerDesc.BorderColor[3] = 0.0f;
+ samplerDesc.MinLOD = 0;
+ samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
+
+ ANGLE_TRY(mRenderer->allocateResource(displayD3D, samplerDesc, &mPassThroughSampler));
+ mPassThroughSampler.setDebugName("Swap chain pass through sampler");
+
+ 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},
+ };
+
+ InputElementArray quadElements(quadLayout);
+ ShaderData vertexShaderData(g_VS_Passthrough2D);
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(displayD3D, quadElements, &vertexShaderData, &mPassThroughIL));
+ mPassThroughIL.setDebugName("Swap chain pass through layout");
+
+ ANGLE_TRY(mRenderer->allocateResource(displayD3D, vertexShaderData, &mPassThroughVS));
+ mPassThroughVS.setDebugName("Swap chain pass through vertex shader");
+
+ if (mEGLSamples <= 1)
+ {
+ ShaderData pixelShaderData(g_PS_PassthroughRGBA2D);
+ ANGLE_TRY(
+ mRenderer->allocateResource(displayD3D, pixelShaderData, &mPassThroughOrResolvePS));
+ }
+ else
+ {
+ if (mNativeWindow->getNativeWindow() && mNeedsOffscreenTexture)
+ {
+ ShaderData pixelShaderData(g_PS_ResolveColor2D);
+ ANGLE_TRY(
+ mRenderer->allocateResource(displayD3D, pixelShaderData, &mPassThroughOrResolvePS));
+ }
+ else
+ {
+ ShaderData pixelShaderData(g_PS_PassthroughRGBA2DMS);
+ ANGLE_TRY(
+ mRenderer->allocateResource(displayD3D, pixelShaderData, &mPassThroughOrResolvePS));
+ }
+ }
+
+ mPassThroughOrResolvePS.setDebugName("Swap chain pass through pixel shader");
+
+ // Use the default rasterizer state but without culling
+ D3D11_RASTERIZER_DESC rasterizerDesc;
+ rasterizerDesc.FillMode = D3D11_FILL_SOLID;
+ rasterizerDesc.CullMode = D3D11_CULL_NONE;
+ rasterizerDesc.FrontCounterClockwise = FALSE;
+ rasterizerDesc.DepthBias = 0;
+ rasterizerDesc.SlopeScaledDepthBias = 0.0f;
+ rasterizerDesc.DepthBiasClamp = 0.0f;
+ rasterizerDesc.DepthClipEnable = TRUE;
+ rasterizerDesc.ScissorEnable = FALSE;
+ rasterizerDesc.MultisampleEnable = FALSE;
+ rasterizerDesc.AntialiasedLineEnable = FALSE;
+
+ ANGLE_TRY(mRenderer->allocateResource(displayD3D, rasterizerDesc, &mPassThroughRS));
+ mPassThroughRS.setDebugName("Swap chain pass through rasterizer state");
+
+ mPassThroughResourcesInit = true;
+ return angle::Result::Continue;
+}
+
+// parameters should be validated/clamped by caller
+EGLint SwapChain11::swapRect(DisplayD3D *displayD3D,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height)
+{
+ if (mNeedsOffscreenTexture)
+ {
+ EGLint result = copyOffscreenToBackbuffer(displayD3D, x, y, width, height);
+ if (result != EGL_SUCCESS)
+ {
+ return result;
+ }
+ }
+
+ EGLint result = present(displayD3D, x, y, width, height);
+ if (result != EGL_SUCCESS)
+ {
+ return result;
+ }
+
+ mRenderer->onSwap();
+
+ return EGL_SUCCESS;
+}
+
+EGLint SwapChain11::copyOffscreenToBackbuffer(DisplayD3D *displayD3D,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height)
+{
+ if (!mSwapChain)
+ {
+ return EGL_SUCCESS;
+ }
+
+ if (initPassThroughResources(displayD3D) == angle::Result::Stop)
+ {
+ return EGL_BAD_ALLOC;
+ }
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // Set vertices
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT result =
+ deviceContext->Map(mQuadVB.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
+ {
+ return EGL_BAD_ACCESS;
+ }
+
+ d3d11::PositionTexCoordVertex *vertices =
+ static_cast<d3d11::PositionTexCoordVertex *>(mappedResource.pData);
+
+ // Create a quad in homogeneous coordinates
+ float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
+ float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
+ float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
+ float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
+
+ float u1 = x / float(mWidth);
+ float v1 = y / float(mHeight);
+ float u2 = (x + width) / float(mWidth);
+ float v2 = (y + height) / float(mHeight);
+
+ // Invert the quad vertices depending on the surface orientation.
+ if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
+ {
+ std::swap(x1, x2);
+ }
+ if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE) != 0)
+ {
+ std::swap(y1, y2);
+ }
+
+ d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, u1, v1);
+ d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, u1, v2);
+ d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, u2, v1);
+ d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, u2, v2);
+
+ deviceContext->Unmap(mQuadVB.get(), 0);
+
+ StateManager11 *stateManager = mRenderer->getStateManager();
+
+ constexpr UINT stride = sizeof(d3d11::PositionTexCoordVertex);
+ stateManager->setSingleVertexBuffer(&mQuadVB, stride, 0);
+
+ // Apply state
+ stateManager->setDepthStencilState(nullptr, 0xFFFFFFFF);
+ stateManager->setSimpleBlendState(nullptr);
+ stateManager->setRasterizerState(&mPassThroughRS);
+
+ // Apply shaders
+ stateManager->setInputLayout(&mPassThroughIL);
+ stateManager->setPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+ stateManager->setDrawShaders(&mPassThroughVS, nullptr, &mPassThroughOrResolvePS);
+
+ // Apply render targets. Use the proxy context in display.
+ stateManager->setRenderTarget(mBackBufferRTView.get(), nullptr);
+
+ // Set the viewport
+ stateManager->setSimpleViewport(mWidth, mHeight);
+
+ // Apply textures
+ stateManager->setSimplePixelTextureAndSampler(mOffscreenSRView, mPassThroughSampler);
+
+ // Draw
+ deviceContext->Draw(4, 0);
+
+ return EGL_SUCCESS;
+}
+
+EGLint SwapChain11::present(DisplayD3D *displayD3D, EGLint x, EGLint y, EGLint width, EGLint height)
+{
+ if (!mSwapChain)
+ {
+ return EGL_SUCCESS;
+ }
+
+ UINT swapInterval = mSwapInterval;
+#if ANGLE_VSYNC == ANGLE_DISABLED
+ swapInterval = 0;
+#endif
+
+ HRESULT result = S_OK;
+
+ // Use IDXGISwapChain1::Present1 with a dirty rect if DXGI 1.2 is available.
+ // Dirty rect present is not supported with a multisampled swapchain.
+ if (mSwapChain1 != nullptr && mEGLSamples <= 1)
+ {
+ if (mFirstSwap)
+ {
+ // Can't swap with a dirty rect if this swap chain has never swapped before
+ DXGI_PRESENT_PARAMETERS params = {0, nullptr, nullptr, nullptr};
+ result = mSwapChain1->Present1(swapInterval, 0, &params);
+ }
+ else
+ {
+ RECT rect = {static_cast<LONG>(x), static_cast<LONG>(mHeight - y - height),
+ static_cast<LONG>(x + width), static_cast<LONG>(mHeight - y)};
+ DXGI_PRESENT_PARAMETERS params = {1, &rect, nullptr, nullptr};
+ result = mSwapChain1->Present1(swapInterval, 0, &params);
+ }
+ }
+ else
+ {
+ result = mSwapChain->Present(swapInterval, 0);
+ }
+
+ mFirstSwap = false;
+
+ // Some swapping mechanisms such as DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL unbind the current render
+ // target. Mark it dirty. Use the proxy context in display since there is none available.
+ mRenderer->getStateManager()->invalidateRenderTarget();
+
+ if (result == DXGI_ERROR_DEVICE_REMOVED)
+ {
+ ERR() << "Present failed: the D3D11 device was removed, "
+ << gl::FmtHR(mRenderer->getDevice()->GetDeviceRemovedReason());
+ return EGL_CONTEXT_LOST;
+ }
+ else if (result == DXGI_ERROR_DEVICE_RESET)
+ {
+ ERR() << "Present failed: the D3D11 device was reset from a bad command.";
+ return EGL_CONTEXT_LOST;
+ }
+ else if (FAILED(result))
+ {
+ ERR() << "Present failed with " << gl::FmtHR(result);
+ }
+
+ mNativeWindow->commitChange();
+
+ return EGL_SUCCESS;
+}
+
+const TextureHelper11 &SwapChain11::getOffscreenTexture()
+{
+ return mNeedsOffscreenTexture ? mOffscreenTexture : mBackBufferTexture;
+}
+
+const d3d11::RenderTargetView &SwapChain11::getRenderTarget()
+{
+ return mNeedsOffscreenTexture ? mOffscreenRTView : mBackBufferRTView;
+}
+
+const d3d11::SharedSRV &SwapChain11::getRenderTargetShaderResource(d3d::Context *context)
+{
+ if (!mNeedsOffscreenTexture)
+ {
+ ASSERT(mBackBufferSRView.valid());
+ return mBackBufferSRView;
+ }
+
+ if (!mNeedsOffscreenTextureCopy)
+ {
+ ASSERT(mOffscreenSRView.valid());
+ return mOffscreenSRView;
+ }
+
+ if (!mOffscreenTextureCopyForSRV.valid())
+ {
+ const d3d11::Format &backbufferFormatInfo =
+ d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE2D_DESC offscreenCopyDesc;
+ mOffscreenTexture.getDesc(&offscreenCopyDesc);
+
+ offscreenCopyDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ offscreenCopyDesc.MiscFlags = 0;
+ offscreenCopyDesc.CPUAccessFlags = 0;
+ angle::Result result = mRenderer->allocateTexture(
+ context, offscreenCopyDesc, backbufferFormatInfo, &mOffscreenTextureCopyForSRV);
+ ASSERT(result != angle::Result::Stop);
+ mOffscreenTextureCopyForSRV.setDebugName("Offscreen back buffer copy for SRV");
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC offscreenSRVDesc;
+ offscreenSRVDesc.Format = backbufferFormatInfo.srvFormat;
+ offscreenSRVDesc.ViewDimension =
+ (mEGLSamples <= 1) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ offscreenSRVDesc.Texture2D.MostDetailedMip = 0;
+ offscreenSRVDesc.Texture2D.MipLevels = static_cast<UINT>(-1);
+
+ result = mRenderer->allocateResource(context, offscreenSRVDesc,
+ mOffscreenTextureCopyForSRV.get(), &mOffscreenSRView);
+ ASSERT(result != angle::Result::Stop);
+ mOffscreenSRView.setDebugName("Offscreen back buffer shader resource");
+ }
+
+ // Need to copy the offscreen texture into the shader-readable copy, since it's external and
+ // we don't know if the copy is up-to-date. This works around the problem we have when the app
+ // passes in a texture that isn't shader-readable.
+ mRenderer->getDeviceContext()->CopyResource(mOffscreenTextureCopyForSRV.get(),
+ mOffscreenTexture.get());
+ return mOffscreenSRView;
+}
+
+const d3d11::DepthStencilView &SwapChain11::getDepthStencil()
+{
+ return mDepthStencilDSView;
+}
+
+const d3d11::SharedSRV &SwapChain11::getDepthStencilShaderResource()
+{
+ return mDepthStencilSRView;
+}
+
+const TextureHelper11 &SwapChain11::getDepthStencilTexture()
+{
+ return mDepthStencilTexture;
+}
+
+void *SwapChain11::getKeyedMutex()
+{
+ return mKeyedMutex;
+}
+
+void SwapChain11::recreate()
+{
+ // possibly should use this method instead of reset
+}
+
+RenderTargetD3D *SwapChain11::getColorRenderTarget()
+{
+ return &mColorRenderTarget;
+}
+
+RenderTargetD3D *SwapChain11::getDepthStencilRenderTarget()
+{
+ return &mDepthStencilRenderTarget;
+}
+
+egl::Error SwapChain11::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
+{
+ if (!mSwapChain)
+ {
+ return egl::EglNotInitialized() << "Swap chain uninitialized";
+ }
+
+ DXGI_FRAME_STATISTICS stats = {};
+ HRESULT result = mSwapChain->GetFrameStatistics(&stats);
+
+ if (FAILED(result))
+ {
+ return egl::EglBadAlloc() << "Failed to get frame statistics, " << gl::FmtHR(result);
+ }
+
+ // Conversion from DXGI_FRAME_STATISTICS to the output values:
+ // stats.SyncRefreshCount -> msc
+ // stats.PresentCount -> sbc
+ // stats.SyncQPCTime -> ust with conversion to microseconds via QueryPerformanceFrequency
+ *msc = stats.SyncRefreshCount;
+ *sbc = stats.PresentCount;
+
+ LONGLONG syncQPCValue = stats.SyncQPCTime.QuadPart;
+ // If the QPC Value is below the overflow threshold, we proceed with
+ // simple multiply and divide.
+ if (syncQPCValue < kQPCOverflowThreshold)
+ {
+ *ust = syncQPCValue * kMicrosecondsPerSecond / mQPCFrequency;
+ }
+ else
+ {
+ // Otherwise, calculate microseconds in a round about manner to avoid
+ // overflow and precision issues.
+ int64_t wholeSeconds = syncQPCValue / mQPCFrequency;
+ int64_t leftoverTicks = syncQPCValue - (wholeSeconds * mQPCFrequency);
+ *ust = wholeSeconds * kMicrosecondsPerSecond +
+ leftoverTicks * kMicrosecondsPerSecond / mQPCFrequency;
+ }
+
+ return egl::NoError();
+}
+
+UINT SwapChain11::getD3DSamples() const
+{
+ return (mEGLSamples == 0) ? 1 : mEGLSamples;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h
new file mode 100644
index 0000000000..c39567c104
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h
@@ -0,0 +1,133 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SwapChain11.h: Defines a back-end specific class for the D3D11 swap chain.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_SWAPCHAIN11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_SWAPCHAIN11_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/renderer/d3d/SwapChainD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+
+namespace rx
+{
+class Renderer11;
+class NativeWindow11;
+
+class SwapChain11 final : public SwapChainD3D
+{
+ public:
+ SwapChain11(Renderer11 *renderer,
+ NativeWindow11 *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation,
+ EGLint samples);
+ ~SwapChain11() override;
+
+ EGLint resize(DisplayD3D *displayD3D, EGLint backbufferWidth, EGLint backbufferHeight) override;
+ EGLint reset(DisplayD3D *displayD3D,
+ EGLint backbufferWidth,
+ EGLint backbufferHeight,
+ EGLint swapInterval) override;
+ EGLint swapRect(DisplayD3D *displayD3D,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height) override;
+ void recreate() override;
+
+ RenderTargetD3D *getColorRenderTarget() override;
+ RenderTargetD3D *getDepthStencilRenderTarget() override;
+
+ const TextureHelper11 &getOffscreenTexture();
+ const d3d11::RenderTargetView &getRenderTarget();
+ const d3d11::SharedSRV &getRenderTargetShaderResource(d3d::Context *context);
+
+ const TextureHelper11 &getDepthStencilTexture();
+ const d3d11::DepthStencilView &getDepthStencil();
+ const d3d11::SharedSRV &getDepthStencilShaderResource();
+
+ EGLint getWidth() const { return mWidth; }
+ EGLint getHeight() const { return mHeight; }
+ void *getKeyedMutex() override;
+ EGLint getSamples() const { return mEGLSamples; }
+
+ egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
+
+ private:
+ void release();
+ angle::Result initPassThroughResources(DisplayD3D *displayD3D);
+
+ void releaseOffscreenColorBuffer();
+ void releaseOffscreenDepthBuffer();
+ EGLint resetOffscreenBuffers(DisplayD3D *displayD3D, int backbufferWidth, int backbufferHeight);
+ EGLint resetOffscreenColorBuffer(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight);
+ EGLint resetOffscreenDepthBuffer(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight);
+
+ DXGI_FORMAT getSwapChainNativeFormat() const;
+
+ EGLint copyOffscreenToBackbuffer(DisplayD3D *displayD3D,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height);
+ EGLint present(DisplayD3D *displayD3D, EGLint x, EGLint y, EGLint width, EGLint height);
+ UINT getD3DSamples() const;
+
+ Renderer11 *mRenderer;
+ EGLint mWidth;
+ EGLint mHeight;
+ const EGLint mOrientation;
+ bool mAppCreatedShareHandle;
+ unsigned int mSwapInterval;
+ bool mPassThroughResourcesInit;
+
+ NativeWindow11 *mNativeWindow; // Handler for the Window that the surface is created for.
+
+ bool mFirstSwap;
+ IDXGISwapChain *mSwapChain;
+ IDXGISwapChain1 *mSwapChain1;
+ IDXGIKeyedMutex *mKeyedMutex;
+
+ TextureHelper11 mBackBufferTexture;
+ d3d11::RenderTargetView mBackBufferRTView;
+ d3d11::SharedSRV mBackBufferSRView;
+
+ const bool mNeedsOffscreenTexture;
+ TextureHelper11 mOffscreenTexture;
+ d3d11::RenderTargetView mOffscreenRTView;
+ d3d11::SharedSRV mOffscreenSRView;
+ bool mNeedsOffscreenTextureCopy;
+ TextureHelper11 mOffscreenTextureCopyForSRV;
+
+ TextureHelper11 mDepthStencilTexture;
+ d3d11::DepthStencilView mDepthStencilDSView;
+ d3d11::SharedSRV mDepthStencilSRView;
+
+ d3d11::Buffer mQuadVB;
+ d3d11::SamplerState mPassThroughSampler;
+ d3d11::InputLayout mPassThroughIL;
+ d3d11::VertexShader mPassThroughVS;
+ d3d11::PixelShader mPassThroughOrResolvePS;
+ d3d11::RasterizerState mPassThroughRS;
+
+ SurfaceRenderTarget11 mColorRenderTarget;
+ SurfaceRenderTarget11 mDepthStencilRenderTarget;
+
+ EGLint mEGLSamples;
+ LONGLONG mQPCFrequency;
+};
+
+} // namespace rx
+#endif // LIBANGLE_RENDERER_D3D_D3D11_SWAPCHAIN11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
new file mode 100644
index 0000000000..ce12f03b34
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -0,0 +1,3680 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage11.cpp: Implements the abstract rx::TextureStorage11 class and its concrete derived
+// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11
+// texture.
+
+#include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h"
+
+#include <tuple>
+
+#include "common/MemoryBuffer.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ImageIndex.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/EGLImageD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/Blit11.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Image11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.h"
+#include "libANGLE/renderer/d3d/d3d11/SwapChain11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+namespace rx
+{
+TextureStorage11::SamplerKey::SamplerKey()
+ : baseLevel(0), mipLevels(0), swizzle(false), dropStencil(false)
+{}
+
+TextureStorage11::SamplerKey::SamplerKey(int baseLevel,
+ int mipLevels,
+ bool swizzle,
+ bool dropStencil)
+ : baseLevel(baseLevel), mipLevels(mipLevels), swizzle(swizzle), dropStencil(dropStencil)
+{}
+
+bool TextureStorage11::SamplerKey::operator<(const SamplerKey &rhs) const
+{
+ return std::tie(baseLevel, mipLevels, swizzle, dropStencil) <
+ std::tie(rhs.baseLevel, rhs.mipLevels, rhs.swizzle, rhs.dropStencil);
+}
+
+TextureStorage11::ImageKey::ImageKey()
+ : level(0), layered(false), layer(0), access(GL_READ_ONLY), format(GL_R32UI)
+{}
+
+TextureStorage11::ImageKey::ImageKey(int level,
+ bool layered,
+ int layer,
+ GLenum access,
+ GLenum format)
+ : level(level), layered(layered), layer(layer), access(access), format(format)
+{}
+
+bool TextureStorage11::ImageKey::operator<(const ImageKey &rhs) const
+{
+ return std::tie(level, layered, layer, access, format) <
+ std::tie(rhs.level, rhs.layered, rhs.layer, rhs.access, rhs.format);
+}
+
+TextureStorage11::TextureStorage11(Renderer11 *renderer,
+ UINT bindFlags,
+ UINT miscFlags,
+ GLenum internalFormat)
+ : mRenderer(renderer),
+ mTopLevel(0),
+ mMipLevels(0),
+ mFormatInfo(d3d11::Format::Get(internalFormat, mRenderer->getRenderer11DeviceCaps())),
+ mTextureWidth(0),
+ mTextureHeight(0),
+ mTextureDepth(0),
+ mDropStencilTexture(),
+ mBindFlags(bindFlags),
+ mMiscFlags(miscFlags)
+{}
+
+TextureStorage11::~TextureStorage11()
+{
+ mSrvCacheForSampler.clear();
+}
+
+DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ bool renderTarget)
+{
+ UINT bindFlags = 0;
+
+ const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
+ if (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ bindFlags |= D3D11_BIND_SHADER_RESOURCE;
+ }
+ if (formatInfo.uavFormat != DXGI_FORMAT_UNKNOWN &&
+ renderer11DeviceCaps.featureLevel >= d3d11_gl::GetMinimumFeatureLevelForES31())
+ {
+ // If we find performance issues later on some specific GPUs, this may be the cause.
+ bindFlags |= D3D11_BIND_UNORDERED_ACCESS;
+ }
+ if (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ bindFlags |= D3D11_BIND_DEPTH_STENCIL;
+ }
+ if (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN && renderTarget)
+ {
+ bindFlags |= D3D11_BIND_RENDER_TARGET;
+ }
+
+ return bindFlags;
+}
+
+DWORD TextureStorage11::GetTextureMiscFlags(GLenum internalFormat,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ bool renderTarget,
+ int levels)
+{
+ UINT miscFlags = 0;
+
+ const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
+ if (renderTarget && levels > 1)
+ {
+ if (d3d11::SupportsMipGen(formatInfo.texFormat, renderer11DeviceCaps.featureLevel))
+ {
+ miscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
+ }
+ }
+
+ return miscFlags;
+}
+
+UINT TextureStorage11::getBindFlags() const
+{
+ return mBindFlags;
+}
+
+UINT TextureStorage11::getMiscFlags() const
+{
+ return mMiscFlags;
+}
+
+int TextureStorage11::getTopLevel() const
+{
+ // Applying top level is meant to be encapsulated inside TextureStorage11.
+ UNREACHABLE();
+ return mTopLevel;
+}
+
+bool TextureStorage11::isRenderTarget() const
+{
+ return (mBindFlags & (D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL)) != 0;
+}
+
+bool TextureStorage11::isManaged() const
+{
+ return false;
+}
+
+bool TextureStorage11::supportsNativeMipmapFunction() const
+{
+ return (mMiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS) != 0;
+}
+
+int TextureStorage11::getLevelCount() const
+{
+ return mMipLevels - mTopLevel;
+}
+
+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);
+}
+
+angle::Result TextureStorage11::getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ return getResource(context, outResource);
+}
+
+angle::Result TextureStorage11::getSubresourceIndex(const gl::Context *context,
+ const gl::ImageIndex &index,
+ UINT *outSubresourceIndex) const
+{
+ UINT mipSlice = static_cast<UINT>(index.getLevelIndex() + mTopLevel);
+ UINT arraySlice = static_cast<UINT>(index.hasLayer() ? index.getLayerIndex() : 0);
+ UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels);
+ ASSERT(subresource != std::numeric_limits<UINT>::max());
+ *outSubresourceIndex = subresource;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getSRVForSampler(const gl::Context *context,
+ const gl::TextureState &textureState,
+ const gl::SamplerState &sampler,
+ const d3d11::SharedSRV **outSRV)
+{
+ // Make sure to add the level offset for our tiny compressed texture workaround
+ const GLuint effectiveBaseLevel = textureState.getEffectiveBaseLevel();
+ const bool swizzleRequired = textureState.swizzleRequired();
+ const bool mipmapping = gl::IsMipmapFiltered(sampler);
+ unsigned int mipLevels =
+ mipmapping ? (textureState.getEffectiveMaxLevel() - effectiveBaseLevel + 1) : 1;
+
+ // Make sure there's 'mipLevels' mipmap levels below the base level (offset by the top level,
+ // which corresponds to GL level 0)
+ mipLevels = std::min(mipLevels, mMipLevels - mTopLevel - effectiveBaseLevel);
+
+ if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ ASSERT(!swizzleRequired);
+ ASSERT(mipLevels == 1 || mipLevels == mMipLevels);
+ }
+
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ // We must ensure that the level zero texture is in sync with mipped texture.
+ ANGLE_TRY(useLevelZeroWorkaroundTexture(context, mipLevels == 1));
+ }
+
+ if (swizzleRequired)
+ {
+ verifySwizzleExists(textureState.getSwizzleState());
+ }
+
+ // We drop the stencil when sampling from the SRV if three conditions hold:
+ // 1. the drop stencil workaround is enabled.
+ const bool emulateTinyStencilTextures =
+ mRenderer->getFeatures().emulateTinyStencilTextures.enabled;
+ // 2. this is a stencil texture.
+ const bool hasStencil = (mFormatInfo.format().stencilBits > 0);
+ // 3. the texture has a 1x1 or 2x2 mip.
+ const int effectiveTopLevel = effectiveBaseLevel + mipLevels - 1;
+ const bool hasSmallMips =
+ (getLevelWidth(effectiveTopLevel) <= 2 || getLevelHeight(effectiveTopLevel) <= 2);
+
+ const bool useDropStencil = (emulateTinyStencilTextures && hasStencil && hasSmallMips);
+ const SamplerKey key(effectiveBaseLevel, mipLevels, swizzleRequired, useDropStencil);
+ if (useDropStencil)
+ {
+ // Ensure drop texture gets created.
+ DropStencil result = DropStencil::CREATED;
+ ANGLE_TRY(ensureDropStencilTexture(context, &result));
+
+ // Clear the SRV cache if necessary.
+ // TODO(jmadill): Re-use find query result.
+ const auto srvEntry = mSrvCacheForSampler.find(key);
+ if (result == DropStencil::CREATED && srvEntry != mSrvCacheForSampler.end())
+ {
+ mSrvCacheForSampler.erase(key);
+ }
+ }
+
+ ANGLE_TRY(getCachedOrCreateSRVForSampler(context, key, outSRV));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getCachedOrCreateSRVForSampler(const gl::Context *context,
+ const SamplerKey &key,
+ const d3d11::SharedSRV **outSRV)
+{
+ auto iter = mSrvCacheForSampler.find(key);
+ if (iter != mSrvCacheForSampler.end())
+ {
+ *outSRV = &iter->second;
+ return angle::Result::Continue;
+ }
+
+ const TextureHelper11 *texture = nullptr;
+ DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
+
+ if (key.swizzle)
+ {
+ const auto &swizzleFormat =
+ mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps());
+ ASSERT(!key.dropStencil || swizzleFormat.format().stencilBits == 0);
+ ANGLE_TRY(getSwizzleTexture(context, &texture));
+ format = swizzleFormat.srvFormat;
+ }
+ else if (key.dropStencil)
+ {
+ ASSERT(mDropStencilTexture.valid());
+ texture = &mDropStencilTexture;
+ format = DXGI_FORMAT_R32_FLOAT;
+ }
+ else
+ {
+ ANGLE_TRY(getResource(context, &texture));
+ format = mFormatInfo.srvFormat;
+ }
+
+ d3d11::SharedSRV srv;
+
+ ANGLE_TRY(createSRVForSampler(context, key.baseLevel, key.mipLevels, format, *texture, &srv));
+
+ const auto &insertIt = mSrvCacheForSampler.insert(std::make_pair(key, std::move(srv)));
+ *outSRV = &insertIt.first->second;
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getSRVLevel(const gl::Context *context,
+ int mipLevel,
+ bool blitSRV,
+ const d3d11::SharedSRV **outSRV)
+{
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+
+ auto &levelSRVs = (blitSRV) ? mLevelBlitSRVs : mLevelSRVs;
+ auto &otherLevelSRVs = (blitSRV) ? mLevelSRVs : mLevelBlitSRVs;
+
+ if (!levelSRVs[mipLevel].valid())
+ {
+ // Only create a different SRV for blit if blit format is different from regular srv format
+ if (otherLevelSRVs[mipLevel].valid() && mFormatInfo.srvFormat == mFormatInfo.blitSRVFormat)
+ {
+ levelSRVs[mipLevel] = otherLevelSRVs[mipLevel].makeCopy();
+ }
+ else
+ {
+ const TextureHelper11 *resource = nullptr;
+ ANGLE_TRY(getResource(context, &resource));
+
+ DXGI_FORMAT resourceFormat =
+ blitSRV ? mFormatInfo.blitSRVFormat : mFormatInfo.srvFormat;
+ ANGLE_TRY(createSRVForSampler(context, mipLevel, 1, resourceFormat, *resource,
+ &levelSRVs[mipLevel]));
+ }
+ }
+
+ *outSRV = &levelSRVs[mipLevel];
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getSRVLevels(const gl::Context *context,
+ GLint baseLevel,
+ GLint maxLevel,
+ const d3d11::SharedSRV **outSRV)
+{
+ unsigned int mipLevels = maxLevel - baseLevel + 1;
+
+ // Make sure there's 'mipLevels' mipmap levels below the base level (offset by the top level,
+ // which corresponds to GL level 0)
+ mipLevels = std::min(mipLevels, mMipLevels - mTopLevel - baseLevel);
+
+ if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ ASSERT(mipLevels == 1 || mipLevels == mMipLevels);
+ }
+
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ // We must ensure that the level zero texture is in sync with mipped texture.
+ ANGLE_TRY(useLevelZeroWorkaroundTexture(context, mipLevels == 1));
+ }
+
+ // TODO(jmadill): Assert we don't need to drop stencil.
+
+ SamplerKey key(baseLevel, mipLevels, false, false);
+ ANGLE_TRY(getCachedOrCreateSRVForSampler(context, key, outSRV));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getSRVForImage(const gl::Context *context,
+ const gl::ImageUnit &imageUnit,
+ const d3d11::SharedSRV **outSRV)
+{
+ // TODO(Xinghua.cao@intel.com): Add solution to handle swizzle required.
+ ImageKey key(imageUnit.level, imageUnit.layered, imageUnit.layer, imageUnit.access,
+ imageUnit.format);
+ ANGLE_TRY(getCachedOrCreateSRVForImage(context, key, outSRV));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getCachedOrCreateSRVForImage(const gl::Context *context,
+ const ImageKey &key,
+ const d3d11::SharedSRV **outSRV)
+{
+ auto iter = mSrvCacheForImage.find(key);
+ if (iter != mSrvCacheForImage.end())
+ {
+ *outSRV = &iter->second;
+ return angle::Result::Continue;
+ }
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+ DXGI_FORMAT format =
+ d3d11::Format::Get(key.format, mRenderer->getRenderer11DeviceCaps()).srvFormat;
+ d3d11::SharedSRV srv;
+ ANGLE_TRY(createSRVForImage(context, key.level, format, *texture, &srv));
+ const auto &insertIt = mSrvCacheForImage.insert(std::make_pair(key, std::move(srv)));
+ *outSRV = &insertIt.first->second;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getUAVForImage(const gl::Context *context,
+ const gl::ImageUnit &imageUnit,
+ const d3d11::SharedUAV **outUAV)
+{
+ // TODO(Xinghua.cao@intel.com): Add solution to handle swizzle required.
+ ImageKey key(imageUnit.level, imageUnit.layered, imageUnit.layer, imageUnit.access,
+ imageUnit.format);
+ ANGLE_TRY(getCachedOrCreateUAVForImage(context, key, outUAV));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::getCachedOrCreateUAVForImage(const gl::Context *context,
+ const ImageKey &key,
+ const d3d11::SharedUAV **outUAV)
+{
+ auto iter = mUavCacheForImage.find(key);
+ if (iter != mUavCacheForImage.end())
+ {
+ *outUAV = &iter->second;
+ return angle::Result::Continue;
+ }
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+ DXGI_FORMAT format =
+ d3d11::Format::Get(key.format, mRenderer->getRenderer11DeviceCaps()).uavFormat;
+ d3d11::SharedUAV uav;
+ ANGLE_TRY(createUAVForImage(context, key.level, format, *texture, &uav));
+ const auto &insertIt = mUavCacheForImage.insert(std::make_pair(key, std::move(uav)));
+ *outUAV = &insertIt.first->second;
+ return angle::Result::Continue;
+}
+
+const d3d11::Format &TextureStorage11::getFormatSet() const
+{
+ return mFormatInfo;
+}
+
+angle::Result TextureStorage11::generateSwizzles(const gl::Context *context,
+ const gl::SwizzleState &swizzleTarget)
+{
+ for (int level = 0; level < getLevelCount(); level++)
+ {
+ // Check if the swizzle for this level is out of date
+ if (mSwizzleCache[level] != swizzleTarget)
+ {
+ // Need to re-render the swizzle for this level
+ const d3d11::SharedSRV *sourceSRV = nullptr;
+ ANGLE_TRY(getSRVLevel(context, level, true, &sourceSRV));
+
+ const d3d11::RenderTargetView *destRTV;
+ ANGLE_TRY(getSwizzleRenderTarget(context, level, &destRTV));
+
+ gl::Extents size(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+
+ Blit11 *blitter = mRenderer->getBlitter();
+
+ ANGLE_TRY(blitter->swizzleTexture(context, *sourceSRV, *destRTV, size, swizzleTarget));
+
+ mSwizzleCache[level] = swizzleTarget;
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+void TextureStorage11::markLevelDirty(int mipLevel)
+{
+ if (mipLevel >= 0 && static_cast<size_t>(mipLevel) < mSwizzleCache.size())
+ {
+ // The default constructor of SwizzleState has GL_INVALID_INDEX for all channels which is
+ // not a valid swizzle combination
+ if (mSwizzleCache[mipLevel] != gl::SwizzleState())
+ {
+ // TODO(jmadill): Invalidate specific swizzle.
+ mRenderer->getStateManager()->invalidateSwizzles();
+ mSwizzleCache[mipLevel] = gl::SwizzleState();
+ }
+ }
+
+ if (mDropStencilTexture.valid())
+ {
+ mDropStencilTexture.reset();
+ }
+}
+
+void TextureStorage11::markDirty()
+{
+ for (size_t mipLevel = 0; mipLevel < mSwizzleCache.size(); ++mipLevel)
+ {
+ markLevelDirty(static_cast<int>(mipLevel));
+ }
+}
+
+angle::Result TextureStorage11::updateSubresourceLevel(const gl::Context *context,
+ const TextureHelper11 &srcTexture,
+ unsigned int sourceSubresource,
+ const gl::ImageIndex &index,
+ const gl::Box &copyArea)
+{
+ ASSERT(srcTexture.valid());
+
+ const GLint level = index.getLevelIndex();
+
+ markLevelDirty(level);
+
+ gl::Extents texSize(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+
+ bool fullCopy = copyArea.x == 0 && copyArea.y == 0 && copyArea.z == 0 &&
+ copyArea.width == texSize.width && copyArea.height == texSize.height &&
+ copyArea.depth == texSize.depth;
+
+ const TextureHelper11 *dstTexture = nullptr;
+
+ // If the zero-LOD workaround is active and we want to update a level greater than zero, then we
+ // should update the mipmapped texture, even if mapmaps are currently disabled.
+ if (level > 0 && mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ANGLE_TRY(getMippedResource(context, &dstTexture));
+ }
+ else
+ {
+ ANGLE_TRY(getResource(context, &dstTexture));
+ }
+
+ unsigned int dstSubresource = 0;
+ ANGLE_TRY(getSubresourceIndex(context, index, &dstSubresource));
+
+ ASSERT(dstTexture->valid());
+
+ const d3d11::DXGIFormatSize &dxgiFormatSizeInfo =
+ d3d11::GetDXGIFormatSizeInfo(mFormatInfo.texFormat);
+ if (!fullCopy && mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ // CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
+ Blit11 *blitter = mRenderer->getBlitter();
+ return blitter->copyDepthStencil(context, srcTexture, sourceSubresource, copyArea, texSize,
+ *dstTexture, dstSubresource, copyArea, texSize, nullptr);
+ }
+
+ D3D11_BOX srcBox;
+ srcBox.left = copyArea.x;
+ srcBox.top = copyArea.y;
+ srcBox.right =
+ copyArea.x + roundUp(static_cast<UINT>(copyArea.width), dxgiFormatSizeInfo.blockWidth);
+ srcBox.bottom =
+ copyArea.y + roundUp(static_cast<UINT>(copyArea.height), dxgiFormatSizeInfo.blockHeight);
+ srcBox.front = copyArea.z;
+ srcBox.back = copyArea.z + copyArea.depth;
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ deviceContext->CopySubresourceRegion(dstTexture->get(), dstSubresource, copyArea.x, copyArea.y,
+ copyArea.z, srcTexture.get(), sourceSubresource,
+ fullCopy ? nullptr : &srcBox);
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::copySubresourceLevel(const gl::Context *context,
+ const TextureHelper11 &dstTexture,
+ unsigned int dstSubresource,
+ const gl::ImageIndex &index,
+ const gl::Box &region)
+{
+ ASSERT(dstTexture.valid());
+
+ const TextureHelper11 *srcTexture = nullptr;
+
+ // If the zero-LOD workaround is active and we want to update a level greater than zero, then we
+ // should update the mipmapped texture, even if mapmaps are currently disabled.
+ if (index.getLevelIndex() > 0 && mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ANGLE_TRY(getMippedResource(context, &srcTexture));
+ }
+ else
+ {
+ ANGLE_TRY(getResource(context, &srcTexture));
+ }
+
+ ASSERT(srcTexture->valid());
+
+ unsigned int srcSubresource = 0;
+ ANGLE_TRY(getSubresourceIndex(context, index, &srcSubresource));
+
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ // D3D11 can't perform partial CopySubresourceRegion on depth/stencil textures, so pSrcBox
+ // should be nullptr.
+ D3D11_BOX srcBox;
+ D3D11_BOX *pSrcBox = nullptr;
+ if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ GLsizei width = region.width;
+ GLsizei height = region.height;
+ d3d11::MakeValidSize(false, mFormatInfo.texFormat, &width, &height, nullptr);
+
+ // Keep srcbox as nullptr if we're dealing with tiny mips of compressed textures.
+ if (width == region.width && height == region.height)
+ {
+ // However, D3D10Level9 doesn't always perform CopySubresourceRegion correctly unless
+ // the source box is specified. This is okay, since we don't perform
+ // CopySubresourceRegion on depth/stencil textures on 9_3.
+ ASSERT(mFormatInfo.dsvFormat == DXGI_FORMAT_UNKNOWN);
+ srcBox.left = region.x;
+ srcBox.right = region.x + region.width;
+ srcBox.top = region.y;
+ srcBox.bottom = region.y + region.height;
+ srcBox.front = region.z;
+ srcBox.back = region.z + region.depth;
+ pSrcBox = &srcBox;
+ }
+ }
+
+ deviceContext->CopySubresourceRegion(dstTexture.get(), dstSubresource, region.x, region.y,
+ region.z, srcTexture->get(), srcSubresource, pSrcBox);
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex)
+{
+ ASSERT(sourceIndex.getLayerIndex() == destIndex.getLayerIndex());
+
+ markLevelDirty(destIndex.getLevelIndex());
+
+ RenderTargetD3D *source = nullptr;
+ ANGLE_TRY(getRenderTarget(context, sourceIndex, &source));
+
+ RenderTargetD3D *dest = nullptr;
+ ANGLE_TRY(getRenderTarget(context, destIndex, &dest));
+
+ RenderTarget11 *rt11 = GetAs<RenderTarget11>(source);
+ const d3d11::SharedSRV &sourceSRV = rt11->getBlitShaderResourceView(context);
+ const d3d11::RenderTargetView &destRTV = rt11->getRenderTargetView();
+
+ gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth());
+ gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth());
+
+ gl::Box destArea(0, 0, 0, dest->getWidth(), dest->getHeight(), dest->getDepth());
+ gl::Extents destSize(dest->getWidth(), dest->getHeight(), dest->getDepth());
+
+ Blit11 *blitter = mRenderer->getBlitter();
+ const gl::InternalFormat &sourceInternalFormat =
+ gl::GetSizedInternalFormatInfo(source->getInternalFormat());
+ GLenum format = sourceInternalFormat.format;
+ GLenum type = sourceInternalFormat.type;
+ return blitter->copyTexture(context, sourceSRV, sourceArea, sourceSize, format, destRTV,
+ destArea, destSize, nullptr, format, type, GL_LINEAR, false, false,
+ false);
+}
+
+void TextureStorage11::verifySwizzleExists(const gl::SwizzleState &swizzleState)
+{
+ for (unsigned int level = 0; level < mMipLevels; level++)
+ {
+ ASSERT(mSwizzleCache[level] == swizzleState);
+ }
+}
+
+void TextureStorage11::clearSRVCache()
+{
+ markDirty();
+ mSrvCacheForSampler.clear();
+
+ for (size_t level = 0; level < mLevelSRVs.size(); level++)
+ {
+ mLevelSRVs[level].reset();
+ mLevelBlitSRVs[level].reset();
+ }
+}
+
+angle::Result TextureStorage11::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ASSERT(destStorage);
+
+ const TextureHelper11 *sourceResouce = nullptr;
+ ANGLE_TRY(getResource(context, &sourceResouce));
+
+ TextureStorage11 *dest11 = GetAs<TextureStorage11>(destStorage);
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
+ immediateContext->CopyResource(destResource->get(), sourceResouce->get());
+
+ dest11->markDirty();
+
+ return angle::Result::Continue;
+}
+
+void TextureStorage11::invalidateTextures()
+{
+ mRenderer->getStateManager()->invalidateTexturesAndSamplers();
+}
+
+angle::Result TextureStorage11::setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData)
+{
+ ASSERT(!image->isDirty());
+
+ markLevelDirty(index.getLevelIndex());
+
+ const TextureHelper11 *resource = nullptr;
+ ANGLE_TRY(getResource(context, &resource));
+ ASSERT(resource && resource->valid());
+
+ UINT destSubresource = 0;
+ ANGLE_TRY(getSubresourceIndex(context, index, &destSubresource));
+
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetInternalFormatInfo(image->getInternalFormat(), type);
+
+ gl::Box levelBox(0, 0, 0, getLevelWidth(index.getLevelIndex()),
+ getLevelHeight(index.getLevelIndex()), getLevelDepth(index.getLevelIndex()));
+ bool fullUpdate = (destBox == nullptr || *destBox == levelBox);
+ ASSERT(internalFormatInfo.depthBits == 0 || fullUpdate);
+
+ // TODO(jmadill): Handle compressed formats
+ // Compressed formats have different load syntax, so we'll have to handle them with slightly
+ // different logic. Will implemnent this in a follow-up patch, and ensure we do not use SetData
+ // with compressed formats in the calling logic.
+ ASSERT(!internalFormatInfo.compressed);
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ const int width = destBox ? destBox->width : static_cast<int>(image->getWidth());
+ const int height = destBox ? destBox->height : static_cast<int>(image->getHeight());
+ const int depth = destBox ? destBox->depth : static_cast<int>(image->getDepth());
+ GLuint srcRowPitch = 0;
+ ANGLE_CHECK_GL_MATH(context11,
+ internalFormatInfo.computeRowPitch(type, width, unpack.alignment,
+ unpack.rowLength, &srcRowPitch));
+ GLuint srcDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(context11, internalFormatInfo.computeDepthPitch(
+ height, unpack.imageHeight, srcRowPitch, &srcDepthPitch));
+ GLuint srcSkipBytes = 0;
+ ANGLE_CHECK_GL_MATH(
+ context11, internalFormatInfo.computeSkipBytes(type, srcRowPitch, srcDepthPitch, unpack,
+ index.usesTex3D(), &srcSkipBytes));
+
+ const d3d11::Format &d3d11Format =
+ d3d11::Format::Get(image->getInternalFormat(), mRenderer->getRenderer11DeviceCaps());
+ const d3d11::DXGIFormatSize &dxgiFormatInfo =
+ d3d11::GetDXGIFormatSizeInfo(d3d11Format.texFormat);
+
+ const size_t outputPixelSize = dxgiFormatInfo.pixelBytes;
+
+ UINT bufferRowPitch = static_cast<unsigned int>(outputPixelSize) * width;
+ UINT bufferDepthPitch = bufferRowPitch * height;
+
+ const size_t neededSize = bufferDepthPitch * depth;
+ angle::MemoryBuffer *conversionBuffer = nullptr;
+ const uint8_t *data = nullptr;
+
+ LoadImageFunctionInfo loadFunctionInfo = d3d11Format.getLoadFunctions()(type);
+ if (loadFunctionInfo.requiresConversion)
+ {
+ ANGLE_TRY(mRenderer->getScratchMemoryBuffer(context11, neededSize, &conversionBuffer));
+ loadFunctionInfo.loadFunction(width, height, depth, pixelData + srcSkipBytes, srcRowPitch,
+ srcDepthPitch, conversionBuffer->data(), bufferRowPitch,
+ bufferDepthPitch);
+ data = conversionBuffer->data();
+ }
+ else
+ {
+ data = pixelData + srcSkipBytes;
+ bufferRowPitch = srcRowPitch;
+ bufferDepthPitch = srcDepthPitch;
+ }
+
+ ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
+
+ if (!fullUpdate)
+ {
+ ASSERT(destBox);
+
+ D3D11_BOX destD3DBox;
+ destD3DBox.left = destBox->x;
+ destD3DBox.right = destBox->x + destBox->width;
+ destD3DBox.top = destBox->y;
+ destD3DBox.bottom = destBox->y + destBox->height;
+ destD3DBox.front = destBox->z;
+ destD3DBox.back = destBox->z + destBox->depth;
+
+ immediateContext->UpdateSubresource(resource->get(), destSubresource, &destD3DBox, data,
+ bufferRowPitch, bufferDepthPitch);
+ }
+ else
+ {
+ immediateContext->UpdateSubresource(resource->get(), destSubresource, nullptr, data,
+ bufferRowPitch, bufferDepthPitch);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11::ensureDropStencilTexture(
+ const gl::Context *context,
+ TextureStorage11::DropStencil *dropStencilOut)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11::initDropStencilTexture(const gl::Context *context,
+ const gl::ImageIndexIterator &it)
+{
+ const TextureHelper11 *sourceTexture = nullptr;
+ ANGLE_TRY(getResource(context, &sourceTexture));
+
+ gl::ImageIndexIterator itCopy = it;
+
+ while (itCopy.hasNext())
+ {
+ gl::ImageIndex index = itCopy.next();
+ gl::Box wholeArea(0, 0, 0, getLevelWidth(index.getLevelIndex()),
+ getLevelHeight(index.getLevelIndex()), 1);
+ gl::Extents wholeSize(wholeArea.width, wholeArea.height, 1);
+
+ UINT subresource = 0;
+ ANGLE_TRY(getSubresourceIndex(context, index, &subresource));
+
+ ANGLE_TRY(mRenderer->getBlitter()->copyDepthStencil(
+ context, *sourceTexture, subresource, wholeArea, wholeSize, mDropStencilTexture,
+ subresource, wholeArea, wholeSize, nullptr));
+ }
+
+ return angle::Result::Continue;
+}
+
+TextureStorage11_2D::TextureStorage11_2D(Renderer11 *renderer, SwapChain11 *swapchain)
+ : TextureStorage11(renderer,
+ D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE,
+ 0,
+ swapchain->getRenderTargetInternalFormat()),
+ mTexture(swapchain->getOffscreenTexture()),
+ mLevelZeroTexture(),
+ mLevelZeroRenderTarget(nullptr),
+ mUseLevelZeroTexture(false),
+ mSwizzleTexture()
+{
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mAssociatedImages[i] = nullptr;
+ mRenderTarget[i] = nullptr;
+ }
+
+ D3D11_TEXTURE2D_DESC texDesc;
+ mTexture.getDesc(&texDesc);
+ mMipLevels = texDesc.MipLevels;
+ mTextureWidth = texDesc.Width;
+ mTextureHeight = texDesc.Height;
+ mTextureDepth = 1;
+ mHasKeyedMutex = (texDesc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0;
+}
+
+TextureStorage11_2D::TextureStorage11_2D(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ bool hintLevelZeroOnly)
+ : TextureStorage11(
+ renderer,
+ GetTextureBindFlags(internalformat, renderer->getRenderer11DeviceCaps(), renderTarget),
+ GetTextureMiscFlags(internalformat,
+ renderer->getRenderer11DeviceCaps(),
+ renderTarget,
+ levels),
+ internalformat),
+ mTexture(),
+ mHasKeyedMutex(false),
+ mLevelZeroTexture(),
+ mLevelZeroRenderTarget(nullptr),
+ mUseLevelZeroTexture(hintLevelZeroOnly && levels > 1),
+ mSwizzleTexture()
+{
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mAssociatedImages[i] = nullptr;
+ mRenderTarget[i] = nullptr;
+ }
+
+ d3d11::MakeValidSize(false, mFormatInfo.texFormat, &width, &height, &mTopLevel);
+ mMipLevels = mTopLevel + levels;
+ mTextureWidth = width;
+ mTextureHeight = height;
+ mTextureDepth = 1;
+
+ // The LevelZeroOnly hint should only be true if the zero max LOD workaround is active.
+ ASSERT(!mUseLevelZeroTexture || mRenderer->getFeatures().zeroMaxLodWorkaround.enabled);
+}
+
+angle::Result TextureStorage11_2D::onDestroy(const gl::Context *context)
+{
+ for (unsigned i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ if (mAssociatedImages[i] != nullptr)
+ {
+ mAssociatedImages[i]->verifyAssociatedStorageValid(this);
+
+ // We must let the Images recover their data before we delete it from the
+ // TextureStorage.
+ ANGLE_TRY(mAssociatedImages[i]->recoverFromAssociatedStorage(context));
+ }
+ }
+
+ if (mHasKeyedMutex)
+ {
+ // If the keyed mutex is released that will unbind it and cause the state cache to become
+ // desynchronized.
+ mRenderer->getStateManager()->invalidateBoundViews();
+ }
+
+ return angle::Result::Continue;
+}
+
+TextureStorage11_2D::~TextureStorage11_2D() {}
+
+angle::Result TextureStorage11_2D::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ASSERT(destStorage);
+
+ TextureStorage11_2D *dest11 = GetAs<TextureStorage11_2D>(destStorage);
+ ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
+
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ // If either mTexture or mLevelZeroTexture exist, then we need to copy them into the
+ // corresponding textures in destStorage.
+ if (mTexture.valid())
+ {
+ ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(context, false));
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ immediateContext->CopyResource(destResource->get(), mTexture.get());
+ }
+
+ if (mLevelZeroTexture.valid())
+ {
+ ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(context, true));
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ immediateContext->CopyResource(destResource->get(), mLevelZeroTexture.get());
+ }
+
+ return angle::Result::Continue;
+ }
+
+ const TextureHelper11 *sourceResouce = nullptr;
+ ANGLE_TRY(getResource(context, &sourceResouce));
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ immediateContext->CopyResource(destResource->get(), sourceResouce->get());
+ dest11->markDirty();
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture)
+{
+ if (useLevelZeroTexture && mMipLevels > 1)
+ {
+ if (!mUseLevelZeroTexture && mTexture.valid())
+ {
+ ANGLE_TRY(ensureTextureExists(context, 1));
+
+ // Pull data back from the mipped texture if necessary.
+ ASSERT(mLevelZeroTexture.valid());
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->CopySubresourceRegion(mLevelZeroTexture.get(), 0, 0, 0, 0,
+ mTexture.get(), 0, nullptr);
+ }
+
+ mUseLevelZeroTexture = true;
+ }
+ else
+ {
+ if (mUseLevelZeroTexture && mLevelZeroTexture.valid())
+ {
+ ANGLE_TRY(ensureTextureExists(context, mMipLevels));
+
+ // Pull data back from the level zero texture if necessary.
+ ASSERT(mTexture.valid());
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ deviceContext->CopySubresourceRegion(mTexture.get(), 0, 0, 0, 0,
+ mLevelZeroTexture.get(), 0, nullptr);
+ }
+
+ mUseLevelZeroTexture = false;
+ }
+
+ return angle::Result::Continue;
+}
+
+void TextureStorage11_2D::associateImage(Image11 *image, const gl::ImageIndex &index)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ mAssociatedImages[level] = image;
+ }
+}
+
+void TextureStorage11_2D::verifyAssociatedImageValid(const gl::ImageIndex &index,
+ Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ // This validation check should never return false. It means the Image/TextureStorage
+ // association is broken.
+ ASSERT(mAssociatedImages[level] == expectedImage);
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_2D::disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(mAssociatedImages[level] == expectedImage);
+ mAssociatedImages[level] = nullptr;
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
+// recover its data before ending the association.
+angle::Result TextureStorage11_2D::releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+ if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ // No need to let the old Image recover its data, if it is also the incoming Image.
+ if (mAssociatedImages[level] != nullptr && mAssociatedImages[level] != incomingImage)
+ {
+ // Ensure that the Image is still associated with this TextureStorage.
+ mAssociatedImages[level]->verifyAssociatedStorageValid(this);
+
+ // Force the image to recover from storage before its data is overwritten.
+ // This will reset mAssociatedImages[level] to nullptr too.
+ ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ if (mUseLevelZeroTexture && mMipLevels > 1)
+ {
+ ANGLE_TRY(ensureTextureExists(context, 1));
+
+ *outResource = &mLevelZeroTexture;
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRY(ensureTextureExists(context, mMipLevels));
+
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ // This shouldn't be called unless the zero max LOD workaround is active.
+ ASSERT(mRenderer->getFeatures().zeroMaxLodWorkaround.enabled);
+
+ ANGLE_TRY(ensureTextureExists(context, mMipLevels));
+
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::ensureTextureExists(const gl::Context *context, int mipLevels)
+{
+ // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture.
+ bool useLevelZeroTexture = mRenderer->getFeatures().zeroMaxLodWorkaround.enabled
+ ? (mipLevels == 1) && (mMipLevels > 1)
+ : false;
+ TextureHelper11 *outputTexture = useLevelZeroTexture ? &mLevelZeroTexture : &mTexture;
+
+ // if the width or height is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (!outputTexture->valid() && mTextureWidth > 0 && mTextureHeight > 0)
+ {
+ ASSERT(mipLevels > 0);
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth; // Compressed texture size constraints?
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mipLevels;
+ desc.ArraySize = 1;
+ desc.Format = mFormatInfo.texFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = getMiscFlags();
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
+ outputTexture));
+
+ if (useLevelZeroTexture)
+ {
+ outputTexture->setDebugName("TexStorage2D.Level0Texture");
+ }
+ else
+ {
+ outputTexture->setDebugName("TexStorage2D.Texture");
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(!index.hasLayer());
+
+ const int level = index.getLevelIndex();
+ ASSERT(level >= 0 && level < getLevelCount());
+
+ // In GL ES 2.0, the application can only render to level zero of the texture (Section 4.4.3 of
+ // the GLES 2.0 spec, page 113 of version 2.0.25). Other parts of TextureStorage11_2D could
+ // create RTVs on non-zero levels of the texture (e.g. generateMipmap).
+ // On Feature Level 9_3, this is unlikely to be useful. The renderer can't create SRVs on the
+ // individual levels of the texture, so methods like generateMipmap can't do anything useful
+ // with non-zero-level RTVs. Therefore if level > 0 on 9_3 then there's almost certainly
+ // something wrong.
+ ASSERT(
+ !(mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3 && level > 0));
+ ASSERT(outRT);
+ if (mRenderTarget[level])
+ {
+ *outRT = mRenderTarget[level].get();
+ return angle::Result::Continue;
+ }
+
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ASSERT(level == 0);
+ ANGLE_TRY(useLevelZeroWorkaroundTexture(context, true));
+ }
+
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+
+ const d3d11::SharedSRV *srv = nullptr;
+ ANGLE_TRY(getSRVLevel(context, level, false, &srv));
+
+ const d3d11::SharedSRV *blitSRV = nullptr;
+ ANGLE_TRY(getSRVLevel(context, level, true, &blitSRV));
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (mUseLevelZeroTexture)
+ {
+ if (!mLevelZeroRenderTarget)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = mTopLevel + level;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(
+ mRenderer->allocateResource(context11, rtvDesc, mLevelZeroTexture.get(), &rtv));
+ rtv.setDebugName("TexStorage2D.Level0RTV");
+
+ mLevelZeroRenderTarget.reset(new TextureRenderTarget11(
+ std::move(rtv), mLevelZeroTexture, d3d11::SharedSRV(), d3d11::SharedSRV(),
+ mFormatInfo.internalFormat, getFormatSet(), getLevelWidth(level),
+ getLevelHeight(level), 1, 0));
+ }
+
+ *outRT = mLevelZeroRenderTarget.get();
+ return angle::Result::Continue;
+ }
+
+ if (mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = mTopLevel + level;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rtvDesc, texture->get(), &rtv));
+ rtv.setDebugName("TexStorage2D.RTV");
+
+ mRenderTarget[level].reset(new TextureRenderTarget11(
+ std::move(rtv), *texture, *srv, *blitSRV, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(level), getLevelHeight(level), 1, 0));
+
+ *outRT = mRenderTarget[level].get();
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = mFormatInfo.dsvFormat;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+ dsvDesc.Texture2D.MipSlice = mTopLevel + level;
+ dsvDesc.Flags = 0;
+
+ d3d11::DepthStencilView dsv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, dsvDesc, texture->get(), &dsv));
+ dsv.setDebugName("TexStorage2D.DSV");
+
+ mRenderTarget[level].reset(new TextureRenderTarget11(
+ std::move(dsv), *texture, *srv, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(level), getLevelHeight(level), 1, 0));
+
+ *outRT = mRenderTarget[level].get();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2D.MipLevels = mipLevels;
+
+ const TextureHelper11 *srvTexture = &texture;
+
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ASSERT(mTopLevel == 0);
+ ASSERT(baseLevel == 0);
+ // This code also assumes that the incoming texture equals either mLevelZeroTexture or
+ // mTexture.
+
+ if (mipLevels == 1 && mMipLevels > 1)
+ {
+ // We must use a SRV on the level-zero-only texture.
+ ANGLE_TRY(ensureTextureExists(context, 1));
+ srvTexture = &mLevelZeroTexture;
+ }
+ else
+ {
+ ASSERT(mipLevels == static_cast<int>(mMipLevels));
+ ASSERT(mTexture.valid() && texture == mTexture);
+ srvTexture = &mTexture;
+ }
+ }
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, srvTexture->get(),
+ outSRV));
+ outSRV->setDebugName("TexStorage2D.SRV");
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = mTopLevel + level;
+ srvDesc.Texture2D.MipLevels = 1;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage2D.SRVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV)
+{
+ ASSERT(outUAV);
+ D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
+ uavDesc.Format = format;
+ uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D;
+ uavDesc.Texture2D.MipSlice = mTopLevel + level;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), uavDesc, texture.get(), outUAV));
+ outUAV->setDebugName("TexStorage2D.UAVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ ASSERT(outTexture);
+
+ if (!mSwizzleTexture.valid())
+ {
+ const auto &format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = 1;
+ desc.Format = format.texFormat;
+ 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;
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, format,
+ &mSwizzleTexture));
+ mSwizzleTexture.setDebugName("TexStorage2D.SwizzleTexture");
+ }
+
+ *outTexture = &mSwizzleTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+ ASSERT(outRTV);
+
+ if (!mSwizzleRenderTargets[mipLevel].valid())
+ {
+ const TextureHelper11 *swizzleTexture = nullptr;
+ ANGLE_TRY(getSwizzleTexture(context, &swizzleTexture));
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format =
+ mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), rtvDesc,
+ mSwizzleTexture.get(),
+ &mSwizzleRenderTargets[mipLevel]));
+ }
+
+ *outRTV = &mSwizzleRenderTargets[mipLevel];
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2D::ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut)
+{
+ if (mDropStencilTexture.valid())
+ {
+ *dropStencilOut = DropStencil::ALREADY_EXISTS;
+ return angle::Result::Continue;
+ }
+
+ D3D11_TEXTURE2D_DESC dropDesc = {};
+ dropDesc.ArraySize = 1;
+ dropDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_DEPTH_STENCIL;
+ dropDesc.CPUAccessFlags = 0;
+ dropDesc.Format = DXGI_FORMAT_R32_TYPELESS;
+ dropDesc.Height = mTextureHeight;
+ dropDesc.MipLevels = mMipLevels;
+ dropDesc.MiscFlags = 0;
+ dropDesc.SampleDesc.Count = 1;
+ dropDesc.SampleDesc.Quality = 0;
+ dropDesc.Usage = D3D11_USAGE_DEFAULT;
+ dropDesc.Width = mTextureWidth;
+
+ const auto &format =
+ d3d11::Format::Get(GL_DEPTH_COMPONENT32F, mRenderer->getRenderer11DeviceCaps());
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), dropDesc, format,
+ &mDropStencilTexture));
+ mDropStencilTexture.setDebugName("TexStorage2D.DropStencil");
+
+ ANGLE_TRY(initDropStencilTexture(context, gl::ImageIndexIterator::Make2D(0, mMipLevels)));
+
+ *dropStencilOut = DropStencil::CREATED;
+ return angle::Result::Continue;
+}
+
+TextureStorage11_External::TextureStorage11_External(
+ Renderer11 *renderer,
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &glDesc)
+ : TextureStorage11(renderer, D3D11_BIND_SHADER_RESOURCE, 0, glDesc.internalFormat)
+{
+ ASSERT(stream->getProducerType() == egl::Stream::ProducerType::D3D11Texture);
+ auto *producer = static_cast<StreamProducerD3DTexture *>(stream->getImplementation());
+ mTexture.set(producer->getD3DTexture(), mFormatInfo);
+ mSubresourceIndex = producer->getArraySlice();
+ mTexture.get()->AddRef();
+ mMipLevels = 1;
+
+ D3D11_TEXTURE2D_DESC desc;
+ mTexture.getDesc(&desc);
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = 1;
+ mHasKeyedMutex = (desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0;
+}
+
+angle::Result TextureStorage11_External::onDestroy(const gl::Context *context)
+{
+ if (mHasKeyedMutex)
+ {
+ // If the keyed mutex is released that will unbind it and cause the state cache to become
+ // desynchronized.
+ mRenderer->getStateManager()->invalidateBoundViews();
+ }
+
+ return angle::Result::Continue;
+}
+
+TextureStorage11_External::~TextureStorage11_External() {}
+
+angle::Result TextureStorage11_External::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ UNIMPLEMENTED();
+ return angle::Result::Continue;
+}
+
+void TextureStorage11_External::associateImage(Image11 *image, const gl::ImageIndex &index)
+{
+ ASSERT(index.getLevelIndex() == 0);
+ mAssociatedImage = image;
+}
+
+void TextureStorage11_External::verifyAssociatedImageValid(const gl::ImageIndex &index,
+ Image11 *expectedImage)
+{
+ ASSERT(index.getLevelIndex() == 0 && mAssociatedImage == expectedImage);
+}
+
+void TextureStorage11_External::disassociateImage(const gl::ImageIndex &index,
+ Image11 *expectedImage)
+{
+ ASSERT(index.getLevelIndex() == 0);
+ ASSERT(mAssociatedImage == expectedImage);
+ mAssociatedImage = nullptr;
+}
+
+angle::Result TextureStorage11_External::releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage)
+{
+ ASSERT(index.getLevelIndex() == 0);
+
+ if (mAssociatedImage != nullptr && mAssociatedImage != incomingImage)
+ {
+ mAssociatedImage->verifyAssociatedStorageValid(this);
+
+ ANGLE_TRY(mAssociatedImage->recoverFromAssociatedStorage(context));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_External::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_External::getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_External::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ // Render targets are not supported for external textures
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_External::createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ // Since external textures are treates as non-mipmapped textures, we ignore mipmap levels and
+ // use the specified subresource ID the storage was created with.
+ ASSERT(mipLevels == 1);
+ ASSERT(outSRV);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ // subresource index is equal to the mip level for 2D textures
+ srvDesc.Texture2DArray.MostDetailedMip = 0;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = mSubresourceIndex;
+ srvDesc.Texture2DArray.ArraySize = 1;
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage2D.SRV");
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_External::createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_External::createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_External::getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_External::getSwizzleRenderTarget(
+ const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+TextureStorage11ImmutableBase::TextureStorage11ImmutableBase(Renderer11 *renderer,
+ UINT bindFlags,
+ UINT miscFlags,
+ GLenum internalFormat)
+ : TextureStorage11(renderer, bindFlags, miscFlags, internalFormat)
+{}
+
+void TextureStorage11ImmutableBase::associateImage(Image11 *, const gl::ImageIndex &) {}
+
+void TextureStorage11ImmutableBase::disassociateImage(const gl::ImageIndex &, Image11 *) {}
+
+void TextureStorage11ImmutableBase::verifyAssociatedImageValid(const gl::ImageIndex &, Image11 *) {}
+
+angle::Result TextureStorage11ImmutableBase::releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &,
+ Image11 *)
+{
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11ImmutableBase::createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11ImmutableBase::createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+TextureStorage11_EGLImage::TextureStorage11_EGLImage(Renderer11 *renderer,
+ EGLImageD3D *eglImage,
+ RenderTarget11 *renderTarget11)
+ : TextureStorage11ImmutableBase(renderer,
+ D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE,
+ 0,
+ renderTarget11->getInternalFormat()),
+ mImage(eglImage),
+ mCurrentRenderTarget(0),
+ mSwizzleTexture(),
+ mSwizzleRenderTargets(gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+{
+ mCurrentRenderTarget = reinterpret_cast<uintptr_t>(renderTarget11);
+
+ mMipLevels = 1;
+ mTextureWidth = renderTarget11->getWidth();
+ mTextureHeight = renderTarget11->getHeight();
+ mTextureDepth = 1;
+}
+
+TextureStorage11_EGLImage::~TextureStorage11_EGLImage() {}
+
+angle::Result TextureStorage11_EGLImage::getSubresourceIndex(const gl::Context *context,
+ const gl::ImageIndex &index,
+ UINT *outSubresourceIndex) const
+{
+ ASSERT(index.getType() == gl::TextureType::_2D);
+ ASSERT(index.getLevelIndex() == 0);
+
+ RenderTarget11 *renderTarget11 = nullptr;
+ ANGLE_TRY(getImageRenderTarget(context, &renderTarget11));
+ *outSubresourceIndex = renderTarget11->getSubresourceIndex();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_EGLImage::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ ANGLE_TRY(checkForUpdatedRenderTarget(context));
+
+ RenderTarget11 *renderTarget11 = nullptr;
+ ANGLE_TRY(getImageRenderTarget(context, &renderTarget11));
+ *outResource = &renderTarget11->getTexture();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_EGLImage::getSRVForSampler(const gl::Context *context,
+ const gl::TextureState &textureState,
+ const gl::SamplerState &sampler,
+ const d3d11::SharedSRV **outSRV)
+{
+ ANGLE_TRY(checkForUpdatedRenderTarget(context));
+ return TextureStorage11::getSRVForSampler(context, textureState, sampler, outSRV);
+}
+
+angle::Result TextureStorage11_EGLImage::getMippedResource(const gl::Context *context,
+ const TextureHelper11 **)
+{
+ // This shouldn't be called unless the zero max LOD workaround is active.
+ // EGL images are unavailable in this configuration.
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_EGLImage::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(!index.hasLayer());
+ ASSERT(index.getLevelIndex() == 0);
+
+ ANGLE_TRY(checkForUpdatedRenderTarget(context));
+
+ return mImage->getRenderTarget(context, outRT);
+}
+
+angle::Result TextureStorage11_EGLImage::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ const TextureHelper11 *sourceResouce = nullptr;
+ ANGLE_TRY(getResource(context, &sourceResouce));
+
+ ASSERT(destStorage);
+ TextureStorage11_2D *dest11 = GetAs<TextureStorage11_2D>(destStorage);
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
+ immediateContext->CopyResource(destResource->get(), sourceResouce->get());
+
+ dest11->markDirty();
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_EGLImage::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_EGLImage::getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ ASSERT(outTexture);
+
+ if (!mSwizzleTexture.valid())
+ {
+ const auto &format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = 1;
+ desc.Format = format.texFormat;
+ 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;
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, format,
+ &mSwizzleTexture));
+ mSwizzleTexture.setDebugName("TexStorageEGLImage.SwizzleTexture");
+ }
+
+ *outTexture = &mSwizzleTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_EGLImage::getSwizzleRenderTarget(
+ const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+ ASSERT(outRTV);
+
+ if (!mSwizzleRenderTargets[mipLevel].valid())
+ {
+ const TextureHelper11 *swizzleTexture = nullptr;
+ ANGLE_TRY(getSwizzleTexture(context, &swizzleTexture));
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format =
+ mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+ rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), rtvDesc,
+ mSwizzleTexture.get(),
+ &mSwizzleRenderTargets[mipLevel]));
+ }
+
+ *outRTV = &mSwizzleRenderTargets[mipLevel];
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_EGLImage::checkForUpdatedRenderTarget(const gl::Context *context)
+{
+ RenderTarget11 *renderTarget11 = nullptr;
+ ANGLE_TRY(getImageRenderTarget(context, &renderTarget11));
+
+ if (mCurrentRenderTarget != reinterpret_cast<uintptr_t>(renderTarget11))
+ {
+ clearSRVCache();
+ mCurrentRenderTarget = reinterpret_cast<uintptr_t>(renderTarget11);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_EGLImage::createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(baseLevel == 0);
+ ASSERT(mipLevels == 1);
+ ASSERT(outSRV);
+
+ // Create a new SRV only for the swizzle texture. Otherwise just return the Image's
+ // RenderTarget's SRV.
+ if (texture == mSwizzleTexture)
+ {
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+ srvDesc.Texture2D.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2D.MipLevels = mipLevels;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(),
+ outSRV));
+ outSRV->setDebugName("TexStorageEGLImage.SRV");
+ }
+ else
+ {
+ RenderTarget11 *renderTarget = nullptr;
+ ANGLE_TRY(getImageRenderTarget(context, &renderTarget));
+
+ ASSERT(texture == renderTarget->getTexture());
+
+ *outSRV = renderTarget->getShaderResourceView(context).makeCopy();
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_EGLImage::getImageRenderTarget(const gl::Context *context,
+ RenderTarget11 **outRT) const
+{
+ RenderTargetD3D *renderTargetD3D = nullptr;
+ ANGLE_TRY(mImage->getRenderTarget(context, &renderTargetD3D));
+ *outRT = GetAs<RenderTarget11>(renderTargetD3D);
+ return angle::Result::Continue;
+}
+
+TextureStorage11_Cube::TextureStorage11_Cube(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly)
+ : TextureStorage11(
+ renderer,
+ GetTextureBindFlags(internalformat, renderer->getRenderer11DeviceCaps(), renderTarget),
+ GetTextureMiscFlags(internalformat,
+ renderer->getRenderer11DeviceCaps(),
+ renderTarget,
+ levels),
+ internalformat),
+ mTexture(),
+ mLevelZeroTexture(),
+ mUseLevelZeroTexture(hintLevelZeroOnly && levels > 1),
+ mSwizzleTexture()
+{
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ for (unsigned int face = 0; face < gl::kCubeFaceCount; face++)
+ {
+ mAssociatedImages[face][level] = nullptr;
+ mRenderTarget[face][level] = nullptr;
+ }
+ }
+
+ for (unsigned int face = 0; face < gl::kCubeFaceCount; face++)
+ {
+ mLevelZeroRenderTarget[face] = nullptr;
+ }
+
+ // adjust size if needed for compressed textures
+ int height = size;
+ d3d11::MakeValidSize(false, mFormatInfo.texFormat, &size, &height, &mTopLevel);
+
+ mMipLevels = mTopLevel + levels;
+ mTextureWidth = size;
+ mTextureHeight = size;
+ mTextureDepth = 1;
+
+ // The LevelZeroOnly hint should only be true if the zero max LOD workaround is active.
+ ASSERT(!mUseLevelZeroTexture || mRenderer->getFeatures().zeroMaxLodWorkaround.enabled);
+}
+
+angle::Result TextureStorage11_Cube::onDestroy(const gl::Context *context)
+{
+ for (unsigned int level = 0; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+ {
+ for (unsigned int face = 0; face < gl::kCubeFaceCount; face++)
+ {
+ if (mAssociatedImages[face][level] != nullptr)
+ {
+ mAssociatedImages[face][level]->verifyAssociatedStorageValid(this);
+
+ // We must let the Images recover their data before we delete it from the
+ // TextureStorage.
+ ANGLE_TRY(mAssociatedImages[face][level]->recoverFromAssociatedStorage(context));
+ }
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+TextureStorage11_Cube::~TextureStorage11_Cube() {}
+
+angle::Result TextureStorage11_Cube::getSubresourceIndex(const gl::Context *context,
+ const gl::ImageIndex &index,
+ UINT *outSubresourceIndex) const
+{
+ UINT arraySlice = index.cubeMapFaceIndex();
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled && mUseLevelZeroTexture &&
+ index.getLevelIndex() == 0)
+ {
+ UINT subresource = D3D11CalcSubresource(0, arraySlice, 1);
+ ASSERT(subresource != std::numeric_limits<UINT>::max());
+ *outSubresourceIndex = subresource;
+ }
+ else
+ {
+ UINT mipSlice = static_cast<UINT>(index.getLevelIndex() + mTopLevel);
+ UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels);
+ ASSERT(subresource != std::numeric_limits<UINT>::max());
+ *outSubresourceIndex = subresource;
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ASSERT(destStorage);
+
+ TextureStorage11_Cube *dest11 = GetAs<TextureStorage11_Cube>(destStorage);
+
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
+
+ // If either mTexture or mLevelZeroTexture exist, then we need to copy them into the
+ // corresponding textures in destStorage.
+ if (mTexture.valid())
+ {
+ ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(context, false));
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ immediateContext->CopyResource(destResource->get(), mTexture.get());
+ }
+
+ if (mLevelZeroTexture.valid())
+ {
+ ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(context, true));
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ immediateContext->CopyResource(destResource->get(), mLevelZeroTexture.get());
+ }
+ }
+ else
+ {
+ const TextureHelper11 *sourceResouce = nullptr;
+ ANGLE_TRY(getResource(context, &sourceResouce));
+
+ const TextureHelper11 *destResource = nullptr;
+ ANGLE_TRY(dest11->getResource(context, &destResource));
+
+ ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
+ immediateContext->CopyResource(destResource->get(), sourceResouce->get());
+ }
+
+ dest11->markDirty();
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture)
+{
+ if (useLevelZeroTexture && mMipLevels > 1)
+ {
+ if (!mUseLevelZeroTexture && mTexture.valid())
+ {
+ ANGLE_TRY(ensureTextureExists(context, 1));
+
+ // Pull data back from the mipped texture if necessary.
+ ASSERT(mLevelZeroTexture.valid());
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ for (int face = 0; face < 6; face++)
+ {
+ deviceContext->CopySubresourceRegion(mLevelZeroTexture.get(),
+ D3D11CalcSubresource(0, face, 1), 0, 0, 0,
+ mTexture.get(), face * mMipLevels, nullptr);
+ }
+ }
+
+ mUseLevelZeroTexture = true;
+ }
+ else
+ {
+ if (mUseLevelZeroTexture && mLevelZeroTexture.valid())
+ {
+ ANGLE_TRY(ensureTextureExists(context, mMipLevels));
+
+ // Pull data back from the level zero texture if necessary.
+ ASSERT(mTexture.valid());
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+
+ for (int face = 0; face < 6; face++)
+ {
+ deviceContext->CopySubresourceRegion(mTexture.get(),
+ D3D11CalcSubresource(0, face, mMipLevels), 0,
+ 0, 0, mLevelZeroTexture.get(), face, nullptr);
+ }
+ }
+
+ mUseLevelZeroTexture = false;
+ }
+
+ return angle::Result::Continue;
+}
+
+void TextureStorage11_Cube::associateImage(Image11 *image, const gl::ImageIndex &index)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.cubeMapFaceIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::kCubeFaceCount));
+
+ if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ if (0 <= layerTarget && layerTarget < static_cast<GLint>(gl::kCubeFaceCount))
+ {
+ mAssociatedImages[layerTarget][level] = image;
+ }
+ }
+}
+
+void TextureStorage11_Cube::verifyAssociatedImageValid(const gl::ImageIndex &index,
+ Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.cubeMapFaceIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::kCubeFaceCount));
+ // This validation check should never return false. It means the Image/TextureStorage
+ // association is broken.
+ ASSERT(mAssociatedImages[layerTarget][level] == expectedImage);
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_Cube::disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.cubeMapFaceIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::kCubeFaceCount));
+ ASSERT(mAssociatedImages[layerTarget][level] == expectedImage);
+ mAssociatedImages[layerTarget][level] = nullptr;
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
+// recover its data before ending the association.
+angle::Result TextureStorage11_Cube::releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.cubeMapFaceIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(0 <= layerTarget && layerTarget < static_cast<GLint>(gl::kCubeFaceCount));
+
+ if ((0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
+ {
+ if (0 <= layerTarget && layerTarget < static_cast<GLint>(gl::kCubeFaceCount))
+ {
+ // No need to let the old Image recover its data, if it is also the incoming Image.
+ if (mAssociatedImages[layerTarget][level] != nullptr &&
+ mAssociatedImages[layerTarget][level] != incomingImage)
+ {
+ // Ensure that the Image is still associated with this TextureStorage.
+ mAssociatedImages[layerTarget][level]->verifyAssociatedStorageValid(this);
+
+ // Force the image to recover from storage before its data is overwritten.
+ // This will reset mAssociatedImages[level] to nullptr too.
+ ANGLE_TRY(
+ mAssociatedImages[layerTarget][level]->recoverFromAssociatedStorage(context));
+ }
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ if (mUseLevelZeroTexture && mMipLevels > 1)
+ {
+ ANGLE_TRY(ensureTextureExists(context, 1));
+ *outResource = &mLevelZeroTexture;
+ }
+ else
+ {
+ ANGLE_TRY(ensureTextureExists(context, mMipLevels));
+ *outResource = &mTexture;
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ // This shouldn't be called unless the zero max LOD workaround is active.
+ ASSERT(mRenderer->getFeatures().zeroMaxLodWorkaround.enabled);
+
+ ANGLE_TRY(ensureTextureExists(context, mMipLevels));
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::ensureTextureExists(const gl::Context *context, int mipLevels)
+{
+ // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture.
+ bool useLevelZeroTexture = mRenderer->getFeatures().zeroMaxLodWorkaround.enabled
+ ? (mipLevels == 1) && (mMipLevels > 1)
+ : false;
+ TextureHelper11 *outputTexture = useLevelZeroTexture ? &mLevelZeroTexture : &mTexture;
+
+ // if the size is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (!outputTexture->valid() && mTextureWidth > 0 && mTextureHeight > 0)
+ {
+ ASSERT(mMipLevels > 0);
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mipLevels;
+ desc.ArraySize = gl::kCubeFaceCount;
+ desc.Format = mFormatInfo.texFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE | getMiscFlags();
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
+ outputTexture));
+ outputTexture->setDebugName("TexStorageCube.Texture");
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::createRenderTargetSRV(const gl::Context *context,
+ const TextureHelper11 &texture,
+ const gl::ImageIndex &index,
+ DXGI_FORMAT resourceFormat,
+ d3d11::SharedSRV *srv) const
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = resourceFormat;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + index.getLevelIndex();
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = index.cubeMapFaceIndex();
+ srvDesc.Texture2DArray.ArraySize = 1;
+
+ if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_10_0)
+ {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+ }
+ else
+ {
+ // Will be used with Texture2D sampler, not TextureCube
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ }
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), srv));
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ const int faceIndex = index.cubeMapFaceIndex();
+ const int level = index.getLevelIndex();
+
+ ASSERT(level >= 0 && level < getLevelCount());
+ ASSERT(faceIndex >= 0 && faceIndex < static_cast<GLint>(gl::kCubeFaceCount));
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (!mRenderTarget[faceIndex][level])
+ {
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ASSERT(index.getLevelIndex() == 0);
+ ANGLE_TRY(useLevelZeroWorkaroundTexture(context, true));
+ }
+
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+
+ if (mUseLevelZeroTexture)
+ {
+ if (!mLevelZeroRenderTarget[faceIndex])
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ rtvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+ rtvDesc.Texture2DArray.ArraySize = 1;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(
+ mRenderer->allocateResource(context11, rtvDesc, mLevelZeroTexture.get(), &rtv));
+
+ mLevelZeroRenderTarget[faceIndex].reset(new TextureRenderTarget11(
+ std::move(rtv), mLevelZeroTexture, d3d11::SharedSRV(), d3d11::SharedSRV(),
+ mFormatInfo.internalFormat, getFormatSet(), getLevelWidth(level),
+ getLevelHeight(level), 1, 0));
+ }
+
+ ASSERT(outRT);
+ *outRT = mLevelZeroRenderTarget[faceIndex].get();
+ return angle::Result::Continue;
+ }
+
+ d3d11::SharedSRV srv;
+ ANGLE_TRY(createRenderTargetSRV(context, *texture, index, mFormatInfo.srvFormat, &srv));
+ d3d11::SharedSRV blitSRV;
+ if (mFormatInfo.blitSRVFormat != mFormatInfo.srvFormat)
+ {
+ ANGLE_TRY(createRenderTargetSRV(context, *texture, index, mFormatInfo.blitSRVFormat,
+ &blitSRV));
+ }
+ else
+ {
+ blitSRV = srv.makeCopy();
+ }
+
+ srv.setDebugName("TexStorageCube.RenderTargetSRV");
+
+ if (mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ rtvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+ rtvDesc.Texture2DArray.ArraySize = 1;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rtvDesc, texture->get(), &rtv));
+ rtv.setDebugName("TexStorageCube.RenderTargetRTV");
+
+ mRenderTarget[faceIndex][level].reset(new TextureRenderTarget11(
+ std::move(rtv), *texture, srv, blitSRV, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(level), getLevelHeight(level), 1, 0));
+ }
+ else if (mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = mFormatInfo.dsvFormat;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
+ dsvDesc.Flags = 0;
+ dsvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ dsvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+ dsvDesc.Texture2DArray.ArraySize = 1;
+
+ d3d11::DepthStencilView dsv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, dsvDesc, texture->get(), &dsv));
+ dsv.setDebugName("TexStorageCube.RenderTargetDSV");
+
+ mRenderTarget[faceIndex][level].reset(new TextureRenderTarget11(
+ std::move(dsv), *texture, srv, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(level), getLevelHeight(level), 1, 0));
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+ }
+
+ ASSERT(outRT);
+ *outRT = mRenderTarget[faceIndex][level].get();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+
+ // Unnormalized integer cube maps are not supported by DX11; we emulate them as an array of six
+ // 2D textures
+ const GLenum componentType = d3d11::GetComponentType(format);
+ if (componentType == GL_INT || componentType == GL_UNSIGNED_INT)
+ {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
+ srvDesc.Texture2DArray.MipLevels = mipLevels;
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = gl::kCubeFaceCount;
+ }
+ else
+ {
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+ srvDesc.TextureCube.MipLevels = mipLevels;
+ srvDesc.TextureCube.MostDetailedMip = mTopLevel + baseLevel;
+ }
+
+ const TextureHelper11 *srvTexture = &texture;
+
+ if (mRenderer->getFeatures().zeroMaxLodWorkaround.enabled)
+ {
+ ASSERT(mTopLevel == 0);
+ ASSERT(baseLevel == 0);
+ // This code also assumes that the incoming texture equals either mLevelZeroTexture or
+ // mTexture.
+
+ if (mipLevels == 1 && mMipLevels > 1)
+ {
+ // We must use a SRV on the level-zero-only texture.
+ ANGLE_TRY(ensureTextureExists(context, 1));
+ srvTexture = &mLevelZeroTexture;
+ }
+ else
+ {
+ ASSERT(mipLevels == static_cast<int>(mMipLevels));
+ ASSERT(mTexture.valid() && texture == mTexture);
+ srvTexture = &mTexture;
+ }
+ }
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, srvTexture->get(),
+ outSRV));
+ outSRV->setDebugName("TexStorageCube.SRV");
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + level;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = gl::kCubeFaceCount;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorageCube.SRVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV)
+{
+ ASSERT(outUAV);
+ D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
+ uavDesc.Format = format;
+ uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
+ uavDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ uavDesc.Texture2DArray.FirstArraySlice = 0;
+ uavDesc.Texture2DArray.ArraySize = gl::kCubeFaceCount;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), uavDesc, texture.get(), outUAV));
+ outUAV->setDebugName("TexStorageCube.UAVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ ASSERT(outTexture);
+
+ if (!mSwizzleTexture.valid())
+ {
+ const auto &format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = gl::kCubeFaceCount;
+ desc.Format = format.texFormat;
+ 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;
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, format,
+ &mSwizzleTexture));
+ mSwizzleTexture.setDebugName("TexStorageCube.SwizzleTexture");
+ }
+
+ *outTexture = &mSwizzleTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+ ASSERT(outRTV);
+
+ if (!mSwizzleRenderTargets[mipLevel].valid())
+ {
+ const TextureHelper11 *swizzleTexture = nullptr;
+ ANGLE_TRY(getSwizzleTexture(context, &swizzleTexture));
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format =
+ mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture2DArray.FirstArraySlice = 0;
+ rtvDesc.Texture2DArray.ArraySize = gl::kCubeFaceCount;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), rtvDesc,
+ mSwizzleTexture.get(),
+ &mSwizzleRenderTargets[mipLevel]));
+ }
+
+ *outRTV = &mSwizzleRenderTargets[mipLevel];
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_Cube::ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut)
+{
+ if (mDropStencilTexture.valid())
+ {
+ *dropStencilOut = DropStencil::ALREADY_EXISTS;
+ return angle::Result::Continue;
+ }
+
+ D3D11_TEXTURE2D_DESC dropDesc = {};
+ dropDesc.ArraySize = 6;
+ dropDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_DEPTH_STENCIL;
+ dropDesc.CPUAccessFlags = 0;
+ dropDesc.Format = DXGI_FORMAT_R32_TYPELESS;
+ dropDesc.Height = mTextureHeight;
+ dropDesc.MipLevels = mMipLevels;
+ dropDesc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
+ dropDesc.SampleDesc.Count = 1;
+ dropDesc.SampleDesc.Quality = 0;
+ dropDesc.Usage = D3D11_USAGE_DEFAULT;
+ dropDesc.Width = mTextureWidth;
+
+ const auto &format =
+ d3d11::Format::Get(GL_DEPTH_COMPONENT32F, mRenderer->getRenderer11DeviceCaps());
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), dropDesc, format,
+ &mDropStencilTexture));
+ mDropStencilTexture.setDebugName("TexStorageCube.DropStencil");
+
+ ANGLE_TRY(initDropStencilTexture(context, gl::ImageIndexIterator::MakeCube(0, mMipLevels)));
+
+ *dropStencilOut = DropStencil::CREATED;
+ return angle::Result::Continue;
+}
+
+TextureStorage11_3D::TextureStorage11_3D(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels)
+ : TextureStorage11(
+ renderer,
+ GetTextureBindFlags(internalformat, renderer->getRenderer11DeviceCaps(), renderTarget),
+ GetTextureMiscFlags(internalformat,
+ renderer->getRenderer11DeviceCaps(),
+ renderTarget,
+ levels),
+ internalformat)
+{
+ for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ mAssociatedImages[i] = nullptr;
+ mLevelRenderTargets[i] = nullptr;
+ }
+
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, mFormatInfo.texFormat, &width, &height, &mTopLevel);
+
+ mMipLevels = mTopLevel + levels;
+ mTextureWidth = width;
+ mTextureHeight = height;
+ mTextureDepth = depth;
+}
+
+angle::Result TextureStorage11_3D::onDestroy(const gl::Context *context)
+{
+ for (unsigned i = 0; i < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+ {
+ if (mAssociatedImages[i] != nullptr)
+ {
+ mAssociatedImages[i]->verifyAssociatedStorageValid(this);
+
+ // We must let the Images recover their data before we delete it from the
+ // TextureStorage.
+ ANGLE_TRY(mAssociatedImages[i]->recoverFromAssociatedStorage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+TextureStorage11_3D::~TextureStorage11_3D() {}
+
+void TextureStorage11_3D::associateImage(Image11 *image, const gl::ImageIndex &index)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+ if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ mAssociatedImages[level] = image;
+ }
+}
+
+void TextureStorage11_3D::verifyAssociatedImageValid(const gl::ImageIndex &index,
+ Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ // This validation check should never return false. It means the Image/TextureStorage
+ // association is broken.
+ ASSERT(mAssociatedImages[level] == expectedImage);
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_3D::disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT(0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ ASSERT(mAssociatedImages[level] == expectedImage);
+ mAssociatedImages[level] = nullptr;
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
+// recover its data before ending the association.
+angle::Result TextureStorage11_3D::releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage)
+{
+ const GLint level = index.getLevelIndex();
+
+ ASSERT((0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS));
+
+ if (0 <= level && level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ // No need to let the old Image recover its data, if it is also the incoming Image.
+ if (mAssociatedImages[level] != nullptr && mAssociatedImages[level] != incomingImage)
+ {
+ // Ensure that the Image is still associated with this TextureStorage.
+ mAssociatedImages[level]->verifyAssociatedStorageValid(this);
+
+ // Force the image to recover from storage before its data is overwritten.
+ // This will reset mAssociatedImages[level] to nullptr too.
+ ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_3D::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ // If the width, height or depth are not positive this should be treated as an incomplete
+ // texture. We handle that here by skipping the d3d texture creation.
+ if (!mTexture.valid() && mTextureWidth > 0 && mTextureHeight > 0 && mTextureDepth > 0)
+ {
+ ASSERT(mMipLevels > 0);
+
+ D3D11_TEXTURE3D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.Depth = mTextureDepth;
+ desc.MipLevels = mMipLevels;
+ desc.Format = mFormatInfo.texFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = getMiscFlags();
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
+ &mTexture));
+ mTexture.setDebugName("TexStorage3D.Texture");
+ }
+
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_3D::createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
+ srvDesc.Texture3D.MostDetailedMip = baseLevel;
+ srvDesc.Texture3D.MipLevels = mipLevels;
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage3D.SRV");
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_3D::createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
+ srvDesc.Texture3D.MostDetailedMip = mTopLevel + level;
+ srvDesc.Texture3D.MipLevels = 1;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage3D.SRVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_3D::createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV)
+{
+ ASSERT(outUAV);
+ D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
+ uavDesc.Format = format;
+ uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D;
+ uavDesc.Texture3D.MipSlice = mTopLevel + level;
+ uavDesc.Texture3D.FirstWSlice = 0;
+ uavDesc.Texture3D.WSize = mTextureDepth;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), uavDesc, texture.get(), outUAV));
+ outUAV->setDebugName("TexStorage3D.UAVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_3D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ const int mipLevel = index.getLevelIndex();
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+
+ ASSERT(mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (!index.hasLayer())
+ {
+ if (!mLevelRenderTargets[mipLevel])
+ {
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+
+ const d3d11::SharedSRV *srv = nullptr;
+ ANGLE_TRY(getSRVLevel(context, mipLevel, false, &srv));
+
+ const d3d11::SharedSRV *blitSRV = nullptr;
+ ANGLE_TRY(getSRVLevel(context, mipLevel, true, &blitSRV));
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture3D.FirstWSlice = 0;
+ rtvDesc.Texture3D.WSize = static_cast<UINT>(-1);
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rtvDesc, texture->get(), &rtv));
+ rtv.setDebugName("TexStorage3D.RTV");
+
+ mLevelRenderTargets[mipLevel].reset(new TextureRenderTarget11(
+ std::move(rtv), *texture, *srv, *blitSRV, mFormatInfo.internalFormat,
+ getFormatSet(), getLevelWidth(mipLevel), getLevelHeight(mipLevel),
+ getLevelDepth(mipLevel), 0));
+ }
+
+ ASSERT(outRT);
+ *outRT = mLevelRenderTargets[mipLevel].get();
+ return angle::Result::Continue;
+ }
+
+ const int layer = index.getLayerIndex();
+
+ LevelLayerKey key(mipLevel, layer);
+ if (mLevelLayerRenderTargets.find(key) == mLevelLayerRenderTargets.end())
+ {
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+
+ // TODO, what kind of SRV is expected here?
+ const d3d11::SharedSRV srv;
+ const d3d11::SharedSRV blitSRV;
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture3D.FirstWSlice = layer;
+ rtvDesc.Texture3D.WSize = 1;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rtvDesc, texture->get(), &rtv));
+ rtv.setDebugName("TexStorage3D.LayerRTV");
+
+ mLevelLayerRenderTargets[key].reset(new TextureRenderTarget11(
+ std::move(rtv), *texture, srv, blitSRV, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1, 0));
+ }
+
+ ASSERT(outRT);
+ *outRT = mLevelLayerRenderTargets[key].get();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_3D::getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ ASSERT(outTexture);
+
+ if (!mSwizzleTexture.valid())
+ {
+ const auto &format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE3D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.Depth = mTextureDepth;
+ desc.MipLevels = mMipLevels;
+ desc.Format = format.texFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, format,
+ &mSwizzleTexture));
+ mSwizzleTexture.setDebugName("TexStorage3D.SwizzleTexture");
+ }
+
+ *outTexture = &mSwizzleTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_3D::getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+ ASSERT(outRTV);
+
+ if (!mSwizzleRenderTargets[mipLevel].valid())
+ {
+ const TextureHelper11 *swizzleTexture = nullptr;
+ ANGLE_TRY(getSwizzleTexture(context, &swizzleTexture));
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format =
+ mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+ rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture3D.FirstWSlice = 0;
+ rtvDesc.Texture3D.WSize = static_cast<UINT>(-1);
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), rtvDesc,
+ mSwizzleTexture.get(),
+ &mSwizzleRenderTargets[mipLevel]));
+ mSwizzleRenderTargets[mipLevel].setDebugName("TexStorage3D.SwizzleRTV");
+ }
+
+ *outRTV = &mSwizzleRenderTargets[mipLevel];
+ return angle::Result::Continue;
+}
+
+TextureStorage11_2DArray::TextureStorage11_2DArray(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels)
+ : TextureStorage11(
+ renderer,
+ GetTextureBindFlags(internalformat, renderer->getRenderer11DeviceCaps(), renderTarget),
+ GetTextureMiscFlags(internalformat,
+ renderer->getRenderer11DeviceCaps(),
+ renderTarget,
+ levels),
+ internalformat)
+{
+ // adjust size if needed for compressed textures
+ d3d11::MakeValidSize(false, mFormatInfo.texFormat, &width, &height, &mTopLevel);
+
+ mMipLevels = mTopLevel + levels;
+ mTextureWidth = width;
+ mTextureHeight = height;
+ mTextureDepth = depth;
+}
+
+angle::Result TextureStorage11_2DArray::onDestroy(const gl::Context *context)
+{
+ for (auto iter : mAssociatedImages)
+ {
+ if (iter.second)
+ {
+ iter.second->verifyAssociatedStorageValid(this);
+
+ // We must let the Images recover their data before we delete it from the
+ // TextureStorage.
+ ANGLE_TRY(iter.second->recoverFromAssociatedStorage(context));
+ }
+ }
+ mAssociatedImages.clear();
+
+ return angle::Result::Continue;
+}
+
+TextureStorage11_2DArray::~TextureStorage11_2DArray() {}
+
+void TextureStorage11_2DArray::associateImage(Image11 *image, const gl::ImageIndex &index)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.getLayerIndex();
+ const GLint numLayers = index.getLayerCount();
+
+ ASSERT(0 <= level && level < getLevelCount());
+
+ if (0 <= level && level < getLevelCount())
+ {
+ LevelLayerRangeKey key(level, layerTarget, numLayers);
+ mAssociatedImages[key] = image;
+ }
+}
+
+void TextureStorage11_2DArray::verifyAssociatedImageValid(const gl::ImageIndex &index,
+ Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.getLayerIndex();
+ const GLint numLayers = index.getLayerCount();
+
+ LevelLayerRangeKey key(level, layerTarget, numLayers);
+
+ // This validation check should never return false. It means the Image/TextureStorage
+ // association is broken.
+ bool retValue = (mAssociatedImages.find(key) != mAssociatedImages.end() &&
+ (mAssociatedImages[key] == expectedImage));
+ ASSERT(retValue);
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_2DArray::disassociateImage(const gl::ImageIndex &index,
+ Image11 *expectedImage)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.getLayerIndex();
+ const GLint numLayers = index.getLayerCount();
+
+ LevelLayerRangeKey key(level, layerTarget, numLayers);
+
+ bool imageAssociationCorrect = (mAssociatedImages.find(key) != mAssociatedImages.end() &&
+ (mAssociatedImages[key] == expectedImage));
+ ASSERT(imageAssociationCorrect);
+ mAssociatedImages[key] = nullptr;
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image
+// recover its data before ending the association.
+angle::Result TextureStorage11_2DArray::releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage)
+{
+ const GLint level = index.getLevelIndex();
+ const GLint layerTarget = index.getLayerIndex();
+ const GLint numLayers = index.getLayerCount();
+
+ LevelLayerRangeKey key(level, layerTarget, numLayers);
+
+ if (mAssociatedImages.find(key) != mAssociatedImages.end())
+ {
+ if (mAssociatedImages[key] != nullptr && mAssociatedImages[key] != incomingImage)
+ {
+ // Ensure that the Image is still associated with this TextureStorage.
+ mAssociatedImages[key]->verifyAssociatedStorageValid(this);
+
+ // Force the image to recover from storage before its data is overwritten.
+ // This will reset mAssociatedImages[level] to nullptr too.
+ ANGLE_TRY(mAssociatedImages[key]->recoverFromAssociatedStorage(context));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ // if the width, height or depth is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (!mTexture.valid() && mTextureWidth > 0 && mTextureHeight > 0 && mTextureDepth > 0)
+ {
+ ASSERT(mMipLevels > 0);
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = mTextureDepth;
+ desc.Format = mFormatInfo.texFormat;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags();
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = getMiscFlags();
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
+ &mTexture));
+ mTexture.setDebugName("TexStorage2DArray.Texture");
+ }
+
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ 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;
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage2DArray.SRV");
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + level;
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = 0;
+ srvDesc.Texture2DArray.ArraySize = mTextureDepth;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage2DArray.SRVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV)
+{
+ ASSERT(outUAV);
+ D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
+ uavDesc.Format = format;
+ uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY;
+ uavDesc.Texture2DArray.MipSlice = mTopLevel + level;
+ uavDesc.Texture2DArray.FirstArraySlice = 0;
+ uavDesc.Texture2DArray.ArraySize = mTextureDepth;
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), uavDesc, texture.get(), outUAV));
+ outUAV->setDebugName("TexStorage2DArray.UAVForImage");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::createRenderTargetSRV(const gl::Context *context,
+ const TextureHelper11 &texture,
+ const gl::ImageIndex &index,
+ DXGI_FORMAT resourceFormat,
+ d3d11::SharedSRV *srv) const
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = resourceFormat;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+ srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + index.getLevelIndex();
+ srvDesc.Texture2DArray.MipLevels = 1;
+ srvDesc.Texture2DArray.FirstArraySlice = index.getLayerIndex();
+ srvDesc.Texture2DArray.ArraySize = index.getLayerCount();
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), srv));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(index.hasLayer());
+
+ const int mipLevel = index.getLevelIndex();
+ const int layer = index.getLayerIndex();
+ const int numLayers = index.getLayerCount();
+
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+
+ LevelLayerRangeKey key(mipLevel, layer, numLayers);
+ if (mRenderTargets.find(key) == mRenderTargets.end())
+ {
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+ d3d11::SharedSRV srv;
+ ANGLE_TRY(createRenderTargetSRV(context, *texture, index, mFormatInfo.srvFormat, &srv));
+ d3d11::SharedSRV blitSRV;
+ if (mFormatInfo.blitSRVFormat != mFormatInfo.srvFormat)
+ {
+ ANGLE_TRY(createRenderTargetSRV(context, *texture, index, mFormatInfo.blitSRVFormat,
+ &blitSRV));
+ }
+ else
+ {
+ blitSRV = srv.makeCopy();
+ }
+
+ srv.setDebugName("TexStorage2DArray.RenderTargetSRV");
+
+ if (mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture2DArray.FirstArraySlice = layer;
+ rtvDesc.Texture2DArray.ArraySize = numLayers;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), rtvDesc,
+ texture->get(), &rtv));
+ rtv.setDebugName("TexStorage2DArray.RenderTargetRTV");
+
+ mRenderTargets[key].reset(new TextureRenderTarget11(
+ std::move(rtv), *texture, srv, blitSRV, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1, 0));
+ }
+ else
+ {
+ ASSERT(mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = mFormatInfo.dsvFormat;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
+ dsvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+ dsvDesc.Texture2DArray.FirstArraySlice = layer;
+ dsvDesc.Texture2DArray.ArraySize = numLayers;
+ dsvDesc.Flags = 0;
+
+ d3d11::DepthStencilView dsv;
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), dsvDesc,
+ texture->get(), &dsv));
+ dsv.setDebugName("TexStorage2DArray.RenderTargetDSV");
+
+ mRenderTargets[key].reset(new TextureRenderTarget11(
+ std::move(dsv), *texture, srv, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1, 0));
+ }
+ }
+
+ ASSERT(outRT);
+ *outRT = mRenderTargets[key].get();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ if (!mSwizzleTexture.valid())
+ {
+ const auto &format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps());
+
+ D3D11_TEXTURE2D_DESC desc;
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mMipLevels;
+ desc.ArraySize = mTextureDepth;
+ desc.Format = format.texFormat;
+ 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;
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, format,
+ &mSwizzleTexture));
+ mSwizzleTexture.setDebugName("TexStorage2DArray.SwizzleTexture");
+ }
+
+ *outTexture = &mSwizzleTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::getSwizzleRenderTarget(
+ const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+ ASSERT(outRTV);
+
+ if (!mSwizzleRenderTargets[mipLevel].valid())
+ {
+ const TextureHelper11 *swizzleTexture = nullptr;
+ ANGLE_TRY(getSwizzleTexture(context, &swizzleTexture));
+
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format =
+ mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+ rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+ rtvDesc.Texture2DArray.FirstArraySlice = 0;
+ rtvDesc.Texture2DArray.ArraySize = mTextureDepth;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), rtvDesc,
+ mSwizzleTexture.get(),
+ &mSwizzleRenderTargets[mipLevel]));
+ }
+
+ *outRTV = &mSwizzleRenderTargets[mipLevel];
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DArray::ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut)
+{
+ if (mDropStencilTexture.valid())
+ {
+ *dropStencilOut = DropStencil::ALREADY_EXISTS;
+ return angle::Result::Continue;
+ }
+
+ D3D11_TEXTURE2D_DESC dropDesc = {};
+ dropDesc.ArraySize = mTextureDepth;
+ dropDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_DEPTH_STENCIL;
+ dropDesc.CPUAccessFlags = 0;
+ dropDesc.Format = DXGI_FORMAT_R32_TYPELESS;
+ dropDesc.Height = mTextureHeight;
+ dropDesc.MipLevels = mMipLevels;
+ dropDesc.MiscFlags = 0;
+ dropDesc.SampleDesc.Count = 1;
+ dropDesc.SampleDesc.Quality = 0;
+ dropDesc.Usage = D3D11_USAGE_DEFAULT;
+ dropDesc.Width = mTextureWidth;
+
+ const auto &format =
+ d3d11::Format::Get(GL_DEPTH_COMPONENT32F, mRenderer->getRenderer11DeviceCaps());
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), dropDesc, format,
+ &mDropStencilTexture));
+ mDropStencilTexture.setDebugName("TexStorage2DArray.DropStencil");
+
+ std::vector<GLsizei> layerCounts(mMipLevels, mTextureDepth);
+
+ ANGLE_TRY(initDropStencilTexture(
+ context, gl::ImageIndexIterator::Make2DArray(0, mMipLevels, layerCounts.data())));
+
+ *dropStencilOut = DropStencil::CREATED;
+ return angle::Result::Continue;
+}
+
+TextureStorage11_2DMultisample::TextureStorage11_2DMultisample(Renderer11 *renderer,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ int samples,
+ bool fixedSampleLocations)
+ : TextureStorage11ImmutableBase(
+ renderer,
+ GetTextureBindFlags(internalformat, renderer->getRenderer11DeviceCaps(), true),
+ GetTextureMiscFlags(internalformat, renderer->getRenderer11DeviceCaps(), true, levels),
+ internalformat),
+ mTexture(),
+ mRenderTarget(nullptr)
+{
+ // There are no multisampled compressed formats, so there's no need to adjust texture size
+ // according to block size.
+ ASSERT(d3d11::GetDXGIFormatSizeInfo(mFormatInfo.texFormat).blockWidth <= 1);
+ ASSERT(d3d11::GetDXGIFormatSizeInfo(mFormatInfo.texFormat).blockHeight <= 1);
+
+ mMipLevels = 1;
+ mTextureWidth = width;
+ mTextureHeight = height;
+ mTextureDepth = 1;
+ mSamples = samples;
+ mFixedSampleLocations = fixedSampleLocations;
+}
+
+angle::Result TextureStorage11_2DMultisample::onDestroy(const gl::Context *context)
+{
+ mRenderTarget.reset();
+ return angle::Result::Continue;
+}
+
+TextureStorage11_2DMultisample::~TextureStorage11_2DMultisample() {}
+
+angle::Result TextureStorage11_2DMultisample::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_2DMultisample::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ ANGLE_TRY(ensureTextureExists(context, 1));
+
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisample::ensureTextureExists(const gl::Context *context,
+ int mipLevels)
+{
+ // For Multisampled textures, mipLevels always equals 1.
+ ASSERT(mipLevels == 1);
+
+ // if the width or height is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (!mTexture.valid() && mTextureWidth > 0 && mTextureHeight > 0)
+ {
+ D3D11_TEXTURE2D_DESC desc;
+ ZeroMemory(&desc, sizeof(desc));
+ desc.Width = mTextureWidth; // Compressed texture size constraints?
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mipLevels;
+ desc.ArraySize = 1;
+ desc.Format = mFormatInfo.texFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags() & ~D3D11_BIND_UNORDERED_ACCESS;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = getMiscFlags();
+
+ const gl::TextureCaps &textureCaps =
+ mRenderer->getNativeTextureCaps().get(mFormatInfo.internalFormat);
+ GLuint supportedSamples = textureCaps.getNearestSamples(mSamples);
+ desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
+ desc.SampleDesc.Quality = static_cast<UINT>(D3D11_STANDARD_MULTISAMPLE_PATTERN);
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
+ &mTexture));
+ mTexture.setDebugName("TexStorage2DMS.Texture");
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisample::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(!index.hasLayer());
+
+ const int level = index.getLevelIndex();
+ ASSERT(level == 0);
+
+ ASSERT(outRT);
+ if (mRenderTarget)
+ {
+ *outRT = mRenderTarget.get();
+ return angle::Result::Continue;
+ }
+
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+
+ const d3d11::SharedSRV *srv = nullptr;
+ ANGLE_TRY(getSRVLevel(context, level, false, &srv));
+
+ const d3d11::SharedSRV *blitSRV = nullptr;
+ ANGLE_TRY(getSRVLevel(context, level, true, &blitSRV));
+
+ Context11 *context11 = GetImplAs<Context11>(context);
+
+ if (mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, rtvDesc, texture->get(), &rtv));
+
+ mRenderTarget.reset(new TextureRenderTarget11(
+ std::move(rtv), *texture, *srv, *blitSRV, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(level), getLevelHeight(level), 1, mSamples));
+
+ *outRT = mRenderTarget.get();
+ return angle::Result::Continue;
+ }
+
+ ASSERT(mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = mFormatInfo.dsvFormat;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS;
+ dsvDesc.Flags = 0;
+
+ d3d11::DepthStencilView dsv;
+ ANGLE_TRY(mRenderer->allocateResource(context11, dsvDesc, texture->get(), &dsv));
+
+ mRenderTarget.reset(new TextureRenderTarget11(
+ std::move(dsv), *texture, *srv, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(level), getLevelHeight(level), 1, mSamples));
+
+ *outRT = mRenderTarget.get();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisample::createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage2DMS.SRV");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisample::getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_2DMultisample::getSwizzleRenderTarget(
+ const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_2DMultisample::ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+TextureStorage11_2DMultisampleArray::TextureStorage11_2DMultisampleArray(Renderer11 *renderer,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels,
+ int samples,
+ bool fixedSampleLocations)
+ : TextureStorage11ImmutableBase(
+ renderer,
+ GetTextureBindFlags(internalformat, renderer->getRenderer11DeviceCaps(), true),
+ GetTextureMiscFlags(internalformat, renderer->getRenderer11DeviceCaps(), true, levels),
+ internalformat),
+ mTexture()
+{
+ // There are no multisampled compressed formats, so there's no need to adjust texture size
+ // according to block size.
+ ASSERT(d3d11::GetDXGIFormatSizeInfo(mFormatInfo.texFormat).blockWidth <= 1);
+ ASSERT(d3d11::GetDXGIFormatSizeInfo(mFormatInfo.texFormat).blockHeight <= 1);
+
+ mMipLevels = 1;
+ mTextureWidth = width;
+ mTextureHeight = height;
+ mTextureDepth = depth;
+ mSamples = samples;
+ mFixedSampleLocations = fixedSampleLocations;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::onDestroy(const gl::Context *context)
+{
+ return angle::Result::Continue;
+}
+
+TextureStorage11_2DMultisampleArray::~TextureStorage11_2DMultisampleArray() {}
+
+angle::Result TextureStorage11_2DMultisampleArray::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::getResource(const gl::Context *context,
+ const TextureHelper11 **outResource)
+{
+ ANGLE_TRY(ensureTextureExists(context, 1));
+
+ *outResource = &mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::ensureTextureExists(const gl::Context *context,
+ int mipLevels)
+{
+ // For multisampled textures, mipLevels always equals 1.
+ ASSERT(mipLevels == 1);
+
+ // if the width or height is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (!mTexture.valid() && mTextureWidth > 0 && mTextureHeight > 0)
+ {
+ D3D11_TEXTURE2D_DESC desc;
+ ZeroMemory(&desc, sizeof(desc));
+ desc.Width = mTextureWidth;
+ desc.Height = mTextureHeight;
+ desc.MipLevels = mipLevels;
+ desc.ArraySize = mTextureDepth;
+ desc.Format = mFormatInfo.texFormat;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = getBindFlags() & ~D3D11_BIND_UNORDERED_ACCESS;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = getMiscFlags();
+
+ const gl::TextureCaps &textureCaps =
+ mRenderer->getNativeTextureCaps().get(mFormatInfo.internalFormat);
+ GLuint supportedSamples = textureCaps.getNearestSamples(mSamples);
+ desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
+ desc.SampleDesc.Quality = static_cast<UINT>(D3D11_STANDARD_MULTISAMPLE_PATTERN);
+
+ ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
+ &mTexture));
+ mTexture.setDebugName("TexStorage2DMSArray.Texture");
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::createRenderTargetSRV(
+ const gl::Context *context,
+ const TextureHelper11 &texture,
+ const gl::ImageIndex &index,
+ DXGI_FORMAT resourceFormat,
+ d3d11::SharedSRV *srv) const
+{
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = resourceFormat;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY;
+ srvDesc.Texture2DMSArray.FirstArraySlice = index.getLayerIndex();
+ srvDesc.Texture2DMSArray.ArraySize = index.getLayerCount();
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), srv));
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(index.hasLayer());
+
+ const int mipLevel = index.getLevelIndex();
+ ASSERT(mipLevel == 0);
+ const int layer = index.getLayerIndex();
+ const int numLayers = index.getLayerCount();
+
+ ASSERT(mipLevel >= 0 && mipLevel < getLevelCount());
+
+ TextureStorage11_2DArray::LevelLayerRangeKey key(mipLevel, layer, numLayers);
+ if (mRenderTargets.find(key) == mRenderTargets.end())
+ {
+ const TextureHelper11 *texture = nullptr;
+ ANGLE_TRY(getResource(context, &texture));
+ d3d11::SharedSRV srv;
+ ANGLE_TRY(createRenderTargetSRV(context, *texture, index, mFormatInfo.srvFormat, &srv));
+ d3d11::SharedSRV blitSRV;
+ if (mFormatInfo.blitSRVFormat != mFormatInfo.srvFormat)
+ {
+ ANGLE_TRY(createRenderTargetSRV(context, *texture, index, mFormatInfo.blitSRVFormat,
+ &blitSRV));
+ }
+ else
+ {
+ blitSRV = srv.makeCopy();
+ }
+
+ srv.setDebugName("TexStorage2DMSArray.RenderTargetSRV");
+
+ if (mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+ rtvDesc.Format = mFormatInfo.rtvFormat;
+ rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY;
+ rtvDesc.Texture2DMSArray.FirstArraySlice = layer;
+ rtvDesc.Texture2DMSArray.ArraySize = numLayers;
+
+ d3d11::RenderTargetView rtv;
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), rtvDesc,
+ texture->get(), &rtv));
+ rtv.setDebugName("TexStorage2DMSArray.RenderTargetRTV");
+
+ mRenderTargets[key].reset(new TextureRenderTarget11(
+ std::move(rtv), *texture, srv, blitSRV, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1, mSamples));
+ }
+ else
+ {
+ ASSERT(mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
+
+ D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+ dsvDesc.Format = mFormatInfo.dsvFormat;
+ dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY;
+ dsvDesc.Texture2DMSArray.FirstArraySlice = layer;
+ dsvDesc.Texture2DMSArray.ArraySize = numLayers;
+ dsvDesc.Flags = 0;
+
+ d3d11::DepthStencilView dsv;
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), dsvDesc,
+ texture->get(), &dsv));
+ dsv.setDebugName("TexStorage2DMSArray.RenderTargetDSV");
+
+ mRenderTargets[key].reset(new TextureRenderTarget11(
+ std::move(dsv), *texture, srv, mFormatInfo.internalFormat, getFormatSet(),
+ getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1, mSamples));
+ }
+ }
+
+ ASSERT(outRT);
+ *outRT = mRenderTargets[key].get();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::createSRVForSampler(
+ const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV)
+{
+ ASSERT(outSRV);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+ srvDesc.Format = format;
+ srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY;
+ srvDesc.Texture2DMSArray.FirstArraySlice = 0;
+ srvDesc.Texture2DMSArray.ArraySize = mTextureDepth;
+
+ ANGLE_TRY(
+ mRenderer->allocateResource(GetImplAs<Context11>(context), srvDesc, texture.get(), outSRV));
+ outSRV->setDebugName("TexStorage2DMSArray.SRV");
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::getSwizzleTexture(
+ const gl::Context *context,
+ const TextureHelper11 **outTexture)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::getSwizzleRenderTarget(
+ const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage11_2DMultisampleArray::ensureDropStencilTexture(
+ const gl::Context *context,
+ DropStencil *dropStencilOut)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
+ return angle::Result::Stop;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
new file mode 100644
index 0000000000..f49bd08acd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
@@ -0,0 +1,827 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage11.h: Defines the abstract rx::TextureStorage11 class and its concrete derived
+// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11
+// texture.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_TEXTURESTORAGE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_TEXTURESTORAGE11_H_
+
+#include "libANGLE/Error.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/renderer/d3d/TextureStorage.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+#include <array>
+#include <map>
+
+namespace gl
+{
+class ImageIndex;
+} // namespace gl
+
+namespace rx
+{
+class EGLImageD3D;
+class RenderTargetD3D;
+class RenderTarget11;
+class Renderer11;
+class SwapChain11;
+class Image11;
+struct Renderer11DeviceCaps;
+
+template <typename T>
+using CubeFaceArray = std::array<T, gl::kCubeFaceCount>;
+
+class TextureStorage11 : public TextureStorage
+{
+ public:
+ ~TextureStorage11() override;
+
+ static DWORD GetTextureBindFlags(GLenum internalFormat,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ bool renderTarget);
+ static DWORD GetTextureMiscFlags(GLenum internalFormat,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ bool renderTarget,
+ int levels);
+
+ UINT getBindFlags() const;
+ UINT getMiscFlags() const;
+ const d3d11::Format &getFormatSet() const;
+ angle::Result getSRVLevels(const gl::Context *context,
+ GLint baseLevel,
+ GLint maxLevel,
+ const d3d11::SharedSRV **outSRV);
+ angle::Result generateSwizzles(const gl::Context *context,
+ const gl::SwizzleState &swizzleTarget);
+ void markLevelDirty(int mipLevel);
+ void markDirty();
+
+ angle::Result updateSubresourceLevel(const gl::Context *context,
+ const TextureHelper11 &texture,
+ unsigned int sourceSubresource,
+ const gl::ImageIndex &index,
+ const gl::Box &copyArea);
+
+ angle::Result copySubresourceLevel(const gl::Context *context,
+ const TextureHelper11 &dstTexture,
+ unsigned int dstSubresource,
+ const gl::ImageIndex &index,
+ const gl::Box &region);
+
+ // TextureStorage virtual functions
+ int getTopLevel() const override;
+ bool isRenderTarget() const override;
+ bool isManaged() const override;
+ bool supportsNativeMipmapFunction() const override;
+ int getLevelCount() const override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+ angle::Result setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData) override;
+ void invalidateTextures() override;
+
+ virtual angle::Result getSRVForSampler(const gl::Context *context,
+ const gl::TextureState &textureState,
+ const gl::SamplerState &sampler,
+ const d3d11::SharedSRV **outSRV);
+ angle::Result getSRVForImage(const gl::Context *context,
+ const gl::ImageUnit &imageUnit,
+ const d3d11::SharedSRV **outSRV);
+ angle::Result getUAVForImage(const gl::Context *context,
+ const gl::ImageUnit &imageUnit,
+ const d3d11::SharedUAV **outUAV);
+ virtual angle::Result getSubresourceIndex(const gl::Context *context,
+ const gl::ImageIndex &index,
+ UINT *outSubresourceIndex) const;
+ virtual angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) = 0;
+ virtual void associateImage(Image11 *image, const gl::ImageIndex &index) = 0;
+ virtual void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) = 0;
+ virtual void verifyAssociatedImageValid(const gl::ImageIndex &index,
+ Image11 *expectedImage) = 0;
+ virtual angle::Result releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage) = 0;
+
+ protected:
+ TextureStorage11(Renderer11 *renderer, UINT bindFlags, UINT miscFlags, GLenum internalFormat);
+ int getLevelWidth(int mipLevel) const;
+ int getLevelHeight(int mipLevel) const;
+ int getLevelDepth(int mipLevel) const;
+
+ // Some classes (e.g. TextureStorage11_2D) will override getMippedResource.
+ virtual angle::Result getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource);
+
+ virtual angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) = 0;
+ virtual angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) = 0;
+ angle::Result getSRVLevel(const gl::Context *context,
+ int mipLevel,
+ bool blitSRV,
+ const d3d11::SharedSRV **outSRV);
+
+ // Get a version of a depth texture with only depth information, not stencil.
+ enum DropStencil
+ {
+ CREATED,
+ ALREADY_EXISTS
+ };
+ virtual angle::Result ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut);
+ angle::Result initDropStencilTexture(const gl::Context *context,
+ const gl::ImageIndexIterator &it);
+
+ // The baseLevel parameter should *not* have mTopLevel applied.
+ virtual angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) = 0;
+ virtual angle::Result createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) = 0;
+ virtual angle::Result createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV) = 0;
+
+ void verifySwizzleExists(const gl::SwizzleState &swizzleState);
+
+ // Clear all cached non-swizzle SRVs and invalidate the swizzle cache.
+ void clearSRVCache();
+
+ Renderer11 *mRenderer;
+ int mTopLevel;
+ unsigned int mMipLevels;
+
+ const d3d11::Format &mFormatInfo;
+ unsigned int mTextureWidth;
+ unsigned int mTextureHeight;
+ unsigned int mTextureDepth;
+
+ gl::TexLevelArray<gl::SwizzleState> mSwizzleCache;
+ TextureHelper11 mDropStencilTexture;
+
+ private:
+ const UINT mBindFlags;
+ const UINT mMiscFlags;
+
+ struct SamplerKey
+ {
+ SamplerKey();
+ SamplerKey(int baseLevel, int mipLevels, bool swizzle, bool dropStencil);
+
+ bool operator<(const SamplerKey &rhs) const;
+
+ int baseLevel;
+ int mipLevels;
+ bool swizzle;
+ bool dropStencil;
+ };
+
+ angle::Result getCachedOrCreateSRVForSampler(const gl::Context *context,
+ const SamplerKey &key,
+ const d3d11::SharedSRV **outSRV);
+
+ using SRVCacheForSampler = std::map<SamplerKey, d3d11::SharedSRV>;
+ SRVCacheForSampler mSrvCacheForSampler;
+
+ struct ImageKey
+ {
+ ImageKey();
+ ImageKey(int level, bool layered, int layer, GLenum access, GLenum format);
+ bool operator<(const ImageKey &rhs) const;
+ int level;
+ bool layered;
+ int layer;
+ GLenum access;
+ GLenum format;
+ };
+
+ angle::Result getCachedOrCreateSRVForImage(const gl::Context *context,
+ const ImageKey &key,
+ const d3d11::SharedSRV **outSRV);
+ angle::Result getCachedOrCreateUAVForImage(const gl::Context *context,
+ const ImageKey &key,
+ const d3d11::SharedUAV **outUAV);
+
+ using SRVCacheForImage = std::map<ImageKey, d3d11::SharedSRV>;
+ SRVCacheForImage mSrvCacheForImage;
+ using UAVCacheForImage = std::map<ImageKey, d3d11::SharedUAV>;
+ UAVCacheForImage mUavCacheForImage;
+
+ gl::TexLevelArray<d3d11::SharedSRV> mLevelSRVs;
+ gl::TexLevelArray<d3d11::SharedSRV> mLevelBlitSRVs;
+};
+
+class TextureStorage11_2D : public TextureStorage11
+{
+ public:
+ TextureStorage11_2D(Renderer11 *renderer, SwapChain11 *swapchain);
+ TextureStorage11_2D(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ bool hintLevelZeroOnly = false);
+ ~TextureStorage11_2D() override;
+
+ angle::Result onDestroy(const gl::Context *context) override;
+
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ void associateImage(Image11 *image, const gl::ImageIndex &index) override;
+ void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ angle::Result releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage) override;
+
+ angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture) override;
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ angle::Result ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut) override;
+
+ angle::Result ensureTextureExists(const gl::Context *context, int mipLevels);
+
+ private:
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV) override;
+
+ TextureHelper11 mTexture;
+ gl::TexLevelArray<std::unique_ptr<RenderTarget11>> mRenderTarget;
+ bool mHasKeyedMutex;
+
+ // These are members related to the zero max-LOD workaround.
+ // D3D11 Feature Level 9_3 can't disable mipmaps on a mipmapped texture (i.e. solely sample from
+ // level zero). These members are used to work around this limitation. Usually only mTexture XOR
+ // mLevelZeroTexture will exist. For example, if an app creates a texture with only one level,
+ // then 9_3 will only create mLevelZeroTexture. However, in some scenarios, both textures have
+ // to be created. This incurs additional memory overhead. One example of this is an application
+ // that creates a texture, calls glGenerateMipmap, and then disables mipmaps on the texture. A
+ // more likely example is an app that creates an empty texture, renders to it, and then calls
+ // glGenerateMipmap
+ // TODO: In this rendering scenario, release the mLevelZeroTexture after mTexture has been
+ // created to save memory.
+ TextureHelper11 mLevelZeroTexture;
+ std::unique_ptr<RenderTarget11> mLevelZeroRenderTarget;
+ bool mUseLevelZeroTexture;
+
+ // Swizzle-related variables
+ TextureHelper11 mSwizzleTexture;
+ gl::TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
+
+ gl::TexLevelArray<Image11 *> mAssociatedImages;
+};
+
+class TextureStorage11_External : public TextureStorage11
+{
+ public:
+ TextureStorage11_External(Renderer11 *renderer,
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &glDesc);
+ ~TextureStorage11_External() override;
+
+ angle::Result onDestroy(const gl::Context *context) override;
+
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ void associateImage(Image11 *image, const gl::ImageIndex &index) override;
+ void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ angle::Result releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage) override;
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ private:
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV) override;
+
+ TextureHelper11 mTexture;
+ int mSubresourceIndex;
+ bool mHasKeyedMutex;
+
+ Image11 *mAssociatedImage;
+};
+
+// A base class for texture storage classes where the associated images are not changed, nor are
+// they accessible as images in GLES3.1+ shaders.
+class TextureStorage11ImmutableBase : public TextureStorage11
+{
+ public:
+ TextureStorage11ImmutableBase(Renderer11 *renderer,
+ UINT bindFlags,
+ UINT miscFlags,
+ GLenum internalFormat);
+
+ void associateImage(Image11 *image, const gl::ImageIndex &index) override;
+ void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ angle::Result releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage) override;
+
+ angle::Result createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV) override;
+};
+
+class TextureStorage11_EGLImage final : public TextureStorage11ImmutableBase
+{
+ public:
+ TextureStorage11_EGLImage(Renderer11 *renderer,
+ EGLImageD3D *eglImage,
+ RenderTarget11 *renderTarget11);
+ ~TextureStorage11_EGLImage() override;
+
+ angle::Result getSubresourceIndex(const gl::Context *context,
+ const gl::ImageIndex &index,
+ UINT *outSubresourceIndex) const override;
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getSRVForSampler(const gl::Context *context,
+ const gl::TextureState &textureState,
+ const gl::SamplerState &sampler,
+ const d3d11::SharedSRV **outSRV) override;
+ angle::Result getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture) override;
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ private:
+ // Check if the EGL image's render target has been updated due to orphaning and delete
+ // any SRVs and other resources based on the image's old render target.
+ angle::Result checkForUpdatedRenderTarget(const gl::Context *context);
+
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+
+ angle::Result getImageRenderTarget(const gl::Context *context, RenderTarget11 **outRT) const;
+
+ EGLImageD3D *mImage;
+ uintptr_t mCurrentRenderTarget;
+
+ // Swizzle-related variables
+ TextureHelper11 mSwizzleTexture;
+ std::vector<d3d11::RenderTargetView> mSwizzleRenderTargets;
+};
+
+class TextureStorage11_Cube : public TextureStorage11
+{
+ public:
+ TextureStorage11_Cube(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly);
+ ~TextureStorage11_Cube() override;
+
+ angle::Result onDestroy(const gl::Context *context) override;
+
+ angle::Result getSubresourceIndex(const gl::Context *context,
+ const gl::ImageIndex &index,
+ UINT *outSubresourceIndex) const override;
+
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getMippedResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ void associateImage(Image11 *image, const gl::ImageIndex &index) override;
+ void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ angle::Result releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage) override;
+
+ angle::Result useLevelZeroWorkaroundTexture(const gl::Context *context,
+ bool useLevelZeroTexture) override;
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ angle::Result ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut) override;
+
+ angle::Result ensureTextureExists(const gl::Context *context, int mipLevels);
+
+ private:
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV) override;
+ angle::Result createRenderTargetSRV(const gl::Context *context,
+ const TextureHelper11 &texture,
+ const gl::ImageIndex &index,
+ DXGI_FORMAT resourceFormat,
+ d3d11::SharedSRV *srv) const;
+
+ TextureHelper11 mTexture;
+ CubeFaceArray<gl::TexLevelArray<std::unique_ptr<RenderTarget11>>> mRenderTarget;
+
+ // Level-zero workaround members. See TextureStorage11_2D's workaround members for a
+ // description.
+ TextureHelper11 mLevelZeroTexture;
+ CubeFaceArray<std::unique_ptr<RenderTarget11>> mLevelZeroRenderTarget;
+ bool mUseLevelZeroTexture;
+
+ TextureHelper11 mSwizzleTexture;
+ gl::TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
+
+ CubeFaceArray<gl::TexLevelArray<Image11 *>> mAssociatedImages;
+};
+
+class TextureStorage11_3D : public TextureStorage11
+{
+ public:
+ TextureStorage11_3D(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels);
+ ~TextureStorage11_3D() override;
+
+ angle::Result onDestroy(const gl::Context *context) override;
+
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+
+ // Handles both layer and non-layer RTs
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ void associateImage(Image11 *image, const gl::ImageIndex &index) override;
+ void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ angle::Result releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage) override;
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ private:
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV) override;
+
+ typedef std::pair<int, int> LevelLayerKey;
+ std::map<LevelLayerKey, std::unique_ptr<RenderTarget11>> mLevelLayerRenderTargets;
+
+ gl::TexLevelArray<std::unique_ptr<RenderTarget11>> mLevelRenderTargets;
+
+ TextureHelper11 mTexture;
+ TextureHelper11 mSwizzleTexture;
+ gl::TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
+
+ gl::TexLevelArray<Image11 *> mAssociatedImages;
+};
+
+class TextureStorage11_2DArray : public TextureStorage11
+{
+ public:
+ TextureStorage11_2DArray(Renderer11 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels);
+ ~TextureStorage11_2DArray() override;
+
+ angle::Result onDestroy(const gl::Context *context) override;
+
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ void associateImage(Image11 *image, const gl::ImageIndex &index) override;
+ void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ void verifyAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
+ angle::Result releaseAssociatedImage(const gl::Context *context,
+ const gl::ImageIndex &index,
+ Image11 *incomingImage) override;
+
+ struct LevelLayerRangeKey
+ {
+ LevelLayerRangeKey(int mipLevelIn, int layerIn, int numLayersIn)
+ : mipLevel(mipLevelIn), layer(layerIn), numLayers(numLayersIn)
+ {}
+ bool operator<(const LevelLayerRangeKey &other) const
+ {
+ if (mipLevel != other.mipLevel)
+ {
+ return mipLevel < other.mipLevel;
+ }
+ if (layer != other.layer)
+ {
+ return layer < other.layer;
+ }
+ return numLayers < other.numLayers;
+ }
+ int mipLevel;
+ int layer;
+ int numLayers;
+ };
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ angle::Result ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut) override;
+
+ private:
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createSRVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+ angle::Result createUAVForImage(const gl::Context *context,
+ int level,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedUAV *outUAV) override;
+ angle::Result createRenderTargetSRV(const gl::Context *context,
+ const TextureHelper11 &texture,
+ const gl::ImageIndex &index,
+ DXGI_FORMAT resourceFormat,
+ d3d11::SharedSRV *srv) const;
+
+ std::map<LevelLayerRangeKey, std::unique_ptr<RenderTarget11>> mRenderTargets;
+
+ TextureHelper11 mTexture;
+
+ TextureHelper11 mSwizzleTexture;
+ gl::TexLevelArray<d3d11::RenderTargetView> mSwizzleRenderTargets;
+
+ typedef std::map<LevelLayerRangeKey, Image11 *> ImageMap;
+ ImageMap mAssociatedImages;
+};
+
+class TextureStorage11_2DMultisample final : public TextureStorage11ImmutableBase
+{
+ public:
+ TextureStorage11_2DMultisample(Renderer11 *renderer,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ int samples,
+ bool fixedSampleLocations);
+ ~TextureStorage11_2DMultisample() override;
+
+ angle::Result onDestroy(const gl::Context *context) override;
+
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ angle::Result ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut) override;
+
+ angle::Result ensureTextureExists(const gl::Context *context, int mipLevels);
+
+ private:
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+
+ TextureHelper11 mTexture;
+ std::unique_ptr<RenderTarget11> mRenderTarget;
+
+ unsigned int mSamples;
+ GLboolean mFixedSampleLocations;
+};
+
+class TextureStorage11_2DMultisampleArray final : public TextureStorage11ImmutableBase
+{
+ public:
+ TextureStorage11_2DMultisampleArray(Renderer11 *renderer,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels,
+ int samples,
+ bool fixedSampleLocations);
+ ~TextureStorage11_2DMultisampleArray() override;
+
+ angle::Result onDestroy(const gl::Context *context) override;
+
+ angle::Result getResource(const gl::Context *context,
+ const TextureHelper11 **outResource) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ protected:
+ angle::Result getSwizzleTexture(const gl::Context *context,
+ const TextureHelper11 **outTexture) override;
+ angle::Result getSwizzleRenderTarget(const gl::Context *context,
+ int mipLevel,
+ const d3d11::RenderTargetView **outRTV) override;
+
+ angle::Result ensureDropStencilTexture(const gl::Context *context,
+ DropStencil *dropStencilOut) override;
+
+ angle::Result ensureTextureExists(const gl::Context *context, int mipLevels);
+
+ private:
+ angle::Result createRenderTargetSRV(const gl::Context *context,
+ const TextureHelper11 &texture,
+ const gl::ImageIndex &index,
+ DXGI_FORMAT resourceFormat,
+ d3d11::SharedSRV *srv) const;
+
+ angle::Result createSRVForSampler(const gl::Context *context,
+ int baseLevel,
+ int mipLevels,
+ DXGI_FORMAT format,
+ const TextureHelper11 &texture,
+ d3d11::SharedSRV *outSRV) override;
+
+ TextureHelper11 mTexture;
+ std::map<TextureStorage11_2DArray::LevelLayerRangeKey, std::unique_ptr<RenderTarget11>>
+ mRenderTargets;
+
+ unsigned int mSamples;
+ GLboolean mFixedSampleLocations;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_TEXTURESTORAGE11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp
new file mode 100644
index 0000000000..1dcd62cd45
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp
@@ -0,0 +1,131 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TransformFeedbackD3D.cpp is a no-op implementation for both the D3D9 and D3D11 renderers.
+
+#include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h"
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+
+namespace rx
+{
+
+TransformFeedback11::TransformFeedback11(const gl::TransformFeedbackState &state,
+ Renderer11 *renderer)
+ : TransformFeedbackImpl(state),
+ mRenderer(renderer),
+ mIsDirty(true),
+ mBuffers(state.getIndexedBuffers().size(), nullptr),
+ mBufferOffsets(state.getIndexedBuffers().size(), 0),
+ mSerial(mRenderer->generateSerial())
+{}
+
+TransformFeedback11::~TransformFeedback11() {}
+
+angle::Result TransformFeedback11::begin(const gl::Context *context,
+ gl::PrimitiveMode primitiveMode)
+{
+ // Reset all the cached offsets to the binding offsets
+ mIsDirty = true;
+ for (size_t bindingIdx = 0; bindingIdx < mBuffers.size(); bindingIdx++)
+ {
+ const auto &binding = mState.getIndexedBuffer(bindingIdx);
+ if (binding.get() != nullptr)
+ {
+ mBufferOffsets[bindingIdx] = static_cast<UINT>(binding.getOffset());
+ }
+ else
+ {
+ mBufferOffsets[bindingIdx] = 0;
+ }
+ }
+ mRenderer->getStateManager()->invalidateTransformFeedback();
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback11::end(const gl::Context *context)
+{
+ mRenderer->getStateManager()->invalidateTransformFeedback();
+ if (mRenderer->getFeatures().flushAfterEndingTransformFeedback.enabled)
+ {
+ mRenderer->getDeviceContext()->Flush();
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback11::pause(const gl::Context *context)
+{
+ mRenderer->getStateManager()->invalidateTransformFeedback();
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback11::resume(const gl::Context *context)
+{
+ mRenderer->getStateManager()->invalidateTransformFeedback();
+ return angle::Result::Continue;
+}
+
+angle::Result TransformFeedback11::bindIndexedBuffer(
+ const gl::Context *context,
+ size_t index,
+ const gl::OffsetBindingPointer<gl::Buffer> &binding)
+{
+ mIsDirty = true;
+ mBufferOffsets[index] = static_cast<UINT>(binding.getOffset());
+ mRenderer->getStateManager()->invalidateTransformFeedback();
+ return angle::Result::Continue;
+}
+
+void TransformFeedback11::onApply()
+{
+ mIsDirty = false;
+
+ // Change all buffer offsets to -1 so that if any of them need to be re-applied, the are set to
+ // append
+ std::fill(mBufferOffsets.begin(), mBufferOffsets.end(), -1);
+}
+
+bool TransformFeedback11::isDirty() const
+{
+ return mIsDirty;
+}
+
+UINT TransformFeedback11::getNumSOBuffers() const
+{
+ return static_cast<UINT>(mBuffers.size());
+}
+
+angle::Result TransformFeedback11::getSOBuffers(const gl::Context *context,
+ const std::vector<ID3D11Buffer *> **buffersOut)
+{
+ for (size_t bindingIdx = 0; bindingIdx < mBuffers.size(); bindingIdx++)
+ {
+ const auto &binding = mState.getIndexedBuffer(bindingIdx);
+ if (binding.get() != nullptr)
+ {
+ Buffer11 *storage = GetImplAs<Buffer11>(binding.get());
+ ANGLE_TRY(storage->getBuffer(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK,
+ &mBuffers[bindingIdx]));
+ }
+ }
+
+ *buffersOut = &mBuffers;
+ return angle::Result::Continue;
+}
+
+const std::vector<UINT> &TransformFeedback11::getSOBufferOffsets() const
+{
+ return mBufferOffsets;
+}
+
+Serial TransformFeedback11::getSerial() const
+{
+ return mSerial;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h
new file mode 100644
index 0000000000..2100316b85
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h
@@ -0,0 +1,61 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TransformFeedback11.h: Implements the abstract rx::TransformFeedbackImpl class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_TRANSFORMFEEDBACK11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_TRANSFORMFEEDBACK11_H_
+
+#include "common/platform.h"
+
+#include "libANGLE/Error.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/TransformFeedbackImpl.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace rx
+{
+
+class Renderer11;
+
+class TransformFeedback11 : public TransformFeedbackImpl
+{
+ public:
+ TransformFeedback11(const gl::TransformFeedbackState &state, Renderer11 *renderer);
+ ~TransformFeedback11() override;
+
+ angle::Result begin(const gl::Context *context, gl::PrimitiveMode primitiveMode) override;
+ angle::Result end(const gl::Context *context) override;
+ angle::Result pause(const gl::Context *context) override;
+ angle::Result resume(const gl::Context *context) override;
+
+ angle::Result bindIndexedBuffer(const gl::Context *context,
+ size_t index,
+ const gl::OffsetBindingPointer<gl::Buffer> &binding) override;
+
+ void onApply();
+
+ bool isDirty() const;
+
+ UINT getNumSOBuffers() const;
+ angle::Result getSOBuffers(const gl::Context *context,
+ const std::vector<ID3D11Buffer *> **buffersOut);
+ const std::vector<UINT> &getSOBufferOffsets() const;
+
+ Serial getSerial() const;
+
+ private:
+ Renderer11 *mRenderer;
+
+ bool mIsDirty;
+ std::vector<ID3D11Buffer *> mBuffers;
+ std::vector<UINT> mBufferOffsets;
+
+ Serial mSerial;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_TRANSFORMFEEDBACK11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp
new file mode 100644
index 0000000000..c5b5d697ba
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp
@@ -0,0 +1,103 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Trim11.cpp: Trim support utility class.
+
+#include "libANGLE/renderer/d3d/d3d11/Trim11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+# include <windows.applicationmodel.core.h>
+# include <wrl.h>
+# include <wrl/wrappers/corewrappers.h>
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Wrappers;
+using namespace ABI::Windows::ApplicationModel;
+using namespace ABI::Windows::ApplicationModel::Core;
+using namespace ABI::Windows::Foundation;
+using namespace ABI::Windows::Foundation::Collections;
+#endif
+
+namespace rx
+{
+
+Trim11::Trim11(rx::Renderer11 *renderer) : mRenderer(renderer)
+{
+ bool result = true;
+ result = registerForRendererTrimRequest();
+ ASSERT(result);
+}
+
+Trim11::~Trim11()
+{
+ unregisterForRendererTrimRequest();
+}
+
+void Trim11::trim()
+{
+ if (!mRenderer)
+ {
+ return;
+ }
+
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ ID3D11Device *device = mRenderer->getDevice();
+ IDXGIDevice3 *dxgiDevice3 = d3d11::DynamicCastComObject<IDXGIDevice3>(device);
+ if (dxgiDevice3)
+ {
+ dxgiDevice3->Trim();
+ }
+ SafeRelease(dxgiDevice3);
+#endif
+}
+
+bool Trim11::registerForRendererTrimRequest()
+{
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ ICoreApplication *coreApplication = nullptr;
+ HRESULT result = GetActivationFactory(
+ HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
+ &coreApplication);
+ if (SUCCEEDED(result))
+ {
+ auto suspendHandler = Callback<IEventHandler<SuspendingEventArgs *>>(
+ [this](IInspectable *, ISuspendingEventArgs *) -> HRESULT {
+ trim();
+ return S_OK;
+ });
+ result =
+ coreApplication->add_Suspending(suspendHandler.Get(), &mApplicationSuspendedEventToken);
+ }
+ SafeRelease(coreApplication);
+
+ if (FAILED(result))
+ {
+ return false;
+ }
+#endif
+ return true;
+}
+
+void Trim11::unregisterForRendererTrimRequest()
+{
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (mApplicationSuspendedEventToken.value != 0)
+ {
+ ICoreApplication *coreApplication = nullptr;
+ if (SUCCEEDED(GetActivationFactory(
+ HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
+ &coreApplication)))
+ {
+ coreApplication->remove_Suspending(mApplicationSuspendedEventToken);
+ }
+ mApplicationSuspendedEventToken.value = 0;
+ SafeRelease(coreApplication);
+ }
+#endif
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.h
new file mode 100644
index 0000000000..6949f6343d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.h
@@ -0,0 +1,43 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Trim11.h: Trim support utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/angletypes.h"
+
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+# include <EventToken.h>
+#endif
+
+namespace rx
+{
+class Renderer11;
+
+class Trim11 : angle::NonCopyable
+{
+ public:
+ explicit Trim11(Renderer11 *renderer);
+ ~Trim11();
+
+ private:
+ Renderer11 *mRenderer;
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ EventRegistrationToken mApplicationSuspendedEventToken;
+#endif
+
+ void trim();
+ bool registerForRendererTrimRequest();
+ void unregisterForRendererTrimRequest();
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
new file mode 100644
index 0000000000..8fbb77a308
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
@@ -0,0 +1,364 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// VertexArray11:
+// Implementation of rx::VertexArray11.
+//
+
+#include "libANGLE/renderer/d3d/d3d11/VertexArray11.h"
+
+#include "common/bitset_utils.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/IndexBuffer.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+
+using namespace angle;
+
+namespace rx
+{
+VertexArray11::VertexArray11(const gl::VertexArrayState &data)
+ : VertexArrayImpl(data),
+ mAttributeStorageTypes(data.getMaxAttribs(), VertexStorageType::CURRENT_VALUE),
+ mTranslatedAttribs(data.getMaxAttribs()),
+ mAppliedNumViewsToDivisor(1),
+ mCurrentElementArrayStorage(IndexStorageType::Invalid),
+ mCachedDestinationIndexType(gl::DrawElementsType::InvalidEnum)
+{}
+
+VertexArray11::~VertexArray11() {}
+
+void VertexArray11::destroy(const gl::Context *context) {}
+
+// As VertexAttribPointer can modify both attribute and binding, we should also set other attributes
+// that are also using this binding dirty.
+#define ANGLE_VERTEX_DIRTY_ATTRIB_FUNC(INDEX) \
+ case gl::VertexArray::DIRTY_BIT_ATTRIB_0 + INDEX: \
+ if ((*attribBits)[INDEX][gl::VertexArray::DirtyAttribBitType::DIRTY_ATTRIB_POINTER]) \
+ { \
+ attributesToUpdate |= mState.getBindingToAttributesMask(INDEX); \
+ } \
+ else \
+ { \
+ attributesToUpdate.set(INDEX); \
+ } \
+ invalidateVertexBuffer = true; \
+ (*attribBits)[INDEX].reset(); \
+ break;
+
+#define ANGLE_VERTEX_DIRTY_BINDING_FUNC(INDEX) \
+ case gl::VertexArray::DIRTY_BIT_BINDING_0 + INDEX: \
+ attributesToUpdate |= mState.getBindingToAttributesMask(INDEX); \
+ invalidateVertexBuffer = true; \
+ (*bindingBits)[INDEX].reset(); \
+ break;
+
+#define ANGLE_VERTEX_DIRTY_BUFFER_DATA_FUNC(INDEX) \
+ case gl::VertexArray::DIRTY_BIT_BUFFER_DATA_0 + INDEX: \
+ if (mAttributeStorageTypes[INDEX] == VertexStorageType::STATIC) \
+ { \
+ invalidateVertexBuffer = true; \
+ mAttribsToTranslate.set(INDEX); \
+ } \
+ break;
+
+angle::Result VertexArray11::syncState(const gl::Context *context,
+ const gl::VertexArray::DirtyBits &dirtyBits,
+ gl::VertexArray::DirtyAttribBitsArray *attribBits,
+ gl::VertexArray::DirtyBindingBitsArray *bindingBits)
+{
+ ASSERT(dirtyBits.any());
+
+ Renderer11 *renderer = GetImplAs<Context11>(context)->getRenderer();
+ StateManager11 *stateManager = renderer->getStateManager();
+
+ // Generate a state serial. This serial is used in the program class to validate the cached
+ // input layout, and skip recomputation in the fast path.
+ mCurrentStateSerial = renderer->generateSerial();
+
+ bool invalidateVertexBuffer = false;
+
+ gl::AttributesMask attributesToUpdate;
+
+ // Make sure we trigger re-translation for static index or vertex data.
+ for (size_t dirtyBit : dirtyBits)
+ {
+ switch (dirtyBit)
+ {
+ case gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER:
+ case gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA:
+ {
+ mLastDrawElementsType.reset();
+ mLastDrawElementsIndices.reset();
+ mLastPrimitiveRestartEnabled.reset();
+ mCachedIndexInfo.reset();
+ break;
+ }
+
+ ANGLE_VERTEX_INDEX_CASES(ANGLE_VERTEX_DIRTY_ATTRIB_FUNC)
+ ANGLE_VERTEX_INDEX_CASES(ANGLE_VERTEX_DIRTY_BINDING_FUNC)
+ ANGLE_VERTEX_INDEX_CASES(ANGLE_VERTEX_DIRTY_BUFFER_DATA_FUNC)
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+
+ for (size_t attribIndex : attributesToUpdate)
+ {
+ updateVertexAttribStorage(context, stateManager, attribIndex);
+ }
+
+ if (invalidateVertexBuffer)
+ {
+ // TODO(jmadill): Individual attribute invalidation.
+ stateManager->invalidateVertexBuffer();
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result VertexArray11::syncStateForDraw(const gl::Context *context,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLsizei instances,
+ GLint baseVertex)
+{
+ Renderer11 *renderer = GetImplAs<Context11>(context)->getRenderer();
+ StateManager11 *stateManager = renderer->getStateManager();
+
+ const gl::State &glState = context->getState();
+ const gl::Program *program = glState.getProgram();
+ ASSERT(program);
+ mAppliedNumViewsToDivisor = (program->usesMultiview() ? program->getNumViews() : 1);
+
+ if (mAttribsToTranslate.any())
+ {
+ const gl::AttributesMask &activeLocations =
+ glState.getProgram()->getActiveAttribLocationsMask();
+ gl::AttributesMask activeDirtyAttribs = (mAttribsToTranslate & activeLocations);
+ if (activeDirtyAttribs.any())
+ {
+ ANGLE_TRY(updateDirtyAttribs(context, activeDirtyAttribs));
+ stateManager->invalidateInputLayout();
+ }
+ }
+
+ if (mDynamicAttribsMask.any())
+ {
+ const gl::AttributesMask &activeLocations =
+ glState.getProgram()->getActiveAttribLocationsMask();
+ gl::AttributesMask activeDynamicAttribs = (mDynamicAttribsMask & activeLocations);
+
+ if (activeDynamicAttribs.any())
+ {
+ ANGLE_TRY(updateDynamicAttribs(context, stateManager->getVertexDataManager(),
+ firstVertex, vertexOrIndexCount, indexTypeOrInvalid,
+ indices, instances, baseVertex, activeDynamicAttribs));
+ stateManager->invalidateInputLayout();
+ }
+ }
+
+ if (indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum)
+ {
+ bool restartEnabled = context->getState().isPrimitiveRestartEnabled();
+ if (!mLastDrawElementsType.valid() || mLastDrawElementsType.value() != indexTypeOrInvalid ||
+ mLastDrawElementsIndices.value() != indices ||
+ mLastPrimitiveRestartEnabled.value() != restartEnabled)
+ {
+ mLastDrawElementsType = indexTypeOrInvalid;
+ mLastDrawElementsIndices = indices;
+ mLastPrimitiveRestartEnabled = restartEnabled;
+
+ ANGLE_TRY(updateElementArrayStorage(context, vertexOrIndexCount, indexTypeOrInvalid,
+ indices, restartEnabled));
+ stateManager->invalidateIndexBuffer();
+ }
+ else if (mCurrentElementArrayStorage == IndexStorageType::Dynamic)
+ {
+ stateManager->invalidateIndexBuffer();
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result VertexArray11::updateElementArrayStorage(const gl::Context *context,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ bool restartEnabled)
+{
+ bool usePrimitiveRestartWorkaround = UsePrimitiveRestartWorkaround(restartEnabled, indexType);
+
+ ANGLE_TRY(GetIndexTranslationDestType(context, indexCount, indexType, indices,
+ usePrimitiveRestartWorkaround,
+ &mCachedDestinationIndexType));
+
+ unsigned int offset = static_cast<unsigned int>(reinterpret_cast<uintptr_t>(indices));
+
+ mCurrentElementArrayStorage =
+ ClassifyIndexStorage(context->getState(), mState.getElementArrayBuffer(), indexType,
+ mCachedDestinationIndexType, offset);
+
+ return angle::Result::Continue;
+}
+
+void VertexArray11::updateVertexAttribStorage(const gl::Context *context,
+ StateManager11 *stateManager,
+ size_t attribIndex)
+{
+ const gl::VertexAttribute &attrib = mState.getVertexAttribute(attribIndex);
+ const gl::VertexBinding &binding = mState.getBindingFromAttribIndex(attribIndex);
+
+ VertexStorageType newStorageType = ClassifyAttributeStorage(context, attrib, binding);
+
+ // Note: having an unchanged storage type doesn't mean the attribute is clean.
+ mAttribsToTranslate.set(attribIndex, newStorageType != VertexStorageType::DYNAMIC);
+
+ if (mAttributeStorageTypes[attribIndex] == newStorageType)
+ return;
+
+ mAttributeStorageTypes[attribIndex] = newStorageType;
+ mDynamicAttribsMask.set(attribIndex, newStorageType == VertexStorageType::DYNAMIC);
+
+ if (newStorageType == VertexStorageType::CURRENT_VALUE)
+ {
+ stateManager->invalidateCurrentValueAttrib(attribIndex);
+ }
+}
+
+bool VertexArray11::hasActiveDynamicAttrib(const gl::Context *context)
+{
+ const auto &activeLocations = context->getState().getProgram()->getActiveAttribLocationsMask();
+ gl::AttributesMask activeDynamicAttribs = (mDynamicAttribsMask & activeLocations);
+ return activeDynamicAttribs.any();
+}
+
+angle::Result VertexArray11::updateDirtyAttribs(const gl::Context *context,
+ const gl::AttributesMask &activeDirtyAttribs)
+{
+ const auto &glState = context->getState();
+ const auto &attribs = mState.getVertexAttributes();
+ const auto &bindings = mState.getVertexBindings();
+
+ for (size_t dirtyAttribIndex : activeDirtyAttribs)
+ {
+ mAttribsToTranslate.reset(dirtyAttribIndex);
+
+ auto *translatedAttrib = &mTranslatedAttribs[dirtyAttribIndex];
+ const auto &currentValue = glState.getVertexAttribCurrentValue(dirtyAttribIndex);
+
+ // Record basic attrib info
+ translatedAttrib->attribute = &attribs[dirtyAttribIndex];
+ translatedAttrib->binding = &bindings[translatedAttrib->attribute->bindingIndex];
+ translatedAttrib->currentValueType = currentValue.Type;
+ translatedAttrib->divisor =
+ translatedAttrib->binding->getDivisor() * mAppliedNumViewsToDivisor;
+
+ switch (mAttributeStorageTypes[dirtyAttribIndex])
+ {
+ case VertexStorageType::DIRECT:
+ VertexDataManager::StoreDirectAttrib(context, translatedAttrib);
+ break;
+ case VertexStorageType::STATIC:
+ {
+ ANGLE_TRY(VertexDataManager::StoreStaticAttrib(context, translatedAttrib));
+ break;
+ }
+ case VertexStorageType::CURRENT_VALUE:
+ // Current value attribs are managed by the StateManager11.
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result VertexArray11::updateDynamicAttribs(const gl::Context *context,
+ VertexDataManager *vertexDataManager,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ const gl::AttributesMask &activeDynamicAttribs)
+{
+ const auto &glState = context->getState();
+ const auto &attribs = mState.getVertexAttributes();
+ const auto &bindings = mState.getVertexBindings();
+
+ GLint startVertex;
+ size_t vertexCount;
+ ANGLE_TRY(GetVertexRangeInfo(context, firstVertex, vertexOrIndexCount, indexTypeOrInvalid,
+ indices, baseVertex, &startVertex, &vertexCount));
+
+ for (size_t dynamicAttribIndex : activeDynamicAttribs)
+ {
+ auto *dynamicAttrib = &mTranslatedAttribs[dynamicAttribIndex];
+ const auto &currentValue = glState.getVertexAttribCurrentValue(dynamicAttribIndex);
+
+ // Record basic attrib info
+ dynamicAttrib->attribute = &attribs[dynamicAttribIndex];
+ dynamicAttrib->binding = &bindings[dynamicAttrib->attribute->bindingIndex];
+ dynamicAttrib->currentValueType = currentValue.Type;
+ dynamicAttrib->divisor = dynamicAttrib->binding->getDivisor() * mAppliedNumViewsToDivisor;
+ }
+
+ ANGLE_TRY(vertexDataManager->storeDynamicAttribs(
+ context, &mTranslatedAttribs, activeDynamicAttribs, startVertex, vertexCount, instances));
+
+ VertexDataManager::PromoteDynamicAttribs(context, mTranslatedAttribs, activeDynamicAttribs,
+ vertexCount);
+
+ return angle::Result::Continue;
+}
+
+const std::vector<TranslatedAttribute> &VertexArray11::getTranslatedAttribs() const
+{
+ return mTranslatedAttribs;
+}
+
+void VertexArray11::markAllAttributeDivisorsForAdjustment(int numViews)
+{
+ if (mAppliedNumViewsToDivisor != numViews)
+ {
+ mAppliedNumViewsToDivisor = numViews;
+ mAttribsToTranslate.set();
+ // mDynamicAttribsMask may have already been set (updateVertexAttribStorage
+ // We don't want to override DYNAMIC attribs as they will be handled separately.
+ mAttribsToTranslate = mAttribsToTranslate ^ mDynamicAttribsMask;
+ }
+}
+
+const TranslatedIndexData &VertexArray11::getCachedIndexInfo() const
+{
+ ASSERT(mCachedIndexInfo.valid());
+ return mCachedIndexInfo.value();
+}
+
+void VertexArray11::updateCachedIndexInfo(const TranslatedIndexData &indexInfo)
+{
+ mCachedIndexInfo = indexInfo;
+}
+
+bool VertexArray11::isCachedIndexInfoValid() const
+{
+ return mCachedIndexInfo.valid();
+}
+
+gl::DrawElementsType VertexArray11::getCachedDestinationIndexType() const
+{
+ return mCachedDestinationIndexType;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h
new file mode 100644
index 0000000000..e259e0fe61
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h
@@ -0,0 +1,108 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexArray11.h: Defines the rx::VertexArray11 class which implements rx::VertexArrayImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
+
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/renderer/VertexArrayImpl.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+class Renderer11;
+
+class VertexArray11 : public VertexArrayImpl
+{
+ public:
+ VertexArray11(const gl::VertexArrayState &data);
+ ~VertexArray11() override;
+ void destroy(const gl::Context *context) override;
+
+ // Does not apply any state updates - these are done in syncStateForDraw which as access to
+ // the draw call parameters.
+ angle::Result syncState(const gl::Context *context,
+ const gl::VertexArray::DirtyBits &dirtyBits,
+ gl::VertexArray::DirtyAttribBitsArray *attribBits,
+ gl::VertexArray::DirtyBindingBitsArray *bindingBits) override;
+
+ // Applied buffer pointers are updated here.
+ angle::Result syncStateForDraw(const gl::Context *context,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLsizei instances,
+ GLint baseVertex);
+
+ // This will check the dynamic attribs mask.
+ bool hasActiveDynamicAttrib(const gl::Context *context);
+
+ const std::vector<TranslatedAttribute> &getTranslatedAttribs() const;
+
+ Serial getCurrentStateSerial() const { return mCurrentStateSerial; }
+
+ // In case of a multi-view program change, we have to update all attributes so that the divisor
+ // is adjusted.
+ void markAllAttributeDivisorsForAdjustment(int numViews);
+
+ const TranslatedIndexData &getCachedIndexInfo() const;
+ void updateCachedIndexInfo(const TranslatedIndexData &indexInfo);
+ bool isCachedIndexInfoValid() const;
+
+ gl::DrawElementsType getCachedDestinationIndexType() const;
+
+ private:
+ void updateVertexAttribStorage(const gl::Context *context,
+ StateManager11 *stateManager,
+ size_t attribIndex);
+ angle::Result updateDirtyAttribs(const gl::Context *context,
+ const gl::AttributesMask &activeDirtyAttribs);
+ angle::Result updateDynamicAttribs(const gl::Context *context,
+ VertexDataManager *vertexDataManager,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ const gl::AttributesMask &activeDynamicAttribs);
+
+ angle::Result updateElementArrayStorage(const gl::Context *context,
+ GLsizei indexCount,
+ gl::DrawElementsType indexType,
+ const void *indices,
+ bool restartEnabled);
+
+ std::vector<VertexStorageType> mAttributeStorageTypes;
+ std::vector<TranslatedAttribute> mTranslatedAttribs;
+
+ // The mask of attributes marked as dynamic.
+ gl::AttributesMask mDynamicAttribsMask;
+
+ // A set of attributes we know are dirty, and need to be re-translated.
+ gl::AttributesMask mAttribsToTranslate;
+
+ Serial mCurrentStateSerial;
+
+ // The numViews value used to adjust the divisor.
+ int mAppliedNumViewsToDivisor;
+
+ // If the index buffer needs re-streaming.
+ Optional<gl::DrawElementsType> mLastDrawElementsType;
+ Optional<const void *> mLastDrawElementsIndices;
+ Optional<bool> mLastPrimitiveRestartEnabled;
+ IndexStorageType mCurrentElementArrayStorage;
+ Optional<TranslatedIndexData> mCachedIndexInfo;
+ gl::DrawElementsType mCachedDestinationIndexType;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
new file mode 100644
index 0000000000..81bdfbdb75
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
@@ -0,0 +1,167 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer11.cpp: Defines the D3D11 VertexBuffer implementation.
+
+#include "libANGLE/renderer/d3d/d3d11/VertexBuffer11.h"
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+
+VertexBuffer11::VertexBuffer11(Renderer11 *const renderer)
+ : mRenderer(renderer),
+ mBuffer(),
+ mBufferSize(0),
+ mDynamicUsage(false),
+ mMappedResourceData(nullptr)
+{}
+
+VertexBuffer11::~VertexBuffer11()
+{
+ ASSERT(mMappedResourceData == nullptr);
+}
+
+angle::Result VertexBuffer11::initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage)
+{
+ mBuffer.reset();
+ updateSerial();
+
+ if (size > 0)
+ {
+ D3D11_BUFFER_DESC bufferDesc;
+ bufferDesc.ByteWidth = size;
+ bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
+ bufferDesc.StructureByteStride = 0;
+
+ ANGLE_TRY(mRenderer->allocateResource(GetImplAs<Context11>(context), bufferDesc, &mBuffer));
+
+ if (dynamicUsage)
+ {
+ mBuffer.setDebugName("VertexBuffer11 (dynamic)");
+ }
+ else
+ {
+ mBuffer.setDebugName("VertexBuffer11 (static)");
+ }
+ }
+
+ mBufferSize = size;
+ mDynamicUsage = dynamicUsage;
+
+ return angle::Result::Continue;
+}
+
+angle::Result VertexBuffer11::mapResource(const gl::Context *context)
+{
+ if (mMappedResourceData == nullptr)
+ {
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+
+ ANGLE_TRY(mRenderer->mapResource(context, mBuffer.get(), 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0,
+ &mappedResource));
+
+ mMappedResourceData = static_cast<uint8_t *>(mappedResource.pData);
+ }
+
+ return angle::Result::Continue;
+}
+
+void VertexBuffer11::hintUnmapResource()
+{
+ if (mMappedResourceData != nullptr)
+ {
+ ID3D11DeviceContext *dxContext = mRenderer->getDeviceContext();
+ dxContext->Unmap(mBuffer.get(), 0);
+
+ mMappedResourceData = nullptr;
+ }
+}
+
+angle::Result VertexBuffer11::storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ gl::VertexAttribType currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData)
+{
+ ASSERT(mBuffer.valid());
+
+ int inputStride = static_cast<int>(ComputeVertexAttributeStride(attrib, binding));
+
+ // This will map the resource if it isn't already mapped.
+ ANGLE_TRY(mapResource(context));
+
+ uint8_t *output = mMappedResourceData + offset;
+
+ const uint8_t *input = sourceData;
+
+ if (instances == 0 || binding.getDivisor() == 0)
+ {
+ input += inputStride * start;
+ }
+
+ angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, currentValueType);
+ const D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel;
+ const d3d11::VertexFormat &vertexFormatInfo =
+ d3d11::GetVertexFormatInfo(vertexFormatID, featureLevel);
+ ASSERT(vertexFormatInfo.copyFunction != nullptr);
+ vertexFormatInfo.copyFunction(input, inputStride, count, output);
+
+ return angle::Result::Continue;
+}
+
+unsigned int VertexBuffer11::getBufferSize() const
+{
+ return mBufferSize;
+}
+
+angle::Result VertexBuffer11::setBufferSize(const gl::Context *context, unsigned int size)
+{
+ if (size > mBufferSize)
+ {
+ return initialize(context, size, mDynamicUsage);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result VertexBuffer11::discard(const gl::Context *context)
+{
+ ASSERT(mBuffer.valid());
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ ANGLE_TRY(mRenderer->mapResource(context, mBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0,
+ &mappedResource));
+
+ mRenderer->getDeviceContext()->Unmap(mBuffer.get(), 0);
+
+ return angle::Result::Continue;
+}
+
+const d3d11::Buffer &VertexBuffer11::getBuffer() const
+{
+ return mBuffer;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h
new file mode 100644
index 0000000000..393b937c54
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h
@@ -0,0 +1,65 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer11.h: Defines the D3D11 VertexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
+
+#include <stdint.h>
+
+#include "libANGLE/renderer/d3d/VertexBuffer.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+
+namespace rx
+{
+class Renderer11;
+
+class VertexBuffer11 : public VertexBuffer
+{
+ public:
+ explicit VertexBuffer11(Renderer11 *const renderer);
+
+ angle::Result initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage) override;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using this
+ // function.
+ angle::Result storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ gl::VertexAttribType currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData) override;
+
+ unsigned int getBufferSize() const override;
+ angle::Result setBufferSize(const gl::Context *context, unsigned int size) override;
+ angle::Result discard(const gl::Context *context) override;
+
+ void hintUnmapResource() override;
+
+ const d3d11::Buffer &getBuffer() const;
+
+ private:
+ ~VertexBuffer11() override;
+ angle::Result mapResource(const gl::Context *context);
+
+ Renderer11 *const mRenderer;
+
+ d3d11::Buffer mBuffer;
+ unsigned int mBufferSize;
+ bool mDynamicUsage;
+
+ uint8_t *mMappedResourceData;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp
new file mode 100644
index 0000000000..826b20d08e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp
@@ -0,0 +1,437 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// CompositorNativeWindow11.cpp: Implementation of NativeWindow11 using Windows.UI.Composition APIs
+// which work in both Win32 and WinRT contexts.
+
+#include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#include "common/debug.h"
+
+using namespace Microsoft::WRL;
+
+namespace rx
+{
+
+CompositorNativeWindow11::CompositorNativeWindow11(EGLNativeWindowType window, bool hasAlpha)
+ : NativeWindow11(window), mHasAlpha(hasAlpha)
+{
+ ABI::Windows::UI::Composition::ISpriteVisual *inspPtr =
+ reinterpret_cast<ABI::Windows::UI::Composition::ISpriteVisual *>(window);
+ mHostVisual = Microsoft::WRL::ComPtr<ABI::Windows::UI::Composition::ISpriteVisual>{inspPtr};
+}
+
+CompositorNativeWindow11::~CompositorNativeWindow11() = default;
+
+bool CompositorNativeWindow11::initialize()
+{
+ return true;
+}
+
+bool CompositorNativeWindow11::getClientRect(LPRECT rect) const
+{
+ ComPtr<ABI::Windows::UI::Composition::IVisual> visual;
+ mHostVisual.As(&visual);
+
+ ABI::Windows::Foundation::Numerics::Vector2 size;
+ HRESULT hr = visual->get_Size(&size);
+ if (FAILED(hr))
+ {
+ return false;
+ }
+
+ ABI::Windows::Foundation::Numerics::Vector3 offset;
+ hr = visual->get_Offset(&offset);
+ if (FAILED(hr))
+ {
+ return false;
+ }
+
+ rect->top = static_cast<LONG>(offset.Y);
+ rect->left = static_cast<LONG>(offset.X);
+ rect->right = static_cast<LONG>(offset.X) + static_cast<LONG>(size.X);
+ rect->bottom = static_cast<LONG>(offset.Y) + static_cast<LONG>(size.Y);
+
+ return true;
+}
+
+bool CompositorNativeWindow11::isIconic() const
+{
+ return false;
+}
+
+HRESULT CompositorNativeWindow11::createSwapChain(ID3D11Device *device,
+ IDXGIFactory *factory,
+ DXGI_FORMAT format,
+ UINT width,
+ UINT height,
+ UINT samples,
+ IDXGISwapChain **swapChain)
+{
+ if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 ||
+ height == 0)
+ {
+ return E_INVALIDARG;
+ }
+
+ HRESULT hr{E_FAIL};
+
+ ComPtr<ABI::Windows::UI::Composition::ICompositionObject> hostVisual;
+ hr = mHostVisual.As(&hostVisual);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Composition::ICompositor> compositor;
+ hr = hostVisual->get_Compositor(&compositor);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ ComPtr<ABI::Windows::UI::Composition::ICompositorInterop> interop;
+
+ hr = compositor.As(&interop);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ ComPtr<IDXGIFactory2> factory2;
+ factory2.Attach(d3d11::DynamicCastComObject<IDXGIFactory2>(factory));
+
+ DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
+ swapChainDesc.Width = width;
+ swapChainDesc.Height = height;
+ swapChainDesc.Format = format;
+ swapChainDesc.Stereo = FALSE;
+ swapChainDesc.SampleDesc.Count = 1;
+ swapChainDesc.SampleDesc.Quality = 0;
+ swapChainDesc.BufferUsage =
+ DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER | DXGI_USAGE_SHADER_INPUT;
+ swapChainDesc.BufferCount = 2;
+ swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
+ swapChainDesc.AlphaMode = mHasAlpha ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE;
+ swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG::DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
+ Microsoft::WRL::ComPtr<IDXGISwapChain1> swapChain1;
+ hr = factory2->CreateSwapChainForComposition(device, &swapChainDesc, nullptr, &swapChain1);
+ if (SUCCEEDED(hr))
+ {
+ swapChain1.CopyTo(swapChain);
+ }
+
+ hr = interop->CreateCompositionSurfaceForSwapChain(swapChain1.Get(), &mSurface);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ hr = compositor->CreateSurfaceBrushWithSurface(mSurface.Get(), &mSurfaceBrush);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ hr = mSurfaceBrush.As(&mCompositionBrush);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ hr = mHostVisual->put_Brush(mCompositionBrush.Get());
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ return hr;
+}
+
+void CompositorNativeWindow11::commitChange()
+{
+ // Windows::UI::Composition uses an implicit commit model hence no action needed here
+}
+
+// static
+bool CompositorNativeWindow11::IsValidNativeWindow(EGLNativeWindowType window)
+{
+ return IsSupportedWinRelease() && IsSpriteVisual(window);
+}
+
+// static
+bool CompositorNativeWindow11::IsSupportedWinRelease()
+{
+ RoHelper helper;
+ if (!helper.WinRtAvailable())
+ {
+ return false;
+ }
+
+ return helper.SupportedWindowsRelease();
+}
+
+bool CompositorNativeWindow11::IsSpriteVisual(EGLNativeWindowType window)
+{
+ RoHelper helper;
+
+ ABI::Windows::UI::Composition::ISpriteVisual *inspp =
+ reinterpret_cast<ABI::Windows::UI::Composition::ISpriteVisual *>(window);
+ HSTRING className, spriteClassName;
+ HSTRING_HEADER spriteClassNameHeader;
+
+ auto hr = helper.GetStringReference(RuntimeClass_Windows_UI_Composition_SpriteVisual,
+ &spriteClassName, &spriteClassNameHeader);
+ if (FAILED(hr))
+ {
+ return false;
+ }
+
+ hr = inspp->GetRuntimeClassName(&className);
+ if (FAILED(hr))
+ {
+ return false;
+ }
+
+ INT32 result = -1;
+ hr = helper.WindowsCompareStringOrdinal(className, spriteClassName, &result);
+
+ helper.WindowsDeleteString(className);
+
+ if (FAILED(hr))
+ {
+ return false;
+ }
+
+ if (result == 0)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+// RoHelperImpl
+
+template <typename T>
+bool AssignProcAddress(HMODULE comBaseModule, const char *name, T *&outProc)
+{
+ outProc = reinterpret_cast<T *>(GetProcAddress(comBaseModule, name));
+ return *outProc != nullptr;
+}
+
+RoHelper::RoHelper()
+ : mFpWindowsCreateStringReference(nullptr),
+ mFpGetActivationFactory(nullptr),
+ mFpWindowsCompareStringOrdinal(nullptr),
+ mFpCreateDispatcherQueueController(nullptr),
+ mFpWindowsDeleteString(nullptr),
+ mFpRoInitialize(nullptr),
+ mFpRoUninitialize(nullptr),
+ mWinRtAvailable(false),
+ mComBaseModule(nullptr),
+ mCoreMessagingModule(nullptr)
+{
+ if (!IsWindows10OrGreater())
+ {
+ return;
+ }
+
+ mComBaseModule = LoadLibraryA("ComBase.dll");
+
+ if (mComBaseModule == nullptr)
+ {
+ return;
+ }
+
+ if (!AssignProcAddress(mComBaseModule, "WindowsCreateStringReference",
+ mFpWindowsCreateStringReference))
+ {
+ return;
+ }
+
+ if (!AssignProcAddress(mComBaseModule, "RoGetActivationFactory", mFpGetActivationFactory))
+ {
+ return;
+ }
+
+ if (!AssignProcAddress(mComBaseModule, "WindowsCompareStringOrdinal",
+ mFpWindowsCompareStringOrdinal))
+ {
+ return;
+ }
+
+ if (!AssignProcAddress(mComBaseModule, "WindowsDeleteString", mFpWindowsDeleteString))
+ {
+ return;
+ }
+
+ if (!AssignProcAddress(mComBaseModule, "RoInitialize", mFpRoInitialize))
+ {
+ return;
+ }
+
+ if (!AssignProcAddress(mComBaseModule, "RoUninitialize", mFpRoUninitialize))
+ {
+ return;
+ }
+
+ mCoreMessagingModule = LoadLibraryA("coremessaging.dll");
+
+ if (mCoreMessagingModule == nullptr)
+ {
+ return;
+ }
+
+ if (!AssignProcAddress(mCoreMessagingModule, "CreateDispatcherQueueController",
+ mFpCreateDispatcherQueueController))
+ {
+ return;
+ }
+
+ if (SUCCEEDED(RoInitialize(RO_INIT_MULTITHREADED)))
+ {
+ mWinRtAvailable = true;
+ }
+}
+
+RoHelper::~RoHelper()
+{
+ if (mWinRtAvailable)
+ {
+ RoUninitialize();
+ }
+
+ if (mCoreMessagingModule != nullptr)
+ {
+ FreeLibrary(mCoreMessagingModule);
+ mCoreMessagingModule = nullptr;
+ }
+
+ if (mComBaseModule != nullptr)
+ {
+ FreeLibrary(mComBaseModule);
+ mComBaseModule = nullptr;
+ }
+}
+
+bool RoHelper::WinRtAvailable() const
+{
+ return mWinRtAvailable;
+}
+
+bool RoHelper::SupportedWindowsRelease()
+{
+ if (!IsWindows10OrGreater() || !mWinRtAvailable)
+ {
+ return false;
+ }
+
+ HSTRING className, contractName;
+ HSTRING_HEADER classNameHeader, contractNameHeader;
+ boolean isSupported = false;
+
+ HRESULT hr = GetStringReference(RuntimeClass_Windows_Foundation_Metadata_ApiInformation,
+ &className, &classNameHeader);
+
+ if (FAILED(hr))
+ {
+ return isSupported;
+ }
+
+ Microsoft::WRL::ComPtr<ABI::Windows::Foundation::Metadata::IApiInformationStatics> api;
+
+ hr = GetActivationFactory(
+ className, __uuidof(ABI::Windows::Foundation::Metadata::IApiInformationStatics), &api);
+
+ if (FAILED(hr))
+ {
+ return isSupported;
+ }
+
+ hr = GetStringReference(L"Windows.Foundation.UniversalApiContract", &contractName,
+ &contractNameHeader);
+ if (FAILED(hr))
+ {
+ return isSupported;
+ }
+
+ api->IsApiContractPresentByMajor(contractName, 6, &isSupported);
+
+ return isSupported;
+}
+
+HRESULT RoHelper::GetStringReference(PCWSTR source, HSTRING *act, HSTRING_HEADER *header)
+{
+ if (!mWinRtAvailable)
+ {
+ return E_FAIL;
+ }
+
+ const wchar_t *str = static_cast<const wchar_t *>(source);
+
+ unsigned int length;
+ HRESULT hr = SizeTToUInt32(::wcslen(str), &length);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ return mFpWindowsCreateStringReference(source, length, header, act);
+}
+
+HRESULT RoHelper::GetActivationFactory(const HSTRING act, const IID &interfaceId, void **fac)
+{
+ if (!mWinRtAvailable)
+ {
+ return E_FAIL;
+ }
+ auto hr = mFpGetActivationFactory(act, interfaceId, fac);
+ return hr;
+}
+
+HRESULT RoHelper::WindowsCompareStringOrdinal(HSTRING one, HSTRING two, int *result)
+{
+ if (!mWinRtAvailable)
+ {
+ return E_FAIL;
+ }
+ return mFpWindowsCompareStringOrdinal(one, two, result);
+}
+
+HRESULT RoHelper::CreateDispatcherQueueController(
+ DispatcherQueueOptions options,
+ ABI::Windows::System::IDispatcherQueueController **dispatcherQueueController)
+{
+ if (!mWinRtAvailable)
+ {
+ return E_FAIL;
+ }
+ return mFpCreateDispatcherQueueController(options, dispatcherQueueController);
+}
+
+HRESULT RoHelper::WindowsDeleteString(HSTRING one)
+{
+ if (!mWinRtAvailable)
+ {
+ return E_FAIL;
+ }
+ return mFpWindowsDeleteString(one);
+}
+
+HRESULT RoHelper::RoInitialize(RO_INIT_TYPE type)
+{
+ return mFpRoInitialize(type);
+}
+
+void RoHelper::RoUninitialize()
+{
+ mFpRoUninitialize();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h
new file mode 100644
index 0000000000..aebdba1a5c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h
@@ -0,0 +1,115 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// CompositorNativeWindow11.h: Implementation of NativeWindow11 using Windows.UI.Composition APIs
+// which work in both Win32 and WinRT contexts.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_CONVERGED_COMPOSITORNATIVEWINDOW11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_CONVERGED_COMPOSITORNATIVEWINDOW11_H_
+
+#include "libANGLE/renderer/d3d/d3d11/NativeWindow11.h"
+
+#include <dispatcherqueue.h>
+#include <versionhelpers.h>
+#include <windows.foundation.metadata.h>
+#include <windows.ui.composition.h>
+#include <windows.ui.composition.interop.h>
+#include <wrl.h>
+
+namespace rx
+{
+
+class RoHelper
+{
+ public:
+ RoHelper();
+ ~RoHelper();
+ bool WinRtAvailable() const;
+ bool SupportedWindowsRelease();
+ HRESULT GetStringReference(PCWSTR source, HSTRING *act, HSTRING_HEADER *header);
+ HRESULT GetActivationFactory(const HSTRING act, const IID &interfaceId, void **fac);
+ HRESULT WindowsCompareStringOrdinal(HSTRING one, HSTRING two, int *result);
+ HRESULT CreateDispatcherQueueController(
+ DispatcherQueueOptions options,
+ ABI::Windows::System::IDispatcherQueueController **dispatcherQueueController);
+ HRESULT WindowsDeleteString(HSTRING one);
+ HRESULT RoInitialize(RO_INIT_TYPE type);
+ void RoUninitialize();
+
+ private:
+ using WindowsCreateStringReference_ = HRESULT __stdcall(PCWSTR,
+ UINT32,
+ HSTRING_HEADER *,
+ HSTRING *);
+
+ using GetActivationFactory_ = HRESULT __stdcall(HSTRING, REFIID, void **);
+
+ using WindowsCompareStringOrginal_ = HRESULT __stdcall(HSTRING, HSTRING, int *);
+
+ using WindowsDeleteString_ = HRESULT __stdcall(HSTRING);
+
+ using CreateDispatcherQueueController_ =
+ HRESULT __stdcall(DispatcherQueueOptions,
+ ABI::Windows::System::IDispatcherQueueController **);
+
+ using RoInitialize_ = HRESULT __stdcall(RO_INIT_TYPE);
+ using RoUninitialize_ = void __stdcall();
+
+ WindowsCreateStringReference_ *mFpWindowsCreateStringReference;
+ GetActivationFactory_ *mFpGetActivationFactory;
+ WindowsCompareStringOrginal_ *mFpWindowsCompareStringOrdinal;
+ CreateDispatcherQueueController_ *mFpCreateDispatcherQueueController;
+ WindowsDeleteString_ *mFpWindowsDeleteString;
+ RoInitialize_ *mFpRoInitialize;
+ RoUninitialize_ *mFpRoUninitialize;
+
+ bool mWinRtAvailable;
+
+ HMODULE mComBaseModule;
+ HMODULE mCoreMessagingModule;
+};
+
+class CompositorNativeWindow11 : public NativeWindow11
+{
+ public:
+ CompositorNativeWindow11(EGLNativeWindowType window, bool hasAlpha);
+ ~CompositorNativeWindow11() override;
+
+ bool initialize() override;
+ bool getClientRect(LPRECT rect) const override;
+ bool isIconic() const override;
+
+ HRESULT createSwapChain(ID3D11Device *device,
+ IDXGIFactory *factory,
+ DXGI_FORMAT format,
+ UINT width,
+ UINT height,
+ UINT samples,
+ IDXGISwapChain **swapChain) override;
+
+ void commitChange() override;
+
+ static bool IsValidNativeWindow(EGLNativeWindowType window);
+
+ static bool IsSupportedWinRelease();
+
+ private:
+ static bool IsSpriteVisual(EGLNativeWindowType window);
+
+ bool mHasAlpha;
+
+ RoHelper mRoHelper;
+
+ // Namespace prefix required here for some reason despite using namespace
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Composition::ISpriteVisual> mHostVisual;
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Composition::ICompositionBrush> mCompositionBrush;
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Composition::ICompositionSurface> mSurface;
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Composition::ICompositionSurfaceBrush> mSurfaceBrush;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_CONVERGED_COMPOSITORNATIVEWINDOW11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
new file mode 100644
index 0000000000..bfcf0550b2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
@@ -0,0 +1,516 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_dxgi_format_table.py using data from dxgi_format_data.json.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DXGI format info:
+// Determining metadata about a DXGI format.
+
+#include "libANGLE/renderer/Format.h"
+
+using namespace angle;
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+GLenum GetComponentType(DXGI_FORMAT dxgiFormat)
+{
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_420_OPAQUE:
+ break;
+ case DXGI_FORMAT_A8P8:
+ break;
+ case DXGI_FORMAT_A8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_AI44:
+ break;
+ case DXGI_FORMAT_AYUV:
+ break;
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ break;
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ break;
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC1_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC1_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC2_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC2_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC3_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC3_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC4_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC4_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC4_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC5_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC5_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC5_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC6H_SF16:
+ break;
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC6H_UF16:
+ break;
+ case DXGI_FORMAT_BC7_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC7_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_D16_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ break;
+ case DXGI_FORMAT_D32_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ break;
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_IA44:
+ break;
+ case DXGI_FORMAT_NV11:
+ break;
+ case DXGI_FORMAT_NV12:
+ break;
+ case DXGI_FORMAT_P010:
+ break;
+ case DXGI_FORMAT_P016:
+ break;
+ case DXGI_FORMAT_P8:
+ break;
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ break;
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ break;
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R16G16_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R16G16_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R16G16_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ break;
+ case DXGI_FORMAT_R16G16_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R16G16_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R16_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R16_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R16_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_R16_TYPELESS:
+ break;
+ case DXGI_FORMAT_R16_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R16_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R1_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R32G32B32_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32G32B32_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R32G32_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R32G32_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32G32_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32_FLOAT:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ return GL_FLOAT;
+ case DXGI_FORMAT_R32_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R8G8_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R8G8_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R8G8_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R8G8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R8_SINT:
+ return GL_INT;
+ case DXGI_FORMAT_R8_SNORM:
+ return GL_SIGNED_NORMALIZED;
+ case DXGI_FORMAT_R8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R8_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_R8_UNORM:
+ return GL_UNSIGNED_NORMALIZED;
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ return GL_FLOAT;
+ case DXGI_FORMAT_UNKNOWN:
+ break;
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ return GL_UNSIGNED_INT;
+ case DXGI_FORMAT_Y210:
+ break;
+ case DXGI_FORMAT_Y216:
+ break;
+ case DXGI_FORMAT_Y410:
+ break;
+ case DXGI_FORMAT_Y416:
+ break;
+ case DXGI_FORMAT_YUY2:
+ break;
+ default:
+ break;
+ }
+
+ UNREACHABLE();
+ return GL_NONE;
+}
+
+} // namespace d3d11
+
+namespace d3d11_angle
+{
+
+const Format &GetFormat(DXGI_FORMAT dxgiFormat)
+{
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_420_OPAQUE:
+ break;
+ case DXGI_FORMAT_A8P8:
+ break;
+ case DXGI_FORMAT_A8_UNORM:
+ return Format::Get(FormatID::A8_UNORM);
+ case DXGI_FORMAT_AI44:
+ break;
+ case DXGI_FORMAT_AYUV:
+ break;
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ return Format::Get(FormatID::B4G4R4A4_UNORM);
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ return Format::Get(FormatID::B5G5R5A1_UNORM);
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ return Format::Get(FormatID::B5G6R5_UNORM);
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ return Format::Get(FormatID::B8G8R8A8_TYPELESS);
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ return Format::Get(FormatID::B8G8R8A8_UNORM);
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ return Format::Get(FormatID::B8G8R8A8_UNORM_SRGB);
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ break;
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ return Format::Get(FormatID::B8G8R8X8_UNORM);
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ break;
+ case DXGI_FORMAT_BC1_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC1_UNORM:
+ return Format::Get(FormatID::BC1_RGBA_UNORM_BLOCK);
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ return Format::Get(FormatID::BC1_RGBA_UNORM_SRGB_BLOCK);
+ case DXGI_FORMAT_BC2_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC2_UNORM:
+ return Format::Get(FormatID::BC2_RGBA_UNORM_BLOCK);
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ return Format::Get(FormatID::BC2_RGBA_UNORM_SRGB_BLOCK);
+ case DXGI_FORMAT_BC3_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC3_UNORM:
+ return Format::Get(FormatID::BC3_RGBA_UNORM_BLOCK);
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ return Format::Get(FormatID::BC3_RGBA_UNORM_SRGB_BLOCK);
+ case DXGI_FORMAT_BC4_SNORM:
+ break;
+ case DXGI_FORMAT_BC4_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC4_UNORM:
+ break;
+ case DXGI_FORMAT_BC5_SNORM:
+ break;
+ case DXGI_FORMAT_BC5_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC5_UNORM:
+ break;
+ case DXGI_FORMAT_BC6H_SF16:
+ break;
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC6H_UF16:
+ break;
+ case DXGI_FORMAT_BC7_TYPELESS:
+ break;
+ case DXGI_FORMAT_BC7_UNORM:
+ break;
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ break;
+ case DXGI_FORMAT_D16_UNORM:
+ return Format::Get(FormatID::D16_UNORM);
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ return Format::Get(FormatID::D24_UNORM_S8_UINT);
+ case DXGI_FORMAT_D32_FLOAT:
+ return Format::Get(FormatID::D32_FLOAT);
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ return Format::Get(FormatID::D32_FLOAT_S8X24_UINT);
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ break;
+ case DXGI_FORMAT_IA44:
+ break;
+ case DXGI_FORMAT_NV11:
+ break;
+ case DXGI_FORMAT_NV12:
+ break;
+ case DXGI_FORMAT_P010:
+ break;
+ case DXGI_FORMAT_P016:
+ break;
+ case DXGI_FORMAT_P8:
+ break;
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ break;
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ return Format::Get(FormatID::R10G10B10A2_UINT);
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ return Format::Get(FormatID::R10G10B10A2_UNORM);
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ break;
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ return Format::Get(FormatID::R11G11B10_FLOAT);
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ return Format::Get(FormatID::R16G16B16A16_FLOAT);
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ return Format::Get(FormatID::R16G16B16A16_SINT);
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ return Format::Get(FormatID::R16G16B16A16_SNORM);
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ break;
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ return Format::Get(FormatID::R16G16B16A16_UINT);
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ return Format::Get(FormatID::R16G16B16A16_UNORM);
+ case DXGI_FORMAT_R16G16_FLOAT:
+ return Format::Get(FormatID::R16G16_FLOAT);
+ case DXGI_FORMAT_R16G16_SINT:
+ return Format::Get(FormatID::R16G16_SINT);
+ case DXGI_FORMAT_R16G16_SNORM:
+ return Format::Get(FormatID::R16G16_SNORM);
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ break;
+ case DXGI_FORMAT_R16G16_UINT:
+ return Format::Get(FormatID::R16G16_UINT);
+ case DXGI_FORMAT_R16G16_UNORM:
+ return Format::Get(FormatID::R16G16_UNORM);
+ case DXGI_FORMAT_R16_FLOAT:
+ return Format::Get(FormatID::R16_FLOAT);
+ case DXGI_FORMAT_R16_SINT:
+ return Format::Get(FormatID::R16_SINT);
+ case DXGI_FORMAT_R16_SNORM:
+ return Format::Get(FormatID::R16_SNORM);
+ case DXGI_FORMAT_R16_TYPELESS:
+ break;
+ case DXGI_FORMAT_R16_UINT:
+ return Format::Get(FormatID::R16_UINT);
+ case DXGI_FORMAT_R16_UNORM:
+ return Format::Get(FormatID::R16_UNORM);
+ case DXGI_FORMAT_R1_UNORM:
+ break;
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ return Format::Get(FormatID::R32G32B32A32_FLOAT);
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ return Format::Get(FormatID::R32G32B32A32_SINT);
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ return Format::Get(FormatID::R32G32B32A32_UINT);
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ return Format::Get(FormatID::R32G32B32_FLOAT);
+ case DXGI_FORMAT_R32G32B32_SINT:
+ return Format::Get(FormatID::R32G32B32_SINT);
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32G32B32_UINT:
+ return Format::Get(FormatID::R32G32B32_UINT);
+ case DXGI_FORMAT_R32G32_FLOAT:
+ return Format::Get(FormatID::R32G32_FLOAT);
+ case DXGI_FORMAT_R32G32_SINT:
+ return Format::Get(FormatID::R32G32_SINT);
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32G32_UINT:
+ return Format::Get(FormatID::R32G32_UINT);
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32_FLOAT:
+ return Format::Get(FormatID::R32_FLOAT);
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32_SINT:
+ return Format::Get(FormatID::R32_SINT);
+ case DXGI_FORMAT_R32_TYPELESS:
+ break;
+ case DXGI_FORMAT_R32_UINT:
+ return Format::Get(FormatID::R32_UINT);
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ return Format::Get(FormatID::R8G8B8A8_SINT);
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ return Format::Get(FormatID::R8G8B8A8_SNORM);
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ return Format::Get(FormatID::R8G8B8A8_TYPELESS);
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ return Format::Get(FormatID::R8G8B8A8_UINT);
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ return Format::Get(FormatID::R8G8B8A8_UNORM);
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ return Format::Get(FormatID::R8G8B8A8_UNORM_SRGB);
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ break;
+ case DXGI_FORMAT_R8G8_SINT:
+ return Format::Get(FormatID::R8G8_SINT);
+ case DXGI_FORMAT_R8G8_SNORM:
+ return Format::Get(FormatID::R8G8_SNORM);
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R8G8_UINT:
+ return Format::Get(FormatID::R8G8_UINT);
+ case DXGI_FORMAT_R8G8_UNORM:
+ return Format::Get(FormatID::R8G8_UNORM);
+ case DXGI_FORMAT_R8_SINT:
+ return Format::Get(FormatID::R8_SINT);
+ case DXGI_FORMAT_R8_SNORM:
+ return Format::Get(FormatID::R8_SNORM);
+ case DXGI_FORMAT_R8_TYPELESS:
+ break;
+ case DXGI_FORMAT_R8_UINT:
+ return Format::Get(FormatID::R8_UINT);
+ case DXGI_FORMAT_R8_UNORM:
+ return Format::Get(FormatID::R8_UNORM);
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ return Format::Get(FormatID::R9G9B9E5_SHAREDEXP);
+ case DXGI_FORMAT_UNKNOWN:
+ return Format::Get(FormatID::NONE);
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ break;
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ break;
+ case DXGI_FORMAT_Y210:
+ break;
+ case DXGI_FORMAT_Y216:
+ break;
+ case DXGI_FORMAT_Y410:
+ break;
+ case DXGI_FORMAT_Y416:
+ break;
+ case DXGI_FORMAT_YUY2:
+ break;
+ default:
+ break;
+ }
+
+ UNREACHABLE();
+ return Format::Get(FormatID::NONE);
+}
+
+} // namespace d3d11_angle
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h
new file mode 100644
index 0000000000..b4dc543e14
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.h
@@ -0,0 +1,43 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// dxgi_support_table:
+// Queries for DXGI support of various texture formats. Depends on DXGI
+// version, D3D feature level, and is sometimes guaranteed or optional.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_DXGI_SUPPORT_TABLE_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_DXGI_SUPPORT_TABLE_H_
+
+#include "common/platform.h"
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+struct DXGISupport
+{
+ DXGISupport() : alwaysSupportedFlags(0), neverSupportedFlags(0), optionallySupportedFlags(0) {}
+
+ DXGISupport(UINT alwaysSupportedIn, UINT neverSupportedIn, UINT optionallySupportedIn)
+ : alwaysSupportedFlags(alwaysSupportedIn),
+ neverSupportedFlags(neverSupportedIn),
+ optionallySupportedFlags(optionallySupportedIn)
+ {}
+
+ UINT alwaysSupportedFlags;
+ UINT neverSupportedFlags;
+ UINT optionallySupportedFlags;
+};
+
+const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel);
+
+} // namespace d3d11
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_DXGI_SUPPORT_TABLE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table_autogen.cpp
new file mode 100644
index 0000000000..51668abbe9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table_autogen.cpp
@@ -0,0 +1,3042 @@
+// GENERATED FILE - DO NOT EDIT. See dxgi_support_data.json.
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// dxgi_support_table:
+// Queries for DXGI support of various texture formats. Depends on DXGI
+// version, D3D feature level, and is sometimes guaranteed or optional.
+//
+
+#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
+
+#include "common/debug.h"
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+#define F_2D D3D11_FORMAT_SUPPORT_TEXTURE2D
+#define F_3D D3D11_FORMAT_SUPPORT_TEXTURE3D
+#define F_CUBE D3D11_FORMAT_SUPPORT_TEXTURECUBE
+#define F_SAMPLE D3D11_FORMAT_SUPPORT_SHADER_SAMPLE
+#define F_RT D3D11_FORMAT_SUPPORT_RENDER_TARGET
+#define F_MS D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET
+#define F_DS D3D11_FORMAT_SUPPORT_DEPTH_STENCIL
+#define F_MIPGEN D3D11_FORMAT_SUPPORT_MIP_AUTOGEN
+
+namespace
+{
+
+const DXGISupport &GetDefaultSupport()
+{
+ static UINT AllSupportFlags =
+ D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURE3D |
+ D3D11_FORMAT_SUPPORT_TEXTURECUBE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE |
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET |
+ D3D11_FORMAT_SUPPORT_DEPTH_STENCIL | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN;
+ static const DXGISupport defaultSupport(0, 0, AllSupportFlags);
+ return defaultSupport;
+}
+
+const DXGISupport &GetDXGISupport_9_3(DXGI_FORMAT dxgiFormat)
+{
+ // clang-format off
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_420_OPAQUE:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_AI44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_AYUV:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_SF16:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_UF16:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_D16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_IA44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_NV11:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_NV12:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P010:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P016:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ {
+ static const DXGISupport info(0, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ {
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ return info;
+ }
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ {
+ static const DXGISupport info(0, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ {
+ static const DXGISupport info(0, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_FLOAT:
+ {
+ static const DXGISupport info(0, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SNORM:
+ {
+ static const DXGISupport info(0, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R1_UNORM:
+ {
+ static const DXGISupport info(F_2D, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ {
+ static const DXGISupport info(0, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UNORM:
+ {
+ static const DXGISupport info(0, F_DS, F_MS | F_RT | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SNORM:
+ {
+ static const DXGISupport info(0, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UINT:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_UNKNOWN:
+ {
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y210:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y216:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y410:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y416:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_YUY2:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+
+ default:
+ UNREACHABLE();
+ return GetDefaultSupport();
+ }
+ // clang-format on
+}
+
+const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
+{
+ // clang-format off
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_420_OPAQUE:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_AI44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_AYUV:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ {
+ static const DXGISupport info(F_MIPGEN, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_RT | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_SF16:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_UF16:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_D16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_IA44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_NV11:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_NV12:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P010:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P016:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ {
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ return info;
+ }
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R1_UNORM:
+ {
+ static const DXGISupport info(F_2D, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_R32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_UNKNOWN:
+ {
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y210:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y216:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y410:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y416:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_YUY2:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+
+ default:
+ UNREACHABLE();
+ return GetDefaultSupport();
+ }
+ // clang-format on
+}
+
+const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
+{
+ // clang-format off
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_420_OPAQUE:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_AI44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_AYUV:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ {
+ static const DXGISupport info(F_MIPGEN, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_RT | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_SF16:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_UF16:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_D16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_IA44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_NV11:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_NV12:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P010:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P016:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ {
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ return info;
+ }
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R1_UNORM:
+ {
+ static const DXGISupport info(F_2D, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_UNKNOWN:
+ {
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y210:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y216:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y410:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y416:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_YUY2:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+
+ default:
+ UNREACHABLE();
+ return GetDefaultSupport();
+ }
+ // clang-format on
+}
+
+const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
+{
+ // clang-format off
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_420_OPAQUE:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_AI44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_AYUV:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ {
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_SF16:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_UF16:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_D16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_IA44:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_NV11:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_NV12:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P010:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P016:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P8:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ {
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ return info;
+ }
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_UNKNOWN:
+ {
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y210:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y216:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y410:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y416:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_YUY2:
+ {
+ static const DXGISupport info(0, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+
+ default:
+ UNREACHABLE();
+ return GetDefaultSupport();
+ }
+ // clang-format on
+}
+
+const DXGISupport &GetDXGISupport_11_1(DXGI_FORMAT dxgiFormat)
+{
+ // clang-format off
+ switch (dxgiFormat)
+ {
+ case DXGI_FORMAT_420_OPAQUE:
+ {
+ static const DXGISupport info(F_2D, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8P8:
+ {
+ static const DXGISupport info(F_2D, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_AI44:
+ {
+ static const DXGISupport info(F_2D, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_AYUV:
+ {
+ static const DXGISupport info(F_2D | F_RT | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ {
+ static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ {
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC4_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC5_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_SF16:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC6H_UF16:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_D16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_IA44:
+ {
+ static const DXGISupport info(F_2D, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_NV11:
+ {
+ static const DXGISupport info(F_2D | F_RT | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_NV12:
+ {
+ static const DXGISupport info(F_2D | F_RT | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P010:
+ {
+ static const DXGISupport info(F_2D | F_RT | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P016:
+ {
+ static const DXGISupport info(F_2D | F_RT | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_P8:
+ {
+ static const DXGISupport info(F_2D, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ {
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ return info;
+ }
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16G16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R16_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R1_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32B32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32G32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R32_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R32_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8G8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_SNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_TYPELESS:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R8_UNORM:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ return info;
+ }
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ {
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_UNKNOWN:
+ {
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ {
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y210:
+ {
+ static const DXGISupport info(F_2D | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y216:
+ {
+ static const DXGISupport info(F_2D | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y410:
+ {
+ static const DXGISupport info(F_2D | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_Y416:
+ {
+ static const DXGISupport info(F_2D | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+ case DXGI_FORMAT_YUY2:
+ {
+ static const DXGISupport info(F_2D | F_SAMPLE, F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ return info;
+ }
+
+ default:
+ UNREACHABLE();
+ return GetDefaultSupport();
+ }
+ // clang-format on
+}
+
+} // namespace
+
+#undef F_2D
+#undef F_3D
+#undef F_CUBE
+#undef F_SAMPLE
+#undef F_RT
+#undef F_MS
+#undef F_DS
+#undef F_MIPGEN
+
+const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_9_3:
+ return GetDXGISupport_9_3(dxgiFormat);
+ case D3D_FEATURE_LEVEL_10_0:
+ return GetDXGISupport_10_0(dxgiFormat);
+ case D3D_FEATURE_LEVEL_10_1:
+ return GetDXGISupport_10_1(dxgiFormat);
+ case D3D_FEATURE_LEVEL_11_0:
+ return GetDXGISupport_11_0(dxgiFormat);
+ case D3D_FEATURE_LEVEL_11_1:
+ return GetDXGISupport_11_1(dxgiFormat);
+ default:
+ return GetDefaultSupport();
+ }
+}
+
+} // namespace d3d11
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
new file mode 100644
index 0000000000..8654245258
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
@@ -0,0 +1,1021 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils11.cpp: Queries for GL image formats and their translations to D3D11
+// formats.
+
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+
+#include "image_util/copyimage.h"
+#include "image_util/generatemip.h"
+#include "image_util/loadimage.h"
+
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/copyvertex.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel)
+{
+ const auto &support = GetDXGISupport(dxgiFormat, featureLevel);
+ ASSERT((support.optionallySupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) == 0);
+ return ((support.alwaysSupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
+}
+
+DXGIFormatSize::DXGIFormatSize(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight)
+ : pixelBytes(pixelBits / 8), blockWidth(blockWidth), blockHeight(blockHeight)
+{}
+
+const DXGIFormatSize &GetDXGIFormatSizeInfo(DXGI_FORMAT format)
+{
+ static const DXGIFormatSize sizeUnknown(0, 0, 0);
+ static const DXGIFormatSize size128(128, 1, 1);
+ static const DXGIFormatSize size96(96, 1, 1);
+ static const DXGIFormatSize size64(64, 1, 1);
+ static const DXGIFormatSize size32(32, 1, 1);
+ static const DXGIFormatSize size16(16, 1, 1);
+ static const DXGIFormatSize size8(8, 1, 1);
+ static const DXGIFormatSize sizeBC1(64, 4, 4);
+ static const DXGIFormatSize sizeBC2(128, 4, 4);
+ static const DXGIFormatSize sizeBC3(128, 4, 4);
+ static const DXGIFormatSize sizeBC4(64, 4, 4);
+ static const DXGIFormatSize sizeBC5(128, 4, 4);
+ static const DXGIFormatSize sizeBC6H(128, 4, 4);
+ static const DXGIFormatSize sizeBC7(128, 4, 4);
+ switch (format)
+ {
+ case DXGI_FORMAT_UNKNOWN:
+ return sizeUnknown;
+ case DXGI_FORMAT_R32G32B32A32_TYPELESS:
+ case DXGI_FORMAT_R32G32B32A32_FLOAT:
+ case DXGI_FORMAT_R32G32B32A32_UINT:
+ case DXGI_FORMAT_R32G32B32A32_SINT:
+ return size128;
+ case DXGI_FORMAT_R32G32B32_TYPELESS:
+ case DXGI_FORMAT_R32G32B32_FLOAT:
+ case DXGI_FORMAT_R32G32B32_UINT:
+ case DXGI_FORMAT_R32G32B32_SINT:
+ return size96;
+ case DXGI_FORMAT_R16G16B16A16_TYPELESS:
+ case DXGI_FORMAT_R16G16B16A16_FLOAT:
+ case DXGI_FORMAT_R16G16B16A16_UNORM:
+ case DXGI_FORMAT_R16G16B16A16_UINT:
+ case DXGI_FORMAT_R16G16B16A16_SNORM:
+ case DXGI_FORMAT_R16G16B16A16_SINT:
+ case DXGI_FORMAT_R32G32_TYPELESS:
+ case DXGI_FORMAT_R32G32_FLOAT:
+ case DXGI_FORMAT_R32G32_UINT:
+ case DXGI_FORMAT_R32G32_SINT:
+ case DXGI_FORMAT_R32G8X24_TYPELESS:
+ case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
+ case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
+ case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
+ return size64;
+ case DXGI_FORMAT_R10G10B10A2_TYPELESS:
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ case DXGI_FORMAT_R10G10B10A2_UINT:
+ case DXGI_FORMAT_R11G11B10_FLOAT:
+ case DXGI_FORMAT_R8G8B8A8_TYPELESS:
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
+ case DXGI_FORMAT_R8G8B8A8_UINT:
+ case DXGI_FORMAT_R8G8B8A8_SNORM:
+ case DXGI_FORMAT_R8G8B8A8_SINT:
+ case DXGI_FORMAT_R16G16_TYPELESS:
+ case DXGI_FORMAT_R16G16_FLOAT:
+ case DXGI_FORMAT_R16G16_UNORM:
+ case DXGI_FORMAT_R16G16_UINT:
+ case DXGI_FORMAT_R16G16_SNORM:
+ case DXGI_FORMAT_R16G16_SINT:
+ case DXGI_FORMAT_R32_TYPELESS:
+ case DXGI_FORMAT_D32_FLOAT:
+ case DXGI_FORMAT_R32_FLOAT:
+ case DXGI_FORMAT_R32_UINT:
+ case DXGI_FORMAT_R32_SINT:
+ case DXGI_FORMAT_R24G8_TYPELESS:
+ case DXGI_FORMAT_D24_UNORM_S8_UINT:
+ case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
+ case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
+ return size32;
+ case DXGI_FORMAT_R8G8_TYPELESS:
+ case DXGI_FORMAT_R8G8_UNORM:
+ case DXGI_FORMAT_R8G8_UINT:
+ case DXGI_FORMAT_R8G8_SNORM:
+ case DXGI_FORMAT_R8G8_SINT:
+ case DXGI_FORMAT_R16_TYPELESS:
+ case DXGI_FORMAT_R16_FLOAT:
+ case DXGI_FORMAT_D16_UNORM:
+ case DXGI_FORMAT_R16_UNORM:
+ case DXGI_FORMAT_R16_UINT:
+ case DXGI_FORMAT_R16_SNORM:
+ case DXGI_FORMAT_R16_SINT:
+ return size16;
+ case DXGI_FORMAT_R8_TYPELESS:
+ case DXGI_FORMAT_R8_UNORM:
+ case DXGI_FORMAT_R8_UINT:
+ case DXGI_FORMAT_R8_SNORM:
+ case DXGI_FORMAT_R8_SINT:
+ case DXGI_FORMAT_A8_UNORM:
+ return size8;
+ case DXGI_FORMAT_R1_UNORM:
+ UNREACHABLE();
+ return sizeUnknown;
+ case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
+ case DXGI_FORMAT_R8G8_B8G8_UNORM:
+ case DXGI_FORMAT_G8R8_G8B8_UNORM:
+ return size32;
+ case DXGI_FORMAT_BC1_TYPELESS:
+ case DXGI_FORMAT_BC1_UNORM:
+ case DXGI_FORMAT_BC1_UNORM_SRGB:
+ return sizeBC1;
+ case DXGI_FORMAT_BC2_TYPELESS:
+ case DXGI_FORMAT_BC2_UNORM:
+ case DXGI_FORMAT_BC2_UNORM_SRGB:
+ return sizeBC2;
+ case DXGI_FORMAT_BC3_TYPELESS:
+ case DXGI_FORMAT_BC3_UNORM:
+ case DXGI_FORMAT_BC3_UNORM_SRGB:
+ return sizeBC3;
+ case DXGI_FORMAT_BC4_TYPELESS:
+ case DXGI_FORMAT_BC4_UNORM:
+ case DXGI_FORMAT_BC4_SNORM:
+ return sizeBC4;
+ case DXGI_FORMAT_BC5_TYPELESS:
+ case DXGI_FORMAT_BC5_UNORM:
+ case DXGI_FORMAT_BC5_SNORM:
+ return sizeBC5;
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ case DXGI_FORMAT_B5G5R5A1_UNORM:
+ return size16;
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
+ case DXGI_FORMAT_B8G8R8A8_TYPELESS:
+ case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
+ case DXGI_FORMAT_B8G8R8X8_TYPELESS:
+ case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
+ return size32;
+ case DXGI_FORMAT_BC6H_TYPELESS:
+ case DXGI_FORMAT_BC6H_UF16:
+ case DXGI_FORMAT_BC6H_SF16:
+ return sizeBC6H;
+ case DXGI_FORMAT_BC7_TYPELESS:
+ case DXGI_FORMAT_BC7_UNORM:
+ case DXGI_FORMAT_BC7_UNORM_SRGB:
+ return sizeBC7;
+ case DXGI_FORMAT_AYUV:
+ case DXGI_FORMAT_Y410:
+ case DXGI_FORMAT_Y416:
+ case DXGI_FORMAT_NV12:
+ case DXGI_FORMAT_P010:
+ case DXGI_FORMAT_P016:
+ case DXGI_FORMAT_420_OPAQUE:
+ case DXGI_FORMAT_YUY2:
+ case DXGI_FORMAT_Y210:
+ case DXGI_FORMAT_Y216:
+ case DXGI_FORMAT_NV11:
+ case DXGI_FORMAT_AI44:
+ case DXGI_FORMAT_IA44:
+ case DXGI_FORMAT_P8:
+ case DXGI_FORMAT_A8P8:
+ UNREACHABLE();
+ return sizeUnknown;
+ case DXGI_FORMAT_B4G4R4A4_UNORM:
+ return size16;
+ default:
+ UNREACHABLE();
+ return sizeUnknown;
+ }
+}
+
+constexpr VertexFormat::VertexFormat()
+ : conversionType(VERTEX_CONVERT_NONE), nativeFormat(DXGI_FORMAT_UNKNOWN), copyFunction(nullptr)
+{}
+
+constexpr VertexFormat::VertexFormat(VertexConversionType conversionTypeIn,
+ DXGI_FORMAT nativeFormatIn,
+ VertexCopyFunction copyFunctionIn)
+ : conversionType(conversionTypeIn), nativeFormat(nativeFormatIn), copyFunction(copyFunctionIn)
+{}
+
+const VertexFormat *GetVertexFormatInfo_FL_9_3(angle::FormatID vertexFormatID)
+{
+ // D3D11 Feature Level 9_3 doesn't support as many formats for vertex buffer resource as Feature
+ // Level 10_0+.
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ff471324(v=vs.85).aspx
+
+ switch (vertexFormatID)
+ {
+ // GL_BYTE -- unnormalized
+ case angle::FormatID::R8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
+ &Copy8SintTo16SintVertexData<1, 2>);
+ return &info;
+ }
+ case angle::FormatID::R8G8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
+ &Copy8SintTo16SintVertexData<2, 2>);
+ return &info;
+ }
+ case angle::FormatID::R8G8B8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
+ &Copy8SintTo16SintVertexData<3, 4>);
+ return &info;
+ }
+ case angle::FormatID::R8G8B8A8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
+ &Copy8SintTo16SintVertexData<4, 4>);
+ return &info;
+ }
+
+ // GL_BYTE -- normalized
+ case angle::FormatID::R8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
+ &Copy8SnormTo16SnormVertexData<1, 2>);
+ return &info;
+ }
+ case angle::FormatID::R8G8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
+ &Copy8SnormTo16SnormVertexData<2, 2>);
+ return &info;
+ }
+ case angle::FormatID::R8G8B8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
+ &Copy8SnormTo16SnormVertexData<3, 4>);
+ return &info;
+ }
+ case angle::FormatID::R8G8B8A8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
+ &Copy8SnormTo16SnormVertexData<4, 4>);
+ return &info;
+ }
+
+ // GL_UNSIGNED_BYTE -- un-normalized
+ // NOTE: 3 and 4 component unnormalized GL_UNSIGNED_BYTE should use the default format
+ // table.
+ case angle::FormatID::R8_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
+ &CopyNativeVertexData<GLubyte, 1, 4, 1>);
+ return &info;
+ }
+ case angle::FormatID::R8G8_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
+ &CopyNativeVertexData<GLubyte, 2, 4, 1>);
+ return &info;
+ }
+
+ // GL_UNSIGNED_BYTE -- normalized
+ // NOTE: 3 and 4 component normalized GL_UNSIGNED_BYTE should use the default format table.
+
+ // GL_UNSIGNED_BYTE -- normalized
+ case angle::FormatID::R8_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
+ &CopyNativeVertexData<GLubyte, 1, 4, UINT8_MAX>);
+ return &info;
+ }
+ case angle::FormatID::R8G8_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
+ &CopyNativeVertexData<GLubyte, 2, 4, UINT8_MAX>);
+ return &info;
+ }
+
+ // GL_SHORT -- un-normalized
+ // NOTE: 2, 3 and 4 component unnormalized GL_SHORT should use the default format table.
+ case angle::FormatID::R16_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
+ &CopyNativeVertexData<GLshort, 1, 2, 0>);
+ return &info;
+ }
+
+ // GL_SHORT -- normalized
+ // NOTE: 2, 3 and 4 component normalized GL_SHORT should use the default format table.
+ case angle::FormatID::R16_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
+ &CopyNativeVertexData<GLshort, 1, 2, 0>);
+ return &info;
+ }
+
+ // GL_UNSIGNED_SHORT -- un-normalized
+ case angle::FormatID::R16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 1, 2, false>);
+ return &info;
+ }
+ case angle::FormatID::R16G16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 2, 2, false>);
+ return &info;
+ }
+ case angle::FormatID::R16G16B16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 3, 3, false>);
+ return &info;
+ }
+ case angle::FormatID::R16G16B16A16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 4, 4, false>);
+ return &info;
+ }
+
+ // GL_UNSIGNED_SHORT -- normalized
+ case angle::FormatID::R16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 1, 2, true>);
+ return &info;
+ }
+ case angle::FormatID::R16G16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 2, 2, true>);
+ return &info;
+ }
+ case angle::FormatID::R16G16B16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 3, 3, true>);
+ return &info;
+ }
+ case angle::FormatID::R16G16B16A16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyTo32FVertexData<GLushort, 4, 4, true>);
+ return &info;
+ }
+
+ // GL_FIXED
+ // TODO: Add test to verify that this works correctly.
+ // NOTE: 2, 3 and 4 component GL_FIXED should use the default format table.
+ case angle::FormatID::R32_FIXED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &Copy32FixedTo32FVertexData<1, 2>);
+ return &info;
+ }
+
+ // GL_FLOAT
+ // TODO: Add test to verify that this works correctly.
+ // NOTE: 2, 3 and 4 component GL_FLOAT should use the default format table.
+ case angle::FormatID::R32_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyNativeVertexData<GLfloat, 1, 2, 0>);
+ return &info;
+ }
+
+ default:
+ return nullptr;
+ }
+}
+
+const VertexFormat &GetVertexFormatInfo(angle::FormatID vertexFormatID,
+ D3D_FEATURE_LEVEL featureLevel)
+{
+ if (featureLevel == D3D_FEATURE_LEVEL_9_3)
+ {
+ const VertexFormat *result = GetVertexFormatInfo_FL_9_3(vertexFormatID);
+ if (result)
+ {
+ return *result;
+ }
+ }
+
+ switch (vertexFormatID)
+ {
+ //
+ // Float formats
+ //
+
+ // GL_BYTE -- un-normalized
+ case angle::FormatID::R8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_SINT,
+ &CopyNativeVertexData<GLbyte, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_SINT,
+ &CopyNativeVertexData<GLbyte, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_SINT,
+ &CopyNativeVertexData<GLbyte, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8A8_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_SINT,
+ &CopyNativeVertexData<GLbyte, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_BYTE -- normalized
+ case angle::FormatID::R8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SNORM,
+ &CopyNativeVertexData<GLbyte, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SNORM,
+ &CopyNativeVertexData<GLbyte, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SNORM,
+ &CopyNativeVertexData<GLbyte, 3, 4, INT8_MAX>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8A8_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SNORM,
+ &CopyNativeVertexData<GLbyte, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_BYTE -- un-normalized
+ case angle::FormatID::R8_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_UINT,
+ &CopyNativeVertexData<GLubyte, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_UINT,
+ &CopyNativeVertexData<GLubyte, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
+ &CopyNativeVertexData<GLubyte, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8A8_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_UINT,
+ &CopyNativeVertexData<GLubyte, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_BYTE -- normalized
+ case angle::FormatID::R8_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UNORM,
+ &CopyNativeVertexData<GLubyte, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UNORM,
+ &CopyNativeVertexData<GLubyte, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
+ &CopyNativeVertexData<GLubyte, 3, 4, UINT8_MAX>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8A8_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UNORM,
+ &CopyNativeVertexData<GLubyte, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_SHORT -- un-normalized
+ case angle::FormatID::R16_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_SINT,
+ &CopyNativeVertexData<GLshort, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_SINT,
+ &CopyNativeVertexData<GLshort, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
+ &CopyNativeVertexData<GLshort, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16A16_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_SINT,
+ &CopyNativeVertexData<GLshort, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_SHORT -- normalized
+ case angle::FormatID::R16_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SNORM,
+ &CopyNativeVertexData<GLshort, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SNORM,
+ &CopyNativeVertexData<GLshort, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
+ &CopyNativeVertexData<GLshort, 3, 4, INT16_MAX>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16A16_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SNORM,
+ &CopyNativeVertexData<GLshort, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_SHORT -- un-normalized
+ case angle::FormatID::R16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_UINT,
+ &CopyNativeVertexData<GLushort, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_UINT,
+ &CopyNativeVertexData<GLushort, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_UINT,
+ &CopyNativeVertexData<GLushort, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16A16_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_UINT,
+ &CopyNativeVertexData<GLushort, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_SHORT -- normalized
+ case angle::FormatID::R16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UNORM,
+ &CopyNativeVertexData<GLushort, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UNORM,
+ &CopyNativeVertexData<GLushort, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UNORM,
+ &CopyNativeVertexData<GLushort, 3, 4, UINT16_MAX>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16A16_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UNORM,
+ &CopyNativeVertexData<GLushort, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_INT -- un-normalized
+ case angle::FormatID::R32_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_SINT,
+ &CopyNativeVertexData<GLint, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_SINT,
+ &CopyNativeVertexData<GLint, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_SINT,
+ &CopyNativeVertexData<GLint, 3, 3, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_SINT,
+ &CopyNativeVertexData<GLint, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_INT -- normalized
+ case angle::FormatID::R32_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
+ &CopyTo32FVertexData<GLint, 1, 1, true>);
+ return info;
+ }
+ case angle::FormatID::R32G32_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyTo32FVertexData<GLint, 2, 2, true>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
+ &CopyTo32FVertexData<GLint, 3, 3, true>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyTo32FVertexData<GLint, 4, 4, true>);
+ return info;
+ }
+
+ // GL_UNSIGNED_INT -- un-normalized
+ case angle::FormatID::R32_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_UINT,
+ &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_UINT,
+ &CopyNativeVertexData<GLuint, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_UINT,
+ &CopyNativeVertexData<GLuint, 3, 3, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_UINT,
+ &CopyNativeVertexData<GLuint, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_INT -- normalized
+ case angle::FormatID::R32_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
+ &CopyTo32FVertexData<GLuint, 1, 1, true>);
+ return info;
+ }
+ case angle::FormatID::R32G32_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyTo32FVertexData<GLuint, 2, 2, true>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
+ &CopyTo32FVertexData<GLuint, 3, 3, true>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyTo32FVertexData<GLuint, 4, 4, true>);
+ return info;
+ }
+
+ // GL_FIXED
+ case angle::FormatID::R32_FIXED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
+ &Copy32FixedTo32FVertexData<1, 1>);
+ return info;
+ }
+ case angle::FormatID::R32G32_FIXED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &Copy32FixedTo32FVertexData<2, 2>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_FIXED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
+ &Copy32FixedTo32FVertexData<3, 3>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_FIXED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &Copy32FixedTo32FVertexData<4, 4>);
+ return info;
+ }
+
+ // GL_HALF_FLOAT
+ case angle::FormatID::R16_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_FLOAT,
+ &CopyNativeVertexData<GLhalf, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_FLOAT,
+ &CopyNativeVertexData<GLhalf, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_FLOAT,
+ &CopyNativeVertexData<GLhalf, 3, 4, gl::Float16One>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16A16_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_FLOAT,
+ &CopyNativeVertexData<GLhalf, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_FLOAT
+ case angle::FormatID::R32_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT,
+ &CopyNativeVertexData<GLfloat, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyNativeVertexData<GLfloat, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_FLOAT,
+ &CopyNativeVertexData<GLfloat, 3, 3, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_FLOAT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyNativeVertexData<GLfloat, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_INT_2_10_10_10_REV
+ case angle::FormatID::R10G10B10A2_SSCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyXYZ10W2ToXYZW32FVertexData<true, false, true>);
+ return info;
+ }
+ case angle::FormatID::R10G10B10A2_SNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyXYZ10W2ToXYZW32FVertexData<true, true, true>);
+ return info;
+ }
+
+ // GL_UNSIGNED_INT_2_10_10_10_REV
+ case angle::FormatID::R10G10B10A2_USCALED:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyXYZ10W2ToXYZW32FVertexData<false, false, true>);
+ return info;
+ }
+ case angle::FormatID::R10G10B10A2_UNORM:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UNORM,
+ &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ return info;
+ }
+
+ //
+ // Integer Formats
+ //
+
+ // GL_BYTE
+ case angle::FormatID::R8_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SINT,
+ &CopyNativeVertexData<GLbyte, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SINT,
+ &CopyNativeVertexData<GLbyte, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SINT,
+ &CopyNativeVertexData<GLbyte, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8A8_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SINT,
+ &CopyNativeVertexData<GLbyte, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_BYTE
+ case angle::FormatID::R8_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UINT,
+ &CopyNativeVertexData<GLubyte, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UINT,
+ &CopyNativeVertexData<GLubyte, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UINT,
+ &CopyNativeVertexData<GLubyte, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R8G8B8A8_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UINT,
+ &CopyNativeVertexData<GLubyte, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_SHORT
+ case angle::FormatID::R16_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SINT,
+ &CopyNativeVertexData<GLshort, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SINT,
+ &CopyNativeVertexData<GLshort, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT,
+ &CopyNativeVertexData<GLshort, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16A16_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SINT,
+ &CopyNativeVertexData<GLshort, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_SHORT
+ case angle::FormatID::R16_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UINT,
+ &CopyNativeVertexData<GLushort, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UINT,
+ &CopyNativeVertexData<GLushort, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UINT,
+ &CopyNativeVertexData<GLushort, 3, 4, 1>);
+ return info;
+ }
+ case angle::FormatID::R16G16B16A16_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UINT,
+ &CopyNativeVertexData<GLushort, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_INT
+ case angle::FormatID::R32_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT,
+ &CopyNativeVertexData<GLint, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT,
+ &CopyNativeVertexData<GLint, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT,
+ &CopyNativeVertexData<GLint, 3, 3, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT,
+ &CopyNativeVertexData<GLint, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_UNSIGNED_INT
+ case angle::FormatID::R32_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT,
+ &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT,
+ &CopyNativeVertexData<GLuint, 2, 2, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT,
+ &CopyNativeVertexData<GLuint, 3, 3, 0>);
+ return info;
+ }
+ case angle::FormatID::R32G32B32A32_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT,
+ &CopyNativeVertexData<GLuint, 4, 4, 0>);
+ return info;
+ }
+
+ // GL_INT_2_10_10_10_REV
+ case angle::FormatID::R10G10B10A2_SINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT,
+ &CopyXYZ10W2ToXYZW32FVertexData<true, true, false>);
+ return info;
+ }
+
+ // GL_UNSIGNED_INT_2_10_10_10_REV
+ case angle::FormatID::R10G10B10A2_UINT:
+ {
+ static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UINT,
+ &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ return info;
+ }
+
+ default:
+ {
+ static constexpr VertexFormat info;
+ return info;
+ }
+ }
+}
+
+} // namespace d3d11
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.h
new file mode 100644
index 0000000000..037fdc4088
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.h
@@ -0,0 +1,72 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils11.h: Queries for GL image formats and their translations to D3D11
+// formats.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
+
+#include <map>
+
+#include "common/platform.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/copyvertex.h"
+#include "libANGLE/renderer/d3d/formatutilsD3D.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace rx
+{
+struct Renderer11DeviceCaps;
+
+namespace d3d11
+{
+
+// A texture might be stored as DXGI_FORMAT_R16_TYPELESS but store integer components,
+// which are accessed through an DXGI_FORMAT_R16_SINT view. It's easy to write code which queries
+// information about the wrong format. Therefore, use of this should be avoided where possible.
+
+bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel);
+
+struct DXGIFormatSize
+{
+ DXGIFormatSize(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight);
+
+ GLuint pixelBytes;
+ GLuint blockWidth;
+ GLuint blockHeight;
+};
+const DXGIFormatSize &GetDXGIFormatSizeInfo(DXGI_FORMAT format);
+
+struct VertexFormat : private angle::NonCopyable
+{
+ constexpr VertexFormat();
+ constexpr VertexFormat(VertexConversionType conversionType,
+ DXGI_FORMAT nativeFormat,
+ VertexCopyFunction copyFunction);
+
+ VertexConversionType conversionType;
+ DXGI_FORMAT nativeFormat;
+ VertexCopyFunction copyFunction;
+};
+
+const VertexFormat &GetVertexFormatInfo(angle::FormatID vertexFormatID,
+ D3D_FEATURE_LEVEL featureLevel);
+
+// Auto-generated in dxgi_format_map_autogen.cpp.
+GLenum GetComponentType(DXGI_FORMAT dxgiFormat);
+
+} // namespace d3d11
+
+namespace d3d11_angle
+{
+const angle::Format &GetFormat(DXGI_FORMAT dxgiFormat);
+}
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
new file mode 100644
index 0000000000..c4c63de9df
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
@@ -0,0 +1,2612 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// renderer11_utils.cpp: Conversion functions and other utility routines
+// specific to the D3D11 renderer.
+
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#include <algorithm>
+
+#include "common/debug.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/State.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/Context11.h"
+#include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h"
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+#include "libANGLE/renderer/driver_utils.h"
+#include "platform/FeaturesD3D.h"
+#include "platform/Platform.h"
+
+namespace rx
+{
+
+namespace d3d11_gl
+{
+namespace
+{
+// Standard D3D sample positions from
+// https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218.aspx
+using SamplePositionsArray = std::array<float, 32>;
+static constexpr std::array<SamplePositionsArray, 5> kSamplePositions = {
+ {{{0.5f, 0.5f}},
+ {{0.75f, 0.75f, 0.25f, 0.25f}},
+ {{0.375f, 0.125f, 0.875f, 0.375f, 0.125f, 0.625f, 0.625f, 0.875f}},
+ {{0.5625f, 0.3125f, 0.4375f, 0.6875f, 0.8125f, 0.5625f, 0.3125f, 0.1875f, 0.1875f, 0.8125f,
+ 0.0625f, 0.4375f, 0.6875f, 0.9375f, 0.9375f, 0.0625f}},
+ {{0.5625f, 0.5625f, 0.4375f, 0.3125f, 0.3125f, 0.625f, 0.75f, 0.4375f,
+ 0.1875f, 0.375f, 0.625f, 0.8125f, 0.8125f, 0.6875f, 0.6875f, 0.1875f,
+ 0.375f, 0.875f, 0.5f, 0.0625f, 0.25f, 0.125f, 0.125f, 0.75f,
+ 0.0f, 0.5f, 0.9375f, 0.25f, 0.875f, 0.9375f, 0.0625f, 0.0f}}}};
+
+// TODO(xinghua.cao@intel.com): Get a more accurate limit.
+static D3D_FEATURE_LEVEL kMinimumFeatureLevelForES31 = D3D_FEATURE_LEVEL_11_0;
+
+// Helper functor for querying DXGI support. Saves passing the parameters repeatedly.
+class DXGISupportHelper : angle::NonCopyable
+{
+ public:
+ DXGISupportHelper(ID3D11Device *device, D3D_FEATURE_LEVEL featureLevel)
+ : mDevice(device), mFeatureLevel(featureLevel)
+ {}
+
+ bool query(DXGI_FORMAT dxgiFormat, UINT supportMask)
+ {
+ if (dxgiFormat == DXGI_FORMAT_UNKNOWN)
+ return false;
+
+ auto dxgiSupport = d3d11::GetDXGISupport(dxgiFormat, mFeatureLevel);
+
+ UINT supportedBits = dxgiSupport.alwaysSupportedFlags;
+
+ if ((dxgiSupport.optionallySupportedFlags & supportMask) != 0)
+ {
+ UINT formatSupport;
+ if (SUCCEEDED(mDevice->CheckFormatSupport(dxgiFormat, &formatSupport)))
+ {
+ supportedBits |= (formatSupport & supportMask);
+ }
+ else
+ {
+ // TODO(jmadill): find out why we fail this call sometimes in FL9_3
+ // ERR() << "Error checking format support for format 0x" << std::hex << dxgiFormat;
+ }
+ }
+
+ return ((supportedBits & supportMask) == supportMask);
+ }
+
+ private:
+ ID3D11Device *mDevice;
+ D3D_FEATURE_LEVEL mFeatureLevel;
+};
+
+gl::TextureCaps GenerateTextureFormatCaps(gl::Version maxClientVersion,
+ GLenum internalFormat,
+ ID3D11Device *device,
+ const Renderer11DeviceCaps &renderer11DeviceCaps)
+{
+ gl::TextureCaps textureCaps;
+
+ DXGISupportHelper support(device, renderer11DeviceCaps.featureLevel);
+ const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
+
+ const gl::InternalFormat &internalFormatInfo = gl::GetSizedInternalFormatInfo(internalFormat);
+
+ UINT texSupportMask = D3D11_FORMAT_SUPPORT_TEXTURE2D;
+ if (internalFormatInfo.depthBits == 0 && internalFormatInfo.stencilBits == 0)
+ {
+ texSupportMask |= D3D11_FORMAT_SUPPORT_TEXTURECUBE;
+ if (maxClientVersion.major > 2)
+ {
+ texSupportMask |= D3D11_FORMAT_SUPPORT_TEXTURE3D;
+ }
+ }
+
+ textureCaps.texturable = support.query(formatInfo.texFormat, texSupportMask);
+ textureCaps.filterable =
+ support.query(formatInfo.srvFormat, D3D11_FORMAT_SUPPORT_SHADER_SAMPLE);
+ textureCaps.textureAttachment =
+ (support.query(formatInfo.rtvFormat, D3D11_FORMAT_SUPPORT_RENDER_TARGET)) ||
+ (support.query(formatInfo.dsvFormat, D3D11_FORMAT_SUPPORT_DEPTH_STENCIL));
+ textureCaps.renderbuffer = textureCaps.textureAttachment;
+
+ DXGI_FORMAT renderFormat = DXGI_FORMAT_UNKNOWN;
+ if (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ renderFormat = formatInfo.dsvFormat;
+ }
+ else if (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
+ {
+ renderFormat = formatInfo.rtvFormat;
+ }
+ if (renderFormat != DXGI_FORMAT_UNKNOWN &&
+ support.query(renderFormat, D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET))
+ {
+ // Assume 1x
+ textureCaps.sampleCounts.insert(1);
+
+ for (unsigned int sampleCount = 2; sampleCount <= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT;
+ sampleCount *= 2)
+ {
+ UINT qualityCount = 0;
+ if (SUCCEEDED(device->CheckMultisampleQualityLevels(renderFormat, sampleCount,
+ &qualityCount)))
+ {
+ // Assume we always support lower sample counts
+ if (qualityCount == 0)
+ {
+ break;
+ }
+ textureCaps.sampleCounts.insert(sampleCount);
+ }
+ }
+ }
+
+ return textureCaps;
+}
+
+bool GetNPOTTextureSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
+
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return false;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+float GetMaximumAnisotropy(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_MAX_MAXANISOTROPY;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_MAX_MAXANISOTROPY;
+
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ return 16;
+
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_DEFAULT_MAX_ANISOTROPY;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+bool GetOcclusionQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
+
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
+ // ID3D11Device::CreateQuery
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ return true;
+ case D3D_FEATURE_LEVEL_9_1:
+ return false;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool GetEventQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
+ // ID3D11Device::CreateQuery
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return true;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool GetInstancingSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
+ // ID3D11Device::CreateInputLayout
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
+
+ // Feature Level 9_3 supports instancing, but slot 0 in the input layout must not be
+ // instanced.
+ // D3D9 has a similar restriction, where stream 0 must not be instanced.
+ // This restriction can be worked around by remapping any non-instanced slot to slot
+ // 0.
+ // This works because HLSL uses shader semantics to match the vertex inputs to the
+ // elements in the input layout, rather than the slots.
+ // Note that we only support instancing via ANGLE_instanced_array on 9_3, since 9_3
+ // doesn't support OpenGL ES 3.0
+ case D3D_FEATURE_LEVEL_9_3:
+ return true;
+
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return false;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool GetFramebufferMultisampleSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return false;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool GetFramebufferBlitSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return false;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool GetDerivativeInstructionSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588.aspx states that
+ // shader model
+ // ps_2_x is required for the ddx (and other derivative functions).
+
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx states that
+ // feature level
+ // 9.3 supports shader model ps_2_x.
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3:
+ return true;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return false;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool GetShaderTextureLODSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return true;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return false;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+size_t GetMaximumSimultaneousRenderTargets(D3D_FEATURE_LEVEL featureLevel)
+{
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
+ // ID3D11Device::CreateInputLayout
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximum2DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumCubeMapTextureSize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_TEXTURECUBE_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_TEXTURECUBE_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ return D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximum2DTextureArraySize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximum3DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumViewportSize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_VIEWPORT_BOUNDS_MAX;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_VIEWPORT_BOUNDS_MAX;
+
+ // No constants for D3D11 Feature Level 9 viewport size limits, use the maximum
+ // texture sizes
+ case D3D_FEATURE_LEVEL_9_3:
+ return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumDrawIndexedIndexCount(D3D_FEATURE_LEVEL featureLevel)
+{
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since
+ // that's what's
+ // returned from glGetInteger
+ static_assert(D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32,
+ "Unexpected D3D11 constant value.");
+ static_assert(D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32,
+ "Unexpected D3D11 constant value.");
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return std::numeric_limits<GLint>::max();
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumDrawVertexCount(D3D_FEATURE_LEVEL featureLevel)
+{
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since
+ // that's what's
+ // returned from glGetInteger
+ static_assert(D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32, "Unexpected D3D11 constant value.");
+ static_assert(D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32, "Unexpected D3D11 constant value.");
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return std::numeric_limits<GLint>::max();
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumVertexInputSlots(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_STANDARD_VERTEX_ELEMENT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ return D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_STANDARD_VERTEX_ELEMENT_COUNT;
+
+ // From http://http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
+ // "Max Input Slots"
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 16;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
+ // ID3D11DeviceContext::VSSetConstantBuffers
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 255 - d3d11_gl::GetReservedVertexUniformVectors(featureLevel);
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumVertexUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+
+ // Uniform blocks not supported on D3D11 Feature Level 9
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetReservedVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ // According to The OpenGL ES Shading Language specifications
+ // (Language Version 1.00 section 10.16, Language Version 3.10 section 12.21)
+ // built-in special variables (e.g. gl_FragCoord, or gl_PointCoord)
+ // which are statically used in the shader should be included in the variable packing
+ // algorithm.
+ // Therefore, we should not reserve output vectors for them.
+
+ switch (featureLevel)
+ {
+ // We must reserve one output vector for dx_Position.
+ // We also reserve one for gl_Position, which we unconditionally output on Feature
+ // Levels 10_0+,
+ // even if it's unused in the shader (e.g. for transform feedback). TODO: This could
+ // be improved.
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 2;
+
+ // Just reserve dx_Position on Feature Level 9, since we don't ever need to output
+ // gl_Position.
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 1;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ static_assert(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT,
+ "Unexpected D3D11 constant value.");
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+ case D3D_FEATURE_LEVEL_10_1:
+ return D3D10_1_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+ // Use Shader Model 2.X limits
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 8 - GetReservedVertexOutputVectors(featureLevel);
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumVertexTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+ // Vertex textures not supported on D3D11 Feature Level 9 according to
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
+ // ID3D11DeviceContext::VSSetSamplers and ID3D11DeviceContext::VSSetShaderResources
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumPixelUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ // TODO(geofflang): Remove hard-coded limit once the gl-uniform-arrays test can pass
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return 1024; // D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 1024; // D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
+ // ID3D11DeviceContext::PSSetConstantBuffers
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 32 - d3d11_gl::GetReservedFragmentUniformVectors(featureLevel);
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumPixelUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+
+ // Uniform blocks not supported on D3D11 Feature Level 9
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumPixelInputVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+ // Use Shader Model 2.X limits
+ case D3D_FEATURE_LEVEL_9_3:
+ return 8 - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 8 - GetReservedVertexOutputVectors(featureLevel);
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumPixelTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
+ // ID3D11DeviceContext::PSSetShaderResources
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 16;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+std::array<GLuint, 3> GetMaxComputeWorkGroupCount(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return {{D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION,
+ D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION,
+ D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION}};
+ break;
+ default:
+ return {{0, 0, 0}};
+ }
+}
+
+std::array<GLuint, 3> GetMaxComputeWorkGroupSize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return {{D3D11_CS_THREAD_GROUP_MAX_X, D3D11_CS_THREAD_GROUP_MAX_Y,
+ D3D11_CS_THREAD_GROUP_MAX_Z}};
+ break;
+ default:
+ return {{0, 0, 0}};
+ }
+}
+
+size_t GetMaxComputeWorkGroupInvocations(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP;
+ default:
+ return 0;
+ }
+}
+
+unsigned int GetMaxComputeSharedMemorySize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ // In D3D11 the maximum total size of all variables with the groupshared storage class is
+ // 32kb.
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-variable-syntax
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return 32768u;
+ default:
+ return 0u;
+ }
+}
+
+size_t GetMaximumComputeUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+ default:
+ return 0;
+ }
+}
+
+size_t GetMaximumComputeUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+ default:
+ return 0;
+ }
+}
+
+size_t GetMaximumComputeTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+ default:
+ return 0;
+ }
+}
+
+void SetUAVRelatedResourceLimits(D3D_FEATURE_LEVEL featureLevel, gl::Caps *caps)
+{
+ ASSERT(caps);
+
+ GLuint reservedUAVsForAtomicCounterBuffers = 0u;
+
+ // For pixel shaders, the render targets and unordered access views share the same resource
+ // slots when being written out.
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476465(v=vs.85).aspx
+ GLuint maxNumRTVsAndUAVs = 0u;
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ // Currently we allocate 4 UAV slots for atomic counter buffers on feature level 11_1.
+ reservedUAVsForAtomicCounterBuffers = 4u;
+ maxNumRTVsAndUAVs = D3D11_1_UAV_SLOT_COUNT;
+ break;
+ case D3D_FEATURE_LEVEL_11_0:
+ // Currently we allocate 1 UAV slot for atomic counter buffers on feature level 11_0.
+ reservedUAVsForAtomicCounterBuffers = 1u;
+ maxNumRTVsAndUAVs = D3D11_PS_CS_UAV_REGISTER_COUNT;
+ break;
+ default:
+ return;
+ }
+
+ // Set limits on atomic counter buffers in fragment shaders and compute shaders.
+ caps->maxCombinedAtomicCounterBuffers = reservedUAVsForAtomicCounterBuffers;
+ caps->maxShaderAtomicCounterBuffers[gl::ShaderType::Compute] =
+ reservedUAVsForAtomicCounterBuffers;
+ caps->maxShaderAtomicCounterBuffers[gl::ShaderType::Fragment] =
+ reservedUAVsForAtomicCounterBuffers;
+ caps->maxAtomicCounterBufferBindings = reservedUAVsForAtomicCounterBuffers;
+
+ // Setting MAX_COMPUTE_ATOMIC_COUNTERS to a conservative number of 1024 * the number of UAV
+ // reserved for atomic counters. It could theoretically be set to max buffer size / 4 but that
+ // number could cause problems.
+ caps->maxCombinedAtomicCounters = reservedUAVsForAtomicCounterBuffers * 1024;
+ caps->maxShaderAtomicCounters[gl::ShaderType::Compute] = caps->maxCombinedAtomicCounters;
+
+ // See
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3d11/overviews-direct3d-11-resources-limits
+ // Resource size (in MB) for any of the preceding resources is min(max(128,0.25f * (amount of
+ // dedicated VRAM)), 2048) MB. So we set it to 128MB to keep same with GL backend.
+ caps->maxShaderStorageBlockSize =
+ D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM * 1024 * 1024;
+
+ // Allocate the remaining slots for images and shader storage blocks.
+ // The maximum number of fragment shader outputs depends on the current context version, so we
+ // will not set it here. See comments in Context11::initialize().
+ caps->maxCombinedShaderOutputResources =
+ maxNumRTVsAndUAVs - reservedUAVsForAtomicCounterBuffers;
+
+ // Set limits on images and shader storage blocks in fragment shaders and compute shaders.
+ caps->maxCombinedShaderStorageBlocks = caps->maxCombinedShaderOutputResources;
+ caps->maxShaderStorageBlocks[gl::ShaderType::Compute] = caps->maxCombinedShaderOutputResources;
+ caps->maxShaderStorageBlocks[gl::ShaderType::Fragment] = caps->maxCombinedShaderOutputResources;
+ caps->maxShaderStorageBufferBindings = caps->maxCombinedShaderOutputResources;
+
+ caps->maxImageUnits = caps->maxCombinedShaderOutputResources;
+ caps->maxCombinedImageUniforms = caps->maxCombinedShaderOutputResources;
+ caps->maxShaderImageUniforms[gl::ShaderType::Compute] = caps->maxCombinedShaderOutputResources;
+ caps->maxShaderImageUniforms[gl::ShaderType::Fragment] = caps->maxCombinedShaderOutputResources;
+
+ // On feature level 11_1, UAVs are also available in vertex shaders and geometry shaders.
+ if (featureLevel == D3D_FEATURE_LEVEL_11_1)
+ {
+ caps->maxShaderAtomicCounterBuffers[gl::ShaderType::Vertex] =
+ caps->maxCombinedAtomicCounterBuffers;
+ caps->maxShaderAtomicCounterBuffers[gl::ShaderType::Geometry] =
+ caps->maxCombinedAtomicCounterBuffers;
+
+ caps->maxShaderImageUniforms[gl::ShaderType::Vertex] =
+ caps->maxCombinedShaderOutputResources;
+ caps->maxShaderStorageBlocks[gl::ShaderType::Vertex] =
+ caps->maxCombinedShaderOutputResources;
+ caps->maxShaderImageUniforms[gl::ShaderType::Geometry] =
+ caps->maxCombinedShaderOutputResources;
+ caps->maxShaderStorageBlocks[gl::ShaderType::Geometry] =
+ caps->maxCombinedShaderOutputResources;
+ }
+}
+
+int GetMinimumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
+
+ // Sampling functions with offsets are not available below shader model 4.0.
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+int GetMaximumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+
+ // Sampling functions with offsets are not available below shader model 4.0.
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+int GetMinimumTextureGatherOffset(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/gather4-po--sm5---asm-
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return -32;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+int GetMaximumTextureGatherOffset(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/gather4-po--sm5---asm-
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return 31;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel)
+{
+ // Returns a size_t despite the limit being a GLuint64 because size_t is the maximum
+ // size of
+ // any buffer that could be allocated.
+
+ const size_t bytesPerComponent = 4 * sizeof(float);
+
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+
+ // Limits from http://msdn.microsoft.com/en-us/library/windows/desktop/ff476501.aspx
+ // remarks section
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 4096 * bytesPerComponent;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumStreamOutputBuffers(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_SO_BUFFER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_10_1:
+ return D3D10_1_SO_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_SO_BUFFER_SLOT_COUNT;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumStreamOutputInterleavedComponents(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return GetMaximumVertexOutputVectors(featureLevel) * 4;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumStreamOutputSeparateComponents(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return GetMaximumStreamOutputInterleavedComponents(featureLevel) /
+ GetMaximumStreamOutputBuffers(featureLevel);
+
+ // D3D 10 and 10.1 only allow one output per output slot if an output slot other
+ // than zero is used.
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 4;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+size_t GetMaximumRenderToBufferWindowSize(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH;
+
+ // REQ_RENDER_TO_BUFFER_WINDOW_WIDTH not supported on D3D11 Feature Level 9,
+ // use the maximum texture sizes
+ case D3D_FEATURE_LEVEL_9_3:
+ return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+IntelDriverVersion GetIntelDriverVersion(const Optional<LARGE_INTEGER> driverVersion)
+{
+ if (!driverVersion.valid())
+ return IntelDriverVersion(0);
+
+ // According to http://www.intel.com/content/www/us/en/support/graphics-drivers/000005654.html,
+ // only the fourth part is necessary since it stands for the driver specific unique version
+ // number.
+ WORD part = LOWORD(driverVersion.value().LowPart);
+ return IntelDriverVersion(part);
+}
+
+} // anonymous namespace
+
+unsigned int GetReservedVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 0;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 3; // dx_ViewAdjust, dx_ViewCoords and dx_ViewScale
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int GetReservedFragmentUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 0;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 3;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+gl::Version GetMaximumClientVersion(const Renderer11DeviceCaps &caps)
+{
+ switch (caps.featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return gl::Version(3, 1);
+ case D3D_FEATURE_LEVEL_10_1:
+ return gl::Version(3, 0);
+
+ case D3D_FEATURE_LEVEL_10_0:
+ if (caps.allowES3OnFL10_0) {
+ return gl::Version(3, 0);
+ } else {
+ return gl::Version(2, 0);
+ }
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return gl::Version(2, 0);
+
+ default:
+ UNREACHABLE();
+ return gl::Version(0, 0);
+ }
+}
+
+D3D_FEATURE_LEVEL GetMinimumFeatureLevelForES31()
+{
+ return kMinimumFeatureLevelForES31;
+}
+
+unsigned int GetMaxViewportAndScissorRectanglesPerPipeline(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 1;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+bool IsMultiviewSupported(D3D_FEATURE_LEVEL featureLevel)
+{
+ // The ANGLE_multiview extension can always be supported in D3D11 through geometry shaders.
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return true;
+ default:
+ return false;
+ }
+}
+
+unsigned int GetMaxSampleMaskWords(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ // D3D10+ only allows 1 sample mask.
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 1u;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 0u;
+ default:
+ UNREACHABLE();
+ return 0u;
+ }
+}
+
+void GenerateCaps(ID3D11Device *device,
+ ID3D11DeviceContext *deviceContext,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ const angle::FeaturesD3D &features,
+ gl::Caps *caps,
+ gl::TextureCapsMap *textureCapsMap,
+ gl::Extensions *extensions,
+ gl::Limitations *limitations)
+{
+ D3D_FEATURE_LEVEL featureLevel = renderer11DeviceCaps.featureLevel;
+ const gl::FormatSet &allFormats = gl::GetAllSizedInternalFormats();
+ for (GLenum internalFormat : allFormats)
+ {
+ gl::TextureCaps textureCaps = GenerateTextureFormatCaps(
+ GetMaximumClientVersion(renderer11DeviceCaps), internalFormat, device, renderer11DeviceCaps);
+ textureCapsMap->insert(internalFormat, textureCaps);
+
+ if (gl::GetSizedInternalFormatInfo(internalFormat).compressed)
+ {
+ caps->compressedTextureFormats.push_back(internalFormat);
+ }
+ }
+
+ // GL core feature limits
+ // Reserve MAX_UINT for D3D11's primitive restart.
+ caps->maxElementIndex = static_cast<GLint64>(std::numeric_limits<unsigned int>::max() - 1);
+ caps->max3DTextureSize = static_cast<GLuint>(GetMaximum3DTextureSize(featureLevel));
+ caps->max2DTextureSize = static_cast<GLuint>(GetMaximum2DTextureSize(featureLevel));
+ caps->maxCubeMapTextureSize = static_cast<GLuint>(GetMaximumCubeMapTextureSize(featureLevel));
+ caps->maxArrayTextureLayers = static_cast<GLuint>(GetMaximum2DTextureArraySize(featureLevel));
+
+ // Unimplemented, set to minimum required
+ caps->maxLODBias = 2.0f;
+
+ // No specific limits on render target size, maximum 2D texture size is equivalent
+ caps->maxRenderbufferSize = caps->max2DTextureSize;
+
+ // Maximum draw buffers and color attachments are the same, max color attachments could
+ // eventually be increased to 16
+ caps->maxDrawBuffers = static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel));
+ caps->maxColorAttachments =
+ static_cast<GLuint>(GetMaximumSimultaneousRenderTargets(featureLevel));
+
+ // D3D11 has the same limit for viewport width and height
+ caps->maxViewportWidth = static_cast<GLuint>(GetMaximumViewportSize(featureLevel));
+ caps->maxViewportHeight = caps->maxViewportWidth;
+
+ // Choose a reasonable maximum, enforced in the shader.
+ caps->minAliasedPointSize = 1.0f;
+ caps->maxAliasedPointSize = 1024.0f;
+
+ // Wide lines not supported
+ caps->minAliasedLineWidth = 1.0f;
+ caps->maxAliasedLineWidth = 1.0f;
+
+ // Primitive count limits
+ caps->maxElementsIndices = static_cast<GLuint>(GetMaximumDrawIndexedIndexCount(featureLevel));
+ caps->maxElementsVertices = static_cast<GLuint>(GetMaximumDrawVertexCount(featureLevel));
+
+ // Program and shader binary formats (no supported shader binary formats)
+ caps->programBinaryFormats.push_back(GL_PROGRAM_BINARY_ANGLE);
+
+ caps->vertexHighpFloat.setIEEEFloat();
+ caps->vertexMediumpFloat.setIEEEFloat();
+ caps->vertexLowpFloat.setIEEEFloat();
+ caps->fragmentHighpFloat.setIEEEFloat();
+ caps->fragmentMediumpFloat.setIEEEFloat();
+ caps->fragmentLowpFloat.setIEEEFloat();
+
+ // 32-bit integers are natively supported
+ caps->vertexHighpInt.setTwosComplementInt(32);
+ caps->vertexMediumpInt.setTwosComplementInt(32);
+ caps->vertexLowpInt.setTwosComplementInt(32);
+ caps->fragmentHighpInt.setTwosComplementInt(32);
+ caps->fragmentMediumpInt.setTwosComplementInt(32);
+ caps->fragmentLowpInt.setTwosComplementInt(32);
+
+ // We do not wait for server fence objects internally, so report a max timeout of zero.
+ caps->maxServerWaitTimeout = 0;
+
+ // Vertex shader limits
+ caps->maxVertexAttributes = static_cast<GLuint>(GetMaximumVertexInputSlots(featureLevel));
+ caps->maxVertexUniformVectors =
+ static_cast<GLuint>(GetMaximumVertexUniformVectors(featureLevel));
+ if (features.skipVSConstantRegisterZero.enabled)
+ {
+ caps->maxVertexUniformVectors -= 1;
+ }
+ caps->maxShaderUniformComponents[gl::ShaderType::Vertex] = caps->maxVertexUniformVectors * 4;
+ caps->maxShaderUniformBlocks[gl::ShaderType::Vertex] =
+ static_cast<GLuint>(GetMaximumVertexUniformBlocks(featureLevel));
+ caps->maxVertexOutputComponents =
+ static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel)) * 4;
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Vertex] =
+ static_cast<GLuint>(GetMaximumVertexTextureUnits(featureLevel));
+
+ // Vertex Attribute Bindings are emulated on D3D11.
+ caps->maxVertexAttribBindings = caps->maxVertexAttributes;
+ // Experimental testing confirmed there is no explicit limit on maximum buffer offset in D3D11.
+ caps->maxVertexAttribRelativeOffset = std::numeric_limits<GLint>::max();
+ // Experimental testing confirmed 2048 is the maximum stride that D3D11 can support on all
+ // platforms.
+ caps->maxVertexAttribStride = 2048;
+
+ // Fragment shader limits
+ caps->maxFragmentUniformVectors =
+ static_cast<GLuint>(GetMaximumPixelUniformVectors(featureLevel));
+ caps->maxShaderUniformComponents[gl::ShaderType::Fragment] =
+ caps->maxFragmentUniformVectors * 4;
+ caps->maxShaderUniformBlocks[gl::ShaderType::Fragment] =
+ static_cast<GLuint>(GetMaximumPixelUniformBlocks(featureLevel));
+ caps->maxFragmentInputComponents =
+ static_cast<GLuint>(GetMaximumPixelInputVectors(featureLevel)) * 4;
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Fragment] =
+ static_cast<GLuint>(GetMaximumPixelTextureUnits(featureLevel));
+ caps->minProgramTexelOffset = GetMinimumTexelOffset(featureLevel);
+ caps->maxProgramTexelOffset = GetMaximumTexelOffset(featureLevel);
+
+ // Compute shader limits
+ caps->maxComputeWorkGroupCount = GetMaxComputeWorkGroupCount(featureLevel);
+ caps->maxComputeWorkGroupSize = GetMaxComputeWorkGroupSize(featureLevel);
+ caps->maxComputeWorkGroupInvocations =
+ static_cast<GLuint>(GetMaxComputeWorkGroupInvocations(featureLevel));
+ caps->maxComputeSharedMemorySize = GetMaxComputeSharedMemorySize(featureLevel);
+ caps->maxShaderUniformComponents[gl::ShaderType::Compute] =
+ static_cast<GLuint>(GetMaximumComputeUniformVectors(featureLevel)) * 4;
+ caps->maxShaderUniformBlocks[gl::ShaderType::Compute] =
+ static_cast<GLuint>(GetMaximumComputeUniformBlocks(featureLevel));
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Compute] =
+ static_cast<GLuint>(GetMaximumComputeTextureUnits(featureLevel));
+
+ SetUAVRelatedResourceLimits(featureLevel, caps);
+
+ // Aggregate shader limits
+ caps->maxUniformBufferBindings = caps->maxShaderUniformBlocks[gl::ShaderType::Vertex] +
+ caps->maxShaderUniformBlocks[gl::ShaderType::Fragment];
+ caps->maxUniformBlockSize = GetMaximumConstantBufferSize(featureLevel);
+
+ // TODO(oetuaho): Get a more accurate limit. For now using the minimum requirement for GLES 3.1.
+ caps->maxUniformLocations = 1024;
+
+ // With DirectX 11.1, constant buffer offset and size must be a multiple of 16 constants of 16
+ // bytes each.
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx
+ // With DirectX 11.0, we emulate UBO offsets using copies of ranges of the UBO however
+ // we still keep the same alignment as 11.1 for consistency.
+ caps->uniformBufferOffsetAlignment = 256;
+
+ caps->maxCombinedUniformBlocks = caps->maxShaderUniformBlocks[gl::ShaderType::Vertex] +
+ caps->maxShaderUniformBlocks[gl::ShaderType::Fragment];
+
+ // A shader storage block will be translated to a structure in HLSL. So We reference the HLSL
+ // structure packing rules
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/bb509632(v=vs.85).aspx. The
+ // resulting size of any structure will always be evenly divisible by sizeof(four-component
+ // vector).
+ caps->shaderStorageBufferOffsetAlignment = 16;
+
+ for (gl::ShaderType shaderType : gl::AllShaderTypes())
+ {
+ caps->maxCombinedShaderUniformComponents[shaderType] =
+ static_cast<GLint64>(caps->maxShaderUniformBlocks[shaderType]) *
+ static_cast<GLint64>(caps->maxUniformBlockSize / 4) +
+ static_cast<GLint64>(caps->maxShaderUniformComponents[shaderType]);
+ }
+
+ caps->maxVaryingComponents =
+ static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel)) * 4;
+ caps->maxVaryingVectors = static_cast<GLuint>(GetMaximumVertexOutputVectors(featureLevel));
+ caps->maxCombinedTextureImageUnits = caps->maxShaderTextureImageUnits[gl::ShaderType::Vertex] +
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Fragment];
+
+ // Transform feedback limits
+ caps->maxTransformFeedbackInterleavedComponents =
+ static_cast<GLuint>(GetMaximumStreamOutputInterleavedComponents(featureLevel));
+ caps->maxTransformFeedbackSeparateAttributes =
+ static_cast<GLuint>(GetMaximumStreamOutputBuffers(featureLevel));
+ caps->maxTransformFeedbackSeparateComponents =
+ static_cast<GLuint>(GetMaximumStreamOutputSeparateComponents(featureLevel));
+
+ // Defer the computation of multisample limits to Context::updateCaps() where max*Samples values
+ // are determined according to available sample counts for each individual format.
+ caps->maxSamples = std::numeric_limits<GLint>::max();
+ caps->maxColorTextureSamples = std::numeric_limits<GLint>::max();
+ caps->maxDepthTextureSamples = std::numeric_limits<GLint>::max();
+ caps->maxIntegerSamples = std::numeric_limits<GLint>::max();
+
+ // Sample mask words limits
+ caps->maxSampleMaskWords = GetMaxSampleMaskWords(featureLevel);
+
+ // Framebuffer limits
+ caps->maxFramebufferSamples = std::numeric_limits<GLint>::max();
+ caps->maxFramebufferWidth =
+ static_cast<GLuint>(GetMaximumRenderToBufferWindowSize(featureLevel));
+ caps->maxFramebufferHeight = caps->maxFramebufferWidth;
+
+ // Texture gather offset limits
+ caps->minProgramTextureGatherOffset = GetMinimumTextureGatherOffset(featureLevel);
+ caps->maxProgramTextureGatherOffset = GetMaximumTextureGatherOffset(featureLevel);
+
+ // GL extension support
+ extensions->setTextureExtensionSupport(*textureCapsMap);
+
+ // Explicitly disable GL_OES_compressed_ETC1_RGB8_texture because it's emulated and never
+ // becomes core. WebGL doesn't want to expose it unless there is native support.
+ extensions->compressedETC1RGB8Texture = false;
+
+ extensions->elementIndexUint = true;
+ extensions->getProgramBinary = true;
+ extensions->rgb8rgba8 = true;
+ extensions->readFormatBGRA = true;
+ extensions->pixelBufferObject = true;
+ extensions->mapBuffer = true;
+ extensions->mapBufferRange = true;
+ extensions->textureNPOT = GetNPOTTextureSupport(featureLevel);
+ extensions->drawBuffers = GetMaximumSimultaneousRenderTargets(featureLevel) > 1;
+ extensions->textureStorage = true;
+ extensions->textureFilterAnisotropic = true;
+ extensions->maxTextureAnisotropy = GetMaximumAnisotropy(featureLevel);
+ extensions->occlusionQueryBoolean = GetOcclusionQuerySupport(featureLevel);
+ extensions->fence = GetEventQuerySupport(featureLevel);
+ extensions->disjointTimerQuery = true;
+ extensions->queryCounterBitsTimeElapsed = 64;
+ extensions->queryCounterBitsTimestamp =
+ 0; // Timestamps cannot be supported due to D3D11 limitations
+ extensions->robustness = true;
+ // Direct3D guarantees to return zero for any resource that is accessed out of bounds.
+ // See https://msdn.microsoft.com/en-us/library/windows/desktop/ff476332(v=vs.85).aspx
+ // and https://msdn.microsoft.com/en-us/library/windows/desktop/ff476900(v=vs.85).aspx
+ extensions->robustBufferAccessBehavior = true;
+ extensions->blendMinMax = true;
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3ddxgi/format-support-for-direct3d-11-0-feature-level-hardware
+ extensions->floatBlend = true;
+ extensions->framebufferBlit = GetFramebufferBlitSupport(featureLevel);
+ extensions->framebufferMultisample = GetFramebufferMultisampleSupport(featureLevel);
+ extensions->instancedArraysANGLE = GetInstancingSupport(featureLevel);
+ extensions->instancedArraysEXT = GetInstancingSupport(featureLevel);
+ extensions->packReverseRowOrder = true;
+ extensions->standardDerivatives = GetDerivativeInstructionSupport(featureLevel);
+ extensions->shaderTextureLOD = GetShaderTextureLODSupport(featureLevel);
+ extensions->fragDepth = true;
+ extensions->multiview = IsMultiviewSupported(featureLevel);
+ extensions->multiview2 = IsMultiviewSupported(featureLevel);
+ if (extensions->multiview || extensions->multiview2)
+ {
+ extensions->maxViews =
+ std::min(static_cast<GLuint>(gl::IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS),
+ std::min(static_cast<GLuint>(GetMaximum2DTextureArraySize(featureLevel)),
+ GetMaxViewportAndScissorRectanglesPerPipeline(featureLevel)));
+ }
+ extensions->textureUsage = true; // This could be false since it has no effect in D3D11
+ extensions->discardFramebuffer = true;
+ extensions->translatedShaderSource = true;
+ extensions->fboRenderMipmap = false;
+ extensions->debugMarker = true;
+ extensions->eglImage = true;
+ extensions->eglImageExternal = true;
+ extensions->eglImageExternalEssl3 = true;
+ extensions->eglStreamConsumerExternal = true;
+ extensions->unpackSubimage = true;
+ extensions->packSubimage = true;
+ extensions->lossyETCDecode = true;
+ extensions->syncQuery = GetEventQuerySupport(featureLevel);
+ extensions->copyTexture = true;
+ extensions->copyCompressedTexture = true;
+ extensions->textureStorageMultisample2DArray = true;
+ extensions->multiviewMultisample = ((extensions->multiview || extensions->multiview2) &&
+ extensions->textureStorageMultisample2DArray);
+ extensions->copyTexture3d = true;
+ extensions->textureBorderClamp = true;
+ extensions->textureMultisample = true;
+ extensions->provokingVertex = true;
+ extensions->blendFuncExtended = true;
+ extensions->maxDualSourceDrawBuffers = 1;
+ extensions->texture3DOES = true;
+
+ // D3D11 cannot support reading depth texture as a luminance texture.
+ // It treats it as a red-channel-only texture.
+ extensions->depthTextureOES = false;
+
+ // D3D11 Feature Level 10_0+ uses SV_IsFrontFace in HLSL to emulate gl_FrontFacing.
+ // D3D11 Feature Level 9_3 doesn't support SV_IsFrontFace, and has no equivalent, so can't
+ // support gl_FrontFacing.
+ limitations->noFrontFacingSupport =
+ (renderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3);
+
+ // D3D11 Feature Level 9_3 doesn't support alpha-to-coverage
+ limitations->noSampleAlphaToCoverageSupport =
+ (renderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3);
+
+ // D3D11 Feature Levels 9_3 and below do not support non-constant loop indexing and require
+ // additional
+ // pre-validation of the shader at compile time to produce a better error message.
+ limitations->shadersRequireIndexedLoopValidation =
+ (renderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3);
+
+ // D3D11 has no concept of separate masks and refs for front and back faces in the depth stencil
+ // state.
+ limitations->noSeparateStencilRefsAndMasks = true;
+
+ // D3D11 cannot support constant color and alpha blend funcs together
+ limitations->noSimultaneousConstantColorAndAlphaBlendFunc = true;
+
+ // D3D11 does not support multiple transform feedback outputs writing to the same buffer.
+ limitations->noDoubleBoundTransformFeedbackBuffers = true;
+
+ // D3D11 does not support vertex attribute aliasing
+ limitations->noVertexAttributeAliasing = true;
+
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+ // Setting a non-zero divisor on attribute zero doesn't work on certain Windows Phone 8-era
+ // devices. We should prevent developers from doing this on ALL Windows Store devices. This will
+ // maintain consistency across all Windows devices. We allow non-zero divisors on attribute zero
+ // if the Client Version >= 3, since devices affected by this issue don't support ES3+.
+ limitations->attributeZeroRequiresZeroDivisorInEXT = true;
+#endif
+}
+
+void GetSamplePosition(GLsizei sampleCount, size_t index, GLfloat *xy)
+{
+ size_t indexKey = static_cast<size_t>(ceil(log2(sampleCount)));
+ ASSERT(indexKey < kSamplePositions.size() &&
+ (2 * index + 1) < kSamplePositions[indexKey].size());
+
+ xy[0] = kSamplePositions[indexKey][2 * index];
+ xy[1] = kSamplePositions[indexKey][2 * index + 1];
+}
+
+} // namespace d3d11_gl
+
+namespace gl_d3d11
+{
+
+D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha)
+{
+ D3D11_BLEND d3dBlend = D3D11_BLEND_ZERO;
+
+ switch (glBlend)
+ {
+ case GL_ZERO:
+ d3dBlend = D3D11_BLEND_ZERO;
+ break;
+ case GL_ONE:
+ d3dBlend = D3D11_BLEND_ONE;
+ break;
+ case GL_SRC_COLOR:
+ d3dBlend = (isAlpha ? D3D11_BLEND_SRC_ALPHA : D3D11_BLEND_SRC_COLOR);
+ break;
+ case GL_ONE_MINUS_SRC_COLOR:
+ d3dBlend = (isAlpha ? D3D11_BLEND_INV_SRC_ALPHA : D3D11_BLEND_INV_SRC_COLOR);
+ break;
+ case GL_DST_COLOR:
+ d3dBlend = (isAlpha ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_DEST_COLOR);
+ break;
+ case GL_ONE_MINUS_DST_COLOR:
+ d3dBlend = (isAlpha ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_INV_DEST_COLOR);
+ break;
+ case GL_SRC_ALPHA:
+ d3dBlend = D3D11_BLEND_SRC_ALPHA;
+ break;
+ case GL_ONE_MINUS_SRC_ALPHA:
+ d3dBlend = D3D11_BLEND_INV_SRC_ALPHA;
+ break;
+ case GL_DST_ALPHA:
+ d3dBlend = D3D11_BLEND_DEST_ALPHA;
+ break;
+ case GL_ONE_MINUS_DST_ALPHA:
+ d3dBlend = D3D11_BLEND_INV_DEST_ALPHA;
+ break;
+ case GL_CONSTANT_COLOR:
+ d3dBlend = D3D11_BLEND_BLEND_FACTOR;
+ break;
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR;
+ break;
+ case GL_CONSTANT_ALPHA:
+ d3dBlend = D3D11_BLEND_BLEND_FACTOR;
+ break;
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR;
+ break;
+ case GL_SRC_ALPHA_SATURATE:
+ d3dBlend = D3D11_BLEND_SRC_ALPHA_SAT;
+ break;
+ case GL_SRC1_COLOR_EXT:
+ d3dBlend = (isAlpha ? D3D11_BLEND_SRC1_ALPHA : D3D11_BLEND_SRC1_COLOR);
+ break;
+ case GL_SRC1_ALPHA_EXT:
+ d3dBlend = D3D11_BLEND_SRC1_ALPHA;
+ break;
+ case GL_ONE_MINUS_SRC1_COLOR_EXT:
+ d3dBlend = (isAlpha ? D3D11_BLEND_INV_SRC1_ALPHA : D3D11_BLEND_INV_SRC1_COLOR);
+ break;
+ case GL_ONE_MINUS_SRC1_ALPHA_EXT:
+ d3dBlend = D3D11_BLEND_INV_SRC1_ALPHA;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dBlend;
+}
+
+D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp)
+{
+ D3D11_BLEND_OP d3dBlendOp = D3D11_BLEND_OP_ADD;
+
+ switch (glBlendOp)
+ {
+ case GL_FUNC_ADD:
+ d3dBlendOp = D3D11_BLEND_OP_ADD;
+ break;
+ case GL_FUNC_SUBTRACT:
+ d3dBlendOp = D3D11_BLEND_OP_SUBTRACT;
+ break;
+ case GL_FUNC_REVERSE_SUBTRACT:
+ d3dBlendOp = D3D11_BLEND_OP_REV_SUBTRACT;
+ break;
+ case GL_MIN:
+ d3dBlendOp = D3D11_BLEND_OP_MIN;
+ break;
+ case GL_MAX:
+ d3dBlendOp = D3D11_BLEND_OP_MAX;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dBlendOp;
+}
+
+UINT8 ConvertColorMask(bool red, bool green, bool blue, bool alpha)
+{
+ UINT8 mask = 0;
+ if (red)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_RED;
+ }
+ if (green)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_GREEN;
+ }
+ if (blue)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_BLUE;
+ }
+ if (alpha)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
+ }
+ return mask;
+}
+
+D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, gl::CullFaceMode cullMode)
+{
+ D3D11_CULL_MODE cull = D3D11_CULL_NONE;
+
+ if (cullEnabled)
+ {
+ switch (cullMode)
+ {
+ case gl::CullFaceMode::Front:
+ cull = D3D11_CULL_FRONT;
+ break;
+ case gl::CullFaceMode::Back:
+ cull = D3D11_CULL_BACK;
+ break;
+ case gl::CullFaceMode::FrontAndBack:
+ cull = D3D11_CULL_NONE;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+ else
+ {
+ cull = D3D11_CULL_NONE;
+ }
+
+ return cull;
+}
+
+D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison)
+{
+ D3D11_COMPARISON_FUNC d3dComp = D3D11_COMPARISON_NEVER;
+ switch (comparison)
+ {
+ case GL_NEVER:
+ d3dComp = D3D11_COMPARISON_NEVER;
+ break;
+ case GL_ALWAYS:
+ d3dComp = D3D11_COMPARISON_ALWAYS;
+ break;
+ case GL_LESS:
+ d3dComp = D3D11_COMPARISON_LESS;
+ break;
+ case GL_LEQUAL:
+ d3dComp = D3D11_COMPARISON_LESS_EQUAL;
+ break;
+ case GL_EQUAL:
+ d3dComp = D3D11_COMPARISON_EQUAL;
+ break;
+ case GL_GREATER:
+ d3dComp = D3D11_COMPARISON_GREATER;
+ break;
+ case GL_GEQUAL:
+ d3dComp = D3D11_COMPARISON_GREATER_EQUAL;
+ break;
+ case GL_NOTEQUAL:
+ d3dComp = D3D11_COMPARISON_NOT_EQUAL;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dComp;
+}
+
+D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled)
+{
+ return depthWriteEnabled ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
+}
+
+UINT8 ConvertStencilMask(GLuint stencilmask)
+{
+ return static_cast<UINT8>(stencilmask);
+}
+
+D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp)
+{
+ D3D11_STENCIL_OP d3dStencilOp = D3D11_STENCIL_OP_KEEP;
+
+ switch (stencilOp)
+ {
+ case GL_ZERO:
+ d3dStencilOp = D3D11_STENCIL_OP_ZERO;
+ break;
+ case GL_KEEP:
+ d3dStencilOp = D3D11_STENCIL_OP_KEEP;
+ break;
+ case GL_REPLACE:
+ d3dStencilOp = D3D11_STENCIL_OP_REPLACE;
+ break;
+ case GL_INCR:
+ d3dStencilOp = D3D11_STENCIL_OP_INCR_SAT;
+ break;
+ case GL_DECR:
+ d3dStencilOp = D3D11_STENCIL_OP_DECR_SAT;
+ break;
+ case GL_INVERT:
+ d3dStencilOp = D3D11_STENCIL_OP_INVERT;
+ break;
+ case GL_INCR_WRAP:
+ d3dStencilOp = D3D11_STENCIL_OP_INCR;
+ break;
+ case GL_DECR_WRAP:
+ d3dStencilOp = D3D11_STENCIL_OP_DECR;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dStencilOp;
+}
+
+D3D11_FILTER ConvertFilter(GLenum minFilter,
+ GLenum magFilter,
+ float maxAnisotropy,
+ GLenum comparisonMode)
+{
+ bool comparison = comparisonMode != GL_NONE;
+
+ if (maxAnisotropy > 1.0f)
+ {
+ return D3D11_ENCODE_ANISOTROPIC_FILTER(static_cast<D3D11_COMPARISON_FUNC>(comparison));
+ }
+ else
+ {
+ D3D11_FILTER_TYPE dxMin = D3D11_FILTER_TYPE_POINT;
+ D3D11_FILTER_TYPE dxMip = D3D11_FILTER_TYPE_POINT;
+ switch (minFilter)
+ {
+ case GL_NEAREST:
+ dxMin = D3D11_FILTER_TYPE_POINT;
+ dxMip = D3D11_FILTER_TYPE_POINT;
+ break;
+ case GL_LINEAR:
+ dxMin = D3D11_FILTER_TYPE_LINEAR;
+ dxMip = D3D11_FILTER_TYPE_POINT;
+ break;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ dxMin = D3D11_FILTER_TYPE_POINT;
+ dxMip = D3D11_FILTER_TYPE_POINT;
+ break;
+ case GL_LINEAR_MIPMAP_NEAREST:
+ dxMin = D3D11_FILTER_TYPE_LINEAR;
+ dxMip = D3D11_FILTER_TYPE_POINT;
+ break;
+ case GL_NEAREST_MIPMAP_LINEAR:
+ dxMin = D3D11_FILTER_TYPE_POINT;
+ dxMip = D3D11_FILTER_TYPE_LINEAR;
+ break;
+ case GL_LINEAR_MIPMAP_LINEAR:
+ dxMin = D3D11_FILTER_TYPE_LINEAR;
+ dxMip = D3D11_FILTER_TYPE_LINEAR;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ D3D11_FILTER_TYPE dxMag = D3D11_FILTER_TYPE_POINT;
+ switch (magFilter)
+ {
+ case GL_NEAREST:
+ dxMag = D3D11_FILTER_TYPE_POINT;
+ break;
+ case GL_LINEAR:
+ dxMag = D3D11_FILTER_TYPE_LINEAR;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip,
+ static_cast<D3D11_COMPARISON_FUNC>(comparison));
+ }
+}
+
+D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap)
+{
+ switch (wrap)
+ {
+ case GL_REPEAT:
+ return D3D11_TEXTURE_ADDRESS_WRAP;
+ case GL_CLAMP_TO_EDGE:
+ return D3D11_TEXTURE_ADDRESS_CLAMP;
+ case GL_CLAMP_TO_BORDER:
+ return D3D11_TEXTURE_ADDRESS_BORDER;
+ case GL_MIRRORED_REPEAT:
+ return D3D11_TEXTURE_ADDRESS_MIRROR;
+ default:
+ UNREACHABLE();
+ }
+
+ return D3D11_TEXTURE_ADDRESS_WRAP;
+}
+
+UINT ConvertMaxAnisotropy(float maxAnisotropy, D3D_FEATURE_LEVEL featureLevel)
+{
+ return static_cast<UINT>(std::min(maxAnisotropy, d3d11_gl::GetMaximumAnisotropy(featureLevel)));
+}
+
+D3D11_QUERY ConvertQueryType(gl::QueryType type)
+{
+ switch (type)
+ {
+ case gl::QueryType::AnySamples:
+ case gl::QueryType::AnySamplesConservative:
+ return D3D11_QUERY_OCCLUSION;
+ case gl::QueryType::TransformFeedbackPrimitivesWritten:
+ return D3D11_QUERY_SO_STATISTICS;
+ case gl::QueryType::TimeElapsed:
+ // Two internal queries are also created for begin/end timestamps
+ return D3D11_QUERY_TIMESTAMP_DISJOINT;
+ case gl::QueryType::CommandsCompleted:
+ return D3D11_QUERY_EVENT;
+ default:
+ UNREACHABLE();
+ return D3D11_QUERY_EVENT;
+ }
+}
+
+// Get the D3D11 write mask covering all color channels of a given format
+UINT8 GetColorMask(const gl::InternalFormat &format)
+{
+ return ConvertColorMask(format.redBits > 0, format.greenBits > 0, format.blueBits > 0,
+ format.alphaBits > 0);
+}
+
+} // namespace gl_d3d11
+
+namespace d3d11
+{
+
+ANGLED3D11DeviceType GetDeviceType(ID3D11Device *device)
+{
+ // Note that this function returns an ANGLED3D11DeviceType rather than a D3D_DRIVER_TYPE value,
+ // since it is difficult to tell Software and Reference devices apart
+
+ IDXGIDevice *dxgiDevice = nullptr;
+ IDXGIAdapter *dxgiAdapter = nullptr;
+ IDXGIAdapter2 *dxgiAdapter2 = nullptr;
+
+ ANGLED3D11DeviceType retDeviceType = ANGLE_D3D11_DEVICE_TYPE_UNKNOWN;
+
+ HRESULT hr = device->QueryInterface(__uuidof(IDXGIDevice), (void **)&dxgiDevice);
+ if (SUCCEEDED(hr))
+ {
+ hr = dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void **)&dxgiAdapter);
+ if (SUCCEEDED(hr))
+ {
+ std::wstring adapterString;
+ HRESULT adapter2hr =
+ dxgiAdapter->QueryInterface(__uuidof(dxgiAdapter2), (void **)&dxgiAdapter2);
+ if (SUCCEEDED(adapter2hr))
+ {
+ // On D3D_FEATURE_LEVEL_9_*, IDXGIAdapter::GetDesc returns "Software Adapter"
+ // for the description string. Try to use IDXGIAdapter2::GetDesc2 to get the
+ // actual hardware values if possible.
+ DXGI_ADAPTER_DESC2 adapterDesc2;
+ dxgiAdapter2->GetDesc2(&adapterDesc2);
+ adapterString = std::wstring(adapterDesc2.Description);
+ }
+ else
+ {
+ DXGI_ADAPTER_DESC adapterDesc;
+ dxgiAdapter->GetDesc(&adapterDesc);
+ adapterString = std::wstring(adapterDesc.Description);
+ }
+
+ // Both Reference and Software adapters will be 'Software Adapter'
+ const bool isSoftwareDevice =
+ (adapterString.find(std::wstring(L"Software Adapter")) != std::string::npos);
+ const bool isNullDevice = (adapterString == L"");
+ const bool isWARPDevice =
+ (adapterString.find(std::wstring(L"Basic Render")) != std::string::npos);
+
+ if (isSoftwareDevice || isNullDevice)
+ {
+ ASSERT(!isWARPDevice);
+ retDeviceType = ANGLE_D3D11_DEVICE_TYPE_SOFTWARE_REF_OR_NULL;
+ }
+ else if (isWARPDevice)
+ {
+ retDeviceType = ANGLE_D3D11_DEVICE_TYPE_WARP;
+ }
+ else
+ {
+ retDeviceType = ANGLE_D3D11_DEVICE_TYPE_HARDWARE;
+ }
+ }
+ }
+
+ SafeRelease(dxgiDevice);
+ SafeRelease(dxgiAdapter);
+ SafeRelease(dxgiAdapter2);
+
+ return retDeviceType;
+}
+
+void MakeValidSize(bool isImage,
+ DXGI_FORMAT format,
+ GLsizei *requestWidth,
+ GLsizei *requestHeight,
+ int *levelOffset)
+{
+ const DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(format);
+
+ int upsampleCount = 0;
+ // Don't expand the size of full textures that are at least (blockWidth x blockHeight) already.
+ if (isImage || *requestWidth < static_cast<GLsizei>(dxgiFormatInfo.blockWidth) ||
+ *requestHeight < static_cast<GLsizei>(dxgiFormatInfo.blockHeight))
+ {
+ while (*requestWidth % dxgiFormatInfo.blockWidth != 0 ||
+ *requestHeight % dxgiFormatInfo.blockHeight != 0)
+ {
+ *requestWidth <<= 1;
+ *requestHeight <<= 1;
+ upsampleCount++;
+ }
+ }
+ if (levelOffset)
+ {
+ *levelOffset = upsampleCount;
+ }
+}
+
+angle::Result GenerateInitialTextureData(
+ const gl::Context *context,
+ GLint internalFormat,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ GLuint width,
+ GLuint height,
+ GLuint depth,
+ GLuint mipLevels,
+ gl::TexLevelArray<D3D11_SUBRESOURCE_DATA> *outSubresourceData)
+{
+ const d3d11::Format &d3dFormatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
+ ASSERT(d3dFormatInfo.dataInitializerFunction != nullptr);
+
+ const d3d11::DXGIFormatSize &dxgiFormatInfo =
+ d3d11::GetDXGIFormatSizeInfo(d3dFormatInfo.texFormat);
+
+ unsigned int rowPitch = dxgiFormatInfo.pixelBytes * width;
+ unsigned int depthPitch = rowPitch * height;
+ unsigned int maxImageSize = depthPitch * depth;
+
+ angle::MemoryBuffer *scratchBuffer = nullptr;
+ ANGLE_CHECK_GL_ALLOC(GetImplAs<Context11>(context),
+ context->getScratchBuffer(maxImageSize, &scratchBuffer));
+
+ d3dFormatInfo.dataInitializerFunction(width, height, depth, scratchBuffer->data(), rowPitch,
+ depthPitch);
+
+ for (unsigned int i = 0; i < mipLevels; i++)
+ {
+ unsigned int mipWidth = std::max(width >> i, 1U);
+ unsigned int mipHeight = std::max(height >> i, 1U);
+
+ unsigned int mipRowPitch = dxgiFormatInfo.pixelBytes * mipWidth;
+ unsigned int mipDepthPitch = mipRowPitch * mipHeight;
+
+ outSubresourceData->at(i).pSysMem = scratchBuffer->data();
+ outSubresourceData->at(i).SysMemPitch = mipRowPitch;
+ outSubresourceData->at(i).SysMemSlicePitch = mipDepthPitch;
+ }
+
+ return angle::Result::Continue;
+}
+
+UINT GetPrimitiveRestartIndex()
+{
+ return std::numeric_limits<UINT>::max();
+}
+
+void SetPositionTexCoordVertex(PositionTexCoordVertex *vertex, float x, float y, float u, float v)
+{
+ vertex->x = x;
+ vertex->y = y;
+ vertex->u = u;
+ vertex->v = v;
+}
+
+void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex *vertex,
+ float x,
+ float y,
+ unsigned int layer,
+ float u,
+ float v,
+ float s)
+{
+ vertex->x = x;
+ vertex->y = y;
+ vertex->l = layer;
+ vertex->u = u;
+ vertex->v = v;
+ vertex->s = s;
+}
+
+BlendStateKey::BlendStateKey()
+{
+ memset(this, 0, sizeof(BlendStateKey));
+}
+
+bool operator==(const BlendStateKey &a, const BlendStateKey &b)
+{
+ return memcmp(&a, &b, sizeof(BlendStateKey)) == 0;
+}
+
+bool operator!=(const BlendStateKey &a, const BlendStateKey &b)
+{
+ return !(a == b);
+}
+
+RasterizerStateKey::RasterizerStateKey()
+{
+ memset(this, 0, sizeof(RasterizerStateKey));
+}
+
+bool operator==(const RasterizerStateKey &a, const RasterizerStateKey &b)
+{
+ return memcmp(&a, &b, sizeof(RasterizerStateKey)) == 0;
+}
+
+bool operator!=(const RasterizerStateKey &a, const RasterizerStateKey &b)
+{
+ return !(a == b);
+}
+
+HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
+{
+#if defined(_DEBUG)
+ UINT existingDataSize = 0;
+ resource->GetPrivateData(WKPDID_D3DDebugObjectName, &existingDataSize, nullptr);
+ // Don't check the HRESULT- if it failed then that probably just means that no private data
+ // exists yet
+
+ if (existingDataSize > 0)
+ {
+ // In some cases, ANGLE will try to apply two names to one object, which causes
+ // a D3D SDK Layers warning. This can occur if, for example, you 'create' two objects
+ // (e.g.Rasterizer States) with identical DESCs on the same device. D3D11 will optimize
+ // these calls and return the same object both times.
+ static const char *multipleNamesUsed = "Multiple names set by ANGLE";
+
+ // Remove the existing name
+ HRESULT hr = resource->SetPrivateData(WKPDID_D3DDebugObjectName, 0, nullptr);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ // Apply the new name
+ return resource->SetPrivateData(WKPDID_D3DDebugObjectName,
+ static_cast<unsigned int>(strlen(multipleNamesUsed)),
+ multipleNamesUsed);
+ }
+ else
+ {
+ return resource->SetPrivateData(WKPDID_D3DDebugObjectName,
+ static_cast<unsigned int>(strlen(name)), name);
+ }
+#else
+ return S_OK;
+#endif
+}
+
+// Keep this in cpp file where it has visibility of Renderer11.h, otherwise calling
+// allocateResource is only compatible with Clang and MSVS, which support calling a
+// method on a forward declared class in a template.
+template <ResourceType ResourceT>
+angle::Result LazyResource<ResourceT>::resolveImpl(d3d::Context *context,
+ Renderer11 *renderer,
+ const GetDescType<ResourceT> &desc,
+ GetInitDataType<ResourceT> *initData,
+ const char *name)
+{
+ if (!mResource.valid())
+ {
+ ANGLE_TRY(renderer->allocateResource(context, desc, initData, &mResource));
+ mResource.setDebugName(name);
+ }
+ return angle::Result::Continue;
+}
+
+template angle::Result LazyResource<ResourceType::BlendState>::resolveImpl(
+ d3d::Context *context,
+ Renderer11 *renderer,
+ const D3D11_BLEND_DESC &desc,
+ void *initData,
+ const char *name);
+template angle::Result LazyResource<ResourceType::ComputeShader>::resolveImpl(
+ d3d::Context *context,
+ Renderer11 *renderer,
+ const ShaderData &desc,
+ void *initData,
+ const char *name);
+template angle::Result LazyResource<ResourceType::GeometryShader>::resolveImpl(
+ d3d::Context *context,
+ Renderer11 *renderer,
+ const ShaderData &desc,
+ const std::vector<D3D11_SO_DECLARATION_ENTRY> *initData,
+ const char *name);
+template angle::Result LazyResource<ResourceType::InputLayout>::resolveImpl(
+ d3d::Context *context,
+ Renderer11 *renderer,
+ const InputElementArray &desc,
+ const ShaderData *initData,
+ const char *name);
+template angle::Result LazyResource<ResourceType::PixelShader>::resolveImpl(d3d::Context *context,
+ Renderer11 *renderer,
+ const ShaderData &desc,
+ void *initData,
+ const char *name);
+template angle::Result LazyResource<ResourceType::VertexShader>::resolveImpl(d3d::Context *context,
+ Renderer11 *renderer,
+ const ShaderData &desc,
+ void *initData,
+ const char *name);
+
+LazyInputLayout::LazyInputLayout(const D3D11_INPUT_ELEMENT_DESC *inputDesc,
+ size_t inputDescLen,
+ const BYTE *byteCode,
+ size_t byteCodeLen,
+ const char *debugName)
+ : mInputDesc(inputDesc, inputDescLen), mByteCode(byteCode, byteCodeLen), mDebugName(debugName)
+{}
+
+LazyInputLayout::~LazyInputLayout() {}
+
+angle::Result LazyInputLayout::resolve(d3d::Context *context, Renderer11 *renderer)
+{
+ return resolveImpl(context, renderer, mInputDesc, &mByteCode, mDebugName);
+}
+
+LazyBlendState::LazyBlendState(const D3D11_BLEND_DESC &desc, const char *debugName)
+ : mDesc(desc), mDebugName(debugName)
+{}
+
+angle::Result LazyBlendState::resolve(d3d::Context *context, Renderer11 *renderer)
+{
+ return resolveImpl(context, renderer, mDesc, nullptr, mDebugName);
+}
+
+void InitializeFeatures(const Renderer11DeviceCaps &deviceCaps,
+ const DXGI_ADAPTER_DESC &adapterDesc,
+ angle::FeaturesD3D *features)
+{
+ bool is9_3 = (deviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3);
+
+ features->mrtPerfWorkaround.enabled = true;
+ features->setDataFasterThanImageUpload.enabled = true;
+ features->setDataFasterThanImageUploadOn128bitFormats.enabled = true;
+ features->zeroMaxLodWorkaround.enabled = is9_3;
+ features->useInstancedPointSpriteEmulation.enabled = is9_3;
+
+ // TODO(jmadill): Narrow problematic driver range.
+ if (IsNvidia(adapterDesc.VendorId))
+ {
+ if (deviceCaps.driverVersion.valid())
+ {
+ WORD part1 = HIWORD(deviceCaps.driverVersion.value().LowPart);
+ WORD part2 = LOWORD(deviceCaps.driverVersion.value().LowPart);
+
+ // Disable the workaround to fix a second driver bug on newer NVIDIA.
+ features->depthStencilBlitExtraCopy.enabled = (part1 <= 13u && part2 < 6881);
+ }
+ else
+ {
+ features->depthStencilBlitExtraCopy.enabled = true;
+ }
+ }
+
+ // TODO(jmadill): Disable workaround when we have a fixed compiler DLL.
+ features->expandIntegerPowExpressions.enabled = true;
+
+ features->flushAfterEndingTransformFeedback.enabled = IsNvidia(adapterDesc.VendorId);
+ features->getDimensionsIgnoresBaseLevel.enabled = IsNvidia(adapterDesc.VendorId);
+ features->skipVSConstantRegisterZero.enabled = IsNvidia(adapterDesc.VendorId);
+ features->forceAtomicValueResolution.enabled = IsNvidia(adapterDesc.VendorId);
+ features->allowES3OnFL10_0.enabled = false;
+
+ if (IsIntel(adapterDesc.VendorId))
+ {
+ IntelDriverVersion capsVersion = d3d11_gl::GetIntelDriverVersion(deviceCaps.driverVersion);
+
+ features->preAddTexelFetchOffsets.enabled = true;
+ features->useSystemMemoryForConstantBuffers.enabled = true;
+ features->disableB5G6R5Support.enabled = capsVersion < IntelDriverVersion(4539);
+ features->addDummyTextureNoRenderTarget.enabled = capsVersion < IntelDriverVersion(4815);
+ if (IsSkylake(adapterDesc.DeviceId))
+ {
+ features->callClearTwice.enabled = capsVersion < IntelDriverVersion(4771);
+ features->emulateIsnanFloat.enabled = capsVersion < IntelDriverVersion(4542);
+ }
+ else if (IsBroadwell(adapterDesc.DeviceId) || IsHaswell(adapterDesc.DeviceId) ||
+ IsIvyBridge(adapterDesc.DeviceId))
+ {
+ features->rewriteUnaryMinusOperator.enabled = capsVersion < IntelDriverVersion(4624);
+
+ // Haswell drivers occasionally corrupt (small?) (vertex?) texture data uploads for
+ // 128bit formats.
+ features->setDataFasterThanImageUploadOn128bitFormats.enabled = false;
+ } else if (IsSandyBridge(adapterDesc.DeviceId)) {
+ features->emulateClearViewAfterDualSourceBlending.enabled = true;
+ }
+ }
+
+ if (IsAMD(adapterDesc.VendorId))
+ {
+ features->disableB5G6R5Support.enabled = true;
+ }
+
+ // TODO(jmadill): Disable when we have a fixed driver version.
+ features->emulateTinyStencilTextures.enabled = IsAMD(adapterDesc.VendorId);
+
+ // The tiny stencil texture workaround involves using CopySubresource or UpdateSubresource on a
+ // depth stencil texture. This is not allowed until feature level 10.1 but since it is not
+ // possible to support ES3 on these devices, there is no need for the workaround to begin with
+ // (anglebug.com/1572).
+ if (deviceCaps.featureLevel < D3D_FEATURE_LEVEL_10_1)
+ {
+ features->emulateTinyStencilTextures.enabled = false;
+ }
+
+ // If the VPAndRTArrayIndexFromAnyShaderFeedingRasterizer feature is not available, we have to
+ // select the viewport / RT array index in the geometry shader.
+ features->selectViewInGeometryShader.enabled =
+ (deviceCaps.supportsVpRtIndexWriteFromVertexShader == false);
+
+ // Never clear for robust resource init. This matches Chrome's texture clearning behaviour.
+ features->allowClearForRobustResourceInit.enabled = false;
+
+ // Call platform hooks for testing overrides.
+ auto *platform = ANGLEPlatformCurrent();
+ platform->overrideWorkaroundsD3D(platform, features);
+}
+
+void InitConstantBufferDesc(D3D11_BUFFER_DESC *constantBufferDescription, size_t byteWidth)
+{
+ constantBufferDescription->ByteWidth = static_cast<UINT>(byteWidth);
+ constantBufferDescription->Usage = D3D11_USAGE_DYNAMIC;
+ constantBufferDescription->BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+ constantBufferDescription->CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ constantBufferDescription->MiscFlags = 0;
+ constantBufferDescription->StructureByteStride = 0;
+}
+
+} // namespace d3d11
+
+// TextureHelper11 implementation.
+TextureHelper11::TextureHelper11() : mFormatSet(nullptr), mSampleCount(0) {}
+
+TextureHelper11::TextureHelper11(TextureHelper11 &&toCopy) : TextureHelper11()
+{
+ *this = std::move(toCopy);
+}
+
+TextureHelper11::TextureHelper11(const TextureHelper11 &other)
+ : mFormatSet(other.mFormatSet), mExtents(other.mExtents), mSampleCount(other.mSampleCount)
+{
+ mData = other.mData;
+}
+
+TextureHelper11::~TextureHelper11() {}
+
+void TextureHelper11::getDesc(D3D11_TEXTURE2D_DESC *desc) const
+{
+ static_cast<ID3D11Texture2D *>(mData->object)->GetDesc(desc);
+}
+
+void TextureHelper11::getDesc(D3D11_TEXTURE3D_DESC *desc) const
+{
+ static_cast<ID3D11Texture3D *>(mData->object)->GetDesc(desc);
+}
+
+void TextureHelper11::initDesc(const D3D11_TEXTURE2D_DESC &desc2D)
+{
+ mData->resourceType = ResourceType::Texture2D;
+ mExtents.width = static_cast<int>(desc2D.Width);
+ mExtents.height = static_cast<int>(desc2D.Height);
+ mExtents.depth = 1;
+ mSampleCount = desc2D.SampleDesc.Count;
+}
+
+void TextureHelper11::initDesc(const D3D11_TEXTURE3D_DESC &desc3D)
+{
+ mData->resourceType = ResourceType::Texture3D;
+ mExtents.width = static_cast<int>(desc3D.Width);
+ mExtents.height = static_cast<int>(desc3D.Height);
+ mExtents.depth = static_cast<int>(desc3D.Depth);
+ mSampleCount = 1;
+}
+
+TextureHelper11 &TextureHelper11::operator=(TextureHelper11 &&other)
+{
+ std::swap(mData, other.mData);
+ std::swap(mExtents, other.mExtents);
+ std::swap(mFormatSet, other.mFormatSet);
+ std::swap(mSampleCount, other.mSampleCount);
+ return *this;
+}
+
+TextureHelper11 &TextureHelper11::operator=(const TextureHelper11 &other)
+{
+ mData = other.mData;
+ mExtents = other.mExtents;
+ mFormatSet = other.mFormatSet;
+ mSampleCount = other.mSampleCount;
+ return *this;
+}
+
+bool TextureHelper11::operator==(const TextureHelper11 &other) const
+{
+ return mData->object == other.mData->object;
+}
+
+bool TextureHelper11::operator!=(const TextureHelper11 &other) const
+{
+ return mData->object != other.mData->object;
+}
+
+bool UsePresentPathFast(const Renderer11 *renderer,
+ const gl::FramebufferAttachment *framebufferAttachment)
+{
+ if (framebufferAttachment == nullptr)
+ {
+ return false;
+ }
+
+ return (framebufferAttachment->type() == GL_FRAMEBUFFER_DEFAULT &&
+ renderer->presentPathFastEnabled());
+}
+
+bool UsePrimitiveRestartWorkaround(bool primitiveRestartFixedIndexEnabled,
+ gl::DrawElementsType type)
+{
+ // We should never have to deal with primitive restart workaround issue with GL_UNSIGNED_INT
+ // indices, since we restrict it via MAX_ELEMENT_INDEX.
+ return (!primitiveRestartFixedIndexEnabled && type == gl::DrawElementsType::UnsignedShort);
+}
+
+IndexStorageType ClassifyIndexStorage(const gl::State &glState,
+ const gl::Buffer *elementArrayBuffer,
+ gl::DrawElementsType elementType,
+ gl::DrawElementsType destElementType,
+ unsigned int offset)
+{
+ // No buffer bound means we are streaming from a client pointer.
+ if (!elementArrayBuffer || !IsOffsetAligned(elementType, offset))
+ {
+ return IndexStorageType::Dynamic;
+ }
+
+ // The buffer can be used directly if the storage supports it and no translation needed.
+ BufferD3D *bufferD3D = GetImplAs<BufferD3D>(elementArrayBuffer);
+ if (bufferD3D->supportsDirectBinding() && destElementType == elementType)
+ {
+ return IndexStorageType::Direct;
+ }
+
+ // Use a static copy when available.
+ StaticIndexBufferInterface *staticBuffer = bufferD3D->getStaticIndexBuffer();
+ if (staticBuffer != nullptr)
+ {
+ return IndexStorageType::Static;
+ }
+
+ // Static buffer not available, fall back to streaming.
+ return IndexStorageType::Dynamic;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h
new file mode 100644
index 0000000000..2cdd6aae17
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h
@@ -0,0 +1,455 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// renderer11_utils.h: Conversion functions and other utility routines
+// specific to the D3D11 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_UTILS_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_UTILS_H_
+
+#include <array>
+#include <functional>
+#include <vector>
+
+#include "common/Color.h"
+
+#include "libANGLE/Caps.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+namespace gl
+{
+class FramebufferAttachment;
+}
+
+namespace rx
+{
+class Context11;
+class Renderer11;
+class RenderTarget11;
+struct Renderer11DeviceCaps;
+
+using RTVArray = std::array<ID3D11RenderTargetView *, gl::IMPLEMENTATION_MAX_DRAW_BUFFERS>;
+
+namespace gl_d3d11
+{
+
+D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha);
+D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp);
+UINT8 ConvertColorMask(bool maskRed, bool maskGreen, bool maskBlue, bool maskAlpha);
+
+D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, gl::CullFaceMode cullMode);
+
+D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison);
+D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled);
+UINT8 ConvertStencilMask(GLuint stencilmask);
+D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
+
+D3D11_FILTER ConvertFilter(GLenum minFilter,
+ GLenum magFilter,
+ float maxAnisotropy,
+ GLenum comparisonMode);
+D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
+UINT ConvertMaxAnisotropy(float maxAnisotropy, D3D_FEATURE_LEVEL featureLevel);
+
+D3D11_QUERY ConvertQueryType(gl::QueryType type);
+
+UINT8 GetColorMask(const gl::InternalFormat &formatInfo);
+
+} // namespace gl_d3d11
+
+namespace d3d11_gl
+{
+
+unsigned int GetReservedVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel);
+
+unsigned int GetReservedFragmentUniformVectors(D3D_FEATURE_LEVEL featureLevel);
+
+gl::Version GetMaximumClientVersion(const Renderer11DeviceCaps &caps);
+void GenerateCaps(ID3D11Device *device,
+ ID3D11DeviceContext *deviceContext,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ const angle::FeaturesD3D &features,
+ gl::Caps *caps,
+ gl::TextureCapsMap *textureCapsMap,
+ gl::Extensions *extensions,
+ gl::Limitations *limitations);
+
+void GetSamplePosition(GLsizei sampleCount, size_t index, GLfloat *xy);
+
+D3D_FEATURE_LEVEL GetMinimumFeatureLevelForES31();
+
+} // namespace d3d11_gl
+
+namespace d3d11
+{
+
+enum ANGLED3D11DeviceType
+{
+ ANGLE_D3D11_DEVICE_TYPE_UNKNOWN,
+ ANGLE_D3D11_DEVICE_TYPE_HARDWARE,
+ ANGLE_D3D11_DEVICE_TYPE_SOFTWARE_REF_OR_NULL,
+ ANGLE_D3D11_DEVICE_TYPE_WARP,
+};
+
+ANGLED3D11DeviceType GetDeviceType(ID3D11Device *device);
+
+void MakeValidSize(bool isImage,
+ DXGI_FORMAT format,
+ GLsizei *requestWidth,
+ GLsizei *requestHeight,
+ int *levelOffset);
+
+angle::Result GenerateInitialTextureData(
+ const gl::Context *context,
+ GLint internalFormat,
+ const Renderer11DeviceCaps &renderer11DeviceCaps,
+ GLuint width,
+ GLuint height,
+ GLuint depth,
+ GLuint mipLevels,
+ gl::TexLevelArray<D3D11_SUBRESOURCE_DATA> *outSubresourceData);
+
+UINT GetPrimitiveRestartIndex();
+
+struct PositionTexCoordVertex
+{
+ float x, y;
+ float u, v;
+};
+void SetPositionTexCoordVertex(PositionTexCoordVertex *vertex, float x, float y, float u, float v);
+
+struct PositionLayerTexCoord3DVertex
+{
+ float x, y;
+ unsigned int l;
+ float u, v, s;
+};
+void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex *vertex,
+ float x,
+ float y,
+ unsigned int layer,
+ float u,
+ float v,
+ float s);
+
+struct PositionVertex
+{
+ float x, y, z, w;
+};
+
+struct BlendStateKey final
+{
+ // This will zero-initialize the struct, including padding.
+ BlendStateKey();
+
+ gl::BlendState blendState;
+
+ // An int so struct size rounds nicely.
+ uint32_t rtvMax;
+
+ uint8_t rtvMasks[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
+};
+
+bool operator==(const BlendStateKey &a, const BlendStateKey &b);
+bool operator!=(const BlendStateKey &a, const BlendStateKey &b);
+
+struct RasterizerStateKey final
+{
+ // This will zero-initialize the struct, including padding.
+ RasterizerStateKey();
+
+ gl::RasterizerState rasterizerState;
+
+ // Use a 32-bit int to round the struct nicely.
+ uint32_t scissorEnabled;
+};
+
+bool operator==(const RasterizerStateKey &a, const RasterizerStateKey &b);
+bool operator!=(const RasterizerStateKey &a, const RasterizerStateKey &b);
+
+template <typename outType>
+outType *DynamicCastComObject(IUnknown *object)
+{
+ outType *outObject = nullptr;
+ HRESULT result =
+ object->QueryInterface(__uuidof(outType), reinterpret_cast<void **>(&outObject));
+ if (SUCCEEDED(result))
+ {
+ return outObject;
+ }
+ else
+ {
+ SafeRelease(outObject);
+ return nullptr;
+ }
+}
+
+inline bool isDeviceLostError(HRESULT errorCode)
+{
+ switch (errorCode)
+ {
+ case DXGI_ERROR_DEVICE_HUNG:
+ case DXGI_ERROR_DEVICE_REMOVED:
+ case DXGI_ERROR_DEVICE_RESET:
+ case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
+ case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+template <ResourceType ResourceT>
+class LazyResource : angle::NonCopyable
+{
+ public:
+ constexpr LazyResource() : mResource() {}
+ virtual ~LazyResource() {}
+
+ virtual angle::Result resolve(d3d::Context *context, Renderer11 *renderer) = 0;
+ void reset() { mResource.reset(); }
+ GetD3D11Type<ResourceT> *get() const
+ {
+ ASSERT(mResource.valid());
+ return mResource.get();
+ }
+
+ const Resource11<GetD3D11Type<ResourceT>> &getObj() const { return mResource; }
+
+ protected:
+ LazyResource(LazyResource &&other) : mResource(std::move(other.mResource)) {}
+
+ // Specialized in the cpp file to avoid MSVS/Clang specific code.
+ angle::Result resolveImpl(d3d::Context *context,
+ Renderer11 *renderer,
+ const GetDescType<ResourceT> &desc,
+ GetInitDataType<ResourceT> *initData,
+ const char *name);
+
+ Resource11<GetD3D11Type<ResourceT>> mResource;
+};
+
+template <typename D3D11ShaderType>
+class LazyShader final : public LazyResource<GetResourceTypeFromD3D11<D3D11ShaderType>()>
+{
+ public:
+ // All parameters must be constexpr. Not supported in VS2013.
+ constexpr LazyShader(const BYTE *byteCode, size_t byteCodeSize, const char *name)
+ : mByteCode(byteCode, byteCodeSize), mName(name)
+ {}
+
+ constexpr LazyShader(LazyShader &&shader)
+ : LazyResource<GetResourceTypeFromD3D11<D3D11ShaderType>()>(std::move(shader)),
+ mByteCode(std::move(shader.mByteCode)),
+ mName(shader.mName)
+ {}
+
+ angle::Result resolve(d3d::Context *context, Renderer11 *renderer) override
+ {
+ return this->resolveImpl(context, renderer, mByteCode, nullptr, mName);
+ }
+
+ private:
+ ShaderData mByteCode;
+ const char *mName;
+};
+
+class LazyInputLayout final : public LazyResource<ResourceType::InputLayout>
+{
+ public:
+ LazyInputLayout(const D3D11_INPUT_ELEMENT_DESC *inputDesc,
+ size_t inputDescLen,
+ const BYTE *byteCode,
+ size_t byteCodeLen,
+ const char *debugName);
+ ~LazyInputLayout() override;
+
+ angle::Result resolve(d3d::Context *context, Renderer11 *renderer) override;
+
+ private:
+ InputElementArray mInputDesc;
+ ShaderData mByteCode;
+ const char *mDebugName;
+};
+
+class LazyBlendState final : public LazyResource<ResourceType::BlendState>
+{
+ public:
+ LazyBlendState(const D3D11_BLEND_DESC &desc, const char *debugName);
+
+ angle::Result resolve(d3d::Context *context, Renderer11 *renderer) override;
+
+ private:
+ D3D11_BLEND_DESC mDesc;
+ const char *mDebugName;
+};
+
+// Copy data to small D3D11 buffers, such as for small constant buffers, which use one struct to
+// represent an entire buffer.
+template <class T>
+void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBuffer, const T &value)
+{
+ D3D11_MAPPED_SUBRESOURCE mappedResource = {};
+ HRESULT result = context->Map(constantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ ASSERT(SUCCEEDED(result));
+ if (SUCCEEDED(result))
+ {
+ memcpy(mappedResource.pData, &value, sizeof(T));
+ context->Unmap(constantBuffer, 0);
+ }
+}
+
+void InitializeFeatures(const Renderer11DeviceCaps &deviceCaps,
+ const DXGI_ADAPTER_DESC &adapterDesc,
+ angle::FeaturesD3D *features);
+
+enum ReservedConstantBufferSlot
+{
+ RESERVED_CONSTANT_BUFFER_SLOT_DEFAULT_UNIFORM_BLOCK = 0,
+ RESERVED_CONSTANT_BUFFER_SLOT_DRIVER = 1,
+
+ RESERVED_CONSTANT_BUFFER_SLOT_COUNT = 2
+};
+
+void InitConstantBufferDesc(D3D11_BUFFER_DESC *constantBufferDescription, size_t byteWidth);
+
+// Helper class for RAII patterning.
+template <typename T>
+class ScopedUnmapper final : angle::NonCopyable
+{
+ public:
+ ScopedUnmapper(T *object) : mObject(object) {}
+ ~ScopedUnmapper() { mObject->unmap(); }
+
+ private:
+ T *mObject;
+};
+} // namespace d3d11
+
+struct GenericData
+{
+ GenericData() {}
+ ~GenericData()
+ {
+ if (object)
+ {
+ // We can have a nullptr factory when holding passed-in resources.
+ if (manager)
+ {
+ manager->onReleaseGeneric(resourceType, object);
+ manager = nullptr;
+ }
+ object->Release();
+ object = nullptr;
+ }
+ }
+
+ ResourceType resourceType = ResourceType::Last;
+ ID3D11Resource *object = nullptr;
+ ResourceManager11 *manager = nullptr;
+};
+
+// A helper class which wraps a 2D or 3D texture.
+class TextureHelper11 : public Resource11Base<ID3D11Resource, std::shared_ptr, GenericData>
+{
+ public:
+ TextureHelper11();
+ TextureHelper11(TextureHelper11 &&other);
+ TextureHelper11(const TextureHelper11 &other);
+ ~TextureHelper11() override;
+ TextureHelper11 &operator=(TextureHelper11 &&other);
+ TextureHelper11 &operator=(const TextureHelper11 &other);
+
+ bool is2D() const { return mData->resourceType == ResourceType::Texture2D; }
+ bool is3D() const { return mData->resourceType == ResourceType::Texture3D; }
+ ResourceType getTextureType() const { return mData->resourceType; }
+ gl::Extents getExtents() const { return mExtents; }
+ DXGI_FORMAT getFormat() const { return mFormatSet->texFormat; }
+ const d3d11::Format &getFormatSet() const { return *mFormatSet; }
+ int getSampleCount() const { return mSampleCount; }
+
+ template <typename DescT, typename ResourceT>
+ void init(Resource11<ResourceT> &&texture, const DescT &desc, const d3d11::Format &format)
+ {
+ std::swap(mData->manager, texture.mData->manager);
+
+ // Can't use std::swap because texture is typed, and here we use ID3D11Resource.
+ ID3D11Resource *temp = mData->object;
+ mData->object = texture.mData->object;
+ texture.mData->object = static_cast<ResourceT *>(temp);
+
+ mFormatSet = &format;
+ initDesc(desc);
+ }
+
+ template <typename ResourceT>
+ void set(ResourceT *object, const d3d11::Format &format)
+ {
+ ASSERT(!valid());
+
+ mFormatSet = &format;
+ mData->object = object;
+ mData->manager = nullptr;
+
+ GetDescFromD3D11<ResourceT> desc;
+ getDesc(&desc);
+ initDesc(desc);
+ }
+
+ bool operator==(const TextureHelper11 &other) const;
+ bool operator!=(const TextureHelper11 &other) const;
+
+ void getDesc(D3D11_TEXTURE2D_DESC *desc) const;
+ void getDesc(D3D11_TEXTURE3D_DESC *desc) const;
+
+ private:
+ void initDesc(const D3D11_TEXTURE2D_DESC &desc2D);
+ void initDesc(const D3D11_TEXTURE3D_DESC &desc3D);
+
+ const d3d11::Format *mFormatSet;
+ gl::Extents mExtents;
+ int mSampleCount;
+};
+
+enum class StagingAccess
+{
+ READ,
+ READ_WRITE,
+};
+
+bool UsePresentPathFast(const Renderer11 *renderer, const gl::FramebufferAttachment *colorbuffer);
+bool UsePrimitiveRestartWorkaround(bool primitiveRestartFixedIndexEnabled,
+ gl::DrawElementsType type);
+
+enum class IndexStorageType
+{
+ // Dynamic indexes are re-streamed every frame. They come from a client data pointer or
+ // from buffers that are updated frequently.
+ Dynamic,
+
+ // Static indexes are translated from the original storage once, and re-used multiple times.
+ Static,
+
+ // Direct indexes are never transated and are used directly from the source buffer. They are
+ // the fastest available path.
+ Direct,
+
+ // Not a real storage type.
+ Invalid,
+};
+
+IndexStorageType ClassifyIndexStorage(const gl::State &glState,
+ const gl::Buffer *elementArrayBuffer,
+ gl::DrawElementsType elementType,
+ gl::DrawElementsType destElementType,
+ unsigned int offset);
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_UTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h
new file mode 100644
index 0000000000..c0635223b4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h
@@ -0,0 +1,85 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E GS_BufferToTexture /T gs_4_0 /Fh
+// compiled/buffertotexture11_gs.h BufferToTexture11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+// LAYER 0 y 1 NONE uint y
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+// SV_RenderTargetArrayIndex 0 y 1 RTINDEX uint y
+//
+gs_4_0
+dcl_input_siv v[1][0].xyzw, position
+dcl_input v[1][1].x
+dcl_input v[1][1].y
+dcl_inputprimitive point
+dcl_outputtopology pointlist
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output_siv o1.y, rendertarget_array_index
+dcl_maxout 1
+mov o0.xyzw, v[0][0].xyzw
+mov o1.x, v[0][1].x
+mov o1.y, v[0][1].y
+emit
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_GS_BufferToTexture[] = {
+ 68, 88, 66, 67, 253, 178, 132, 190, 125, 118, 185, 34, 196, 114, 214, 207, 219, 137, 140,
+ 138, 1, 0, 0, 0, 212, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 0,
+ 0, 0, 0, 1, 0, 0, 136, 1, 0, 0, 88, 2, 0, 0, 82, 68, 69, 70, 80,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 83, 71, 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111,
+ 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51,
+ 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 108, 0, 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 15, 15, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 101, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 2, 0, 0,
+ 83, 86, 95, 80, 111, 115, 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 76, 65, 89, 69, 82, 0, 171, 79, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0, 101, 0, 0,
+ 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 13,
+ 0, 0, 83, 86, 95, 80, 111, 115, 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79,
+ 79, 82, 68, 0, 83, 86, 95, 82, 101, 110, 100, 101, 114, 84, 97, 114, 103, 101, 116,
+ 65, 114, 114, 97, 121, 73, 110, 100, 101, 120, 0, 171, 83, 72, 68, 82, 200, 0, 0,
+ 0, 64, 0, 2, 0, 50, 0, 0, 0, 97, 0, 0, 5, 242, 16, 32, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 95, 0, 0, 4, 18, 16, 32, 0, 1,
+ 0, 0, 0, 1, 0, 0, 0, 95, 0, 0, 4, 34, 16, 32, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 93, 8, 0, 1, 92, 8, 0, 1, 103, 0, 0, 4, 242, 32, 16,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 101, 0, 0, 3, 18, 32, 16, 0, 1, 0,
+ 0, 0, 103, 0, 0, 4, 34, 32, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 94,
+ 0, 0, 2, 1, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0,
+ 70, 30, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 32, 16,
+ 0, 1, 0, 0, 0, 10, 16, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 54, 0,
+ 0, 6, 34, 32, 16, 0, 1, 0, 0, 0, 26, 16, 32, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 19, 0, 0, 1, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h
new file mode 100644
index 0000000000..5b98b6782a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h
@@ -0,0 +1,115 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_BufferToTexture_4F /T ps_4_0 /Fh
+// compiled/buffertotexture11_ps_4f.h BufferToTexture11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer BufferCopyParams
+// {
+//
+// uint FirstPixelOffset; // Offset: 0 Size: 4 [unused]
+// uint PixelsPerRow; // Offset: 4 Size: 4 [unused]
+// uint RowStride; // Offset: 8 Size: 4 [unused]
+// uint RowsPerSlice; // Offset: 12 Size: 4 [unused]
+// float2 PositionOffset; // Offset: 16 Size: 8 [unused]
+// float2 PositionScale; // Offset: 24 Size: 8 [unused]
+// int2 TexLocationOffset; // Offset: 32 Size: 8 [unused]
+// int2 TexLocationScale; // Offset: 40 Size: 8 [unused]
+// uint FirstSlice; // Offset: 48 Size: 4 [unused]
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4F texture float4 buf 0 1
+// BufferCopyParams cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 x 1 NONE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Target 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_buffer (float,float,float,float) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4F[] = {
+ 68, 88, 66, 67, 143, 104, 46, 161, 50, 189, 182, 102, 245, 177, 159, 82, 43, 210, 80,
+ 71, 1, 0, 0, 0, 252, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 2,
+ 0, 0, 228, 2, 0, 0, 24, 3, 0, 0, 128, 3, 0, 0, 82, 68, 69, 70, 80,
+ 2, 0, 0, 1, 0, 0, 0, 120, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 28, 2, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 5, 0, 0, 0, 1, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 66, 117, 102, 102, 101, 114, 52, 70, 0, 66, 117, 102, 102, 101, 114, 67, 111, 112, 121,
+ 80, 97, 114, 97, 109, 115, 0, 171, 171, 101, 0, 0, 0, 9, 0, 0, 0, 144, 0,
+ 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 1, 0, 0, 0,
+ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 124, 1, 0, 0, 0, 0, 0, 0,
+ 140, 1, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 124, 1, 0,
+ 0, 0, 0, 0, 0, 153, 1, 0, 0, 8, 0, 0, 0, 4, 0, 0, 0, 0, 0,
+ 0, 0, 124, 1, 0, 0, 0, 0, 0, 0, 163, 1, 0, 0, 12, 0, 0, 0, 4,
+ 0, 0, 0, 0, 0, 0, 0, 124, 1, 0, 0, 0, 0, 0, 0, 176, 1, 0, 0,
+ 16, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 192, 1, 0, 0, 0, 0, 0,
+ 0, 208, 1, 0, 0, 24, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 192, 1,
+ 0, 0, 0, 0, 0, 0, 222, 1, 0, 0, 32, 0, 0, 0, 8, 0, 0, 0, 0,
+ 0, 0, 0, 240, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 40, 0, 0, 0,
+ 8, 0, 0, 0, 0, 0, 0, 0, 240, 1, 0, 0, 0, 0, 0, 0, 17, 2, 0,
+ 0, 48, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 124, 1, 0, 0, 0, 0,
+ 0, 0, 70, 105, 114, 115, 116, 80, 105, 120, 101, 108, 79, 102, 102, 115, 101, 116, 0,
+ 171, 171, 171, 0, 0, 19, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 80, 105, 120, 101, 108, 115, 80, 101, 114, 82, 111, 119, 0, 82, 111, 119, 83, 116, 114,
+ 105, 100, 101, 0, 82, 111, 119, 115, 80, 101, 114, 83, 108, 105, 99, 101, 0, 80, 111,
+ 115, 105, 116, 105, 111, 110, 79, 102, 102, 115, 101, 116, 0, 171, 1, 0, 3, 0, 1,
+ 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 111, 115, 105, 116, 105, 111, 110,
+ 83, 99, 97, 108, 101, 0, 84, 101, 120, 76, 111, 99, 97, 116, 105, 111, 110, 79, 102,
+ 102, 115, 101, 116, 0, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 84, 101, 120, 76, 111, 99, 97, 116, 105, 111, 110, 83, 99, 97, 108, 101, 0,
+ 70, 105, 114, 115, 116, 83, 108, 105, 99, 101, 0, 77, 105, 99, 114, 111, 115, 111, 102,
+ 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67,
+ 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49,
+ 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8,
+ 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 83, 86, 95, 80, 111, 115,
+ 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 97, 114, 103, 101, 116, 0, 171, 171, 83, 72, 68, 82, 96, 0,
+ 0, 0, 64, 0, 0, 0, 24, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 88, 8, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 98, 8, 0, 3, 18, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0,
+ 3, 242, 32, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 32, 16, 0, 0, 0,
+ 0, 0, 6, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h
new file mode 100644
index 0000000000..b3692c9fb1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h
@@ -0,0 +1,69 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_BufferToTexture_4I /T ps_4_0 /Fh
+// compiled/buffertotexture11_ps_4i.h BufferToTexture11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4I texture sint4 buf 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 x 1 NONE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Target 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_buffer (sint,sint,sint,sint) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4I[] = {
+ 68, 88, 66, 67, 104, 142, 165, 212, 7, 64, 44, 53, 68, 117, 135, 216, 87, 167, 148,
+ 192, 1, 0, 0, 0, 20, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 152, 1, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 1, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 66, 117, 102, 102, 101, 114, 52, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 83, 86, 95,
+ 80, 111, 115, 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 97, 114, 103, 101, 116, 0, 171, 171, 83, 72, 68,
+ 82, 80, 0, 0, 0, 64, 0, 0, 0, 20, 0, 0, 0, 88, 8, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 51, 51, 0, 0, 98, 8, 0, 3, 18, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7,
+ 242, 32, 16, 0, 0, 0, 0, 0, 6, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h
new file mode 100644
index 0000000000..9eb63555fd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h
@@ -0,0 +1,69 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_BufferToTexture_4UI /T ps_4_0 /Fh
+// compiled/buffertotexture11_ps_4ui.h BufferToTexture11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4UI texture uint4 buf 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 x 1 NONE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Target 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_buffer (uint,uint,uint,uint) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4UI[] = {
+ 68, 88, 66, 67, 150, 54, 239, 129, 105, 57, 103, 28, 8, 175, 168, 118, 153, 92, 233,
+ 98, 1, 0, 0, 0, 20, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 152, 1, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 1, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 66, 117, 102, 102, 101, 114, 52, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 83, 86, 95,
+ 80, 111, 115, 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 97, 114, 103, 101, 116, 0, 171, 171, 83, 72, 68,
+ 82, 80, 0, 0, 0, 64, 0, 0, 0, 20, 0, 0, 0, 88, 8, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 68, 68, 0, 0, 98, 8, 0, 3, 18, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 45, 0, 0, 7,
+ 242, 32, 16, 0, 0, 0, 0, 0, 6, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h
new file mode 100644
index 0000000000..41f1c03f6c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h
@@ -0,0 +1,150 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E VS_BufferToTexture /T vs_4_0 /Fh
+// compiled/buffertotexture11_vs.h BufferToTexture11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer BufferCopyParams
+// {
+//
+// uint FirstPixelOffset; // Offset: 0 Size: 4
+// uint PixelsPerRow; // Offset: 4 Size: 4
+// uint RowStride; // Offset: 8 Size: 4
+// uint RowsPerSlice; // Offset: 12 Size: 4
+// float2 PositionOffset; // Offset: 16 Size: 8
+// float2 PositionScale; // Offset: 24 Size: 8
+// int2 TexLocationOffset; // Offset: 32 Size: 8 [unused]
+// int2 TexLocationScale; // Offset: 40 Size: 8 [unused]
+// uint FirstSlice; // Offset: 48 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// BufferCopyParams cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_VertexID 0 x 0 VERTID uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+// LAYER 0 y 1 NONE uint y
+//
+vs_4_0
+dcl_constantbuffer cb0[4], immediateIndexed
+dcl_input_sgv v0.x, vertex_id
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output o1.y
+dcl_temps 2
+mov o0.zw, l(0,0,0,1.000000)
+imul null, r0.xy, cb0[0].yzyy, cb0[0].wwww
+udiv r0.z, null, v0.x, r0.x
+imad r0.x, -r0.z, r0.x, v0.x
+imad r0.y, r0.z, r0.y, cb0[0].x
+iadd o1.y, cb0[3].x, r0.z
+udiv r0.z, null, r0.x, cb0[0].y
+imad r0.x, -r0.z, cb0[0].y, r0.x
+utof r1.xy, r0.xzxx
+imad r0.y, r0.z, cb0[0].z, r0.y
+iadd o1.x, r0.y, r0.x
+mad o0.xy, cb0[1].zwzz, r1.xyxx, cb0[1].xyxx
+ret
+// Approximately 13 instruction slots used
+#endif
+
+const BYTE g_VS_BufferToTexture[] = {
+ 68, 88, 66, 67, 118, 65, 244, 232, 116, 137, 175, 126, 82, 230, 140, 17, 178, 249, 223,
+ 31, 1, 0, 0, 0, 152, 5, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 100, 2,
+ 0, 0, 152, 2, 0, 0, 12, 3, 0, 0, 28, 5, 0, 0, 82, 68, 69, 70, 40,
+ 2, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 254, 255, 0, 1, 0, 0, 244, 1, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 66, 117, 102, 102, 101, 114, 67, 111, 112, 121, 80, 97, 114,
+ 97, 109, 115, 0, 171, 171, 171, 60, 0, 0, 0, 9, 0, 0, 0, 104, 0, 0, 0,
+ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 1, 0, 0, 0, 0, 0,
+ 0, 4, 0, 0, 0, 2, 0, 0, 0, 84, 1, 0, 0, 0, 0, 0, 0, 100, 1,
+ 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 84, 1, 0, 0, 0,
+ 0, 0, 0, 113, 1, 0, 0, 8, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0,
+ 84, 1, 0, 0, 0, 0, 0, 0, 123, 1, 0, 0, 12, 0, 0, 0, 4, 0, 0,
+ 0, 2, 0, 0, 0, 84, 1, 0, 0, 0, 0, 0, 0, 136, 1, 0, 0, 16, 0,
+ 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 152, 1, 0, 0, 0, 0, 0, 0, 168,
+ 1, 0, 0, 24, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 152, 1, 0, 0,
+ 0, 0, 0, 0, 182, 1, 0, 0, 32, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
+ 0, 200, 1, 0, 0, 0, 0, 0, 0, 216, 1, 0, 0, 40, 0, 0, 0, 8, 0,
+ 0, 0, 0, 0, 0, 0, 200, 1, 0, 0, 0, 0, 0, 0, 233, 1, 0, 0, 48,
+ 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 84, 1, 0, 0, 0, 0, 0, 0,
+ 70, 105, 114, 115, 116, 80, 105, 120, 101, 108, 79, 102, 102, 115, 101, 116, 0, 171, 171,
+ 171, 0, 0, 19, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 105,
+ 120, 101, 108, 115, 80, 101, 114, 82, 111, 119, 0, 82, 111, 119, 83, 116, 114, 105, 100,
+ 101, 0, 82, 111, 119, 115, 80, 101, 114, 83, 108, 105, 99, 101, 0, 80, 111, 115, 105,
+ 116, 105, 111, 110, 79, 102, 102, 115, 101, 116, 0, 171, 1, 0, 3, 0, 1, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 111, 115, 105, 116, 105, 111, 110, 83, 99,
+ 97, 108, 101, 0, 84, 101, 120, 76, 111, 99, 97, 116, 105, 111, 110, 79, 102, 102, 115,
+ 101, 116, 0, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 84, 101, 120, 76, 111, 99, 97, 116, 105, 111, 110, 83, 99, 97, 108, 101, 0, 70, 105,
+ 114, 115, 116, 83, 108, 105, 99, 101, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32,
+ 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49,
+ 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0, 0, 83, 86, 95, 86, 101, 114, 116, 101, 120, 73, 68, 0, 79,
+ 83, 71, 78, 108, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 14, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 1, 0, 0, 0, 2, 13, 0, 0, 83, 86, 95, 80, 111, 115, 105, 116,
+ 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 76, 65, 89, 69, 82, 0,
+ 171, 83, 72, 68, 82, 8, 2, 0, 0, 64, 0, 1, 0, 130, 0, 0, 0, 89, 0,
+ 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, 96, 0, 0, 4, 18,
+ 16, 16, 0, 0, 0, 0, 0, 6, 0, 0, 0, 103, 0, 0, 4, 242, 32, 16, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 101, 0, 0, 3, 18, 32, 16, 0, 1, 0, 0,
+ 0, 101, 0, 0, 3, 34, 32, 16, 0, 1, 0, 0, 0, 104, 0, 0, 2, 2, 0,
+ 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 38, 0, 0, 10,
+ 0, 208, 0, 0, 50, 0, 16, 0, 0, 0, 0, 0, 150, 133, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 246, 143, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 0,
+ 0, 8, 66, 0, 16, 0, 0, 0, 0, 0, 0, 208, 0, 0, 10, 16, 16, 0, 0,
+ 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 35, 0, 0, 10, 18, 0, 16, 0,
+ 0, 0, 0, 0, 42, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 10, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 0, 0, 0, 0, 35, 0, 0, 10, 34, 0,
+ 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0,
+ 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 8,
+ 34, 32, 16, 0, 1, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 42, 0, 16, 0, 0, 0, 0, 0, 78, 0, 0, 9, 66, 0, 16, 0, 0, 0,
+ 0, 0, 0, 208, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 26, 128, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 11, 18, 0, 16, 0, 0, 0, 0, 0,
+ 42, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 1, 0, 0, 0, 134, 0, 16, 0, 0, 0, 0, 0, 35, 0, 0, 10, 34,
+ 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 42, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 30, 0, 0,
+ 7, 18, 32, 16, 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0, 50, 0, 0, 11, 50, 32, 16, 0, 0, 0, 0, 0, 230,
+ 138, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 70, 0, 16, 0, 1, 0, 0, 0,
+ 70, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11_fl9vs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11_fl9vs.h
new file mode 100644
index 0000000000..5f04bcbcdf
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11_fl9vs.h
@@ -0,0 +1,75 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E VS_Clear_FL9 /T vs_4_0_level_9_3 /Fh
+// compiled\clear11_fl9vs.h Clear11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION 0 xyzw 0 NONE float xyzw
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+//
+//
+// Runtime generated constant mappings:
+//
+// Target Reg Constant Description
+// ---------- --------------------------------------------------
+// c0 Vertex Shader position offset
+//
+//
+// Level9 shader bytecode:
+//
+ vs_2_x
+ dcl_texcoord v0
+ mad oPos.xy, v0.w, c0, v0
+ mov oPos.zw, v0
+
+// approximately 2 instruction slots used
+vs_4_0
+dcl_input v0.xyzw
+dcl_output_siv o0.xyzw, position
+mov o0.xyzw, v0.xyzw
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_VS_Clear_FL9[] = {
+ 68, 88, 66, 67, 70, 225, 22, 82, 198, 171, 210, 104, 82, 233, 227, 173, 206, 48, 250, 109,
+ 1, 0, 0, 0, 28, 2, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 156, 0, 0, 0,
+ 224, 0, 0, 0, 92, 1, 0, 0, 180, 1, 0, 0, 232, 1, 0, 0, 65, 111, 110, 57,
+ 92, 0, 0, 0, 92, 0, 0, 0, 0, 2, 254, 255, 52, 0, 0, 0, 40, 0, 0, 0,
+ 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 1, 0, 36, 0,
+ 0, 0, 0, 0, 1, 2, 254, 255, 31, 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144,
+ 4, 0, 0, 4, 0, 0, 3, 192, 0, 0, 255, 144, 0, 0, 228, 160, 0, 0, 228, 144,
+ 1, 0, 0, 2, 0, 0, 12, 192, 0, 0, 228, 144, 255, 255, 0, 0, 83, 72, 68, 82,
+ 60, 0, 0, 0, 64, 0, 1, 0, 15, 0, 0, 0, 95, 0, 0, 3, 242, 16, 16, 0,
+ 0, 0, 0, 0, 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 70, 30, 16, 0, 0, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 82, 68, 69, 70, 80, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 4, 254, 255, 0, 1, 0, 0,
+ 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57,
+ 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 0, 0, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewgs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewgs.h
new file mode 100644
index 0000000000..4e581a24b4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewgs.h
@@ -0,0 +1,88 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E GS_Multiview_Clear /T gs_4_0 /Fh
+// compiled\clear11multiviewgs.h Clear11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// SV_RenderTargetArrayIndex 0 x 1 RTINDEX uint x
+//
+gs_4_0
+dcl_input_siv v[3][0].xyzw, position
+dcl_input v[3][1].x
+dcl_temps 1
+dcl_inputprimitive triangle
+dcl_outputtopology trianglestrip
+dcl_output_siv o0.xyzw, position
+dcl_output_siv o1.x, rendertarget_array_index
+dcl_maxout 3
+mov r0.x, l(0)
+loop
+ ige r0.y, r0.x, l(3)
+ breakc_nz r0.y
+ mov o0.xyzw, v[r0.x + 0][0].xyzw
+ mov o1.x, v[r0.x + 0][1].x
+ emit
+ iadd r0.x, r0.x, l(1)
+endloop
+cut
+ret
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_GS_Multiview_Clear[] = {
+ 68, 88, 66, 67, 97, 213, 116, 205, 170, 60, 132, 93, 138, 100, 91, 17, 237, 138, 8,
+ 224, 1, 0, 0, 0, 216, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 0,
+ 0, 0, 228, 0, 0, 0, 76, 1, 0, 0, 92, 2, 0, 0, 82, 68, 69, 70, 80,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 83, 71, 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111,
+ 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51,
+ 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 15, 15, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 83, 86, 95, 80, 111,
+ 115, 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171,
+ 79, 83, 71, 78, 96, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 14, 0, 0, 83, 86, 95, 80, 111, 115, 105, 116, 105, 111, 110, 0,
+ 83, 86, 95, 82, 101, 110, 100, 101, 114, 84, 97, 114, 103, 101, 116, 65, 114, 114, 97,
+ 121, 73, 110, 100, 101, 120, 0, 171, 171, 83, 72, 68, 82, 8, 1, 0, 0, 64, 0,
+ 2, 0, 66, 0, 0, 0, 97, 0, 0, 5, 242, 16, 32, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 95, 0, 0, 4, 18, 16, 32, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 93, 24, 0, 1, 92, 40, 0,
+ 1, 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 103, 0,
+ 0, 4, 18, 32, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 94, 0, 0, 2, 3,
+ 0, 0, 0, 54, 0, 0, 5, 18, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 48, 0, 0, 1, 33, 0, 0, 7, 34, 0, 16, 0, 0, 0, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 3, 0, 0, 0, 3, 0,
+ 4, 3, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 7, 242, 32, 16, 0, 0,
+ 0, 0, 0, 70, 30, 160, 0, 10, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32, 16, 0, 1, 0, 0, 0, 10, 16, 160, 0, 10, 0, 16,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 19, 0, 0, 1, 30, 0, 0, 7, 18, 0,
+ 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1,
+ 0, 0, 0, 22, 0, 0, 1, 9, 0, 0, 1, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 11, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 5, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewvs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewvs.h
new file mode 100644
index 0000000000..aa3073ba56
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11multiviewvs.h
@@ -0,0 +1,85 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E VS_Multiview_Clear /T vs_4_0 /Fh
+// compiled\clear11multiviewvs.h Clear11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_VertexID 0 x 0 VERTID uint x
+// SV_InstanceID 0 x 1 INSTID uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 x 1 NONE uint x
+//
+vs_4_0
+dcl_immediateConstantBuffer { { -1.000000, 1.000000, 0, 0},
+ { 1.000000, -1.000000, 0, 0},
+ { -1.000000, -1.000000, 0, 0},
+ { -1.000000, 1.000000, 0, 0},
+ { 1.000000, 1.000000, 0, 0},
+ { 1.000000, -1.000000, 0, 0} }
+dcl_input_sgv v0.x, vertex_id
+dcl_input_sgv v1.x, instance_id
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_temps 1
+mov r0.x, v0.x
+mov o0.xy, icb[r0.x + 0].xyxx
+mov o0.zw, l(0,0,0,1.000000)
+mov o1.x, v1.x
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_VS_Multiview_Clear[] = {
+ 68, 88, 66, 67, 14, 99, 210, 81, 182, 39, 8, 134, 74, 169, 88, 103, 114, 197, 56,
+ 220, 1, 0, 0, 0, 220, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 0,
+ 0, 0, 232, 0, 0, 0, 64, 1, 0, 0, 96, 2, 0, 0, 82, 68, 69, 70, 80,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 254, 255, 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111,
+ 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51,
+ 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 84, 0, 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 8, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 83, 86, 95, 86, 101,
+ 114, 116, 101, 120, 73, 68, 0, 83, 86, 95, 73, 110, 115, 116, 97, 110, 99, 101, 73,
+ 68, 0, 171, 171, 79, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0,
+ 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 83, 72, 68,
+ 82, 24, 1, 0, 0, 64, 0, 1, 0, 70, 0, 0, 0, 53, 24, 0, 0, 26, 0,
+ 0, 0, 0, 0, 128, 191, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 128, 63, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191,
+ 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, 128,
+ 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 191, 0, 0, 0, 0, 0,
+ 0, 0, 0, 96, 0, 0, 4, 18, 16, 16, 0, 0, 0, 0, 0, 6, 0, 0, 0,
+ 96, 0, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 8, 0, 0, 0, 103, 0, 0,
+ 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 101, 0, 0, 3, 18, 32,
+ 16, 0, 1, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 54, 0, 0, 5, 18,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 50, 32, 16, 0, 0, 0, 0, 0, 70, 144, 144, 0, 10, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 54, 0, 0, 5, 18,
+ 32, 16, 0, 1, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11vs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11vs.h
new file mode 100644
index 0000000000..de5f1d3ed6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clear11vs.h
@@ -0,0 +1,72 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E VS_Clear /T vs_4_0 /Fh compiled\clear11vs.h Clear11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_VertexID 0 x 0 VERTID uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+//
+vs_4_0
+dcl_immediateConstantBuffer { { -1.000000, 1.000000, 0, 0},
+ { 1.000000, -1.000000, 0, 0},
+ { -1.000000, -1.000000, 0, 0},
+ { -1.000000, 1.000000, 0, 0},
+ { 1.000000, 1.000000, 0, 0},
+ { 1.000000, -1.000000, 0, 0} }
+dcl_input_sgv v0.x, vertex_id
+dcl_output_siv o0.xyzw, position
+dcl_temps 1
+mov r0.x, v0.x
+mov o0.xy, icb[r0.x + 0].xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_Clear[] = {
+ 68, 88, 66, 67, 103, 28, 87, 215, 135, 83, 130, 82, 213, 30, 12, 24, 41, 41, 187,
+ 87, 1, 0, 0, 0, 96, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 0,
+ 0, 0, 192, 0, 0, 0, 244, 0, 0, 0, 228, 1, 0, 0, 82, 68, 69, 70, 80,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 254, 255, 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111,
+ 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51,
+ 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 83, 86, 95, 86, 101, 114, 116, 101, 120, 73,
+ 68, 0, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 72, 68,
+ 82, 232, 0, 0, 0, 64, 0, 1, 0, 58, 0, 0, 0, 53, 24, 0, 0, 26, 0,
+ 0, 0, 0, 0, 128, 191, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 128, 63, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191,
+ 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, 128,
+ 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 191, 0, 0, 0, 0, 0,
+ 0, 0, 0, 96, 0, 0, 4, 18, 16, 16, 0, 0, 0, 0, 0, 6, 0, 0, 0,
+ 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 104, 0, 0,
+ 2, 1, 0, 0, 0, 54, 0, 0, 5, 18, 0, 16, 0, 0, 0, 0, 0, 10, 16,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 50, 32, 16, 0, 0, 0, 0, 0, 70,
+ 144, 144, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0,
+ 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0,
+ 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/cleardepth11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/cleardepth11ps.h
new file mode 100644
index 0000000000..059a8445ae
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/cleardepth11ps.h
@@ -0,0 +1,79 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearDepth /T ps_4_0 /Fh compiled\cleardepth11ps.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer DepthOnlyData
+// {
+//
+// float zValue_Depth; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// DepthOnlyData cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output oDepth
+mov oDepth, cb0[1].x
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_ClearDepth[] = {
+ 68, 88, 66, 67, 120, 231, 15, 116, 114, 21, 246, 235, 236, 14, 234, 123, 214, 247, 16,
+ 187, 1, 0, 0, 0, 48, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 12, 1,
+ 0, 0, 64, 1, 0, 0, 116, 1, 0, 0, 180, 1, 0, 0, 82, 68, 69, 70, 208,
+ 0, 0, 0, 1, 0, 0, 0, 76, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 156, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 68, 101, 112, 116, 104, 79, 110, 108, 121, 68, 97, 116, 97,
+ 0, 171, 171, 60, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0,
+ 0, 2, 0, 0, 0, 140, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97, 108, 117, 101,
+ 95, 68, 101, 112, 116, 104, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105,
+ 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171,
+ 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 79, 83, 71,
+ 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83,
+ 86, 95, 68, 69, 80, 84, 72, 0, 171, 171, 171, 83, 72, 68, 82, 56, 0, 0, 0,
+ 64, 0, 0, 0, 14, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 5, 1, 192,
+ 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h
new file mode 100644
index 0000000000..9d8e9a7b77
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h
@@ -0,0 +1,133 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat_FL9 /T ps_4_0_level_9_3 /Fh
+// compiled\clearfloat11_fl9ps.h Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_TARGET 2 xyzw 2 TARGET float xyzw
+// SV_TARGET 3 xyzw 3 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+//
+// Constant buffer to DX9 shader constant mappings:
+//
+// Target Reg Buffer Start Reg # of Regs Data Conversion
+// ---------- ------- --------- --------- ----------------------
+// c0 cb0 0 2 ( FLT, FLT, FLT, FLT)
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ mov oC0, c0
+ mov oC1, c0
+ mov oC2, c0
+ mov oC3, c0
+ mov oDepth, c1.x
+
+// approximately 5 instruction slots used
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat_FL9[] = {
+ 68, 88, 66, 67, 104, 72, 248, 31, 140, 236, 7, 58, 247, 255, 77, 116, 217, 183, 170,
+ 19, 1, 0, 0, 0, 228, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 180, 0,
+ 0, 0, 132, 1, 0, 0, 0, 2, 0, 0, 20, 3, 0, 0, 72, 3, 0, 0, 65,
+ 111, 110, 57, 116, 0, 0, 0, 116, 0, 0, 0, 0, 2, 255, 255, 68, 0, 0, 0,
+ 48, 0, 0, 0, 1, 0, 36, 0, 0, 0, 48, 0, 0, 0, 48, 0, 0, 0, 36,
+ 0, 0, 0, 48, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 2,
+ 255, 255, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 160, 1, 0, 0, 2, 1,
+ 8, 15, 128, 0, 0, 228, 160, 1, 0, 0, 2, 2, 8, 15, 128, 0, 0, 228, 160,
+ 1, 0, 0, 2, 3, 8, 15, 128, 0, 0, 228, 160, 1, 0, 0, 2, 0, 8, 15,
+ 144, 1, 0, 0, 160, 255, 255, 0, 0, 83, 72, 68, 82, 200, 0, 0, 0, 64, 0,
+ 0, 0, 50, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0,
+ 0, 101, 0, 0, 3, 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 2, 1, 192,
+ 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0,
+ 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16,
+ 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 6, 242, 32, 16, 0, 3, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
+ 68, 69, 70, 12, 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68,
+ 101, 112, 116, 104, 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0,
+ 2, 0, 0, 0, 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 156, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0,
+ 0, 0, 0, 0, 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2,
+ 0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108,
+ 111, 97, 116, 0, 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 122, 86, 97, 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0,
+ 3, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111,
+ 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101,
+ 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50,
+ 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0,
+ 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 79, 83, 71, 78, 148, 0, 0, 0, 5, 0, 0, 0, 8, 0, 0,
+ 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3,
+ 0, 0, 0, 1, 0, 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 128, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 15, 0,
+ 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255,
+ 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86,
+ 95, 68, 69, 80, 84, 72, 0, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps1.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps1.h
new file mode 100644
index 0000000000..d486562b23
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps1.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat1 /T ps_4_0 /Fh compiled\clearfloat11ps1.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat1[] = {
+ 68, 88, 66, 67, 194, 191, 135, 22, 7, 101, 39, 154, 161, 7, 119, 129, 159, 77, 141,
+ 64, 1, 0, 0, 0, 176, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 208, 1, 0, 0, 52, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 76, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255,
+ 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86,
+ 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 92, 0, 0, 0, 64, 0, 0,
+ 0, 23, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 2, 1,
+ 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps2.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps2.h
new file mode 100644
index 0000000000..d2fb37a988
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps2.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat2 /T ps_4_0 /Fh compiled\clearfloat11ps2.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat2[] = {
+ 68, 88, 66, 67, 225, 157, 134, 36, 221, 175, 143, 13, 216, 233, 141, 160, 234, 199, 6,
+ 135, 1, 0, 0, 0, 236, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 232, 1, 0, 0, 112, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 100, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 80, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71,
+ 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 128, 0,
+ 0, 0, 64, 0, 0, 0, 32, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0,
+ 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70,
+ 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0,
+ 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps3.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps3.h
new file mode 100644
index 0000000000..df64565fb8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps3.h
@@ -0,0 +1,102 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat3 /T ps_4_0 /Fh compiled\clearfloat11ps3.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_TARGET 2 xyzw 2 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat3[] = {
+ 68, 88, 66, 67, 204, 19, 228, 34, 50, 163, 79, 235, 82, 71, 143, 124, 210, 54, 184,
+ 205, 1, 0, 0, 0, 40, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 0, 2, 0, 0, 172, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 124, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 104, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 104, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 114, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83,
+ 72, 68, 82, 164, 0, 0, 0, 64, 0, 0, 0, 41, 0, 0, 0, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0,
+ 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1,
+ 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps4.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps4.h
new file mode 100644
index 0000000000..7917307b08
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps4.h
@@ -0,0 +1,108 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat4 /T ps_4_0 /Fh compiled\clearfloat11ps4.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_TARGET 2 xyzw 2 TARGET float xyzw
+// SV_TARGET 3 xyzw 3 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat4[] = {
+ 68, 88, 66, 67, 118, 236, 166, 207, 85, 126, 49, 200, 223, 63, 28, 99, 129, 76, 44,
+ 101, 1, 0, 0, 0, 100, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 24, 2, 0, 0, 232, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 148, 0, 0, 0, 5, 0, 0, 0, 8, 0, 0, 0, 128, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 128, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 138, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1,
+ 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80,
+ 84, 72, 0, 171, 83, 72, 68, 82, 200, 0, 0, 0, 64, 0, 0, 0, 50, 0, 0,
+ 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0,
+ 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0,
+ 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16,
+ 0, 3, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps5.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps5.h
new file mode 100644
index 0000000000..b9c702705a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps5.h
@@ -0,0 +1,114 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat5 /T ps_4_0 /Fh compiled\clearfloat11ps5.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_TARGET 2 xyzw 2 TARGET float xyzw
+// SV_TARGET 3 xyzw 3 TARGET float xyzw
+// SV_TARGET 4 xyzw 4 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat5[] = {
+ 68, 88, 66, 67, 123, 52, 161, 168, 70, 129, 246, 30, 10, 53, 190, 145, 187, 163, 141,
+ 41, 1, 0, 0, 0, 160, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 48, 2, 0, 0, 36, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 172, 0, 0, 0, 6, 0, 0, 0, 8, 0, 0, 0, 152, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 152, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 152, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 152, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 152, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83,
+ 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 236, 0, 0, 0, 64, 0,
+ 0, 0, 59, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0,
+ 0, 101, 0, 0, 3, 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 4, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3,
+ 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 242, 32, 16, 0, 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps6.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps6.h
new file mode 100644
index 0000000000..6a0d5ad96d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps6.h
@@ -0,0 +1,120 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat6 /T ps_4_0 /Fh compiled\clearfloat11ps6.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_TARGET 2 xyzw 2 TARGET float xyzw
+// SV_TARGET 3 xyzw 3 TARGET float xyzw
+// SV_TARGET 4 xyzw 4 TARGET float xyzw
+// SV_TARGET 5 xyzw 5 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat6[] = {
+ 68, 88, 66, 67, 9, 231, 198, 152, 73, 204, 169, 213, 251, 221, 21, 165, 112, 13, 206,
+ 187, 1, 0, 0, 0, 220, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 72, 2, 0, 0, 96, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 196, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 176, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 176, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 176, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 176, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 176, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 176, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 16,
+ 1, 0, 0, 64, 0, 0, 0, 68, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 3, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 4, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 5, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16,
+ 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0,
+ 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32,
+ 16, 0, 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps7.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps7.h
new file mode 100644
index 0000000000..fd2f57227a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps7.h
@@ -0,0 +1,127 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat7 /T ps_4_0 /Fh compiled\clearfloat11ps7.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_TARGET 2 xyzw 2 TARGET float xyzw
+// SV_TARGET 3 xyzw 3 TARGET float xyzw
+// SV_TARGET 4 xyzw 4 TARGET float xyzw
+// SV_TARGET 5 xyzw 5 TARGET float xyzw
+// SV_TARGET 6 xyzw 6 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov o6.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat7[] = {
+ 68, 88, 66, 67, 170, 173, 131, 172, 155, 25, 100, 152, 127, 184, 193, 251, 147, 13, 61,
+ 159, 1, 0, 0, 0, 24, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 96, 2, 0, 0, 156, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 220, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 200, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 200, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 200, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 200, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 6, 0, 0, 0, 15, 0, 0, 0, 210, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83,
+ 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171,
+ 83, 72, 68, 82, 52, 1, 0, 0, 64, 0, 0, 0, 77, 0, 0, 0, 89, 0, 0,
+ 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 3, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 4, 0, 0, 0, 101, 0, 0,
+ 3, 242, 32, 16, 0, 5, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 6, 0,
+ 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0,
+ 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0, 0, 70,
+ 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0,
+ 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 6, 242, 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 6, 0, 0, 0, 70, 142, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps8.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps8.h
new file mode 100644
index 0000000000..dbc9073f02
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps8.h
@@ -0,0 +1,133 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearFloat8 /T ps_4_0 /Fh compiled\clearfloat11ps8.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataFloat
+// {
+//
+// float4 color_Float; // Offset: 0 Size: 16
+// float zValueF_Float; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataFloat cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+// SV_TARGET 1 xyzw 1 TARGET float xyzw
+// SV_TARGET 2 xyzw 2 TARGET float xyzw
+// SV_TARGET 3 xyzw 3 TARGET float xyzw
+// SV_TARGET 4 xyzw 4 TARGET float xyzw
+// SV_TARGET 5 xyzw 5 TARGET float xyzw
+// SV_TARGET 6 xyzw 6 TARGET float xyzw
+// SV_TARGET 7 xyzw 7 TARGET float xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov o6.xyzw, cb0[0].xyzw
+mov o7.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat8[] = {
+ 68, 88, 66, 67, 182, 101, 16, 155, 29, 152, 163, 52, 194, 25, 110, 209, 100, 8, 227,
+ 42, 1, 0, 0, 0, 84, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 120, 2, 0, 0, 216, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 70, 108, 111, 97, 116, 0, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 70, 108, 111, 97, 116, 0,
+ 1, 0, 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 70, 108, 111, 97, 116, 0, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 244, 0, 0, 0, 9, 0, 0, 0, 8, 0, 0, 0, 224, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 224, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 224, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 224, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 6, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 7, 0, 0, 0, 15, 0, 0, 0, 234,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255,
+ 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69,
+ 80, 84, 72, 0, 171, 83, 72, 68, 82, 88, 1, 0, 0, 64, 0, 0, 0, 86, 0,
+ 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0,
+ 3, 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 4, 0,
+ 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 5, 0, 0, 0, 101, 0, 0, 3, 242,
+ 32, 16, 0, 6, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 7, 0, 0, 0,
+ 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0,
+ 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32,
+ 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0, 0, 70, 142, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 4, 0,
+ 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242,
+ 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 242, 32, 16, 0, 6, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 7, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10,
+ 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps1.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps1.h
new file mode 100644
index 0000000000..369f91b169
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps1.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint1 /T ps_4_0 /Fh compiled\clearsint11ps1.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint1[] = {
+ 68, 88, 66, 67, 88, 163, 189, 91, 71, 60, 117, 226, 154, 216, 135, 21, 77, 90, 76,
+ 124, 1, 0, 0, 0, 176, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 208, 1, 0, 0, 52, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 76, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255,
+ 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86,
+ 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 92, 0, 0, 0, 64, 0, 0,
+ 0, 23, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 2, 1,
+ 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps2.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps2.h
new file mode 100644
index 0000000000..cbf612d83b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps2.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint2 /T ps_4_0 /Fh compiled\clearsint11ps2.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint2[] = {
+ 68, 88, 66, 67, 78, 174, 75, 16, 146, 221, 109, 222, 248, 135, 83, 225, 132, 36, 188,
+ 212, 1, 0, 0, 0, 236, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 232, 1, 0, 0, 112, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 100, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 80, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71,
+ 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 128, 0,
+ 0, 0, 64, 0, 0, 0, 32, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0,
+ 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70,
+ 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0,
+ 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps3.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps3.h
new file mode 100644
index 0000000000..4df53c3110
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps3.h
@@ -0,0 +1,102 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint3 /T ps_4_0 /Fh compiled\clearsint11ps3.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_TARGET 2 xyzw 2 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint3[] = {
+ 68, 88, 66, 67, 211, 173, 24, 113, 222, 43, 56, 242, 158, 91, 245, 255, 64, 66, 11,
+ 177, 1, 0, 0, 0, 40, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 0, 2, 0, 0, 172, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 124, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 104, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 104, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 114, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83,
+ 72, 68, 82, 164, 0, 0, 0, 64, 0, 0, 0, 41, 0, 0, 0, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0,
+ 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1,
+ 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps4.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps4.h
new file mode 100644
index 0000000000..45527cba25
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps4.h
@@ -0,0 +1,108 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint4 /T ps_4_0 /Fh compiled\clearsint11ps4.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_TARGET 2 xyzw 2 TARGET int xyzw
+// SV_TARGET 3 xyzw 3 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint4[] = {
+ 68, 88, 66, 67, 38, 96, 29, 166, 205, 218, 64, 123, 117, 198, 133, 227, 83, 243, 198,
+ 238, 1, 0, 0, 0, 100, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 24, 2, 0, 0, 232, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 148, 0, 0, 0, 5, 0, 0, 0, 8, 0, 0, 0, 128, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 128, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 138, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1,
+ 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80,
+ 84, 72, 0, 171, 83, 72, 68, 82, 200, 0, 0, 0, 64, 0, 0, 0, 50, 0, 0,
+ 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0,
+ 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0,
+ 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16,
+ 0, 3, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps5.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps5.h
new file mode 100644
index 0000000000..76cbc116ef
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps5.h
@@ -0,0 +1,114 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint5 /T ps_4_0 /Fh compiled\clearsint11ps5.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_TARGET 2 xyzw 2 TARGET int xyzw
+// SV_TARGET 3 xyzw 3 TARGET int xyzw
+// SV_TARGET 4 xyzw 4 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint5[] = {
+ 68, 88, 66, 67, 24, 79, 49, 33, 135, 214, 214, 87, 139, 54, 205, 88, 244, 235, 83,
+ 59, 1, 0, 0, 0, 160, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 48, 2, 0, 0, 36, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 172, 0, 0, 0, 6, 0, 0, 0, 8, 0, 0, 0, 152, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 152, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 152, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 152, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 152, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83,
+ 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 236, 0, 0, 0, 64, 0,
+ 0, 0, 59, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0,
+ 0, 101, 0, 0, 3, 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 4, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3,
+ 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 242, 32, 16, 0, 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps6.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps6.h
new file mode 100644
index 0000000000..4ea96b39ce
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps6.h
@@ -0,0 +1,120 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint6 /T ps_4_0 /Fh compiled\clearsint11ps6.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_TARGET 2 xyzw 2 TARGET int xyzw
+// SV_TARGET 3 xyzw 3 TARGET int xyzw
+// SV_TARGET 4 xyzw 4 TARGET int xyzw
+// SV_TARGET 5 xyzw 5 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint6[] = {
+ 68, 88, 66, 67, 222, 117, 7, 238, 217, 163, 47, 39, 162, 0, 176, 159, 4, 111, 83,
+ 238, 1, 0, 0, 0, 220, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 72, 2, 0, 0, 96, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 196, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 176, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 176, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 176, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 176, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 176, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 176, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 16,
+ 1, 0, 0, 64, 0, 0, 0, 68, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 3, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 4, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 5, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16,
+ 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0,
+ 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32,
+ 16, 0, 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps7.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps7.h
new file mode 100644
index 0000000000..b48dc1e0cd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps7.h
@@ -0,0 +1,127 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint7 /T ps_4_0 /Fh compiled\clearsint11ps7.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_TARGET 2 xyzw 2 TARGET int xyzw
+// SV_TARGET 3 xyzw 3 TARGET int xyzw
+// SV_TARGET 4 xyzw 4 TARGET int xyzw
+// SV_TARGET 5 xyzw 5 TARGET int xyzw
+// SV_TARGET 6 xyzw 6 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov o6.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint7[] = {
+ 68, 88, 66, 67, 47, 152, 142, 138, 182, 8, 198, 91, 234, 199, 6, 111, 183, 141, 38,
+ 79, 1, 0, 0, 0, 24, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 96, 2, 0, 0, 156, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 220, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 200, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 200, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 200, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 200, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 6, 0, 0, 0, 15, 0, 0, 0, 210, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83,
+ 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171,
+ 83, 72, 68, 82, 52, 1, 0, 0, 64, 0, 0, 0, 77, 0, 0, 0, 89, 0, 0,
+ 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 3, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 4, 0, 0, 0, 101, 0, 0,
+ 3, 242, 32, 16, 0, 5, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 6, 0,
+ 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0,
+ 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0, 0, 70,
+ 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0,
+ 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 6, 242, 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 6, 0, 0, 0, 70, 142, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps8.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps8.h
new file mode 100644
index 0000000000..1d07938a04
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps8.h
@@ -0,0 +1,133 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearSint8 /T ps_4_0 /Fh compiled\clearsint11ps8.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataSint
+// {
+//
+// int4 color_Sint; // Offset: 0 Size: 16
+// float zValueF_Sint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataSint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+// SV_TARGET 1 xyzw 1 TARGET int xyzw
+// SV_TARGET 2 xyzw 2 TARGET int xyzw
+// SV_TARGET 3 xyzw 3 TARGET int xyzw
+// SV_TARGET 4 xyzw 4 TARGET int xyzw
+// SV_TARGET 5 xyzw 5 TARGET int xyzw
+// SV_TARGET 6 xyzw 6 TARGET int xyzw
+// SV_TARGET 7 xyzw 7 TARGET int xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov o6.xyzw, cb0[0].xyzw
+mov o7.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint8[] = {
+ 68, 88, 66, 67, 224, 106, 130, 91, 4, 244, 99, 23, 240, 126, 19, 252, 49, 217, 220,
+ 228, 1, 0, 0, 0, 84, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 120, 2, 0, 0, 216, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 83, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 83, 105, 110, 116, 0, 171,
+ 1, 0, 2, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 83, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 244, 0, 0, 0, 9, 0, 0, 0, 8, 0, 0, 0, 224, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 224, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 224, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 224, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 6, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 7, 0, 0, 0, 15, 0, 0, 0, 234,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255,
+ 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69,
+ 80, 84, 72, 0, 171, 83, 72, 68, 82, 88, 1, 0, 0, 64, 0, 0, 0, 86, 0,
+ 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0,
+ 3, 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 4, 0,
+ 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 5, 0, 0, 0, 101, 0, 0, 3, 242,
+ 32, 16, 0, 6, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 7, 0, 0, 0,
+ 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0,
+ 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32,
+ 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0, 0, 70, 142, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 4, 0,
+ 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242,
+ 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 242, 32, 16, 0, 6, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 7, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10,
+ 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps1.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps1.h
new file mode 100644
index 0000000000..a2ad6bc3f7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps1.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint1 /T ps_4_0 /Fh compiled\clearuint11ps1.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint1[] = {
+ 68, 88, 66, 67, 220, 175, 96, 75, 216, 185, 134, 21, 58, 117, 130, 41, 133, 106, 117,
+ 72, 1, 0, 0, 0, 176, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 208, 1, 0, 0, 52, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 76, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255,
+ 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86,
+ 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 92, 0, 0, 0, 64, 0, 0,
+ 0, 23, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 2, 1,
+ 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps2.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps2.h
new file mode 100644
index 0000000000..c4655453c5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps2.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint2 /T ps_4_0 /Fh compiled\clearuint11ps2.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint2[] = {
+ 68, 88, 66, 67, 42, 133, 132, 52, 23, 242, 4, 181, 33, 9, 143, 17, 179, 83, 209,
+ 213, 1, 0, 0, 0, 236, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 232, 1, 0, 0, 112, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 100, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 80, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71,
+ 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 128, 0,
+ 0, 0, 64, 0, 0, 0, 32, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0,
+ 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0,
+ 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70,
+ 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0,
+ 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps3.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps3.h
new file mode 100644
index 0000000000..e83c79243f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps3.h
@@ -0,0 +1,102 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint3 /T ps_4_0 /Fh compiled\clearuint11ps3.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_TARGET 2 xyzw 2 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint3[] = {
+ 68, 88, 66, 67, 53, 56, 177, 56, 90, 50, 25, 21, 43, 95, 252, 133, 162, 6, 79,
+ 246, 1, 0, 0, 0, 40, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 0, 2, 0, 0, 172, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 124, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 104, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 104, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 114, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83,
+ 72, 68, 82, 164, 0, 0, 0, 64, 0, 0, 0, 41, 0, 0, 0, 89, 0, 0, 4,
+ 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0,
+ 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1,
+ 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps4.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps4.h
new file mode 100644
index 0000000000..756ce6a13c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps4.h
@@ -0,0 +1,108 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint4 /T ps_4_0 /Fh compiled\clearuint11ps4.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_TARGET 2 xyzw 2 TARGET uint xyzw
+// SV_TARGET 3 xyzw 3 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint4[] = {
+ 68, 88, 66, 67, 93, 224, 233, 7, 108, 86, 206, 136, 211, 232, 189, 38, 61, 229, 240,
+ 107, 1, 0, 0, 0, 100, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 24, 2, 0, 0, 232, 2, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 148, 0, 0, 0, 5, 0, 0, 0, 8, 0, 0, 0, 128, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 128, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 128, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 138, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1,
+ 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80,
+ 84, 72, 0, 171, 83, 72, 68, 82, 200, 0, 0, 0, 64, 0, 0, 0, 50, 0, 0,
+ 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0,
+ 6, 242, 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0,
+ 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16,
+ 0, 3, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps5.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps5.h
new file mode 100644
index 0000000000..c3f4855be0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps5.h
@@ -0,0 +1,114 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint5 /T ps_4_0 /Fh compiled\clearuint11ps5.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_TARGET 2 xyzw 2 TARGET uint xyzw
+// SV_TARGET 3 xyzw 3 TARGET uint xyzw
+// SV_TARGET 4 xyzw 4 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint5[] = {
+ 68, 88, 66, 67, 145, 170, 201, 225, 97, 45, 33, 28, 95, 98, 167, 25, 135, 24, 231,
+ 97, 1, 0, 0, 0, 160, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 48, 2, 0, 0, 36, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 172, 0, 0, 0, 6, 0, 0, 0, 8, 0, 0, 0, 152, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 152, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 152, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 152, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 152, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83,
+ 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 236, 0, 0, 0, 64, 0,
+ 0, 0, 59, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3,
+ 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0,
+ 0, 101, 0, 0, 3, 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 4, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3,
+ 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 242, 32, 16, 0, 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps6.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps6.h
new file mode 100644
index 0000000000..9861e81e78
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps6.h
@@ -0,0 +1,120 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint6 /T ps_4_0 /Fh compiled\clearuint11ps6.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_TARGET 2 xyzw 2 TARGET uint xyzw
+// SV_TARGET 3 xyzw 3 TARGET uint xyzw
+// SV_TARGET 4 xyzw 4 TARGET uint xyzw
+// SV_TARGET 5 xyzw 5 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint6[] = {
+ 68, 88, 66, 67, 59, 95, 199, 69, 225, 101, 80, 115, 38, 233, 215, 218, 240, 146, 191,
+ 41, 1, 0, 0, 0, 220, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 72, 2, 0, 0, 96, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 196, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 176, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 176, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 176, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 176, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 176, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 176, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 83, 72, 68, 82, 16,
+ 1, 0, 0, 64, 0, 0, 0, 68, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 3, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 4, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 5, 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16,
+ 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 6, 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0,
+ 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32,
+ 16, 0, 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps7.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps7.h
new file mode 100644
index 0000000000..39af7a5479
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps7.h
@@ -0,0 +1,127 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint7 /T ps_4_0 /Fh compiled\clearuint11ps7.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_TARGET 2 xyzw 2 TARGET uint xyzw
+// SV_TARGET 3 xyzw 3 TARGET uint xyzw
+// SV_TARGET 4 xyzw 4 TARGET uint xyzw
+// SV_TARGET 5 xyzw 5 TARGET uint xyzw
+// SV_TARGET 6 xyzw 6 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov o6.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint7[] = {
+ 68, 88, 66, 67, 6, 251, 248, 98, 126, 222, 114, 11, 145, 122, 100, 238, 211, 116, 210,
+ 124, 1, 0, 0, 0, 24, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 96, 2, 0, 0, 156, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 220, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 200, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 200, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 200, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 200, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 200, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 6, 0, 0, 0, 15, 0, 0, 0, 210, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0, 83,
+ 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171,
+ 83, 72, 68, 82, 52, 1, 0, 0, 64, 0, 0, 0, 77, 0, 0, 0, 89, 0, 0,
+ 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 1, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 3, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 4, 0, 0, 0, 101, 0, 0,
+ 3, 242, 32, 16, 0, 5, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 6, 0,
+ 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0,
+ 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 242, 32, 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0, 0, 70,
+ 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0,
+ 4, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 6, 242, 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 6, 0, 0, 0, 70, 142, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10, 128, 32, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps8.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps8.h
new file mode 100644
index 0000000000..3974396441
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps8.h
@@ -0,0 +1,133 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ClearUint8 /T ps_4_0 /Fh compiled\clearuint11ps8.h
+// Clear11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer ColorAndDepthDataUint
+// {
+//
+// uint4 color_Uint; // Offset: 0 Size: 16
+// float zValueF_Uint; // Offset: 16 Size: 4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// ColorAndDepthDataUint cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+// SV_TARGET 1 xyzw 1 TARGET uint xyzw
+// SV_TARGET 2 xyzw 2 TARGET uint xyzw
+// SV_TARGET 3 xyzw 3 TARGET uint xyzw
+// SV_TARGET 4 xyzw 4 TARGET uint xyzw
+// SV_TARGET 5 xyzw 5 TARGET uint xyzw
+// SV_TARGET 6 xyzw 6 TARGET uint xyzw
+// SV_TARGET 7 xyzw 7 TARGET uint xyzw
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_constantbuffer cb0[2], immediateIndexed
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+dcl_output oDepth
+mov o0.xyzw, cb0[0].xyzw
+mov o1.xyzw, cb0[0].xyzw
+mov o2.xyzw, cb0[0].xyzw
+mov o3.xyzw, cb0[0].xyzw
+mov o4.xyzw, cb0[0].xyzw
+mov o5.xyzw, cb0[0].xyzw
+mov o6.xyzw, cb0[0].xyzw
+mov o7.xyzw, cb0[0].xyzw
+mov oDepth, cb0[1].x
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint8[] = {
+ 68, 88, 66, 67, 136, 114, 184, 151, 152, 245, 97, 46, 151, 61, 117, 123, 231, 117, 211,
+ 116, 1, 0, 0, 0, 84, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 72, 1,
+ 0, 0, 124, 1, 0, 0, 120, 2, 0, 0, 216, 3, 0, 0, 82, 68, 69, 70, 12,
+ 1, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 216, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 67, 111, 108, 111, 114, 65, 110, 100, 68, 101, 112, 116, 104,
+ 68, 97, 116, 97, 85, 105, 110, 116, 0, 171, 171, 60, 0, 0, 0, 2, 0, 0, 0,
+ 108, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 168, 0, 0, 0, 0, 0,
+ 0, 0, 184, 0, 0, 0, 16, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 200,
+ 0, 0, 0, 0, 0, 0, 0, 99, 111, 108, 111, 114, 95, 85, 105, 110, 116, 0, 171,
+ 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 86, 97,
+ 108, 117, 101, 70, 95, 85, 105, 110, 116, 0, 171, 171, 171, 0, 0, 3, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 79, 83, 71, 78, 244, 0, 0, 0, 9, 0, 0, 0, 8, 0, 0, 0, 224, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 224, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 2, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 15, 0, 0, 0, 224, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 15,
+ 0, 0, 0, 224, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 5, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 6, 0, 0, 0, 15, 0, 0, 0, 224, 0, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 15, 0, 0, 0, 234,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255,
+ 1, 14, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 83, 86, 95, 68, 69,
+ 80, 84, 72, 0, 171, 83, 72, 68, 82, 88, 1, 0, 0, 64, 0, 0, 0, 86, 0,
+ 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 101,
+ 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 2, 0, 0, 0, 101, 0, 0,
+ 3, 242, 32, 16, 0, 3, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 4, 0,
+ 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 5, 0, 0, 0, 101, 0, 0, 3, 242,
+ 32, 16, 0, 6, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 7, 0, 0, 0,
+ 101, 0, 0, 2, 1, 192, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 0, 0, 0,
+ 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32,
+ 16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 242, 32, 16, 0, 2, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 3, 0, 0, 0, 70, 142, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 4, 0,
+ 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 242,
+ 32, 16, 0, 5, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 242, 32, 16, 0, 6, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 242, 32, 16, 0, 7, 0, 0, 0, 70, 142,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 1, 192, 0, 0, 10,
+ 128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2d_ps.h
new file mode 100644
index 0000000000..e267c67c29
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2d_ps.h
@@ -0,0 +1,81 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_LUMA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_luma_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xxxx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_LUMA_2D[] = {
+ 68, 88, 66, 67, 209, 59, 102, 31, 237, 225, 110, 86, 236, 253, 1, 91, 155, 216, 150,
+ 240, 1, 0, 0, 0, 136, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 12, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 156, 0, 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 6, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1,
+ 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2darray_ps.h
new file mode 100644
index 0000000000..386203c3bf
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_2darray_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_LUMA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_luma_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xxxx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_LUMA_2DArray[] = {
+ 68, 88, 66, 67, 208, 70, 99, 71, 119, 41, 43, 184, 189, 145, 19, 67, 181, 106, 103,
+ 72, 1, 0, 0, 0, 248, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 124, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 212, 0, 0, 0, 64, 0, 0, 0, 53, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_3d_ps.h
new file mode 100644
index 0000000000..d3d612b6af
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_luma_3d_ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_LUMA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_luma_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xxxx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_LUMA_3D[] = {
+ 68, 88, 66, 67, 214, 160, 249, 108, 182, 66, 25, 177, 36, 87, 104, 15, 250, 128, 30,
+ 24, 1, 0, 0, 0, 188, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 64, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 156, 0,
+ 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 32, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2d_ps.h
new file mode 100644
index 0000000000..7e2fbddc6b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2d_ps.h
@@ -0,0 +1,81 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_LUMAALPHA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_lumaalpha_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xxxx
+mov o0.w, r0.w
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_LUMAALPHA_2D[] = {
+ 68, 88, 66, 67, 115, 23, 213, 46, 252, 25, 113, 198, 165, 30, 205, 48, 189, 198, 141,
+ 23, 1, 0, 0, 0, 136, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 12, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 156, 0, 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 6, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 58,
+ 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2darray_ps.h
new file mode 100644
index 0000000000..8e19b44f5a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_2darray_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_LUMAALPHA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_lumaalpha_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xxxx
+mov o0.w, r0.w
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_LUMAALPHA_2DArray[] = {
+ 68, 88, 66, 67, 93, 91, 193, 199, 207, 164, 35, 12, 201, 95, 163, 171, 218, 214, 187,
+ 51, 1, 0, 0, 0, 248, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 124, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 212, 0, 0, 0, 64, 0, 0, 0, 53, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 58, 0, 16,
+ 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_3d_ps.h
new file mode 100644
index 0000000000..003c0f2872
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_lumaalpha_3d_ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_LUMAALPHA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_lumaalpha_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xxxx
+mov o0.w, r0.w
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_LUMAALPHA_3D[] = {
+ 68, 88, 66, 67, 246, 88, 227, 190, 126, 145, 255, 83, 3, 145, 110, 73, 19, 110, 141,
+ 116, 1, 0, 0, 0, 188, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 64, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 156, 0,
+ 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 32, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2d_ps.h
new file mode 100644
index 0000000000..5e6b38058a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2d_ps.h
@@ -0,0 +1,81 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGB_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgb_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGB_2D[] = {
+ 68, 88, 66, 67, 25, 134, 222, 46, 234, 185, 135, 172, 122, 147, 21, 58, 145, 33, 84,
+ 232, 1, 0, 0, 0, 136, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 12, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 156, 0, 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1,
+ 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2darray_ps.h
new file mode 100644
index 0000000000..8ec063df4c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_2darray_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGB_2DArray[] = {
+ 68, 88, 66, 67, 5, 209, 117, 255, 204, 165, 3, 202, 62, 237, 111, 22, 134, 7, 56,
+ 167, 1, 0, 0, 0, 248, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 124, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 212, 0, 0, 0, 64, 0, 0, 0, 53, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_3d_ps.h
new file mode 100644
index 0000000000..ba2a9484c5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_3d_ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGB_3D[] = {
+ 68, 88, 66, 67, 105, 156, 158, 73, 245, 65, 169, 138, 164, 71, 86, 95, 185, 136, 127,
+ 70, 1, 0, 0, 0, 188, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 64, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 156, 0,
+ 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 32, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2d_ps.h
new file mode 100644
index 0000000000..d5d6e6055b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2d_ps.h
@@ -0,0 +1,89 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGB_565_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgb_565_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGB_565_2D[] = {
+ 68, 88, 66, 67, 153, 181, 200, 3, 63, 247, 199, 176, 24, 55, 137, 153, 94, 174, 61,
+ 31, 1, 0, 0, 0, 236, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 112, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 0, 1, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 124, 66,
+ 0, 0, 248, 65, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 32, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 33,
+ 8, 130, 60, 8, 33, 4, 61, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2darray_ps.h
new file mode 100644
index 0000000000..fbc1bf5220
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_2darray_ps.h
@@ -0,0 +1,99 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGB_565_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgb_565_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGB_565_2DArray[] = {
+ 68, 88, 66, 67, 82, 230, 180, 156, 53, 248, 202, 43, 118, 192, 10, 70, 121, 224, 218,
+ 52, 1, 0, 0, 0, 92, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 224, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 56, 1, 0, 0, 64, 0, 0, 0, 78, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 124, 66, 0, 0,
+ 248, 65, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 32, 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 33, 8, 130,
+ 60, 8, 33, 4, 61, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116,
+ 0, 0, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_3d_ps.h
new file mode 100644
index 0000000000..1c349a2021
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgb_565_3d_ps.h
@@ -0,0 +1,93 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGB_565_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgb_565_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGB_565_3D[] = {
+ 68, 88, 66, 67, 151, 48, 123, 120, 147, 84, 12, 118, 27, 132, 114, 7, 119, 110, 184,
+ 103, 1, 0, 0, 0, 32, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 164, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 0, 1,
+ 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 124, 66, 0, 0, 248, 65, 0,
+ 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 33, 8, 130, 60, 8, 33,
+ 4, 61, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1,
+ 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2d_ps.h
new file mode 100644
index 0000000000..72b11056d1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2d_ps.h
@@ -0,0 +1,81 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_2D[] = {
+ 68, 88, 66, 67, 98, 163, 157, 38, 253, 172, 208, 179, 84, 166, 215, 117, 236, 59, 71,
+ 89, 1, 0, 0, 0, 136, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 12, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 156, 0, 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 58,
+ 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2darray_ps.h
new file mode 100644
index 0000000000..02e93e1fd2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_2darray_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 71, 137, 115, 116, 116, 227, 120, 13, 78, 6, 238, 184, 42, 233, 145,
+ 176, 1, 0, 0, 0, 248, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 124, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 212, 0, 0, 0, 64, 0, 0, 0, 53, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 32, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 58, 0, 16,
+ 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_3d_ps.h
new file mode 100644
index 0000000000..588e7a87f3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_3d_ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul o0.xyz, r0.wwww, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_3D[] = {
+ 68, 88, 66, 67, 18, 96, 97, 129, 150, 42, 120, 55, 5, 245, 19, 153, 24, 53, 74,
+ 155, 1, 0, 0, 0, 188, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 64, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 156, 0,
+ 0, 0, 64, 0, 0, 0, 39, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 32, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2d_ps.h
new file mode 100644
index 0000000000..de1bf9bd78
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2d_ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_4444_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_4444_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_4444_2D[] = {
+ 68, 88, 66, 67, 162, 159, 42, 148, 192, 35, 248, 166, 96, 219, 84, 153, 55, 243, 174,
+ 115, 1, 0, 0, 0, 216, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 92, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 236, 0, 0, 0, 64, 0, 0, 0, 59, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 112, 65, 0, 0, 112, 65,
+ 0, 0, 112, 65, 0, 0, 112, 65, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 137, 136, 136, 61, 137,
+ 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2darray_ps.h
new file mode 100644
index 0000000000..0beb462746
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_2darray_ps.h
@@ -0,0 +1,97 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_4444_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_4444_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_4444_2DArray[] = {
+ 68, 88, 66, 67, 0, 105, 196, 49, 19, 185, 247, 82, 176, 7, 54, 252, 239, 225, 169,
+ 225, 1, 0, 0, 0, 72, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 204, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 36, 1, 0, 0, 64, 0, 0, 0, 73, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 112, 65, 0, 0, 112, 65, 0, 0,
+ 112, 65, 0, 0, 112, 65, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 137, 136, 136, 61, 137, 136, 136,
+ 61, 137, 136, 136, 61, 137, 136, 136, 61, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_3d_ps.h
new file mode 100644
index 0000000000..95984d74dc
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_4444_3d_ps.h
@@ -0,0 +1,91 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_4444_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_4444_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_4444_3D[] = {
+ 68, 88, 66, 67, 182, 254, 44, 165, 15, 39, 193, 247, 58, 244, 243, 166, 190, 236, 221,
+ 252, 1, 0, 0, 0, 12, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 144, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 236, 0,
+ 0, 0, 64, 0, 0, 0, 59, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 112, 65, 0, 0, 112, 65, 0, 0, 112, 65, 0,
+ 0, 112, 65, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 137, 136, 136, 61, 137, 136, 136, 61, 137, 136,
+ 136, 61, 137, 136, 136, 61, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2d_ps.h
new file mode 100644
index 0000000000..ec165e09cb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2d_ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_5551_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_5551_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_5551_2D[] = {
+ 68, 88, 66, 67, 9, 162, 245, 66, 237, 195, 125, 215, 175, 86, 217, 7, 250, 144, 127,
+ 24, 1, 0, 0, 0, 216, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 92, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 236, 0, 0, 0, 64, 0, 0, 0, 59, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 248, 65,
+ 0, 0, 248, 65, 0, 0, 128, 63, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 8,
+ 33, 4, 61, 8, 33, 4, 61, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2darray_ps.h
new file mode 100644
index 0000000000..c32ad2a617
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_2darray_ps.h
@@ -0,0 +1,97 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_5551_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_5551_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_5551_2DArray[] = {
+ 68, 88, 66, 67, 205, 80, 185, 185, 211, 249, 96, 159, 20, 215, 234, 77, 101, 157, 240,
+ 47, 1, 0, 0, 0, 72, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 204, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 36, 1, 0, 0, 64, 0, 0, 0, 73, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 248, 65, 0, 0,
+ 248, 65, 0, 0, 128, 63, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 8, 33, 4,
+ 61, 8, 33, 4, 61, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_3d_ps.h
new file mode 100644
index 0000000000..1220a494fa
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_pm_rgba_5551_3d_ps.h
@@ -0,0 +1,91 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_PM_RGBA_5551_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_pm_rgba_5551_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_PM_RGBA_5551_3D[] = {
+ 68, 88, 66, 67, 6, 155, 93, 120, 159, 88, 203, 149, 81, 116, 108, 30, 223, 171, 137,
+ 112, 1, 0, 0, 0, 12, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 144, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 236, 0,
+ 0, 0, 64, 0, 0, 0, 59, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 248, 65, 0, 0, 248, 65, 0,
+ 0, 128, 63, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 8, 33, 4, 61, 8, 33,
+ 4, 61, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2d_ps.h
new file mode 100644
index 0000000000..3ef4affde9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2d_ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_LUMA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_luma_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r0.w, r0.x, r0.w
+movc o0.xyz, r1.xxxx, r0.wwww, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_LUMA_2D[] = {
+ 68, 88, 66, 67, 71, 14, 186, 44, 238, 163, 144, 254, 61, 126, 83, 179, 106, 64, 226,
+ 41, 1, 0, 0, 0, 200, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 76, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 220, 0, 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 10,
+ 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 32, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 246, 15, 16,
+ 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2darray_ps.h
new file mode 100644
index 0000000000..64ab922ff0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_2darray_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_LUMA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_luma_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r0.w, r0.x, r0.w
+movc o0.xyz, r1.xxxx, r0.wwww, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_LUMA_2DArray[] = {
+ 68, 88, 66, 67, 184, 162, 155, 43, 23, 48, 207, 131, 7, 89, 192, 94, 227, 94, 220,
+ 191, 1, 0, 0, 0, 56, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 188, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 20, 1, 0, 0, 64, 0, 0, 0, 69, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16,
+ 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 246, 15, 16, 0, 0,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_3d_ps.h
new file mode 100644
index 0000000000..7ad48953d8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_luma_3d_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_LUMA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_luma_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r0.w, r0.x, r0.w
+movc o0.xyz, r1.xxxx, r0.wwww, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_LUMA_3D[] = {
+ 68, 88, 66, 67, 77, 171, 194, 196, 97, 109, 120, 177, 44, 223, 143, 94, 184, 55, 24,
+ 193, 1, 0, 0, 0, 252, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 128, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 220, 0,
+ 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 130, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0,
+ 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2d_ps.h
new file mode 100644
index 0000000000..78c2c25e34
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2d_ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_LUMAALPHA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_lumaalpha_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.y, r0.x, r0.w
+movc o0.xyz, r1.xxxx, r1.yyyy, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_LUMAALPHA_2D[] = {
+ 68, 88, 66, 67, 22, 109, 155, 40, 201, 35, 16, 39, 85, 5, 175, 53, 227, 54, 209,
+ 235, 1, 0, 0, 0, 200, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 76, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 220, 0, 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 34, 0, 16, 0, 1, 0, 0, 0, 10,
+ 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 32, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 86, 5, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2darray_ps.h
new file mode 100644
index 0000000000..297851ac87
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_2darray_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_LUMAALPHA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_lumaalpha_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.y, r0.x, r0.w
+movc o0.xyz, r1.xxxx, r1.yyyy, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_LUMAALPHA_2DArray[] = {
+ 68, 88, 66, 67, 94, 117, 2, 58, 233, 207, 165, 71, 59, 41, 51, 92, 213, 80, 177,
+ 27, 1, 0, 0, 0, 56, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 188, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 20, 1, 0, 0, 64, 0, 0, 0, 69, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 34, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16,
+ 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
+ 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_3d_ps.h
new file mode 100644
index 0000000000..530391aea6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_lumaalpha_3d_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_LUMAALPHA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_lumaalpha_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.y, r0.x, r0.w
+movc o0.xyz, r1.xxxx, r1.yyyy, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_LUMAALPHA_3D[] = {
+ 68, 88, 66, 67, 128, 175, 170, 32, 32, 26, 145, 52, 16, 138, 167, 233, 195, 132, 202,
+ 23, 1, 0, 0, 0, 252, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 128, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 220, 0,
+ 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 34, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 0, 0, 0,
+ 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 86, 5, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
+ 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2d_ps.h
new file mode 100644
index 0000000000..bc82ff60f7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2d_ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGB_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgb_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc o0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGB_2D[] = {
+ 68, 88, 66, 67, 63, 117, 49, 53, 235, 146, 223, 2, 159, 166, 4, 195, 149, 255, 102,
+ 138, 1, 0, 0, 0, 200, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 76, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 220, 0, 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6,
+ 9, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 32, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2darray_ps.h
new file mode 100644
index 0000000000..7e9b05f189
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_2darray_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc o0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGB_2DArray[] = {
+ 68, 88, 66, 67, 210, 10, 53, 114, 86, 93, 161, 110, 5, 206, 177, 106, 185, 213, 179,
+ 76, 1, 0, 0, 0, 56, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 188, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 20, 1, 0, 0, 64, 0, 0, 0, 69, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_3d_ps.h
new file mode 100644
index 0000000000..7af44b30c1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_3d_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc o0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGB_3D[] = {
+ 68, 88, 66, 67, 188, 48, 16, 8, 90, 93, 28, 229, 37, 1, 35, 250, 16, 184, 91,
+ 94, 1, 0, 0, 0, 252, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 128, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 220, 0,
+ 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2d_ps.h
new file mode 100644
index 0000000000..7bc7ce3a31
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2d_ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGB_565_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgb_565_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGB_565_2D[] = {
+ 68, 88, 66, 67, 117, 81, 223, 7, 30, 231, 23, 32, 47, 120, 68, 27, 206, 77, 54,
+ 22, 1, 0, 0, 0, 44, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 176, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 64, 1, 0, 0, 64, 0, 0, 0, 80, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6,
+ 9, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0,
+ 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 248, 65, 0, 0, 124, 66, 0, 0, 248, 65, 0, 0, 0, 0, 64, 0, 0, 5,
+ 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 10, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 8, 33, 4, 61, 33, 8, 130, 60, 8, 33, 4, 61, 0, 0, 0, 0, 54,
+ 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63,
+ 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2darray_ps.h
new file mode 100644
index 0000000000..e45bb2a2fb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_2darray_ps.h
@@ -0,0 +1,104 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGB_565_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgb_565_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGB_565_2DArray[] = {
+ 68, 88, 66, 67, 35, 219, 151, 252, 191, 176, 177, 149, 253, 136, 157, 72, 99, 141, 43,
+ 53, 1, 0, 0, 0, 156, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 32, 3, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 120, 1, 0, 0, 64, 0, 0, 0, 94, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248,
+ 65, 0, 0, 124, 66, 0, 0, 248, 65, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0,
+ 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114,
+ 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 8, 33, 4, 61, 33, 8, 130, 60, 8, 33, 4, 61, 0, 0, 0, 0, 54, 0, 0,
+ 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0,
+ 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 11, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_3d_ps.h
new file mode 100644
index 0000000000..7cda8da7e3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgb_565_3d_ps.h
@@ -0,0 +1,98 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGB_565_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgb_565_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGB_565_3D[] = {
+ 68, 88, 66, 67, 103, 213, 3, 101, 235, 72, 224, 234, 90, 115, 96, 192, 84, 122, 216,
+ 161, 1, 0, 0, 0, 96, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 228, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 64, 1,
+ 0, 0, 64, 0, 0, 0, 80, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0,
+ 124, 66, 0, 0, 248, 65, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 32, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4,
+ 61, 33, 8, 130, 60, 8, 33, 4, 61, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2d_ps.h
new file mode 100644
index 0000000000..ba9d3a219b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2d_ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc o0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_2D[] = {
+ 68, 88, 66, 67, 214, 130, 152, 233, 185, 254, 78, 247, 13, 195, 81, 12, 126, 13, 130,
+ 154, 1, 0, 0, 0, 200, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 76, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 220, 0, 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6,
+ 9, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 32, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32,
+ 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2darray_ps.h
new file mode 100644
index 0000000000..8fde37e269
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_2darray_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc o0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 94, 112, 50, 105, 113, 109, 240, 60, 172, 113, 184, 242, 235, 87, 64,
+ 32, 1, 0, 0, 0, 56, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 188, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 20, 1, 0, 0, 64, 0, 0, 0, 69, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
+ 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_3d_ps.h
new file mode 100644
index 0000000000..b3589c6753
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_3d_ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc o0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mov o0.w, r0.w
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_3D[] = {
+ 68, 88, 66, 67, 238, 227, 231, 209, 25, 105, 137, 11, 175, 227, 234, 239, 250, 100, 198,
+ 187, 1, 0, 0, 0, 252, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 128, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 220, 0,
+ 0, 0, 64, 0, 0, 0, 55, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 32, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
+ 0, 58, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 6, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2d_ps.h
new file mode 100644
index 0000000000..76495e70f5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2d_ps.h
@@ -0,0 +1,92 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_4444_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_4444_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_4444_2D[] = {
+ 68, 88, 66, 67, 222, 241, 125, 211, 53, 8, 171, 225, 195, 188, 22, 118, 155, 53, 136,
+ 73, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 44, 1, 0, 0, 64, 0, 0, 0, 75, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6,
+ 9, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 112, 65, 0, 0, 112, 65, 0, 0, 112, 65, 0, 0, 112, 65, 64, 0, 0, 5,
+ 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 10, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 137, 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2darray_ps.h
new file mode 100644
index 0000000000..b0e165adf3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_2darray_ps.h
@@ -0,0 +1,102 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_4444_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_4444_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_4444_2DArray[] = {
+ 68, 88, 66, 67, 248, 46, 191, 7, 4, 167, 130, 163, 93, 127, 212, 211, 47, 149, 216,
+ 24, 1, 0, 0, 0, 136, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 12, 3, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 100, 1, 0, 0, 64, 0, 0, 0, 89, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 112,
+ 65, 0, 0, 112, 65, 0, 0, 112, 65, 0, 0, 112, 65, 64, 0, 0, 5, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 137, 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 62, 0, 0,
+ 1, 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_3d_ps.h
new file mode 100644
index 0000000000..a1b7ed0036
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_4444_3d_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_4444_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_4444_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_4444_3D[] = {
+ 68, 88, 66, 67, 234, 154, 253, 59, 138, 126, 10, 67, 101, 219, 116, 42, 69, 129, 73,
+ 147, 1, 0, 0, 0, 76, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 208, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 44, 1,
+ 0, 0, 64, 0, 0, 0, 75, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 112, 65, 0, 0,
+ 112, 65, 0, 0, 112, 65, 0, 0, 112, 65, 64, 0, 0, 5, 242, 0, 16, 0, 0,
+ 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 137, 136, 136,
+ 61, 137, 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2d_ps.h
new file mode 100644
index 0000000000..1fc84161bf
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2d_ps.h
@@ -0,0 +1,92 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_5551_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_5551_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_5551_2D[] = {
+ 68, 88, 66, 67, 244, 247, 148, 118, 3, 30, 60, 3, 4, 193, 209, 178, 87, 185, 179,
+ 75, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 44, 1, 0, 0, 64, 0, 0, 0, 75, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6,
+ 9, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 248, 65, 0, 0, 248, 65, 0, 0, 248, 65, 0, 0, 128, 63, 64, 0, 0, 5,
+ 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 10, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 8, 33, 4, 61, 8, 33, 4, 61, 8, 33, 4, 61, 0, 0, 128, 63, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2darray_ps.h
new file mode 100644
index 0000000000..b98fd23975
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_2darray_ps.h
@@ -0,0 +1,102 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_5551_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_5551_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_5551_2DArray[] = {
+ 68, 88, 66, 67, 196, 233, 27, 136, 227, 152, 84, 237, 85, 28, 205, 241, 162, 112, 239,
+ 139, 1, 0, 0, 0, 136, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 12, 3, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 100, 1, 0, 0, 64, 0, 0, 0, 89, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248,
+ 65, 0, 0, 248, 65, 0, 0, 248, 65, 0, 0, 128, 63, 64, 0, 0, 5, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 8, 33, 4, 61, 8, 33, 4, 61, 8, 33, 4, 61, 0, 0, 128, 63, 62, 0, 0,
+ 1, 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_3d_ps.h
new file mode 100644
index 0000000000..235f5d7d62
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftof_um_rgba_5551_3d_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoF_UM_RGBA_5551_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftof_um_rgba_5551_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoF_UM_RGBA_5551_3D[] = {
+ 68, 88, 66, 67, 11, 156, 219, 201, 154, 211, 248, 190, 164, 107, 120, 89, 222, 49, 246,
+ 208, 1, 0, 0, 0, 76, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 208, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 44, 1,
+ 0, 0, 64, 0, 0, 0, 75, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0,
+ 248, 65, 0, 0, 248, 65, 0, 0, 128, 63, 64, 0, 0, 5, 242, 0, 16, 0, 0,
+ 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4,
+ 61, 8, 33, 4, 61, 8, 33, 4, 61, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_2darray_ps.h
new file mode 100644
index 0000000000..d04d8044e0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_2darray_ps.h
@@ -0,0 +1,98 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PM_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pm_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(127.000000, 127.000000, 127.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+ftoi o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PM_RGB_2DArray[] = {
+ 68, 88, 66, 67, 178, 234, 183, 182, 127, 41, 43, 30, 160, 66, 5, 227, 47, 30, 115,
+ 214, 1, 0, 0, 0, 72, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 204, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 36, 1, 0, 0, 64, 0, 0, 0, 73, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0,
+ 254, 66, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
+ 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_3d_ps.h
new file mode 100644
index 0000000000..4b51b2ac46
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgb_3d_ps.h
@@ -0,0 +1,92 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PM_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pm_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(127.000000, 127.000000, 127.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+ftoi o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PM_RGB_3D[] = {
+ 68, 88, 66, 67, 223, 210, 226, 205, 135, 197, 5, 16, 69, 92, 186, 191, 202, 155, 229,
+ 110, 1, 0, 0, 0, 12, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 144, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 236, 0,
+ 0, 0, 64, 0, 0, 0, 59, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 0,
+ 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 27, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_2darray_ps.h
new file mode 100644
index 0000000000..b2f822152c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_2darray_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PM_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pm_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(127.000000, 127.000000, 127.000000, 127.000000)
+round_ne r0.xyzw, r0.xyzw
+ftoi o0.xyzw, r0.xyzw
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PM_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 87, 131, 227, 32, 225, 230, 151, 126, 121, 211, 132, 157, 16, 12, 99,
+ 119, 1, 0, 0, 0, 52, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 184, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 16, 1, 0, 0, 64, 0, 0, 0, 68, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0,
+ 254, 66, 0, 0, 254, 66, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_3d_ps.h
new file mode 100644
index 0000000000..54bd284dea
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pm_rgba_3d_ps.h
@@ -0,0 +1,89 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PM_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pm_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(127.000000, 127.000000, 127.000000, 127.000000)
+round_ne r0.xyzw, r0.xyzw
+ftoi o0.xyzw, r0.xyzw
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PM_RGBA_3D[] = {
+ 68, 88, 66, 67, 76, 57, 132, 133, 26, 119, 131, 55, 47, 147, 155, 129, 114, 58, 103,
+ 131, 1, 0, 0, 0, 248, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 124, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 216, 0,
+ 0, 0, 64, 0, 0, 0, 54, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 0,
+ 0, 254, 66, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 27, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16,
+ 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_2darray_ps.h
new file mode 100644
index 0000000000..ff9a4fc322
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_2darray_ps.h
@@ -0,0 +1,95 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PT_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pt_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(127.000000, 127.000000, 127.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+ftoi o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PT_RGB_2DArray[] = {
+ 68, 88, 66, 67, 222, 89, 121, 207, 53, 159, 15, 135, 134, 177, 156, 255, 37, 117, 152,
+ 141, 1, 0, 0, 0, 44, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 176, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 8, 1, 0, 0, 64, 0, 0, 0, 66, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 0, 0, 64, 0, 0,
+ 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 27, 0,
+ 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54,
+ 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_3d_ps.h
new file mode 100644
index 0000000000..6e9b39d163
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgb_3d_ps.h
@@ -0,0 +1,89 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PT_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pt_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(127.000000, 127.000000, 127.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+ftoi o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PT_RGB_3D[] = {
+ 68, 88, 66, 67, 43, 227, 90, 159, 144, 11, 2, 191, 69, 118, 253, 191, 58, 136, 178,
+ 132, 1, 0, 0, 0, 240, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 116, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 208, 0,
+ 0, 0, 64, 0, 0, 0, 52, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254,
+ 66, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0,
+ 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 114,
+ 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0,
+ 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_2darray_ps.h
new file mode 100644
index 0000000000..93fec3090a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_2darray_ps.h
@@ -0,0 +1,93 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PT_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pt_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(127.000000, 127.000000, 127.000000, 127.000000)
+round_ne r0.xyzw, r0.xyzw
+ftoi o0.xyzw, r0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PT_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 148, 84, 9, 215, 25, 45, 131, 213, 232, 230, 51, 79, 128, 66, 45,
+ 64, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 244, 0, 0, 0, 64, 0, 0, 0, 61, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 64, 0, 0,
+ 5, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 27, 0,
+ 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_3d_ps.h
new file mode 100644
index 0000000000..8618026fc5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_pt_rgba_3d_ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_PT_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_pt_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(127.000000, 127.000000, 127.000000, 127.000000)
+round_ne r0.xyzw, r0.xyzw
+ftoi o0.xyzw, r0.xyzw
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_PT_RGBA_3D[] = {
+ 68, 88, 66, 67, 32, 58, 93, 84, 232, 52, 147, 45, 185, 44, 249, 218, 171, 114, 58,
+ 216, 1, 0, 0, 0, 220, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 96, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 188, 0,
+ 0, 0, 64, 0, 0, 0, 47, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254,
+ 66, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 64, 0, 0, 5, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_2darray_ps.h
new file mode 100644
index 0000000000..b9ffff95c3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_2darray_ps.h
@@ -0,0 +1,103 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_UM_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_um_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(127.000000, 127.000000, 127.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+ftoi o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_UM_RGB_2DArray[] = {
+ 68, 88, 66, 67, 255, 151, 44, 91, 195, 98, 212, 246, 231, 76, 145, 99, 52, 104, 88,
+ 255, 1, 0, 0, 0, 136, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 12, 3, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 100, 1, 0, 0, 64, 0, 0, 0, 89, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254,
+ 66, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0,
+ 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 114,
+ 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0,
+ 1, 83, 84, 65, 84, 116, 0, 0, 0, 11, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_3d_ps.h
new file mode 100644
index 0000000000..30c03e1d16
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgb_3d_ps.h
@@ -0,0 +1,97 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_UM_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_um_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(127.000000, 127.000000, 127.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+ftoi o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_UM_RGB_3D[] = {
+ 68, 88, 66, 67, 228, 27, 253, 8, 117, 139, 69, 193, 51, 55, 44, 74, 19, 61, 157,
+ 116, 1, 0, 0, 0, 76, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 208, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 44, 1,
+ 0, 0, 64, 0, 0, 0, 75, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254, 66, 0, 0,
+ 254, 66, 0, 0, 254, 66, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 114, 32, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16,
+ 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_2darray_ps.h
new file mode 100644
index 0000000000..a4f4b862da
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_2darray_ps.h
@@ -0,0 +1,101 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_UM_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_um_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(127.000000, 127.000000, 127.000000, 127.000000)
+round_ne r0.xyzw, r0.xyzw
+ftoi o0.xyzw, r0.xyzw
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_UM_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 18, 73, 236, 141, 229, 245, 37, 44, 233, 175, 83, 206, 219, 9, 226,
+ 133, 1, 0, 0, 0, 116, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 248, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 80, 1, 0, 0, 64, 0, 0, 0, 84, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254,
+ 66, 0, 0, 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 64, 0, 0, 5, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_3d_ps.h
new file mode 100644
index 0000000000..2d31e31274
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftoi_um_rgba_3d_ps.h
@@ -0,0 +1,95 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoI_UM_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftoi_um_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(127.000000, 127.000000, 127.000000, 127.000000)
+round_ne r0.xyzw, r0.xyzw
+ftoi o0.xyzw, r0.xyzw
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoI_UM_RGBA_3D[] = {
+ 68, 88, 66, 67, 242, 33, 254, 63, 245, 177, 165, 63, 135, 115, 166, 217, 149, 184, 138,
+ 167, 1, 0, 0, 0, 56, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 188, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 24, 1,
+ 0, 0, 64, 0, 0, 0, 70, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 254, 66, 0, 0,
+ 254, 66, 0, 0, 254, 66, 0, 0, 254, 66, 64, 0, 0, 5, 242, 0, 16, 0, 0,
+ 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 27, 0, 0, 5, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2d_ps.h
new file mode 100644
index 0000000000..6bbafe83e9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2d_ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PM_RGB_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pm_rgb_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PM_RGB_2D[] = {
+ 68, 88, 66, 67, 20, 77, 110, 129, 29, 108, 27, 35, 238, 173, 7, 238, 54, 53, 120,
+ 204, 1, 0, 0, 0, 196, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 72, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 216, 0, 0, 0, 64, 0, 0, 0, 54, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0, 127, 67,
+ 0, 0, 127, 67, 0, 0, 0, 0, 28, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116,
+ 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2darray_ps.h
new file mode 100644
index 0000000000..decebddf06
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_2darray_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PM_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pm_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PM_RGB_2DArray[] = {
+ 68, 88, 66, 67, 54, 224, 65, 196, 66, 244, 119, 251, 192, 102, 250, 25, 134, 201, 171,
+ 166, 1, 0, 0, 0, 52, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 184, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 16, 1, 0, 0, 64, 0, 0, 0, 68, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0,
+ 127, 67, 0, 0, 0, 0, 28, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_3d_ps.h
new file mode 100644
index 0000000000..0480272a1d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgb_3d_ps.h
@@ -0,0 +1,89 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PM_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pm_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PM_RGB_3D[] = {
+ 68, 88, 66, 67, 20, 187, 213, 234, 155, 214, 102, 203, 113, 47, 28, 231, 206, 171, 185,
+ 96, 1, 0, 0, 0, 248, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 124, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 216, 0,
+ 0, 0, 64, 0, 0, 0, 54, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0,
+ 0, 0, 0, 28, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2d_ps.h
new file mode 100644
index 0000000000..eecab30929
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2d_ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PM_RGBA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pm_rgba_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PM_RGBA_2D[] = {
+ 68, 88, 66, 67, 93, 192, 148, 235, 21, 122, 15, 156, 33, 238, 227, 9, 210, 97, 80,
+ 205, 1, 0, 0, 0, 176, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 52, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 196, 0, 0, 0, 64, 0, 0, 0, 49, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 7, 114, 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0, 127, 67,
+ 0, 0, 127, 67, 0, 0, 127, 67, 28, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2darray_ps.h
new file mode 100644
index 0000000000..f96c032a1c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_2darray_ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PM_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pm_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PM_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 42, 244, 142, 225, 76, 161, 113, 194, 50, 71, 173, 250, 202, 155, 165,
+ 106, 1, 0, 0, 0, 32, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 164, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 252, 0, 0, 0, 64, 0, 0, 0, 63, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114,
+ 0, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0,
+ 127, 67, 0, 0, 127, 67, 28, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_3d_ps.h
new file mode 100644
index 0000000000..47204f6dde
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pm_rgba_3d_ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PM_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pm_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.wwww, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PM_RGBA_3D[] = {
+ 68, 88, 66, 67, 5, 232, 61, 27, 145, 8, 233, 211, 47, 61, 219, 94, 35, 252, 253,
+ 81, 1, 0, 0, 0, 228, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 104, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 196, 0,
+ 0, 0, 64, 0, 0, 0, 49, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0,
+ 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0,
+ 0, 127, 67, 28, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2d_ps.h
new file mode 100644
index 0000000000..b032b9b44f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2d_ps.h
@@ -0,0 +1,83 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PT_RGB_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pt_rgb_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PT_RGB_2D[] = {
+ 68, 88, 66, 67, 239, 19, 57, 191, 36, 138, 64, 19, 35, 8, 170, 114, 160, 146, 147,
+ 152, 1, 0, 0, 0, 168, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 44, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 188, 0, 0, 0, 64, 0, 0, 0, 47, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 0, 0, 28,
+ 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0,
+ 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2darray_ps.h
new file mode 100644
index 0000000000..11e56cb60e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_2darray_ps.h
@@ -0,0 +1,93 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PT_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pt_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PT_RGB_2DArray[] = {
+ 68, 88, 66, 67, 138, 251, 49, 113, 99, 115, 227, 181, 77, 108, 206, 221, 48, 181, 111,
+ 115, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 244, 0, 0, 0, 64, 0, 0, 0, 61, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 0, 0, 28, 0, 0,
+ 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0,
+ 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_3d_ps.h
new file mode 100644
index 0000000000..b6c37cba04
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgb_3d_ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PT_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pt_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PT_RGB_3D[] = {
+ 68, 88, 66, 67, 230, 86, 10, 151, 92, 97, 109, 198, 34, 46, 73, 109, 246, 243, 56,
+ 31, 1, 0, 0, 0, 220, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 96, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 188, 0,
+ 0, 0, 64, 0, 0, 0, 47, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127,
+ 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 0, 0, 28, 0, 0, 5, 114, 32,
+ 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130,
+ 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2d_ps.h
new file mode 100644
index 0000000000..d5638576e8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2d_ps.h
@@ -0,0 +1,81 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PT_RGBA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pt_rgba_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PT_RGBA_2D[] = {
+ 68, 88, 66, 67, 220, 98, 155, 50, 254, 144, 222, 163, 64, 196, 167, 225, 13, 4, 27,
+ 185, 1, 0, 0, 0, 148, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 24, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 168, 0, 0, 0, 64, 0, 0, 0, 42, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0,
+ 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 28,
+ 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2darray_ps.h
new file mode 100644
index 0000000000..519a857a4c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_2darray_ps.h
@@ -0,0 +1,91 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PT_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pt_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PT_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 0, 99, 216, 74, 193, 89, 188, 62, 67, 114, 133, 110, 172, 170, 220,
+ 250, 1, 0, 0, 0, 4, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 136, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 224, 0, 0, 0, 64, 0, 0, 0, 56, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 28, 0, 0,
+ 5, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_3d_ps.h
new file mode 100644
index 0000000000..ed52359a2e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_pt_rgba_3d_ps.h
@@ -0,0 +1,85 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_PT_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_pt_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_PT_RGBA_3D[] = {
+ 68, 88, 66, 67, 140, 33, 31, 103, 96, 28, 78, 196, 234, 153, 58, 158, 176, 167, 230,
+ 238, 1, 0, 0, 0, 200, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 76, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 168, 0,
+ 0, 0, 64, 0, 0, 0, 42, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127,
+ 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 28, 0, 0, 5, 242, 32,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2d_ps.h
new file mode 100644
index 0000000000..2531db2202
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2d_ps.h
@@ -0,0 +1,91 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_UM_RGB_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_um_rgb_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_UM_RGB_2D[] = {
+ 68, 88, 66, 67, 114, 138, 59, 173, 45, 10, 93, 45, 253, 137, 191, 45, 53, 32, 34,
+ 110, 1, 0, 0, 0, 4, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 136, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 24, 1, 0, 0, 64, 0, 0, 0, 70, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6,
+ 9, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0,
+ 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 0, 0, 28, 0, 0, 5,
+ 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0,
+ 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2darray_ps.h
new file mode 100644
index 0000000000..361ceff057
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_2darray_ps.h
@@ -0,0 +1,101 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_UM_RGB_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_um_rgb_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_UM_RGB_2DArray[] = {
+ 68, 88, 66, 67, 34, 166, 61, 121, 63, 205, 72, 128, 217, 151, 52, 241, 20, 136, 182,
+ 226, 1, 0, 0, 0, 116, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 248, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 80, 1, 0, 0, 64, 0, 0, 0, 84, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127,
+ 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 0, 0, 28, 0, 0, 5, 114, 32,
+ 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130,
+ 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_3d_ps.h
new file mode 100644
index 0000000000..5eb39dd840
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgb_3d_ps.h
@@ -0,0 +1,95 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_UM_RGB_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_um_rgb_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyz, r0.xyzx, l(255.000000, 255.000000, 255.000000, 0.000000)
+ftou o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_UM_RGB_3D[] = {
+ 68, 88, 66, 67, 90, 1, 145, 37, 152, 68, 18, 98, 175, 189, 182, 166, 152, 58, 224,
+ 12, 1, 0, 0, 0, 56, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 188, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 24, 1,
+ 0, 0, 64, 0, 0, 0, 70, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0,
+ 127, 67, 0, 0, 127, 67, 0, 0, 0, 0, 28, 0, 0, 5, 114, 32, 16, 0, 0,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2d_ps.h
new file mode 100644
index 0000000000..336a8968f1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2d_ps.h
@@ -0,0 +1,89 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_UM_RGBA_2D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_um_rgba_2d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_UM_RGBA_2D[] = {
+ 68, 88, 66, 67, 168, 0, 97, 230, 108, 173, 2, 154, 44, 146, 249, 246, 158, 213, 153,
+ 180, 1, 0, 0, 0, 240, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 116, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 4, 1, 0, 0, 64, 0, 0, 0, 65, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0,
+ 7, 18, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6,
+ 9, 16, 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9,
+ 114, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16,
+ 0, 1, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 28, 0, 0, 5,
+ 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0,
+ 1, 83, 84, 65, 84, 116, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2darray_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2darray_ps.h
new file mode 100644
index 0000000000..adf8403620
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_2darray_ps.h
@@ -0,0 +1,99 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_UM_RGBA_2DArray /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_um_rgba_2darray_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_2DArray texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 2
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_UM_RGBA_2DArray[] = {
+ 68, 88, 66, 67, 222, 115, 245, 233, 95, 182, 197, 189, 41, 105, 31, 89, 140, 176, 0,
+ 87, 1, 0, 0, 0, 96, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 228, 0,
+ 0, 0, 108, 1, 0, 0, 160, 1, 0, 0, 228, 2, 0, 0, 82, 68, 69, 70, 168,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 117, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 50, 68,
+ 65, 114, 114, 97, 121, 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, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73,
+ 84, 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69,
+ 84, 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
+ 68, 82, 60, 1, 0, 0, 64, 0, 0, 0, 79, 0, 0, 0, 90, 0, 0, 3, 0,
+ 96, 16, 0, 0, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0,
+ 85, 85, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 86, 0, 0, 5, 66,
+ 0, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
+ 50, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0,
+ 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18,
+ 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16,
+ 0, 0, 0, 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0,
+ 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0,
+ 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127,
+ 67, 0, 0, 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 28, 0, 0, 5, 242, 32,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_3d_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_3d_ps.h
new file mode 100644
index 0000000000..6c98014700
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/multiplyalpha_ftou_um_rgba_3d_ps.h
@@ -0,0 +1,93 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_FtoU_UM_RGBA_3D /T ps_4_0 /Fh
+// compiled\multiplyalpha_ftou_um_rgba_3d_ps.h MultiplyAlpha.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF_3D texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+lt r1.x, l(0.000000), r0.w
+div r1.yzw, r0.xxyz, r0.wwww
+movc r0.xyz, r1.xxxx, r1.yzwy, r0.xyzx
+mul r0.xyzw, r0.xyzw, l(255.000000, 255.000000, 255.000000, 255.000000)
+ftou o0.xyzw, r0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_FtoU_UM_RGBA_3D[] = {
+ 68, 88, 66, 67, 211, 213, 129, 95, 158, 84, 47, 191, 113, 114, 198, 245, 188, 65, 31,
+ 212, 1, 0, 0, 0, 36, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 224, 0,
+ 0, 0, 104, 1, 0, 0, 156, 1, 0, 0, 168, 2, 0, 0, 82, 68, 69, 70, 164,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 112, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 51, 68,
+ 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,
+ 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78,
+ 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82,
+ 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79,
+ 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 4, 1,
+ 0, 0, 64, 0, 0, 0, 65, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16,
+ 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 49, 0, 0, 7, 18, 0, 16, 0,
+ 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0,
+ 0, 14, 0, 0, 7, 226, 0, 16, 0, 1, 0, 0, 0, 6, 9, 16, 0, 0, 0,
+ 0, 0, 246, 15, 16, 0, 0, 0, 0, 0, 55, 0, 0, 9, 114, 0, 16, 0, 0,
+ 0, 0, 0, 6, 0, 16, 0, 1, 0, 0, 0, 150, 7, 16, 0, 1, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 127, 67, 0, 0,
+ 127, 67, 0, 0, 127, 67, 0, 0, 127, 67, 28, 0, 0, 5, 242, 32, 16, 0, 0,
+ 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h
new file mode 100644
index 0000000000..36e6dddd2d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E VS_Passthrough2D /T vs_4_0_level_9_3 /Fh
+// compiled\passthrough2d11vs.h Passthrough2D11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION 0 xy 0 NONE float xy
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Runtime generated constant mappings:
+//
+// Target Reg Constant Description
+// ---------- --------------------------------------------------
+// c0 Vertex Shader position offset
+//
+//
+// Level9 shader bytecode:
+//
+ vs_2_x
+ def c1, 0, 1, 0, 0
+ dcl_texcoord v0
+ dcl_texcoord1 v1
+ add oPos.xy, v0, c0
+ mov oPos.zw, c1.xyxy
+ mov oT0.xy, v1
+
+// approximately 3 instruction slots used
+vs_4_0
+dcl_input v0.xy
+dcl_input v1.xy
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xy
+mov o0.xy, v0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+mov o1.xy, v1.xyxx
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_Passthrough2D[] = {
+ 68, 88, 66, 67, 156, 85, 202, 210, 211, 104, 132, 208, 180, 71, 55, 89, 176, 127, 12,
+ 190, 1, 0, 0, 0, 216, 2, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 200, 0,
+ 0, 0, 88, 1, 0, 0, 212, 1, 0, 0, 44, 2, 0, 0, 128, 2, 0, 0, 65,
+ 111, 110, 57, 136, 0, 0, 0, 136, 0, 0, 0, 0, 2, 254, 255, 96, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36, 0, 0, 0, 36,
+ 0, 1, 0, 36, 0, 0, 0, 0, 0, 1, 2, 254, 255, 81, 0, 0, 5, 1, 0,
+ 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 31,
+ 0, 0, 2, 5, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 5, 0, 1, 128,
+ 1, 0, 15, 144, 2, 0, 0, 3, 0, 0, 3, 192, 0, 0, 228, 144, 0, 0, 228,
+ 160, 1, 0, 0, 2, 0, 0, 12, 192, 1, 0, 68, 160, 1, 0, 0, 2, 0, 0,
+ 3, 224, 1, 0, 228, 144, 255, 255, 0, 0, 83, 72, 68, 82, 136, 0, 0, 0, 64,
+ 0, 1, 0, 34, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, 0, 0, 0, 0,
+ 95, 0, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 103, 0, 0, 4, 242, 32, 16,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 101, 0, 0, 3, 50, 32, 16, 0, 1, 0,
+ 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 0,
+ 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 54, 0, 0,
+ 5, 50, 32, 16, 0, 1, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 68, 69, 70, 80, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 4,
+ 254, 255, 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116,
+ 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111,
+ 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49,
+ 49, 0, 171, 171, 171, 73, 83, 71, 78, 76, 0, 0, 0, 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 3, 3, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 80, 79, 83, 73, 84, 73, 79,
+ 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 79, 83, 71, 78, 80, 0,
+ 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 12, 0,
+ 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h
new file mode 100644
index 0000000000..b25aa0e85e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h
@@ -0,0 +1,95 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E GS_Passthrough3D /T gs_4_0 /Fh compiled\passthrough3d11gs.h
+// Passthrough3D11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// LAYER 0 x 1 NONE uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+gs_4_0
+dcl_input_siv v[3][0].xyzw, position
+dcl_input v[3][1].x
+dcl_input v[3][2].xyz
+dcl_temps 1
+dcl_inputprimitive triangle
+dcl_outputtopology trianglestrip
+dcl_output_siv o0.xyzw, position
+dcl_output_siv o1.x, rendertarget_array_index
+dcl_output o2.xyz
+dcl_maxout 3
+mov r0.x, l(0)
+loop
+ ige r0.y, r0.x, l(3)
+ breakc_nz r0.y
+ mov o0.xyzw, v[r0.x + 0][0].xyzw
+ mov o1.x, v[r0.x + 0][1].x
+ mov o2.xyz, v[r0.x + 0][2].xyzx
+ emit
+ iadd r0.x, r0.x, l(1)
+endloop
+ret
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_GS_Passthrough3D[] = {
+ 68, 88, 66, 67, 180, 53, 93, 23, 14, 237, 172, 99, 214, 91, 125, 123, 81, 232, 165, 207,
+ 1, 0, 0, 0, 72, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 0, 0, 0,
+ 0, 1, 0, 0, 136, 1, 0, 0, 204, 2, 0, 0, 82, 68, 69, 70, 80, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 4, 83, 71,
+ 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82,
+ 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171,
+ 73, 83, 71, 78, 108, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 0, 0,
+ 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 1, 1, 0, 0, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 2, 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 76, 65, 89, 69, 82, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78,
+ 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0,
+ 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 8, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82,
+ 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 83, 72, 68, 82, 60, 1, 0, 0,
+ 64, 0, 2, 0, 79, 0, 0, 0, 97, 0, 0, 5, 242, 16, 32, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 95, 0, 0, 4, 18, 16, 32, 0, 3, 0, 0, 0,
+ 1, 0, 0, 0, 95, 0, 0, 4, 114, 16, 32, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 104, 0, 0, 2, 1, 0, 0, 0, 93, 24, 0, 1, 92, 40, 0, 1, 103, 0, 0, 4,
+ 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 103, 0, 0, 4, 18, 32, 16, 0,
+ 1, 0, 0, 0, 4, 0, 0, 0, 101, 0, 0, 3, 114, 32, 16, 0, 2, 0, 0, 0,
+ 94, 0, 0, 2, 3, 0, 0, 0, 54, 0, 0, 5, 18, 0, 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0, 0, 0, 48, 0, 0, 1, 33, 0, 0, 7, 34, 0, 16, 0,
+ 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 3, 0, 0, 0,
+ 3, 0, 4, 3, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 7, 242, 32, 16, 0,
+ 0, 0, 0, 0, 70, 30, 160, 0, 10, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32, 16, 0, 1, 0, 0, 0, 10, 16, 160, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 54, 0, 0, 7, 114, 32, 16, 0, 2, 0, 0, 0,
+ 70, 18, 160, 0, 10, 0, 16, 0, 0, 0, 0, 0, 2, 0, 0, 0, 19, 0, 0, 1,
+ 30, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 1, 0, 0, 0, 22, 0, 0, 1, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 11, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 5, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h
new file mode 100644
index 0000000000..9eb05ca683
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h
@@ -0,0 +1,79 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E VS_Passthrough3D /T vs_4_0 /Fh compiled\passthrough3d11vs.h
+// Passthrough3D11.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION 0 xy 0 NONE float xy
+// LAYER 0 x 1 NONE uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float xyzw
+// LAYER 0 x 1 NONE uint x
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+vs_4_0
+dcl_input v0.xy
+dcl_input v1.x
+dcl_input v2.xyz
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output o2.xyz
+mov o0.xy, v0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+mov o1.x, v1.x
+mov o2.xyz, v2.xyzx
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_VS_Passthrough3D[] = {
+ 68, 88, 66, 67, 9, 205, 109, 150, 157, 96, 223, 251, 107, 10, 208, 179, 211, 20, 141,
+ 130, 1, 0, 0, 0, 168, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 0,
+ 0, 0, 252, 0, 0, 0, 112, 1, 0, 0, 44, 2, 0, 0, 82, 68, 69, 70, 80,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 254, 255, 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111,
+ 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51,
+ 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0,
+ 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 3, 3, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 95, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7, 0, 0,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 76, 65, 89, 69, 82, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 79, 83, 71, 78, 108, 0, 0, 0, 3, 0, 0, 0, 8, 0,
+ 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0, 98, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 8, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 76, 65, 89, 69, 82, 0, 84, 69, 88,
+ 67, 79, 79, 82, 68, 0, 171, 83, 72, 68, 82, 180, 0, 0, 0, 64, 0, 1, 0,
+ 45, 0, 0, 0, 95, 0, 0, 3, 50, 16, 16, 0, 0, 0, 0, 0, 95, 0, 0,
+ 3, 18, 16, 16, 0, 1, 0, 0, 0, 95, 0, 0, 3, 114, 16, 16, 0, 2, 0,
+ 0, 0, 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 101,
+ 0, 0, 3, 18, 32, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 114, 32, 16, 0,
+ 2, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0, 70, 16, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 54,
+ 0, 0, 5, 18, 32, 16, 0, 1, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0,
+ 54, 0, 0, 5, 114, 32, 16, 0, 2, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0,
+ 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 5, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrougha2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrougha2d11ps.h
new file mode 100644
index 0000000000..267e759e84
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrougha2d11ps.h
@@ -0,0 +1,108 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughA2D /T ps_4_0_level_9_3 /Fh
+// compiled\passthrougha2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 0, 1, 0, 0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mul r0, r0.w, c0.xxxy
+ mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.w, r0.w
+mov o0.xyz, l(0,0,0,0)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughA2D[] = {
+ 68, 88, 66, 67, 17, 105, 185, 134, 195, 189, 174, 192, 122, 0, 85, 229, 126, 190, 30,
+ 125, 1, 0, 0, 0, 36, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 204, 0,
+ 0, 0, 116, 1, 0, 0, 240, 1, 0, 0, 152, 2, 0, 0, 240, 2, 0, 0, 65,
+ 111, 110, 57, 140, 0, 0, 0, 140, 0, 0, 0, 0, 2, 255, 255, 100, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 5, 0, 0, 3, 0, 0, 15, 128, 0, 0, 255, 128, 0, 0, 64, 160, 1, 0,
+ 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0, 83, 72, 68, 82, 160,
+ 0, 0, 0, 64, 0, 0, 0, 40, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0,
+ 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0,
+ 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16,
+ 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 114, 32,
+ 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 82, 68, 69, 70, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0,
+ 92, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1,
+ 0, 0, 0, 13, 0, 0, 0, 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116,
+ 117, 114, 101, 70, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73,
+ 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0,
+ 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84,
+ 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h
new file mode 100644
index 0000000000..16bfaa7b43
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h
@@ -0,0 +1,78 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughDepth2D /T ps_4_0 /Fh
+// compiled\passthroughdepth2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_DEPTH 0 N/A oDepth DEPTH float YES
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output oDepth
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov oDepth, r0.x
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughDepth2D[] = {
+ 68, 88, 66, 67, 18, 100, 210, 152, 138, 132, 5, 51, 93, 169, 189, 245, 32, 164, 14,
+ 233, 1, 0, 0, 0, 100, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 232, 1, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0,
+ 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83,
+ 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255,
+ 255, 255, 1, 14, 0, 0, 83, 86, 95, 68, 69, 80, 84, 72, 0, 171, 171, 171, 83,
+ 72, 68, 82, 120, 0, 0, 0, 64, 0, 0, 0, 30, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 2, 1, 192, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 4, 1, 192, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h
new file mode 100644
index 0000000000..72a111bf2c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h
@@ -0,0 +1,107 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughLum2D /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughlum2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 1, 0, 0, 0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mad r0, r0.x, c0.xxxy, c0.yyyx
+ mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xyz, r0.xxxx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLum2D[] = {
+ 68, 88, 66, 67, 188, 225, 249, 227, 93, 195, 221, 6, 89, 16, 237, 173, 184, 245, 118,
+ 123, 1, 0, 0, 0, 28, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 208, 0,
+ 0, 0, 108, 1, 0, 0, 232, 1, 0, 0, 144, 2, 0, 0, 232, 2, 0, 0, 65,
+ 111, 110, 57, 144, 0, 0, 0, 144, 0, 0, 0, 0, 2, 255, 255, 104, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 4, 0, 0, 4, 0, 0, 15, 128, 0, 0, 0, 128, 0, 0, 64, 160, 0, 0,
+ 21, 160, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0, 83,
+ 72, 68, 82, 148, 0, 0, 0, 64, 0, 0, 0, 37, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0,
+ 5, 114, 32, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 54, 0,
+ 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 68, 69, 70, 160, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0, 0,
+ 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, 83,
+ 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2,
+ 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0,
+ 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2darray11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2darray11ps.h
new file mode 100644
index 0000000000..916d9d001a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2darray11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughLum2DArray /T ps_4_0 /Fh
+// compiled\passthroughlum2darray11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xxxx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLum2DArray[] = {
+ 68, 88, 66, 67, 48, 31, 236, 162, 56, 23, 109, 114, 250, 90, 80, 100, 160, 102, 228,
+ 252, 1, 0, 0, 0, 232, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 108, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 204, 0, 0, 0, 64, 0,
+ 0, 0, 51, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 6,
+ 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h
new file mode 100644
index 0000000000..1c307d4096
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughLum3D /T ps_4_0 /Fh
+// compiled\passthroughlum3d11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xxxx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLum3D[] = {
+ 68, 88, 66, 67, 189, 19, 141, 227, 229, 153, 47, 229, 108, 56, 120, 27, 139, 44, 214,
+ 101, 1, 0, 0, 0, 176, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 52, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 148, 0, 0, 0, 64, 0,
+ 0, 0, 37, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0,
+ 6, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h
new file mode 100644
index 0000000000..58771dd1fd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h
@@ -0,0 +1,103 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughLumAlpha2D /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughlumalpha2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mov r0, r0.xxxw
+ mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xyzw, r0.xxxw
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLumAlpha2D[] = {
+ 68, 88, 66, 67, 123, 243, 206, 171, 140, 47, 129, 32, 9, 64, 73, 124, 19, 131, 17,
+ 168, 1, 0, 0, 0, 232, 2, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 176, 0,
+ 0, 0, 56, 1, 0, 0, 180, 1, 0, 0, 92, 2, 0, 0, 180, 2, 0, 0, 65,
+ 111, 110, 57, 112, 0, 0, 0, 112, 0, 0, 0, 0, 2, 255, 255, 72, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 31, 0, 0, 2, 0, 0,
+ 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144, 0, 8, 15, 160, 66,
+ 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228, 160, 1, 0, 0, 2,
+ 0, 0, 15, 128, 0, 0, 192, 128, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228,
+ 128, 255, 255, 0, 0, 83, 72, 68, 82, 128, 0, 0, 0, 64, 0, 0, 0, 32, 0,
+ 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0,
+ 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
+ 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16,
+ 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0,
+ 0, 0, 0, 54, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 6, 12, 16, 0,
+ 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 3, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
+ 68, 69, 70, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5,
+ 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0,
+ 13, 0, 0, 0, 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101,
+ 70, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57,
+ 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78,
+ 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3,
+ 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67,
+ 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0,
+ 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84,
+ 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2darray11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2darray11ps.h
new file mode 100644
index 0000000000..9fe93edb48
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2darray11ps.h
@@ -0,0 +1,88 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughLumAlpha2DArray /T ps_4_0 /Fh
+// compiled\passthroughlumalpha2darray11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov o0.xyzw, r0.xxxw
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLumAlpha2DArray[] = {
+ 68, 88, 66, 67, 171, 126, 222, 213, 133, 151, 3, 160, 237, 58, 39, 228, 228, 109, 48,
+ 150, 1, 0, 0, 0, 212, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 88, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 184, 0, 0, 0, 64, 0,
+ 0, 0, 46, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0, 6,
+ 12, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h
new file mode 100644
index 0000000000..adb47fe1ad
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h
@@ -0,0 +1,82 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughLumAlpha3D /T ps_4_0 /Fh
+// compiled\passthroughlumalpha3d11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyzw, r0.xxxw
+ret
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLumAlpha3D[] = {
+ 68, 88, 66, 67, 191, 137, 201, 175, 2, 158, 150, 52, 202, 186, 67, 28, 235, 67, 228,
+ 244, 1, 0, 0, 0, 156, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 32, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 128, 0, 0, 0, 64, 0,
+ 0, 0, 32, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 242, 32, 16, 0, 0, 0, 0, 0,
+ 6, 12, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h
new file mode 100644
index 0000000000..b6f4e8d8d3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h
@@ -0,0 +1,108 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR2D /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughr2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 1, 0, 0, 0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mad r0, r0.x, c0.xyyy, c0.yyyx
+ mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2D[] = {
+ 68, 88, 66, 67, 192, 5, 106, 26, 153, 118, 66, 122, 234, 139, 38, 125, 56, 165, 124,
+ 152, 1, 0, 0, 0, 40, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 208, 0,
+ 0, 0, 120, 1, 0, 0, 244, 1, 0, 0, 156, 2, 0, 0, 244, 2, 0, 0, 65,
+ 111, 110, 57, 144, 0, 0, 0, 144, 0, 0, 0, 0, 2, 255, 255, 104, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 4, 0, 0, 4, 0, 0, 15, 128, 0, 0, 0, 128, 0, 0, 84, 160, 0, 0,
+ 21, 160, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0, 83,
+ 72, 68, 82, 160, 0, 0, 0, 64, 0, 0, 0, 40, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0,
+ 5, 18, 32, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0,
+ 0, 8, 226, 32, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 82, 68, 69, 70, 160, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 100, 0,
+ 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0,
+ 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, 83, 97, 109, 112, 108, 101, 114, 0,
+ 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32,
+ 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49,
+ 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73,
+ 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darray11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darray11ps.h
new file mode 100644
index 0000000000..cac7073482
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darray11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR2DArray /T ps_4_0 /Fh
+// compiled\passthroughr2darray11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DArray[] = {
+ 68, 88, 66, 67, 153, 98, 1, 143, 57, 155, 108, 8, 63, 182, 136, 234, 41, 243, 201,
+ 84, 1, 0, 0, 0, 244, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 120, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 216, 0, 0, 0, 64, 0,
+ 0, 0, 54, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0, 0, 10,
+ 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
+ 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayi11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayi11ps.h
new file mode 100644
index 0000000000..a540a840c1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayi11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR2DArrayI /T ps_4_0 /Fh
+// compiled\passthroughr2darrayi11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (sint,sint,sint,sint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DArrayI[] = {
+ 68, 88, 66, 67, 190, 14, 213, 255, 85, 29, 217, 11, 43, 5, 110, 54, 55, 146, 149,
+ 98, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 36, 1, 0, 0, 64, 0, 0, 0,
+ 73, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0, 0, 10, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayui11ps.h
new file mode 100644
index 0000000000..6cc2b5635e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2darrayui11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR2DArrayUI /T ps_4_0 /Fh
+// compiled\passthroughr2darrayui11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (uint,uint,uint,uint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DArrayUI[] = {
+ 68, 88, 66, 67, 97, 102, 75, 216, 41, 19, 132, 193, 57, 182, 129, 168, 6, 197, 203,
+ 131, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 36, 1, 0, 0, 64, 0, 0, 0,
+ 73, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0, 0, 10, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h
new file mode 100644
index 0000000000..aa8baec1e4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR2DI /T ps_4_0 /Fh
+// compiled\passthroughr2di11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DI[] = {
+ 68, 88, 66, 67, 84, 64, 112, 93, 36, 186, 166, 75, 161, 187, 231, 211, 189, 98, 8,
+ 233, 1, 0, 0, 0, 208, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 84, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 12, 1, 0, 0, 64, 0, 0, 0, 67, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 51, 51, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h
new file mode 100644
index 0000000000..513fe48395
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR2DUI /T ps_4_0 /Fh
+// compiled\passthroughr2dui11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DUI[] = {
+ 68, 88, 66, 67, 55, 128, 134, 94, 118, 7, 10, 194, 208, 15, 238, 95, 29, 18, 60,
+ 168, 1, 0, 0, 0, 208, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 84, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 12, 1, 0, 0, 64, 0, 0, 0, 67, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 68, 68, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h
new file mode 100644
index 0000000000..54d4060674
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR3D /T ps_4_0 /Fh
+// compiled\passthroughr3d11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3D[] = {
+ 68, 88, 66, 67, 163, 108, 19, 168, 114, 56, 140, 241, 17, 131, 30, 212, 85, 209, 92,
+ 73, 1, 0, 0, 0, 188, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 64, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 160, 0, 0, 0, 64, 0,
+ 0, 0, 40, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0, 0,
+ 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h
new file mode 100644
index 0000000000..3150d79868
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR3DI /T ps_4_0 /Fh
+// compiled\passthroughr3di11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3DI[] = {
+ 68, 88, 66, 67, 127, 168, 81, 164, 11, 136, 38, 235, 9, 101, 192, 215, 64, 24, 167,
+ 101, 1, 0, 0, 0, 244, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 120, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 0, 1, 0, 0, 64, 0, 0, 0,
+ 64, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0, 0, 10,
+ 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h
new file mode 100644
index 0000000000..3db3809bc4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughR3DUI /T ps_4_0 /Fh
+// compiled\passthroughr3dui11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3DUI[] = {
+ 68, 88, 66, 67, 181, 211, 48, 255, 138, 94, 31, 252, 44, 254, 92, 188, 78, 15, 80,
+ 13, 1, 0, 0, 0, 244, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 120, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 0, 1, 0, 0, 64, 0, 0, 0,
+ 64, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0, 0, 10,
+ 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 226, 32, 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h
new file mode 100644
index 0000000000..63024de2ec
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h
@@ -0,0 +1,108 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG2D /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughrg2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 1, 0, 0, 0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mad r0, r0.xyxx, c0.xxyy, c0.yyyx
+ mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2D[] = {
+ 68, 88, 66, 67, 191, 201, 107, 187, 59, 10, 97, 89, 109, 87, 18, 235, 11, 52, 192,
+ 94, 1, 0, 0, 0, 40, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 208, 0,
+ 0, 0, 120, 1, 0, 0, 244, 1, 0, 0, 156, 2, 0, 0, 244, 2, 0, 0, 65,
+ 111, 110, 57, 144, 0, 0, 0, 144, 0, 0, 0, 0, 2, 255, 255, 104, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 4, 0, 0, 4, 0, 0, 15, 128, 0, 0, 4, 128, 0, 0, 80, 160, 0, 0,
+ 21, 160, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0, 83,
+ 72, 68, 82, 160, 0, 0, 0, 64, 0, 0, 0, 40, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0,
+ 5, 50, 32, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0,
+ 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 82, 68, 69, 70, 160, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0,
+ 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 100, 0,
+ 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0,
+ 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, 83, 97, 109, 112, 108, 101, 114, 0,
+ 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32,
+ 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109,
+ 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49,
+ 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0,
+ 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73,
+ 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darray11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darray11ps.h
new file mode 100644
index 0000000000..9fd501411a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darray11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG2DArray /T ps_4_0 /Fh
+// compiled\passthroughrg2darray11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DArray[] = {
+ 68, 88, 66, 67, 113, 101, 41, 131, 63, 206, 223, 205, 209, 167, 123, 102, 201, 174, 37,
+ 186, 1, 0, 0, 0, 244, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 120, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 216, 0, 0, 0, 64, 0,
+ 0, 0, 54, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0, 70,
+ 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128,
+ 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayi11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayi11ps.h
new file mode 100644
index 0000000000..a092debfc7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayi11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG2DArrayI /T ps_4_0 /Fh
+// compiled\passthroughrg2darrayi11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (sint,sint,sint,sint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DArrayI[] = {
+ 68, 88, 66, 67, 247, 185, 135, 38, 69, 135, 207, 14, 57, 114, 126, 102, 133, 233, 225,
+ 80, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 36, 1, 0, 0, 64, 0, 0, 0,
+ 73, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayui11ps.h
new file mode 100644
index 0000000000..f5e0afcf6c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2darrayui11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG2DArrayUI /T ps_4_0 /Fh
+// compiled\passthroughrg2darrayui11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (uint,uint,uint,uint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DArrayUI[] = {
+ 68, 88, 66, 67, 63, 58, 182, 113, 143, 129, 92, 4, 182, 79, 59, 171, 155, 95, 217,
+ 111, 1, 0, 0, 0, 24, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 156, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 36, 1, 0, 0, 64, 0, 0, 0,
+ 73, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h
new file mode 100644
index 0000000000..e2f98d98e8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG2DI /T ps_4_0 /Fh
+// compiled\passthroughrg2di11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DI[] = {
+ 68, 88, 66, 67, 154, 63, 188, 122, 50, 211, 44, 194, 175, 193, 7, 1, 234, 178, 251,
+ 83, 1, 0, 0, 0, 208, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 84, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 12, 1, 0, 0, 64, 0, 0, 0, 67, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 51, 51, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0,
+ 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h
new file mode 100644
index 0000000000..4b0e4ce31e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG2DUI /T ps_4_0 /Fh
+// compiled\passthroughrg2dui11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DUI[] = {
+ 68, 88, 66, 67, 144, 43, 208, 108, 186, 143, 89, 184, 35, 31, 116, 8, 149, 47, 23,
+ 40, 1, 0, 0, 0, 208, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 84, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 12, 1, 0, 0, 64, 0, 0, 0, 67, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 68, 68, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0,
+ 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h
new file mode 100644
index 0000000000..9510edcfb9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG3D /T ps_4_0 /Fh
+// compiled\passthroughrg3d11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3D[] = {
+ 68, 88, 66, 67, 229, 144, 152, 160, 204, 175, 158, 188, 47, 45, 65, 251, 42, 224, 182,
+ 55, 1, 0, 0, 0, 188, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 64, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 160, 0, 0, 0, 64, 0,
+ 0, 0, 40, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0,
+ 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0,
+ 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h
new file mode 100644
index 0000000000..daa39a86f5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG3DI /T ps_4_0 /Fh
+// compiled\passthroughrg3di11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3DI[] = {
+ 68, 88, 66, 67, 185, 213, 244, 108, 113, 189, 253, 145, 131, 2, 68, 116, 163, 196, 223,
+ 94, 1, 0, 0, 0, 244, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 120, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 0, 1, 0, 0, 64, 0, 0, 0,
+ 64, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0, 70,
+ 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h
new file mode 100644
index 0000000000..cf62b2e0b6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRG3DUI /T ps_4_0 /Fh
+// compiled\passthroughrg3dui11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3DUI[] = {
+ 68, 88, 66, 67, 96, 192, 36, 178, 243, 86, 188, 32, 61, 242, 109, 248, 60, 242, 238,
+ 185, 1, 0, 0, 0, 244, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 120, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 0, 1, 0, 0, 64, 0, 0, 0,
+ 64, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 50, 32, 16, 0, 0, 0, 0, 0, 70,
+ 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0,
+ 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h
new file mode 100644
index 0000000000..ea3c4ae1df
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h
@@ -0,0 +1,107 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2D /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughrgb2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 1, 0, 0, 0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mad r0, r0.xyzx, c0.xxxy, c0.yyyx
+ mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2D[] = {
+ 68, 88, 66, 67, 85, 126, 250, 196, 188, 16, 162, 84, 25, 241, 221, 195, 112, 236, 199,
+ 254, 1, 0, 0, 0, 28, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 208, 0,
+ 0, 0, 108, 1, 0, 0, 232, 1, 0, 0, 144, 2, 0, 0, 232, 2, 0, 0, 65,
+ 111, 110, 57, 144, 0, 0, 0, 144, 0, 0, 0, 0, 2, 255, 255, 104, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 4, 0, 0, 4, 0, 0, 15, 128, 0, 0, 36, 128, 0, 0, 64, 160, 0, 0,
+ 21, 160, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0, 83,
+ 72, 68, 82, 148, 0, 0, 0, 64, 0, 0, 0, 37, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 69,
+ 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0,
+ 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0,
+ 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 68, 69, 70, 160, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0, 0,
+ 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0,
+ 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, 83,
+ 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2,
+ 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86,
+ 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0,
+ 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d_565_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d_565_11ps.h
new file mode 100644
index 0000000000..f0dfd44034
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d_565_11ps.h
@@ -0,0 +1,123 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2D_565 /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughrgb2d_565_11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 31, 63, 0.5, 1
+ def c1, 0.0322580636, 0.0158730168, 0, 0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mad r0.xyz, r0, c0.xyxw, c0.z
+ frc r1.xyz, r0
+ add r0.xyz, r0, -r1
+ mul r0.xyz, r0, c1.xyxw
+ mov r0.w, c0.w
+ mov oC0, r0
+
+// approximately 7 instruction slots used (1 texture, 6 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2D_565[] = {
+ 68, 88, 66, 67, 67, 66, 55, 172, 133, 227, 110, 204, 193, 171, 136, 102, 65, 233, 15,
+ 94, 1, 0, 0, 0, 188, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 32, 1,
+ 0, 0, 12, 2, 0, 0, 136, 2, 0, 0, 48, 3, 0, 0, 136, 3, 0, 0, 65,
+ 111, 110, 57, 224, 0, 0, 0, 224, 0, 0, 0, 0, 2, 255, 255, 184, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 248, 65, 0, 0, 124, 66, 0, 0, 0, 63, 0, 0, 128, 63, 81,
+ 0, 0, 5, 1, 0, 15, 160, 8, 33, 4, 61, 33, 8, 130, 60, 0, 0, 0, 0,
+ 0, 0, 0, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0,
+ 2, 0, 0, 0, 144, 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0,
+ 228, 176, 0, 8, 228, 160, 4, 0, 0, 4, 0, 0, 7, 128, 0, 0, 228, 128, 0,
+ 0, 196, 160, 0, 0, 170, 160, 19, 0, 0, 2, 1, 0, 7, 128, 0, 0, 228, 128,
+ 2, 0, 0, 3, 0, 0, 7, 128, 0, 0, 228, 128, 1, 0, 228, 129, 5, 0, 0,
+ 3, 0, 0, 7, 128, 0, 0, 228, 128, 1, 0, 196, 160, 1, 0, 0, 2, 0, 0,
+ 8, 128, 0, 0, 255, 160, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255,
+ 255, 0, 0, 83, 72, 68, 82, 228, 0, 0, 0, 64, 0, 0, 0, 57, 0, 0, 0,
+ 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16,
+ 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1,
+ 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0,
+ 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 124, 66, 0, 0, 248, 65, 0,
+ 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0,
+ 0, 0, 0, 0, 56, 0, 0, 10, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 33, 8, 130, 60, 8, 33,
+ 4, 61, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1,
+ 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0,
+ 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 82, 68, 69, 70, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0,
+ 92, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0,
+ 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1,
+ 0, 0, 0, 13, 0, 0, 0, 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116,
+ 117, 114, 101, 70, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32,
+ 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101,
+ 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73,
+ 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0,
+ 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84,
+ 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0,
+ 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82,
+ 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray11ps.h
new file mode 100644
index 0000000000..674ecbe532
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2DArray /T ps_4_0 /Fh
+// compiled\passthroughrgb2darray11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DArray[] = {
+ 68, 88, 66, 67, 225, 163, 46, 39, 57, 32, 20, 75, 137, 40, 221, 13, 168, 142, 200,
+ 45, 1, 0, 0, 0, 232, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 108, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 204, 0, 0, 0, 64, 0,
+ 0, 0, 51, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray_565_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray_565_11ps.h
new file mode 100644
index 0000000000..4ac3484e0a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darray_565_11ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2DArray_565 /T ps_4_0 /Fh
+// compiled\passthroughrgb2darray_565_11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DArray_565[] = {
+ 68, 88, 66, 67, 154, 118, 191, 108, 144, 58, 136, 40, 31, 50, 241, 170, 80, 59, 111,
+ 122, 1, 0, 0, 0, 56, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 188, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 28, 1, 0, 0, 64, 0,
+ 0, 0, 71, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 124, 66,
+ 0, 0, 248, 65, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 32, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 33,
+ 8, 130, 60, 8, 33, 4, 61, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayi11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayi11ps.h
new file mode 100644
index 0000000000..867c9fba84
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayi11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2DArrayI /T ps_4_0 /Fh
+// compiled\passthroughrgb2darrayi11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (sint,sint,sint,sint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DArrayI[] = {
+ 68, 88, 66, 67, 203, 204, 115, 216, 122, 41, 103, 203, 207, 35, 129, 118, 254, 235, 84,
+ 148, 1, 0, 0, 0, 12, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 144, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 24, 1, 0, 0, 64, 0, 0, 0,
+ 70, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 10,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayui11ps.h
new file mode 100644
index 0000000000..af27be1fc4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2darrayui11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2DArrayUI /T ps_4_0 /Fh
+// compiled\passthroughrgb2darrayui11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (uint,uint,uint,uint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1)
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DArrayUI[] = {
+ 68, 88, 66, 67, 253, 90, 38, 58, 32, 167, 35, 29, 29, 134, 13, 19, 245, 38, 146,
+ 38, 1, 0, 0, 0, 12, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 144, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 24, 1, 0, 0, 64, 0, 0, 0,
+ 70, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0, 1, 64,
+ 0, 0, 1, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 10,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h
new file mode 100644
index 0000000000..d44e778744
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2DI /T ps_4_0 /Fh
+// compiled\passthroughrgb2di11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DI[] = {
+ 68, 88, 66, 67, 103, 48, 174, 226, 36, 218, 154, 243, 36, 109, 177, 52, 89, 59, 167,
+ 243, 1, 0, 0, 0, 196, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 72, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 0, 1, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 51, 51, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116,
+ 0, 0, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h
new file mode 100644
index 0000000000..7905f1d968
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h
@@ -0,0 +1,87 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB2DUI /T ps_4_0 /Fh
+// compiled\passthroughrgb2dui11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DUI[] = {
+ 68, 88, 66, 67, 106, 224, 213, 49, 148, 23, 134, 204, 255, 208, 89, 239, 72, 191, 144,
+ 2, 1, 0, 0, 0, 196, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 72, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 0, 1, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 68, 68, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0,
+ 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116,
+ 0, 0, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h
new file mode 100644
index 0000000000..2f35cb0dbe
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h
@@ -0,0 +1,84 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB3D /T ps_4_0 /Fh
+// compiled\passthroughrgb3d11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3D[] = {
+ 68, 88, 66, 67, 64, 144, 204, 156, 117, 84, 185, 228, 65, 179, 80, 244, 146, 54, 206,
+ 119, 1, 0, 0, 0, 176, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 52, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 148, 0, 0, 0, 64, 0,
+ 0, 0, 37, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d_565_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d_565_11ps.h
new file mode 100644
index 0000000000..29f83d91bc
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d_565_11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB3D_565 /T ps_4_0 /Fh
+// compiled\passthroughrgb3d_565_11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyz, r0.xyzx, l(31.000000, 63.000000, 31.000000, 0.000000)
+round_ne r0.xyz, r0.xyzx
+mul o0.xyz, r0.xyzx, l(0.032258, 0.015873, 0.032258, 0.000000)
+mov o0.w, l(1.000000)
+ret
+// Approximately 6 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3D_565[] = {
+ 68, 88, 66, 67, 64, 214, 210, 233, 132, 86, 85, 54, 162, 63, 180, 191, 68, 70, 147,
+ 32, 1, 0, 0, 0, 0, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 132, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 228, 0, 0, 0, 64, 0,
+ 0, 0, 57, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 0, 0, 0, 0,
+ 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 124,
+ 66, 0, 0, 248, 65, 0, 0, 0, 0, 64, 0, 0, 5, 114, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 114, 32, 16, 0, 0,
+ 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61,
+ 33, 8, 130, 60, 8, 33, 4, 61, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16,
+ 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h
new file mode 100644
index 0000000000..90fd973ad4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB3DI /T ps_4_0 /Fh
+// compiled\passthroughrgb3di11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3DI[] = {
+ 68, 88, 66, 67, 154, 56, 82, 215, 167, 57, 211, 57, 235, 39, 42, 82, 164, 188, 103,
+ 126, 1, 0, 0, 0, 232, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 108, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 244, 0, 0, 0, 64, 0, 0, 0,
+ 61, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h
new file mode 100644
index 0000000000..0192a1c8a0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h
@@ -0,0 +1,90 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGB3DUI /T ps_4_0 /Fh
+// compiled\passthroughrgb3dui11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3DUI[] = {
+ 68, 88, 66, 67, 206, 73, 153, 209, 111, 4, 107, 131, 207, 172, 41, 87, 186, 3, 238,
+ 41, 1, 0, 0, 0, 232, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 108, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 244, 0, 0, 0, 64, 0, 0, 0,
+ 61, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 114, 32, 16, 0, 0, 0, 0, 0, 70,
+ 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 32, 16, 0, 0, 0, 0, 0,
+ 1, 64, 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h
new file mode 100644
index 0000000000..fb4b2f4c37
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h
@@ -0,0 +1,98 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2D /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughrgba2d11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mov oC0, r0
+
+// approximately 2 instruction slots used (1 texture, 1 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+sample o0.xyzw, v1.xyxx, t0.xyzw, s0
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2D[] = {
+ 68, 88, 66, 67, 184, 218, 64, 10, 229, 55, 228, 76, 217, 225, 255, 57, 166, 235, 140,
+ 175, 1, 0, 0, 0, 192, 2, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 164, 0,
+ 0, 0, 16, 1, 0, 0, 140, 1, 0, 0, 52, 2, 0, 0, 140, 2, 0, 0, 65,
+ 111, 110, 57, 100, 0, 0, 0, 100, 0, 0, 0, 0, 2, 255, 255, 60, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 31, 0, 0, 2, 0, 0,
+ 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144, 0, 8, 15, 160, 66,
+ 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228, 160, 1, 0, 0, 2,
+ 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0, 83, 72, 68, 82, 100, 0, 0,
+ 0, 64, 0, 0, 0, 25, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0,
+ 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98,
+ 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0,
+ 0, 0, 0, 0, 69, 0, 0, 9, 242, 32, 16, 0, 0, 0, 0, 0, 70, 16, 16,
+ 0, 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0,
+ 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 68, 69,
+ 70, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0,
+ 0, 0, 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0,
+ 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0,
+ 0, 0, 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0,
+ 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32,
+ 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50,
+ 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0,
+ 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0,
+ 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79,
+ 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8,
+ 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171,
+ 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_4444_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_4444_11ps.h
new file mode 100644
index 0000000000..e8f4114b45
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_4444_11ps.h
@@ -0,0 +1,117 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2D_4444 /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughrgba2d_4444_11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 15, 0.5, 0.0666666701, 0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mad r0, r0, c0.x, c0.y
+ frc r1, r0
+ add r0, r0, -r1
+ mul r0, r0, c0.z
+ mov oC0, r0
+
+// approximately 6 instruction slots used (1 texture, 5 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2D_4444[] = {
+ 68, 88, 66, 67, 181, 230, 28, 163, 183, 216, 19, 26, 254, 253, 53, 255, 203, 47, 5,
+ 169, 1, 0, 0, 0, 132, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 252, 0,
+ 0, 0, 212, 1, 0, 0, 80, 2, 0, 0, 248, 2, 0, 0, 80, 3, 0, 0, 65,
+ 111, 110, 57, 188, 0, 0, 0, 188, 0, 0, 0, 0, 2, 255, 255, 148, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 112, 65, 0, 0, 0, 63, 137, 136, 136, 61, 0, 0, 0, 0, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 4, 0, 0, 4, 0, 0, 15, 128, 0, 0, 228, 128, 0, 0, 0, 160, 0, 0,
+ 85, 160, 19, 0, 0, 2, 1, 0, 15, 128, 0, 0, 228, 128, 2, 0, 0, 3, 0,
+ 0, 15, 128, 0, 0, 228, 128, 1, 0, 228, 129, 5, 0, 0, 3, 0, 0, 15, 128,
+ 0, 0, 228, 128, 0, 0, 170, 160, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228,
+ 128, 255, 255, 0, 0, 83, 72, 68, 82, 208, 0, 0, 0, 64, 0, 0, 0, 52, 0,
+ 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0,
+ 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
+ 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16,
+ 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0,
+ 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 112, 65, 0, 0, 112, 65, 0, 0, 112,
+ 65, 0, 0, 112, 65, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 137, 136, 136, 61, 137, 136, 136, 61,
+ 137, 136, 136, 61, 137, 136, 136, 61, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 82, 68, 69, 70, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0,
+ 0, 92, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2,
+ 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0, 0, 0, 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120,
+ 116, 117, 114, 101, 70, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41,
+ 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_5551_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_5551_11ps.h
new file mode 100644
index 0000000000..c0e6cfaa37
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d_5551_11ps.h
@@ -0,0 +1,117 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2D_5551 /T ps_4_0_level_9_3 /Fh
+// compiled\passthroughrgba2d_5551_11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler Source Resource
+// -------------- --------------- ----------------
+// s0 s0 t0
+//
+//
+// Level9 shader bytecode:
+//
+ ps_2_x
+ def c0, 31, 1, 0.5, 0.0322580636
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mad r0, r0, c0.xxxy, c0.z
+ frc r1, r0
+ add r0, r0, -r1
+ mul r0, r0, c0.wwwy
+ mov oC0, r0
+
+// approximately 6 instruction slots used (1 texture, 5 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2D_5551[] = {
+ 68, 88, 66, 67, 187, 10, 247, 243, 253, 108, 12, 228, 143, 154, 244, 52, 216, 197, 86,
+ 249, 1, 0, 0, 0, 132, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 252, 0,
+ 0, 0, 212, 1, 0, 0, 80, 2, 0, 0, 248, 2, 0, 0, 80, 3, 0, 0, 65,
+ 111, 110, 57, 188, 0, 0, 0, 188, 0, 0, 0, 0, 2, 255, 255, 148, 0, 0, 0,
+ 40, 0, 0, 0, 0, 0, 40, 0, 0, 0, 40, 0, 0, 0, 40, 0, 1, 0, 36,
+ 0, 0, 0, 40, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 0, 0,
+ 15, 160, 0, 0, 248, 65, 0, 0, 128, 63, 0, 0, 0, 63, 8, 33, 4, 61, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 4, 0, 0, 4, 0, 0, 15, 128, 0, 0, 228, 128, 0, 0, 64, 160, 0, 0,
+ 170, 160, 19, 0, 0, 2, 1, 0, 15, 128, 0, 0, 228, 128, 2, 0, 0, 3, 0,
+ 0, 15, 128, 0, 0, 228, 128, 1, 0, 228, 129, 5, 0, 0, 3, 0, 0, 15, 128,
+ 0, 0, 228, 128, 0, 0, 127, 160, 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228,
+ 128, 255, 255, 0, 0, 83, 72, 68, 82, 208, 0, 0, 0, 64, 0, 0, 0, 52, 0,
+ 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0,
+ 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0,
+ 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0,
+ 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70, 16,
+ 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0,
+ 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 248, 65, 0, 0, 248,
+ 65, 0, 0, 128, 63, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 8, 33, 4, 61,
+ 8, 33, 4, 61, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 82, 68, 69, 70, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 28, 0, 0, 0, 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0,
+ 0, 92, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2,
+ 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0,
+ 1, 0, 0, 0, 13, 0, 0, 0, 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120,
+ 116, 117, 114, 101, 70, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41,
+ 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108,
+ 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171,
+ 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1,
+ 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray11ps.h
new file mode 100644
index 0000000000..be556724c6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray11ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2DArray /T ps_4_0 /Fh
+// compiled\passthroughrgba2darray11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample o0.xyzw, r0.xyzx, t0.xyzw, s0
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DArray[] = {
+ 68, 88, 66, 67, 148, 154, 188, 83, 129, 94, 72, 95, 71, 120, 64, 206, 76, 52, 234,
+ 173, 1, 0, 0, 0, 192, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 68, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 164, 0, 0, 0, 64, 0,
+ 0, 0, 41, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 32, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_4444_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_4444_11ps.h
new file mode 100644
index 0000000000..7b46eb50ba
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_4444_11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2DArray_4444 /T ps_4_0 /Fh
+// compiled\passthroughrgba2darray_4444_11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DArray_4444[] = {
+ 68, 88, 66, 67, 61, 140, 14, 155, 149, 30, 84, 37, 234, 238, 138, 36, 31, 128, 78,
+ 120, 1, 0, 0, 0, 36, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 168, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 8, 1, 0, 0, 64, 0,
+ 0, 0, 66, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 112, 65, 0, 0, 112, 65,
+ 0, 0, 112, 65, 0, 0, 112, 65, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 137, 136, 136, 61, 137,
+ 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_5551_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_5551_11ps.h
new file mode 100644
index 0000000000..c7ed3eb1a1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darray_5551_11ps.h
@@ -0,0 +1,94 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2DArray_5551 /T ps_4_0 /Fh
+// compiled\passthroughrgba2darray_5551_11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DArray_5551[] = {
+ 68, 88, 66, 67, 209, 124, 27, 45, 239, 120, 103, 6, 221, 133, 157, 71, 79, 73, 236,
+ 138, 1, 0, 0, 0, 36, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 168, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 8, 1, 0, 0, 64, 0,
+ 0, 0, 66, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 100, 8, 0, 4,
+ 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0, 3, 50, 16, 16,
+ 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0,
+ 0, 2, 1, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10,
+ 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96,
+ 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 248, 65,
+ 0, 0, 248, 65, 0, 0, 128, 63, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0, 0,
+ 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61, 8,
+ 33, 4, 61, 8, 33, 4, 61, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65, 84,
+ 116, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayi11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayi11ps.h
new file mode 100644
index 0000000000..c1d45a287c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayi11ps.h
@@ -0,0 +1,89 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2DArrayI /T ps_4_0 /Fh
+// compiled\passthroughrgba2darrayi11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (sint,sint,sint,sint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DArrayI[] = {
+ 68, 88, 66, 67, 5, 189, 13, 241, 119, 156, 1, 197, 65, 203, 237, 2, 64, 152, 186,
+ 206, 1, 0, 0, 0, 228, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 104, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 240, 0, 0, 0, 64, 0, 0, 0,
+ 60, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayui11ps.h
new file mode 100644
index 0000000000..a1b050aebf
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2darrayui11ps.h
@@ -0,0 +1,89 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2DArrayUI /T ps_4_0 /Fh
+// compiled\passthroughrgba2darrayui11ps.h Passthrough2DArray11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2darray 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2darray (uint,uint,uint,uint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DArrayUI[] = {
+ 68, 88, 66, 67, 5, 138, 102, 222, 93, 168, 178, 120, 117, 240, 177, 152, 209, 17, 205,
+ 155, 1, 0, 0, 0, 228, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 104, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 240, 0, 0, 0, 64, 0, 0, 0,
+ 60, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16,
+ 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0,
+ 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0, 16,
+ 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242,
+ 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 8, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h
new file mode 100644
index 0000000000..8347f23156
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h
@@ -0,0 +1,83 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2DI /T ps_4_0 /Fh
+// compiled\passthroughrgba2di11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DI[] = {
+ 68, 88, 66, 67, 95, 246, 206, 5, 65, 242, 73, 197, 5, 64, 172, 186, 253, 27, 87,
+ 195, 1, 0, 0, 0, 156, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 32, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 216, 0, 0, 0, 64, 0, 0, 0, 54, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 51, 51, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h
new file mode 100644
index 0000000000..56d4c63d58
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dms11ps.h
@@ -0,0 +1,80 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureF_MS texture float4 2dMS 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCORD 0 xy 1 NONE float xy
+// SV_SAMPLEINDEX 0 x 2 SAMPLE uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+// Pixel Shader runs at sample frequency
+//
+ps_4_1
+dcl_globalFlags refactoringAllowed
+dcl_resource_texture2dms(0) (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_input_ps_sgv v2.x, sampleIndex
+dcl_output o0.xyzw
+dcl_temps 1
+ftou r0.xy, v1.xyxx
+mov r0.zw, l(0,0,0,0)
+ldms o0.xyzw, r0.xyzw, t0.xyzw, v2.x
+ret
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DMS[] = {
+ 68, 88, 66, 67, 24, 185, 64, 224, 216, 192, 107, 84, 140, 208, 46, 210, 75, 20, 1,
+ 202, 1, 0, 0, 0, 148, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 184, 0,
+ 0, 0, 52, 1, 0, 0, 104, 1, 0, 0, 24, 2, 0, 0, 82, 68, 69, 70, 124,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 1, 4, 255, 255, 0, 1, 0, 0, 72, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 5, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 77, 83, 0, 77,
+ 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83,
+ 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 54, 46, 51, 46,
+ 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 116, 0,
+ 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0,
+ 0, 100, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 2, 0,
+ 0, 0, 1, 1, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84,
+ 69, 88, 67, 79, 82, 68, 0, 83, 86, 95, 83, 65, 77, 80, 76, 69, 73, 78, 68,
+ 69, 88, 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0,
+ 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83,
+ 72, 68, 82, 168, 0, 0, 0, 65, 0, 0, 0, 42, 0, 0, 0, 106, 8, 0, 1,
+ 88, 32, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0,
+ 3, 50, 16, 16, 0, 1, 0, 0, 0, 99, 8, 0, 4, 18, 16, 16, 0, 2, 0,
+ 0, 0, 10, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104,
+ 0, 0, 2, 1, 0, 0, 0, 28, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0,
+ 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 46, 0, 0, 9, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0,
+ 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 2, 0, 0, 0,
+ 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h
new file mode 100644
index 0000000000..e26df78741
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h
@@ -0,0 +1,83 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA2DUI /T ps_4_0 /Fh
+// compiled\passthroughrgba2dui11ps.h Passthrough2D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 2d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DUI[] = {
+ 68, 88, 66, 67, 159, 192, 164, 129, 44, 28, 150, 201, 25, 200, 72, 168, 76, 37, 93,
+ 246, 1, 0, 0, 0, 156, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 32, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 216, 0, 0, 0, 64, 0, 0, 0, 54, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 68, 68, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50,
+ 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0,
+ 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45,
+ 0, 0, 7, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0,
+ 70, 126, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0,
+ 0, 7, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h
new file mode 100644
index 0000000000..196570007d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h
@@ -0,0 +1,78 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA3D /T ps_4_0 /Fh
+// compiled\passthroughrgba3d11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+sample o0.xyzw, v2.xyzx, t0.xyzw, s0
+ret
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3D[] = {
+ 68, 88, 66, 67, 249, 218, 187, 23, 150, 61, 9, 105, 122, 199, 110, 26, 29, 97, 207,
+ 112, 1, 0, 0, 0, 128, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 4, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 100, 0, 0, 0, 64, 0,
+ 0, 0, 25, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 69, 0, 0, 9, 242, 32, 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0,
+ 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 62,
+ 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_4444_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_4444_11ps.h
new file mode 100644
index 0000000000..a19ab8f46b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_4444_11ps.h
@@ -0,0 +1,88 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA3D_4444 /T ps_4_0 /Fh
+// compiled\passthroughrgba3d_4444_11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(15.000000, 15.000000, 15.000000, 15.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.066667, 0.066667, 0.066667, 0.066667)
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3D_4444[] = {
+ 68, 88, 66, 67, 34, 122, 167, 6, 161, 200, 45, 27, 155, 205, 20, 94, 188, 182, 46,
+ 114, 1, 0, 0, 0, 236, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 112, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 208, 0, 0, 0, 64, 0,
+ 0, 0, 52, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 112, 65, 0, 0, 112,
+ 65, 0, 0, 112, 65, 0, 0, 112, 65, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0,
+ 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 137, 136, 136, 61,
+ 137, 136, 136, 61, 137, 136, 136, 61, 137, 136, 136, 61, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_5551_11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_5551_11ps.h
new file mode 100644
index 0000000000..b048b5749e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d_5551_11ps.h
@@ -0,0 +1,88 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA3D_5551 /T ps_4_0 /Fh
+// compiled\passthroughrgba3d_5551_11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF texture float4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mul r0.xyzw, r0.xyzw, l(31.000000, 31.000000, 31.000000, 1.000000)
+round_ne r0.xyzw, r0.xyzw
+mul o0.xyzw, r0.xyzw, l(0.032258, 0.032258, 0.032258, 1.000000)
+ret
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3D_5551[] = {
+ 68, 88, 66, 67, 145, 96, 104, 51, 195, 218, 236, 165, 55, 186, 12, 206, 155, 10, 90,
+ 25, 1, 0, 0, 0, 236, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 220, 0,
+ 0, 0, 100, 1, 0, 0, 152, 1, 0, 0, 112, 2, 0, 0, 82, 68, 69, 70, 160,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 109, 0, 0, 0, 92, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 100, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 83, 97, 109, 112, 108, 101, 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0,
+ 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0,
+ 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95,
+ 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78,
+ 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44,
+ 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95,
+ 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 208, 0, 0, 0, 64, 0,
+ 0, 0, 52, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 0, 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 248, 65, 0, 0, 248,
+ 65, 0, 0, 248, 65, 0, 0, 128, 63, 64, 0, 0, 5, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 242, 32, 16, 0, 0,
+ 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 8, 33, 4, 61,
+ 8, 33, 4, 61, 8, 33, 4, 61, 0, 0, 128, 63, 62, 0, 0, 1, 83, 84, 65,
+ 84, 116, 0, 0, 0, 5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h
new file mode 100644
index 0000000000..3d9180e79f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA3DI /T ps_4_0 /Fh
+// compiled\passthroughrgba3di11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI texture sint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3DI[] = {
+ 68, 88, 66, 67, 114, 209, 219, 121, 211, 105, 24, 83, 99, 59, 231, 76, 145, 78, 142,
+ 39, 1, 0, 0, 0, 192, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 68, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 69, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 73, 0, 77, 105, 99, 114,
+ 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100,
+ 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53,
+ 50, 46, 51, 49, 49, 49, 0, 171, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 204, 0, 0, 0, 64, 0, 0, 0,
+ 51, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h
new file mode 100644
index 0000000000..59e1574029
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_PassthroughRGBA3DUI /T ps_4_0 /Fh
+// compiled\passthroughrgba3dui11ps.h Passthrough3D11.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI texture uint4 3d 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3DUI[] = {
+ 68, 88, 66, 67, 117, 34, 123, 144, 139, 50, 107, 8, 199, 58, 188, 37, 26, 62, 108,
+ 21, 1, 0, 0, 0, 192, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 60, 1, 0, 0, 112, 1, 0, 0, 68, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 70, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 85, 73, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
+ 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57,
+ 53, 50, 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 128, 0, 0, 0, 3, 0,
+ 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 118, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 7, 7,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86, 95, 82, 69,
+ 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73, 78, 68, 69,
+ 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78, 44, 0, 0,
+ 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65,
+ 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 204, 0, 0, 0, 64, 0, 0, 0,
+ 51, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 242,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16,
+ 0, 0, 0, 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2,
+ 16, 0, 0, 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114,
+ 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5,
+ 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0,
+ 7, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126,
+ 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 7,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvecolor2dps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvecolor2dps.h
new file mode 100644
index 0000000000..b214a23ad8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvecolor2dps.h
@@ -0,0 +1,107 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ResolveColor2D /T ps_4_1 /Fh compiled\resolvecolor2dps.h
+// ResolveColor.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureF_MS texture float4 2dMS 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_1
+dcl_globalFlags refactoringAllowed
+dcl_resource_texture2dms(0) (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 4
+resinfo_uint r0.xy, l(0), t0.xyzw
+sampleinfo_uint r0.z, t0.x
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftou r1.xy, r0.xyxx
+mov r1.zw, l(0,0,0,0)
+mov r2.xyzw, l(0,0,0,0)
+mov r0.x, l(0)
+loop
+ uge r0.y, r0.x, r0.z
+ breakc_nz r0.y
+ ldms r3.xyzw, r1.xyzw, t0.xyzw, r0.x
+ add r2.xyzw, r2.xyzw, r3.xyzw
+ iadd r0.x, r0.x, l(1)
+endloop
+sampleinfo r0.x, t0.x
+div o0.xyzw, r2.xyzw, r0.xxxx
+ret
+// Approximately 18 instruction slots used
+#endif
+
+const BYTE g_PS_ResolveColor2D[] = {
+ 68, 88, 66, 67, 192, 130, 252, 156, 103, 192, 177, 148, 25, 142, 181, 214, 173, 217, 123,
+ 174, 1, 0, 0, 0, 136, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 184, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 12, 3, 0, 0, 82, 68, 69, 70, 124,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 1, 4, 255, 255, 0, 1, 0, 0, 72, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 5, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 84, 101, 120, 116, 117, 114, 101, 70, 95, 77, 83, 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, 50, 57,
+ 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 76, 0,
+ 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0,
+ 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 82,
+ 68, 0, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 196, 1, 0, 0, 65, 0, 0, 0, 113, 0, 0, 0, 106, 8, 0, 1, 88, 32,
+ 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3, 50,
+ 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0,
+ 104, 0, 0, 2, 4, 0, 0, 0, 61, 16, 0, 7, 50, 0, 16, 0, 0, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 111, 8,
+ 0, 5, 66, 0, 16, 0, 0, 0, 0, 0, 10, 112, 16, 0, 0, 0, 0, 0, 86,
+ 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0,
+ 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0,
+ 0, 70, 16, 16, 0, 1, 0, 0, 0, 28, 0, 0, 5, 50, 0, 16, 0, 1, 0,
+ 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 1,
+ 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 8, 242, 0, 16, 0, 2, 0, 0, 0, 2, 64, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0,
+ 0, 5, 18, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 48,
+ 0, 0, 1, 80, 0, 0, 7, 34, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 3, 0, 4, 3, 26, 0, 16,
+ 0, 0, 0, 0, 0, 46, 0, 0, 9, 242, 0, 16, 0, 3, 0, 0, 0, 70, 14,
+ 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0,
+ 0, 0, 0, 0, 0, 0, 7, 242, 0, 16, 0, 2, 0, 0, 0, 70, 14, 16, 0,
+ 2, 0, 0, 0, 70, 14, 16, 0, 3, 0, 0, 0, 30, 0, 0, 7, 18, 0, 16,
+ 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 1, 0,
+ 0, 0, 22, 0, 0, 1, 111, 0, 0, 5, 18, 0, 16, 0, 0, 0, 0, 0, 10,
+ 112, 16, 0, 0, 0, 0, 0, 14, 0, 0, 7, 242, 32, 16, 0, 0, 0, 0, 0,
+ 70, 14, 16, 0, 2, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0,
+ 1, 83, 84, 65, 84, 116, 0, 0, 0, 18, 0, 0, 0, 4, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepth11_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepth11_ps.h
new file mode 100644
index 0000000000..48fd119958
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepth11_ps.h
@@ -0,0 +1,86 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ResolveDepth /T ps_4_1 /Fh compiled/resolvedepth11_ps.h
+// ResolveDepthStencil.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Depth texture float 2dMS 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Depth 0 N/A oDepth DEPTH float YES
+//
+ps_4_1
+dcl_globalFlags refactoringAllowed
+dcl_resource_texture2dms(0) (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output oDepth
+dcl_temps 1
+resinfo_uint r0.xy, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftou r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ldms r0.x, r0.xyzw, t0.xyzw, l(0)
+mov oDepth, r0.x
+ret
+// Approximately 8 instruction slots used
+#endif
+
+const BYTE g_PS_ResolveDepth[] = {
+ 68, 88, 66, 67, 91, 30, 96, 236, 23, 31, 71, 224, 94, 101, 86, 142, 90, 12, 152,
+ 206, 1, 0, 0, 0, 176, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 176, 0,
+ 0, 0, 8, 1, 0, 0, 60, 1, 0, 0, 52, 2, 0, 0, 82, 68, 69, 70, 116,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 1, 4, 255, 255, 0, 1, 0, 0, 66, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 5, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 68, 101, 112, 116, 104, 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, 50, 57, 46, 57, 53, 50, 46, 51,
+ 49, 49, 49, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0,
+ 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 111, 115, 105,
+ 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 1, 14, 0, 0,
+ 83, 86, 95, 68, 101, 112, 116, 104, 0, 171, 171, 171, 83, 72, 68, 82, 240, 0, 0,
+ 0, 65, 0, 0, 0, 60, 0, 0, 0, 106, 8, 0, 1, 88, 32, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 2, 1, 192, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0,
+ 61, 16, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0,
+ 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0,
+ 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0,
+ 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0,
+ 28, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 9, 18,
+ 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 4, 1, 192, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0,
+ 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_ps.h
new file mode 100644
index 0000000000..b5ae56f153
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_ps.h
@@ -0,0 +1,96 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ResolveDepthStencil /T ps_4_1 /Fh
+// compiled/resolvedepthstencil11_ps.h ResolveDepthStencil.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Depth texture float 2dMS 0 1
+// Stencil texture uint2 2dMS 1 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Target 0 xy 0 TARGET float xy
+//
+ps_4_1
+dcl_globalFlags refactoringAllowed
+dcl_resource_texture2dms(0) (float,float,float,float) t0
+dcl_resource_texture2dms(0) (uint,uint,uint,uint) t1
+dcl_input_ps linear v1.xy
+dcl_output o0.xy
+dcl_temps 1
+resinfo_uint r0.xy, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftou r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ldms r0.z, r0.xyzw, t1.xzyw, l(0)
+ldms r0.x, r0.xyww, t0.xyzw, l(0)
+mov o0.x, r0.x
+utof o0.y, r0.z
+ret
+// Approximately 10 instruction slots used
+#endif
+
+const BYTE g_PS_ResolveDepthStencil[] = {
+ 68, 88, 66, 67, 47, 137, 160, 229, 91, 11, 163, 77, 193, 134, 67, 56, 141, 222, 2,
+ 194, 1, 0, 0, 0, 40, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 216, 0,
+ 0, 0, 48, 1, 0, 0, 100, 1, 0, 0, 172, 2, 0, 0, 82, 68, 69, 70, 156,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 1, 4, 255, 255, 0, 1, 0, 0, 106, 0, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 5, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 98, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 6,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0,
+ 68, 101, 112, 116, 104, 0, 83, 116, 101, 110, 99, 105, 108, 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, 50, 57, 46, 57, 53, 50,
+ 46, 51, 49, 49, 49, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0,
+ 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 111,
+ 115, 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171,
+ 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 12,
+ 0, 0, 83, 86, 95, 84, 97, 114, 103, 101, 116, 0, 171, 171, 83, 72, 68, 82, 64,
+ 1, 0, 0, 65, 0, 0, 0, 80, 0, 0, 0, 106, 8, 0, 1, 88, 32, 0, 4,
+ 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 88, 32, 0, 4, 0, 112, 16,
+ 0, 1, 0, 0, 0, 68, 68, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0,
+ 0, 0, 101, 0, 0, 3, 50, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1,
+ 0, 0, 0, 61, 16, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0,
+ 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0, 16,
+ 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50, 0,
+ 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1,
+ 0, 0, 0, 28, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 0,
+ 0, 9, 66, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 134,
+ 125, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 46, 0, 0, 9,
+ 18, 0, 16, 0, 0, 0, 0, 0, 70, 15, 16, 0, 0, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 5, 18, 32,
+ 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 34,
+ 32, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 10, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_vs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_vs.h
new file mode 100644
index 0000000000..b141a3c8c1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvedepthstencil11_vs.h
@@ -0,0 +1,88 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E VS_ResolveDepthStencil /T vs_4_1 /Fh
+// compiled/resolvedepthstencil11_vs.h ResolveDepthStencil.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_VertexID 0 x 0 VERTID uint x
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float xyzw
+// TEXCOORD 0 xy 1 NONE float xy
+//
+vs_4_1
+dcl_globalFlags refactoringAllowed
+dcl_immediateConstantBuffer { { -1.000000, 1.000000, 0, 0},
+ { 1.000000, -1.000000, 0, 0},
+ { -1.000000, -1.000000, 0, 0},
+ { -1.000000, 1.000000, 0, 0},
+ { 1.000000, 1.000000, 0, 0},
+ { 1.000000, -1.000000, 0, 0} }
+dcl_input_sgv v0.x, vertex_id
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xy
+dcl_temps 1
+mov o0.zw, l(0,0,0,1.000000)
+mov r0.x, v0.x
+mov o0.xy, icb[r0.x + 0].xyxx
+add r0.y, l(1.000000), icb[r0.x + 0].x
+add r0.x, l(1.000000), -icb[r0.x + 0].y
+mul o1.xy, r0.yxyy, l(0.500000, 0.500000, 0.000000, 0.000000)
+ret
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_VS_ResolveDepthStencil[] = {
+ 68, 88, 66, 67, 40, 8, 1, 50, 138, 208, 33, 92, 46, 194, 48, 131, 250, 159, 71,
+ 56, 1, 0, 0, 0, 0, 3, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 140, 0,
+ 0, 0, 192, 0, 0, 0, 24, 1, 0, 0, 132, 2, 0, 0, 82, 68, 69, 70, 80,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
+ 1, 4, 254, 255, 0, 1, 0, 0, 28, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111,
+ 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32,
+ 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51,
+ 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 83, 86, 95, 86, 101, 114, 116, 101, 120, 73,
+ 68, 0, 79, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 1, 0, 0, 0, 3, 12, 0, 0, 83, 86, 95, 80, 111, 115, 105, 116, 105, 111,
+ 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 171, 171, 83, 72, 68, 82, 100,
+ 1, 0, 0, 65, 0, 1, 0, 89, 0, 0, 0, 106, 8, 0, 1, 53, 24, 0, 0,
+ 26, 0, 0, 0, 0, 0, 128, 191, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 128, 63, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 128, 191, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0,
+ 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 191, 0, 0, 0,
+ 0, 0, 0, 0, 0, 96, 0, 0, 4, 18, 16, 16, 0, 0, 0, 0, 0, 6, 0,
+ 0, 0, 103, 0, 0, 4, 242, 32, 16, 0, 0, 0, 0, 0, 1, 0, 0, 0, 101,
+ 0, 0, 3, 50, 32, 16, 0, 1, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0,
+ 54, 0, 0, 8, 194, 32, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 54, 0, 0, 5, 18, 0,
+ 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 50,
+ 32, 16, 0, 0, 0, 0, 0, 70, 144, 144, 0, 10, 0, 16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 8, 34, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128,
+ 63, 10, 144, 144, 0, 10, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 9, 18, 0,
+ 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 26, 144, 144, 128, 65,
+ 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 10, 50, 32, 16, 0,
+ 1, 0, 0, 0, 22, 5, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0,
+ 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 3,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvestencil11_ps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvestencil11_ps.h
new file mode 100644
index 0000000000..55bddf2758
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/resolvestencil11_ps.h
@@ -0,0 +1,88 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_ResolveStencil /T ps_4_1 /Fh
+// compiled/resolvestencil11_ps.h ResolveDepthStencil.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Stencil texture uint2 2dMS 1 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Position 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_Target 0 xy 0 TARGET float xy
+//
+ps_4_1
+dcl_globalFlags refactoringAllowed
+dcl_resource_texture2dms(0) (uint,uint,uint,uint) t1
+dcl_input_ps linear v1.xy
+dcl_output o0.xy
+dcl_temps 1
+resinfo_uint r0.xy, l(0), t1.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftou r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ldms r0.x, r0.xyzw, t1.yxzw, l(0)
+utof o0.y, r0.x
+mov o0.x, l(0)
+ret
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ResolveStencil[] = {
+ 68, 88, 66, 67, 23, 194, 195, 209, 212, 28, 208, 37, 42, 21, 191, 206, 191, 0, 52,
+ 120, 1, 0, 0, 0, 208, 2, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 180, 0,
+ 0, 0, 12, 1, 0, 0, 64, 1, 0, 0, 84, 2, 0, 0, 82, 68, 69, 70, 120,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0,
+ 1, 4, 255, 255, 0, 1, 0, 0, 68, 0, 0, 0, 60, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+ 0, 0, 5, 0, 0, 0, 83, 116, 101, 110, 99, 105, 108, 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, 50, 57, 46, 57, 53, 50,
+ 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
+ 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
+ 80, 111, 115, 105, 116, 105, 111, 110, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 3, 12, 0, 0, 83, 86, 95, 84, 97, 114, 103, 101, 116, 0, 171, 171, 83, 72, 68,
+ 82, 12, 1, 0, 0, 65, 0, 0, 0, 67, 0, 0, 0, 106, 8, 0, 1, 88, 32,
+ 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 68, 68, 0, 0, 98, 16, 0, 3, 50,
+ 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3, 50, 32, 16, 0, 0, 0, 0, 0,
+ 104, 0, 0, 2, 1, 0, 0, 0, 61, 16, 0, 7, 50, 0, 16, 0, 0, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 1, 0, 0, 0, 86, 0,
+ 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56,
+ 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0,
+ 70, 16, 16, 0, 1, 0, 0, 0, 28, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0,
+ 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0,
+ 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 46, 0, 0, 9, 18, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0,
+ 0, 0, 0, 0, 22, 126, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 34, 32, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 5, 18, 32, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0,
+ 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 9, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
+ 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h
new file mode 100644
index 0000000000..81b94fd81f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h
@@ -0,0 +1,140 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleF2DArray /T ps_4_0 /Fh
+// compiled\swizzlef2darrayps.h Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF2DArray texture float4 2darray 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 18 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF2DArray[] = {
+ 68, 88, 66, 67, 10, 112, 114, 208, 204, 221, 6, 130, 191, 123, 80, 111, 226, 70, 79,
+ 225, 1, 0, 0, 0, 204, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 104, 1,
+ 0, 0, 240, 1, 0, 0, 36, 2, 0, 0, 80, 4, 0, 0, 82, 68, 69, 70, 44,
+ 1, 0, 0, 1, 0, 0, 0, 168, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 248, 0, 0, 0, 124, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 5,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 83, 97, 109, 112, 108, 101,
+ 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 50, 68, 65, 114, 114, 97, 121, 0, 83,
+ 119, 105, 122, 122, 108, 101, 80, 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171,
+ 148, 0, 0, 0, 1, 0, 0, 0, 192, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 216, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0,
+ 0, 0, 232, 0, 0, 0, 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110,
+ 100, 105, 99, 101, 115, 0, 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72,
+ 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114,
+ 32, 57, 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73,
+ 83, 71, 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
+ 0, 92, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+ 0, 0, 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
+ 0, 0, 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84,
+ 73, 79, 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84,
+ 65, 82, 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68,
+ 0, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68,
+ 82, 36, 2, 0, 0, 64, 0, 0, 0, 137, 0, 0, 0, 89, 0, 0, 4, 70, 142,
+ 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0,
+ 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0,
+ 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0, 0, 0, 98, 16, 0,
+ 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0,
+ 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 105, 0, 0, 4, 0, 0, 0, 0, 6,
+ 0, 0, 0, 4, 0, 0, 0, 86, 0, 0, 5, 66, 0, 16, 0, 0, 0, 0, 0,
+ 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0,
+ 0, 70, 16, 16, 0, 2, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0,
+ 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0,
+ 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0,
+ 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0,
+ 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0,
+ 58, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0,
+ 0, 4, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 54,
+ 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32,
+ 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0,
+ 16, 0, 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
+ 0, 0, 7, 34, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0,
+ 0, 42, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32,
+ 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0,
+ 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0,
+ 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0,
+ 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 18, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h
new file mode 100644
index 0000000000..27a87c215b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h
@@ -0,0 +1,130 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleF2D /T ps_4_0 /Fh compiled\swizzlef2dps.h
+// Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF2D texture float4 2d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 16 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF2D[] = {
+ 68, 88, 66, 67, 231, 84, 171, 36, 174, 101, 233, 167, 224, 61, 160, 30, 113, 106, 106,
+ 125, 1, 0, 0, 0, 96, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 100, 1,
+ 0, 0, 188, 1, 0, 0, 240, 1, 0, 0, 228, 3, 0, 0, 82, 68, 69, 70, 40,
+ 1, 0, 0, 1, 0, 0, 0, 164, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 244, 0, 0, 0, 124, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 83, 97, 109, 112, 108, 101,
+ 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 50, 68, 0, 83, 119, 105, 122, 122, 108,
+ 101, 80, 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171, 171, 143, 0, 0, 0,
+ 1, 0, 0, 0, 188, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 212, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 228, 0,
+ 0, 0, 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105, 99, 101,
+ 115, 0, 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32,
+ 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50,
+ 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 80,
+ 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3,
+ 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79,
+ 79, 82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0,
+ 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0,
+ 171, 171, 83, 72, 68, 82, 236, 1, 0, 0, 64, 0, 0, 0, 123, 0, 0, 0, 89,
+ 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 90, 0, 0, 3,
+ 0, 96, 16, 0, 0, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 85, 85, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0,
+ 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 105,
+ 0, 0, 4, 0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 69, 0, 0, 9,
+ 242, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 26, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 42, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18,
+ 48, 32, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 5, 0, 0, 0, 1, 64, 0,
+ 0, 0, 0, 128, 63, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 10, 128,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 18, 32, 16, 0, 0,
+ 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 7, 34, 32, 16, 0, 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18,
+ 0, 16, 0, 0, 0, 0, 0, 42, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 66, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0,
+ 0, 0, 58, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 130,
+ 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 16, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
+ 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h
new file mode 100644
index 0000000000..4b05cda2fd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h
@@ -0,0 +1,134 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleF3D /T ps_4_0 /Fh compiled\swizzlef3dps.h
+// Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler sampler NA NA 0 1
+// TextureF3D texture float4 3d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET float xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 16 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF3D[] = {
+ 68, 88, 66, 67, 239, 190, 93, 16, 108, 116, 194, 88, 111, 43, 244, 26, 83, 204, 59,
+ 123, 1, 0, 0, 0, 144, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 100, 1,
+ 0, 0, 236, 1, 0, 0, 32, 2, 0, 0, 20, 4, 0, 0, 82, 68, 69, 70, 40,
+ 1, 0, 0, 1, 0, 0, 0, 164, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 244, 0, 0, 0, 124, 0, 0, 0, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 1, 0, 0, 0, 132, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 8,
+ 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0,
+ 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 83, 97, 109, 112, 108, 101,
+ 114, 0, 84, 101, 120, 116, 117, 114, 101, 70, 51, 68, 0, 83, 119, 105, 122, 122, 108,
+ 101, 80, 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171, 171, 143, 0, 0, 0,
+ 1, 0, 0, 0, 188, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 212, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 228, 0,
+ 0, 0, 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105, 99, 101,
+ 115, 0, 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32,
+ 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50,
+ 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 128,
+ 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0,
+ 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+ 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2,
+ 0, 0, 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0,
+ 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65,
+ 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83,
+ 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0,
+ 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 236, 1, 0,
+ 0, 64, 0, 0, 0, 123, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 90, 0, 0, 3, 0, 96, 16, 0, 0, 0, 0, 0, 88,
+ 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 85, 85, 0, 0, 98, 16, 0, 3,
+ 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0,
+ 0, 104, 0, 0, 2, 1, 0, 0, 0, 105, 0, 0, 4, 0, 0, 0, 0, 6, 0,
+ 0, 0, 4, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 0, 0, 0, 0, 70,
+ 18, 16, 0, 2, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18,
+ 48, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 58, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 4, 0,
+ 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0,
+ 0, 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128, 63, 54, 0, 0, 6,
+ 18, 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0,
+ 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0,
+ 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7,
+ 34, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 42, 128,
+ 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32, 16, 0, 0,
+ 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0,
+ 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0, 0, 10, 48,
+ 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83,
+ 84, 65, 84, 116, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h
new file mode 100644
index 0000000000..b3188adc08
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h
@@ -0,0 +1,144 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleI2DArray /T ps_4_0 /Fh
+// compiled\swizzlei2darrayps.h Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI2DArray texture sint4 2darray 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2darray (sint,sint,sint,sint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 22 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI2DArray[] = {
+ 68, 88, 66, 67, 133, 234, 212, 67, 255, 165, 181, 252, 19, 185, 168, 29, 237, 193, 125,
+ 57, 1, 0, 0, 0, 240, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 64, 1,
+ 0, 0, 200, 1, 0, 0, 252, 1, 0, 0, 116, 4, 0, 0, 82, 68, 69, 70, 4,
+ 1, 0, 0, 1, 0, 0, 0, 128, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 208, 0, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114, 101, 73, 50, 68, 65, 114, 114, 97, 121, 0, 83, 119, 105,
+ 122, 122, 108, 101, 80, 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171, 108, 0,
+ 0, 0, 1, 0, 0, 0, 152, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0,
+ 192, 0, 0, 0, 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105,
+ 99, 101, 115, 0, 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57,
+ 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71,
+ 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92,
+ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82,
+ 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 112,
+ 2, 0, 0, 64, 0, 0, 0, 156, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 51, 51, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0,
+ 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242,
+ 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 105, 0, 0, 4,
+ 0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16,
+ 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16,
+ 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0,
+ 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 18, 48, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 4,
+ 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 54, 0, 0,
+ 6, 18, 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0,
+ 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 7, 34, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 42,
+ 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0, 0, 10,
+ 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h
new file mode 100644
index 0000000000..a0470b5325
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h
@@ -0,0 +1,137 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleI2D /T ps_4_0 /Fh compiled\swizzlei2dps.h
+// Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI2D texture sint4 2d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI2D[] = {
+ 68, 88, 66, 67, 173, 226, 173, 23, 21, 249, 148, 56, 12, 194, 17, 225, 118, 52, 31,
+ 119, 1, 0, 0, 0, 164, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 60, 1,
+ 0, 0, 148, 1, 0, 0, 200, 1, 0, 0, 40, 4, 0, 0, 82, 68, 69, 70, 0,
+ 1, 0, 0, 1, 0, 0, 0, 124, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 204, 0, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114, 101, 73, 50, 68, 0, 83, 119, 105, 122, 122, 108, 101, 80,
+ 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171, 171, 103, 0, 0, 0, 1, 0,
+ 0, 0, 148, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172,
+ 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105, 99, 101, 115, 0,
+ 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 80, 0, 0,
+ 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0,
+ 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 88, 2, 0, 0, 64, 0, 0, 0, 150, 0, 0, 0, 89, 0, 0,
+ 4, 70, 142, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 51, 51, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 105, 0, 0, 4, 0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0,
+ 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0, 16, 0, 0,
+ 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0,
+ 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 18, 48, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 4,
+ 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 54, 0, 0,
+ 6, 18, 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0,
+ 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 7, 34, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 42,
+ 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0, 0, 10,
+ 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 21, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h
new file mode 100644
index 0000000000..d5b4644642
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h
@@ -0,0 +1,140 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleI3D /T ps_4_0 /Fh compiled\swizzlei3dps.h
+// Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI3D texture sint4 3d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET int xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI3D[] = {
+ 68, 88, 66, 67, 249, 178, 247, 141, 249, 115, 249, 29, 105, 250, 202, 151, 43, 0, 206,
+ 251, 1, 0, 0, 0, 200, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 60, 1,
+ 0, 0, 196, 1, 0, 0, 248, 1, 0, 0, 76, 4, 0, 0, 82, 68, 69, 70, 0,
+ 1, 0, 0, 1, 0, 0, 0, 124, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 204, 0, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114, 101, 73, 51, 68, 0, 83, 119, 105, 122, 122, 108, 101, 80,
+ 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171, 171, 103, 0, 0, 0, 1, 0,
+ 0, 0, 148, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172,
+ 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105, 99, 101, 115, 0,
+ 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 128, 0, 0,
+ 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0,
+ 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86,
+ 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73,
+ 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 76, 2, 0, 0, 64,
+ 0, 0, 0, 147, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 51, 51, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 105, 0, 0, 4, 0,
+ 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0,
+ 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16,
+ 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 4, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0,
+ 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 54, 0, 0, 6, 18,
+ 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 34,
+ 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 42, 128, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32,
+ 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0, 21, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h
new file mode 100644
index 0000000000..e840ad80b9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h
@@ -0,0 +1,144 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleUI2DArray /T ps_4_0 /Fh
+// compiled\swizzleui2darrayps.h Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI2DArray texture uint4 2darray 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint x
+// TEXCOORD 0 xyz 2 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2darray (uint,uint,uint,uint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 22 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI2DArray[] = {
+ 68, 88, 66, 67, 253, 219, 132, 138, 227, 164, 143, 132, 2, 123, 116, 0, 12, 103, 207,
+ 6, 1, 0, 0, 0, 240, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 64, 1,
+ 0, 0, 200, 1, 0, 0, 252, 1, 0, 0, 116, 4, 0, 0, 82, 68, 69, 70, 4,
+ 1, 0, 0, 1, 0, 0, 0, 128, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 208, 0, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 5, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114, 101, 85, 73, 50, 68, 65, 114, 114, 97, 121, 0, 83, 119,
+ 105, 122, 122, 108, 101, 80, 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 109, 0,
+ 0, 0, 1, 0, 0, 0, 152, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0,
+ 192, 0, 0, 0, 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105,
+ 99, 101, 115, 0, 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83,
+ 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57,
+ 46, 50, 57, 46, 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71,
+ 78, 128, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92,
+ 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 1, 1, 0, 0, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
+ 0, 2, 0, 0, 0, 7, 3, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79,
+ 78, 0, 83, 86, 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82,
+ 82, 65, 89, 73, 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171,
+ 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0,
+ 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 112,
+ 2, 0, 0, 64, 0, 0, 0, 156, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 88, 64, 0, 4, 0, 112, 16, 0, 0, 0, 0,
+ 0, 68, 68, 0, 0, 100, 8, 0, 4, 18, 16, 16, 0, 1, 0, 0, 0, 4, 0,
+ 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242,
+ 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 105, 0, 0, 4,
+ 0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16,
+ 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0,
+ 0, 0, 86, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0,
+ 0, 0, 0, 56, 0, 0, 7, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0,
+ 0, 0, 0, 0, 70, 16, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16,
+ 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 66, 0,
+ 16, 0, 0, 0, 0, 0, 10, 16, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5, 130,
+ 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 18, 48, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 4,
+ 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 54, 0, 0,
+ 6, 18, 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0,
+ 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 7, 34, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 42,
+ 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0, 0, 10,
+ 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h
new file mode 100644
index 0000000000..2316b2859d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h
@@ -0,0 +1,137 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleUI2D /T ps_4_0 /Fh compiled\swizzleui2dps.h
+// Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI2D texture uint4 2d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// TEXCOORD 0 xy 1 NONE float xy
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI2D[] = {
+ 68, 88, 66, 67, 140, 55, 150, 179, 133, 9, 250, 249, 200, 106, 121, 178, 86, 215, 59,
+ 109, 1, 0, 0, 0, 164, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 60, 1,
+ 0, 0, 148, 1, 0, 0, 200, 1, 0, 0, 40, 4, 0, 0, 82, 68, 69, 70, 0,
+ 1, 0, 0, 1, 0, 0, 0, 124, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 204, 0, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114, 101, 85, 73, 50, 68, 0, 83, 119, 105, 122, 122, 108, 101,
+ 80, 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171, 104, 0, 0, 0, 1, 0,
+ 0, 0, 148, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172,
+ 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105, 99, 101, 115, 0,
+ 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 80, 0, 0,
+ 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 68, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0,
+ 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82,
+ 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0,
+ 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, 0, 0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171,
+ 83, 72, 68, 82, 88, 2, 0, 0, 64, 0, 0, 0, 150, 0, 0, 0, 89, 0, 0,
+ 4, 70, 142, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 88, 24, 0, 4, 0, 112,
+ 16, 0, 0, 0, 0, 0, 68, 68, 0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1,
+ 0, 0, 0, 101, 0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
+ 1, 0, 0, 0, 105, 0, 0, 4, 0, 0, 0, 0, 6, 0, 0, 0, 4, 0, 0,
+ 0, 61, 16, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0,
+ 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 86, 0, 0, 5, 50, 0, 16, 0, 0,
+ 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 50, 0, 16, 0,
+ 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0,
+ 0, 27, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0,
+ 0, 0, 54, 0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7,
+ 242, 0, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16,
+ 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6,
+ 18, 48, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 58, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 4,
+ 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0,
+ 0, 0, 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 54, 0, 0,
+ 6, 18, 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0,
+ 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0,
+ 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 7, 34, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0,
+ 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 42,
+ 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32, 16, 0,
+ 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0,
+ 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0, 0, 10,
+ 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1,
+ 83, 84, 65, 84, 116, 0, 0, 0, 21, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h
new file mode 100644
index 0000000000..608813e9a3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h
@@ -0,0 +1,140 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+// fxc /nologo /E PS_SwizzleUI3D /T ps_4_0 /Fh compiled\swizzleui3dps.h
+// Swizzle11.hlsl
+//
+//
+// Buffer Definitions:
+//
+// cbuffer SwizzleProperties
+// {
+//
+// uint4 SwizzleIndices; // Offset: 0 Size: 16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name Type Format Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI3D texture uint4 3d 0 1
+// SwizzleProperties cbuffer NA NA 0 1
+//
+//
+//
+// Input signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION 0 xyzw 0 POS float
+// SV_RENDERTARGETARRAYINDEX 0 x 1 RTINDEX uint
+// TEXCOORD 0 xyz 2 NONE float xyz
+//
+//
+// Output signature:
+//
+// Name Index Mask Register SysValue Format Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET 0 xyzw 0 TARGET uint xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI3D[] = {
+ 68, 88, 66, 67, 16, 68, 155, 94, 147, 232, 30, 147, 133, 253, 183, 22, 27, 47, 144,
+ 44, 1, 0, 0, 0, 200, 4, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 60, 1,
+ 0, 0, 196, 1, 0, 0, 248, 1, 0, 0, 76, 4, 0, 0, 82, 68, 69, 70, 0,
+ 1, 0, 0, 1, 0, 0, 0, 124, 0, 0, 0, 2, 0, 0, 0, 28, 0, 0, 0,
+ 0, 4, 255, 255, 0, 1, 0, 0, 204, 0, 0, 0, 92, 0, 0, 0, 2, 0, 0,
+ 0, 4, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 1, 0,
+ 0, 0, 13, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 84, 101, 120, 116, 117, 114, 101, 85, 73, 51, 68, 0, 83, 119, 105, 122, 122, 108, 101,
+ 80, 114, 111, 112, 101, 114, 116, 105, 101, 115, 0, 171, 171, 104, 0, 0, 0, 1, 0,
+ 0, 0, 148, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172,
+ 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 188, 0, 0, 0,
+ 0, 0, 0, 0, 83, 119, 105, 122, 122, 108, 101, 73, 110, 100, 105, 99, 101, 115, 0,
+ 171, 1, 0, 19, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105,
+ 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 57, 46, 50, 57, 46,
+ 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 73, 83, 71, 78, 128, 0, 0,
+ 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
+ 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0,
+ 0, 7, 7, 0, 0, 83, 86, 95, 80, 79, 83, 73, 84, 73, 79, 78, 0, 83, 86,
+ 95, 82, 69, 78, 68, 69, 82, 84, 65, 82, 71, 69, 84, 65, 82, 82, 65, 89, 73,
+ 78, 68, 69, 88, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0, 171, 79, 83, 71, 78,
+ 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86,
+ 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 76, 2, 0, 0, 64,
+ 0, 0, 0, 147, 0, 0, 0, 89, 0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 88, 40, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
+ 0, 98, 16, 0, 3, 114, 16, 16, 0, 2, 0, 0, 0, 101, 0, 0, 3, 242, 32,
+ 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 1, 0, 0, 0, 105, 0, 0, 4, 0,
+ 0, 0, 0, 6, 0, 0, 0, 4, 0, 0, 0, 61, 16, 0, 7, 242, 0, 16, 0,
+ 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0,
+ 0, 86, 0, 0, 5, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0, 0,
+ 0, 0, 56, 0, 0, 7, 114, 0, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 0,
+ 0, 0, 0, 70, 18, 16, 0, 2, 0, 0, 0, 27, 0, 0, 5, 114, 0, 16, 0,
+ 0, 0, 0, 0, 70, 2, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16,
+ 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, 0, 0, 45, 0, 0, 7, 242, 0,
+ 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0,
+ 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0,
+ 0, 1, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48,
+ 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 3, 0, 0, 0, 58, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0, 0, 0, 4, 0, 0,
+ 0, 1, 64, 0, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 48, 32, 0, 0, 0,
+ 0, 0, 5, 0, 0, 0, 1, 64, 0, 0, 1, 0, 0, 0, 54, 0, 0, 6, 18,
+ 0, 16, 0, 0, 0, 0, 0, 10, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 54, 0, 0, 7, 18, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0,
+ 0, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0,
+ 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 34,
+ 32, 16, 0, 0, 0, 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0,
+ 0, 0, 0, 0, 54, 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 42, 128, 32,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 7, 66, 32, 16, 0, 0, 0,
+ 0, 0, 10, 48, 32, 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 54,
+ 0, 0, 6, 18, 0, 16, 0, 0, 0, 0, 0, 58, 128, 32, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 54, 0, 0, 7, 130, 32, 16, 0, 0, 0, 0, 0, 10, 48, 32,
+ 4, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84,
+ 65, 84, 116, 0, 0, 0, 21, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp
new file mode 100644
index 0000000000..a9dfec56b8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp
@@ -0,0 +1,35 @@
+//
+// Copyright 2016 The ANGLE Project 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 routines for the D3D11 texture format table.
+
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+#include "libANGLE/renderer/load_functions_table.h"
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+const Format &Format::getSwizzleFormat(const Renderer11DeviceCaps &deviceCaps) const
+{
+ return (swizzleFormat == internalFormat ? *this : Format::Get(swizzleFormat, deviceCaps));
+}
+
+LoadFunctionMap Format::getLoadFunctions() const
+{
+ return GetLoadFunctionsMap(internalFormat, formatID);
+}
+
+const angle::Format &Format::format() const
+{
+ return angle::Format::Get(formatID);
+}
+
+} // namespace d3d11
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h
new file mode 100644
index 0000000000..b7bcba9cb4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h
@@ -0,0 +1,108 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// texture_format_table:
+// Queries for full textureFormat information based on internalFormat
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_TEXTUREFORMATTABLE_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_TEXTUREFORMATTABLE_H_
+
+#include <map>
+
+#include "common/angleutils.h"
+#include "common/platform.h"
+#include "libANGLE/renderer/Format.h"
+#include "libANGLE/renderer/d3d/formatutilsD3D.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace rx
+{
+
+struct Renderer11DeviceCaps;
+
+namespace d3d11
+{
+
+// For sized GL internal formats, there are several possible corresponding D3D11 formats depending
+// on device capabilities.
+// This structure allows querying for the DXGI texture formats to use for textures, SRVs, RTVs and
+// DSVs given a GL internal format.
+struct Format final : private angle::NonCopyable
+{
+ inline constexpr Format();
+ inline constexpr Format(GLenum internalFormat,
+ angle::FormatID formatID,
+ DXGI_FORMAT texFormat,
+ DXGI_FORMAT srvFormat,
+ DXGI_FORMAT uavFormat,
+ DXGI_FORMAT rtvFormat,
+ DXGI_FORMAT dsvFormat,
+ DXGI_FORMAT blitSRVFormat,
+ GLenum swizzleFormat,
+ InitializeTextureDataFunction internalFormatInitializer);
+
+ static const Format &Get(GLenum internalFormat, const Renderer11DeviceCaps &deviceCaps);
+
+ const Format &getSwizzleFormat(const Renderer11DeviceCaps &deviceCaps) const;
+ LoadFunctionMap getLoadFunctions() const;
+ const angle::Format &format() const;
+
+ GLenum internalFormat;
+ angle::FormatID formatID;
+
+ DXGI_FORMAT texFormat;
+ DXGI_FORMAT srvFormat;
+ DXGI_FORMAT uavFormat;
+ DXGI_FORMAT rtvFormat;
+ DXGI_FORMAT dsvFormat;
+
+ DXGI_FORMAT blitSRVFormat;
+
+ GLenum swizzleFormat;
+
+ InitializeTextureDataFunction dataInitializerFunction;
+};
+
+constexpr Format::Format()
+ : internalFormat(GL_NONE),
+ formatID(angle::FormatID::NONE),
+ texFormat(DXGI_FORMAT_UNKNOWN),
+ srvFormat(DXGI_FORMAT_UNKNOWN),
+ uavFormat(DXGI_FORMAT_UNKNOWN),
+ rtvFormat(DXGI_FORMAT_UNKNOWN),
+ dsvFormat(DXGI_FORMAT_UNKNOWN),
+ blitSRVFormat(DXGI_FORMAT_UNKNOWN),
+ swizzleFormat(GL_NONE),
+ dataInitializerFunction(nullptr)
+{}
+
+constexpr Format::Format(GLenum internalFormat,
+ angle::FormatID formatID,
+ DXGI_FORMAT texFormat,
+ DXGI_FORMAT srvFormat,
+ DXGI_FORMAT uavFormat,
+ DXGI_FORMAT rtvFormat,
+ DXGI_FORMAT dsvFormat,
+ DXGI_FORMAT blitSRVFormat,
+ GLenum swizzleFormat,
+ InitializeTextureDataFunction internalFormatInitializer)
+ : internalFormat(internalFormat),
+ formatID(formatID),
+ texFormat(texFormat),
+ srvFormat(srvFormat),
+ uavFormat(uavFormat),
+ rtvFormat(rtvFormat),
+ dsvFormat(dsvFormat),
+ blitSRVFormat(blitSRVFormat),
+ swizzleFormat(swizzleFormat),
+ dataInitializerFunction(internalFormatInitializer)
+{}
+
+} // namespace d3d11
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_TEXTUREFORMATTABLE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp
new file mode 100644
index 0000000000..594ee848cb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp
@@ -0,0 +1,2448 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_texture_format_table.py using data from texture_format_data.json
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// texture_format_table:
+// Queries for full textureFormat information based in internalFormat
+//
+
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
+
+#include "image_util/copyimage.h"
+#include "image_util/generatemip.h"
+#include "image_util/loadimage.h"
+
+#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+#include "libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h"
+
+using namespace angle;
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+// static
+const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &deviceCaps)
+{
+ // clang-format off
+ switch (internalFormat)
+ {
+ case GL_ALPHA16F_EXT:
+ {
+ static constexpr Format info(GL_ALPHA16F_EXT,
+ angle::FormatID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ nullptr);
+ return info;
+ }
+ case GL_ALPHA32F_EXT:
+ {
+ static constexpr Format info(GL_ALPHA32F_EXT,
+ angle::FormatID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_ALPHA8_EXT:
+ {
+ if (OnlyFL10Plus(deviceCaps))
+ {
+ static constexpr Format info(GL_ALPHA8_EXT,
+ angle::FormatID::A8_UNORM,
+ DXGI_FORMAT_A8_UNORM,
+ DXGI_FORMAT_A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_ALPHA8_EXT,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_BGR565_ANGLEX:
+ {
+ if (SupportsFormat(DXGI_FORMAT_B5G6R5_UNORM, deviceCaps))
+ {
+ static constexpr Format info(GL_BGR565_ANGLEX,
+ angle::FormatID::B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_BGR565_ANGLEX,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_BGR5_A1_ANGLEX:
+ {
+ static constexpr Format info(GL_BGR5_A1_ANGLEX,
+ angle::FormatID::B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ GL_BGRA8_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_BGRA4_ANGLEX:
+ {
+ static constexpr Format info(GL_BGRA4_ANGLEX,
+ angle::FormatID::B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ GL_BGRA8_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_BGRA8_EXT:
+ {
+ static constexpr Format info(GL_BGRA8_EXT,
+ angle::FormatID::B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ GL_BGRA8_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_BGRA8_SRGB_ANGLEX:
+ {
+ static constexpr Format info(GL_BGRA8_SRGB_ANGLEX,
+ angle::FormatID::B8G8R8A8_UNORM_SRGB,
+ DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
+ DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
+ GL_BGRA8_SRGB_ANGLEX,
+ nullptr);
+ return info;
+ }
+ case GL_BGRX8_ANGLEX:
+ {
+ if (OnlyFL11_1Plus(deviceCaps))
+ {
+ static constexpr Format info(GL_BGRX8_ANGLEX,
+ angle::FormatID::B8G8R8X8_UNORM,
+ DXGI_FORMAT_B8G8R8X8_UNORM,
+ DXGI_FORMAT_B8G8R8X8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8X8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8X8_UNORM,
+ GL_BGRX8_ANGLEX,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_BGRX8_ANGLEX,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_COMPRESSED_R11_EAC:
+ {
+ static constexpr Format info(GL_COMPRESSED_R11_EAC,
+ angle::FormatID::R16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RG11_EAC:
+ {
+ static constexpr Format info(GL_COMPRESSED_RG11_EAC,
+ angle::FormatID::R16G16_UNORM,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGB8_ETC2:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGB8_ETC2,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE,
+ angle::FormatID::BC1_RGB_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE,
+ angle::FormatID::BC1_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA8_ETC2_EAC:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA8_ETC2_EAC,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_3x3x3_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_4x3x3_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_4x4x3_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_4x4x4_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_5x4x4_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_5x5x4_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_5x5x5_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_6x5x5_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_6x6x5_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_6x6x6_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
+ angle::FormatID::BPTC_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC7_UNORM,
+ DXGI_FORMAT_BC7_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC7_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ angle::FormatID::BC1_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
+ angle::FormatID::BC2_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC2_UNORM,
+ DXGI_FORMAT_BC2_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC2_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
+ angle::FormatID::BC3_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC3_UNORM,
+ DXGI_FORMAT_BC3_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC3_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
+ angle::FormatID::BPTC_RGB_SIGNED_FLOAT_BLOCK,
+ DXGI_FORMAT_BC6H_SF16,
+ DXGI_FORMAT_BC6H_SF16,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC6H_SF16,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
+ angle::FormatID::BPTC_RGB_UNSIGNED_FLOAT_BLOCK,
+ DXGI_FORMAT_BC6H_UF16,
+ DXGI_FORMAT_BC6H_UF16,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC6H_UF16,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ angle::FormatID::BC1_RGB_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SIGNED_R11_EAC:
+ {
+ static constexpr Format info(GL_COMPRESSED_SIGNED_R11_EAC,
+ angle::FormatID::R16_SNORM,
+ DXGI_FORMAT_R16_SNORM,
+ DXGI_FORMAT_R16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SIGNED_RG11_EAC:
+ {
+ static constexpr Format info(GL_COMPRESSED_SIGNED_RG11_EAC,
+ angle::FormatID::R16G16_SNORM,
+ DXGI_FORMAT_R16G16_SNORM,
+ DXGI_FORMAT_R16G16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ angle::FormatID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_ETC2:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_ETC2,
+ angle::FormatID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE,
+ angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ angle::FormatID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE,
+ angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
+ angle::FormatID::BPTC_SRGB_ALPHA_UNORM_BLOCK,
+ DXGI_FORMAT_BC7_UNORM_SRGB,
+ DXGI_FORMAT_BC7_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC7_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
+ angle::FormatID::BC1_RGBA_UNORM_SRGB_BLOCK,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
+ angle::FormatID::BC2_RGBA_UNORM_SRGB_BLOCK,
+ DXGI_FORMAT_BC2_UNORM_SRGB,
+ DXGI_FORMAT_BC2_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC2_UNORM_SRGB,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
+ angle::FormatID::BC3_RGBA_UNORM_SRGB_BLOCK,
+ DXGI_FORMAT_BC3_UNORM_SRGB,
+ DXGI_FORMAT_BC3_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC3_UNORM_SRGB,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ {
+ static constexpr Format info(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
+ angle::FormatID::BC1_RGB_UNORM_SRGB_BLOCK,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM_SRGB,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_DEPTH24_STENCIL8:
+ {
+ if (OnlyFL10Plus(deviceCaps))
+ {
+ static constexpr Format info(GL_DEPTH24_STENCIL8,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_DEPTH24_STENCIL8,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_DEPTH32F_STENCIL8:
+ {
+ static constexpr Format info(GL_DEPTH32F_STENCIL8,
+ angle::FormatID::D32_FLOAT_S8X24_UINT,
+ DXGI_FORMAT_R32G8X24_TYPELESS,
+ DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
+ DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_DEPTH_COMPONENT16:
+ {
+ if (OnlyFL10Plus(deviceCaps))
+ {
+ static constexpr Format info(GL_DEPTH_COMPONENT16,
+ angle::FormatID::D16_UNORM,
+ DXGI_FORMAT_R16_TYPELESS,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_DEPTH_COMPONENT16,
+ angle::FormatID::D16_UNORM,
+ DXGI_FORMAT_D16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_DEPTH_COMPONENT24:
+ {
+ if (OnlyFL10Plus(deviceCaps))
+ {
+ static constexpr Format info(GL_DEPTH_COMPONENT24,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_DEPTH_COMPONENT24,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_DEPTH_COMPONENT32F:
+ {
+ static constexpr Format info(GL_DEPTH_COMPONENT32F,
+ angle::FormatID::D32_FLOAT,
+ DXGI_FORMAT_R32_TYPELESS,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_DEPTH_COMPONENT32_OES:
+ {
+ if (OnlyFL10Plus(deviceCaps))
+ {
+ static constexpr Format info(GL_DEPTH_COMPONENT32_OES,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_DEPTH_COMPONENT32_OES,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ {
+ static constexpr Format info(GL_ETC1_RGB8_LOSSY_DECODE_ANGLE,
+ angle::FormatID::BC1_RGB_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_ETC1_RGB8_OES:
+ {
+ static constexpr Format info(GL_ETC1_RGB8_OES,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_LUMINANCE16F_EXT:
+ {
+ static constexpr Format info(GL_LUMINANCE16F_EXT,
+ angle::FormatID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>);
+ return info;
+ }
+ case GL_LUMINANCE32F_EXT:
+ {
+ static constexpr Format info(GL_LUMINANCE32F_EXT,
+ angle::FormatID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>);
+ return info;
+ }
+ case GL_LUMINANCE8_ALPHA8_EXT:
+ {
+ static constexpr Format info(GL_LUMINANCE8_ALPHA8_EXT,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_LUMINANCE8_EXT:
+ {
+ static constexpr Format info(GL_LUMINANCE8_EXT,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_LUMINANCE_ALPHA16F_EXT:
+ {
+ static constexpr Format info(GL_LUMINANCE_ALPHA16F_EXT,
+ angle::FormatID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ nullptr);
+ return info;
+ }
+ case GL_LUMINANCE_ALPHA32F_EXT:
+ {
+ static constexpr Format info(GL_LUMINANCE_ALPHA32F_EXT,
+ angle::FormatID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_NONE:
+ {
+ static constexpr Format info(GL_NONE,
+ angle::FormatID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr);
+ return info;
+ }
+ case GL_R11F_G11F_B10F:
+ {
+ static constexpr Format info(GL_R11F_G11F_B10F,
+ angle::FormatID::R11G11B10_FLOAT,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ GL_RGBA16F_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_R16F:
+ {
+ static constexpr Format info(GL_R16F,
+ angle::FormatID::R16_FLOAT,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_FLOAT,
+ GL_RGBA16F_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_R16I:
+ {
+ static constexpr Format info(GL_R16I,
+ angle::FormatID::R16_SINT,
+ DXGI_FORMAT_R16_SINT,
+ DXGI_FORMAT_R16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_SINT,
+ GL_RGBA16I,
+ nullptr);
+ return info;
+ }
+ case GL_R16UI:
+ {
+ static constexpr Format info(GL_R16UI,
+ angle::FormatID::R16_UINT,
+ DXGI_FORMAT_R16_UINT,
+ DXGI_FORMAT_R16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UINT,
+ GL_RGBA16I,
+ nullptr);
+ return info;
+ }
+ case GL_R16_EXT:
+ {
+ static constexpr Format info(GL_R16_EXT,
+ angle::FormatID::R16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_R16_SNORM_EXT:
+ {
+ static constexpr Format info(GL_R16_SNORM_EXT,
+ angle::FormatID::R16_SNORM,
+ DXGI_FORMAT_R16_SNORM,
+ DXGI_FORMAT_R16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_R32F:
+ {
+ static constexpr Format info(GL_R32F,
+ angle::FormatID::R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32_FLOAT,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_R32I:
+ {
+ static constexpr Format info(GL_R32I,
+ angle::FormatID::R32_SINT,
+ DXGI_FORMAT_R32_SINT,
+ DXGI_FORMAT_R32_SINT,
+ DXGI_FORMAT_R32_SINT,
+ DXGI_FORMAT_R32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32_SINT,
+ GL_RGBA32I,
+ nullptr);
+ return info;
+ }
+ case GL_R32UI:
+ {
+ static constexpr Format info(GL_R32UI,
+ angle::FormatID::R32_UINT,
+ DXGI_FORMAT_R32_UINT,
+ DXGI_FORMAT_R32_UINT,
+ DXGI_FORMAT_R32_UINT,
+ DXGI_FORMAT_R32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32_UINT,
+ GL_RGBA32I,
+ nullptr);
+ return info;
+ }
+ case GL_R8:
+ {
+ static constexpr Format info(GL_R8,
+ angle::FormatID::R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_R8I:
+ {
+ static constexpr Format info(GL_R8I,
+ angle::FormatID::R8_SINT,
+ DXGI_FORMAT_R8_SINT,
+ DXGI_FORMAT_R8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_SINT,
+ GL_RGBA8I,
+ nullptr);
+ return info;
+ }
+ case GL_R8UI:
+ {
+ static constexpr Format info(GL_R8UI,
+ angle::FormatID::R8_UINT,
+ DXGI_FORMAT_R8_UINT,
+ DXGI_FORMAT_R8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_UINT,
+ GL_RGBA8I,
+ nullptr);
+ return info;
+ }
+ case GL_R8_SNORM:
+ {
+ static constexpr Format info(GL_R8_SNORM,
+ angle::FormatID::R8_SNORM,
+ DXGI_FORMAT_R8_SNORM,
+ DXGI_FORMAT_R8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr);
+ return info;
+ }
+ case GL_RG16F:
+ {
+ static constexpr Format info(GL_RG16F,
+ angle::FormatID::R16G16_FLOAT,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_FLOAT,
+ GL_RGBA16F_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_RG16I:
+ {
+ static constexpr Format info(GL_RG16I,
+ angle::FormatID::R16G16_SINT,
+ DXGI_FORMAT_R16G16_SINT,
+ DXGI_FORMAT_R16G16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_SINT,
+ GL_RGBA16I,
+ nullptr);
+ return info;
+ }
+ case GL_RG16UI:
+ {
+ static constexpr Format info(GL_RG16UI,
+ angle::FormatID::R16G16_UINT,
+ DXGI_FORMAT_R16G16_UINT,
+ DXGI_FORMAT_R16G16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UINT,
+ GL_RGBA16I,
+ nullptr);
+ return info;
+ }
+ case GL_RG16_EXT:
+ {
+ static constexpr Format info(GL_RG16_EXT,
+ angle::FormatID::R16G16_UNORM,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_RG16_SNORM_EXT:
+ {
+ static constexpr Format info(GL_RG16_SNORM_EXT,
+ angle::FormatID::R16G16_SNORM,
+ DXGI_FORMAT_R16G16_SNORM,
+ DXGI_FORMAT_R16G16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_RG32F:
+ {
+ static constexpr Format info(GL_RG32F,
+ angle::FormatID::R32G32_FLOAT,
+ DXGI_FORMAT_R32G32_FLOAT,
+ DXGI_FORMAT_R32G32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_FLOAT,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_RG32I:
+ {
+ static constexpr Format info(GL_RG32I,
+ angle::FormatID::R32G32_SINT,
+ DXGI_FORMAT_R32G32_SINT,
+ DXGI_FORMAT_R32G32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_SINT,
+ GL_RGBA32I,
+ nullptr);
+ return info;
+ }
+ case GL_RG32UI:
+ {
+ static constexpr Format info(GL_RG32UI,
+ angle::FormatID::R32G32_UINT,
+ DXGI_FORMAT_R32G32_UINT,
+ DXGI_FORMAT_R32G32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_UINT,
+ GL_RGBA32I,
+ nullptr);
+ return info;
+ }
+ case GL_RG8:
+ {
+ static constexpr Format info(GL_RG8,
+ angle::FormatID::R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_RG8I:
+ {
+ static constexpr Format info(GL_RG8I,
+ angle::FormatID::R8G8_SINT,
+ DXGI_FORMAT_R8G8_SINT,
+ DXGI_FORMAT_R8G8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_SINT,
+ GL_RGBA8I,
+ nullptr);
+ return info;
+ }
+ case GL_RG8UI:
+ {
+ static constexpr Format info(GL_RG8UI,
+ angle::FormatID::R8G8_UINT,
+ DXGI_FORMAT_R8G8_UINT,
+ DXGI_FORMAT_R8G8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_UINT,
+ GL_RGBA8I,
+ nullptr);
+ return info;
+ }
+ case GL_RG8_SNORM:
+ {
+ static constexpr Format info(GL_RG8_SNORM,
+ angle::FormatID::R8G8_SNORM,
+ DXGI_FORMAT_R8G8_SNORM,
+ DXGI_FORMAT_R8G8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr);
+ return info;
+ }
+ case GL_RGB:
+ {
+ static constexpr Format info(GL_RGB,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_RGB10_A2:
+ {
+ static constexpr Format info(GL_RGB10_A2,
+ angle::FormatID::R10G10B10A2_UNORM,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_RGB10_A2UI:
+ {
+ static constexpr Format info(GL_RGB10_A2UI,
+ angle::FormatID::R10G10B10A2_UINT,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ GL_RGBA16I,
+ nullptr);
+ return info;
+ }
+ case GL_RGB16F:
+ {
+ static constexpr Format info(GL_RGB16F,
+ angle::FormatID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>);
+ return info;
+ }
+ case GL_RGB16I:
+ {
+ static constexpr Format info(GL_RGB16I,
+ angle::FormatID::R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ GL_RGBA16I,
+ Initialize4ComponentData<GLshort, 0x0000, 0x0000, 0x0000, 0x0001>);
+ return info;
+ }
+ case GL_RGB16UI:
+ {
+ static constexpr Format info(GL_RGB16UI,
+ angle::FormatID::R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ GL_RGBA16UI,
+ Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x0001>);
+ return info;
+ }
+ case GL_RGB16_EXT:
+ {
+ static constexpr Format info(GL_RGB16_EXT,
+ angle::FormatID::R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ GL_RGBA16_EXT,
+ Initialize4ComponentData<GLubyte, 0x0000, 0x0000, 0x0000, 0xFFFF>);
+ return info;
+ }
+ case GL_RGB16_SNORM_EXT:
+ {
+ static constexpr Format info(GL_RGB16_SNORM_EXT,
+ angle::FormatID::R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x7FFF>);
+ return info;
+ }
+ case GL_RGB32F:
+ {
+ static constexpr Format info(GL_RGB32F,
+ angle::FormatID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>);
+ return info;
+ }
+ case GL_RGB32I:
+ {
+ static constexpr Format info(GL_RGB32I,
+ angle::FormatID::R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ GL_RGBA32I,
+ Initialize4ComponentData<GLint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>);
+ return info;
+ }
+ case GL_RGB32UI:
+ {
+ static constexpr Format info(GL_RGB32UI,
+ angle::FormatID::R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ GL_RGBA32UI,
+ Initialize4ComponentData<GLuint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>);
+ return info;
+ }
+ case GL_RGB565:
+ {
+ if (SupportsFormat(DXGI_FORMAT_B5G6R5_UNORM, deviceCaps))
+ {
+ static constexpr Format info(GL_RGB565,
+ angle::FormatID::B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_RGB565,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ }
+ case GL_RGB5_A1:
+ {
+ if (SupportsFormat(DXGI_FORMAT_B5G5R5A1_UNORM, deviceCaps))
+ {
+ static constexpr Format info(GL_RGB5_A1,
+ angle::FormatID::B5G5R5A1_UNORM,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_RGB5_A1,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_RGB8:
+ {
+ static constexpr Format info(GL_RGB8,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_RGB8I:
+ {
+ static constexpr Format info(GL_RGB8I,
+ angle::FormatID::R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ GL_RGBA8I,
+ Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x01>);
+ return info;
+ }
+ case GL_RGB8UI:
+ {
+ static constexpr Format info(GL_RGB8UI,
+ angle::FormatID::R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ GL_RGBA8UI,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0x01>);
+ return info;
+ }
+ case GL_RGB8_SNORM:
+ {
+ static constexpr Format info(GL_RGB8_SNORM,
+ angle::FormatID::R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ GL_RGBA8_SNORM,
+ Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x7F>);
+ return info;
+ }
+ case GL_RGB9_E5:
+ {
+ static constexpr Format info(GL_RGB9_E5,
+ angle::FormatID::R9G9B9E5_SHAREDEXP,
+ DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
+ DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
+ GL_RGBA16F_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA:
+ {
+ static constexpr Format info(GL_RGBA,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA16F:
+ {
+ static constexpr Format info(GL_RGBA16F,
+ angle::FormatID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA16I:
+ {
+ static constexpr Format info(GL_RGBA16I,
+ angle::FormatID::R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ GL_RGBA16I,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA16UI:
+ {
+ static constexpr Format info(GL_RGBA16UI,
+ angle::FormatID::R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ GL_RGBA16UI,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA16_EXT:
+ {
+ static constexpr Format info(GL_RGBA16_EXT,
+ angle::FormatID::R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA16_SNORM_EXT:
+ {
+ static constexpr Format info(GL_RGBA16_SNORM_EXT,
+ angle::FormatID::R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA32F:
+ {
+ static constexpr Format info(GL_RGBA32F,
+ angle::FormatID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA32I:
+ {
+ static constexpr Format info(GL_RGBA32I,
+ angle::FormatID::R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ GL_RGBA32I,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA32UI:
+ {
+ static constexpr Format info(GL_RGBA32UI,
+ angle::FormatID::R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ GL_RGBA32UI,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA4:
+ {
+ if (SupportsFormat(DXGI_FORMAT_B4G4R4A4_UNORM, deviceCaps))
+ {
+ static constexpr Format info(GL_RGBA4,
+ angle::FormatID::B4G4R4A4_UNORM,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ GL_RGBA4,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_RGBA4,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ }
+ case GL_RGBA8:
+ {
+ static constexpr Format info(GL_RGBA8,
+ angle::FormatID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA8I:
+ {
+ static constexpr Format info(GL_RGBA8I,
+ angle::FormatID::R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ GL_RGBA8I,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA8UI:
+ {
+ static constexpr Format info(GL_RGBA8UI,
+ angle::FormatID::R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ GL_RGBA8UI,
+ nullptr);
+ return info;
+ }
+ case GL_RGBA8_SNORM:
+ {
+ static constexpr Format info(GL_RGBA8_SNORM,
+ angle::FormatID::R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr);
+ return info;
+ }
+ case GL_SRGB8:
+ {
+ static constexpr Format info(GL_SRGB8,
+ angle::FormatID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ return info;
+ }
+ case GL_SRGB8_ALPHA8:
+ {
+ static constexpr Format info(GL_SRGB8_ALPHA8,
+ angle::FormatID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ nullptr);
+ return info;
+ }
+ case GL_STENCIL_INDEX8:
+ {
+ if (OnlyFL10Plus(deviceCaps))
+ {
+ static constexpr Format info(GL_STENCIL_INDEX8,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ else
+ {
+ static constexpr Format info(GL_STENCIL_INDEX8,
+ angle::FormatID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr);
+ return info;
+ }
+ }
+
+ default:
+ break;
+ }
+ // clang-format on
+
+ UNREACHABLE();
+ static constexpr Format defaultInfo;
+ return defaultInfo;
+}
+
+} // namespace d3d11
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h
new file mode 100644
index 0000000000..f46f769182
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_utils.h
@@ -0,0 +1,90 @@
+//
+// Copyright 2016 The ANGLE Project 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 routines for the D3D11 texture format table.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_TEXTURE_FORMAT_TABLE_UTILS_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_TEXTURE_FORMAT_TABLE_UTILS_H_
+
+#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+using FormatSupportFunction = bool (*)(const Renderer11DeviceCaps &);
+
+inline bool OnlyFL11_1Plus(const Renderer11DeviceCaps &deviceCaps)
+{
+ return (deviceCaps.featureLevel >= D3D_FEATURE_LEVEL_11_1);
+}
+
+inline bool OnlyFL10Plus(const Renderer11DeviceCaps &deviceCaps)
+{
+ return (deviceCaps.featureLevel >= D3D_FEATURE_LEVEL_10_0);
+}
+
+inline bool OnlyFL9_3(const Renderer11DeviceCaps &deviceCaps)
+{
+ return (deviceCaps.featureLevel == D3D_FEATURE_LEVEL_9_3);
+}
+
+inline bool SupportsFormat(DXGI_FORMAT format, const Renderer11DeviceCaps &deviceCaps)
+{
+ // Must support texture, SRV and RTV support
+ UINT mustSupport = D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURECUBE |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE | D3D11_FORMAT_SUPPORT_MIP |
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET;
+ UINT minimumRequiredSamples = 0;
+
+ if (d3d11_gl::GetMaximumClientVersion(deviceCaps).major > 2)
+ {
+ mustSupport |= D3D11_FORMAT_SUPPORT_TEXTURE3D;
+
+ // RGBA4, RGB5A1 and RGB565 are all required multisampled renderbuffer formats in ES3 and
+ // need to support a minimum of 4 samples.
+ minimumRequiredSamples = 4;
+ }
+
+ bool fullSupport = false;
+ if (format == DXGI_FORMAT_B5G6R5_UNORM)
+ {
+ // All hardware that supports DXGI_FORMAT_B5G6R5_UNORM should support autogen mipmaps, but
+ // check anyway.
+ mustSupport |= D3D11_FORMAT_SUPPORT_MIP_AUTOGEN;
+ fullSupport = ((deviceCaps.B5G6R5support & mustSupport) == mustSupport) &&
+ deviceCaps.B5G6R5maxSamples >= minimumRequiredSamples;
+ }
+ else if (format == DXGI_FORMAT_B4G4R4A4_UNORM)
+ {
+ fullSupport = ((deviceCaps.B4G4R4A4support & mustSupport) == mustSupport) &&
+ deviceCaps.B4G4R4A4maxSamples >= minimumRequiredSamples;
+ }
+ else if (format == DXGI_FORMAT_B5G5R5A1_UNORM)
+ {
+ fullSupport = ((deviceCaps.B5G5R5A1support & mustSupport) == mustSupport) &&
+ deviceCaps.B5G5R5A1maxSamples >= minimumRequiredSamples;
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+
+ // This means that ANGLE would like to use the entry in the map if the inputted DXGI format
+ // *IS* supported.
+ // e.g. the entry might map GL_RGB5_A1 to DXGI_FORMAT_B5G5R5A1, which should only be used if
+ // DXGI_FORMAT_B5G5R5A1 is supported.
+ // In this case, we should only return 'true' if the format *IS* supported.
+ return fullSupport;
+}
+
+} // namespace d3d11
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_TEXTURE_FORMAT_TABLE_UTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp
new file mode 100644
index 0000000000..146c492ddb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp
@@ -0,0 +1,218 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// NativeWindow11Win32.cpp: Implementation of NativeWindow11 using win32 window APIs.
+
+#include "libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h"
+#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
+
+#include "common/debug.h"
+
+// This header must be included before dcomp.h.
+#include <initguid.h>
+
+#include <dcomp.h>
+
+namespace rx
+{
+
+NativeWindow11Win32::NativeWindow11Win32(EGLNativeWindowType window,
+ bool hasAlpha,
+ bool directComposition)
+ : NativeWindow11(window),
+ mDirectComposition(directComposition),
+ mHasAlpha(hasAlpha),
+ mDevice(nullptr),
+ mCompositionTarget(nullptr),
+ mVisual(nullptr)
+{}
+
+NativeWindow11Win32::~NativeWindow11Win32()
+{
+ SafeRelease(mCompositionTarget);
+ SafeRelease(mDevice);
+ SafeRelease(mVisual);
+}
+
+bool NativeWindow11Win32::initialize()
+{
+ return true;
+}
+
+bool NativeWindow11Win32::getClientRect(LPRECT rect) const
+{
+ return GetClientRect(getNativeWindow(), rect) == TRUE;
+}
+
+bool NativeWindow11Win32::isIconic() const
+{
+ return IsIconic(getNativeWindow()) == TRUE;
+}
+
+HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device,
+ IDXGIFactory *factory,
+ DXGI_FORMAT format,
+ UINT width,
+ UINT height,
+ UINT samples,
+ IDXGISwapChain **swapChain)
+{
+ if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 ||
+ height == 0)
+ {
+ return E_INVALIDARG;
+ }
+
+ if (mDirectComposition)
+ {
+ HMODULE dcomp = ::GetModuleHandle(TEXT("dcomp.dll"));
+ if (!dcomp)
+ {
+ return E_INVALIDARG;
+ }
+
+ typedef HRESULT(WINAPI * PFN_DCOMPOSITION_CREATE_DEVICE)(
+ IDXGIDevice * dxgiDevice, REFIID iid, void **dcompositionDevice);
+ PFN_DCOMPOSITION_CREATE_DEVICE createDComp =
+ reinterpret_cast<PFN_DCOMPOSITION_CREATE_DEVICE>(
+ GetProcAddress(dcomp, "DCompositionCreateDevice"));
+ if (!createDComp)
+ {
+ return E_INVALIDARG;
+ }
+
+ if (!mDevice)
+ {
+ IDXGIDevice *dxgiDevice = d3d11::DynamicCastComObject<IDXGIDevice>(device);
+ HRESULT result = createDComp(dxgiDevice, __uuidof(IDCompositionDevice),
+ reinterpret_cast<void **>(&mDevice));
+ SafeRelease(dxgiDevice);
+
+ if (FAILED(result))
+ {
+ return result;
+ }
+ }
+
+ if (!mCompositionTarget)
+ {
+ HRESULT result =
+ mDevice->CreateTargetForHwnd(getNativeWindow(), TRUE, &mCompositionTarget);
+ if (FAILED(result))
+ {
+ return result;
+ }
+ }
+
+ if (!mVisual)
+ {
+ HRESULT result = mDevice->CreateVisual(&mVisual);
+ if (FAILED(result))
+ {
+ return result;
+ }
+ }
+
+ IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory);
+ DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
+ swapChainDesc.Width = width;
+ swapChainDesc.Height = height;
+ swapChainDesc.Format = format;
+ swapChainDesc.Stereo = FALSE;
+ swapChainDesc.SampleDesc.Count = 1;
+ swapChainDesc.SampleDesc.Quality = 0;
+ swapChainDesc.BufferUsage =
+ DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER | DXGI_USAGE_SHADER_INPUT;
+ swapChainDesc.BufferCount = 2;
+ swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
+ swapChainDesc.AlphaMode =
+ mHasAlpha ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE;
+ swapChainDesc.Flags = 0;
+ IDXGISwapChain1 *swapChain1 = nullptr;
+ HRESULT result =
+ factory2->CreateSwapChainForComposition(device, &swapChainDesc, nullptr, &swapChain1);
+ if (SUCCEEDED(result))
+ {
+ *swapChain = static_cast<IDXGISwapChain *>(swapChain1);
+ }
+ mVisual->SetContent(swapChain1);
+ mCompositionTarget->SetRoot(mVisual);
+ SafeRelease(factory2);
+ return result;
+ }
+
+ // Use IDXGIFactory2::CreateSwapChainForHwnd if DXGI 1.2 is available to create a
+ // DXGI_SWAP_EFFECT_SEQUENTIAL swap chain.
+ IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory);
+ if (factory2 != nullptr)
+ {
+ DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
+ swapChainDesc.Width = width;
+ swapChainDesc.Height = height;
+ swapChainDesc.Format = format;
+ swapChainDesc.Stereo = FALSE;
+ swapChainDesc.SampleDesc.Count = samples;
+ swapChainDesc.SampleDesc.Quality = 0;
+ swapChainDesc.BufferUsage =
+ DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_BACK_BUFFER;
+ swapChainDesc.BufferCount = 1;
+ swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL;
+ swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
+ swapChainDesc.Flags = 0;
+ IDXGISwapChain1 *swapChain1 = nullptr;
+ HRESULT result = factory2->CreateSwapChainForHwnd(device, getNativeWindow(), &swapChainDesc,
+ nullptr, nullptr, &swapChain1);
+ if (SUCCEEDED(result))
+ {
+ factory2->MakeWindowAssociation(getNativeWindow(), DXGI_MWA_NO_ALT_ENTER);
+ *swapChain = static_cast<IDXGISwapChain *>(swapChain1);
+ }
+ SafeRelease(factory2);
+ return result;
+ }
+
+ DXGI_SWAP_CHAIN_DESC swapChainDesc = {};
+ swapChainDesc.BufferCount = 1;
+ swapChainDesc.BufferDesc.Format = format;
+ swapChainDesc.BufferDesc.Width = width;
+ swapChainDesc.BufferDesc.Height = height;
+ swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
+ swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
+ swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
+ swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
+ swapChainDesc.BufferUsage =
+ DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_BACK_BUFFER;
+ swapChainDesc.Flags = 0;
+ swapChainDesc.OutputWindow = getNativeWindow();
+ swapChainDesc.SampleDesc.Count = samples;
+ swapChainDesc.SampleDesc.Quality = 0;
+ swapChainDesc.Windowed = TRUE;
+ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+
+ HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain);
+ if (SUCCEEDED(result))
+ {
+ factory->MakeWindowAssociation(getNativeWindow(), DXGI_MWA_NO_ALT_ENTER);
+ }
+ return result;
+}
+
+void NativeWindow11Win32::commitChange()
+{
+ if (mDevice)
+ {
+ mDevice->Commit();
+ }
+}
+
+// static
+bool NativeWindow11Win32::IsValidNativeWindow(EGLNativeWindowType window)
+{
+ return IsWindow(window) == TRUE;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h
new file mode 100644
index 0000000000..baeba6a347
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.h
@@ -0,0 +1,53 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// NativeWindow11Win32.h: Implementation of NativeWindow11 using win32 window APIs.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_WIN32_NATIVEWINDOW11WIN32_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_WIN32_NATIVEWINDOW11WIN32_H_
+
+#include "libANGLE/renderer/d3d/d3d11/NativeWindow11.h"
+
+typedef interface IDCompositionDevice IDCompositionDevice;
+typedef interface IDCompositionTarget IDCompositionTarget;
+typedef interface IDCompositionVisual IDCompositionVisual;
+
+namespace rx
+{
+
+class NativeWindow11Win32 : public NativeWindow11
+{
+ public:
+ NativeWindow11Win32(EGLNativeWindowType window, bool hasAlpha, bool directComposition);
+ ~NativeWindow11Win32() override;
+
+ bool initialize() override;
+ bool getClientRect(LPRECT rect) const override;
+ bool isIconic() const override;
+
+ HRESULT createSwapChain(ID3D11Device *device,
+ IDXGIFactory *factory,
+ DXGI_FORMAT format,
+ UINT width,
+ UINT height,
+ UINT samples,
+ IDXGISwapChain **swapChain) override;
+
+ void commitChange() override;
+
+ static bool IsValidNativeWindow(EGLNativeWindowType window);
+
+ private:
+ bool mDirectComposition;
+ bool mHasAlpha;
+ IDCompositionDevice *mDevice;
+ IDCompositionTarget *mCompositionTarget;
+ IDCompositionVisual *mVisual;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_WIN32_NATIVEWINDOW11WIN32_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
new file mode 100644
index 0000000000..44362bd11a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
@@ -0,0 +1,760 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit9.cpp: Surface copy utility class.
+
+#include "libANGLE/renderer/d3d/d3d9/Blit9.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace
+{
+// Precompiled shaders
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h"
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h"
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h"
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h"
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h"
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h"
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h"
+#include "libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h"
+
+const BYTE *const g_shaderCode[] = {
+ g_vs20_standardvs,
+ g_ps20_passthroughps,
+ g_ps20_luminanceps,
+ g_ps20_luminancepremultps,
+ g_ps20_luminanceunmultps,
+ g_ps20_componentmaskps,
+ g_ps20_componentmaskpremultps,
+ g_ps20_componentmaskunmultps,
+};
+
+const size_t g_shaderSize[] = {
+ sizeof(g_vs20_standardvs),
+ sizeof(g_ps20_passthroughps),
+ sizeof(g_ps20_luminanceps),
+ sizeof(g_ps20_luminancepremultps),
+ sizeof(g_ps20_luminanceunmultps),
+ sizeof(g_ps20_componentmaskps),
+ sizeof(g_ps20_componentmaskpremultps),
+ sizeof(g_ps20_componentmaskunmultps),
+};
+} // namespace
+
+namespace rx
+{
+
+Blit9::Blit9(Renderer9 *renderer)
+ : mRenderer(renderer),
+ mGeometryLoaded(false),
+ mQuadVertexBuffer(nullptr),
+ mQuadVertexDeclaration(nullptr),
+ mSavedStateBlock(nullptr),
+ mSavedRenderTarget(nullptr),
+ mSavedDepthStencil(nullptr)
+{
+ memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
+}
+
+Blit9::~Blit9()
+{
+ SafeRelease(mSavedStateBlock);
+ SafeRelease(mQuadVertexBuffer);
+ SafeRelease(mQuadVertexDeclaration);
+
+ for (int i = 0; i < SHADER_COUNT; i++)
+ {
+ SafeRelease(mCompiledShaders[i]);
+ }
+}
+
+angle::Result Blit9::initialize(Context9 *context9)
+{
+ if (mGeometryLoaded)
+ {
+ return angle::Result::Continue;
+ }
+
+ static const float quad[] = {-1, -1, -1, 1, 1, -1, 1, 1};
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ HRESULT result = device->CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0,
+ D3DPOOL_DEFAULT, &mQuadVertexBuffer, nullptr);
+
+ ANGLE_TRY_HR(context9, result, "Failed to create internal blit vertex shader");
+
+ void *lockPtr = nullptr;
+ result = mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0);
+
+ ANGLE_TRY_HR(context9, result, "Failed to lock internal blit vertex shader");
+ ASSERT(lockPtr);
+
+ memcpy(lockPtr, quad, sizeof(quad));
+ mQuadVertexBuffer->Unlock();
+
+ static const D3DVERTEXELEMENT9 elements[] = {
+ {0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, D3DDECL_END()};
+
+ result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration);
+ ANGLE_TRY_HR(context9, result, "Failed to create internal blit vertex shader declaration");
+
+ mGeometryLoaded = true;
+ return angle::Result::Continue;
+}
+
+template <class D3DShaderType>
+angle::Result Blit9::setShader(Context9 *context9,
+ ShaderId source,
+ const char *profile,
+ angle::Result (Renderer9::*createShader)(d3d::Context *,
+ const DWORD *,
+ size_t length,
+ D3DShaderType **outShader),
+ HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType *))
+{
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ D3DShaderType *shader = nullptr;
+
+ if (mCompiledShaders[source] != nullptr)
+ {
+ shader = static_cast<D3DShaderType *>(mCompiledShaders[source]);
+ }
+ else
+ {
+ const BYTE *shaderCode = g_shaderCode[source];
+ size_t shaderSize = g_shaderSize[source];
+ ANGLE_TRY((mRenderer->*createShader)(context9, reinterpret_cast<const DWORD *>(shaderCode),
+ shaderSize, &shader));
+ mCompiledShaders[source] = shader;
+ }
+
+ HRESULT hr = (device->*setShader)(shader);
+ ANGLE_TRY_HR(context9, hr, "Failed to set shader for blit operation");
+ return angle::Result::Continue;
+}
+
+angle::Result Blit9::setVertexShader(Context9 *context9, ShaderId shader)
+{
+ return setShader<IDirect3DVertexShader9>(context9, shader, "vs_2_0",
+ &Renderer9::createVertexShader,
+ &IDirect3DDevice9::SetVertexShader);
+}
+
+angle::Result Blit9::setPixelShader(Context9 *context9, ShaderId shader)
+{
+ return setShader<IDirect3DPixelShader9>(context9, shader, "ps_2_0",
+ &Renderer9::createPixelShader,
+ &IDirect3DDevice9::SetPixelShader);
+}
+
+RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
+{
+ D3DSURFACE_DESC desc;
+ surface->GetDesc(&desc);
+
+ RECT rect;
+ rect.left = 0;
+ rect.top = 0;
+ rect.right = desc.Width;
+ rect.bottom = desc.Height;
+
+ return rect;
+}
+
+gl::Extents Blit9::getSurfaceSize(IDirect3DSurface9 *surface) const
+{
+ D3DSURFACE_DESC desc;
+ surface->GetDesc(&desc);
+
+ return gl::Extents(desc.Width, desc.Height, 1);
+}
+
+angle::Result Blit9::boxFilter(Context9 *context9,
+ IDirect3DSurface9 *source,
+ IDirect3DSurface9 *dest)
+{
+ ANGLE_TRY(initialize(context9));
+
+ angle::ComPtr<IDirect3DBaseTexture9> texture = nullptr;
+ ANGLE_TRY(copySurfaceToTexture(context9, source, getSurfaceRect(source), &texture));
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ saveState();
+
+ device->SetTexture(0, texture.Get());
+ device->SetRenderTarget(0, dest);
+
+ ANGLE_TRY(setVertexShader(context9, SHADER_VS_STANDARD));
+ ANGLE_TRY(setPixelShader(context9, SHADER_PS_PASSTHROUGH));
+
+ setCommonBlitState();
+ device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
+ device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
+
+ setViewportAndShaderConstants(getSurfaceRect(source), getSurfaceSize(source),
+ getSurfaceRect(dest), false);
+
+ render();
+
+ restoreState();
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit9::copy2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
+{
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ ANGLE_TRY(initialize(context9));
+
+ const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorAttachment(0);
+ ASSERT(colorbuffer);
+
+ RenderTarget9 *renderTarget9 = nullptr;
+ ANGLE_TRY(colorbuffer->getRenderTarget(context, &renderTarget9));
+ ASSERT(renderTarget9);
+
+ angle::ComPtr<IDirect3DSurface9> source = renderTarget9->getSurface();
+ ASSERT(source);
+
+ angle::ComPtr<IDirect3DSurface9> destSurface = nullptr;
+ TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
+ ANGLE_TRY(
+ storage9->getSurfaceLevel(context, gl::TextureTarget::_2D, level, true, &destSurface));
+ ASSERT(destSurface);
+
+ ANGLE_TRY(copy(context9, source.Get(), nullptr, sourceRect, destFormat, destOffset,
+ destSurface.Get(), false, false, false));
+ return angle::Result::Continue;
+}
+
+angle::Result Blit9::copyCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level)
+{
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ ANGLE_TRY(initialize(context9));
+
+ const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorAttachment(0);
+ ASSERT(colorbuffer);
+
+ RenderTarget9 *renderTarget9 = nullptr;
+ ANGLE_TRY(colorbuffer->getRenderTarget(context, &renderTarget9));
+ ASSERT(renderTarget9);
+
+ angle::ComPtr<IDirect3DSurface9> source = renderTarget9->getSurface();
+ ASSERT(source);
+
+ angle::ComPtr<IDirect3DSurface9> destSurface = nullptr;
+ TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
+ ANGLE_TRY(storage9->getSurfaceLevel(context, target, level, true, &destSurface));
+ ASSERT(destSurface);
+
+ return copy(context9, source.Get(), nullptr, sourceRect, destFormat, destOffset,
+ destSurface.Get(), false, false, false);
+}
+
+angle::Result Blit9::copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha)
+{
+ Context9 *context9 = GetImplAs<Context9>(context);
+ ANGLE_TRY(initialize(context9));
+
+ TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
+
+ TextureStorage *sourceStorage = nullptr;
+ ANGLE_TRY(sourceD3D->getNativeTexture(context, &sourceStorage));
+
+ TextureStorage9_2D *sourceStorage9 = GetAs<TextureStorage9_2D>(sourceStorage);
+ ASSERT(sourceStorage9);
+
+ TextureStorage9 *destStorage9 = GetAs<TextureStorage9>(storage);
+ ASSERT(destStorage9);
+
+ ASSERT(sourceLevel == 0);
+ IDirect3DBaseTexture9 *sourceTexture = nullptr;
+ ANGLE_TRY(sourceStorage9->getBaseTexture(context, &sourceTexture));
+
+ angle::ComPtr<IDirect3DSurface9> sourceSurface = nullptr;
+ ANGLE_TRY(sourceStorage9->getSurfaceLevel(context, gl::TextureTarget::_2D, sourceLevel, true,
+ &sourceSurface));
+
+ angle::ComPtr<IDirect3DSurface9> destSurface = nullptr;
+ ANGLE_TRY(destStorage9->getSurfaceLevel(context, destTarget, destLevel, true, &destSurface));
+
+ return copy(context9, sourceSurface.Get(), sourceTexture, sourceRect, destFormat, destOffset,
+ destSurface.Get(), flipY, premultiplyAlpha, unmultiplyAlpha);
+}
+
+angle::Result Blit9::copy(Context9 *context9,
+ IDirect3DSurface9 *source,
+ IDirect3DBaseTexture9 *sourceTexture,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ IDirect3DSurface9 *dest,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha)
+{
+ ASSERT(source != nullptr && dest != nullptr);
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ D3DSURFACE_DESC sourceDesc;
+ D3DSURFACE_DESC destDesc;
+ source->GetDesc(&sourceDesc);
+ dest->GetDesc(&destDesc);
+
+ // Check if it's possible to use StetchRect
+ if (sourceDesc.Format == destDesc.Format && (destDesc.Usage & D3DUSAGE_RENDERTARGET) &&
+ d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat) && !flipY &&
+ premultiplyAlpha == unmultiplyAlpha)
+ {
+ RECT destRect = {destOffset.x, destOffset.y,
+ destOffset.x + (sourceRect.right - sourceRect.left),
+ destOffset.y + (sourceRect.bottom - sourceRect.top)};
+ HRESULT result = device->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_POINT);
+ ANGLE_TRY_HR(context9, result, "StretchRect failed to blit between textures");
+ return angle::Result::Continue;
+ }
+
+ angle::ComPtr<IDirect3DBaseTexture9> texture = sourceTexture;
+ RECT adjustedSourceRect = sourceRect;
+ gl::Extents sourceSize(sourceDesc.Width, sourceDesc.Height, 1);
+
+ if (texture == nullptr)
+ {
+ ANGLE_TRY(copySurfaceToTexture(context9, source, sourceRect, &texture));
+
+ // copySurfaceToTexture only copies in the sourceRect area of the source surface.
+ // Adjust sourceRect so that it is now covering the entire source texture
+ adjustedSourceRect.left = 0;
+ adjustedSourceRect.right = sourceRect.right - sourceRect.left;
+ adjustedSourceRect.top = 0;
+ adjustedSourceRect.bottom = sourceRect.bottom - sourceRect.top;
+
+ sourceSize.width = sourceRect.right - sourceRect.left;
+ sourceSize.height = sourceRect.bottom - sourceRect.top;
+ }
+
+ ANGLE_TRY(formatConvert(context9, texture.Get(), adjustedSourceRect, sourceSize, destFormat,
+ destOffset, dest, flipY, premultiplyAlpha, unmultiplyAlpha));
+ return angle::Result::Continue;
+}
+
+angle::Result Blit9::formatConvert(Context9 *context9,
+ IDirect3DBaseTexture9 *source,
+ const RECT &sourceRect,
+ const gl::Extents &sourceSize,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ IDirect3DSurface9 *dest,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha)
+{
+ ANGLE_TRY(initialize(context9));
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ saveState();
+
+ device->SetTexture(0, source);
+ device->SetRenderTarget(0, dest);
+
+ RECT destRect;
+ destRect.left = destOffset.x;
+ destRect.right = destOffset.x + (sourceRect.right - sourceRect.left);
+ destRect.top = destOffset.y;
+ destRect.bottom = destOffset.y + (sourceRect.bottom - sourceRect.top);
+
+ setViewportAndShaderConstants(sourceRect, sourceSize, destRect, flipY);
+
+ setCommonBlitState();
+
+ angle::Result result =
+ setFormatConvertShaders(context9, destFormat, flipY, premultiplyAlpha, unmultiplyAlpha);
+ if (result == angle::Result::Continue)
+ {
+ render();
+ }
+
+ restoreState();
+
+ return result;
+}
+
+angle::Result Blit9::setFormatConvertShaders(Context9 *context9,
+ GLenum destFormat,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha)
+{
+ ANGLE_TRY(setVertexShader(context9, SHADER_VS_STANDARD));
+
+ switch (destFormat)
+ {
+ case GL_RGBA:
+ case GL_BGRA_EXT:
+ case GL_RGB:
+ case GL_RG_EXT:
+ case GL_RED_EXT:
+ case GL_ALPHA:
+ if (premultiplyAlpha == unmultiplyAlpha)
+ {
+ ANGLE_TRY(setPixelShader(context9, SHADER_PS_COMPONENTMASK));
+ }
+ else if (premultiplyAlpha)
+ {
+ ANGLE_TRY(setPixelShader(context9, SHADER_PS_COMPONENTMASK_PREMULTIPLY_ALPHA));
+ }
+ else
+ {
+ ASSERT(unmultiplyAlpha);
+ ANGLE_TRY(setPixelShader(context9, SHADER_PS_COMPONENTMASK_UNMULTIPLY_ALPHA));
+ }
+ break;
+
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ if (premultiplyAlpha == unmultiplyAlpha)
+ {
+ ANGLE_TRY(setPixelShader(context9, SHADER_PS_LUMINANCE));
+ }
+ else if (premultiplyAlpha)
+ {
+ ANGLE_TRY(setPixelShader(context9, SHADER_PS_LUMINANCE_PREMULTIPLY_ALPHA));
+ }
+ else
+ {
+ ASSERT(unmultiplyAlpha);
+ ANGLE_TRY(setPixelShader(context9, SHADER_PS_LUMINANCE_UNMULTIPLY_ALPHA));
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ enum
+ {
+ X = 0,
+ Y = 1,
+ Z = 2,
+ W = 3
+ };
+
+ // The meaning of this constant depends on the shader that was selected.
+ // See the shader assembly code above for details.
+ // Allocate one array for both registers and split it into two float4's.
+ float psConst[8] = {0};
+ float *multConst = &psConst[0];
+ float *addConst = &psConst[4];
+
+ switch (destFormat)
+ {
+ case GL_RGBA:
+ case GL_BGRA_EXT:
+ multConst[X] = 1;
+ multConst[Y] = 1;
+ multConst[Z] = 1;
+ multConst[W] = 1;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 0;
+ break;
+
+ case GL_RGB:
+ multConst[X] = 1;
+ multConst[Y] = 1;
+ multConst[Z] = 1;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
+ break;
+
+ case GL_RG_EXT:
+ multConst[X] = 1;
+ multConst[Y] = 1;
+ multConst[Z] = 0;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
+ break;
+
+ case GL_RED_EXT:
+ multConst[X] = 1;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
+ break;
+
+ case GL_ALPHA:
+ multConst[X] = 0;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 1;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 0;
+ break;
+
+ case GL_LUMINANCE:
+ multConst[X] = 1;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 0;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 1;
+ break;
+
+ case GL_LUMINANCE_ALPHA:
+ multConst[X] = 1;
+ multConst[Y] = 0;
+ multConst[Z] = 0;
+ multConst[W] = 1;
+ addConst[X] = 0;
+ addConst[Y] = 0;
+ addConst[Z] = 0;
+ addConst[W] = 0;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Blit9::copySurfaceToTexture(Context9 *context9,
+ IDirect3DSurface9 *surface,
+ const RECT &sourceRect,
+ angle::ComPtr<IDirect3DBaseTexture9> *outTexture)
+{
+ ASSERT(surface);
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ D3DSURFACE_DESC sourceDesc;
+ surface->GetDesc(&sourceDesc);
+
+ // Copy the render target into a texture
+ angle::ComPtr<IDirect3DTexture9> texture;
+ HRESULT result = device->CreateTexture(
+ sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1,
+ D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, nullptr);
+ ANGLE_TRY_HR(context9, result, "Failed to allocate internal texture for blit");
+
+ angle::ComPtr<IDirect3DSurface9> textureSurface;
+ result = texture->GetSurfaceLevel(0, &textureSurface);
+ ANGLE_TRY_HR(context9, result, "Failed to query surface of internal blit texture");
+
+ mRenderer->endScene();
+ result = device->StretchRect(surface, &sourceRect, textureSurface.Get(), nullptr, D3DTEXF_NONE);
+ ANGLE_TRY_HR(context9, result, "Failed to copy between internal blit textures");
+ *outTexture = texture;
+
+ return angle::Result::Continue;
+}
+
+void Blit9::setViewportAndShaderConstants(const RECT &sourceRect,
+ const gl::Extents &sourceSize,
+ const RECT &destRect,
+ bool flipY)
+{
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ D3DVIEWPORT9 vp;
+ vp.X = destRect.left;
+ vp.Y = destRect.top;
+ vp.Width = destRect.right - destRect.left;
+ vp.Height = destRect.bottom - destRect.top;
+ vp.MinZ = 0.0f;
+ vp.MaxZ = 1.0f;
+ device->SetViewport(&vp);
+
+ float vertexConstants[8] = {
+ // halfPixelAdjust
+ -1.0f / vp.Width,
+ 1.0f / vp.Height,
+ 0,
+ 0,
+ // texcoordOffset
+ static_cast<float>(sourceRect.left) / sourceSize.width,
+ static_cast<float>(flipY ? sourceRect.bottom : sourceRect.top) / sourceSize.height,
+ static_cast<float>(sourceRect.right - sourceRect.left) / sourceSize.width,
+ static_cast<float>(flipY ? sourceRect.top - sourceRect.bottom
+ : sourceRect.bottom - sourceRect.top) /
+ sourceSize.height,
+ };
+
+ device->SetVertexShaderConstantF(0, vertexConstants, 2);
+}
+
+void Blit9::setCommonBlitState()
+{
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ device->SetDepthStencilSurface(nullptr);
+
+ device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+ device->SetRenderState(D3DRS_COLORWRITEENABLE,
+ D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE |
+ D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
+ device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
+ device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+
+ device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_SRGBTEXTURE, FALSE);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+
+ RECT scissorRect = {0}; // Scissoring is disabled for flipping, but we need this to capture and
+ // restore the old rectangle
+ device->SetScissorRect(&scissorRect);
+
+ for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
+ {
+ device->SetStreamSourceFreq(i, 1);
+ }
+}
+
+void Blit9::render()
+{
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ HRESULT hr = device->SetStreamSource(0, mQuadVertexBuffer, 0, 2 * sizeof(float));
+ hr = device->SetVertexDeclaration(mQuadVertexDeclaration);
+
+ mRenderer->startScene();
+ hr = device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
+}
+
+void Blit9::saveState()
+{
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ HRESULT hr;
+
+ device->GetDepthStencilSurface(&mSavedDepthStencil);
+ device->GetRenderTarget(0, &mSavedRenderTarget);
+
+ if (mSavedStateBlock == nullptr)
+ {
+ hr = device->BeginStateBlock();
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+ setCommonBlitState();
+
+ static const float dummyConst[8] = {0};
+
+ device->SetVertexShader(nullptr);
+ device->SetVertexShaderConstantF(0, dummyConst, 2);
+ device->SetPixelShader(nullptr);
+ device->SetPixelShaderConstantF(0, dummyConst, 2);
+
+ D3DVIEWPORT9 dummyVp;
+ dummyVp.X = 0;
+ dummyVp.Y = 0;
+ dummyVp.Width = 1;
+ dummyVp.Height = 1;
+ dummyVp.MinZ = 0;
+ dummyVp.MaxZ = 1;
+
+ device->SetViewport(&dummyVp);
+
+ device->SetTexture(0, nullptr);
+
+ device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);
+
+ device->SetVertexDeclaration(mQuadVertexDeclaration);
+
+ hr = device->EndStateBlock(&mSavedStateBlock);
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+ }
+
+ ASSERT(mSavedStateBlock != nullptr);
+
+ if (mSavedStateBlock != nullptr)
+ {
+ hr = mSavedStateBlock->Capture();
+ ASSERT(SUCCEEDED(hr));
+ }
+}
+
+void Blit9::restoreState()
+{
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ device->SetDepthStencilSurface(mSavedDepthStencil);
+ SafeRelease(mSavedDepthStencil);
+
+ device->SetRenderTarget(0, mSavedRenderTarget);
+ SafeRelease(mSavedRenderTarget);
+
+ ASSERT(mSavedStateBlock != nullptr);
+
+ if (mSavedStateBlock != nullptr)
+ {
+ mSavedStateBlock->Apply();
+ }
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h
new file mode 100644
index 0000000000..5617552069
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h
@@ -0,0 +1,166 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Blit9.cpp: Surface copy utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
+
+#include "common/PackedEnums.h"
+#include "common/angleutils.h"
+#include "libANGLE/Error.h"
+
+namespace gl
+{
+class Context;
+class Framebuffer;
+class Texture;
+struct Extents;
+struct Offset;
+} // namespace gl
+
+namespace rx
+{
+class Context9;
+class Renderer9;
+class TextureStorage;
+
+namespace d3d
+{
+class Context;
+} // namespace d3d
+
+class Blit9 : angle::NonCopyable
+{
+ public:
+ explicit Blit9(Renderer9 *renderer);
+ ~Blit9();
+
+ angle::Result initialize(Context9 *context9);
+
+ // Copy from source surface to dest surface.
+ // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
+ angle::Result copy2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level);
+ angle::Result copyCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level);
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha);
+
+ // 2x2 box filter sample from source to dest.
+ // Requires that source is RGB(A) and dest has the same format as source.
+ angle::Result boxFilter(Context9 *context9, IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
+
+ private:
+ Renderer9 *mRenderer;
+
+ bool mGeometryLoaded;
+ IDirect3DVertexBuffer9 *mQuadVertexBuffer;
+ IDirect3DVertexDeclaration9 *mQuadVertexDeclaration;
+
+ // Copy from source texture to dest surface.
+ // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
+ // source is interpreted as RGBA and destFormat specifies the desired result format. For
+ // example, if destFormat = GL_RGB, the alpha channel will be forced to 0.
+ angle::Result formatConvert(Context9 *context9,
+ IDirect3DBaseTexture9 *source,
+ const RECT &sourceRect,
+ const gl::Extents &sourceSize,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ IDirect3DSurface9 *dest,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha);
+ angle::Result setFormatConvertShaders(Context9 *context9,
+ GLenum destFormat,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha);
+
+ angle::Result copy(Context9 *context9,
+ IDirect3DSurface9 *source,
+ IDirect3DBaseTexture9 *sourceTexture,
+ const RECT &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ IDirect3DSurface9 *dest,
+ bool flipY,
+ bool premultiplyAlpha,
+ bool unmultiplyAlpha);
+ angle::Result copySurfaceToTexture(Context9 *context9,
+ IDirect3DSurface9 *surface,
+ const RECT &sourceRect,
+ angle::ComPtr<IDirect3DBaseTexture9> *outTexture);
+ void setViewportAndShaderConstants(const RECT &sourceRect,
+ const gl::Extents &sourceSize,
+ const RECT &destRect,
+ bool flipY);
+ void setCommonBlitState();
+ RECT getSurfaceRect(IDirect3DSurface9 *surface) const;
+ gl::Extents getSurfaceSize(IDirect3DSurface9 *surface) const;
+
+ // This enum is used to index mCompiledShaders and mShaderSource.
+ enum ShaderId
+ {
+ SHADER_VS_STANDARD,
+ SHADER_PS_PASSTHROUGH,
+ SHADER_PS_LUMINANCE,
+ SHADER_PS_LUMINANCE_PREMULTIPLY_ALPHA,
+ SHADER_PS_LUMINANCE_UNMULTIPLY_ALPHA,
+ SHADER_PS_COMPONENTMASK,
+ SHADER_PS_COMPONENTMASK_PREMULTIPLY_ALPHA,
+ SHADER_PS_COMPONENTMASK_UNMULTIPLY_ALPHA,
+ SHADER_COUNT,
+ };
+
+ // This actually contains IDirect3DVertexShader9 or IDirect3DPixelShader9 casted to IUnknown.
+ IUnknown *mCompiledShaders[SHADER_COUNT];
+
+ template <class D3DShaderType>
+ angle::Result setShader(Context9 *,
+ ShaderId source,
+ const char *profile,
+ angle::Result (Renderer9::*createShader)(d3d::Context *context,
+ const DWORD *,
+ size_t length,
+ D3DShaderType **outShader),
+ HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType *));
+
+ angle::Result setVertexShader(Context9 *context9, ShaderId shader);
+ angle::Result setPixelShader(Context9 *context9, ShaderId shader);
+ void render();
+
+ void saveState();
+ void restoreState();
+ IDirect3DStateBlock9 *mSavedStateBlock;
+ IDirect3DSurface9 *mSavedRenderTarget;
+ IDirect3DSurface9 *mSavedDepthStencil;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
new file mode 100644
index 0000000000..dbf875134b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
@@ -0,0 +1,141 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer9.cpp Defines the Buffer9 class.
+
+#include "libANGLE/renderer/d3d/d3d9/Buffer9.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+
+namespace rx
+{
+
+Buffer9::Buffer9(const gl::BufferState &state, Renderer9 *renderer)
+ : BufferD3D(state, renderer), mSize(0)
+{}
+
+Buffer9::~Buffer9()
+{
+ mSize = 0;
+}
+
+size_t Buffer9::getSize() const
+{
+ return mSize;
+}
+
+bool Buffer9::supportsDirectBinding() const
+{
+ return false;
+}
+
+angle::Result Buffer9::setData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ gl::BufferUsage usage)
+{
+ if (size > mMemory.size())
+ {
+ ANGLE_CHECK_GL_ALLOC(GetImplAs<Context9>(context), mMemory.resize(size));
+ }
+
+ mSize = size;
+ if (data && size > 0)
+ {
+ memcpy(mMemory.data(), data, size);
+ }
+
+ updateD3DBufferUsage(context, usage);
+
+ invalidateStaticData(context);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer9::getData(const gl::Context *context, const uint8_t **outData)
+{
+ if (mMemory.empty())
+ {
+ *outData = nullptr;
+ }
+ else
+ {
+ *outData = mMemory.data();
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer9::setSubData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ size_t offset)
+{
+ if (offset + size > mMemory.size())
+ {
+ ANGLE_CHECK_GL_ALLOC(GetImplAs<Context9>(context), mMemory.resize(size + offset));
+ }
+
+ mSize = std::max(mSize, offset + size);
+ if (data && size > 0)
+ {
+ memcpy(mMemory.data() + offset, data, size);
+ }
+
+ invalidateStaticData(context);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Buffer9::copySubData(const gl::Context *context,
+ BufferImpl *source,
+ GLintptr sourceOffset,
+ GLintptr destOffset,
+ GLsizeiptr size)
+{
+ // Note: this method is currently unreachable
+ Buffer9 *sourceBuffer = GetAs<Buffer9>(source);
+ ASSERT(sourceBuffer);
+
+ memcpy(mMemory.data() + destOffset, sourceBuffer->mMemory.data() + sourceOffset, size);
+
+ invalidateStaticData(context);
+
+ return angle::Result::Continue;
+}
+
+// We do not support buffer mapping in D3D9
+angle::Result Buffer9::map(const gl::Context *context, GLenum access, void **mapPtr)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Buffer9::mapRange(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ void **mapPtr)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Buffer9::unmap(const gl::Context *context, GLboolean *result)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Buffer9::markTransformFeedbackUsage(const gl::Context *context)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
new file mode 100644
index 0000000000..dad120d75b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
@@ -0,0 +1,63 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Buffer9.h: Defines the rx::Buffer9 class which implements rx::BufferImpl via rx::BufferD3D.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_BUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_BUFFER9_H_
+
+#include "common/MemoryBuffer.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+
+namespace rx
+{
+class Renderer9;
+
+class Buffer9 : public BufferD3D
+{
+ public:
+ Buffer9(const gl::BufferState &state, Renderer9 *renderer);
+ ~Buffer9() override;
+
+ // BufferD3D implementation
+ size_t getSize() const override;
+ bool supportsDirectBinding() const override;
+ angle::Result getData(const gl::Context *context, const uint8_t **outData) override;
+
+ // BufferImpl implementation
+ angle::Result setData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ gl::BufferUsage usage) override;
+ angle::Result setSubData(const gl::Context *context,
+ gl::BufferBinding target,
+ const void *data,
+ size_t size,
+ size_t offset) override;
+ angle::Result copySubData(const gl::Context *context,
+ BufferImpl *source,
+ GLintptr sourceOffset,
+ GLintptr destOffset,
+ GLsizeiptr size) override;
+ angle::Result map(const gl::Context *context, GLenum access, void **mapPtr) override;
+ angle::Result mapRange(const gl::Context *context,
+ size_t offset,
+ size_t length,
+ GLbitfield access,
+ void **mapPtr) override;
+ angle::Result unmap(const gl::Context *context, GLboolean *result) override;
+ angle::Result markTransformFeedbackUsage(const gl::Context *context) override;
+
+ private:
+ angle::MemoryBuffer mMemory;
+ size_t mSize;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_BUFFER9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
new file mode 100644
index 0000000000..26d28e67e3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
@@ -0,0 +1,369 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context9:
+// D3D9-specific functionality associated with a GL Context.
+//
+
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+
+#include "common/string_utils.h"
+#include "libANGLE/renderer/d3d/CompilerD3D.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
+#include "libANGLE/renderer/d3d/SamplerD3D.h"
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/Buffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/Fence9.h"
+#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/Query9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/StateManager9.h"
+#include "libANGLE/renderer/d3d/d3d9/VertexArray9.h"
+
+namespace rx
+{
+
+Context9::Context9(const gl::State &state, gl::ErrorSet *errorSet, Renderer9 *renderer)
+ : ContextD3D(state, errorSet), mRenderer(renderer)
+{}
+
+Context9::~Context9() {}
+
+angle::Result Context9::initialize()
+{
+ return angle::Result::Continue;
+}
+
+void Context9::onDestroy(const gl::Context *context)
+{
+ mIncompleteTextures.onDestroy(context);
+}
+
+CompilerImpl *Context9::createCompiler()
+{
+ return new CompilerD3D(SH_HLSL_3_0_OUTPUT);
+}
+
+ShaderImpl *Context9::createShader(const gl::ShaderState &data)
+{
+ return new ShaderD3D(data, mRenderer->getFeatures(), mRenderer->getNativeExtensions());
+}
+
+ProgramImpl *Context9::createProgram(const gl::ProgramState &data)
+{
+ return new ProgramD3D(data, mRenderer);
+}
+
+FramebufferImpl *Context9::createFramebuffer(const gl::FramebufferState &data)
+{
+ return new Framebuffer9(data, mRenderer);
+}
+
+TextureImpl *Context9::createTexture(const gl::TextureState &state)
+{
+ switch (state.getType())
+ {
+ case gl::TextureType::_2D:
+ return new TextureD3D_2D(state, mRenderer);
+ case gl::TextureType::CubeMap:
+ return new TextureD3D_Cube(state, mRenderer);
+ case gl::TextureType::External:
+ return new TextureD3D_External(state, mRenderer);
+ default:
+ UNREACHABLE();
+ }
+ return nullptr;
+}
+
+RenderbufferImpl *Context9::createRenderbuffer(const gl::RenderbufferState &state)
+{
+ return new RenderbufferD3D(state, mRenderer);
+}
+
+BufferImpl *Context9::createBuffer(const gl::BufferState &state)
+{
+ return new Buffer9(state, mRenderer);
+}
+
+VertexArrayImpl *Context9::createVertexArray(const gl::VertexArrayState &data)
+{
+ return new VertexArray9(data);
+}
+
+QueryImpl *Context9::createQuery(gl::QueryType type)
+{
+ return new Query9(mRenderer, type);
+}
+
+FenceNVImpl *Context9::createFenceNV()
+{
+ return new FenceNV9(mRenderer);
+}
+
+SyncImpl *Context9::createSync()
+{
+ // D3D9 doesn't support ES 3.0 and its sync objects.
+ UNREACHABLE();
+ return nullptr;
+}
+
+TransformFeedbackImpl *Context9::createTransformFeedback(const gl::TransformFeedbackState &state)
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+SamplerImpl *Context9::createSampler(const gl::SamplerState &state)
+{
+ return new SamplerD3D(state);
+}
+
+ProgramPipelineImpl *Context9::createProgramPipeline(const gl::ProgramPipelineState &data)
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+std::vector<PathImpl *> Context9::createPaths(GLsizei)
+{
+ return std::vector<PathImpl *>();
+}
+
+MemoryObjectImpl *Context9::createMemoryObject()
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+SemaphoreImpl *Context9::createSemaphore()
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+angle::Result Context9::flush(const gl::Context *context)
+{
+ return mRenderer->flush(context);
+}
+
+angle::Result Context9::finish(const gl::Context *context)
+{
+ return mRenderer->finish(context);
+}
+
+angle::Result Context9::drawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count)
+{
+ return mRenderer->genericDrawArrays(context, mode, first, count, 0);
+}
+
+angle::Result Context9::drawArraysInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instanceCount)
+{
+ return mRenderer->genericDrawArrays(context, mode, first, count, instanceCount);
+}
+
+angle::Result Context9::drawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices)
+{
+ return mRenderer->genericDrawElements(context, mode, count, type, indices, 0);
+}
+
+angle::Result Context9::drawElementsInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances)
+{
+ return mRenderer->genericDrawElements(context, mode, count, type, indices, instances);
+}
+
+angle::Result Context9::drawRangeElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices)
+{
+ return mRenderer->genericDrawElements(context, mode, count, type, indices, 0);
+}
+
+angle::Result Context9::drawArraysIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ const void *indirect)
+{
+ ANGLE_HR_UNREACHABLE(this);
+ return angle::Result::Stop;
+}
+
+angle::Result Context9::drawElementsIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType type,
+ const void *indirect)
+{
+ ANGLE_HR_UNREACHABLE(this);
+ return angle::Result::Stop;
+}
+
+gl::GraphicsResetStatus Context9::getResetStatus()
+{
+ return mRenderer->getResetStatus();
+}
+
+std::string Context9::getVendorString() const
+{
+ return mRenderer->getVendorString();
+}
+
+std::string Context9::getRendererDescription() const
+{
+ return mRenderer->getRendererDescription();
+}
+
+void Context9::insertEventMarker(GLsizei length, const char *marker)
+{
+ mRenderer->getAnnotator()->setMarker(marker);
+}
+
+void Context9::pushGroupMarker(GLsizei length, const char *marker)
+{
+ mRenderer->getAnnotator()->beginEvent(marker, marker);
+ mMarkerStack.push(std::string(marker));
+}
+
+void Context9::popGroupMarker()
+{
+ const char *marker = nullptr;
+ if (!mMarkerStack.empty())
+ {
+ marker = mMarkerStack.top().c_str();
+ mMarkerStack.pop();
+ mRenderer->getAnnotator()->endEvent(marker);
+ }
+}
+
+void Context9::pushDebugGroup(GLenum source, GLuint id, const std::string &message)
+{
+ // Fall through to the EXT_debug_marker functions
+ pushGroupMarker(message.size(), message.c_str());
+}
+
+void Context9::popDebugGroup()
+{
+ // Fall through to the EXT_debug_marker functions
+ popGroupMarker();
+}
+
+angle::Result Context9::syncState(const gl::Context *context,
+ const gl::State::DirtyBits &dirtyBits,
+ const gl::State::DirtyBits &bitMask)
+{
+ mRenderer->getStateManager()->syncState(mState, dirtyBits);
+ return angle::Result::Continue;
+}
+
+GLint Context9::getGPUDisjoint()
+{
+ return mRenderer->getGPUDisjoint();
+}
+
+GLint64 Context9::getTimestamp()
+{
+ return mRenderer->getTimestamp();
+}
+
+angle::Result Context9::onMakeCurrent(const gl::Context *context)
+{
+ mRenderer->getStateManager()->setAllDirtyBits();
+ return mRenderer->ensureVertexDataManagerInitialized(context);
+}
+
+gl::Caps Context9::getNativeCaps() const
+{
+ return mRenderer->getNativeCaps();
+}
+
+const gl::TextureCapsMap &Context9::getNativeTextureCaps() const
+{
+ return mRenderer->getNativeTextureCaps();
+}
+
+const gl::Extensions &Context9::getNativeExtensions() const
+{
+ return mRenderer->getNativeExtensions();
+}
+
+const gl::Limitations &Context9::getNativeLimitations() const
+{
+ return mRenderer->getNativeLimitations();
+}
+
+angle::Result Context9::dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ)
+{
+ ANGLE_HR_UNREACHABLE(this);
+ return angle::Result::Stop;
+}
+
+angle::Result Context9::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect)
+{
+ ANGLE_HR_UNREACHABLE(this);
+ return angle::Result::Stop;
+}
+
+angle::Result Context9::memoryBarrier(const gl::Context *context, GLbitfield barriers)
+{
+ ANGLE_HR_UNREACHABLE(this);
+ return angle::Result::Stop;
+}
+
+angle::Result Context9::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers)
+{
+ ANGLE_HR_UNREACHABLE(this);
+ return angle::Result::Stop;
+}
+
+angle::Result Context9::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
+{
+ return mIncompleteTextures.getIncompleteTexture(context, type, nullptr, textureOut);
+}
+
+void Context9::handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line)
+{
+ ASSERT(FAILED(hr));
+
+ if (d3d9::isDeviceLostError(hr))
+ {
+ mRenderer->notifyDeviceLost();
+ }
+
+ GLenum glErrorCode = DefaultGLErrorCode(hr);
+
+ std::stringstream errorStream;
+ errorStream << "Internal D3D9 error: " << gl::FmtHR(hr) << ": " << message;
+
+ mErrors->handleError(glErrorCode, errorStream.str().c_str(), file, function, line);
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.h
new file mode 100644
index 0000000000..542131964c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.h
@@ -0,0 +1,177 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Context9:
+// D3D9-specific functionality associated with a GL Context.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
+
+#include <stack>
+#include "libANGLE/renderer/d3d/ContextD3D.h"
+
+namespace rx
+{
+class Renderer9;
+
+class Context9 : public ContextD3D
+{
+ public:
+ Context9(const gl::State &state, gl::ErrorSet *errorSet, Renderer9 *renderer);
+ ~Context9() override;
+
+ angle::Result initialize() override;
+ void onDestroy(const gl::Context *context) override;
+
+ // Shader creation
+ CompilerImpl *createCompiler() override;
+ ShaderImpl *createShader(const gl::ShaderState &data) override;
+ ProgramImpl *createProgram(const gl::ProgramState &data) override;
+
+ // Framebuffer creation
+ FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override;
+
+ // Texture creation
+ TextureImpl *createTexture(const gl::TextureState &state) override;
+
+ // Renderbuffer creation
+ RenderbufferImpl *createRenderbuffer(const gl::RenderbufferState &state) override;
+
+ // Buffer creation
+ BufferImpl *createBuffer(const gl::BufferState &state) override;
+
+ // Vertex Array creation
+ VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) override;
+
+ // Query and Fence creation
+ QueryImpl *createQuery(gl::QueryType type) override;
+ FenceNVImpl *createFenceNV() override;
+ SyncImpl *createSync() override;
+
+ // Transform Feedback creation
+ TransformFeedbackImpl *createTransformFeedback(
+ const gl::TransformFeedbackState &state) override;
+
+ // Sampler object creation
+ SamplerImpl *createSampler(const gl::SamplerState &state) override;
+
+ // Program Pipeline object creation
+ ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
+
+ // Path object creation
+ std::vector<PathImpl *> createPaths(GLsizei) override;
+
+ // Memory object creation.
+ MemoryObjectImpl *createMemoryObject() override;
+
+ // Semaphore creation.
+ SemaphoreImpl *createSemaphore() override;
+
+ // Flush and finish.
+ angle::Result flush(const gl::Context *context) override;
+ angle::Result finish(const gl::Context *context) override;
+
+ // Drawing methods.
+ angle::Result drawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count) override;
+ angle::Result drawArraysInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instanceCount) override;
+
+ angle::Result drawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices) override;
+ angle::Result drawElementsInstanced(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances) override;
+ angle::Result drawRangeElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices) override;
+ angle::Result drawArraysIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ const void *indirect) override;
+ angle::Result drawElementsIndirect(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType type,
+ const void *indirect) override;
+
+ // Device loss
+ gl::GraphicsResetStatus getResetStatus() override;
+
+ // Vendor and description strings.
+ std::string getVendorString() const override;
+ std::string getRendererDescription() const override;
+
+ // EXT_debug_marker
+ void insertEventMarker(GLsizei length, const char *marker) override;
+ void pushGroupMarker(GLsizei length, const char *marker) override;
+ void popGroupMarker() override;
+
+ // KHR_debug
+ void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
+ void popDebugGroup() override;
+
+ // State sync with dirty bits.
+ angle::Result syncState(const gl::Context *context,
+ const gl::State::DirtyBits &dirtyBits,
+ const gl::State::DirtyBits &bitMask) override;
+
+ // Disjoint timer queries
+ GLint getGPUDisjoint() override;
+ GLint64 getTimestamp() override;
+
+ // Context switching
+ angle::Result onMakeCurrent(const gl::Context *context) override;
+
+ // Caps queries
+ gl::Caps getNativeCaps() const override;
+ const gl::TextureCapsMap &getNativeTextureCaps() const override;
+ const gl::Extensions &getNativeExtensions() const override;
+ const gl::Limitations &getNativeLimitations() const override;
+
+ angle::Result dispatchCompute(const gl::Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ) override;
+ angle::Result dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) override;
+
+ angle::Result memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
+ angle::Result memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
+
+ Renderer9 *getRenderer() const { return mRenderer; }
+
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut);
+
+ void handleResult(HRESULT hr,
+ const char *message,
+ const char *file,
+ const char *function,
+ unsigned int line) override;
+
+ private:
+ Renderer9 *mRenderer;
+ IncompleteTextureSet mIncompleteTextures;
+ std::stack<std::string> mMarkerStack;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp
new file mode 100644
index 0000000000..18034b6b3c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp
@@ -0,0 +1,43 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DebugAnnotator9.h: D3D9 helpers for adding trace annotations.
+//
+
+#include "libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h"
+
+#include "common/platform.h"
+
+namespace rx
+{
+
+void DebugAnnotator9::beginEvent(const char *eventName, const char *eventMessage)
+{
+ angle::LoggingAnnotator::beginEvent(eventName, eventMessage);
+ std::mbstate_t state = std::mbstate_t();
+ std::mbsrtowcs(mWCharMessage, &eventMessage, kMaxMessageLength, &state);
+ D3DPERF_BeginEvent(0, mWCharMessage);
+}
+
+void DebugAnnotator9::endEvent(const char *eventName)
+{
+ angle::LoggingAnnotator::endEvent(eventName);
+ D3DPERF_EndEvent();
+}
+
+void DebugAnnotator9::setMarker(const char *markerName)
+{
+ angle::LoggingAnnotator::setMarker(markerName);
+ std::mbstate_t state = std::mbstate_t();
+ std::mbsrtowcs(mWCharMessage, &markerName, kMaxMessageLength, &state);
+ D3DPERF_SetMarker(0, mWCharMessage);
+}
+
+bool DebugAnnotator9::getStatus()
+{
+ return !!D3DPERF_GetStatus();
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h
new file mode 100644
index 0000000000..4aa23a6e33
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h
@@ -0,0 +1,33 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// DebugAnnotator9.h: D3D9 helpers for adding trace annotations.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_
+
+#include "libANGLE/LoggingAnnotator.h"
+
+namespace rx
+{
+
+class DebugAnnotator9 : public angle::LoggingAnnotator
+{
+ public:
+ DebugAnnotator9() {}
+ void beginEvent(const char *eventName, const char *eventMessage) override;
+ void endEvent(const char *eventName) override;
+ void setMarker(const char *markerName) override;
+ bool getStatus() override;
+
+ private:
+ static constexpr size_t kMaxMessageLength = 256;
+ wchar_t mWCharMessage[kMaxMessageLength];
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp
new file mode 100644
index 0000000000..0113b62471
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp
@@ -0,0 +1,73 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence9.cpp: Defines the rx::FenceNV9 class.
+
+#include "libANGLE/renderer/d3d/d3d9/Fence9.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace rx
+{
+
+FenceNV9::FenceNV9(Renderer9 *renderer) : FenceNVImpl(), mRenderer(renderer), mQuery(nullptr) {}
+
+FenceNV9::~FenceNV9()
+{
+ SafeRelease(mQuery);
+}
+
+angle::Result FenceNV9::set(const gl::Context *context, GLenum condition)
+{
+ if (!mQuery)
+ {
+ ANGLE_TRY(mRenderer->allocateEventQuery(context, &mQuery));
+ }
+
+ HRESULT result = mQuery->Issue(D3DISSUE_END);
+ if (FAILED(result))
+ {
+ SafeRelease(mQuery);
+ }
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to end event query");
+ return angle::Result::Continue;
+}
+
+angle::Result FenceNV9::test(const gl::Context *context, GLboolean *outFinished)
+{
+ return testHelper(GetImplAs<Context9>(context), true, outFinished);
+}
+
+angle::Result FenceNV9::finish(const gl::Context *context)
+{
+ GLboolean finished = GL_FALSE;
+ while (finished != GL_TRUE)
+ {
+ ANGLE_TRY(testHelper(GetImplAs<Context9>(context), true, &finished));
+ Sleep(0);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result FenceNV9::testHelper(Context9 *context9,
+ bool flushCommandBuffer,
+ GLboolean *outFinished)
+{
+ ASSERT(mQuery);
+
+ DWORD getDataFlags = (flushCommandBuffer ? D3DGETDATA_FLUSH : 0);
+ HRESULT result = mQuery->GetData(nullptr, 0, getDataFlags);
+ ANGLE_TRY_HR(context9, result, "Failed to get query data");
+ ASSERT(result == S_OK || result == S_FALSE);
+ *outFinished = ((result == S_OK) ? GL_TRUE : GL_FALSE);
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.h
new file mode 100644
index 0000000000..9237301744
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.h
@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence9.h: Defines the rx::FenceNV9 class which implements rx::FenceNVImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_
+
+#include "libANGLE/renderer/FenceNVImpl.h"
+#include "libANGLE/renderer/SyncImpl.h"
+
+namespace rx
+{
+class Context9;
+class Renderer9;
+
+class FenceNV9 : public FenceNVImpl
+{
+ public:
+ explicit FenceNV9(Renderer9 *renderer);
+ ~FenceNV9() override;
+
+ angle::Result set(const gl::Context *context, GLenum condition) override;
+ angle::Result test(const gl::Context *context, GLboolean *outFinished) override;
+ angle::Result finish(const gl::Context *context) override;
+
+ private:
+ angle::Result testHelper(Context9 *context9, bool flushCommandBuffer, GLboolean *outFinished);
+
+ Renderer9 *mRenderer;
+ IDirect3DQuery9 *mQuery;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
new file mode 100644
index 0000000000..a982a94d28
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
@@ -0,0 +1,408 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer9.cpp: Implements the Framebuffer9 class.
+
+#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace rx
+{
+Framebuffer9::Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer)
+ : FramebufferD3D(data, renderer), mRenderer(renderer)
+{
+ ASSERT(mRenderer != nullptr);
+}
+
+Framebuffer9::~Framebuffer9() {}
+
+angle::Result Framebuffer9::discard(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Framebuffer9::invalidate(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Framebuffer9::invalidateSub(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ const gl::Rectangle &area)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Framebuffer9::clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams)
+{
+ ANGLE_TRY(mRenderer->applyRenderTarget(context, mRenderTargetCache.getColors()[0],
+ mRenderTargetCache.getDepthStencil()));
+
+ const gl::State &glState = context->getState();
+ float nearZ = glState.getNearPlane();
+ float farZ = glState.getFarPlane();
+ mRenderer->setViewport(glState.getViewport(), nearZ, farZ, gl::PrimitiveMode::Triangles,
+ glState.getRasterizerState().frontFace, true);
+
+ mRenderer->setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
+
+ mRenderer->clear(clearParams, mRenderTargetCache.getColors()[0],
+ mRenderTargetCache.getDepthStencil());
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer9::readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels)
+{
+ const gl::FramebufferAttachment *colorbuffer = mState.getColorAttachment(0);
+ ASSERT(colorbuffer);
+
+ RenderTarget9 *renderTarget = nullptr;
+ ANGLE_TRY(colorbuffer->getRenderTarget(context, &renderTarget));
+ ASSERT(renderTarget);
+
+ IDirect3DSurface9 *surface = renderTarget->getSurface();
+ ASSERT(surface);
+
+ D3DSURFACE_DESC desc;
+ surface->GetDesc(&desc);
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
+ {
+ UNIMPLEMENTED(); // FIXME: Requires resolve using StretchRect into non-multisampled render
+ // target
+ SafeRelease(surface);
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY,
+ "ReadPixels is unimplemented for multisampled framebuffer attachments.");
+ }
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+ ASSERT(device);
+
+ HRESULT result;
+ IDirect3DSurface9 *systemSurface = nullptr;
+ bool directToPixels =
+ !pack.reverseRowOrder && pack.alignment <= 4 && mRenderer->getShareHandleSupport() &&
+ area.x == 0 && area.y == 0 && static_cast<UINT>(area.width) == desc.Width &&
+ static_cast<UINT>(area.height) == desc.Height && desc.Format == D3DFMT_A8R8G8B8 &&
+ format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE;
+ if (directToPixels)
+ {
+ // Use the pixels ptr as a shared handle to write directly into client's memory
+ result = device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
+ D3DPOOL_SYSTEMMEM, &systemSurface,
+ reinterpret_cast<void **>(&pixels));
+ if (FAILED(result))
+ {
+ // Try again without the shared handle
+ directToPixels = false;
+ }
+ }
+
+ if (!directToPixels)
+ {
+ result = device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
+ D3DPOOL_SYSTEMMEM, &systemSurface, nullptr);
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+ SafeRelease(surface);
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY,
+ "Failed to allocate internal texture for ReadPixels.");
+ }
+ }
+
+ result = device->GetRenderTargetData(surface, systemSurface);
+ SafeRelease(surface);
+
+ if (FAILED(result))
+ {
+ SafeRelease(systemSurface);
+
+ // It turns out that D3D will sometimes produce more error
+ // codes than those documented.
+ if (d3d9::isDeviceLostError(result))
+ {
+ mRenderer->notifyDeviceLost();
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY, "Failed to read internal render target data.");
+ }
+
+ if (directToPixels)
+ {
+ SafeRelease(systemSurface);
+ return angle::Result::Continue;
+ }
+
+ RECT rect;
+ rect.left = gl::clamp(area.x, 0L, static_cast<LONG>(desc.Width));
+ rect.top = gl::clamp(area.y, 0L, static_cast<LONG>(desc.Height));
+ rect.right = gl::clamp(area.x + area.width, 0L, static_cast<LONG>(desc.Width));
+ rect.bottom = gl::clamp(area.y + area.height, 0L, static_cast<LONG>(desc.Height));
+
+ D3DLOCKED_RECT lock;
+ result = systemSurface->LockRect(&lock, &rect, D3DLOCK_READONLY);
+
+ if (FAILED(result))
+ {
+ UNREACHABLE();
+ SafeRelease(systemSurface);
+
+ ANGLE_TRY_HR(context9, E_OUTOFMEMORY, "Failed to lock internal render target.");
+ }
+
+ uint8_t *source = static_cast<uint8_t *>(lock.pBits);
+ int inputPitch = lock.Pitch;
+
+ const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
+
+ gl::FormatType formatType(format, type);
+
+ PackPixelsParams packParams;
+ packParams.area.x = rect.left;
+ packParams.area.y = rect.top;
+ packParams.area.width = rect.right - rect.left;
+ packParams.area.height = rect.bottom - rect.top;
+ packParams.destFormat = &GetFormatFromFormatType(format, type);
+ packParams.outputPitch = static_cast<GLuint>(outputPitch);
+ packParams.reverseRowOrder = pack.reverseRowOrder;
+
+ PackPixels(packParams, d3dFormatInfo.info(), inputPitch, source, pixels);
+
+ systemSurface->UnlockRect();
+ SafeRelease(systemSurface);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Framebuffer9::blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer)
+{
+ ASSERT(filter == GL_NEAREST);
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+ ASSERT(device);
+
+ mRenderer->endScene();
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ if (blitRenderTarget)
+ {
+ const gl::FramebufferAttachment *readBuffer = sourceFramebuffer->getColorAttachment(0);
+ ASSERT(readBuffer);
+
+ RenderTarget9 *readRenderTarget = nullptr;
+ ANGLE_TRY(readBuffer->getRenderTarget(context, &readRenderTarget));
+ ASSERT(readRenderTarget);
+
+ const gl::FramebufferAttachment *drawBuffer = mState.getColorAttachment(0);
+ ASSERT(drawBuffer);
+
+ RenderTarget9 *drawRenderTarget = nullptr;
+ ANGLE_TRY(drawBuffer->getRenderTarget(context, &drawRenderTarget));
+ ASSERT(drawRenderTarget);
+
+ // The getSurface calls do an AddRef so save them until after no errors are possible
+ IDirect3DSurface9 *readSurface = readRenderTarget->getSurface();
+ ASSERT(readSurface);
+
+ IDirect3DSurface9 *drawSurface = drawRenderTarget->getSurface();
+ ASSERT(drawSurface);
+
+ gl::Extents srcSize(readRenderTarget->getWidth(), readRenderTarget->getHeight(), 1);
+ gl::Extents dstSize(drawRenderTarget->getWidth(), drawRenderTarget->getHeight(), 1);
+
+ RECT srcRect;
+ srcRect.left = sourceArea.x;
+ srcRect.right = sourceArea.x + sourceArea.width;
+ srcRect.top = sourceArea.y;
+ srcRect.bottom = sourceArea.y + sourceArea.height;
+
+ RECT dstRect;
+ dstRect.left = destArea.x;
+ dstRect.right = destArea.x + destArea.width;
+ dstRect.top = destArea.y;
+ dstRect.bottom = destArea.y + destArea.height;
+
+ // Clip the rectangles to the scissor rectangle
+ if (scissor)
+ {
+ if (dstRect.left < 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;
+ }
+
+ HRESULT result =
+ device->StretchRect(readSurface, &srcRect, drawSurface, &dstRect, D3DTEXF_NONE);
+
+ SafeRelease(readSurface);
+ SafeRelease(drawSurface);
+
+ ANGLE_TRY_HR(context9, result, "Internal blit failed.");
+ }
+
+ if (blitDepth || blitStencil)
+ {
+ const gl::FramebufferAttachment *readBuffer =
+ sourceFramebuffer->getDepthOrStencilAttachment();
+ ASSERT(readBuffer);
+
+ RenderTarget9 *readDepthStencil = nullptr;
+ ANGLE_TRY(readBuffer->getRenderTarget(context, &readDepthStencil));
+ ASSERT(readDepthStencil);
+
+ const gl::FramebufferAttachment *drawBuffer = mState.getDepthOrStencilAttachment();
+ ASSERT(drawBuffer);
+
+ RenderTarget9 *drawDepthStencil = nullptr;
+ ANGLE_TRY(drawBuffer->getRenderTarget(context, &drawDepthStencil));
+ ASSERT(drawDepthStencil);
+
+ // The getSurface calls do an AddRef so save them until after no errors are possible
+ IDirect3DSurface9 *readSurface = readDepthStencil->getSurface();
+ ASSERT(readDepthStencil);
+
+ IDirect3DSurface9 *drawSurface = drawDepthStencil->getSurface();
+ ASSERT(drawDepthStencil);
+
+ HRESULT result =
+ device->StretchRect(readSurface, nullptr, drawSurface, nullptr, D3DTEXF_NONE);
+
+ SafeRelease(readSurface);
+ SafeRelease(drawSurface);
+
+ ANGLE_TRY_HR(context9, result, "Internal blit failed.");
+ }
+
+ return angle::Result::Continue;
+}
+
+GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
+{
+ RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTarget);
+ const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(renderTarget9->getD3DFormat());
+ return d3dFormatInfo.info().glInternalFormat;
+}
+
+angle::Result Framebuffer9::getSamplePosition(const gl::Context *context,
+ size_t index,
+ GLfloat *xy) const
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Framebuffer9::syncState(const gl::Context *context,
+ const gl::Framebuffer::DirtyBits &dirtyBits)
+{
+ ANGLE_TRY(FramebufferD3D::syncState(context, dirtyBits));
+ ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits));
+ return angle::Result::Continue;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h
new file mode 100644
index 0000000000..d9c4d7b75d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h
@@ -0,0 +1,85 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Framebuffer9.h: Defines the Framebuffer9 class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
+
+#include "libANGLE/renderer/RenderTargetCache.h"
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace rx
+{
+class Renderer9;
+
+class Framebuffer9 : public FramebufferD3D
+{
+ public:
+ Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer);
+ ~Framebuffer9() override;
+
+ angle::Result discard(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments) override;
+ angle::Result invalidate(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments) override;
+ angle::Result invalidateSub(const gl::Context *context,
+ size_t count,
+ const GLenum *attachments,
+ const gl::Rectangle &area) override;
+
+ angle::Result getSamplePosition(const gl::Context *context,
+ size_t index,
+ GLfloat *xy) const override;
+
+ angle::Result syncState(const gl::Context *context,
+ const gl::Framebuffer::DirtyBits &dirtyBits) override;
+
+ const gl::AttachmentArray<RenderTarget9 *> &getCachedColorRenderTargets() const
+ {
+ return mRenderTargetCache.getColors();
+ }
+
+ const RenderTarget9 *getCachedDepthStencilRenderTarget() const
+ {
+ return mRenderTargetCache.getDepthStencil();
+ }
+
+ private:
+ angle::Result clearImpl(const gl::Context *context,
+ const ClearParameters &clearParams) override;
+
+ angle::Result readPixelsImpl(const gl::Context *context,
+ const gl::Rectangle &area,
+ GLenum format,
+ GLenum type,
+ size_t outputPitch,
+ const gl::PixelPackState &pack,
+ uint8_t *pixels) override;
+
+ angle::Result blitImpl(const gl::Context *context,
+ const gl::Rectangle &sourceArea,
+ const gl::Rectangle &destArea,
+ const gl::Rectangle *scissor,
+ bool blitRenderTarget,
+ bool blitDepth,
+ bool blitStencil,
+ GLenum filter,
+ const gl::Framebuffer *sourceFramebuffer) override;
+
+ GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
+
+ Renderer9 *const mRenderer;
+
+ RenderTargetCache<RenderTarget9> mRenderTargetCache;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
new file mode 100644
index 0000000000..0f56463961
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
@@ -0,0 +1,792 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image9.cpp: Implements the rx::Image9 class, which acts as the interface to
+// the actual underlying surfaces of a Texture.
+
+#include "libANGLE/renderer/d3d/d3d9/Image9.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/copyvertex.h"
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace rx
+{
+
+Image9::Image9(Renderer9 *renderer)
+{
+ mSurface = nullptr;
+ mRenderer = nullptr;
+
+ mD3DPool = D3DPOOL_SYSTEMMEM;
+ mD3DFormat = D3DFMT_UNKNOWN;
+
+ mRenderer = renderer;
+}
+
+Image9::~Image9()
+{
+ SafeRelease(mSurface);
+}
+
+// static
+angle::Result Image9::GenerateMip(Context9 *context9,
+ IDirect3DSurface9 *destSurface,
+ IDirect3DSurface9 *sourceSurface)
+{
+ D3DSURFACE_DESC destDesc;
+ HRESULT result = destSurface->GetDesc(&destDesc);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result,
+ "Failed to query the source surface description for mipmap generation");
+
+ D3DSURFACE_DESC sourceDesc;
+ result = sourceSurface->GetDesc(&sourceDesc);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result,
+ "Failed to query the destination surface description for mipmap generation");
+
+ ASSERT(sourceDesc.Format == destDesc.Format);
+ ASSERT(sourceDesc.Width == 1 || sourceDesc.Width / 2 == destDesc.Width);
+ ASSERT(sourceDesc.Height == 1 || sourceDesc.Height / 2 == destDesc.Height);
+
+ const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(sourceDesc.Format);
+ ASSERT(d3dFormatInfo.info().mipGenerationFunction != nullptr);
+
+ D3DLOCKED_RECT sourceLocked = {0};
+ result = sourceSurface->LockRect(&sourceLocked, nullptr, D3DLOCK_READONLY);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to lock the source surface for mipmap generation");
+
+ D3DLOCKED_RECT destLocked = {0};
+ result = destSurface->LockRect(&destLocked, nullptr, 0);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to lock the destination surface for mipmap generation");
+
+ const uint8_t *sourceData = static_cast<const uint8_t *>(sourceLocked.pBits);
+ uint8_t *destData = static_cast<uint8_t *>(destLocked.pBits);
+
+ ASSERT(sourceData && destData);
+
+ d3dFormatInfo.info().mipGenerationFunction(sourceDesc.Width, sourceDesc.Height, 1, sourceData,
+ sourceLocked.Pitch, 0, destData, destLocked.Pitch,
+ 0);
+
+ destSurface->UnlockRect();
+ sourceSurface->UnlockRect();
+
+ return angle::Result::Continue;
+}
+
+// static
+angle::Result Image9::GenerateMipmap(Context9 *context9, Image9 *dest, Image9 *source)
+{
+ IDirect3DSurface9 *sourceSurface = nullptr;
+ ANGLE_TRY(source->getSurface(context9, &sourceSurface));
+
+ IDirect3DSurface9 *destSurface = nullptr;
+ ANGLE_TRY(dest->getSurface(context9, &destSurface));
+
+ ANGLE_TRY(GenerateMip(context9, destSurface, sourceSurface));
+
+ dest->markDirty();
+
+ return angle::Result::Continue;
+}
+
+// static
+angle::Result Image9::CopyLockableSurfaces(Context9 *context9,
+ IDirect3DSurface9 *dest,
+ IDirect3DSurface9 *source)
+{
+ D3DLOCKED_RECT sourceLock = {0};
+ D3DLOCKED_RECT destLock = {0};
+
+ HRESULT result;
+
+ result = source->LockRect(&sourceLock, nullptr, 0);
+ ANGLE_TRY_HR(context9, result, "Failed to lock source surface for copy");
+
+ result = dest->LockRect(&destLock, nullptr, 0);
+ if (FAILED(result))
+ {
+ source->UnlockRect();
+ }
+ ANGLE_TRY_HR(context9, result, "Failed to lock destination surface for copy");
+
+ ASSERT(sourceLock.pBits && destLock.pBits);
+
+ D3DSURFACE_DESC desc;
+ source->GetDesc(&desc);
+
+ const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
+ unsigned int rows = desc.Height / d3dFormatInfo.blockHeight;
+
+ unsigned int bytes = d3d9::ComputeBlockSize(desc.Format, desc.Width, d3dFormatInfo.blockHeight);
+ ASSERT(bytes <= static_cast<unsigned int>(sourceLock.Pitch) &&
+ bytes <= static_cast<unsigned int>(destLock.Pitch));
+
+ for (unsigned int i = 0; i < rows; i++)
+ {
+ memcpy((char *)destLock.pBits + destLock.Pitch * i,
+ (char *)sourceLock.pBits + sourceLock.Pitch * i, bytes);
+ }
+
+ source->UnlockRect();
+ dest->UnlockRect();
+
+ return angle::Result::Continue;
+}
+
+// static
+angle::Result Image9::CopyImage(const gl::Context *context,
+ Image9 *dest,
+ Image9 *source,
+ const gl::Rectangle &sourceRect,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
+{
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ IDirect3DSurface9 *sourceSurface = nullptr;
+ ANGLE_TRY(source->getSurface(context9, &sourceSurface));
+
+ IDirect3DSurface9 *destSurface = nullptr;
+ ANGLE_TRY(dest->getSurface(context9, &destSurface));
+
+ D3DSURFACE_DESC destDesc;
+ HRESULT result = destSurface->GetDesc(&destDesc);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to query the source surface description for CopyImage");
+ const d3d9::D3DFormat &destD3DFormatInfo = d3d9::GetD3DFormatInfo(destDesc.Format);
+
+ D3DSURFACE_DESC sourceDesc;
+ result = sourceSurface->GetDesc(&sourceDesc);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result,
+ "Failed to query the destination surface description for CopyImage");
+ const d3d9::D3DFormat &sourceD3DFormatInfo = d3d9::GetD3DFormatInfo(sourceDesc.Format);
+
+ D3DLOCKED_RECT sourceLocked = {0};
+ result = sourceSurface->LockRect(&sourceLocked, nullptr, D3DLOCK_READONLY);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to lock the source surface for CopyImage");
+
+ D3DLOCKED_RECT destLocked = {0};
+ result = destSurface->LockRect(&destLocked, nullptr, 0);
+ ASSERT(SUCCEEDED(result));
+ if (FAILED(result))
+ {
+ sourceSurface->UnlockRect();
+ }
+ ANGLE_TRY_HR(context9, result, "Failed to lock the destination surface for CopyImage");
+
+ const uint8_t *sourceData = static_cast<const uint8_t *>(sourceLocked.pBits) +
+ sourceRect.x * sourceD3DFormatInfo.pixelBytes +
+ sourceRect.y * sourceLocked.Pitch;
+ uint8_t *destData = static_cast<uint8_t *>(destLocked.pBits) +
+ destOffset.x * destD3DFormatInfo.pixelBytes +
+ destOffset.y * destLocked.Pitch;
+ ASSERT(sourceData && destData);
+
+ CopyImageCHROMIUM(sourceData, sourceLocked.Pitch, sourceD3DFormatInfo.pixelBytes, 0,
+ sourceD3DFormatInfo.info().pixelReadFunction, destData, destLocked.Pitch,
+ destD3DFormatInfo.pixelBytes, 0, destD3DFormatInfo.info().pixelWriteFunction,
+ gl::GetUnsizedFormat(dest->getInternalFormat()),
+ destD3DFormatInfo.info().componentType, sourceRect.width, sourceRect.height,
+ 1, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ destSurface->UnlockRect();
+ sourceSurface->UnlockRect();
+
+ return angle::Result::Continue;
+}
+
+bool Image9::redefine(gl::TextureType type,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease)
+{
+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(size.depth <= 1);
+
+ // Only 2D and cube texture are supported by the D3D9 backend.
+ ASSERT(type == gl::TextureType::_2D || type == gl::TextureType::CubeMap);
+
+ if (mWidth != size.width || mHeight != size.height || mDepth != size.depth ||
+ mInternalFormat != internalformat || forceRelease)
+ {
+ mWidth = size.width;
+ mHeight = size.height;
+ mDepth = size.depth;
+ mType = type;
+ mInternalFormat = internalformat;
+
+ // compute the d3d format that will be used
+ const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+ mD3DFormat = d3d9FormatInfo.texFormat;
+ mRenderable = (d3d9FormatInfo.renderFormat != D3DFMT_UNKNOWN);
+
+ SafeRelease(mSurface);
+ mDirty = (d3d9FormatInfo.dataInitializerFunction != nullptr);
+
+ return true;
+ }
+
+ return false;
+}
+
+angle::Result Image9::createSurface(Context9 *context9)
+{
+ if (mSurface)
+ {
+ return angle::Result::Continue;
+ }
+
+ IDirect3DTexture9 *newTexture = nullptr;
+ IDirect3DSurface9 *newSurface = nullptr;
+ const D3DPOOL poolToUse = D3DPOOL_SYSTEMMEM;
+ const D3DFORMAT d3dFormat = getD3DFormat();
+
+ if (mWidth != 0 && mHeight != 0)
+ {
+ int levelToFetch = 0;
+ GLsizei requestWidth = mWidth;
+ GLsizei requestHeight = mHeight;
+ d3d9::MakeValidSize(true, d3dFormat, &requestWidth, &requestHeight, &levelToFetch);
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ HRESULT result = device->CreateTexture(requestWidth, requestHeight, levelToFetch + 1, 0,
+ d3dFormat, poolToUse, &newTexture, nullptr);
+
+ ANGLE_TRY_HR(context9, result, "Failed to create image surface");
+
+ newTexture->GetSurfaceLevel(levelToFetch, &newSurface);
+ SafeRelease(newTexture);
+
+ const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
+ if (d3dFormatInfo.dataInitializerFunction != nullptr)
+ {
+ 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));
+ ANGLE_TRY_HR(context9, result, "Failed to lock image surface");
+
+ d3dFormatInfo.dataInitializerFunction(
+ mWidth, mHeight, 1, static_cast<uint8_t *>(lockedRect.pBits), lockedRect.Pitch, 0);
+
+ result = newSurface->UnlockRect();
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to unlock image surface");
+ }
+ }
+
+ mSurface = newSurface;
+ mDirty = false;
+ mD3DPool = poolToUse;
+
+ return angle::Result::Continue;
+}
+
+angle::Result Image9::lock(Context9 *context9, D3DLOCKED_RECT *lockedRect, const RECT &rect)
+{
+ ANGLE_TRY(createSurface(context9));
+
+ if (mSurface)
+ {
+ HRESULT result = mSurface->LockRect(lockedRect, &rect, 0);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to lock image surface");
+ mDirty = true;
+ }
+
+ return angle::Result::Continue;
+}
+
+void Image9::unlock()
+{
+ if (mSurface)
+ {
+ HRESULT result = mSurface->UnlockRect();
+ ASSERT(SUCCEEDED(result));
+ }
+}
+
+D3DFORMAT Image9::getD3DFormat() const
+{
+ // this should only happen if the image hasn't been redefined first
+ // which would be a bug by the caller
+ ASSERT(mD3DFormat != D3DFMT_UNKNOWN);
+
+ return mD3DFormat;
+}
+
+bool Image9::isDirty() const
+{
+ // Make sure to that this image is marked as dirty even if the staging texture hasn't been
+ // created yet if initialization is required before use.
+ return (mSurface ||
+ d3d9::GetTextureFormatInfo(mInternalFormat).dataInitializerFunction != nullptr) &&
+ mDirty;
+}
+
+angle::Result Image9::getSurface(Context9 *context9, IDirect3DSurface9 **outSurface)
+{
+ ANGLE_TRY(createSurface(context9));
+ *outSurface = mSurface;
+ return angle::Result::Continue;
+}
+
+angle::Result Image9::setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level)
+{
+ IDirect3DSurface9 *surface = nullptr;
+ TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
+ ANGLE_TRY(storage9->getSurfaceLevel(context, gl::TextureTarget::_2D, level, false, &surface));
+ return setManagedSurface(GetImplAs<Context9>(context), surface);
+}
+
+angle::Result Image9::setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level)
+{
+ IDirect3DSurface9 *surface = nullptr;
+ TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
+ ANGLE_TRY(storage9->getSurfaceLevel(context, gl::CubeFaceIndexToTextureTarget(face), level,
+ false, &surface));
+ return setManagedSurface(GetImplAs<Context9>(context), surface);
+}
+
+angle::Result Image9::setManagedSurface(Context9 *context9, IDirect3DSurface9 *surface)
+{
+ D3DSURFACE_DESC desc;
+ surface->GetDesc(&desc);
+ ASSERT(desc.Pool == D3DPOOL_MANAGED);
+
+ if ((GLsizei)desc.Width == mWidth && (GLsizei)desc.Height == mHeight)
+ {
+ if (mSurface)
+ {
+ angle::Result result = CopyLockableSurfaces(context9, surface, mSurface);
+ SafeRelease(mSurface);
+ ANGLE_TRY(result);
+ }
+
+ mSurface = surface;
+ mD3DPool = desc.Pool;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Image9::copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box &region)
+{
+ ANGLE_TRY(createSurface(GetImplAs<Context9>(context)));
+
+ TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
+ IDirect3DSurface9 *destSurface = nullptr;
+ ANGLE_TRY(storage9->getSurfaceLevel(context, index.getTarget(), index.getLevelIndex(), true,
+ &destSurface));
+
+ angle::Result result = copyToSurface(GetImplAs<Context9>(context), destSurface, region);
+ SafeRelease(destSurface);
+ return result;
+}
+
+angle::Result Image9::copyToSurface(Context9 *context9,
+ IDirect3DSurface9 *destSurface,
+ const gl::Box &area)
+{
+ ASSERT(area.width > 0 && area.height > 0 && area.depth == 1);
+ ASSERT(destSurface);
+
+ IDirect3DSurface9 *sourceSurface = nullptr;
+ ANGLE_TRY(getSurface(context9, &sourceSurface));
+
+ ASSERT(sourceSurface && sourceSurface != destSurface);
+
+ RECT rect;
+ rect.left = area.x;
+ rect.top = area.y;
+ rect.right = area.x + area.width;
+ rect.bottom = area.y + area.height;
+
+ POINT point = {rect.left, rect.top};
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ if (mD3DPool == D3DPOOL_MANAGED)
+ {
+ D3DSURFACE_DESC desc;
+ sourceSurface->GetDesc(&desc);
+
+ IDirect3DSurface9 *surf = 0;
+ HRESULT result = device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
+ D3DPOOL_SYSTEMMEM, &surf, nullptr);
+ ANGLE_TRY_HR(context9, result, "Internal CreateOffscreenPlainSurface call failed");
+
+ auto err = CopyLockableSurfaces(context9, surf, sourceSurface);
+ result = device->UpdateSurface(surf, &rect, destSurface, &point);
+ SafeRelease(surf);
+ ANGLE_TRY(err);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Internal UpdateSurface call failed");
+ }
+ else
+ {
+ // UpdateSurface: source must be SYSTEMMEM, dest must be DEFAULT pools
+ HRESULT result = device->UpdateSurface(sourceSurface, &rect, destSurface, &point);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Internal UpdateSurface call failed");
+ }
+
+ return angle::Result::Continue;
+}
+
+// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as
+// format/type at input into the target pixel rectangle.
+angle::Result Image9::loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages)
+{
+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(area.z == 0 && area.depth == 1);
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
+ GLuint inputRowPitch = 0;
+ ANGLE_CHECK_GL_MATH(context9, formatInfo.computeRowPitch(type, area.width, unpack.alignment,
+ unpack.rowLength, &inputRowPitch));
+ ASSERT(!applySkipImages);
+ ASSERT(unpack.skipPixels == 0);
+ ASSERT(unpack.skipRows == 0);
+
+ const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
+ ASSERT(d3dFormatInfo.loadFunction != nullptr);
+
+ RECT lockRect = {area.x, area.y, area.x + area.width, area.y + area.height};
+
+ D3DLOCKED_RECT locked;
+ ANGLE_TRY(lock(GetImplAs<Context9>(context), &locked, lockRect));
+
+ d3dFormatInfo.loadFunction(area.width, area.height, area.depth,
+ static_cast<const uint8_t *>(input), inputRowPitch, 0,
+ static_cast<uint8_t *>(locked.pBits), locked.Pitch, 0);
+
+ unlock();
+
+ return angle::Result::Continue;
+}
+
+angle::Result Image9::loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input)
+{
+ // 3D textures are not supported by the D3D9 backend.
+ ASSERT(area.z == 0 && area.depth == 1);
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat);
+ GLuint inputRowPitch = 0;
+ ANGLE_CHECK_GL_MATH(
+ context9, formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0, &inputRowPitch));
+
+ GLuint inputDepthPitch = 0;
+ ANGLE_CHECK_GL_MATH(
+ context9, formatInfo.computeDepthPitch(area.height, 0, inputRowPitch, &inputDepthPitch));
+
+ const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
+
+ ASSERT(area.x % d3d9::GetD3DFormatInfo(d3d9FormatInfo.texFormat).blockWidth == 0);
+ ASSERT(area.y % d3d9::GetD3DFormatInfo(d3d9FormatInfo.texFormat).blockHeight == 0);
+
+ ASSERT(d3d9FormatInfo.loadFunction != nullptr);
+
+ RECT lockRect = {area.x, area.y, area.x + area.width, area.y + area.height};
+
+ D3DLOCKED_RECT locked;
+ ANGLE_TRY(lock(GetImplAs<Context9>(context), &locked, lockRect));
+
+ d3d9FormatInfo.loadFunction(area.width, area.height, area.depth,
+ static_cast<const uint8_t *>(input), inputRowPitch, inputDepthPitch,
+ static_cast<uint8_t *>(locked.pBits), locked.Pitch, 0);
+
+ unlock();
+
+ return angle::Result::Continue;
+}
+
+// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete
+// textures
+angle::Result Image9::copyFromRTInternal(Context9 *context9,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ RenderTargetD3D *source)
+{
+ ASSERT(source);
+
+ // ES3.0 only behaviour to copy into a 3d texture
+ ASSERT(destOffset.z == 0);
+
+ RenderTarget9 *renderTarget = GetAs<RenderTarget9>(source);
+
+ angle::ComPtr<IDirect3DSurface9> surface = renderTarget->getSurface();
+ ASSERT(surface);
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ angle::ComPtr<IDirect3DSurface9> renderTargetData = nullptr;
+ D3DSURFACE_DESC description;
+ surface->GetDesc(&description);
+
+ HRESULT hr = device->CreateOffscreenPlainSurface(description.Width, description.Height,
+ description.Format, D3DPOOL_SYSTEMMEM,
+ &renderTargetData, nullptr);
+
+ ANGLE_TRY_HR(context9, hr, "Could not create matching destination surface");
+
+ hr = device->GetRenderTargetData(surface.Get(), renderTargetData.Get());
+
+ ANGLE_TRY_HR(context9, hr, "GetRenderTargetData unexpectedly failed");
+
+ int width = sourceArea.width;
+ int height = sourceArea.height;
+
+ RECT sourceRect = {sourceArea.x, sourceArea.y, sourceArea.x + width, sourceArea.y + height};
+ RECT destRect = {destOffset.x, destOffset.y, destOffset.x + width, destOffset.y + height};
+
+ D3DLOCKED_RECT sourceLock = {0};
+ hr = renderTargetData->LockRect(&sourceLock, &sourceRect, 0);
+
+ ANGLE_TRY_HR(context9, hr, "Failed to lock the source surface (rectangle might be invalid)");
+
+ D3DLOCKED_RECT destLock = {0};
+ angle::Result result = lock(context9, &destLock, destRect);
+ if (result == angle::Result::Stop)
+ {
+ renderTargetData->UnlockRect();
+ }
+ ANGLE_TRY(result);
+
+ ASSERT(destLock.pBits && sourceLock.pBits);
+
+ unsigned char *sourcePixels = (unsigned char *)sourceLock.pBits;
+ unsigned char *destPixels = (unsigned char *)destLock.pBits;
+
+ switch (description.Format)
+ {
+ case D3DFMT_X8R8G8B8:
+ case D3DFMT_A8R8G8B8:
+ switch (getD3DFormat())
+ {
+ case D3DFMT_X8R8G8B8:
+ case D3DFMT_A8R8G8B8:
+ for (int y = 0; y < height; y++)
+ {
+ memcpy(destPixels, sourcePixels, 4 * width);
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_L8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ destPixels[x] = sourcePixels[x * 4 + 2];
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_A8L8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ destPixels[x * 2 + 0] = sourcePixels[x * 4 + 2];
+ destPixels[x * 2 + 1] = sourcePixels[x * 4 + 3];
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ case D3DFMT_R5G6B5:
+ switch (getD3DFormat())
+ {
+ case D3DFMT_X8R8G8B8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short rgb = ((unsigned short *)sourcePixels)[x];
+ unsigned char red = static_cast<unsigned char>((rgb & 0xF800) >> 8);
+ unsigned char green = static_cast<unsigned char>((rgb & 0x07E0) >> 3);
+ unsigned char blue = static_cast<unsigned char>((rgb & 0x001F) << 3);
+ destPixels[x + 0] = blue | (blue >> 5);
+ destPixels[x + 1] = green | (green >> 6);
+ destPixels[x + 2] = red | (red >> 5);
+ destPixels[x + 3] = 0xFF;
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_L8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ unsigned char red = sourcePixels[x * 2 + 1] & 0xF8;
+ destPixels[x] = red | (red >> 5);
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ case D3DFMT_A1R5G5B5:
+ switch (getD3DFormat())
+ {
+ case D3DFMT_X8R8G8B8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short argb = ((unsigned short *)sourcePixels)[x];
+ unsigned char red = static_cast<unsigned char>((argb & 0x7C00) >> 7);
+ unsigned char green = static_cast<unsigned char>((argb & 0x03E0) >> 2);
+ unsigned char blue = static_cast<unsigned char>((argb & 0x001F) << 3);
+ destPixels[x + 0] = blue | (blue >> 5);
+ destPixels[x + 1] = green | (green >> 5);
+ destPixels[x + 2] = red | (red >> 5);
+ destPixels[x + 3] = 0xFF;
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_A8R8G8B8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ unsigned short argb = ((unsigned short *)sourcePixels)[x];
+ unsigned char red = static_cast<unsigned char>((argb & 0x7C00) >> 7);
+ unsigned char green = static_cast<unsigned char>((argb & 0x03E0) >> 2);
+ unsigned char blue = static_cast<unsigned char>((argb & 0x001F) << 3);
+ unsigned char alpha = (signed short)argb >> 15;
+ destPixels[x + 0] = blue | (blue >> 5);
+ destPixels[x + 1] = green | (green >> 5);
+ destPixels[x + 2] = red | (red >> 5);
+ destPixels[x + 3] = alpha;
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_L8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ unsigned char red = sourcePixels[x * 2 + 1] & 0x7C;
+ destPixels[x] = (red << 1) | (red >> 4);
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ case D3DFMT_A8L8:
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 0; x < width; x++)
+ {
+ unsigned char red = sourcePixels[x * 2 + 1] & 0x7C;
+ destPixels[x * 2 + 0] = (red << 1) | (red >> 4);
+ destPixels[x * 2 + 1] = (signed char)sourcePixels[x * 2 + 1] >> 7;
+ }
+ sourcePixels += sourceLock.Pitch;
+ destPixels += destLock.Pitch;
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ unlock();
+ renderTargetData->UnlockRect();
+
+ mDirty = true;
+ return angle::Result::Continue;
+}
+
+angle::Result Image9::copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source)
+{
+ RenderTargetD3D *renderTarget = nullptr;
+ ANGLE_TRY(source->getRenderTarget(context, imageIndex, &renderTarget));
+
+ gl::Rectangle sourceArea(0, 0, mWidth, mHeight);
+ return copyFromRTInternal(GetImplAs<Context9>(context), gl::Offset(), sourceArea, renderTarget);
+}
+
+angle::Result Image9::copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source)
+{
+ const gl::FramebufferAttachment *srcAttachment = source->getReadColorAttachment();
+ ASSERT(srcAttachment);
+
+ RenderTargetD3D *renderTarget = nullptr;
+ ANGLE_TRY(srcAttachment->getRenderTarget(context, &renderTarget));
+ ASSERT(renderTarget);
+ return copyFromRTInternal(GetImplAs<Context9>(context), destOffset, sourceArea, renderTarget);
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h
new file mode 100644
index 0000000000..81b8e9c12c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h
@@ -0,0 +1,112 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Image9.h: Defines the rx::Image9 class, which acts as the interface to
+// the actual underlying surfaces of a Texture.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_IMAGE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_IMAGE9_H_
+
+#include "common/debug.h"
+#include "libANGLE/renderer/d3d/ImageD3D.h"
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace rx
+{
+class Context9;
+class Renderer9;
+
+class Image9 : public ImageD3D
+{
+ public:
+ Image9(Renderer9 *renderer);
+ ~Image9() override;
+
+ static angle::Result GenerateMipmap(Context9 *context9, Image9 *dest, Image9 *source);
+ static angle::Result GenerateMip(Context9 *context9,
+ IDirect3DSurface9 *destSurface,
+ IDirect3DSurface9 *sourceSurface);
+ static angle::Result CopyLockableSurfaces(Context9 *context9,
+ IDirect3DSurface9 *dest,
+ IDirect3DSurface9 *source);
+ static angle::Result CopyImage(const gl::Context *context,
+ Image9 *dest,
+ Image9 *source,
+ const gl::Rectangle &sourceRect,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha);
+
+ bool redefine(gl::TextureType type,
+ GLenum internalformat,
+ const gl::Extents &size,
+ bool forceRelease) override;
+
+ D3DFORMAT getD3DFormat() const;
+
+ bool isDirty() const override;
+
+ angle::Result setManagedSurface2D(const gl::Context *context,
+ TextureStorage *storage,
+ int level) override;
+ angle::Result setManagedSurfaceCube(const gl::Context *context,
+ TextureStorage *storage,
+ int face,
+ int level) override;
+ angle::Result copyToStorage(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::ImageIndex &index,
+ const gl::Box &region) override;
+
+ angle::Result loadData(const gl::Context *context,
+ const gl::Box &area,
+ const gl::PixelUnpackState &unpack,
+ GLenum type,
+ const void *input,
+ bool applySkipImages) override;
+ angle::Result loadCompressedData(const gl::Context *context,
+ const gl::Box &area,
+ const void *input) override;
+
+ angle::Result copyFromTexStorage(const gl::Context *context,
+ const gl::ImageIndex &imageIndex,
+ TextureStorage *source) override;
+ angle::Result copyFromFramebuffer(const gl::Context *context,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ const gl::Framebuffer *source) override;
+
+ private:
+ angle::Result getSurface(Context9 *context9, IDirect3DSurface9 **outSurface);
+
+ angle::Result createSurface(Context9 *context9);
+ angle::Result setManagedSurface(Context9 *context9, IDirect3DSurface9 *surface);
+ angle::Result copyToSurface(Context9 *context9, IDirect3DSurface9 *dest, const gl::Box &area);
+
+ angle::Result lock(Context9 *context9, D3DLOCKED_RECT *lockedRect, const RECT &rect);
+ void unlock();
+
+ angle::Result copyFromRTInternal(Context9 *context9,
+ const gl::Offset &destOffset,
+ const gl::Rectangle &sourceArea,
+ RenderTargetD3D *source);
+
+ Renderer9 *mRenderer;
+
+ D3DPOOL mD3DPool; // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be
+ // lockable.
+ D3DFORMAT mD3DFormat;
+
+ IDirect3DSurface9 *mSurface;
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_IMAGE9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp
new file mode 100644
index 0000000000..d1b1b51a64
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp
@@ -0,0 +1,161 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Indexffer9.cpp: Defines the D3D9 IndexBuffer implementation.
+
+#include "libANGLE/renderer/d3d/d3d9/IndexBuffer9.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+
+namespace rx
+{
+
+IndexBuffer9::IndexBuffer9(Renderer9 *const renderer) : mRenderer(renderer)
+{
+ mIndexBuffer = nullptr;
+ mBufferSize = 0;
+ mIndexType = gl::DrawElementsType::InvalidEnum;
+ mDynamic = false;
+}
+
+IndexBuffer9::~IndexBuffer9()
+{
+ SafeRelease(mIndexBuffer);
+}
+
+angle::Result IndexBuffer9::initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType,
+ bool dynamic)
+{
+ SafeRelease(mIndexBuffer);
+
+ updateSerial();
+
+ if (bufferSize > 0)
+ {
+ D3DFORMAT format = D3DFMT_UNKNOWN;
+ if (indexType == gl::DrawElementsType::UnsignedShort ||
+ indexType == gl::DrawElementsType::UnsignedByte)
+ {
+ format = D3DFMT_INDEX16;
+ }
+ else if (indexType == gl::DrawElementsType::UnsignedInt)
+ {
+ ASSERT(mRenderer->getNativeExtensions().elementIndexUint);
+ format = D3DFMT_INDEX32;
+ }
+ else
+ UNREACHABLE();
+
+ DWORD usageFlags = D3DUSAGE_WRITEONLY;
+ if (dynamic)
+ {
+ usageFlags |= D3DUSAGE_DYNAMIC;
+ }
+
+ HRESULT result =
+ mRenderer->createIndexBuffer(bufferSize, usageFlags, format, &mIndexBuffer);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result,
+ "Failed to allocate internal index buffer");
+ }
+
+ mBufferSize = bufferSize;
+ mIndexType = indexType;
+ mDynamic = dynamic;
+
+ return angle::Result::Continue;
+}
+
+angle::Result IndexBuffer9::mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory)
+{
+ ASSERT(mIndexBuffer);
+
+ DWORD lockFlags = mDynamic ? D3DLOCK_NOOVERWRITE : 0;
+
+ void *mapPtr = nullptr;
+ HRESULT result = mIndexBuffer->Lock(offset, size, &mapPtr, lockFlags);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to lock internal index buffer");
+
+ *outMappedMemory = mapPtr;
+ return angle::Result::Continue;
+}
+
+angle::Result IndexBuffer9::unmapBuffer(const gl::Context *context)
+{
+ ASSERT(mIndexBuffer);
+ HRESULT result = mIndexBuffer->Unlock();
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to unlock internal index buffer");
+
+ return angle::Result::Continue;
+}
+
+gl::DrawElementsType IndexBuffer9::getIndexType() const
+{
+ return mIndexType;
+}
+
+unsigned int IndexBuffer9::getBufferSize() const
+{
+ return mBufferSize;
+}
+
+angle::Result IndexBuffer9::setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType)
+{
+ if (bufferSize > mBufferSize || indexType != mIndexType)
+ {
+ return initialize(context, bufferSize, indexType, mDynamic);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result IndexBuffer9::discard(const gl::Context *context)
+{
+ ASSERT(mIndexBuffer);
+
+ void *dummy;
+ HRESULT result;
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ result = mIndexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
+ ANGLE_TRY_HR(context9, result, "Failed to lock internal index buffer");
+
+ result = mIndexBuffer->Unlock();
+ ANGLE_TRY_HR(context9, result, "Failed to unlock internal index buffer");
+
+ return angle::Result::Continue;
+}
+
+D3DFORMAT IndexBuffer9::getIndexFormat() const
+{
+ switch (mIndexType)
+ {
+ case gl::DrawElementsType::UnsignedByte:
+ return D3DFMT_INDEX16;
+ case gl::DrawElementsType::UnsignedShort:
+ return D3DFMT_INDEX16;
+ case gl::DrawElementsType::UnsignedInt:
+ return D3DFMT_INDEX32;
+ default:
+ UNREACHABLE();
+ return D3DFMT_UNKNOWN;
+ }
+}
+
+IDirect3DIndexBuffer9 *IndexBuffer9::getBuffer() const
+{
+ return mIndexBuffer;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h
new file mode 100644
index 0000000000..ca7cc20ed2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h
@@ -0,0 +1,57 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Indexffer9.h: Defines the D3D9 IndexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_INDEXBUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_INDEXBUFFER9_H_
+
+#include "libANGLE/renderer/d3d/IndexBuffer.h"
+
+namespace rx
+{
+class Renderer9;
+
+class IndexBuffer9 : public IndexBuffer
+{
+ public:
+ explicit IndexBuffer9(Renderer9 *const renderer);
+ ~IndexBuffer9() override;
+
+ angle::Result initialize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType,
+ bool dynamic) override;
+
+ angle::Result mapBuffer(const gl::Context *context,
+ unsigned int offset,
+ unsigned int size,
+ void **outMappedMemory) override;
+ angle::Result unmapBuffer(const gl::Context *context) override;
+
+ gl::DrawElementsType getIndexType() const override;
+ unsigned int getBufferSize() const override;
+ angle::Result setSize(const gl::Context *context,
+ unsigned int bufferSize,
+ gl::DrawElementsType indexType) override;
+
+ angle::Result discard(const gl::Context *context) override;
+
+ D3DFORMAT getIndexFormat() const;
+ IDirect3DIndexBuffer9 *getBuffer() const;
+
+ private:
+ Renderer9 *const mRenderer;
+
+ IDirect3DIndexBuffer9 *mIndexBuffer;
+ unsigned int mBufferSize;
+ gl::DrawElementsType mIndexType;
+ bool mDynamic;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_INDEXBUFFER9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp
new file mode 100644
index 0000000000..6ee408fe8b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp
@@ -0,0 +1,37 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// NativeWindow9.cpp: Defines NativeWindow9, a class for managing and
+// performing operations on an EGLNativeWindowType for the D3D9 renderer.
+
+#include "libANGLE/renderer/d3d/d3d9/NativeWindow9.h"
+
+namespace rx
+{
+NativeWindow9::NativeWindow9(EGLNativeWindowType window) : NativeWindowD3D(window) {}
+
+bool NativeWindow9::initialize()
+{
+ return true;
+}
+
+bool NativeWindow9::getClientRect(LPRECT rect) const
+{
+ return GetClientRect(getNativeWindow(), rect) == TRUE;
+}
+
+bool NativeWindow9::isIconic() const
+{
+ return IsIconic(getNativeWindow()) == TRUE;
+}
+
+// static
+bool NativeWindow9::IsValidNativeWindow(EGLNativeWindowType window)
+{
+ return IsWindow(window) == TRUE;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h
new file mode 100644
index 0000000000..a56b08dc81
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.h
@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// NativeWindow9.h: Defines NativeWindow9, a class for managing and
+// performing operations on an EGLNativeWindowType for the D3D9 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_NATIVEWINDOW9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_NATIVEWINDOW9_H_
+
+#include "common/debug.h"
+#include "common/platform.h"
+
+#include "libANGLE/renderer/d3d/NativeWindowD3D.h"
+
+namespace rx
+{
+
+class NativeWindow9 : public NativeWindowD3D
+{
+ public:
+ explicit NativeWindow9(EGLNativeWindowType window);
+
+ bool initialize() override;
+ bool getClientRect(LPRECT rect) const override;
+ bool isIconic() const override;
+
+ static bool IsValidNativeWindow(EGLNativeWindowType window);
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_NATIVEWINDOW9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.cpp
new file mode 100644
index 0000000000..06a977ce10
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.cpp
@@ -0,0 +1,176 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl.
+
+#include "libANGLE/renderer/d3d/d3d9/Query9.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+#include <GLES2/gl2ext.h>
+
+namespace rx
+{
+Query9::Query9(Renderer9 *renderer, gl::QueryType type)
+ : QueryImpl(type),
+ mGetDataAttemptCount(0),
+ mResult(GL_FALSE),
+ mQueryFinished(false),
+ mRenderer(renderer),
+ mQuery(nullptr)
+{}
+
+Query9::~Query9()
+{
+ SafeRelease(mQuery);
+}
+
+angle::Result Query9::begin(const gl::Context *context)
+{
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ D3DQUERYTYPE d3dQueryType = gl_d3d9::ConvertQueryType(getType());
+ if (mQuery == nullptr)
+ {
+ HRESULT result = mRenderer->getDevice()->CreateQuery(d3dQueryType, &mQuery);
+ ANGLE_TRY_HR(context9, result, "Internal query creation failed");
+ }
+
+ if (d3dQueryType != D3DQUERYTYPE_EVENT)
+ {
+ HRESULT result = mQuery->Issue(D3DISSUE_BEGIN);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to begin internal query");
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Query9::end(const gl::Context *context)
+{
+ Context9 *context9 = GetImplAs<Context9>(context);
+ ASSERT(mQuery);
+
+ HRESULT result = mQuery->Issue(D3DISSUE_END);
+ ASSERT(SUCCEEDED(result));
+ ANGLE_TRY_HR(context9, result, "Failed to end internal query");
+ mQueryFinished = false;
+ mResult = GL_FALSE;
+
+ return angle::Result::Continue;
+}
+
+angle::Result Query9::queryCounter(const gl::Context *context)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+}
+
+template <typename T>
+angle::Result Query9::getResultBase(Context9 *context9, T *params)
+{
+ while (!mQueryFinished)
+ {
+ ANGLE_TRY(testQuery(context9));
+
+ if (!mQueryFinished)
+ {
+ Sleep(0);
+ }
+ }
+
+ ASSERT(mQueryFinished);
+ *params = static_cast<T>(mResult);
+ return angle::Result::Continue;
+}
+
+angle::Result Query9::getResult(const gl::Context *context, GLint *params)
+{
+ return getResultBase(GetImplAs<Context9>(context), params);
+}
+
+angle::Result Query9::getResult(const gl::Context *context, GLuint *params)
+{
+ return getResultBase(GetImplAs<Context9>(context), params);
+}
+
+angle::Result Query9::getResult(const gl::Context *context, GLint64 *params)
+{
+ return getResultBase(GetImplAs<Context9>(context), params);
+}
+
+angle::Result Query9::getResult(const gl::Context *context, GLuint64 *params)
+{
+ return getResultBase(GetImplAs<Context9>(context), params);
+}
+
+angle::Result Query9::isResultAvailable(const gl::Context *context, bool *available)
+{
+ ANGLE_TRY(testQuery(GetImplAs<Context9>(context)));
+ *available = mQueryFinished;
+ return angle::Result::Continue;
+}
+
+angle::Result Query9::testQuery(Context9 *context9)
+{
+ if (!mQueryFinished)
+ {
+ ASSERT(mQuery);
+
+ HRESULT result = S_OK;
+ switch (getType())
+ {
+ case gl::QueryType::AnySamples:
+ case gl::QueryType::AnySamplesConservative:
+ {
+ DWORD numPixels = 0;
+ result = mQuery->GetData(&numPixels, sizeof(numPixels), D3DGETDATA_FLUSH);
+ if (result == S_OK)
+ {
+ mQueryFinished = true;
+ mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
+ }
+ break;
+ }
+
+ case gl::QueryType::CommandsCompleted:
+ {
+ BOOL completed = FALSE;
+ result = mQuery->GetData(&completed, sizeof(completed), D3DGETDATA_FLUSH);
+ if (result == S_OK)
+ {
+ mQueryFinished = true;
+ mResult = (completed == TRUE) ? GL_TRUE : GL_FALSE;
+ }
+ break;
+ }
+
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ if (!mQueryFinished)
+ {
+ ANGLE_TRY_HR(context9, result, "Failed to test get query result");
+
+ mGetDataAttemptCount++;
+ bool checkDeviceLost =
+ (mGetDataAttemptCount % kPollingD3DDeviceLostCheckFrequency) == 0;
+ if (checkDeviceLost && mRenderer->testDeviceLost())
+ {
+ ANGLE_TRY_HR(context9, D3DERR_DEVICELOST,
+ "Failed to test get query result, device is lost");
+ }
+ }
+ }
+
+ return angle::Result::Continue;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.h
new file mode 100644
index 0000000000..15e4be5bb5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Query9.h
@@ -0,0 +1,50 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Query9.h: Defines the rx::Query9 class which implements rx::QueryImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_
+
+#include "libANGLE/renderer/QueryImpl.h"
+
+namespace rx
+{
+class Context9;
+class Renderer9;
+
+class Query9 : public QueryImpl
+{
+ public:
+ Query9(Renderer9 *renderer, gl::QueryType type);
+ ~Query9() override;
+
+ angle::Result begin(const gl::Context *context) override;
+ angle::Result end(const gl::Context *context) override;
+ angle::Result queryCounter(const gl::Context *context) override;
+ angle::Result getResult(const gl::Context *context, GLint *params) override;
+ angle::Result getResult(const gl::Context *context, GLuint *params) override;
+ angle::Result getResult(const gl::Context *context, GLint64 *params) override;
+ angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
+ angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
+
+ private:
+ angle::Result testQuery(Context9 *context9);
+
+ template <typename T>
+ angle::Result getResultBase(Context9 *context9, T *params);
+
+ unsigned int mGetDataAttemptCount;
+ GLuint64 mResult;
+ bool mQueryFinished;
+
+ Renderer9 *mRenderer;
+ IDirect3DQuery9 *mQuery;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp
new file mode 100644
index 0000000000..9104bed617
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp
@@ -0,0 +1,160 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTarget9.cpp: Implements a D3D9-specific wrapper for IDirect3DSurface9
+// pointers retained by renderbuffers.
+
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/SwapChain9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace rx
+{
+
+// TODO: AddRef the incoming surface to take ownership instead of expecting that its ref is being
+// given.
+TextureRenderTarget9::TextureRenderTarget9(IDirect3DBaseTexture9 *texture,
+ size_t textureLevel,
+ IDirect3DSurface9 *surface,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei samples)
+ : mWidth(width),
+ mHeight(height),
+ mDepth(depth),
+ mInternalFormat(internalFormat),
+ mD3DFormat(D3DFMT_UNKNOWN),
+ mSamples(samples),
+ mTexture(texture),
+ mTextureLevel(textureLevel),
+ mRenderTarget(surface)
+{
+ ASSERT(mDepth == 1);
+
+ if (mRenderTarget)
+ {
+ D3DSURFACE_DESC description;
+ mRenderTarget->GetDesc(&description);
+ mD3DFormat = description.Format;
+ }
+}
+
+TextureRenderTarget9::~TextureRenderTarget9()
+{
+ SafeRelease(mTexture);
+ SafeRelease(mRenderTarget);
+}
+
+GLsizei TextureRenderTarget9::getWidth() const
+{
+ return mWidth;
+}
+
+GLsizei TextureRenderTarget9::getHeight() const
+{
+ return mHeight;
+}
+
+GLsizei TextureRenderTarget9::getDepth() const
+{
+ return mDepth;
+}
+
+GLenum TextureRenderTarget9::getInternalFormat() const
+{
+ return mInternalFormat;
+}
+
+GLsizei TextureRenderTarget9::getSamples() const
+{
+ return mSamples;
+}
+
+IDirect3DBaseTexture9 *TextureRenderTarget9::getTexture() const
+{
+ return mTexture;
+}
+
+size_t TextureRenderTarget9::getTextureLevel() const
+{
+ return mTextureLevel;
+}
+
+IDirect3DSurface9 *TextureRenderTarget9::getSurface() const
+{
+ // Caller is responsible for releasing the returned surface reference.
+ // TODO: remove the AddRef to match RenderTarget11
+ if (mRenderTarget)
+ {
+ mRenderTarget->AddRef();
+ }
+
+ return mRenderTarget;
+}
+
+D3DFORMAT TextureRenderTarget9::getD3DFormat() const
+{
+ return mD3DFormat;
+}
+
+SurfaceRenderTarget9::SurfaceRenderTarget9(SwapChain9 *swapChain, bool depth)
+ : mSwapChain(swapChain), mDepth(depth)
+{}
+
+SurfaceRenderTarget9::~SurfaceRenderTarget9() {}
+
+GLsizei SurfaceRenderTarget9::getWidth() const
+{
+ return mSwapChain->getWidth();
+}
+
+GLsizei SurfaceRenderTarget9::getHeight() const
+{
+ return mSwapChain->getHeight();
+}
+
+GLsizei SurfaceRenderTarget9::getDepth() const
+{
+ return 1;
+}
+
+GLenum SurfaceRenderTarget9::getInternalFormat() const
+{
+ return (mDepth ? mSwapChain->getDepthBufferInternalFormat()
+ : mSwapChain->getRenderTargetInternalFormat());
+}
+
+GLsizei SurfaceRenderTarget9::getSamples() const
+{
+ // Our EGL surfaces do not support multisampling.
+ return 0;
+}
+
+IDirect3DSurface9 *SurfaceRenderTarget9::getSurface() const
+{
+ return (mDepth ? mSwapChain->getDepthStencil() : mSwapChain->getRenderTarget());
+}
+
+IDirect3DBaseTexture9 *SurfaceRenderTarget9::getTexture() const
+{
+ return (mDepth ? nullptr : mSwapChain->getOffscreenTexture());
+}
+
+size_t SurfaceRenderTarget9::getTextureLevel() const
+{
+ return 0;
+}
+
+D3DFORMAT SurfaceRenderTarget9::getD3DFormat() const
+{
+ return d3d9::GetTextureFormatInfo(getInternalFormat()).texFormat;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h
new file mode 100644
index 0000000000..2b189479ab
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h
@@ -0,0 +1,98 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTarget9.h: Defines a D3D9-specific wrapper for IDirect3DSurface9 pointers
+// retained by Renderbuffers.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_RENDERTARGET9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_RENDERTARGET9_H_
+
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+
+namespace rx
+{
+class Renderer9;
+class SwapChain9;
+
+class RenderTarget9 : public RenderTargetD3D
+{
+ public:
+ RenderTarget9() {}
+ ~RenderTarget9() override {}
+ // Retrieve the texture that backs this render target, may be null for swap chain render
+ // targets.
+ virtual IDirect3DBaseTexture9 *getTexture() const = 0;
+ virtual size_t getTextureLevel() const = 0;
+
+ virtual IDirect3DSurface9 *getSurface() const = 0;
+
+ virtual D3DFORMAT getD3DFormat() const = 0;
+};
+
+class TextureRenderTarget9 : public RenderTarget9
+{
+ public:
+ TextureRenderTarget9(IDirect3DBaseTexture9 *texture,
+ size_t textureLevel,
+ IDirect3DSurface9 *surface,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei samples);
+ ~TextureRenderTarget9() override;
+
+ GLsizei getWidth() const override;
+ GLsizei getHeight() const override;
+ GLsizei getDepth() const override;
+ GLenum getInternalFormat() const override;
+ GLsizei getSamples() const override;
+
+ IDirect3DBaseTexture9 *getTexture() const override;
+ size_t getTextureLevel() const override;
+ IDirect3DSurface9 *getSurface() const override;
+
+ D3DFORMAT getD3DFormat() const override;
+
+ private:
+ GLsizei mWidth;
+ GLsizei mHeight;
+ GLsizei mDepth;
+ GLenum mInternalFormat;
+ D3DFORMAT mD3DFormat;
+ GLsizei mSamples;
+
+ IDirect3DBaseTexture9 *mTexture;
+ size_t mTextureLevel;
+ IDirect3DSurface9 *mRenderTarget;
+};
+
+class SurfaceRenderTarget9 : public RenderTarget9
+{
+ public:
+ SurfaceRenderTarget9(SwapChain9 *swapChain, bool depth);
+ ~SurfaceRenderTarget9() override;
+
+ GLsizei getWidth() const override;
+ GLsizei getHeight() const override;
+ GLsizei getDepth() const override;
+ GLenum getInternalFormat() const override;
+ GLsizei getSamples() const override;
+
+ IDirect3DBaseTexture9 *getTexture() const override;
+ size_t getTextureLevel() const override;
+ IDirect3DSurface9 *getSurface() const override;
+
+ D3DFORMAT getD3DFormat() const override;
+
+ private:
+ SwapChain9 *mSwapChain;
+ bool mDepth;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERTARGET9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
new file mode 100644
index 0000000000..558023658d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -0,0 +1,3239 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderer9.cpp: Implements a back-end specific class for the D3D9 renderer.
+
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+
+#include <EGL/eglext.h>
+#include <sstream>
+
+#include "common/utilities.h"
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/State.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/features.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/CompilerD3D.h"
+#include "libANGLE/renderer/d3d/DeviceD3D.h"
+#include "libANGLE/renderer/d3d/FramebufferD3D.h"
+#include "libANGLE/renderer/d3d/IndexDataManager.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/RenderbufferD3D.h"
+#include "libANGLE/renderer/d3d/ShaderD3D.h"
+#include "libANGLE/renderer/d3d/SurfaceD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/Blit9.h"
+#include "libANGLE/renderer/d3d/d3d9/Buffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+#include "libANGLE/renderer/d3d/d3d9/Fence9.h"
+#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/Image9.h"
+#include "libANGLE/renderer/d3d/d3d9/IndexBuffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/NativeWindow9.h"
+#include "libANGLE/renderer/d3d/d3d9/Query9.h"
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+#include "libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h"
+#include "libANGLE/renderer/d3d/d3d9/SwapChain9.h"
+#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
+#include "libANGLE/renderer/d3d/d3d9/VertexArray9.h"
+#include "libANGLE/renderer/d3d/d3d9/VertexBuffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+#include "libANGLE/trace.h"
+
+#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+# define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
+#endif
+
+// Enable ANGLE_SUPPORT_SHADER_MODEL_2 if you wish devices with only shader model 2.
+// Such a device would not be conformant.
+#ifndef ANGLE_SUPPORT_SHADER_MODEL_2
+# define ANGLE_SUPPORT_SHADER_MODEL_2 0
+#endif
+
+namespace rx
+{
+
+namespace
+{
+enum
+{
+ MAX_VERTEX_CONSTANT_VECTORS_D3D9 = 256,
+ MAX_PIXEL_CONSTANT_VECTORS_SM2 = 32,
+ MAX_PIXEL_CONSTANT_VECTORS_SM3 = 224,
+ MAX_VARYING_VECTORS_SM2 = 8,
+ MAX_VARYING_VECTORS_SM3 = 10,
+
+ MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4
+};
+
+template <typename T>
+static void DrawPoints(IDirect3DDevice9 *device, GLsizei count, const void *indices, int minIndex)
+{
+ for (int i = 0; i < count; i++)
+ {
+ unsigned int indexValue =
+ static_cast<unsigned int>(static_cast<const T *>(indices)[i]) - minIndex;
+ device->DrawPrimitive(D3DPT_POINTLIST, indexValue, 1);
+ }
+}
+
+// A hard limit on buffer size. This works around a problem in the NVIDIA drivers where buffer sizes
+// close to MAX_UINT would give undefined results. The limit of MAX_UINT/2 should be generous enough
+// for almost any demanding application.
+constexpr UINT kMaximumBufferSizeHardLimit = std::numeric_limits<UINT>::max() >> 1;
+} // anonymous namespace
+
+Renderer9::Renderer9(egl::Display *display) : RendererD3D(display), mStateManager(this)
+{
+ mD3d9Module = nullptr;
+
+ mD3d9 = nullptr;
+ mD3d9Ex = nullptr;
+ mDevice = nullptr;
+ mDeviceEx = nullptr;
+ mDeviceWindow = nullptr;
+ mBlit = nullptr;
+
+ mAdapter = D3DADAPTER_DEFAULT;
+
+ const egl::AttributeMap &attributes = display->getAttributeMap();
+ EGLint requestedDeviceType = static_cast<EGLint>(attributes.get(
+ EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE));
+ switch (requestedDeviceType)
+ {
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
+ mDeviceType = D3DDEVTYPE_HAL;
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
+ mDeviceType = D3DDEVTYPE_REF;
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
+ mDeviceType = D3DDEVTYPE_NULLREF;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ mMaskedClearSavedState = nullptr;
+
+ mVertexDataManager = nullptr;
+ mIndexDataManager = nullptr;
+ mLineLoopIB = nullptr;
+ mCountingIB = nullptr;
+
+ mMaxNullColorbufferLRU = 0;
+ for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+ {
+ mNullRenderTargetCache[i].lruCount = 0;
+ mNullRenderTargetCache[i].width = 0;
+ mNullRenderTargetCache[i].height = 0;
+ mNullRenderTargetCache[i].renderTarget = nullptr;
+ }
+
+ mAppliedVertexShader = nullptr;
+ mAppliedPixelShader = nullptr;
+ mAppliedProgramSerial = 0;
+
+ gl::InitializeDebugAnnotations(&mAnnotator);
+}
+
+Renderer9::~Renderer9()
+{
+ if (mDevice)
+ {
+ // If the device is lost, reset it first to prevent leaving the driver in an unstable state
+ if (testDeviceLost())
+ {
+ resetDevice();
+ }
+ }
+
+ release();
+}
+
+void Renderer9::release()
+{
+ gl::UninitializeDebugAnnotations();
+
+ mTranslatedAttribCache.clear();
+
+ releaseDeviceResources();
+
+ SafeRelease(mDevice);
+ SafeRelease(mDeviceEx);
+ SafeRelease(mD3d9);
+ SafeRelease(mD3d9Ex);
+
+ mCompiler.release();
+
+ if (mDeviceWindow)
+ {
+ DestroyWindow(mDeviceWindow);
+ mDeviceWindow = nullptr;
+ }
+
+ mD3d9Module = nullptr;
+}
+
+egl::Error Renderer9::initialize()
+{
+ ANGLE_TRACE_EVENT0("gpu.angle", "GetModuleHandle_d3d9");
+ mD3d9Module = ::LoadLibrary(TEXT("d3d9.dll"));
+
+ if (mD3d9Module == nullptr)
+ {
+ return egl::EglNotInitialized(D3D9_INIT_MISSING_DEP) << "No D3D9 module found.";
+ }
+
+ typedef HRESULT(WINAPI * Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex **);
+ Direct3DCreate9ExFunc Direct3DCreate9ExPtr =
+ reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
+
+ // Use Direct3D9Ex if available. Among other things, this version is less
+ // inclined to report a lost context, for example when the user switches
+ // desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are
+ // available.
+ if (ANGLE_D3D9EX == ANGLE_ENABLED && Direct3DCreate9ExPtr &&
+ SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9Ex)))
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "D3d9Ex_QueryInterface");
+ ASSERT(mD3d9Ex);
+ mD3d9Ex->QueryInterface(__uuidof(IDirect3D9), reinterpret_cast<void **>(&mD3d9));
+ ASSERT(mD3d9);
+ }
+ else
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "Direct3DCreate9");
+ mD3d9 = Direct3DCreate9(D3D_SDK_VERSION);
+ }
+
+ if (!mD3d9)
+ {
+ return egl::EglNotInitialized(D3D9_INIT_MISSING_DEP) << "Could not create D3D9 device.";
+ }
+
+ if (mDisplay->getNativeDisplayId() != nullptr)
+ {
+ // UNIMPLEMENTED(); // FIXME: Determine which adapter index the device context
+ // corresponds to
+ }
+
+ HRESULT result;
+
+ // Give up on getting device caps after about one second.
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "GetDeviceCaps");
+ for (int i = 0; i < 10; ++i)
+ {
+ result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps);
+ if (SUCCEEDED(result))
+ {
+ break;
+ }
+ else if (result == D3DERR_NOTAVAILABLE)
+ {
+ Sleep(100); // Give the driver some time to initialize/recover
+ }
+ else if (FAILED(result)) // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY,
+ // D3DERR_INVALIDDEVICE, or another error we can't recover
+ // from
+ {
+ return egl::EglNotInitialized(D3D9_INIT_OTHER_ERROR)
+ << "Failed to get device caps, " << gl::FmtHR(result);
+ }
+ }
+ }
+
+#if ANGLE_SUPPORT_SHADER_MODEL_2
+ size_t minShaderModel = 2;
+#else
+ size_t minShaderModel = 3;
+#endif
+
+ if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(minShaderModel, 0))
+ {
+ return egl::EglNotInitialized(D3D9_INIT_UNSUPPORTED_VERSION)
+ << "Renderer does not support PS " << minShaderModel << ".0, aborting!";
+ }
+
+ // When DirectX9 is running with an older DirectX8 driver, a StretchRect from a regular texture
+ // to a render target texture is not supported. This is required by
+ // Texture2D::ensureRenderTarget.
+ if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
+ {
+ return egl::EglNotInitialized(D3D9_INIT_UNSUPPORTED_STRETCHRECT)
+ << "Renderer does not support StretctRect from textures.";
+ }
+
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "GetAdapterIdentifier");
+ mD3d9->GetAdapterIdentifier(mAdapter, 0, &mAdapterIdentifier);
+ }
+
+ static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
+ static const TCHAR className[] = TEXT("STATIC");
+
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "CreateWindowEx");
+ mDeviceWindow =
+ CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1,
+ 1, HWND_MESSAGE, nullptr, GetModuleHandle(nullptr), nullptr);
+ }
+
+ D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
+ DWORD behaviorFlags =
+ D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES | D3DCREATE_MULTITHREADED;
+
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "D3d9_CreateDevice");
+ result = mD3d9->CreateDevice(
+ mAdapter, mDeviceType, mDeviceWindow,
+ behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE,
+ &presentParameters, &mDevice);
+ }
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
+ {
+ return egl::EglBadAlloc(D3D9_INIT_OUT_OF_MEMORY)
+ << "CreateDevice failed: device lost of out of memory";
+ }
+
+ if (FAILED(result))
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "D3d9_CreateDevice2");
+ result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow,
+ behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING,
+ &presentParameters, &mDevice);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY ||
+ result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
+ return egl::EglBadAlloc(D3D9_INIT_OUT_OF_MEMORY)
+ << "CreateDevice2 failed: device lost, not available, or of out of memory";
+ }
+ }
+
+ if (mD3d9Ex)
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "mDevice_QueryInterface");
+ result = mDevice->QueryInterface(__uuidof(IDirect3DDevice9Ex), (void **)&mDeviceEx);
+ ASSERT(SUCCEEDED(result));
+ }
+
+ {
+ ANGLE_TRACE_EVENT0("gpu.angle", "ShaderCache initialize");
+ mVertexShaderCache.initialize(mDevice);
+ mPixelShaderCache.initialize(mDevice);
+ }
+
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ // Check vertex texture support
+ // Only Direct3D 10 ready devices support all the necessary vertex texture formats.
+ // We test this using D3D9 by checking support for the R16F format.
+ mVertexTextureSupport = mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0) &&
+ SUCCEEDED(mD3d9->CheckDeviceFormat(
+ mAdapter, mDeviceType, currentDisplayMode.Format,
+ D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F));
+
+ ANGLE_TRY(initializeDevice());
+
+ return egl::NoError();
+}
+
+// do any one-time device initialization
+// NOTE: this is also needed after a device lost/reset
+// to reset the scene status and ensure the default states are reset.
+egl::Error Renderer9::initializeDevice()
+{
+ // Permanent non-default states
+ mDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
+ mDevice->SetRenderState(D3DRS_LASTPIXEL, FALSE);
+
+ if (mDeviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0))
+ {
+ mDevice->SetRenderState(D3DRS_POINTSIZE_MAX, (DWORD &)mDeviceCaps.MaxPointSize);
+ }
+ else
+ {
+ mDevice->SetRenderState(D3DRS_POINTSIZE_MAX, 0x3F800000); // 1.0f
+ }
+
+ const gl::Caps &rendererCaps = getNativeCaps();
+
+ mCurVertexSamplerStates.resize(rendererCaps.maxShaderTextureImageUnits[gl::ShaderType::Vertex]);
+ mCurPixelSamplerStates.resize(
+ rendererCaps.maxShaderTextureImageUnits[gl::ShaderType::Fragment]);
+
+ mCurVertexTextures.resize(rendererCaps.maxShaderTextureImageUnits[gl::ShaderType::Vertex]);
+ mCurPixelTextures.resize(rendererCaps.maxShaderTextureImageUnits[gl::ShaderType::Fragment]);
+
+ markAllStateDirty();
+
+ mSceneStarted = false;
+
+ ASSERT(!mBlit);
+ mBlit = new Blit9(this);
+
+ ASSERT(!mVertexDataManager && !mIndexDataManager);
+ mIndexDataManager = new IndexDataManager(this);
+
+ mTranslatedAttribCache.resize(getNativeCaps().maxVertexAttributes);
+
+ mStateManager.initialize();
+
+ return egl::NoError();
+}
+
+D3DPRESENT_PARAMETERS Renderer9::getDefaultPresentParameters()
+{
+ D3DPRESENT_PARAMETERS presentParameters = {0};
+
+ // The default swap chain is never actually used. Surface will create a new swap chain with the
+ // proper parameters.
+ presentParameters.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
+ presentParameters.BackBufferCount = 1;
+ presentParameters.BackBufferFormat = D3DFMT_UNKNOWN;
+ presentParameters.BackBufferWidth = 1;
+ presentParameters.BackBufferHeight = 1;
+ presentParameters.EnableAutoDepthStencil = FALSE;
+ presentParameters.Flags = 0;
+ presentParameters.hDeviceWindow = mDeviceWindow;
+ presentParameters.MultiSampleQuality = 0;
+ presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE;
+ presentParameters.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
+ presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ presentParameters.Windowed = TRUE;
+
+ return presentParameters;
+}
+
+egl::ConfigSet Renderer9::generateConfigs()
+{
+ static const GLenum colorBufferFormats[] = {
+ GL_BGR5_A1_ANGLEX,
+ GL_BGRA8_EXT,
+ GL_RGB565,
+
+ };
+
+ static const GLenum depthStencilBufferFormats[] = {
+ GL_NONE,
+ GL_DEPTH_COMPONENT32_OES,
+ GL_DEPTH24_STENCIL8_OES,
+ GL_DEPTH_COMPONENT24_OES,
+ GL_DEPTH_COMPONENT16,
+ };
+
+ const gl::Caps &rendererCaps = getNativeCaps();
+ const gl::TextureCapsMap &rendererTextureCaps = getNativeTextureCaps();
+
+ D3DDISPLAYMODE currentDisplayMode;
+ mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
+
+ // Determine the min and max swap intervals
+ int minSwapInterval = 4;
+ int maxSwapInterval = 0;
+
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
+ {
+ minSwapInterval = std::min(minSwapInterval, 0);
+ maxSwapInterval = std::max(maxSwapInterval, 0);
+ }
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
+ {
+ minSwapInterval = std::min(minSwapInterval, 1);
+ maxSwapInterval = std::max(maxSwapInterval, 1);
+ }
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO)
+ {
+ minSwapInterval = std::min(minSwapInterval, 2);
+ maxSwapInterval = std::max(maxSwapInterval, 2);
+ }
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_THREE)
+ {
+ minSwapInterval = std::min(minSwapInterval, 3);
+ maxSwapInterval = std::max(maxSwapInterval, 3);
+ }
+ if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_FOUR)
+ {
+ minSwapInterval = std::min(minSwapInterval, 4);
+ maxSwapInterval = std::max(maxSwapInterval, 4);
+ }
+
+ egl::ConfigSet configs;
+ for (size_t formatIndex = 0; formatIndex < ArraySize(colorBufferFormats); formatIndex++)
+ {
+ GLenum colorBufferInternalFormat = colorBufferFormats[formatIndex];
+ const gl::TextureCaps &colorBufferFormatCaps =
+ rendererTextureCaps.get(colorBufferInternalFormat);
+ if (colorBufferFormatCaps.renderbuffer)
+ {
+ ASSERT(colorBufferFormatCaps.textureAttachment);
+ for (size_t depthStencilIndex = 0;
+ depthStencilIndex < ArraySize(depthStencilBufferFormats); depthStencilIndex++)
+ {
+ GLenum depthStencilBufferInternalFormat =
+ depthStencilBufferFormats[depthStencilIndex];
+ const gl::TextureCaps &depthStencilBufferFormatCaps =
+ rendererTextureCaps.get(depthStencilBufferInternalFormat);
+ if (depthStencilBufferFormatCaps.renderbuffer ||
+ depthStencilBufferInternalFormat == GL_NONE)
+ {
+ ASSERT(depthStencilBufferFormatCaps.textureAttachment ||
+ depthStencilBufferInternalFormat == GL_NONE);
+ const gl::InternalFormat &colorBufferFormatInfo =
+ gl::GetSizedInternalFormatInfo(colorBufferInternalFormat);
+ const gl::InternalFormat &depthStencilBufferFormatInfo =
+ gl::GetSizedInternalFormatInfo(depthStencilBufferInternalFormat);
+ const d3d9::TextureFormat &d3d9ColorBufferFormatInfo =
+ d3d9::GetTextureFormatInfo(colorBufferInternalFormat);
+
+ egl::Config config;
+ config.renderTargetFormat = colorBufferInternalFormat;
+ config.depthStencilFormat = depthStencilBufferInternalFormat;
+ config.bufferSize = colorBufferFormatInfo.pixelBytes * 8;
+ config.redSize = colorBufferFormatInfo.redBits;
+ config.greenSize = colorBufferFormatInfo.greenBits;
+ config.blueSize = colorBufferFormatInfo.blueBits;
+ config.luminanceSize = colorBufferFormatInfo.luminanceBits;
+ config.alphaSize = colorBufferFormatInfo.alphaBits;
+ config.alphaMaskSize = 0;
+ config.bindToTextureRGB = (colorBufferFormatInfo.format == GL_RGB);
+ config.bindToTextureRGBA = (colorBufferFormatInfo.format == GL_RGBA ||
+ colorBufferFormatInfo.format == GL_BGRA_EXT);
+ config.colorBufferType = EGL_RGB_BUFFER;
+ // Mark as slow if blits to the back-buffer won't be straight forward
+ config.configCaveat =
+ (currentDisplayMode.Format == d3d9ColorBufferFormatInfo.renderFormat)
+ ? EGL_NONE
+ : EGL_SLOW_CONFIG;
+ config.configID = static_cast<EGLint>(configs.size() + 1);
+ config.conformant = EGL_OPENGL_ES2_BIT;
+ config.depthSize = depthStencilBufferFormatInfo.depthBits;
+ config.level = 0;
+ config.matchNativePixmap = EGL_NONE;
+ config.maxPBufferWidth = rendererCaps.max2DTextureSize;
+ config.maxPBufferHeight = rendererCaps.max2DTextureSize;
+ config.maxPBufferPixels =
+ rendererCaps.max2DTextureSize * rendererCaps.max2DTextureSize;
+ config.maxSwapInterval = maxSwapInterval;
+ config.minSwapInterval = minSwapInterval;
+ config.nativeRenderable = EGL_FALSE;
+ config.nativeVisualID = 0;
+ config.nativeVisualType = EGL_NONE;
+ config.renderableType = EGL_OPENGL_ES2_BIT;
+ config.sampleBuffers = 0; // FIXME: enumerate multi-sampling
+ config.samples = 0;
+ config.stencilSize = depthStencilBufferFormatInfo.stencilBits;
+ config.surfaceType =
+ EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+ config.transparentType = EGL_NONE;
+ config.transparentRedValue = 0;
+ config.transparentGreenValue = 0;
+ config.transparentBlueValue = 0;
+ config.colorComponentType = gl_egl::GLComponentTypeToEGLColorComponentType(
+ colorBufferFormatInfo.componentType);
+
+ configs.add(config);
+ }
+ }
+ }
+ }
+
+ ASSERT(configs.size() > 0);
+ return configs;
+}
+
+void Renderer9::generateDisplayExtensions(egl::DisplayExtensions *outExtensions) const
+{
+ outExtensions->createContextRobustness = true;
+
+ if (getShareHandleSupport())
+ {
+ outExtensions->d3dShareHandleClientBuffer = true;
+ outExtensions->surfaceD3DTexture2DShareHandle = true;
+ }
+ outExtensions->d3dTextureClientBuffer = true;
+
+ outExtensions->querySurfacePointer = true;
+ outExtensions->windowFixedSize = true;
+ outExtensions->postSubBuffer = true;
+ outExtensions->deviceQuery = true;
+
+ outExtensions->image = true;
+ outExtensions->imageBase = true;
+ outExtensions->glTexture2DImage = true;
+ outExtensions->glRenderbufferImage = true;
+
+ outExtensions->flexibleSurfaceCompatibility = true;
+
+ // Contexts are virtualized so textures can be shared globally
+ outExtensions->displayTextureShareGroup = true;
+
+ // D3D9 can be used without an output surface
+ outExtensions->surfacelessContext = true;
+
+ outExtensions->robustResourceInitialization = true;
+}
+
+void Renderer9::startScene()
+{
+ if (!mSceneStarted)
+ {
+ long result = mDevice->BeginScene();
+ if (SUCCEEDED(result))
+ {
+ // This is defensive checking against the device being
+ // lost at unexpected times.
+ mSceneStarted = true;
+ }
+ }
+}
+
+void Renderer9::endScene()
+{
+ if (mSceneStarted)
+ {
+ // EndScene can fail if the device was lost, for example due
+ // to a TDR during a draw call.
+ mDevice->EndScene();
+ mSceneStarted = false;
+ }
+}
+
+angle::Result Renderer9::flush(const gl::Context *context)
+{
+ IDirect3DQuery9 *query = nullptr;
+ ANGLE_TRY(allocateEventQuery(context, &query));
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ HRESULT result = query->Issue(D3DISSUE_END);
+ ANGLE_TRY_HR(context9, result, "Failed to issue event query");
+
+ // Grab the query data once
+ result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
+ freeEventQuery(query);
+ ANGLE_TRY_HR(context9, result, "Failed to get event query data");
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::finish(const gl::Context *context)
+{
+ IDirect3DQuery9 *query = nullptr;
+ ANGLE_TRY(allocateEventQuery(context, &query));
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ HRESULT result = query->Issue(D3DISSUE_END);
+ ANGLE_TRY_HR(context9, result, "Failed to issue event query");
+
+ // Grab the query data once
+ result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
+ if (FAILED(result))
+ {
+ freeEventQuery(query);
+ }
+ ANGLE_TRY_HR(context9, result, "Failed to get event query data");
+
+ // Loop until the query completes
+ unsigned int attempt = 0;
+ while (result == S_FALSE)
+ {
+ // Keep polling, but allow other threads to do something useful first
+ ScheduleYield();
+
+ result = query->GetData(nullptr, 0, D3DGETDATA_FLUSH);
+ attempt++;
+
+ if (result == S_FALSE)
+ {
+ // explicitly check for device loss
+ // some drivers seem to return S_FALSE even if the device is lost
+ // instead of D3DERR_DEVICELOST like they should
+ bool checkDeviceLost = (attempt % kPollingD3DDeviceLostCheckFrequency) == 0;
+ if (checkDeviceLost && testDeviceLost())
+ {
+ result = D3DERR_DEVICELOST;
+ }
+ }
+
+ if (FAILED(result))
+ {
+ freeEventQuery(query);
+ }
+ ANGLE_TRY_HR(context9, result, "Failed to get event query data");
+ }
+
+ freeEventQuery(query);
+
+ return angle::Result::Continue;
+}
+
+bool Renderer9::isValidNativeWindow(EGLNativeWindowType window) const
+{
+ return NativeWindow9::IsValidNativeWindow(window);
+}
+
+NativeWindowD3D *Renderer9::createNativeWindow(EGLNativeWindowType window,
+ const egl::Config *,
+ const egl::AttributeMap &) const
+{
+ return new NativeWindow9(window);
+}
+
+SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation,
+ EGLint samples)
+{
+ return new SwapChain9(this, GetAs<NativeWindow9>(nativeWindow), shareHandle, d3dTexture,
+ backBufferFormat, depthBufferFormat, orientation);
+}
+
+egl::Error Renderer9::getD3DTextureInfo(const egl::Config *configuration,
+ IUnknown *d3dTexture,
+ EGLint *width,
+ EGLint *height,
+ EGLint *samples,
+ const angle::Format **angleFormat) const
+{
+ IDirect3DTexture9 *texture = nullptr;
+ if (FAILED(d3dTexture->QueryInterface(&texture)))
+ {
+ return egl::EglBadParameter() << "Client buffer is not a IDirect3DTexture9";
+ }
+
+ IDirect3DDevice9 *textureDevice = nullptr;
+ texture->GetDevice(&textureDevice);
+ if (textureDevice != mDevice)
+ {
+ SafeRelease(texture);
+ return egl::EglBadParameter() << "Texture's device does not match.";
+ }
+ SafeRelease(textureDevice);
+
+ D3DSURFACE_DESC desc;
+ texture->GetLevelDesc(0, &desc);
+ SafeRelease(texture);
+
+ if (width)
+ {
+ *width = static_cast<EGLint>(desc.Width);
+ }
+ if (height)
+ {
+ *height = static_cast<EGLint>(desc.Height);
+ }
+
+ // GetSamplesCount() returns 0 when multisampling isn't used.
+ GLsizei sampleCount = d3d9_gl::GetSamplesCount(desc.MultiSampleType);
+ if ((configuration && configuration->samples > 1) || sampleCount != 0)
+ {
+ return egl::EglBadParameter() << "Multisampling not supported for client buffer texture";
+ }
+ if (samples)
+ {
+ *samples = static_cast<EGLint>(sampleCount);
+ }
+
+ // From table egl.restrictions in EGL_ANGLE_d3d_texture_client_buffer.
+ switch (desc.Format)
+ {
+ case D3DFMT_R8G8B8:
+ case D3DFMT_A8R8G8B8:
+ case D3DFMT_A16B16G16R16F:
+ case D3DFMT_A32B32G32R32F:
+ break;
+
+ default:
+ return egl::EglBadParameter()
+ << "Unknown client buffer texture format: " << desc.Format;
+ }
+
+ if (angleFormat)
+ {
+ const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
+ ASSERT(d3dFormatInfo.info().id != angle::FormatID::NONE);
+ *angleFormat = &d3dFormatInfo.info();
+ }
+
+ return egl::NoError();
+}
+
+egl::Error Renderer9::validateShareHandle(const egl::Config *config,
+ HANDLE shareHandle,
+ const egl::AttributeMap &attribs) const
+{
+ if (shareHandle == nullptr)
+ {
+ return egl::EglBadParameter() << "NULL share handle.";
+ }
+
+ EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
+ EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
+ ASSERT(width != 0 && height != 0);
+
+ const d3d9::TextureFormat &backBufferd3dFormatInfo =
+ d3d9::GetTextureFormatInfo(config->renderTargetFormat);
+
+ IDirect3DTexture9 *texture = nullptr;
+ HRESULT result = mDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET,
+ backBufferd3dFormatInfo.texFormat, D3DPOOL_DEFAULT,
+ &texture, &shareHandle);
+ if (FAILED(result))
+ {
+ return egl::EglBadParameter() << "Failed to open share handle, " << gl::FmtHR(result);
+ }
+
+ DWORD levelCount = texture->GetLevelCount();
+
+ D3DSURFACE_DESC desc;
+ texture->GetLevelDesc(0, &desc);
+ SafeRelease(texture);
+
+ if (levelCount != 1 || desc.Width != static_cast<UINT>(width) ||
+ desc.Height != static_cast<UINT>(height) ||
+ desc.Format != backBufferd3dFormatInfo.texFormat)
+ {
+ return egl::EglBadParameter() << "Invalid texture parameters in share handle texture.";
+ }
+
+ return egl::NoError();
+}
+
+ContextImpl *Renderer9::createContext(const gl::State &state, gl::ErrorSet *errorSet)
+{
+ return new Context9(state, errorSet, this);
+}
+
+void *Renderer9::getD3DDevice()
+{
+ return mDevice;
+}
+
+angle::Result Renderer9::allocateEventQuery(const gl::Context *context, IDirect3DQuery9 **outQuery)
+{
+ if (mEventQueryPool.empty())
+ {
+ HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, outQuery);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to allocate event query");
+ }
+ else
+ {
+ *outQuery = mEventQueryPool.back();
+ mEventQueryPool.pop_back();
+ }
+
+ return angle::Result::Continue;
+}
+
+void Renderer9::freeEventQuery(IDirect3DQuery9 *query)
+{
+ if (mEventQueryPool.size() > 1000)
+ {
+ SafeRelease(query);
+ }
+ else
+ {
+ mEventQueryPool.push_back(query);
+ }
+}
+
+angle::Result Renderer9::createVertexShader(d3d::Context *context,
+ const DWORD *function,
+ size_t length,
+ IDirect3DVertexShader9 **outShader)
+{
+ return mVertexShaderCache.create(context, function, length, outShader);
+}
+
+angle::Result Renderer9::createPixelShader(d3d::Context *context,
+ const DWORD *function,
+ size_t length,
+ IDirect3DPixelShader9 **outShader)
+{
+ return mPixelShaderCache.create(context, function, length, outShader);
+}
+
+HRESULT Renderer9::createVertexBuffer(UINT Length,
+ DWORD Usage,
+ IDirect3DVertexBuffer9 **ppVertexBuffer)
+{
+ // Force buffers to be limited to a fixed max size.
+ if (Length > kMaximumBufferSizeHardLimit)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ D3DPOOL Pool = getBufferPool(Usage);
+ return mDevice->CreateVertexBuffer(Length, Usage, 0, Pool, ppVertexBuffer, nullptr);
+}
+
+VertexBuffer *Renderer9::createVertexBuffer()
+{
+ return new VertexBuffer9(this);
+}
+
+HRESULT Renderer9::createIndexBuffer(UINT Length,
+ DWORD Usage,
+ D3DFORMAT Format,
+ IDirect3DIndexBuffer9 **ppIndexBuffer)
+{
+ // Force buffers to be limited to a fixed max size.
+ if (Length > kMaximumBufferSizeHardLimit)
+ {
+ return E_OUTOFMEMORY;
+ }
+
+ D3DPOOL Pool = getBufferPool(Usage);
+ return mDevice->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, nullptr);
+}
+
+IndexBuffer *Renderer9::createIndexBuffer()
+{
+ return new IndexBuffer9(this);
+}
+
+StreamProducerImpl *Renderer9::createStreamProducerD3DTexture(
+ egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs)
+{
+ // Streams are not supported under D3D9
+ UNREACHABLE();
+ return nullptr;
+}
+
+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;
+}
+
+angle::Result Renderer9::fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *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.
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Renderer9::setSamplerState(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture,
+ const gl::SamplerState &samplerState)
+{
+ CurSamplerState &appliedSampler = (type == gl::ShaderType::Fragment)
+ ? mCurPixelSamplerStates[index]
+ : mCurVertexSamplerStates[index];
+
+ // Make sure to add the level offset for our tiny compressed texture workaround
+ TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
+
+ TextureStorage *storage = nullptr;
+ ANGLE_TRY(textureD3D->getNativeTexture(context, &storage));
+
+ // Storage should exist, texture should be complete
+ ASSERT(storage);
+
+ DWORD baseLevel = texture->getBaseLevel() + storage->getTopLevel();
+
+ if (appliedSampler.forceSet || appliedSampler.baseLevel != baseLevel ||
+ memcmp(&samplerState, &appliedSampler, sizeof(gl::SamplerState)) != 0)
+ {
+ int d3dSamplerOffset = (type == gl::ShaderType::Fragment) ? 0 : D3DVERTEXTEXTURESAMPLER0;
+ int d3dSampler = index + d3dSamplerOffset;
+
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_ADDRESSU,
+ gl_d3d9::ConvertTextureWrap(samplerState.getWrapS()));
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_ADDRESSV,
+ gl_d3d9::ConvertTextureWrap(samplerState.getWrapT()));
+
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAGFILTER,
+ gl_d3d9::ConvertMagFilter(samplerState.getMagFilter(),
+ samplerState.getMaxAnisotropy()));
+
+ D3DTEXTUREFILTERTYPE d3dMinFilter, d3dMipFilter;
+ float lodBias;
+ gl_d3d9::ConvertMinFilter(samplerState.getMinFilter(), &d3dMinFilter, &d3dMipFilter,
+ &lodBias, samplerState.getMaxAnisotropy(), baseLevel);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MINFILTER, d3dMinFilter);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPFILTER, d3dMipFilter);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXMIPLEVEL, baseLevel);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPMAPLODBIAS, static_cast<DWORD>(lodBias));
+ if (getNativeExtensions().textureFilterAnisotropic)
+ {
+ DWORD maxAnisotropy = std::min(mDeviceCaps.MaxAnisotropy,
+ static_cast<DWORD>(samplerState.getMaxAnisotropy()));
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, maxAnisotropy);
+ }
+
+ ASSERT(texture->getBorderColor().type == angle::ColorGeneric::Type::Float);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_BORDERCOLOR,
+ gl_d3d9::ConvertColor(texture->getBorderColor().colorF));
+ }
+
+ appliedSampler.forceSet = false;
+ appliedSampler.samplerState = samplerState;
+ appliedSampler.baseLevel = baseLevel;
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::setTexture(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture)
+{
+ int d3dSamplerOffset = (type == gl::ShaderType::Fragment) ? 0 : D3DVERTEXTEXTURESAMPLER0;
+ int d3dSampler = index + d3dSamplerOffset;
+ IDirect3DBaseTexture9 *d3dTexture = nullptr;
+ bool forceSetTexture = false;
+
+ std::vector<uintptr_t> &appliedTextures =
+ (type == gl::ShaderType::Fragment) ? mCurPixelTextures : mCurVertexTextures;
+
+ if (texture)
+ {
+ TextureD3D *textureImpl = GetImplAs<TextureD3D>(texture);
+
+ TextureStorage *texStorage = nullptr;
+ ANGLE_TRY(textureImpl->getNativeTexture(context, &texStorage));
+
+ // Texture should be complete and have a storage
+ ASSERT(texStorage);
+
+ TextureStorage9 *storage9 = GetAs<TextureStorage9>(texStorage);
+ ANGLE_TRY(storage9->getBaseTexture(context, &d3dTexture));
+
+ // If we get NULL back from getBaseTexture here, something went wrong
+ // in the texture class and we're unexpectedly missing the d3d texture
+ ASSERT(d3dTexture != nullptr);
+
+ forceSetTexture = textureImpl->hasDirtyImages();
+ textureImpl->resetDirty();
+ }
+
+ if (forceSetTexture || appliedTextures[index] != reinterpret_cast<uintptr_t>(d3dTexture))
+ {
+ mDevice->SetTexture(d3dSampler, d3dTexture);
+ }
+
+ appliedTextures[index] = reinterpret_cast<uintptr_t>(d3dTexture);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::updateState(const gl::Context *context, gl::PrimitiveMode drawMode)
+{
+ const auto &glState = context->getState();
+
+ // Applies the render target surface, depth stencil surface, viewport rectangle and
+ // scissor rectangle to the renderer
+ gl::Framebuffer *framebuffer = glState.getDrawFramebuffer();
+ ASSERT(framebuffer && !framebuffer->hasAnyDirtyBit());
+
+ Framebuffer9 *framebuffer9 = GetImplAs<Framebuffer9>(framebuffer);
+
+ ANGLE_TRY(applyRenderTarget(context, framebuffer9->getCachedColorRenderTargets()[0],
+ framebuffer9->getCachedDepthStencilRenderTarget()));
+
+ // Setting viewport state
+ setViewport(glState.getViewport(), glState.getNearPlane(), glState.getFarPlane(), drawMode,
+ glState.getRasterizerState().frontFace, false);
+
+ // Setting scissors state
+ setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
+
+ // Setting blend, depth stencil, and rasterizer states
+ // Since framebuffer->getSamples will return the original samples which may be different with
+ // the sample counts that we set in render target view, here we use renderTarget->getSamples to
+ // get the actual samples.
+ GLsizei samples = 0;
+ const gl::FramebufferAttachment *firstColorAttachment = framebuffer->getFirstColorAttachment();
+ if (firstColorAttachment)
+ {
+ ASSERT(firstColorAttachment->isAttached());
+ RenderTarget9 *renderTarget = nullptr;
+ ANGLE_TRY(firstColorAttachment->getRenderTarget(context, &renderTarget));
+ samples = renderTarget->getSamples();
+ }
+ gl::RasterizerState rasterizer = glState.getRasterizerState();
+ rasterizer.pointDrawMode = (drawMode == gl::PrimitiveMode::Points);
+ rasterizer.multiSample = (samples != 0);
+
+ ANGLE_TRY(setBlendDepthRasterStates(context, drawMode));
+
+ mStateManager.resetDirtyBits();
+
+ return angle::Result::Continue;
+}
+
+void Renderer9::setScissorRectangle(const gl::Rectangle &scissor, bool enabled)
+{
+ mStateManager.setScissorState(scissor, enabled);
+}
+
+angle::Result Renderer9::setBlendDepthRasterStates(const gl::Context *context,
+ gl::PrimitiveMode drawMode)
+{
+ const auto &glState = context->getState();
+ gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
+ ASSERT(!drawFramebuffer->hasAnyDirtyBit());
+ // Since framebuffer->getSamples will return the original samples which may be different with
+ // the sample counts that we set in render target view, here we use renderTarget->getSamples to
+ // get the actual samples.
+ GLsizei samples = 0;
+ const gl::FramebufferAttachment *firstColorAttachment =
+ drawFramebuffer->getFirstColorAttachment();
+ if (firstColorAttachment)
+ {
+ ASSERT(firstColorAttachment->isAttached());
+ RenderTarget9 *renderTarget = nullptr;
+ ANGLE_TRY(firstColorAttachment->getRenderTarget(context, &renderTarget));
+ samples = renderTarget->getSamples();
+ }
+ gl::RasterizerState rasterizer = glState.getRasterizerState();
+ rasterizer.pointDrawMode = (drawMode == gl::PrimitiveMode::Points);
+ rasterizer.multiSample = (samples != 0);
+
+ unsigned int mask = GetBlendSampleMask(glState, samples);
+ mStateManager.setBlendDepthRasterStates(glState, mask);
+ return angle::Result::Continue;
+}
+
+void Renderer9::setViewport(const gl::Rectangle &viewport,
+ float zNear,
+ float zFar,
+ gl::PrimitiveMode drawMode,
+ GLenum frontFace,
+ bool ignoreViewport)
+{
+ mStateManager.setViewportState(viewport, zNear, zFar, drawMode, frontFace, ignoreViewport);
+}
+
+bool Renderer9::applyPrimitiveType(gl::PrimitiveMode mode, GLsizei count, bool usesPointSize)
+{
+ switch (mode)
+ {
+ case gl::PrimitiveMode::Points:
+ mPrimitiveType = D3DPT_POINTLIST;
+ mPrimitiveCount = count;
+ break;
+ case gl::PrimitiveMode::Lines:
+ mPrimitiveType = D3DPT_LINELIST;
+ mPrimitiveCount = count / 2;
+ break;
+ case gl::PrimitiveMode::LineLoop:
+ mPrimitiveType = D3DPT_LINESTRIP;
+ mPrimitiveCount =
+ count - 1; // D3D doesn't support line loops, so we draw the last line separately
+ break;
+ case gl::PrimitiveMode::LineStrip:
+ mPrimitiveType = D3DPT_LINESTRIP;
+ mPrimitiveCount = count - 1;
+ break;
+ case gl::PrimitiveMode::Triangles:
+ mPrimitiveType = D3DPT_TRIANGLELIST;
+ mPrimitiveCount = count / 3;
+ break;
+ case gl::PrimitiveMode::TriangleStrip:
+ mPrimitiveType = D3DPT_TRIANGLESTRIP;
+ mPrimitiveCount = count - 2;
+ break;
+ case gl::PrimitiveMode::TriangleFan:
+ mPrimitiveType = D3DPT_TRIANGLEFAN;
+ mPrimitiveCount = count - 2;
+ break;
+ default:
+ UNREACHABLE();
+ return false;
+ }
+
+ return mPrimitiveCount > 0;
+}
+
+angle::Result Renderer9::getNullColorRenderTarget(const gl::Context *context,
+ const RenderTarget9 *depthRenderTarget,
+ const RenderTarget9 **outColorRenderTarget)
+{
+ ASSERT(depthRenderTarget);
+
+ const gl::Extents &size = depthRenderTarget->getExtents();
+
+ // search cached nullcolorbuffers
+ for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+ {
+ if (mNullRenderTargetCache[i].renderTarget != nullptr &&
+ mNullRenderTargetCache[i].width == size.width &&
+ mNullRenderTargetCache[i].height == size.height)
+ {
+ mNullRenderTargetCache[i].lruCount = ++mMaxNullColorbufferLRU;
+ *outColorRenderTarget = mNullRenderTargetCache[i].renderTarget;
+ return angle::Result::Continue;
+ }
+ }
+
+ RenderTargetD3D *nullRenderTarget = nullptr;
+ ANGLE_TRY(createRenderTarget(context, size.width, size.height, GL_NONE, 0, &nullRenderTarget));
+
+ // add nullbuffer to the cache
+ NullRenderTargetCacheEntry *oldest = &mNullRenderTargetCache[0];
+ for (int i = 1; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+ {
+ if (mNullRenderTargetCache[i].lruCount < oldest->lruCount)
+ {
+ oldest = &mNullRenderTargetCache[i];
+ }
+ }
+
+ SafeDelete(oldest->renderTarget);
+ oldest->renderTarget = GetAs<RenderTarget9>(nullRenderTarget);
+ oldest->lruCount = ++mMaxNullColorbufferLRU;
+ oldest->width = size.width;
+ oldest->height = size.height;
+
+ *outColorRenderTarget = oldest->renderTarget;
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::applyRenderTarget(const gl::Context *context,
+ const RenderTarget9 *colorRenderTargetIn,
+ const RenderTarget9 *depthStencilRenderTarget)
+{
+ // if there is no color attachment we must synthesize a NULL colorattachment
+ // to keep the D3D runtime happy. This should only be possible if depth texturing.
+ const RenderTarget9 *colorRenderTarget = colorRenderTargetIn;
+ if (colorRenderTarget == nullptr)
+ {
+ ANGLE_TRY(getNullColorRenderTarget(context, depthStencilRenderTarget, &colorRenderTarget));
+ }
+ ASSERT(colorRenderTarget != nullptr);
+
+ size_t renderTargetWidth = 0;
+ size_t renderTargetHeight = 0;
+ D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN;
+
+ bool renderTargetChanged = false;
+ unsigned int renderTargetSerial = colorRenderTarget->getSerial();
+ if (renderTargetSerial != mAppliedRenderTargetSerial)
+ {
+ // Apply the render target on the device
+ IDirect3DSurface9 *renderTargetSurface = colorRenderTarget->getSurface();
+ ASSERT(renderTargetSurface);
+
+ mDevice->SetRenderTarget(0, renderTargetSurface);
+ SafeRelease(renderTargetSurface);
+
+ renderTargetWidth = colorRenderTarget->getWidth();
+ renderTargetHeight = colorRenderTarget->getHeight();
+ renderTargetFormat = colorRenderTarget->getD3DFormat();
+
+ mAppliedRenderTargetSerial = renderTargetSerial;
+ renderTargetChanged = true;
+ }
+
+ unsigned int depthStencilSerial = 0;
+ if (depthStencilRenderTarget != nullptr)
+ {
+ depthStencilSerial = depthStencilRenderTarget->getSerial();
+ }
+
+ if (depthStencilSerial != mAppliedDepthStencilSerial || !mDepthStencilInitialized)
+ {
+ unsigned int depthSize = 0;
+ unsigned int stencilSize = 0;
+
+ // Apply the depth stencil on the device
+ if (depthStencilRenderTarget)
+ {
+ IDirect3DSurface9 *depthStencilSurface = depthStencilRenderTarget->getSurface();
+ ASSERT(depthStencilSurface);
+
+ mDevice->SetDepthStencilSurface(depthStencilSurface);
+ SafeRelease(depthStencilSurface);
+
+ const gl::InternalFormat &format =
+ gl::GetSizedInternalFormatInfo(depthStencilRenderTarget->getInternalFormat());
+
+ depthSize = format.depthBits;
+ stencilSize = format.stencilBits;
+ }
+ else
+ {
+ mDevice->SetDepthStencilSurface(nullptr);
+ }
+
+ mStateManager.updateDepthSizeIfChanged(mDepthStencilInitialized, depthSize);
+ mStateManager.updateStencilSizeIfChanged(mDepthStencilInitialized, stencilSize);
+
+ mAppliedDepthStencilSerial = depthStencilSerial;
+ mDepthStencilInitialized = true;
+ }
+
+ if (renderTargetChanged || !mRenderTargetDescInitialized)
+ {
+ mStateManager.forceSetBlendState();
+ mStateManager.forceSetScissorState();
+ mStateManager.setRenderTargetBounds(renderTargetWidth, renderTargetHeight);
+ mRenderTargetDescInitialized = true;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::applyVertexBuffer(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instances,
+ TranslatedIndexData * /*indexInfo*/)
+{
+ const gl::State &state = context->getState();
+ ANGLE_TRY(mVertexDataManager->prepareVertexData(context, first, count, &mTranslatedAttribCache,
+ instances));
+
+ return mVertexDeclarationCache.applyDeclaration(context, mDevice, mTranslatedAttribCache,
+ state.getProgram(), first, instances,
+ &mRepeatDraw);
+}
+
+// Applies the indices and element array bindings to the Direct3D 9 device
+angle::Result Renderer9::applyIndexBuffer(const gl::Context *context,
+ const void *indices,
+ GLsizei count,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType type,
+ TranslatedIndexData *indexInfo)
+{
+ gl::VertexArray *vao = context->getState().getVertexArray();
+ gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
+
+ gl::DrawElementsType dstType = gl::DrawElementsType::InvalidEnum;
+ ANGLE_TRY(GetIndexTranslationDestType(context, count, type, indices, false, &dstType));
+
+ ANGLE_TRY(mIndexDataManager->prepareIndexData(context, type, dstType, count, elementArrayBuffer,
+ indices, indexInfo));
+
+ // Directly binding the storage buffer is not supported for d3d9
+ ASSERT(indexInfo->storage == nullptr);
+
+ if (indexInfo->serial != mAppliedIBSerial)
+ {
+ IndexBuffer9 *indexBuffer = GetAs<IndexBuffer9>(indexInfo->indexBuffer);
+
+ mDevice->SetIndices(indexBuffer->getBuffer());
+ mAppliedIBSerial = indexInfo->serial;
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::drawArraysImpl(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint startVertex,
+ GLsizei count,
+ GLsizei instances)
+{
+ ASSERT(!context->getState().isTransformFeedbackActiveUnpaused());
+
+ startScene();
+
+ if (mode == gl::PrimitiveMode::LineLoop)
+ {
+ return drawLineLoop(context, count, gl::DrawElementsType::InvalidEnum, nullptr, 0, nullptr);
+ }
+
+ if (instances > 0)
+ {
+ StaticIndexBufferInterface *countingIB = nullptr;
+ ANGLE_TRY(getCountingIB(context, count, &countingIB));
+
+ if (mAppliedIBSerial != countingIB->getSerial())
+ {
+ IndexBuffer9 *indexBuffer = GetAs<IndexBuffer9>(countingIB->getIndexBuffer());
+
+ mDevice->SetIndices(indexBuffer->getBuffer());
+ mAppliedIBSerial = countingIB->getSerial();
+ }
+
+ for (int i = 0; i < mRepeatDraw; i++)
+ {
+ mDevice->DrawIndexedPrimitive(mPrimitiveType, 0, 0, count, 0, mPrimitiveCount);
+ }
+
+ return angle::Result::Continue;
+ }
+
+ // Regular case
+ mDevice->DrawPrimitive(mPrimitiveType, 0, mPrimitiveCount);
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::drawElementsImpl(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances)
+{
+ TranslatedIndexData indexInfo;
+
+ ANGLE_TRY(applyIndexBuffer(context, indices, count, mode, type, &indexInfo));
+
+ gl::IndexRange indexRange;
+ ANGLE_TRY(context->getState().getVertexArray()->getIndexRange(context, type, count, indices,
+ &indexRange));
+
+ size_t vertexCount = indexRange.vertexCount();
+ ANGLE_TRY(applyVertexBuffer(context, mode, static_cast<GLsizei>(indexRange.start),
+ static_cast<GLsizei>(vertexCount), instances, &indexInfo));
+
+ startScene();
+
+ int minIndex = static_cast<int>(indexRange.start);
+
+ gl::VertexArray *vao = context->getState().getVertexArray();
+ gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
+
+ if (mode == gl::PrimitiveMode::Points)
+ {
+ return drawIndexedPoints(context, count, type, indices, minIndex, elementArrayBuffer);
+ }
+
+ if (mode == gl::PrimitiveMode::LineLoop)
+ {
+ return drawLineLoop(context, count, type, indices, minIndex, elementArrayBuffer);
+ }
+
+ for (int i = 0; i < mRepeatDraw; i++)
+ {
+ mDevice->DrawIndexedPrimitive(mPrimitiveType, -minIndex, minIndex,
+ static_cast<UINT>(vertexCount), indexInfo.startIndex,
+ mPrimitiveCount);
+ }
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::drawLineLoop(const gl::Context *context,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ int minIndex,
+ gl::Buffer *elementArrayBuffer)
+{
+ // Get the raw indices for an indexed draw
+ if (type != gl::DrawElementsType::InvalidEnum && elementArrayBuffer)
+ {
+ BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(storage->getData(context, &bufferData));
+ indices = bufferData + offset;
+ }
+
+ unsigned int startIndex = 0;
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ if (getNativeExtensions().elementIndexUint)
+ {
+ if (!mLineLoopIB)
+ {
+ mLineLoopIB = new StreamingIndexBufferInterface(this);
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, INITIAL_INDEX_BUFFER_SIZE,
+ gl::DrawElementsType::UnsignedInt));
+ }
+
+ // Checked by Renderer9::applyPrimitiveType
+ ASSERT(count >= 0);
+
+ ANGLE_CHECK(context9,
+ static_cast<unsigned int>(count) + 1 <=
+ (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)),
+ "Failed to create a 32-bit looping index buffer for "
+ "GL_LINE_LOOP, too many indices required.",
+ GL_OUT_OF_MEMORY);
+
+ const unsigned int spaceNeeded =
+ (static_cast<unsigned int>(count) + 1) * sizeof(unsigned int);
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, spaceNeeded,
+ gl::DrawElementsType::UnsignedInt));
+
+ void *mappedMemory = nullptr;
+ unsigned int offset = 0;
+ ANGLE_TRY(mLineLoopIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
+
+ startIndex = static_cast<unsigned int>(offset) / 4;
+ unsigned int *data = static_cast<unsigned int *>(mappedMemory);
+
+ switch (type)
+ {
+ case gl::DrawElementsType::InvalidEnum: // Non-indexed draw
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = i;
+ }
+ data[count] = 0;
+ break;
+ case gl::DrawElementsType::UnsignedByte:
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = static_cast<const GLubyte *>(indices)[i];
+ }
+ data[count] = static_cast<const GLubyte *>(indices)[0];
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = static_cast<const GLushort *>(indices)[i];
+ }
+ data[count] = static_cast<const GLushort *>(indices)[0];
+ break;
+ case gl::DrawElementsType::UnsignedInt:
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = static_cast<const GLuint *>(indices)[i];
+ }
+ data[count] = static_cast<const GLuint *>(indices)[0];
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ ANGLE_TRY(mLineLoopIB->unmapBuffer(context));
+ }
+ else
+ {
+ if (!mLineLoopIB)
+ {
+ mLineLoopIB = new StreamingIndexBufferInterface(this);
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, INITIAL_INDEX_BUFFER_SIZE,
+ gl::DrawElementsType::UnsignedShort));
+ }
+
+ // Checked by Renderer9::applyPrimitiveType
+ ASSERT(count >= 0);
+
+ ANGLE_CHECK(context9,
+ static_cast<unsigned int>(count) + 1 <=
+ (std::numeric_limits<unsigned short>::max() / sizeof(unsigned short)),
+ "Failed to create a 16-bit looping index buffer for "
+ "GL_LINE_LOOP, too many indices required.",
+ GL_OUT_OF_MEMORY);
+
+ const unsigned int spaceNeeded =
+ (static_cast<unsigned int>(count) + 1) * sizeof(unsigned short);
+ ANGLE_TRY(mLineLoopIB->reserveBufferSpace(context, spaceNeeded,
+ gl::DrawElementsType::UnsignedShort));
+
+ void *mappedMemory = nullptr;
+ unsigned int offset;
+ ANGLE_TRY(mLineLoopIB->mapBuffer(context, spaceNeeded, &mappedMemory, &offset));
+
+ startIndex = static_cast<unsigned int>(offset) / 2;
+ unsigned short *data = static_cast<unsigned short *>(mappedMemory);
+
+ switch (type)
+ {
+ case gl::DrawElementsType::InvalidEnum: // Non-indexed draw
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = static_cast<unsigned short>(i);
+ }
+ data[count] = 0;
+ break;
+ case gl::DrawElementsType::UnsignedByte:
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = static_cast<const GLubyte *>(indices)[i];
+ }
+ data[count] = static_cast<const GLubyte *>(indices)[0];
+ break;
+ case gl::DrawElementsType::UnsignedShort:
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = static_cast<const GLushort *>(indices)[i];
+ }
+ data[count] = static_cast<const GLushort *>(indices)[0];
+ break;
+ case gl::DrawElementsType::UnsignedInt:
+ for (int i = 0; i < count; i++)
+ {
+ data[i] = static_cast<unsigned short>(static_cast<const GLuint *>(indices)[i]);
+ }
+ data[count] = static_cast<unsigned short>(static_cast<const GLuint *>(indices)[0]);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ ANGLE_TRY(mLineLoopIB->unmapBuffer(context));
+ }
+
+ if (mAppliedIBSerial != mLineLoopIB->getSerial())
+ {
+ IndexBuffer9 *indexBuffer = GetAs<IndexBuffer9>(mLineLoopIB->getIndexBuffer());
+
+ mDevice->SetIndices(indexBuffer->getBuffer());
+ mAppliedIBSerial = mLineLoopIB->getSerial();
+ }
+
+ mDevice->DrawIndexedPrimitive(D3DPT_LINESTRIP, -minIndex, minIndex, count, startIndex, count);
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::drawIndexedPoints(const gl::Context *context,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ int minIndex,
+ gl::Buffer *elementArrayBuffer)
+{
+ // Drawing index point lists is unsupported in d3d9, fall back to a regular DrawPrimitive call
+ // for each individual point. This call is not expected to happen often.
+
+ if (elementArrayBuffer)
+ {
+ BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
+
+ const uint8_t *bufferData = nullptr;
+ ANGLE_TRY(storage->getData(context, &bufferData));
+ indices = bufferData + offset;
+ }
+
+ switch (type)
+ {
+ case gl::DrawElementsType::UnsignedByte:
+ DrawPoints<GLubyte>(mDevice, count, indices, minIndex);
+ return angle::Result::Continue;
+ case gl::DrawElementsType::UnsignedShort:
+ DrawPoints<GLushort>(mDevice, count, indices, minIndex);
+ return angle::Result::Continue;
+ case gl::DrawElementsType::UnsignedInt:
+ DrawPoints<GLuint>(mDevice, count, indices, minIndex);
+ return angle::Result::Continue;
+ default:
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ }
+}
+
+angle::Result Renderer9::getCountingIB(const gl::Context *context,
+ size_t count,
+ StaticIndexBufferInterface **outIB)
+{
+ // Update the counting index buffer if it is not large enough or has not been created yet.
+ if (count <= 65536) // 16-bit indices
+ {
+ const unsigned int spaceNeeded = static_cast<unsigned int>(count) * sizeof(unsigned short);
+
+ if (!mCountingIB || mCountingIB->getBufferSize() < spaceNeeded)
+ {
+ SafeDelete(mCountingIB);
+ mCountingIB = new StaticIndexBufferInterface(this);
+ ANGLE_TRY(mCountingIB->reserveBufferSpace(context, spaceNeeded,
+ gl::DrawElementsType::UnsignedShort));
+
+ void *mappedMemory = nullptr;
+ ANGLE_TRY(mCountingIB->mapBuffer(context, spaceNeeded, &mappedMemory, nullptr));
+
+ unsigned short *data = static_cast<unsigned short *>(mappedMemory);
+ for (size_t i = 0; i < count; i++)
+ {
+ data[i] = static_cast<unsigned short>(i);
+ }
+
+ ANGLE_TRY(mCountingIB->unmapBuffer(context));
+ }
+ }
+ else if (getNativeExtensions().elementIndexUint)
+ {
+ const unsigned int spaceNeeded = static_cast<unsigned int>(count) * sizeof(unsigned int);
+
+ if (!mCountingIB || mCountingIB->getBufferSize() < spaceNeeded)
+ {
+ SafeDelete(mCountingIB);
+ mCountingIB = new StaticIndexBufferInterface(this);
+ ANGLE_TRY(mCountingIB->reserveBufferSpace(context, spaceNeeded,
+ gl::DrawElementsType::UnsignedInt));
+
+ void *mappedMemory = nullptr;
+ ANGLE_TRY(mCountingIB->mapBuffer(context, spaceNeeded, &mappedMemory, nullptr));
+
+ unsigned int *data = static_cast<unsigned int *>(mappedMemory);
+ for (unsigned int i = 0; i < count; i++)
+ {
+ data[i] = i;
+ }
+
+ ANGLE_TRY(mCountingIB->unmapBuffer(context));
+ }
+ }
+ else
+ {
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), E_OUTOFMEMORY,
+ "Could not create a counting index buffer for glDrawArraysInstanced.");
+ }
+
+ *outIB = mCountingIB;
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::applyShaders(const gl::Context *context, gl::PrimitiveMode drawMode)
+{
+ const gl::State &state = context->getState();
+ d3d::Context *contextD3D = GetImplAs<ContextD3D>(context);
+
+ // This method is called single-threaded.
+ ANGLE_TRY(ensureHLSLCompilerInitialized(contextD3D));
+
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(state.getProgram());
+ VertexArray9 *vao = GetImplAs<VertexArray9>(state.getVertexArray());
+ programD3D->updateCachedInputLayout(vao->getCurrentStateSerial(), state);
+
+ ShaderExecutableD3D *vertexExe = nullptr;
+ ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(contextD3D, &vertexExe, nullptr));
+
+ const gl::Framebuffer *drawFramebuffer = state.getDrawFramebuffer();
+ programD3D->updateCachedOutputLayout(context, drawFramebuffer);
+
+ ShaderExecutableD3D *pixelExe = nullptr;
+ ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(contextD3D, &pixelExe, nullptr));
+
+ IDirect3DVertexShader9 *vertexShader =
+ (vertexExe ? GetAs<ShaderExecutable9>(vertexExe)->getVertexShader() : nullptr);
+ IDirect3DPixelShader9 *pixelShader =
+ (pixelExe ? GetAs<ShaderExecutable9>(pixelExe)->getPixelShader() : nullptr);
+
+ if (vertexShader != mAppliedVertexShader)
+ {
+ mDevice->SetVertexShader(vertexShader);
+ mAppliedVertexShader = vertexShader;
+ }
+
+ if (pixelShader != mAppliedPixelShader)
+ {
+ mDevice->SetPixelShader(pixelShader);
+ mAppliedPixelShader = pixelShader;
+ }
+
+ // D3D9 has a quirk where creating multiple shaders with the same content
+ // can return the same shader pointer. Because GL programs store different data
+ // per-program, checking the program serial guarantees we upload fresh
+ // uniform data even if our shader pointers are the same.
+ // https://code.google.com/p/angleproject/issues/detail?id=661
+ unsigned int programSerial = programD3D->getSerial();
+ if (programSerial != mAppliedProgramSerial)
+ {
+ programD3D->dirtyAllUniforms();
+ mStateManager.forceSetDXUniformsState();
+ mAppliedProgramSerial = programSerial;
+ }
+
+ applyUniforms(programD3D);
+
+ // Driver uniforms
+ mStateManager.setShaderConstants();
+
+ return angle::Result::Continue;
+}
+
+void Renderer9::applyUniforms(ProgramD3D *programD3D)
+{
+ // Skip updates if we're not dirty. Note that D3D9 cannot have compute or geometry.
+ if (!programD3D->anyShaderUniformsDirty())
+ {
+ return;
+ }
+
+ const auto &uniformArray = programD3D->getD3DUniforms();
+
+ for (const D3DUniform *targetUniform : uniformArray)
+ {
+ // Built-in uniforms must be skipped.
+ if (!targetUniform->isReferencedByShader(gl::ShaderType::Vertex) &&
+ !targetUniform->isReferencedByShader(gl::ShaderType::Fragment))
+ continue;
+
+ const GLfloat *f = reinterpret_cast<const GLfloat *>(targetUniform->firstNonNullData());
+ const GLint *i = reinterpret_cast<const GLint *>(targetUniform->firstNonNullData());
+
+ switch (targetUniform->typeInfo.type)
+ {
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ break;
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ applyUniformnbv(targetUniform, i);
+ break;
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ applyUniformnfv(targetUniform, f);
+ break;
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ applyUniformniv(targetUniform, i);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ }
+
+ programD3D->markUniformsClean();
+}
+
+void Renderer9::applyUniformnfv(const D3DUniform *targetUniform, const GLfloat *v)
+{
+ if (targetUniform->isReferencedByShader(gl::ShaderType::Fragment))
+ {
+ mDevice->SetPixelShaderConstantF(
+ targetUniform->mShaderRegisterIndexes[gl::ShaderType::Fragment], v,
+ targetUniform->registerCount);
+ }
+
+ if (targetUniform->isReferencedByShader(gl::ShaderType::Vertex))
+ {
+ mDevice->SetVertexShaderConstantF(
+ targetUniform->mShaderRegisterIndexes[gl::ShaderType::Vertex], v,
+ targetUniform->registerCount);
+ }
+}
+
+void Renderer9::applyUniformniv(const D3DUniform *targetUniform, const GLint *v)
+{
+ ASSERT(targetUniform->registerCount <= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
+ GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
+
+ for (unsigned int i = 0; i < targetUniform->registerCount; i++)
+ {
+ vector[i][0] = (GLfloat)v[4 * i + 0];
+ vector[i][1] = (GLfloat)v[4 * i + 1];
+ vector[i][2] = (GLfloat)v[4 * i + 2];
+ vector[i][3] = (GLfloat)v[4 * i + 3];
+ }
+
+ applyUniformnfv(targetUniform, (GLfloat *)vector);
+}
+
+void Renderer9::applyUniformnbv(const D3DUniform *targetUniform, const GLint *v)
+{
+ ASSERT(targetUniform->registerCount <= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
+ GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
+
+ for (unsigned int i = 0; i < targetUniform->registerCount; i++)
+ {
+ vector[i][0] = (v[4 * i + 0] == GL_FALSE) ? 0.0f : 1.0f;
+ vector[i][1] = (v[4 * i + 1] == GL_FALSE) ? 0.0f : 1.0f;
+ vector[i][2] = (v[4 * i + 2] == GL_FALSE) ? 0.0f : 1.0f;
+ vector[i][3] = (v[4 * i + 3] == GL_FALSE) ? 0.0f : 1.0f;
+ }
+
+ applyUniformnfv(targetUniform, (GLfloat *)vector);
+}
+
+void Renderer9::clear(const ClearParameters &clearParams,
+ const RenderTarget9 *colorRenderTarget,
+ const RenderTarget9 *depthStencilRenderTarget)
+{
+ // Clearing buffers with non-float values is not supported by Renderer9 and ES 2.0
+ ASSERT(clearParams.colorType == GL_FLOAT);
+
+ // Clearing individual buffers other than buffer zero is not supported by Renderer9 and ES 2.0
+ bool clearColor = clearParams.clearColor[0];
+ for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
+ {
+ ASSERT(clearParams.clearColor[i] == clearColor);
+ }
+
+ float depth = gl::clamp01(clearParams.depthValue);
+ DWORD stencil = clearParams.stencilValue & 0x000000FF;
+
+ unsigned int stencilUnmasked = 0x0;
+ if (clearParams.clearStencil && depthStencilRenderTarget)
+ {
+ const gl::InternalFormat &depthStencilFormat =
+ gl::GetSizedInternalFormatInfo(depthStencilRenderTarget->getInternalFormat());
+ if (depthStencilFormat.stencilBits > 0)
+ {
+ const d3d9::D3DFormat &d3dFormatInfo =
+ d3d9::GetD3DFormatInfo(depthStencilRenderTarget->getD3DFormat());
+ stencilUnmasked = (0x1 << d3dFormatInfo.stencilBits) - 1;
+ }
+ }
+
+ const bool needMaskedStencilClear =
+ clearParams.clearStencil &&
+ (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
+
+ bool needMaskedColorClear = false;
+ D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0);
+ if (clearColor)
+ {
+ ASSERT(colorRenderTarget != nullptr);
+
+ const gl::InternalFormat &formatInfo =
+ gl::GetSizedInternalFormatInfo(colorRenderTarget->getInternalFormat());
+ const d3d9::D3DFormat &d3dFormatInfo =
+ d3d9::GetD3DFormatInfo(colorRenderTarget->getD3DFormat());
+
+ color =
+ D3DCOLOR_ARGB(gl::unorm<8>((formatInfo.alphaBits == 0 && d3dFormatInfo.alphaBits > 0)
+ ? 1.0f
+ : clearParams.colorF.alpha),
+ gl::unorm<8>((formatInfo.redBits == 0 && d3dFormatInfo.redBits > 0)
+ ? 0.0f
+ : clearParams.colorF.red),
+ gl::unorm<8>((formatInfo.greenBits == 0 && d3dFormatInfo.greenBits > 0)
+ ? 0.0f
+ : clearParams.colorF.green),
+ gl::unorm<8>((formatInfo.blueBits == 0 && d3dFormatInfo.blueBits > 0)
+ ? 0.0f
+ : clearParams.colorF.blue));
+
+ if ((formatInfo.redBits > 0 && !clearParams.colorMaskRed) ||
+ (formatInfo.greenBits > 0 && !clearParams.colorMaskGreen) ||
+ (formatInfo.blueBits > 0 && !clearParams.colorMaskBlue) ||
+ (formatInfo.alphaBits > 0 && !clearParams.colorMaskAlpha))
+ {
+ needMaskedColorClear = true;
+ }
+ }
+
+ if (needMaskedColorClear || needMaskedStencilClear)
+ {
+ // State which is altered in all paths from this point to the clear call is saved.
+ // State which is altered in only some paths will be flagged dirty in the case that
+ // that path is taken.
+ HRESULT hr;
+ if (mMaskedClearSavedState == nullptr)
+ {
+ hr = mDevice->BeginStateBlock();
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+ mDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
+ mDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ mDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ mDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+ mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
+ mDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ mDevice->SetPixelShader(nullptr);
+ mDevice->SetVertexShader(nullptr);
+ mDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
+ mDevice->SetStreamSource(0, nullptr, 0, 0);
+ mDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+ mDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ mDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
+ mDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
+ mDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
+ mDevice->SetRenderState(D3DRS_TEXTUREFACTOR, color);
+ mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
+
+ for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
+ {
+ mDevice->SetStreamSourceFreq(i, 1);
+ }
+
+ hr = mDevice->EndStateBlock(&mMaskedClearSavedState);
+ ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+ }
+
+ ASSERT(mMaskedClearSavedState != nullptr);
+
+ if (mMaskedClearSavedState != nullptr)
+ {
+ hr = mMaskedClearSavedState->Capture();
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ mDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
+ mDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ mDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ mDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ mDevice->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+
+ if (clearColor)
+ {
+ mDevice->SetRenderState(
+ D3DRS_COLORWRITEENABLE,
+ gl_d3d9::ConvertColorMask(clearParams.colorMaskRed, clearParams.colorMaskGreen,
+ clearParams.colorMaskBlue, clearParams.colorMaskAlpha));
+ }
+ else
+ {
+ mDevice->SetRenderState(D3DRS_COLORWRITEENABLE, 0);
+ }
+
+ if (stencilUnmasked != 0x0 && clearParams.clearStencil)
+ {
+ mDevice->SetRenderState(D3DRS_STENCILENABLE, TRUE);
+ mDevice->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, FALSE);
+ mDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
+ mDevice->SetRenderState(D3DRS_STENCILREF, stencil);
+ mDevice->SetRenderState(D3DRS_STENCILWRITEMASK, clearParams.stencilWriteMask);
+ mDevice->SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE);
+ mDevice->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_REPLACE);
+ mDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE);
+ }
+ else
+ {
+ mDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ }
+
+ mDevice->SetPixelShader(nullptr);
+ mDevice->SetVertexShader(nullptr);
+ mDevice->SetFVF(D3DFVF_XYZRHW);
+ mDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+ mDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ mDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
+ mDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
+ mDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
+ mDevice->SetRenderState(D3DRS_TEXTUREFACTOR, color);
+ mDevice->SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
+
+ for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
+ {
+ mDevice->SetStreamSourceFreq(i, 1);
+ }
+
+ int renderTargetWidth = mStateManager.getRenderTargetWidth();
+ int renderTargetHeight = mStateManager.getRenderTargetHeight();
+
+ float quad[4][4]; // A quadrilateral covering the target, aligned to match the edges
+ quad[0][0] = -0.5f;
+ quad[0][1] = renderTargetHeight - 0.5f;
+ quad[0][2] = 0.0f;
+ quad[0][3] = 1.0f;
+
+ quad[1][0] = renderTargetWidth - 0.5f;
+ quad[1][1] = renderTargetHeight - 0.5f;
+ quad[1][2] = 0.0f;
+ quad[1][3] = 1.0f;
+
+ quad[2][0] = -0.5f;
+ quad[2][1] = -0.5f;
+ quad[2][2] = 0.0f;
+ quad[2][3] = 1.0f;
+
+ quad[3][0] = renderTargetWidth - 0.5f;
+ quad[3][1] = -0.5f;
+ quad[3][2] = 0.0f;
+ quad[3][3] = 1.0f;
+
+ startScene();
+ mDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float[4]));
+
+ if (clearParams.clearDepth)
+ {
+ mDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
+ mDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
+ mDevice->Clear(0, nullptr, D3DCLEAR_ZBUFFER, color, depth, stencil);
+ }
+
+ if (mMaskedClearSavedState != nullptr)
+ {
+ mMaskedClearSavedState->Apply();
+ }
+ }
+ else if (clearColor || clearParams.clearDepth || clearParams.clearStencil)
+ {
+ DWORD dxClearFlags = 0;
+ if (clearColor)
+ {
+ dxClearFlags |= D3DCLEAR_TARGET;
+ }
+ if (clearParams.clearDepth)
+ {
+ dxClearFlags |= D3DCLEAR_ZBUFFER;
+ }
+ if (clearParams.clearStencil)
+ {
+ dxClearFlags |= D3DCLEAR_STENCIL;
+ }
+
+ mDevice->Clear(0, nullptr, dxClearFlags, color, depth, stencil);
+ }
+}
+
+void Renderer9::markAllStateDirty()
+{
+ mAppliedRenderTargetSerial = 0;
+ mAppliedDepthStencilSerial = 0;
+ mDepthStencilInitialized = false;
+ mRenderTargetDescInitialized = false;
+
+ mStateManager.forceSetRasterState();
+ mStateManager.forceSetDepthStencilState();
+ mStateManager.forceSetBlendState();
+ mStateManager.forceSetScissorState();
+ mStateManager.forceSetViewportState();
+
+ ASSERT(mCurVertexSamplerStates.size() == mCurVertexTextures.size());
+ for (unsigned int i = 0; i < mCurVertexTextures.size(); i++)
+ {
+ mCurVertexSamplerStates[i].forceSet = true;
+ mCurVertexTextures[i] = angle::DirtyPointer;
+ }
+
+ ASSERT(mCurPixelSamplerStates.size() == mCurPixelTextures.size());
+ for (unsigned int i = 0; i < mCurPixelSamplerStates.size(); i++)
+ {
+ mCurPixelSamplerStates[i].forceSet = true;
+ mCurPixelTextures[i] = angle::DirtyPointer;
+ }
+
+ mAppliedIBSerial = 0;
+ mAppliedVertexShader = nullptr;
+ mAppliedPixelShader = nullptr;
+ mAppliedProgramSerial = 0;
+ mStateManager.forceSetDXUniformsState();
+
+ mVertexDeclarationCache.markStateDirty();
+}
+
+void Renderer9::releaseDeviceResources()
+{
+ for (size_t i = 0; i < mEventQueryPool.size(); i++)
+ {
+ SafeRelease(mEventQueryPool[i]);
+ }
+ mEventQueryPool.clear();
+
+ SafeRelease(mMaskedClearSavedState);
+
+ mVertexShaderCache.clear();
+ mPixelShaderCache.clear();
+
+ SafeDelete(mBlit);
+ SafeDelete(mVertexDataManager);
+ SafeDelete(mIndexDataManager);
+ SafeDelete(mLineLoopIB);
+ SafeDelete(mCountingIB);
+
+ for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+ {
+ SafeDelete(mNullRenderTargetCache[i].renderTarget);
+ }
+}
+
+// set notify to true to broadcast a message to all contexts of the device loss
+bool Renderer9::testDeviceLost()
+{
+ HRESULT status = getDeviceStatusCode();
+ return FAILED(status);
+}
+
+HRESULT Renderer9::getDeviceStatusCode()
+{
+ HRESULT status = D3D_OK;
+
+ if (mDeviceEx)
+ {
+ status = mDeviceEx->CheckDeviceState(nullptr);
+ }
+ else if (mDevice)
+ {
+ status = mDevice->TestCooperativeLevel();
+ }
+
+ return status;
+}
+
+bool Renderer9::testDeviceResettable()
+{
+ // On D3D9Ex, DEVICELOST represents a hung device that needs to be restarted
+ // DEVICEREMOVED indicates the device has been stopped and must be recreated
+ switch (getDeviceStatusCode())
+ {
+ case D3DERR_DEVICENOTRESET:
+ case D3DERR_DEVICEHUNG:
+ return true;
+ case D3DERR_DEVICELOST:
+ return (mDeviceEx != nullptr);
+ case D3DERR_DEVICEREMOVED:
+ ASSERT(mDeviceEx != nullptr);
+ return isRemovedDeviceResettable();
+ default:
+ return false;
+ }
+}
+
+bool Renderer9::resetDevice()
+{
+ releaseDeviceResources();
+
+ D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
+
+ HRESULT result = D3D_OK;
+ bool lost = testDeviceLost();
+ bool removedDevice = (getDeviceStatusCode() == D3DERR_DEVICEREMOVED);
+
+ // Device Removed is a feature which is only present with D3D9Ex
+ ASSERT(mDeviceEx != nullptr || !removedDevice);
+
+ for (int attempts = 3; lost && attempts > 0; attempts--)
+ {
+ if (removedDevice)
+ {
+ // Device removed, which may trigger on driver reinstallation,
+ // may cause a longer wait other reset attempts before the
+ // system is ready to handle creating a new device.
+ Sleep(800);
+ lost = !resetRemovedDevice();
+ }
+ else if (mDeviceEx)
+ {
+ Sleep(500); // Give the graphics driver some CPU time
+ result = mDeviceEx->ResetEx(&presentParameters, nullptr);
+ lost = testDeviceLost();
+ }
+ else
+ {
+ result = mDevice->TestCooperativeLevel();
+ while (result == D3DERR_DEVICELOST)
+ {
+ Sleep(100); // Give the graphics driver some CPU time
+ result = mDevice->TestCooperativeLevel();
+ }
+
+ if (result == D3DERR_DEVICENOTRESET)
+ {
+ result = mDevice->Reset(&presentParameters);
+ }
+ lost = testDeviceLost();
+ }
+ }
+
+ if (FAILED(result))
+ {
+ ERR() << "Reset/ResetEx failed multiple times, " << gl::FmtHR(result);
+ return false;
+ }
+
+ if (removedDevice && lost)
+ {
+ ERR() << "Device lost reset failed multiple times";
+ return false;
+ }
+
+ // If the device was removed, we already finished re-initialization in resetRemovedDevice
+ if (!removedDevice)
+ {
+ // reset device defaults
+ if (initializeDevice().isError())
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Renderer9::isRemovedDeviceResettable() const
+{
+ bool success = false;
+
+#if ANGLE_D3D9EX == ANGLE_ENABLED
+ IDirect3D9Ex *d3d9Ex = nullptr;
+ typedef HRESULT(WINAPI * Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex **);
+ Direct3DCreate9ExFunc Direct3DCreate9ExPtr =
+ reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
+
+ if (Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &d3d9Ex)))
+ {
+ D3DCAPS9 deviceCaps;
+ HRESULT result = d3d9Ex->GetDeviceCaps(mAdapter, mDeviceType, &deviceCaps);
+ success = SUCCEEDED(result);
+ }
+
+ SafeRelease(d3d9Ex);
+#else
+ UNREACHABLE();
+#endif
+
+ return success;
+}
+
+bool Renderer9::resetRemovedDevice()
+{
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/bb172554(v=vs.85).aspx:
+ // The hardware adapter has been removed. Application must destroy the device, do enumeration of
+ // adapters and create another Direct3D device. If application continues rendering without
+ // calling Reset, the rendering calls will succeed. Applies to Direct3D 9Ex only.
+ release();
+ return !initialize().isError();
+}
+
+VendorID Renderer9::getVendorId() const
+{
+ return static_cast<VendorID>(mAdapterIdentifier.VendorId);
+}
+
+std::string Renderer9::getRendererDescription() const
+{
+ std::ostringstream rendererString;
+
+ rendererString << mAdapterIdentifier.Description;
+ if (getShareHandleSupport())
+ {
+ rendererString << " Direct3D9Ex";
+ }
+ else
+ {
+ rendererString << " Direct3D9";
+ }
+
+ rendererString << " vs_" << D3DSHADER_VERSION_MAJOR(mDeviceCaps.VertexShaderVersion) << "_"
+ << D3DSHADER_VERSION_MINOR(mDeviceCaps.VertexShaderVersion);
+ rendererString << " ps_" << D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion) << "_"
+ << D3DSHADER_VERSION_MINOR(mDeviceCaps.PixelShaderVersion);
+
+ return rendererString.str();
+}
+
+DeviceIdentifier Renderer9::getAdapterIdentifier() const
+{
+ DeviceIdentifier deviceIdentifier = {0};
+ deviceIdentifier.VendorId = static_cast<UINT>(mAdapterIdentifier.VendorId);
+ deviceIdentifier.DeviceId = static_cast<UINT>(mAdapterIdentifier.DeviceId);
+ deviceIdentifier.SubSysId = static_cast<UINT>(mAdapterIdentifier.SubSysId);
+ deviceIdentifier.Revision = static_cast<UINT>(mAdapterIdentifier.Revision);
+ deviceIdentifier.FeatureLevel = 0;
+
+ return deviceIdentifier;
+}
+
+unsigned int Renderer9::getReservedVertexUniformVectors() const
+{
+ return d3d9_gl::GetReservedVertexUniformVectors();
+}
+
+unsigned int Renderer9::getReservedFragmentUniformVectors() const
+{
+ return d3d9_gl::GetReservedFragmentUniformVectors();
+}
+
+bool Renderer9::getShareHandleSupport() const
+{
+ // PIX doesn't seem to support using share handles, so disable them.
+ return (mD3d9Ex != nullptr) && !gl::DebugAnnotationsActive();
+}
+
+int Renderer9::getMajorShaderModel() const
+{
+ return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion);
+}
+
+int Renderer9::getMinorShaderModel() const
+{
+ return D3DSHADER_VERSION_MINOR(mDeviceCaps.PixelShaderVersion);
+}
+
+std::string Renderer9::getShaderModelSuffix() const
+{
+ return "";
+}
+
+DWORD Renderer9::getCapsDeclTypes() const
+{
+ return mDeviceCaps.DeclTypes;
+}
+
+D3DPOOL Renderer9::getBufferPool(DWORD usage) const
+{
+ if (mD3d9Ex != nullptr)
+ {
+ return D3DPOOL_DEFAULT;
+ }
+ else
+ {
+ if (!(usage & D3DUSAGE_DYNAMIC))
+ {
+ return D3DPOOL_MANAGED;
+ }
+ }
+
+ return D3DPOOL_DEFAULT;
+}
+
+angle::Result Renderer9::copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
+{
+ RECT rect;
+ rect.left = sourceRect.x;
+ rect.top = sourceRect.y;
+ rect.right = sourceRect.x + sourceRect.width;
+ rect.bottom = sourceRect.y + sourceRect.height;
+
+ return mBlit->copy2D(context, framebuffer, rect, destFormat, destOffset, storage, level);
+}
+
+angle::Result Renderer9::copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level)
+{
+ RECT rect;
+ rect.left = sourceRect.x;
+ rect.top = sourceRect.y;
+ rect.right = sourceRect.x + sourceRect.width;
+ rect.bottom = sourceRect.y + sourceRect.height;
+
+ return mBlit->copyCube(context, framebuffer, rect, destFormat, destOffset, storage, target,
+ level);
+}
+
+angle::Result Renderer9::copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
+{
+ // 3D textures are not available in the D3D9 backend.
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Renderer9::copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level)
+{
+ // 2D array textures are not available in the D3D9 backend.
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Renderer9::copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ gl::TextureTarget srcTarget,
+ const gl::Box &sourceBox,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
+{
+ RECT rect;
+ rect.left = sourceBox.x;
+ rect.top = sourceBox.y;
+ rect.right = sourceBox.x + sourceBox.width;
+ rect.bottom = sourceBox.y + sourceBox.height;
+
+ return mBlit->copyTexture(context, source, sourceLevel, rect, destFormat, destOffset, storage,
+ destTarget, destLevel, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+}
+
+angle::Result Renderer9::copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Renderer9::createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT)
+{
+ const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(format);
+
+ const gl::TextureCaps &textureCaps = getNativeTextureCaps().get(format);
+ GLuint supportedSamples = textureCaps.getNearestSamples(samples);
+
+ IDirect3DTexture9 *texture = nullptr;
+ IDirect3DSurface9 *renderTarget = nullptr;
+ if (width > 0 && height > 0)
+ {
+ bool requiresInitialization = false;
+ HRESULT result = D3DERR_INVALIDCALL;
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(format);
+ if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
+ {
+ result = mDevice->CreateDepthStencilSurface(
+ width, height, d3d9FormatInfo.renderFormat,
+ gl_d3d9::GetMultisampleType(supportedSamples), 0, FALSE, &renderTarget, nullptr);
+ }
+ else
+ {
+ requiresInitialization = (d3d9FormatInfo.dataInitializerFunction != nullptr);
+ if (supportedSamples > 0)
+ {
+ result = mDevice->CreateRenderTarget(width, height, d3d9FormatInfo.renderFormat,
+ gl_d3d9::GetMultisampleType(supportedSamples),
+ 0, FALSE, &renderTarget, nullptr);
+ }
+ else
+ {
+ result = mDevice->CreateTexture(
+ width, height, 1, D3DUSAGE_RENDERTARGET, d3d9FormatInfo.texFormat,
+ getTexturePool(D3DUSAGE_RENDERTARGET), &texture, nullptr);
+ if (!FAILED(result))
+ {
+ result = texture->GetSurfaceLevel(0, &renderTarget);
+ }
+ }
+ }
+
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to create render target");
+
+ 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 = nullptr;
+ mDevice->GetRenderTarget(0, &prevRenderTarget);
+ mDevice->SetRenderTarget(0, renderTarget);
+ mDevice->Clear(0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 255), 0.0f, 0);
+ mDevice->SetRenderTarget(0, prevRenderTarget);
+ }
+ }
+
+ *outRT = new TextureRenderTarget9(texture, 0, renderTarget, format, width, height, 1,
+ supportedSamples);
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(source != nullptr);
+
+ RenderTargetD3D *newRT = nullptr;
+ ANGLE_TRY(createRenderTarget(context, source->getWidth(), source->getHeight(),
+ source->getInternalFormat(), source->getSamples(), &newRT));
+
+ RenderTarget9 *source9 = GetAs<RenderTarget9>(source);
+ RenderTarget9 *dest9 = GetAs<RenderTarget9>(newRT);
+
+ HRESULT result = mDevice->StretchRect(source9->getSurface(), nullptr, dest9->getSurface(),
+ nullptr, D3DTEXF_NONE);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to copy render target");
+
+ *outRT = newRT;
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::loadExecutable(d3d::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable)
+{
+ // Transform feedback is not supported in ES2 or D3D9
+ ASSERT(streamOutVaryings.empty());
+
+ switch (type)
+ {
+ case gl::ShaderType::Vertex:
+ {
+ IDirect3DVertexShader9 *vshader = nullptr;
+ ANGLE_TRY(createVertexShader(context, (DWORD *)function, length, &vshader));
+ *outExecutable = new ShaderExecutable9(function, length, vshader);
+ }
+ break;
+ case gl::ShaderType::Fragment:
+ {
+ IDirect3DPixelShader9 *pshader = nullptr;
+ ANGLE_TRY(createPixelShader(context, (DWORD *)function, length, &pshader));
+ *outExecutable = new ShaderExecutable9(function, length, pshader);
+ }
+ break;
+ default:
+ ANGLE_HR_UNREACHABLE(context);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::compileToExecutable(d3d::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable)
+{
+ // Transform feedback is not supported in ES2 or D3D9
+ ASSERT(streamOutVaryings.empty());
+
+ std::stringstream profileStream;
+
+ switch (type)
+ {
+ case gl::ShaderType::Vertex:
+ profileStream << "vs";
+ break;
+ case gl::ShaderType::Fragment:
+ profileStream << "ps";
+ break;
+ default:
+ ANGLE_HR_UNREACHABLE(context);
+ }
+
+ profileStream << "_" << ((getMajorShaderModel() >= 3) ? 3 : 2);
+ profileStream << "_"
+ << "0";
+
+ std::string profile = profileStream.str();
+
+ UINT flags = ANGLE_COMPILE_OPTIMIZATION_LEVEL;
+
+ if (workarounds.skipOptimization)
+ {
+ flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+ }
+ else if (workarounds.useMaxOptimization)
+ {
+ flags = D3DCOMPILE_OPTIMIZATION_LEVEL3;
+ }
+
+ if (gl::DebugAnnotationsActive())
+ {
+#ifndef NDEBUG
+ flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+#endif
+
+ flags |= D3DCOMPILE_DEBUG;
+ }
+
+ // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders
+ // when it would otherwise pass with alternative options. Try the default flags first and if
+ // compilation fails, try some alternatives.
+ std::vector<CompileConfig> configs;
+ configs.push_back(CompileConfig(flags, "default"));
+ configs.push_back(CompileConfig(flags | D3DCOMPILE_AVOID_FLOW_CONTROL, "avoid flow control"));
+ configs.push_back(CompileConfig(flags | D3DCOMPILE_PREFER_FLOW_CONTROL, "prefer flow control"));
+
+ ID3DBlob *binary = nullptr;
+ std::string debugInfo;
+ angle::Result error = mCompiler.compileToBinary(context, infoLog, shaderHLSL, profile, configs,
+ nullptr, &binary, &debugInfo);
+ ANGLE_TRY(error);
+
+ // It's possible that binary is NULL if the compiler failed in all configurations. Set the
+ // executable to NULL and return GL_NO_ERROR to signify that there was a link error but the
+ // internal state is still OK.
+ if (!binary)
+ {
+ *outExectuable = nullptr;
+ return angle::Result::Continue;
+ }
+
+ error = loadExecutable(context, reinterpret_cast<const uint8_t *>(binary->GetBufferPointer()),
+ binary->GetBufferSize(), type, streamOutVaryings, separatedOutputBuffers,
+ outExectuable);
+
+ SafeRelease(binary);
+ ANGLE_TRY(error);
+
+ if (!debugInfo.empty())
+ {
+ (*outExectuable)->appendDebugInfo(debugInfo);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::ensureHLSLCompilerInitialized(d3d::Context *context)
+{
+ return mCompiler.ensureInitialized(context);
+}
+
+UniformStorageD3D *Renderer9::createUniformStorage(size_t storageSize)
+{
+ return new UniformStorageD3D(storageSize);
+}
+
+angle::Result Renderer9::boxFilter(Context9 *context9,
+ IDirect3DSurface9 *source,
+ IDirect3DSurface9 *dest)
+{
+ return mBlit->boxFilter(context9, source, dest);
+}
+
+D3DPOOL Renderer9::getTexturePool(DWORD usage) const
+{
+ if (mD3d9Ex != nullptr)
+ {
+ return D3DPOOL_DEFAULT;
+ }
+ else
+ {
+ if (!(usage & (D3DUSAGE_DEPTHSTENCIL | D3DUSAGE_RENDERTARGET)))
+ {
+ return D3DPOOL_MANAGED;
+ }
+ }
+
+ return D3DPOOL_DEFAULT;
+}
+
+angle::Result Renderer9::copyToRenderTarget(const gl::Context *context,
+ IDirect3DSurface9 *dest,
+ IDirect3DSurface9 *source,
+ bool fromManaged)
+{
+ ASSERT(source && dest);
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ HRESULT result = D3DERR_OUTOFVIDEOMEMORY;
+
+ if (fromManaged)
+ {
+ D3DSURFACE_DESC desc;
+ source->GetDesc(&desc);
+
+ IDirect3DSurface9 *surf = 0;
+ result = mDevice->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
+ D3DPOOL_SYSTEMMEM, &surf, nullptr);
+
+ if (SUCCEEDED(result))
+ {
+ ANGLE_TRY(Image9::CopyLockableSurfaces(context9, surf, source));
+ result = mDevice->UpdateSurface(surf, nullptr, dest, nullptr);
+ SafeRelease(surf);
+ }
+ }
+ else
+ {
+ endScene();
+ result = mDevice->StretchRect(source, nullptr, dest, nullptr, D3DTEXF_NONE);
+ }
+
+ ANGLE_TRY_HR(context9, result, "Failed to blit internal texture");
+ return angle::Result::Continue;
+}
+
+RendererClass Renderer9::getRendererClass() const
+{
+ return RENDERER_D3D9;
+}
+
+ImageD3D *Renderer9::createImage()
+{
+ return new Image9(this);
+}
+
+ExternalImageSiblingImpl *Renderer9::createExternalImageSibling(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs)
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+angle::Result Renderer9::generateMipmap(const gl::Context *context, ImageD3D *dest, ImageD3D *src)
+{
+ Image9 *src9 = GetAs<Image9>(src);
+ Image9 *dst9 = GetAs<Image9>(dest);
+ return Image9::GenerateMipmap(GetImplAs<Context9>(context), dst9, src9);
+}
+
+angle::Result Renderer9::generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result Renderer9::copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Box &sourceBox,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
+{
+ Image9 *dest9 = GetAs<Image9>(dest);
+ Image9 *src9 = GetAs<Image9>(source);
+ return Image9::CopyImage(context, dest9, src9, sourceBox.toRect(), destOffset, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+}
+
+TextureStorage *Renderer9::createTextureStorage2D(SwapChainD3D *swapChain)
+{
+ SwapChain9 *swapChain9 = GetAs<SwapChain9>(swapChain);
+ return new TextureStorage9_2D(this, swapChain9);
+}
+
+TextureStorage *Renderer9::createTextureStorageEGLImage(EGLImageD3D *eglImage,
+ RenderTargetD3D *renderTargetD3D)
+{
+ return new TextureStorage9_EGLImage(this, eglImage, GetAs<RenderTarget9>(renderTargetD3D));
+}
+
+TextureStorage *Renderer9::createTextureStorageExternal(
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc)
+{
+ UNIMPLEMENTED();
+ return nullptr;
+}
+
+TextureStorage *Renderer9::createTextureStorage2D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ bool hintLevelZeroOnly)
+{
+ return new TextureStorage9_2D(this, internalformat, renderTarget, width, height, levels);
+}
+
+TextureStorage *Renderer9::createTextureStorageCube(GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly)
+{
+ return new TextureStorage9_Cube(this, internalformat, renderTarget, size, levels,
+ hintLevelZeroOnly);
+}
+
+TextureStorage *Renderer9::createTextureStorage3D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels)
+{
+ // 3D textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+
+ return nullptr;
+}
+
+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 nullptr;
+}
+
+TextureStorage *Renderer9::createTextureStorage2DMultisample(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ int samples,
+ bool fixedSampleLocations)
+{
+ // 2D multisampled textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+
+ return nullptr;
+}
+
+TextureStorage *Renderer9::createTextureStorage2DMultisampleArray(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels,
+ int samples,
+ bool fixedSampleLocations)
+{
+ // 2D multisampled textures are not supported by the D3D9 backend.
+ UNREACHABLE();
+
+ return nullptr;
+}
+
+bool Renderer9::getLUID(LUID *adapterLuid) const
+{
+ adapterLuid->HighPart = 0;
+ adapterLuid->LowPart = 0;
+
+ if (mD3d9Ex)
+ {
+ mD3d9Ex->GetAdapterLUID(mAdapter, adapterLuid);
+ return true;
+ }
+
+ return false;
+}
+
+VertexConversionType Renderer9::getVertexConversionType(angle::FormatID vertexFormatID) const
+{
+ return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatID).conversionType;
+}
+
+GLenum Renderer9::getVertexComponentType(angle::FormatID vertexFormatID) const
+{
+ return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatID).componentType;
+}
+
+angle::Result Renderer9::getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const
+{
+ if (!attrib.enabled)
+ {
+ *bytesRequiredOut = 16u;
+ return angle::Result::Continue;
+ }
+
+ angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, gl::VertexAttribType::Float);
+ const d3d9::VertexFormat &d3d9VertexInfo =
+ d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormatID);
+
+ unsigned int elementCount = 0;
+ const unsigned int divisor = binding.getDivisor();
+ if (instances == 0 || divisor == 0)
+ {
+ elementCount = static_cast<unsigned int>(count);
+ }
+ else
+ {
+ // Round up to divisor, if possible
+ elementCount = UnsignedCeilDivide(static_cast<unsigned int>(instances), divisor);
+ }
+
+ bool check = (d3d9VertexInfo.outputElementSize >
+ std::numeric_limits<unsigned int>::max() / elementCount);
+ ANGLE_CHECK(GetImplAs<Context9>(context), !check,
+ "New vertex buffer size would result in an overflow.", GL_OUT_OF_MEMORY);
+
+ *bytesRequiredOut = static_cast<unsigned int>(d3d9VertexInfo.outputElementSize) * elementCount;
+ return angle::Result::Continue;
+}
+
+void Renderer9::generateCaps(gl::Caps *outCaps,
+ gl::TextureCapsMap *outTextureCaps,
+ gl::Extensions *outExtensions,
+ gl::Limitations *outLimitations) const
+{
+ d3d9_gl::GenerateCaps(mD3d9, mDevice, mDeviceType, mAdapter, outCaps, outTextureCaps,
+ outExtensions, outLimitations);
+}
+
+void Renderer9::initializeFeatures(angle::FeaturesD3D *features) const
+{
+ d3d9::InitializeFeatures(features);
+ OverrideFeaturesWithDisplayState(features, mDisplay->getState());
+}
+
+DeviceImpl *Renderer9::createEGLDevice()
+{
+ return new DeviceD3D(EGL_D3D9_DEVICE_ANGLE, mDevice);
+}
+
+Renderer9::CurSamplerState::CurSamplerState()
+ : forceSet(true), baseLevel(std::numeric_limits<size_t>::max()), samplerState()
+{}
+
+angle::Result Renderer9::genericDrawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances)
+{
+ const gl::State &state = context->getState();
+ gl::Program *program = context->getState().getProgram();
+ ASSERT(program != nullptr);
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
+ bool usesPointSize = programD3D->usesPointSize();
+
+ programD3D->updateSamplerMapping();
+
+ if (!applyPrimitiveType(mode, count, usesPointSize))
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRY(updateState(context, mode));
+ ANGLE_TRY(applyTextures(context));
+ ANGLE_TRY(applyShaders(context, mode));
+
+ if (!skipDraw(state, mode))
+ {
+ ANGLE_TRY(drawElementsImpl(context, mode, count, type, indices, instances));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::genericDrawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instances)
+{
+ gl::Program *program = context->getState().getProgram();
+ ASSERT(program != nullptr);
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
+ bool usesPointSize = programD3D->usesPointSize();
+
+ programD3D->updateSamplerMapping();
+
+ if (!applyPrimitiveType(mode, count, usesPointSize))
+ {
+ return angle::Result::Continue;
+ }
+
+ ANGLE_TRY(updateState(context, mode));
+ ANGLE_TRY(applyVertexBuffer(context, mode, first, count, instances, nullptr));
+ ANGLE_TRY(applyTextures(context));
+ ANGLE_TRY(applyShaders(context, mode));
+
+ if (!skipDraw(context->getState(), mode))
+ {
+ ANGLE_TRY(drawArraysImpl(context, mode, first, count, instances));
+ }
+
+ return angle::Result::Continue;
+}
+
+FramebufferImpl *Renderer9::createDefaultFramebuffer(const gl::FramebufferState &state)
+{
+ return new Framebuffer9(state, this);
+}
+
+gl::Version Renderer9::getMaxSupportedESVersion() const
+{
+ return gl::Version(2, 0);
+}
+
+gl::Version Renderer9::getMaxConformantESVersion() const
+{
+ return gl::Version(2, 0);
+}
+
+angle::Result Renderer9::clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue)
+{
+ D3DCOLOR color =
+ D3DCOLOR_ARGB(gl::unorm<8>(clearColorValue.alpha), gl::unorm<8>(clearColorValue.red),
+ gl::unorm<8>(clearColorValue.green), gl::unorm<8>(clearColorValue.blue));
+ float depth = clearDepthValue;
+ DWORD stencil = clearStencilValue & 0x000000FF;
+
+ unsigned int renderTargetSerial = renderTarget->getSerial();
+ RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTarget);
+ IDirect3DSurface9 *renderTargetSurface = renderTarget9->getSurface();
+ ASSERT(renderTargetSurface);
+
+ DWORD dxClearFlags = 0;
+
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetSizedInternalFormatInfo(renderTarget->getInternalFormat());
+ if (internalFormatInfo.depthBits > 0 || internalFormatInfo.stencilBits > 0)
+ {
+ dxClearFlags = D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL;
+ if (mAppliedDepthStencilSerial != renderTargetSerial)
+ {
+ mDevice->SetDepthStencilSurface(renderTargetSurface);
+ }
+ }
+ else
+ {
+ dxClearFlags = D3DCLEAR_TARGET;
+ if (mAppliedRenderTargetSerial != renderTargetSerial)
+ {
+ mDevice->SetRenderTarget(0, renderTargetSurface);
+ }
+ }
+ SafeRelease(renderTargetSurface);
+
+ D3DVIEWPORT9 viewport;
+ viewport.X = 0;
+ viewport.Y = 0;
+ viewport.Width = renderTarget->getWidth();
+ viewport.Height = renderTarget->getHeight();
+ mDevice->SetViewport(&viewport);
+
+ mDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+
+ mDevice->Clear(0, nullptr, dxClearFlags, color, depth, stencil);
+
+ markAllStateDirty();
+
+ return angle::Result::Continue;
+}
+
+bool Renderer9::canSelectViewInVertexShader() const
+{
+ return false;
+}
+
+// For each Direct3D sampler of either the pixel or vertex stage,
+// looks up the corresponding OpenGL texture image unit and texture type,
+// and sets the texture and its addressing/filtering state (or NULL when inactive).
+// Sampler mapping needs to be up-to-date on the program object before this is called.
+angle::Result Renderer9::applyTextures(const gl::Context *context, gl::ShaderType shaderType)
+{
+ const auto &glState = context->getState();
+ const auto &caps = context->getCaps();
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
+
+ ASSERT(!programD3D->isSamplerMappingDirty());
+
+ // TODO(jmadill): Use the Program's sampler bindings.
+ const gl::ActiveTexturePointerArray &activeTextures = glState.getActiveTexturesCache();
+
+ const gl::RangeUI samplerRange = programD3D->getUsedSamplerRange(shaderType);
+ for (unsigned int samplerIndex = samplerRange.low(); samplerIndex < samplerRange.high();
+ samplerIndex++)
+ {
+ GLint textureUnit = programD3D->getSamplerMapping(shaderType, samplerIndex, caps);
+ ASSERT(textureUnit != -1);
+ gl::Texture *texture = activeTextures[textureUnit];
+
+ // A nullptr texture indicates incomplete.
+ if (texture)
+ {
+ gl::Sampler *samplerObject = glState.getSampler(textureUnit);
+
+ const gl::SamplerState &samplerState =
+ samplerObject ? samplerObject->getSamplerState() : texture->getSamplerState();
+
+ ANGLE_TRY(setSamplerState(context, shaderType, samplerIndex, texture, samplerState));
+ ANGLE_TRY(setTexture(context, shaderType, samplerIndex, texture));
+ }
+ else
+ {
+ gl::TextureType textureType =
+ programD3D->getSamplerTextureType(shaderType, samplerIndex);
+
+ // Texture is not sampler complete or it is in use by the framebuffer. Bind the
+ // incomplete texture.
+ gl::Texture *incompleteTexture = nullptr;
+ ANGLE_TRY(getIncompleteTexture(context, textureType, &incompleteTexture));
+ ANGLE_TRY(setSamplerState(context, shaderType, samplerIndex, incompleteTexture,
+ incompleteTexture->getSamplerState()));
+ ANGLE_TRY(setTexture(context, shaderType, samplerIndex, incompleteTexture));
+ }
+ }
+
+ // Set all the remaining textures to NULL
+ size_t samplerCount = (shaderType == gl::ShaderType::Fragment)
+ ? caps.maxShaderTextureImageUnits[gl::ShaderType::Fragment]
+ : caps.maxShaderTextureImageUnits[gl::ShaderType::Vertex];
+
+ // TODO(jmadill): faster way?
+ for (size_t samplerIndex = samplerRange.high(); samplerIndex < samplerCount; samplerIndex++)
+ {
+ ANGLE_TRY(setTexture(context, shaderType, static_cast<int>(samplerIndex), nullptr));
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::applyTextures(const gl::Context *context)
+{
+ ANGLE_TRY(applyTextures(context, gl::ShaderType::Vertex));
+ ANGLE_TRY(applyTextures(context, gl::ShaderType::Fragment));
+ return angle::Result::Continue;
+}
+
+angle::Result Renderer9::getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut)
+{
+ return GetImplAs<Context9>(context)->getIncompleteTexture(context, type, textureOut);
+}
+
+angle::Result Renderer9::ensureVertexDataManagerInitialized(const gl::Context *context)
+{
+ if (!mVertexDataManager)
+ {
+ mVertexDataManager = new VertexDataManager(this);
+ ANGLE_TRY(mVertexDataManager->initialize(context));
+ }
+
+ return angle::Result::Continue;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
new file mode 100644
index 0000000000..9fa5fbfec4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
@@ -0,0 +1,580 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Renderer9.h: Defines a back-end specific class for the D3D9 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_RENDERER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_RENDERER9_H_
+
+#include "common/angleutils.h"
+#include "common/mathutil.h"
+#include "libANGLE/renderer/d3d/HLSLCompiler.h"
+#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h"
+#include "libANGLE/renderer/d3d/d3d9/ShaderCache.h"
+#include "libANGLE/renderer/d3d/d3d9/StateManager9.h"
+#include "libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h"
+#include "libANGLE/renderer/driver_utils.h"
+
+namespace gl
+{
+class FramebufferAttachment;
+}
+
+namespace egl
+{
+class AttributeMap;
+}
+
+namespace rx
+{
+class Blit9;
+class Context9;
+class IndexDataManager;
+class ProgramD3D;
+class RenderTarget9;
+class StreamingIndexBufferInterface;
+class StaticIndexBufferInterface;
+class VertexDataManager;
+struct ClearParameters;
+struct D3DUniform;
+struct TranslatedAttribute;
+
+enum D3D9InitError
+{
+ D3D9_INIT_SUCCESS = 0,
+ // Failed to load the D3D or ANGLE compiler
+ D3D9_INIT_COMPILER_ERROR,
+ // Failed to load a necessary DLL
+ D3D9_INIT_MISSING_DEP,
+ // Device creation error
+ D3D9_INIT_CREATE_DEVICE_ERROR,
+ // System does not meet minimum shader spec
+ D3D9_INIT_UNSUPPORTED_VERSION,
+ // System does not support stretchrect from textures
+ D3D9_INIT_UNSUPPORTED_STRETCHRECT,
+ // A call returned out of memory or device lost
+ D3D9_INIT_OUT_OF_MEMORY,
+ // Other unspecified error
+ D3D9_INIT_OTHER_ERROR,
+ NUM_D3D9_INIT_ERRORS
+};
+
+class Renderer9 : public RendererD3D
+{
+ public:
+ explicit Renderer9(egl::Display *display);
+ ~Renderer9() override;
+
+ egl::Error initialize() override;
+ bool resetDevice() override;
+
+ egl::ConfigSet generateConfigs() override;
+ void generateDisplayExtensions(egl::DisplayExtensions *outExtensions) const override;
+
+ void startScene();
+ void endScene();
+
+ angle::Result flush(const gl::Context *context);
+ angle::Result finish(const gl::Context *context);
+
+ bool isValidNativeWindow(EGLNativeWindowType window) const override;
+ NativeWindowD3D *createNativeWindow(EGLNativeWindowType window,
+ const egl::Config *config,
+ const egl::AttributeMap &attribs) const override;
+
+ SwapChainD3D *createSwapChain(NativeWindowD3D *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation,
+ EGLint samples) override;
+ egl::Error getD3DTextureInfo(const egl::Config *configuration,
+ IUnknown *d3dTexture,
+ EGLint *width,
+ EGLint *height,
+ EGLint *samples,
+ const angle::Format **angleFormat) const override;
+ egl::Error validateShareHandle(const egl::Config *config,
+ HANDLE shareHandle,
+ const egl::AttributeMap &attribs) const override;
+
+ ContextImpl *createContext(const gl::State &state, gl::ErrorSet *errorSet) override;
+
+ angle::Result allocateEventQuery(const gl::Context *context, IDirect3DQuery9 **outQuery);
+ void freeEventQuery(IDirect3DQuery9 *query);
+
+ // resource creation
+ angle::Result createVertexShader(d3d::Context *context,
+ const DWORD *function,
+ size_t length,
+ IDirect3DVertexShader9 **outShader);
+ angle::Result createPixelShader(d3d::Context *context,
+ const DWORD *function,
+ size_t length,
+ IDirect3DPixelShader9 **outShader);
+ HRESULT createVertexBuffer(UINT Length, DWORD Usage, IDirect3DVertexBuffer9 **ppVertexBuffer);
+ HRESULT createIndexBuffer(UINT Length,
+ DWORD Usage,
+ D3DFORMAT Format,
+ IDirect3DIndexBuffer9 **ppIndexBuffer);
+ angle::Result setSamplerState(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture,
+ const gl::SamplerState &sampler);
+ angle::Result setTexture(const gl::Context *context,
+ gl::ShaderType type,
+ int index,
+ gl::Texture *texture);
+
+ angle::Result updateState(const gl::Context *context, gl::PrimitiveMode drawMode);
+
+ void setScissorRectangle(const gl::Rectangle &scissor, bool enabled);
+ void setViewport(const gl::Rectangle &viewport,
+ float zNear,
+ float zFar,
+ gl::PrimitiveMode drawMode,
+ GLenum frontFace,
+ bool ignoreViewport);
+
+ angle::Result applyRenderTarget(const gl::Context *context,
+ const RenderTarget9 *colorRenderTarget,
+ const RenderTarget9 *depthStencilRenderTarget);
+ void applyUniforms(ProgramD3D *programD3D);
+ bool applyPrimitiveType(gl::PrimitiveMode primitiveType,
+ GLsizei elementCount,
+ bool usesPointSize);
+ angle::Result applyVertexBuffer(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instances,
+ TranslatedIndexData *indexInfo);
+ angle::Result applyIndexBuffer(const gl::Context *context,
+ const void *indices,
+ GLsizei count,
+ gl::PrimitiveMode mode,
+ gl::DrawElementsType type,
+ TranslatedIndexData *indexInfo);
+
+ void clear(const ClearParameters &clearParams,
+ const RenderTarget9 *colorRenderTarget,
+ const RenderTarget9 *depthStencilRenderTarget);
+
+ void markAllStateDirty();
+
+ // lost device
+ bool testDeviceLost() override;
+ bool testDeviceResettable() override;
+
+ VendorID getVendorId() const;
+ std::string getRendererDescription() const;
+ DeviceIdentifier getAdapterIdentifier() const override;
+
+ IDirect3DDevice9 *getDevice() { return mDevice; }
+ void *getD3DDevice() override;
+
+ unsigned int getReservedVertexUniformVectors() const;
+ unsigned int getReservedFragmentUniformVectors() const;
+
+ bool getShareHandleSupport() const;
+
+ int getMajorShaderModel() const override;
+ int getMinorShaderModel() const override;
+ std::string getShaderModelSuffix() const override;
+
+ DWORD getCapsDeclTypes() const;
+
+ // Pixel operations
+ angle::Result copyImage2D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImageCube(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget target,
+ GLint level) override;
+ angle::Result copyImage3D(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+ angle::Result copyImage2DArray(const gl::Context *context,
+ const gl::Framebuffer *framebuffer,
+ const gl::Rectangle &sourceRect,
+ GLenum destFormat,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ GLint level) override;
+
+ angle::Result copyTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ gl::TextureTarget srcTarget,
+ const gl::Box &sourceBox,
+ GLenum destFormat,
+ GLenum destType,
+ const gl::Offset &destOffset,
+ TextureStorage *storage,
+ gl::TextureTarget destTarget,
+ GLint destLevel,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
+ angle::Result copyCompressedTexture(const gl::Context *context,
+ const gl::Texture *source,
+ GLint sourceLevel,
+ TextureStorage *storage,
+ GLint destLevel) override;
+
+ // RenderTarget creation
+ angle::Result createRenderTarget(const gl::Context *context,
+ int width,
+ int height,
+ GLenum format,
+ GLsizei samples,
+ RenderTargetD3D **outRT) override;
+ angle::Result createRenderTargetCopy(const gl::Context *context,
+ RenderTargetD3D *source,
+ RenderTargetD3D **outRT) override;
+
+ // Shader operations
+ angle::Result loadExecutable(d3d::Context *context,
+ const uint8_t *function,
+ size_t length,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ ShaderExecutableD3D **outExecutable) override;
+ angle::Result compileToExecutable(d3d::Context *context,
+ gl::InfoLog &infoLog,
+ const std::string &shaderHLSL,
+ gl::ShaderType type,
+ const std::vector<D3DVarying> &streamOutVaryings,
+ bool separatedOutputBuffers,
+ const angle::CompilerWorkaroundsD3D &workarounds,
+ ShaderExecutableD3D **outExectuable) override;
+ angle::Result ensureHLSLCompilerInitialized(d3d::Context *context) override;
+
+ UniformStorageD3D *createUniformStorage(size_t storageSize) override;
+
+ // Image operations
+ ImageD3D *createImage() override;
+ ExternalImageSiblingImpl *createExternalImageSibling(const gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const egl::AttributeMap &attribs) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source) override;
+ angle::Result generateMipmapUsingD3D(const gl::Context *context,
+ TextureStorage *storage,
+ const gl::TextureState &textureState) override;
+ angle::Result copyImage(const gl::Context *context,
+ ImageD3D *dest,
+ ImageD3D *source,
+ const gl::Box &sourceBox,
+ const gl::Offset &destOffset,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha) override;
+ TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) override;
+ TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
+ RenderTargetD3D *renderTargetD3D) override;
+ TextureStorage *createTextureStorageExternal(
+ egl::Stream *stream,
+ const egl::Stream::GLTextureDescription &desc) override;
+ TextureStorage *createTextureStorage2D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ bool hintLevelZeroOnly) override;
+ TextureStorage *createTextureStorageCube(GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly) override;
+ TextureStorage *createTextureStorage3D(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels) override;
+ TextureStorage *createTextureStorage2DArray(GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels) override;
+
+ TextureStorage *createTextureStorage2DMultisample(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ int levels,
+ int samples,
+ bool fixedSampleLocations) override;
+ TextureStorage *createTextureStorage2DMultisampleArray(GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ int levels,
+ int samples,
+ bool fixedSampleLocations) override;
+
+ // Buffer creation
+ VertexBuffer *createVertexBuffer() override;
+ IndexBuffer *createIndexBuffer() override;
+
+ // Stream Creation
+ StreamProducerImpl *createStreamProducerD3DTexture(egl::Stream::ConsumerType consumerType,
+ const egl::AttributeMap &attribs) override;
+
+ // Buffer-to-texture and Texture-to-buffer copies
+ bool supportsFastCopyBufferToTexture(GLenum internalFormat) const override;
+ angle::Result fastCopyBufferToTexture(const gl::Context *context,
+ const gl::PixelUnpackState &unpack,
+ unsigned int offset,
+ RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat,
+ GLenum sourcePixelsType,
+ const gl::Box &destArea) override;
+
+ // D3D9-renderer specific methods
+ angle::Result boxFilter(Context9 *context9, IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
+
+ D3DPOOL getTexturePool(DWORD usage) const;
+
+ bool getLUID(LUID *adapterLuid) const override;
+ VertexConversionType getVertexConversionType(angle::FormatID vertexFormatID) const override;
+ GLenum getVertexComponentType(angle::FormatID vertexFormatID) const override;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using this
+ // function.
+ angle::Result getVertexSpaceRequired(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ size_t count,
+ GLsizei instances,
+ unsigned int *bytesRequiredOut) const override;
+
+ angle::Result copyToRenderTarget(const gl::Context *context,
+ IDirect3DSurface9 *dest,
+ IDirect3DSurface9 *source,
+ bool fromManaged);
+
+ RendererClass getRendererClass() const override;
+
+ D3DDEVTYPE getD3D9DeviceType() const { return mDeviceType; }
+
+ DeviceImpl *createEGLDevice() override;
+
+ StateManager9 *getStateManager() { return &mStateManager; }
+
+ angle::Result genericDrawArrays(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instances);
+
+ angle::Result genericDrawElements(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances);
+
+ // Necessary hack for default framebuffers in D3D.
+ FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
+
+ DebugAnnotator9 *getAnnotator() { return &mAnnotator; }
+
+ gl::Version getMaxSupportedESVersion() const override;
+ gl::Version getMaxConformantESVersion() const override;
+
+ angle::Result clearRenderTarget(const gl::Context *context,
+ RenderTargetD3D *renderTarget,
+ const gl::ColorF &clearColorValue,
+ const float clearDepthValue,
+ const unsigned int clearStencilValue) override;
+
+ bool canSelectViewInVertexShader() const override;
+
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ gl::Texture **textureOut) override;
+
+ angle::Result ensureVertexDataManagerInitialized(const gl::Context *context);
+
+ private:
+ angle::Result drawArraysImpl(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLint startVertex,
+ GLsizei count,
+ GLsizei instances);
+ angle::Result drawElementsImpl(const gl::Context *context,
+ gl::PrimitiveMode mode,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ GLsizei instances);
+
+ angle::Result applyShaders(const gl::Context *context, gl::PrimitiveMode drawMode);
+
+ angle::Result applyTextures(const gl::Context *context);
+ angle::Result applyTextures(const gl::Context *context, gl::ShaderType shaderType);
+
+ void generateCaps(gl::Caps *outCaps,
+ gl::TextureCapsMap *outTextureCaps,
+ gl::Extensions *outExtensions,
+ gl::Limitations *outLimitations) const override;
+
+ void initializeFeatures(angle::FeaturesD3D *features) const override;
+
+ angle::Result setBlendDepthRasterStates(const gl::Context *context, gl::PrimitiveMode drawMode);
+
+ void release();
+
+ void applyUniformnfv(const D3DUniform *targetUniform, const GLfloat *v);
+ void applyUniformniv(const D3DUniform *targetUniform, const GLint *v);
+ void applyUniformnbv(const D3DUniform *targetUniform, const GLint *v);
+
+ angle::Result drawLineLoop(const gl::Context *context,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ int minIndex,
+ gl::Buffer *elementArrayBuffer);
+ angle::Result drawIndexedPoints(const gl::Context *context,
+ GLsizei count,
+ gl::DrawElementsType type,
+ const void *indices,
+ int minIndex,
+ gl::Buffer *elementArrayBuffer);
+
+ angle::Result getCountingIB(const gl::Context *context,
+ size_t count,
+ StaticIndexBufferInterface **outIB);
+
+ angle::Result getNullColorRenderTarget(const gl::Context *context,
+ const RenderTarget9 *depthRenderTarget,
+ const RenderTarget9 **outColorRenderTarget);
+
+ D3DPOOL getBufferPool(DWORD usage) const;
+
+ HMODULE mD3d9Module;
+
+ egl::Error initializeDevice();
+ D3DPRESENT_PARAMETERS getDefaultPresentParameters();
+ void releaseDeviceResources();
+
+ HRESULT getDeviceStatusCode();
+ bool isRemovedDeviceResettable() const;
+ bool resetRemovedDevice();
+
+ UINT mAdapter;
+ D3DDEVTYPE mDeviceType;
+ IDirect3D9 *mD3d9; // Always valid after successful initialization.
+ IDirect3D9Ex *mD3d9Ex; // Might be null if D3D9Ex is not supported.
+ IDirect3DDevice9 *mDevice;
+ IDirect3DDevice9Ex *mDeviceEx; // Might be null if D3D9Ex is not supported.
+
+ HLSLCompiler mCompiler;
+
+ Blit9 *mBlit;
+
+ HWND mDeviceWindow;
+
+ D3DCAPS9 mDeviceCaps;
+ D3DADAPTER_IDENTIFIER9 mAdapterIdentifier;
+
+ D3DPRIMITIVETYPE mPrimitiveType;
+ int mPrimitiveCount;
+ GLsizei mRepeatDraw;
+
+ bool mSceneStarted;
+
+ bool mVertexTextureSupport;
+
+ // current render target states
+ unsigned int mAppliedRenderTargetSerial;
+ unsigned int mAppliedDepthStencilSerial;
+ bool mDepthStencilInitialized;
+ bool mRenderTargetDescInitialized;
+
+ IDirect3DStateBlock9 *mMaskedClearSavedState;
+
+ StateManager9 mStateManager;
+
+ // Currently applied sampler states
+ struct CurSamplerState
+ {
+ CurSamplerState();
+
+ bool forceSet;
+ size_t baseLevel;
+ gl::SamplerState samplerState;
+ };
+ std::vector<CurSamplerState> mCurVertexSamplerStates;
+ std::vector<CurSamplerState> mCurPixelSamplerStates;
+
+ // Currently applied textures
+ std::vector<uintptr_t> mCurVertexTextures;
+ std::vector<uintptr_t> mCurPixelTextures;
+
+ unsigned int mAppliedIBSerial;
+ IDirect3DVertexShader9 *mAppliedVertexShader;
+ IDirect3DPixelShader9 *mAppliedPixelShader;
+ unsigned int mAppliedProgramSerial;
+
+ // A pool of event queries that are currently unused.
+ std::vector<IDirect3DQuery9 *> mEventQueryPool;
+ VertexShaderCache mVertexShaderCache;
+ PixelShaderCache mPixelShaderCache;
+
+ VertexDataManager *mVertexDataManager;
+ VertexDeclarationCache mVertexDeclarationCache;
+
+ IndexDataManager *mIndexDataManager;
+ StreamingIndexBufferInterface *mLineLoopIB;
+ StaticIndexBufferInterface *mCountingIB;
+
+ enum
+ {
+ NUM_NULL_COLORBUFFER_CACHE_ENTRIES = 12
+ };
+ struct NullRenderTargetCacheEntry
+ {
+ UINT lruCount;
+ int width;
+ int height;
+ RenderTarget9 *renderTarget;
+ };
+
+ std::array<NullRenderTargetCacheEntry, NUM_NULL_COLORBUFFER_CACHE_ENTRIES>
+ mNullRenderTargetCache;
+ UINT mMaxNullColorbufferLRU;
+
+ std::vector<TranslatedAttribute> mTranslatedAttribCache;
+
+ DebugAnnotator9 mAnnotator;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERER9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h
new file mode 100644
index 0000000000..1aef503ba5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h
@@ -0,0 +1,110 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderCache: Defines rx::ShaderCache, a cache of Direct3D shader objects
+// keyed by their byte code.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_SHADERCACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_SHADERCACHE_H_
+
+#include "libANGLE/Error.h"
+
+#include "common/debug.h"
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+
+#include <cstddef>
+#include <mutex>
+#include <string>
+#include <unordered_map>
+
+namespace rx
+{
+template <typename ShaderObject>
+class ShaderCache : angle::NonCopyable
+{
+ public:
+ ShaderCache() : mDevice(nullptr) {}
+
+ ~ShaderCache()
+ {
+ // Call clear while the device is still valid.
+ ASSERT(mMap.empty());
+ }
+
+ void initialize(IDirect3DDevice9 *device) { mDevice = device; }
+
+ angle::Result create(d3d::Context *context,
+ const DWORD *function,
+ size_t length,
+ ShaderObject **outShaderObject)
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+
+ std::string key(reinterpret_cast<const char *>(function), length);
+ typename Map::iterator it = mMap.find(key);
+ if (it != mMap.end())
+ {
+ it->second->AddRef();
+ *outShaderObject = it->second;
+ return angle::Result::Continue;
+ }
+
+ ShaderObject *shader;
+ HRESULT result = createShader(function, &shader);
+ ANGLE_TRY_HR(context, result, "Failed to create shader");
+
+ // Random eviction policy.
+ if (mMap.size() >= kMaxMapSize)
+ {
+ SafeRelease(mMap.begin()->second);
+ mMap.erase(mMap.begin());
+ }
+
+ shader->AddRef();
+ mMap[key] = shader;
+
+ *outShaderObject = shader;
+ return angle::Result::Continue;
+ }
+
+ void clear()
+ {
+ std::lock_guard<std::mutex> lock(mMutex);
+
+ for (typename Map::iterator it = mMap.begin(); it != mMap.end(); ++it)
+ {
+ SafeRelease(it->second);
+ }
+
+ mMap.clear();
+ }
+
+ private:
+ const static size_t kMaxMapSize = 100;
+
+ HRESULT createShader(const DWORD *function, IDirect3DVertexShader9 **shader)
+ {
+ return mDevice->CreateVertexShader(function, shader);
+ }
+
+ HRESULT createShader(const DWORD *function, IDirect3DPixelShader9 **shader)
+ {
+ return mDevice->CreatePixelShader(function, shader);
+ }
+
+ typedef std::unordered_map<std::string, ShaderObject *> Map;
+ Map mMap;
+ std::mutex mMutex;
+
+ IDirect3DDevice9 *mDevice;
+};
+
+typedef ShaderCache<IDirect3DVertexShader9> VertexShaderCache;
+typedef ShaderCache<IDirect3DPixelShader9> PixelShaderCache;
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_SHADERCACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp
new file mode 100644
index 0000000000..c9e8e73ed6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderExecutable9.cpp: Implements a D3D9-specific class to contain shader
+// executable implementation details.
+
+#include "libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h"
+
+#include "common/debug.h"
+
+namespace rx
+{
+
+ShaderExecutable9::ShaderExecutable9(const void *function,
+ size_t length,
+ IDirect3DPixelShader9 *executable)
+ : ShaderExecutableD3D(function, length)
+{
+ mPixelExecutable = executable;
+ mVertexExecutable = nullptr;
+}
+
+ShaderExecutable9::ShaderExecutable9(const void *function,
+ size_t length,
+ IDirect3DVertexShader9 *executable)
+ : ShaderExecutableD3D(function, length)
+{
+ mVertexExecutable = executable;
+ mPixelExecutable = nullptr;
+}
+
+ShaderExecutable9::~ShaderExecutable9()
+{
+ SafeRelease(mVertexExecutable);
+ SafeRelease(mPixelExecutable);
+}
+
+IDirect3DVertexShader9 *ShaderExecutable9::getVertexShader() const
+{
+ return mVertexExecutable;
+}
+
+IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader() const
+{
+ return mPixelExecutable;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h
new file mode 100644
index 0000000000..599a166870
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h
@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ShaderExecutable9.h: Defines a D3D9-specific class to contain shader
+// executable implementation details.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_
+
+#include "libANGLE/renderer/d3d/ShaderExecutableD3D.h"
+
+namespace rx
+{
+
+class ShaderExecutable9 : public ShaderExecutableD3D
+{
+ public:
+ ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable);
+ ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable);
+ ~ShaderExecutable9() override;
+
+ IDirect3DPixelShader9 *getPixelShader() const;
+ IDirect3DVertexShader9 *getVertexShader() const;
+
+ private:
+ IDirect3DPixelShader9 *mPixelExecutable;
+ IDirect3DVertexShader9 *mVertexExecutable;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
new file mode 100644
index 0000000000..74bbe53fd8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
@@ -0,0 +1,938 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// StateManager9.cpp: Defines a class for caching D3D9 state
+#include "libANGLE/renderer/d3d/d3d9/StateManager9.h"
+
+#include "common/bitset_utils.h"
+#include "common/utilities.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace rx
+{
+
+StateManager9::StateManager9(Renderer9 *renderer9)
+ : mUsingZeroColorMaskWorkaround(false),
+ mCurBlendState(),
+ mCurBlendColor(0, 0, 0, 0),
+ mCurSampleMask(0),
+ mCurRasterState(),
+ mCurDepthSize(0),
+ mCurDepthStencilState(),
+ mCurStencilRef(0),
+ mCurStencilBackRef(0),
+ mCurFrontFaceCCW(0),
+ mCurStencilSize(0),
+ mCurScissorRect(),
+ mCurScissorEnabled(false),
+ mCurViewport(),
+ mCurNear(0.0f),
+ mCurFar(0.0f),
+ mCurDepthFront(0.0f),
+ mCurIgnoreViewport(false),
+ mRenderer9(renderer9),
+ mDirtyBits()
+{
+ mBlendStateDirtyBits.set(DIRTY_BIT_BLEND_ENABLED);
+ mBlendStateDirtyBits.set(DIRTY_BIT_BLEND_COLOR);
+ mBlendStateDirtyBits.set(DIRTY_BIT_BLEND_FUNCS_EQUATIONS);
+ mBlendStateDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE);
+ mBlendStateDirtyBits.set(DIRTY_BIT_COLOR_MASK);
+ mBlendStateDirtyBits.set(DIRTY_BIT_DITHER);
+ mBlendStateDirtyBits.set(DIRTY_BIT_SAMPLE_MASK);
+
+ mRasterizerStateDirtyBits.set(DIRTY_BIT_CULL_MODE);
+ mRasterizerStateDirtyBits.set(DIRTY_BIT_DEPTH_BIAS);
+
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_DEPTH_MASK);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_DEPTH_FUNC);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_TEST_ENABLED);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_BACK);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_FRONT);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_BACK);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_OPS_FRONT);
+ mDepthStencilStateDirtyBits.set(DIRTY_BIT_STENCIL_OPS_BACK);
+
+ mScissorStateDirtyBits.set(DIRTY_BIT_SCISSOR_ENABLED);
+ mScissorStateDirtyBits.set(DIRTY_BIT_SCISSOR_RECT);
+}
+
+StateManager9::~StateManager9() {}
+
+void StateManager9::initialize()
+{
+ mUsingZeroColorMaskWorkaround = IsAMD(mRenderer9->getVendorId());
+}
+
+void StateManager9::forceSetBlendState()
+{
+ mDirtyBits |= mBlendStateDirtyBits;
+}
+
+void StateManager9::forceSetRasterState()
+{
+ mDirtyBits |= mRasterizerStateDirtyBits;
+}
+
+void StateManager9::forceSetDepthStencilState()
+{
+ mDirtyBits |= mDepthStencilStateDirtyBits;
+}
+
+void StateManager9::forceSetScissorState()
+{
+ mDirtyBits |= mScissorStateDirtyBits;
+}
+
+void StateManager9::forceSetViewportState()
+{
+ mForceSetViewport = true;
+}
+
+void StateManager9::forceSetDXUniformsState()
+{
+ mDxUniformsDirty = true;
+}
+
+void StateManager9::updateStencilSizeIfChanged(bool depthStencilInitialized,
+ unsigned int stencilSize)
+{
+ if (!depthStencilInitialized || stencilSize != mCurStencilSize)
+ {
+ mCurStencilSize = stencilSize;
+ forceSetDepthStencilState();
+ }
+}
+
+void StateManager9::syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits)
+{
+ if (!dirtyBits.any())
+ {
+ return;
+ }
+
+ for (auto dirtyBit : dirtyBits)
+ {
+ switch (dirtyBit)
+ {
+ case gl::State::DIRTY_BIT_BLEND_ENABLED:
+ if (state.getBlendState().blend != mCurBlendState.blend)
+ {
+ mDirtyBits.set(DIRTY_BIT_BLEND_ENABLED);
+ // BlendColor and funcs and equations has to be set if blend is enabled
+ mDirtyBits.set(DIRTY_BIT_BLEND_COLOR);
+ mDirtyBits.set(DIRTY_BIT_BLEND_FUNCS_EQUATIONS);
+
+ // The color mask may have to be updated if the blend state changes
+ if (mUsingZeroColorMaskWorkaround)
+ {
+ mDirtyBits.set(DIRTY_BIT_COLOR_MASK);
+ }
+ }
+ break;
+ case gl::State::DIRTY_BIT_BLEND_FUNCS:
+ {
+ const gl::BlendState &blendState = state.getBlendState();
+ if (blendState.sourceBlendRGB != mCurBlendState.sourceBlendRGB ||
+ blendState.destBlendRGB != mCurBlendState.destBlendRGB ||
+ blendState.sourceBlendAlpha != mCurBlendState.sourceBlendAlpha ||
+ blendState.destBlendAlpha != mCurBlendState.destBlendAlpha)
+ {
+ mDirtyBits.set(DIRTY_BIT_BLEND_FUNCS_EQUATIONS);
+ // BlendColor depends on the values of blend funcs
+ mDirtyBits.set(DIRTY_BIT_BLEND_COLOR);
+
+ // The color mask may have to be updated if the blend funcs change
+ if (mUsingZeroColorMaskWorkaround)
+ {
+ mDirtyBits.set(DIRTY_BIT_COLOR_MASK);
+ }
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_BLEND_EQUATIONS:
+ {
+ const gl::BlendState &blendState = state.getBlendState();
+ if (blendState.blendEquationRGB != mCurBlendState.blendEquationRGB ||
+ blendState.blendEquationAlpha != mCurBlendState.blendEquationAlpha)
+ {
+ mDirtyBits.set(DIRTY_BIT_BLEND_FUNCS_EQUATIONS);
+
+ // The color mask may have to be updated if the blend funcs change
+ if (mUsingZeroColorMaskWorkaround)
+ {
+ mDirtyBits.set(DIRTY_BIT_COLOR_MASK);
+ }
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE_ENABLED:
+ if (state.getBlendState().sampleAlphaToCoverage !=
+ mCurBlendState.sampleAlphaToCoverage)
+ {
+ mDirtyBits.set(DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_COLOR_MASK:
+ {
+ const gl::BlendState &blendState = state.getBlendState();
+ if (blendState.colorMaskRed != mCurBlendState.colorMaskRed ||
+ blendState.colorMaskGreen != mCurBlendState.colorMaskGreen ||
+ blendState.colorMaskBlue != mCurBlendState.colorMaskBlue ||
+ blendState.colorMaskAlpha != mCurBlendState.colorMaskAlpha)
+ {
+ mDirtyBits.set(DIRTY_BIT_COLOR_MASK);
+
+ // The color mask can cause the blend state to get out of sync when using the
+ // zero color mask workaround
+ if (mUsingZeroColorMaskWorkaround)
+ {
+ mDirtyBits.set(DIRTY_BIT_BLEND_ENABLED);
+ mDirtyBits.set(DIRTY_BIT_BLEND_FUNCS_EQUATIONS);
+ }
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_DITHER_ENABLED:
+ if (state.getBlendState().dither != mCurBlendState.dither)
+ {
+ mDirtyBits.set(DIRTY_BIT_DITHER);
+ }
+ break;
+ case gl::State::DIRTY_BIT_BLEND_COLOR:
+ if (state.getBlendColor() != mCurBlendColor)
+ {
+ mDirtyBits.set(DIRTY_BIT_BLEND_COLOR);
+ }
+ break;
+ case gl::State::DIRTY_BIT_CULL_FACE_ENABLED:
+ if (state.getRasterizerState().cullFace != mCurRasterState.cullFace)
+ {
+ mDirtyBits.set(DIRTY_BIT_CULL_MODE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_CULL_FACE:
+ if (state.getRasterizerState().cullMode != mCurRasterState.cullMode)
+ {
+ mDirtyBits.set(DIRTY_BIT_CULL_MODE);
+ }
+ break;
+ case gl::State::DIRTY_BIT_FRONT_FACE:
+ if (state.getRasterizerState().frontFace != mCurRasterState.frontFace)
+ {
+ mDirtyBits.set(DIRTY_BIT_CULL_MODE);
+
+ // Viewport state depends on rasterizer.frontface
+ mDirtyBits.set(DIRTY_BIT_VIEWPORT);
+ }
+ break;
+ case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED:
+ if (state.getRasterizerState().polygonOffsetFill !=
+ mCurRasterState.polygonOffsetFill)
+ {
+ mDirtyBits.set(DIRTY_BIT_DEPTH_BIAS);
+ }
+ break;
+ case gl::State::DIRTY_BIT_POLYGON_OFFSET:
+ {
+ const gl::RasterizerState &rasterizerState = state.getRasterizerState();
+ if (rasterizerState.polygonOffsetFactor != mCurRasterState.polygonOffsetFactor ||
+ rasterizerState.polygonOffsetUnits != mCurRasterState.polygonOffsetUnits)
+ {
+ mDirtyBits.set(DIRTY_BIT_DEPTH_BIAS);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_DEPTH_MASK:
+ if (state.getDepthStencilState().depthMask != mCurDepthStencilState.depthMask)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_DEPTH_MASK);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DEPTH_TEST_ENABLED:
+ if (state.getDepthStencilState().depthTest != mCurDepthStencilState.depthTest)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_DEPTH_FUNC);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DEPTH_FUNC:
+ if (state.getDepthStencilState().depthFunc != mCurDepthStencilState.depthFunc)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_DEPTH_FUNC);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_TEST_ENABLED:
+ if (state.getDepthStencilState().stencilTest != mCurDepthStencilState.stencilTest)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_TEST_ENABLED);
+ // If we enable the stencil test, all of these must be set
+ mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_BACK);
+ mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_FRONT);
+ mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT);
+ mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_BACK);
+ mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_FRONT);
+ mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_BACK);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_FUNCS_FRONT:
+ {
+ const gl::DepthStencilState &depthStencilState = state.getDepthStencilState();
+ if (depthStencilState.stencilFunc != mCurDepthStencilState.stencilFunc ||
+ depthStencilState.stencilMask != mCurDepthStencilState.stencilMask ||
+ state.getStencilRef() != mCurStencilRef)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_STENCIL_FUNCS_BACK:
+ {
+ const gl::DepthStencilState &depthStencilState = state.getDepthStencilState();
+ if (depthStencilState.stencilBackFunc != mCurDepthStencilState.stencilBackFunc ||
+ depthStencilState.stencilBackMask != mCurDepthStencilState.stencilBackMask ||
+ state.getStencilBackRef() != mCurStencilBackRef)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_BACK);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_FRONT:
+ if (state.getDepthStencilState().stencilWritemask !=
+ mCurDepthStencilState.stencilWritemask)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_FRONT);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_WRITEMASK_BACK:
+ if (state.getDepthStencilState().stencilBackWritemask !=
+ mCurDepthStencilState.stencilBackWritemask)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_BACK);
+ }
+ break;
+ case gl::State::DIRTY_BIT_STENCIL_OPS_FRONT:
+ {
+ const gl::DepthStencilState &depthStencilState = state.getDepthStencilState();
+ if (depthStencilState.stencilFail != mCurDepthStencilState.stencilFail ||
+ depthStencilState.stencilPassDepthFail !=
+ mCurDepthStencilState.stencilPassDepthFail ||
+ depthStencilState.stencilPassDepthPass !=
+ mCurDepthStencilState.stencilPassDepthPass)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_FRONT);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_STENCIL_OPS_BACK:
+ {
+ const gl::DepthStencilState &depthStencilState = state.getDepthStencilState();
+ if (depthStencilState.stencilBackFail != mCurDepthStencilState.stencilBackFail ||
+ depthStencilState.stencilBackPassDepthFail !=
+ mCurDepthStencilState.stencilBackPassDepthFail ||
+ depthStencilState.stencilBackPassDepthPass !=
+ mCurDepthStencilState.stencilBackPassDepthPass)
+ {
+ mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_BACK);
+ }
+ break;
+ }
+ case gl::State::DIRTY_BIT_SCISSOR_TEST_ENABLED:
+ if (state.isScissorTestEnabled() != mCurScissorEnabled)
+ {
+ mDirtyBits.set(DIRTY_BIT_SCISSOR_ENABLED);
+ // If scissor is enabled, we have to set the scissor rect
+ mDirtyBits.set(DIRTY_BIT_SCISSOR_RECT);
+ }
+ break;
+ case gl::State::DIRTY_BIT_SCISSOR:
+ if (state.getScissor() != mCurScissorRect)
+ {
+ mDirtyBits.set(DIRTY_BIT_SCISSOR_RECT);
+ }
+ break;
+ case gl::State::DIRTY_BIT_DEPTH_RANGE:
+ mDirtyBits.set(DIRTY_BIT_VIEWPORT);
+ break;
+ case gl::State::DIRTY_BIT_VIEWPORT:
+ if (state.getViewport() != mCurViewport)
+ {
+ mDirtyBits.set(DIRTY_BIT_VIEWPORT);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void StateManager9::setBlendDepthRasterStates(const gl::State &glState, unsigned int sampleMask)
+{
+ const gl::Framebuffer *framebuffer = glState.getDrawFramebuffer();
+
+ const gl::BlendState &blendState = glState.getBlendState();
+ const gl::ColorF &blendColor = glState.getBlendColor();
+ const gl::RasterizerState &rasterState = glState.getRasterizerState();
+
+ const auto &depthStencilState = glState.getDepthStencilState();
+ bool frontFaceCCW = (glState.getRasterizerState().frontFace == GL_CCW);
+ unsigned int maxStencil = (1 << mCurStencilSize) - 1;
+
+ // All the depth stencil states depends on the front face ccw variable
+ if (frontFaceCCW != mCurFrontFaceCCW)
+ {
+ forceSetDepthStencilState();
+ mCurFrontFaceCCW = frontFaceCCW;
+ }
+
+ for (auto dirtyBit : mDirtyBits)
+ {
+ switch (dirtyBit)
+ {
+ case DIRTY_BIT_BLEND_ENABLED:
+ setBlendEnabled(blendState.blend);
+ break;
+ case DIRTY_BIT_BLEND_COLOR:
+ setBlendColor(blendState, blendColor);
+ break;
+ case DIRTY_BIT_BLEND_FUNCS_EQUATIONS:
+ setBlendFuncsEquations(blendState);
+ break;
+ case DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE:
+ setSampleAlphaToCoverage(blendState.sampleAlphaToCoverage);
+ break;
+ case DIRTY_BIT_COLOR_MASK:
+ setColorMask(framebuffer, blendState.colorMaskRed, blendState.colorMaskBlue,
+ blendState.colorMaskGreen, blendState.colorMaskAlpha);
+ break;
+ case DIRTY_BIT_DITHER:
+ setDither(blendState.dither);
+ break;
+ case DIRTY_BIT_CULL_MODE:
+ setCullMode(rasterState.cullFace, rasterState.cullMode, rasterState.frontFace);
+ break;
+ case DIRTY_BIT_DEPTH_BIAS:
+ setDepthBias(rasterState.polygonOffsetFill, rasterState.polygonOffsetFactor,
+ rasterState.polygonOffsetUnits);
+ break;
+ case DIRTY_BIT_STENCIL_DEPTH_MASK:
+ setDepthMask(depthStencilState.depthMask);
+ break;
+ case DIRTY_BIT_STENCIL_DEPTH_FUNC:
+ setDepthFunc(depthStencilState.depthTest, depthStencilState.depthFunc);
+ break;
+ case DIRTY_BIT_STENCIL_TEST_ENABLED:
+ setStencilTestEnabled(depthStencilState.stencilTest);
+ break;
+ case DIRTY_BIT_STENCIL_FUNCS_FRONT:
+ setStencilFuncsFront(depthStencilState.stencilFunc, depthStencilState.stencilMask,
+ glState.getStencilRef(), frontFaceCCW, maxStencil);
+ break;
+ case DIRTY_BIT_STENCIL_FUNCS_BACK:
+ setStencilFuncsBack(depthStencilState.stencilBackFunc,
+ depthStencilState.stencilBackMask, glState.getStencilBackRef(),
+ frontFaceCCW, maxStencil);
+ break;
+ case DIRTY_BIT_STENCIL_WRITEMASK_FRONT:
+ setStencilWriteMask(depthStencilState.stencilWritemask, frontFaceCCW);
+ break;
+ case DIRTY_BIT_STENCIL_WRITEMASK_BACK:
+ setStencilBackWriteMask(depthStencilState.stencilBackWritemask, frontFaceCCW);
+ break;
+ case DIRTY_BIT_STENCIL_OPS_FRONT:
+ setStencilOpsFront(depthStencilState.stencilFail,
+ depthStencilState.stencilPassDepthFail,
+ depthStencilState.stencilPassDepthPass, frontFaceCCW);
+ break;
+ case DIRTY_BIT_STENCIL_OPS_BACK:
+ setStencilOpsBack(depthStencilState.stencilBackFail,
+ depthStencilState.stencilBackPassDepthFail,
+ depthStencilState.stencilBackPassDepthPass, frontFaceCCW);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (sampleMask != mCurSampleMask)
+ {
+ setSampleMask(sampleMask);
+ }
+}
+
+void StateManager9::setViewportState(const gl::Rectangle &viewport,
+ float zNear,
+ float zFar,
+ gl::PrimitiveMode drawMode,
+ GLenum frontFace,
+ bool ignoreViewport)
+{
+ if (!mDirtyBits.test(DIRTY_BIT_VIEWPORT) && mCurIgnoreViewport == ignoreViewport)
+ return;
+
+ gl::Rectangle actualViewport = viewport;
+ float actualZNear = gl::clamp01(zNear);
+ float actualZFar = gl::clamp01(zFar);
+
+ if (ignoreViewport)
+ {
+ actualViewport.x = 0;
+ actualViewport.y = 0;
+ actualViewport.width = static_cast<int>(mRenderTargetBounds.width);
+ actualViewport.height = static_cast<int>(mRenderTargetBounds.height);
+ actualZNear = 0.0f;
+ actualZFar = 1.0f;
+ }
+
+ D3DVIEWPORT9 dxViewport;
+ dxViewport.X = gl::clamp(actualViewport.x, 0, static_cast<int>(mRenderTargetBounds.width));
+ dxViewport.Y = gl::clamp(actualViewport.y, 0, static_cast<int>(mRenderTargetBounds.height));
+ dxViewport.Width =
+ gl::clamp(actualViewport.width, 0,
+ static_cast<int>(mRenderTargetBounds.width) - static_cast<int>(dxViewport.X));
+ dxViewport.Height =
+ gl::clamp(actualViewport.height, 0,
+ static_cast<int>(mRenderTargetBounds.height) - static_cast<int>(dxViewport.Y));
+ dxViewport.MinZ = actualZNear;
+ dxViewport.MaxZ = actualZFar;
+
+ float depthFront = !gl::IsTriangleMode(drawMode) ? 0.0f : (frontFace == GL_CCW ? 1.0f : -1.0f);
+
+ mRenderer9->getDevice()->SetViewport(&dxViewport);
+
+ mCurViewport = actualViewport;
+ mCurNear = actualZNear;
+ mCurFar = actualZFar;
+ mCurDepthFront = depthFront;
+ mCurIgnoreViewport = ignoreViewport;
+
+ // Setting shader constants
+ dx_VertexConstants9 vc = {};
+ dx_PixelConstants9 pc = {};
+
+ vc.viewAdjust[0] =
+ static_cast<float>((actualViewport.width - static_cast<int>(dxViewport.Width)) +
+ 2 * (actualViewport.x - static_cast<int>(dxViewport.X)) - 1) /
+ dxViewport.Width;
+ vc.viewAdjust[1] =
+ static_cast<float>((actualViewport.height - static_cast<int>(dxViewport.Height)) +
+ 2 * (actualViewport.y - static_cast<int>(dxViewport.Y)) - 1) /
+ dxViewport.Height;
+ vc.viewAdjust[2] = static_cast<float>(actualViewport.width) / dxViewport.Width;
+ vc.viewAdjust[3] = static_cast<float>(actualViewport.height) / dxViewport.Height;
+
+ pc.viewCoords[0] = actualViewport.width * 0.5f;
+ pc.viewCoords[1] = actualViewport.height * 0.5f;
+ pc.viewCoords[2] = actualViewport.x + (actualViewport.width * 0.5f);
+ pc.viewCoords[3] = actualViewport.y + (actualViewport.height * 0.5f);
+
+ pc.depthFront[0] = (actualZFar - actualZNear) * 0.5f;
+ pc.depthFront[1] = (actualZNear + actualZFar) * 0.5f;
+ pc.depthFront[2] = depthFront;
+
+ vc.depthRange[0] = actualZNear;
+ vc.depthRange[1] = actualZFar;
+ vc.depthRange[2] = actualZFar - actualZNear;
+
+ pc.depthRange[0] = actualZNear;
+ pc.depthRange[1] = actualZFar;
+ pc.depthRange[2] = actualZFar - actualZNear;
+
+ if (memcmp(&vc, &mVertexConstants, sizeof(dx_VertexConstants9)) != 0)
+ {
+ mVertexConstants = vc;
+ mDxUniformsDirty = true;
+ }
+
+ if (memcmp(&pc, &mPixelConstants, sizeof(dx_PixelConstants9)) != 0)
+ {
+ mPixelConstants = pc;
+ mDxUniformsDirty = true;
+ }
+
+ mForceSetViewport = false;
+}
+
+void StateManager9::setShaderConstants()
+{
+ if (!mDxUniformsDirty)
+ return;
+
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetVertexShaderConstantF(0, reinterpret_cast<float *>(&mVertexConstants),
+ sizeof(dx_VertexConstants9) / sizeof(float[4]));
+ device->SetPixelShaderConstantF(0, reinterpret_cast<float *>(&mPixelConstants),
+ sizeof(dx_PixelConstants9) / sizeof(float[4]));
+ mDxUniformsDirty = false;
+}
+
+// This is separate from the main state loop because other functions
+// outside call only setScissorState to update scissor state
+void StateManager9::setScissorState(const gl::Rectangle &scissor, bool enabled)
+{
+ if (mDirtyBits.test(DIRTY_BIT_SCISSOR_ENABLED))
+ setScissorEnabled(enabled);
+
+ if (mDirtyBits.test(DIRTY_BIT_SCISSOR_RECT))
+ setScissorRect(scissor, enabled);
+}
+
+void StateManager9::setRenderTargetBounds(size_t width, size_t height)
+{
+ mRenderTargetBounds.width = (int)width;
+ mRenderTargetBounds.height = (int)height;
+ forceSetViewportState();
+}
+
+void StateManager9::setScissorEnabled(bool scissorEnabled)
+{
+ mRenderer9->getDevice()->SetRenderState(D3DRS_SCISSORTESTENABLE, scissorEnabled ? TRUE : FALSE);
+ mCurScissorEnabled = scissorEnabled;
+}
+
+void StateManager9::setScissorRect(const gl::Rectangle &scissor, bool enabled)
+{
+ if (!enabled)
+ return;
+
+ RECT rect;
+ rect.left = gl::clamp(scissor.x, 0, static_cast<int>(mRenderTargetBounds.width));
+ rect.top = gl::clamp(scissor.y, 0, static_cast<int>(mRenderTargetBounds.height));
+ rect.right =
+ gl::clamp(scissor.x + scissor.width, 0, static_cast<int>(mRenderTargetBounds.width));
+ rect.bottom =
+ gl::clamp(scissor.y + scissor.height, 0, static_cast<int>(mRenderTargetBounds.height));
+ mRenderer9->getDevice()->SetScissorRect(&rect);
+}
+
+void StateManager9::setDepthFunc(bool depthTest, GLenum depthFunc)
+{
+ if (depthTest)
+ {
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
+ device->SetRenderState(D3DRS_ZFUNC, gl_d3d9::ConvertComparison(depthFunc));
+ }
+ else
+ {
+ mRenderer9->getDevice()->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
+ }
+
+ mCurDepthStencilState.depthTest = depthTest;
+ mCurDepthStencilState.depthFunc = depthFunc;
+}
+
+void StateManager9::setStencilOpsFront(GLenum stencilFail,
+ GLenum stencilPassDepthFail,
+ GLenum stencilPassDepthPass,
+ bool frontFaceCCW)
+{
+ // TODO(dianx) It may be slightly more efficient todo these and other similar areas
+ // with separate dirty bits.
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetRenderState(frontFaceCCW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL,
+ gl_d3d9::ConvertStencilOp(stencilFail));
+ device->SetRenderState(frontFaceCCW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL,
+ gl_d3d9::ConvertStencilOp(stencilPassDepthFail));
+ device->SetRenderState(frontFaceCCW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS,
+ gl_d3d9::ConvertStencilOp(stencilPassDepthPass));
+
+ mCurDepthStencilState.stencilFail = stencilFail;
+ mCurDepthStencilState.stencilPassDepthFail = stencilPassDepthFail;
+ mCurDepthStencilState.stencilPassDepthPass = stencilPassDepthPass;
+}
+
+void StateManager9::setStencilOpsBack(GLenum stencilBackFail,
+ GLenum stencilBackPassDepthFail,
+ GLenum stencilBackPassDepthPass,
+ bool frontFaceCCW)
+{
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetRenderState(!frontFaceCCW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL,
+ gl_d3d9::ConvertStencilOp(stencilBackFail));
+ device->SetRenderState(!frontFaceCCW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL,
+ gl_d3d9::ConvertStencilOp(stencilBackPassDepthFail));
+ device->SetRenderState(!frontFaceCCW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS,
+ gl_d3d9::ConvertStencilOp(stencilBackPassDepthPass));
+
+ mCurDepthStencilState.stencilBackFail = stencilBackFail;
+ mCurDepthStencilState.stencilBackPassDepthFail = stencilBackPassDepthFail;
+ mCurDepthStencilState.stencilBackPassDepthPass = stencilBackPassDepthPass;
+}
+
+void StateManager9::setStencilBackWriteMask(GLuint stencilBackWriteMask, bool frontFaceCCW)
+{
+ mRenderer9->getDevice()->SetRenderState(
+ !frontFaceCCW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK, stencilBackWriteMask);
+
+ mCurDepthStencilState.stencilBackWritemask = stencilBackWriteMask;
+}
+
+void StateManager9::setStencilFuncsBack(GLenum stencilBackFunc,
+ GLuint stencilBackMask,
+ GLint stencilBackRef,
+ bool frontFaceCCW,
+ unsigned int maxStencil)
+{
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetRenderState(!frontFaceCCW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC,
+ gl_d3d9::ConvertComparison(stencilBackFunc));
+ device->SetRenderState(!frontFaceCCW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF,
+ (stencilBackRef < (int)maxStencil) ? stencilBackRef : maxStencil);
+ device->SetRenderState(!frontFaceCCW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK,
+ stencilBackMask);
+
+ mCurDepthStencilState.stencilBackFunc = stencilBackFunc;
+ mCurStencilBackRef = stencilBackRef;
+ mCurDepthStencilState.stencilBackMask = stencilBackMask;
+}
+
+void StateManager9::setStencilWriteMask(GLuint stencilWriteMask, bool frontFaceCCW)
+{
+ mRenderer9->getDevice()->SetRenderState(
+ frontFaceCCW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK, stencilWriteMask);
+ mCurDepthStencilState.stencilWritemask = stencilWriteMask;
+}
+
+void StateManager9::setStencilFuncsFront(GLenum stencilFunc,
+ GLuint stencilMask,
+ GLint stencilRef,
+ bool frontFaceCCW,
+ unsigned int maxStencil)
+{
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetRenderState(frontFaceCCW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC,
+ gl_d3d9::ConvertComparison(stencilFunc));
+ device->SetRenderState(frontFaceCCW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF,
+ (stencilRef < static_cast<int>(maxStencil)) ? stencilRef : maxStencil);
+ device->SetRenderState(frontFaceCCW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK, stencilMask);
+
+ mCurDepthStencilState.stencilFunc = stencilFunc;
+ mCurStencilRef = stencilRef;
+ mCurDepthStencilState.stencilMask = stencilMask;
+}
+void StateManager9::setStencilTestEnabled(bool stencilTestEnabled)
+{
+ if (stencilTestEnabled && mCurStencilSize > 0)
+ {
+ mRenderer9->getDevice()->SetRenderState(D3DRS_STENCILENABLE, TRUE);
+ mRenderer9->getDevice()->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, TRUE);
+ }
+ else
+ {
+ mRenderer9->getDevice()->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ }
+
+ mCurDepthStencilState.stencilTest = stencilTestEnabled;
+}
+
+void StateManager9::setDepthMask(bool depthMask)
+{
+ mRenderer9->getDevice()->SetRenderState(D3DRS_ZWRITEENABLE, depthMask ? TRUE : FALSE);
+ mCurDepthStencilState.depthMask = depthMask;
+}
+
+// TODO(dianx) one bit for sampleAlphaToCoverage
+void StateManager9::setSampleAlphaToCoverage(bool enabled)
+{
+ if (enabled)
+ {
+ UNREACHABLE();
+ }
+}
+
+void StateManager9::setBlendColor(const gl::BlendState &blendState, const gl::ColorF &blendColor)
+{
+ if (!blendState.blend)
+ return;
+
+ if (blendState.sourceBlendRGB != GL_CONSTANT_ALPHA &&
+ blendState.sourceBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA &&
+ blendState.destBlendRGB != GL_CONSTANT_ALPHA &&
+ blendState.destBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA)
+ {
+ mRenderer9->getDevice()->SetRenderState(D3DRS_BLENDFACTOR,
+ gl_d3d9::ConvertColor(blendColor));
+ }
+ else
+ {
+ mRenderer9->getDevice()->SetRenderState(
+ D3DRS_BLENDFACTOR,
+ D3DCOLOR_RGBA(gl::unorm<8>(blendColor.alpha), gl::unorm<8>(blendColor.alpha),
+ gl::unorm<8>(blendColor.alpha), gl::unorm<8>(blendColor.alpha)));
+ }
+ mCurBlendColor = blendColor;
+}
+
+void StateManager9::setBlendFuncsEquations(const gl::BlendState &blendState)
+{
+ if (!blendState.blend)
+ return;
+
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+
+ device->SetRenderState(D3DRS_SRCBLEND, gl_d3d9::ConvertBlendFunc(blendState.sourceBlendRGB));
+ device->SetRenderState(D3DRS_DESTBLEND, gl_d3d9::ConvertBlendFunc(blendState.destBlendRGB));
+ device->SetRenderState(D3DRS_BLENDOP, gl_d3d9::ConvertBlendOp(blendState.blendEquationRGB));
+
+ if (blendState.sourceBlendRGB != blendState.sourceBlendAlpha ||
+ blendState.destBlendRGB != blendState.destBlendAlpha ||
+ blendState.blendEquationRGB != blendState.blendEquationAlpha)
+ {
+ device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+
+ device->SetRenderState(D3DRS_SRCBLENDALPHA,
+ gl_d3d9::ConvertBlendFunc(blendState.sourceBlendAlpha));
+ device->SetRenderState(D3DRS_DESTBLENDALPHA,
+ gl_d3d9::ConvertBlendFunc(blendState.destBlendAlpha));
+ device->SetRenderState(D3DRS_BLENDOPALPHA,
+ gl_d3d9::ConvertBlendOp(blendState.blendEquationAlpha));
+ }
+ else
+ {
+ device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
+ }
+
+ mCurBlendState.sourceBlendRGB = blendState.sourceBlendRGB;
+ mCurBlendState.destBlendRGB = blendState.destBlendRGB;
+ mCurBlendState.blendEquationRGB = blendState.blendEquationRGB;
+ mCurBlendState.blendEquationAlpha = blendState.blendEquationAlpha;
+}
+
+void StateManager9::setBlendEnabled(bool enabled)
+{
+ mRenderer9->getDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, enabled ? TRUE : FALSE);
+ mCurBlendState.blend = enabled;
+}
+
+void StateManager9::setDither(bool dither)
+{
+ mRenderer9->getDevice()->SetRenderState(D3DRS_DITHERENABLE, dither ? TRUE : FALSE);
+ mCurBlendState.dither = dither;
+}
+
+// TODO(dianx) one bit for color mask
+void StateManager9::setColorMask(const gl::Framebuffer *framebuffer,
+ bool red,
+ bool blue,
+ bool green,
+ bool alpha)
+{
+ // Set the color mask
+
+ const auto *attachment = framebuffer->getFirstColorAttachment();
+ const auto &format = attachment ? attachment->getFormat() : gl::Format::Invalid();
+
+ DWORD colorMask = gl_d3d9::ConvertColorMask(
+ format.info->redBits > 0 && red, format.info->greenBits > 0 && green,
+ format.info->blueBits > 0 && blue, format.info->alphaBits > 0 && alpha);
+
+ // Apparently some ATI cards have a bug where a draw with a zero color write mask can cause
+ // later draws to have incorrect results. Instead, set a nonzero color write mask but modify the
+ // blend state so that no drawing is done.
+ // http://anglebug.com/169
+ if (colorMask == 0 && mUsingZeroColorMaskWorkaround)
+ {
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ // Enable green channel, but set blending so nothing will be drawn.
+ device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_GREEN);
+
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+
+ device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
+ device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
+ device->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
+
+ mCurBlendState.colorMaskRed = false;
+ mCurBlendState.colorMaskGreen = true;
+ mCurBlendState.colorMaskBlue = false;
+ mCurBlendState.colorMaskAlpha = false;
+
+ mCurBlendState.blend = true;
+ mCurBlendState.sourceBlendRGB = GL_ZERO;
+ mCurBlendState.sourceBlendAlpha = GL_ZERO;
+ mCurBlendState.destBlendRGB = GL_ONE;
+ mCurBlendState.destBlendAlpha = GL_ONE;
+ mCurBlendState.blendEquationRGB = GL_FUNC_ADD;
+ mCurBlendState.blendEquationAlpha = GL_FUNC_ADD;
+ }
+ else
+ {
+ mRenderer9->getDevice()->SetRenderState(D3DRS_COLORWRITEENABLE, colorMask);
+
+ mCurBlendState.colorMaskRed = red;
+ mCurBlendState.colorMaskGreen = green;
+ mCurBlendState.colorMaskBlue = blue;
+ mCurBlendState.colorMaskAlpha = alpha;
+ }
+}
+
+void StateManager9::setSampleMask(unsigned int sampleMask)
+{
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ // Set the multisample mask
+ device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
+ device->SetRenderState(D3DRS_MULTISAMPLEMASK, static_cast<DWORD>(sampleMask));
+
+ mCurSampleMask = sampleMask;
+}
+
+void StateManager9::setCullMode(bool cullFace, gl::CullFaceMode cullMode, GLenum frontFace)
+{
+ if (cullFace)
+ {
+ mRenderer9->getDevice()->SetRenderState(D3DRS_CULLMODE,
+ gl_d3d9::ConvertCullMode(cullMode, frontFace));
+ }
+ else
+ {
+ mRenderer9->getDevice()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ }
+
+ mCurRasterState.cullFace = cullFace;
+ mCurRasterState.cullMode = cullMode;
+ mCurRasterState.frontFace = frontFace;
+}
+
+void StateManager9::setDepthBias(bool polygonOffsetFill,
+ GLfloat polygonOffsetFactor,
+ GLfloat polygonOffsetUnits)
+{
+ if (polygonOffsetFill)
+ {
+ if (mCurDepthSize > 0)
+ {
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD *)&polygonOffsetFactor);
+
+ float depthBias = ldexp(polygonOffsetUnits, -static_cast<int>(mCurDepthSize));
+ device->SetRenderState(D3DRS_DEPTHBIAS, *(DWORD *)&depthBias);
+ }
+ }
+ else
+ {
+ IDirect3DDevice9 *device = mRenderer9->getDevice();
+ device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, 0);
+ device->SetRenderState(D3DRS_DEPTHBIAS, 0);
+ }
+
+ mCurRasterState.polygonOffsetFill = polygonOffsetFill;
+ mCurRasterState.polygonOffsetFactor = polygonOffsetFactor;
+ mCurRasterState.polygonOffsetUnits = polygonOffsetUnits;
+}
+
+void StateManager9::updateDepthSizeIfChanged(bool depthStencilInitialized, unsigned int depthSize)
+{
+ if (!depthStencilInitialized || depthSize != mCurDepthSize)
+ {
+ mCurDepthSize = depthSize;
+ forceSetRasterState();
+ }
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.h
new file mode 100644
index 0000000000..2457303731
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.h
@@ -0,0 +1,209 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// StateManager9.h: Defines a class for caching D3D9 state
+
+#ifndef LIBANGLE_RENDERER_D3D9_STATEMANAGER9_H_
+#define LIBANGLE_RENDERER_D3D9_STATEMANAGER9_H_
+
+#include "libANGLE/State.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/renderer/d3d/RendererD3D.h"
+
+namespace rx
+{
+
+class Renderer9;
+
+struct dx_VertexConstants9
+{
+ float depthRange[4];
+ float viewAdjust[4];
+ float viewCoords[4];
+};
+
+struct dx_PixelConstants9
+{
+ float depthRange[4];
+ float viewCoords[4];
+ float depthFront[4];
+};
+
+class StateManager9 final : angle::NonCopyable
+{
+ public:
+ StateManager9(Renderer9 *renderer9);
+ ~StateManager9();
+
+ void initialize();
+
+ void syncState(const gl::State &state, const gl::State::DirtyBits &dirtyBits);
+
+ void setBlendDepthRasterStates(const gl::State &glState, unsigned int sampleMask);
+ void setScissorState(const gl::Rectangle &scissor, bool enabled);
+ void setViewportState(const gl::Rectangle &viewport,
+ float zNear,
+ float zFar,
+ gl::PrimitiveMode drawMode,
+ GLenum frontFace,
+ bool ignoreViewport);
+
+ void setShaderConstants();
+
+ void forceSetBlendState();
+ void forceSetRasterState();
+ void forceSetDepthStencilState();
+ void forceSetScissorState();
+ void forceSetViewportState();
+ void forceSetDXUniformsState();
+
+ void updateDepthSizeIfChanged(bool depthStencilInitialized, unsigned int depthSize);
+ void updateStencilSizeIfChanged(bool depthStencilInitialized, unsigned int stencilSize);
+
+ void setRenderTargetBounds(size_t width, size_t height);
+
+ int getRenderTargetWidth() const { return mRenderTargetBounds.width; }
+ int getRenderTargetHeight() const { return mRenderTargetBounds.height; }
+
+ void setAllDirtyBits() { mDirtyBits.set(); }
+ void resetDirtyBits() { mDirtyBits.reset(); }
+
+ private:
+ // Blend state functions
+ void setBlendEnabled(bool enabled);
+ void setBlendColor(const gl::BlendState &blendState, const gl::ColorF &blendColor);
+ void setBlendFuncsEquations(const gl::BlendState &blendState);
+ void setColorMask(const gl::Framebuffer *framebuffer,
+ bool red,
+ bool blue,
+ bool green,
+ bool alpha);
+ void setSampleAlphaToCoverage(bool enabled);
+ void setDither(bool dither);
+ void setSampleMask(unsigned int sampleMask);
+
+ // Current raster state functions
+ void setCullMode(bool cullFace, gl::CullFaceMode cullMode, GLenum frontFace);
+ void setDepthBias(bool polygonOffsetFill,
+ GLfloat polygonOffsetFactor,
+ GLfloat polygonOffsetUnits);
+
+ // Depth stencil state functions
+ void setStencilOpsFront(GLenum stencilFail,
+ GLenum stencilPassDepthFail,
+ GLenum stencilPassDepthPass,
+ bool frontFaceCCW);
+ void setStencilOpsBack(GLenum stencilBackFail,
+ GLenum stencilBackPassDepthFail,
+ GLenum stencilBackPassDepthPass,
+ bool frontFaceCCW);
+ void setStencilBackWriteMask(GLuint stencilBackWriteMask, bool frontFaceCCW);
+ void setDepthFunc(bool depthTest, GLenum depthFunc);
+ void setStencilTestEnabled(bool enabled);
+ void setDepthMask(bool depthMask);
+ void setStencilFuncsFront(GLenum stencilFunc,
+ GLuint stencilMask,
+ GLint stencilRef,
+ bool frontFaceCCW,
+ unsigned int maxStencil);
+ void setStencilFuncsBack(GLenum stencilBackFunc,
+ GLuint stencilBackMask,
+ GLint stencilBackRef,
+ bool frontFaceCCW,
+ unsigned int maxStencil);
+ void setStencilWriteMask(GLuint stencilWriteMask, bool frontFaceCCW);
+
+ void setScissorEnabled(bool scissorEnabled);
+ void setScissorRect(const gl::Rectangle &scissor, bool enabled);
+
+ enum DirtyBitType
+ {
+ // Blend dirty bits
+ DIRTY_BIT_BLEND_ENABLED,
+ DIRTY_BIT_BLEND_COLOR,
+ DIRTY_BIT_BLEND_FUNCS_EQUATIONS,
+ DIRTY_BIT_SAMPLE_ALPHA_TO_COVERAGE,
+ DIRTY_BIT_COLOR_MASK,
+ DIRTY_BIT_DITHER,
+ DIRTY_BIT_SAMPLE_MASK,
+
+ // Rasterizer dirty bits
+ DIRTY_BIT_CULL_MODE,
+ DIRTY_BIT_DEPTH_BIAS,
+
+ // Depth stencil dirty bits
+ DIRTY_BIT_STENCIL_DEPTH_MASK,
+ DIRTY_BIT_STENCIL_DEPTH_FUNC,
+ DIRTY_BIT_STENCIL_TEST_ENABLED,
+ DIRTY_BIT_STENCIL_FUNCS_FRONT,
+ DIRTY_BIT_STENCIL_FUNCS_BACK,
+ DIRTY_BIT_STENCIL_WRITEMASK_FRONT,
+ DIRTY_BIT_STENCIL_WRITEMASK_BACK,
+ DIRTY_BIT_STENCIL_OPS_FRONT,
+ DIRTY_BIT_STENCIL_OPS_BACK,
+
+ // Scissor dirty bits
+ DIRTY_BIT_SCISSOR_ENABLED,
+ DIRTY_BIT_SCISSOR_RECT,
+
+ // Viewport dirty bits
+ DIRTY_BIT_VIEWPORT,
+
+ DIRTY_BIT_MAX
+ };
+
+ using DirtyBits = angle::BitSet<DIRTY_BIT_MAX>;
+
+ bool mUsingZeroColorMaskWorkaround;
+
+ // Currently applied blend state
+ gl::BlendState mCurBlendState;
+ gl::ColorF mCurBlendColor;
+ unsigned int mCurSampleMask;
+ DirtyBits mBlendStateDirtyBits;
+
+ // Currently applied raster state
+ gl::RasterizerState mCurRasterState;
+ unsigned int mCurDepthSize;
+ DirtyBits mRasterizerStateDirtyBits;
+
+ // Currently applied depth stencil state
+ gl::DepthStencilState mCurDepthStencilState;
+ int mCurStencilRef;
+ int mCurStencilBackRef;
+ bool mCurFrontFaceCCW;
+ unsigned int mCurStencilSize;
+ DirtyBits mDepthStencilStateDirtyBits;
+
+ // Currently applied scissor states
+ gl::Rectangle mCurScissorRect;
+ bool mCurScissorEnabled;
+ gl::Extents mRenderTargetBounds;
+ DirtyBits mScissorStateDirtyBits;
+
+ // Currently applied viewport states
+ bool mForceSetViewport;
+ gl::Rectangle mCurViewport;
+ float mCurNear;
+ float mCurFar;
+ float mCurDepthFront;
+ bool mCurIgnoreViewport;
+
+ dx_VertexConstants9 mVertexConstants;
+ dx_PixelConstants9 mPixelConstants;
+ bool mDxUniformsDirty;
+
+ // FIXME: Unsupported by D3D9
+ static const D3DRENDERSTATETYPE D3DRS_CCW_STENCILREF = D3DRS_STENCILREF;
+ static const D3DRENDERSTATETYPE D3DRS_CCW_STENCILMASK = D3DRS_STENCILMASK;
+ static const D3DRENDERSTATETYPE D3DRS_CCW_STENCILWRITEMASK = D3DRS_STENCILWRITEMASK;
+
+ Renderer9 *mRenderer9;
+ DirtyBits mDirtyBits;
+};
+
+} // namespace rx
+#endif // LIBANGLE_RENDERER_D3D9_STATEMANAGER9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
new file mode 100644
index 0000000000..bb6e7a186e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
@@ -0,0 +1,472 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SwapChain9.cpp: Implements a back-end specific class for the D3D9 swap chain.
+
+#include "libANGLE/renderer/d3d/d3d9/SwapChain9.h"
+
+#include "libANGLE/features.h"
+#include "libANGLE/renderer/d3d/d3d9/NativeWindow9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace rx
+{
+
+SwapChain9::SwapChain9(Renderer9 *renderer,
+ NativeWindow9 *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation)
+ : SwapChainD3D(shareHandle, d3dTexture, backBufferFormat, depthBufferFormat),
+ mRenderer(renderer),
+ mWidth(-1),
+ mHeight(-1),
+ mSwapInterval(-1),
+ mNativeWindow(nativeWindow),
+ mSwapChain(nullptr),
+ mBackBuffer(nullptr),
+ mRenderTarget(nullptr),
+ mDepthStencil(nullptr),
+ mOffscreenTexture(nullptr),
+ mColorRenderTarget(this, false),
+ mDepthStencilRenderTarget(this, true)
+{
+ ASSERT(orientation == 0);
+}
+
+SwapChain9::~SwapChain9()
+{
+ release();
+}
+
+void SwapChain9::release()
+{
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBuffer);
+ SafeRelease(mDepthStencil);
+ SafeRelease(mRenderTarget);
+ SafeRelease(mOffscreenTexture);
+
+ if (mNativeWindow->getNativeWindow())
+ {
+ mShareHandle = nullptr;
+ }
+}
+
+static DWORD convertInterval(EGLint interval)
+{
+#if ANGLE_VSYNC == ANGLE_DISABLED
+ return D3DPRESENT_INTERVAL_IMMEDIATE;
+#else
+ switch (interval)
+ {
+ case 0:
+ return D3DPRESENT_INTERVAL_IMMEDIATE;
+ case 1:
+ return D3DPRESENT_INTERVAL_ONE;
+ case 2:
+ return D3DPRESENT_INTERVAL_TWO;
+ case 3:
+ return D3DPRESENT_INTERVAL_THREE;
+ case 4:
+ return D3DPRESENT_INTERVAL_FOUR;
+ default:
+ UNREACHABLE();
+ }
+
+ return D3DPRESENT_INTERVAL_DEFAULT;
+#endif
+}
+
+EGLint SwapChain9::resize(DisplayD3D *displayD3D, int backbufferWidth, int backbufferHeight)
+{
+ // D3D9 does not support resizing swap chains without recreating them
+ return reset(displayD3D, backbufferWidth, backbufferHeight, mSwapInterval);
+}
+
+EGLint SwapChain9::reset(DisplayD3D *displayD3D,
+ int backbufferWidth,
+ int backbufferHeight,
+ EGLint swapInterval)
+{
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ if (device == nullptr)
+ {
+ return EGL_BAD_ACCESS;
+ }
+
+ // Evict all non-render target textures to system memory and release all resources
+ // before reallocating them to free up as much video memory as possible.
+ device->EvictManagedResources();
+
+ HRESULT result;
+
+ // Release specific resources to free up memory for the new render target, while the
+ // old render target still exists for the purpose of preserving its contents.
+ SafeRelease(mSwapChain);
+ SafeRelease(mBackBuffer);
+ SafeRelease(mOffscreenTexture);
+ SafeRelease(mDepthStencil);
+
+ const d3d9::TextureFormat &backBufferd3dFormatInfo =
+ d3d9::GetTextureFormatInfo(mOffscreenRenderTargetFormat);
+ if (mD3DTexture != nullptr)
+ {
+ result = mD3DTexture->QueryInterface(&mOffscreenTexture);
+ ASSERT(SUCCEEDED(result));
+ }
+ else
+ {
+ HANDLE *pShareHandle = nullptr;
+ if (!mNativeWindow->getNativeWindow() && mRenderer->getShareHandleSupport())
+ {
+ pShareHandle = &mShareHandle;
+ }
+
+ result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
+ backBufferd3dFormatInfo.texFormat, D3DPOOL_DEFAULT,
+ &mOffscreenTexture, pShareHandle);
+ if (FAILED(result))
+ {
+ ERR() << "Could not create offscreen texture, " << gl::FmtHR(result);
+ release();
+
+ if (d3d9::isDeviceLostError(result))
+ {
+ return EGL_CONTEXT_LOST;
+ }
+ else
+ {
+ return EGL_BAD_ALLOC;
+ }
+ }
+ }
+
+ IDirect3DSurface9 *oldRenderTarget = mRenderTarget;
+
+ result = mOffscreenTexture->GetSurfaceLevel(0, &mRenderTarget);
+ ASSERT(SUCCEEDED(result));
+
+ if (oldRenderTarget)
+ {
+ RECT rect = {0, 0, mWidth, mHeight};
+
+ if (rect.right > static_cast<LONG>(backbufferWidth))
+ {
+ rect.right = backbufferWidth;
+ }
+
+ if (rect.bottom > static_cast<LONG>(backbufferHeight))
+ {
+ rect.bottom = backbufferHeight;
+ }
+
+ mRenderer->endScene();
+
+ result = device->StretchRect(oldRenderTarget, &rect, mRenderTarget, &rect, D3DTEXF_NONE);
+ ASSERT(SUCCEEDED(result));
+
+ SafeRelease(oldRenderTarget);
+ }
+
+ const d3d9::TextureFormat &depthBufferd3dFormatInfo =
+ d3d9::GetTextureFormatInfo(mDepthBufferFormat);
+
+ // Don't create a swapchain for NULLREF devices
+ D3DDEVTYPE deviceType = mRenderer->getD3D9DeviceType();
+ EGLNativeWindowType window = mNativeWindow->getNativeWindow();
+ if (window && deviceType != D3DDEVTYPE_NULLREF)
+ {
+ D3DPRESENT_PARAMETERS presentParameters = {0};
+ presentParameters.AutoDepthStencilFormat = depthBufferd3dFormatInfo.renderFormat;
+ presentParameters.BackBufferCount = 1;
+ presentParameters.BackBufferFormat = backBufferd3dFormatInfo.renderFormat;
+ presentParameters.EnableAutoDepthStencil = FALSE;
+ presentParameters.Flags = 0;
+ presentParameters.hDeviceWindow = window;
+ presentParameters.MultiSampleQuality = 0; // FIXME: Unimplemented
+ presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE; // FIXME: Unimplemented
+ presentParameters.PresentationInterval = convertInterval(swapInterval);
+ presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ presentParameters.Windowed = TRUE;
+ presentParameters.BackBufferWidth = backbufferWidth;
+ presentParameters.BackBufferHeight = backbufferHeight;
+
+ // http://crbug.com/140239
+ // http://crbug.com/143434
+ //
+ // Some AMD/Intel switchable systems / drivers appear to round swap chain surfaces to a
+ // multiple of 64 pixels in width when using the integrated Intel. This rounds the width up
+ // rather than down.
+ //
+ // Some non-switchable AMD GPUs / drivers do not respect the source rectangle to Present.
+ // Therefore, when the vendor ID is not Intel, the back buffer width must be exactly the
+ // same width as the window or horizontal scaling will occur.
+ if (IsIntel(mRenderer->getVendorId()))
+ {
+ presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64;
+ }
+
+ result = device->CreateAdditionalSwapChain(&presentParameters, &mSwapChain);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY ||
+ result == D3DERR_INVALIDCALL || result == D3DERR_DEVICELOST);
+
+ ERR() << "Could not create additional swap chains or offscreen surfaces, "
+ << gl::FmtHR(result);
+ release();
+
+ if (d3d9::isDeviceLostError(result))
+ {
+ return EGL_CONTEXT_LOST;
+ }
+ else
+ {
+ return EGL_BAD_ALLOC;
+ }
+ }
+
+ result = mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
+ ASSERT(SUCCEEDED(result));
+ InvalidateRect(window, nullptr, FALSE);
+ }
+
+ if (mDepthBufferFormat != GL_NONE)
+ {
+ result = device->CreateDepthStencilSurface(
+ backbufferWidth, backbufferHeight, depthBufferd3dFormatInfo.renderFormat,
+ D3DMULTISAMPLE_NONE, 0, FALSE, &mDepthStencil, nullptr);
+
+ if (FAILED(result))
+ {
+ ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY ||
+ result == D3DERR_INVALIDCALL);
+
+ ERR() << "Could not create depthstencil surface for new swap chain, "
+ << gl::FmtHR(result);
+ release();
+
+ if (d3d9::isDeviceLostError(result))
+ {
+ return EGL_CONTEXT_LOST;
+ }
+ else
+ {
+ return EGL_BAD_ALLOC;
+ }
+ }
+ }
+
+ mWidth = backbufferWidth;
+ mHeight = backbufferHeight;
+ mSwapInterval = swapInterval;
+
+ return EGL_SUCCESS;
+}
+
+// parameters should be validated/clamped by caller
+EGLint SwapChain9::swapRect(DisplayD3D *displayD3D, EGLint x, EGLint y, EGLint width, EGLint height)
+{
+ if (!mSwapChain)
+ {
+ return EGL_SUCCESS;
+ }
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+
+ // Disable all pipeline operations
+ device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
+ device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+ device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+ device->SetRenderState(D3DRS_COLORWRITEENABLE,
+ D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE |
+ D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
+ device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
+ device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ device->SetPixelShader(nullptr);
+ device->SetVertexShader(nullptr);
+
+ device->SetRenderTarget(0, mBackBuffer);
+ device->SetDepthStencilSurface(nullptr);
+
+ device->SetTexture(0, mOffscreenTexture);
+ device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
+ device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+ device->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
+
+ for (UINT streamIndex = 0; streamIndex < gl::MAX_VERTEX_ATTRIBS; streamIndex++)
+ {
+ device->SetStreamSourceFreq(streamIndex, 1);
+ }
+
+ D3DVIEWPORT9 viewport = {0, 0, static_cast<DWORD>(mWidth), static_cast<DWORD>(mHeight),
+ 0.0f, 1.0f};
+ device->SetViewport(&viewport);
+
+ float x1 = x - 0.5f;
+ float y1 = (mHeight - y - height) - 0.5f;
+ float x2 = (x + width) - 0.5f;
+ float y2 = (mHeight - y) - 0.5f;
+
+ float u1 = x / float(mWidth);
+ float v1 = y / float(mHeight);
+ float u2 = (x + width) / float(mWidth);
+ float v2 = (y + height) / float(mHeight);
+
+ float quad[4][6] = {{x1, y1, 0.0f, 1.0f, u1, v2},
+ {x2, y1, 0.0f, 1.0f, u2, v2},
+ {x2, y2, 0.0f, 1.0f, u2, v1},
+ {x1, y2, 0.0f, 1.0f, u1, v1}}; // x, y, z, rhw, u, v
+
+ mRenderer->startScene();
+ device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, 6 * sizeof(float));
+ mRenderer->endScene();
+
+ device->SetTexture(0, nullptr);
+
+ RECT rect = {static_cast<LONG>(x), static_cast<LONG>(mHeight - y - height),
+ static_cast<LONG>(x + width), static_cast<LONG>(mHeight - y)};
+
+ HRESULT result = mSwapChain->Present(&rect, &rect, nullptr, nullptr, 0);
+
+ mRenderer->markAllStateDirty();
+
+ if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY ||
+ result == D3DERR_DRIVERINTERNALERROR)
+ {
+ return EGL_BAD_ALLOC;
+ }
+
+ // On Windows 8 systems, IDirect3DSwapChain9::Present sometimes returns 0x88760873 when the
+ // windows is in the process of entering/exiting fullscreen. This code doesn't seem to have any
+ // documentation. The device appears to be ok after emitting this error so simply return a
+ // failure to swap.
+ if (result == static_cast<HRESULT>(0x88760873) || result == static_cast<HRESULT>(0x88760872))
+ {
+ return EGL_BAD_MATCH;
+ }
+
+ // http://crbug.com/313210
+ // If our swap failed, trigger a device lost event. Resetting will work around an AMD-specific
+ // device removed bug with lost contexts when reinstalling drivers.
+ if (FAILED(result))
+ {
+ mRenderer->notifyDeviceLost();
+ return EGL_CONTEXT_LOST;
+ }
+
+ return EGL_SUCCESS;
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+// TODO: remove the AddRef to match SwapChain11
+IDirect3DSurface9 *SwapChain9::getRenderTarget()
+{
+ if (mRenderTarget)
+ {
+ mRenderTarget->AddRef();
+ }
+
+ return mRenderTarget;
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+// TODO: remove the AddRef to match SwapChain11
+IDirect3DSurface9 *SwapChain9::getDepthStencil()
+{
+ if (mDepthStencil)
+ {
+ mDepthStencil->AddRef();
+ }
+
+ return mDepthStencil;
+}
+
+// Increments refcount on texture.
+// caller must Release() the returned texture
+// TODO: remove the AddRef to match SwapChain11
+IDirect3DTexture9 *SwapChain9::getOffscreenTexture()
+{
+ if (mOffscreenTexture)
+ {
+ mOffscreenTexture->AddRef();
+ }
+
+ return mOffscreenTexture;
+}
+
+void *SwapChain9::getKeyedMutex()
+{
+ UNREACHABLE();
+ return nullptr;
+}
+
+egl::Error SwapChain9::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
+{
+ UNREACHABLE();
+ return egl::EglBadSurface();
+}
+
+void SwapChain9::recreate()
+{
+ if (!mSwapChain)
+ {
+ return;
+ }
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+ if (device == nullptr)
+ {
+ return;
+ }
+
+ D3DPRESENT_PARAMETERS presentParameters;
+ HRESULT result = mSwapChain->GetPresentParameters(&presentParameters);
+ ASSERT(SUCCEEDED(result));
+
+ IDirect3DSwapChain9 *newSwapChain = nullptr;
+ result = device->CreateAdditionalSwapChain(&presentParameters, &newSwapChain);
+ if (FAILED(result))
+ {
+ return;
+ }
+
+ SafeRelease(mSwapChain);
+ mSwapChain = newSwapChain;
+
+ SafeRelease(mBackBuffer);
+ result = mSwapChain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
+ ASSERT(SUCCEEDED(result));
+}
+
+RenderTargetD3D *SwapChain9::getColorRenderTarget()
+{
+ return &mColorRenderTarget;
+}
+
+RenderTargetD3D *SwapChain9::getDepthStencilRenderTarget()
+{
+ return &mDepthStencilRenderTarget;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h
new file mode 100644
index 0000000000..c4c9843a74
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h
@@ -0,0 +1,80 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// SwapChain9.h: Defines a back-end specific class for the D3D9 swap chain.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_
+
+#include "common/angleutils.h"
+#include "libANGLE/renderer/d3d/SwapChainD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+
+namespace rx
+{
+class NativeWindow9;
+class Renderer9;
+
+class SwapChain9 : public SwapChainD3D
+{
+ public:
+ SwapChain9(Renderer9 *renderer,
+ NativeWindow9 *nativeWindow,
+ HANDLE shareHandle,
+ IUnknown *d3dTexture,
+ GLenum backBufferFormat,
+ GLenum depthBufferFormat,
+ EGLint orientation);
+ ~SwapChain9() override;
+
+ EGLint resize(DisplayD3D *displayD3D, EGLint backbufferWidth, EGLint backbufferHeight) override;
+ EGLint reset(DisplayD3D *displayD3D,
+ EGLint backbufferWidth,
+ EGLint backbufferHeight,
+ EGLint swapInterval) override;
+ EGLint swapRect(DisplayD3D *displayD3D,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height) override;
+ void recreate() override;
+
+ RenderTargetD3D *getColorRenderTarget() override;
+ RenderTargetD3D *getDepthStencilRenderTarget() override;
+
+ virtual IDirect3DSurface9 *getRenderTarget();
+ virtual IDirect3DSurface9 *getDepthStencil();
+ virtual IDirect3DTexture9 *getOffscreenTexture();
+
+ EGLint getWidth() const { return mWidth; }
+ EGLint getHeight() const { return mHeight; }
+
+ void *getKeyedMutex() override;
+
+ egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
+
+ private:
+ void release();
+
+ Renderer9 *mRenderer;
+ EGLint mWidth;
+ EGLint mHeight;
+ EGLint mSwapInterval;
+
+ NativeWindow9 *mNativeWindow;
+
+ IDirect3DSwapChain9 *mSwapChain;
+ IDirect3DSurface9 *mBackBuffer;
+ IDirect3DSurface9 *mRenderTarget;
+ IDirect3DSurface9 *mDepthStencil;
+ IDirect3DTexture9 *mOffscreenTexture;
+
+ SurfaceRenderTarget9 mColorRenderTarget;
+ SurfaceRenderTarget9 mDepthStencilRenderTarget;
+};
+
+} // namespace rx
+#endif // LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
new file mode 100644
index 0000000000..fabb773dc0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
@@ -0,0 +1,523 @@
+//
+// Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage9.cpp: Implements the abstract rx::TextureStorage9 class and its concrete derived
+// classes TextureStorage9_2D and TextureStorage9_Cube, which act as the interface to the
+// D3D9 texture.
+
+#include "libANGLE/renderer/d3d/d3d9/TextureStorage9.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/EGLImageD3D.h"
+#include "libANGLE/renderer/d3d/TextureD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/SwapChain9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+namespace rx
+{
+TextureStorage9::TextureStorage9(Renderer9 *renderer, DWORD usage)
+ : mTopLevel(0),
+ mMipLevels(0),
+ mTextureWidth(0),
+ mTextureHeight(0),
+ mInternalFormat(GL_NONE),
+ mTextureFormat(D3DFMT_UNKNOWN),
+ mRenderer(renderer),
+ mD3DUsage(usage),
+ mD3DPool(mRenderer->getTexturePool(usage))
+{}
+
+TextureStorage9::~TextureStorage9() {}
+
+DWORD TextureStorage9::GetTextureUsage(GLenum internalformat, bool renderTarget)
+{
+ DWORD d3dusage = 0;
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
+ const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+ if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
+ {
+ d3dusage |= D3DUSAGE_DEPTHSTENCIL;
+ }
+ else if (renderTarget && (d3dFormatInfo.renderFormat != D3DFMT_UNKNOWN))
+ {
+ d3dusage |= D3DUSAGE_RENDERTARGET;
+ }
+
+ return d3dusage;
+}
+
+bool TextureStorage9::isRenderTarget() const
+{
+ return (mD3DUsage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) != 0;
+}
+
+bool TextureStorage9::isManaged() const
+{
+ return (mD3DPool == D3DPOOL_MANAGED);
+}
+
+bool TextureStorage9::supportsNativeMipmapFunction() const
+{
+ return false;
+}
+
+D3DPOOL TextureStorage9::getPool() const
+{
+ return mD3DPool;
+}
+
+DWORD TextureStorage9::getUsage() const
+{
+ return mD3DUsage;
+}
+
+int TextureStorage9::getTopLevel() const
+{
+ return mTopLevel;
+}
+
+int TextureStorage9::getLevelCount() const
+{
+ return static_cast<int>(mMipLevels) - mTopLevel;
+}
+
+angle::Result TextureStorage9::setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+TextureStorage9_2D::TextureStorage9_2D(Renderer9 *renderer, SwapChain9 *swapchain)
+ : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET)
+{
+ IDirect3DTexture9 *surfaceTexture = swapchain->getOffscreenTexture();
+ mTexture = surfaceTexture;
+ mMipLevels = surfaceTexture->GetLevelCount();
+
+ mInternalFormat = swapchain->getRenderTargetInternalFormat();
+
+ D3DSURFACE_DESC surfaceDesc;
+ surfaceTexture->GetLevelDesc(0, &surfaceDesc);
+ mTextureWidth = surfaceDesc.Width;
+ mTextureHeight = surfaceDesc.Height;
+ mTextureFormat = surfaceDesc.Format;
+
+ mRenderTargets.resize(mMipLevels, nullptr);
+}
+
+TextureStorage9_2D::TextureStorage9_2D(Renderer9 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels)
+ : TextureStorage9(renderer, GetTextureUsage(internalformat, renderTarget))
+{
+ mTexture = nullptr;
+
+ mInternalFormat = internalformat;
+
+ const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+ mTextureFormat = d3dFormatInfo.texFormat;
+
+ d3d9::MakeValidSize(false, d3dFormatInfo.texFormat, &width, &height, &mTopLevel);
+ mTextureWidth = width;
+ mTextureHeight = height;
+ mMipLevels = mTopLevel + levels;
+
+ mRenderTargets.resize(levels, nullptr);
+}
+
+TextureStorage9_2D::~TextureStorage9_2D()
+{
+ SafeRelease(mTexture);
+ for (RenderTargetD3D *renderTarget : mRenderTargets)
+ {
+ SafeDelete(renderTarget);
+ }
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+angle::Result TextureStorage9_2D::getSurfaceLevel(const gl::Context *context,
+ gl::TextureTarget target,
+ int level,
+ bool dirty,
+ IDirect3DSurface9 **outSurface)
+{
+ ASSERT(target == gl::TextureTarget::_2D);
+
+ IDirect3DBaseTexture9 *baseTexture = nullptr;
+ ANGLE_TRY(getBaseTexture(context, &baseTexture));
+
+ IDirect3DTexture9 *texture = static_cast<IDirect3DTexture9 *>(baseTexture);
+
+ HRESULT result = texture->GetSurfaceLevel(level + mTopLevel, outSurface);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to get the surface from a texture");
+
+ // With managed textures the driver needs to be informed of updates to the lower mipmap levels
+ if (level + mTopLevel != 0 && isManaged() && dirty)
+ {
+ texture->AddDirtyRect(nullptr);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_2D::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(index.getLevelIndex() < getLevelCount());
+
+ if (!mRenderTargets[index.getLevelIndex()] && isRenderTarget())
+ {
+ IDirect3DBaseTexture9 *baseTexture = nullptr;
+ ANGLE_TRY(getBaseTexture(context, &baseTexture));
+
+ IDirect3DSurface9 *surface = nullptr;
+ ANGLE_TRY(getSurfaceLevel(context, gl::TextureTarget::_2D, index.getLevelIndex(), false,
+ &surface));
+
+ size_t textureMipLevel = mTopLevel + index.getLevelIndex();
+ size_t mipWidth = std::max<size_t>(mTextureWidth >> textureMipLevel, 1u);
+ size_t mipHeight = std::max<size_t>(mTextureHeight >> textureMipLevel, 1u);
+
+ baseTexture->AddRef();
+ mRenderTargets[index.getLevelIndex()] = new TextureRenderTarget9(
+ baseTexture, textureMipLevel, surface, mInternalFormat, static_cast<GLsizei>(mipWidth),
+ static_cast<GLsizei>(mipHeight), 1, 0);
+ }
+
+ ASSERT(outRT);
+ *outRT = mRenderTargets[index.getLevelIndex()];
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_2D::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex)
+{
+ angle::ComPtr<IDirect3DSurface9> upper = nullptr;
+ ANGLE_TRY(getSurfaceLevel(context, gl::TextureTarget::_2D, sourceIndex.getLevelIndex(), false,
+ &upper));
+
+ angle::ComPtr<IDirect3DSurface9> lower = nullptr;
+ ANGLE_TRY(
+ getSurfaceLevel(context, gl::TextureTarget::_2D, destIndex.getLevelIndex(), true, &lower));
+
+ ASSERT(upper && lower);
+ return mRenderer->boxFilter(GetImplAs<Context9>(context), upper.Get(), lower.Get());
+}
+
+angle::Result TextureStorage9_2D::getBaseTexture(const gl::Context *context,
+ IDirect3DBaseTexture9 **outTexture)
+{
+ // if the width or height is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (mTexture == nullptr && mTextureWidth > 0 && mTextureHeight > 0)
+ {
+ ASSERT(mMipLevels > 0);
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+ HRESULT result = device->CreateTexture(static_cast<unsigned int>(mTextureWidth),
+ static_cast<unsigned int>(mTextureHeight),
+ static_cast<unsigned int>(mMipLevels), getUsage(),
+ mTextureFormat, getPool(), &mTexture, nullptr);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to create 2D storage texture");
+ }
+
+ *outTexture = mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_2D::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ASSERT(destStorage);
+
+ TextureStorage9_2D *dest9 = GetAs<TextureStorage9_2D>(destStorage);
+
+ int levels = getLevelCount();
+ for (int i = 0; i < levels; ++i)
+ {
+ angle::ComPtr<IDirect3DSurface9> srcSurf = nullptr;
+ ANGLE_TRY(getSurfaceLevel(context, gl::TextureTarget::_2D, i, false, &srcSurf));
+
+ angle::ComPtr<IDirect3DSurface9> dstSurf = nullptr;
+ ANGLE_TRY(dest9->getSurfaceLevel(context, gl::TextureTarget::_2D, i, true, &dstSurf));
+
+ ANGLE_TRY(
+ mRenderer->copyToRenderTarget(context, dstSurf.Get(), srcSurf.Get(), isManaged()));
+ }
+
+ return angle::Result::Continue;
+}
+
+TextureStorage9_EGLImage::TextureStorage9_EGLImage(Renderer9 *renderer,
+ EGLImageD3D *image,
+ RenderTarget9 *renderTarget9)
+ : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET), mImage(image)
+{
+ mInternalFormat = renderTarget9->getInternalFormat();
+ mTextureFormat = renderTarget9->getD3DFormat();
+ mTextureWidth = renderTarget9->getWidth();
+ mTextureHeight = renderTarget9->getHeight();
+ mTopLevel = static_cast<int>(renderTarget9->getTextureLevel());
+ mMipLevels = mTopLevel + 1;
+}
+
+TextureStorage9_EGLImage::~TextureStorage9_EGLImage() {}
+
+angle::Result TextureStorage9_EGLImage::getSurfaceLevel(const gl::Context *context,
+ gl::TextureTarget target,
+ int level,
+ bool,
+ IDirect3DSurface9 **outSurface)
+{
+ ASSERT(target == gl::TextureTarget::_2D);
+ ASSERT(level == 0);
+
+ RenderTargetD3D *renderTargetD3D = nullptr;
+ ANGLE_TRY(mImage->getRenderTarget(context, &renderTargetD3D));
+
+ RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTargetD3D);
+
+ *outSurface = renderTarget9->getSurface();
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_EGLImage::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(!index.hasLayer());
+ ASSERT(index.getLevelIndex() == 0);
+
+ return mImage->getRenderTarget(context, outRT);
+}
+
+angle::Result TextureStorage9_EGLImage::getBaseTexture(const gl::Context *context,
+ IDirect3DBaseTexture9 **outTexture)
+{
+ RenderTargetD3D *renderTargetD3D = nullptr;
+ ANGLE_TRY(mImage->getRenderTarget(context, &renderTargetD3D));
+
+ RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTargetD3D);
+ *outTexture = renderTarget9->getTexture();
+ ASSERT(*outTexture != nullptr);
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_EGLImage::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &,
+ const gl::ImageIndex &)
+{
+ ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
+ return angle::Result::Stop;
+}
+
+angle::Result TextureStorage9_EGLImage::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ASSERT(destStorage);
+ ASSERT(getLevelCount() == 1);
+
+ TextureStorage9 *dest9 = GetAs<TextureStorage9>(destStorage);
+
+ IDirect3DBaseTexture9 *destBaseTexture9 = nullptr;
+ ANGLE_TRY(dest9->getBaseTexture(context, &destBaseTexture9));
+
+ IDirect3DTexture9 *destTexture9 = static_cast<IDirect3DTexture9 *>(destBaseTexture9);
+
+ angle::ComPtr<IDirect3DSurface9> destSurface = nullptr;
+ HRESULT result = destTexture9->GetSurfaceLevel(destStorage->getTopLevel(), &destSurface);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to get the surface from a texture");
+
+ RenderTargetD3D *sourceRenderTarget = nullptr;
+ ANGLE_TRY(mImage->getRenderTarget(context, &sourceRenderTarget));
+
+ RenderTarget9 *sourceRenderTarget9 = GetAs<RenderTarget9>(sourceRenderTarget);
+ ANGLE_TRY(mRenderer->copyToRenderTarget(context, destSurface.Get(),
+ sourceRenderTarget9->getSurface(), isManaged()));
+
+ if (destStorage->getTopLevel() != 0)
+ {
+ destTexture9->AddDirtyRect(nullptr);
+ }
+
+ return angle::Result::Continue;
+}
+
+TextureStorage9_Cube::TextureStorage9_Cube(Renderer9 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly)
+ : TextureStorage9(renderer, GetTextureUsage(internalformat, renderTarget))
+{
+ mTexture = nullptr;
+ for (size_t i = 0; i < gl::kCubeFaceCount; ++i)
+ {
+ mRenderTarget[i] = nullptr;
+ }
+
+ mInternalFormat = internalformat;
+
+ const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+ mTextureFormat = d3dFormatInfo.texFormat;
+
+ int height = size;
+ d3d9::MakeValidSize(false, d3dFormatInfo.texFormat, &size, &height, &mTopLevel);
+ mTextureWidth = size;
+ mTextureHeight = size;
+ mMipLevels = mTopLevel + levels;
+}
+
+TextureStorage9_Cube::~TextureStorage9_Cube()
+{
+ SafeRelease(mTexture);
+
+ for (size_t i = 0; i < gl::kCubeFaceCount; ++i)
+ {
+ SafeDelete(mRenderTarget[i]);
+ }
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+angle::Result TextureStorage9_Cube::getSurfaceLevel(const gl::Context *context,
+ gl::TextureTarget target,
+ int level,
+ bool dirty,
+ IDirect3DSurface9 **outSurface)
+{
+ IDirect3DBaseTexture9 *baseTexture = nullptr;
+ ANGLE_TRY(getBaseTexture(context, &baseTexture));
+
+ IDirect3DCubeTexture9 *texture = static_cast<IDirect3DCubeTexture9 *>(baseTexture);
+
+ D3DCUBEMAP_FACES face = gl_d3d9::ConvertCubeFace(target);
+ HRESULT result = texture->GetCubeMapSurface(face, level, outSurface);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to get the surface from a texture");
+
+ // With managed textures the driver needs to be informed of updates to the lower mipmap levels
+ if (level != 0 && isManaged() && dirty)
+ {
+ texture->AddDirtyRect(face, nullptr);
+ }
+
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_Cube::getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT)
+{
+ ASSERT(outRT);
+ ASSERT(index.getLevelIndex() == 0);
+
+ ASSERT(index.getType() == gl::TextureType::CubeMap &&
+ gl::IsCubeMapFaceTarget(index.getTarget()));
+ const size_t renderTargetIndex = index.cubeMapFaceIndex();
+
+ if (mRenderTarget[renderTargetIndex] == nullptr && isRenderTarget())
+ {
+ IDirect3DBaseTexture9 *baseTexture = nullptr;
+ ANGLE_TRY(getBaseTexture(context, &baseTexture));
+
+ IDirect3DSurface9 *surface = nullptr;
+ ANGLE_TRY(getSurfaceLevel(context, index.getTarget(), mTopLevel + index.getLevelIndex(),
+ false, &surface));
+
+ baseTexture->AddRef();
+ mRenderTarget[renderTargetIndex] = new TextureRenderTarget9(
+ baseTexture, mTopLevel + index.getLevelIndex(), surface, mInternalFormat,
+ static_cast<GLsizei>(mTextureWidth), static_cast<GLsizei>(mTextureHeight), 1, 0);
+ }
+
+ *outRT = mRenderTarget[renderTargetIndex];
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_Cube::generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex)
+{
+ angle::ComPtr<IDirect3DSurface9> upper = nullptr;
+ ANGLE_TRY(getSurfaceLevel(context, sourceIndex.getTarget(), sourceIndex.getLevelIndex(), false,
+ &upper));
+
+ angle::ComPtr<IDirect3DSurface9> lower = nullptr;
+ ANGLE_TRY(
+ getSurfaceLevel(context, destIndex.getTarget(), destIndex.getLevelIndex(), true, &lower));
+
+ ASSERT(upper && lower);
+ return mRenderer->boxFilter(GetImplAs<Context9>(context), upper.Get(), lower.Get());
+}
+
+angle::Result TextureStorage9_Cube::getBaseTexture(const gl::Context *context,
+ IDirect3DBaseTexture9 **outTexture)
+{
+ // if the size is not positive this should be treated as an incomplete texture
+ // we handle that here by skipping the d3d texture creation
+ if (mTexture == nullptr && mTextureWidth > 0 && mTextureHeight > 0)
+ {
+ ASSERT(mMipLevels > 0);
+ ASSERT(mTextureWidth == mTextureHeight);
+
+ IDirect3DDevice9 *device = mRenderer->getDevice();
+ HRESULT result = device->CreateCubeTexture(
+ static_cast<unsigned int>(mTextureWidth), static_cast<unsigned int>(mMipLevels),
+ getUsage(), mTextureFormat, getPool(), &mTexture, nullptr);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to create cube storage texture");
+ }
+
+ *outTexture = mTexture;
+ return angle::Result::Continue;
+}
+
+angle::Result TextureStorage9_Cube::copyToStorage(const gl::Context *context,
+ TextureStorage *destStorage)
+{
+ ASSERT(destStorage);
+
+ TextureStorage9_Cube *dest9 = GetAs<TextureStorage9_Cube>(destStorage);
+
+ int levels = getLevelCount();
+ for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets())
+ {
+ for (int i = 0; i < levels; i++)
+ {
+ angle::ComPtr<IDirect3DSurface9> srcSurf = nullptr;
+ ANGLE_TRY(getSurfaceLevel(context, face, i, false, &srcSurf));
+
+ angle::ComPtr<IDirect3DSurface9> dstSurf = nullptr;
+ ANGLE_TRY(dest9->getSurfaceLevel(context, face, i, true, &dstSurf));
+
+ ANGLE_TRY(
+ mRenderer->copyToRenderTarget(context, dstSurf.Get(), srcSurf.Get(), isManaged()));
+ }
+ }
+
+ return angle::Result::Continue;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
new file mode 100644
index 0000000000..7228cf68f0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h
@@ -0,0 +1,164 @@
+//
+// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage9.h: Defines the abstract rx::TextureStorage9 class and its concrete derived
+// classes TextureStorage9_2D and TextureStorage9_Cube, which act as the interface to the
+// D3D9 texture.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_TEXTURESTORAGE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_TEXTURESTORAGE9_H_
+
+#include "common/debug.h"
+#include "libANGLE/renderer/d3d/TextureStorage.h"
+
+namespace rx
+{
+class EGLImageD3D;
+class Renderer9;
+class SwapChain9;
+class RenderTargetD3D;
+class RenderTarget9;
+
+class TextureStorage9 : public TextureStorage
+{
+ public:
+ ~TextureStorage9() override;
+
+ static DWORD GetTextureUsage(GLenum internalformat, bool renderTarget);
+
+ D3DPOOL getPool() const;
+ DWORD getUsage() const;
+
+ virtual angle::Result getSurfaceLevel(const gl::Context *context,
+ gl::TextureTarget target,
+ int level,
+ bool dirty,
+ IDirect3DSurface9 **outSurface) = 0;
+ virtual angle::Result getBaseTexture(const gl::Context *context,
+ IDirect3DBaseTexture9 **outTexture) = 0;
+
+ int getTopLevel() const override;
+ bool isRenderTarget() const override;
+ bool isManaged() const override;
+ bool supportsNativeMipmapFunction() const override;
+ int getLevelCount() const override;
+
+ angle::Result setData(const gl::Context *context,
+ const gl::ImageIndex &index,
+ ImageD3D *image,
+ const gl::Box *destBox,
+ GLenum type,
+ const gl::PixelUnpackState &unpack,
+ const uint8_t *pixelData) override;
+
+ protected:
+ int mTopLevel;
+ size_t mMipLevels;
+ size_t mTextureWidth;
+ size_t mTextureHeight;
+ GLenum mInternalFormat;
+ D3DFORMAT mTextureFormat;
+
+ Renderer9 *mRenderer;
+
+ TextureStorage9(Renderer9 *renderer, DWORD usage);
+
+ private:
+ const DWORD mD3DUsage;
+ const D3DPOOL mD3DPool;
+};
+
+class TextureStorage9_2D : public TextureStorage9
+{
+ public:
+ TextureStorage9_2D(Renderer9 *renderer, SwapChain9 *swapchain);
+ TextureStorage9_2D(Renderer9 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ GLsizei width,
+ GLsizei height,
+ int levels);
+ ~TextureStorage9_2D() override;
+
+ angle::Result getSurfaceLevel(const gl::Context *context,
+ gl::TextureTarget target,
+ int level,
+ bool dirty,
+ IDirect3DSurface9 **outSurface) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+ angle::Result getBaseTexture(const gl::Context *context,
+ IDirect3DBaseTexture9 **outTexture) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ private:
+ IDirect3DTexture9 *mTexture;
+ std::vector<RenderTarget9 *> mRenderTargets;
+};
+
+class TextureStorage9_EGLImage final : public TextureStorage9
+{
+ public:
+ TextureStorage9_EGLImage(Renderer9 *renderer, EGLImageD3D *image, RenderTarget9 *renderTarget9);
+ ~TextureStorage9_EGLImage() override;
+
+ angle::Result getSurfaceLevel(const gl::Context *context,
+ gl::TextureTarget target,
+ int level,
+ bool dirty,
+ IDirect3DSurface9 **outSurface) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+ angle::Result getBaseTexture(const gl::Context *context,
+ IDirect3DBaseTexture9 **outTexture) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ private:
+ EGLImageD3D *mImage;
+};
+
+class TextureStorage9_Cube : public TextureStorage9
+{
+ public:
+ TextureStorage9_Cube(Renderer9 *renderer,
+ GLenum internalformat,
+ bool renderTarget,
+ int size,
+ int levels,
+ bool hintLevelZeroOnly);
+ ~TextureStorage9_Cube() override;
+
+ angle::Result getSurfaceLevel(const gl::Context *context,
+ gl::TextureTarget target,
+ int level,
+ bool dirty,
+ IDirect3DSurface9 **outSurface) override;
+ angle::Result getRenderTarget(const gl::Context *context,
+ const gl::ImageIndex &index,
+ RenderTargetD3D **outRT) override;
+ angle::Result getBaseTexture(const gl::Context *context,
+ IDirect3DBaseTexture9 **outTexture) override;
+ angle::Result generateMipmap(const gl::Context *context,
+ const gl::ImageIndex &sourceIndex,
+ const gl::ImageIndex &destIndex) override;
+ angle::Result copyToStorage(const gl::Context *context, TextureStorage *destStorage) override;
+
+ private:
+ IDirect3DCubeTexture9 *mTexture;
+ RenderTarget9 *mRenderTarget[gl::kCubeFaceCount];
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_TEXTURESTORAGE9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h
new file mode 100644
index 0000000000..a9c1ee7d4b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h
@@ -0,0 +1,57 @@
+//
+// Copyright 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexArray9.h: Defines the rx::VertexArray9 class which implements rx::VertexArrayImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
+
+#include "libANGLE/Context.h"
+#include "libANGLE/renderer/VertexArrayImpl.h"
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+
+namespace rx
+{
+class Renderer9;
+
+class VertexArray9 : public VertexArrayImpl
+{
+ public:
+ VertexArray9(const gl::VertexArrayState &data) : VertexArrayImpl(data) {}
+
+ angle::Result syncState(const gl::Context *context,
+ const gl::VertexArray::DirtyBits &dirtyBits,
+ gl::VertexArray::DirtyAttribBitsArray *attribBits,
+ gl::VertexArray::DirtyBindingBitsArray *bindingBits) override;
+
+ ~VertexArray9() override {}
+
+ Serial getCurrentStateSerial() const { return mCurrentStateSerial; }
+
+ private:
+ Serial mCurrentStateSerial;
+};
+
+inline angle::Result VertexArray9::syncState(const gl::Context *context,
+ const gl::VertexArray::DirtyBits &dirtyBits,
+ gl::VertexArray::DirtyAttribBitsArray *attribBits,
+ gl::VertexArray::DirtyBindingBitsArray *bindingBits)
+{
+
+ ASSERT(dirtyBits.any());
+ Renderer9 *renderer = GetImplAs<Context9>(context)->getRenderer();
+ mCurrentStateSerial = renderer->generateSerial();
+
+ // Clear the dirty bits in the back-end here.
+ memset(attribBits, 0, sizeof(gl::VertexArray::DirtyAttribBitsArray));
+ memset(bindingBits, 0, sizeof(gl::VertexArray::DirtyBindingBitsArray));
+
+ return angle::Result::Continue;
+}
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
new file mode 100644
index 0000000000..67517f2788
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp
@@ -0,0 +1,153 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
+
+#include "libANGLE/renderer/d3d/d3d9/VertexBuffer9.h"
+
+#include "libANGLE/Buffer.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/renderer/d3d/BufferD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/d3d/d3d9/vertexconversion.h"
+
+namespace rx
+{
+
+VertexBuffer9::VertexBuffer9(Renderer9 *renderer) : mRenderer(renderer)
+{
+ mVertexBuffer = nullptr;
+ mBufferSize = 0;
+ mDynamicUsage = false;
+}
+
+VertexBuffer9::~VertexBuffer9()
+{
+ SafeRelease(mVertexBuffer);
+}
+
+angle::Result VertexBuffer9::initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage)
+{
+ SafeRelease(mVertexBuffer);
+
+ updateSerial();
+
+ if (size > 0)
+ {
+ DWORD flags = D3DUSAGE_WRITEONLY;
+ if (dynamicUsage)
+ {
+ flags |= D3DUSAGE_DYNAMIC;
+ }
+
+ HRESULT result = mRenderer->createVertexBuffer(size, flags, &mVertexBuffer);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result,
+ "Failed to allocate internal vertex buffer");
+ }
+
+ mBufferSize = size;
+ mDynamicUsage = dynamicUsage;
+ return angle::Result::Continue;
+}
+
+angle::Result VertexBuffer9::storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ gl::VertexAttribType currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData)
+{
+ ASSERT(mVertexBuffer);
+
+ size_t inputStride = gl::ComputeVertexAttributeStride(attrib, binding);
+ size_t elementSize = gl::ComputeVertexAttributeTypeSize(attrib);
+
+ DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
+
+ uint8_t *mapPtr = nullptr;
+
+ unsigned int mapSize = 0;
+ ANGLE_TRY(
+ mRenderer->getVertexSpaceRequired(context, attrib, binding, count, instances, &mapSize));
+
+ HRESULT result =
+ mVertexBuffer->Lock(offset, mapSize, reinterpret_cast<void **>(&mapPtr), lockFlags);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result, "Failed to lock internal vertex buffer");
+
+ const uint8_t *input = sourceData;
+
+ if (instances == 0 || binding.getDivisor() == 0)
+ {
+ input += inputStride * start;
+ }
+
+ angle::FormatID vertexFormatID = gl::GetVertexFormatID(attrib, currentValueType);
+ const d3d9::VertexFormat &d3dVertexInfo =
+ d3d9::GetVertexFormatInfo(mRenderer->getCapsDeclTypes(), vertexFormatID);
+ bool needsConversion = (d3dVertexInfo.conversionType & VERTEX_CONVERT_CPU) > 0;
+
+ if (!needsConversion && inputStride == elementSize)
+ {
+ size_t copySize = count * inputStride;
+ memcpy(mapPtr, input, copySize);
+ }
+ else
+ {
+ d3dVertexInfo.copyFunction(input, inputStride, count, mapPtr);
+ }
+
+ mVertexBuffer->Unlock();
+
+ return angle::Result::Continue;
+}
+
+unsigned int VertexBuffer9::getBufferSize() const
+{
+ return mBufferSize;
+}
+
+angle::Result VertexBuffer9::setBufferSize(const gl::Context *context, unsigned int size)
+{
+ if (size > mBufferSize)
+ {
+ return initialize(context, size, mDynamicUsage);
+ }
+ else
+ {
+ return angle::Result::Continue;
+ }
+}
+
+angle::Result VertexBuffer9::discard(const gl::Context *context)
+{
+ ASSERT(mVertexBuffer);
+
+ void *dummy;
+ HRESULT result;
+
+ Context9 *context9 = GetImplAs<Context9>(context);
+
+ result = mVertexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
+ ANGLE_TRY_HR(context9, result, "Failed to lock internal vertex buffer for discarding");
+
+ result = mVertexBuffer->Unlock();
+ ANGLE_TRY_HR(context9, result, "Failed to unlock internal vertex buffer for discarding");
+
+ return angle::Result::Continue;
+}
+
+IDirect3DVertexBuffer9 *VertexBuffer9::getBuffer() const
+{
+ return mVertexBuffer;
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h
new file mode 100644
index 0000000000..178a7a3f6a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h
@@ -0,0 +1,56 @@
+//
+// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexBuffer9.h: Defines the D3D9 VertexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXBUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXBUFFER9_H_
+
+#include "libANGLE/renderer/d3d/VertexBuffer.h"
+
+namespace rx
+{
+class Renderer9;
+
+class VertexBuffer9 : public VertexBuffer
+{
+ public:
+ explicit VertexBuffer9(Renderer9 *renderer);
+
+ angle::Result initialize(const gl::Context *context,
+ unsigned int size,
+ bool dynamicUsage) override;
+
+ // Warning: you should ensure binding really matches attrib.bindingIndex before using this
+ // function.
+ angle::Result storeVertexAttributes(const gl::Context *context,
+ const gl::VertexAttribute &attrib,
+ const gl::VertexBinding &binding,
+ gl::VertexAttribType currentValueType,
+ GLint start,
+ size_t count,
+ GLsizei instances,
+ unsigned int offset,
+ const uint8_t *sourceData) override;
+
+ unsigned int getBufferSize() const override;
+ angle::Result setBufferSize(const gl::Context *context, unsigned int size) override;
+ angle::Result discard(const gl::Context *context) override;
+
+ IDirect3DVertexBuffer9 *getBuffer() const;
+
+ private:
+ ~VertexBuffer9() override;
+ Renderer9 *mRenderer;
+
+ IDirect3DVertexBuffer9 *mVertexBuffer;
+ unsigned int mBufferSize;
+ bool mDynamicUsage;
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXBUFFER9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
new file mode 100644
index 0000000000..c7c642404e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
@@ -0,0 +1,262 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexDeclarationCache.cpp: Implements a helper class to construct and cache vertex declarations.
+
+#include "libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/VertexAttribute.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/ProgramD3D.h"
+#include "libANGLE/renderer/d3d/d3d9/Context9.h"
+#include "libANGLE/renderer/d3d/d3d9/VertexBuffer9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+
+namespace rx
+{
+
+VertexDeclarationCache::VertexDeclarationCache() : mMaxLru(0)
+{
+ for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+ {
+ mVertexDeclCache[i].vertexDeclaration = nullptr;
+ mVertexDeclCache[i].lruCount = 0;
+ }
+
+ for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
+ {
+ mAppliedVBs[i].serial = 0;
+ }
+
+ mLastSetVDecl = nullptr;
+ mInstancingEnabled = true;
+}
+
+VertexDeclarationCache::~VertexDeclarationCache()
+{
+ for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+ {
+ SafeRelease(mVertexDeclCache[i].vertexDeclaration);
+ }
+}
+
+angle::Result VertexDeclarationCache::applyDeclaration(
+ const gl::Context *context,
+ IDirect3DDevice9 *device,
+ const std::vector<TranslatedAttribute> &attributes,
+ gl::Program *program,
+ GLint start,
+ GLsizei instances,
+ GLsizei *repeatDraw)
+{
+ ASSERT(gl::MAX_VERTEX_ATTRIBS >= attributes.size());
+
+ *repeatDraw = 1;
+
+ const size_t invalidAttribIndex = attributes.size();
+ size_t indexedAttribute = invalidAttribIndex;
+ size_t instancedAttribute = invalidAttribIndex;
+
+ if (instances == 0)
+ {
+ for (size_t i = 0; i < attributes.size(); ++i)
+ {
+ if (attributes[i].divisor != 0)
+ {
+ // If a divisor is set, it still applies even if an instanced draw was not used, so
+ // treat as a single-instance draw.
+ instances = 1;
+ break;
+ }
+ }
+ }
+
+ if (instances > 0)
+ {
+ // Find an indexed attribute to be mapped to D3D stream 0
+ for (size_t i = 0; i < attributes.size(); i++)
+ {
+ if (attributes[i].active)
+ {
+ if (indexedAttribute == invalidAttribIndex && attributes[i].divisor == 0)
+ {
+ indexedAttribute = i;
+ }
+ else if (instancedAttribute == invalidAttribIndex && attributes[i].divisor != 0)
+ {
+ instancedAttribute = i;
+ }
+ if (indexedAttribute != invalidAttribIndex &&
+ instancedAttribute != invalidAttribIndex)
+ break; // Found both an indexed and instanced attribute
+ }
+ }
+
+ // The validation layer checks that there is at least one active attribute with a zero
+ // divisor as per the GL_ANGLE_instanced_arrays spec.
+ ASSERT(indexedAttribute != invalidAttribIndex);
+ }
+
+ D3DCAPS9 caps;
+ device->GetDeviceCaps(&caps);
+
+ D3DVERTEXELEMENT9 elements[gl::MAX_VERTEX_ATTRIBS + 1];
+ D3DVERTEXELEMENT9 *element = &elements[0];
+
+ ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
+ const auto &semanticIndexes = programD3D->getAttribLocationToD3DSemantics();
+
+ for (size_t i = 0; i < attributes.size(); i++)
+ {
+ if (attributes[i].active)
+ {
+ // Directly binding the storage buffer is not supported for d3d9
+ ASSERT(attributes[i].storage == nullptr);
+
+ int stream = static_cast<int>(i);
+
+ if (instances > 0)
+ {
+ // Due to a bug on ATI cards we can't enable instancing when none of the attributes
+ // are instanced.
+ if (instancedAttribute == invalidAttribIndex)
+ {
+ *repeatDraw = instances;
+ }
+ else
+ {
+ if (i == indexedAttribute)
+ {
+ stream = 0;
+ }
+ else if (i == 0)
+ {
+ stream = static_cast<int>(indexedAttribute);
+ }
+
+ UINT frequency = 1;
+
+ if (attributes[i].divisor == 0)
+ {
+ frequency = D3DSTREAMSOURCE_INDEXEDDATA | instances;
+ }
+ else
+ {
+ frequency = D3DSTREAMSOURCE_INSTANCEDATA | attributes[i].divisor;
+ }
+
+ device->SetStreamSourceFreq(stream, frequency);
+ mInstancingEnabled = true;
+ }
+ }
+
+ VertexBuffer9 *vertexBuffer = GetAs<VertexBuffer9>(attributes[i].vertexBuffer.get());
+
+ unsigned int offset = 0;
+ ANGLE_TRY(attributes[i].computeOffset(context, start, &offset));
+
+ if (mAppliedVBs[stream].serial != attributes[i].serial ||
+ mAppliedVBs[stream].stride != attributes[i].stride ||
+ mAppliedVBs[stream].offset != offset)
+ {
+ device->SetStreamSource(stream, vertexBuffer->getBuffer(), offset,
+ attributes[i].stride);
+ mAppliedVBs[stream].serial = attributes[i].serial;
+ mAppliedVBs[stream].stride = attributes[i].stride;
+ mAppliedVBs[stream].offset = offset;
+ }
+
+ angle::FormatID vertexformatID =
+ gl::GetVertexFormatID(*attributes[i].attribute, gl::VertexAttribType::Float);
+ const d3d9::VertexFormat &d3d9VertexInfo =
+ d3d9::GetVertexFormatInfo(caps.DeclTypes, vertexformatID);
+
+ element->Stream = static_cast<WORD>(stream);
+ element->Offset = 0;
+ element->Type = static_cast<BYTE>(d3d9VertexInfo.nativeFormat);
+ element->Method = D3DDECLMETHOD_DEFAULT;
+ element->Usage = D3DDECLUSAGE_TEXCOORD;
+ element->UsageIndex = static_cast<BYTE>(semanticIndexes[i]);
+ element++;
+ }
+ }
+
+ if (instances == 0 || instancedAttribute == invalidAttribIndex)
+ {
+ if (mInstancingEnabled)
+ {
+ for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
+ {
+ device->SetStreamSourceFreq(i, 1);
+ }
+
+ mInstancingEnabled = false;
+ }
+ }
+
+ static const D3DVERTEXELEMENT9 end = D3DDECL_END();
+ *(element++) = end;
+
+ for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+ {
+ VertexDeclCacheEntry *entry = &mVertexDeclCache[i];
+ if (memcmp(entry->cachedElements, elements,
+ (element - elements) * sizeof(D3DVERTEXELEMENT9)) == 0 &&
+ entry->vertexDeclaration)
+ {
+ entry->lruCount = ++mMaxLru;
+ if (entry->vertexDeclaration != mLastSetVDecl)
+ {
+ device->SetVertexDeclaration(entry->vertexDeclaration);
+ mLastSetVDecl = entry->vertexDeclaration;
+ }
+
+ return angle::Result::Continue;
+ }
+ }
+
+ VertexDeclCacheEntry *lastCache = mVertexDeclCache;
+
+ for (int i = 0; i < NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+ {
+ if (mVertexDeclCache[i].lruCount < lastCache->lruCount)
+ {
+ lastCache = &mVertexDeclCache[i];
+ }
+ }
+
+ if (lastCache->vertexDeclaration != nullptr)
+ {
+ SafeRelease(lastCache->vertexDeclaration);
+ // mLastSetVDecl is set to the replacement, so we don't have to worry
+ // about it.
+ }
+
+ memcpy(lastCache->cachedElements, elements, (element - elements) * sizeof(D3DVERTEXELEMENT9));
+ HRESULT result = device->CreateVertexDeclaration(elements, &lastCache->vertexDeclaration);
+ ANGLE_TRY_HR(GetImplAs<Context9>(context), result,
+ "Failed to create internal vertex declaration");
+
+ device->SetVertexDeclaration(lastCache->vertexDeclaration);
+ mLastSetVDecl = lastCache->vertexDeclaration;
+ lastCache->lruCount = ++mMaxLru;
+
+ return angle::Result::Continue;
+}
+
+void VertexDeclarationCache::markStateDirty()
+{
+ for (int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
+ {
+ mAppliedVBs[i].serial = 0;
+ }
+
+ mLastSetVDecl = nullptr;
+ mInstancingEnabled = true; // Forces it to be disabled when not used
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h
new file mode 100644
index 0000000000..53667f1ff8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h
@@ -0,0 +1,68 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// VertexDeclarationCache.h: Defines a helper class to construct and cache vertex declarations.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXDECLARATIONCACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXDECLARATIONCACHE_H_
+
+#include "libANGLE/Error.h"
+#include "libANGLE/renderer/d3d/VertexDataManager.h"
+
+namespace gl
+{
+class VertexDataManager;
+class Program;
+} // namespace gl
+
+namespace rx
+{
+class VertexDeclarationCache
+{
+ public:
+ VertexDeclarationCache();
+ ~VertexDeclarationCache();
+
+ angle::Result applyDeclaration(const gl::Context *context,
+ IDirect3DDevice9 *device,
+ const std::vector<TranslatedAttribute> &attributes,
+ gl::Program *program,
+ GLint start,
+ GLsizei instances,
+ GLsizei *repeatDraw);
+
+ void markStateDirty();
+
+ private:
+ UINT mMaxLru;
+
+ enum
+ {
+ NUM_VERTEX_DECL_CACHE_ENTRIES = 32
+ };
+
+ struct VBData
+ {
+ unsigned int serial;
+ unsigned int stride;
+ unsigned int offset;
+ };
+
+ VBData mAppliedVBs[gl::MAX_VERTEX_ATTRIBS];
+ IDirect3DVertexDeclaration9 *mLastSetVDecl;
+ bool mInstancingEnabled;
+
+ struct VertexDeclCacheEntry
+ {
+ D3DVERTEXELEMENT9 cachedElements[gl::MAX_VERTEX_ATTRIBS + 1];
+ UINT lruCount;
+ IDirect3DVertexDeclaration9 *vertexDeclaration;
+ } mVertexDeclCache[NUM_VERTEX_DECL_CACHE_ENTRIES];
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXDECLARATIONCACHE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp
new file mode 100644
index 0000000000..826b446953
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp
@@ -0,0 +1,872 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils9.cpp: Queries for GL image formats and their translations to D3D9
+// formats.
+
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+
+#include "image_util/copyimage.h"
+#include "image_util/generatemip.h"
+#include "image_util/loadimage.h"
+
+#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/vertexconversion.h"
+
+using namespace angle;
+
+namespace rx
+{
+
+namespace d3d9
+{
+
+constexpr D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I', 'N', 'T', 'Z')));
+constexpr D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N', 'U', 'L', 'L')));
+
+// A map to determine the pixel size and mip generation function of a given D3D format
+typedef std::map<D3DFORMAT, D3DFormat> D3D9FormatInfoMap;
+
+D3DFormat::D3DFormat()
+ : pixelBytes(0),
+ blockWidth(0),
+ blockHeight(0),
+ redBits(0),
+ greenBits(0),
+ blueBits(0),
+ alphaBits(0),
+ luminanceBits(0),
+ depthBits(0),
+ stencilBits(0),
+ formatID(angle::FormatID::NONE)
+{}
+
+D3DFormat::D3DFormat(GLuint bits,
+ GLuint blockWidth,
+ GLuint blockHeight,
+ GLuint redBits,
+ GLuint greenBits,
+ GLuint blueBits,
+ GLuint alphaBits,
+ GLuint lumBits,
+ GLuint depthBits,
+ GLuint stencilBits,
+ FormatID formatID)
+ : pixelBytes(bits / 8),
+ blockWidth(blockWidth),
+ blockHeight(blockHeight),
+ redBits(redBits),
+ greenBits(greenBits),
+ blueBits(blueBits),
+ alphaBits(alphaBits),
+ luminanceBits(lumBits),
+ depthBits(depthBits),
+ stencilBits(stencilBits),
+ formatID(formatID)
+{}
+
+const D3DFormat &GetD3DFormatInfo(D3DFORMAT format)
+{
+ if (format == D3DFMT_NULL)
+ {
+ static const D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FormatID::NONE);
+ return info;
+ }
+
+ if (format == D3DFMT_INTZ)
+ {
+ static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8, FormatID::D24_UNORM_S8_UINT);
+ return info;
+ }
+
+ switch (format)
+ {
+ case D3DFMT_UNKNOWN:
+ {
+ static const D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FormatID::NONE);
+ return info;
+ }
+
+ case D3DFMT_L8:
+ {
+ static const D3DFormat info(8, 1, 1, 0, 0, 0, 0, 8, 0, 0, FormatID::L8_UNORM);
+ return info;
+ }
+ case D3DFMT_A8:
+ {
+ static const D3DFormat info(8, 1, 1, 0, 0, 0, 8, 0, 0, 0, FormatID::A8_UNORM);
+ return info;
+ }
+ case D3DFMT_A8L8:
+ {
+ static const D3DFormat info(16, 1, 1, 0, 0, 0, 8, 8, 0, 0, FormatID::L8A8_UNORM);
+ return info;
+ }
+
+ case D3DFMT_A4R4G4B4:
+ {
+ static const D3DFormat info(16, 1, 1, 4, 4, 4, 4, 0, 0, 0, FormatID::B4G4R4A4_UNORM);
+ return info;
+ }
+ case D3DFMT_A1R5G5B5:
+ {
+ static const D3DFormat info(16, 1, 1, 5, 5, 5, 1, 0, 0, 0, FormatID::B5G5R5A1_UNORM);
+ return info;
+ }
+ case D3DFMT_R5G6B5:
+ {
+ static const D3DFormat info(16, 1, 1, 5, 6, 5, 0, 0, 0, 0, FormatID::R5G6B5_UNORM);
+ return info;
+ }
+ case D3DFMT_X8R8G8B8:
+ {
+ static const D3DFormat info(32, 1, 1, 8, 8, 8, 0, 0, 0, 0, FormatID::B8G8R8X8_UNORM);
+ return info;
+ }
+ case D3DFMT_A8R8G8B8:
+ {
+ static const D3DFormat info(32, 1, 1, 8, 8, 8, 8, 0, 0, 0, FormatID::B8G8R8A8_UNORM);
+ return info;
+ }
+
+ case D3DFMT_R16F:
+ {
+ static const D3DFormat info(16, 1, 1, 16, 0, 0, 0, 0, 0, 0, FormatID::R16_FLOAT);
+ return info;
+ }
+ case D3DFMT_G16R16F:
+ {
+ static const D3DFormat info(32, 1, 1, 16, 16, 0, 0, 0, 0, 0, FormatID::R16G16_FLOAT);
+ return info;
+ }
+ case D3DFMT_A16B16G16R16F:
+ {
+ static const D3DFormat info(64, 1, 1, 16, 16, 16, 16, 0, 0, 0,
+ FormatID::R16G16B16A16_FLOAT);
+ return info;
+ }
+ case D3DFMT_R32F:
+ {
+ static const D3DFormat info(32, 1, 1, 32, 0, 0, 0, 0, 0, 0, FormatID::R32_FLOAT);
+ return info;
+ }
+ case D3DFMT_G32R32F:
+ {
+ static const D3DFormat info(64, 1, 1, 32, 32, 0, 0, 0, 0, 0, FormatID::R32G32_FLOAT);
+ return info;
+ }
+ case D3DFMT_A32B32G32R32F:
+ {
+ static const D3DFormat info(128, 1, 1, 32, 32, 32, 32, 0, 0, 0,
+ FormatID::R32G32B32A32_FLOAT);
+ return info;
+ }
+
+ case D3DFMT_D16:
+ {
+ static const D3DFormat info(16, 1, 1, 0, 0, 0, 0, 0, 16, 0, FormatID::D16_UNORM);
+ return info;
+ }
+ case D3DFMT_D24S8:
+ {
+ static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8,
+ FormatID::D24_UNORM_S8_UINT);
+ return info;
+ }
+ case D3DFMT_D24X8:
+ {
+ static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 0, FormatID::D16_UNORM);
+ return info;
+ }
+ case D3DFMT_D32:
+ {
+ static const D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 32, 0, FormatID::D32_UNORM);
+ return info;
+ }
+
+ case D3DFMT_DXT1:
+ {
+ static const D3DFormat info(64, 4, 4, 0, 0, 0, 0, 0, 0, 0,
+ FormatID::BC1_RGBA_UNORM_BLOCK);
+ return info;
+ }
+ case D3DFMT_DXT3:
+ {
+ static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
+ FormatID::BC2_RGBA_UNORM_BLOCK);
+ return info;
+ }
+ case D3DFMT_DXT5:
+ {
+ static const D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
+ FormatID::BC3_RGBA_UNORM_BLOCK);
+ return info;
+ }
+
+ default:
+ {
+ static const D3DFormat defaultInfo;
+ return defaultInfo;
+ }
+ }
+}
+
+typedef std::pair<GLint, InitializeTextureDataFunction> InternalFormatInitialzerPair;
+typedef std::map<GLint, InitializeTextureDataFunction> InternalFormatInitialzerMap;
+
+static InternalFormatInitialzerMap BuildInternalFormatInitialzerMap()
+{
+ using namespace angle; // For image initialization functions
+
+ InternalFormatInitialzerMap map;
+
+ map.insert(InternalFormatInitialzerPair(
+ GL_RGB16F, Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>));
+ map.insert(InternalFormatInitialzerPair(
+ GL_RGB32F,
+ Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>));
+
+ return map;
+}
+
+static void UnreachableLoad(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ UNREACHABLE();
+}
+
+typedef std::pair<GLenum, TextureFormat> D3D9FormatPair;
+typedef std::map<GLenum, TextureFormat> D3D9FormatMap;
+
+TextureFormat::TextureFormat()
+ : texFormat(D3DFMT_UNKNOWN),
+ renderFormat(D3DFMT_UNKNOWN),
+ dataInitializerFunction(nullptr),
+ loadFunction(UnreachableLoad)
+{}
+
+static inline void InsertD3D9FormatInfo(D3D9FormatMap *map,
+ GLenum internalFormat,
+ D3DFORMAT texFormat,
+ D3DFORMAT renderFormat,
+ LoadImageFunction loadFunction)
+{
+ TextureFormat info;
+ info.texFormat = texFormat;
+ info.renderFormat = renderFormat;
+
+ static const InternalFormatInitialzerMap dataInitializationMap =
+ BuildInternalFormatInitialzerMap();
+ InternalFormatInitialzerMap::const_iterator dataInitIter =
+ dataInitializationMap.find(internalFormat);
+ info.dataInitializerFunction =
+ (dataInitIter != dataInitializationMap.end()) ? dataInitIter->second : nullptr;
+
+ info.loadFunction = loadFunction;
+
+ map->insert(std::make_pair(internalFormat, info));
+}
+
+static D3D9FormatMap BuildD3D9FormatMap()
+{
+ using namespace angle; // For image loading functions
+
+ D3D9FormatMap map;
+
+ // clang-format off
+ // | Internal format | Texture format | Render format | Load function |
+ InsertD3D9FormatInfo(&map, GL_NONE, D3DFMT_NULL, D3DFMT_NULL, UnreachableLoad );
+
+ // We choose to downsample the GL_DEPTH_COMPONENT32_OES format to a 24-bit format because D3DFMT_D32 is not widely
+ // supported. We're allowed to do this because:
+ // - The ES spec 2.0.25 sec 3.7.1 states that we're allowed to store texture formats with internal format
+ // resolutions of our own choosing.
+ // - OES_depth_texture states that downsampling of the depth formats is allowed.
+ // - ANGLE_depth_texture does not state minimum required resolutions of the depth texture formats it
+ // introduces.
+ // In ES3 however, there are minimum resolutions for the texture formats and this would not be allowed.
+
+ InsertD3D9FormatInfo(&map, GL_DEPTH_COMPONENT16, D3DFMT_INTZ, D3DFMT_D24S8, UnreachableLoad );
+ InsertD3D9FormatInfo(&map, GL_DEPTH_COMPONENT32_OES, D3DFMT_INTZ, D3DFMT_D24X8, UnreachableLoad );
+ InsertD3D9FormatInfo(&map, GL_DEPTH24_STENCIL8_OES, D3DFMT_INTZ, D3DFMT_D24S8, UnreachableLoad );
+ InsertD3D9FormatInfo(&map, GL_STENCIL_INDEX8, D3DFMT_UNKNOWN, D3DFMT_D24S8, UnreachableLoad ); // TODO: What's the texture format?
+
+ InsertD3D9FormatInfo(&map, GL_RGBA32F_EXT, D3DFMT_A32B32G32R32F, D3DFMT_A32B32G32R32F, LoadToNative<GLfloat, 4> );
+ InsertD3D9FormatInfo(&map, GL_RGB32F_EXT, D3DFMT_A32B32G32R32F, D3DFMT_A32B32G32R32F, LoadToNative3To4<GLfloat, gl::Float32One>);
+ InsertD3D9FormatInfo(&map, GL_RG32F_EXT, D3DFMT_G32R32F, D3DFMT_G32R32F, LoadToNative<GLfloat, 2> );
+ InsertD3D9FormatInfo(&map, GL_R32F_EXT, D3DFMT_R32F, D3DFMT_R32F, LoadToNative<GLfloat, 1> );
+ InsertD3D9FormatInfo(&map, GL_ALPHA32F_EXT, D3DFMT_A32B32G32R32F, D3DFMT_UNKNOWN, LoadA32FToRGBA32F );
+ InsertD3D9FormatInfo(&map, GL_LUMINANCE32F_EXT, D3DFMT_A32B32G32R32F, D3DFMT_UNKNOWN, LoadL32FToRGBA32F );
+ InsertD3D9FormatInfo(&map, GL_LUMINANCE_ALPHA32F_EXT, D3DFMT_A32B32G32R32F, D3DFMT_UNKNOWN, LoadLA32FToRGBA32F );
+
+ InsertD3D9FormatInfo(&map, GL_RGBA16F_EXT, D3DFMT_A16B16G16R16F, D3DFMT_A16B16G16R16F, LoadToNative<GLhalf, 4> );
+ InsertD3D9FormatInfo(&map, GL_RGB16F_EXT, D3DFMT_A16B16G16R16F, D3DFMT_A16B16G16R16F, LoadToNative3To4<GLhalf, gl::Float16One> );
+ InsertD3D9FormatInfo(&map, GL_RG16F_EXT, D3DFMT_G16R16F, D3DFMT_G16R16F, LoadToNative<GLhalf, 2> );
+ InsertD3D9FormatInfo(&map, GL_R16F_EXT, D3DFMT_R16F, D3DFMT_R16F, LoadToNative<GLhalf, 1> );
+ InsertD3D9FormatInfo(&map, GL_ALPHA16F_EXT, D3DFMT_A16B16G16R16F, D3DFMT_UNKNOWN, LoadA16FToRGBA16F );
+ InsertD3D9FormatInfo(&map, GL_LUMINANCE16F_EXT, D3DFMT_A16B16G16R16F, D3DFMT_UNKNOWN, LoadL16FToRGBA16F );
+ InsertD3D9FormatInfo(&map, GL_LUMINANCE_ALPHA16F_EXT, D3DFMT_A16B16G16R16F, D3DFMT_UNKNOWN, LoadLA16FToRGBA16F );
+
+ InsertD3D9FormatInfo(&map, GL_ALPHA8_EXT, D3DFMT_A8R8G8B8, D3DFMT_A8R8G8B8, LoadA8ToBGRA8 );
+
+ InsertD3D9FormatInfo(&map, GL_RGB8_OES, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, LoadRGB8ToBGRX8 );
+ InsertD3D9FormatInfo(&map, GL_RGB565, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, LoadR5G6B5ToBGRA8 );
+ InsertD3D9FormatInfo(&map, GL_RGBA8_OES, D3DFMT_A8R8G8B8, D3DFMT_A8R8G8B8, LoadRGBA8ToBGRA8 );
+ InsertD3D9FormatInfo(&map, GL_RGBA4, D3DFMT_A8R8G8B8, D3DFMT_A8R8G8B8, LoadRGBA4ToBGRA8 );
+ InsertD3D9FormatInfo(&map, GL_RGB5_A1, D3DFMT_A8R8G8B8, D3DFMT_A8R8G8B8, LoadRGB5A1ToBGRA8 );
+ InsertD3D9FormatInfo(&map, GL_R8_EXT, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, LoadR8ToBGRX8 );
+ InsertD3D9FormatInfo(&map, GL_RG8_EXT, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, LoadRG8ToBGRX8 );
+
+ InsertD3D9FormatInfo(&map, GL_BGRA8_EXT, D3DFMT_A8R8G8B8, D3DFMT_A8R8G8B8, LoadToNative<GLubyte, 4> );
+ InsertD3D9FormatInfo(&map, GL_BGRA4_ANGLEX, D3DFMT_A8R8G8B8, D3DFMT_A8R8G8B8, LoadBGRA4ToBGRA8 );
+ InsertD3D9FormatInfo(&map, GL_BGR5_A1_ANGLEX, D3DFMT_A8R8G8B8, D3DFMT_A8R8G8B8, LoadBGR5A1ToBGRA8 );
+
+ InsertD3D9FormatInfo(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, D3DFMT_DXT1, D3DFMT_UNKNOWN, LoadCompressedToNative<4, 4, 1, 8> );
+ InsertD3D9FormatInfo(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, D3DFMT_DXT1, D3DFMT_UNKNOWN, LoadCompressedToNative<4, 4, 1, 8> );
+ InsertD3D9FormatInfo(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, D3DFMT_DXT3, D3DFMT_UNKNOWN, LoadCompressedToNative<4, 4, 1, 16> );
+ InsertD3D9FormatInfo(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, D3DFMT_DXT5, D3DFMT_UNKNOWN, LoadCompressedToNative<4, 4, 1, 16> );
+
+ // These formats require checking if the renderer supports D3DFMT_L8 or D3DFMT_A8L8 and
+ // then changing the format and loading function appropriately.
+ InsertD3D9FormatInfo(&map, GL_LUMINANCE8_EXT, D3DFMT_L8, D3DFMT_UNKNOWN, LoadToNative<GLubyte, 1> );
+ InsertD3D9FormatInfo(&map, GL_LUMINANCE8_ALPHA8_EXT, D3DFMT_A8L8, D3DFMT_UNKNOWN, LoadToNative<GLubyte, 2> );
+ // clang-format on
+
+ return map;
+}
+
+const TextureFormat &GetTextureFormatInfo(GLenum internalFormat)
+{
+ static const D3D9FormatMap formatMap = BuildD3D9FormatMap();
+ D3D9FormatMap::const_iterator iter = formatMap.find(internalFormat);
+ if (iter != formatMap.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ static const TextureFormat defaultInfo;
+ return defaultInfo;
+ }
+}
+
+static GLenum GetDeclTypeComponentType(D3DDECLTYPE declType)
+{
+ switch (declType)
+ {
+ case D3DDECLTYPE_FLOAT1:
+ return GL_FLOAT;
+ case D3DDECLTYPE_FLOAT2:
+ return GL_FLOAT;
+ case D3DDECLTYPE_FLOAT3:
+ return GL_FLOAT;
+ case D3DDECLTYPE_FLOAT4:
+ return GL_FLOAT;
+ case D3DDECLTYPE_UBYTE4:
+ return GL_UNSIGNED_INT;
+ case D3DDECLTYPE_SHORT2:
+ return GL_INT;
+ case D3DDECLTYPE_SHORT4:
+ return GL_INT;
+ case D3DDECLTYPE_UBYTE4N:
+ return GL_UNSIGNED_NORMALIZED;
+ case D3DDECLTYPE_SHORT4N:
+ return GL_SIGNED_NORMALIZED;
+ case D3DDECLTYPE_USHORT4N:
+ return GL_UNSIGNED_NORMALIZED;
+ case D3DDECLTYPE_SHORT2N:
+ return GL_SIGNED_NORMALIZED;
+ case D3DDECLTYPE_USHORT2N:
+ return GL_UNSIGNED_NORMALIZED;
+ default:
+ UNREACHABLE();
+ return GL_NONE;
+ }
+}
+
+// Attribute format conversion
+enum
+{
+ NUM_GL_VERTEX_ATTRIB_TYPES = 6
+};
+
+struct TranslationDescription
+{
+ DWORD capsFlag;
+ VertexFormat preferredConversion;
+ VertexFormat fallbackConversion;
+};
+
+// Mapping from OpenGL-ES vertex attrib type to D3D decl type:
+//
+// BYTE SHORT (Cast)
+// BYTE-norm FLOAT (Normalize) (can't be exactly represented as SHORT-norm)
+// UNSIGNED_BYTE UBYTE4 (Identity) or SHORT (Cast)
+// UNSIGNED_BYTE-norm UBYTE4N (Identity) or FLOAT (Normalize)
+// SHORT SHORT (Identity)
+// SHORT-norm SHORT-norm (Identity) or FLOAT (Normalize)
+// UNSIGNED_SHORT FLOAT (Cast)
+// UNSIGNED_SHORT-norm USHORT-norm (Identity) or FLOAT (Normalize)
+// FIXED (not in WebGL) FLOAT (FixedToFloat)
+// FLOAT FLOAT (Identity)
+
+// GLToCType maps from GL type (as GLenum) to the C typedef.
+template <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
+ };
+};
+
+VertexFormat::VertexFormat()
+ : conversionType(VERTEX_CONVERT_NONE),
+ outputElementSize(0),
+ copyFunction(nullptr),
+ nativeFormat(D3DDECLTYPE_UNUSED),
+ componentType(GL_NONE)
+{}
+
+// Initialize a TranslationInfo
+VertexFormat CreateVertexFormatInfo(bool identity,
+ size_t elementSize,
+ VertexCopyFunction copyFunc,
+ D3DDECLTYPE nativeFormat)
+{
+ VertexFormat formatInfo;
+ formatInfo.conversionType = identity ? VERTEX_CONVERT_NONE : VERTEX_CONVERT_CPU;
+ formatInfo.outputElementSize = elementSize;
+ formatInfo.copyFunction = copyFunc;
+ formatInfo.nativeFormat = nativeFormat;
+ formatInfo.componentType = GetDeclTypeComponentType(nativeFormat);
+ return formatInfo;
+}
+
+#define TRANSLATION(type, norm, size, preferred) \
+ CreateVertexFormatInfo( \
+ Converter<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)}, \
+ }
+
+static inline unsigned int ComputeTypeIndex(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return 0;
+ case GL_UNSIGNED_BYTE:
+ return 1;
+ case GL_SHORT:
+ return 2;
+ case GL_UNSIGNED_SHORT:
+ return 3;
+ case GL_FIXED:
+ return 4;
+ case GL_FLOAT:
+ return 5;
+
+ default:
+ UNREACHABLE();
+ return 5;
+ }
+}
+
+const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes, angle::FormatID vertexFormatID)
+{
+ static bool initialized = false;
+ static DWORD initializedDeclTypes = 0;
+ static VertexFormat formatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
+ if (initializedDeclTypes != supportedDeclTypes)
+ {
+ const TranslationDescription
+ translations[NUM_GL_VERTEX_ATTRIB_TYPES][2]
+ [4] = // [GL types as enumerated by typeIndex()][normalized][size-1]
+ {TRANSLATIONS_FOR_TYPE(GL_BYTE), TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_BYTE),
+ TRANSLATIONS_FOR_TYPE(GL_SHORT), TRANSLATIONS_FOR_TYPE(GL_UNSIGNED_SHORT),
+ TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FIXED), TRANSLATIONS_FOR_TYPE_NO_NORM(GL_FLOAT)};
+ for (unsigned int i = 0; i < NUM_GL_VERTEX_ATTRIB_TYPES; i++)
+ {
+ for (unsigned int j = 0; j < 2; j++)
+ {
+ for (unsigned int k = 0; k < 4; k++)
+ {
+ if (translations[i][j][k].capsFlag == 0 ||
+ (supportedDeclTypes & translations[i][j][k].capsFlag) != 0)
+ {
+ formatConverters[i][j][k] = translations[i][j][k].preferredConversion;
+ }
+ else
+ {
+ formatConverters[i][j][k] = translations[i][j][k].fallbackConversion;
+ }
+ }
+ }
+ }
+ initialized = true;
+ initializedDeclTypes = supportedDeclTypes;
+ }
+
+ const gl::VertexFormat &vertexFormat = gl::GetVertexFormatFromID(vertexFormatID);
+
+ // Pure integer attributes only supported in ES3.0
+ ASSERT(!vertexFormat.pureInteger);
+ return formatConverters[ComputeTypeIndex(vertexFormat.type)][vertexFormat.normalized]
+ [vertexFormat.components - 1];
+}
+} // namespace d3d9
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.h
new file mode 100644
index 0000000000..ba1a1ca981
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.h
@@ -0,0 +1,93 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils9.h: Queries for GL image formats and their translations to D3D9
+// formats.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
+
+#include <map>
+
+#include "common/platform.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/Format.h"
+#include "libANGLE/renderer/copyvertex.h"
+#include "libANGLE/renderer/d3d/formatutilsD3D.h"
+#include "libANGLE/renderer/renderer_utils.h"
+
+namespace rx
+{
+
+class Renderer9;
+
+namespace d3d9
+{
+
+struct D3DFormat
+{
+ D3DFormat();
+ D3DFormat(GLuint pixelBytes,
+ GLuint blockWidth,
+ GLuint blockHeight,
+ GLuint redBits,
+ GLuint greenBits,
+ GLuint blueBits,
+ GLuint alphaBits,
+ GLuint luminanceBits,
+ GLuint depthBits,
+ GLuint stencilBits,
+ angle::FormatID formatID);
+
+ const angle::Format &info() const { return angle::Format::Get(formatID); }
+
+ GLuint pixelBytes;
+ GLuint blockWidth;
+ GLuint blockHeight;
+
+ GLuint redBits;
+ GLuint greenBits;
+ GLuint blueBits;
+ GLuint alphaBits;
+ GLuint luminanceBits;
+
+ GLuint depthBits;
+ GLuint stencilBits;
+
+ angle::FormatID formatID;
+};
+
+const D3DFormat &GetD3DFormatInfo(D3DFORMAT format);
+
+struct VertexFormat
+{
+ VertexFormat();
+
+ VertexConversionType conversionType;
+ size_t outputElementSize;
+ VertexCopyFunction copyFunction;
+ D3DDECLTYPE nativeFormat;
+ GLenum componentType;
+};
+const VertexFormat &GetVertexFormatInfo(DWORD supportedDeclTypes, angle::FormatID vertexFormatID);
+
+struct TextureFormat
+{
+ TextureFormat();
+
+ D3DFORMAT texFormat;
+ D3DFORMAT renderFormat;
+
+ InitializeTextureDataFunction dataInitializerFunction;
+
+ LoadImageFunction loadFunction;
+};
+const TextureFormat &GetTextureFormatInfo(GLenum internalFormat);
+} // namespace d3d9
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
new file mode 100644
index 0000000000..8c56837299
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
@@ -0,0 +1,826 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// renderer9_utils.cpp: Conversion functions and other utility routines
+// specific to the D3D9 renderer.
+
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
+
+#include "common/debug.h"
+#include "common/mathutil.h"
+
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
+#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
+#include "libANGLE/renderer/driver_utils.h"
+#include "platform/FeaturesD3D.h"
+#include "platform/Platform.h"
+
+#include "third_party/systeminfo/SystemInfo.h"
+
+namespace rx
+{
+
+namespace gl_d3d9
+{
+
+D3DCMPFUNC ConvertComparison(GLenum comparison)
+{
+ D3DCMPFUNC d3dComp = D3DCMP_ALWAYS;
+ switch (comparison)
+ {
+ case GL_NEVER:
+ d3dComp = D3DCMP_NEVER;
+ break;
+ case GL_ALWAYS:
+ d3dComp = D3DCMP_ALWAYS;
+ break;
+ case GL_LESS:
+ d3dComp = D3DCMP_LESS;
+ break;
+ case GL_LEQUAL:
+ d3dComp = D3DCMP_LESSEQUAL;
+ break;
+ case GL_EQUAL:
+ d3dComp = D3DCMP_EQUAL;
+ break;
+ case GL_GREATER:
+ d3dComp = D3DCMP_GREATER;
+ break;
+ case GL_GEQUAL:
+ d3dComp = D3DCMP_GREATEREQUAL;
+ break;
+ case GL_NOTEQUAL:
+ d3dComp = D3DCMP_NOTEQUAL;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dComp;
+}
+
+D3DCOLOR ConvertColor(gl::ColorF color)
+{
+ return D3DCOLOR_RGBA(gl::unorm<8>(color.red), gl::unorm<8>(color.green),
+ gl::unorm<8>(color.blue), gl::unorm<8>(color.alpha));
+}
+
+D3DBLEND ConvertBlendFunc(GLenum blend)
+{
+ D3DBLEND d3dBlend = D3DBLEND_ZERO;
+
+ switch (blend)
+ {
+ case GL_ZERO:
+ d3dBlend = D3DBLEND_ZERO;
+ break;
+ case GL_ONE:
+ d3dBlend = D3DBLEND_ONE;
+ break;
+ case GL_SRC_COLOR:
+ d3dBlend = D3DBLEND_SRCCOLOR;
+ break;
+ case GL_ONE_MINUS_SRC_COLOR:
+ d3dBlend = D3DBLEND_INVSRCCOLOR;
+ break;
+ case GL_DST_COLOR:
+ d3dBlend = D3DBLEND_DESTCOLOR;
+ break;
+ case GL_ONE_MINUS_DST_COLOR:
+ d3dBlend = D3DBLEND_INVDESTCOLOR;
+ break;
+ case GL_SRC_ALPHA:
+ d3dBlend = D3DBLEND_SRCALPHA;
+ break;
+ case GL_ONE_MINUS_SRC_ALPHA:
+ d3dBlend = D3DBLEND_INVSRCALPHA;
+ break;
+ case GL_DST_ALPHA:
+ d3dBlend = D3DBLEND_DESTALPHA;
+ break;
+ case GL_ONE_MINUS_DST_ALPHA:
+ d3dBlend = D3DBLEND_INVDESTALPHA;
+ break;
+ case GL_CONSTANT_COLOR:
+ d3dBlend = D3DBLEND_BLENDFACTOR;
+ break;
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ d3dBlend = D3DBLEND_INVBLENDFACTOR;
+ break;
+ case GL_CONSTANT_ALPHA:
+ d3dBlend = D3DBLEND_BLENDFACTOR;
+ break;
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ d3dBlend = D3DBLEND_INVBLENDFACTOR;
+ break;
+ case GL_SRC_ALPHA_SATURATE:
+ d3dBlend = D3DBLEND_SRCALPHASAT;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dBlend;
+}
+
+D3DBLENDOP ConvertBlendOp(GLenum blendOp)
+{
+ D3DBLENDOP d3dBlendOp = D3DBLENDOP_ADD;
+
+ switch (blendOp)
+ {
+ case GL_FUNC_ADD:
+ d3dBlendOp = D3DBLENDOP_ADD;
+ break;
+ case GL_FUNC_SUBTRACT:
+ d3dBlendOp = D3DBLENDOP_SUBTRACT;
+ break;
+ case GL_FUNC_REVERSE_SUBTRACT:
+ d3dBlendOp = D3DBLENDOP_REVSUBTRACT;
+ break;
+ case GL_MIN_EXT:
+ d3dBlendOp = D3DBLENDOP_MIN;
+ break;
+ case GL_MAX_EXT:
+ d3dBlendOp = D3DBLENDOP_MAX;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dBlendOp;
+}
+
+D3DSTENCILOP ConvertStencilOp(GLenum stencilOp)
+{
+ D3DSTENCILOP d3dStencilOp = D3DSTENCILOP_KEEP;
+
+ switch (stencilOp)
+ {
+ case GL_ZERO:
+ d3dStencilOp = D3DSTENCILOP_ZERO;
+ break;
+ case GL_KEEP:
+ d3dStencilOp = D3DSTENCILOP_KEEP;
+ break;
+ case GL_REPLACE:
+ d3dStencilOp = D3DSTENCILOP_REPLACE;
+ break;
+ case GL_INCR:
+ d3dStencilOp = D3DSTENCILOP_INCRSAT;
+ break;
+ case GL_DECR:
+ d3dStencilOp = D3DSTENCILOP_DECRSAT;
+ break;
+ case GL_INVERT:
+ d3dStencilOp = D3DSTENCILOP_INVERT;
+ break;
+ case GL_INCR_WRAP:
+ d3dStencilOp = D3DSTENCILOP_INCR;
+ break;
+ case GL_DECR_WRAP:
+ d3dStencilOp = D3DSTENCILOP_DECR;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dStencilOp;
+}
+
+D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap)
+{
+ D3DTEXTUREADDRESS d3dWrap = D3DTADDRESS_WRAP;
+
+ switch (wrap)
+ {
+ case GL_REPEAT:
+ d3dWrap = D3DTADDRESS_WRAP;
+ break;
+ case GL_CLAMP_TO_EDGE:
+ d3dWrap = D3DTADDRESS_CLAMP;
+ break;
+ case GL_CLAMP_TO_BORDER:
+ d3dWrap = D3DTADDRESS_BORDER;
+ break;
+ case GL_MIRRORED_REPEAT:
+ d3dWrap = D3DTADDRESS_MIRROR;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dWrap;
+}
+
+D3DCULL ConvertCullMode(gl::CullFaceMode cullFace, GLenum frontFace)
+{
+ D3DCULL cull = D3DCULL_CCW;
+ switch (cullFace)
+ {
+ case gl::CullFaceMode::Front:
+ cull = (frontFace == GL_CCW ? D3DCULL_CW : D3DCULL_CCW);
+ break;
+ case gl::CullFaceMode::Back:
+ cull = (frontFace == GL_CCW ? D3DCULL_CCW : D3DCULL_CW);
+ break;
+ case gl::CullFaceMode::FrontAndBack:
+ cull = D3DCULL_NONE; // culling will be handled during draw
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return cull;
+}
+
+D3DCUBEMAP_FACES ConvertCubeFace(gl::TextureTarget cubeFace)
+{
+ D3DCUBEMAP_FACES face = D3DCUBEMAP_FACE_POSITIVE_X;
+
+ switch (cubeFace)
+ {
+ case gl::TextureTarget::CubeMapPositiveX:
+ face = D3DCUBEMAP_FACE_POSITIVE_X;
+ break;
+ case gl::TextureTarget::CubeMapNegativeX:
+ face = D3DCUBEMAP_FACE_NEGATIVE_X;
+ break;
+ case gl::TextureTarget::CubeMapPositiveY:
+ face = D3DCUBEMAP_FACE_POSITIVE_Y;
+ break;
+ case gl::TextureTarget::CubeMapNegativeY:
+ face = D3DCUBEMAP_FACE_NEGATIVE_Y;
+ break;
+ case gl::TextureTarget::CubeMapPositiveZ:
+ face = D3DCUBEMAP_FACE_POSITIVE_Z;
+ break;
+ case gl::TextureTarget::CubeMapNegativeZ:
+ face = D3DCUBEMAP_FACE_NEGATIVE_Z;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return face;
+}
+
+DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha)
+{
+ return (red ? D3DCOLORWRITEENABLE_RED : 0) | (green ? D3DCOLORWRITEENABLE_GREEN : 0) |
+ (blue ? D3DCOLORWRITEENABLE_BLUE : 0) | (alpha ? D3DCOLORWRITEENABLE_ALPHA : 0);
+}
+
+D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy)
+{
+ if (maxAnisotropy > 1.0f)
+ {
+ return D3DTEXF_ANISOTROPIC;
+ }
+
+ D3DTEXTUREFILTERTYPE d3dMagFilter = D3DTEXF_POINT;
+ switch (magFilter)
+ {
+ case GL_NEAREST:
+ d3dMagFilter = D3DTEXF_POINT;
+ break;
+ case GL_LINEAR:
+ d3dMagFilter = D3DTEXF_LINEAR;
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ return d3dMagFilter;
+}
+
+void ConvertMinFilter(GLenum minFilter,
+ D3DTEXTUREFILTERTYPE *d3dMinFilter,
+ D3DTEXTUREFILTERTYPE *d3dMipFilter,
+ float *d3dLodBias,
+ float maxAnisotropy,
+ size_t baseLevel)
+{
+ switch (minFilter)
+ {
+ case GL_NEAREST:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_NONE;
+ break;
+ case GL_LINEAR:
+ *d3dMinFilter = D3DTEXF_LINEAR;
+ *d3dMipFilter = D3DTEXF_NONE;
+ break;
+ case GL_NEAREST_MIPMAP_NEAREST:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_POINT;
+ break;
+ case GL_LINEAR_MIPMAP_NEAREST:
+ *d3dMinFilter = D3DTEXF_LINEAR;
+ *d3dMipFilter = D3DTEXF_POINT;
+ break;
+ case GL_NEAREST_MIPMAP_LINEAR:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_LINEAR;
+ break;
+ case GL_LINEAR_MIPMAP_LINEAR:
+ *d3dMinFilter = D3DTEXF_LINEAR;
+ *d3dMipFilter = D3DTEXF_LINEAR;
+ break;
+ default:
+ *d3dMinFilter = D3DTEXF_POINT;
+ *d3dMipFilter = D3DTEXF_NONE;
+ UNREACHABLE();
+ }
+
+ // Disabling mipmapping will always sample from level 0 of the texture. It is possible to work
+ // around this by modifying D3DSAMP_MAXMIPLEVEL to force a specific mip level to become the
+ // lowest sampled mip level and using a large negative value for D3DSAMP_MIPMAPLODBIAS to
+ // ensure that only the base mip level is sampled.
+ if (baseLevel > 0 && *d3dMipFilter == D3DTEXF_NONE)
+ {
+ *d3dMipFilter = D3DTEXF_POINT;
+ *d3dLodBias = -static_cast<float>(gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+ }
+ else
+ {
+ *d3dLodBias = 0.0f;
+ }
+
+ if (maxAnisotropy > 1.0f)
+ {
+ *d3dMinFilter = D3DTEXF_ANISOTROPIC;
+ }
+}
+
+D3DQUERYTYPE ConvertQueryType(gl::QueryType type)
+{
+ switch (type)
+ {
+ case gl::QueryType::AnySamples:
+ case gl::QueryType::AnySamplesConservative:
+ return D3DQUERYTYPE_OCCLUSION;
+ case gl::QueryType::CommandsCompleted:
+ return D3DQUERYTYPE_EVENT;
+ default:
+ UNREACHABLE();
+ return static_cast<D3DQUERYTYPE>(0);
+ }
+}
+
+D3DMULTISAMPLE_TYPE GetMultisampleType(GLuint samples)
+{
+ return (samples > 1) ? static_cast<D3DMULTISAMPLE_TYPE>(samples) : D3DMULTISAMPLE_NONE;
+}
+
+} // namespace gl_d3d9
+
+namespace d3d9_gl
+{
+
+unsigned int GetReservedVaryingVectors()
+{
+ // We reserve two registers for "dx_Position" and "gl_Position". The spec says they
+ // don't count towards the varying limit, so we must make space for them. We also
+ // reserve the last register since it can only pass a PSIZE, and not any arbitrary
+ // varying.
+ return 3;
+}
+
+unsigned int GetReservedVertexUniformVectors()
+{
+ return 3; // dx_ViewCoords, dx_ViewAdjust and dx_DepthRange.
+}
+
+unsigned int GetReservedFragmentUniformVectors()
+{
+ return 3; // dx_ViewCoords, dx_DepthFront and dx_DepthRange.
+}
+
+GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type)
+{
+ return (type != D3DMULTISAMPLE_NONMASKABLE) ? type : 0;
+}
+
+bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format)
+{
+ GLenum internalFormat = d3d9::GetD3DFormatInfo(d3dformat).info().glInternalFormat;
+ GLenum convertedFormat = gl::GetSizedInternalFormatInfo(internalFormat).format;
+ return convertedFormat == format;
+}
+
+static gl::TextureCaps GenerateTextureFormatCaps(GLenum internalFormat,
+ IDirect3D9 *d3d9,
+ D3DDEVTYPE deviceType,
+ UINT adapter,
+ D3DFORMAT adapterFormat)
+{
+ gl::TextureCaps textureCaps;
+
+ const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(internalFormat);
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat);
+
+ if (d3dFormatInfo.texFormat != D3DFMT_UNKNOWN)
+ {
+ if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
+ {
+ textureCaps.texturable = SUCCEEDED(d3d9->CheckDeviceFormat(
+ adapter, deviceType, adapterFormat, 0, D3DRTYPE_TEXTURE, d3dFormatInfo.texFormat));
+ }
+ else
+ {
+ textureCaps.texturable =
+ SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, 0,
+ D3DRTYPE_TEXTURE, d3dFormatInfo.texFormat)) &&
+ SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, 0,
+ D3DRTYPE_CUBETEXTURE, d3dFormatInfo.texFormat));
+ }
+
+ textureCaps.filterable = SUCCEEDED(
+ d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_QUERY_FILTER,
+ D3DRTYPE_TEXTURE, d3dFormatInfo.texFormat));
+ }
+
+ if (d3dFormatInfo.renderFormat != D3DFMT_UNKNOWN)
+ {
+ textureCaps.textureAttachment = SUCCEEDED(
+ d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_RENDERTARGET,
+ D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
+
+ if ((formatInfo.depthBits > 0 || formatInfo.stencilBits > 0) &&
+ !textureCaps.textureAttachment)
+ {
+ textureCaps.textureAttachment = SUCCEEDED(
+ d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL,
+ D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
+ }
+ textureCaps.renderbuffer = textureCaps.textureAttachment;
+
+ textureCaps.sampleCounts.insert(1);
+ for (unsigned int i = D3DMULTISAMPLE_2_SAMPLES; i <= D3DMULTISAMPLE_16_SAMPLES; i++)
+ {
+ D3DMULTISAMPLE_TYPE multisampleType = D3DMULTISAMPLE_TYPE(i);
+
+ HRESULT result = d3d9->CheckDeviceMultiSampleType(
+ adapter, deviceType, d3dFormatInfo.renderFormat, TRUE, multisampleType, nullptr);
+ if (SUCCEEDED(result))
+ {
+ textureCaps.sampleCounts.insert(i);
+ }
+ }
+ }
+
+ return textureCaps;
+}
+
+void GenerateCaps(IDirect3D9 *d3d9,
+ IDirect3DDevice9 *device,
+ D3DDEVTYPE deviceType,
+ UINT adapter,
+ gl::Caps *caps,
+ gl::TextureCapsMap *textureCapsMap,
+ gl::Extensions *extensions,
+ gl::Limitations *limitations)
+{
+ D3DCAPS9 deviceCaps;
+ if (FAILED(d3d9->GetDeviceCaps(adapter, deviceType, &deviceCaps)))
+ {
+ // Can't continue with out device caps
+ return;
+ }
+
+ D3DDISPLAYMODE currentDisplayMode;
+ d3d9->GetAdapterDisplayMode(adapter, &currentDisplayMode);
+
+ GLuint maxSamples = 0;
+ for (GLenum internalFormat : gl::GetAllSizedInternalFormats())
+ {
+ gl::TextureCaps textureCaps = GenerateTextureFormatCaps(internalFormat, d3d9, deviceType,
+ adapter, currentDisplayMode.Format);
+ textureCapsMap->insert(internalFormat, textureCaps);
+
+ maxSamples = std::max(maxSamples, textureCaps.getMaxSamples());
+
+ if (gl::GetSizedInternalFormatInfo(internalFormat).compressed)
+ {
+ caps->compressedTextureFormats.push_back(internalFormat);
+ }
+ }
+
+ // GL core feature limits
+ caps->maxElementIndex = static_cast<GLint64>(std::numeric_limits<unsigned int>::max());
+
+ // 3D textures are unimplemented in D3D9
+ caps->max3DTextureSize = 1;
+
+ // Only one limit in GL, use the minimum dimension
+ caps->max2DTextureSize = std::min(deviceCaps.MaxTextureWidth, deviceCaps.MaxTextureHeight);
+
+ // D3D treats cube maps as a special case of 2D textures
+ caps->maxCubeMapTextureSize = caps->max2DTextureSize;
+
+ // Array textures are not available in D3D9
+ caps->maxArrayTextureLayers = 1;
+
+ // ES3-only feature
+ caps->maxLODBias = 0.0f;
+
+ // No specific limits on render target size, maximum 2D texture size is equivalent
+ caps->maxRenderbufferSize = caps->max2DTextureSize;
+
+ // Draw buffers are not supported in D3D9
+ caps->maxDrawBuffers = 1;
+ caps->maxColorAttachments = 1;
+
+ // No specific limits on viewport size, maximum 2D texture size is equivalent
+ caps->maxViewportWidth = caps->max2DTextureSize;
+ caps->maxViewportHeight = caps->maxViewportWidth;
+
+ // Point size is clamped to 1.0f when the shader model is less than 3
+ caps->minAliasedPointSize = 1.0f;
+ caps->maxAliasedPointSize =
+ ((D3DSHADER_VERSION_MAJOR(deviceCaps.PixelShaderVersion) >= 3) ? deviceCaps.MaxPointSize
+ : 1.0f);
+
+ // Wide lines not supported
+ caps->minAliasedLineWidth = 1.0f;
+ caps->maxAliasedLineWidth = 1.0f;
+
+ // Primitive count limits (unused in ES2)
+ caps->maxElementsIndices = 0;
+ caps->maxElementsVertices = 0;
+
+ // Program and shader binary formats (no supported shader binary formats)
+ caps->programBinaryFormats.push_back(GL_PROGRAM_BINARY_ANGLE);
+
+ caps->vertexHighpFloat.setIEEEFloat();
+ caps->vertexMediumpFloat.setIEEEFloat();
+ caps->vertexLowpFloat.setIEEEFloat();
+ caps->fragmentHighpFloat.setIEEEFloat();
+ caps->fragmentMediumpFloat.setIEEEFloat();
+ caps->fragmentLowpFloat.setIEEEFloat();
+
+ // Some (most) hardware only supports single-precision floating-point numbers,
+ // which can accurately represent integers up to +/-16777216
+ caps->vertexHighpInt.setSimulatedInt(24);
+ caps->vertexMediumpInt.setSimulatedInt(24);
+ caps->vertexLowpInt.setSimulatedInt(24);
+ caps->fragmentHighpInt.setSimulatedInt(24);
+ caps->fragmentMediumpInt.setSimulatedInt(24);
+ caps->fragmentLowpInt.setSimulatedInt(24);
+
+ // WaitSync is ES3-only, set to zero
+ caps->maxServerWaitTimeout = 0;
+
+ // Vertex shader limits
+ caps->maxVertexAttributes = 16;
+ // Vertex Attrib Binding not supported.
+ caps->maxVertexAttribBindings = caps->maxVertexAttributes;
+
+ const size_t MAX_VERTEX_CONSTANT_VECTORS_D3D9 = 256;
+ caps->maxVertexUniformVectors =
+ MAX_VERTEX_CONSTANT_VECTORS_D3D9 - GetReservedVertexUniformVectors();
+ caps->maxShaderUniformComponents[gl::ShaderType::Vertex] = caps->maxVertexUniformVectors * 4;
+
+ caps->maxShaderUniformBlocks[gl::ShaderType::Vertex] = 0;
+
+ // SM3 only supports 12 output variables, but the special 12th register is only for PSIZE.
+ const unsigned int MAX_VERTEX_OUTPUT_VECTORS_SM3 = 12 - GetReservedVaryingVectors();
+ const unsigned int MAX_VERTEX_OUTPUT_VECTORS_SM2 = 10 - GetReservedVaryingVectors();
+ caps->maxVertexOutputComponents =
+ ((deviceCaps.VertexShaderVersion >= D3DVS_VERSION(3, 0)) ? MAX_VERTEX_OUTPUT_VECTORS_SM3
+ : MAX_VERTEX_OUTPUT_VECTORS_SM2) *
+ 4;
+
+ // Only Direct3D 10 ready devices support all the necessary vertex texture formats.
+ // We test this using D3D9 by checking support for the R16F format.
+ if (deviceCaps.VertexShaderVersion >= D3DVS_VERSION(3, 0) &&
+ SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, currentDisplayMode.Format,
+ D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE,
+ D3DFMT_R16F)))
+ {
+ const size_t MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4;
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Vertex] = MAX_TEXTURE_IMAGE_UNITS_VTF_SM3;
+ }
+ else
+ {
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Vertex] = 0;
+ }
+
+ // Fragment shader limits
+ const size_t MAX_PIXEL_CONSTANT_VECTORS_SM3 = 224;
+ const size_t MAX_PIXEL_CONSTANT_VECTORS_SM2 = 32;
+ caps->maxFragmentUniformVectors =
+ ((deviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0)) ? MAX_PIXEL_CONSTANT_VECTORS_SM3
+ : MAX_PIXEL_CONSTANT_VECTORS_SM2) -
+ GetReservedFragmentUniformVectors();
+ caps->maxShaderUniformComponents[gl::ShaderType::Fragment] =
+ caps->maxFragmentUniformVectors * 4;
+ caps->maxShaderUniformBlocks[gl::ShaderType::Fragment] = 0;
+ caps->maxFragmentInputComponents = caps->maxVertexOutputComponents;
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Fragment] = 16;
+ caps->minProgramTexelOffset = 0;
+ caps->maxProgramTexelOffset = 0;
+
+ // Aggregate shader limits (unused in ES2)
+ caps->maxUniformBufferBindings = 0;
+ caps->maxUniformBlockSize = 0;
+ caps->uniformBufferOffsetAlignment = 0;
+ caps->maxCombinedUniformBlocks = 0;
+ caps->maxCombinedShaderUniformComponents[gl::ShaderType::Vertex] = 0;
+ caps->maxCombinedShaderUniformComponents[gl::ShaderType::Fragment] = 0;
+ caps->maxVaryingComponents = 0;
+
+ // Aggregate shader limits
+ caps->maxVaryingVectors = caps->maxVertexOutputComponents / 4;
+ caps->maxCombinedTextureImageUnits = caps->maxShaderTextureImageUnits[gl::ShaderType::Vertex] +
+ caps->maxShaderTextureImageUnits[gl::ShaderType::Fragment];
+
+ // Transform feedback limits
+ caps->maxTransformFeedbackInterleavedComponents = 0;
+ caps->maxTransformFeedbackSeparateAttributes = 0;
+ caps->maxTransformFeedbackSeparateComponents = 0;
+
+ // Multisample limits
+ caps->maxSamples = maxSamples;
+
+ // GL extension support
+ extensions->setTextureExtensionSupport(*textureCapsMap);
+ extensions->elementIndexUint = deviceCaps.MaxVertexIndex >= (1 << 16);
+ extensions->getProgramBinary = true;
+ extensions->rgb8rgba8 = true;
+ extensions->readFormatBGRA = true;
+ extensions->pixelBufferObject = false;
+ extensions->mapBuffer = false;
+ extensions->mapBufferRange = false;
+
+ // D3D does not allow depth textures to have more than one mipmap level OES_depth_texture
+ // allows for that so we can't implement full support with the D3D9 back end.
+ extensions->depthTextureOES = false;
+
+ // textureRG is emulated and not performant.
+ extensions->textureRG = false;
+
+ D3DADAPTER_IDENTIFIER9 adapterId = {};
+ if (SUCCEEDED(d3d9->GetAdapterIdentifier(adapter, 0, &adapterId)))
+ {
+ // ATI cards on XP have problems with non-power-of-two textures.
+ extensions->textureNPOT = !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
+ !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
+ !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &&
+ !(!isWindowsVistaOrGreater() && IsAMD(adapterId.VendorId));
+
+ // Disable depth texture support on AMD cards (See ANGLE issue 839)
+ if (IsAMD(adapterId.VendorId))
+ {
+ extensions->depthTextureANGLE = false;
+ extensions->depthTextureOES = false;
+ }
+ }
+ else
+ {
+ extensions->textureNPOT = false;
+ }
+
+ extensions->drawBuffers = false;
+ extensions->textureStorage = true;
+
+ // Must support a minimum of 2:1 anisotropy for max anisotropy to be considered supported, per
+ // the spec
+ extensions->textureFilterAnisotropic =
+ (deviceCaps.RasterCaps & D3DPRASTERCAPS_ANISOTROPY) != 0 && deviceCaps.MaxAnisotropy >= 2;
+ extensions->maxTextureAnisotropy = static_cast<GLfloat>(deviceCaps.MaxAnisotropy);
+
+ // Check occlusion query support by trying to create one
+ IDirect3DQuery9 *occlusionQuery = nullptr;
+ extensions->occlusionQueryBoolean =
+ SUCCEEDED(device->CreateQuery(D3DQUERYTYPE_OCCLUSION, &occlusionQuery)) && occlusionQuery;
+ SafeRelease(occlusionQuery);
+
+ // Check event query support by trying to create one
+ IDirect3DQuery9 *eventQuery = nullptr;
+ extensions->fence =
+ SUCCEEDED(device->CreateQuery(D3DQUERYTYPE_EVENT, &eventQuery)) && eventQuery;
+ SafeRelease(eventQuery);
+
+ extensions->disjointTimerQuery = false;
+ extensions->robustness = true;
+ // It seems that only DirectX 10 and higher enforce the well-defined behavior of always
+ // returning zero values when out-of-bounds reads. See
+ // https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_robustness.txt
+ extensions->robustBufferAccessBehavior = false;
+ extensions->blendMinMax = true;
+ // Although according to
+ // https://docs.microsoft.com/en-us/windows/desktop/direct3ddxgi/format-support-for-direct3d-feature-level-9-1-hardware
+ // D3D9 doesn't have full blending capability for RGBA32F. But turns out it could provide
+ // correct blending result in reality. As a result of some regression reports by client app, we
+ // decided to turn floatBlend on for D3D9
+ extensions->floatBlend = true;
+ extensions->framebufferBlit = true;
+ extensions->framebufferMultisample = true;
+ extensions->instancedArraysANGLE = deviceCaps.PixelShaderVersion >= D3DPS_VERSION(3, 0);
+ // D3D9 requires at least one attribute that has a divisor of 0, which isn't required by the EXT
+ // extension
+ extensions->instancedArraysEXT = false;
+ extensions->packReverseRowOrder = true;
+ extensions->standardDerivatives =
+ (deviceCaps.PS20Caps.Caps & D3DPS20CAPS_GRADIENTINSTRUCTIONS) != 0;
+ extensions->shaderTextureLOD = true;
+ extensions->fragDepth = true;
+ extensions->textureUsage = true;
+ extensions->translatedShaderSource = true;
+ extensions->fboRenderMipmap = false;
+ extensions->discardFramebuffer = false; // It would be valid to set this to true, since
+ // glDiscardFramebufferEXT is just a hint
+ extensions->colorBufferFloat = false;
+ extensions->debugMarker = true;
+ extensions->eglImage = true;
+ extensions->eglImageExternal = true;
+ extensions->unpackSubimage = true;
+ extensions->packSubimage = true;
+ extensions->syncQuery = extensions->fence;
+ extensions->copyTexture = true;
+ extensions->textureBorderClamp = true;
+
+ // D3D9 has no concept of separate masks and refs for front and back faces in the depth stencil
+ // state.
+ limitations->noSeparateStencilRefsAndMasks = true;
+
+ // D3D9 shader models have limited support for looping, so the Appendix A
+ // index/loop limitations are necessary. Workarounds that are needed to
+ // support dynamic indexing of vectors on HLSL also don't work on D3D9.
+ limitations->shadersRequireIndexedLoopValidation = true;
+
+ // D3D9 cannot support constant color and alpha blend funcs together
+ limitations->noSimultaneousConstantColorAndAlphaBlendFunc = true;
+
+ // D3D9 cannot support packing more than one variable to a single varying.
+ // TODO(jmadill): Implement more sophisticated component packing in D3D9.
+ limitations->noFlexibleVaryingPacking = true;
+
+ // D3D9 does not support vertex attribute aliasing
+ limitations->noVertexAttributeAliasing = true;
+}
+
+} // namespace d3d9_gl
+
+namespace d3d9
+{
+
+GLuint ComputeBlockSize(D3DFORMAT format, GLuint width, GLuint height)
+{
+ const D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(format);
+ GLuint numBlocksWide = (width + d3dFormatInfo.blockWidth - 1) / d3dFormatInfo.blockWidth;
+ GLuint numBlocksHight = (height + d3dFormatInfo.blockHeight - 1) / d3dFormatInfo.blockHeight;
+ return (d3dFormatInfo.pixelBytes * numBlocksWide * numBlocksHight);
+}
+
+void MakeValidSize(bool isImage,
+ D3DFORMAT format,
+ GLsizei *requestWidth,
+ GLsizei *requestHeight,
+ int *levelOffset)
+{
+ const D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(format);
+
+ int upsampleCount = 0;
+ // Don't expand the size of full textures that are at least (blockWidth x blockHeight) already.
+ if (isImage || *requestWidth < static_cast<GLsizei>(d3dFormatInfo.blockWidth) ||
+ *requestHeight < static_cast<GLsizei>(d3dFormatInfo.blockHeight))
+ {
+ while (*requestWidth % d3dFormatInfo.blockWidth != 0 ||
+ *requestHeight % d3dFormatInfo.blockHeight != 0)
+ {
+ *requestWidth <<= 1;
+ *requestHeight <<= 1;
+ upsampleCount++;
+ }
+ }
+ *levelOffset = upsampleCount;
+}
+
+void InitializeFeatures(angle::FeaturesD3D *features)
+{
+ features->mrtPerfWorkaround.enabled = true;
+ features->setDataFasterThanImageUpload.enabled = false;
+ features->setDataFasterThanImageUploadOn128bitFormats.enabled = false;
+ features->useInstancedPointSpriteEmulation.enabled = false;
+
+ // TODO(jmadill): Disable workaround when we have a fixed compiler DLL.
+ features->expandIntegerPowExpressions.enabled = true;
+
+ // Never clear for robust resource init. This matches Chrome's texture clearning behaviour.
+ features->allowClearForRobustResourceInit.enabled = false;
+
+ // Call platform hooks for testing overrides.
+ auto *platform = ANGLEPlatformCurrent();
+ platform->overrideWorkaroundsD3D(platform, features);
+}
+
+} // namespace d3d9
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h
new file mode 100644
index 0000000000..5780837fec
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h
@@ -0,0 +1,105 @@
+//
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// renderer9_utils.h: Conversion functions and other utility routines
+// specific to the D3D9 renderer
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
+
+#include "common/Color.h"
+#include "libANGLE/Caps.h"
+#include "libANGLE/Error.h"
+#include "platform/FeaturesD3D.h"
+
+namespace gl
+{
+class FramebufferAttachment;
+}
+
+namespace rx
+{
+class RenderTarget9;
+
+namespace gl_d3d9
+{
+
+D3DCMPFUNC ConvertComparison(GLenum comparison);
+D3DCOLOR ConvertColor(gl::ColorF color);
+D3DBLEND ConvertBlendFunc(GLenum blend);
+D3DBLENDOP ConvertBlendOp(GLenum blendOp);
+D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
+D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap);
+D3DCULL ConvertCullMode(gl::CullFaceMode cullFace, GLenum frontFace);
+D3DCUBEMAP_FACES ConvertCubeFace(gl::TextureTarget cubeFace);
+DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
+D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy);
+void ConvertMinFilter(GLenum minFilter,
+ D3DTEXTUREFILTERTYPE *d3dMinFilter,
+ D3DTEXTUREFILTERTYPE *d3dMipFilter,
+ float *d3dLodBias,
+ float maxAnisotropy,
+ size_t baseLevel);
+D3DQUERYTYPE ConvertQueryType(gl::QueryType type);
+
+D3DMULTISAMPLE_TYPE GetMultisampleType(GLuint samples);
+
+} // namespace gl_d3d9
+
+namespace d3d9_gl
+{
+
+unsigned int GetReservedVaryingVectors();
+
+unsigned int GetReservedVertexUniformVectors();
+
+unsigned int GetReservedFragmentUniformVectors();
+
+GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type);
+
+bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
+
+void GenerateCaps(IDirect3D9 *d3d9,
+ IDirect3DDevice9 *device,
+ D3DDEVTYPE deviceType,
+ UINT adapter,
+ gl::Caps *caps,
+ gl::TextureCapsMap *textureCapsMap,
+ gl::Extensions *extensions,
+ gl::Limitations *limitations);
+} // namespace d3d9_gl
+
+namespace d3d9
+{
+
+GLuint ComputeBlockSize(D3DFORMAT format, GLuint width, GLuint height);
+
+void MakeValidSize(bool isImage,
+ D3DFORMAT format,
+ GLsizei *requestWidth,
+ GLsizei *requestHeight,
+ int *levelOffset);
+
+inline bool isDeviceLostError(HRESULT errorCode)
+{
+ switch (errorCode)
+ {
+ case D3DERR_DRIVERINTERNALERROR:
+ case D3DERR_DEVICELOST:
+ case D3DERR_DEVICEHUNG:
+ case D3DERR_DEVICEREMOVED:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void InitializeFeatures(angle::FeaturesD3D *features);
+} // namespace d3d9
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h
new file mode 100644
index 0000000000..04868aeb9c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskpremultps.h
@@ -0,0 +1,50 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// float4 add;
+// float4 mult;
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// mult c0 1
+// add c1 1
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mul r0.xyz, r0.w, r0
+ mov r1, c0
+ mad r0, r0, r1, c1
+ mov oC0, r0
+
+// approximately 5 instruction slots used (1 texture, 4 arithmetic)
+#endif
+
+const BYTE g_ps20_componentmaskpremultps[] = {
+ 0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
+ 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
+ 0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
+ 0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
+ 0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
+ 95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
+ 54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 5, 0, 0, 3, 0, 0, 7, 128, 0, 0, 255, 128, 0, 0, 228, 128, 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};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h
new file mode 100644
index 0000000000..06673ae5f7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h
@@ -0,0 +1,48 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// float4 add;
+// float4 mult;
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// mult c0 1
+// add c1 1
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mov r1, c0
+ mad r0, r0, r1, c1
+ mov oC0, r0
+
+// approximately 4 instruction slots used (1 texture, 3 arithmetic)
+#endif
+
+const BYTE g_ps20_componentmaskps[] = {
+ 0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
+ 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
+ 0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
+ 0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
+ 0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
+ 95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
+ 54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 1, 0, 0, 2, 1, 0, 15, 128, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0,
+ 15, 128, 0, 0, 228, 128, 1, 0, 228, 128, 1, 0, 228, 160, 1, 0, 0, 2, 0,
+ 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h
new file mode 100644
index 0000000000..ad15364bb8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskunmultps.h
@@ -0,0 +1,54 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// float4 add;
+// float4 mult;
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// mult c0 1
+// add c1 1
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ rcp r1.w, r0.w
+ mul r1.xyz, r0, r1.w
+ cmp r0.xyz, -r0.w, r0, r1
+ mov r1, c0
+ mad r0, r0, r1, c1
+ mov oC0, r0
+
+// approximately 7 instruction slots used (1 texture, 6 arithmetic)
+#endif
+
+const BYTE g_ps20_componentmaskunmultps[] = {
+ 0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
+ 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
+ 0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
+ 0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
+ 0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
+ 95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
+ 54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 6, 0, 0, 2, 1, 0, 8, 128, 0, 0, 255, 128, 5, 0, 0, 3, 1, 0,
+ 7, 128, 0, 0, 228, 128, 1, 0, 255, 128, 88, 0, 0, 4, 0, 0, 7, 128, 0,
+ 0, 255, 129, 0, 0, 228, 128, 1, 0, 228, 128, 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};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h
new file mode 100644
index 0000000000..274a7824f9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminancepremultps.h
@@ -0,0 +1,50 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// float4 add;
+// float4 mult;
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// mult c0 1
+// add c1 1
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mul r0.xyz, r0.w, r0.x
+ mov r1, c0
+ mad r0, r0, r1, c1
+ mov oC0, r0
+
+// approximately 5 instruction slots used (1 texture, 4 arithmetic)
+#endif
+
+const BYTE g_ps20_luminancepremultps[] = {
+ 0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
+ 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
+ 0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
+ 0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
+ 0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
+ 95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
+ 54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 5, 0, 0, 3, 0, 0, 7, 128, 0, 0, 255, 128, 0, 0, 0, 128, 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};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h
new file mode 100644
index 0000000000..0be665c525
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h
@@ -0,0 +1,53 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// float4 add;
+// float4 mult;
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// mult c0 1
+// add c1 1
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mov r1.xw, c0
+ mad r0.x, r0.x, r1.x, c1.x
+ mad r0.y, r0.w, r1.w, c1.w
+ mov r1.xyz, r0.x
+ mov r1.w, r0.y
+ mov oC0, r1
+
+// approximately 7 instruction slots used (1 texture, 6 arithmetic)
+#endif
+
+const BYTE g_ps20_luminanceps[] = {
+ 0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
+ 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
+ 0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
+ 0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
+ 0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
+ 95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
+ 54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 1, 0, 0, 2, 1, 0, 9, 128, 0, 0, 228, 160, 4, 0, 0, 4, 0, 0,
+ 1, 128, 0, 0, 0, 128, 1, 0, 0, 128, 1, 0, 0, 160, 4, 0, 0, 4, 0,
+ 0, 2, 128, 0, 0, 255, 128, 1, 0, 255, 128, 1, 0, 255, 160, 1, 0, 0, 2,
+ 1, 0, 7, 128, 0, 0, 0, 128, 1, 0, 0, 2, 1, 0, 8, 128, 0, 0, 85,
+ 128, 1, 0, 0, 2, 0, 8, 15, 128, 1, 0, 228, 128, 255, 255, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h
new file mode 100644
index 0000000000..1100d0b088
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceunmultps.h
@@ -0,0 +1,54 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// float4 add;
+// float4 mult;
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// mult c0 1
+// add c1 1
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ rcp r1.w, r0.w
+ mul r1.x, r0.x, r1.w
+ cmp r0.xyz, -r0.w, r0.x, r1.x
+ mov r1, c0
+ mad r0, r0, r1, c1
+ mov oC0, r0
+
+// approximately 7 instruction slots used (1 texture, 6 arithmetic)
+#endif
+
+const BYTE g_ps20_luminanceunmultps[] = {
+ 0, 2, 255, 255, 254, 255, 50, 0, 67, 84, 65, 66, 28, 0, 0, 0, 143, 0, 0,
+ 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 136, 0,
+ 0, 0, 88, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 92, 0, 0, 0, 0,
+ 0, 0, 0, 108, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 92, 0, 0, 0,
+ 0, 0, 0, 0, 113, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 120, 0, 0,
+ 0, 0, 0, 0, 0, 97, 100, 100, 0, 1, 0, 3, 0, 1, 0, 4, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 109, 117, 108, 116, 0, 116, 101, 120, 0, 171, 171, 171, 4,
+ 0, 12, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50,
+ 95, 48, 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76,
+ 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32,
+ 54, 46, 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31,
+ 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144,
+ 0, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228,
+ 160, 6, 0, 0, 2, 1, 0, 8, 128, 0, 0, 255, 128, 5, 0, 0, 3, 1, 0,
+ 1, 128, 0, 0, 0, 128, 1, 0, 255, 128, 88, 0, 0, 4, 0, 0, 7, 128, 0,
+ 0, 255, 129, 0, 0, 0, 128, 1, 0, 0, 128, 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};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h
new file mode 100644
index 0000000000..0c17739e17
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h
@@ -0,0 +1,37 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// sampler2D tex;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// ------------ ----- ----
+// tex s0 1
+//
+
+ ps_2_0
+ dcl t0.xy
+ dcl_2d s0
+ texld r0, t0, s0
+ mov oC0, r0
+
+// approximately 2 instruction slots used (1 texture, 1 arithmetic)
+#endif
+
+const BYTE g_ps20_passthroughps[] = {
+ 0, 2, 255, 255, 254, 255, 33, 0, 67, 84, 65, 66, 28, 0, 0, 0, 75, 0,
+ 0, 0, 0, 2, 255, 255, 1, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0,
+ 68, 0, 0, 0, 48, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 52, 0,
+ 0, 0, 0, 0, 0, 0, 116, 101, 120, 0, 4, 0, 12, 0, 1, 0, 1, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 112, 115, 95, 50, 95, 48, 0, 77, 105, 99,
+ 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104,
+ 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 54, 46, 51, 46,
+ 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 171, 171, 171, 31, 0, 0, 2,
+ 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, 0, 0, 0, 144, 0, 8,
+ 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, 0, 8, 228, 160,
+ 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h
new file mode 100644
index 0000000000..e4d7e0e1a8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h
@@ -0,0 +1,46 @@
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+// float4 halfPixelSize;
+// float4 texcoordOffset;
+//
+//
+// Registers:
+//
+// Name Reg Size
+// -------------- ----- ----
+// halfPixelSize c0 1
+// texcoordOffset c1 1
+//
+
+ vs_2_0
+ def c2, 0.5, -0.5, 1, 0
+ dcl_position v0
+ add oPos, v0, c0
+ mad r0, v0, c2.xyzz, c2.xxww
+ mov oT0.zw, r0
+ mad oT0.xy, r0, c1.zwzw, c1
+
+// approximately 4 instruction slots used
+#endif
+
+const BYTE g_vs20_standardvs[] = {
+ 0, 2, 254, 255, 254, 255, 44, 0, 67, 84, 65, 66, 28, 0, 0, 0, 122, 0, 0,
+ 0, 0, 2, 254, 255, 2, 0, 0, 0, 28, 0, 0, 0, 0, 1, 0, 0, 115, 0,
+ 0, 0, 68, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 84, 0, 0, 0, 0,
+ 0, 0, 0, 100, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 84, 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, 116, 101,
+ 120, 99, 111, 111, 114, 100, 79, 102, 102, 115, 101, 116, 0, 118, 115, 95, 50, 95, 48,
+ 0, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76,
+ 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 54, 46,
+ 51, 46, 57, 54, 48, 48, 46, 49, 54, 51, 56, 52, 0, 81, 0, 0, 5, 2, 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, 128, 0, 0, 228,
+ 144, 2, 0, 164, 160, 2, 0, 240, 160, 1, 0, 0, 2, 0, 0, 12, 224, 0, 0,
+ 228, 128, 4, 0, 0, 4, 0, 0, 3, 224, 0, 0, 228, 128, 1, 0, 238, 160, 1,
+ 0, 228, 160, 255, 255, 0, 0};
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h
new file mode 100644
index 0000000000..8a702bcb61
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h
@@ -0,0 +1,197 @@
+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// vertexconversion.h: A library of vertex conversion classes that can be used to build
+// the FormatConverter objects used by the buffer conversion system.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <limits>
+
+namespace rx
+{
+
+// Conversion types:
+// static const bool identity: true if this is an identity transform, false otherwise
+// static U convert(T): convert a single element from the input type to the output type
+// typedef ... OutputType: the type produced by this conversion
+
+template <class T>
+struct Identity
+{
+ static const bool identity = true;
+
+ typedef T OutputType;
+
+ static T convert(T x) { return x; }
+};
+
+template <class FromT, class ToT>
+struct Cast
+{
+ static const bool identity = false;
+
+ typedef ToT OutputType;
+
+ static ToT convert(FromT x) { return static_cast<ToT>(x); }
+};
+
+template <class T>
+struct Cast<T, T>
+{
+ static const bool identity = true;
+
+ typedef T OutputType;
+
+ static T convert(T x) { return static_cast<T>(x); }
+};
+
+template <class T>
+struct Normalize
+{
+ static const bool identity = false;
+
+ typedef float OutputType;
+
+ static float convert(T x)
+ {
+ typedef std::numeric_limits<T> NL;
+ float f = static_cast<float>(x);
+
+ if (NL::is_signed)
+ {
+ // const float => VC2008 computes it at compile time
+ // static const float => VC2008 computes it the first time we get here, stores it to
+ // memory with static guard and all that.
+ const float divisor = 1.0f / (2 * static_cast<float>(NL::max()) + 1);
+ return (2 * f + 1) * divisor;
+ }
+ else
+ {
+ return f / NL::max();
+ }
+ }
+};
+
+template <class FromType, std::size_t ScaleBits>
+struct FixedToFloat
+{
+ static const bool identity = false;
+
+ typedef float OutputType;
+
+ static float convert(FromType x)
+ {
+ const float divisor = 1.0f / static_cast<float>(static_cast<FromType>(1) << ScaleBits);
+ return static_cast<float>(x) * divisor;
+ }
+};
+
+// Widen types:
+// static const unsigned int initialWidth: number of components before conversion
+// static const unsigned int finalWidth: number of components after conversion
+
+// Float is supported at any size.
+template <std::size_t N>
+struct NoWiden
+{
+ static const std::size_t initialWidth = N;
+ static const std::size_t finalWidth = N;
+};
+
+// SHORT, norm-SHORT, norm-UNSIGNED_SHORT are supported but only with 2 or 4 components
+template <std::size_t N>
+struct WidenToEven
+{
+ static const std::size_t initialWidth = N;
+ static const std::size_t finalWidth = N + (N & 1);
+};
+
+template <std::size_t N>
+struct WidenToFour
+{
+ static const std::size_t initialWidth = N;
+ static const std::size_t finalWidth = 4;
+};
+
+// Most types have 0 and 1 that are just that.
+template <class T>
+struct SimpleDefaultValues
+{
+ static T zero() { return static_cast<T>(0); }
+ static T one() { return static_cast<T>(1); }
+};
+
+// But normalised types only store [0,1] or [-1,1] so 1.0 is represented by the max value.
+template <class T>
+struct NormalizedDefaultValues
+{
+ static T zero() { return static_cast<T>(0); }
+ static T one() { return std::numeric_limits<T>::max(); }
+};
+
+// Converter:
+// static const bool identity: true if this is an identity transform (with no widening)
+// static const std::size_t finalSize: number of bytes per output vertex
+// static void convertArray(const void *in, std::size_t stride, std::size_t n, void *out): convert
+// an array of vertices. Input may be strided, but output will be unstrided.
+
+template <class InT,
+ class WidenRule,
+ class Converter,
+ class DefaultValueRule = SimpleDefaultValues<InT>>
+struct VertexDataConverter
+{
+ typedef typename Converter::OutputType OutputType;
+ typedef InT InputType;
+
+ static const bool identity =
+ (WidenRule::initialWidth == WidenRule::finalWidth) && Converter::identity;
+ static const std::size_t finalSize = WidenRule::finalWidth * sizeof(OutputType);
+
+ static void convertArray(const uint8_t *input, size_t stride, size_t n, uint8_t *output)
+ {
+ OutputType *out = reinterpret_cast<OutputType *>(output);
+
+ for (std::size_t i = 0; i < n; i++)
+ {
+ const InputType *ein = reinterpret_cast<const InputType *>(input + i * stride);
+
+ copyComponent(out, ein, 0, static_cast<OutputType>(DefaultValueRule::zero()));
+ copyComponent(out, ein, 1, static_cast<OutputType>(DefaultValueRule::zero()));
+ copyComponent(out, ein, 2, static_cast<OutputType>(DefaultValueRule::zero()));
+ copyComponent(out, ein, 3, static_cast<OutputType>(DefaultValueRule::one()));
+
+ out += WidenRule::finalWidth;
+ }
+ }
+
+ private:
+ static void copyComponent(OutputType *out,
+ const InputType *in,
+ std::size_t elementindex,
+ OutputType defaultvalue)
+ {
+ if (WidenRule::finalWidth > elementindex)
+ {
+ if (WidenRule::initialWidth > elementindex)
+ {
+ out[elementindex] = Converter::convert(in[elementindex]);
+ }
+ else
+ {
+ out[elementindex] = defaultvalue;
+ }
+ }
+ }
+};
+
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/formatutilsD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/formatutilsD3D.h
new file mode 100644
index 0000000000..00d749dd0d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/formatutilsD3D.h
@@ -0,0 +1,24 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// formatutils9.h: Queries for GL image formats and their translations to D3D
+// formats.
+
+#ifndef LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
+#define LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
+
+namespace rx
+{
+enum VertexConversionType
+{
+ VERTEX_CONVERT_NONE = 0,
+ VERTEX_CONVERT_CPU = 1,
+ VERTEX_CONVERT_GPU = 2,
+ VERTEX_CONVERT_BOTH = 3
+};
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/driver_utils.cpp b/gfx/angle/checkout/src/libANGLE/renderer/driver_utils.cpp
new file mode 100644
index 0000000000..2a4771ed7e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/driver_utils.cpp
@@ -0,0 +1,209 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// driver_utils.h : provides more information about current driver.
+
+#include <algorithm>
+
+#include "libANGLE/renderer/driver_utils.h"
+
+#include "common/platform.h"
+
+#if defined(ANGLE_PLATFORM_ANDROID)
+# include <sys/system_properties.h>
+#endif
+
+namespace rx
+{
+// Intel
+// Referenced from https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_pciids.h
+namespace
+{
+// gen6
+const uint32_t SandyBridge[] = {0x0102, 0x0106, 0x010A, 0x0112, 0x0116, 0x0122, 0x0126};
+
+// gen7
+const uint32_t IvyBridge[] = {0x0152, 0x0156, 0x015A, 0x0162, 0x0166, 0x016A};
+
+const uint32_t Haswell[] = {
+ 0x0402, 0x0406, 0x040A, 0x040B, 0x040E, 0x0C02, 0x0C06, 0x0C0A, 0x0C0B, 0x0C0E,
+ 0x0A02, 0x0A06, 0x0A0A, 0x0A0B, 0x0A0E, 0x0D02, 0x0D06, 0x0D0A, 0x0D0B, 0x0D0E, // hsw_gt1
+ 0x0412, 0x0416, 0x041A, 0x041B, 0x041E, 0x0C12, 0x0C16, 0x0C1A, 0x0C1B, 0x0C1E,
+ 0x0A12, 0x0A16, 0x0A1A, 0x0A1B, 0x0A1E, 0x0D12, 0x0D16, 0x0D1A, 0x0D1B, 0x0D1E, // hsw_gt2
+ 0x0422, 0x0426, 0x042A, 0x042B, 0x042E, 0x0C22, 0x0C26, 0x0C2A, 0x0C2B, 0x0C2E,
+ 0x0A22, 0x0A26, 0x0A2A, 0x0A2B, 0x0A2E, 0x0D22, 0x0D26, 0x0D2A, 0x0D2B, 0x0D2E // hsw_gt3
+};
+
+// gen8
+const uint32_t Broadwell[] = {0x1602, 0x1606, 0x160A, 0x160B, 0x160D, 0x160E,
+ 0x1612, 0x1616, 0x161A, 0x161B, 0x161D, 0x161E,
+ 0x1622, 0x1626, 0x162A, 0x162B, 0x162D, 0x162E};
+
+const uint32_t CherryView[] = {0x22B0, 0x22B1, 0x22B2, 0x22B3};
+
+// gen9
+const uint32_t Skylake[] = {0x1902, 0x1906, 0x190A, 0x190B, 0x190E, 0x1912, 0x1913, 0x1915, 0x1916,
+ 0x1917, 0x191A, 0x191B, 0x191D, 0x191E, 0x1921, 0x1923, 0x1926, 0x1927,
+ 0x192A, 0x192B, 0x192D, 0x1932, 0x193A, 0x193B, 0x193D};
+
+const uint32_t Broxton[] = {0x0A84, 0x1A84, 0x1A85, 0x5A84, 0x5A85};
+
+// gen9p5
+const uint32_t Kabylake[] = {0x5916, 0x5913, 0x5906, 0x5926, 0x5921, 0x5915, 0x590E,
+ 0x591E, 0x5912, 0x5917, 0x5902, 0x591B, 0x593B, 0x590B,
+ 0x591A, 0x590A, 0x591D, 0x5908, 0x5923, 0x5927};
+
+} // anonymous namespace
+
+IntelDriverVersion::IntelDriverVersion(uint16_t lastPart) : mVersionPart(lastPart) {}
+
+bool IntelDriverVersion::operator==(const IntelDriverVersion &version)
+{
+ return mVersionPart == version.mVersionPart;
+}
+
+bool IntelDriverVersion::operator!=(const IntelDriverVersion &version)
+{
+ return !(*this == version);
+}
+
+bool IntelDriverVersion::operator<(const IntelDriverVersion &version)
+{
+ // See http://www.intel.com/content/www/us/en/support/graphics-drivers/000005654.html to
+ // understand the Intel graphics driver version number on Windows.
+ // mVersionPart1 changes with OS version. mVersionPart2 changes with DirectX version.
+ // mVersionPart3 stands for release year. mVersionPart4 is driver specific unique version
+ // number.
+ // For example: Intel driver version '20.19.15.4539'
+ // 20 -> windows 10 driver
+ // 19 -> DirectX 12 first version(12.0) supported
+ // 15 -> Driver released in 2015
+ // 4539 -> Driver specific unique version number
+ // For linux, Intel graphics driver version is the mesa version. The version number has three
+ // parts: major revision, minor revision, release number. So, for linux, we need to compare
+ // three parts.
+ // Currently, it's only used in windows. So, checking the last part is enough. Once it's needed
+ // in other platforms, it's easy to be extended.
+ return mVersionPart < version.mVersionPart;
+}
+
+bool IntelDriverVersion::operator>=(const IntelDriverVersion &version)
+{
+ return !(*this < version);
+}
+
+bool IsSandyBridge(uint32_t DeviceId)
+{
+ return std::find(std::begin(SandyBridge), std::end(SandyBridge), DeviceId) != std::end(SandyBridge);
+}
+
+bool IsIvyBridge(uint32_t DeviceId)
+{
+ return std::find(std::begin(IvyBridge), std::end(IvyBridge), DeviceId) != std::end(IvyBridge);
+}
+
+bool IsHaswell(uint32_t DeviceId)
+{
+ return std::find(std::begin(Haswell), std::end(Haswell), DeviceId) != std::end(Haswell);
+}
+
+bool IsBroadwell(uint32_t DeviceId)
+{
+ return std::find(std::begin(Broadwell), std::end(Broadwell), DeviceId) != std::end(Broadwell);
+}
+
+bool IsCherryView(uint32_t DeviceId)
+{
+ return std::find(std::begin(CherryView), std::end(CherryView), DeviceId) !=
+ std::end(CherryView);
+}
+
+bool IsSkylake(uint32_t DeviceId)
+{
+ return std::find(std::begin(Skylake), std::end(Skylake), DeviceId) != std::end(Skylake);
+}
+
+bool IsBroxton(uint32_t DeviceId)
+{
+ return std::find(std::begin(Broxton), std::end(Broxton), DeviceId) != std::end(Broxton);
+}
+
+bool IsKabylake(uint32_t DeviceId)
+{
+ return std::find(std::begin(Kabylake), std::end(Kabylake), DeviceId) != std::end(Kabylake);
+}
+
+const char *GetVendorString(uint32_t vendorId)
+{
+ switch (vendorId)
+ {
+ case VENDOR_ID_AMD:
+ return "Advanced Micro Devices";
+ case VENDOR_ID_NVIDIA:
+ return "NVIDIA";
+ case VENDOR_ID_INTEL:
+ return "Intel";
+ case VENDOR_ID_QUALCOMM:
+ return "Qualcomm";
+ case VENDOR_ID_ARM:
+ return "ARM";
+ default:
+ // TODO(jmadill): More vendor IDs.
+ ASSERT(vendorId == 0xba5eba11); // Mock vendor ID used for tests.
+ return "Unknown";
+ }
+}
+
+int GetAndroidSDKVersion()
+{
+#if defined(ANGLE_PLATFORM_ANDROID)
+ char apiVersion[PROP_VALUE_MAX];
+ int length = __system_property_get("ro.build.version.sdk", apiVersion);
+ if (length == 0)
+ {
+ return 0;
+ }
+ return atoi(apiVersion);
+#else
+ return 0;
+#endif
+}
+
+OSVersion::OSVersion() {}
+OSVersion::OSVersion(int major, int minor, int patch)
+ : majorVersion(major), minorVersion(minor), patchVersion(patch)
+{}
+
+bool operator==(const OSVersion &a, const OSVersion &b)
+{
+ return std::tie(a.majorVersion, a.minorVersion, a.patchVersion) ==
+ std::tie(b.majorVersion, b.minorVersion, b.patchVersion);
+}
+bool operator!=(const OSVersion &a, const OSVersion &b)
+{
+ return std::tie(a.majorVersion, a.minorVersion, a.patchVersion) !=
+ std::tie(b.majorVersion, b.minorVersion, b.patchVersion);
+}
+bool operator<(const OSVersion &a, const OSVersion &b)
+{
+ return std::tie(a.majorVersion, a.minorVersion, a.patchVersion) <
+ std::tie(b.majorVersion, b.minorVersion, b.patchVersion);
+}
+bool operator>=(const OSVersion &a, const OSVersion &b)
+{
+ return std::tie(a.majorVersion, a.minorVersion, a.patchVersion) >=
+ std::tie(b.majorVersion, b.minorVersion, b.patchVersion);
+}
+
+#if !defined(ANGLE_PLATFORM_APPLE)
+OSVersion GetMacOSVersion()
+{
+ // Return a default version
+ return OSVersion(0, 0, 0);
+}
+#endif
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/driver_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/driver_utils.h
new file mode 100644
index 0000000000..abd2608573
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/driver_utils.h
@@ -0,0 +1,162 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// driver_utils.h : provides more information about current driver.
+
+#ifndef LIBANGLE_RENDERER_DRIVER_UTILS_H_
+#define LIBANGLE_RENDERER_DRIVER_UTILS_H_
+
+#include "common/platform.h"
+#include "libANGLE/angletypes.h"
+
+namespace rx
+{
+
+enum VendorID : uint32_t
+{
+ VENDOR_ID_UNKNOWN = 0x0,
+ VENDOR_ID_AMD = 0x1002,
+ VENDOR_ID_ARM = 0x13B5,
+ VENDOR_ID_INTEL = 0x8086,
+ VENDOR_ID_NVIDIA = 0x10DE,
+ // This is Qualcomm PCI Vendor ID.
+ // Android doesn't have a PCI bus, but all we need is a unique id.
+ VENDOR_ID_QUALCOMM = 0x5143,
+};
+
+enum AndroidDeviceID : uint32_t
+{
+ ANDROID_DEVICE_ID_UNKNOWN = 0x0,
+ ANDROID_DEVICE_ID_NEXUS5X = 0x4010800,
+ ANDROID_DEVICE_ID_PIXEL1XL = 0x5040001,
+ ANDROID_DEVICE_ID_PIXEL2 = 0x5030004,
+};
+
+inline bool IsAMD(uint32_t vendorId)
+{
+ return vendorId == VENDOR_ID_AMD;
+}
+
+inline bool IsARM(uint32_t vendorId)
+{
+ return vendorId == VENDOR_ID_ARM;
+}
+
+inline bool IsIntel(uint32_t vendorId)
+{
+ return vendorId == VENDOR_ID_INTEL;
+}
+
+inline bool IsNvidia(uint32_t vendorId)
+{
+ return vendorId == VENDOR_ID_NVIDIA;
+}
+
+inline bool IsQualcomm(uint32_t vendorId)
+{
+ return vendorId == VENDOR_ID_QUALCOMM;
+}
+
+inline bool IsNexus5X(uint32_t vendorId, uint32_t deviceId)
+{
+ return IsQualcomm(vendorId) && deviceId == ANDROID_DEVICE_ID_NEXUS5X;
+}
+
+inline bool IsPixel1XL(uint32_t vendorId, uint32_t deviceId)
+{
+ return IsQualcomm(vendorId) && deviceId == ANDROID_DEVICE_ID_PIXEL1XL;
+}
+
+inline bool IsPixel2(uint32_t vendorId, uint32_t deviceId)
+{
+ return IsQualcomm(vendorId) && deviceId == ANDROID_DEVICE_ID_PIXEL2;
+}
+
+const char *GetVendorString(uint32_t vendorId);
+
+// Intel
+class IntelDriverVersion
+{
+ public:
+ // Currently, We only provide the constructor with one parameter. It mainly used in Intel
+ // version number on windows. If you want to use this class on other platforms, it's easy to
+ // be extended.
+ IntelDriverVersion(uint16_t lastPart);
+ bool operator==(const IntelDriverVersion &);
+ bool operator!=(const IntelDriverVersion &);
+ bool operator<(const IntelDriverVersion &);
+ bool operator>=(const IntelDriverVersion &);
+
+ private:
+ uint16_t mVersionPart;
+};
+
+bool IsSandyBridge(uint32_t DeviceId);
+bool IsIvyBridge(uint32_t DeviceId);
+bool IsHaswell(uint32_t DeviceId);
+bool IsBroadwell(uint32_t DeviceId);
+bool IsCherryView(uint32_t DeviceId);
+bool IsSkylake(uint32_t DeviceId);
+bool IsBroxton(uint32_t DeviceId);
+bool IsKabylake(uint32_t DeviceId);
+
+// Platform helpers
+inline bool IsWindows()
+{
+#if defined(ANGLE_PLATFORM_WINDOWS)
+ return true;
+#else
+ return false;
+#endif
+}
+
+inline bool IsLinux()
+{
+#if defined(ANGLE_PLATFORM_LINUX)
+ return true;
+#else
+ return false;
+#endif
+}
+
+inline bool IsApple()
+{
+#if defined(ANGLE_PLATFORM_APPLE)
+ return true;
+#else
+ return false;
+#endif
+}
+
+struct OSVersion
+{
+ OSVersion();
+ OSVersion(int major, int minor, int patch);
+
+ int majorVersion = 0;
+ int minorVersion = 0;
+ int patchVersion = 0;
+};
+bool operator==(const OSVersion &a, const OSVersion &b);
+bool operator!=(const OSVersion &a, const OSVersion &b);
+bool operator<(const OSVersion &a, const OSVersion &b);
+bool operator>=(const OSVersion &a, const OSVersion &b);
+
+OSVersion GetMacOSVersion();
+
+inline bool IsAndroid()
+{
+#if defined(ANGLE_PLATFORM_ANDROID)
+ return true;
+#else
+ return false;
+#endif
+}
+
+int GetAndroidSDKVersion();
+
+} // namespace rx
+#endif // LIBANGLE_RENDERER_DRIVER_UTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table.h b/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table.h
new file mode 100644
index 0000000000..27eaebc8e7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table.h
@@ -0,0 +1,20 @@
+//
+// Copyright 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// load_functions_table:
+// Contains load functions table depending on internal format and ANGLE format.
+//
+
+#ifndef LIBANGLE_RENDERER_LOADFUNCTIONSTABLE_H_
+#define LIBANGLE_RENDERER_LOADFUNCTIONSTABLE_H_
+
+#include "libANGLE/renderer/Format.h"
+
+namespace angle
+{
+rx::LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat);
+} // namespace angle
+
+#endif // LIBANGLE_RENDERER_LOADFUNCTIONSTABLE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp
new file mode 100644
index 0000000000..a06b12e78b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp
@@ -0,0 +1,4118 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_load_functions_table.py using data from load_functions_data.json
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// load_functions_table:
+// Contains the GetLoadFunctionsMap for texture_format_util.h
+//
+
+#include "libANGLE/renderer/load_functions_table.h"
+
+#include "image_util/copyimage.h"
+#include "image_util/generatemip.h"
+#include "image_util/loadimage.h"
+
+using namespace rx;
+
+namespace angle
+{
+
+namespace
+{
+
+// ES3 image loading functions vary based on:
+// - the GL internal format (supplied to glTex*Image*D)
+// - the GL data type given (supplied to glTex*Image*D)
+// - the target DXGI_FORMAT that the image will be loaded into (which is chosen based on the D3D
+// device's capabilities)
+// This map type determines which loading function to use, based on these three parameters.
+// Source formats and types are taken from Tables 3.2 and 3.3 of the ES 3 spec.
+void UnimplementedLoadFunction(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ UNIMPLEMENTED();
+}
+
+void UnreachableLoadFunction(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch)
+{
+ UNREACHABLE();
+}
+
+LoadImageFunctionInfo A1RGB5_ANGLEX_to_A1R5G5B5_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGB5A1ToRGBA8, true);
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA_to_R16G16B16A16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadA16FToRGBA16F, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadA16FToRGBA16F, true);
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA_to_R32G32B32A32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadA32FToRGBA32F, true);
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA16F_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadA16FToRGBA16F, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadA16FToRGBA16F, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA32F_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadA32FToRGBA32F, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA8_EXT_to_A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA8_EXT_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadA8ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ALPHA8_EXT_to_R8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGR565_ANGLEX_to_B5G6R5_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGB8ToBGR565, true);
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return LoadImageFunctionInfo(LoadRGB565ToBGR565, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGR5_A1_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGB5A1ToRGBA8, true);
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGRA4_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ return LoadImageFunctionInfo(LoadRGBA4ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGRA8_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGRA8_SRGB_ANGLEX_to_B8G8R8A8_UNORM_SRGB(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGRA_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGRX8_ANGLEX_to_B8G8R8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo BGRX8_ANGLEX_to_B8G8R8X8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_R11_EAC_to_EAC_R11_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_R11_EAC_to_R16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadEACR11ToR16, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RG11_EAC_to_EAC_R11G11_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RG11_EAC_to_R16G16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadEACRG11ToRG16, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB8_ETC2_to_ETC2_R8G8B8_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB8_ETC2_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2RGB8ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGB_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2RGB8ToBC1, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_ETC2_R8G8B8A1_UNORM_BLOCK(
+ GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2RGB8A1ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo
+COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGBA_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2RGB8A1ToBC1, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA8_ETC2_EAC_to_ETC2_R8G8B8A8_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA8_ETC2_EAC_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2RGBA8ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x10_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 10, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x6_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 6, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_10x8_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 8, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_12x10_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<12, 10, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_12x12_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<12, 12, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_3x3x3_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<3, 3, 3, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x3x3_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 3, 3, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x4_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x4x3_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 3, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_4x4x4_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 4, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x4_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x4x4_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 4, 4, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x5x4_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 5, 4, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_5x5x5_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 5, 5, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x5x5_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 5, 5, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x6_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 6, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x6x5_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 6, 5, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_6x6x6_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 6, 6, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<8, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x6_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<8, 6, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_ASTC_8x8_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<8, 8, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_BPTC_UNORM_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_S3TC_DXT1_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_S3TC_DXT3_ANGLE_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGBA_S3TC_DXT5_ANGLE_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_RGB_S3TC_DXT1_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SIGNED_R11_EAC_to_EAC_R11_SNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SIGNED_R11_EAC_to_R16_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadEACR11SToR16, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SIGNED_RG11_EAC_to_EAC_R11G11_SNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SIGNED_RG11_EAC_to_R16G16_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadEACRG11SToRG16, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 10, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 6, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<10, 8, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<12, 10, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<12, 12, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<3, 3, 3, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 3, 3, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 3, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 4, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 4, 4, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 5, 4, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<5, 5, 5, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 5, 5, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 6, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 6, 5, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<6, 6, 6, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<8, 5, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<8, 6, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<8, 8, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ETC2_EAC_to_ETC2_R8G8B8A8_SRGB_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ALPHA8_ETC2_EAC_to_R8G8B8A8_UNORM_SRGB(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2SRGBA8ToSRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ETC2_to_ETC2_R8G8B8_SRGB_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_ETC2_to_R8G8B8A8_UNORM_SRGB(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2SRGB8ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGB_UNORM_SRGB_BLOCK(
+ GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2SRGB8ToBC1, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_ETC2_R8G8B8A1_SRGB_BLOCK(
+ GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_R8G8B8A8_UNORM_SRGB(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2SRGB8A1ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo
+COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGBA_UNORM_SRGB_BLOCK(
+ GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC2SRGB8A1ToBC1, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 16>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo COMPRESSED_SRGB_S3TC_DXT1_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH24_STENCIL8_to_D24_UNORM_S8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_24_8:
+ return LoadImageFunctionInfo(LoadR32ToR24G8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH24_STENCIL8_to_D32_FLOAT_S8X24_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_24_8:
+ return LoadImageFunctionInfo(LoadD24S8ToD32FS8X24, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH32F_STENCIL8_to_D24_UNORM_S8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ return LoadImageFunctionInfo(LoadD32FS8X24ToD24S8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH32F_STENCIL8_to_D32_FLOAT_S8X24_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ return LoadImageFunctionInfo(LoadD32FS8X24ToD32FS8X24, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH_COMPONENT16_to_D16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadR32ToR16, true);
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH_COMPONENT24_to_D24_UNORM_S8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadR32ToR24G8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH_COMPONENT24_to_D32_FLOAT_S8X24_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_24_8:
+ return LoadImageFunctionInfo(LoadD24S8ToD32FS8X24, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH_COMPONENT32F_to_D32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadD32FToD32F, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo DEPTH_COMPONENT32_OES_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadR32ToR24G8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ETC1_RGB8_LOSSY_DECODE_ANGLE_to_BC1_RGB_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC1RGB8ToBC1, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ETC1_RGB8_OES_to_ETC1_R8G8B8_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ETC1_RGB8_OES_to_ETC2_R8G8B8_UNORM_BLOCK(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadCompressedToNative<4, 4, 1, 8>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo ETC1_RGB8_OES_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadETC1RGB8ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_to_R16G16B16A16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadL16FToRGBA16F, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadL16FToRGBA16F, true);
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_to_R32G32B32A32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadL32FToRGBA32F, true);
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE16F_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadL16FToRGBA16F, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadL16FToRGBA16F, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE32F_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadL32FToRGBA32F, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE8_ALPHA8_EXT_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadLA8ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE8_ALPHA8_EXT_to_R8G8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE8_EXT_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadL8ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE8_EXT_to_R8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_ALPHA_to_R16G16B16A16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadLA16FToRGBA16F, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadLA16FToRGBA16F, true);
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_ALPHA_to_R32G32B32A32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadLA32FToRGBA32F, true);
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_ALPHA_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_ALPHA16F_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadLA16FToRGBA16F, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadLA16FToRGBA16F, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo LUMINANCE_ALPHA32F_EXT_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadLA32FToRGBA32F, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R11F_G11F_B10F_to_R11G11B10_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadRGB32FToRG11B10F, true);
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadRGB16FToRG11B10F, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadRGB16FToRG11B10F, true);
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R16F_to_R16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(Load32FTo16F<1>, true);
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 1>, false);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R16I_to_R16_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLshort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R16UI_to_R16_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R16_EXT_to_R16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R16_SNORM_EXT_to_R16_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R16_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R16_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R32F_to_R32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLfloat, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R32I_to_R32_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R32UI_to_R32_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R8_to_R8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R8I_to_R8_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R8UI_to_R8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R8_SNORM_to_R8_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R8_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo R8_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG16F_to_R16G16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(Load32FTo16F<2>, true);
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 2>, false);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG16I_to_R16G16_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLshort, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG16UI_to_R16G16_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG16_EXT_to_R16G16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG16_SNORM_EXT_to_R16G16_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG16_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG16_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG32F_to_R32G32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLfloat, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG32I_to_R32G32_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLint, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG32UI_to_R32G32_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG8_to_R8G8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG8I_to_R8G8_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG8UI_to_R8G8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG8_SNORM_to_R8G8_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 2>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG8_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RG8_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB10_A2_to_R10G10B10A2_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB10_A2UI_to_R10G10B10A2_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB10_A2_SINT_ANGLEX_to_R10G10B10A2_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGB10A2ToRGBA8, true);
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB10_A2_SNORM_ANGLEX_to_R10G10B10A2_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGB10A2ToRGBA8, true);
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB10_A2_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB10_A2_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16F_to_R16G16B16A16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadRGB32FToRGBA16F, true);
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLhalf, gl::Float16One>, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLhalf, gl::Float16One>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16F_to_R16G16B16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadRGB32FToRGB16F, true);
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 3>, false);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16I_to_R16G16B16A16_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLshort, 0x0001>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16I_to_R16G16B16_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLshort, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16UI_to_R16G16B16A16_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLushort, 0x0001>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16UI_to_R16G16B16_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16_EXT_to_R16G16B16A16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLushort, 0xFFFF>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16_EXT_to_R16G16B16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16_SNORM_EXT_to_R16G16B16A16_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLushort, 0x7FFF>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16_SNORM_EXT_to_R16G16B16_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB16_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB32F_to_R32G32B32A32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLfloat, gl::Float32One>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB32F_to_R32G32B32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLfloat, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB32I_to_R32G32B32A32_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_INT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLint, 0x00000001>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB32I_to_R32G32B32_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLint, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB32UI_to_R32G32B32A32_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLuint, 0x00000001>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB32UI_to_R32G32B32_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB565_to_B5G6R5_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGB8ToBGR565, true);
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB565_to_R5G6B5_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGB8ToBGR565, true);
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB565_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLubyte, 0xFF>, true);
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return LoadImageFunctionInfo(LoadR5G6B5ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB5_A1_to_A1R5G5B5_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGBA8ToBGR5A1, true);
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return LoadImageFunctionInfo(LoadRGB10A2ToBGR5A1, true);
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return LoadImageFunctionInfo(LoadRGB5A1ToA1RGB5, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB5_A1_to_B5G5R5A1_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGBA8ToBGR5A1, true);
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return LoadImageFunctionInfo(LoadRGB10A2ToBGR5A1, true);
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return LoadImageFunctionInfo(LoadRGB5A1ToA1RGB5, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB5_A1_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ return LoadImageFunctionInfo(LoadRGB10A2ToRGBA8, true);
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return LoadImageFunctionInfo(LoadRGB5A1ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLubyte, 0xFF>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8I_to_R8G8B8A8_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLbyte, 0x01>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8I_to_R8G8B8_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8UI_to_R8G8B8A8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLubyte, 0x01>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8UI_to_R8G8B8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8_SNORM_to_R8G8B8A8_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLbyte, 0x7F>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8_SNORM_to_R8G8B8_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 3>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB8_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGB9_E5_to_R9G9B9E5_SHAREDEXP(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadRGB32FToRGB9E5, true);
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadRGB16FToRGB9E5, true);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadRGB16FToRGB9E5, true);
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 1>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA16F_to_R16G16B16A16_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(Load32FTo16F<4>, true);
+ case GL_HALF_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 4>, false);
+ case GL_HALF_FLOAT_OES:
+ return LoadImageFunctionInfo(LoadToNative<GLhalf, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA16I_to_R16G16B16A16_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLshort, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA16UI_to_R16G16B16A16_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA16_EXT_to_R16G16B16A16_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA16_SNORM_EXT_to_R16G16B16A16_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_SHORT:
+ return LoadImageFunctionInfo(LoadToNative<GLushort, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA16_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA16_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA32F_to_R32G32B32A32_FLOAT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_FLOAT:
+ return LoadImageFunctionInfo(LoadToNative<GLfloat, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA32I_to_R32G32B32A32_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLint, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA32UI_to_R32G32B32A32_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_INT:
+ return LoadImageFunctionInfo(LoadToNative<GLuint, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA4_to_B4G4R4A4_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadRGBA8ToBGRA4, true);
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ return LoadImageFunctionInfo(LoadRGBA4ToARGB4, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA4_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ return LoadImageFunctionInfo(LoadRGBA4ToRGBA8, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA8_to_R8G8B8A8_UNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA8I_to_R8G8B8A8_SINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA8UI_to_R8G8B8A8_UINT(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA8_SNORM_to_R8G8B8A8_SNORM(GLenum type)
+{
+ switch (type)
+ {
+ case GL_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLbyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA8_SSCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo RGBA8_USCALED_ANGLEX_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo SRGB8_to_R8G8B8A8_UNORM_SRGB(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative3To4<GLubyte, 0xFF>, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo SRGB8_ALPHA8_to_R8G8B8A8_UNORM_SRGB(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(LoadToNative<GLubyte, 4>, false);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+LoadImageFunctionInfo STENCIL_INDEX8_to_default(GLenum type)
+{
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ return LoadImageFunctionInfo(UnimplementedLoadFunction, true);
+ default:
+ UNREACHABLE();
+ return LoadImageFunctionInfo(UnreachableLoadFunction, true);
+ }
+}
+
+} // namespace
+
+LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat)
+{
+ // clang-format off
+ switch (internalFormat)
+ {
+ case GL_A1RGB5_ANGLEX:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::A1R5G5B5_UNORM:
+ return A1RGB5_ANGLEX_to_A1R5G5B5_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_ALPHA:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_FLOAT:
+ return ALPHA_to_R16G16B16A16_FLOAT;
+ case FormatID::R32G32B32A32_FLOAT:
+ return ALPHA_to_R32G32B32A32_FLOAT;
+ default:
+ return ALPHA_to_default;
+ }
+ }
+ case GL_ALPHA16F_EXT:
+ return ALPHA16F_EXT_to_default;
+ case GL_ALPHA32F_EXT:
+ return ALPHA32F_EXT_to_default;
+ case GL_ALPHA8_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::A8_UNORM:
+ return ALPHA8_EXT_to_A8_UNORM;
+ case FormatID::R8G8B8A8_UNORM:
+ return ALPHA8_EXT_to_R8G8B8A8_UNORM;
+ case FormatID::R8_UNORM:
+ return ALPHA8_EXT_to_R8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BGR565_ANGLEX:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::B5G6R5_UNORM:
+ return BGR565_ANGLEX_to_B5G6R5_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BGR5_A1_ANGLEX:
+ return BGR5_A1_ANGLEX_to_default;
+ case GL_BGRA4_ANGLEX:
+ return BGRA4_ANGLEX_to_default;
+ case GL_BGRA8_EXT:
+ return BGRA8_EXT_to_default;
+ case GL_BGRA8_SRGB_ANGLEX:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::B8G8R8A8_UNORM_SRGB:
+ return BGRA8_SRGB_ANGLEX_to_B8G8R8A8_UNORM_SRGB;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_BGRA_EXT:
+ return BGRA_EXT_to_default;
+ case GL_BGRX8_ANGLEX:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::B8G8R8A8_UNORM:
+ return BGRX8_ANGLEX_to_B8G8R8A8_UNORM;
+ case FormatID::B8G8R8X8_UNORM:
+ return BGRX8_ANGLEX_to_B8G8R8X8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_R11_EAC:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::EAC_R11_UNORM_BLOCK:
+ return COMPRESSED_R11_EAC_to_EAC_R11_UNORM_BLOCK;
+ case FormatID::R16_UNORM:
+ return COMPRESSED_R11_EAC_to_R16_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_RG11_EAC:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::EAC_R11G11_UNORM_BLOCK:
+ return COMPRESSED_RG11_EAC_to_EAC_R11G11_UNORM_BLOCK;
+ case FormatID::R16G16_UNORM:
+ return COMPRESSED_RG11_EAC_to_R16G16_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_RGB8_ETC2:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::ETC2_R8G8B8_UNORM_BLOCK:
+ return COMPRESSED_RGB8_ETC2_to_ETC2_R8G8B8_UNORM_BLOCK;
+ case FormatID::R8G8B8A8_UNORM:
+ return COMPRESSED_RGB8_ETC2_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::BC1_RGB_UNORM_BLOCK:
+ return COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGB_UNORM_BLOCK;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::ETC2_R8G8B8A1_UNORM_BLOCK:
+ return COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_ETC2_R8G8B8A1_UNORM_BLOCK;
+ case FormatID::R8G8B8A8_UNORM:
+ return COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::BC1_RGBA_UNORM_BLOCK:
+ return COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGBA_UNORM_BLOCK;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_RGBA8_ETC2_EAC:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::ETC2_R8G8B8A8_UNORM_BLOCK:
+ return COMPRESSED_RGBA8_ETC2_EAC_to_ETC2_R8G8B8A8_UNORM_BLOCK;
+ case FormatID::R8G8B8A8_UNORM:
+ return COMPRESSED_RGBA8_ETC2_EAC_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
+ return COMPRESSED_RGBA_ASTC_10x10_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
+ return COMPRESSED_RGBA_ASTC_10x5_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
+ return COMPRESSED_RGBA_ASTC_10x6_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
+ return COMPRESSED_RGBA_ASTC_10x8_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
+ return COMPRESSED_RGBA_ASTC_12x10_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
+ return COMPRESSED_RGBA_ASTC_12x12_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_3x3x3_OES:
+ return COMPRESSED_RGBA_ASTC_3x3x3_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_4x3x3_OES:
+ return COMPRESSED_RGBA_ASTC_4x3x3_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
+ return COMPRESSED_RGBA_ASTC_4x4_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_4x4x3_OES:
+ return COMPRESSED_RGBA_ASTC_4x4x3_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_4x4x4_OES:
+ return COMPRESSED_RGBA_ASTC_4x4x4_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
+ return COMPRESSED_RGBA_ASTC_5x4_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_5x4x4_OES:
+ return COMPRESSED_RGBA_ASTC_5x4x4_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
+ return COMPRESSED_RGBA_ASTC_5x5_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_5x5x4_OES:
+ return COMPRESSED_RGBA_ASTC_5x5x4_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_5x5x5_OES:
+ return COMPRESSED_RGBA_ASTC_5x5x5_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
+ return COMPRESSED_RGBA_ASTC_6x5_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_6x5x5_OES:
+ return COMPRESSED_RGBA_ASTC_6x5x5_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
+ return COMPRESSED_RGBA_ASTC_6x6_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_6x6x5_OES:
+ return COMPRESSED_RGBA_ASTC_6x6x5_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_6x6x6_OES:
+ return COMPRESSED_RGBA_ASTC_6x6x6_OES_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
+ return COMPRESSED_RGBA_ASTC_8x5_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
+ return COMPRESSED_RGBA_ASTC_8x6_KHR_to_default;
+ case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
+ return COMPRESSED_RGBA_ASTC_8x8_KHR_to_default;
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
+ return COMPRESSED_RGBA_BPTC_UNORM_EXT_to_default;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return COMPRESSED_RGBA_S3TC_DXT1_EXT_to_default;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ return COMPRESSED_RGBA_S3TC_DXT3_ANGLE_to_default;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ return COMPRESSED_RGBA_S3TC_DXT5_ANGLE_to_default;
+ case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT:
+ return COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT_to_default;
+ case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
+ return COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT_to_default;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return COMPRESSED_RGB_S3TC_DXT1_EXT_to_default;
+ case GL_COMPRESSED_SIGNED_R11_EAC:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::EAC_R11_SNORM_BLOCK:
+ return COMPRESSED_SIGNED_R11_EAC_to_EAC_R11_SNORM_BLOCK;
+ case FormatID::R16_SNORM:
+ return COMPRESSED_SIGNED_R11_EAC_to_R16_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_SIGNED_RG11_EAC:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::EAC_R11G11_SNORM_BLOCK:
+ return COMPRESSED_SIGNED_RG11_EAC_to_EAC_R11G11_SNORM_BLOCK;
+ case FormatID::R16G16_SNORM:
+ return COMPRESSED_SIGNED_RG11_EAC_to_R16G16_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+ return COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR_to_default;
+ case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::ETC2_R8G8B8A8_SRGB_BLOCK:
+ return COMPRESSED_SRGB8_ALPHA8_ETC2_EAC_to_ETC2_R8G8B8A8_SRGB_BLOCK;
+ case FormatID::R8G8B8A8_UNORM_SRGB:
+ return COMPRESSED_SRGB8_ALPHA8_ETC2_EAC_to_R8G8B8A8_UNORM_SRGB;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_SRGB8_ETC2:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::ETC2_R8G8B8_SRGB_BLOCK:
+ return COMPRESSED_SRGB8_ETC2_to_ETC2_R8G8B8_SRGB_BLOCK;
+ case FormatID::R8G8B8A8_UNORM_SRGB:
+ return COMPRESSED_SRGB8_ETC2_to_R8G8B8A8_UNORM_SRGB;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::BC1_RGB_UNORM_SRGB_BLOCK:
+ return COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGB_UNORM_SRGB_BLOCK;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::ETC2_R8G8B8A1_SRGB_BLOCK:
+ return COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_ETC2_R8G8B8A1_SRGB_BLOCK;
+ case FormatID::R8G8B8A8_UNORM_SRGB:
+ return COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2_to_R8G8B8A8_UNORM_SRGB;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::BC1_RGBA_UNORM_SRGB_BLOCK:
+ return COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE_to_BC1_RGBA_UNORM_SRGB_BLOCK;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
+ return COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT_to_default;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ return COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT_to_default;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ return COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT_to_default;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ return COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT_to_default;
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ return COMPRESSED_SRGB_S3TC_DXT1_EXT_to_default;
+ case GL_DEPTH24_STENCIL8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::D24_UNORM_S8_UINT:
+ return DEPTH24_STENCIL8_to_D24_UNORM_S8_UINT;
+ case FormatID::D32_FLOAT_S8X24_UINT:
+ return DEPTH24_STENCIL8_to_D32_FLOAT_S8X24_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_DEPTH32F_STENCIL8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::D24_UNORM_S8_UINT:
+ return DEPTH32F_STENCIL8_to_D24_UNORM_S8_UINT;
+ case FormatID::D32_FLOAT_S8X24_UINT:
+ return DEPTH32F_STENCIL8_to_D32_FLOAT_S8X24_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_DEPTH_COMPONENT16:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::D16_UNORM:
+ return DEPTH_COMPONENT16_to_D16_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_DEPTH_COMPONENT24:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::D24_UNORM_S8_UINT:
+ return DEPTH_COMPONENT24_to_D24_UNORM_S8_UINT;
+ case FormatID::D32_FLOAT_S8X24_UINT:
+ return DEPTH_COMPONENT24_to_D32_FLOAT_S8X24_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_DEPTH_COMPONENT32F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::D32_FLOAT:
+ return DEPTH_COMPONENT32F_to_D32_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_DEPTH_COMPONENT32_OES:
+ return DEPTH_COMPONENT32_OES_to_default;
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::BC1_RGB_UNORM_BLOCK:
+ return ETC1_RGB8_LOSSY_DECODE_ANGLE_to_BC1_RGB_UNORM_BLOCK;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_ETC1_RGB8_OES:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::ETC1_R8G8B8_UNORM_BLOCK:
+ return ETC1_RGB8_OES_to_ETC1_R8G8B8_UNORM_BLOCK;
+ case FormatID::ETC2_R8G8B8_UNORM_BLOCK:
+ return ETC1_RGB8_OES_to_ETC2_R8G8B8_UNORM_BLOCK;
+ case FormatID::R8G8B8A8_UNORM:
+ return ETC1_RGB8_OES_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_LUMINANCE:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_FLOAT:
+ return LUMINANCE_to_R16G16B16A16_FLOAT;
+ case FormatID::R32G32B32A32_FLOAT:
+ return LUMINANCE_to_R32G32B32A32_FLOAT;
+ default:
+ return LUMINANCE_to_default;
+ }
+ }
+ case GL_LUMINANCE16F_EXT:
+ return LUMINANCE16F_EXT_to_default;
+ case GL_LUMINANCE32F_EXT:
+ return LUMINANCE32F_EXT_to_default;
+ case GL_LUMINANCE8_ALPHA8_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UNORM:
+ return LUMINANCE8_ALPHA8_EXT_to_R8G8B8A8_UNORM;
+ case FormatID::R8G8_UNORM:
+ return LUMINANCE8_ALPHA8_EXT_to_R8G8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_LUMINANCE8_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UNORM:
+ return LUMINANCE8_EXT_to_R8G8B8A8_UNORM;
+ case FormatID::R8_UNORM:
+ return LUMINANCE8_EXT_to_R8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_LUMINANCE_ALPHA:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_FLOAT:
+ return LUMINANCE_ALPHA_to_R16G16B16A16_FLOAT;
+ case FormatID::R32G32B32A32_FLOAT:
+ return LUMINANCE_ALPHA_to_R32G32B32A32_FLOAT;
+ default:
+ return LUMINANCE_ALPHA_to_default;
+ }
+ }
+ case GL_LUMINANCE_ALPHA16F_EXT:
+ return LUMINANCE_ALPHA16F_EXT_to_default;
+ case GL_LUMINANCE_ALPHA32F_EXT:
+ return LUMINANCE_ALPHA32F_EXT_to_default;
+ case GL_R11F_G11F_B10F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R11G11B10_FLOAT:
+ return R11F_G11F_B10F_to_R11G11B10_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R16F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16_FLOAT:
+ return R16F_to_R16_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R16I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16_SINT:
+ return R16I_to_R16_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R16UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16_UINT:
+ return R16UI_to_R16_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R16_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16_UNORM:
+ return R16_EXT_to_R16_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R16_SNORM_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16_SNORM:
+ return R16_SNORM_EXT_to_R16_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R16_SSCALED_ANGLEX:
+ return R16_SSCALED_ANGLEX_to_default;
+ case GL_R16_USCALED_ANGLEX:
+ return R16_USCALED_ANGLEX_to_default;
+ case GL_R32F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32_FLOAT:
+ return R32F_to_R32_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R32I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32_SINT:
+ return R32I_to_R32_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R32UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32_UINT:
+ return R32UI_to_R32_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8_UNORM:
+ return R8_to_R8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R8I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8_SINT:
+ return R8I_to_R8_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R8UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8_UINT:
+ return R8UI_to_R8_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R8_SNORM:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8_SNORM:
+ return R8_SNORM_to_R8_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_R8_SSCALED_ANGLEX:
+ return R8_SSCALED_ANGLEX_to_default;
+ case GL_R8_USCALED_ANGLEX:
+ return R8_USCALED_ANGLEX_to_default;
+ case GL_RG16F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16_FLOAT:
+ return RG16F_to_R16G16_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG16I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16_SINT:
+ return RG16I_to_R16G16_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG16UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16_UINT:
+ return RG16UI_to_R16G16_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG16_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16_UNORM:
+ return RG16_EXT_to_R16G16_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG16_SNORM_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16_SNORM:
+ return RG16_SNORM_EXT_to_R16G16_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG16_SSCALED_ANGLEX:
+ return RG16_SSCALED_ANGLEX_to_default;
+ case GL_RG16_USCALED_ANGLEX:
+ return RG16_USCALED_ANGLEX_to_default;
+ case GL_RG32F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32_FLOAT:
+ return RG32F_to_R32G32_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG32I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32_SINT:
+ return RG32I_to_R32G32_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG32UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32_UINT:
+ return RG32UI_to_R32G32_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8_UNORM:
+ return RG8_to_R8G8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG8I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8_SINT:
+ return RG8I_to_R8G8_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG8UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8_UINT:
+ return RG8UI_to_R8G8_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG8_SNORM:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8_SNORM:
+ return RG8_SNORM_to_R8G8_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RG8_SSCALED_ANGLEX:
+ return RG8_SSCALED_ANGLEX_to_default;
+ case GL_RG8_USCALED_ANGLEX:
+ return RG8_USCALED_ANGLEX_to_default;
+ case GL_RGB:
+ return RGB_to_default;
+ case GL_RGB10_A2:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R10G10B10A2_UNORM:
+ return RGB10_A2_to_R10G10B10A2_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB10_A2UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R10G10B10A2_UINT:
+ return RGB10_A2UI_to_R10G10B10A2_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB10_A2_SINT_ANGLEX:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R10G10B10A2_SINT:
+ return RGB10_A2_SINT_ANGLEX_to_R10G10B10A2_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB10_A2_SNORM_ANGLEX:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R10G10B10A2_SNORM:
+ return RGB10_A2_SNORM_ANGLEX_to_R10G10B10A2_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB10_A2_SSCALED_ANGLEX:
+ return RGB10_A2_SSCALED_ANGLEX_to_default;
+ case GL_RGB10_A2_USCALED_ANGLEX:
+ return RGB10_A2_USCALED_ANGLEX_to_default;
+ case GL_RGB16F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_FLOAT:
+ return RGB16F_to_R16G16B16A16_FLOAT;
+ case FormatID::R16G16B16_FLOAT:
+ return RGB16F_to_R16G16B16_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB16I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_SINT:
+ return RGB16I_to_R16G16B16A16_SINT;
+ case FormatID::R16G16B16_SINT:
+ return RGB16I_to_R16G16B16_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB16UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_UINT:
+ return RGB16UI_to_R16G16B16A16_UINT;
+ case FormatID::R16G16B16_UINT:
+ return RGB16UI_to_R16G16B16_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB16_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_UNORM:
+ return RGB16_EXT_to_R16G16B16A16_UNORM;
+ case FormatID::R16G16B16_UNORM:
+ return RGB16_EXT_to_R16G16B16_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB16_SNORM_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_SNORM:
+ return RGB16_SNORM_EXT_to_R16G16B16A16_SNORM;
+ case FormatID::R16G16B16_SNORM:
+ return RGB16_SNORM_EXT_to_R16G16B16_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB16_SSCALED_ANGLEX:
+ return RGB16_SSCALED_ANGLEX_to_default;
+ case GL_RGB16_USCALED_ANGLEX:
+ return RGB16_USCALED_ANGLEX_to_default;
+ case GL_RGB32F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32B32A32_FLOAT:
+ return RGB32F_to_R32G32B32A32_FLOAT;
+ case FormatID::R32G32B32_FLOAT:
+ return RGB32F_to_R32G32B32_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB32I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32B32A32_SINT:
+ return RGB32I_to_R32G32B32A32_SINT;
+ case FormatID::R32G32B32_SINT:
+ return RGB32I_to_R32G32B32_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB32UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32B32A32_UINT:
+ return RGB32UI_to_R32G32B32A32_UINT;
+ case FormatID::R32G32B32_UINT:
+ return RGB32UI_to_R32G32B32_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB565:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::B5G6R5_UNORM:
+ return RGB565_to_B5G6R5_UNORM;
+ case FormatID::R5G6B5_UNORM:
+ return RGB565_to_R5G6B5_UNORM;
+ case FormatID::R8G8B8A8_UNORM:
+ return RGB565_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB5_A1:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::A1R5G5B5_UNORM:
+ return RGB5_A1_to_A1R5G5B5_UNORM;
+ case FormatID::B5G5R5A1_UNORM:
+ return RGB5_A1_to_B5G5R5A1_UNORM;
+ case FormatID::R8G8B8A8_UNORM:
+ return RGB5_A1_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UNORM:
+ return RGB8_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB8I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_SINT:
+ return RGB8I_to_R8G8B8A8_SINT;
+ case FormatID::R8G8B8_SINT:
+ return RGB8I_to_R8G8B8_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB8UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UINT:
+ return RGB8UI_to_R8G8B8A8_UINT;
+ case FormatID::R8G8B8_UINT:
+ return RGB8UI_to_R8G8B8_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB8_SNORM:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_SNORM:
+ return RGB8_SNORM_to_R8G8B8A8_SNORM;
+ case FormatID::R8G8B8_SNORM:
+ return RGB8_SNORM_to_R8G8B8_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGB8_SSCALED_ANGLEX:
+ return RGB8_SSCALED_ANGLEX_to_default;
+ case GL_RGB8_USCALED_ANGLEX:
+ return RGB8_USCALED_ANGLEX_to_default;
+ case GL_RGB9_E5:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R9G9B9E5_SHAREDEXP:
+ return RGB9_E5_to_R9G9B9E5_SHAREDEXP;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA:
+ return RGBA_to_default;
+ case GL_RGBA16F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_FLOAT:
+ return RGBA16F_to_R16G16B16A16_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA16I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_SINT:
+ return RGBA16I_to_R16G16B16A16_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA16UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_UINT:
+ return RGBA16UI_to_R16G16B16A16_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA16_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_UNORM:
+ return RGBA16_EXT_to_R16G16B16A16_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA16_SNORM_EXT:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R16G16B16A16_SNORM:
+ return RGBA16_SNORM_EXT_to_R16G16B16A16_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA16_SSCALED_ANGLEX:
+ return RGBA16_SSCALED_ANGLEX_to_default;
+ case GL_RGBA16_USCALED_ANGLEX:
+ return RGBA16_USCALED_ANGLEX_to_default;
+ case GL_RGBA32F:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32B32A32_FLOAT:
+ return RGBA32F_to_R32G32B32A32_FLOAT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA32I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32B32A32_SINT:
+ return RGBA32I_to_R32G32B32A32_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA32UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R32G32B32A32_UINT:
+ return RGBA32UI_to_R32G32B32A32_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA4:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::B4G4R4A4_UNORM:
+ return RGBA4_to_B4G4R4A4_UNORM;
+ case FormatID::R8G8B8A8_UNORM:
+ return RGBA4_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UNORM:
+ return RGBA8_to_R8G8B8A8_UNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA8I:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_SINT:
+ return RGBA8I_to_R8G8B8A8_SINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA8UI:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UINT:
+ return RGBA8UI_to_R8G8B8A8_UINT;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA8_SNORM:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_SNORM:
+ return RGBA8_SNORM_to_R8G8B8A8_SNORM;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_RGBA8_SSCALED_ANGLEX:
+ return RGBA8_SSCALED_ANGLEX_to_default;
+ case GL_RGBA8_USCALED_ANGLEX:
+ return RGBA8_USCALED_ANGLEX_to_default;
+ case GL_SRGB8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UNORM_SRGB:
+ return SRGB8_to_R8G8B8A8_UNORM_SRGB;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_SRGB8_ALPHA8:
+ {
+ switch (angleFormat)
+ {
+ case FormatID::R8G8B8A8_UNORM_SRGB:
+ return SRGB8_ALPHA8_to_R8G8B8A8_UNORM_SRGB;
+ default:
+ break;
+ }
+ break;
+ }
+ case GL_STENCIL_INDEX8:
+ return STENCIL_INDEX8_to_default;
+
+ default:
+ break;
+ }
+ // clang-format on
+ ASSERT(internalFormat == GL_NONE || angleFormat == angle::FormatID::NONE);
+ static LoadFunctionMap emptyLoadFunctionsMap;
+ return emptyLoadFunctionsMap;
+
+} // GetLoadFunctionsMap
+
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp
new file mode 100644
index 0000000000..402e284821
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp
@@ -0,0 +1,803 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// renderer_utils:
+// Helper methods pertaining to most or all back-ends.
+//
+
+#include "libANGLE/renderer/renderer_utils.h"
+
+#include "image_util/copyimage.h"
+#include "image_util/imageformats.h"
+
+#include "libANGLE/AttributeMap.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/renderer/ContextImpl.h"
+#include "libANGLE/renderer/Format.h"
+
+#include "platform/Feature.h"
+
+#include <string.h>
+#include "common/utilities.h"
+
+namespace rx
+{
+
+namespace
+{
+void CopyColor(gl::ColorF *color)
+{
+ // No-op
+}
+
+void PremultiplyAlpha(gl::ColorF *color)
+{
+ color->red *= color->alpha;
+ color->green *= color->alpha;
+ color->blue *= color->alpha;
+}
+
+void UnmultiplyAlpha(gl::ColorF *color)
+{
+ if (color->alpha != 0.0f)
+ {
+ float invAlpha = 1.0f / color->alpha;
+ color->red *= invAlpha;
+ color->green *= invAlpha;
+ color->blue *= invAlpha;
+ }
+}
+
+void ClipChannelsR(gl::ColorF *color)
+{
+ color->green = 0.0f;
+ color->blue = 0.0f;
+ color->alpha = 1.0f;
+}
+
+void ClipChannelsRG(gl::ColorF *color)
+{
+ color->blue = 0.0f;
+ color->alpha = 1.0f;
+}
+
+void ClipChannelsRGB(gl::ColorF *color)
+{
+ color->alpha = 1.0f;
+}
+
+void ClipChannelsLuminance(gl::ColorF *color)
+{
+ color->alpha = 1.0f;
+}
+
+void ClipChannelsAlpha(gl::ColorF *color)
+{
+ color->red = 0.0f;
+ color->green = 0.0f;
+ color->blue = 0.0f;
+}
+
+void ClipChannelsNoOp(gl::ColorF *color) {}
+
+void WriteUintColor(const gl::ColorF &color,
+ PixelWriteFunction colorWriteFunction,
+ uint8_t *destPixelData)
+{
+ gl::ColorUI destColor(
+ static_cast<unsigned int>(color.red * 255), static_cast<unsigned int>(color.green * 255),
+ static_cast<unsigned int>(color.blue * 255), static_cast<unsigned int>(color.alpha * 255));
+ colorWriteFunction(reinterpret_cast<const uint8_t *>(&destColor), destPixelData);
+}
+
+void WriteFloatColor(const gl::ColorF &color,
+ PixelWriteFunction colorWriteFunction,
+ uint8_t *destPixelData)
+{
+ colorWriteFunction(reinterpret_cast<const uint8_t *>(&color), destPixelData);
+}
+
+template <int cols, int rows, bool IsColumnMajor>
+inline int GetFlattenedIndex(int col, int row)
+{
+ if (IsColumnMajor)
+ {
+ return col * rows + row;
+ }
+ else
+ {
+ return row * cols + col;
+ }
+}
+
+template <typename T,
+ bool IsSrcColumnMajor,
+ int colsSrc,
+ int rowsSrc,
+ bool IsDstColumnMajor,
+ int colsDst,
+ int rowsDst>
+bool ExpandMatrix(T *target, const GLfloat *value)
+{
+ static_assert(colsSrc <= colsDst && rowsSrc <= rowsDst, "Can only expand!");
+
+ constexpr int kDstFlatSize = colsDst * rowsDst;
+ T staging[kDstFlatSize] = {0};
+
+ for (int r = 0; r < rowsSrc; r++)
+ {
+ for (int c = 0; c < colsSrc; c++)
+ {
+ int srcIndex = GetFlattenedIndex<colsSrc, rowsSrc, IsSrcColumnMajor>(c, r);
+ int dstIndex = GetFlattenedIndex<colsDst, rowsDst, IsDstColumnMajor>(c, r);
+
+ staging[dstIndex] = static_cast<T>(value[srcIndex]);
+ }
+ }
+
+ if (memcmp(target, staging, kDstFlatSize * sizeof(T)) == 0)
+ {
+ return false;
+ }
+
+ memcpy(target, staging, kDstFlatSize * sizeof(T));
+ return true;
+}
+
+template <bool IsSrcColumMajor,
+ int colsSrc,
+ int rowsSrc,
+ bool IsDstColumnMajor,
+ int colsDst,
+ int rowsDst>
+bool SetFloatUniformMatrix(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ const GLfloat *value,
+ uint8_t *targetData)
+{
+ unsigned int count =
+ std::min(elementCount - arrayElementOffset, static_cast<unsigned int>(countIn));
+
+ const unsigned int targetMatrixStride = colsDst * rowsDst;
+ GLfloat *target = reinterpret_cast<GLfloat *>(
+ targetData + arrayElementOffset * sizeof(GLfloat) * targetMatrixStride);
+
+ bool dirty = false;
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ dirty = ExpandMatrix<GLfloat, IsSrcColumMajor, colsSrc, rowsSrc, IsDstColumnMajor, colsDst,
+ rowsDst>(target, value) ||
+ dirty;
+
+ target += targetMatrixStride;
+ value += colsSrc * rowsSrc;
+ }
+
+ return dirty;
+}
+
+bool SetFloatUniformMatrixFast(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ size_t matrixSize,
+ const GLfloat *value,
+ uint8_t *targetData)
+{
+ const unsigned int count =
+ std::min(elementCount - arrayElementOffset, static_cast<unsigned int>(countIn));
+
+ const uint8_t *valueData = reinterpret_cast<const uint8_t *>(value);
+ targetData = targetData + arrayElementOffset * matrixSize;
+
+ if (memcmp(targetData, valueData, matrixSize * count) == 0)
+ {
+ return false;
+ }
+
+ memcpy(targetData, valueData, matrixSize * count);
+ return true;
+}
+
+} // anonymous namespace
+
+PackPixelsParams::PackPixelsParams()
+ : destFormat(nullptr), outputPitch(0), packBuffer(nullptr), offset(0)
+{}
+
+PackPixelsParams::PackPixelsParams(const gl::Rectangle &areaIn,
+ const angle::Format &destFormat,
+ GLuint outputPitchIn,
+ bool reverseRowOrderIn,
+ gl::Buffer *packBufferIn,
+ ptrdiff_t offsetIn)
+ : area(areaIn),
+ destFormat(&destFormat),
+ outputPitch(outputPitchIn),
+ packBuffer(packBufferIn),
+ reverseRowOrder(reverseRowOrderIn),
+ offset(offsetIn)
+{}
+
+void PackPixels(const PackPixelsParams &params,
+ const angle::Format &sourceFormat,
+ int inputPitchIn,
+ const uint8_t *sourceIn,
+ uint8_t *destWithoutOffset)
+{
+ uint8_t *destWithOffset = destWithoutOffset + params.offset;
+
+ const uint8_t *source = sourceIn;
+ int inputPitch = inputPitchIn;
+
+ if (params.reverseRowOrder)
+ {
+ source += inputPitch * (params.area.height - 1);
+ inputPitch = -inputPitch;
+ }
+
+ if (sourceFormat == *params.destFormat)
+ {
+ // Direct copy possible
+ for (int y = 0; y < params.area.height; ++y)
+ {
+ memcpy(destWithOffset + y * params.outputPitch, source + y * inputPitch,
+ params.area.width * sourceFormat.pixelBytes);
+ }
+ return;
+ }
+
+ PixelCopyFunction fastCopyFunc = sourceFormat.fastCopyFunctions.get(params.destFormat->id);
+
+ if (fastCopyFunc)
+ {
+ // Fast copy is possible through some special function
+ for (int y = 0; y < params.area.height; ++y)
+ {
+ for (int x = 0; x < params.area.width; ++x)
+ {
+ uint8_t *dest =
+ destWithOffset + y * params.outputPitch + x * params.destFormat->pixelBytes;
+ const uint8_t *src = source + y * inputPitch + x * sourceFormat.pixelBytes;
+
+ fastCopyFunc(src, dest);
+ }
+ }
+ return;
+ }
+
+ PixelWriteFunction pixelWriteFunction = params.destFormat->pixelWriteFunction;
+ ASSERT(pixelWriteFunction != nullptr);
+
+ // Maximum size of any Color<T> type used.
+ uint8_t temp[16];
+ static_assert(sizeof(temp) >= sizeof(gl::ColorF) && sizeof(temp) >= sizeof(gl::ColorUI) &&
+ sizeof(temp) >= sizeof(gl::ColorI) &&
+ sizeof(temp) >= sizeof(angle::DepthStencil),
+ "Unexpected size of pixel struct.");
+
+ PixelReadFunction pixelReadFunction = sourceFormat.pixelReadFunction;
+ ASSERT(pixelReadFunction != nullptr);
+
+ for (int y = 0; y < params.area.height; ++y)
+ {
+ for (int x = 0; x < params.area.width; ++x)
+ {
+ uint8_t *dest =
+ destWithOffset + y * params.outputPitch + x * params.destFormat->pixelBytes;
+ const uint8_t *src = source + y * inputPitch + x * sourceFormat.pixelBytes;
+
+ // readFunc and writeFunc will be using the same type of color, CopyTexImage
+ // will not allow the copy otherwise.
+ pixelReadFunction(src, temp);
+ pixelWriteFunction(temp, dest);
+ }
+ }
+}
+
+bool FastCopyFunctionMap::has(angle::FormatID formatID) const
+{
+ return (get(formatID) != nullptr);
+}
+
+PixelCopyFunction FastCopyFunctionMap::get(angle::FormatID formatID) const
+{
+ for (size_t index = 0; index < mSize; ++index)
+ {
+ if (mData[index].formatID == formatID)
+ {
+ return mData[index].func;
+ }
+ }
+
+ return nullptr;
+}
+
+bool ShouldUseDebugLayers(const egl::AttributeMap &attribs)
+{
+ // (miko): Disabling debug layers fixes flakiness with debug builds.
+ return false;
+
+ EGLAttrib debugSetting =
+ attribs.get(EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE, EGL_DONT_CARE);
+
+// Prefer to enable debug layers if compiling in Debug, and disabled in Release.
+#if defined(ANGLE_ENABLE_ASSERTS)
+ return (debugSetting != EGL_FALSE);
+#else
+ return (debugSetting == EGL_TRUE);
+#endif // defined(ANGLE_ENABLE_ASSERTS)
+}
+
+bool ShouldUseVirtualizedContexts(const egl::AttributeMap &attribs, bool defaultValue)
+{
+ EGLAttrib virtualizedContextRequest =
+ attribs.get(EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE, EGL_DONT_CARE);
+ if (defaultValue)
+ {
+ return (virtualizedContextRequest != EGL_FALSE);
+ }
+ else
+ {
+ return (virtualizedContextRequest == EGL_TRUE);
+ }
+}
+
+void CopyImageCHROMIUM(const uint8_t *sourceData,
+ size_t sourceRowPitch,
+ size_t sourcePixelBytes,
+ size_t sourceDepthPitch,
+ PixelReadFunction pixelReadFunction,
+ uint8_t *destData,
+ size_t destRowPitch,
+ size_t destPixelBytes,
+ size_t destDepthPitch,
+ PixelWriteFunction pixelWriteFunction,
+ GLenum destUnsizedFormat,
+ GLenum destComponentType,
+ size_t width,
+ size_t height,
+ size_t depth,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha)
+{
+ using ConversionFunction = void (*)(gl::ColorF *);
+ ConversionFunction conversionFunction = CopyColor;
+ if (unpackPremultiplyAlpha != unpackUnmultiplyAlpha)
+ {
+ if (unpackPremultiplyAlpha)
+ {
+ conversionFunction = PremultiplyAlpha;
+ }
+ else
+ {
+ conversionFunction = UnmultiplyAlpha;
+ }
+ }
+
+ auto clipChannelsFunction = ClipChannelsNoOp;
+ switch (destUnsizedFormat)
+ {
+ case GL_RED:
+ clipChannelsFunction = ClipChannelsR;
+ break;
+ case GL_RG:
+ clipChannelsFunction = ClipChannelsRG;
+ break;
+ case GL_RGB:
+ clipChannelsFunction = ClipChannelsRGB;
+ break;
+ case GL_LUMINANCE:
+ clipChannelsFunction = ClipChannelsLuminance;
+ break;
+ case GL_ALPHA:
+ clipChannelsFunction = ClipChannelsAlpha;
+ break;
+ }
+
+ auto writeFunction = (destComponentType == GL_UNSIGNED_INT) ? WriteUintColor : WriteFloatColor;
+
+ for (size_t z = 0; z < depth; z++)
+ {
+ for (size_t y = 0; y < height; y++)
+ {
+ for (size_t x = 0; x < width; x++)
+ {
+ const uint8_t *sourcePixelData =
+ sourceData + y * sourceRowPitch + x * sourcePixelBytes + z * sourceDepthPitch;
+
+ gl::ColorF sourceColor;
+ pixelReadFunction(sourcePixelData, reinterpret_cast<uint8_t *>(&sourceColor));
+
+ conversionFunction(&sourceColor);
+ clipChannelsFunction(&sourceColor);
+
+ size_t destY = 0;
+ if (unpackFlipY)
+ {
+ destY += (height - 1);
+ destY -= y;
+ }
+ else
+ {
+ destY += y;
+ }
+
+ uint8_t *destPixelData =
+ destData + destY * destRowPitch + x * destPixelBytes + z * destDepthPitch;
+ writeFunction(sourceColor, pixelWriteFunction, destPixelData);
+ }
+ }
+ }
+}
+
+// IncompleteTextureSet implementation.
+IncompleteTextureSet::IncompleteTextureSet() {}
+
+IncompleteTextureSet::~IncompleteTextureSet() {}
+
+void IncompleteTextureSet::onDestroy(const gl::Context *context)
+{
+ // Clear incomplete textures.
+ for (auto &incompleteTexture : mIncompleteTextures)
+ {
+ if (incompleteTexture.get() != nullptr)
+ {
+ incompleteTexture->onDestroy(context);
+ incompleteTexture.set(context, nullptr);
+ }
+ }
+}
+
+angle::Result IncompleteTextureSet::getIncompleteTexture(
+ const gl::Context *context,
+ gl::TextureType type,
+ MultisampleTextureInitializer *multisampleInitializer,
+ gl::Texture **textureOut)
+{
+ *textureOut = mIncompleteTextures[type].get();
+ if (*textureOut != nullptr)
+ {
+ return angle::Result::Continue;
+ }
+
+ ContextImpl *implFactory = context->getImplementation();
+
+ const GLubyte color[] = {0, 0, 0, 255};
+ const gl::Extents colorSize(1, 1, 1);
+ gl::PixelUnpackState unpack;
+ unpack.alignment = 1;
+ const gl::Box area(0, 0, 0, 1, 1, 1);
+
+ // If a texture is external use a 2D texture for the incomplete texture
+ gl::TextureType createType = (type == gl::TextureType::External) ? gl::TextureType::_2D : type;
+
+ gl::Texture *tex = new gl::Texture(implFactory, std::numeric_limits<GLuint>::max(), createType);
+ angle::UniqueObjectPointer<gl::Texture, gl::Context> t(tex, context);
+
+ // This is a bit of a kludge but is necessary to consume the error.
+ gl::Context *mutableContext = const_cast<gl::Context *>(context);
+
+ if (createType == gl::TextureType::_2DMultisample)
+ {
+ ANGLE_TRY(
+ t->setStorageMultisample(mutableContext, createType, 1, GL_RGBA8, colorSize, true));
+ }
+ else
+ {
+ ANGLE_TRY(t->setStorage(mutableContext, createType, 1, GL_RGBA8, colorSize));
+ }
+
+ if (type == gl::TextureType::CubeMap)
+ {
+ for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets())
+ {
+ ANGLE_TRY(t->setSubImage(mutableContext, unpack, nullptr, face, 0, area, GL_RGBA,
+ GL_UNSIGNED_BYTE, color));
+ }
+ }
+ else if (type == gl::TextureType::_2DMultisample)
+ {
+ // Call a specialized clear function to init a multisample texture.
+ ANGLE_TRY(multisampleInitializer->initializeMultisampleTextureToBlack(context, t.get()));
+ }
+ else
+ {
+ ANGLE_TRY(t->setSubImage(mutableContext, unpack, nullptr,
+ gl::NonCubeTextureTypeToTarget(createType), 0, area, GL_RGBA,
+ GL_UNSIGNED_BYTE, color));
+ }
+
+ ANGLE_TRY(t->syncState(context));
+
+ mIncompleteTextures[type].set(context, t.release());
+ *textureOut = mIncompleteTextures[type].get();
+ return angle::Result::Continue;
+}
+
+#define ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(api, cols, rows) \
+ template bool SetFloatUniformMatrix##api<cols, rows>::Run( \
+ unsigned int, unsigned int, GLsizei, GLboolean, const GLfloat *, uint8_t *)
+
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(GLSL, 2, 2);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(GLSL, 3, 3);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(GLSL, 2, 3);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(GLSL, 3, 2);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(GLSL, 4, 2);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(GLSL, 4, 3);
+
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(HLSL, 2, 2);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(HLSL, 3, 3);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(HLSL, 2, 3);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(HLSL, 3, 2);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(HLSL, 2, 4);
+ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(HLSL, 3, 4);
+
+#undef ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC
+
+#define ANGLE_SPECIALIZATION_ROWS_SET_UNIFORM_MATRIX_FUNC(api, cols, rows) \
+ template bool SetFloatUniformMatrix##api<cols, 4>::Run(unsigned int, unsigned int, GLsizei, \
+ GLboolean, const GLfloat *, uint8_t *)
+
+template <int cols>
+struct SetFloatUniformMatrixGLSL<cols, 4>
+{
+ static bool Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData);
+};
+
+ANGLE_SPECIALIZATION_ROWS_SET_UNIFORM_MATRIX_FUNC(GLSL, 2, 4);
+ANGLE_SPECIALIZATION_ROWS_SET_UNIFORM_MATRIX_FUNC(GLSL, 3, 4);
+ANGLE_SPECIALIZATION_ROWS_SET_UNIFORM_MATRIX_FUNC(GLSL, 4, 4);
+
+#undef ANGLE_SPECIALIZATION_ROWS_SET_UNIFORM_MATRIX_FUNC
+
+#define ANGLE_SPECIALIZATION_COLS_SET_UNIFORM_MATRIX_FUNC(api, cols, rows) \
+ template bool SetFloatUniformMatrix##api<4, rows>::Run(unsigned int, unsigned int, GLsizei, \
+ GLboolean, const GLfloat *, uint8_t *)
+
+template <int rows>
+struct SetFloatUniformMatrixHLSL<4, rows>
+{
+ static bool Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData);
+};
+
+ANGLE_SPECIALIZATION_COLS_SET_UNIFORM_MATRIX_FUNC(HLSL, 4, 2);
+ANGLE_SPECIALIZATION_COLS_SET_UNIFORM_MATRIX_FUNC(HLSL, 4, 3);
+ANGLE_SPECIALIZATION_COLS_SET_UNIFORM_MATRIX_FUNC(HLSL, 4, 4);
+
+#undef ANGLE_SPECIALIZATION_COLS_SET_UNIFORM_MATRIX_FUNC
+
+template <int cols>
+bool SetFloatUniformMatrixGLSL<cols, 4>::Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData)
+{
+ const bool isSrcColumnMajor = !transpose;
+ if (isSrcColumnMajor)
+ {
+ // Both src and dst matrixs are has same layout,
+ // a single memcpy updates all the matrices
+ constexpr size_t srcMatrixSize = sizeof(GLfloat) * cols * 4;
+ return SetFloatUniformMatrixFast(arrayElementOffset, elementCount, countIn, srcMatrixSize,
+ value, targetData);
+ }
+ else
+ {
+ // fallback to general cases
+ return SetFloatUniformMatrix<false, cols, 4, true, cols, 4>(
+ arrayElementOffset, elementCount, countIn, value, targetData);
+ }
+}
+
+template <int cols, int rows>
+bool SetFloatUniformMatrixGLSL<cols, rows>::Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData)
+{
+ const bool isSrcColumnMajor = !transpose;
+ // GLSL expects matrix uniforms to be column-major, and each column is padded to 4 rows.
+ if (isSrcColumnMajor)
+ {
+ return SetFloatUniformMatrix<true, cols, rows, true, cols, 4>(
+ arrayElementOffset, elementCount, countIn, value, targetData);
+ }
+ else
+ {
+ return SetFloatUniformMatrix<false, cols, rows, true, cols, 4>(
+ arrayElementOffset, elementCount, countIn, value, targetData);
+ }
+}
+
+template <int rows>
+bool SetFloatUniformMatrixHLSL<4, rows>::Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData)
+{
+ const bool isSrcColumnMajor = !transpose;
+ if (!isSrcColumnMajor)
+ {
+ // Both src and dst matrixs are has same layout,
+ // a single memcpy updates all the matrices
+ constexpr size_t srcMatrixSize = sizeof(GLfloat) * 4 * rows;
+ return SetFloatUniformMatrixFast(arrayElementOffset, elementCount, countIn, srcMatrixSize,
+ value, targetData);
+ }
+ else
+ {
+ // fallback to general cases
+ return SetFloatUniformMatrix<true, 4, rows, false, 4, rows>(
+ arrayElementOffset, elementCount, countIn, value, targetData);
+ }
+}
+
+template <int cols, int rows>
+bool SetFloatUniformMatrixHLSL<cols, rows>::Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData)
+{
+ const bool isSrcColumnMajor = !transpose;
+ // Internally store matrices as row-major to accomodate HLSL matrix indexing. Each row is
+ // padded to 4 columns.
+ if (!isSrcColumnMajor)
+ {
+ return SetFloatUniformMatrix<false, cols, rows, false, 4, rows>(
+ arrayElementOffset, elementCount, countIn, value, targetData);
+ }
+ else
+ {
+ return SetFloatUniformMatrix<true, cols, rows, false, 4, rows>(
+ arrayElementOffset, elementCount, countIn, value, targetData);
+ }
+}
+
+template void GetMatrixUniform<GLint>(GLenum, GLint *, const GLint *, bool);
+template void GetMatrixUniform<GLuint>(GLenum, GLuint *, const GLuint *, bool);
+
+void GetMatrixUniform(GLenum type, GLfloat *dataOut, const GLfloat *source, bool transpose)
+{
+ int columns = gl::VariableColumnCount(type);
+ int rows = gl::VariableRowCount(type);
+ for (GLint col = 0; col < columns; ++col)
+ {
+ for (GLint row = 0; row < rows; ++row)
+ {
+ GLfloat *outptr = dataOut + ((col * rows) + row);
+ const GLfloat *inptr =
+ transpose ? source + ((row * 4) + col) : source + ((col * 4) + row);
+ *outptr = *inptr;
+ }
+ }
+}
+
+template <typename NonFloatT>
+void GetMatrixUniform(GLenum type, NonFloatT *dataOut, const NonFloatT *source, bool transpose)
+{
+ UNREACHABLE();
+}
+
+const angle::Format &GetFormatFromFormatType(GLenum format, GLenum type)
+{
+ GLenum sizedInternalFormat = gl::GetInternalFormatInfo(format, type).sizedInternalFormat;
+ angle::FormatID angleFormatID = angle::Format::InternalFormatToID(sizedInternalFormat);
+ return angle::Format::Get(angleFormatID);
+}
+
+angle::Result ComputeStartVertex(ContextImpl *contextImpl,
+ const gl::IndexRange &indexRange,
+ GLint baseVertex,
+ GLint *firstVertexOut)
+{
+ // The entire index range should be within the limits of a 32-bit uint because the largest
+ // GL index type is GL_UNSIGNED_INT.
+ ASSERT(indexRange.start <= std::numeric_limits<uint32_t>::max() &&
+ indexRange.end <= std::numeric_limits<uint32_t>::max());
+
+ // The base vertex is only used in DrawElementsIndirect. Given the assertion above and the
+ // type of mBaseVertex (GLint), adding them both as 64-bit ints is safe.
+ int64_t startVertexInt64 =
+ static_cast<int64_t>(baseVertex) + static_cast<int64_t>(indexRange.start);
+
+ // OpenGL ES 3.2 spec section 10.5: "Behavior of DrawElementsOneInstance is undefined if the
+ // vertex ID is negative for any element"
+ ANGLE_CHECK_GL_MATH(contextImpl, startVertexInt64 >= 0);
+
+ // OpenGL ES 3.2 spec section 10.5: "If the vertex ID is larger than the maximum value
+ // representable by type, it should behave as if the calculation were upconverted to 32-bit
+ // unsigned integers(with wrapping on overflow conditions)." ANGLE does not fully handle
+ // these rules, an overflow error is returned if the start vertex cannot be stored in a
+ // 32-bit signed integer.
+ ANGLE_CHECK_GL_MATH(contextImpl, startVertexInt64 <= std::numeric_limits<GLint>::max());
+
+ *firstVertexOut = static_cast<GLint>(startVertexInt64);
+ return angle::Result::Continue;
+}
+
+angle::Result GetVertexRangeInfo(const gl::Context *context,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLint baseVertex,
+ GLint *startVertexOut,
+ size_t *vertexCountOut)
+{
+ if (indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum)
+ {
+ gl::IndexRange indexRange;
+ ANGLE_TRY(context->getState().getVertexArray()->getIndexRange(
+ context, indexTypeOrInvalid, vertexOrIndexCount, indices, &indexRange));
+ ANGLE_TRY(ComputeStartVertex(context->getImplementation(), indexRange, baseVertex,
+ startVertexOut));
+ *vertexCountOut = indexRange.vertexCount();
+ }
+ else
+ {
+ *startVertexOut = firstVertex;
+ *vertexCountOut = vertexOrIndexCount;
+ }
+ return angle::Result::Continue;
+}
+
+gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &rect, bool invertY)
+{
+ if (glState.isScissorTestEnabled())
+ {
+ gl::Rectangle clippedRect;
+ if (!gl::ClipRectangle(glState.getScissor(), rect, &clippedRect))
+ {
+ return gl::Rectangle();
+ }
+
+ if (invertY)
+ {
+ clippedRect.y = rect.height - clippedRect.y - clippedRect.height;
+ }
+
+ return clippedRect;
+ }
+
+ // If the scissor test isn't enabled, assume it has infinite size. Its intersection with the
+ // rect would be the rect itself.
+ //
+ // Note that on Vulkan, returning this (as opposed to a fixed max-int-sized rect) could lead to
+ // unnecessary pipeline creations if two otherwise identical pipelines are used on framebuffers
+ // with different sizes. If such usage is observed in an application, we should investigate
+ // possible optimizations.
+ return rect;
+}
+
+void OverrideFeaturesWithDisplayState(angle::FeatureSetBase *features,
+ const egl::DisplayState &state)
+{
+ features->overrideFeatures(state.featureOverridesEnabled, true);
+ features->overrideFeatures(state.featureOverridesDisabled, false);
+}
+} // namespace rx
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h
new file mode 100644
index 0000000000..667f3d5a02
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h
@@ -0,0 +1,406 @@
+//
+// Copyright 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// renderer_utils:
+// Helper methods pertaining to most or all back-ends.
+//
+
+#ifndef LIBANGLE_RENDERER_RENDERER_UTILS_H_
+#define LIBANGLE_RENDERER_RENDERER_UTILS_H_
+
+#include <cstdint>
+
+#include <atomic>
+#include <limits>
+#include <map>
+
+#include "common/angleutils.h"
+#include "common/utilities.h"
+#include "libANGLE/angletypes.h"
+
+namespace angle
+{
+struct FeatureSetBase;
+struct Format;
+enum class FormatID;
+} // namespace angle
+
+namespace gl
+{
+struct FormatType;
+struct InternalFormat;
+class State;
+} // namespace gl
+
+namespace egl
+{
+class AttributeMap;
+struct DisplayState;
+} // namespace egl
+
+namespace rx
+{
+class ContextImpl;
+
+class ResourceSerial
+{
+ public:
+ constexpr ResourceSerial() : mValue(kDirty) {}
+ explicit constexpr ResourceSerial(uintptr_t value) : mValue(value) {}
+ constexpr bool operator==(ResourceSerial other) const { return mValue == other.mValue; }
+ constexpr bool operator!=(ResourceSerial other) const { return mValue != other.mValue; }
+
+ void dirty() { mValue = kDirty; }
+ void clear() { mValue = kEmpty; }
+
+ constexpr bool valid() const { return mValue != kEmpty && mValue != kDirty; }
+ constexpr bool empty() const { return mValue == kEmpty; }
+
+ private:
+ constexpr static uintptr_t kDirty = std::numeric_limits<uintptr_t>::max();
+ constexpr static uintptr_t kEmpty = 0;
+
+ uintptr_t mValue;
+};
+
+class Serial final
+{
+ public:
+ constexpr Serial() : mValue(kInvalid) {}
+ constexpr Serial(const Serial &other) = default;
+ Serial &operator=(const Serial &other) = default;
+
+ constexpr bool operator==(const Serial &other) const
+ {
+ return mValue != kInvalid && mValue == other.mValue;
+ }
+ constexpr bool operator==(uint32_t value) const
+ {
+ return mValue != kInvalid && mValue == static_cast<uint64_t>(value);
+ }
+ constexpr bool operator!=(const Serial &other) const
+ {
+ return mValue == kInvalid || mValue != other.mValue;
+ }
+ constexpr bool operator>(const Serial &other) const { return mValue > other.mValue; }
+ constexpr bool operator>=(const Serial &other) const { return mValue >= other.mValue; }
+ constexpr bool operator<(const Serial &other) const { return mValue < other.mValue; }
+ constexpr bool operator<=(const Serial &other) const { return mValue <= other.mValue; }
+
+ constexpr bool operator<(uint32_t value) const { return mValue < static_cast<uint64_t>(value); }
+
+ // Useful for serialization.
+ constexpr uint64_t getValue() const { return mValue; }
+
+ private:
+ template <typename T>
+ friend class SerialFactoryBase;
+ constexpr explicit Serial(uint64_t value) : mValue(value) {}
+ uint64_t mValue;
+ static constexpr uint64_t kInvalid = 0;
+};
+
+template <typename SerialBaseType>
+class SerialFactoryBase final : angle::NonCopyable
+{
+ public:
+ SerialFactoryBase() : mSerial(1) {}
+
+ Serial generate()
+ {
+ ASSERT(mSerial + 1 > mSerial);
+ return Serial(mSerial++);
+ }
+
+ private:
+ SerialBaseType mSerial;
+};
+
+using SerialFactory = SerialFactoryBase<uint64_t>;
+using AtomicSerialFactory = SerialFactoryBase<std::atomic<uint64_t>>;
+
+using MipGenerationFunction = void (*)(size_t sourceWidth,
+ size_t sourceHeight,
+ size_t sourceDepth,
+ const uint8_t *sourceData,
+ size_t sourceRowPitch,
+ size_t sourceDepthPitch,
+ uint8_t *destData,
+ size_t destRowPitch,
+ size_t destDepthPitch);
+
+typedef void (*PixelReadFunction)(const uint8_t *source, uint8_t *dest);
+typedef void (*PixelWriteFunction)(const uint8_t *source, uint8_t *dest);
+typedef void (*PixelCopyFunction)(const uint8_t *source, uint8_t *dest);
+
+class FastCopyFunctionMap
+{
+ public:
+ struct Entry
+ {
+ angle::FormatID formatID;
+ PixelCopyFunction func;
+ };
+
+ constexpr FastCopyFunctionMap() : FastCopyFunctionMap(nullptr, 0) {}
+
+ constexpr FastCopyFunctionMap(const Entry *data, size_t size) : mSize(size), mData(data) {}
+
+ bool has(angle::FormatID formatID) const;
+ PixelCopyFunction get(angle::FormatID formatID) const;
+
+ private:
+ size_t mSize;
+ const Entry *mData;
+};
+
+struct PackPixelsParams
+{
+ PackPixelsParams();
+ PackPixelsParams(const gl::Rectangle &area,
+ const angle::Format &destFormat,
+ GLuint outputPitch,
+ bool reverseRowOrderIn,
+ gl::Buffer *packBufferIn,
+ ptrdiff_t offset);
+
+ gl::Rectangle area;
+ const angle::Format *destFormat;
+ GLuint outputPitch;
+ gl::Buffer *packBuffer;
+ bool reverseRowOrder;
+ ptrdiff_t offset;
+};
+
+void PackPixels(const PackPixelsParams &params,
+ const angle::Format &sourceFormat,
+ int inputPitch,
+ const uint8_t *source,
+ uint8_t *destination);
+
+using InitializeTextureDataFunction = void (*)(size_t width,
+ size_t height,
+ size_t depth,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+using LoadImageFunction = void (*)(size_t width,
+ size_t height,
+ size_t depth,
+ const uint8_t *input,
+ size_t inputRowPitch,
+ size_t inputDepthPitch,
+ uint8_t *output,
+ size_t outputRowPitch,
+ size_t outputDepthPitch);
+
+struct LoadImageFunctionInfo
+{
+ LoadImageFunctionInfo() : loadFunction(nullptr), requiresConversion(false) {}
+ LoadImageFunctionInfo(LoadImageFunction loadFunction, bool requiresConversion)
+ : loadFunction(loadFunction), requiresConversion(requiresConversion)
+ {}
+
+ LoadImageFunction loadFunction;
+ bool requiresConversion;
+};
+
+using LoadFunctionMap = LoadImageFunctionInfo (*)(GLenum);
+
+bool ShouldUseDebugLayers(const egl::AttributeMap &attribs);
+bool ShouldUseVirtualizedContexts(const egl::AttributeMap &attribs, bool defaultValue);
+
+void CopyImageCHROMIUM(const uint8_t *sourceData,
+ size_t sourceRowPitch,
+ size_t sourcePixelBytes,
+ size_t sourceDepthPitch,
+ PixelReadFunction pixelReadFunction,
+ uint8_t *destData,
+ size_t destRowPitch,
+ size_t destPixelBytes,
+ size_t destDepthPitch,
+ PixelWriteFunction pixelWriteFunction,
+ GLenum destUnsizedFormat,
+ GLenum destComponentType,
+ size_t width,
+ size_t height,
+ size_t depth,
+ bool unpackFlipY,
+ bool unpackPremultiplyAlpha,
+ bool unpackUnmultiplyAlpha);
+
+// Incomplete textures are 1x1 textures filled with black, used when samplers are incomplete.
+// This helper class encapsulates handling incomplete textures. Because the GL back-end
+// can take advantage of the driver's incomplete textures, and because clearing multisample
+// textures is so difficult, we can keep an instance of this class in the back-end instead
+// of moving the logic to the Context front-end.
+
+// This interface allows us to call-back to init a multisample texture.
+class MultisampleTextureInitializer
+{
+ public:
+ virtual ~MultisampleTextureInitializer() {}
+ virtual angle::Result initializeMultisampleTextureToBlack(const gl::Context *context,
+ gl::Texture *glTexture) = 0;
+};
+
+class IncompleteTextureSet final : angle::NonCopyable
+{
+ public:
+ IncompleteTextureSet();
+ ~IncompleteTextureSet();
+
+ void onDestroy(const gl::Context *context);
+
+ angle::Result getIncompleteTexture(const gl::Context *context,
+ gl::TextureType type,
+ MultisampleTextureInitializer *multisampleInitializer,
+ gl::Texture **textureOut);
+
+ private:
+ gl::TextureMap mIncompleteTextures;
+};
+
+// Helpers to set a matrix uniform value based on GLSL or HLSL semantics.
+// The return value indicate if the data was updated or not.
+template <int cols, int rows>
+struct SetFloatUniformMatrixGLSL
+{
+ static bool Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData);
+};
+
+template <int cols, int rows>
+struct SetFloatUniformMatrixHLSL
+{
+ static bool Run(unsigned int arrayElementOffset,
+ unsigned int elementCount,
+ GLsizei countIn,
+ GLboolean transpose,
+ const GLfloat *value,
+ uint8_t *targetData);
+};
+
+// Helper method to de-tranpose a matrix uniform for an API query.
+void GetMatrixUniform(GLenum type, GLfloat *dataOut, const GLfloat *source, bool transpose);
+
+template <typename NonFloatT>
+void GetMatrixUniform(GLenum type, NonFloatT *dataOut, const NonFloatT *source, bool transpose);
+
+const angle::Format &GetFormatFromFormatType(GLenum format, GLenum type);
+
+angle::Result ComputeStartVertex(ContextImpl *contextImpl,
+ const gl::IndexRange &indexRange,
+ GLint baseVertex,
+ GLint *firstVertexOut);
+
+angle::Result GetVertexRangeInfo(const gl::Context *context,
+ GLint firstVertex,
+ GLsizei vertexOrIndexCount,
+ gl::DrawElementsType indexTypeOrInvalid,
+ const void *indices,
+ GLint baseVertex,
+ GLint *startVertexOut,
+ size_t *vertexCountOut);
+
+gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &rect, bool invertY);
+
+// Helper method to intialize a FeatureSet with overrides from the DisplayState
+void OverrideFeaturesWithDisplayState(angle::FeatureSetBase *features,
+ const egl::DisplayState &state);
+
+template <typename In>
+size_t LineLoopRestartIndexCountHelper(GLsizei indexCount, const uint8_t *srcPtr)
+{
+ constexpr In restartIndex = gl::GetPrimitiveRestartIndexFromType<In>();
+ const In *inIndices = reinterpret_cast<const In *>(srcPtr);
+ size_t numIndices = 0;
+ // See CopyLineLoopIndicesWithRestart() below for more info on how
+ // numIndices is calculated.
+ GLsizei loopStartIndex = 0;
+ for (GLsizei curIndex = 0; curIndex < indexCount; curIndex++)
+ {
+ In vertex = inIndices[curIndex];
+ if (vertex != restartIndex)
+ {
+ numIndices++;
+ }
+ else
+ {
+ if (curIndex > loopStartIndex)
+ {
+ numIndices += 2;
+ }
+ loopStartIndex = curIndex + 1;
+ }
+ }
+ if (indexCount > loopStartIndex)
+ {
+ numIndices++;
+ }
+ return numIndices;
+}
+
+inline size_t GetLineLoopWithRestartIndexCount(gl::DrawElementsType glIndexType,
+ GLsizei indexCount,
+ const uint8_t *srcPtr)
+{
+ switch (glIndexType)
+ {
+ case gl::DrawElementsType::UnsignedByte:
+ return LineLoopRestartIndexCountHelper<uint8_t>(indexCount, srcPtr);
+ case gl::DrawElementsType::UnsignedShort:
+ return LineLoopRestartIndexCountHelper<uint16_t>(indexCount, srcPtr);
+ case gl::DrawElementsType::UnsignedInt:
+ return LineLoopRestartIndexCountHelper<uint32_t>(indexCount, srcPtr);
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+// Writes the line-strip vertices for a line loop to outPtr,
+// where outLimit is calculated as in GetPrimitiveRestartIndexCount.
+template <typename In, typename Out>
+void CopyLineLoopIndicesWithRestart(GLsizei indexCount, const uint8_t *srcPtr, uint8_t *outPtr)
+{
+ constexpr In restartIndex = gl::GetPrimitiveRestartIndexFromType<In>();
+ constexpr Out outRestartIndex = gl::GetPrimitiveRestartIndexFromType<Out>();
+ const In *inIndices = reinterpret_cast<const In *>(srcPtr);
+ Out *outIndices = reinterpret_cast<Out *>(outPtr);
+ GLsizei loopStartIndex = 0;
+ for (GLsizei curIndex = 0; curIndex < indexCount; curIndex++)
+ {
+ In vertex = inIndices[curIndex];
+ if (vertex != restartIndex)
+ {
+ *(outIndices++) = static_cast<Out>(vertex);
+ }
+ else
+ {
+ if (curIndex > loopStartIndex)
+ {
+ // Emit an extra vertex only if the loop is not empty.
+ *(outIndices++) = inIndices[loopStartIndex];
+ // Then restart the strip.
+ *(outIndices++) = outRestartIndex;
+ }
+ loopStartIndex = curIndex + 1;
+ }
+ }
+ if (indexCount > loopStartIndex)
+ {
+ // Close the last loop if not empty.
+ *(outIndices++) = inIndices[loopStartIndex];
+ }
+}
+} // namespace rx
+
+#endif // LIBANGLE_RENDERER_RENDERER_UTILS_H_
diff --git a/gfx/angle/checkout/src/libANGLE/trace.h b/gfx/angle/checkout/src/libANGLE/trace.h
new file mode 100644
index 0000000000..831fef6ab3
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/trace.h
@@ -0,0 +1,24 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// trace.h: Wrappers for ANGLE trace event functions.
+//
+
+#ifndef LIBANGLE_TRACE_H_
+#define LIBANGLE_TRACE_H_
+
+#include <platform/Platform.h>
+#include "third_party/trace_event/trace_event.h"
+
+// TODO: Pass platform directly to these methods. http://anglebug.com/1892
+#define ANGLE_TRACE_EVENT_BEGIN0(CATEGORY, EVENT) \
+ TRACE_EVENT_BEGIN0(ANGLEPlatformCurrent(), CATEGORY, EVENT)
+#define ANGLE_TRACE_EVENT_END0(CATEGORY, EVENT) \
+ TRACE_EVENT_END0(ANGLEPlatformCurrent(), CATEGORY, EVENT)
+#define ANGLE_TRACE_EVENT_INSTANT0(CATEGORY, EVENT) \
+ TRACE_EVENT_INSTANT0(ANGLEPlatformCurrent(), CATEGORY, EVENT)
+#define ANGLE_TRACE_EVENT0(CATEGORY, EVENT) TRACE_EVENT0(ANGLEPlatformCurrent(), CATEGORY, EVENT)
+
+#endif // LIBANGLE_TRACE_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationEGL.cpp b/gfx/angle/checkout/src/libANGLE/validationEGL.cpp
new file mode 100644
index 0000000000..105afc64d0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationEGL.cpp
@@ -0,0 +1,3933 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationEGL.cpp: Validation functions for generic EGL entry point parameters
+
+#include "libANGLE/validationEGL.h"
+
+#include "common/utilities.h"
+#include "libANGLE/Config.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Device.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/EGLSync.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/Stream.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/Thread.h"
+#include "libANGLE/formatutils.h"
+
+#include <EGL/eglext.h>
+
+namespace egl
+{
+namespace
+{
+size_t GetMaximumMipLevel(const gl::Context *context, gl::TextureType type)
+{
+ const gl::Caps &caps = context->getCaps();
+
+ size_t maxDimension = 0;
+ switch (type)
+ {
+ case gl::TextureType::_2D:
+ case gl::TextureType::_2DArray:
+ case gl::TextureType::_2DMultisample:
+ maxDimension = caps.max2DTextureSize;
+ break;
+ case gl::TextureType::Rectangle:
+ maxDimension = caps.maxRectangleTextureSize;
+ break;
+ case gl::TextureType::CubeMap:
+ maxDimension = caps.maxCubeMapTextureSize;
+ break;
+ case gl::TextureType::_3D:
+ maxDimension = caps.max3DTextureSize;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ return gl::log2(static_cast<int>(maxDimension));
+}
+
+bool TextureHasNonZeroMipLevelsSpecified(const gl::Context *context, const gl::Texture *texture)
+{
+ size_t maxMip = GetMaximumMipLevel(context, texture->getType());
+ for (size_t level = 1; level < maxMip; level++)
+ {
+ if (texture->getType() == gl::TextureType::CubeMap)
+ {
+ for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets())
+ {
+ if (texture->getFormat(face, level).valid())
+ {
+ return true;
+ }
+ }
+ }
+ else
+ {
+ if (texture->getFormat(gl::NonCubeTextureTypeToTarget(texture->getType()), level)
+ .valid())
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool CubeTextureHasUnspecifiedLevel0Face(const gl::Texture *texture)
+{
+ ASSERT(texture->getType() == gl::TextureType::CubeMap);
+ for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets())
+ {
+ if (!texture->getFormat(face, 0).valid())
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+Error ValidateStreamAttribute(const EGLAttrib attribute,
+ const EGLAttrib value,
+ const DisplayExtensions &extensions)
+{
+ switch (attribute)
+ {
+ case EGL_STREAM_STATE_KHR:
+ case EGL_PRODUCER_FRAME_KHR:
+ case EGL_CONSUMER_FRAME_KHR:
+ return EglBadAccess() << "Attempt to initialize readonly parameter";
+ case EGL_CONSUMER_LATENCY_USEC_KHR:
+ // Technically not in spec but a latency < 0 makes no sense so we check it
+ if (value < 0)
+ {
+ return EglBadParameter() << "Latency must be positive";
+ }
+ break;
+ case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
+ if (!extensions.streamConsumerGLTexture)
+ {
+ return EglBadAttribute() << "Consumer GL extension not enabled";
+ }
+ // Again not in spec but it should be positive anyways
+ if (value < 0)
+ {
+ return EglBadParameter() << "Timeout must be positive";
+ }
+ break;
+ default:
+ return EglBadAttribute() << "Invalid stream attribute";
+ }
+ return NoError();
+}
+
+Error ValidateCreateImageMipLevelCommon(gl::Context *context,
+ const gl::Texture *texture,
+ EGLAttrib level)
+{
+ // Note that the spec EGL_create_image spec does not explicitly specify an error
+ // when the level is outside the base/max level range, but it does mention that the
+ // level "must be a part of the complete texture object <buffer>". It can be argued
+ // that out-of-range levels are not a part of the complete texture.
+ const GLuint effectiveBaseLevel = texture->getTextureState().getEffectiveBaseLevel();
+ if (level > 0 &&
+ (!texture->isMipmapComplete() || static_cast<GLuint>(level) < effectiveBaseLevel ||
+ static_cast<GLuint>(level) > texture->getTextureState().getMipmapMaxLevel()))
+ {
+ return EglBadParameter() << "texture must be complete if level is non-zero.";
+ }
+
+ if (level == 0 && !texture->isMipmapComplete() &&
+ TextureHasNonZeroMipLevelsSpecified(context, texture))
+ {
+ return EglBadParameter() << "if level is zero and the texture is incomplete, it must "
+ "have no mip levels specified except zero.";
+ }
+
+ return NoError();
+}
+
+Error ValidateConfigAttribute(const Display *display, EGLAttrib attribute)
+{
+ switch (attribute)
+ {
+ case EGL_BUFFER_SIZE:
+ case EGL_ALPHA_SIZE:
+ case EGL_BLUE_SIZE:
+ case EGL_GREEN_SIZE:
+ case EGL_RED_SIZE:
+ case EGL_DEPTH_SIZE:
+ case EGL_STENCIL_SIZE:
+ case EGL_CONFIG_CAVEAT:
+ case EGL_CONFIG_ID:
+ case EGL_LEVEL:
+ case EGL_NATIVE_RENDERABLE:
+ case EGL_NATIVE_VISUAL_ID:
+ case EGL_NATIVE_VISUAL_TYPE:
+ case EGL_SAMPLES:
+ case EGL_SAMPLE_BUFFERS:
+ case EGL_SURFACE_TYPE:
+ case EGL_TRANSPARENT_TYPE:
+ case EGL_TRANSPARENT_BLUE_VALUE:
+ case EGL_TRANSPARENT_GREEN_VALUE:
+ case EGL_TRANSPARENT_RED_VALUE:
+ case EGL_BIND_TO_TEXTURE_RGB:
+ case EGL_BIND_TO_TEXTURE_RGBA:
+ case EGL_MIN_SWAP_INTERVAL:
+ case EGL_MAX_SWAP_INTERVAL:
+ case EGL_LUMINANCE_SIZE:
+ case EGL_ALPHA_MASK_SIZE:
+ case EGL_COLOR_BUFFER_TYPE:
+ case EGL_RENDERABLE_TYPE:
+ case EGL_MATCH_NATIVE_PIXMAP:
+ case EGL_CONFORMANT:
+ case EGL_MAX_PBUFFER_WIDTH:
+ case EGL_MAX_PBUFFER_HEIGHT:
+ case EGL_MAX_PBUFFER_PIXELS:
+ break;
+
+ case EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE:
+ if (!display->getExtensions().surfaceOrientation)
+ {
+ return EglBadAttribute() << "EGL_ANGLE_surface_orientation is not enabled.";
+ }
+ break;
+
+ case EGL_COLOR_COMPONENT_TYPE_EXT:
+ if (!display->getExtensions().pixelFormatFloat)
+ {
+ return EglBadAttribute() << "EGL_EXT_pixel_format_float is not enabled.";
+ }
+ break;
+
+ case EGL_RECORDABLE_ANDROID:
+ if (!display->getExtensions().recordable)
+ {
+ return EglBadAttribute() << "EGL_ANDROID_recordable is not enabled.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Unknown attribute.";
+ }
+
+ return NoError();
+}
+
+Error ValidateConfigAttributeValue(const Display *display, EGLAttrib attribute, EGLAttrib value)
+{
+ switch (attribute)
+ {
+
+ case EGL_BIND_TO_TEXTURE_RGB:
+ case EGL_BIND_TO_TEXTURE_RGBA:
+ switch (value)
+ {
+ case EGL_DONT_CARE:
+ case EGL_TRUE:
+ case EGL_FALSE:
+ break;
+ default:
+ return EglBadAttribute() << "EGL_bind_to_texture invalid attribute: " << value;
+ }
+ break;
+
+ case EGL_COLOR_BUFFER_TYPE:
+ switch (value)
+ {
+ case EGL_RGB_BUFFER:
+ case EGL_LUMINANCE_BUFFER:
+ // EGL_DONT_CARE doesn't match the spec, but does match dEQP usage
+ case EGL_DONT_CARE:
+ break;
+ default:
+ return EglBadAttribute()
+ << "EGL_color_buffer_type invalid attribute: " << value;
+ }
+ break;
+
+ case EGL_NATIVE_RENDERABLE:
+ switch (value)
+ {
+ case EGL_DONT_CARE:
+ case EGL_TRUE:
+ case EGL_FALSE:
+ break;
+ default:
+ return EglBadAttribute()
+ << "EGL_native_renderable invalid attribute: " << value;
+ }
+ break;
+
+ case EGL_TRANSPARENT_TYPE:
+ switch (value)
+ {
+ case EGL_NONE:
+ case EGL_TRANSPARENT_RGB:
+ // EGL_DONT_CARE doesn't match the spec, but does match dEQP usage
+ case EGL_DONT_CARE:
+ break;
+ default:
+ return EglBadAttribute() << "EGL_transparent_type invalid attribute: " << value;
+ }
+ break;
+
+ case EGL_RECORDABLE_ANDROID:
+ switch (value)
+ {
+ case EGL_TRUE:
+ case EGL_FALSE:
+ case EGL_DONT_CARE:
+ break;
+ default:
+ return EglBadAttribute()
+ << "EGL_RECORDABLE_ANDROID invalid attribute: " << value;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return NoError();
+}
+
+Error ValidateConfigAttributes(const Display *display, const AttributeMap &attributes)
+{
+ for (const auto &attrib : attributes)
+ {
+ ANGLE_TRY(ValidateConfigAttribute(display, attrib.first));
+ ANGLE_TRY(ValidateConfigAttributeValue(display, attrib.first, attrib.second));
+ }
+
+ return NoError();
+}
+
+Error ValidatePlatformType(const ClientExtensions &clientExtensions, EGLAttrib platformType)
+{
+ switch (platformType)
+ {
+ case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
+ case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
+ if (!clientExtensions.platformANGLED3D)
+ {
+ return EglBadAttribute() << "Direct3D platform is unsupported.";
+ }
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
+ case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
+ if (!clientExtensions.platformANGLEOpenGL)
+ {
+ return EglBadAttribute() << "OpenGL platform is unsupported.";
+ }
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
+ if (!clientExtensions.platformANGLENULL)
+ {
+ return EglBadAttribute() << "Display type EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE "
+ "requires EGL_ANGLE_platform_angle_null.";
+ }
+ break;
+
+ case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
+ if (!clientExtensions.platformANGLEVulkan)
+ {
+ return EglBadAttribute() << "Vulkan platform is unsupported.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Unknown platform type.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetPlatformDisplayCommon(EGLenum platform,
+ void *native_display,
+ const AttributeMap &attribMap)
+{
+ const ClientExtensions &clientExtensions = Display::GetClientExtensions();
+
+ switch (platform)
+ {
+ case EGL_PLATFORM_ANGLE_ANGLE:
+ if (!clientExtensions.platformANGLE)
+ {
+ return EglBadParameter() << "Platform ANGLE extension is not active";
+ }
+ break;
+ case EGL_PLATFORM_DEVICE_EXT:
+ if (!clientExtensions.platformDevice)
+ {
+ return EglBadParameter() << "Platform Device extension is not active";
+ }
+ break;
+ default:
+ return EglBadConfig() << "Bad platform type.";
+ }
+
+ if (platform == EGL_PLATFORM_ANGLE_ANGLE)
+ {
+ EGLAttrib platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
+ bool enableAutoTrimSpecified = false;
+ bool presentPathSpecified = false;
+
+ Optional<EGLAttrib> majorVersion;
+ Optional<EGLAttrib> minorVersion;
+ Optional<EGLAttrib> deviceType;
+ Optional<EGLAttrib> eglHandle;
+
+ for (const auto &curAttrib : attribMap)
+ {
+ const EGLAttrib value = curAttrib.second;
+
+ switch (curAttrib.first)
+ {
+ case EGL_PLATFORM_ANGLE_TYPE_ANGLE:
+ {
+ ANGLE_TRY(ValidatePlatformType(clientExtensions, value));
+ platformType = value;
+ break;
+ }
+
+ case EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE:
+ if (value != EGL_DONT_CARE)
+ {
+ majorVersion = value;
+ }
+ break;
+
+ case EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE:
+ if (value != EGL_DONT_CARE)
+ {
+ minorVersion = value;
+ }
+ break;
+
+ case EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE:
+ switch (value)
+ {
+ case EGL_TRUE:
+ case EGL_FALSE:
+ break;
+ default:
+ return EglBadAttribute() << "Invalid automatic trim attribute";
+ }
+ enableAutoTrimSpecified = true;
+ break;
+
+ case EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE:
+ if (!clientExtensions.experimentalPresentPath)
+ {
+ return EglBadAttribute()
+ << "EGL_ANGLE_experimental_present_path extension not active";
+ }
+
+ switch (value)
+ {
+ case EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE:
+ case EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE:
+ break;
+ default:
+ return EglBadAttribute()
+ << "Invalid value for EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE";
+ }
+ presentPathSpecified = true;
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE:
+ switch (value)
+ {
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE:
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
+ if (!clientExtensions.platformANGLED3D)
+ {
+ return EglBadAttribute()
+ << "EGL_ANGLE_platform_angle_d3d is not supported";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid value for "
+ "EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE "
+ "attrib";
+ }
+ deviceType = value;
+ break;
+
+ case EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE:
+ if (!clientExtensions.platformANGLE)
+ {
+ return EglBadAttribute() << "EGL_ANGLE_platform_angle extension not active";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE && value != EGL_DONT_CARE)
+ {
+ return EglBadAttribute() << "EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE "
+ "must be EGL_TRUE, EGL_FALSE, or "
+ "EGL_DONT_CARE.";
+ }
+ break;
+
+ case EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE:
+ if (value != EGL_DONT_CARE)
+ {
+ eglHandle = value;
+ }
+ break;
+
+ case EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE:
+ if (!clientExtensions.platformANGLEContextVirtualization)
+ {
+ return EglBadAttribute() << "EGL_ANGLE_platform_angle_context_"
+ "virtualization extension not active";
+ }
+
+ switch (value)
+ {
+ case EGL_DONT_CARE:
+ case EGL_FALSE:
+ case EGL_TRUE:
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid value for "
+ "EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_"
+ "ANGLE attrib";
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (!majorVersion.valid() && minorVersion.valid())
+ {
+ return EglBadAttribute()
+ << "Must specify major version if you specify a minor version.";
+ }
+
+ if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE &&
+ platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ return EglBadAttribute() << "EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE requires a "
+ "device type of EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.";
+ }
+
+ if (enableAutoTrimSpecified && platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ return EglBadAttribute() << "EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE "
+ "requires a device type of "
+ "EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.";
+ }
+
+ if (presentPathSpecified && platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ return EglBadAttribute() << "EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE requires a "
+ "device type of EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.";
+ }
+
+ if (deviceType.valid())
+ {
+ switch (deviceType.value())
+ {
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
+ case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE:
+ if (platformType != EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE &&
+ platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ return EglBadAttribute()
+ << "This device type requires a "
+ "platform type of EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE or "
+ "EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE.";
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (platformType == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE)
+ {
+ if ((majorVersion.valid() && majorVersion.value() != 1) ||
+ (minorVersion.valid() && minorVersion.value() != 0))
+ {
+ return EglBadAttribute() << "EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE currently "
+ "only supports Vulkan 1.0.";
+ }
+ }
+
+ if (eglHandle.valid() && platformType != EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE &&
+ platformType != EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE)
+ {
+ return EglBadAttribute() << "EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE requires a "
+ "device type of EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE.";
+ }
+ }
+ else if (platform == EGL_PLATFORM_DEVICE_EXT)
+ {
+ Device *eglDevice = static_cast<Device *>(native_display);
+ if (eglDevice == nullptr || !Device::IsValidDevice(eglDevice))
+ {
+ return EglBadAttribute() << "native_display should be a valid EGL device if "
+ "platform equals EGL_PLATFORM_DEVICE_EXT";
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ }
+
+ if (attribMap.contains(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE))
+ {
+ if (!clientExtensions.featureControlANGLE)
+ {
+ return EglBadAttribute() << "EGL_ANGLE_feature_control is not supported";
+ }
+ else if (attribMap.get(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE, 0) == 0)
+ {
+ return EglBadAttribute()
+ << "EGL_FEATURE_OVERRIDES_ENABLED_ANGLE must be a valid pointer";
+ }
+ }
+ if (attribMap.contains(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE))
+ {
+ if (!clientExtensions.featureControlANGLE)
+ {
+ return EglBadAttribute() << "EGL_ANGLE_feature_control is not supported";
+ }
+ else if (attribMap.get(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE, 0) == 0)
+ {
+ return EglBadAttribute()
+ << "EGL_FEATURE_OVERRIDES_DISABLED_ANGLE must be a valid pointer";
+ }
+ }
+
+ return NoError();
+}
+
+Error ValidateStream(const Display *display, const Stream *stream)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.stream)
+ {
+ return EglBadAccess() << "Stream extension not active";
+ }
+
+ if (stream == EGL_NO_STREAM_KHR || !display->isValidStream(stream))
+ {
+ return EglBadStream() << "Invalid stream";
+ }
+
+ return NoError();
+}
+
+Error ValidateLabeledObject(Thread *thread,
+ const Display *display,
+ ObjectType objectType,
+ EGLObjectKHR object,
+ LabeledObject **outLabeledObject)
+{
+ switch (objectType)
+ {
+ case ObjectType::Context:
+ {
+ gl::Context *context = static_cast<gl::Context *>(object);
+ ANGLE_TRY(ValidateContext(display, context));
+ *outLabeledObject = context;
+ break;
+ }
+
+ case ObjectType::Display:
+ {
+ ANGLE_TRY(ValidateDisplay(display));
+ if (display != object)
+ {
+ return EglBadParameter() << "when object type is EGL_OBJECT_DISPLAY_KHR, the "
+ "object must be the same as the display.";
+ }
+
+ *outLabeledObject = static_cast<Display *>(object);
+ break;
+ }
+
+ case ObjectType::Image:
+ {
+ Image *image = static_cast<Image *>(object);
+ ANGLE_TRY(ValidateImage(display, image));
+ *outLabeledObject = image;
+ break;
+ }
+
+ case ObjectType::Stream:
+ {
+ Stream *stream = static_cast<Stream *>(object);
+ ANGLE_TRY(ValidateStream(display, stream));
+ *outLabeledObject = stream;
+ break;
+ }
+
+ case ObjectType::Surface:
+ {
+ Surface *surface = static_cast<Surface *>(object);
+ ANGLE_TRY(ValidateSurface(display, surface));
+ *outLabeledObject = surface;
+ break;
+ }
+
+ case ObjectType::Sync:
+ {
+ Sync *sync = static_cast<Sync *>(object);
+ ANGLE_TRY(ValidateSync(display, sync));
+ *outLabeledObject = sync;
+ break;
+ }
+
+ case ObjectType::Thread:
+ {
+ *outLabeledObject = thread;
+ break;
+ }
+
+ default:
+ return EglBadParameter() << "unknown object type.";
+ }
+
+ return NoError();
+}
+
+// This is a common sub-check of Display status that's shared by multiple functions
+Error ValidateDisplayPointer(const Display *display)
+{
+ if (display == EGL_NO_DISPLAY)
+ {
+ return EglBadDisplay() << "display is EGL_NO_DISPLAY.";
+ }
+
+ if (!Display::isValidDisplay(display))
+ {
+ return EglBadDisplay() << "display is not a valid display.";
+ }
+
+ return NoError();
+}
+
+bool ValidCompositorTimingName(CompositorTiming name)
+{
+ switch (name)
+ {
+ case CompositorTiming::CompositeDeadline:
+ case CompositorTiming::CompositInterval:
+ case CompositorTiming::CompositToPresentLatency:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidTimestampType(Timestamp timestamp)
+{
+ switch (timestamp)
+ {
+ case Timestamp::RequestedPresentTime:
+ case Timestamp::RenderingCompleteTime:
+ case Timestamp::CompositionLatchTime:
+ case Timestamp::FirstCompositionStartTime:
+ case Timestamp::LastCompositionStartTime:
+ case Timestamp::FirstCompositionGPUFinishedTime:
+ case Timestamp::DisplayPresentTime:
+ case Timestamp::DequeueReadyTime:
+ case Timestamp::ReadsDoneTime:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+} // anonymous namespace
+
+Error ValidateDisplay(const Display *display)
+{
+ ANGLE_TRY(ValidateDisplayPointer(display));
+
+ if (!display->isInitialized())
+ {
+ return EglNotInitialized() << "display is not initialized.";
+ }
+
+ if (display->isDeviceLost())
+ {
+ return EglContextLost() << "display had a context loss";
+ }
+
+ return NoError();
+}
+
+Error ValidateSurface(const Display *display, const Surface *surface)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->isValidSurface(surface))
+ {
+ return EglBadSurface();
+ }
+
+ return NoError();
+}
+
+Error ValidateConfig(const Display *display, const Config *config)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->isValidConfig(config))
+ {
+ return EglBadConfig();
+ }
+
+ return NoError();
+}
+
+Error ValidateContext(const Display *display, const gl::Context *context)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->isValidContext(context))
+ {
+ return EglBadContext();
+ }
+
+ return NoError();
+}
+
+Error ValidateImage(const Display *display, const Image *image)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->isValidImage(image))
+ {
+ return EglBadParameter() << "image is not valid.";
+ }
+
+ return NoError();
+}
+
+Error ValidateDevice(const Device *device)
+{
+ if (device == EGL_NO_DEVICE_EXT)
+ {
+ return EglBadAccess() << "device is EGL_NO_DEVICE.";
+ }
+
+ if (!Device::IsValidDevice(device))
+ {
+ return EglBadAccess() << "device is not valid.";
+ }
+
+ return NoError();
+}
+
+Error ValidateSync(const Display *display, const Sync *sync)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->isValidSync(sync))
+ {
+ return EglBadParameter() << "sync object is not valid.";
+ }
+
+ return NoError();
+}
+
+const Thread *GetThreadIfValid(const Thread *thread)
+{
+ // Threads should always be valid
+ return thread;
+}
+
+const Display *GetDisplayIfValid(const Display *display)
+{
+ if (ValidateDisplay(display).isError())
+ {
+ return nullptr;
+ }
+
+ return display;
+}
+
+const Surface *GetSurfaceIfValid(const Display *display, const Surface *surface)
+{
+ if (ValidateSurface(display, surface).isError())
+ {
+ return nullptr;
+ }
+
+ return surface;
+}
+
+const Image *GetImageIfValid(const Display *display, const Image *image)
+{
+ if (ValidateImage(display, image).isError())
+ {
+ return nullptr;
+ }
+
+ return image;
+}
+
+const Stream *GetStreamIfValid(const Display *display, const Stream *stream)
+{
+ if (ValidateStream(display, stream).isError())
+ {
+ return nullptr;
+ }
+
+ return stream;
+}
+
+const gl::Context *GetContextIfValid(const Display *display, const gl::Context *context)
+{
+ if (ValidateContext(display, context).isError())
+ {
+ return nullptr;
+ }
+
+ return context;
+}
+
+const Device *GetDeviceIfValid(const Device *device)
+{
+ if (ValidateDevice(device).isError())
+ {
+ return nullptr;
+ }
+
+ return device;
+}
+
+const Sync *GetSyncIfValid(const Display *display, const Sync *sync)
+{
+ if (ValidateSync(display, sync).isError())
+ {
+ return nullptr;
+ }
+
+ return sync;
+}
+
+LabeledObject *GetLabeledObjectIfValid(Thread *thread,
+ const Display *display,
+ ObjectType objectType,
+ EGLObjectKHR object)
+{
+ LabeledObject *labeledObject = nullptr;
+ if (ValidateLabeledObject(thread, display, objectType, object, &labeledObject).isError())
+ {
+ return nullptr;
+ }
+
+ return labeledObject;
+}
+
+Error ValidateInitialize(const Display *display)
+{
+ return ValidateDisplayPointer(display);
+}
+
+Error ValidateTerminate(const Display *display)
+{
+ return ValidateDisplayPointer(display);
+}
+
+Error ValidateCreateContext(Display *display,
+ Config *configuration,
+ gl::Context *shareContext,
+ const AttributeMap &attributes)
+{
+ ANGLE_TRY(ValidateConfig(display, configuration));
+
+ // Get the requested client version (default is 1) and check it is 2 or 3.
+ EGLAttrib clientMajorVersion = 1;
+ EGLAttrib clientMinorVersion = 0;
+ EGLAttrib contextFlags = 0;
+ bool resetNotification = false;
+ for (AttributeMap::const_iterator attributeIter = attributes.begin();
+ attributeIter != attributes.end(); attributeIter++)
+ {
+ EGLAttrib attribute = attributeIter->first;
+ EGLAttrib value = attributeIter->second;
+
+ switch (attribute)
+ {
+ case EGL_CONTEXT_CLIENT_VERSION:
+ clientMajorVersion = value;
+ break;
+
+ case EGL_CONTEXT_MINOR_VERSION:
+ clientMinorVersion = value;
+ break;
+
+ case EGL_CONTEXT_FLAGS_KHR:
+ contextFlags = value;
+ break;
+
+ case EGL_CONTEXT_OPENGL_DEBUG:
+ break;
+
+ case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
+ // Only valid for OpenGL (non-ES) contexts
+ return EglBadAttribute();
+
+ case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
+ if (!display->getExtensions().createContextRobustness)
+ {
+ return EglBadAttribute();
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
+ return EglBadAttribute()
+ << "EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR is not"
+ << " valid for GLES with EGL 1.4 and KHR_create_context. Use"
+ << " EXT_create_context_robustness.";
+ case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
+ if (!display->getExtensions().createContextRobustness)
+ {
+ return EglBadAttribute();
+ }
+ if (value == EGL_LOSE_CONTEXT_ON_RESET_EXT)
+ {
+ resetNotification = true;
+ }
+ else if (value != EGL_NO_RESET_NOTIFICATION_EXT)
+ {
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_CONTEXT_OPENGL_NO_ERROR_KHR:
+ if (!display->getExtensions().createContextNoError)
+ {
+ return EglBadAttribute() << "Invalid Context attribute.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "Attribute must be EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE:
+ if (!display->getExtensions().createContextWebGLCompatibility)
+ {
+ return EglBadAttribute() << "Attribute "
+ "EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE requires "
+ "EGL_ANGLE_create_context_webgl_compatibility.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE must be "
+ "EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM:
+ if (!display->getExtensions().createContextBindGeneratesResource)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM requires "
+ "EGL_CHROMIUM_create_context_bind_generates_resource.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM "
+ "must be EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE:
+ if (!display->getExtensions().displayTextureShareGroup)
+ {
+ return EglBadAttribute() << "Attribute "
+ "EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE requires "
+ "EGL_ANGLE_display_texture_share_group.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE must be "
+ "EGL_TRUE or EGL_FALSE.";
+ }
+ if (shareContext &&
+ (shareContext->usingDisplayTextureShareGroup() != (value == EGL_TRUE)))
+ {
+ return EglBadAttribute() << "All contexts within a share group must be "
+ "created with the same value of "
+ "EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE.";
+ }
+ break;
+
+ case EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE:
+ if (!display->getExtensions().createContextClientArrays)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE requires "
+ "EGL_ANGLE_create_context_client_arrays.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE must "
+ "be EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE:
+ if (!display->getExtensions().programCacheControl)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE "
+ "requires EGL_ANGLE_program_cache_control.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute()
+ << "EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE must "
+ "be EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ if (!display->getExtensions().robustResourceInitialization)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
+ "requires EGL_ANGLE_robust_resource_initialization.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
+ "either EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_EXTENSIONS_ENABLED_ANGLE:
+ if (!display->getExtensions().createContextExtensionsEnabled)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_EXTENSIONS_ENABLED_ANGLE "
+ "requires EGL_ANGLE_create_context_extensions_enabled.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_EXTENSIONS_ENABLED_ANGLE must be "
+ "either EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_POWER_PREFERENCE_ANGLE:
+ if (!display->getExtensions().powerPreference)
+ {
+ return EglBadAttribute() << "Attribute EGL_POWER_PREFERENCE_ANGLE "
+ "requires EGL_ANGLE_power_preference.";
+ }
+ if (value != EGL_LOW_POWER_ANGLE && value != EGL_HIGH_POWER_ANGLE)
+ {
+ return EglBadAttribute()
+ << "EGL_POWER_PREFERENCE_ANGLE must be "
+ "either EGL_LOW_POWER_ANGLE or EGL_HIGH_POWER_ANGLE.";
+ }
+ break;
+
+ case EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE:
+ if (!display->getExtensions().createContextBackwardsCompatible)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE "
+ "requires EGL_ANGLE_create_context_backwards_compatible.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute()
+ << "EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE must be "
+ "either EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Unknown attribute.";
+ }
+ }
+
+ switch (clientMajorVersion)
+ {
+ case 1:
+ if (clientMinorVersion != 0 && clientMinorVersion != 1)
+ {
+ return EglBadConfig();
+ }
+ break;
+
+ case 2:
+ if (clientMinorVersion != 0)
+ {
+ return EglBadConfig();
+ }
+ break;
+ case 3:
+ if (clientMinorVersion != 0 && clientMinorVersion != 1)
+ {
+ return EglBadConfig();
+ }
+ if (!(configuration->renderableType & EGL_OPENGL_ES3_BIT_KHR))
+ {
+ return EglBadConfig();
+ }
+ if (display->getMaxSupportedESVersion() <
+ gl::Version(static_cast<GLuint>(clientMajorVersion),
+ static_cast<GLuint>(clientMinorVersion)))
+ {
+ return EglBadConfig() << "Requested GLES version is not supported.";
+ }
+ break;
+ default:
+ return EglBadConfig();
+ break;
+ }
+
+ // Note: EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR does not apply to ES
+ const EGLint validContextFlags =
+ (EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR | EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR);
+ if ((contextFlags & ~validContextFlags) != 0)
+ {
+ return EglBadAttribute();
+ }
+
+ if (shareContext)
+ {
+ // Shared context is invalid or is owned by another display
+ if (!display->isValidContext(shareContext))
+ {
+ return EglBadMatch();
+ }
+
+ if (shareContext->isResetNotificationEnabled() != resetNotification)
+ {
+ return EglBadMatch();
+ }
+ }
+
+ return NoError();
+}
+
+Error ValidateCreateWindowSurface(Display *display,
+ Config *config,
+ EGLNativeWindowType window,
+ const AttributeMap &attributes)
+{
+ ANGLE_TRY(ValidateConfig(display, config));
+
+ if (!display->isValidNativeWindow(window))
+ {
+ return EglBadNativeWindow();
+ }
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+
+ for (AttributeMap::const_iterator attributeIter = attributes.begin();
+ attributeIter != attributes.end(); attributeIter++)
+ {
+ EGLAttrib attribute = attributeIter->first;
+ EGLAttrib value = attributeIter->second;
+
+ switch (attribute)
+ {
+ case EGL_RENDER_BUFFER:
+ switch (value)
+ {
+ case EGL_BACK_BUFFER:
+ break;
+ case EGL_SINGLE_BUFFER:
+ return EglBadMatch(); // Rendering directly to front buffer not supported
+ default:
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
+ if (!displayExtensions.postSubBuffer)
+ {
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
+ if (!displayExtensions.flexibleSurfaceCompatibility)
+ {
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_WIDTH:
+ case EGL_HEIGHT:
+ if (!displayExtensions.windowFixedSize)
+ {
+ return EglBadAttribute();
+ }
+ if (value < 0)
+ {
+ return EglBadParameter();
+ }
+ break;
+
+ case EGL_FIXED_SIZE_ANGLE:
+ if (!displayExtensions.windowFixedSize)
+ {
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_SURFACE_ORIENTATION_ANGLE:
+ if (!displayExtensions.surfaceOrientation)
+ {
+ return EglBadAttribute() << "EGL_ANGLE_surface_orientation is not enabled.";
+ }
+ break;
+
+ case EGL_VG_COLORSPACE:
+ return EglBadMatch();
+
+ case EGL_VG_ALPHA_FORMAT:
+ return EglBadMatch();
+
+ case EGL_DIRECT_COMPOSITION_ANGLE:
+ if (!displayExtensions.directComposition)
+ {
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ if (!display->getExtensions().robustResourceInitialization)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
+ "requires EGL_ANGLE_robust_resource_initialization.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
+ "either EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute();
+ }
+ }
+
+ if (Display::hasExistingWindowSurface(window))
+ {
+ return EglBadAlloc();
+ }
+
+ return NoError();
+}
+
+Error ValidateCreatePbufferSurface(Display *display, Config *config, const AttributeMap &attributes)
+{
+ ANGLE_TRY(ValidateConfig(display, config));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+
+ for (AttributeMap::const_iterator attributeIter = attributes.begin();
+ attributeIter != attributes.end(); attributeIter++)
+ {
+ EGLAttrib attribute = attributeIter->first;
+ EGLAttrib value = attributeIter->second;
+
+ switch (attribute)
+ {
+ case EGL_WIDTH:
+ case EGL_HEIGHT:
+ if (value < 0)
+ {
+ return EglBadParameter();
+ }
+ break;
+
+ case EGL_LARGEST_PBUFFER:
+ break;
+
+ case EGL_TEXTURE_FORMAT:
+ switch (value)
+ {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_RGB:
+ case EGL_TEXTURE_RGBA:
+ break;
+ default:
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_TEXTURE_TARGET:
+ switch (value)
+ {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_2D:
+ break;
+ default:
+ return EglBadAttribute();
+ }
+ break;
+
+ case EGL_MIPMAP_TEXTURE:
+ break;
+
+ case EGL_VG_COLORSPACE:
+ break;
+
+ case EGL_VG_ALPHA_FORMAT:
+ break;
+
+ case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
+ if (!displayExtensions.flexibleSurfaceCompatibility)
+ {
+ return EglBadAttribute()
+ << "EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE cannot be used "
+ "without EGL_ANGLE_flexible_surface_compatibility support.";
+ }
+ break;
+
+ case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ if (!display->getExtensions().robustResourceInitialization)
+ {
+ return EglBadAttribute()
+ << "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
+ "requires EGL_ANGLE_robust_resource_initialization.";
+ }
+ if (value != EGL_TRUE && value != EGL_FALSE)
+ {
+ return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
+ "either EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute();
+ }
+ }
+
+ if (!(config->surfaceType & EGL_PBUFFER_BIT))
+ {
+ return EglBadMatch();
+ }
+
+ const Caps &caps = display->getCaps();
+
+ EGLAttrib textureFormat = attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
+ EGLAttrib textureTarget = attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
+
+ if ((textureFormat != EGL_NO_TEXTURE && textureTarget == EGL_NO_TEXTURE) ||
+ (textureFormat == EGL_NO_TEXTURE && textureTarget != EGL_NO_TEXTURE))
+ {
+ return EglBadMatch();
+ }
+
+ if ((textureFormat == EGL_TEXTURE_RGB && config->bindToTextureRGB != EGL_TRUE) ||
+ (textureFormat == EGL_TEXTURE_RGBA && config->bindToTextureRGBA != EGL_TRUE))
+ {
+ return EglBadAttribute();
+ }
+
+ EGLint width = static_cast<EGLint>(attributes.get(EGL_WIDTH, 0));
+ EGLint height = static_cast<EGLint>(attributes.get(EGL_HEIGHT, 0));
+ if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT &&
+ (!gl::isPow2(width) || !gl::isPow2(height)))
+ {
+ return EglBadMatch();
+ }
+
+ return NoError();
+}
+
+Error ValidateCreatePbufferFromClientBuffer(Display *display,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ Config *config,
+ const AttributeMap &attributes)
+{
+ ANGLE_TRY(ValidateConfig(display, config));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+
+ switch (buftype)
+ {
+ case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+ if (!displayExtensions.d3dShareHandleClientBuffer)
+ {
+ return EglBadParameter();
+ }
+ if (buffer == nullptr)
+ {
+ return EglBadParameter();
+ }
+ break;
+
+ case EGL_D3D_TEXTURE_ANGLE:
+ if (!displayExtensions.d3dTextureClientBuffer)
+ {
+ return EglBadParameter();
+ }
+ if (buffer == nullptr)
+ {
+ return EglBadParameter();
+ }
+ break;
+
+ case EGL_IOSURFACE_ANGLE:
+ if (!displayExtensions.iosurfaceClientBuffer)
+ {
+ return EglBadParameter() << "<buftype> EGL_IOSURFACE_ANGLE requires the "
+ "EGL_ANGLE_iosurface_client_buffer extension.";
+ }
+ if (buffer == nullptr)
+ {
+ return EglBadParameter() << "<buffer> must be non null";
+ }
+ break;
+
+ default:
+ return EglBadParameter();
+ }
+
+ for (AttributeMap::const_iterator attributeIter = attributes.begin();
+ attributeIter != attributes.end(); attributeIter++)
+ {
+ EGLAttrib attribute = attributeIter->first;
+ EGLAttrib value = attributeIter->second;
+
+ switch (attribute)
+ {
+ case EGL_WIDTH:
+ case EGL_HEIGHT:
+ if (buftype != EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE &&
+ buftype != EGL_D3D_TEXTURE_ANGLE && buftype != EGL_IOSURFACE_ANGLE)
+ {
+ return EglBadParameter()
+ << "Width and Height are not supported for thie <buftype>";
+ }
+ if (value < 0)
+ {
+ return EglBadParameter() << "Width and Height must be positive";
+ }
+ break;
+
+ case EGL_TEXTURE_FORMAT:
+ switch (value)
+ {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_RGB:
+ case EGL_TEXTURE_RGBA:
+ break;
+ default:
+ return EglBadAttribute() << "Invalid value for EGL_TEXTURE_FORMAT";
+ }
+ break;
+
+ case EGL_TEXTURE_TARGET:
+ switch (value)
+ {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_2D:
+ break;
+ case EGL_TEXTURE_RECTANGLE_ANGLE:
+ if (buftype != EGL_IOSURFACE_ANGLE)
+ {
+ return EglBadParameter()
+ << "<buftype> doesn't support rectangle texture targets";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid value for EGL_TEXTURE_TARGET";
+ }
+ break;
+
+ case EGL_MIPMAP_TEXTURE:
+ break;
+
+ case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
+ if (!displayExtensions.flexibleSurfaceCompatibility)
+ {
+ return EglBadAttribute()
+ << "EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE cannot be used "
+ "without EGL_ANGLE_flexible_surface_compatibility support.";
+ }
+ break;
+
+ case EGL_IOSURFACE_PLANE_ANGLE:
+ if (buftype != EGL_IOSURFACE_ANGLE)
+ {
+ return EglBadAttribute() << "<buftype> doesn't support iosurface plane";
+ }
+ break;
+
+ case EGL_TEXTURE_TYPE_ANGLE:
+ if (buftype != EGL_IOSURFACE_ANGLE)
+ {
+ return EglBadAttribute() << "<buftype> doesn't support texture type";
+ }
+ break;
+
+ case EGL_TEXTURE_INTERNAL_FORMAT_ANGLE:
+ if (buftype != EGL_IOSURFACE_ANGLE)
+ {
+ return EglBadAttribute() << "<buftype> doesn't support texture internal format";
+ }
+ break;
+ case EGL_GL_COLORSPACE:
+ if (buftype != EGL_D3D_TEXTURE_ANGLE)
+ {
+ return EglBadAttribute() << "<buftype> doesn't support setting GL colorspace";
+ }
+ break;
+ default:
+ return EglBadAttribute();
+ }
+ }
+
+ EGLAttrib colorspace = attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
+ if (colorspace != EGL_GL_COLORSPACE_LINEAR && colorspace != EGL_GL_COLORSPACE_SRGB)
+ {
+ return EglBadAttribute() << "invalid GL colorspace";
+ }
+
+ if (!(config->surfaceType & EGL_PBUFFER_BIT))
+ {
+ return EglBadMatch();
+ }
+
+ EGLAttrib textureFormat = attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
+ EGLAttrib textureTarget = attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
+ if ((textureFormat != EGL_NO_TEXTURE && textureTarget == EGL_NO_TEXTURE) ||
+ (textureFormat == EGL_NO_TEXTURE && textureTarget != EGL_NO_TEXTURE))
+ {
+ return EglBadMatch();
+ }
+ if ((textureFormat == EGL_TEXTURE_RGB && config->bindToTextureRGB != EGL_TRUE) ||
+ (textureFormat == EGL_TEXTURE_RGBA && config->bindToTextureRGBA != EGL_TRUE))
+ {
+ // TODO(cwallez@chromium.org): For IOSurface pbuffers we require that EGL_TEXTURE_RGBA is
+ // set so that eglBindTexImage works. Normally this is only allowed if the config exposes
+ // the bindToTextureRGB/RGBA flag. This issue is that enabling this flags means that
+ // eglBindTexImage should also work for regular pbuffers which isn't implemented on macOS.
+ // Instead of adding the flag we special case the check here to be ignored for IOSurfaces.
+ // The TODO is to find a proper solution for this, maybe by implementing eglBindTexImage on
+ // OSX?
+ if (buftype != EGL_IOSURFACE_ANGLE)
+ {
+ return EglBadAttribute();
+ }
+ }
+
+ if (buftype == EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE)
+ {
+ EGLint width = static_cast<EGLint>(attributes.get(EGL_WIDTH, 0));
+ EGLint height = static_cast<EGLint>(attributes.get(EGL_HEIGHT, 0));
+
+ if (width == 0 || height == 0)
+ {
+ return EglBadAttribute();
+ }
+
+ const Caps &caps = display->getCaps();
+ if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT &&
+ (!gl::isPow2(width) || !gl::isPow2(height)))
+ {
+ return EglBadMatch();
+ }
+ }
+
+ if (buftype == EGL_IOSURFACE_ANGLE)
+ {
+ if (textureTarget != EGL_TEXTURE_RECTANGLE_ANGLE)
+ {
+ return EglBadAttribute() << "EGL_IOSURFACE requires the EGL_TEXTURE_RECTANGLE target";
+ }
+
+ if (textureFormat != EGL_TEXTURE_RGBA)
+ {
+ return EglBadAttribute() << "EGL_IOSURFACE requires the EGL_TEXTURE_RGBA format";
+ }
+
+ if (!attributes.contains(EGL_WIDTH) || !attributes.contains(EGL_HEIGHT) ||
+ !attributes.contains(EGL_TEXTURE_FORMAT) ||
+ !attributes.contains(EGL_TEXTURE_TYPE_ANGLE) ||
+ !attributes.contains(EGL_TEXTURE_INTERNAL_FORMAT_ANGLE) ||
+ !attributes.contains(EGL_IOSURFACE_PLANE_ANGLE))
+ {
+ return EglBadParameter() << "Missing required attribute for EGL_IOSURFACE";
+ }
+ }
+
+ ANGLE_TRY(display->validateClientBuffer(config, buftype, buffer, attributes));
+
+ return NoError();
+}
+
+Error ValidateMakeCurrent(Display *display, Surface *draw, Surface *read, gl::Context *context)
+{
+ if (context == EGL_NO_CONTEXT && (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
+ {
+ return EglBadMatch() << "If ctx is EGL_NO_CONTEXT, surfaces must be EGL_NO_SURFACE";
+ }
+
+ // If ctx is EGL_NO_CONTEXT and either draw or read are not EGL_NO_SURFACE, an EGL_BAD_MATCH
+ // error is generated. EGL_KHR_surfaceless_context allows both surfaces to be EGL_NO_SURFACE.
+ if (context != EGL_NO_CONTEXT && (draw == EGL_NO_SURFACE || read == EGL_NO_SURFACE))
+ {
+ if (display->getExtensions().surfacelessContext)
+ {
+ if ((draw == EGL_NO_SURFACE) != (read == EGL_NO_SURFACE))
+ {
+ return EglBadMatch() << "If ctx is not EGL_NOT_CONTEXT, draw or read must "
+ "both be EGL_NO_SURFACE, or both not";
+ }
+ }
+ else
+ {
+ return EglBadMatch()
+ << "If ctx is not EGL_NO_CONTEXT, surfaces must not be EGL_NO_SURFACE";
+ }
+ }
+
+ // If either of draw or read is a valid surface and the other is EGL_NO_SURFACE, an
+ // EGL_BAD_MATCH error is generated.
+ if ((read == EGL_NO_SURFACE) != (draw == EGL_NO_SURFACE))
+ {
+ return EglBadMatch()
+ << "read and draw must both be valid surfaces, or both be EGL_NO_SURFACE";
+ }
+
+ if (display == EGL_NO_DISPLAY || !Display::isValidDisplay(display))
+ {
+ return EglBadDisplay() << "'dpy' not a valid EGLDisplay handle";
+ }
+
+ // EGL 1.5 spec: dpy can be uninitialized if all other parameters are null
+ if (!display->isInitialized() &&
+ (context != EGL_NO_CONTEXT || draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
+ {
+ return EglNotInitialized() << "'dpy' not initialized";
+ }
+
+ if (context != EGL_NO_CONTEXT)
+ {
+ ANGLE_TRY(ValidateContext(display, context));
+ }
+
+ if (display->isInitialized() && display->isDeviceLost())
+ {
+ return EglContextLost();
+ }
+
+ if (draw != EGL_NO_SURFACE)
+ {
+ ANGLE_TRY(ValidateSurface(display, draw));
+ }
+
+ if (read != EGL_NO_SURFACE)
+ {
+ ANGLE_TRY(ValidateSurface(display, read));
+ ANGLE_TRY(ValidateCompatibleConfigs(display, read->getConfig(), read, context->getConfig(),
+ read->getType()));
+ }
+
+ if (draw != read)
+ {
+ UNIMPLEMENTED(); // FIXME
+
+ if (draw)
+ {
+ ANGLE_TRY(ValidateCompatibleConfigs(display, draw->getConfig(), draw,
+ context->getConfig(), draw->getType()));
+ }
+ }
+ return NoError();
+}
+
+Error ValidateCompatibleConfigs(const Display *display,
+ const Config *config1,
+ const Surface *surface,
+ const Config *config2,
+ EGLint surfaceType)
+{
+
+ if (!surface->flexibleSurfaceCompatibilityRequested())
+ {
+ // Config compatibility is defined in section 2.2 of the EGL 1.5 spec
+
+ bool colorBufferCompat = config1->colorBufferType == config2->colorBufferType;
+ if (!colorBufferCompat)
+ {
+ return EglBadMatch() << "Color buffer types are not compatible.";
+ }
+
+ bool colorCompat =
+ config1->redSize == config2->redSize && config1->greenSize == config2->greenSize &&
+ config1->blueSize == config2->blueSize && config1->alphaSize == config2->alphaSize &&
+ config1->luminanceSize == config2->luminanceSize;
+ if (!colorCompat)
+ {
+ return EglBadMatch() << "Color buffer sizes are not compatible.";
+ }
+
+ bool componentTypeCompat = config1->colorComponentType == config2->colorComponentType;
+ if (!componentTypeCompat)
+ {
+ return EglBadMatch() << "Color buffer component types are not compatible.";
+ }
+
+ bool dsCompat = config1->depthSize == config2->depthSize &&
+ config1->stencilSize == config2->stencilSize;
+ if (!dsCompat)
+ {
+ return EglBadMatch() << "Depth-stencil buffer types are not compatible.";
+ }
+ }
+
+ bool surfaceTypeCompat = (config1->surfaceType & config2->surfaceType & surfaceType) != 0;
+ if (!surfaceTypeCompat)
+ {
+ return EglBadMatch() << "Surface types are not compatible.";
+ }
+
+ return NoError();
+}
+
+Error ValidateCreateImage(const Display *display,
+ gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attributes)
+{
+
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+
+ // TODO(geofflang): Complete validation from EGL_KHR_image_base:
+ // If the resource specified by <dpy>, <ctx>, <target>, <buffer> and <attrib_list> is itself an
+ // EGLImage sibling, the error EGL_BAD_ACCESS is generated.
+
+ for (AttributeMap::const_iterator attributeIter = attributes.begin();
+ attributeIter != attributes.end(); attributeIter++)
+ {
+ EGLAttrib attribute = attributeIter->first;
+ EGLAttrib value = attributeIter->second;
+
+ switch (attribute)
+ {
+ case EGL_IMAGE_PRESERVED:
+ switch (value)
+ {
+ case EGL_TRUE:
+ case EGL_FALSE:
+ break;
+
+ default:
+ return EglBadParameter()
+ << "EGL_IMAGE_PRESERVED must be EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+
+ case EGL_GL_TEXTURE_LEVEL:
+ if (!displayExtensions.glTexture2DImage &&
+ !displayExtensions.glTextureCubemapImage && !displayExtensions.glTexture3DImage)
+ {
+ return EglBadParameter() << "EGL_GL_TEXTURE_LEVEL cannot be used "
+ "without KHR_gl_texture_*_image support.";
+ }
+
+ if (value < 0)
+ {
+ return EglBadParameter() << "EGL_GL_TEXTURE_LEVEL cannot be negative.";
+ }
+ break;
+
+ case EGL_GL_TEXTURE_ZOFFSET:
+ if (!displayExtensions.glTexture3DImage)
+ {
+ return EglBadParameter() << "EGL_GL_TEXTURE_ZOFFSET cannot be used "
+ "without KHR_gl_texture_3D_image support.";
+ }
+ break;
+
+ default:
+ return EglBadParameter()
+ << "invalid attribute: 0x" << std::hex << std::uppercase << attribute;
+ }
+ }
+
+ switch (target)
+ {
+ case EGL_GL_TEXTURE_2D:
+ {
+ if (!displayExtensions.glTexture2DImage)
+ {
+ return EglBadParameter() << "KHR_gl_texture_2D_image not supported.";
+ }
+
+ if (buffer == 0)
+ {
+ return EglBadParameter() << "buffer cannot reference a 2D texture with the name 0.";
+ }
+
+ ANGLE_TRY(ValidateContext(display, context));
+ const gl::Texture *texture =
+ context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
+ if (texture == nullptr || texture->getType() != gl::TextureType::_2D)
+ {
+ return EglBadParameter() << "target is not a 2D texture.";
+ }
+
+ if (texture->getBoundSurface() != nullptr)
+ {
+ return EglBadAccess() << "texture has a surface bound to it.";
+ }
+
+ EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL, 0);
+ if (texture->getWidth(gl::TextureTarget::_2D, static_cast<size_t>(level)) == 0 ||
+ texture->getHeight(gl::TextureTarget::_2D, static_cast<size_t>(level)) == 0)
+ {
+ return EglBadParameter()
+ << "target 2D texture does not have a valid size at specified level.";
+ }
+
+ ANGLE_TRY(ValidateCreateImageMipLevelCommon(context, texture, level));
+ }
+ break;
+
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ {
+ if (!displayExtensions.glTextureCubemapImage)
+ {
+ return EglBadParameter() << "KHR_gl_texture_cubemap_image not supported.";
+ }
+
+ if (buffer == 0)
+ {
+ return EglBadParameter()
+ << "buffer cannot reference a cubemap texture with the name 0.";
+ }
+
+ ANGLE_TRY(ValidateContext(display, context));
+ const gl::Texture *texture =
+ context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
+ if (texture == nullptr || texture->getType() != gl::TextureType::CubeMap)
+ {
+ return EglBadParameter() << "target is not a cubemap texture.";
+ }
+
+ if (texture->getBoundSurface() != nullptr)
+ {
+ return EglBadAccess() << "texture has a surface bound to it.";
+ }
+
+ EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL, 0);
+ gl::TextureTarget cubeMapFace = egl_gl::EGLCubeMapTargetToCubeMapTarget(target);
+ if (texture->getWidth(cubeMapFace, static_cast<size_t>(level)) == 0 ||
+ texture->getHeight(cubeMapFace, static_cast<size_t>(level)) == 0)
+ {
+ return EglBadParameter() << "target cubemap texture does not have a valid "
+ "size at specified level and face.";
+ }
+
+ ANGLE_TRY(ValidateCreateImageMipLevelCommon(context, texture, level));
+
+ if (level == 0 && !texture->isMipmapComplete() &&
+ CubeTextureHasUnspecifiedLevel0Face(texture))
+ {
+ return EglBadParameter() << "if level is zero and the texture is incomplete, "
+ "it must have all of its faces specified at level "
+ "zero.";
+ }
+ }
+ break;
+
+ case EGL_GL_TEXTURE_3D:
+ {
+ if (!displayExtensions.glTexture3DImage)
+ {
+ return EglBadParameter() << "KHR_gl_texture_3D_image not supported.";
+ }
+
+ if (buffer == 0)
+ {
+ return EglBadParameter() << "buffer cannot reference a 3D texture with the name 0.";
+ }
+
+ ANGLE_TRY(ValidateContext(display, context));
+ const gl::Texture *texture =
+ context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
+ if (texture == nullptr || texture->getType() != gl::TextureType::_3D)
+ {
+ return EglBadParameter() << "target is not a 3D texture.";
+ }
+
+ if (texture->getBoundSurface() != nullptr)
+ {
+ return EglBadAccess() << "texture has a surface bound to it.";
+ }
+
+ EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL, 0);
+ EGLAttrib zOffset = attributes.get(EGL_GL_TEXTURE_ZOFFSET, 0);
+ if (texture->getWidth(gl::TextureTarget::_3D, static_cast<size_t>(level)) == 0 ||
+ texture->getHeight(gl::TextureTarget::_3D, static_cast<size_t>(level)) == 0 ||
+ texture->getDepth(gl::TextureTarget::_3D, static_cast<size_t>(level)) == 0)
+ {
+ return EglBadParameter()
+ << "target 3D texture does not have a valid size at specified level.";
+ }
+
+ if (static_cast<size_t>(zOffset) >=
+ texture->getDepth(gl::TextureTarget::_3D, static_cast<size_t>(level)))
+ {
+ return EglBadParameter() << "target 3D texture does not have enough layers "
+ "for the specified Z offset at the specified "
+ "level.";
+ }
+
+ ANGLE_TRY(ValidateCreateImageMipLevelCommon(context, texture, level));
+ }
+ break;
+
+ case EGL_GL_RENDERBUFFER:
+ {
+ if (!displayExtensions.glRenderbufferImage)
+ {
+ return EglBadParameter() << "KHR_gl_renderbuffer_image not supported.";
+ }
+
+ if (attributes.contains(EGL_GL_TEXTURE_LEVEL))
+ {
+ return EglBadParameter() << "EGL_GL_TEXTURE_LEVEL cannot be used in "
+ "conjunction with a renderbuffer target.";
+ }
+
+ if (buffer == 0)
+ {
+ return EglBadParameter()
+ << "buffer cannot reference a renderbuffer with the name 0.";
+ }
+
+ ANGLE_TRY(ValidateContext(display, context));
+ const gl::Renderbuffer *renderbuffer =
+ context->getRenderbuffer(egl_gl::EGLClientBufferToGLObjectHandle(buffer));
+ if (renderbuffer == nullptr)
+ {
+ return EglBadParameter() << "target is not a renderbuffer.";
+ }
+
+ if (renderbuffer->getSamples() > 0)
+ {
+ return EglBadParameter() << "target renderbuffer cannot be multisampled.";
+ }
+ }
+ break;
+
+ case EGL_NATIVE_BUFFER_ANDROID:
+ {
+ if (!displayExtensions.imageNativeBuffer)
+ {
+ return EglBadParameter() << "EGL_ANDROID_image_native_buffer not supported.";
+ }
+
+ if (context != nullptr)
+ {
+ return EglBadContext() << "ctx must be EGL_NO_CONTEXT.";
+ }
+
+ ANGLE_TRY(display->validateImageClientBuffer(context, target, buffer, attributes));
+ }
+ break;
+
+ case EGL_D3D11_TEXTURE_ANGLE:
+ if (!displayExtensions.imageD3D11Texture)
+ {
+ return EglBadParameter() << "EGL_ANGLE_image_d3d11_texture not supported.";
+ }
+
+ if (context != nullptr)
+ {
+ return EglBadContext() << "ctx must be EGL_NO_CONTEXT.";
+ }
+
+ ANGLE_TRY(display->validateImageClientBuffer(context, target, buffer, attributes));
+ break;
+
+ default:
+ return EglBadParameter()
+ << "invalid target: 0x" << std::hex << std::uppercase << target;
+ }
+
+ if (attributes.contains(EGL_GL_TEXTURE_ZOFFSET) && target != EGL_GL_TEXTURE_3D)
+ {
+ return EglBadParameter() << "EGL_GL_TEXTURE_ZOFFSET must be used with a 3D texture target.";
+ }
+
+ return NoError();
+}
+
+Error ValidateDestroyImage(const Display *display, const Image *image)
+{
+ ANGLE_TRY(ValidateImage(display, image));
+
+ return NoError();
+}
+
+Error ValidateCreateImageKHR(const Display *display,
+ gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attributes)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().imageBase && !display->getExtensions().image)
+ {
+ // It is out of spec what happens when calling an extension function when the extension is
+ // not available.
+ // EGL_BAD_DISPLAY seems like a reasonable error.
+ return EglBadDisplay() << "EGL_KHR_image not supported.";
+ }
+
+ return ValidateCreateImage(display, context, target, buffer, attributes);
+}
+
+Error ValidateDestroyImageKHR(const Display *display, const Image *image)
+{
+ ANGLE_TRY(ValidateImage(display, image));
+
+ if (!display->getExtensions().imageBase && !display->getExtensions().image)
+ {
+ // It is out of spec what happens when calling an extension function when the extension is
+ // not available.
+ // EGL_BAD_DISPLAY seems like a reasonable error.
+ return EglBadDisplay();
+ }
+
+ return NoError();
+}
+
+Error ValidateCreateDeviceANGLE(EGLint device_type,
+ void *native_device,
+ const EGLAttrib *attrib_list)
+{
+ const ClientExtensions &clientExtensions = Display::GetClientExtensions();
+ if (!clientExtensions.deviceCreation)
+ {
+ return EglBadAccess() << "Device creation extension not active";
+ }
+
+ if (attrib_list != nullptr && attrib_list[0] != EGL_NONE)
+ {
+ return EglBadAttribute() << "Invalid attrib_list parameter";
+ }
+
+ switch (device_type)
+ {
+ case EGL_D3D11_DEVICE_ANGLE:
+ if (!clientExtensions.deviceCreationD3D11)
+ {
+ return EglBadAttribute() << "D3D11 device creation extension not active";
+ }
+ break;
+ default:
+ return EglBadAttribute() << "Invalid device_type parameter";
+ }
+
+ return NoError();
+}
+
+Error ValidateReleaseDeviceANGLE(Device *device)
+{
+ const ClientExtensions &clientExtensions = Display::GetClientExtensions();
+ if (!clientExtensions.deviceCreation)
+ {
+ return EglBadAccess() << "Device creation extension not active";
+ }
+
+ if (device == EGL_NO_DEVICE_EXT || !Device::IsValidDevice(device))
+ {
+ return EglBadDevice() << "Invalid device parameter";
+ }
+
+ Display *owningDisplay = device->getOwningDisplay();
+ if (owningDisplay != nullptr)
+ {
+ return EglBadDevice() << "Device must have been created using eglCreateDevice";
+ }
+
+ return NoError();
+}
+
+Error ValidateCreateSyncBase(const Display *display,
+ EGLenum type,
+ const AttributeMap &attribs,
+ const Display *currentDisplay,
+ const gl::Context *currentContext,
+ bool isExt)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ switch (type)
+ {
+ case EGL_SYNC_FENCE_KHR:
+ if (!attribs.isEmpty())
+ {
+ return EglBadAttribute() << "Invalid attribute";
+ }
+ break;
+
+ case EGL_SYNC_NATIVE_FENCE_ANDROID:
+ if (!display->getExtensions().nativeFenceSyncANDROID)
+ {
+ return EglBadDisplay()
+ << "EGL_ANDROID_native_fence_sync extension is not available.";
+ }
+
+ for (const auto &attributeIter : attribs)
+ {
+ EGLAttrib attribute = attributeIter.first;
+
+ switch (attribute)
+ {
+ case EGL_SYNC_NATIVE_FENCE_FD_ANDROID:
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid attribute";
+ }
+ }
+ break;
+
+ default:
+ if (isExt)
+ {
+ return EglBadAttribute() << "Invalid type parameter";
+ }
+ else
+ {
+ return EglBadParameter() << "Invalid type parameter";
+ }
+ }
+
+ if (display != currentDisplay)
+ {
+ return EglBadMatch() << "CreateSync can only be called on the current display";
+ }
+
+ ANGLE_TRY(ValidateContext(currentDisplay, currentContext));
+
+ if (!currentContext->getExtensions().eglSync)
+ {
+ return EglBadMatch() << "EGL_SYNC_FENCE_KHR cannot be used without "
+ "GL_OES_EGL_sync support.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetSyncAttribBase(const Display *display, const Sync *sync, EGLint attribute)
+{
+ ANGLE_TRY(ValidateSync(display, sync));
+
+ switch (attribute)
+ {
+ case EGL_SYNC_CONDITION_KHR:
+ switch (sync->getType())
+ {
+ case EGL_SYNC_FENCE_KHR:
+ case EGL_SYNC_NATIVE_FENCE_ANDROID:
+ break;
+
+ default:
+ return EglBadAttribute()
+ << "EGL_SYNC_CONDITION_KHR is not valid for this sync type.";
+ }
+ break;
+
+ // The following attributes are accepted by all types
+ case EGL_SYNC_TYPE_KHR:
+ case EGL_SYNC_STATUS_KHR:
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid attribute";
+ }
+
+ return NoError();
+}
+
+Error ValidateCreateSyncKHR(const Display *display,
+ EGLenum type,
+ const AttributeMap &attribs,
+ const Display *currentDisplay,
+ const gl::Context *currentContext)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &extensions = display->getExtensions();
+ if (!extensions.fenceSync)
+ {
+ return EglBadAccess() << "EGL_KHR_fence_sync extension is not available";
+ }
+
+ return ValidateCreateSyncBase(display, type, attribs, currentDisplay, currentContext, true);
+}
+
+Error ValidateCreateSync(const Display *display,
+ EGLenum type,
+ const AttributeMap &attribs,
+ const Display *currentDisplay,
+ const gl::Context *currentContext)
+{
+ return ValidateCreateSyncBase(display, type, attribs, currentDisplay, currentContext, false);
+}
+
+Error ValidateDestroySync(const Display *display, const Sync *sync)
+{
+ ANGLE_TRY(ValidateSync(display, sync));
+ return NoError();
+}
+
+Error ValidateClientWaitSync(const Display *display,
+ const Sync *sync,
+ EGLint flags,
+ EGLTime timeout)
+{
+ ANGLE_TRY(ValidateSync(display, sync));
+ return NoError();
+}
+
+Error ValidateWaitSync(const Display *display,
+ const gl::Context *context,
+ const Sync *sync,
+ EGLint flags)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &extensions = display->getExtensions();
+ if (!extensions.waitSync)
+ {
+ return EglBadAccess() << "EGL_KHR_wait_sync extension is not available";
+ }
+
+ ANGLE_TRY(ValidateSync(display, sync));
+
+ if (context == nullptr)
+ {
+ return EglBadMatch() << "No context is current.";
+ }
+
+ if (!context->getExtensions().eglSync)
+ {
+ return EglBadMatch() << "Server-side waits cannot be performed without "
+ "GL_OES_EGL_sync support.";
+ }
+
+ if (flags != 0)
+ {
+ return EglBadParameter() << "flags must be zero";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetSyncAttribKHR(const Display *display,
+ const Sync *sync,
+ EGLint attribute,
+ EGLint *value)
+{
+ if (value == nullptr)
+ {
+ return EglBadParameter() << "Invalid value parameter";
+ }
+ return ValidateGetSyncAttribBase(display, sync, attribute);
+}
+
+Error ValidateGetSyncAttrib(const Display *display,
+ const Sync *sync,
+ EGLint attribute,
+ EGLAttrib *value)
+{
+ if (value == nullptr)
+ {
+ return EglBadParameter() << "Invalid value parameter";
+ }
+ return ValidateGetSyncAttribBase(display, sync, attribute);
+}
+
+Error ValidateCreateStreamKHR(const Display *display, const AttributeMap &attributes)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.stream)
+ {
+ return EglBadAlloc() << "Stream extension not active";
+ }
+
+ for (const auto &attributeIter : attributes)
+ {
+ EGLAttrib attribute = attributeIter.first;
+ EGLAttrib value = attributeIter.second;
+
+ ANGLE_TRY(ValidateStreamAttribute(attribute, value, displayExtensions));
+ }
+
+ return NoError();
+}
+
+Error ValidateDestroyStreamKHR(const Display *display, const Stream *stream)
+{
+ ANGLE_TRY(ValidateStream(display, stream));
+ return NoError();
+}
+
+Error ValidateStreamAttribKHR(const Display *display,
+ const Stream *stream,
+ EGLint attribute,
+ EGLint value)
+{
+ ANGLE_TRY(ValidateStream(display, stream));
+
+ if (stream->getState() == EGL_STREAM_STATE_DISCONNECTED_KHR)
+ {
+ return EglBadState() << "Bad stream state";
+ }
+
+ return ValidateStreamAttribute(attribute, value, display->getExtensions());
+}
+
+Error ValidateQueryStreamKHR(const Display *display,
+ const Stream *stream,
+ EGLenum attribute,
+ EGLint *value)
+{
+ ANGLE_TRY(ValidateStream(display, stream));
+
+ switch (attribute)
+ {
+ case EGL_STREAM_STATE_KHR:
+ case EGL_CONSUMER_LATENCY_USEC_KHR:
+ break;
+ case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
+ if (!display->getExtensions().streamConsumerGLTexture)
+ {
+ return EglBadAttribute() << "Consumer GLTexture extension not active";
+ }
+ break;
+ default:
+ return EglBadAttribute() << "Invalid attribute";
+ }
+
+ return NoError();
+}
+
+Error ValidateQueryStreamu64KHR(const Display *display,
+ const Stream *stream,
+ EGLenum attribute,
+ EGLuint64KHR *value)
+{
+ ANGLE_TRY(ValidateStream(display, stream));
+
+ switch (attribute)
+ {
+ case EGL_CONSUMER_FRAME_KHR:
+ case EGL_PRODUCER_FRAME_KHR:
+ break;
+ default:
+ return EglBadAttribute() << "Invalid attribute";
+ }
+
+ return NoError();
+}
+
+Error ValidateStreamConsumerGLTextureExternalKHR(const Display *display,
+ gl::Context *context,
+ const Stream *stream)
+{
+ ANGLE_TRY(ValidateContext(display, context));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.streamConsumerGLTexture)
+ {
+ return EglBadAccess() << "Stream consumer extension not active";
+ }
+
+ if (!context->getExtensions().eglStreamConsumerExternal)
+ {
+ return EglBadAccess() << "EGL stream consumer external GL extension not enabled";
+ }
+
+ if (stream == EGL_NO_STREAM_KHR || !display->isValidStream(stream))
+ {
+ return EglBadStream() << "Invalid stream";
+ }
+
+ if (stream->getState() != EGL_STREAM_STATE_CREATED_KHR)
+ {
+ return EglBadState() << "Invalid stream state";
+ }
+
+ // Lookup the texture and ensure it is correct
+ gl::Texture *texture = context->getState().getTargetTexture(gl::TextureType::External);
+ if (texture == nullptr || texture->getId() == 0)
+ {
+ return EglBadAccess() << "No external texture bound";
+ }
+
+ return NoError();
+}
+
+Error ValidateStreamConsumerAcquireKHR(const Display *display,
+ gl::Context *context,
+ const Stream *stream)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.streamConsumerGLTexture)
+ {
+ return EglBadAccess() << "Stream consumer extension not active";
+ }
+
+ if (stream == EGL_NO_STREAM_KHR || !display->isValidStream(stream))
+ {
+ return EglBadStream() << "Invalid stream";
+ }
+
+ if (!context)
+ {
+ return EglBadAccess() << "No GL context current to calling thread.";
+ }
+
+ ANGLE_TRY(ValidateContext(display, context));
+
+ if (!stream->isConsumerBoundToContext(context))
+ {
+ return EglBadAccess() << "Current GL context not associated with stream consumer";
+ }
+
+ if (stream->getConsumerType() != Stream::ConsumerType::GLTextureRGB &&
+ stream->getConsumerType() != Stream::ConsumerType::GLTextureYUV)
+ {
+ return EglBadAccess() << "Invalid stream consumer type";
+ }
+
+ // Note: technically EGL_STREAM_STATE_EMPTY_KHR is a valid state when the timeout is non-zero.
+ // However, the timeout is effectively ignored since it has no useful functionality with the
+ // current producers that are implemented, so we don't allow that state
+ if (stream->getState() != EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR &&
+ stream->getState() != EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR)
+ {
+ return EglBadState() << "Invalid stream state";
+ }
+
+ return NoError();
+}
+
+Error ValidateStreamConsumerReleaseKHR(const Display *display,
+ gl::Context *context,
+ const Stream *stream)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.streamConsumerGLTexture)
+ {
+ return EglBadAccess() << "Stream consumer extension not active";
+ }
+
+ if (stream == EGL_NO_STREAM_KHR || !display->isValidStream(stream))
+ {
+ return EglBadStream() << "Invalid stream";
+ }
+
+ if (!context)
+ {
+ return EglBadAccess() << "No GL context current to calling thread.";
+ }
+
+ ANGLE_TRY(ValidateContext(display, context));
+
+ if (!stream->isConsumerBoundToContext(context))
+ {
+ return EglBadAccess() << "Current GL context not associated with stream consumer";
+ }
+
+ if (stream->getConsumerType() != Stream::ConsumerType::GLTextureRGB &&
+ stream->getConsumerType() != Stream::ConsumerType::GLTextureYUV)
+ {
+ return EglBadAccess() << "Invalid stream consumer type";
+ }
+
+ if (stream->getState() != EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR &&
+ stream->getState() != EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR)
+ {
+ return EglBadState() << "Invalid stream state";
+ }
+
+ return NoError();
+}
+
+Error ValidateStreamConsumerGLTextureExternalAttribsNV(const Display *display,
+ gl::Context *context,
+ const Stream *stream,
+ const AttributeMap &attribs)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.streamConsumerGLTexture)
+ {
+ return EglBadAccess() << "Stream consumer extension not active";
+ }
+
+ ANGLE_TRY(ValidateContext(display, context));
+
+ // Although technically not a requirement in spec, the context needs to be checked for support
+ // for external textures or future logic will cause assertations. This extension is also
+ // effectively useless without external textures.
+ if (!context->getExtensions().eglStreamConsumerExternal)
+ {
+ return EglBadAccess() << "EGL stream consumer external GL extension not enabled";
+ }
+
+ if (stream == EGL_NO_STREAM_KHR || !display->isValidStream(stream))
+ {
+ return EglBadStream() << "Invalid stream";
+ }
+
+ if (stream->getState() != EGL_STREAM_STATE_CREATED_KHR)
+ {
+ return EglBadState() << "Invalid stream state";
+ }
+
+ const gl::Caps &glCaps = context->getCaps();
+
+ EGLAttrib colorBufferType = EGL_RGB_BUFFER;
+ EGLAttrib planeCount = -1;
+ EGLAttrib plane[3];
+ for (int i = 0; i < 3; i++)
+ {
+ plane[i] = -1;
+ }
+ for (const auto &attributeIter : attribs)
+ {
+ EGLAttrib attribute = attributeIter.first;
+ EGLAttrib value = attributeIter.second;
+
+ switch (attribute)
+ {
+ case EGL_COLOR_BUFFER_TYPE:
+ if (value != EGL_RGB_BUFFER && value != EGL_YUV_BUFFER_EXT)
+ {
+ return EglBadParameter() << "Invalid color buffer type";
+ }
+ colorBufferType = value;
+ break;
+ case EGL_YUV_NUMBER_OF_PLANES_EXT:
+ // planeCount = -1 is a tag for the default plane count so the value must be checked
+ // to be positive here to ensure future logic doesn't break on invalid negative
+ // inputs
+ if (value < 0)
+ {
+ return EglBadMatch() << "Invalid plane count";
+ }
+ planeCount = value;
+ break;
+ default:
+ if (attribute >= EGL_YUV_PLANE0_TEXTURE_UNIT_NV &&
+ attribute <= EGL_YUV_PLANE2_TEXTURE_UNIT_NV)
+ {
+ if ((value < 0 ||
+ value >= static_cast<EGLAttrib>(glCaps.maxCombinedTextureImageUnits)) &&
+ value != EGL_NONE)
+ {
+ return EglBadAccess() << "Invalid texture unit";
+ }
+ plane[attribute - EGL_YUV_PLANE0_TEXTURE_UNIT_NV] = value;
+ }
+ else
+ {
+ return EglBadAttribute() << "Invalid attribute";
+ }
+ }
+ }
+
+ if (colorBufferType == EGL_RGB_BUFFER)
+ {
+ if (planeCount > 0)
+ {
+ return EglBadMatch() << "Plane count must be 0 for RGB buffer";
+ }
+ for (int i = 0; i < 3; i++)
+ {
+ if (plane[i] != -1)
+ {
+ return EglBadMatch() << "Planes cannot be specified";
+ }
+ }
+
+ // Lookup the texture and ensure it is correct
+ gl::Texture *texture = context->getState().getTargetTexture(gl::TextureType::External);
+ if (texture == nullptr || texture->getId() == 0)
+ {
+ return EglBadAccess() << "No external texture bound";
+ }
+ }
+ else
+ {
+ if (planeCount == -1)
+ {
+ planeCount = 2;
+ }
+ if (planeCount < 1 || planeCount > 3)
+ {
+ return EglBadMatch() << "Invalid YUV plane count";
+ }
+ for (EGLAttrib i = planeCount; i < 3; i++)
+ {
+ if (plane[i] != -1)
+ {
+ return EglBadMatch() << "Invalid plane specified";
+ }
+ }
+
+ // Set to ensure no texture is referenced more than once
+ std::set<gl::Texture *> textureSet;
+ for (EGLAttrib i = 0; i < planeCount; i++)
+ {
+ if (plane[i] == -1)
+ {
+ return EglBadMatch() << "Not all planes specified";
+ }
+ if (plane[i] != EGL_NONE)
+ {
+ gl::Texture *texture = context->getState().getSamplerTexture(
+ static_cast<unsigned int>(plane[i]), gl::TextureType::External);
+ if (texture == nullptr || texture->getId() == 0)
+ {
+ return EglBadAccess()
+ << "No external texture bound at one or more specified texture units";
+ }
+ if (textureSet.find(texture) != textureSet.end())
+ {
+ return EglBadAccess() << "Multiple planes bound to same texture object";
+ }
+ textureSet.insert(texture);
+ }
+ }
+ }
+
+ return NoError();
+}
+
+Error ValidateCreateStreamProducerD3DTextureANGLE(const Display *display,
+ const Stream *stream,
+ const AttributeMap &attribs)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.streamProducerD3DTexture)
+ {
+ return EglBadAccess() << "Stream producer extension not active";
+ }
+
+ ANGLE_TRY(ValidateStream(display, stream));
+
+ if (!attribs.isEmpty())
+ {
+ return EglBadAttribute() << "Invalid attribute";
+ }
+
+ if (stream->getState() != EGL_STREAM_STATE_CONNECTING_KHR)
+ {
+ return EglBadState() << "Stream not in connecting state";
+ }
+
+ switch (stream->getConsumerType())
+ {
+ case Stream::ConsumerType::GLTextureYUV:
+ if (stream->getPlaneCount() != 2)
+ {
+ return EglBadMatch() << "Incompatible stream consumer type";
+ }
+ break;
+
+ case Stream::ConsumerType::GLTextureRGB:
+ if (stream->getPlaneCount() != 1)
+ {
+ return EglBadMatch() << "Incompatible stream consumer type";
+ }
+ break;
+
+ default:
+ return EglBadMatch() << "Incompatible stream consumer type";
+ }
+
+ return NoError();
+}
+
+Error ValidateStreamPostD3DTextureANGLE(const Display *display,
+ const Stream *stream,
+ void *texture,
+ const AttributeMap &attribs)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.streamProducerD3DTexture)
+ {
+ return EglBadAccess() << "Stream producer extension not active";
+ }
+
+ ANGLE_TRY(ValidateStream(display, stream));
+
+ for (auto &attributeIter : attribs)
+ {
+ EGLAttrib attribute = attributeIter.first;
+ EGLAttrib value = attributeIter.second;
+
+ switch (attribute)
+ {
+ case EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE:
+ if (value < 0)
+ {
+ return EglBadParameter() << "Invalid subresource index";
+ }
+ break;
+ case EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG:
+ if (value < 0)
+ {
+ return EglBadParameter() << "Invalid plane offset";
+ }
+ break;
+ default:
+ return EglBadAttribute() << "Invalid attribute";
+ }
+ }
+
+ if (stream->getState() != EGL_STREAM_STATE_EMPTY_KHR &&
+ stream->getState() != EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR &&
+ stream->getState() != EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR)
+ {
+ return EglBadState() << "Stream not fully configured";
+ }
+
+ if (stream->getProducerType() != Stream::ProducerType::D3D11Texture)
+ {
+ return EglBadMatch() << "Incompatible stream producer";
+ }
+
+ if (texture == nullptr)
+ {
+ return EglBadParameter() << "Texture is null";
+ }
+
+ return stream->validateD3D11Texture(texture, attribs);
+}
+
+Error ValidateGetSyncValuesCHROMIUM(const Display *display,
+ const Surface *surface,
+ const EGLuint64KHR *ust,
+ const EGLuint64KHR *msc,
+ const EGLuint64KHR *sbc)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ const DisplayExtensions &displayExtensions = display->getExtensions();
+ if (!displayExtensions.getSyncValues)
+ {
+ return EglBadAccess() << "getSyncValues extension not active";
+ }
+
+ if (display->isDeviceLost())
+ {
+ return EglContextLost() << "Context is lost.";
+ }
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ return EglBadSurface() << "getSyncValues surface cannot be EGL_NO_SURFACE";
+ }
+
+ if (!surface->directComposition())
+ {
+ return EglBadSurface() << "getSyncValues surface requires Direct Composition to be enabled";
+ }
+
+ if (ust == nullptr)
+ {
+ return EglBadParameter() << "ust is null";
+ }
+
+ if (msc == nullptr)
+ {
+ return EglBadParameter() << "msc is null";
+ }
+
+ if (sbc == nullptr)
+ {
+ return EglBadParameter() << "sbc is null";
+ }
+
+ return NoError();
+}
+
+Error ValidateDestroySurface(const Display *display,
+ const Surface *surface,
+ const EGLSurface eglSurface)
+{
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (eglSurface == EGL_NO_SURFACE)
+ {
+ return EglBadSurface();
+ }
+
+ return NoError();
+}
+
+Error ValidateDestroyContext(const Display *display,
+ const gl::Context *glCtx,
+ const EGLContext eglCtx)
+{
+ ANGLE_TRY(ValidateContext(display, glCtx));
+
+ if (eglCtx == EGL_NO_CONTEXT)
+ {
+ return EglBadContext();
+ }
+
+ return NoError();
+}
+
+Error ValidateSwapBuffers(Thread *thread, const Display *display, const Surface *eglSurface)
+{
+ ANGLE_TRY(ValidateSurface(display, eglSurface));
+
+ if (display->isDeviceLost())
+ {
+ return EglContextLost();
+ }
+
+ if (eglSurface == EGL_NO_SURFACE || !thread->getContext() ||
+ thread->getCurrentDrawSurface() != eglSurface)
+ {
+ return EglBadSurface();
+ }
+
+ return NoError();
+}
+
+Error ValidateSwapBuffersWithDamageKHR(const Display *display,
+ const Surface *surface,
+ EGLint *rects,
+ EGLint n_rects)
+{
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (!display->getExtensions().swapBuffersWithDamage)
+ {
+ // It is out of spec what happens when calling an extension function when the extension is
+ // not available. EGL_BAD_DISPLAY seems like a reasonable error.
+ return EglBadDisplay() << "EGL_KHR_swap_buffers_with_damage is not available.";
+ }
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ return EglBadSurface() << "Swap surface cannot be EGL_NO_SURFACE.";
+ }
+
+ if (n_rects < 0)
+ {
+ return EglBadParameter() << "n_rects cannot be negative.";
+ }
+
+ if (n_rects > 0 && rects == nullptr)
+ {
+ return EglBadParameter() << "n_rects cannot be greater than zero when rects is NULL.";
+ }
+
+ // TODO(jmadill): Validate Surface is bound to the thread.
+
+ return NoError();
+}
+
+Error ValidateWaitNative(const Display *display, const EGLint engine)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (engine != EGL_CORE_NATIVE_ENGINE)
+ {
+ return EglBadParameter() << "the 'engine' parameter has an unrecognized value";
+ }
+
+ return NoError();
+}
+
+Error ValidateCopyBuffers(Display *display, const Surface *surface)
+{
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (display->testDeviceLost())
+ {
+ return EglContextLost();
+ }
+
+ return NoError();
+}
+
+// Validate state for eglBindTexImage. If context is non-null then textureObject will be set to
+// surface's texture that will have an image bound to it
+Error ValidateBindTexImage(const Display *display,
+ const Surface *surface,
+ const EGLSurface eglSurface,
+ const EGLint buffer,
+ const gl::Context *context,
+ gl::Texture **textureObject)
+{
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (buffer != EGL_BACK_BUFFER)
+ {
+ return EglBadParameter();
+ }
+
+ if (eglSurface == EGL_NO_SURFACE || surface->getType() == EGL_WINDOW_BIT)
+ {
+ return EglBadSurface();
+ }
+
+ if (surface->getBoundTexture())
+ {
+ return EglBadAccess();
+ }
+
+ if (surface->getTextureFormat() == TextureFormat::NoTexture)
+ {
+ return EglBadMatch();
+ }
+
+ if (context)
+ {
+ gl::TextureType type = egl_gl::EGLTextureTargetToTextureType(surface->getTextureTarget());
+ *textureObject = context->getTextureByType(type);
+ ASSERT(*textureObject != nullptr);
+
+ if ((*textureObject)->getImmutableFormat())
+ {
+ return EglBadMatch();
+ }
+ }
+
+ return NoError();
+}
+
+Error ValidateReleaseTexImage(const Display *display,
+ const Surface *surface,
+ const EGLSurface eglSurface,
+ const EGLint buffer)
+{
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (buffer != EGL_BACK_BUFFER)
+ {
+ return EglBadParameter();
+ }
+
+ if (eglSurface == EGL_NO_SURFACE || surface->getType() == EGL_WINDOW_BIT)
+ {
+ return EglBadSurface();
+ }
+
+ if (surface->getTextureFormat() == TextureFormat::NoTexture)
+ {
+ return EglBadMatch();
+ }
+
+ return NoError();
+}
+
+Error ValidateSwapInterval(const Display *display,
+ const Surface *draw_surface,
+ const gl::Context *context)
+{
+ ANGLE_TRY(ValidateContext(display, context));
+
+ if (draw_surface == nullptr)
+ {
+ return EglBadSurface();
+ }
+
+ return NoError();
+}
+
+Error ValidateBindAPI(const EGLenum api)
+{
+ switch (api)
+ {
+ case EGL_OPENGL_API:
+ case EGL_OPENVG_API:
+ return EglBadParameter(); // Not supported by this implementation
+ case EGL_OPENGL_ES_API:
+ break;
+ default:
+ return EglBadParameter();
+ }
+
+ return NoError();
+}
+
+Error ValidatePresentationTimeANDROID(const Display *display,
+ const Surface *surface,
+ EGLnsecsANDROID time)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().presentationTime)
+ {
+ // It is out of spec what happens when calling an extension function when the extension is
+ // not available. EGL_BAD_DISPLAY seems like a reasonable error.
+ return EglBadDisplay() << "EGL_ANDROID_presentation_time is not available.";
+ }
+
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ return NoError();
+}
+
+Error ValidateSetBlobCacheANDROID(const Display *display,
+ EGLSetBlobFuncANDROID set,
+ EGLGetBlobFuncANDROID get)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (display->areBlobCacheFuncsSet())
+ {
+ return EglBadParameter()
+ << "Blob cache functions can only be set once in the lifetime of a Display";
+ }
+
+ if (set == nullptr || get == nullptr)
+ {
+ return EglBadParameter() << "Blob cache callbacks cannot be null.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetConfigAttrib(const Display *display, const Config *config, EGLint attribute)
+{
+ ANGLE_TRY(ValidateConfig(display, config));
+ ANGLE_TRY(ValidateConfigAttribute(display, static_cast<EGLAttrib>(attribute)));
+ return NoError();
+}
+
+Error ValidateChooseConfig(const Display *display,
+ const AttributeMap &attribs,
+ EGLint configSize,
+ EGLint *numConfig)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+ ANGLE_TRY(ValidateConfigAttributes(display, attribs));
+
+ if (numConfig == nullptr)
+ {
+ return EglBadParameter() << "num_config cannot be null.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetConfigs(const Display *display, EGLint configSize, EGLint *numConfig)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (numConfig == nullptr)
+ {
+ return EglBadParameter() << "num_config cannot be null.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetPlatformDisplay(EGLenum platform,
+ void *native_display,
+ const EGLAttrib *attrib_list)
+{
+ const auto &attribMap = AttributeMap::CreateFromAttribArray(attrib_list);
+ return ValidateGetPlatformDisplayCommon(platform, native_display, attribMap);
+}
+
+Error ValidateGetPlatformDisplayEXT(EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list)
+{
+ const auto &attribMap = AttributeMap::CreateFromIntArray(attrib_list);
+ return ValidateGetPlatformDisplayCommon(platform, native_display, attribMap);
+}
+
+Error ValidateCreatePlatformWindowSurfaceEXT(const Display *display,
+ const Config *configuration,
+ void *nativeWindow,
+ const AttributeMap &attributes)
+{
+ if (!Display::GetClientExtensions().platformBase)
+ {
+ return EglBadAccess() << "EGL_EXT_platform_base not supported";
+ }
+
+ ANGLE_TRY(ValidateConfig(display, configuration));
+
+ return EglBadDisplay() << "ValidateCreatePlatformWindowSurfaceEXT unimplemented.";
+}
+
+Error ValidateCreatePlatformPixmapSurfaceEXT(const Display *display,
+ const Config *configuration,
+ void *nativePixmap,
+ const AttributeMap &attributes)
+{
+ if (!Display::GetClientExtensions().platformBase)
+ {
+ return EglBadAccess() << "EGL_EXT_platform_base not supported";
+ }
+
+ ANGLE_TRY(ValidateConfig(display, configuration));
+
+ return EglBadDisplay() << "ValidateCreatePlatformPixmapSurfaceEXT unimplemented.";
+}
+
+Error ValidateProgramCacheGetAttribANGLE(const Display *display, EGLenum attrib)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().programCacheControl)
+ {
+ return EglBadAccess() << "Extension not supported";
+ }
+
+ switch (attrib)
+ {
+ case EGL_PROGRAM_CACHE_KEY_LENGTH_ANGLE:
+ case EGL_PROGRAM_CACHE_SIZE_ANGLE:
+ break;
+
+ default:
+ return EglBadParameter() << "Invalid program cache attribute.";
+ }
+
+ return NoError();
+}
+
+Error ValidateProgramCacheQueryANGLE(const Display *display,
+ EGLint index,
+ void *key,
+ EGLint *keysize,
+ void *binary,
+ EGLint *binarysize)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().programCacheControl)
+ {
+ return EglBadAccess() << "Extension not supported";
+ }
+
+ if (index < 0 || index >= display->programCacheGetAttrib(EGL_PROGRAM_CACHE_SIZE_ANGLE))
+ {
+ return EglBadParameter() << "Program index out of range.";
+ }
+
+ if (keysize == nullptr || binarysize == nullptr)
+ {
+ return EglBadParameter() << "keysize and binarysize must always be valid pointers.";
+ }
+
+ if (binary && *keysize != static_cast<EGLint>(egl::BlobCache::kKeyLength))
+ {
+ return EglBadParameter() << "Invalid program key size.";
+ }
+
+ if ((key == nullptr) != (binary == nullptr))
+ {
+ return EglBadParameter() << "key and binary must both be null or both non-null.";
+ }
+
+ return NoError();
+}
+
+Error ValidateProgramCachePopulateANGLE(const Display *display,
+ const void *key,
+ EGLint keysize,
+ const void *binary,
+ EGLint binarysize)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().programCacheControl)
+ {
+ return EglBadAccess() << "Extension not supported";
+ }
+
+ if (keysize != static_cast<EGLint>(egl::BlobCache::kKeyLength))
+ {
+ return EglBadParameter() << "Invalid program key size.";
+ }
+
+ if (key == nullptr || binary == nullptr)
+ {
+ return EglBadParameter() << "null pointer in arguments.";
+ }
+
+ // Upper bound for binarysize is arbitrary.
+ if (binarysize <= 0 || binarysize > egl::kProgramCacheSizeAbsoluteMax)
+ {
+ return EglBadParameter() << "binarysize out of valid range.";
+ }
+
+ return NoError();
+}
+
+Error ValidateProgramCacheResizeANGLE(const Display *display, EGLint limit, EGLenum mode)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().programCacheControl)
+ {
+ return EglBadAccess() << "Extension not supported";
+ }
+
+ if (limit < 0)
+ {
+ return EglBadParameter() << "limit must be non-negative.";
+ }
+
+ switch (mode)
+ {
+ case EGL_PROGRAM_CACHE_RESIZE_ANGLE:
+ case EGL_PROGRAM_CACHE_TRIM_ANGLE:
+ break;
+
+ default:
+ return EglBadParameter() << "Invalid cache resize mode.";
+ }
+
+ return NoError();
+}
+
+Error ValidateSurfaceAttrib(const Display *display,
+ const Surface *surface,
+ EGLint attribute,
+ EGLint value)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ return EglBadSurface() << "Surface cannot be EGL_NO_SURFACE.";
+ }
+
+ switch (attribute)
+ {
+ case EGL_MIPMAP_LEVEL:
+ break;
+
+ case EGL_MULTISAMPLE_RESOLVE:
+ switch (value)
+ {
+ case EGL_MULTISAMPLE_RESOLVE_DEFAULT:
+ break;
+
+ case EGL_MULTISAMPLE_RESOLVE_BOX:
+ if ((surface->getConfig()->surfaceType & EGL_MULTISAMPLE_RESOLVE_BOX_BIT) == 0)
+ {
+ return EglBadMatch()
+ << "Surface does not support EGL_MULTISAMPLE_RESOLVE_BOX.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid multisample resolve type.";
+ }
+ break;
+
+ case EGL_SWAP_BEHAVIOR:
+ switch (value)
+ {
+ case EGL_BUFFER_PRESERVED:
+ if ((surface->getConfig()->surfaceType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT) == 0)
+ {
+ return EglBadMatch()
+ << "Surface does not support EGL_SWAP_BEHAVIOR_PRESERVED.";
+ }
+ break;
+
+ case EGL_BUFFER_DESTROYED:
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid swap behaviour.";
+ }
+ break;
+
+ case EGL_WIDTH:
+ case EGL_HEIGHT:
+ if (!display->getExtensions().windowFixedSize)
+ {
+ return EglBadAttribute() << "EGL_WIDTH or EGL_HEIGHT cannot be set without "
+ "EGL_ANGLE_window_fixed_size support.";
+ }
+ if (!surface->isFixedSize())
+ {
+ return EglBadMatch() << "EGL_WIDTH or EGL_HEIGHT cannot be set without "
+ "EGL_FIXED_SIZE_ANGLE being enabled on the surface.";
+ }
+ break;
+
+ case EGL_TIMESTAMPS_ANDROID:
+ if (!display->getExtensions().getFrameTimestamps)
+ {
+ return EglBadAttribute() << "EGL_TIMESTAMPS_ANDROID cannot be used without "
+ "EGL_ANDROID_get_frame_timestamps support.";
+ }
+ switch (value)
+ {
+ case EGL_TRUE:
+ case EGL_FALSE:
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid value.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid surface attribute.";
+ }
+
+ return NoError();
+}
+
+Error ValidateQuerySurface(const Display *display,
+ const Surface *surface,
+ EGLint attribute,
+ EGLint *value)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ return EglBadSurface() << "Surface cannot be EGL_NO_SURFACE.";
+ }
+
+ switch (attribute)
+ {
+ case EGL_GL_COLORSPACE:
+ case EGL_VG_ALPHA_FORMAT:
+ case EGL_VG_COLORSPACE:
+ case EGL_CONFIG_ID:
+ case EGL_HEIGHT:
+ case EGL_HORIZONTAL_RESOLUTION:
+ case EGL_LARGEST_PBUFFER:
+ case EGL_MIPMAP_TEXTURE:
+ case EGL_MIPMAP_LEVEL:
+ case EGL_MULTISAMPLE_RESOLVE:
+ case EGL_PIXEL_ASPECT_RATIO:
+ case EGL_RENDER_BUFFER:
+ case EGL_SWAP_BEHAVIOR:
+ case EGL_TEXTURE_FORMAT:
+ case EGL_TEXTURE_TARGET:
+ case EGL_VERTICAL_RESOLUTION:
+ case EGL_WIDTH:
+ break;
+
+ case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
+ if (!display->getExtensions().postSubBuffer)
+ {
+ return EglBadAttribute() << "EGL_POST_SUB_BUFFER_SUPPORTED_NV cannot be used "
+ "without EGL_ANGLE_surface_orientation support.";
+ }
+ break;
+
+ case EGL_FIXED_SIZE_ANGLE:
+ if (!display->getExtensions().windowFixedSize)
+ {
+ return EglBadAttribute() << "EGL_FIXED_SIZE_ANGLE cannot be used without "
+ "EGL_ANGLE_window_fixed_size support.";
+ }
+ break;
+
+ case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
+ if (!display->getExtensions().flexibleSurfaceCompatibility)
+ {
+ return EglBadAttribute()
+ << "EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE cannot be "
+ "used without EGL_ANGLE_flexible_surface_compatibility support.";
+ }
+ break;
+
+ case EGL_SURFACE_ORIENTATION_ANGLE:
+ if (!display->getExtensions().surfaceOrientation)
+ {
+ return EglBadAttribute() << "EGL_SURFACE_ORIENTATION_ANGLE cannot be "
+ "queried without "
+ "EGL_ANGLE_surface_orientation support.";
+ }
+ break;
+
+ case EGL_DIRECT_COMPOSITION_ANGLE:
+ if (!display->getExtensions().directComposition)
+ {
+ return EglBadAttribute() << "EGL_DIRECT_COMPOSITION_ANGLE cannot be "
+ "used without "
+ "EGL_ANGLE_direct_composition support.";
+ }
+ break;
+
+ case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ if (!display->getExtensions().robustResourceInitialization)
+ {
+ return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE cannot be "
+ "used without EGL_ANGLE_robust_resource_initialization "
+ "support.";
+ }
+ break;
+
+ case EGL_TIMESTAMPS_ANDROID:
+ if (!display->getExtensions().getFrameTimestamps)
+ {
+ return EglBadAttribute() << "EGL_TIMESTAMPS_ANDROID cannot be used without "
+ "EGL_ANDROID_get_frame_timestamps support.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid surface attribute.";
+ }
+
+ return NoError();
+}
+
+Error ValidateQueryContext(const Display *display,
+ const gl::Context *context,
+ EGLint attribute,
+ EGLint *value)
+{
+ ANGLE_TRY(ValidateContext(display, context));
+
+ switch (attribute)
+ {
+ case EGL_CONFIG_ID:
+ case EGL_CONTEXT_CLIENT_TYPE:
+ case EGL_CONTEXT_CLIENT_VERSION:
+ case EGL_RENDER_BUFFER:
+ break;
+
+ case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ if (!display->getExtensions().robustResourceInitialization)
+ {
+ return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE cannot be "
+ "used without EGL_ANGLE_robust_resource_initialization "
+ "support.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "Invalid context attribute.";
+ }
+
+ return NoError();
+}
+
+Error ValidateDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const AttributeMap &attribs)
+{
+ const ClientExtensions &clientExtensions = Display::GetClientExtensions();
+ if (!clientExtensions.debug)
+ {
+ return EglBadAccess() << "EGL_KHR_debug extension is not available.";
+ }
+
+ for (const auto &attrib : attribs)
+ {
+ switch (attrib.first)
+ {
+ case EGL_DEBUG_MSG_CRITICAL_KHR:
+ case EGL_DEBUG_MSG_ERROR_KHR:
+ case EGL_DEBUG_MSG_WARN_KHR:
+ case EGL_DEBUG_MSG_INFO_KHR:
+ if (attrib.second != EGL_TRUE && attrib.second != EGL_FALSE)
+ {
+ return EglBadAttribute() << "message controls must be EGL_TRUE or EGL_FALSE.";
+ }
+ break;
+ }
+ }
+
+ return NoError();
+}
+
+Error ValidateQueryDebugKHR(EGLint attribute, EGLAttrib *value)
+{
+ const ClientExtensions &clientExtensions = Display::GetClientExtensions();
+ if (!clientExtensions.debug)
+ {
+ return EglBadAccess() << "EGL_KHR_debug extension is not available.";
+ }
+
+ switch (attribute)
+ {
+ case EGL_DEBUG_MSG_CRITICAL_KHR:
+ case EGL_DEBUG_MSG_ERROR_KHR:
+ case EGL_DEBUG_MSG_WARN_KHR:
+ case EGL_DEBUG_MSG_INFO_KHR:
+ case EGL_DEBUG_CALLBACK_KHR:
+ break;
+
+ default:
+ return EglBadAttribute() << "unknown attribute.";
+ }
+
+ return NoError();
+}
+
+Error ValidateLabelObjectKHR(Thread *thread,
+ const Display *display,
+ ObjectType objectType,
+ EGLObjectKHR object,
+ EGLLabelKHR label)
+{
+ const ClientExtensions &clientExtensions = Display::GetClientExtensions();
+ if (!clientExtensions.debug)
+ {
+ return EglBadAccess() << "EGL_KHR_debug extension is not available.";
+ }
+
+ LabeledObject *labeledObject = nullptr;
+ ANGLE_TRY(ValidateLabeledObject(thread, display, objectType, object, &labeledObject));
+
+ return NoError();
+}
+
+Error ValidateGetCompositorTimingSupportedANDROID(const Display *display,
+ const Surface *surface,
+ CompositorTiming name)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().getFrameTimestamps)
+ {
+ return EglBadDisplay() << "EGL_ANDROID_get_frame_timestamps extension is not available.";
+ }
+
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (!ValidCompositorTimingName(name))
+ {
+ return EglBadParameter() << "invalid timing name.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetCompositorTimingANDROID(const Display *display,
+ const Surface *surface,
+ EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().getFrameTimestamps)
+ {
+ return EglBadDisplay() << "EGL_ANDROID_get_frame_timestamps extension is not available.";
+ }
+
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (names == nullptr && numTimestamps > 0)
+ {
+ return EglBadParameter() << "names is NULL.";
+ }
+
+ if (values == nullptr && numTimestamps > 0)
+ {
+ return EglBadParameter() << "values is NULL.";
+ }
+
+ if (numTimestamps < 0)
+ {
+ return EglBadParameter() << "numTimestamps must be at least 0.";
+ }
+
+ for (EGLint i = 0; i < numTimestamps; i++)
+ {
+ CompositorTiming name = FromEGLenum<CompositorTiming>(names[i]);
+
+ if (!ValidCompositorTimingName(name))
+ {
+ return EglBadParameter() << "invalid compositor timing.";
+ }
+
+ if (!surface->getSupportedCompositorTimings().test(name))
+ {
+ return EglBadParameter() << "compositor timing not supported by surface.";
+ }
+ }
+
+ return NoError();
+}
+
+Error ValidateGetNextFrameIdANDROID(const Display *display,
+ const Surface *surface,
+ EGLuint64KHR *frameId)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().getFrameTimestamps)
+ {
+ return EglBadDisplay() << "EGL_ANDROID_get_frame_timestamps extension is not available.";
+ }
+
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (frameId == nullptr)
+ {
+ return EglBadParameter() << "frameId is NULL.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetFrameTimestampSupportedANDROID(const Display *display,
+ const Surface *surface,
+ Timestamp timestamp)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().getFrameTimestamps)
+ {
+ return EglBadDisplay() << "EGL_ANDROID_get_frame_timestamps extension is not available.";
+ }
+
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (!ValidTimestampType(timestamp))
+ {
+ return EglBadParameter() << "invalid timestamp type.";
+ }
+
+ return NoError();
+}
+
+Error ValidateGetFrameTimestampsANDROID(const Display *display,
+ const Surface *surface,
+ EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().getFrameTimestamps)
+ {
+ return EglBadDisplay() << "EGL_ANDROID_get_frame_timestamps extension is not available.";
+ }
+
+ ANGLE_TRY(ValidateSurface(display, surface));
+
+ if (!surface->isTimestampsEnabled())
+ {
+ return EglBadSurface() << "timestamp collection is not enabled for this surface.";
+ }
+
+ if (timestamps == nullptr && numTimestamps > 0)
+ {
+ return EglBadParameter() << "timestamps is NULL.";
+ }
+
+ if (values == nullptr && numTimestamps > 0)
+ {
+ return EglBadParameter() << "values is NULL.";
+ }
+
+ if (numTimestamps < 0)
+ {
+ return EglBadParameter() << "numTimestamps must be at least 0.";
+ }
+
+ for (EGLint i = 0; i < numTimestamps; i++)
+ {
+ Timestamp timestamp = FromEGLenum<Timestamp>(timestamps[i]);
+
+ if (!ValidTimestampType(timestamp))
+ {
+ return EglBadParameter() << "invalid timestamp type.";
+ }
+
+ if (!surface->getSupportedTimestamps().test(timestamp))
+ {
+ return EglBadParameter() << "timestamp not supported by surface.";
+ }
+ }
+
+ return NoError();
+}
+
+Error ValidateQueryStringiANGLE(const Display *display, EGLint name, EGLint index)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!Display::GetClientExtensions().featureControlANGLE)
+ {
+ return EglBadDisplay() << "EGL_ANGLE_feature_control extension is not available.";
+ }
+
+ if (index < 0)
+ {
+ return EglBadParameter() << "index is negative.";
+ }
+
+ switch (name)
+ {
+ case EGL_FEATURE_NAME_ANGLE:
+ case EGL_FEATURE_CATEGORY_ANGLE:
+ case EGL_FEATURE_DESCRIPTION_ANGLE:
+ case EGL_FEATURE_BUG_ANGLE:
+ case EGL_FEATURE_STATUS_ANGLE:
+ break;
+ default:
+ return EglBadParameter() << "name is not valid.";
+ }
+
+ if (static_cast<size_t>(index) >= display->getFeatures().size())
+ {
+ return EglBadParameter() << "index is too big.";
+ }
+
+ return NoError();
+}
+
+Error ValidateQueryDisplayAttribBase(const Display *display, const EGLint attribute)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ switch (attribute)
+ {
+ case EGL_DEVICE_EXT:
+ if (!display->getExtensions().deviceQuery)
+ {
+ return EglBadDisplay() << "EGL_EXT_device_query extension is not available.";
+ }
+ break;
+
+ case EGL_FEATURE_COUNT_ANGLE:
+ if (!Display::GetClientExtensions().featureControlANGLE)
+ {
+ return EglBadDisplay() << "EGL_ANGLE_feature_control extension is not available.";
+ }
+ break;
+
+ default:
+ return EglBadAttribute() << "attribute is not valid.";
+ }
+
+ return NoError();
+}
+
+Error ValidateQueryDisplayAttribEXT(const Display *display, const EGLint attribute)
+{
+ ANGLE_TRY(ValidateQueryDisplayAttribBase(display, attribute));
+
+ return NoError();
+}
+
+Error ValidateQueryDisplayAttribANGLE(const Display *display, const EGLint attribute)
+{
+ ANGLE_TRY(ValidateQueryDisplayAttribBase(display, attribute));
+
+ return NoError();
+}
+
+Error ValidateGetNativeClientBufferANDROID(const AHardwareBuffer *buffer)
+{
+ // No extension check is done because no display is passed to eglGetNativeClientBufferANDROID
+ // despite it being a display extension. No display is needed for the implementation though.
+ if (buffer == nullptr)
+ {
+ return EglBadParameter() << "NULL buffer.";
+ }
+
+ return NoError();
+}
+
+Error ValidateDupNativeFenceFDANDROID(const Display *display, const Sync *sync)
+{
+ ANGLE_TRY(ValidateDisplay(display));
+
+ if (!display->getExtensions().nativeFenceSyncANDROID)
+ {
+ return EglBadDisplay() << "EGL_ANDROID_native_fence_sync extension is not available.";
+ }
+
+ ANGLE_TRY(ValidateSync(display, sync));
+
+ if (sync->getNativeFenceFD() == EGL_NO_NATIVE_FENCE_FD_ANDROID)
+ {
+ return EglBadParameter() << "EGL_NATIVE_FENCE_FD_ANDROID attribute of sync is "
+ "EGL_NO_NATIVE_FENCE_FD_ANDROID";
+ }
+
+ return NoError();
+}
+
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libANGLE/validationEGL.h b/gfx/angle/checkout/src/libANGLE/validationEGL.h
new file mode 100644
index 0000000000..0c5a74ce5d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationEGL.h
@@ -0,0 +1,356 @@
+//
+// Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationEGL.h: Validation functions for generic EGL entry point parameters
+
+#ifndef LIBANGLE_VALIDATIONEGL_H_
+#define LIBANGLE_VALIDATIONEGL_H_
+
+#include "common/PackedEnums.h"
+#include "libANGLE/Error.h"
+#include "libANGLE/Texture.h"
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+namespace gl
+{
+class Context;
+}
+
+namespace egl
+{
+
+class AttributeMap;
+struct ClientExtensions;
+struct Config;
+class Device;
+class Display;
+class Image;
+class Stream;
+class Surface;
+class Sync;
+class Thread;
+class LabeledObject;
+
+// Object validation
+Error ValidateDisplay(const Display *display);
+Error ValidateSurface(const Display *display, const Surface *surface);
+Error ValidateConfig(const Display *display, const Config *config);
+Error ValidateContext(const Display *display, const gl::Context *context);
+Error ValidateImage(const Display *display, const Image *image);
+Error ValidateDevice(const Device *device);
+Error ValidateSync(const Display *display, const Sync *sync);
+
+// Return the requested object only if it is valid (otherwise nullptr)
+const Thread *GetThreadIfValid(const Thread *thread);
+const Display *GetDisplayIfValid(const Display *display);
+const Surface *GetSurfaceIfValid(const Display *display, const Surface *surface);
+const Image *GetImageIfValid(const Display *display, const Image *image);
+const Stream *GetStreamIfValid(const Display *display, const Stream *stream);
+const gl::Context *GetContextIfValid(const Display *display, const gl::Context *context);
+const Device *GetDeviceIfValid(const Device *device);
+const Sync *GetSyncIfValid(const Display *display, const Sync *sync);
+LabeledObject *GetLabeledObjectIfValid(Thread *thread,
+ const Display *display,
+ ObjectType objectType,
+ EGLObjectKHR object);
+
+// Entry point validation
+Error ValidateInitialize(const Display *display);
+
+Error ValidateTerminate(const Display *display);
+
+Error ValidateCreateContext(Display *display,
+ Config *configuration,
+ gl::Context *shareContext,
+ const AttributeMap &attributes);
+
+Error ValidateCreateWindowSurface(Display *display,
+ Config *config,
+ EGLNativeWindowType window,
+ const AttributeMap &attributes);
+
+Error ValidateCreatePbufferSurface(Display *display,
+ Config *config,
+ const AttributeMap &attributes);
+Error ValidateCreatePbufferFromClientBuffer(Display *display,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ Config *config,
+ const AttributeMap &attributes);
+
+Error ValidateMakeCurrent(Display *display, Surface *draw, Surface *read, gl::Context *context);
+
+Error ValidateCreateImage(const Display *display,
+ gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attributes);
+Error ValidateDestroyImage(const Display *display, const Image *image);
+Error ValidateCreateImageKHR(const Display *display,
+ gl::Context *context,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const AttributeMap &attributes);
+Error ValidateDestroyImageKHR(const Display *display, const Image *image);
+
+Error ValidateCreateDeviceANGLE(EGLint device_type,
+ void *native_device,
+ const EGLAttrib *attrib_list);
+Error ValidateReleaseDeviceANGLE(Device *device);
+
+Error ValidateCreateSyncBase(const Display *display,
+ EGLenum type,
+ const AttributeMap &attribs,
+ const Display *currentDisplay,
+ const gl::Context *currentContext,
+ bool isExt);
+Error ValidateGetSyncAttribBase(const Display *display, const Sync *sync, EGLint attribute);
+
+Error ValidateCreateSyncKHR(const Display *display,
+ EGLenum type,
+ const AttributeMap &attribs,
+ const Display *currentDisplay,
+ const gl::Context *currentContext);
+Error ValidateCreateSync(const Display *display,
+ EGLenum type,
+ const AttributeMap &attribs,
+ const Display *currentDisplay,
+ const gl::Context *currentContext);
+Error ValidateDestroySync(const Display *display, const Sync *sync);
+Error ValidateClientWaitSync(const Display *display,
+ const Sync *sync,
+ EGLint flags,
+ EGLTime timeout);
+Error ValidateWaitSync(const Display *display,
+ const gl::Context *context,
+ const Sync *sync,
+ EGLint flags);
+Error ValidateGetSyncAttribKHR(const Display *display,
+ const Sync *sync,
+ EGLint attribute,
+ EGLint *value);
+Error ValidateGetSyncAttrib(const Display *display,
+ const Sync *sync,
+ EGLint attribute,
+ EGLAttrib *value);
+
+Error ValidateCreateStreamKHR(const Display *display, const AttributeMap &attributes);
+Error ValidateDestroyStreamKHR(const Display *display, const Stream *stream);
+Error ValidateStreamAttribKHR(const Display *display,
+ const Stream *stream,
+ EGLint attribute,
+ EGLint value);
+Error ValidateQueryStreamKHR(const Display *display,
+ const Stream *stream,
+ EGLenum attribute,
+ EGLint *value);
+Error ValidateQueryStreamu64KHR(const Display *display,
+ const Stream *stream,
+ EGLenum attribute,
+ EGLuint64KHR *value);
+Error ValidateStreamConsumerGLTextureExternalKHR(const Display *display,
+ gl::Context *context,
+ const Stream *stream);
+Error ValidateStreamConsumerAcquireKHR(const Display *display,
+ gl::Context *context,
+ const Stream *stream);
+Error ValidateStreamConsumerReleaseKHR(const Display *display,
+ gl::Context *context,
+ const Stream *stream);
+Error ValidateStreamConsumerGLTextureExternalAttribsNV(const Display *display,
+ gl::Context *context,
+ const Stream *stream,
+ const AttributeMap &attribs);
+Error ValidateCreateStreamProducerD3DTextureANGLE(const Display *display,
+ const Stream *stream,
+ const AttributeMap &attribs);
+Error ValidateStreamPostD3DTextureANGLE(const Display *display,
+ const Stream *stream,
+ void *texture,
+ const AttributeMap &attribs);
+
+Error ValidateGetSyncValuesCHROMIUM(const Display *display,
+ const Surface *surface,
+ const EGLuint64KHR *ust,
+ const EGLuint64KHR *msc,
+ const EGLuint64KHR *sbc);
+
+Error ValidateDestroySurface(const Display *display,
+ const Surface *surface,
+ const EGLSurface eglSurface);
+
+Error ValidateDestroyContext(const Display *display,
+ const gl::Context *glCtx,
+ const EGLContext eglCtx);
+
+Error ValidateSwapBuffers(Thread *thread, const Display *display, const Surface *surface);
+
+Error ValidateWaitNative(const Display *display, const EGLint engine);
+
+Error ValidateCopyBuffers(Display *display, const Surface *surface);
+
+Error ValidateSwapBuffersWithDamageKHR(const Display *display,
+ const Surface *surface,
+ EGLint *rects,
+ EGLint n_rects);
+
+Error ValidateBindTexImage(const Display *display,
+ const Surface *surface,
+ const EGLSurface eglSurface,
+ const EGLint buffer,
+ const gl::Context *context,
+ gl::Texture **textureObject);
+
+Error ValidateReleaseTexImage(const Display *display,
+ const Surface *surface,
+ const EGLSurface eglSurface,
+ const EGLint buffer);
+
+Error ValidateSwapInterval(const Display *display,
+ const Surface *draw_surface,
+ const gl::Context *context);
+
+Error ValidateBindAPI(const EGLenum api);
+
+Error ValidatePresentationTimeANDROID(const Display *display,
+ const Surface *surface,
+ EGLnsecsANDROID time);
+
+Error ValidateSetBlobCacheANDROID(const Display *display,
+ EGLSetBlobFuncANDROID set,
+ EGLGetBlobFuncANDROID get);
+
+Error ValidateGetConfigAttrib(const Display *display, const Config *config, EGLint attribute);
+Error ValidateChooseConfig(const Display *display,
+ const AttributeMap &attribs,
+ EGLint configSize,
+ EGLint *numConfig);
+Error ValidateGetConfigs(const Display *display, EGLint configSize, EGLint *numConfig);
+
+// Other validation
+Error ValidateCompatibleConfigs(const Display *display,
+ const Config *config1,
+ const Surface *surface,
+ const Config *config2,
+ EGLint surfaceType);
+
+Error ValidateGetPlatformDisplay(EGLenum platform,
+ void *native_display,
+ const EGLAttrib *attrib_list);
+Error ValidateGetPlatformDisplayEXT(EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list);
+Error ValidateCreatePlatformWindowSurfaceEXT(const Display *display,
+ const Config *configuration,
+ void *nativeWindow,
+ const AttributeMap &attributes);
+Error ValidateCreatePlatformPixmapSurfaceEXT(const Display *display,
+ const Config *configuration,
+ void *nativePixmap,
+ const AttributeMap &attributes);
+
+Error ValidateProgramCacheGetAttribANGLE(const Display *display, EGLenum attrib);
+
+Error ValidateProgramCacheQueryANGLE(const Display *display,
+ EGLint index,
+ void *key,
+ EGLint *keysize,
+ void *binary,
+ EGLint *binarysize);
+
+Error ValidateProgramCachePopulateANGLE(const Display *display,
+ const void *key,
+ EGLint keysize,
+ const void *binary,
+ EGLint binarysize);
+
+Error ValidateProgramCacheResizeANGLE(const Display *display, EGLint limit, EGLenum mode);
+
+Error ValidateSurfaceAttrib(const Display *display,
+ const Surface *surface,
+ EGLint attribute,
+ EGLint value);
+Error ValidateQuerySurface(const Display *display,
+ const Surface *surface,
+ EGLint attribute,
+ EGLint *value);
+Error ValidateQueryContext(const Display *display,
+ const gl::Context *context,
+ EGLint attribute,
+ EGLint *value);
+
+// EGL_KHR_debug
+Error ValidateDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const AttributeMap &attribs);
+
+Error ValidateQueryDebugKHR(EGLint attribute, EGLAttrib *value);
+
+Error ValidateLabelObjectKHR(Thread *thread,
+ const Display *display,
+ ObjectType objectType,
+ EGLObjectKHR object,
+ EGLLabelKHR label);
+
+// ANDROID_get_frame_timestamps
+Error ValidateGetCompositorTimingSupportedANDROID(const Display *display,
+ const Surface *surface,
+ CompositorTiming name);
+
+Error ValidateGetCompositorTimingANDROID(const Display *display,
+ const Surface *surface,
+ EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values);
+
+Error ValidateGetNextFrameIdANDROID(const Display *display,
+ const Surface *surface,
+ EGLuint64KHR *frameId);
+
+Error ValidateGetFrameTimestampSupportedANDROID(const Display *display,
+ const Surface *surface,
+ Timestamp timestamp);
+
+Error ValidateGetFrameTimestampsANDROID(const Display *display,
+ const Surface *surface,
+ EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values);
+
+Error ValidateQueryStringiANGLE(const Display *display, EGLint name, EGLint index);
+
+Error ValidateQueryDisplayAttribEXT(const Display *display, const EGLint attribute);
+Error ValidateQueryDisplayAttribANGLE(const Display *display, const EGLint attribute);
+
+// EGL_ANDROID_get_native_client_buffer
+Error ValidateGetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer);
+
+// EGL_ANDROID_native_fence_sync
+Error ValidateDupNativeFenceFDANDROID(const Display *display, const Sync *sync);
+
+} // namespace egl
+
+#define ANGLE_EGL_TRY(THREAD, EXPR, FUNCNAME, LABELOBJECT) \
+ do \
+ { \
+ auto ANGLE_LOCAL_VAR = (EXPR); \
+ if (ANGLE_LOCAL_VAR.isError()) \
+ return THREAD->setError(ANGLE_LOCAL_VAR, GetDebug(), FUNCNAME, LABELOBJECT); \
+ } while (0)
+
+#define ANGLE_EGL_TRY_RETURN(THREAD, EXPR, FUNCNAME, LABELOBJECT, RETVAL) \
+ do \
+ { \
+ auto ANGLE_LOCAL_VAR = (EXPR); \
+ if (ANGLE_LOCAL_VAR.isError()) \
+ { \
+ THREAD->setError(ANGLE_LOCAL_VAR, GetDebug(), FUNCNAME, LABELOBJECT); \
+ return RETVAL; \
+ } \
+ } while (0)
+
+#endif // LIBANGLE_VALIDATIONEGL_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES.cpp b/gfx/angle/checkout/src/libANGLE/validationES.cpp
new file mode 100644
index 0000000000..d6b0d270a0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES.cpp
@@ -0,0 +1,6600 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES.h: Validation functions for generic OpenGL ES entry point parameters
+
+#include "libANGLE/validationES.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Image.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/Query.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/TransformFeedback.h"
+#include "libANGLE/angletypes.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/queryconversions.h"
+#include "libANGLE/queryutils.h"
+#include "libANGLE/validationES2.h"
+#include "libANGLE/validationES3.h"
+
+#include "common/mathutil.h"
+#include "common/utilities.h"
+
+using namespace angle;
+
+namespace gl
+{
+using namespace err;
+
+namespace
+{
+bool CompressedTextureFormatRequiresExactSize(GLenum internalFormat)
+{
+ // List of compressed format that require that the texture size is smaller than or a multiple of
+ // the compressed block size.
+ 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:
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGBA8_LOSSY_DECODE_ETC2_EAC_ANGLE:
+ case GL_COMPRESSED_SRGB8_ALPHA8_LOSSY_DECODE_ETC2_EAC_ANGLE:
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
+ case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT:
+ case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
+ return true;
+
+ default:
+ return false;
+ }
+}
+bool CompressedSubTextureFormatRequiresExactSize(GLenum internalFormat)
+{
+ // Compressed sub textures have additional formats that requires exact size.
+ // ES 3.1, Section 8.7, Page 171
+ return CompressedTextureFormatRequiresExactSize(internalFormat) ||
+ IsETC2EACFormat(internalFormat);
+}
+
+bool DifferenceCanOverflow(GLint a, GLint b)
+{
+ CheckedNumeric<GLint> checkedA(a);
+ checkedA -= b;
+ // Use negation to make sure that the difference can't overflow regardless of the order.
+ checkedA = -checkedA;
+ return !checkedA.IsValid();
+}
+
+bool ValidReadPixelsTypeEnum(Context *context, GLenum type)
+{
+ switch (type)
+ {
+ // Types referenced in Table 3.4 of the ES 2.0.25 spec
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return context->getClientVersion() >= ES_2_0;
+
+ // Types referenced in Table 3.2 of the ES 3.0.5 spec (Except depth stencil)
+ case GL_BYTE:
+ case GL_INT:
+ case GL_SHORT:
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ case GL_UNSIGNED_INT_24_8:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
+ return context->getClientVersion() >= ES_3_0;
+
+ case GL_FLOAT:
+ return context->getClientVersion() >= ES_3_0 || context->getExtensions().textureFloat ||
+ context->getExtensions().colorBufferHalfFloat;
+
+ case GL_HALF_FLOAT:
+ return context->getClientVersion() >= ES_3_0 ||
+ context->getExtensions().textureHalfFloat;
+
+ case GL_HALF_FLOAT_OES:
+ return context->getExtensions().colorBufferHalfFloat;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidReadPixelsFormatEnum(Context *context, GLenum format)
+{
+ switch (format)
+ {
+ // Formats referenced in Table 3.4 of the ES 2.0.25 spec (Except luminance)
+ case GL_RGBA:
+ case GL_RGB:
+ case GL_ALPHA:
+ return context->getClientVersion() >= ES_2_0;
+
+ // Formats referenced in Table 3.2 of the ES 3.0.5 spec
+ case GL_RG:
+ case GL_RED:
+ case GL_RGBA_INTEGER:
+ case GL_RGB_INTEGER:
+ case GL_RG_INTEGER:
+ case GL_RED_INTEGER:
+ return context->getClientVersion() >= ES_3_0;
+
+ case GL_SRGB_ALPHA_EXT:
+ case GL_SRGB_EXT:
+ return context->getExtensions().sRGB;
+
+ case GL_BGRA_EXT:
+ return context->getExtensions().readFormatBGRA;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidReadPixelsFormatType(Context *context,
+ GLenum framebufferComponentType,
+ GLenum format,
+ GLenum type)
+{
+ switch (framebufferComponentType)
+ {
+ case GL_UNSIGNED_NORMALIZED:
+ // TODO(geofflang): Don't accept BGRA here. Some chrome internals appear to try to use
+ // ReadPixels with BGRA even if the extension is not present
+ return (format == GL_RGBA && type == GL_UNSIGNED_BYTE) ||
+ (context->getExtensions().readFormatBGRA && format == GL_BGRA_EXT &&
+ type == GL_UNSIGNED_BYTE);
+
+ case GL_SIGNED_NORMALIZED:
+ return (format == GL_RGBA && type == GL_UNSIGNED_BYTE);
+
+ case GL_INT:
+ return (format == GL_RGBA_INTEGER && type == GL_INT);
+
+ case GL_UNSIGNED_INT:
+ return (format == GL_RGBA_INTEGER && type == GL_UNSIGNED_INT);
+
+ case GL_FLOAT:
+ return (format == GL_RGBA && type == GL_FLOAT);
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+template <typename ParamType>
+bool ValidateTextureWrapModeValue(Context *context,
+ const ParamType *params,
+ bool restrictedWrapModes)
+{
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_CLAMP_TO_EDGE:
+ break;
+
+ case GL_CLAMP_TO_BORDER:
+ if (!context->getExtensions().textureBorderClamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ case GL_REPEAT:
+ case GL_MIRRORED_REPEAT:
+ if (restrictedWrapModes)
+ {
+ // OES_EGL_image_external and ANGLE_texture_rectangle specifies this error.
+ context->validationError(GL_INVALID_ENUM, kInvalidWrapModeTexture);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureWrap);
+ return false;
+ }
+
+ return true;
+}
+
+template <typename ParamType>
+bool ValidateTextureMinFilterValue(Context *context,
+ const ParamType *params,
+ bool restrictedMinFilter)
+{
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ break;
+
+ case GL_NEAREST_MIPMAP_NEAREST:
+ case GL_LINEAR_MIPMAP_NEAREST:
+ case GL_NEAREST_MIPMAP_LINEAR:
+ case GL_LINEAR_MIPMAP_LINEAR:
+ if (restrictedMinFilter)
+ {
+ // OES_EGL_image_external specifies this error.
+ context->validationError(GL_INVALID_ENUM, kInvalidFilterTexture);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureFilterParam);
+ return false;
+ }
+
+ return true;
+}
+
+template <typename ParamType>
+bool ValidateTextureMagFilterValue(Context *context, const ParamType *params)
+{
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureFilterParam);
+ return false;
+ }
+
+ return true;
+}
+
+template <typename ParamType>
+bool ValidateTextureCompareModeValue(Context *context, const ParamType *params)
+{
+ // Acceptable mode parameters from GLES 3.0.2 spec, table 3.17
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_NONE:
+ case GL_COMPARE_REF_TO_TEXTURE:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kUnknownParameter);
+ return false;
+ }
+
+ return true;
+}
+
+template <typename ParamType>
+bool ValidateTextureCompareFuncValue(Context *context, const ParamType *params)
+{
+ // Acceptable function parameters from GLES 3.0.2 spec, table 3.17
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_LEQUAL:
+ case GL_GEQUAL:
+ case GL_LESS:
+ case GL_GREATER:
+ case GL_EQUAL:
+ case GL_NOTEQUAL:
+ case GL_ALWAYS:
+ case GL_NEVER:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kUnknownParameter);
+ return false;
+ }
+
+ return true;
+}
+
+template <typename ParamType>
+bool ValidateTextureSRGBDecodeValue(Context *context, const ParamType *params)
+{
+ if (!context->getExtensions().textureSRGBDecode)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_DECODE_EXT:
+ case GL_SKIP_DECODE_EXT:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kUnknownParameter);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTextureMaxAnisotropyExtensionEnabled(Context *context)
+{
+ if (!context->getExtensions().textureFilterAnisotropic)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTextureMaxAnisotropyValue(Context *context, GLfloat paramValue)
+{
+ if (!ValidateTextureMaxAnisotropyExtensionEnabled(context))
+ {
+ return false;
+ }
+
+ GLfloat largest = context->getExtensions().maxTextureAnisotropy;
+
+ if (paramValue < 1 || paramValue > largest)
+ {
+ context->validationError(GL_INVALID_VALUE, kOutsideOfBounds);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFragmentShaderColorBufferMaskMatch(Context *context)
+{
+ const Program *program = context->getState().getLinkedProgram(context);
+ const Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
+
+ auto drawBufferMask = framebuffer->getDrawBufferMask().to_ulong();
+ auto fragmentOutputMask = program->getActiveOutputVariables().to_ulong();
+
+ return drawBufferMask == (drawBufferMask & fragmentOutputMask);
+}
+
+bool ValidateFragmentShaderColorBufferTypeMatch(Context *context)
+{
+ const Program *program = context->getState().getLinkedProgram(context);
+ const Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
+
+ return ValidateComponentTypeMasks(program->getDrawBufferTypeMask().to_ulong(),
+ framebuffer->getDrawBufferTypeMask().to_ulong(),
+ program->getActiveOutputVariables().to_ulong(),
+ framebuffer->getDrawBufferMask().to_ulong());
+}
+
+bool ValidateVertexShaderAttributeTypeMatch(Context *context)
+{
+ const auto &glState = context->getState();
+ const Program *program = context->getState().getLinkedProgram(context);
+ const VertexArray *vao = context->getState().getVertexArray();
+
+ unsigned long stateCurrentValuesTypeBits = glState.getCurrentValuesTypeMask().to_ulong();
+ unsigned long vaoAttribTypeBits = vao->getAttributesTypeMask().to_ulong();
+ unsigned long vaoAttribEnabledMask = vao->getAttributesMask().to_ulong();
+
+ vaoAttribEnabledMask |= vaoAttribEnabledMask << kMaxComponentTypeMaskIndex;
+ vaoAttribTypeBits = (vaoAttribEnabledMask & vaoAttribTypeBits);
+ vaoAttribTypeBits |= (~vaoAttribEnabledMask & stateCurrentValuesTypeBits);
+
+ return ValidateComponentTypeMasks(program->getAttributesTypeMask().to_ulong(),
+ vaoAttribTypeBits, program->getAttributesMask().to_ulong(),
+ 0xFFFF);
+}
+
+bool IsCompatibleDrawModeWithGeometryShader(PrimitiveMode drawMode,
+ PrimitiveMode geometryShaderInputPrimitiveType)
+{
+ // [EXT_geometry_shader] Section 11.1gs.1, Geometry Shader Input Primitives
+ switch (drawMode)
+ {
+ case PrimitiveMode::Points:
+ return geometryShaderInputPrimitiveType == PrimitiveMode::Points;
+ case PrimitiveMode::Lines:
+ case PrimitiveMode::LineStrip:
+ case PrimitiveMode::LineLoop:
+ return geometryShaderInputPrimitiveType == PrimitiveMode::Lines;
+ case PrimitiveMode::LinesAdjacency:
+ case PrimitiveMode::LineStripAdjacency:
+ return geometryShaderInputPrimitiveType == PrimitiveMode::LinesAdjacency;
+ case PrimitiveMode::Triangles:
+ case PrimitiveMode::TriangleFan:
+ case PrimitiveMode::TriangleStrip:
+ return geometryShaderInputPrimitiveType == PrimitiveMode::Triangles;
+ case PrimitiveMode::TrianglesAdjacency:
+ case PrimitiveMode::TriangleStripAdjacency:
+ return geometryShaderInputPrimitiveType == PrimitiveMode::TrianglesAdjacency;
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+// GLES1 texture parameters are a small subset of the others
+bool IsValidGLES1TextureParameter(GLenum pname)
+{
+ switch (pname)
+ {
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_GENERATE_MIPMAP:
+ case GL_TEXTURE_CROP_RECT_OES:
+ return true;
+ default:
+ return false;
+ }
+}
+
+unsigned int GetSamplerParameterCount(GLenum pname)
+{
+ return pname == GL_TEXTURE_BORDER_COLOR ? 4 : 1;
+}
+
+} // anonymous namespace
+
+void SetRobustLengthParam(GLsizei *length, GLsizei value)
+{
+ if (length)
+ {
+ *length = value;
+ }
+}
+
+bool IsETC2EACFormat(const GLenum format)
+{
+ // ES 3.1, Table 8.19
+ switch (format)
+ {
+ case GL_COMPRESSED_R11_EAC:
+ case GL_COMPRESSED_SIGNED_R11_EAC:
+ case GL_COMPRESSED_RG11_EAC:
+ case GL_COMPRESSED_SIGNED_RG11_EAC:
+ case GL_COMPRESSED_RGB8_ETC2:
+ case GL_COMPRESSED_SRGB8_ETC2:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
+ case GL_COMPRESSED_RGBA8_ETC2_EAC:
+ case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidTextureTarget(const Context *context, TextureType type)
+{
+ switch (type)
+ {
+ case TextureType::_2D:
+ case TextureType::CubeMap:
+ return true;
+
+ case TextureType::Rectangle:
+ return context->getExtensions().textureRectangle;
+
+ case TextureType::_3D:
+ return ((context->getClientMajorVersion() >= 3) ||
+ context->getExtensions().texture3DOES);
+
+ case TextureType::_2DArray:
+ return (context->getClientMajorVersion() >= 3);
+
+ case TextureType::_2DMultisample:
+ return (context->getClientVersion() >= Version(3, 1) ||
+ context->getExtensions().textureMultisample);
+ case TextureType::_2DMultisampleArray:
+ return context->getExtensions().textureStorageMultisample2DArray;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidTexture2DTarget(const Context *context, TextureType type)
+{
+ switch (type)
+ {
+ case TextureType::_2D:
+ case TextureType::CubeMap:
+ return true;
+
+ case TextureType::Rectangle:
+ return context->getExtensions().textureRectangle;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidTexture3DTarget(const Context *context, TextureType target)
+{
+ switch (target)
+ {
+ case TextureType::_3D:
+ case TextureType::_2DArray:
+ return (context->getClientMajorVersion() >= 3);
+
+ default:
+ return false;
+ }
+}
+
+// Most texture GL calls are not compatible with external textures, so we have a separate validation
+// function for use in the GL calls that do
+bool ValidTextureExternalTarget(const Context *context, TextureType target)
+{
+ return (target == TextureType::External) &&
+ (context->getExtensions().eglImageExternal ||
+ context->getExtensions().eglStreamConsumerExternal);
+}
+
+bool ValidTextureExternalTarget(const Context *context, TextureTarget target)
+{
+ return (target == TextureTarget::External) &&
+ ValidTextureExternalTarget(context, TextureType::External);
+}
+
+// This function differs from ValidTextureTarget in that the target must be
+// usable as the destination of a 2D operation-- so a cube face is valid, but
+// GL_TEXTURE_CUBE_MAP is not.
+// Note: duplicate of IsInternalTextureTarget
+bool ValidTexture2DDestinationTarget(const Context *context, TextureTarget target)
+{
+ switch (target)
+ {
+ case TextureTarget::_2D:
+ case TextureTarget::CubeMapNegativeX:
+ case TextureTarget::CubeMapNegativeY:
+ case TextureTarget::CubeMapNegativeZ:
+ case TextureTarget::CubeMapPositiveX:
+ case TextureTarget::CubeMapPositiveY:
+ case TextureTarget::CubeMapPositiveZ:
+ return true;
+ case TextureTarget::Rectangle:
+ return context->getExtensions().textureRectangle;
+ default:
+ return false;
+ }
+}
+
+bool ValidateTransformFeedbackPrimitiveMode(const Context *context,
+ PrimitiveMode transformFeedbackPrimitiveMode,
+ PrimitiveMode renderPrimitiveMode)
+{
+ ASSERT(context);
+
+ if (!context->getExtensions().geometryShader)
+ {
+ // 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 transformFeedbackPrimitiveMode == renderPrimitiveMode;
+ }
+
+ // [GL_EXT_geometry_shader] Table 12.1gs
+ switch (renderPrimitiveMode)
+ {
+ case PrimitiveMode::Points:
+ return transformFeedbackPrimitiveMode == PrimitiveMode::Points;
+ case PrimitiveMode::Lines:
+ case PrimitiveMode::LineStrip:
+ case PrimitiveMode::LineLoop:
+ return transformFeedbackPrimitiveMode == PrimitiveMode::Lines;
+ case PrimitiveMode::Triangles:
+ case PrimitiveMode::TriangleFan:
+ case PrimitiveMode::TriangleStrip:
+ return transformFeedbackPrimitiveMode == PrimitiveMode::Triangles;
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool ValidateDrawElementsInstancedBase(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const GLvoid *indices,
+ GLsizei primcount)
+{
+ if (primcount <= 0)
+ {
+ if (primcount < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativePrimcount);
+ return false;
+ }
+
+ // Early exit.
+ return ValidateDrawElementsCommon(context, mode, count, type, indices, primcount);
+ }
+
+ if (!ValidateDrawElementsCommon(context, mode, count, type, indices, primcount))
+ {
+ return false;
+ }
+
+ if (count == 0)
+ {
+ // Early exit.
+ return true;
+ }
+
+ return ValidateDrawInstancedAttribs(context, primcount);
+}
+
+bool ValidateDrawArraysInstancedBase(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ if (primcount <= 0)
+ {
+ if (primcount < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativePrimcount);
+ return false;
+ }
+
+ // Early exit.
+ return ValidateDrawArraysCommon(context, mode, first, count, primcount);
+ }
+
+ if (!ValidateDrawArraysCommon(context, mode, first, count, primcount))
+ {
+ return false;
+ }
+
+ if (count == 0)
+ {
+ // Early exit.
+ return true;
+ }
+
+ return ValidateDrawInstancedAttribs(context, primcount);
+}
+
+bool ValidateDrawInstancedANGLE(Context *context)
+{
+ // Verify there is at least one active attribute with a divisor of zero
+ const State &state = context->getState();
+
+ Program *program = state.getLinkedProgram(context);
+
+ const auto &attribs = state.getVertexArray()->getVertexAttributes();
+ const auto &bindings = state.getVertexArray()->getVertexBindings();
+ for (size_t attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
+ {
+ const VertexAttribute &attrib = attribs[attributeIndex];
+ const VertexBinding &binding = bindings[attrib.bindingIndex];
+ if (program->isAttribLocationActive(attributeIndex) && binding.getDivisor() == 0)
+ {
+ return true;
+ }
+ }
+
+ context->validationError(GL_INVALID_OPERATION, kNoZeroDivisor);
+ return false;
+}
+
+bool ValidTexture3DDestinationTarget(const Context *context, TextureTarget target)
+{
+ switch (target)
+ {
+ case TextureTarget::_3D:
+ case TextureTarget::_2DArray:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidTexLevelDestinationTarget(const Context *context, TextureType type)
+{
+ switch (type)
+ {
+ case TextureType::_2D:
+ case TextureType::_2DArray:
+ case TextureType::_2DMultisample:
+ case TextureType::CubeMap:
+ case TextureType::_3D:
+ return true;
+ case TextureType::Rectangle:
+ return context->getExtensions().textureRectangle;
+ case TextureType::_2DMultisampleArray:
+ return context->getExtensions().textureStorageMultisample2DArray;
+ default:
+ return false;
+ }
+}
+
+bool ValidFramebufferTarget(const Context *context, GLenum target)
+{
+ static_assert(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER &&
+ GL_READ_FRAMEBUFFER_ANGLE == GL_READ_FRAMEBUFFER,
+ "ANGLE framebuffer enums must equal the ES3 framebuffer enums.");
+
+ switch (target)
+ {
+ case GL_FRAMEBUFFER:
+ return true;
+
+ case GL_READ_FRAMEBUFFER:
+ case GL_DRAW_FRAMEBUFFER:
+ return (context->getExtensions().framebufferBlit ||
+ context->getClientMajorVersion() >= 3);
+
+ default:
+ return false;
+ }
+}
+
+bool ValidMipLevel(const Context *context, TextureType type, GLint level)
+{
+ const auto &caps = context->getCaps();
+ size_t maxDimension = 0;
+ switch (type)
+ {
+ case TextureType::_2D:
+ case TextureType::_2DArray:
+ case TextureType::_2DMultisample:
+ case TextureType::_2DMultisampleArray:
+ // TODO(http://anglebug.com/2775): It's a bit unclear what the "maximum allowable
+ // level-of-detail" for multisample textures should be. Could maybe make it zero.
+ maxDimension = caps.max2DTextureSize;
+ break;
+
+ case TextureType::CubeMap:
+ maxDimension = caps.maxCubeMapTextureSize;
+ break;
+
+ case TextureType::External:
+ case TextureType::Rectangle:
+ return level == 0;
+
+ case TextureType::_3D:
+ maxDimension = caps.max3DTextureSize;
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ return level <= log2(static_cast<int>(maxDimension)) && level >= 0;
+}
+
+bool ValidImageSizeParameters(Context *context,
+ TextureType target,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ bool isSubImage)
+{
+ if (width < 0 || height < 0 || depth < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+ // TexSubImage parameters can be NPOT without textureNPOT extension,
+ // as long as the destination texture is POT.
+ bool hasNPOTSupport =
+ context->getExtensions().textureNPOT || context->getClientVersion() >= Version(3, 0);
+ if (!isSubImage && !hasNPOTSupport &&
+ (level != 0 && (!isPow2(width) || !isPow2(height) || !isPow2(depth))))
+ {
+ context->validationError(GL_INVALID_VALUE, kTextureNotPow2);
+ return false;
+ }
+
+ if (!ValidMipLevel(context, target, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidCompressedDimension(GLsizei size, GLuint blockSize, bool smallerThanBlockSizeAllowed)
+{
+ return (smallerThanBlockSizeAllowed && (size > 0) && (blockSize % size == 0)) ||
+ (size % blockSize == 0);
+}
+
+bool ValidCompressedImageSize(const Context *context,
+ GLenum internalFormat,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalFormat);
+ if (!formatInfo.compressed)
+ {
+ return false;
+ }
+
+ if (width < 0 || height < 0)
+ {
+ return false;
+ }
+
+ if (CompressedTextureFormatRequiresExactSize(internalFormat))
+ {
+ // The ANGLE extensions allow specifying compressed textures with sizes smaller than the
+ // block size for level 0 but WebGL disallows this.
+ bool smallerThanBlockSizeAllowed =
+ level > 0 || !context->getExtensions().webglCompatibility;
+
+ if (!ValidCompressedDimension(width, formatInfo.compressedBlockWidth,
+ smallerThanBlockSizeAllowed) ||
+ !ValidCompressedDimension(height, formatInfo.compressedBlockHeight,
+ smallerThanBlockSizeAllowed) ||
+ !ValidCompressedDimension(depth, formatInfo.compressedBlockDepth,
+ smallerThanBlockSizeAllowed))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidCompressedSubImageSize(const Context *context,
+ GLenum internalFormat,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ size_t textureWidth,
+ size_t textureHeight,
+ size_t textureDepth)
+{
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalFormat);
+ if (!formatInfo.compressed)
+ {
+ return false;
+ }
+
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0 || width < 0 || height < 0 || depth < 0)
+ {
+ return false;
+ }
+
+ if (CompressedSubTextureFormatRequiresExactSize(internalFormat))
+ {
+ if (xoffset % formatInfo.compressedBlockWidth != 0 ||
+ yoffset % formatInfo.compressedBlockHeight != 0 ||
+ zoffset % formatInfo.compressedBlockDepth != 0)
+ {
+ return false;
+ }
+
+ // Allowed to either have data that is a multiple of block size or is smaller than the block
+ // size but fills the entire mip
+ bool fillsEntireMip = xoffset == 0 && yoffset == 0 &&
+ static_cast<size_t>(width) == textureWidth &&
+ static_cast<size_t>(height) == textureHeight &&
+ static_cast<size_t>(depth) == textureDepth;
+ bool sizeMultipleOfBlockSize = (width % formatInfo.compressedBlockWidth) == 0 &&
+ (height % formatInfo.compressedBlockHeight) == 0 &&
+ (depth % formatInfo.compressedBlockDepth) == 0;
+ if (!sizeMultipleOfBlockSize && !fillsEntireMip)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidImageDataSize(Context *context,
+ TextureType texType,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ GLsizei imageSize)
+{
+ Buffer *pixelUnpackBuffer = context->getState().getTargetBuffer(BufferBinding::PixelUnpack);
+ if (pixelUnpackBuffer == nullptr && imageSize < 0)
+ {
+ // Checks are not required
+ return true;
+ }
+
+ // ...the data would be unpacked from the buffer object such that the memory reads required
+ // would exceed the data store size.
+ const InternalFormat &formatInfo = GetInternalFormatInfo(format, type);
+ ASSERT(formatInfo.internalFormat != GL_NONE);
+ const Extents size(width, height, depth);
+ const auto &unpack = context->getState().getUnpackState();
+
+ bool targetIs3D = texType == TextureType::_3D || texType == TextureType::_2DArray;
+ GLuint endByte = 0;
+ if (!formatInfo.computePackUnpackEndByte(type, size, unpack, targetIs3D, &endByte))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ if (pixelUnpackBuffer)
+ {
+ CheckedNumeric<size_t> checkedEndByte(endByte);
+ CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(pixels));
+ checkedEndByte += checkedOffset;
+
+ if (!checkedEndByte.IsValid() ||
+ (checkedEndByte.ValueOrDie() > static_cast<size_t>(pixelUnpackBuffer->getSize())))
+ {
+ // Overflow past the end of the buffer
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+ if (context->getExtensions().webglCompatibility &&
+ pixelUnpackBuffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kPixelUnpackBufferBoundForTransformFeedback);
+ return false;
+ }
+ }
+ else
+ {
+ ASSERT(imageSize >= 0);
+ if (pixels == nullptr && imageSize != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kImageSizeMustBeZero);
+ return false;
+ }
+
+ if (pixels != nullptr && endByte > static_cast<GLuint>(imageSize))
+ {
+ context->validationError(GL_INVALID_OPERATION, kImageSizeTooSmall);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidQueryType(const Context *context, QueryType queryType)
+{
+ switch (queryType)
+ {
+ case QueryType::AnySamples:
+ case QueryType::AnySamplesConservative:
+ return context->getClientMajorVersion() >= 3 ||
+ context->getExtensions().occlusionQueryBoolean;
+ case QueryType::TransformFeedbackPrimitivesWritten:
+ return (context->getClientMajorVersion() >= 3);
+ case QueryType::TimeElapsed:
+ return context->getExtensions().disjointTimerQuery;
+ case QueryType::CommandsCompleted:
+ return context->getExtensions().syncQuery;
+ case QueryType::PrimitivesGenerated:
+ return context->getExtensions().geometryShader;
+ default:
+ return false;
+ }
+}
+
+bool ValidateWebGLVertexAttribPointer(Context *context,
+ VertexAttribType type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *ptr,
+ bool pureInteger)
+{
+ ASSERT(context->getExtensions().webglCompatibility);
+ // WebGL 1.0 [Section 6.11] Vertex Attribute Data Stride
+ // The WebGL API supports vertex attribute data strides up to 255 bytes. A call to
+ // vertexAttribPointer will generate an INVALID_VALUE error if the value for the stride
+ // parameter exceeds 255.
+ constexpr GLsizei kMaxWebGLStride = 255;
+ if (stride > kMaxWebGLStride)
+ {
+ context->validationError(GL_INVALID_VALUE, kStrideExceedsWebGLLimit);
+ return false;
+ }
+
+ // WebGL 1.0 [Section 6.4] Buffer Offset and Stride Requirements
+ // The offset arguments to drawElements and vertexAttribPointer, and the stride argument to
+ // vertexAttribPointer, must be a multiple of the size of the data type passed to the call,
+ // or an INVALID_OPERATION error is generated.
+ angle::FormatID internalType = GetVertexFormatID(type, normalized, 1, pureInteger);
+ size_t typeSize = GetVertexFormatSize(internalType);
+
+ ASSERT(isPow2(typeSize) && typeSize > 0);
+ size_t sizeMask = (typeSize - 1);
+ if ((reinterpret_cast<intptr_t>(ptr) & sizeMask) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kOffsetMustBeMultipleOfType);
+ return false;
+ }
+
+ if ((stride & sizeMask) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kStrideMustBeMultipleOfType);
+ return false;
+ }
+
+ return true;
+}
+
+Program *GetValidProgramNoResolve(Context *context, GLuint id)
+{
+ // ES3 spec (section 2.11.1) -- "Commands that accept shader or program object names will
+ // generate the error INVALID_VALUE if the provided name is not the name of either a shader
+ // or program object and INVALID_OPERATION if the provided name identifies an object
+ // that is not the expected type."
+
+ Program *validProgram = context->getProgramNoResolveLink(id);
+
+ if (!validProgram)
+ {
+ if (context->getShader(id))
+ {
+ context->validationError(GL_INVALID_OPERATION, kExpectedProgramName);
+ }
+ else
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProgramName);
+ }
+ }
+
+ return validProgram;
+}
+
+Program *GetValidProgram(Context *context, GLuint id)
+{
+ Program *program = GetValidProgramNoResolve(context, id);
+ if (program)
+ {
+ program->resolveLink(context);
+ }
+ return program;
+}
+
+Shader *GetValidShader(Context *context, GLuint id)
+{
+ // See ValidProgram for spec details.
+
+ Shader *validShader = context->getShader(id);
+
+ if (!validShader)
+ {
+ if (context->getProgramNoResolveLink(id))
+ {
+ context->validationError(GL_INVALID_OPERATION, kExpectedShaderName);
+ }
+ else
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidShaderName);
+ }
+ }
+
+ return validShader;
+}
+
+bool ValidateAttachmentTarget(Context *context, GLenum attachment)
+{
+ if (attachment >= GL_COLOR_ATTACHMENT1_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ if (context->getClientMajorVersion() < 3 && !context->getExtensions().drawBuffers)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidAttachment);
+ return false;
+ }
+
+ // Color attachment 0 is validated below because it is always valid
+ const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+ if (colorAttachment >= context->getCaps().maxColorAttachments)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidAttachment);
+ return false;
+ }
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_COLOR_ATTACHMENT0:
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (!context->getExtensions().webglCompatibility &&
+ context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidAttachment);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidAttachment);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateRenderbufferStorageParametersBase(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ switch (target)
+ {
+ case GL_RENDERBUFFER:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidRenderbufferTarget);
+ return false;
+ }
+
+ if (width < 0 || height < 0 || samples < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidRenderbufferWidthHeight);
+ return false;
+ }
+
+ // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
+ GLenum convertedInternalFormat = context->getConvertedRenderbufferFormat(internalformat);
+
+ const TextureCaps &formatCaps = context->getTextureCaps().get(convertedInternalFormat);
+ if (!formatCaps.renderbuffer)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidRenderbufferInternalFormat);
+ return false;
+ }
+
+ // ANGLE_framebuffer_multisample does not explicitly state that the internal format must be
+ // sized but it does state that the format must be in the ES2.0 spec table 4.5 which contains
+ // only sized internal formats.
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(convertedInternalFormat);
+ if (formatInfo.internalFormat == GL_NONE)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidRenderbufferInternalFormat);
+ return false;
+ }
+
+ if (static_cast<GLuint>(std::max(width, height)) > context->getCaps().maxRenderbufferSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxRenderbufferSize);
+ return false;
+ }
+
+ GLuint handle = context->getState().getRenderbufferId();
+ if (handle == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidRenderbufferTarget);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFramebufferRenderbufferParameters(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+
+ ASSERT(framebuffer);
+ if (framebuffer->id() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultFramebufferTarget);
+ return false;
+ }
+
+ if (!ValidateAttachmentTarget(context, attachment))
+ {
+ return false;
+ }
+
+ // [OpenGL ES 2.0.25] Section 4.4.3 page 112
+ // [OpenGL ES 3.0.2] Section 4.4.2 page 201
+ // 'renderbuffer' must be either zero or the name of an existing renderbuffer object of
+ // type 'renderbuffertarget', otherwise an INVALID_OPERATION error is generated.
+ if (renderbuffer != 0)
+ {
+ if (!context->getRenderbuffer(renderbuffer))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidRenderbufferTarget);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateBlitFramebufferParameters(Context *context,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ switch (filter)
+ {
+ case GL_NEAREST:
+ break;
+ case GL_LINEAR:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kBlitInvalidFilter);
+ return false;
+ }
+
+ if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kBlitInvalidMask);
+ return false;
+ }
+
+ // ES3.0 spec, section 4.3.2 states that linear filtering is only available for the
+ // color buffer, leaving only nearest being unfiltered from above
+ if ((mask & ~GL_COLOR_BUFFER_BIT) != 0 && filter != GL_NEAREST)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitOnlyNearestForNonColor);
+ return false;
+ }
+
+ const auto &glState = context->getState();
+ Framebuffer *readFramebuffer = glState.getReadFramebuffer();
+ Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
+
+ if (!readFramebuffer || !drawFramebuffer)
+ {
+ context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, kBlitFramebufferMissing);
+ return false;
+ }
+
+ if (!ValidateFramebufferComplete(context, readFramebuffer))
+ {
+ return false;
+ }
+
+ if (!ValidateFramebufferComplete(context, drawFramebuffer))
+ {
+ return false;
+ }
+
+ if (readFramebuffer->id() == drawFramebuffer->id())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitFeedbackLoop);
+ return false;
+ }
+
+ if (!ValidateFramebufferNotMultisampled(context, drawFramebuffer))
+ {
+ return false;
+ }
+
+ // This validation is specified in the WebGL 2.0 spec and not in the GLES 3.0.5 spec, but we
+ // always run it in order to avoid triggering driver bugs.
+ if (DifferenceCanOverflow(srcX0, srcX1) || DifferenceCanOverflow(srcY0, srcY1) ||
+ DifferenceCanOverflow(dstX0, dstX1) || DifferenceCanOverflow(dstY0, dstY1))
+ {
+ context->validationError(GL_INVALID_VALUE, kBlitDimensionsOutOfRange);
+ return false;
+ }
+
+ bool sameBounds = srcX0 == dstX0 && srcY0 == dstY0 && srcX1 == dstX1 && srcY1 == dstY1;
+
+ if (mask & GL_COLOR_BUFFER_BIT)
+ {
+ const FramebufferAttachment *readColorBuffer = readFramebuffer->getReadColorAttachment();
+ const Extensions &extensions = context->getExtensions();
+
+ if (readColorBuffer)
+ {
+ const Format &readFormat = readColorBuffer->getFormat();
+
+ for (size_t drawbufferIdx = 0;
+ drawbufferIdx < drawFramebuffer->getDrawbufferStateCount(); ++drawbufferIdx)
+ {
+ const FramebufferAttachment *attachment =
+ drawFramebuffer->getDrawBuffer(drawbufferIdx);
+ if (attachment)
+ {
+ const Format &drawFormat = attachment->getFormat();
+
+ // The GL ES 3.0.2 spec (pg 193) states that:
+ // 1) If the read buffer is fixed point format, the draw buffer must be as well
+ // 2) If the read buffer is an unsigned integer format, the draw buffer must be
+ // as well
+ // 3) If the read buffer is a signed integer format, the draw buffer must be as
+ // well
+ // Changes with EXT_color_buffer_float:
+ // Case 1) is changed to fixed point OR floating point
+ GLenum readComponentType = readFormat.info->componentType;
+ GLenum drawComponentType = drawFormat.info->componentType;
+ bool readFixedPoint = (readComponentType == GL_UNSIGNED_NORMALIZED ||
+ readComponentType == GL_SIGNED_NORMALIZED);
+ bool drawFixedPoint = (drawComponentType == GL_UNSIGNED_NORMALIZED ||
+ drawComponentType == GL_SIGNED_NORMALIZED);
+
+ if (extensions.colorBufferFloat)
+ {
+ bool readFixedOrFloat = (readFixedPoint || readComponentType == GL_FLOAT);
+ bool drawFixedOrFloat = (drawFixedPoint || drawComponentType == GL_FLOAT);
+
+ if (readFixedOrFloat != drawFixedOrFloat)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitTypeMismatchFixedOrFloat);
+ return false;
+ }
+ }
+ else if (readFixedPoint != drawFixedPoint)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitTypeMismatchFixedPoint);
+ return false;
+ }
+
+ if (readComponentType == GL_UNSIGNED_INT &&
+ drawComponentType != GL_UNSIGNED_INT)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitTypeMismatchUnsignedInteger);
+ return false;
+ }
+
+ if (readComponentType == GL_INT && drawComponentType != GL_INT)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitTypeMismatchSignedInteger);
+ return false;
+ }
+
+ if (readColorBuffer->getSamples() > 0 &&
+ (!Format::EquivalentForBlit(readFormat, drawFormat) || !sameBounds))
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitMultisampledFormatOrBoundsMismatch);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility &&
+ *readColorBuffer == *attachment)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitSameImageColor);
+ return false;
+ }
+ }
+ }
+
+ if (readFormat.info->isInt() && filter == GL_LINEAR)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitIntegerWithLinearFilter);
+ return false;
+ }
+ }
+ // WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
+ // In OpenGL ES it is undefined what happens when an operation tries to blit from a missing
+ // attachment and WebGL defines it to be an error. We do the check unconditionally as the
+ // situation is an application error that would lead to a crash in ANGLE.
+ else if (drawFramebuffer->hasEnabledDrawBuffer())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitMissingColor);
+ return false;
+ }
+ }
+
+ GLenum masks[] = {GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT};
+ GLenum attachments[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
+ for (size_t i = 0; i < 2; i++)
+ {
+ if (mask & masks[i])
+ {
+ const FramebufferAttachment *readBuffer =
+ readFramebuffer->getAttachment(context, attachments[i]);
+ const FramebufferAttachment *drawBuffer =
+ drawFramebuffer->getAttachment(context, attachments[i]);
+
+ if (readBuffer && drawBuffer)
+ {
+ if (!Format::EquivalentForBlit(readBuffer->getFormat(), drawBuffer->getFormat()))
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitDepthOrStencilFormatMismatch);
+ return false;
+ }
+
+ if (readBuffer->getSamples() > 0 && !sameBounds)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitMultisampledBoundsMismatch);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility && *readBuffer == *drawBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitSameImageDepthOrStencil);
+ return false;
+ }
+ }
+ // WebGL 2.0 BlitFramebuffer when blitting from a missing attachment
+ else if (drawBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitMissingDepthOrStencil);
+ return false;
+ }
+ }
+ }
+
+ // OVR_multiview2:
+ // Calling BlitFramebuffer will result in an INVALID_FRAMEBUFFER_OPERATION error if the
+ // current draw framebuffer isMultiview() or the number of
+ // views in the current read framebuffer is more than one.
+ if (readFramebuffer->readDisallowedByMultiview())
+ {
+ context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, kBlitFromMultiview);
+ return false;
+ }
+ if (drawFramebuffer->isMultiview())
+ {
+ context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, kBlitToMultiview);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateReadPixelsRobustANGLE(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+ GLsizei writeColumns = 0;
+ GLsizei writeRows = 0;
+
+ if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, &writeLength,
+ &writeColumns, &writeRows, pixels))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+ SetRobustLengthParam(columns, writeColumns);
+ SetRobustLengthParam(rows, writeRows);
+
+ return true;
+}
+
+bool ValidateReadnPixelsEXT(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels)
+{
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ return ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, nullptr,
+ nullptr, nullptr, pixels);
+}
+
+bool ValidateReadnPixelsRobustANGLE(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data)
+{
+ GLsizei writeLength = 0;
+ GLsizei writeColumns = 0;
+ GLsizei writeRows = 0;
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, &writeLength,
+ &writeColumns, &writeRows, data))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+ SetRobustLengthParam(columns, writeColumns);
+ SetRobustLengthParam(rows, writeRows);
+
+ return true;
+}
+
+bool ValidateGenQueriesEXT(Context *context, GLsizei n, GLuint *ids)
+{
+ if (!context->getExtensions().occlusionQueryBoolean &&
+ !context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateDeleteQueriesEXT(Context *context, GLsizei n, const GLuint *ids)
+{
+ if (!context->getExtensions().occlusionQueryBoolean &&
+ !context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateIsQueryEXT(Context *context, GLuint id)
+{
+ if (!context->getExtensions().occlusionQueryBoolean &&
+ !context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id)
+{
+ if (!ValidQueryType(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidQueryType);
+ return false;
+ }
+
+ if (id == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidQueryId);
+ return false;
+ }
+
+ // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an <id>
+ // of zero, if the active query object name for <target> is non-zero (for the
+ // targets ANY_SAMPLES_PASSED_EXT and ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, if
+ // the active query for either target is non-zero), if <id> is the name of an
+ // existing query object whose type does not match <target>, or if <id> is the
+ // active query object name for any query type, the error INVALID_OPERATION is
+ // generated.
+
+ // Ensure no other queries are active
+ // NOTE: If other queries than occlusion are supported, we will need to check
+ // separately that:
+ // a) The query ID passed is not the current active query for any target/type
+ // b) There are no active queries for the requested target (and in the case
+ // of GL_ANY_SAMPLES_PASSED_EXT and GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
+ // no query may be active for either if glBeginQuery targets either.
+
+ if (context->getState().isQueryActive(target))
+ {
+ context->validationError(GL_INVALID_OPERATION, kOtherQueryActive);
+ return false;
+ }
+
+ Query *queryObject = context->getQuery(id, true, target);
+
+ // check that name was obtained with glGenQueries
+ if (!queryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidQueryId);
+ return false;
+ }
+
+ // check for type mismatch
+ if (queryObject->getType() != target)
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryTargetMismatch);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBeginQueryEXT(Context *context, QueryType target, GLuint id)
+{
+ if (!context->getExtensions().occlusionQueryBoolean &&
+ !context->getExtensions().disjointTimerQuery && !context->getExtensions().syncQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateBeginQueryBase(context, target, id);
+}
+
+bool ValidateEndQueryBase(Context *context, QueryType target)
+{
+ if (!ValidQueryType(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidQueryType);
+ return false;
+ }
+
+ const Query *queryObject = context->getState().getActiveQuery(target);
+
+ if (queryObject == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryInactive);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateEndQueryEXT(Context *context, QueryType target)
+{
+ if (!context->getExtensions().occlusionQueryBoolean &&
+ !context->getExtensions().disjointTimerQuery && !context->getExtensions().syncQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateEndQueryBase(context, target);
+}
+
+bool ValidateQueryCounterEXT(Context *context, GLuint id, QueryType target)
+{
+ if (!context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (target != QueryType::Timestamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidQueryTarget);
+ return false;
+ }
+
+ Query *queryObject = context->getQuery(id, true, target);
+ if (queryObject == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidQueryId);
+ return false;
+ }
+
+ if (context->getState().isQueryActive(queryObject))
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryActive);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetQueryivBase(Context *context, QueryType target, GLenum pname, GLsizei *numParams)
+{
+ if (numParams)
+ {
+ *numParams = 0;
+ }
+
+ if (!ValidQueryType(context, target) && target != QueryType::Timestamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidQueryType);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_CURRENT_QUERY_EXT:
+ if (target == QueryType::Timestamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidQueryTarget);
+ return false;
+ }
+ break;
+ case GL_QUERY_COUNTER_BITS_EXT:
+ if (!context->getExtensions().disjointTimerQuery ||
+ (target != QueryType::Timestamp && target != QueryType::TimeElapsed))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ if (numParams)
+ {
+ // All queries return only one value
+ *numParams = 1;
+ }
+
+ return true;
+}
+
+bool ValidateGetQueryivEXT(Context *context, QueryType target, GLenum pname, GLint *params)
+{
+ if (!context->getExtensions().occlusionQueryBoolean &&
+ !context->getExtensions().disjointTimerQuery && !context->getExtensions().syncQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGetQueryivBase(context, target, pname, nullptr);
+}
+
+bool ValidateGetQueryivRobustANGLE(Context *context,
+ QueryType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetQueryivBase(context, target, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetQueryObjectValueBase(Context *context, GLuint id, GLenum pname, GLsizei *numParams)
+{
+ if (numParams)
+ {
+ *numParams = 1;
+ }
+
+ if (context->isContextLost())
+ {
+ context->validationError(GL_CONTEXT_LOST, kContextLost);
+
+ if (pname == GL_QUERY_RESULT_AVAILABLE_EXT)
+ {
+ // Generate an error but still return true, the context still needs to return a
+ // value in this case.
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ Query *queryObject = context->getQuery(id, false, QueryType::InvalidEnum);
+
+ if (!queryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidQueryId);
+ return false;
+ }
+
+ if (context->getState().isQueryActive(queryObject))
+ {
+ context->validationError(GL_INVALID_OPERATION, kQueryActive);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_QUERY_RESULT_EXT:
+ case GL_QUERY_RESULT_AVAILABLE_EXT:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetQueryObjectivEXT(Context *context, GLuint id, GLenum pname, GLint *params)
+{
+ if (!context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
+}
+
+bool ValidateGetQueryObjectivRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetQueryObjectuivEXT(Context *context, GLuint id, GLenum pname, GLuint *params)
+{
+ if (!context->getExtensions().disjointTimerQuery &&
+ !context->getExtensions().occlusionQueryBoolean && !context->getExtensions().syncQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
+}
+
+bool ValidateGetQueryObjectuivRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ if (!context->getExtensions().disjointTimerQuery &&
+ !context->getExtensions().occlusionQueryBoolean && !context->getExtensions().syncQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetQueryObjecti64vEXT(Context *context, GLuint id, GLenum pname, GLint64 *params)
+{
+ if (!context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
+}
+
+bool ValidateGetQueryObjecti64vRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ if (!context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetQueryObjectui64vEXT(Context *context, GLuint id, GLenum pname, GLuint64 *params)
+{
+ if (!context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
+}
+
+bool ValidateGetQueryObjectui64vRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params)
+{
+ if (!context->getExtensions().disjointTimerQuery)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateUniformCommonBase(Context *context,
+ Program *program,
+ GLint location,
+ GLsizei count,
+ const LinkedUniform **uniformOut)
+{
+ // TODO(Jiajia): Add image uniform check in future.
+ if (count < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+
+ if (!program)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidProgramName);
+ return false;
+ }
+
+ if (!program->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ if (location == -1)
+ {
+ // Silently ignore the uniform command
+ return false;
+ }
+
+ const auto &uniformLocations = program->getUniformLocations();
+ size_t castedLocation = static_cast<size_t>(location);
+ if (castedLocation >= uniformLocations.size())
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidUniformLocation);
+ return false;
+ }
+
+ const auto &uniformLocation = uniformLocations[castedLocation];
+ if (uniformLocation.ignored)
+ {
+ // Silently ignore the uniform command
+ return false;
+ }
+
+ if (!uniformLocation.used())
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidUniformLocation);
+ return false;
+ }
+
+ const auto &uniform = program->getUniformByIndex(uniformLocation.index);
+
+ // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+ if (count > 1 && !uniform.isArray())
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidUniformCount);
+ return false;
+ }
+
+ *uniformOut = &uniform;
+ return true;
+}
+
+bool ValidateUniform1ivValue(Context *context,
+ GLenum uniformType,
+ GLsizei count,
+ const GLint *value)
+{
+ // Value type is GL_INT, because we only get here from glUniform1i{v}.
+ // It is compatible with INT or BOOL.
+ // Do these cheap tests first, for a little extra speed.
+ if (GL_INT == uniformType || GL_BOOL == uniformType)
+ {
+ return true;
+ }
+
+ if (IsSamplerType(uniformType))
+ {
+ // Check that the values are in range.
+ const GLint max = context->getCaps().maxCombinedTextureImageUnits;
+ for (GLsizei i = 0; i < count; ++i)
+ {
+ if (value[i] < 0 || value[i] >= max)
+ {
+ context->validationError(GL_INVALID_VALUE, kSamplerUniformValueOutOfRange);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ context->validationError(GL_INVALID_OPERATION, kUniformTypeMismatch);
+ return false;
+}
+
+bool ValidateUniformMatrixValue(Context *context, GLenum valueType, GLenum uniformType)
+{
+ // Check that the value type is compatible with uniform type.
+ if (valueType == uniformType)
+ {
+ return true;
+ }
+
+ context->validationError(GL_INVALID_OPERATION, kUniformTypeMismatch);
+ return false;
+}
+
+bool ValidateUniform(Context *context, GLenum valueType, GLint location, GLsizei count)
+{
+ const LinkedUniform *uniform = nullptr;
+ Program *programObject = context->getState().getLinkedProgram(context);
+ return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
+ ValidateUniformValue(context, valueType, uniform->type);
+}
+
+bool ValidateUniform1iv(Context *context, GLint location, GLsizei count, const GLint *value)
+{
+ const LinkedUniform *uniform = nullptr;
+ Program *programObject = context->getState().getLinkedProgram(context);
+ return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
+ ValidateUniform1ivValue(context, uniform->type, count, value);
+}
+
+bool ValidateUniformMatrix(Context *context,
+ GLenum valueType,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose)
+{
+ if (ConvertToBool(transpose) && context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_VALUE, kES3Required);
+ return false;
+ }
+
+ const LinkedUniform *uniform = nullptr;
+ Program *programObject = context->getState().getLinkedProgram(context);
+ return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
+ ValidateUniformMatrixValue(context, valueType, uniform->type);
+}
+
+bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams)
+{
+ if (!context->getQueryParameterInfo(pname, nativeType, numParams))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+
+ if (pname >= GL_DRAW_BUFFER0 && pname <= GL_DRAW_BUFFER15)
+ {
+ unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0);
+
+ if (colorAttachment >= caps.maxDrawBuffers)
+ {
+ context->validationError(GL_INVALID_OPERATION, kIndexExceedsMaxDrawBuffer);
+ return false;
+ }
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_BINDING_2D:
+ case GL_TEXTURE_BINDING_CUBE_MAP:
+ case GL_TEXTURE_BINDING_3D:
+ case GL_TEXTURE_BINDING_2D_ARRAY:
+ case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
+ break;
+ case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY:
+ if (!context->getExtensions().textureStorageMultisample2DArray)
+ {
+ context->validationError(GL_INVALID_ENUM, kMultisampleArrayExtensionRequired);
+ return false;
+ }
+ break;
+ case GL_TEXTURE_BINDING_RECTANGLE_ANGLE:
+ if (!context->getExtensions().textureRectangle)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_TEXTURE_BINDING_EXTERNAL_OES:
+ if (!context->getExtensions().eglStreamConsumerExternal &&
+ !context->getExtensions().eglImageExternal)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+ {
+ Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
+ ASSERT(readFramebuffer);
+
+ if (!ValidateFramebufferComplete<GL_INVALID_OPERATION>(context, readFramebuffer))
+ {
+ return false;
+ }
+
+ if (readFramebuffer->getReadBufferState() == GL_NONE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kReadBufferNone);
+ return false;
+ }
+
+ const FramebufferAttachment *attachment = readFramebuffer->getReadColorAttachment();
+ if (!attachment)
+ {
+ context->validationError(GL_INVALID_OPERATION, kReadBufferNotAttached);
+ return false;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ // pname is valid, but there are no parameters to return
+ if (*numParams == 0)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetBooleanvRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+
+ if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetFloatvRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+
+ if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetIntegervRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+
+ if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetInteger64vRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+
+ if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
+ {
+ return false;
+ }
+
+ if (nativeType == GL_INT_64_ANGLEX)
+ {
+ CastStateValues(context, nativeType, pname, numParams, data);
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+ return true;
+}
+
+bool ValidateRobustStateQuery(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLenum *nativeType,
+ unsigned int *numParams)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ if (!ValidateStateQuery(context, pname, nativeType, numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, *numParams))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCopyTexImageParametersBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ Format *textureFormatOut)
+{
+ TextureType texType = TextureTargetToType(target);
+
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (width < 0 || height < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ std::numeric_limits<GLsizei>::max() - yoffset < height)
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
+ return false;
+ }
+
+ if (border != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBorder);
+ return false;
+ }
+
+ if (!ValidMipLevel(context, texType, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ const State &state = context->getState();
+ Framebuffer *readFramebuffer = state.getReadFramebuffer();
+ if (!ValidateFramebufferComplete(context, readFramebuffer))
+ {
+ return false;
+ }
+
+ if (readFramebuffer->id() != 0 && !ValidateFramebufferNotMultisampled(context, readFramebuffer))
+ {
+ return false;
+ }
+
+ if (readFramebuffer->getReadBufferState() == GL_NONE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kReadBufferNone);
+ return false;
+ }
+
+ // WebGL 1.0 [Section 6.26] Reading From a Missing Attachment
+ // In OpenGL ES it is undefined what happens when an operation tries to read from a missing
+ // attachment and WebGL defines it to be an error. We do the check unconditionally as the
+ // situation is an application error that would lead to a crash in ANGLE.
+ const FramebufferAttachment *source = readFramebuffer->getReadColorAttachment();
+ if (source == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMissingReadAttachment);
+ return false;
+ }
+
+ // ANGLE_multiview spec, Revision 1:
+ // Calling CopyTexSubImage3D, CopyTexImage2D, or CopyTexSubImage2D will result in an
+ // INVALID_FRAMEBUFFER_OPERATION error if the multi-view layout of the current read framebuffer
+ // is FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE or the number of views in the current read
+ // framebuffer is more than one.
+ if (readFramebuffer->readDisallowedByMultiview())
+ {
+ context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, kMultiviewReadFramebuffer);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+
+ GLuint maxDimension = 0;
+ switch (texType)
+ {
+ case TextureType::_2D:
+ maxDimension = caps.max2DTextureSize;
+ break;
+
+ case TextureType::CubeMap:
+ maxDimension = caps.maxCubeMapTextureSize;
+ break;
+
+ case TextureType::Rectangle:
+ maxDimension = caps.maxRectangleTextureSize;
+ break;
+
+ case TextureType::_2DArray:
+ maxDimension = caps.max2DTextureSize;
+ break;
+
+ case TextureType::_3D:
+ maxDimension = caps.max3DTextureSize;
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ Texture *texture = state.getTargetTexture(texType);
+ if (!texture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureNotBound);
+ return false;
+ }
+
+ if (texture->getImmutableFormat() && !isSubImage)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureIsImmutable);
+ return false;
+ }
+
+ const InternalFormat &formatInfo =
+ isSubImage ? *texture->getFormat(target, level).info
+ : GetInternalFormatInfo(internalformat, GL_UNSIGNED_BYTE);
+
+ if (formatInfo.depthBits > 0 || formatInfo.compressed)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+
+ if (isSubImage)
+ {
+ if (static_cast<size_t>(xoffset + width) > texture->getWidth(target, level) ||
+ static_cast<size_t>(yoffset + height) > texture->getHeight(target, level) ||
+ static_cast<size_t>(zoffset) >= texture->getDepth(target, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
+ return false;
+ }
+ }
+ else
+ {
+ if (texType == TextureType::CubeMap && width != height)
+ {
+ context->validationError(GL_INVALID_VALUE, kCubemapIncomplete);
+ return false;
+ }
+
+ if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ int maxLevelDimension = (maxDimension >> level);
+ if (static_cast<int>(width) > maxLevelDimension ||
+ static_cast<int>(height) > maxLevelDimension)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ }
+
+ if (textureFormatOut)
+ {
+ *textureFormatOut = texture->getFormat(target, level);
+ }
+
+ // Detect texture copying feedback loops for WebGL.
+ if (context->getExtensions().webglCompatibility)
+ {
+ if (readFramebuffer->formsCopyingFeedbackLoopWith(texture->id(), level, zoffset))
+ {
+ context->validationError(GL_INVALID_OPERATION, kFeedbackLoop);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// Note all errors returned from this function are INVALID_OPERATION except for the draw framebuffer
+// completeness check.
+const char *ValidateDrawStates(Context *context)
+{
+ const Extensions &extensions = context->getExtensions();
+ const State &state = context->getState();
+
+ // WebGL buffers cannot be mapped/unmapped because the MapBufferRange, FlushMappedBufferRange,
+ // and UnmapBuffer entry points are removed from the WebGL 2.0 API.
+ // https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14
+ VertexArray *vertexArray = state.getVertexArray();
+ ASSERT(vertexArray);
+
+ if (!extensions.webglCompatibility && vertexArray->hasMappedEnabledArrayBuffer())
+ {
+ return kBufferMapped;
+ }
+
+ // Note: these separate values are not supported in WebGL, due to D3D's limitations. See
+ // Section 6.10 of the WebGL 1.0 spec.
+ Framebuffer *framebuffer = state.getDrawFramebuffer();
+ ASSERT(framebuffer);
+
+ if (context->getLimitations().noSeparateStencilRefsAndMasks || extensions.webglCompatibility)
+ {
+ ASSERT(framebuffer);
+ const FramebufferAttachment *dsAttachment =
+ framebuffer->getStencilOrDepthStencilAttachment();
+ const GLuint stencilBits = dsAttachment ? dsAttachment->getStencilSize() : 0;
+ ASSERT(stencilBits <= 8);
+
+ const DepthStencilState &depthStencilState = state.getDepthStencilState();
+ if (depthStencilState.stencilTest && stencilBits > 0)
+ {
+ GLuint maxStencilValue = (1 << stencilBits) - 1;
+
+ bool differentRefs =
+ clamp(state.getStencilRef(), 0, static_cast<GLint>(maxStencilValue)) !=
+ clamp(state.getStencilBackRef(), 0, static_cast<GLint>(maxStencilValue));
+ bool differentWritemasks = (depthStencilState.stencilWritemask & maxStencilValue) !=
+ (depthStencilState.stencilBackWritemask & maxStencilValue);
+ bool differentMasks = (depthStencilState.stencilMask & maxStencilValue) !=
+ (depthStencilState.stencilBackMask & maxStencilValue);
+
+ if (differentRefs || differentWritemasks || differentMasks)
+ {
+ if (!extensions.webglCompatibility)
+ {
+ WARN() << "This ANGLE implementation does not support separate front/back "
+ "stencil writemasks, reference values, or stencil mask values.";
+ }
+ return kStencilReferenceMaskOrMismatch;
+ }
+ }
+ }
+
+ if (!extensions.floatBlend && context->getState().isBlendEnabled() &&
+ framebuffer->hasActiveFloat32ColorAttachment())
+ {
+ return kUnsupportedFloatBlending;
+ }
+
+ if (!framebuffer->isComplete(context))
+ {
+ // Note: this error should be generated as INVALID_FRAMEBUFFER_OPERATION.
+ return kDrawFramebufferIncomplete;
+ }
+
+ if (context->getStateCache().hasAnyEnabledClientAttrib())
+ {
+ if (context->getExtensions().webglCompatibility || !state.areClientArraysEnabled())
+ {
+ // [WebGL 1.0] Section 6.5 Enabled Vertex Attributes and Range Checking
+ // If a vertex attribute is enabled as an array via enableVertexAttribArray but no
+ // buffer is bound to that attribute via bindBuffer and vertexAttribPointer, then calls
+ // to drawArrays or drawElements will generate an INVALID_OPERATION error.
+ return kVertexArrayNoBuffer;
+ }
+
+ if (state.getVertexArray()->hasEnabledNullPointerClientArray())
+ {
+ // This is an application error that would normally result in a crash, but we catch it
+ // and return an error
+ return kVertexArrayNoBufferPointer;
+ }
+ }
+
+ // If we are running GLES1, there is no current program.
+ if (context->getClientVersion() >= Version(2, 0))
+ {
+ Program *program = state.getLinkedProgram(context);
+ if (!program)
+ {
+ return kProgramNotBound;
+ }
+
+ // In OpenGL ES spec for UseProgram at section 7.3, trying to render without
+ // vertex shader stage or fragment shader stage is a undefined behaviour.
+ // But ANGLE should clearly generate an INVALID_OPERATION error instead of
+ // produce undefined result.
+ if (!program->hasLinkedShaderStage(ShaderType::Vertex) ||
+ !program->hasLinkedShaderStage(ShaderType::Fragment))
+ {
+ return kNoActiveGraphicsShaderStage;
+ }
+
+ if (!program->validateSamplers(nullptr, context->getCaps()))
+ {
+ return kTextureTypeConflict;
+ }
+
+ if (extensions.multiview || extensions.multiview2)
+ {
+ const int programNumViews = program->usesMultiview() ? program->getNumViews() : 1;
+ const int framebufferNumViews = framebuffer->getNumViews();
+ if (framebufferNumViews != programNumViews)
+ {
+ return kMultiviewMismatch;
+ }
+
+ if (state.isTransformFeedbackActiveUnpaused() && framebufferNumViews > 1)
+ {
+ return kMultiviewTransformFeedback;
+ }
+
+ if (extensions.disjointTimerQuery && framebufferNumViews > 1 &&
+ state.isQueryActive(QueryType::TimeElapsed))
+ {
+ return kMultiviewTimerQuery;
+ }
+ }
+
+ // Uniform buffer validation
+ for (unsigned int uniformBlockIndex = 0;
+ uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++)
+ {
+ const InterfaceBlock &uniformBlock = program->getUniformBlockByIndex(uniformBlockIndex);
+ GLuint blockBinding = program->getUniformBlockBinding(uniformBlockIndex);
+ const OffsetBindingPointer<Buffer> &uniformBuffer =
+ state.getIndexedUniformBuffer(blockBinding);
+
+ if (uniformBuffer.get() == nullptr)
+ {
+ // undefined behaviour
+ return kUniformBufferUnbound;
+ }
+
+ size_t uniformBufferSize = GetBoundBufferAvailableSize(uniformBuffer);
+ if (uniformBufferSize < uniformBlock.dataSize)
+ {
+ // undefined behaviour
+ return kUniformBufferTooSmall;
+ }
+
+ if (extensions.webglCompatibility &&
+ uniformBuffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ return kUniformBufferBoundForTransformFeedback;
+ }
+ }
+
+ // Do some additonal WebGL-specific validation
+ if (extensions.webglCompatibility)
+ {
+ if (!state.validateSamplerFormats())
+ {
+ return kSamplerFormatMismatch;
+ }
+
+ const TransformFeedback *transformFeedbackObject = state.getCurrentTransformFeedback();
+ if (state.isTransformFeedbackActive() &&
+ transformFeedbackObject->buffersBoundForOtherUse())
+ {
+ return kTransformFeedbackBufferDoubleBound;
+ }
+
+ // Detect rendering feedback loops for WebGL.
+ if (framebuffer->formsRenderingFeedbackLoopWith(context))
+ {
+ return kFeedbackLoop;
+ }
+
+ // Detect that the vertex shader input types match the attribute types
+ if (!ValidateVertexShaderAttributeTypeMatch(context))
+ {
+ return kVertexShaderTypeMismatch;
+ }
+
+ if (!context->getState().getRasterizerState().rasterizerDiscard &&
+ !context->getState().getBlendState().allChannelsMasked())
+ {
+ // Detect that if there's active color buffer without fragment shader output
+ if (!ValidateFragmentShaderColorBufferMaskMatch(context))
+ {
+ return kDrawBufferMaskMismatch;
+ }
+
+ // Detect that the color buffer types match the fragment shader output types
+ if (!ValidateFragmentShaderColorBufferTypeMatch(context))
+ {
+ return kDrawBufferTypeMismatch;
+ }
+ }
+
+ const VertexArray *vao = context->getState().getVertexArray();
+ if (vao->hasTransformFeedbackBindingConflict(context))
+ {
+ return kVertexBufferBoundForTransformFeedback;
+ }
+ }
+ }
+
+ return nullptr;
+}
+
+void RecordDrawModeError(Context *context, PrimitiveMode mode)
+{
+ const State &state = context->getState();
+ TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
+ if (state.isTransformFeedbackActiveUnpaused())
+ {
+ if (!ValidateTransformFeedbackPrimitiveMode(context,
+ curTransformFeedback->getPrimitiveMode(), mode))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidDrawModeTransformFeedback);
+ return;
+ }
+ }
+
+ const Extensions &extensions = context->getExtensions();
+
+ switch (mode)
+ {
+ case PrimitiveMode::Points:
+ case PrimitiveMode::Lines:
+ case PrimitiveMode::LineLoop:
+ case PrimitiveMode::LineStrip:
+ case PrimitiveMode::Triangles:
+ case PrimitiveMode::TriangleStrip:
+ case PrimitiveMode::TriangleFan:
+ break;
+
+ case PrimitiveMode::LinesAdjacency:
+ case PrimitiveMode::LineStripAdjacency:
+ case PrimitiveMode::TrianglesAdjacency:
+ case PrimitiveMode::TriangleStripAdjacency:
+ if (!extensions.geometryShader)
+ {
+ context->validationError(GL_INVALID_ENUM, kGeometryShaderExtensionNotEnabled);
+ return;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidDrawMode);
+ return;
+ }
+
+ // If we are running GLES1, there is no current program.
+ if (context->getClientVersion() >= Version(2, 0))
+ {
+ Program *program = state.getLinkedProgram(context);
+ ASSERT(program);
+
+ // Do geometry shader specific validations
+ if (program->hasLinkedShaderStage(ShaderType::Geometry))
+ {
+ if (!IsCompatibleDrawModeWithGeometryShader(
+ mode, program->getGeometryShaderInputPrimitiveType()))
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kIncompatibleDrawModeAgainstGeometryShader);
+ return;
+ }
+ }
+ }
+
+ // An error should be recorded.
+ UNREACHABLE();
+}
+
+bool ValidateDrawArraysInstancedANGLE(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ if (!context->getExtensions().instancedArraysANGLE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateDrawArraysInstancedBase(context, mode, first, count, primcount))
+ {
+ return false;
+ }
+
+ return ValidateDrawInstancedANGLE(context);
+}
+
+bool ValidateDrawArraysInstancedEXT(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ if (!context->getExtensions().instancedArraysEXT)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateDrawArraysInstancedBase(context, mode, first, count, primcount))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+const char *ValidateDrawElementsStates(Context *context)
+{
+ const State &state = context->getState();
+
+ if (context->getStateCache().isTransformFeedbackActiveUnpaused())
+ {
+ // EXT_geometry_shader allows transform feedback to work with all draw commands.
+ // [EXT_geometry_shader] Section 12.1, "Transform Feedback"
+ if (!context->getExtensions().geometryShader)
+ {
+ // 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 kUnsupportedDrawModeForTransformFeedback;
+ }
+ }
+
+ const VertexArray *vao = state.getVertexArray();
+ Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
+
+ if (elementArrayBuffer)
+ {
+ if (context->getExtensions().webglCompatibility)
+ {
+ if (elementArrayBuffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ return kElementArrayBufferBoundForTransformFeedback;
+ }
+ }
+ else if (elementArrayBuffer->isMapped())
+ {
+ // WebGL buffers cannot be mapped/unmapped because the MapBufferRange,
+ // FlushMappedBufferRange, and UnmapBuffer entry points are removed from the
+ // WebGL 2.0 API. https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14
+ return kBufferMapped;
+ }
+ }
+ else
+ {
+ // [WebGL 1.0] Section 6.2 No Client Side Arrays
+ // If an indexed draw command (drawElements) is called and no WebGLBuffer is bound to
+ // the ELEMENT_ARRAY_BUFFER binding point, an INVALID_OPERATION error is generated.
+ if (!context->getState().areClientArraysEnabled() ||
+ context->getExtensions().webglCompatibility)
+ {
+ return kMustHaveElementArrayBinding;
+ }
+ }
+
+ return nullptr;
+}
+
+bool ValidateDrawElementsInstancedANGLE(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei primcount)
+{
+ if (!context->getExtensions().instancedArraysANGLE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount))
+ {
+ return false;
+ }
+
+ return ValidateDrawInstancedANGLE(context);
+}
+
+bool ValidateDrawElementsInstancedEXT(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei primcount)
+{
+ if (!context->getExtensions().instancedArraysEXT)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateDrawElementsInstancedBase(context, mode, count, type, indices, primcount))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFramebufferTextureBase(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ if (!ValidateAttachmentTarget(context, attachment))
+ {
+ return false;
+ }
+
+ if (texture != 0)
+ {
+ Texture *tex = context->getTexture(texture);
+
+ if (tex == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMissingTexture);
+ return false;
+ }
+
+ if (level < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+ }
+
+ const Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (framebuffer->id() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultFramebufferTarget);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetUniformBase(Context *context, GLuint program, GLint location)
+{
+ if (program == 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kProgramDoesNotExist);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (!programObject || !programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ if (!programObject->isValidUniformLocation(location))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidUniformLocation);
+ return false;
+ }
+
+ return true;
+}
+
+static bool ValidateSizedGetUniform(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (!ValidateGetUniformBase(context, program, location))
+ {
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Program *programObject = context->getProgramResolveLink(program);
+ ASSERT(programObject);
+
+ // sized queries -- ensure the provided buffer is large enough
+ const LinkedUniform &uniform = programObject->getUniformByLocation(location);
+ size_t requiredBytes = VariableExternalSize(uniform.type);
+ if (static_cast<size_t>(bufSize) < requiredBytes)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInsufficientBufferSize);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = VariableComponentCount(uniform.type);
+ }
+
+ return true;
+}
+
+bool ValidateGetnUniformfvEXT(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params)
+{
+ return ValidateSizedGetUniform(context, program, location, bufSize, nullptr);
+}
+
+bool ValidateGetnUniformfvRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetnUniformivEXT(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params)
+{
+ return ValidateSizedGetUniform(context, program, location, bufSize, nullptr);
+}
+
+bool ValidateGetnUniformivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetnUniformuivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetUniformfvRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ // bufSize is validated in ValidateSizedGetUniform
+ if (!ValidateSizedGetUniform(context, program, location, bufSize, &writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateGetUniformivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ // bufSize is validated in ValidateSizedGetUniform
+ if (!ValidateSizedGetUniform(context, program, location, bufSize, &writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateGetUniformuivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ // bufSize is validated in ValidateSizedGetUniform
+ if (!ValidateSizedGetUniform(context, program, location, bufSize, &writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateDiscardFramebufferBase(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ bool defaultFramebuffer)
+{
+ if (numAttachments < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeAttachments);
+ return false;
+ }
+
+ for (GLsizei i = 0; i < numAttachments; ++i)
+ {
+ if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT31)
+ {
+ if (defaultFramebuffer)
+ {
+ context->validationError(GL_INVALID_ENUM, kDefaultFramebufferInvalidAttachment);
+ return false;
+ }
+
+ if (attachments[i] >= GL_COLOR_ATTACHMENT0 + context->getCaps().maxColorAttachments)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExceedsMaxColorAttachments);
+ return false;
+ }
+ }
+ else
+ {
+ switch (attachments[i])
+ {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (defaultFramebuffer)
+ {
+ context->validationError(GL_INVALID_ENUM,
+ kDefaultFramebufferInvalidAttachment);
+ return false;
+ }
+ break;
+ case GL_COLOR:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (!defaultFramebuffer)
+ {
+ context->validationError(GL_INVALID_ENUM,
+ kDefaultFramebufferInvalidAttachment);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidAttachment);
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker)
+{
+ if (!context->getExtensions().debugMarker)
+ {
+ // The debug marker calls should not set error state
+ // However, it seems reasonable to set an error state if the extension is not enabled
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ // Note that debug marker calls must not set error state
+ if (length < 0)
+ {
+ return false;
+ }
+
+ if (marker == nullptr)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker)
+{
+ if (!context->getExtensions().debugMarker)
+ {
+ // The debug marker calls should not set error state
+ // However, it seems reasonable to set an error state if the extension is not enabled
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ // Note that debug marker calls must not set error state
+ if (length < 0)
+ {
+ return false;
+ }
+
+ if (length > 0 && marker == nullptr)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeglImageOES image)
+{
+ if (!context->getExtensions().eglImage && !context->getExtensions().eglImageExternal)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (type)
+ {
+ case TextureType::_2D:
+ if (!context->getExtensions().eglImage)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ }
+ break;
+
+ case TextureType::External:
+ if (!context->getExtensions().eglImageExternal)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ egl::Image *imageObject = static_cast<egl::Image *>(image);
+
+ ASSERT(context->getDisplay());
+ if (!context->getDisplay()->isValidImage(imageObject))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidEGLImage);
+ return false;
+ }
+
+ if (imageObject->getSamples() > 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kEGLImageCannotCreate2DMultisampled);
+ return false;
+ }
+
+ if (!imageObject->isTexturable(context))
+ {
+ context->validationError(GL_INVALID_OPERATION, kEGLImageTextureFormatNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
+ GLenum target,
+ GLeglImageOES image)
+{
+ if (!context->getExtensions().eglImage)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (target)
+ {
+ case GL_RENDERBUFFER:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidRenderbufferTarget);
+ return false;
+ }
+
+ egl::Image *imageObject = static_cast<egl::Image *>(image);
+
+ ASSERT(context->getDisplay());
+ if (!context->getDisplay()->isValidImage(imageObject))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidEGLImage);
+ return false;
+ }
+
+ if (!imageObject->isRenderable(context))
+ {
+ context->validationError(GL_INVALID_OPERATION, kEGLImageRenderbufferFormatNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindVertexArrayBase(Context *context, GLuint array)
+{
+ if (!context->isVertexArrayGenerated(array))
+ {
+ // The default VAO should always exist
+ ASSERT(array != 0);
+ context->validationError(GL_INVALID_OPERATION, kInvalidVertexArray);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateProgramBinaryBase(Context *context,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length)
+{
+ Program *programObject = GetValidProgram(context, program);
+ if (programObject == nullptr)
+ {
+ return false;
+ }
+
+ const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats;
+ if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) ==
+ programBinaryFormats.end())
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidProgramBinaryFormat);
+ return false;
+ }
+
+ if (context->hasActiveTransformFeedback(program))
+ {
+ // ES 3.0.4 section 2.15 page 91
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackProgramBinary);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetProgramBinaryBase(Context *context,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ Program *programObject = GetValidProgram(context, program);
+ if (programObject == nullptr)
+ {
+ return false;
+ }
+
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ if (context->getCaps().programBinaryFormats.empty())
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoProgramBinaryFormats);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs)
+{
+ // INVALID_VALUE is generated if n is negative or greater than value of MAX_DRAW_BUFFERS
+ if (n < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+ if (static_cast<GLuint>(n) > context->getCaps().maxDrawBuffers)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
+ return false;
+ }
+
+ ASSERT(context->getState().getDrawFramebuffer());
+ GLuint frameBufferId = context->getState().getDrawFramebuffer()->id();
+ GLuint maxColorAttachment = GL_COLOR_ATTACHMENT0_EXT + context->getCaps().maxColorAttachments;
+
+ // This should come first before the check for the default frame buffer
+ // because when we switch to ES3.1+, invalid enums will return INVALID_ENUM
+ // rather than INVALID_OPERATION
+ for (int colorAttachment = 0; colorAttachment < n; colorAttachment++)
+ {
+ const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment;
+
+ if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != GL_BACK &&
+ (bufs[colorAttachment] < GL_COLOR_ATTACHMENT0 ||
+ bufs[colorAttachment] > GL_COLOR_ATTACHMENT31))
+ {
+ // Value in bufs is not NONE, BACK, or GL_COLOR_ATTACHMENTi
+ // The 3.0.4 spec says to generate GL_INVALID_OPERATION here, but this
+ // was changed to GL_INVALID_ENUM in 3.1, which dEQP also expects.
+ // 3.1 is still a bit ambiguous about the error, but future specs are
+ // expected to clarify that GL_INVALID_ENUM is the correct error.
+ context->validationError(GL_INVALID_ENUM, kInvalidDrawBuffer);
+ return false;
+ }
+ else if (bufs[colorAttachment] >= maxColorAttachment)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExceedsMaxColorAttachments);
+ return false;
+ }
+ else if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment &&
+ frameBufferId != 0)
+ {
+ // INVALID_OPERATION-GL is bound to buffer and ith argument
+ // is not COLOR_ATTACHMENTi or NONE
+ context->validationError(GL_INVALID_OPERATION, kInvalidDrawBufferValue);
+ return false;
+ }
+ }
+
+ // INVALID_OPERATION is generated if GL is bound to the default framebuffer
+ // and n is not 1 or bufs is bound to value other than BACK and NONE
+ if (frameBufferId == 0)
+ {
+ if (n != 1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidDrawBufferCountForDefault);
+ return false;
+ }
+
+ if (bufs[0] != GL_NONE && bufs[0] != GL_BACK)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultFramebufferInvalidDrawBuffer);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetBufferPointervBase(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ GLsizei *length,
+ void **params)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_BUFFER_MAP_POINTER:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ // GLES 3.0 section 2.10.1: "Attempts to attempts to modify or query buffer object state for a
+ // target bound to zero generate an INVALID_OPERATION error."
+ // GLES 3.1 section 6.6 explicitly specifies this error.
+ if (context->getState().getTargetBuffer(target) == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferPointerNotAvailable);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = 1;
+ }
+
+ return true;
+}
+
+bool ValidateUnmapBufferBase(Context *context, BufferBinding target)
+{
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (buffer == nullptr || !buffer->isMapped())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferNotMapped);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateMapBufferRangeBase(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ if (offset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (length < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeLength);
+ return false;
+ }
+
+ Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferNotMappable);
+ return false;
+ }
+
+ // Check for buffer overflow
+ CheckedNumeric<size_t> checkedOffset(offset);
+ auto checkedSize = checkedOffset + length;
+
+ if (!checkedSize.IsValid() || checkedSize.ValueOrDie() > static_cast<size_t>(buffer->getSize()))
+ {
+ context->validationError(GL_INVALID_VALUE, kMapOutOfRange);
+ return false;
+ }
+
+ // 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))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidAccessBits);
+ return false;
+ }
+
+ if (length == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kLengthZero);
+ return false;
+ }
+
+ if (buffer->isMapped())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferAlreadyMapped);
+ return false;
+ }
+
+ // Check for invalid bit combinations
+ if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidAccessBitsReadWrite);
+ return false;
+ }
+
+ 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)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidAccessBitsRead);
+ return false;
+ }
+
+ if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidAccessBitsFlush);
+ return false;
+ }
+
+ return ValidateMapBufferBase(context, target);
+}
+
+bool ValidateFlushMappedBufferRangeBase(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ if (offset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (length < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeLength);
+ return false;
+ }
+
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (buffer == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFlushZero);
+ return false;
+ }
+
+ if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFlushTarget);
+ return false;
+ }
+
+ // Check for buffer overflow
+ CheckedNumeric<size_t> checkedOffset(offset);
+ auto checkedSize = checkedOffset + length;
+
+ if (!checkedSize.IsValid() ||
+ checkedSize.ValueOrDie() > static_cast<size_t>(buffer->getMapLength()))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFlushOutOfRange);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGenOrDelete(Context *context, GLint n)
+{
+ if (n < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateRobustEntryPoint(Context *context, GLsizei bufSize)
+{
+ if (!context->getExtensions().robustClientMemory)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateRobustBufferSize(Context *context, GLsizei bufSize, GLsizei numParams)
+{
+ if (bufSize < numParams)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInsufficientParams);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetFramebufferAttachmentParameterivBase(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei *numParams)
+{
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ int clientVersion = context->getClientMajorVersion();
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR:
+ if (clientVersion < 3 ||
+ !(context->getExtensions().multiview || context->getExtensions().multiview2))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ if (clientVersion < 3 && !context->getExtensions().sRGB)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (clientVersion < 3)
+ {
+ context->validationError(GL_INVALID_ENUM, kES3Required);
+ return false;
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT:
+ if (!context->getExtensions().geometryShader)
+ {
+ context->validationError(GL_INVALID_ENUM, kGeometryShaderExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ // Determine if the attachment is a valid enum
+ switch (attachment)
+ {
+ case GL_BACK:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (clientVersion < 3)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidAttachment);
+ return false;
+ }
+ break;
+
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (clientVersion < 3 && !context->isWebGL1())
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidAttachment);
+ return false;
+ }
+ break;
+
+ case GL_COLOR_ATTACHMENT0:
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+
+ default:
+ if ((clientVersion < 3 && !context->getExtensions().drawBuffers) ||
+ attachment < GL_COLOR_ATTACHMENT0_EXT ||
+ (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidAttachment);
+ return false;
+ }
+ break;
+ }
+
+ const Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (framebuffer->id() == 0)
+ {
+ if (clientVersion < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultFramebufferTarget);
+ return false;
+ }
+
+ switch (attachment)
+ {
+ case GL_BACK:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_OPERATION, kInvalidAttachment);
+ return false;
+ }
+ }
+ else
+ {
+ if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT)
+ {
+ // Valid attachment query
+ }
+ else
+ {
+ switch (attachment)
+ {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+
+ case GL_DEPTH_STENCIL_ATTACHMENT:
+ if (!framebuffer->hasValidDepthStencil() && !context->isWebGL1())
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidAttachment);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_OPERATION, kInvalidAttachment);
+ return false;
+ }
+ }
+ }
+
+ const FramebufferAttachment *attachmentObject = framebuffer->getAttachment(context, attachment);
+ if (attachmentObject)
+ {
+ ASSERT(attachmentObject->type() == GL_RENDERBUFFER ||
+ attachmentObject->type() == GL_TEXTURE ||
+ attachmentObject->type() == GL_FRAMEBUFFER_DEFAULT);
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (attachmentObject->type() != GL_RENDERBUFFER &&
+ attachmentObject->type() != GL_TEXTURE)
+ {
+ context->validationError(GL_INVALID_ENUM, kFramebufferIncompleteAttachment);
+ return false;
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ if (attachmentObject->type() != GL_TEXTURE)
+ {
+ context->validationError(GL_INVALID_ENUM, kFramebufferIncompleteAttachment);
+ return false;
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ if (attachmentObject->type() != GL_TEXTURE)
+ {
+ context->validationError(GL_INVALID_ENUM, kFramebufferIncompleteAttachment);
+ return false;
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ if (attachment == GL_DEPTH_STENCIL_ATTACHMENT)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidAttachment);
+ return false;
+ }
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (attachmentObject->type() != GL_TEXTURE)
+ {
+ context->validationError(GL_INVALID_ENUM, kFramebufferIncompleteAttachment);
+ return false;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
+ // is NONE, then querying any other pname will generate INVALID_ENUM.
+
+ // ES 3.0.2 spec pg 235 states that if the attachment type is none,
+ // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
+ // INVALID_OPERATION for all other pnames
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ break;
+
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ if (clientVersion < 3)
+ {
+ context->validationError(GL_INVALID_ENUM,
+ kInvalidFramebufferAttachmentParameter);
+ return false;
+ }
+ break;
+
+ default:
+ if (clientVersion < 3)
+ {
+ context->validationError(GL_INVALID_ENUM,
+ kInvalidFramebufferAttachmentParameter);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kInvalidFramebufferAttachmentParameter);
+ return false;
+ }
+ }
+ }
+
+ if (numParams)
+ {
+ *numParams = 1;
+ }
+
+ return true;
+}
+
+bool ValidateGetFramebufferAttachmentParameterivRobustANGLE(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+ if (!ValidateGetFramebufferAttachmentParameterivBase(context, target, attachment, pname,
+ &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetBufferParameterivRobustANGLE(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetBufferParameterBase(context, target, pname, false, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+ return true;
+}
+
+bool ValidateGetBufferParameteri64vRobustANGLE(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ GLsizei numParams = 0;
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ if (!ValidateGetBufferParameterBase(context, target, pname, false, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GLsizei *numParams)
+{
+ // Currently, all GetProgramiv queries return 1 parameter
+ if (numParams)
+ {
+ *numParams = 1;
+ }
+
+ if (context->isContextLost())
+ {
+ context->validationError(GL_CONTEXT_LOST, kContextLost);
+
+ if (context->getExtensions().parallelShaderCompile && pname == GL_COMPLETION_STATUS_KHR)
+ {
+ // Generate an error but still return true, the context still needs to return a
+ // value in this case.
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ // Special case for GL_COMPLETION_STATUS_KHR: don't resolve the link. Otherwise resolve it now.
+ Program *programObject = (pname == GL_COMPLETION_STATUS_KHR)
+ ? GetValidProgramNoResolve(context, program)
+ : GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_DELETE_STATUS:
+ case GL_LINK_STATUS:
+ case GL_VALIDATE_STATUS:
+ case GL_INFO_LOG_LENGTH:
+ case GL_ATTACHED_SHADERS:
+ case GL_ACTIVE_ATTRIBUTES:
+ case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ case GL_ACTIVE_UNIFORMS:
+ case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+ break;
+
+ case GL_PROGRAM_BINARY_LENGTH:
+ if (context->getClientMajorVersion() < 3 && !context->getExtensions().getProgramBinary)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ 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:
+ case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
+ return false;
+ }
+ break;
+
+ case GL_PROGRAM_SEPARABLE:
+ case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS:
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ break;
+
+ case GL_COMPUTE_WORK_GROUP_SIZE:
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+
+ // [OpenGL ES 3.1] Chapter 7.12 Page 122
+ // An INVALID_OPERATION error is generated if COMPUTE_WORK_GROUP_SIZE is queried for a
+ // program which has not been linked successfully, or which does not contain objects to
+ // form a compute shader.
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+ if (!programObject->hasLinkedShaderStage(ShaderType::Compute))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoActiveComputeShaderStage);
+ return false;
+ }
+ break;
+
+ case GL_GEOMETRY_LINKED_INPUT_TYPE_EXT:
+ case GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT:
+ case GL_GEOMETRY_LINKED_VERTICES_OUT_EXT:
+ case GL_GEOMETRY_SHADER_INVOCATIONS_EXT:
+ if (!context->getExtensions().geometryShader)
+ {
+ context->validationError(GL_INVALID_ENUM, kGeometryShaderExtensionNotEnabled);
+ return false;
+ }
+
+ // [EXT_geometry_shader] Chapter 7.12
+ // An INVALID_OPERATION error is generated if GEOMETRY_LINKED_VERTICES_OUT_EXT,
+ // GEOMETRY_LINKED_INPUT_TYPE_EXT, GEOMETRY_LINKED_OUTPUT_TYPE_EXT, or
+ // GEOMETRY_SHADER_INVOCATIONS_EXT are queried for a program which has not been linked
+ // successfully, or which does not contain objects to form a geometry shader.
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+ if (!programObject->hasLinkedShaderStage(ShaderType::Geometry))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoActiveGeometryShaderStage);
+ return false;
+ }
+ break;
+
+ case GL_COMPLETION_STATUS_KHR:
+ if (!context->getExtensions().parallelShaderCompile)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetProgramivRobustANGLE(Context *context,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetProgramivBase(context, program, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetRenderbufferParameterivRobustANGLE(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetRenderbufferParameterivBase(context, target, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetShaderivRobustANGLE(Context *context,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetShaderivBase(context, shader, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetTexParameterfvRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetTexParameterBase(context, target, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetTexParameterivRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+ GLsizei numParams = 0;
+ if (!ValidateGetTexParameterBase(context, target, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+ return true;
+}
+
+bool ValidateGetTexParameterIivRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetTexParameterIuivRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateTexParameterfvRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ return ValidateTexParameterBase(context, target, pname, bufSize, true, params);
+}
+
+bool ValidateTexParameterivRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ return ValidateTexParameterBase(context, target, pname, bufSize, true, params);
+}
+
+bool ValidateTexParameterIivRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateTexParameterIuivRobustANGLE(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetSamplerParameterBase(context, sampler, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+ return true;
+}
+
+bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetSamplerParameterBase(context, sampler, pname, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+ return true;
+}
+
+bool ValidateGetSamplerParameterIivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetSamplerParameterIuivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateSamplerParameterfvRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ return ValidateSamplerParameterBase(context, sampler, pname, bufSize, true, params);
+}
+
+bool ValidateSamplerParameterivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ return ValidateSamplerParameterBase(context, sampler, pname, bufSize, true, params);
+}
+
+bool ValidateSamplerParameterIivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateSamplerParameterIuivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetVertexAttribfvRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, false))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+ return true;
+}
+
+bool ValidateGetVertexAttribivRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, false))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateGetVertexAttribPointervRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, true, false))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateGetVertexAttribIivRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, true))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateGetVertexAttribIuivRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, true))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateGetActiveUniformBlockivRobustANGLE(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei writeLength = 0;
+
+ if (!ValidateGetActiveUniformBlockivBase(context, program, uniformBlockIndex, pname,
+ &writeLength))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, writeLength))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, writeLength);
+
+ return true;
+}
+
+bool ValidateGetInternalformativRobustANGLE(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateGetInternalFormativBase(context, target, internalformat, pname, bufSize,
+ &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+// Perform validation from WebGL 2 section 5.10 "Invalid Clears":
+// In the WebGL 2 API, trying to perform a clear when there is a mismatch between the type of the
+// specified clear value and the type of a buffer that is being cleared generates an
+// INVALID_OPERATION error instead of producing undefined results
+bool ValidateWebGLFramebufferAttachmentClearType(Context *context,
+ GLint drawbuffer,
+ const GLenum *validComponentTypes,
+ size_t validComponentTypeCount)
+{
+ const FramebufferAttachment *attachment =
+ context->getState().getDrawFramebuffer()->getDrawBuffer(drawbuffer);
+ if (attachment)
+ {
+ GLenum componentType = attachment->getFormat().info->componentType;
+ const GLenum *end = validComponentTypes + validComponentTypeCount;
+ if (std::find(validComponentTypes, end, componentType) == end)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoDefinedClearConversion);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateRobustCompressedTexImageBase(Context *context, GLsizei imageSize, GLsizei dataSize)
+{
+ if (!ValidateRobustEntryPoint(context, dataSize))
+ {
+ return false;
+ }
+
+ Buffer *pixelUnpackBuffer = context->getState().getTargetBuffer(BufferBinding::PixelUnpack);
+ if (pixelUnpackBuffer == nullptr)
+ {
+ if (dataSize < imageSize)
+ {
+ context->validationError(GL_INVALID_OPERATION, kCompressedDataSizeTooSmall);
+ }
+ }
+ return true;
+}
+
+bool ValidateGetBufferParameterBase(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ bool pointerVersion,
+ GLsizei *numParams)
+{
+ if (numParams)
+ {
+ *numParams = 0;
+ }
+
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ const Buffer *buffer = context->getState().getTargetBuffer(target);
+ if (!buffer)
+ {
+ // A null buffer means that "0" is bound to the requested buffer target
+ context->validationError(GL_INVALID_OPERATION, kBufferNotBound);
+ return false;
+ }
+
+ const Extensions &extensions = context->getExtensions();
+
+ switch (pname)
+ {
+ case GL_BUFFER_USAGE:
+ case GL_BUFFER_SIZE:
+ break;
+
+ case GL_BUFFER_ACCESS_OES:
+ if (!extensions.mapBuffer)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_BUFFER_MAPPED:
+ static_assert(GL_BUFFER_MAPPED == GL_BUFFER_MAPPED_OES, "GL enums should be equal.");
+ if (context->getClientMajorVersion() < 3 && !extensions.mapBuffer &&
+ !extensions.mapBufferRange)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_BUFFER_MAP_POINTER:
+ if (!pointerVersion)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidMapPointerQuery);
+ return false;
+ }
+ break;
+
+ case GL_BUFFER_ACCESS_FLAGS:
+ case GL_BUFFER_MAP_OFFSET:
+ case GL_BUFFER_MAP_LENGTH:
+ if (context->getClientMajorVersion() < 3 && !extensions.mapBufferRange)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_MEMORY_SIZE_ANGLE:
+ if (!context->getExtensions().memorySize)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ // All buffer parameter queries return one value.
+ if (numParams)
+ {
+ *numParams = 1;
+ }
+
+ return true;
+}
+
+bool ValidateGetRenderbufferParameterivBase(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLsizei *length)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (target != GL_RENDERBUFFER)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidRenderbufferTarget);
+ return false;
+ }
+
+ Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer();
+ if (renderbuffer == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kRenderbufferNotBound);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_RENDERBUFFER_WIDTH:
+ case GL_RENDERBUFFER_HEIGHT:
+ case GL_RENDERBUFFER_INTERNAL_FORMAT:
+ case GL_RENDERBUFFER_RED_SIZE:
+ case GL_RENDERBUFFER_GREEN_SIZE:
+ case GL_RENDERBUFFER_BLUE_SIZE:
+ case GL_RENDERBUFFER_ALPHA_SIZE:
+ case GL_RENDERBUFFER_DEPTH_SIZE:
+ case GL_RENDERBUFFER_STENCIL_SIZE:
+ break;
+
+ case GL_RENDERBUFFER_SAMPLES_ANGLE:
+ if (!context->getExtensions().framebufferMultisample)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ case GL_MEMORY_SIZE_ANGLE:
+ if (!context->getExtensions().memorySize)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = 1;
+ }
+ return true;
+}
+
+bool ValidateGetShaderivBase(Context *context, GLuint shader, GLenum pname, GLsizei *length)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (context->isContextLost())
+ {
+ context->validationError(GL_CONTEXT_LOST, kContextLost);
+
+ if (context->getExtensions().parallelShaderCompile && pname == GL_COMPLETION_STATUS_KHR)
+ {
+ // Generate an error but still return true, the context still needs to return a
+ // value in this case.
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if (GetValidShader(context, shader) == nullptr)
+ {
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_SHADER_TYPE:
+ case GL_DELETE_STATUS:
+ case GL_COMPILE_STATUS:
+ case GL_INFO_LOG_LENGTH:
+ case GL_SHADER_SOURCE_LENGTH:
+ break;
+
+ case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
+ if (!context->getExtensions().translatedShaderSource)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ case GL_COMPLETION_STATUS_KHR:
+ if (!context->getExtensions().parallelShaderCompile)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = 1;
+ }
+ return true;
+}
+
+bool ValidateGetTexParameterBase(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei *length)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (!ValidTextureTarget(context, target) && !ValidTextureExternalTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ if (context->getTextureByType(target) == nullptr)
+ {
+ // Should only be possible for external textures
+ context->validationError(GL_INVALID_ENUM, kTextureNotBound);
+ return false;
+ }
+
+ if (context->getClientMajorVersion() == 1 && !IsValidGLES1TextureParameter(pname))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ break;
+
+ case GL_TEXTURE_USAGE_ANGLE:
+ if (!context->getExtensions().textureUsage)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (!ValidateTextureMaxAnisotropyExtensionEnabled(context))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ if (context->getClientMajorVersion() < 3 && !context->getExtensions().textureStorage)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ case GL_TEXTURE_SWIZZLE_R:
+ case GL_TEXTURE_SWIZZLE_G:
+ case GL_TEXTURE_SWIZZLE_B:
+ case GL_TEXTURE_SWIZZLE_A:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!context->getExtensions().textureSRGBDecode)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ break;
+
+ case GL_GENERATE_MIPMAP:
+ case GL_TEXTURE_CROP_RECT_OES:
+ // TODO(lfy@google.com): Restrict to GL_OES_draw_texture
+ // after GL_OES_draw_texture functionality implemented
+ if (context->getClientMajorVersion() > 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kGLES1Only);
+ return false;
+ }
+ break;
+
+ case GL_MEMORY_SIZE_ANGLE:
+ if (!context->getExtensions().memorySize)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_BORDER_COLOR:
+ if (!context->getExtensions().textureBorderClamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_NATIVE_ID_ANGLE:
+ if (!context->getExtensions().textureExternalUpdateANGLE)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = GetTexParameterCount(pname);
+ }
+ return true;
+}
+
+bool ValidateGetVertexAttribBase(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei *length,
+ bool pointer,
+ bool pureIntegerEntryPoint)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (pureIntegerEntryPoint && context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (index >= context->getCaps().maxVertexAttributes)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ if (pointer)
+ {
+ if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ }
+ else
+ {
+ switch (pname)
+ {
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ case GL_CURRENT_VERTEX_ATTRIB:
+ break;
+
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+ static_assert(
+ GL_VERTEX_ATTRIB_ARRAY_DIVISOR == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE,
+ "ANGLE extension enums not equal to GL enums.");
+ if (context->getClientMajorVersion() < 3 &&
+ !context->getExtensions().instancedArraysAny())
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_VERTEX_ATTRIB_BINDING:
+ case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ }
+
+ if (length)
+ {
+ if (pname == GL_CURRENT_VERTEX_ATTRIB)
+ {
+ *length = 4;
+ }
+ else
+ {
+ *length = 1;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateReadPixelsBase(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels)
+{
+ if (length != nullptr)
+ {
+ *length = 0;
+ }
+ if (rows != nullptr)
+ {
+ *rows = 0;
+ }
+ if (columns != nullptr)
+ {
+ *columns = 0;
+ }
+
+ if (width < 0 || height < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
+
+ if (!ValidateFramebufferComplete(context, readFramebuffer))
+ {
+ return false;
+ }
+
+ if (readFramebuffer->id() != 0 && !ValidateFramebufferNotMultisampled(context, readFramebuffer))
+ {
+ return false;
+ }
+
+ Framebuffer *framebuffer = context->getState().getReadFramebuffer();
+ ASSERT(framebuffer);
+
+ if (framebuffer->getReadBufferState() == GL_NONE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kReadBufferNone);
+ return false;
+ }
+
+ const FramebufferAttachment *readBuffer = framebuffer->getReadColorAttachment();
+ // WebGL 1.0 [Section 6.26] Reading From a Missing Attachment
+ // In OpenGL ES it is undefined what happens when an operation tries to read from a missing
+ // attachment and WebGL defines it to be an error. We do the check unconditionnaly as the
+ // situation is an application error that would lead to a crash in ANGLE.
+ if (readBuffer == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMissingReadAttachment);
+ return false;
+ }
+
+ // OVR_multiview2, Revision 1:
+ // ReadPixels generates an INVALID_FRAMEBUFFER_OPERATION error if
+ // the number of views in the current read framebuffer is more than one.
+ if (framebuffer->readDisallowedByMultiview())
+ {
+ context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, kMultiviewReadFramebuffer);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility)
+ {
+ // The ES 2.0 spec states that the format must be "among those defined in table 3.4,
+ // excluding formats LUMINANCE and LUMINANCE_ALPHA.". This requires validating the format
+ // and type before validating the combination of format and type. However, the
+ // dEQP-GLES3.functional.negative_api.buffer.read_pixels passes GL_LUMINANCE as a format and
+ // verifies that GL_INVALID_OPERATION is generated.
+ // TODO(geofflang): Update this check to be done in all/no cases once this is resolved in
+ // dEQP/WebGL.
+ if (!ValidReadPixelsFormatEnum(context, format))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ if (!ValidReadPixelsTypeEnum(context, type))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidType);
+ return false;
+ }
+ }
+
+ GLenum currentFormat = GL_NONE;
+ ANGLE_VALIDATION_TRY(framebuffer->getImplementationColorReadFormat(context, &currentFormat));
+
+ GLenum currentType = GL_NONE;
+ ANGLE_VALIDATION_TRY(framebuffer->getImplementationColorReadType(context, &currentType));
+
+ GLenum currentComponentType = readBuffer->getFormat().info->componentType;
+
+ bool validFormatTypeCombination =
+ ValidReadPixelsFormatType(context, currentComponentType, format, type);
+
+ if (!(currentFormat == format && currentType == type) && !validFormatTypeCombination)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+
+ // Check for pixel pack buffer related API errors
+ Buffer *pixelPackBuffer = context->getState().getTargetBuffer(BufferBinding::PixelPack);
+ if (pixelPackBuffer != nullptr && pixelPackBuffer->isMapped())
+ {
+ // ...the buffer object's data store is currently mapped.
+ context->validationError(GL_INVALID_OPERATION, kBufferMapped);
+ return false;
+ }
+ if (context->getExtensions().webglCompatibility && pixelPackBuffer != nullptr &&
+ pixelPackBuffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ context->validationError(GL_INVALID_OPERATION, kPixelPackBufferBoundForTransformFeedback);
+ return false;
+ }
+
+ // .. the data would be packed to the buffer object such that the memory writes required
+ // would exceed the data store size.
+ const InternalFormat &formatInfo = GetInternalFormatInfo(format, type);
+ const Extents size(width, height, 1);
+ const auto &pack = context->getState().getPackState();
+
+ GLuint endByte = 0;
+ if (!formatInfo.computePackUnpackEndByte(type, size, pack, false, &endByte))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ if (bufSize >= 0)
+ {
+ if (pixelPackBuffer == nullptr && static_cast<size_t>(bufSize) < endByte)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInsufficientBufferSize);
+ return false;
+ }
+ }
+
+ if (pixelPackBuffer != nullptr)
+ {
+ CheckedNumeric<size_t> checkedEndByte(endByte);
+ CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(pixels));
+ checkedEndByte += checkedOffset;
+
+ if (checkedEndByte.ValueOrDie() > static_cast<size_t>(pixelPackBuffer->getSize()))
+ {
+ // Overflow past the end of the buffer
+ context->validationError(GL_INVALID_OPERATION, kParamOverflow);
+ return false;
+ }
+ }
+
+ if (pixelPackBuffer == nullptr && length != nullptr)
+ {
+ if (endByte > static_cast<size_t>(std::numeric_limits<GLsizei>::max()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ *length = static_cast<GLsizei>(endByte);
+ }
+
+ auto getClippedExtent = [](GLint start, GLsizei length, int bufferSize, GLsizei *outExtent) {
+ angle::CheckedNumeric<int> clippedExtent(length);
+ if (start < 0)
+ {
+ // "subtract" the area that is less than 0
+ clippedExtent += start;
+ }
+
+ angle::CheckedNumeric<int> readExtent = start;
+ readExtent += length;
+ if (!readExtent.IsValid())
+ {
+ return false;
+ }
+
+ if (readExtent.ValueOrDie() > bufferSize)
+ {
+ // Subtract the region to the right of the read buffer
+ clippedExtent -= (readExtent - bufferSize);
+ }
+
+ if (!clippedExtent.IsValid())
+ {
+ return false;
+ }
+
+ *outExtent = std::max(clippedExtent.ValueOrDie(), 0);
+ return true;
+ };
+
+ GLsizei writtenColumns = 0;
+ if (!getClippedExtent(x, width, readBuffer->getSize().width, &writtenColumns))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ GLsizei writtenRows = 0;
+ if (!getClippedExtent(y, height, readBuffer->getSize().height, &writtenRows))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ if (columns != nullptr)
+ {
+ *columns = writtenColumns;
+ }
+
+ if (rows != nullptr)
+ {
+ *rows = writtenRows;
+ }
+
+ return true;
+}
+
+template <typename ParamType>
+bool ValidateTexParameterBase(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ bool vectorParams,
+ const ParamType *params)
+{
+ if (!ValidTextureTarget(context, target) && !ValidTextureExternalTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ if (context->getTextureByType(target) == nullptr)
+ {
+ // Should only be possible for external textures
+ context->validationError(GL_INVALID_ENUM, kTextureNotBound);
+ return false;
+ }
+
+ const GLsizei minBufSize = GetTexParameterCount(pname);
+ if (bufSize >= 0 && bufSize < minBufSize)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInsufficientBufferSize);
+ return false;
+ }
+
+ if (context->getClientMajorVersion() == 1 && !IsValidGLES1TextureParameter(pname))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_SWIZZLE_R:
+ case GL_TEXTURE_SWIZZLE_G:
+ case GL_TEXTURE_SWIZZLE_B:
+ case GL_TEXTURE_SWIZZLE_A:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ if (context->getClientMajorVersion() < 3 &&
+ !(pname == GL_TEXTURE_WRAP_R && context->getExtensions().texture3DOES))
+ {
+ context->validationError(GL_INVALID_ENUM, kES3Required);
+ return false;
+ }
+ if (target == TextureType::External && !context->getExtensions().eglImageExternalEssl3)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_GENERATE_MIPMAP:
+ case GL_TEXTURE_CROP_RECT_OES:
+ if (context->getClientMajorVersion() > 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kGLES1Only);
+ return false;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (target == TextureType::_2DMultisample || target == TextureType::_2DMultisampleArray)
+ {
+ switch (pname)
+ {
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ case GL_TEXTURE_BORDER_COLOR:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ {
+ bool restrictedWrapModes =
+ target == TextureType::External || target == TextureType::Rectangle;
+ if (!ValidateTextureWrapModeValue(context, params, restrictedWrapModes))
+ {
+ return false;
+ }
+ }
+ break;
+
+ case GL_TEXTURE_MIN_FILTER:
+ {
+ bool restrictedMinFilter =
+ target == TextureType::External || target == TextureType::Rectangle;
+ if (!ValidateTextureMinFilterValue(context, params, restrictedMinFilter))
+ {
+ return false;
+ }
+ }
+ break;
+
+ case GL_TEXTURE_MAG_FILTER:
+ if (!ValidateTextureMagFilterValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_USAGE_ANGLE:
+ if (!context->getExtensions().textureUsage)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_NONE:
+ case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ {
+ GLfloat paramValue = static_cast<GLfloat>(params[0]);
+ if (!ValidateTextureMaxAnisotropyValue(context, paramValue))
+ {
+ return false;
+ }
+ ASSERT(static_cast<ParamType>(paramValue) == params[0]);
+ }
+ break;
+
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ // any value is permissible
+ break;
+
+ case GL_TEXTURE_COMPARE_MODE:
+ if (!ValidateTextureCompareModeValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_COMPARE_FUNC:
+ if (!ValidateTextureCompareFuncValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_SWIZZLE_R:
+ case GL_TEXTURE_SWIZZLE_G:
+ case GL_TEXTURE_SWIZZLE_B:
+ case GL_TEXTURE_SWIZZLE_A:
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_ZERO:
+ case GL_ONE:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_BASE_LEVEL:
+ if (ConvertToGLint(params[0]) < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kBaseLevelNegative);
+ return false;
+ }
+ if (target == TextureType::External && static_cast<GLuint>(params[0]) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBaseLevelNonZero);
+ return false;
+ }
+ if ((target == TextureType::_2DMultisample ||
+ target == TextureType::_2DMultisampleArray) &&
+ static_cast<GLuint>(params[0]) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBaseLevelNonZero);
+ return false;
+ }
+ if (target == TextureType::Rectangle && static_cast<GLuint>(params[0]) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBaseLevelNonZero);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_MAX_LEVEL:
+ if (ConvertToGLint(params[0]) < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+ break;
+
+ case GL_DEPTH_STENCIL_TEXTURE_MODE:
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ switch (ConvertToGLenum(params[0]))
+ {
+ case GL_DEPTH_COMPONENT:
+ case GL_STENCIL_INDEX:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!ValidateTextureSRGBDecodeValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_GENERATE_MIPMAP:
+ if (context->getClientMajorVersion() > 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kGLES1Only);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_CROP_RECT_OES:
+ if (context->getClientMajorVersion() > 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kGLES1Only);
+ return false;
+ }
+ if (!vectorParams)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInsufficientBufferSize);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_BORDER_COLOR:
+ if (!context->getExtensions().textureBorderClamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ if (!vectorParams)
+ {
+ context->validationError(GL_INVALID_ENUM, kInsufficientBufferSize);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+template bool ValidateTexParameterBase(Context *,
+ TextureType,
+ GLenum,
+ GLsizei,
+ bool,
+ const GLfloat *);
+template bool ValidateTexParameterBase(Context *,
+ TextureType,
+ GLenum,
+ GLsizei,
+ bool,
+ const GLint *);
+template bool ValidateTexParameterBase(Context *,
+ TextureType,
+ GLenum,
+ GLsizei,
+ bool,
+ const GLuint *);
+
+bool ValidateVertexAttribIndex(Context *context, GLuint index)
+{
+ if (index >= MAX_VERTEX_ATTRIBS)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetActiveUniformBlockivBase(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei *length)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsActiveUniformBlockCount);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_UNIFORM_BLOCK_BINDING:
+ 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:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (length)
+ {
+ if (pname == GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)
+ {
+ const InterfaceBlock &uniformBlock =
+ programObject->getUniformBlockByIndex(uniformBlockIndex);
+ *length = static_cast<GLsizei>(uniformBlock.memberIndexes.size());
+ }
+ else
+ {
+ *length = 1;
+ }
+ }
+
+ return true;
+}
+
+template <typename ParamType>
+bool ValidateSamplerParameterBase(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ bool vectorParams,
+ const ParamType *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidSampler);
+ return false;
+ }
+
+ const GLsizei minBufSize = GetSamplerParameterCount(pname);
+ if (bufSize >= 0 && bufSize < minBufSize)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInsufficientBufferSize);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ if (!ValidateTextureWrapModeValue(context, params, false))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_MIN_FILTER:
+ if (!ValidateTextureMinFilterValue(context, params, false))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_MAG_FILTER:
+ if (!ValidateTextureMagFilterValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ // any value is permissible
+ break;
+
+ case GL_TEXTURE_COMPARE_MODE:
+ if (!ValidateTextureCompareModeValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_COMPARE_FUNC:
+ if (!ValidateTextureCompareFuncValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!ValidateTextureSRGBDecodeValue(context, params))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ {
+ GLfloat paramValue = static_cast<GLfloat>(params[0]);
+ if (!ValidateTextureMaxAnisotropyValue(context, paramValue))
+ {
+ return false;
+ }
+ }
+ break;
+
+ case GL_TEXTURE_BORDER_COLOR:
+ if (!context->getExtensions().textureBorderClamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ if (!vectorParams)
+ {
+ context->validationError(GL_INVALID_ENUM, kInsufficientBufferSize);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+template bool ValidateSamplerParameterBase(Context *,
+ GLuint,
+ GLenum,
+ GLsizei,
+ bool,
+ const GLfloat *);
+template bool ValidateSamplerParameterBase(Context *, GLuint, GLenum, GLsizei, bool, const GLint *);
+template bool ValidateSamplerParameterBase(Context *,
+ GLuint,
+ GLenum,
+ GLsizei,
+ bool,
+ const GLuint *);
+
+bool ValidateGetSamplerParameterBase(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei *length)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!context->isSampler(sampler))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidSampler);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_COMPARE_FUNC:
+ break;
+
+ case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (!ValidateTextureMaxAnisotropyExtensionEnabled(context))
+ {
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!context->getExtensions().textureSRGBDecode)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_TEXTURE_BORDER_COLOR:
+ if (!context->getExtensions().textureBorderClamp)
+ {
+ context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = GetSamplerParameterCount(pname);
+ }
+ return true;
+}
+
+bool ValidateGetInternalFormativBase(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *numParams)
+{
+ if (numParams)
+ {
+ *numParams = 0;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
+ if (!formatCaps.renderbuffer)
+ {
+ context->validationError(GL_INVALID_ENUM, kFormatNotRenderable);
+ return false;
+ }
+
+ switch (target)
+ {
+ case GL_RENDERBUFFER:
+ break;
+
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ if (context->getClientVersion() < ES_3_1 &&
+ !context->getExtensions().textureMultisample)
+ {
+ context->validationError(GL_INVALID_ENUM,
+ kMultisampleTextureExtensionOrES31Required);
+ return false;
+ }
+ break;
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES:
+ if (!context->getExtensions().textureStorageMultisample2DArray)
+ {
+ context->validationError(GL_INVALID_ENUM, kMultisampleArrayExtensionRequired);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTarget);
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInsufficientBufferSize);
+ return false;
+ }
+
+ GLsizei maxWriteParams = 0;
+ switch (pname)
+ {
+ case GL_NUM_SAMPLE_COUNTS:
+ maxWriteParams = 1;
+ break;
+
+ case GL_SAMPLES:
+ maxWriteParams = static_cast<GLsizei>(formatCaps.sampleCounts.size());
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (numParams)
+ {
+ // glGetInternalFormativ will not overflow bufSize
+ *numParams = std::min(bufSize, maxWriteParams);
+ }
+
+ return true;
+}
+
+bool ValidateFramebufferNotMultisampled(Context *context, Framebuffer *framebuffer)
+{
+ if (framebuffer->getSamples(context) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidMultisampledFramebufferOperation);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateMultitextureUnit(Context *context, GLenum texture)
+{
+ if (texture < GL_TEXTURE0 || texture >= GL_TEXTURE0 + context->getCaps().maxMultitextureUnits)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidMultitextureUnit);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateTexStorageMultisample(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLint internalFormat,
+ GLsizei width,
+ GLsizei height)
+{
+ const Caps &caps = context->getCaps();
+ if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
+ static_cast<GLuint>(height) > caps.max2DTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kTextureWidthOrHeightOutOfRange);
+ return false;
+ }
+
+ if (samples == 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kSamplesZero);
+ return false;
+ }
+
+ const TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat);
+ if (!formatCaps.textureAttachment)
+ {
+ context->validationError(GL_INVALID_ENUM, kRenderableInternalFormat);
+ return false;
+ }
+
+ // The ES3.1 spec(section 8.8) states that an INVALID_ENUM error is generated if internalformat
+ // is one of the unsized base internalformats listed in table 8.11.
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalFormat);
+ if (formatInfo.internalFormat == GL_NONE)
+ {
+ context->validationError(GL_INVALID_ENUM, kUnsizedInternalFormatUnsupported);
+ return false;
+ }
+
+ if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
+ {
+ context->validationError(GL_INVALID_OPERATION, kSamplesOutOfRange);
+ return false;
+ }
+
+ Texture *texture = context->getTextureByType(target);
+ if (!texture || texture->id() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kZeroBoundToTarget);
+ return false;
+ }
+
+ if (texture->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kImmutableTextureBound);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateTexStorage2DMultisampleBase(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLint internalFormat,
+ GLsizei width,
+ GLsizei height)
+{
+ if (target != TextureType::_2DMultisample)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTarget);
+ return false;
+ }
+
+ if (width < 1 || height < 1)
+ {
+ context->validationError(GL_INVALID_VALUE, kTextureSizeTooSmall);
+ return false;
+ }
+
+ return ValidateTexStorageMultisample(context, target, samples, internalFormat, width, height);
+}
+
+bool ValidateGetTexLevelParameterBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLsizei *length)
+{
+
+ if (length)
+ {
+ *length = 0;
+ }
+
+ TextureType type = TextureTargetToType(target);
+
+ if (!ValidTexLevelDestinationTarget(context, type))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ if (context->getTextureByType(type) == nullptr)
+ {
+ context->validationError(GL_INVALID_ENUM, kTextureNotBound);
+ return false;
+ }
+
+ if (!ValidMipLevel(context, type, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_TEXTURE_RED_TYPE:
+ case GL_TEXTURE_GREEN_TYPE:
+ case GL_TEXTURE_BLUE_TYPE:
+ case GL_TEXTURE_ALPHA_TYPE:
+ case GL_TEXTURE_DEPTH_TYPE:
+ break;
+ case GL_TEXTURE_RED_SIZE:
+ case GL_TEXTURE_GREEN_SIZE:
+ case GL_TEXTURE_BLUE_SIZE:
+ case GL_TEXTURE_ALPHA_SIZE:
+ case GL_TEXTURE_DEPTH_SIZE:
+ case GL_TEXTURE_STENCIL_SIZE:
+ case GL_TEXTURE_SHARED_SIZE:
+ break;
+ case GL_TEXTURE_INTERNAL_FORMAT:
+ case GL_TEXTURE_WIDTH:
+ case GL_TEXTURE_HEIGHT:
+ case GL_TEXTURE_DEPTH:
+ break;
+ case GL_TEXTURE_SAMPLES:
+ case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
+ break;
+ case GL_TEXTURE_COMPRESSED:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = 1;
+ }
+ return true;
+}
+
+bool ValidateGetMultisamplefvBase(Context *context, GLenum pname, GLuint index, GLfloat *val)
+{
+ if (pname != GL_SAMPLE_POSITION)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ Framebuffer *framebuffer = context->getState().getDrawFramebuffer();
+ GLint samples = framebuffer->getSamples(context);
+
+ if (index >= static_cast<GLuint>(samples))
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsSamples);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateSampleMaskiBase(Context *context, GLuint maskNumber, GLbitfield mask)
+{
+ if (maskNumber >= context->getCaps().maxSampleMaskWords)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSampleMaskNumber);
+ return false;
+ }
+
+ return true;
+}
+
+void RecordDrawAttribsError(Context *context)
+{
+ // An overflow can happen when adding the offset. Check against a special constant.
+ if (context->getStateCache().getNonInstancedVertexElementLimit() ==
+ VertexAttribute::kIntegerOverflow ||
+ context->getStateCache().getInstancedVertexElementLimit() ==
+ VertexAttribute::kIntegerOverflow)
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ }
+ else
+ {
+ // [OpenGL ES 3.0.2] section 2.9.4 page 40:
+ // We can return INVALID_OPERATION if our buffer does not have enough backing data.
+ context->validationError(GL_INVALID_OPERATION, kInsufficientVertexBufferSize);
+ }
+}
+
+bool ValidateLoseContextCHROMIUM(Context *context,
+ GraphicsResetStatus current,
+ GraphicsResetStatus other)
+{
+ if (!context->getExtensions().loseContextCHROMIUM)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (current)
+ {
+ case GraphicsResetStatus::GuiltyContextReset:
+ case GraphicsResetStatus::InnocentContextReset:
+ case GraphicsResetStatus::UnknownContextReset:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidResetStatus);
+ }
+
+ switch (other)
+ {
+ case GraphicsResetStatus::GuiltyContextReset:
+ case GraphicsResetStatus::InnocentContextReset:
+ case GraphicsResetStatus::UnknownContextReset:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidResetStatus);
+ }
+
+ return true;
+}
+
+// GL_ANGLE_texture_storage_external
+bool ValidateTexImage2DExternalANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type)
+{
+ if (!context->getExtensions().textureExternalUpdateANGLE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidTexture2DDestinationTarget(context, target) &&
+ !ValidTextureExternalTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ if (context->getClientMajorVersion() <= 2)
+ {
+ if (!ValidateES2TexImageParametersBase(context, target, level, internalformat, false, false,
+ 0, 0, width, height, border, format, type, -1,
+ nullptr))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (!ValidateES3TexImageParametersBase(context, target, level, internalformat, false, false,
+ 0, 0, 0, width, height, 1, border, format, type, -1,
+ nullptr))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateInvalidateTextureANGLE(Context *context, TextureType target)
+{
+ if (!context->getExtensions().textureExternalUpdateANGLE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidTextureTarget(context, target) && !ValidTextureExternalTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationES.h b/gfx/angle/checkout/src/libANGLE/validationES.h
new file mode 100644
index 0000000000..b6aeb2683e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES.h
@@ -0,0 +1,956 @@
+//
+// Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES.h: Validation functions for generic OpenGL ES entry point parameters
+
+#ifndef LIBANGLE_VALIDATION_ES_H_
+#define LIBANGLE_VALIDATION_ES_H_
+
+#include "common/PackedEnums.h"
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/VertexArray.h"
+
+#include <GLES2/gl2.h>
+#include <GLES3/gl3.h>
+#include <GLES3/gl31.h>
+
+namespace egl
+{
+class Display;
+class Image;
+} // namespace egl
+
+namespace gl
+{
+class Context;
+struct Format;
+class Framebuffer;
+struct LinkedUniform;
+class Program;
+class Shader;
+
+void SetRobustLengthParam(GLsizei *length, GLsizei value);
+bool IsETC2EACFormat(const GLenum format);
+bool ValidTextureTarget(const Context *context, TextureType type);
+bool ValidTexture2DTarget(const Context *context, TextureType type);
+bool ValidTexture3DTarget(const Context *context, TextureType target);
+bool ValidTextureExternalTarget(const Context *context, TextureType target);
+bool ValidTextureExternalTarget(const Context *context, TextureTarget target);
+bool ValidTexture2DDestinationTarget(const Context *context, TextureTarget target);
+bool ValidTexture3DDestinationTarget(const Context *context, TextureTarget target);
+bool ValidTexLevelDestinationTarget(const Context *context, TextureType type);
+bool ValidFramebufferTarget(const Context *context, GLenum target);
+bool ValidMipLevel(const Context *context, TextureType type, GLint level);
+bool ValidImageSizeParameters(Context *context,
+ TextureType target,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ bool isSubImage);
+bool ValidCompressedImageSize(const Context *context,
+ GLenum internalFormat,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+bool ValidCompressedSubImageSize(const Context *context,
+ GLenum internalFormat,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ size_t textureWidth,
+ size_t textureHeight,
+ size_t textureDepth);
+bool ValidImageDataSize(Context *context,
+ TextureType texType,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels,
+ GLsizei imageSize);
+
+bool ValidQueryType(const Context *context, QueryType queryType);
+
+bool ValidateWebGLVertexAttribPointer(Context *context,
+ VertexAttribType type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *ptr,
+ bool pureInteger);
+
+// Returns valid program if id is a valid program name
+// Errors INVALID_OPERATION if valid shader is given and returns NULL
+// Errors INVALID_VALUE otherwise and returns NULL
+Program *GetValidProgram(Context *context, GLuint id);
+
+// Returns valid shader if id is a valid shader name
+// Errors INVALID_OPERATION if valid program is given and returns NULL
+// Errors INVALID_VALUE otherwise and returns NULL
+Shader *GetValidShader(Context *context, GLuint id);
+
+bool ValidateAttachmentTarget(Context *context, GLenum attachment);
+bool ValidateRenderbufferStorageParametersBase(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateFramebufferRenderbufferParameters(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+
+bool ValidateBlitFramebufferParameters(Context *context,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+
+bool ValidateReadPixelsBase(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels);
+bool ValidateReadPixelsRobustANGLE(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels);
+bool ValidateReadnPixelsEXT(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels);
+bool ValidateReadnPixelsRobustANGLE(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data);
+
+bool ValidateGenQueriesEXT(gl::Context *context, GLsizei n, GLuint *ids);
+bool ValidateDeleteQueriesEXT(gl::Context *context, GLsizei n, const GLuint *ids);
+bool ValidateIsQueryEXT(gl::Context *context, GLuint id);
+bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id);
+bool ValidateBeginQueryEXT(Context *context, QueryType target, GLuint id);
+bool ValidateEndQueryBase(Context *context, QueryType target);
+bool ValidateEndQueryEXT(Context *context, QueryType target);
+bool ValidateQueryCounterEXT(Context *context, GLuint id, QueryType target);
+bool ValidateGetQueryivBase(Context *context, QueryType target, GLenum pname, GLsizei *numParams);
+bool ValidateGetQueryivEXT(Context *context, QueryType target, GLenum pname, GLint *params);
+bool ValidateGetQueryivRobustANGLE(Context *context,
+ QueryType target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetQueryObjectValueBase(Context *context, GLuint id, GLenum pname, GLsizei *numParams);
+bool ValidateGetQueryObjectivEXT(Context *context, GLuint id, GLenum pname, GLint *params);
+bool ValidateGetQueryObjectivRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetQueryObjectuivEXT(Context *context, GLuint id, GLenum pname, GLuint *params);
+bool ValidateGetQueryObjectuivRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateGetQueryObjecti64vEXT(Context *context, GLuint id, GLenum pname, GLint64 *params);
+bool ValidateGetQueryObjecti64vRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+bool ValidateGetQueryObjectui64vEXT(Context *context, GLuint id, GLenum pname, GLuint64 *params);
+bool ValidateGetQueryObjectui64vRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params);
+
+bool ValidateUniformCommonBase(Context *context,
+ gl::Program *program,
+ GLint location,
+ GLsizei count,
+ const LinkedUniform **uniformOut);
+bool ValidateUniform1ivValue(Context *context,
+ GLenum uniformType,
+ GLsizei count,
+ const GLint *value);
+
+ANGLE_INLINE bool ValidateUniformValue(Context *context, GLenum valueType, GLenum uniformType)
+{
+ // Check that the value type is compatible with uniform type.
+ // Do the cheaper test first, for a little extra speed.
+ if (valueType != uniformType && VariableBoolVectorType(valueType) != uniformType)
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kUniformSizeMismatch);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateUniformMatrixValue(Context *context, GLenum valueType, GLenum uniformType);
+bool ValidateUniform(Context *context, GLenum uniformType, GLint location, GLsizei count);
+bool ValidateUniformMatrix(Context *context,
+ GLenum matrixType,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose);
+bool ValidateGetBooleanvRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params);
+bool ValidateGetFloatvRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateStateQuery(Context *context,
+ GLenum pname,
+ GLenum *nativeType,
+ unsigned int *numParams);
+bool ValidateGetIntegervRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+bool ValidateGetInteger64vRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+bool ValidateRobustStateQuery(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLenum *nativeType,
+ unsigned int *numParams);
+
+bool ValidateCopyTexImageParametersBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ Format *textureFormatOut);
+
+void RecordDrawModeError(Context *context, PrimitiveMode mode);
+const char *ValidateDrawElementsStates(Context *context);
+
+ANGLE_INLINE bool ValidateDrawBase(Context *context, PrimitiveMode mode)
+{
+ if (!context->getStateCache().isValidDrawMode(mode))
+ {
+ RecordDrawModeError(context, mode);
+ return false;
+ }
+
+ intptr_t drawStatesError = context->getStateCache().getBasicDrawStatesError(context);
+ if (drawStatesError)
+ {
+ const char *errorMessage = reinterpret_cast<const char *>(drawStatesError);
+
+ // All errors from ValidateDrawStates should return INVALID_OPERATION except Framebuffer
+ // Incomplete.
+ GLenum errorCode =
+ (errorMessage == err::kDrawFramebufferIncomplete ? GL_INVALID_FRAMEBUFFER_OPERATION
+ : GL_INVALID_OPERATION);
+ context->validationError(errorCode, errorMessage);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawArraysInstancedBase(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+bool ValidateDrawArraysInstancedANGLE(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+bool ValidateDrawArraysInstancedEXT(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+
+bool ValidateDrawElementsInstancedBase(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei primcount);
+bool ValidateDrawElementsInstancedANGLE(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei primcount);
+bool ValidateDrawElementsInstancedEXT(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei primcount);
+
+bool ValidateDrawInstancedANGLE(Context *context);
+bool ValidateDrawInstancedEXT(Context *context);
+
+bool ValidateFramebufferTextureBase(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level);
+
+bool ValidateGetUniformBase(Context *context, GLuint program, GLint location);
+bool ValidateGetnUniformfvEXT(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params);
+bool ValidateGetnUniformfvRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetnUniformivEXT(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params);
+bool ValidateGetnUniformivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetnUniformuivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateGetUniformfvRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetUniformivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetUniformuivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+
+bool ValidateDiscardFramebufferBase(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ bool defaultFramebuffer);
+
+bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker);
+bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker);
+
+bool ValidateEGLImageTargetTexture2DOES(Context *context,
+ gl::TextureType type,
+ GLeglImageOES image);
+bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
+ GLenum target,
+ GLeglImageOES image);
+
+bool ValidateBindVertexArrayBase(Context *context, GLuint array);
+
+bool ValidateProgramBinaryBase(Context *context,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length);
+bool ValidateGetProgramBinaryBase(Context *context,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+
+bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs);
+
+bool ValidateGetBufferPointervBase(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ GLsizei *length,
+ void **params);
+bool ValidateUnmapBufferBase(Context *context, BufferBinding target);
+bool ValidateMapBufferRangeBase(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+bool ValidateFlushMappedBufferRangeBase(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length);
+
+bool ValidateGenOrDelete(Context *context, GLint n);
+
+bool ValidateRobustEntryPoint(Context *context, GLsizei bufSize);
+bool ValidateRobustBufferSize(Context *context, GLsizei bufSize, GLsizei numParams);
+
+bool ValidateGetFramebufferAttachmentParameterivBase(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei *numParams);
+
+bool ValidateGetBufferParameterBase(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ bool pointerVersion,
+ GLsizei *numParams);
+
+bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GLsizei *numParams);
+
+bool ValidateGetRenderbufferParameterivBase(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLsizei *length);
+
+bool ValidateGetShaderivBase(Context *context, GLuint shader, GLenum pname, GLsizei *length);
+
+bool ValidateGetTexParameterBase(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei *length);
+
+template <typename ParamType>
+bool ValidateTexParameterBase(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLsizei bufSize,
+ bool vectorParams,
+ const ParamType *params);
+
+bool ValidateGetVertexAttribBase(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei *length,
+ bool pointer,
+ bool pureIntegerEntryPoint);
+
+ANGLE_INLINE bool ValidateVertexFormat(Context *context,
+ GLuint index,
+ GLint size,
+ VertexAttribTypeCase validation)
+{
+ const Caps &caps = context->getCaps();
+ if (index >= caps.maxVertexAttributes)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ switch (validation)
+ {
+ case VertexAttribTypeCase::Invalid:
+ context->validationError(GL_INVALID_ENUM, err::kInvalidType);
+ return false;
+ case VertexAttribTypeCase::Valid:
+ if (size < 1 || size > 4)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kInvalidVertexAttrSize);
+ return false;
+ }
+ break;
+ case VertexAttribTypeCase::ValidSize4Only:
+ if (size != 4)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ err::kInvalidVertexAttribSize2101010);
+ return false;
+ }
+ break;
+ }
+
+ return true;
+}
+
+// Note: These byte, short, and int types are all converted to float for the shader.
+ANGLE_INLINE bool ValidateFloatVertexFormat(Context *context,
+ GLuint index,
+ GLint size,
+ VertexAttribType type)
+{
+ return ValidateVertexFormat(context, index, size,
+ context->getStateCache().getVertexAttribTypeValidation(type));
+}
+
+ANGLE_INLINE bool ValidateIntegerVertexFormat(Context *context,
+ GLuint index,
+ GLint size,
+ VertexAttribType type)
+{
+ return ValidateVertexFormat(
+ context, index, size, context->getStateCache().getIntegerVertexAttribTypeValidation(type));
+}
+
+bool ValidateWebGLFramebufferAttachmentClearType(Context *context,
+ GLint drawbuffer,
+ const GLenum *validComponentTypes,
+ size_t validComponentTypeCount);
+
+bool ValidateRobustCompressedTexImageBase(Context *context, GLsizei imageSize, GLsizei dataSize);
+
+bool ValidateVertexAttribIndex(Context *context, GLuint index);
+
+bool ValidateGetActiveUniformBlockivBase(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei *length);
+
+bool ValidateGetSamplerParameterBase(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei *length);
+
+template <typename ParamType>
+bool ValidateSamplerParameterBase(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ bool vectorParams,
+ const ParamType *params);
+
+bool ValidateGetInternalFormativBase(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *numParams);
+
+bool ValidateFramebufferNotMultisampled(Context *context, Framebuffer *framebuffer);
+
+bool ValidateMultitextureUnit(Context *context, GLenum texture);
+
+bool ValidateTransformFeedbackPrimitiveMode(const Context *context,
+ PrimitiveMode transformFeedbackPrimitiveMode,
+ PrimitiveMode renderPrimitiveMode);
+
+// Common validation for 2D and 3D variants of TexStorage*Multisample.
+bool ValidateTexStorageMultisample(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLint internalFormat,
+ GLsizei width,
+ GLsizei height);
+
+bool ValidateTexStorage2DMultisampleBase(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLint internalFormat,
+ GLsizei width,
+ GLsizei height);
+
+bool ValidateGetTexLevelParameterBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLsizei *length);
+
+bool ValidateMapBufferBase(Context *context, BufferBinding target);
+bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLsizei *length);
+bool ValidateES3TexImage2DParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei imageSize,
+ const void *pixels);
+bool ValidateES3CopyTexImage2DParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border);
+bool ValidateES3TexStorage2DParameters(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+bool ValidateES3TexStorage3DParameters(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+
+bool ValidateGetMultisamplefvBase(Context *context, GLenum pname, GLuint index, GLfloat *val);
+bool ValidateSampleMaskiBase(Context *context, GLuint maskNumber, GLbitfield mask);
+
+// Utility macro for handling implementation methods inside Validation.
+#define ANGLE_HANDLE_VALIDATION_ERR(X) \
+ (void)(X); \
+ return false
+#define ANGLE_VALIDATION_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_HANDLE_VALIDATION_ERR)
+
+// We should check with Khronos if returning INVALID_FRAMEBUFFER_OPERATION is OK when querying
+// implementation format info for incomplete framebuffers. It seems like these queries are
+// incongruent with the other errors.
+// Inlined for speed.
+template <GLenum ErrorCode = GL_INVALID_FRAMEBUFFER_OPERATION>
+ANGLE_INLINE bool ValidateFramebufferComplete(Context *context, Framebuffer *framebuffer)
+{
+ if (!framebuffer->isComplete(context))
+ {
+ context->validationError(ErrorCode, err::kFramebufferIncomplete);
+ return false;
+ }
+
+ return true;
+}
+
+const char *ValidateDrawStates(Context *context);
+
+void RecordDrawAttribsError(Context *context);
+
+ANGLE_INLINE bool ValidateDrawAttribs(Context *context, int64_t maxVertex)
+{
+ if (maxVertex > context->getStateCache().getNonInstancedVertexElementLimit())
+ {
+ RecordDrawAttribsError(context);
+ return false;
+ }
+
+ return true;
+}
+
+ANGLE_INLINE bool ValidateDrawArraysAttribs(Context *context, GLint first, GLsizei count)
+{
+ if (!context->isBufferAccessValidationEnabled())
+ {
+ return true;
+ }
+
+ // Check the computation of maxVertex doesn't overflow.
+ // - first < 0 has been checked as an error condition.
+ // - if count <= 0, skip validating no-op draw calls.
+ // From this we know maxVertex will be positive, and only need to check if it overflows GLint.
+ ASSERT(first >= 0);
+ ASSERT(count > 0);
+ int64_t maxVertex = static_cast<int64_t>(first) + static_cast<int64_t>(count) - 1;
+ if (maxVertex > static_cast<int64_t>(std::numeric_limits<GLint>::max()))
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kIntegerOverflow);
+ return false;
+ }
+
+ return ValidateDrawAttribs(context, maxVertex);
+}
+
+ANGLE_INLINE bool ValidateDrawInstancedAttribs(Context *context, GLint primcount)
+{
+ if (!context->isBufferAccessValidationEnabled())
+ {
+ return true;
+ }
+
+ if ((primcount - 1) > context->getStateCache().getInstancedVertexElementLimit())
+ {
+ RecordDrawAttribsError(context);
+ return false;
+ }
+
+ return true;
+}
+
+ANGLE_INLINE bool ValidateDrawArraysCommon(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ if (first < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kNegativeStart);
+ return false;
+ }
+
+ if (count <= 0)
+ {
+ if (count < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kNegativeCount);
+ return false;
+ }
+
+ // Early exit.
+ return ValidateDrawBase(context, mode);
+ }
+
+ if (!ValidateDrawBase(context, mode))
+ {
+ return false;
+ }
+
+ if (context->getStateCache().isTransformFeedbackActiveUnpaused())
+ {
+ const State &state = context->getState();
+ TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
+ if (!curTransformFeedback->checkBufferSpaceForDraw(count, primcount))
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kTransformFeedbackBufferTooSmall);
+ return false;
+ }
+ }
+
+ return ValidateDrawArraysAttribs(context, first, count);
+}
+
+ANGLE_INLINE bool ValidateDrawElementsBase(Context *context,
+ PrimitiveMode mode,
+ DrawElementsType type)
+{
+ if (!context->getStateCache().isValidDrawElementsType(type))
+ {
+ if (type == DrawElementsType::UnsignedInt)
+ {
+ context->validationError(GL_INVALID_ENUM, err::kTypeNotUnsignedShortByte);
+ return false;
+ }
+
+ ASSERT(type == DrawElementsType::InvalidEnum);
+ context->validationError(GL_INVALID_ENUM, err::kEnumNotSupported);
+ return false;
+ }
+
+ intptr_t drawElementsError = context->getStateCache().getBasicDrawElementsError(context);
+ if (drawElementsError)
+ {
+ // All errors from ValidateDrawElementsStates return INVALID_OPERATION.
+ const char *errorMessage = reinterpret_cast<const char *>(drawElementsError);
+ context->validationError(GL_INVALID_OPERATION, errorMessage);
+ return false;
+ }
+
+ // Note that we are missing overflow checks for active transform feedback buffers.
+ return true;
+}
+
+ANGLE_INLINE bool ValidateDrawElementsCommon(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei primcount)
+{
+ if (!ValidateDrawElementsBase(context, mode, type))
+ {
+ return false;
+ }
+
+ ASSERT(isPow2(GetDrawElementsTypeSize(type)) && GetDrawElementsTypeSize(type) > 0);
+
+ if (context->getExtensions().webglCompatibility)
+ {
+ GLuint typeBytes = GetDrawElementsTypeSize(type);
+
+ if ((reinterpret_cast<uintptr_t>(indices) & static_cast<uintptr_t>(typeBytes - 1)) != 0)
+ {
+ // [WebGL 1.0] Section 6.4 Buffer Offset and Stride Requirements
+ // The offset arguments to drawElements and [...], must be a multiple of the size of the
+ // data type passed to the call, or an INVALID_OPERATION error is generated.
+ context->validationError(GL_INVALID_OPERATION, err::kOffsetMustBeMultipleOfType);
+ return false;
+ }
+
+ // [WebGL 1.0] Section 6.4 Buffer Offset and Stride Requirements
+ // In addition the offset argument to drawElements must be non-negative or an INVALID_VALUE
+ // error is generated.
+ if (reinterpret_cast<intptr_t>(indices) < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kNegativeOffset);
+ return false;
+ }
+ }
+
+ if (count <= 0)
+ {
+ if (count < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kNegativeCount);
+ return false;
+ }
+
+ // Early exit.
+ return ValidateDrawBase(context, mode);
+ }
+
+ if (!ValidateDrawBase(context, mode))
+ {
+ return false;
+ }
+
+ const State &state = context->getState();
+ const VertexArray *vao = state.getVertexArray();
+ Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
+
+ if (!elementArrayBuffer)
+ {
+ if (!indices)
+ {
+ // This is an application error that would normally result in a crash, but we catch
+ // it and return an error
+ context->validationError(GL_INVALID_OPERATION, err::kElementArrayNoBufferOrPointer);
+ return false;
+ }
+ }
+ else
+ {
+ // The max possible type size is 8 and count is on 32 bits so doing the multiplication
+ // in a 64 bit integer is safe. Also we are guaranteed that here count > 0.
+ static_assert(std::is_same<int, GLsizei>::value, "GLsizei isn't the expected type");
+ constexpr uint64_t kMaxTypeSize = 8;
+ constexpr uint64_t kIntMax = std::numeric_limits<int>::max();
+ constexpr uint64_t kUint64Max = std::numeric_limits<uint64_t>::max();
+ static_assert(kIntMax < kUint64Max / kMaxTypeSize, "");
+
+ uint64_t elementCount = static_cast<uint64_t>(count);
+ ASSERT(elementCount > 0 && GetDrawElementsTypeSize(type) <= kMaxTypeSize);
+
+ // Doing the multiplication here is overflow-safe
+ uint64_t elementDataSizeNoOffset = elementCount << GetDrawElementsTypeShift(type);
+
+ // The offset can be any value, check for overflows
+ uint64_t offset = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(indices));
+ uint64_t elementDataSizeWithOffset = elementDataSizeNoOffset + offset;
+ if (elementDataSizeWithOffset < elementDataSizeNoOffset)
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kIntegerOverflow);
+ return false;
+ }
+
+ if (elementDataSizeWithOffset > static_cast<uint64_t>(elementArrayBuffer->getSize()))
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kInsufficientBufferSize);
+ return false;
+ }
+ }
+
+ if (context->isBufferAccessValidationEnabled() && primcount > 0)
+ {
+ // Use the parameter buffer to retrieve and cache the index range.
+ IndexRange indexRange{IndexRange::Undefined()};
+ ANGLE_VALIDATION_TRY(vao->getIndexRange(context, type, count, indices, &indexRange));
+
+ // If we use an index greater than our maximum supported index range, return an error.
+ // The ES3 spec does not specify behaviour here, it is undefined, but ANGLE should
+ // always return an error if possible here.
+ if (static_cast<GLuint64>(indexRange.end) >= context->getCaps().maxElementIndex)
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kExceedsMaxElement);
+ return false;
+ }
+
+ if (!ValidateDrawAttribs(context, static_cast<GLint>(indexRange.end)))
+ {
+ return false;
+ }
+
+ // No op if there are no real indices in the index data (all are primitive restart).
+ return (indexRange.vertexIndexCount > 0);
+ }
+
+ return true;
+}
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES1.cpp b/gfx/angle/checkout/src/libANGLE/validationES1.cpp
new file mode 100644
index 0000000000..57b8b88aa9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES1.cpp
@@ -0,0 +1,1631 @@
+//
+// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES1.cpp: Validation functions for OpenGL ES 1.0 entry point parameters
+
+#include "libANGLE/validationES1_autogen.h"
+
+#include "common/debug.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/GLES1State.h"
+#include "libANGLE/queryconversions.h"
+#include "libANGLE/queryutils.h"
+#include "libANGLE/validationES.h"
+
+#define ANGLE_VALIDATE_IS_GLES1(context) \
+ do \
+ { \
+ if (context->getClientMajorVersion() > 1) \
+ { \
+ context->validationError(GL_INVALID_OPERATION, kGLES1Only); \
+ return false; \
+ } \
+ } while (0)
+
+namespace gl
+{
+using namespace err;
+
+bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func)
+{
+ switch (func)
+ {
+ case AlphaTestFunc::AlwaysPass:
+ case AlphaTestFunc::Equal:
+ case AlphaTestFunc::Gequal:
+ case AlphaTestFunc::Greater:
+ case AlphaTestFunc::Lequal:
+ case AlphaTestFunc::Less:
+ case AlphaTestFunc::Never:
+ case AlphaTestFunc::NotEqual:
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+}
+
+bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ switch (arrayType)
+ {
+ case ClientVertexArrayType::Vertex:
+ case ClientVertexArrayType::Normal:
+ case ClientVertexArrayType::Color:
+ case ClientVertexArrayType::TextureCoord:
+ return true;
+ case ClientVertexArrayType::PointSize:
+ if (!context->getExtensions().pointSizeArray)
+ {
+ context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
+ return false;
+ }
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidClientState);
+ return false;
+ }
+}
+
+bool ValidateBuiltinVertexAttributeCommon(Context *context,
+ ClientVertexArrayType arrayType,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (stride < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerStride);
+ return false;
+ }
+
+ int minSize = 1;
+ int maxSize = 4;
+
+ switch (arrayType)
+ {
+ case ClientVertexArrayType::Vertex:
+ case ClientVertexArrayType::TextureCoord:
+ minSize = 2;
+ maxSize = 4;
+ break;
+ case ClientVertexArrayType::Normal:
+ minSize = 3;
+ maxSize = 3;
+ break;
+ case ClientVertexArrayType::Color:
+ minSize = 4;
+ maxSize = 4;
+ break;
+ case ClientVertexArrayType::PointSize:
+ if (!context->getExtensions().pointSizeArray)
+ {
+ context->validationError(GL_INVALID_ENUM, kPointSizeArrayExtensionNotEnabled);
+ return false;
+ }
+
+ minSize = 1;
+ maxSize = 1;
+ break;
+ default:
+ UNREACHABLE();
+ return false;
+ }
+
+ if (size < minSize || size > maxSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidVertexPointerSize);
+ return false;
+ }
+
+ switch (type)
+ {
+ case VertexAttribType::Byte:
+ if (arrayType == ClientVertexArrayType::PointSize)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
+ return false;
+ }
+ break;
+ case VertexAttribType::Short:
+ if (arrayType == ClientVertexArrayType::PointSize ||
+ arrayType == ClientVertexArrayType::Color)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
+ return false;
+ }
+ break;
+ case VertexAttribType::Fixed:
+ case VertexAttribType::Float:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidVertexPointerType);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLightCaps(Context *context, GLenum light)
+{
+ if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidLight);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLightCommon(Context *context,
+ GLenum light,
+ LightParameter pname,
+ const GLfloat *params)
+{
+
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (!ValidateLightCaps(context, light))
+ {
+ return false;
+ }
+
+ switch (pname)
+ {
+ case LightParameter::Ambient:
+ case LightParameter::Diffuse:
+ case LightParameter::Specular:
+ case LightParameter::Position:
+ case LightParameter::SpotDirection:
+ return true;
+ case LightParameter::SpotExponent:
+ if (params[0] < 0.0f || params[0] > 128.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
+ return false;
+ }
+ return true;
+ case LightParameter::SpotCutoff:
+ if (params[0] == 180.0f)
+ {
+ return true;
+ }
+ if (params[0] < 0.0f || params[0] > 90.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
+ return false;
+ }
+ return true;
+ case LightParameter::ConstantAttenuation:
+ case LightParameter::LinearAttenuation:
+ case LightParameter::QuadraticAttenuation:
+ if (params[0] < 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kLightParameterOutOfRange);
+ return false;
+ }
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
+ return false;
+ }
+}
+
+bool ValidateLightSingleComponent(Context *context,
+ GLenum light,
+ LightParameter pname,
+ GLfloat param)
+{
+ if (!ValidateLightCommon(context, light, pname, &param))
+ {
+ return false;
+ }
+
+ if (GetLightParameterCount(pname) > 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidLightParameter);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateMaterialCommon(Context *context,
+ GLenum face,
+ MaterialParameter pname,
+ const GLfloat *params)
+{
+ switch (pname)
+ {
+ case MaterialParameter::Ambient:
+ case MaterialParameter::Diffuse:
+ case MaterialParameter::Specular:
+ case MaterialParameter::Emission:
+ return true;
+ case MaterialParameter::Shininess:
+ if (params[0] < 0.0f || params[0] > 128.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kMaterialParameterOutOfRange);
+ return false;
+ }
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
+ return false;
+ }
+}
+
+bool ValidateMaterialSetting(Context *context,
+ GLenum face,
+ MaterialParameter pname,
+ const GLfloat *params)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (face != GL_FRONT_AND_BACK)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
+ return false;
+ }
+
+ return ValidateMaterialCommon(context, face, pname, params);
+}
+
+bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pname)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (face != GL_FRONT && face != GL_BACK)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidMaterialFace);
+ return false;
+ }
+
+ GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+
+ return ValidateMaterialCommon(context, face, pname, dummyParams);
+}
+
+bool ValidateMaterialSingleComponent(Context *context,
+ GLenum face,
+ MaterialParameter pname,
+ GLfloat param)
+{
+ if (!ValidateMaterialSetting(context, face, pname, &param))
+ {
+ return false;
+ }
+
+ if (GetMaterialParameterCount(pname) > 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidMaterialParameter);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLightModelCommon(Context *context, GLenum pname)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ switch (pname)
+ {
+ case GL_LIGHT_MODEL_AMBIENT:
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
+ return false;
+ }
+}
+
+bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
+{
+ if (!ValidateLightModelCommon(context, pname))
+ {
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidLightModelParameter);
+ return false;
+ }
+}
+
+bool ValidateClipPlaneCommon(Context *context, GLenum plane)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidClipPlane);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ switch (pname)
+ {
+ case GL_FOG_MODE:
+ {
+ GLenum modeParam = static_cast<GLenum>(params[0]);
+ switch (modeParam)
+ {
+ case GL_EXP:
+ case GL_EXP2:
+ case GL_LINEAR:
+ return true;
+ default:
+ context->validationError(GL_INVALID_VALUE, kInvalidFogMode);
+ return false;
+ }
+ }
+ break;
+ case GL_FOG_START:
+ case GL_FOG_END:
+ case GL_FOG_COLOR:
+ break;
+ case GL_FOG_DENSITY:
+ if (params[0] < 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFogDensity);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidFogParameter);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateTexEnvCommon(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ const GLfloat *params)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ switch (target)
+ {
+ case TextureEnvTarget::Env:
+ switch (pname)
+ {
+ case TextureEnvParameter::Mode:
+ {
+ TextureEnvMode mode = FromGLenum<TextureEnvMode>(ConvertToGLenum(params[0]));
+ switch (mode)
+ {
+ case TextureEnvMode::Add:
+ case TextureEnvMode::Blend:
+ case TextureEnvMode::Combine:
+ case TextureEnvMode::Decal:
+ case TextureEnvMode::Modulate:
+ case TextureEnvMode::Replace:
+ break;
+ default:
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvMode);
+ return false;
+ }
+ break;
+ }
+ case TextureEnvParameter::CombineRgb:
+ case TextureEnvParameter::CombineAlpha:
+ {
+ TextureCombine combine = FromGLenum<TextureCombine>(ConvertToGLenum(params[0]));
+ switch (combine)
+ {
+ case TextureCombine::Add:
+ case TextureCombine::AddSigned:
+ case TextureCombine::Interpolate:
+ case TextureCombine::Modulate:
+ case TextureCombine::Replace:
+ case TextureCombine::Subtract:
+ break;
+ case TextureCombine::Dot3Rgb:
+ case TextureCombine::Dot3Rgba:
+ if (pname == TextureEnvParameter::CombineAlpha)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
+ return false;
+ }
+ break;
+ }
+ case TextureEnvParameter::Src0Rgb:
+ case TextureEnvParameter::Src1Rgb:
+ case TextureEnvParameter::Src2Rgb:
+ case TextureEnvParameter::Src0Alpha:
+ case TextureEnvParameter::Src1Alpha:
+ case TextureEnvParameter::Src2Alpha:
+ {
+ TextureSrc combine = FromGLenum<TextureSrc>(ConvertToGLenum(params[0]));
+ switch (combine)
+ {
+ case TextureSrc::Constant:
+ case TextureSrc::Previous:
+ case TextureSrc::PrimaryColor:
+ case TextureSrc::Texture:
+ break;
+ default:
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineSrc);
+ return false;
+ }
+ break;
+ }
+ case TextureEnvParameter::Op0Rgb:
+ case TextureEnvParameter::Op1Rgb:
+ case TextureEnvParameter::Op2Rgb:
+ case TextureEnvParameter::Op0Alpha:
+ case TextureEnvParameter::Op1Alpha:
+ case TextureEnvParameter::Op2Alpha:
+ {
+ TextureOp operand = FromGLenum<TextureOp>(ConvertToGLenum(params[0]));
+ switch (operand)
+ {
+ case TextureOp::SrcAlpha:
+ case TextureOp::OneMinusSrcAlpha:
+ break;
+ case TextureOp::SrcColor:
+ case TextureOp::OneMinusSrcColor:
+ if (pname == TextureEnvParameter::Op0Alpha ||
+ pname == TextureEnvParameter::Op1Alpha ||
+ pname == TextureEnvParameter::Op2Alpha)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureCombine);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureCombineOp);
+ return false;
+ }
+ break;
+ }
+ case TextureEnvParameter::RgbScale:
+ case TextureEnvParameter::AlphaScale:
+ if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureEnvScale);
+ return false;
+ }
+ break;
+ case TextureEnvParameter::Color:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
+ return false;
+ }
+ break;
+ case TextureEnvTarget::PointSprite:
+ if (!context->getExtensions().pointSprite)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
+ return false;
+ }
+ switch (pname)
+ {
+ case TextureEnvParameter::PointCoordReplace:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvParameter);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureEnvTarget);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateGetTexEnvCommon(Context *context, TextureEnvTarget target, TextureEnvParameter pname)
+{
+ GLfloat dummy[4] = {};
+ switch (pname)
+ {
+ case TextureEnvParameter::Mode:
+ ConvertPackedEnum(TextureEnvMode::Add, dummy);
+ break;
+ case TextureEnvParameter::CombineRgb:
+ case TextureEnvParameter::CombineAlpha:
+ ConvertPackedEnum(TextureCombine::Add, dummy);
+ break;
+ case TextureEnvParameter::Src0Rgb:
+ case TextureEnvParameter::Src1Rgb:
+ case TextureEnvParameter::Src2Rgb:
+ case TextureEnvParameter::Src0Alpha:
+ case TextureEnvParameter::Src1Alpha:
+ case TextureEnvParameter::Src2Alpha:
+ ConvertPackedEnum(TextureSrc::Constant, dummy);
+ break;
+ case TextureEnvParameter::Op0Rgb:
+ case TextureEnvParameter::Op1Rgb:
+ case TextureEnvParameter::Op2Rgb:
+ case TextureEnvParameter::Op0Alpha:
+ case TextureEnvParameter::Op1Alpha:
+ case TextureEnvParameter::Op2Alpha:
+ ConvertPackedEnum(TextureOp::SrcAlpha, dummy);
+ break;
+ case TextureEnvParameter::RgbScale:
+ case TextureEnvParameter::AlphaScale:
+ case TextureEnvParameter::PointCoordReplace:
+ dummy[0] = 1.0f;
+ break;
+ default:
+ break;
+ }
+
+ return ValidateTexEnvCommon(context, target, pname, dummy);
+}
+
+bool ValidatePointParameterCommon(Context *context, PointParameter pname, const GLfloat *params)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ switch (pname)
+ {
+ case PointParameter::PointSizeMin:
+ case PointParameter::PointSizeMax:
+ case PointParameter::PointFadeThresholdSize:
+ case PointParameter::PointDistanceAttenuation:
+ for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
+ {
+ if (params[i] < 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPointParameterValue);
+ return false;
+ }
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidatePointSizeCommon(Context *context, GLfloat size)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (size <= 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPointSizeValue);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawTexCommon(Context *context, float width, float height)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (width <= 0.0f || height <= 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kNonPositiveDrawTextureDimension);
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace gl
+
+namespace gl
+{
+
+bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return ValidateAlphaFuncCommon(context, func);
+}
+
+bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return ValidateAlphaFuncCommon(context, func);
+}
+
+bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateClearDepthx(Context *context, GLfixed depth)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateClientActiveTexture(Context *context, GLenum texture)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return ValidateMultitextureUnit(context, texture);
+}
+
+bool ValidateClipPlanef(Context *context, GLenum plane, const GLfloat *eqn)
+{
+ return ValidateClipPlaneCommon(context, plane);
+}
+
+bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation)
+{
+ return ValidateClipPlaneCommon(context, plane);
+}
+
+bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateColorPointer(Context *context,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Color, size, type,
+ stride, pointer);
+}
+
+bool ValidateCullFace(Context *context, GLenum mode)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayType)
+{
+ return ValidateClientStateCommon(context, arrayType);
+}
+
+bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayType)
+{
+ return ValidateClientStateCommon(context, arrayType);
+}
+
+bool ValidateFogf(Context *context, GLenum pname, GLfloat param)
+{
+ return ValidateFogCommon(context, pname, &param);
+}
+
+bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params)
+{
+ return ValidateFogCommon(context, pname, params);
+}
+
+bool ValidateFogx(Context *context, GLenum pname, GLfixed param)
+{
+ GLfloat asFloat = FixedToFloat(param);
+ return ValidateFogCommon(context, pname, &asFloat);
+}
+
+bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *params)
+{
+ unsigned int paramCount = GetFogParameterCount(pname);
+ GLfloat paramsf[4] = {};
+
+ for (unsigned int i = 0; i < paramCount; i++)
+ {
+ paramsf[i] = FixedToFloat(params[i]);
+ }
+
+ return ValidateFogCommon(context, pname, paramsf);
+}
+
+bool ValidateFrustumf(Context *context,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
+ }
+ return true;
+}
+
+bool ValidateFrustumx(Context *context,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ if (l == r || b == t || n == f || n <= 0 || f <= 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
+ }
+ return true;
+}
+
+bool ValidateGetBufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation)
+{
+ return ValidateClipPlaneCommon(context, plane);
+}
+
+bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation)
+{
+ return ValidateClipPlaneCommon(context, plane);
+}
+
+bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGetLightfv(Context *context, GLenum light, LightParameter pname, GLfloat *params)
+{
+ GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ return ValidateLightCommon(context, light, pname, dummyParams);
+}
+
+bool ValidateGetLightxv(Context *context, GLenum light, LightParameter pname, GLfixed *params)
+{
+ GLfloat dummyParams[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ return ValidateLightCommon(context, light, pname, dummyParams);
+}
+
+bool ValidateGetMaterialfv(Context *context, GLenum face, MaterialParameter pname, GLfloat *params)
+{
+ return ValidateMaterialQuery(context, face, pname);
+}
+
+bool ValidateGetMaterialxv(Context *context, GLenum face, MaterialParameter pname, GLfixed *params)
+{
+ return ValidateMaterialQuery(context, face, pname);
+}
+
+bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ switch (pname)
+ {
+ case GL_VERTEX_ARRAY_POINTER:
+ case GL_NORMAL_ARRAY_POINTER:
+ case GL_COLOR_ARRAY_POINTER:
+ case GL_TEXTURE_COORD_ARRAY_POINTER:
+ case GL_POINT_SIZE_ARRAY_POINTER_OES:
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPointerQuery);
+ return false;
+ }
+}
+
+bool ValidateGetTexEnvfv(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLfloat *params)
+{
+ return ValidateGetTexEnvCommon(context, target, pname);
+}
+
+bool ValidateGetTexEnviv(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLint *params)
+{
+ return ValidateGetTexEnvCommon(context, target, pname);
+}
+
+bool ValidateGetTexEnvxv(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLfixed *params)
+{
+ return ValidateGetTexEnvCommon(context, target, pname);
+}
+
+bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+
+ if (!ValidateGetTexParameterBase(context, target, pname, nullptr))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param)
+{
+ return ValidateLightModelSingleComponent(context, pname);
+}
+
+bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params)
+{
+ return ValidateLightModelCommon(context, pname);
+}
+
+bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param)
+{
+ return ValidateLightModelSingleComponent(context, pname);
+}
+
+bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param)
+{
+ return ValidateLightModelCommon(context, pname);
+}
+
+bool ValidateLightf(Context *context, GLenum light, LightParameter pname, GLfloat param)
+{
+ return ValidateLightSingleComponent(context, light, pname, param);
+}
+
+bool ValidateLightfv(Context *context, GLenum light, LightParameter pname, const GLfloat *params)
+{
+ return ValidateLightCommon(context, light, pname, params);
+}
+
+bool ValidateLightx(Context *context, GLenum light, LightParameter pname, GLfixed param)
+{
+ return ValidateLightSingleComponent(context, light, pname, FixedToFloat(param));
+}
+
+bool ValidateLightxv(Context *context, GLenum light, LightParameter pname, const GLfixed *params)
+{
+ GLfloat paramsf[4];
+ for (unsigned int i = 0; i < GetLightParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(params[i]);
+ }
+
+ return ValidateLightCommon(context, light, pname, paramsf);
+}
+
+bool ValidateLineWidthx(Context *context, GLfixed width)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateLoadIdentity(Context *context)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateLoadMatrixf(Context *context, const GLfloat *m)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateLoadMatrixx(Context *context, const GLfixed *m)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateLogicOp(Context *context, LogicalOperation opcode)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ switch (opcode)
+ {
+ case LogicalOperation::And:
+ case LogicalOperation::AndInverted:
+ case LogicalOperation::AndReverse:
+ case LogicalOperation::Clear:
+ case LogicalOperation::Copy:
+ case LogicalOperation::CopyInverted:
+ case LogicalOperation::Equiv:
+ case LogicalOperation::Invert:
+ case LogicalOperation::Nand:
+ case LogicalOperation::Noop:
+ case LogicalOperation::Nor:
+ case LogicalOperation::Or:
+ case LogicalOperation::OrInverted:
+ case LogicalOperation::OrReverse:
+ case LogicalOperation::Set:
+ case LogicalOperation::Xor:
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidLogicOp);
+ return false;
+ }
+}
+
+bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pname, GLfloat param)
+{
+ return ValidateMaterialSingleComponent(context, face, pname, param);
+}
+
+bool ValidateMaterialfv(Context *context,
+ GLenum face,
+ MaterialParameter pname,
+ const GLfloat *params)
+{
+ return ValidateMaterialSetting(context, face, pname, params);
+}
+
+bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pname, GLfixed param)
+{
+ return ValidateMaterialSingleComponent(context, face, pname, FixedToFloat(param));
+}
+
+bool ValidateMaterialxv(Context *context,
+ GLenum face,
+ MaterialParameter pname,
+ const GLfixed *params)
+{
+ GLfloat paramsf[4];
+
+ for (unsigned int i = 0; i < GetMaterialParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(params[i]);
+ }
+
+ return ValidateMaterialSetting(context, face, pname, paramsf);
+}
+
+bool ValidateMatrixMode(Context *context, MatrixType mode)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ switch (mode)
+ {
+ case MatrixType::Projection:
+ case MatrixType::Modelview:
+ case MatrixType::Texture:
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidMatrixMode);
+ return false;
+ }
+}
+
+bool ValidateMultMatrixf(Context *context, const GLfloat *m)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateMultMatrixx(Context *context, const GLfixed *m)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateMultiTexCoord4f(Context *context,
+ GLenum target,
+ GLfloat s,
+ GLfloat t,
+ GLfloat r,
+ GLfloat q)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return ValidateMultitextureUnit(context, target);
+}
+
+bool ValidateMultiTexCoord4x(Context *context,
+ GLenum target,
+ GLfixed s,
+ GLfixed t,
+ GLfixed r,
+ GLfixed q)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return ValidateMultitextureUnit(context, target);
+}
+
+bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateNormalPointer(Context *context,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Normal, 3, type,
+ stride, pointer);
+}
+
+bool ValidateOrthof(Context *context,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
+ }
+ return true;
+}
+
+bool ValidateOrthox(Context *context,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ if (l == r || b == t || n == f || n <= 0 || f <= 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProjectionMatrix);
+ }
+ return true;
+}
+
+bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat param)
+{
+ unsigned int paramCount = GetPointParameterCount(pname);
+ if (paramCount != 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
+ return false;
+ }
+
+ return ValidatePointParameterCommon(context, pname, &param);
+}
+
+bool ValidatePointParameterfv(Context *context, PointParameter pname, const GLfloat *params)
+{
+ return ValidatePointParameterCommon(context, pname, params);
+}
+
+bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed param)
+{
+ unsigned int paramCount = GetPointParameterCount(pname);
+ if (paramCount != 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPointParameter);
+ return false;
+ }
+
+ GLfloat paramf = FixedToFloat(param);
+ return ValidatePointParameterCommon(context, pname, &paramf);
+}
+
+bool ValidatePointParameterxv(Context *context, PointParameter pname, const GLfixed *params)
+{
+ GLfloat paramsf[4] = {};
+ for (unsigned int i = 0; i < GetPointParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(params[i]);
+ }
+ return ValidatePointParameterCommon(context, pname, paramsf);
+}
+
+bool ValidatePointSize(Context *context, GLfloat size)
+{
+ return ValidatePointSizeCommon(context, size);
+}
+
+bool ValidatePointSizex(Context *context, GLfixed size)
+{
+ return ValidatePointSizeCommon(context, FixedToFloat(size));
+}
+
+bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidatePopMatrix(Context *context)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ const auto &stack = context->getState().gles1().currentMatrixStack();
+ if (stack.size() == 1)
+ {
+ context->validationError(GL_STACK_UNDERFLOW, kMatrixStackUnderflow);
+ return false;
+ }
+ return true;
+}
+
+bool ValidatePushMatrix(Context *context)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ const auto &stack = context->getState().gles1().currentMatrixStack();
+ if (stack.size() == stack.max_size())
+ {
+ context->validationError(GL_STACK_OVERFLOW, kMatrixStackOverflow);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateShadeModel(Context *context, ShadingModel mode)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ switch (mode)
+ {
+ case ShadingModel::Flat:
+ case ShadingModel::Smooth:
+ return true;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidShadingModel);
+ return false;
+ }
+}
+
+bool ValidateTexCoordPointer(Context *context,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::TextureCoord, size,
+ type, stride, pointer);
+}
+
+bool ValidateTexEnvf(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLfloat param)
+{
+ return ValidateTexEnvCommon(context, target, pname, &param);
+}
+
+bool ValidateTexEnvfv(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ const GLfloat *params)
+{
+ return ValidateTexEnvCommon(context, target, pname, params);
+}
+
+bool ValidateTexEnvi(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLint param)
+{
+ GLfloat paramf = static_cast<GLfloat>(param);
+ return ValidateTexEnvCommon(context, target, pname, &paramf);
+}
+
+bool ValidateTexEnviv(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ const GLint *params)
+{
+ GLfloat paramsf[4];
+ for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
+ {
+ paramsf[i] = static_cast<GLfloat>(params[i]);
+ }
+ return ValidateTexEnvCommon(context, target, pname, paramsf);
+}
+
+bool ValidateTexEnvx(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ GLfixed param)
+{
+ GLfloat paramf = static_cast<GLfloat>(param);
+ return ValidateTexEnvCommon(context, target, pname, &paramf);
+}
+
+bool ValidateTexEnvxv(Context *context,
+ TextureEnvTarget target,
+ TextureEnvParameter pname,
+ const GLfixed *params)
+{
+ GLfloat paramsf[4];
+ for (unsigned int i = 0; i < GetTextureEnvParameterCount(pname); i++)
+ {
+ paramsf[i] = static_cast<GLfloat>(params[i]);
+ }
+ return ValidateTexEnvCommon(context, target, pname, paramsf);
+}
+
+bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ GLfloat paramf = FixedToFloat(param);
+ return ValidateTexParameterBase(context, target, pname, -1, false, &paramf);
+}
+
+bool ValidateTexParameterxv(Context *context,
+ TextureType target,
+ GLenum pname,
+ const GLfixed *params)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ GLfloat paramsf[4] = {};
+ for (unsigned int i = 0; i < GetTexParameterCount(pname); i++)
+ {
+ paramsf[i] = FixedToFloat(params[i]);
+ }
+ return ValidateTexParameterBase(context, target, pname, -1, true, paramsf);
+}
+
+bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z)
+{
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return true;
+}
+
+bool ValidateVertexPointer(Context *context,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::Vertex, size, type,
+ stride, pointer);
+}
+
+bool ValidateDrawTexfOES(Context *context,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat width,
+ GLfloat height)
+{
+ return ValidateDrawTexCommon(context, width, height);
+}
+
+bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords)
+{
+ return ValidateDrawTexCommon(context, coords[3], coords[4]);
+}
+
+bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height)
+{
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
+ static_cast<GLfloat>(height));
+}
+
+bool ValidateDrawTexivOES(Context *context, const GLint *coords)
+{
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
+ static_cast<GLfloat>(coords[4]));
+}
+
+bool ValidateDrawTexsOES(Context *context,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort width,
+ GLshort height)
+{
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(width),
+ static_cast<GLfloat>(height));
+}
+
+bool ValidateDrawTexsvOES(Context *context, const GLshort *coords)
+{
+ return ValidateDrawTexCommon(context, static_cast<GLfloat>(coords[3]),
+ static_cast<GLfloat>(coords[4]));
+}
+
+bool ValidateDrawTexxOES(Context *context,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z,
+ GLfixed width,
+ GLfixed height)
+{
+ return ValidateDrawTexCommon(context, FixedToFloat(width), FixedToFloat(height));
+}
+
+bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords)
+{
+ return ValidateDrawTexCommon(context, FixedToFloat(coords[3]), FixedToFloat(coords[4]));
+}
+
+bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateMatrixIndexPointerOES(Context *context,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateWeightPointerOES(Context *context,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidatePointSizePointerOES(Context *context,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return ValidateBuiltinVertexAttributeCommon(context, ClientVertexArrayType::PointSize, 1, type,
+ stride, pointer);
+}
+
+bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateFramebufferRenderbufferOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum rbtarget,
+ GLuint renderbuffer)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateFramebufferTexture2DOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textarget,
+ GLuint texture,
+ GLint level)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGenerateMipmapOES(Context *context, TextureType target)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGetRenderbufferParameterivOES(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateRenderbufferStorageOES(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+// GL_OES_texture_cube_map
+
+bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param)
+{
+ UNIMPLEMENTED();
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationES1.h b/gfx/angle/checkout/src/libANGLE/validationES1.h
new file mode 100644
index 0000000000..e2e6248400
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES1.h
@@ -0,0 +1,20 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES1.h:
+// Inlined validation functions for OpenGL ES 1.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES1_H_
+#define LIBANGLE_VALIDATION_ES1_H_
+
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/validationES1_autogen.h"
+
+namespace gl
+{
+// Nothing here yet.
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES1_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES1_autogen.h b/gfx/angle/checkout/src/libANGLE/validationES1_autogen.h
new file mode 100644
index 0000000000..432332659f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES1_autogen.h
@@ -0,0 +1,214 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES1_autogen.h:
+// Validation functions for the OpenGL ES 1.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES1_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_ES1_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateAlphaFunc(Context *context, AlphaTestFunc funcPacked, GLfloat ref);
+bool ValidateAlphaFuncx(Context *context, AlphaTestFunc funcPacked, GLfixed ref);
+bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+bool ValidateClearDepthx(Context *context, GLfixed depth);
+bool ValidateClientActiveTexture(Context *context, GLenum texture);
+bool ValidateClipPlanef(Context *context, GLenum p, const GLfloat *eqn);
+bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation);
+bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+bool ValidateColorPointer(Context *context,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateDepthRangex(Context *context, GLfixed n, GLfixed f);
+bool ValidateDisableClientState(Context *context, ClientVertexArrayType arrayPacked);
+bool ValidateEnableClientState(Context *context, ClientVertexArrayType arrayPacked);
+bool ValidateFogf(Context *context, GLenum pname, GLfloat param);
+bool ValidateFogfv(Context *context, GLenum pname, const GLfloat *params);
+bool ValidateFogx(Context *context, GLenum pname, GLfixed param);
+bool ValidateFogxv(Context *context, GLenum pname, const GLfixed *param);
+bool ValidateFrustumf(Context *context,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f);
+bool ValidateFrustumx(Context *context,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f);
+bool ValidateGetClipPlanef(Context *context, GLenum plane, GLfloat *equation);
+bool ValidateGetClipPlanex(Context *context, GLenum plane, GLfixed *equation);
+bool ValidateGetFixedv(Context *context, GLenum pname, GLfixed *params);
+bool ValidateGetLightfv(Context *context,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfloat *params);
+bool ValidateGetLightxv(Context *context,
+ GLenum light,
+ LightParameter pnamePacked,
+ GLfixed *params);
+bool ValidateGetMaterialfv(Context *context,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfloat *params);
+bool ValidateGetMaterialxv(Context *context,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ GLfixed *params);
+bool ValidateGetPointerv(Context *context, GLenum pname, void **params);
+bool ValidateGetTexEnvfv(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfloat *params);
+bool ValidateGetTexEnviv(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLint *params);
+bool ValidateGetTexEnvxv(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfixed *params);
+bool ValidateGetTexParameterxv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfixed *params);
+bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param);
+bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params);
+bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param);
+bool ValidateLightModelxv(Context *context, GLenum pname, const GLfixed *param);
+bool ValidateLightf(Context *context, GLenum light, LightParameter pnamePacked, GLfloat param);
+bool ValidateLightfv(Context *context,
+ GLenum light,
+ LightParameter pnamePacked,
+ const GLfloat *params);
+bool ValidateLightx(Context *context, GLenum light, LightParameter pnamePacked, GLfixed param);
+bool ValidateLightxv(Context *context,
+ GLenum light,
+ LightParameter pnamePacked,
+ const GLfixed *params);
+bool ValidateLineWidthx(Context *context, GLfixed width);
+bool ValidateLoadIdentity(Context *context);
+bool ValidateLoadMatrixf(Context *context, const GLfloat *m);
+bool ValidateLoadMatrixx(Context *context, const GLfixed *m);
+bool ValidateLogicOp(Context *context, LogicalOperation opcodePacked);
+bool ValidateMaterialf(Context *context, GLenum face, MaterialParameter pnamePacked, GLfloat param);
+bool ValidateMaterialfv(Context *context,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ const GLfloat *params);
+bool ValidateMaterialx(Context *context, GLenum face, MaterialParameter pnamePacked, GLfixed param);
+bool ValidateMaterialxv(Context *context,
+ GLenum face,
+ MaterialParameter pnamePacked,
+ const GLfixed *param);
+bool ValidateMatrixMode(Context *context, MatrixType modePacked);
+bool ValidateMultMatrixf(Context *context, const GLfloat *m);
+bool ValidateMultMatrixx(Context *context, const GLfixed *m);
+bool ValidateMultiTexCoord4f(Context *context,
+ GLenum target,
+ GLfloat s,
+ GLfloat t,
+ GLfloat r,
+ GLfloat q);
+bool ValidateMultiTexCoord4x(Context *context,
+ GLenum texture,
+ GLfixed s,
+ GLfixed t,
+ GLfixed r,
+ GLfixed q);
+bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz);
+bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz);
+bool ValidateNormalPointer(Context *context,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateOrthof(Context *context,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f);
+bool ValidateOrthox(Context *context,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f);
+bool ValidatePointParameterf(Context *context, PointParameter pnamePacked, GLfloat param);
+bool ValidatePointParameterfv(Context *context, PointParameter pnamePacked, const GLfloat *params);
+bool ValidatePointParameterx(Context *context, PointParameter pnamePacked, GLfixed param);
+bool ValidatePointParameterxv(Context *context, PointParameter pnamePacked, const GLfixed *params);
+bool ValidatePointSize(Context *context, GLfloat size);
+bool ValidatePointSizex(Context *context, GLfixed size);
+bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units);
+bool ValidatePopMatrix(Context *context);
+bool ValidatePushMatrix(Context *context);
+bool ValidateRotatef(Context *context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+bool ValidateRotatex(Context *context, GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+bool ValidateSampleCoveragex(Context *context, GLclampx value, GLboolean invert);
+bool ValidateScalef(Context *context, GLfloat x, GLfloat y, GLfloat z);
+bool ValidateScalex(Context *context, GLfixed x, GLfixed y, GLfixed z);
+bool ValidateShadeModel(Context *context, ShadingModel modePacked);
+bool ValidateTexCoordPointer(Context *context,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateTexEnvf(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfloat param);
+bool ValidateTexEnvfv(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLfloat *params);
+bool ValidateTexEnvi(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLint param);
+bool ValidateTexEnviv(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLint *params);
+bool ValidateTexEnvx(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ GLfixed param);
+bool ValidateTexEnvxv(Context *context,
+ TextureEnvTarget targetPacked,
+ TextureEnvParameter pnamePacked,
+ const GLfixed *params);
+bool ValidateTexParameterx(Context *context, TextureType targetPacked, GLenum pname, GLfixed param);
+bool ValidateTexParameterxv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLfixed *params);
+bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z);
+bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z);
+bool ValidateVertexPointer(Context *context,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES2.cpp b/gfx/angle/checkout/src/libANGLE/validationES2.cpp
new file mode 100644
index 0000000000..df0aab4b09
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES2.cpp
@@ -0,0 +1,7187 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES2.cpp: Validation functions for OpenGL ES 2.0 entry point parameters
+
+#include "libANGLE/validationES2_autogen.h"
+
+#include <cstdint>
+
+#include "common/mathutil.h"
+#include "common/string_utils.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/Fence.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Shader.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/Uniform.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/validationES.h"
+#include "libANGLE/validationES2.h"
+#include "libANGLE/validationES3_autogen.h"
+
+namespace gl
+{
+using namespace err;
+
+namespace
+{
+
+bool IsPartialBlit(gl::Context *context,
+ const FramebufferAttachment *readBuffer,
+ const FramebufferAttachment *writeBuffer,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1)
+{
+ const Extents &writeSize = writeBuffer->getSize();
+ const Extents &readSize = readBuffer->getSize();
+
+ if (srcX0 != 0 || srcY0 != 0 || dstX0 != 0 || dstY0 != 0 || dstX1 != writeSize.width ||
+ dstY1 != writeSize.height || srcX1 != readSize.width || srcY1 != readSize.height)
+ {
+ return true;
+ }
+
+ if (context->getState().isScissorTestEnabled())
+ {
+ const Rectangle &scissor = context->getState().getScissor();
+ return scissor.x > 0 || scissor.y > 0 || scissor.width < writeSize.width ||
+ scissor.height < writeSize.height;
+ }
+
+ return false;
+}
+
+template <typename T>
+bool ValidatePathInstances(gl::Context *context,
+ GLsizei numPaths,
+ const void *paths,
+ GLuint pathBase)
+{
+ const auto *array = static_cast<const T *>(paths);
+
+ for (GLsizei i = 0; i < numPaths; ++i)
+ {
+ const GLuint pathName = array[i] + pathBase;
+ if (context->isPathGenerated(pathName) && !context->isPath(pathName))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoSuchPath);
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateInstancedPathParameters(gl::Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (paths == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathNameArray);
+ return false;
+ }
+
+ if (numPaths < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathNumPaths);
+ return false;
+ }
+
+ if (!angle::IsValueInRangeForNumericType<std::uint32_t>(numPaths))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ std::uint32_t pathNameTypeSize = 0;
+ std::uint32_t componentCount = 0;
+
+ switch (pathNameType)
+ {
+ case GL_UNSIGNED_BYTE:
+ pathNameTypeSize = sizeof(GLubyte);
+ if (!ValidatePathInstances<GLubyte>(context, numPaths, paths, pathBase))
+ return false;
+ break;
+
+ case GL_BYTE:
+ pathNameTypeSize = sizeof(GLbyte);
+ if (!ValidatePathInstances<GLbyte>(context, numPaths, paths, pathBase))
+ return false;
+ break;
+
+ case GL_UNSIGNED_SHORT:
+ pathNameTypeSize = sizeof(GLushort);
+ if (!ValidatePathInstances<GLushort>(context, numPaths, paths, pathBase))
+ return false;
+ break;
+
+ case GL_SHORT:
+ pathNameTypeSize = sizeof(GLshort);
+ if (!ValidatePathInstances<GLshort>(context, numPaths, paths, pathBase))
+ return false;
+ break;
+
+ case GL_UNSIGNED_INT:
+ pathNameTypeSize = sizeof(GLuint);
+ if (!ValidatePathInstances<GLuint>(context, numPaths, paths, pathBase))
+ return false;
+ break;
+
+ case GL_INT:
+ pathNameTypeSize = sizeof(GLint);
+ if (!ValidatePathInstances<GLint>(context, numPaths, paths, pathBase))
+ return false;
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathNameType);
+ return false;
+ }
+
+ switch (transformType)
+ {
+ case GL_NONE:
+ componentCount = 0;
+ break;
+ case GL_TRANSLATE_X_CHROMIUM:
+ case GL_TRANSLATE_Y_CHROMIUM:
+ componentCount = 1;
+ break;
+ case GL_TRANSLATE_2D_CHROMIUM:
+ componentCount = 2;
+ break;
+ case GL_TRANSLATE_3D_CHROMIUM:
+ componentCount = 3;
+ break;
+ case GL_AFFINE_2D_CHROMIUM:
+ case GL_TRANSPOSE_AFFINE_2D_CHROMIUM:
+ componentCount = 6;
+ break;
+ case GL_AFFINE_3D_CHROMIUM:
+ case GL_TRANSPOSE_AFFINE_3D_CHROMIUM:
+ componentCount = 12;
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTransformation);
+ return false;
+ }
+ if (componentCount != 0 && transformValues == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kNoTransformArray);
+ return false;
+ }
+
+ angle::CheckedNumeric<std::uint32_t> checkedSize(0);
+ checkedSize += (numPaths * pathNameTypeSize);
+ checkedSize += (numPaths * sizeof(GLfloat) * componentCount);
+ if (!checkedSize.IsValid())
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ return true;
+}
+
+bool IsValidCopyTextureSourceInternalFormatEnum(GLenum internalFormat)
+{
+ // Table 1.1 from the CHROMIUM_copy_texture spec
+ switch (GetUnsizedFormat(internalFormat))
+ {
+ case GL_RED:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGB:
+ case GL_RGBA:
+ case GL_RGB8:
+ case GL_RGBA8:
+ case GL_BGRA_EXT:
+ case GL_BGRA8_EXT:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool IsValidCopySubTextureSourceInternalFormat(GLenum internalFormat)
+{
+ return IsValidCopyTextureSourceInternalFormatEnum(internalFormat);
+}
+
+bool IsValidCopyTextureDestinationInternalFormatEnum(GLint internalFormat)
+{
+ // Table 1.0 from the CHROMIUM_copy_texture spec
+ switch (internalFormat)
+ {
+ case GL_RGB:
+ case GL_RGBA:
+ case GL_RGB8:
+ case GL_RGBA8:
+ case GL_BGRA_EXT:
+ case GL_BGRA8_EXT:
+ case GL_SRGB_EXT:
+ case GL_SRGB_ALPHA_EXT:
+ case GL_R8:
+ case GL_R8UI:
+ case GL_RG8:
+ case GL_RG8UI:
+ case GL_SRGB8:
+ case GL_RGB565:
+ case GL_RGB8UI:
+ case GL_RGB10_A2:
+ case GL_SRGB8_ALPHA8:
+ case GL_RGB5_A1:
+ case GL_RGBA4:
+ case GL_RGBA8UI:
+ case GL_RGB9_E5:
+ case GL_R16F:
+ case GL_R32F:
+ case GL_RG16F:
+ case GL_RG32F:
+ case GL_RGB16F:
+ case GL_RGB32F:
+ case GL_RGBA16F:
+ case GL_RGBA32F:
+ case GL_R11F_G11F_B10F:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_ALPHA:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool IsValidCopySubTextureDestionationInternalFormat(GLenum internalFormat)
+{
+ return IsValidCopyTextureDestinationInternalFormatEnum(internalFormat);
+}
+
+bool IsValidCopyTextureDestinationFormatType(Context *context, GLint internalFormat, GLenum type)
+{
+ if (!IsValidCopyTextureDestinationInternalFormatEnum(internalFormat))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ if (!ValidES3FormatCombination(GetUnsizedFormat(internalFormat), type, internalFormat))
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+
+ const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat, type);
+ if (!internalFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ return true;
+}
+
+bool IsValidCopyTextureDestinationTargetEnum(Context *context, TextureTarget target)
+{
+ switch (target)
+ {
+ case TextureTarget::_2D:
+ case TextureTarget::CubeMapNegativeX:
+ case TextureTarget::CubeMapNegativeY:
+ case TextureTarget::CubeMapNegativeZ:
+ case TextureTarget::CubeMapPositiveX:
+ case TextureTarget::CubeMapPositiveY:
+ case TextureTarget::CubeMapPositiveZ:
+ return true;
+
+ case TextureTarget::Rectangle:
+ return context->getExtensions().textureRectangle;
+
+ default:
+ return false;
+ }
+}
+
+bool IsValidCopyTextureDestinationTarget(Context *context,
+ TextureType textureType,
+ TextureTarget target)
+{
+ return TextureTargetToType(target) == textureType;
+}
+
+bool IsValidCopyTextureSourceTarget(Context *context, TextureType type)
+{
+ switch (type)
+ {
+ case TextureType::_2D:
+ return true;
+ case TextureType::Rectangle:
+ return context->getExtensions().textureRectangle;
+ case TextureType::External:
+ return context->getExtensions().eglImageExternal;
+ default:
+ return false;
+ }
+}
+
+bool IsValidCopyTextureSourceLevel(Context *context, TextureType type, GLint level)
+{
+ if (!ValidMipLevel(context, type, level))
+ {
+ return false;
+ }
+
+ if (level > 0 && context->getClientVersion() < ES_3_0)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool IsValidCopyTextureDestinationLevel(Context *context,
+ TextureType type,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ bool isSubImage)
+{
+ if (!ValidMipLevel(context, type, level))
+ {
+ return false;
+ }
+
+ if (!ValidImageSizeParameters(context, type, level, width, height, 1, isSubImage))
+ {
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ switch (type)
+ {
+ case TextureType::_2D:
+ return static_cast<GLuint>(width) <= (caps.max2DTextureSize >> level) &&
+ static_cast<GLuint>(height) <= (caps.max2DTextureSize >> level);
+ case TextureType::Rectangle:
+ ASSERT(level == 0);
+ return static_cast<GLuint>(width) <= (caps.max2DTextureSize >> level) &&
+ static_cast<GLuint>(height) <= (caps.max2DTextureSize >> level);
+
+ case TextureType::CubeMap:
+ return static_cast<GLuint>(width) <= (caps.maxCubeMapTextureSize >> level) &&
+ static_cast<GLuint>(height) <= (caps.maxCubeMapTextureSize >> level);
+ default:
+ return true;
+ }
+}
+
+bool IsValidStencilFunc(GLenum func)
+{
+ switch (func)
+ {
+ case GL_NEVER:
+ case GL_ALWAYS:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_EQUAL:
+ case GL_GEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool IsValidStencilFace(GLenum face)
+{
+ switch (face)
+ {
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool IsValidStencilOp(GLenum op)
+{
+ switch (op)
+ {
+ case GL_ZERO:
+ case GL_KEEP:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_DECR:
+ case GL_INVERT:
+ case GL_INCR_WRAP:
+ case GL_DECR_WRAP:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidateES2CopyTexImageParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ TextureType texType = TextureTargetToType(target);
+ if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage))
+ {
+ // Error is already handled.
+ return false;
+ }
+
+ Format textureFormat = Format::Invalid();
+ if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+ xoffset, yoffset, 0, x, y, width, height, border,
+ &textureFormat))
+ {
+ return false;
+ }
+
+ const gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
+ GLenum colorbufferFormat =
+ framebuffer->getReadColorAttachment()->getFormat().info->sizedInternalFormat;
+ const auto &formatInfo = *textureFormat.info;
+
+ // [OpenGL ES 2.0.24] table 3.9
+ if (isSubImage)
+ {
+ switch (formatInfo.format)
+ {
+ case GL_ALPHA:
+ if (colorbufferFormat != GL_ALPHA8_EXT && colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_RGBA8_OES &&
+ colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_LUMINANCE:
+ if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_RED_EXT:
+ if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_R32F &&
+ colorbufferFormat != GL_RG32F && colorbufferFormat != GL_RGB32F &&
+ colorbufferFormat != GL_RGBA32F && colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_RG_EXT:
+ if (colorbufferFormat != GL_RG8_EXT && colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES && colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_RGBA8_OES &&
+ colorbufferFormat != GL_RG32F && colorbufferFormat != GL_RGB32F &&
+ colorbufferFormat != GL_RGBA32F && colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_RGB:
+ if (colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_RGB32F &&
+ colorbufferFormat != GL_RGBA32F && colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGBA:
+ if (colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_RGBA32F &&
+ colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ case GL_ETC1_RGB8_OES:
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGBA_BPTC_UNORM_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:
+ case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT:
+ case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT:
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL_OES:
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+
+ if (formatInfo.type == GL_FLOAT && !context->getExtensions().textureFloat)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ }
+ else
+ {
+ 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 && colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_LUMINANCE:
+ if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_RED_EXT:
+ if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
+ colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
+ colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_RG_EXT:
+ if (colorbufferFormat != GL_RG8_EXT && colorbufferFormat != GL_RGB565 &&
+ colorbufferFormat != GL_RGB8_OES && colorbufferFormat != GL_RGBA4 &&
+ colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_BGRA8_EXT &&
+ colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ 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 &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGBA:
+ if (colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
+ colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
+ colorbufferFormat != GL_BGR5_A1_ANGLEX)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (context->getExtensions().textureCompressionDXT1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ if (context->getExtensions().textureCompressionDXT3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ if (context->getExtensions().textureCompressionDXT5)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_ETC1_RGB8_OES:
+ if (context->getExtensions().compressedETC1RGB8Texture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ if (context->getExtensions().lossyETCDecode)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT32_OES:
+ if (context->getExtensions().depthTextureAny())
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_DEPTH_STENCIL_OES:
+ case GL_DEPTH24_STENCIL8_OES:
+ if (context->getExtensions().depthTextureAny() ||
+ context->getExtensions().packedDepthStencil)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ }
+
+ // If width or height is zero, it is a no-op. Return false without setting an error.
+ return (width > 0 && height > 0);
+}
+
+bool ValidCap(const Context *context, GLenum cap, bool queryOnly)
+{
+ switch (cap)
+ {
+ // EXT_multisample_compatibility
+ case GL_MULTISAMPLE_EXT:
+ case GL_SAMPLE_ALPHA_TO_ONE_EXT:
+ return context->getExtensions().multisampleCompatibility;
+
+ case GL_CULL_FACE:
+ case GL_POLYGON_OFFSET_FILL:
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ case GL_SAMPLE_COVERAGE:
+ case GL_SCISSOR_TEST:
+ case GL_STENCIL_TEST:
+ case GL_DEPTH_TEST:
+ case GL_BLEND:
+ case GL_DITHER:
+ return true;
+
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ case GL_RASTERIZER_DISCARD:
+ return (context->getClientMajorVersion() >= 3);
+
+ case GL_DEBUG_OUTPUT_SYNCHRONOUS:
+ case GL_DEBUG_OUTPUT:
+ return context->getExtensions().debug;
+
+ case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
+ return queryOnly && context->getExtensions().bindGeneratesResource;
+
+ case GL_CLIENT_ARRAYS_ANGLE:
+ return queryOnly && context->getExtensions().clientArrays;
+
+ case GL_FRAMEBUFFER_SRGB_EXT:
+ return context->getExtensions().sRGBWriteControl;
+
+ case GL_SAMPLE_MASK:
+ return context->getClientVersion() >= Version(3, 1);
+
+ case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
+ return queryOnly && context->getExtensions().robustResourceInitialization;
+
+ // GLES1 emulation: GLES1-specific caps
+ case GL_ALPHA_TEST:
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_TEXTURE_2D:
+ case GL_LIGHTING:
+ case GL_LIGHT0:
+ case GL_LIGHT1:
+ case GL_LIGHT2:
+ case GL_LIGHT3:
+ case GL_LIGHT4:
+ case GL_LIGHT5:
+ case GL_LIGHT6:
+ case GL_LIGHT7:
+ case GL_NORMALIZE:
+ case GL_RESCALE_NORMAL:
+ case GL_COLOR_MATERIAL:
+ case GL_CLIP_PLANE0:
+ case GL_CLIP_PLANE1:
+ case GL_CLIP_PLANE2:
+ case GL_CLIP_PLANE3:
+ case GL_CLIP_PLANE4:
+ case GL_CLIP_PLANE5:
+ case GL_FOG:
+ case GL_POINT_SMOOTH:
+ case GL_LINE_SMOOTH:
+ case GL_COLOR_LOGIC_OP:
+ return context->getClientVersion() < Version(2, 0);
+ case GL_POINT_SIZE_ARRAY_OES:
+ return context->getClientVersion() < Version(2, 0) &&
+ context->getExtensions().pointSizeArray;
+ case GL_TEXTURE_CUBE_MAP:
+ return context->getClientVersion() < Version(2, 0) &&
+ context->getExtensions().textureCubeMap;
+ case GL_POINT_SPRITE_OES:
+ return context->getClientVersion() < Version(2, 0) &&
+ context->getExtensions().pointSprite;
+ default:
+ return false;
+ }
+}
+
+// Return true if a character belongs to the ASCII subset as defined in GLSL ES 1.0 spec section
+// 3.1.
+bool IsValidESSLCharacter(unsigned char c)
+{
+ // Printing characters are valid except " $ ` @ \ ' DEL.
+ if (c >= 32 && c <= 126 && c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' &&
+ c != '\'')
+ {
+ return true;
+ }
+
+ // Horizontal tab, line feed, vertical tab, form feed, carriage return are also valid.
+ if (c >= 9 && c <= 13)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool IsValidESSLString(const char *str, size_t len)
+{
+ for (size_t i = 0; i < len; i++)
+ {
+ if (!IsValidESSLCharacter(str[i]))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool IsValidESSLShaderSourceString(const char *str, size_t len, bool lineContinuationAllowed)
+{
+ enum class ParseState
+ {
+ // Have not seen an ASCII non-whitespace character yet on
+ // this line. Possible that we might see a preprocessor
+ // directive.
+ BEGINING_OF_LINE,
+
+ // Have seen at least one ASCII non-whitespace character
+ // on this line.
+ MIDDLE_OF_LINE,
+
+ // Handling a preprocessor directive. Passes through all
+ // characters up to the end of the line. Disables comment
+ // processing.
+ IN_PREPROCESSOR_DIRECTIVE,
+
+ // Handling a single-line comment. The comment text is
+ // replaced with a single space.
+ IN_SINGLE_LINE_COMMENT,
+
+ // Handling a multi-line comment. Newlines are passed
+ // through to preserve line numbers.
+ IN_MULTI_LINE_COMMENT
+ };
+
+ ParseState state = ParseState::BEGINING_OF_LINE;
+ size_t pos = 0;
+
+ while (pos < len)
+ {
+ char c = str[pos];
+ char next = pos + 1 < len ? str[pos + 1] : 0;
+
+ // Check for newlines
+ if (c == '\n' || c == '\r')
+ {
+ if (state != ParseState::IN_MULTI_LINE_COMMENT)
+ {
+ state = ParseState::BEGINING_OF_LINE;
+ }
+
+ pos++;
+ continue;
+ }
+
+ switch (state)
+ {
+ case ParseState::BEGINING_OF_LINE:
+ if (c == ' ')
+ {
+ // Maintain the BEGINING_OF_LINE state until a non-space is seen
+ pos++;
+ }
+ else if (c == '#')
+ {
+ state = ParseState::IN_PREPROCESSOR_DIRECTIVE;
+ pos++;
+ }
+ else
+ {
+ // Don't advance, re-process this character with the MIDDLE_OF_LINE state
+ state = ParseState::MIDDLE_OF_LINE;
+ }
+ break;
+
+ case ParseState::MIDDLE_OF_LINE:
+ if (c == '/' && next == '/')
+ {
+ state = ParseState::IN_SINGLE_LINE_COMMENT;
+ pos++;
+ }
+ else if (c == '/' && next == '*')
+ {
+ state = ParseState::IN_MULTI_LINE_COMMENT;
+ pos++;
+ }
+ else if (lineContinuationAllowed && c == '\\' && (next == '\n' || next == '\r'))
+ {
+ // Skip line continuation characters
+ }
+ else if (!IsValidESSLCharacter(c))
+ {
+ return false;
+ }
+ pos++;
+ break;
+
+ case ParseState::IN_PREPROCESSOR_DIRECTIVE:
+ // Line-continuation characters may not be permitted.
+ // Otherwise, just pass it through. Do not parse comments in this state.
+ if (!lineContinuationAllowed && c == '\\')
+ {
+ return false;
+ }
+ pos++;
+ break;
+
+ case ParseState::IN_SINGLE_LINE_COMMENT:
+ // Line-continuation characters are processed before comment processing.
+ // Advance string if a new line character is immediately behind
+ // line-continuation character.
+ if (c == '\\' && (next == '\n' || next == '\r'))
+ {
+ pos++;
+ }
+ pos++;
+ break;
+
+ case ParseState::IN_MULTI_LINE_COMMENT:
+ if (c == '*' && next == '/')
+ {
+ state = ParseState::MIDDLE_OF_LINE;
+ pos++;
+ }
+ pos++;
+ break;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateWebGLNamePrefix(Context *context, const GLchar *name)
+{
+ ASSERT(context->isWebGL());
+
+ // WebGL 1.0 [Section 6.16] GLSL Constructs
+ // Identifiers starting with "webgl_" and "_webgl_" are reserved for use by WebGL.
+ if (strncmp(name, "webgl_", 6) == 0 || strncmp(name, "_webgl_", 7) == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kWebglBindAttribLocationReservedPrefix);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateWebGLNameLength(Context *context, size_t length)
+{
+ ASSERT(context->isWebGL());
+
+ if (context->isWebGL1() && length > 256)
+ {
+ // WebGL 1.0 [Section 6.21] Maxmimum Uniform and Attribute Location Lengths
+ // WebGL imposes a limit of 256 characters on the lengths of uniform and attribute
+ // locations.
+ context->validationError(GL_INVALID_VALUE, kWebglNameLengthLimitExceeded);
+
+ return false;
+ }
+ else if (length > 1024)
+ {
+ // WebGL 2.0 [Section 4.3.2] WebGL 2.0 imposes a limit of 1024 characters on the lengths of
+ // uniform and attribute locations.
+ context->validationError(GL_INVALID_VALUE, kWebgl2NameLengthLimitExceeded);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateMatrixMode(Context *context, GLenum matrixMode)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (matrixMode != GL_PATH_MODELVIEW_CHROMIUM && matrixMode != GL_PATH_PROJECTION_CHROMIUM)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidMatrixMode);
+ return false;
+ }
+ return true;
+}
+
+bool ValidBlendFunc(const Context *context, GLenum val)
+{
+ const gl::Extensions &ext = context->getExtensions();
+
+ // these are always valid for src and dst.
+ switch (val)
+ {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ return true;
+
+ // EXT_blend_func_extended.
+ case GL_SRC1_COLOR_EXT:
+ case GL_SRC1_ALPHA_EXT:
+ case GL_ONE_MINUS_SRC1_COLOR_EXT:
+ case GL_ONE_MINUS_SRC1_ALPHA_EXT:
+ case GL_SRC_ALPHA_SATURATE_EXT:
+ return ext.blendFuncExtended;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidSrcBlendFunc(const Context *context, GLenum val)
+{
+ if (ValidBlendFunc(context, val))
+ return true;
+
+ if (val == GL_SRC_ALPHA_SATURATE)
+ return true;
+
+ return false;
+}
+
+bool ValidDstBlendFunc(const Context *context, GLenum val)
+{
+ if (ValidBlendFunc(context, val))
+ return true;
+
+ if (val == GL_SRC_ALPHA_SATURATE)
+ {
+ if (context->getClientMajorVersion() >= 3)
+ return true;
+ }
+
+ return false;
+}
+
+bool IsValidImageLayout(ImageLayout layout)
+{
+ switch (layout)
+ {
+ case ImageLayout::Undefined:
+ case ImageLayout::General:
+ case ImageLayout::ColorAttachment:
+ case ImageLayout::DepthStencilAttachment:
+ case ImageLayout::DepthStencilReadOnlyAttachment:
+ case ImageLayout::ShaderReadOnly:
+ case ImageLayout::TransferSrc:
+ case ImageLayout::TransferDst:
+ case ImageLayout::DepthReadOnlyStencilAttachment:
+ case ImageLayout::DepthAttachmentStencilReadOnly:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidateES2TexImageParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei imageSize,
+ const void *pixels)
+{
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ return ValidateES2TexImageParametersBase(context, target, level, internalformat, isCompressed,
+ isSubImage, xoffset, yoffset, width, height, border,
+ format, type, imageSize, pixels);
+}
+
+} // anonymous namespace
+
+bool ValidateES2TexImageParametersBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei imageSize,
+ const void *pixels)
+{
+
+ TextureType texType = TextureTargetToType(target);
+ if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage))
+ {
+ // Error already handled.
+ return false;
+ }
+
+ if (!ValidMipLevel(context, texType, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ if (xoffset < 0 || std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ std::numeric_limits<GLsizei>::max() - yoffset < height)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+
+ const gl::Caps &caps = context->getCaps();
+
+ switch (texType)
+ {
+ case TextureType::_2D:
+ case TextureType::External:
+ if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
+ static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+
+ case TextureType::Rectangle:
+ ASSERT(level == 0);
+ if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
+ static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ if (isCompressed)
+ {
+ context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
+ return false;
+ }
+ break;
+
+ case TextureType::CubeMap:
+ if (!isSubImage && width != height)
+ {
+ context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions);
+ return false;
+ }
+
+ if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level) ||
+ static_cast<GLuint>(height) > (caps.maxCubeMapTextureSize >> level))
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ gl::Texture *texture = context->getTextureByType(texType);
+ if (!texture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferNotBound);
+ return false;
+ }
+
+ // Verify zero border
+ if (border != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBorder);
+ return false;
+ }
+
+ bool nonEqualFormatsAllowed = false;
+
+ if (isCompressed)
+ {
+ GLenum actualInternalFormat =
+ isSubImage ? texture->getFormat(target, level).info->sizedInternalFormat
+ : internalformat;
+
+ const InternalFormat &internalFormatInfo = GetSizedInternalFormatInfo(actualInternalFormat);
+
+ if (!internalFormatInfo.compressed)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidInternalFormat);
+ return false;
+ }
+
+ if (!internalFormatInfo.textureSupport(context->getClientVersion(),
+ context->getExtensions()))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidInternalFormat);
+ return false;
+ }
+
+ if (isSubImage)
+ {
+ // From the OES_compressed_ETC1_RGB8_texture spec:
+ // INVALID_OPERATION is generated by CompressedTexSubImage2D, TexSubImage2D, or
+ // CopyTexSubImage2D if the texture image <level> bound to <target> has internal format
+ // ETC1_RGB8_OES.
+ if (actualInternalFormat == GL_ETC1_RGB8_OES)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ if (!ValidCompressedSubImageSize(context, actualInternalFormat, xoffset, yoffset, 0,
+ width, height, 1, texture->getWidth(target, level),
+ texture->getHeight(target, level),
+ texture->getDepth(target, level)))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
+ return false;
+ }
+
+ if (format != actualInternalFormat)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ }
+ else
+ {
+ if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height, 1))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
+ return false;
+ }
+ }
+ }
+ else
+ {
+ // 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:
+ context->validationError(GL_INVALID_ENUM, kInvalidType);
+ return false;
+ }
+
+ // validate <format> + <type> combinations
+ // - invalid <format> -> sets INVALID_ENUM
+ // - invalid <format>+<type> combination -> sets INVALID_OPERATION
+ switch (format)
+ {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ case GL_RED:
+ case GL_RG:
+ if (!context->getExtensions().textureRG)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ if (!context->getExtensions().textureFloat)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ case GL_RGB:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ case GL_RGBA:
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ case GL_BGRA_EXT:
+ if (!context->getExtensions().textureFormatBGRA8888)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ case GL_SRGB_EXT:
+ case GL_SRGB_ALPHA_EXT:
+ if (!context->getExtensions().sRGB)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ switch (type)
+ {
+ case GL_UNSIGNED_BYTE:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // error cases for compressed textures are
+ // handled below
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ break;
+ case GL_DEPTH_COMPONENT:
+ switch (type)
+ {
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_INT:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ case GL_DEPTH_STENCIL_OES:
+ switch (type)
+ {
+ case GL_UNSIGNED_INT_24_8_OES:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ switch (format)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (context->getExtensions().textureCompressionDXT1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ if (context->getExtensions().textureCompressionDXT3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ if (context->getExtensions().textureCompressionDXT5)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_ETC1_RGB8_OES:
+ if (context->getExtensions().compressedETC1RGB8Texture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ if (context->getExtensions().lossyETCDecode)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL_OES:
+ if (!context->getExtensions().depthTextureANGLE &&
+ !(context->getExtensions().packedDepthStencil &&
+ context->getExtensions().depthTextureOES))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ if (target != TextureTarget::_2D)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat);
+ return false;
+ }
+ // OES_depth_texture supports loading depth data and multiple levels,
+ // but ANGLE_depth_texture does not
+ if (!context->getExtensions().depthTextureOES)
+ {
+ if (pixels != nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kPixelDataNotNull);
+ return false;
+ }
+ if (level != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kLevelNotZero);
+ return false;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!isSubImage)
+ {
+ switch (internalformat)
+ {
+ // Core ES 2.0 formats
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RGB:
+ case GL_RGBA:
+ break;
+
+ case GL_RGBA32F:
+ if (!context->getExtensions().colorBufferFloatRGBA)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ nonEqualFormatsAllowed = true;
+
+ if (type != GL_FLOAT)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ if (format != GL_RGBA)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+
+ case GL_RGB32F:
+ if (!context->getExtensions().colorBufferFloatRGB)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ nonEqualFormatsAllowed = true;
+
+ if (type != GL_FLOAT)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ if (format != GL_RGB)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
+ return false;
+ }
+ break;
+
+ case GL_BGRA_EXT:
+ if (!context->getExtensions().textureFormatBGRA8888)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+ break;
+
+ case GL_DEPTH_COMPONENT:
+ if (!(context->getExtensions().depthTextureAny()))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+ break;
+
+ case GL_DEPTH_STENCIL:
+ if (!(context->getExtensions().depthTextureANGLE ||
+ context->getExtensions().packedDepthStencil))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+ break;
+
+ case GL_RED:
+ case GL_RG:
+ if (!context->getExtensions().textureRG)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+ break;
+
+ case GL_SRGB_EXT:
+ case GL_SRGB_ALPHA_EXT:
+ if (!context->getExtensions().sRGB)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_VALUE, kInvalidInternalFormat);
+ return false;
+ }
+ }
+
+ if (type == GL_FLOAT)
+ {
+ if (!context->getExtensions().textureFloat)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ }
+ else if (type == GL_HALF_FLOAT_OES)
+ {
+ if (!context->getExtensions().textureHalfFloat)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ }
+ }
+
+ if (isSubImage)
+ {
+ const InternalFormat &textureInternalFormat = *texture->getFormat(target, level).info;
+ if (textureInternalFormat.internalFormat == GL_NONE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureLevel);
+ return false;
+ }
+
+ if (format != textureInternalFormat.format)
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kTextureFormatMismatch);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility)
+ {
+ if (GetInternalFormatInfo(format, type).sizedInternalFormat !=
+ textureInternalFormat.sizedInternalFormat)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureTypeMismatch);
+ return false;
+ }
+ }
+
+ if (static_cast<size_t>(xoffset + width) > texture->getWidth(target, level) ||
+ static_cast<size_t>(yoffset + height) > texture->getHeight(target, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
+ return false;
+ }
+
+ if (width > 0 && height > 0 && pixels == nullptr &&
+ context->getState().getTargetBuffer(BufferBinding::PixelUnpack) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kPixelDataNull);
+ return false;
+ }
+ }
+ else
+ {
+ if (texture->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureIsImmutable);
+ return false;
+ }
+ }
+
+ // From GL_CHROMIUM_color_buffer_float_rgb[a]:
+ // GL_RGB[A] / GL_RGB[A]32F becomes an allowable format / internalformat parameter pair for
+ // TexImage2D. The restriction in section 3.7.1 of the OpenGL ES 2.0 spec that the
+ // internalformat parameter and format parameter of TexImage2D must match is lifted for this
+ // case.
+ if (!isSubImage && !isCompressed && internalformat != format && !nonEqualFormatsAllowed)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormatCombination);
+ return false;
+ }
+
+ GLenum sizeCheckFormat = isSubImage ? format : internalformat;
+ return ValidImageDataSize(context, texType, width, height, 1, sizeCheckFormat, type, pixels,
+ imageSize);
+}
+
+bool ValidateES2TexStorageParameters(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ if (target != TextureType::_2D && target != TextureType::CubeMap &&
+ target != TextureType::Rectangle)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ if (width < 1 || height < 1 || levels < 1)
+ {
+ context->validationError(GL_INVALID_VALUE, kTextureSizeTooSmall);
+ return false;
+ }
+
+ if (target == TextureType::CubeMap && width != height)
+ {
+ context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions);
+ return false;
+ }
+
+ if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidMipLevels);
+ return false;
+ }
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
+ if (formatInfo.format == GL_NONE || formatInfo.type == GL_NONE)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ const gl::Caps &caps = context->getCaps();
+
+ switch (target)
+ {
+ case TextureType::_2D:
+ if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
+ static_cast<GLuint>(height) > caps.max2DTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+ case TextureType::Rectangle:
+ if (levels != 1)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
+ static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ if (formatInfo.compressed)
+ {
+ context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
+ return false;
+ }
+ break;
+ case TextureType::CubeMap:
+ if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize ||
+ static_cast<GLuint>(height) > caps.maxCubeMapTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (levels != 1 && !context->getExtensions().textureNPOT)
+ {
+ if (!gl::isPow2(width) || !gl::isPow2(height))
+ {
+ context->validationError(GL_INVALID_OPERATION, kDimensionsMustBePow2);
+ return false;
+ }
+ }
+
+ switch (internalformat)
+ {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ if (!context->getExtensions().textureCompressionDXT1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+ if (!context->getExtensions().textureCompressionDXT3)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+ if (!context->getExtensions().textureCompressionDXT5)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_ETC1_RGB8_OES:
+ if (!context->getExtensions().compressedETC1RGB8Texture)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
+ case GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
+ if (!context->getExtensions().lossyETCDecode)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_RGBA32F_EXT:
+ case GL_RGB32F_EXT:
+ case GL_ALPHA32F_EXT:
+ case GL_LUMINANCE32F_EXT:
+ case GL_LUMINANCE_ALPHA32F_EXT:
+ if (!context->getExtensions().textureFloat)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_RGBA16F_EXT:
+ case GL_RGB16F_EXT:
+ case GL_ALPHA16F_EXT:
+ case GL_LUMINANCE16F_EXT:
+ case GL_LUMINANCE_ALPHA16F_EXT:
+ if (!context->getExtensions().textureHalfFloat)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_R8_EXT:
+ case GL_RG8_EXT:
+ if (!context->getExtensions().textureRG)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_R16F_EXT:
+ case GL_RG16F_EXT:
+ if (!context->getExtensions().textureRG || !context->getExtensions().textureHalfFloat)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_R32F_EXT:
+ case GL_RG32F_EXT:
+ if (!context->getExtensions().textureRG || !context->getExtensions().textureFloat)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT32_OES:
+ if (!(context->getExtensions().depthTextureAny()))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ if (target != TextureType::_2D)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
+ return false;
+ }
+ // ANGLE_depth_texture only supports 1-level textures
+ if (!context->getExtensions().depthTextureOES)
+ {
+ if (levels != 1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidMipLevels);
+ return false;
+ }
+ }
+ break;
+ case GL_DEPTH24_STENCIL8_OES:
+ if (!(context->getExtensions().depthTextureANGLE ||
+ (context->getExtensions().packedDepthStencil &&
+ context->getExtensions().textureStorage)))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ if (target != TextureType::_2D)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
+ return false;
+ }
+ if (!context->getExtensions().packedDepthStencil)
+ {
+ // ANGLE_depth_texture only supports 1-level textures
+ if (levels != 1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidMipLevels);
+ return false;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ gl::Texture *texture = context->getTextureByType(target);
+ if (!texture || texture->id() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMissingTexture);
+ return false;
+ }
+
+ if (texture->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureIsImmutable);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDiscardFramebufferEXT(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ if (!context->getExtensions().discardFramebuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ bool defaultFramebuffer = false;
+
+ switch (target)
+ {
+ case GL_FRAMEBUFFER:
+ defaultFramebuffer =
+ (context->getState().getTargetFramebuffer(GL_FRAMEBUFFER)->id() == 0);
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments,
+ defaultFramebuffer);
+}
+
+bool ValidateBindVertexArrayOES(Context *context, GLuint array)
+{
+ if (!context->getExtensions().vertexArrayObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateBindVertexArrayBase(context, array);
+}
+
+bool ValidateDeleteVertexArraysOES(Context *context, GLsizei n, const GLuint *arrays)
+{
+ if (!context->getExtensions().vertexArrayObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenVertexArraysOES(Context *context, GLsizei n, GLuint *arrays)
+{
+ if (!context->getExtensions().vertexArrayObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateIsVertexArrayOES(Context *context, GLuint array)
+{
+ if (!context->getExtensions().vertexArrayObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateProgramBinaryOES(Context *context,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length)
+{
+ if (!context->getExtensions().getProgramBinary)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateProgramBinaryBase(context, program, binaryFormat, binary, length);
+}
+
+bool ValidateGetProgramBinaryOES(Context *context,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ if (!context->getExtensions().getProgramBinary)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGetProgramBinaryBase(context, program, bufSize, length, binaryFormat, binary);
+}
+
+static bool ValidDebugSource(GLenum source, bool mustBeThirdPartyOrApplication)
+{
+ switch (source)
+ {
+ case GL_DEBUG_SOURCE_API:
+ case GL_DEBUG_SOURCE_SHADER_COMPILER:
+ case GL_DEBUG_SOURCE_WINDOW_SYSTEM:
+ case GL_DEBUG_SOURCE_OTHER:
+ // Only THIRD_PARTY and APPLICATION sources are allowed to be manually inserted
+ return !mustBeThirdPartyOrApplication;
+
+ case GL_DEBUG_SOURCE_THIRD_PARTY:
+ case GL_DEBUG_SOURCE_APPLICATION:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+static bool ValidDebugType(GLenum type)
+{
+ switch (type)
+ {
+ case GL_DEBUG_TYPE_ERROR:
+ case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
+ case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
+ case GL_DEBUG_TYPE_PERFORMANCE:
+ case GL_DEBUG_TYPE_PORTABILITY:
+ case GL_DEBUG_TYPE_OTHER:
+ case GL_DEBUG_TYPE_MARKER:
+ case GL_DEBUG_TYPE_PUSH_GROUP:
+ case GL_DEBUG_TYPE_POP_GROUP:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+static bool ValidDebugSeverity(GLenum severity)
+{
+ switch (severity)
+ {
+ case GL_DEBUG_SEVERITY_HIGH:
+ case GL_DEBUG_SEVERITY_MEDIUM:
+ case GL_DEBUG_SEVERITY_LOW:
+ case GL_DEBUG_SEVERITY_NOTIFICATION:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidateDebugMessageControlKHR(Context *context,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidDebugSource(source, false) && source != GL_DONT_CARE)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidDebugSource);
+ return false;
+ }
+
+ if (!ValidDebugType(type) && type != GL_DONT_CARE)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidDebugType);
+ return false;
+ }
+
+ if (!ValidDebugSeverity(severity) && severity != GL_DONT_CARE)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidDebugSeverity);
+ return false;
+ }
+
+ if (count > 0)
+ {
+ if (source == GL_DONT_CARE || type == GL_DONT_CARE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidDebugSourceType);
+ return false;
+ }
+
+ if (severity != GL_DONT_CARE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidDebugSeverity);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateDebugMessageInsertKHR(Context *context,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!context->getState().getDebug().isOutputEnabled())
+ {
+ // If the DEBUG_OUTPUT state is disabled calls to DebugMessageInsert are discarded and do
+ // not generate an error.
+ return false;
+ }
+
+ if (!ValidDebugSeverity(severity))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidDebugSource);
+ return false;
+ }
+
+ if (!ValidDebugType(type))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidDebugType);
+ return false;
+ }
+
+ if (!ValidDebugSource(source, true))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidDebugSource);
+ return false;
+ }
+
+ size_t messageLength = (length < 0) ? strlen(buf) : length;
+ if (messageLength > context->getExtensions().maxDebugMessageLength)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxDebugMessageLength);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDebugMessageCallbackKHR(Context *context,
+ GLDEBUGPROCKHR callback,
+ const void *userParam)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetDebugMessageLogKHR(Context *context,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (bufSize < 0 && messageLog != nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidatePushDebugGroupKHR(Context *context,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidDebugSource(source, true))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidDebugSource);
+ return false;
+ }
+
+ size_t messageLength = (length < 0) ? strlen(message) : length;
+ if (messageLength > context->getExtensions().maxDebugMessageLength)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxDebugMessageLength);
+ return false;
+ }
+
+ size_t currentStackSize = context->getState().getDebug().getGroupStackDepth();
+ if (currentStackSize >= context->getExtensions().maxDebugGroupStackDepth)
+ {
+ context->validationError(GL_STACK_OVERFLOW, kExceedsMaxDebugGroupStackDepth);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidatePopDebugGroupKHR(Context *context)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ size_t currentStackSize = context->getState().getDebug().getGroupStackDepth();
+ if (currentStackSize <= 1)
+ {
+ context->validationError(GL_STACK_UNDERFLOW, kCannotPopDefaultDebugGroup);
+ return false;
+ }
+
+ return true;
+}
+
+static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, GLuint name)
+{
+ switch (identifier)
+ {
+ case GL_BUFFER:
+ if (context->getBuffer(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBufferName);
+ return false;
+ }
+ return true;
+
+ case GL_SHADER:
+ if (context->getShader(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidShaderName);
+ return false;
+ }
+ return true;
+
+ case GL_PROGRAM:
+ if (context->getProgramNoResolveLink(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProgramName);
+ return false;
+ }
+ return true;
+
+ case GL_VERTEX_ARRAY:
+ if (context->getVertexArray(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidVertexArrayName);
+ return false;
+ }
+ return true;
+
+ case GL_QUERY:
+ if (context->getQuery(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidQueryName);
+ return false;
+ }
+ return true;
+
+ case GL_TRANSFORM_FEEDBACK:
+ if (context->getTransformFeedback(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTransformFeedbackName);
+ return false;
+ }
+ return true;
+
+ case GL_SAMPLER:
+ if (context->getSampler(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSamplerName);
+ return false;
+ }
+ return true;
+
+ case GL_TEXTURE:
+ if (context->getTexture(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureName);
+ return false;
+ }
+ return true;
+
+ case GL_RENDERBUFFER:
+ if (context->getRenderbuffer(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidRenderbufferName);
+ return false;
+ }
+ return true;
+
+ case GL_FRAMEBUFFER:
+ if (context->getFramebuffer(name) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFramebufferName);
+ return false;
+ }
+ return true;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidIndentifier);
+ return false;
+ }
+}
+
+static bool ValidateLabelLength(Context *context, GLsizei length, const GLchar *label)
+{
+ size_t labelLength = 0;
+
+ if (length < 0)
+ {
+ if (label != nullptr)
+ {
+ labelLength = strlen(label);
+ }
+ }
+ else
+ {
+ labelLength = static_cast<size_t>(length);
+ }
+
+ if (labelLength > context->getExtensions().maxLabelLength)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxLabelLength);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateObjectLabelKHR(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateObjectIdentifierAndName(context, identifier, name))
+ {
+ return false;
+ }
+
+ if (!ValidateLabelLength(context, length, label))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetObjectLabelKHR(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ if (!ValidateObjectIdentifierAndName(context, identifier, name))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+static bool ValidateObjectPtrName(Context *context, const void *ptr)
+{
+ if (context->getSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr))) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSyncPointer);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateObjectPtrLabelKHR(Context *context,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateObjectPtrName(context, ptr))
+ {
+ return false;
+ }
+
+ if (!ValidateLabelLength(context, length, label))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetObjectPtrLabelKHR(Context *context,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ if (!ValidateObjectPtrName(context, ptr))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetPointervKHR(Context *context, GLenum pname, void **params)
+{
+ if (!context->getExtensions().debug)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ // TODO: represent this in Context::getQueryParameterInfo.
+ switch (pname)
+ {
+ case GL_DEBUG_CALLBACK_FUNCTION:
+ case GL_DEBUG_CALLBACK_USER_PARAM:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetPointervRobustANGLERobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateBlitFramebufferANGLE(Context *context,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ if (!context->getExtensions().framebufferBlit)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBlitExtensionNotAvailable);
+ return false;
+ }
+
+ if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
+ {
+ // TODO(jmadill): Determine if this should be available on other implementations.
+ context->validationError(GL_INVALID_OPERATION, kBlitExtensionScaleOrFlip);
+ return false;
+ }
+
+ if (filter == GL_LINEAR)
+ {
+ context->validationError(GL_INVALID_ENUM, kBlitExtensionLinear);
+ return false;
+ }
+
+ Framebuffer *readFramebuffer = context->getState().getReadFramebuffer();
+ Framebuffer *drawFramebuffer = context->getState().getDrawFramebuffer();
+
+ if (mask & GL_COLOR_BUFFER_BIT)
+ {
+ const FramebufferAttachment *readColorAttachment =
+ readFramebuffer->getReadColorAttachment();
+ const FramebufferAttachment *drawColorAttachment =
+ drawFramebuffer->getFirstColorAttachment();
+
+ if (readColorAttachment && drawColorAttachment)
+ {
+ if (!(readColorAttachment->type() == GL_TEXTURE &&
+ (readColorAttachment->getTextureImageIndex().getType() == TextureType::_2D ||
+ readColorAttachment->getTextureImageIndex().getType() ==
+ TextureType::Rectangle)) &&
+ readColorAttachment->type() != GL_RENDERBUFFER &&
+ readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitExtensionFromInvalidAttachmentType);
+ return false;
+ }
+
+ for (size_t drawbufferIdx = 0;
+ drawbufferIdx < drawFramebuffer->getDrawbufferStateCount(); ++drawbufferIdx)
+ {
+ const FramebufferAttachment *attachment =
+ drawFramebuffer->getDrawBuffer(drawbufferIdx);
+ if (attachment)
+ {
+ if (!(attachment->type() == GL_TEXTURE &&
+ (attachment->getTextureImageIndex().getType() == TextureType::_2D ||
+ attachment->getTextureImageIndex().getType() ==
+ TextureType::Rectangle)) &&
+ attachment->type() != GL_RENDERBUFFER &&
+ attachment->type() != GL_FRAMEBUFFER_DEFAULT)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitExtensionToInvalidAttachmentType);
+ return false;
+ }
+
+ // Return an error if the destination formats do not match
+ if (!Format::EquivalentForBlit(attachment->getFormat(),
+ readColorAttachment->getFormat()))
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitExtensionFormatMismatch);
+ return false;
+ }
+ }
+ }
+
+ GLint samples = readFramebuffer->getSamples(context);
+ if (samples != 0 &&
+ IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0,
+ srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitExtensionMultisampledWholeBufferBlit);
+ return false;
+ }
+ }
+ }
+
+ GLenum masks[] = {GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT};
+ GLenum attachments[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
+ for (size_t i = 0; i < 2; i++)
+ {
+ if (mask & masks[i])
+ {
+ const FramebufferAttachment *readBuffer =
+ readFramebuffer->getAttachment(context, attachments[i]);
+ const FramebufferAttachment *drawBuffer =
+ drawFramebuffer->getAttachment(context, attachments[i]);
+
+ if (readBuffer && drawBuffer)
+ {
+ if (IsPartialBlit(context, readBuffer, drawBuffer, srcX0, srcY0, srcX1, srcY1,
+ dstX0, dstY0, dstX1, dstY1))
+ {
+ // only whole-buffer copies are permitted
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitExtensionDepthStencilWholeBufferBlit);
+ return false;
+ }
+
+ if (readBuffer->getSamples() != 0 || drawBuffer->getSamples() != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kBlitExtensionMultisampledDepthOrStencil);
+ return false;
+ }
+ }
+ }
+ }
+
+ return ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
+ dstX1, dstY1, mask, filter);
+}
+
+bool ValidateClear(Context *context, GLbitfield mask)
+{
+ Framebuffer *fbo = context->getState().getDrawFramebuffer();
+ const Extensions &extensions = context->getExtensions();
+
+ if (!ValidateFramebufferComplete(context, fbo))
+ {
+ return false;
+ }
+
+ if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidClearMask);
+ return false;
+ }
+
+ if (extensions.webglCompatibility && (mask & GL_COLOR_BUFFER_BIT) != 0)
+ {
+ constexpr GLenum validComponentTypes[] = {GL_FLOAT, GL_UNSIGNED_NORMALIZED,
+ GL_SIGNED_NORMALIZED};
+
+ for (GLuint drawBufferIdx = 0; drawBufferIdx < fbo->getDrawbufferStateCount();
+ drawBufferIdx++)
+ {
+ if (!ValidateWebGLFramebufferAttachmentClearType(
+ context, drawBufferIdx, validComponentTypes, ArraySize(validComponentTypes)))
+ {
+ return false;
+ }
+ }
+ }
+
+ if ((extensions.multiview || extensions.multiview2) && extensions.disjointTimerQuery)
+ {
+ const State &state = context->getState();
+ Framebuffer *framebuffer = state.getDrawFramebuffer();
+ if (framebuffer->getNumViews() > 1 && state.isQueryActive(QueryType::TimeElapsed))
+ {
+ context->validationError(GL_INVALID_OPERATION, kMultiviewTimerQuery);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateDrawBuffersEXT(Context *context, GLsizei n, const GLenum *bufs)
+{
+ if (!context->getExtensions().drawBuffers)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateDrawBuffersBase(context, n, bufs);
+}
+
+bool ValidateTexImage2D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, width, height, border, format, type, -1, pixels);
+ }
+
+ ASSERT(context->getClientMajorVersion() >= 3);
+ return ValidateES3TexImage2DParameters(context, target, level, internalformat, false, false, 0,
+ 0, 0, width, height, 1, border, format, type, -1,
+ pixels);
+}
+
+bool ValidateTexImage2DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
+ 0, 0, width, height, border, format, type, bufSize,
+ pixels);
+ }
+
+ ASSERT(context->getClientMajorVersion() >= 3);
+ return ValidateES3TexImage2DParameters(context, target, level, internalformat, false, false, 0,
+ 0, 0, width, height, 1, border, format, type, bufSize,
+ pixels);
+}
+
+bool ValidateTexSubImage2D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, xoffset,
+ yoffset, width, height, 0, format, type, -1, pixels);
+ }
+
+ ASSERT(context->getClientMajorVersion() >= 3);
+ return ValidateES3TexImage2DParameters(context, target, level, GL_NONE, false, true, xoffset,
+ yoffset, 0, width, height, 1, 0, format, type, -1,
+ pixels);
+}
+
+bool ValidateTexSubImage2DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, xoffset,
+ yoffset, width, height, 0, format, type, bufSize,
+ pixels);
+ }
+
+ ASSERT(context->getClientMajorVersion() >= 3);
+ return ValidateES3TexImage2DParameters(context, target, level, GL_NONE, false, true, xoffset,
+ yoffset, 0, width, height, 1, 0, format, type, bufSize,
+ pixels);
+}
+
+bool ValidateTexSubImage3DOES(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return ValidateTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, type, pixels);
+}
+
+bool ValidateCompressedTexImage2D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ if (!ValidateES2TexImageParameters(context, target, level, internalformat, true, false, 0,
+ 0, width, height, border, GL_NONE, GL_NONE, -1, data))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ ASSERT(context->getClientMajorVersion() >= 3);
+ if (!ValidateES3TexImage2DParameters(context, target, level, internalformat, true, false, 0,
+ 0, 0, width, height, 1, border, GL_NONE, GL_NONE, -1,
+ data))
+ {
+ return false;
+ }
+ }
+
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalformat);
+
+ GLuint blockSize = 0;
+ if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1), &blockSize))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kCompressedTextureDimensionsMustMatchData);
+ return false;
+ }
+
+ if (target == TextureTarget::Rectangle)
+ {
+ context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCompressedTexImage2DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const void *data)
+{
+ if (!ValidateRobustCompressedTexImageBase(context, imageSize, dataSize))
+ {
+ return false;
+ }
+
+ return ValidateCompressedTexImage2D(context, target, level, internalformat, width, height,
+ border, imageSize, data);
+}
+
+bool ValidateCompressedTexImage3DOES(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return ValidateCompressedTexImage3D(context, target, level, internalformat, width, height,
+ depth, border, imageSize, data);
+}
+
+bool ValidateCompressedTexSubImage2DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const void *data)
+{
+ if (!ValidateRobustCompressedTexImageBase(context, imageSize, dataSize))
+ {
+ return false;
+ }
+
+ return ValidateCompressedTexSubImage2D(context, target, level, xoffset, yoffset, width, height,
+ format, imageSize, data);
+}
+
+bool ValidateCompressedTexSubImage2D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ if (!ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true, xoffset,
+ yoffset, width, height, 0, format, GL_NONE, -1, data))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ ASSERT(context->getClientMajorVersion() >= 3);
+ if (!ValidateES3TexImage2DParameters(context, target, level, GL_NONE, true, true, xoffset,
+ yoffset, 0, width, height, 1, 0, format, GL_NONE, -1,
+ data))
+ {
+ return false;
+ }
+ }
+
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(format);
+ GLuint blockSize = 0;
+ if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, 1), &blockSize))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidCompressedImageSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCompressedTexSubImage3DOES(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return ValidateCompressedTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, imageSize, data);
+}
+
+bool ValidateGetBufferPointervOES(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ void **params)
+{
+ if (!context->getExtensions().mapBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGetBufferPointervBase(context, target, pname, nullptr, params);
+}
+
+bool ValidateMapBufferOES(Context *context, BufferBinding target, GLenum access)
+{
+ if (!context->getExtensions().mapBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (buffer == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferNotMappable);
+ return false;
+ }
+
+ if (access != GL_WRITE_ONLY_OES)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidAccessBits);
+ return false;
+ }
+
+ if (buffer->isMapped())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferAlreadyMapped);
+ return false;
+ }
+
+ return ValidateMapBufferBase(context, target);
+}
+
+bool ValidateUnmapBufferOES(Context *context, BufferBinding target)
+{
+ if (!context->getExtensions().mapBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateUnmapBufferBase(context, target);
+}
+
+bool ValidateMapBufferRangeEXT(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ if (!context->getExtensions().mapBufferRange)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateMapBufferRangeBase(context, target, offset, length, access);
+}
+
+bool ValidateBufferStorageMemEXT(Context *context,
+ TextureType target,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateCreateMemoryObjectsEXT(Context *context, GLsizei n, GLuint *memoryObjects)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateDeleteMemoryObjectsEXT(Context *context, GLsizei n, const GLuint *memoryObjects)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGetMemoryObjectParameterivEXT(Context *context,
+ GLuint memoryObject,
+ GLenum pname,
+ GLint *params)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetUnsignedBytevEXT(Context *context, GLenum pname, GLubyte *data)
+{
+ if (!context->getExtensions().memoryObject && !context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetUnsignedBytei_vEXT(Context *context, GLenum target, GLuint index, GLubyte *data)
+{
+ if (!context->getExtensions().memoryObject && !context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateIsMemoryObjectEXT(Context *context, GLuint memoryObject)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateMemoryObjectParameterivEXT(Context *context,
+ GLuint memoryObject,
+ GLenum pname,
+ const GLint *params)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateTexStorageMem2DEXT(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2TexStorageParameters(context, target, levels, internalFormat, width,
+ height);
+ }
+
+ ASSERT(context->getClientMajorVersion() >= 3);
+ return ValidateES3TexStorage2DParameters(context, target, levels, internalFormat, width, height,
+ 1);
+}
+
+bool ValidateTexStorageMem3DEXT(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateImportMemoryFdEXT(Context *context,
+ GLuint memory,
+ GLuint64 size,
+ HandleType handleType,
+ GLint fd)
+{
+ if (!context->getExtensions().memoryObjectFd)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (handleType)
+ {
+ case HandleType::OpaqueFd:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidHandleType);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDeleteSemaphoresEXT(Context *context, GLsizei n, const GLuint *semaphores)
+{
+ if (!context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenSemaphoresEXT(Context *context, GLsizei n, GLuint *semaphores)
+{
+ if (!context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGetSemaphoreParameterui64vEXT(Context *context,
+ GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params)
+{
+ if (!context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateIsSemaphoreEXT(Context *context, GLuint semaphore)
+{
+ if (!context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateSemaphoreParameterui64vEXT(Context *context,
+ GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params)
+{
+ if (!context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateSignalSemaphoreEXT(Context *context,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts)
+{
+ if (!context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ for (GLuint i = 0; i < numTextureBarriers; ++i)
+ {
+ if (!IsValidImageLayout(FromGLenum<ImageLayout>(dstLayouts[i])))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidImageLayout);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateWaitSemaphoreEXT(Context *context,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts)
+{
+ if (!context->getExtensions().semaphore)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ for (GLuint i = 0; i < numTextureBarriers; ++i)
+ {
+ if (!IsValidImageLayout(FromGLenum<ImageLayout>(srcLayouts[i])))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidImageLayout);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateImportSemaphoreFdEXT(Context *context,
+ GLuint semaphore,
+ HandleType handleType,
+ GLint fd)
+{
+ if (!context->getExtensions().semaphoreFd)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (handleType)
+ {
+ case HandleType::OpaqueFd:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidHandleType);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateMapBufferBase(Context *context, BufferBinding target)
+{
+ Buffer *buffer = context->getState().getTargetBuffer(target);
+ ASSERT(buffer != nullptr);
+
+ // Check if this buffer is currently being used as a transform feedback output buffer
+ if (context->getState().isTransformFeedbackActive())
+ {
+ TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ for (size_t i = 0; i < transformFeedback->getIndexedBufferCount(); i++)
+ {
+ const auto &transformFeedbackBuffer = transformFeedback->getIndexedBuffer(i);
+ if (transformFeedbackBuffer.get() == buffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback);
+ return false;
+ }
+ }
+ }
+
+ if (context->getExtensions().webglCompatibility &&
+ buffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFlushMappedBufferRangeEXT(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ if (!context->getExtensions().mapBufferRange)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateFlushMappedBufferRangeBase(context, target, offset, length);
+}
+
+bool ValidateBindUniformLocationCHROMIUM(Context *context,
+ GLuint program,
+ GLint location,
+ const GLchar *name)
+{
+ if (!context->getExtensions().bindUniformLocation)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (location < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeLocation);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ if (static_cast<size_t>(location) >=
+ (caps.maxVertexUniformVectors + caps.maxFragmentUniformVectors) * 4)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBindUniformLocation);
+ return false;
+ }
+
+ // The WebGL spec (section 6.20) disallows strings containing invalid ESSL characters for
+ // shader-related entry points
+ if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name)))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters);
+ return false;
+ }
+
+ if (strncmp(name, "gl_", 3) == 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNameBeginsWithGL);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components)
+{
+ if (!context->getExtensions().framebufferMixedSamples)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ switch (components)
+ {
+ case GL_RGB:
+ case GL_RGBA:
+ case GL_ALPHA:
+ case GL_NONE:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidCoverageComponents);
+ return false;
+ }
+
+ return true;
+}
+
+// CHROMIUM_path_rendering
+
+bool ValidateMatrixLoadfCHROMIUM(Context *context, GLenum matrixMode, const GLfloat *matrix)
+{
+ if (!ValidateMatrixMode(context, matrixMode))
+ {
+ return false;
+ }
+
+ if (matrix == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidPathMatrix);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateMatrixLoadIdentityCHROMIUM(Context *context, GLenum matrixMode)
+{
+ return ValidateMatrixMode(context, matrixMode);
+}
+
+bool ValidateGenPathsCHROMIUM(Context *context, GLsizei range)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ // range = 0 is undefined in NV_path_rendering.
+ // we add stricter semantic check here and require a non zero positive range.
+ if (range <= 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidRange);
+ return false;
+ }
+
+ if (!angle::IsValueInRangeForNumericType<std::uint32_t>(range))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDeletePathsCHROMIUM(Context *context, GLuint path, GLsizei range)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ // range = 0 is undefined in NV_path_rendering.
+ // we add stricter semantic check here and require a non zero positive range.
+ if (range <= 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidRange);
+ return false;
+ }
+
+ angle::CheckedNumeric<std::uint32_t> checkedRange(path);
+ checkedRange += range;
+
+ if (!angle::IsValueInRangeForNumericType<std::uint32_t>(range) || !checkedRange.IsValid())
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+ return true;
+}
+
+bool ValidatePathCommandsCHROMIUM(Context *context,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (!context->isPathGenerated(path))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoSuchPath);
+ return false;
+ }
+
+ if (numCommands < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathNumCommands);
+ return false;
+ }
+ else if (numCommands > 0)
+ {
+ if (!commands)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathCommandsArray);
+ return false;
+ }
+ }
+
+ if (numCoords < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathNumCoords);
+ return false;
+ }
+ else if (numCoords > 0)
+ {
+ if (!coords)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathNumCoordsArray);
+ return false;
+ }
+ }
+
+ std::uint32_t coordTypeSize = 0;
+ switch (coordType)
+ {
+ case GL_BYTE:
+ coordTypeSize = sizeof(GLbyte);
+ break;
+
+ case GL_UNSIGNED_BYTE:
+ coordTypeSize = sizeof(GLubyte);
+ break;
+
+ case GL_SHORT:
+ coordTypeSize = sizeof(GLshort);
+ break;
+
+ case GL_UNSIGNED_SHORT:
+ coordTypeSize = sizeof(GLushort);
+ break;
+
+ case GL_FLOAT:
+ coordTypeSize = sizeof(GLfloat);
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathCoordinateType);
+ return false;
+ }
+
+ angle::CheckedNumeric<std::uint32_t> checkedSize(numCommands);
+ checkedSize += (coordTypeSize * numCoords);
+ if (!checkedSize.IsValid())
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ // early return skips command data validation when it doesn't exist.
+ if (!commands)
+ return true;
+
+ GLsizei expectedNumCoords = 0;
+ for (GLsizei i = 0; i < numCommands; ++i)
+ {
+ switch (commands[i])
+ {
+ case GL_CLOSE_PATH_CHROMIUM: // no coordinates.
+ break;
+ case GL_MOVE_TO_CHROMIUM:
+ case GL_LINE_TO_CHROMIUM:
+ expectedNumCoords += 2;
+ break;
+ case GL_QUADRATIC_CURVE_TO_CHROMIUM:
+ expectedNumCoords += 4;
+ break;
+ case GL_CUBIC_CURVE_TO_CHROMIUM:
+ expectedNumCoords += 6;
+ break;
+ case GL_CONIC_CURVE_TO_CHROMIUM:
+ expectedNumCoords += 5;
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathCommand);
+ return false;
+ }
+ }
+
+ if (expectedNumCoords != numCoords)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathNumCoords);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, GLfloat value)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (!context->isPathGenerated(path))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoSuchPath);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_PATH_STROKE_WIDTH_CHROMIUM:
+ if (value < 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathStrokeWidth);
+ return false;
+ }
+ break;
+ case GL_PATH_END_CAPS_CHROMIUM:
+ switch (static_cast<GLenum>(value))
+ {
+ case GL_FLAT_CHROMIUM:
+ case GL_SQUARE_CHROMIUM:
+ case GL_ROUND_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathEndCaps);
+ return false;
+ }
+ break;
+ case GL_PATH_JOIN_STYLE_CHROMIUM:
+ switch (static_cast<GLenum>(value))
+ {
+ case GL_MITER_REVERT_CHROMIUM:
+ case GL_BEVEL_CHROMIUM:
+ case GL_ROUND_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathJoinStyle);
+ return false;
+ }
+ break;
+ case GL_PATH_MITER_LIMIT_CHROMIUM:
+ if (value < 0.0f)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathMiterLimit);
+ return false;
+ }
+ break;
+
+ case GL_PATH_STROKE_BOUND_CHROMIUM:
+ // no errors, only clamping.
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathParameter);
+ return false;
+ }
+ return true;
+}
+
+bool ValidatePathParameteriCHROMIUM(Context *context, GLuint path, GLenum pname, GLint value)
+{
+ // TODO(jmadill): Use proper clamping cast.
+ return ValidatePathParameterfCHROMIUM(context, path, pname, static_cast<GLfloat>(value));
+}
+
+bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pname, GLfloat *value)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!context->isPathGenerated(path))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoSuchPath);
+ return false;
+ }
+
+ if (!value)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathValueArray);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_PATH_STROKE_WIDTH_CHROMIUM:
+ case GL_PATH_END_CAPS_CHROMIUM:
+ case GL_PATH_JOIN_STYLE_CHROMIUM:
+ case GL_PATH_MITER_LIMIT_CHROMIUM:
+ case GL_PATH_STROKE_BOUND_CHROMIUM:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathParameter);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetPathParameterivCHROMIUM(Context *context, GLuint path, GLenum pname, GLint *value)
+{
+ return ValidateGetPathParameterfvCHROMIUM(context, path, pname,
+ reinterpret_cast<GLfloat *>(value));
+}
+
+bool ValidatePathStencilFuncCHROMIUM(Context *context, GLenum func, GLint ref, GLuint mask)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (func)
+ {
+ case GL_NEVER:
+ case GL_ALWAYS:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_EQUAL:
+ case GL_GEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ return true;
+}
+
+// Note that the spec specifies that for the path drawing commands
+// if the path object is not an existing path object the command
+// does nothing and no error is generated.
+// However if the path object exists but has not been specified any
+// commands then an error is generated.
+
+bool ValidateStencilFillPathCHROMIUM(Context *context, GLuint path, GLenum fillMode, GLuint mask)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (context->isPathGenerated(path) && !context->isPath(path))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoSuchPath);
+ return false;
+ }
+
+ switch (fillMode)
+ {
+ case GL_INVERT:
+ case GL_COUNT_UP_CHROMIUM:
+ case GL_COUNT_DOWN_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidFillMode);
+ return false;
+ }
+
+ if (!isPow2(mask + 1))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidStencilBitMask);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint reference, GLuint mask)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (context->isPathGenerated(path) && !context->isPath(path))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoPathOrNoPathData);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCoverPathCHROMIUM(Context *context, GLuint path, GLenum coverMode)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (context->isPathGenerated(path) && !context->isPath(path))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoSuchPath);
+ return false;
+ }
+
+ switch (coverMode)
+ {
+ case GL_CONVEX_HULL_CHROMIUM:
+ case GL_BOUNDING_BOX_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidCoverMode);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateCoverFillPathCHROMIUM(Context *context, GLuint path, GLenum coverMode)
+{
+ return ValidateCoverPathCHROMIUM(context, path, coverMode);
+}
+
+bool ValidateCoverStrokePathCHROMIUM(Context *context, GLuint path, GLenum coverMode)
+{
+ return ValidateCoverPathCHROMIUM(context, path, coverMode);
+}
+
+bool ValidateStencilThenCoverFillPathCHROMIUM(Context *context,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode)
+{
+ return ValidateStencilFillPathCHROMIUM(context, path, fillMode, mask) &&
+ ValidateCoverPathCHROMIUM(context, path, coverMode);
+}
+
+bool ValidateStencilThenCoverStrokePathCHROMIUM(Context *context,
+ GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode)
+{
+ return ValidateStencilStrokePathCHROMIUM(context, path, reference, mask) &&
+ ValidateCoverPathCHROMIUM(context, path, coverMode);
+}
+
+bool ValidateIsPathCHROMIUM(Context *context, GLuint path)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateCoverFillPathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
+ transformType, transformValues))
+ return false;
+
+ switch (coverMode)
+ {
+ case GL_CONVEX_HULL_CHROMIUM:
+ case GL_BOUNDING_BOX_CHROMIUM:
+ case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidCoverMode);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCoverStrokePathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
+ transformType, transformValues))
+ return false;
+
+ switch (coverMode)
+ {
+ case GL_CONVEX_HULL_CHROMIUM:
+ case GL_BOUNDING_BOX_CHROMIUM:
+ case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidCoverMode);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilFillPathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+
+ if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
+ transformType, transformValues))
+ return false;
+
+ switch (fillMode)
+ {
+ case GL_INVERT:
+ case GL_COUNT_UP_CHROMIUM:
+ case GL_COUNT_DOWN_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidFillMode);
+ return false;
+ }
+ if (!isPow2(mask + 1))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidStencilBitMask);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateStencilStrokePathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
+ transformType, transformValues))
+ return false;
+
+ // no more validation here.
+
+ return true;
+}
+
+bool ValidateStencilThenCoverFillPathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
+ transformType, transformValues))
+ return false;
+
+ switch (coverMode)
+ {
+ case GL_CONVEX_HULL_CHROMIUM:
+ case GL_BOUNDING_BOX_CHROMIUM:
+ case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidCoverMode);
+ return false;
+ }
+
+ switch (fillMode)
+ {
+ case GL_INVERT:
+ case GL_COUNT_UP_CHROMIUM:
+ case GL_COUNT_DOWN_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidFillMode);
+ return false;
+ }
+ if (!isPow2(mask + 1))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidStencilBitMask);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilThenCoverStrokePathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
+ transformType, transformValues))
+ return false;
+
+ switch (coverMode)
+ {
+ case GL_CONVEX_HULL_CHROMIUM:
+ case GL_BOUNDING_BOX_CHROMIUM:
+ case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidCoverMode);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindFragmentInputLocationCHROMIUM(Context *context,
+ GLuint program,
+ GLint location,
+ const GLchar *name)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ const GLint MaxLocation = context->getCaps().maxVaryingVectors * 4;
+ if (location >= MaxLocation)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidVaryingLocation);
+ return false;
+ }
+
+ const auto *programObject = context->getProgramNoResolveLink(program);
+ if (!programObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotBound);
+ return false;
+ }
+
+ if (!name)
+ {
+ context->validationError(GL_INVALID_VALUE, kMissingName);
+ return false;
+ }
+
+ if (angle::BeginsWith(name, "gl_"))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNameBeginsWithGL);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
+ GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ if (!context->getExtensions().pathRendering)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ const auto *programObject = context->getProgramResolveLink(program);
+ if (!programObject || programObject->isFlaggedForDeletion())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramDoesNotExist);
+ return false;
+ }
+
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ switch (genMode)
+ {
+ case GL_NONE:
+ if (components != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidComponents);
+ return false;
+ }
+ break;
+
+ case GL_OBJECT_LINEAR_CHROMIUM:
+ case GL_EYE_LINEAR_CHROMIUM:
+ case GL_CONSTANT_CHROMIUM:
+ if (components < 1 || components > 4)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidComponents);
+ return false;
+ }
+ if (!coeffs)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPathCoefficientsArray);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPathGenMode);
+ return false;
+ }
+
+ // If the location is -1 then the command is silently ignored
+ // and no further validation is needed.
+ if (location == -1)
+ return true;
+
+ const auto &binding = programObject->getFragmentInputBindingInfo(location);
+
+ if (!binding.valid)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFragmentInputBinding);
+ return false;
+ }
+
+ if (binding.type != GL_NONE)
+ {
+ GLint expectedComponents = 0;
+ switch (binding.type)
+ {
+ case GL_FLOAT:
+ expectedComponents = 1;
+ break;
+ case GL_FLOAT_VEC2:
+ expectedComponents = 2;
+ break;
+ case GL_FLOAT_VEC3:
+ expectedComponents = 3;
+ break;
+ case GL_FLOAT_VEC4:
+ expectedComponents = 4;
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kFragmentInputTypeNotFloatingPoint);
+ return false;
+ }
+ if (expectedComponents != components && genMode != GL_NONE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidPathComponents);
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateCopyTextureCHROMIUM(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ if (!context->getExtensions().copyTexture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ const Texture *source = context->getTexture(sourceId);
+ if (source == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
+ return false;
+ }
+
+ if (!IsValidCopyTextureSourceTarget(context, source->getType()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ TextureType sourceType = source->getType();
+ ASSERT(sourceType != TextureType::CubeMap);
+ TextureTarget sourceTarget = NonCubeTextureTypeToTarget(sourceType);
+
+ if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureLevel);
+ return false;
+ }
+
+ GLsizei sourceWidth = static_cast<GLsizei>(source->getWidth(sourceTarget, sourceLevel));
+ GLsizei sourceHeight = static_cast<GLsizei>(source->getHeight(sourceTarget, sourceLevel));
+ if (sourceWidth == 0 || sourceHeight == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ const InternalFormat &sourceFormat = *source->getFormat(sourceTarget, sourceLevel).info;
+ if (!IsValidCopyTextureSourceInternalFormatEnum(sourceFormat.internalFormat))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidSourceTextureInternalFormat);
+ return false;
+ }
+
+ if (!IsValidCopyTextureDestinationTargetEnum(context, destTarget))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ const Texture *dest = context->getTexture(destId);
+ if (dest == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
+ return false;
+ }
+
+ if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType);
+ return false;
+ }
+
+ if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, sourceWidth,
+ sourceHeight, false))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ if (!IsValidCopyTextureDestinationFormatType(context, internalFormat, destType))
+ {
+ return false;
+ }
+
+ if (dest->getType() == TextureType::CubeMap && sourceWidth != sourceHeight)
+ {
+ context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions);
+ return false;
+ }
+
+ if (dest->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kDestinationImmutable);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCopySubTextureCHROMIUM(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ if (!context->getExtensions().copyTexture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ const Texture *source = context->getTexture(sourceId);
+ if (source == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
+ return false;
+ }
+
+ if (!IsValidCopyTextureSourceTarget(context, source->getType()))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureType);
+ return false;
+ }
+
+ TextureType sourceType = source->getType();
+ ASSERT(sourceType != TextureType::CubeMap);
+ TextureTarget sourceTarget = NonCubeTextureTypeToTarget(sourceType);
+
+ if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ if (source->getWidth(sourceTarget, sourceLevel) == 0 ||
+ source->getHeight(sourceTarget, sourceLevel) == 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureLevel);
+ return false;
+ }
+
+ if (x < 0 || y < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (width < 0 || height < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ if (static_cast<size_t>(x + width) > source->getWidth(sourceTarget, sourceLevel) ||
+ static_cast<size_t>(y + height) > source->getHeight(sourceTarget, sourceLevel))
+ {
+ context->validationError(GL_INVALID_VALUE, kSourceTextureTooSmall);
+ return false;
+ }
+
+ const Format &sourceFormat = source->getFormat(sourceTarget, sourceLevel);
+ if (!IsValidCopySubTextureSourceInternalFormat(sourceFormat.info->internalFormat))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ if (!IsValidCopyTextureDestinationTargetEnum(context, destTarget))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ const Texture *dest = context->getTexture(destId);
+ if (dest == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
+ return false;
+ }
+
+ if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType);
+ return false;
+ }
+
+ if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, width, height,
+ true))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ if (dest->getWidth(destTarget, destLevel) == 0 || dest->getHeight(destTarget, destLevel) == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDestinationLevelNotDefined);
+ return false;
+ }
+
+ const InternalFormat &destFormat = *dest->getFormat(destTarget, destLevel).info;
+ if (!IsValidCopySubTextureDestionationInternalFormat(destFormat.internalFormat))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormatCombination);
+ return false;
+ }
+
+ if (xoffset < 0 || yoffset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (static_cast<size_t>(xoffset + width) > dest->getWidth(destTarget, destLevel) ||
+ static_cast<size_t>(yoffset + height) > dest->getHeight(destTarget, destLevel))
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GLuint destId)
+{
+ if (!context->getExtensions().copyCompressedTexture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ const gl::Texture *source = context->getTexture(sourceId);
+ if (source == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
+ return false;
+ }
+
+ if (source->getType() != TextureType::_2D)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureType);
+ return false;
+ }
+
+ if (source->getWidth(TextureTarget::_2D, 0) == 0 ||
+ source->getHeight(TextureTarget::_2D, 0) == 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kSourceTextureLevelZeroDefined);
+ return false;
+ }
+
+ const gl::Format &sourceFormat = source->getFormat(TextureTarget::_2D, 0);
+ if (!sourceFormat.info->compressed)
+ {
+ context->validationError(GL_INVALID_OPERATION, kSourceTextureMustBeCompressed);
+ return false;
+ }
+
+ const gl::Texture *dest = context->getTexture(destId);
+ if (dest == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
+ return false;
+ }
+
+ if (dest->getType() != TextureType::_2D)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType);
+ return false;
+ }
+
+ if (dest->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kDestinationImmutable);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCreateShader(Context *context, ShaderType type)
+{
+ switch (type)
+ {
+ case ShaderType::Vertex:
+ case ShaderType::Fragment:
+ break;
+
+ case ShaderType::Compute:
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_ENUM, kES31Required);
+ return false;
+ }
+ break;
+
+ case ShaderType::Geometry:
+ if (!context->getExtensions().geometryShader)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidShaderType);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidShaderType);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBufferData(Context *context,
+ BufferBinding target,
+ GLsizeiptr size,
+ const void *data,
+ BufferUsage usage)
+{
+ if (size < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ switch (usage)
+ {
+ case BufferUsage::StreamDraw:
+ case BufferUsage::StaticDraw:
+ case BufferUsage::DynamicDraw:
+ break;
+
+ case BufferUsage::StreamRead:
+ case BufferUsage::StaticRead:
+ case BufferUsage::DynamicRead:
+ case BufferUsage::StreamCopy:
+ case BufferUsage::StaticCopy:
+ case BufferUsage::DynamicCopy:
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferUsage);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferUsage);
+ return false;
+ }
+
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferNotBound);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility &&
+ buffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBufferSubData(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data)
+{
+ if (size < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ if (offset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ Buffer *buffer = context->getState().getTargetBuffer(target);
+
+ if (!buffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferNotBound);
+ return false;
+ }
+
+ if (buffer->isMapped())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferMapped);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility &&
+ buffer->isBoundForTransformFeedbackAndOtherUse())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback);
+ return false;
+ }
+
+ // Check for possible overflow of size + offset
+ angle::CheckedNumeric<size_t> checkedSize(size);
+ checkedSize += offset;
+ if (!checkedSize.IsValid())
+ {
+ context->validationError(GL_INVALID_VALUE, kParamOverflow);
+ return false;
+ }
+
+ if (size + offset > buffer->getSize())
+ {
+ context->validationError(GL_INVALID_VALUE, kInsufficientBufferSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name)
+{
+ if (!context->getExtensions().requestExtension)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!context->isExtensionRequestable(name))
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotRequestable);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateActiveTexture(Context *context, GLenum texture)
+{
+ if (context->getClientMajorVersion() < 2)
+ {
+ return ValidateMultitextureUnit(context, texture);
+ }
+
+ if (texture < GL_TEXTURE0 ||
+ texture > GL_TEXTURE0 + context->getCaps().maxCombinedTextureImageUnits - 1)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidCombinedImageUnit);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateAttachShader(Context *context, GLuint program, GLuint shader)
+{
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ Shader *shaderObject = GetValidShader(context, shader);
+ if (!shaderObject)
+ {
+ return false;
+ }
+
+ if (programObject->getAttachedShader(shaderObject->getType()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kShaderAttachmentHasShader);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindAttribLocation(Context *context, GLuint program, GLuint index, const GLchar *name)
+{
+ if (index >= MAX_VERTEX_ATTRIBS)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ if (strncmp(name, "gl_", 3) == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNameBeginsWithGL);
+ return false;
+ }
+
+ if (context->isWebGL())
+ {
+ const size_t length = strlen(name);
+
+ if (!IsValidESSLString(name, length))
+ {
+ // The WebGL spec (section 6.20) disallows strings containing invalid ESSL characters
+ // for shader-related entry points
+ context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters);
+ return false;
+ }
+
+ if (!ValidateWebGLNameLength(context, length) || !ValidateWebGLNamePrefix(context, name))
+ {
+ return false;
+ }
+ }
+
+ return GetValidProgram(context, program) != nullptr;
+}
+
+bool ValidateBindFramebuffer(Context *context, GLenum target, GLuint framebuffer)
+{
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ if (!context->getState().isBindGeneratesResourceEnabled() &&
+ !context->isFramebufferGenerated(framebuffer))
+ {
+ context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindRenderbuffer(Context *context, GLenum target, GLuint renderbuffer)
+{
+ if (target != GL_RENDERBUFFER)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidRenderbufferTarget);
+ return false;
+ }
+
+ if (!context->getState().isBindGeneratesResourceEnabled() &&
+ !context->isRenderbufferGenerated(renderbuffer))
+ {
+ context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
+ return false;
+ }
+
+ return true;
+}
+
+static bool ValidBlendEquationMode(const Context *context, GLenum mode)
+{
+ switch (mode)
+ {
+ case GL_FUNC_ADD:
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ return true;
+
+ case GL_MIN:
+ case GL_MAX:
+ return context->getClientVersion() >= ES_3_0 || context->getExtensions().blendMinMax;
+
+ default:
+ return false;
+ }
+}
+
+bool ValidateBlendColor(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return true;
+}
+
+bool ValidateBlendEquation(Context *context, GLenum mode)
+{
+ if (!ValidBlendEquationMode(context, mode))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBlendEquation);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBlendEquationSeparate(Context *context, GLenum modeRGB, GLenum modeAlpha)
+{
+ if (!ValidBlendEquationMode(context, modeRGB))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBlendEquation);
+ return false;
+ }
+
+ if (!ValidBlendEquationMode(context, modeAlpha))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBlendEquation);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBlendFunc(Context *context, GLenum sfactor, GLenum dfactor)
+{
+ return ValidateBlendFuncSeparate(context, sfactor, dfactor, sfactor, dfactor);
+}
+
+bool ValidateBlendFuncSeparate(Context *context,
+ GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha)
+{
+ if (!ValidSrcBlendFunc(context, srcRGB))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction);
+ return false;
+ }
+
+ if (!ValidDstBlendFunc(context, dstRGB))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction);
+ return false;
+ }
+
+ if (!ValidSrcBlendFunc(context, srcAlpha))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction);
+ return false;
+ }
+
+ if (!ValidDstBlendFunc(context, dstAlpha))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction);
+ return false;
+ }
+
+ if (context->getLimitations().noSimultaneousConstantColorAndAlphaBlendFunc ||
+ context->getExtensions().webglCompatibility)
+ {
+ bool constantColorUsed =
+ (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR ||
+ dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR);
+
+ bool constantAlphaUsed =
+ (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA ||
+ dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA);
+
+ if (constantColorUsed && constantAlphaUsed)
+ {
+ if (context->getExtensions().webglCompatibility)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidConstantColor);
+ return false;
+ }
+
+ WARN() << kConstantColorAlphaLimitation;
+ context->validationError(GL_INVALID_OPERATION, kConstantColorAlphaLimitation);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetString(Context *context, GLenum name)
+{
+ switch (name)
+ {
+ case GL_VENDOR:
+ case GL_RENDERER:
+ case GL_VERSION:
+ case GL_SHADING_LANGUAGE_VERSION:
+ case GL_EXTENSIONS:
+ break;
+
+ case GL_REQUESTABLE_EXTENSIONS_ANGLE:
+ if (!context->getExtensions().requestExtension)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidName);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidName);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLineWidth(Context *context, GLfloat width)
+{
+ if (width <= 0.0f || isNaN(width))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidWidth);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDepthRangef(Context *context, GLfloat zNear, GLfloat zFar)
+{
+ if (context->getExtensions().webglCompatibility && zNear > zFar)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidDepthRange);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateRenderbufferStorage(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return ValidateRenderbufferStorageParametersBase(context, target, 0, internalformat, width,
+ height);
+}
+
+bool ValidateRenderbufferStorageMultisampleANGLE(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ if (!context->getExtensions().framebufferMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ // ANGLE_framebuffer_multisample states that the value of samples must be less than or equal
+ // to MAX_SAMPLES_ANGLE (Context::getCaps().maxSamples) otherwise GL_INVALID_VALUE is
+ // generated.
+ if (static_cast<GLuint>(samples) > context->getCaps().maxSamples)
+ {
+ context->validationError(GL_INVALID_VALUE, kSamplesOutOfRange);
+ return false;
+ }
+
+ // ANGLE_framebuffer_multisample states GL_OUT_OF_MEMORY is generated on a failure to create
+ // the specified storage. This is different than ES 3.0 in which a sample number higher
+ // than the maximum sample number supported by this format generates a GL_INVALID_VALUE.
+ // The TextureCaps::getMaxSamples method is only guarenteed to be valid when the context is ES3.
+ if (context->getClientMajorVersion() >= 3)
+ {
+ const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
+ if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
+ {
+ context->validationError(GL_OUT_OF_MEMORY, kSamplesOutOfRange);
+ return false;
+ }
+ }
+
+ return ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat,
+ width, height);
+}
+
+bool ValidateCheckFramebufferStatus(Context *context, GLenum target)
+{
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateClearColor(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return true;
+}
+
+bool ValidateClearDepthf(Context *context, GLfloat depth)
+{
+ return true;
+}
+
+bool ValidateClearStencil(Context *context, GLint s)
+{
+ return true;
+}
+
+bool ValidateColorMask(Context *context,
+ GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha)
+{
+ return true;
+}
+
+bool ValidateCompileShader(Context *context, GLuint shader)
+{
+ return true;
+}
+
+bool ValidateCreateProgram(Context *context)
+{
+ return true;
+}
+
+bool ValidateCullFace(Context *context, CullFaceMode mode)
+{
+ switch (mode)
+ {
+ case CullFaceMode::Front:
+ case CullFaceMode::Back:
+ case CullFaceMode::FrontAndBack:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidCullMode);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDeleteProgram(Context *context, GLuint program)
+{
+ if (program == 0)
+ {
+ return false;
+ }
+
+ if (!context->getProgramResolveLink(program))
+ {
+ if (context->getShader(program))
+ {
+ context->validationError(GL_INVALID_OPERATION, kExpectedProgramName);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProgramName);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateDeleteShader(Context *context, GLuint shader)
+{
+ if (shader == 0)
+ {
+ return false;
+ }
+
+ if (!context->getShader(shader))
+ {
+ if (context->getProgramResolveLink(shader))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidShaderName);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_VALUE, kExpectedShaderName);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateDepthFunc(Context *context, GLenum func)
+{
+ switch (func)
+ {
+ case GL_NEVER:
+ case GL_ALWAYS:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_EQUAL:
+ case GL_GREATER:
+ case GL_GEQUAL:
+ case GL_NOTEQUAL:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDepthMask(Context *context, GLboolean flag)
+{
+ return true;
+}
+
+bool ValidateDetachShader(Context *context, GLuint program, GLuint shader)
+{
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ Shader *shaderObject = GetValidShader(context, shader);
+ if (!shaderObject)
+ {
+ return false;
+ }
+
+ const Shader *attachedShader = programObject->getAttachedShader(shaderObject->getType());
+ if (attachedShader != shaderObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kShaderToDetachMustBeAttached);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDisableVertexAttribArray(Context *context, GLuint index)
+{
+ if (index >= MAX_VERTEX_ATTRIBS)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateEnableVertexAttribArray(Context *context, GLuint index)
+{
+ if (index >= MAX_VERTEX_ATTRIBS)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFinish(Context *context)
+{
+ return true;
+}
+
+bool ValidateFlush(Context *context)
+{
+ return true;
+}
+
+bool ValidateFrontFace(Context *context, GLenum mode)
+{
+ switch (mode)
+ {
+ case GL_CW:
+ case GL_CCW:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetActiveAttrib(Context *context,
+ GLuint program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ if (bufsize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (index >= static_cast<GLuint>(programObject->getActiveAttributeCount()))
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxActiveUniform);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetActiveUniform(Context *context,
+ GLuint program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ if (bufsize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (index >= static_cast<GLuint>(programObject->getActiveUniformCount()))
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxActiveUniform);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetAttachedShaders(Context *context,
+ GLuint program,
+ GLsizei maxcount,
+ GLsizei *count,
+ GLuint *shaders)
+{
+ if (maxcount < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeMaxCount);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+
+ if (!programObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetAttribLocation(Context *context, GLuint program, const GLchar *name)
+{
+ // The WebGL spec (section 6.20) disallows strings containing invalid ESSL characters for
+ // shader-related entry points
+ if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name)))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+
+ if (!programObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotBound);
+ return false;
+ }
+
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetBooleanv(Context *context, GLenum pname, GLboolean *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ return ValidateStateQuery(context, pname, &nativeType, &numParams);
+}
+
+bool ValidateGetError(Context *context)
+{
+ return true;
+}
+
+bool ValidateGetFloatv(Context *context, GLenum pname, GLfloat *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ return ValidateStateQuery(context, pname, &nativeType, &numParams);
+}
+
+bool ValidateGetIntegerv(Context *context, GLenum pname, GLint *params)
+{
+ GLenum nativeType;
+ unsigned int numParams = 0;
+ return ValidateStateQuery(context, pname, &nativeType, &numParams);
+}
+
+bool ValidateGetProgramInfoLog(Context *context,
+ GLuint program,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *infolog)
+{
+ if (bufsize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetShaderInfoLog(Context *context,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *infolog)
+{
+ if (bufsize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Shader *shaderObject = GetValidShader(context, shader);
+ if (!shaderObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetShaderPrecisionFormat(Context *context,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision)
+{
+ switch (shadertype)
+ {
+ case GL_VERTEX_SHADER:
+ case GL_FRAGMENT_SHADER:
+ break;
+ case GL_COMPUTE_SHADER:
+ context->validationError(GL_INVALID_OPERATION, kUnimplementedComputeShaderPrecision);
+ return false;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidShaderType);
+ return false;
+ }
+
+ switch (precisiontype)
+ {
+ case GL_LOW_FLOAT:
+ case GL_MEDIUM_FLOAT:
+ case GL_HIGH_FLOAT:
+ case GL_LOW_INT:
+ case GL_MEDIUM_INT:
+ case GL_HIGH_INT:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPrecision);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetShaderSource(Context *context,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source)
+{
+ if (bufsize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Shader *shaderObject = GetValidShader(context, shader);
+ if (!shaderObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetUniformLocation(Context *context, GLuint program, const GLchar *name)
+{
+ if (strstr(name, "gl_") == name)
+ {
+ return false;
+ }
+
+ // The WebGL spec (section 6.20) disallows strings containing invalid ESSL characters for
+ // shader-related entry points
+ if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name)))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateHint(Context *context, GLenum target, GLenum mode)
+{
+ switch (mode)
+ {
+ case GL_FASTEST:
+ case GL_NICEST:
+ case GL_DONT_CARE:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ switch (target)
+ {
+ case GL_GENERATE_MIPMAP_HINT:
+ break;
+
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
+ if (context->getClientVersion() < ES_3_0 &&
+ !context->getExtensions().standardDerivatives)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ case GL_POINT_SMOOTH_HINT:
+ case GL_LINE_SMOOTH_HINT:
+ case GL_FOG_HINT:
+ if (context->getClientMajorVersion() >= 2)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateIsBuffer(Context *context, GLuint buffer)
+{
+ return true;
+}
+
+bool ValidateIsFramebuffer(Context *context, GLuint framebuffer)
+{
+ return true;
+}
+
+bool ValidateIsProgram(Context *context, GLuint program)
+{
+ return true;
+}
+
+bool ValidateIsRenderbuffer(Context *context, GLuint renderbuffer)
+{
+ return true;
+}
+
+bool ValidateIsShader(Context *context, GLuint shader)
+{
+ return true;
+}
+
+bool ValidateIsTexture(Context *context, GLuint texture)
+{
+ return true;
+}
+
+bool ValidatePixelStorei(Context *context, GLenum pname, GLint param)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ switch (pname)
+ {
+ case GL_UNPACK_IMAGE_HEIGHT:
+ case GL_UNPACK_SKIP_IMAGES:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+
+ case GL_UNPACK_ROW_LENGTH:
+ case GL_UNPACK_SKIP_ROWS:
+ case GL_UNPACK_SKIP_PIXELS:
+ if (!context->getExtensions().unpackSubimage)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+ break;
+
+ case GL_PACK_ROW_LENGTH:
+ case GL_PACK_SKIP_ROWS:
+ case GL_PACK_SKIP_PIXELS:
+ if (!context->getExtensions().packSubimage)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+ break;
+ }
+ }
+
+ if (param < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeParam);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_UNPACK_ALIGNMENT:
+ if (param != 1 && param != 2 && param != 4 && param != 8)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidUnpackAlignment);
+ return false;
+ }
+ break;
+
+ case GL_PACK_ALIGNMENT:
+ if (param != 1 && param != 2 && param != 4 && param != 8)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidUnpackAlignment);
+ return false;
+ }
+ break;
+
+ case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
+ if (!context->getExtensions().packReverseRowOrder)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ }
+ break;
+
+ case GL_UNPACK_ROW_LENGTH:
+ case GL_UNPACK_IMAGE_HEIGHT:
+ case GL_UNPACK_SKIP_IMAGES:
+ 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:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidatePolygonOffset(Context *context, GLfloat factor, GLfloat units)
+{
+ return true;
+}
+
+bool ValidateReleaseShaderCompiler(Context *context)
+{
+ return true;
+}
+
+bool ValidateSampleCoverage(Context *context, GLfloat value, GLboolean invert)
+{
+ return true;
+}
+
+bool ValidateScissor(Context *context, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ if (width < 0 || height < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateShaderBinary(Context *context,
+ GLsizei n,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length)
+{
+ const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats;
+ if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) ==
+ shaderBinaryFormats.end())
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidShaderBinaryFormat);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateShaderSource(Context *context,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length)
+{
+ if (count < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+
+ // The WebGL spec (section 6.20) disallows strings containing invalid ESSL characters for
+ // shader-related entry points
+ if (context->getExtensions().webglCompatibility)
+ {
+ for (GLsizei i = 0; i < count; i++)
+ {
+ size_t len =
+ (length && length[i] >= 0) ? static_cast<size_t>(length[i]) : strlen(string[i]);
+
+ // Backslash as line-continuation is allowed in WebGL 2.0.
+ if (!IsValidESSLShaderSourceString(string[i], len,
+ context->getClientVersion() >= ES_3_0))
+ {
+ context->validationError(GL_INVALID_VALUE, kShaderSourceInvalidCharacters);
+ return false;
+ }
+ }
+ }
+
+ Shader *shaderObject = GetValidShader(context, shader);
+ if (!shaderObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilFunc(Context *context, GLenum func, GLint ref, GLuint mask)
+{
+ if (!IsValidStencilFunc(func))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilFuncSeparate(Context *context, GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ if (!IsValidStencilFace(face))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ if (!IsValidStencilFunc(func))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilMask(Context *context, GLuint mask)
+{
+ return true;
+}
+
+bool ValidateStencilMaskSeparate(Context *context, GLenum face, GLuint mask)
+{
+ if (!IsValidStencilFace(face))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilOp(Context *context, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ if (!IsValidStencilOp(fail))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ if (!IsValidStencilOp(zfail))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ if (!IsValidStencilOp(zpass))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateStencilOpSeparate(Context *context,
+ GLenum face,
+ GLenum fail,
+ GLenum zfail,
+ GLenum zpass)
+{
+ if (!IsValidStencilFace(face))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidStencil);
+ return false;
+ }
+
+ return ValidateStencilOp(context, fail, zfail, zpass);
+}
+
+bool ValidateUniform1f(Context *context, GLint location, GLfloat x)
+{
+ return ValidateUniform(context, GL_FLOAT, location, 1);
+}
+
+bool ValidateUniform1fv(Context *context, GLint location, GLsizei count, const GLfloat *v)
+{
+ return ValidateUniform(context, GL_FLOAT, location, count);
+}
+
+bool ValidateUniform1i(Context *context, GLint location, GLint x)
+{
+ return ValidateUniform1iv(context, location, 1, &x);
+}
+
+bool ValidateUniform2fv(Context *context, GLint location, GLsizei count, const GLfloat *v)
+{
+ return ValidateUniform(context, GL_FLOAT_VEC2, location, count);
+}
+
+bool ValidateUniform2i(Context *context, GLint location, GLint x, GLint y)
+{
+ return ValidateUniform(context, GL_INT_VEC2, location, 1);
+}
+
+bool ValidateUniform2iv(Context *context, GLint location, GLsizei count, const GLint *v)
+{
+ return ValidateUniform(context, GL_INT_VEC2, location, count);
+}
+
+bool ValidateUniform3f(Context *context, GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+ return ValidateUniform(context, GL_FLOAT_VEC3, location, 1);
+}
+
+bool ValidateUniform3fv(Context *context, GLint location, GLsizei count, const GLfloat *v)
+{
+ return ValidateUniform(context, GL_FLOAT_VEC3, location, count);
+}
+
+bool ValidateUniform3i(Context *context, GLint location, GLint x, GLint y, GLint z)
+{
+ return ValidateUniform(context, GL_INT_VEC3, location, 1);
+}
+
+bool ValidateUniform3iv(Context *context, GLint location, GLsizei count, const GLint *v)
+{
+ return ValidateUniform(context, GL_INT_VEC3, location, count);
+}
+
+bool ValidateUniform4f(Context *context, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ return ValidateUniform(context, GL_FLOAT_VEC4, location, 1);
+}
+
+bool ValidateUniform4fv(Context *context, GLint location, GLsizei count, const GLfloat *v)
+{
+ return ValidateUniform(context, GL_FLOAT_VEC4, location, count);
+}
+
+bool ValidateUniform4i(Context *context, GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+ return ValidateUniform(context, GL_INT_VEC4, location, 1);
+}
+
+bool ValidateUniform4iv(Context *context, GLint location, GLsizei count, const GLint *v)
+{
+ return ValidateUniform(context, GL_INT_VEC4, location, count);
+}
+
+bool ValidateUniformMatrix2fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose);
+}
+
+bool ValidateUniformMatrix3fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose);
+}
+
+bool ValidateUniformMatrix4fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose);
+}
+
+bool ValidateValidateProgram(Context *context, GLuint program)
+{
+ Program *programObject = GetValidProgram(context, program);
+
+ if (!programObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateVertexAttrib1f(Context *context, GLuint index, GLfloat x)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttrib1fv(Context *context, GLuint index, const GLfloat *values)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttrib2f(Context *context, GLuint index, GLfloat x, GLfloat y)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttrib2fv(Context *context, GLuint index, const GLfloat *values)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttrib3f(Context *context, GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttrib3fv(Context *context, GLuint index, const GLfloat *values)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttrib4f(Context *context,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttrib4fv(Context *context, GLuint index, const GLfloat *values)
+{
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateViewport(Context *context, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ if (width < 0 || height < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kViewportNegativeSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetFramebufferAttachmentParameteriv(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ return ValidateGetFramebufferAttachmentParameterivBase(context, target, attachment, pname,
+ nullptr);
+}
+
+bool ValidateGetProgramiv(Context *context, GLuint program, GLenum pname, GLint *params)
+{
+ return ValidateGetProgramivBase(context, program, pname, nullptr);
+}
+
+bool ValidateCopyTexImage2D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2CopyTexImageParameters(context, target, level, internalformat, false, 0,
+ 0, x, y, width, height, border);
+ }
+
+ ASSERT(context->getClientMajorVersion() == 3);
+ return ValidateES3CopyTexImage2DParameters(context, target, level, internalformat, false, 0, 0,
+ 0, x, y, width, height, border);
+}
+
+bool ValidateCopyTexSubImage2D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset,
+ yoffset, x, y, width, height, 0);
+ }
+
+ return ValidateES3CopyTexImage2DParameters(context, target, level, GL_NONE, true, xoffset,
+ yoffset, 0, x, y, width, height, 0);
+}
+
+bool ValidateCopyTexSubImage3DOES(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return ValidateCopyTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, x, y, width,
+ height);
+}
+
+bool ValidateDeleteBuffers(Context *context, GLint n, const GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateDeleteFramebuffers(Context *context, GLint n, const GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateDeleteRenderbuffers(Context *context, GLint n, const GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateDeleteTextures(Context *context, GLint n, const GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateDisable(Context *context, GLenum cap)
+{
+ if (!ValidCap(context, cap, false))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateEnable(Context *context, GLenum cap)
+{
+ if (!ValidCap(context, cap, false))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (context->getLimitations().noSampleAlphaToCoverageSupport &&
+ cap == GL_SAMPLE_ALPHA_TO_COVERAGE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoSampleAlphaToCoveragesLimitation);
+
+ // We also output an error message to the debugger window if tracing is active, so that
+ // developers can see the error message.
+ ERR() << kNoSampleAlphaToCoveragesLimitation;
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFramebufferRenderbuffer(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ if (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidRenderbufferTarget);
+ return false;
+ }
+
+ return ValidateFramebufferRenderbufferParameters(context, target, attachment,
+ renderbuffertarget, renderbuffer);
+}
+
+bool ValidateFramebufferTexture2D(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textarget,
+ GLuint texture,
+ GLint level)
+{
+ // Attachments are required to be bound to level 0 without ES3 or the GL_OES_fbo_render_mipmap
+ // extension
+ if (context->getClientMajorVersion() < 3 && !context->getExtensions().fboRenderMipmap &&
+ level != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFramebufferTextureLevel);
+ return false;
+ }
+
+ if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
+ {
+ return false;
+ }
+
+ if (texture != 0)
+ {
+ gl::Texture *tex = context->getTexture(texture);
+ ASSERT(tex);
+
+ const gl::Caps &caps = context->getCaps();
+
+ switch (textarget)
+ {
+ case TextureTarget::_2D:
+ {
+ if (level > gl::log2(caps.max2DTextureSize))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+ if (tex->getType() != TextureType::_2D)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
+ return false;
+ }
+ }
+ break;
+
+ case TextureTarget::Rectangle:
+ {
+ if (level != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+ if (tex->getType() != TextureType::Rectangle)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch);
+ return false;
+ }
+ }
+ break;
+
+ case TextureTarget::CubeMapNegativeX:
+ case TextureTarget::CubeMapNegativeY:
+ case TextureTarget::CubeMapNegativeZ:
+ case TextureTarget::CubeMapPositiveX:
+ case TextureTarget::CubeMapPositiveY:
+ case TextureTarget::CubeMapPositiveZ:
+ {
+ if (level > gl::log2(caps.maxCubeMapTextureSize))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+ if (tex->getType() != TextureType::CubeMap)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch);
+ return false;
+ }
+ }
+ break;
+
+ case TextureTarget::_2DMultisample:
+ {
+ if (context->getClientVersion() < ES_3_1 &&
+ !context->getExtensions().textureMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kMultisampleTextureExtensionOrES31Required);
+ return false;
+ }
+
+ if (level != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kLevelNotZero);
+ return false;
+ }
+ if (tex->getType() != TextureType::_2DMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch);
+ return false;
+ }
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateFramebufferTexture3DOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGenBuffers(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenFramebuffers(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenRenderbuffers(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenTextures(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenerateMipmap(Context *context, TextureType target)
+{
+ if (!ValidTextureTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ Texture *texture = context->getTextureByType(target);
+
+ if (texture == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureNotBound);
+ return false;
+ }
+
+ const GLuint effectiveBaseLevel = texture->getTextureState().getEffectiveBaseLevel();
+
+ // This error isn't spelled out in the spec in a very explicit way, but we interpret the spec so
+ // that out-of-range base level has a non-color-renderable / non-texture-filterable format.
+ if (effectiveBaseLevel >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBaseLevelOutOfRange);
+ return false;
+ }
+
+ TextureTarget baseTarget = (target == TextureType::CubeMap)
+ ? TextureTarget::CubeMapPositiveX
+ : NonCubeTextureTypeToTarget(target);
+ const auto &format = *(texture->getFormat(baseTarget, effectiveBaseLevel).info);
+ if (format.sizedInternalFormat == GL_NONE || format.compressed || format.depthBits > 0 ||
+ format.stencilBits > 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kGenerateMipmapNotAllowed);
+ return false;
+ }
+
+ // GenerateMipmap accepts formats that are unsized or both color renderable and filterable.
+ bool formatUnsized = !format.sized;
+ bool formatColorRenderableAndFilterable =
+ format.filterSupport(context->getClientVersion(), context->getExtensions()) &&
+ format.textureAttachmentSupport(context->getClientVersion(), context->getExtensions());
+ if (!formatUnsized && !formatColorRenderableAndFilterable)
+ {
+ context->validationError(GL_INVALID_OPERATION, kGenerateMipmapNotAllowed);
+ return false;
+ }
+
+ // GL_EXT_sRGB adds an unsized SRGB (no alpha) format which has explicitly disabled mipmap
+ // generation
+ if (format.colorEncoding == GL_SRGB && format.format == GL_RGB)
+ {
+ context->validationError(GL_INVALID_OPERATION, kGenerateMipmapNotAllowed);
+ return false;
+ }
+
+ // According to the OpenGL extension spec EXT_sRGB.txt, EXT_SRGB is based on ES 2.0 and
+ // generateMipmap is not allowed if texture format is SRGB_EXT or SRGB_ALPHA_EXT.
+ if (context->getClientVersion() < Version(3, 0) && format.colorEncoding == GL_SRGB)
+ {
+ context->validationError(GL_INVALID_OPERATION, kGenerateMipmapNotAllowed);
+ return false;
+ }
+
+ // Non-power of 2 ES2 check
+ if (context->getClientVersion() < Version(3, 0) && !context->getExtensions().textureNPOT &&
+ (!isPow2(static_cast<int>(texture->getWidth(baseTarget, 0))) ||
+ !isPow2(static_cast<int>(texture->getHeight(baseTarget, 0)))))
+ {
+ ASSERT(target == TextureType::_2D || target == TextureType::Rectangle ||
+ target == TextureType::CubeMap);
+ context->validationError(GL_INVALID_OPERATION, kTextureNotPow2);
+ return false;
+ }
+
+ // Cube completeness check
+ if (target == TextureType::CubeMap && !texture->getTextureState().isCubeComplete())
+ {
+ context->validationError(GL_INVALID_OPERATION, kCubemapIncomplete);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility &&
+ (texture->getWidth(baseTarget, effectiveBaseLevel) == 0 ||
+ texture->getHeight(baseTarget, effectiveBaseLevel) == 0))
+ {
+ context->validationError(GL_INVALID_OPERATION, kGenerateMipmapZeroSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetBufferParameteriv(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ GLint *params)
+{
+ return ValidateGetBufferParameterBase(context, target, pname, false, nullptr);
+}
+
+bool ValidateGetRenderbufferParameteriv(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return ValidateGetRenderbufferParameterivBase(context, target, pname, nullptr);
+}
+
+bool ValidateGetShaderiv(Context *context, GLuint shader, GLenum pname, GLint *params)
+{
+ return ValidateGetShaderivBase(context, shader, pname, nullptr);
+}
+
+bool ValidateGetTexParameterfv(Context *context, TextureType target, GLenum pname, GLfloat *params)
+{
+ return ValidateGetTexParameterBase(context, target, pname, nullptr);
+}
+
+bool ValidateGetTexParameteriv(Context *context, TextureType target, GLenum pname, GLint *params)
+{
+ return ValidateGetTexParameterBase(context, target, pname, nullptr);
+}
+
+bool ValidateGetTexParameterIivOES(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateGetTexParameterBase(context, target, pname, nullptr);
+}
+
+bool ValidateGetTexParameterIuivOES(Context *context,
+ TextureType target,
+ GLenum pname,
+ GLuint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateGetTexParameterBase(context, target, pname, nullptr);
+}
+
+bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat *params)
+{
+ return ValidateGetUniformBase(context, program, location);
+}
+
+bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint *params)
+{
+ return ValidateGetUniformBase(context, program, location);
+}
+
+bool ValidateGetVertexAttribfv(Context *context, GLuint index, GLenum pname, GLfloat *params)
+{
+ return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, false);
+}
+
+bool ValidateGetVertexAttribiv(Context *context, GLuint index, GLenum pname, GLint *params)
+{
+ return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, false);
+}
+
+bool ValidateGetVertexAttribPointerv(Context *context, GLuint index, GLenum pname, void **pointer)
+{
+ return ValidateGetVertexAttribBase(context, index, pname, nullptr, true, false);
+}
+
+bool ValidateIsEnabled(Context *context, GLenum cap)
+{
+ if (!ValidCap(context, cap, true))
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateLinkProgram(Context *context, GLuint program)
+{
+ if (context->hasActiveTransformFeedback(program))
+ {
+ // ES 3.0.4 section 2.15 page 91
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackActiveDuringLink);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateReadPixels(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ return ValidateReadPixelsBase(context, x, y, width, height, format, type, -1, nullptr, nullptr,
+ nullptr, pixels);
+}
+
+bool ValidateTexParameterf(Context *context, TextureType target, GLenum pname, GLfloat param)
+{
+ return ValidateTexParameterBase(context, target, pname, -1, false, &param);
+}
+
+bool ValidateTexParameterfv(Context *context,
+ TextureType target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return ValidateTexParameterBase(context, target, pname, -1, true, params);
+}
+
+bool ValidateTexParameteri(Context *context, TextureType target, GLenum pname, GLint param)
+{
+ return ValidateTexParameterBase(context, target, pname, -1, false, &param);
+}
+
+bool ValidateTexParameteriv(Context *context, TextureType target, GLenum pname, const GLint *params)
+{
+ return ValidateTexParameterBase(context, target, pname, -1, true, params);
+}
+
+bool ValidateTexParameterIivOES(Context *context,
+ TextureType target,
+ GLenum pname,
+ const GLint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateTexParameterBase(context, target, pname, -1, true, params);
+}
+
+bool ValidateTexParameterIuivOES(Context *context,
+ TextureType target,
+ GLenum pname,
+ const GLuint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateTexParameterBase(context, target, pname, -1, true, params);
+}
+
+bool ValidateUseProgram(Context *context, GLuint program)
+{
+ if (program != 0)
+ {
+ Program *programObject = context->getProgramResolveLink(program);
+ if (!programObject)
+ {
+ // ES 3.1.0 section 7.3 page 72
+ if (context->getShader(program))
+ {
+ context->validationError(GL_INVALID_OPERATION, kExpectedProgramName);
+ return false;
+ }
+ else
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProgramName);
+ return false;
+ }
+ }
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+ }
+ if (context->getState().isTransformFeedbackActiveUnpaused())
+ {
+ // ES 3.0.4 section 2.15 page 91
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackUseProgram);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDeleteFencesNV(Context *context, GLsizei n, const GLuint *fences)
+{
+ if (!context->getExtensions().fence)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported);
+ return false;
+ }
+
+ if (n < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFinishFenceNV(Context *context, GLuint fence)
+{
+ if (!context->getExtensions().fence)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported);
+ return false;
+ }
+
+ FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFence);
+ return false;
+ }
+
+ if (!fenceObject->isSet())
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFenceState);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGenFencesNV(Context *context, GLsizei n, GLuint *fences)
+{
+ if (!context->getExtensions().fence)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported);
+ return false;
+ }
+
+ if (n < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetFenceivNV(Context *context, GLuint fence, GLenum pname, GLint *params)
+{
+ if (!context->getExtensions().fence)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported);
+ return false;
+ }
+
+ FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFence);
+ return false;
+ }
+
+ if (!fenceObject->isSet())
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFenceState);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_FENCE_STATUS_NV:
+ case GL_FENCE_CONDITION_NV:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetGraphicsResetStatusEXT(Context *context)
+{
+ if (!context->getExtensions().robustness)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetTranslatedShaderSourceANGLE(Context *context,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source)
+{
+ if (!context->getExtensions().translatedShaderSource)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (bufsize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Shader *shaderObject = context->getShader(shader);
+
+ if (!shaderObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidShaderName);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateIsFenceNV(Context *context, GLuint fence)
+{
+ if (!context->getExtensions().fence)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateSetFenceNV(Context *context, GLuint fence, GLenum condition)
+{
+ if (!context->getExtensions().fence)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported);
+ return false;
+ }
+
+ if (condition != GL_ALL_COMPLETED_NV)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFenceCondition);
+ return false;
+ }
+
+ FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFence);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTestFenceNV(Context *context, GLuint fence)
+{
+ if (!context->getExtensions().fence)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported);
+ return false;
+ }
+
+ FenceNV *fenceObject = context->getFenceNV(fence);
+
+ if (fenceObject == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFence);
+ return false;
+ }
+
+ if (fenceObject->isSet() != GL_TRUE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFenceState);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTexStorage2DEXT(Context *context,
+ TextureType type,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ if (!context->getExtensions().textureStorage)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ return ValidateES2TexStorageParameters(context, type, levels, internalformat, width,
+ height);
+ }
+
+ ASSERT(context->getClientMajorVersion() >= 3);
+ return ValidateES3TexStorage2DParameters(context, type, levels, internalformat, width, height,
+ 1);
+}
+
+bool ValidateVertexAttribDivisorANGLE(Context *context, GLuint index, GLuint divisor)
+{
+ if (!context->getExtensions().instancedArraysANGLE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (index >= MAX_VERTEX_ATTRIBS)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ if (context->getLimitations().attributeZeroRequiresZeroDivisorInEXT)
+ {
+ if (index == 0 && divisor != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kAttributeZeroRequiresDivisorLimitation);
+
+ // We also output an error message to the debugger window if tracing is active, so
+ // that developers can see the error message.
+ ERR() << kAttributeZeroRequiresDivisorLimitation;
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateVertexAttribDivisorEXT(Context *context, GLuint index, GLuint divisor)
+{
+ if (!context->getExtensions().instancedArraysEXT)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (index >= MAX_VERTEX_ATTRIBS)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTexImage3DOES(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return ValidateTexImage3D(context, target, level, internalformat, width, height, depth, border,
+ format, type, pixels);
+}
+
+bool ValidatePopGroupMarkerEXT(Context *context)
+{
+ if (!context->getExtensions().debugMarker)
+ {
+ // The debug marker calls should not set error state
+ // However, it seems reasonable to set an error state if the extension is not enabled
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTexStorage1DEXT(Context *context,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width)
+{
+ UNIMPLEMENTED();
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+}
+
+bool ValidateTexStorage3DEXT(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ if (!context->getExtensions().textureStorage)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateES3TexStorage3DParameters(context, target, levels, internalformat, width, height,
+ depth);
+}
+
+bool ValidateMaxShaderCompilerThreadsKHR(Context *context, GLuint count)
+{
+ if (!context->getExtensions().parallelShaderCompile)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateMultiDrawArraysANGLE(Context *context,
+ PrimitiveMode mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount)
+{
+ if (!context->getExtensions().multiDraw)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (!ValidateDrawArrays(context, mode, firsts[drawID], counts[drawID]))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateMultiDrawElementsANGLE(Context *context,
+ PrimitiveMode mode,
+ const GLsizei *counts,
+ DrawElementsType type,
+ const GLvoid *const *indices,
+ GLsizei drawcount)
+{
+ if (!context->getExtensions().multiDraw)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (!ValidateDrawElements(context, mode, counts[drawID], type, indices[drawID]))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateProvokingVertexANGLE(Context *context, ProvokingVertexConvention modePacked)
+{
+ if (!context->getExtensions().provokingVertex)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ switch (modePacked)
+ {
+ case ProvokingVertexConvention::FirstVertexConvention:
+ case ProvokingVertexConvention::LastVertexConvention:
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidProvokingVertex);
+ return false;
+ }
+
+ return true;
+}
+
+void RecordBindTextureTypeError(Context *context, TextureType target)
+{
+ ASSERT(!context->getStateCache().isValidBindTextureType(target));
+
+ switch (target)
+ {
+ case TextureType::Rectangle:
+ ASSERT(!context->getExtensions().textureRectangle);
+ context->validationError(GL_INVALID_ENUM, kTextureRectangleNotSupported);
+ break;
+
+ case TextureType::_3D:
+ case TextureType::_2DArray:
+ ASSERT(context->getClientMajorVersion() < 3);
+ context->validationError(GL_INVALID_ENUM, kES3Required);
+ break;
+
+ case TextureType::_2DMultisample:
+ ASSERT(context->getClientVersion() < Version(3, 1) &&
+ !context->getExtensions().textureMultisample);
+ context->validationError(GL_INVALID_ENUM, kMultisampleTextureExtensionOrES31Required);
+ break;
+
+ case TextureType::_2DMultisampleArray:
+ ASSERT(!context->getExtensions().textureStorageMultisample2DArray);
+ context->validationError(GL_INVALID_ENUM, kMultisampleArrayExtensionRequired);
+ break;
+
+ case TextureType::External:
+ ASSERT(!context->getExtensions().eglImageExternal &&
+ !context->getExtensions().eglStreamConsumerExternal);
+ context->validationError(GL_INVALID_ENUM, kExternalTextureNotSupported);
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ }
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationES2.h b/gfx/angle/checkout/src/libANGLE/validationES2.h
new file mode 100644
index 0000000000..44d18ba1eb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES2.h
@@ -0,0 +1,176 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES2.h:
+// Inlined validation functions for OpenGL ES 2.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES2_H_
+#define LIBANGLE_VALIDATION_ES2_H_
+
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/validationES.h"
+#include "libANGLE/validationES2_autogen.h"
+
+namespace gl
+{
+ANGLE_INLINE bool ValidateDrawArrays(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count)
+{
+ return ValidateDrawArraysCommon(context, mode, first, count, 1);
+}
+
+ANGLE_INLINE bool ValidateUniform2f(Context *context, GLint location, GLfloat x, GLfloat y)
+{
+ return ValidateUniform(context, GL_FLOAT_VEC2, location, 1);
+}
+
+ANGLE_INLINE bool ValidateBindBuffer(Context *context, BufferBinding target, GLuint buffer)
+{
+ if (!context->isValidBufferBinding(target))
+ {
+ context->validationError(GL_INVALID_ENUM, err::kInvalidBufferTypes);
+ return false;
+ }
+
+ if (!context->getState().isBindGeneratesResourceEnabled() &&
+ !context->isBufferGenerated(buffer))
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kObjectNotGenerated);
+ return false;
+ }
+
+ return true;
+}
+
+ANGLE_INLINE bool ValidateDrawElements(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices)
+{
+ return ValidateDrawElementsCommon(context, mode, count, type, indices, 1);
+}
+
+ANGLE_INLINE bool ValidateVertexAttribPointer(Context *context,
+ GLuint index,
+ GLint size,
+ VertexAttribType type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *ptr)
+{
+ if (!ValidateFloatVertexFormat(context, index, size, type))
+ {
+ return false;
+ }
+
+ if (stride < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kNegativeStride);
+ return false;
+ }
+
+ if (context->getClientVersion() >= ES_3_1)
+ {
+ const Caps &caps = context->getCaps();
+ if (stride > caps.maxVertexAttribStride)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kExceedsMaxVertexAttribStride);
+ return false;
+ }
+
+ if (index >= caps.maxVertexAttribBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, err::kExceedsMaxVertexAttribBindings);
+ return false;
+ }
+ }
+
+ // [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.
+ bool nullBufferAllowed = context->getState().areClientArraysEnabled() &&
+ context->getState().getVertexArray()->id() == 0;
+ if (!nullBufferAllowed && context->getState().getTargetBuffer(BufferBinding::Array) == 0 &&
+ ptr != nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kClientDataInVertexArray);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility)
+ {
+ // WebGL 1.0 [Section 6.14] Fixed point support
+ // The WebGL API does not support the GL_FIXED data type.
+ if (type == VertexAttribType::Fixed)
+ {
+ context->validationError(GL_INVALID_ENUM, err::kFixedNotInWebGL);
+ return false;
+ }
+
+ if (!ValidateWebGLVertexAttribPointer(context, type, normalized, stride, ptr, false))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void RecordBindTextureTypeError(Context *context, TextureType target);
+
+ANGLE_INLINE bool ValidateBindTexture(Context *context, TextureType target, GLuint texture)
+{
+ if (!context->getStateCache().isValidBindTextureType(target))
+ {
+ RecordBindTextureTypeError(context, target);
+ return false;
+ }
+
+ if (texture == 0)
+ {
+ return true;
+ }
+
+ Texture *textureObject = context->getTexture(texture);
+ if (textureObject && textureObject->getType() != target)
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kTextureTargetMismatch);
+ return false;
+ }
+
+ if (!context->getState().isBindGeneratesResourceEnabled() &&
+ !context->isTextureGenerated(texture))
+ {
+ context->validationError(GL_INVALID_OPERATION, err::kObjectNotGenerated);
+ return false;
+ }
+
+ return true;
+}
+
+// Validation of all Tex[Sub]Image2D parameters except TextureTarget.
+bool ValidateES2TexImageParametersBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei imageSize,
+ const void *pixels);
+
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES2_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES2_autogen.h b/gfx/angle/checkout/src/libANGLE/validationES2_autogen.h
new file mode 100644
index 0000000000..b2fa1184a1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES2_autogen.h
@@ -0,0 +1,356 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES2_autogen.h:
+// Validation functions for the OpenGL ES 2.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES2_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_ES2_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateActiveTexture(Context *context, GLenum texture);
+bool ValidateAttachShader(Context *context, GLuint program, GLuint shader);
+bool ValidateBindAttribLocation(Context *context, GLuint program, GLuint index, const GLchar *name);
+bool ValidateBindBuffer(Context *context, BufferBinding targetPacked, GLuint buffer);
+bool ValidateBindFramebuffer(Context *context, GLenum target, GLuint framebuffer);
+bool ValidateBindRenderbuffer(Context *context, GLenum target, GLuint renderbuffer);
+bool ValidateBindTexture(Context *context, TextureType targetPacked, GLuint texture);
+bool ValidateBlendColor(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+bool ValidateBlendEquation(Context *context, GLenum mode);
+bool ValidateBlendEquationSeparate(Context *context, GLenum modeRGB, GLenum modeAlpha);
+bool ValidateBlendFunc(Context *context, GLenum sfactor, GLenum dfactor);
+bool ValidateBlendFuncSeparate(Context *context,
+ GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha);
+bool ValidateBufferData(Context *context,
+ BufferBinding targetPacked,
+ GLsizeiptr size,
+ const void *data,
+ BufferUsage usagePacked);
+bool ValidateBufferSubData(Context *context,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data);
+bool ValidateCheckFramebufferStatus(Context *context, GLenum target);
+bool ValidateClear(Context *context, GLbitfield mask);
+bool ValidateClearColor(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+bool ValidateClearDepthf(Context *context, GLfloat d);
+bool ValidateClearStencil(Context *context, GLint s);
+bool ValidateColorMask(Context *context,
+ GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha);
+bool ValidateCompileShader(Context *context, GLuint shader);
+bool ValidateCompressedTexImage2D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCompressedTexSubImage2D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCopyTexImage2D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border);
+bool ValidateCopyTexSubImage2D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+bool ValidateCreateProgram(Context *context);
+bool ValidateCreateShader(Context *context, ShaderType typePacked);
+bool ValidateCullFace(Context *context, CullFaceMode modePacked);
+bool ValidateDeleteBuffers(Context *context, GLsizei n, const GLuint *buffers);
+bool ValidateDeleteFramebuffers(Context *context, GLsizei n, const GLuint *framebuffers);
+bool ValidateDeleteProgram(Context *context, GLuint program);
+bool ValidateDeleteRenderbuffers(Context *context, GLsizei n, const GLuint *renderbuffers);
+bool ValidateDeleteShader(Context *context, GLuint shader);
+bool ValidateDeleteTextures(Context *context, GLsizei n, const GLuint *textures);
+bool ValidateDepthFunc(Context *context, GLenum func);
+bool ValidateDepthMask(Context *context, GLboolean flag);
+bool ValidateDepthRangef(Context *context, GLfloat n, GLfloat f);
+bool ValidateDetachShader(Context *context, GLuint program, GLuint shader);
+bool ValidateDisable(Context *context, GLenum cap);
+bool ValidateDisableVertexAttribArray(Context *context, GLuint index);
+bool ValidateDrawArrays(Context *context, PrimitiveMode modePacked, GLint first, GLsizei count);
+bool ValidateDrawElements(Context *context,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices);
+bool ValidateEnable(Context *context, GLenum cap);
+bool ValidateEnableVertexAttribArray(Context *context, GLuint index);
+bool ValidateFinish(Context *context);
+bool ValidateFlush(Context *context);
+bool ValidateFramebufferRenderbuffer(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+bool ValidateFramebufferTexture2D(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level);
+bool ValidateFrontFace(Context *context, GLenum mode);
+bool ValidateGenBuffers(Context *context, GLsizei n, GLuint *buffers);
+bool ValidateGenFramebuffers(Context *context, GLsizei n, GLuint *framebuffers);
+bool ValidateGenRenderbuffers(Context *context, GLsizei n, GLuint *renderbuffers);
+bool ValidateGenTextures(Context *context, GLsizei n, GLuint *textures);
+bool ValidateGenerateMipmap(Context *context, TextureType targetPacked);
+bool ValidateGetActiveAttrib(Context *context,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+bool ValidateGetActiveUniform(Context *context,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+bool ValidateGetAttachedShaders(Context *context,
+ GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders);
+bool ValidateGetAttribLocation(Context *context, GLuint program, const GLchar *name);
+bool ValidateGetBooleanv(Context *context, GLenum pname, GLboolean *data);
+bool ValidateGetBufferParameteriv(Context *context,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetError(Context *context);
+bool ValidateGetFloatv(Context *context, GLenum pname, GLfloat *data);
+bool ValidateGetFramebufferAttachmentParameteriv(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetIntegerv(Context *context, GLenum pname, GLint *data);
+bool ValidateGetProgramInfoLog(Context *context,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+bool ValidateGetProgramiv(Context *context, GLuint program, GLenum pname, GLint *params);
+bool ValidateGetRenderbufferParameteriv(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetShaderInfoLog(Context *context,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+bool ValidateGetShaderPrecisionFormat(Context *context,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision);
+bool ValidateGetShaderSource(Context *context,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source);
+bool ValidateGetShaderiv(Context *context, GLuint shader, GLenum pname, GLint *params);
+bool ValidateGetString(Context *context, GLenum name);
+bool ValidateGetTexParameterfv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLfloat *params);
+bool ValidateGetTexParameteriv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetUniformLocation(Context *context, GLuint program, const GLchar *name);
+bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat *params);
+bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint *params);
+bool ValidateGetVertexAttribPointerv(Context *context, GLuint index, GLenum pname, void **pointer);
+bool ValidateGetVertexAttribfv(Context *context, GLuint index, GLenum pname, GLfloat *params);
+bool ValidateGetVertexAttribiv(Context *context, GLuint index, GLenum pname, GLint *params);
+bool ValidateHint(Context *context, GLenum target, GLenum mode);
+bool ValidateIsBuffer(Context *context, GLuint buffer);
+bool ValidateIsEnabled(Context *context, GLenum cap);
+bool ValidateIsFramebuffer(Context *context, GLuint framebuffer);
+bool ValidateIsProgram(Context *context, GLuint program);
+bool ValidateIsRenderbuffer(Context *context, GLuint renderbuffer);
+bool ValidateIsShader(Context *context, GLuint shader);
+bool ValidateIsTexture(Context *context, GLuint texture);
+bool ValidateLineWidth(Context *context, GLfloat width);
+bool ValidateLinkProgram(Context *context, GLuint program);
+bool ValidatePixelStorei(Context *context, GLenum pname, GLint param);
+bool ValidatePolygonOffset(Context *context, GLfloat factor, GLfloat units);
+bool ValidateReadPixels(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels);
+bool ValidateReleaseShaderCompiler(Context *context);
+bool ValidateRenderbufferStorage(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateSampleCoverage(Context *context, GLfloat value, GLboolean invert);
+bool ValidateScissor(Context *context, GLint x, GLint y, GLsizei width, GLsizei height);
+bool ValidateShaderBinary(Context *context,
+ GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length);
+bool ValidateShaderSource(Context *context,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length);
+bool ValidateStencilFunc(Context *context, GLenum func, GLint ref, GLuint mask);
+bool ValidateStencilFuncSeparate(Context *context,
+ GLenum face,
+ GLenum func,
+ GLint ref,
+ GLuint mask);
+bool ValidateStencilMask(Context *context, GLuint mask);
+bool ValidateStencilMaskSeparate(Context *context, GLenum face, GLuint mask);
+bool ValidateStencilOp(Context *context, GLenum fail, GLenum zfail, GLenum zpass);
+bool ValidateStencilOpSeparate(Context *context,
+ GLenum face,
+ GLenum sfail,
+ GLenum dpfail,
+ GLenum dppass);
+bool ValidateTexImage2D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTexParameterf(Context *context, TextureType targetPacked, GLenum pname, GLfloat param);
+bool ValidateTexParameterfv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLfloat *params);
+bool ValidateTexParameteri(Context *context, TextureType targetPacked, GLenum pname, GLint param);
+bool ValidateTexParameteriv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params);
+bool ValidateTexSubImage2D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateUniform1f(Context *context, GLint location, GLfloat v0);
+bool ValidateUniform1fv(Context *context, GLint location, GLsizei count, const GLfloat *value);
+bool ValidateUniform1i(Context *context, GLint location, GLint v0);
+bool ValidateUniform1iv(Context *context, GLint location, GLsizei count, const GLint *value);
+bool ValidateUniform2f(Context *context, GLint location, GLfloat v0, GLfloat v1);
+bool ValidateUniform2fv(Context *context, GLint location, GLsizei count, const GLfloat *value);
+bool ValidateUniform2i(Context *context, GLint location, GLint v0, GLint v1);
+bool ValidateUniform2iv(Context *context, GLint location, GLsizei count, const GLint *value);
+bool ValidateUniform3f(Context *context, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+bool ValidateUniform3fv(Context *context, GLint location, GLsizei count, const GLfloat *value);
+bool ValidateUniform3i(Context *context, GLint location, GLint v0, GLint v1, GLint v2);
+bool ValidateUniform3iv(Context *context, GLint location, GLsizei count, const GLint *value);
+bool ValidateUniform4f(Context *context,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3);
+bool ValidateUniform4fv(Context *context, GLint location, GLsizei count, const GLfloat *value);
+bool ValidateUniform4i(Context *context, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+bool ValidateUniform4iv(Context *context, GLint location, GLsizei count, const GLint *value);
+bool ValidateUniformMatrix2fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUniformMatrix3fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUniformMatrix4fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUseProgram(Context *context, GLuint program);
+bool ValidateValidateProgram(Context *context, GLuint program);
+bool ValidateVertexAttrib1f(Context *context, GLuint index, GLfloat x);
+bool ValidateVertexAttrib1fv(Context *context, GLuint index, const GLfloat *v);
+bool ValidateVertexAttrib2f(Context *context, GLuint index, GLfloat x, GLfloat y);
+bool ValidateVertexAttrib2fv(Context *context, GLuint index, const GLfloat *v);
+bool ValidateVertexAttrib3f(Context *context, GLuint index, GLfloat x, GLfloat y, GLfloat z);
+bool ValidateVertexAttrib3fv(Context *context, GLuint index, const GLfloat *v);
+bool ValidateVertexAttrib4f(Context *context,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w);
+bool ValidateVertexAttrib4fv(Context *context, GLuint index, const GLfloat *v);
+bool ValidateVertexAttribPointer(Context *context,
+ GLuint index,
+ GLint size,
+ VertexAttribType typePacked,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateViewport(Context *context, GLint x, GLint y, GLsizei width, GLsizei height);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES2_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES3.cpp b/gfx/angle/checkout/src/libANGLE/validationES3.cpp
new file mode 100644
index 0000000000..869a2033f4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES3.cpp
@@ -0,0 +1,4330 @@
+//
+// Copyright (c) 2013-2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES3.cpp: Validation functions for OpenGL ES 3.0 entry point parameters
+
+#include "libANGLE/validationES3_autogen.h"
+
+#include "anglebase/numerics/safe_conversions.h"
+#include "common/mathutil.h"
+#include "common/utilities.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/FramebufferAttachment.h"
+#include "libANGLE/Renderbuffer.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/formatutils.h"
+#include "libANGLE/validationES.h"
+
+using namespace angle;
+
+namespace gl
+{
+using namespace err;
+
+namespace
+{
+bool ValidateFramebufferTextureMultiviewBaseANGLE(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLsizei numViews)
+{
+ if (!(context->getExtensions().multiview || context->getExtensions().multiview2))
+ {
+ context->validationError(GL_INVALID_OPERATION, kMultiviewNotAvailable);
+ return false;
+ }
+
+ if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
+ {
+ return false;
+ }
+
+ if (texture != 0 && numViews < 1)
+ {
+ context->validationError(GL_INVALID_VALUE, kMultiviewViewsTooSmall);
+ return false;
+ }
+
+ const Extensions &extensions = context->getExtensions();
+ if (static_cast<GLuint>(numViews) > extensions.maxViews)
+ {
+ context->validationError(GL_INVALID_VALUE, kMultiviewViewsTooLarge);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateFramebufferTextureMultiviewLevelAndFormat(Context *context,
+ Texture *texture,
+ GLint level)
+{
+ TextureType type = texture->getType();
+ if (!ValidMipLevel(context, type, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+
+ const auto &format = texture->getFormat(NonCubeTextureTypeToTarget(type), level);
+ if (format.info->compressed)
+ {
+ context->validationError(GL_INVALID_OPERATION, kCompressedTexturesNotAttachable);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateUniformES3(Context *context, GLenum uniformType, GLint location, GLint count)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateUniform(context, uniformType, location, count);
+}
+
+bool ValidateUniformMatrixES3(Context *context,
+ GLenum valueType,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose)
+{
+ // Check for ES3 uniform entry points
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateUniformMatrix(context, valueType, location, count, transpose);
+}
+
+bool ValidateGenOrDeleteES3(Context *context, GLint n)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenOrDeleteCountES3(Context *context, GLint count)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ if (count < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateCopyTexture3DCommon(Context *context,
+ const Texture *source,
+ GLint sourceLevel,
+ GLint srcInternalFormat,
+ const Texture *dest,
+ GLint destLevel,
+ GLint internalFormat,
+ TextureTarget destTarget)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!context->getExtensions().copyTexture3d)
+ {
+ context->validationError(GL_INVALID_OPERATION, kANGLECopyTexture3DUnavailable);
+ return false;
+ }
+
+ if (!ValidTexture3DTarget(context, source->getType()))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ // Table 1.1 from the ANGLE_copy_texture_3d spec
+ switch (GetUnsizedFormat(srcInternalFormat))
+ {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_RED:
+ case GL_RED_INTEGER:
+ case GL_RG:
+ case GL_RG_INTEGER:
+ case GL_RGB:
+ case GL_RGB_INTEGER:
+ case GL_RGBA:
+ case GL_RGBA_INTEGER:
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ if (!ValidTexture3DTarget(context, TextureTargetToType(destTarget)))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ // Table 1.0 from the ANGLE_copy_texture_3d spec
+ switch (internalFormat)
+ {
+ case GL_RGB:
+ case GL_RGBA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ case GL_ALPHA:
+ case GL_R8:
+ case GL_R8_SNORM:
+ case GL_R16F:
+ case GL_R32F:
+ case GL_R8UI:
+ case GL_R8I:
+ case GL_R16UI:
+ case GL_R16I:
+ case GL_R32UI:
+ case GL_R32I:
+ case GL_RG:
+ case GL_RG8:
+ case GL_RG8_SNORM:
+ case GL_RG16F:
+ case GL_RG32F:
+ case GL_RG8UI:
+ case GL_RG8I:
+ case GL_RG16UI:
+ case GL_RG16I:
+ case GL_RG32UI:
+ case GL_RG32I:
+ case GL_RGB8:
+ case GL_SRGB8:
+ case GL_RGB565:
+ case GL_RGB8_SNORM:
+ case GL_R11F_G11F_B10F:
+ case GL_RGB9_E5:
+ case GL_RGB16F:
+ case GL_RGB32F:
+ case GL_RGB8UI:
+ case GL_RGB8I:
+ case GL_RGB16UI:
+ case GL_RGB16I:
+ case GL_RGB32UI:
+ case GL_RGB32I:
+ case GL_RGBA8:
+ case GL_SRGB8_ALPHA8:
+ case GL_RGBA8_SNORM:
+ case GL_RGB5_A1:
+ case GL_RGBA4:
+ case GL_RGB10_A2:
+ case GL_RGBA16F:
+ case GL_RGBA32F:
+ case GL_RGBA8UI:
+ case GL_RGBA8I:
+ case GL_RGB10_A2UI:
+ case GL_RGBA16UI:
+ case GL_RGBA16I:
+ case GL_RGBA32I:
+ case GL_RGBA32UI:
+ break;
+ default:
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ return true;
+}
+} // anonymous namespace
+
+static bool ValidateTexImageFormatCombination(gl::Context *context,
+ TextureType target,
+ GLenum internalFormat,
+ GLenum format,
+ GLenum type)
+{
+
+ // The type and format are valid if any supported internal format has that type and format
+ if (!ValidES3Format(format))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ if (!ValidES3Type(type))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidType);
+ return false;
+ }
+
+ // For historical reasons, glTexImage2D and glTexImage3D pass in their internal format as a
+ // GLint instead of a GLenum. Therefor an invalid internal format gives a GL_INVALID_VALUE
+ // error instead of a GL_INVALID_ENUM error. As this validation function is only called in
+ // the validation codepaths for glTexImage2D/3D, we record a GL_INVALID_VALUE error.
+ if (!ValidES3InternalFormat(internalFormat))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidInternalFormat);
+ return false;
+ }
+
+ // From the ES 3.0 spec section 3.8.3:
+ // Textures with a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL are supported by
+ // texture image specification commands only if target is TEXTURE_2D, TEXTURE_2D_ARRAY, or
+ // TEXTURE_CUBE_MAP.Using these formats in conjunction with any other target will result in an
+ // INVALID_OPERATION error.
+ if (target == TextureType::_3D && (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL))
+ {
+ context->validationError(GL_INVALID_OPERATION, k3DDepthStencil);
+ return false;
+ }
+
+ // Check if this is a valid format combination to load texture data
+ if (!ValidES3FormatCombination(format, type, internalFormat))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormatCombination);
+ return false;
+ }
+
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat, type);
+ if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateES3TexImageParametersBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei imageSize,
+ const void *pixels)
+{
+ TextureType texType = TextureTargetToType(target);
+
+ // Validate image size
+ if (!ValidImageSizeParameters(context, texType, level, width, height, depth, isSubImage))
+ {
+ // Error already processed.
+ return false;
+ }
+
+ // Verify zero border
+ if (border != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBorder);
+ return false;
+ }
+
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ std::numeric_limits<GLsizei>::max() - yoffset < height ||
+ std::numeric_limits<GLsizei>::max() - zoffset < depth)
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
+ return false;
+ }
+
+ const gl::Caps &caps = context->getCaps();
+
+ switch (texType)
+ {
+ case TextureType::_2D:
+ case TextureType::External:
+ if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
+ static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+
+ case TextureType::Rectangle:
+ ASSERT(level == 0);
+ if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
+ static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ if (isCompressed)
+ {
+ context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
+ return false;
+ }
+ break;
+
+ case TextureType::CubeMap:
+ if (!isSubImage && width != height)
+ {
+ context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions);
+ return false;
+ }
+
+ if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level))
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+
+ case TextureType::_3D:
+ if (static_cast<GLuint>(width) > (caps.max3DTextureSize >> level) ||
+ static_cast<GLuint>(height) > (caps.max3DTextureSize >> level) ||
+ static_cast<GLuint>(depth) > (caps.max3DTextureSize >> level))
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+
+ case TextureType::_2DArray:
+ if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
+ static_cast<GLuint>(height) > (caps.max2DTextureSize >> level) ||
+ static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ gl::Texture *texture = context->getTextureByType(texType);
+ if (!texture)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMissingTexture);
+ return false;
+ }
+
+ if (texture->getImmutableFormat() && !isSubImage)
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureIsImmutable);
+ return false;
+ }
+
+ // Validate texture formats
+ GLenum actualInternalFormat =
+ isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat;
+ if (isSubImage && actualInternalFormat == GL_NONE)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidMipLevel);
+ return false;
+ }
+
+ const gl::InternalFormat &actualFormatInfo = isSubImage
+ ? *texture->getFormat(target, level).info
+ : GetInternalFormatInfo(internalformat, type);
+ if (isCompressed)
+ {
+ if (!actualFormatInfo.compressed)
+ {
+ context->validationError(GL_INVALID_ENUM, kCompressedMismatch);
+ return false;
+ }
+
+ if (isSubImage)
+ {
+ if (!ValidCompressedSubImageSize(
+ context, actualFormatInfo.internalFormat, xoffset, yoffset, zoffset, width,
+ height, depth, texture->getWidth(target, level),
+ texture->getHeight(target, level), texture->getDepth(target, level)))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
+ return false;
+ }
+
+ if (format != actualInternalFormat)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMismatchedFormat);
+ return false;
+ }
+
+ if (actualInternalFormat == GL_ETC1_RGB8_OES)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat);
+ return false;
+ }
+ }
+ else
+ {
+ if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height,
+ depth))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
+ return false;
+ }
+ }
+
+ if (!actualFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ if (texType == TextureType::_3D)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
+ return false;
+ }
+
+ // Disallow 3D-only compressed formats from being set on 2D textures
+ if (actualFormatInfo.compressedBlockDepth > 1 && texType != TextureType::_2DArray)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
+ return false;
+ }
+ }
+ else
+ {
+ if (!ValidateTexImageFormatCombination(context, texType, actualInternalFormat, format,
+ type))
+ {
+ return false;
+ }
+ }
+
+ // Validate sub image parameters
+ if (isSubImage)
+ {
+ if (isCompressed != actualFormatInfo.compressed)
+ {
+ context->validationError(GL_INVALID_OPERATION, kCompressedMismatch);
+ return false;
+ }
+
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ std::numeric_limits<GLsizei>::max() - yoffset < height ||
+ std::numeric_limits<GLsizei>::max() - zoffset < depth)
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
+ return false;
+ }
+
+ if (static_cast<size_t>(xoffset + width) > texture->getWidth(target, level) ||
+ static_cast<size_t>(yoffset + height) > texture->getHeight(target, level) ||
+ static_cast<size_t>(zoffset + depth) > texture->getDepth(target, level))
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
+ return false;
+ }
+
+ if (width > 0 && height > 0 && depth > 0 && pixels == nullptr &&
+ context->getState().getTargetBuffer(gl::BufferBinding::PixelUnpack) == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kPixelDataNull);
+ return false;
+ }
+ }
+
+ GLenum sizeCheckFormat = isSubImage ? format : internalformat;
+ if (!ValidImageDataSize(context, texType, width, height, depth, sizeCheckFormat, type, pixels,
+ imageSize))
+ {
+ return false;
+ }
+
+ // Check for pixel unpack buffer related API errors
+ gl::Buffer *pixelUnpackBuffer = context->getState().getTargetBuffer(BufferBinding::PixelUnpack);
+ if (pixelUnpackBuffer != nullptr)
+ {
+ // ...data is not evenly divisible into the number of bytes needed to store in memory a
+ // datum
+ // indicated by type.
+ if (!isCompressed)
+ {
+ size_t offset = reinterpret_cast<size_t>(pixels);
+ size_t dataBytesPerPixel = static_cast<size_t>(gl::GetTypeInfo(type).bytes);
+
+ if ((offset % dataBytesPerPixel) != 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDataTypeNotAligned);
+ return false;
+ }
+ }
+
+ // ...the buffer object's data store is currently mapped.
+ if (pixelUnpackBuffer->isMapped())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferMapped);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateES3TexImage2DParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei imageSize,
+ const void *pixels)
+{
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ return ValidateES3TexImageParametersBase(context, target, level, internalformat, isCompressed,
+ isSubImage, xoffset, yoffset, zoffset, width, height,
+ depth, border, format, type, imageSize, pixels);
+}
+
+bool ValidateES3TexImage3DParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ if (!ValidTexture3DDestinationTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ if (IsETC2EACFormat(format) && target != TextureTarget::_2DArray)
+ {
+ // ES 3.1, Section 8.7, page 169.
+ context->validationError(GL_INVALID_OPERATION, kInternalFormatRequiresTexture2DArray);
+ return false;
+ }
+
+ return ValidateES3TexImageParametersBase(context, target, level, internalformat, isCompressed,
+ isSubImage, xoffset, yoffset, zoffset, width, height,
+ depth, border, format, type, bufSize, pixels);
+}
+
+struct EffectiveInternalFormatInfo
+{
+ GLenum effectiveFormat;
+ GLenum destFormat;
+ GLuint minRedBits;
+ GLuint maxRedBits;
+ GLuint minGreenBits;
+ GLuint maxGreenBits;
+ GLuint minBlueBits;
+ GLuint maxBlueBits;
+ GLuint minAlphaBits;
+ GLuint maxAlphaBits;
+};
+
+static bool QueryEffectiveFormatList(const InternalFormat &srcFormat,
+ GLenum targetFormat,
+ const EffectiveInternalFormatInfo *list,
+ size_t size,
+ GLenum *outEffectiveFormat)
+{
+ for (size_t curFormat = 0; curFormat < size; ++curFormat)
+ {
+ const EffectiveInternalFormatInfo &formatInfo = list[curFormat];
+ if ((formatInfo.destFormat == targetFormat) &&
+ (formatInfo.minRedBits <= srcFormat.redBits &&
+ formatInfo.maxRedBits >= srcFormat.redBits) &&
+ (formatInfo.minGreenBits <= srcFormat.greenBits &&
+ formatInfo.maxGreenBits >= srcFormat.greenBits) &&
+ (formatInfo.minBlueBits <= srcFormat.blueBits &&
+ formatInfo.maxBlueBits >= srcFormat.blueBits) &&
+ (formatInfo.minAlphaBits <= srcFormat.alphaBits &&
+ formatInfo.maxAlphaBits >= srcFormat.alphaBits))
+ {
+ *outEffectiveFormat = formatInfo.effectiveFormat;
+ return true;
+ }
+ }
+
+ *outEffectiveFormat = GL_NONE;
+ return false;
+}
+
+bool GetSizedEffectiveInternalFormatInfo(const InternalFormat &srcFormat,
+ GLenum *outEffectiveFormat)
+{
+ // 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 |
+ // clang-format off
+ constexpr EffectiveInternalFormatInfo list[] = {
+ { GL_ALPHA8_EXT, GL_NONE, 0, 0, 0, 0, 0, 0, 1, 8 },
+ { GL_R8, GL_NONE, 1, 8, 0, 0, 0, 0, 0, 0 },
+ { GL_RG8, GL_NONE, 1, 8, 1, 8, 0, 0, 0, 0 },
+ { GL_RGB565, GL_NONE, 1, 5, 1, 6, 1, 5, 0, 0 },
+ { GL_RGB8, GL_NONE, 6, 8, 7, 8, 6, 8, 0, 0 },
+ { GL_RGBA4, GL_NONE, 1, 4, 1, 4, 1, 4, 1, 4 },
+ { GL_RGB5_A1, GL_NONE, 5, 5, 5, 5, 5, 5, 1, 1 },
+ { GL_RGBA8, GL_NONE, 5, 8, 5, 8, 5, 8, 2, 8 },
+ { GL_RGB10_A2, GL_NONE, 9, 10, 9, 10, 9, 10, 2, 2 },
+ };
+ // clang-format on
+
+ return QueryEffectiveFormatList(srcFormat, GL_NONE, list, ArraySize(list), outEffectiveFormat);
+}
+
+bool GetUnsizedEffectiveInternalFormatInfo(const InternalFormat &srcFormat,
+ const InternalFormat &destFormat,
+ GLenum *outEffectiveFormat)
+{
+ constexpr GLuint umax = UINT_MAX;
+
+ // OpenGL ES 3.0.3 Specification, Table 3.17, pg 141:
+ // Effective internal format coresponding to destination internal format andlinear source buffer
+ // component sizes.
+ // | Source channel min/max sizes |
+ // Effective Internal Format | Dest Format | R | G | B | A |
+ // clang-format off
+ constexpr EffectiveInternalFormatInfo list[] = {
+ { GL_ALPHA8_EXT, GL_ALPHA, 0, umax, 0, umax, 0, umax, 1, 8 },
+ { GL_LUMINANCE8_EXT, GL_LUMINANCE, 1, 8, 0, umax, 0, umax, 0, umax },
+ { GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE_ALPHA, 1, 8, 0, umax, 0, umax, 1, 8 },
+ { GL_RGB565, GL_RGB, 1, 5, 1, 6, 1, 5, 0, umax },
+ { GL_RGB8, GL_RGB, 6, 8, 7, 8, 6, 8, 0, umax },
+ { GL_RGBA4, GL_RGBA, 1, 4, 1, 4, 1, 4, 1, 4 },
+ { GL_RGB5_A1, GL_RGBA, 5, 5, 5, 5, 5, 5, 1, 1 },
+ { GL_RGBA8, GL_RGBA, 5, 8, 5, 8, 5, 8, 5, 8 },
+ };
+ // clang-format on
+
+ return QueryEffectiveFormatList(srcFormat, destFormat.format, list, ArraySize(list),
+ outEffectiveFormat);
+}
+
+static bool GetEffectiveInternalFormat(const InternalFormat &srcFormat,
+ const InternalFormat &destFormat,
+ GLenum *outEffectiveFormat)
+{
+ if (destFormat.sized)
+ {
+ return GetSizedEffectiveInternalFormatInfo(srcFormat, outEffectiveFormat);
+ }
+ else
+ {
+ return GetUnsizedEffectiveInternalFormatInfo(srcFormat, destFormat, outEffectiveFormat);
+ }
+}
+
+static bool EqualOrFirstZero(GLuint first, GLuint second)
+{
+ return first == 0 || first == second;
+}
+
+static bool IsValidES3CopyTexImageCombination(const InternalFormat &textureFormatInfo,
+ const InternalFormat &framebufferFormatInfo,
+ GLuint readBufferHandle)
+{
+ if (!ValidES3CopyConversion(textureFormatInfo.format, framebufferFormatInfo.format))
+ {
+ return false;
+ }
+
+ // 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 ((textureFormatInfo.colorEncoding == GL_SRGB) !=
+ (framebufferFormatInfo.colorEncoding == GL_SRGB))
+ {
+ return false;
+ }
+
+ if (((textureFormatInfo.componentType == GL_INT) !=
+ (framebufferFormatInfo.componentType == GL_INT)) ||
+ ((textureFormatInfo.componentType == GL_UNSIGNED_INT) !=
+ (framebufferFormatInfo.componentType == GL_UNSIGNED_INT)))
+ {
+ return false;
+ }
+
+ if ((textureFormatInfo.componentType == GL_UNSIGNED_NORMALIZED ||
+ textureFormatInfo.componentType == GL_SIGNED_NORMALIZED) &&
+ !(framebufferFormatInfo.componentType == GL_UNSIGNED_NORMALIZED ||
+ framebufferFormatInfo.componentType == GL_SIGNED_NORMALIZED))
+ {
+ return false;
+ }
+
+ // SNORM is not supported (e.g. is not in the tables of "effective internal format" that
+ // correspond to internal formats.
+ if (textureFormatInfo.componentType == GL_SIGNED_NORMALIZED)
+ {
+ return false;
+ }
+
+ // Section 3.8.5 of the GLES 3.0.3 (and section 8.6 of the GLES 3.2) spec has a caveat, that
+ // the KHR dEQP tests enforce:
+ //
+ // Note that the above rules disallow matches where some components sizes are smaller and
+ // others are larger (such as RGB10_A2).
+ if (!textureFormatInfo.sized && (framebufferFormatInfo.internalFormat == GL_RGB10_A2))
+ {
+ 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.
+ const InternalFormat *sourceEffectiveFormat = nullptr;
+ if (readBufferHandle != 0)
+ {
+ // Not the default framebuffer, therefore the read buffer must be a user-created texture or
+ // renderbuffer
+ if (framebufferFormatInfo.sized)
+ {
+ sourceEffectiveFormat = &framebufferFormatInfo;
+ }
+ 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.
+ sourceEffectiveFormat =
+ &GetSizedInternalFormatInfo(framebufferFormatInfo.sizedInternalFormat);
+ }
+ }
+ else
+ {
+ // The effective internal format must be derived from the source framebuffer's channel
+ // sizes. This is done in GetEffectiveInternalFormat for linear buffers (table 3.17)
+ if (framebufferFormatInfo.colorEncoding == GL_LINEAR)
+ {
+ GLenum effectiveFormat;
+ if (GetEffectiveInternalFormat(framebufferFormatInfo, textureFormatInfo,
+ &effectiveFormat))
+ {
+ sourceEffectiveFormat = &GetSizedInternalFormatInfo(effectiveFormat);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else if (framebufferFormatInfo.colorEncoding == GL_SRGB)
+ {
+ // SRGB buffers can only be copied to sized format destinations according to table 3.18
+ if (textureFormatInfo.sized &&
+ (framebufferFormatInfo.redBits >= 1 && framebufferFormatInfo.redBits <= 8) &&
+ (framebufferFormatInfo.greenBits >= 1 && framebufferFormatInfo.greenBits <= 8) &&
+ (framebufferFormatInfo.blueBits >= 1 && framebufferFormatInfo.blueBits <= 8) &&
+ (framebufferFormatInfo.alphaBits >= 1 && framebufferFormatInfo.alphaBits <= 8))
+ {
+ sourceEffectiveFormat = &GetSizedInternalFormatInfo(GL_SRGB8_ALPHA8);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ UNREACHABLE();
+ return false;
+ }
+ }
+
+ if (textureFormatInfo.sized)
+ {
+ // 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 the
+ // destination format exists.
+ if (!EqualOrFirstZero(textureFormatInfo.redBits, sourceEffectiveFormat->redBits) ||
+ !EqualOrFirstZero(textureFormatInfo.greenBits, sourceEffectiveFormat->greenBits) ||
+ !EqualOrFirstZero(textureFormatInfo.blueBits, sourceEffectiveFormat->blueBits) ||
+ !EqualOrFirstZero(textureFormatInfo.alphaBits, sourceEffectiveFormat->alphaBits))
+ {
+ return false;
+ }
+ }
+
+ return true; // A conversion function exists, and no rule in the specification has precluded
+ // conversion between these formats.
+}
+
+bool ValidateES3CopyTexImageParametersBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ Format textureFormat = Format::Invalid();
+ if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+ xoffset, yoffset, zoffset, x, y, width, height, border,
+ &textureFormat))
+ {
+ return false;
+ }
+ ASSERT(textureFormat.valid() || !isSubImage);
+
+ const auto &state = context->getState();
+ gl::Framebuffer *framebuffer = state.getReadFramebuffer();
+ GLuint readFramebufferID = framebuffer->id();
+
+ if (!ValidateFramebufferComplete(context, framebuffer))
+ {
+ return false;
+ }
+
+ if (readFramebufferID != 0 && !ValidateFramebufferNotMultisampled(context, framebuffer))
+ {
+ return false;
+ }
+
+ const FramebufferAttachment *source = framebuffer->getReadColorAttachment();
+
+ // According to ES 3.x spec, if the internalformat of the texture
+ // is RGB9_E5 and copy to such a texture, generate INVALID_OPERATION.
+ if (textureFormat.info->internalFormat == GL_RGB9_E5)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
+ return false;
+ }
+
+ if (isSubImage)
+ {
+ if (!IsValidES3CopyTexImageCombination(*textureFormat.info, *source->getFormat().info,
+ readFramebufferID))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidCopyCombination);
+ return false;
+ }
+ }
+ else
+ {
+ // Use format/type from the source FBO. (Might not be perfect for all cases?)
+ const InternalFormat &framebufferFormat = *source->getFormat().info;
+ const InternalFormat &copyFormat = GetInternalFormatInfo(internalformat, GL_UNSIGNED_BYTE);
+ if (!IsValidES3CopyTexImageCombination(copyFormat, framebufferFormat, readFramebufferID))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidCopyCombination);
+ return false;
+ }
+ }
+
+ // If width or height is zero, it is a no-op. Return false without setting an error.
+ return (width > 0 && height > 0);
+}
+
+bool ValidateES3CopyTexImage2DParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ if (!ValidTexture2DDestinationTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ return ValidateES3CopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+ xoffset, yoffset, zoffset, x, y, width, height,
+ border);
+}
+
+bool ValidateES3CopyTexImage3DParameters(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ if (!ValidTexture3DDestinationTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ return ValidateES3CopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+ xoffset, yoffset, zoffset, x, y, width, height,
+ border);
+}
+
+bool ValidateES3TexStorageParametersBase(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ if (width < 1 || height < 1 || depth < 1 || levels < 1)
+ {
+ context->validationError(GL_INVALID_VALUE, kTextureSizeTooSmall);
+ return false;
+ }
+
+ GLsizei maxDim = std::max(width, height);
+ if (target != TextureType::_2DArray)
+ {
+ maxDim = std::max(maxDim, depth);
+ }
+
+ if (levels > gl::log2(maxDim) + 1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidMipLevels);
+ return false;
+ }
+
+ const gl::Caps &caps = context->getCaps();
+
+ switch (target)
+ {
+ case TextureType::_2D:
+ {
+ if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
+ static_cast<GLuint>(height) > caps.max2DTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ }
+ break;
+
+ case TextureType::Rectangle:
+ {
+ if (levels != 1)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevels);
+ return false;
+ }
+
+ if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
+ static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ }
+ break;
+
+ case TextureType::CubeMap:
+ {
+ if (width != height)
+ {
+ context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions);
+ return false;
+ }
+
+ if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ }
+ break;
+
+ case TextureType::_3D:
+ {
+ if (static_cast<GLuint>(width) > caps.max3DTextureSize ||
+ static_cast<GLuint>(height) > caps.max3DTextureSize ||
+ static_cast<GLuint>(depth) > caps.max3DTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ }
+ break;
+
+ case TextureType::_2DArray:
+ {
+ if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
+ static_cast<GLuint>(height) > caps.max2DTextureSize ||
+ static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
+ {
+ context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize);
+ return false;
+ }
+ }
+ break;
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+
+ gl::Texture *texture = context->getTextureByType(target);
+ if (!texture || texture->id() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMissingTexture);
+ return false;
+ }
+
+ if (texture->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureIsImmutable);
+ return false;
+ }
+
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
+ if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ if (!formatInfo.sized)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFormat);
+ return false;
+ }
+
+ if (formatInfo.compressed && target == TextureType::Rectangle)
+ {
+ context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
+ return false;
+ }
+
+ if (formatInfo.compressed && target == TextureType::_3D)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateES3TexStorage2DParameters(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ if (!ValidTexture2DTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ return ValidateES3TexStorageParametersBase(context, target, levels, internalformat, width,
+ height, depth);
+}
+
+bool ValidateES3TexStorage3DParameters(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ if (!ValidTexture3DTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ return ValidateES3TexStorageParametersBase(context, target, levels, internalformat, width,
+ height, depth);
+}
+
+bool ValidateBeginQuery(gl::Context *context, QueryType target, GLuint id)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateBeginQueryBase(context, target, id);
+}
+
+bool ValidateEndQuery(gl::Context *context, QueryType target)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateEndQueryBase(context, target);
+}
+
+bool ValidateGetQueryiv(Context *context, QueryType target, GLenum pname, GLint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateGetQueryivBase(context, target, pname, nullptr);
+}
+
+bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
+}
+
+bool ValidateFramebufferTextureLayer(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
+ {
+ return false;
+ }
+
+ const gl::Caps &caps = context->getCaps();
+ if (texture != 0)
+ {
+ if (layer < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeLayer);
+ return false;
+ }
+
+ gl::Texture *tex = context->getTexture(texture);
+ ASSERT(tex);
+
+ switch (tex->getType())
+ {
+ case TextureType::_2DArray:
+ {
+ if (level > gl::log2(caps.max2DTextureSize))
+ {
+ context->validationError(GL_INVALID_VALUE, kFramebufferTextureInvalidMipLevel);
+ return false;
+ }
+
+ if (static_cast<GLuint>(layer) >= caps.maxArrayTextureLayers)
+ {
+ context->validationError(GL_INVALID_VALUE, kFramebufferTextureInvalidLayer);
+ return false;
+ }
+ }
+ break;
+
+ case TextureType::_3D:
+ {
+ if (level > gl::log2(caps.max3DTextureSize))
+ {
+ context->validationError(GL_INVALID_VALUE, kFramebufferTextureInvalidMipLevel);
+ return false;
+ }
+
+ if (static_cast<GLuint>(layer) >= caps.max3DTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kFramebufferTextureInvalidLayer);
+ return false;
+ }
+ }
+ break;
+
+ case TextureType::_2DMultisampleArray:
+ {
+ if (level != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kFramebufferTextureInvalidMipLevel);
+ return false;
+ }
+
+ if (static_cast<GLuint>(layer) >= caps.maxArrayTextureLayers)
+ {
+ context->validationError(GL_INVALID_VALUE, kFramebufferTextureInvalidLayer);
+ return false;
+ }
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_OPERATION,
+ kFramebufferTextureLayerIncorrectTextureType);
+ return false;
+ }
+
+ const auto &format = tex->getFormat(NonCubeTextureTypeToTarget(tex->getType()), level);
+ if (format.info->compressed)
+ {
+ context->validationError(GL_INVALID_OPERATION, kCompressedTexturesNotAttachable);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateInvalidateFramebuffer(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ bool defaultFramebuffer = false;
+
+ switch (target)
+ {
+ case GL_DRAW_FRAMEBUFFER:
+ case GL_FRAMEBUFFER:
+ defaultFramebuffer = context->getState().getDrawFramebuffer()->id() == 0;
+ break;
+ case GL_READ_FRAMEBUFFER:
+ defaultFramebuffer = context->getState().getReadFramebuffer()->id() == 0;
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments,
+ defaultFramebuffer);
+}
+
+bool ValidateInvalidateSubFramebuffer(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ if (width < 0 || height < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ return ValidateInvalidateFramebuffer(context, target, numAttachments, attachments);
+}
+
+bool ValidateClearBuffer(Context *context)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateFramebufferComplete(context, context->getState().getDrawFramebuffer()))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawRangeElements(Context *context,
+ PrimitiveMode mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (end < start)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidElementRange);
+ return false;
+ }
+
+ if (!ValidateDrawElementsCommon(context, mode, count, type, indices, 0))
+ {
+ return false;
+ }
+
+ // Skip range checks for no-op calls.
+ if (count <= 0)
+ {
+ return true;
+ }
+
+ // Note that resolving the index range is a bit slow. We should probably optimize this.
+ IndexRange indexRange;
+ ANGLE_VALIDATION_TRY(context->getState().getVertexArray()->getIndexRange(context, type, count,
+ indices, &indexRange));
+
+ if (indexRange.end > end || indexRange.start < start)
+ {
+ // GL spec says that behavior in this case is undefined - generating an error is fine.
+ context->validationError(GL_INVALID_OPERATION, kExceedsElementRange);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateGetUniformBase(context, program, location);
+}
+
+bool ValidateReadBuffer(Context *context, GLenum src)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ const Framebuffer *readFBO = context->getState().getReadFramebuffer();
+
+ if (readFBO == nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoReadFramebuffer);
+ return false;
+ }
+
+ if (src == GL_NONE)
+ {
+ return true;
+ }
+
+ if (src != GL_BACK && (src < GL_COLOR_ATTACHMENT0 || src > GL_COLOR_ATTACHMENT31))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidReadBuffer);
+ return false;
+ }
+
+ if (readFBO->id() == 0)
+ {
+ if (src != GL_BACK)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidDefaultReadBuffer);
+ return false;
+ }
+ }
+ else
+ {
+ GLuint drawBuffer = static_cast<GLuint>(src - GL_COLOR_ATTACHMENT0);
+
+ if (drawBuffer >= context->getCaps().maxDrawBuffers)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExceedsMaxDrawBuffers);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateCompressedTexImage3D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ if ((context->getClientMajorVersion() < 3) && !context->getExtensions().texture3DOES)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidTextureTarget(context, TextureTargetToType(target)))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ // Validate image size
+ if (!ValidImageSizeParameters(context, TextureTargetToType(target), level, width, height, depth,
+ false))
+ {
+ // Error already generated.
+ return false;
+ }
+
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalformat);
+ if (!formatInfo.compressed)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidCompressedFormat);
+ return false;
+ }
+
+ GLuint blockSize = 0;
+ if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth), &blockSize))
+ {
+ context->validationError(GL_INVALID_VALUE, kIntegerOverflow);
+ return false;
+ }
+
+ if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidCompressedImageSize);
+ return false;
+ }
+
+ // 3D texture target validation
+ if (target != TextureTarget::_3D && target != TextureTarget::_2DArray)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
+ return false;
+ }
+
+ // validateES3TexImageFormat sets the error code if there is an error
+ if (!ValidateES3TexImage3DParameters(context, target, level, internalformat, true, false, 0, 0,
+ 0, width, height, depth, border, GL_NONE, GL_NONE, -1,
+ data))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCompressedTexImage3DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const void *data)
+{
+ if (!ValidateRobustCompressedTexImageBase(context, imageSize, dataSize))
+ {
+ return false;
+ }
+
+ return ValidateCompressedTexImage3D(context, target, level, internalformat, width, height,
+ depth, border, imageSize, data);
+}
+
+bool ValidateBindVertexArray(Context *context, GLuint array)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateBindVertexArrayBase(context, array);
+}
+
+bool ValidateIsVertexArray(Context *context, GLuint array)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return true;
+}
+
+static bool ValidateBindBufferCommon(Context *context,
+ BufferBinding target,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (buffer != 0 && offset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (!context->getState().isBindGeneratesResourceEnabled() &&
+ !context->isBufferGenerated(buffer))
+ {
+ context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ switch (target)
+ {
+ case BufferBinding::TransformFeedback:
+ {
+ if (index >= caps.maxTransformFeedbackSeparateAttributes)
+ {
+ context->validationError(GL_INVALID_VALUE,
+ kIndexExceedsTransformFeedbackBufferBindings);
+ return false;
+ }
+ if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0))
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetAndSizeAlignment);
+ return false;
+ }
+
+ if (context->getState().isTransformFeedbackActive())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackTargetActive);
+ return false;
+ }
+ break;
+ }
+ case BufferBinding::Uniform:
+ {
+ if (index >= caps.maxUniformBufferBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxUniformBufferBindings);
+ return false;
+ }
+
+ ASSERT(caps.uniformBufferOffsetAlignment);
+ if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kUniformBufferOffsetAlignment);
+ return false;
+ }
+ break;
+ }
+ case BufferBinding::AtomicCounter:
+ {
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ if (index >= caps.maxAtomicCounterBufferBindings)
+ {
+ context->validationError(GL_INVALID_VALUE,
+ kIndexExceedsMaxAtomicCounterBufferBindings);
+ return false;
+ }
+ if (buffer != 0 && (offset % 4) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetAlignment);
+ return false;
+ }
+ break;
+ }
+ case BufferBinding::ShaderStorage:
+ {
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ if (index >= caps.maxShaderStorageBufferBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxShaderStorageBufferBindings);
+ return false;
+ }
+ ASSERT(caps.shaderStorageBufferOffsetAlignment);
+ if (buffer != 0 && (offset % caps.shaderStorageBufferOffsetAlignment) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kShaderStorageBufferOffsetAlignment);
+ return false;
+ }
+ break;
+ }
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindBufferBase(Context *context, BufferBinding target, GLuint index, GLuint buffer)
+{
+ return ValidateBindBufferCommon(context, target, index, buffer, 0, 0);
+}
+
+bool ValidateBindBufferRange(Context *context,
+ BufferBinding target,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ if (buffer != 0 && size <= 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBindBufferSize);
+ return false;
+ }
+ return ValidateBindBufferCommon(context, target, index, buffer, offset, size);
+}
+
+bool ValidateProgramBinary(Context *context,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateProgramBinaryBase(context, program, binaryFormat, binary, length);
+}
+
+bool ValidateGetProgramBinary(Context *context,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateGetProgramBinaryBase(context, program, bufSize, length, binaryFormat, binary);
+}
+
+bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, GLint value)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (GetValidProgram(context, program) == nullptr)
+ {
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
+ if (value != GL_FALSE && value != GL_TRUE)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBooleanValue);
+ return false;
+ }
+ break;
+
+ case GL_PROGRAM_SEPARABLE:
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kES31Required);
+ return false;
+ }
+
+ if (value != GL_FALSE && value != GL_TRUE)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidBooleanValue);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBlitFramebuffer(Context *context,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
+ dstX1, dstY1, mask, filter);
+}
+
+bool ValidateClearBufferiv(Context *context, GLenum buffer, GLint drawbuffer, const GLint *value)
+{
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 ||
+ static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
+ return false;
+ }
+ if (context->getExtensions().webglCompatibility)
+ {
+ constexpr GLenum validComponentTypes[] = {GL_INT};
+ if (!ValidateWebGLFramebufferAttachmentClearType(
+ context, drawbuffer, validComponentTypes, ArraySize(validComponentTypes)))
+ {
+ return false;
+ }
+ }
+ break;
+
+ case GL_STENCIL:
+ if (drawbuffer != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDepthStencilDrawBuffer);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return ValidateClearBuffer(context);
+}
+
+bool ValidateClearBufferuiv(Context *context, GLenum buffer, GLint drawbuffer, const GLuint *value)
+{
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 ||
+ static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
+ return false;
+ }
+ if (context->getExtensions().webglCompatibility)
+ {
+ constexpr GLenum validComponentTypes[] = {GL_UNSIGNED_INT};
+ if (!ValidateWebGLFramebufferAttachmentClearType(
+ context, drawbuffer, validComponentTypes, ArraySize(validComponentTypes)))
+ {
+ return false;
+ }
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return ValidateClearBuffer(context);
+}
+
+bool ValidateClearBufferfv(Context *context, GLenum buffer, GLint drawbuffer, const GLfloat *value)
+{
+ switch (buffer)
+ {
+ case GL_COLOR:
+ if (drawbuffer < 0 ||
+ static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxDrawBuffer);
+ return false;
+ }
+ if (context->getExtensions().webglCompatibility)
+ {
+ constexpr GLenum validComponentTypes[] = {GL_FLOAT, GL_UNSIGNED_NORMALIZED,
+ GL_SIGNED_NORMALIZED};
+ if (!ValidateWebGLFramebufferAttachmentClearType(
+ context, drawbuffer, validComponentTypes, ArraySize(validComponentTypes)))
+ {
+ return false;
+ }
+ }
+ break;
+
+ case GL_DEPTH:
+ if (drawbuffer != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDepthStencilDrawBuffer);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return ValidateClearBuffer(context);
+}
+
+bool ValidateClearBufferfi(Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil)
+{
+ switch (buffer)
+ {
+ case GL_DEPTH_STENCIL:
+ if (drawbuffer != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDepthStencilDrawBuffer);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return ValidateClearBuffer(context);
+}
+
+bool ValidateDrawBuffers(Context *context, GLsizei n, const GLenum *bufs)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateDrawBuffersBase(context, n, bufs);
+}
+
+bool ValidateCopyTexSubImage3D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ if ((context->getClientMajorVersion() < 3) && !context->getExtensions().texture3DOES)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateES3CopyTexImage3DParameters(context, target, level, GL_NONE, true, xoffset,
+ yoffset, zoffset, x, y, width, height, 0);
+}
+
+bool ValidateCopyTexture3DANGLE(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ const Texture *source = context->getTexture(sourceId);
+ if (source == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
+ return false;
+ }
+
+ TextureType sourceType = source->getType();
+ ASSERT(sourceType != TextureType::CubeMap);
+ TextureTarget sourceTarget = NonCubeTextureTypeToTarget(sourceType);
+ const Format &sourceFormat = source->getFormat(sourceTarget, sourceLevel);
+
+ const Texture *dest = context->getTexture(destId);
+ if (dest == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
+ return false;
+ }
+
+ if (!ValidateCopyTexture3DCommon(context, source, sourceLevel,
+ sourceFormat.info->internalFormat, dest, destLevel,
+ internalFormat, destTarget))
+ {
+ return false;
+ }
+
+ if (!ValidMipLevel(context, source->getType(), sourceLevel))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureLevel);
+ return false;
+ }
+
+ GLsizei sourceWidth = static_cast<GLsizei>(source->getWidth(sourceTarget, sourceLevel));
+ GLsizei sourceHeight = static_cast<GLsizei>(source->getHeight(sourceTarget, sourceLevel));
+ if (sourceWidth == 0 || sourceHeight == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidSourceTextureSize);
+ return false;
+ }
+
+ if (dest->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kDestinationImmutable);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCopySubTexture3DANGLE(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ const Texture *source = context->getTexture(sourceId);
+ if (source == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
+ return false;
+ }
+
+ TextureType sourceType = source->getType();
+ ASSERT(sourceType != TextureType::CubeMap);
+ TextureTarget sourceTarget = NonCubeTextureTypeToTarget(sourceType);
+ const Format &sourceFormat = source->getFormat(sourceTarget, sourceLevel);
+
+ const Texture *dest = context->getTexture(destId);
+ if (dest == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
+ return false;
+ }
+
+ const InternalFormat &destFormat = *dest->getFormat(destTarget, destLevel).info;
+
+ if (!ValidateCopyTexture3DCommon(context, source, sourceLevel,
+ sourceFormat.info->internalFormat, dest, destLevel,
+ destFormat.internalFormat, destTarget))
+ {
+ return false;
+ }
+
+ if (x < 0 || y < 0 || z < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeXYZ);
+ return false;
+ }
+
+ if (width < 0 || height < 0 || depth < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeHeightWidthDepth);
+ return false;
+ }
+
+ if (static_cast<size_t>(x + width) > source->getWidth(sourceTarget, sourceLevel) ||
+ static_cast<size_t>(y + height) > source->getHeight(sourceTarget, sourceLevel) ||
+ static_cast<size_t>(z + depth) > source->getDepth(sourceTarget, sourceLevel))
+ {
+ context->validationError(GL_INVALID_VALUE, kSourceTextureTooSmall);
+ return false;
+ }
+
+ if (TextureTargetToType(destTarget) != dest->getType())
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType);
+ return false;
+ }
+
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (static_cast<size_t>(xoffset + width) > dest->getWidth(destTarget, destLevel) ||
+ static_cast<size_t>(yoffset + height) > dest->getHeight(destTarget, destLevel) ||
+ static_cast<size_t>(zoffset + depth) > dest->getDepth(destTarget, destLevel))
+ {
+ context->validationError(GL_INVALID_VALUE, kDestinationTextureTooSmall);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTexImage3D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ if ((context->getClientMajorVersion() < 3) && !context->getExtensions().texture3DOES)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ return ValidateES3TexImage3DParameters(context, target, level, internalformat, false, false, 0,
+ 0, 0, width, height, depth, border, format, type, -1,
+ pixels);
+}
+
+bool ValidateTexImage3DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ return ValidateES3TexImage3DParameters(context, target, level, internalformat, false, false, 0,
+ 0, 0, width, height, depth, border, format, type,
+ bufSize, pixels);
+}
+
+bool ValidateTexSubImage3D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ if ((context->getClientMajorVersion() < 3) && !context->getExtensions().texture3DOES)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateES3TexImage3DParameters(context, target, level, GL_NONE, false, true, xoffset,
+ yoffset, zoffset, width, height, depth, 0, format, type,
+ -1, pixels);
+}
+
+bool ValidateTexSubImage3DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ return ValidateES3TexImage3DParameters(context, target, level, GL_NONE, false, true, xoffset,
+ yoffset, zoffset, width, height, depth, 0, format, type,
+ bufSize, pixels);
+}
+
+bool ValidateCompressedTexSubImage3D(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ if ((context->getClientMajorVersion() < 3) && !context->getExtensions().texture3DOES)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ const InternalFormat &formatInfo = GetSizedInternalFormatInfo(format);
+ if (!formatInfo.compressed)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidCompressedFormat);
+ return false;
+ }
+
+ GLuint blockSize = 0;
+ if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth), &blockSize))
+ {
+ context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
+ return false;
+ }
+
+ if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidCompressedImageSize);
+ return false;
+ }
+
+ if (!ValidateES3TexImage3DParameters(context, target, level, GL_NONE, true, true, xoffset,
+ yoffset, zoffset, width, height, depth, 0, format, GL_NONE,
+ -1, data))
+ {
+ return false;
+ }
+
+ if (!data)
+ {
+ context->validationError(GL_INVALID_VALUE, kPixelDataNull);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateCompressedTexSubImage3DRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const void *data)
+{
+ if (!ValidateRobustCompressedTexImageBase(context, imageSize, dataSize))
+ {
+ return false;
+ }
+
+ return ValidateCompressedTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, imageSize, data);
+}
+
+bool ValidateGenQueries(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDeleteES3(context, n);
+}
+
+bool ValidateDeleteQueries(Context *context, GLint n, const GLuint *)
+{
+ return ValidateGenOrDeleteES3(context, n);
+}
+
+bool ValidateGenSamplers(Context *context, GLint count, GLuint *)
+{
+ return ValidateGenOrDeleteCountES3(context, count);
+}
+
+bool ValidateDeleteSamplers(Context *context, GLint count, const GLuint *)
+{
+ return ValidateGenOrDeleteCountES3(context, count);
+}
+
+bool ValidateGenTransformFeedbacks(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDeleteES3(context, n);
+}
+
+bool ValidateDeleteTransformFeedbacks(Context *context, GLint n, const GLuint *ids)
+{
+ if (!ValidateGenOrDeleteES3(context, n))
+ {
+ return false;
+ }
+ for (GLint i = 0; i < n; ++i)
+ {
+ auto *transformFeedback = context->getTransformFeedback(ids[i]);
+ if (transformFeedback != nullptr && transformFeedback->isActive())
+ {
+ // ES 3.0.4 section 2.15.1 page 86
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackActiveDelete);
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateGenVertexArrays(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDeleteES3(context, n);
+}
+
+bool ValidateDeleteVertexArrays(Context *context, GLint n, const GLuint *)
+{
+ return ValidateGenOrDeleteES3(context, n);
+}
+
+bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMode)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ switch (primitiveMode)
+ {
+ case PrimitiveMode::Triangles:
+ case PrimitiveMode::Lines:
+ case PrimitiveMode::Points:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPrimitiveMode);
+ return false;
+ }
+
+ TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != nullptr);
+
+ if (transformFeedback->isActive())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransfomFeedbackAlreadyActive);
+ return false;
+ }
+
+ for (size_t i = 0; i < transformFeedback->getIndexedBufferCount(); i++)
+ {
+ const auto &buffer = transformFeedback->getIndexedBuffer(i);
+ if (buffer.get())
+ {
+ if (buffer->isMapped())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferMapped);
+ return false;
+ }
+ if ((context->getLimitations().noDoubleBoundTransformFeedbackBuffers ||
+ context->getExtensions().webglCompatibility) &&
+ buffer->isDoubleBoundForTransformFeedback())
+ {
+ context->validationError(GL_INVALID_OPERATION,
+ kTransformFeedbackBufferMultipleOutputs);
+ return false;
+ }
+ }
+ }
+
+ Program *program = context->getState().getLinkedProgram(context);
+
+ if (!program)
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotBound);
+ return false;
+ }
+
+ if (program->getTransformFeedbackVaryingCount() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoTransformFeedbackOutputVariables);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetBufferPointerv(Context *context, BufferBinding target, GLenum pname, void **params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateGetBufferPointervBase(context, target, pname, nullptr, params);
+}
+
+bool ValidateGetBufferPointervRobustANGLE(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (context->getClientMajorVersion() < 3 && !context->getExtensions().mapBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ if (!ValidateGetBufferPointervBase(context, target, pname, &numParams, params))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateUnmapBuffer(Context *context, BufferBinding target)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateUnmapBufferBase(context, target);
+}
+
+bool ValidateMapBufferRange(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateMapBufferRangeBase(context, target, offset, length, access);
+}
+
+bool ValidateFlushMappedBufferRange(Context *context,
+ BufferBinding target,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateFlushMappedBufferRangeBase(context, target, offset, length);
+}
+
+bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLsizei *length)
+{
+ if (length)
+ {
+ *length = 0;
+ }
+
+ GLenum nativeType;
+ unsigned int numParams;
+ if (!context->getIndexedQueryParameterInfo(pname, &nativeType, &numParams))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ switch (pname)
+ {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ if (index >= caps.maxTransformFeedbackSeparateAttributes)
+ {
+ context->validationError(GL_INVALID_VALUE,
+ kIndexExceedsMaxTransformFeedbackAttribs);
+ return false;
+ }
+ break;
+
+ case GL_UNIFORM_BUFFER_START:
+ case GL_UNIFORM_BUFFER_SIZE:
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index >= caps.maxUniformBufferBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxUniformBufferBindings);
+ return false;
+ }
+ break;
+
+ case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
+ case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
+ if (index >= 3u)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxWorkgroupDimensions);
+ return false;
+ }
+ break;
+
+ case GL_ATOMIC_COUNTER_BUFFER_START:
+ case GL_ATOMIC_COUNTER_BUFFER_SIZE:
+ case GL_ATOMIC_COUNTER_BUFFER_BINDING:
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ if (index >= caps.maxAtomicCounterBufferBindings)
+ {
+ context->validationError(GL_INVALID_VALUE,
+ kIndexExceedsMaxAtomicCounterBufferBindings);
+ return false;
+ }
+ break;
+
+ case GL_SHADER_STORAGE_BUFFER_START:
+ case GL_SHADER_STORAGE_BUFFER_SIZE:
+ case GL_SHADER_STORAGE_BUFFER_BINDING:
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ if (index >= caps.maxShaderStorageBufferBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxShaderStorageBufferBindings);
+ return false;
+ }
+ break;
+
+ case GL_VERTEX_BINDING_BUFFER:
+ case GL_VERTEX_BINDING_DIVISOR:
+ case GL_VERTEX_BINDING_OFFSET:
+ case GL_VERTEX_BINDING_STRIDE:
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ if (index >= caps.maxVertexAttribBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
+ return false;
+ }
+ break;
+ case GL_SAMPLE_MASK_VALUE:
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ if (index >= caps.maxSampleMaskWords)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidSampleMaskNumber);
+ return false;
+ }
+ break;
+ case GL_IMAGE_BINDING_NAME:
+ case GL_IMAGE_BINDING_LEVEL:
+ case GL_IMAGE_BINDING_LAYERED:
+ case GL_IMAGE_BINDING_LAYER:
+ case GL_IMAGE_BINDING_ACCESS:
+ case GL_IMAGE_BINDING_FORMAT:
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
+ return false;
+ }
+ if (index >= caps.maxImageUnits)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxImageUnits);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (length)
+ {
+ *length = 1;
+ }
+
+ return true;
+}
+
+bool ValidateGetIntegeri_v(Context *context, GLenum target, GLuint index, GLint *data)
+{
+ if (context->getClientVersion() < ES_3_0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateIndexedStateQuery(context, target, index, nullptr);
+}
+
+bool ValidateGetIntegeri_vRobustANGLE(Context *context,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ if (context->getClientVersion() < ES_3_0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateIndexedStateQuery(context, target, index, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateGetInteger64i_v(Context *context, GLenum target, GLuint index, GLint64 *data)
+{
+ if (context->getClientVersion() < ES_3_0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateIndexedStateQuery(context, target, index, nullptr);
+}
+
+bool ValidateGetInteger64i_vRobustANGLE(Context *context,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ if (context->getClientVersion() < ES_3_0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateIndexedStateQuery(context, target, index, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+
+ return true;
+}
+
+bool ValidateCopyBufferSubData(Context *context,
+ BufferBinding readTarget,
+ BufferBinding writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!context->isValidBufferBinding(readTarget) || !context->isValidBufferBinding(writeTarget))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
+ return false;
+ }
+
+ Buffer *readBuffer = context->getState().getTargetBuffer(readTarget);
+ Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget);
+
+ if (!readBuffer || !writeBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferNotBound);
+ return false;
+ }
+
+ // Verify that readBuffer and writeBuffer are not currently mapped
+ if (readBuffer->isMapped() || writeBuffer->isMapped())
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferMapped);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility &&
+ (readBuffer->isBoundForTransformFeedbackAndOtherUse() ||
+ writeBuffer->isBoundForTransformFeedbackAndOtherUse()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback);
+ return false;
+ }
+
+ CheckedNumeric<GLintptr> checkedReadOffset(readOffset);
+ CheckedNumeric<GLintptr> checkedWriteOffset(writeOffset);
+ CheckedNumeric<GLintptr> checkedSize(size);
+
+ auto checkedReadSum = checkedReadOffset + checkedSize;
+ auto checkedWriteSum = checkedWriteOffset + checkedSize;
+
+ if (!checkedReadSum.IsValid() || !checkedWriteSum.IsValid() ||
+ !IsValueInRangeForNumericType<GLintptr>(readBuffer->getSize()) ||
+ !IsValueInRangeForNumericType<GLintptr>(writeBuffer->getSize()))
+ {
+ context->validationError(GL_INVALID_VALUE, kIntegerOverflow);
+ return false;
+ }
+
+ if (readOffset < 0 || writeOffset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (size < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ if (checkedReadSum.ValueOrDie() > readBuffer->getSize() ||
+ checkedWriteSum.ValueOrDie() > writeBuffer->getSize())
+ {
+ context->validationError(GL_INVALID_VALUE, kBufferOffsetOverflow);
+ return false;
+ }
+
+ if (readBuffer == writeBuffer)
+ {
+ auto checkedOffsetDiff = (checkedReadOffset - checkedWriteOffset).Abs();
+ if (!checkedOffsetDiff.IsValid())
+ {
+ // This shold not be possible.
+ UNREACHABLE();
+ context->validationError(GL_INVALID_VALUE, kIntegerOverflow);
+ return false;
+ }
+
+ if (checkedOffsetDiff.ValueOrDie() < size)
+ {
+ context->validationError(GL_INVALID_VALUE, kCopyAlias);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetStringi(Context *context, GLenum name, GLuint index)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ switch (name)
+ {
+ case GL_EXTENSIONS:
+ if (index >= context->getExtensionStringCount())
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsNumExtensions);
+ return false;
+ }
+ break;
+
+ case GL_REQUESTABLE_EXTENSIONS_ANGLE:
+ if (!context->getExtensions().requestExtension)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidName);
+ return false;
+ }
+ if (index >= context->getRequestableExtensionStringCount())
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsNumRequestableExtensions);
+ return false;
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidName);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateRenderbufferStorageMultisample(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width,
+ height))
+ {
+ return false;
+ }
+
+ // The ES3 spec(section 4.4.2) states that the internal format must be sized and not an integer
+ // format if samples is greater than zero. In ES3.1(section 9.2.5), it can support integer
+ // multisample renderbuffer, but the samples should not be greater than MAX_INTEGER_SAMPLES.
+ const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
+ if (formatInfo.isInt())
+ {
+ if ((samples > 0 && context->getClientVersion() == ES_3_0) ||
+ static_cast<GLuint>(samples) > context->getCaps().maxIntegerSamples)
+ {
+ context->validationError(GL_INVALID_OPERATION, kSamplesOutOfRange);
+ return false;
+ }
+ }
+
+ // The behavior is different than the ANGLE version, which would generate a GL_OUT_OF_MEMORY.
+ const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
+ if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
+ {
+ context->validationError(GL_INVALID_OPERATION, kSamplesOutOfRange);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateVertexAttribIPointer(Context *context,
+ GLuint index,
+ GLint size,
+ VertexAttribType type,
+ GLsizei stride,
+ const void *pointer)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateIntegerVertexFormat(context, index, size, type))
+ {
+ return false;
+ }
+
+ if (stride < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeStride);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ if (context->getClientVersion() >= ES_3_1)
+ {
+ if (stride > caps.maxVertexAttribStride)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribStride);
+ return false;
+ }
+
+ // [OpenGL ES 3.1] Section 10.3.1 page 245:
+ // glVertexAttribBinding is part of the equivalent code of VertexAttribIPointer, so its
+ // validation should be inherited.
+ if (index >= caps.maxVertexAttribBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
+ return false;
+ }
+ }
+
+ // [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->getState().getVertexArrayId() != 0 &&
+ context->getState().getTargetBuffer(BufferBinding::Array) == 0 && pointer != nullptr)
+ {
+ context->validationError(GL_INVALID_OPERATION, kClientDataInVertexArray);
+ return false;
+ }
+
+ if (context->getExtensions().webglCompatibility)
+ {
+ if (!ValidateWebGLVertexAttribPointer(context, type, false, stride, pointer, true))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetSynciv(Context *context,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ if (context->isContextLost())
+ {
+ context->validationError(GL_CONTEXT_LOST, kContextLost);
+
+ if (pname == GL_SYNC_STATUS)
+ {
+ // Generate an error but still return true, the context still needs to return a
+ // value in this case.
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ Sync *syncObject = context->getSync(sync);
+ if (!syncObject)
+ {
+ context->validationError(GL_INVALID_VALUE, kSyncMissing);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_OBJECT_TYPE:
+ case GL_SYNC_CONDITION:
+ case GL_SYNC_FLAGS:
+ case GL_SYNC_STATUS:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawElementsInstanced(Context *context,
+ PrimitiveMode mode,
+ GLsizei count,
+ DrawElementsType type,
+ const void *indices,
+ GLsizei instanceCount)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateDrawElementsInstancedBase(context, mode, count, type, indices, instanceCount);
+}
+
+bool ValidateMultiDrawArraysInstancedANGLE(Context *context,
+ PrimitiveMode mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ if (!context->getExtensions().multiDraw)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (context->getClientMajorVersion() < 3)
+ {
+ if (!context->getExtensions().instancedArraysAny())
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (!ValidateDrawInstancedANGLE(context))
+ {
+ return false;
+ }
+ }
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (!ValidateDrawArraysInstancedBase(context, mode, firsts[drawID], counts[drawID],
+ instanceCounts[drawID]))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateMultiDrawElementsInstancedANGLE(Context *context,
+ PrimitiveMode mode,
+ const GLsizei *counts,
+ DrawElementsType type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ if (!context->getExtensions().multiDraw)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (context->getClientMajorVersion() < 3)
+ {
+ if (!context->getExtensions().instancedArraysAny())
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (!ValidateDrawInstancedANGLE(context))
+ {
+ return false;
+ }
+ }
+ for (GLsizei drawID = 0; drawID < drawcount; ++drawID)
+ {
+ if (!ValidateDrawElementsInstancedBase(context, mode, counts[drawID], type, indices[drawID],
+ instanceCounts[drawID]))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateFramebufferTextureMultiviewOVR(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews)
+{
+ if (!ValidateFramebufferTextureMultiviewBaseANGLE(context, target, attachment, texture, level,
+ numViews))
+ {
+ return false;
+ }
+
+ if (texture != 0)
+ {
+ if (baseViewIndex < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBaseViewIndex);
+ return false;
+ }
+
+ Texture *tex = context->getTexture(texture);
+ ASSERT(tex);
+
+ switch (tex->getType())
+ {
+ case TextureType::_2DArray:
+ case TextureType::_2DMultisampleArray:
+ {
+ if (tex->getType() == TextureType::_2DMultisampleArray)
+ {
+ if (!context->getExtensions().multiviewMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureType);
+ return false;
+ }
+ }
+
+ const Caps &caps = context->getCaps();
+ if (static_cast<GLuint>(baseViewIndex + numViews) > caps.maxArrayTextureLayers)
+ {
+ context->validationError(GL_INVALID_VALUE, kViewsExceedMaxArrayLayers);
+ return false;
+ }
+
+ break;
+ }
+ default:
+ context->validationError(GL_INVALID_OPERATION, kInvalidTextureType);
+ return false;
+ }
+
+ if (!ValidateFramebufferTextureMultiviewLevelAndFormat(context, tex, level))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateUniform1ui(Context *context, GLint location, GLuint v0)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT, location, 1);
+}
+
+bool ValidateUniform2ui(Context *context, GLint location, GLuint v0, GLuint v1)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT_VEC2, location, 1);
+}
+
+bool ValidateUniform3ui(Context *context, GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT_VEC3, location, 1);
+}
+
+bool ValidateUniform4ui(Context *context,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT_VEC4, location, 1);
+}
+
+bool ValidateUniform1uiv(Context *context, GLint location, GLsizei count, const GLuint *value)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT, location, count);
+}
+
+bool ValidateUniform2uiv(Context *context, GLint location, GLsizei count, const GLuint *value)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT_VEC2, location, count);
+}
+
+bool ValidateUniform3uiv(Context *context, GLint location, GLsizei count, const GLuint *value)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT_VEC3, location, count);
+}
+
+bool ValidateUniform4uiv(Context *context, GLint location, GLsizei count, const GLuint *value)
+{
+ return ValidateUniformES3(context, GL_UNSIGNED_INT_VEC4, location, count);
+}
+
+bool ValidateIsQuery(Context *context, GLuint id)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateUniformMatrix2x3fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrixES3(context, GL_FLOAT_MAT2x3, location, count, transpose);
+}
+
+bool ValidateUniformMatrix3x2fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrixES3(context, GL_FLOAT_MAT3x2, location, count, transpose);
+}
+
+bool ValidateUniformMatrix2x4fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrixES3(context, GL_FLOAT_MAT2x4, location, count, transpose);
+}
+
+bool ValidateUniformMatrix4x2fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrixES3(context, GL_FLOAT_MAT4x2, location, count, transpose);
+}
+
+bool ValidateUniformMatrix3x4fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrixES3(context, GL_FLOAT_MAT3x4, location, count, transpose);
+}
+
+bool ValidateUniformMatrix4x3fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateUniformMatrixES3(context, GL_FLOAT_MAT4x3, location, count, transpose);
+}
+
+bool ValidateEndTransformFeedback(Context *context)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != nullptr);
+
+ if (!transformFeedback->isActive())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackNotActive);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTransformFeedbackVaryings(Context *context,
+ GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (count < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+
+ switch (bufferMode)
+ {
+ case GL_INTERLEAVED_ATTRIBS:
+ break;
+ case GL_SEPARATE_ATTRIBS:
+ {
+ const Caps &caps = context->getCaps();
+ if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTransformFeedbackAttribsCount);
+ return false;
+ }
+ break;
+ }
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetTransformFeedbackVarying(Context *context,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
+ {
+ context->validationError(GL_INVALID_VALUE, kTransformFeedbackVaryingIndexOutOfRange);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindTransformFeedback(Context *context, GLenum target, GLuint id)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ 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)
+ if (context->getState().isTransformFeedbackActiveUnpaused())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackNotPaused);
+ return false;
+ }
+
+ // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section
+ // 2.14.1)
+ if (!context->isTransformFeedbackGenerated(id))
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackDoesNotExist);
+ return false;
+ }
+ }
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateIsTransformFeedback(Context *context, GLuint id)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidatePauseTransformFeedback(Context *context)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != nullptr);
+
+ // Current transform feedback must be active and not paused in order to pause (3.0.2 pg 86)
+ if (!transformFeedback->isActive())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackNotActive);
+ return false;
+ }
+
+ if (transformFeedback->isPaused())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackPaused);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateResumeTransformFeedback(Context *context)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback();
+ ASSERT(transformFeedback != nullptr);
+
+ // Current transform feedback must be active and paused in order to resume (3.0.2 pg 86)
+ if (!transformFeedback->isActive())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackNotActive);
+ return false;
+ }
+
+ if (!transformFeedback->isPaused())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTransformFeedbackNotPaused);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateVertexAttribI4i(Context *context, GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttribI4ui(Context *context,
+ GLuint index,
+ GLuint x,
+ GLuint y,
+ GLuint z,
+ GLuint w)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttribI4iv(Context *context, GLuint index, const GLint *v)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateVertexAttribI4uiv(Context *context, GLuint index, const GLuint *v)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateGetFragDataLocation(Context *context, GLuint program, const GLchar *name)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetUniformIndices(Context *context,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (uniformCount < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetActiveUniformsiv(Context *context,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (uniformCount < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeCount);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_UNIFORM_TYPE:
+ case GL_UNIFORM_SIZE:
+ break;
+ case GL_UNIFORM_NAME_LENGTH:
+ if (context->getExtensions().webglCompatibility)
+ {
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+ break;
+ case GL_UNIFORM_BLOCK_INDEX:
+ case GL_UNIFORM_OFFSET:
+ case GL_UNIFORM_ARRAY_STRIDE:
+ case GL_UNIFORM_MATRIX_STRIDE:
+ case GL_UNIFORM_IS_ROW_MAJOR:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
+ return false;
+ }
+
+ if (uniformCount > programObject->getActiveUniformCount())
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxActiveUniform);
+ return false;
+ }
+
+ for (int uniformId = 0; uniformId < uniformCount; uniformId++)
+ {
+ const GLuint index = uniformIndices[uniformId];
+
+ if (index >= static_cast<GLuint>(programObject->getActiveUniformCount()))
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxActiveUniform);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetUniformBlockIndex(Context *context, GLuint program, const GLchar *uniformBlockName)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetActiveUniformBlockiv(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params)
+{
+ return ValidateGetActiveUniformBlockivBase(context, program, uniformBlockIndex, pname, nullptr);
+}
+
+bool ValidateGetActiveUniformBlockName(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxActiveUniformBlock);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateUniformBlockBinding(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxUniformBufferBindings);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+
+ // if never linked, there won't be any uniform blocks
+ if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxUniformBufferBindings);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawArraysInstanced(Context *context,
+ PrimitiveMode mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateDrawArraysInstancedBase(context, mode, first, count, primcount);
+}
+
+bool ValidateFenceSync(Context *context, GLenum condition, GLbitfield flags)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFenceCondition);
+ return false;
+ }
+
+ if (flags != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFlags);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateIsSync(Context *context, GLsync sync)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDeleteSync(Context *context, GLsync sync)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (sync != static_cast<GLsync>(0) && !context->getSync(sync))
+ {
+ context->validationError(GL_INVALID_VALUE, kSyncMissing);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateClientWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFlags);
+ return false;
+ }
+
+ Sync *clientWaitSync = context->getSync(sync);
+ if (!clientWaitSync)
+ {
+ context->validationError(GL_INVALID_VALUE, kSyncMissing);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (flags != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFlags);
+ return false;
+ }
+
+ if (timeout != GL_TIMEOUT_IGNORED)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTimeout);
+ return false;
+ }
+
+ Sync *waitSync = context->getSync(sync);
+ if (!waitSync)
+ {
+ context->validationError(GL_INVALID_VALUE, kSyncMissing);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetInteger64v(Context *context, GLenum pname, GLint64 *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ GLenum nativeType = GL_NONE;
+ unsigned int numParams = 0;
+ if (!ValidateStateQuery(context, pname, &nativeType, &numParams))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateIsSampler(Context *context, GLuint sampler)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindSampler(Context *context, GLuint unit, GLuint sampler)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (sampler != 0 && !context->isSampler(sampler))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidSampler);
+ return false;
+ }
+
+ if (unit >= context->getCaps().maxCombinedTextureImageUnits)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidCombinedImageUnit);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ return ValidateVertexAttribIndex(context, index);
+}
+
+bool ValidateTexStorage2D(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width, height,
+ 1))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateTexStorage3D(Context *context,
+ TextureType target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+
+ if (!ValidateES3TexStorage3DParameters(context, target, levels, internalformat, width, height,
+ depth))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetBufferParameteri64v(Context *context,
+ BufferBinding target,
+ GLenum pname,
+ GLint64 *params)
+{
+ return ValidateGetBufferParameterBase(context, target, pname, false, nullptr);
+}
+
+bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params)
+{
+ return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
+}
+
+bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params)
+{
+ return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
+}
+
+bool ValidateGetSamplerParameterIivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
+}
+
+bool ValidateGetSamplerParameterIuivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
+}
+
+bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param)
+{
+ return ValidateSamplerParameterBase(context, sampler, pname, -1, false, &param);
+}
+
+bool ValidateSamplerParameterfv(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return ValidateSamplerParameterBase(context, sampler, pname, -1, true, params);
+}
+
+bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param)
+{
+ return ValidateSamplerParameterBase(context, sampler, pname, -1, false, &param);
+}
+
+bool ValidateSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, const GLint *params)
+{
+ return ValidateSamplerParameterBase(context, sampler, pname, -1, true, params);
+}
+
+bool ValidateSamplerParameterIivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateSamplerParameterBase(context, sampler, pname, -1, true, params);
+}
+
+bool ValidateSamplerParameterIuivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *params)
+{
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ return ValidateSamplerParameterBase(context, sampler, pname, -1, true, params);
+}
+
+bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params)
+{
+ return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, true);
+}
+
+bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params)
+{
+ return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, true);
+}
+
+bool ValidateGetInternalformativ(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params)
+{
+ return ValidateGetInternalFormativBase(context, target, internalformat, pname, bufSize,
+ nullptr);
+}
+
+bool ValidateBindFragDataLocationIndexedEXT(Context *context,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char *name)
+{
+ if (!context->getExtensions().blendFuncExtended)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ if (index < 0 || index > 1)
+ {
+ // This error is not explicitly specified but the spec does say that "<index> may be zero or
+ // one to specify that the color be used as either the first or second color input to the
+ // blend equation, respectively"
+ context->validationError(GL_INVALID_VALUE, kFragDataBindingIndexOutOfRange);
+ return false;
+ }
+ if (index == 1)
+ {
+ if (colorNumber >= context->getExtensions().maxDualSourceDrawBuffers)
+ {
+ context->validationError(GL_INVALID_VALUE,
+ kColorNumberGreaterThanMaxDualSourceDrawBuffers);
+ return false;
+ }
+ }
+ else
+ {
+ if (colorNumber >= context->getCaps().maxDrawBuffers)
+ {
+ context->validationError(GL_INVALID_VALUE, kColorNumberGreaterThanMaxDrawBuffers);
+ return false;
+ }
+ }
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+ return true;
+}
+
+bool ValidateBindFragDataLocationEXT(Context *context,
+ GLuint program,
+ GLuint colorNumber,
+ const char *name)
+{
+ return ValidateBindFragDataLocationIndexedEXT(context, program, colorNumber, 0u, name);
+}
+
+bool ValidateGetFragDataIndexEXT(Context *context, GLuint program, const char *name)
+{
+ if (!context->getExtensions().blendFuncExtended)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (context->getClientMajorVersion() < 3)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES3Required);
+ return false;
+ }
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateTexStorage2DMultisampleANGLE(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations)
+{
+ if (!context->getExtensions().textureMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMultisampleTextureExtensionOrES31Required);
+ return false;
+ }
+
+ return ValidateTexStorage2DMultisampleBase(context, target, samples, internalFormat, width,
+ height);
+}
+
+bool ValidateGetTexLevelParameterfvANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ if (!context->getExtensions().textureMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMultisampleTextureExtensionOrES31Required);
+ return false;
+ }
+
+ return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
+}
+
+bool ValidateGetTexLevelParameterivANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ if (!context->getExtensions().textureMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMultisampleTextureExtensionOrES31Required);
+ return false;
+ }
+
+ return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
+}
+
+bool ValidateGetMultisamplefvANGLE(Context *context, GLenum pname, GLuint index, GLfloat *val)
+{
+ if (!context->getExtensions().textureMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMultisampleTextureExtensionOrES31Required);
+ return false;
+ }
+
+ return ValidateGetMultisamplefvBase(context, pname, index, val);
+}
+
+bool ValidateSampleMaskiANGLE(Context *context, GLuint maskNumber, GLbitfield mask)
+{
+ if (!context->getExtensions().textureMultisample)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMultisampleTextureExtensionOrES31Required);
+ return false;
+ }
+
+ return ValidateSampleMaskiBase(context, maskNumber, mask);
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationES3.h b/gfx/angle/checkout/src/libANGLE/validationES3.h
new file mode 100644
index 0000000000..2206db44b2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES3.h
@@ -0,0 +1,36 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES3.h:
+// Inlined validation functions for OpenGL ES 3.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES3_H_
+#define LIBANGLE_VALIDATION_ES3_H_
+
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/validationES3_autogen.h"
+
+namespace gl
+{
+bool ValidateES3TexImageParametersBase(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum internalformat,
+ bool isCompressed,
+ bool isSubImage,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei imageSize,
+ const void *pixels);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES3_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES31.cpp b/gfx/angle/checkout/src/libANGLE/validationES31.cpp
new file mode 100644
index 0000000000..fc55e31cd5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES31.cpp
@@ -0,0 +1,1935 @@
+//
+// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationES31.cpp: Validation functions for OpenGL ES 3.1 entry point parameters
+
+#include "libANGLE/validationES31_autogen.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/Framebuffer.h"
+#include "libANGLE/VertexArray.h"
+#include "libANGLE/validationES.h"
+#include "libANGLE/validationES2_autogen.h"
+#include "libANGLE/validationES3_autogen.h"
+
+#include "common/utilities.h"
+
+using namespace angle;
+
+namespace gl
+{
+using namespace err;
+
+namespace
+{
+
+bool ValidateNamedProgramInterface(GLenum programInterface)
+{
+ switch (programInterface)
+ {
+ case GL_UNIFORM:
+ case GL_UNIFORM_BLOCK:
+ case GL_PROGRAM_INPUT:
+ case GL_PROGRAM_OUTPUT:
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ case GL_BUFFER_VARIABLE:
+ case GL_SHADER_STORAGE_BLOCK:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateLocationProgramInterface(GLenum programInterface)
+{
+ switch (programInterface)
+ {
+ case GL_UNIFORM:
+ case GL_PROGRAM_INPUT:
+ case GL_PROGRAM_OUTPUT:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidateProgramInterface(GLenum programInterface)
+{
+ return (programInterface == GL_ATOMIC_COUNTER_BUFFER ||
+ ValidateNamedProgramInterface(programInterface));
+}
+
+bool ValidateProgramResourceProperty(const Context *context, GLenum prop)
+{
+ ASSERT(context);
+ switch (prop)
+ {
+ case GL_ACTIVE_VARIABLES:
+ case GL_BUFFER_BINDING:
+ case GL_NUM_ACTIVE_VARIABLES:
+
+ case GL_ARRAY_SIZE:
+
+ case GL_ARRAY_STRIDE:
+ case GL_BLOCK_INDEX:
+ case GL_IS_ROW_MAJOR:
+ case GL_MATRIX_STRIDE:
+
+ case GL_ATOMIC_COUNTER_BUFFER_INDEX:
+
+ case GL_BUFFER_DATA_SIZE:
+
+ case GL_LOCATION:
+
+ case GL_NAME_LENGTH:
+
+ case GL_OFFSET:
+
+ case GL_REFERENCED_BY_VERTEX_SHADER:
+ case GL_REFERENCED_BY_FRAGMENT_SHADER:
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+
+ case GL_TOP_LEVEL_ARRAY_SIZE:
+ case GL_TOP_LEVEL_ARRAY_STRIDE:
+
+ case GL_TYPE:
+ return true;
+
+ case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
+ return context->getExtensions().geometryShader;
+
+ case GL_LOCATION_INDEX_EXT:
+ return context->getExtensions().blendFuncExtended;
+
+ default:
+ return false;
+ }
+}
+
+// GLES 3.10 spec: Page 82 -- Table 7.2
+bool ValidateProgramResourcePropertyByInterface(GLenum prop, GLenum programInterface)
+{
+ switch (prop)
+ {
+ case GL_ACTIVE_VARIABLES:
+ case GL_BUFFER_BINDING:
+ case GL_NUM_ACTIVE_VARIABLES:
+ {
+ switch (programInterface)
+ {
+ case GL_ATOMIC_COUNTER_BUFFER:
+ case GL_SHADER_STORAGE_BLOCK:
+ case GL_UNIFORM_BLOCK:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ case GL_ARRAY_SIZE:
+ {
+ switch (programInterface)
+ {
+ case GL_BUFFER_VARIABLE:
+ case GL_PROGRAM_INPUT:
+ case GL_PROGRAM_OUTPUT:
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ case GL_UNIFORM:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ case GL_ARRAY_STRIDE:
+ case GL_BLOCK_INDEX:
+ case GL_IS_ROW_MAJOR:
+ case GL_MATRIX_STRIDE:
+ {
+ switch (programInterface)
+ {
+ case GL_BUFFER_VARIABLE:
+ case GL_UNIFORM:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ case GL_ATOMIC_COUNTER_BUFFER_INDEX:
+ {
+ if (programInterface == GL_UNIFORM)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ case GL_BUFFER_DATA_SIZE:
+ {
+ switch (programInterface)
+ {
+ case GL_ATOMIC_COUNTER_BUFFER:
+ case GL_SHADER_STORAGE_BLOCK:
+ case GL_UNIFORM_BLOCK:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ case GL_LOCATION:
+ {
+ return ValidateLocationProgramInterface(programInterface);
+ }
+
+ case GL_LOCATION_INDEX_EXT:
+ {
+ // EXT_blend_func_extended
+ return (programInterface == GL_PROGRAM_OUTPUT);
+ }
+
+ case GL_NAME_LENGTH:
+ {
+ return ValidateNamedProgramInterface(programInterface);
+ }
+
+ case GL_OFFSET:
+ {
+ switch (programInterface)
+ {
+ case GL_BUFFER_VARIABLE:
+ case GL_UNIFORM:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ case GL_REFERENCED_BY_VERTEX_SHADER:
+ case GL_REFERENCED_BY_FRAGMENT_SHADER:
+ case GL_REFERENCED_BY_COMPUTE_SHADER:
+ case GL_REFERENCED_BY_GEOMETRY_SHADER_EXT:
+ {
+ switch (programInterface)
+ {
+ case GL_ATOMIC_COUNTER_BUFFER:
+ case GL_BUFFER_VARIABLE:
+ case GL_PROGRAM_INPUT:
+ case GL_PROGRAM_OUTPUT:
+ case GL_SHADER_STORAGE_BLOCK:
+ case GL_UNIFORM:
+ case GL_UNIFORM_BLOCK:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ case GL_TOP_LEVEL_ARRAY_SIZE:
+ case GL_TOP_LEVEL_ARRAY_STRIDE:
+ {
+ if (programInterface == GL_BUFFER_VARIABLE)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ case GL_TYPE:
+ {
+ switch (programInterface)
+ {
+ case GL_BUFFER_VARIABLE:
+ case GL_PROGRAM_INPUT:
+ case GL_PROGRAM_OUTPUT:
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ case GL_UNIFORM:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ default:
+ return false;
+ }
+}
+
+bool ValidateProgramResourceIndex(const Program *programObject,
+ GLenum programInterface,
+ GLuint index)
+{
+ switch (programInterface)
+ {
+ case GL_PROGRAM_INPUT:
+ return (index < static_cast<GLuint>(programObject->getActiveAttributeCount()));
+
+ case GL_PROGRAM_OUTPUT:
+ return (index < static_cast<GLuint>(programObject->getOutputResourceCount()));
+
+ case GL_UNIFORM:
+ return (index < static_cast<GLuint>(programObject->getActiveUniformCount()));
+
+ case GL_BUFFER_VARIABLE:
+ return (index < static_cast<GLuint>(programObject->getActiveBufferVariableCount()));
+
+ case GL_SHADER_STORAGE_BLOCK:
+ return (index < static_cast<GLuint>(programObject->getActiveShaderStorageBlockCount()));
+
+ case GL_UNIFORM_BLOCK:
+ return (index < programObject->getActiveUniformBlockCount());
+
+ case GL_ATOMIC_COUNTER_BUFFER:
+ return (index < programObject->getActiveAtomicCounterBufferCount());
+
+ case GL_TRANSFORM_FEEDBACK_VARYING:
+ return (index < static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()));
+
+ default:
+ UNREACHABLE();
+ return false;
+ }
+}
+
+bool ValidateProgramUniform(Context *context,
+ GLenum valueType,
+ GLuint program,
+ GLint location,
+ GLsizei count)
+{
+ // Check for ES31 program uniform entry points
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ const LinkedUniform *uniform = nullptr;
+ Program *programObject = GetValidProgram(context, program);
+ return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
+ ValidateUniformValue(context, valueType, uniform->type);
+}
+
+bool ValidateProgramUniformMatrix(Context *context,
+ GLenum valueType,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose)
+{
+ // Check for ES31 program uniform entry points
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ const LinkedUniform *uniform = nullptr;
+ Program *programObject = GetValidProgram(context, program);
+ return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
+ ValidateUniformMatrixValue(context, valueType, uniform->type);
+}
+
+bool ValidateVertexAttribFormatCommon(Context *context, GLuint relativeOffset)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset))
+ {
+ context->validationError(GL_INVALID_VALUE, kRelativeOffsetTooLarge);
+ return false;
+ }
+
+ // [OpenGL ES 3.1] Section 10.3.1 page 243:
+ // An INVALID_OPERATION error is generated if the default vertex array object is bound.
+ if (context->getState().getVertexArrayId() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
+ return false;
+ }
+
+ return true;
+}
+
+} // anonymous namespace
+
+bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (!ValidateIndexedStateQuery(context, target, index, nullptr))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetBooleani_vRobustANGLE(Context *context,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (!ValidateRobustEntryPoint(context, bufSize))
+ {
+ return false;
+ }
+
+ GLsizei numParams = 0;
+
+ if (!ValidateIndexedStateQuery(context, target, index, &numParams))
+ {
+ return false;
+ }
+
+ if (!ValidateRobustBufferSize(context, bufSize, numParams))
+ {
+ return false;
+ }
+
+ SetRobustLengthParam(length, numParams);
+ return true;
+}
+
+bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void *indirect)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ // Here the third parameter 1 is only to pass the count validation.
+ if (!ValidateDrawBase(context, mode))
+ {
+ return false;
+ }
+
+ const State &state = context->getState();
+
+ // An INVALID_OPERATION error is generated if zero is bound to VERTEX_ARRAY_BINDING,
+ // DRAW_INDIRECT_BUFFER or to any enabled vertex array.
+ if (!state.getVertexArrayId())
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
+ return false;
+ }
+
+ Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
+ if (!drawIndirectBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDrawIndirectBufferNotBound);
+ return false;
+ }
+
+ // An INVALID_VALUE error is generated if indirect is not a multiple of the size, in basic
+ // machine units, of uint.
+ GLint64 offset = reinterpret_cast<GLint64>(indirect);
+ if ((static_cast<GLuint>(offset) % sizeof(GLuint)) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidIndirectOffset);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void *indirect)
+{
+ const State &state = context->getState();
+ TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
+ if (curTransformFeedback && curTransformFeedback->isActive() &&
+ !curTransformFeedback->isPaused())
+ {
+ // EXT_geometry_shader allows transform feedback to work with all draw commands.
+ // [EXT_geometry_shader] Section 12.1, "Transform Feedback"
+ if (context->getExtensions().geometryShader)
+ {
+ if (!ValidateTransformFeedbackPrimitiveMode(
+ context, curTransformFeedback->getPrimitiveMode(), mode))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidDrawModeTransformFeedback);
+ return false;
+ }
+ }
+ else
+ {
+ // An INVALID_OPERATION error is generated if transform feedback is active and not
+ // paused.
+ context->validationError(GL_INVALID_OPERATION,
+ kUnsupportedDrawModeForTransformFeedback);
+ return false;
+ }
+ }
+
+ if (!ValidateDrawIndirectBase(context, mode, indirect))
+ return false;
+
+ Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
+ CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(indirect));
+ // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawArraysIndirectCommand
+ // which's size is 4 * sizeof(uint).
+ auto checkedSum = checkedOffset + 4 * sizeof(GLuint);
+ if (!checkedSum.IsValid() ||
+ checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kParamOverflow);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDrawElementsIndirect(Context *context,
+ PrimitiveMode mode,
+ DrawElementsType type,
+ const void *indirect)
+{
+ if (!ValidateDrawElementsBase(context, mode, type))
+ {
+ return false;
+ }
+
+ const State &state = context->getState();
+ const VertexArray *vao = state.getVertexArray();
+ Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
+ if (!elementArrayBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kMustHaveElementArrayBinding);
+ return false;
+ }
+
+ if (!ValidateDrawIndirectBase(context, mode, indirect))
+ return false;
+
+ Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
+ CheckedNumeric<size_t> checkedOffset(reinterpret_cast<size_t>(indirect));
+ // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawElementsIndirectCommand
+ // which's size is 5 * sizeof(uint).
+ auto checkedSum = checkedOffset + 5 * sizeof(GLuint);
+ if (!checkedSum.IsValid() ||
+ checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kParamOverflow);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateProgramUniform1i(Context *context, GLuint program, GLint location, GLint v0)
+{
+ return ValidateProgramUniform1iv(context, program, location, 1, &v0);
+}
+
+bool ValidateProgramUniform2i(Context *context, GLuint program, GLint location, GLint v0, GLint v1)
+{
+ GLint xy[2] = {v0, v1};
+ return ValidateProgramUniform2iv(context, program, location, 1, xy);
+}
+
+bool ValidateProgramUniform3i(Context *context,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2)
+{
+ GLint xyz[3] = {v0, v1, v2};
+ return ValidateProgramUniform3iv(context, program, location, 1, xyz);
+}
+
+bool ValidateProgramUniform4i(Context *context,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3)
+{
+ GLint xyzw[4] = {v0, v1, v2, v3};
+ return ValidateProgramUniform4iv(context, program, location, 1, xyzw);
+}
+
+bool ValidateProgramUniform1ui(Context *context, GLuint program, GLint location, GLuint v0)
+{
+ return ValidateProgramUniform1uiv(context, program, location, 1, &v0);
+}
+
+bool ValidateProgramUniform2ui(Context *context,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1)
+{
+ GLuint xy[2] = {v0, v1};
+ return ValidateProgramUniform2uiv(context, program, location, 1, xy);
+}
+
+bool ValidateProgramUniform3ui(Context *context,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2)
+{
+ GLuint xyz[3] = {v0, v1, v2};
+ return ValidateProgramUniform3uiv(context, program, location, 1, xyz);
+}
+
+bool ValidateProgramUniform4ui(Context *context,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3)
+{
+ GLuint xyzw[4] = {v0, v1, v2, v3};
+ return ValidateProgramUniform4uiv(context, program, location, 1, xyzw);
+}
+
+bool ValidateProgramUniform1f(Context *context, GLuint program, GLint location, GLfloat v0)
+{
+ return ValidateProgramUniform1fv(context, program, location, 1, &v0);
+}
+
+bool ValidateProgramUniform2f(Context *context,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1)
+{
+ GLfloat xy[2] = {v0, v1};
+ return ValidateProgramUniform2fv(context, program, location, 1, xy);
+}
+
+bool ValidateProgramUniform3f(Context *context,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2)
+{
+ GLfloat xyz[3] = {v0, v1, v2};
+ return ValidateProgramUniform3fv(context, program, location, 1, xyz);
+}
+
+bool ValidateProgramUniform4f(Context *context,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3)
+{
+ GLfloat xyzw[4] = {v0, v1, v2, v3};
+ return ValidateProgramUniform4fv(context, program, location, 1, xyzw);
+}
+
+bool ValidateProgramUniform1iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ // Check for ES31 program uniform entry points
+ if (context->getClientVersion() < Version(3, 1))
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ const LinkedUniform *uniform = nullptr;
+ Program *programObject = GetValidProgram(context, program);
+ return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
+ ValidateUniform1ivValue(context, uniform->type, count, value);
+}
+
+bool ValidateProgramUniform2iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return ValidateProgramUniform(context, GL_INT_VEC2, program, location, count);
+}
+
+bool ValidateProgramUniform3iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return ValidateProgramUniform(context, GL_INT_VEC3, program, location, count);
+}
+
+bool ValidateProgramUniform4iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return ValidateProgramUniform(context, GL_INT_VEC4, program, location, count);
+}
+
+bool ValidateProgramUniform1uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return ValidateProgramUniform(context, GL_UNSIGNED_INT, program, location, count);
+}
+
+bool ValidateProgramUniform2uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC2, program, location, count);
+}
+
+bool ValidateProgramUniform3uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC3, program, location, count);
+}
+
+bool ValidateProgramUniform4uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC4, program, location, count);
+}
+
+bool ValidateProgramUniform1fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return ValidateProgramUniform(context, GL_FLOAT, program, location, count);
+}
+
+bool ValidateProgramUniform2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return ValidateProgramUniform(context, GL_FLOAT_VEC2, program, location, count);
+}
+
+bool ValidateProgramUniform3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return ValidateProgramUniform(context, GL_FLOAT_VEC3, program, location, count);
+}
+
+bool ValidateProgramUniform4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return ValidateProgramUniform(context, GL_FLOAT_VEC4, program, location, count);
+}
+
+bool ValidateProgramUniformMatrix2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix2x3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2x3, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix3x2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3x2, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix2x4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2x4, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix4x2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4x2, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix3x4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3x4, program, location, count,
+ transpose);
+}
+
+bool ValidateProgramUniformMatrix4x3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4x3, program, location, count,
+ transpose);
+}
+
+bool ValidateGetTexLevelParameterfv(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
+}
+
+bool ValidateGetTexLevelParameterfvRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetTexLevelParameteriv(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
+}
+
+bool ValidateGetTexLevelParameterivRobustANGLE(Context *context,
+ TextureTarget target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateTexStorage2DMultisample(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ return ValidateTexStorage2DMultisampleBase(context, target, samples, internalFormat, width,
+ height);
+}
+
+bool ValidateTexStorageMem2DMultisampleEXT(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfloat *val)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ return ValidateGetMultisamplefvBase(context, pname, index, val);
+}
+
+bool ValidateGetMultisamplefvRobustANGLE(Context *context,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_DEFAULT_WIDTH:
+ {
+ GLint maxWidth = context->getCaps().maxFramebufferWidth;
+ if (param < 0 || param > maxWidth)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsFramebufferWidth);
+ return false;
+ }
+ break;
+ }
+ case GL_FRAMEBUFFER_DEFAULT_HEIGHT:
+ {
+ GLint maxHeight = context->getCaps().maxFramebufferHeight;
+ if (param < 0 || param > maxHeight)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsFramebufferHeight);
+ return false;
+ }
+ break;
+ }
+ case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
+ {
+ GLint maxSamples = context->getCaps().maxFramebufferSamples;
+ if (param < 0 || param > maxSamples)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsFramebufferSamples);
+ return false;
+ }
+ break;
+ }
+ case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
+ {
+ break;
+ }
+ case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
+ {
+ if (!context->getExtensions().geometryShader)
+ {
+ context->validationError(GL_INVALID_ENUM, kGeometryShaderExtensionNotEnabled);
+ return false;
+ }
+ GLint maxLayers = context->getCaps().maxFramebufferLayers;
+ if (param < 0 || param > maxLayers)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidFramebufferLayer);
+ return false;
+ }
+ break;
+ }
+ default:
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+ }
+
+ const Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+ if (framebuffer->id() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultFramebuffer);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (!ValidFramebufferTarget(context, target))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_FRAMEBUFFER_DEFAULT_WIDTH:
+ case GL_FRAMEBUFFER_DEFAULT_HEIGHT:
+ case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
+ case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
+ break;
+ case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
+ if (!context->getExtensions().geometryShader)
+ {
+ context->validationError(GL_INVALID_ENUM, kGeometryShaderExtensionNotEnabled);
+ return false;
+ }
+ break;
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ const Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
+ ASSERT(framebuffer);
+
+ if (framebuffer->id() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultFramebuffer);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateGetFramebufferParameterivRobustANGLE(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetProgramResourceIndex(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (programObject == nullptr)
+ {
+ return false;
+ }
+
+ if (!ValidateNamedProgramInterface(programInterface))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindVertexBuffer(Context *context,
+ GLuint bindingIndex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (!context->isBufferGenerated(buffer))
+ {
+ context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ if (bindingIndex >= caps.maxVertexAttribBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
+ return false;
+ }
+
+ if (offset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if (stride < 0 || stride > caps.maxVertexAttribStride)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribStride);
+ return false;
+ }
+
+ // [OpenGL ES 3.1] Section 10.3.1 page 244:
+ // An INVALID_OPERATION error is generated if the default vertex array object is bound.
+ if (context->getState().getVertexArrayId() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint divisor)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ if (bindingIndex >= caps.maxVertexAttribBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
+ return false;
+ }
+
+ // [OpenGL ES 3.1] Section 10.3.1 page 243:
+ // An INVALID_OPERATION error is generated if the default vertex array object is bound.
+ if (context->getState().getVertexArrayId() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateVertexAttribFormat(Context *context,
+ GLuint attribindex,
+ GLint size,
+ VertexAttribType type,
+ GLboolean normalized,
+ GLuint relativeoffset)
+{
+ if (!ValidateVertexAttribFormatCommon(context, relativeoffset))
+ {
+ return false;
+ }
+
+ return ValidateFloatVertexFormat(context, attribindex, size, type);
+}
+
+bool ValidateVertexAttribIFormat(Context *context,
+ GLuint attribindex,
+ GLint size,
+ VertexAttribType type,
+ GLuint relativeoffset)
+{
+ if (!ValidateVertexAttribFormatCommon(context, relativeoffset))
+ {
+ return false;
+ }
+
+ return ValidateIntegerVertexFormat(context, attribindex, size, type);
+}
+
+bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bindingIndex)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ // [OpenGL ES 3.1] Section 10.3.1 page 243:
+ // An INVALID_OPERATION error is generated if the default vertex array object is bound.
+ if (context->getState().getVertexArrayId() == 0)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ if (attribIndex >= caps.maxVertexAttributes)
+ {
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
+ return false;
+ }
+
+ if (bindingIndex >= caps.maxVertexAttribBindings)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateGetProgramResourceName(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (programObject == nullptr)
+ {
+ return false;
+ }
+
+ if (!ValidateNamedProgramInterface(programInterface))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
+ return false;
+ }
+
+ if (!ValidateProgramResourceIndex(programObject, programInterface, index))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProgramResourceIndex);
+ return false;
+ }
+
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDispatchCompute(Context *context,
+ GLuint numGroupsX,
+ GLuint numGroupsY,
+ GLuint numGroupsZ)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ const State &state = context->getState();
+ Program *program = state.getLinkedProgram(context);
+
+ if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoActiveProgramWithComputeShader);
+ return false;
+ }
+
+ const Caps &caps = context->getCaps();
+ if (numGroupsX > caps.maxComputeWorkGroupCount[0])
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountX);
+ return false;
+ }
+ if (numGroupsY > caps.maxComputeWorkGroupCount[1])
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountY);
+ return false;
+ }
+ if (numGroupsZ > caps.maxComputeWorkGroupCount[2])
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountZ);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ const State &state = context->getState();
+ Program *program = state.getLinkedProgram(context);
+
+ if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
+ {
+ context->validationError(GL_INVALID_OPERATION, kNoActiveProgramWithComputeShader);
+ return false;
+ }
+
+ if (indirect < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
+ return false;
+ }
+
+ if ((indirect & (sizeof(GLuint) - 1)) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kOffsetMustBeMultipleOfUint);
+ return false;
+ }
+
+ Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect);
+ if (!dispatchIndirectBuffer)
+ {
+ context->validationError(GL_INVALID_OPERATION, kDispatchIndirectBufferNotBound);
+ return false;
+ }
+
+ CheckedNumeric<GLuint64> checkedOffset(static_cast<GLuint64>(indirect));
+ auto checkedSum = checkedOffset + static_cast<GLuint64>(3 * sizeof(GLuint));
+ if (!checkedSum.IsValid() ||
+ checkedSum.ValueOrDie() > static_cast<GLuint64>(dispatchIndirectBuffer->getSize()))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInsufficientBufferSize);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateBindImageTexture(Context *context,
+ GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format)
+{
+ GLuint maxImageUnits = context->getCaps().maxImageUnits;
+ if (unit >= maxImageUnits)
+ {
+ context->validationError(GL_INVALID_VALUE, kExceedsMaxImageUnits);
+ return false;
+ }
+
+ if (level < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeLevel);
+ return false;
+ }
+
+ if (layer < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeLayer);
+ return false;
+ }
+
+ if (access != GL_READ_ONLY && access != GL_WRITE_ONLY && access != GL_READ_WRITE)
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidImageAccess);
+ return false;
+ }
+
+ switch (format)
+ {
+ case GL_RGBA32F:
+ case GL_RGBA16F:
+ case GL_R32F:
+ case GL_RGBA32UI:
+ case GL_RGBA16UI:
+ case GL_RGBA8UI:
+ case GL_R32UI:
+ case GL_RGBA32I:
+ case GL_RGBA16I:
+ case GL_RGBA8I:
+ case GL_R32I:
+ case GL_RGBA8:
+ case GL_RGBA8_SNORM:
+ break;
+ default:
+ context->validationError(GL_INVALID_VALUE, kInvalidImageFormat);
+ return false;
+ }
+
+ if (texture != 0)
+ {
+ Texture *tex = context->getTexture(texture);
+
+ if (tex == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kMissingTextureName);
+ return false;
+ }
+
+ if (!tex->getImmutableFormat())
+ {
+ context->validationError(GL_INVALID_OPERATION, kTextureIsNotImmutable);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetProgramResourceLocation(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (programObject == nullptr)
+ {
+ return false;
+ }
+
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+
+ if (!ValidateLocationProgramInterface(programInterface))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
+ return false;
+ }
+ return true;
+}
+
+bool ValidateGetProgramResourceiv(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (programObject == nullptr)
+ {
+ return false;
+ }
+ if (!ValidateProgramInterface(programInterface))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
+ return false;
+ }
+ if (propCount <= 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidPropCount);
+ return false;
+ }
+ if (bufSize < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeBufSize);
+ return false;
+ }
+ if (!ValidateProgramResourceIndex(programObject, programInterface, index))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidProgramResourceIndex);
+ return false;
+ }
+ for (GLsizei i = 0; i < propCount; i++)
+ {
+ if (!ValidateProgramResourceProperty(context, props[i]))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidProgramResourceProperty);
+ return false;
+ }
+ if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface))
+ {
+ context->validationError(GL_INVALID_OPERATION, kInvalidPropertyForProgramInterface);
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ValidateGetProgramInterfaceiv(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ Program *programObject = GetValidProgram(context, program);
+ if (programObject == nullptr)
+ {
+ return false;
+ }
+
+ if (!ValidateProgramInterface(programInterface))
+ {
+ context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
+ return false;
+ }
+
+ switch (pname)
+ {
+ case GL_ACTIVE_RESOURCES:
+ case GL_MAX_NAME_LENGTH:
+ case GL_MAX_NUM_ACTIVE_VARIABLES:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
+ return false;
+ }
+
+ if (pname == GL_MAX_NAME_LENGTH && programInterface == GL_ATOMIC_COUNTER_BUFFER)
+ {
+ context->validationError(GL_INVALID_OPERATION, kAtomicCounterResourceName);
+ return false;
+ }
+
+ if (pname == GL_MAX_NUM_ACTIVE_VARIABLES)
+ {
+ switch (programInterface)
+ {
+ case GL_ATOMIC_COUNTER_BUFFER:
+ case GL_SHADER_STORAGE_BLOCK:
+ case GL_UNIFORM_BLOCK:
+ break;
+
+ default:
+ context->validationError(GL_INVALID_OPERATION, kMaxActiveVariablesInterface);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool ValidateGetProgramInterfaceivRobustANGLE(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+static bool ValidateGenOrDeleteES31(Context *context, GLint n)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ return ValidateGenOrDelete(context, n);
+}
+
+bool ValidateGenProgramPipelines(Context *context, GLint n, GLuint *)
+{
+ return ValidateGenOrDeleteES31(context, n);
+}
+
+bool ValidateDeleteProgramPipelines(Context *context, GLint n, const GLuint *)
+{
+ return ValidateGenOrDeleteES31(context, n);
+}
+
+bool ValidateBindProgramPipeline(Context *context, GLuint pipeline)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (!context->isProgramPipelineGenerated(pipeline))
+ {
+ context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateIsProgramPipeline(Context *context, GLuint pipeline)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateUseProgramStages(Context *context, GLuint pipeline, GLbitfield stages, GLuint program)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateActiveShaderProgram(Context *context, GLuint pipeline, GLuint program)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateCreateShaderProgramv(Context *context,
+ ShaderType type,
+ GLsizei count,
+ const GLchar *const *strings)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetProgramPipelineiv(Context *context, GLuint pipeline, GLenum pname, GLint *params)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateValidateProgramPipeline(Context *context, GLuint pipeline)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetProgramPipelineInfoLog(Context *context,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateMemoryBarrier(Context *context, GLbitfield barriers)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (barriers == GL_ALL_BARRIER_BITS)
+ {
+ return true;
+ }
+
+ GLbitfield supported_barrier_bits =
+ GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT | GL_ELEMENT_ARRAY_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT |
+ GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL_COMMAND_BARRIER_BIT |
+ GL_PIXEL_BUFFER_BARRIER_BIT | GL_TEXTURE_UPDATE_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT |
+ GL_FRAMEBUFFER_BARRIER_BIT | GL_TRANSFORM_FEEDBACK_BARRIER_BIT |
+ GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT;
+ if (barriers == 0 || (barriers & ~supported_barrier_bits) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMemoryBarrierBit);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ if (barriers == GL_ALL_BARRIER_BITS)
+ {
+ return true;
+ }
+
+ GLbitfield supported_barrier_bits = GL_ATOMIC_COUNTER_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT |
+ GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
+ GL_SHADER_STORAGE_BARRIER_BIT |
+ GL_TEXTURE_FETCH_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT;
+ if (barriers == 0 || (barriers & ~supported_barrier_bits) != 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMemoryBarrierBit);
+ return false;
+ }
+
+ return true;
+}
+
+bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask)
+{
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+
+ return ValidateSampleMaskiBase(context, maskNumber, mask);
+}
+
+bool ValidateFramebufferTextureEXT(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ if (!context->getExtensions().geometryShader)
+ {
+ context->validationError(GL_INVALID_OPERATION, kGeometryShaderExtensionNotEnabled);
+ return false;
+ }
+
+ if (texture != 0)
+ {
+ gl::Texture *tex = context->getTexture(texture);
+
+ // [EXT_geometry_shader] Section 9.2.8 "Attaching Texture Images to a Framebuffer"
+ // An INVALID_VALUE error is generated if <texture> is not the name of a texture object.
+ // We put this validation before ValidateFramebufferTextureBase because it is an
+ // INVALID_OPERATION error for both FramebufferTexture2D and FramebufferTextureLayer:
+ // [OpenGL ES 3.1] Chapter 9.2.8 (FramebufferTexture2D)
+ // An INVALID_OPERATION error is generated if texture is not zero, and does not name an
+ // existing texture object of type matching textarget.
+ // [OpenGL ES 3.1 Chapter 9.2.8 (FramebufferTextureLayer)
+ // An INVALID_OPERATION error is generated if texture is non-zero and is not the name of a
+ // three-dimensional or two-dimensional array texture.
+ if (tex == nullptr)
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureName);
+ return false;
+ }
+
+ if (!ValidMipLevel(context, tex->getType(), level))
+ {
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
+ return false;
+ }
+ }
+
+ if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+// GL_OES_texture_storage_multisample_2d_array
+bool ValidateTexStorage3DMultisampleOES(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLenum sizedinternalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ if (!context->getExtensions().textureStorageMultisample2DArray)
+ {
+ context->validationError(GL_INVALID_ENUM, kMultisampleArrayExtensionRequired);
+ return false;
+ }
+
+ if (target != TextureType::_2DMultisampleArray)
+ {
+ context->validationError(GL_INVALID_ENUM, kTargetMustBeTexture2DMultisampleArrayOES);
+ return false;
+ }
+
+ if (width < 1 || height < 1 || depth < 1)
+ {
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
+ return false;
+ }
+
+ return ValidateTexStorageMultisample(context, target, samples, sizedinternalformat, width,
+ height);
+}
+
+bool ValidateTexStorageMem3DMultisampleEXT(Context *context,
+ TextureType target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ if (!context->getExtensions().memoryObject)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool ValidateGetProgramResourceLocationIndexEXT(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const char *name)
+{
+ if (!context->getExtensions().blendFuncExtended)
+ {
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
+ return false;
+ }
+ if (context->getClientVersion() < ES_3_1)
+ {
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
+ return false;
+ }
+ if (programInterface != GL_PROGRAM_OUTPUT)
+ {
+ context->validationError(GL_INVALID_ENUM, kProgramInterfaceMustBeProgramOutput);
+ return false;
+ }
+ Program *programObject = GetValidProgram(context, program);
+ if (!programObject)
+ {
+ return false;
+ }
+ if (!programObject->isLinked())
+ {
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
+ return false;
+ }
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationES31.h b/gfx/angle/checkout/src/libANGLE/validationES31.h
new file mode 100644
index 0000000000..0c07ea88a1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES31.h
@@ -0,0 +1,20 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES31.h:
+// Inlined validation functions for OpenGL ES 3.1 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES31_H_
+#define LIBANGLE_VALIDATION_ES31_H_
+
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/validationES31_autogen.h"
+
+namespace gl
+{
+// Nothing here yet.
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES31_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES31_autogen.h b/gfx/angle/checkout/src/libANGLE/validationES31_autogen.h
new file mode 100644
index 0000000000..5f01b27ea4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES31_autogen.h
@@ -0,0 +1,298 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES31_autogen.h:
+// Validation functions for the OpenGL ES 3.1 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES31_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_ES31_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateActiveShaderProgram(Context *context, GLuint pipeline, GLuint program);
+bool ValidateBindImageTexture(Context *context,
+ GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format);
+bool ValidateBindProgramPipeline(Context *context, GLuint pipeline);
+bool ValidateBindVertexBuffer(Context *context,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride);
+bool ValidateCreateShaderProgramv(Context *context,
+ ShaderType typePacked,
+ GLsizei count,
+ const GLchar *const *strings);
+bool ValidateDeleteProgramPipelines(Context *context, GLsizei n, const GLuint *pipelines);
+bool ValidateDispatchCompute(Context *context,
+ GLuint num_groups_x,
+ GLuint num_groups_y,
+ GLuint num_groups_z);
+bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect);
+bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode modePacked, const void *indirect);
+bool ValidateDrawElementsIndirect(Context *context,
+ PrimitiveMode modePacked,
+ DrawElementsType typePacked,
+ const void *indirect);
+bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param);
+bool ValidateGenProgramPipelines(Context *context, GLsizei n, GLuint *pipelines);
+bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data);
+bool ValidateGetFramebufferParameteriv(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfloat *val);
+bool ValidateGetProgramInterfaceiv(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetProgramPipelineInfoLog(Context *context,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+bool ValidateGetProgramPipelineiv(Context *context, GLuint pipeline, GLenum pname, GLint *params);
+bool ValidateGetProgramResourceIndex(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+bool ValidateGetProgramResourceLocation(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+bool ValidateGetProgramResourceName(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name);
+bool ValidateGetProgramResourceiv(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetTexLevelParameterfv(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+bool ValidateGetTexLevelParameteriv(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+bool ValidateIsProgramPipeline(Context *context, GLuint pipeline);
+bool ValidateMemoryBarrier(Context *context, GLbitfield barriers);
+bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers);
+bool ValidateProgramUniform1f(Context *context, GLuint program, GLint location, GLfloat v0);
+bool ValidateProgramUniform1fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+bool ValidateProgramUniform1i(Context *context, GLuint program, GLint location, GLint v0);
+bool ValidateProgramUniform1iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+bool ValidateProgramUniform1ui(Context *context, GLuint program, GLint location, GLuint v0);
+bool ValidateProgramUniform1uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+bool ValidateProgramUniform2f(Context *context,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1);
+bool ValidateProgramUniform2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+bool ValidateProgramUniform2i(Context *context, GLuint program, GLint location, GLint v0, GLint v1);
+bool ValidateProgramUniform2iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+bool ValidateProgramUniform2ui(Context *context,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1);
+bool ValidateProgramUniform2uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+bool ValidateProgramUniform3f(Context *context,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2);
+bool ValidateProgramUniform3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+bool ValidateProgramUniform3i(Context *context,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2);
+bool ValidateProgramUniform3iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+bool ValidateProgramUniform3ui(Context *context,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2);
+bool ValidateProgramUniform3uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+bool ValidateProgramUniform4f(Context *context,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3);
+bool ValidateProgramUniform4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+bool ValidateProgramUniform4i(Context *context,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3);
+bool ValidateProgramUniform4iv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+bool ValidateProgramUniform4ui(Context *context,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3);
+bool ValidateProgramUniform4uiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+bool ValidateProgramUniformMatrix2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix2x3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix2x4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix3x2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix3x4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix4fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix4x2fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateProgramUniformMatrix4x3fv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask);
+bool ValidateTexStorage2DMultisample(Context *context,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+bool ValidateUseProgramStages(Context *context, GLuint pipeline, GLbitfield stages, GLuint program);
+bool ValidateValidateProgramPipeline(Context *context, GLuint pipeline);
+bool ValidateVertexAttribBinding(Context *context, GLuint attribindex, GLuint bindingindex);
+bool ValidateVertexAttribFormat(Context *context,
+ GLuint attribindex,
+ GLint size,
+ VertexAttribType typePacked,
+ GLboolean normalized,
+ GLuint relativeoffset);
+bool ValidateVertexAttribIFormat(Context *context,
+ GLuint attribindex,
+ GLint size,
+ VertexAttribType typePacked,
+ GLuint relativeoffset);
+bool ValidateVertexBindingDivisor(Context *context, GLuint bindingindex, GLuint divisor);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES31_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationES3_autogen.h b/gfx/angle/checkout/src/libANGLE/validationES3_autogen.h
new file mode 100644
index 0000000000..89836ccc9f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationES3_autogen.h
@@ -0,0 +1,355 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationES3_autogen.h:
+// Validation functions for the OpenGL ES 3.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_ES3_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_ES3_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateBeginQuery(Context *context, QueryType targetPacked, GLuint id);
+bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveModePacked);
+bool ValidateBindBufferBase(Context *context,
+ BufferBinding targetPacked,
+ GLuint index,
+ GLuint buffer);
+bool ValidateBindBufferRange(Context *context,
+ BufferBinding targetPacked,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+bool ValidateBindSampler(Context *context, GLuint unit, GLuint sampler);
+bool ValidateBindTransformFeedback(Context *context, GLenum target, GLuint id);
+bool ValidateBindVertexArray(Context *context, GLuint array);
+bool ValidateBlitFramebuffer(Context *context,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+bool ValidateClearBufferfi(Context *context,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil);
+bool ValidateClearBufferfv(Context *context, GLenum buffer, GLint drawbuffer, const GLfloat *value);
+bool ValidateClearBufferiv(Context *context, GLenum buffer, GLint drawbuffer, const GLint *value);
+bool ValidateClearBufferuiv(Context *context, GLenum buffer, GLint drawbuffer, const GLuint *value);
+bool ValidateClientWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout);
+bool ValidateCompressedTexImage3D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCompressedTexSubImage3D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCopyBufferSubData(Context *context,
+ BufferBinding readTargetPacked,
+ BufferBinding writeTargetPacked,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size);
+bool ValidateCopyTexSubImage3D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+bool ValidateDeleteQueries(Context *context, GLsizei n, const GLuint *ids);
+bool ValidateDeleteSamplers(Context *context, GLsizei count, const GLuint *samplers);
+bool ValidateDeleteSync(Context *context, GLsync sync);
+bool ValidateDeleteTransformFeedbacks(Context *context, GLsizei n, const GLuint *ids);
+bool ValidateDeleteVertexArrays(Context *context, GLsizei n, const GLuint *arrays);
+bool ValidateDrawArraysInstanced(Context *context,
+ PrimitiveMode modePacked,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount);
+bool ValidateDrawBuffers(Context *context, GLsizei n, const GLenum *bufs);
+bool ValidateDrawElementsInstanced(Context *context,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei instancecount);
+bool ValidateDrawRangeElements(Context *context,
+ PrimitiveMode modePacked,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices);
+bool ValidateEndQuery(Context *context, QueryType targetPacked);
+bool ValidateEndTransformFeedback(Context *context);
+bool ValidateFenceSync(Context *context, GLenum condition, GLbitfield flags);
+bool ValidateFlushMappedBufferRange(Context *context,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length);
+bool ValidateFramebufferTextureLayer(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer);
+bool ValidateGenQueries(Context *context, GLsizei n, GLuint *ids);
+bool ValidateGenSamplers(Context *context, GLsizei count, GLuint *samplers);
+bool ValidateGenTransformFeedbacks(Context *context, GLsizei n, GLuint *ids);
+bool ValidateGenVertexArrays(Context *context, GLsizei n, GLuint *arrays);
+bool ValidateGetActiveUniformBlockName(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName);
+bool ValidateGetActiveUniformBlockiv(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetActiveUniformsiv(Context *context,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetBufferParameteri64v(Context *context,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLint64 *params);
+bool ValidateGetBufferPointerv(Context *context,
+ BufferBinding targetPacked,
+ GLenum pname,
+ void **params);
+bool ValidateGetFragDataLocation(Context *context, GLuint program, const GLchar *name);
+bool ValidateGetInteger64i_v(Context *context, GLenum target, GLuint index, GLint64 *data);
+bool ValidateGetInteger64v(Context *context, GLenum pname, GLint64 *data);
+bool ValidateGetIntegeri_v(Context *context, GLenum target, GLuint index, GLint *data);
+bool ValidateGetInternalformativ(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params);
+bool ValidateGetProgramBinary(Context *context,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint *params);
+bool ValidateGetQueryiv(Context *context, QueryType targetPacked, GLenum pname, GLint *params);
+bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params);
+bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params);
+bool ValidateGetStringi(Context *context, GLenum name, GLuint index);
+bool ValidateGetSynciv(Context *context,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values);
+bool ValidateGetTransformFeedbackVarying(Context *context,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name);
+bool ValidateGetUniformBlockIndex(Context *context, GLuint program, const GLchar *uniformBlockName);
+bool ValidateGetUniformIndices(Context *context,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices);
+bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint *params);
+bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params);
+bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params);
+bool ValidateInvalidateFramebuffer(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+bool ValidateInvalidateSubFramebuffer(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+bool ValidateIsQuery(Context *context, GLuint id);
+bool ValidateIsSampler(Context *context, GLuint sampler);
+bool ValidateIsSync(Context *context, GLsync sync);
+bool ValidateIsTransformFeedback(Context *context, GLuint id);
+bool ValidateIsVertexArray(Context *context, GLuint array);
+bool ValidateMapBufferRange(Context *context,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+bool ValidatePauseTransformFeedback(Context *context);
+bool ValidateProgramBinary(Context *context,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length);
+bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, GLint value);
+bool ValidateReadBuffer(Context *context, GLenum src);
+bool ValidateRenderbufferStorageMultisample(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateResumeTransformFeedback(Context *context);
+bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param);
+bool ValidateSamplerParameterfv(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLfloat *param);
+bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param);
+bool ValidateSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, const GLint *param);
+bool ValidateTexImage3D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTexStorage2D(Context *context,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateTexStorage3D(Context *context,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+bool ValidateTexSubImage3D(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTransformFeedbackVaryings(Context *context,
+ GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode);
+bool ValidateUniform1ui(Context *context, GLint location, GLuint v0);
+bool ValidateUniform1uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
+bool ValidateUniform2ui(Context *context, GLint location, GLuint v0, GLuint v1);
+bool ValidateUniform2uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
+bool ValidateUniform3ui(Context *context, GLint location, GLuint v0, GLuint v1, GLuint v2);
+bool ValidateUniform3uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
+bool ValidateUniform4ui(Context *context,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3);
+bool ValidateUniform4uiv(Context *context, GLint location, GLsizei count, const GLuint *value);
+bool ValidateUniformBlockBinding(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding);
+bool ValidateUniformMatrix2x3fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUniformMatrix2x4fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUniformMatrix3x2fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUniformMatrix3x4fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUniformMatrix4x2fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUniformMatrix4x3fv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+bool ValidateUnmapBuffer(Context *context, BufferBinding targetPacked);
+bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor);
+bool ValidateVertexAttribI4i(Context *context, GLuint index, GLint x, GLint y, GLint z, GLint w);
+bool ValidateVertexAttribI4iv(Context *context, GLuint index, const GLint *v);
+bool ValidateVertexAttribI4ui(Context *context,
+ GLuint index,
+ GLuint x,
+ GLuint y,
+ GLuint z,
+ GLuint w);
+bool ValidateVertexAttribI4uiv(Context *context, GLuint index, const GLuint *v);
+bool ValidateVertexAttribIPointer(Context *context,
+ GLuint index,
+ GLint size,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ES3_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationESEXT.h b/gfx/angle/checkout/src/libANGLE/validationESEXT.h
new file mode 100644
index 0000000000..b22ed4e379
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationESEXT.h
@@ -0,0 +1,20 @@
+//
+// Copyright 2018 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationESEXT.h:
+// Inlined validation functions for OpenGL ES extension entry points.
+
+#ifndef LIBANGLE_VALIDATION_ESEXT_H_
+#define LIBANGLE_VALIDATION_ESEXT_H_
+
+#include "libANGLE/ErrorStrings.h"
+#include "libANGLE/validationESEXT_autogen.h"
+
+namespace gl
+{
+// Nothing here yet.
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ESEXT_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationESEXT_autogen.h b/gfx/angle/checkout/src/libANGLE/validationESEXT_autogen.h
new file mode 100644
index 0000000000..f9bd14153d
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationESEXT_autogen.h
@@ -0,0 +1,1271 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationESEXT_autogen.h:
+// Validation functions for the OpenGL ES extension entry points.
+
+#ifndef LIBANGLE_VALIDATION_ESEXT_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_ESEXT_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+// GL_ANGLE_copy_texture_3d
+bool ValidateCopyTexture3DANGLE(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+bool ValidateCopySubTexture3DANGLE(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+
+// GL_ANGLE_framebuffer_blit
+bool ValidateBlitFramebufferANGLE(Context *context,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+
+// GL_ANGLE_framebuffer_multisample
+bool ValidateRenderbufferStorageMultisampleANGLE(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+
+// GL_ANGLE_instanced_arrays
+bool ValidateDrawArraysInstancedANGLE(Context *context,
+ PrimitiveMode modePacked,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+bool ValidateDrawElementsInstancedANGLE(Context *context,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei primcount);
+bool ValidateVertexAttribDivisorANGLE(Context *context, GLuint index, GLuint divisor);
+
+// GL_ANGLE_multi_draw
+bool ValidateMultiDrawArraysANGLE(Context *context,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount);
+bool ValidateMultiDrawArraysInstancedANGLE(Context *context,
+ PrimitiveMode modePacked,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+bool ValidateMultiDrawElementsANGLE(Context *context,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ GLsizei drawcount);
+bool ValidateMultiDrawElementsInstancedANGLE(Context *context,
+ PrimitiveMode modePacked,
+ const GLsizei *counts,
+ DrawElementsType typePacked,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+
+// GL_ANGLE_provoking_vertex
+bool ValidateProvokingVertexANGLE(Context *context, ProvokingVertexConvention modePacked);
+
+// GL_ANGLE_request_extension
+bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name);
+
+// GL_ANGLE_robust_client_memory
+bool ValidateGetBooleanvRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params);
+bool ValidateGetBufferParameterivRobustANGLE(Context *context,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetFloatvRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetFramebufferAttachmentParameterivRobustANGLE(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetIntegervRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+bool ValidateGetProgramivRobustANGLE(Context *context,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetRenderbufferParameterivRobustANGLE(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetShaderivRobustANGLE(Context *context,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetTexParameterfvRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetTexParameterivRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetUniformfvRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetUniformivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetVertexAttribfvRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetVertexAttribivRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetVertexAttribPointervRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer);
+bool ValidateReadPixelsRobustANGLE(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels);
+bool ValidateTexImage2DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+bool ValidateTexParameterfvRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params);
+bool ValidateTexParameterivRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+bool ValidateTexSubImage2DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+bool ValidateTexImage3DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+bool ValidateTexSubImage3DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+bool ValidateCompressedTexImage2DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+bool ValidateCompressedTexSubImage2DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+bool ValidateCompressedTexImage3DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+bool ValidateCompressedTexSubImage3DRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+bool ValidateGetQueryivRobustANGLE(Context *context,
+ QueryType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetQueryObjectuivRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateGetBufferPointervRobustANGLE(Context *context,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+bool ValidateGetIntegeri_vRobustANGLE(Context *context,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+bool ValidateGetInternalformativRobustANGLE(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetVertexAttribIivRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetVertexAttribIuivRobustANGLE(Context *context,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateGetUniformuivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateGetActiveUniformBlockivRobustANGLE(Context *context,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetInteger64vRobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+bool ValidateGetInteger64i_vRobustANGLE(Context *context,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+bool ValidateGetBufferParameteri64vRobustANGLE(Context *context,
+ BufferBinding targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+bool ValidateSamplerParameterivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param);
+bool ValidateSamplerParameterfvRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param);
+bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetFramebufferParameterivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetProgramInterfaceivRobustANGLE(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetBooleani_vRobustANGLE(Context *context,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data);
+bool ValidateGetMultisamplefvRobustANGLE(Context *context,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val);
+bool ValidateGetTexLevelParameterivRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetTexLevelParameterfvRobustANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetPointervRobustANGLERobustANGLE(Context *context,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+bool ValidateReadnPixelsRobustANGLE(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data);
+bool ValidateGetnUniformfvRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+bool ValidateGetnUniformivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetnUniformuivRobustANGLE(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateTexParameterIivRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+bool ValidateTexParameterIuivRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params);
+bool ValidateGetTexParameterIivRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetTexParameterIuivRobustANGLE(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateSamplerParameterIivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param);
+bool ValidateSamplerParameterIuivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param);
+bool ValidateGetSamplerParameterIivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetSamplerParameterIuivRobustANGLE(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+bool ValidateGetQueryObjectivRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+bool ValidateGetQueryObjecti64vRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+bool ValidateGetQueryObjectui64vRobustANGLE(Context *context,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params);
+
+// GL_ANGLE_texture_external_update
+bool ValidateTexImage2DExternalANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type);
+bool ValidateInvalidateTextureANGLE(Context *context, TextureType targetPacked);
+
+// GL_ANGLE_texture_multisample
+bool ValidateTexStorage2DMultisampleANGLE(Context *context,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+bool ValidateGetTexLevelParameterivANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetTexLevelParameterfvANGLE(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+bool ValidateGetMultisamplefvANGLE(Context *context, GLenum pname, GLuint index, GLfloat *val);
+bool ValidateSampleMaskiANGLE(Context *context, GLuint maskNumber, GLbitfield mask);
+
+// GL_ANGLE_translated_shader_source
+bool ValidateGetTranslatedShaderSourceANGLE(Context *context,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source);
+
+// GL_CHROMIUM_bind_uniform_location
+bool ValidateBindUniformLocationCHROMIUM(Context *context,
+ GLuint program,
+ GLint location,
+ const GLchar *name);
+
+// GL_CHROMIUM_copy_compressed_texture
+bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GLuint destId);
+
+// GL_CHROMIUM_copy_texture
+bool ValidateCopyTextureCHROMIUM(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+bool ValidateCopySubTextureCHROMIUM(Context *context,
+ GLuint sourceId,
+ GLint sourceLevel,
+ TextureTarget destTargetPacked,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+
+// GL_CHROMIUM_framebuffer_mixed_samples
+bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components);
+bool ValidateMatrixLoadfCHROMIUM(Context *context, GLenum matrixMode, const GLfloat *matrix);
+bool ValidateMatrixLoadIdentityCHROMIUM(Context *context, GLenum matrixMode);
+
+// GL_CHROMIUM_lose_context
+bool ValidateLoseContextCHROMIUM(Context *context,
+ GraphicsResetStatus currentPacked,
+ GraphicsResetStatus otherPacked);
+
+// GL_CHROMIUM_path_rendering
+bool ValidateGenPathsCHROMIUM(Context *context, GLsizei range);
+bool ValidateDeletePathsCHROMIUM(Context *context, GLuint first, GLsizei range);
+bool ValidateIsPathCHROMIUM(Context *context, GLuint path);
+bool ValidatePathCommandsCHROMIUM(Context *context,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords);
+bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, GLfloat value);
+bool ValidatePathParameteriCHROMIUM(Context *context, GLuint path, GLenum pname, GLint value);
+bool ValidateGetPathParameterfvCHROMIUM(Context *context,
+ GLuint path,
+ GLenum pname,
+ GLfloat *value);
+bool ValidateGetPathParameterivCHROMIUM(Context *context, GLuint path, GLenum pname, GLint *value);
+bool ValidatePathStencilFuncCHROMIUM(Context *context, GLenum func, GLint ref, GLuint mask);
+bool ValidateStencilFillPathCHROMIUM(Context *context, GLuint path, GLenum fillMode, GLuint mask);
+bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint reference, GLuint mask);
+bool ValidateCoverFillPathCHROMIUM(Context *context, GLuint path, GLenum coverMode);
+bool ValidateCoverStrokePathCHROMIUM(Context *context, GLuint path, GLenum coverMode);
+bool ValidateStencilThenCoverFillPathCHROMIUM(Context *context,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode);
+bool ValidateStencilThenCoverStrokePathCHROMIUM(Context *context,
+ GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode);
+bool ValidateCoverFillPathInstancedCHROMIUM(Context *context,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+bool ValidateCoverStrokePathInstancedCHROMIUM(Context *context,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+bool ValidateStencilStrokePathInstancedCHROMIUM(Context *context,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+bool ValidateStencilFillPathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+bool ValidateStencilThenCoverFillPathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+bool ValidateStencilThenCoverStrokePathInstancedCHROMIUM(Context *context,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+bool ValidateBindFragmentInputLocationCHROMIUM(Context *context,
+ GLuint programs,
+ GLint location,
+ const GLchar *name);
+bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
+ GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs);
+
+// GL_EXT_blend_func_extended
+bool ValidateBindFragDataLocationEXT(Context *context,
+ GLuint program,
+ GLuint color,
+ const GLchar *name);
+bool ValidateBindFragDataLocationIndexedEXT(Context *context,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name);
+bool ValidateGetFragDataIndexEXT(Context *context, GLuint program, const GLchar *name);
+bool ValidateGetProgramResourceLocationIndexEXT(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+
+// GL_EXT_debug_marker
+bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const GLchar *marker);
+bool ValidatePopGroupMarkerEXT(Context *context);
+bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const GLchar *marker);
+
+// GL_EXT_discard_framebuffer
+bool ValidateDiscardFramebufferEXT(Context *context,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+
+// GL_EXT_disjoint_timer_query
+bool ValidateBeginQueryEXT(Context *context, QueryType targetPacked, GLuint id);
+bool ValidateDeleteQueriesEXT(Context *context, GLsizei n, const GLuint *ids);
+bool ValidateEndQueryEXT(Context *context, QueryType targetPacked);
+bool ValidateGenQueriesEXT(Context *context, GLsizei n, GLuint *ids);
+bool ValidateGetQueryObjecti64vEXT(Context *context, GLuint id, GLenum pname, GLint64 *params);
+bool ValidateGetQueryObjectivEXT(Context *context, GLuint id, GLenum pname, GLint *params);
+bool ValidateGetQueryObjectui64vEXT(Context *context, GLuint id, GLenum pname, GLuint64 *params);
+bool ValidateGetQueryObjectuivEXT(Context *context, GLuint id, GLenum pname, GLuint *params);
+bool ValidateGetQueryivEXT(Context *context, QueryType targetPacked, GLenum pname, GLint *params);
+bool ValidateIsQueryEXT(Context *context, GLuint id);
+bool ValidateQueryCounterEXT(Context *context, GLuint id, QueryType targetPacked);
+
+// GL_EXT_draw_buffers
+bool ValidateDrawBuffersEXT(Context *context, GLsizei n, const GLenum *bufs);
+
+// GL_EXT_geometry_shader
+bool ValidateFramebufferTextureEXT(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level);
+
+// GL_EXT_instanced_arrays
+bool ValidateDrawArraysInstancedEXT(Context *context,
+ PrimitiveMode modePacked,
+ GLint start,
+ GLsizei count,
+ GLsizei primcount);
+bool ValidateDrawElementsInstancedEXT(Context *context,
+ PrimitiveMode modePacked,
+ GLsizei count,
+ DrawElementsType typePacked,
+ const void *indices,
+ GLsizei primcount);
+bool ValidateVertexAttribDivisorEXT(Context *context, GLuint index, GLuint divisor);
+
+// GL_EXT_map_buffer_range
+bool ValidateFlushMappedBufferRangeEXT(Context *context,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length);
+bool ValidateMapBufferRangeEXT(Context *context,
+ BufferBinding targetPacked,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+
+// GL_EXT_memory_object
+bool ValidateBufferStorageMemEXT(Context *context,
+ TextureType targetPacked,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset);
+bool ValidateCreateMemoryObjectsEXT(Context *context, GLsizei n, GLuint *memoryObjects);
+bool ValidateDeleteMemoryObjectsEXT(Context *context, GLsizei n, const GLuint *memoryObjects);
+bool ValidateGetMemoryObjectParameterivEXT(Context *context,
+ GLuint memoryObject,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetUnsignedBytevEXT(Context *context, GLenum pname, GLubyte *data);
+bool ValidateGetUnsignedBytei_vEXT(Context *context, GLenum target, GLuint index, GLubyte *data);
+bool ValidateIsMemoryObjectEXT(Context *context, GLuint memoryObject);
+bool ValidateMemoryObjectParameterivEXT(Context *context,
+ GLuint memoryObject,
+ GLenum pname,
+ const GLint *params);
+bool ValidateTexStorageMem2DEXT(Context *context,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset);
+bool ValidateTexStorageMem2DMultisampleEXT(Context *context,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+bool ValidateTexStorageMem3DEXT(Context *context,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset);
+bool ValidateTexStorageMem3DMultisampleEXT(Context *context,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+
+// GL_EXT_memory_object_fd
+bool ValidateImportMemoryFdEXT(Context *context,
+ GLuint memory,
+ GLuint64 size,
+ HandleType handleTypePacked,
+ GLint fd);
+
+// GL_EXT_occlusion_query_boolean
+
+// GL_EXT_robustness
+bool ValidateGetGraphicsResetStatusEXT(Context *context);
+bool ValidateGetnUniformfvEXT(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params);
+bool ValidateGetnUniformivEXT(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params);
+bool ValidateReadnPixelsEXT(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data);
+
+// GL_EXT_semaphore
+bool ValidateDeleteSemaphoresEXT(Context *context, GLsizei n, const GLuint *semaphores);
+bool ValidateGenSemaphoresEXT(Context *context, GLsizei n, GLuint *semaphores);
+bool ValidateGetSemaphoreParameterui64vEXT(Context *context,
+ GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params);
+bool ValidateIsSemaphoreEXT(Context *context, GLuint semaphore);
+bool ValidateSemaphoreParameterui64vEXT(Context *context,
+ GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params);
+bool ValidateSignalSemaphoreEXT(Context *context,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts);
+bool ValidateWaitSemaphoreEXT(Context *context,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts);
+
+// GL_EXT_semaphore_fd
+bool ValidateImportSemaphoreFdEXT(Context *context,
+ GLuint semaphore,
+ HandleType handleTypePacked,
+ GLint fd);
+
+// GL_EXT_texture_storage
+bool ValidateTexStorage1DEXT(Context *context,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width);
+bool ValidateTexStorage2DEXT(Context *context,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateTexStorage3DEXT(Context *context,
+ TextureType targetPacked,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+
+// GL_KHR_debug
+bool ValidateDebugMessageCallbackKHR(Context *context,
+ GLDEBUGPROCKHR callback,
+ const void *userParam);
+bool ValidateDebugMessageControlKHR(Context *context,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled);
+bool ValidateDebugMessageInsertKHR(Context *context,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf);
+bool ValidateGetDebugMessageLogKHR(Context *context,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog);
+bool ValidateGetObjectLabelKHR(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+bool ValidateGetObjectPtrLabelKHR(Context *context,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+bool ValidateGetPointervKHR(Context *context, GLenum pname, void **params);
+bool ValidateObjectLabelKHR(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label);
+bool ValidateObjectPtrLabelKHR(Context *context,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label);
+bool ValidatePopDebugGroupKHR(Context *context);
+bool ValidatePushDebugGroupKHR(Context *context,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message);
+
+// GL_KHR_parallel_shader_compile
+bool ValidateMaxShaderCompilerThreadsKHR(Context *context, GLuint count);
+
+// GL_NV_fence
+bool ValidateDeleteFencesNV(Context *context, GLsizei n, const GLuint *fences);
+bool ValidateFinishFenceNV(Context *context, GLuint fence);
+bool ValidateGenFencesNV(Context *context, GLsizei n, GLuint *fences);
+bool ValidateGetFenceivNV(Context *context, GLuint fence, GLenum pname, GLint *params);
+bool ValidateIsFenceNV(Context *context, GLuint fence);
+bool ValidateSetFenceNV(Context *context, GLuint fence, GLenum condition);
+bool ValidateTestFenceNV(Context *context, GLuint fence);
+
+// GL_OES_EGL_image
+bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
+ GLenum target,
+ GLeglImageOES image);
+bool ValidateEGLImageTargetTexture2DOES(Context *context,
+ TextureType targetPacked,
+ GLeglImageOES image);
+
+// GL_OES_draw_texture
+bool ValidateDrawTexfOES(Context *context,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat width,
+ GLfloat height);
+bool ValidateDrawTexfvOES(Context *context, const GLfloat *coords);
+bool ValidateDrawTexiOES(Context *context, GLint x, GLint y, GLint z, GLint width, GLint height);
+bool ValidateDrawTexivOES(Context *context, const GLint *coords);
+bool ValidateDrawTexsOES(Context *context,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort width,
+ GLshort height);
+bool ValidateDrawTexsvOES(Context *context, const GLshort *coords);
+bool ValidateDrawTexxOES(Context *context,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z,
+ GLfixed width,
+ GLfixed height);
+bool ValidateDrawTexxvOES(Context *context, const GLfixed *coords);
+
+// GL_OES_framebuffer_object
+bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer);
+bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer);
+bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target);
+bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers);
+bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers);
+bool ValidateFramebufferRenderbufferOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+bool ValidateFramebufferTexture2DOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level);
+bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers);
+bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers);
+bool ValidateGenerateMipmapOES(Context *context, TextureType targetPacked);
+bool ValidateGetFramebufferAttachmentParameterivOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetRenderbufferParameterivOES(Context *context,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer);
+bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer);
+bool ValidateRenderbufferStorageOES(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+
+// GL_OES_get_program_binary
+bool ValidateGetProgramBinaryOES(Context *context,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+bool ValidateProgramBinaryOES(Context *context,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length);
+
+// GL_OES_mapbuffer
+bool ValidateGetBufferPointervOES(Context *context,
+ BufferBinding targetPacked,
+ GLenum pname,
+ void **params);
+bool ValidateMapBufferOES(Context *context, BufferBinding targetPacked, GLenum access);
+bool ValidateUnmapBufferOES(Context *context, BufferBinding targetPacked);
+
+// GL_OES_matrix_palette
+bool ValidateCurrentPaletteMatrixOES(Context *context, GLuint matrixpaletteindex);
+bool ValidateLoadPaletteFromModelViewMatrixOES(Context *context);
+bool ValidateMatrixIndexPointerOES(Context *context,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateWeightPointerOES(Context *context,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+
+// GL_OES_point_size_array
+bool ValidatePointSizePointerOES(Context *context,
+ VertexAttribType typePacked,
+ GLsizei stride,
+ const void *pointer);
+
+// GL_OES_query_matrix
+bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent);
+
+// GL_OES_texture_3D
+bool ValidateCompressedTexImage3DOES(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCompressedTexSubImage3DOES(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCopyTexSubImage3DOES(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+bool ValidateFramebufferTexture3DOES(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level,
+ GLint zoffset);
+bool ValidateTexImage3DOES(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTexSubImage3DOES(Context *context,
+ TextureTarget targetPacked,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+
+// GL_OES_texture_border_clamp
+bool ValidateGetSamplerParameterIivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetSamplerParameterIuivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params);
+bool ValidateGetTexParameterIivOES(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetTexParameterIuivOES(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLuint *params);
+bool ValidateSamplerParameterIivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param);
+bool ValidateSamplerParameterIuivOES(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param);
+bool ValidateTexParameterIivOES(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params);
+bool ValidateTexParameterIuivOES(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLuint *params);
+
+// GL_OES_texture_cube_map
+bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params);
+bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, GLint *params);
+bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params);
+bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param);
+bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params);
+bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param);
+bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *params);
+bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param);
+bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLfixed *params);
+
+// GL_OES_texture_storage_multisample_2d_array
+bool ValidateTexStorage3DMultisampleOES(Context *context,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations);
+
+// GL_OES_vertex_array_object
+bool ValidateBindVertexArrayOES(Context *context, GLuint array);
+bool ValidateDeleteVertexArraysOES(Context *context, GLsizei n, const GLuint *arrays);
+bool ValidateGenVertexArraysOES(Context *context, GLsizei n, GLuint *arrays);
+bool ValidateIsVertexArrayOES(Context *context, GLuint array);
+
+// GL_OVR_multiview
+bool ValidateFramebufferTextureMultiviewOVR(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews);
+
+// GL_OVR_multiview2
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_ESEXT_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL1.cpp b/gfx/angle/checkout/src/libANGLE/validationGL1.cpp
new file mode 100644
index 0000000000..e1ff3289d4
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL1.cpp
@@ -0,0 +1,1279 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL1.cpp: Validation functions for OpenGL 1.0 entry point parameters
+
+#include "libANGLE/validationGL1_autogen.h"
+
+namespace gl
+{
+
+bool ValidateAccum(Context *context, GLenum op, GLfloat value)
+{
+ return true;
+}
+
+bool ValidateBegin(Context *context, GLenum mode)
+{
+ return true;
+}
+
+bool ValidateBitmap(Context *context,
+ GLsizei width,
+ GLsizei height,
+ GLfloat xorig,
+ GLfloat yorig,
+ GLfloat xmove,
+ GLfloat ymove,
+ const GLubyte *bitmap)
+{
+ return true;
+}
+
+bool ValidateCallList(Context *context, GLuint list)
+{
+ return true;
+}
+
+bool ValidateCallLists(Context *context, GLsizei n, GLenum type, const void *lists)
+{
+ return true;
+}
+
+bool ValidateClearAccum(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return true;
+}
+
+bool ValidateClearDepth(Context *context, GLdouble depth)
+{
+ return true;
+}
+
+bool ValidateClearIndex(Context *context, GLfloat c)
+{
+ return true;
+}
+
+bool ValidateClipPlane(Context *context, GLenum plane, const GLdouble *equation)
+{
+ return true;
+}
+
+bool ValidateColor3b(Context *context, GLbyte red, GLbyte green, GLbyte blue)
+{
+ return true;
+}
+
+bool ValidateColor3bv(Context *context, const GLbyte *v)
+{
+ return true;
+}
+
+bool ValidateColor3d(Context *context, GLdouble red, GLdouble green, GLdouble blue)
+{
+ return true;
+}
+
+bool ValidateColor3dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateColor3f(Context *context, GLfloat red, GLfloat green, GLfloat blue)
+{
+ return true;
+}
+
+bool ValidateColor3fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateColor3i(Context *context, GLint red, GLint green, GLint blue)
+{
+ return true;
+}
+
+bool ValidateColor3iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateColor3s(Context *context, GLshort red, GLshort green, GLshort blue)
+{
+ return true;
+}
+
+bool ValidateColor3sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateColor3ub(Context *context, GLubyte red, GLubyte green, GLubyte blue)
+{
+ return true;
+}
+
+bool ValidateColor3ubv(Context *context, const GLubyte *v)
+{
+ return true;
+}
+
+bool ValidateColor3ui(Context *context, GLuint red, GLuint green, GLuint blue)
+{
+ return true;
+}
+
+bool ValidateColor3uiv(Context *context, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateColor3us(Context *context, GLushort red, GLushort green, GLushort blue)
+{
+ return true;
+}
+
+bool ValidateColor3usv(Context *context, const GLushort *v)
+{
+ return true;
+}
+
+bool ValidateColor4b(Context *context, GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)
+{
+ return true;
+}
+
+bool ValidateColor4bv(Context *context, const GLbyte *v)
+{
+ return true;
+}
+
+bool ValidateColor4d(Context *context, GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)
+{
+ return true;
+}
+
+bool ValidateColor4dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateColor4fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateColor4i(Context *context, GLint red, GLint green, GLint blue, GLint alpha)
+{
+ return true;
+}
+
+bool ValidateColor4iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateColor4s(Context *context, GLshort red, GLshort green, GLshort blue, GLshort alpha)
+{
+ return true;
+}
+
+bool ValidateColor4sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateColor4ubv(Context *context, const GLubyte *v)
+{
+ return true;
+}
+
+bool ValidateColor4ui(Context *context, GLuint red, GLuint green, GLuint blue, GLuint alpha)
+{
+ return true;
+}
+
+bool ValidateColor4uiv(Context *context, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateColor4us(Context *context, GLushort red, GLushort green, GLushort blue, GLushort alpha)
+{
+ return true;
+}
+
+bool ValidateColor4usv(Context *context, const GLushort *v)
+{
+ return true;
+}
+
+bool ValidateColorMaterial(Context *context, GLenum face, GLenum mode)
+{
+ return true;
+}
+
+bool ValidateCopyPixels(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum type)
+{
+ return true;
+}
+
+bool ValidateDeleteLists(Context *context, GLuint list, GLsizei range)
+{
+ return true;
+}
+
+bool ValidateDepthRange(Context *context, GLdouble n, GLdouble f)
+{
+ return true;
+}
+
+bool ValidateDrawBuffer(Context *context, GLenum buf)
+{
+ return true;
+}
+
+bool ValidateDrawPixels(Context *context,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return true;
+}
+
+bool ValidateEdgeFlag(Context *context, GLboolean flag)
+{
+ return true;
+}
+
+bool ValidateEdgeFlagv(Context *context, const GLboolean *flag)
+{
+ return true;
+}
+
+bool ValidateEnd(Context *context)
+{
+ return true;
+}
+
+bool ValidateEndList(Context *context)
+{
+ return true;
+}
+
+bool ValidateEvalCoord1d(Context *context, GLdouble u)
+{
+ return true;
+}
+
+bool ValidateEvalCoord1dv(Context *context, const GLdouble *u)
+{
+ return true;
+}
+
+bool ValidateEvalCoord1f(Context *context, GLfloat u)
+{
+ return true;
+}
+
+bool ValidateEvalCoord1fv(Context *context, const GLfloat *u)
+{
+ return true;
+}
+
+bool ValidateEvalCoord2d(Context *context, GLdouble u, GLdouble v)
+{
+ return true;
+}
+
+bool ValidateEvalCoord2dv(Context *context, const GLdouble *u)
+{
+ return true;
+}
+
+bool ValidateEvalCoord2f(Context *context, GLfloat u, GLfloat v)
+{
+ return true;
+}
+
+bool ValidateEvalCoord2fv(Context *context, const GLfloat *u)
+{
+ return true;
+}
+
+bool ValidateEvalMesh1(Context *context, GLenum mode, GLint i1, GLint i2)
+{
+ return true;
+}
+
+bool ValidateEvalMesh2(Context *context, GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
+{
+ return true;
+}
+
+bool ValidateEvalPoint1(Context *context, GLint i)
+{
+ return true;
+}
+
+bool ValidateEvalPoint2(Context *context, GLint i, GLint j)
+{
+ return true;
+}
+
+bool ValidateFeedbackBuffer(Context *context, GLsizei size, GLenum type, GLfloat *buffer)
+{
+ return true;
+}
+
+bool ValidateFogi(Context *context, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidateFogiv(Context *context, GLenum pname, const GLint *params)
+{
+ return true;
+}
+
+bool ValidateFrustum(Context *context,
+ GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar)
+{
+ return true;
+}
+
+bool ValidateGenLists(Context *context, GLsizei range)
+{
+ return true;
+}
+
+bool ValidateGetClipPlane(Context *context, GLenum plane, GLdouble *equation)
+{
+ return true;
+}
+
+bool ValidateGetDoublev(Context *context, GLenum pname, GLdouble *data)
+{
+ return true;
+}
+
+bool ValidateGetLightiv(Context *context, GLenum light, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetMapdv(Context *context, GLenum target, GLenum query, GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateGetMapfv(Context *context, GLenum target, GLenum query, GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateGetMapiv(Context *context, GLenum target, GLenum query, GLint *v)
+{
+ return true;
+}
+
+bool ValidateGetMaterialiv(Context *context, GLenum face, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetPixelMapfv(Context *context, GLenum map, GLfloat *values)
+{
+ return true;
+}
+
+bool ValidateGetPixelMapuiv(Context *context, GLenum map, GLuint *values)
+{
+ return true;
+}
+
+bool ValidateGetPixelMapusv(Context *context, GLenum map, GLushort *values)
+{
+ return true;
+}
+
+bool ValidateGetPolygonStipple(Context *context, GLubyte *mask)
+{
+ return true;
+}
+
+bool ValidateGetTexGendv(Context *context, GLenum coord, GLenum pname, GLdouble *params)
+{
+ return true;
+}
+
+bool ValidateGetTexGenfv(Context *context, GLenum coord, GLenum pname, GLfloat *params)
+{
+ return true;
+}
+
+bool ValidateGetTexGeniv(Context *context, GLenum coord, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetTexImage(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ return true;
+}
+
+bool ValidateIndexMask(Context *context, GLuint mask)
+{
+ return true;
+}
+
+bool ValidateIndexd(Context *context, GLdouble c)
+{
+ return true;
+}
+
+bool ValidateIndexdv(Context *context, const GLdouble *c)
+{
+ return true;
+}
+
+bool ValidateIndexf(Context *context, GLfloat c)
+{
+ return true;
+}
+
+bool ValidateIndexfv(Context *context, const GLfloat *c)
+{
+ return true;
+}
+
+bool ValidateIndexi(Context *context, GLint c)
+{
+ return true;
+}
+
+bool ValidateIndexiv(Context *context, const GLint *c)
+{
+ return true;
+}
+
+bool ValidateIndexs(Context *context, GLshort c)
+{
+ return true;
+}
+
+bool ValidateIndexsv(Context *context, const GLshort *c)
+{
+ return true;
+}
+
+bool ValidateInitNames(Context *context)
+{
+ return true;
+}
+
+bool ValidateIsList(Context *context, GLuint list)
+{
+ return true;
+}
+
+bool ValidateLightModeli(Context *context, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidateLightModeliv(Context *context, GLenum pname, const GLint *params)
+{
+ return true;
+}
+
+bool ValidateLighti(Context *context, GLenum light, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidateLightiv(Context *context, GLenum light, GLenum pname, const GLint *params)
+{
+ return true;
+}
+
+bool ValidateLineStipple(Context *context, GLint factor, GLushort pattern)
+{
+ return true;
+}
+
+bool ValidateListBase(Context *context, GLuint base)
+{
+ return true;
+}
+
+bool ValidateLoadMatrixd(Context *context, const GLdouble *m)
+{
+ return true;
+}
+
+bool ValidateLoadName(Context *context, GLuint name)
+{
+ return true;
+}
+
+bool ValidateMap1d(Context *context,
+ GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint stride,
+ GLint order,
+ const GLdouble *points)
+{
+ return true;
+}
+
+bool ValidateMap1f(Context *context,
+ GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint stride,
+ GLint order,
+ const GLfloat *points)
+{
+ return true;
+}
+
+bool ValidateMap2d(Context *context,
+ GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint ustride,
+ GLint uorder,
+ GLdouble v1,
+ GLdouble v2,
+ GLint vstride,
+ GLint vorder,
+ const GLdouble *points)
+{
+ return true;
+}
+
+bool ValidateMap2f(Context *context,
+ GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint ustride,
+ GLint uorder,
+ GLfloat v1,
+ GLfloat v2,
+ GLint vstride,
+ GLint vorder,
+ const GLfloat *points)
+{
+ return true;
+}
+
+bool ValidateMapGrid1d(Context *context, GLint un, GLdouble u1, GLdouble u2)
+{
+ return true;
+}
+
+bool ValidateMapGrid1f(Context *context, GLint un, GLfloat u1, GLfloat u2)
+{
+ return true;
+}
+
+bool ValidateMapGrid2d(Context *context,
+ GLint un,
+ GLdouble u1,
+ GLdouble u2,
+ GLint vn,
+ GLdouble v1,
+ GLdouble v2)
+{
+ return true;
+}
+
+bool ValidateMapGrid2f(Context *context,
+ GLint un,
+ GLfloat u1,
+ GLfloat u2,
+ GLint vn,
+ GLfloat v1,
+ GLfloat v2)
+{
+ return true;
+}
+
+bool ValidateMateriali(Context *context, GLenum face, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidateMaterialiv(Context *context, GLenum face, GLenum pname, const GLint *params)
+{
+ return true;
+}
+
+bool ValidateMultMatrixd(Context *context, const GLdouble *m)
+{
+ return true;
+}
+
+bool ValidateNewList(Context *context, GLuint list, GLenum mode)
+{
+ return true;
+}
+
+bool ValidateNormal3b(Context *context, GLbyte nx, GLbyte ny, GLbyte nz)
+{
+ return true;
+}
+
+bool ValidateNormal3bv(Context *context, const GLbyte *v)
+{
+ return true;
+}
+
+bool ValidateNormal3d(Context *context, GLdouble nx, GLdouble ny, GLdouble nz)
+{
+ return true;
+}
+
+bool ValidateNormal3dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateNormal3fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateNormal3i(Context *context, GLint nx, GLint ny, GLint nz)
+{
+ return true;
+}
+
+bool ValidateNormal3iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateNormal3s(Context *context, GLshort nx, GLshort ny, GLshort nz)
+{
+ return true;
+}
+
+bool ValidateNormal3sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateOrtho(Context *context,
+ GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar)
+{
+ return true;
+}
+
+bool ValidatePassThrough(Context *context, GLfloat token)
+{
+ return true;
+}
+
+bool ValidatePixelMapfv(Context *context, GLenum map, GLsizei mapsize, const GLfloat *values)
+{
+ return true;
+}
+
+bool ValidatePixelMapuiv(Context *context, GLenum map, GLsizei mapsize, const GLuint *values)
+{
+ return true;
+}
+
+bool ValidatePixelMapusv(Context *context, GLenum map, GLsizei mapsize, const GLushort *values)
+{
+ return true;
+}
+
+bool ValidatePixelStoref(Context *context, GLenum pname, GLfloat param)
+{
+ return true;
+}
+
+bool ValidatePixelTransferf(Context *context, GLenum pname, GLfloat param)
+{
+ return true;
+}
+
+bool ValidatePixelTransferi(Context *context, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidatePixelZoom(Context *context, GLfloat xfactor, GLfloat yfactor)
+{
+ return true;
+}
+
+bool ValidatePolygonMode(Context *context, GLenum face, GLenum mode)
+{
+ return true;
+}
+
+bool ValidatePolygonStipple(Context *context, const GLubyte *mask)
+{
+ return true;
+}
+
+bool ValidatePopAttrib(Context *context)
+{
+ return true;
+}
+
+bool ValidatePopName(Context *context)
+{
+ return true;
+}
+
+bool ValidatePushAttrib(Context *context, GLbitfield mask)
+{
+ return true;
+}
+
+bool ValidatePushName(Context *context, GLuint name)
+{
+ return true;
+}
+
+bool ValidateRasterPos2d(Context *context, GLdouble x, GLdouble y)
+{
+ return true;
+}
+
+bool ValidateRasterPos2dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos2f(Context *context, GLfloat x, GLfloat y)
+{
+ return true;
+}
+
+bool ValidateRasterPos2fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos2i(Context *context, GLint x, GLint y)
+{
+ return true;
+}
+
+bool ValidateRasterPos2iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos2s(Context *context, GLshort x, GLshort y)
+{
+ return true;
+}
+
+bool ValidateRasterPos2sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos3d(Context *context, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateRasterPos3dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos3f(Context *context, GLfloat x, GLfloat y, GLfloat z)
+{
+ return true;
+}
+
+bool ValidateRasterPos3fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos3i(Context *context, GLint x, GLint y, GLint z)
+{
+ return true;
+}
+
+bool ValidateRasterPos3iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos3s(Context *context, GLshort x, GLshort y, GLshort z)
+{
+ return true;
+}
+
+bool ValidateRasterPos3sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos4d(Context *context, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ return true;
+}
+
+bool ValidateRasterPos4dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos4f(Context *context, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ return true;
+}
+
+bool ValidateRasterPos4fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos4i(Context *context, GLint x, GLint y, GLint z, GLint w)
+{
+ return true;
+}
+
+bool ValidateRasterPos4iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateRasterPos4s(Context *context, GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ return true;
+}
+
+bool ValidateRasterPos4sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateRectd(Context *context, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
+{
+ return true;
+}
+
+bool ValidateRectdv(Context *context, const GLdouble *v1, const GLdouble *v2)
+{
+ return true;
+}
+
+bool ValidateRectf(Context *context, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
+{
+ return true;
+}
+
+bool ValidateRectfv(Context *context, const GLfloat *v1, const GLfloat *v2)
+{
+ return true;
+}
+
+bool ValidateRecti(Context *context, GLint x1, GLint y1, GLint x2, GLint y2)
+{
+ return true;
+}
+
+bool ValidateRectiv(Context *context, const GLint *v1, const GLint *v2)
+{
+ return true;
+}
+
+bool ValidateRects(Context *context, GLshort x1, GLshort y1, GLshort x2, GLshort y2)
+{
+ return true;
+}
+
+bool ValidateRectsv(Context *context, const GLshort *v1, const GLshort *v2)
+{
+ return true;
+}
+
+bool ValidateRenderMode(Context *context, GLenum mode)
+{
+ return true;
+}
+
+bool ValidateRotated(Context *context, GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateScaled(Context *context, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateSelectBuffer(Context *context, GLsizei size, GLuint *buffer)
+{
+ return true;
+}
+
+bool ValidateTexCoord1d(Context *context, GLdouble s)
+{
+ return true;
+}
+
+bool ValidateTexCoord1dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord1f(Context *context, GLfloat s)
+{
+ return true;
+}
+
+bool ValidateTexCoord1fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord1i(Context *context, GLint s)
+{
+ return true;
+}
+
+bool ValidateTexCoord1iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord1s(Context *context, GLshort s)
+{
+ return true;
+}
+
+bool ValidateTexCoord1sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord2d(Context *context, GLdouble s, GLdouble t)
+{
+ return true;
+}
+
+bool ValidateTexCoord2dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord2f(Context *context, GLfloat s, GLfloat t)
+{
+ return true;
+}
+
+bool ValidateTexCoord2fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord2i(Context *context, GLint s, GLint t)
+{
+ return true;
+}
+
+bool ValidateTexCoord2iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord2s(Context *context, GLshort s, GLshort t)
+{
+ return true;
+}
+
+bool ValidateTexCoord2sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord3d(Context *context, GLdouble s, GLdouble t, GLdouble r)
+{
+ return true;
+}
+
+bool ValidateTexCoord3dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord3f(Context *context, GLfloat s, GLfloat t, GLfloat r)
+{
+ return true;
+}
+
+bool ValidateTexCoord3fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord3i(Context *context, GLint s, GLint t, GLint r)
+{
+ return true;
+}
+
+bool ValidateTexCoord3iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord3s(Context *context, GLshort s, GLshort t, GLshort r)
+{
+ return true;
+}
+
+bool ValidateTexCoord3sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord4d(Context *context, GLdouble s, GLdouble t, GLdouble r, GLdouble q)
+{
+ return true;
+}
+
+bool ValidateTexCoord4dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord4f(Context *context, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ return true;
+}
+
+bool ValidateTexCoord4fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord4i(Context *context, GLint s, GLint t, GLint r, GLint q)
+{
+ return true;
+}
+
+bool ValidateTexCoord4iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateTexCoord4s(Context *context, GLshort s, GLshort t, GLshort r, GLshort q)
+{
+ return true;
+}
+
+bool ValidateTexCoord4sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateTexGend(Context *context, GLenum coord, GLenum pname, GLdouble param)
+{
+ return true;
+}
+
+bool ValidateTexGendv(Context *context, GLenum coord, GLenum pname, const GLdouble *params)
+{
+ return true;
+}
+
+bool ValidateTexGenf(Context *context, GLenum coord, GLenum pname, GLfloat param)
+{
+ return true;
+}
+bool ValidateTexGenfv(Context *context, GLenum coord, GLenum pname, const GLfloat *params)
+{
+ return true;
+}
+
+bool ValidateTexGeni(Context *context, GLenum coord, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidateTexGeniv(Context *context, GLenum coord, GLenum pname, const GLint *params)
+{
+ return true;
+}
+
+bool ValidateTexImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return true;
+}
+
+bool ValidateTranslated(Context *context, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateVertex2d(Context *context, GLdouble x, GLdouble y)
+{
+ return true;
+}
+
+bool ValidateVertex2dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertex2f(Context *context, GLfloat x, GLfloat y)
+{
+ return true;
+}
+
+bool ValidateVertex2fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateVertex2i(Context *context, GLint x, GLint y)
+{
+ return true;
+}
+
+bool ValidateVertex2iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertex2s(Context *context, GLshort x, GLshort y)
+{
+ return true;
+}
+
+bool ValidateVertex2sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertex3d(Context *context, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateVertex3dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertex3f(Context *context, GLfloat x, GLfloat y, GLfloat z)
+{
+ return true;
+}
+
+bool ValidateVertex3fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateVertex3i(Context *context, GLint x, GLint y, GLint z)
+{
+ return true;
+}
+
+bool ValidateVertex3iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertex3s(Context *context, GLshort x, GLshort y, GLshort z)
+{
+ return true;
+}
+
+bool ValidateVertex3sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertex4d(Context *context, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+ return true;
+}
+
+bool ValidateVertex4dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertex4f(Context *context, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ return true;
+}
+
+bool ValidateVertex4fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateVertex4i(Context *context, GLint x, GLint y, GLint z, GLint w)
+{
+ return true;
+}
+
+bool ValidateVertex4iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertex4s(Context *context, GLshort x, GLshort y, GLshort z, GLshort w)
+{
+ return true;
+}
+
+bool ValidateVertex4sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL11.cpp b/gfx/angle/checkout/src/libANGLE/validationGL11.cpp
new file mode 100644
index 0000000000..f4226f1a5b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL11.cpp
@@ -0,0 +1,105 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL11.cpp: Validation functions for OpenGL 1.1 entry point parameters
+
+#include "libANGLE/validationGL11_autogen.h"
+
+namespace gl
+{
+
+bool ValidateAreTexturesResident(Context *context,
+ GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences)
+{
+ return true;
+}
+
+bool ValidateArrayElement(Context *context, GLint i)
+{
+ return true;
+}
+
+bool ValidateCopyTexImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLint border)
+{
+ return true;
+}
+
+bool ValidateCopyTexSubImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ return true;
+}
+
+bool ValidateEdgeFlagPointer(Context *context, GLsizei stride, const void *pointer)
+{
+ return true;
+}
+
+bool ValidateIndexPointer(Context *context, GLenum type, GLsizei stride, const void *pointer)
+{
+ return true;
+}
+
+bool ValidateIndexub(Context *context, GLubyte c)
+{
+ return true;
+}
+
+bool ValidateIndexubv(Context *context, const GLubyte *c)
+{
+ return true;
+}
+
+bool ValidateInterleavedArrays(Context *context, GLenum format, GLsizei stride, const void *pointer)
+{
+ return true;
+}
+
+bool ValidatePopClientAttrib(Context *context)
+{
+ return true;
+}
+
+bool ValidatePrioritizeTextures(Context *context,
+ GLsizei n,
+ const GLuint *textures,
+ const GLfloat *priorities)
+{
+ return true;
+}
+
+bool ValidatePushClientAttrib(Context *context, GLbitfield mask)
+{
+ return true;
+}
+
+bool ValidateTexSubImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL11_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL11_autogen.h
new file mode 100644
index 0000000000..5d5309f528
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL11_autogen.h
@@ -0,0 +1,64 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL11_autogen.h:
+// Validation functions for the OpenGL 1.1 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL11_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL11_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateAreTexturesResident(Context *context,
+ GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences);
+bool ValidateArrayElement(Context *context, GLint i);
+bool ValidateCopyTexImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLint border);
+bool ValidateCopyTexSubImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width);
+bool ValidateEdgeFlagPointer(Context *context, GLsizei stride, const void *pointer);
+bool ValidateIndexPointer(Context *context, GLenum type, GLsizei stride, const void *pointer);
+bool ValidateIndexub(Context *context, GLubyte c);
+bool ValidateIndexubv(Context *context, const GLubyte *c);
+bool ValidateInterleavedArrays(Context *context,
+ GLenum format,
+ GLsizei stride,
+ const void *pointer);
+bool ValidatePopClientAttrib(Context *context);
+bool ValidatePrioritizeTextures(Context *context,
+ GLsizei n,
+ const GLuint *textures,
+ const GLfloat *priorities);
+bool ValidatePushClientAttrib(Context *context, GLbitfield mask);
+bool ValidateTexSubImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL11_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL12.cpp b/gfx/angle/checkout/src/libANGLE/validationGL12.cpp
new file mode 100644
index 0000000000..7c94ddb682
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL12.cpp
@@ -0,0 +1,12 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL12.cpp: Validation functions for OpenGL 1.2 entry point parameters
+
+#include "libANGLE/validationGL12_autogen.h"
+
+namespace gl
+{} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL12_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL12_autogen.h
new file mode 100644
index 0000000000..3d32e1b8af
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL12_autogen.h
@@ -0,0 +1,22 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL12_autogen.h:
+// Validation functions for the OpenGL 1.2 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL12_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL12_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL12_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL13.cpp b/gfx/angle/checkout/src/libANGLE/validationGL13.cpp
new file mode 100644
index 0000000000..6db60234e0
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL13.cpp
@@ -0,0 +1,228 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL13.cpp: Validation functions for OpenGL 1.3 entry point parameters
+
+#include "libANGLE/validationGL13_autogen.h"
+
+namespace gl
+{
+
+bool ValidateCompressedTexImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateCompressedTexSubImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateGetCompressedTexImage(Context *context, GLenum target, GLint level, void *img)
+{
+ return true;
+}
+
+bool ValidateLoadTransposeMatrixd(Context *context, const GLdouble *m)
+{
+ return true;
+}
+
+bool ValidateLoadTransposeMatrixf(Context *context, const GLfloat *m)
+{
+ return true;
+}
+
+bool ValidateMultTransposeMatrixd(Context *context, const GLdouble *m)
+{
+ return true;
+}
+
+bool ValidateMultTransposeMatrixf(Context *context, const GLfloat *m)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1d(Context *context, GLenum target, GLdouble s)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1dv(Context *context, GLenum target, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1f(Context *context, GLenum target, GLfloat s)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1fv(Context *context, GLenum target, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1i(Context *context, GLenum target, GLint s)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1iv(Context *context, GLenum target, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1s(Context *context, GLenum target, GLshort s)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord1sv(Context *context, GLenum target, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2d(Context *context, GLenum target, GLdouble s, GLdouble t)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2dv(Context *context, GLenum target, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2f(Context *context, GLenum target, GLfloat s, GLfloat t)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2fv(Context *context, GLenum target, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2i(Context *context, GLenum target, GLint s, GLint t)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2iv(Context *context, GLenum target, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2s(Context *context, GLenum target, GLshort s, GLshort t)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord2sv(Context *context, GLenum target, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3d(Context *context, GLenum target, GLdouble s, GLdouble t, GLdouble r)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3dv(Context *context, GLenum target, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3f(Context *context, GLenum target, GLfloat s, GLfloat t, GLfloat r)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3fv(Context *context, GLenum target, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3i(Context *context, GLenum target, GLint s, GLint t, GLint r)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3iv(Context *context, GLenum target, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3s(Context *context, GLenum target, GLshort s, GLshort t, GLshort r)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord3sv(Context *context, GLenum target, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord4d(Context *context,
+ GLenum target,
+ GLdouble s,
+ GLdouble t,
+ GLdouble r,
+ GLdouble q)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord4dv(Context *context, GLenum target, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord4fv(Context *context, GLenum target, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord4i(Context *context, GLenum target, GLint s, GLint t, GLint r, GLint q)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord4iv(Context *context, GLenum target, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord4s(Context *context,
+ GLenum target,
+ GLshort s,
+ GLshort t,
+ GLshort r,
+ GLshort q)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoord4sv(Context *context, GLenum target, const GLshort *v)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL13_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL13_autogen.h
new file mode 100644
index 0000000000..0e12b68e31
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL13_autogen.h
@@ -0,0 +1,84 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL13_autogen.h:
+// Validation functions for the OpenGL 1.3 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL13_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL13_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateCompressedTexImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCompressedTexSubImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateGetCompressedTexImage(Context *context, GLenum target, GLint level, void *img);
+bool ValidateLoadTransposeMatrixd(Context *context, const GLdouble *m);
+bool ValidateLoadTransposeMatrixf(Context *context, const GLfloat *m);
+bool ValidateMultTransposeMatrixd(Context *context, const GLdouble *m);
+bool ValidateMultTransposeMatrixf(Context *context, const GLfloat *m);
+bool ValidateMultiTexCoord1d(Context *context, GLenum target, GLdouble s);
+bool ValidateMultiTexCoord1dv(Context *context, GLenum target, const GLdouble *v);
+bool ValidateMultiTexCoord1f(Context *context, GLenum target, GLfloat s);
+bool ValidateMultiTexCoord1fv(Context *context, GLenum target, const GLfloat *v);
+bool ValidateMultiTexCoord1i(Context *context, GLenum target, GLint s);
+bool ValidateMultiTexCoord1iv(Context *context, GLenum target, const GLint *v);
+bool ValidateMultiTexCoord1s(Context *context, GLenum target, GLshort s);
+bool ValidateMultiTexCoord1sv(Context *context, GLenum target, const GLshort *v);
+bool ValidateMultiTexCoord2d(Context *context, GLenum target, GLdouble s, GLdouble t);
+bool ValidateMultiTexCoord2dv(Context *context, GLenum target, const GLdouble *v);
+bool ValidateMultiTexCoord2f(Context *context, GLenum target, GLfloat s, GLfloat t);
+bool ValidateMultiTexCoord2fv(Context *context, GLenum target, const GLfloat *v);
+bool ValidateMultiTexCoord2i(Context *context, GLenum target, GLint s, GLint t);
+bool ValidateMultiTexCoord2iv(Context *context, GLenum target, const GLint *v);
+bool ValidateMultiTexCoord2s(Context *context, GLenum target, GLshort s, GLshort t);
+bool ValidateMultiTexCoord2sv(Context *context, GLenum target, const GLshort *v);
+bool ValidateMultiTexCoord3d(Context *context, GLenum target, GLdouble s, GLdouble t, GLdouble r);
+bool ValidateMultiTexCoord3dv(Context *context, GLenum target, const GLdouble *v);
+bool ValidateMultiTexCoord3f(Context *context, GLenum target, GLfloat s, GLfloat t, GLfloat r);
+bool ValidateMultiTexCoord3fv(Context *context, GLenum target, const GLfloat *v);
+bool ValidateMultiTexCoord3i(Context *context, GLenum target, GLint s, GLint t, GLint r);
+bool ValidateMultiTexCoord3iv(Context *context, GLenum target, const GLint *v);
+bool ValidateMultiTexCoord3s(Context *context, GLenum target, GLshort s, GLshort t, GLshort r);
+bool ValidateMultiTexCoord3sv(Context *context, GLenum target, const GLshort *v);
+bool ValidateMultiTexCoord4d(Context *context,
+ GLenum target,
+ GLdouble s,
+ GLdouble t,
+ GLdouble r,
+ GLdouble q);
+bool ValidateMultiTexCoord4dv(Context *context, GLenum target, const GLdouble *v);
+bool ValidateMultiTexCoord4fv(Context *context, GLenum target, const GLfloat *v);
+bool ValidateMultiTexCoord4i(Context *context, GLenum target, GLint s, GLint t, GLint r, GLint q);
+bool ValidateMultiTexCoord4iv(Context *context, GLenum target, const GLint *v);
+bool ValidateMultiTexCoord4s(Context *context,
+ GLenum target,
+ GLshort s,
+ GLshort t,
+ GLshort r,
+ GLshort q);
+bool ValidateMultiTexCoord4sv(Context *context, GLenum target, const GLshort *v);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL13_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL14.cpp b/gfx/angle/checkout/src/libANGLE/validationGL14.cpp
new file mode 100644
index 0000000000..bf12576a71
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL14.cpp
@@ -0,0 +1,237 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL14.cpp: Validation functions for OpenGL 1.4 entry point parameters
+
+#include "libANGLE/validationGL14_autogen.h"
+
+namespace gl
+{
+
+bool ValidateFogCoordPointer(Context *context, GLenum type, GLsizei stride, const void *pointer)
+{
+ return true;
+}
+
+bool ValidateFogCoordd(Context *context, GLdouble coord)
+{
+ return true;
+}
+
+bool ValidateFogCoorddv(Context *context, const GLdouble *coord)
+{
+ return true;
+}
+
+bool ValidateFogCoordf(Context *context, GLfloat coord)
+{
+ return true;
+}
+
+bool ValidateFogCoordfv(Context *context, const GLfloat *coord)
+{
+ return true;
+}
+
+bool ValidateMultiDrawArrays(Context *context,
+ PrimitiveMode modePacked,
+ const GLint *first,
+ const GLsizei *count,
+ GLsizei drawcount)
+{
+ return true;
+}
+
+bool ValidateMultiDrawElements(Context *context,
+ PrimitiveMode modePacked,
+ const GLsizei *count,
+ DrawElementsType typePacked,
+ const void *const *indices,
+ GLsizei drawcount)
+{
+ return true;
+}
+
+bool ValidatePointParameteri(Context *context, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidatePointParameteriv(Context *context, GLenum pname, const GLint *params)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3b(Context *context, GLbyte red, GLbyte green, GLbyte blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3bv(Context *context, const GLbyte *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3d(Context *context, GLdouble red, GLdouble green, GLdouble blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3f(Context *context, GLfloat red, GLfloat green, GLfloat blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3i(Context *context, GLint red, GLint green, GLint blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3s(Context *context, GLshort red, GLshort green, GLshort blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3ub(Context *context, GLubyte red, GLubyte green, GLubyte blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3ubv(Context *context, const GLubyte *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3ui(Context *context, GLuint red, GLuint green, GLuint blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3uiv(Context *context, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3us(Context *context, GLushort red, GLushort green, GLushort blue)
+{
+ return true;
+}
+
+bool ValidateSecondaryColor3usv(Context *context, const GLushort *v)
+{
+ return true;
+}
+
+bool ValidateSecondaryColorPointer(Context *context,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return true;
+}
+
+bool ValidateWindowPos2d(Context *context, GLdouble x, GLdouble y)
+{
+ return true;
+}
+
+bool ValidateWindowPos2dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateWindowPos2f(Context *context, GLfloat x, GLfloat y)
+{
+ return true;
+}
+
+bool ValidateWindowPos2fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateWindowPos2i(Context *context, GLint x, GLint y)
+{
+ return true;
+}
+
+bool ValidateWindowPos2iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateWindowPos2s(Context *context, GLshort x, GLshort y)
+{
+ return true;
+}
+
+bool ValidateWindowPos2sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateWindowPos3d(Context *context, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateWindowPos3dv(Context *context, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateWindowPos3f(Context *context, GLfloat x, GLfloat y, GLfloat z)
+{
+ return true;
+}
+
+bool ValidateWindowPos3fv(Context *context, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateWindowPos3i(Context *context, GLint x, GLint y, GLint z)
+{
+ return true;
+}
+
+bool ValidateWindowPos3iv(Context *context, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateWindowPos3s(Context *context, GLshort x, GLshort y, GLshort z)
+{
+ return true;
+}
+
+bool ValidateWindowPos3sv(Context *context, const GLshort *v)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL14_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL14_autogen.h
new file mode 100644
index 0000000000..a012d0d83e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL14_autogen.h
@@ -0,0 +1,77 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL14_autogen.h:
+// Validation functions for the OpenGL 1.4 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL14_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL14_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateFogCoordPointer(Context *context, GLenum type, GLsizei stride, const void *pointer);
+bool ValidateFogCoordd(Context *context, GLdouble coord);
+bool ValidateFogCoorddv(Context *context, const GLdouble *coord);
+bool ValidateFogCoordf(Context *context, GLfloat coord);
+bool ValidateFogCoordfv(Context *context, const GLfloat *coord);
+bool ValidateMultiDrawArrays(Context *context,
+ PrimitiveMode modePacked,
+ const GLint *first,
+ const GLsizei *count,
+ GLsizei drawcount);
+bool ValidateMultiDrawElements(Context *context,
+ PrimitiveMode modePacked,
+ const GLsizei *count,
+ DrawElementsType typePacked,
+ const void *const *indices,
+ GLsizei drawcount);
+bool ValidatePointParameteri(Context *context, GLenum pname, GLint param);
+bool ValidatePointParameteriv(Context *context, GLenum pname, const GLint *params);
+bool ValidateSecondaryColor3b(Context *context, GLbyte red, GLbyte green, GLbyte blue);
+bool ValidateSecondaryColor3bv(Context *context, const GLbyte *v);
+bool ValidateSecondaryColor3d(Context *context, GLdouble red, GLdouble green, GLdouble blue);
+bool ValidateSecondaryColor3dv(Context *context, const GLdouble *v);
+bool ValidateSecondaryColor3f(Context *context, GLfloat red, GLfloat green, GLfloat blue);
+bool ValidateSecondaryColor3fv(Context *context, const GLfloat *v);
+bool ValidateSecondaryColor3i(Context *context, GLint red, GLint green, GLint blue);
+bool ValidateSecondaryColor3iv(Context *context, const GLint *v);
+bool ValidateSecondaryColor3s(Context *context, GLshort red, GLshort green, GLshort blue);
+bool ValidateSecondaryColor3sv(Context *context, const GLshort *v);
+bool ValidateSecondaryColor3ub(Context *context, GLubyte red, GLubyte green, GLubyte blue);
+bool ValidateSecondaryColor3ubv(Context *context, const GLubyte *v);
+bool ValidateSecondaryColor3ui(Context *context, GLuint red, GLuint green, GLuint blue);
+bool ValidateSecondaryColor3uiv(Context *context, const GLuint *v);
+bool ValidateSecondaryColor3us(Context *context, GLushort red, GLushort green, GLushort blue);
+bool ValidateSecondaryColor3usv(Context *context, const GLushort *v);
+bool ValidateSecondaryColorPointer(Context *context,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateWindowPos2d(Context *context, GLdouble x, GLdouble y);
+bool ValidateWindowPos2dv(Context *context, const GLdouble *v);
+bool ValidateWindowPos2f(Context *context, GLfloat x, GLfloat y);
+bool ValidateWindowPos2fv(Context *context, const GLfloat *v);
+bool ValidateWindowPos2i(Context *context, GLint x, GLint y);
+bool ValidateWindowPos2iv(Context *context, const GLint *v);
+bool ValidateWindowPos2s(Context *context, GLshort x, GLshort y);
+bool ValidateWindowPos2sv(Context *context, const GLshort *v);
+bool ValidateWindowPos3d(Context *context, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateWindowPos3dv(Context *context, const GLdouble *v);
+bool ValidateWindowPos3f(Context *context, GLfloat x, GLfloat y, GLfloat z);
+bool ValidateWindowPos3fv(Context *context, const GLfloat *v);
+bool ValidateWindowPos3i(Context *context, GLint x, GLint y, GLint z);
+bool ValidateWindowPos3iv(Context *context, const GLint *v);
+bool ValidateWindowPos3s(Context *context, GLshort x, GLshort y, GLshort z);
+bool ValidateWindowPos3sv(Context *context, const GLshort *v);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL14_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL15.cpp b/gfx/angle/checkout/src/libANGLE/validationGL15.cpp
new file mode 100644
index 0000000000..d754d11fc8
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL15.cpp
@@ -0,0 +1,33 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL15.cpp: Validation functions for OpenGL 1.5 entry point parameters
+
+#include "libANGLE/validationGL15_autogen.h"
+
+namespace gl
+{
+
+bool ValidateGetBufferSubData(Context *context,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ void *data)
+{
+ return true;
+}
+
+bool ValidateGetQueryObjectiv(Context *context, GLuint id, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateMapBuffer(Context *context, BufferBinding targetPacked, GLenum access)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL15_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL15_autogen.h
new file mode 100644
index 0000000000..c7d899ebf2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL15_autogen.h
@@ -0,0 +1,29 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL15_autogen.h:
+// Validation functions for the OpenGL 1.5 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL15_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL15_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateGetBufferSubData(Context *context,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ void *data);
+bool ValidateGetQueryObjectiv(Context *context, GLuint id, GLenum pname, GLint *params);
+bool ValidateMapBuffer(Context *context, BufferBinding targetPacked, GLenum access);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL15_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL1_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL1_autogen.h
new file mode 100644
index 0000000000..07d1397576
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL1_autogen.h
@@ -0,0 +1,348 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL1_autogen.h:
+// Validation functions for the OpenGL 1.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL1_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL1_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateAccum(Context *context, GLenum op, GLfloat value);
+bool ValidateBegin(Context *context, GLenum mode);
+bool ValidateBitmap(Context *context,
+ GLsizei width,
+ GLsizei height,
+ GLfloat xorig,
+ GLfloat yorig,
+ GLfloat xmove,
+ GLfloat ymove,
+ const GLubyte *bitmap);
+bool ValidateCallList(Context *context, GLuint list);
+bool ValidateCallLists(Context *context, GLsizei n, GLenum type, const void *lists);
+bool ValidateClearAccum(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+bool ValidateClearDepth(Context *context, GLdouble depth);
+bool ValidateClearIndex(Context *context, GLfloat c);
+bool ValidateClipPlane(Context *context, GLenum plane, const GLdouble *equation);
+bool ValidateColor3b(Context *context, GLbyte red, GLbyte green, GLbyte blue);
+bool ValidateColor3bv(Context *context, const GLbyte *v);
+bool ValidateColor3d(Context *context, GLdouble red, GLdouble green, GLdouble blue);
+bool ValidateColor3dv(Context *context, const GLdouble *v);
+bool ValidateColor3f(Context *context, GLfloat red, GLfloat green, GLfloat blue);
+bool ValidateColor3fv(Context *context, const GLfloat *v);
+bool ValidateColor3i(Context *context, GLint red, GLint green, GLint blue);
+bool ValidateColor3iv(Context *context, const GLint *v);
+bool ValidateColor3s(Context *context, GLshort red, GLshort green, GLshort blue);
+bool ValidateColor3sv(Context *context, const GLshort *v);
+bool ValidateColor3ub(Context *context, GLubyte red, GLubyte green, GLubyte blue);
+bool ValidateColor3ubv(Context *context, const GLubyte *v);
+bool ValidateColor3ui(Context *context, GLuint red, GLuint green, GLuint blue);
+bool ValidateColor3uiv(Context *context, const GLuint *v);
+bool ValidateColor3us(Context *context, GLushort red, GLushort green, GLushort blue);
+bool ValidateColor3usv(Context *context, const GLushort *v);
+bool ValidateColor4b(Context *context, GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
+bool ValidateColor4bv(Context *context, const GLbyte *v);
+bool ValidateColor4d(Context *context, GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
+bool ValidateColor4dv(Context *context, const GLdouble *v);
+bool ValidateColor4fv(Context *context, const GLfloat *v);
+bool ValidateColor4i(Context *context, GLint red, GLint green, GLint blue, GLint alpha);
+bool ValidateColor4iv(Context *context, const GLint *v);
+bool ValidateColor4s(Context *context, GLshort red, GLshort green, GLshort blue, GLshort alpha);
+bool ValidateColor4sv(Context *context, const GLshort *v);
+bool ValidateColor4ubv(Context *context, const GLubyte *v);
+bool ValidateColor4ui(Context *context, GLuint red, GLuint green, GLuint blue, GLuint alpha);
+bool ValidateColor4uiv(Context *context, const GLuint *v);
+bool ValidateColor4us(Context *context,
+ GLushort red,
+ GLushort green,
+ GLushort blue,
+ GLushort alpha);
+bool ValidateColor4usv(Context *context, const GLushort *v);
+bool ValidateColorMaterial(Context *context, GLenum face, GLenum mode);
+bool ValidateCopyPixels(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum type);
+bool ValidateDeleteLists(Context *context, GLuint list, GLsizei range);
+bool ValidateDepthRange(Context *context, GLdouble n, GLdouble f);
+bool ValidateDrawBuffer(Context *context, GLenum buf);
+bool ValidateDrawPixels(Context *context,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateEdgeFlag(Context *context, GLboolean flag);
+bool ValidateEdgeFlagv(Context *context, const GLboolean *flag);
+bool ValidateEnd(Context *context);
+bool ValidateEndList(Context *context);
+bool ValidateEvalCoord1d(Context *context, GLdouble u);
+bool ValidateEvalCoord1dv(Context *context, const GLdouble *u);
+bool ValidateEvalCoord1f(Context *context, GLfloat u);
+bool ValidateEvalCoord1fv(Context *context, const GLfloat *u);
+bool ValidateEvalCoord2d(Context *context, GLdouble u, GLdouble v);
+bool ValidateEvalCoord2dv(Context *context, const GLdouble *u);
+bool ValidateEvalCoord2f(Context *context, GLfloat u, GLfloat v);
+bool ValidateEvalCoord2fv(Context *context, const GLfloat *u);
+bool ValidateEvalMesh1(Context *context, GLenum mode, GLint i1, GLint i2);
+bool ValidateEvalMesh2(Context *context, GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
+bool ValidateEvalPoint1(Context *context, GLint i);
+bool ValidateEvalPoint2(Context *context, GLint i, GLint j);
+bool ValidateFeedbackBuffer(Context *context, GLsizei size, GLenum type, GLfloat *buffer);
+bool ValidateFogi(Context *context, GLenum pname, GLint param);
+bool ValidateFogiv(Context *context, GLenum pname, const GLint *params);
+bool ValidateFrustum(Context *context,
+ GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar);
+bool ValidateGenLists(Context *context, GLsizei range);
+bool ValidateGetClipPlane(Context *context, GLenum plane, GLdouble *equation);
+bool ValidateGetDoublev(Context *context, GLenum pname, GLdouble *data);
+bool ValidateGetLightiv(Context *context, GLenum light, GLenum pname, GLint *params);
+bool ValidateGetMapdv(Context *context, GLenum target, GLenum query, GLdouble *v);
+bool ValidateGetMapfv(Context *context, GLenum target, GLenum query, GLfloat *v);
+bool ValidateGetMapiv(Context *context, GLenum target, GLenum query, GLint *v);
+bool ValidateGetMaterialiv(Context *context, GLenum face, GLenum pname, GLint *params);
+bool ValidateGetPixelMapfv(Context *context, GLenum map, GLfloat *values);
+bool ValidateGetPixelMapuiv(Context *context, GLenum map, GLuint *values);
+bool ValidateGetPixelMapusv(Context *context, GLenum map, GLushort *values);
+bool ValidateGetPolygonStipple(Context *context, GLubyte *mask);
+bool ValidateGetTexGendv(Context *context, GLenum coord, GLenum pname, GLdouble *params);
+bool ValidateGetTexGenfv(Context *context, GLenum coord, GLenum pname, GLfloat *params);
+bool ValidateGetTexGeniv(Context *context, GLenum coord, GLenum pname, GLint *params);
+bool ValidateGetTexImage(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ void *pixels);
+bool ValidateIndexMask(Context *context, GLuint mask);
+bool ValidateIndexd(Context *context, GLdouble c);
+bool ValidateIndexdv(Context *context, const GLdouble *c);
+bool ValidateIndexf(Context *context, GLfloat c);
+bool ValidateIndexfv(Context *context, const GLfloat *c);
+bool ValidateIndexi(Context *context, GLint c);
+bool ValidateIndexiv(Context *context, const GLint *c);
+bool ValidateIndexs(Context *context, GLshort c);
+bool ValidateIndexsv(Context *context, const GLshort *c);
+bool ValidateInitNames(Context *context);
+bool ValidateIsList(Context *context, GLuint list);
+bool ValidateLightModeli(Context *context, GLenum pname, GLint param);
+bool ValidateLightModeliv(Context *context, GLenum pname, const GLint *params);
+bool ValidateLighti(Context *context, GLenum light, GLenum pname, GLint param);
+bool ValidateLightiv(Context *context, GLenum light, GLenum pname, const GLint *params);
+bool ValidateLineStipple(Context *context, GLint factor, GLushort pattern);
+bool ValidateListBase(Context *context, GLuint base);
+bool ValidateLoadMatrixd(Context *context, const GLdouble *m);
+bool ValidateLoadName(Context *context, GLuint name);
+bool ValidateMap1d(Context *context,
+ GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint stride,
+ GLint order,
+ const GLdouble *points);
+bool ValidateMap1f(Context *context,
+ GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint stride,
+ GLint order,
+ const GLfloat *points);
+bool ValidateMap2d(Context *context,
+ GLenum target,
+ GLdouble u1,
+ GLdouble u2,
+ GLint ustride,
+ GLint uorder,
+ GLdouble v1,
+ GLdouble v2,
+ GLint vstride,
+ GLint vorder,
+ const GLdouble *points);
+bool ValidateMap2f(Context *context,
+ GLenum target,
+ GLfloat u1,
+ GLfloat u2,
+ GLint ustride,
+ GLint uorder,
+ GLfloat v1,
+ GLfloat v2,
+ GLint vstride,
+ GLint vorder,
+ const GLfloat *points);
+bool ValidateMapGrid1d(Context *context, GLint un, GLdouble u1, GLdouble u2);
+bool ValidateMapGrid1f(Context *context, GLint un, GLfloat u1, GLfloat u2);
+bool ValidateMapGrid2d(Context *context,
+ GLint un,
+ GLdouble u1,
+ GLdouble u2,
+ GLint vn,
+ GLdouble v1,
+ GLdouble v2);
+bool ValidateMapGrid2f(Context *context,
+ GLint un,
+ GLfloat u1,
+ GLfloat u2,
+ GLint vn,
+ GLfloat v1,
+ GLfloat v2);
+bool ValidateMateriali(Context *context, GLenum face, GLenum pname, GLint param);
+bool ValidateMaterialiv(Context *context, GLenum face, GLenum pname, const GLint *params);
+bool ValidateMultMatrixd(Context *context, const GLdouble *m);
+bool ValidateNewList(Context *context, GLuint list, GLenum mode);
+bool ValidateNormal3b(Context *context, GLbyte nx, GLbyte ny, GLbyte nz);
+bool ValidateNormal3bv(Context *context, const GLbyte *v);
+bool ValidateNormal3d(Context *context, GLdouble nx, GLdouble ny, GLdouble nz);
+bool ValidateNormal3dv(Context *context, const GLdouble *v);
+bool ValidateNormal3fv(Context *context, const GLfloat *v);
+bool ValidateNormal3i(Context *context, GLint nx, GLint ny, GLint nz);
+bool ValidateNormal3iv(Context *context, const GLint *v);
+bool ValidateNormal3s(Context *context, GLshort nx, GLshort ny, GLshort nz);
+bool ValidateNormal3sv(Context *context, const GLshort *v);
+bool ValidateOrtho(Context *context,
+ GLdouble left,
+ GLdouble right,
+ GLdouble bottom,
+ GLdouble top,
+ GLdouble zNear,
+ GLdouble zFar);
+bool ValidatePassThrough(Context *context, GLfloat token);
+bool ValidatePixelMapfv(Context *context, GLenum map, GLsizei mapsize, const GLfloat *values);
+bool ValidatePixelMapuiv(Context *context, GLenum map, GLsizei mapsize, const GLuint *values);
+bool ValidatePixelMapusv(Context *context, GLenum map, GLsizei mapsize, const GLushort *values);
+bool ValidatePixelStoref(Context *context, GLenum pname, GLfloat param);
+bool ValidatePixelTransferf(Context *context, GLenum pname, GLfloat param);
+bool ValidatePixelTransferi(Context *context, GLenum pname, GLint param);
+bool ValidatePixelZoom(Context *context, GLfloat xfactor, GLfloat yfactor);
+bool ValidatePolygonMode(Context *context, GLenum face, GLenum mode);
+bool ValidatePolygonStipple(Context *context, const GLubyte *mask);
+bool ValidatePopAttrib(Context *context);
+bool ValidatePopName(Context *context);
+bool ValidatePushAttrib(Context *context, GLbitfield mask);
+bool ValidatePushName(Context *context, GLuint name);
+bool ValidateRasterPos2d(Context *context, GLdouble x, GLdouble y);
+bool ValidateRasterPos2dv(Context *context, const GLdouble *v);
+bool ValidateRasterPos2f(Context *context, GLfloat x, GLfloat y);
+bool ValidateRasterPos2fv(Context *context, const GLfloat *v);
+bool ValidateRasterPos2i(Context *context, GLint x, GLint y);
+bool ValidateRasterPos2iv(Context *context, const GLint *v);
+bool ValidateRasterPos2s(Context *context, GLshort x, GLshort y);
+bool ValidateRasterPos2sv(Context *context, const GLshort *v);
+bool ValidateRasterPos3d(Context *context, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateRasterPos3dv(Context *context, const GLdouble *v);
+bool ValidateRasterPos3f(Context *context, GLfloat x, GLfloat y, GLfloat z);
+bool ValidateRasterPos3fv(Context *context, const GLfloat *v);
+bool ValidateRasterPos3i(Context *context, GLint x, GLint y, GLint z);
+bool ValidateRasterPos3iv(Context *context, const GLint *v);
+bool ValidateRasterPos3s(Context *context, GLshort x, GLshort y, GLshort z);
+bool ValidateRasterPos3sv(Context *context, const GLshort *v);
+bool ValidateRasterPos4d(Context *context, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+bool ValidateRasterPos4dv(Context *context, const GLdouble *v);
+bool ValidateRasterPos4f(Context *context, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+bool ValidateRasterPos4fv(Context *context, const GLfloat *v);
+bool ValidateRasterPos4i(Context *context, GLint x, GLint y, GLint z, GLint w);
+bool ValidateRasterPos4iv(Context *context, const GLint *v);
+bool ValidateRasterPos4s(Context *context, GLshort x, GLshort y, GLshort z, GLshort w);
+bool ValidateRasterPos4sv(Context *context, const GLshort *v);
+bool ValidateRectd(Context *context, GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
+bool ValidateRectdv(Context *context, const GLdouble *v1, const GLdouble *v2);
+bool ValidateRectf(Context *context, GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+bool ValidateRectfv(Context *context, const GLfloat *v1, const GLfloat *v2);
+bool ValidateRecti(Context *context, GLint x1, GLint y1, GLint x2, GLint y2);
+bool ValidateRectiv(Context *context, const GLint *v1, const GLint *v2);
+bool ValidateRects(Context *context, GLshort x1, GLshort y1, GLshort x2, GLshort y2);
+bool ValidateRectsv(Context *context, const GLshort *v1, const GLshort *v2);
+bool ValidateRenderMode(Context *context, GLenum mode);
+bool ValidateRotated(Context *context, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateScaled(Context *context, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateSelectBuffer(Context *context, GLsizei size, GLuint *buffer);
+bool ValidateTexCoord1d(Context *context, GLdouble s);
+bool ValidateTexCoord1dv(Context *context, const GLdouble *v);
+bool ValidateTexCoord1f(Context *context, GLfloat s);
+bool ValidateTexCoord1fv(Context *context, const GLfloat *v);
+bool ValidateTexCoord1i(Context *context, GLint s);
+bool ValidateTexCoord1iv(Context *context, const GLint *v);
+bool ValidateTexCoord1s(Context *context, GLshort s);
+bool ValidateTexCoord1sv(Context *context, const GLshort *v);
+bool ValidateTexCoord2d(Context *context, GLdouble s, GLdouble t);
+bool ValidateTexCoord2dv(Context *context, const GLdouble *v);
+bool ValidateTexCoord2f(Context *context, GLfloat s, GLfloat t);
+bool ValidateTexCoord2fv(Context *context, const GLfloat *v);
+bool ValidateTexCoord2i(Context *context, GLint s, GLint t);
+bool ValidateTexCoord2iv(Context *context, const GLint *v);
+bool ValidateTexCoord2s(Context *context, GLshort s, GLshort t);
+bool ValidateTexCoord2sv(Context *context, const GLshort *v);
+bool ValidateTexCoord3d(Context *context, GLdouble s, GLdouble t, GLdouble r);
+bool ValidateTexCoord3dv(Context *context, const GLdouble *v);
+bool ValidateTexCoord3f(Context *context, GLfloat s, GLfloat t, GLfloat r);
+bool ValidateTexCoord3fv(Context *context, const GLfloat *v);
+bool ValidateTexCoord3i(Context *context, GLint s, GLint t, GLint r);
+bool ValidateTexCoord3iv(Context *context, const GLint *v);
+bool ValidateTexCoord3s(Context *context, GLshort s, GLshort t, GLshort r);
+bool ValidateTexCoord3sv(Context *context, const GLshort *v);
+bool ValidateTexCoord4d(Context *context, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+bool ValidateTexCoord4dv(Context *context, const GLdouble *v);
+bool ValidateTexCoord4f(Context *context, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+bool ValidateTexCoord4fv(Context *context, const GLfloat *v);
+bool ValidateTexCoord4i(Context *context, GLint s, GLint t, GLint r, GLint q);
+bool ValidateTexCoord4iv(Context *context, const GLint *v);
+bool ValidateTexCoord4s(Context *context, GLshort s, GLshort t, GLshort r, GLshort q);
+bool ValidateTexCoord4sv(Context *context, const GLshort *v);
+bool ValidateTexGend(Context *context, GLenum coord, GLenum pname, GLdouble param);
+bool ValidateTexGendv(Context *context, GLenum coord, GLenum pname, const GLdouble *params);
+bool ValidateTexGenf(Context *context, GLenum coord, GLenum pname, GLfloat param);
+bool ValidateTexGenfv(Context *context, GLenum coord, GLenum pname, const GLfloat *params);
+bool ValidateTexGeni(Context *context, GLenum coord, GLenum pname, GLint param);
+bool ValidateTexGeniv(Context *context, GLenum coord, GLenum pname, const GLint *params);
+bool ValidateTexImage1D(Context *context,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTranslated(Context *context, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateVertex2d(Context *context, GLdouble x, GLdouble y);
+bool ValidateVertex2dv(Context *context, const GLdouble *v);
+bool ValidateVertex2f(Context *context, GLfloat x, GLfloat y);
+bool ValidateVertex2fv(Context *context, const GLfloat *v);
+bool ValidateVertex2i(Context *context, GLint x, GLint y);
+bool ValidateVertex2iv(Context *context, const GLint *v);
+bool ValidateVertex2s(Context *context, GLshort x, GLshort y);
+bool ValidateVertex2sv(Context *context, const GLshort *v);
+bool ValidateVertex3d(Context *context, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateVertex3dv(Context *context, const GLdouble *v);
+bool ValidateVertex3f(Context *context, GLfloat x, GLfloat y, GLfloat z);
+bool ValidateVertex3fv(Context *context, const GLfloat *v);
+bool ValidateVertex3i(Context *context, GLint x, GLint y, GLint z);
+bool ValidateVertex3iv(Context *context, const GLint *v);
+bool ValidateVertex3s(Context *context, GLshort x, GLshort y, GLshort z);
+bool ValidateVertex3sv(Context *context, const GLshort *v);
+bool ValidateVertex4d(Context *context, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+bool ValidateVertex4dv(Context *context, const GLdouble *v);
+bool ValidateVertex4f(Context *context, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+bool ValidateVertex4fv(Context *context, const GLfloat *v);
+bool ValidateVertex4i(Context *context, GLint x, GLint y, GLint z, GLint w);
+bool ValidateVertex4iv(Context *context, const GLint *v);
+bool ValidateVertex4s(Context *context, GLshort x, GLshort y, GLshort z, GLshort w);
+bool ValidateVertex4sv(Context *context, const GLshort *v);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL2.cpp b/gfx/angle/checkout/src/libANGLE/validationGL2.cpp
new file mode 100644
index 0000000000..0b393f169c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL2.cpp
@@ -0,0 +1,174 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL2.cpp: Validation functions for OpenGL 2.0 entry point parameters
+
+#include "libANGLE/validationGL2_autogen.h"
+
+namespace gl
+{
+
+bool ValidateGetVertexAttribdv(Context *context, GLuint index, GLenum pname, GLdouble *params)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib1d(Context *context, GLuint index, GLdouble x)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib1dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib1s(Context *context, GLuint index, GLshort x)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib1sv(Context *context, GLuint index, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib2d(Context *context, GLuint index, GLdouble x, GLdouble y)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib2dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib2s(Context *context, GLuint index, GLshort x, GLshort y)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib2sv(Context *context, GLuint index, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib3d(Context *context, GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib3dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib3s(Context *context, GLuint index, GLshort x, GLshort y, GLshort z)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib3sv(Context *context, GLuint index, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4Nbv(Context *context, GLuint index, const GLbyte *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4Niv(Context *context, GLuint index, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4Nsv(Context *context, GLuint index, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4Nub(Context *context,
+ GLuint index,
+ GLubyte x,
+ GLubyte y,
+ GLubyte z,
+ GLubyte w)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4Nubv(Context *context, GLuint index, const GLubyte *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4Nuiv(Context *context, GLuint index, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4Nusv(Context *context, GLuint index, const GLushort *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4bv(Context *context, GLuint index, const GLbyte *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4d(Context *context,
+ GLuint index,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z,
+ GLdouble w)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4iv(Context *context, GLuint index, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4s(Context *context,
+ GLuint index,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort w)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4sv(Context *context, GLuint index, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4ubv(Context *context, GLuint index, const GLubyte *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4uiv(Context *context, GLuint index, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttrib4usv(Context *context, GLuint index, const GLushort *v)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL21.cpp b/gfx/angle/checkout/src/libANGLE/validationGL21.cpp
new file mode 100644
index 0000000000..9e5532c99c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL21.cpp
@@ -0,0 +1,12 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL21.cpp: Validation functions for OpenGL 2.1 entry point parameters
+
+#include "libANGLE/validationGL21_autogen.h"
+
+namespace gl
+{} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL21_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL21_autogen.h
new file mode 100644
index 0000000000..99661bb5cd
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL21_autogen.h
@@ -0,0 +1,22 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL21_autogen.h:
+// Validation functions for the OpenGL 2.1 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL21_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL21_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL21_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL2_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL2_autogen.h
new file mode 100644
index 0000000000..5ffe3feccb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL2_autogen.h
@@ -0,0 +1,66 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL2_autogen.h:
+// Validation functions for the OpenGL 2.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL2_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL2_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateGetVertexAttribdv(Context *context, GLuint index, GLenum pname, GLdouble *params);
+bool ValidateVertexAttrib1d(Context *context, GLuint index, GLdouble x);
+bool ValidateVertexAttrib1dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttrib1s(Context *context, GLuint index, GLshort x);
+bool ValidateVertexAttrib1sv(Context *context, GLuint index, const GLshort *v);
+bool ValidateVertexAttrib2d(Context *context, GLuint index, GLdouble x, GLdouble y);
+bool ValidateVertexAttrib2dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttrib2s(Context *context, GLuint index, GLshort x, GLshort y);
+bool ValidateVertexAttrib2sv(Context *context, GLuint index, const GLshort *v);
+bool ValidateVertexAttrib3d(Context *context, GLuint index, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateVertexAttrib3dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttrib3s(Context *context, GLuint index, GLshort x, GLshort y, GLshort z);
+bool ValidateVertexAttrib3sv(Context *context, GLuint index, const GLshort *v);
+bool ValidateVertexAttrib4Nbv(Context *context, GLuint index, const GLbyte *v);
+bool ValidateVertexAttrib4Niv(Context *context, GLuint index, const GLint *v);
+bool ValidateVertexAttrib4Nsv(Context *context, GLuint index, const GLshort *v);
+bool ValidateVertexAttrib4Nub(Context *context,
+ GLuint index,
+ GLubyte x,
+ GLubyte y,
+ GLubyte z,
+ GLubyte w);
+bool ValidateVertexAttrib4Nubv(Context *context, GLuint index, const GLubyte *v);
+bool ValidateVertexAttrib4Nuiv(Context *context, GLuint index, const GLuint *v);
+bool ValidateVertexAttrib4Nusv(Context *context, GLuint index, const GLushort *v);
+bool ValidateVertexAttrib4bv(Context *context, GLuint index, const GLbyte *v);
+bool ValidateVertexAttrib4d(Context *context,
+ GLuint index,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z,
+ GLdouble w);
+bool ValidateVertexAttrib4dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttrib4iv(Context *context, GLuint index, const GLint *v);
+bool ValidateVertexAttrib4s(Context *context,
+ GLuint index,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort w);
+bool ValidateVertexAttrib4sv(Context *context, GLuint index, const GLshort *v);
+bool ValidateVertexAttrib4ubv(Context *context, GLuint index, const GLubyte *v);
+bool ValidateVertexAttrib4uiv(Context *context, GLuint index, const GLuint *v);
+bool ValidateVertexAttrib4usv(Context *context, GLuint index, const GLushort *v);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL2_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL3.cpp b/gfx/angle/checkout/src/libANGLE/validationGL3.cpp
new file mode 100644
index 0000000000..8117a3852f
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL3.cpp
@@ -0,0 +1,194 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL3.cpp: Validation functions for OpenGL 3.0 entry point parameters
+
+#include "libANGLE/validationGL3_autogen.h"
+
+namespace gl
+{
+
+bool ValidateBeginConditionalRender(Context *context, GLuint id, GLenum mode)
+{
+ return true;
+}
+
+bool ValidateBindFragDataLocation(Context *context,
+ GLuint program,
+ GLuint color,
+ const GLchar *name)
+{
+ return true;
+}
+
+bool ValidateClampColor(Context *context, GLenum target, GLenum clamp)
+{
+ return true;
+}
+
+bool ValidateColorMaski(Context *context,
+ GLuint index,
+ GLboolean r,
+ GLboolean g,
+ GLboolean b,
+ GLboolean a)
+{
+ return true;
+}
+
+bool ValidateDisablei(Context *context, GLenum target, GLuint index)
+{
+ return true;
+}
+
+bool ValidateEnablei(Context *context, GLenum target, GLuint index)
+{
+ return true;
+}
+
+bool ValidateEndConditionalRender(Context *context)
+{
+ return true;
+}
+
+bool ValidateFramebufferTexture1D(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ return true;
+}
+
+bool ValidateFramebufferTexture3D(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ return true;
+}
+
+bool ValidateGetTexParameterIiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetTexParameterIuiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLuint *params)
+{
+ return true;
+}
+
+bool ValidateIsEnabledi(Context *context, GLenum target, GLuint index)
+{
+ return true;
+}
+
+bool ValidateTexParameterIiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params)
+{
+ return true;
+}
+
+bool ValidateTexParameterIuiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLuint *params)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI1i(Context *context, GLuint index, GLint x)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI1iv(Context *context, GLuint index, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI1ui(Context *context, GLuint index, GLuint x)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI1uiv(Context *context, GLuint index, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI2i(Context *context, GLuint index, GLint x, GLint y)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI2iv(Context *context, GLuint index, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI2ui(Context *context, GLuint index, GLuint x, GLuint y)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI2uiv(Context *context, GLuint index, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI3i(Context *context, GLuint index, GLint x, GLint y, GLint z)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI3iv(Context *context, GLuint index, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI3ui(Context *context, GLuint index, GLuint x, GLuint y, GLuint z)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI3uiv(Context *context, GLuint index, const GLuint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI4bv(Context *context, GLuint index, const GLbyte *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI4sv(Context *context, GLuint index, const GLshort *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI4ubv(Context *context, GLuint index, const GLubyte *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribI4usv(Context *context, GLuint index, const GLushort *v)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL31.cpp b/gfx/angle/checkout/src/libANGLE/validationGL31.cpp
new file mode 100644
index 0000000000..20a0931396
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL31.cpp
@@ -0,0 +1,34 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL31.cpp: Validation functions for OpenGL 3.1 entry point parameters
+
+#include "libANGLE/validationGL31_autogen.h"
+
+namespace gl
+{
+
+bool ValidateGetActiveUniformName(Context *context,
+ GLuint program,
+ GLuint uniformIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformName)
+{
+ return true;
+}
+
+bool ValidatePrimitiveRestartIndex(Context *context, GLuint index)
+{
+ return true;
+}
+
+bool ValidateTexBuffer(Context *context, GLenum target, GLenum internalformat, GLuint buffer)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL31_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL31_autogen.h
new file mode 100644
index 0000000000..e1233805c6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL31_autogen.h
@@ -0,0 +1,30 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL31_autogen.h:
+// Validation functions for the OpenGL 3.1 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL31_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL31_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateGetActiveUniformName(Context *context,
+ GLuint program,
+ GLuint uniformIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformName);
+bool ValidatePrimitiveRestartIndex(Context *context, GLuint index);
+bool ValidateTexBuffer(Context *context, GLenum target, GLenum internalformat, GLuint buffer);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL31_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL32.cpp b/gfx/angle/checkout/src/libANGLE/validationGL32.cpp
new file mode 100644
index 0000000000..fda9e8f904
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL32.cpp
@@ -0,0 +1,95 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL32.cpp: Validation functions for OpenGL 3.2 entry point parameters
+
+#include "libANGLE/validationGL32_autogen.h"
+
+namespace gl
+{
+
+bool ValidateDrawElementsBaseVertex(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLint basevertex)
+{
+ return true;
+}
+
+bool ValidateDrawElementsInstancedBaseVertex(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLint basevertex)
+{
+ return true;
+}
+
+bool ValidateDrawRangeElementsBaseVertex(Context *context,
+ GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLint basevertex)
+{
+ return true;
+}
+
+bool ValidateFramebufferTexture(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ return true;
+}
+
+bool ValidateMultiDrawElementsBaseVertex(Context *context,
+ GLenum mode,
+ const GLsizei *count,
+ GLenum type,
+ const void *const *indices,
+ GLsizei drawcount,
+ const GLint *basevertex)
+{
+ return true;
+}
+
+bool ValidateProvokingVertex(Context *context, ProvokingVertexConvention modePacked)
+{
+ return true;
+}
+
+bool ValidateTexImage2DMultisample(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ return true;
+}
+
+bool ValidateTexImage3DMultisample(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL32_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL32_autogen.h
new file mode 100644
index 0000000000..19f54e39ab
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL32_autogen.h
@@ -0,0 +1,71 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL32_autogen.h:
+// Validation functions for the OpenGL 3.2 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL32_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL32_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateDrawElementsBaseVertex(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLint basevertex);
+bool ValidateDrawElementsInstancedBaseVertex(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLint basevertex);
+bool ValidateDrawRangeElementsBaseVertex(Context *context,
+ GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLint basevertex);
+bool ValidateFramebufferTexture(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level);
+bool ValidateMultiDrawElementsBaseVertex(Context *context,
+ GLenum mode,
+ const GLsizei *count,
+ GLenum type,
+ const void *const *indices,
+ GLsizei drawcount,
+ const GLint *basevertex);
+bool ValidateProvokingVertex(Context *context, ProvokingVertexConvention modePacked);
+bool ValidateTexImage2DMultisample(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+bool ValidateTexImage3DMultisample(Context *context,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL32_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL33.cpp b/gfx/angle/checkout/src/libANGLE/validationGL33.cpp
new file mode 100644
index 0000000000..834badf9b6
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL33.cpp
@@ -0,0 +1,288 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL33.cpp: Validation functions for OpenGL 3.3 entry point parameters
+
+#include "libANGLE/validationGL33_autogen.h"
+
+namespace gl
+{
+
+bool ValidateBindFragDataLocationIndexed(Context *context,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name)
+{
+ return true;
+}
+
+bool ValidateColorP3ui(Context *context, GLenum type, GLuint color)
+{
+ return true;
+}
+
+bool ValidateColorP3uiv(Context *context, GLenum type, const GLuint *color)
+{
+ return true;
+}
+
+bool ValidateColorP4ui(Context *context, GLenum type, GLuint color)
+{
+ return true;
+}
+
+bool ValidateColorP4uiv(Context *context, GLenum type, const GLuint *color)
+{
+ return true;
+}
+
+bool ValidateGetFragDataIndex(Context *context, GLuint program, const GLchar *name)
+{
+ return true;
+}
+
+bool ValidateGetQueryObjecti64v(Context *context, GLuint id, GLenum pname, GLint64 *params)
+{
+ return true;
+}
+
+bool ValidateGetQueryObjectui64v(Context *context, GLuint id, GLenum pname, GLuint64 *params)
+{
+ return true;
+}
+
+bool ValidateGetSamplerParameterIiv(Context *context, GLuint sampler, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetSamplerParameterIuiv(Context *context, GLuint sampler, GLenum pname, GLuint *params)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP1ui(Context *context, GLenum texture, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP1uiv(Context *context, GLenum texture, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP2ui(Context *context, GLenum texture, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP2uiv(Context *context, GLenum texture, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP3ui(Context *context, GLenum texture, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP3uiv(Context *context, GLenum texture, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP4ui(Context *context, GLenum texture, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateMultiTexCoordP4uiv(Context *context, GLenum texture, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateNormalP3ui(Context *context, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateNormalP3uiv(Context *context, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateQueryCounter(Context *context, GLuint id, QueryType targetPacked)
+{
+ return true;
+}
+
+bool ValidateSamplerParameterIiv(Context *context, GLuint sampler, GLenum pname, const GLint *param)
+{
+ return true;
+}
+
+bool ValidateSamplerParameterIuiv(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param)
+{
+ return true;
+}
+
+bool ValidateSecondaryColorP3ui(Context *context, GLenum type, GLuint color)
+{
+ return true;
+}
+
+bool ValidateSecondaryColorP3uiv(Context *context, GLenum type, const GLuint *color)
+{
+ return true;
+}
+
+bool ValidateTexCoordP1ui(Context *context, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateTexCoordP1uiv(Context *context, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateTexCoordP2ui(Context *context, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateTexCoordP2uiv(Context *context, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateTexCoordP3ui(Context *context, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateTexCoordP3uiv(Context *context, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateTexCoordP4ui(Context *context, GLenum type, GLuint coords)
+{
+ return true;
+}
+
+bool ValidateTexCoordP4uiv(Context *context, GLenum type, const GLuint *coords)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP1ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP1uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP2ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP2uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP3ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP3uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP4ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value)
+{
+ return true;
+}
+
+bool ValidateVertexAttribP4uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value)
+{
+ return true;
+}
+
+bool ValidateVertexP2ui(Context *context, GLenum type, GLuint value)
+{
+ return true;
+}
+
+bool ValidateVertexP2uiv(Context *context, GLenum type, const GLuint *value)
+{
+ return true;
+}
+
+bool ValidateVertexP3ui(Context *context, GLenum type, GLuint value)
+{
+ return true;
+}
+
+bool ValidateVertexP3uiv(Context *context, GLenum type, const GLuint *value)
+{
+ return true;
+}
+
+bool ValidateVertexP4ui(Context *context, GLenum type, GLuint value)
+{
+ return true;
+}
+
+bool ValidateVertexP4uiv(Context *context, GLenum type, const GLuint *value)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL33_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL33_autogen.h
new file mode 100644
index 0000000000..dff0f3de64
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL33_autogen.h
@@ -0,0 +1,126 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL33_autogen.h:
+// Validation functions for the OpenGL 3.3 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL33_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL33_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateBindFragDataLocationIndexed(Context *context,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name);
+bool ValidateColorP3ui(Context *context, GLenum type, GLuint color);
+bool ValidateColorP3uiv(Context *context, GLenum type, const GLuint *color);
+bool ValidateColorP4ui(Context *context, GLenum type, GLuint color);
+bool ValidateColorP4uiv(Context *context, GLenum type, const GLuint *color);
+bool ValidateGetFragDataIndex(Context *context, GLuint program, const GLchar *name);
+bool ValidateGetQueryObjecti64v(Context *context, GLuint id, GLenum pname, GLint64 *params);
+bool ValidateGetQueryObjectui64v(Context *context, GLuint id, GLenum pname, GLuint64 *params);
+bool ValidateGetSamplerParameterIiv(Context *context, GLuint sampler, GLenum pname, GLint *params);
+bool ValidateGetSamplerParameterIuiv(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params);
+bool ValidateMultiTexCoordP1ui(Context *context, GLenum texture, GLenum type, GLuint coords);
+bool ValidateMultiTexCoordP1uiv(Context *context,
+ GLenum texture,
+ GLenum type,
+ const GLuint *coords);
+bool ValidateMultiTexCoordP2ui(Context *context, GLenum texture, GLenum type, GLuint coords);
+bool ValidateMultiTexCoordP2uiv(Context *context,
+ GLenum texture,
+ GLenum type,
+ const GLuint *coords);
+bool ValidateMultiTexCoordP3ui(Context *context, GLenum texture, GLenum type, GLuint coords);
+bool ValidateMultiTexCoordP3uiv(Context *context,
+ GLenum texture,
+ GLenum type,
+ const GLuint *coords);
+bool ValidateMultiTexCoordP4ui(Context *context, GLenum texture, GLenum type, GLuint coords);
+bool ValidateMultiTexCoordP4uiv(Context *context,
+ GLenum texture,
+ GLenum type,
+ const GLuint *coords);
+bool ValidateNormalP3ui(Context *context, GLenum type, GLuint coords);
+bool ValidateNormalP3uiv(Context *context, GLenum type, const GLuint *coords);
+bool ValidateQueryCounter(Context *context, GLuint id, QueryType targetPacked);
+bool ValidateSamplerParameterIiv(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param);
+bool ValidateSamplerParameterIuiv(Context *context,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param);
+bool ValidateSecondaryColorP3ui(Context *context, GLenum type, GLuint color);
+bool ValidateSecondaryColorP3uiv(Context *context, GLenum type, const GLuint *color);
+bool ValidateTexCoordP1ui(Context *context, GLenum type, GLuint coords);
+bool ValidateTexCoordP1uiv(Context *context, GLenum type, const GLuint *coords);
+bool ValidateTexCoordP2ui(Context *context, GLenum type, GLuint coords);
+bool ValidateTexCoordP2uiv(Context *context, GLenum type, const GLuint *coords);
+bool ValidateTexCoordP3ui(Context *context, GLenum type, GLuint coords);
+bool ValidateTexCoordP3uiv(Context *context, GLenum type, const GLuint *coords);
+bool ValidateTexCoordP4ui(Context *context, GLenum type, GLuint coords);
+bool ValidateTexCoordP4uiv(Context *context, GLenum type, const GLuint *coords);
+bool ValidateVertexAttribP1ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value);
+bool ValidateVertexAttribP1uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value);
+bool ValidateVertexAttribP2ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value);
+bool ValidateVertexAttribP2uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value);
+bool ValidateVertexAttribP3ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value);
+bool ValidateVertexAttribP3uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value);
+bool ValidateVertexAttribP4ui(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ GLuint value);
+bool ValidateVertexAttribP4uiv(Context *context,
+ GLuint index,
+ GLenum type,
+ GLboolean normalized,
+ const GLuint *value);
+bool ValidateVertexP2ui(Context *context, GLenum type, GLuint value);
+bool ValidateVertexP2uiv(Context *context, GLenum type, const GLuint *value);
+bool ValidateVertexP3ui(Context *context, GLenum type, GLuint value);
+bool ValidateVertexP3uiv(Context *context, GLenum type, const GLuint *value);
+bool ValidateVertexP4ui(Context *context, GLenum type, GLuint value);
+bool ValidateVertexP4uiv(Context *context, GLenum type, const GLuint *value);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL33_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL3_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL3_autogen.h
new file mode 100644
index 0000000000..6646b7b8ea
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL3_autogen.h
@@ -0,0 +1,83 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL3_autogen.h:
+// Validation functions for the OpenGL 3.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL3_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL3_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateBeginConditionalRender(Context *context, GLuint id, GLenum mode);
+bool ValidateBindFragDataLocation(Context *context,
+ GLuint program,
+ GLuint color,
+ const GLchar *name);
+bool ValidateClampColor(Context *context, GLenum target, GLenum clamp);
+bool ValidateColorMaski(Context *context,
+ GLuint index,
+ GLboolean r,
+ GLboolean g,
+ GLboolean b,
+ GLboolean a);
+bool ValidateDisablei(Context *context, GLenum target, GLuint index);
+bool ValidateEnablei(Context *context, GLenum target, GLuint index);
+bool ValidateEndConditionalRender(Context *context);
+bool ValidateFramebufferTexture1D(Context *context,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+bool ValidateFramebufferTexture3D(Context *context,
+ GLenum target,
+ GLenum attachment,
+ TextureTarget textargetPacked,
+ GLuint texture,
+ GLint level,
+ GLint zoffset);
+bool ValidateGetTexParameterIiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetTexParameterIuiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ GLuint *params);
+bool ValidateIsEnabledi(Context *context, GLenum target, GLuint index);
+bool ValidateTexParameterIiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLint *params);
+bool ValidateTexParameterIuiv(Context *context,
+ TextureType targetPacked,
+ GLenum pname,
+ const GLuint *params);
+bool ValidateVertexAttribI1i(Context *context, GLuint index, GLint x);
+bool ValidateVertexAttribI1iv(Context *context, GLuint index, const GLint *v);
+bool ValidateVertexAttribI1ui(Context *context, GLuint index, GLuint x);
+bool ValidateVertexAttribI1uiv(Context *context, GLuint index, const GLuint *v);
+bool ValidateVertexAttribI2i(Context *context, GLuint index, GLint x, GLint y);
+bool ValidateVertexAttribI2iv(Context *context, GLuint index, const GLint *v);
+bool ValidateVertexAttribI2ui(Context *context, GLuint index, GLuint x, GLuint y);
+bool ValidateVertexAttribI2uiv(Context *context, GLuint index, const GLuint *v);
+bool ValidateVertexAttribI3i(Context *context, GLuint index, GLint x, GLint y, GLint z);
+bool ValidateVertexAttribI3iv(Context *context, GLuint index, const GLint *v);
+bool ValidateVertexAttribI3ui(Context *context, GLuint index, GLuint x, GLuint y, GLuint z);
+bool ValidateVertexAttribI3uiv(Context *context, GLuint index, const GLuint *v);
+bool ValidateVertexAttribI4bv(Context *context, GLuint index, const GLbyte *v);
+bool ValidateVertexAttribI4sv(Context *context, GLuint index, const GLshort *v);
+bool ValidateVertexAttribI4ubv(Context *context, GLuint index, const GLubyte *v);
+bool ValidateVertexAttribI4usv(Context *context, GLuint index, const GLushort *v);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL3_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL4.cpp b/gfx/angle/checkout/src/libANGLE/validationGL4.cpp
new file mode 100644
index 0000000000..a104988f85
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL4.cpp
@@ -0,0 +1,287 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL4.cpp: Validation functions for OpenGL 4.0 entry point parameters
+
+#include "libANGLE/validationGL4_autogen.h"
+
+namespace gl
+{
+
+bool ValidateBeginQueryIndexed(Context *context, GLenum target, GLuint index, GLuint id)
+{
+ return true;
+}
+
+bool ValidateBlendEquationSeparatei(Context *context, GLuint buf, GLenum modeRGB, GLenum modeAlpha)
+{
+ return true;
+}
+
+bool ValidateBlendEquationi(Context *context, GLuint buf, GLenum mode)
+{
+ return true;
+}
+
+bool ValidateBlendFuncSeparatei(Context *context,
+ GLuint buf,
+ GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha)
+{
+ return true;
+}
+
+bool ValidateBlendFunci(Context *context, GLuint buf, GLenum src, GLenum dst)
+{
+ return true;
+}
+
+bool ValidateDrawTransformFeedback(Context *context, GLenum mode, GLuint id)
+{
+ return true;
+}
+
+bool ValidateDrawTransformFeedbackStream(Context *context, GLenum mode, GLuint id, GLuint stream)
+{
+ return true;
+}
+
+bool ValidateEndQueryIndexed(Context *context, GLenum target, GLuint index)
+{
+ return true;
+}
+
+bool ValidateGetActiveSubroutineName(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *name)
+{
+ return true;
+}
+
+bool ValidateGetActiveSubroutineUniformName(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *name)
+{
+ return true;
+}
+
+bool ValidateGetActiveSubroutineUniformiv(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLenum pname,
+ GLint *values)
+{
+ return true;
+}
+
+bool ValidateGetProgramStageiv(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLenum pname,
+ GLint *values)
+{
+ return true;
+}
+
+bool ValidateGetQueryIndexediv(Context *context,
+ GLenum target,
+ GLuint index,
+ GLenum pname,
+ GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetSubroutineIndex(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ const GLchar *name)
+{
+ return true;
+}
+
+bool ValidateGetSubroutineUniformLocation(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ const GLchar *name)
+{
+ return true;
+}
+
+bool ValidateGetUniformSubroutineuiv(Context *context,
+ GLenum shadertype,
+ GLint location,
+ GLuint *params)
+{
+ return true;
+}
+
+bool ValidateGetUniformdv(Context *context, GLuint program, GLint location, GLdouble *params)
+{
+ return true;
+}
+
+bool ValidateMinSampleShading(Context *context, GLfloat value)
+{
+ return true;
+}
+
+bool ValidatePatchParameterfv(Context *context, GLenum pname, const GLfloat *values)
+{
+ return true;
+}
+
+bool ValidatePatchParameteri(Context *context, GLenum pname, GLint value)
+{
+ return true;
+}
+
+bool ValidateUniform1d(Context *context, GLint location, GLdouble x)
+{
+ return true;
+}
+
+bool ValidateUniform1dv(Context *context, GLint location, GLsizei count, const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniform2d(Context *context, GLint location, GLdouble x, GLdouble y)
+{
+ return true;
+}
+
+bool ValidateUniform2dv(Context *context, GLint location, GLsizei count, const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniform3d(Context *context, GLint location, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateUniform3dv(Context *context, GLint location, GLsizei count, const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniform4d(Context *context,
+ GLint location,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z,
+ GLdouble w)
+{
+ return true;
+}
+
+bool ValidateUniform4dv(Context *context, GLint location, GLsizei count, const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix2dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix2x3dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix2x4dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix3dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix3x2dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix3x4dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix4dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix4x2dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformMatrix4x3dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateUniformSubroutinesuiv(Context *context,
+ GLenum shadertype,
+ GLsizei count,
+ const GLuint *indices)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL41.cpp b/gfx/angle/checkout/src/libANGLE/validationGL41.cpp
new file mode 100644
index 0000000000..e04a6cfab2
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL41.cpp
@@ -0,0 +1,295 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL41.cpp: Validation functions for OpenGL 4.1 entry point parameters
+
+#include "libANGLE/validationGL41_autogen.h"
+
+namespace gl
+{
+
+bool ValidateDepthRangeArrayv(Context *context, GLuint first, GLsizei count, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateDepthRangeIndexed(Context *context, GLuint index, GLdouble n, GLdouble f)
+{
+ return true;
+}
+
+bool ValidateGetDoublei_v(Context *context, GLenum target, GLuint index, GLdouble *data)
+{
+ return true;
+}
+
+bool ValidateGetFloati_v(Context *context, GLenum target, GLuint index, GLfloat *data)
+{
+ return true;
+}
+
+bool ValidateGetVertexAttribLdv(Context *context, GLuint index, GLenum pname, GLdouble *params)
+{
+ return true;
+}
+
+bool ValidateProgramUniform1d(Context *context, GLuint program, GLint location, GLdouble v0)
+{
+ return true;
+}
+
+bool ValidateProgramUniform1dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniform2d(Context *context,
+ GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1)
+{
+ return true;
+}
+
+bool ValidateProgramUniform2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniform3d(Context *context,
+ GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1,
+ GLdouble v2)
+{
+ return true;
+}
+
+bool ValidateProgramUniform3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniform4d(Context *context,
+ GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1,
+ GLdouble v2,
+ GLdouble v3)
+{
+ return true;
+}
+
+bool ValidateProgramUniform4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix2x3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix2x4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix3x2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix3x4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix4x2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateProgramUniformMatrix4x3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value)
+{
+ return true;
+}
+
+bool ValidateScissorArrayv(Context *context, GLuint first, GLsizei count, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateScissorIndexed(Context *context,
+ GLuint index,
+ GLint left,
+ GLint bottom,
+ GLsizei width,
+ GLsizei height)
+{
+ return true;
+}
+
+bool ValidateScissorIndexedv(Context *context, GLuint index, const GLint *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL1d(Context *context, GLuint index, GLdouble x)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL1dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL2d(Context *context, GLuint index, GLdouble x, GLdouble y)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL2dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL3d(Context *context, GLuint index, GLdouble x, GLdouble y, GLdouble z)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL3dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL4d(Context *context,
+ GLuint index,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z,
+ GLdouble w)
+{
+ return true;
+}
+
+bool ValidateVertexAttribL4dv(Context *context, GLuint index, const GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateVertexAttribLPointer(Context *context,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return true;
+}
+
+bool ValidateViewportArrayv(Context *context, GLuint first, GLsizei count, const GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateViewportIndexedf(Context *context,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat w,
+ GLfloat h)
+{
+ return true;
+}
+
+bool ValidateViewportIndexedfv(Context *context, GLuint index, const GLfloat *v)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL41_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL41_autogen.h
new file mode 100644
index 0000000000..9c05488e6a
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL41_autogen.h
@@ -0,0 +1,155 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL41_autogen.h:
+// Validation functions for the OpenGL 4.1 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL41_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL41_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateDepthRangeArrayv(Context *context, GLuint first, GLsizei count, const GLdouble *v);
+bool ValidateDepthRangeIndexed(Context *context, GLuint index, GLdouble n, GLdouble f);
+bool ValidateGetDoublei_v(Context *context, GLenum target, GLuint index, GLdouble *data);
+bool ValidateGetFloati_v(Context *context, GLenum target, GLuint index, GLfloat *data);
+bool ValidateGetVertexAttribLdv(Context *context, GLuint index, GLenum pname, GLdouble *params);
+bool ValidateProgramUniform1d(Context *context, GLuint program, GLint location, GLdouble v0);
+bool ValidateProgramUniform1dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value);
+bool ValidateProgramUniform2d(Context *context,
+ GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1);
+bool ValidateProgramUniform2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value);
+bool ValidateProgramUniform3d(Context *context,
+ GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1,
+ GLdouble v2);
+bool ValidateProgramUniform3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value);
+bool ValidateProgramUniform4d(Context *context,
+ GLuint program,
+ GLint location,
+ GLdouble v0,
+ GLdouble v1,
+ GLdouble v2,
+ GLdouble v3);
+bool ValidateProgramUniform4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix2x3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix2x4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix3x2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix3x4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix4dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix4x2dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateProgramUniformMatrix4x3dv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateScissorArrayv(Context *context, GLuint first, GLsizei count, const GLint *v);
+bool ValidateScissorIndexed(Context *context,
+ GLuint index,
+ GLint left,
+ GLint bottom,
+ GLsizei width,
+ GLsizei height);
+bool ValidateScissorIndexedv(Context *context, GLuint index, const GLint *v);
+bool ValidateVertexAttribL1d(Context *context, GLuint index, GLdouble x);
+bool ValidateVertexAttribL1dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttribL2d(Context *context, GLuint index, GLdouble x, GLdouble y);
+bool ValidateVertexAttribL2dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttribL3d(Context *context, GLuint index, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateVertexAttribL3dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttribL4d(Context *context,
+ GLuint index,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z,
+ GLdouble w);
+bool ValidateVertexAttribL4dv(Context *context, GLuint index, const GLdouble *v);
+bool ValidateVertexAttribLPointer(Context *context,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+bool ValidateViewportArrayv(Context *context, GLuint first, GLsizei count, const GLfloat *v);
+bool ValidateViewportIndexedf(Context *context,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat w,
+ GLfloat h);
+bool ValidateViewportIndexedfv(Context *context, GLuint index, const GLfloat *v);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL41_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL42.cpp b/gfx/angle/checkout/src/libANGLE/validationGL42.cpp
new file mode 100644
index 0000000000..d4e73a15e9
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL42.cpp
@@ -0,0 +1,82 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL42.cpp: Validation functions for OpenGL 4.2 entry point parameters
+
+#include "libANGLE/validationGL42_autogen.h"
+
+namespace gl
+{
+
+bool ValidateDrawArraysInstancedBaseInstance(Context *context,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount,
+ GLuint baseinstance)
+{
+ return true;
+}
+
+bool ValidateDrawElementsInstancedBaseInstance(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLuint baseinstance)
+{
+ return true;
+}
+
+bool ValidateDrawElementsInstancedBaseVertexBaseInstance(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLint basevertex,
+ GLuint baseinstance)
+{
+ return true;
+}
+
+bool ValidateDrawTransformFeedbackInstanced(Context *context,
+ GLenum mode,
+ GLuint id,
+ GLsizei instancecount)
+{
+ return true;
+}
+
+bool ValidateDrawTransformFeedbackStreamInstanced(Context *context,
+ GLenum mode,
+ GLuint id,
+ GLuint stream,
+ GLsizei instancecount)
+{
+ return true;
+}
+
+bool ValidateGetActiveAtomicCounterBufferiv(Context *context,
+ GLuint program,
+ GLuint bufferIndex,
+ GLenum pname,
+ GLint *params)
+{
+ return true;
+}
+
+bool ValidateTexStorage1D(Context *context,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL42_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL42_autogen.h
new file mode 100644
index 0000000000..bf18a9ff9e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL42_autogen.h
@@ -0,0 +1,62 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL42_autogen.h:
+// Validation functions for the OpenGL 4.2 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL42_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL42_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateDrawArraysInstancedBaseInstance(Context *context,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount,
+ GLuint baseinstance);
+bool ValidateDrawElementsInstancedBaseInstance(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLuint baseinstance);
+bool ValidateDrawElementsInstancedBaseVertexBaseInstance(Context *context,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount,
+ GLint basevertex,
+ GLuint baseinstance);
+bool ValidateDrawTransformFeedbackInstanced(Context *context,
+ GLenum mode,
+ GLuint id,
+ GLsizei instancecount);
+bool ValidateDrawTransformFeedbackStreamInstanced(Context *context,
+ GLenum mode,
+ GLuint id,
+ GLuint stream,
+ GLsizei instancecount);
+bool ValidateGetActiveAtomicCounterBufferiv(Context *context,
+ GLuint program,
+ GLuint bufferIndex,
+ GLenum pname,
+ GLint *params);
+bool ValidateTexStorage1D(Context *context,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL42_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL43.cpp b/gfx/angle/checkout/src/libANGLE/validationGL43.cpp
new file mode 100644
index 0000000000..a72ef62cf5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL43.cpp
@@ -0,0 +1,263 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL43.cpp: Validation functions for OpenGL 4.3 entry point parameters
+
+#include "libANGLE/validationGL43_autogen.h"
+
+namespace gl
+{
+
+bool ValidateClearBufferData(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateClearBufferSubData(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLintptr offset,
+ GLsizeiptr size,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateCopyImageSubData(Context *context,
+ GLuint srcName,
+ GLenum srcTarget,
+ GLint srcLevel,
+ GLint srcX,
+ GLint srcY,
+ GLint srcZ,
+ GLuint dstName,
+ GLenum dstTarget,
+ GLint dstLevel,
+ GLint dstX,
+ GLint dstY,
+ GLint dstZ,
+ GLsizei srcWidth,
+ GLsizei srcHeight,
+ GLsizei srcDepth)
+{
+ return true;
+}
+
+bool ValidateDebugMessageCallback(Context *context, GLDEBUGPROC callback, const void *userParam)
+{
+ return true;
+}
+
+bool ValidateDebugMessageControl(Context *context,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled)
+{
+ return true;
+}
+
+bool ValidateDebugMessageInsert(Context *context,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf)
+{
+ return true;
+}
+
+bool ValidateGetDebugMessageLog(Context *context,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ return true;
+}
+
+bool ValidateGetInternalformati64v(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint64 *params)
+{
+ return true;
+}
+
+bool ValidateGetObjectLabel(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ return true;
+}
+
+bool ValidateGetObjectPtrLabel(Context *context,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ return true;
+}
+
+bool ValidateGetProgramResourceLocationIndex(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ return true;
+}
+
+bool ValidateInvalidateBufferData(Context *context, GLuint buffer)
+{
+ return true;
+}
+
+bool ValidateInvalidateBufferSubData(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ return true;
+}
+
+bool ValidateInvalidateTexImage(Context *context, GLuint texture, GLint level)
+{
+ return true;
+}
+
+bool ValidateInvalidateTexSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ return true;
+}
+
+bool ValidateMultiDrawArraysIndirect(Context *context,
+ GLenum mode,
+ const void *indirect,
+ GLsizei drawcount,
+ GLsizei stride)
+{
+ return true;
+}
+
+bool ValidateMultiDrawElementsIndirect(Context *context,
+ GLenum mode,
+ GLenum type,
+ const void *indirect,
+ GLsizei drawcount,
+ GLsizei stride)
+{
+ return true;
+}
+
+bool ValidateObjectLabel(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label)
+{
+ return true;
+}
+
+bool ValidateObjectPtrLabel(Context *context, const void *ptr, GLsizei length, const GLchar *label)
+{
+ return true;
+}
+
+bool ValidatePopDebugGroup(Context *context)
+{
+ return true;
+}
+
+bool ValidatePushDebugGroup(Context *context,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message)
+{
+ return true;
+}
+
+bool ValidateShaderStorageBlockBinding(Context *context,
+ GLuint program,
+ GLuint storageBlockIndex,
+ GLuint storageBlockBinding)
+{
+ return true;
+}
+
+bool ValidateTexBufferRange(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ return true;
+}
+
+bool ValidateTexStorage3DMultisample(Context *context,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ return true;
+}
+
+bool ValidateTextureView(Context *context,
+ GLuint texture,
+ GLenum target,
+ GLuint origtexture,
+ GLenum internalformat,
+ GLuint minlevel,
+ GLuint numlevels,
+ GLuint minlayer,
+ GLuint numlayers)
+{
+ return true;
+}
+
+bool ValidateVertexAttribLFormat(Context *context,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL43_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL43_autogen.h
new file mode 100644
index 0000000000..6cf37bc24c
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL43_autogen.h
@@ -0,0 +1,167 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL43_autogen.h:
+// Validation functions for the OpenGL 4.3 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL43_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL43_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateClearBufferData(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type,
+ const void *data);
+bool ValidateClearBufferSubData(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLintptr offset,
+ GLsizeiptr size,
+ GLenum format,
+ GLenum type,
+ const void *data);
+bool ValidateCopyImageSubData(Context *context,
+ GLuint srcName,
+ GLenum srcTarget,
+ GLint srcLevel,
+ GLint srcX,
+ GLint srcY,
+ GLint srcZ,
+ GLuint dstName,
+ GLenum dstTarget,
+ GLint dstLevel,
+ GLint dstX,
+ GLint dstY,
+ GLint dstZ,
+ GLsizei srcWidth,
+ GLsizei srcHeight,
+ GLsizei srcDepth);
+bool ValidateDebugMessageCallback(Context *context, GLDEBUGPROC callback, const void *userParam);
+bool ValidateDebugMessageControl(Context *context,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled);
+bool ValidateDebugMessageInsert(Context *context,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf);
+bool ValidateGetDebugMessageLog(Context *context,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog);
+bool ValidateGetInternalformati64v(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint64 *params);
+bool ValidateGetObjectLabel(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+bool ValidateGetObjectPtrLabel(Context *context,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+bool ValidateGetProgramResourceLocationIndex(Context *context,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+bool ValidateInvalidateBufferData(Context *context, GLuint buffer);
+bool ValidateInvalidateBufferSubData(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr length);
+bool ValidateInvalidateTexImage(Context *context, GLuint texture, GLint level);
+bool ValidateInvalidateTexSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+bool ValidateMultiDrawArraysIndirect(Context *context,
+ GLenum mode,
+ const void *indirect,
+ GLsizei drawcount,
+ GLsizei stride);
+bool ValidateMultiDrawElementsIndirect(Context *context,
+ GLenum mode,
+ GLenum type,
+ const void *indirect,
+ GLsizei drawcount,
+ GLsizei stride);
+bool ValidateObjectLabel(Context *context,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label);
+bool ValidateObjectPtrLabel(Context *context, const void *ptr, GLsizei length, const GLchar *label);
+bool ValidatePopDebugGroup(Context *context);
+bool ValidatePushDebugGroup(Context *context,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message);
+bool ValidateShaderStorageBlockBinding(Context *context,
+ GLuint program,
+ GLuint storageBlockIndex,
+ GLuint storageBlockBinding);
+bool ValidateTexBufferRange(Context *context,
+ GLenum target,
+ GLenum internalformat,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+bool ValidateTexStorage3DMultisample(Context *context,
+ TextureType targetPacked,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations);
+bool ValidateTextureView(Context *context,
+ GLuint texture,
+ GLenum target,
+ GLuint origtexture,
+ GLenum internalformat,
+ GLuint minlevel,
+ GLuint numlevels,
+ GLuint minlayer,
+ GLuint numlayers);
+bool ValidateVertexAttribLFormat(Context *context,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL43_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL44.cpp b/gfx/angle/checkout/src/libANGLE/validationGL44.cpp
new file mode 100644
index 0000000000..e6615f5afb
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL44.cpp
@@ -0,0 +1,97 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL44.cpp: Validation functions for OpenGL 4.4 entry point parameters
+
+#include "libANGLE/validationGL44_autogen.h"
+
+namespace gl
+{
+
+bool ValidateBindBuffersBase(Context *context,
+ GLenum target,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers)
+{
+ return true;
+}
+
+bool ValidateBindBuffersRange(Context *context,
+ GLenum target,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizeiptr *sizes)
+{
+ return true;
+}
+
+bool ValidateBindImageTextures(Context *context,
+ GLuint first,
+ GLsizei count,
+ const GLuint *textures)
+{
+ return true;
+}
+
+bool ValidateBindSamplers(Context *context, GLuint first, GLsizei count, const GLuint *samplers)
+{
+ return true;
+}
+
+bool ValidateBindTextures(Context *context, GLuint first, GLsizei count, const GLuint *textures)
+{
+ return true;
+}
+
+bool ValidateBindVertexBuffers(Context *context,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizei *strides)
+{
+ return true;
+}
+
+bool ValidateBufferStorage(Context *context,
+ GLenum target,
+ GLsizeiptr size,
+ const void *data,
+ GLbitfield flags)
+{
+ return true;
+}
+
+bool ValidateClearTexImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateClearTexSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL44_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL44_autogen.h
new file mode 100644
index 0000000000..f5d30a01f1
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL44_autogen.h
@@ -0,0 +1,69 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL44_autogen.h:
+// Validation functions for the OpenGL 4.4 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL44_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL44_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateBindBuffersBase(Context *context,
+ GLenum target,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers);
+bool ValidateBindBuffersRange(Context *context,
+ GLenum target,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizeiptr *sizes);
+bool ValidateBindImageTextures(Context *context,
+ GLuint first,
+ GLsizei count,
+ const GLuint *textures);
+bool ValidateBindSamplers(Context *context, GLuint first, GLsizei count, const GLuint *samplers);
+bool ValidateBindTextures(Context *context, GLuint first, GLsizei count, const GLuint *textures);
+bool ValidateBindVertexBuffers(Context *context,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizei *strides);
+bool ValidateBufferStorage(Context *context,
+ GLenum target,
+ GLsizeiptr size,
+ const void *data,
+ GLbitfield flags);
+bool ValidateClearTexImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ const void *data);
+bool ValidateClearTexSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *data);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL44_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL45.cpp b/gfx/angle/checkout/src/libANGLE/validationGL45.cpp
new file mode 100644
index 0000000000..32f1e9ca0e
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL45.cpp
@@ -0,0 +1,1032 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL45.cpp: Validation functions for OpenGL 4.5 entry point parameters
+
+#include "libANGLE/validationGL45_autogen.h"
+
+namespace gl
+{
+
+bool ValidateBindTextureUnit(Context *context, GLuint unit, GLuint texture)
+{
+ return true;
+}
+
+bool ValidateBlitNamedFramebuffer(Context *context,
+ GLuint readFramebuffer,
+ GLuint drawFramebuffer,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ return true;
+}
+
+bool ValidateCheckNamedFramebufferStatus(Context *context, GLuint framebuffer, GLenum target)
+{
+ return true;
+}
+
+bool ValidateClearNamedBufferData(Context *context,
+ GLuint buffer,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateClearNamedBufferSubData(Context *context,
+ GLuint buffer,
+ GLenum internalformat,
+ GLintptr offset,
+ GLsizeiptr size,
+ GLenum format,
+ GLenum type,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateClearNamedFramebufferfi(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil)
+{
+ return true;
+}
+
+bool ValidateClearNamedFramebufferfv(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value)
+{
+ return true;
+}
+
+bool ValidateClearNamedFramebufferiv(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value)
+{
+ return true;
+}
+
+bool ValidateClearNamedFramebufferuiv(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value)
+{
+ return true;
+}
+
+bool ValidateClipControl(Context *context, GLenum origin, GLenum depth)
+{
+ return true;
+}
+
+bool ValidateCompressedTextureSubImage1D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateCompressedTextureSubImage2D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateCompressedTextureSubImage3D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateCopyNamedBufferSubData(Context *context,
+ GLuint readBuffer,
+ GLuint writeBuffer,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ return true;
+}
+
+bool ValidateCopyTextureSubImage1D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width)
+{
+ return true;
+}
+
+bool ValidateCopyTextureSubImage2D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return true;
+}
+
+bool ValidateCopyTextureSubImage3D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return true;
+}
+
+bool ValidateCreateBuffers(Context *context, GLsizei n, GLuint *buffers)
+{
+ return true;
+}
+
+bool ValidateCreateFramebuffers(Context *context, GLsizei n, GLuint *framebuffers)
+{
+ return true;
+}
+
+bool ValidateCreateProgramPipelines(Context *context, GLsizei n, GLuint *pipelines)
+{
+ return true;
+}
+
+bool ValidateCreateQueries(Context *context, GLenum target, GLsizei n, GLuint *ids)
+{
+ return true;
+}
+
+bool ValidateCreateRenderbuffers(Context *context, GLsizei n, GLuint *renderbuffers)
+{
+ return true;
+}
+
+bool ValidateCreateSamplers(Context *context, GLsizei n, GLuint *samplers)
+{
+ return true;
+}
+
+bool ValidateCreateTextures(Context *context, GLenum target, GLsizei n, GLuint *textures)
+{
+ return true;
+}
+
+bool ValidateCreateTransformFeedbacks(Context *context, GLsizei n, GLuint *ids)
+{
+ return true;
+}
+
+bool ValidateCreateVertexArrays(Context *context, GLsizei n, GLuint *arrays)
+{
+ return true;
+}
+
+bool ValidateDisableVertexArrayAttrib(Context *context, GLuint vaobj, GLuint index)
+{
+ return true;
+}
+
+bool ValidateEnableVertexArrayAttrib(Context *context, GLuint vaobj, GLuint index)
+{
+ return true;
+}
+
+bool ValidateFlushMappedNamedBufferRange(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ return true;
+}
+
+bool ValidateGenerateTextureMipmap(Context *context, GLuint texture)
+{
+ return true;
+}
+
+bool ValidateGetCompressedTextureImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLsizei bufSize,
+ void *pixels)
+{
+ return true;
+}
+
+bool ValidateGetCompressedTextureSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei bufSize,
+ void *pixels)
+{
+ return true;
+}
+
+bool ValidateGetGraphicsResetStatus(Context *context)
+{
+ return true;
+}
+
+bool ValidateGetNamedBufferParameteri64v(Context *context,
+ GLuint buffer,
+ GLenum pname,
+ GLint64 *params)
+{
+ return true;
+}
+
+bool ValidateGetNamedBufferParameteriv(Context *context, GLuint buffer, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetNamedBufferPointerv(Context *context, GLuint buffer, GLenum pname, void **params)
+{
+ return true;
+}
+
+bool ValidateGetNamedBufferSubData(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size,
+ void *data)
+{
+ return true;
+}
+
+bool ValidateGetNamedFramebufferAttachmentParameteriv(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetNamedFramebufferParameteriv(Context *context,
+ GLuint framebuffer,
+ GLenum pname,
+ GLint *param)
+{
+ return true;
+}
+
+bool ValidateGetNamedRenderbufferParameteriv(Context *context,
+ GLuint renderbuffer,
+ GLenum pname,
+ GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetQueryBufferObjecti64v(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset)
+{
+ return true;
+}
+
+bool ValidateGetQueryBufferObjectiv(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset)
+{
+ return true;
+}
+
+bool ValidateGetQueryBufferObjectui64v(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset)
+{
+ return true;
+}
+
+bool ValidateGetQueryBufferObjectuiv(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset)
+{
+ return true;
+}
+
+bool ValidateGetTextureImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels)
+{
+ return true;
+}
+
+bool ValidateGetTextureLevelParameterfv(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ return true;
+}
+
+bool ValidateGetTextureLevelParameteriv(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetTextureParameterIiv(Context *context, GLuint texture, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetTextureParameterIuiv(Context *context, GLuint texture, GLenum pname, GLuint *params)
+{
+ return true;
+}
+
+bool ValidateGetTextureParameterfv(Context *context, GLuint texture, GLenum pname, GLfloat *params)
+{
+ return true;
+}
+
+bool ValidateGetTextureParameteriv(Context *context, GLuint texture, GLenum pname, GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetTextureSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels)
+{
+ return true;
+}
+
+bool ValidateGetTransformFeedbacki64_v(Context *context,
+ GLuint xfb,
+ GLenum pname,
+ GLuint index,
+ GLint64 *param)
+{
+ return true;
+}
+
+bool ValidateGetTransformFeedbacki_v(Context *context,
+ GLuint xfb,
+ GLenum pname,
+ GLuint index,
+ GLint *param)
+{
+ return true;
+}
+
+bool ValidateGetTransformFeedbackiv(Context *context, GLuint xfb, GLenum pname, GLint *param)
+{
+ return true;
+}
+
+bool ValidateGetVertexArrayIndexed64iv(Context *context,
+ GLuint vaobj,
+ GLuint index,
+ GLenum pname,
+ GLint64 *param)
+{
+ return true;
+}
+
+bool ValidateGetVertexArrayIndexediv(Context *context,
+ GLuint vaobj,
+ GLuint index,
+ GLenum pname,
+ GLint *param)
+{
+ return true;
+}
+
+bool ValidateGetVertexArrayiv(Context *context, GLuint vaobj, GLenum pname, GLint *param)
+{
+ return true;
+}
+
+bool ValidateGetnColorTable(Context *context,
+ GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *table)
+{
+ return true;
+}
+
+bool ValidateGetnCompressedTexImage(Context *context,
+ GLenum target,
+ GLint lod,
+ GLsizei bufSize,
+ void *pixels)
+{
+ return true;
+}
+
+bool ValidateGetnConvolutionFilter(Context *context,
+ GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *image)
+{
+ return true;
+}
+
+bool ValidateGetnHistogram(Context *context,
+ GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *values)
+{
+ return true;
+}
+
+bool ValidateGetnMapdv(Context *context, GLenum target, GLenum query, GLsizei bufSize, GLdouble *v)
+{
+ return true;
+}
+
+bool ValidateGetnMapfv(Context *context, GLenum target, GLenum query, GLsizei bufSize, GLfloat *v)
+{
+ return true;
+}
+
+bool ValidateGetnMapiv(Context *context, GLenum target, GLenum query, GLsizei bufSize, GLint *v)
+{
+ return true;
+}
+
+bool ValidateGetnMinmax(Context *context,
+ GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *values)
+{
+ return true;
+}
+
+bool ValidateGetnPixelMapfv(Context *context, GLenum map, GLsizei bufSize, GLfloat *values)
+{
+ return true;
+}
+
+bool ValidateGetnPixelMapuiv(Context *context, GLenum map, GLsizei bufSize, GLuint *values)
+{
+ return true;
+}
+
+bool ValidateGetnPixelMapusv(Context *context, GLenum map, GLsizei bufSize, GLushort *values)
+{
+ return true;
+}
+
+bool ValidateGetnPolygonStipple(Context *context, GLsizei bufSize, GLubyte *pattern)
+{
+ return true;
+}
+
+bool ValidateGetnSeparableFilter(Context *context,
+ GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei rowBufSize,
+ void *row,
+ GLsizei columnBufSize,
+ void *column,
+ void *span)
+{
+ return true;
+}
+
+bool ValidateGetnTexImage(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels)
+{
+ return true;
+}
+
+bool ValidateGetnUniformdv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLdouble *params)
+{
+ return true;
+}
+
+bool ValidateGetnUniformfv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params)
+{
+ return true;
+}
+
+bool ValidateGetnUniformiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params)
+{
+ return true;
+}
+
+bool ValidateGetnUniformuiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLuint *params)
+{
+ return true;
+}
+
+bool ValidateInvalidateNamedFramebufferData(Context *context,
+ GLuint framebuffer,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ return true;
+}
+
+bool ValidateInvalidateNamedFramebufferSubData(Context *context,
+ GLuint framebuffer,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return true;
+}
+
+bool ValidateMapNamedBuffer(Context *context, GLuint buffer, GLenum access)
+{
+ return true;
+}
+
+bool ValidateMapNamedBufferRange(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ return true;
+}
+
+bool ValidateNamedBufferData(Context *context,
+ GLuint buffer,
+ GLsizeiptr size,
+ const void *data,
+ GLenum usage)
+{
+ return true;
+}
+
+bool ValidateNamedBufferStorage(Context *context,
+ GLuint buffer,
+ GLsizeiptr size,
+ const void *data,
+ GLbitfield flags)
+{
+ return true;
+}
+
+bool ValidateNamedBufferSubData(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data)
+{
+ return true;
+}
+
+bool ValidateNamedFramebufferDrawBuffer(Context *context, GLuint framebuffer, GLenum buf)
+{
+ return true;
+}
+
+bool ValidateNamedFramebufferDrawBuffers(Context *context,
+ GLuint framebuffer,
+ GLsizei n,
+ const GLenum *bufs)
+{
+ return true;
+}
+
+bool ValidateNamedFramebufferParameteri(Context *context,
+ GLuint framebuffer,
+ GLenum pname,
+ GLint param)
+{
+ return true;
+}
+
+bool ValidateNamedFramebufferReadBuffer(Context *context, GLuint framebuffer, GLenum src)
+{
+ return true;
+}
+
+bool ValidateNamedFramebufferRenderbuffer(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ return true;
+}
+
+bool ValidateNamedFramebufferTexture(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ return true;
+}
+
+bool ValidateNamedFramebufferTextureLayer(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer)
+{
+ return true;
+}
+
+bool ValidateNamedRenderbufferStorage(Context *context,
+ GLuint renderbuffer,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return true;
+}
+
+bool ValidateNamedRenderbufferStorageMultisample(Context *context,
+ GLuint renderbuffer,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return true;
+}
+
+bool ValidateReadnPixels(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data)
+{
+ return true;
+}
+
+bool ValidateTextureBarrier(Context *context)
+{
+ return true;
+}
+
+bool ValidateTextureBuffer(Context *context, GLuint texture, GLenum internalformat, GLuint buffer)
+{
+ return true;
+}
+
+bool ValidateTextureBufferRange(Context *context,
+ GLuint texture,
+ GLenum internalformat,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ return true;
+}
+
+bool ValidateTextureParameterIiv(Context *context,
+ GLuint texture,
+ GLenum pname,
+ const GLint *params)
+{
+ return true;
+}
+
+bool ValidateTextureParameterIuiv(Context *context,
+ GLuint texture,
+ GLenum pname,
+ const GLuint *params)
+{
+ return true;
+}
+
+bool ValidateTextureParameterf(Context *context, GLuint texture, GLenum pname, GLfloat param)
+{
+ return true;
+}
+
+bool ValidateTextureParameterfv(Context *context,
+ GLuint texture,
+ GLenum pname,
+ const GLfloat *param)
+{
+ return true;
+}
+
+bool ValidateTextureParameteri(Context *context, GLuint texture, GLenum pname, GLint param)
+{
+ return true;
+}
+
+bool ValidateTextureParameteriv(Context *context, GLuint texture, GLenum pname, const GLint *param)
+{
+ return true;
+}
+
+bool ValidateTextureStorage1D(Context *context,
+ GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width)
+{
+ return true;
+}
+
+bool ValidateTextureStorage2D(Context *context,
+ GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return true;
+}
+
+bool ValidateTextureStorage2DMultisample(Context *context,
+ GLuint texture,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ return true;
+}
+
+bool ValidateTextureStorage3D(Context *context,
+ GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ return true;
+}
+
+bool ValidateTextureStorage3DMultisample(Context *context,
+ GLuint texture,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ return true;
+}
+
+bool ValidateTextureSubImage1D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return true;
+}
+
+bool ValidateTextureSubImage2D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return true;
+}
+
+bool ValidateTextureSubImage3D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return true;
+}
+
+bool ValidateTransformFeedbackBufferBase(Context *context, GLuint xfb, GLuint index, GLuint buffer)
+{
+ return true;
+}
+
+bool ValidateTransformFeedbackBufferRange(Context *context,
+ GLuint xfb,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ return true;
+}
+
+bool ValidateUnmapNamedBuffer(Context *context, GLuint buffer)
+{
+ return true;
+}
+
+bool ValidateVertexArrayAttribBinding(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLuint bindingindex)
+{
+ return true;
+}
+
+bool ValidateVertexArrayAttribFormat(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset)
+{
+ return true;
+}
+
+bool ValidateVertexArrayAttribIFormat(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ return true;
+}
+
+bool ValidateVertexArrayAttribLFormat(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ return true;
+}
+
+bool ValidateVertexArrayBindingDivisor(Context *context,
+ GLuint vaobj,
+ GLuint bindingindex,
+ GLuint divisor)
+{
+ return true;
+}
+
+bool ValidateVertexArrayElementBuffer(Context *context, GLuint vaobj, GLuint buffer)
+{
+ return true;
+}
+
+bool ValidateVertexArrayVertexBuffer(Context *context,
+ GLuint vaobj,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ return true;
+}
+
+bool ValidateVertexArrayVertexBuffers(Context *context,
+ GLuint vaobj,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizei *strides)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL45_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL45_autogen.h
new file mode 100644
index 0000000000..4911efa6f7
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL45_autogen.h
@@ -0,0 +1,562 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL45_autogen.h:
+// Validation functions for the OpenGL 4.5 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL45_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL45_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateBindTextureUnit(Context *context, GLuint unit, GLuint texture);
+bool ValidateBlitNamedFramebuffer(Context *context,
+ GLuint readFramebuffer,
+ GLuint drawFramebuffer,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+bool ValidateCheckNamedFramebufferStatus(Context *context, GLuint framebuffer, GLenum target);
+bool ValidateClearNamedBufferData(Context *context,
+ GLuint buffer,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type,
+ const void *data);
+bool ValidateClearNamedBufferSubData(Context *context,
+ GLuint buffer,
+ GLenum internalformat,
+ GLintptr offset,
+ GLsizeiptr size,
+ GLenum format,
+ GLenum type,
+ const void *data);
+bool ValidateClearNamedFramebufferfi(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil);
+bool ValidateClearNamedFramebufferfv(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value);
+bool ValidateClearNamedFramebufferiv(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value);
+bool ValidateClearNamedFramebufferuiv(Context *context,
+ GLuint framebuffer,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value);
+bool ValidateClipControl(Context *context, GLenum origin, GLenum depth);
+bool ValidateCompressedTextureSubImage1D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCompressedTextureSubImage2D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCompressedTextureSubImage3D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+bool ValidateCopyNamedBufferSubData(Context *context,
+ GLuint readBuffer,
+ GLuint writeBuffer,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size);
+bool ValidateCopyTextureSubImage1D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint x,
+ GLint y,
+ GLsizei width);
+bool ValidateCopyTextureSubImage2D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+bool ValidateCopyTextureSubImage3D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+bool ValidateCreateBuffers(Context *context, GLsizei n, GLuint *buffers);
+bool ValidateCreateFramebuffers(Context *context, GLsizei n, GLuint *framebuffers);
+bool ValidateCreateProgramPipelines(Context *context, GLsizei n, GLuint *pipelines);
+bool ValidateCreateQueries(Context *context, GLenum target, GLsizei n, GLuint *ids);
+bool ValidateCreateRenderbuffers(Context *context, GLsizei n, GLuint *renderbuffers);
+bool ValidateCreateSamplers(Context *context, GLsizei n, GLuint *samplers);
+bool ValidateCreateTextures(Context *context, GLenum target, GLsizei n, GLuint *textures);
+bool ValidateCreateTransformFeedbacks(Context *context, GLsizei n, GLuint *ids);
+bool ValidateCreateVertexArrays(Context *context, GLsizei n, GLuint *arrays);
+bool ValidateDisableVertexArrayAttrib(Context *context, GLuint vaobj, GLuint index);
+bool ValidateEnableVertexArrayAttrib(Context *context, GLuint vaobj, GLuint index);
+bool ValidateFlushMappedNamedBufferRange(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr length);
+bool ValidateGenerateTextureMipmap(Context *context, GLuint texture);
+bool ValidateGetCompressedTextureImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLsizei bufSize,
+ void *pixels);
+bool ValidateGetCompressedTextureSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei bufSize,
+ void *pixels);
+bool ValidateGetGraphicsResetStatus(Context *context);
+bool ValidateGetNamedBufferParameteri64v(Context *context,
+ GLuint buffer,
+ GLenum pname,
+ GLint64 *params);
+bool ValidateGetNamedBufferParameteriv(Context *context,
+ GLuint buffer,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetNamedBufferPointerv(Context *context, GLuint buffer, GLenum pname, void **params);
+bool ValidateGetNamedBufferSubData(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size,
+ void *data);
+bool ValidateGetNamedFramebufferAttachmentParameteriv(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetNamedFramebufferParameteriv(Context *context,
+ GLuint framebuffer,
+ GLenum pname,
+ GLint *param);
+bool ValidateGetNamedRenderbufferParameteriv(Context *context,
+ GLuint renderbuffer,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetQueryBufferObjecti64v(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset);
+bool ValidateGetQueryBufferObjectiv(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset);
+bool ValidateGetQueryBufferObjectui64v(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset);
+bool ValidateGetQueryBufferObjectuiv(Context *context,
+ GLuint id,
+ GLuint buffer,
+ GLenum pname,
+ GLintptr offset);
+bool ValidateGetTextureImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels);
+bool ValidateGetTextureLevelParameterfv(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+bool ValidateGetTextureLevelParameteriv(Context *context,
+ GLuint texture,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetTextureParameterIiv(Context *context, GLuint texture, GLenum pname, GLint *params);
+bool ValidateGetTextureParameterIuiv(Context *context,
+ GLuint texture,
+ GLenum pname,
+ GLuint *params);
+bool ValidateGetTextureParameterfv(Context *context, GLuint texture, GLenum pname, GLfloat *params);
+bool ValidateGetTextureParameteriv(Context *context, GLuint texture, GLenum pname, GLint *params);
+bool ValidateGetTextureSubImage(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels);
+bool ValidateGetTransformFeedbacki64_v(Context *context,
+ GLuint xfb,
+ GLenum pname,
+ GLuint index,
+ GLint64 *param);
+bool ValidateGetTransformFeedbacki_v(Context *context,
+ GLuint xfb,
+ GLenum pname,
+ GLuint index,
+ GLint *param);
+bool ValidateGetTransformFeedbackiv(Context *context, GLuint xfb, GLenum pname, GLint *param);
+bool ValidateGetVertexArrayIndexed64iv(Context *context,
+ GLuint vaobj,
+ GLuint index,
+ GLenum pname,
+ GLint64 *param);
+bool ValidateGetVertexArrayIndexediv(Context *context,
+ GLuint vaobj,
+ GLuint index,
+ GLenum pname,
+ GLint *param);
+bool ValidateGetVertexArrayiv(Context *context, GLuint vaobj, GLenum pname, GLint *param);
+bool ValidateGetnColorTable(Context *context,
+ GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *table);
+bool ValidateGetnCompressedTexImage(Context *context,
+ GLenum target,
+ GLint lod,
+ GLsizei bufSize,
+ void *pixels);
+bool ValidateGetnConvolutionFilter(Context *context,
+ GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *image);
+bool ValidateGetnHistogram(Context *context,
+ GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *values);
+bool ValidateGetnMapdv(Context *context, GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
+bool ValidateGetnMapfv(Context *context, GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
+bool ValidateGetnMapiv(Context *context, GLenum target, GLenum query, GLsizei bufSize, GLint *v);
+bool ValidateGetnMinmax(Context *context,
+ GLenum target,
+ GLboolean reset,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *values);
+bool ValidateGetnPixelMapfv(Context *context, GLenum map, GLsizei bufSize, GLfloat *values);
+bool ValidateGetnPixelMapuiv(Context *context, GLenum map, GLsizei bufSize, GLuint *values);
+bool ValidateGetnPixelMapusv(Context *context, GLenum map, GLsizei bufSize, GLushort *values);
+bool ValidateGetnPolygonStipple(Context *context, GLsizei bufSize, GLubyte *pattern);
+bool ValidateGetnSeparableFilter(Context *context,
+ GLenum target,
+ GLenum format,
+ GLenum type,
+ GLsizei rowBufSize,
+ void *row,
+ GLsizei columnBufSize,
+ void *column,
+ void *span);
+bool ValidateGetnTexImage(Context *context,
+ GLenum target,
+ GLint level,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *pixels);
+bool ValidateGetnUniformdv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLdouble *params);
+bool ValidateGetnUniformfv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params);
+bool ValidateGetnUniformiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params);
+bool ValidateGetnUniformuiv(Context *context,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLuint *params);
+bool ValidateInvalidateNamedFramebufferData(Context *context,
+ GLuint framebuffer,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+bool ValidateInvalidateNamedFramebufferSubData(Context *context,
+ GLuint framebuffer,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+bool ValidateMapNamedBuffer(Context *context, GLuint buffer, GLenum access);
+bool ValidateMapNamedBufferRange(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+bool ValidateNamedBufferData(Context *context,
+ GLuint buffer,
+ GLsizeiptr size,
+ const void *data,
+ GLenum usage);
+bool ValidateNamedBufferStorage(Context *context,
+ GLuint buffer,
+ GLsizeiptr size,
+ const void *data,
+ GLbitfield flags);
+bool ValidateNamedBufferSubData(Context *context,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data);
+bool ValidateNamedFramebufferDrawBuffer(Context *context, GLuint framebuffer, GLenum buf);
+bool ValidateNamedFramebufferDrawBuffers(Context *context,
+ GLuint framebuffer,
+ GLsizei n,
+ const GLenum *bufs);
+bool ValidateNamedFramebufferParameteri(Context *context,
+ GLuint framebuffer,
+ GLenum pname,
+ GLint param);
+bool ValidateNamedFramebufferReadBuffer(Context *context, GLuint framebuffer, GLenum src);
+bool ValidateNamedFramebufferRenderbuffer(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+bool ValidateNamedFramebufferTexture(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLuint texture,
+ GLint level);
+bool ValidateNamedFramebufferTextureLayer(Context *context,
+ GLuint framebuffer,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer);
+bool ValidateNamedRenderbufferStorage(Context *context,
+ GLuint renderbuffer,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateNamedRenderbufferStorageMultisample(Context *context,
+ GLuint renderbuffer,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateReadnPixels(Context *context,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data);
+bool ValidateTextureBarrier(Context *context);
+bool ValidateTextureBuffer(Context *context, GLuint texture, GLenum internalformat, GLuint buffer);
+bool ValidateTextureBufferRange(Context *context,
+ GLuint texture,
+ GLenum internalformat,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+bool ValidateTextureParameterIiv(Context *context,
+ GLuint texture,
+ GLenum pname,
+ const GLint *params);
+bool ValidateTextureParameterIuiv(Context *context,
+ GLuint texture,
+ GLenum pname,
+ const GLuint *params);
+bool ValidateTextureParameterf(Context *context, GLuint texture, GLenum pname, GLfloat param);
+bool ValidateTextureParameterfv(Context *context,
+ GLuint texture,
+ GLenum pname,
+ const GLfloat *param);
+bool ValidateTextureParameteri(Context *context, GLuint texture, GLenum pname, GLint param);
+bool ValidateTextureParameteriv(Context *context, GLuint texture, GLenum pname, const GLint *param);
+bool ValidateTextureStorage1D(Context *context,
+ GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width);
+bool ValidateTextureStorage2D(Context *context,
+ GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+bool ValidateTextureStorage2DMultisample(Context *context,
+ GLuint texture,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+bool ValidateTextureStorage3D(Context *context,
+ GLuint texture,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+bool ValidateTextureStorage3DMultisample(Context *context,
+ GLuint texture,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations);
+bool ValidateTextureSubImage1D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLsizei width,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTextureSubImage2D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTextureSubImage3D(Context *context,
+ GLuint texture,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+bool ValidateTransformFeedbackBufferBase(Context *context, GLuint xfb, GLuint index, GLuint buffer);
+bool ValidateTransformFeedbackBufferRange(Context *context,
+ GLuint xfb,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+bool ValidateUnmapNamedBuffer(Context *context, GLuint buffer);
+bool ValidateVertexArrayAttribBinding(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLuint bindingindex);
+bool ValidateVertexArrayAttribFormat(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset);
+bool ValidateVertexArrayAttribIFormat(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset);
+bool ValidateVertexArrayAttribLFormat(Context *context,
+ GLuint vaobj,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset);
+bool ValidateVertexArrayBindingDivisor(Context *context,
+ GLuint vaobj,
+ GLuint bindingindex,
+ GLuint divisor);
+bool ValidateVertexArrayElementBuffer(Context *context, GLuint vaobj, GLuint buffer);
+bool ValidateVertexArrayVertexBuffer(Context *context,
+ GLuint vaobj,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride);
+bool ValidateVertexArrayVertexBuffers(Context *context,
+ GLuint vaobj,
+ GLuint first,
+ GLsizei count,
+ const GLuint *buffers,
+ const GLintptr *offsets,
+ const GLsizei *strides);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL45_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL46.cpp b/gfx/angle/checkout/src/libANGLE/validationGL46.cpp
new file mode 100644
index 0000000000..2c134f880b
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL46.cpp
@@ -0,0 +1,50 @@
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// validationGL46.cpp: Validation functions for OpenGL 4.6 entry point parameters
+
+#include "libANGLE/validationGL46_autogen.h"
+
+namespace gl
+{
+
+bool ValidateMultiDrawArraysIndirectCount(Context *context,
+ GLenum mode,
+ const void *indirect,
+ GLintptr drawcount,
+ GLsizei maxdrawcount,
+ GLsizei stride)
+{
+ return true;
+}
+
+bool ValidateMultiDrawElementsIndirectCount(Context *context,
+ GLenum mode,
+ GLenum type,
+ const void *indirect,
+ GLintptr drawcount,
+ GLsizei maxdrawcount,
+ GLsizei stride)
+{
+ return true;
+}
+
+bool ValidatePolygonOffsetClamp(Context *context, GLfloat factor, GLfloat units, GLfloat clamp)
+{
+ return true;
+}
+
+bool ValidateSpecializeShader(Context *context,
+ GLuint shader,
+ const GLchar *pEntryPoint,
+ GLuint numSpecializationConstants,
+ const GLuint *pConstantIndex,
+ const GLuint *pConstantValue)
+{
+ return true;
+}
+
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL46_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL46_autogen.h
new file mode 100644
index 0000000000..1bb5ad7711
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL46_autogen.h
@@ -0,0 +1,42 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL46_autogen.h:
+// Validation functions for the OpenGL 4.6 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL46_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL46_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateMultiDrawArraysIndirectCount(Context *context,
+ GLenum mode,
+ const void *indirect,
+ GLintptr drawcount,
+ GLsizei maxdrawcount,
+ GLsizei stride);
+bool ValidateMultiDrawElementsIndirectCount(Context *context,
+ GLenum mode,
+ GLenum type,
+ const void *indirect,
+ GLintptr drawcount,
+ GLsizei maxdrawcount,
+ GLsizei stride);
+bool ValidatePolygonOffsetClamp(Context *context, GLfloat factor, GLfloat units, GLfloat clamp);
+bool ValidateSpecializeShader(Context *context,
+ GLuint shader,
+ const GLchar *pEntryPoint,
+ GLuint numSpecializationConstants,
+ const GLuint *pConstantIndex,
+ const GLuint *pConstantValue);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL46_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libANGLE/validationGL4_autogen.h b/gfx/angle/checkout/src/libANGLE/validationGL4_autogen.h
new file mode 100644
index 0000000000..af433503e5
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/validationGL4_autogen.h
@@ -0,0 +1,143 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and wgl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// validationGL4_autogen.h:
+// Validation functions for the OpenGL 4.0 entry points.
+
+#ifndef LIBANGLE_VALIDATION_GL4_AUTOGEN_H_
+#define LIBANGLE_VALIDATION_GL4_AUTOGEN_H_
+
+#include "common/PackedEnums.h"
+
+namespace gl
+{
+class Context;
+
+bool ValidateBeginQueryIndexed(Context *context, GLenum target, GLuint index, GLuint id);
+bool ValidateBlendEquationSeparatei(Context *context, GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+bool ValidateBlendEquationi(Context *context, GLuint buf, GLenum mode);
+bool ValidateBlendFuncSeparatei(Context *context,
+ GLuint buf,
+ GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha);
+bool ValidateBlendFunci(Context *context, GLuint buf, GLenum src, GLenum dst);
+bool ValidateDrawTransformFeedback(Context *context, GLenum mode, GLuint id);
+bool ValidateDrawTransformFeedbackStream(Context *context, GLenum mode, GLuint id, GLuint stream);
+bool ValidateEndQueryIndexed(Context *context, GLenum target, GLuint index);
+bool ValidateGetActiveSubroutineName(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *name);
+bool ValidateGetActiveSubroutineUniformName(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *name);
+bool ValidateGetActiveSubroutineUniformiv(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLuint index,
+ GLenum pname,
+ GLint *values);
+bool ValidateGetProgramStageiv(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ GLenum pname,
+ GLint *values);
+bool ValidateGetQueryIndexediv(Context *context,
+ GLenum target,
+ GLuint index,
+ GLenum pname,
+ GLint *params);
+bool ValidateGetSubroutineIndex(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ const GLchar *name);
+bool ValidateGetSubroutineUniformLocation(Context *context,
+ GLuint program,
+ GLenum shadertype,
+ const GLchar *name);
+bool ValidateGetUniformSubroutineuiv(Context *context,
+ GLenum shadertype,
+ GLint location,
+ GLuint *params);
+bool ValidateGetUniformdv(Context *context, GLuint program, GLint location, GLdouble *params);
+bool ValidateMinSampleShading(Context *context, GLfloat value);
+bool ValidatePatchParameterfv(Context *context, GLenum pname, const GLfloat *values);
+bool ValidatePatchParameteri(Context *context, GLenum pname, GLint value);
+bool ValidateUniform1d(Context *context, GLint location, GLdouble x);
+bool ValidateUniform1dv(Context *context, GLint location, GLsizei count, const GLdouble *value);
+bool ValidateUniform2d(Context *context, GLint location, GLdouble x, GLdouble y);
+bool ValidateUniform2dv(Context *context, GLint location, GLsizei count, const GLdouble *value);
+bool ValidateUniform3d(Context *context, GLint location, GLdouble x, GLdouble y, GLdouble z);
+bool ValidateUniform3dv(Context *context, GLint location, GLsizei count, const GLdouble *value);
+bool ValidateUniform4d(Context *context,
+ GLint location,
+ GLdouble x,
+ GLdouble y,
+ GLdouble z,
+ GLdouble w);
+bool ValidateUniform4dv(Context *context, GLint location, GLsizei count, const GLdouble *value);
+bool ValidateUniformMatrix2dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix2x3dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix2x4dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix3dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix3x2dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix3x4dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix4dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix4x2dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformMatrix4x3dv(Context *context,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLdouble *value);
+bool ValidateUniformSubroutinesuiv(Context *context,
+ GLenum shadertype,
+ GLsizei count,
+ const GLuint *indices);
+} // namespace gl
+
+#endif // LIBANGLE_VALIDATION_GL4_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libEGL/egl_loader_autogen.cpp b/gfx/angle/checkout/src/libEGL/egl_loader_autogen.cpp
new file mode 100644
index 0000000000..0e622e63c5
--- /dev/null
+++ b/gfx/angle/checkout/src/libEGL/egl_loader_autogen.cpp
@@ -0,0 +1,261 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_loader.py using data from egl.xml and egl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// egl_loader_autogen.cpp:
+// Simple EGL function loader.
+
+#include "egl_loader_autogen.h"
+
+PFNEGLCHOOSECONFIGPROC EGL_ChooseConfig;
+PFNEGLCOPYBUFFERSPROC EGL_CopyBuffers;
+PFNEGLCREATECONTEXTPROC EGL_CreateContext;
+PFNEGLCREATEPBUFFERSURFACEPROC EGL_CreatePbufferSurface;
+PFNEGLCREATEPIXMAPSURFACEPROC EGL_CreatePixmapSurface;
+PFNEGLCREATEWINDOWSURFACEPROC EGL_CreateWindowSurface;
+PFNEGLDESTROYCONTEXTPROC EGL_DestroyContext;
+PFNEGLDESTROYSURFACEPROC EGL_DestroySurface;
+PFNEGLGETCONFIGATTRIBPROC EGL_GetConfigAttrib;
+PFNEGLGETCONFIGSPROC EGL_GetConfigs;
+PFNEGLGETCURRENTDISPLAYPROC EGL_GetCurrentDisplay;
+PFNEGLGETCURRENTSURFACEPROC EGL_GetCurrentSurface;
+PFNEGLGETDISPLAYPROC EGL_GetDisplay;
+PFNEGLGETERRORPROC EGL_GetError;
+PFNEGLGETPROCADDRESSPROC EGL_GetProcAddress;
+PFNEGLINITIALIZEPROC EGL_Initialize;
+PFNEGLMAKECURRENTPROC EGL_MakeCurrent;
+PFNEGLQUERYCONTEXTPROC EGL_QueryContext;
+PFNEGLQUERYSTRINGPROC EGL_QueryString;
+PFNEGLQUERYSURFACEPROC EGL_QuerySurface;
+PFNEGLSWAPBUFFERSPROC EGL_SwapBuffers;
+PFNEGLTERMINATEPROC EGL_Terminate;
+PFNEGLWAITGLPROC EGL_WaitGL;
+PFNEGLWAITNATIVEPROC EGL_WaitNative;
+PFNEGLBINDTEXIMAGEPROC EGL_BindTexImage;
+PFNEGLRELEASETEXIMAGEPROC EGL_ReleaseTexImage;
+PFNEGLSURFACEATTRIBPROC EGL_SurfaceAttrib;
+PFNEGLSWAPINTERVALPROC EGL_SwapInterval;
+PFNEGLBINDAPIPROC EGL_BindAPI;
+PFNEGLQUERYAPIPROC EGL_QueryAPI;
+PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC EGL_CreatePbufferFromClientBuffer;
+PFNEGLRELEASETHREADPROC EGL_ReleaseThread;
+PFNEGLWAITCLIENTPROC EGL_WaitClient;
+PFNEGLGETCURRENTCONTEXTPROC EGL_GetCurrentContext;
+PFNEGLCREATESYNCPROC EGL_CreateSync;
+PFNEGLDESTROYSYNCPROC EGL_DestroySync;
+PFNEGLCLIENTWAITSYNCPROC EGL_ClientWaitSync;
+PFNEGLGETSYNCATTRIBPROC EGL_GetSyncAttrib;
+PFNEGLCREATEIMAGEPROC EGL_CreateImage;
+PFNEGLDESTROYIMAGEPROC EGL_DestroyImage;
+PFNEGLGETPLATFORMDISPLAYPROC EGL_GetPlatformDisplay;
+PFNEGLCREATEPLATFORMWINDOWSURFACEPROC EGL_CreatePlatformWindowSurface;
+PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC EGL_CreatePlatformPixmapSurface;
+PFNEGLWAITSYNCPROC EGL_WaitSync;
+PFNEGLSETBLOBCACHEFUNCSANDROIDPROC EGL_SetBlobCacheFuncsANDROID;
+PFNEGLGETCOMPOSITORTIMINGANDROIDPROC EGL_GetCompositorTimingANDROID;
+PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC EGL_GetCompositorTimingSupportedANDROID;
+PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC EGL_GetFrameTimestampSupportedANDROID;
+PFNEGLGETFRAMETIMESTAMPSANDROIDPROC EGL_GetFrameTimestampsANDROID;
+PFNEGLGETNEXTFRAMEIDANDROIDPROC EGL_GetNextFrameIdANDROID;
+PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC EGL_GetNativeClientBufferANDROID;
+PFNEGLDUPNATIVEFENCEFDANDROIDPROC EGL_DupNativeFenceFDANDROID;
+PFNEGLPRESENTATIONTIMEANDROIDPROC EGL_PresentationTimeANDROID;
+PFNEGLCREATEDEVICEANGLEPROC EGL_CreateDeviceANGLE;
+PFNEGLRELEASEDEVICEANGLEPROC EGL_ReleaseDeviceANGLE;
+PFNEGLQUERYDISPLAYATTRIBANGLEPROC EGL_QueryDisplayAttribANGLE;
+PFNEGLQUERYSTRINGIANGLEPROC EGL_QueryStringiANGLE;
+PFNEGLPROGRAMCACHEGETATTRIBANGLEPROC EGL_ProgramCacheGetAttribANGLE;
+PFNEGLPROGRAMCACHEPOPULATEANGLEPROC EGL_ProgramCachePopulateANGLE;
+PFNEGLPROGRAMCACHEQUERYANGLEPROC EGL_ProgramCacheQueryANGLE;
+PFNEGLPROGRAMCACHERESIZEANGLEPROC EGL_ProgramCacheResizeANGLE;
+PFNEGLQUERYSURFACEPOINTERANGLEPROC EGL_QuerySurfacePointerANGLE;
+PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC EGL_CreateStreamProducerD3DTextureANGLE;
+PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC EGL_StreamPostD3DTextureANGLE;
+PFNEGLGETSYNCVALUESCHROMIUMPROC EGL_GetSyncValuesCHROMIUM;
+PFNEGLQUERYDEVICEATTRIBEXTPROC EGL_QueryDeviceAttribEXT;
+PFNEGLQUERYDEVICESTRINGEXTPROC EGL_QueryDeviceStringEXT;
+PFNEGLQUERYDISPLAYATTRIBEXTPROC EGL_QueryDisplayAttribEXT;
+PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC EGL_CreatePlatformPixmapSurfaceEXT;
+PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC EGL_CreatePlatformWindowSurfaceEXT;
+PFNEGLGETPLATFORMDISPLAYEXTPROC EGL_GetPlatformDisplayEXT;
+PFNEGLDEBUGMESSAGECONTROLKHRPROC EGL_DebugMessageControlKHR;
+PFNEGLLABELOBJECTKHRPROC EGL_LabelObjectKHR;
+PFNEGLQUERYDEBUGKHRPROC EGL_QueryDebugKHR;
+PFNEGLCLIENTWAITSYNCKHRPROC EGL_ClientWaitSyncKHR;
+PFNEGLCREATESYNCKHRPROC EGL_CreateSyncKHR;
+PFNEGLDESTROYSYNCKHRPROC EGL_DestroySyncKHR;
+PFNEGLGETSYNCATTRIBKHRPROC EGL_GetSyncAttribKHR;
+PFNEGLCREATEIMAGEKHRPROC EGL_CreateImageKHR;
+PFNEGLDESTROYIMAGEKHRPROC EGL_DestroyImageKHR;
+PFNEGLCREATESTREAMKHRPROC EGL_CreateStreamKHR;
+PFNEGLDESTROYSTREAMKHRPROC EGL_DestroyStreamKHR;
+PFNEGLQUERYSTREAMKHRPROC EGL_QueryStreamKHR;
+PFNEGLQUERYSTREAMU64KHRPROC EGL_QueryStreamu64KHR;
+PFNEGLSTREAMATTRIBKHRPROC EGL_StreamAttribKHR;
+PFNEGLSTREAMCONSUMERACQUIREKHRPROC EGL_StreamConsumerAcquireKHR;
+PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC EGL_StreamConsumerGLTextureExternalKHR;
+PFNEGLSTREAMCONSUMERRELEASEKHRPROC EGL_StreamConsumerReleaseKHR;
+PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC EGL_SwapBuffersWithDamageKHR;
+PFNEGLWAITSYNCKHRPROC EGL_WaitSyncKHR;
+PFNEGLPOSTSUBBUFFERNVPROC EGL_PostSubBufferNV;
+PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC EGL_StreamConsumerGLTextureExternalAttribsNV;
+
+namespace angle
+{
+void LoadEGL_EGL(LoadProc loadProc)
+{
+ EGL_ChooseConfig = reinterpret_cast<PFNEGLCHOOSECONFIGPROC>(loadProc("EGL_ChooseConfig"));
+ EGL_CopyBuffers = reinterpret_cast<PFNEGLCOPYBUFFERSPROC>(loadProc("EGL_CopyBuffers"));
+ EGL_CreateContext = reinterpret_cast<PFNEGLCREATECONTEXTPROC>(loadProc("EGL_CreateContext"));
+ EGL_CreatePbufferSurface =
+ reinterpret_cast<PFNEGLCREATEPBUFFERSURFACEPROC>(loadProc("EGL_CreatePbufferSurface"));
+ EGL_CreatePixmapSurface =
+ reinterpret_cast<PFNEGLCREATEPIXMAPSURFACEPROC>(loadProc("EGL_CreatePixmapSurface"));
+ EGL_CreateWindowSurface =
+ reinterpret_cast<PFNEGLCREATEWINDOWSURFACEPROC>(loadProc("EGL_CreateWindowSurface"));
+ EGL_DestroyContext = reinterpret_cast<PFNEGLDESTROYCONTEXTPROC>(loadProc("EGL_DestroyContext"));
+ EGL_DestroySurface = reinterpret_cast<PFNEGLDESTROYSURFACEPROC>(loadProc("EGL_DestroySurface"));
+ EGL_GetConfigAttrib =
+ reinterpret_cast<PFNEGLGETCONFIGATTRIBPROC>(loadProc("EGL_GetConfigAttrib"));
+ EGL_GetConfigs = reinterpret_cast<PFNEGLGETCONFIGSPROC>(loadProc("EGL_GetConfigs"));
+ EGL_GetCurrentDisplay =
+ reinterpret_cast<PFNEGLGETCURRENTDISPLAYPROC>(loadProc("EGL_GetCurrentDisplay"));
+ EGL_GetCurrentSurface =
+ reinterpret_cast<PFNEGLGETCURRENTSURFACEPROC>(loadProc("EGL_GetCurrentSurface"));
+ EGL_GetDisplay = reinterpret_cast<PFNEGLGETDISPLAYPROC>(loadProc("EGL_GetDisplay"));
+ EGL_GetError = reinterpret_cast<PFNEGLGETERRORPROC>(loadProc("EGL_GetError"));
+ EGL_GetProcAddress = reinterpret_cast<PFNEGLGETPROCADDRESSPROC>(loadProc("EGL_GetProcAddress"));
+ EGL_Initialize = reinterpret_cast<PFNEGLINITIALIZEPROC>(loadProc("EGL_Initialize"));
+ EGL_MakeCurrent = reinterpret_cast<PFNEGLMAKECURRENTPROC>(loadProc("EGL_MakeCurrent"));
+ EGL_QueryContext = reinterpret_cast<PFNEGLQUERYCONTEXTPROC>(loadProc("EGL_QueryContext"));
+ EGL_QueryString = reinterpret_cast<PFNEGLQUERYSTRINGPROC>(loadProc("EGL_QueryString"));
+ EGL_QuerySurface = reinterpret_cast<PFNEGLQUERYSURFACEPROC>(loadProc("EGL_QuerySurface"));
+ EGL_SwapBuffers = reinterpret_cast<PFNEGLSWAPBUFFERSPROC>(loadProc("EGL_SwapBuffers"));
+ EGL_Terminate = reinterpret_cast<PFNEGLTERMINATEPROC>(loadProc("EGL_Terminate"));
+ EGL_WaitGL = reinterpret_cast<PFNEGLWAITGLPROC>(loadProc("EGL_WaitGL"));
+ EGL_WaitNative = reinterpret_cast<PFNEGLWAITNATIVEPROC>(loadProc("EGL_WaitNative"));
+ EGL_BindTexImage = reinterpret_cast<PFNEGLBINDTEXIMAGEPROC>(loadProc("EGL_BindTexImage"));
+ EGL_ReleaseTexImage =
+ reinterpret_cast<PFNEGLRELEASETEXIMAGEPROC>(loadProc("EGL_ReleaseTexImage"));
+ EGL_SurfaceAttrib = reinterpret_cast<PFNEGLSURFACEATTRIBPROC>(loadProc("EGL_SurfaceAttrib"));
+ EGL_SwapInterval = reinterpret_cast<PFNEGLSWAPINTERVALPROC>(loadProc("EGL_SwapInterval"));
+ EGL_BindAPI = reinterpret_cast<PFNEGLBINDAPIPROC>(loadProc("EGL_BindAPI"));
+ EGL_QueryAPI = reinterpret_cast<PFNEGLQUERYAPIPROC>(loadProc("EGL_QueryAPI"));
+ EGL_CreatePbufferFromClientBuffer = reinterpret_cast<PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC>(
+ loadProc("EGL_CreatePbufferFromClientBuffer"));
+ EGL_ReleaseThread = reinterpret_cast<PFNEGLRELEASETHREADPROC>(loadProc("EGL_ReleaseThread"));
+ EGL_WaitClient = reinterpret_cast<PFNEGLWAITCLIENTPROC>(loadProc("EGL_WaitClient"));
+ EGL_GetCurrentContext =
+ reinterpret_cast<PFNEGLGETCURRENTCONTEXTPROC>(loadProc("EGL_GetCurrentContext"));
+ EGL_CreateSync = reinterpret_cast<PFNEGLCREATESYNCPROC>(loadProc("EGL_CreateSync"));
+ EGL_DestroySync = reinterpret_cast<PFNEGLDESTROYSYNCPROC>(loadProc("EGL_DestroySync"));
+ EGL_ClientWaitSync = reinterpret_cast<PFNEGLCLIENTWAITSYNCPROC>(loadProc("EGL_ClientWaitSync"));
+ EGL_GetSyncAttrib = reinterpret_cast<PFNEGLGETSYNCATTRIBPROC>(loadProc("EGL_GetSyncAttrib"));
+ EGL_CreateImage = reinterpret_cast<PFNEGLCREATEIMAGEPROC>(loadProc("EGL_CreateImage"));
+ EGL_DestroyImage = reinterpret_cast<PFNEGLDESTROYIMAGEPROC>(loadProc("EGL_DestroyImage"));
+ EGL_GetPlatformDisplay =
+ reinterpret_cast<PFNEGLGETPLATFORMDISPLAYPROC>(loadProc("EGL_GetPlatformDisplay"));
+ EGL_CreatePlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEPROC>(
+ loadProc("EGL_CreatePlatformWindowSurface"));
+ EGL_CreatePlatformPixmapSurface = reinterpret_cast<PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC>(
+ loadProc("EGL_CreatePlatformPixmapSurface"));
+ EGL_WaitSync = reinterpret_cast<PFNEGLWAITSYNCPROC>(loadProc("EGL_WaitSync"));
+ EGL_SetBlobCacheFuncsANDROID = reinterpret_cast<PFNEGLSETBLOBCACHEFUNCSANDROIDPROC>(
+ loadProc("EGL_SetBlobCacheFuncsANDROID"));
+ EGL_GetCompositorTimingANDROID = reinterpret_cast<PFNEGLGETCOMPOSITORTIMINGANDROIDPROC>(
+ loadProc("EGL_GetCompositorTimingANDROID"));
+ EGL_GetCompositorTimingSupportedANDROID =
+ reinterpret_cast<PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC>(
+ loadProc("EGL_GetCompositorTimingSupportedANDROID"));
+ EGL_GetFrameTimestampSupportedANDROID =
+ reinterpret_cast<PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC>(
+ loadProc("EGL_GetFrameTimestampSupportedANDROID"));
+ EGL_GetFrameTimestampsANDROID = reinterpret_cast<PFNEGLGETFRAMETIMESTAMPSANDROIDPROC>(
+ loadProc("EGL_GetFrameTimestampsANDROID"));
+ EGL_GetNextFrameIdANDROID =
+ reinterpret_cast<PFNEGLGETNEXTFRAMEIDANDROIDPROC>(loadProc("EGL_GetNextFrameIdANDROID"));
+ EGL_GetNativeClientBufferANDROID = reinterpret_cast<PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC>(
+ loadProc("EGL_GetNativeClientBufferANDROID"));
+ EGL_DupNativeFenceFDANDROID = reinterpret_cast<PFNEGLDUPNATIVEFENCEFDANDROIDPROC>(
+ loadProc("EGL_DupNativeFenceFDANDROID"));
+ EGL_PresentationTimeANDROID = reinterpret_cast<PFNEGLPRESENTATIONTIMEANDROIDPROC>(
+ loadProc("EGL_PresentationTimeANDROID"));
+ EGL_CreateDeviceANGLE =
+ reinterpret_cast<PFNEGLCREATEDEVICEANGLEPROC>(loadProc("EGL_CreateDeviceANGLE"));
+ EGL_ReleaseDeviceANGLE =
+ reinterpret_cast<PFNEGLRELEASEDEVICEANGLEPROC>(loadProc("EGL_ReleaseDeviceANGLE"));
+ EGL_QueryDisplayAttribANGLE = reinterpret_cast<PFNEGLQUERYDISPLAYATTRIBANGLEPROC>(
+ loadProc("EGL_QueryDisplayAttribANGLE"));
+ EGL_QueryStringiANGLE =
+ reinterpret_cast<PFNEGLQUERYSTRINGIANGLEPROC>(loadProc("EGL_QueryStringiANGLE"));
+ EGL_ProgramCacheGetAttribANGLE = reinterpret_cast<PFNEGLPROGRAMCACHEGETATTRIBANGLEPROC>(
+ loadProc("EGL_ProgramCacheGetAttribANGLE"));
+ EGL_ProgramCachePopulateANGLE = reinterpret_cast<PFNEGLPROGRAMCACHEPOPULATEANGLEPROC>(
+ loadProc("EGL_ProgramCachePopulateANGLE"));
+ EGL_ProgramCacheQueryANGLE =
+ reinterpret_cast<PFNEGLPROGRAMCACHEQUERYANGLEPROC>(loadProc("EGL_ProgramCacheQueryANGLE"));
+ EGL_ProgramCacheResizeANGLE = reinterpret_cast<PFNEGLPROGRAMCACHERESIZEANGLEPROC>(
+ loadProc("EGL_ProgramCacheResizeANGLE"));
+ EGL_QuerySurfacePointerANGLE = reinterpret_cast<PFNEGLQUERYSURFACEPOINTERANGLEPROC>(
+ loadProc("EGL_QuerySurfacePointerANGLE"));
+ EGL_CreateStreamProducerD3DTextureANGLE =
+ reinterpret_cast<PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC>(
+ loadProc("EGL_CreateStreamProducerD3DTextureANGLE"));
+ EGL_StreamPostD3DTextureANGLE = reinterpret_cast<PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC>(
+ loadProc("EGL_StreamPostD3DTextureANGLE"));
+ EGL_GetSyncValuesCHROMIUM =
+ reinterpret_cast<PFNEGLGETSYNCVALUESCHROMIUMPROC>(loadProc("EGL_GetSyncValuesCHROMIUM"));
+ EGL_QueryDeviceAttribEXT =
+ reinterpret_cast<PFNEGLQUERYDEVICEATTRIBEXTPROC>(loadProc("EGL_QueryDeviceAttribEXT"));
+ EGL_QueryDeviceStringEXT =
+ reinterpret_cast<PFNEGLQUERYDEVICESTRINGEXTPROC>(loadProc("EGL_QueryDeviceStringEXT"));
+ EGL_QueryDisplayAttribEXT =
+ reinterpret_cast<PFNEGLQUERYDISPLAYATTRIBEXTPROC>(loadProc("EGL_QueryDisplayAttribEXT"));
+ EGL_CreatePlatformPixmapSurfaceEXT = reinterpret_cast<PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC>(
+ loadProc("EGL_CreatePlatformPixmapSurfaceEXT"));
+ EGL_CreatePlatformWindowSurfaceEXT = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
+ loadProc("EGL_CreatePlatformWindowSurfaceEXT"));
+ EGL_GetPlatformDisplayEXT =
+ reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(loadProc("EGL_GetPlatformDisplayEXT"));
+ EGL_DebugMessageControlKHR =
+ reinterpret_cast<PFNEGLDEBUGMESSAGECONTROLKHRPROC>(loadProc("EGL_DebugMessageControlKHR"));
+ EGL_LabelObjectKHR = reinterpret_cast<PFNEGLLABELOBJECTKHRPROC>(loadProc("EGL_LabelObjectKHR"));
+ EGL_QueryDebugKHR = reinterpret_cast<PFNEGLQUERYDEBUGKHRPROC>(loadProc("EGL_QueryDebugKHR"));
+ EGL_ClientWaitSyncKHR =
+ reinterpret_cast<PFNEGLCLIENTWAITSYNCKHRPROC>(loadProc("EGL_ClientWaitSyncKHR"));
+ EGL_CreateSyncKHR = reinterpret_cast<PFNEGLCREATESYNCKHRPROC>(loadProc("EGL_CreateSyncKHR"));
+ EGL_DestroySyncKHR = reinterpret_cast<PFNEGLDESTROYSYNCKHRPROC>(loadProc("EGL_DestroySyncKHR"));
+ EGL_GetSyncAttribKHR =
+ reinterpret_cast<PFNEGLGETSYNCATTRIBKHRPROC>(loadProc("EGL_GetSyncAttribKHR"));
+ EGL_CreateImageKHR = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(loadProc("EGL_CreateImageKHR"));
+ EGL_DestroyImageKHR =
+ reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(loadProc("EGL_DestroyImageKHR"));
+ EGL_CreateStreamKHR =
+ reinterpret_cast<PFNEGLCREATESTREAMKHRPROC>(loadProc("EGL_CreateStreamKHR"));
+ EGL_DestroyStreamKHR =
+ reinterpret_cast<PFNEGLDESTROYSTREAMKHRPROC>(loadProc("EGL_DestroyStreamKHR"));
+ EGL_QueryStreamKHR = reinterpret_cast<PFNEGLQUERYSTREAMKHRPROC>(loadProc("EGL_QueryStreamKHR"));
+ EGL_QueryStreamu64KHR =
+ reinterpret_cast<PFNEGLQUERYSTREAMU64KHRPROC>(loadProc("EGL_QueryStreamu64KHR"));
+ EGL_StreamAttribKHR =
+ reinterpret_cast<PFNEGLSTREAMATTRIBKHRPROC>(loadProc("EGL_StreamAttribKHR"));
+ EGL_StreamConsumerAcquireKHR = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREKHRPROC>(
+ loadProc("EGL_StreamConsumerAcquireKHR"));
+ EGL_StreamConsumerGLTextureExternalKHR =
+ reinterpret_cast<PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC>(
+ loadProc("EGL_StreamConsumerGLTextureExternalKHR"));
+ EGL_StreamConsumerReleaseKHR = reinterpret_cast<PFNEGLSTREAMCONSUMERRELEASEKHRPROC>(
+ loadProc("EGL_StreamConsumerReleaseKHR"));
+ EGL_SwapBuffersWithDamageKHR = reinterpret_cast<PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC>(
+ loadProc("EGL_SwapBuffersWithDamageKHR"));
+ EGL_WaitSyncKHR = reinterpret_cast<PFNEGLWAITSYNCKHRPROC>(loadProc("EGL_WaitSyncKHR"));
+ EGL_PostSubBufferNV =
+ reinterpret_cast<PFNEGLPOSTSUBBUFFERNVPROC>(loadProc("EGL_PostSubBufferNV"));
+ EGL_StreamConsumerGLTextureExternalAttribsNV =
+ reinterpret_cast<PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC>(
+ loadProc("EGL_StreamConsumerGLTextureExternalAttribsNV"));
+}
+} // namespace angle
diff --git a/gfx/angle/checkout/src/libEGL/egl_loader_autogen.h b/gfx/angle/checkout/src/libEGL/egl_loader_autogen.h
new file mode 100644
index 0000000000..e6f2240ee7
--- /dev/null
+++ b/gfx/angle/checkout/src/libEGL/egl_loader_autogen.h
@@ -0,0 +1,118 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_loader.py using data from egl.xml and egl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// egl_loader_autogen.h:
+// Simple EGL function loader.
+
+#ifndef LIBEGL_EGL_LOADER_AUTOGEN_H_
+#define LIBEGL_EGL_LOADER_AUTOGEN_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+extern PFNEGLCHOOSECONFIGPROC EGL_ChooseConfig;
+extern PFNEGLCOPYBUFFERSPROC EGL_CopyBuffers;
+extern PFNEGLCREATECONTEXTPROC EGL_CreateContext;
+extern PFNEGLCREATEPBUFFERSURFACEPROC EGL_CreatePbufferSurface;
+extern PFNEGLCREATEPIXMAPSURFACEPROC EGL_CreatePixmapSurface;
+extern PFNEGLCREATEWINDOWSURFACEPROC EGL_CreateWindowSurface;
+extern PFNEGLDESTROYCONTEXTPROC EGL_DestroyContext;
+extern PFNEGLDESTROYSURFACEPROC EGL_DestroySurface;
+extern PFNEGLGETCONFIGATTRIBPROC EGL_GetConfigAttrib;
+extern PFNEGLGETCONFIGSPROC EGL_GetConfigs;
+extern PFNEGLGETCURRENTDISPLAYPROC EGL_GetCurrentDisplay;
+extern PFNEGLGETCURRENTSURFACEPROC EGL_GetCurrentSurface;
+extern PFNEGLGETDISPLAYPROC EGL_GetDisplay;
+extern PFNEGLGETERRORPROC EGL_GetError;
+extern PFNEGLGETPROCADDRESSPROC EGL_GetProcAddress;
+extern PFNEGLINITIALIZEPROC EGL_Initialize;
+extern PFNEGLMAKECURRENTPROC EGL_MakeCurrent;
+extern PFNEGLQUERYCONTEXTPROC EGL_QueryContext;
+extern PFNEGLQUERYSTRINGPROC EGL_QueryString;
+extern PFNEGLQUERYSURFACEPROC EGL_QuerySurface;
+extern PFNEGLSWAPBUFFERSPROC EGL_SwapBuffers;
+extern PFNEGLTERMINATEPROC EGL_Terminate;
+extern PFNEGLWAITGLPROC EGL_WaitGL;
+extern PFNEGLWAITNATIVEPROC EGL_WaitNative;
+extern PFNEGLBINDTEXIMAGEPROC EGL_BindTexImage;
+extern PFNEGLRELEASETEXIMAGEPROC EGL_ReleaseTexImage;
+extern PFNEGLSURFACEATTRIBPROC EGL_SurfaceAttrib;
+extern PFNEGLSWAPINTERVALPROC EGL_SwapInterval;
+extern PFNEGLBINDAPIPROC EGL_BindAPI;
+extern PFNEGLQUERYAPIPROC EGL_QueryAPI;
+extern PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC EGL_CreatePbufferFromClientBuffer;
+extern PFNEGLRELEASETHREADPROC EGL_ReleaseThread;
+extern PFNEGLWAITCLIENTPROC EGL_WaitClient;
+extern PFNEGLGETCURRENTCONTEXTPROC EGL_GetCurrentContext;
+extern PFNEGLCREATESYNCPROC EGL_CreateSync;
+extern PFNEGLDESTROYSYNCPROC EGL_DestroySync;
+extern PFNEGLCLIENTWAITSYNCPROC EGL_ClientWaitSync;
+extern PFNEGLGETSYNCATTRIBPROC EGL_GetSyncAttrib;
+extern PFNEGLCREATEIMAGEPROC EGL_CreateImage;
+extern PFNEGLDESTROYIMAGEPROC EGL_DestroyImage;
+extern PFNEGLGETPLATFORMDISPLAYPROC EGL_GetPlatformDisplay;
+extern PFNEGLCREATEPLATFORMWINDOWSURFACEPROC EGL_CreatePlatformWindowSurface;
+extern PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC EGL_CreatePlatformPixmapSurface;
+extern PFNEGLWAITSYNCPROC EGL_WaitSync;
+extern PFNEGLSETBLOBCACHEFUNCSANDROIDPROC EGL_SetBlobCacheFuncsANDROID;
+extern PFNEGLGETCOMPOSITORTIMINGANDROIDPROC EGL_GetCompositorTimingANDROID;
+extern PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC EGL_GetCompositorTimingSupportedANDROID;
+extern PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC EGL_GetFrameTimestampSupportedANDROID;
+extern PFNEGLGETFRAMETIMESTAMPSANDROIDPROC EGL_GetFrameTimestampsANDROID;
+extern PFNEGLGETNEXTFRAMEIDANDROIDPROC EGL_GetNextFrameIdANDROID;
+extern PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC EGL_GetNativeClientBufferANDROID;
+extern PFNEGLDUPNATIVEFENCEFDANDROIDPROC EGL_DupNativeFenceFDANDROID;
+extern PFNEGLPRESENTATIONTIMEANDROIDPROC EGL_PresentationTimeANDROID;
+extern PFNEGLCREATEDEVICEANGLEPROC EGL_CreateDeviceANGLE;
+extern PFNEGLRELEASEDEVICEANGLEPROC EGL_ReleaseDeviceANGLE;
+extern PFNEGLQUERYDISPLAYATTRIBANGLEPROC EGL_QueryDisplayAttribANGLE;
+extern PFNEGLQUERYSTRINGIANGLEPROC EGL_QueryStringiANGLE;
+extern PFNEGLPROGRAMCACHEGETATTRIBANGLEPROC EGL_ProgramCacheGetAttribANGLE;
+extern PFNEGLPROGRAMCACHEPOPULATEANGLEPROC EGL_ProgramCachePopulateANGLE;
+extern PFNEGLPROGRAMCACHEQUERYANGLEPROC EGL_ProgramCacheQueryANGLE;
+extern PFNEGLPROGRAMCACHERESIZEANGLEPROC EGL_ProgramCacheResizeANGLE;
+extern PFNEGLQUERYSURFACEPOINTERANGLEPROC EGL_QuerySurfacePointerANGLE;
+extern PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC EGL_CreateStreamProducerD3DTextureANGLE;
+extern PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC EGL_StreamPostD3DTextureANGLE;
+extern PFNEGLGETSYNCVALUESCHROMIUMPROC EGL_GetSyncValuesCHROMIUM;
+extern PFNEGLQUERYDEVICEATTRIBEXTPROC EGL_QueryDeviceAttribEXT;
+extern PFNEGLQUERYDEVICESTRINGEXTPROC EGL_QueryDeviceStringEXT;
+extern PFNEGLQUERYDISPLAYATTRIBEXTPROC EGL_QueryDisplayAttribEXT;
+extern PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC EGL_CreatePlatformPixmapSurfaceEXT;
+extern PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC EGL_CreatePlatformWindowSurfaceEXT;
+extern PFNEGLGETPLATFORMDISPLAYEXTPROC EGL_GetPlatformDisplayEXT;
+extern PFNEGLDEBUGMESSAGECONTROLKHRPROC EGL_DebugMessageControlKHR;
+extern PFNEGLLABELOBJECTKHRPROC EGL_LabelObjectKHR;
+extern PFNEGLQUERYDEBUGKHRPROC EGL_QueryDebugKHR;
+extern PFNEGLCLIENTWAITSYNCKHRPROC EGL_ClientWaitSyncKHR;
+extern PFNEGLCREATESYNCKHRPROC EGL_CreateSyncKHR;
+extern PFNEGLDESTROYSYNCKHRPROC EGL_DestroySyncKHR;
+extern PFNEGLGETSYNCATTRIBKHRPROC EGL_GetSyncAttribKHR;
+extern PFNEGLCREATEIMAGEKHRPROC EGL_CreateImageKHR;
+extern PFNEGLDESTROYIMAGEKHRPROC EGL_DestroyImageKHR;
+extern PFNEGLCREATESTREAMKHRPROC EGL_CreateStreamKHR;
+extern PFNEGLDESTROYSTREAMKHRPROC EGL_DestroyStreamKHR;
+extern PFNEGLQUERYSTREAMKHRPROC EGL_QueryStreamKHR;
+extern PFNEGLQUERYSTREAMU64KHRPROC EGL_QueryStreamu64KHR;
+extern PFNEGLSTREAMATTRIBKHRPROC EGL_StreamAttribKHR;
+extern PFNEGLSTREAMCONSUMERACQUIREKHRPROC EGL_StreamConsumerAcquireKHR;
+extern PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC EGL_StreamConsumerGLTextureExternalKHR;
+extern PFNEGLSTREAMCONSUMERRELEASEKHRPROC EGL_StreamConsumerReleaseKHR;
+extern PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC EGL_SwapBuffersWithDamageKHR;
+extern PFNEGLWAITSYNCKHRPROC EGL_WaitSyncKHR;
+extern PFNEGLPOSTSUBBUFFERNVPROC EGL_PostSubBufferNV;
+extern PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC
+ EGL_StreamConsumerGLTextureExternalAttribsNV;
+
+namespace angle
+{
+using GenericProc = void (*)();
+using LoadProc = GenericProc(KHRONOS_APIENTRY *)(const char *);
+void LoadEGL_EGL(LoadProc loadProc);
+} // namespace angle
+
+#endif // LIBEGL_EGL_LOADER_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libEGL/libEGL.cpp b/gfx/angle/checkout/src/libEGL/libEGL.cpp
new file mode 100644
index 0000000000..8ee1f33d1e
--- /dev/null
+++ b/gfx/angle/checkout/src/libEGL/libEGL.cpp
@@ -0,0 +1,709 @@
+//
+// 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.
+//
+
+// libEGL.cpp: Implements the exported EGL functions.
+
+#include "common/system_utils.h"
+
+#include <memory>
+
+#if defined(ANGLE_USE_EGL_LOADER)
+# include "libEGL/egl_loader_autogen.h"
+#else
+# include "libGLESv2/entry_points_egl.h"
+# include "libGLESv2/entry_points_egl_ext.h"
+#endif // defined(ANGLE_USE_EGL_LOADER)
+
+namespace
+{
+#if defined(ANGLE_USE_EGL_LOADER)
+bool gLoaded = false;
+std::unique_ptr<angle::Library> gEntryPointsLib;
+
+angle::GenericProc KHRONOS_APIENTRY GlobalLoad(const char *symbol)
+{
+ return reinterpret_cast<angle::GenericProc>(gEntryPointsLib->getSymbol(symbol));
+}
+
+void EnsureEGLLoaded()
+{
+ if (gLoaded)
+ return;
+
+ gEntryPointsLib.reset(
+ angle::OpenSharedLibrary(ANGLE_GLESV2_LIBRARY_NAME, angle::SearchType::ApplicationDir));
+ angle::LoadEGL_EGL(GlobalLoad);
+ if (!EGL_GetPlatformDisplay)
+ {
+ fprintf(stderr, "Error loading EGL entry points.\n");
+ }
+ else
+ {
+ gLoaded = true;
+ }
+}
+#else
+void EnsureEGLLoaded() {}
+#endif // defined(ANGLE_USE_EGL_LOADER)
+} // anonymous namespace
+
+extern "C" {
+
+EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy,
+ const EGLint *attrib_list,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config)
+{
+ EnsureEGLLoaded();
+ return EGL_ChooseConfig(dpy, attrib_list, configs, config_size, num_config);
+}
+
+EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLNativePixmapType target)
+{
+ EnsureEGLLoaded();
+ return EGL_CopyBuffers(dpy, surface, target);
+}
+
+EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy,
+ EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateContext(dpy, config, share_context, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy,
+ EGLConfig config,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreatePbufferSurface(dpy, config, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreatePixmapSurface(dpy, config, pixmap, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateWindowSurface(dpy, config, win, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+ EnsureEGLLoaded();
+ return EGL_DestroyContext(dpy, ctx);
+}
+
+EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+ EnsureEGLLoaded();
+ return EGL_DestroySurface(dpy, surface);
+}
+
+EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy,
+ EGLConfig config,
+ EGLint attribute,
+ EGLint *value)
+{
+ EnsureEGLLoaded();
+ return EGL_GetConfigAttrib(dpy, config, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config)
+{
+ EnsureEGLLoaded();
+ return EGL_GetConfigs(dpy, configs, config_size, num_config);
+}
+
+EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
+{
+ EnsureEGLLoaded();
+ return EGL_GetCurrentDisplay();
+}
+
+EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
+{
+ EnsureEGLLoaded();
+ return EGL_GetCurrentSurface(readdraw);
+}
+
+EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
+{
+ EnsureEGLLoaded();
+ return EGL_GetDisplay(display_id);
+}
+
+EGLint EGLAPIENTRY eglGetError(void)
+{
+ EnsureEGLLoaded();
+ return EGL_GetError();
+}
+
+EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
+{
+ EnsureEGLLoaded();
+ return EGL_Initialize(dpy, major, minor);
+}
+
+EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext ctx)
+{
+ EnsureEGLLoaded();
+ return EGL_MakeCurrent(dpy, draw, read, ctx);
+}
+
+EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLint attribute,
+ EGLint *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryContext(dpy, ctx, attribute, value);
+}
+
+const char *EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryString(dpy, name);
+}
+
+EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QuerySurface(dpy, surface, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+ EnsureEGLLoaded();
+ return EGL_SwapBuffers(dpy, surface);
+}
+
+EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
+{
+ EnsureEGLLoaded();
+ return EGL_Terminate(dpy);
+}
+
+EGLBoolean EGLAPIENTRY eglWaitGL(void)
+{
+ EnsureEGLLoaded();
+ return EGL_WaitGL();
+}
+
+EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
+{
+ EnsureEGLLoaded();
+ return EGL_WaitNative(engine);
+}
+
+EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ EnsureEGLLoaded();
+ return EGL_BindTexImage(dpy, surface, buffer);
+}
+
+EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ EnsureEGLLoaded();
+ return EGL_ReleaseTexImage(dpy, surface, buffer);
+}
+
+EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint value)
+{
+ EnsureEGLLoaded();
+ return EGL_SurfaceAttrib(dpy, surface, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+ EnsureEGLLoaded();
+ return EGL_SwapInterval(dpy, interval);
+}
+
+EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
+{
+ EnsureEGLLoaded();
+ return EGL_BindAPI(api);
+}
+
+EGLenum EGLAPIENTRY eglQueryAPI(void)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryAPI();
+}
+
+EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ EGLConfig config,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglReleaseThread(void)
+{
+ EnsureEGLLoaded();
+ return EGL_ReleaseThread();
+}
+
+EGLBoolean EGLAPIENTRY eglWaitClient(void)
+{
+ EnsureEGLLoaded();
+ return EGL_WaitClient();
+}
+
+EGLContext EGLAPIENTRY eglGetCurrentContext(void)
+{
+ EnsureEGLLoaded();
+ return EGL_GetCurrentContext();
+}
+
+EGLSync EGLAPIENTRY eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateSync(dpy, type, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglDestroySync(EGLDisplay dpy, EGLSync sync)
+{
+ EnsureEGLLoaded();
+ return EGL_DestroySync(dpy, sync);
+}
+
+EGLint EGLAPIENTRY eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
+{
+ EnsureEGLLoaded();
+ return EGL_ClientWaitSync(dpy, sync, flags, timeout);
+}
+
+EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint attribute,
+ EGLAttrib *value)
+{
+ EnsureEGLLoaded();
+ return EGL_GetSyncAttrib(dpy, sync, attribute, value);
+}
+
+EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateImage(dpy, ctx, target, buffer, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglDestroyImage(EGLDisplay dpy, EGLImage image)
+{
+ EnsureEGLLoaded();
+ return EGL_DestroyImage(dpy, image);
+}
+
+EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform,
+ void *native_display,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_GetPlatformDisplay(platform, native_display, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_window,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_pixmap,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
+{
+ EnsureEGLLoaded();
+ return EGL_WaitSync(dpy, sync, flags);
+}
+
+EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ void **value)
+{
+ EnsureEGLLoaded();
+ return EGL_QuerySurfacePointerANGLE(dpy, surface, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height)
+{
+ EnsureEGLLoaded();
+ return EGL_PostSubBufferNV(dpy, surface, x, y, width, height);
+}
+
+EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_GetPlatformDisplayEXT(platform, native_display, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_window,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreatePlatformWindowSurfaceEXT(dpy, config, native_window, attrib_list);
+}
+
+EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_pixmap,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryDisplayAttribEXT(dpy, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglQueryDisplayAttribANGLE(EGLDisplay dpy,
+ EGLint attribute,
+ EGLAttrib *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryDisplayAttribANGLE(dpy, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT(EGLDeviceEXT device,
+ EGLint attribute,
+ EGLAttrib *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryDeviceAttribEXT(device, attribute, value);
+}
+
+const char *EGLAPIENTRY eglQueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryDeviceStringEXT(device, name);
+}
+
+EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateImageKHR(dpy, ctx, target, buffer, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
+{
+ EnsureEGLLoaded();
+ return EGL_DestroyImageKHR(dpy, image);
+}
+
+EGLDeviceEXT EGLAPIENTRY eglCreateDeviceANGLE(EGLint device_type,
+ void *native_device,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateDeviceANGLE(device_type, native_device, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE(EGLDeviceEXT device)
+{
+ EnsureEGLLoaded();
+ return EGL_ReleaseDeviceANGLE(device);
+}
+
+__eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
+{
+ EnsureEGLLoaded();
+ return EGL_GetProcAddress(procname);
+}
+
+EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateStreamKHR(dpy, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ EnsureEGLLoaded();
+ return EGL_DestroyStreamKHR(dpy, stream);
+}
+
+EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLint value)
+{
+ EnsureEGLLoaded();
+ return EGL_StreamAttribKHR(dpy, stream, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLint *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryStreamKHR(dpy, stream, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLuint64KHR *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryStreamu64KHR(dpy, stream, attribute, value);
+}
+
+EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ EnsureEGLLoaded();
+ return EGL_StreamConsumerGLTextureExternalKHR(dpy, stream);
+}
+
+EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ EnsureEGLLoaded();
+ return EGL_StreamConsumerAcquireKHR(dpy, stream);
+}
+
+EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ EnsureEGLLoaded();
+ return EGL_StreamConsumerReleaseKHR(dpy, stream);
+}
+
+EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_StreamConsumerGLTextureExternalAttribsNV(dpy, stream, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglCreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_CreateStreamProducerD3DTextureANGLE(dpy, stream, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglStreamPostD3DTextureANGLE(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ void *texture,
+ const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_StreamPostD3DTextureANGLE(dpy, stream, texture, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *ust,
+ EGLuint64KHR *msc,
+ EGLuint64KHR *sbc)
+{
+ EnsureEGLLoaded();
+ return EGL_GetSyncValuesCHROMIUM(dpy, surface, ust, msc, sbc);
+}
+
+EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint *rects,
+ EGLint n_rects)
+{
+ EnsureEGLLoaded();
+ return EGL_SwapBuffersWithDamageKHR(dpy, surface, rects, n_rects);
+}
+
+EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLnsecsANDROID time)
+{
+ EnsureEGLLoaded();
+ return EGL_PresentationTimeANDROID(dpy, surface, time);
+}
+
+EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
+{
+ EnsureEGLLoaded();
+ return EGL_ProgramCacheGetAttribANGLE(dpy, attrib);
+}
+
+void EGLAPIENTRY eglProgramCacheQueryANGLE(EGLDisplay dpy,
+ EGLint index,
+ void *key,
+ EGLint *keysize,
+ void *binary,
+ EGLint *binarysize)
+{
+ EGL_ProgramCacheQueryANGLE(dpy, index, key, keysize, binary, binarysize);
+}
+
+void EGLAPIENTRY eglProgramCachePopulateANGLE(EGLDisplay dpy,
+ const void *key,
+ EGLint keysize,
+ const void *binary,
+ EGLint binarysize)
+{
+ EGL_ProgramCachePopulateANGLE(dpy, key, keysize, binary, binarysize);
+}
+
+EGLint EGLAPIENTRY eglProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLenum mode)
+{
+ EnsureEGLLoaded();
+ return EGL_ProgramCacheResizeANGLE(dpy, limit, mode);
+}
+
+EGLint EGLAPIENTRY eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list)
+{
+ EnsureEGLLoaded();
+ return EGL_DebugMessageControlKHR(callback, attrib_list);
+}
+
+EGLBoolean EGLAPIENTRY eglQueryDebugKHR(EGLint attribute, EGLAttrib *value)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryDebugKHR(attribute, value);
+}
+
+EGLint EGLAPIENTRY eglLabelObjectKHR(EGLDisplay dpy,
+ EGLenum objectType,
+ EGLObjectKHR object,
+ EGLLabelKHR label)
+{
+ EnsureEGLLoaded();
+ return EGL_LabelObjectKHR(dpy, objectType, object, label);
+}
+
+void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy,
+ EGLSetBlobFuncANDROID set,
+ EGLGetBlobFuncANDROID get)
+{
+ EnsureEGLLoaded();
+ return EGL_SetBlobCacheFuncsANDROID(dpy, set, get);
+}
+
+EGLBoolean EGLAPIENTRY eglGetCompositorTimingSupportedANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint name)
+{
+ EnsureEGLLoaded();
+ return EGL_GetCompositorTimingSupportedANDROID(dpy, surface, name);
+}
+
+EGLBoolean EGLAPIENTRY eglGetCompositorTimingANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values)
+{
+ EnsureEGLLoaded();
+ return EGL_GetCompositorTimingANDROID(dpy, surface, numTimestamps, names, values);
+}
+
+EGLBoolean EGLAPIENTRY eglGetNextFrameIdANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *frameId)
+{
+ EnsureEGLLoaded();
+ return EGL_GetNextFrameIdANDROID(dpy, surface, frameId);
+}
+
+EGLBoolean EGLAPIENTRY eglGetFrameTimestampSupportedANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint timestamp)
+{
+ EnsureEGLLoaded();
+ return EGL_GetFrameTimestampSupportedANDROID(dpy, surface, timestamp);
+}
+
+EGLBoolean EGLAPIENTRY eglGetFrameTimestampsANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values)
+{
+ EnsureEGLLoaded();
+ return EGL_GetFrameTimestampsANDROID(dpy, surface, frameId, numTimestamps, timestamps, values);
+}
+
+const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index)
+{
+ EnsureEGLLoaded();
+ return EGL_QueryStringiANGLE(dpy, name, index);
+}
+
+EGLClientBuffer EGLAPIENTRY eglGetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer)
+{
+ EnsureEGLLoaded();
+ return EGL_GetNativeClientBufferANDROID(buffer);
+}
+
+EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync)
+{
+ EnsureEGLLoaded();
+ return EGL_DupNativeFenceFDANDROID(dpy, sync);
+}
+
+} // extern "C"
diff --git a/gfx/angle/checkout/src/libEGL/libEGL.def b/gfx/angle/checkout/src/libEGL/libEGL.def
new file mode 100644
index 0000000000..630c7b69c0
--- /dev/null
+++ b/gfx/angle/checkout/src/libEGL/libEGL.def
@@ -0,0 +1,88 @@
+LIBRARY libEGL
+EXPORTS
+ eglBindAPI @14
+ eglBindTexImage @20
+ eglChooseConfig @7
+ eglCopyBuffers @33
+ eglCreateContext @23
+ eglCreatePbufferFromClientBuffer @18
+ eglCreatePbufferSurface @10
+ eglCreatePixmapSurface @11
+ eglCreateWindowSurface @9
+ eglDestroyContext @24
+ eglDestroySurface @12
+ eglGetConfigAttrib @8
+ eglGetConfigs @6
+ eglGetCurrentContext @26
+ eglGetCurrentDisplay @28
+ eglGetCurrentSurface @27
+ eglGetDisplay @2
+ eglGetError @1
+ eglGetProcAddress @34
+ eglInitialize @3
+ eglMakeCurrent @25
+ eglQueryAPI @15
+ eglQueryContext @29
+ eglQueryString @5
+ eglQuerySurface @13
+ eglReleaseTexImage @21
+ eglReleaseThread @17
+ eglSurfaceAttrib @19
+ eglSwapBuffers @32
+ eglSwapInterval @22
+ eglTerminate @4
+ eglWaitClient @16
+ eglWaitGL @30
+ eglWaitNative @31
+
+ ; Extensions
+ eglGetPlatformDisplayEXT @35
+ eglQuerySurfacePointerANGLE @36
+ eglPostSubBufferNV @37
+ eglQueryDisplayAttribEXT @48
+ eglQueryDeviceAttribEXT @49
+ eglQueryDeviceStringEXT @50
+ eglCreateImageKHR @51
+ eglDestroyImageKHR @52
+ eglCreateDeviceANGLE @53
+ eglReleaseDeviceANGLE @54
+ eglCreateStreamKHR @55
+ eglDestroyStreamKHR @56
+ eglStreamAttribKHR @57
+ eglQueryStreamKHR @58
+ eglQueryStreamu64KHR @59
+ eglStreamConsumerGLTextureExternalKHR @60
+ eglStreamConsumerAcquireKHR @61
+ eglStreamConsumerReleaseKHR @62
+ eglStreamConsumerGLTextureExternalAttribsNV @63
+ eglCreateStreamProducerD3DTextureANGLE @64
+ eglStreamPostD3DTextureANGLE @65
+ eglGetSyncValuesCHROMIUM @66
+ eglSwapBuffersWithDamageKHR @67
+ eglProgramCacheGetAttribANGLE @68
+ eglProgramCachePopulateANGLE @69
+ eglProgramCacheQueryANGLE @70
+ eglProgramCacheResizeANGLE @71
+ eglCreatePlatformWindowSurfaceEXT @72
+ eglCreatePlatformPixmapSurfaceEXT @73
+ eglPresentationTimeANDROID @74
+ eglDebugMessageControlKHR @75
+ eglQueryDebugKHR @76
+ eglLabelObjectKHR @77
+ eglSetBlobCacheFuncsANDROID @78
+ eglQueryDisplayAttribANGLE @79
+ eglQueryStringiANGLE @80
+ eglGetNativeClientBufferANDROID @81
+ eglDupNativeFenceFDANDROID @82
+
+ ; 1.5 entry points
+ eglCreateSync @38
+ eglDestroySync @39
+ eglClientWaitSync @40
+ eglGetSyncAttrib @41
+ eglCreateImage @42
+ eglDestroyImage @43
+ eglGetPlatformDisplay @44
+ eglCreatePlatformWindowSurface @45
+ eglCreatePlatformPixmapSurface @46
+ eglWaitSync @47
diff --git a/gfx/angle/checkout/src/libEGL/libEGL.rc b/gfx/angle/checkout/src/libEGL/libEGL.rc
new file mode 100644
index 0000000000..52d92676a4
--- /dev/null
+++ b/gfx/angle/checkout/src/libEGL/libEGL.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include <windows.h>
+#include "../common/version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "#include ""../common/version.h""\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,ANGLE_REVISION,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,ANGLE_REVISION,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library"
+ VALUE "FileVersion", ANGLE_VERSION_STRING
+ VALUE "InternalName", "libEGL"
+ VALUE "LegalCopyright", "Copyright (C) 2015 Google Inc."
+ VALUE "OriginalFilename", "libEGL.dll"
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
+ VALUE "ProductName", "ANGLE libEGL Dynamic Link Library"
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/gfx/angle/checkout/src/libEGL/resource.h b/gfx/angle/checkout/src/libEGL/resource.h
new file mode 100644
index 0000000000..018d085c02
--- /dev/null
+++ b/gfx/angle/checkout/src/libEGL/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by libEGL.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+# ifndef APSTUDIO_READONLY_SYMBOLS
+# define _APS_NEXT_RESOURCE_VALUE 101
+# define _APS_NEXT_COMMAND_VALUE 40001
+# define _APS_NEXT_CONTROL_VALUE 1001
+# define _APS_NEXT_SYMED_VALUE 101
+# endif
+#endif
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp
new file mode 100644
index 0000000000..ba0ab78e33
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp
@@ -0,0 +1,1096 @@
+//
+// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// entry_points_egl.cpp : Implements the EGL entry points.
+
+#include "libGLESv2/entry_points_egl.h"
+
+#include "common/debug.h"
+#include "common/utilities.h"
+#include "common/version.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/EGLSync.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Texture.h"
+#include "libANGLE/Thread.h"
+#include "libANGLE/queryutils.h"
+#include "libANGLE/validationEGL.h"
+#include "libGLESv2/global_state.h"
+#include "libGLESv2/proc_table_egl.h"
+
+using namespace egl;
+
+namespace
+{
+
+bool CompareProc(const ProcEntry &a, const char *b)
+{
+ return strcmp(a.first, b) < 0;
+}
+
+void ClipConfigs(const std::vector<const Config *> &filteredConfigs,
+ EGLConfig *output_configs,
+ EGLint config_size,
+ EGLint *num_config)
+{
+ EGLint result_size = static_cast<EGLint>(filteredConfigs.size());
+ if (output_configs)
+ {
+ result_size = std::max(std::min(result_size, config_size), 0);
+ for (EGLint i = 0; i < result_size; i++)
+ {
+ output_configs[i] = const_cast<Config *>(filteredConfigs[i]);
+ }
+ }
+ *num_config = result_size;
+}
+} // anonymous namespace
+
+extern "C" {
+// EGL 1.0
+EGLint EGLAPIENTRY EGL_GetError(void)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("()");
+ Thread *thread = egl::GetCurrentThread();
+
+ EGLint error = thread->getError();
+ thread->setSuccess();
+ return error;
+}
+
+EGLDisplay EGLAPIENTRY EGL_GetDisplay(EGLNativeDisplayType display_id)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLNativeDisplayType display_id = 0x%016" PRIxPTR ")", (uintptr_t)display_id);
+
+ return egl::Display::GetDisplayFromNativeDisplay(display_id, AttributeMap());
+}
+
+EGLBoolean EGLAPIENTRY EGL_Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint *major = 0x%016" PRIxPTR
+ ", EGLint *minor = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)major, (uintptr_t)minor);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ ANGLE_EGL_TRY_RETURN(thread, ValidateInitialize(display), "eglInitialize",
+ GetDisplayIfValid(display), EGL_FALSE);
+
+ ANGLE_EGL_TRY_RETURN(thread, display->initialize(), "eglInitialize", GetDisplayIfValid(display),
+ EGL_FALSE);
+
+ if (major)
+ *major = 1;
+ if (minor)
+ *minor = 4;
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_Terminate(EGLDisplay dpy)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ")", (uintptr_t)dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ ANGLE_EGL_TRY_RETURN(thread, ValidateTerminate(display), "eglTerminate",
+ GetDisplayIfValid(display), EGL_FALSE);
+
+ ANGLE_EGL_TRY_RETURN(thread, display->makeCurrent(thread, nullptr, nullptr, nullptr),
+ "eglTerminate", GetDisplayIfValid(display), EGL_FALSE);
+ SetContextCurrent(thread, nullptr);
+ ANGLE_EGL_TRY_RETURN(thread, display->terminate(thread), "eglTerminate",
+ GetDisplayIfValid(display), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+const char *EGLAPIENTRY EGL_QueryString(EGLDisplay dpy, EGLint name)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint name = %d)", (uintptr_t)dpy, name);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ if (!(display == EGL_NO_DISPLAY && name == EGL_EXTENSIONS))
+ {
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDisplay(display), "eglQueryString",
+ GetDisplayIfValid(display), nullptr);
+ }
+
+ const char *result;
+ switch (name)
+ {
+ case EGL_CLIENT_APIS:
+ result = "OpenGL_ES";
+ break;
+ case EGL_EXTENSIONS:
+ if (display == EGL_NO_DISPLAY)
+ {
+ result = egl::Display::GetClientExtensionString().c_str();
+ }
+ else
+ {
+ result = display->getExtensionString().c_str();
+ }
+ break;
+ case EGL_VENDOR:
+ result = display->getVendorString().c_str();
+ break;
+ case EGL_VERSION:
+ result = "1.4 (ANGLE " ANGLE_VERSION_STRING ")";
+ break;
+ default:
+ thread->setError(EglBadParameter(), GetDebug(), "eglQueryString",
+ GetDisplayIfValid(display));
+ return nullptr;
+ }
+
+ thread->setSuccess();
+ return result;
+}
+
+EGLBoolean EGLAPIENTRY EGL_GetConfigs(EGLDisplay dpy,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig *configs = 0x%016" PRIxPTR
+ ", "
+ "EGLint config_size = %d, EGLint *num_config = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)configs, config_size, (uintptr_t)num_config);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateGetConfigs(display, config_size, num_config),
+ "eglGetConfigs", GetDisplayIfValid(display), EGL_FALSE);
+
+ ClipConfigs(display->getConfigs(AttributeMap()), configs, config_size, num_config);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_ChooseConfig(EGLDisplay dpy,
+ const EGLint *attrib_list,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", const EGLint *attrib_list = 0x%016" PRIxPTR
+ ", "
+ "EGLConfig *configs = 0x%016" PRIxPTR
+ ", EGLint config_size = %d, EGLint *num_config = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)attrib_list, (uintptr_t)configs, config_size,
+ (uintptr_t)num_config);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ AttributeMap attribMap = AttributeMap::CreateFromIntArray(attrib_list);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateChooseConfig(display, attribMap, config_size, num_config),
+ "eglChooseConfig", GetDisplayIfValid(display), EGL_FALSE);
+
+ ClipConfigs(display->chooseConfig(attribMap), configs, config_size, num_config);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_GetConfigAttrib(EGLDisplay dpy,
+ EGLConfig config,
+ EGLint attribute,
+ EGLint *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, EGLint "
+ "*value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, attribute, (uintptr_t)value);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateGetConfigAttrib(display, configuration, attribute),
+ "eglGetConfigAttrib", GetDisplayIfValid(display), EGL_FALSE);
+
+ QueryConfigAttrib(configuration, attribute, value);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLSurface EGLAPIENTRY EGL_CreateWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", EGLNativeWindowType win = 0x%016" PRIxPTR
+ ", "
+ "const EGLint *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)win, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ ANGLE_EGL_TRY_RETURN(thread,
+ ValidateCreateWindowSurface(display, configuration, win, attributes),
+ "eglCreateWindowSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ egl::Surface *surface = nullptr;
+ ANGLE_EGL_TRY_RETURN(thread,
+ display->createWindowSurface(configuration, win, attributes, &surface),
+ "eglCreateWindowSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ return static_cast<EGLSurface>(surface);
+}
+
+EGLSurface EGLAPIENTRY EGL_CreatePbufferSurface(EGLDisplay dpy,
+ EGLConfig config,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", const EGLint *attrib_list = "
+ "0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateCreatePbufferSurface(display, configuration, attributes),
+ "eglCreatePbufferSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ egl::Surface *surface = nullptr;
+ ANGLE_EGL_TRY_RETURN(thread, display->createPbufferSurface(configuration, attributes, &surface),
+ "eglCreatePbufferSurface", GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ return static_cast<EGLSurface>(surface);
+}
+
+EGLSurface EGLAPIENTRY EGL_CreatePixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", EGLNativePixmapType pixmap = "
+ "0x%016" PRIxPTR
+ ", "
+ "const EGLint *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)pixmap, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateConfig(display, configuration), "eglCreatePixmapSurface",
+ GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ UNIMPLEMENTED(); // FIXME
+
+ thread->setSuccess();
+ return EGL_NO_SURFACE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_DestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDestroySurface(display, eglSurface, surface),
+ "eglDestroySurface", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ ANGLE_EGL_TRY_RETURN(thread, display->destroySurface(eglSurface), "eglDestroySurface",
+ GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, EGLint "
+ "*value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
+ Thread *thread = egl::GetCurrentThread();
+
+ const egl::Display *display = static_cast<const egl::Display *>(dpy);
+ const Surface *eglSurface = static_cast<const Surface *>(surface);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateQuerySurface(display, eglSurface, attribute, value),
+ "eglQuerySurface", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ QuerySurfaceAttrib(eglSurface, attribute, value);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLContext EGLAPIENTRY EGL_CreateContext(EGLDisplay dpy,
+ EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", EGLContext share_context = "
+ "0x%016" PRIxPTR
+ ", "
+ "const EGLint *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)share_context, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+ gl::Context *sharedGLContext = static_cast<gl::Context *>(share_context);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ ANGLE_EGL_TRY_RETURN(thread,
+ ValidateCreateContext(display, configuration, sharedGLContext, attributes),
+ "eglCreateContext", GetDisplayIfValid(display), EGL_NO_CONTEXT);
+
+ gl::Context *context = nullptr;
+ ANGLE_EGL_TRY_RETURN(thread,
+ display->createContext(configuration, sharedGLContext, thread->getAPI(),
+ attributes, &context),
+ "eglCreateContext", GetDisplayIfValid(display), EGL_NO_CONTEXT);
+
+ thread->setSuccess();
+ return static_cast<EGLContext>(context);
+}
+
+EGLBoolean EGLAPIENTRY EGL_DestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLContext ctx = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)ctx);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ gl::Context *context = static_cast<gl::Context *>(ctx);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDestroyContext(display, context, ctx), "eglDestroyContext",
+ GetContextIfValid(display, context), EGL_FALSE);
+
+ bool contextWasCurrent = context == thread->getContext();
+
+ ANGLE_EGL_TRY_RETURN(thread, display->destroyContext(thread, context), "eglDestroyContext",
+ GetContextIfValid(display, context), EGL_FALSE);
+
+ if (contextWasCurrent)
+ {
+ SetContextCurrent(thread, nullptr);
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_MakeCurrent(EGLDisplay dpy,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext ctx)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface draw = 0x%016" PRIxPTR
+ ", EGLSurface read = 0x%016" PRIxPTR
+ ", "
+ "EGLContext ctx = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)draw, (uintptr_t)read, (uintptr_t)ctx);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *drawSurface = static_cast<Surface *>(draw);
+ Surface *readSurface = static_cast<Surface *>(read);
+ gl::Context *context = static_cast<gl::Context *>(ctx);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateMakeCurrent(display, drawSurface, readSurface, context),
+ "eglMakeCurrent", GetContextIfValid(display, context), EGL_FALSE);
+
+ Surface *previousDraw = thread->getCurrentDrawSurface();
+ Surface *previousRead = thread->getCurrentReadSurface();
+ gl::Context *previousContext = thread->getContext();
+
+ // Only call makeCurrent if the context or surfaces have changed.
+ if (previousDraw != drawSurface || previousRead != readSurface || previousContext != context)
+ {
+ ANGLE_EGL_TRY_RETURN(thread,
+ display->makeCurrent(thread, drawSurface, readSurface, context),
+ "eglMakeCurrent", GetContextIfValid(display, context), EGL_FALSE);
+
+ SetContextCurrent(thread, context);
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLint readdraw = %d)", readdraw);
+ Thread *thread = egl::GetCurrentThread();
+
+ if (readdraw == EGL_READ)
+ {
+ thread->setSuccess();
+ return thread->getCurrentReadSurface();
+ }
+ else if (readdraw == EGL_DRAW)
+ {
+ thread->setSuccess();
+ return thread->getCurrentDrawSurface();
+ }
+ else
+ {
+ thread->setError(EglBadParameter(), GetDebug(), "eglGetCurrentSurface", nullptr);
+ return EGL_NO_SURFACE;
+ }
+}
+
+EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay(void)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("()");
+ Thread *thread = egl::GetCurrentThread();
+
+ thread->setSuccess();
+ if (thread->getContext() != nullptr)
+ {
+ return thread->getContext()->getDisplay();
+ }
+ return EGL_NO_DISPLAY;
+}
+
+EGLBoolean EGLAPIENTRY EGL_QueryContext(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLint attribute,
+ EGLint *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLContext ctx = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, EGLint *value "
+ "= 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)ctx, attribute, (uintptr_t)value);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ gl::Context *context = static_cast<gl::Context *>(ctx);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateQueryContext(display, context, attribute, value),
+ "eglQueryContext", GetContextIfValid(display, context), EGL_FALSE);
+
+ QueryContextAttrib(context, attribute, value);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_WaitGL(void)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("()");
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = thread->getDisplay();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDisplay(display), "eglWaitGL", GetDisplayIfValid(display),
+ EGL_FALSE);
+
+ // eglWaitGL like calling eglWaitClient with the OpenGL ES API bound. Since we only implement
+ // OpenGL ES we can do the call directly.
+ ANGLE_EGL_TRY_RETURN(thread, display->waitClient(thread->getContext()), "eglWaitGL",
+ GetDisplayIfValid(display), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLint engine = %d)", engine);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = thread->getDisplay();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateWaitNative(display, engine), "eglWaitNative",
+ GetThreadIfValid(thread), EGL_FALSE);
+
+ ANGLE_EGL_TRY_RETURN(thread, display->waitNative(thread->getContext(), engine), "eglWaitNative",
+ GetThreadIfValid(thread), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_SwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = (Surface *)surface;
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateSwapBuffers(thread, display, eglSurface), "eglSwapBuffers",
+ GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ ANGLE_EGL_TRY_RETURN(thread, eglSurface->swap(thread->getContext()), "eglSwapBuffers",
+ GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_CopyBuffers(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLNativePixmapType target)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLNativePixmapType target = "
+ "0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)target);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateCopyBuffers(display, eglSurface), "eglCopyBuffers",
+ GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ UNIMPLEMENTED(); // FIXME
+
+ thread->setSuccess();
+ return 0;
+}
+
+// EGL 1.1
+EGLBoolean EGLAPIENTRY EGL_BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint buffer = %d)",
+ (uintptr_t)dpy, (uintptr_t)surface, buffer);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+ gl::Context *context = thread->getContext();
+ gl::Texture *textureObject = nullptr;
+
+ ANGLE_EGL_TRY_RETURN(
+ thread, ValidateBindTexImage(display, eglSurface, surface, buffer, context, &textureObject),
+ "eglBindTexImage", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ if (context)
+ {
+ ANGLE_EGL_TRY_RETURN(thread, eglSurface->bindTexImage(context, textureObject, buffer),
+ "eglBindTexImage", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_SurfaceAttrib(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, EGLint "
+ "value = %d)",
+ (uintptr_t)dpy, (uintptr_t)surface, attribute, value);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateSurfaceAttrib(display, eglSurface, attribute, value),
+ "eglSurfaceAttrib", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ SetSurfaceAttrib(eglSurface, attribute, value);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint buffer = %d)",
+ (uintptr_t)dpy, (uintptr_t)surface, buffer);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateReleaseTexImage(display, eglSurface, surface, buffer),
+ "eglReleaseTexImage", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ gl::Texture *texture = eglSurface->getBoundTexture();
+
+ if (texture)
+ {
+ ANGLE_EGL_TRY_RETURN(thread, eglSurface->releaseTexImage(thread->getContext(), buffer),
+ "eglReleaseTexImage", GetSurfaceIfValid(display, eglSurface),
+ EGL_FALSE);
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_SwapInterval(EGLDisplay dpy, EGLint interval)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint interval = %d)", (uintptr_t)dpy, interval);
+ Thread *thread = egl::GetCurrentThread();
+ gl::Context *context = thread->getContext();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *draw_surface = static_cast<Surface *>(thread->getCurrentDrawSurface());
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateSwapInterval(display, draw_surface, context),
+ "eglSwapInterval", GetDisplayIfValid(display), EGL_FALSE);
+
+ const egl::Config *surfaceConfig = draw_surface->getConfig();
+ EGLint clampedInterval = std::min(std::max(interval, surfaceConfig->minSwapInterval),
+ surfaceConfig->maxSwapInterval);
+
+ draw_surface->setSwapInterval(clampedInterval);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL 1.2
+EGLBoolean EGLAPIENTRY EGL_BindAPI(EGLenum api)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLenum api = 0x%X)", api);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateBindAPI(api), "eglBindAPI", GetThreadIfValid(thread),
+ EGL_FALSE);
+
+ thread->setAPI(api);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLenum EGLAPIENTRY EGL_QueryAPI(void)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("()");
+ Thread *thread = egl::GetCurrentThread();
+
+ EGLenum API = thread->getAPI();
+
+ thread->setSuccess();
+ return API;
+}
+
+EGLSurface EGLAPIENTRY EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ EGLConfig config,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR
+ ", EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%016" PRIxPTR
+ ", "
+ "EGLConfig config = 0x%016" PRIxPTR ", const EGLint *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, buftype, (uintptr_t)buffer, (uintptr_t)config, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ ANGLE_EGL_TRY_RETURN(
+ thread,
+ ValidateCreatePbufferFromClientBuffer(display, buftype, buffer, configuration, attributes),
+ "eglCreatePbufferFromClientBuffer", GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ egl::Surface *surface = nullptr;
+ ANGLE_EGL_TRY_RETURN(thread,
+ display->createPbufferFromClientBuffer(configuration, buftype, buffer,
+ attributes, &surface),
+ "eglCreatePbufferFromClientBuffer", GetDisplayIfValid(display),
+ EGL_NO_SURFACE);
+
+ return static_cast<EGLSurface>(surface);
+}
+
+EGLBoolean EGLAPIENTRY EGL_ReleaseThread(void)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("()");
+ Thread *thread = egl::GetCurrentThread();
+
+ Surface *previousDraw = thread->getCurrentDrawSurface();
+ Surface *previousRead = thread->getCurrentReadSurface();
+ gl::Context *previousContext = thread->getContext();
+ egl::Display *previousDisplay = thread->getDisplay();
+
+ // Only call makeCurrent if the context or surfaces have changed.
+ if (previousDraw != EGL_NO_SURFACE || previousRead != EGL_NO_SURFACE ||
+ previousContext != EGL_NO_CONTEXT)
+ {
+ if (previousDisplay != EGL_NO_DISPLAY)
+ {
+ ANGLE_EGL_TRY_RETURN(thread,
+ previousDisplay->makeCurrent(thread, nullptr, nullptr, nullptr),
+ "eglReleaseThread", nullptr, EGL_FALSE);
+ }
+
+ SetContextCurrent(thread, nullptr);
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_WaitClient(void)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("()");
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = thread->getDisplay();
+ gl::Context *context = thread->getContext();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDisplay(display), "eglWaitClient",
+ GetContextIfValid(display, context), EGL_FALSE);
+
+ ANGLE_EGL_TRY_RETURN(thread, display->waitClient(context), "eglWaitClient",
+ GetContextIfValid(display, context), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL 1.4
+EGLContext EGLAPIENTRY EGL_GetCurrentContext(void)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("()");
+ Thread *thread = egl::GetCurrentThread();
+
+ gl::Context *context = thread->getContext();
+
+ thread->setSuccess();
+ return static_cast<EGLContext>(context);
+}
+
+// EGL 1.5
+EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR
+ ", EGLenum type = 0x%X, const EGLint* attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, type, (uintptr_t)attrib_list);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
+
+ gl::Context *currentContext = thread->getContext();
+ egl::Display *currentDisplay = currentContext ? currentContext->getDisplay() : nullptr;
+
+ ANGLE_EGL_TRY_RETURN(
+ thread, ValidateCreateSyncKHR(display, type, attributes, currentDisplay, currentContext),
+ "eglCreateSync", GetDisplayIfValid(display), EGL_NO_SYNC);
+
+ egl::Sync *syncObject = nullptr;
+ ANGLE_EGL_TRY_RETURN(thread, display->createSync(currentContext, type, attributes, &syncObject),
+ "eglCreateSync", GetDisplayIfValid(display), EGL_NO_SYNC);
+
+ thread->setSuccess();
+ return static_cast<EGLSync>(syncObject);
+}
+
+EGLBoolean EGLAPIENTRY EGL_DestroySync(EGLDisplay dpy, EGLSync sync)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR ")", (uintptr_t)dpy,
+ (uintptr_t)sync);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDestroySync(display, syncObject), "eglDestroySync",
+ GetDisplayIfValid(display), EGL_FALSE);
+
+ display->destroySync(syncObject);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
+ ", EGLint flags = 0x%X, EGLTime timeout = "
+ "%llu)",
+ (uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateClientWaitSync(display, syncObject, flags, timeout),
+ "eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ gl::Context *currentContext = thread->getContext();
+ EGLint syncStatus = EGL_FALSE;
+ ANGLE_EGL_TRY_RETURN(
+ thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
+ "eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ thread->setSuccess();
+ return syncStatus;
+}
+
+EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint attribute,
+ EGLAttrib *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
+ ", EGLint attribute = 0x%X, EGLAttrib "
+ "*value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateGetSyncAttrib(display, syncObject, attribute, value),
+ "eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ EGLint valueExt;
+ ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, &valueExt),
+ "eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
+ *value = valueExt;
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLImage EGLAPIENTRY EGL_CreateImage(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLContext ctx = 0x%016" PRIxPTR
+ ", EGLenum target = 0x%X, "
+ "EGLClientBuffer buffer = 0x%016" PRIxPTR
+ ", const EGLAttrib *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ gl::Context *context = static_cast<gl::Context *>(ctx);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray((const EGLint *)attrib_list);
+
+ Error error = ValidateCreateImage(display, context, target, buffer, attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateImage", GetDisplayIfValid(display));
+ return EGL_NO_IMAGE;
+ }
+
+ Image *image = nullptr;
+ error = display->createImage(context, target, buffer, attributes, &image);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateImage", GetDisplayIfValid(display));
+ return EGL_NO_IMAGE;
+ }
+
+ thread->setSuccess();
+ return static_cast<EGLImage>(image);
+}
+
+EGLBoolean EGLAPIENTRY EGL_DestroyImage(EGLDisplay dpy, EGLImage image)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLImage image = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)image);
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Image *img = static_cast<Image *>(image);
+
+ Error error = ValidateDestroyImage(display, img);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglDestroyImage", GetImageIfValid(display, img));
+ return EGL_FALSE;
+ }
+
+ display->destroyImage(img);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplay(EGLenum platform,
+ void *native_display,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLenum platform = %d, void* native_display = 0x%016" PRIxPTR
+ ", const EGLint* attrib_list = "
+ "0x%016" PRIxPTR ")",
+ platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateGetPlatformDisplay(platform, native_display, attrib_list),
+ "eglGetPlatformDisplay", GetThreadIfValid(thread), EGL_NO_DISPLAY);
+
+ const auto &attribMap = AttributeMap::CreateFromAttribArray(attrib_list);
+ if (platform == EGL_PLATFORM_ANGLE_ANGLE)
+ {
+ return egl::Display::GetDisplayFromNativeDisplay(
+ gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
+ }
+ else if (platform == EGL_PLATFORM_DEVICE_EXT)
+ {
+ Device *eglDevice = static_cast<Device *>(native_display);
+ return egl::Display::GetDisplayFromDevice(eglDevice, attribMap);
+ }
+ else
+ {
+ UNREACHABLE();
+ return EGL_NO_DISPLAY;
+ }
+}
+
+EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_window,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", void* native_window = 0x%016" PRIxPTR
+ ", "
+ "const EGLint* attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+
+ UNIMPLEMENTED();
+ thread->setError(EglBadDisplay() << "eglCreatePlatformWindowSurface unimplemented.", GetDebug(),
+ "eglCreatePlatformWindowSurface", GetDisplayIfValid(display));
+ return EGL_NO_SURFACE;
+}
+
+EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_pixmap,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", void* native_pixmap = 0x%016" PRIxPTR
+ ", "
+ "const EGLint* attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+
+ UNIMPLEMENTED();
+ thread->setError(EglBadDisplay() << "eglCreatePlatformPixmapSurface unimplemented.", GetDebug(),
+ "eglCreatePlatformPixmapSurface", GetDisplayIfValid(display));
+ return EGL_NO_SURFACE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy =0x%016" PRIxPTR "p, EGLSync sync = 0x%016" PRIxPTR
+ ", EGLint flags = 0x%X)",
+ (uintptr_t)dpy, (uintptr_t)sync, flags);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ gl::Context *context = thread->getContext();
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateWaitSync(display, context, syncObject, flags),
+ "eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ gl::Context *currentContext = thread->getContext();
+ ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
+ "eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+__eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const char *procname)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(const char *procname = \"%s\")", procname);
+ Thread *thread = egl::GetCurrentThread();
+
+ ProcEntry *entry =
+ std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], procname, CompareProc);
+
+ thread->setSuccess();
+
+ if (entry == &g_procTable[g_numProcs] || strcmp(entry->first, procname) != 0)
+ {
+ return nullptr;
+ }
+
+ return entry->second;
+}
+} // extern "C"
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_egl.h b/gfx/angle/checkout/src/libGLESv2/entry_points_egl.h
new file mode 100644
index 0000000000..85a86ddc96
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_egl.h
@@ -0,0 +1,136 @@
+//
+// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// entry_points_egl.h : Defines the EGL entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTSEGL_H_
+#define LIBGLESV2_ENTRYPOINTSEGL_H_
+
+#include <EGL/egl.h>
+#include <export.h>
+
+extern "C" {
+
+// EGL 1.0
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_ChooseConfig(EGLDisplay dpy,
+ const EGLint *attrib_list,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_CopyBuffers(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLNativePixmapType target);
+ANGLE_EXPORT EGLContext EGLAPIENTRY EGL_CreateContext(EGLDisplay dpy,
+ EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreatePbufferSurface(EGLDisplay dpy,
+ EGLConfig config,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreatePixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreateWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroyContext(EGLDisplay dpy, EGLContext ctx);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroySurface(EGLDisplay dpy, EGLSurface surface);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetConfigAttrib(EGLDisplay dpy,
+ EGLConfig config,
+ EGLint attribute,
+ EGLint *value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetConfigs(EGLDisplay dpy,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config);
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY EGL_GetCurrentDisplay(void);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_GetCurrentSurface(EGLint readdraw);
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY EGL_GetDisplay(EGLNativeDisplayType display_id);
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_GetError(void);
+ANGLE_EXPORT __eglMustCastToProperFunctionPointerType EGLAPIENTRY
+EGL_GetProcAddress(const char *procname);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_MakeCurrent(EGLDisplay dpy,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext ctx);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QueryContext(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLint attribute,
+ EGLint *value);
+ANGLE_EXPORT const char *EGLAPIENTRY EGL_QueryString(EGLDisplay dpy, EGLint name);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QuerySurface(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint *value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_SwapBuffers(EGLDisplay dpy, EGLSurface surface);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_Terminate(EGLDisplay dpy);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_WaitGL(void);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_WaitNative(EGLint engine);
+
+// EGL 1.1
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_BindTexImage(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint buffer);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_ReleaseTexImage(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint buffer);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_SurfaceAttrib(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_SwapInterval(EGLDisplay dpy, EGLint interval);
+
+// EGL 1.2
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_BindAPI(EGLenum api);
+ANGLE_EXPORT EGLenum EGLAPIENTRY EGL_QueryAPI(void);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreatePbufferFromClientBuffer(EGLDisplay dpy,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ EGLConfig config,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_ReleaseThread(void);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_WaitClient(void);
+
+// EGL 1.4
+ANGLE_EXPORT EGLContext EGLAPIENTRY EGL_GetCurrentContext(void);
+
+// EGL 1.5
+ANGLE_EXPORT EGLSync EGLAPIENTRY EGL_CreateSync(EGLDisplay dpy,
+ EGLenum type,
+ const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroySync(EGLDisplay dpy, EGLSync sync);
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ClientWaitSync(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint flags,
+ EGLTime timeout);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetSyncAttrib(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint attribute,
+ EGLAttrib *value);
+ANGLE_EXPORT EGLImage EGLAPIENTRY EGL_CreateImage(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroyImage(EGLDisplay dpy, EGLImage image);
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplay(EGLenum platform,
+ void *native_display,
+ const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_window,
+ const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_pixmap,
+ const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags);
+} // extern "C"
+
+#endif // LIBGLESV2_ENTRYPOINTSEGL_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.cpp
new file mode 100644
index 0000000000..55823b8059
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.cpp
@@ -0,0 +1,1480 @@
+//
+// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// entry_points_ext.cpp : Implements the EGL extension entry points.
+
+#include "libGLESv2/entry_points_egl_ext.h"
+
+#include "common/debug.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/Device.h"
+#include "libANGLE/Display.h"
+#include "libANGLE/EGLSync.h"
+#include "libANGLE/Stream.h"
+#include "libANGLE/Surface.h"
+#include "libANGLE/Thread.h"
+#include "libANGLE/queryutils.h"
+#include "libANGLE/validationEGL.h"
+#include "libGLESv2/global_state.h"
+
+using namespace egl;
+
+extern "C" {
+
+// EGL_ANGLE_query_surface_pointer
+EGLBoolean EGLAPIENTRY EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ void **value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, void "
+ "**value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface, attribute, (uintptr_t)value);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ Error error = ValidateSurface(display, eglSurface);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQuerySurfacePointerANGLE",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ if (!display->getExtensions().querySurfacePointer)
+ {
+ thread->setSuccess();
+ return EGL_FALSE;
+ }
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ thread->setError(EglBadSurface(), GetDebug(), "eglQuerySurfacePointerANGLE",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ // validate the attribute parameter
+ switch (attribute)
+ {
+ case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+ if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
+ {
+ thread->setError(EglBadAttribute(), GetDebug(), "eglQuerySurfacePointerANGLE",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+ break;
+ case EGL_DXGI_KEYED_MUTEX_ANGLE:
+ if (!display->getExtensions().keyedMutex)
+ {
+ thread->setError(EglBadAttribute(), GetDebug(), "eglQuerySurfacePointerANGLE",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+ break;
+ default:
+ thread->setError(EglBadAttribute(), GetDebug(), "eglQuerySurfacePointerANGLE",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ error = eglSurface->querySurfacePointerANGLE(attribute, value);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQuerySurfacePointerANGLE",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_NV_post_sub_buffer
+EGLBoolean EGLAPIENTRY EGL_PostSubBufferNV(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint x = %d, EGLint y = %d, "
+ "EGLint width = %d, EGLint height = %d)",
+ (uintptr_t)dpy, (uintptr_t)surface, x, y, width, height);
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ if (x < 0 || y < 0 || width < 0 || height < 0)
+ {
+ thread->setError(EglBadParameter(), GetDebug(), "eglPostSubBufferNV",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ Error error = ValidateSurface(display, eglSurface);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglPostSubBufferNV",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ if (display->testDeviceLost())
+ {
+ thread->setError(EglContextLost(), GetDebug(), "eglPostSubBufferNV",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ if (surface == EGL_NO_SURFACE)
+ {
+ thread->setError(EglBadSurface(), GetDebug(), "eglPostSubBufferNV",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ if (!display->getExtensions().postSubBuffer)
+ {
+ // Spec is not clear about how this should be handled.
+ thread->setSuccess();
+ return EGL_TRUE;
+ }
+
+ // TODO(jmadill): Validate Surface is bound to the thread.
+ error = eglSurface->postSubBuffer(thread->getContext(), x, y, width, height);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglPostSubBufferNV",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_EXT_platform_base
+EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplayEXT(EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLenum platform = %d, void* native_display = 0x%016" PRIxPTR
+ ", const EGLint* attrib_list = "
+ "0x%016" PRIxPTR ")",
+ platform, (uintptr_t)native_display, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ Error err = ValidateGetPlatformDisplayEXT(platform, native_display, attrib_list);
+ thread->setError(err, GetDebug(), "eglGetPlatformDisplayEXT", GetThreadIfValid(thread));
+ if (err.isError())
+ {
+ return EGL_NO_DISPLAY;
+ }
+
+ const auto &attribMap = AttributeMap::CreateFromIntArray(attrib_list);
+ if (platform == EGL_PLATFORM_ANGLE_ANGLE)
+ {
+ return egl::Display::GetDisplayFromNativeDisplay(
+ gl::bitCast<EGLNativeDisplayType>(native_display), attribMap);
+ }
+ else if (platform == EGL_PLATFORM_DEVICE_EXT)
+ {
+ Device *eglDevice = static_cast<Device *>(native_display);
+ return egl::Display::GetDisplayFromDevice(eglDevice, attribMap);
+ }
+ else
+ {
+ UNREACHABLE();
+ return EGL_NO_DISPLAY;
+ }
+}
+
+EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_window,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", void *native_window = 0x%016" PRIxPTR
+ ", "
+ "const EGLint *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_window, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ ANGLE_EGL_TRY_RETURN(
+ thread,
+ ValidateCreatePlatformWindowSurfaceEXT(display, configuration, native_window, attributes),
+ "eglCreatePlatformWindowSurfaceEXT", GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ thread->setError(EglBadDisplay() << "CreatePlatformWindowSurfaceEXT unimplemented.", GetDebug(),
+ "eglCreatePlatformWindowSurfaceEXT", GetDisplayIfValid(display));
+ return EGL_NO_SURFACE;
+}
+
+EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_pixmap,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLConfig config = 0x%016" PRIxPTR
+ ", void *native_pixmap = 0x%016" PRIxPTR
+ ", "
+ "const EGLint *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)config, (uintptr_t)native_pixmap, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Config *configuration = static_cast<Config *>(config);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ ANGLE_EGL_TRY_RETURN(
+ thread,
+ ValidateCreatePlatformPixmapSurfaceEXT(display, configuration, native_pixmap, attributes),
+ "eglCreatePlatformPixmapSurfaceEXT", GetDisplayIfValid(display), EGL_NO_SURFACE);
+
+ thread->setError(EglBadDisplay() << "CreatePlatformPixmapSurfaceEXT unimplemented.", GetDebug(),
+ "eglCreatePlatformPixmapSurfaceEXT", GetDisplayIfValid(display));
+ return EGL_NO_SURFACE;
+}
+
+// EGL_EXT_device_query
+EGLBoolean EGLAPIENTRY EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,
+ EGLint attribute,
+ EGLAttrib *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDeviceEXT device = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, EGLAttrib *value = 0x%016" PRIxPTR ")",
+ (uintptr_t)device, attribute, (uintptr_t)value);
+ Thread *thread = egl::GetCurrentThread();
+
+ Device *dev = static_cast<Device *>(device);
+
+ Error error = ValidateDevice(dev);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQueryDeviceAttribEXT", GetDeviceIfValid(dev));
+ return EGL_FALSE;
+ }
+
+ // If the device was created by (and is owned by) a display, and that display doesn't support
+ // device querying, then this call should fail
+ egl::Display *owningDisplay = dev->getOwningDisplay();
+ if (owningDisplay != nullptr && !owningDisplay->getExtensions().deviceQuery)
+ {
+ thread->setError(EglBadAccess() << "Device wasn't created using eglCreateDeviceANGLE, "
+ "and the egl::Display that created it doesn't support "
+ "device querying",
+ GetDebug(), "eglQueryDeviceAttribEXT", GetDeviceIfValid(dev));
+ return EGL_FALSE;
+ }
+
+ // validate the attribute parameter
+ switch (attribute)
+ {
+ case EGL_D3D11_DEVICE_ANGLE:
+ case EGL_D3D9_DEVICE_ANGLE:
+ if (!dev->getExtensions().deviceD3D || dev->getType() != attribute)
+ {
+ thread->setError(EglBadAttribute(), GetDebug(), "eglQueryDeviceAttribEXT",
+ GetDeviceIfValid(dev));
+ return EGL_FALSE;
+ }
+ error = dev->getDevice(value);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQueryDeviceAttribEXT",
+ GetDeviceIfValid(dev));
+ return EGL_FALSE;
+ }
+ break;
+ default:
+ thread->setError(EglBadAttribute(), GetDebug(), "eglQueryDeviceAttribEXT",
+ GetDeviceIfValid(dev));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_EXT_device_query
+const char *EGLAPIENTRY EGL_QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDeviceEXT device = 0x%016" PRIxPTR ", EGLint name = %d)", (uintptr_t)device, name);
+ Thread *thread = egl::GetCurrentThread();
+
+ Device *dev = static_cast<Device *>(device);
+
+ Error error = ValidateDevice(dev);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQueryDeviceStringEXT", GetDeviceIfValid(dev));
+ return EGL_FALSE;
+ }
+
+ const char *result;
+ switch (name)
+ {
+ case EGL_EXTENSIONS:
+ result = dev->getExtensionString().c_str();
+ break;
+ default:
+ thread->setError(EglBadDevice(), GetDebug(), "eglQueryDeviceStringEXT",
+ GetDeviceIfValid(dev));
+ return nullptr;
+ }
+
+ thread->setSuccess();
+ return result;
+}
+
+// EGL_EXT_device_query
+EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, EGLAttrib *value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, attribute, (uintptr_t)value);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateQueryDisplayAttribEXT(display, attribute),
+ "eglQueryDisplayAttribEXT", GetDisplayIfValid(display), EGL_FALSE);
+
+ *value = display->queryAttrib(attribute);
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_ANGLE_feature_control
+EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,
+ EGLint attribute,
+ EGLAttrib *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR
+ ", EGLint attribute = %d, EGLAttrib *value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, attribute, (uintptr_t)value);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateQueryDisplayAttribANGLE(display, attribute),
+ "eglQueryDisplayAttribANGLE", GetDisplayIfValid(display), EGL_FALSE);
+
+ *value = display->queryAttrib(attribute);
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+ANGLE_EXPORT EGLImageKHR EGLAPIENTRY EGL_CreateImageKHR(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLContext ctx = 0x%016" PRIxPTR
+ ", EGLenum target = 0x%X, "
+ "EGLClientBuffer buffer = 0x%016" PRIxPTR
+ ", const EGLAttrib *attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)ctx, target, (uintptr_t)buffer, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ gl::Context *context = static_cast<gl::Context *>(ctx);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ Error error = ValidateCreateImageKHR(display, context, target, buffer, attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateImageKHR", GetDisplayIfValid(display));
+ return EGL_NO_IMAGE;
+ }
+
+ Image *image = nullptr;
+ error = display->createImage(context, target, buffer, attributes, &image);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateImageKHR", GetDisplayIfValid(display));
+ return EGL_NO_IMAGE;
+ }
+
+ thread->setSuccess();
+ return static_cast<EGLImage>(image);
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLImage image = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)image);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Image *img = static_cast<Image *>(image);
+
+ Error error = ValidateDestroyImageKHR(display, img);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglDestroyImageKHR", GetImageIfValid(display, img));
+ return EGL_FALSE;
+ }
+
+ display->destroyImage(img);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+ANGLE_EXPORT EGLDeviceEXT EGLAPIENTRY EGL_CreateDeviceANGLE(EGLint device_type,
+ void *native_device,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLint device_type = %d, void* native_device = 0x%016" PRIxPTR
+ ", const EGLAttrib* attrib_list = "
+ "0x%016" PRIxPTR ")",
+ device_type, (uintptr_t)native_device, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ Error error = ValidateCreateDeviceANGLE(device_type, native_device, attrib_list);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateDeviceANGLE", GetThreadIfValid(thread));
+ return EGL_NO_DEVICE_EXT;
+ }
+
+ Device *device = nullptr;
+ error = Device::CreateDevice(device_type, native_device, &device);
+ if (error.isError())
+ {
+ ASSERT(device == nullptr);
+ thread->setError(error, GetDebug(), "eglCreateDeviceANGLE", GetThreadIfValid(thread));
+ return EGL_NO_DEVICE_EXT;
+ }
+
+ thread->setSuccess();
+ return device;
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_ReleaseDeviceANGLE(EGLDeviceEXT device)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDeviceEXT device = 0x%016" PRIxPTR ")", (uintptr_t)device);
+ Thread *thread = egl::GetCurrentThread();
+
+ Device *dev = static_cast<Device *>(device);
+
+ Error error = ValidateReleaseDeviceANGLE(dev);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglReleaseDeviceANGLE", GetDeviceIfValid(dev));
+ return EGL_FALSE;
+ }
+
+ SafeDelete(dev);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_KHR_stream
+EGLStreamKHR EGLAPIENTRY EGL_CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", const EGLAttrib* attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ Error error = ValidateCreateStreamKHR(display, attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateStreamKHR", GetDisplayIfValid(display));
+ return EGL_NO_STREAM_KHR;
+ }
+
+ Stream *stream;
+ error = display->createStream(attributes, &stream);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateStreamKHR", GetDisplayIfValid(display));
+ return EGL_NO_STREAM_KHR;
+ }
+
+ thread->setSuccess();
+ return static_cast<EGLStreamKHR>(stream);
+}
+
+EGLBoolean EGLAPIENTRY EGL_DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR ")", (uintptr_t)dpy,
+ (uintptr_t)stream);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+
+ Error error = ValidateDestroyStreamKHR(display, streamObject);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglDestroyStreamKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ display->destroyStream(streamObject);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_StreamAttribKHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLint value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
+ ", EGLenum attribute = 0x%X, "
+ "EGLint value = 0x%X)",
+ (uintptr_t)dpy, (uintptr_t)stream, attribute, value);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+
+ Error error = ValidateStreamAttribKHR(display, streamObject, attribute, value);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamAttribKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ switch (attribute)
+ {
+ case EGL_CONSUMER_LATENCY_USEC_KHR:
+ streamObject->setConsumerLatency(value);
+ break;
+ case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
+ streamObject->setConsumerAcquireTimeout(value);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_QueryStreamKHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLint *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
+ ", EGLenum attribute = 0x%X, "
+ "EGLint value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+
+ Error error = ValidateQueryStreamKHR(display, streamObject, attribute, value);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQueryStreamKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ switch (attribute)
+ {
+ case EGL_STREAM_STATE_KHR:
+ *value = streamObject->getState();
+ break;
+ case EGL_CONSUMER_LATENCY_USEC_KHR:
+ *value = streamObject->getConsumerLatency();
+ break;
+ case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR:
+ *value = streamObject->getConsumerAcquireTimeout();
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_QueryStreamu64KHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLuint64KHR *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
+ ", EGLenum attribute = 0x%X, "
+ "EGLuint64KHR value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)stream, attribute, (uintptr_t)value);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+
+ Error error = ValidateQueryStreamu64KHR(display, streamObject, attribute, value);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQueryStreamu64KHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ switch (attribute)
+ {
+ case EGL_PRODUCER_FRAME_KHR:
+ *value = streamObject->getProducerFrame();
+ break;
+ case EGL_CONSUMER_FRAME_KHR:
+ *value = streamObject->getConsumerFrame();
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR ")", (uintptr_t)dpy,
+ (uintptr_t)stream);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+ gl::Context *context = gl::GetValidGlobalContext();
+
+ Error error = ValidateStreamConsumerGLTextureExternalKHR(display, context, streamObject);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamConsumerGLTextureExternalKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ error = streamObject->createConsumerGLTextureExternal(AttributeMap(), context);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamConsumerGLTextureExternalKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR ")", (uintptr_t)dpy,
+ (uintptr_t)stream);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+ gl::Context *context = gl::GetValidGlobalContext();
+
+ Error error = ValidateStreamConsumerAcquireKHR(display, context, streamObject);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamConsumerAcquireKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ error = streamObject->consumerAcquire(context);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamConsumerAcquireKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR = 0x%016" PRIxPTR ")", (uintptr_t)dpy,
+ (uintptr_t)stream);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+ gl::Context *context = gl::GetValidGlobalContext();
+
+ Error error = ValidateStreamConsumerReleaseKHR(display, context, streamObject);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglSStreamConsumerReleaseKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ error = streamObject->consumerRelease(context);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamConsumerReleaseKHR",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
+ ", EGLAttrib attrib_list = 0x%016" PRIxPTR "",
+ (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+ gl::Context *context = gl::GetValidGlobalContext();
+ AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
+
+ Error error = ValidateStreamConsumerGLTextureExternalAttribsNV(display, context, streamObject,
+ attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamConsumerGLTextureExternalAttribsNV",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ error = streamObject->createConsumerGLTextureExternal(attributes, context);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamConsumerGLTextureExternalAttribsNV",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
+ ", EGLAttrib attrib_list = 0x%016" PRIxPTR "",
+ (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+ AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
+
+ Error error = ValidateCreateStreamProducerD3DTextureANGLE(display, streamObject, attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateStreamProducerD3DTextureANGLE",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ error = streamObject->createProducerD3D11Texture(attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglCreateStreamProducerD3DTextureANGLE",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ void *texture,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLStreamKHR stream = 0x%016" PRIxPTR
+ ", void* texture = 0x%016" PRIxPTR
+ ", "
+ "EGLAttrib attrib_list = 0x%016" PRIxPTR "",
+ (uintptr_t)dpy, (uintptr_t)stream, (uintptr_t)texture, (uintptr_t)attrib_list);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Stream *streamObject = static_cast<Stream *>(stream);
+ AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
+
+ Error error = ValidateStreamPostD3DTextureANGLE(display, streamObject, texture, attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamPostD3DTextureANGLE",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ error = streamObject->postD3D11Texture(texture, attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglStreamPostD3DTextureANGLE",
+ GetStreamIfValid(display, streamObject));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_KHR_fence_sync
+ANGLE_EXPORT EGLSync EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy,
+ EGLenum type,
+ const EGLint *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR
+ ", EGLenum type = 0x%X, const EGLint* attrib_list = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, type, (uintptr_t)attrib_list);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
+
+ gl::Context *currentContext = thread->getContext();
+ egl::Display *currentDisplay = currentContext ? currentContext->getDisplay() : nullptr;
+
+ ANGLE_EGL_TRY_RETURN(
+ thread, ValidateCreateSyncKHR(display, type, attributes, currentDisplay, currentContext),
+ "eglCreateSync", GetDisplayIfValid(display), EGL_NO_SYNC);
+
+ egl::Sync *syncObject = nullptr;
+ ANGLE_EGL_TRY_RETURN(thread, display->createSync(currentContext, type, attributes, &syncObject),
+ "eglCreateSync", GetDisplayIfValid(display), EGL_NO_SYNC);
+
+ thread->setSuccess();
+ return static_cast<EGLSync>(syncObject);
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroySyncKHR(EGLDisplay dpy, EGLSync sync)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR ")", (uintptr_t)dpy,
+ (uintptr_t)sync);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDestroySync(display, syncObject), "eglDestroySync",
+ GetDisplayIfValid(display), EGL_FALSE);
+
+ display->destroySync(syncObject);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint flags,
+ EGLTime timeout)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
+ ", EGLint flags = 0x%X, EGLTime timeout = "
+ "%llu)",
+ (uintptr_t)dpy, (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateClientWaitSync(display, syncObject, flags, timeout),
+ "eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ gl::Context *currentContext = thread->getContext();
+ EGLint syncStatus = EGL_FALSE;
+ ANGLE_EGL_TRY_RETURN(
+ thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
+ "eglClientWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ thread->setSuccess();
+ return syncStatus;
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetSyncAttribKHR(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint attribute,
+ EGLint *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSync sync = 0x%016" PRIxPTR
+ ", EGLint attribute = 0x%X, EGLAttrib "
+ "*value = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)sync, attribute, (uintptr_t)value);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateGetSyncAttribKHR(display, syncObject, attribute, value),
+ "eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ ANGLE_EGL_TRY_RETURN(thread, GetSyncAttrib(display, syncObject, attribute, value),
+ "eglGetSyncAttrib", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_KHR_wait_sync
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_WaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy =0x%016" PRIxPTR "p, EGLSync sync = 0x%016" PRIxPTR
+ ", EGLint flags = 0x%X)",
+ (uintptr_t)dpy, (uintptr_t)sync, flags);
+
+ Thread *thread = egl::GetCurrentThread();
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ gl::Context *context = thread->getContext();
+ egl::Sync *syncObject = static_cast<Sync *>(sync);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateWaitSync(display, context, syncObject, flags),
+ "eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ gl::Context *currentContext = thread->getContext();
+ ANGLE_EGL_TRY_RETURN(thread, syncObject->serverWait(display, currentContext, flags),
+ "eglWaitSync", GetSyncIfValid(display, syncObject), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *ust,
+ EGLuint64KHR *msc,
+ EGLuint64KHR *sbc)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLuint64KHR* ust = 0x%016" PRIxPTR
+ ", "
+ "EGLuint64KHR* msc = 0x%016" PRIxPTR ", EGLuint64KHR* sbc = 0x%016" PRIxPTR "",
+ (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)ust, (uintptr_t)msc, (uintptr_t)sbc);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ Error error = ValidateGetSyncValuesCHROMIUM(display, eglSurface, ust, msc, sbc);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglGetSyncValuesCHROMIUM",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ error = eglSurface->getSyncValues(ust, msc, sbc);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglGetSyncValuesCHROMIUM",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint *rects,
+ EGLint n_rects)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint *rects = 0x%016" PRIxPTR
+ ", EGLint "
+ "n_rects = %d)",
+ (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)rects, n_rects);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ Error error = ValidateSwapBuffersWithDamageKHR(display, eglSurface, rects, n_rects);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglSwapBuffersWithDamageEXT",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ error = eglSurface->swapWithDamage(thread->getContext(), rects, n_rects);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglSwapBuffersWithDamageEXT",
+ GetSurfaceIfValid(display, eglSurface));
+ return EGL_FALSE;
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY EGL_PresentationTimeANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLnsecsANDROID time)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLnsecsANDROID time = %llu)",
+ (uintptr_t)dpy, (uintptr_t)surface, static_cast<unsigned long long>(time));
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidatePresentationTimeANDROID(display, eglSurface, time),
+ "eglPresentationTimeANDROID", GetSurfaceIfValid(display, eglSurface),
+ EGL_FALSE);
+ ANGLE_EGL_TRY_RETURN(thread, eglSurface->setPresentationTime(time),
+ "eglPresentationTimeANDROID", GetSurfaceIfValid(display, eglSurface),
+ EGL_FALSE);
+
+ return EGL_TRUE;
+}
+
+ANGLE_EXPORT void EGLAPIENTRY EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,
+ EGLSetBlobFuncANDROID set,
+ EGLGetBlobFuncANDROID get)
+{
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSetBlobFuncANDROID set = 0x%016" PRIxPTR
+ ", EGLGetBlobFuncANDROID get "
+ "= 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)set, (uintptr_t)get);
+ Thread *thread = egl::GetCurrentThread();
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+
+ ANGLE_EGL_TRY(thread, ValidateSetBlobCacheANDROID(display, set, get),
+ "eglSetBlobCacheFuncsANDROID", GetDisplayIfValid(display));
+
+ thread->setSuccess();
+ display->setBlobCacheFuncs(set, get);
+}
+
+EGLint EGLAPIENTRY EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLenum attrib = 0x%X)", (uintptr_t)dpy, attrib);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateProgramCacheGetAttribANGLE(display, attrib),
+ "eglProgramCacheGetAttribANGLE", GetDisplayIfValid(display), 0);
+
+ thread->setSuccess();
+ return display->programCacheGetAttrib(attrib);
+}
+
+void EGLAPIENTRY EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,
+ EGLint index,
+ void *key,
+ EGLint *keysize,
+ void *binary,
+ EGLint *binarysize)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint index = %d, void *key = 0x%016" PRIxPTR
+ ", EGLint *keysize = "
+ "0x%016" PRIxPTR ", void *binary = 0x%016" PRIxPTR ", EGLint *size = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, index, (uintptr_t)key, (uintptr_t)keysize, (uintptr_t)binary,
+ (uintptr_t)binarysize);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY(thread,
+ ValidateProgramCacheQueryANGLE(display, index, key, keysize, binary, binarysize),
+ "eglProgramCacheQueryANGLE", GetDisplayIfValid(display));
+
+ ANGLE_EGL_TRY(thread, display->programCacheQuery(index, key, keysize, binary, binarysize),
+ "eglProgramCacheQueryANGLE", GetDisplayIfValid(display));
+
+ thread->setSuccess();
+}
+
+void EGLAPIENTRY EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,
+ const void *key,
+ EGLint keysize,
+ const void *binary,
+ EGLint binarysize)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", void *key = 0x%016" PRIxPTR
+ ", EGLint keysize = %d, void *binary = "
+ "0x%016" PRIxPTR ", EGLint size = %d)",
+ (uintptr_t)dpy, (uintptr_t)key, keysize, (uintptr_t)binary, binarysize);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY(thread,
+ ValidateProgramCachePopulateANGLE(display, key, keysize, binary, binarysize),
+ "eglProgramCachePopulateANGLE", GetDisplayIfValid(display));
+
+ ANGLE_EGL_TRY(thread, display->programCachePopulate(key, keysize, binary, binarysize),
+ "eglProgramCachePopulateANGLE", GetDisplayIfValid(display));
+
+ thread->setSuccess();
+}
+
+EGLint EGLAPIENTRY EGL_ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLenum mode)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint limit = %d, EGLenum mode = 0x%X)",
+ (uintptr_t)dpy, limit, mode);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateProgramCacheResizeANGLE(display, limit, mode),
+ "eglProgramCacheResizeANGLE", GetDisplayIfValid(display), 0);
+
+ thread->setSuccess();
+ return display->programCacheResize(limit, mode);
+}
+
+EGLint EGLAPIENTRY EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,
+ const EGLAttrib *attrib_list)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDEBUGPROCKHR callback = 0x%016" PRIxPTR ", EGLAttrib attrib_list = 0x%016" PRIxPTR
+ ")",
+ (uintptr_t)callback, (uintptr_t)attrib_list);
+
+ Thread *thread = egl::GetCurrentThread();
+
+ AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list);
+
+ Error error = ValidateDebugMessageControlKHR(callback, attributes);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglDebugMessageControlKHR", nullptr);
+ return error.getCode();
+ }
+
+ Debug *debug = GetDebug();
+ debug->setCallback(callback, attributes);
+
+ thread->setSuccess();
+ return EGL_SUCCESS;
+}
+
+EGLBoolean EGLAPIENTRY EGL_QueryDebugKHR(EGLint attribute, EGLAttrib *value)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLint attribute = 0x%X, EGLAttrib* value = 0x%016" PRIxPTR ")", attribute,
+ (uintptr_t)value);
+
+ Thread *thread = egl::GetCurrentThread();
+
+ Error error = ValidateQueryDebugKHR(attribute, value);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglQueryDebugKHR", nullptr);
+ return EGL_FALSE;
+ }
+
+ Debug *debug = GetDebug();
+ switch (attribute)
+ {
+ case EGL_DEBUG_MSG_CRITICAL_KHR:
+ case EGL_DEBUG_MSG_ERROR_KHR:
+ case EGL_DEBUG_MSG_WARN_KHR:
+ case EGL_DEBUG_MSG_INFO_KHR:
+ *value = debug->isMessageTypeEnabled(FromEGLenum<MessageType>(attribute)) ? EGL_TRUE
+ : EGL_FALSE;
+ break;
+ case EGL_DEBUG_CALLBACK_KHR:
+ *value = reinterpret_cast<EGLAttrib>(debug->getCallback());
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+EGLint EGLAPIENTRY EGL_LabelObjectKHR(EGLDisplay dpy,
+ EGLenum objectType,
+ EGLObjectKHR object,
+ EGLLabelKHR label)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR
+ ", EGLenum objectType = 0x%X, EGLObjectKHR object = 0x%016" PRIxPTR
+ ", "
+ "EGLLabelKHR label = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, objectType, (uintptr_t)object, (uintptr_t)label);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ObjectType objectTypePacked = FromEGLenum<ObjectType>(objectType);
+ Error error = ValidateLabelObjectKHR(thread, display, objectTypePacked, object, label);
+ if (error.isError())
+ {
+ thread->setError(error, GetDebug(), "eglLabelObjectKHR",
+ GetLabeledObjectIfValid(thread, display, objectTypePacked, object));
+ return error.getCode();
+ }
+
+ LabeledObject *labeledObject =
+ GetLabeledObjectIfValid(thread, display, objectTypePacked, object);
+ ASSERT(labeledObject != nullptr);
+ labeledObject->setLabel(label);
+
+ thread->setSuccess();
+ return EGL_SUCCESS;
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint name)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint name = 0x%X)",
+ (uintptr_t)dpy, (uintptr_t)surface, name);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+ Thread *thread = egl::GetCurrentThread();
+
+ CompositorTiming nameInternal = FromEGLenum<CompositorTiming>(name);
+
+ ANGLE_EGL_TRY_RETURN(
+ thread, ValidateGetCompositorTimingSupportedANDROID(display, eglSurface, nameInternal),
+ "eglQueryTimestampSupportedANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ thread->setSuccess();
+ return eglSurface->getSupportedCompositorTimings().test(nameInternal);
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint numTimestamps = %d, const EGLint *names = 0x%016" PRIxPTR
+ ", EGLnsecsANDROID *values = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface, numTimestamps, (uintptr_t)names, (uintptr_t)values);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(
+ thread,
+ ValidateGetCompositorTimingANDROID(display, eglSurface, numTimestamps, names, values),
+ "eglGetCompositorTimingANDROIDD", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+ ANGLE_EGL_TRY_RETURN(thread, eglSurface->getCompositorTiming(numTimestamps, names, values),
+ "eglGetCompositorTimingANDROIDD", GetSurfaceIfValid(display, eglSurface),
+ EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetNextFrameIdANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *frameId)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLuint64KHR *frameId = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface, (uintptr_t)frameId);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateGetNextFrameIdANDROID(display, eglSurface, frameId),
+ "eglGetNextFrameIdANDROID", GetSurfaceIfValid(display, eglSurface),
+ EGL_FALSE);
+ ANGLE_EGL_TRY_RETURN(thread, eglSurface->getNextFrameId(frameId), "eglGetNextFrameIdANDROID",
+ GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint timestamp)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLint timestamp = 0x%X)",
+ (uintptr_t)dpy, (uintptr_t)surface, timestamp);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+ Thread *thread = egl::GetCurrentThread();
+
+ Timestamp timestampInternal = FromEGLenum<Timestamp>(timestamp);
+
+ ANGLE_EGL_TRY_RETURN(
+ thread, ValidateGetFrameTimestampSupportedANDROID(display, eglSurface, timestampInternal),
+ "eglQueryTimestampSupportedANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ thread->setSuccess();
+ return eglSurface->getSupportedTimestamps().test(timestampInternal);
+}
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSurface surface = 0x%016" PRIxPTR
+ ", EGLuint64KHR frameId = %llu, EGLint numTimestamps = %d, const EGLint *timestamps = "
+ "0x%016" PRIxPTR ", EGLnsecsANDROID *values = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)surface, (unsigned long long)frameId, numTimestamps,
+ (uintptr_t)timestamps, (uintptr_t)values);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Surface *eglSurface = static_cast<Surface *>(surface);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread,
+ ValidateGetFrameTimestampsANDROID(display, eglSurface, frameId,
+ numTimestamps, timestamps, values),
+ "eglGetFrameTimestampsANDROID", GetSurfaceIfValid(display, eglSurface),
+ EGL_FALSE);
+ ANGLE_EGL_TRY_RETURN(
+ thread, eglSurface->getFrameTimestamps(frameId, numTimestamps, timestamps, values),
+ "eglGetFrameTimestampsANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
+
+ thread->setSuccess();
+ return EGL_TRUE;
+}
+
+// EGL_ANGLE_feature_control
+ANGLE_EXPORT const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy,
+ EGLint name,
+ EGLint index)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint name = %d, EGLint index = %d)",
+ (uintptr_t)dpy, name, index);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateQueryStringiANGLE(display, name, index),
+ "eglQueryStringiANGLE", GetDisplayIfValid(display), nullptr);
+
+ thread->setSuccess();
+ return display->queryStringi(name, index);
+}
+
+EGLClientBuffer EGLAPIENTRY EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(const struct AHardwareBuffer *buffer = 0x%016" PRIxPTR ")", (uintptr_t)buffer);
+
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateGetNativeClientBufferANDROID(buffer),
+ "eglGetNativeClientBufferANDROID", nullptr, nullptr);
+
+ thread->setSuccess();
+ return egl::Display::GetNativeClientBuffer(buffer);
+}
+
+EGLint EGLAPIENTRY EGL_DupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync)
+{
+ ANGLE_SCOPED_GLOBAL_LOCK();
+ EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLSyncKHR sync = 0x%016" PRIxPTR ")",
+ (uintptr_t)dpy, (uintptr_t)sync);
+
+ egl::Display *display = static_cast<egl::Display *>(dpy);
+ Sync *syncObject = static_cast<Sync *>(sync);
+ Thread *thread = egl::GetCurrentThread();
+
+ ANGLE_EGL_TRY_RETURN(thread, ValidateDupNativeFenceFDANDROID(display, syncObject),
+ "eglDupNativeFenceFDANDROID", GetSyncIfValid(display, syncObject),
+ EGL_NO_NATIVE_FENCE_FD_ANDROID);
+
+ EGLint result = EGL_NO_NATIVE_FENCE_FD_ANDROID;
+ ANGLE_EGL_TRY_RETURN(thread, syncObject->dupNativeFenceFD(display, &result),
+ "eglDupNativeFenceFDANDROID", GetSyncIfValid(display, syncObject),
+ EGL_NO_NATIVE_FENCE_FD_ANDROID);
+
+ thread->setSuccess();
+ return result;
+}
+
+} // extern "C"
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.h b/gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.h
new file mode 100644
index 0000000000..37aa94619d
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_egl_ext.h
@@ -0,0 +1,222 @@
+//
+// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// entry_points_egl_ext.h : Defines the EGL extension entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTSEGLEXT_H_
+#define LIBGLESV2_ENTRYPOINTSEGLEXT_H_
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <export.h>
+
+extern "C" {
+
+// EGL_ANGLE_query_surface_pointer
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QuerySurfacePointerANGLE(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ void **value);
+
+// EGL_NV_post_sub_buffer
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_PostSubBufferNV(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint x,
+ EGLint y,
+ EGLint width,
+ EGLint height);
+
+// EGL_EXT_platform_base
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY EGL_GetPlatformDisplayEXT(EGLenum platform,
+ void *native_display,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_window,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY EGL_CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy,
+ EGLConfig config,
+ void *native_pixmap,
+ const EGLint *attrib_list);
+
+// EGL_EXT_device_query
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribEXT(EGLDisplay dpy,
+ EGLint attribute,
+ EGLAttrib *value);
+
+// EGL_ANGLE_feature_control
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QueryDisplayAttribANGLE(EGLDisplay dpy,
+ EGLint attribute,
+ EGLAttrib *value);
+
+// EGL_EXT_device_query
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QueryDeviceAttribEXT(EGLDeviceEXT device,
+ EGLint attribute,
+ EGLAttrib *value);
+ANGLE_EXPORT const char *EGLAPIENTRY EGL_QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name);
+
+// EGL_KHR_image_base/EGL_KHR_image
+ANGLE_EXPORT EGLImageKHR EGLAPIENTRY EGL_CreateImageKHR(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image);
+
+// EGL_ANGLE_device_creation
+ANGLE_EXPORT EGLDeviceEXT EGLAPIENTRY EGL_CreateDeviceANGLE(EGLint device_type,
+ void *native_device,
+ const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_ReleaseDeviceANGLE(EGLDeviceEXT device);
+
+// EGL_KHR_stream
+ANGLE_EXPORT EGLStreamKHR EGLAPIENTRY EGL_CreateStreamKHR(EGLDisplay dpy,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_StreamAttribKHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLint value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QueryStreamKHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLint *value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QueryStreamu64KHR(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ EGLenum attribute,
+ EGLuint64KHR *value);
+
+// EGL_KHR_stream_consumer_gltexture
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_StreamConsumerGLTextureExternalKHR(EGLDisplay dpy,
+ EGLStreamKHR stream);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_StreamConsumerAcquireKHR(EGLDisplay dpy,
+ EGLStreamKHR stream);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_StreamConsumerReleaseKHR(EGLDisplay dpy,
+ EGLStreamKHR stream);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY
+EGL_StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ const EGLAttrib *attrib_list);
+
+// EGL_ANGLE_stream_producer_d3d_texture
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY
+EGL_CreateStreamProducerD3DTextureANGLE(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_StreamPostD3DTextureANGLE(EGLDisplay dpy,
+ EGLStreamKHR stream,
+ void *texture,
+ const EGLAttrib *attrib_list);
+
+// EGL_KHR_fence_sync
+ANGLE_EXPORT EGLSync EGLAPIENTRY EGL_CreateSyncKHR(EGLDisplay dpy,
+ EGLenum type,
+ const EGLint *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_DestroySyncKHR(EGLDisplay dpy, EGLSync sync);
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint flags,
+ EGLTime timeout);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetSyncAttribKHR(EGLDisplay dpy,
+ EGLSync sync,
+ EGLint attribute,
+ EGLint *value);
+
+// EGL_KHR_wait_sync
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_WaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags);
+
+// EGL_CHROMIUM_get_sync_values
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetSyncValuesCHROMIUM(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *ust,
+ EGLuint64KHR *msc,
+ EGLuint64KHR *sbc);
+
+// EGL_KHR_swap_buffers_with_damage
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_SwapBuffersWithDamageKHR(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint *rects,
+ EGLint n_rects);
+
+// EGL_ANDROID_presentation_time
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_PresentationTimeANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLnsecsANDROID time);
+
+// EGL_ANDRIOD_blob_cache
+ANGLE_EXPORT void EGLAPIENTRY EGL_SetBlobCacheFuncsANDROID(EGLDisplay dpy,
+ EGLSetBlobFuncANDROID set,
+ EGLGetBlobFuncANDROID get);
+
+// EGL_ANGLE_program_cache_control
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib);
+ANGLE_EXPORT void EGLAPIENTRY EGL_ProgramCacheQueryANGLE(EGLDisplay dpy,
+ EGLint index,
+ void *key,
+ EGLint *keysize,
+ void *binary,
+ EGLint *binarysize);
+ANGLE_EXPORT void EGLAPIENTRY EGL_ProgramCachePopulateANGLE(EGLDisplay dpy,
+ const void *key,
+ EGLint keysize,
+ const void *binary,
+ EGLint binarysize);
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ProgramCacheResizeANGLE(EGLDisplay dpy,
+ EGLint limit,
+ EGLenum mode);
+
+// EGL_KHR_debug
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_DebugMessageControlKHR(EGLDEBUGPROCKHR callback,
+ const EGLAttrib *attrib_list);
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_QueryDebugKHR(EGLint attribute, EGLAttrib *value);
+
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_LabelObjectKHR(EGLDisplay display,
+ EGLenum objectType,
+ EGLObjectKHR object,
+ EGLLabelKHR label);
+
+// ANDROID_get_frame_timestamps
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingSupportedANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint name);
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint numTimestamps,
+ const EGLint *names,
+ EGLnsecsANDROID *values);
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetNextFrameIdANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR *frameId);
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampSupportedANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint timestamp);
+
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLuint64KHR frameId,
+ EGLint numTimestamps,
+ const EGLint *timestamps,
+ EGLnsecsANDROID *values);
+
+// EGL_ANGLE_feature_control
+ANGLE_EXPORT const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy,
+ EGLint name,
+ EGLint index);
+
+// EGL_ANDROID_get_native_client_buffer
+ANGLE_EXPORT EGLClientBuffer EGLAPIENTRY
+EGL_GetNativeClientBufferANDROID(const struct AHardwareBuffer *buffer);
+
+// EGL_ANDROID_native_fence_sync
+ANGLE_EXPORT EGLint EGLAPIENTRY EGL_DupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync);
+
+} // extern "C"
+
+#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp
new file mode 100644
index 0000000000..c210033aaa
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp
@@ -0,0 +1,1429 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_1_0_autogen.cpp:
+// Defines the GLES 1.0 entry points.
+
+#include "libGLESv2/entry_points_gles_1_0_autogen.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Context.inl.h"
+#include "libANGLE/capture_gles_1_0_autogen.h"
+#include "libANGLE/entry_points_utils.h"
+#include "libANGLE/validationES1.h"
+#include "libGLESv2/global_state.h"
+
+namespace gl
+{
+void GL_APIENTRY AlphaFunc(GLenum func, GLfloat ref)
+{
+ EVENT("(GLenum func = 0x%X, GLfloat ref = %f)", func, ref);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ AlphaTestFunc funcPacked = FromGLenum<AlphaTestFunc>(func);
+ ANGLE_CAPTURE(AlphaFunc, context, funcPacked, ref);
+ if (context->skipValidation() || ValidateAlphaFunc(context, funcPacked, ref))
+ {
+ context->alphaFunc(funcPacked, ref);
+ }
+ }
+}
+
+void GL_APIENTRY AlphaFuncx(GLenum func, GLfixed ref)
+{
+ EVENT("(GLenum func = 0x%X, GLfixed ref = 0x%X)", func, ref);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ AlphaTestFunc funcPacked = FromGLenum<AlphaTestFunc>(func);
+ ANGLE_CAPTURE(AlphaFuncx, context, funcPacked, ref);
+ if (context->skipValidation() || ValidateAlphaFuncx(context, funcPacked, ref))
+ {
+ context->alphaFuncx(funcPacked, ref);
+ }
+ }
+}
+
+void GL_APIENTRY ClearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ EVENT("(GLfixed red = 0x%X, GLfixed green = 0x%X, GLfixed blue = 0x%X, GLfixed alpha = 0x%X)",
+ red, green, blue, alpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearColorx, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateClearColorx(context, red, green, blue, alpha))
+ {
+ context->clearColorx(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY ClearDepthx(GLfixed depth)
+{
+ EVENT("(GLfixed depth = 0x%X)", depth);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearDepthx, context, depth);
+ if (context->skipValidation() || ValidateClearDepthx(context, depth))
+ {
+ context->clearDepthx(depth);
+ }
+ }
+}
+
+void GL_APIENTRY ClientActiveTexture(GLenum texture)
+{
+ EVENT("(GLenum texture = 0x%X)", texture);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClientActiveTexture, context, texture);
+ if (context->skipValidation() || ValidateClientActiveTexture(context, texture))
+ {
+ context->clientActiveTexture(texture);
+ }
+ }
+}
+
+void GL_APIENTRY ClipPlanef(GLenum p, const GLfloat *eqn)
+{
+ EVENT("(GLenum p = 0x%X, const GLfloat *eqn = 0x%016" PRIxPTR ")", p, (uintptr_t)eqn);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClipPlanef, context, p, eqn);
+ if (context->skipValidation() || ValidateClipPlanef(context, p, eqn))
+ {
+ context->clipPlanef(p, eqn);
+ }
+ }
+}
+
+void GL_APIENTRY ClipPlanex(GLenum plane, const GLfixed *equation)
+{
+ EVENT("(GLenum plane = 0x%X, const GLfixed *equation = 0x%016" PRIxPTR ")", plane,
+ (uintptr_t)equation);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClipPlanex, context, plane, equation);
+ if (context->skipValidation() || ValidateClipPlanex(context, plane, equation))
+ {
+ context->clipPlanex(plane, equation);
+ }
+ }
+}
+
+void GL_APIENTRY Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red,
+ green, blue, alpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Color4f, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColor4f(context, red, green, blue, alpha))
+ {
+ context->color4f(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ EVENT("(GLubyte red = %d, GLubyte green = %d, GLubyte blue = %d, GLubyte alpha = %d)", red,
+ green, blue, alpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Color4ub, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColor4ub(context, red, green, blue, alpha))
+ {
+ context->color4ub(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ EVENT("(GLfixed red = 0x%X, GLfixed green = 0x%X, GLfixed blue = 0x%X, GLfixed alpha = 0x%X)",
+ red, green, blue, alpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Color4x, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColor4x(context, red, green, blue, alpha))
+ {
+ context->color4x(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY ColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(ColorPointer, context, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateColorPointer(context, size, typePacked, stride, pointer))
+ {
+ context->colorPointer(size, typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY DepthRangex(GLfixed n, GLfixed f)
+{
+ EVENT("(GLfixed n = 0x%X, GLfixed f = 0x%X)", n, f);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DepthRangex, context, n, f);
+ if (context->skipValidation() || ValidateDepthRangex(context, n, f))
+ {
+ context->depthRangex(n, f);
+ }
+ }
+}
+
+void GL_APIENTRY DisableClientState(GLenum array)
+{
+ EVENT("(GLenum array = 0x%X)", array);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ClientVertexArrayType arrayPacked = FromGLenum<ClientVertexArrayType>(array);
+ ANGLE_CAPTURE(DisableClientState, context, arrayPacked);
+ if (context->skipValidation() || ValidateDisableClientState(context, arrayPacked))
+ {
+ context->disableClientState(arrayPacked);
+ }
+ }
+}
+
+void GL_APIENTRY EnableClientState(GLenum array)
+{
+ EVENT("(GLenum array = 0x%X)", array);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ClientVertexArrayType arrayPacked = FromGLenum<ClientVertexArrayType>(array);
+ ANGLE_CAPTURE(EnableClientState, context, arrayPacked);
+ if (context->skipValidation() || ValidateEnableClientState(context, arrayPacked))
+ {
+ context->enableClientState(arrayPacked);
+ }
+ }
+}
+
+void GL_APIENTRY Fogf(GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Fogf, context, pname, param);
+ if (context->skipValidation() || ValidateFogf(context, pname, param))
+ {
+ context->fogf(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY Fogfv(GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Fogfv, context, pname, params);
+ if (context->skipValidation() || ValidateFogfv(context, pname, params))
+ {
+ context->fogfv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY Fogx(GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed param = 0x%X)", pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Fogx, context, pname, param);
+ if (context->skipValidation() || ValidateFogx(context, pname, param))
+ {
+ context->fogx(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY Fogxv(GLenum pname, const GLfixed *param)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfixed *param = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Fogxv, context, pname, param);
+ if (context->skipValidation() || ValidateFogxv(context, pname, param))
+ {
+ context->fogxv(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY Frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f)
+{
+ EVENT(
+ "(GLfloat l = %f, GLfloat r = %f, GLfloat b = %f, GLfloat t = %f, GLfloat n = %f, GLfloat "
+ "f = %f)",
+ l, r, b, t, n, f);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Frustumf, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateFrustumf(context, l, r, b, t, n, f))
+ {
+ context->frustumf(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY Frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
+{
+ EVENT(
+ "(GLfixed l = 0x%X, GLfixed r = 0x%X, GLfixed b = 0x%X, GLfixed t = 0x%X, GLfixed n = "
+ "0x%X, GLfixed f = 0x%X)",
+ l, r, b, t, n, f);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Frustumx, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateFrustumx(context, l, r, b, t, n, f))
+ {
+ context->frustumx(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY GetClipPlanef(GLenum plane, GLfloat *equation)
+{
+ EVENT("(GLenum plane = 0x%X, GLfloat *equation = 0x%016" PRIxPTR ")", plane,
+ (uintptr_t)equation);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetClipPlanef, context, plane, equation);
+ if (context->skipValidation() || ValidateGetClipPlanef(context, plane, equation))
+ {
+ context->getClipPlanef(plane, equation);
+ }
+ }
+}
+
+void GL_APIENTRY GetClipPlanex(GLenum plane, GLfixed *equation)
+{
+ EVENT("(GLenum plane = 0x%X, GLfixed *equation = 0x%016" PRIxPTR ")", plane,
+ (uintptr_t)equation);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetClipPlanex, context, plane, equation);
+ if (context->skipValidation() || ValidateGetClipPlanex(context, plane, equation))
+ {
+ context->getClipPlanex(plane, equation);
+ }
+ }
+}
+
+void GL_APIENTRY GetFixedv(GLenum pname, GLfixed *params)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFixedv, context, pname, params);
+ if (context->skipValidation() || ValidateGetFixedv(context, pname, params))
+ {
+ context->getFixedv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetLightfv(GLenum light, GLenum pname, GLfloat *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", light,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(GetLightfv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetLightfv(context, light, pnamePacked, params))
+ {
+ context->getLightfv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetLightxv(GLenum light, GLenum pname, GLfixed *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", light,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(GetLightxv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetLightxv(context, light, pnamePacked, params))
+ {
+ context->getLightxv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", face,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(GetMaterialfv, context, face, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetMaterialfv(context, face, pnamePacked, params))
+ {
+ context->getMaterialfv(face, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", face,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(GetMaterialxv, context, face, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetMaterialxv(context, face, pnamePacked, params))
+ {
+ context->getMaterialxv(face, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetPointerv(GLenum pname, void **params)
+{
+ EVENT("(GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetPointerv, context, pname, params);
+ if (context->skipValidation() || ValidateGetPointerv(context, pname, params))
+ {
+ context->getPointerv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(GetTexEnvfv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateGetTexEnvfv(context, targetPacked, pnamePacked, params))
+ {
+ context->getTexEnvfv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexEnviv(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(GetTexEnviv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateGetTexEnviv(context, targetPacked, pnamePacked, params))
+ {
+ context->getTexEnviv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(GetTexEnvxv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateGetTexEnvxv(context, targetPacked, pnamePacked, params))
+ {
+ context->getTexEnvxv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterxv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterxv(context, targetPacked, pname, params))
+ {
+ context->getTexParameterxv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY LightModelf(GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LightModelf, context, pname, param);
+ if (context->skipValidation() || ValidateLightModelf(context, pname, param))
+ {
+ context->lightModelf(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY LightModelfv(GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LightModelfv, context, pname, params);
+ if (context->skipValidation() || ValidateLightModelfv(context, pname, params))
+ {
+ context->lightModelfv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY LightModelx(GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed param = 0x%X)", pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LightModelx, context, pname, param);
+ if (context->skipValidation() || ValidateLightModelx(context, pname, param))
+ {
+ context->lightModelx(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY LightModelxv(GLenum pname, const GLfixed *param)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfixed *param = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LightModelxv, context, pname, param);
+ if (context->skipValidation() || ValidateLightModelxv(context, pname, param))
+ {
+ context->lightModelxv(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY Lightf(GLenum light, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", light, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightf, context, light, pnamePacked, param);
+ if (context->skipValidation() || ValidateLightf(context, light, pnamePacked, param))
+ {
+ context->lightf(light, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY Lightfv(GLenum light, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ light, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightfv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateLightfv(context, light, pnamePacked, params))
+ {
+ context->lightfv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY Lightx(GLenum light, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", light, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightx, context, light, pnamePacked, param);
+ if (context->skipValidation() || ValidateLightx(context, light, pnamePacked, param))
+ {
+ context->lightx(light, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY Lightxv(GLenum light, GLenum pname, const GLfixed *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ light, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightxv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateLightxv(context, light, pnamePacked, params))
+ {
+ context->lightxv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY LineWidthx(GLfixed width)
+{
+ EVENT("(GLfixed width = 0x%X)", width);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LineWidthx, context, width);
+ if (context->skipValidation() || ValidateLineWidthx(context, width))
+ {
+ context->lineWidthx(width);
+ }
+ }
+}
+
+void GL_APIENTRY LoadIdentity()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LoadIdentity, context);
+ if (context->skipValidation() || ValidateLoadIdentity(context))
+ {
+ context->loadIdentity();
+ }
+ }
+}
+
+void GL_APIENTRY LoadMatrixf(const GLfloat *m)
+{
+ EVENT("(const GLfloat *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LoadMatrixf, context, m);
+ if (context->skipValidation() || ValidateLoadMatrixf(context, m))
+ {
+ context->loadMatrixf(m);
+ }
+ }
+}
+
+void GL_APIENTRY LoadMatrixx(const GLfixed *m)
+{
+ EVENT("(const GLfixed *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LoadMatrixx, context, m);
+ if (context->skipValidation() || ValidateLoadMatrixx(context, m))
+ {
+ context->loadMatrixx(m);
+ }
+ }
+}
+
+void GL_APIENTRY LogicOp(GLenum opcode)
+{
+ EVENT("(GLenum opcode = 0x%X)", opcode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ LogicalOperation opcodePacked = FromGLenum<LogicalOperation>(opcode);
+ ANGLE_CAPTURE(LogicOp, context, opcodePacked);
+ if (context->skipValidation() || ValidateLogicOp(context, opcodePacked))
+ {
+ context->logicOp(opcodePacked);
+ }
+ }
+}
+
+void GL_APIENTRY Materialf(GLenum face, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", face, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialf, context, face, pnamePacked, param);
+ if (context->skipValidation() || ValidateMaterialf(context, face, pnamePacked, param))
+ {
+ context->materialf(face, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY Materialfv(GLenum face, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ face, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialfv, context, face, pnamePacked, params);
+ if (context->skipValidation() || ValidateMaterialfv(context, face, pnamePacked, params))
+ {
+ context->materialfv(face, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY Materialx(GLenum face, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", face, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialx, context, face, pnamePacked, param);
+ if (context->skipValidation() || ValidateMaterialx(context, face, pnamePacked, param))
+ {
+ context->materialx(face, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY Materialxv(GLenum face, GLenum pname, const GLfixed *param)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, const GLfixed *param = 0x%016" PRIxPTR ")",
+ face, pname, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialxv, context, face, pnamePacked, param);
+ if (context->skipValidation() || ValidateMaterialxv(context, face, pnamePacked, param))
+ {
+ context->materialxv(face, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY MatrixMode(GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ MatrixType modePacked = FromGLenum<MatrixType>(mode);
+ ANGLE_CAPTURE(MatrixMode, context, modePacked);
+ if (context->skipValidation() || ValidateMatrixMode(context, modePacked))
+ {
+ context->matrixMode(modePacked);
+ }
+ }
+}
+
+void GL_APIENTRY MultMatrixf(const GLfloat *m)
+{
+ EVENT("(const GLfloat *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MultMatrixf, context, m);
+ if (context->skipValidation() || ValidateMultMatrixf(context, m))
+ {
+ context->multMatrixf(m);
+ }
+ }
+}
+
+void GL_APIENTRY MultMatrixx(const GLfixed *m)
+{
+ EVENT("(const GLfixed *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MultMatrixx, context, m);
+ if (context->skipValidation() || ValidateMultMatrixx(context, m))
+ {
+ context->multMatrixx(m);
+ }
+ }
+}
+
+void GL_APIENTRY MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ EVENT("(GLenum target = 0x%X, GLfloat s = %f, GLfloat t = %f, GLfloat r = %f, GLfloat q = %f)",
+ target, s, t, r, q);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MultiTexCoord4f, context, target, s, t, r, q);
+ if (context->skipValidation() || ValidateMultiTexCoord4f(context, target, s, t, r, q))
+ {
+ context->multiTexCoord4f(target, s, t, r, q);
+ }
+ }
+}
+
+void GL_APIENTRY MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+{
+ EVENT(
+ "(GLenum texture = 0x%X, GLfixed s = 0x%X, GLfixed t = 0x%X, GLfixed r = 0x%X, GLfixed q = "
+ "0x%X)",
+ texture, s, t, r, q);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MultiTexCoord4x, context, texture, s, t, r, q);
+ if (context->skipValidation() || ValidateMultiTexCoord4x(context, texture, s, t, r, q))
+ {
+ context->multiTexCoord4x(texture, s, t, r, q);
+ }
+ }
+}
+
+void GL_APIENTRY Normal3f(GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ EVENT("(GLfloat nx = %f, GLfloat ny = %f, GLfloat nz = %f)", nx, ny, nz);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Normal3f, context, nx, ny, nz);
+ if (context->skipValidation() || ValidateNormal3f(context, nx, ny, nz))
+ {
+ context->normal3f(nx, ny, nz);
+ }
+ }
+}
+
+void GL_APIENTRY Normal3x(GLfixed nx, GLfixed ny, GLfixed nz)
+{
+ EVENT("(GLfixed nx = 0x%X, GLfixed ny = 0x%X, GLfixed nz = 0x%X)", nx, ny, nz);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Normal3x, context, nx, ny, nz);
+ if (context->skipValidation() || ValidateNormal3x(context, nx, ny, nz))
+ {
+ context->normal3x(nx, ny, nz);
+ }
+ }
+}
+
+void GL_APIENTRY NormalPointer(GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT("(GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR ")",
+ type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(NormalPointer, context, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateNormalPointer(context, typePacked, stride, pointer))
+ {
+ context->normalPointer(typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY Orthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f)
+{
+ EVENT(
+ "(GLfloat l = %f, GLfloat r = %f, GLfloat b = %f, GLfloat t = %f, GLfloat n = %f, GLfloat "
+ "f = %f)",
+ l, r, b, t, n, f);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Orthof, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateOrthof(context, l, r, b, t, n, f))
+ {
+ context->orthof(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY Orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
+{
+ EVENT(
+ "(GLfixed l = 0x%X, GLfixed r = 0x%X, GLfixed b = 0x%X, GLfixed t = 0x%X, GLfixed n = "
+ "0x%X, GLfixed f = 0x%X)",
+ l, r, b, t, n, f);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Orthox, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateOrthox(context, l, r, b, t, n, f))
+ {
+ context->orthox(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterf(GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterf, context, pnamePacked, param);
+ if (context->skipValidation() || ValidatePointParameterf(context, pnamePacked, param))
+ {
+ context->pointParameterf(pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterfv(GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterfv, context, pnamePacked, params);
+ if (context->skipValidation() || ValidatePointParameterfv(context, pnamePacked, params))
+ {
+ context->pointParameterfv(pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterx(GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed param = 0x%X)", pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterx, context, pnamePacked, param);
+ if (context->skipValidation() || ValidatePointParameterx(context, pnamePacked, param))
+ {
+ context->pointParameterx(pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterxv(GLenum pname, const GLfixed *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterxv, context, pnamePacked, params);
+ if (context->skipValidation() || ValidatePointParameterxv(context, pnamePacked, params))
+ {
+ context->pointParameterxv(pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY PointSize(GLfloat size)
+{
+ EVENT("(GLfloat size = %f)", size);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PointSize, context, size);
+ if (context->skipValidation() || ValidatePointSize(context, size))
+ {
+ context->pointSize(size);
+ }
+ }
+}
+
+void GL_APIENTRY PointSizex(GLfixed size)
+{
+ EVENT("(GLfixed size = 0x%X)", size);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PointSizex, context, size);
+ if (context->skipValidation() || ValidatePointSizex(context, size))
+ {
+ context->pointSizex(size);
+ }
+ }
+}
+
+void GL_APIENTRY PolygonOffsetx(GLfixed factor, GLfixed units)
+{
+ EVENT("(GLfixed factor = 0x%X, GLfixed units = 0x%X)", factor, units);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PolygonOffsetx, context, factor, units);
+ if (context->skipValidation() || ValidatePolygonOffsetx(context, factor, units))
+ {
+ context->polygonOffsetx(factor, units);
+ }
+ }
+}
+
+void GL_APIENTRY PopMatrix()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PopMatrix, context);
+ if (context->skipValidation() || ValidatePopMatrix(context))
+ {
+ context->popMatrix();
+ }
+ }
+}
+
+void GL_APIENTRY PushMatrix()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PushMatrix, context);
+ if (context->skipValidation() || ValidatePushMatrix(context))
+ {
+ context->pushMatrix();
+ }
+ }
+}
+
+void GL_APIENTRY Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLfloat angle = %f, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", angle, x, y, z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Rotatef, context, angle, x, y, z);
+ if (context->skipValidation() || ValidateRotatef(context, angle, x, y, z))
+ {
+ context->rotatef(angle, x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+{
+ EVENT("(GLfixed angle = 0x%X, GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X)", angle, x,
+ y, z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Rotatex, context, angle, x, y, z);
+ if (context->skipValidation() || ValidateRotatex(context, angle, x, y, z))
+ {
+ context->rotatex(angle, x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY SampleCoveragex(GLclampx value, GLboolean invert)
+{
+ EVENT("(GLclampx value = 0x%X, GLboolean invert = %u)", value, invert);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SampleCoveragex, context, value, invert);
+ if (context->skipValidation() || ValidateSampleCoveragex(context, value, invert))
+ {
+ context->sampleCoveragex(value, invert);
+ }
+ }
+}
+
+void GL_APIENTRY Scalef(GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", x, y, z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Scalef, context, x, y, z);
+ if (context->skipValidation() || ValidateScalef(context, x, y, z))
+ {
+ context->scalef(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY Scalex(GLfixed x, GLfixed y, GLfixed z)
+{
+ EVENT("(GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X)", x, y, z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Scalex, context, x, y, z);
+ if (context->skipValidation() || ValidateScalex(context, x, y, z))
+ {
+ context->scalex(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY ShadeModel(GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ShadingModel modePacked = FromGLenum<ShadingModel>(mode);
+ ANGLE_CAPTURE(ShadeModel, context, modePacked);
+ if (context->skipValidation() || ValidateShadeModel(context, modePacked))
+ {
+ context->shadeModel(modePacked);
+ }
+ }
+}
+
+void GL_APIENTRY TexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(TexCoordPointer, context, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateTexCoordPointer(context, size, typePacked, stride, pointer))
+ {
+ context->texCoordPointer(size, typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvf(GLenum target, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvf, context, targetPacked, pnamePacked, param);
+ if (context->skipValidation() || ValidateTexEnvf(context, targetPacked, pnamePacked, param))
+ {
+ context->texEnvf(targetPacked, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvfv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateTexEnvfv(context, targetPacked, pnamePacked, params))
+ {
+ context->texEnvfv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvi(GLenum target, GLenum pname, GLint param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvi, context, targetPacked, pnamePacked, param);
+ if (context->skipValidation() || ValidateTexEnvi(context, targetPacked, pnamePacked, param))
+ {
+ context->texEnvi(targetPacked, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnviv(GLenum target, GLenum pname, const GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnviv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateTexEnviv(context, targetPacked, pnamePacked, params))
+ {
+ context->texEnviv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvx(GLenum target, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", target, pname,
+ param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvx, context, targetPacked, pnamePacked, param);
+ if (context->skipValidation() || ValidateTexEnvx(context, targetPacked, pnamePacked, param))
+ {
+ context->texEnvx(targetPacked, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvxv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateTexEnvxv(context, targetPacked, pnamePacked, params))
+ {
+ context->texEnvxv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterx(GLenum target, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", target, pname,
+ param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterx, context, targetPacked, pname, param);
+ if (context->skipValidation() || ValidateTexParameterx(context, targetPacked, pname, param))
+ {
+ context->texParameterx(targetPacked, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterxv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterxv(context, targetPacked, pname, params))
+ {
+ context->texParameterxv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY Translatef(GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", x, y, z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Translatef, context, x, y, z);
+ if (context->skipValidation() || ValidateTranslatef(context, x, y, z))
+ {
+ context->translatef(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY Translatex(GLfixed x, GLfixed y, GLfixed z)
+{
+ EVENT("(GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X)", x, y, z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Translatex, context, x, y, z);
+ if (context->skipValidation() || ValidateTranslatex(context, x, y, z))
+ {
+ context->translatex(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY VertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexPointer, context, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateVertexPointer(context, size, typePacked, stride, pointer))
+ {
+ context->vertexPointer(size, typePacked, stride, pointer);
+ }
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h
new file mode 100644
index 0000000000..ba098f51b9
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h
@@ -0,0 +1,122 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_1_0_autogen.h:
+// Defines the GLES 1.0 entry points.
+
+#ifndef LIBGLESV2_ENTRY_POINTS_GLES_1_0_AUTOGEN_H_
+#define LIBGLESV2_ENTRY_POINTS_GLES_1_0_AUTOGEN_H_
+
+#include <GLES/gl.h>
+#include <export.h>
+
+namespace gl
+{
+ANGLE_EXPORT void GL_APIENTRY AlphaFunc(GLenum func, GLfloat ref);
+ANGLE_EXPORT void GL_APIENTRY AlphaFuncx(GLenum func, GLfixed ref);
+ANGLE_EXPORT void GL_APIENTRY ClearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+ANGLE_EXPORT void GL_APIENTRY ClearDepthx(GLfixed depth);
+ANGLE_EXPORT void GL_APIENTRY ClientActiveTexture(GLenum texture);
+ANGLE_EXPORT void GL_APIENTRY ClipPlanef(GLenum p, const GLfloat *eqn);
+ANGLE_EXPORT void GL_APIENTRY ClipPlanex(GLenum plane, const GLfixed *equation);
+ANGLE_EXPORT void GL_APIENTRY Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+ANGLE_EXPORT void GL_APIENTRY Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+ANGLE_EXPORT void GL_APIENTRY ColorPointer(GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY DepthRangex(GLfixed n, GLfixed f);
+ANGLE_EXPORT void GL_APIENTRY DisableClientState(GLenum array);
+ANGLE_EXPORT void GL_APIENTRY EnableClientState(GLenum array);
+ANGLE_EXPORT void GL_APIENTRY Fogf(GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY Fogfv(GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY Fogx(GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY Fogxv(GLenum pname, const GLfixed *param);
+ANGLE_EXPORT void GL_APIENTRY
+Frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+ANGLE_EXPORT void GL_APIENTRY
+Frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+ANGLE_EXPORT void GL_APIENTRY GetClipPlanef(GLenum plane, GLfloat *equation);
+ANGLE_EXPORT void GL_APIENTRY GetClipPlanex(GLenum plane, GLfixed *equation);
+ANGLE_EXPORT void GL_APIENTRY GetFixedv(GLenum pname, GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetLightfv(GLenum light, GLenum pname, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetLightxv(GLenum light, GLenum pname, GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetMaterialfv(GLenum face, GLenum pname, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetMaterialxv(GLenum face, GLenum pname, GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetPointerv(GLenum pname, void **params);
+ANGLE_EXPORT void GL_APIENTRY GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexEnviv(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY LightModelf(GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY LightModelfv(GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY LightModelx(GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY LightModelxv(GLenum pname, const GLfixed *param);
+ANGLE_EXPORT void GL_APIENTRY Lightf(GLenum light, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY Lightfv(GLenum light, GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY Lightx(GLenum light, GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY Lightxv(GLenum light, GLenum pname, const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY LineWidthx(GLfixed width);
+ANGLE_EXPORT void GL_APIENTRY LoadIdentity();
+ANGLE_EXPORT void GL_APIENTRY LoadMatrixf(const GLfloat *m);
+ANGLE_EXPORT void GL_APIENTRY LoadMatrixx(const GLfixed *m);
+ANGLE_EXPORT void GL_APIENTRY LogicOp(GLenum opcode);
+ANGLE_EXPORT void GL_APIENTRY Materialf(GLenum face, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY Materialfv(GLenum face, GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY Materialx(GLenum face, GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY Materialxv(GLenum face, GLenum pname, const GLfixed *param);
+ANGLE_EXPORT void GL_APIENTRY MatrixMode(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY MultMatrixf(const GLfloat *m);
+ANGLE_EXPORT void GL_APIENTRY MultMatrixx(const GLfixed *m);
+ANGLE_EXPORT void GL_APIENTRY
+MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+ANGLE_EXPORT void GL_APIENTRY
+MultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+ANGLE_EXPORT void GL_APIENTRY Normal3f(GLfloat nx, GLfloat ny, GLfloat nz);
+ANGLE_EXPORT void GL_APIENTRY Normal3x(GLfixed nx, GLfixed ny, GLfixed nz);
+ANGLE_EXPORT void GL_APIENTRY NormalPointer(GLenum type, GLsizei stride, const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY
+Orthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
+ANGLE_EXPORT void GL_APIENTRY
+Orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
+ANGLE_EXPORT void GL_APIENTRY PointParameterf(GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY PointParameterfv(GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY PointParameterx(GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY PointParameterxv(GLenum pname, const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY PointSize(GLfloat size);
+ANGLE_EXPORT void GL_APIENTRY PointSizex(GLfixed size);
+ANGLE_EXPORT void GL_APIENTRY PolygonOffsetx(GLfixed factor, GLfixed units);
+ANGLE_EXPORT void GL_APIENTRY PopMatrix();
+ANGLE_EXPORT void GL_APIENTRY PushMatrix();
+ANGLE_EXPORT void GL_APIENTRY Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+ANGLE_EXPORT void GL_APIENTRY SampleCoveragex(GLclampx value, GLboolean invert);
+ANGLE_EXPORT void GL_APIENTRY Scalef(GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY Scalex(GLfixed x, GLfixed y, GLfixed z);
+ANGLE_EXPORT void GL_APIENTRY ShadeModel(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY TexCoordPointer(GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY TexEnvf(GLenum target, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY TexEnvfv(GLenum target, GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexEnvi(GLenum target, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY TexEnviv(GLenum target, GLenum pname, const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexEnvx(GLenum target, GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY TexEnvxv(GLenum target, GLenum pname, const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterx(GLenum target, GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY TexParameterxv(GLenum target, GLenum pname, const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY Translatef(GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY Translatex(GLfixed x, GLfixed y, GLfixed z);
+ANGLE_EXPORT void GL_APIENTRY VertexPointer(GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+} // namespace gl
+
+#endif // LIBGLESV2_ENTRY_POINTS_GLES_1_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp
new file mode 100644
index 0000000000..a723a888ca
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp
@@ -0,0 +1,2503 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_2_0_autogen.cpp:
+// Defines the GLES 2.0 entry points.
+
+#include "libGLESv2/entry_points_gles_2_0_autogen.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Context.inl.h"
+#include "libANGLE/capture_gles_2_0_autogen.h"
+#include "libANGLE/entry_points_utils.h"
+#include "libANGLE/validationES2.h"
+#include "libGLESv2/global_state.h"
+
+namespace gl
+{
+void GL_APIENTRY ActiveTexture(GLenum texture)
+{
+ EVENT("(GLenum texture = 0x%X)", texture);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ActiveTexture, context, texture);
+ if (context->skipValidation() || ValidateActiveTexture(context, texture))
+ {
+ context->activeTexture(texture);
+ }
+ }
+}
+
+void GL_APIENTRY AttachShader(GLuint program, GLuint shader)
+{
+ EVENT("(GLuint program = %u, GLuint shader = %u)", program, shader);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(AttachShader, context, program, shader);
+ if (context->skipValidation() || ValidateAttachShader(context, program, shader))
+ {
+ context->attachShader(program, shader);
+ }
+ }
+}
+
+void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, GLuint index = %u, const GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindAttribLocation, context, program, index, name);
+ if (context->skipValidation() || ValidateBindAttribLocation(context, program, index, name))
+ {
+ context->bindAttribLocation(program, index, name);
+ }
+ }
+}
+
+void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint buffer = %u)", target, buffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BindBuffer, context, targetPacked, buffer);
+ if (context->skipValidation() || ValidateBindBuffer(context, targetPacked, buffer))
+ {
+ context->bindBuffer(targetPacked, buffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint framebuffer = %u)", target, framebuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindFramebuffer, context, target, framebuffer);
+ if (context->skipValidation() || ValidateBindFramebuffer(context, target, framebuffer))
+ {
+ context->bindFramebuffer(target, framebuffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %u)", target, renderbuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindRenderbuffer, context, target, renderbuffer);
+ if (context->skipValidation() || ValidateBindRenderbuffer(context, target, renderbuffer))
+ {
+ context->bindRenderbuffer(target, renderbuffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindTexture(GLenum target, GLuint texture)
+{
+ EVENT("(GLenum target = 0x%X, GLuint texture = %u)", target, texture);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(BindTexture, context, targetPacked, texture);
+ if (context->skipValidation() || ValidateBindTexture(context, targetPacked, texture))
+ {
+ context->bindTexture(targetPacked, texture);
+ }
+ }
+}
+
+void GL_APIENTRY BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red,
+ green, blue, alpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BlendColor, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateBlendColor(context, red, green, blue, alpha))
+ {
+ context->blendColor(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY BlendEquation(GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BlendEquation, context, mode);
+ if (context->skipValidation() || ValidateBlendEquation(context, mode))
+ {
+ context->blendEquation(mode);
+ }
+ }
+}
+
+void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+ EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BlendEquationSeparate, context, modeRGB, modeAlpha);
+ if (context->skipValidation() || ValidateBlendEquationSeparate(context, modeRGB, modeAlpha))
+ {
+ context->blendEquationSeparate(modeRGB, modeAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor)
+{
+ EVENT("(GLenum sfactor = 0x%X, GLenum dfactor = 0x%X)", sfactor, dfactor);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BlendFunc, context, sfactor, dfactor);
+ if (context->skipValidation() || ValidateBlendFunc(context, sfactor, dfactor))
+ {
+ context->blendFunc(sfactor, dfactor);
+ }
+ }
+}
+
+void GL_APIENTRY BlendFuncSeparate(GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha)
+{
+ EVENT(
+ "(GLenum sfactorRGB = 0x%X, GLenum dfactorRGB = 0x%X, GLenum sfactorAlpha = 0x%X, GLenum "
+ "dfactorAlpha = 0x%X)",
+ sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BlendFuncSeparate, context, sfactorRGB, dfactorRGB, sfactorAlpha,
+ dfactorAlpha);
+ if (context->skipValidation() ||
+ ValidateBlendFuncSeparate(context, sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha))
+ {
+ context->blendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
+{
+ EVENT("(GLenum target = 0x%X, GLsizeiptr size = %llu, const void *data = 0x%016" PRIxPTR
+ ", GLenum usage = 0x%X)",
+ target, static_cast<unsigned long long>(size), (uintptr_t)data, usage);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ BufferUsage usagePacked = FromGLenum<BufferUsage>(usage);
+ ANGLE_CAPTURE(BufferData, context, targetPacked, size, data, usagePacked);
+ if (context->skipValidation() ||
+ ValidateBufferData(context, targetPacked, size, data, usagePacked))
+ {
+ context->bufferData(targetPacked, size, data, usagePacked);
+ }
+ }
+}
+
+void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr size = %llu, const void *data = "
+ "0x%016" PRIxPTR ")",
+ target, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
+ (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BufferSubData, context, targetPacked, offset, size, data);
+ if (context->skipValidation() ||
+ ValidateBufferSubData(context, targetPacked, offset, size, data))
+ {
+ context->bufferSubData(targetPacked, offset, size, data);
+ }
+ }
+}
+
+GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CheckFramebufferStatus, context, target);
+ if (context->skipValidation() || ValidateCheckFramebufferStatus(context, target))
+ {
+ return context->checkFramebufferStatus(target);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CheckFramebufferStatus, GLenum>();
+}
+
+void GL_APIENTRY Clear(GLbitfield mask)
+{
+ EVENT("(GLbitfield mask = 0x%X)", mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Clear, context, mask);
+ if (context->skipValidation() || ValidateClear(context, mask))
+ {
+ context->clear(mask);
+ }
+ }
+}
+
+void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red,
+ green, blue, alpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearColor, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateClearColor(context, red, green, blue, alpha))
+ {
+ context->clearColor(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY ClearDepthf(GLfloat d)
+{
+ EVENT("(GLfloat d = %f)", d);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearDepthf, context, d);
+ if (context->skipValidation() || ValidateClearDepthf(context, d))
+ {
+ context->clearDepthf(d);
+ }
+ }
+}
+
+void GL_APIENTRY ClearStencil(GLint s)
+{
+ EVENT("(GLint s = %d)", s);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearStencil, context, s);
+ if (context->skipValidation() || ValidateClearStencil(context, s))
+ {
+ context->clearStencil(s);
+ }
+ }
+}
+
+void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ EVENT("(GLboolean red = %u, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)",
+ red, green, blue, alpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ColorMask, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColorMask(context, red, green, blue, alpha))
+ {
+ context->colorMask(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY CompileShader(GLuint shader)
+{
+ EVENT("(GLuint shader = %u)", shader);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CompileShader, context, shader);
+ if (context->skipValidation() || ValidateCompileShader(context, shader))
+ {
+ context->compileShader(shader);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const void *data = "
+ "0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, imageSize, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage2D, context, targetPacked, level, internalformat, width,
+ height, border, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexImage2D(context, targetPacked, level, internalformat, width,
+ height, border, imageSize, data))
+ {
+ context->compressedTexImage2D(targetPacked, level, internalformat, width, height,
+ border, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei "
+ "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLsizei imageSize = %d, const void "
+ "*data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, imageSize, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage2D, context, targetPacked, level, xoffset, yoffset,
+ width, height, format, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage2D(context, targetPacked, level, xoffset, yoffset, width,
+ height, format, imageSize, data))
+ {
+ context->compressedTexSubImage2D(targetPacked, level, xoffset, yoffset, width, height,
+ format, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLint x = %d, "
+ "GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)",
+ target, level, internalformat, x, y, width, height, border);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexImage2D, context, targetPacked, level, internalformat, x, y, width,
+ height, border);
+ if (context->skipValidation() ||
+ ValidateCopyTexImage2D(context, targetPacked, level, internalformat, x, y, width,
+ height, border))
+ {
+ context->copyTexImage2D(targetPacked, level, internalformat, x, y, width, height,
+ border);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLint x "
+ "= %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, level, xoffset, yoffset, x, y, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexSubImage2D, context, targetPacked, level, xoffset, yoffset, x, y,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateCopyTexSubImage2D(context, targetPacked, level, xoffset, yoffset, x, y, width,
+ height))
+ {
+ context->copyTexSubImage2D(targetPacked, level, xoffset, yoffset, x, y, width, height);
+ }
+ }
+}
+
+GLuint GL_APIENTRY CreateProgram()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CreateProgram, context);
+ if (context->skipValidation() || ValidateCreateProgram(context))
+ {
+ return context->createProgram();
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CreateProgram, GLuint>();
+}
+
+GLuint GL_APIENTRY CreateShader(GLenum type)
+{
+ EVENT("(GLenum type = 0x%X)", type);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ShaderType typePacked = FromGLenum<ShaderType>(type);
+ ANGLE_CAPTURE(CreateShader, context, typePacked);
+ if (context->skipValidation() || ValidateCreateShader(context, typePacked))
+ {
+ return context->createShader(typePacked);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CreateShader, GLuint>();
+}
+
+void GL_APIENTRY CullFace(GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ CullFaceMode modePacked = FromGLenum<CullFaceMode>(mode);
+ ANGLE_CAPTURE(CullFace, context, modePacked);
+ if (context->skipValidation() || ValidateCullFace(context, modePacked))
+ {
+ context->cullFace(modePacked);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *buffers = 0x%016" PRIxPTR ")", n, (uintptr_t)buffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteBuffers, context, n, buffers);
+ if (context->skipValidation() || ValidateDeleteBuffers(context, n, buffers))
+ {
+ context->deleteBuffers(n, buffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *framebuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)framebuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteFramebuffers, context, n, framebuffers);
+ if (context->skipValidation() || ValidateDeleteFramebuffers(context, n, framebuffers))
+ {
+ context->deleteFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteProgram(GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteProgram, context, program);
+ if (context->skipValidation() || ValidateDeleteProgram(context, program))
+ {
+ context->deleteProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteRenderbuffers, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateDeleteRenderbuffers(context, n, renderbuffers))
+ {
+ context->deleteRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteShader(GLuint shader)
+{
+ EVENT("(GLuint shader = %u)", shader);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteShader, context, shader);
+ if (context->skipValidation() || ValidateDeleteShader(context, shader))
+ {
+ context->deleteShader(shader);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint *textures)
+{
+ EVENT("(GLsizei n = %d, const GLuint *textures = 0x%016" PRIxPTR ")", n, (uintptr_t)textures);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteTextures, context, n, textures);
+ if (context->skipValidation() || ValidateDeleteTextures(context, n, textures))
+ {
+ context->deleteTextures(n, textures);
+ }
+ }
+}
+
+void GL_APIENTRY DepthFunc(GLenum func)
+{
+ EVENT("(GLenum func = 0x%X)", func);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DepthFunc, context, func);
+ if (context->skipValidation() || ValidateDepthFunc(context, func))
+ {
+ context->depthFunc(func);
+ }
+ }
+}
+
+void GL_APIENTRY DepthMask(GLboolean flag)
+{
+ EVENT("(GLboolean flag = %u)", flag);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DepthMask, context, flag);
+ if (context->skipValidation() || ValidateDepthMask(context, flag))
+ {
+ context->depthMask(flag);
+ }
+ }
+}
+
+void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f)
+{
+ EVENT("(GLfloat n = %f, GLfloat f = %f)", n, f);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DepthRangef, context, n, f);
+ if (context->skipValidation() || ValidateDepthRangef(context, n, f))
+ {
+ context->depthRangef(n, f);
+ }
+ }
+}
+
+void GL_APIENTRY DetachShader(GLuint program, GLuint shader)
+{
+ EVENT("(GLuint program = %u, GLuint shader = %u)", program, shader);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DetachShader, context, program, shader);
+ if (context->skipValidation() || ValidateDetachShader(context, program, shader))
+ {
+ context->detachShader(program, shader);
+ }
+ }
+}
+
+void GL_APIENTRY Disable(GLenum cap)
+{
+ EVENT("(GLenum cap = 0x%X)", cap);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Disable, context, cap);
+ if (context->skipValidation() || ValidateDisable(context, cap))
+ {
+ context->disable(cap);
+ }
+ }
+}
+
+void GL_APIENTRY DisableVertexAttribArray(GLuint index)
+{
+ EVENT("(GLuint index = %u)", index);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DisableVertexAttribArray, context, index);
+ if (context->skipValidation() || ValidateDisableVertexAttribArray(context, index))
+ {
+ context->disableVertexAttribArray(index);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+ EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArrays, context, modePacked, first, count);
+ if (context->skipValidation() || ValidateDrawArrays(context, modePacked, first, count))
+ {
+ context->drawArrays(modePacked, first, count);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ")",
+ mode, count, type, (uintptr_t)indices);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElements, context, modePacked, count, typePacked, indices);
+ if (context->skipValidation() ||
+ ValidateDrawElements(context, modePacked, count, typePacked, indices))
+ {
+ context->drawElements(modePacked, count, typePacked, indices);
+ }
+ }
+}
+
+void GL_APIENTRY Enable(GLenum cap)
+{
+ EVENT("(GLenum cap = 0x%X)", cap);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Enable, context, cap);
+ if (context->skipValidation() || ValidateEnable(context, cap))
+ {
+ context->enable(cap);
+ }
+ }
+}
+
+void GL_APIENTRY EnableVertexAttribArray(GLuint index)
+{
+ EVENT("(GLuint index = %u)", index);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(EnableVertexAttribArray, context, index);
+ if (context->skipValidation() || ValidateEnableVertexAttribArray(context, index))
+ {
+ context->enableVertexAttribArray(index);
+ }
+ }
+}
+
+void GL_APIENTRY Finish()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Finish, context);
+ if (context->skipValidation() || ValidateFinish(context))
+ {
+ context->finish();
+ }
+ }
+}
+
+void GL_APIENTRY Flush()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Flush, context);
+ if (context->skipValidation() || ValidateFlush(context))
+ {
+ context->flush();
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, GLuint "
+ "renderbuffer = %u)",
+ target, attachment, renderbuffertarget, renderbuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FramebufferRenderbuffer, context, target, attachment, renderbuffertarget,
+ renderbuffer);
+ if (context->skipValidation() ||
+ ValidateFramebufferRenderbuffer(context, target, attachment, renderbuffertarget,
+ renderbuffer))
+ {
+ context->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTexture2D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, GLuint texture "
+ "= %u, GLint level = %d)",
+ target, attachment, textarget, texture, level);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget textargetPacked = FromGLenum<TextureTarget>(textarget);
+ ANGLE_CAPTURE(FramebufferTexture2D, context, target, attachment, textargetPacked, texture,
+ level);
+ if (context->skipValidation() ||
+ ValidateFramebufferTexture2D(context, target, attachment, textargetPacked, texture,
+ level))
+ {
+ context->framebufferTexture2D(target, attachment, textargetPacked, texture, level);
+ }
+ }
+}
+
+void GL_APIENTRY FrontFace(GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FrontFace, context, mode);
+ if (context->skipValidation() || ValidateFrontFace(context, mode))
+ {
+ context->frontFace(mode);
+ }
+ }
+}
+
+void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *buffers = 0x%016" PRIxPTR ")", n, (uintptr_t)buffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenBuffers, context, n, buffers);
+ if (context->skipValidation() || ValidateGenBuffers(context, n, buffers))
+ {
+ context->genBuffers(n, buffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *framebuffers = 0x%016" PRIxPTR ")", n, (uintptr_t)framebuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenFramebuffers, context, n, framebuffers);
+ if (context->skipValidation() || ValidateGenFramebuffers(context, n, framebuffers))
+ {
+ context->genFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenRenderbuffers, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateGenRenderbuffers(context, n, renderbuffers))
+ {
+ context->genRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures)
+{
+ EVENT("(GLsizei n = %d, GLuint *textures = 0x%016" PRIxPTR ")", n, (uintptr_t)textures);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenTextures, context, n, textures);
+ if (context->skipValidation() || ValidateGenTextures(context, n, textures))
+ {
+ context->genTextures(n, textures);
+ }
+ }
+}
+
+void GL_APIENTRY GenerateMipmap(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GenerateMipmap, context, targetPacked);
+ if (context->skipValidation() || ValidateGenerateMipmap(context, targetPacked))
+ {
+ context->generateMipmap(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveAttrib(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei *length = "
+ "0x%016" PRIxPTR ", GLint *size = 0x%016" PRIxPTR ", GLenum *type = 0x%016" PRIxPTR
+ ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, bufSize, (uintptr_t)length, (uintptr_t)size, (uintptr_t)type,
+ (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetActiveAttrib, context, program, index, bufSize, length, size, type, name);
+ if (context->skipValidation() ||
+ ValidateGetActiveAttrib(context, program, index, bufSize, length, size, type, name))
+ {
+ context->getActiveAttrib(program, index, bufSize, length, size, type, name);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniform(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei *length = "
+ "0x%016" PRIxPTR ", GLint *size = 0x%016" PRIxPTR ", GLenum *type = 0x%016" PRIxPTR
+ ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, bufSize, (uintptr_t)length, (uintptr_t)size, (uintptr_t)type,
+ (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetActiveUniform, context, program, index, bufSize, length, size, type, name);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniform(context, program, index, bufSize, length, size, type, name))
+ {
+ context->getActiveUniform(program, index, bufSize, length, size, type, name);
+ }
+ }
+}
+
+void GL_APIENTRY GetAttachedShaders(GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders)
+{
+ EVENT("(GLuint program = %u, GLsizei maxCount = %d, GLsizei *count = 0x%016" PRIxPTR
+ ", GLuint *shaders = 0x%016" PRIxPTR ")",
+ program, maxCount, (uintptr_t)count, (uintptr_t)shaders);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetAttachedShaders, context, program, maxCount, count, shaders);
+ if (context->skipValidation() ||
+ ValidateGetAttachedShaders(context, program, maxCount, count, shaders))
+ {
+ context->getAttachedShaders(program, maxCount, count, shaders);
+ }
+ }
+}
+
+GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetAttribLocation, context, program, name);
+ if (context->skipValidation() || ValidateGetAttribLocation(context, program, name))
+ {
+ return context->getAttribLocation(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetAttribLocation, GLint>();
+}
+
+void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLboolean *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetBooleanv, context, pname, data);
+ if (context->skipValidation() || ValidateGetBooleanv(context, pname, data))
+ {
+ context->getBooleanv(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameteriv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferParameteriv(context, targetPacked, pname, params))
+ {
+ context->getBufferParameteriv(targetPacked, pname, params);
+ }
+ }
+}
+
+GLenum GL_APIENTRY GetError()
+{
+ EVENT("()");
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetError, context);
+ if (context->skipValidation() || ValidateGetError(context))
+ {
+ return context->getError();
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetError, GLenum>();
+}
+
+void GL_APIENTRY GetFloatv(GLenum pname, GLfloat *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFloatv, context, pname, data);
+ if (context->skipValidation() || ValidateGetFloatv(context, pname, data))
+ {
+ context->getFloatv(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ target, attachment, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFramebufferAttachmentParameteriv, context, target, attachment, pname,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetFramebufferAttachmentParameteriv(context, target, attachment, pname, params))
+ {
+ context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetIntegerv(GLenum pname, GLint *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLint *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetIntegerv, context, pname, data);
+ if (context->skipValidation() || ValidateGetIntegerv(context, pname, data))
+ {
+ context->getIntegerv(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramInfoLog(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *infoLog = 0x%016" PRIxPTR ")",
+ program, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramInfoLog, context, program, bufSize, length, infoLog);
+ if (context->skipValidation() ||
+ ValidateGetProgramInfoLog(context, program, bufSize, length, infoLog))
+ {
+ context->getProgramInfoLog(program, bufSize, length, infoLog);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", program,
+ pname, (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramiv, context, program, pname, params);
+ if (context->skipValidation() || ValidateGetProgramiv(context, program, pname, params))
+ {
+ context->getProgramiv(program, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetRenderbufferParameteriv, context, target, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetRenderbufferParameteriv(context, target, pname, params))
+ {
+ context->getRenderbufferParameteriv(target, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
+{
+ EVENT("(GLuint shader = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *infoLog = 0x%016" PRIxPTR ")",
+ shader, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetShaderInfoLog, context, shader, bufSize, length, infoLog);
+ if (context->skipValidation() ||
+ ValidateGetShaderInfoLog(context, shader, bufSize, length, infoLog))
+ {
+ context->getShaderInfoLog(shader, bufSize, length, infoLog);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision)
+{
+ EVENT("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint *range = 0x%016" PRIxPTR
+ ", GLint *precision = 0x%016" PRIxPTR ")",
+ shadertype, precisiontype, (uintptr_t)range, (uintptr_t)precision);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetShaderPrecisionFormat, context, shadertype, precisiontype, range,
+ precision);
+ if (context->skipValidation() ||
+ ValidateGetShaderPrecisionFormat(context, shadertype, precisiontype, range, precision))
+ {
+ context->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
+{
+ EVENT("(GLuint shader = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *source = 0x%016" PRIxPTR ")",
+ shader, bufSize, (uintptr_t)length, (uintptr_t)source);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetShaderSource, context, shader, bufSize, length, source);
+ if (context->skipValidation() ||
+ ValidateGetShaderSource(context, shader, bufSize, length, source))
+ {
+ context->getShaderSource(shader, bufSize, length, source);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint shader = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", shader,
+ pname, (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetShaderiv, context, shader, pname, params);
+ if (context->skipValidation() || ValidateGetShaderiv(context, shader, pname, params))
+ {
+ context->getShaderiv(shader, pname, params);
+ }
+ }
+}
+
+const GLubyte *GL_APIENTRY GetString(GLenum name)
+{
+ EVENT("(GLenum name = 0x%X)", name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetString, context, name);
+ if (context->skipValidation() || ValidateGetString(context, name))
+ {
+ return context->getString(name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetString, const GLubyte *>();
+}
+
+void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterfv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterfv(context, targetPacked, pname, params))
+ {
+ context->getTexParameterfv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameteriv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameteriv(context, targetPacked, pname, params))
+ {
+ context->getTexParameteriv(targetPacked, pname, params);
+ }
+ }
+}
+
+GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformLocation, context, program, name);
+ if (context->skipValidation() || ValidateGetUniformLocation(context, program, name))
+ {
+ return context->getUniformLocation(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetUniformLocation, GLint>();
+}
+
+void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat *params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLfloat *params = 0x%016" PRIxPTR ")",
+ program, location, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformfv, context, program, location, params);
+ if (context->skipValidation() || ValidateGetUniformfv(context, program, location, params))
+ {
+ context->getUniformfv(program, location, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint *params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint *params = 0x%016" PRIxPTR ")", program,
+ location, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformiv, context, program, location, params);
+ if (context->skipValidation() || ValidateGetUniformiv(context, program, location, params))
+ {
+ context->getUniformiv(program, location, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, void **pointer = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribPointerv, context, index, pname, pointer);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribPointerv(context, index, pname, pointer))
+ {
+ context->getVertexAttribPointerv(index, pname, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribfv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribfv(context, index, pname, params))
+ {
+ context->getVertexAttribfv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribiv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribiv(context, index, pname, params))
+ {
+ context->getVertexAttribiv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY Hint(GLenum target, GLenum mode)
+{
+ EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Hint, context, target, mode);
+ if (context->skipValidation() || ValidateHint(context, target, mode))
+ {
+ context->hint(target, mode);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsBuffer(GLuint buffer)
+{
+ EVENT("(GLuint buffer = %u)", buffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsBuffer, context, buffer);
+ if (context->skipValidation() || ValidateIsBuffer(context, buffer))
+ {
+ return context->isBuffer(buffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsBuffer, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsEnabled(GLenum cap)
+{
+ EVENT("(GLenum cap = 0x%X)", cap);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsEnabled, context, cap);
+ if (context->skipValidation() || ValidateIsEnabled(context, cap))
+ {
+ return context->isEnabled(cap);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsEnabled, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer)
+{
+ EVENT("(GLuint framebuffer = %u)", framebuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsFramebuffer, context, framebuffer);
+ if (context->skipValidation() || ValidateIsFramebuffer(context, framebuffer))
+ {
+ return context->isFramebuffer(framebuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsFramebuffer, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsProgram(GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsProgram, context, program);
+ if (context->skipValidation() || ValidateIsProgram(context, program))
+ {
+ return context->isProgram(program);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsProgram, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer)
+{
+ EVENT("(GLuint renderbuffer = %u)", renderbuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsRenderbuffer, context, renderbuffer);
+ if (context->skipValidation() || ValidateIsRenderbuffer(context, renderbuffer))
+ {
+ return context->isRenderbuffer(renderbuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsRenderbuffer, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsShader(GLuint shader)
+{
+ EVENT("(GLuint shader = %u)", shader);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsShader, context, shader);
+ if (context->skipValidation() || ValidateIsShader(context, shader))
+ {
+ return context->isShader(shader);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsShader, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsTexture(GLuint texture)
+{
+ EVENT("(GLuint texture = %u)", texture);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsTexture, context, texture);
+ if (context->skipValidation() || ValidateIsTexture(context, texture))
+ {
+ return context->isTexture(texture);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsTexture, GLboolean>();
+}
+
+void GL_APIENTRY LineWidth(GLfloat width)
+{
+ EVENT("(GLfloat width = %f)", width);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LineWidth, context, width);
+ if (context->skipValidation() || ValidateLineWidth(context, width))
+ {
+ context->lineWidth(width);
+ }
+ }
+}
+
+void GL_APIENTRY LinkProgram(GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LinkProgram, context, program);
+ if (context->skipValidation() || ValidateLinkProgram(context, program))
+ {
+ context->linkProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
+{
+ EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PixelStorei, context, pname, param);
+ if (context->skipValidation() || ValidatePixelStorei(context, pname, param))
+ {
+ context->pixelStorei(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units)
+{
+ EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PolygonOffset, context, factor, units);
+ if (context->skipValidation() || ValidatePolygonOffset(context, factor, units))
+ {
+ context->polygonOffset(factor, units);
+ }
+ }
+}
+
+void GL_APIENTRY ReadPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, void *pixels = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ReadPixels, context, x, y, width, height, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateReadPixels(context, x, y, width, height, format, type, pixels))
+ {
+ context->readPixels(x, y, width, height, format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY ReleaseShaderCompiler()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ReleaseShaderCompiler, context);
+ if (context->skipValidation() || ValidateReleaseShaderCompiler(context))
+ {
+ context->releaseShaderCompiler();
+ }
+ }
+}
+
+void GL_APIENTRY RenderbufferStorage(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = "
+ "%d)",
+ target, internalformat, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(RenderbufferStorage, context, target, internalformat, width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorage(context, target, internalformat, width, height))
+ {
+ context->renderbufferStorage(target, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert)
+{
+ EVENT("(GLfloat value = %f, GLboolean invert = %u)", value, invert);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SampleCoverage, context, value, invert);
+ if (context->skipValidation() || ValidateSampleCoverage(context, value, invert))
+ {
+ context->sampleCoverage(value, invert);
+ }
+ }
+}
+
+void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width,
+ height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Scissor, context, x, y, width, height);
+ if (context->skipValidation() || ValidateScissor(context, x, y, width, height))
+ {
+ context->scissor(x, y, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY ShaderBinary(GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length)
+{
+ EVENT("(GLsizei count = %d, const GLuint *shaders = 0x%016" PRIxPTR
+ ", GLenum binaryformat = 0x%X, const void *binary = 0x%016" PRIxPTR
+ ", GLsizei length = %d)",
+ count, (uintptr_t)shaders, binaryformat, (uintptr_t)binary, length);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ShaderBinary, context, count, shaders, binaryformat, binary, length);
+ if (context->skipValidation() ||
+ ValidateShaderBinary(context, count, shaders, binaryformat, binary, length))
+ {
+ context->shaderBinary(count, shaders, binaryformat, binary, length);
+ }
+ }
+}
+
+void GL_APIENTRY ShaderSource(GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length)
+{
+ EVENT("(GLuint shader = %u, GLsizei count = %d, const GLchar *const*string = 0x%016" PRIxPTR
+ ", const GLint *length = 0x%016" PRIxPTR ")",
+ shader, count, (uintptr_t)string, (uintptr_t)length);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ShaderSource, context, shader, count, string, length);
+ if (context->skipValidation() ||
+ ValidateShaderSource(context, shader, count, string, length))
+ {
+ context->shaderSource(shader, count, string, length);
+ }
+ }
+}
+
+void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ EVENT("(GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", func, ref, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilFunc, context, func, ref, mask);
+ if (context->skipValidation() || ValidateStencilFunc(context, func, ref, mask))
+ {
+ context->stencilFunc(func, ref, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ EVENT("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", face, func,
+ ref, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilFuncSeparate, context, face, func, ref, mask);
+ if (context->skipValidation() ||
+ ValidateStencilFuncSeparate(context, face, func, ref, mask))
+ {
+ context->stencilFuncSeparate(face, func, ref, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilMask(GLuint mask)
+{
+ EVENT("(GLuint mask = %u)", mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilMask, context, mask);
+ if (context->skipValidation() || ValidateStencilMask(context, mask))
+ {
+ context->stencilMask(mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask)
+{
+ EVENT("(GLenum face = 0x%X, GLuint mask = %u)", face, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilMaskSeparate, context, face, mask);
+ if (context->skipValidation() || ValidateStencilMaskSeparate(context, face, mask))
+ {
+ context->stencilMaskSeparate(face, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ EVENT("(GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpass = 0x%X)", fail, zfail, zpass);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilOp, context, fail, zfail, zpass);
+ if (context->skipValidation() || ValidateStencilOp(context, fail, zfail, zpass))
+ {
+ context->stencilOp(fail, zfail, zpass);
+ }
+ }
+}
+
+void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
+{
+ EVENT("(GLenum face = 0x%X, GLenum sfail = 0x%X, GLenum dpfail = 0x%X, GLenum dppass = 0x%X)",
+ face, sfail, dpfail, dppass);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilOpSeparate, context, face, sfail, dpfail, dppass);
+ if (context->skipValidation() ||
+ ValidateStencilOpSeparate(context, face, sfail, dpfail, dppass))
+ {
+ context->stencilOpSeparate(face, sfail, dpfail, dppass);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage2D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const "
+ "void *pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, format, type, (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage2D, context, targetPacked, level, internalformat, width, height,
+ border, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage2D(context, targetPacked, level, internalformat, width, height, border,
+ format, type, pixels))
+ {
+ context->texImage2D(targetPacked, level, internalformat, width, height, border, format,
+ type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterf, context, targetPacked, pname, param);
+ if (context->skipValidation() || ValidateTexParameterf(context, targetPacked, pname, param))
+ {
+ context->texParameterf(targetPacked, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterfv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterfv(context, targetPacked, pname, params))
+ {
+ context->texParameterfv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameteri, context, targetPacked, pname, param);
+ if (context->skipValidation() || ValidateTexParameteri(context, targetPacked, pname, param))
+ {
+ context->texParameteri(targetPacked, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameteriv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameteriv(context, targetPacked, pname, params))
+ {
+ context->texParameteriv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei "
+ "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, const void "
+ "*pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, type, (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage2D, context, targetPacked, level, xoffset, yoffset, width, height,
+ format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage2D(context, targetPacked, level, xoffset, yoffset, width, height,
+ format, type, pixels))
+ {
+ context->texSubImage2D(targetPacked, level, xoffset, yoffset, width, height, format,
+ type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1f(GLint location, GLfloat v0)
+{
+ EVENT("(GLint location = %d, GLfloat v0 = %f)", location, v0);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform1f, context, location, v0);
+ if (context->skipValidation() || ValidateUniform1f(context, location, v0))
+ {
+ context->uniform1f(location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform1fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform1fv(context, location, count, value))
+ {
+ context->uniform1fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1i(GLint location, GLint v0)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d)", location, v0);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform1i, context, location, v0);
+ if (context->skipValidation() || ValidateUniform1i(context, location, v0))
+ {
+ context->uniform1i(location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform1iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform1iv(context, location, count, value))
+ {
+ context->uniform1iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2f(GLint location, GLfloat v0, GLfloat v1)
+{
+ EVENT("(GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f)", location, v0, v1);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform2f, context, location, v0, v1);
+ if (context->skipValidation() || ValidateUniform2f(context, location, v0, v1))
+ {
+ context->uniform2f(location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform2fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform2fv(context, location, count, value))
+ {
+ context->uniform2fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2i(GLint location, GLint v0, GLint v1)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d, GLint v1 = %d)", location, v0, v1);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform2i, context, location, v0, v1);
+ if (context->skipValidation() || ValidateUniform2i(context, location, v0, v1))
+ {
+ context->uniform2i(location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform2iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform2iv(context, location, count, value))
+ {
+ context->uniform2iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ EVENT("(GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = %f)", location, v0,
+ v1, v2);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform3f, context, location, v0, v1, v2);
+ if (context->skipValidation() || ValidateUniform3f(context, location, v0, v1, v2))
+ {
+ context->uniform3f(location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform3fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform3fv(context, location, count, value))
+ {
+ context->uniform3fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3i(GLint location, GLint v0, GLint v1, GLint v2)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d)", location, v0, v1,
+ v2);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform3i, context, location, v0, v1, v2);
+ if (context->skipValidation() || ValidateUniform3i(context, location, v0, v1, v2))
+ {
+ context->uniform3i(location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform3iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform3iv(context, location, count, value))
+ {
+ context->uniform3iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
+{
+ EVENT(
+ "(GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = %f, GLfloat v3 = %f)",
+ location, v0, v1, v2, v3);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform4f, context, location, v0, v1, v2, v3);
+ if (context->skipValidation() || ValidateUniform4f(context, location, v0, v1, v2, v3))
+ {
+ context->uniform4f(location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform4fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform4fv(context, location, count, value))
+ {
+ context->uniform4fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d, GLint v3 = %d)",
+ location, v0, v1, v2, v3);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform4i, context, location, v0, v1, v2, v3);
+ if (context->skipValidation() || ValidateUniform4i(context, location, v0, v1, v2, v3))
+ {
+ context->uniform4i(location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform4iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform4iv(context, location, count, value))
+ {
+ context->uniform4iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix2fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix2fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix2fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix3fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix3fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix3fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix4fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix4fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix4fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UseProgram(GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UseProgram, context, program);
+ if (context->skipValidation() || ValidateUseProgram(context, program))
+ {
+ context->useProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY ValidateProgram(GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ValidateProgram, context, program);
+ if (context->skipValidation() || ValidateValidateProgram(context, program))
+ {
+ context->validateProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib1f(GLuint index, GLfloat x)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f)", index, x);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib1f, context, index, x);
+ if (context->skipValidation() || ValidateVertexAttrib1f(context, index, x))
+ {
+ context->vertexAttrib1f(index, x);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib1fv(GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib1fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib1fv(context, index, v))
+ {
+ context->vertexAttrib1fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f, GLfloat y = %f)", index, x, y);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib2f, context, index, x, y);
+ if (context->skipValidation() || ValidateVertexAttrib2f(context, index, x, y))
+ {
+ context->vertexAttrib2f(index, x, y);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib2fv(GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib2fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib2fv(context, index, v))
+ {
+ context->vertexAttrib2fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib3f, context, index, x, y, z);
+ if (context->skipValidation() || ValidateVertexAttrib3f(context, index, x, y, z))
+ {
+ context->vertexAttrib3f(index, x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib3fv(GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib3fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib3fv(context, index, v))
+ {
+ context->vertexAttrib3fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)",
+ index, x, y, z, w);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib4f, context, index, x, y, z, w);
+ if (context->skipValidation() || ValidateVertexAttrib4f(context, index, x, y, z, w))
+ {
+ context->vertexAttrib4f(index, x, y, z, w);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib4fv(GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttrib4fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib4fv(context, index, v))
+ {
+ context->vertexAttrib4fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribPointer(GLuint index,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLboolean normalized = %u, "
+ "GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR ")",
+ index, size, type, normalized, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribPointer, context, index, size, typePacked, normalized, stride,
+ pointer);
+ if (context->skipValidation() ||
+ ValidateVertexAttribPointer(context, index, size, typePacked, normalized, stride,
+ pointer))
+ {
+ context->vertexAttribPointer(index, size, typePacked, normalized, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width,
+ height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Viewport, context, x, y, width, height);
+ if (context->skipValidation() || ValidateViewport(context, x, y, width, height))
+ {
+ context->viewport(x, y, width, height);
+ }
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h
new file mode 100644
index 0000000000..4b2a0f53cb
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h
@@ -0,0 +1,297 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_2_0_autogen.h:
+// Defines the GLES 2.0 entry points.
+
+#ifndef LIBGLESV2_ENTRY_POINTS_GLES_2_0_AUTOGEN_H_
+#define LIBGLESV2_ENTRY_POINTS_GLES_2_0_AUTOGEN_H_
+
+#include <GLES2/gl2.h>
+#include <export.h>
+
+namespace gl
+{
+ANGLE_EXPORT void GL_APIENTRY ActiveTexture(GLenum texture);
+ANGLE_EXPORT void GL_APIENTRY AttachShader(GLuint program, GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer);
+ANGLE_EXPORT void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer);
+ANGLE_EXPORT void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY BindTexture(GLenum target, GLuint texture);
+ANGLE_EXPORT void GL_APIENTRY BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY BlendEquation(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+ANGLE_EXPORT void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor);
+ANGLE_EXPORT void GL_APIENTRY BlendFuncSeparate(GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha);
+ANGLE_EXPORT void GL_APIENTRY BufferData(GLenum target,
+ GLsizeiptr size,
+ const void *data,
+ GLenum usage);
+ANGLE_EXPORT void GL_APIENTRY BufferSubData(GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data);
+ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY Clear(GLbitfield mask);
+ANGLE_EXPORT void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY ClearDepthf(GLfloat d);
+ANGLE_EXPORT void GL_APIENTRY ClearStencil(GLint s);
+ANGLE_EXPORT void GL_APIENTRY ColorMask(GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha);
+ANGLE_EXPORT void GL_APIENTRY CompileShader(GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CopyTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT GLuint GL_APIENTRY CreateProgram();
+ANGLE_EXPORT GLuint GL_APIENTRY CreateShader(GLenum type);
+ANGLE_EXPORT void GL_APIENTRY CullFace(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteShader(GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint *textures);
+ANGLE_EXPORT void GL_APIENTRY DepthFunc(GLenum func);
+ANGLE_EXPORT void GL_APIENTRY DepthMask(GLboolean flag);
+ANGLE_EXPORT void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f);
+ANGLE_EXPORT void GL_APIENTRY DetachShader(GLuint program, GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY Disable(GLenum cap);
+ANGLE_EXPORT void GL_APIENTRY DisableVertexAttribArray(GLuint index);
+ANGLE_EXPORT void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count);
+ANGLE_EXPORT void GL_APIENTRY DrawElements(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices);
+ANGLE_EXPORT void GL_APIENTRY Enable(GLenum cap);
+ANGLE_EXPORT void GL_APIENTRY EnableVertexAttribArray(GLuint index);
+ANGLE_EXPORT void GL_APIENTRY Finish();
+ANGLE_EXPORT void GL_APIENTRY Flush();
+ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+ANGLE_EXPORT void GL_APIENTRY FrontFace(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers);
+ANGLE_EXPORT void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures);
+ANGLE_EXPORT void GL_APIENTRY GenerateMipmap(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GetActiveAttrib(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniform(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetAttachedShaders(GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders);
+ANGLE_EXPORT GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean *data);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT GLenum GL_APIENTRY GetError();
+ANGLE_EXPORT void GL_APIENTRY GetFloatv(GLenum pname, GLfloat *data);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetIntegerv(GLenum pname, GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetProgramInfoLog(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+ANGLE_EXPORT void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameteriv(GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetShaderInfoLog(GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+ANGLE_EXPORT void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision);
+ANGLE_EXPORT void GL_APIENTRY GetShaderSource(GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source);
+ANGLE_EXPORT void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint *params);
+ANGLE_EXPORT const GLubyte *GL_APIENTRY GetString(GLenum name);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY Hint(GLenum target, GLenum mode);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsBuffer(GLuint buffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabled(GLenum cap);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsProgram(GLuint program);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsShader(GLuint shader);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsTexture(GLuint texture);
+ANGLE_EXPORT void GL_APIENTRY LineWidth(GLfloat width);
+ANGLE_EXPORT void GL_APIENTRY LinkProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY PixelStorei(GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units);
+ANGLE_EXPORT void GL_APIENTRY ReadPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels);
+ANGLE_EXPORT void GL_APIENTRY ReleaseShaderCompiler();
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorage(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert);
+ANGLE_EXPORT void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY ShaderBinary(GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length);
+ANGLE_EXPORT void GL_APIENTRY ShaderSource(GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length);
+ANGLE_EXPORT void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilMask(GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass);
+ANGLE_EXPORT void GL_APIENTRY StencilOpSeparate(GLenum face,
+ GLenum sfail,
+ GLenum dpfail,
+ GLenum dppass);
+ANGLE_EXPORT void GL_APIENTRY TexImage2D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY Uniform1f(GLint location, GLfloat v0);
+ANGLE_EXPORT void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform1i(GLint location, GLint v0);
+ANGLE_EXPORT void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform2f(GLint location, GLfloat v0, GLfloat v1);
+ANGLE_EXPORT void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform2i(GLint location, GLint v0, GLint v1);
+ANGLE_EXPORT void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+ANGLE_EXPORT void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform3i(GLint location, GLint v0, GLint v1, GLint v2);
+ANGLE_EXPORT void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY
+Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+ANGLE_EXPORT void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+ANGLE_EXPORT void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UseProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY ValidateProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib1f(GLuint index, GLfloat x);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib1fv(GLuint index, const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib2fv(GLuint index, const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib3fv(GLuint index, const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY
+VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib4fv(GLuint index, const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribPointer(GLuint index,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
+} // namespace gl
+
+#endif // LIBGLESV2_ENTRY_POINTS_GLES_2_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp
new file mode 100644
index 0000000000..b57a8ddd19
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp
@@ -0,0 +1,2005 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_3_0_autogen.cpp:
+// Defines the GLES 3.0 entry points.
+
+#include "libGLESv2/entry_points_gles_3_0_autogen.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Context.inl.h"
+#include "libANGLE/capture_gles_3_0_autogen.h"
+#include "libANGLE/entry_points_utils.h"
+#include "libANGLE/validationES3.h"
+#include "libGLESv2/global_state.h"
+
+namespace gl
+{
+void GL_APIENTRY BeginQuery(GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(BeginQuery, context, targetPacked, id);
+ if (context->skipValidation() || ValidateBeginQuery(context, targetPacked, id))
+ {
+ context->beginQuery(targetPacked, id);
+ }
+ }
+}
+
+void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode)
+{
+ EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode primitiveModePacked = FromGLenum<PrimitiveMode>(primitiveMode);
+ ANGLE_CAPTURE(BeginTransformFeedback, context, primitiveModePacked);
+ if (context->skipValidation() ||
+ ValidateBeginTransformFeedback(context, primitiveModePacked))
+ {
+ context->beginTransformFeedback(primitiveModePacked);
+ }
+ }
+}
+
+void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", target, index, buffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BindBufferBase, context, targetPacked, index, buffer);
+ if (context->skipValidation() ||
+ ValidateBindBufferBase(context, targetPacked, index, buffer))
+ {
+ context->bindBufferBase(targetPacked, index, buffer);
+ }
+ }
+}
+
+void GL_APIENTRY
+BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %llu, "
+ "GLsizeiptr size = %llu)",
+ target, index, buffer, static_cast<unsigned long long>(offset),
+ static_cast<unsigned long long>(size));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BindBufferRange, context, targetPacked, index, buffer, offset, size);
+ if (context->skipValidation() ||
+ ValidateBindBufferRange(context, targetPacked, index, buffer, offset, size))
+ {
+ context->bindBufferRange(targetPacked, index, buffer, offset, size);
+ }
+ }
+}
+
+void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler)
+{
+ EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindSampler, context, unit, sampler);
+ if (context->skipValidation() || ValidateBindSampler(context, unit, sampler))
+ {
+ context->bindSampler(unit, sampler);
+ }
+ }
+}
+
+void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindTransformFeedback, context, target, id);
+ if (context->skipValidation() || ValidateBindTransformFeedback(context, target, id))
+ {
+ context->bindTransformFeedback(target, id);
+ }
+ }
+}
+
+void GL_APIENTRY BindVertexArray(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindVertexArray, context, array);
+ if (context->skipValidation() || ValidateBindVertexArray(context, array))
+ {
+ context->bindVertexArray(array);
+ }
+ }
+}
+
+void GL_APIENTRY BlitFramebuffer(GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ EVENT(
+ "(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BlitFramebuffer, context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1,
+ dstY1, mask, filter);
+ if (context->skipValidation() ||
+ ValidateBlitFramebuffer(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter))
+ {
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
+ filter);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth = %f, GLint stencil = %d)",
+ buffer, drawbuffer, depth, stencil);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearBufferfi, context, buffer, drawbuffer, depth, stencil);
+ if (context->skipValidation() ||
+ ValidateClearBufferfi(context, buffer, drawbuffer, depth, stencil))
+ {
+ context->clearBufferfi(buffer, drawbuffer, depth, stencil);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ buffer, drawbuffer, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearBufferfv, context, buffer, drawbuffer, value);
+ if (context->skipValidation() || ValidateClearBufferfv(context, buffer, drawbuffer, value))
+ {
+ context->clearBufferfv(buffer, drawbuffer, value);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ buffer, drawbuffer, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearBufferiv, context, buffer, drawbuffer, value);
+ if (context->skipValidation() || ValidateClearBufferiv(context, buffer, drawbuffer, value))
+ {
+ context->clearBufferiv(buffer, drawbuffer, value);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ buffer, drawbuffer, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClearBufferuiv, context, buffer, drawbuffer, value);
+ if (context->skipValidation() || ValidateClearBufferuiv(context, buffer, drawbuffer, value))
+ {
+ context->clearBufferuiv(buffer, drawbuffer, value);
+ }
+ }
+}
+
+GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ", GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ClientWaitSync, context, sync, flags, timeout);
+ if (context->skipValidation() || ValidateClientWaitSync(context, sync, flags, timeout))
+ {
+ return context->clientWaitSync(sync, flags, timeout);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::ClientWaitSync, GLenum>();
+}
+
+void GL_APIENTRY CompressedTexImage3D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, imageSize, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage3D, context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexImage3D(context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data))
+ {
+ context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
+ border, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage3D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize,
+ (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage3D, context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, imageSize, data))
+ {
+ context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CopyBufferSubData(GLenum readTarget,
+ GLenum writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ EVENT(
+ "(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %llu, "
+ "GLintptr writeOffset = %llu, GLsizeiptr size = %llu)",
+ readTarget, writeTarget, static_cast<unsigned long long>(readOffset),
+ static_cast<unsigned long long>(writeOffset), static_cast<unsigned long long>(size));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding readTargetPacked = FromGLenum<BufferBinding>(readTarget);
+ BufferBinding writeTargetPacked = FromGLenum<BufferBinding>(writeTarget);
+ ANGLE_CAPTURE(CopyBufferSubData, context, readTargetPacked, writeTargetPacked, readOffset,
+ writeOffset, size);
+ if (context->skipValidation() ||
+ ValidateCopyBufferSubData(context, readTargetPacked, writeTargetPacked, readOffset,
+ writeOffset, size))
+ {
+ context->copyBufferSubData(readTargetPacked, writeTargetPacked, readOffset, writeOffset,
+ size);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexSubImage3D(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexSubImage3D, context, targetPacked, level, xoffset, yoffset, zoffset, x,
+ y, width, height);
+ if (context->skipValidation() ||
+ ValidateCopyTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, x, y,
+ width, height))
+ {
+ context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
+ height);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteQueries, context, n, ids);
+ if (context->skipValidation() || ValidateDeleteQueries(context, n, ids))
+ {
+ context->deleteQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers)
+{
+ EVENT("(GLsizei count = %d, const GLuint *samplers = 0x%016" PRIxPTR ")", count,
+ (uintptr_t)samplers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteSamplers, context, count, samplers);
+ if (context->skipValidation() || ValidateDeleteSamplers(context, count, samplers))
+ {
+ context->deleteSamplers(count, samplers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteSync(GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ")", (uintptr_t)sync);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteSync, context, sync);
+ if (context->skipValidation() || ValidateDeleteSync(context, sync))
+ {
+ context->deleteSync(sync);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteTransformFeedbacks, context, n, ids);
+ if (context->skipValidation() || ValidateDeleteTransformFeedbacks(context, n, ids))
+ {
+ context->deleteTransformFeedbacks(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, const GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteVertexArrays, context, n, arrays);
+ if (context->skipValidation() || ValidateDeleteVertexArrays(context, n, arrays))
+ {
+ context->deleteVertexArrays(n, arrays);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArraysInstanced(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysInstanced, context, modePacked, first, count, instancecount);
+ if (context->skipValidation() ||
+ ValidateDrawArraysInstanced(context, modePacked, first, count, instancecount))
+ {
+ context->drawArraysInstanced(modePacked, first, count, instancecount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum *bufs)
+{
+ EVENT("(GLsizei n = %d, const GLenum *bufs = 0x%016" PRIxPTR ")", n, (uintptr_t)bufs);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawBuffers, context, n, bufs);
+ if (context->skipValidation() || ValidateDrawBuffers(context, n, bufs))
+ {
+ context->drawBuffers(n, bufs);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsInstanced(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ", GLsizei instancecount = %d)",
+ mode, count, type, (uintptr_t)indices, instancecount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsInstanced, context, modePacked, count, typePacked, indices,
+ instancecount);
+ if (context->skipValidation() ||
+ ValidateDrawElementsInstanced(context, modePacked, count, typePacked, indices,
+ instancecount))
+ {
+ context->drawElementsInstanced(modePacked, count, typePacked, indices, instancecount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawRangeElements(GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type "
+ "= 0x%X, const void *indices = 0x%016" PRIxPTR ")",
+ mode, start, end, count, type, (uintptr_t)indices);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawRangeElements, context, modePacked, start, end, count, typePacked,
+ indices);
+ if (context->skipValidation() ||
+ ValidateDrawRangeElements(context, modePacked, start, end, count, typePacked, indices))
+ {
+ context->drawRangeElements(modePacked, start, end, count, typePacked, indices);
+ }
+ }
+}
+
+void GL_APIENTRY EndQuery(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(EndQuery, context, targetPacked);
+ if (context->skipValidation() || ValidateEndQuery(context, targetPacked))
+ {
+ context->endQuery(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY EndTransformFeedback()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(EndTransformFeedback, context);
+ if (context->skipValidation() || ValidateEndTransformFeedback(context))
+ {
+ context->endTransformFeedback();
+ }
+ }
+}
+
+GLsync GL_APIENTRY FenceSync(GLenum condition, GLbitfield flags)
+{
+ EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FenceSync, context, condition, flags);
+ if (context->skipValidation() || ValidateFenceSync(context, condition, flags))
+ {
+ return context->fenceSync(condition, flags);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::FenceSync, GLsync>();
+}
+
+void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu)", target,
+ static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(FlushMappedBufferRange, context, targetPacked, offset, length);
+ if (context->skipValidation() ||
+ ValidateFlushMappedBufferRange(context, targetPacked, offset, length))
+ {
+ context->flushMappedBufferRange(targetPacked, offset, length);
+ }
+ }
+}
+
+void GL_APIENTRY
+FramebufferTextureLayer(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FramebufferTextureLayer, context, target, attachment, texture, level, layer);
+ if (context->skipValidation() ||
+ ValidateFramebufferTextureLayer(context, target, attachment, texture, level, layer))
+ {
+ context->framebufferTextureLayer(target, attachment, texture, level, layer);
+ }
+ }
+}
+
+void GL_APIENTRY GenQueries(GLsizei n, GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenQueries, context, n, ids);
+ if (context->skipValidation() || ValidateGenQueries(context, n, ids))
+ {
+ context->genQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers)
+{
+ EVENT("(GLsizei count = %d, GLuint *samplers = 0x%016" PRIxPTR ")", count, (uintptr_t)samplers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenSamplers, context, count, samplers);
+ if (context->skipValidation() || ValidateGenSamplers(context, count, samplers))
+ {
+ context->genSamplers(count, samplers);
+ }
+ }
+}
+
+void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenTransformFeedbacks, context, n, ids);
+ if (context->skipValidation() || ValidateGenTransformFeedbacks(context, n, ids))
+ {
+ context->genTransformFeedbacks(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenVertexArrays, context, n, arrays);
+ if (context->skipValidation() || ValidateGenVertexArrays(context, n, arrays))
+ {
+ context->genVertexArrays(n, arrays);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformBlockName(GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei "
+ "*length = 0x%016" PRIxPTR ", GLchar *uniformBlockName = 0x%016" PRIxPTR ")",
+ program, uniformBlockIndex, bufSize, (uintptr_t)length, (uintptr_t)uniformBlockName);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetActiveUniformBlockName, context, program, uniformBlockIndex, bufSize,
+ length, uniformBlockName);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniformBlockName(context, program, uniformBlockIndex, bufSize, length,
+ uniformBlockName))
+ {
+ context->getActiveUniformBlockName(program, uniformBlockIndex, bufSize, length,
+ uniformBlockName);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformBlockiv(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ program, uniformBlockIndex, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetActiveUniformBlockiv, context, program, uniformBlockIndex, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniformBlockiv(context, program, uniformBlockIndex, pname, params))
+ {
+ context->getActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformsiv(GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLsizei uniformCount = %d, const GLuint *uniformIndices = "
+ "0x%016" PRIxPTR ", GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")",
+ program, uniformCount, (uintptr_t)uniformIndices, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetActiveUniformsiv, context, program, uniformCount, uniformIndices, pname,
+ params);
+ if (context->skipValidation() || ValidateGetActiveUniformsiv(context, program, uniformCount,
+ uniformIndices, pname, params))
+ {
+ context->getActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64 *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameteri64v, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferParameteri64v(context, targetPacked, pname, params))
+ {
+ context->getBufferParameteri64v(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferPointerv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferPointerv(context, targetPacked, pname, params))
+ {
+ context->getBufferPointerv(targetPacked, pname, params);
+ }
+ }
+}
+
+GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFragDataLocation, context, program, name);
+ if (context->skipValidation() || ValidateGetFragDataLocation(context, program, name))
+ {
+ return context->getFragDataLocation(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetFragDataLocation, GLint>();
+}
+
+void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64 *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetInteger64i_v, context, target, index, data);
+ if (context->skipValidation() || ValidateGetInteger64i_v(context, target, index, data))
+ {
+ context->getInteger64i_v(target, index, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInteger64v(GLenum pname, GLint64 *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLint64 *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetInteger64v, context, pname, data);
+ if (context->skipValidation() || ValidateGetInteger64v(context, pname, data))
+ {
+ context->getInteger64v(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetIntegeri_v, context, target, index, data);
+ if (context->skipValidation() || ValidateGetIntegeri_v(context, target, index, data))
+ {
+ context->getIntegeri_v(target, index, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInternalformativ(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%016" PRIxPTR ")",
+ target, internalformat, pname, bufSize, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetInternalformativ, context, target, internalformat, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateGetInternalformativ(context, target, internalformat, pname, bufSize, params))
+ {
+ context->getInternalformativ(target, internalformat, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramBinary(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLenum *binaryFormat = 0x%016" PRIxPTR ", void *binary = 0x%016" PRIxPTR ")",
+ program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat, (uintptr_t)binary);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramBinary, context, program, bufSize, length, binaryFormat, binary);
+ if (context->skipValidation() ||
+ ValidateGetProgramBinary(context, program, bufSize, length, binaryFormat, binary))
+ {
+ context->getProgramBinary(program, bufSize, length, binaryFormat, binary);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjectuiv, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectuiv(context, id, pname, params))
+ {
+ context->getQueryObjectuiv(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(GetQueryiv, context, targetPacked, pname, params);
+ if (context->skipValidation() || ValidateGetQueryiv(context, targetPacked, pname, params))
+ {
+ context->getQueryiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameterfv, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameterfv(context, sampler, pname, params))
+ {
+ context->getSamplerParameterfv(sampler, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", sampler,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameteriv, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameteriv(context, sampler, pname, params))
+ {
+ context->getSamplerParameteriv(sampler, pname, params);
+ }
+ }
+}
+
+const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index)
+{
+ EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetStringi, context, name, index);
+ if (context->skipValidation() || ValidateGetStringi(context, name, index))
+ {
+ return context->getStringi(name, index);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetStringi, const GLubyte *>();
+}
+
+void GL_APIENTRY
+GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR
+ ", GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLint *values = 0x%016" PRIxPTR ")",
+ (uintptr_t)sync, pname, bufSize, (uintptr_t)length, (uintptr_t)values);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSynciv, context, sync, pname, bufSize, length, values);
+ if (context->skipValidation() ||
+ ValidateGetSynciv(context, sync, pname, bufSize, length, values))
+ {
+ context->getSynciv(sync, pname, bufSize, length, values);
+ }
+ }
+}
+
+void GL_APIENTRY GetTransformFeedbackVarying(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%016" PRIxPTR ", GLsizei *size = 0x%016" PRIxPTR ", GLenum *type = 0x%016" PRIxPTR
+ ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, bufSize, (uintptr_t)length, (uintptr_t)size, (uintptr_t)type,
+ (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetTransformFeedbackVarying, context, program, index, bufSize, length, size,
+ type, name);
+ if (context->skipValidation() ||
+ ValidateGetTransformFeedbackVarying(context, program, index, bufSize, length, size,
+ type, name))
+ {
+ context->getTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
+ }
+ }
+}
+
+GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
+{
+ EVENT("(GLuint program = %u, const GLchar *uniformBlockName = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)uniformBlockName);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformBlockIndex, context, program, uniformBlockName);
+ if (context->skipValidation() ||
+ ValidateGetUniformBlockIndex(context, program, uniformBlockName))
+ {
+ return context->getUniformBlockIndex(program, uniformBlockName);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetUniformBlockIndex, GLuint>();
+}
+
+void GL_APIENTRY GetUniformIndices(GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices)
+{
+ EVENT(
+ "(GLuint program = %u, GLsizei uniformCount = %d, const GLchar *const*uniformNames = "
+ "0x%016" PRIxPTR ", GLuint *uniformIndices = 0x%016" PRIxPTR ")",
+ program, uniformCount, (uintptr_t)uniformNames, (uintptr_t)uniformIndices);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformIndices, context, program, uniformCount, uniformNames,
+ uniformIndices);
+ if (context->skipValidation() ||
+ ValidateGetUniformIndices(context, program, uniformCount, uniformNames, uniformIndices))
+ {
+ context->getUniformIndices(program, uniformCount, uniformNames, uniformIndices);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint *params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint *params = 0x%016" PRIxPTR ")", program,
+ location, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformuiv, context, program, location, params);
+ if (context->skipValidation() || ValidateGetUniformuiv(context, program, location, params))
+ {
+ context->getUniformuiv(program, location, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribIiv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribIiv(context, index, pname, params))
+ {
+ context->getVertexAttribIiv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribIuiv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribIuiv(context, index, pname, params))
+ {
+ context->getVertexAttribIuiv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY InvalidateFramebuffer(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = "
+ "0x%016" PRIxPTR ")",
+ target, numAttachments, (uintptr_t)attachments);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(InvalidateFramebuffer, context, target, numAttachments, attachments);
+ if (context->skipValidation() ||
+ ValidateInvalidateFramebuffer(context, target, numAttachments, attachments))
+ {
+ context->invalidateFramebuffer(target, numAttachments, attachments);
+ }
+ }
+}
+
+void GL_APIENTRY InvalidateSubFramebuffer(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%016" PRIxPTR ", GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, numAttachments, (uintptr_t)attachments, x, y, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(InvalidateSubFramebuffer, context, target, numAttachments, attachments, x, y,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateInvalidateSubFramebuffer(context, target, numAttachments, attachments, x, y,
+ width, height))
+ {
+ context->invalidateSubFramebuffer(target, numAttachments, attachments, x, y, width,
+ height);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsQuery(GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsQuery, context, id);
+ if (context->skipValidation() || ValidateIsQuery(context, id))
+ {
+ return context->isQuery(id);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsQuery, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsSampler(GLuint sampler)
+{
+ EVENT("(GLuint sampler = %u)", sampler);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsSampler, context, sampler);
+ if (context->skipValidation() || ValidateIsSampler(context, sampler))
+ {
+ return context->isSampler(sampler);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsSampler, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsSync(GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ")", (uintptr_t)sync);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsSync, context, sync);
+ if (context->skipValidation() || ValidateIsSync(context, sync))
+ {
+ return context->isSync(sync);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsSync, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsTransformFeedback(GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsTransformFeedback, context, id);
+ if (context->skipValidation() || ValidateIsTransformFeedback(context, id))
+ {
+ return context->isTransformFeedback(id);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsTransformFeedback, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsVertexArray(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsVertexArray, context, array);
+ if (context->skipValidation() || ValidateIsVertexArray(context, array))
+ {
+ return context->isVertexArray(array);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsVertexArray, GLboolean>();
+}
+
+void *GL_APIENTRY MapBufferRange(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu, GLbitfield "
+ "access = 0x%X)",
+ target, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
+ access);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(MapBufferRange, context, targetPacked, offset, length, access);
+ if (context->skipValidation() ||
+ ValidateMapBufferRange(context, targetPacked, offset, length, access))
+ {
+ return context->mapBufferRange(targetPacked, offset, length, access);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::MapBufferRange, void *>();
+}
+
+void GL_APIENTRY PauseTransformFeedback()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PauseTransformFeedback, context);
+ if (context->skipValidation() || ValidatePauseTransformFeedback(context))
+ {
+ context->pauseTransformFeedback();
+ }
+ }
+}
+
+void GL_APIENTRY ProgramBinary(GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length)
+{
+ EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const void *binary = 0x%016" PRIxPTR
+ ", GLsizei length = %d)",
+ program, binaryFormat, (uintptr_t)binary, length);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramBinary, context, program, binaryFormat, binary, length);
+ if (context->skipValidation() ||
+ ValidateProgramBinary(context, program, binaryFormat, binary, length))
+ {
+ context->programBinary(program, binaryFormat, binary, length);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+ EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", program, pname, value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramParameteri, context, program, pname, value);
+ if (context->skipValidation() || ValidateProgramParameteri(context, program, pname, value))
+ {
+ context->programParameteri(program, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY ReadBuffer(GLenum src)
+{
+ EVENT("(GLenum src = 0x%X)", src);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ReadBuffer, context, src);
+ if (context->skipValidation() || ValidateReadBuffer(context, src))
+ {
+ context->readBuffer(src);
+ }
+ }
+}
+
+void GL_APIENTRY RenderbufferStorageMultisample(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(RenderbufferStorageMultisample, context, target, samples, internalformat,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorageMultisample(context, target, samples, internalformat, width,
+ height))
+ {
+ context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY ResumeTransformFeedback()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ResumeTransformFeedback, context);
+ if (context->skipValidation() || ValidateResumeTransformFeedback(context))
+ {
+ context->resumeTransformFeedback();
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %f)", sampler, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterf, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameterf(context, sampler, pname, param))
+ {
+ context->samplerParameterf(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLfloat *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterfv, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameterfv(context, sampler, pname, param))
+ {
+ context->samplerParameterfv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameteri, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameteri(context, sampler, pname, param))
+ {
+ context->samplerParameteri(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLint *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameteriv, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameteriv(context, sampler, pname, param))
+ {
+ context->samplerParameteriv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage3D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *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 void *pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage3D, context, targetPacked, level, internalformat, width, height,
+ depth, border, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage3D(context, targetPacked, level, internalformat, width, height, depth,
+ border, format, type, pixels))
+ {
+ context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
+ format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY
+TexStorage2D(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2D, context, targetPacked, levels, internalformat, width, height);
+ if (context->skipValidation() ||
+ ValidateTexStorage2D(context, targetPacked, levels, internalformat, width, height))
+ {
+ context->texStorage2D(targetPacked, levels, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage3D(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage3D, context, targetPacked, levels, internalformat, width, height,
+ depth);
+ if (context->skipValidation() || ValidateTexStorage3D(context, targetPacked, levels,
+ internalformat, width, height, depth))
+ {
+ context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage3D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *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 void *pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage3D, context, targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels))
+ {
+ context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TransformFeedbackVaryings(GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar *const*varyings = 0x%016" PRIxPTR
+ ", GLenum bufferMode = 0x%X)",
+ program, count, (uintptr_t)varyings, bufferMode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TransformFeedbackVaryings, context, program, count, varyings, bufferMode);
+ if (context->skipValidation() ||
+ ValidateTransformFeedbackVaryings(context, program, count, varyings, bufferMode))
+ {
+ context->transformFeedbackVaryings(program, count, varyings, bufferMode);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1ui(GLint location, GLuint v0)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u)", location, v0);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform1ui, context, location, v0);
+ if (context->skipValidation() || ValidateUniform1ui(context, location, v0))
+ {
+ context->uniform1ui(location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform1uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform1uiv(context, location, count, value))
+ {
+ context->uniform1uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u, GLuint v1 = %u)", location, v0, v1);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform2ui, context, location, v0, v1);
+ if (context->skipValidation() || ValidateUniform2ui(context, location, v0, v1))
+ {
+ context->uniform2ui(location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform2uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform2uiv(context, location, count, value))
+ {
+ context->uniform2uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = %u)", location, v0, v1,
+ v2);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform3ui, context, location, v0, v1, v2);
+ if (context->skipValidation() || ValidateUniform3ui(context, location, v0, v1, v2))
+ {
+ context->uniform3ui(location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform3uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform3uiv(context, location, count, value))
+ {
+ context->uniform3uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = %u, GLuint v3 = %u)",
+ location, v0, v1, v2, v3);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform4ui, context, location, v0, v1, v2, v3);
+ if (context->skipValidation() || ValidateUniform4ui(context, location, v0, v1, v2, v3))
+ {
+ context->uniform4ui(location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(Uniform4uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform4uiv(context, location, count, value))
+ {
+ context->uniform4uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformBlockBinding(GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding)
+{
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)",
+ program, uniformBlockIndex, uniformBlockBinding);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformBlockBinding, context, program, uniformBlockIndex,
+ uniformBlockBinding);
+ if (context->skipValidation() ||
+ ValidateUniformBlockBinding(context, program, uniformBlockIndex, uniformBlockBinding))
+ {
+ context->uniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix2x3fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix2x3fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix2x3fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix2x4fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix2x4fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix2x4fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix3x2fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix3x2fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix3x2fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix3x4fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix3x4fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix3x4fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix4x2fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix4x2fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix4x2fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UniformMatrix4x3fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix4x3fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix4x3fv(location, count, transpose, value);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY UnmapBuffer(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(UnmapBuffer, context, targetPacked);
+ if (context->skipValidation() || ValidateUnmapBuffer(context, targetPacked))
+ {
+ return context->unmapBuffer(targetPacked);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::UnmapBuffer, GLboolean>();
+}
+
+void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribDivisor, context, index, divisor);
+ if (context->skipValidation() || ValidateVertexAttribDivisor(context, index, divisor))
+ {
+ context->vertexAttribDivisor(index, divisor);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribI4i(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribI4i, context, index, x, y, z, w);
+ if (context->skipValidation() || ValidateVertexAttribI4i(context, index, x, y, z, w))
+ {
+ context->vertexAttribI4i(index, x, y, z, w);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint *v)
+{
+ EVENT("(GLuint index = %u, const GLint *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribI4iv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttribI4iv(context, index, v))
+ {
+ context->vertexAttribI4iv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribI4ui(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribI4ui, context, index, x, y, z, w);
+ if (context->skipValidation() || ValidateVertexAttribI4ui(context, index, x, y, z, w))
+ {
+ context->vertexAttribI4ui(index, x, y, z, w);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint *v)
+{
+ EVENT("(GLuint index = %u, const GLuint *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribI4uiv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttribI4uiv(context, index, v))
+ {
+ context->vertexAttribI4uiv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY
+VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT(
+ "(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void "
+ "*pointer = 0x%016" PRIxPTR ")",
+ index, size, type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribIPointer, context, index, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateVertexAttribIPointer(context, index, size, typePacked, stride, pointer))
+ {
+ context->vertexAttribIPointer(index, size, typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ", GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(WaitSync, context, sync, flags, timeout);
+ if (context->skipValidation() || ValidateWaitSync(context, sync, flags, timeout))
+ {
+ context->waitSync(sync, flags, timeout);
+ }
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.h
new file mode 100644
index 0000000000..6c12fa80ba
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.h
@@ -0,0 +1,284 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_3_0_autogen.h:
+// Defines the GLES 3.0 entry points.
+
+#ifndef LIBGLESV2_ENTRY_POINTS_GLES_3_0_AUTOGEN_H_
+#define LIBGLESV2_ENTRY_POINTS_GLES_3_0_AUTOGEN_H_
+
+#include <GLES3/gl3.h>
+#include <export.h>
+
+namespace gl
+{
+ANGLE_EXPORT void GL_APIENTRY BeginQuery(GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode);
+ANGLE_EXPORT void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer);
+ANGLE_EXPORT void GL_APIENTRY
+BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+ANGLE_EXPORT void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler);
+ANGLE_EXPORT void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY BindVertexArray(GLuint array);
+ANGLE_EXPORT void GL_APIENTRY BlitFramebuffer(GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferfi(GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
+ANGLE_EXPORT GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CopyBufferSubData(GLenum readTarget,
+ GLenum writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage3D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers);
+ANGLE_EXPORT void GL_APIENTRY DeleteSync(GLsync sync);
+ANGLE_EXPORT void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint *arrays);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstanced(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount);
+ANGLE_EXPORT void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum *bufs);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstanced(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount);
+ANGLE_EXPORT void GL_APIENTRY DrawRangeElements(GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices);
+ANGLE_EXPORT void GL_APIENTRY EndQuery(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY EndTransformFeedback();
+ANGLE_EXPORT GLsync GL_APIENTRY FenceSync(GLenum condition, GLbitfield flags);
+ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRange(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length);
+ANGLE_EXPORT void GL_APIENTRY
+FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+ANGLE_EXPORT void GL_APIENTRY GenQueries(GLsizei n, GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers);
+ANGLE_EXPORT void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint *arrays);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockName(GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockiv(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformsiv(GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params);
+ANGLE_EXPORT GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64v(GLenum pname, GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetInternalformativ(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramBinary(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
+ANGLE_EXPORT const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index);
+ANGLE_EXPORT void GL_APIENTRY
+GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+ANGLE_EXPORT void GL_APIENTRY GetTransformFeedbackVarying(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name);
+ANGLE_EXPORT GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program,
+ const GLchar *uniformBlockName);
+ANGLE_EXPORT void GL_APIENTRY GetUniformIndices(GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices);
+ANGLE_EXPORT void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY InvalidateFramebuffer(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+ANGLE_EXPORT void GL_APIENTRY InvalidateSubFramebuffer(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsQuery(GLuint id);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSampler(GLuint sampler);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSync(GLsync sync);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsTransformFeedback(GLuint id);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArray(GLuint array);
+ANGLE_EXPORT void *GL_APIENTRY MapBufferRange(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+ANGLE_EXPORT void GL_APIENTRY PauseTransformFeedback();
+ANGLE_EXPORT void GL_APIENTRY ProgramBinary(GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length);
+ANGLE_EXPORT void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value);
+ANGLE_EXPORT void GL_APIENTRY ReadBuffer(GLenum src);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY ResumeTransformFeedback();
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterfv(GLuint sampler,
+ GLenum pname,
+ const GLfloat *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY TexImage3D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY
+TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY TexStorage3D(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage3D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TransformFeedbackVaryings(GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode);
+ANGLE_EXPORT void GL_APIENTRY Uniform1ui(GLint location, GLuint v0);
+ANGLE_EXPORT void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1);
+ANGLE_EXPORT void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
+ANGLE_EXPORT void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY
+Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+ANGLE_EXPORT void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY UniformBlockBinding(GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBuffer(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint *v);
+ANGLE_EXPORT void GL_APIENTRY
+VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint *v);
+ANGLE_EXPORT void GL_APIENTRY
+VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
+} // namespace gl
+
+#endif // LIBGLESV2_ENTRY_POINTS_GLES_3_0_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp
new file mode 100644
index 0000000000..e1848fdf70
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp
@@ -0,0 +1,1380 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_3_1_autogen.cpp:
+// Defines the GLES 3.1 entry points.
+
+#include "libGLESv2/entry_points_gles_3_1_autogen.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Context.inl.h"
+#include "libANGLE/capture_gles_3_1_autogen.h"
+#include "libANGLE/entry_points_utils.h"
+#include "libANGLE/validationES31.h"
+#include "libGLESv2/global_state.h"
+
+namespace gl
+{
+void GL_APIENTRY ActiveShaderProgram(GLuint pipeline, GLuint program)
+{
+ EVENT("(GLuint pipeline = %u, GLuint program = %u)", pipeline, program);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ActiveShaderProgram, context, pipeline, program);
+ if (context->skipValidation() || ValidateActiveShaderProgram(context, pipeline, program))
+ {
+ context->activeShaderProgram(pipeline, program);
+ }
+ }
+}
+
+void GL_APIENTRY BindImageTexture(GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format)
+{
+ EVENT(
+ "(GLuint unit = %u, GLuint texture = %u, GLint level = %d, GLboolean layered = %u, GLint "
+ "layer = %d, GLenum access = 0x%X, GLenum format = 0x%X)",
+ unit, texture, level, layered, layer, access, format);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindImageTexture, context, unit, texture, level, layered, layer, access,
+ format);
+ if (context->skipValidation() ||
+ ValidateBindImageTexture(context, unit, texture, level, layered, layer, access, format))
+ {
+ context->bindImageTexture(unit, texture, level, layered, layer, access, format);
+ }
+ }
+}
+
+void GL_APIENTRY BindProgramPipeline(GLuint pipeline)
+{
+ EVENT("(GLuint pipeline = %u)", pipeline);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindProgramPipeline, context, pipeline);
+ if (context->skipValidation() || ValidateBindProgramPipeline(context, pipeline))
+ {
+ context->bindProgramPipeline(pipeline);
+ }
+ }
+}
+
+void GL_APIENTRY BindVertexBuffer(GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ EVENT(
+ "(GLuint bindingindex = %u, GLuint buffer = %u, GLintptr offset = %llu, GLsizei stride = "
+ "%d)",
+ bindingindex, buffer, static_cast<unsigned long long>(offset), stride);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindVertexBuffer, context, bindingindex, buffer, offset, stride);
+ if (context->skipValidation() ||
+ ValidateBindVertexBuffer(context, bindingindex, buffer, offset, stride))
+ {
+ context->bindVertexBuffer(bindingindex, buffer, offset, stride);
+ }
+ }
+}
+
+GLuint GL_APIENTRY CreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
+{
+ EVENT("(GLenum type = 0x%X, GLsizei count = %d, const GLchar *const*strings = 0x%016" PRIxPTR
+ ")",
+ type, count, (uintptr_t)strings);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ShaderType typePacked = FromGLenum<ShaderType>(type);
+ ANGLE_CAPTURE(CreateShaderProgramv, context, typePacked, count, strings);
+ if (context->skipValidation() ||
+ ValidateCreateShaderProgramv(context, typePacked, count, strings))
+ {
+ return context->createShaderProgramv(typePacked, count, strings);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CreateShaderProgramv, GLuint>();
+}
+
+void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
+{
+ EVENT("(GLsizei n = %d, const GLuint *pipelines = 0x%016" PRIxPTR ")", n, (uintptr_t)pipelines);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteProgramPipelines, context, n, pipelines);
+ if (context->skipValidation() || ValidateDeleteProgramPipelines(context, n, pipelines))
+ {
+ context->deleteProgramPipelines(n, pipelines);
+ }
+ }
+}
+
+void GL_APIENTRY DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
+{
+ EVENT("(GLuint num_groups_x = %u, GLuint num_groups_y = %u, GLuint num_groups_z = %u)",
+ num_groups_x, num_groups_y, num_groups_z);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DispatchCompute, context, num_groups_x, num_groups_y, num_groups_z);
+ if (context->skipValidation() ||
+ ValidateDispatchCompute(context, num_groups_x, num_groups_y, num_groups_z))
+ {
+ context->dispatchCompute(num_groups_x, num_groups_y, num_groups_z);
+ }
+ }
+}
+
+void GL_APIENTRY DispatchComputeIndirect(GLintptr indirect)
+{
+ EVENT("(GLintptr indirect = %llu)", static_cast<unsigned long long>(indirect));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DispatchComputeIndirect, context, indirect);
+ if (context->skipValidation() || ValidateDispatchComputeIndirect(context, indirect))
+ {
+ context->dispatchComputeIndirect(indirect);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArraysIndirect(GLenum mode, const void *indirect)
+{
+ EVENT("(GLenum mode = 0x%X, const void *indirect = 0x%016" PRIxPTR ")", mode,
+ (uintptr_t)indirect);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysIndirect, context, modePacked, indirect);
+ if (context->skipValidation() || ValidateDrawArraysIndirect(context, modePacked, indirect))
+ {
+ context->drawArraysIndirect(modePacked, indirect);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
+{
+ EVENT("(GLenum mode = 0x%X, GLenum type = 0x%X, const void *indirect = 0x%016" PRIxPTR ")",
+ mode, type, (uintptr_t)indirect);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsIndirect, context, modePacked, typePacked, indirect);
+ if (context->skipValidation() ||
+ ValidateDrawElementsIndirect(context, modePacked, typePacked, indirect))
+ {
+ context->drawElementsIndirect(modePacked, typePacked, indirect);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferParameteri(GLenum target, GLenum pname, GLint param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FramebufferParameteri, context, target, pname, param);
+ if (context->skipValidation() ||
+ ValidateFramebufferParameteri(context, target, pname, param))
+ {
+ context->framebufferParameteri(target, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines)
+{
+ EVENT("(GLsizei n = %d, GLuint *pipelines = 0x%016" PRIxPTR ")", n, (uintptr_t)pipelines);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenProgramPipelines, context, n, pipelines);
+ if (context->skipValidation() || ValidateGenProgramPipelines(context, n, pipelines))
+ {
+ context->genProgramPipelines(n, pipelines);
+ }
+ }
+}
+
+void GL_APIENTRY GetBooleani_v(GLenum target, GLuint index, GLboolean *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLboolean *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetBooleani_v, context, target, index, data);
+ if (context->skipValidation() || ValidateGetBooleani_v(context, target, index, data))
+ {
+ context->getBooleani_v(target, index, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFramebufferParameteriv, context, target, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetFramebufferParameteriv(context, target, pname, params))
+ {
+ context->getFramebufferParameteriv(target, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
+{
+ EVENT("(GLenum pname = 0x%X, GLuint index = %u, GLfloat *val = 0x%016" PRIxPTR ")", pname,
+ index, (uintptr_t)val);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetMultisamplefv, context, pname, index, val);
+ if (context->skipValidation() || ValidateGetMultisamplefv(context, pname, index, val))
+ {
+ context->getMultisamplefv(pname, index, val);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramInterfaceiv(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLenum pname = 0x%X, GLint *params "
+ "= 0x%016" PRIxPTR ")",
+ program, programInterface, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramInterfaceiv, context, program, programInterface, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramInterfaceiv(context, program, programInterface, pname, params))
+ {
+ context->getProgramInterfaceiv(program, programInterface, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramPipelineInfoLog(GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ EVENT("(GLuint pipeline = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *infoLog = 0x%016" PRIxPTR ")",
+ pipeline, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramPipelineInfoLog, context, pipeline, bufSize, length, infoLog);
+ if (context->skipValidation() ||
+ ValidateGetProgramPipelineInfoLog(context, pipeline, bufSize, length, infoLog))
+ {
+ context->getProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint pipeline = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")",
+ pipeline, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramPipelineiv, context, pipeline, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramPipelineiv(context, pipeline, pname, params))
+ {
+ context->getProgramPipelineiv(pipeline, pname, params);
+ }
+ }
+}
+
+GLuint GL_APIENTRY GetProgramResourceIndex(GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar *name = 0x%016" PRIxPTR
+ ")",
+ program, programInterface, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramResourceIndex, context, program, programInterface, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceIndex(context, program, programInterface, name))
+ {
+ return context->getProgramResourceIndex(program, programInterface, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetProgramResourceIndex, GLuint>();
+}
+
+GLint GL_APIENTRY GetProgramResourceLocation(GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar *name = 0x%016" PRIxPTR
+ ")",
+ program, programInterface, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramResourceLocation, context, program, programInterface, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceLocation(context, program, programInterface, name))
+ {
+ return context->getProgramResourceLocation(program, programInterface, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetProgramResourceLocation, GLint>();
+}
+
+void GL_APIENTRY GetProgramResourceName(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLuint index = %u, GLsizei bufSize "
+ "= %d, GLsizei *length = 0x%016" PRIxPTR ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, programInterface, index, bufSize, (uintptr_t)length, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramResourceName, context, program, programInterface, index, bufSize,
+ length, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceName(context, program, programInterface, index, bufSize,
+ length, name))
+ {
+ context->getProgramResourceName(program, programInterface, index, bufSize, length,
+ name);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramResourceiv(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLuint index = %u, GLsizei "
+ "propCount = %d, const GLenum *props = 0x%016" PRIxPTR
+ ", GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLint *params = 0x%016" PRIxPTR ")",
+ program, programInterface, index, propCount, (uintptr_t)props, bufSize, (uintptr_t)length,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramResourceiv, context, program, programInterface, index, propCount,
+ props, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceiv(context, program, programInterface, index, propCount,
+ props, bufSize, length, params))
+ {
+ context->getProgramResourceiv(program, programInterface, index, propCount, props,
+ bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLfloat *params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterfv, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterfv(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameterfv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameteriv, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameteriv(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameteriv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline)
+{
+ EVENT("(GLuint pipeline = %u)", pipeline);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsProgramPipeline, context, pipeline);
+ if (context->skipValidation() || ValidateIsProgramPipeline(context, pipeline))
+ {
+ return context->isProgramPipeline(pipeline);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsProgramPipeline, GLboolean>();
+}
+
+void GL_APIENTRY MemoryBarrier(GLbitfield barriers)
+{
+ EVENT("(GLbitfield barriers = 0x%X)", barriers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MemoryBarrier, context, barriers);
+ if (context->skipValidation() || ValidateMemoryBarrier(context, barriers))
+ {
+ context->memoryBarrier(barriers);
+ }
+ }
+}
+
+void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers)
+{
+ EVENT("(GLbitfield barriers = 0x%X)", barriers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MemoryBarrierByRegion, context, barriers);
+ if (context->skipValidation() || ValidateMemoryBarrierByRegion(context, barriers))
+ {
+ context->memoryBarrierByRegion(barriers);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %f)", program, location, v0);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform1f, context, program, location, v0);
+ if (context->skipValidation() || ValidateProgramUniform1f(context, program, location, v0))
+ {
+ context->programUniform1f(program, location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform1fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform1fv(context, program, location, count, value))
+ {
+ context->programUniform1fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1i(GLuint program, GLint location, GLint v0)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d)", program, location, v0);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform1i, context, program, location, v0);
+ if (context->skipValidation() || ValidateProgramUniform1i(context, program, location, v0))
+ {
+ context->programUniform1i(program, location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform1iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform1iv(context, program, location, count, value))
+ {
+ context->programUniform1iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1ui(GLuint program, GLint location, GLuint v0)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u)", program, location, v0);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform1ui, context, program, location, v0);
+ if (context->skipValidation() || ValidateProgramUniform1ui(context, program, location, v0))
+ {
+ context->programUniform1ui(program, location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform1uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform1uiv(context, program, location, count, value))
+ {
+ context->programUniform1uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f)", program,
+ location, v0, v1);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform2f, context, program, location, v0, v1);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2f(context, program, location, v0, v1))
+ {
+ context->programUniform2f(program, location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform2fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2fv(context, program, location, count, value))
+ {
+ context->programUniform2fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d)", program,
+ location, v0, v1);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform2i, context, program, location, v0, v1);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2i(context, program, location, v0, v1))
+ {
+ context->programUniform2i(program, location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform2iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2iv(context, program, location, count, value))
+ {
+ context->programUniform2iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u)", program,
+ location, v0, v1);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform2ui, context, program, location, v0, v1);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2ui(context, program, location, v0, v1))
+ {
+ context->programUniform2ui(program, location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform2uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2uiv(context, program, location, count, value))
+ {
+ context->programUniform2uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = "
+ "%f)",
+ program, location, v0, v1, v2);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform3f, context, program, location, v0, v1, v2);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3f(context, program, location, v0, v1, v2))
+ {
+ context->programUniform3f(program, location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform3fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3fv(context, program, location, count, value))
+ {
+ context->programUniform3fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d)",
+ program, location, v0, v1, v2);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform3i, context, program, location, v0, v1, v2);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3i(context, program, location, v0, v1, v2))
+ {
+ context->programUniform3i(program, location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform3iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3iv(context, program, location, count, value))
+ {
+ context->programUniform3iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = "
+ "%u)",
+ program, location, v0, v1, v2);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform3ui, context, program, location, v0, v1, v2);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3ui(context, program, location, v0, v1, v2))
+ {
+ context->programUniform3ui(program, location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform3uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3uiv(context, program, location, count, value))
+ {
+ context->programUniform3uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = "
+ "%f, GLfloat v3 = %f)",
+ program, location, v0, v1, v2, v3);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform4f, context, program, location, v0, v1, v2, v3);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4f(context, program, location, v0, v1, v2, v3))
+ {
+ context->programUniform4f(program, location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform4fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4fv(context, program, location, count, value))
+ {
+ context->programUniform4fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d, "
+ "GLint v3 = %d)",
+ program, location, v0, v1, v2, v3);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform4i, context, program, location, v0, v1, v2, v3);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4i(context, program, location, v0, v1, v2, v3))
+ {
+ context->programUniform4i(program, location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform4iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4iv(context, program, location, count, value))
+ {
+ context->programUniform4iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = "
+ "%u, GLuint v3 = %u)",
+ program, location, v0, v1, v2, v3);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform4ui, context, program, location, v0, v1, v2, v3);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4ui(context, program, location, v0, v1, v2, v3))
+ {
+ context->programUniform4ui(program, location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniform4uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4uiv(context, program, location, count, value))
+ {
+ context->programUniform4uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix2fv, context, program, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix2fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix2fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix2x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix2x3fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix2x3fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix2x3fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix2x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix2x4fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix2x4fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix2x4fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix3fv, context, program, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix3fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix3fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix3x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix3x2fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix3x2fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix3x2fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix3x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix3x4fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix3x4fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix3x4fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix4fv, context, program, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix4fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix4fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix4x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix4x2fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix4x2fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix4x2fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix4x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramUniformMatrix4x3fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix4x3fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix4x3fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY SampleMaski(GLuint maskNumber, GLbitfield mask)
+{
+ EVENT("(GLuint maskNumber = %u, GLbitfield mask = 0x%X)", maskNumber, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SampleMaski, context, maskNumber, mask);
+ if (context->skipValidation() || ValidateSampleMaski(context, maskNumber, mask))
+ {
+ context->sampleMaski(maskNumber, mask);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage2DMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLboolean fixedsamplelocations = %u)",
+ target, samples, internalformat, width, height, fixedsamplelocations);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2DMultisample, context, targetPacked, samples, internalformat,
+ width, height, fixedsamplelocations);
+ if (context->skipValidation() ||
+ ValidateTexStorage2DMultisample(context, targetPacked, samples, internalformat, width,
+ height, fixedsamplelocations))
+ {
+ context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
+ fixedsamplelocations);
+ }
+ }
+}
+
+void GL_APIENTRY UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
+{
+ EVENT("(GLuint pipeline = %u, GLbitfield stages = 0x%X, GLuint program = %u)", pipeline, stages,
+ program);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(UseProgramStages, context, pipeline, stages, program);
+ if (context->skipValidation() ||
+ ValidateUseProgramStages(context, pipeline, stages, program))
+ {
+ context->useProgramStages(pipeline, stages, program);
+ }
+ }
+}
+
+void GL_APIENTRY ValidateProgramPipeline(GLuint pipeline)
+{
+ EVENT("(GLuint pipeline = %u)", pipeline);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ValidateProgramPipeline, context, pipeline);
+ if (context->skipValidation() || ValidateValidateProgramPipeline(context, pipeline))
+ {
+ context->validateProgramPipeline(pipeline);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribBinding(GLuint attribindex, GLuint bindingindex)
+{
+ EVENT("(GLuint attribindex = %u, GLuint bindingindex = %u)", attribindex, bindingindex);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribBinding, context, attribindex, bindingindex);
+ if (context->skipValidation() ||
+ ValidateVertexAttribBinding(context, attribindex, bindingindex))
+ {
+ context->vertexAttribBinding(attribindex, bindingindex);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribFormat(GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset)
+{
+ EVENT(
+ "(GLuint attribindex = %u, GLint size = %d, GLenum type = 0x%X, GLboolean normalized = %u, "
+ "GLuint relativeoffset = %u)",
+ attribindex, size, type, normalized, relativeoffset);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribFormat, context, attribindex, size, typePacked, normalized,
+ relativeoffset);
+ if (context->skipValidation() ||
+ ValidateVertexAttribFormat(context, attribindex, size, typePacked, normalized,
+ relativeoffset))
+ {
+ context->vertexAttribFormat(attribindex, size, typePacked, normalized, relativeoffset);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribIFormat(GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ EVENT(
+ "(GLuint attribindex = %u, GLint size = %d, GLenum type = 0x%X, GLuint relativeoffset = "
+ "%u)",
+ attribindex, size, type, relativeoffset);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribIFormat, context, attribindex, size, typePacked, relativeoffset);
+ if (context->skipValidation() ||
+ ValidateVertexAttribIFormat(context, attribindex, size, typePacked, relativeoffset))
+ {
+ context->vertexAttribIFormat(attribindex, size, typePacked, relativeoffset);
+ }
+ }
+}
+
+void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor)
+{
+ EVENT("(GLuint bindingindex = %u, GLuint divisor = %u)", bindingindex, divisor);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexBindingDivisor, context, bindingindex, divisor);
+ if (context->skipValidation() ||
+ ValidateVertexBindingDivisor(context, bindingindex, divisor))
+ {
+ context->vertexBindingDivisor(bindingindex, divisor);
+ }
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.h
new file mode 100644
index 0000000000..bdb4905133
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.h
@@ -0,0 +1,227 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_3_1_autogen.h:
+// Defines the GLES 3.1 entry points.
+
+#ifndef LIBGLESV2_ENTRY_POINTS_GLES_3_1_AUTOGEN_H_
+#define LIBGLESV2_ENTRY_POINTS_GLES_3_1_AUTOGEN_H_
+
+#include <GLES3/gl31.h>
+#include <export.h>
+#include "common/platform.h"
+
+namespace gl
+{
+ANGLE_EXPORT void GL_APIENTRY ActiveShaderProgram(GLuint pipeline, GLuint program);
+ANGLE_EXPORT void GL_APIENTRY BindImageTexture(GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format);
+ANGLE_EXPORT void GL_APIENTRY BindProgramPipeline(GLuint pipeline);
+ANGLE_EXPORT void GL_APIENTRY BindVertexBuffer(GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride);
+ANGLE_EXPORT GLuint GL_APIENTRY CreateShaderProgramv(GLenum type,
+ GLsizei count,
+ const GLchar *const *strings);
+ANGLE_EXPORT void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
+ANGLE_EXPORT void GL_APIENTRY DispatchCompute(GLuint num_groups_x,
+ GLuint num_groups_y,
+ GLuint num_groups_z);
+ANGLE_EXPORT void GL_APIENTRY DispatchComputeIndirect(GLintptr indirect);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysIndirect(GLenum mode, const void *indirect);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
+ANGLE_EXPORT void GL_APIENTRY FramebufferParameteri(GLenum target, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines);
+ANGLE_EXPORT void GL_APIENTRY GetBooleani_v(GLenum target, GLuint index, GLboolean *data);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
+ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceiv(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineInfoLog(GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
+ANGLE_EXPORT GLuint GL_APIENTRY GetProgramResourceIndex(GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+ANGLE_EXPORT GLint GL_APIENTRY GetProgramResourceLocation(GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetProgramResourceName(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetProgramResourceiv(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfv(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameteriv(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline);
+ANGLE_EXPORT void GL_APIENTRY MemoryBarrier(GLbitfield barriers);
+ANGLE_EXPORT void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1f(GLuint program, GLint location, GLfloat v0);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1i(GLuint program, GLint location, GLint v0);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1ui(GLuint program, GLint location, GLuint v0);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2f(GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2ui(GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY SampleMaski(GLuint maskNumber, GLbitfield mask);
+ANGLE_EXPORT void GL_APIENTRY TexStorage2DMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+ANGLE_EXPORT void GL_APIENTRY UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
+ANGLE_EXPORT void GL_APIENTRY ValidateProgramPipeline(GLuint pipeline);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribBinding(GLuint attribindex, GLuint bindingindex);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribFormat(GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribIFormat(GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset);
+ANGLE_EXPORT void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor);
+} // namespace gl
+
+#endif // LIBGLESV2_ENTRY_POINTS_GLES_3_1_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp
new file mode 100644
index 0000000000..043634e01d
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp
@@ -0,0 +1,19759 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_ext_autogen.cpp:
+// Defines the GLES extension entry points.
+
+#include "libGLESv2/entry_points_gles_ext_autogen.h"
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Context.inl.h"
+#include "libANGLE/capture_gles_ext_autogen.h"
+#include "libANGLE/entry_points_utils.h"
+#include "libANGLE/validationESEXT.h"
+#include "libGLESv2/global_state.h"
+
+#include "libANGLE/capture_gles_1_0_autogen.h"
+#include "libANGLE/capture_gles_2_0_autogen.h"
+#include "libANGLE/capture_gles_3_0_autogen.h"
+#include "libANGLE/capture_gles_3_1_autogen.h"
+#include "libANGLE/validationES1.h"
+#include "libANGLE/validationES2.h"
+#include "libANGLE/validationES3.h"
+#include "libANGLE/validationES31.h"
+
+namespace gl
+{
+
+// GL_ANGLE_copy_texture_3d
+void GL_APIENTRY CopyTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint internalFormat = %d, GLenum destType = 0x%X, GLboolean "
+ "unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha "
+ "= %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopyTexture3DANGLE, context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopyTexture3DANGLE(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
+ {
+ context->copyTexture3D(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY CopySubTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint xoffset = %d, GLint yoffset = %d, GLint zoffset = %d, "
+ "GLint x = %d, GLint y = %d, GLint z = %d, GLint width = %d, GLint height = %d, GLint "
+ "depth = %d, GLboolean unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean "
+ "unpackUnmultiplyAlpha = %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, zoffset, x, y, z,
+ width, height, depth, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopySubTexture3DANGLE, context, sourceId, sourceLevel, destTargetPacked,
+ destId, destLevel, xoffset, yoffset, zoffset, x, y, z, width, height, depth,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopySubTexture3DANGLE(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, xoffset, yoffset, zoffset, x, y, z, width,
+ height, depth, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha))
+ {
+ context->copySubTexture3D(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ xoffset, yoffset, zoffset, x, y, z, width, height, depth,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+// GL_ANGLE_framebuffer_blit
+void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ EVENT(
+ "(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BlitFramebufferANGLE, context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
+ dstX1, dstY1, mask, filter);
+ if (context->skipValidation() ||
+ ValidateBlitFramebufferANGLE(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1,
+ dstY1, mask, filter))
+ {
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
+ filter);
+ }
+ }
+}
+
+// GL_ANGLE_framebuffer_multisample
+void GL_APIENTRY RenderbufferStorageMultisampleANGLE(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(RenderbufferStorageMultisampleANGLE, context, target, samples, internalformat,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorageMultisampleANGLE(context, target, samples, internalformat,
+ width, height))
+ {
+ context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
+ }
+ }
+}
+
+// GL_ANGLE_instanced_arrays
+void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)",
+ mode, first, count, primcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysInstancedANGLE, context, modePacked, first, count, primcount);
+ if (context->skipValidation() ||
+ ValidateDrawArraysInstancedANGLE(context, modePacked, first, count, primcount))
+ {
+ context->drawArraysInstanced(modePacked, first, count, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ", GLsizei primcount = %d)",
+ mode, count, type, (uintptr_t)indices, primcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsInstancedANGLE, context, modePacked, count, typePacked, indices,
+ primcount);
+ if (context->skipValidation() ||
+ ValidateDrawElementsInstancedANGLE(context, modePacked, count, typePacked, indices,
+ primcount))
+ {
+ context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribDivisorANGLE, context, index, divisor);
+ if (context->skipValidation() || ValidateVertexAttribDivisorANGLE(context, index, divisor))
+ {
+ context->vertexAttribDivisor(index, divisor);
+ }
+ }
+}
+
+// GL_ANGLE_multi_draw
+void GL_APIENTRY MultiDrawArraysANGLE(GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLint *firsts = 0x%016" PRIxPTR
+ ", const GLsizei *counts = 0x%016" PRIxPTR ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)firsts, (uintptr_t)counts, drawcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(MultiDrawArraysANGLE, context, modePacked, firsts, counts, drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawArraysANGLE(context, modePacked, firsts, counts, drawcount))
+ {
+ context->multiDrawArrays(modePacked, firsts, counts, drawcount);
+ }
+ }
+}
+
+void GL_APIENTRY MultiDrawArraysInstancedANGLE(GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLint *firsts = 0x%016" PRIxPTR
+ ", const GLsizei *counts = 0x%016" PRIxPTR
+ ", const GLsizei *instanceCounts = 0x%016" PRIxPTR ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)firsts, (uintptr_t)counts, (uintptr_t)instanceCounts, drawcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(MultiDrawArraysInstancedANGLE, context, modePacked, firsts, counts,
+ instanceCounts, drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawArraysInstancedANGLE(context, modePacked, firsts, counts,
+ instanceCounts, drawcount))
+ {
+ context->multiDrawArraysInstanced(modePacked, firsts, counts, instanceCounts,
+ drawcount);
+ }
+ }
+}
+
+void GL_APIENTRY MultiDrawElementsANGLE(GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLsizei *counts = 0x%016" PRIxPTR
+ ", GLenum type = 0x%X, const GLvoid *const*indices = 0x%016" PRIxPTR
+ ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)counts, type, (uintptr_t)indices, drawcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(MultiDrawElementsANGLE, context, modePacked, counts, typePacked, indices,
+ drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawElementsANGLE(context, modePacked, counts, typePacked, indices,
+ drawcount))
+ {
+ context->multiDrawElements(modePacked, counts, typePacked, indices, drawcount);
+ }
+ }
+}
+
+void GL_APIENTRY MultiDrawElementsInstancedANGLE(GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLsizei *counts = 0x%016" PRIxPTR
+ ", GLenum type = 0x%X, const GLvoid *const*indices = 0x%016" PRIxPTR
+ ", const GLsizei*instanceCounts = 0x%016" PRIxPTR ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)counts, type, (uintptr_t)indices, (uintptr_t)instanceCounts, drawcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(MultiDrawElementsInstancedANGLE, context, modePacked, counts, typePacked,
+ indices, instanceCounts, drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawElementsInstancedANGLE(context, modePacked, counts, typePacked,
+ indices, instanceCounts, drawcount))
+ {
+ context->multiDrawElementsInstanced(modePacked, counts, typePacked, indices,
+ instanceCounts, drawcount);
+ }
+ }
+}
+
+// GL_ANGLE_provoking_vertex
+void GL_APIENTRY ProvokingVertexANGLE(GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ProvokingVertexConvention modePacked = FromGLenum<ProvokingVertexConvention>(mode);
+ ANGLE_CAPTURE(ProvokingVertexANGLE, context, modePacked);
+ if (context->skipValidation() || ValidateProvokingVertexANGLE(context, modePacked))
+ {
+ context->provokingVertex(modePacked);
+ }
+ }
+}
+
+// GL_ANGLE_request_extension
+void GL_APIENTRY RequestExtensionANGLE(const GLchar *name)
+{
+ EVENT("(const GLchar * name = 0x%016" PRIxPTR ")", (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(RequestExtensionANGLE, context, name);
+ if (context->skipValidation() || ValidateRequestExtensionANGLE(context, name))
+ {
+ context->requestExtension(name);
+ }
+ }
+}
+
+// GL_ANGLE_robust_client_memory
+void GL_APIENTRY GetBooleanvRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLboolean * params = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetBooleanvRobustANGLE, context, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetBooleanvRobustANGLE(context, pname, bufSize, length, params))
+ {
+ context->getBooleanvRobust(pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameterivRobustANGLE, context, targetPacked, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetBufferParameterivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getBufferParameterivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFloatvRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLfloat * params = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFloatvRobustANGLE, context, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetFloatvRobustANGLE(context, pname, bufSize, length, params))
+ {
+ context->getFloatvRobust(pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferAttachmentParameterivRobustANGLE(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = "
+ "%d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, attachment, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFramebufferAttachmentParameterivRobustANGLE, context, target, attachment,
+ pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetFramebufferAttachmentParameterivRobustANGLE(context, target, attachment,
+ pname, bufSize, length, params))
+ {
+ context->getFramebufferAttachmentParameterivRobust(target, attachment, pname, bufSize,
+ length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetIntegervRobustANGLE(GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLint * data = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetIntegervRobustANGLE, context, pname, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetIntegervRobustANGLE(context, pname, bufSize, length, data))
+ {
+ context->getIntegervRobust(pname, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramivRobustANGLE(GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramivRobustANGLE, context, program, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramivRobustANGLE(context, program, pname, bufSize, length, params))
+ {
+ context->getProgramivRobust(program, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetRenderbufferParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetRenderbufferParameterivRobustANGLE, context, target, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetRenderbufferParameterivRobustANGLE(
+ context, target, pname, bufSize, length, params))
+ {
+ context->getRenderbufferParameterivRobust(target, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY
+GetShaderivRobustANGLE(GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params)
+{
+ EVENT(
+ "(GLuint shader = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ shader, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetShaderivRobustANGLE, context, shader, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetShaderivRobustANGLE(context, shader, pname, bufSize, length, params))
+ {
+ context->getShaderivRobust(shader, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterfvRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterfvRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterfvRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterfvRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterivRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformfvRobustANGLE, context, program, location, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetUniformfvRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getUniformfvRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformivRobustANGLE, context, program, location, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetUniformivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getUniformivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribfvRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribfvRobustANGLE, context, index, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribfvRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribfvRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribivRobustANGLE, context, index, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribivRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribivRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribPointervRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", void ** pointer = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribPointervRobustANGLE, context, index, pname, bufSize, length,
+ pointer);
+ if (context->skipValidation() || ValidateGetVertexAttribPointervRobustANGLE(
+ context, index, pname, bufSize, length, pointer))
+ {
+ context->getVertexAttribPointervRobust(index, pname, bufSize, length, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY ReadPixelsRobustANGLE(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLsizei * columns = 0x%016" PRIxPTR ", GLsizei * rows = 0x%016" PRIxPTR
+ ", void * pixels = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, bufSize, (uintptr_t)length, (uintptr_t)columns,
+ (uintptr_t)rows, (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ReadPixelsRobustANGLE, context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, pixels);
+ if (context->skipValidation() ||
+ ValidateReadPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, pixels))
+ {
+ context->readPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
+ rows, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, GLsizei "
+ "bufSize = %d, const void * pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, format, type, bufSize,
+ (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage2DRobustANGLE, context, targetPacked, level, internalformat, width,
+ height, border, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage2DRobustANGLE(context, targetPacked, level, internalformat, width,
+ height, border, format, type, bufSize, pixels))
+ {
+ context->texImage2DRobust(targetPacked, level, internalformat, width, height, border,
+ format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterfvRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLfloat * params "
+ "= 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterfvRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterfvRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterfvRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLint * params = "
+ "0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterivRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterivRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterivRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei "
+ "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, GLsizei "
+ "bufSize = %d, const void * pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, type, bufSize, (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage2DRobustANGLE, context, targetPacked, level, xoffset, yoffset,
+ width, height, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage2DRobustANGLE(context, targetPacked, level, xoffset, yoffset, width,
+ height, format, type, bufSize, pixels))
+ {
+ context->texSubImage2DRobust(targetPacked, level, xoffset, yoffset, width, height,
+ format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *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, GLsizei bufSize = %d, const void * pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, format, type, bufSize,
+ (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage3DRobustANGLE, context, targetPacked, level, internalformat, width,
+ height, depth, border, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage3DRobustANGLE(context, targetPacked, level, internalformat, width,
+ height, depth, border, format, type, bufSize, pixels))
+ {
+ context->texImage3DRobust(targetPacked, level, internalformat, width, height, depth,
+ border, format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *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, GLsizei bufSize = %d, const void * pixels = 0x%016" PRIxPTR
+ ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize,
+ (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage3DRobustANGLE, context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage3DRobustANGLE(context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, type, bufSize,
+ pixels))
+ {
+ context->texSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, GLsizei dataSize = "
+ "%d, const GLvoid * data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, imageSize, dataSize, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage2DRobustANGLE, context, targetPacked, level, internalformat,
+ width, height, border, imageSize, dataSize, data);
+ if (context->skipValidation() || ValidateCompressedTexImage2DRobustANGLE(
+ context, targetPacked, level, internalformat, width,
+ height, border, imageSize, dataSize, data))
+ {
+ context->compressedTexImage2DRobust(targetPacked, level, internalformat, width, height,
+ border, imageSize, dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLsizei xoffset = %d, GLsizei yoffset = %d, "
+ "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLsizei imageSize = %d, "
+ "GLsizei dataSize = %d, const GLvoid * data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, imageSize, dataSize,
+ (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage2DRobustANGLE, context, targetPacked, level, xoffset,
+ yoffset, width, height, format, imageSize, dataSize, data);
+ if (context->skipValidation() || ValidateCompressedTexSubImage2DRobustANGLE(
+ context, targetPacked, level, xoffset, yoffset, width,
+ height, format, imageSize, dataSize, data))
+ {
+ context->compressedTexSubImage2DRobust(targetPacked, level, xoffset, yoffset, width,
+ height, format, imageSize, dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ 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, "
+ "GLsizei dataSize = %d, const GLvoid * data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, imageSize, dataSize,
+ (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage3DRobustANGLE, context, targetPacked, level, internalformat,
+ width, height, depth, border, imageSize, dataSize, data);
+ if (context->skipValidation() || ValidateCompressedTexImage3DRobustANGLE(
+ context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, dataSize, data))
+ {
+ context->compressedTexImage3DRobust(targetPacked, level, internalformat, width, height,
+ depth, border, imageSize, dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ 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, GLsizei dataSize = %d, const GLvoid * data = "
+ "0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, dataSize,
+ (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage3DRobustANGLE, context, targetPacked, level, xoffset,
+ yoffset, zoffset, width, height, depth, format, imageSize, dataSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage3DRobustANGLE(context, targetPacked, level, xoffset,
+ yoffset, zoffset, width, height, depth,
+ format, imageSize, dataSize, data))
+ {
+ context->compressedTexSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, imageSize,
+ dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY
+GetQueryivRobustANGLE(GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(GetQueryivRobustANGLE, context, targetPacked, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryivRobustANGLE(context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getQueryivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectuivRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjectuivRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjectuivRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjectuivRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferPointervRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", void ** params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferPointervRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetBufferPointervRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getBufferPointervRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY
+GetIntegeri_vRobustANGLE(GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * data = 0x%016" PRIxPTR ")",
+ target, index, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetIntegeri_vRobustANGLE, context, target, index, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, length, data))
+ {
+ context->getIntegeri_vRobust(target, index, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInternalformativRobustANGLE(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize "
+ "= %d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, internalformat, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetInternalformativRobustANGLE, context, target, internalformat, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetInternalformativRobustANGLE(context, target, internalformat, pname, bufSize,
+ length, params))
+ {
+ context->getInternalformativRobust(target, internalformat, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribIivRobustANGLE, context, index, pname, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribIivRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribIivRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIuivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetVertexAttribIuivRobustANGLE, context, index, pname, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribIuivRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribIuivRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformuivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUniformuivRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetUniformuivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getUniformuivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformBlockivRobustANGLE(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLsizei bufSize "
+ "= %d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, uniformBlockIndex, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetActiveUniformBlockivRobustANGLE, context, program, uniformBlockIndex,
+ pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniformBlockivRobustANGLE(context, program, uniformBlockIndex, pname,
+ bufSize, length, params))
+ {
+ context->getActiveUniformBlockivRobust(program, uniformBlockIndex, pname, bufSize,
+ length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLint64 * data = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetInteger64vRobustANGLE, context, pname, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetInteger64vRobustANGLE(context, pname, bufSize, length, data))
+ {
+ context->getInteger64vRobust(pname, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint64 * data = 0x%016" PRIxPTR ")",
+ target, index, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetInteger64i_vRobustANGLE, context, target, index, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, length, data))
+ {
+ context->getInteger64i_vRobust(target, index, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint64 * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameteri64vRobustANGLE, context, targetPacked, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetBufferParameteri64vRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getBufferParameteri64vRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLuint pname = %u, GLsizei bufSize = %d, const GLint * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterivRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterivRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLfloat * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterfvRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterfvRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameterivRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameterfvRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterfvRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterfvRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferParameterivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFramebufferParameterivRobustANGLE, context, sampler, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetFramebufferParameterivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getFramebufferParameterivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramInterfaceivRobustANGLE(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLenum pname = 0x%X, GLsizei "
+ "bufSize = %d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, programInterface, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramInterfaceivRobustANGLE, context, program, programInterface, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramInterfaceivRobustANGLE(context, program, programInterface, pname,
+ bufSize, length, params))
+ {
+ context->getProgramInterfaceivRobust(program, programInterface, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBooleani_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLboolean * data = 0x%016" PRIxPTR ")",
+ target, index, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetBooleani_vRobustANGLE, context, target, index, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, length, data))
+ {
+ context->getBooleani_vRobust(target, index, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetMultisamplefvRobustANGLE(GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val)
+{
+ EVENT(
+ "(GLenum pname = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * val = 0x%016" PRIxPTR ")",
+ pname, index, bufSize, (uintptr_t)length, (uintptr_t)val);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetMultisamplefvRobustANGLE, context, pname, index, bufSize, length, val);
+ if (context->skipValidation() ||
+ ValidateGetMultisamplefvRobustANGLE(context, pname, index, bufSize, length, val))
+ {
+ context->getMultisamplefvRobust(pname, index, bufSize, length, val);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterivRobustANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLsizei bufSize = %d, "
+ "GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, level, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterivRobustANGLE, context, targetPacked, level, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterivRobustANGLE(context, targetPacked, level, pname, bufSize,
+ length, params))
+ {
+ context->getTexLevelParameterivRobust(targetPacked, level, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterfvRobustANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLsizei bufSize = %d, "
+ "GLsizei * length = 0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ target, level, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterfvRobustANGLE, context, targetPacked, level, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterfvRobustANGLE(context, targetPacked, level, pname, bufSize,
+ length, params))
+ {
+ context->getTexLevelParameterfvRobust(targetPacked, level, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetPointervRobustANGLERobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", void ** params = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetPointervRobustANGLERobustANGLE, context, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetPointervRobustANGLERobustANGLE(context, pname, bufSize, length, params))
+ {
+ context->getPointervRobustANGLERobust(pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY ReadnPixelsRobustANGLE(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLsizei * columns = 0x%016" PRIxPTR ", GLsizei * rows = 0x%016" PRIxPTR
+ ", void * data = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, bufSize, (uintptr_t)length, (uintptr_t)columns,
+ (uintptr_t)rows, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ReadnPixelsRobustANGLE, context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, data);
+ if (context->skipValidation() ||
+ ValidateReadnPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, data))
+ {
+ context->readnPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
+ rows, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformfvRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetnUniformfvRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformfvRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getnUniformfvRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetnUniformivRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getnUniformivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformuivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetnUniformuivRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformuivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getnUniformuivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLint * params = "
+ "0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIivRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIivRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterIivRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIuivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLuint * params = "
+ "0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIuivRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIuivRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterIuivRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIivRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterIivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterIivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIuivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIuivRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterIuivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterIuivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLint * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterIivRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIivRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterIivRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIuivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLuint * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterIuivRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIuivRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterIuivRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterIivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameterIivRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterIivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterIivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterIuivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameterIuivRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterIuivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterIuivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectivRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjectivRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjectivRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjectivRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjecti64vRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint64 * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjecti64vRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjecti64vRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjecti64vRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectui64vRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint64 * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjectui64vRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjectui64vRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjectui64vRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+// GL_ANGLE_texture_external_update
+void GL_APIENTRY TexImage2DExternalANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X)",
+ target, level, internalformat, width, height, border, format, type);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage2DExternalANGLE, context, targetPacked, level, internalformat, width,
+ height, border, format, type);
+ if (context->skipValidation() ||
+ ValidateTexImage2DExternalANGLE(context, targetPacked, level, internalformat, width,
+ height, border, format, type))
+ {
+ context->texImage2DExternal(targetPacked, level, internalformat, width, height, border,
+ format, type);
+ }
+ }
+}
+
+void GL_APIENTRY InvalidateTextureANGLE(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(InvalidateTextureANGLE, context, targetPacked);
+ if (context->skipValidation() || ValidateInvalidateTextureANGLE(context, targetPacked))
+ {
+ context->invalidateTexture(targetPacked);
+ }
+ }
+}
+
+// GL_ANGLE_texture_multisample
+void GL_APIENTRY TexStorage2DMultisampleANGLE(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLboolean fixedsamplelocations = %u)",
+ target, samples, internalformat, width, height, fixedsamplelocations);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2DMultisampleANGLE, context, targetPacked, samples, internalformat,
+ width, height, fixedsamplelocations);
+ if (context->skipValidation() ||
+ ValidateTexStorage2DMultisampleANGLE(context, targetPacked, samples, internalformat,
+ width, height, fixedsamplelocations))
+ {
+ context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
+ fixedsamplelocations);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterivANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLint * params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterivANGLE, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterivANGLE(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameteriv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterfvANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLfloat * params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterfvANGLE, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterfvANGLE(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameterfv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMultisamplefvANGLE(GLenum pname, GLuint index, GLfloat *val)
+{
+ EVENT("(GLenum pname = 0x%X, GLuint index = %u, GLfloat * val = 0x%016" PRIxPTR ")", pname,
+ index, (uintptr_t)val);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetMultisamplefvANGLE, context, pname, index, val);
+ if (context->skipValidation() || ValidateGetMultisamplefvANGLE(context, pname, index, val))
+ {
+ context->getMultisamplefv(pname, index, val);
+ }
+ }
+}
+
+void GL_APIENTRY SampleMaskiANGLE(GLuint maskNumber, GLbitfield mask)
+{
+ EVENT("(GLuint maskNumber = %u, GLbitfield mask = 0x%X)", maskNumber, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SampleMaskiANGLE, context, maskNumber, mask);
+ if (context->skipValidation() || ValidateSampleMaskiANGLE(context, maskNumber, mask))
+ {
+ context->sampleMaski(maskNumber, mask);
+ }
+ }
+}
+
+// GL_ANGLE_translated_shader_source
+void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source)
+{
+ EVENT("(GLuint shader = %u, GLsizei bufsize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *source = 0x%016" PRIxPTR ")",
+ shader, bufsize, (uintptr_t)length, (uintptr_t)source);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetTranslatedShaderSourceANGLE, context, shader, bufsize, length, source);
+ if (context->skipValidation() ||
+ ValidateGetTranslatedShaderSourceANGLE(context, shader, bufsize, length, source))
+ {
+ context->getTranslatedShaderSource(shader, bufsize, length, source);
+ }
+ }
+}
+
+// GL_CHROMIUM_bind_uniform_location
+void GL_APIENTRY BindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, const GLchar* name = 0x%016" PRIxPTR ")",
+ program, location, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindUniformLocationCHROMIUM, context, program, location, name);
+ if (context->skipValidation() ||
+ ValidateBindUniformLocationCHROMIUM(context, program, location, name))
+ {
+ context->bindUniformLocation(program, location, name);
+ }
+ }
+}
+
+// GL_CHROMIUM_copy_compressed_texture
+void GL_APIENTRY CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
+{
+ EVENT("(GLuint sourceId = %u, GLuint destId = %u)", sourceId, destId);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CompressedCopyTextureCHROMIUM, context, sourceId, destId);
+ if (context->skipValidation() ||
+ ValidateCompressedCopyTextureCHROMIUM(context, sourceId, destId))
+ {
+ context->compressedCopyTexture(sourceId, destId);
+ }
+ }
+}
+
+// GL_CHROMIUM_copy_texture
+void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint internalFormat = %d, GLenum destType = 0x%X, GLboolean "
+ "unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha "
+ "= %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopyTextureCHROMIUM, context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopyTextureCHROMIUM(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
+ {
+ context->copyTexture(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint xoffset = %d, GLint yoffset = %d, GLint x = %d, GLint y = "
+ "%d, GLint width = %d, GLint height = %d, GLboolean unpackFlipY = %u, GLboolean "
+ "unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha = %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x, y, width, height,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopySubTextureCHROMIUM, context, sourceId, sourceLevel, destTargetPacked,
+ destId, destLevel, xoffset, yoffset, x, y, width, height, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopySubTextureCHROMIUM(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, xoffset, yoffset, x, y, width, height,
+ unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha))
+ {
+ context->copySubTexture(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ xoffset, yoffset, x, y, width, height, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+// GL_CHROMIUM_framebuffer_mixed_samples
+void GL_APIENTRY CoverageModulationCHROMIUM(GLenum components)
+{
+ EVENT("(GLenum components = 0x%X)", components);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CoverageModulationCHROMIUM, context, components);
+ if (context->skipValidation() || ValidateCoverageModulationCHROMIUM(context, components))
+ {
+ context->coverageModulation(components);
+ }
+ }
+}
+
+void GL_APIENTRY MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix)
+{
+ EVENT("(GLenum matrixMode = 0x%X, const GLfloat * matrix = 0x%016" PRIxPTR ")", matrixMode,
+ (uintptr_t)matrix);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MatrixLoadfCHROMIUM, context, matrixMode, matrix);
+ if (context->skipValidation() || ValidateMatrixLoadfCHROMIUM(context, matrixMode, matrix))
+ {
+ context->matrixLoadf(matrixMode, matrix);
+ }
+ }
+}
+
+void GL_APIENTRY MatrixLoadIdentityCHROMIUM(GLenum matrixMode)
+{
+ EVENT("(GLenum matrixMode = 0x%X)", matrixMode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MatrixLoadIdentityCHROMIUM, context, matrixMode);
+ if (context->skipValidation() || ValidateMatrixLoadIdentityCHROMIUM(context, matrixMode))
+ {
+ context->matrixLoadIdentity(matrixMode);
+ }
+ }
+}
+
+// GL_CHROMIUM_lose_context
+void GL_APIENTRY LoseContextCHROMIUM(GLenum current, GLenum other)
+{
+ EVENT("(GLenum current = 0x%X, GLenum other = 0x%X)", current, other);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ GraphicsResetStatus currentPacked = FromGLenum<GraphicsResetStatus>(current);
+ GraphicsResetStatus otherPacked = FromGLenum<GraphicsResetStatus>(other);
+ ANGLE_CAPTURE(LoseContextCHROMIUM, context, currentPacked, otherPacked);
+ if (context->skipValidation() ||
+ ValidateLoseContextCHROMIUM(context, currentPacked, otherPacked))
+ {
+ context->loseContext(currentPacked, otherPacked);
+ }
+ }
+}
+
+// GL_CHROMIUM_path_rendering
+GLuint GL_APIENTRY GenPathsCHROMIUM(GLsizei range)
+{
+ EVENT("(GLsizei range = %d)", range);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenPathsCHROMIUM, context, range);
+ if (context->skipValidation() || ValidateGenPathsCHROMIUM(context, range))
+ {
+ return context->genPaths(range);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GenPathsCHROMIUM, GLuint>();
+}
+
+void GL_APIENTRY DeletePathsCHROMIUM(GLuint first, GLsizei range)
+{
+ EVENT("(GLuint first = %u, GLsizei range = %d)", first, range);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeletePathsCHROMIUM, context, first, range);
+ if (context->skipValidation() || ValidateDeletePathsCHROMIUM(context, first, range))
+ {
+ context->deletePaths(first, range);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsPathCHROMIUM(GLuint path)
+{
+ EVENT("(GLuint path = %u)", path);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsPathCHROMIUM, context, path);
+ if (context->skipValidation() || ValidateIsPathCHROMIUM(context, path))
+ {
+ return context->isPath(path);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsPathCHROMIUM, GLboolean>();
+}
+
+void GL_APIENTRY PathCommandsCHROMIUM(GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords)
+{
+ EVENT("(GLuint path = %u, GLsizei numCommands = %d, const GLubyte * commands = 0x%016" PRIxPTR
+ ", GLsizei numCoords = %d, GLenum coordType = 0x%X, const void* coords = 0x%016" PRIxPTR
+ ")",
+ path, numCommands, (uintptr_t)commands, numCoords, coordType, (uintptr_t)coords);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PathCommandsCHROMIUM, context, path, numCommands, commands, numCoords,
+ coordType, coords);
+ if (context->skipValidation() ||
+ ValidatePathCommandsCHROMIUM(context, path, numCommands, commands, numCoords, coordType,
+ coords))
+ {
+ context->pathCommands(path, numCommands, commands, numCoords, coordType, coords);
+ }
+ }
+}
+
+void GL_APIENTRY PathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLfloat value = %f)", path, pname, value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PathParameterfCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidatePathParameterfCHROMIUM(context, path, pname, value))
+ {
+ context->pathParameterf(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLint value = %d)", path, pname, value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PathParameteriCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidatePathParameteriCHROMIUM(context, path, pname, value))
+ {
+ context->pathParameteri(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY GetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLfloat * value = 0x%016" PRIxPTR ")", path,
+ pname, (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetPathParameterfvCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidateGetPathParameterfvCHROMIUM(context, path, pname, value))
+ {
+ context->getPathParameterfv(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY GetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLint * value = 0x%016" PRIxPTR ")", path, pname,
+ (uintptr_t)value);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetPathParameterivCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidateGetPathParameterivCHROMIUM(context, path, pname, value))
+ {
+ context->getPathParameteriv(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask)
+{
+ EVENT("(GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", func, ref, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PathStencilFuncCHROMIUM, context, func, ref, mask);
+ if (context->skipValidation() || ValidatePathStencilFuncCHROMIUM(context, func, ref, mask))
+ {
+ context->pathStencilFunc(func, ref, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask)
+{
+ EVENT("(GLuint path = %u, GLenum fillMode = 0x%X, GLuint mask = %u)", path, fillMode, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilFillPathCHROMIUM, context, path, fillMode, mask);
+ if (context->skipValidation() ||
+ ValidateStencilFillPathCHROMIUM(context, path, fillMode, mask))
+ {
+ context->stencilFillPath(path, fillMode, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask)
+{
+ EVENT("(GLuint path = %u, GLint reference = %d, GLuint mask = %u)", path, reference, mask);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilStrokePathCHROMIUM, context, path, reference, mask);
+ if (context->skipValidation() ||
+ ValidateStencilStrokePathCHROMIUM(context, path, reference, mask))
+ {
+ context->stencilStrokePath(path, reference, mask);
+ }
+ }
+}
+
+void GL_APIENTRY CoverFillPathCHROMIUM(GLuint path, GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLenum coverMode = 0x%X)", path, coverMode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CoverFillPathCHROMIUM, context, path, coverMode);
+ if (context->skipValidation() || ValidateCoverFillPathCHROMIUM(context, path, coverMode))
+ {
+ context->coverFillPath(path, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY CoverStrokePathCHROMIUM(GLuint path, GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLenum coverMode = 0x%X)", path, coverMode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CoverStrokePathCHROMIUM, context, path, coverMode);
+ if (context->skipValidation() || ValidateCoverStrokePathCHROMIUM(context, path, coverMode))
+ {
+ context->coverStrokePath(path, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY StencilThenCoverFillPathCHROMIUM(GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLenum fillMode = 0x%X, GLuint mask = %u, GLenum coverMode = 0x%X)",
+ path, fillMode, mask, coverMode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilThenCoverFillPathCHROMIUM, context, path, fillMode, mask, coverMode);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverFillPathCHROMIUM(context, path, fillMode, mask, coverMode))
+ {
+ context->stencilThenCoverFillPath(path, fillMode, mask, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY StencilThenCoverStrokePathCHROMIUM(GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLint reference = %d, GLuint mask = %u, GLenum coverMode = 0x%X)",
+ path, reference, mask, coverMode);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilThenCoverStrokePathCHROMIUM, context, path, reference, mask,
+ coverMode);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverStrokePathCHROMIUM(context, path, reference, mask, coverMode))
+ {
+ context->stencilThenCoverStrokePath(path, reference, mask, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY CoverFillPathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPath = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum coverMode = 0x%X, GLenum transformType = 0x%X, const "
+ "GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPath, pathNameType, (uintptr_t)paths, pathBase, coverMode, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CoverFillPathInstancedCHROMIUM, context, numPath, pathNameType, paths,
+ pathBase, coverMode, transformType, transformValues);
+ if (context->skipValidation() ||
+ ValidateCoverFillPathInstancedCHROMIUM(context, numPath, pathNameType, paths, pathBase,
+ coverMode, transformType, transformValues))
+ {
+ context->coverFillPathInstanced(numPath, pathNameType, paths, pathBase, coverMode,
+ transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPath = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum coverMode = 0x%X, GLenum transformType = 0x%X, const "
+ "GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPath, pathNameType, (uintptr_t)paths, pathBase, coverMode, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CoverStrokePathInstancedCHROMIUM, context, numPath, pathNameType, paths,
+ pathBase, coverMode, transformType, transformValues);
+ if (context->skipValidation() || ValidateCoverStrokePathInstancedCHROMIUM(
+ context, numPath, pathNameType, paths, pathBase,
+ coverMode, transformType, transformValues))
+ {
+ context->coverStrokePathInstanced(numPath, pathNameType, paths, pathBase, coverMode,
+ transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY StencilStrokePathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPath = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLint reference = %d, GLuint mask = %u, GLenum transformType = "
+ "0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPath, pathNameType, (uintptr_t)paths, pathBase, reference, mask, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilStrokePathInstancedCHROMIUM, context, numPath, pathNameType, paths,
+ pathBase, reference, mask, transformType, transformValues);
+ if (context->skipValidation() || ValidateStencilStrokePathInstancedCHROMIUM(
+ context, numPath, pathNameType, paths, pathBase,
+ reference, mask, transformType, transformValues))
+ {
+ context->stencilStrokePathInstanced(numPath, pathNameType, paths, pathBase, reference,
+ mask, transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY StencilFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPaths = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum fillMode = 0x%X, GLuint mask = %u, GLenum transformType "
+ "= 0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPaths, pathNameType, (uintptr_t)paths, pathBase, fillMode, mask, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilFillPathInstancedCHROMIUM, context, numPaths, pathNameType, paths,
+ pathBase, fillMode, mask, transformType, transformValues);
+ if (context->skipValidation() || ValidateStencilFillPathInstancedCHROMIUM(
+ context, numPaths, pathNameType, paths, pathBase,
+ fillMode, mask, transformType, transformValues))
+ {
+ context->stencilFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode,
+ mask, transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY StencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPaths = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum fillMode = 0x%X, GLuint mask = %u, GLenum coverMode = "
+ "0x%X, GLenum transformType = 0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPaths, pathNameType, (uintptr_t)paths, pathBase, fillMode, mask, coverMode,
+ transformType, (uintptr_t)transformValues);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilThenCoverFillPathInstancedCHROMIUM, context, numPaths, pathNameType,
+ paths, pathBase, fillMode, mask, coverMode, transformType, transformValues);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverFillPathInstancedCHROMIUM(
+ context, numPaths, pathNameType, paths, pathBase, fillMode, mask, coverMode,
+ transformType, transformValues))
+ {
+ context->stencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase,
+ fillMode, mask, coverMode, transformType,
+ transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY StencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPaths = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLint reference = %d, GLuint mask = %u, GLenum coverMode = "
+ "0x%X, GLenum transformType = 0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPaths, pathNameType, (uintptr_t)paths, pathBase, reference, mask, coverMode,
+ transformType, (uintptr_t)transformValues);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(StencilThenCoverStrokePathInstancedCHROMIUM, context, numPaths, pathNameType,
+ paths, pathBase, reference, mask, coverMode, transformType, transformValues);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverStrokePathInstancedCHROMIUM(
+ context, numPaths, pathNameType, paths, pathBase, reference, mask, coverMode,
+ transformType, transformValues))
+ {
+ context->stencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
+ reference, mask, coverMode, transformType,
+ transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY BindFragmentInputLocationCHROMIUM(GLuint programs,
+ GLint location,
+ const GLchar *name)
+{
+ EVENT("(GLuint programs = %u, GLint location = %d, const GLchar * name = 0x%016" PRIxPTR ")",
+ programs, location, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindFragmentInputLocationCHROMIUM, context, programs, location, name);
+ if (context->skipValidation() ||
+ ValidateBindFragmentInputLocationCHROMIUM(context, programs, location, name))
+ {
+ context->bindFragmentInputLocation(programs, location, name);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLenum genMode = 0x%X, GLint components = %d, "
+ "const GLfloat * coeffs = 0x%016" PRIxPTR ")",
+ program, location, genMode, components, (uintptr_t)coeffs);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramPathFragmentInputGenCHROMIUM, context, program, location, genMode,
+ components, coeffs);
+ if (context->skipValidation() ||
+ ValidateProgramPathFragmentInputGenCHROMIUM(context, program, location, genMode,
+ components, coeffs))
+ {
+ context->programPathFragmentInputGen(program, location, genMode, components, coeffs);
+ }
+ }
+}
+
+// GL_EXT_blend_func_extended
+void GL_APIENTRY BindFragDataLocationEXT(GLuint program, GLuint color, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, GLuint color = %u, const GLchar *name = 0x%016" PRIxPTR ")",
+ program, color, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindFragDataLocationEXT, context, program, color, name);
+ if (context->skipValidation() ||
+ ValidateBindFragDataLocationEXT(context, program, color, name))
+ {
+ context->bindFragDataLocation(program, color, name);
+ }
+ }
+}
+
+void GL_APIENTRY BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint colorNumber = %u, GLuint index = %u, const GLchar *name = "
+ "0x%016" PRIxPTR ")",
+ program, colorNumber, index, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindFragDataLocationIndexedEXT, context, program, colorNumber, index, name);
+ if (context->skipValidation() ||
+ ValidateBindFragDataLocationIndexedEXT(context, program, colorNumber, index, name))
+ {
+ context->bindFragDataLocationIndexed(program, colorNumber, index, name);
+ }
+ }
+}
+
+GLint GL_APIENTRY GetFragDataIndexEXT(GLuint program, const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFragDataIndexEXT, context, program, name);
+ if (context->skipValidation() || ValidateGetFragDataIndexEXT(context, program, name))
+ {
+ return context->getFragDataIndex(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetFragDataIndexEXT, GLint>();
+}
+
+GLint GL_APIENTRY GetProgramResourceLocationIndexEXT(GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar *name = 0x%016" PRIxPTR
+ ")",
+ program, programInterface, (uintptr_t)name);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramResourceLocationIndexEXT, context, program, programInterface, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceLocationIndexEXT(context, program, programInterface, name))
+ {
+ return context->getProgramResourceLocationIndex(program, programInterface, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetProgramResourceLocationIndexEXT, GLint>();
+}
+
+// GL_EXT_debug_marker
+void GL_APIENTRY InsertEventMarkerEXT(GLsizei length, const GLchar *marker)
+{
+ // Don't run an EVENT() macro on the EXT_debug_marker entry points.
+ // It can interfere with the debug events being set by the caller.
+ // EVENT("(GLsizei length = %d, const GLchar *marker = 0x%016" PRIxPTR ")", length,
+ // (uintptr_t)marker);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(InsertEventMarkerEXT, context, length, marker);
+ if (context->skipValidation() || ValidateInsertEventMarkerEXT(context, length, marker))
+ {
+ context->insertEventMarker(length, marker);
+ }
+ }
+}
+
+void GL_APIENTRY PopGroupMarkerEXT()
+{
+ // Don't run an EVENT() macro on the EXT_debug_marker entry points.
+ // It can interfere with the debug events being set by the caller.
+ // EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PopGroupMarkerEXT, context);
+ if (context->skipValidation() || ValidatePopGroupMarkerEXT(context))
+ {
+ context->popGroupMarker();
+ }
+ }
+}
+
+void GL_APIENTRY PushGroupMarkerEXT(GLsizei length, const GLchar *marker)
+{
+ // Don't run an EVENT() macro on the EXT_debug_marker entry points.
+ // It can interfere with the debug events being set by the caller.
+ // EVENT("(GLsizei length = %d, const GLchar *marker = 0x%016" PRIxPTR ")", length,
+ // (uintptr_t)marker);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PushGroupMarkerEXT, context, length, marker);
+ if (context->skipValidation() || ValidatePushGroupMarkerEXT(context, length, marker))
+ {
+ context->pushGroupMarker(length, marker);
+ }
+ }
+}
+
+// GL_EXT_discard_framebuffer
+void GL_APIENTRY DiscardFramebufferEXT(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = "
+ "0x%016" PRIxPTR ")",
+ target, numAttachments, (uintptr_t)attachments);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DiscardFramebufferEXT, context, target, numAttachments, attachments);
+ if (context->skipValidation() ||
+ ValidateDiscardFramebufferEXT(context, target, numAttachments, attachments))
+ {
+ context->discardFramebuffer(target, numAttachments, attachments);
+ }
+ }
+}
+
+// GL_EXT_disjoint_timer_query
+void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(BeginQueryEXT, context, targetPacked, id);
+ if (context->skipValidation() || ValidateBeginQueryEXT(context, targetPacked, id))
+ {
+ context->beginQuery(targetPacked, id);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteQueriesEXT, context, n, ids);
+ if (context->skipValidation() || ValidateDeleteQueriesEXT(context, n, ids))
+ {
+ context->deleteQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY EndQueryEXT(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(EndQueryEXT, context, targetPacked);
+ if (context->skipValidation() || ValidateEndQueryEXT(context, targetPacked))
+ {
+ context->endQuery(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenQueriesEXT, context, n, ids);
+ if (context->skipValidation() || ValidateGenQueriesEXT(context, n, ids))
+ {
+ context->genQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint64 *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjecti64vEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjecti64vEXT(context, id, pname, params))
+ {
+ context->getQueryObjecti64v(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjectivEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectivEXT(context, id, pname, params))
+ {
+ context->getQueryObjectiv(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLuint64 *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjectui64vEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectui64vEXT(context, id, pname, params))
+ {
+ context->getQueryObjectui64v(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetQueryObjectuivEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectuivEXT(context, id, pname, params))
+ {
+ context->getQueryObjectuiv(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(GetQueryivEXT, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryivEXT(context, targetPacked, pname, params))
+ {
+ context->getQueryiv(targetPacked, pname, params);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsQueryEXT(GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsQueryEXT, context, id);
+ if (context->skipValidation() || ValidateIsQueryEXT(context, id))
+ {
+ return context->isQuery(id);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsQueryEXT, GLboolean>();
+}
+
+void GL_APIENTRY QueryCounterEXT(GLuint id, GLenum target)
+{
+ EVENT("(GLuint id = %u, GLenum target = 0x%X)", id, target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(QueryCounterEXT, context, id, targetPacked);
+ if (context->skipValidation() || ValidateQueryCounterEXT(context, id, targetPacked))
+ {
+ context->queryCounter(id, targetPacked);
+ }
+ }
+}
+
+// GL_EXT_draw_buffers
+void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs)
+{
+ EVENT("(GLsizei n = %d, const GLenum *bufs = 0x%016" PRIxPTR ")", n, (uintptr_t)bufs);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawBuffersEXT, context, n, bufs);
+ if (context->skipValidation() || ValidateDrawBuffersEXT(context, n, bufs))
+ {
+ context->drawBuffers(n, bufs);
+ }
+ }
+}
+
+// GL_EXT_geometry_shader
+void GL_APIENTRY FramebufferTextureEXT(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d)",
+ target, attachment, texture, level);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FramebufferTextureEXT, context, target, attachment, texture, level);
+ if (context->skipValidation() ||
+ ValidateFramebufferTextureEXT(context, target, attachment, texture, level))
+ {
+ context->framebufferTexture(target, attachment, texture, level);
+ }
+ }
+}
+
+// GL_EXT_instanced_arrays
+void GL_APIENTRY DrawArraysInstancedEXT(GLenum mode, GLint start, GLsizei count, GLsizei primcount)
+{
+ EVENT("(GLenum mode = 0x%X, GLint start = %d, GLsizei count = %d, GLsizei primcount = %d)",
+ mode, start, count, primcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysInstancedEXT, context, modePacked, start, count, primcount);
+ if (context->skipValidation() ||
+ ValidateDrawArraysInstancedEXT(context, modePacked, start, count, primcount))
+ {
+ context->drawArraysInstanced(modePacked, start, count, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsInstancedEXT(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ", GLsizei primcount = %d)",
+ mode, count, type, (uintptr_t)indices, primcount);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsInstancedEXT, context, modePacked, count, typePacked, indices,
+ primcount);
+ if (context->skipValidation() ||
+ ValidateDrawElementsInstancedEXT(context, modePacked, count, typePacked, indices,
+ primcount))
+ {
+ context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribDivisorEXT(GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(VertexAttribDivisorEXT, context, index, divisor);
+ if (context->skipValidation() || ValidateVertexAttribDivisorEXT(context, index, divisor))
+ {
+ context->vertexAttribDivisor(index, divisor);
+ }
+ }
+}
+
+// GL_EXT_map_buffer_range
+void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu)", target,
+ static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(FlushMappedBufferRangeEXT, context, targetPacked, offset, length);
+ if (context->skipValidation() ||
+ ValidateFlushMappedBufferRangeEXT(context, targetPacked, offset, length))
+ {
+ context->flushMappedBufferRange(targetPacked, offset, length);
+ }
+ }
+}
+
+void *GL_APIENTRY MapBufferRangeEXT(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu, GLbitfield "
+ "access = 0x%X)",
+ target, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
+ access);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(MapBufferRangeEXT, context, targetPacked, offset, length, access);
+ if (context->skipValidation() ||
+ ValidateMapBufferRangeEXT(context, targetPacked, offset, length, access))
+ {
+ return context->mapBufferRange(targetPacked, offset, length, access);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::MapBufferRangeEXT, void *>();
+}
+
+// GL_EXT_memory_object
+void GL_APIENTRY BufferStorageMemEXT(GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizeiptr size = %llu, GLuint memory = %u, GLuint64 offset = "
+ "%llu)",
+ target, static_cast<unsigned long long>(size), memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(BufferStorageMemEXT, context, targetPacked, size, memory, offset);
+ if (context->skipValidation() ||
+ ValidateBufferStorageMemEXT(context, targetPacked, size, memory, offset))
+ {
+ context->bufferStorageMem(targetPacked, size, memory, offset);
+ }
+ }
+}
+
+void GL_APIENTRY CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects)
+{
+ EVENT("(GLsizei n = %d, GLuint *memoryObjects = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)memoryObjects);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CreateMemoryObjectsEXT, context, n, memoryObjects);
+ if (context->skipValidation() || ValidateCreateMemoryObjectsEXT(context, n, memoryObjects))
+ {
+ context->createMemoryObjects(n, memoryObjects);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects)
+{
+ EVENT("(GLsizei n = %d, const GLuint *memoryObjects = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)memoryObjects);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteMemoryObjectsEXT, context, n, memoryObjects);
+ if (context->skipValidation() || ValidateDeleteMemoryObjectsEXT(context, n, memoryObjects))
+ {
+ context->deleteMemoryObjects(n, memoryObjects);
+ }
+ }
+}
+
+void GL_APIENTRY GetMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint memoryObject = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")",
+ memoryObject, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetMemoryObjectParameterivEXT, context, memoryObject, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetMemoryObjectParameterivEXT(context, memoryObject, pname, params))
+ {
+ context->getMemoryObjectParameteriv(memoryObject, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUnsignedBytevEXT(GLenum pname, GLubyte *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLubyte *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUnsignedBytevEXT, context, pname, data);
+ if (context->skipValidation() || ValidateGetUnsignedBytevEXT(context, pname, data))
+ {
+ context->getUnsignedBytev(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLubyte *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetUnsignedBytei_vEXT, context, target, index, data);
+ if (context->skipValidation() ||
+ ValidateGetUnsignedBytei_vEXT(context, target, index, data))
+ {
+ context->getUnsignedBytei_v(target, index, data);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsMemoryObjectEXT(GLuint memoryObject)
+{
+ EVENT("(GLuint memoryObject = %u)", memoryObject);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsMemoryObjectEXT, context, memoryObject);
+ if (context->skipValidation() || ValidateIsMemoryObjectEXT(context, memoryObject))
+ {
+ return context->isMemoryObject(memoryObject);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsMemoryObjectEXT, GLboolean>();
+}
+
+void GL_APIENTRY MemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, const GLint *params)
+{
+ EVENT("(GLuint memoryObject = %u, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR
+ ")",
+ memoryObject, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MemoryObjectParameterivEXT, context, memoryObject, pname, params);
+ if (context->skipValidation() ||
+ ValidateMemoryObjectParameterivEXT(context, memoryObject, pname, params))
+ {
+ context->memoryObjectParameteriv(memoryObject, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem2DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalFormat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLuint memory = %u, GLuint64 offset = %llu)",
+ target, levels, internalFormat, width, height, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem2DEXT, context, targetPacked, levels, internalFormat, width,
+ height, memory, offset);
+ if (context->skipValidation() ||
+ ValidateTexStorageMem2DEXT(context, targetPacked, levels, internalFormat, width, height,
+ memory, offset))
+ {
+ context->texStorageMem2D(targetPacked, levels, internalFormat, width, height, memory,
+ offset);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem2DMultisampleEXT(GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalFormat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLboolean fixedSampleLocations = %u, GLuint memory = %u, "
+ "GLuint64 offset = %llu)",
+ target, samples, internalFormat, width, height, fixedSampleLocations, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem2DMultisampleEXT, context, targetPacked, samples, internalFormat,
+ width, height, fixedSampleLocations, memory, offset);
+ if (context->skipValidation() || ValidateTexStorageMem2DMultisampleEXT(
+ context, targetPacked, samples, internalFormat, width,
+ height, fixedSampleLocations, memory, offset))
+ {
+ context->texStorageMem2DMultisample(targetPacked, samples, internalFormat, width,
+ height, fixedSampleLocations, memory, offset);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem3DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalFormat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLsizei depth = %d, GLuint memory = %u, GLuint64 offset = %llu)",
+ target, levels, internalFormat, width, height, depth, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem3DEXT, context, targetPacked, levels, internalFormat, width,
+ height, depth, memory, offset);
+ if (context->skipValidation() ||
+ ValidateTexStorageMem3DEXT(context, targetPacked, levels, internalFormat, width, height,
+ depth, memory, offset))
+ {
+ context->texStorageMem3D(targetPacked, levels, internalFormat, width, height, depth,
+ memory, offset);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem3DMultisampleEXT(GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalFormat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLsizei depth = %d, GLboolean fixedSampleLocations = %u, "
+ "GLuint memory = %u, GLuint64 offset = %llu)",
+ target, samples, internalFormat, width, height, depth, fixedSampleLocations, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem3DMultisampleEXT, context, targetPacked, samples, internalFormat,
+ width, height, depth, fixedSampleLocations, memory, offset);
+ if (context->skipValidation() || ValidateTexStorageMem3DMultisampleEXT(
+ context, targetPacked, samples, internalFormat, width,
+ height, depth, fixedSampleLocations, memory, offset))
+ {
+ context->texStorageMem3DMultisample(targetPacked, samples, internalFormat, width,
+ height, depth, fixedSampleLocations, memory,
+ offset);
+ }
+ }
+}
+
+// GL_EXT_memory_object_fd
+void GL_APIENTRY ImportMemoryFdEXT(GLuint memory, GLuint64 size, GLenum handleType, GLint fd)
+{
+ EVENT("(GLuint memory = %u, GLuint64 size = %llu, GLenum handleType = 0x%X, GLint fd = %d)",
+ memory, static_cast<unsigned long long>(size), handleType, fd);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ HandleType handleTypePacked = FromGLenum<HandleType>(handleType);
+ ANGLE_CAPTURE(ImportMemoryFdEXT, context, memory, size, handleTypePacked, fd);
+ if (context->skipValidation() ||
+ ValidateImportMemoryFdEXT(context, memory, size, handleTypePacked, fd))
+ {
+ context->importMemoryFd(memory, size, handleTypePacked, fd);
+ }
+ }
+}
+
+// GL_EXT_occlusion_query_boolean
+// BeginQueryEXT is already defined.
+
+// DeleteQueriesEXT is already defined.
+
+// EndQueryEXT is already defined.
+
+// GenQueriesEXT is already defined.
+
+// GetQueryObjectuivEXT is already defined.
+
+// GetQueryivEXT is already defined.
+
+// IsQueryEXT is already defined.
+
+// GL_EXT_robustness
+GLenum GL_APIENTRY GetGraphicsResetStatusEXT()
+{
+ EVENT("()");
+
+ Context *context = GetGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetGraphicsResetStatusEXT, context);
+ if (context->skipValidation() || ValidateGetGraphicsResetStatusEXT(context))
+ {
+ return context->getGraphicsResetStatus();
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetGraphicsResetStatusEXT, GLenum>();
+}
+
+void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLfloat *params = "
+ "0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetnUniformfvEXT, context, program, location, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformfvEXT(context, program, location, bufSize, params))
+ {
+ context->getnUniformfv(program, location, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetnUniformivEXT, context, program, location, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformivEXT(context, program, location, bufSize, params))
+ {
+ context->getnUniformiv(program, location, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY ReadnPixelsEXT(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, GLsizei bufSize = %d, void *data = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, bufSize, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ReadnPixelsEXT, context, x, y, width, height, format, type, bufSize, data);
+ if (context->skipValidation() ||
+ ValidateReadnPixelsEXT(context, x, y, width, height, format, type, bufSize, data))
+ {
+ context->readnPixels(x, y, width, height, format, type, bufSize, data);
+ }
+ }
+}
+
+// GL_EXT_semaphore
+void GL_APIENTRY DeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores)
+{
+ EVENT("(GLsizei n = %d, const GLuint *semaphores = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)semaphores);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteSemaphoresEXT, context, n, semaphores);
+ if (context->skipValidation() || ValidateDeleteSemaphoresEXT(context, n, semaphores))
+ {
+ context->deleteSemaphores(n, semaphores);
+ }
+ }
+}
+
+void GL_APIENTRY GenSemaphoresEXT(GLsizei n, GLuint *semaphores)
+{
+ EVENT("(GLsizei n = %d, GLuint *semaphores = 0x%016" PRIxPTR ")", n, (uintptr_t)semaphores);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenSemaphoresEXT, context, n, semaphores);
+ if (context->skipValidation() || ValidateGenSemaphoresEXT(context, n, semaphores))
+ {
+ context->genSemaphores(n, semaphores);
+ }
+ }
+}
+
+void GL_APIENTRY GetSemaphoreParameterui64vEXT(GLuint semaphore, GLenum pname, GLuint64 *params)
+{
+ EVENT("(GLuint semaphore = %u, GLenum pname = 0x%X, GLuint64 *params = 0x%016" PRIxPTR ")",
+ semaphore, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSemaphoreParameterui64vEXT, context, semaphore, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSemaphoreParameterui64vEXT(context, semaphore, pname, params))
+ {
+ context->getSemaphoreParameterui64v(semaphore, pname, params);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsSemaphoreEXT(GLuint semaphore)
+{
+ EVENT("(GLuint semaphore = %u)", semaphore);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsSemaphoreEXT, context, semaphore);
+ if (context->skipValidation() || ValidateIsSemaphoreEXT(context, semaphore))
+ {
+ return context->isSemaphore(semaphore);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsSemaphoreEXT, GLboolean>();
+}
+
+void GL_APIENTRY SemaphoreParameterui64vEXT(GLuint semaphore, GLenum pname, const GLuint64 *params)
+{
+ EVENT("(GLuint semaphore = %u, GLenum pname = 0x%X, const GLuint64 *params = 0x%016" PRIxPTR
+ ")",
+ semaphore, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SemaphoreParameterui64vEXT, context, semaphore, pname, params);
+ if (context->skipValidation() ||
+ ValidateSemaphoreParameterui64vEXT(context, semaphore, pname, params))
+ {
+ context->semaphoreParameterui64v(semaphore, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY SignalSemaphoreEXT(GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts)
+{
+ EVENT(
+ "(GLuint semaphore = %u, GLuint numBufferBarriers = %u, const GLuint *buffers = "
+ "0x%016" PRIxPTR ", GLuint numTextureBarriers = %u, const GLuint *textures = 0x%016" PRIxPTR
+ ", const GLenum *dstLayouts = 0x%016" PRIxPTR ")",
+ semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers, (uintptr_t)textures,
+ (uintptr_t)dstLayouts);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SignalSemaphoreEXT, context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, dstLayouts);
+ if (context->skipValidation() ||
+ ValidateSignalSemaphoreEXT(context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, dstLayouts))
+ {
+ context->signalSemaphore(semaphore, numBufferBarriers, buffers, numTextureBarriers,
+ textures, dstLayouts);
+ }
+ }
+}
+
+void GL_APIENTRY WaitSemaphoreEXT(GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts)
+{
+ EVENT(
+ "(GLuint semaphore = %u, GLuint numBufferBarriers = %u, const GLuint *buffers = "
+ "0x%016" PRIxPTR ", GLuint numTextureBarriers = %u, const GLuint *textures = 0x%016" PRIxPTR
+ ", const GLenum *srcLayouts = 0x%016" PRIxPTR ")",
+ semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers, (uintptr_t)textures,
+ (uintptr_t)srcLayouts);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(WaitSemaphoreEXT, context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, srcLayouts);
+ if (context->skipValidation() ||
+ ValidateWaitSemaphoreEXT(context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, srcLayouts))
+ {
+ context->waitSemaphore(semaphore, numBufferBarriers, buffers, numTextureBarriers,
+ textures, srcLayouts);
+ }
+ }
+}
+
+// GetUnsignedBytei_vEXT is already defined.
+
+// GetUnsignedBytevEXT is already defined.
+
+// GL_EXT_semaphore_fd
+void GL_APIENTRY ImportSemaphoreFdEXT(GLuint semaphore, GLenum handleType, GLint fd)
+{
+ EVENT("(GLuint semaphore = %u, GLenum handleType = 0x%X, GLint fd = %d)", semaphore, handleType,
+ fd);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ HandleType handleTypePacked = FromGLenum<HandleType>(handleType);
+ ANGLE_CAPTURE(ImportSemaphoreFdEXT, context, semaphore, handleTypePacked, fd);
+ if (context->skipValidation() ||
+ ValidateImportSemaphoreFdEXT(context, semaphore, handleTypePacked, fd))
+ {
+ context->importSemaphoreFd(semaphore, handleTypePacked, fd);
+ }
+ }
+}
+
+// GL_EXT_texture_storage
+void GL_APIENTRY TexStorage1DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d)",
+ target, levels, internalformat, width);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TexStorage1DEXT, context, target, levels, internalformat, width);
+ if (context->skipValidation() ||
+ ValidateTexStorage1DEXT(context, target, levels, internalformat, width))
+ {
+ context->texStorage1D(target, levels, internalformat, width);
+ }
+ }
+}
+
+void GL_APIENTRY
+TexStorage2DEXT(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2DEXT, context, targetPacked, levels, internalformat, width,
+ height);
+ if (context->skipValidation() ||
+ ValidateTexStorage2DEXT(context, targetPacked, levels, internalformat, width, height))
+ {
+ context->texStorage2D(targetPacked, levels, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage3DEXT(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage3DEXT, context, targetPacked, levels, internalformat, width, height,
+ depth);
+ if (context->skipValidation() ||
+ ValidateTexStorage3DEXT(context, targetPacked, levels, internalformat, width, height,
+ depth))
+ {
+ context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
+ }
+ }
+}
+
+// GL_KHR_debug
+void GL_APIENTRY DebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam)
+{
+ EVENT("(GLDEBUGPROCKHR callback = 0x%016" PRIxPTR ", const void *userParam = 0x%016" PRIxPTR
+ ")",
+ (uintptr_t)callback, (uintptr_t)userParam);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DebugMessageCallbackKHR, context, callback, userParam);
+ if (context->skipValidation() ||
+ ValidateDebugMessageCallbackKHR(context, callback, userParam))
+ {
+ context->debugMessageCallback(callback, userParam);
+ }
+ }
+}
+
+void GL_APIENTRY DebugMessageControlKHR(GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled)
+{
+ EVENT(
+ "(GLenum source = 0x%X, GLenum type = 0x%X, GLenum severity = 0x%X, GLsizei count = %d, "
+ "const GLuint *ids = 0x%016" PRIxPTR ", GLboolean enabled = %u)",
+ source, type, severity, count, (uintptr_t)ids, enabled);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DebugMessageControlKHR, context, source, type, severity, count, ids, enabled);
+ if (context->skipValidation() ||
+ ValidateDebugMessageControlKHR(context, source, type, severity, count, ids, enabled))
+ {
+ context->debugMessageControl(source, type, severity, count, ids, enabled);
+ }
+ }
+}
+
+void GL_APIENTRY DebugMessageInsertKHR(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf)
+{
+ EVENT(
+ "(GLenum source = 0x%X, GLenum type = 0x%X, GLuint id = %u, GLenum severity = 0x%X, "
+ "GLsizei length = %d, const GLchar *buf = 0x%016" PRIxPTR ")",
+ source, type, id, severity, length, (uintptr_t)buf);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DebugMessageInsertKHR, context, source, type, id, severity, length, buf);
+ if (context->skipValidation() ||
+ ValidateDebugMessageInsertKHR(context, source, type, id, severity, length, buf))
+ {
+ context->debugMessageInsert(source, type, id, severity, length, buf);
+ }
+ }
+}
+
+GLuint GL_APIENTRY GetDebugMessageLogKHR(GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ EVENT("(GLuint count = %u, GLsizei bufSize = %d, GLenum *sources = 0x%016" PRIxPTR
+ ", GLenum *types = 0x%016" PRIxPTR ", GLuint *ids = 0x%016" PRIxPTR
+ ", GLenum *severities = 0x%016" PRIxPTR ", GLsizei *lengths = 0x%016" PRIxPTR
+ ", GLchar *messageLog = 0x%016" PRIxPTR ")",
+ count, bufSize, (uintptr_t)sources, (uintptr_t)types, (uintptr_t)ids,
+ (uintptr_t)severities, (uintptr_t)lengths, (uintptr_t)messageLog);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetDebugMessageLogKHR, context, count, bufSize, sources, types, ids,
+ severities, lengths, messageLog);
+ if (context->skipValidation() ||
+ ValidateGetDebugMessageLogKHR(context, count, bufSize, sources, types, ids, severities,
+ lengths, messageLog))
+ {
+ return context->getDebugMessageLog(count, bufSize, sources, types, ids, severities,
+ lengths, messageLog);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetDebugMessageLogKHR, GLuint>();
+}
+
+void GL_APIENTRY
+GetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
+{
+ EVENT(
+ "(GLenum identifier = 0x%X, GLuint name = %u, GLsizei bufSize = %d, GLsizei *length = "
+ "0x%016" PRIxPTR ", GLchar *label = 0x%016" PRIxPTR ")",
+ identifier, name, bufSize, (uintptr_t)length, (uintptr_t)label);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetObjectLabelKHR, context, identifier, name, bufSize, length, label);
+ if (context->skipValidation() ||
+ ValidateGetObjectLabelKHR(context, identifier, name, bufSize, length, label))
+ {
+ context->getObjectLabel(identifier, name, bufSize, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY GetObjectPtrLabelKHR(const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ EVENT("(const void *ptr = 0x%016" PRIxPTR
+ ", GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *label = 0x%016" PRIxPTR ")",
+ (uintptr_t)ptr, bufSize, (uintptr_t)length, (uintptr_t)label);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetObjectPtrLabelKHR, context, ptr, bufSize, length, label);
+ if (context->skipValidation() ||
+ ValidateGetObjectPtrLabelKHR(context, ptr, bufSize, length, label))
+ {
+ context->getObjectPtrLabel(ptr, bufSize, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY GetPointervKHR(GLenum pname, void **params)
+{
+ EVENT("(GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetPointervKHR, context, pname, params);
+ if (context->skipValidation() || ValidateGetPointervKHR(context, pname, params))
+ {
+ context->getPointerv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY ObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
+{
+ EVENT(
+ "(GLenum identifier = 0x%X, GLuint name = %u, GLsizei length = %d, const GLchar *label = "
+ "0x%016" PRIxPTR ")",
+ identifier, name, length, (uintptr_t)label);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ObjectLabelKHR, context, identifier, name, length, label);
+ if (context->skipValidation() ||
+ ValidateObjectLabelKHR(context, identifier, name, length, label))
+ {
+ context->objectLabel(identifier, name, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY ObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label)
+{
+ EVENT("(const void *ptr = 0x%016" PRIxPTR
+ ", GLsizei length = %d, const GLchar *label = 0x%016" PRIxPTR ")",
+ (uintptr_t)ptr, length, (uintptr_t)label);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ObjectPtrLabelKHR, context, ptr, length, label);
+ if (context->skipValidation() || ValidateObjectPtrLabelKHR(context, ptr, length, label))
+ {
+ context->objectPtrLabel(ptr, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY PopDebugGroupKHR()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PopDebugGroupKHR, context);
+ if (context->skipValidation() || ValidatePopDebugGroupKHR(context))
+ {
+ context->popDebugGroup();
+ }
+ }
+}
+
+void GL_APIENTRY PushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar *message)
+{
+ EVENT(
+ "(GLenum source = 0x%X, GLuint id = %u, GLsizei length = %d, const GLchar *message = "
+ "0x%016" PRIxPTR ")",
+ source, id, length, (uintptr_t)message);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(PushDebugGroupKHR, context, source, id, length, message);
+ if (context->skipValidation() ||
+ ValidatePushDebugGroupKHR(context, source, id, length, message))
+ {
+ context->pushDebugGroup(source, id, length, message);
+ }
+ }
+}
+
+// GL_KHR_parallel_shader_compile
+void GL_APIENTRY MaxShaderCompilerThreadsKHR(GLuint count)
+{
+ EVENT("(GLuint count = %u)", count);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MaxShaderCompilerThreadsKHR, context, count);
+ if (context->skipValidation() || ValidateMaxShaderCompilerThreadsKHR(context, count))
+ {
+ context->maxShaderCompilerThreads(count);
+ }
+ }
+}
+
+// GL_NV_fence
+void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint *fences)
+{
+ EVENT("(GLsizei n = %d, const GLuint *fences = 0x%016" PRIxPTR ")", n, (uintptr_t)fences);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteFencesNV, context, n, fences);
+ if (context->skipValidation() || ValidateDeleteFencesNV(context, n, fences))
+ {
+ context->deleteFencesNV(n, fences);
+ }
+ }
+}
+
+void GL_APIENTRY FinishFenceNV(GLuint fence)
+{
+ EVENT("(GLuint fence = %u)", fence);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FinishFenceNV, context, fence);
+ if (context->skipValidation() || ValidateFinishFenceNV(context, fence))
+ {
+ context->finishFenceNV(fence);
+ }
+ }
+}
+
+void GL_APIENTRY GenFencesNV(GLsizei n, GLuint *fences)
+{
+ EVENT("(GLsizei n = %d, GLuint *fences = 0x%016" PRIxPTR ")", n, (uintptr_t)fences);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenFencesNV, context, n, fences);
+ if (context->skipValidation() || ValidateGenFencesNV(context, n, fences))
+ {
+ context->genFencesNV(n, fences);
+ }
+ }
+}
+
+void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint fence = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", fence,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFenceivNV, context, fence, pname, params);
+ if (context->skipValidation() || ValidateGetFenceivNV(context, fence, pname, params))
+ {
+ context->getFenceivNV(fence, pname, params);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsFenceNV(GLuint fence)
+{
+ EVENT("(GLuint fence = %u)", fence);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsFenceNV, context, fence);
+ if (context->skipValidation() || ValidateIsFenceNV(context, fence))
+ {
+ return context->isFenceNV(fence);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsFenceNV, GLboolean>();
+}
+
+void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition)
+{
+ EVENT("(GLuint fence = %u, GLenum condition = 0x%X)", fence, condition);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SetFenceNV, context, fence, condition);
+ if (context->skipValidation() || ValidateSetFenceNV(context, fence, condition))
+ {
+ context->setFenceNV(fence, condition);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY TestFenceNV(GLuint fence)
+{
+ EVENT("(GLuint fence = %u)", fence);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TestFenceNV, context, fence);
+ if (context->skipValidation() || ValidateTestFenceNV(context, fence))
+ {
+ return context->testFenceNV(fence);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::TestFenceNV, GLboolean>();
+}
+
+// GL_OES_EGL_image
+void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
+{
+ EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%016" PRIxPTR ")", target,
+ (uintptr_t)image);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(EGLImageTargetRenderbufferStorageOES, context, target, image);
+ if (context->skipValidation() ||
+ ValidateEGLImageTargetRenderbufferStorageOES(context, target, image))
+ {
+ context->eGLImageTargetRenderbufferStorage(target, image);
+ }
+ }
+}
+
+void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
+{
+ EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%016" PRIxPTR ")", target,
+ (uintptr_t)image);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(EGLImageTargetTexture2DOES, context, targetPacked, image);
+ if (context->skipValidation() ||
+ ValidateEGLImageTargetTexture2DOES(context, targetPacked, image))
+ {
+ context->eGLImageTargetTexture2D(targetPacked, image);
+ }
+ }
+}
+
+// GL_OES_draw_texture
+void GL_APIENTRY DrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
+{
+ EVENT(
+ "(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat width = %f, GLfloat height = %f)",
+ x, y, z, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexfOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexfOES(context, x, y, z, width, height))
+ {
+ context->drawTexf(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexfvOES(const GLfloat *coords)
+{
+ EVENT("(const GLfloat *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexfvOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexfvOES(context, coords))
+ {
+ context->drawTexfv(coords);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
+{
+ EVENT("(GLint x = %d, GLint y = %d, GLint z = %d, GLint width = %d, GLint height = %d)", x, y,
+ z, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexiOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexiOES(context, x, y, z, width, height))
+ {
+ context->drawTexi(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexivOES(const GLint *coords)
+{
+ EVENT("(const GLint *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexivOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexivOES(context, coords))
+ {
+ context->drawTexiv(coords);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
+{
+ EVENT(
+ "(GLshort x = %d, GLshort y = %d, GLshort z = %d, GLshort width = %d, GLshort height = %d)",
+ x, y, z, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexsOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexsOES(context, x, y, z, width, height))
+ {
+ context->drawTexs(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexsvOES(const GLshort *coords)
+{
+ EVENT("(const GLshort *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexsvOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexsvOES(context, coords))
+ {
+ context->drawTexsv(coords);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
+{
+ EVENT(
+ "(GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X, GLfixed width = 0x%X, GLfixed "
+ "height = 0x%X)",
+ x, y, z, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexxOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexxOES(context, x, y, z, width, height))
+ {
+ context->drawTexx(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexxvOES(const GLfixed *coords)
+{
+ EVENT("(const GLfixed *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DrawTexxvOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexxvOES(context, coords))
+ {
+ context->drawTexxv(coords);
+ }
+ }
+}
+
+// GL_OES_framebuffer_object
+void GL_APIENTRY BindFramebufferOES(GLenum target, GLuint framebuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint framebuffer = %u)", target, framebuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindFramebufferOES, context, target, framebuffer);
+ if (context->skipValidation() || ValidateBindFramebufferOES(context, target, framebuffer))
+ {
+ context->bindFramebuffer(target, framebuffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindRenderbufferOES(GLenum target, GLuint renderbuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %u)", target, renderbuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindRenderbufferOES, context, target, renderbuffer);
+ if (context->skipValidation() || ValidateBindRenderbufferOES(context, target, renderbuffer))
+ {
+ context->bindRenderbuffer(target, renderbuffer);
+ }
+ }
+}
+
+GLenum GL_APIENTRY CheckFramebufferStatusOES(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CheckFramebufferStatusOES, context, target);
+ if (context->skipValidation() || ValidateCheckFramebufferStatusOES(context, target))
+ {
+ return context->checkFramebufferStatus(target);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CheckFramebufferStatusOES, GLenum>();
+}
+
+void GL_APIENTRY DeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *framebuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)framebuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteFramebuffersOES, context, n, framebuffers);
+ if (context->skipValidation() || ValidateDeleteFramebuffersOES(context, n, framebuffers))
+ {
+ context->deleteFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteRenderbuffersOES, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateDeleteRenderbuffersOES(context, n, renderbuffers))
+ {
+ context->deleteRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferRenderbufferOES(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, GLuint "
+ "renderbuffer = %u)",
+ target, attachment, renderbuffertarget, renderbuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FramebufferRenderbufferOES, context, target, attachment, renderbuffertarget,
+ renderbuffer);
+ if (context->skipValidation() ||
+ ValidateFramebufferRenderbufferOES(context, target, attachment, renderbuffertarget,
+ renderbuffer))
+ {
+ context->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTexture2DOES(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, GLuint texture "
+ "= %u, GLint level = %d)",
+ target, attachment, textarget, texture, level);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget textargetPacked = FromGLenum<TextureTarget>(textarget);
+ ANGLE_CAPTURE(FramebufferTexture2DOES, context, target, attachment, textargetPacked,
+ texture, level);
+ if (context->skipValidation() ||
+ ValidateFramebufferTexture2DOES(context, target, attachment, textargetPacked, texture,
+ level))
+ {
+ context->framebufferTexture2D(target, attachment, textargetPacked, texture, level);
+ }
+ }
+}
+
+void GL_APIENTRY GenFramebuffersOES(GLsizei n, GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *framebuffers = 0x%016" PRIxPTR ")", n, (uintptr_t)framebuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenFramebuffersOES, context, n, framebuffers);
+ if (context->skipValidation() || ValidateGenFramebuffersOES(context, n, framebuffers))
+ {
+ context->genFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenRenderbuffersOES, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateGenRenderbuffersOES(context, n, renderbuffers))
+ {
+ context->genRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenerateMipmapOES(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GenerateMipmapOES, context, targetPacked);
+ if (context->skipValidation() || ValidateGenerateMipmapOES(context, targetPacked))
+ {
+ context->generateMipmap(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferAttachmentParameterivOES(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ target, attachment, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetFramebufferAttachmentParameterivOES, context, target, attachment, pname,
+ params);
+ if (context->skipValidation() || ValidateGetFramebufferAttachmentParameterivOES(
+ context, target, attachment, pname, params))
+ {
+ context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetRenderbufferParameterivOES, context, target, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetRenderbufferParameterivOES(context, target, pname, params))
+ {
+ context->getRenderbufferParameteriv(target, pname, params);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsFramebufferOES(GLuint framebuffer)
+{
+ EVENT("(GLuint framebuffer = %u)", framebuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsFramebufferOES, context, framebuffer);
+ if (context->skipValidation() || ValidateIsFramebufferOES(context, framebuffer))
+ {
+ return context->isFramebuffer(framebuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsFramebufferOES, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsRenderbufferOES(GLuint renderbuffer)
+{
+ EVENT("(GLuint renderbuffer = %u)", renderbuffer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsRenderbufferOES, context, renderbuffer);
+ if (context->skipValidation() || ValidateIsRenderbufferOES(context, renderbuffer))
+ {
+ return context->isRenderbuffer(renderbuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsRenderbufferOES, GLboolean>();
+}
+
+void GL_APIENTRY RenderbufferStorageOES(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = "
+ "%d)",
+ target, internalformat, width, height);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(RenderbufferStorageOES, context, target, internalformat, width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorageOES(context, target, internalformat, width, height))
+ {
+ context->renderbufferStorage(target, internalformat, width, height);
+ }
+ }
+}
+
+// GL_OES_get_program_binary
+void GL_APIENTRY GetProgramBinaryOES(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLenum *binaryFormat = 0x%016" PRIxPTR ", void *binary = 0x%016" PRIxPTR ")",
+ program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat, (uintptr_t)binary);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetProgramBinaryOES, context, program, bufSize, length, binaryFormat, binary);
+ if (context->skipValidation() ||
+ ValidateGetProgramBinaryOES(context, program, bufSize, length, binaryFormat, binary))
+ {
+ context->getProgramBinary(program, bufSize, length, binaryFormat, binary);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramBinaryOES(GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length)
+{
+ EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const void *binary = 0x%016" PRIxPTR
+ ", GLint length = %d)",
+ program, binaryFormat, (uintptr_t)binary, length);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(ProgramBinaryOES, context, program, binaryFormat, binary, length);
+ if (context->skipValidation() ||
+ ValidateProgramBinaryOES(context, program, binaryFormat, binary, length))
+ {
+ context->programBinary(program, binaryFormat, binary, length);
+ }
+ }
+}
+
+// GL_OES_mapbuffer
+void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, void **params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferPointervOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferPointervOES(context, targetPacked, pname, params))
+ {
+ context->getBufferPointerv(targetPacked, pname, params);
+ }
+ }
+}
+
+void *GL_APIENTRY MapBufferOES(GLenum target, GLenum access)
+{
+ EVENT("(GLenum target = 0x%X, GLenum access = 0x%X)", target, access);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(MapBufferOES, context, targetPacked, access);
+ if (context->skipValidation() || ValidateMapBufferOES(context, targetPacked, access))
+ {
+ return context->mapBuffer(targetPacked, access);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::MapBufferOES, void *>();
+}
+
+GLboolean GL_APIENTRY UnmapBufferOES(GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(UnmapBufferOES, context, targetPacked);
+ if (context->skipValidation() || ValidateUnmapBufferOES(context, targetPacked))
+ {
+ return context->unmapBuffer(targetPacked);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::UnmapBufferOES, GLboolean>();
+}
+
+// GL_OES_matrix_palette
+void GL_APIENTRY CurrentPaletteMatrixOES(GLuint matrixpaletteindex)
+{
+ EVENT("(GLuint matrixpaletteindex = %u)", matrixpaletteindex);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(CurrentPaletteMatrixOES, context, matrixpaletteindex);
+ if (context->skipValidation() ||
+ ValidateCurrentPaletteMatrixOES(context, matrixpaletteindex))
+ {
+ context->currentPaletteMatrix(matrixpaletteindex);
+ }
+ }
+}
+
+void GL_APIENTRY LoadPaletteFromModelViewMatrixOES()
+{
+ EVENT("()");
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(LoadPaletteFromModelViewMatrixOES, context);
+ if (context->skipValidation() || ValidateLoadPaletteFromModelViewMatrixOES(context))
+ {
+ context->loadPaletteFromModelViewMatrix();
+ }
+ }
+}
+
+void GL_APIENTRY MatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(MatrixIndexPointerOES, context, size, type, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateMatrixIndexPointerOES(context, size, type, stride, pointer))
+ {
+ context->matrixIndexPointer(size, type, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY WeightPointerOES(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(WeightPointerOES, context, size, type, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateWeightPointerOES(context, size, type, stride, pointer))
+ {
+ context->weightPointer(size, type, stride, pointer);
+ }
+ }
+}
+
+// GL_OES_point_size_array
+void GL_APIENTRY PointSizePointerOES(GLenum type, GLsizei stride, const void *pointer)
+{
+ EVENT("(GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR ")",
+ type, stride, (uintptr_t)pointer);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(PointSizePointerOES, context, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidatePointSizePointerOES(context, typePacked, stride, pointer))
+ {
+ context->pointSizePointer(typePacked, stride, pointer);
+ }
+ }
+}
+
+// GL_OES_query_matrix
+GLbitfield GL_APIENTRY QueryMatrixxOES(GLfixed *mantissa, GLint *exponent)
+{
+ EVENT("(GLfixed *mantissa = 0x%016" PRIxPTR ", GLint *exponent = 0x%016" PRIxPTR ")",
+ (uintptr_t)mantissa, (uintptr_t)exponent);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(QueryMatrixxOES, context, mantissa, exponent);
+ if (context->skipValidation() || ValidateQueryMatrixxOES(context, mantissa, exponent))
+ {
+ return context->queryMatrixx(mantissa, exponent);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::QueryMatrixxOES, GLbitfield>();
+}
+
+// GL_OES_texture_3D
+void GL_APIENTRY CompressedTexImage3DOES(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, imageSize, (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage3DOES, context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexImage3DOES(context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data))
+ {
+ context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
+ border, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize,
+ (uintptr_t)data);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage3DOES, context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage3DOES(context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, imageSize,
+ data))
+ {
+ context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexSubImage3DOES(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);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexSubImage3DOES, context, targetPacked, level, xoffset, yoffset, zoffset,
+ x, y, width, height);
+ if (context->skipValidation() ||
+ ValidateCopyTexSubImage3DOES(context, targetPacked, level, xoffset, yoffset, zoffset, x,
+ y, width, height))
+ {
+ context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
+ height);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTexture3DOES(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, GLuint texture "
+ "= %u, GLint level = %d, GLint zoffset = %d)",
+ target, attachment, textarget, texture, level, zoffset);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget textargetPacked = FromGLenum<TextureTarget>(textarget);
+ ANGLE_CAPTURE(FramebufferTexture3DOES, context, target, attachment, textargetPacked,
+ texture, level, zoffset);
+ if (context->skipValidation() ||
+ ValidateFramebufferTexture3DOES(context, target, attachment, textargetPacked, texture,
+ level, zoffset))
+ {
+ context->framebufferTexture3D(target, attachment, textargetPacked, texture, level,
+ zoffset);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage3DOES(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, "
+ "GLenum type = 0x%X, const void *pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage3DOES, context, targetPacked, level, internalformat, width, height,
+ depth, border, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage3DOES(context, targetPacked, level, internalformat, width, height,
+ depth, border, format, type, pixels))
+ {
+ context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
+ format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *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 void *pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage3DOES, context, targetPacked, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage3DOES(context, targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels))
+ {
+ context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, type, pixels);
+ }
+ }
+}
+
+// GL_OES_texture_border_clamp
+void GL_APIENTRY GetSamplerParameterIivOES(GLuint sampler, GLenum pname, GLint *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", sampler,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameterIivOES, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameterIivOES(context, sampler, pname, params))
+ {
+ context->getSamplerParameterIiv(sampler, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterIuivOES(GLuint sampler, GLenum pname, GLuint *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", sampler,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetSamplerParameterIuivOES, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameterIuivOES(context, sampler, pname, params))
+ {
+ context->getSamplerParameterIuiv(sampler, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIivOES(GLenum target, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterIivOES(context, targetPacked, pname, params))
+ {
+ context->getTexParameterIiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIuivOES(GLenum target, GLenum pname, GLuint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIuivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterIuivOES(context, targetPacked, pname, params))
+ {
+ context->getTexParameterIuiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIivOES(GLuint sampler, GLenum pname, const GLint *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLint *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterIivOES, context, sampler, pname, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIivOES(context, sampler, pname, param))
+ {
+ context->samplerParameterIiv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIuivOES(GLuint sampler, GLenum pname, const GLuint *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLuint *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(SamplerParameterIuivOES, context, sampler, pname, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIuivOES(context, sampler, pname, param))
+ {
+ context->samplerParameterIuiv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIivOES(GLenum target, GLenum pname, const GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIivOES(context, targetPacked, pname, params))
+ {
+ context->texParameterIiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIuivOES(GLenum target, GLenum pname, const GLuint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLuint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIuivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIuivOES(context, targetPacked, pname, params))
+ {
+ context->texParameterIuiv(targetPacked, pname, params);
+ }
+ }
+}
+
+// GL_OES_texture_cube_map
+void GL_APIENTRY GetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", coord,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetTexGenfvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateGetTexGenfvOES(context, coord, pname, params))
+ {
+ context->getTexGenfv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", coord,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetTexGenivOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateGetTexGenivOES(context, coord, pname, params))
+ {
+ context->getTexGeniv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", coord,
+ pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GetTexGenxvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateGetTexGenxvOES(context, coord, pname, params))
+ {
+ context->getTexGenxv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenfOES(GLenum coord, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", coord, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TexGenfOES, context, coord, pname, param);
+ if (context->skipValidation() || ValidateTexGenfOES(context, coord, pname, param))
+ {
+ context->texGenf(coord, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ coord, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TexGenfvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateTexGenfvOES(context, coord, pname, params))
+ {
+ context->texGenfv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexGeniOES(GLenum coord, GLenum pname, GLint param)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLint param = %d)", coord, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TexGeniOES, context, coord, pname, param);
+ if (context->skipValidation() || ValidateTexGeniOES(context, coord, pname, param))
+ {
+ context->texGeni(coord, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenivOES(GLenum coord, GLenum pname, const GLint *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ coord, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TexGenivOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateTexGenivOES(context, coord, pname, params))
+ {
+ context->texGeniv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenxOES(GLenum coord, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", coord, pname, param);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TexGenxOES, context, coord, pname, param);
+ if (context->skipValidation() || ValidateTexGenxOES(context, coord, pname, param))
+ {
+ context->texGenx(coord, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ coord, pname, (uintptr_t)params);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(TexGenxvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateTexGenxvOES(context, coord, pname, params))
+ {
+ context->texGenxv(coord, pname, params);
+ }
+ }
+}
+
+// GL_OES_texture_storage_multisample_2d_array
+void GL_APIENTRY TexStorage3DMultisampleOES(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLsizei depth = %d, GLboolean fixedsamplelocations = %u)",
+ target, samples, internalformat, width, height, depth, fixedsamplelocations);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage3DMultisampleOES, context, targetPacked, samples, internalformat,
+ width, height, depth, fixedsamplelocations);
+ if (context->skipValidation() ||
+ ValidateTexStorage3DMultisampleOES(context, targetPacked, samples, internalformat,
+ width, height, depth, fixedsamplelocations))
+ {
+ context->texStorage3DMultisample(targetPacked, samples, internalformat, width, height,
+ depth, fixedsamplelocations);
+ }
+ }
+}
+
+// GL_OES_vertex_array_object
+void GL_APIENTRY BindVertexArrayOES(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(BindVertexArrayOES, context, array);
+ if (context->skipValidation() || ValidateBindVertexArrayOES(context, array))
+ {
+ context->bindVertexArray(array);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, const GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(DeleteVertexArraysOES, context, n, arrays);
+ if (context->skipValidation() || ValidateDeleteVertexArraysOES(context, n, arrays))
+ {
+ context->deleteVertexArrays(n, arrays);
+ }
+ }
+}
+
+void GL_APIENTRY GenVertexArraysOES(GLsizei n, GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(GenVertexArraysOES, context, n, arrays);
+ if (context->skipValidation() || ValidateGenVertexArraysOES(context, n, arrays))
+ {
+ context->genVertexArrays(n, arrays);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsVertexArrayOES(GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(IsVertexArrayOES, context, array);
+ if (context->skipValidation() || ValidateIsVertexArrayOES(context, array))
+ {
+ return context->isVertexArray(array);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsVertexArrayOES, GLboolean>();
+}
+
+// GL_OVR_multiview
+void GL_APIENTRY FramebufferTextureMultiviewOVR(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, "
+ "GLint baseViewIndex = %d, GLsizei numViews = %d)",
+ target, attachment, texture, level, baseViewIndex, numViews);
+
+ Context *context = GetValidGlobalContext();
+ if (context)
+ {
+ ANGLE_CAPTURE(FramebufferTextureMultiviewOVR, context, target, attachment, texture, level,
+ baseViewIndex, numViews);
+ if (context->skipValidation() ||
+ ValidateFramebufferTextureMultiviewOVR(context, target, attachment, texture, level,
+ baseViewIndex, numViews))
+ {
+ context->framebufferTextureMultiview(target, attachment, texture, level, baseViewIndex,
+ numViews);
+ }
+ }
+}
+
+// GL_OVR_multiview2
+
+// EGL_ANGLE_explicit_context
+void GL_APIENTRY ActiveShaderProgramContextANGLE(GLeglContext ctx, GLuint pipeline, GLuint program)
+{
+ EVENT("(GLuint pipeline = %u, GLuint program = %u)", pipeline, program);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ActiveShaderProgram, context, pipeline, program);
+ if (context->skipValidation() || ValidateActiveShaderProgram(context, pipeline, program))
+ {
+ context->activeShaderProgram(pipeline, program);
+ }
+ }
+}
+
+void GL_APIENTRY ActiveTextureContextANGLE(GLeglContext ctx, GLenum texture)
+{
+ EVENT("(GLenum texture = 0x%X)", texture);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ActiveTexture, context, texture);
+ if (context->skipValidation() || ValidateActiveTexture(context, texture))
+ {
+ context->activeTexture(texture);
+ }
+ }
+}
+
+void GL_APIENTRY AlphaFuncContextANGLE(GLeglContext ctx, GLenum func, GLfloat ref)
+{
+ EVENT("(GLenum func = 0x%X, GLfloat ref = %f)", func, ref);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ AlphaTestFunc funcPacked = FromGLenum<AlphaTestFunc>(func);
+ ANGLE_CAPTURE(AlphaFunc, context, funcPacked, ref);
+ if (context->skipValidation() || ValidateAlphaFunc(context, funcPacked, ref))
+ {
+ context->alphaFunc(funcPacked, ref);
+ }
+ }
+}
+
+void GL_APIENTRY AlphaFuncxContextANGLE(GLeglContext ctx, GLenum func, GLfixed ref)
+{
+ EVENT("(GLenum func = 0x%X, GLfixed ref = 0x%X)", func, ref);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ AlphaTestFunc funcPacked = FromGLenum<AlphaTestFunc>(func);
+ ANGLE_CAPTURE(AlphaFuncx, context, funcPacked, ref);
+ if (context->skipValidation() || ValidateAlphaFuncx(context, funcPacked, ref))
+ {
+ context->alphaFuncx(funcPacked, ref);
+ }
+ }
+}
+
+void GL_APIENTRY AttachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader)
+{
+ EVENT("(GLuint program = %u, GLuint shader = %u)", program, shader);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(AttachShader, context, program, shader);
+ if (context->skipValidation() || ValidateAttachShader(context, program, shader))
+ {
+ context->attachShader(program, shader);
+ }
+ }
+}
+
+void GL_APIENTRY BeginQueryContextANGLE(GLeglContext ctx, GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(BeginQuery, context, targetPacked, id);
+ if (context->skipValidation() || ValidateBeginQuery(context, targetPacked, id))
+ {
+ context->beginQuery(targetPacked, id);
+ }
+ }
+}
+
+void GL_APIENTRY BeginQueryEXTContextANGLE(GLeglContext ctx, GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(BeginQueryEXT, context, targetPacked, id);
+ if (context->skipValidation() || ValidateBeginQueryEXT(context, targetPacked, id))
+ {
+ context->beginQuery(targetPacked, id);
+ }
+ }
+}
+
+void GL_APIENTRY BeginTransformFeedbackContextANGLE(GLeglContext ctx, GLenum primitiveMode)
+{
+ EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode primitiveModePacked = FromGLenum<PrimitiveMode>(primitiveMode);
+ ANGLE_CAPTURE(BeginTransformFeedback, context, primitiveModePacked);
+ if (context->skipValidation() ||
+ ValidateBeginTransformFeedback(context, primitiveModePacked))
+ {
+ context->beginTransformFeedback(primitiveModePacked);
+ }
+ }
+}
+
+void GL_APIENTRY BindAttribLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ const GLchar *name)
+{
+ EVENT("(GLuint program = %u, GLuint index = %u, const GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindAttribLocation, context, program, index, name);
+ if (context->skipValidation() || ValidateBindAttribLocation(context, program, index, name))
+ {
+ context->bindAttribLocation(program, index, name);
+ }
+ }
+}
+
+void GL_APIENTRY BindBufferContextANGLE(GLeglContext ctx, GLenum target, GLuint buffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint buffer = %u)", target, buffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BindBuffer, context, targetPacked, buffer);
+ if (context->skipValidation() || ValidateBindBuffer(context, targetPacked, buffer))
+ {
+ context->bindBuffer(targetPacked, buffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindBufferBaseContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLuint buffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", target, index, buffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BindBufferBase, context, targetPacked, index, buffer);
+ if (context->skipValidation() ||
+ ValidateBindBufferBase(context, targetPacked, index, buffer))
+ {
+ context->bindBufferBase(targetPacked, index, buffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %llu, "
+ "GLsizeiptr size = %llu)",
+ target, index, buffer, static_cast<unsigned long long>(offset),
+ static_cast<unsigned long long>(size));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BindBufferRange, context, targetPacked, index, buffer, offset, size);
+ if (context->skipValidation() ||
+ ValidateBindBufferRange(context, targetPacked, index, buffer, offset, size))
+ {
+ context->bindBufferRange(targetPacked, index, buffer, offset, size);
+ }
+ }
+}
+
+void GL_APIENTRY BindFragDataLocationEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint color,
+ const GLchar *name)
+{
+ EVENT("(GLuint program = %u, GLuint color = %u, const GLchar *name = 0x%016" PRIxPTR ")",
+ program, color, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindFragDataLocationEXT, context, program, color, name);
+ if (context->skipValidation() ||
+ ValidateBindFragDataLocationEXT(context, program, color, name))
+ {
+ context->bindFragDataLocation(program, color, name);
+ }
+ }
+}
+
+void GL_APIENTRY BindFragDataLocationIndexedEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint colorNumber = %u, GLuint index = %u, const GLchar *name = "
+ "0x%016" PRIxPTR ")",
+ program, colorNumber, index, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindFragDataLocationIndexedEXT, context, program, colorNumber, index, name);
+ if (context->skipValidation() ||
+ ValidateBindFragDataLocationIndexedEXT(context, program, colorNumber, index, name))
+ {
+ context->bindFragDataLocationIndexed(program, colorNumber, index, name);
+ }
+ }
+}
+
+void GL_APIENTRY BindFramebufferContextANGLE(GLeglContext ctx, GLenum target, GLuint framebuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint framebuffer = %u)", target, framebuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindFramebuffer, context, target, framebuffer);
+ if (context->skipValidation() || ValidateBindFramebuffer(context, target, framebuffer))
+ {
+ context->bindFramebuffer(target, framebuffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindFramebufferOESContextANGLE(GLeglContext ctx, GLenum target, GLuint framebuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint framebuffer = %u)", target, framebuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindFramebufferOES, context, target, framebuffer);
+ if (context->skipValidation() || ValidateBindFramebufferOES(context, target, framebuffer))
+ {
+ context->bindFramebuffer(target, framebuffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindImageTextureContextANGLE(GLeglContext ctx,
+ GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format)
+{
+ EVENT(
+ "(GLuint unit = %u, GLuint texture = %u, GLint level = %d, GLboolean layered = %u, GLint "
+ "layer = %d, GLenum access = 0x%X, GLenum format = 0x%X)",
+ unit, texture, level, layered, layer, access, format);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindImageTexture, context, unit, texture, level, layered, layer, access,
+ format);
+ if (context->skipValidation() ||
+ ValidateBindImageTexture(context, unit, texture, level, layered, layer, access, format))
+ {
+ context->bindImageTexture(unit, texture, level, layered, layer, access, format);
+ }
+ }
+}
+
+void GL_APIENTRY BindProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline)
+{
+ EVENT("(GLuint pipeline = %u)", pipeline);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindProgramPipeline, context, pipeline);
+ if (context->skipValidation() || ValidateBindProgramPipeline(context, pipeline))
+ {
+ context->bindProgramPipeline(pipeline);
+ }
+ }
+}
+
+void GL_APIENTRY BindRenderbufferContextANGLE(GLeglContext ctx, GLenum target, GLuint renderbuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %u)", target, renderbuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindRenderbuffer, context, target, renderbuffer);
+ if (context->skipValidation() || ValidateBindRenderbuffer(context, target, renderbuffer))
+ {
+ context->bindRenderbuffer(target, renderbuffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindRenderbufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint renderbuffer)
+{
+ EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %u)", target, renderbuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindRenderbufferOES, context, target, renderbuffer);
+ if (context->skipValidation() || ValidateBindRenderbufferOES(context, target, renderbuffer))
+ {
+ context->bindRenderbuffer(target, renderbuffer);
+ }
+ }
+}
+
+void GL_APIENTRY BindSamplerContextANGLE(GLeglContext ctx, GLuint unit, GLuint sampler)
+{
+ EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindSampler, context, unit, sampler);
+ if (context->skipValidation() || ValidateBindSampler(context, unit, sampler))
+ {
+ context->bindSampler(unit, sampler);
+ }
+ }
+}
+
+void GL_APIENTRY BindTextureContextANGLE(GLeglContext ctx, GLenum target, GLuint texture)
+{
+ EVENT("(GLenum target = 0x%X, GLuint texture = %u)", target, texture);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(BindTexture, context, targetPacked, texture);
+ if (context->skipValidation() || ValidateBindTexture(context, targetPacked, texture))
+ {
+ context->bindTexture(targetPacked, texture);
+ }
+ }
+}
+
+void GL_APIENTRY BindTransformFeedbackContextANGLE(GLeglContext ctx, GLenum target, GLuint id)
+{
+ EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindTransformFeedback, context, target, id);
+ if (context->skipValidation() || ValidateBindTransformFeedback(context, target, id))
+ {
+ context->bindTransformFeedback(target, id);
+ }
+ }
+}
+
+void GL_APIENTRY BindVertexArrayContextANGLE(GLeglContext ctx, GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindVertexArray, context, array);
+ if (context->skipValidation() || ValidateBindVertexArray(context, array))
+ {
+ context->bindVertexArray(array);
+ }
+ }
+}
+
+void GL_APIENTRY BindVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindVertexArrayOES, context, array);
+ if (context->skipValidation() || ValidateBindVertexArrayOES(context, array))
+ {
+ context->bindVertexArray(array);
+ }
+ }
+}
+
+void GL_APIENTRY BindVertexBufferContextANGLE(GLeglContext ctx,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ EVENT(
+ "(GLuint bindingindex = %u, GLuint buffer = %u, GLintptr offset = %llu, GLsizei stride = "
+ "%d)",
+ bindingindex, buffer, static_cast<unsigned long long>(offset), stride);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindVertexBuffer, context, bindingindex, buffer, offset, stride);
+ if (context->skipValidation() ||
+ ValidateBindVertexBuffer(context, bindingindex, buffer, offset, stride))
+ {
+ context->bindVertexBuffer(bindingindex, buffer, offset, stride);
+ }
+ }
+}
+
+void GL_APIENTRY
+BlendColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red,
+ green, blue, alpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BlendColor, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateBlendColor(context, red, green, blue, alpha))
+ {
+ context->blendColor(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY BlendEquationContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BlendEquation, context, mode);
+ if (context->skipValidation() || ValidateBlendEquation(context, mode))
+ {
+ context->blendEquation(mode);
+ }
+ }
+}
+
+void GL_APIENTRY BlendEquationSeparateContextANGLE(GLeglContext ctx,
+ GLenum modeRGB,
+ GLenum modeAlpha)
+{
+ EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BlendEquationSeparate, context, modeRGB, modeAlpha);
+ if (context->skipValidation() || ValidateBlendEquationSeparate(context, modeRGB, modeAlpha))
+ {
+ context->blendEquationSeparate(modeRGB, modeAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY BlendFuncContextANGLE(GLeglContext ctx, GLenum sfactor, GLenum dfactor)
+{
+ EVENT("(GLenum sfactor = 0x%X, GLenum dfactor = 0x%X)", sfactor, dfactor);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BlendFunc, context, sfactor, dfactor);
+ if (context->skipValidation() || ValidateBlendFunc(context, sfactor, dfactor))
+ {
+ context->blendFunc(sfactor, dfactor);
+ }
+ }
+}
+
+void GL_APIENTRY BlendFuncSeparateContextANGLE(GLeglContext ctx,
+ GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha)
+{
+ EVENT(
+ "(GLenum sfactorRGB = 0x%X, GLenum dfactorRGB = 0x%X, GLenum sfactorAlpha = 0x%X, GLenum "
+ "dfactorAlpha = 0x%X)",
+ sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BlendFuncSeparate, context, sfactorRGB, dfactorRGB, sfactorAlpha,
+ dfactorAlpha);
+ if (context->skipValidation() ||
+ ValidateBlendFuncSeparate(context, sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha))
+ {
+ context->blendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY BlitFramebufferContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BlitFramebuffer, context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1,
+ dstY1, mask, filter);
+ if (context->skipValidation() ||
+ ValidateBlitFramebuffer(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
+ mask, filter))
+ {
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
+ filter);
+ }
+ }
+}
+
+void GL_APIENTRY BlitFramebufferANGLEContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BlitFramebufferANGLE, context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
+ dstX1, dstY1, mask, filter);
+ if (context->skipValidation() ||
+ ValidateBlitFramebufferANGLE(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1,
+ dstY1, mask, filter))
+ {
+ context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
+ filter);
+ }
+ }
+}
+
+void GL_APIENTRY BufferDataContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizeiptr size,
+ const void *data,
+ GLenum usage)
+{
+ EVENT("(GLenum target = 0x%X, GLsizeiptr size = %llu, const void *data = 0x%016" PRIxPTR
+ ", GLenum usage = 0x%X)",
+ target, static_cast<unsigned long long>(size), (uintptr_t)data, usage);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ BufferUsage usagePacked = FromGLenum<BufferUsage>(usage);
+ ANGLE_CAPTURE(BufferData, context, targetPacked, size, data, usagePacked);
+ if (context->skipValidation() ||
+ ValidateBufferData(context, targetPacked, size, data, usagePacked))
+ {
+ context->bufferData(targetPacked, size, data, usagePacked);
+ }
+ }
+}
+
+void GL_APIENTRY BufferStorageMemEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizeiptr size = %llu, GLuint memory = %u, GLuint64 offset = "
+ "%llu)",
+ target, static_cast<unsigned long long>(size), memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(BufferStorageMemEXT, context, targetPacked, size, memory, offset);
+ if (context->skipValidation() ||
+ ValidateBufferStorageMemEXT(context, targetPacked, size, memory, offset))
+ {
+ context->bufferStorageMem(targetPacked, size, memory, offset);
+ }
+ }
+}
+
+void GL_APIENTRY BufferSubDataContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr size = %llu, const void *data = "
+ "0x%016" PRIxPTR ")",
+ target, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(size),
+ (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(BufferSubData, context, targetPacked, offset, size, data);
+ if (context->skipValidation() ||
+ ValidateBufferSubData(context, targetPacked, offset, size, data))
+ {
+ context->bufferSubData(targetPacked, offset, size, data);
+ }
+ }
+}
+
+GLenum GL_APIENTRY CheckFramebufferStatusContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CheckFramebufferStatus, context, target);
+ if (context->skipValidation() || ValidateCheckFramebufferStatus(context, target))
+ {
+ return context->checkFramebufferStatus(target);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CheckFramebufferStatus, GLenum>();
+}
+
+GLenum GL_APIENTRY CheckFramebufferStatusOESContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CheckFramebufferStatusOES, context, target);
+ if (context->skipValidation() || ValidateCheckFramebufferStatusOES(context, target))
+ {
+ return context->checkFramebufferStatus(target);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CheckFramebufferStatusOES, GLenum>();
+}
+
+void GL_APIENTRY ClearContextANGLE(GLeglContext ctx, GLbitfield mask)
+{
+ EVENT("(GLbitfield mask = 0x%X)", mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Clear, context, mask);
+ if (context->skipValidation() || ValidateClear(context, mask))
+ {
+ context->clear(mask);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferfiContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth = %f, GLint stencil = %d)",
+ buffer, drawbuffer, depth, stencil);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearBufferfi, context, buffer, drawbuffer, depth, stencil);
+ if (context->skipValidation() ||
+ ValidateClearBufferfi(context, buffer, drawbuffer, depth, stencil))
+ {
+ context->clearBufferfi(buffer, drawbuffer, depth, stencil);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferfvContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ buffer, drawbuffer, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearBufferfv, context, buffer, drawbuffer, value);
+ if (context->skipValidation() || ValidateClearBufferfv(context, buffer, drawbuffer, value))
+ {
+ context->clearBufferfv(buffer, drawbuffer, value);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferivContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ buffer, drawbuffer, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearBufferiv, context, buffer, drawbuffer, value);
+ if (context->skipValidation() || ValidateClearBufferiv(context, buffer, drawbuffer, value))
+ {
+ context->clearBufferiv(buffer, drawbuffer, value);
+ }
+ }
+}
+
+void GL_APIENTRY ClearBufferuivContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value)
+{
+ EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ buffer, drawbuffer, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearBufferuiv, context, buffer, drawbuffer, value);
+ if (context->skipValidation() || ValidateClearBufferuiv(context, buffer, drawbuffer, value))
+ {
+ context->clearBufferuiv(buffer, drawbuffer, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+ClearColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red,
+ green, blue, alpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearColor, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateClearColor(context, red, green, blue, alpha))
+ {
+ context->clearColor(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY
+ClearColorxContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ EVENT("(GLfixed red = 0x%X, GLfixed green = 0x%X, GLfixed blue = 0x%X, GLfixed alpha = 0x%X)",
+ red, green, blue, alpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearColorx, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateClearColorx(context, red, green, blue, alpha))
+ {
+ context->clearColorx(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY ClearDepthfContextANGLE(GLeglContext ctx, GLfloat d)
+{
+ EVENT("(GLfloat d = %f)", d);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearDepthf, context, d);
+ if (context->skipValidation() || ValidateClearDepthf(context, d))
+ {
+ context->clearDepthf(d);
+ }
+ }
+}
+
+void GL_APIENTRY ClearDepthxContextANGLE(GLeglContext ctx, GLfixed depth)
+{
+ EVENT("(GLfixed depth = 0x%X)", depth);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearDepthx, context, depth);
+ if (context->skipValidation() || ValidateClearDepthx(context, depth))
+ {
+ context->clearDepthx(depth);
+ }
+ }
+}
+
+void GL_APIENTRY ClearStencilContextANGLE(GLeglContext ctx, GLint s)
+{
+ EVENT("(GLint s = %d)", s);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClearStencil, context, s);
+ if (context->skipValidation() || ValidateClearStencil(context, s))
+ {
+ context->clearStencil(s);
+ }
+ }
+}
+
+void GL_APIENTRY ClientActiveTextureContextANGLE(GLeglContext ctx, GLenum texture)
+{
+ EVENT("(GLenum texture = 0x%X)", texture);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClientActiveTexture, context, texture);
+ if (context->skipValidation() || ValidateClientActiveTexture(context, texture))
+ {
+ context->clientActiveTexture(texture);
+ }
+ }
+}
+
+GLenum GL_APIENTRY ClientWaitSyncContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ", GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClientWaitSync, context, sync, flags, timeout);
+ if (context->skipValidation() || ValidateClientWaitSync(context, sync, flags, timeout))
+ {
+ return context->clientWaitSync(sync, flags, timeout);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::ClientWaitSync, GLenum>();
+}
+
+void GL_APIENTRY ClipPlanefContextANGLE(GLeglContext ctx, GLenum p, const GLfloat *eqn)
+{
+ EVENT("(GLenum p = 0x%X, const GLfloat *eqn = 0x%016" PRIxPTR ")", p, (uintptr_t)eqn);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClipPlanef, context, p, eqn);
+ if (context->skipValidation() || ValidateClipPlanef(context, p, eqn))
+ {
+ context->clipPlanef(p, eqn);
+ }
+ }
+}
+
+void GL_APIENTRY ClipPlanexContextANGLE(GLeglContext ctx, GLenum plane, const GLfixed *equation)
+{
+ EVENT("(GLenum plane = 0x%X, const GLfixed *equation = 0x%016" PRIxPTR ")", plane,
+ (uintptr_t)equation);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ClipPlanex, context, plane, equation);
+ if (context->skipValidation() || ValidateClipPlanex(context, plane, equation))
+ {
+ context->clipPlanex(plane, equation);
+ }
+ }
+}
+
+void GL_APIENTRY
+Color4fContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red,
+ green, blue, alpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Color4f, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColor4f(context, red, green, blue, alpha))
+ {
+ context->color4f(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY
+Color4ubContextANGLE(GLeglContext ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ EVENT("(GLubyte red = %d, GLubyte green = %d, GLubyte blue = %d, GLubyte alpha = %d)", red,
+ green, blue, alpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Color4ub, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColor4ub(context, red, green, blue, alpha))
+ {
+ context->color4ub(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY
+Color4xContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ EVENT("(GLfixed red = 0x%X, GLfixed green = 0x%X, GLfixed blue = 0x%X, GLfixed alpha = 0x%X)",
+ red, green, blue, alpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Color4x, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColor4x(context, red, green, blue, alpha))
+ {
+ context->color4x(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY ColorMaskContextANGLE(GLeglContext ctx,
+ GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha)
+{
+ EVENT("(GLboolean red = %u, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)",
+ red, green, blue, alpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ColorMask, context, red, green, blue, alpha);
+ if (context->skipValidation() || ValidateColorMask(context, red, green, blue, alpha))
+ {
+ context->colorMask(red, green, blue, alpha);
+ }
+ }
+}
+
+void GL_APIENTRY ColorPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(ColorPointer, context, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateColorPointer(context, size, typePacked, stride, pointer))
+ {
+ context->colorPointer(size, typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY CompileShaderContextANGLE(GLeglContext ctx, GLuint shader)
+{
+ EVENT("(GLuint shader = %u)", shader);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CompileShader, context, shader);
+ if (context->skipValidation() || ValidateCompileShader(context, shader))
+ {
+ context->compileShader(shader);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const void *data = "
+ "0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, imageSize, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage2D, context, targetPacked, level, internalformat, width,
+ height, border, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexImage2D(context, targetPacked, level, internalformat, width,
+ height, border, imageSize, data))
+ {
+ context->compressedTexImage2D(targetPacked, level, internalformat, width, height,
+ border, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, imageSize, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage3D, context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexImage3D(context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data))
+ {
+ context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
+ border, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, imageSize, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage3DOES, context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexImage3DOES(context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, data))
+ {
+ context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth,
+ border, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei "
+ "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLsizei imageSize = %d, const void "
+ "*data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, imageSize, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage2D, context, targetPacked, level, xoffset, yoffset,
+ width, height, format, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage2D(context, targetPacked, level, xoffset, yoffset, width,
+ height, format, imageSize, data))
+ {
+ context->compressedTexSubImage2D(targetPacked, level, xoffset, yoffset, width, height,
+ format, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize,
+ (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage3D, context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, imageSize, data))
+ {
+ context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *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 void *data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize,
+ (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage3DOES, context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, imageSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage3DOES(context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, imageSize,
+ data))
+ {
+ context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, imageSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CopyBufferSubDataContextANGLE(GLeglContext ctx,
+ GLenum readTarget,
+ GLenum writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ EVENT(
+ "(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %llu, "
+ "GLintptr writeOffset = %llu, GLsizeiptr size = %llu)",
+ readTarget, writeTarget, static_cast<unsigned long long>(readOffset),
+ static_cast<unsigned long long>(writeOffset), static_cast<unsigned long long>(size));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding readTargetPacked = FromGLenum<BufferBinding>(readTarget);
+ BufferBinding writeTargetPacked = FromGLenum<BufferBinding>(writeTarget);
+ ANGLE_CAPTURE(CopyBufferSubData, context, readTargetPacked, writeTargetPacked, readOffset,
+ writeOffset, size);
+ if (context->skipValidation() ||
+ ValidateCopyBufferSubData(context, readTargetPacked, writeTargetPacked, readOffset,
+ writeOffset, size))
+ {
+ context->copyBufferSubData(readTargetPacked, writeTargetPacked, readOffset, writeOffset,
+ size);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLint x = %d, "
+ "GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)",
+ target, level, internalformat, x, y, width, height, border);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexImage2D, context, targetPacked, level, internalformat, x, y, width,
+ height, border);
+ if (context->skipValidation() ||
+ ValidateCopyTexImage2D(context, targetPacked, level, internalformat, x, y, width,
+ height, border))
+ {
+ context->copyTexImage2D(targetPacked, level, internalformat, x, y, width, height,
+ border);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLint x "
+ "= %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, level, xoffset, yoffset, x, y, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexSubImage2D, context, targetPacked, level, xoffset, yoffset, x, y,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateCopyTexSubImage2D(context, targetPacked, level, xoffset, yoffset, x, y, width,
+ height))
+ {
+ context->copyTexSubImage2D(targetPacked, level, xoffset, yoffset, x, y, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexSubImage3DContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexSubImage3D, context, targetPacked, level, xoffset, yoffset, zoffset, x,
+ y, width, height);
+ if (context->skipValidation() ||
+ ValidateCopyTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, x, y,
+ width, height))
+ {
+ context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
+ height);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexSubImage3DOESContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CopyTexSubImage3DOES, context, targetPacked, level, xoffset, yoffset, zoffset,
+ x, y, width, height);
+ if (context->skipValidation() ||
+ ValidateCopyTexSubImage3DOES(context, targetPacked, level, xoffset, yoffset, zoffset, x,
+ y, width, height))
+ {
+ context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width,
+ height);
+ }
+ }
+}
+
+void GL_APIENTRY CreateMemoryObjectsEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *memoryObjects)
+{
+ EVENT("(GLsizei n = %d, GLuint *memoryObjects = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)memoryObjects);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CreateMemoryObjectsEXT, context, n, memoryObjects);
+ if (context->skipValidation() || ValidateCreateMemoryObjectsEXT(context, n, memoryObjects))
+ {
+ context->createMemoryObjects(n, memoryObjects);
+ }
+ }
+}
+
+GLuint GL_APIENTRY CreateProgramContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CreateProgram, context);
+ if (context->skipValidation() || ValidateCreateProgram(context))
+ {
+ return context->createProgram();
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CreateProgram, GLuint>();
+}
+
+GLuint GL_APIENTRY CreateShaderContextANGLE(GLeglContext ctx, GLenum type)
+{
+ EVENT("(GLenum type = 0x%X)", type);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ShaderType typePacked = FromGLenum<ShaderType>(type);
+ ANGLE_CAPTURE(CreateShader, context, typePacked);
+ if (context->skipValidation() || ValidateCreateShader(context, typePacked))
+ {
+ return context->createShader(typePacked);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CreateShader, GLuint>();
+}
+
+GLuint GL_APIENTRY CreateShaderProgramvContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei count,
+ const GLchar *const *strings)
+{
+ EVENT("(GLenum type = 0x%X, GLsizei count = %d, const GLchar *const*strings = 0x%016" PRIxPTR
+ ")",
+ type, count, (uintptr_t)strings);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ShaderType typePacked = FromGLenum<ShaderType>(type);
+ ANGLE_CAPTURE(CreateShaderProgramv, context, typePacked, count, strings);
+ if (context->skipValidation() ||
+ ValidateCreateShaderProgramv(context, typePacked, count, strings))
+ {
+ return context->createShaderProgramv(typePacked, count, strings);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::CreateShaderProgramv, GLuint>();
+}
+
+void GL_APIENTRY CullFaceContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ CullFaceMode modePacked = FromGLenum<CullFaceMode>(mode);
+ ANGLE_CAPTURE(CullFace, context, modePacked);
+ if (context->skipValidation() || ValidateCullFace(context, modePacked))
+ {
+ context->cullFace(modePacked);
+ }
+ }
+}
+
+void GL_APIENTRY CurrentPaletteMatrixOESContextANGLE(GLeglContext ctx, GLuint matrixpaletteindex)
+{
+ EVENT("(GLuint matrixpaletteindex = %u)", matrixpaletteindex);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CurrentPaletteMatrixOES, context, matrixpaletteindex);
+ if (context->skipValidation() ||
+ ValidateCurrentPaletteMatrixOES(context, matrixpaletteindex))
+ {
+ context->currentPaletteMatrix(matrixpaletteindex);
+ }
+ }
+}
+
+void GL_APIENTRY DebugMessageCallbackKHRContextANGLE(GLeglContext ctx,
+ GLDEBUGPROCKHR callback,
+ const void *userParam)
+{
+ EVENT("(GLDEBUGPROCKHR callback = 0x%016" PRIxPTR ", const void *userParam = 0x%016" PRIxPTR
+ ")",
+ (uintptr_t)callback, (uintptr_t)userParam);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DebugMessageCallbackKHR, context, callback, userParam);
+ if (context->skipValidation() ||
+ ValidateDebugMessageCallbackKHR(context, callback, userParam))
+ {
+ context->debugMessageCallback(callback, userParam);
+ }
+ }
+}
+
+void GL_APIENTRY DebugMessageControlKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled)
+{
+ EVENT(
+ "(GLenum source = 0x%X, GLenum type = 0x%X, GLenum severity = 0x%X, GLsizei count = %d, "
+ "const GLuint *ids = 0x%016" PRIxPTR ", GLboolean enabled = %u)",
+ source, type, severity, count, (uintptr_t)ids, enabled);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DebugMessageControlKHR, context, source, type, severity, count, ids, enabled);
+ if (context->skipValidation() ||
+ ValidateDebugMessageControlKHR(context, source, type, severity, count, ids, enabled))
+ {
+ context->debugMessageControl(source, type, severity, count, ids, enabled);
+ }
+ }
+}
+
+void GL_APIENTRY DebugMessageInsertKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf)
+{
+ EVENT(
+ "(GLenum source = 0x%X, GLenum type = 0x%X, GLuint id = %u, GLenum severity = 0x%X, "
+ "GLsizei length = %d, const GLchar *buf = 0x%016" PRIxPTR ")",
+ source, type, id, severity, length, (uintptr_t)buf);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DebugMessageInsertKHR, context, source, type, id, severity, length, buf);
+ if (context->skipValidation() ||
+ ValidateDebugMessageInsertKHR(context, source, type, id, severity, length, buf))
+ {
+ context->debugMessageInsert(source, type, id, severity, length, buf);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *buffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *buffers = 0x%016" PRIxPTR ")", n, (uintptr_t)buffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteBuffers, context, n, buffers);
+ if (context->skipValidation() || ValidateDeleteBuffers(context, n, buffers))
+ {
+ context->deleteBuffers(n, buffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteFencesNVContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *fences)
+{
+ EVENT("(GLsizei n = %d, const GLuint *fences = 0x%016" PRIxPTR ")", n, (uintptr_t)fences);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteFencesNV, context, n, fences);
+ if (context->skipValidation() || ValidateDeleteFencesNV(context, n, fences))
+ {
+ context->deleteFencesNV(n, fences);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteFramebuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *framebuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)framebuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteFramebuffers, context, n, framebuffers);
+ if (context->skipValidation() || ValidateDeleteFramebuffers(context, n, framebuffers))
+ {
+ context->deleteFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteFramebuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *framebuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)framebuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteFramebuffersOES, context, n, framebuffers);
+ if (context->skipValidation() || ValidateDeleteFramebuffersOES(context, n, framebuffers))
+ {
+ context->deleteFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteMemoryObjectsEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *memoryObjects)
+{
+ EVENT("(GLsizei n = %d, const GLuint *memoryObjects = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)memoryObjects);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteMemoryObjectsEXT, context, n, memoryObjects);
+ if (context->skipValidation() || ValidateDeleteMemoryObjectsEXT(context, n, memoryObjects))
+ {
+ context->deleteMemoryObjects(n, memoryObjects);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteProgram, context, program);
+ if (context->skipValidation() || ValidateDeleteProgram(context, program))
+ {
+ context->deleteProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteProgramPipelinesContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *pipelines)
+{
+ EVENT("(GLsizei n = %d, const GLuint *pipelines = 0x%016" PRIxPTR ")", n, (uintptr_t)pipelines);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteProgramPipelines, context, n, pipelines);
+ if (context->skipValidation() || ValidateDeleteProgramPipelines(context, n, pipelines))
+ {
+ context->deleteProgramPipelines(n, pipelines);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteQueriesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteQueries, context, n, ids);
+ if (context->skipValidation() || ValidateDeleteQueries(context, n, ids))
+ {
+ context->deleteQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteQueriesEXT, context, n, ids);
+ if (context->skipValidation() || ValidateDeleteQueriesEXT(context, n, ids))
+ {
+ context->deleteQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteRenderbuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteRenderbuffers, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateDeleteRenderbuffers(context, n, renderbuffers))
+ {
+ context->deleteRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteRenderbuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, const GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteRenderbuffersOES, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateDeleteRenderbuffersOES(context, n, renderbuffers))
+ {
+ context->deleteRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteSamplersContextANGLE(GLeglContext ctx, GLsizei count, const GLuint *samplers)
+{
+ EVENT("(GLsizei count = %d, const GLuint *samplers = 0x%016" PRIxPTR ")", count,
+ (uintptr_t)samplers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteSamplers, context, count, samplers);
+ if (context->skipValidation() || ValidateDeleteSamplers(context, count, samplers))
+ {
+ context->deleteSamplers(count, samplers);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteSemaphoresEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *semaphores)
+{
+ EVENT("(GLsizei n = %d, const GLuint *semaphores = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)semaphores);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteSemaphoresEXT, context, n, semaphores);
+ if (context->skipValidation() || ValidateDeleteSemaphoresEXT(context, n, semaphores))
+ {
+ context->deleteSemaphores(n, semaphores);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteShaderContextANGLE(GLeglContext ctx, GLuint shader)
+{
+ EVENT("(GLuint shader = %u)", shader);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteShader, context, shader);
+ if (context->skipValidation() || ValidateDeleteShader(context, shader))
+ {
+ context->deleteShader(shader);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteSyncContextANGLE(GLeglContext ctx, GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ")", (uintptr_t)sync);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteSync, context, sync);
+ if (context->skipValidation() || ValidateDeleteSync(context, sync))
+ {
+ context->deleteSync(sync);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteTexturesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *textures)
+{
+ EVENT("(GLsizei n = %d, const GLuint *textures = 0x%016" PRIxPTR ")", n, (uintptr_t)textures);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteTextures, context, n, textures);
+ if (context->skipValidation() || ValidateDeleteTextures(context, n, textures))
+ {
+ context->deleteTextures(n, textures);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteTransformFeedbacksContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, const GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteTransformFeedbacks, context, n, ids);
+ if (context->skipValidation() || ValidateDeleteTransformFeedbacks(context, n, ids))
+ {
+ context->deleteTransformFeedbacks(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteVertexArraysContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, const GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteVertexArrays, context, n, arrays);
+ if (context->skipValidation() || ValidateDeleteVertexArrays(context, n, arrays))
+ {
+ context->deleteVertexArrays(n, arrays);
+ }
+ }
+}
+
+void GL_APIENTRY DeleteVertexArraysOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, const GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeleteVertexArraysOES, context, n, arrays);
+ if (context->skipValidation() || ValidateDeleteVertexArraysOES(context, n, arrays))
+ {
+ context->deleteVertexArrays(n, arrays);
+ }
+ }
+}
+
+void GL_APIENTRY DepthFuncContextANGLE(GLeglContext ctx, GLenum func)
+{
+ EVENT("(GLenum func = 0x%X)", func);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DepthFunc, context, func);
+ if (context->skipValidation() || ValidateDepthFunc(context, func))
+ {
+ context->depthFunc(func);
+ }
+ }
+}
+
+void GL_APIENTRY DepthMaskContextANGLE(GLeglContext ctx, GLboolean flag)
+{
+ EVENT("(GLboolean flag = %u)", flag);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DepthMask, context, flag);
+ if (context->skipValidation() || ValidateDepthMask(context, flag))
+ {
+ context->depthMask(flag);
+ }
+ }
+}
+
+void GL_APIENTRY DepthRangefContextANGLE(GLeglContext ctx, GLfloat n, GLfloat f)
+{
+ EVENT("(GLfloat n = %f, GLfloat f = %f)", n, f);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DepthRangef, context, n, f);
+ if (context->skipValidation() || ValidateDepthRangef(context, n, f))
+ {
+ context->depthRangef(n, f);
+ }
+ }
+}
+
+void GL_APIENTRY DepthRangexContextANGLE(GLeglContext ctx, GLfixed n, GLfixed f)
+{
+ EVENT("(GLfixed n = 0x%X, GLfixed f = 0x%X)", n, f);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DepthRangex, context, n, f);
+ if (context->skipValidation() || ValidateDepthRangex(context, n, f))
+ {
+ context->depthRangex(n, f);
+ }
+ }
+}
+
+void GL_APIENTRY DetachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader)
+{
+ EVENT("(GLuint program = %u, GLuint shader = %u)", program, shader);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DetachShader, context, program, shader);
+ if (context->skipValidation() || ValidateDetachShader(context, program, shader))
+ {
+ context->detachShader(program, shader);
+ }
+ }
+}
+
+void GL_APIENTRY DisableContextANGLE(GLeglContext ctx, GLenum cap)
+{
+ EVENT("(GLenum cap = 0x%X)", cap);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Disable, context, cap);
+ if (context->skipValidation() || ValidateDisable(context, cap))
+ {
+ context->disable(cap);
+ }
+ }
+}
+
+void GL_APIENTRY DisableClientStateContextANGLE(GLeglContext ctx, GLenum array)
+{
+ EVENT("(GLenum array = 0x%X)", array);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ClientVertexArrayType arrayPacked = FromGLenum<ClientVertexArrayType>(array);
+ ANGLE_CAPTURE(DisableClientState, context, arrayPacked);
+ if (context->skipValidation() || ValidateDisableClientState(context, arrayPacked))
+ {
+ context->disableClientState(arrayPacked);
+ }
+ }
+}
+
+void GL_APIENTRY DisableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index)
+{
+ EVENT("(GLuint index = %u)", index);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DisableVertexAttribArray, context, index);
+ if (context->skipValidation() || ValidateDisableVertexAttribArray(context, index))
+ {
+ context->disableVertexAttribArray(index);
+ }
+ }
+}
+
+void GL_APIENTRY DiscardFramebufferEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = "
+ "0x%016" PRIxPTR ")",
+ target, numAttachments, (uintptr_t)attachments);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DiscardFramebufferEXT, context, target, numAttachments, attachments);
+ if (context->skipValidation() ||
+ ValidateDiscardFramebufferEXT(context, target, numAttachments, attachments))
+ {
+ context->discardFramebuffer(target, numAttachments, attachments);
+ }
+ }
+}
+
+void GL_APIENTRY DispatchComputeContextANGLE(GLeglContext ctx,
+ GLuint num_groups_x,
+ GLuint num_groups_y,
+ GLuint num_groups_z)
+{
+ EVENT("(GLuint num_groups_x = %u, GLuint num_groups_y = %u, GLuint num_groups_z = %u)",
+ num_groups_x, num_groups_y, num_groups_z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DispatchCompute, context, num_groups_x, num_groups_y, num_groups_z);
+ if (context->skipValidation() ||
+ ValidateDispatchCompute(context, num_groups_x, num_groups_y, num_groups_z))
+ {
+ context->dispatchCompute(num_groups_x, num_groups_y, num_groups_z);
+ }
+ }
+}
+
+void GL_APIENTRY DispatchComputeIndirectContextANGLE(GLeglContext ctx, GLintptr indirect)
+{
+ EVENT("(GLintptr indirect = %llu)", static_cast<unsigned long long>(indirect));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DispatchComputeIndirect, context, indirect);
+ if (context->skipValidation() || ValidateDispatchComputeIndirect(context, indirect))
+ {
+ context->dispatchComputeIndirect(indirect);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArraysContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count)
+{
+ EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArrays, context, modePacked, first, count);
+ if (context->skipValidation() || ValidateDrawArrays(context, modePacked, first, count))
+ {
+ context->drawArrays(modePacked, first, count);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArraysIndirectContextANGLE(GLeglContext ctx, GLenum mode, const void *indirect)
+{
+ EVENT("(GLenum mode = 0x%X, const void *indirect = 0x%016" PRIxPTR ")", mode,
+ (uintptr_t)indirect);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysIndirect, context, modePacked, indirect);
+ if (context->skipValidation() || ValidateDrawArraysIndirect(context, modePacked, indirect))
+ {
+ context->drawArraysIndirect(modePacked, indirect);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArraysInstancedContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysInstanced, context, modePacked, first, count, instancecount);
+ if (context->skipValidation() ||
+ ValidateDrawArraysInstanced(context, modePacked, first, count, instancecount))
+ {
+ context->drawArraysInstanced(modePacked, first, count, instancecount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)",
+ mode, first, count, primcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysInstancedANGLE, context, modePacked, first, count, primcount);
+ if (context->skipValidation() ||
+ ValidateDrawArraysInstancedANGLE(context, modePacked, first, count, primcount))
+ {
+ context->drawArraysInstanced(modePacked, first, count, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawArraysInstancedEXTContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint start,
+ GLsizei count,
+ GLsizei primcount)
+{
+ EVENT("(GLenum mode = 0x%X, GLint start = %d, GLsizei count = %d, GLsizei primcount = %d)",
+ mode, start, count, primcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(DrawArraysInstancedEXT, context, modePacked, start, count, primcount);
+ if (context->skipValidation() ||
+ ValidateDrawArraysInstancedEXT(context, modePacked, start, count, primcount))
+ {
+ context->drawArraysInstanced(modePacked, start, count, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs)
+{
+ EVENT("(GLsizei n = %d, const GLenum *bufs = 0x%016" PRIxPTR ")", n, (uintptr_t)bufs);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawBuffers, context, n, bufs);
+ if (context->skipValidation() || ValidateDrawBuffers(context, n, bufs))
+ {
+ context->drawBuffers(n, bufs);
+ }
+ }
+}
+
+void GL_APIENTRY DrawBuffersEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs)
+{
+ EVENT("(GLsizei n = %d, const GLenum *bufs = 0x%016" PRIxPTR ")", n, (uintptr_t)bufs);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawBuffersEXT, context, n, bufs);
+ if (context->skipValidation() || ValidateDrawBuffersEXT(context, n, bufs))
+ {
+ context->drawBuffers(n, bufs);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ")",
+ mode, count, type, (uintptr_t)indices);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElements, context, modePacked, count, typePacked, indices);
+ if (context->skipValidation() ||
+ ValidateDrawElements(context, modePacked, count, typePacked, indices))
+ {
+ context->drawElements(modePacked, count, typePacked, indices);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsIndirectContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLenum type,
+ const void *indirect)
+{
+ EVENT("(GLenum mode = 0x%X, GLenum type = 0x%X, const void *indirect = 0x%016" PRIxPTR ")",
+ mode, type, (uintptr_t)indirect);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsIndirect, context, modePacked, typePacked, indirect);
+ if (context->skipValidation() ||
+ ValidateDrawElementsIndirect(context, modePacked, typePacked, indirect))
+ {
+ context->drawElementsIndirect(modePacked, typePacked, indirect);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsInstancedContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ", GLsizei instancecount = %d)",
+ mode, count, type, (uintptr_t)indices, instancecount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsInstanced, context, modePacked, count, typePacked, indices,
+ instancecount);
+ if (context->skipValidation() ||
+ ValidateDrawElementsInstanced(context, modePacked, count, typePacked, indices,
+ instancecount))
+ {
+ context->drawElementsInstanced(modePacked, count, typePacked, indices, instancecount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ", GLsizei primcount = %d)",
+ mode, count, type, (uintptr_t)indices, primcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsInstancedANGLE, context, modePacked, count, typePacked, indices,
+ primcount);
+ if (context->skipValidation() ||
+ ValidateDrawElementsInstancedANGLE(context, modePacked, count, typePacked, indices,
+ primcount))
+ {
+ context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawElementsInstancedEXTContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = "
+ "0x%016" PRIxPTR ", GLsizei primcount = %d)",
+ mode, count, type, (uintptr_t)indices, primcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawElementsInstancedEXT, context, modePacked, count, typePacked, indices,
+ primcount);
+ if (context->skipValidation() ||
+ ValidateDrawElementsInstancedEXT(context, modePacked, count, typePacked, indices,
+ primcount))
+ {
+ context->drawElementsInstanced(modePacked, count, typePacked, indices, primcount);
+ }
+ }
+}
+
+void GL_APIENTRY DrawRangeElementsContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices)
+{
+ EVENT(
+ "(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type "
+ "= 0x%X, const void *indices = 0x%016" PRIxPTR ")",
+ mode, start, end, count, type, (uintptr_t)indices);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(DrawRangeElements, context, modePacked, start, end, count, typePacked,
+ indices);
+ if (context->skipValidation() ||
+ ValidateDrawRangeElements(context, modePacked, start, end, count, typePacked, indices))
+ {
+ context->drawRangeElements(modePacked, start, end, count, typePacked, indices);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexfOESContextANGLE(GLeglContext ctx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat width,
+ GLfloat height)
+{
+ EVENT(
+ "(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat width = %f, GLfloat height = %f)",
+ x, y, z, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexfOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexfOES(context, x, y, z, width, height))
+ {
+ context->drawTexf(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexfvOESContextANGLE(GLeglContext ctx, const GLfloat *coords)
+{
+ EVENT("(const GLfloat *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexfvOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexfvOES(context, coords))
+ {
+ context->drawTexfv(coords);
+ }
+ }
+}
+
+void GL_APIENTRY
+DrawTexiOESContextANGLE(GLeglContext ctx, GLint x, GLint y, GLint z, GLint width, GLint height)
+{
+ EVENT("(GLint x = %d, GLint y = %d, GLint z = %d, GLint width = %d, GLint height = %d)", x, y,
+ z, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexiOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexiOES(context, x, y, z, width, height))
+ {
+ context->drawTexi(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexivOESContextANGLE(GLeglContext ctx, const GLint *coords)
+{
+ EVENT("(const GLint *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexivOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexivOES(context, coords))
+ {
+ context->drawTexiv(coords);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexsOESContextANGLE(GLeglContext ctx,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort width,
+ GLshort height)
+{
+ EVENT(
+ "(GLshort x = %d, GLshort y = %d, GLshort z = %d, GLshort width = %d, GLshort height = %d)",
+ x, y, z, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexsOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexsOES(context, x, y, z, width, height))
+ {
+ context->drawTexs(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexsvOESContextANGLE(GLeglContext ctx, const GLshort *coords)
+{
+ EVENT("(const GLshort *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexsvOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexsvOES(context, coords))
+ {
+ context->drawTexsv(coords);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexxOESContextANGLE(GLeglContext ctx,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z,
+ GLfixed width,
+ GLfixed height)
+{
+ EVENT(
+ "(GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X, GLfixed width = 0x%X, GLfixed "
+ "height = 0x%X)",
+ x, y, z, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexxOES, context, x, y, z, width, height);
+ if (context->skipValidation() || ValidateDrawTexxOES(context, x, y, z, width, height))
+ {
+ context->drawTexx(x, y, z, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY DrawTexxvOESContextANGLE(GLeglContext ctx, const GLfixed *coords)
+{
+ EVENT("(const GLfixed *coords = 0x%016" PRIxPTR ")", (uintptr_t)coords);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DrawTexxvOES, context, coords);
+ if (context->skipValidation() || ValidateDrawTexxvOES(context, coords))
+ {
+ context->drawTexxv(coords);
+ }
+ }
+}
+
+void GL_APIENTRY EGLImageTargetRenderbufferStorageOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLeglImageOES image)
+{
+ EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%016" PRIxPTR ")", target,
+ (uintptr_t)image);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(EGLImageTargetRenderbufferStorageOES, context, target, image);
+ if (context->skipValidation() ||
+ ValidateEGLImageTargetRenderbufferStorageOES(context, target, image))
+ {
+ context->eGLImageTargetRenderbufferStorage(target, image);
+ }
+ }
+}
+
+void GL_APIENTRY EGLImageTargetTexture2DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLeglImageOES image)
+{
+ EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%016" PRIxPTR ")", target,
+ (uintptr_t)image);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(EGLImageTargetTexture2DOES, context, targetPacked, image);
+ if (context->skipValidation() ||
+ ValidateEGLImageTargetTexture2DOES(context, targetPacked, image))
+ {
+ context->eGLImageTargetTexture2D(targetPacked, image);
+ }
+ }
+}
+
+void GL_APIENTRY EnableContextANGLE(GLeglContext ctx, GLenum cap)
+{
+ EVENT("(GLenum cap = 0x%X)", cap);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Enable, context, cap);
+ if (context->skipValidation() || ValidateEnable(context, cap))
+ {
+ context->enable(cap);
+ }
+ }
+}
+
+void GL_APIENTRY EnableClientStateContextANGLE(GLeglContext ctx, GLenum array)
+{
+ EVENT("(GLenum array = 0x%X)", array);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ClientVertexArrayType arrayPacked = FromGLenum<ClientVertexArrayType>(array);
+ ANGLE_CAPTURE(EnableClientState, context, arrayPacked);
+ if (context->skipValidation() || ValidateEnableClientState(context, arrayPacked))
+ {
+ context->enableClientState(arrayPacked);
+ }
+ }
+}
+
+void GL_APIENTRY EnableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index)
+{
+ EVENT("(GLuint index = %u)", index);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(EnableVertexAttribArray, context, index);
+ if (context->skipValidation() || ValidateEnableVertexAttribArray(context, index))
+ {
+ context->enableVertexAttribArray(index);
+ }
+ }
+}
+
+void GL_APIENTRY EndQueryContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(EndQuery, context, targetPacked);
+ if (context->skipValidation() || ValidateEndQuery(context, targetPacked))
+ {
+ context->endQuery(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY EndQueryEXTContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(EndQueryEXT, context, targetPacked);
+ if (context->skipValidation() || ValidateEndQueryEXT(context, targetPacked))
+ {
+ context->endQuery(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY EndTransformFeedbackContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(EndTransformFeedback, context);
+ if (context->skipValidation() || ValidateEndTransformFeedback(context))
+ {
+ context->endTransformFeedback();
+ }
+ }
+}
+
+GLsync GL_APIENTRY FenceSyncContextANGLE(GLeglContext ctx, GLenum condition, GLbitfield flags)
+{
+ EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FenceSync, context, condition, flags);
+ if (context->skipValidation() || ValidateFenceSync(context, condition, flags))
+ {
+ return context->fenceSync(condition, flags);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::FenceSync, GLsync>();
+}
+
+void GL_APIENTRY FinishContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Finish, context);
+ if (context->skipValidation() || ValidateFinish(context))
+ {
+ context->finish();
+ }
+ }
+}
+
+void GL_APIENTRY FinishFenceNVContextANGLE(GLeglContext ctx, GLuint fence)
+{
+ EVENT("(GLuint fence = %u)", fence);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FinishFenceNV, context, fence);
+ if (context->skipValidation() || ValidateFinishFenceNV(context, fence))
+ {
+ context->finishFenceNV(fence);
+ }
+ }
+}
+
+void GL_APIENTRY FlushContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Flush, context);
+ if (context->skipValidation() || ValidateFlush(context))
+ {
+ context->flush();
+ }
+ }
+}
+
+void GL_APIENTRY FlushMappedBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu)", target,
+ static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(FlushMappedBufferRange, context, targetPacked, offset, length);
+ if (context->skipValidation() ||
+ ValidateFlushMappedBufferRange(context, targetPacked, offset, length))
+ {
+ context->flushMappedBufferRange(targetPacked, offset, length);
+ }
+ }
+}
+
+void GL_APIENTRY FlushMappedBufferRangeEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ EVENT("(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu)", target,
+ static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(FlushMappedBufferRangeEXT, context, targetPacked, offset, length);
+ if (context->skipValidation() ||
+ ValidateFlushMappedBufferRangeEXT(context, targetPacked, offset, length))
+ {
+ context->flushMappedBufferRange(targetPacked, offset, length);
+ }
+ }
+}
+
+void GL_APIENTRY FogfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Fogf, context, pname, param);
+ if (context->skipValidation() || ValidateFogf(context, pname, param))
+ {
+ context->fogf(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY FogfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Fogfv, context, pname, params);
+ if (context->skipValidation() || ValidateFogfv(context, pname, params))
+ {
+ context->fogfv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY FogxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed param = 0x%X)", pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Fogx, context, pname, param);
+ if (context->skipValidation() || ValidateFogx(context, pname, param))
+ {
+ context->fogx(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY FogxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *param)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfixed *param = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Fogxv, context, pname, param);
+ if (context->skipValidation() || ValidateFogxv(context, pname, param))
+ {
+ context->fogxv(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferParameteriContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FramebufferParameteri, context, target, pname, param);
+ if (context->skipValidation() ||
+ ValidateFramebufferParameteri(context, target, pname, param))
+ {
+ context->framebufferParameteri(target, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferRenderbufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, GLuint "
+ "renderbuffer = %u)",
+ target, attachment, renderbuffertarget, renderbuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FramebufferRenderbuffer, context, target, attachment, renderbuffertarget,
+ renderbuffer);
+ if (context->skipValidation() ||
+ ValidateFramebufferRenderbuffer(context, target, attachment, renderbuffertarget,
+ renderbuffer))
+ {
+ context->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferRenderbufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, GLuint "
+ "renderbuffer = %u)",
+ target, attachment, renderbuffertarget, renderbuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FramebufferRenderbufferOES, context, target, attachment, renderbuffertarget,
+ renderbuffer);
+ if (context->skipValidation() ||
+ ValidateFramebufferRenderbufferOES(context, target, attachment, renderbuffertarget,
+ renderbuffer))
+ {
+ context->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTexture2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, GLuint texture "
+ "= %u, GLint level = %d)",
+ target, attachment, textarget, texture, level);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget textargetPacked = FromGLenum<TextureTarget>(textarget);
+ ANGLE_CAPTURE(FramebufferTexture2D, context, target, attachment, textargetPacked, texture,
+ level);
+ if (context->skipValidation() ||
+ ValidateFramebufferTexture2D(context, target, attachment, textargetPacked, texture,
+ level))
+ {
+ context->framebufferTexture2D(target, attachment, textargetPacked, texture, level);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTexture2DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, GLuint texture "
+ "= %u, GLint level = %d)",
+ target, attachment, textarget, texture, level);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget textargetPacked = FromGLenum<TextureTarget>(textarget);
+ ANGLE_CAPTURE(FramebufferTexture2DOES, context, target, attachment, textargetPacked,
+ texture, level);
+ if (context->skipValidation() ||
+ ValidateFramebufferTexture2DOES(context, target, attachment, textargetPacked, texture,
+ level))
+ {
+ context->framebufferTexture2D(target, attachment, textargetPacked, texture, level);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTexture3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, GLuint texture "
+ "= %u, GLint level = %d, GLint zoffset = %d)",
+ target, attachment, textarget, texture, level, zoffset);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget textargetPacked = FromGLenum<TextureTarget>(textarget);
+ ANGLE_CAPTURE(FramebufferTexture3DOES, context, target, attachment, textargetPacked,
+ texture, level, zoffset);
+ if (context->skipValidation() ||
+ ValidateFramebufferTexture3DOES(context, target, attachment, textargetPacked, texture,
+ level, zoffset))
+ {
+ context->framebufferTexture3D(target, attachment, textargetPacked, texture, level,
+ zoffset);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTextureEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d)",
+ target, attachment, texture, level);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FramebufferTextureEXT, context, target, attachment, texture, level);
+ if (context->skipValidation() ||
+ ValidateFramebufferTextureEXT(context, target, attachment, texture, level))
+ {
+ context->framebufferTexture(target, attachment, texture, level);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTextureLayerContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FramebufferTextureLayer, context, target, attachment, texture, level, layer);
+ if (context->skipValidation() ||
+ ValidateFramebufferTextureLayer(context, target, attachment, texture, level, layer))
+ {
+ context->framebufferTextureLayer(target, attachment, texture, level, layer);
+ }
+ }
+}
+
+void GL_APIENTRY FramebufferTextureMultiviewOVRContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, "
+ "GLint baseViewIndex = %d, GLsizei numViews = %d)",
+ target, attachment, texture, level, baseViewIndex, numViews);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FramebufferTextureMultiviewOVR, context, target, attachment, texture, level,
+ baseViewIndex, numViews);
+ if (context->skipValidation() ||
+ ValidateFramebufferTextureMultiviewOVR(context, target, attachment, texture, level,
+ baseViewIndex, numViews))
+ {
+ context->framebufferTextureMultiview(target, attachment, texture, level, baseViewIndex,
+ numViews);
+ }
+ }
+}
+
+void GL_APIENTRY FrontFaceContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(FrontFace, context, mode);
+ if (context->skipValidation() || ValidateFrontFace(context, mode))
+ {
+ context->frontFace(mode);
+ }
+ }
+}
+
+void GL_APIENTRY FrustumfContextANGLE(GLeglContext ctx,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f)
+{
+ EVENT(
+ "(GLfloat l = %f, GLfloat r = %f, GLfloat b = %f, GLfloat t = %f, GLfloat n = %f, GLfloat "
+ "f = %f)",
+ l, r, b, t, n, f);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Frustumf, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateFrustumf(context, l, r, b, t, n, f))
+ {
+ context->frustumf(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY FrustumxContextANGLE(GLeglContext ctx,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f)
+{
+ EVENT(
+ "(GLfixed l = 0x%X, GLfixed r = 0x%X, GLfixed b = 0x%X, GLfixed t = 0x%X, GLfixed n = "
+ "0x%X, GLfixed f = 0x%X)",
+ l, r, b, t, n, f);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Frustumx, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateFrustumx(context, l, r, b, t, n, f))
+ {
+ context->frustumx(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY GenBuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *buffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *buffers = 0x%016" PRIxPTR ")", n, (uintptr_t)buffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenBuffers, context, n, buffers);
+ if (context->skipValidation() || ValidateGenBuffers(context, n, buffers))
+ {
+ context->genBuffers(n, buffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenFencesNVContextANGLE(GLeglContext ctx, GLsizei n, GLuint *fences)
+{
+ EVENT("(GLsizei n = %d, GLuint *fences = 0x%016" PRIxPTR ")", n, (uintptr_t)fences);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenFencesNV, context, n, fences);
+ if (context->skipValidation() || ValidateGenFencesNV(context, n, fences))
+ {
+ context->genFencesNV(n, fences);
+ }
+ }
+}
+
+void GL_APIENTRY GenFramebuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *framebuffers = 0x%016" PRIxPTR ")", n, (uintptr_t)framebuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenFramebuffers, context, n, framebuffers);
+ if (context->skipValidation() || ValidateGenFramebuffers(context, n, framebuffers))
+ {
+ context->genFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenFramebuffersOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *framebuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *framebuffers = 0x%016" PRIxPTR ")", n, (uintptr_t)framebuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenFramebuffersOES, context, n, framebuffers);
+ if (context->skipValidation() || ValidateGenFramebuffersOES(context, n, framebuffers))
+ {
+ context->genFramebuffers(n, framebuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenProgramPipelinesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *pipelines)
+{
+ EVENT("(GLsizei n = %d, GLuint *pipelines = 0x%016" PRIxPTR ")", n, (uintptr_t)pipelines);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenProgramPipelines, context, n, pipelines);
+ if (context->skipValidation() || ValidateGenProgramPipelines(context, n, pipelines))
+ {
+ context->genProgramPipelines(n, pipelines);
+ }
+ }
+}
+
+void GL_APIENTRY GenQueriesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenQueries, context, n, ids);
+ if (context->skipValidation() || ValidateGenQueries(context, n, ids))
+ {
+ context->genQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY GenQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenQueriesEXT, context, n, ids);
+ if (context->skipValidation() || ValidateGenQueriesEXT(context, n, ids))
+ {
+ context->genQueries(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY GenRenderbuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenRenderbuffers, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateGenRenderbuffers(context, n, renderbuffers))
+ {
+ context->genRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenRenderbuffersOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *renderbuffers)
+{
+ EVENT("(GLsizei n = %d, GLuint *renderbuffers = 0x%016" PRIxPTR ")", n,
+ (uintptr_t)renderbuffers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenRenderbuffersOES, context, n, renderbuffers);
+ if (context->skipValidation() || ValidateGenRenderbuffersOES(context, n, renderbuffers))
+ {
+ context->genRenderbuffers(n, renderbuffers);
+ }
+ }
+}
+
+void GL_APIENTRY GenSamplersContextANGLE(GLeglContext ctx, GLsizei count, GLuint *samplers)
+{
+ EVENT("(GLsizei count = %d, GLuint *samplers = 0x%016" PRIxPTR ")", count, (uintptr_t)samplers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenSamplers, context, count, samplers);
+ if (context->skipValidation() || ValidateGenSamplers(context, count, samplers))
+ {
+ context->genSamplers(count, samplers);
+ }
+ }
+}
+
+void GL_APIENTRY GenSemaphoresEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *semaphores)
+{
+ EVENT("(GLsizei n = %d, GLuint *semaphores = 0x%016" PRIxPTR ")", n, (uintptr_t)semaphores);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenSemaphoresEXT, context, n, semaphores);
+ if (context->skipValidation() || ValidateGenSemaphoresEXT(context, n, semaphores))
+ {
+ context->genSemaphores(n, semaphores);
+ }
+ }
+}
+
+void GL_APIENTRY GenTexturesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *textures)
+{
+ EVENT("(GLsizei n = %d, GLuint *textures = 0x%016" PRIxPTR ")", n, (uintptr_t)textures);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenTextures, context, n, textures);
+ if (context->skipValidation() || ValidateGenTextures(context, n, textures))
+ {
+ context->genTextures(n, textures);
+ }
+ }
+}
+
+void GL_APIENTRY GenTransformFeedbacksContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids)
+{
+ EVENT("(GLsizei n = %d, GLuint *ids = 0x%016" PRIxPTR ")", n, (uintptr_t)ids);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenTransformFeedbacks, context, n, ids);
+ if (context->skipValidation() || ValidateGenTransformFeedbacks(context, n, ids))
+ {
+ context->genTransformFeedbacks(n, ids);
+ }
+ }
+}
+
+void GL_APIENTRY GenVertexArraysContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenVertexArrays, context, n, arrays);
+ if (context->skipValidation() || ValidateGenVertexArrays(context, n, arrays))
+ {
+ context->genVertexArrays(n, arrays);
+ }
+ }
+}
+
+void GL_APIENTRY GenVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays)
+{
+ EVENT("(GLsizei n = %d, GLuint *arrays = 0x%016" PRIxPTR ")", n, (uintptr_t)arrays);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenVertexArraysOES, context, n, arrays);
+ if (context->skipValidation() || ValidateGenVertexArraysOES(context, n, arrays))
+ {
+ context->genVertexArrays(n, arrays);
+ }
+ }
+}
+
+void GL_APIENTRY GenerateMipmapContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GenerateMipmap, context, targetPacked);
+ if (context->skipValidation() || ValidateGenerateMipmap(context, targetPacked))
+ {
+ context->generateMipmap(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY GenerateMipmapOESContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GenerateMipmapOES, context, targetPacked);
+ if (context->skipValidation() || ValidateGenerateMipmapOES(context, targetPacked))
+ {
+ context->generateMipmap(targetPacked);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveAttribContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei *length = "
+ "0x%016" PRIxPTR ", GLint *size = 0x%016" PRIxPTR ", GLenum *type = 0x%016" PRIxPTR
+ ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, bufSize, (uintptr_t)length, (uintptr_t)size, (uintptr_t)type,
+ (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetActiveAttrib, context, program, index, bufSize, length, size, type, name);
+ if (context->skipValidation() ||
+ ValidateGetActiveAttrib(context, program, index, bufSize, length, size, type, name))
+ {
+ context->getActiveAttrib(program, index, bufSize, length, size, type, name);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei *length = "
+ "0x%016" PRIxPTR ", GLint *size = 0x%016" PRIxPTR ", GLenum *type = 0x%016" PRIxPTR
+ ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, bufSize, (uintptr_t)length, (uintptr_t)size, (uintptr_t)type,
+ (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetActiveUniform, context, program, index, bufSize, length, size, type, name);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniform(context, program, index, bufSize, length, size, type, name))
+ {
+ context->getActiveUniform(program, index, bufSize, length, size, type, name);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformBlockNameContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei "
+ "*length = 0x%016" PRIxPTR ", GLchar *uniformBlockName = 0x%016" PRIxPTR ")",
+ program, uniformBlockIndex, bufSize, (uintptr_t)length, (uintptr_t)uniformBlockName);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetActiveUniformBlockName, context, program, uniformBlockIndex, bufSize,
+ length, uniformBlockName);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniformBlockName(context, program, uniformBlockIndex, bufSize, length,
+ uniformBlockName))
+ {
+ context->getActiveUniformBlockName(program, uniformBlockIndex, bufSize, length,
+ uniformBlockName);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformBlockivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ program, uniformBlockIndex, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetActiveUniformBlockiv, context, program, uniformBlockIndex, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniformBlockiv(context, program, uniformBlockIndex, pname, params))
+ {
+ context->getActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformsivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLsizei uniformCount = %d, const GLuint *uniformIndices = "
+ "0x%016" PRIxPTR ", GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")",
+ program, uniformCount, (uintptr_t)uniformIndices, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetActiveUniformsiv, context, program, uniformCount, uniformIndices, pname,
+ params);
+ if (context->skipValidation() || ValidateGetActiveUniformsiv(context, program, uniformCount,
+ uniformIndices, pname, params))
+ {
+ context->getActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetAttachedShadersContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders)
+{
+ EVENT("(GLuint program = %u, GLsizei maxCount = %d, GLsizei *count = 0x%016" PRIxPTR
+ ", GLuint *shaders = 0x%016" PRIxPTR ")",
+ program, maxCount, (uintptr_t)count, (uintptr_t)shaders);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetAttachedShaders, context, program, maxCount, count, shaders);
+ if (context->skipValidation() ||
+ ValidateGetAttachedShaders(context, program, maxCount, count, shaders))
+ {
+ context->getAttachedShaders(program, maxCount, count, shaders);
+ }
+ }
+}
+
+GLint GL_APIENTRY GetAttribLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetAttribLocation, context, program, name);
+ if (context->skipValidation() || ValidateGetAttribLocation(context, program, name))
+ {
+ return context->getAttribLocation(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetAttribLocation, GLint>();
+}
+
+void GL_APIENTRY GetBooleani_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLboolean *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLboolean *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetBooleani_v, context, target, index, data);
+ if (context->skipValidation() || ValidateGetBooleani_v(context, target, index, data))
+ {
+ context->getBooleani_v(target, index, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetBooleanvContextANGLE(GLeglContext ctx, GLenum pname, GLboolean *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLboolean *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetBooleanv, context, pname, data);
+ if (context->skipValidation() || ValidateGetBooleanv(context, pname, data))
+ {
+ context->getBooleanv(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameteri64vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint64 *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64 *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameteri64v, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferParameteri64v(context, targetPacked, pname, params))
+ {
+ context->getBufferParameteri64v(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameteriv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferParameteriv(context, targetPacked, pname, params))
+ {
+ context->getBufferParameteriv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferPointervContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ void **params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferPointerv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferPointerv(context, targetPacked, pname, params))
+ {
+ context->getBufferPointerv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferPointervOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ void **params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferPointervOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetBufferPointervOES(context, targetPacked, pname, params))
+ {
+ context->getBufferPointerv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetClipPlanefContextANGLE(GLeglContext ctx, GLenum plane, GLfloat *equation)
+{
+ EVENT("(GLenum plane = 0x%X, GLfloat *equation = 0x%016" PRIxPTR ")", plane,
+ (uintptr_t)equation);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetClipPlanef, context, plane, equation);
+ if (context->skipValidation() || ValidateGetClipPlanef(context, plane, equation))
+ {
+ context->getClipPlanef(plane, equation);
+ }
+ }
+}
+
+void GL_APIENTRY GetClipPlanexContextANGLE(GLeglContext ctx, GLenum plane, GLfixed *equation)
+{
+ EVENT("(GLenum plane = 0x%X, GLfixed *equation = 0x%016" PRIxPTR ")", plane,
+ (uintptr_t)equation);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetClipPlanex, context, plane, equation);
+ if (context->skipValidation() || ValidateGetClipPlanex(context, plane, equation))
+ {
+ context->getClipPlanex(plane, equation);
+ }
+ }
+}
+
+GLuint GL_APIENTRY GetDebugMessageLogKHRContextANGLE(GLeglContext ctx,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ EVENT("(GLuint count = %u, GLsizei bufSize = %d, GLenum *sources = 0x%016" PRIxPTR
+ ", GLenum *types = 0x%016" PRIxPTR ", GLuint *ids = 0x%016" PRIxPTR
+ ", GLenum *severities = 0x%016" PRIxPTR ", GLsizei *lengths = 0x%016" PRIxPTR
+ ", GLchar *messageLog = 0x%016" PRIxPTR ")",
+ count, bufSize, (uintptr_t)sources, (uintptr_t)types, (uintptr_t)ids,
+ (uintptr_t)severities, (uintptr_t)lengths, (uintptr_t)messageLog);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetDebugMessageLogKHR, context, count, bufSize, sources, types, ids,
+ severities, lengths, messageLog);
+ if (context->skipValidation() ||
+ ValidateGetDebugMessageLogKHR(context, count, bufSize, sources, types, ids, severities,
+ lengths, messageLog))
+ {
+ return context->getDebugMessageLog(count, bufSize, sources, types, ids, severities,
+ lengths, messageLog);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetDebugMessageLogKHR, GLuint>();
+}
+
+GLenum GL_APIENTRY GetErrorContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetError, context);
+ if (context->skipValidation() || ValidateGetError(context))
+ {
+ return context->getError();
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetError, GLenum>();
+}
+
+void GL_APIENTRY GetFenceivNVContextANGLE(GLeglContext ctx,
+ GLuint fence,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint fence = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", fence,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFenceivNV, context, fence, pname, params);
+ if (context->skipValidation() || ValidateGetFenceivNV(context, fence, pname, params))
+ {
+ context->getFenceivNV(fence, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFixedvContextANGLE(GLeglContext ctx, GLenum pname, GLfixed *params)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFixedv, context, pname, params);
+ if (context->skipValidation() || ValidateGetFixedv(context, pname, params))
+ {
+ context->getFixedv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFloatvContextANGLE(GLeglContext ctx, GLenum pname, GLfloat *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFloatv, context, pname, data);
+ if (context->skipValidation() || ValidateGetFloatv(context, pname, data))
+ {
+ context->getFloatv(pname, data);
+ }
+ }
+}
+
+GLint GL_APIENTRY GetFragDataIndexEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFragDataIndexEXT, context, program, name);
+ if (context->skipValidation() || ValidateGetFragDataIndexEXT(context, program, name))
+ {
+ return context->getFragDataIndex(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetFragDataIndexEXT, GLint>();
+}
+
+GLint GL_APIENTRY GetFragDataLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFragDataLocation, context, program, name);
+ if (context->skipValidation() || ValidateGetFragDataLocation(context, program, name))
+ {
+ return context->getFragDataLocation(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetFragDataLocation, GLint>();
+}
+
+void GL_APIENTRY GetFramebufferAttachmentParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ target, attachment, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFramebufferAttachmentParameteriv, context, target, attachment, pname,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetFramebufferAttachmentParameteriv(context, target, attachment, pname, params))
+ {
+ context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferAttachmentParameterivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ target, attachment, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFramebufferAttachmentParameterivOES, context, target, attachment, pname,
+ params);
+ if (context->skipValidation() || ValidateGetFramebufferAttachmentParameterivOES(
+ context, target, attachment, pname, params))
+ {
+ context->getFramebufferAttachmentParameteriv(target, attachment, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFramebufferParameteriv, context, target, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetFramebufferParameteriv(context, target, pname, params))
+ {
+ context->getFramebufferParameteriv(target, pname, params);
+ }
+ }
+}
+
+GLenum GL_APIENTRY GetGraphicsResetStatusEXTContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetGraphicsResetStatusEXT, context);
+ if (context->skipValidation() || ValidateGetGraphicsResetStatusEXT(context))
+ {
+ return context->getGraphicsResetStatus();
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetGraphicsResetStatusEXT, GLenum>();
+}
+
+void GL_APIENTRY GetInteger64i_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLint64 *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64 *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetInteger64i_v, context, target, index, data);
+ if (context->skipValidation() || ValidateGetInteger64i_v(context, target, index, data))
+ {
+ context->getInteger64i_v(target, index, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInteger64vContextANGLE(GLeglContext ctx, GLenum pname, GLint64 *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLint64 *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetInteger64v, context, pname, data);
+ if (context->skipValidation() || ValidateGetInteger64v(context, pname, data))
+ {
+ context->getInteger64v(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetIntegeri_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLint *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetIntegeri_v, context, target, index, data);
+ if (context->skipValidation() || ValidateGetIntegeri_v(context, target, index, data))
+ {
+ context->getIntegeri_v(target, index, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetIntegervContextANGLE(GLeglContext ctx, GLenum pname, GLint *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLint *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetIntegerv, context, pname, data);
+ if (context->skipValidation() || ValidateGetIntegerv(context, pname, data))
+ {
+ context->getIntegerv(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInternalformativContextANGLE(GLeglContext ctx,
+ 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%016" PRIxPTR ")",
+ target, internalformat, pname, bufSize, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetInternalformativ, context, target, internalformat, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateGetInternalformativ(context, target, internalformat, pname, bufSize, params))
+ {
+ context->getInternalformativ(target, internalformat, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetLightfvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", light,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(GetLightfv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetLightfv(context, light, pnamePacked, params))
+ {
+ context->getLightfv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetLightxvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfixed *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", light,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(GetLightxv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetLightxv(context, light, pnamePacked, params))
+ {
+ context->getLightxv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMaterialfvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", face,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(GetMaterialfv, context, face, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetMaterialfv(context, face, pnamePacked, params))
+ {
+ context->getMaterialfv(face, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMaterialxvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfixed *params)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", face,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(GetMaterialxv, context, face, pnamePacked, params);
+ if (context->skipValidation() || ValidateGetMaterialxv(context, face, pnamePacked, params))
+ {
+ context->getMaterialxv(face, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx,
+ GLuint memoryObject,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint memoryObject = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")",
+ memoryObject, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetMemoryObjectParameterivEXT, context, memoryObject, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetMemoryObjectParameterivEXT(context, memoryObject, pname, params))
+ {
+ context->getMemoryObjectParameteriv(memoryObject, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetMultisamplefvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val)
+{
+ EVENT("(GLenum pname = 0x%X, GLuint index = %u, GLfloat *val = 0x%016" PRIxPTR ")", pname,
+ index, (uintptr_t)val);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetMultisamplefv, context, pname, index, val);
+ if (context->skipValidation() || ValidateGetMultisamplefv(context, pname, index, val))
+ {
+ context->getMultisamplefv(pname, index, val);
+ }
+ }
+}
+
+void GL_APIENTRY GetObjectLabelKHRContextANGLE(GLeglContext ctx,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ EVENT(
+ "(GLenum identifier = 0x%X, GLuint name = %u, GLsizei bufSize = %d, GLsizei *length = "
+ "0x%016" PRIxPTR ", GLchar *label = 0x%016" PRIxPTR ")",
+ identifier, name, bufSize, (uintptr_t)length, (uintptr_t)label);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetObjectLabelKHR, context, identifier, name, bufSize, length, label);
+ if (context->skipValidation() ||
+ ValidateGetObjectLabelKHR(context, identifier, name, bufSize, length, label))
+ {
+ context->getObjectLabel(identifier, name, bufSize, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY GetObjectPtrLabelKHRContextANGLE(GLeglContext ctx,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ EVENT("(const void *ptr = 0x%016" PRIxPTR
+ ", GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *label = 0x%016" PRIxPTR ")",
+ (uintptr_t)ptr, bufSize, (uintptr_t)length, (uintptr_t)label);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetObjectPtrLabelKHR, context, ptr, bufSize, length, label);
+ if (context->skipValidation() ||
+ ValidateGetObjectPtrLabelKHR(context, ptr, bufSize, length, label))
+ {
+ context->getObjectPtrLabel(ptr, bufSize, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY GetPointervContextANGLE(GLeglContext ctx, GLenum pname, void **params)
+{
+ EVENT("(GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetPointerv, context, pname, params);
+ if (context->skipValidation() || ValidateGetPointerv(context, pname, params))
+ {
+ context->getPointerv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetPointervKHRContextANGLE(GLeglContext ctx, GLenum pname, void **params)
+{
+ EVENT("(GLenum pname = 0x%X, void **params = 0x%016" PRIxPTR ")", pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetPointervKHR, context, pname, params);
+ if (context->skipValidation() || ValidateGetPointervKHR(context, pname, params))
+ {
+ context->getPointerv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramBinaryContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLenum *binaryFormat = 0x%016" PRIxPTR ", void *binary = 0x%016" PRIxPTR ")",
+ program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat, (uintptr_t)binary);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramBinary, context, program, bufSize, length, binaryFormat, binary);
+ if (context->skipValidation() ||
+ ValidateGetProgramBinary(context, program, bufSize, length, binaryFormat, binary))
+ {
+ context->getProgramBinary(program, bufSize, length, binaryFormat, binary);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramBinaryOESContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLenum *binaryFormat = 0x%016" PRIxPTR ", void *binary = 0x%016" PRIxPTR ")",
+ program, bufSize, (uintptr_t)length, (uintptr_t)binaryFormat, (uintptr_t)binary);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramBinaryOES, context, program, bufSize, length, binaryFormat, binary);
+ if (context->skipValidation() ||
+ ValidateGetProgramBinaryOES(context, program, bufSize, length, binaryFormat, binary))
+ {
+ context->getProgramBinary(program, bufSize, length, binaryFormat, binary);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramInfoLogContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *infoLog = 0x%016" PRIxPTR ")",
+ program, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramInfoLog, context, program, bufSize, length, infoLog);
+ if (context->skipValidation() ||
+ ValidateGetProgramInfoLog(context, program, bufSize, length, infoLog))
+ {
+ context->getProgramInfoLog(program, bufSize, length, infoLog);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramInterfaceivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLenum pname = 0x%X, GLint *params "
+ "= 0x%016" PRIxPTR ")",
+ program, programInterface, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramInterfaceiv, context, program, programInterface, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramInterfaceiv(context, program, programInterface, pname, params))
+ {
+ context->getProgramInterfaceiv(program, programInterface, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramPipelineInfoLogContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ EVENT("(GLuint pipeline = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *infoLog = 0x%016" PRIxPTR ")",
+ pipeline, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramPipelineInfoLog, context, pipeline, bufSize, length, infoLog);
+ if (context->skipValidation() ||
+ ValidateGetProgramPipelineInfoLog(context, pipeline, bufSize, length, infoLog))
+ {
+ context->getProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramPipelineivContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint pipeline = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")",
+ pipeline, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramPipelineiv, context, pipeline, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramPipelineiv(context, pipeline, pname, params))
+ {
+ context->getProgramPipelineiv(pipeline, pname, params);
+ }
+ }
+}
+
+GLuint GL_APIENTRY GetProgramResourceIndexContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar *name = 0x%016" PRIxPTR
+ ")",
+ program, programInterface, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramResourceIndex, context, program, programInterface, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceIndex(context, program, programInterface, name))
+ {
+ return context->getProgramResourceIndex(program, programInterface, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetProgramResourceIndex, GLuint>();
+}
+
+GLint GL_APIENTRY GetProgramResourceLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar *name = 0x%016" PRIxPTR
+ ")",
+ program, programInterface, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramResourceLocation, context, program, programInterface, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceLocation(context, program, programInterface, name))
+ {
+ return context->getProgramResourceLocation(program, programInterface, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetProgramResourceLocation, GLint>();
+}
+
+GLint GL_APIENTRY GetProgramResourceLocationIndexEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar *name = 0x%016" PRIxPTR
+ ")",
+ program, programInterface, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramResourceLocationIndexEXT, context, program, programInterface, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceLocationIndexEXT(context, program, programInterface, name))
+ {
+ return context->getProgramResourceLocationIndex(program, programInterface, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetProgramResourceLocationIndexEXT, GLint>();
+}
+
+void GL_APIENTRY GetProgramResourceNameContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLuint index = %u, GLsizei bufSize "
+ "= %d, GLsizei *length = 0x%016" PRIxPTR ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, programInterface, index, bufSize, (uintptr_t)length, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramResourceName, context, program, programInterface, index, bufSize,
+ length, name);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceName(context, program, programInterface, index, bufSize,
+ length, name))
+ {
+ context->getProgramResourceName(program, programInterface, index, bufSize, length,
+ name);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramResourceivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLuint index = %u, GLsizei "
+ "propCount = %d, const GLenum *props = 0x%016" PRIxPTR
+ ", GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLint *params = 0x%016" PRIxPTR ")",
+ program, programInterface, index, propCount, (uintptr_t)props, bufSize, (uintptr_t)length,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramResourceiv, context, program, programInterface, index, propCount,
+ props, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramResourceiv(context, program, programInterface, index, propCount,
+ props, bufSize, length, params))
+ {
+ context->getProgramResourceiv(program, programInterface, index, propCount, props,
+ bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", program,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramiv, context, program, pname, params);
+ if (context->skipValidation() || ValidateGetProgramiv(context, program, pname, params))
+ {
+ context->getProgramiv(program, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjecti64vEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLint64 *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint64 *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjecti64vEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjecti64vEXT(context, id, pname, params))
+ {
+ context->getQueryObjecti64v(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectivEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjectivEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectivEXT(context, id, pname, params))
+ {
+ context->getQueryObjectiv(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint64 *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLuint64 *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjectui64vEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectui64vEXT(context, id, pname, params))
+ {
+ context->getQueryObjectui64v(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectuivContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjectuiv, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectuiv(context, id, pname, params))
+ {
+ context->getQueryObjectuiv(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectuivEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint *params)
+{
+ EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", id, pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjectuivEXT, context, id, pname, params);
+ if (context->skipValidation() || ValidateGetQueryObjectuivEXT(context, id, pname, params))
+ {
+ context->getQueryObjectuiv(id, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(GetQueryiv, context, targetPacked, pname, params);
+ if (context->skipValidation() || ValidateGetQueryiv(context, targetPacked, pname, params))
+ {
+ context->getQueryiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryivEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(GetQueryivEXT, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryivEXT(context, targetPacked, pname, params))
+ {
+ context->getQueryiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetRenderbufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetRenderbufferParameteriv, context, target, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetRenderbufferParameteriv(context, target, pname, params))
+ {
+ context->getRenderbufferParameteriv(target, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetRenderbufferParameterivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetRenderbufferParameterivOES, context, target, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetRenderbufferParameterivOES(context, target, pname, params))
+ {
+ context->getRenderbufferParameteriv(target, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterIivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", sampler,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameterIivOES, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameterIivOES(context, sampler, pname, params))
+ {
+ context->getSamplerParameterIiv(sampler, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", sampler,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameterIuivOES, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameterIuivOES(context, sampler, pname, params))
+ {
+ context->getSamplerParameterIuiv(sampler, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterfvContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameterfv, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameterfv(context, sampler, pname, params))
+ {
+ context->getSamplerParameterfv(sampler, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterivContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", sampler,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameteriv, context, sampler, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSamplerParameteriv(context, sampler, pname, params))
+ {
+ context->getSamplerParameteriv(sampler, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params)
+{
+ EVENT("(GLuint semaphore = %u, GLenum pname = 0x%X, GLuint64 *params = 0x%016" PRIxPTR ")",
+ semaphore, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSemaphoreParameterui64vEXT, context, semaphore, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetSemaphoreParameterui64vEXT(context, semaphore, pname, params))
+ {
+ context->getSemaphoreParameterui64v(semaphore, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderInfoLogContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ EVENT("(GLuint shader = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *infoLog = 0x%016" PRIxPTR ")",
+ shader, bufSize, (uintptr_t)length, (uintptr_t)infoLog);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetShaderInfoLog, context, shader, bufSize, length, infoLog);
+ if (context->skipValidation() ||
+ ValidateGetShaderInfoLog(context, shader, bufSize, length, infoLog))
+ {
+ context->getShaderInfoLog(shader, bufSize, length, infoLog);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderPrecisionFormatContextANGLE(GLeglContext ctx,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision)
+{
+ EVENT("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint *range = 0x%016" PRIxPTR
+ ", GLint *precision = 0x%016" PRIxPTR ")",
+ shadertype, precisiontype, (uintptr_t)range, (uintptr_t)precision);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetShaderPrecisionFormat, context, shadertype, precisiontype, range,
+ precision);
+ if (context->skipValidation() ||
+ ValidateGetShaderPrecisionFormat(context, shadertype, precisiontype, range, precision))
+ {
+ context->getShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderSourceContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source)
+{
+ EVENT("(GLuint shader = %u, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *source = 0x%016" PRIxPTR ")",
+ shader, bufSize, (uintptr_t)length, (uintptr_t)source);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetShaderSource, context, shader, bufSize, length, source);
+ if (context->skipValidation() ||
+ ValidateGetShaderSource(context, shader, bufSize, length, source))
+ {
+ context->getShaderSource(shader, bufSize, length, source);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderivContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint shader = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", shader,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetShaderiv, context, shader, pname, params);
+ if (context->skipValidation() || ValidateGetShaderiv(context, shader, pname, params))
+ {
+ context->getShaderiv(shader, pname, params);
+ }
+ }
+}
+
+const GLubyte *GL_APIENTRY GetStringContextANGLE(GLeglContext ctx, GLenum name)
+{
+ EVENT("(GLenum name = 0x%X)", name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetString, context, name);
+ if (context->skipValidation() || ValidateGetString(context, name))
+ {
+ return context->getString(name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetString, const GLubyte *>();
+}
+
+const GLubyte *GL_APIENTRY GetStringiContextANGLE(GLeglContext ctx, GLenum name, GLuint index)
+{
+ EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetStringi, context, name, index);
+ if (context->skipValidation() || ValidateGetStringi(context, name, index))
+ {
+ return context->getStringi(name, index);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetStringi, const GLubyte *>();
+}
+
+void GL_APIENTRY GetSyncivContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR
+ ", GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLint *values = 0x%016" PRIxPTR ")",
+ (uintptr_t)sync, pname, bufSize, (uintptr_t)length, (uintptr_t)values);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSynciv, context, sync, pname, bufSize, length, values);
+ if (context->skipValidation() ||
+ ValidateGetSynciv(context, sync, pname, bufSize, length, values))
+ {
+ context->getSynciv(sync, pname, bufSize, length, values);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexEnvfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(GetTexEnvfv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateGetTexEnvfv(context, targetPacked, pnamePacked, params))
+ {
+ context->getTexEnvfv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexEnvivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(GetTexEnviv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateGetTexEnviv(context, targetPacked, pnamePacked, params))
+ {
+ context->getTexEnviv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexEnvxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(GetTexEnvxv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateGetTexEnvxv(context, targetPacked, pnamePacked, params))
+ {
+ context->getTexEnvxv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexGenfvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", coord,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetTexGenfvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateGetTexGenfvOES(context, coord, pname, params))
+ {
+ context->getTexGenfv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexGenivOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", coord,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetTexGenivOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateGetTexGenivOES(context, coord, pname, params))
+ {
+ context->getTexGeniv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexGenxvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfixed *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")", coord,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetTexGenxvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateGetTexGenxvOES(context, coord, pname, params))
+ {
+ context->getTexGenxv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLfloat *params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterfv, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterfv(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameterfv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameteriv, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameteriv(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameteriv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterIivOES(context, targetPacked, pname, params))
+ {
+ context->getTexParameterIiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLuint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIuivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterIuivOES(context, targetPacked, pname, params))
+ {
+ context->getTexParameterIuiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterfv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterfv(context, targetPacked, pname, params))
+ {
+ context->getTexParameterfv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", target,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameteriv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameteriv(context, targetPacked, pname, params))
+ {
+ context->getTexParameteriv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterxv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexParameterxv(context, targetPacked, pname, params))
+ {
+ context->getTexParameterxv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTransformFeedbackVaryingContextANGLE(GLeglContext ctx,
+ 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%016" PRIxPTR ", GLsizei *size = 0x%016" PRIxPTR ", GLenum *type = 0x%016" PRIxPTR
+ ", GLchar *name = 0x%016" PRIxPTR ")",
+ program, index, bufSize, (uintptr_t)length, (uintptr_t)size, (uintptr_t)type,
+ (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetTransformFeedbackVarying, context, program, index, bufSize, length, size,
+ type, name);
+ if (context->skipValidation() ||
+ ValidateGetTransformFeedbackVarying(context, program, index, bufSize, length, size,
+ type, name))
+ {
+ context->getTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
+ }
+ }
+}
+
+void GL_APIENTRY GetTranslatedShaderSourceANGLEContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source)
+{
+ EVENT("(GLuint shader = %u, GLsizei bufsize = %d, GLsizei *length = 0x%016" PRIxPTR
+ ", GLchar *source = 0x%016" PRIxPTR ")",
+ shader, bufsize, (uintptr_t)length, (uintptr_t)source);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetTranslatedShaderSourceANGLE, context, shader, bufsize, length, source);
+ if (context->skipValidation() ||
+ ValidateGetTranslatedShaderSourceANGLE(context, shader, bufsize, length, source))
+ {
+ context->getTranslatedShaderSource(shader, bufsize, length, source);
+ }
+ }
+}
+
+GLuint GL_APIENTRY GetUniformBlockIndexContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *uniformBlockName)
+{
+ EVENT("(GLuint program = %u, const GLchar *uniformBlockName = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)uniformBlockName);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformBlockIndex, context, program, uniformBlockName);
+ if (context->skipValidation() ||
+ ValidateGetUniformBlockIndex(context, program, uniformBlockName))
+ {
+ return context->getUniformBlockIndex(program, uniformBlockName);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetUniformBlockIndex, GLuint>();
+}
+
+void GL_APIENTRY GetUniformIndicesContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices)
+{
+ EVENT(
+ "(GLuint program = %u, GLsizei uniformCount = %d, const GLchar *const*uniformNames = "
+ "0x%016" PRIxPTR ", GLuint *uniformIndices = 0x%016" PRIxPTR ")",
+ program, uniformCount, (uintptr_t)uniformNames, (uintptr_t)uniformIndices);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformIndices, context, program, uniformCount, uniformNames,
+ uniformIndices);
+ if (context->skipValidation() ||
+ ValidateGetUniformIndices(context, program, uniformCount, uniformNames, uniformIndices))
+ {
+ context->getUniformIndices(program, uniformCount, uniformNames, uniformIndices);
+ }
+ }
+}
+
+GLint GL_APIENTRY GetUniformLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ EVENT("(GLuint program = %u, const GLchar *name = 0x%016" PRIxPTR ")", program,
+ (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformLocation, context, program, name);
+ if (context->skipValidation() || ValidateGetUniformLocation(context, program, name))
+ {
+ return context->getUniformLocation(program, name);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GetUniformLocation, GLint>();
+}
+
+void GL_APIENTRY GetUniformfvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat *params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLfloat *params = 0x%016" PRIxPTR ")",
+ program, location, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformfv, context, program, location, params);
+ if (context->skipValidation() || ValidateGetUniformfv(context, program, location, params))
+ {
+ context->getUniformfv(program, location, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint *params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint *params = 0x%016" PRIxPTR ")", program,
+ location, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformiv, context, program, location, params);
+ if (context->skipValidation() || ValidateGetUniformiv(context, program, location, params))
+ {
+ context->getUniformiv(program, location, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformuivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint *params)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint *params = 0x%016" PRIxPTR ")", program,
+ location, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformuiv, context, program, location, params);
+ if (context->skipValidation() || ValidateGetUniformuiv(context, program, location, params))
+ {
+ context->getUniformuiv(program, location, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUnsignedBytevEXTContextANGLE(GLeglContext ctx, GLenum pname, GLubyte *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLubyte *data = 0x%016" PRIxPTR ")", pname, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUnsignedBytevEXT, context, pname, data);
+ if (context->skipValidation() || ValidateGetUnsignedBytevEXT(context, pname, data))
+ {
+ context->getUnsignedBytev(pname, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetUnsignedBytei_vEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLubyte *data)
+{
+ EVENT("(GLenum target = 0x%X, GLuint index = %u, GLubyte *data = 0x%016" PRIxPTR ")", target,
+ index, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUnsignedBytei_vEXT, context, target, index, data);
+ if (context->skipValidation() ||
+ ValidateGetUnsignedBytei_vEXT(context, target, index, data))
+ {
+ context->getUnsignedBytei_v(target, index, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribIiv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribIiv(context, index, pname, params))
+ {
+ context->getVertexAttribIiv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIuivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLuint *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribIuiv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribIuiv(context, index, pname, params))
+ {
+ context->getVertexAttribIuiv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribPointervContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ void **pointer)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, void **pointer = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribPointerv, context, index, pname, pointer);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribPointerv(context, index, pname, pointer))
+ {
+ context->getVertexAttribPointerv(index, pname, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribfvContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLfloat *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribfv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribfv(context, index, pname, params))
+ {
+ context->getVertexAttribfv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint *params = 0x%016" PRIxPTR ")", index,
+ pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribiv, context, index, pname, params);
+ if (context->skipValidation() || ValidateGetVertexAttribiv(context, index, pname, params))
+ {
+ context->getVertexAttribiv(index, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformfvEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLfloat *params = "
+ "0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetnUniformfvEXT, context, program, location, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformfvEXT(context, program, location, bufSize, params))
+ {
+ context->getnUniformfv(program, location, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformivEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLint *params = "
+ "0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetnUniformivEXT, context, program, location, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformivEXT(context, program, location, bufSize, params))
+ {
+ context->getnUniformiv(program, location, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY HintContextANGLE(GLeglContext ctx, GLenum target, GLenum mode)
+{
+ EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Hint, context, target, mode);
+ if (context->skipValidation() || ValidateHint(context, target, mode))
+ {
+ context->hint(target, mode);
+ }
+ }
+}
+
+void GL_APIENTRY ImportMemoryFdEXTContextANGLE(GLeglContext ctx,
+ GLuint memory,
+ GLuint64 size,
+ GLenum handleType,
+ GLint fd)
+{
+ EVENT("(GLuint memory = %u, GLuint64 size = %llu, GLenum handleType = 0x%X, GLint fd = %d)",
+ memory, static_cast<unsigned long long>(size), handleType, fd);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ HandleType handleTypePacked = FromGLenum<HandleType>(handleType);
+ ANGLE_CAPTURE(ImportMemoryFdEXT, context, memory, size, handleTypePacked, fd);
+ if (context->skipValidation() ||
+ ValidateImportMemoryFdEXT(context, memory, size, handleTypePacked, fd))
+ {
+ context->importMemoryFd(memory, size, handleTypePacked, fd);
+ }
+ }
+}
+
+void GL_APIENTRY ImportSemaphoreFdEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum handleType,
+ GLint fd)
+{
+ EVENT("(GLuint semaphore = %u, GLenum handleType = 0x%X, GLint fd = %d)", semaphore, handleType,
+ fd);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ HandleType handleTypePacked = FromGLenum<HandleType>(handleType);
+ ANGLE_CAPTURE(ImportSemaphoreFdEXT, context, semaphore, handleTypePacked, fd);
+ if (context->skipValidation() ||
+ ValidateImportSemaphoreFdEXT(context, semaphore, handleTypePacked, fd))
+ {
+ context->importSemaphoreFd(semaphore, handleTypePacked, fd);
+ }
+ }
+}
+
+void GL_APIENTRY InsertEventMarkerEXTContextANGLE(GLeglContext ctx,
+ GLsizei length,
+ const GLchar *marker)
+{
+ // Don't run an EVENT() macro on the EXT_debug_marker entry points.
+ // It can interfere with the debug events being set by the caller.
+ // EVENT("(GLsizei length = %d, const GLchar *marker = 0x%016" PRIxPTR ")", length,
+ // (uintptr_t)marker);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(InsertEventMarkerEXT, context, length, marker);
+ if (context->skipValidation() || ValidateInsertEventMarkerEXT(context, length, marker))
+ {
+ context->insertEventMarker(length, marker);
+ }
+ }
+}
+
+void GL_APIENTRY InvalidateFramebufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = "
+ "0x%016" PRIxPTR ")",
+ target, numAttachments, (uintptr_t)attachments);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(InvalidateFramebuffer, context, target, numAttachments, attachments);
+ if (context->skipValidation() ||
+ ValidateInvalidateFramebuffer(context, target, numAttachments, attachments))
+ {
+ context->invalidateFramebuffer(target, numAttachments, attachments);
+ }
+ }
+}
+
+void GL_APIENTRY InvalidateSubFramebufferContextANGLE(GLeglContext ctx,
+ 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%016" PRIxPTR ", GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
+ target, numAttachments, (uintptr_t)attachments, x, y, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(InvalidateSubFramebuffer, context, target, numAttachments, attachments, x, y,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateInvalidateSubFramebuffer(context, target, numAttachments, attachments, x, y,
+ width, height))
+ {
+ context->invalidateSubFramebuffer(target, numAttachments, attachments, x, y, width,
+ height);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsBufferContextANGLE(GLeglContext ctx, GLuint buffer)
+{
+ EVENT("(GLuint buffer = %u)", buffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsBuffer, context, buffer);
+ if (context->skipValidation() || ValidateIsBuffer(context, buffer))
+ {
+ return context->isBuffer(buffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsBuffer, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsEnabledContextANGLE(GLeglContext ctx, GLenum cap)
+{
+ EVENT("(GLenum cap = 0x%X)", cap);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsEnabled, context, cap);
+ if (context->skipValidation() || ValidateIsEnabled(context, cap))
+ {
+ return context->isEnabled(cap);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsEnabled, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsFenceNVContextANGLE(GLeglContext ctx, GLuint fence)
+{
+ EVENT("(GLuint fence = %u)", fence);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsFenceNV, context, fence);
+ if (context->skipValidation() || ValidateIsFenceNV(context, fence))
+ {
+ return context->isFenceNV(fence);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsFenceNV, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsFramebufferContextANGLE(GLeglContext ctx, GLuint framebuffer)
+{
+ EVENT("(GLuint framebuffer = %u)", framebuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsFramebuffer, context, framebuffer);
+ if (context->skipValidation() || ValidateIsFramebuffer(context, framebuffer))
+ {
+ return context->isFramebuffer(framebuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsFramebuffer, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsFramebufferOESContextANGLE(GLeglContext ctx, GLuint framebuffer)
+{
+ EVENT("(GLuint framebuffer = %u)", framebuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsFramebufferOES, context, framebuffer);
+ if (context->skipValidation() || ValidateIsFramebufferOES(context, framebuffer))
+ {
+ return context->isFramebuffer(framebuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsFramebufferOES, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsMemoryObjectEXTContextANGLE(GLeglContext ctx, GLuint memoryObject)
+{
+ EVENT("(GLuint memoryObject = %u)", memoryObject);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsMemoryObjectEXT, context, memoryObject);
+ if (context->skipValidation() || ValidateIsMemoryObjectEXT(context, memoryObject))
+ {
+ return context->isMemoryObject(memoryObject);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsMemoryObjectEXT, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsProgram, context, program);
+ if (context->skipValidation() || ValidateIsProgram(context, program))
+ {
+ return context->isProgram(program);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsProgram, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline)
+{
+ EVENT("(GLuint pipeline = %u)", pipeline);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsProgramPipeline, context, pipeline);
+ if (context->skipValidation() || ValidateIsProgramPipeline(context, pipeline))
+ {
+ return context->isProgramPipeline(pipeline);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsProgramPipeline, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsQueryContextANGLE(GLeglContext ctx, GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsQuery, context, id);
+ if (context->skipValidation() || ValidateIsQuery(context, id))
+ {
+ return context->isQuery(id);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsQuery, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsQueryEXTContextANGLE(GLeglContext ctx, GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsQueryEXT, context, id);
+ if (context->skipValidation() || ValidateIsQueryEXT(context, id))
+ {
+ return context->isQuery(id);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsQueryEXT, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsRenderbufferContextANGLE(GLeglContext ctx, GLuint renderbuffer)
+{
+ EVENT("(GLuint renderbuffer = %u)", renderbuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsRenderbuffer, context, renderbuffer);
+ if (context->skipValidation() || ValidateIsRenderbuffer(context, renderbuffer))
+ {
+ return context->isRenderbuffer(renderbuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsRenderbuffer, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsRenderbufferOESContextANGLE(GLeglContext ctx, GLuint renderbuffer)
+{
+ EVENT("(GLuint renderbuffer = %u)", renderbuffer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsRenderbufferOES, context, renderbuffer);
+ if (context->skipValidation() || ValidateIsRenderbufferOES(context, renderbuffer))
+ {
+ return context->isRenderbuffer(renderbuffer);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsRenderbufferOES, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore)
+{
+ EVENT("(GLuint semaphore = %u)", semaphore);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsSemaphoreEXT, context, semaphore);
+ if (context->skipValidation() || ValidateIsSemaphoreEXT(context, semaphore))
+ {
+ return context->isSemaphore(semaphore);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsSemaphoreEXT, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsSamplerContextANGLE(GLeglContext ctx, GLuint sampler)
+{
+ EVENT("(GLuint sampler = %u)", sampler);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsSampler, context, sampler);
+ if (context->skipValidation() || ValidateIsSampler(context, sampler))
+ {
+ return context->isSampler(sampler);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsSampler, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsShaderContextANGLE(GLeglContext ctx, GLuint shader)
+{
+ EVENT("(GLuint shader = %u)", shader);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsShader, context, shader);
+ if (context->skipValidation() || ValidateIsShader(context, shader))
+ {
+ return context->isShader(shader);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsShader, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsSyncContextANGLE(GLeglContext ctx, GLsync sync)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ")", (uintptr_t)sync);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsSync, context, sync);
+ if (context->skipValidation() || ValidateIsSync(context, sync))
+ {
+ return context->isSync(sync);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsSync, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsTextureContextANGLE(GLeglContext ctx, GLuint texture)
+{
+ EVENT("(GLuint texture = %u)", texture);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsTexture, context, texture);
+ if (context->skipValidation() || ValidateIsTexture(context, texture))
+ {
+ return context->isTexture(texture);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsTexture, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsTransformFeedbackContextANGLE(GLeglContext ctx, GLuint id)
+{
+ EVENT("(GLuint id = %u)", id);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsTransformFeedback, context, id);
+ if (context->skipValidation() || ValidateIsTransformFeedback(context, id))
+ {
+ return context->isTransformFeedback(id);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsTransformFeedback, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsVertexArrayContextANGLE(GLeglContext ctx, GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsVertexArray, context, array);
+ if (context->skipValidation() || ValidateIsVertexArray(context, array))
+ {
+ return context->isVertexArray(array);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsVertexArray, GLboolean>();
+}
+
+GLboolean GL_APIENTRY IsVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array)
+{
+ EVENT("(GLuint array = %u)", array);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsVertexArrayOES, context, array);
+ if (context->skipValidation() || ValidateIsVertexArrayOES(context, array))
+ {
+ return context->isVertexArray(array);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsVertexArrayOES, GLboolean>();
+}
+
+void GL_APIENTRY LightModelfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LightModelf, context, pname, param);
+ if (context->skipValidation() || ValidateLightModelf(context, pname, param))
+ {
+ context->lightModelf(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY LightModelfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LightModelfv, context, pname, params);
+ if (context->skipValidation() || ValidateLightModelfv(context, pname, params))
+ {
+ context->lightModelfv(pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY LightModelxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed param = 0x%X)", pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LightModelx, context, pname, param);
+ if (context->skipValidation() || ValidateLightModelx(context, pname, param))
+ {
+ context->lightModelx(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY LightModelxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *param)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfixed *param = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LightModelxv, context, pname, param);
+ if (context->skipValidation() || ValidateLightModelxv(context, pname, param))
+ {
+ context->lightModelxv(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY LightfContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", light, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightf, context, light, pnamePacked, param);
+ if (context->skipValidation() || ValidateLightf(context, light, pnamePacked, param))
+ {
+ context->lightf(light, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY LightfvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ const GLfloat *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ light, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightfv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateLightfv(context, light, pnamePacked, params))
+ {
+ context->lightfv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY LightxContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", light, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightx, context, light, pnamePacked, param);
+ if (context->skipValidation() || ValidateLightx(context, light, pnamePacked, param))
+ {
+ context->lightx(light, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY LightxvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ const GLfixed *params)
+{
+ EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ light, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ LightParameter pnamePacked = FromGLenum<LightParameter>(pname);
+ ANGLE_CAPTURE(Lightxv, context, light, pnamePacked, params);
+ if (context->skipValidation() || ValidateLightxv(context, light, pnamePacked, params))
+ {
+ context->lightxv(light, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY LineWidthContextANGLE(GLeglContext ctx, GLfloat width)
+{
+ EVENT("(GLfloat width = %f)", width);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LineWidth, context, width);
+ if (context->skipValidation() || ValidateLineWidth(context, width))
+ {
+ context->lineWidth(width);
+ }
+ }
+}
+
+void GL_APIENTRY LineWidthxContextANGLE(GLeglContext ctx, GLfixed width)
+{
+ EVENT("(GLfixed width = 0x%X)", width);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LineWidthx, context, width);
+ if (context->skipValidation() || ValidateLineWidthx(context, width))
+ {
+ context->lineWidthx(width);
+ }
+ }
+}
+
+void GL_APIENTRY LinkProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LinkProgram, context, program);
+ if (context->skipValidation() || ValidateLinkProgram(context, program))
+ {
+ context->linkProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY LoadIdentityContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LoadIdentity, context);
+ if (context->skipValidation() || ValidateLoadIdentity(context))
+ {
+ context->loadIdentity();
+ }
+ }
+}
+
+void GL_APIENTRY LoadMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m)
+{
+ EVENT("(const GLfloat *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LoadMatrixf, context, m);
+ if (context->skipValidation() || ValidateLoadMatrixf(context, m))
+ {
+ context->loadMatrixf(m);
+ }
+ }
+}
+
+void GL_APIENTRY LoadMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m)
+{
+ EVENT("(const GLfixed *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LoadMatrixx, context, m);
+ if (context->skipValidation() || ValidateLoadMatrixx(context, m))
+ {
+ context->loadMatrixx(m);
+ }
+ }
+}
+
+void GL_APIENTRY LoadPaletteFromModelViewMatrixOESContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(LoadPaletteFromModelViewMatrixOES, context);
+ if (context->skipValidation() || ValidateLoadPaletteFromModelViewMatrixOES(context))
+ {
+ context->loadPaletteFromModelViewMatrix();
+ }
+ }
+}
+
+void GL_APIENTRY LogicOpContextANGLE(GLeglContext ctx, GLenum opcode)
+{
+ EVENT("(GLenum opcode = 0x%X)", opcode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ LogicalOperation opcodePacked = FromGLenum<LogicalOperation>(opcode);
+ ANGLE_CAPTURE(LogicOp, context, opcodePacked);
+ if (context->skipValidation() || ValidateLogicOp(context, opcodePacked))
+ {
+ context->logicOp(opcodePacked);
+ }
+ }
+}
+
+void *GL_APIENTRY MapBufferOESContextANGLE(GLeglContext ctx, GLenum target, GLenum access)
+{
+ EVENT("(GLenum target = 0x%X, GLenum access = 0x%X)", target, access);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(MapBufferOES, context, targetPacked, access);
+ if (context->skipValidation() || ValidateMapBufferOES(context, targetPacked, access))
+ {
+ return context->mapBuffer(targetPacked, access);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::MapBufferOES, void *>();
+}
+
+void *GL_APIENTRY MapBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu, GLbitfield "
+ "access = 0x%X)",
+ target, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
+ access);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(MapBufferRange, context, targetPacked, offset, length, access);
+ if (context->skipValidation() ||
+ ValidateMapBufferRange(context, targetPacked, offset, length, access))
+ {
+ return context->mapBufferRange(targetPacked, offset, length, access);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::MapBufferRange, void *>();
+}
+
+void *GL_APIENTRY MapBufferRangeEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLintptr offset = %llu, GLsizeiptr length = %llu, GLbitfield "
+ "access = 0x%X)",
+ target, static_cast<unsigned long long>(offset), static_cast<unsigned long long>(length),
+ access);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(MapBufferRangeEXT, context, targetPacked, offset, length, access);
+ if (context->skipValidation() ||
+ ValidateMapBufferRangeEXT(context, targetPacked, offset, length, access))
+ {
+ return context->mapBufferRange(targetPacked, offset, length, access);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::MapBufferRangeEXT, void *>();
+}
+
+void GL_APIENTRY MaterialfContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", face, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialf, context, face, pnamePacked, param);
+ if (context->skipValidation() || ValidateMaterialf(context, face, pnamePacked, param))
+ {
+ context->materialf(face, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY MaterialfvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ const GLfloat *params)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ face, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialfv, context, face, pnamePacked, params);
+ if (context->skipValidation() || ValidateMaterialfv(context, face, pnamePacked, params))
+ {
+ context->materialfv(face, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY MaterialxContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", face, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialx, context, face, pnamePacked, param);
+ if (context->skipValidation() || ValidateMaterialx(context, face, pnamePacked, param))
+ {
+ context->materialx(face, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY MaterialxvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ const GLfixed *param)
+{
+ EVENT("(GLenum face = 0x%X, GLenum pname = 0x%X, const GLfixed *param = 0x%016" PRIxPTR ")",
+ face, pname, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ MaterialParameter pnamePacked = FromGLenum<MaterialParameter>(pname);
+ ANGLE_CAPTURE(Materialxv, context, face, pnamePacked, param);
+ if (context->skipValidation() || ValidateMaterialxv(context, face, pnamePacked, param))
+ {
+ context->materialxv(face, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY MatrixIndexPointerOESContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MatrixIndexPointerOES, context, size, type, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateMatrixIndexPointerOES(context, size, type, stride, pointer))
+ {
+ context->matrixIndexPointer(size, type, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY MatrixModeContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ MatrixType modePacked = FromGLenum<MatrixType>(mode);
+ ANGLE_CAPTURE(MatrixMode, context, modePacked);
+ if (context->skipValidation() || ValidateMatrixMode(context, modePacked))
+ {
+ context->matrixMode(modePacked);
+ }
+ }
+}
+
+void GL_APIENTRY MaxShaderCompilerThreadsKHRContextANGLE(GLeglContext ctx, GLuint count)
+{
+ EVENT("(GLuint count = %u)", count);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MaxShaderCompilerThreadsKHR, context, count);
+ if (context->skipValidation() || ValidateMaxShaderCompilerThreadsKHR(context, count))
+ {
+ context->maxShaderCompilerThreads(count);
+ }
+ }
+}
+
+void GL_APIENTRY MemoryBarrierContextANGLE(GLeglContext ctx, GLbitfield barriers)
+{
+ EVENT("(GLbitfield barriers = 0x%X)", barriers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MemoryBarrier, context, barriers);
+ if (context->skipValidation() || ValidateMemoryBarrier(context, barriers))
+ {
+ context->memoryBarrier(barriers);
+ }
+ }
+}
+
+void GL_APIENTRY MemoryBarrierByRegionContextANGLE(GLeglContext ctx, GLbitfield barriers)
+{
+ EVENT("(GLbitfield barriers = 0x%X)", barriers);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MemoryBarrierByRegion, context, barriers);
+ if (context->skipValidation() || ValidateMemoryBarrierByRegion(context, barriers))
+ {
+ context->memoryBarrierByRegion(barriers);
+ }
+ }
+}
+
+void GL_APIENTRY MemoryObjectParameterivEXTContextANGLE(GLeglContext ctx,
+ GLuint memoryObject,
+ GLenum pname,
+ const GLint *params)
+{
+ EVENT("(GLuint memoryObject = %u, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR
+ ")",
+ memoryObject, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MemoryObjectParameterivEXT, context, memoryObject, pname, params);
+ if (context->skipValidation() ||
+ ValidateMemoryObjectParameterivEXT(context, memoryObject, pname, params))
+ {
+ context->memoryObjectParameteriv(memoryObject, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY MultMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m)
+{
+ EVENT("(const GLfloat *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MultMatrixf, context, m);
+ if (context->skipValidation() || ValidateMultMatrixf(context, m))
+ {
+ context->multMatrixf(m);
+ }
+ }
+}
+
+void GL_APIENTRY MultMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m)
+{
+ EVENT("(const GLfixed *m = 0x%016" PRIxPTR ")", (uintptr_t)m);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MultMatrixx, context, m);
+ if (context->skipValidation() || ValidateMultMatrixx(context, m))
+ {
+ context->multMatrixx(m);
+ }
+ }
+}
+
+void GL_APIENTRY MultiTexCoord4fContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLfloat s,
+ GLfloat t,
+ GLfloat r,
+ GLfloat q)
+{
+ EVENT("(GLenum target = 0x%X, GLfloat s = %f, GLfloat t = %f, GLfloat r = %f, GLfloat q = %f)",
+ target, s, t, r, q);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MultiTexCoord4f, context, target, s, t, r, q);
+ if (context->skipValidation() || ValidateMultiTexCoord4f(context, target, s, t, r, q))
+ {
+ context->multiTexCoord4f(target, s, t, r, q);
+ }
+ }
+}
+
+void GL_APIENTRY MultiTexCoord4xContextANGLE(GLeglContext ctx,
+ GLenum texture,
+ GLfixed s,
+ GLfixed t,
+ GLfixed r,
+ GLfixed q)
+{
+ EVENT(
+ "(GLenum texture = 0x%X, GLfixed s = 0x%X, GLfixed t = 0x%X, GLfixed r = 0x%X, GLfixed q = "
+ "0x%X)",
+ texture, s, t, r, q);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MultiTexCoord4x, context, texture, s, t, r, q);
+ if (context->skipValidation() || ValidateMultiTexCoord4x(context, texture, s, t, r, q))
+ {
+ context->multiTexCoord4x(texture, s, t, r, q);
+ }
+ }
+}
+
+void GL_APIENTRY Normal3fContextANGLE(GLeglContext ctx, GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ EVENT("(GLfloat nx = %f, GLfloat ny = %f, GLfloat nz = %f)", nx, ny, nz);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Normal3f, context, nx, ny, nz);
+ if (context->skipValidation() || ValidateNormal3f(context, nx, ny, nz))
+ {
+ context->normal3f(nx, ny, nz);
+ }
+ }
+}
+
+void GL_APIENTRY Normal3xContextANGLE(GLeglContext ctx, GLfixed nx, GLfixed ny, GLfixed nz)
+{
+ EVENT("(GLfixed nx = 0x%X, GLfixed ny = 0x%X, GLfixed nz = 0x%X)", nx, ny, nz);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Normal3x, context, nx, ny, nz);
+ if (context->skipValidation() || ValidateNormal3x(context, nx, ny, nz))
+ {
+ context->normal3x(nx, ny, nz);
+ }
+ }
+}
+
+void GL_APIENTRY NormalPointerContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT("(GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR ")",
+ type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(NormalPointer, context, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateNormalPointer(context, typePacked, stride, pointer))
+ {
+ context->normalPointer(typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY ObjectLabelKHRContextANGLE(GLeglContext ctx,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label)
+{
+ EVENT(
+ "(GLenum identifier = 0x%X, GLuint name = %u, GLsizei length = %d, const GLchar *label = "
+ "0x%016" PRIxPTR ")",
+ identifier, name, length, (uintptr_t)label);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ObjectLabelKHR, context, identifier, name, length, label);
+ if (context->skipValidation() ||
+ ValidateObjectLabelKHR(context, identifier, name, length, label))
+ {
+ context->objectLabel(identifier, name, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY ObjectPtrLabelKHRContextANGLE(GLeglContext ctx,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label)
+{
+ EVENT("(const void *ptr = 0x%016" PRIxPTR
+ ", GLsizei length = %d, const GLchar *label = 0x%016" PRIxPTR ")",
+ (uintptr_t)ptr, length, (uintptr_t)label);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ObjectPtrLabelKHR, context, ptr, length, label);
+ if (context->skipValidation() || ValidateObjectPtrLabelKHR(context, ptr, length, label))
+ {
+ context->objectPtrLabel(ptr, length, label);
+ }
+ }
+}
+
+void GL_APIENTRY OrthofContextANGLE(GLeglContext ctx,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f)
+{
+ EVENT(
+ "(GLfloat l = %f, GLfloat r = %f, GLfloat b = %f, GLfloat t = %f, GLfloat n = %f, GLfloat "
+ "f = %f)",
+ l, r, b, t, n, f);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Orthof, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateOrthof(context, l, r, b, t, n, f))
+ {
+ context->orthof(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY OrthoxContextANGLE(GLeglContext ctx,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f)
+{
+ EVENT(
+ "(GLfixed l = 0x%X, GLfixed r = 0x%X, GLfixed b = 0x%X, GLfixed t = 0x%X, GLfixed n = "
+ "0x%X, GLfixed f = 0x%X)",
+ l, r, b, t, n, f);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Orthox, context, l, r, b, t, n, f);
+ if (context->skipValidation() || ValidateOrthox(context, l, r, b, t, n, f))
+ {
+ context->orthox(l, r, b, t, n, f);
+ }
+ }
+}
+
+void GL_APIENTRY PauseTransformFeedbackContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PauseTransformFeedback, context);
+ if (context->skipValidation() || ValidatePauseTransformFeedback(context))
+ {
+ context->pauseTransformFeedback();
+ }
+ }
+}
+
+void GL_APIENTRY PixelStoreiContextANGLE(GLeglContext ctx, GLenum pname, GLint param)
+{
+ EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PixelStorei, context, pname, param);
+ if (context->skipValidation() || ValidatePixelStorei(context, pname, param))
+ {
+ context->pixelStorei(pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterf, context, pnamePacked, param);
+ if (context->skipValidation() || ValidatePointParameterf(context, pnamePacked, param))
+ {
+ context->pointParameterf(pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterfv, context, pnamePacked, params);
+ if (context->skipValidation() || ValidatePointParameterfv(context, pnamePacked, params))
+ {
+ context->pointParameterfv(pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum pname = 0x%X, GLfixed param = 0x%X)", pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterx, context, pnamePacked, param);
+ if (context->skipValidation() || ValidatePointParameterx(context, pnamePacked, param))
+ {
+ context->pointParameterx(pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY PointParameterxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *params)
+{
+ EVENT("(GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")", pname,
+ (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PointParameter pnamePacked = FromGLenum<PointParameter>(pname);
+ ANGLE_CAPTURE(PointParameterxv, context, pnamePacked, params);
+ if (context->skipValidation() || ValidatePointParameterxv(context, pnamePacked, params))
+ {
+ context->pointParameterxv(pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY PointSizeContextANGLE(GLeglContext ctx, GLfloat size)
+{
+ EVENT("(GLfloat size = %f)", size);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PointSize, context, size);
+ if (context->skipValidation() || ValidatePointSize(context, size))
+ {
+ context->pointSize(size);
+ }
+ }
+}
+
+void GL_APIENTRY PointSizePointerOESContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT("(GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR ")",
+ type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(PointSizePointerOES, context, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidatePointSizePointerOES(context, typePacked, stride, pointer))
+ {
+ context->pointSizePointer(typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY PointSizexContextANGLE(GLeglContext ctx, GLfixed size)
+{
+ EVENT("(GLfixed size = 0x%X)", size);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PointSizex, context, size);
+ if (context->skipValidation() || ValidatePointSizex(context, size))
+ {
+ context->pointSizex(size);
+ }
+ }
+}
+
+void GL_APIENTRY PolygonOffsetContextANGLE(GLeglContext ctx, GLfloat factor, GLfloat units)
+{
+ EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PolygonOffset, context, factor, units);
+ if (context->skipValidation() || ValidatePolygonOffset(context, factor, units))
+ {
+ context->polygonOffset(factor, units);
+ }
+ }
+}
+
+void GL_APIENTRY PolygonOffsetxContextANGLE(GLeglContext ctx, GLfixed factor, GLfixed units)
+{
+ EVENT("(GLfixed factor = 0x%X, GLfixed units = 0x%X)", factor, units);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PolygonOffsetx, context, factor, units);
+ if (context->skipValidation() || ValidatePolygonOffsetx(context, factor, units))
+ {
+ context->polygonOffsetx(factor, units);
+ }
+ }
+}
+
+void GL_APIENTRY PopDebugGroupKHRContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PopDebugGroupKHR, context);
+ if (context->skipValidation() || ValidatePopDebugGroupKHR(context))
+ {
+ context->popDebugGroup();
+ }
+ }
+}
+
+void GL_APIENTRY PopGroupMarkerEXTContextANGLE(GLeglContext ctx)
+{
+ // Don't run an EVENT() macro on the EXT_debug_marker entry points.
+ // It can interfere with the debug events being set by the caller.
+ // EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PopGroupMarkerEXT, context);
+ if (context->skipValidation() || ValidatePopGroupMarkerEXT(context))
+ {
+ context->popGroupMarker();
+ }
+ }
+}
+
+void GL_APIENTRY PopMatrixContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PopMatrix, context);
+ if (context->skipValidation() || ValidatePopMatrix(context))
+ {
+ context->popMatrix();
+ }
+ }
+}
+
+void GL_APIENTRY ProgramBinaryContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length)
+{
+ EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const void *binary = 0x%016" PRIxPTR
+ ", GLsizei length = %d)",
+ program, binaryFormat, (uintptr_t)binary, length);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramBinary, context, program, binaryFormat, binary, length);
+ if (context->skipValidation() ||
+ ValidateProgramBinary(context, program, binaryFormat, binary, length))
+ {
+ context->programBinary(program, binaryFormat, binary, length);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramBinaryOESContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length)
+{
+ EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const void *binary = 0x%016" PRIxPTR
+ ", GLint length = %d)",
+ program, binaryFormat, (uintptr_t)binary, length);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramBinaryOES, context, program, binaryFormat, binary, length);
+ if (context->skipValidation() ||
+ ValidateProgramBinaryOES(context, program, binaryFormat, binary, length))
+ {
+ context->programBinary(program, binaryFormat, binary, length);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramParameteriContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLint value)
+{
+ EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", program, pname, value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramParameteri, context, program, pname, value);
+ if (context->skipValidation() || ValidateProgramParameteri(context, program, pname, value))
+ {
+ context->programParameteri(program, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %f)", program, location, v0);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform1f, context, program, location, v0);
+ if (context->skipValidation() || ValidateProgramUniform1f(context, program, location, v0))
+ {
+ context->programUniform1f(program, location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform1fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform1fv(context, program, location, count, value))
+ {
+ context->programUniform1fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d)", program, location, v0);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform1i, context, program, location, v0);
+ if (context->skipValidation() || ValidateProgramUniform1i(context, program, location, v0))
+ {
+ context->programUniform1i(program, location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform1iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform1iv(context, program, location, count, value))
+ {
+ context->programUniform1iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u)", program, location, v0);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform1ui, context, program, location, v0);
+ if (context->skipValidation() || ValidateProgramUniform1ui(context, program, location, v0))
+ {
+ context->programUniform1ui(program, location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform1uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform1uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform1uiv(context, program, location, count, value))
+ {
+ context->programUniform1uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f)", program,
+ location, v0, v1);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform2f, context, program, location, v0, v1);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2f(context, program, location, v0, v1))
+ {
+ context->programUniform2f(program, location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform2fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2fv(context, program, location, count, value))
+ {
+ context->programUniform2fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+ProgramUniform2iContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d)", program,
+ location, v0, v1);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform2i, context, program, location, v0, v1);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2i(context, program, location, v0, v1))
+ {
+ context->programUniform2i(program, location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform2iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2iv(context, program, location, count, value))
+ {
+ context->programUniform2iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u)", program,
+ location, v0, v1);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform2ui, context, program, location, v0, v1);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2ui(context, program, location, v0, v1))
+ {
+ context->programUniform2ui(program, location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform2uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform2uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform2uiv(context, program, location, count, value))
+ {
+ context->programUniform2uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = "
+ "%f)",
+ program, location, v0, v1, v2);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform3f, context, program, location, v0, v1, v2);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3f(context, program, location, v0, v1, v2))
+ {
+ context->programUniform3f(program, location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform3fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3fv(context, program, location, count, value))
+ {
+ context->programUniform3fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d)",
+ program, location, v0, v1, v2);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform3i, context, program, location, v0, v1, v2);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3i(context, program, location, v0, v1, v2))
+ {
+ context->programUniform3i(program, location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform3iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3iv(context, program, location, count, value))
+ {
+ context->programUniform3iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = "
+ "%u)",
+ program, location, v0, v1, v2);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform3ui, context, program, location, v0, v1, v2);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3ui(context, program, location, v0, v1, v2))
+ {
+ context->programUniform3ui(program, location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform3uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform3uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform3uiv(context, program, location, count, value))
+ {
+ context->programUniform3uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = "
+ "%f, GLfloat v3 = %f)",
+ program, location, v0, v1, v2, v3);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform4f, context, program, location, v0, v1, v2, v3);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4f(context, program, location, v0, v1, v2, v3))
+ {
+ context->programUniform4f(program, location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform4fv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4fv(context, program, location, count, value))
+ {
+ context->programUniform4fv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d, "
+ "GLint v3 = %d)",
+ program, location, v0, v1, v2, v3);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform4i, context, program, location, v0, v1, v2, v3);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4i(context, program, location, v0, v1, v2, v3))
+ {
+ context->programUniform4i(program, location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform4iv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4iv(context, program, location, count, value))
+ {
+ context->programUniform4iv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = "
+ "%u, GLuint v3 = %u)",
+ program, location, v0, v1, v2, v3);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform4ui, context, program, location, v0, v1, v2, v3);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4ui(context, program, location, v0, v1, v2, v3))
+ {
+ context->programUniform4ui(program, location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniform4uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint *value = "
+ "0x%016" PRIxPTR ")",
+ program, location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniform4uiv, context, program, location, count, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniform4uiv(context, program, location, count, value))
+ {
+ context->programUniform4uiv(program, location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix2fv, context, program, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix2fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix2fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix2x3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix2x3fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix2x3fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix2x3fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix2x4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix2x4fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix2x4fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix2x4fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix3fv, context, program, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix3fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix3fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix3x2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix3x2fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix3x2fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix3x2fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix3x4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix3x4fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix3x4fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix3x4fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix4fv, context, program, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix4fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix4fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix4x2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix4x2fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix4x2fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix4x2fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramUniformMatrix4x3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, "
+ "const GLfloat *value = 0x%016" PRIxPTR ")",
+ program, location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramUniformMatrix4x3fv, context, program, location, count, transpose,
+ value);
+ if (context->skipValidation() ||
+ ValidateProgramUniformMatrix4x3fv(context, program, location, count, transpose, value))
+ {
+ context->programUniformMatrix4x3fv(program, location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY PushDebugGroupKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message)
+{
+ EVENT(
+ "(GLenum source = 0x%X, GLuint id = %u, GLsizei length = %d, const GLchar *message = "
+ "0x%016" PRIxPTR ")",
+ source, id, length, (uintptr_t)message);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PushDebugGroupKHR, context, source, id, length, message);
+ if (context->skipValidation() ||
+ ValidatePushDebugGroupKHR(context, source, id, length, message))
+ {
+ context->pushDebugGroup(source, id, length, message);
+ }
+ }
+}
+
+void GL_APIENTRY PushGroupMarkerEXTContextANGLE(GLeglContext ctx,
+ GLsizei length,
+ const GLchar *marker)
+{
+ // Don't run an EVENT() macro on the EXT_debug_marker entry points.
+ // It can interfere with the debug events being set by the caller.
+ // EVENT("(GLsizei length = %d, const GLchar *marker = 0x%016" PRIxPTR ")", length,
+ // (uintptr_t)marker);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PushGroupMarkerEXT, context, length, marker);
+ if (context->skipValidation() || ValidatePushGroupMarkerEXT(context, length, marker))
+ {
+ context->pushGroupMarker(length, marker);
+ }
+ }
+}
+
+void GL_APIENTRY PushMatrixContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PushMatrix, context);
+ if (context->skipValidation() || ValidatePushMatrix(context))
+ {
+ context->pushMatrix();
+ }
+ }
+}
+
+void GL_APIENTRY QueryCounterEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum target)
+{
+ EVENT("(GLuint id = %u, GLenum target = 0x%X)", id, target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(QueryCounterEXT, context, id, targetPacked);
+ if (context->skipValidation() || ValidateQueryCounterEXT(context, id, targetPacked))
+ {
+ context->queryCounter(id, targetPacked);
+ }
+ }
+}
+
+GLbitfield GL_APIENTRY QueryMatrixxOESContextANGLE(GLeglContext ctx,
+ GLfixed *mantissa,
+ GLint *exponent)
+{
+ EVENT("(GLfixed *mantissa = 0x%016" PRIxPTR ", GLint *exponent = 0x%016" PRIxPTR ")",
+ (uintptr_t)mantissa, (uintptr_t)exponent);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(QueryMatrixxOES, context, mantissa, exponent);
+ if (context->skipValidation() || ValidateQueryMatrixxOES(context, mantissa, exponent))
+ {
+ return context->queryMatrixx(mantissa, exponent);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::QueryMatrixxOES, GLbitfield>();
+}
+
+void GL_APIENTRY ReadBufferContextANGLE(GLeglContext ctx, GLenum src)
+{
+ EVENT("(GLenum src = 0x%X)", src);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ReadBuffer, context, src);
+ if (context->skipValidation() || ValidateReadBuffer(context, src))
+ {
+ context->readBuffer(src);
+ }
+ }
+}
+
+void GL_APIENTRY ReadPixelsContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, void *pixels = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ReadPixels, context, x, y, width, height, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateReadPixels(context, x, y, width, height, format, type, pixels))
+ {
+ context->readPixels(x, y, width, height, format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY ReadnPixelsEXTContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, GLsizei bufSize = %d, void *data = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, bufSize, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ReadnPixelsEXT, context, x, y, width, height, format, type, bufSize, data);
+ if (context->skipValidation() ||
+ ValidateReadnPixelsEXT(context, x, y, width, height, format, type, bufSize, data))
+ {
+ context->readnPixels(x, y, width, height, format, type, bufSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY ReleaseShaderCompilerContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ReleaseShaderCompiler, context);
+ if (context->skipValidation() || ValidateReleaseShaderCompiler(context))
+ {
+ context->releaseShaderCompiler();
+ }
+ }
+}
+
+void GL_APIENTRY RenderbufferStorageContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = "
+ "%d)",
+ target, internalformat, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(RenderbufferStorage, context, target, internalformat, width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorage(context, target, internalformat, width, height))
+ {
+ context->renderbufferStorage(target, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY RenderbufferStorageMultisampleContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(RenderbufferStorageMultisample, context, target, samples, internalformat,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorageMultisample(context, target, samples, internalformat, width,
+ height))
+ {
+ context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY RenderbufferStorageMultisampleANGLEContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(RenderbufferStorageMultisampleANGLE, context, target, samples, internalformat,
+ width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorageMultisampleANGLE(context, target, samples, internalformat,
+ width, height))
+ {
+ context->renderbufferStorageMultisample(target, samples, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY RenderbufferStorageOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = "
+ "%d)",
+ target, internalformat, width, height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(RenderbufferStorageOES, context, target, internalformat, width, height);
+ if (context->skipValidation() ||
+ ValidateRenderbufferStorageOES(context, target, internalformat, width, height))
+ {
+ context->renderbufferStorage(target, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY ResumeTransformFeedbackContextANGLE(GLeglContext ctx)
+{
+ EVENT("()");
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ResumeTransformFeedback, context);
+ if (context->skipValidation() || ValidateResumeTransformFeedback(context))
+ {
+ context->resumeTransformFeedback();
+ }
+ }
+}
+
+void GL_APIENTRY
+RotatefContextANGLE(GLeglContext ctx, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLfloat angle = %f, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", angle, x, y, z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Rotatef, context, angle, x, y, z);
+ if (context->skipValidation() || ValidateRotatef(context, angle, x, y, z))
+ {
+ context->rotatef(angle, x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY
+RotatexContextANGLE(GLeglContext ctx, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+{
+ EVENT("(GLfixed angle = 0x%X, GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X)", angle, x,
+ y, z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Rotatex, context, angle, x, y, z);
+ if (context->skipValidation() || ValidateRotatex(context, angle, x, y, z))
+ {
+ context->rotatex(angle, x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY SampleCoverageContextANGLE(GLeglContext ctx, GLfloat value, GLboolean invert)
+{
+ EVENT("(GLfloat value = %f, GLboolean invert = %u)", value, invert);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SampleCoverage, context, value, invert);
+ if (context->skipValidation() || ValidateSampleCoverage(context, value, invert))
+ {
+ context->sampleCoverage(value, invert);
+ }
+ }
+}
+
+void GL_APIENTRY SampleCoveragexContextANGLE(GLeglContext ctx, GLclampx value, GLboolean invert)
+{
+ EVENT("(GLclampx value = 0x%X, GLboolean invert = %u)", value, invert);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SampleCoveragex, context, value, invert);
+ if (context->skipValidation() || ValidateSampleCoveragex(context, value, invert))
+ {
+ context->sampleCoveragex(value, invert);
+ }
+ }
+}
+
+void GL_APIENTRY SampleMaskiContextANGLE(GLeglContext ctx, GLuint maskNumber, GLbitfield mask)
+{
+ EVENT("(GLuint maskNumber = %u, GLbitfield mask = 0x%X)", maskNumber, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SampleMaski, context, maskNumber, mask);
+ if (context->skipValidation() || ValidateSampleMaski(context, maskNumber, mask))
+ {
+ context->sampleMaski(maskNumber, mask);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLint *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterIivOES, context, sampler, pname, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIivOES(context, sampler, pname, param))
+ {
+ context->samplerParameterIiv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLuint *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterIuivOES, context, sampler, pname, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIuivOES(context, sampler, pname, param))
+ {
+ context->samplerParameterIuiv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterfContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %f)", sampler, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterf, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameterf(context, sampler, pname, param))
+ {
+ context->samplerParameterf(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterfvContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLfloat *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLfloat *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterfv, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameterfv(context, sampler, pname, param))
+ {
+ context->samplerParameterfv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameteriContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameteri, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameteri(context, sampler, pname, param))
+ {
+ context->samplerParameteri(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterivContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param)
+{
+ EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLint *param = 0x%016" PRIxPTR ")",
+ sampler, pname, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameteriv, context, sampler, pname, param);
+ if (context->skipValidation() || ValidateSamplerParameteriv(context, sampler, pname, param))
+ {
+ context->samplerParameteriv(sampler, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY ScalefContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", x, y, z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Scalef, context, x, y, z);
+ if (context->skipValidation() || ValidateScalef(context, x, y, z))
+ {
+ context->scalef(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY ScalexContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z)
+{
+ EVENT("(GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X)", x, y, z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Scalex, context, x, y, z);
+ if (context->skipValidation() || ValidateScalex(context, x, y, z))
+ {
+ context->scalex(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY
+ScissorContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width,
+ height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Scissor, context, x, y, width, height);
+ if (context->skipValidation() || ValidateScissor(context, x, y, width, height))
+ {
+ context->scissor(x, y, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY SemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params)
+{
+ EVENT("(GLuint semaphore = %u, GLenum pname = 0x%X, const GLuint64 *params = 0x%016" PRIxPTR
+ ")",
+ semaphore, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SemaphoreParameterui64vEXT, context, semaphore, pname, params);
+ if (context->skipValidation() ||
+ ValidateSemaphoreParameterui64vEXT(context, semaphore, pname, params))
+ {
+ context->semaphoreParameterui64v(semaphore, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY SetFenceNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum condition)
+{
+ EVENT("(GLuint fence = %u, GLenum condition = 0x%X)", fence, condition);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SetFenceNV, context, fence, condition);
+ if (context->skipValidation() || ValidateSetFenceNV(context, fence, condition))
+ {
+ context->setFenceNV(fence, condition);
+ }
+ }
+}
+
+void GL_APIENTRY ShadeModelContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ShadingModel modePacked = FromGLenum<ShadingModel>(mode);
+ ANGLE_CAPTURE(ShadeModel, context, modePacked);
+ if (context->skipValidation() || ValidateShadeModel(context, modePacked))
+ {
+ context->shadeModel(modePacked);
+ }
+ }
+}
+
+void GL_APIENTRY ShaderBinaryContextANGLE(GLeglContext ctx,
+ GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length)
+{
+ EVENT("(GLsizei count = %d, const GLuint *shaders = 0x%016" PRIxPTR
+ ", GLenum binaryformat = 0x%X, const void *binary = 0x%016" PRIxPTR
+ ", GLsizei length = %d)",
+ count, (uintptr_t)shaders, binaryformat, (uintptr_t)binary, length);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ShaderBinary, context, count, shaders, binaryformat, binary, length);
+ if (context->skipValidation() ||
+ ValidateShaderBinary(context, count, shaders, binaryformat, binary, length))
+ {
+ context->shaderBinary(count, shaders, binaryformat, binary, length);
+ }
+ }
+}
+
+void GL_APIENTRY ShaderSourceContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length)
+{
+ EVENT("(GLuint shader = %u, GLsizei count = %d, const GLchar *const*string = 0x%016" PRIxPTR
+ ", const GLint *length = 0x%016" PRIxPTR ")",
+ shader, count, (uintptr_t)string, (uintptr_t)length);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ShaderSource, context, shader, count, string, length);
+ if (context->skipValidation() ||
+ ValidateShaderSource(context, shader, count, string, length))
+ {
+ context->shaderSource(shader, count, string, length);
+ }
+ }
+}
+
+void GL_APIENTRY SignalSemaphoreEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts)
+{
+ EVENT(
+ "(GLuint semaphore = %u, GLuint numBufferBarriers = %u, const GLuint *buffers = "
+ "0x%016" PRIxPTR ", GLuint numTextureBarriers = %u, const GLuint *textures = 0x%016" PRIxPTR
+ ", const GLenum *dstLayouts = 0x%016" PRIxPTR ")",
+ semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers, (uintptr_t)textures,
+ (uintptr_t)dstLayouts);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SignalSemaphoreEXT, context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, dstLayouts);
+ if (context->skipValidation() ||
+ ValidateSignalSemaphoreEXT(context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, dstLayouts))
+ {
+ context->signalSemaphore(semaphore, numBufferBarriers, buffers, numTextureBarriers,
+ textures, dstLayouts);
+ }
+ }
+}
+
+void GL_APIENTRY StencilFuncContextANGLE(GLeglContext ctx, GLenum func, GLint ref, GLuint mask)
+{
+ EVENT("(GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", func, ref, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilFunc, context, func, ref, mask);
+ if (context->skipValidation() || ValidateStencilFunc(context, func, ref, mask))
+ {
+ context->stencilFunc(func, ref, mask);
+ }
+ }
+}
+
+void GL_APIENTRY
+StencilFuncSeparateContextANGLE(GLeglContext ctx, GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ EVENT("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", face, func,
+ ref, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilFuncSeparate, context, face, func, ref, mask);
+ if (context->skipValidation() ||
+ ValidateStencilFuncSeparate(context, face, func, ref, mask))
+ {
+ context->stencilFuncSeparate(face, func, ref, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilMaskContextANGLE(GLeglContext ctx, GLuint mask)
+{
+ EVENT("(GLuint mask = %u)", mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilMask, context, mask);
+ if (context->skipValidation() || ValidateStencilMask(context, mask))
+ {
+ context->stencilMask(mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilMaskSeparateContextANGLE(GLeglContext ctx, GLenum face, GLuint mask)
+{
+ EVENT("(GLenum face = 0x%X, GLuint mask = %u)", face, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilMaskSeparate, context, face, mask);
+ if (context->skipValidation() || ValidateStencilMaskSeparate(context, face, mask))
+ {
+ context->stencilMaskSeparate(face, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilOpContextANGLE(GLeglContext ctx, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ EVENT("(GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpass = 0x%X)", fail, zfail, zpass);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilOp, context, fail, zfail, zpass);
+ if (context->skipValidation() || ValidateStencilOp(context, fail, zfail, zpass))
+ {
+ context->stencilOp(fail, zfail, zpass);
+ }
+ }
+}
+
+void GL_APIENTRY StencilOpSeparateContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum sfail,
+ GLenum dpfail,
+ GLenum dppass)
+{
+ EVENT("(GLenum face = 0x%X, GLenum sfail = 0x%X, GLenum dpfail = 0x%X, GLenum dppass = 0x%X)",
+ face, sfail, dpfail, dppass);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilOpSeparate, context, face, sfail, dpfail, dppass);
+ if (context->skipValidation() ||
+ ValidateStencilOpSeparate(context, face, sfail, dpfail, dppass))
+ {
+ context->stencilOpSeparate(face, sfail, dpfail, dppass);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY TestFenceNVContextANGLE(GLeglContext ctx, GLuint fence)
+{
+ EVENT("(GLuint fence = %u)", fence);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TestFenceNV, context, fence);
+ if (context->skipValidation() || ValidateTestFenceNV(context, fence))
+ {
+ return context->testFenceNV(fence);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::TestFenceNV, GLboolean>();
+}
+
+void GL_APIENTRY TexCoordPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(TexCoordPointer, context, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateTexCoordPointer(context, size, typePacked, stride, pointer))
+ {
+ context->texCoordPointer(size, typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvfContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvf, context, targetPacked, pnamePacked, param);
+ if (context->skipValidation() || ValidateTexEnvf(context, targetPacked, pnamePacked, param))
+ {
+ context->texEnvf(targetPacked, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvfv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateTexEnvfv(context, targetPacked, pnamePacked, params))
+ {
+ context->texEnvfv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnviContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvi, context, targetPacked, pnamePacked, param);
+ if (context->skipValidation() || ValidateTexEnvi(context, targetPacked, pnamePacked, param))
+ {
+ context->texEnvi(targetPacked, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnviv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateTexEnviv(context, targetPacked, pnamePacked, params))
+ {
+ context->texEnviv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvxContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", target, pname,
+ param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvx, context, targetPacked, pnamePacked, param);
+ if (context->skipValidation() || ValidateTexEnvx(context, targetPacked, pnamePacked, param))
+ {
+ context->texEnvx(targetPacked, pnamePacked, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexEnvxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureEnvTarget targetPacked = FromGLenum<TextureEnvTarget>(target);
+ TextureEnvParameter pnamePacked = FromGLenum<TextureEnvParameter>(pname);
+ ANGLE_CAPTURE(TexEnvxv, context, targetPacked, pnamePacked, params);
+ if (context->skipValidation() ||
+ ValidateTexEnvxv(context, targetPacked, pnamePacked, params))
+ {
+ context->texEnvxv(targetPacked, pnamePacked, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenfOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfloat param)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", coord, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TexGenfOES, context, coord, pname, param);
+ if (context->skipValidation() || ValidateTexGenfOES(context, coord, pname, param))
+ {
+ context->texGenf(coord, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenfvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLfloat *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ coord, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TexGenfvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateTexGenfvOES(context, coord, pname, params))
+ {
+ context->texGenfv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexGeniOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLint param)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLint param = %d)", coord, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TexGeniOES, context, coord, pname, param);
+ if (context->skipValidation() || ValidateTexGeniOES(context, coord, pname, param))
+ {
+ context->texGeni(coord, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenivOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLint *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ coord, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TexGenivOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateTexGenivOES(context, coord, pname, params))
+ {
+ context->texGeniv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenxOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLfixed param)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", coord, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TexGenxOES, context, coord, pname, param);
+ if (context->skipValidation() || ValidateTexGenxOES(context, coord, pname, param))
+ {
+ context->texGenx(coord, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexGenxvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLfixed *params)
+{
+ EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ coord, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TexGenxvOES, context, coord, pname, params);
+ if (context->skipValidation() || ValidateTexGenxvOES(context, coord, pname, params))
+ {
+ context->texGenxv(coord, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const "
+ "void *pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, format, type, (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage2D, context, targetPacked, level, internalformat, width, height,
+ border, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage2D(context, targetPacked, level, internalformat, width, height, border,
+ format, type, pixels))
+ {
+ context->texImage2D(targetPacked, level, internalformat, width, height, border, format,
+ type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *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 void *pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage3D, context, targetPacked, level, internalformat, width, height,
+ depth, border, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage3D(context, targetPacked, level, internalformat, width, height, depth,
+ border, format, type, pixels))
+ {
+ context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
+ format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, "
+ "GLenum type = 0x%X, const void *pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage3DOES, context, targetPacked, level, internalformat, width, height,
+ depth, border, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage3DOES(context, targetPacked, level, internalformat, width, height,
+ depth, border, format, type, pixels))
+ {
+ context->texImage3D(targetPacked, level, internalformat, width, height, depth, border,
+ format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIivOES(context, targetPacked, pname, params))
+ {
+ context->texParameterIiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLuint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLuint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIuivOES, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIuivOES(context, targetPacked, pname, params))
+ {
+ context->texParameterIuiv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterfContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterf, context, targetPacked, pname, param);
+ if (context->skipValidation() || ValidateTexParameterf(context, targetPacked, pname, param))
+ {
+ context->texParameterf(targetPacked, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterfv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterfv(context, targetPacked, pname, params))
+ {
+ context->texParameterfv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameteriContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameteri, context, targetPacked, pname, param);
+ if (context->skipValidation() || ValidateTexParameteri(context, targetPacked, pname, param))
+ {
+ context->texParameteri(targetPacked, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameteriv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameteriv(context, targetPacked, pname, params))
+ {
+ context->texParameteriv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterxContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed param)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", target, pname,
+ param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterx, context, targetPacked, pname, param);
+ if (context->skipValidation() || ValidateTexParameterx(context, targetPacked, pname, param))
+ {
+ context->texParameterx(targetPacked, pname, param);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfixed *params)
+{
+ EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%016" PRIxPTR ")",
+ target, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterxv, context, targetPacked, pname, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterxv(context, targetPacked, pname, params))
+ {
+ context->texParameterxv(targetPacked, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage1DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d)",
+ target, levels, internalformat, width);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TexStorage1DEXT, context, target, levels, internalformat, width);
+ if (context->skipValidation() ||
+ ValidateTexStorage1DEXT(context, target, levels, internalformat, width))
+ {
+ context->texStorage1D(target, levels, internalformat, width);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage2DContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2D, context, targetPacked, levels, internalformat, width, height);
+ if (context->skipValidation() ||
+ ValidateTexStorage2D(context, targetPacked, levels, internalformat, width, height))
+ {
+ context->texStorage2D(targetPacked, levels, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage2DEXTContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2DEXT, context, targetPacked, levels, internalformat, width,
+ height);
+ if (context->skipValidation() ||
+ ValidateTexStorage2DEXT(context, targetPacked, levels, internalformat, width, height))
+ {
+ context->texStorage2D(targetPacked, levels, internalformat, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage2DMultisampleContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLboolean fixedsamplelocations = %u)",
+ target, samples, internalformat, width, height, fixedsamplelocations);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2DMultisample, context, targetPacked, samples, internalformat,
+ width, height, fixedsamplelocations);
+ if (context->skipValidation() ||
+ ValidateTexStorage2DMultisample(context, targetPacked, samples, internalformat, width,
+ height, fixedsamplelocations))
+ {
+ context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
+ fixedsamplelocations);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage3DContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage3D, context, targetPacked, levels, internalformat, width, height,
+ depth);
+ if (context->skipValidation() || ValidateTexStorage3D(context, targetPacked, levels,
+ internalformat, width, height, depth))
+ {
+ context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage3DEXTContextANGLE(GLeglContext ctx,
+ 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage3DEXT, context, targetPacked, levels, internalformat, width, height,
+ depth);
+ if (context->skipValidation() ||
+ ValidateTexStorage3DEXT(context, targetPacked, levels, internalformat, width, height,
+ depth))
+ {
+ context->texStorage3D(targetPacked, levels, internalformat, width, height, depth);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage3DMultisampleOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLsizei depth = %d, GLboolean fixedsamplelocations = %u)",
+ target, samples, internalformat, width, height, depth, fixedsamplelocations);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage3DMultisampleOES, context, targetPacked, samples, internalformat,
+ width, height, depth, fixedsamplelocations);
+ if (context->skipValidation() ||
+ ValidateTexStorage3DMultisampleOES(context, targetPacked, samples, internalformat,
+ width, height, depth, fixedsamplelocations))
+ {
+ context->texStorage3DMultisample(targetPacked, samples, internalformat, width, height,
+ depth, fixedsamplelocations);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem2DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalFormat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLuint memory = %u, GLuint64 offset = %llu)",
+ target, levels, internalFormat, width, height, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem2DEXT, context, targetPacked, levels, internalFormat, width,
+ height, memory, offset);
+ if (context->skipValidation() ||
+ ValidateTexStorageMem2DEXT(context, targetPacked, levels, internalFormat, width, height,
+ memory, offset))
+ {
+ context->texStorageMem2D(targetPacked, levels, internalFormat, width, height, memory,
+ offset);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem2DMultisampleEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalFormat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLboolean fixedSampleLocations = %u, GLuint memory = %u, "
+ "GLuint64 offset = %llu)",
+ target, samples, internalFormat, width, height, fixedSampleLocations, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem2DMultisampleEXT, context, targetPacked, samples, internalFormat,
+ width, height, fixedSampleLocations, memory, offset);
+ if (context->skipValidation() || ValidateTexStorageMem2DMultisampleEXT(
+ context, targetPacked, samples, internalFormat, width,
+ height, fixedSampleLocations, memory, offset))
+ {
+ context->texStorageMem2DMultisample(targetPacked, samples, internalFormat, width,
+ height, fixedSampleLocations, memory, offset);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem3DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalFormat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLsizei depth = %d, GLuint memory = %u, GLuint64 offset = %llu)",
+ target, levels, internalFormat, width, height, depth, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem3DEXT, context, targetPacked, levels, internalFormat, width,
+ height, depth, memory, offset);
+ if (context->skipValidation() ||
+ ValidateTexStorageMem3DEXT(context, targetPacked, levels, internalFormat, width, height,
+ depth, memory, offset))
+ {
+ context->texStorageMem3D(targetPacked, levels, internalFormat, width, height, depth,
+ memory, offset);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorageMem3DMultisampleEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalFormat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLsizei depth = %d, GLboolean fixedSampleLocations = %u, "
+ "GLuint memory = %u, GLuint64 offset = %llu)",
+ target, samples, internalFormat, width, height, depth, fixedSampleLocations, memory,
+ static_cast<unsigned long long>(offset));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorageMem3DMultisampleEXT, context, targetPacked, samples, internalFormat,
+ width, height, depth, fixedSampleLocations, memory, offset);
+ if (context->skipValidation() || ValidateTexStorageMem3DMultisampleEXT(
+ context, targetPacked, samples, internalFormat, width,
+ height, depth, fixedSampleLocations, memory, offset))
+ {
+ context->texStorageMem3DMultisample(targetPacked, samples, internalFormat, width,
+ height, depth, fixedSampleLocations, memory,
+ offset);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei "
+ "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, const void "
+ "*pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, type, (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage2D, context, targetPacked, level, xoffset, yoffset, width, height,
+ format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage2D(context, targetPacked, level, xoffset, yoffset, width, height,
+ format, type, pixels))
+ {
+ context->texSubImage2D(targetPacked, level, xoffset, yoffset, width, height, format,
+ type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *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 void *pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage3D, context, targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels))
+ {
+ context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *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 void *pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type,
+ (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage3DOES, context, targetPacked, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage3DOES(context, targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels))
+ {
+ context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, type, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TransformFeedbackVaryingsContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar *const*varyings = 0x%016" PRIxPTR
+ ", GLenum bufferMode = 0x%X)",
+ program, count, (uintptr_t)varyings, bufferMode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(TransformFeedbackVaryings, context, program, count, varyings, bufferMode);
+ if (context->skipValidation() ||
+ ValidateTransformFeedbackVaryings(context, program, count, varyings, bufferMode))
+ {
+ context->transformFeedbackVaryings(program, count, varyings, bufferMode);
+ }
+ }
+}
+
+void GL_APIENTRY TranslatefContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", x, y, z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Translatef, context, x, y, z);
+ if (context->skipValidation() || ValidateTranslatef(context, x, y, z))
+ {
+ context->translatef(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY TranslatexContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z)
+{
+ EVENT("(GLfixed x = 0x%X, GLfixed y = 0x%X, GLfixed z = 0x%X)", x, y, z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Translatex, context, x, y, z);
+ if (context->skipValidation() || ValidateTranslatex(context, x, y, z))
+ {
+ context->translatex(x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0)
+{
+ EVENT("(GLint location = %d, GLfloat v0 = %f)", location, v0);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform1f, context, location, v0);
+ if (context->skipValidation() || ValidateUniform1f(context, location, v0))
+ {
+ context->uniform1f(location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform1fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform1fv(context, location, count, value))
+ {
+ context->uniform1fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1iContextANGLE(GLeglContext ctx, GLint location, GLint v0)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d)", location, v0);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform1i, context, location, v0);
+ if (context->skipValidation() || ValidateUniform1i(context, location, v0))
+ {
+ context->uniform1i(location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform1iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform1iv(context, location, count, value))
+ {
+ context->uniform1iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u)", location, v0);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform1ui, context, location, v0);
+ if (context->skipValidation() || ValidateUniform1ui(context, location, v0))
+ {
+ context->uniform1ui(location, v0);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform1uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform1uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform1uiv(context, location, count, value))
+ {
+ context->uniform1uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1)
+{
+ EVENT("(GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f)", location, v0, v1);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform2f, context, location, v0, v1);
+ if (context->skipValidation() || ValidateUniform2f(context, location, v0, v1))
+ {
+ context->uniform2f(location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform2fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform2fv(context, location, count, value))
+ {
+ context->uniform2fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d, GLint v1 = %d)", location, v0, v1);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform2i, context, location, v0, v1);
+ if (context->skipValidation() || ValidateUniform2i(context, location, v0, v1))
+ {
+ context->uniform2i(location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform2iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform2iv(context, location, count, value))
+ {
+ context->uniform2iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u, GLuint v1 = %u)", location, v0, v1);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform2ui, context, location, v0, v1);
+ if (context->skipValidation() || ValidateUniform2ui(context, location, v0, v1))
+ {
+ context->uniform2ui(location, v0, v1);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform2uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform2uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform2uiv(context, location, count, value))
+ {
+ context->uniform2uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+Uniform3fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ EVENT("(GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = %f)", location, v0,
+ v1, v2);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform3f, context, location, v0, v1, v2);
+ if (context->skipValidation() || ValidateUniform3f(context, location, v0, v1, v2))
+ {
+ context->uniform3f(location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform3fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform3fv(context, location, count, value))
+ {
+ context->uniform3fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+Uniform3iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d)", location, v0, v1,
+ v2);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform3i, context, location, v0, v1, v2);
+ if (context->skipValidation() || ValidateUniform3i(context, location, v0, v1, v2))
+ {
+ context->uniform3i(location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform3iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform3iv(context, location, count, value))
+ {
+ context->uniform3iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+Uniform3uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = %u)", location, v0, v1,
+ v2);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform3ui, context, location, v0, v1, v2);
+ if (context->skipValidation() || ValidateUniform3ui(context, location, v0, v1, v2))
+ {
+ context->uniform3ui(location, v0, v1, v2);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform3uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform3uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform3uiv(context, location, count, value))
+ {
+ context->uniform3uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4fContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3)
+{
+ EVENT(
+ "(GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = %f, GLfloat v3 = %f)",
+ location, v0, v1, v2, v3);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform4f, context, location, v0, v1, v2, v3);
+ if (context->skipValidation() || ValidateUniform4f(context, location, v0, v1, v2, v3))
+ {
+ context->uniform4f(location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform4fv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform4fv(context, location, count, value))
+ {
+ context->uniform4fv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+Uniform4iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ EVENT("(GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d, GLint v3 = %d)",
+ location, v0, v1, v2, v3);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform4i, context, location, v0, v1, v2, v3);
+ if (context->skipValidation() || ValidateUniform4i(context, location, v0, v1, v2, v3))
+ {
+ context->uniform4i(location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform4iv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform4iv(context, location, count, value))
+ {
+ context->uniform4iv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY
+Uniform4uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ EVENT("(GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = %u, GLuint v3 = %u)",
+ location, v0, v1, v2, v3);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform4ui, context, location, v0, v1, v2, v3);
+ if (context->skipValidation() || ValidateUniform4ui(context, location, v0, v1, v2, v3))
+ {
+ context->uniform4ui(location, v0, v1, v2, v3);
+ }
+ }
+}
+
+void GL_APIENTRY Uniform4uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ EVENT("(GLint location = %d, GLsizei count = %d, const GLuint *value = 0x%016" PRIxPTR ")",
+ location, count, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Uniform4uiv, context, location, count, value);
+ if (context->skipValidation() || ValidateUniform4uiv(context, location, count, value))
+ {
+ context->uniform4uiv(location, count, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformBlockBindingContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding)
+{
+ EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)",
+ program, uniformBlockIndex, uniformBlockBinding);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformBlockBinding, context, program, uniformBlockIndex,
+ uniformBlockBinding);
+ if (context->skipValidation() ||
+ ValidateUniformBlockBinding(context, program, uniformBlockIndex, uniformBlockBinding))
+ {
+ context->uniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix2fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix2fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix2fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix2x3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix2x3fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix2x3fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix2x3fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix2x4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix2x4fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix2x4fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix2x4fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix3fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix3fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix3fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix3x2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix3x2fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix3x2fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix3x2fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix3x4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix3x4fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix3x4fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix3x4fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix4fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix4fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix4fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix4x2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix4x2fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix4x2fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix4x2fv(location, count, transpose, value);
+ }
+ }
+}
+
+void GL_APIENTRY UniformMatrix4x3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ EVENT(
+ "(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat *value "
+ "= 0x%016" PRIxPTR ")",
+ location, count, transpose, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UniformMatrix4x3fv, context, location, count, transpose, value);
+ if (context->skipValidation() ||
+ ValidateUniformMatrix4x3fv(context, location, count, transpose, value))
+ {
+ context->uniformMatrix4x3fv(location, count, transpose, value);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY UnmapBufferContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(UnmapBuffer, context, targetPacked);
+ if (context->skipValidation() || ValidateUnmapBuffer(context, targetPacked))
+ {
+ return context->unmapBuffer(targetPacked);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::UnmapBuffer, GLboolean>();
+}
+
+GLboolean GL_APIENTRY UnmapBufferOESContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(UnmapBufferOES, context, targetPacked);
+ if (context->skipValidation() || ValidateUnmapBufferOES(context, targetPacked))
+ {
+ return context->unmapBuffer(targetPacked);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::UnmapBufferOES, GLboolean>();
+}
+
+void GL_APIENTRY UseProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UseProgram, context, program);
+ if (context->skipValidation() || ValidateUseProgram(context, program))
+ {
+ context->useProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY UseProgramStagesContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLbitfield stages,
+ GLuint program)
+{
+ EVENT("(GLuint pipeline = %u, GLbitfield stages = 0x%X, GLuint program = %u)", pipeline, stages,
+ program);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(UseProgramStages, context, pipeline, stages, program);
+ if (context->skipValidation() ||
+ ValidateUseProgramStages(context, pipeline, stages, program))
+ {
+ context->useProgramStages(pipeline, stages, program);
+ }
+ }
+}
+
+void GL_APIENTRY ValidateProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ EVENT("(GLuint program = %u)", program);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ValidateProgram, context, program);
+ if (context->skipValidation() || ValidateValidateProgram(context, program))
+ {
+ context->validateProgram(program);
+ }
+ }
+}
+
+void GL_APIENTRY ValidateProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline)
+{
+ EVENT("(GLuint pipeline = %u)", pipeline);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ValidateProgramPipeline, context, pipeline);
+ if (context->skipValidation() || ValidateValidateProgramPipeline(context, pipeline))
+ {
+ context->validateProgramPipeline(pipeline);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib1fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f)", index, x);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib1f, context, index, x);
+ if (context->skipValidation() || ValidateVertexAttrib1f(context, index, x))
+ {
+ context->vertexAttrib1f(index, x);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib1fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib1fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib1fv(context, index, v))
+ {
+ context->vertexAttrib1fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib2fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f, GLfloat y = %f)", index, x, y);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib2f, context, index, x, y);
+ if (context->skipValidation() || ValidateVertexAttrib2f(context, index, x, y))
+ {
+ context->vertexAttrib2f(index, x, y);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib2fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib2fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib2fv(context, index, v))
+ {
+ context->vertexAttrib2fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY
+VertexAttrib3fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib3f, context, index, x, y, z);
+ if (context->skipValidation() || ValidateVertexAttrib3f(context, index, x, y, z))
+ {
+ context->vertexAttrib3f(index, x, y, z);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib3fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib3fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib3fv(context, index, v))
+ {
+ context->vertexAttrib3fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib4fContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w)
+{
+ EVENT("(GLuint index = %u, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)",
+ index, x, y, z, w);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib4f, context, index, x, y, z, w);
+ if (context->skipValidation() || ValidateVertexAttrib4f(context, index, x, y, z, w))
+ {
+ context->vertexAttrib4f(index, x, y, z, w);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttrib4fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ EVENT("(GLuint index = %u, const GLfloat *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttrib4fv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttrib4fv(context, index, v))
+ {
+ context->vertexAttrib4fv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribBindingContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLuint bindingindex)
+{
+ EVENT("(GLuint attribindex = %u, GLuint bindingindex = %u)", attribindex, bindingindex);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribBinding, context, attribindex, bindingindex);
+ if (context->skipValidation() ||
+ ValidateVertexAttribBinding(context, attribindex, bindingindex))
+ {
+ context->vertexAttribBinding(attribindex, bindingindex);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribDivisorContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribDivisor, context, index, divisor);
+ if (context->skipValidation() || ValidateVertexAttribDivisor(context, index, divisor))
+ {
+ context->vertexAttribDivisor(index, divisor);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribDivisorANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribDivisorANGLE, context, index, divisor);
+ if (context->skipValidation() || ValidateVertexAttribDivisorANGLE(context, index, divisor))
+ {
+ context->vertexAttribDivisor(index, divisor);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribDivisorEXTContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor)
+{
+ EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribDivisorEXT, context, index, divisor);
+ if (context->skipValidation() || ValidateVertexAttribDivisorEXT(context, index, divisor))
+ {
+ context->vertexAttribDivisor(index, divisor);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribFormatContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset)
+{
+ EVENT(
+ "(GLuint attribindex = %u, GLint size = %d, GLenum type = 0x%X, GLboolean normalized = %u, "
+ "GLuint relativeoffset = %u)",
+ attribindex, size, type, normalized, relativeoffset);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribFormat, context, attribindex, size, typePacked, normalized,
+ relativeoffset);
+ if (context->skipValidation() ||
+ ValidateVertexAttribFormat(context, attribindex, size, typePacked, normalized,
+ relativeoffset))
+ {
+ context->vertexAttribFormat(attribindex, size, typePacked, normalized, relativeoffset);
+ }
+ }
+}
+
+void GL_APIENTRY
+VertexAttribI4iContextANGLE(GLeglContext ctx, 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribI4i, context, index, x, y, z, w);
+ if (context->skipValidation() || ValidateVertexAttribI4i(context, index, x, y, z, w))
+ {
+ context->vertexAttribI4i(index, x, y, z, w);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribI4ivContextANGLE(GLeglContext ctx, GLuint index, const GLint *v)
+{
+ EVENT("(GLuint index = %u, const GLint *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribI4iv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttribI4iv(context, index, v))
+ {
+ context->vertexAttribI4iv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY
+VertexAttribI4uiContextANGLE(GLeglContext ctx, 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);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribI4ui, context, index, x, y, z, w);
+ if (context->skipValidation() || ValidateVertexAttribI4ui(context, index, x, y, z, w))
+ {
+ context->vertexAttribI4ui(index, x, y, z, w);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribI4uivContextANGLE(GLeglContext ctx, GLuint index, const GLuint *v)
+{
+ EVENT("(GLuint index = %u, const GLuint *v = 0x%016" PRIxPTR ")", index, (uintptr_t)v);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexAttribI4uiv, context, index, v);
+ if (context->skipValidation() || ValidateVertexAttribI4uiv(context, index, v))
+ {
+ context->vertexAttribI4uiv(index, v);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribIFormatContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ EVENT(
+ "(GLuint attribindex = %u, GLint size = %d, GLenum type = 0x%X, GLuint relativeoffset = "
+ "%u)",
+ attribindex, size, type, relativeoffset);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribIFormat, context, attribindex, size, typePacked, relativeoffset);
+ if (context->skipValidation() ||
+ ValidateVertexAttribIFormat(context, attribindex, size, typePacked, relativeoffset))
+ {
+ context->vertexAttribIFormat(attribindex, size, typePacked, relativeoffset);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribIPointerContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void "
+ "*pointer = 0x%016" PRIxPTR ")",
+ index, size, type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribIPointer, context, index, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateVertexAttribIPointer(context, index, size, typePacked, stride, pointer))
+ {
+ context->vertexAttribIPointer(index, size, typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY VertexAttribPointerContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLboolean normalized = %u, "
+ "GLsizei stride = %d, const void *pointer = 0x%016" PRIxPTR ")",
+ index, size, type, normalized, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexAttribPointer, context, index, size, typePacked, normalized, stride,
+ pointer);
+ if (context->skipValidation() ||
+ ValidateVertexAttribPointer(context, index, size, typePacked, normalized, stride,
+ pointer))
+ {
+ context->vertexAttribPointer(index, size, typePacked, normalized, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY VertexBindingDivisorContextANGLE(GLeglContext ctx,
+ GLuint bindingindex,
+ GLuint divisor)
+{
+ EVENT("(GLuint bindingindex = %u, GLuint divisor = %u)", bindingindex, divisor);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(VertexBindingDivisor, context, bindingindex, divisor);
+ if (context->skipValidation() ||
+ ValidateVertexBindingDivisor(context, bindingindex, divisor))
+ {
+ context->vertexBindingDivisor(bindingindex, divisor);
+ }
+ }
+}
+
+void GL_APIENTRY VertexPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ VertexAttribType typePacked = FromGLenum<VertexAttribType>(type);
+ ANGLE_CAPTURE(VertexPointer, context, size, typePacked, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateVertexPointer(context, size, typePacked, stride, pointer))
+ {
+ context->vertexPointer(size, typePacked, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY
+ViewportContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width,
+ height);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(Viewport, context, x, y, width, height);
+ if (context->skipValidation() || ValidateViewport(context, x, y, width, height))
+ {
+ context->viewport(x, y, width, height);
+ }
+ }
+}
+
+void GL_APIENTRY WaitSemaphoreEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts)
+{
+ EVENT(
+ "(GLuint semaphore = %u, GLuint numBufferBarriers = %u, const GLuint *buffers = "
+ "0x%016" PRIxPTR ", GLuint numTextureBarriers = %u, const GLuint *textures = 0x%016" PRIxPTR
+ ", const GLenum *srcLayouts = 0x%016" PRIxPTR ")",
+ semaphore, numBufferBarriers, (uintptr_t)buffers, numTextureBarriers, (uintptr_t)textures,
+ (uintptr_t)srcLayouts);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(WaitSemaphoreEXT, context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, srcLayouts);
+ if (context->skipValidation() ||
+ ValidateWaitSemaphoreEXT(context, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, srcLayouts))
+ {
+ context->waitSemaphore(semaphore, numBufferBarriers, buffers, numTextureBarriers,
+ textures, srcLayouts);
+ }
+ }
+}
+
+void GL_APIENTRY WaitSyncContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout)
+{
+ EVENT("(GLsync sync = 0x%016" PRIxPTR ", GLbitfield flags = 0x%X, GLuint64 timeout = %llu)",
+ (uintptr_t)sync, flags, static_cast<unsigned long long>(timeout));
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(WaitSync, context, sync, flags, timeout);
+ if (context->skipValidation() || ValidateWaitSync(context, sync, flags, timeout))
+ {
+ context->waitSync(sync, flags, timeout);
+ }
+ }
+}
+
+void GL_APIENTRY WeightPointerOESContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ EVENT(
+ "(GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const void *pointer = "
+ "0x%016" PRIxPTR ")",
+ size, type, stride, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(WeightPointerOES, context, size, type, stride, pointer);
+ if (context->skipValidation() ||
+ ValidateWeightPointerOES(context, size, type, stride, pointer))
+ {
+ context->weightPointer(size, type, stride, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY BindUniformLocationCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ const GLchar *name)
+{
+ EVENT("(GLuint program = %u, GLint location = %d, const GLchar* name = 0x%016" PRIxPTR ")",
+ program, location, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindUniformLocationCHROMIUM, context, program, location, name);
+ if (context->skipValidation() ||
+ ValidateBindUniformLocationCHROMIUM(context, program, location, name))
+ {
+ context->bindUniformLocation(program, location, name);
+ }
+ }
+}
+
+void GL_APIENTRY CoverageModulationCHROMIUMContextANGLE(GLeglContext ctx, GLenum components)
+{
+ EVENT("(GLenum components = 0x%X)", components);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CoverageModulationCHROMIUM, context, components);
+ if (context->skipValidation() || ValidateCoverageModulationCHROMIUM(context, components))
+ {
+ context->coverageModulation(components);
+ }
+ }
+}
+
+void GL_APIENTRY MatrixLoadfCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum matrixMode,
+ const GLfloat *matrix)
+{
+ EVENT("(GLenum matrixMode = 0x%X, const GLfloat * matrix = 0x%016" PRIxPTR ")", matrixMode,
+ (uintptr_t)matrix);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MatrixLoadfCHROMIUM, context, matrixMode, matrix);
+ if (context->skipValidation() || ValidateMatrixLoadfCHROMIUM(context, matrixMode, matrix))
+ {
+ context->matrixLoadf(matrixMode, matrix);
+ }
+ }
+}
+
+void GL_APIENTRY MatrixLoadIdentityCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode)
+{
+ EVENT("(GLenum matrixMode = 0x%X)", matrixMode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(MatrixLoadIdentityCHROMIUM, context, matrixMode);
+ if (context->skipValidation() || ValidateMatrixLoadIdentityCHROMIUM(context, matrixMode))
+ {
+ context->matrixLoadIdentity(matrixMode);
+ }
+ }
+}
+
+GLuint GL_APIENTRY GenPathsCHROMIUMContextANGLE(GLeglContext ctx, GLsizei range)
+{
+ EVENT("(GLsizei range = %d)", range);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GenPathsCHROMIUM, context, range);
+ if (context->skipValidation() || ValidateGenPathsCHROMIUM(context, range))
+ {
+ return context->genPaths(range);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::GenPathsCHROMIUM, GLuint>();
+}
+
+void GL_APIENTRY DeletePathsCHROMIUMContextANGLE(GLeglContext ctx, GLuint first, GLsizei range)
+{
+ EVENT("(GLuint first = %u, GLsizei range = %d)", first, range);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(DeletePathsCHROMIUM, context, first, range);
+ if (context->skipValidation() || ValidateDeletePathsCHROMIUM(context, first, range))
+ {
+ context->deletePaths(first, range);
+ }
+ }
+}
+
+GLboolean GL_APIENTRY IsPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path)
+{
+ EVENT("(GLuint path = %u)", path);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(IsPathCHROMIUM, context, path);
+ if (context->skipValidation() || ValidateIsPathCHROMIUM(context, path))
+ {
+ return context->isPath(path);
+ }
+ }
+
+ return GetDefaultReturnValue<EntryPoint::IsPathCHROMIUM, GLboolean>();
+}
+
+void GL_APIENTRY PathCommandsCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords)
+{
+ EVENT("(GLuint path = %u, GLsizei numCommands = %d, const GLubyte * commands = 0x%016" PRIxPTR
+ ", GLsizei numCoords = %d, GLenum coordType = 0x%X, const void* coords = 0x%016" PRIxPTR
+ ")",
+ path, numCommands, (uintptr_t)commands, numCoords, coordType, (uintptr_t)coords);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PathCommandsCHROMIUM, context, path, numCommands, commands, numCoords,
+ coordType, coords);
+ if (context->skipValidation() ||
+ ValidatePathCommandsCHROMIUM(context, path, numCommands, commands, numCoords, coordType,
+ coords))
+ {
+ context->pathCommands(path, numCommands, commands, numCoords, coordType, coords);
+ }
+ }
+}
+
+void GL_APIENTRY PathParameterfCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLfloat value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLfloat value = %f)", path, pname, value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PathParameterfCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidatePathParameterfCHROMIUM(context, path, pname, value))
+ {
+ context->pathParameterf(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY PathParameteriCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLint value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLint value = %d)", path, pname, value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PathParameteriCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidatePathParameteriCHROMIUM(context, path, pname, value))
+ {
+ context->pathParameteri(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY GetPathParameterfvCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLfloat *value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLfloat * value = 0x%016" PRIxPTR ")", path,
+ pname, (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetPathParameterfvCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidateGetPathParameterfvCHROMIUM(context, path, pname, value))
+ {
+ context->getPathParameterfv(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY GetPathParameterivCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLint *value)
+{
+ EVENT("(GLuint path = %u, GLenum pname = 0x%X, GLint * value = 0x%016" PRIxPTR ")", path, pname,
+ (uintptr_t)value);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetPathParameterivCHROMIUM, context, path, pname, value);
+ if (context->skipValidation() ||
+ ValidateGetPathParameterivCHROMIUM(context, path, pname, value))
+ {
+ context->getPathParameteriv(path, pname, value);
+ }
+ }
+}
+
+void GL_APIENTRY PathStencilFuncCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum func,
+ GLint ref,
+ GLuint mask)
+{
+ EVENT("(GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", func, ref, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(PathStencilFuncCHROMIUM, context, func, ref, mask);
+ if (context->skipValidation() || ValidatePathStencilFuncCHROMIUM(context, func, ref, mask))
+ {
+ context->pathStencilFunc(func, ref, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask)
+{
+ EVENT("(GLuint path = %u, GLenum fillMode = 0x%X, GLuint mask = %u)", path, fillMode, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilFillPathCHROMIUM, context, path, fillMode, mask);
+ if (context->skipValidation() ||
+ ValidateStencilFillPathCHROMIUM(context, path, fillMode, mask))
+ {
+ context->stencilFillPath(path, fillMode, mask);
+ }
+ }
+}
+
+void GL_APIENTRY StencilStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLint reference,
+ GLuint mask)
+{
+ EVENT("(GLuint path = %u, GLint reference = %d, GLuint mask = %u)", path, reference, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilStrokePathCHROMIUM, context, path, reference, mask);
+ if (context->skipValidation() ||
+ ValidateStencilStrokePathCHROMIUM(context, path, reference, mask))
+ {
+ context->stencilStrokePath(path, reference, mask);
+ }
+ }
+}
+
+void GL_APIENTRY CoverFillPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path, GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLenum coverMode = 0x%X)", path, coverMode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CoverFillPathCHROMIUM, context, path, coverMode);
+ if (context->skipValidation() || ValidateCoverFillPathCHROMIUM(context, path, coverMode))
+ {
+ context->coverFillPath(path, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY CoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLenum coverMode = 0x%X)", path, coverMode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CoverStrokePathCHROMIUM, context, path, coverMode);
+ if (context->skipValidation() || ValidateCoverStrokePathCHROMIUM(context, path, coverMode))
+ {
+ context->coverStrokePath(path, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY StencilThenCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLenum fillMode = 0x%X, GLuint mask = %u, GLenum coverMode = 0x%X)",
+ path, fillMode, mask, coverMode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilThenCoverFillPathCHROMIUM, context, path, fillMode, mask, coverMode);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverFillPathCHROMIUM(context, path, fillMode, mask, coverMode))
+ {
+ context->stencilThenCoverFillPath(path, fillMode, mask, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY StencilThenCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode)
+{
+ EVENT("(GLuint path = %u, GLint reference = %d, GLuint mask = %u, GLenum coverMode = 0x%X)",
+ path, reference, mask, coverMode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilThenCoverStrokePathCHROMIUM, context, path, reference, mask,
+ coverMode);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverStrokePathCHROMIUM(context, path, reference, mask, coverMode))
+ {
+ context->stencilThenCoverStrokePath(path, reference, mask, coverMode);
+ }
+ }
+}
+
+void GL_APIENTRY CoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPath = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum coverMode = 0x%X, GLenum transformType = 0x%X, const "
+ "GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPath, pathNameType, (uintptr_t)paths, pathBase, coverMode, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CoverFillPathInstancedCHROMIUM, context, numPath, pathNameType, paths,
+ pathBase, coverMode, transformType, transformValues);
+ if (context->skipValidation() ||
+ ValidateCoverFillPathInstancedCHROMIUM(context, numPath, pathNameType, paths, pathBase,
+ coverMode, transformType, transformValues))
+ {
+ context->coverFillPathInstanced(numPath, pathNameType, paths, pathBase, coverMode,
+ transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY CoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPath = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum coverMode = 0x%X, GLenum transformType = 0x%X, const "
+ "GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPath, pathNameType, (uintptr_t)paths, pathBase, coverMode, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CoverStrokePathInstancedCHROMIUM, context, numPath, pathNameType, paths,
+ pathBase, coverMode, transformType, transformValues);
+ if (context->skipValidation() || ValidateCoverStrokePathInstancedCHROMIUM(
+ context, numPath, pathNameType, paths, pathBase,
+ coverMode, transformType, transformValues))
+ {
+ context->coverStrokePathInstanced(numPath, pathNameType, paths, pathBase, coverMode,
+ transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY StencilStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPath = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLint reference = %d, GLuint mask = %u, GLenum transformType = "
+ "0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPath, pathNameType, (uintptr_t)paths, pathBase, reference, mask, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilStrokePathInstancedCHROMIUM, context, numPath, pathNameType, paths,
+ pathBase, reference, mask, transformType, transformValues);
+ if (context->skipValidation() || ValidateStencilStrokePathInstancedCHROMIUM(
+ context, numPath, pathNameType, paths, pathBase,
+ reference, mask, transformType, transformValues))
+ {
+ context->stencilStrokePathInstanced(numPath, pathNameType, paths, pathBase, reference,
+ mask, transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY StencilFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPaths = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum fillMode = 0x%X, GLuint mask = %u, GLenum transformType "
+ "= 0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPaths, pathNameType, (uintptr_t)paths, pathBase, fillMode, mask, transformType,
+ (uintptr_t)transformValues);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilFillPathInstancedCHROMIUM, context, numPaths, pathNameType, paths,
+ pathBase, fillMode, mask, transformType, transformValues);
+ if (context->skipValidation() || ValidateStencilFillPathInstancedCHROMIUM(
+ context, numPaths, pathNameType, paths, pathBase,
+ fillMode, mask, transformType, transformValues))
+ {
+ context->stencilFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode,
+ mask, transformType, transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY
+StencilThenCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPaths = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLenum fillMode = 0x%X, GLuint mask = %u, GLenum coverMode = "
+ "0x%X, GLenum transformType = 0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPaths, pathNameType, (uintptr_t)paths, pathBase, fillMode, mask, coverMode,
+ transformType, (uintptr_t)transformValues);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilThenCoverFillPathInstancedCHROMIUM, context, numPaths, pathNameType,
+ paths, pathBase, fillMode, mask, coverMode, transformType, transformValues);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverFillPathInstancedCHROMIUM(
+ context, numPaths, pathNameType, paths, pathBase, fillMode, mask, coverMode,
+ transformType, transformValues))
+ {
+ context->stencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase,
+ fillMode, mask, coverMode, transformType,
+ transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY
+StencilThenCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ EVENT("(GLsizei numPaths = %d, GLenum pathNameType = 0x%X, const void * paths = 0x%016" PRIxPTR
+ ", GLuint pathBase = %u, GLint reference = %d, GLuint mask = %u, GLenum coverMode = "
+ "0x%X, GLenum transformType = 0x%X, const GLfloat * transformValues = 0x%016" PRIxPTR ")",
+ numPaths, pathNameType, (uintptr_t)paths, pathBase, reference, mask, coverMode,
+ transformType, (uintptr_t)transformValues);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(StencilThenCoverStrokePathInstancedCHROMIUM, context, numPaths, pathNameType,
+ paths, pathBase, reference, mask, coverMode, transformType, transformValues);
+ if (context->skipValidation() ||
+ ValidateStencilThenCoverStrokePathInstancedCHROMIUM(
+ context, numPaths, pathNameType, paths, pathBase, reference, mask, coverMode,
+ transformType, transformValues))
+ {
+ context->stencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
+ reference, mask, coverMode, transformType,
+ transformValues);
+ }
+ }
+}
+
+void GL_APIENTRY BindFragmentInputLocationCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint programs,
+ GLint location,
+ const GLchar *name)
+{
+ EVENT("(GLuint programs = %u, GLint location = %d, const GLchar * name = 0x%016" PRIxPTR ")",
+ programs, location, (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(BindFragmentInputLocationCHROMIUM, context, programs, location, name);
+ if (context->skipValidation() ||
+ ValidateBindFragmentInputLocationCHROMIUM(context, programs, location, name))
+ {
+ context->bindFragmentInputLocation(programs, location, name);
+ }
+ }
+}
+
+void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLenum genMode = 0x%X, GLint components = %d, "
+ "const GLfloat * coeffs = 0x%016" PRIxPTR ")",
+ program, location, genMode, components, (uintptr_t)coeffs);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ProgramPathFragmentInputGenCHROMIUM, context, program, location, genMode,
+ components, coeffs);
+ if (context->skipValidation() ||
+ ValidateProgramPathFragmentInputGenCHROMIUM(context, program, location, genMode,
+ components, coeffs))
+ {
+ context->programPathFragmentInputGen(program, location, genMode, components, coeffs);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint internalFormat = %d, GLenum destType = 0x%X, GLboolean "
+ "unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha "
+ "= %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopyTextureCHROMIUM, context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopyTextureCHROMIUM(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
+ {
+ context->copyTexture(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY CopySubTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint xoffset = %d, GLint yoffset = %d, GLint x = %d, GLint y = "
+ "%d, GLint width = %d, GLint height = %d, GLboolean unpackFlipY = %u, GLboolean "
+ "unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha = %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x, y, width, height,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopySubTextureCHROMIUM, context, sourceId, sourceLevel, destTargetPacked,
+ destId, destLevel, xoffset, yoffset, x, y, width, height, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopySubTextureCHROMIUM(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, xoffset, yoffset, x, y, width, height,
+ unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha))
+ {
+ context->copySubTexture(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ xoffset, yoffset, x, y, width, height, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedCopyTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLuint destId)
+{
+ EVENT("(GLuint sourceId = %u, GLuint destId = %u)", sourceId, destId);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(CompressedCopyTextureCHROMIUM, context, sourceId, destId);
+ if (context->skipValidation() ||
+ ValidateCompressedCopyTextureCHROMIUM(context, sourceId, destId))
+ {
+ context->compressedCopyTexture(sourceId, destId);
+ }
+ }
+}
+
+void GL_APIENTRY RequestExtensionANGLEContextANGLE(GLeglContext ctx, const GLchar *name)
+{
+ EVENT("(const GLchar * name = 0x%016" PRIxPTR ")", (uintptr_t)name);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(RequestExtensionANGLE, context, name);
+ if (context->skipValidation() || ValidateRequestExtensionANGLE(context, name))
+ {
+ context->requestExtension(name);
+ }
+ }
+}
+
+void GL_APIENTRY GetBooleanvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLboolean * params = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetBooleanvRobustANGLE, context, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetBooleanvRobustANGLE(context, pname, bufSize, length, params))
+ {
+ context->getBooleanvRobust(pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameterivRobustANGLE, context, targetPacked, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetBufferParameterivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getBufferParameterivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFloatvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLfloat * params = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFloatvRobustANGLE, context, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetFloatvRobustANGLE(context, pname, bufSize, length, params))
+ {
+ context->getFloatvRobust(pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferAttachmentParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = "
+ "%d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, attachment, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFramebufferAttachmentParameterivRobustANGLE, context, target, attachment,
+ pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetFramebufferAttachmentParameterivRobustANGLE(context, target, attachment,
+ pname, bufSize, length, params))
+ {
+ context->getFramebufferAttachmentParameterivRobust(target, attachment, pname, bufSize,
+ length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetIntegervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLint * data = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetIntegervRobustANGLE, context, pname, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetIntegervRobustANGLE(context, pname, bufSize, length, data))
+ {
+ context->getIntegervRobust(pname, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramivRobustANGLE, context, program, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramivRobustANGLE(context, program, pname, bufSize, length, params))
+ {
+ context->getProgramivRobust(program, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetRenderbufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetRenderbufferParameterivRobustANGLE, context, target, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetRenderbufferParameterivRobustANGLE(
+ context, target, pname, bufSize, length, params))
+ {
+ context->getRenderbufferParameterivRobust(target, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetShaderivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint shader = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ shader, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetShaderivRobustANGLE, context, shader, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetShaderivRobustANGLE(context, shader, pname, bufSize, length, params))
+ {
+ context->getShaderivRobust(shader, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterfvRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterfvRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterfvRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterivRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformfvRobustANGLE, context, program, location, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetUniformfvRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getUniformfvRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformivRobustANGLE, context, program, location, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetUniformivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getUniformivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribfvRobustANGLE, context, index, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribfvRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribfvRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribivRobustANGLE, context, index, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribivRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribivRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribPointervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", void ** pointer = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)pointer);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribPointervRobustANGLE, context, index, pname, bufSize, length,
+ pointer);
+ if (context->skipValidation() || ValidateGetVertexAttribPointervRobustANGLE(
+ context, index, pname, bufSize, length, pointer))
+ {
+ context->getVertexAttribPointervRobust(index, pname, bufSize, length, pointer);
+ }
+ }
+}
+
+void GL_APIENTRY ReadPixelsRobustANGLEContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLsizei * columns = 0x%016" PRIxPTR ", GLsizei * rows = 0x%016" PRIxPTR
+ ", void * pixels = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, bufSize, (uintptr_t)length, (uintptr_t)columns,
+ (uintptr_t)rows, (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ReadPixelsRobustANGLE, context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, pixels);
+ if (context->skipValidation() ||
+ ValidateReadPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, pixels))
+ {
+ context->readPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
+ rows, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, GLsizei "
+ "bufSize = %d, const void * pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, format, type, bufSize,
+ (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage2DRobustANGLE, context, targetPacked, level, internalformat, width,
+ height, border, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage2DRobustANGLE(context, targetPacked, level, internalformat, width,
+ height, border, format, type, bufSize, pixels))
+ {
+ context->texImage2DRobust(targetPacked, level, internalformat, width, height, border,
+ format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLfloat * params "
+ "= 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterfvRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterfvRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterfvRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLint * params = "
+ "0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterivRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterivRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterivRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei "
+ "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, GLsizei "
+ "bufSize = %d, const void * pixels = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, type, bufSize, (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage2DRobustANGLE, context, targetPacked, level, xoffset, yoffset,
+ width, height, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage2DRobustANGLE(context, targetPacked, level, xoffset, yoffset, width,
+ height, format, type, bufSize, pixels))
+ {
+ context->texSubImage2DRobust(targetPacked, level, xoffset, yoffset, width, height,
+ format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *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, GLsizei bufSize = %d, const void * pixels = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, format, type, bufSize,
+ (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage3DRobustANGLE, context, targetPacked, level, internalformat, width,
+ height, depth, border, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexImage3DRobustANGLE(context, targetPacked, level, internalformat, width,
+ height, depth, border, format, type, bufSize, pixels))
+ {
+ context->texImage3DRobust(targetPacked, level, internalformat, width, height, depth,
+ border, format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY TexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *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, GLsizei bufSize = %d, const void * pixels = 0x%016" PRIxPTR
+ ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize,
+ (uintptr_t)pixels);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexSubImage3DRobustANGLE, context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, type, bufSize, pixels);
+ if (context->skipValidation() ||
+ ValidateTexSubImage3DRobustANGLE(context, targetPacked, level, xoffset, yoffset,
+ zoffset, width, height, depth, format, type, bufSize,
+ pixels))
+ {
+ context->texSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, bufSize, pixels);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = "
+ "%d, GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, GLsizei dataSize = "
+ "%d, const GLvoid * data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, border, imageSize, dataSize, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage2DRobustANGLE, context, targetPacked, level, internalformat,
+ width, height, border, imageSize, dataSize, data);
+ if (context->skipValidation() || ValidateCompressedTexImage2DRobustANGLE(
+ context, targetPacked, level, internalformat, width,
+ height, border, imageSize, dataSize, data))
+ {
+ context->compressedTexImage2DRobust(targetPacked, level, internalformat, width, height,
+ border, imageSize, dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLsizei xoffset = %d, GLsizei yoffset = %d, "
+ "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLsizei imageSize = %d, "
+ "GLsizei dataSize = %d, const GLvoid * data = 0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, width, height, format, imageSize, dataSize,
+ (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage2DRobustANGLE, context, targetPacked, level, xoffset,
+ yoffset, width, height, format, imageSize, dataSize, data);
+ if (context->skipValidation() || ValidateCompressedTexSubImage2DRobustANGLE(
+ context, targetPacked, level, xoffset, yoffset, width,
+ height, format, imageSize, dataSize, data))
+ {
+ context->compressedTexSubImage2DRobust(targetPacked, level, xoffset, yoffset, width,
+ height, format, imageSize, dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ 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, "
+ "GLsizei dataSize = %d, const GLvoid * data = 0x%016" PRIxPTR ")",
+ target, level, internalformat, width, height, depth, border, imageSize, dataSize,
+ (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexImage3DRobustANGLE, context, targetPacked, level, internalformat,
+ width, height, depth, border, imageSize, dataSize, data);
+ if (context->skipValidation() || ValidateCompressedTexImage3DRobustANGLE(
+ context, targetPacked, level, internalformat, width,
+ height, depth, border, imageSize, dataSize, data))
+ {
+ context->compressedTexImage3DRobust(targetPacked, level, internalformat, width, height,
+ depth, border, imageSize, dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY CompressedTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ 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, GLsizei dataSize = %d, const GLvoid * data = "
+ "0x%016" PRIxPTR ")",
+ target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, dataSize,
+ (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(CompressedTexSubImage3DRobustANGLE, context, targetPacked, level, xoffset,
+ yoffset, zoffset, width, height, depth, format, imageSize, dataSize, data);
+ if (context->skipValidation() ||
+ ValidateCompressedTexSubImage3DRobustANGLE(context, targetPacked, level, xoffset,
+ yoffset, zoffset, width, height, depth,
+ format, imageSize, dataSize, data))
+ {
+ context->compressedTexSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, imageSize,
+ dataSize, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ QueryType targetPacked = FromGLenum<QueryType>(target);
+ ANGLE_CAPTURE(GetQueryivRobustANGLE, context, targetPacked, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryivRobustANGLE(context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getQueryivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjectuivRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjectuivRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjectuivRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferPointervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", void ** params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferPointervRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetBufferPointervRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getBufferPointervRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetIntegeri_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * data = 0x%016" PRIxPTR ")",
+ target, index, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetIntegeri_vRobustANGLE, context, target, index, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, length, data))
+ {
+ context->getIntegeri_vRobust(target, index, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInternalformativRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize "
+ "= %d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, internalformat, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetInternalformativRobustANGLE, context, target, internalformat, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetInternalformativRobustANGLE(context, target, internalformat, pname, bufSize,
+ length, params))
+ {
+ context->getInternalformativRobust(target, internalformat, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribIivRobustANGLE, context, index, pname, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribIivRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribIivRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetVertexAttribIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ index, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetVertexAttribIuivRobustANGLE, context, index, pname, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetVertexAttribIuivRobustANGLE(context, index, pname, bufSize, length, params))
+ {
+ context->getVertexAttribIuivRobust(index, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetUniformuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetUniformuivRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetUniformuivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getUniformuivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetActiveUniformBlockivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLsizei bufSize "
+ "= %d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, uniformBlockIndex, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetActiveUniformBlockivRobustANGLE, context, program, uniformBlockIndex,
+ pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetActiveUniformBlockivRobustANGLE(context, program, uniformBlockIndex, pname,
+ bufSize, length, params))
+ {
+ context->getActiveUniformBlockivRobust(program, uniformBlockIndex, pname, bufSize,
+ length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetInteger64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLint64 * data = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetInteger64vRobustANGLE, context, pname, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetInteger64vRobustANGLE(context, pname, bufSize, length, data))
+ {
+ context->getInteger64vRobust(pname, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetInteger64i_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint64 * data = 0x%016" PRIxPTR ")",
+ target, index, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetInteger64i_vRobustANGLE, context, target, index, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, length, data))
+ {
+ context->getInteger64i_vRobust(target, index, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetBufferParameteri64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint64 * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ BufferBinding targetPacked = FromGLenum<BufferBinding>(target);
+ ANGLE_CAPTURE(GetBufferParameteri64vRobustANGLE, context, targetPacked, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetBufferParameteri64vRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getBufferParameteri64vRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLuint pname = %u, GLsizei bufSize = %d, const GLint * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterivRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterivRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLfloat * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterfvRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterfvRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameterivRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameterfvRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterfvRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterfvRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetFramebufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetFramebufferParameterivRobustANGLE, context, sampler, pname, bufSize,
+ length, params);
+ if (context->skipValidation() || ValidateGetFramebufferParameterivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getFramebufferParameterivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetProgramInterfaceivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLenum programInterface = 0x%X, GLenum pname = 0x%X, GLsizei "
+ "bufSize = %d, GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, programInterface, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetProgramInterfaceivRobustANGLE, context, program, programInterface, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetProgramInterfaceivRobustANGLE(context, program, programInterface, pname,
+ bufSize, length, params))
+ {
+ context->getProgramInterfaceivRobust(program, programInterface, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetBooleani_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLboolean * data = 0x%016" PRIxPTR ")",
+ target, index, bufSize, (uintptr_t)length, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetBooleani_vRobustANGLE, context, target, index, bufSize, length, data);
+ if (context->skipValidation() ||
+ ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, length, data))
+ {
+ context->getBooleani_vRobust(target, index, bufSize, length, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetMultisamplefvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val)
+{
+ EVENT(
+ "(GLenum pname = 0x%X, GLuint index = %u, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * val = 0x%016" PRIxPTR ")",
+ pname, index, bufSize, (uintptr_t)length, (uintptr_t)val);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetMultisamplefvRobustANGLE, context, pname, index, bufSize, length, val);
+ if (context->skipValidation() ||
+ ValidateGetMultisamplefvRobustANGLE(context, pname, index, bufSize, length, val))
+ {
+ context->getMultisamplefvRobust(pname, index, bufSize, length, val);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLsizei bufSize = %d, "
+ "GLsizei * length = 0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, level, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterivRobustANGLE, context, targetPacked, level, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterivRobustANGLE(context, targetPacked, level, pname, bufSize,
+ length, params))
+ {
+ context->getTexLevelParameterivRobust(targetPacked, level, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLsizei bufSize = %d, "
+ "GLsizei * length = 0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ target, level, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterfvRobustANGLE, context, targetPacked, level, pname,
+ bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterfvRobustANGLE(context, targetPacked, level, pname, bufSize,
+ length, params))
+ {
+ context->getTexLevelParameterfvRobust(targetPacked, level, pname, bufSize, length,
+ params);
+ }
+ }
+}
+
+void GL_APIENTRY GetPointervRobustANGLERobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ EVENT("(GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", void ** params = 0x%016" PRIxPTR ")",
+ pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetPointervRobustANGLERobustANGLE, context, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetPointervRobustANGLERobustANGLE(context, pname, bufSize, length, params))
+ {
+ context->getPointervRobustANGLERobust(pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY ReadnPixelsRobustANGLEContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data)
+{
+ EVENT(
+ "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = "
+ "0x%X, GLenum type = 0x%X, GLsizei bufSize = %d, GLsizei * length = 0x%016" PRIxPTR
+ ", GLsizei * columns = 0x%016" PRIxPTR ", GLsizei * rows = 0x%016" PRIxPTR
+ ", void * data = 0x%016" PRIxPTR ")",
+ x, y, width, height, format, type, bufSize, (uintptr_t)length, (uintptr_t)columns,
+ (uintptr_t)rows, (uintptr_t)data);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(ReadnPixelsRobustANGLE, context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, data);
+ if (context->skipValidation() ||
+ ValidateReadnPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize,
+ length, columns, rows, data))
+ {
+ context->readnPixelsRobust(x, y, width, height, format, type, bufSize, length, columns,
+ rows, data);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLfloat * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetnUniformfvRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformfvRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getnUniformfvRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetnUniformivRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getnUniformivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetnUniformuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint program = %u, GLint location = %d, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ program, location, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetnUniformuivRobustANGLE, context, program, location, bufSize, length,
+ params);
+ if (context->skipValidation() ||
+ ValidateGetnUniformuivRobustANGLE(context, program, location, bufSize, length, params))
+ {
+ context->getnUniformuivRobust(program, location, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLint * params = "
+ "0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIivRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIivRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterIivRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY TexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLuint * params = "
+ "0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexParameterIuivRobustANGLE, context, targetPacked, pname, bufSize, params);
+ if (context->skipValidation() ||
+ ValidateTexParameterIuivRobustANGLE(context, targetPacked, pname, bufSize, params))
+ {
+ context->texParameterIuivRobust(targetPacked, pname, bufSize, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIivRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterIivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterIivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ target, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(GetTexParameterIuivRobustANGLE, context, targetPacked, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetTexParameterIuivRobustANGLE(
+ context, targetPacked, pname, bufSize, length, params))
+ {
+ context->getTexParameterIuivRobust(targetPacked, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLint * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterIivRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIivRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterIivRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY SamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, const GLuint * param = "
+ "0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)param);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SamplerParameterIuivRobustANGLE, context, sampler, pname, bufSize, param);
+ if (context->skipValidation() ||
+ ValidateSamplerParameterIuivRobustANGLE(context, sampler, pname, bufSize, param))
+ {
+ context->samplerParameterIuivRobust(sampler, pname, bufSize, param);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameterIivRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterIivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterIivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ EVENT(
+ "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint * params = 0x%016" PRIxPTR ")",
+ sampler, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetSamplerParameterIuivRobustANGLE, context, sampler, pname, bufSize, length,
+ params);
+ if (context->skipValidation() || ValidateGetSamplerParameterIuivRobustANGLE(
+ context, sampler, pname, bufSize, length, params))
+ {
+ context->getSamplerParameterIuivRobust(sampler, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjectivRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjectivRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjectivRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjecti64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLint64 * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjecti64vRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjecti64vRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjecti64vRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetQueryObjectui64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params)
+{
+ EVENT(
+ "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei * length = "
+ "0x%016" PRIxPTR ", GLuint64 * params = 0x%016" PRIxPTR ")",
+ id, pname, bufSize, (uintptr_t)length, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetQueryObjectui64vRobustANGLE, context, id, pname, bufSize, length, params);
+ if (context->skipValidation() ||
+ ValidateGetQueryObjectui64vRobustANGLE(context, id, pname, bufSize, length, params))
+ {
+ context->getQueryObjectui64vRobust(id, pname, bufSize, length, params);
+ }
+ }
+}
+
+void GL_APIENTRY CopyTexture3DANGLEContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint internalFormat = %d, GLenum destType = 0x%X, GLboolean "
+ "unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha "
+ "= %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopyTexture3DANGLE, context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopyTexture3DANGLE(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha))
+ {
+ context->copyTexture3D(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY CopySubTexture3DANGLEContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ EVENT(
+ "(GLuint sourceId = %u, GLint sourceLevel = %d, GLenum destTarget = 0x%X, GLuint destId = "
+ "%u, GLint destLevel = %d, GLint xoffset = %d, GLint yoffset = %d, GLint zoffset = %d, "
+ "GLint x = %d, GLint y = %d, GLint z = %d, GLint width = %d, GLint height = %d, GLint "
+ "depth = %d, GLboolean unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean "
+ "unpackUnmultiplyAlpha = %u)",
+ sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, zoffset, x, y, z,
+ width, height, depth, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget destTargetPacked = FromGLenum<TextureTarget>(destTarget);
+ ANGLE_CAPTURE(CopySubTexture3DANGLE, context, sourceId, sourceLevel, destTargetPacked,
+ destId, destLevel, xoffset, yoffset, zoffset, x, y, z, width, height, depth,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ if (context->skipValidation() ||
+ ValidateCopySubTexture3DANGLE(context, sourceId, sourceLevel, destTargetPacked, destId,
+ destLevel, xoffset, yoffset, zoffset, x, y, z, width,
+ height, depth, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha))
+ {
+ context->copySubTexture3D(sourceId, sourceLevel, destTargetPacked, destId, destLevel,
+ xoffset, yoffset, zoffset, x, y, z, width, height, depth,
+ unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+ }
+ }
+}
+
+void GL_APIENTRY TexStorage2DMultisampleANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width "
+ "= %d, GLsizei height = %d, GLboolean fixedsamplelocations = %u)",
+ target, samples, internalformat, width, height, fixedsamplelocations);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(TexStorage2DMultisampleANGLE, context, targetPacked, samples, internalformat,
+ width, height, fixedsamplelocations);
+ if (context->skipValidation() ||
+ ValidateTexStorage2DMultisampleANGLE(context, targetPacked, samples, internalformat,
+ width, height, fixedsamplelocations))
+ {
+ context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height,
+ fixedsamplelocations);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterivANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLint * params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterivANGLE, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterivANGLE(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameteriv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY GetTexLevelParameterfvANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLfloat * params = "
+ "0x%016" PRIxPTR ")",
+ target, level, pname, (uintptr_t)params);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(GetTexLevelParameterfvANGLE, context, targetPacked, level, pname, params);
+ if (context->skipValidation() ||
+ ValidateGetTexLevelParameterfvANGLE(context, targetPacked, level, pname, params))
+ {
+ context->getTexLevelParameterfv(targetPacked, level, pname, params);
+ }
+ }
+}
+
+void GL_APIENTRY MultiDrawArraysANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLint *firsts = 0x%016" PRIxPTR
+ ", const GLsizei *counts = 0x%016" PRIxPTR ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)firsts, (uintptr_t)counts, drawcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(MultiDrawArraysANGLE, context, modePacked, firsts, counts, drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawArraysANGLE(context, modePacked, firsts, counts, drawcount))
+ {
+ context->multiDrawArrays(modePacked, firsts, counts, drawcount);
+ }
+ }
+}
+
+void GL_APIENTRY MultiDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLint *firsts = 0x%016" PRIxPTR
+ ", const GLsizei *counts = 0x%016" PRIxPTR
+ ", const GLsizei *instanceCounts = 0x%016" PRIxPTR ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)firsts, (uintptr_t)counts, (uintptr_t)instanceCounts, drawcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ ANGLE_CAPTURE(MultiDrawArraysInstancedANGLE, context, modePacked, firsts, counts,
+ instanceCounts, drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawArraysInstancedANGLE(context, modePacked, firsts, counts,
+ instanceCounts, drawcount))
+ {
+ context->multiDrawArraysInstanced(modePacked, firsts, counts, instanceCounts,
+ drawcount);
+ }
+ }
+}
+
+void GL_APIENTRY MultiDrawElementsANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLsizei *counts = 0x%016" PRIxPTR
+ ", GLenum type = 0x%X, const GLvoid *const*indices = 0x%016" PRIxPTR
+ ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)counts, type, (uintptr_t)indices, drawcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(MultiDrawElementsANGLE, context, modePacked, counts, typePacked, indices,
+ drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawElementsANGLE(context, modePacked, counts, typePacked, indices,
+ drawcount))
+ {
+ context->multiDrawElements(modePacked, counts, typePacked, indices, drawcount);
+ }
+ }
+}
+
+void GL_APIENTRY MultiDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ EVENT("(GLenum mode = 0x%X, const GLsizei *counts = 0x%016" PRIxPTR
+ ", GLenum type = 0x%X, const GLvoid *const*indices = 0x%016" PRIxPTR
+ ", const GLsizei*instanceCounts = 0x%016" PRIxPTR ", GLsizei drawcount = %d)",
+ mode, (uintptr_t)counts, type, (uintptr_t)indices, (uintptr_t)instanceCounts, drawcount);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+ DrawElementsType typePacked = FromGLenum<DrawElementsType>(type);
+ ANGLE_CAPTURE(MultiDrawElementsInstancedANGLE, context, modePacked, counts, typePacked,
+ indices, instanceCounts, drawcount);
+ if (context->skipValidation() ||
+ ValidateMultiDrawElementsInstancedANGLE(context, modePacked, counts, typePacked,
+ indices, instanceCounts, drawcount))
+ {
+ context->multiDrawElementsInstanced(modePacked, counts, typePacked, indices,
+ instanceCounts, drawcount);
+ }
+ }
+}
+
+void GL_APIENTRY GetMultisamplefvANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val)
+{
+ EVENT("(GLenum pname = 0x%X, GLuint index = %u, GLfloat * val = 0x%016" PRIxPTR ")", pname,
+ index, (uintptr_t)val);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(GetMultisamplefvANGLE, context, pname, index, val);
+ if (context->skipValidation() || ValidateGetMultisamplefvANGLE(context, pname, index, val))
+ {
+ context->getMultisamplefv(pname, index, val);
+ }
+ }
+}
+
+void GL_APIENTRY SampleMaskiANGLEContextANGLE(GLeglContext ctx, GLuint maskNumber, GLbitfield mask)
+{
+ EVENT("(GLuint maskNumber = %u, GLbitfield mask = 0x%X)", maskNumber, mask);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ANGLE_CAPTURE(SampleMaskiANGLE, context, maskNumber, mask);
+ if (context->skipValidation() || ValidateSampleMaskiANGLE(context, maskNumber, mask))
+ {
+ context->sampleMaski(maskNumber, mask);
+ }
+ }
+}
+
+void GL_APIENTRY ProvokingVertexANGLEContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ EVENT("(GLenum mode = 0x%X)", mode);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ ProvokingVertexConvention modePacked = FromGLenum<ProvokingVertexConvention>(mode);
+ ANGLE_CAPTURE(ProvokingVertexANGLE, context, modePacked);
+ if (context->skipValidation() || ValidateProvokingVertexANGLE(context, modePacked))
+ {
+ context->provokingVertex(modePacked);
+ }
+ }
+}
+
+void GL_APIENTRY LoseContextCHROMIUMContextANGLE(GLeglContext ctx, GLenum current, GLenum other)
+{
+ EVENT("(GLenum current = 0x%X, GLenum other = 0x%X)", current, other);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ GraphicsResetStatus currentPacked = FromGLenum<GraphicsResetStatus>(current);
+ GraphicsResetStatus otherPacked = FromGLenum<GraphicsResetStatus>(other);
+ ANGLE_CAPTURE(LoseContextCHROMIUM, context, currentPacked, otherPacked);
+ if (context->skipValidation() ||
+ ValidateLoseContextCHROMIUM(context, currentPacked, otherPacked))
+ {
+ context->loseContext(currentPacked, otherPacked);
+ }
+ }
+}
+
+void GL_APIENTRY TexImage2DExternalANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type)
+{
+ EVENT(
+ "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, "
+ "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X)",
+ target, level, internalformat, width, height, border, format, type);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureTarget targetPacked = FromGLenum<TextureTarget>(target);
+ ANGLE_CAPTURE(TexImage2DExternalANGLE, context, targetPacked, level, internalformat, width,
+ height, border, format, type);
+ if (context->skipValidation() ||
+ ValidateTexImage2DExternalANGLE(context, targetPacked, level, internalformat, width,
+ height, border, format, type))
+ {
+ context->texImage2DExternal(targetPacked, level, internalformat, width, height, border,
+ format, type);
+ }
+ }
+}
+
+void GL_APIENTRY InvalidateTextureANGLEContextANGLE(GLeglContext ctx, GLenum target)
+{
+ EVENT("(GLenum target = 0x%X)", target);
+
+ Context *context = static_cast<gl::Context *>(ctx);
+ if (context)
+ {
+ ASSERT(context == GetValidGlobalContext());
+ TextureType targetPacked = FromGLenum<TextureType>(target);
+ ANGLE_CAPTURE(InvalidateTextureANGLE, context, targetPacked);
+ if (context->skipValidation() || ValidateInvalidateTextureANGLE(context, targetPacked))
+ {
+ context->invalidateTexture(targetPacked);
+ }
+ }
+}
+} // namespace gl
diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h
new file mode 100644
index 0000000000..efc8ee3859
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h
@@ -0,0 +1,3874 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// entry_points_gles_ext_autogen.h:
+// Defines the GLES extension entry points.
+
+#ifndef LIBGLESV2_ENTRY_POINTS_GLES_EXT_AUTOGEN_H_
+#define LIBGLESV2_ENTRY_POINTS_GLES_EXT_AUTOGEN_H_
+
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <export.h>
+
+namespace gl
+{
+
+// GL_ANGLE_copy_texture_3d
+ANGLE_EXPORT void GL_APIENTRY CopyTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+ANGLE_EXPORT void GL_APIENTRY CopySubTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+
+// GL_ANGLE_framebuffer_blit
+ANGLE_EXPORT void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+
+// GL_ANGLE_framebuffer_multisample
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+
+// GL_ANGLE_instanced_arrays
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor);
+
+// GL_ANGLE_multi_draw
+ANGLE_EXPORT void GL_APIENTRY MultiDrawArraysANGLE(GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount);
+ANGLE_EXPORT void GL_APIENTRY MultiDrawArraysInstancedANGLE(GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+ANGLE_EXPORT void GL_APIENTRY MultiDrawElementsANGLE(GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ GLsizei drawcount);
+ANGLE_EXPORT void GL_APIENTRY MultiDrawElementsInstancedANGLE(GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+
+// GL_ANGLE_provoking_vertex
+ANGLE_EXPORT void GL_APIENTRY ProvokingVertexANGLE(GLenum mode);
+
+// GL_ANGLE_request_extension
+ANGLE_EXPORT void GL_APIENTRY RequestExtensionANGLE(const GLchar *name);
+
+// GL_ANGLE_robust_client_memory
+ANGLE_EXPORT void GL_APIENTRY GetBooleanvRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetFloatvRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivRobustANGLE(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetIntegervRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetProgramivRobustANGLE(GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetShaderivRobustANGLE(GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfvRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointervRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer);
+ANGLE_EXPORT void GL_APIENTRY ReadPixelsRobustANGLE(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexParameterfvRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY
+GetQueryivRobustANGLE(GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointervRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY GetIntegeri_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetInternalformativRobustANGLE(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformuivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockivRobustANGLE(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceivRobustANGLE(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetBooleani_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data);
+ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvRobustANGLE(GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterivRobustANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfvRobustANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetPointervRobustANGLERobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY ReadnPixelsRobustANGLE(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformfvRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformuivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIuivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIuivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params);
+
+// GL_ANGLE_texture_external_update
+ANGLE_EXPORT void GL_APIENTRY TexImage2DExternalANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type);
+ANGLE_EXPORT void GL_APIENTRY InvalidateTextureANGLE(GLenum target);
+
+// GL_ANGLE_texture_multisample
+ANGLE_EXPORT void GL_APIENTRY TexStorage2DMultisampleANGLE(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterivANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfvANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvANGLE(GLenum pname, GLuint index, GLfloat *val);
+ANGLE_EXPORT void GL_APIENTRY SampleMaskiANGLE(GLuint maskNumber, GLbitfield mask);
+
+// GL_ANGLE_translated_shader_source
+ANGLE_EXPORT void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source);
+
+// GL_CHROMIUM_bind_uniform_location
+ANGLE_EXPORT void GL_APIENTRY BindUniformLocationCHROMIUM(GLuint program,
+ GLint location,
+ const GLchar *name);
+
+// GL_CHROMIUM_copy_compressed_texture
+ANGLE_EXPORT void GL_APIENTRY CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
+
+// GL_CHROMIUM_copy_texture
+ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+
+// GL_CHROMIUM_framebuffer_mixed_samples
+ANGLE_EXPORT void GL_APIENTRY CoverageModulationCHROMIUM(GLenum components);
+ANGLE_EXPORT void GL_APIENTRY MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix);
+ANGLE_EXPORT void GL_APIENTRY MatrixLoadIdentityCHROMIUM(GLenum matrixMode);
+
+// GL_CHROMIUM_lose_context
+ANGLE_EXPORT void GL_APIENTRY LoseContextCHROMIUM(GLenum current, GLenum other);
+
+// GL_CHROMIUM_path_rendering
+ANGLE_EXPORT GLuint GL_APIENTRY GenPathsCHROMIUM(GLsizei range);
+ANGLE_EXPORT void GL_APIENTRY DeletePathsCHROMIUM(GLuint first, GLsizei range);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsPathCHROMIUM(GLuint path);
+ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUM(GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords);
+ANGLE_EXPORT void GL_APIENTRY PathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value);
+ANGLE_EXPORT void GL_APIENTRY PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value);
+ANGLE_EXPORT void GL_APIENTRY GetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY GetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value);
+ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY CoverFillPathCHROMIUM(GLuint path, GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY CoverStrokePathCHROMIUM(GLuint path, GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY StencilThenCoverFillPathCHROMIUM(GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY StencilThenCoverStrokePathCHROMIUM(GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY CoverFillPathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY StencilStrokePathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY StencilFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY
+StencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY
+StencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY BindFragmentInputLocationCHROMIUM(GLuint programs,
+ GLint location,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs);
+
+// GL_EXT_blend_func_extended
+ANGLE_EXPORT void GL_APIENTRY BindFragDataLocationEXT(GLuint program,
+ GLuint color,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name);
+ANGLE_EXPORT GLint GL_APIENTRY GetFragDataIndexEXT(GLuint program, const GLchar *name);
+ANGLE_EXPORT GLint GL_APIENTRY GetProgramResourceLocationIndexEXT(GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+
+// GL_EXT_debug_marker
+ANGLE_EXPORT void GL_APIENTRY InsertEventMarkerEXT(GLsizei length, const GLchar *marker);
+ANGLE_EXPORT void GL_APIENTRY PopGroupMarkerEXT();
+ANGLE_EXPORT void GL_APIENTRY PushGroupMarkerEXT(GLsizei length, const GLchar *marker);
+
+// GL_EXT_discard_framebuffer
+ANGLE_EXPORT void GL_APIENTRY DiscardFramebufferEXT(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+
+// GL_EXT_disjoint_timer_query
+ANGLE_EXPORT void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY EndQueryEXT(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsQueryEXT(GLuint id);
+ANGLE_EXPORT void GL_APIENTRY QueryCounterEXT(GLuint id, GLenum target);
+
+// GL_EXT_draw_buffers
+ANGLE_EXPORT void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs);
+
+// GL_EXT_geometry_shader
+ANGLE_EXPORT void GL_APIENTRY FramebufferTextureEXT(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level);
+
+// GL_EXT_instanced_arrays
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedEXT(GLenum mode,
+ GLint start,
+ GLsizei count,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedEXT(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorEXT(GLuint index, GLuint divisor);
+
+// GL_EXT_map_buffer_range
+ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length);
+ANGLE_EXPORT void *GL_APIENTRY MapBufferRangeEXT(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+
+// GL_EXT_memory_object
+ANGLE_EXPORT void GL_APIENTRY BufferStorageMemEXT(GLenum target,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY CreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects);
+ANGLE_EXPORT void GL_APIENTRY DeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects);
+ANGLE_EXPORT void GL_APIENTRY GetMemoryObjectParameterivEXT(GLuint memoryObject,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetUnsignedBytevEXT(GLenum pname, GLubyte *data);
+ANGLE_EXPORT void GL_APIENTRY GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsMemoryObjectEXT(GLuint memoryObject);
+ANGLE_EXPORT void GL_APIENTRY MemoryObjectParameterivEXT(GLuint memoryObject,
+ GLenum pname,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexStorageMem2DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY TexStorageMem2DMultisampleEXT(GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY TexStorageMem3DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY TexStorageMem3DMultisampleEXT(GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+
+// GL_EXT_memory_object_fd
+ANGLE_EXPORT void GL_APIENTRY ImportMemoryFdEXT(GLuint memory,
+ GLuint64 size,
+ GLenum handleType,
+ GLint fd);
+
+// GL_EXT_occlusion_query_boolean
+
+// GL_EXT_robustness
+ANGLE_EXPORT GLenum GL_APIENTRY GetGraphicsResetStatusEXT();
+ANGLE_EXPORT void GL_APIENTRY GetnUniformfvEXT(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformivEXT(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY ReadnPixelsEXT(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data);
+
+// GL_EXT_semaphore
+ANGLE_EXPORT void GL_APIENTRY DeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores);
+ANGLE_EXPORT void GL_APIENTRY GenSemaphoresEXT(GLsizei n, GLuint *semaphores);
+ANGLE_EXPORT void GL_APIENTRY GetSemaphoreParameterui64vEXT(GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSemaphoreEXT(GLuint semaphore);
+ANGLE_EXPORT void GL_APIENTRY SemaphoreParameterui64vEXT(GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params);
+ANGLE_EXPORT void GL_APIENTRY SignalSemaphoreEXT(GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts);
+ANGLE_EXPORT void GL_APIENTRY WaitSemaphoreEXT(GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts);
+
+// GL_EXT_semaphore_fd
+ANGLE_EXPORT void GL_APIENTRY ImportSemaphoreFdEXT(GLuint semaphore, GLenum handleType, GLint fd);
+
+// GL_EXT_texture_storage
+ANGLE_EXPORT void GL_APIENTRY TexStorage1DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width);
+ANGLE_EXPORT void GL_APIENTRY TexStorage2DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY TexStorage3DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+
+// GL_KHR_debug
+ANGLE_EXPORT void GL_APIENTRY DebugMessageCallbackKHR(GLDEBUGPROCKHR callback,
+ const void *userParam);
+ANGLE_EXPORT void GL_APIENTRY DebugMessageControlKHR(GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled);
+ANGLE_EXPORT void GL_APIENTRY DebugMessageInsertKHR(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf);
+ANGLE_EXPORT GLuint GL_APIENTRY GetDebugMessageLogKHR(GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog);
+ANGLE_EXPORT void GL_APIENTRY
+GetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY GetObjectPtrLabelKHR(const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY GetPointervKHR(GLenum pname, void **params);
+ANGLE_EXPORT void GL_APIENTRY ObjectLabelKHR(GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY ObjectPtrLabelKHR(const void *ptr,
+ GLsizei length,
+ const GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY PopDebugGroupKHR();
+ANGLE_EXPORT void GL_APIENTRY PushDebugGroupKHR(GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message);
+
+// GL_KHR_parallel_shader_compile
+ANGLE_EXPORT void GL_APIENTRY MaxShaderCompilerThreadsKHR(GLuint count);
+
+// GL_NV_fence
+ANGLE_EXPORT void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint *fences);
+ANGLE_EXPORT void GL_APIENTRY FinishFenceNV(GLuint fence);
+ANGLE_EXPORT void GL_APIENTRY GenFencesNV(GLsizei n, GLuint *fences);
+ANGLE_EXPORT void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFenceNV(GLuint fence);
+ANGLE_EXPORT void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition);
+ANGLE_EXPORT GLboolean GL_APIENTRY TestFenceNV(GLuint fence);
+
+// GL_OES_EGL_image
+ANGLE_EXPORT void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target,
+ GLeglImageOES image);
+ANGLE_EXPORT void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
+
+// GL_OES_draw_texture
+ANGLE_EXPORT void GL_APIENTRY
+DrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexfvOES(const GLfloat *coords);
+ANGLE_EXPORT void GL_APIENTRY DrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexivOES(const GLint *coords);
+ANGLE_EXPORT void GL_APIENTRY
+DrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexsvOES(const GLshort *coords);
+ANGLE_EXPORT void GL_APIENTRY
+DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexxvOES(const GLfixed *coords);
+
+// GL_OES_framebuffer_object
+ANGLE_EXPORT void GL_APIENTRY BindFramebufferOES(GLenum target, GLuint framebuffer);
+ANGLE_EXPORT void GL_APIENTRY BindRenderbufferOES(GLenum target, GLuint renderbuffer);
+ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatusOES(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbufferOES(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2DOES(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+ANGLE_EXPORT void GL_APIENTRY GenFramebuffersOES(GLsizei n, GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY GenRenderbuffersOES(GLsizei n, GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY GenerateMipmapOES(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivOES(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivOES(GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebufferOES(GLuint framebuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbufferOES(GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageOES(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+
+// GL_OES_get_program_binary
+ANGLE_EXPORT void GL_APIENTRY GetProgramBinaryOES(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+ANGLE_EXPORT void GL_APIENTRY ProgramBinaryOES(GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length);
+
+// GL_OES_mapbuffer
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, void **params);
+ANGLE_EXPORT void *GL_APIENTRY MapBufferOES(GLenum target, GLenum access);
+ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBufferOES(GLenum target);
+
+// GL_OES_matrix_palette
+ANGLE_EXPORT void GL_APIENTRY CurrentPaletteMatrixOES(GLuint matrixpaletteindex);
+ANGLE_EXPORT void GL_APIENTRY LoadPaletteFromModelViewMatrixOES();
+ANGLE_EXPORT void GL_APIENTRY MatrixIndexPointerOES(GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY WeightPointerOES(GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+
+// GL_OES_point_size_array
+ANGLE_EXPORT void GL_APIENTRY PointSizePointerOES(GLenum type, GLsizei stride, const void *pointer);
+
+// GL_OES_query_matrix
+ANGLE_EXPORT GLbitfield GL_APIENTRY QueryMatrixxOES(GLfixed *mantissa, GLint *exponent);
+
+// GL_OES_texture_3D
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3DOES(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTexture3DOES(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLint zoffset);
+ANGLE_EXPORT void GL_APIENTRY TexImage3DOES(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+
+// GL_OES_texture_border_clamp
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIivOES(GLuint sampler,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuivOES(GLuint sampler,
+ GLenum pname,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIivOES(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIuivOES(GLenum target, GLenum pname, GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIivOES(GLuint sampler,
+ GLenum pname,
+ const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuivOES(GLuint sampler,
+ GLenum pname,
+ const GLuint *param);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIivOES(GLenum target, GLenum pname, const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIuivOES(GLenum target,
+ GLenum pname,
+ const GLuint *params);
+
+// GL_OES_texture_cube_map
+ANGLE_EXPORT void GL_APIENTRY GetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexGenivOES(GLenum coord, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY TexGenfOES(GLenum coord, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY TexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexGeniOES(GLenum coord, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY TexGenivOES(GLenum coord, GLenum pname, const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexGenxOES(GLenum coord, GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params);
+
+// GL_OES_texture_storage_multisample_2d_array
+ANGLE_EXPORT void GL_APIENTRY TexStorage3DMultisampleOES(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations);
+
+// GL_OES_vertex_array_object
+ANGLE_EXPORT void GL_APIENTRY BindVertexArrayOES(GLuint array);
+ANGLE_EXPORT void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays);
+ANGLE_EXPORT void GL_APIENTRY GenVertexArraysOES(GLsizei n, GLuint *arrays);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArrayOES(GLuint array);
+
+// GL_OVR_multiview
+ANGLE_EXPORT void GL_APIENTRY FramebufferTextureMultiviewOVR(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews);
+
+// GL_OVR_multiview2
+
+// EGL_ANGLE_explicit_context
+ANGLE_EXPORT void GL_APIENTRY ActiveShaderProgramContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLuint program);
+ANGLE_EXPORT void GL_APIENTRY ActiveTextureContextANGLE(GLeglContext ctx, GLenum texture);
+ANGLE_EXPORT void GL_APIENTRY AlphaFuncContextANGLE(GLeglContext ctx, GLenum func, GLfloat ref);
+ANGLE_EXPORT void GL_APIENTRY AlphaFuncxContextANGLE(GLeglContext ctx, GLenum func, GLfixed ref);
+ANGLE_EXPORT void GL_APIENTRY AttachShaderContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY BeginQueryContextANGLE(GLeglContext ctx, GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY BeginQueryEXTContextANGLE(GLeglContext ctx, GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY BeginTransformFeedbackContextANGLE(GLeglContext ctx,
+ GLenum primitiveMode);
+ANGLE_EXPORT void GL_APIENTRY BindAttribLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY BindBufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint buffer);
+ANGLE_EXPORT void GL_APIENTRY BindBufferBaseContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLuint buffer);
+ANGLE_EXPORT void GL_APIENTRY BindBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+ANGLE_EXPORT void GL_APIENTRY BindFragDataLocationEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint color,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY BindFragDataLocationIndexedEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY BindFramebufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint framebuffer);
+ANGLE_EXPORT void GL_APIENTRY BindFramebufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint framebuffer);
+ANGLE_EXPORT void GL_APIENTRY BindImageTextureContextANGLE(GLeglContext ctx,
+ GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format);
+ANGLE_EXPORT void GL_APIENTRY BindProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline);
+ANGLE_EXPORT void GL_APIENTRY BindRenderbufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY BindRenderbufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY BindSamplerContextANGLE(GLeglContext ctx,
+ GLuint unit,
+ GLuint sampler);
+ANGLE_EXPORT void GL_APIENTRY BindTextureContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint texture);
+ANGLE_EXPORT void GL_APIENTRY BindTransformFeedbackContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint id);
+ANGLE_EXPORT void GL_APIENTRY BindVertexArrayContextANGLE(GLeglContext ctx, GLuint array);
+ANGLE_EXPORT void GL_APIENTRY BindVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
+ANGLE_EXPORT void GL_APIENTRY BindVertexBufferContextANGLE(GLeglContext ctx,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride);
+ANGLE_EXPORT void GL_APIENTRY
+BlendColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY BlendEquationContextANGLE(GLeglContext ctx, GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY BlendEquationSeparateContextANGLE(GLeglContext ctx,
+ GLenum modeRGB,
+ GLenum modeAlpha);
+ANGLE_EXPORT void GL_APIENTRY BlendFuncContextANGLE(GLeglContext ctx,
+ GLenum sfactor,
+ GLenum dfactor);
+ANGLE_EXPORT void GL_APIENTRY BlendFuncSeparateContextANGLE(GLeglContext ctx,
+ GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha);
+ANGLE_EXPORT void GL_APIENTRY BlitFramebufferContextANGLE(GLeglContext ctx,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+ANGLE_EXPORT void GL_APIENTRY BlitFramebufferANGLEContextANGLE(GLeglContext ctx,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter);
+ANGLE_EXPORT void GL_APIENTRY BufferDataContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizeiptr size,
+ const void *data,
+ GLenum usage);
+ANGLE_EXPORT void GL_APIENTRY BufferStorageMemEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY BufferSubDataContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data);
+ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatusContextANGLE(GLeglContext ctx, GLenum target);
+ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatusOESContextANGLE(GLeglContext ctx,
+ GLenum target);
+ANGLE_EXPORT void GL_APIENTRY ClearContextANGLE(GLeglContext ctx, GLbitfield mask);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferfiContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferfvContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferivContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferuivContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY
+ClearColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY
+ClearColorxContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+ANGLE_EXPORT void GL_APIENTRY ClearDepthfContextANGLE(GLeglContext ctx, GLfloat d);
+ANGLE_EXPORT void GL_APIENTRY ClearDepthxContextANGLE(GLeglContext ctx, GLfixed depth);
+ANGLE_EXPORT void GL_APIENTRY ClearStencilContextANGLE(GLeglContext ctx, GLint s);
+ANGLE_EXPORT void GL_APIENTRY ClientActiveTextureContextANGLE(GLeglContext ctx, GLenum texture);
+ANGLE_EXPORT GLenum GL_APIENTRY ClientWaitSyncContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout);
+ANGLE_EXPORT void GL_APIENTRY ClipPlanefContextANGLE(GLeglContext ctx,
+ GLenum p,
+ const GLfloat *eqn);
+ANGLE_EXPORT void GL_APIENTRY ClipPlanexContextANGLE(GLeglContext ctx,
+ GLenum plane,
+ const GLfixed *equation);
+ANGLE_EXPORT void GL_APIENTRY
+Color4fContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY
+Color4ubContextANGLE(GLeglContext ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+ANGLE_EXPORT void GL_APIENTRY
+Color4xContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+ANGLE_EXPORT void GL_APIENTRY ColorMaskContextANGLE(GLeglContext ctx,
+ GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha);
+ANGLE_EXPORT void GL_APIENTRY ColorPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY CompileShaderContextANGLE(GLeglContext ctx, GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data);
+ANGLE_EXPORT void GL_APIENTRY CopyBufferSubDataContextANGLE(GLeglContext ctx,
+ GLenum readTarget,
+ GLenum writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size);
+ANGLE_EXPORT void GL_APIENTRY CopyTexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY CreateMemoryObjectsEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *memoryObjects);
+ANGLE_EXPORT GLuint GL_APIENTRY CreateProgramContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT GLuint GL_APIENTRY CreateShaderContextANGLE(GLeglContext ctx, GLenum type);
+ANGLE_EXPORT GLuint GL_APIENTRY CreateShaderProgramvContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei count,
+ const GLchar *const *strings);
+ANGLE_EXPORT void GL_APIENTRY CullFaceContextANGLE(GLeglContext ctx, GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY CurrentPaletteMatrixOESContextANGLE(GLeglContext ctx,
+ GLuint matrixpaletteindex);
+ANGLE_EXPORT void GL_APIENTRY DebugMessageCallbackKHRContextANGLE(GLeglContext ctx,
+ GLDEBUGPROCKHR callback,
+ const void *userParam);
+ANGLE_EXPORT void GL_APIENTRY DebugMessageControlKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled);
+ANGLE_EXPORT void GL_APIENTRY DebugMessageInsertKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf);
+ANGLE_EXPORT void GL_APIENTRY DeleteBuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *buffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteFencesNVContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *fences);
+ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteMemoryObjectsEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *memoryObjects);
+ANGLE_EXPORT void GL_APIENTRY DeleteProgramContextANGLE(GLeglContext ctx, GLuint program);
+ANGLE_EXPORT void GL_APIENTRY DeleteProgramPipelinesContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *pipelines);
+ANGLE_EXPORT void GL_APIENTRY DeleteQueriesContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY DeleteQueriesEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteSamplersContextANGLE(GLeglContext ctx,
+ GLsizei count,
+ const GLuint *samplers);
+ANGLE_EXPORT void GL_APIENTRY DeleteSemaphoresEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *semaphores);
+ANGLE_EXPORT void GL_APIENTRY DeleteShaderContextANGLE(GLeglContext ctx, GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY DeleteSyncContextANGLE(GLeglContext ctx, GLsync sync);
+ANGLE_EXPORT void GL_APIENTRY DeleteTexturesContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *textures);
+ANGLE_EXPORT void GL_APIENTRY DeleteTransformFeedbacksContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY DeleteVertexArraysContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *arrays);
+ANGLE_EXPORT void GL_APIENTRY DeleteVertexArraysOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *arrays);
+ANGLE_EXPORT void GL_APIENTRY DepthFuncContextANGLE(GLeglContext ctx, GLenum func);
+ANGLE_EXPORT void GL_APIENTRY DepthMaskContextANGLE(GLeglContext ctx, GLboolean flag);
+ANGLE_EXPORT void GL_APIENTRY DepthRangefContextANGLE(GLeglContext ctx, GLfloat n, GLfloat f);
+ANGLE_EXPORT void GL_APIENTRY DepthRangexContextANGLE(GLeglContext ctx, GLfixed n, GLfixed f);
+ANGLE_EXPORT void GL_APIENTRY DetachShaderContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY DisableContextANGLE(GLeglContext ctx, GLenum cap);
+ANGLE_EXPORT void GL_APIENTRY DisableClientStateContextANGLE(GLeglContext ctx, GLenum array);
+ANGLE_EXPORT void GL_APIENTRY DisableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index);
+ANGLE_EXPORT void GL_APIENTRY DiscardFramebufferEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+ANGLE_EXPORT void GL_APIENTRY DispatchComputeContextANGLE(GLeglContext ctx,
+ GLuint num_groups_x,
+ GLuint num_groups_y,
+ GLuint num_groups_z);
+ANGLE_EXPORT void GL_APIENTRY DispatchComputeIndirectContextANGLE(GLeglContext ctx,
+ GLintptr indirect);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysIndirectContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const void *indirect);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedEXTContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint start,
+ GLsizei count,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY DrawBuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLenum *bufs);
+ANGLE_EXPORT void GL_APIENTRY DrawBuffersEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLenum *bufs);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsIndirectContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLenum type,
+ const void *indirect);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedEXTContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY DrawRangeElementsContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices);
+ANGLE_EXPORT void GL_APIENTRY DrawTexfOESContextANGLE(GLeglContext ctx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat width,
+ GLfloat height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexfvOESContextANGLE(GLeglContext ctx, const GLfloat *coords);
+ANGLE_EXPORT void GL_APIENTRY
+DrawTexiOESContextANGLE(GLeglContext ctx, GLint x, GLint y, GLint z, GLint width, GLint height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexivOESContextANGLE(GLeglContext ctx, const GLint *coords);
+ANGLE_EXPORT void GL_APIENTRY DrawTexsOESContextANGLE(GLeglContext ctx,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort width,
+ GLshort height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexsvOESContextANGLE(GLeglContext ctx, const GLshort *coords);
+ANGLE_EXPORT void GL_APIENTRY DrawTexxOESContextANGLE(GLeglContext ctx,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z,
+ GLfixed width,
+ GLfixed height);
+ANGLE_EXPORT void GL_APIENTRY DrawTexxvOESContextANGLE(GLeglContext ctx, const GLfixed *coords);
+ANGLE_EXPORT void GL_APIENTRY EGLImageTargetRenderbufferStorageOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLeglImageOES image);
+ANGLE_EXPORT void GL_APIENTRY EGLImageTargetTexture2DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLeglImageOES image);
+ANGLE_EXPORT void GL_APIENTRY EnableContextANGLE(GLeglContext ctx, GLenum cap);
+ANGLE_EXPORT void GL_APIENTRY EnableClientStateContextANGLE(GLeglContext ctx, GLenum array);
+ANGLE_EXPORT void GL_APIENTRY EnableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index);
+ANGLE_EXPORT void GL_APIENTRY EndQueryContextANGLE(GLeglContext ctx, GLenum target);
+ANGLE_EXPORT void GL_APIENTRY EndQueryEXTContextANGLE(GLeglContext ctx, GLenum target);
+ANGLE_EXPORT void GL_APIENTRY EndTransformFeedbackContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT GLsync GL_APIENTRY FenceSyncContextANGLE(GLeglContext ctx,
+ GLenum condition,
+ GLbitfield flags);
+ANGLE_EXPORT void GL_APIENTRY FinishContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY FinishFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
+ANGLE_EXPORT void GL_APIENTRY FlushContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length);
+ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRangeEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length);
+ANGLE_EXPORT void GL_APIENTRY FogfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY FogfvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY FogxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY FogxvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfixed *param);
+ANGLE_EXPORT void GL_APIENTRY FramebufferParameteriContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint param);
+ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTexture3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLint zoffset);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTextureEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTextureLayerContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTextureMultiviewOVRContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews);
+ANGLE_EXPORT void GL_APIENTRY FrontFaceContextANGLE(GLeglContext ctx, GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY FrustumfContextANGLE(GLeglContext ctx,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f);
+ANGLE_EXPORT void GL_APIENTRY FrustumxContextANGLE(GLeglContext ctx,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f);
+ANGLE_EXPORT void GL_APIENTRY GenBuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *buffers);
+ANGLE_EXPORT void GL_APIENTRY GenFencesNVContextANGLE(GLeglContext ctx, GLsizei n, GLuint *fences);
+ANGLE_EXPORT void GL_APIENTRY GenFramebuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY GenFramebuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *framebuffers);
+ANGLE_EXPORT void GL_APIENTRY GenProgramPipelinesContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *pipelines);
+ANGLE_EXPORT void GL_APIENTRY GenQueriesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY GenQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY GenRenderbuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY GenRenderbuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY GenSamplersContextANGLE(GLeglContext ctx,
+ GLsizei count,
+ GLuint *samplers);
+ANGLE_EXPORT void GL_APIENTRY GenSemaphoresEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *semaphores);
+ANGLE_EXPORT void GL_APIENTRY GenTexturesContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *textures);
+ANGLE_EXPORT void GL_APIENTRY GenTransformFeedbacksContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY GenVertexArraysContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *arrays);
+ANGLE_EXPORT void GL_APIENTRY GenVertexArraysOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *arrays);
+ANGLE_EXPORT void GL_APIENTRY GenerateMipmapContextANGLE(GLeglContext ctx, GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GenerateMipmapOESContextANGLE(GLeglContext ctx, GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GetActiveAttribContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockNameContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformsivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetAttachedShadersContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders);
+ANGLE_EXPORT GLint GL_APIENTRY GetAttribLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetBooleani_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLboolean *data);
+ANGLE_EXPORT void GL_APIENTRY GetBooleanvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLboolean *data);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointervContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointervOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY GetClipPlanefContextANGLE(GLeglContext ctx,
+ GLenum plane,
+ GLfloat *equation);
+ANGLE_EXPORT void GL_APIENTRY GetClipPlanexContextANGLE(GLeglContext ctx,
+ GLenum plane,
+ GLfixed *equation);
+ANGLE_EXPORT GLuint GL_APIENTRY GetDebugMessageLogKHRContextANGLE(GLeglContext ctx,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog);
+ANGLE_EXPORT GLenum GL_APIENTRY GetErrorContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY GetFenceivNVContextANGLE(GLeglContext ctx,
+ GLuint fence,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetFixedvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetFloatvContextANGLE(GLeglContext ctx, GLenum pname, GLfloat *data);
+ANGLE_EXPORT GLint GL_APIENTRY GetFragDataIndexEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name);
+ANGLE_EXPORT GLint GL_APIENTRY GetFragDataLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT GLenum GL_APIENTRY GetGraphicsResetStatusEXTContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64vContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetIntegeri_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetIntegervContextANGLE(GLeglContext ctx, GLenum pname, GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetInternalformativContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetLightfvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetLightxvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetMaterialfvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetMaterialxvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx,
+ GLuint memoryObject,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val);
+ANGLE_EXPORT void GL_APIENTRY GetObjectLabelKHRContextANGLE(GLeglContext ctx,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY GetObjectPtrLabelKHRContextANGLE(GLeglContext ctx,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY GetPointervContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY GetPointervKHRContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramBinaryContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+ANGLE_EXPORT void GL_APIENTRY GetProgramBinaryOESContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary);
+ANGLE_EXPORT void GL_APIENTRY GetProgramInfoLogContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineInfoLogContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineivContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT GLuint GL_APIENTRY GetProgramResourceIndexContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+ANGLE_EXPORT GLint GL_APIENTRY GetProgramResourceLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+ANGLE_EXPORT GLint GL_APIENTRY
+GetProgramResourceLocationIndexEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetProgramResourceNameContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetProgramResourceivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryivEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetShaderInfoLogContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog);
+ANGLE_EXPORT void GL_APIENTRY GetShaderPrecisionFormatContextANGLE(GLeglContext ctx,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision);
+ANGLE_EXPORT void GL_APIENTRY GetShaderSourceContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source);
+ANGLE_EXPORT void GL_APIENTRY GetShaderivContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT const GLubyte *GL_APIENTRY GetStringContextANGLE(GLeglContext ctx, GLenum name);
+ANGLE_EXPORT const GLubyte *GL_APIENTRY GetStringiContextANGLE(GLeglContext ctx,
+ GLenum name,
+ GLuint index);
+ANGLE_EXPORT void GL_APIENTRY GetSyncivContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values);
+ANGLE_EXPORT void GL_APIENTRY GetTexEnvfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexEnvivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexEnvxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexGenfvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexGenivOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexGenxvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY GetTransformFeedbackVaryingContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetTranslatedShaderSourceANGLEContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source);
+ANGLE_EXPORT GLuint GL_APIENTRY GetUniformBlockIndexContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *uniformBlockName);
+ANGLE_EXPORT void GL_APIENTRY GetUniformIndicesContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices);
+ANGLE_EXPORT GLint GL_APIENTRY GetUniformLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetUniformfvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformuivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetUnsignedBytevEXTContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLubyte *data);
+ANGLE_EXPORT void GL_APIENTRY GetUnsignedBytei_vEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLubyte *data);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointervContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ void **pointer);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfvContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformfvEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformivEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY HintContextANGLE(GLeglContext ctx, GLenum target, GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY ImportMemoryFdEXTContextANGLE(GLeglContext ctx,
+ GLuint memory,
+ GLuint64 size,
+ GLenum handleType,
+ GLint fd);
+ANGLE_EXPORT void GL_APIENTRY ImportSemaphoreFdEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum handleType,
+ GLint fd);
+ANGLE_EXPORT void GL_APIENTRY InsertEventMarkerEXTContextANGLE(GLeglContext ctx,
+ GLsizei length,
+ const GLchar *marker);
+ANGLE_EXPORT void GL_APIENTRY InvalidateFramebufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments);
+ANGLE_EXPORT void GL_APIENTRY InvalidateSubFramebufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsBufferContextANGLE(GLeglContext ctx, GLuint buffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabledContextANGLE(GLeglContext ctx, GLenum cap);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebufferContextANGLE(GLeglContext ctx, GLuint framebuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebufferOESContextANGLE(GLeglContext ctx,
+ GLuint framebuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsMemoryObjectEXTContextANGLE(GLeglContext ctx,
+ GLuint memoryObject);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsProgramContextANGLE(GLeglContext ctx, GLuint program);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsQueryContextANGLE(GLeglContext ctx, GLuint id);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsQueryEXTContextANGLE(GLeglContext ctx, GLuint id);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbufferContextANGLE(GLeglContext ctx,
+ GLuint renderbuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbufferOESContextANGLE(GLeglContext ctx,
+ GLuint renderbuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSamplerContextANGLE(GLeglContext ctx, GLuint sampler);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsShaderContextANGLE(GLeglContext ctx, GLuint shader);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSyncContextANGLE(GLeglContext ctx, GLsync sync);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsTextureContextANGLE(GLeglContext ctx, GLuint texture);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsTransformFeedbackContextANGLE(GLeglContext ctx, GLuint id);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArrayContextANGLE(GLeglContext ctx, GLuint array);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array);
+ANGLE_EXPORT void GL_APIENTRY LightModelfContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY LightModelfvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY LightModelxContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY LightModelxvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfixed *param);
+ANGLE_EXPORT void GL_APIENTRY LightfContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY LightfvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY LightxContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY LightxvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY LineWidthContextANGLE(GLeglContext ctx, GLfloat width);
+ANGLE_EXPORT void GL_APIENTRY LineWidthxContextANGLE(GLeglContext ctx, GLfixed width);
+ANGLE_EXPORT void GL_APIENTRY LinkProgramContextANGLE(GLeglContext ctx, GLuint program);
+ANGLE_EXPORT void GL_APIENTRY LoadIdentityContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY LoadMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m);
+ANGLE_EXPORT void GL_APIENTRY LoadMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m);
+ANGLE_EXPORT void GL_APIENTRY LoadPaletteFromModelViewMatrixOESContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY LogicOpContextANGLE(GLeglContext ctx, GLenum opcode);
+ANGLE_EXPORT void *GL_APIENTRY MapBufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum access);
+ANGLE_EXPORT void *GL_APIENTRY MapBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+ANGLE_EXPORT void *GL_APIENTRY MapBufferRangeEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+ANGLE_EXPORT void GL_APIENTRY MaterialfContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY MaterialfvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY MaterialxContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY MaterialxvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ const GLfixed *param);
+ANGLE_EXPORT void GL_APIENTRY MatrixIndexPointerOESContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY MatrixModeContextANGLE(GLeglContext ctx, GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY MaxShaderCompilerThreadsKHRContextANGLE(GLeglContext ctx,
+ GLuint count);
+ANGLE_EXPORT void GL_APIENTRY MemoryBarrierContextANGLE(GLeglContext ctx, GLbitfield barriers);
+ANGLE_EXPORT void GL_APIENTRY MemoryBarrierByRegionContextANGLE(GLeglContext ctx,
+ GLbitfield barriers);
+ANGLE_EXPORT void GL_APIENTRY MemoryObjectParameterivEXTContextANGLE(GLeglContext ctx,
+ GLuint memoryObject,
+ GLenum pname,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY MultMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m);
+ANGLE_EXPORT void GL_APIENTRY MultMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m);
+ANGLE_EXPORT void GL_APIENTRY MultiTexCoord4fContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLfloat s,
+ GLfloat t,
+ GLfloat r,
+ GLfloat q);
+ANGLE_EXPORT void GL_APIENTRY MultiTexCoord4xContextANGLE(GLeglContext ctx,
+ GLenum texture,
+ GLfixed s,
+ GLfixed t,
+ GLfixed r,
+ GLfixed q);
+ANGLE_EXPORT void GL_APIENTRY Normal3fContextANGLE(GLeglContext ctx,
+ GLfloat nx,
+ GLfloat ny,
+ GLfloat nz);
+ANGLE_EXPORT void GL_APIENTRY Normal3xContextANGLE(GLeglContext ctx,
+ GLfixed nx,
+ GLfixed ny,
+ GLfixed nz);
+ANGLE_EXPORT void GL_APIENTRY NormalPointerContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY ObjectLabelKHRContextANGLE(GLeglContext ctx,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY ObjectPtrLabelKHRContextANGLE(GLeglContext ctx,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label);
+ANGLE_EXPORT void GL_APIENTRY OrthofContextANGLE(GLeglContext ctx,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f);
+ANGLE_EXPORT void GL_APIENTRY OrthoxContextANGLE(GLeglContext ctx,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f);
+ANGLE_EXPORT void GL_APIENTRY PauseTransformFeedbackContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY PixelStoreiContextANGLE(GLeglContext ctx, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY PointParameterfContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY PointParameterfvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY PointParameterxContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY PointParameterxvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY PointSizeContextANGLE(GLeglContext ctx, GLfloat size);
+ANGLE_EXPORT void GL_APIENTRY PointSizePointerOESContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY PointSizexContextANGLE(GLeglContext ctx, GLfixed size);
+ANGLE_EXPORT void GL_APIENTRY PolygonOffsetContextANGLE(GLeglContext ctx,
+ GLfloat factor,
+ GLfloat units);
+ANGLE_EXPORT void GL_APIENTRY PolygonOffsetxContextANGLE(GLeglContext ctx,
+ GLfixed factor,
+ GLfixed units);
+ANGLE_EXPORT void GL_APIENTRY PopDebugGroupKHRContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY PopGroupMarkerEXTContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY PopMatrixContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY ProgramBinaryContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length);
+ANGLE_EXPORT void GL_APIENTRY ProgramBinaryOESContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length);
+ANGLE_EXPORT void GL_APIENTRY ProgramParameteriContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLint value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform1uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramUniform2iContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform2uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform3uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniform4uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2x3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2x4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3x2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3x4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4x2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4x3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY PushDebugGroupKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message);
+ANGLE_EXPORT void GL_APIENTRY PushGroupMarkerEXTContextANGLE(GLeglContext ctx,
+ GLsizei length,
+ const GLchar *marker);
+ANGLE_EXPORT void GL_APIENTRY PushMatrixContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY QueryCounterEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum target);
+ANGLE_EXPORT GLbitfield GL_APIENTRY QueryMatrixxOESContextANGLE(GLeglContext ctx,
+ GLfixed *mantissa,
+ GLint *exponent);
+ANGLE_EXPORT void GL_APIENTRY ReadBufferContextANGLE(GLeglContext ctx, GLenum src);
+ANGLE_EXPORT void GL_APIENTRY ReadPixelsContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels);
+ANGLE_EXPORT void GL_APIENTRY ReadnPixelsEXTContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data);
+ANGLE_EXPORT void GL_APIENTRY ReleaseShaderCompilerContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisampleContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisampleANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY ResumeTransformFeedbackContextANGLE(GLeglContext ctx);
+ANGLE_EXPORT void GL_APIENTRY
+RotatefContextANGLE(GLeglContext ctx, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY
+RotatexContextANGLE(GLeglContext ctx, GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+ANGLE_EXPORT void GL_APIENTRY SampleCoverageContextANGLE(GLeglContext ctx,
+ GLfloat value,
+ GLboolean invert);
+ANGLE_EXPORT void GL_APIENTRY SampleCoveragexContextANGLE(GLeglContext ctx,
+ GLclampx value,
+ GLboolean invert);
+ANGLE_EXPORT void GL_APIENTRY SampleMaskiContextANGLE(GLeglContext ctx,
+ GLuint maskNumber,
+ GLbitfield mask);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterfContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLfloat *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameteriContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterivContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY ScalefContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY ScalexContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z);
+ANGLE_EXPORT void GL_APIENTRY
+ScissorContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY SemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params);
+ANGLE_EXPORT void GL_APIENTRY SetFenceNVContextANGLE(GLeglContext ctx,
+ GLuint fence,
+ GLenum condition);
+ANGLE_EXPORT void GL_APIENTRY ShadeModelContextANGLE(GLeglContext ctx, GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY ShaderBinaryContextANGLE(GLeglContext ctx,
+ GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length);
+ANGLE_EXPORT void GL_APIENTRY ShaderSourceContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length);
+ANGLE_EXPORT void GL_APIENTRY SignalSemaphoreEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts);
+ANGLE_EXPORT void GL_APIENTRY StencilFuncContextANGLE(GLeglContext ctx,
+ GLenum func,
+ GLint ref,
+ GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY
+StencilFuncSeparateContextANGLE(GLeglContext ctx, GLenum face, GLenum func, GLint ref, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilMaskContextANGLE(GLeglContext ctx, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilMaskSeparateContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilOpContextANGLE(GLeglContext ctx,
+ GLenum fail,
+ GLenum zfail,
+ GLenum zpass);
+ANGLE_EXPORT void GL_APIENTRY StencilOpSeparateContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum sfail,
+ GLenum dpfail,
+ GLenum dppass);
+ANGLE_EXPORT GLboolean GL_APIENTRY TestFenceNVContextANGLE(GLeglContext ctx, GLuint fence);
+ANGLE_EXPORT void GL_APIENTRY TexCoordPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY TexEnvfContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY TexEnvfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexEnviContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint param);
+ANGLE_EXPORT void GL_APIENTRY TexEnvivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexEnvxContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY TexEnvxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY TexGenfOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY TexGenfvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexGeniOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLint param);
+ANGLE_EXPORT void GL_APIENTRY TexGenivOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexGenxOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY TexGenxvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY TexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterfContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY TexParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameteriContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint param);
+ANGLE_EXPORT void GL_APIENTRY TexParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterxContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed param);
+ANGLE_EXPORT void GL_APIENTRY TexParameterxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfixed *params);
+ANGLE_EXPORT void GL_APIENTRY TexStorage1DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width);
+ANGLE_EXPORT void GL_APIENTRY TexStorage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY TexStorage2DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY TexStorage2DMultisampleContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+ANGLE_EXPORT void GL_APIENTRY TexStorage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+ANGLE_EXPORT void GL_APIENTRY TexStorage3DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth);
+ANGLE_EXPORT void GL_APIENTRY
+TexStorage3DMultisampleOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations);
+ANGLE_EXPORT void GL_APIENTRY TexStorageMem2DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY
+TexStorageMem2DMultisampleEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY TexStorageMem3DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY
+TexStorageMem3DMultisampleEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TransformFeedbackVaryingsContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode);
+ANGLE_EXPORT void GL_APIENTRY TranslatefContextANGLE(GLeglContext ctx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY TranslatexContextANGLE(GLeglContext ctx,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z);
+ANGLE_EXPORT void GL_APIENTRY Uniform1fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0);
+ANGLE_EXPORT void GL_APIENTRY Uniform1fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform1iContextANGLE(GLeglContext ctx, GLint location, GLint v0);
+ANGLE_EXPORT void GL_APIENTRY Uniform1ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform1uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0);
+ANGLE_EXPORT void GL_APIENTRY Uniform1uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform2fContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1);
+ANGLE_EXPORT void GL_APIENTRY Uniform2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform2iContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLint v0,
+ GLint v1);
+ANGLE_EXPORT void GL_APIENTRY Uniform2ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform2uiContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLuint v0,
+ GLuint v1);
+ANGLE_EXPORT void GL_APIENTRY Uniform2uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY
+Uniform3fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+ANGLE_EXPORT void GL_APIENTRY Uniform3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY
+Uniform3iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2);
+ANGLE_EXPORT void GL_APIENTRY Uniform3ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY
+Uniform3uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2);
+ANGLE_EXPORT void GL_APIENTRY Uniform3uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform4fContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3);
+ANGLE_EXPORT void GL_APIENTRY Uniform4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY
+Uniform4iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+ANGLE_EXPORT void GL_APIENTRY Uniform4ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value);
+ANGLE_EXPORT void GL_APIENTRY Uniform4uiContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3);
+ANGLE_EXPORT void GL_APIENTRY Uniform4uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value);
+ANGLE_EXPORT void GL_APIENTRY UniformBlockBindingContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBufferContextANGLE(GLeglContext ctx, GLenum target);
+ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBufferOESContextANGLE(GLeglContext ctx, GLenum target);
+ANGLE_EXPORT void GL_APIENTRY UseProgramContextANGLE(GLeglContext ctx, GLuint program);
+ANGLE_EXPORT void GL_APIENTRY UseProgramStagesContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLbitfield stages,
+ GLuint program);
+ANGLE_EXPORT void GL_APIENTRY ValidateProgramContextANGLE(GLeglContext ctx, GLuint program);
+ANGLE_EXPORT void GL_APIENTRY ValidateProgramPipelineContextANGLE(GLeglContext ctx,
+ GLuint pipeline);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib1fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib1fvContextANGLE(GLeglContext ctx,
+ GLuint index,
+ const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib2fContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLfloat x,
+ GLfloat y);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib2fvContextANGLE(GLeglContext ctx,
+ GLuint index,
+ const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY
+VertexAttrib3fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib3fvContextANGLE(GLeglContext ctx,
+ GLuint index,
+ const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib4fContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib4fvContextANGLE(GLeglContext ctx,
+ GLuint index,
+ const GLfloat *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribBindingContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLuint bindingindex);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint divisor);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint divisor);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorEXTContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint divisor);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribFormatContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset);
+ANGLE_EXPORT void GL_APIENTRY
+VertexAttribI4iContextANGLE(GLeglContext ctx, GLuint index, GLint x, GLint y, GLint z, GLint w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4ivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ const GLint *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4uiContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint x,
+ GLuint y,
+ GLuint z,
+ GLuint w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4uivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ const GLuint *v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribIFormatContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribIPointerContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribPointerContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY VertexBindingDivisorContextANGLE(GLeglContext ctx,
+ GLuint bindingindex,
+ GLuint divisor);
+ANGLE_EXPORT void GL_APIENTRY VertexPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY
+ViewportContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY WaitSemaphoreEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts);
+ANGLE_EXPORT void GL_APIENTRY WaitSyncContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout);
+ANGLE_EXPORT void GL_APIENTRY WeightPointerOESContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer);
+ANGLE_EXPORT void GL_APIENTRY BindUniformLocationCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY CoverageModulationCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum components);
+ANGLE_EXPORT void GL_APIENTRY MatrixLoadfCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum matrixMode,
+ const GLfloat *matrix);
+ANGLE_EXPORT void GL_APIENTRY MatrixLoadIdentityCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum matrixMode);
+ANGLE_EXPORT GLuint GL_APIENTRY GenPathsCHROMIUMContextANGLE(GLeglContext ctx, GLsizei range);
+ANGLE_EXPORT void GL_APIENTRY DeletePathsCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint first,
+ GLsizei range);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path);
+ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords);
+ANGLE_EXPORT void GL_APIENTRY PathParameterfCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLfloat value);
+ANGLE_EXPORT void GL_APIENTRY PathParameteriCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLint value);
+ANGLE_EXPORT void GL_APIENTRY GetPathParameterfvCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLfloat *value);
+ANGLE_EXPORT void GL_APIENTRY GetPathParameterivCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLint *value);
+ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum func,
+ GLint ref,
+ GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLint reference,
+ GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY CoverFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY CoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY StencilThenCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY StencilThenCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode);
+ANGLE_EXPORT void GL_APIENTRY
+CoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY
+CoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY
+StencilStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY
+StencilFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY
+StencilThenCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY
+StencilThenCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues);
+ANGLE_EXPORT void GL_APIENTRY BindFragmentInputLocationCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint programs,
+ GLint location,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY
+ProgramPathFragmentInputGenCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs);
+ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+ANGLE_EXPORT void GL_APIENTRY CompressedCopyTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLuint destId);
+ANGLE_EXPORT void GL_APIENTRY RequestExtensionANGLEContextANGLE(GLeglContext ctx,
+ const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY GetBooleanvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetFloatvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY
+GetFramebufferAttachmentParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetIntegervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetProgramivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetShaderivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer);
+ANGLE_EXPORT void GL_APIENTRY ReadPixelsRobustANGLEContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data);
+ANGLE_EXPORT void GL_APIENTRY GetQueryivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY GetIntegeri_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data);
+ANGLE_EXPORT void GL_APIENTRY GetInternalformativRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY
+GetActiveUniformBlockivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetBooleani_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data);
+ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetPointervRobustANGLERobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params);
+ANGLE_EXPORT void GL_APIENTRY ReadnPixelsRobustANGLEContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params);
+ANGLE_EXPORT void GL_APIENTRY TexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params);
+ANGLE_EXPORT void GL_APIENTRY CopyTexture3DANGLEContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+ANGLE_EXPORT void GL_APIENTRY CopySubTexture3DANGLEContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha);
+ANGLE_EXPORT void GL_APIENTRY
+TexStorage2DMultisampleANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterivANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfvANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params);
+ANGLE_EXPORT void GL_APIENTRY MultiDrawArraysANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount);
+ANGLE_EXPORT void GL_APIENTRY
+MultiDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+ANGLE_EXPORT void GL_APIENTRY MultiDrawElementsANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ GLsizei drawcount);
+ANGLE_EXPORT void GL_APIENTRY
+MultiDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount);
+ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val);
+ANGLE_EXPORT void GL_APIENTRY SampleMaskiANGLEContextANGLE(GLeglContext ctx,
+ GLuint maskNumber,
+ GLbitfield mask);
+ANGLE_EXPORT void GL_APIENTRY ProvokingVertexANGLEContextANGLE(GLeglContext ctx, GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY LoseContextCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum current,
+ GLenum other);
+ANGLE_EXPORT void GL_APIENTRY TexImage2DExternalANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type);
+ANGLE_EXPORT void GL_APIENTRY InvalidateTextureANGLEContextANGLE(GLeglContext ctx, GLenum target);
+} // namespace gl
+
+#endif // LIBGLESV2_ENTRY_POINTS_GLES_EXT_AUTOGEN_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/global_state.cpp b/gfx/angle/checkout/src/libGLESv2/global_state.cpp
new file mode 100644
index 0000000000..f9830a0f80
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/global_state.cpp
@@ -0,0 +1,225 @@
+//
+// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// global_state.cpp : Implements functions for querying the thread-local GL and EGL state.
+
+#include "libGLESv2/global_state.h"
+
+#include "common/debug.h"
+#include "common/platform.h"
+#include "common/tls.h"
+
+namespace gl
+{
+// In single-threaded cases we can avoid a TLS lookup for the current Context.
+//
+// Let a global single-threaded context have 3 states: unset, set, and multi-threaded.
+// Initially it is unset. Then, on MakeCurrent:
+//
+// * if the ST context is unset -> set the global context.
+// * if the ST context is set and matches the TLS -> set the global context.
+// * if the ST context is set and does not match TLS -> set multi-threaded mode.
+// * if in multi-threaded mode, unset and subsequently ignore the global context.
+//
+// Implementation-wise we can use a pointer and a boolean to represent the three modes.
+Context *gSingleThreadedContext = nullptr;
+bool gIsMultiThreadedContext = false;
+} // namespace gl
+
+namespace egl
+{
+namespace
+{
+static TLSIndex threadTLS = TLS_INVALID_INDEX;
+Debug *g_Debug = nullptr;
+std::atomic<std::mutex *> g_Mutex;
+
+Thread *AllocateCurrentThread()
+{
+ ASSERT(threadTLS != TLS_INVALID_INDEX);
+ if (threadTLS == TLS_INVALID_INDEX)
+ {
+ return nullptr;
+ }
+
+ Thread *thread = new Thread();
+ if (!SetTLSValue(threadTLS, thread))
+ {
+ ERR() << "Could not set thread local storage.";
+ return nullptr;
+ }
+
+ return thread;
+}
+
+void AllocateDebug()
+{
+ // All EGL calls use a global lock, this is thread safe
+ if (g_Debug == nullptr)
+ {
+ g_Debug = new Debug();
+ }
+}
+
+void AllocateMutex()
+{
+ if (g_Mutex == nullptr)
+ {
+ std::unique_ptr<std::mutex> newMutex(new std::mutex());
+ std::mutex *expected = nullptr;
+ if (g_Mutex.compare_exchange_strong(expected, newMutex.get()))
+ {
+ newMutex.release();
+ }
+ }
+}
+
+} // anonymous namespace
+
+std::mutex &GetGlobalMutex()
+{
+ AllocateMutex();
+ return *g_Mutex;
+}
+
+Thread *GetCurrentThread()
+{
+ // Create a TLS index if one has not been created for this DLL
+ if (threadTLS == TLS_INVALID_INDEX)
+ {
+ threadTLS = CreateTLSIndex();
+ }
+
+ Thread *current = static_cast<Thread *>(GetTLSValue(threadTLS));
+
+ // ANGLE issue 488: when the dll is loaded after thread initialization,
+ // thread local storage (current) might not exist yet.
+ return (current ? current : AllocateCurrentThread());
+}
+
+Debug *GetDebug()
+{
+ AllocateDebug();
+ return g_Debug;
+}
+
+void SetContextCurrent(Thread *thread, gl::Context *context)
+{
+ // See above comment on gGlobalContext.
+ // If the context is in multi-threaded mode, ignore the global context.
+ if (!gl::gIsMultiThreadedContext)
+ {
+ // If the global context is unset or matches the current TLS, set the global context.
+ if (gl::gSingleThreadedContext == nullptr ||
+ gl::gSingleThreadedContext == thread->getContext())
+ {
+ gl::gSingleThreadedContext = context;
+ }
+ else
+ {
+ // If the global context is set and does not match TLS, set multi-threaded mode.
+ gl::gSingleThreadedContext = nullptr;
+ gl::gIsMultiThreadedContext = true;
+ }
+ }
+ thread->setCurrent(context);
+}
+} // namespace egl
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+namespace egl
+{
+
+namespace
+{
+
+bool DeallocateCurrentThread()
+{
+ Thread *thread = static_cast<Thread *>(GetTLSValue(threadTLS));
+ SafeDelete(thread);
+ return SetTLSValue(threadTLS, nullptr);
+}
+
+void DeallocateDebug()
+{
+ SafeDelete(g_Debug);
+}
+
+void DeallocateMutex()
+{
+ std::mutex *mutex = g_Mutex.exchange(nullptr);
+ {
+ // Wait for the mutex to become released by other threads before deleting.
+ std::lock_guard<std::mutex> lock(*mutex);
+ }
+ SafeDelete(mutex);
+}
+
+bool InitializeProcess()
+{
+ ASSERT(g_Debug == nullptr);
+ AllocateDebug();
+
+ AllocateMutex();
+
+ threadTLS = CreateTLSIndex();
+ if (threadTLS == TLS_INVALID_INDEX)
+ {
+ return false;
+ }
+
+ return AllocateCurrentThread() != nullptr;
+}
+
+bool TerminateProcess()
+{
+ DeallocateDebug();
+
+ DeallocateMutex();
+
+ if (!DeallocateCurrentThread())
+ {
+ return false;
+ }
+
+ if (threadTLS != TLS_INVALID_INDEX)
+ {
+ TLSIndex tlsCopy = threadTLS;
+ threadTLS = TLS_INVALID_INDEX;
+
+ if (!DestroyTLSIndex(tlsCopy))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+} // anonymous namespace
+
+} // namespace egl
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID)
+{
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ return static_cast<BOOL>(egl::InitializeProcess());
+
+ case DLL_THREAD_ATTACH:
+ return static_cast<BOOL>(egl::AllocateCurrentThread() != nullptr);
+
+ case DLL_THREAD_DETACH:
+ return static_cast<BOOL>(egl::DeallocateCurrentThread());
+
+ case DLL_PROCESS_DETACH:
+ return static_cast<BOOL>(egl::TerminateProcess());
+ }
+
+ return TRUE;
+}
+#endif // ANGLE_PLATFORM_WINDOWS
diff --git a/gfx/angle/checkout/src/libGLESv2/global_state.h b/gfx/angle/checkout/src/libGLESv2/global_state.h
new file mode 100644
index 0000000000..8d55b91905
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/global_state.h
@@ -0,0 +1,61 @@
+//
+// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// global_state.h : Defines functions for querying the thread-local GL and EGL state.
+
+#ifndef LIBGLESV2_GLOBALSTATE_H_
+#define LIBGLESV2_GLOBALSTATE_H_
+
+#include "libANGLE/Context.h"
+#include "libANGLE/Debug.h"
+#include "libANGLE/Thread.h"
+#include "libANGLE/features.h"
+
+#include <mutex>
+
+namespace egl
+{
+class Debug;
+class Thread;
+
+std::mutex &GetGlobalMutex();
+Thread *GetCurrentThread();
+Debug *GetDebug();
+void SetContextCurrent(Thread *thread, gl::Context *context);
+} // namespace egl
+
+#define ANGLE_SCOPED_GLOBAL_LOCK() \
+ std::lock_guard<std::mutex> globalMutexLock(egl::GetGlobalMutex())
+
+namespace gl
+{
+extern Context *gSingleThreadedContext;
+
+ANGLE_INLINE Context *GetGlobalContext()
+{
+ if (gSingleThreadedContext)
+ {
+ return gSingleThreadedContext;
+ }
+
+ egl::Thread *thread = egl::GetCurrentThread();
+ return thread->getContext();
+}
+
+ANGLE_INLINE Context *GetValidGlobalContext()
+{
+ if (gSingleThreadedContext && !gSingleThreadedContext->isContextLost())
+ {
+ return gSingleThreadedContext;
+ }
+
+ egl::Thread *thread = egl::GetCurrentThread();
+ return thread->getValidContext();
+}
+
+} // namespace gl
+
+#endif // LIBGLESV2_GLOBALSTATE_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/libGLESv2.rc b/gfx/angle/checkout/src/libGLESv2/libGLESv2.rc
new file mode 100644
index 0000000000..4c3d137304
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/libGLESv2.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include <windows.h>
+#include "../common/version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "#include ""../common/version.h""\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,ANGLE_REVISION,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,ANGLE_REVISION,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "ANGLE libGLESv2 Dynamic Link Library"
+ VALUE "FileVersion", ANGLE_VERSION_STRING
+ VALUE "InternalName", "libGLESv2"
+ VALUE "LegalCopyright", "Copyright (C) 2015 Google Inc."
+ VALUE "OriginalFilename", "libGLESv2.dll"
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
+ VALUE "ProductName", "ANGLE libGLESv2 Dynamic Link Library"
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.cpp
new file mode 100644
index 0000000000..d5a4ae3628
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.cpp
@@ -0,0 +1,9775 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by generate_entry_points.py using data from gl.xml and gl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// libGLESv2.cpp: Implements the exported OpenGL ES functions.
+
+#include "angle_gl.h"
+
+#include "libGLESv2/entry_points_gles_1_0_autogen.h"
+#include "libGLESv2/entry_points_gles_2_0_autogen.h"
+#include "libGLESv2/entry_points_gles_3_0_autogen.h"
+#include "libGLESv2/entry_points_gles_3_1_autogen.h"
+#include "libGLESv2/entry_points_gles_ext_autogen.h"
+
+#include "common/event_tracer.h"
+
+extern "C" {
+
+// OpenGL ES 2.0
+void GL_APIENTRY glActiveTexture(GLenum texture)
+{
+ return gl::ActiveTexture(texture);
+}
+
+void GL_APIENTRY glAttachShader(GLuint program, GLuint shader)
+{
+ return gl::AttachShader(program, shader);
+}
+
+void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
+{
+ return gl::BindAttribLocation(program, index, name);
+}
+
+void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer)
+{
+ return gl::BindBuffer(target, buffer);
+}
+
+void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+ return gl::BindFramebuffer(target, framebuffer);
+}
+
+void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+ return gl::BindRenderbuffer(target, renderbuffer);
+}
+
+void GL_APIENTRY glBindTexture(GLenum target, GLuint texture)
+{
+ return gl::BindTexture(target, texture);
+}
+
+void GL_APIENTRY glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return gl::BlendColor(red, green, blue, alpha);
+}
+
+void GL_APIENTRY glBlendEquation(GLenum mode)
+{
+ return gl::BlendEquation(mode);
+}
+
+void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+ return gl::BlendEquationSeparate(modeRGB, modeAlpha);
+}
+
+void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+ return gl::BlendFunc(sfactor, dfactor);
+}
+
+void GL_APIENTRY glBlendFuncSeparate(GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha)
+{
+ return gl::BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
+}
+
+void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage)
+{
+ return gl::BufferData(target, size, data, usage);
+}
+
+void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data)
+{
+ return gl::BufferSubData(target, offset, size, data);
+}
+
+GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target)
+{
+ return gl::CheckFramebufferStatus(target);
+}
+
+void GL_APIENTRY glClear(GLbitfield mask)
+{
+ return gl::Clear(mask);
+}
+
+void GL_APIENTRY glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return gl::ClearColor(red, green, blue, alpha);
+}
+
+void GL_APIENTRY glClearDepthf(GLfloat d)
+{
+ return gl::ClearDepthf(d);
+}
+
+void GL_APIENTRY glClearStencil(GLint s)
+{
+ return gl::ClearStencil(s);
+}
+
+void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ return gl::ColorMask(red, green, blue, alpha);
+}
+
+void GL_APIENTRY glCompileShader(GLuint shader)
+{
+ return gl::CompileShader(shader);
+}
+
+void GL_APIENTRY glCompressedTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize,
+ data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format,
+ imageSize, data);
+}
+
+void GL_APIENTRY glCopyTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ return gl::CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+}
+
+void GL_APIENTRY glCopyTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+}
+
+GLuint GL_APIENTRY glCreateProgram()
+{
+ return gl::CreateProgram();
+}
+
+GLuint GL_APIENTRY glCreateShader(GLenum type)
+{
+ return gl::CreateShader(type);
+}
+
+void GL_APIENTRY glCullFace(GLenum mode)
+{
+ return gl::CullFace(mode);
+}
+
+void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint *buffers)
+{
+ return gl::DeleteBuffers(n, buffers);
+}
+
+void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
+{
+ return gl::DeleteFramebuffers(n, framebuffers);
+}
+
+void GL_APIENTRY glDeleteProgram(GLuint program)
+{
+ return gl::DeleteProgram(program);
+}
+
+void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
+{
+ return gl::DeleteRenderbuffers(n, renderbuffers);
+}
+
+void GL_APIENTRY glDeleteShader(GLuint shader)
+{
+ return gl::DeleteShader(shader);
+}
+
+void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
+{
+ return gl::DeleteTextures(n, textures);
+}
+
+void GL_APIENTRY glDepthFunc(GLenum func)
+{
+ return gl::DepthFunc(func);
+}
+
+void GL_APIENTRY glDepthMask(GLboolean flag)
+{
+ return gl::DepthMask(flag);
+}
+
+void GL_APIENTRY glDepthRangef(GLfloat n, GLfloat f)
+{
+ return gl::DepthRangef(n, f);
+}
+
+void GL_APIENTRY glDetachShader(GLuint program, GLuint shader)
+{
+ return gl::DetachShader(program, shader);
+}
+
+void GL_APIENTRY glDisable(GLenum cap)
+{
+ return gl::Disable(cap);
+}
+
+void GL_APIENTRY glDisableVertexAttribArray(GLuint index)
+{
+ return gl::DisableVertexAttribArray(index);
+}
+
+void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+ return gl::DrawArrays(mode, first, count);
+}
+
+void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
+{
+ return gl::DrawElements(mode, count, type, indices);
+}
+
+void GL_APIENTRY glEnable(GLenum cap)
+{
+ return gl::Enable(cap);
+}
+
+void GL_APIENTRY glEnableVertexAttribArray(GLuint index)
+{
+ return gl::EnableVertexAttribArray(index);
+}
+
+void GL_APIENTRY glFinish()
+{
+ return gl::Finish();
+}
+
+void GL_APIENTRY glFlush()
+{
+ return gl::Flush();
+}
+
+void GL_APIENTRY glFramebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ return gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+}
+
+void GL_APIENTRY glFramebufferTexture2D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ return gl::FramebufferTexture2D(target, attachment, textarget, texture, level);
+}
+
+void GL_APIENTRY glFrontFace(GLenum mode)
+{
+ return gl::FrontFace(mode);
+}
+
+void GL_APIENTRY glGenBuffers(GLsizei n, GLuint *buffers)
+{
+ return gl::GenBuffers(n, buffers);
+}
+
+void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint *framebuffers)
+{
+ return gl::GenFramebuffers(n, framebuffers);
+}
+
+void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
+{
+ return gl::GenRenderbuffers(n, renderbuffers);
+}
+
+void GL_APIENTRY glGenTextures(GLsizei n, GLuint *textures)
+{
+ return gl::GenTextures(n, textures);
+}
+
+void GL_APIENTRY glGenerateMipmap(GLenum target)
+{
+ return gl::GenerateMipmap(target);
+}
+
+void GL_APIENTRY glGetActiveAttrib(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ return gl::GetActiveAttrib(program, index, bufSize, length, size, type, name);
+}
+
+void GL_APIENTRY glGetActiveUniform(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ return gl::GetActiveUniform(program, index, bufSize, length, size, type, name);
+}
+
+void GL_APIENTRY glGetAttachedShaders(GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders)
+{
+ return gl::GetAttachedShaders(program, maxCount, count, shaders);
+}
+
+GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar *name)
+{
+ return gl::GetAttribLocation(program, name);
+}
+
+void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean *data)
+{
+ return gl::GetBooleanv(pname, data);
+}
+
+void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetBufferParameteriv(target, pname, params);
+}
+
+GLenum GL_APIENTRY glGetError()
+{
+ return gl::GetError();
+}
+
+void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat *data)
+{
+ return gl::GetFloatv(pname, data);
+}
+
+void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+}
+
+void GL_APIENTRY glGetIntegerv(GLenum pname, GLint *data)
+{
+ return gl::GetIntegerv(pname, data);
+}
+
+void GL_APIENTRY glGetProgramInfoLog(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ return gl::GetProgramInfoLog(program, bufSize, length, infoLog);
+}
+
+void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint *params)
+{
+ return gl::GetProgramiv(program, pname, params);
+}
+
+void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetRenderbufferParameteriv(target, pname, params);
+}
+
+void GL_APIENTRY glGetShaderInfoLog(GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ return gl::GetShaderInfoLog(shader, bufSize, length, infoLog);
+}
+
+void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision)
+{
+ return gl::GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+}
+
+void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)
+{
+ return gl::GetShaderSource(shader, bufSize, length, source);
+}
+
+void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
+{
+ return gl::GetShaderiv(shader, pname, params);
+}
+
+const GLubyte *GL_APIENTRY glGetString(GLenum name)
+{
+ return gl::GetString(name);
+}
+
+void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ return gl::GetTexParameterfv(target, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetTexParameteriv(target, pname, params);
+}
+
+GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar *name)
+{
+ return gl::GetUniformLocation(program, name);
+}
+
+void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat *params)
+{
+ return gl::GetUniformfv(program, location, params);
+}
+
+void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint *params)
+{
+ return gl::GetUniformiv(program, location, params);
+}
+
+void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
+{
+ return gl::GetVertexAttribPointerv(index, pname, pointer);
+}
+
+void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
+{
+ return gl::GetVertexAttribfv(index, pname, params);
+}
+
+void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
+{
+ return gl::GetVertexAttribiv(index, pname, params);
+}
+
+void GL_APIENTRY glHint(GLenum target, GLenum mode)
+{
+ return gl::Hint(target, mode);
+}
+
+GLboolean GL_APIENTRY glIsBuffer(GLuint buffer)
+{
+ return gl::IsBuffer(buffer);
+}
+
+GLboolean GL_APIENTRY glIsEnabled(GLenum cap)
+{
+ return gl::IsEnabled(cap);
+}
+
+GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer)
+{
+ return gl::IsFramebuffer(framebuffer);
+}
+
+GLboolean GL_APIENTRY glIsProgram(GLuint program)
+{
+ return gl::IsProgram(program);
+}
+
+GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer)
+{
+ return gl::IsRenderbuffer(renderbuffer);
+}
+
+GLboolean GL_APIENTRY glIsShader(GLuint shader)
+{
+ return gl::IsShader(shader);
+}
+
+GLboolean GL_APIENTRY glIsTexture(GLuint texture)
+{
+ return gl::IsTexture(texture);
+}
+
+void GL_APIENTRY glLineWidth(GLfloat width)
+{
+ return gl::LineWidth(width);
+}
+
+void GL_APIENTRY glLinkProgram(GLuint program)
+{
+ return gl::LinkProgram(program);
+}
+
+void GL_APIENTRY glPixelStorei(GLenum pname, GLint param)
+{
+ return gl::PixelStorei(pname, param);
+}
+
+void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
+{
+ return gl::PolygonOffset(factor, units);
+}
+
+void GL_APIENTRY glReadPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ return gl::ReadPixels(x, y, width, height, format, type, pixels);
+}
+
+void GL_APIENTRY glReleaseShaderCompiler()
+{
+ return gl::ReleaseShaderCompiler();
+}
+
+void GL_APIENTRY glRenderbufferStorage(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorage(target, internalformat, width, height);
+}
+
+void GL_APIENTRY glSampleCoverage(GLfloat value, GLboolean invert)
+{
+ return gl::SampleCoverage(value, invert);
+}
+
+void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ return gl::Scissor(x, y, width, height);
+}
+
+void GL_APIENTRY glShaderBinary(GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length)
+{
+ return gl::ShaderBinary(count, shaders, binaryformat, binary, length);
+}
+
+void GL_APIENTRY glShaderSource(GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length)
+{
+ return gl::ShaderSource(shader, count, string, length);
+}
+
+void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ return gl::StencilFunc(func, ref, mask);
+}
+
+void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ return gl::StencilFuncSeparate(face, func, ref, mask);
+}
+
+void GL_APIENTRY glStencilMask(GLuint mask)
+{
+ return gl::StencilMask(mask);
+}
+
+void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+ return gl::StencilMaskSeparate(face, mask);
+}
+
+void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ return gl::StencilOp(fail, zfail, zpass);
+}
+
+void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
+{
+ return gl::StencilOpSeparate(face, sfail, dpfail, dppass);
+}
+
+void GL_APIENTRY glTexImage2D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexImage2D(target, level, internalformat, width, height, border, format, type,
+ pixels);
+}
+
+void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ return gl::TexParameterf(target, pname, param);
+}
+
+void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ return gl::TexParameterfv(target, pname, params);
+}
+
+void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ return gl::TexParameteri(target, pname, param);
+}
+
+void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+ return gl::TexParameteriv(target, pname, params);
+}
+
+void GL_APIENTRY glTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+
+void GL_APIENTRY glUniform1f(GLint location, GLfloat v0)
+{
+ return gl::Uniform1f(location, v0);
+}
+
+void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ return gl::Uniform1fv(location, count, value);
+}
+
+void GL_APIENTRY glUniform1i(GLint location, GLint v0)
+{
+ return gl::Uniform1i(location, v0);
+}
+
+void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint *value)
+{
+ return gl::Uniform1iv(location, count, value);
+}
+
+void GL_APIENTRY glUniform2f(GLint location, GLfloat v0, GLfloat v1)
+{
+ return gl::Uniform2f(location, v0, v1);
+}
+
+void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ return gl::Uniform2fv(location, count, value);
+}
+
+void GL_APIENTRY glUniform2i(GLint location, GLint v0, GLint v1)
+{
+ return gl::Uniform2i(location, v0, v1);
+}
+
+void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint *value)
+{
+ return gl::Uniform2iv(location, count, value);
+}
+
+void GL_APIENTRY glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ return gl::Uniform3f(location, v0, v1, v2);
+}
+
+void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ return gl::Uniform3fv(location, count, value);
+}
+
+void GL_APIENTRY glUniform3i(GLint location, GLint v0, GLint v1, GLint v2)
+{
+ return gl::Uniform3i(location, v0, v1, v2);
+}
+
+void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint *value)
+{
+ return gl::Uniform3iv(location, count, value);
+}
+
+void GL_APIENTRY glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
+{
+ return gl::Uniform4f(location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat *value)
+{
+ return gl::Uniform4fv(location, count, value);
+}
+
+void GL_APIENTRY glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ return gl::Uniform4i(location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint *value)
+{
+ return gl::Uniform4iv(location, count, value);
+}
+
+void GL_APIENTRY glUniformMatrix2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix2fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix3fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix4fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUseProgram(GLuint program)
+{
+ return gl::UseProgram(program);
+}
+
+void GL_APIENTRY glValidateProgram(GLuint program)
+{
+ return gl::ValidateProgram(program);
+}
+
+void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x)
+{
+ return gl::VertexAttrib1f(index, x);
+}
+
+void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib1fv(index, v);
+}
+
+void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+ return gl::VertexAttrib2f(index, x, y);
+}
+
+void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib2fv(index, v);
+}
+
+void GL_APIENTRY glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::VertexAttrib3f(index, x, y, z);
+}
+
+void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib3fv(index, v);
+}
+
+void GL_APIENTRY glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ return gl::VertexAttrib4f(index, x, y, z, w);
+}
+
+void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib4fv(index, v);
+}
+
+void GL_APIENTRY glVertexAttribPointer(GLuint index,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::VertexAttribPointer(index, size, type, normalized, stride, pointer);
+}
+
+void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ return gl::Viewport(x, y, width, height);
+}
+
+// OpenGL ES 3.0
+void GL_APIENTRY glBeginQuery(GLenum target, GLuint id)
+{
+ return gl::BeginQuery(target, id);
+}
+
+void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode)
+{
+ return gl::BeginTransformFeedback(primitiveMode);
+}
+
+void GL_APIENTRY glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ return gl::BindBufferBase(target, index, buffer);
+}
+
+void GL_APIENTRY
+glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ return gl::BindBufferRange(target, index, buffer, offset, size);
+}
+
+void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler)
+{
+ return gl::BindSampler(unit, sampler);
+}
+
+void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id)
+{
+ return gl::BindTransformFeedback(target, id);
+}
+
+void GL_APIENTRY glBindVertexArray(GLuint array)
+{
+ return gl::BindVertexArray(array);
+}
+
+void GL_APIENTRY glBlitFramebuffer(GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ return gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
+ filter);
+}
+
+void GL_APIENTRY glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+ return gl::ClearBufferfi(buffer, drawbuffer, depth, stencil);
+}
+
+void GL_APIENTRY glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
+{
+ return gl::ClearBufferfv(buffer, drawbuffer, value);
+}
+
+void GL_APIENTRY glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
+{
+ return gl::ClearBufferiv(buffer, drawbuffer, value);
+}
+
+void GL_APIENTRY glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
+{
+ return gl::ClearBufferuiv(buffer, drawbuffer, value);
+}
+
+GLenum GL_APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ return gl::ClientWaitSync(sync, flags, timeout);
+}
+
+void GL_APIENTRY glCompressedTexImage3D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexImage3D(target, level, internalformat, width, height, depth, border,
+ imageSize, data);
+}
+
+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 void *data)
+{
+ return gl::CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, imageSize, data);
+}
+
+void GL_APIENTRY glCopyBufferSubData(GLenum readTarget,
+ GLenum writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ return gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
+}
+
+void GL_APIENTRY glCopyTexSubImage3D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
+}
+
+void GL_APIENTRY glDeleteQueries(GLsizei n, const GLuint *ids)
+{
+ return gl::DeleteQueries(n, ids);
+}
+
+void GL_APIENTRY glDeleteSamplers(GLsizei count, const GLuint *samplers)
+{
+ return gl::DeleteSamplers(count, samplers);
+}
+
+void GL_APIENTRY glDeleteSync(GLsync sync)
+{
+ return gl::DeleteSync(sync);
+}
+
+void GL_APIENTRY glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
+{
+ return gl::DeleteTransformFeedbacks(n, ids);
+}
+
+void GL_APIENTRY glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
+{
+ return gl::DeleteVertexArrays(n, arrays);
+}
+
+void GL_APIENTRY glDrawArraysInstanced(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount)
+{
+ return gl::DrawArraysInstanced(mode, first, count, instancecount);
+}
+
+void GL_APIENTRY glDrawBuffers(GLsizei n, const GLenum *bufs)
+{
+ return gl::DrawBuffers(n, bufs);
+}
+
+void GL_APIENTRY glDrawElementsInstanced(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount)
+{
+ return gl::DrawElementsInstanced(mode, count, type, indices, instancecount);
+}
+
+void GL_APIENTRY glDrawRangeElements(GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices)
+{
+ return gl::DrawRangeElements(mode, start, end, count, type, indices);
+}
+
+void GL_APIENTRY glEndQuery(GLenum target)
+{
+ return gl::EndQuery(target);
+}
+
+void GL_APIENTRY glEndTransformFeedback()
+{
+ return gl::EndTransformFeedback();
+}
+
+GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags)
+{
+ return gl::FenceSync(condition, flags);
+}
+
+void GL_APIENTRY glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ return gl::FlushMappedBufferRange(target, offset, length);
+}
+
+void GL_APIENTRY glFramebufferTextureLayer(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer)
+{
+ return gl::FramebufferTextureLayer(target, attachment, texture, level, layer);
+}
+
+void GL_APIENTRY glGenQueries(GLsizei n, GLuint *ids)
+{
+ return gl::GenQueries(n, ids);
+}
+
+void GL_APIENTRY glGenSamplers(GLsizei count, GLuint *samplers)
+{
+ return gl::GenSamplers(count, samplers);
+}
+
+void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint *ids)
+{
+ return gl::GenTransformFeedbacks(n, ids);
+}
+
+void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint *arrays)
+{
+ return gl::GenVertexArrays(n, arrays);
+}
+
+void GL_APIENTRY glGetActiveUniformBlockName(GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName)
+{
+ return gl::GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length,
+ uniformBlockName);
+}
+
+void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
+}
+
+void GL_APIENTRY glGetActiveUniformsiv(GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
+}
+
+void GL_APIENTRY glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
+{
+ return gl::GetBufferParameteri64v(target, pname, params);
+}
+
+void GL_APIENTRY glGetBufferPointerv(GLenum target, GLenum pname, void **params)
+{
+ return gl::GetBufferPointerv(target, pname, params);
+}
+
+GLint GL_APIENTRY glGetFragDataLocation(GLuint program, const GLchar *name)
+{
+ return gl::GetFragDataLocation(program, name);
+}
+
+void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
+{
+ return gl::GetInteger64i_v(target, index, data);
+}
+
+void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64 *data)
+{
+ return gl::GetInteger64v(pname, data);
+}
+
+void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
+{
+ return gl::GetIntegeri_v(target, index, data);
+}
+
+void GL_APIENTRY glGetInternalformativ(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params)
+{
+ return gl::GetInternalformativ(target, internalformat, pname, bufSize, params);
+}
+
+void GL_APIENTRY glGetProgramBinary(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ return gl::GetProgramBinary(program, bufSize, length, binaryFormat, binary);
+}
+
+void GL_APIENTRY glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
+{
+ return gl::GetQueryObjectuiv(id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryiv(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetQueryiv(target, pname, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
+{
+ return gl::GetSamplerParameterfv(sampler, pname, params);
+}
+
+void GL_APIENTRY glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
+{
+ return gl::GetSamplerParameteriv(sampler, pname, params);
+}
+
+const GLubyte *GL_APIENTRY glGetStringi(GLenum name, GLuint index)
+{
+ return gl::GetStringi(name, index);
+}
+
+void GL_APIENTRY
+glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
+{
+ return gl::GetSynciv(sync, pname, bufSize, length, values);
+}
+
+void GL_APIENTRY glGetTransformFeedbackVarying(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name)
+{
+ return gl::GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
+}
+
+GLuint GL_APIENTRY glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
+{
+ return gl::GetUniformBlockIndex(program, uniformBlockName);
+}
+
+void GL_APIENTRY glGetUniformIndices(GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices)
+{
+ return gl::GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
+}
+
+void GL_APIENTRY glGetUniformuiv(GLuint program, GLint location, GLuint *params)
+{
+ return gl::GetUniformuiv(program, location, params);
+}
+
+void GL_APIENTRY glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
+{
+ return gl::GetVertexAttribIiv(index, pname, params);
+}
+
+void GL_APIENTRY glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
+{
+ return gl::GetVertexAttribIuiv(index, pname, params);
+}
+
+void GL_APIENTRY glInvalidateFramebuffer(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ return gl::InvalidateFramebuffer(target, numAttachments, attachments);
+}
+
+void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
+}
+
+GLboolean GL_APIENTRY glIsQuery(GLuint id)
+{
+ return gl::IsQuery(id);
+}
+
+GLboolean GL_APIENTRY glIsSampler(GLuint sampler)
+{
+ return gl::IsSampler(sampler);
+}
+
+GLboolean GL_APIENTRY glIsSync(GLsync sync)
+{
+ return gl::IsSync(sync);
+}
+
+GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id)
+{
+ return gl::IsTransformFeedback(id);
+}
+
+GLboolean GL_APIENTRY glIsVertexArray(GLuint array)
+{
+ return gl::IsVertexArray(array);
+}
+
+void *GL_APIENTRY glMapBufferRange(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ return gl::MapBufferRange(target, offset, length, access);
+}
+
+void GL_APIENTRY glPauseTransformFeedback()
+{
+ return gl::PauseTransformFeedback();
+}
+
+void GL_APIENTRY glProgramBinary(GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length)
+{
+ return gl::ProgramBinary(program, binaryFormat, binary, length);
+}
+
+void GL_APIENTRY glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+ return gl::ProgramParameteri(program, pname, value);
+}
+
+void GL_APIENTRY glReadBuffer(GLenum src)
+{
+ return gl::ReadBuffer(src);
+}
+
+void GL_APIENTRY glRenderbufferStorageMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height);
+}
+
+void GL_APIENTRY glResumeTransformFeedback()
+{
+ return gl::ResumeTransformFeedback();
+}
+
+void GL_APIENTRY glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ return gl::SamplerParameterf(sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
+{
+ return gl::SamplerParameterfv(sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ return gl::SamplerParameteri(sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
+{
+ return gl::SamplerParameteriv(sampler, pname, param);
+}
+
+void GL_APIENTRY glTexImage3D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexImage3D(target, level, internalformat, width, height, depth, border, format, type,
+ pixels);
+}
+
+void GL_APIENTRY
+glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ return gl::TexStorage2D(target, levels, internalformat, width, height);
+}
+
+void GL_APIENTRY glTexStorage3D(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ return gl::TexStorage3D(target, levels, internalformat, width, height, depth);
+}
+
+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 void *pixels)
+{
+ return gl::TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format,
+ type, pixels);
+}
+
+void GL_APIENTRY glTransformFeedbackVaryings(GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ return gl::TransformFeedbackVaryings(program, count, varyings, bufferMode);
+}
+
+void GL_APIENTRY glUniform1ui(GLint location, GLuint v0)
+{
+ return gl::Uniform1ui(location, v0);
+}
+
+void GL_APIENTRY glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ return gl::Uniform1uiv(location, count, value);
+}
+
+void GL_APIENTRY glUniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ return gl::Uniform2ui(location, v0, v1);
+}
+
+void GL_APIENTRY glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ return gl::Uniform2uiv(location, count, value);
+}
+
+void GL_APIENTRY glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ return gl::Uniform3ui(location, v0, v1, v2);
+}
+
+void GL_APIENTRY glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ return gl::Uniform3uiv(location, count, value);
+}
+
+void GL_APIENTRY glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ return gl::Uniform4ui(location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ return gl::Uniform4uiv(location, count, value);
+}
+
+void GL_APIENTRY glUniformBlockBinding(GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding)
+{
+ return gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
+}
+
+void GL_APIENTRY glUniformMatrix2x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix2x3fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix2x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix2x4fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix3x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix3x2fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix3x4fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix3x4fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix4x2fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix4x2fv(location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix4x3fv(GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix4x3fv(location, count, transpose, value);
+}
+
+GLboolean GL_APIENTRY glUnmapBuffer(GLenum target)
+{
+ return gl::UnmapBuffer(target);
+}
+
+void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ return gl::VertexAttribDivisor(index, divisor);
+}
+
+void GL_APIENTRY glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+ return gl::VertexAttribI4i(index, x, y, z, w);
+}
+
+void GL_APIENTRY glVertexAttribI4iv(GLuint index, const GLint *v)
+{
+ return gl::VertexAttribI4iv(index, v);
+}
+
+void GL_APIENTRY glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+ return gl::VertexAttribI4ui(index, x, y, z, w);
+}
+
+void GL_APIENTRY glVertexAttribI4uiv(GLuint index, const GLuint *v)
+{
+ return gl::VertexAttribI4uiv(index, v);
+}
+
+void GL_APIENTRY
+glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ return gl::VertexAttribIPointer(index, size, type, stride, pointer);
+}
+
+void GL_APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ return gl::WaitSync(sync, flags, timeout);
+}
+
+// OpenGL ES 3.1
+void GL_APIENTRY glActiveShaderProgram(GLuint pipeline, GLuint program)
+{
+ return gl::ActiveShaderProgram(pipeline, program);
+}
+
+void GL_APIENTRY glBindImageTexture(GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format)
+{
+ return gl::BindImageTexture(unit, texture, level, layered, layer, access, format);
+}
+
+void GL_APIENTRY glBindProgramPipeline(GLuint pipeline)
+{
+ return gl::BindProgramPipeline(pipeline);
+}
+
+void GL_APIENTRY glBindVertexBuffer(GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ return gl::BindVertexBuffer(bindingindex, buffer, offset, stride);
+}
+
+GLuint GL_APIENTRY glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
+{
+ return gl::CreateShaderProgramv(type, count, strings);
+}
+
+void GL_APIENTRY glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
+{
+ return gl::DeleteProgramPipelines(n, pipelines);
+}
+
+void GL_APIENTRY glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
+{
+ return gl::DispatchCompute(num_groups_x, num_groups_y, num_groups_z);
+}
+
+void GL_APIENTRY glDispatchComputeIndirect(GLintptr indirect)
+{
+ return gl::DispatchComputeIndirect(indirect);
+}
+
+void GL_APIENTRY glDrawArraysIndirect(GLenum mode, const void *indirect)
+{
+ return gl::DrawArraysIndirect(mode, indirect);
+}
+
+void GL_APIENTRY glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
+{
+ return gl::DrawElementsIndirect(mode, type, indirect);
+}
+
+void GL_APIENTRY glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
+{
+ return gl::FramebufferParameteri(target, pname, param);
+}
+
+void GL_APIENTRY glGenProgramPipelines(GLsizei n, GLuint *pipelines)
+{
+ return gl::GenProgramPipelines(n, pipelines);
+}
+
+void GL_APIENTRY glGetBooleani_v(GLenum target, GLuint index, GLboolean *data)
+{
+ return gl::GetBooleani_v(target, index, data);
+}
+
+void GL_APIENTRY glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetFramebufferParameteriv(target, pname, params);
+}
+
+void GL_APIENTRY glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val)
+{
+ return gl::GetMultisamplefv(pname, index, val);
+}
+
+void GL_APIENTRY glGetProgramInterfaceiv(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetProgramInterfaceiv(program, programInterface, pname, params);
+}
+
+void GL_APIENTRY glGetProgramPipelineInfoLog(GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ return gl::GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
+}
+
+void GL_APIENTRY glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
+{
+ return gl::GetProgramPipelineiv(pipeline, pname, params);
+}
+
+GLuint GL_APIENTRY glGetProgramResourceIndex(GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ return gl::GetProgramResourceIndex(program, programInterface, name);
+}
+
+GLint GL_APIENTRY glGetProgramResourceLocation(GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ return gl::GetProgramResourceLocation(program, programInterface, name);
+}
+
+void GL_APIENTRY glGetProgramResourceName(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ return gl::GetProgramResourceName(program, programInterface, index, bufSize, length, name);
+}
+
+void GL_APIENTRY glGetProgramResourceiv(GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize,
+ length, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
+{
+ return gl::GetTexLevelParameterfv(target, level, pname, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
+{
+ return gl::GetTexLevelParameteriv(target, level, pname, params);
+}
+
+GLboolean GL_APIENTRY glIsProgramPipeline(GLuint pipeline)
+{
+ return gl::IsProgramPipeline(pipeline);
+}
+
+void GL_APIENTRY glMemoryBarrier(GLbitfield barriers)
+{
+ return gl::MemoryBarrier(barriers);
+}
+
+void GL_APIENTRY glMemoryBarrierByRegion(GLbitfield barriers)
+{
+ return gl::MemoryBarrierByRegion(barriers);
+}
+
+void GL_APIENTRY glProgramUniform1f(GLuint program, GLint location, GLfloat v0)
+{
+ return gl::ProgramUniform1f(program, location, v0);
+}
+
+void GL_APIENTRY glProgramUniform1fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform1fv(program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform1i(GLuint program, GLint location, GLint v0)
+{
+ return gl::ProgramUniform1i(program, location, v0);
+}
+
+void GL_APIENTRY glProgramUniform1iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform1iv(program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform1ui(GLuint program, GLint location, GLuint v0)
+{
+ return gl::ProgramUniform1ui(program, location, v0);
+}
+
+void GL_APIENTRY glProgramUniform1uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform1uiv(program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
+{
+ return gl::ProgramUniform2f(program, location, v0, v1);
+}
+
+void GL_APIENTRY glProgramUniform2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform2fv(program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
+{
+ return gl::ProgramUniform2i(program, location, v0, v1);
+}
+
+void GL_APIENTRY glProgramUniform2iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform2iv(program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
+{
+ return gl::ProgramUniform2ui(program, location, v0, v1);
+}
+
+void GL_APIENTRY glProgramUniform2uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform2uiv(program, location, count, value);
+}
+
+void GL_APIENTRY
+glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ return gl::ProgramUniform3f(program, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glProgramUniform3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform3fv(program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
+{
+ return gl::ProgramUniform3i(program, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glProgramUniform3iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform3iv(program, location, count, value);
+}
+
+void GL_APIENTRY
+glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ return gl::ProgramUniform3ui(program, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glProgramUniform3uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform3uiv(program, location, count, value);
+}
+
+void GL_APIENTRY
+glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
+{
+ return gl::ProgramUniform4f(program, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glProgramUniform4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform4fv(program, location, count, value);
+}
+
+void GL_APIENTRY
+glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ return gl::ProgramUniform4i(program, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glProgramUniform4iv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform4iv(program, location, count, value);
+}
+
+void GL_APIENTRY
+glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ return gl::ProgramUniform4ui(program, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glProgramUniform4uiv(GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform4uiv(program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix2fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix2x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix2x3fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix2x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix2x4fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix3fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix3x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix3x2fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix3x4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix3x4fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix4fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix4fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix4x2fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix4x2fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix4x3fv(GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix4x3fv(program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glSampleMaski(GLuint maskNumber, GLbitfield mask)
+{
+ return gl::SampleMaski(maskNumber, mask);
+}
+
+void GL_APIENTRY glTexStorage2DMultisample(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ return gl::TexStorage2DMultisample(target, samples, internalformat, width, height,
+ fixedsamplelocations);
+}
+
+void GL_APIENTRY glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
+{
+ return gl::UseProgramStages(pipeline, stages, program);
+}
+
+void GL_APIENTRY glValidateProgramPipeline(GLuint pipeline)
+{
+ return gl::ValidateProgramPipeline(pipeline);
+}
+
+void GL_APIENTRY glVertexAttribBinding(GLuint attribindex, GLuint bindingindex)
+{
+ return gl::VertexAttribBinding(attribindex, bindingindex);
+}
+
+void GL_APIENTRY glVertexAttribFormat(GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset)
+{
+ return gl::VertexAttribFormat(attribindex, size, type, normalized, relativeoffset);
+}
+
+void GL_APIENTRY glVertexAttribIFormat(GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ return gl::VertexAttribIFormat(attribindex, size, type, relativeoffset);
+}
+
+void GL_APIENTRY glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
+{
+ return gl::VertexBindingDivisor(bindingindex, divisor);
+}
+
+// OpenGL ES 1.0
+void GL_APIENTRY glAlphaFunc(GLenum func, GLfloat ref)
+{
+ return gl::AlphaFunc(func, ref);
+}
+
+void GL_APIENTRY glAlphaFuncx(GLenum func, GLfixed ref)
+{
+ return gl::AlphaFuncx(func, ref);
+}
+
+void GL_APIENTRY glClearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ return gl::ClearColorx(red, green, blue, alpha);
+}
+
+void GL_APIENTRY glClearDepthx(GLfixed depth)
+{
+ return gl::ClearDepthx(depth);
+}
+
+void GL_APIENTRY glClientActiveTexture(GLenum texture)
+{
+ return gl::ClientActiveTexture(texture);
+}
+
+void GL_APIENTRY glClipPlanef(GLenum p, const GLfloat *eqn)
+{
+ return gl::ClipPlanef(p, eqn);
+}
+
+void GL_APIENTRY glClipPlanex(GLenum plane, const GLfixed *equation)
+{
+ return gl::ClipPlanex(plane, equation);
+}
+
+void GL_APIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return gl::Color4f(red, green, blue, alpha);
+}
+
+void GL_APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ return gl::Color4ub(red, green, blue, alpha);
+}
+
+void GL_APIENTRY glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ return gl::Color4x(red, green, blue, alpha);
+}
+
+void GL_APIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ return gl::ColorPointer(size, type, stride, pointer);
+}
+
+void GL_APIENTRY glDepthRangex(GLfixed n, GLfixed f)
+{
+ return gl::DepthRangex(n, f);
+}
+
+void GL_APIENTRY glDisableClientState(GLenum array)
+{
+ return gl::DisableClientState(array);
+}
+
+void GL_APIENTRY glEnableClientState(GLenum array)
+{
+ return gl::EnableClientState(array);
+}
+
+void GL_APIENTRY glFogf(GLenum pname, GLfloat param)
+{
+ return gl::Fogf(pname, param);
+}
+
+void GL_APIENTRY glFogfv(GLenum pname, const GLfloat *params)
+{
+ return gl::Fogfv(pname, params);
+}
+
+void GL_APIENTRY glFogx(GLenum pname, GLfixed param)
+{
+ return gl::Fogx(pname, param);
+}
+
+void GL_APIENTRY glFogxv(GLenum pname, const GLfixed *param)
+{
+ return gl::Fogxv(pname, param);
+}
+
+void GL_APIENTRY glFrustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f)
+{
+ return gl::Frustumf(l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glFrustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
+{
+ return gl::Frustumx(l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glGetClipPlanef(GLenum plane, GLfloat *equation)
+{
+ return gl::GetClipPlanef(plane, equation);
+}
+
+void GL_APIENTRY glGetClipPlanex(GLenum plane, GLfixed *equation)
+{
+ return gl::GetClipPlanex(plane, equation);
+}
+
+void GL_APIENTRY glGetFixedv(GLenum pname, GLfixed *params)
+{
+ return gl::GetFixedv(pname, params);
+}
+
+void GL_APIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
+{
+ return gl::GetLightfv(light, pname, params);
+}
+
+void GL_APIENTRY glGetLightxv(GLenum light, GLenum pname, GLfixed *params)
+{
+ return gl::GetLightxv(light, pname, params);
+}
+
+void GL_APIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
+{
+ return gl::GetMaterialfv(face, pname, params);
+}
+
+void GL_APIENTRY glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
+{
+ return gl::GetMaterialxv(face, pname, params);
+}
+
+void GL_APIENTRY glGetPointerv(GLenum pname, void **params)
+{
+ return gl::GetPointerv(pname, params);
+}
+
+void GL_APIENTRY glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ return gl::GetTexEnvfv(target, pname, params);
+}
+
+void GL_APIENTRY glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetTexEnviv(target, pname, params);
+}
+
+void GL_APIENTRY glGetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
+{
+ return gl::GetTexEnvxv(target, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
+{
+ return gl::GetTexParameterxv(target, pname, params);
+}
+
+void GL_APIENTRY glLightModelf(GLenum pname, GLfloat param)
+{
+ return gl::LightModelf(pname, param);
+}
+
+void GL_APIENTRY glLightModelfv(GLenum pname, const GLfloat *params)
+{
+ return gl::LightModelfv(pname, params);
+}
+
+void GL_APIENTRY glLightModelx(GLenum pname, GLfixed param)
+{
+ return gl::LightModelx(pname, param);
+}
+
+void GL_APIENTRY glLightModelxv(GLenum pname, const GLfixed *param)
+{
+ return gl::LightModelxv(pname, param);
+}
+
+void GL_APIENTRY glLightf(GLenum light, GLenum pname, GLfloat param)
+{
+ return gl::Lightf(light, pname, param);
+}
+
+void GL_APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params)
+{
+ return gl::Lightfv(light, pname, params);
+}
+
+void GL_APIENTRY glLightx(GLenum light, GLenum pname, GLfixed param)
+{
+ return gl::Lightx(light, pname, param);
+}
+
+void GL_APIENTRY glLightxv(GLenum light, GLenum pname, const GLfixed *params)
+{
+ return gl::Lightxv(light, pname, params);
+}
+
+void GL_APIENTRY glLineWidthx(GLfixed width)
+{
+ return gl::LineWidthx(width);
+}
+
+void GL_APIENTRY glLoadIdentity()
+{
+ return gl::LoadIdentity();
+}
+
+void GL_APIENTRY glLoadMatrixf(const GLfloat *m)
+{
+ return gl::LoadMatrixf(m);
+}
+
+void GL_APIENTRY glLoadMatrixx(const GLfixed *m)
+{
+ return gl::LoadMatrixx(m);
+}
+
+void GL_APIENTRY glLogicOp(GLenum opcode)
+{
+ return gl::LogicOp(opcode);
+}
+
+void GL_APIENTRY glMaterialf(GLenum face, GLenum pname, GLfloat param)
+{
+ return gl::Materialf(face, pname, param);
+}
+
+void GL_APIENTRY glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
+{
+ return gl::Materialfv(face, pname, params);
+}
+
+void GL_APIENTRY glMaterialx(GLenum face, GLenum pname, GLfixed param)
+{
+ return gl::Materialx(face, pname, param);
+}
+
+void GL_APIENTRY glMaterialxv(GLenum face, GLenum pname, const GLfixed *param)
+{
+ return gl::Materialxv(face, pname, param);
+}
+
+void GL_APIENTRY glMatrixMode(GLenum mode)
+{
+ return gl::MatrixMode(mode);
+}
+
+void GL_APIENTRY glMultMatrixf(const GLfloat *m)
+{
+ return gl::MultMatrixf(m);
+}
+
+void GL_APIENTRY glMultMatrixx(const GLfixed *m)
+{
+ return gl::MultMatrixx(m);
+}
+
+void GL_APIENTRY glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ return gl::MultiTexCoord4f(target, s, t, r, q);
+}
+
+void GL_APIENTRY glMultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+{
+ return gl::MultiTexCoord4x(texture, s, t, r, q);
+}
+
+void GL_APIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ return gl::Normal3f(nx, ny, nz);
+}
+
+void GL_APIENTRY glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz)
+{
+ return gl::Normal3x(nx, ny, nz);
+}
+
+void GL_APIENTRY glNormalPointer(GLenum type, GLsizei stride, const void *pointer)
+{
+ return gl::NormalPointer(type, stride, pointer);
+}
+
+void GL_APIENTRY glOrthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f)
+{
+ return gl::Orthof(l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glOrthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
+{
+ return gl::Orthox(l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glPointParameterf(GLenum pname, GLfloat param)
+{
+ return gl::PointParameterf(pname, param);
+}
+
+void GL_APIENTRY glPointParameterfv(GLenum pname, const GLfloat *params)
+{
+ return gl::PointParameterfv(pname, params);
+}
+
+void GL_APIENTRY glPointParameterx(GLenum pname, GLfixed param)
+{
+ return gl::PointParameterx(pname, param);
+}
+
+void GL_APIENTRY glPointParameterxv(GLenum pname, const GLfixed *params)
+{
+ return gl::PointParameterxv(pname, params);
+}
+
+void GL_APIENTRY glPointSize(GLfloat size)
+{
+ return gl::PointSize(size);
+}
+
+void GL_APIENTRY glPointSizex(GLfixed size)
+{
+ return gl::PointSizex(size);
+}
+
+void GL_APIENTRY glPolygonOffsetx(GLfixed factor, GLfixed units)
+{
+ return gl::PolygonOffsetx(factor, units);
+}
+
+void GL_APIENTRY glPopMatrix()
+{
+ return gl::PopMatrix();
+}
+
+void GL_APIENTRY glPushMatrix()
+{
+ return gl::PushMatrix();
+}
+
+void GL_APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::Rotatef(angle, x, y, z);
+}
+
+void GL_APIENTRY glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+{
+ return gl::Rotatex(angle, x, y, z);
+}
+
+void GL_APIENTRY glSampleCoveragex(GLclampx value, GLboolean invert)
+{
+ return gl::SampleCoveragex(value, invert);
+}
+
+void GL_APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::Scalef(x, y, z);
+}
+
+void GL_APIENTRY glScalex(GLfixed x, GLfixed y, GLfixed z)
+{
+ return gl::Scalex(x, y, z);
+}
+
+void GL_APIENTRY glShadeModel(GLenum mode)
+{
+ return gl::ShadeModel(mode);
+}
+
+void GL_APIENTRY glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ return gl::TexCoordPointer(size, type, stride, pointer);
+}
+
+void GL_APIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param)
+{
+ return gl::TexEnvf(target, pname, param);
+}
+
+void GL_APIENTRY glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ return gl::TexEnvfv(target, pname, params);
+}
+
+void GL_APIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param)
+{
+ return gl::TexEnvi(target, pname, param);
+}
+
+void GL_APIENTRY glTexEnviv(GLenum target, GLenum pname, const GLint *params)
+{
+ return gl::TexEnviv(target, pname, params);
+}
+
+void GL_APIENTRY glTexEnvx(GLenum target, GLenum pname, GLfixed param)
+{
+ return gl::TexEnvx(target, pname, param);
+}
+
+void GL_APIENTRY glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
+{
+ return gl::TexEnvxv(target, pname, params);
+}
+
+void GL_APIENTRY glTexParameterx(GLenum target, GLenum pname, GLfixed param)
+{
+ return gl::TexParameterx(target, pname, param);
+}
+
+void GL_APIENTRY glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
+{
+ return gl::TexParameterxv(target, pname, params);
+}
+
+void GL_APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::Translatef(x, y, z);
+}
+
+void GL_APIENTRY glTranslatex(GLfixed x, GLfixed y, GLfixed z)
+{
+ return gl::Translatex(x, y, z);
+}
+
+void GL_APIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ return gl::VertexPointer(size, type, stride, pointer);
+}
+
+// GL_ANGLE_copy_texture_3d
+void GL_APIENTRY glCopyTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopyTexture3DANGLE(sourceId, sourceLevel, destTarget, destId, destLevel,
+ internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+}
+
+void GL_APIENTRY glCopySubTexture3DANGLE(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopySubTexture3DANGLE(sourceId, sourceLevel, destTarget, destId, destLevel, xoffset,
+ yoffset, zoffset, x, y, z, width, height, depth, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+}
+
+// GL_ANGLE_framebuffer_blit
+void GL_APIENTRY glBlitFramebufferANGLE(GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ return gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask,
+ filter);
+}
+
+// GL_ANGLE_framebuffer_multisample
+void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
+}
+
+// GL_ANGLE_instanced_arrays
+void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ return gl::DrawArraysInstancedANGLE(mode, first, count, primcount);
+}
+
+void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ return gl::DrawElementsInstancedANGLE(mode, count, type, indices, primcount);
+}
+
+void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
+{
+ return gl::VertexAttribDivisorANGLE(index, divisor);
+}
+
+// GL_ANGLE_multi_draw
+void GL_APIENTRY glMultiDrawArraysANGLE(GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawArraysANGLE(mode, firsts, counts, drawcount);
+}
+
+void GL_APIENTRY glMultiDrawArraysInstancedANGLE(GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawArraysInstancedANGLE(mode, firsts, counts, instanceCounts, drawcount);
+}
+
+void GL_APIENTRY glMultiDrawElementsANGLE(GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawElementsANGLE(mode, counts, type, indices, drawcount);
+}
+
+void GL_APIENTRY glMultiDrawElementsInstancedANGLE(GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawElementsInstancedANGLE(mode, counts, type, indices, instanceCounts,
+ drawcount);
+}
+
+// GL_ANGLE_provoking_vertex
+void GL_APIENTRY glProvokingVertexANGLE(GLenum mode)
+{
+ return gl::ProvokingVertexANGLE(mode);
+}
+
+// GL_ANGLE_request_extension
+void GL_APIENTRY glRequestExtensionANGLE(const GLchar *name)
+{
+ return gl::RequestExtensionANGLE(name);
+}
+
+// GL_ANGLE_robust_client_memory
+void GL_APIENTRY glGetBooleanvRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params)
+{
+ return gl::GetBooleanvRobustANGLE(pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetBufferParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetBufferParameterivRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetFloatvRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetFloatvRobustANGLE(pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetFramebufferAttachmentParameterivRobustANGLE(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetFramebufferAttachmentParameterivRobustANGLE(target, attachment, pname, bufSize,
+ length, params);
+}
+
+void GL_APIENTRY glGetIntegervRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ return gl::GetIntegervRobustANGLE(pname, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetProgramivRobustANGLE(GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetProgramivRobustANGLE(program, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetRenderbufferParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetRenderbufferParameterivRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetShaderivRobustANGLE(GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetShaderivRobustANGLE(shader, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetTexParameterfvRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetTexParameterfvRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetTexParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetTexParameterivRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetUniformfvRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetUniformfvRobustANGLE(program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetUniformivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetUniformivRobustANGLE(program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribfvRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetVertexAttribfvRobustANGLE(index, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetVertexAttribivRobustANGLE(index, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribPointervRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer)
+{
+ return gl::GetVertexAttribPointervRobustANGLE(index, pname, bufSize, length, pointer);
+}
+
+void GL_APIENTRY glReadPixelsRobustANGLE(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels)
+{
+ return gl::ReadPixelsRobustANGLE(x, y, width, height, format, type, bufSize, length, columns,
+ rows, pixels);
+}
+
+void GL_APIENTRY glTexImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexImage2DRobustANGLE(target, level, internalformat, width, height, border, format,
+ type, bufSize, pixels);
+}
+
+void GL_APIENTRY glTexParameterfvRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params)
+{
+ return gl::TexParameterfvRobustANGLE(target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glTexParameterivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ return gl::TexParameterivRobustANGLE(target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glTexSubImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height, format,
+ type, bufSize, pixels);
+}
+
+void GL_APIENTRY glTexImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexImage3DRobustANGLE(target, level, internalformat, width, height, depth, border,
+ format, type, bufSize, pixels);
+}
+
+void GL_APIENTRY glTexSubImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexSubImage3DRobustANGLE(target, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, type, bufSize, pixels);
+}
+
+void GL_APIENTRY glCompressedTexImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexImage2DRobustANGLE(target, level, internalformat, width, height, border,
+ imageSize, dataSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage2DRobustANGLE(GLenum target,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height,
+ format, imageSize, dataSize, data);
+}
+
+void GL_APIENTRY glCompressedTexImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexImage3DRobustANGLE(target, level, internalformat, width, height, depth,
+ border, imageSize, dataSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage3DRobustANGLE(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexSubImage3DRobustANGLE(target, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, imageSize, dataSize, data);
+}
+
+void GL_APIENTRY glGetQueryivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetQueryivRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetQueryObjectuivRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetQueryObjectuivRobustANGLE(id, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetBufferPointervRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ return gl::GetBufferPointervRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetIntegeri_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ return gl::GetIntegeri_vRobustANGLE(target, index, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetInternalformativRobustANGLE(GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetInternalformativRobustANGLE(target, internalformat, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetVertexAttribIivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetVertexAttribIivRobustANGLE(index, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribIuivRobustANGLE(GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetVertexAttribIuivRobustANGLE(index, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetUniformuivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetUniformuivRobustANGLE(program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetActiveUniformBlockivRobustANGLE(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetActiveUniformBlockivRobustANGLE(program, uniformBlockIndex, pname, bufSize,
+ length, params);
+}
+
+void GL_APIENTRY glGetInteger64vRobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ return gl::GetInteger64vRobustANGLE(pname, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetInteger64i_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ return gl::GetInteger64i_vRobustANGLE(target, index, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetBufferParameteri64vRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ return gl::GetBufferParameteri64vRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glSamplerParameterivRobustANGLE(GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ return gl::SamplerParameterivRobustANGLE(sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glSamplerParameterfvRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param)
+{
+ return gl::SamplerParameterfvRobustANGLE(sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glGetSamplerParameterivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetSamplerParameterivRobustANGLE(sampler, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterfvRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetSamplerParameterfvRobustANGLE(sampler, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetFramebufferParameterivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetFramebufferParameterivRobustANGLE(sampler, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetProgramInterfaceivRobustANGLE(GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetProgramInterfaceivRobustANGLE(program, programInterface, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetBooleani_vRobustANGLE(GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data)
+{
+ return gl::GetBooleani_vRobustANGLE(target, index, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetMultisamplefvRobustANGLE(GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val)
+{
+ return gl::GetMultisamplefvRobustANGLE(pname, index, bufSize, length, val);
+}
+
+void GL_APIENTRY glGetTexLevelParameterivRobustANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetTexLevelParameterivRobustANGLE(target, level, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameterfvRobustANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetTexLevelParameterfvRobustANGLE(target, level, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetPointervRobustANGLERobustANGLE(GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ return gl::GetPointervRobustANGLERobustANGLE(pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glReadnPixelsRobustANGLE(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data)
+{
+ return gl::ReadnPixelsRobustANGLE(x, y, width, height, format, type, bufSize, length, columns,
+ rows, data);
+}
+
+void GL_APIENTRY glGetnUniformfvRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetnUniformfvRobustANGLE(program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetnUniformivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetnUniformivRobustANGLE(program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetnUniformuivRobustANGLE(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetnUniformuivRobustANGLE(program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glTexParameterIivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ return gl::TexParameterIivRobustANGLE(target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glTexParameterIuivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params)
+{
+ return gl::TexParameterIuivRobustANGLE(target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glGetTexParameterIivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetTexParameterIivRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetTexParameterIuivRobustANGLE(GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetTexParameterIuivRobustANGLE(target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glSamplerParameterIivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ return gl::SamplerParameterIivRobustANGLE(sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glSamplerParameterIuivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param)
+{
+ return gl::SamplerParameterIuivRobustANGLE(sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glGetSamplerParameterIivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetSamplerParameterIivRobustANGLE(sampler, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterIuivRobustANGLE(GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetSamplerParameterIuivRobustANGLE(sampler, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetQueryObjectivRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetQueryObjectivRobustANGLE(id, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetQueryObjecti64vRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ return gl::GetQueryObjecti64vRobustANGLE(id, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetQueryObjectui64vRobustANGLE(GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params)
+{
+ return gl::GetQueryObjectui64vRobustANGLE(id, pname, bufSize, length, params);
+}
+
+// GL_ANGLE_texture_external_update
+void GL_APIENTRY glTexImage2DExternalANGLE(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type)
+{
+ return gl::TexImage2DExternalANGLE(target, level, internalformat, width, height, border, format,
+ type);
+}
+
+void GL_APIENTRY glInvalidateTextureANGLE(GLenum target)
+{
+ return gl::InvalidateTextureANGLE(target);
+}
+
+// GL_ANGLE_texture_multisample
+void GL_APIENTRY glTexStorage2DMultisampleANGLE(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ return gl::TexStorage2DMultisampleANGLE(target, samples, internalformat, width, height,
+ fixedsamplelocations);
+}
+
+void GL_APIENTRY glGetTexLevelParameterivANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetTexLevelParameterivANGLE(target, level, pname, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameterfvANGLE(GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetTexLevelParameterfvANGLE(target, level, pname, params);
+}
+
+void GL_APIENTRY glGetMultisamplefvANGLE(GLenum pname, GLuint index, GLfloat *val)
+{
+ return gl::GetMultisamplefvANGLE(pname, index, val);
+}
+
+void GL_APIENTRY glSampleMaskiANGLE(GLuint maskNumber, GLbitfield mask)
+{
+ return gl::SampleMaskiANGLE(maskNumber, mask);
+}
+
+// GL_ANGLE_translated_shader_source
+void GL_APIENTRY glGetTranslatedShaderSourceANGLE(GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source)
+{
+ return gl::GetTranslatedShaderSourceANGLE(shader, bufsize, length, source);
+}
+
+// GL_CHROMIUM_bind_uniform_location
+void GL_APIENTRY glBindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name)
+{
+ return gl::BindUniformLocationCHROMIUM(program, location, name);
+}
+
+// GL_CHROMIUM_copy_compressed_texture
+void GL_APIENTRY glCompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
+{
+ return gl::CompressedCopyTextureCHROMIUM(sourceId, destId);
+}
+
+// GL_CHROMIUM_copy_texture
+void GL_APIENTRY glCopyTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopyTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel,
+ internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha,
+ unpackUnmultiplyAlpha);
+}
+
+void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopySubTextureCHROMIUM(sourceId, sourceLevel, destTarget, destId, destLevel, xoffset,
+ yoffset, x, y, width, height, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+}
+
+// GL_CHROMIUM_framebuffer_mixed_samples
+void GL_APIENTRY glCoverageModulationCHROMIUM(GLenum components)
+{
+ return gl::CoverageModulationCHROMIUM(components);
+}
+
+void GL_APIENTRY glMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix)
+{
+ return gl::MatrixLoadfCHROMIUM(matrixMode, matrix);
+}
+
+void GL_APIENTRY glMatrixLoadIdentityCHROMIUM(GLenum matrixMode)
+{
+ return gl::MatrixLoadIdentityCHROMIUM(matrixMode);
+}
+
+// GL_CHROMIUM_lose_context
+void GL_APIENTRY glLoseContextCHROMIUM(GLenum current, GLenum other)
+{
+ return gl::LoseContextCHROMIUM(current, other);
+}
+
+// GL_CHROMIUM_path_rendering
+GLuint GL_APIENTRY glGenPathsCHROMIUM(GLsizei range)
+{
+ return gl::GenPathsCHROMIUM(range);
+}
+
+void GL_APIENTRY glDeletePathsCHROMIUM(GLuint first, GLsizei range)
+{
+ return gl::DeletePathsCHROMIUM(first, range);
+}
+
+GLboolean GL_APIENTRY glIsPathCHROMIUM(GLuint path)
+{
+ return gl::IsPathCHROMIUM(path);
+}
+
+void GL_APIENTRY glPathCommandsCHROMIUM(GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords)
+{
+ return gl::PathCommandsCHROMIUM(path, numCommands, commands, numCoords, coordType, coords);
+}
+
+void GL_APIENTRY glPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value)
+{
+ return gl::PathParameterfCHROMIUM(path, pname, value);
+}
+
+void GL_APIENTRY glPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value)
+{
+ return gl::PathParameteriCHROMIUM(path, pname, value);
+}
+
+void GL_APIENTRY glGetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value)
+{
+ return gl::GetPathParameterfvCHROMIUM(path, pname, value);
+}
+
+void GL_APIENTRY glGetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value)
+{
+ return gl::GetPathParameterivCHROMIUM(path, pname, value);
+}
+
+void GL_APIENTRY glPathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask)
+{
+ return gl::PathStencilFuncCHROMIUM(func, ref, mask);
+}
+
+void GL_APIENTRY glStencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask)
+{
+ return gl::StencilFillPathCHROMIUM(path, fillMode, mask);
+}
+
+void GL_APIENTRY glStencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask)
+{
+ return gl::StencilStrokePathCHROMIUM(path, reference, mask);
+}
+
+void GL_APIENTRY glCoverFillPathCHROMIUM(GLuint path, GLenum coverMode)
+{
+ return gl::CoverFillPathCHROMIUM(path, coverMode);
+}
+
+void GL_APIENTRY glCoverStrokePathCHROMIUM(GLuint path, GLenum coverMode)
+{
+ return gl::CoverStrokePathCHROMIUM(path, coverMode);
+}
+
+void GL_APIENTRY glStencilThenCoverFillPathCHROMIUM(GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode)
+{
+ return gl::StencilThenCoverFillPathCHROMIUM(path, fillMode, mask, coverMode);
+}
+
+void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUM(GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode)
+{
+ return gl::StencilThenCoverStrokePathCHROMIUM(path, reference, mask, coverMode);
+}
+
+void GL_APIENTRY glCoverFillPathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::CoverFillPathInstancedCHROMIUM(numPath, pathNameType, paths, pathBase, coverMode,
+ transformType, transformValues);
+}
+
+void GL_APIENTRY glCoverStrokePathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::CoverStrokePathInstancedCHROMIUM(numPath, pathNameType, paths, pathBase, coverMode,
+ transformType, transformValues);
+}
+
+void GL_APIENTRY glStencilStrokePathInstancedCHROMIUM(GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilStrokePathInstancedCHROMIUM(numPath, pathNameType, paths, pathBase, reference,
+ mask, transformType, transformValues);
+}
+
+void GL_APIENTRY glStencilFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, fillMode,
+ mask, transformType, transformValues);
+}
+
+void GL_APIENTRY glStencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilThenCoverFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase,
+ fillMode, mask, coverMode, transformType,
+ transformValues);
+}
+
+void GL_APIENTRY glStencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilThenCoverStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase,
+ reference, mask, coverMode,
+ transformType, transformValues);
+}
+
+void GL_APIENTRY glBindFragmentInputLocationCHROMIUM(GLuint programs,
+ GLint location,
+ const GLchar *name)
+{
+ return gl::BindFragmentInputLocationCHROMIUM(programs, location, name);
+}
+
+void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUM(GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ return gl::ProgramPathFragmentInputGenCHROMIUM(program, location, genMode, components, coeffs);
+}
+
+// GL_EXT_blend_func_extended
+void GL_APIENTRY glBindFragDataLocationEXT(GLuint program, GLuint color, const GLchar *name)
+{
+ return gl::BindFragDataLocationEXT(program, color, name);
+}
+
+void GL_APIENTRY glBindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name)
+{
+ return gl::BindFragDataLocationIndexedEXT(program, colorNumber, index, name);
+}
+
+GLint GL_APIENTRY glGetFragDataIndexEXT(GLuint program, const GLchar *name)
+{
+ return gl::GetFragDataIndexEXT(program, name);
+}
+
+GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT(GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ return gl::GetProgramResourceLocationIndexEXT(program, programInterface, name);
+}
+
+// GL_EXT_debug_marker
+void GL_APIENTRY glInsertEventMarkerEXT(GLsizei length, const GLchar *marker)
+{
+ return gl::InsertEventMarkerEXT(length, marker);
+}
+
+void GL_APIENTRY glPopGroupMarkerEXT()
+{
+ return gl::PopGroupMarkerEXT();
+}
+
+void GL_APIENTRY glPushGroupMarkerEXT(GLsizei length, const GLchar *marker)
+{
+ return gl::PushGroupMarkerEXT(length, marker);
+}
+
+// GL_EXT_discard_framebuffer
+void GL_APIENTRY glDiscardFramebufferEXT(GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ return gl::DiscardFramebufferEXT(target, numAttachments, attachments);
+}
+
+// GL_EXT_disjoint_timer_query
+void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint id)
+{
+ return gl::BeginQueryEXT(target, id);
+}
+
+void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
+{
+ return gl::DeleteQueriesEXT(n, ids);
+}
+
+void GL_APIENTRY glEndQueryEXT(GLenum target)
+{
+ return gl::EndQueryEXT(target);
+}
+
+void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint *ids)
+{
+ return gl::GenQueriesEXT(n, ids);
+}
+
+void GL_APIENTRY glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
+{
+ return gl::GetQueryObjecti64vEXT(id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
+{
+ return gl::GetQueryObjectivEXT(id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
+{
+ return gl::GetQueryObjectui64vEXT(id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
+{
+ return gl::GetQueryObjectuivEXT(id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetQueryivEXT(target, pname, params);
+}
+
+GLboolean GL_APIENTRY glIsQueryEXT(GLuint id)
+{
+ return gl::IsQueryEXT(id);
+}
+
+void GL_APIENTRY glQueryCounterEXT(GLuint id, GLenum target)
+{
+ return gl::QueryCounterEXT(id, target);
+}
+
+// GL_EXT_draw_buffers
+void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs)
+{
+ return gl::DrawBuffersEXT(n, bufs);
+}
+
+// GL_EXT_geometry_shader
+void GL_APIENTRY glFramebufferTextureEXT(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ return gl::FramebufferTextureEXT(target, attachment, texture, level);
+}
+
+// GL_EXT_instanced_arrays
+void GL_APIENTRY glDrawArraysInstancedEXT(GLenum mode,
+ GLint start,
+ GLsizei count,
+ GLsizei primcount)
+{
+ return gl::DrawArraysInstancedEXT(mode, start, count, primcount);
+}
+
+void GL_APIENTRY glDrawElementsInstancedEXT(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ return gl::DrawElementsInstancedEXT(mode, count, type, indices, primcount);
+}
+
+void GL_APIENTRY glVertexAttribDivisorEXT(GLuint index, GLuint divisor)
+{
+ return gl::VertexAttribDivisorEXT(index, divisor);
+}
+
+// GL_EXT_map_buffer_range
+void GL_APIENTRY glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ return gl::FlushMappedBufferRangeEXT(target, offset, length);
+}
+
+void *GL_APIENTRY glMapBufferRangeEXT(GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ return gl::MapBufferRangeEXT(target, offset, length, access);
+}
+
+// GL_EXT_memory_object
+void GL_APIENTRY glBufferStorageMemEXT(GLenum target,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::BufferStorageMemEXT(target, size, memory, offset);
+}
+
+void GL_APIENTRY glCreateMemoryObjectsEXT(GLsizei n, GLuint *memoryObjects)
+{
+ return gl::CreateMemoryObjectsEXT(n, memoryObjects);
+}
+
+void GL_APIENTRY glDeleteMemoryObjectsEXT(GLsizei n, const GLuint *memoryObjects)
+{
+ return gl::DeleteMemoryObjectsEXT(n, memoryObjects);
+}
+
+void GL_APIENTRY glGetMemoryObjectParameterivEXT(GLuint memoryObject, GLenum pname, GLint *params)
+{
+ return gl::GetMemoryObjectParameterivEXT(memoryObject, pname, params);
+}
+
+void GL_APIENTRY glGetUnsignedBytevEXT(GLenum pname, GLubyte *data)
+{
+ return gl::GetUnsignedBytevEXT(pname, data);
+}
+
+void GL_APIENTRY glGetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data)
+{
+ return gl::GetUnsignedBytei_vEXT(target, index, data);
+}
+
+GLboolean GL_APIENTRY glIsMemoryObjectEXT(GLuint memoryObject)
+{
+ return gl::IsMemoryObjectEXT(memoryObject);
+}
+
+void GL_APIENTRY glMemoryObjectParameterivEXT(GLuint memoryObject,
+ GLenum pname,
+ const GLint *params)
+{
+ return gl::MemoryObjectParameterivEXT(memoryObject, pname, params);
+}
+
+void GL_APIENTRY glTexStorageMem2DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem2DEXT(target, levels, internalFormat, width, height, memory, offset);
+}
+
+void GL_APIENTRY glTexStorageMem2DMultisampleEXT(GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem2DMultisampleEXT(target, samples, internalFormat, width, height,
+ fixedSampleLocations, memory, offset);
+}
+
+void GL_APIENTRY glTexStorageMem3DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem3DEXT(target, levels, internalFormat, width, height, depth, memory,
+ offset);
+}
+
+void GL_APIENTRY glTexStorageMem3DMultisampleEXT(GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem3DMultisampleEXT(target, samples, internalFormat, width, height, depth,
+ fixedSampleLocations, memory, offset);
+}
+
+// GL_EXT_memory_object_fd
+void GL_APIENTRY glImportMemoryFdEXT(GLuint memory, GLuint64 size, GLenum handleType, GLint fd)
+{
+ return gl::ImportMemoryFdEXT(memory, size, handleType, fd);
+}
+
+// GL_EXT_occlusion_query_boolean
+
+// GL_EXT_robustness
+GLenum GL_APIENTRY glGetGraphicsResetStatusEXT()
+{
+ return gl::GetGraphicsResetStatusEXT();
+}
+
+void GL_APIENTRY glGetnUniformfvEXT(GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params)
+{
+ return gl::GetnUniformfvEXT(program, location, bufSize, params);
+}
+
+void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params)
+{
+ return gl::GetnUniformivEXT(program, location, bufSize, params);
+}
+
+void GL_APIENTRY glReadnPixelsEXT(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data)
+{
+ return gl::ReadnPixelsEXT(x, y, width, height, format, type, bufSize, data);
+}
+
+// GL_EXT_semaphore
+void GL_APIENTRY glDeleteSemaphoresEXT(GLsizei n, const GLuint *semaphores)
+{
+ return gl::DeleteSemaphoresEXT(n, semaphores);
+}
+
+void GL_APIENTRY glGenSemaphoresEXT(GLsizei n, GLuint *semaphores)
+{
+ return gl::GenSemaphoresEXT(n, semaphores);
+}
+
+void GL_APIENTRY glGetSemaphoreParameterui64vEXT(GLuint semaphore, GLenum pname, GLuint64 *params)
+{
+ return gl::GetSemaphoreParameterui64vEXT(semaphore, pname, params);
+}
+
+GLboolean GL_APIENTRY glIsSemaphoreEXT(GLuint semaphore)
+{
+ return gl::IsSemaphoreEXT(semaphore);
+}
+
+void GL_APIENTRY glSemaphoreParameterui64vEXT(GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params)
+{
+ return gl::SemaphoreParameterui64vEXT(semaphore, pname, params);
+}
+
+void GL_APIENTRY glSignalSemaphoreEXT(GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts)
+{
+ return gl::SignalSemaphoreEXT(semaphore, numBufferBarriers, buffers, numTextureBarriers,
+ textures, dstLayouts);
+}
+
+void GL_APIENTRY glWaitSemaphoreEXT(GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts)
+{
+ return gl::WaitSemaphoreEXT(semaphore, numBufferBarriers, buffers, numTextureBarriers, textures,
+ srcLayouts);
+}
+
+// GL_EXT_semaphore_fd
+void GL_APIENTRY glImportSemaphoreFdEXT(GLuint semaphore, GLenum handleType, GLint fd)
+{
+ return gl::ImportSemaphoreFdEXT(semaphore, handleType, fd);
+}
+
+// GL_EXT_texture_storage
+void GL_APIENTRY glTexStorage1DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width)
+{
+ return gl::TexStorage1DEXT(target, levels, internalformat, width);
+}
+
+void GL_APIENTRY glTexStorage2DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::TexStorage2DEXT(target, levels, internalformat, width, height);
+}
+
+void GL_APIENTRY glTexStorage3DEXT(GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ return gl::TexStorage3DEXT(target, levels, internalformat, width, height, depth);
+}
+
+// GL_KHR_debug
+void GL_APIENTRY glDebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam)
+{
+ return gl::DebugMessageCallbackKHR(callback, userParam);
+}
+
+void GL_APIENTRY glDebugMessageControlKHR(GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled)
+{
+ return gl::DebugMessageControlKHR(source, type, severity, count, ids, enabled);
+}
+
+void GL_APIENTRY glDebugMessageInsertKHR(GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf)
+{
+ return gl::DebugMessageInsertKHR(source, type, id, severity, length, buf);
+}
+
+GLuint GL_APIENTRY glGetDebugMessageLogKHR(GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ return gl::GetDebugMessageLogKHR(count, bufSize, sources, types, ids, severities, lengths,
+ messageLog);
+}
+
+void GL_APIENTRY
+glGetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label)
+{
+ return gl::GetObjectLabelKHR(identifier, name, bufSize, length, label);
+}
+
+void GL_APIENTRY glGetObjectPtrLabelKHR(const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ return gl::GetObjectPtrLabelKHR(ptr, bufSize, length, label);
+}
+
+void GL_APIENTRY glGetPointervKHR(GLenum pname, void **params)
+{
+ return gl::GetPointervKHR(pname, params);
+}
+
+void GL_APIENTRY glObjectLabelKHR(GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label)
+{
+ return gl::ObjectLabelKHR(identifier, name, length, label);
+}
+
+void GL_APIENTRY glObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label)
+{
+ return gl::ObjectPtrLabelKHR(ptr, length, label);
+}
+
+void GL_APIENTRY glPopDebugGroupKHR()
+{
+ return gl::PopDebugGroupKHR();
+}
+
+void GL_APIENTRY glPushDebugGroupKHR(GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message)
+{
+ return gl::PushDebugGroupKHR(source, id, length, message);
+}
+
+// GL_KHR_parallel_shader_compile
+void GL_APIENTRY glMaxShaderCompilerThreadsKHR(GLuint count)
+{
+ return gl::MaxShaderCompilerThreadsKHR(count);
+}
+
+// GL_NV_fence
+void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint *fences)
+{
+ return gl::DeleteFencesNV(n, fences);
+}
+
+void GL_APIENTRY glFinishFenceNV(GLuint fence)
+{
+ return gl::FinishFenceNV(fence);
+}
+
+void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint *fences)
+{
+ return gl::GenFencesNV(n, fences);
+}
+
+void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
+{
+ return gl::GetFenceivNV(fence, pname, params);
+}
+
+GLboolean GL_APIENTRY glIsFenceNV(GLuint fence)
+{
+ return gl::IsFenceNV(fence);
+}
+
+void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition)
+{
+ return gl::SetFenceNV(fence, condition);
+}
+
+GLboolean GL_APIENTRY glTestFenceNV(GLuint fence)
+{
+ return gl::TestFenceNV(fence);
+}
+
+// GL_OES_EGL_image
+void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
+{
+ return gl::EGLImageTargetRenderbufferStorageOES(target, image);
+}
+
+void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
+{
+ return gl::EGLImageTargetTexture2DOES(target, image);
+}
+
+// GL_OES_draw_texture
+void GL_APIENTRY glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
+{
+ return gl::DrawTexfOES(x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexfvOES(const GLfloat *coords)
+{
+ return gl::DrawTexfvOES(coords);
+}
+
+void GL_APIENTRY glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
+{
+ return gl::DrawTexiOES(x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexivOES(const GLint *coords)
+{
+ return gl::DrawTexivOES(coords);
+}
+
+void GL_APIENTRY glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
+{
+ return gl::DrawTexsOES(x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexsvOES(const GLshort *coords)
+{
+ return gl::DrawTexsvOES(coords);
+}
+
+void GL_APIENTRY glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
+{
+ return gl::DrawTexxOES(x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexxvOES(const GLfixed *coords)
+{
+ return gl::DrawTexxvOES(coords);
+}
+
+// GL_OES_framebuffer_object
+void GL_APIENTRY glBindFramebufferOES(GLenum target, GLuint framebuffer)
+{
+ return gl::BindFramebufferOES(target, framebuffer);
+}
+
+void GL_APIENTRY glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
+{
+ return gl::BindRenderbufferOES(target, renderbuffer);
+}
+
+GLenum GL_APIENTRY glCheckFramebufferStatusOES(GLenum target)
+{
+ return gl::CheckFramebufferStatusOES(target);
+}
+
+void GL_APIENTRY glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers)
+{
+ return gl::DeleteFramebuffersOES(n, framebuffers);
+}
+
+void GL_APIENTRY glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers)
+{
+ return gl::DeleteRenderbuffersOES(n, renderbuffers);
+}
+
+void GL_APIENTRY glFramebufferRenderbufferOES(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ return gl::FramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
+}
+
+void GL_APIENTRY glFramebufferTexture2DOES(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ return gl::FramebufferTexture2DOES(target, attachment, textarget, texture, level);
+}
+
+void GL_APIENTRY glGenFramebuffersOES(GLsizei n, GLuint *framebuffers)
+{
+ return gl::GenFramebuffersOES(n, framebuffers);
+}
+
+void GL_APIENTRY glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
+{
+ return gl::GenRenderbuffersOES(n, renderbuffers);
+}
+
+void GL_APIENTRY glGenerateMipmapOES(GLenum target)
+{
+ return gl::GenerateMipmapOES(target);
+}
+
+void GL_APIENTRY glGetFramebufferAttachmentParameterivOES(GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
+}
+
+void GL_APIENTRY glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetRenderbufferParameterivOES(target, pname, params);
+}
+
+GLboolean GL_APIENTRY glIsFramebufferOES(GLuint framebuffer)
+{
+ return gl::IsFramebufferOES(framebuffer);
+}
+
+GLboolean GL_APIENTRY glIsRenderbufferOES(GLuint renderbuffer)
+{
+ return gl::IsRenderbufferOES(renderbuffer);
+}
+
+void GL_APIENTRY glRenderbufferStorageOES(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorageOES(target, internalformat, width, height);
+}
+
+// GL_OES_get_program_binary
+void GL_APIENTRY glGetProgramBinaryOES(GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ return gl::GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
+}
+
+void GL_APIENTRY glProgramBinaryOES(GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length)
+{
+ return gl::ProgramBinaryOES(program, binaryFormat, binary, length);
+}
+
+// GL_OES_mapbuffer
+void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, void **params)
+{
+ return gl::GetBufferPointervOES(target, pname, params);
+}
+
+void *GL_APIENTRY glMapBufferOES(GLenum target, GLenum access)
+{
+ return gl::MapBufferOES(target, access);
+}
+
+GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target)
+{
+ return gl::UnmapBufferOES(target);
+}
+
+// GL_OES_matrix_palette
+void GL_APIENTRY glCurrentPaletteMatrixOES(GLuint matrixpaletteindex)
+{
+ return gl::CurrentPaletteMatrixOES(matrixpaletteindex);
+}
+
+void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES()
+{
+ return gl::LoadPaletteFromModelViewMatrixOES();
+}
+
+void GL_APIENTRY glMatrixIndexPointerOES(GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::MatrixIndexPointerOES(size, type, stride, pointer);
+}
+
+void GL_APIENTRY glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ return gl::WeightPointerOES(size, type, stride, pointer);
+}
+
+// GL_OES_point_size_array
+void GL_APIENTRY glPointSizePointerOES(GLenum type, GLsizei stride, const void *pointer)
+{
+ return gl::PointSizePointerOES(type, stride, pointer);
+}
+
+// GL_OES_query_matrix
+GLbitfield GL_APIENTRY glQueryMatrixxOES(GLfixed *mantissa, GLint *exponent)
+{
+ return gl::QueryMatrixxOES(mantissa, exponent);
+}
+
+// GL_OES_texture_3D
+void GL_APIENTRY glCompressedTexImage3DOES(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexImage3DOES(target, level, internalformat, width, height, depth, border,
+ imageSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height,
+ depth, format, imageSize, data);
+}
+
+void GL_APIENTRY glCopyTexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::CopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height);
+}
+
+void GL_APIENTRY glFramebufferTexture3DOES(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ return gl::FramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset);
+}
+
+void GL_APIENTRY glTexImage3DOES(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexImage3DOES(target, level, internalformat, width, height, depth, border, format,
+ type, pixels);
+}
+
+void GL_APIENTRY glTexSubImage3DOES(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth,
+ format, type, pixels);
+}
+
+// GL_OES_texture_border_clamp
+void GL_APIENTRY glGetSamplerParameterIivOES(GLuint sampler, GLenum pname, GLint *params)
+{
+ return gl::GetSamplerParameterIivOES(sampler, pname, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterIuivOES(GLuint sampler, GLenum pname, GLuint *params)
+{
+ return gl::GetSamplerParameterIuivOES(sampler, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterIivOES(GLenum target, GLenum pname, GLint *params)
+{
+ return gl::GetTexParameterIivOES(target, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterIuivOES(GLenum target, GLenum pname, GLuint *params)
+{
+ return gl::GetTexParameterIuivOES(target, pname, params);
+}
+
+void GL_APIENTRY glSamplerParameterIivOES(GLuint sampler, GLenum pname, const GLint *param)
+{
+ return gl::SamplerParameterIivOES(sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameterIuivOES(GLuint sampler, GLenum pname, const GLuint *param)
+{
+ return gl::SamplerParameterIuivOES(sampler, pname, param);
+}
+
+void GL_APIENTRY glTexParameterIivOES(GLenum target, GLenum pname, const GLint *params)
+{
+ return gl::TexParameterIivOES(target, pname, params);
+}
+
+void GL_APIENTRY glTexParameterIuivOES(GLenum target, GLenum pname, const GLuint *params)
+{
+ return gl::TexParameterIuivOES(target, pname, params);
+}
+
+// GL_OES_texture_cube_map
+void GL_APIENTRY glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
+{
+ return gl::GetTexGenfvOES(coord, pname, params);
+}
+
+void GL_APIENTRY glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params)
+{
+ return gl::GetTexGenivOES(coord, pname, params);
+}
+
+void GL_APIENTRY glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
+{
+ return gl::GetTexGenxvOES(coord, pname, params);
+}
+
+void GL_APIENTRY glTexGenfOES(GLenum coord, GLenum pname, GLfloat param)
+{
+ return gl::TexGenfOES(coord, pname, param);
+}
+
+void GL_APIENTRY glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params)
+{
+ return gl::TexGenfvOES(coord, pname, params);
+}
+
+void GL_APIENTRY glTexGeniOES(GLenum coord, GLenum pname, GLint param)
+{
+ return gl::TexGeniOES(coord, pname, param);
+}
+
+void GL_APIENTRY glTexGenivOES(GLenum coord, GLenum pname, const GLint *params)
+{
+ return gl::TexGenivOES(coord, pname, params);
+}
+
+void GL_APIENTRY glTexGenxOES(GLenum coord, GLenum pname, GLfixed param)
+{
+ return gl::TexGenxOES(coord, pname, param);
+}
+
+void GL_APIENTRY glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
+{
+ return gl::TexGenxvOES(coord, pname, params);
+}
+
+// GL_OES_texture_storage_multisample_2d_array
+void GL_APIENTRY glTexStorage3DMultisampleOES(GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ return gl::TexStorage3DMultisampleOES(target, samples, internalformat, width, height, depth,
+ fixedsamplelocations);
+}
+
+// GL_OES_vertex_array_object
+void GL_APIENTRY glBindVertexArrayOES(GLuint array)
+{
+ return gl::BindVertexArrayOES(array);
+}
+
+void GL_APIENTRY glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
+{
+ return gl::DeleteVertexArraysOES(n, arrays);
+}
+
+void GL_APIENTRY glGenVertexArraysOES(GLsizei n, GLuint *arrays)
+{
+ return gl::GenVertexArraysOES(n, arrays);
+}
+
+GLboolean GL_APIENTRY glIsVertexArrayOES(GLuint array)
+{
+ return gl::IsVertexArrayOES(array);
+}
+
+// GL_OVR_multiview
+void GL_APIENTRY glFramebufferTextureMultiviewOVR(GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews)
+{
+ return gl::FramebufferTextureMultiviewOVR(target, attachment, texture, level, baseViewIndex,
+ numViews);
+}
+
+// GL_OVR_multiview2
+
+// EGL_ANGLE_explicit_context
+void GL_APIENTRY glActiveShaderProgramContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLuint program)
+{
+ return gl::ActiveShaderProgramContextANGLE(ctx, pipeline, program);
+}
+
+void GL_APIENTRY glActiveTextureContextANGLE(GLeglContext ctx, GLenum texture)
+{
+ return gl::ActiveTextureContextANGLE(ctx, texture);
+}
+
+void GL_APIENTRY glAlphaFuncContextANGLE(GLeglContext ctx, GLenum func, GLfloat ref)
+{
+ return gl::AlphaFuncContextANGLE(ctx, func, ref);
+}
+
+void GL_APIENTRY glAlphaFuncxContextANGLE(GLeglContext ctx, GLenum func, GLfixed ref)
+{
+ return gl::AlphaFuncxContextANGLE(ctx, func, ref);
+}
+
+void GL_APIENTRY glAttachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader)
+{
+ return gl::AttachShaderContextANGLE(ctx, program, shader);
+}
+
+void GL_APIENTRY glBeginQueryContextANGLE(GLeglContext ctx, GLenum target, GLuint id)
+{
+ return gl::BeginQueryContextANGLE(ctx, target, id);
+}
+
+void GL_APIENTRY glBeginQueryEXTContextANGLE(GLeglContext ctx, GLenum target, GLuint id)
+{
+ return gl::BeginQueryEXTContextANGLE(ctx, target, id);
+}
+
+void GL_APIENTRY glBeginTransformFeedbackContextANGLE(GLeglContext ctx, GLenum primitiveMode)
+{
+ return gl::BeginTransformFeedbackContextANGLE(ctx, primitiveMode);
+}
+
+void GL_APIENTRY glBindAttribLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ const GLchar *name)
+{
+ return gl::BindAttribLocationContextANGLE(ctx, program, index, name);
+}
+
+void GL_APIENTRY glBindBufferContextANGLE(GLeglContext ctx, GLenum target, GLuint buffer)
+{
+ return gl::BindBufferContextANGLE(ctx, target, buffer);
+}
+
+void GL_APIENTRY glBindBufferBaseContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLuint buffer)
+{
+ return gl::BindBufferBaseContextANGLE(ctx, target, index, buffer);
+}
+
+void GL_APIENTRY glBindBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ return gl::BindBufferRangeContextANGLE(ctx, target, index, buffer, offset, size);
+}
+
+void GL_APIENTRY glBindFragDataLocationEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint color,
+ const GLchar *name)
+{
+ return gl::BindFragDataLocationEXTContextANGLE(ctx, program, color, name);
+}
+
+void GL_APIENTRY glBindFragDataLocationIndexedEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const GLchar *name)
+{
+ return gl::BindFragDataLocationIndexedEXTContextANGLE(ctx, program, colorNumber, index, name);
+}
+
+void GL_APIENTRY glBindFramebufferContextANGLE(GLeglContext ctx, GLenum target, GLuint framebuffer)
+{
+ return gl::BindFramebufferContextANGLE(ctx, target, framebuffer);
+}
+
+void GL_APIENTRY glBindFramebufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint framebuffer)
+{
+ return gl::BindFramebufferOESContextANGLE(ctx, target, framebuffer);
+}
+
+void GL_APIENTRY glBindImageTextureContextANGLE(GLeglContext ctx,
+ GLuint unit,
+ GLuint texture,
+ GLint level,
+ GLboolean layered,
+ GLint layer,
+ GLenum access,
+ GLenum format)
+{
+ return gl::BindImageTextureContextANGLE(ctx, unit, texture, level, layered, layer, access,
+ format);
+}
+
+void GL_APIENTRY glBindProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline)
+{
+ return gl::BindProgramPipelineContextANGLE(ctx, pipeline);
+}
+
+void GL_APIENTRY glBindRenderbufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint renderbuffer)
+{
+ return gl::BindRenderbufferContextANGLE(ctx, target, renderbuffer);
+}
+
+void GL_APIENTRY glBindRenderbufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint renderbuffer)
+{
+ return gl::BindRenderbufferOESContextANGLE(ctx, target, renderbuffer);
+}
+
+void GL_APIENTRY glBindSamplerContextANGLE(GLeglContext ctx, GLuint unit, GLuint sampler)
+{
+ return gl::BindSamplerContextANGLE(ctx, unit, sampler);
+}
+
+void GL_APIENTRY glBindTextureContextANGLE(GLeglContext ctx, GLenum target, GLuint texture)
+{
+ return gl::BindTextureContextANGLE(ctx, target, texture);
+}
+
+void GL_APIENTRY glBindTransformFeedbackContextANGLE(GLeglContext ctx, GLenum target, GLuint id)
+{
+ return gl::BindTransformFeedbackContextANGLE(ctx, target, id);
+}
+
+void GL_APIENTRY glBindVertexArrayContextANGLE(GLeglContext ctx, GLuint array)
+{
+ return gl::BindVertexArrayContextANGLE(ctx, array);
+}
+
+void GL_APIENTRY glBindVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array)
+{
+ return gl::BindVertexArrayOESContextANGLE(ctx, array);
+}
+
+void GL_APIENTRY glBindVertexBufferContextANGLE(GLeglContext ctx,
+ GLuint bindingindex,
+ GLuint buffer,
+ GLintptr offset,
+ GLsizei stride)
+{
+ return gl::BindVertexBufferContextANGLE(ctx, bindingindex, buffer, offset, stride);
+}
+
+void GL_APIENTRY
+glBlendColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return gl::BlendColorContextANGLE(ctx, red, green, blue, alpha);
+}
+
+void GL_APIENTRY glBlendEquationContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ return gl::BlendEquationContextANGLE(ctx, mode);
+}
+
+void GL_APIENTRY glBlendEquationSeparateContextANGLE(GLeglContext ctx,
+ GLenum modeRGB,
+ GLenum modeAlpha)
+{
+ return gl::BlendEquationSeparateContextANGLE(ctx, modeRGB, modeAlpha);
+}
+
+void GL_APIENTRY glBlendFuncContextANGLE(GLeglContext ctx, GLenum sfactor, GLenum dfactor)
+{
+ return gl::BlendFuncContextANGLE(ctx, sfactor, dfactor);
+}
+
+void GL_APIENTRY glBlendFuncSeparateContextANGLE(GLeglContext ctx,
+ GLenum sfactorRGB,
+ GLenum dfactorRGB,
+ GLenum sfactorAlpha,
+ GLenum dfactorAlpha)
+{
+ return gl::BlendFuncSeparateContextANGLE(ctx, sfactorRGB, dfactorRGB, sfactorAlpha,
+ dfactorAlpha);
+}
+
+void GL_APIENTRY glBlitFramebufferContextANGLE(GLeglContext ctx,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ return gl::BlitFramebufferContextANGLE(ctx, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1,
+ dstY1, mask, filter);
+}
+
+void GL_APIENTRY glBlitFramebufferANGLEContextANGLE(GLeglContext ctx,
+ GLint srcX0,
+ GLint srcY0,
+ GLint srcX1,
+ GLint srcY1,
+ GLint dstX0,
+ GLint dstY0,
+ GLint dstX1,
+ GLint dstY1,
+ GLbitfield mask,
+ GLenum filter)
+{
+ return gl::BlitFramebufferANGLEContextANGLE(ctx, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
+ dstX1, dstY1, mask, filter);
+}
+
+void GL_APIENTRY glBufferDataContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizeiptr size,
+ const void *data,
+ GLenum usage)
+{
+ return gl::BufferDataContextANGLE(ctx, target, size, data, usage);
+}
+
+void GL_APIENTRY glBufferStorageMemEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizeiptr size,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::BufferStorageMemEXTContextANGLE(ctx, target, size, memory, offset);
+}
+
+void GL_APIENTRY glBufferSubDataContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr size,
+ const void *data)
+{
+ return gl::BufferSubDataContextANGLE(ctx, target, offset, size, data);
+}
+
+GLenum GL_APIENTRY glCheckFramebufferStatusContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::CheckFramebufferStatusContextANGLE(ctx, target);
+}
+
+GLenum GL_APIENTRY glCheckFramebufferStatusOESContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::CheckFramebufferStatusOESContextANGLE(ctx, target);
+}
+
+void GL_APIENTRY glClearContextANGLE(GLeglContext ctx, GLbitfield mask)
+{
+ return gl::ClearContextANGLE(ctx, mask);
+}
+
+void GL_APIENTRY glClearBufferfiContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ GLfloat depth,
+ GLint stencil)
+{
+ return gl::ClearBufferfiContextANGLE(ctx, buffer, drawbuffer, depth, stencil);
+}
+
+void GL_APIENTRY glClearBufferfvContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLfloat *value)
+{
+ return gl::ClearBufferfvContextANGLE(ctx, buffer, drawbuffer, value);
+}
+
+void GL_APIENTRY glClearBufferivContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLint *value)
+{
+ return gl::ClearBufferivContextANGLE(ctx, buffer, drawbuffer, value);
+}
+
+void GL_APIENTRY glClearBufferuivContextANGLE(GLeglContext ctx,
+ GLenum buffer,
+ GLint drawbuffer,
+ const GLuint *value)
+{
+ return gl::ClearBufferuivContextANGLE(ctx, buffer, drawbuffer, value);
+}
+
+void GL_APIENTRY
+glClearColorContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return gl::ClearColorContextANGLE(ctx, red, green, blue, alpha);
+}
+
+void GL_APIENTRY
+glClearColorxContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ return gl::ClearColorxContextANGLE(ctx, red, green, blue, alpha);
+}
+
+void GL_APIENTRY glClearDepthfContextANGLE(GLeglContext ctx, GLfloat d)
+{
+ return gl::ClearDepthfContextANGLE(ctx, d);
+}
+
+void GL_APIENTRY glClearDepthxContextANGLE(GLeglContext ctx, GLfixed depth)
+{
+ return gl::ClearDepthxContextANGLE(ctx, depth);
+}
+
+void GL_APIENTRY glClearStencilContextANGLE(GLeglContext ctx, GLint s)
+{
+ return gl::ClearStencilContextANGLE(ctx, s);
+}
+
+void GL_APIENTRY glClientActiveTextureContextANGLE(GLeglContext ctx, GLenum texture)
+{
+ return gl::ClientActiveTextureContextANGLE(ctx, texture);
+}
+
+GLenum GL_APIENTRY glClientWaitSyncContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout)
+{
+ return gl::ClientWaitSyncContextANGLE(ctx, sync, flags, timeout);
+}
+
+void GL_APIENTRY glClipPlanefContextANGLE(GLeglContext ctx, GLenum p, const GLfloat *eqn)
+{
+ return gl::ClipPlanefContextANGLE(ctx, p, eqn);
+}
+
+void GL_APIENTRY glClipPlanexContextANGLE(GLeglContext ctx, GLenum plane, const GLfixed *equation)
+{
+ return gl::ClipPlanexContextANGLE(ctx, plane, equation);
+}
+
+void GL_APIENTRY
+glColor4fContextANGLE(GLeglContext ctx, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ return gl::Color4fContextANGLE(ctx, red, green, blue, alpha);
+}
+
+void GL_APIENTRY
+glColor4ubContextANGLE(GLeglContext ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ return gl::Color4ubContextANGLE(ctx, red, green, blue, alpha);
+}
+
+void GL_APIENTRY
+glColor4xContextANGLE(GLeglContext ctx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+{
+ return gl::Color4xContextANGLE(ctx, red, green, blue, alpha);
+}
+
+void GL_APIENTRY glColorMaskContextANGLE(GLeglContext ctx,
+ GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha)
+{
+ return gl::ColorMaskContextANGLE(ctx, red, green, blue, alpha);
+}
+
+void GL_APIENTRY glColorPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::ColorPointerContextANGLE(ctx, size, type, stride, pointer);
+}
+
+void GL_APIENTRY glCompileShaderContextANGLE(GLeglContext ctx, GLuint shader)
+{
+ return gl::CompileShaderContextANGLE(ctx, shader);
+}
+
+void GL_APIENTRY glCompressedTexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexImage2DContextANGLE(ctx, target, level, internalformat, width, height,
+ border, imageSize, data);
+}
+
+void GL_APIENTRY glCompressedTexImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexImage3DContextANGLE(ctx, target, level, internalformat, width, height,
+ depth, border, imageSize, data);
+}
+
+void GL_APIENTRY glCompressedTexImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexImage3DOESContextANGLE(ctx, target, level, internalformat, width,
+ height, depth, border, imageSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexSubImage2DContextANGLE(ctx, target, level, xoffset, yoffset, width,
+ height, format, imageSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexSubImage3DContextANGLE(ctx, target, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, imageSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const void *data)
+{
+ return gl::CompressedTexSubImage3DOESContextANGLE(ctx, target, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, imageSize,
+ data);
+}
+
+void GL_APIENTRY glCopyBufferSubDataContextANGLE(GLeglContext ctx,
+ GLenum readTarget,
+ GLenum writeTarget,
+ GLintptr readOffset,
+ GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ return gl::CopyBufferSubDataContextANGLE(ctx, readTarget, writeTarget, readOffset, writeOffset,
+ size);
+}
+
+void GL_APIENTRY glCopyTexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ return gl::CopyTexImage2DContextANGLE(ctx, target, level, internalformat, x, y, width, height,
+ border);
+}
+
+void GL_APIENTRY glCopyTexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::CopyTexSubImage2DContextANGLE(ctx, target, level, xoffset, yoffset, x, y, width,
+ height);
+}
+
+void GL_APIENTRY glCopyTexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::CopyTexSubImage3DContextANGLE(ctx, target, level, xoffset, yoffset, zoffset, x, y,
+ width, height);
+}
+
+void GL_APIENTRY glCopyTexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::CopyTexSubImage3DOESContextANGLE(ctx, target, level, xoffset, yoffset, zoffset, x, y,
+ width, height);
+}
+
+void GL_APIENTRY glCreateMemoryObjectsEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *memoryObjects)
+{
+ return gl::CreateMemoryObjectsEXTContextANGLE(ctx, n, memoryObjects);
+}
+
+GLuint GL_APIENTRY glCreateProgramContextANGLE(GLeglContext ctx)
+{
+ return gl::CreateProgramContextANGLE(ctx);
+}
+
+GLuint GL_APIENTRY glCreateShaderContextANGLE(GLeglContext ctx, GLenum type)
+{
+ return gl::CreateShaderContextANGLE(ctx, type);
+}
+
+GLuint GL_APIENTRY glCreateShaderProgramvContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei count,
+ const GLchar *const *strings)
+{
+ return gl::CreateShaderProgramvContextANGLE(ctx, type, count, strings);
+}
+
+void GL_APIENTRY glCullFaceContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ return gl::CullFaceContextANGLE(ctx, mode);
+}
+
+void GL_APIENTRY glCurrentPaletteMatrixOESContextANGLE(GLeglContext ctx, GLuint matrixpaletteindex)
+{
+ return gl::CurrentPaletteMatrixOESContextANGLE(ctx, matrixpaletteindex);
+}
+
+void GL_APIENTRY glDebugMessageCallbackKHRContextANGLE(GLeglContext ctx,
+ GLDEBUGPROCKHR callback,
+ const void *userParam)
+{
+ return gl::DebugMessageCallbackKHRContextANGLE(ctx, callback, userParam);
+}
+
+void GL_APIENTRY glDebugMessageControlKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLenum type,
+ GLenum severity,
+ GLsizei count,
+ const GLuint *ids,
+ GLboolean enabled)
+{
+ return gl::DebugMessageControlKHRContextANGLE(ctx, source, type, severity, count, ids, enabled);
+}
+
+void GL_APIENTRY glDebugMessageInsertKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLenum type,
+ GLuint id,
+ GLenum severity,
+ GLsizei length,
+ const GLchar *buf)
+{
+ return gl::DebugMessageInsertKHRContextANGLE(ctx, source, type, id, severity, length, buf);
+}
+
+void GL_APIENTRY glDeleteBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *buffers)
+{
+ return gl::DeleteBuffersContextANGLE(ctx, n, buffers);
+}
+
+void GL_APIENTRY glDeleteFencesNVContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *fences)
+{
+ return gl::DeleteFencesNVContextANGLE(ctx, n, fences);
+}
+
+void GL_APIENTRY glDeleteFramebuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *framebuffers)
+{
+ return gl::DeleteFramebuffersContextANGLE(ctx, n, framebuffers);
+}
+
+void GL_APIENTRY glDeleteFramebuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *framebuffers)
+{
+ return gl::DeleteFramebuffersOESContextANGLE(ctx, n, framebuffers);
+}
+
+void GL_APIENTRY glDeleteMemoryObjectsEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *memoryObjects)
+{
+ return gl::DeleteMemoryObjectsEXTContextANGLE(ctx, n, memoryObjects);
+}
+
+void GL_APIENTRY glDeleteProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ return gl::DeleteProgramContextANGLE(ctx, program);
+}
+
+void GL_APIENTRY glDeleteProgramPipelinesContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *pipelines)
+{
+ return gl::DeleteProgramPipelinesContextANGLE(ctx, n, pipelines);
+}
+
+void GL_APIENTRY glDeleteQueriesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids)
+{
+ return gl::DeleteQueriesContextANGLE(ctx, n, ids);
+}
+
+void GL_APIENTRY glDeleteQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *ids)
+{
+ return gl::DeleteQueriesEXTContextANGLE(ctx, n, ids);
+}
+
+void GL_APIENTRY glDeleteRenderbuffersContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *renderbuffers)
+{
+ return gl::DeleteRenderbuffersContextANGLE(ctx, n, renderbuffers);
+}
+
+void GL_APIENTRY glDeleteRenderbuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *renderbuffers)
+{
+ return gl::DeleteRenderbuffersOESContextANGLE(ctx, n, renderbuffers);
+}
+
+void GL_APIENTRY glDeleteSamplersContextANGLE(GLeglContext ctx,
+ GLsizei count,
+ const GLuint *samplers)
+{
+ return gl::DeleteSamplersContextANGLE(ctx, count, samplers);
+}
+
+void GL_APIENTRY glDeleteSemaphoresEXTContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *semaphores)
+{
+ return gl::DeleteSemaphoresEXTContextANGLE(ctx, n, semaphores);
+}
+
+void GL_APIENTRY glDeleteShaderContextANGLE(GLeglContext ctx, GLuint shader)
+{
+ return gl::DeleteShaderContextANGLE(ctx, shader);
+}
+
+void GL_APIENTRY glDeleteSyncContextANGLE(GLeglContext ctx, GLsync sync)
+{
+ return gl::DeleteSyncContextANGLE(ctx, sync);
+}
+
+void GL_APIENTRY glDeleteTexturesContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *textures)
+{
+ return gl::DeleteTexturesContextANGLE(ctx, n, textures);
+}
+
+void GL_APIENTRY glDeleteTransformFeedbacksContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *ids)
+{
+ return gl::DeleteTransformFeedbacksContextANGLE(ctx, n, ids);
+}
+
+void GL_APIENTRY glDeleteVertexArraysContextANGLE(GLeglContext ctx, GLsizei n, const GLuint *arrays)
+{
+ return gl::DeleteVertexArraysContextANGLE(ctx, n, arrays);
+}
+
+void GL_APIENTRY glDeleteVertexArraysOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ const GLuint *arrays)
+{
+ return gl::DeleteVertexArraysOESContextANGLE(ctx, n, arrays);
+}
+
+void GL_APIENTRY glDepthFuncContextANGLE(GLeglContext ctx, GLenum func)
+{
+ return gl::DepthFuncContextANGLE(ctx, func);
+}
+
+void GL_APIENTRY glDepthMaskContextANGLE(GLeglContext ctx, GLboolean flag)
+{
+ return gl::DepthMaskContextANGLE(ctx, flag);
+}
+
+void GL_APIENTRY glDepthRangefContextANGLE(GLeglContext ctx, GLfloat n, GLfloat f)
+{
+ return gl::DepthRangefContextANGLE(ctx, n, f);
+}
+
+void GL_APIENTRY glDepthRangexContextANGLE(GLeglContext ctx, GLfixed n, GLfixed f)
+{
+ return gl::DepthRangexContextANGLE(ctx, n, f);
+}
+
+void GL_APIENTRY glDetachShaderContextANGLE(GLeglContext ctx, GLuint program, GLuint shader)
+{
+ return gl::DetachShaderContextANGLE(ctx, program, shader);
+}
+
+void GL_APIENTRY glDisableContextANGLE(GLeglContext ctx, GLenum cap)
+{
+ return gl::DisableContextANGLE(ctx, cap);
+}
+
+void GL_APIENTRY glDisableClientStateContextANGLE(GLeglContext ctx, GLenum array)
+{
+ return gl::DisableClientStateContextANGLE(ctx, array);
+}
+
+void GL_APIENTRY glDisableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index)
+{
+ return gl::DisableVertexAttribArrayContextANGLE(ctx, index);
+}
+
+void GL_APIENTRY glDiscardFramebufferEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ return gl::DiscardFramebufferEXTContextANGLE(ctx, target, numAttachments, attachments);
+}
+
+void GL_APIENTRY glDispatchComputeContextANGLE(GLeglContext ctx,
+ GLuint num_groups_x,
+ GLuint num_groups_y,
+ GLuint num_groups_z)
+{
+ return gl::DispatchComputeContextANGLE(ctx, num_groups_x, num_groups_y, num_groups_z);
+}
+
+void GL_APIENTRY glDispatchComputeIndirectContextANGLE(GLeglContext ctx, GLintptr indirect)
+{
+ return gl::DispatchComputeIndirectContextANGLE(ctx, indirect);
+}
+
+void GL_APIENTRY glDrawArraysContextANGLE(GLeglContext ctx, GLenum mode, GLint first, GLsizei count)
+{
+ return gl::DrawArraysContextANGLE(ctx, mode, first, count);
+}
+
+void GL_APIENTRY glDrawArraysIndirectContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const void *indirect)
+{
+ return gl::DrawArraysIndirectContextANGLE(ctx, mode, indirect);
+}
+
+void GL_APIENTRY glDrawArraysInstancedContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei instancecount)
+{
+ return gl::DrawArraysInstancedContextANGLE(ctx, mode, first, count, instancecount);
+}
+
+void GL_APIENTRY glDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ return gl::DrawArraysInstancedANGLEContextANGLE(ctx, mode, first, count, primcount);
+}
+
+void GL_APIENTRY glDrawArraysInstancedEXTContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLint start,
+ GLsizei count,
+ GLsizei primcount)
+{
+ return gl::DrawArraysInstancedEXTContextANGLE(ctx, mode, start, count, primcount);
+}
+
+void GL_APIENTRY glDrawBuffersContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs)
+{
+ return gl::DrawBuffersContextANGLE(ctx, n, bufs);
+}
+
+void GL_APIENTRY glDrawBuffersEXTContextANGLE(GLeglContext ctx, GLsizei n, const GLenum *bufs)
+{
+ return gl::DrawBuffersEXTContextANGLE(ctx, n, bufs);
+}
+
+void GL_APIENTRY glDrawElementsContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices)
+{
+ return gl::DrawElementsContextANGLE(ctx, mode, count, type, indices);
+}
+
+void GL_APIENTRY glDrawElementsIndirectContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLenum type,
+ const void *indirect)
+{
+ return gl::DrawElementsIndirectContextANGLE(ctx, mode, type, indirect);
+}
+
+void GL_APIENTRY glDrawElementsInstancedContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei instancecount)
+{
+ return gl::DrawElementsInstancedContextANGLE(ctx, mode, count, type, indices, instancecount);
+}
+
+void GL_APIENTRY glDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ return gl::DrawElementsInstancedANGLEContextANGLE(ctx, mode, count, type, indices, primcount);
+}
+
+void GL_APIENTRY glDrawElementsInstancedEXTContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const void *indices,
+ GLsizei primcount)
+{
+ return gl::DrawElementsInstancedEXTContextANGLE(ctx, mode, count, type, indices, primcount);
+}
+
+void GL_APIENTRY glDrawRangeElementsContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const void *indices)
+{
+ return gl::DrawRangeElementsContextANGLE(ctx, mode, start, end, count, type, indices);
+}
+
+void GL_APIENTRY glDrawTexfOESContextANGLE(GLeglContext ctx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat width,
+ GLfloat height)
+{
+ return gl::DrawTexfOESContextANGLE(ctx, x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexfvOESContextANGLE(GLeglContext ctx, const GLfloat *coords)
+{
+ return gl::DrawTexfvOESContextANGLE(ctx, coords);
+}
+
+void GL_APIENTRY
+glDrawTexiOESContextANGLE(GLeglContext ctx, GLint x, GLint y, GLint z, GLint width, GLint height)
+{
+ return gl::DrawTexiOESContextANGLE(ctx, x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexivOESContextANGLE(GLeglContext ctx, const GLint *coords)
+{
+ return gl::DrawTexivOESContextANGLE(ctx, coords);
+}
+
+void GL_APIENTRY glDrawTexsOESContextANGLE(GLeglContext ctx,
+ GLshort x,
+ GLshort y,
+ GLshort z,
+ GLshort width,
+ GLshort height)
+{
+ return gl::DrawTexsOESContextANGLE(ctx, x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexsvOESContextANGLE(GLeglContext ctx, const GLshort *coords)
+{
+ return gl::DrawTexsvOESContextANGLE(ctx, coords);
+}
+
+void GL_APIENTRY glDrawTexxOESContextANGLE(GLeglContext ctx,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z,
+ GLfixed width,
+ GLfixed height)
+{
+ return gl::DrawTexxOESContextANGLE(ctx, x, y, z, width, height);
+}
+
+void GL_APIENTRY glDrawTexxvOESContextANGLE(GLeglContext ctx, const GLfixed *coords)
+{
+ return gl::DrawTexxvOESContextANGLE(ctx, coords);
+}
+
+void GL_APIENTRY glEGLImageTargetRenderbufferStorageOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLeglImageOES image)
+{
+ return gl::EGLImageTargetRenderbufferStorageOESContextANGLE(ctx, target, image);
+}
+
+void GL_APIENTRY glEGLImageTargetTexture2DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLeglImageOES image)
+{
+ return gl::EGLImageTargetTexture2DOESContextANGLE(ctx, target, image);
+}
+
+void GL_APIENTRY glEnableContextANGLE(GLeglContext ctx, GLenum cap)
+{
+ return gl::EnableContextANGLE(ctx, cap);
+}
+
+void GL_APIENTRY glEnableClientStateContextANGLE(GLeglContext ctx, GLenum array)
+{
+ return gl::EnableClientStateContextANGLE(ctx, array);
+}
+
+void GL_APIENTRY glEnableVertexAttribArrayContextANGLE(GLeglContext ctx, GLuint index)
+{
+ return gl::EnableVertexAttribArrayContextANGLE(ctx, index);
+}
+
+void GL_APIENTRY glEndQueryContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::EndQueryContextANGLE(ctx, target);
+}
+
+void GL_APIENTRY glEndQueryEXTContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::EndQueryEXTContextANGLE(ctx, target);
+}
+
+void GL_APIENTRY glEndTransformFeedbackContextANGLE(GLeglContext ctx)
+{
+ return gl::EndTransformFeedbackContextANGLE(ctx);
+}
+
+GLsync GL_APIENTRY glFenceSyncContextANGLE(GLeglContext ctx, GLenum condition, GLbitfield flags)
+{
+ return gl::FenceSyncContextANGLE(ctx, condition, flags);
+}
+
+void GL_APIENTRY glFinishContextANGLE(GLeglContext ctx)
+{
+ return gl::FinishContextANGLE(ctx);
+}
+
+void GL_APIENTRY glFinishFenceNVContextANGLE(GLeglContext ctx, GLuint fence)
+{
+ return gl::FinishFenceNVContextANGLE(ctx, fence);
+}
+
+void GL_APIENTRY glFlushContextANGLE(GLeglContext ctx)
+{
+ return gl::FlushContextANGLE(ctx);
+}
+
+void GL_APIENTRY glFlushMappedBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ return gl::FlushMappedBufferRangeContextANGLE(ctx, target, offset, length);
+}
+
+void GL_APIENTRY glFlushMappedBufferRangeEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ return gl::FlushMappedBufferRangeEXTContextANGLE(ctx, target, offset, length);
+}
+
+void GL_APIENTRY glFogfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param)
+{
+ return gl::FogfContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glFogfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params)
+{
+ return gl::FogfvContextANGLE(ctx, pname, params);
+}
+
+void GL_APIENTRY glFogxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param)
+{
+ return gl::FogxContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glFogxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *param)
+{
+ return gl::FogxvContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glFramebufferParameteriContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ return gl::FramebufferParameteriContextANGLE(ctx, target, pname, param);
+}
+
+void GL_APIENTRY glFramebufferRenderbufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ return gl::FramebufferRenderbufferContextANGLE(ctx, target, attachment, renderbuffertarget,
+ renderbuffer);
+}
+
+void GL_APIENTRY glFramebufferRenderbufferOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ return gl::FramebufferRenderbufferOESContextANGLE(ctx, target, attachment, renderbuffertarget,
+ renderbuffer);
+}
+
+void GL_APIENTRY glFramebufferTexture2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ return gl::FramebufferTexture2DContextANGLE(ctx, target, attachment, textarget, texture, level);
+}
+
+void GL_APIENTRY glFramebufferTexture2DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ return gl::FramebufferTexture2DOESContextANGLE(ctx, target, attachment, textarget, texture,
+ level);
+}
+
+void GL_APIENTRY glFramebufferTexture3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level,
+ GLint zoffset)
+{
+ return gl::FramebufferTexture3DOESContextANGLE(ctx, target, attachment, textarget, texture,
+ level, zoffset);
+}
+
+void GL_APIENTRY glFramebufferTextureEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level)
+{
+ return gl::FramebufferTextureEXTContextANGLE(ctx, target, attachment, texture, level);
+}
+
+void GL_APIENTRY glFramebufferTextureLayerContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint layer)
+{
+ return gl::FramebufferTextureLayerContextANGLE(ctx, target, attachment, texture, level, layer);
+}
+
+void GL_APIENTRY glFramebufferTextureMultiviewOVRContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLuint texture,
+ GLint level,
+ GLint baseViewIndex,
+ GLsizei numViews)
+{
+ return gl::FramebufferTextureMultiviewOVRContextANGLE(ctx, target, attachment, texture, level,
+ baseViewIndex, numViews);
+}
+
+void GL_APIENTRY glFrontFaceContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ return gl::FrontFaceContextANGLE(ctx, mode);
+}
+
+void GL_APIENTRY glFrustumfContextANGLE(GLeglContext ctx,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f)
+{
+ return gl::FrustumfContextANGLE(ctx, l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glFrustumxContextANGLE(GLeglContext ctx,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f)
+{
+ return gl::FrustumxContextANGLE(ctx, l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glGenBuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *buffers)
+{
+ return gl::GenBuffersContextANGLE(ctx, n, buffers);
+}
+
+void GL_APIENTRY glGenFencesNVContextANGLE(GLeglContext ctx, GLsizei n, GLuint *fences)
+{
+ return gl::GenFencesNVContextANGLE(ctx, n, fences);
+}
+
+void GL_APIENTRY glGenFramebuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *framebuffers)
+{
+ return gl::GenFramebuffersContextANGLE(ctx, n, framebuffers);
+}
+
+void GL_APIENTRY glGenFramebuffersOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *framebuffers)
+{
+ return gl::GenFramebuffersOESContextANGLE(ctx, n, framebuffers);
+}
+
+void GL_APIENTRY glGenProgramPipelinesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *pipelines)
+{
+ return gl::GenProgramPipelinesContextANGLE(ctx, n, pipelines);
+}
+
+void GL_APIENTRY glGenQueriesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids)
+{
+ return gl::GenQueriesContextANGLE(ctx, n, ids);
+}
+
+void GL_APIENTRY glGenQueriesEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids)
+{
+ return gl::GenQueriesEXTContextANGLE(ctx, n, ids);
+}
+
+void GL_APIENTRY glGenRenderbuffersContextANGLE(GLeglContext ctx, GLsizei n, GLuint *renderbuffers)
+{
+ return gl::GenRenderbuffersContextANGLE(ctx, n, renderbuffers);
+}
+
+void GL_APIENTRY glGenRenderbuffersOESContextANGLE(GLeglContext ctx,
+ GLsizei n,
+ GLuint *renderbuffers)
+{
+ return gl::GenRenderbuffersOESContextANGLE(ctx, n, renderbuffers);
+}
+
+void GL_APIENTRY glGenSamplersContextANGLE(GLeglContext ctx, GLsizei count, GLuint *samplers)
+{
+ return gl::GenSamplersContextANGLE(ctx, count, samplers);
+}
+
+void GL_APIENTRY glGenSemaphoresEXTContextANGLE(GLeglContext ctx, GLsizei n, GLuint *semaphores)
+{
+ return gl::GenSemaphoresEXTContextANGLE(ctx, n, semaphores);
+}
+
+void GL_APIENTRY glGenTexturesContextANGLE(GLeglContext ctx, GLsizei n, GLuint *textures)
+{
+ return gl::GenTexturesContextANGLE(ctx, n, textures);
+}
+
+void GL_APIENTRY glGenTransformFeedbacksContextANGLE(GLeglContext ctx, GLsizei n, GLuint *ids)
+{
+ return gl::GenTransformFeedbacksContextANGLE(ctx, n, ids);
+}
+
+void GL_APIENTRY glGenVertexArraysContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays)
+{
+ return gl::GenVertexArraysContextANGLE(ctx, n, arrays);
+}
+
+void GL_APIENTRY glGenVertexArraysOESContextANGLE(GLeglContext ctx, GLsizei n, GLuint *arrays)
+{
+ return gl::GenVertexArraysOESContextANGLE(ctx, n, arrays);
+}
+
+void GL_APIENTRY glGenerateMipmapContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::GenerateMipmapContextANGLE(ctx, target);
+}
+
+void GL_APIENTRY glGenerateMipmapOESContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::GenerateMipmapOESContextANGLE(ctx, target);
+}
+
+void GL_APIENTRY glGetActiveAttribContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ return gl::GetActiveAttribContextANGLE(ctx, program, index, bufSize, length, size, type, name);
+}
+
+void GL_APIENTRY glGetActiveUniformContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ return gl::GetActiveUniformContextANGLE(ctx, program, index, bufSize, length, size, type, name);
+}
+
+void GL_APIENTRY glGetActiveUniformBlockNameContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName)
+{
+ return gl::GetActiveUniformBlockNameContextANGLE(ctx, program, uniformBlockIndex, bufSize,
+ length, uniformBlockName);
+}
+
+void GL_APIENTRY glGetActiveUniformBlockivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetActiveUniformBlockivContextANGLE(ctx, program, uniformBlockIndex, pname, params);
+}
+
+void GL_APIENTRY glGetActiveUniformsivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetActiveUniformsivContextANGLE(ctx, program, uniformCount, uniformIndices, pname,
+ params);
+}
+
+void GL_APIENTRY glGetAttachedShadersContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei maxCount,
+ GLsizei *count,
+ GLuint *shaders)
+{
+ return gl::GetAttachedShadersContextANGLE(ctx, program, maxCount, count, shaders);
+}
+
+GLint GL_APIENTRY glGetAttribLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ return gl::GetAttribLocationContextANGLE(ctx, program, name);
+}
+
+void GL_APIENTRY glGetBooleani_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLboolean *data)
+{
+ return gl::GetBooleani_vContextANGLE(ctx, target, index, data);
+}
+
+void GL_APIENTRY glGetBooleanvContextANGLE(GLeglContext ctx, GLenum pname, GLboolean *data)
+{
+ return gl::GetBooleanvContextANGLE(ctx, pname, data);
+}
+
+void GL_APIENTRY glGetBufferParameteri64vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint64 *params)
+{
+ return gl::GetBufferParameteri64vContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetBufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetBufferParameterivContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetBufferPointervContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ void **params)
+{
+ return gl::GetBufferPointervContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetBufferPointervOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ void **params)
+{
+ return gl::GetBufferPointervOESContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetClipPlanefContextANGLE(GLeglContext ctx, GLenum plane, GLfloat *equation)
+{
+ return gl::GetClipPlanefContextANGLE(ctx, plane, equation);
+}
+
+void GL_APIENTRY glGetClipPlanexContextANGLE(GLeglContext ctx, GLenum plane, GLfixed *equation)
+{
+ return gl::GetClipPlanexContextANGLE(ctx, plane, equation);
+}
+
+GLuint GL_APIENTRY glGetDebugMessageLogKHRContextANGLE(GLeglContext ctx,
+ GLuint count,
+ GLsizei bufSize,
+ GLenum *sources,
+ GLenum *types,
+ GLuint *ids,
+ GLenum *severities,
+ GLsizei *lengths,
+ GLchar *messageLog)
+{
+ return gl::GetDebugMessageLogKHRContextANGLE(ctx, count, bufSize, sources, types, ids,
+ severities, lengths, messageLog);
+}
+
+GLenum GL_APIENTRY glGetErrorContextANGLE(GLeglContext ctx)
+{
+ return gl::GetErrorContextANGLE(ctx);
+}
+
+void GL_APIENTRY glGetFenceivNVContextANGLE(GLeglContext ctx,
+ GLuint fence,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetFenceivNVContextANGLE(ctx, fence, pname, params);
+}
+
+void GL_APIENTRY glGetFixedvContextANGLE(GLeglContext ctx, GLenum pname, GLfixed *params)
+{
+ return gl::GetFixedvContextANGLE(ctx, pname, params);
+}
+
+void GL_APIENTRY glGetFloatvContextANGLE(GLeglContext ctx, GLenum pname, GLfloat *data)
+{
+ return gl::GetFloatvContextANGLE(ctx, pname, data);
+}
+
+GLint GL_APIENTRY glGetFragDataIndexEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ return gl::GetFragDataIndexEXTContextANGLE(ctx, program, name);
+}
+
+GLint GL_APIENTRY glGetFragDataLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ return gl::GetFragDataLocationContextANGLE(ctx, program, name);
+}
+
+void GL_APIENTRY glGetFramebufferAttachmentParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetFramebufferAttachmentParameterivContextANGLE(ctx, target, attachment, pname,
+ params);
+}
+
+void GL_APIENTRY glGetFramebufferAttachmentParameterivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetFramebufferAttachmentParameterivOESContextANGLE(ctx, target, attachment, pname,
+ params);
+}
+
+void GL_APIENTRY glGetFramebufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetFramebufferParameterivContextANGLE(ctx, target, pname, params);
+}
+
+GLenum GL_APIENTRY glGetGraphicsResetStatusEXTContextANGLE(GLeglContext ctx)
+{
+ return gl::GetGraphicsResetStatusEXTContextANGLE(ctx);
+}
+
+void GL_APIENTRY glGetInteger64i_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLint64 *data)
+{
+ return gl::GetInteger64i_vContextANGLE(ctx, target, index, data);
+}
+
+void GL_APIENTRY glGetInteger64vContextANGLE(GLeglContext ctx, GLenum pname, GLint64 *data)
+{
+ return gl::GetInteger64vContextANGLE(ctx, pname, data);
+}
+
+void GL_APIENTRY glGetIntegeri_vContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLint *data)
+{
+ return gl::GetIntegeri_vContextANGLE(ctx, target, index, data);
+}
+
+void GL_APIENTRY glGetIntegervContextANGLE(GLeglContext ctx, GLenum pname, GLint *data)
+{
+ return gl::GetIntegervContextANGLE(ctx, pname, data);
+}
+
+void GL_APIENTRY glGetInternalformativContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLint *params)
+{
+ return gl::GetInternalformativContextANGLE(ctx, target, internalformat, pname, bufSize, params);
+}
+
+void GL_APIENTRY glGetLightfvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetLightfvContextANGLE(ctx, light, pname, params);
+}
+
+void GL_APIENTRY glGetLightxvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ GLfixed *params)
+{
+ return gl::GetLightxvContextANGLE(ctx, light, pname, params);
+}
+
+void GL_APIENTRY glGetMaterialfvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetMaterialfvContextANGLE(ctx, face, pname, params);
+}
+
+void GL_APIENTRY glGetMaterialxvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ GLfixed *params)
+{
+ return gl::GetMaterialxvContextANGLE(ctx, face, pname, params);
+}
+
+void GL_APIENTRY glGetMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx,
+ GLuint memoryObject,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetMemoryObjectParameterivEXTContextANGLE(ctx, memoryObject, pname, params);
+}
+
+void GL_APIENTRY glGetMultisamplefvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val)
+{
+ return gl::GetMultisamplefvContextANGLE(ctx, pname, index, val);
+}
+
+void GL_APIENTRY glGetObjectLabelKHRContextANGLE(GLeglContext ctx,
+ GLenum identifier,
+ GLuint name,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ return gl::GetObjectLabelKHRContextANGLE(ctx, identifier, name, bufSize, length, label);
+}
+
+void GL_APIENTRY glGetObjectPtrLabelKHRContextANGLE(GLeglContext ctx,
+ const void *ptr,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *label)
+{
+ return gl::GetObjectPtrLabelKHRContextANGLE(ctx, ptr, bufSize, length, label);
+}
+
+void GL_APIENTRY glGetPointervContextANGLE(GLeglContext ctx, GLenum pname, void **params)
+{
+ return gl::GetPointervContextANGLE(ctx, pname, params);
+}
+
+void GL_APIENTRY glGetPointervKHRContextANGLE(GLeglContext ctx, GLenum pname, void **params)
+{
+ return gl::GetPointervKHRContextANGLE(ctx, pname, params);
+}
+
+void GL_APIENTRY glGetProgramBinaryContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ return gl::GetProgramBinaryContextANGLE(ctx, program, bufSize, length, binaryFormat, binary);
+}
+
+void GL_APIENTRY glGetProgramBinaryOESContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLenum *binaryFormat,
+ void *binary)
+{
+ return gl::GetProgramBinaryOESContextANGLE(ctx, program, bufSize, length, binaryFormat, binary);
+}
+
+void GL_APIENTRY glGetProgramInfoLogContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ return gl::GetProgramInfoLogContextANGLE(ctx, program, bufSize, length, infoLog);
+}
+
+void GL_APIENTRY glGetProgramInterfaceivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetProgramInterfaceivContextANGLE(ctx, program, programInterface, pname, params);
+}
+
+void GL_APIENTRY glGetProgramPipelineInfoLogContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ return gl::GetProgramPipelineInfoLogContextANGLE(ctx, pipeline, bufSize, length, infoLog);
+}
+
+void GL_APIENTRY glGetProgramPipelineivContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetProgramPipelineivContextANGLE(ctx, pipeline, pname, params);
+}
+
+GLuint GL_APIENTRY glGetProgramResourceIndexContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ return gl::GetProgramResourceIndexContextANGLE(ctx, program, programInterface, name);
+}
+
+GLint GL_APIENTRY glGetProgramResourceLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ return gl::GetProgramResourceLocationContextANGLE(ctx, program, programInterface, name);
+}
+
+GLint GL_APIENTRY glGetProgramResourceLocationIndexEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ const GLchar *name)
+{
+ return gl::GetProgramResourceLocationIndexEXTContextANGLE(ctx, program, programInterface, name);
+}
+
+void GL_APIENTRY glGetProgramResourceNameContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *name)
+{
+ return gl::GetProgramResourceNameContextANGLE(ctx, program, programInterface, index, bufSize,
+ length, name);
+}
+
+void GL_APIENTRY glGetProgramResourceivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLuint index,
+ GLsizei propCount,
+ const GLenum *props,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetProgramResourceivContextANGLE(ctx, program, programInterface, index, propCount,
+ props, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetProgramivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetProgramivContextANGLE(ctx, program, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjecti64vEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLint64 *params)
+{
+ return gl::GetQueryObjecti64vEXTContextANGLE(ctx, id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjectivEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetQueryObjectivEXTContextANGLE(ctx, id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjectui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint64 *params)
+{
+ return gl::GetQueryObjectui64vEXTContextANGLE(ctx, id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjectuivContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint *params)
+{
+ return gl::GetQueryObjectuivContextANGLE(ctx, id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryObjectuivEXTContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLuint *params)
+{
+ return gl::GetQueryObjectuivEXTContextANGLE(ctx, id, pname, params);
+}
+
+void GL_APIENTRY glGetQueryivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetQueryivContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetQueryivEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetQueryivEXTContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetRenderbufferParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetRenderbufferParameterivContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetRenderbufferParameterivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetRenderbufferParameterivOESContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterIivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetSamplerParameterIivOESContextANGLE(ctx, sampler, pname, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLuint *params)
+{
+ return gl::GetSamplerParameterIuivOESContextANGLE(ctx, sampler, pname, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterfvContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetSamplerParameterfvContextANGLE(ctx, sampler, pname, params);
+}
+
+void GL_APIENTRY glGetSamplerParameterivContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetSamplerParameterivContextANGLE(ctx, sampler, pname, params);
+}
+
+void GL_APIENTRY glGetSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum pname,
+ GLuint64 *params)
+{
+ return gl::GetSemaphoreParameterui64vEXTContextANGLE(ctx, semaphore, pname, params);
+}
+
+void GL_APIENTRY glGetShaderInfoLogContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *infoLog)
+{
+ return gl::GetShaderInfoLogContextANGLE(ctx, shader, bufSize, length, infoLog);
+}
+
+void GL_APIENTRY glGetShaderPrecisionFormatContextANGLE(GLeglContext ctx,
+ GLenum shadertype,
+ GLenum precisiontype,
+ GLint *range,
+ GLint *precision)
+{
+ return gl::GetShaderPrecisionFormatContextANGLE(ctx, shadertype, precisiontype, range,
+ precision);
+}
+
+void GL_APIENTRY glGetShaderSourceContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *source)
+{
+ return gl::GetShaderSourceContextANGLE(ctx, shader, bufSize, length, source);
+}
+
+void GL_APIENTRY glGetShaderivContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetShaderivContextANGLE(ctx, shader, pname, params);
+}
+
+const GLubyte *GL_APIENTRY glGetStringContextANGLE(GLeglContext ctx, GLenum name)
+{
+ return gl::GetStringContextANGLE(ctx, name);
+}
+
+const GLubyte *GL_APIENTRY glGetStringiContextANGLE(GLeglContext ctx, GLenum name, GLuint index)
+{
+ return gl::GetStringiContextANGLE(ctx, name, index);
+}
+
+void GL_APIENTRY glGetSyncivContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *values)
+{
+ return gl::GetSyncivContextANGLE(ctx, sync, pname, bufSize, length, values);
+}
+
+void GL_APIENTRY glGetTexEnvfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetTexEnvfvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTexEnvivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetTexEnvivContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTexEnvxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed *params)
+{
+ return gl::GetTexEnvxvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTexGenfvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetTexGenfvOESContextANGLE(ctx, coord, pname, params);
+}
+
+void GL_APIENTRY glGetTexGenivOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetTexGenivOESContextANGLE(ctx, coord, pname, params);
+}
+
+void GL_APIENTRY glGetTexGenxvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfixed *params)
+{
+ return gl::GetTexGenxvOESContextANGLE(ctx, coord, pname, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetTexLevelParameterfvContextANGLE(ctx, target, level, pname, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetTexLevelParameterivContextANGLE(ctx, target, level, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterIivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetTexParameterIivOESContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLuint *params)
+{
+ return gl::GetTexParameterIuivOESContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetTexParameterfvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetTexParameterivContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTexParameterxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed *params)
+{
+ return gl::GetTexParameterxvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glGetTransformFeedbackVaryingContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name)
+{
+ return gl::GetTransformFeedbackVaryingContextANGLE(ctx, program, index, bufSize, length, size,
+ type, name);
+}
+
+void GL_APIENTRY glGetTranslatedShaderSourceANGLEContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *source)
+{
+ return gl::GetTranslatedShaderSourceANGLEContextANGLE(ctx, shader, bufsize, length, source);
+}
+
+GLuint GL_APIENTRY glGetUniformBlockIndexContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *uniformBlockName)
+{
+ return gl::GetUniformBlockIndexContextANGLE(ctx, program, uniformBlockName);
+}
+
+void GL_APIENTRY glGetUniformIndicesContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices)
+{
+ return gl::GetUniformIndicesContextANGLE(ctx, program, uniformCount, uniformNames,
+ uniformIndices);
+}
+
+GLint GL_APIENTRY glGetUniformLocationContextANGLE(GLeglContext ctx,
+ GLuint program,
+ const GLchar *name)
+{
+ return gl::GetUniformLocationContextANGLE(ctx, program, name);
+}
+
+void GL_APIENTRY glGetUniformfvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat *params)
+{
+ return gl::GetUniformfvContextANGLE(ctx, program, location, params);
+}
+
+void GL_APIENTRY glGetUniformivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint *params)
+{
+ return gl::GetUniformivContextANGLE(ctx, program, location, params);
+}
+
+void GL_APIENTRY glGetUniformuivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint *params)
+{
+ return gl::GetUniformuivContextANGLE(ctx, program, location, params);
+}
+
+void GL_APIENTRY glGetUnsignedBytevEXTContextANGLE(GLeglContext ctx, GLenum pname, GLubyte *data)
+{
+ return gl::GetUnsignedBytevEXTContextANGLE(ctx, pname, data);
+}
+
+void GL_APIENTRY glGetUnsignedBytei_vEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLubyte *data)
+{
+ return gl::GetUnsignedBytei_vEXTContextANGLE(ctx, target, index, data);
+}
+
+void GL_APIENTRY glGetVertexAttribIivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetVertexAttribIivContextANGLE(ctx, index, pname, params);
+}
+
+void GL_APIENTRY glGetVertexAttribIuivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLuint *params)
+{
+ return gl::GetVertexAttribIuivContextANGLE(ctx, index, pname, params);
+}
+
+void GL_APIENTRY glGetVertexAttribPointervContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ void **pointer)
+{
+ return gl::GetVertexAttribPointervContextANGLE(ctx, index, pname, pointer);
+}
+
+void GL_APIENTRY glGetVertexAttribfvContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetVertexAttribfvContextANGLE(ctx, index, pname, params);
+}
+
+void GL_APIENTRY glGetVertexAttribivContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetVertexAttribivContextANGLE(ctx, index, pname, params);
+}
+
+void GL_APIENTRY glGetnUniformfvEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLfloat *params)
+{
+ return gl::GetnUniformfvEXTContextANGLE(ctx, program, location, bufSize, params);
+}
+
+void GL_APIENTRY glGetnUniformivEXTContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLint *params)
+{
+ return gl::GetnUniformivEXTContextANGLE(ctx, program, location, bufSize, params);
+}
+
+void GL_APIENTRY glHintContextANGLE(GLeglContext ctx, GLenum target, GLenum mode)
+{
+ return gl::HintContextANGLE(ctx, target, mode);
+}
+
+void GL_APIENTRY glImportMemoryFdEXTContextANGLE(GLeglContext ctx,
+ GLuint memory,
+ GLuint64 size,
+ GLenum handleType,
+ GLint fd)
+{
+ return gl::ImportMemoryFdEXTContextANGLE(ctx, memory, size, handleType, fd);
+}
+
+void GL_APIENTRY glImportSemaphoreFdEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum handleType,
+ GLint fd)
+{
+ return gl::ImportSemaphoreFdEXTContextANGLE(ctx, semaphore, handleType, fd);
+}
+
+void GL_APIENTRY glInsertEventMarkerEXTContextANGLE(GLeglContext ctx,
+ GLsizei length,
+ const GLchar *marker)
+{
+ return gl::InsertEventMarkerEXTContextANGLE(ctx, length, marker);
+}
+
+void GL_APIENTRY glInvalidateFramebufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ return gl::InvalidateFramebufferContextANGLE(ctx, target, numAttachments, attachments);
+}
+
+void GL_APIENTRY glInvalidateSubFramebufferContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei numAttachments,
+ const GLenum *attachments,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::InvalidateSubFramebufferContextANGLE(ctx, target, numAttachments, attachments, x, y,
+ width, height);
+}
+
+GLboolean GL_APIENTRY glIsBufferContextANGLE(GLeglContext ctx, GLuint buffer)
+{
+ return gl::IsBufferContextANGLE(ctx, buffer);
+}
+
+GLboolean GL_APIENTRY glIsEnabledContextANGLE(GLeglContext ctx, GLenum cap)
+{
+ return gl::IsEnabledContextANGLE(ctx, cap);
+}
+
+GLboolean GL_APIENTRY glIsFenceNVContextANGLE(GLeglContext ctx, GLuint fence)
+{
+ return gl::IsFenceNVContextANGLE(ctx, fence);
+}
+
+GLboolean GL_APIENTRY glIsFramebufferContextANGLE(GLeglContext ctx, GLuint framebuffer)
+{
+ return gl::IsFramebufferContextANGLE(ctx, framebuffer);
+}
+
+GLboolean GL_APIENTRY glIsFramebufferOESContextANGLE(GLeglContext ctx, GLuint framebuffer)
+{
+ return gl::IsFramebufferOESContextANGLE(ctx, framebuffer);
+}
+
+GLboolean GL_APIENTRY glIsMemoryObjectEXTContextANGLE(GLeglContext ctx, GLuint memoryObject)
+{
+ return gl::IsMemoryObjectEXTContextANGLE(ctx, memoryObject);
+}
+
+GLboolean GL_APIENTRY glIsProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ return gl::IsProgramContextANGLE(ctx, program);
+}
+
+GLboolean GL_APIENTRY glIsProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline)
+{
+ return gl::IsProgramPipelineContextANGLE(ctx, pipeline);
+}
+
+GLboolean GL_APIENTRY glIsQueryContextANGLE(GLeglContext ctx, GLuint id)
+{
+ return gl::IsQueryContextANGLE(ctx, id);
+}
+
+GLboolean GL_APIENTRY glIsQueryEXTContextANGLE(GLeglContext ctx, GLuint id)
+{
+ return gl::IsQueryEXTContextANGLE(ctx, id);
+}
+
+GLboolean GL_APIENTRY glIsRenderbufferContextANGLE(GLeglContext ctx, GLuint renderbuffer)
+{
+ return gl::IsRenderbufferContextANGLE(ctx, renderbuffer);
+}
+
+GLboolean GL_APIENTRY glIsRenderbufferOESContextANGLE(GLeglContext ctx, GLuint renderbuffer)
+{
+ return gl::IsRenderbufferOESContextANGLE(ctx, renderbuffer);
+}
+
+GLboolean GL_APIENTRY glIsSemaphoreEXTContextANGLE(GLeglContext ctx, GLuint semaphore)
+{
+ return gl::IsSemaphoreEXTContextANGLE(ctx, semaphore);
+}
+
+GLboolean GL_APIENTRY glIsSamplerContextANGLE(GLeglContext ctx, GLuint sampler)
+{
+ return gl::IsSamplerContextANGLE(ctx, sampler);
+}
+
+GLboolean GL_APIENTRY glIsShaderContextANGLE(GLeglContext ctx, GLuint shader)
+{
+ return gl::IsShaderContextANGLE(ctx, shader);
+}
+
+GLboolean GL_APIENTRY glIsSyncContextANGLE(GLeglContext ctx, GLsync sync)
+{
+ return gl::IsSyncContextANGLE(ctx, sync);
+}
+
+GLboolean GL_APIENTRY glIsTextureContextANGLE(GLeglContext ctx, GLuint texture)
+{
+ return gl::IsTextureContextANGLE(ctx, texture);
+}
+
+GLboolean GL_APIENTRY glIsTransformFeedbackContextANGLE(GLeglContext ctx, GLuint id)
+{
+ return gl::IsTransformFeedbackContextANGLE(ctx, id);
+}
+
+GLboolean GL_APIENTRY glIsVertexArrayContextANGLE(GLeglContext ctx, GLuint array)
+{
+ return gl::IsVertexArrayContextANGLE(ctx, array);
+}
+
+GLboolean GL_APIENTRY glIsVertexArrayOESContextANGLE(GLeglContext ctx, GLuint array)
+{
+ return gl::IsVertexArrayOESContextANGLE(ctx, array);
+}
+
+void GL_APIENTRY glLightModelfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param)
+{
+ return gl::LightModelfContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glLightModelfvContextANGLE(GLeglContext ctx, GLenum pname, const GLfloat *params)
+{
+ return gl::LightModelfvContextANGLE(ctx, pname, params);
+}
+
+void GL_APIENTRY glLightModelxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param)
+{
+ return gl::LightModelxContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glLightModelxvContextANGLE(GLeglContext ctx, GLenum pname, const GLfixed *param)
+{
+ return gl::LightModelxvContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glLightfContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfloat param)
+{
+ return gl::LightfContextANGLE(ctx, light, pname, param);
+}
+
+void GL_APIENTRY glLightfvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return gl::LightfvContextANGLE(ctx, light, pname, params);
+}
+
+void GL_APIENTRY glLightxContextANGLE(GLeglContext ctx, GLenum light, GLenum pname, GLfixed param)
+{
+ return gl::LightxContextANGLE(ctx, light, pname, param);
+}
+
+void GL_APIENTRY glLightxvContextANGLE(GLeglContext ctx,
+ GLenum light,
+ GLenum pname,
+ const GLfixed *params)
+{
+ return gl::LightxvContextANGLE(ctx, light, pname, params);
+}
+
+void GL_APIENTRY glLineWidthContextANGLE(GLeglContext ctx, GLfloat width)
+{
+ return gl::LineWidthContextANGLE(ctx, width);
+}
+
+void GL_APIENTRY glLineWidthxContextANGLE(GLeglContext ctx, GLfixed width)
+{
+ return gl::LineWidthxContextANGLE(ctx, width);
+}
+
+void GL_APIENTRY glLinkProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ return gl::LinkProgramContextANGLE(ctx, program);
+}
+
+void GL_APIENTRY glLoadIdentityContextANGLE(GLeglContext ctx)
+{
+ return gl::LoadIdentityContextANGLE(ctx);
+}
+
+void GL_APIENTRY glLoadMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m)
+{
+ return gl::LoadMatrixfContextANGLE(ctx, m);
+}
+
+void GL_APIENTRY glLoadMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m)
+{
+ return gl::LoadMatrixxContextANGLE(ctx, m);
+}
+
+void GL_APIENTRY glLoadPaletteFromModelViewMatrixOESContextANGLE(GLeglContext ctx)
+{
+ return gl::LoadPaletteFromModelViewMatrixOESContextANGLE(ctx);
+}
+
+void GL_APIENTRY glLogicOpContextANGLE(GLeglContext ctx, GLenum opcode)
+{
+ return gl::LogicOpContextANGLE(ctx, opcode);
+}
+
+void *GL_APIENTRY glMapBufferOESContextANGLE(GLeglContext ctx, GLenum target, GLenum access)
+{
+ return gl::MapBufferOESContextANGLE(ctx, target, access);
+}
+
+void *GL_APIENTRY glMapBufferRangeContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ return gl::MapBufferRangeContextANGLE(ctx, target, offset, length, access);
+}
+
+void *GL_APIENTRY glMapBufferRangeEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ return gl::MapBufferRangeEXTContextANGLE(ctx, target, offset, length, access);
+}
+
+void GL_APIENTRY glMaterialfContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfloat param)
+{
+ return gl::MaterialfContextANGLE(ctx, face, pname, param);
+}
+
+void GL_APIENTRY glMaterialfvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return gl::MaterialfvContextANGLE(ctx, face, pname, params);
+}
+
+void GL_APIENTRY glMaterialxContextANGLE(GLeglContext ctx, GLenum face, GLenum pname, GLfixed param)
+{
+ return gl::MaterialxContextANGLE(ctx, face, pname, param);
+}
+
+void GL_APIENTRY glMaterialxvContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum pname,
+ const GLfixed *param)
+{
+ return gl::MaterialxvContextANGLE(ctx, face, pname, param);
+}
+
+void GL_APIENTRY glMatrixIndexPointerOESContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::MatrixIndexPointerOESContextANGLE(ctx, size, type, stride, pointer);
+}
+
+void GL_APIENTRY glMatrixModeContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ return gl::MatrixModeContextANGLE(ctx, mode);
+}
+
+void GL_APIENTRY glMaxShaderCompilerThreadsKHRContextANGLE(GLeglContext ctx, GLuint count)
+{
+ return gl::MaxShaderCompilerThreadsKHRContextANGLE(ctx, count);
+}
+
+void GL_APIENTRY glMemoryBarrierContextANGLE(GLeglContext ctx, GLbitfield barriers)
+{
+ return gl::MemoryBarrierContextANGLE(ctx, barriers);
+}
+
+void GL_APIENTRY glMemoryBarrierByRegionContextANGLE(GLeglContext ctx, GLbitfield barriers)
+{
+ return gl::MemoryBarrierByRegionContextANGLE(ctx, barriers);
+}
+
+void GL_APIENTRY glMemoryObjectParameterivEXTContextANGLE(GLeglContext ctx,
+ GLuint memoryObject,
+ GLenum pname,
+ const GLint *params)
+{
+ return gl::MemoryObjectParameterivEXTContextANGLE(ctx, memoryObject, pname, params);
+}
+
+void GL_APIENTRY glMultMatrixfContextANGLE(GLeglContext ctx, const GLfloat *m)
+{
+ return gl::MultMatrixfContextANGLE(ctx, m);
+}
+
+void GL_APIENTRY glMultMatrixxContextANGLE(GLeglContext ctx, const GLfixed *m)
+{
+ return gl::MultMatrixxContextANGLE(ctx, m);
+}
+
+void GL_APIENTRY glMultiTexCoord4fContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLfloat s,
+ GLfloat t,
+ GLfloat r,
+ GLfloat q)
+{
+ return gl::MultiTexCoord4fContextANGLE(ctx, target, s, t, r, q);
+}
+
+void GL_APIENTRY glMultiTexCoord4xContextANGLE(GLeglContext ctx,
+ GLenum texture,
+ GLfixed s,
+ GLfixed t,
+ GLfixed r,
+ GLfixed q)
+{
+ return gl::MultiTexCoord4xContextANGLE(ctx, texture, s, t, r, q);
+}
+
+void GL_APIENTRY glNormal3fContextANGLE(GLeglContext ctx, GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ return gl::Normal3fContextANGLE(ctx, nx, ny, nz);
+}
+
+void GL_APIENTRY glNormal3xContextANGLE(GLeglContext ctx, GLfixed nx, GLfixed ny, GLfixed nz)
+{
+ return gl::Normal3xContextANGLE(ctx, nx, ny, nz);
+}
+
+void GL_APIENTRY glNormalPointerContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::NormalPointerContextANGLE(ctx, type, stride, pointer);
+}
+
+void GL_APIENTRY glObjectLabelKHRContextANGLE(GLeglContext ctx,
+ GLenum identifier,
+ GLuint name,
+ GLsizei length,
+ const GLchar *label)
+{
+ return gl::ObjectLabelKHRContextANGLE(ctx, identifier, name, length, label);
+}
+
+void GL_APIENTRY glObjectPtrLabelKHRContextANGLE(GLeglContext ctx,
+ const void *ptr,
+ GLsizei length,
+ const GLchar *label)
+{
+ return gl::ObjectPtrLabelKHRContextANGLE(ctx, ptr, length, label);
+}
+
+void GL_APIENTRY glOrthofContextANGLE(GLeglContext ctx,
+ GLfloat l,
+ GLfloat r,
+ GLfloat b,
+ GLfloat t,
+ GLfloat n,
+ GLfloat f)
+{
+ return gl::OrthofContextANGLE(ctx, l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glOrthoxContextANGLE(GLeglContext ctx,
+ GLfixed l,
+ GLfixed r,
+ GLfixed b,
+ GLfixed t,
+ GLfixed n,
+ GLfixed f)
+{
+ return gl::OrthoxContextANGLE(ctx, l, r, b, t, n, f);
+}
+
+void GL_APIENTRY glPauseTransformFeedbackContextANGLE(GLeglContext ctx)
+{
+ return gl::PauseTransformFeedbackContextANGLE(ctx);
+}
+
+void GL_APIENTRY glPixelStoreiContextANGLE(GLeglContext ctx, GLenum pname, GLint param)
+{
+ return gl::PixelStoreiContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glPointParameterfContextANGLE(GLeglContext ctx, GLenum pname, GLfloat param)
+{
+ return gl::PointParameterfContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glPointParameterfvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return gl::PointParameterfvContextANGLE(ctx, pname, params);
+}
+
+void GL_APIENTRY glPointParameterxContextANGLE(GLeglContext ctx, GLenum pname, GLfixed param)
+{
+ return gl::PointParameterxContextANGLE(ctx, pname, param);
+}
+
+void GL_APIENTRY glPointParameterxvContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ const GLfixed *params)
+{
+ return gl::PointParameterxvContextANGLE(ctx, pname, params);
+}
+
+void GL_APIENTRY glPointSizeContextANGLE(GLeglContext ctx, GLfloat size)
+{
+ return gl::PointSizeContextANGLE(ctx, size);
+}
+
+void GL_APIENTRY glPointSizePointerOESContextANGLE(GLeglContext ctx,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::PointSizePointerOESContextANGLE(ctx, type, stride, pointer);
+}
+
+void GL_APIENTRY glPointSizexContextANGLE(GLeglContext ctx, GLfixed size)
+{
+ return gl::PointSizexContextANGLE(ctx, size);
+}
+
+void GL_APIENTRY glPolygonOffsetContextANGLE(GLeglContext ctx, GLfloat factor, GLfloat units)
+{
+ return gl::PolygonOffsetContextANGLE(ctx, factor, units);
+}
+
+void GL_APIENTRY glPolygonOffsetxContextANGLE(GLeglContext ctx, GLfixed factor, GLfixed units)
+{
+ return gl::PolygonOffsetxContextANGLE(ctx, factor, units);
+}
+
+void GL_APIENTRY glPopDebugGroupKHRContextANGLE(GLeglContext ctx)
+{
+ return gl::PopDebugGroupKHRContextANGLE(ctx);
+}
+
+void GL_APIENTRY glPopGroupMarkerEXTContextANGLE(GLeglContext ctx)
+{
+ return gl::PopGroupMarkerEXTContextANGLE(ctx);
+}
+
+void GL_APIENTRY glPopMatrixContextANGLE(GLeglContext ctx)
+{
+ return gl::PopMatrixContextANGLE(ctx);
+}
+
+void GL_APIENTRY glProgramBinaryContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLsizei length)
+{
+ return gl::ProgramBinaryContextANGLE(ctx, program, binaryFormat, binary, length);
+}
+
+void GL_APIENTRY glProgramBinaryOESContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum binaryFormat,
+ const void *binary,
+ GLint length)
+{
+ return gl::ProgramBinaryOESContextANGLE(ctx, program, binaryFormat, binary, length);
+}
+
+void GL_APIENTRY glProgramParameteriContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLint value)
+{
+ return gl::ProgramParameteriContextANGLE(ctx, program, pname, value);
+}
+
+void GL_APIENTRY glProgramUniform1fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0)
+{
+ return gl::ProgramUniform1fContextANGLE(ctx, program, location, v0);
+}
+
+void GL_APIENTRY glProgramUniform1fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform1fvContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform1iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0)
+{
+ return gl::ProgramUniform1iContextANGLE(ctx, program, location, v0);
+}
+
+void GL_APIENTRY glProgramUniform1ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform1ivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform1uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0)
+{
+ return gl::ProgramUniform1uiContextANGLE(ctx, program, location, v0);
+}
+
+void GL_APIENTRY glProgramUniform1uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform1uivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform2fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1)
+{
+ return gl::ProgramUniform2fContextANGLE(ctx, program, location, v0, v1);
+}
+
+void GL_APIENTRY glProgramUniform2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform2fvContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY
+glProgramUniform2iContextANGLE(GLeglContext ctx, GLuint program, GLint location, GLint v0, GLint v1)
+{
+ return gl::ProgramUniform2iContextANGLE(ctx, program, location, v0, v1);
+}
+
+void GL_APIENTRY glProgramUniform2ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform2ivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform2uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1)
+{
+ return gl::ProgramUniform2uiContextANGLE(ctx, program, location, v0, v1);
+}
+
+void GL_APIENTRY glProgramUniform2uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform2uivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform3fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2)
+{
+ return gl::ProgramUniform3fContextANGLE(ctx, program, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glProgramUniform3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform3fvContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform3iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2)
+{
+ return gl::ProgramUniform3iContextANGLE(ctx, program, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glProgramUniform3ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform3ivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform3uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2)
+{
+ return gl::ProgramUniform3uiContextANGLE(ctx, program, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glProgramUniform3uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform3uivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform4fContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3)
+{
+ return gl::ProgramUniform4fContextANGLE(ctx, program, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glProgramUniform4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::ProgramUniform4fvContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform4iContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLint v0,
+ GLint v1,
+ GLint v2,
+ GLint v3)
+{
+ return gl::ProgramUniform4iContextANGLE(ctx, program, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glProgramUniform4ivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::ProgramUniform4ivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniform4uiContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3)
+{
+ return gl::ProgramUniform4uiContextANGLE(ctx, program, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glProgramUniform4uivContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::ProgramUniform4uivContextANGLE(ctx, program, location, count, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix2fvContextANGLE(ctx, program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix2x3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix2x3fvContextANGLE(ctx, program, location, count, transpose,
+ value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix2x4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix2x4fvContextANGLE(ctx, program, location, count, transpose,
+ value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix3fvContextANGLE(ctx, program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix3x2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix3x2fvContextANGLE(ctx, program, location, count, transpose,
+ value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix3x4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix3x4fvContextANGLE(ctx, program, location, count, transpose,
+ value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix4fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix4fvContextANGLE(ctx, program, location, count, transpose, value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix4x2fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix4x2fvContextANGLE(ctx, program, location, count, transpose,
+ value);
+}
+
+void GL_APIENTRY glProgramUniformMatrix4x3fvContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::ProgramUniformMatrix4x3fvContextANGLE(ctx, program, location, count, transpose,
+ value);
+}
+
+void GL_APIENTRY glPushDebugGroupKHRContextANGLE(GLeglContext ctx,
+ GLenum source,
+ GLuint id,
+ GLsizei length,
+ const GLchar *message)
+{
+ return gl::PushDebugGroupKHRContextANGLE(ctx, source, id, length, message);
+}
+
+void GL_APIENTRY glPushGroupMarkerEXTContextANGLE(GLeglContext ctx,
+ GLsizei length,
+ const GLchar *marker)
+{
+ return gl::PushGroupMarkerEXTContextANGLE(ctx, length, marker);
+}
+
+void GL_APIENTRY glPushMatrixContextANGLE(GLeglContext ctx)
+{
+ return gl::PushMatrixContextANGLE(ctx);
+}
+
+void GL_APIENTRY glQueryCounterEXTContextANGLE(GLeglContext ctx, GLuint id, GLenum target)
+{
+ return gl::QueryCounterEXTContextANGLE(ctx, id, target);
+}
+
+GLbitfield GL_APIENTRY glQueryMatrixxOESContextANGLE(GLeglContext ctx,
+ GLfixed *mantissa,
+ GLint *exponent)
+{
+ return gl::QueryMatrixxOESContextANGLE(ctx, mantissa, exponent);
+}
+
+void GL_APIENTRY glReadBufferContextANGLE(GLeglContext ctx, GLenum src)
+{
+ return gl::ReadBufferContextANGLE(ctx, src);
+}
+
+void GL_APIENTRY glReadPixelsContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ void *pixels)
+{
+ return gl::ReadPixelsContextANGLE(ctx, x, y, width, height, format, type, pixels);
+}
+
+void GL_APIENTRY glReadnPixelsEXTContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ void *data)
+{
+ return gl::ReadnPixelsEXTContextANGLE(ctx, x, y, width, height, format, type, bufSize, data);
+}
+
+void GL_APIENTRY glReleaseShaderCompilerContextANGLE(GLeglContext ctx)
+{
+ return gl::ReleaseShaderCompilerContextANGLE(ctx);
+}
+
+void GL_APIENTRY glRenderbufferStorageContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorageContextANGLE(ctx, target, internalformat, width, height);
+}
+
+void GL_APIENTRY glRenderbufferStorageMultisampleContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorageMultisampleContextANGLE(ctx, target, samples, internalformat,
+ width, height);
+}
+
+void GL_APIENTRY glRenderbufferStorageMultisampleANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorageMultisampleANGLEContextANGLE(ctx, target, samples, internalformat,
+ width, height);
+}
+
+void GL_APIENTRY glRenderbufferStorageOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::RenderbufferStorageOESContextANGLE(ctx, target, internalformat, width, height);
+}
+
+void GL_APIENTRY glResumeTransformFeedbackContextANGLE(GLeglContext ctx)
+{
+ return gl::ResumeTransformFeedbackContextANGLE(ctx);
+}
+
+void GL_APIENTRY
+glRotatefContextANGLE(GLeglContext ctx, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::RotatefContextANGLE(ctx, angle, x, y, z);
+}
+
+void GL_APIENTRY
+glRotatexContextANGLE(GLeglContext ctx, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+{
+ return gl::RotatexContextANGLE(ctx, angle, x, y, z);
+}
+
+void GL_APIENTRY glSampleCoverageContextANGLE(GLeglContext ctx, GLfloat value, GLboolean invert)
+{
+ return gl::SampleCoverageContextANGLE(ctx, value, invert);
+}
+
+void GL_APIENTRY glSampleCoveragexContextANGLE(GLeglContext ctx, GLclampx value, GLboolean invert)
+{
+ return gl::SampleCoveragexContextANGLE(ctx, value, invert);
+}
+
+void GL_APIENTRY glSampleMaskiContextANGLE(GLeglContext ctx, GLuint maskNumber, GLbitfield mask)
+{
+ return gl::SampleMaskiContextANGLE(ctx, maskNumber, mask);
+}
+
+void GL_APIENTRY glSamplerParameterIivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param)
+{
+ return gl::SamplerParameterIivOESContextANGLE(ctx, sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLuint *param)
+{
+ return gl::SamplerParameterIuivOESContextANGLE(ctx, sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameterfContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLfloat param)
+{
+ return gl::SamplerParameterfContextANGLE(ctx, sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameterfvContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLfloat *param)
+{
+ return gl::SamplerParameterfvContextANGLE(ctx, sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameteriContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLint param)
+{
+ return gl::SamplerParameteriContextANGLE(ctx, sampler, pname, param);
+}
+
+void GL_APIENTRY glSamplerParameterivContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ const GLint *param)
+{
+ return gl::SamplerParameterivContextANGLE(ctx, sampler, pname, param);
+}
+
+void GL_APIENTRY glScalefContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::ScalefContextANGLE(ctx, x, y, z);
+}
+
+void GL_APIENTRY glScalexContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z)
+{
+ return gl::ScalexContextANGLE(ctx, x, y, z);
+}
+
+void GL_APIENTRY
+glScissorContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ return gl::ScissorContextANGLE(ctx, x, y, width, height);
+}
+
+void GL_APIENTRY glSemaphoreParameterui64vEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLenum pname,
+ const GLuint64 *params)
+{
+ return gl::SemaphoreParameterui64vEXTContextANGLE(ctx, semaphore, pname, params);
+}
+
+void GL_APIENTRY glSetFenceNVContextANGLE(GLeglContext ctx, GLuint fence, GLenum condition)
+{
+ return gl::SetFenceNVContextANGLE(ctx, fence, condition);
+}
+
+void GL_APIENTRY glShadeModelContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ return gl::ShadeModelContextANGLE(ctx, mode);
+}
+
+void GL_APIENTRY glShaderBinaryContextANGLE(GLeglContext ctx,
+ GLsizei count,
+ const GLuint *shaders,
+ GLenum binaryformat,
+ const void *binary,
+ GLsizei length)
+{
+ return gl::ShaderBinaryContextANGLE(ctx, count, shaders, binaryformat, binary, length);
+}
+
+void GL_APIENTRY glShaderSourceContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLsizei count,
+ const GLchar *const *string,
+ const GLint *length)
+{
+ return gl::ShaderSourceContextANGLE(ctx, shader, count, string, length);
+}
+
+void GL_APIENTRY glSignalSemaphoreEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *dstLayouts)
+{
+ return gl::SignalSemaphoreEXTContextANGLE(ctx, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, dstLayouts);
+}
+
+void GL_APIENTRY glStencilFuncContextANGLE(GLeglContext ctx, GLenum func, GLint ref, GLuint mask)
+{
+ return gl::StencilFuncContextANGLE(ctx, func, ref, mask);
+}
+
+void GL_APIENTRY glStencilFuncSeparateContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum func,
+ GLint ref,
+ GLuint mask)
+{
+ return gl::StencilFuncSeparateContextANGLE(ctx, face, func, ref, mask);
+}
+
+void GL_APIENTRY glStencilMaskContextANGLE(GLeglContext ctx, GLuint mask)
+{
+ return gl::StencilMaskContextANGLE(ctx, mask);
+}
+
+void GL_APIENTRY glStencilMaskSeparateContextANGLE(GLeglContext ctx, GLenum face, GLuint mask)
+{
+ return gl::StencilMaskSeparateContextANGLE(ctx, face, mask);
+}
+
+void GL_APIENTRY glStencilOpContextANGLE(GLeglContext ctx, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ return gl::StencilOpContextANGLE(ctx, fail, zfail, zpass);
+}
+
+void GL_APIENTRY glStencilOpSeparateContextANGLE(GLeglContext ctx,
+ GLenum face,
+ GLenum sfail,
+ GLenum dpfail,
+ GLenum dppass)
+{
+ return gl::StencilOpSeparateContextANGLE(ctx, face, sfail, dpfail, dppass);
+}
+
+GLboolean GL_APIENTRY glTestFenceNVContextANGLE(GLeglContext ctx, GLuint fence)
+{
+ return gl::TestFenceNVContextANGLE(ctx, fence);
+}
+
+void GL_APIENTRY glTexCoordPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::TexCoordPointerContextANGLE(ctx, size, type, stride, pointer);
+}
+
+void GL_APIENTRY glTexEnvfContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfloat param)
+{
+ return gl::TexEnvfContextANGLE(ctx, target, pname, param);
+}
+
+void GL_APIENTRY glTexEnvfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return gl::TexEnvfvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexEnviContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLint param)
+{
+ return gl::TexEnviContextANGLE(ctx, target, pname, param);
+}
+
+void GL_APIENTRY glTexEnvivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ return gl::TexEnvivContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexEnvxContextANGLE(GLeglContext ctx, GLenum target, GLenum pname, GLfixed param)
+{
+ return gl::TexEnvxContextANGLE(ctx, target, pname, param);
+}
+
+void GL_APIENTRY glTexEnvxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfixed *params)
+{
+ return gl::TexEnvxvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexGenfOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfloat param)
+{
+ return gl::TexGenfOESContextANGLE(ctx, coord, pname, param);
+}
+
+void GL_APIENTRY glTexGenfvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return gl::TexGenfvOESContextANGLE(ctx, coord, pname, params);
+}
+
+void GL_APIENTRY glTexGeniOESContextANGLE(GLeglContext ctx, GLenum coord, GLenum pname, GLint param)
+{
+ return gl::TexGeniOESContextANGLE(ctx, coord, pname, param);
+}
+
+void GL_APIENTRY glTexGenivOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLint *params)
+{
+ return gl::TexGenivOESContextANGLE(ctx, coord, pname, params);
+}
+
+void GL_APIENTRY glTexGenxOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ GLfixed param)
+{
+ return gl::TexGenxOESContextANGLE(ctx, coord, pname, param);
+}
+
+void GL_APIENTRY glTexGenxvOESContextANGLE(GLeglContext ctx,
+ GLenum coord,
+ GLenum pname,
+ const GLfixed *params)
+{
+ return gl::TexGenxvOESContextANGLE(ctx, coord, pname, params);
+}
+
+void GL_APIENTRY glTexImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexImage2DContextANGLE(ctx, target, level, internalformat, width, height, border,
+ format, type, pixels);
+}
+
+void GL_APIENTRY glTexImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexImage3DContextANGLE(ctx, target, level, internalformat, width, height, depth,
+ border, format, type, pixels);
+}
+
+void GL_APIENTRY glTexImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexImage3DOESContextANGLE(ctx, target, level, internalformat, width, height, depth,
+ border, format, type, pixels);
+}
+
+void GL_APIENTRY glTexParameterIivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ return gl::TexParameterIivOESContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexParameterIuivOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLuint *params)
+{
+ return gl::TexParameterIuivOESContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexParameterfContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat param)
+{
+ return gl::TexParameterfContextANGLE(ctx, target, pname, param);
+}
+
+void GL_APIENTRY glTexParameterfvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ return gl::TexParameterfvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexParameteriContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLint param)
+{
+ return gl::TexParameteriContextANGLE(ctx, target, pname, param);
+}
+
+void GL_APIENTRY glTexParameterivContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLint *params)
+{
+ return gl::TexParameterivContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexParameterxContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLfixed param)
+{
+ return gl::TexParameterxContextANGLE(ctx, target, pname, param);
+}
+
+void GL_APIENTRY glTexParameterxvContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfixed *params)
+{
+ return gl::TexParameterxvContextANGLE(ctx, target, pname, params);
+}
+
+void GL_APIENTRY glTexStorage1DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width)
+{
+ return gl::TexStorage1DEXTContextANGLE(ctx, target, levels, internalformat, width);
+}
+
+void GL_APIENTRY glTexStorage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::TexStorage2DContextANGLE(ctx, target, levels, internalformat, width, height);
+}
+
+void GL_APIENTRY glTexStorage2DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+{
+ return gl::TexStorage2DEXTContextANGLE(ctx, target, levels, internalformat, width, height);
+}
+
+void GL_APIENTRY glTexStorage2DMultisampleContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ return gl::TexStorage2DMultisampleContextANGLE(ctx, target, samples, internalformat, width,
+ height, fixedsamplelocations);
+}
+
+void GL_APIENTRY glTexStorage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ return gl::TexStorage3DContextANGLE(ctx, target, levels, internalformat, width, height, depth);
+}
+
+void GL_APIENTRY glTexStorage3DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth)
+{
+ return gl::TexStorage3DEXTContextANGLE(ctx, target, levels, internalformat, width, height,
+ depth);
+}
+
+void GL_APIENTRY glTexStorage3DMultisampleOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedsamplelocations)
+{
+ return gl::TexStorage3DMultisampleOESContextANGLE(ctx, target, samples, internalformat, width,
+ height, depth, fixedsamplelocations);
+}
+
+void GL_APIENTRY glTexStorageMem2DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem2DEXTContextANGLE(ctx, target, levels, internalFormat, width, height,
+ memory, offset);
+}
+
+void GL_APIENTRY glTexStorageMem2DMultisampleEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem2DMultisampleEXTContextANGLE(
+ ctx, target, samples, internalFormat, width, height, fixedSampleLocations, memory, offset);
+}
+
+void GL_APIENTRY glTexStorageMem3DEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei levels,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem3DEXTContextANGLE(ctx, target, levels, internalFormat, width, height,
+ depth, memory, offset);
+}
+
+void GL_APIENTRY glTexStorageMem3DMultisampleEXTContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalFormat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLboolean fixedSampleLocations,
+ GLuint memory,
+ GLuint64 offset)
+{
+ return gl::TexStorageMem3DMultisampleEXTContextANGLE(ctx, target, samples, internalFormat,
+ width, height, depth, fixedSampleLocations,
+ memory, offset);
+}
+
+void GL_APIENTRY glTexSubImage2DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexSubImage2DContextANGLE(ctx, target, level, xoffset, yoffset, width, height,
+ format, type, pixels);
+}
+
+void GL_APIENTRY glTexSubImage3DContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexSubImage3DContextANGLE(ctx, target, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels);
+}
+
+void GL_APIENTRY glTexSubImage3DOESContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ const void *pixels)
+{
+ return gl::TexSubImage3DOESContextANGLE(ctx, target, level, xoffset, yoffset, zoffset, width,
+ height, depth, format, type, pixels);
+}
+
+void GL_APIENTRY glTransformFeedbackVaryingsContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ return gl::TransformFeedbackVaryingsContextANGLE(ctx, program, count, varyings, bufferMode);
+}
+
+void GL_APIENTRY glTranslatefContextANGLE(GLeglContext ctx, GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::TranslatefContextANGLE(ctx, x, y, z);
+}
+
+void GL_APIENTRY glTranslatexContextANGLE(GLeglContext ctx, GLfixed x, GLfixed y, GLfixed z)
+{
+ return gl::TranslatexContextANGLE(ctx, x, y, z);
+}
+
+void GL_APIENTRY glUniform1fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0)
+{
+ return gl::Uniform1fContextANGLE(ctx, location, v0);
+}
+
+void GL_APIENTRY glUniform1fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::Uniform1fvContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniform1iContextANGLE(GLeglContext ctx, GLint location, GLint v0)
+{
+ return gl::Uniform1iContextANGLE(ctx, location, v0);
+}
+
+void GL_APIENTRY glUniform1ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::Uniform1ivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniform1uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0)
+{
+ return gl::Uniform1uiContextANGLE(ctx, location, v0);
+}
+
+void GL_APIENTRY glUniform1uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::Uniform1uivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniform2fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1)
+{
+ return gl::Uniform2fContextANGLE(ctx, location, v0, v1);
+}
+
+void GL_APIENTRY glUniform2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::Uniform2fvContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniform2iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1)
+{
+ return gl::Uniform2iContextANGLE(ctx, location, v0, v1);
+}
+
+void GL_APIENTRY glUniform2ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::Uniform2ivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniform2uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1)
+{
+ return gl::Uniform2uiContextANGLE(ctx, location, v0, v1);
+}
+
+void GL_APIENTRY glUniform2uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::Uniform2uivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY
+glUniform3fContextANGLE(GLeglContext ctx, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
+{
+ return gl::Uniform3fContextANGLE(ctx, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glUniform3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::Uniform3fvContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY
+glUniform3iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2)
+{
+ return gl::Uniform3iContextANGLE(ctx, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glUniform3ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::Uniform3ivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY
+glUniform3uiContextANGLE(GLeglContext ctx, GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ return gl::Uniform3uiContextANGLE(ctx, location, v0, v1, v2);
+}
+
+void GL_APIENTRY glUniform3uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::Uniform3uivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniform4fContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLfloat v0,
+ GLfloat v1,
+ GLfloat v2,
+ GLfloat v3)
+{
+ return gl::Uniform4fContextANGLE(ctx, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glUniform4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLfloat *value)
+{
+ return gl::Uniform4fvContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY
+glUniform4iContextANGLE(GLeglContext ctx, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
+{
+ return gl::Uniform4iContextANGLE(ctx, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glUniform4ivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLint *value)
+{
+ return gl::Uniform4ivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniform4uiContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3)
+{
+ return gl::Uniform4uiContextANGLE(ctx, location, v0, v1, v2, v3);
+}
+
+void GL_APIENTRY glUniform4uivContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ const GLuint *value)
+{
+ return gl::Uniform4uivContextANGLE(ctx, location, count, value);
+}
+
+void GL_APIENTRY glUniformBlockBindingContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding)
+{
+ return gl::UniformBlockBindingContextANGLE(ctx, program, uniformBlockIndex,
+ uniformBlockBinding);
+}
+
+void GL_APIENTRY glUniformMatrix2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix2fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix2x3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix2x3fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix2x4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix2x4fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix3fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix3x2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix3x2fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix3x4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix3x4fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix4fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix4fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix4x2fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix4x2fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+void GL_APIENTRY glUniformMatrix4x3fvContextANGLE(GLeglContext ctx,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ return gl::UniformMatrix4x3fvContextANGLE(ctx, location, count, transpose, value);
+}
+
+GLboolean GL_APIENTRY glUnmapBufferContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::UnmapBufferContextANGLE(ctx, target);
+}
+
+GLboolean GL_APIENTRY glUnmapBufferOESContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::UnmapBufferOESContextANGLE(ctx, target);
+}
+
+void GL_APIENTRY glUseProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ return gl::UseProgramContextANGLE(ctx, program);
+}
+
+void GL_APIENTRY glUseProgramStagesContextANGLE(GLeglContext ctx,
+ GLuint pipeline,
+ GLbitfield stages,
+ GLuint program)
+{
+ return gl::UseProgramStagesContextANGLE(ctx, pipeline, stages, program);
+}
+
+void GL_APIENTRY glValidateProgramContextANGLE(GLeglContext ctx, GLuint program)
+{
+ return gl::ValidateProgramContextANGLE(ctx, program);
+}
+
+void GL_APIENTRY glValidateProgramPipelineContextANGLE(GLeglContext ctx, GLuint pipeline)
+{
+ return gl::ValidateProgramPipelineContextANGLE(ctx, pipeline);
+}
+
+void GL_APIENTRY glVertexAttrib1fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x)
+{
+ return gl::VertexAttrib1fContextANGLE(ctx, index, x);
+}
+
+void GL_APIENTRY glVertexAttrib1fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib1fvContextANGLE(ctx, index, v);
+}
+
+void GL_APIENTRY glVertexAttrib2fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y)
+{
+ return gl::VertexAttrib2fContextANGLE(ctx, index, x, y);
+}
+
+void GL_APIENTRY glVertexAttrib2fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib2fvContextANGLE(ctx, index, v);
+}
+
+void GL_APIENTRY
+glVertexAttrib3fContextANGLE(GLeglContext ctx, GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+ return gl::VertexAttrib3fContextANGLE(ctx, index, x, y, z);
+}
+
+void GL_APIENTRY glVertexAttrib3fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib3fvContextANGLE(ctx, index, v);
+}
+
+void GL_APIENTRY glVertexAttrib4fContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w)
+{
+ return gl::VertexAttrib4fContextANGLE(ctx, index, x, y, z, w);
+}
+
+void GL_APIENTRY glVertexAttrib4fvContextANGLE(GLeglContext ctx, GLuint index, const GLfloat *v)
+{
+ return gl::VertexAttrib4fvContextANGLE(ctx, index, v);
+}
+
+void GL_APIENTRY glVertexAttribBindingContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLuint bindingindex)
+{
+ return gl::VertexAttribBindingContextANGLE(ctx, attribindex, bindingindex);
+}
+
+void GL_APIENTRY glVertexAttribDivisorContextANGLE(GLeglContext ctx, GLuint index, GLuint divisor)
+{
+ return gl::VertexAttribDivisorContextANGLE(ctx, index, divisor);
+}
+
+void GL_APIENTRY glVertexAttribDivisorANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint divisor)
+{
+ return gl::VertexAttribDivisorANGLEContextANGLE(ctx, index, divisor);
+}
+
+void GL_APIENTRY glVertexAttribDivisorEXTContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint divisor)
+{
+ return gl::VertexAttribDivisorEXTContextANGLE(ctx, index, divisor);
+}
+
+void GL_APIENTRY glVertexAttribFormatContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLuint relativeoffset)
+{
+ return gl::VertexAttribFormatContextANGLE(ctx, attribindex, size, type, normalized,
+ relativeoffset);
+}
+
+void GL_APIENTRY
+glVertexAttribI4iContextANGLE(GLeglContext ctx, GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+ return gl::VertexAttribI4iContextANGLE(ctx, index, x, y, z, w);
+}
+
+void GL_APIENTRY glVertexAttribI4ivContextANGLE(GLeglContext ctx, GLuint index, const GLint *v)
+{
+ return gl::VertexAttribI4ivContextANGLE(ctx, index, v);
+}
+
+void GL_APIENTRY glVertexAttribI4uiContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLuint x,
+ GLuint y,
+ GLuint z,
+ GLuint w)
+{
+ return gl::VertexAttribI4uiContextANGLE(ctx, index, x, y, z, w);
+}
+
+void GL_APIENTRY glVertexAttribI4uivContextANGLE(GLeglContext ctx, GLuint index, const GLuint *v)
+{
+ return gl::VertexAttribI4uivContextANGLE(ctx, index, v);
+}
+
+void GL_APIENTRY glVertexAttribIFormatContextANGLE(GLeglContext ctx,
+ GLuint attribindex,
+ GLint size,
+ GLenum type,
+ GLuint relativeoffset)
+{
+ return gl::VertexAttribIFormatContextANGLE(ctx, attribindex, size, type, relativeoffset);
+}
+
+void GL_APIENTRY glVertexAttribIPointerContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::VertexAttribIPointerContextANGLE(ctx, index, size, type, stride, pointer);
+}
+
+void GL_APIENTRY glVertexAttribPointerContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::VertexAttribPointerContextANGLE(ctx, index, size, type, normalized, stride, pointer);
+}
+
+void GL_APIENTRY glVertexBindingDivisorContextANGLE(GLeglContext ctx,
+ GLuint bindingindex,
+ GLuint divisor)
+{
+ return gl::VertexBindingDivisorContextANGLE(ctx, bindingindex, divisor);
+}
+
+void GL_APIENTRY glVertexPointerContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::VertexPointerContextANGLE(ctx, size, type, stride, pointer);
+}
+
+void GL_APIENTRY
+glViewportContextANGLE(GLeglContext ctx, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ return gl::ViewportContextANGLE(ctx, x, y, width, height);
+}
+
+void GL_APIENTRY glWaitSemaphoreEXTContextANGLE(GLeglContext ctx,
+ GLuint semaphore,
+ GLuint numBufferBarriers,
+ const GLuint *buffers,
+ GLuint numTextureBarriers,
+ const GLuint *textures,
+ const GLenum *srcLayouts)
+{
+ return gl::WaitSemaphoreEXTContextANGLE(ctx, semaphore, numBufferBarriers, buffers,
+ numTextureBarriers, textures, srcLayouts);
+}
+
+void GL_APIENTRY glWaitSyncContextANGLE(GLeglContext ctx,
+ GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout)
+{
+ return gl::WaitSyncContextANGLE(ctx, sync, flags, timeout);
+}
+
+void GL_APIENTRY glWeightPointerOESContextANGLE(GLeglContext ctx,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ const void *pointer)
+{
+ return gl::WeightPointerOESContextANGLE(ctx, size, type, stride, pointer);
+}
+
+void GL_APIENTRY glBindUniformLocationCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ const GLchar *name)
+{
+ return gl::BindUniformLocationCHROMIUMContextANGLE(ctx, program, location, name);
+}
+
+void GL_APIENTRY glCoverageModulationCHROMIUMContextANGLE(GLeglContext ctx, GLenum components)
+{
+ return gl::CoverageModulationCHROMIUMContextANGLE(ctx, components);
+}
+
+void GL_APIENTRY glMatrixLoadfCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum matrixMode,
+ const GLfloat *matrix)
+{
+ return gl::MatrixLoadfCHROMIUMContextANGLE(ctx, matrixMode, matrix);
+}
+
+void GL_APIENTRY glMatrixLoadIdentityCHROMIUMContextANGLE(GLeglContext ctx, GLenum matrixMode)
+{
+ return gl::MatrixLoadIdentityCHROMIUMContextANGLE(ctx, matrixMode);
+}
+
+GLuint GL_APIENTRY glGenPathsCHROMIUMContextANGLE(GLeglContext ctx, GLsizei range)
+{
+ return gl::GenPathsCHROMIUMContextANGLE(ctx, range);
+}
+
+void GL_APIENTRY glDeletePathsCHROMIUMContextANGLE(GLeglContext ctx, GLuint first, GLsizei range)
+{
+ return gl::DeletePathsCHROMIUMContextANGLE(ctx, first, range);
+}
+
+GLboolean GL_APIENTRY glIsPathCHROMIUMContextANGLE(GLeglContext ctx, GLuint path)
+{
+ return gl::IsPathCHROMIUMContextANGLE(ctx, path);
+}
+
+void GL_APIENTRY glPathCommandsCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLsizei numCommands,
+ const GLubyte *commands,
+ GLsizei numCoords,
+ GLenum coordType,
+ const void *coords)
+{
+ return gl::PathCommandsCHROMIUMContextANGLE(ctx, path, numCommands, commands, numCoords,
+ coordType, coords);
+}
+
+void GL_APIENTRY glPathParameterfCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLfloat value)
+{
+ return gl::PathParameterfCHROMIUMContextANGLE(ctx, path, pname, value);
+}
+
+void GL_APIENTRY glPathParameteriCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLint value)
+{
+ return gl::PathParameteriCHROMIUMContextANGLE(ctx, path, pname, value);
+}
+
+void GL_APIENTRY glGetPathParameterfvCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLfloat *value)
+{
+ return gl::GetPathParameterfvCHROMIUMContextANGLE(ctx, path, pname, value);
+}
+
+void GL_APIENTRY glGetPathParameterivCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum pname,
+ GLint *value)
+{
+ return gl::GetPathParameterivCHROMIUMContextANGLE(ctx, path, pname, value);
+}
+
+void GL_APIENTRY glPathStencilFuncCHROMIUMContextANGLE(GLeglContext ctx,
+ GLenum func,
+ GLint ref,
+ GLuint mask)
+{
+ return gl::PathStencilFuncCHROMIUMContextANGLE(ctx, func, ref, mask);
+}
+
+void GL_APIENTRY glStencilFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask)
+{
+ return gl::StencilFillPathCHROMIUMContextANGLE(ctx, path, fillMode, mask);
+}
+
+void GL_APIENTRY glStencilStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLint reference,
+ GLuint mask)
+{
+ return gl::StencilStrokePathCHROMIUMContextANGLE(ctx, path, reference, mask);
+}
+
+void GL_APIENTRY glCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum coverMode)
+{
+ return gl::CoverFillPathCHROMIUMContextANGLE(ctx, path, coverMode);
+}
+
+void GL_APIENTRY glCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum coverMode)
+{
+ return gl::CoverStrokePathCHROMIUMContextANGLE(ctx, path, coverMode);
+}
+
+void GL_APIENTRY glStencilThenCoverFillPathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode)
+{
+ return gl::StencilThenCoverFillPathCHROMIUMContextANGLE(ctx, path, fillMode, mask, coverMode);
+}
+
+void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint path,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode)
+{
+ return gl::StencilThenCoverStrokePathCHROMIUMContextANGLE(ctx, path, reference, mask,
+ coverMode);
+}
+
+void GL_APIENTRY glCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::CoverFillPathInstancedCHROMIUMContextANGLE(
+ ctx, numPath, pathNameType, paths, pathBase, coverMode, transformType, transformValues);
+}
+
+void GL_APIENTRY glCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::CoverStrokePathInstancedCHROMIUMContextANGLE(
+ ctx, numPath, pathNameType, paths, pathBase, coverMode, transformType, transformValues);
+}
+
+void GL_APIENTRY glStencilStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPath,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilStrokePathInstancedCHROMIUMContextANGLE(ctx, numPath, pathNameType, paths,
+ pathBase, reference, mask,
+ transformType, transformValues);
+}
+
+void GL_APIENTRY glStencilFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilFillPathInstancedCHROMIUMContextANGLE(ctx, numPaths, pathNameType, paths,
+ pathBase, fillMode, mask, transformType,
+ transformValues);
+}
+
+void GL_APIENTRY
+glStencilThenCoverFillPathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLenum fillMode,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilThenCoverFillPathInstancedCHROMIUMContextANGLE(
+ ctx, numPaths, pathNameType, paths, pathBase, fillMode, mask, coverMode, transformType,
+ transformValues);
+}
+
+void GL_APIENTRY
+glStencilThenCoverStrokePathInstancedCHROMIUMContextANGLE(GLeglContext ctx,
+ GLsizei numPaths,
+ GLenum pathNameType,
+ const void *paths,
+ GLuint pathBase,
+ GLint reference,
+ GLuint mask,
+ GLenum coverMode,
+ GLenum transformType,
+ const GLfloat *transformValues)
+{
+ return gl::StencilThenCoverStrokePathInstancedCHROMIUMContextANGLE(
+ ctx, numPaths, pathNameType, paths, pathBase, reference, mask, coverMode, transformType,
+ transformValues);
+}
+
+void GL_APIENTRY glBindFragmentInputLocationCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint programs,
+ GLint location,
+ const GLchar *name)
+{
+ return gl::BindFragmentInputLocationCHROMIUMContextANGLE(ctx, programs, location, name);
+}
+
+void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLenum genMode,
+ GLint components,
+ const GLfloat *coeffs)
+{
+ return gl::ProgramPathFragmentInputGenCHROMIUMContextANGLE(ctx, program, location, genMode,
+ components, coeffs);
+}
+
+void GL_APIENTRY glCopyTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopyTextureCHROMIUMContextANGLE(ctx, sourceId, sourceLevel, destTarget, destId,
+ destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+}
+
+void GL_APIENTRY glCopySubTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLint width,
+ GLint height,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopySubTextureCHROMIUMContextANGLE(
+ ctx, sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x, y, width,
+ height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+}
+
+void GL_APIENTRY glCompressedCopyTextureCHROMIUMContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLuint destId)
+{
+ return gl::CompressedCopyTextureCHROMIUMContextANGLE(ctx, sourceId, destId);
+}
+
+void GL_APIENTRY glRequestExtensionANGLEContextANGLE(GLeglContext ctx, const GLchar *name)
+{
+ return gl::RequestExtensionANGLEContextANGLE(ctx, name);
+}
+
+void GL_APIENTRY glGetBooleanvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *params)
+{
+ return gl::GetBooleanvRobustANGLEContextANGLE(ctx, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetBufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetBufferParameterivRobustANGLEContextANGLE(ctx, target, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetFloatvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetFloatvRobustANGLEContextANGLE(ctx, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetFramebufferAttachmentParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum attachment,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetFramebufferAttachmentParameterivRobustANGLEContextANGLE(
+ ctx, target, attachment, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetIntegervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ return gl::GetIntegervRobustANGLEContextANGLE(ctx, pname, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetProgramivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetProgramivRobustANGLEContextANGLE(ctx, program, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetRenderbufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetRenderbufferParameterivRobustANGLEContextANGLE(ctx, target, pname, bufSize,
+ length, params);
+}
+
+void GL_APIENTRY glGetShaderivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint shader,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetShaderivRobustANGLEContextANGLE(ctx, shader, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetTexParameterfvRobustANGLEContextANGLE(ctx, target, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetTexParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetTexParameterivRobustANGLEContextANGLE(ctx, target, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetUniformfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetUniformfvRobustANGLEContextANGLE(ctx, program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetUniformivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetUniformivRobustANGLEContextANGLE(ctx, program, location, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetVertexAttribfvRobustANGLEContextANGLE(ctx, index, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetVertexAttribivRobustANGLEContextANGLE(ctx, index, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribPointervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **pointer)
+{
+ return gl::GetVertexAttribPointervRobustANGLEContextANGLE(ctx, index, pname, bufSize, length,
+ pointer);
+}
+
+void GL_APIENTRY glReadPixelsRobustANGLEContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *pixels)
+{
+ return gl::ReadPixelsRobustANGLEContextANGLE(ctx, x, y, width, height, format, type, bufSize,
+ length, columns, rows, pixels);
+}
+
+void GL_APIENTRY glTexImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexImage2DRobustANGLEContextANGLE(ctx, target, level, internalformat, width, height,
+ border, format, type, bufSize, pixels);
+}
+
+void GL_APIENTRY glTexParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *params)
+{
+ return gl::TexParameterfvRobustANGLEContextANGLE(ctx, target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glTexParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ return gl::TexParameterivRobustANGLEContextANGLE(ctx, target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexSubImage2DRobustANGLEContextANGLE(ctx, target, level, xoffset, yoffset, width,
+ height, format, type, bufSize, pixels);
+}
+
+void GL_APIENTRY glTexImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexImage3DRobustANGLEContextANGLE(ctx, target, level, internalformat, width, height,
+ depth, border, format, type, bufSize, pixels);
+}
+
+void GL_APIENTRY glTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ const void *pixels)
+{
+ return gl::TexSubImage3DRobustANGLEContextANGLE(ctx, target, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type, bufSize,
+ pixels);
+}
+
+void GL_APIENTRY glCompressedTexImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexImage2DRobustANGLEContextANGLE(
+ ctx, target, level, internalformat, width, height, border, imageSize, dataSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage2DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLsizei xoffset,
+ GLsizei yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexSubImage2DRobustANGLEContextANGLE(
+ ctx, target, level, xoffset, yoffset, width, height, format, imageSize, dataSize, data);
+}
+
+void GL_APIENTRY glCompressedTexImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexImage3DRobustANGLEContextANGLE(ctx, target, level, internalformat,
+ width, height, depth, border, imageSize,
+ dataSize, data);
+}
+
+void GL_APIENTRY glCompressedTexSubImage3DRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ GLsizei dataSize,
+ const GLvoid *data)
+{
+ return gl::CompressedTexSubImage3DRobustANGLEContextANGLE(ctx, target, level, xoffset, yoffset,
+ zoffset, width, height, depth, format,
+ imageSize, dataSize, data);
+}
+
+void GL_APIENTRY glGetQueryivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetQueryivRobustANGLEContextANGLE(ctx, target, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetQueryObjectuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetQueryObjectuivRobustANGLEContextANGLE(ctx, id, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetBufferPointervRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ return gl::GetBufferPointervRobustANGLEContextANGLE(ctx, target, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetIntegeri_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *data)
+{
+ return gl::GetIntegeri_vRobustANGLEContextANGLE(ctx, target, index, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetInternalformativRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum internalformat,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetInternalformativRobustANGLEContextANGLE(ctx, target, internalformat, pname,
+ bufSize, length, params);
+}
+
+void GL_APIENTRY glGetVertexAttribIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetVertexAttribIivRobustANGLEContextANGLE(ctx, index, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetVertexAttribIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint index,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetVertexAttribIuivRobustANGLEContextANGLE(ctx, index, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetUniformuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetUniformuivRobustANGLEContextANGLE(ctx, program, location, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetActiveUniformBlockivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetActiveUniformBlockivRobustANGLEContextANGLE(ctx, program, uniformBlockIndex,
+ pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetInteger64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ return gl::GetInteger64vRobustANGLEContextANGLE(ctx, pname, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetInteger64i_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *data)
+{
+ return gl::GetInteger64i_vRobustANGLEContextANGLE(ctx, target, index, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetBufferParameteri64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ return gl::GetBufferParameteri64vRobustANGLEContextANGLE(ctx, target, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLuint pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ return gl::SamplerParameterivRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLfloat *param)
+{
+ return gl::SamplerParameterfvRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glGetSamplerParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetSamplerParameterivRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetSamplerParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetSamplerParameterfvRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetFramebufferParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetFramebufferParameterivRobustANGLEContextANGLE(ctx, sampler, pname, bufSize,
+ length, params);
+}
+
+void GL_APIENTRY glGetProgramInterfaceivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLenum programInterface,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetProgramInterfaceivRobustANGLEContextANGLE(ctx, program, programInterface, pname,
+ bufSize, length, params);
+}
+
+void GL_APIENTRY glGetBooleani_vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLboolean *data)
+{
+ return gl::GetBooleani_vRobustANGLEContextANGLE(ctx, target, index, bufSize, length, data);
+}
+
+void GL_APIENTRY glGetMultisamplefvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *val)
+{
+ return gl::GetMultisamplefvRobustANGLEContextANGLE(ctx, pname, index, bufSize, length, val);
+}
+
+void GL_APIENTRY glGetTexLevelParameterivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetTexLevelParameterivRobustANGLEContextANGLE(ctx, target, level, pname, bufSize,
+ length, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameterfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetTexLevelParameterfvRobustANGLEContextANGLE(ctx, target, level, pname, bufSize,
+ length, params);
+}
+
+void GL_APIENTRY glGetPointervRobustANGLERobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ void **params)
+{
+ return gl::GetPointervRobustANGLERobustANGLEContextANGLE(ctx, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glReadnPixelsRobustANGLEContextANGLE(GLeglContext ctx,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *columns,
+ GLsizei *rows,
+ void *data)
+{
+ return gl::ReadnPixelsRobustANGLEContextANGLE(ctx, x, y, width, height, format, type, bufSize,
+ length, columns, rows, data);
+}
+
+void GL_APIENTRY glGetnUniformfvRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLfloat *params)
+{
+ return gl::GetnUniformfvRobustANGLEContextANGLE(ctx, program, location, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetnUniformivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetnUniformivRobustANGLEContextANGLE(ctx, program, location, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetnUniformuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint program,
+ GLint location,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetnUniformuivRobustANGLEContextANGLE(ctx, program, location, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *params)
+{
+ return gl::TexParameterIivRobustANGLEContextANGLE(ctx, target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *params)
+{
+ return gl::TexParameterIuivRobustANGLEContextANGLE(ctx, target, pname, bufSize, params);
+}
+
+void GL_APIENTRY glGetTexParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetTexParameterIivRobustANGLEContextANGLE(ctx, target, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetTexParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetTexParameterIuivRobustANGLEContextANGLE(ctx, target, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLint *param)
+{
+ return gl::SamplerParameterIivRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ const GLuint *param)
+{
+ return gl::SamplerParameterIuivRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, param);
+}
+
+void GL_APIENTRY glGetSamplerParameterIivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetSamplerParameterIivRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetSamplerParameterIuivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint sampler,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint *params)
+{
+ return gl::GetSamplerParameterIuivRobustANGLEContextANGLE(ctx, sampler, pname, bufSize, length,
+ params);
+}
+
+void GL_APIENTRY glGetQueryObjectivRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint *params)
+{
+ return gl::GetQueryObjectivRobustANGLEContextANGLE(ctx, id, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetQueryObjecti64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLint64 *params)
+{
+ return gl::GetQueryObjecti64vRobustANGLEContextANGLE(ctx, id, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glGetQueryObjectui64vRobustANGLEContextANGLE(GLeglContext ctx,
+ GLuint id,
+ GLenum pname,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLuint64 *params)
+{
+ return gl::GetQueryObjectui64vRobustANGLEContextANGLE(ctx, id, pname, bufSize, length, params);
+}
+
+void GL_APIENTRY glCopyTexture3DANGLEContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint internalFormat,
+ GLenum destType,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopyTexture3DANGLEContextANGLE(ctx, sourceId, sourceLevel, destTarget, destId,
+ destLevel, internalFormat, destType, unpackFlipY,
+ unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+}
+
+void GL_APIENTRY glCopySubTexture3DANGLEContextANGLE(GLeglContext ctx,
+ GLuint sourceId,
+ GLint sourceLevel,
+ GLenum destTarget,
+ GLuint destId,
+ GLint destLevel,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint width,
+ GLint height,
+ GLint depth,
+ GLboolean unpackFlipY,
+ GLboolean unpackPremultiplyAlpha,
+ GLboolean unpackUnmultiplyAlpha)
+{
+ return gl::CopySubTexture3DANGLEContextANGLE(
+ ctx, sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, zoffset, x, y,
+ z, width, height, depth, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
+}
+
+void GL_APIENTRY glTexStorage2DMultisampleANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLsizei samples,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLboolean fixedsamplelocations)
+{
+ return gl::TexStorage2DMultisampleANGLEContextANGLE(ctx, target, samples, internalformat, width,
+ height, fixedsamplelocations);
+}
+
+void GL_APIENTRY glGetTexLevelParameterivANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLint *params)
+{
+ return gl::GetTexLevelParameterivANGLEContextANGLE(ctx, target, level, pname, params);
+}
+
+void GL_APIENTRY glGetTexLevelParameterfvANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLenum pname,
+ GLfloat *params)
+{
+ return gl::GetTexLevelParameterfvANGLEContextANGLE(ctx, target, level, pname, params);
+}
+
+void GL_APIENTRY glMultiDrawArraysANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawArraysANGLEContextANGLE(ctx, mode, firsts, counts, drawcount);
+}
+
+void GL_APIENTRY glMultiDrawArraysInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLint *firsts,
+ const GLsizei *counts,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawArraysInstancedANGLEContextANGLE(ctx, mode, firsts, counts, instanceCounts,
+ drawcount);
+}
+
+void GL_APIENTRY glMultiDrawElementsANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawElementsANGLEContextANGLE(ctx, mode, counts, type, indices, drawcount);
+}
+
+void GL_APIENTRY glMultiDrawElementsInstancedANGLEContextANGLE(GLeglContext ctx,
+ GLenum mode,
+ const GLsizei *counts,
+ GLenum type,
+ const GLvoid *const *indices,
+ const GLsizei *instanceCounts,
+ GLsizei drawcount)
+{
+ return gl::MultiDrawElementsInstancedANGLEContextANGLE(ctx, mode, counts, type, indices,
+ instanceCounts, drawcount);
+}
+
+void GL_APIENTRY glGetMultisamplefvANGLEContextANGLE(GLeglContext ctx,
+ GLenum pname,
+ GLuint index,
+ GLfloat *val)
+{
+ return gl::GetMultisamplefvANGLEContextANGLE(ctx, pname, index, val);
+}
+
+void GL_APIENTRY glSampleMaskiANGLEContextANGLE(GLeglContext ctx,
+ GLuint maskNumber,
+ GLbitfield mask)
+{
+ return gl::SampleMaskiANGLEContextANGLE(ctx, maskNumber, mask);
+}
+
+void GL_APIENTRY glProvokingVertexANGLEContextANGLE(GLeglContext ctx, GLenum mode)
+{
+ return gl::ProvokingVertexANGLEContextANGLE(ctx, mode);
+}
+
+void GL_APIENTRY glLoseContextCHROMIUMContextANGLE(GLeglContext ctx, GLenum current, GLenum other)
+{
+ return gl::LoseContextCHROMIUMContextANGLE(ctx, current, other);
+}
+
+void GL_APIENTRY glTexImage2DExternalANGLEContextANGLE(GLeglContext ctx,
+ GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type)
+{
+ return gl::TexImage2DExternalANGLEContextANGLE(ctx, target, level, internalformat, width,
+ height, border, format, type);
+}
+
+void GL_APIENTRY glInvalidateTextureANGLEContextANGLE(GLeglContext ctx, GLenum target)
+{
+ return gl::InvalidateTextureANGLEContextANGLE(ctx, target);
+}
+
+} // extern "C"
diff --git a/gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.def b/gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.def
new file mode 100644
index 0000000000..803a8022e4
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/libGLESv2_autogen.def
@@ -0,0 +1,1572 @@
+; GENERATED FILE - DO NOT EDIT.
+; Generated by generate_entry_points.py using data from Khronos and ANGLE XML files.
+;
+; Copyright 2019 The ANGLE Project Authors. All rights reserved.
+; Use of this source code is governed by a BSD-style license that can be
+; found in the LICENSE file.
+LIBRARY libGLESv2
+EXPORTS
+
+ ; OpenGL ES 2.0
+ glActiveTexture
+ glAttachShader
+ glBindAttribLocation
+ glBindBuffer
+ glBindFramebuffer
+ glBindRenderbuffer
+ glBindTexture
+ glBlendColor
+ glBlendEquation
+ glBlendEquationSeparate
+ glBlendFunc
+ glBlendFuncSeparate
+ glBufferData
+ glBufferSubData
+ glCheckFramebufferStatus
+ glClear
+ glClearColor
+ glClearDepthf
+ glClearStencil
+ glColorMask
+ glCompileShader
+ glCompressedTexImage2D
+ glCompressedTexSubImage2D
+ glCopyTexImage2D
+ glCopyTexSubImage2D
+ glCreateProgram
+ glCreateShader
+ glCullFace
+ glDeleteBuffers
+ glDeleteFramebuffers
+ glDeleteProgram
+ glDeleteRenderbuffers
+ glDeleteShader
+ glDeleteTextures
+ glDepthFunc
+ glDepthMask
+ glDepthRangef
+ glDetachShader
+ glDisable
+ glDisableVertexAttribArray
+ glDrawArrays
+ glDrawElements
+ glEnable
+ glEnableVertexAttribArray
+ glFinish
+ glFlush
+ glFramebufferRenderbuffer
+ glFramebufferTexture2D
+ glFrontFace
+ glGenBuffers
+ glGenFramebuffers
+ glGenRenderbuffers
+ glGenTextures
+ glGenerateMipmap
+ glGetActiveAttrib
+ glGetActiveUniform
+ glGetAttachedShaders
+ glGetAttribLocation
+ glGetBooleanv
+ glGetBufferParameteriv
+ glGetError
+ glGetFloatv
+ glGetFramebufferAttachmentParameteriv
+ glGetIntegerv
+ glGetProgramInfoLog
+ glGetProgramiv
+ glGetRenderbufferParameteriv
+ glGetShaderInfoLog
+ glGetShaderPrecisionFormat
+ glGetShaderSource
+ glGetShaderiv
+ glGetString
+ glGetTexParameterfv
+ glGetTexParameteriv
+ glGetUniformLocation
+ glGetUniformfv
+ glGetUniformiv
+ glGetVertexAttribPointerv
+ glGetVertexAttribfv
+ glGetVertexAttribiv
+ glHint
+ glIsBuffer
+ glIsEnabled
+ glIsFramebuffer
+ glIsProgram
+ glIsRenderbuffer
+ glIsShader
+ glIsTexture
+ glLineWidth
+ glLinkProgram
+ glPixelStorei
+ glPolygonOffset
+ glReadPixels
+ glReleaseShaderCompiler
+ glRenderbufferStorage
+ glSampleCoverage
+ glScissor
+ glShaderBinary
+ glShaderSource
+ glStencilFunc
+ glStencilFuncSeparate
+ glStencilMask
+ glStencilMaskSeparate
+ glStencilOp
+ glStencilOpSeparate
+ glTexImage2D
+ glTexParameterf
+ glTexParameterfv
+ glTexParameteri
+ glTexParameteriv
+ glTexSubImage2D
+ glUniform1f
+ glUniform1fv
+ glUniform1i
+ glUniform1iv
+ glUniform2f
+ glUniform2fv
+ glUniform2i
+ glUniform2iv
+ glUniform3f
+ glUniform3fv
+ glUniform3i
+ glUniform3iv
+ glUniform4f
+ glUniform4fv
+ glUniform4i
+ glUniform4iv
+ glUniformMatrix2fv
+ glUniformMatrix3fv
+ glUniformMatrix4fv
+ glUseProgram
+ glValidateProgram
+ glVertexAttrib1f
+ glVertexAttrib1fv
+ glVertexAttrib2f
+ glVertexAttrib2fv
+ glVertexAttrib3f
+ glVertexAttrib3fv
+ glVertexAttrib4f
+ glVertexAttrib4fv
+ glVertexAttribPointer
+ glViewport
+
+ ; OpenGL ES 3.0
+ glBeginQuery
+ glBeginTransformFeedback
+ glBindBufferBase
+ glBindBufferRange
+ glBindSampler
+ glBindTransformFeedback
+ glBindVertexArray
+ glBlitFramebuffer
+ glClearBufferfi
+ glClearBufferfv
+ glClearBufferiv
+ glClearBufferuiv
+ glClientWaitSync
+ glCompressedTexImage3D
+ glCompressedTexSubImage3D
+ glCopyBufferSubData
+ glCopyTexSubImage3D
+ glDeleteQueries
+ glDeleteSamplers
+ glDeleteSync
+ glDeleteTransformFeedbacks
+ glDeleteVertexArrays
+ glDrawArraysInstanced
+ glDrawBuffers
+ glDrawElementsInstanced
+ glDrawRangeElements
+ glEndQuery
+ glEndTransformFeedback
+ glFenceSync
+ glFlushMappedBufferRange
+ glFramebufferTextureLayer
+ glGenQueries
+ glGenSamplers
+ glGenTransformFeedbacks
+ glGenVertexArrays
+ glGetActiveUniformBlockName
+ glGetActiveUniformBlockiv
+ glGetActiveUniformsiv
+ glGetBufferParameteri64v
+ glGetBufferPointerv
+ glGetFragDataLocation
+ glGetInteger64i_v
+ glGetInteger64v
+ glGetIntegeri_v
+ glGetInternalformativ
+ glGetProgramBinary
+ glGetQueryObjectuiv
+ glGetQueryiv
+ glGetSamplerParameterfv
+ glGetSamplerParameteriv
+ glGetStringi
+ glGetSynciv
+ glGetTransformFeedbackVarying
+ glGetUniformBlockIndex
+ glGetUniformIndices
+ glGetUniformuiv
+ glGetVertexAttribIiv
+ glGetVertexAttribIuiv
+ glInvalidateFramebuffer
+ glInvalidateSubFramebuffer
+ glIsQuery
+ glIsSampler
+ glIsSync
+ glIsTransformFeedback
+ glIsVertexArray
+ glMapBufferRange
+ glPauseTransformFeedback
+ glProgramBinary
+ glProgramParameteri
+ glReadBuffer
+ glRenderbufferStorageMultisample
+ glResumeTransformFeedback
+ glSamplerParameterf
+ glSamplerParameterfv
+ glSamplerParameteri
+ glSamplerParameteriv
+ glTexImage3D
+ glTexStorage2D
+ glTexStorage3D
+ glTexSubImage3D
+ glTransformFeedbackVaryings
+ glUniform1ui
+ glUniform1uiv
+ glUniform2ui
+ glUniform2uiv
+ glUniform3ui
+ glUniform3uiv
+ glUniform4ui
+ glUniform4uiv
+ glUniformBlockBinding
+ glUniformMatrix2x3fv
+ glUniformMatrix2x4fv
+ glUniformMatrix3x2fv
+ glUniformMatrix3x4fv
+ glUniformMatrix4x2fv
+ glUniformMatrix4x3fv
+ glUnmapBuffer
+ glVertexAttribDivisor
+ glVertexAttribI4i
+ glVertexAttribI4iv
+ glVertexAttribI4ui
+ glVertexAttribI4uiv
+ glVertexAttribIPointer
+ glWaitSync
+
+ ; OpenGL ES 3.1
+ glActiveShaderProgram
+ glBindImageTexture
+ glBindProgramPipeline
+ glBindVertexBuffer
+ glCreateShaderProgramv
+ glDeleteProgramPipelines
+ glDispatchCompute
+ glDispatchComputeIndirect
+ glDrawArraysIndirect
+ glDrawElementsIndirect
+ glFramebufferParameteri
+ glGenProgramPipelines
+ glGetBooleani_v
+ glGetFramebufferParameteriv
+ glGetMultisamplefv
+ glGetProgramInterfaceiv
+ glGetProgramPipelineInfoLog
+ glGetProgramPipelineiv
+ glGetProgramResourceIndex
+ glGetProgramResourceLocation
+ glGetProgramResourceName
+ glGetProgramResourceiv
+ glGetTexLevelParameterfv
+ glGetTexLevelParameteriv
+ glIsProgramPipeline
+ glMemoryBarrier
+ glMemoryBarrierByRegion
+ glProgramUniform1f
+ glProgramUniform1fv
+ glProgramUniform1i
+ glProgramUniform1iv
+ glProgramUniform1ui
+ glProgramUniform1uiv
+ glProgramUniform2f
+ glProgramUniform2fv
+ glProgramUniform2i
+ glProgramUniform2iv
+ glProgramUniform2ui
+ glProgramUniform2uiv
+ glProgramUniform3f
+ glProgramUniform3fv
+ glProgramUniform3i
+ glProgramUniform3iv
+ glProgramUniform3ui
+ glProgramUniform3uiv
+ glProgramUniform4f
+ glProgramUniform4fv
+ glProgramUniform4i
+ glProgramUniform4iv
+ glProgramUniform4ui
+ glProgramUniform4uiv
+ glProgramUniformMatrix2fv
+ glProgramUniformMatrix2x3fv
+ glProgramUniformMatrix2x4fv
+ glProgramUniformMatrix3fv
+ glProgramUniformMatrix3x2fv
+ glProgramUniformMatrix3x4fv
+ glProgramUniformMatrix4fv
+ glProgramUniformMatrix4x2fv
+ glProgramUniformMatrix4x3fv
+ glSampleMaski
+ glTexStorage2DMultisample
+ glUseProgramStages
+ glValidateProgramPipeline
+ glVertexAttribBinding
+ glVertexAttribFormat
+ glVertexAttribIFormat
+ glVertexBindingDivisor
+
+ ; OpenGL ES 1.0
+ glAlphaFunc
+ glAlphaFuncx
+ glClearColorx
+ glClearDepthx
+ glClientActiveTexture
+ glClipPlanef
+ glClipPlanex
+ glColor4f
+ glColor4ub
+ glColor4x
+ glColorPointer
+ glDepthRangex
+ glDisableClientState
+ glEnableClientState
+ glFogf
+ glFogfv
+ glFogx
+ glFogxv
+ glFrustumf
+ glFrustumx
+ glGetClipPlanef
+ glGetClipPlanex
+ glGetFixedv
+ glGetLightfv
+ glGetLightxv
+ glGetMaterialfv
+ glGetMaterialxv
+ glGetPointerv
+ glGetTexEnvfv
+ glGetTexEnviv
+ glGetTexEnvxv
+ glGetTexParameterxv
+ glLightModelf
+ glLightModelfv
+ glLightModelx
+ glLightModelxv
+ glLightf
+ glLightfv
+ glLightx
+ glLightxv
+ glLineWidthx
+ glLoadIdentity
+ glLoadMatrixf
+ glLoadMatrixx
+ glLogicOp
+ glMaterialf
+ glMaterialfv
+ glMaterialx
+ glMaterialxv
+ glMatrixMode
+ glMultMatrixf
+ glMultMatrixx
+ glMultiTexCoord4f
+ glMultiTexCoord4x
+ glNormal3f
+ glNormal3x
+ glNormalPointer
+ glOrthof
+ glOrthox
+ glPointParameterf
+ glPointParameterfv
+ glPointParameterx
+ glPointParameterxv
+ glPointSize
+ glPointSizex
+ glPolygonOffsetx
+ glPopMatrix
+ glPushMatrix
+ glRotatef
+ glRotatex
+ glSampleCoveragex
+ glScalef
+ glScalex
+ glShadeModel
+ glTexCoordPointer
+ glTexEnvf
+ glTexEnvfv
+ glTexEnvi
+ glTexEnviv
+ glTexEnvx
+ glTexEnvxv
+ glTexParameterx
+ glTexParameterxv
+ glTranslatef
+ glTranslatex
+ glVertexPointer
+
+ ; GL_ANGLE_copy_texture_3d
+ glCopySubTexture3DANGLE
+ glCopyTexture3DANGLE
+
+ ; GL_ANGLE_framebuffer_blit
+ glBlitFramebufferANGLE
+
+ ; GL_ANGLE_framebuffer_multisample
+ glRenderbufferStorageMultisampleANGLE
+
+ ; GL_ANGLE_instanced_arrays
+ glDrawArraysInstancedANGLE
+ glDrawElementsInstancedANGLE
+ glVertexAttribDivisorANGLE
+
+ ; GL_ANGLE_multi_draw
+ glMultiDrawArraysANGLE
+ glMultiDrawArraysInstancedANGLE
+ glMultiDrawElementsANGLE
+ glMultiDrawElementsInstancedANGLE
+
+ ; GL_ANGLE_provoking_vertex
+ glProvokingVertexANGLE
+
+ ; GL_ANGLE_request_extension
+ glRequestExtensionANGLE
+
+ ; GL_ANGLE_robust_client_memory
+ glCompressedTexImage2DRobustANGLE
+ glCompressedTexImage3DRobustANGLE
+ glCompressedTexSubImage2DRobustANGLE
+ glCompressedTexSubImage3DRobustANGLE
+ glGetActiveUniformBlockivRobustANGLE
+ glGetBooleani_vRobustANGLE
+ glGetBooleanvRobustANGLE
+ glGetBufferParameteri64vRobustANGLE
+ glGetBufferParameterivRobustANGLE
+ glGetBufferPointervRobustANGLE
+ glGetFloatvRobustANGLE
+ glGetFramebufferAttachmentParameterivRobustANGLE
+ glGetFramebufferParameterivRobustANGLE
+ glGetInteger64i_vRobustANGLE
+ glGetInteger64vRobustANGLE
+ glGetIntegeri_vRobustANGLE
+ glGetIntegervRobustANGLE
+ glGetInternalformativRobustANGLE
+ glGetMultisamplefvRobustANGLE
+ glGetPointervRobustANGLERobustANGLE
+ glGetProgramInterfaceivRobustANGLE
+ glGetProgramivRobustANGLE
+ glGetQueryObjecti64vRobustANGLE
+ glGetQueryObjectivRobustANGLE
+ glGetQueryObjectui64vRobustANGLE
+ glGetQueryObjectuivRobustANGLE
+ glGetQueryivRobustANGLE
+ glGetRenderbufferParameterivRobustANGLE
+ glGetSamplerParameterIivRobustANGLE
+ glGetSamplerParameterIuivRobustANGLE
+ glGetSamplerParameterfvRobustANGLE
+ glGetSamplerParameterivRobustANGLE
+ glGetShaderivRobustANGLE
+ glGetTexLevelParameterfvRobustANGLE
+ glGetTexLevelParameterivRobustANGLE
+ glGetTexParameterIivRobustANGLE
+ glGetTexParameterIuivRobustANGLE
+ glGetTexParameterfvRobustANGLE
+ glGetTexParameterivRobustANGLE
+ glGetUniformfvRobustANGLE
+ glGetUniformivRobustANGLE
+ glGetUniformuivRobustANGLE
+ glGetVertexAttribIivRobustANGLE
+ glGetVertexAttribIuivRobustANGLE
+ glGetVertexAttribPointervRobustANGLE
+ glGetVertexAttribfvRobustANGLE
+ glGetVertexAttribivRobustANGLE
+ glGetnUniformfvRobustANGLE
+ glGetnUniformivRobustANGLE
+ glGetnUniformuivRobustANGLE
+ glReadPixelsRobustANGLE
+ glReadnPixelsRobustANGLE
+ glSamplerParameterIivRobustANGLE
+ glSamplerParameterIuivRobustANGLE
+ glSamplerParameterfvRobustANGLE
+ glSamplerParameterivRobustANGLE
+ glTexImage2DRobustANGLE
+ glTexImage3DRobustANGLE
+ glTexParameterIivRobustANGLE
+ glTexParameterIuivRobustANGLE
+ glTexParameterfvRobustANGLE
+ glTexParameterivRobustANGLE
+ glTexSubImage2DRobustANGLE
+ glTexSubImage3DRobustANGLE
+
+ ; GL_ANGLE_texture_external_update
+ glInvalidateTextureANGLE
+ glTexImage2DExternalANGLE
+
+ ; GL_ANGLE_texture_multisample
+ glGetMultisamplefvANGLE
+ glGetTexLevelParameterfvANGLE
+ glGetTexLevelParameterivANGLE
+ glSampleMaskiANGLE
+ glTexStorage2DMultisampleANGLE
+
+ ; GL_ANGLE_translated_shader_source
+ glGetTranslatedShaderSourceANGLE
+
+ ; GL_CHROMIUM_bind_uniform_location
+ glBindUniformLocationCHROMIUM
+
+ ; GL_CHROMIUM_copy_compressed_texture
+ glCompressedCopyTextureCHROMIUM
+
+ ; GL_CHROMIUM_copy_texture
+ glCopySubTextureCHROMIUM
+ glCopyTextureCHROMIUM
+
+ ; GL_CHROMIUM_framebuffer_mixed_samples
+ glCoverageModulationCHROMIUM
+ glMatrixLoadIdentityCHROMIUM
+ glMatrixLoadfCHROMIUM
+
+ ; GL_CHROMIUM_lose_context
+ glLoseContextCHROMIUM
+
+ ; GL_CHROMIUM_path_rendering
+ glBindFragmentInputLocationCHROMIUM
+ glCoverFillPathCHROMIUM
+ glCoverFillPathInstancedCHROMIUM
+ glCoverStrokePathCHROMIUM
+ glCoverStrokePathInstancedCHROMIUM
+ glDeletePathsCHROMIUM
+ glGenPathsCHROMIUM
+ glGetPathParameterfvCHROMIUM
+ glGetPathParameterivCHROMIUM
+ glIsPathCHROMIUM
+ glPathCommandsCHROMIUM
+ glPathParameterfCHROMIUM
+ glPathParameteriCHROMIUM
+ glPathStencilFuncCHROMIUM
+ glProgramPathFragmentInputGenCHROMIUM
+ glStencilFillPathCHROMIUM
+ glStencilFillPathInstancedCHROMIUM
+ glStencilStrokePathCHROMIUM
+ glStencilStrokePathInstancedCHROMIUM
+ glStencilThenCoverFillPathCHROMIUM
+ glStencilThenCoverFillPathInstancedCHROMIUM
+ glStencilThenCoverStrokePathCHROMIUM
+ glStencilThenCoverStrokePathInstancedCHROMIUM
+
+ ; GL_EXT_blend_func_extended
+ glBindFragDataLocationEXT
+ glBindFragDataLocationIndexedEXT
+ glGetFragDataIndexEXT
+ glGetProgramResourceLocationIndexEXT
+
+ ; GL_EXT_debug_marker
+ glInsertEventMarkerEXT
+ glPopGroupMarkerEXT
+ glPushGroupMarkerEXT
+
+ ; GL_EXT_discard_framebuffer
+ glDiscardFramebufferEXT
+
+ ; GL_EXT_disjoint_timer_query
+ glBeginQueryEXT
+ glDeleteQueriesEXT
+ glEndQueryEXT
+ glGenQueriesEXT
+ glGetQueryObjecti64vEXT
+ glGetQueryObjectivEXT
+ glGetQueryObjectui64vEXT
+ glGetQueryObjectuivEXT
+ glGetQueryivEXT
+ glIsQueryEXT
+ glQueryCounterEXT
+
+ ; GL_EXT_draw_buffers
+ glDrawBuffersEXT
+
+ ; GL_EXT_geometry_shader
+ glFramebufferTextureEXT
+
+ ; GL_EXT_instanced_arrays
+ glDrawArraysInstancedEXT
+ glDrawElementsInstancedEXT
+ glVertexAttribDivisorEXT
+
+ ; GL_EXT_map_buffer_range
+ glFlushMappedBufferRangeEXT
+ glMapBufferRangeEXT
+
+ ; GL_EXT_memory_object
+ glBufferStorageMemEXT
+ glCreateMemoryObjectsEXT
+ glDeleteMemoryObjectsEXT
+ glGetMemoryObjectParameterivEXT
+ glGetUnsignedBytei_vEXT
+ glGetUnsignedBytevEXT
+ glIsMemoryObjectEXT
+ glMemoryObjectParameterivEXT
+ glTexStorageMem2DEXT
+ glTexStorageMem2DMultisampleEXT
+ glTexStorageMem3DEXT
+ glTexStorageMem3DMultisampleEXT
+
+ ; GL_EXT_memory_object_fd
+ glImportMemoryFdEXT
+
+ ; GL_EXT_occlusion_query_boolean
+
+ ; GL_EXT_robustness
+ glGetGraphicsResetStatusEXT
+ glGetnUniformfvEXT
+ glGetnUniformivEXT
+ glReadnPixelsEXT
+
+ ; GL_EXT_semaphore
+ glDeleteSemaphoresEXT
+ glGenSemaphoresEXT
+ glGetSemaphoreParameterui64vEXT
+ glIsSemaphoreEXT
+ glSemaphoreParameterui64vEXT
+ glSignalSemaphoreEXT
+ glWaitSemaphoreEXT
+
+ ; GL_EXT_semaphore_fd
+ glImportSemaphoreFdEXT
+
+ ; GL_EXT_texture_storage
+ glTexStorage1DEXT
+ glTexStorage2DEXT
+ glTexStorage3DEXT
+
+ ; GL_KHR_debug
+ glDebugMessageCallbackKHR
+ glDebugMessageControlKHR
+ glDebugMessageInsertKHR
+ glGetDebugMessageLogKHR
+ glGetObjectLabelKHR
+ glGetObjectPtrLabelKHR
+ glGetPointervKHR
+ glObjectLabelKHR
+ glObjectPtrLabelKHR
+ glPopDebugGroupKHR
+ glPushDebugGroupKHR
+
+ ; GL_KHR_parallel_shader_compile
+ glMaxShaderCompilerThreadsKHR
+
+ ; GL_NV_fence
+ glDeleteFencesNV
+ glFinishFenceNV
+ glGenFencesNV
+ glGetFenceivNV
+ glIsFenceNV
+ glSetFenceNV
+ glTestFenceNV
+
+ ; GL_OES_EGL_image
+ glEGLImageTargetRenderbufferStorageOES
+ glEGLImageTargetTexture2DOES
+
+ ; GL_OES_draw_texture
+ glDrawTexfOES
+ glDrawTexfvOES
+ glDrawTexiOES
+ glDrawTexivOES
+ glDrawTexsOES
+ glDrawTexsvOES
+ glDrawTexxOES
+ glDrawTexxvOES
+
+ ; GL_OES_framebuffer_object
+ glBindFramebufferOES
+ glBindRenderbufferOES
+ glCheckFramebufferStatusOES
+ glDeleteFramebuffersOES
+ glDeleteRenderbuffersOES
+ glFramebufferRenderbufferOES
+ glFramebufferTexture2DOES
+ glGenFramebuffersOES
+ glGenRenderbuffersOES
+ glGenerateMipmapOES
+ glGetFramebufferAttachmentParameterivOES
+ glGetRenderbufferParameterivOES
+ glIsFramebufferOES
+ glIsRenderbufferOES
+ glRenderbufferStorageOES
+
+ ; GL_OES_get_program_binary
+ glGetProgramBinaryOES
+ glProgramBinaryOES
+
+ ; GL_OES_mapbuffer
+ glGetBufferPointervOES
+ glMapBufferOES
+ glUnmapBufferOES
+
+ ; GL_OES_matrix_palette
+ glCurrentPaletteMatrixOES
+ glLoadPaletteFromModelViewMatrixOES
+ glMatrixIndexPointerOES
+ glWeightPointerOES
+
+ ; GL_OES_point_size_array
+ glPointSizePointerOES
+
+ ; GL_OES_query_matrix
+ glQueryMatrixxOES
+
+ ; GL_OES_texture_3D
+ glCompressedTexImage3DOES
+ glCompressedTexSubImage3DOES
+ glCopyTexSubImage3DOES
+ glFramebufferTexture3DOES
+ glTexImage3DOES
+ glTexSubImage3DOES
+
+ ; GL_OES_texture_border_clamp
+ glGetSamplerParameterIivOES
+ glGetSamplerParameterIuivOES
+ glGetTexParameterIivOES
+ glGetTexParameterIuivOES
+ glSamplerParameterIivOES
+ glSamplerParameterIuivOES
+ glTexParameterIivOES
+ glTexParameterIuivOES
+
+ ; GL_OES_texture_cube_map
+ glGetTexGenfvOES
+ glGetTexGenivOES
+ glGetTexGenxvOES
+ glTexGenfOES
+ glTexGenfvOES
+ glTexGeniOES
+ glTexGenivOES
+ glTexGenxOES
+ glTexGenxvOES
+
+ ; GL_OES_texture_storage_multisample_2d_array
+ glTexStorage3DMultisampleOES
+
+ ; GL_OES_vertex_array_object
+ glBindVertexArrayOES
+ glDeleteVertexArraysOES
+ glGenVertexArraysOES
+ glIsVertexArrayOES
+
+ ; GL_OVR_multiview
+ glFramebufferTextureMultiviewOVR
+
+ ; GL_OVR_multiview2
+
+ ; EGL_ANGLE_explicit_context
+ glActiveShaderProgramContextANGLE
+ glActiveTextureContextANGLE
+ glAlphaFuncContextANGLE
+ glAlphaFuncxContextANGLE
+ glAttachShaderContextANGLE
+ glBeginQueryContextANGLE
+ glBeginQueryEXTContextANGLE
+ glBeginTransformFeedbackContextANGLE
+ glBindAttribLocationContextANGLE
+ glBindBufferContextANGLE
+ glBindBufferBaseContextANGLE
+ glBindBufferRangeContextANGLE
+ glBindFragDataLocationEXTContextANGLE
+ glBindFragDataLocationIndexedEXTContextANGLE
+ glBindFragmentInputLocationCHROMIUMContextANGLE
+ glBindFramebufferContextANGLE
+ glBindFramebufferOESContextANGLE
+ glBindImageTextureContextANGLE
+ glBindProgramPipelineContextANGLE
+ glBindRenderbufferContextANGLE
+ glBindRenderbufferOESContextANGLE
+ glBindSamplerContextANGLE
+ glBindTextureContextANGLE
+ glBindTransformFeedbackContextANGLE
+ glBindUniformLocationCHROMIUMContextANGLE
+ glBindVertexArrayContextANGLE
+ glBindVertexArrayOESContextANGLE
+ glBindVertexBufferContextANGLE
+ glBlendColorContextANGLE
+ glBlendEquationContextANGLE
+ glBlendEquationSeparateContextANGLE
+ glBlendFuncContextANGLE
+ glBlendFuncSeparateContextANGLE
+ glBlitFramebufferContextANGLE
+ glBlitFramebufferANGLEContextANGLE
+ glBufferDataContextANGLE
+ glBufferStorageMemEXTContextANGLE
+ glBufferSubDataContextANGLE
+ glCheckFramebufferStatusContextANGLE
+ glCheckFramebufferStatusOESContextANGLE
+ glClearContextANGLE
+ glClearBufferfiContextANGLE
+ glClearBufferfvContextANGLE
+ glClearBufferivContextANGLE
+ glClearBufferuivContextANGLE
+ glClearColorContextANGLE
+ glClearColorxContextANGLE
+ glClearDepthfContextANGLE
+ glClearDepthxContextANGLE
+ glClearStencilContextANGLE
+ glClientActiveTextureContextANGLE
+ glClientWaitSyncContextANGLE
+ glClipPlanefContextANGLE
+ glClipPlanexContextANGLE
+ glColor4fContextANGLE
+ glColor4ubContextANGLE
+ glColor4xContextANGLE
+ glColorMaskContextANGLE
+ glColorPointerContextANGLE
+ glCompileShaderContextANGLE
+ glCompressedCopyTextureCHROMIUMContextANGLE
+ glCompressedTexImage2DContextANGLE
+ glCompressedTexImage2DRobustANGLEContextANGLE
+ glCompressedTexImage3DContextANGLE
+ glCompressedTexImage3DOESContextANGLE
+ glCompressedTexImage3DRobustANGLEContextANGLE
+ glCompressedTexSubImage2DContextANGLE
+ glCompressedTexSubImage2DRobustANGLEContextANGLE
+ glCompressedTexSubImage3DContextANGLE
+ glCompressedTexSubImage3DOESContextANGLE
+ glCompressedTexSubImage3DRobustANGLEContextANGLE
+ glCopyBufferSubDataContextANGLE
+ glCopySubTexture3DANGLEContextANGLE
+ glCopySubTextureCHROMIUMContextANGLE
+ glCopyTexImage2DContextANGLE
+ glCopyTexSubImage2DContextANGLE
+ glCopyTexSubImage3DContextANGLE
+ glCopyTexSubImage3DOESContextANGLE
+ glCopyTexture3DANGLEContextANGLE
+ glCopyTextureCHROMIUMContextANGLE
+ glCoverFillPathCHROMIUMContextANGLE
+ glCoverFillPathInstancedCHROMIUMContextANGLE
+ glCoverStrokePathCHROMIUMContextANGLE
+ glCoverStrokePathInstancedCHROMIUMContextANGLE
+ glCoverageModulationCHROMIUMContextANGLE
+ glCreateMemoryObjectsEXTContextANGLE
+ glCreateProgramContextANGLE
+ glCreateShaderContextANGLE
+ glCreateShaderProgramvContextANGLE
+ glCullFaceContextANGLE
+ glCurrentPaletteMatrixOESContextANGLE
+ glDebugMessageCallbackKHRContextANGLE
+ glDebugMessageControlKHRContextANGLE
+ glDebugMessageInsertKHRContextANGLE
+ glDeleteBuffersContextANGLE
+ glDeleteFencesNVContextANGLE
+ glDeleteFramebuffersContextANGLE
+ glDeleteFramebuffersOESContextANGLE
+ glDeleteMemoryObjectsEXTContextANGLE
+ glDeletePathsCHROMIUMContextANGLE
+ glDeleteProgramContextANGLE
+ glDeleteProgramPipelinesContextANGLE
+ glDeleteQueriesContextANGLE
+ glDeleteQueriesEXTContextANGLE
+ glDeleteRenderbuffersContextANGLE
+ glDeleteRenderbuffersOESContextANGLE
+ glDeleteSamplersContextANGLE
+ glDeleteSemaphoresEXTContextANGLE
+ glDeleteShaderContextANGLE
+ glDeleteSyncContextANGLE
+ glDeleteTexturesContextANGLE
+ glDeleteTransformFeedbacksContextANGLE
+ glDeleteVertexArraysContextANGLE
+ glDeleteVertexArraysOESContextANGLE
+ glDepthFuncContextANGLE
+ glDepthMaskContextANGLE
+ glDepthRangefContextANGLE
+ glDepthRangexContextANGLE
+ glDetachShaderContextANGLE
+ glDisableContextANGLE
+ glDisableClientStateContextANGLE
+ glDisableVertexAttribArrayContextANGLE
+ glDiscardFramebufferEXTContextANGLE
+ glDispatchComputeContextANGLE
+ glDispatchComputeIndirectContextANGLE
+ glDrawArraysContextANGLE
+ glDrawArraysIndirectContextANGLE
+ glDrawArraysInstancedContextANGLE
+ glDrawArraysInstancedANGLEContextANGLE
+ glDrawArraysInstancedEXTContextANGLE
+ glDrawBuffersContextANGLE
+ glDrawBuffersEXTContextANGLE
+ glDrawElementsContextANGLE
+ glDrawElementsIndirectContextANGLE
+ glDrawElementsInstancedContextANGLE
+ glDrawElementsInstancedANGLEContextANGLE
+ glDrawElementsInstancedEXTContextANGLE
+ glDrawRangeElementsContextANGLE
+ glDrawTexfOESContextANGLE
+ glDrawTexfvOESContextANGLE
+ glDrawTexiOESContextANGLE
+ glDrawTexivOESContextANGLE
+ glDrawTexsOESContextANGLE
+ glDrawTexsvOESContextANGLE
+ glDrawTexxOESContextANGLE
+ glDrawTexxvOESContextANGLE
+ glEGLImageTargetRenderbufferStorageOESContextANGLE
+ glEGLImageTargetTexture2DOESContextANGLE
+ glEnableContextANGLE
+ glEnableClientStateContextANGLE
+ glEnableVertexAttribArrayContextANGLE
+ glEndQueryContextANGLE
+ glEndQueryEXTContextANGLE
+ glEndTransformFeedbackContextANGLE
+ glFenceSyncContextANGLE
+ glFinishContextANGLE
+ glFinishFenceNVContextANGLE
+ glFlushContextANGLE
+ glFlushMappedBufferRangeContextANGLE
+ glFlushMappedBufferRangeEXTContextANGLE
+ glFogfContextANGLE
+ glFogfvContextANGLE
+ glFogxContextANGLE
+ glFogxvContextANGLE
+ glFramebufferParameteriContextANGLE
+ glFramebufferRenderbufferContextANGLE
+ glFramebufferRenderbufferOESContextANGLE
+ glFramebufferTexture2DContextANGLE
+ glFramebufferTexture2DOESContextANGLE
+ glFramebufferTexture3DOESContextANGLE
+ glFramebufferTextureEXTContextANGLE
+ glFramebufferTextureLayerContextANGLE
+ glFramebufferTextureMultiviewOVRContextANGLE
+ glFrontFaceContextANGLE
+ glFrustumfContextANGLE
+ glFrustumxContextANGLE
+ glGenBuffersContextANGLE
+ glGenFencesNVContextANGLE
+ glGenFramebuffersContextANGLE
+ glGenFramebuffersOESContextANGLE
+ glGenPathsCHROMIUMContextANGLE
+ glGenProgramPipelinesContextANGLE
+ glGenQueriesContextANGLE
+ glGenQueriesEXTContextANGLE
+ glGenRenderbuffersContextANGLE
+ glGenRenderbuffersOESContextANGLE
+ glGenSamplersContextANGLE
+ glGenSemaphoresEXTContextANGLE
+ glGenTexturesContextANGLE
+ glGenTransformFeedbacksContextANGLE
+ glGenVertexArraysContextANGLE
+ glGenVertexArraysOESContextANGLE
+ glGenerateMipmapContextANGLE
+ glGenerateMipmapOESContextANGLE
+ glGetActiveAttribContextANGLE
+ glGetActiveUniformContextANGLE
+ glGetActiveUniformBlockNameContextANGLE
+ glGetActiveUniformBlockivContextANGLE
+ glGetActiveUniformBlockivRobustANGLEContextANGLE
+ glGetActiveUniformsivContextANGLE
+ glGetAttachedShadersContextANGLE
+ glGetAttribLocationContextANGLE
+ glGetBooleani_vContextANGLE
+ glGetBooleani_vRobustANGLEContextANGLE
+ glGetBooleanvContextANGLE
+ glGetBooleanvRobustANGLEContextANGLE
+ glGetBufferParameteri64vContextANGLE
+ glGetBufferParameteri64vRobustANGLEContextANGLE
+ glGetBufferParameterivContextANGLE
+ glGetBufferParameterivRobustANGLEContextANGLE
+ glGetBufferPointervContextANGLE
+ glGetBufferPointervOESContextANGLE
+ glGetBufferPointervRobustANGLEContextANGLE
+ glGetClipPlanefContextANGLE
+ glGetClipPlanexContextANGLE
+ glGetDebugMessageLogKHRContextANGLE
+ glGetErrorContextANGLE
+ glGetFenceivNVContextANGLE
+ glGetFixedvContextANGLE
+ glGetFloatvContextANGLE
+ glGetFloatvRobustANGLEContextANGLE
+ glGetFragDataIndexEXTContextANGLE
+ glGetFragDataLocationContextANGLE
+ glGetFramebufferAttachmentParameterivContextANGLE
+ glGetFramebufferAttachmentParameterivOESContextANGLE
+ glGetFramebufferAttachmentParameterivRobustANGLEContextANGLE
+ glGetFramebufferParameterivContextANGLE
+ glGetFramebufferParameterivRobustANGLEContextANGLE
+ glGetGraphicsResetStatusEXTContextANGLE
+ glGetInteger64i_vContextANGLE
+ glGetInteger64i_vRobustANGLEContextANGLE
+ glGetInteger64vContextANGLE
+ glGetInteger64vRobustANGLEContextANGLE
+ glGetIntegeri_vContextANGLE
+ glGetIntegeri_vRobustANGLEContextANGLE
+ glGetIntegervContextANGLE
+ glGetIntegervRobustANGLEContextANGLE
+ glGetInternalformativContextANGLE
+ glGetInternalformativRobustANGLEContextANGLE
+ glGetLightfvContextANGLE
+ glGetLightxvContextANGLE
+ glGetMaterialfvContextANGLE
+ glGetMaterialxvContextANGLE
+ glGetMemoryObjectParameterivEXTContextANGLE
+ glGetMultisamplefvContextANGLE
+ glGetMultisamplefvANGLEContextANGLE
+ glGetMultisamplefvRobustANGLEContextANGLE
+ glGetObjectLabelKHRContextANGLE
+ glGetObjectPtrLabelKHRContextANGLE
+ glGetPathParameterfvCHROMIUMContextANGLE
+ glGetPathParameterivCHROMIUMContextANGLE
+ glGetPointervContextANGLE
+ glGetPointervKHRContextANGLE
+ glGetPointervRobustANGLERobustANGLEContextANGLE
+ glGetProgramBinaryContextANGLE
+ glGetProgramBinaryOESContextANGLE
+ glGetProgramInfoLogContextANGLE
+ glGetProgramInterfaceivContextANGLE
+ glGetProgramInterfaceivRobustANGLEContextANGLE
+ glGetProgramPipelineInfoLogContextANGLE
+ glGetProgramPipelineivContextANGLE
+ glGetProgramResourceIndexContextANGLE
+ glGetProgramResourceLocationContextANGLE
+ glGetProgramResourceLocationIndexEXTContextANGLE
+ glGetProgramResourceNameContextANGLE
+ glGetProgramResourceivContextANGLE
+ glGetProgramivContextANGLE
+ glGetProgramivRobustANGLEContextANGLE
+ glGetQueryObjecti64vEXTContextANGLE
+ glGetQueryObjecti64vRobustANGLEContextANGLE
+ glGetQueryObjectivEXTContextANGLE
+ glGetQueryObjectivRobustANGLEContextANGLE
+ glGetQueryObjectui64vEXTContextANGLE
+ glGetQueryObjectui64vRobustANGLEContextANGLE
+ glGetQueryObjectuivContextANGLE
+ glGetQueryObjectuivEXTContextANGLE
+ glGetQueryObjectuivRobustANGLEContextANGLE
+ glGetQueryivContextANGLE
+ glGetQueryivEXTContextANGLE
+ glGetQueryivRobustANGLEContextANGLE
+ glGetRenderbufferParameterivContextANGLE
+ glGetRenderbufferParameterivOESContextANGLE
+ glGetRenderbufferParameterivRobustANGLEContextANGLE
+ glGetSamplerParameterIivOESContextANGLE
+ glGetSamplerParameterIivRobustANGLEContextANGLE
+ glGetSamplerParameterIuivOESContextANGLE
+ glGetSamplerParameterIuivRobustANGLEContextANGLE
+ glGetSamplerParameterfvContextANGLE
+ glGetSamplerParameterfvRobustANGLEContextANGLE
+ glGetSamplerParameterivContextANGLE
+ glGetSamplerParameterivRobustANGLEContextANGLE
+ glGetSemaphoreParameterui64vEXTContextANGLE
+ glGetShaderInfoLogContextANGLE
+ glGetShaderPrecisionFormatContextANGLE
+ glGetShaderSourceContextANGLE
+ glGetShaderivContextANGLE
+ glGetShaderivRobustANGLEContextANGLE
+ glGetStringContextANGLE
+ glGetStringiContextANGLE
+ glGetSyncivContextANGLE
+ glGetTexEnvfvContextANGLE
+ glGetTexEnvivContextANGLE
+ glGetTexEnvxvContextANGLE
+ glGetTexGenfvOESContextANGLE
+ glGetTexGenivOESContextANGLE
+ glGetTexGenxvOESContextANGLE
+ glGetTexLevelParameterfvContextANGLE
+ glGetTexLevelParameterfvANGLEContextANGLE
+ glGetTexLevelParameterfvRobustANGLEContextANGLE
+ glGetTexLevelParameterivContextANGLE
+ glGetTexLevelParameterivANGLEContextANGLE
+ glGetTexLevelParameterivRobustANGLEContextANGLE
+ glGetTexParameterIivOESContextANGLE
+ glGetTexParameterIivRobustANGLEContextANGLE
+ glGetTexParameterIuivOESContextANGLE
+ glGetTexParameterIuivRobustANGLEContextANGLE
+ glGetTexParameterfvContextANGLE
+ glGetTexParameterfvRobustANGLEContextANGLE
+ glGetTexParameterivContextANGLE
+ glGetTexParameterivRobustANGLEContextANGLE
+ glGetTexParameterxvContextANGLE
+ glGetTransformFeedbackVaryingContextANGLE
+ glGetTranslatedShaderSourceANGLEContextANGLE
+ glGetUniformBlockIndexContextANGLE
+ glGetUniformIndicesContextANGLE
+ glGetUniformLocationContextANGLE
+ glGetUniformfvContextANGLE
+ glGetUniformfvRobustANGLEContextANGLE
+ glGetUniformivContextANGLE
+ glGetUniformivRobustANGLEContextANGLE
+ glGetUniformuivContextANGLE
+ glGetUniformuivRobustANGLEContextANGLE
+ glGetUnsignedBytei_vEXTContextANGLE
+ glGetUnsignedBytevEXTContextANGLE
+ glGetVertexAttribIivContextANGLE
+ glGetVertexAttribIivRobustANGLEContextANGLE
+ glGetVertexAttribIuivContextANGLE
+ glGetVertexAttribIuivRobustANGLEContextANGLE
+ glGetVertexAttribPointervContextANGLE
+ glGetVertexAttribPointervRobustANGLEContextANGLE
+ glGetVertexAttribfvContextANGLE
+ glGetVertexAttribfvRobustANGLEContextANGLE
+ glGetVertexAttribivContextANGLE
+ glGetVertexAttribivRobustANGLEContextANGLE
+ glGetnUniformfvEXTContextANGLE
+ glGetnUniformfvRobustANGLEContextANGLE
+ glGetnUniformivEXTContextANGLE
+ glGetnUniformivRobustANGLEContextANGLE
+ glGetnUniformuivRobustANGLEContextANGLE
+ glHintContextANGLE
+ glImportMemoryFdEXTContextANGLE
+ glImportSemaphoreFdEXTContextANGLE
+ glInsertEventMarkerEXTContextANGLE
+ glInvalidateFramebufferContextANGLE
+ glInvalidateSubFramebufferContextANGLE
+ glInvalidateTextureANGLEContextANGLE
+ glIsBufferContextANGLE
+ glIsEnabledContextANGLE
+ glIsFenceNVContextANGLE
+ glIsFramebufferContextANGLE
+ glIsFramebufferOESContextANGLE
+ glIsMemoryObjectEXTContextANGLE
+ glIsPathCHROMIUMContextANGLE
+ glIsProgramContextANGLE
+ glIsProgramPipelineContextANGLE
+ glIsQueryContextANGLE
+ glIsQueryEXTContextANGLE
+ glIsRenderbufferContextANGLE
+ glIsRenderbufferOESContextANGLE
+ glIsSamplerContextANGLE
+ glIsSemaphoreEXTContextANGLE
+ glIsShaderContextANGLE
+ glIsSyncContextANGLE
+ glIsTextureContextANGLE
+ glIsTransformFeedbackContextANGLE
+ glIsVertexArrayContextANGLE
+ glIsVertexArrayOESContextANGLE
+ glLightModelfContextANGLE
+ glLightModelfvContextANGLE
+ glLightModelxContextANGLE
+ glLightModelxvContextANGLE
+ glLightfContextANGLE
+ glLightfvContextANGLE
+ glLightxContextANGLE
+ glLightxvContextANGLE
+ glLineWidthContextANGLE
+ glLineWidthxContextANGLE
+ glLinkProgramContextANGLE
+ glLoadIdentityContextANGLE
+ glLoadMatrixfContextANGLE
+ glLoadMatrixxContextANGLE
+ glLoadPaletteFromModelViewMatrixOESContextANGLE
+ glLogicOpContextANGLE
+ glLoseContextCHROMIUMContextANGLE
+ glMapBufferOESContextANGLE
+ glMapBufferRangeContextANGLE
+ glMapBufferRangeEXTContextANGLE
+ glMaterialfContextANGLE
+ glMaterialfvContextANGLE
+ glMaterialxContextANGLE
+ glMaterialxvContextANGLE
+ glMatrixIndexPointerOESContextANGLE
+ glMatrixLoadIdentityCHROMIUMContextANGLE
+ glMatrixLoadfCHROMIUMContextANGLE
+ glMatrixModeContextANGLE
+ glMaxShaderCompilerThreadsKHRContextANGLE
+ glMemoryBarrierContextANGLE
+ glMemoryBarrierByRegionContextANGLE
+ glMemoryObjectParameterivEXTContextANGLE
+ glMultMatrixfContextANGLE
+ glMultMatrixxContextANGLE
+ glMultiDrawArraysANGLEContextANGLE
+ glMultiDrawArraysInstancedANGLEContextANGLE
+ glMultiDrawElementsANGLEContextANGLE
+ glMultiDrawElementsInstancedANGLEContextANGLE
+ glMultiTexCoord4fContextANGLE
+ glMultiTexCoord4xContextANGLE
+ glNormal3fContextANGLE
+ glNormal3xContextANGLE
+ glNormalPointerContextANGLE
+ glObjectLabelKHRContextANGLE
+ glObjectPtrLabelKHRContextANGLE
+ glOrthofContextANGLE
+ glOrthoxContextANGLE
+ glPathCommandsCHROMIUMContextANGLE
+ glPathParameterfCHROMIUMContextANGLE
+ glPathParameteriCHROMIUMContextANGLE
+ glPathStencilFuncCHROMIUMContextANGLE
+ glPauseTransformFeedbackContextANGLE
+ glPixelStoreiContextANGLE
+ glPointParameterfContextANGLE
+ glPointParameterfvContextANGLE
+ glPointParameterxContextANGLE
+ glPointParameterxvContextANGLE
+ glPointSizeContextANGLE
+ glPointSizePointerOESContextANGLE
+ glPointSizexContextANGLE
+ glPolygonOffsetContextANGLE
+ glPolygonOffsetxContextANGLE
+ glPopDebugGroupKHRContextANGLE
+ glPopGroupMarkerEXTContextANGLE
+ glPopMatrixContextANGLE
+ glProgramBinaryContextANGLE
+ glProgramBinaryOESContextANGLE
+ glProgramParameteriContextANGLE
+ glProgramPathFragmentInputGenCHROMIUMContextANGLE
+ glProgramUniform1fContextANGLE
+ glProgramUniform1fvContextANGLE
+ glProgramUniform1iContextANGLE
+ glProgramUniform1ivContextANGLE
+ glProgramUniform1uiContextANGLE
+ glProgramUniform1uivContextANGLE
+ glProgramUniform2fContextANGLE
+ glProgramUniform2fvContextANGLE
+ glProgramUniform2iContextANGLE
+ glProgramUniform2ivContextANGLE
+ glProgramUniform2uiContextANGLE
+ glProgramUniform2uivContextANGLE
+ glProgramUniform3fContextANGLE
+ glProgramUniform3fvContextANGLE
+ glProgramUniform3iContextANGLE
+ glProgramUniform3ivContextANGLE
+ glProgramUniform3uiContextANGLE
+ glProgramUniform3uivContextANGLE
+ glProgramUniform4fContextANGLE
+ glProgramUniform4fvContextANGLE
+ glProgramUniform4iContextANGLE
+ glProgramUniform4ivContextANGLE
+ glProgramUniform4uiContextANGLE
+ glProgramUniform4uivContextANGLE
+ glProgramUniformMatrix2fvContextANGLE
+ glProgramUniformMatrix2x3fvContextANGLE
+ glProgramUniformMatrix2x4fvContextANGLE
+ glProgramUniformMatrix3fvContextANGLE
+ glProgramUniformMatrix3x2fvContextANGLE
+ glProgramUniformMatrix3x4fvContextANGLE
+ glProgramUniformMatrix4fvContextANGLE
+ glProgramUniformMatrix4x2fvContextANGLE
+ glProgramUniformMatrix4x3fvContextANGLE
+ glProvokingVertexANGLEContextANGLE
+ glPushDebugGroupKHRContextANGLE
+ glPushGroupMarkerEXTContextANGLE
+ glPushMatrixContextANGLE
+ glQueryCounterEXTContextANGLE
+ glQueryMatrixxOESContextANGLE
+ glReadBufferContextANGLE
+ glReadPixelsContextANGLE
+ glReadPixelsRobustANGLEContextANGLE
+ glReadnPixelsEXTContextANGLE
+ glReadnPixelsRobustANGLEContextANGLE
+ glReleaseShaderCompilerContextANGLE
+ glRenderbufferStorageContextANGLE
+ glRenderbufferStorageMultisampleContextANGLE
+ glRenderbufferStorageMultisampleANGLEContextANGLE
+ glRenderbufferStorageOESContextANGLE
+ glRequestExtensionANGLEContextANGLE
+ glResumeTransformFeedbackContextANGLE
+ glRotatefContextANGLE
+ glRotatexContextANGLE
+ glSampleCoverageContextANGLE
+ glSampleCoveragexContextANGLE
+ glSampleMaskiContextANGLE
+ glSampleMaskiANGLEContextANGLE
+ glSamplerParameterIivOESContextANGLE
+ glSamplerParameterIivRobustANGLEContextANGLE
+ glSamplerParameterIuivOESContextANGLE
+ glSamplerParameterIuivRobustANGLEContextANGLE
+ glSamplerParameterfContextANGLE
+ glSamplerParameterfvContextANGLE
+ glSamplerParameterfvRobustANGLEContextANGLE
+ glSamplerParameteriContextANGLE
+ glSamplerParameterivContextANGLE
+ glSamplerParameterivRobustANGLEContextANGLE
+ glScalefContextANGLE
+ glScalexContextANGLE
+ glScissorContextANGLE
+ glSemaphoreParameterui64vEXTContextANGLE
+ glSetFenceNVContextANGLE
+ glShadeModelContextANGLE
+ glShaderBinaryContextANGLE
+ glShaderSourceContextANGLE
+ glSignalSemaphoreEXTContextANGLE
+ glStencilFillPathCHROMIUMContextANGLE
+ glStencilFillPathInstancedCHROMIUMContextANGLE
+ glStencilFuncContextANGLE
+ glStencilFuncSeparateContextANGLE
+ glStencilMaskContextANGLE
+ glStencilMaskSeparateContextANGLE
+ glStencilOpContextANGLE
+ glStencilOpSeparateContextANGLE
+ glStencilStrokePathCHROMIUMContextANGLE
+ glStencilStrokePathInstancedCHROMIUMContextANGLE
+ glStencilThenCoverFillPathCHROMIUMContextANGLE
+ glStencilThenCoverFillPathInstancedCHROMIUMContextANGLE
+ glStencilThenCoverStrokePathCHROMIUMContextANGLE
+ glStencilThenCoverStrokePathInstancedCHROMIUMContextANGLE
+ glTestFenceNVContextANGLE
+ glTexCoordPointerContextANGLE
+ glTexEnvfContextANGLE
+ glTexEnvfvContextANGLE
+ glTexEnviContextANGLE
+ glTexEnvivContextANGLE
+ glTexEnvxContextANGLE
+ glTexEnvxvContextANGLE
+ glTexGenfOESContextANGLE
+ glTexGenfvOESContextANGLE
+ glTexGeniOESContextANGLE
+ glTexGenivOESContextANGLE
+ glTexGenxOESContextANGLE
+ glTexGenxvOESContextANGLE
+ glTexImage2DContextANGLE
+ glTexImage2DExternalANGLEContextANGLE
+ glTexImage2DRobustANGLEContextANGLE
+ glTexImage3DContextANGLE
+ glTexImage3DOESContextANGLE
+ glTexImage3DRobustANGLEContextANGLE
+ glTexParameterIivOESContextANGLE
+ glTexParameterIivRobustANGLEContextANGLE
+ glTexParameterIuivOESContextANGLE
+ glTexParameterIuivRobustANGLEContextANGLE
+ glTexParameterfContextANGLE
+ glTexParameterfvContextANGLE
+ glTexParameterfvRobustANGLEContextANGLE
+ glTexParameteriContextANGLE
+ glTexParameterivContextANGLE
+ glTexParameterivRobustANGLEContextANGLE
+ glTexParameterxContextANGLE
+ glTexParameterxvContextANGLE
+ glTexStorage1DEXTContextANGLE
+ glTexStorage2DContextANGLE
+ glTexStorage2DEXTContextANGLE
+ glTexStorage2DMultisampleContextANGLE
+ glTexStorage2DMultisampleANGLEContextANGLE
+ glTexStorage3DContextANGLE
+ glTexStorage3DEXTContextANGLE
+ glTexStorage3DMultisampleOESContextANGLE
+ glTexStorageMem2DEXTContextANGLE
+ glTexStorageMem2DMultisampleEXTContextANGLE
+ glTexStorageMem3DEXTContextANGLE
+ glTexStorageMem3DMultisampleEXTContextANGLE
+ glTexSubImage2DContextANGLE
+ glTexSubImage2DRobustANGLEContextANGLE
+ glTexSubImage3DContextANGLE
+ glTexSubImage3DOESContextANGLE
+ glTexSubImage3DRobustANGLEContextANGLE
+ glTransformFeedbackVaryingsContextANGLE
+ glTranslatefContextANGLE
+ glTranslatexContextANGLE
+ glUniform1fContextANGLE
+ glUniform1fvContextANGLE
+ glUniform1iContextANGLE
+ glUniform1ivContextANGLE
+ glUniform1uiContextANGLE
+ glUniform1uivContextANGLE
+ glUniform2fContextANGLE
+ glUniform2fvContextANGLE
+ glUniform2iContextANGLE
+ glUniform2ivContextANGLE
+ glUniform2uiContextANGLE
+ glUniform2uivContextANGLE
+ glUniform3fContextANGLE
+ glUniform3fvContextANGLE
+ glUniform3iContextANGLE
+ glUniform3ivContextANGLE
+ glUniform3uiContextANGLE
+ glUniform3uivContextANGLE
+ glUniform4fContextANGLE
+ glUniform4fvContextANGLE
+ glUniform4iContextANGLE
+ glUniform4ivContextANGLE
+ glUniform4uiContextANGLE
+ glUniform4uivContextANGLE
+ glUniformBlockBindingContextANGLE
+ glUniformMatrix2fvContextANGLE
+ glUniformMatrix2x3fvContextANGLE
+ glUniformMatrix2x4fvContextANGLE
+ glUniformMatrix3fvContextANGLE
+ glUniformMatrix3x2fvContextANGLE
+ glUniformMatrix3x4fvContextANGLE
+ glUniformMatrix4fvContextANGLE
+ glUniformMatrix4x2fvContextANGLE
+ glUniformMatrix4x3fvContextANGLE
+ glUnmapBufferContextANGLE
+ glUnmapBufferOESContextANGLE
+ glUseProgramContextANGLE
+ glUseProgramStagesContextANGLE
+ glValidateProgramContextANGLE
+ glValidateProgramPipelineContextANGLE
+ glVertexAttrib1fContextANGLE
+ glVertexAttrib1fvContextANGLE
+ glVertexAttrib2fContextANGLE
+ glVertexAttrib2fvContextANGLE
+ glVertexAttrib3fContextANGLE
+ glVertexAttrib3fvContextANGLE
+ glVertexAttrib4fContextANGLE
+ glVertexAttrib4fvContextANGLE
+ glVertexAttribBindingContextANGLE
+ glVertexAttribDivisorContextANGLE
+ glVertexAttribDivisorANGLEContextANGLE
+ glVertexAttribDivisorEXTContextANGLE
+ glVertexAttribFormatContextANGLE
+ glVertexAttribI4iContextANGLE
+ glVertexAttribI4ivContextANGLE
+ glVertexAttribI4uiContextANGLE
+ glVertexAttribI4uivContextANGLE
+ glVertexAttribIFormatContextANGLE
+ glVertexAttribIPointerContextANGLE
+ glVertexAttribPointerContextANGLE
+ glVertexBindingDivisorContextANGLE
+ glVertexPointerContextANGLE
+ glViewportContextANGLE
+ glWaitSemaphoreEXTContextANGLE
+ glWaitSyncContextANGLE
+ glWeightPointerOESContextANGLE
+
+ ; EGL 1.0
+ EGL_ChooseConfig
+ EGL_CopyBuffers
+ EGL_CreateContext
+ EGL_CreatePbufferSurface
+ EGL_CreatePixmapSurface
+ EGL_CreateWindowSurface
+ EGL_DestroyContext
+ EGL_DestroySurface
+ EGL_GetConfigAttrib
+ EGL_GetConfigs
+ EGL_GetCurrentDisplay
+ EGL_GetCurrentSurface
+ EGL_GetDisplay
+ EGL_GetError
+ EGL_GetProcAddress
+ EGL_Initialize
+ EGL_MakeCurrent
+ EGL_QueryContext
+ EGL_QueryString
+ EGL_QuerySurface
+ EGL_SwapBuffers
+ EGL_Terminate
+ EGL_WaitGL
+ EGL_WaitNative
+
+ ; EGL 1.1
+ EGL_BindTexImage
+ EGL_ReleaseTexImage
+ EGL_SurfaceAttrib
+ EGL_SwapInterval
+
+ ; EGL 1.2
+ EGL_BindAPI
+ EGL_CreatePbufferFromClientBuffer
+ EGL_QueryAPI
+ EGL_ReleaseThread
+ EGL_WaitClient
+
+ ; EGL 1.4
+ EGL_GetCurrentContext
+
+ ; EGL 1.5
+ EGL_ClientWaitSync
+ EGL_CreateImage
+ EGL_CreatePlatformPixmapSurface
+ EGL_CreatePlatformWindowSurface
+ EGL_CreateSync
+ EGL_DestroyImage
+ EGL_DestroySync
+ EGL_GetPlatformDisplay
+ EGL_GetSyncAttrib
+ EGL_WaitSync
+
+ ; EGL_ANDROID_blob_cache
+ EGL_SetBlobCacheFuncsANDROID
+
+ ; EGL_ANDROID_get_frame_timestamps
+ EGL_GetCompositorTimingANDROID
+ EGL_GetCompositorTimingSupportedANDROID
+ EGL_GetFrameTimestampSupportedANDROID
+ EGL_GetFrameTimestampsANDROID
+ EGL_GetNextFrameIdANDROID
+
+ ; EGL_ANDROID_get_native_client_buffer
+ EGL_GetNativeClientBufferANDROID
+
+ ; EGL_ANDROID_native_fence_sync
+ EGL_DupNativeFenceFDANDROID
+
+ ; EGL_ANDROID_presentation_time
+ EGL_PresentationTimeANDROID
+
+ ; EGL_ANGLE_device_creation
+ EGL_CreateDeviceANGLE
+ EGL_ReleaseDeviceANGLE
+
+ ; EGL_ANGLE_feature_control
+ EGL_QueryDisplayAttribANGLE
+ EGL_QueryStringiANGLE
+
+ ; EGL_ANGLE_program_cache_control
+ EGL_ProgramCacheGetAttribANGLE
+ EGL_ProgramCachePopulateANGLE
+ EGL_ProgramCacheQueryANGLE
+ EGL_ProgramCacheResizeANGLE
+
+ ; EGL_ANGLE_query_surface_pointer
+ EGL_QuerySurfacePointerANGLE
+
+ ; EGL_ANGLE_stream_producer_d3d_texture
+ EGL_CreateStreamProducerD3DTextureANGLE
+ EGL_StreamPostD3DTextureANGLE
+
+ ; EGL_CHROMIUM_get_sync_values
+ EGL_GetSyncValuesCHROMIUM
+
+ ; EGL_EXT_device_query
+ EGL_QueryDeviceAttribEXT
+ EGL_QueryDeviceStringEXT
+ EGL_QueryDisplayAttribEXT
+
+ ; EGL_EXT_platform_base
+ EGL_CreatePlatformPixmapSurfaceEXT
+ EGL_CreatePlatformWindowSurfaceEXT
+ EGL_GetPlatformDisplayEXT
+
+ ; EGL_KHR_debug
+ EGL_DebugMessageControlKHR
+ EGL_LabelObjectKHR
+ EGL_QueryDebugKHR
+
+ ; EGL_KHR_fence_sync
+ EGL_ClientWaitSyncKHR
+ EGL_CreateSyncKHR
+ EGL_DestroySyncKHR
+ EGL_GetSyncAttribKHR
+
+ ; EGL_KHR_image
+ EGL_CreateImageKHR
+ EGL_DestroyImageKHR
+
+ ; EGL_KHR_stream
+ EGL_CreateStreamKHR
+ EGL_DestroyStreamKHR
+ EGL_QueryStreamKHR
+ EGL_QueryStreamu64KHR
+ EGL_StreamAttribKHR
+
+ ; EGL_KHR_stream_consumer_gltexture
+ EGL_StreamConsumerAcquireKHR
+ EGL_StreamConsumerGLTextureExternalKHR
+ EGL_StreamConsumerReleaseKHR
+
+ ; EGL_KHR_swap_buffers_with_damage
+ EGL_SwapBuffersWithDamageKHR
+
+ ; EGL_KHR_wait_sync
+ EGL_WaitSyncKHR
+
+ ; EGL_NV_post_sub_buffer
+ EGL_PostSubBufferNV
+
+ ; EGL_NV_stream_consumer_gltexture_yuv
+ EGL_StreamConsumerGLTextureExternalAttribsNV
diff --git a/gfx/angle/checkout/src/libGLESv2/proc_table_egl.h b/gfx/angle/checkout/src/libGLESv2/proc_table_egl.h
new file mode 100644
index 0000000000..38506e7c4c
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/proc_table_egl.h
@@ -0,0 +1,25 @@
+//
+// Copyright 2017 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// getProcAddress loader table:
+// Mapping from a string entry point name to function address.
+//
+
+#ifndef LIBGLESV2_PROC_TABLE_H_
+#define LIBGLESV2_PROC_TABLE_H_
+
+#include <EGL/egl.h>
+#include <stddef.h>
+#include <utility>
+
+namespace egl
+{
+using ProcEntry = std::pair<const char *, __eglMustCastToProperFunctionPointerType>;
+
+extern ProcEntry g_procTable[];
+extern size_t g_numProcs;
+} // namespace egl
+
+#endif // LIBGLESV2_PROC_TABLE_H_
diff --git a/gfx/angle/checkout/src/libGLESv2/proc_table_egl_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/proc_table_egl_autogen.cpp
new file mode 100644
index 0000000000..3fc0850de4
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/proc_table_egl_autogen.cpp
@@ -0,0 +1,1495 @@
+// GENERATED FILE - DO NOT EDIT.
+// Generated by gen_proc_table.py using data from gl.xml, gl_angle_ext.xml, egl.xml,
+// egl_angle_ext.xml.
+//
+// Copyright 2019 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// getProcAddress loader table:
+// Mapping from a string entry point name to function address.
+//
+
+#include "libGLESv2/proc_table_egl.h"
+
+#include "libGLESv2/entry_points_egl.h"
+#include "libGLESv2/entry_points_egl_ext.h"
+#include "libGLESv2/entry_points_gles_1_0_autogen.h"
+#include "libGLESv2/entry_points_gles_2_0_autogen.h"
+#include "libGLESv2/entry_points_gles_3_0_autogen.h"
+#include "libGLESv2/entry_points_gles_3_1_autogen.h"
+#include "libGLESv2/entry_points_gles_ext_autogen.h"
+#include "platform/Platform.h"
+
+#define P(FUNC) reinterpret_cast<__eglMustCastToProperFunctionPointerType>(FUNC)
+
+namespace egl
+{
+ProcEntry g_procTable[] = {
+ {"ANGLEGetDisplayPlatform", P(ANGLEGetDisplayPlatform)},
+ {"ANGLEResetDisplayPlatform", P(ANGLEResetDisplayPlatform)},
+ {"eglBindAPI", P(EGL_BindAPI)},
+ {"eglBindTexImage", P(EGL_BindTexImage)},
+ {"eglChooseConfig", P(EGL_ChooseConfig)},
+ {"eglClientWaitSync", P(EGL_ClientWaitSync)},
+ {"eglClientWaitSyncKHR", P(EGL_ClientWaitSyncKHR)},
+ {"eglCopyBuffers", P(EGL_CopyBuffers)},
+ {"eglCreateContext", P(EGL_CreateContext)},
+ {"eglCreateDeviceANGLE", P(EGL_CreateDeviceANGLE)},
+ {"eglCreateImage", P(EGL_CreateImage)},
+ {"eglCreateImageKHR", P(EGL_CreateImageKHR)},
+ {"eglCreatePbufferFromClientBuffer", P(EGL_CreatePbufferFromClientBuffer)},
+ {"eglCreatePbufferSurface", P(EGL_CreatePbufferSurface)},
+ {"eglCreatePixmapSurface", P(EGL_CreatePixmapSurface)},
+ {"eglCreatePlatformPixmapSurface", P(EGL_CreatePlatformPixmapSurface)},
+ {"eglCreatePlatformPixmapSurfaceEXT", P(EGL_CreatePlatformPixmapSurfaceEXT)},
+ {"eglCreatePlatformWindowSurface", P(EGL_CreatePlatformWindowSurface)},
+ {"eglCreatePlatformWindowSurfaceEXT", P(EGL_CreatePlatformWindowSurfaceEXT)},
+ {"eglCreateStreamKHR", P(EGL_CreateStreamKHR)},
+ {"eglCreateStreamProducerD3DTextureANGLE", P(EGL_CreateStreamProducerD3DTextureANGLE)},
+ {"eglCreateSync", P(EGL_CreateSync)},
+ {"eglCreateSyncKHR", P(EGL_CreateSyncKHR)},
+ {"eglCreateWindowSurface", P(EGL_CreateWindowSurface)},
+ {"eglDebugMessageControlKHR", P(EGL_DebugMessageControlKHR)},
+ {"eglDestroyContext", P(EGL_DestroyContext)},
+ {"eglDestroyImage", P(EGL_DestroyImage)},
+ {"eglDestroyImageKHR", P(EGL_DestroyImageKHR)},
+ {"eglDestroyStreamKHR", P(EGL_DestroyStreamKHR)},
+ {"eglDestroySurface", P(EGL_DestroySurface)},
+ {"eglDestroySync", P(EGL_DestroySync)},
+ {"eglDestroySyncKHR", P(EGL_DestroySyncKHR)},
+ {"eglDupNativeFenceFDANDROID", P(EGL_DupNativeFenceFDANDROID)},
+ {"eglGetCompositorTimingANDROID", P(EGL_GetCompositorTimingANDROID)},
+ {"eglGetCompositorTimingSupportedANDROID", P(EGL_GetCompositorTimingSupportedANDROID)},
+ {"eglGetConfigAttrib", P(EGL_GetConfigAttrib)},
+ {"eglGetConfigs", P(EGL_GetConfigs)},
+ {"eglGetCurrentContext", P(EGL_GetCurrentContext)},
+ {"eglGetCurrentDisplay", P(EGL_GetCurrentDisplay)},
+ {"eglGetCurrentSurface", P(EGL_GetCurrentSurface)},
+ {"eglGetDisplay", P(EGL_GetDisplay)},
+ {"eglGetError", P(EGL_GetError)},
+ {"eglGetFrameTimestampSupportedANDROID", P(EGL_GetFrameTimestampSupportedANDROID)},
+ {"eglGetFrameTimestampsANDROID", P(EGL_GetFrameTimestampsANDROID)},
+ {"eglGetNativeClientBufferANDROID", P(EGL_GetNativeClientBufferANDROID)},
+ {"eglGetNextFrameIdANDROID", P(EGL_GetNextFrameIdANDROID)},
+ {"eglGetPlatformDisplay", P(EGL_GetPlatformDisplay)},
+ {"eglGetPlatformDisplayEXT", P(EGL_GetPlatformDisplayEXT)},
+ {"eglGetProcAddress", P(EGL_GetProcAddress)},
+ {"eglGetSyncAttrib", P(EGL_GetSyncAttrib)},
+ {"eglGetSyncAttribKHR", P(EGL_GetSyncAttribKHR)},
+ {"eglGetSyncValuesCHROMIUM", P(EGL_GetSyncValuesCHROMIUM)},
+ {"eglInitialize", P(EGL_Initialize)},
+ {"eglLabelObjectKHR", P(EGL_LabelObjectKHR)},
+ {"eglMakeCurrent", P(EGL_MakeCurrent)},
+ {"eglPostSubBufferNV", P(EGL_PostSubBufferNV)},
+ {"eglPresentationTimeANDROID", P(EGL_PresentationTimeANDROID)},
+ {"eglProgramCacheGetAttribANGLE", P(EGL_ProgramCacheGetAttribANGLE)},
+ {"eglProgramCachePopulateANGLE", P(EGL_ProgramCachePopulateANGLE)},
+ {"eglProgramCacheQueryANGLE", P(EGL_ProgramCacheQueryANGLE)},
+ {"eglProgramCacheResizeANGLE", P(EGL_ProgramCacheResizeANGLE)},
+ {"eglQueryAPI", P(EGL_QueryAPI)},
+ {"eglQueryContext", P(EGL_QueryContext)},
+ {"eglQueryDebugKHR", P(EGL_QueryDebugKHR)},
+ {"eglQueryDeviceAttribEXT", P(EGL_QueryDeviceAttribEXT)},
+ {"eglQueryDeviceStringEXT", P(EGL_QueryDeviceStringEXT)},
+ {"eglQueryDisplayAttribANGLE", P(EGL_QueryDisplayAttribANGLE)},
+ {"eglQueryDisplayAttribEXT", P(EGL_QueryDisplayAttribEXT)},
+ {"eglQueryStreamKHR", P(EGL_QueryStreamKHR)},
+ {"eglQueryStreamu64KHR", P(EGL_QueryStreamu64KHR)},
+ {"eglQueryString", P(EGL_QueryString)},
+ {"eglQueryStringiANGLE", P(EGL_QueryStringiANGLE)},
+ {"eglQuerySurface", P(EGL_QuerySurface)},
+ {"eglQuerySurfacePointerANGLE", P(EGL_QuerySurfacePointerANGLE)},
+ {"eglReleaseDeviceANGLE", P(EGL_ReleaseDeviceANGLE)},
+ {"eglReleaseTexImage", P(EGL_ReleaseTexImage)},
+ {"eglReleaseThread", P(EGL_ReleaseThread)},
+ {"eglSetBlobCacheFuncsANDROID", P(EGL_SetBlobCacheFuncsANDROID)},
+ {"eglStreamAttribKHR", P(EGL_StreamAttribKHR)},
+ {"eglStreamConsumerAcquireKHR", P(EGL_StreamConsumerAcquireKHR)},
+ {"eglStreamConsumerGLTextureExternalAttribsNV",
+ P(EGL_StreamConsumerGLTextureExternalAttribsNV)},
+ {"eglStreamConsumerGLTextureExternalKHR", P(EGL_StreamConsumerGLTextureExternalKHR)},
+ {"eglStreamConsumerReleaseKHR", P(EGL_StreamConsumerReleaseKHR)},
+ {"eglStreamPostD3DTextureANGLE", P(EGL_StreamPostD3DTextureANGLE)},
+ {"eglSurfaceAttrib", P(EGL_SurfaceAttrib)},
+ {"eglSwapBuffers", P(EGL_SwapBuffers)},
+ {"eglSwapBuffersWithDamageKHR", P(EGL_SwapBuffersWithDamageKHR)},
+ {"eglSwapInterval", P(EGL_SwapInterval)},
+ {"eglTerminate", P(EGL_Terminate)},
+ {"eglWaitClient", P(EGL_WaitClient)},
+ {"eglWaitGL", P(EGL_WaitGL)},
+ {"eglWaitNative", P(EGL_WaitNative)},
+ {"eglWaitSync", P(EGL_WaitSync)},
+ {"eglWaitSyncKHR", P(EGL_WaitSyncKHR)},
+ {"glActiveShaderProgram", P(gl::ActiveShaderProgram)},
+ {"glActiveShaderProgramContextANGLE", P(gl::ActiveShaderProgramContextANGLE)},
+ {"glActiveTexture", P(gl::ActiveTexture)},
+ {"glActiveTextureContextANGLE", P(gl::ActiveTextureContextANGLE)},
+ {"glAlphaFunc", P(gl::AlphaFunc)},
+ {"glAlphaFuncContextANGLE", P(gl::AlphaFuncContextANGLE)},
+ {"glAlphaFuncx", P(gl::AlphaFuncx)},
+ {"glAlphaFuncxContextANGLE", P(gl::AlphaFuncxContextANGLE)},
+ {"glAttachShader", P(gl::AttachShader)},
+ {"glAttachShaderContextANGLE", P(gl::AttachShaderContextANGLE)},
+ {"glBeginQuery", P(gl::BeginQuery)},
+ {"glBeginQueryContextANGLE", P(gl::BeginQueryContextANGLE)},
+ {"glBeginQueryEXT", P(gl::BeginQueryEXT)},
+ {"glBeginQueryEXTContextANGLE", P(gl::BeginQueryEXTContextANGLE)},
+ {"glBeginTransformFeedback", P(gl::BeginTransformFeedback)},
+ {"glBeginTransformFeedbackContextANGLE", P(gl::BeginTransformFeedbackContextANGLE)},
+ {"glBindAttribLocation", P(gl::BindAttribLocation)},
+ {"glBindAttribLocationContextANGLE", P(gl::BindAttribLocationContextANGLE)},
+ {"glBindBuffer", P(gl::BindBuffer)},
+ {"glBindBufferBase", P(gl::BindBufferBase)},
+ {"glBindBufferBaseContextANGLE", P(gl::BindBufferBaseContextANGLE)},
+ {"glBindBufferContextANGLE", P(gl::BindBufferContextANGLE)},
+ {"glBindBufferRange", P(gl::BindBufferRange)},
+ {"glBindBufferRangeContextANGLE", P(gl::BindBufferRangeContextANGLE)},
+ {"glBindFragDataLocationEXT", P(gl::BindFragDataLocationEXT)},
+ {"glBindFragDataLocationEXTContextANGLE", P(gl::BindFragDataLocationEXTContextANGLE)},
+ {"glBindFragDataLocationIndexedEXT", P(gl::BindFragDataLocationIndexedEXT)},
+ {"glBindFragDataLocationIndexedEXTContextANGLE",
+ P(gl::BindFragDataLocationIndexedEXTContextANGLE)},
+ {"glBindFragmentInputLocationCHROMIUM", P(gl::BindFragmentInputLocationCHROMIUM)},
+ {"glBindFragmentInputLocationCHROMIUMContextANGLE",
+ P(gl::BindFragmentInputLocationCHROMIUMContextANGLE)},
+ {"glBindFramebuffer", P(gl::BindFramebuffer)},
+ {"glBindFramebufferContextANGLE", P(gl::BindFramebufferContextANGLE)},
+ {"glBindFramebufferOES", P(gl::BindFramebufferOES)},
+ {"glBindFramebufferOESContextANGLE", P(gl::BindFramebufferOESContextANGLE)},
+ {"glBindImageTexture", P(gl::BindImageTexture)},
+ {"glBindImageTextureContextANGLE", P(gl::BindImageTextureContextANGLE)},
+ {"glBindProgramPipeline", P(gl::BindProgramPipeline)},
+ {"glBindProgramPipelineContextANGLE", P(gl::BindProgramPipelineContextANGLE)},
+ {"glBindRenderbuffer", P(gl::BindRenderbuffer)},
+ {"glBindRenderbufferContextANGLE", P(gl::BindRenderbufferContextANGLE)},
+ {"glBindRenderbufferOES", P(gl::BindRenderbufferOES)},
+ {"glBindRenderbufferOESContextANGLE", P(gl::BindRenderbufferOESContextANGLE)},
+ {"glBindSampler", P(gl::BindSampler)},
+ {"glBindSamplerContextANGLE", P(gl::BindSamplerContextANGLE)},
+ {"glBindTexture", P(gl::BindTexture)},
+ {"glBindTextureContextANGLE", P(gl::BindTextureContextANGLE)},
+ {"glBindTransformFeedback", P(gl::BindTransformFeedback)},
+ {"glBindTransformFeedbackContextANGLE", P(gl::BindTransformFeedbackContextANGLE)},
+ {"glBindUniformLocationCHROMIUM", P(gl::BindUniformLocationCHROMIUM)},
+ {"glBindUniformLocationCHROMIUMContextANGLE", P(gl::BindUniformLocationCHROMIUMContextANGLE)},
+ {"glBindVertexArray", P(gl::BindVertexArray)},
+ {"glBindVertexArrayContextANGLE", P(gl::BindVertexArrayContextANGLE)},
+ {"glBindVertexArrayOES", P(gl::BindVertexArrayOES)},
+ {"glBindVertexArrayOESContextANGLE", P(gl::BindVertexArrayOESContextANGLE)},
+ {"glBindVertexBuffer", P(gl::BindVertexBuffer)},
+ {"glBindVertexBufferContextANGLE", P(gl::BindVertexBufferContextANGLE)},
+ {"glBlendColor", P(gl::BlendColor)},
+ {"glBlendColorContextANGLE", P(gl::BlendColorContextANGLE)},
+ {"glBlendEquation", P(gl::BlendEquation)},
+ {"glBlendEquationContextANGLE", P(gl::BlendEquationContextANGLE)},
+ {"glBlendEquationSeparate", P(gl::BlendEquationSeparate)},
+ {"glBlendEquationSeparateContextANGLE", P(gl::BlendEquationSeparateContextANGLE)},
+ {"glBlendFunc", P(gl::BlendFunc)},
+ {"glBlendFuncContextANGLE", P(gl::BlendFuncContextANGLE)},
+ {"glBlendFuncSeparate", P(gl::BlendFuncSeparate)},
+ {"glBlendFuncSeparateContextANGLE", P(gl::BlendFuncSeparateContextANGLE)},
+ {"glBlitFramebuffer", P(gl::BlitFramebuffer)},
+ {"glBlitFramebufferANGLE", P(gl::BlitFramebufferANGLE)},
+ {"glBlitFramebufferANGLEContextANGLE", P(gl::BlitFramebufferANGLEContextANGLE)},
+ {"glBlitFramebufferContextANGLE", P(gl::BlitFramebufferContextANGLE)},
+ {"glBufferData", P(gl::BufferData)},
+ {"glBufferDataContextANGLE", P(gl::BufferDataContextANGLE)},
+ {"glBufferStorageMemEXT", P(gl::BufferStorageMemEXT)},
+ {"glBufferStorageMemEXTContextANGLE", P(gl::BufferStorageMemEXTContextANGLE)},
+ {"glBufferSubData", P(gl::BufferSubData)},
+ {"glBufferSubDataContextANGLE", P(gl::BufferSubDataContextANGLE)},
+ {"glCheckFramebufferStatus", P(gl::CheckFramebufferStatus)},
+ {"glCheckFramebufferStatusContextANGLE", P(gl::CheckFramebufferStatusContextANGLE)},
+ {"glCheckFramebufferStatusOES", P(gl::CheckFramebufferStatusOES)},
+ {"glCheckFramebufferStatusOESContextANGLE", P(gl::CheckFramebufferStatusOESContextANGLE)},
+ {"glClear", P(gl::Clear)},
+ {"glClearBufferfi", P(gl::ClearBufferfi)},
+ {"glClearBufferfiContextANGLE", P(gl::ClearBufferfiContextANGLE)},
+ {"glClearBufferfv", P(gl::ClearBufferfv)},
+ {"glClearBufferfvContextANGLE", P(gl::ClearBufferfvContextANGLE)},
+ {"glClearBufferiv", P(gl::ClearBufferiv)},
+ {"glClearBufferivContextANGLE", P(gl::ClearBufferivContextANGLE)},
+ {"glClearBufferuiv", P(gl::ClearBufferuiv)},
+ {"glClearBufferuivContextANGLE", P(gl::ClearBufferuivContextANGLE)},
+ {"glClearColor", P(gl::ClearColor)},
+ {"glClearColorContextANGLE", P(gl::ClearColorContextANGLE)},
+ {"glClearColorx", P(gl::ClearColorx)},
+ {"glClearColorxContextANGLE", P(gl::ClearColorxContextANGLE)},
+ {"glClearContextANGLE", P(gl::ClearContextANGLE)},
+ {"glClearDepthf", P(gl::ClearDepthf)},
+ {"glClearDepthfContextANGLE", P(gl::ClearDepthfContextANGLE)},
+ {"glClearDepthx", P(gl::ClearDepthx)},
+ {"glClearDepthxContextANGLE", P(gl::ClearDepthxContextANGLE)},
+ {"glClearStencil", P(gl::ClearStencil)},
+ {"glClearStencilContextANGLE", P(gl::ClearStencilContextANGLE)},
+ {"glClientActiveTexture", P(gl::ClientActiveTexture)},
+ {"glClientActiveTextureContextANGLE", P(gl::ClientActiveTextureContextANGLE)},
+ {"glClientWaitSync", P(gl::ClientWaitSync)},
+ {"glClientWaitSyncContextANGLE", P(gl::ClientWaitSyncContextANGLE)},
+ {"glClipPlanef", P(gl::ClipPlanef)},
+ {"glClipPlanefContextANGLE", P(gl::ClipPlanefContextANGLE)},
+ {"glClipPlanex", P(gl::ClipPlanex)},
+ {"glClipPlanexContextANGLE", P(gl::ClipPlanexContextANGLE)},
+ {"glColor4f", P(gl::Color4f)},
+ {"glColor4fContextANGLE", P(gl::Color4fContextANGLE)},
+ {"glColor4ub", P(gl::Color4ub)},
+ {"glColor4ubContextANGLE", P(gl::Color4ubContextANGLE)},
+ {"glColor4x", P(gl::Color4x)},
+ {"glColor4xContextANGLE", P(gl::Color4xContextANGLE)},
+ {"glColorMask", P(gl::ColorMask)},
+ {"glColorMaskContextANGLE", P(gl::ColorMaskContextANGLE)},
+ {"glColorPointer", P(gl::ColorPointer)},
+ {"glColorPointerContextANGLE", P(gl::ColorPointerContextANGLE)},
+ {"glCompileShader", P(gl::CompileShader)},
+ {"glCompileShaderContextANGLE", P(gl::CompileShaderContextANGLE)},
+ {"glCompressedCopyTextureCHROMIUM", P(gl::CompressedCopyTextureCHROMIUM)},
+ {"glCompressedCopyTextureCHROMIUMContextANGLE",
+ P(gl::CompressedCopyTextureCHROMIUMContextANGLE)},
+ {"glCompressedTexImage2D", P(gl::CompressedTexImage2D)},
+ {"glCompressedTexImage2DContextANGLE", P(gl::CompressedTexImage2DContextANGLE)},
+ {"glCompressedTexImage2DRobustANGLE", P(gl::CompressedTexImage2DRobustANGLE)},
+ {"glCompressedTexImage2DRobustANGLEContextANGLE",
+ P(gl::CompressedTexImage2DRobustANGLEContextANGLE)},
+ {"glCompressedTexImage3D", P(gl::CompressedTexImage3D)},
+ {"glCompressedTexImage3DContextANGLE", P(gl::CompressedTexImage3DContextANGLE)},
+ {"glCompressedTexImage3DOES", P(gl::CompressedTexImage3DOES)},
+ {"glCompressedTexImage3DOESContextANGLE", P(gl::CompressedTexImage3DOESContextANGLE)},
+ {"glCompressedTexImage3DRobustANGLE", P(gl::CompressedTexImage3DRobustANGLE)},
+ {"glCompressedTexImage3DRobustANGLEContextANGLE",
+ P(gl::CompressedTexImage3DRobustANGLEContextANGLE)},
+ {"glCompressedTexSubImage2D", P(gl::CompressedTexSubImage2D)},
+ {"glCompressedTexSubImage2DContextANGLE", P(gl::CompressedTexSubImage2DContextANGLE)},
+ {"glCompressedTexSubImage2DRobustANGLE", P(gl::CompressedTexSubImage2DRobustANGLE)},
+ {"glCompressedTexSubImage2DRobustANGLEContextANGLE",
+ P(gl::CompressedTexSubImage2DRobustANGLEContextANGLE)},
+ {"glCompressedTexSubImage3D", P(gl::CompressedTexSubImage3D)},
+ {"glCompressedTexSubImage3DContextANGLE", P(gl::CompressedTexSubImage3DContextANGLE)},
+ {"glCompressedTexSubImage3DOES", P(gl::CompressedTexSubImage3DOES)},
+ {"glCompressedTexSubImage3DOESContextANGLE", P(gl::CompressedTexSubImage3DOESContextANGLE)},
+ {"glCompressedTexSubImage3DRobustANGLE", P(gl::CompressedTexSubImage3DRobustANGLE)},
+ {"glCompressedTexSubImage3DRobustANGLEContextANGLE",
+ P(gl::CompressedTexSubImage3DRobustANGLEContextANGLE)},
+ {"glCopyBufferSubData", P(gl::CopyBufferSubData)},
+ {"glCopyBufferSubDataContextANGLE", P(gl::CopyBufferSubDataContextANGLE)},
+ {"glCopySubTexture3DANGLE", P(gl::CopySubTexture3DANGLE)},
+ {"glCopySubTexture3DANGLEContextANGLE", P(gl::CopySubTexture3DANGLEContextANGLE)},
+ {"glCopySubTextureCHROMIUM", P(gl::CopySubTextureCHROMIUM)},
+ {"glCopySubTextureCHROMIUMContextANGLE", P(gl::CopySubTextureCHROMIUMContextANGLE)},
+ {"glCopyTexImage2D", P(gl::CopyTexImage2D)},
+ {"glCopyTexImage2DContextANGLE", P(gl::CopyTexImage2DContextANGLE)},
+ {"glCopyTexSubImage2D", P(gl::CopyTexSubImage2D)},
+ {"glCopyTexSubImage2DContextANGLE", P(gl::CopyTexSubImage2DContextANGLE)},
+ {"glCopyTexSubImage3D", P(gl::CopyTexSubImage3D)},
+ {"glCopyTexSubImage3DContextANGLE", P(gl::CopyTexSubImage3DContextANGLE)},
+ {"glCopyTexSubImage3DOES", P(gl::CopyTexSubImage3DOES)},
+ {"glCopyTexSubImage3DOESContextANGLE", P(gl::CopyTexSubImage3DOESContextANGLE)},
+ {"glCopyTexture3DANGLE", P(gl::CopyTexture3DANGLE)},
+ {"glCopyTexture3DANGLEContextANGLE", P(gl::CopyTexture3DANGLEContextANGLE)},
+ {"glCopyTextureCHROMIUM", P(gl::CopyTextureCHROMIUM)},
+ {"glCopyTextureCHROMIUMContextANGLE", P(gl::CopyTextureCHROMIUMContextANGLE)},
+ {"glCoverFillPathCHROMIUM", P(gl::CoverFillPathCHROMIUM)},
+ {"glCoverFillPathCHROMIUMContextANGLE", P(gl::CoverFillPathCHROMIUMContextANGLE)},
+ {"glCoverFillPathInstancedCHROMIUM", P(gl::CoverFillPathInstancedCHROMIUM)},
+ {"glCoverFillPathInstancedCHROMIUMContextANGLE",
+ P(gl::CoverFillPathInstancedCHROMIUMContextANGLE)},
+ {"glCoverStrokePathCHROMIUM", P(gl::CoverStrokePathCHROMIUM)},
+ {"glCoverStrokePathCHROMIUMContextANGLE", P(gl::CoverStrokePathCHROMIUMContextANGLE)},
+ {"glCoverStrokePathInstancedCHROMIUM", P(gl::CoverStrokePathInstancedCHROMIUM)},
+ {"glCoverStrokePathInstancedCHROMIUMContextANGLE",
+ P(gl::CoverStrokePathInstancedCHROMIUMContextANGLE)},
+ {"glCoverageModulationCHROMIUM", P(gl::CoverageModulationCHROMIUM)},
+ {"glCoverageModulationCHROMIUMContextANGLE", P(gl::CoverageModulationCHROMIUMContextANGLE)},
+ {"glCreateMemoryObjectsEXT", P(gl::CreateMemoryObjectsEXT)},
+ {"glCreateMemoryObjectsEXTContextANGLE", P(gl::CreateMemoryObjectsEXTContextANGLE)},
+ {"glCreateProgram", P(gl::CreateProgram)},
+ {"glCreateProgramContextANGLE", P(gl::CreateProgramContextANGLE)},
+ {"glCreateShader", P(gl::CreateShader)},
+ {"glCreateShaderContextANGLE", P(gl::CreateShaderContextANGLE)},
+ {"glCreateShaderProgramv", P(gl::CreateShaderProgramv)},
+ {"glCreateShaderProgramvContextANGLE", P(gl::CreateShaderProgramvContextANGLE)},
+ {"glCullFace", P(gl::CullFace)},
+ {"glCullFaceContextANGLE", P(gl::CullFaceContextANGLE)},
+ {"glCurrentPaletteMatrixOES", P(gl::CurrentPaletteMatrixOES)},
+ {"glCurrentPaletteMatrixOESContextANGLE", P(gl::CurrentPaletteMatrixOESContextANGLE)},
+ {"glDebugMessageCallbackKHR", P(gl::DebugMessageCallbackKHR)},
+ {"glDebugMessageCallbackKHRContextANGLE", P(gl::DebugMessageCallbackKHRContextANGLE)},
+ {"glDebugMessageControlKHR", P(gl::DebugMessageControlKHR)},
+ {"glDebugMessageControlKHRContextANGLE", P(gl::DebugMessageControlKHRContextANGLE)},
+ {"glDebugMessageInsertKHR", P(gl::DebugMessageInsertKHR)},
+ {"glDebugMessageInsertKHRContextANGLE", P(gl::DebugMessageInsertKHRContextANGLE)},
+ {"glDeleteBuffers", P(gl::DeleteBuffers)},
+ {"glDeleteBuffersContextANGLE", P(gl::DeleteBuffersContextANGLE)},
+ {"glDeleteFencesNV", P(gl::DeleteFencesNV)},
+ {"glDeleteFencesNVContextANGLE", P(gl::DeleteFencesNVContextANGLE)},
+ {"glDeleteFramebuffers", P(gl::DeleteFramebuffers)},
+ {"glDeleteFramebuffersContextANGLE", P(gl::DeleteFramebuffersContextANGLE)},
+ {"glDeleteFramebuffersOES", P(gl::DeleteFramebuffersOES)},
+ {"glDeleteFramebuffersOESContextANGLE", P(gl::DeleteFramebuffersOESContextANGLE)},
+ {"glDeleteMemoryObjectsEXT", P(gl::DeleteMemoryObjectsEXT)},
+ {"glDeleteMemoryObjectsEXTContextANGLE", P(gl::DeleteMemoryObjectsEXTContextANGLE)},
+ {"glDeletePathsCHROMIUM", P(gl::DeletePathsCHROMIUM)},
+ {"glDeletePathsCHROMIUMContextANGLE", P(gl::DeletePathsCHROMIUMContextANGLE)},
+ {"glDeleteProgram", P(gl::DeleteProgram)},
+ {"glDeleteProgramContextANGLE", P(gl::DeleteProgramContextANGLE)},
+ {"glDeleteProgramPipelines", P(gl::DeleteProgramPipelines)},
+ {"glDeleteProgramPipelinesContextANGLE", P(gl::DeleteProgramPipelinesContextANGLE)},
+ {"glDeleteQueries", P(gl::DeleteQueries)},
+ {"glDeleteQueriesContextANGLE", P(gl::DeleteQueriesContextANGLE)},
+ {"glDeleteQueriesEXT", P(gl::DeleteQueriesEXT)},
+ {"glDeleteQueriesEXTContextANGLE", P(gl::DeleteQueriesEXTContextANGLE)},
+ {"glDeleteRenderbuffers", P(gl::DeleteRenderbuffers)},
+ {"glDeleteRenderbuffersContextANGLE", P(gl::DeleteRenderbuffersContextANGLE)},
+ {"glDeleteRenderbuffersOES", P(gl::DeleteRenderbuffersOES)},
+ {"glDeleteRenderbuffersOESContextANGLE", P(gl::DeleteRenderbuffersOESContextANGLE)},
+ {"glDeleteSamplers", P(gl::DeleteSamplers)},
+ {"glDeleteSamplersContextANGLE", P(gl::DeleteSamplersContextANGLE)},
+ {"glDeleteSemaphoresEXT", P(gl::DeleteSemaphoresEXT)},
+ {"glDeleteSemaphoresEXTContextANGLE", P(gl::DeleteSemaphoresEXTContextANGLE)},
+ {"glDeleteShader", P(gl::DeleteShader)},
+ {"glDeleteShaderContextANGLE", P(gl::DeleteShaderContextANGLE)},
+ {"glDeleteSync", P(gl::DeleteSync)},
+ {"glDeleteSyncContextANGLE", P(gl::DeleteSyncContextANGLE)},
+ {"glDeleteTextures", P(gl::DeleteTextures)},
+ {"glDeleteTexturesContextANGLE", P(gl::DeleteTexturesContextANGLE)},
+ {"glDeleteTransformFeedbacks", P(gl::DeleteTransformFeedbacks)},
+ {"glDeleteTransformFeedbacksContextANGLE", P(gl::DeleteTransformFeedbacksContextANGLE)},
+ {"glDeleteVertexArrays", P(gl::DeleteVertexArrays)},
+ {"glDeleteVertexArraysContextANGLE", P(gl::DeleteVertexArraysContextANGLE)},
+ {"glDeleteVertexArraysOES", P(gl::DeleteVertexArraysOES)},
+ {"glDeleteVertexArraysOESContextANGLE", P(gl::DeleteVertexArraysOESContextANGLE)},
+ {"glDepthFunc", P(gl::DepthFunc)},
+ {"glDepthFuncContextANGLE", P(gl::DepthFuncContextANGLE)},
+ {"glDepthMask", P(gl::DepthMask)},
+ {"glDepthMaskContextANGLE", P(gl::DepthMaskContextANGLE)},
+ {"glDepthRangef", P(gl::DepthRangef)},
+ {"glDepthRangefContextANGLE", P(gl::DepthRangefContextANGLE)},
+ {"glDepthRangex", P(gl::DepthRangex)},
+ {"glDepthRangexContextANGLE", P(gl::DepthRangexContextANGLE)},
+ {"glDetachShader", P(gl::DetachShader)},
+ {"glDetachShaderContextANGLE", P(gl::DetachShaderContextANGLE)},
+ {"glDisable", P(gl::Disable)},
+ {"glDisableClientState", P(gl::DisableClientState)},
+ {"glDisableClientStateContextANGLE", P(gl::DisableClientStateContextANGLE)},
+ {"glDisableContextANGLE", P(gl::DisableContextANGLE)},
+ {"glDisableVertexAttribArray", P(gl::DisableVertexAttribArray)},
+ {"glDisableVertexAttribArrayContextANGLE", P(gl::DisableVertexAttribArrayContextANGLE)},
+ {"glDiscardFramebufferEXT", P(gl::DiscardFramebufferEXT)},
+ {"glDiscardFramebufferEXTContextANGLE", P(gl::DiscardFramebufferEXTContextANGLE)},
+ {"glDispatchCompute", P(gl::DispatchCompute)},
+ {"glDispatchComputeContextANGLE", P(gl::DispatchComputeContextANGLE)},
+ {"glDispatchComputeIndirect", P(gl::DispatchComputeIndirect)},
+ {"glDispatchComputeIndirectContextANGLE", P(gl::DispatchComputeIndirectContextANGLE)},
+ {"glDrawArrays", P(gl::DrawArrays)},
+ {"glDrawArraysContextANGLE", P(gl::DrawArraysContextANGLE)},
+ {"glDrawArraysIndirect", P(gl::DrawArraysIndirect)},
+ {"glDrawArraysIndirectContextANGLE", P(gl::DrawArraysIndirectContextANGLE)},
+ {"glDrawArraysInstanced", P(gl::DrawArraysInstanced)},
+ {"glDrawArraysInstancedANGLE", P(gl::DrawArraysInstancedANGLE)},
+ {"glDrawArraysInstancedANGLEContextANGLE", P(gl::DrawArraysInstancedANGLEContextANGLE)},
+ {"glDrawArraysInstancedContextANGLE", P(gl::DrawArraysInstancedContextANGLE)},
+ {"glDrawArraysInstancedEXT", P(gl::DrawArraysInstancedEXT)},
+ {"glDrawArraysInstancedEXTContextANGLE", P(gl::DrawArraysInstancedEXTContextANGLE)},
+ {"glDrawBuffers", P(gl::DrawBuffers)},
+ {"glDrawBuffersContextANGLE", P(gl::DrawBuffersContextANGLE)},
+ {"glDrawBuffersEXT", P(gl::DrawBuffersEXT)},
+ {"glDrawBuffersEXTContextANGLE", P(gl::DrawBuffersEXTContextANGLE)},
+ {"glDrawElements", P(gl::DrawElements)},
+ {"glDrawElementsContextANGLE", P(gl::DrawElementsContextANGLE)},
+ {"glDrawElementsIndirect", P(gl::DrawElementsIndirect)},
+ {"glDrawElementsIndirectContextANGLE", P(gl::DrawElementsIndirectContextANGLE)},
+ {"glDrawElementsInstanced", P(gl::DrawElementsInstanced)},
+ {"glDrawElementsInstancedANGLE", P(gl::DrawElementsInstancedANGLE)},
+ {"glDrawElementsInstancedANGLEContextANGLE", P(gl::DrawElementsInstancedANGLEContextANGLE)},
+ {"glDrawElementsInstancedContextANGLE", P(gl::DrawElementsInstancedContextANGLE)},
+ {"glDrawElementsInstancedEXT", P(gl::DrawElementsInstancedEXT)},
+ {"glDrawElementsInstancedEXTContextANGLE", P(gl::DrawElementsInstancedEXTContextANGLE)},
+ {"glDrawRangeElements", P(gl::DrawRangeElements)},
+ {"glDrawRangeElementsContextANGLE", P(gl::DrawRangeElementsContextANGLE)},
+ {"glDrawTexfOES", P(gl::DrawTexfOES)},
+ {"glDrawTexfOESContextANGLE", P(gl::DrawTexfOESContextANGLE)},
+ {"glDrawTexfvOES", P(gl::DrawTexfvOES)},
+ {"glDrawTexfvOESContextANGLE", P(gl::DrawTexfvOESContextANGLE)},
+ {"glDrawTexiOES", P(gl::DrawTexiOES)},
+ {"glDrawTexiOESContextANGLE", P(gl::DrawTexiOESContextANGLE)},
+ {"glDrawTexivOES", P(gl::DrawTexivOES)},
+ {"glDrawTexivOESContextANGLE", P(gl::DrawTexivOESContextANGLE)},
+ {"glDrawTexsOES", P(gl::DrawTexsOES)},
+ {"glDrawTexsOESContextANGLE", P(gl::DrawTexsOESContextANGLE)},
+ {"glDrawTexsvOES", P(gl::DrawTexsvOES)},
+ {"glDrawTexsvOESContextANGLE", P(gl::DrawTexsvOESContextANGLE)},
+ {"glDrawTexxOES", P(gl::DrawTexxOES)},
+ {"glDrawTexxOESContextANGLE", P(gl::DrawTexxOESContextANGLE)},
+ {"glDrawTexxvOES", P(gl::DrawTexxvOES)},
+ {"glDrawTexxvOESContextANGLE", P(gl::DrawTexxvOESContextANGLE)},
+ {"glEGLImageTargetRenderbufferStorageOES", P(gl::EGLImageTargetRenderbufferStorageOES)},
+ {"glEGLImageTargetRenderbufferStorageOESContextANGLE",
+ P(gl::EGLImageTargetRenderbufferStorageOESContextANGLE)},
+ {"glEGLImageTargetTexture2DOES", P(gl::EGLImageTargetTexture2DOES)},
+ {"glEGLImageTargetTexture2DOESContextANGLE", P(gl::EGLImageTargetTexture2DOESContextANGLE)},
+ {"glEnable", P(gl::Enable)},
+ {"glEnableClientState", P(gl::EnableClientState)},
+ {"glEnableClientStateContextANGLE", P(gl::EnableClientStateContextANGLE)},
+ {"glEnableContextANGLE", P(gl::EnableContextANGLE)},
+ {"glEnableVertexAttribArray", P(gl::EnableVertexAttribArray)},
+ {"glEnableVertexAttribArrayContextANGLE", P(gl::EnableVertexAttribArrayContextANGLE)},
+ {"glEndQuery", P(gl::EndQuery)},
+ {"glEndQueryContextANGLE", P(gl::EndQueryContextANGLE)},
+ {"glEndQueryEXT", P(gl::EndQueryEXT)},
+ {"glEndQueryEXTContextANGLE", P(gl::EndQueryEXTContextANGLE)},
+ {"glEndTransformFeedback", P(gl::EndTransformFeedback)},
+ {"glEndTransformFeedbackContextANGLE", P(gl::EndTransformFeedbackContextANGLE)},
+ {"glFenceSync", P(gl::FenceSync)},
+ {"glFenceSyncContextANGLE", P(gl::FenceSyncContextANGLE)},
+ {"glFinish", P(gl::Finish)},
+ {"glFinishContextANGLE", P(gl::FinishContextANGLE)},
+ {"glFinishFenceNV", P(gl::FinishFenceNV)},
+ {"glFinishFenceNVContextANGLE", P(gl::FinishFenceNVContextANGLE)},
+ {"glFlush", P(gl::Flush)},
+ {"glFlushContextANGLE", P(gl::FlushContextANGLE)},
+ {"glFlushMappedBufferRange", P(gl::FlushMappedBufferRange)},
+ {"glFlushMappedBufferRangeContextANGLE", P(gl::FlushMappedBufferRangeContextANGLE)},
+ {"glFlushMappedBufferRangeEXT", P(gl::FlushMappedBufferRangeEXT)},
+ {"glFlushMappedBufferRangeEXTContextANGLE", P(gl::FlushMappedBufferRangeEXTContextANGLE)},
+ {"glFogf", P(gl::Fogf)},
+ {"glFogfContextANGLE", P(gl::FogfContextANGLE)},
+ {"glFogfv", P(gl::Fogfv)},
+ {"glFogfvContextANGLE", P(gl::FogfvContextANGLE)},
+ {"glFogx", P(gl::Fogx)},
+ {"glFogxContextANGLE", P(gl::FogxContextANGLE)},
+ {"glFogxv", P(gl::Fogxv)},
+ {"glFogxvContextANGLE", P(gl::FogxvContextANGLE)},
+ {"glFramebufferParameteri", P(gl::FramebufferParameteri)},
+ {"glFramebufferParameteriContextANGLE", P(gl::FramebufferParameteriContextANGLE)},
+ {"glFramebufferRenderbuffer", P(gl::FramebufferRenderbuffer)},
+ {"glFramebufferRenderbufferContextANGLE", P(gl::FramebufferRenderbufferContextANGLE)},
+ {"glFramebufferRenderbufferOES", P(gl::FramebufferRenderbufferOES)},
+ {"glFramebufferRenderbufferOESContextANGLE", P(gl::FramebufferRenderbufferOESContextANGLE)},
+ {"glFramebufferTexture2D", P(gl::FramebufferTexture2D)},
+ {"glFramebufferTexture2DContextANGLE", P(gl::FramebufferTexture2DContextANGLE)},
+ {"glFramebufferTexture2DOES", P(gl::FramebufferTexture2DOES)},
+ {"glFramebufferTexture2DOESContextANGLE", P(gl::FramebufferTexture2DOESContextANGLE)},
+ {"glFramebufferTexture3DOES", P(gl::FramebufferTexture3DOES)},
+ {"glFramebufferTexture3DOESContextANGLE", P(gl::FramebufferTexture3DOESContextANGLE)},
+ {"glFramebufferTextureEXT", P(gl::FramebufferTextureEXT)},
+ {"glFramebufferTextureEXTContextANGLE", P(gl::FramebufferTextureEXTContextANGLE)},
+ {"glFramebufferTextureLayer", P(gl::FramebufferTextureLayer)},
+ {"glFramebufferTextureLayerContextANGLE", P(gl::FramebufferTextureLayerContextANGLE)},
+ {"glFramebufferTextureMultiviewOVR", P(gl::FramebufferTextureMultiviewOVR)},
+ {"glFramebufferTextureMultiviewOVRContextANGLE",
+ P(gl::FramebufferTextureMultiviewOVRContextANGLE)},
+ {"glFrontFace", P(gl::FrontFace)},
+ {"glFrontFaceContextANGLE", P(gl::FrontFaceContextANGLE)},
+ {"glFrustumf", P(gl::Frustumf)},
+ {"glFrustumfContextANGLE", P(gl::FrustumfContextANGLE)},
+ {"glFrustumx", P(gl::Frustumx)},
+ {"glFrustumxContextANGLE", P(gl::FrustumxContextANGLE)},
+ {"glGenBuffers", P(gl::GenBuffers)},
+ {"glGenBuffersContextANGLE", P(gl::GenBuffersContextANGLE)},
+ {"glGenFencesNV", P(gl::GenFencesNV)},
+ {"glGenFencesNVContextANGLE", P(gl::GenFencesNVContextANGLE)},
+ {"glGenFramebuffers", P(gl::GenFramebuffers)},
+ {"glGenFramebuffersContextANGLE", P(gl::GenFramebuffersContextANGLE)},
+ {"glGenFramebuffersOES", P(gl::GenFramebuffersOES)},
+ {"glGenFramebuffersOESContextANGLE", P(gl::GenFramebuffersOESContextANGLE)},
+ {"glGenPathsCHROMIUM", P(gl::GenPathsCHROMIUM)},
+ {"glGenPathsCHROMIUMContextANGLE", P(gl::GenPathsCHROMIUMContextANGLE)},
+ {"glGenProgramPipelines", P(gl::GenProgramPipelines)},
+ {"glGenProgramPipelinesContextANGLE", P(gl::GenProgramPipelinesContextANGLE)},
+ {"glGenQueries", P(gl::GenQueries)},
+ {"glGenQueriesContextANGLE", P(gl::GenQueriesContextANGLE)},
+ {"glGenQueriesEXT", P(gl::GenQueriesEXT)},
+ {"glGenQueriesEXTContextANGLE", P(gl::GenQueriesEXTContextANGLE)},
+ {"glGenRenderbuffers", P(gl::GenRenderbuffers)},
+ {"glGenRenderbuffersContextANGLE", P(gl::GenRenderbuffersContextANGLE)},
+ {"glGenRenderbuffersOES", P(gl::GenRenderbuffersOES)},
+ {"glGenRenderbuffersOESContextANGLE", P(gl::GenRenderbuffersOESContextANGLE)},
+ {"glGenSamplers", P(gl::GenSamplers)},
+ {"glGenSamplersContextANGLE", P(gl::GenSamplersContextANGLE)},
+ {"glGenSemaphoresEXT", P(gl::GenSemaphoresEXT)},
+ {"glGenSemaphoresEXTContextANGLE", P(gl::GenSemaphoresEXTContextANGLE)},
+ {"glGenTextures", P(gl::GenTextures)},
+ {"glGenTexturesContextANGLE", P(gl::GenTexturesContextANGLE)},
+ {"glGenTransformFeedbacks", P(gl::GenTransformFeedbacks)},
+ {"glGenTransformFeedbacksContextANGLE", P(gl::GenTransformFeedbacksContextANGLE)},
+ {"glGenVertexArrays", P(gl::GenVertexArrays)},
+ {"glGenVertexArraysContextANGLE", P(gl::GenVertexArraysContextANGLE)},
+ {"glGenVertexArraysOES", P(gl::GenVertexArraysOES)},
+ {"glGenVertexArraysOESContextANGLE", P(gl::GenVertexArraysOESContextANGLE)},
+ {"glGenerateMipmap", P(gl::GenerateMipmap)},
+ {"glGenerateMipmapContextANGLE", P(gl::GenerateMipmapContextANGLE)},
+ {"glGenerateMipmapOES", P(gl::GenerateMipmapOES)},
+ {"glGenerateMipmapOESContextANGLE", P(gl::GenerateMipmapOESContextANGLE)},
+ {"glGetActiveAttrib", P(gl::GetActiveAttrib)},
+ {"glGetActiveAttribContextANGLE", P(gl::GetActiveAttribContextANGLE)},
+ {"glGetActiveUniform", P(gl::GetActiveUniform)},
+ {"glGetActiveUniformBlockName", P(gl::GetActiveUniformBlockName)},
+ {"glGetActiveUniformBlockNameContextANGLE", P(gl::GetActiveUniformBlockNameContextANGLE)},
+ {"glGetActiveUniformBlockiv", P(gl::GetActiveUniformBlockiv)},
+ {"glGetActiveUniformBlockivContextANGLE", P(gl::GetActiveUniformBlockivContextANGLE)},
+ {"glGetActiveUniformBlockivRobustANGLE", P(gl::GetActiveUniformBlockivRobustANGLE)},
+ {"glGetActiveUniformBlockivRobustANGLEContextANGLE",
+ P(gl::GetActiveUniformBlockivRobustANGLEContextANGLE)},
+ {"glGetActiveUniformContextANGLE", P(gl::GetActiveUniformContextANGLE)},
+ {"glGetActiveUniformsiv", P(gl::GetActiveUniformsiv)},
+ {"glGetActiveUniformsivContextANGLE", P(gl::GetActiveUniformsivContextANGLE)},
+ {"glGetAttachedShaders", P(gl::GetAttachedShaders)},
+ {"glGetAttachedShadersContextANGLE", P(gl::GetAttachedShadersContextANGLE)},
+ {"glGetAttribLocation", P(gl::GetAttribLocation)},
+ {"glGetAttribLocationContextANGLE", P(gl::GetAttribLocationContextANGLE)},
+ {"glGetBooleani_v", P(gl::GetBooleani_v)},
+ {"glGetBooleani_vContextANGLE", P(gl::GetBooleani_vContextANGLE)},
+ {"glGetBooleani_vRobustANGLE", P(gl::GetBooleani_vRobustANGLE)},
+ {"glGetBooleani_vRobustANGLEContextANGLE", P(gl::GetBooleani_vRobustANGLEContextANGLE)},
+ {"glGetBooleanv", P(gl::GetBooleanv)},
+ {"glGetBooleanvContextANGLE", P(gl::GetBooleanvContextANGLE)},
+ {"glGetBooleanvRobustANGLE", P(gl::GetBooleanvRobustANGLE)},
+ {"glGetBooleanvRobustANGLEContextANGLE", P(gl::GetBooleanvRobustANGLEContextANGLE)},
+ {"glGetBufferParameteri64v", P(gl::GetBufferParameteri64v)},
+ {"glGetBufferParameteri64vContextANGLE", P(gl::GetBufferParameteri64vContextANGLE)},
+ {"glGetBufferParameteri64vRobustANGLE", P(gl::GetBufferParameteri64vRobustANGLE)},
+ {"glGetBufferParameteri64vRobustANGLEContextANGLE",
+ P(gl::GetBufferParameteri64vRobustANGLEContextANGLE)},
+ {"glGetBufferParameteriv", P(gl::GetBufferParameteriv)},
+ {"glGetBufferParameterivContextANGLE", P(gl::GetBufferParameterivContextANGLE)},
+ {"glGetBufferParameterivRobustANGLE", P(gl::GetBufferParameterivRobustANGLE)},
+ {"glGetBufferParameterivRobustANGLEContextANGLE",
+ P(gl::GetBufferParameterivRobustANGLEContextANGLE)},
+ {"glGetBufferPointerv", P(gl::GetBufferPointerv)},
+ {"glGetBufferPointervContextANGLE", P(gl::GetBufferPointervContextANGLE)},
+ {"glGetBufferPointervOES", P(gl::GetBufferPointervOES)},
+ {"glGetBufferPointervOESContextANGLE", P(gl::GetBufferPointervOESContextANGLE)},
+ {"glGetBufferPointervRobustANGLE", P(gl::GetBufferPointervRobustANGLE)},
+ {"glGetBufferPointervRobustANGLEContextANGLE", P(gl::GetBufferPointervRobustANGLEContextANGLE)},
+ {"glGetClipPlanef", P(gl::GetClipPlanef)},
+ {"glGetClipPlanefContextANGLE", P(gl::GetClipPlanefContextANGLE)},
+ {"glGetClipPlanex", P(gl::GetClipPlanex)},
+ {"glGetClipPlanexContextANGLE", P(gl::GetClipPlanexContextANGLE)},
+ {"glGetDebugMessageLogKHR", P(gl::GetDebugMessageLogKHR)},
+ {"glGetDebugMessageLogKHRContextANGLE", P(gl::GetDebugMessageLogKHRContextANGLE)},
+ {"glGetError", P(gl::GetError)},
+ {"glGetErrorContextANGLE", P(gl::GetErrorContextANGLE)},
+ {"glGetFenceivNV", P(gl::GetFenceivNV)},
+ {"glGetFenceivNVContextANGLE", P(gl::GetFenceivNVContextANGLE)},
+ {"glGetFixedv", P(gl::GetFixedv)},
+ {"glGetFixedvContextANGLE", P(gl::GetFixedvContextANGLE)},
+ {"glGetFloatv", P(gl::GetFloatv)},
+ {"glGetFloatvContextANGLE", P(gl::GetFloatvContextANGLE)},
+ {"glGetFloatvRobustANGLE", P(gl::GetFloatvRobustANGLE)},
+ {"glGetFloatvRobustANGLEContextANGLE", P(gl::GetFloatvRobustANGLEContextANGLE)},
+ {"glGetFragDataIndexEXT", P(gl::GetFragDataIndexEXT)},
+ {"glGetFragDataIndexEXTContextANGLE", P(gl::GetFragDataIndexEXTContextANGLE)},
+ {"glGetFragDataLocation", P(gl::GetFragDataLocation)},
+ {"glGetFragDataLocationContextANGLE", P(gl::GetFragDataLocationContextANGLE)},
+ {"glGetFramebufferAttachmentParameteriv", P(gl::GetFramebufferAttachmentParameteriv)},
+ {"glGetFramebufferAttachmentParameterivContextANGLE",
+ P(gl::GetFramebufferAttachmentParameterivContextANGLE)},
+ {"glGetFramebufferAttachmentParameterivOES", P(gl::GetFramebufferAttachmentParameterivOES)},
+ {"glGetFramebufferAttachmentParameterivOESContextANGLE",
+ P(gl::GetFramebufferAttachmentParameterivOESContextANGLE)},
+ {"glGetFramebufferAttachmentParameterivRobustANGLE",
+ P(gl::GetFramebufferAttachmentParameterivRobustANGLE)},
+ {"glGetFramebufferAttachmentParameterivRobustANGLEContextANGLE",
+ P(gl::GetFramebufferAttachmentParameterivRobustANGLEContextANGLE)},
+ {"glGetFramebufferParameteriv", P(gl::GetFramebufferParameteriv)},
+ {"glGetFramebufferParameterivContextANGLE", P(gl::GetFramebufferParameterivContextANGLE)},
+ {"glGetFramebufferParameterivRobustANGLE", P(gl::GetFramebufferParameterivRobustANGLE)},
+ {"glGetFramebufferParameterivRobustANGLEContextANGLE",
+ P(gl::GetFramebufferParameterivRobustANGLEContextANGLE)},
+ {"glGetGraphicsResetStatusEXT", P(gl::GetGraphicsResetStatusEXT)},
+ {"glGetGraphicsResetStatusEXTContextANGLE", P(gl::GetGraphicsResetStatusEXTContextANGLE)},
+ {"glGetInteger64i_v", P(gl::GetInteger64i_v)},
+ {"glGetInteger64i_vContextANGLE", P(gl::GetInteger64i_vContextANGLE)},
+ {"glGetInteger64i_vRobustANGLE", P(gl::GetInteger64i_vRobustANGLE)},
+ {"glGetInteger64i_vRobustANGLEContextANGLE", P(gl::GetInteger64i_vRobustANGLEContextANGLE)},
+ {"glGetInteger64v", P(gl::GetInteger64v)},
+ {"glGetInteger64vContextANGLE", P(gl::GetInteger64vContextANGLE)},
+ {"glGetInteger64vRobustANGLE", P(gl::GetInteger64vRobustANGLE)},
+ {"glGetInteger64vRobustANGLEContextANGLE", P(gl::GetInteger64vRobustANGLEContextANGLE)},
+ {"glGetIntegeri_v", P(gl::GetIntegeri_v)},
+ {"glGetIntegeri_vContextANGLE", P(gl::GetIntegeri_vContextANGLE)},
+ {"glGetIntegeri_vRobustANGLE", P(gl::GetIntegeri_vRobustANGLE)},
+ {"glGetIntegeri_vRobustANGLEContextANGLE", P(gl::GetIntegeri_vRobustANGLEContextANGLE)},
+ {"glGetIntegerv", P(gl::GetIntegerv)},
+ {"glGetIntegervContextANGLE", P(gl::GetIntegervContextANGLE)},
+ {"glGetIntegervRobustANGLE", P(gl::GetIntegervRobustANGLE)},
+ {"glGetIntegervRobustANGLEContextANGLE", P(gl::GetIntegervRobustANGLEContextANGLE)},
+ {"glGetInternalformativ", P(gl::GetInternalformativ)},
+ {"glGetInternalformativContextANGLE", P(gl::GetInternalformativContextANGLE)},
+ {"glGetInternalformativRobustANGLE", P(gl::GetInternalformativRobustANGLE)},
+ {"glGetInternalformativRobustANGLEContextANGLE",
+ P(gl::GetInternalformativRobustANGLEContextANGLE)},
+ {"glGetLightfv", P(gl::GetLightfv)},
+ {"glGetLightfvContextANGLE", P(gl::GetLightfvContextANGLE)},
+ {"glGetLightxv", P(gl::GetLightxv)},
+ {"glGetLightxvContextANGLE", P(gl::GetLightxvContextANGLE)},
+ {"glGetMaterialfv", P(gl::GetMaterialfv)},
+ {"glGetMaterialfvContextANGLE", P(gl::GetMaterialfvContextANGLE)},
+ {"glGetMaterialxv", P(gl::GetMaterialxv)},
+ {"glGetMaterialxvContextANGLE", P(gl::GetMaterialxvContextANGLE)},
+ {"glGetMemoryObjectParameterivEXT", P(gl::GetMemoryObjectParameterivEXT)},
+ {"glGetMemoryObjectParameterivEXTContextANGLE",
+ P(gl::GetMemoryObjectParameterivEXTContextANGLE)},
+ {"glGetMultisamplefv", P(gl::GetMultisamplefv)},
+ {"glGetMultisamplefvANGLE", P(gl::GetMultisamplefvANGLE)},
+ {"glGetMultisamplefvANGLEContextANGLE", P(gl::GetMultisamplefvANGLEContextANGLE)},
+ {"glGetMultisamplefvContextANGLE", P(gl::GetMultisamplefvContextANGLE)},
+ {"glGetMultisamplefvRobustANGLE", P(gl::GetMultisamplefvRobustANGLE)},
+ {"glGetMultisamplefvRobustANGLEContextANGLE", P(gl::GetMultisamplefvRobustANGLEContextANGLE)},
+ {"glGetObjectLabelKHR", P(gl::GetObjectLabelKHR)},
+ {"glGetObjectLabelKHRContextANGLE", P(gl::GetObjectLabelKHRContextANGLE)},
+ {"glGetObjectPtrLabelKHR", P(gl::GetObjectPtrLabelKHR)},
+ {"glGetObjectPtrLabelKHRContextANGLE", P(gl::GetObjectPtrLabelKHRContextANGLE)},
+ {"glGetPathParameterfvCHROMIUM", P(gl::GetPathParameterfvCHROMIUM)},
+ {"glGetPathParameterfvCHROMIUMContextANGLE", P(gl::GetPathParameterfvCHROMIUMContextANGLE)},
+ {"glGetPathParameterivCHROMIUM", P(gl::GetPathParameterivCHROMIUM)},
+ {"glGetPathParameterivCHROMIUMContextANGLE", P(gl::GetPathParameterivCHROMIUMContextANGLE)},
+ {"glGetPointerv", P(gl::GetPointerv)},
+ {"glGetPointervContextANGLE", P(gl::GetPointervContextANGLE)},
+ {"glGetPointervKHR", P(gl::GetPointervKHR)},
+ {"glGetPointervKHRContextANGLE", P(gl::GetPointervKHRContextANGLE)},
+ {"glGetPointervRobustANGLERobustANGLE", P(gl::GetPointervRobustANGLERobustANGLE)},
+ {"glGetPointervRobustANGLERobustANGLEContextANGLE",
+ P(gl::GetPointervRobustANGLERobustANGLEContextANGLE)},
+ {"glGetProgramBinary", P(gl::GetProgramBinary)},
+ {"glGetProgramBinaryContextANGLE", P(gl::GetProgramBinaryContextANGLE)},
+ {"glGetProgramBinaryOES", P(gl::GetProgramBinaryOES)},
+ {"glGetProgramBinaryOESContextANGLE", P(gl::GetProgramBinaryOESContextANGLE)},
+ {"glGetProgramInfoLog", P(gl::GetProgramInfoLog)},
+ {"glGetProgramInfoLogContextANGLE", P(gl::GetProgramInfoLogContextANGLE)},
+ {"glGetProgramInterfaceiv", P(gl::GetProgramInterfaceiv)},
+ {"glGetProgramInterfaceivContextANGLE", P(gl::GetProgramInterfaceivContextANGLE)},
+ {"glGetProgramInterfaceivRobustANGLE", P(gl::GetProgramInterfaceivRobustANGLE)},
+ {"glGetProgramInterfaceivRobustANGLEContextANGLE",
+ P(gl::GetProgramInterfaceivRobustANGLEContextANGLE)},
+ {"glGetProgramPipelineInfoLog", P(gl::GetProgramPipelineInfoLog)},
+ {"glGetProgramPipelineInfoLogContextANGLE", P(gl::GetProgramPipelineInfoLogContextANGLE)},
+ {"glGetProgramPipelineiv", P(gl::GetProgramPipelineiv)},
+ {"glGetProgramPipelineivContextANGLE", P(gl::GetProgramPipelineivContextANGLE)},
+ {"glGetProgramResourceIndex", P(gl::GetProgramResourceIndex)},
+ {"glGetProgramResourceIndexContextANGLE", P(gl::GetProgramResourceIndexContextANGLE)},
+ {"glGetProgramResourceLocation", P(gl::GetProgramResourceLocation)},
+ {"glGetProgramResourceLocationContextANGLE", P(gl::GetProgramResourceLocationContextANGLE)},
+ {"glGetProgramResourceLocationIndexEXT", P(gl::GetProgramResourceLocationIndexEXT)},
+ {"glGetProgramResourceLocationIndexEXTContextANGLE",
+ P(gl::GetProgramResourceLocationIndexEXTContextANGLE)},
+ {"glGetProgramResourceName", P(gl::GetProgramResourceName)},
+ {"glGetProgramResourceNameContextANGLE", P(gl::GetProgramResourceNameContextANGLE)},
+ {"glGetProgramResourceiv", P(gl::GetProgramResourceiv)},
+ {"glGetProgramResourceivContextANGLE", P(gl::GetProgramResourceivContextANGLE)},
+ {"glGetProgramiv", P(gl::GetProgramiv)},
+ {"glGetProgramivContextANGLE", P(gl::GetProgramivContextANGLE)},
+ {"glGetProgramivRobustANGLE", P(gl::GetProgramivRobustANGLE)},
+ {"glGetProgramivRobustANGLEContextANGLE", P(gl::GetProgramivRobustANGLEContextANGLE)},
+ {"glGetQueryObjecti64vEXT", P(gl::GetQueryObjecti64vEXT)},
+ {"glGetQueryObjecti64vEXTContextANGLE", P(gl::GetQueryObjecti64vEXTContextANGLE)},
+ {"glGetQueryObjecti64vRobustANGLE", P(gl::GetQueryObjecti64vRobustANGLE)},
+ {"glGetQueryObjecti64vRobustANGLEContextANGLE",
+ P(gl::GetQueryObjecti64vRobustANGLEContextANGLE)},
+ {"glGetQueryObjectivEXT", P(gl::GetQueryObjectivEXT)},
+ {"glGetQueryObjectivEXTContextANGLE", P(gl::GetQueryObjectivEXTContextANGLE)},
+ {"glGetQueryObjectivRobustANGLE", P(gl::GetQueryObjectivRobustANGLE)},
+ {"glGetQueryObjectivRobustANGLEContextANGLE", P(gl::GetQueryObjectivRobustANGLEContextANGLE)},
+ {"glGetQueryObjectui64vEXT", P(gl::GetQueryObjectui64vEXT)},
+ {"glGetQueryObjectui64vEXTContextANGLE", P(gl::GetQueryObjectui64vEXTContextANGLE)},
+ {"glGetQueryObjectui64vRobustANGLE", P(gl::GetQueryObjectui64vRobustANGLE)},
+ {"glGetQueryObjectui64vRobustANGLEContextANGLE",
+ P(gl::GetQueryObjectui64vRobustANGLEContextANGLE)},
+ {"glGetQueryObjectuiv", P(gl::GetQueryObjectuiv)},
+ {"glGetQueryObjectuivContextANGLE", P(gl::GetQueryObjectuivContextANGLE)},
+ {"glGetQueryObjectuivEXT", P(gl::GetQueryObjectuivEXT)},
+ {"glGetQueryObjectuivEXTContextANGLE", P(gl::GetQueryObjectuivEXTContextANGLE)},
+ {"glGetQueryObjectuivRobustANGLE", P(gl::GetQueryObjectuivRobustANGLE)},
+ {"glGetQueryObjectuivRobustANGLEContextANGLE", P(gl::GetQueryObjectuivRobustANGLEContextANGLE)},
+ {"glGetQueryiv", P(gl::GetQueryiv)},
+ {"glGetQueryivContextANGLE", P(gl::GetQueryivContextANGLE)},
+ {"glGetQueryivEXT", P(gl::GetQueryivEXT)},
+ {"glGetQueryivEXTContextANGLE", P(gl::GetQueryivEXTContextANGLE)},
+ {"glGetQueryivRobustANGLE", P(gl::GetQueryivRobustANGLE)},
+ {"glGetQueryivRobustANGLEContextANGLE", P(gl::GetQueryivRobustANGLEContextANGLE)},
+ {"glGetRenderbufferParameteriv", P(gl::GetRenderbufferParameteriv)},
+ {"glGetRenderbufferParameterivContextANGLE", P(gl::GetRenderbufferParameterivContextANGLE)},
+ {"glGetRenderbufferParameterivOES", P(gl::GetRenderbufferParameterivOES)},
+ {"glGetRenderbufferParameterivOESContextANGLE",
+ P(gl::GetRenderbufferParameterivOESContextANGLE)},
+ {"glGetRenderbufferParameterivRobustANGLE", P(gl::GetRenderbufferParameterivRobustANGLE)},
+ {"glGetRenderbufferParameterivRobustANGLEContextANGLE",
+ P(gl::GetRenderbufferParameterivRobustANGLEContextANGLE)},
+ {"glGetSamplerParameterIivOES", P(gl::GetSamplerParameterIivOES)},
+ {"glGetSamplerParameterIivOESContextANGLE", P(gl::GetSamplerParameterIivOESContextANGLE)},
+ {"glGetSamplerParameterIivRobustANGLE", P(gl::GetSamplerParameterIivRobustANGLE)},
+ {"glGetSamplerParameterIivRobustANGLEContextANGLE",
+ P(gl::GetSamplerParameterIivRobustANGLEContextANGLE)},
+ {"glGetSamplerParameterIuivOES", P(gl::GetSamplerParameterIuivOES)},
+ {"glGetSamplerParameterIuivOESContextANGLE", P(gl::GetSamplerParameterIuivOESContextANGLE)},
+ {"glGetSamplerParameterIuivRobustANGLE", P(gl::GetSamplerParameterIuivRobustANGLE)},
+ {"glGetSamplerParameterIuivRobustANGLEContextANGLE",
+ P(gl::GetSamplerParameterIuivRobustANGLEContextANGLE)},
+ {"glGetSamplerParameterfv", P(gl::GetSamplerParameterfv)},
+ {"glGetSamplerParameterfvContextANGLE", P(gl::GetSamplerParameterfvContextANGLE)},
+ {"glGetSamplerParameterfvRobustANGLE", P(gl::GetSamplerParameterfvRobustANGLE)},
+ {"glGetSamplerParameterfvRobustANGLEContextANGLE",
+ P(gl::GetSamplerParameterfvRobustANGLEContextANGLE)},
+ {"glGetSamplerParameteriv", P(gl::GetSamplerParameteriv)},
+ {"glGetSamplerParameterivContextANGLE", P(gl::GetSamplerParameterivContextANGLE)},
+ {"glGetSamplerParameterivRobustANGLE", P(gl::GetSamplerParameterivRobustANGLE)},
+ {"glGetSamplerParameterivRobustANGLEContextANGLE",
+ P(gl::GetSamplerParameterivRobustANGLEContextANGLE)},
+ {"glGetSemaphoreParameterui64vEXT", P(gl::GetSemaphoreParameterui64vEXT)},
+ {"glGetSemaphoreParameterui64vEXTContextANGLE",
+ P(gl::GetSemaphoreParameterui64vEXTContextANGLE)},
+ {"glGetShaderInfoLog", P(gl::GetShaderInfoLog)},
+ {"glGetShaderInfoLogContextANGLE", P(gl::GetShaderInfoLogContextANGLE)},
+ {"glGetShaderPrecisionFormat", P(gl::GetShaderPrecisionFormat)},
+ {"glGetShaderPrecisionFormatContextANGLE", P(gl::GetShaderPrecisionFormatContextANGLE)},
+ {"glGetShaderSource", P(gl::GetShaderSource)},
+ {"glGetShaderSourceContextANGLE", P(gl::GetShaderSourceContextANGLE)},
+ {"glGetShaderiv", P(gl::GetShaderiv)},
+ {"glGetShaderivContextANGLE", P(gl::GetShaderivContextANGLE)},
+ {"glGetShaderivRobustANGLE", P(gl::GetShaderivRobustANGLE)},
+ {"glGetShaderivRobustANGLEContextANGLE", P(gl::GetShaderivRobustANGLEContextANGLE)},
+ {"glGetString", P(gl::GetString)},
+ {"glGetStringContextANGLE", P(gl::GetStringContextANGLE)},
+ {"glGetStringi", P(gl::GetStringi)},
+ {"glGetStringiContextANGLE", P(gl::GetStringiContextANGLE)},
+ {"glGetSynciv", P(gl::GetSynciv)},
+ {"glGetSyncivContextANGLE", P(gl::GetSyncivContextANGLE)},
+ {"glGetTexEnvfv", P(gl::GetTexEnvfv)},
+ {"glGetTexEnvfvContextANGLE", P(gl::GetTexEnvfvContextANGLE)},
+ {"glGetTexEnviv", P(gl::GetTexEnviv)},
+ {"glGetTexEnvivContextANGLE", P(gl::GetTexEnvivContextANGLE)},
+ {"glGetTexEnvxv", P(gl::GetTexEnvxv)},
+ {"glGetTexEnvxvContextANGLE", P(gl::GetTexEnvxvContextANGLE)},
+ {"glGetTexGenfvOES", P(gl::GetTexGenfvOES)},
+ {"glGetTexGenfvOESContextANGLE", P(gl::GetTexGenfvOESContextANGLE)},
+ {"glGetTexGenivOES", P(gl::GetTexGenivOES)},
+ {"glGetTexGenivOESContextANGLE", P(gl::GetTexGenivOESContextANGLE)},
+ {"glGetTexGenxvOES", P(gl::GetTexGenxvOES)},
+ {"glGetTexGenxvOESContextANGLE", P(gl::GetTexGenxvOESContextANGLE)},
+ {"glGetTexLevelParameterfv", P(gl::GetTexLevelParameterfv)},
+ {"glGetTexLevelParameterfvANGLE", P(gl::GetTexLevelParameterfvANGLE)},
+ {"glGetTexLevelParameterfvANGLEContextANGLE", P(gl::GetTexLevelParameterfvANGLEContextANGLE)},
+ {"glGetTexLevelParameterfvContextANGLE", P(gl::GetTexLevelParameterfvContextANGLE)},
+ {"glGetTexLevelParameterfvRobustANGLE", P(gl::GetTexLevelParameterfvRobustANGLE)},
+ {"glGetTexLevelParameterfvRobustANGLEContextANGLE",
+ P(gl::GetTexLevelParameterfvRobustANGLEContextANGLE)},
+ {"glGetTexLevelParameteriv", P(gl::GetTexLevelParameteriv)},
+ {"glGetTexLevelParameterivANGLE", P(gl::GetTexLevelParameterivANGLE)},
+ {"glGetTexLevelParameterivANGLEContextANGLE", P(gl::GetTexLevelParameterivANGLEContextANGLE)},
+ {"glGetTexLevelParameterivContextANGLE", P(gl::GetTexLevelParameterivContextANGLE)},
+ {"glGetTexLevelParameterivRobustANGLE", P(gl::GetTexLevelParameterivRobustANGLE)},
+ {"glGetTexLevelParameterivRobustANGLEContextANGLE",
+ P(gl::GetTexLevelParameterivRobustANGLEContextANGLE)},
+ {"glGetTexParameterIivOES", P(gl::GetTexParameterIivOES)},
+ {"glGetTexParameterIivOESContextANGLE", P(gl::GetTexParameterIivOESContextANGLE)},
+ {"glGetTexParameterIivRobustANGLE", P(gl::GetTexParameterIivRobustANGLE)},
+ {"glGetTexParameterIivRobustANGLEContextANGLE",
+ P(gl::GetTexParameterIivRobustANGLEContextANGLE)},
+ {"glGetTexParameterIuivOES", P(gl::GetTexParameterIuivOES)},
+ {"glGetTexParameterIuivOESContextANGLE", P(gl::GetTexParameterIuivOESContextANGLE)},
+ {"glGetTexParameterIuivRobustANGLE", P(gl::GetTexParameterIuivRobustANGLE)},
+ {"glGetTexParameterIuivRobustANGLEContextANGLE",
+ P(gl::GetTexParameterIuivRobustANGLEContextANGLE)},
+ {"glGetTexParameterfv", P(gl::GetTexParameterfv)},
+ {"glGetTexParameterfvContextANGLE", P(gl::GetTexParameterfvContextANGLE)},
+ {"glGetTexParameterfvRobustANGLE", P(gl::GetTexParameterfvRobustANGLE)},
+ {"glGetTexParameterfvRobustANGLEContextANGLE", P(gl::GetTexParameterfvRobustANGLEContextANGLE)},
+ {"glGetTexParameteriv", P(gl::GetTexParameteriv)},
+ {"glGetTexParameterivContextANGLE", P(gl::GetTexParameterivContextANGLE)},
+ {"glGetTexParameterivRobustANGLE", P(gl::GetTexParameterivRobustANGLE)},
+ {"glGetTexParameterivRobustANGLEContextANGLE", P(gl::GetTexParameterivRobustANGLEContextANGLE)},
+ {"glGetTexParameterxv", P(gl::GetTexParameterxv)},
+ {"glGetTexParameterxvContextANGLE", P(gl::GetTexParameterxvContextANGLE)},
+ {"glGetTransformFeedbackVarying", P(gl::GetTransformFeedbackVarying)},
+ {"glGetTransformFeedbackVaryingContextANGLE", P(gl::GetTransformFeedbackVaryingContextANGLE)},
+ {"glGetTranslatedShaderSourceANGLE", P(gl::GetTranslatedShaderSourceANGLE)},
+ {"glGetTranslatedShaderSourceANGLEContextANGLE",
+ P(gl::GetTranslatedShaderSourceANGLEContextANGLE)},
+ {"glGetUniformBlockIndex", P(gl::GetUniformBlockIndex)},
+ {"glGetUniformBlockIndexContextANGLE", P(gl::GetUniformBlockIndexContextANGLE)},
+ {"glGetUniformIndices", P(gl::GetUniformIndices)},
+ {"glGetUniformIndicesContextANGLE", P(gl::GetUniformIndicesContextANGLE)},
+ {"glGetUniformLocation", P(gl::GetUniformLocation)},
+ {"glGetUniformLocationContextANGLE", P(gl::GetUniformLocationContextANGLE)},
+ {"glGetUniformfv", P(gl::GetUniformfv)},
+ {"glGetUniformfvContextANGLE", P(gl::GetUniformfvContextANGLE)},
+ {"glGetUniformfvRobustANGLE", P(gl::GetUniformfvRobustANGLE)},
+ {"glGetUniformfvRobustANGLEContextANGLE", P(gl::GetUniformfvRobustANGLEContextANGLE)},
+ {"glGetUniformiv", P(gl::GetUniformiv)},
+ {"glGetUniformivContextANGLE", P(gl::GetUniformivContextANGLE)},
+ {"glGetUniformivRobustANGLE", P(gl::GetUniformivRobustANGLE)},
+ {"glGetUniformivRobustANGLEContextANGLE", P(gl::GetUniformivRobustANGLEContextANGLE)},
+ {"glGetUniformuiv", P(gl::GetUniformuiv)},
+ {"glGetUniformuivContextANGLE", P(gl::GetUniformuivContextANGLE)},
+ {"glGetUniformuivRobustANGLE", P(gl::GetUniformuivRobustANGLE)},
+ {"glGetUniformuivRobustANGLEContextANGLE", P(gl::GetUniformuivRobustANGLEContextANGLE)},
+ {"glGetUnsignedBytei_vEXT", P(gl::GetUnsignedBytei_vEXT)},
+ {"glGetUnsignedBytei_vEXTContextANGLE", P(gl::GetUnsignedBytei_vEXTContextANGLE)},
+ {"glGetUnsignedBytevEXT", P(gl::GetUnsignedBytevEXT)},
+ {"glGetUnsignedBytevEXTContextANGLE", P(gl::GetUnsignedBytevEXTContextANGLE)},
+ {"glGetVertexAttribIiv", P(gl::GetVertexAttribIiv)},
+ {"glGetVertexAttribIivContextANGLE", P(gl::GetVertexAttribIivContextANGLE)},
+ {"glGetVertexAttribIivRobustANGLE", P(gl::GetVertexAttribIivRobustANGLE)},
+ {"glGetVertexAttribIivRobustANGLEContextANGLE",
+ P(gl::GetVertexAttribIivRobustANGLEContextANGLE)},
+ {"glGetVertexAttribIuiv", P(gl::GetVertexAttribIuiv)},
+ {"glGetVertexAttribIuivContextANGLE", P(gl::GetVertexAttribIuivContextANGLE)},
+ {"glGetVertexAttribIuivRobustANGLE", P(gl::GetVertexAttribIuivRobustANGLE)},
+ {"glGetVertexAttribIuivRobustANGLEContextANGLE",
+ P(gl::GetVertexAttribIuivRobustANGLEContextANGLE)},
+ {"glGetVertexAttribPointerv", P(gl::GetVertexAttribPointerv)},
+ {"glGetVertexAttribPointervContextANGLE", P(gl::GetVertexAttribPointervContextANGLE)},
+ {"glGetVertexAttribPointervRobustANGLE", P(gl::GetVertexAttribPointervRobustANGLE)},
+ {"glGetVertexAttribPointervRobustANGLEContextANGLE",
+ P(gl::GetVertexAttribPointervRobustANGLEContextANGLE)},
+ {"glGetVertexAttribfv", P(gl::GetVertexAttribfv)},
+ {"glGetVertexAttribfvContextANGLE", P(gl::GetVertexAttribfvContextANGLE)},
+ {"glGetVertexAttribfvRobustANGLE", P(gl::GetVertexAttribfvRobustANGLE)},
+ {"glGetVertexAttribfvRobustANGLEContextANGLE", P(gl::GetVertexAttribfvRobustANGLEContextANGLE)},
+ {"glGetVertexAttribiv", P(gl::GetVertexAttribiv)},
+ {"glGetVertexAttribivContextANGLE", P(gl::GetVertexAttribivContextANGLE)},
+ {"glGetVertexAttribivRobustANGLE", P(gl::GetVertexAttribivRobustANGLE)},
+ {"glGetVertexAttribivRobustANGLEContextANGLE", P(gl::GetVertexAttribivRobustANGLEContextANGLE)},
+ {"glGetnUniformfvEXT", P(gl::GetnUniformfvEXT)},
+ {"glGetnUniformfvEXTContextANGLE", P(gl::GetnUniformfvEXTContextANGLE)},
+ {"glGetnUniformfvRobustANGLE", P(gl::GetnUniformfvRobustANGLE)},
+ {"glGetnUniformfvRobustANGLEContextANGLE", P(gl::GetnUniformfvRobustANGLEContextANGLE)},
+ {"glGetnUniformivEXT", P(gl::GetnUniformivEXT)},
+ {"glGetnUniformivEXTContextANGLE", P(gl::GetnUniformivEXTContextANGLE)},
+ {"glGetnUniformivRobustANGLE", P(gl::GetnUniformivRobustANGLE)},
+ {"glGetnUniformivRobustANGLEContextANGLE", P(gl::GetnUniformivRobustANGLEContextANGLE)},
+ {"glGetnUniformuivRobustANGLE", P(gl::GetnUniformuivRobustANGLE)},
+ {"glGetnUniformuivRobustANGLEContextANGLE", P(gl::GetnUniformuivRobustANGLEContextANGLE)},
+ {"glHint", P(gl::Hint)},
+ {"glHintContextANGLE", P(gl::HintContextANGLE)},
+ {"glImportMemoryFdEXT", P(gl::ImportMemoryFdEXT)},
+ {"glImportMemoryFdEXTContextANGLE", P(gl::ImportMemoryFdEXTContextANGLE)},
+ {"glImportSemaphoreFdEXT", P(gl::ImportSemaphoreFdEXT)},
+ {"glImportSemaphoreFdEXTContextANGLE", P(gl::ImportSemaphoreFdEXTContextANGLE)},
+ {"glInsertEventMarkerEXT", P(gl::InsertEventMarkerEXT)},
+ {"glInsertEventMarkerEXTContextANGLE", P(gl::InsertEventMarkerEXTContextANGLE)},
+ {"glInvalidateFramebuffer", P(gl::InvalidateFramebuffer)},
+ {"glInvalidateFramebufferContextANGLE", P(gl::InvalidateFramebufferContextANGLE)},
+ {"glInvalidateSubFramebuffer", P(gl::InvalidateSubFramebuffer)},
+ {"glInvalidateSubFramebufferContextANGLE", P(gl::InvalidateSubFramebufferContextANGLE)},
+ {"glInvalidateTextureANGLE", P(gl::InvalidateTextureANGLE)},
+ {"glInvalidateTextureANGLEContextANGLE", P(gl::InvalidateTextureANGLEContextANGLE)},
+ {"glIsBuffer", P(gl::IsBuffer)},
+ {"glIsBufferContextANGLE", P(gl::IsBufferContextANGLE)},
+ {"glIsEnabled", P(gl::IsEnabled)},
+ {"glIsEnabledContextANGLE", P(gl::IsEnabledContextANGLE)},
+ {"glIsFenceNV", P(gl::IsFenceNV)},
+ {"glIsFenceNVContextANGLE", P(gl::IsFenceNVContextANGLE)},
+ {"glIsFramebuffer", P(gl::IsFramebuffer)},
+ {"glIsFramebufferContextANGLE", P(gl::IsFramebufferContextANGLE)},
+ {"glIsFramebufferOES", P(gl::IsFramebufferOES)},
+ {"glIsFramebufferOESContextANGLE", P(gl::IsFramebufferOESContextANGLE)},
+ {"glIsMemoryObjectEXT", P(gl::IsMemoryObjectEXT)},
+ {"glIsMemoryObjectEXTContextANGLE", P(gl::IsMemoryObjectEXTContextANGLE)},
+ {"glIsPathCHROMIUM", P(gl::IsPathCHROMIUM)},
+ {"glIsPathCHROMIUMContextANGLE", P(gl::IsPathCHROMIUMContextANGLE)},
+ {"glIsProgram", P(gl::IsProgram)},
+ {"glIsProgramContextANGLE", P(gl::IsProgramContextANGLE)},
+ {"glIsProgramPipeline", P(gl::IsProgramPipeline)},
+ {"glIsProgramPipelineContextANGLE", P(gl::IsProgramPipelineContextANGLE)},
+ {"glIsQuery", P(gl::IsQuery)},
+ {"glIsQueryContextANGLE", P(gl::IsQueryContextANGLE)},
+ {"glIsQueryEXT", P(gl::IsQueryEXT)},
+ {"glIsQueryEXTContextANGLE", P(gl::IsQueryEXTContextANGLE)},
+ {"glIsRenderbuffer", P(gl::IsRenderbuffer)},
+ {"glIsRenderbufferContextANGLE", P(gl::IsRenderbufferContextANGLE)},
+ {"glIsRenderbufferOES", P(gl::IsRenderbufferOES)},
+ {"glIsRenderbufferOESContextANGLE", P(gl::IsRenderbufferOESContextANGLE)},
+ {"glIsSampler", P(gl::IsSampler)},
+ {"glIsSamplerContextANGLE", P(gl::IsSamplerContextANGLE)},
+ {"glIsSemaphoreEXT", P(gl::IsSemaphoreEXT)},
+ {"glIsSemaphoreEXTContextANGLE", P(gl::IsSemaphoreEXTContextANGLE)},
+ {"glIsShader", P(gl::IsShader)},
+ {"glIsShaderContextANGLE", P(gl::IsShaderContextANGLE)},
+ {"glIsSync", P(gl::IsSync)},
+ {"glIsSyncContextANGLE", P(gl::IsSyncContextANGLE)},
+ {"glIsTexture", P(gl::IsTexture)},
+ {"glIsTextureContextANGLE", P(gl::IsTextureContextANGLE)},
+ {"glIsTransformFeedback", P(gl::IsTransformFeedback)},
+ {"glIsTransformFeedbackContextANGLE", P(gl::IsTransformFeedbackContextANGLE)},
+ {"glIsVertexArray", P(gl::IsVertexArray)},
+ {"glIsVertexArrayContextANGLE", P(gl::IsVertexArrayContextANGLE)},
+ {"glIsVertexArrayOES", P(gl::IsVertexArrayOES)},
+ {"glIsVertexArrayOESContextANGLE", P(gl::IsVertexArrayOESContextANGLE)},
+ {"glLightModelf", P(gl::LightModelf)},
+ {"glLightModelfContextANGLE", P(gl::LightModelfContextANGLE)},
+ {"glLightModelfv", P(gl::LightModelfv)},
+ {"glLightModelfvContextANGLE", P(gl::LightModelfvContextANGLE)},
+ {"glLightModelx", P(gl::LightModelx)},
+ {"glLightModelxContextANGLE", P(gl::LightModelxContextANGLE)},
+ {"glLightModelxv", P(gl::LightModelxv)},
+ {"glLightModelxvContextANGLE", P(gl::LightModelxvContextANGLE)},
+ {"glLightf", P(gl::Lightf)},
+ {"glLightfContextANGLE", P(gl::LightfContextANGLE)},
+ {"glLightfv", P(gl::Lightfv)},
+ {"glLightfvContextANGLE", P(gl::LightfvContextANGLE)},
+ {"glLightx", P(gl::Lightx)},
+ {"glLightxContextANGLE", P(gl::LightxContextANGLE)},
+ {"glLightxv", P(gl::Lightxv)},
+ {"glLightxvContextANGLE", P(gl::LightxvContextANGLE)},
+ {"glLineWidth", P(gl::LineWidth)},
+ {"glLineWidthContextANGLE", P(gl::LineWidthContextANGLE)},
+ {"glLineWidthx", P(gl::LineWidthx)},
+ {"glLineWidthxContextANGLE", P(gl::LineWidthxContextANGLE)},
+ {"glLinkProgram", P(gl::LinkProgram)},
+ {"glLinkProgramContextANGLE", P(gl::LinkProgramContextANGLE)},
+ {"glLoadIdentity", P(gl::LoadIdentity)},
+ {"glLoadIdentityContextANGLE", P(gl::LoadIdentityContextANGLE)},
+ {"glLoadMatrixf", P(gl::LoadMatrixf)},
+ {"glLoadMatrixfContextANGLE", P(gl::LoadMatrixfContextANGLE)},
+ {"glLoadMatrixx", P(gl::LoadMatrixx)},
+ {"glLoadMatrixxContextANGLE", P(gl::LoadMatrixxContextANGLE)},
+ {"glLoadPaletteFromModelViewMatrixOES", P(gl::LoadPaletteFromModelViewMatrixOES)},
+ {"glLoadPaletteFromModelViewMatrixOESContextANGLE",
+ P(gl::LoadPaletteFromModelViewMatrixOESContextANGLE)},
+ {"glLogicOp", P(gl::LogicOp)},
+ {"glLogicOpContextANGLE", P(gl::LogicOpContextANGLE)},
+ {"glLoseContextCHROMIUM", P(gl::LoseContextCHROMIUM)},
+ {"glLoseContextCHROMIUMContextANGLE", P(gl::LoseContextCHROMIUMContextANGLE)},
+ {"glMapBufferOES", P(gl::MapBufferOES)},
+ {"glMapBufferOESContextANGLE", P(gl::MapBufferOESContextANGLE)},
+ {"glMapBufferRange", P(gl::MapBufferRange)},
+ {"glMapBufferRangeContextANGLE", P(gl::MapBufferRangeContextANGLE)},
+ {"glMapBufferRangeEXT", P(gl::MapBufferRangeEXT)},
+ {"glMapBufferRangeEXTContextANGLE", P(gl::MapBufferRangeEXTContextANGLE)},
+ {"glMaterialf", P(gl::Materialf)},
+ {"glMaterialfContextANGLE", P(gl::MaterialfContextANGLE)},
+ {"glMaterialfv", P(gl::Materialfv)},
+ {"glMaterialfvContextANGLE", P(gl::MaterialfvContextANGLE)},
+ {"glMaterialx", P(gl::Materialx)},
+ {"glMaterialxContextANGLE", P(gl::MaterialxContextANGLE)},
+ {"glMaterialxv", P(gl::Materialxv)},
+ {"glMaterialxvContextANGLE", P(gl::MaterialxvContextANGLE)},
+ {"glMatrixIndexPointerOES", P(gl::MatrixIndexPointerOES)},
+ {"glMatrixIndexPointerOESContextANGLE", P(gl::MatrixIndexPointerOESContextANGLE)},
+ {"glMatrixLoadIdentityCHROMIUM", P(gl::MatrixLoadIdentityCHROMIUM)},
+ {"glMatrixLoadIdentityCHROMIUMContextANGLE", P(gl::MatrixLoadIdentityCHROMIUMContextANGLE)},
+ {"glMatrixLoadfCHROMIUM", P(gl::MatrixLoadfCHROMIUM)},
+ {"glMatrixLoadfCHROMIUMContextANGLE", P(gl::MatrixLoadfCHROMIUMContextANGLE)},
+ {"glMatrixMode", P(gl::MatrixMode)},
+ {"glMatrixModeContextANGLE", P(gl::MatrixModeContextANGLE)},
+ {"glMaxShaderCompilerThreadsKHR", P(gl::MaxShaderCompilerThreadsKHR)},
+ {"glMaxShaderCompilerThreadsKHRContextANGLE", P(gl::MaxShaderCompilerThreadsKHRContextANGLE)},
+ {"glMemoryBarrier", P(gl::MemoryBarrier)},
+ {"glMemoryBarrierByRegion", P(gl::MemoryBarrierByRegion)},
+ {"glMemoryBarrierByRegionContextANGLE", P(gl::MemoryBarrierByRegionContextANGLE)},
+ {"glMemoryBarrierContextANGLE", P(gl::MemoryBarrierContextANGLE)},
+ {"glMemoryObjectParameterivEXT", P(gl::MemoryObjectParameterivEXT)},
+ {"glMemoryObjectParameterivEXTContextANGLE", P(gl::MemoryObjectParameterivEXTContextANGLE)},
+ {"glMultMatrixf", P(gl::MultMatrixf)},
+ {"glMultMatrixfContextANGLE", P(gl::MultMatrixfContextANGLE)},
+ {"glMultMatrixx", P(gl::MultMatrixx)},
+ {"glMultMatrixxContextANGLE", P(gl::MultMatrixxContextANGLE)},
+ {"glMultiDrawArraysANGLE", P(gl::MultiDrawArraysANGLE)},
+ {"glMultiDrawArraysANGLEContextANGLE", P(gl::MultiDrawArraysANGLEContextANGLE)},
+ {"glMultiDrawArraysInstancedANGLE", P(gl::MultiDrawArraysInstancedANGLE)},
+ {"glMultiDrawArraysInstancedANGLEContextANGLE",
+ P(gl::MultiDrawArraysInstancedANGLEContextANGLE)},
+ {"glMultiDrawElementsANGLE", P(gl::MultiDrawElementsANGLE)},
+ {"glMultiDrawElementsANGLEContextANGLE", P(gl::MultiDrawElementsANGLEContextANGLE)},
+ {"glMultiDrawElementsInstancedANGLE", P(gl::MultiDrawElementsInstancedANGLE)},
+ {"glMultiDrawElementsInstancedANGLEContextANGLE",
+ P(gl::MultiDrawElementsInstancedANGLEContextANGLE)},
+ {"glMultiTexCoord4f", P(gl::MultiTexCoord4f)},
+ {"glMultiTexCoord4fContextANGLE", P(gl::MultiTexCoord4fContextANGLE)},
+ {"glMultiTexCoord4x", P(gl::MultiTexCoord4x)},
+ {"glMultiTexCoord4xContextANGLE", P(gl::MultiTexCoord4xContextANGLE)},
+ {"glNormal3f", P(gl::Normal3f)},
+ {"glNormal3fContextANGLE", P(gl::Normal3fContextANGLE)},
+ {"glNormal3x", P(gl::Normal3x)},
+ {"glNormal3xContextANGLE", P(gl::Normal3xContextANGLE)},
+ {"glNormalPointer", P(gl::NormalPointer)},
+ {"glNormalPointerContextANGLE", P(gl::NormalPointerContextANGLE)},
+ {"glObjectLabelKHR", P(gl::ObjectLabelKHR)},
+ {"glObjectLabelKHRContextANGLE", P(gl::ObjectLabelKHRContextANGLE)},
+ {"glObjectPtrLabelKHR", P(gl::ObjectPtrLabelKHR)},
+ {"glObjectPtrLabelKHRContextANGLE", P(gl::ObjectPtrLabelKHRContextANGLE)},
+ {"glOrthof", P(gl::Orthof)},
+ {"glOrthofContextANGLE", P(gl::OrthofContextANGLE)},
+ {"glOrthox", P(gl::Orthox)},
+ {"glOrthoxContextANGLE", P(gl::OrthoxContextANGLE)},
+ {"glPathCommandsCHROMIUM", P(gl::PathCommandsCHROMIUM)},
+ {"glPathCommandsCHROMIUMContextANGLE", P(gl::PathCommandsCHROMIUMContextANGLE)},
+ {"glPathParameterfCHROMIUM", P(gl::PathParameterfCHROMIUM)},
+ {"glPathParameterfCHROMIUMContextANGLE", P(gl::PathParameterfCHROMIUMContextANGLE)},
+ {"glPathParameteriCHROMIUM", P(gl::PathParameteriCHROMIUM)},
+ {"glPathParameteriCHROMIUMContextANGLE", P(gl::PathParameteriCHROMIUMContextANGLE)},
+ {"glPathStencilFuncCHROMIUM", P(gl::PathStencilFuncCHROMIUM)},
+ {"glPathStencilFuncCHROMIUMContextANGLE", P(gl::PathStencilFuncCHROMIUMContextANGLE)},
+ {"glPauseTransformFeedback", P(gl::PauseTransformFeedback)},
+ {"glPauseTransformFeedbackContextANGLE", P(gl::PauseTransformFeedbackContextANGLE)},
+ {"glPixelStorei", P(gl::PixelStorei)},
+ {"glPixelStoreiContextANGLE", P(gl::PixelStoreiContextANGLE)},
+ {"glPointParameterf", P(gl::PointParameterf)},
+ {"glPointParameterfContextANGLE", P(gl::PointParameterfContextANGLE)},
+ {"glPointParameterfv", P(gl::PointParameterfv)},
+ {"glPointParameterfvContextANGLE", P(gl::PointParameterfvContextANGLE)},
+ {"glPointParameterx", P(gl::PointParameterx)},
+ {"glPointParameterxContextANGLE", P(gl::PointParameterxContextANGLE)},
+ {"glPointParameterxv", P(gl::PointParameterxv)},
+ {"glPointParameterxvContextANGLE", P(gl::PointParameterxvContextANGLE)},
+ {"glPointSize", P(gl::PointSize)},
+ {"glPointSizeContextANGLE", P(gl::PointSizeContextANGLE)},
+ {"glPointSizePointerOES", P(gl::PointSizePointerOES)},
+ {"glPointSizePointerOESContextANGLE", P(gl::PointSizePointerOESContextANGLE)},
+ {"glPointSizex", P(gl::PointSizex)},
+ {"glPointSizexContextANGLE", P(gl::PointSizexContextANGLE)},
+ {"glPolygonOffset", P(gl::PolygonOffset)},
+ {"glPolygonOffsetContextANGLE", P(gl::PolygonOffsetContextANGLE)},
+ {"glPolygonOffsetx", P(gl::PolygonOffsetx)},
+ {"glPolygonOffsetxContextANGLE", P(gl::PolygonOffsetxContextANGLE)},
+ {"glPopDebugGroupKHR", P(gl::PopDebugGroupKHR)},
+ {"glPopDebugGroupKHRContextANGLE", P(gl::PopDebugGroupKHRContextANGLE)},
+ {"glPopGroupMarkerEXT", P(gl::PopGroupMarkerEXT)},
+ {"glPopGroupMarkerEXTContextANGLE", P(gl::PopGroupMarkerEXTContextANGLE)},
+ {"glPopMatrix", P(gl::PopMatrix)},
+ {"glPopMatrixContextANGLE", P(gl::PopMatrixContextANGLE)},
+ {"glProgramBinary", P(gl::ProgramBinary)},
+ {"glProgramBinaryContextANGLE", P(gl::ProgramBinaryContextANGLE)},
+ {"glProgramBinaryOES", P(gl::ProgramBinaryOES)},
+ {"glProgramBinaryOESContextANGLE", P(gl::ProgramBinaryOESContextANGLE)},
+ {"glProgramParameteri", P(gl::ProgramParameteri)},
+ {"glProgramParameteriContextANGLE", P(gl::ProgramParameteriContextANGLE)},
+ {"glProgramPathFragmentInputGenCHROMIUM", P(gl::ProgramPathFragmentInputGenCHROMIUM)},
+ {"glProgramPathFragmentInputGenCHROMIUMContextANGLE",
+ P(gl::ProgramPathFragmentInputGenCHROMIUMContextANGLE)},
+ {"glProgramUniform1f", P(gl::ProgramUniform1f)},
+ {"glProgramUniform1fContextANGLE", P(gl::ProgramUniform1fContextANGLE)},
+ {"glProgramUniform1fv", P(gl::ProgramUniform1fv)},
+ {"glProgramUniform1fvContextANGLE", P(gl::ProgramUniform1fvContextANGLE)},
+ {"glProgramUniform1i", P(gl::ProgramUniform1i)},
+ {"glProgramUniform1iContextANGLE", P(gl::ProgramUniform1iContextANGLE)},
+ {"glProgramUniform1iv", P(gl::ProgramUniform1iv)},
+ {"glProgramUniform1ivContextANGLE", P(gl::ProgramUniform1ivContextANGLE)},
+ {"glProgramUniform1ui", P(gl::ProgramUniform1ui)},
+ {"glProgramUniform1uiContextANGLE", P(gl::ProgramUniform1uiContextANGLE)},
+ {"glProgramUniform1uiv", P(gl::ProgramUniform1uiv)},
+ {"glProgramUniform1uivContextANGLE", P(gl::ProgramUniform1uivContextANGLE)},
+ {"glProgramUniform2f", P(gl::ProgramUniform2f)},
+ {"glProgramUniform2fContextANGLE", P(gl::ProgramUniform2fContextANGLE)},
+ {"glProgramUniform2fv", P(gl::ProgramUniform2fv)},
+ {"glProgramUniform2fvContextANGLE", P(gl::ProgramUniform2fvContextANGLE)},
+ {"glProgramUniform2i", P(gl::ProgramUniform2i)},
+ {"glProgramUniform2iContextANGLE", P(gl::ProgramUniform2iContextANGLE)},
+ {"glProgramUniform2iv", P(gl::ProgramUniform2iv)},
+ {"glProgramUniform2ivContextANGLE", P(gl::ProgramUniform2ivContextANGLE)},
+ {"glProgramUniform2ui", P(gl::ProgramUniform2ui)},
+ {"glProgramUniform2uiContextANGLE", P(gl::ProgramUniform2uiContextANGLE)},
+ {"glProgramUniform2uiv", P(gl::ProgramUniform2uiv)},
+ {"glProgramUniform2uivContextANGLE", P(gl::ProgramUniform2uivContextANGLE)},
+ {"glProgramUniform3f", P(gl::ProgramUniform3f)},
+ {"glProgramUniform3fContextANGLE", P(gl::ProgramUniform3fContextANGLE)},
+ {"glProgramUniform3fv", P(gl::ProgramUniform3fv)},
+ {"glProgramUniform3fvContextANGLE", P(gl::ProgramUniform3fvContextANGLE)},
+ {"glProgramUniform3i", P(gl::ProgramUniform3i)},
+ {"glProgramUniform3iContextANGLE", P(gl::ProgramUniform3iContextANGLE)},
+ {"glProgramUniform3iv", P(gl::ProgramUniform3iv)},
+ {"glProgramUniform3ivContextANGLE", P(gl::ProgramUniform3ivContextANGLE)},
+ {"glProgramUniform3ui", P(gl::ProgramUniform3ui)},
+ {"glProgramUniform3uiContextANGLE", P(gl::ProgramUniform3uiContextANGLE)},
+ {"glProgramUniform3uiv", P(gl::ProgramUniform3uiv)},
+ {"glProgramUniform3uivContextANGLE", P(gl::ProgramUniform3uivContextANGLE)},
+ {"glProgramUniform4f", P(gl::ProgramUniform4f)},
+ {"glProgramUniform4fContextANGLE", P(gl::ProgramUniform4fContextANGLE)},
+ {"glProgramUniform4fv", P(gl::ProgramUniform4fv)},
+ {"glProgramUniform4fvContextANGLE", P(gl::ProgramUniform4fvContextANGLE)},
+ {"glProgramUniform4i", P(gl::ProgramUniform4i)},
+ {"glProgramUniform4iContextANGLE", P(gl::ProgramUniform4iContextANGLE)},
+ {"glProgramUniform4iv", P(gl::ProgramUniform4iv)},
+ {"glProgramUniform4ivContextANGLE", P(gl::ProgramUniform4ivContextANGLE)},
+ {"glProgramUniform4ui", P(gl::ProgramUniform4ui)},
+ {"glProgramUniform4uiContextANGLE", P(gl::ProgramUniform4uiContextANGLE)},
+ {"glProgramUniform4uiv", P(gl::ProgramUniform4uiv)},
+ {"glProgramUniform4uivContextANGLE", P(gl::ProgramUniform4uivContextANGLE)},
+ {"glProgramUniformMatrix2fv", P(gl::ProgramUniformMatrix2fv)},
+ {"glProgramUniformMatrix2fvContextANGLE", P(gl::ProgramUniformMatrix2fvContextANGLE)},
+ {"glProgramUniformMatrix2x3fv", P(gl::ProgramUniformMatrix2x3fv)},
+ {"glProgramUniformMatrix2x3fvContextANGLE", P(gl::ProgramUniformMatrix2x3fvContextANGLE)},
+ {"glProgramUniformMatrix2x4fv", P(gl::ProgramUniformMatrix2x4fv)},
+ {"glProgramUniformMatrix2x4fvContextANGLE", P(gl::ProgramUniformMatrix2x4fvContextANGLE)},
+ {"glProgramUniformMatrix3fv", P(gl::ProgramUniformMatrix3fv)},
+ {"glProgramUniformMatrix3fvContextANGLE", P(gl::ProgramUniformMatrix3fvContextANGLE)},
+ {"glProgramUniformMatrix3x2fv", P(gl::ProgramUniformMatrix3x2fv)},
+ {"glProgramUniformMatrix3x2fvContextANGLE", P(gl::ProgramUniformMatrix3x2fvContextANGLE)},
+ {"glProgramUniformMatrix3x4fv", P(gl::ProgramUniformMatrix3x4fv)},
+ {"glProgramUniformMatrix3x4fvContextANGLE", P(gl::ProgramUniformMatrix3x4fvContextANGLE)},
+ {"glProgramUniformMatrix4fv", P(gl::ProgramUniformMatrix4fv)},
+ {"glProgramUniformMatrix4fvContextANGLE", P(gl::ProgramUniformMatrix4fvContextANGLE)},
+ {"glProgramUniformMatrix4x2fv", P(gl::ProgramUniformMatrix4x2fv)},
+ {"glProgramUniformMatrix4x2fvContextANGLE", P(gl::ProgramUniformMatrix4x2fvContextANGLE)},
+ {"glProgramUniformMatrix4x3fv", P(gl::ProgramUniformMatrix4x3fv)},
+ {"glProgramUniformMatrix4x3fvContextANGLE", P(gl::ProgramUniformMatrix4x3fvContextANGLE)},
+ {"glProvokingVertexANGLE", P(gl::ProvokingVertexANGLE)},
+ {"glProvokingVertexANGLEContextANGLE", P(gl::ProvokingVertexANGLEContextANGLE)},
+ {"glPushDebugGroupKHR", P(gl::PushDebugGroupKHR)},
+ {"glPushDebugGroupKHRContextANGLE", P(gl::PushDebugGroupKHRContextANGLE)},
+ {"glPushGroupMarkerEXT", P(gl::PushGroupMarkerEXT)},
+ {"glPushGroupMarkerEXTContextANGLE", P(gl::PushGroupMarkerEXTContextANGLE)},
+ {"glPushMatrix", P(gl::PushMatrix)},
+ {"glPushMatrixContextANGLE", P(gl::PushMatrixContextANGLE)},
+ {"glQueryCounterEXT", P(gl::QueryCounterEXT)},
+ {"glQueryCounterEXTContextANGLE", P(gl::QueryCounterEXTContextANGLE)},
+ {"glQueryMatrixxOES", P(gl::QueryMatrixxOES)},
+ {"glQueryMatrixxOESContextANGLE", P(gl::QueryMatrixxOESContextANGLE)},
+ {"glReadBuffer", P(gl::ReadBuffer)},
+ {"glReadBufferContextANGLE", P(gl::ReadBufferContextANGLE)},
+ {"glReadPixels", P(gl::ReadPixels)},
+ {"glReadPixelsContextANGLE", P(gl::ReadPixelsContextANGLE)},
+ {"glReadPixelsRobustANGLE", P(gl::ReadPixelsRobustANGLE)},
+ {"glReadPixelsRobustANGLEContextANGLE", P(gl::ReadPixelsRobustANGLEContextANGLE)},
+ {"glReadnPixelsEXT", P(gl::ReadnPixelsEXT)},
+ {"glReadnPixelsEXTContextANGLE", P(gl::ReadnPixelsEXTContextANGLE)},
+ {"glReadnPixelsRobustANGLE", P(gl::ReadnPixelsRobustANGLE)},
+ {"glReadnPixelsRobustANGLEContextANGLE", P(gl::ReadnPixelsRobustANGLEContextANGLE)},
+ {"glReleaseShaderCompiler", P(gl::ReleaseShaderCompiler)},
+ {"glReleaseShaderCompilerContextANGLE", P(gl::ReleaseShaderCompilerContextANGLE)},
+ {"glRenderbufferStorage", P(gl::RenderbufferStorage)},
+ {"glRenderbufferStorageContextANGLE", P(gl::RenderbufferStorageContextANGLE)},
+ {"glRenderbufferStorageMultisample", P(gl::RenderbufferStorageMultisample)},
+ {"glRenderbufferStorageMultisampleANGLE", P(gl::RenderbufferStorageMultisampleANGLE)},
+ {"glRenderbufferStorageMultisampleANGLEContextANGLE",
+ P(gl::RenderbufferStorageMultisampleANGLEContextANGLE)},
+ {"glRenderbufferStorageMultisampleContextANGLE",
+ P(gl::RenderbufferStorageMultisampleContextANGLE)},
+ {"glRenderbufferStorageOES", P(gl::RenderbufferStorageOES)},
+ {"glRenderbufferStorageOESContextANGLE", P(gl::RenderbufferStorageOESContextANGLE)},
+ {"glRequestExtensionANGLE", P(gl::RequestExtensionANGLE)},
+ {"glRequestExtensionANGLEContextANGLE", P(gl::RequestExtensionANGLEContextANGLE)},
+ {"glResumeTransformFeedback", P(gl::ResumeTransformFeedback)},
+ {"glResumeTransformFeedbackContextANGLE", P(gl::ResumeTransformFeedbackContextANGLE)},
+ {"glRotatef", P(gl::Rotatef)},
+ {"glRotatefContextANGLE", P(gl::RotatefContextANGLE)},
+ {"glRotatex", P(gl::Rotatex)},
+ {"glRotatexContextANGLE", P(gl::RotatexContextANGLE)},
+ {"glSampleCoverage", P(gl::SampleCoverage)},
+ {"glSampleCoverageContextANGLE", P(gl::SampleCoverageContextANGLE)},
+ {"glSampleCoveragex", P(gl::SampleCoveragex)},
+ {"glSampleCoveragexContextANGLE", P(gl::SampleCoveragexContextANGLE)},
+ {"glSampleMaski", P(gl::SampleMaski)},
+ {"glSampleMaskiANGLE", P(gl::SampleMaskiANGLE)},
+ {"glSampleMaskiANGLEContextANGLE", P(gl::SampleMaskiANGLEContextANGLE)},
+ {"glSampleMaskiContextANGLE", P(gl::SampleMaskiContextANGLE)},
+ {"glSamplerParameterIivOES", P(gl::SamplerParameterIivOES)},
+ {"glSamplerParameterIivOESContextANGLE", P(gl::SamplerParameterIivOESContextANGLE)},
+ {"glSamplerParameterIivRobustANGLE", P(gl::SamplerParameterIivRobustANGLE)},
+ {"glSamplerParameterIivRobustANGLEContextANGLE",
+ P(gl::SamplerParameterIivRobustANGLEContextANGLE)},
+ {"glSamplerParameterIuivOES", P(gl::SamplerParameterIuivOES)},
+ {"glSamplerParameterIuivOESContextANGLE", P(gl::SamplerParameterIuivOESContextANGLE)},
+ {"glSamplerParameterIuivRobustANGLE", P(gl::SamplerParameterIuivRobustANGLE)},
+ {"glSamplerParameterIuivRobustANGLEContextANGLE",
+ P(gl::SamplerParameterIuivRobustANGLEContextANGLE)},
+ {"glSamplerParameterf", P(gl::SamplerParameterf)},
+ {"glSamplerParameterfContextANGLE", P(gl::SamplerParameterfContextANGLE)},
+ {"glSamplerParameterfv", P(gl::SamplerParameterfv)},
+ {"glSamplerParameterfvContextANGLE", P(gl::SamplerParameterfvContextANGLE)},
+ {"glSamplerParameterfvRobustANGLE", P(gl::SamplerParameterfvRobustANGLE)},
+ {"glSamplerParameterfvRobustANGLEContextANGLE",
+ P(gl::SamplerParameterfvRobustANGLEContextANGLE)},
+ {"glSamplerParameteri", P(gl::SamplerParameteri)},
+ {"glSamplerParameteriContextANGLE", P(gl::SamplerParameteriContextANGLE)},
+ {"glSamplerParameteriv", P(gl::SamplerParameteriv)},
+ {"glSamplerParameterivContextANGLE", P(gl::SamplerParameterivContextANGLE)},
+ {"glSamplerParameterivRobustANGLE", P(gl::SamplerParameterivRobustANGLE)},
+ {"glSamplerParameterivRobustANGLEContextANGLE",
+ P(gl::SamplerParameterivRobustANGLEContextANGLE)},
+ {"glScalef", P(gl::Scalef)},
+ {"glScalefContextANGLE", P(gl::ScalefContextANGLE)},
+ {"glScalex", P(gl::Scalex)},
+ {"glScalexContextANGLE", P(gl::ScalexContextANGLE)},
+ {"glScissor", P(gl::Scissor)},
+ {"glScissorContextANGLE", P(gl::ScissorContextANGLE)},
+ {"glSemaphoreParameterui64vEXT", P(gl::SemaphoreParameterui64vEXT)},
+ {"glSemaphoreParameterui64vEXTContextANGLE", P(gl::SemaphoreParameterui64vEXTContextANGLE)},
+ {"glSetFenceNV", P(gl::SetFenceNV)},
+ {"glSetFenceNVContextANGLE", P(gl::SetFenceNVContextANGLE)},
+ {"glShadeModel", P(gl::ShadeModel)},
+ {"glShadeModelContextANGLE", P(gl::ShadeModelContextANGLE)},
+ {"glShaderBinary", P(gl::ShaderBinary)},
+ {"glShaderBinaryContextANGLE", P(gl::ShaderBinaryContextANGLE)},
+ {"glShaderSource", P(gl::ShaderSource)},
+ {"glShaderSourceContextANGLE", P(gl::ShaderSourceContextANGLE)},
+ {"glSignalSemaphoreEXT", P(gl::SignalSemaphoreEXT)},
+ {"glSignalSemaphoreEXTContextANGLE", P(gl::SignalSemaphoreEXTContextANGLE)},
+ {"glStencilFillPathCHROMIUM", P(gl::StencilFillPathCHROMIUM)},
+ {"glStencilFillPathCHROMIUMContextANGLE", P(gl::StencilFillPathCHROMIUMContextANGLE)},
+ {"glStencilFillPathInstancedCHROMIUM", P(gl::StencilFillPathInstancedCHROMIUM)},
+ {"glStencilFillPathInstancedCHROMIUMContextANGLE",
+ P(gl::StencilFillPathInstancedCHROMIUMContextANGLE)},
+ {"glStencilFunc", P(gl::StencilFunc)},
+ {"glStencilFuncContextANGLE", P(gl::StencilFuncContextANGLE)},
+ {"glStencilFuncSeparate", P(gl::StencilFuncSeparate)},
+ {"glStencilFuncSeparateContextANGLE", P(gl::StencilFuncSeparateContextANGLE)},
+ {"glStencilMask", P(gl::StencilMask)},
+ {"glStencilMaskContextANGLE", P(gl::StencilMaskContextANGLE)},
+ {"glStencilMaskSeparate", P(gl::StencilMaskSeparate)},
+ {"glStencilMaskSeparateContextANGLE", P(gl::StencilMaskSeparateContextANGLE)},
+ {"glStencilOp", P(gl::StencilOp)},
+ {"glStencilOpContextANGLE", P(gl::StencilOpContextANGLE)},
+ {"glStencilOpSeparate", P(gl::StencilOpSeparate)},
+ {"glStencilOpSeparateContextANGLE", P(gl::StencilOpSeparateContextANGLE)},
+ {"glStencilStrokePathCHROMIUM", P(gl::StencilStrokePathCHROMIUM)},
+ {"glStencilStrokePathCHROMIUMContextANGLE", P(gl::StencilStrokePathCHROMIUMContextANGLE)},
+ {"glStencilStrokePathInstancedCHROMIUM", P(gl::StencilStrokePathInstancedCHROMIUM)},
+ {"glStencilStrokePathInstancedCHROMIUMContextANGLE",
+ P(gl::StencilStrokePathInstancedCHROMIUMContextANGLE)},
+ {"glStencilThenCoverFillPathCHROMIUM", P(gl::StencilThenCoverFillPathCHROMIUM)},
+ {"glStencilThenCoverFillPathCHROMIUMContextANGLE",
+ P(gl::StencilThenCoverFillPathCHROMIUMContextANGLE)},
+ {"glStencilThenCoverFillPathInstancedCHROMIUM",
+ P(gl::StencilThenCoverFillPathInstancedCHROMIUM)},
+ {"glStencilThenCoverFillPathInstancedCHROMIUMContextANGLE",
+ P(gl::StencilThenCoverFillPathInstancedCHROMIUMContextANGLE)},
+ {"glStencilThenCoverStrokePathCHROMIUM", P(gl::StencilThenCoverStrokePathCHROMIUM)},
+ {"glStencilThenCoverStrokePathCHROMIUMContextANGLE",
+ P(gl::StencilThenCoverStrokePathCHROMIUMContextANGLE)},
+ {"glStencilThenCoverStrokePathInstancedCHROMIUM",
+ P(gl::StencilThenCoverStrokePathInstancedCHROMIUM)},
+ {"glStencilThenCoverStrokePathInstancedCHROMIUMContextANGLE",
+ P(gl::StencilThenCoverStrokePathInstancedCHROMIUMContextANGLE)},
+ {"glTestFenceNV", P(gl::TestFenceNV)},
+ {"glTestFenceNVContextANGLE", P(gl::TestFenceNVContextANGLE)},
+ {"glTexCoordPointer", P(gl::TexCoordPointer)},
+ {"glTexCoordPointerContextANGLE", P(gl::TexCoordPointerContextANGLE)},
+ {"glTexEnvf", P(gl::TexEnvf)},
+ {"glTexEnvfContextANGLE", P(gl::TexEnvfContextANGLE)},
+ {"glTexEnvfv", P(gl::TexEnvfv)},
+ {"glTexEnvfvContextANGLE", P(gl::TexEnvfvContextANGLE)},
+ {"glTexEnvi", P(gl::TexEnvi)},
+ {"glTexEnviContextANGLE", P(gl::TexEnviContextANGLE)},
+ {"glTexEnviv", P(gl::TexEnviv)},
+ {"glTexEnvivContextANGLE", P(gl::TexEnvivContextANGLE)},
+ {"glTexEnvx", P(gl::TexEnvx)},
+ {"glTexEnvxContextANGLE", P(gl::TexEnvxContextANGLE)},
+ {"glTexEnvxv", P(gl::TexEnvxv)},
+ {"glTexEnvxvContextANGLE", P(gl::TexEnvxvContextANGLE)},
+ {"glTexGenfOES", P(gl::TexGenfOES)},
+ {"glTexGenfOESContextANGLE", P(gl::TexGenfOESContextANGLE)},
+ {"glTexGenfvOES", P(gl::TexGenfvOES)},
+ {"glTexGenfvOESContextANGLE", P(gl::TexGenfvOESContextANGLE)},
+ {"glTexGeniOES", P(gl::TexGeniOES)},
+ {"glTexGeniOESContextANGLE", P(gl::TexGeniOESContextANGLE)},
+ {"glTexGenivOES", P(gl::TexGenivOES)},
+ {"glTexGenivOESContextANGLE", P(gl::TexGenivOESContextANGLE)},
+ {"glTexGenxOES", P(gl::TexGenxOES)},
+ {"glTexGenxOESContextANGLE", P(gl::TexGenxOESContextANGLE)},
+ {"glTexGenxvOES", P(gl::TexGenxvOES)},
+ {"glTexGenxvOESContextANGLE", P(gl::TexGenxvOESContextANGLE)},
+ {"glTexImage2D", P(gl::TexImage2D)},
+ {"glTexImage2DContextANGLE", P(gl::TexImage2DContextANGLE)},
+ {"glTexImage2DExternalANGLE", P(gl::TexImage2DExternalANGLE)},
+ {"glTexImage2DExternalANGLEContextANGLE", P(gl::TexImage2DExternalANGLEContextANGLE)},
+ {"glTexImage2DRobustANGLE", P(gl::TexImage2DRobustANGLE)},
+ {"glTexImage2DRobustANGLEContextANGLE", P(gl::TexImage2DRobustANGLEContextANGLE)},
+ {"glTexImage3D", P(gl::TexImage3D)},
+ {"glTexImage3DContextANGLE", P(gl::TexImage3DContextANGLE)},
+ {"glTexImage3DOES", P(gl::TexImage3DOES)},
+ {"glTexImage3DOESContextANGLE", P(gl::TexImage3DOESContextANGLE)},
+ {"glTexImage3DRobustANGLE", P(gl::TexImage3DRobustANGLE)},
+ {"glTexImage3DRobustANGLEContextANGLE", P(gl::TexImage3DRobustANGLEContextANGLE)},
+ {"glTexParameterIivOES", P(gl::TexParameterIivOES)},
+ {"glTexParameterIivOESContextANGLE", P(gl::TexParameterIivOESContextANGLE)},
+ {"glTexParameterIivRobustANGLE", P(gl::TexParameterIivRobustANGLE)},
+ {"glTexParameterIivRobustANGLEContextANGLE", P(gl::TexParameterIivRobustANGLEContextANGLE)},
+ {"glTexParameterIuivOES", P(gl::TexParameterIuivOES)},
+ {"glTexParameterIuivOESContextANGLE", P(gl::TexParameterIuivOESContextANGLE)},
+ {"glTexParameterIuivRobustANGLE", P(gl::TexParameterIuivRobustANGLE)},
+ {"glTexParameterIuivRobustANGLEContextANGLE", P(gl::TexParameterIuivRobustANGLEContextANGLE)},
+ {"glTexParameterf", P(gl::TexParameterf)},
+ {"glTexParameterfContextANGLE", P(gl::TexParameterfContextANGLE)},
+ {"glTexParameterfv", P(gl::TexParameterfv)},
+ {"glTexParameterfvContextANGLE", P(gl::TexParameterfvContextANGLE)},
+ {"glTexParameterfvRobustANGLE", P(gl::TexParameterfvRobustANGLE)},
+ {"glTexParameterfvRobustANGLEContextANGLE", P(gl::TexParameterfvRobustANGLEContextANGLE)},
+ {"glTexParameteri", P(gl::TexParameteri)},
+ {"glTexParameteriContextANGLE", P(gl::TexParameteriContextANGLE)},
+ {"glTexParameteriv", P(gl::TexParameteriv)},
+ {"glTexParameterivContextANGLE", P(gl::TexParameterivContextANGLE)},
+ {"glTexParameterivRobustANGLE", P(gl::TexParameterivRobustANGLE)},
+ {"glTexParameterivRobustANGLEContextANGLE", P(gl::TexParameterivRobustANGLEContextANGLE)},
+ {"glTexParameterx", P(gl::TexParameterx)},
+ {"glTexParameterxContextANGLE", P(gl::TexParameterxContextANGLE)},
+ {"glTexParameterxv", P(gl::TexParameterxv)},
+ {"glTexParameterxvContextANGLE", P(gl::TexParameterxvContextANGLE)},
+ {"glTexStorage1DEXT", P(gl::TexStorage1DEXT)},
+ {"glTexStorage1DEXTContextANGLE", P(gl::TexStorage1DEXTContextANGLE)},
+ {"glTexStorage2D", P(gl::TexStorage2D)},
+ {"glTexStorage2DContextANGLE", P(gl::TexStorage2DContextANGLE)},
+ {"glTexStorage2DEXT", P(gl::TexStorage2DEXT)},
+ {"glTexStorage2DEXTContextANGLE", P(gl::TexStorage2DEXTContextANGLE)},
+ {"glTexStorage2DMultisample", P(gl::TexStorage2DMultisample)},
+ {"glTexStorage2DMultisampleANGLE", P(gl::TexStorage2DMultisampleANGLE)},
+ {"glTexStorage2DMultisampleANGLEContextANGLE", P(gl::TexStorage2DMultisampleANGLEContextANGLE)},
+ {"glTexStorage2DMultisampleContextANGLE", P(gl::TexStorage2DMultisampleContextANGLE)},
+ {"glTexStorage3D", P(gl::TexStorage3D)},
+ {"glTexStorage3DContextANGLE", P(gl::TexStorage3DContextANGLE)},
+ {"glTexStorage3DEXT", P(gl::TexStorage3DEXT)},
+ {"glTexStorage3DEXTContextANGLE", P(gl::TexStorage3DEXTContextANGLE)},
+ {"glTexStorage3DMultisampleOES", P(gl::TexStorage3DMultisampleOES)},
+ {"glTexStorage3DMultisampleOESContextANGLE", P(gl::TexStorage3DMultisampleOESContextANGLE)},
+ {"glTexStorageMem2DEXT", P(gl::TexStorageMem2DEXT)},
+ {"glTexStorageMem2DEXTContextANGLE", P(gl::TexStorageMem2DEXTContextANGLE)},
+ {"glTexStorageMem2DMultisampleEXT", P(gl::TexStorageMem2DMultisampleEXT)},
+ {"glTexStorageMem2DMultisampleEXTContextANGLE",
+ P(gl::TexStorageMem2DMultisampleEXTContextANGLE)},
+ {"glTexStorageMem3DEXT", P(gl::TexStorageMem3DEXT)},
+ {"glTexStorageMem3DEXTContextANGLE", P(gl::TexStorageMem3DEXTContextANGLE)},
+ {"glTexStorageMem3DMultisampleEXT", P(gl::TexStorageMem3DMultisampleEXT)},
+ {"glTexStorageMem3DMultisampleEXTContextANGLE",
+ P(gl::TexStorageMem3DMultisampleEXTContextANGLE)},
+ {"glTexSubImage2D", P(gl::TexSubImage2D)},
+ {"glTexSubImage2DContextANGLE", P(gl::TexSubImage2DContextANGLE)},
+ {"glTexSubImage2DRobustANGLE", P(gl::TexSubImage2DRobustANGLE)},
+ {"glTexSubImage2DRobustANGLEContextANGLE", P(gl::TexSubImage2DRobustANGLEContextANGLE)},
+ {"glTexSubImage3D", P(gl::TexSubImage3D)},
+ {"glTexSubImage3DContextANGLE", P(gl::TexSubImage3DContextANGLE)},
+ {"glTexSubImage3DOES", P(gl::TexSubImage3DOES)},
+ {"glTexSubImage3DOESContextANGLE", P(gl::TexSubImage3DOESContextANGLE)},
+ {"glTexSubImage3DRobustANGLE", P(gl::TexSubImage3DRobustANGLE)},
+ {"glTexSubImage3DRobustANGLEContextANGLE", P(gl::TexSubImage3DRobustANGLEContextANGLE)},
+ {"glTransformFeedbackVaryings", P(gl::TransformFeedbackVaryings)},
+ {"glTransformFeedbackVaryingsContextANGLE", P(gl::TransformFeedbackVaryingsContextANGLE)},
+ {"glTranslatef", P(gl::Translatef)},
+ {"glTranslatefContextANGLE", P(gl::TranslatefContextANGLE)},
+ {"glTranslatex", P(gl::Translatex)},
+ {"glTranslatexContextANGLE", P(gl::TranslatexContextANGLE)},
+ {"glUniform1f", P(gl::Uniform1f)},
+ {"glUniform1fContextANGLE", P(gl::Uniform1fContextANGLE)},
+ {"glUniform1fv", P(gl::Uniform1fv)},
+ {"glUniform1fvContextANGLE", P(gl::Uniform1fvContextANGLE)},
+ {"glUniform1i", P(gl::Uniform1i)},
+ {"glUniform1iContextANGLE", P(gl::Uniform1iContextANGLE)},
+ {"glUniform1iv", P(gl::Uniform1iv)},
+ {"glUniform1ivContextANGLE", P(gl::Uniform1ivContextANGLE)},
+ {"glUniform1ui", P(gl::Uniform1ui)},
+ {"glUniform1uiContextANGLE", P(gl::Uniform1uiContextANGLE)},
+ {"glUniform1uiv", P(gl::Uniform1uiv)},
+ {"glUniform1uivContextANGLE", P(gl::Uniform1uivContextANGLE)},
+ {"glUniform2f", P(gl::Uniform2f)},
+ {"glUniform2fContextANGLE", P(gl::Uniform2fContextANGLE)},
+ {"glUniform2fv", P(gl::Uniform2fv)},
+ {"glUniform2fvContextANGLE", P(gl::Uniform2fvContextANGLE)},
+ {"glUniform2i", P(gl::Uniform2i)},
+ {"glUniform2iContextANGLE", P(gl::Uniform2iContextANGLE)},
+ {"glUniform2iv", P(gl::Uniform2iv)},
+ {"glUniform2ivContextANGLE", P(gl::Uniform2ivContextANGLE)},
+ {"glUniform2ui", P(gl::Uniform2ui)},
+ {"glUniform2uiContextANGLE", P(gl::Uniform2uiContextANGLE)},
+ {"glUniform2uiv", P(gl::Uniform2uiv)},
+ {"glUniform2uivContextANGLE", P(gl::Uniform2uivContextANGLE)},
+ {"glUniform3f", P(gl::Uniform3f)},
+ {"glUniform3fContextANGLE", P(gl::Uniform3fContextANGLE)},
+ {"glUniform3fv", P(gl::Uniform3fv)},
+ {"glUniform3fvContextANGLE", P(gl::Uniform3fvContextANGLE)},
+ {"glUniform3i", P(gl::Uniform3i)},
+ {"glUniform3iContextANGLE", P(gl::Uniform3iContextANGLE)},
+ {"glUniform3iv", P(gl::Uniform3iv)},
+ {"glUniform3ivContextANGLE", P(gl::Uniform3ivContextANGLE)},
+ {"glUniform3ui", P(gl::Uniform3ui)},
+ {"glUniform3uiContextANGLE", P(gl::Uniform3uiContextANGLE)},
+ {"glUniform3uiv", P(gl::Uniform3uiv)},
+ {"glUniform3uivContextANGLE", P(gl::Uniform3uivContextANGLE)},
+ {"glUniform4f", P(gl::Uniform4f)},
+ {"glUniform4fContextANGLE", P(gl::Uniform4fContextANGLE)},
+ {"glUniform4fv", P(gl::Uniform4fv)},
+ {"glUniform4fvContextANGLE", P(gl::Uniform4fvContextANGLE)},
+ {"glUniform4i", P(gl::Uniform4i)},
+ {"glUniform4iContextANGLE", P(gl::Uniform4iContextANGLE)},
+ {"glUniform4iv", P(gl::Uniform4iv)},
+ {"glUniform4ivContextANGLE", P(gl::Uniform4ivContextANGLE)},
+ {"glUniform4ui", P(gl::Uniform4ui)},
+ {"glUniform4uiContextANGLE", P(gl::Uniform4uiContextANGLE)},
+ {"glUniform4uiv", P(gl::Uniform4uiv)},
+ {"glUniform4uivContextANGLE", P(gl::Uniform4uivContextANGLE)},
+ {"glUniformBlockBinding", P(gl::UniformBlockBinding)},
+ {"glUniformBlockBindingContextANGLE", P(gl::UniformBlockBindingContextANGLE)},
+ {"glUniformMatrix2fv", P(gl::UniformMatrix2fv)},
+ {"glUniformMatrix2fvContextANGLE", P(gl::UniformMatrix2fvContextANGLE)},
+ {"glUniformMatrix2x3fv", P(gl::UniformMatrix2x3fv)},
+ {"glUniformMatrix2x3fvContextANGLE", P(gl::UniformMatrix2x3fvContextANGLE)},
+ {"glUniformMatrix2x4fv", P(gl::UniformMatrix2x4fv)},
+ {"glUniformMatrix2x4fvContextANGLE", P(gl::UniformMatrix2x4fvContextANGLE)},
+ {"glUniformMatrix3fv", P(gl::UniformMatrix3fv)},
+ {"glUniformMatrix3fvContextANGLE", P(gl::UniformMatrix3fvContextANGLE)},
+ {"glUniformMatrix3x2fv", P(gl::UniformMatrix3x2fv)},
+ {"glUniformMatrix3x2fvContextANGLE", P(gl::UniformMatrix3x2fvContextANGLE)},
+ {"glUniformMatrix3x4fv", P(gl::UniformMatrix3x4fv)},
+ {"glUniformMatrix3x4fvContextANGLE", P(gl::UniformMatrix3x4fvContextANGLE)},
+ {"glUniformMatrix4fv", P(gl::UniformMatrix4fv)},
+ {"glUniformMatrix4fvContextANGLE", P(gl::UniformMatrix4fvContextANGLE)},
+ {"glUniformMatrix4x2fv", P(gl::UniformMatrix4x2fv)},
+ {"glUniformMatrix4x2fvContextANGLE", P(gl::UniformMatrix4x2fvContextANGLE)},
+ {"glUniformMatrix4x3fv", P(gl::UniformMatrix4x3fv)},
+ {"glUniformMatrix4x3fvContextANGLE", P(gl::UniformMatrix4x3fvContextANGLE)},
+ {"glUnmapBuffer", P(gl::UnmapBuffer)},
+ {"glUnmapBufferContextANGLE", P(gl::UnmapBufferContextANGLE)},
+ {"glUnmapBufferOES", P(gl::UnmapBufferOES)},
+ {"glUnmapBufferOESContextANGLE", P(gl::UnmapBufferOESContextANGLE)},
+ {"glUseProgram", P(gl::UseProgram)},
+ {"glUseProgramContextANGLE", P(gl::UseProgramContextANGLE)},
+ {"glUseProgramStages", P(gl::UseProgramStages)},
+ {"glUseProgramStagesContextANGLE", P(gl::UseProgramStagesContextANGLE)},
+ {"glValidateProgram", P(gl::ValidateProgram)},
+ {"glValidateProgramContextANGLE", P(gl::ValidateProgramContextANGLE)},
+ {"glValidateProgramPipeline", P(gl::ValidateProgramPipeline)},
+ {"glValidateProgramPipelineContextANGLE", P(gl::ValidateProgramPipelineContextANGLE)},
+ {"glVertexAttrib1f", P(gl::VertexAttrib1f)},
+ {"glVertexAttrib1fContextANGLE", P(gl::VertexAttrib1fContextANGLE)},
+ {"glVertexAttrib1fv", P(gl::VertexAttrib1fv)},
+ {"glVertexAttrib1fvContextANGLE", P(gl::VertexAttrib1fvContextANGLE)},
+ {"glVertexAttrib2f", P(gl::VertexAttrib2f)},
+ {"glVertexAttrib2fContextANGLE", P(gl::VertexAttrib2fContextANGLE)},
+ {"glVertexAttrib2fv", P(gl::VertexAttrib2fv)},
+ {"glVertexAttrib2fvContextANGLE", P(gl::VertexAttrib2fvContextANGLE)},
+ {"glVertexAttrib3f", P(gl::VertexAttrib3f)},
+ {"glVertexAttrib3fContextANGLE", P(gl::VertexAttrib3fContextANGLE)},
+ {"glVertexAttrib3fv", P(gl::VertexAttrib3fv)},
+ {"glVertexAttrib3fvContextANGLE", P(gl::VertexAttrib3fvContextANGLE)},
+ {"glVertexAttrib4f", P(gl::VertexAttrib4f)},
+ {"glVertexAttrib4fContextANGLE", P(gl::VertexAttrib4fContextANGLE)},
+ {"glVertexAttrib4fv", P(gl::VertexAttrib4fv)},
+ {"glVertexAttrib4fvContextANGLE", P(gl::VertexAttrib4fvContextANGLE)},
+ {"glVertexAttribBinding", P(gl::VertexAttribBinding)},
+ {"glVertexAttribBindingContextANGLE", P(gl::VertexAttribBindingContextANGLE)},
+ {"glVertexAttribDivisor", P(gl::VertexAttribDivisor)},
+ {"glVertexAttribDivisorANGLE", P(gl::VertexAttribDivisorANGLE)},
+ {"glVertexAttribDivisorANGLEContextANGLE", P(gl::VertexAttribDivisorANGLEContextANGLE)},
+ {"glVertexAttribDivisorContextANGLE", P(gl::VertexAttribDivisorContextANGLE)},
+ {"glVertexAttribDivisorEXT", P(gl::VertexAttribDivisorEXT)},
+ {"glVertexAttribDivisorEXTContextANGLE", P(gl::VertexAttribDivisorEXTContextANGLE)},
+ {"glVertexAttribFormat", P(gl::VertexAttribFormat)},
+ {"glVertexAttribFormatContextANGLE", P(gl::VertexAttribFormatContextANGLE)},
+ {"glVertexAttribI4i", P(gl::VertexAttribI4i)},
+ {"glVertexAttribI4iContextANGLE", P(gl::VertexAttribI4iContextANGLE)},
+ {"glVertexAttribI4iv", P(gl::VertexAttribI4iv)},
+ {"glVertexAttribI4ivContextANGLE", P(gl::VertexAttribI4ivContextANGLE)},
+ {"glVertexAttribI4ui", P(gl::VertexAttribI4ui)},
+ {"glVertexAttribI4uiContextANGLE", P(gl::VertexAttribI4uiContextANGLE)},
+ {"glVertexAttribI4uiv", P(gl::VertexAttribI4uiv)},
+ {"glVertexAttribI4uivContextANGLE", P(gl::VertexAttribI4uivContextANGLE)},
+ {"glVertexAttribIFormat", P(gl::VertexAttribIFormat)},
+ {"glVertexAttribIFormatContextANGLE", P(gl::VertexAttribIFormatContextANGLE)},
+ {"glVertexAttribIPointer", P(gl::VertexAttribIPointer)},
+ {"glVertexAttribIPointerContextANGLE", P(gl::VertexAttribIPointerContextANGLE)},
+ {"glVertexAttribPointer", P(gl::VertexAttribPointer)},
+ {"glVertexAttribPointerContextANGLE", P(gl::VertexAttribPointerContextANGLE)},
+ {"glVertexBindingDivisor", P(gl::VertexBindingDivisor)},
+ {"glVertexBindingDivisorContextANGLE", P(gl::VertexBindingDivisorContextANGLE)},
+ {"glVertexPointer", P(gl::VertexPointer)},
+ {"glVertexPointerContextANGLE", P(gl::VertexPointerContextANGLE)},
+ {"glViewport", P(gl::Viewport)},
+ {"glViewportContextANGLE", P(gl::ViewportContextANGLE)},
+ {"glWaitSemaphoreEXT", P(gl::WaitSemaphoreEXT)},
+ {"glWaitSemaphoreEXTContextANGLE", P(gl::WaitSemaphoreEXTContextANGLE)},
+ {"glWaitSync", P(gl::WaitSync)},
+ {"glWaitSyncContextANGLE", P(gl::WaitSyncContextANGLE)},
+ {"glWeightPointerOES", P(gl::WeightPointerOES)},
+ {"glWeightPointerOESContextANGLE", P(gl::WeightPointerOESContextANGLE)}};
+
+size_t g_numProcs = 1402;
+} // namespace egl
diff --git a/gfx/angle/checkout/src/libGLESv2/resource.h b/gfx/angle/checkout/src/libGLESv2/resource.h
new file mode 100644
index 0000000000..7308c2ecfd
--- /dev/null
+++ b/gfx/angle/checkout/src/libGLESv2/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by libGLESv2.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+# ifndef APSTUDIO_READONLY_SYMBOLS
+# define _APS_NEXT_RESOURCE_VALUE 101
+# define _APS_NEXT_COMMAND_VALUE 40001
+# define _APS_NEXT_CONTROL_VALUE 1001
+# define _APS_NEXT_SYMED_VALUE 101
+# endif
+#endif
diff --git a/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp b/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp
new file mode 100644
index 0000000000..b9bd73418c
--- /dev/null
+++ b/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "third_party/compiler/ArrayBoundsClamper.h"
+
+#include "compiler/translator/tree_util/IntermTraverse.h"
+
+// The built-in 'clamp' instruction only accepts floats and returns a float. I
+// iterated a few times with our driver team who examined the output from our
+// compiler - they said the multiple casts generates more code than a single
+// function call. An inline ternary operator might have been better, but since
+// the index value might be an expression itself, we'd have to make temporary
+// variables to avoid evaluating the expression multiple times. And making
+// temporary variables was difficult because ANGLE would then need to make more
+// brutal changes to the expression tree.
+
+const char *kIntClampBegin = "// BEGIN: Generated code for array bounds clamping\n\n";
+const char *kIntClampEnd = "// END: Generated code for array bounds clamping\n\n";
+const char *kIntClampDefinition =
+ "int webgl_int_clamp(int value, int minValue, int maxValue) { return ((value < minValue) ? "
+ "minValue : ((value > maxValue) ? maxValue : value)); }\n\n";
+
+namespace sh
+{
+
+namespace
+{
+
+class ArrayBoundsClamperMarker : public TIntermTraverser
+{
+ public:
+ ArrayBoundsClamperMarker() : TIntermTraverser(true, false, false), mNeedsClamp(false) {}
+
+ bool visitBinary(Visit visit, TIntermBinary *node) override
+ {
+ if (node->getOp() == EOpIndexIndirect)
+ {
+ TIntermTyped *left = node->getLeft();
+ if (left->isArray() || left->isVector() || left->isMatrix())
+ {
+ node->setAddIndexClamp();
+ mNeedsClamp = true;
+ }
+ }
+ return true;
+ }
+
+ bool GetNeedsClamp() { return mNeedsClamp; }
+
+ private:
+ bool mNeedsClamp;
+};
+
+} // anonymous namespace
+
+ArrayBoundsClamper::ArrayBoundsClamper()
+ : mClampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC), mArrayBoundsClampDefinitionNeeded(false)
+{}
+
+void ArrayBoundsClamper::SetClampingStrategy(ShArrayIndexClampingStrategy clampingStrategy)
+{
+ mClampingStrategy = clampingStrategy;
+}
+
+void ArrayBoundsClamper::MarkIndirectArrayBoundsForClamping(TIntermNode *root)
+{
+ ASSERT(root);
+
+ ArrayBoundsClamperMarker clamper;
+ root->traverse(&clamper);
+ if (clamper.GetNeedsClamp())
+ {
+ SetArrayBoundsClampDefinitionNeeded();
+ }
+}
+
+void ArrayBoundsClamper::OutputClampingFunctionDefinition(TInfoSinkBase &out) const
+{
+ if (!mArrayBoundsClampDefinitionNeeded)
+ {
+ return;
+ }
+ if (mClampingStrategy != SH_CLAMP_WITH_USER_DEFINED_INT_CLAMP_FUNCTION)
+ {
+ return;
+ }
+ out << kIntClampBegin << kIntClampDefinition << kIntClampEnd;
+}
+
+} // namespace sh
diff --git a/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.h b/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.h
new file mode 100644
index 0000000000..4cb758840c
--- /dev/null
+++ b/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef THIRD_PARTY_COMPILER_ARRAYBOUNDSCLAMPER_H_
+#define THIRD_PARTY_COMPILER_ARRAYBOUNDSCLAMPER_H_
+
+#include "compiler/translator/InfoSink.h"
+#include "compiler/translator/IntermNode.h"
+
+namespace sh
+{
+
+class ArrayBoundsClamper
+{
+ public:
+ ArrayBoundsClamper();
+
+ // Must be set before compiling any shaders to ensure consistency
+ // between the translated shaders and any necessary prequel.
+ void SetClampingStrategy(ShArrayIndexClampingStrategy clampingStrategy);
+
+ // Marks nodes in the tree that index arrays indirectly as
+ // requiring clamping.
+ void MarkIndirectArrayBoundsForClamping(TIntermNode *root);
+
+ // If necessary, output array clamp function source into the shader source.
+ void OutputClampingFunctionDefinition(TInfoSinkBase &out) const;
+
+ void Cleanup() { mArrayBoundsClampDefinitionNeeded = false; }
+
+ private:
+ bool GetArrayBoundsClampDefinitionNeeded() const { return mArrayBoundsClampDefinitionNeeded; }
+ void SetArrayBoundsClampDefinitionNeeded() { mArrayBoundsClampDefinitionNeeded = true; }
+
+ ShArrayIndexClampingStrategy mClampingStrategy;
+ bool mArrayBoundsClampDefinitionNeeded;
+};
+
+} // namespace sh
+
+#endif // THIRD_PARTY_COMPILER_ARRAYBOUNDSCLAMPER_H_
diff --git a/gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.cpp b/gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.cpp
new file mode 100644
index 0000000000..4b11109761
--- /dev/null
+++ b/gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <windows.h>
+#include "common/platform.h"
+
+#if _WIN32_WINNT_WINBLUE
+# include <versionhelpers.h>
+#endif
+
+namespace rx
+{
+
+#ifndef _WIN32_WINNT_WINBLUE
+static bool IsWindowsVistaOrGreater()
+{
+ OSVERSIONINFOEXW osvi = {};
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_VISTA);
+ osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_VISTA);
+ DWORDLONG condition = 0;
+ VER_SET_CONDITION(condition, VER_MAJORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(condition, VER_MINORVERSION, VER_GREATER_EQUAL);
+ return !!::VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION, condition);
+}
+#endif
+
+bool isWindowsVistaOrGreater()
+{
+ static bool initialized = false;
+ static bool cachedIsWindowsVistaOrGreater;
+
+ if (!initialized)
+ {
+ initialized = true;
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ cachedIsWindowsVistaOrGreater = true;
+#else
+ cachedIsWindowsVistaOrGreater = IsWindowsVistaOrGreater();
+#endif
+ }
+ return cachedIsWindowsVistaOrGreater;
+}
+
+} // namespace rx
diff --git a/gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.h b/gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.h
new file mode 100644
index 0000000000..5c3b2e6541
--- /dev/null
+++ b/gfx/angle/checkout/src/third_party/systeminfo/SystemInfo.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef THIRD_PARTY_SYSTEMINFO_SYSTEMINFO_H_
+#define THIRD_PARTY_SYSTEMINFO_SYSTEMINFO_H_
+
+namespace rx
+{
+
+bool isWindowsVistaOrGreater();
+
+} // namespace rx
+
+#endif // THIRD_PARTY_SYSTEMINFO_SYSTEMINFO_H_
diff --git a/gfx/angle/checkout/src/third_party/trace_event/trace_event.h b/gfx/angle/checkout/src/third_party/trace_event/trace_event.h
new file mode 100644
index 0000000000..a29e70808f
--- /dev/null
+++ b/gfx/angle/checkout/src/third_party/trace_event/trace_event.h
@@ -0,0 +1,775 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Trace events are for tracking application performance and resource usage.
+// Macros are provided to track:
+// Begin and end of function calls
+// Counters
+//
+// Events are issued against categories. Whereas LOG's
+// categories are statically defined, TRACE categories are created
+// implicitly with a string. For example:
+// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
+//
+// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope:
+// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly")
+// doSomethingCostly()
+// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly")
+// Note: our tools can't always determine the correct BEGIN/END pairs unless
+// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you need them
+// to be in separate scopes.
+//
+// A common use case is to trace entire function scopes. This
+// issues a trace BEGIN and END automatically:
+// void doSomethingCostly() {
+// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly");
+// ...
+// }
+//
+// Additional parameters can be associated with an event:
+// void doSomethingCostly2(int howMuch) {
+// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly",
+// "howMuch", howMuch);
+// ...
+// }
+//
+// The trace system will automatically add to this information the
+// current process id, thread id, and a timestamp in microseconds.
+//
+// To trace an asynchronous procedure such as an IPC send/receive, use ASYNC_BEGIN and
+// ASYNC_END:
+// [single threaded sender code]
+// static int send_count = 0;
+// ++send_count;
+// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count);
+// Send(new MyMessage(send_count));
+// [receive code]
+// void OnMyMessage(send_count) {
+// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count);
+// }
+// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs.
+// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process. Pointers can
+// be used for the ID parameter, and they will be mangled internally so that
+// the same pointer on two different processes will not match. For example:
+// class MyTracedClass {
+// public:
+// MyTracedClass() {
+// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this);
+// }
+// ~MyTracedClass() {
+// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this);
+// }
+// }
+//
+// Trace event also supports counters, which is a way to track a quantity
+// as it varies over time. Counters are created with the following macro:
+// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue);
+//
+// Counters are process-specific. The macro itself can be issued from any
+// thread, however.
+//
+// Sometimes, you want to track two counters at once. You can do this with two
+// counter macros:
+// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]);
+// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]);
+// Or you can do it with a combined macro:
+// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter",
+// "bytesPinned", g_myCounterValue[0],
+// "bytesAllocated", g_myCounterValue[1]);
+// This indicates to the tracing UI that these counters should be displayed
+// in a single graph, as a summed area chart.
+//
+// Since counters are in a global namespace, you may want to disembiguate with a
+// unique ID, by using the TRACE_COUNTER_ID* variations.
+//
+// By default, trace collection is compiled in, but turned off at runtime.
+// Collecting trace data is the responsibility of the embedding
+// application. In Chrome's case, navigating to about:tracing will turn on
+// tracing and display data collected across all active processes.
+//
+//
+// Memory scoping note:
+// Tracing copies the pointers, not the string content, of the strings passed
+// in for category, name, and arg_names. Thus, the following code will
+// cause problems:
+// char* str = strdup("impprtantName");
+// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD!
+// free(str); // Trace system now has dangling pointer
+//
+// To avoid this issue with the |name| and |arg_name| parameters, use the
+// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime overhead.
+// Notes: The category must always be in a long-lived char* (i.e. static const).
+// The |arg_values|, when used, are always deep copied with the _COPY
+// macros.
+//
+// When are string argument values copied:
+// const char* arg_values are only referenced by default:
+// TRACE_EVENT1("category", "name",
+// "arg1", "literal string is only referenced");
+// Use TRACE_STR_COPY to force copying of a const char*:
+// TRACE_EVENT1("category", "name",
+// "arg1", TRACE_STR_COPY("string will be copied"));
+// std::string arg_values are always copied:
+// TRACE_EVENT1("category", "name",
+// "arg1", std::string("string will be copied"));
+//
+//
+// Thread Safety:
+// A thread safe singleton and mutex are used for thread safety. Category
+// enabled flags are used to limit the performance impact when the system
+// is not enabled.
+//
+// TRACE_EVENT macros first cache a pointer to a category. The categories are
+// statically allocated and safe at all times, even after exit. Fetching a
+// category is protected by the TraceLog::lock_. Multiple threads initializing
+// the static variable is safe, as they will be serialized by the lock and
+// multiple calls will return the same pointer to the category.
+//
+// Then the category_enabled flag is checked. This is a unsigned char, and
+// not intended to be multithread safe. It optimizes access to addTraceEvent
+// which is threadsafe internally via TraceLog::lock_. The enabled flag may
+// cause some threads to incorrectly call or skip calling addTraceEvent near
+// the time of the system being enabled or disabled. This is acceptable as
+// we tolerate some data loss while the system is being enabled/disabled and
+// because addTraceEvent is threadsafe internally and checks the enabled state
+// again under lock.
+//
+// Without the use of these static category pointers and enabled flags all
+// trace points would carry a significant performance cost of aquiring a lock
+// and resolving the category.
+
+#ifndef COMMON_TRACE_EVENT_H_
+#define COMMON_TRACE_EVENT_H_
+
+#include <string>
+
+#include "common/event_tracer.h"
+
+// By default, const char* argument values are assumed to have long-lived scope
+// and will not be copied. Use this macro to force a const char* to be copied.
+#define TRACE_STR_COPY(str) WebCore::TraceEvent::TraceStringWithCopy(str)
+
+// Records a pair of begin and end events called "name" for the current
+// scope, with 0, 1 or 2 associated arguments. If the category is not
+// enabled, then this does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT0(platform, category, name) \
+ INTERNAL_TRACE_EVENT_ADD_SCOPED(platform, category, name)
+#define TRACE_EVENT1(platform, category, name, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD_SCOPED(platform, category, name, arg1_name, arg1_val)
+#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD_SCOPED(platform, category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val)
+
+// Records a single event called "name" immediately, with 0, 1 or 2
+// associated arguments. If the category is not enabled, then this
+// does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT_INSTANT0(platform, category, name) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_INSTANT, category, name, \
+ TRACE_EVENT_FLAG_NONE)
+#define TRACE_EVENT_INSTANT1(platform, category, name, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_INSTANT, category, name, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
+#define TRACE_EVENT_INSTANT2(platform, category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_INSTANT, category, name, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
+#define TRACE_EVENT_COPY_INSTANT0(platform, category, name) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_INSTANT, category, name, \
+ TRACE_EVENT_FLAG_COPY)
+#define TRACE_EVENT_COPY_INSTANT1(platform, category, name, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_INSTANT, category, name, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
+#define TRACE_EVENT_COPY_INSTANT2(platform, category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_INSTANT, category, name, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val)
+
+// Records a single BEGIN event called "name" immediately, with 0, 1 or 2
+// associated arguments. If the category is not enabled, then this
+// does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT_BEGIN0(platform, category, name) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_BEGIN, category, name, \
+ TRACE_EVENT_FLAG_NONE)
+#define TRACE_EVENT_BEGIN1(platform, category, name, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_BEGIN, category, name, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
+#define TRACE_EVENT_BEGIN2(platform, category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_BEGIN, category, name, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
+#define TRACE_EVENT_COPY_BEGIN0(platform, category, name) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_BEGIN, category, name, \
+ TRACE_EVENT_FLAG_COPY)
+#define TRACE_EVENT_COPY_BEGIN1(platform, category, name, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_BEGIN, category, name, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
+#define TRACE_EVENT_COPY_BEGIN2(platform, category, name, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_BEGIN, category, name, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val)
+
+// Records a single END event for "name" immediately. If the category
+// is not enabled, then this does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_EVENT_END0(platform, category, name) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_END, category, name, TRACE_EVENT_FLAG_NONE)
+#define TRACE_EVENT_END1(platform, category, name, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_END, category, name, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
+#define TRACE_EVENT_END2(platform, category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_END, category, name, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
+#define TRACE_EVENT_COPY_END0(platform, category, name) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_END, category, name, TRACE_EVENT_FLAG_COPY)
+#define TRACE_EVENT_COPY_END1(platform, category, name, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_END, category, name, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
+#define TRACE_EVENT_COPY_END2(platform, category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_END, category, name, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, arg2_val)
+
+// Records the value of a counter called "name" immediately. Value
+// must be representable as a 32 bit integer.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_COUNTER1(platform, category, name, value) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_COUNTER, category, name, \
+ TRACE_EVENT_FLAG_NONE, "value", static_cast<int>(value))
+#define TRACE_COPY_COUNTER1(platform, category, name, value) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_COUNTER, category, name, \
+ TRACE_EVENT_FLAG_COPY, "value", static_cast<int>(value))
+
+// Records the values of a multi-parted counter called "name" immediately.
+// The UI will treat value1 and value2 as parts of a whole, displaying their
+// values as a stacked-bar chart.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+#define TRACE_COUNTER2(platform, category, name, value1_name, value1_val, value2_name, value2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_COUNTER, category, name, \
+ TRACE_EVENT_FLAG_NONE, value1_name, static_cast<int>(value1_val), \
+ value2_name, static_cast<int>(value2_val))
+#define TRACE_COPY_COUNTER2(platform, category, name, value1_name, value1_val, value2_name, \
+ value2_val) \
+ INTERNAL_TRACE_EVENT_ADD(platform, TRACE_EVENT_PHASE_COUNTER, category, name, \
+ TRACE_EVENT_FLAG_COPY, value1_name, static_cast<int>(value1_val), \
+ value2_name, static_cast<int>(value2_val))
+
+// Records the value of a counter called "name" immediately. Value
+// must be representable as a 32 bit integer.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+// - |id| is used to disambiguate counters with the same name. It must either
+// be a pointer or an integer value up to 64 bits. If it's a pointer, the bits
+// will be xored with a hash of the process ID so that the same pointer on
+// two different processes will not collide.
+#define TRACE_COUNTER_ID1(platform, category, name, id, value) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_COUNTER, category, name, id, \
+ TRACE_EVENT_FLAG_NONE, "value", static_cast<int>(value))
+#define TRACE_COPY_COUNTER_ID1(platform, category, name, id, value) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_COUNTER, category, name, id, \
+ TRACE_EVENT_FLAG_COPY, "value", static_cast<int>(value))
+
+// Records the values of a multi-parted counter called "name" immediately.
+// The UI will treat value1 and value2 as parts of a whole, displaying their
+// values as a stacked-bar chart.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+// - |id| is used to disambiguate counters with the same name. It must either
+// be a pointer or an integer value up to 64 bits. If it's a pointer, the bits
+// will be xored with a hash of the process ID so that the same pointer on
+// two different processes will not collide.
+#define TRACE_COUNTER_ID2(platform, category, name, id, value1_name, value1_val, value2_name, \
+ value2_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
+ platform, TRACE_EVENT_PHASE_COUNTER, category, name, id, TRACE_EVENT_FLAG_NONE, \
+ value1_name, static_cast<int>(value1_val), value2_name, static_cast<int>(value2_val))
+#define TRACE_COPY_COUNTER_ID2(platform, category, name, id, value1_name, value1_val, value2_name, \
+ value2_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
+ platform, TRACE_EVENT_PHASE_COUNTER, category, name, id, TRACE_EVENT_FLAG_COPY, \
+ value1_name, static_cast<int>(value1_val), value2_name, static_cast<int>(value2_val))
+
+// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
+// associated arguments. If the category is not enabled, then this
+// does nothing.
+// - category and name strings must have application lifetime (statics or
+// literals). They may not include " chars.
+// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC
+// events are considered to match if their category, name and id values all
+// match. |id| must either be a pointer or an integer value up to 64 bits. If
+// it's a pointer, the bits will be xored with a hash of the process ID so
+// that the same pointer on two different processes will not collide.
+// An asynchronous operation can consist of multiple phases. The first phase is
+// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the
+// ASYNC_STEP_BEGIN macros. When the operation completes, call ASYNC_END.
+// An async operation can span threads and processes, but all events in that
+// operation must use the same |name| and |id|. Each event can have its own
+// args.
+#define TRACE_EVENT_ASYNC_BEGIN0(platform, category, name, id) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_BEGIN, category, name, id, \
+ TRACE_EVENT_FLAG_NONE)
+#define TRACE_EVENT_ASYNC_BEGIN1(platform, category, name, id, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_BEGIN, category, name, id, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
+#define TRACE_EVENT_ASYNC_BEGIN2(platform, category, name, id, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_BEGIN, category, name, id, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, \
+ arg2_val)
+#define TRACE_EVENT_COPY_ASYNC_BEGIN0(platform, category, name, id) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_BEGIN, category, name, id, \
+ TRACE_EVENT_FLAG_COPY)
+#define TRACE_EVENT_COPY_ASYNC_BEGIN1(platform, category, name, id, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_BEGIN, category, name, id, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
+#define TRACE_EVENT_COPY_ASYNC_BEGIN2(platform, category, name, id, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_BEGIN, category, name, id, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \
+ arg2_val)
+
+// Records a single ASYNC_STEP event for |step| immediately. If the category
+// is not enabled, then this does nothing. The |name| and |id| must match the
+// ASYNC_BEGIN event above. The |step| param identifies this step within the
+// async event. This should be called at the beginning of the next phase of an
+// asynchronous operation.
+#define TRACE_EVENT_ASYNC_STEP0(platform, category, name, id, step) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_STEP, category, name, id, \
+ TRACE_EVENT_FLAG_NONE, "step", step)
+#define TRACE_EVENT_ASYNC_STEP1(platform, category, name, id, step, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_STEP, category, name, id, \
+ TRACE_EVENT_FLAG_NONE, "step", step, arg1_name, arg1_val)
+#define TRACE_EVENT_COPY_ASYNC_STEP0(platform, category, name, id, step) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_STEP, category, name, id, \
+ TRACE_EVENT_FLAG_COPY, "step", step)
+#define TRACE_EVENT_COPY_ASYNC_STEP1(platform, category, name, id, step, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_STEP, category, name, id, \
+ TRACE_EVENT_FLAG_COPY, "step", step, arg1_name, arg1_val)
+
+// Records a single ASYNC_END event for "name" immediately. If the category
+// is not enabled, then this does nothing.
+#define TRACE_EVENT_ASYNC_END0(platform, category, name, id) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_END, category, name, id, \
+ TRACE_EVENT_FLAG_NONE)
+#define TRACE_EVENT_ASYNC_END1(platform, category, name, id, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_END, category, name, id, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
+#define TRACE_EVENT_ASYNC_END2(platform, category, name, id, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_END, category, name, id, \
+ TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, \
+ arg2_val)
+#define TRACE_EVENT_COPY_ASYNC_END0(platform, category, name, id) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_END, category, name, id, \
+ TRACE_EVENT_FLAG_COPY)
+#define TRACE_EVENT_COPY_ASYNC_END1(platform, category, name, id, arg1_name, arg1_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_END, category, name, id, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
+#define TRACE_EVENT_COPY_ASYNC_END2(platform, category, name, id, arg1_name, arg1_val, arg2_name, \
+ arg2_val) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, TRACE_EVENT_PHASE_ASYNC_END, category, name, id, \
+ TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \
+ arg2_val)
+
+// Creates a scope of a sampling state with the given category and name (both must
+// be constant strings). These states are intended for a sampling profiler.
+// Implementation note: we store category and name together because we don't
+// want the inconsistency/expense of storing two pointers.
+// |thread_bucket| is [0..2] and is used to statically isolate samples in one
+// thread from others.
+//
+// { // The sampling state is set within this scope.
+// TRACE_EVENT_SAMPLING_STATE_SCOPE_FOR_BUCKET(0, "category", "name");
+// ...;
+// }
+#define TRACE_EVENT_SCOPED_SAMPLING_STATE_FOR_BUCKET(bucket_number, category, name) \
+ TraceEvent::SamplingStateScope<bucket_number> traceEventSamplingScope(category "\0" name);
+
+// Returns a current sampling state of the given bucket.
+// The format of the returned string is "category\0name".
+#define TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(bucket_number) \
+ TraceEvent::SamplingStateScope<bucket_number>::current()
+
+// Sets a current sampling state of the given bucket.
+// |category| and |name| have to be constant strings.
+#define TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(bucket_number, category, name) \
+ TraceEvent::SamplingStateScope<bucket_number>::set(category "\0" name)
+
+// Sets a current sampling state of the given bucket.
+// |categoryAndName| doesn't need to be a constant string.
+// The format of the string is "category\0name".
+#define TRACE_EVENT_SET_NONCONST_SAMPLING_STATE_FOR_BUCKET(bucket_number, categoryAndName) \
+ TraceEvent::SamplingStateScope<bucket_number>::set(categoryAndName)
+
+// Syntactic sugars for the sampling tracing in the main thread.
+#define TRACE_EVENT_SCOPED_SAMPLING_STATE(category, name) \
+ TRACE_EVENT_SCOPED_SAMPLING_STATE_FOR_BUCKET(0, category, name)
+#define TRACE_EVENT_GET_SAMPLING_STATE() TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(0)
+#define TRACE_EVENT_SET_SAMPLING_STATE(category, name) \
+ TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET(0, category, name)
+#define TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(categoryAndName) \
+ TRACE_EVENT_SET_NONCONST_SAMPLING_STATE_FOR_BUCKET(0, categoryAndName)
+
+////////////////////////////////////////////////////////////////////////////////
+// Implementation specific tracing API definitions.
+
+// Get a pointer to the enabled state of the given trace category. Only
+// long-lived literal strings should be given as the category name. The returned
+// pointer can be held permanently in a local static for example. If the
+// unsigned char is non-zero, tracing is enabled. If tracing is enabled,
+// TRACE_EVENT_API_ADD_TRACE_EVENT can be called. It's OK if tracing is disabled
+// between the load of the tracing state and the call to
+// TRACE_EVENT_API_ADD_TRACE_EVENT, because this flag only provides an early out
+// for best performance when tracing is disabled.
+// const unsigned char*
+// TRACE_EVENT_API_GET_CATEGORY_ENABLED(const char* category_name)
+#define TRACE_EVENT_API_GET_CATEGORY_ENABLED angle::GetTraceCategoryEnabledFlag
+
+// Add a trace event to the platform tracing system.
+// void TRACE_EVENT_API_ADD_TRACE_EVENT(
+// char phase,
+// const unsigned char* category_enabled,
+// const char* name,
+// unsigned long long id,
+// int num_args,
+// const char** arg_names,
+// const unsigned char* arg_types,
+// const unsigned long long* arg_values,
+// unsigned char flags)
+#define TRACE_EVENT_API_ADD_TRACE_EVENT angle::AddTraceEvent
+
+////////////////////////////////////////////////////////////////////////////////
+
+// Implementation detail: trace event macros create temporary variables
+// to keep instrumentation overhead low. These macros give each temporary
+// variable a unique name based on the line number to prevent name collissions.
+#define INTERNAL_TRACE_EVENT_UID3(a, b) trace_event_unique_##a##b
+#define INTERNAL_TRACE_EVENT_UID2(a, b) INTERNAL_TRACE_EVENT_UID3(a, b)
+#define INTERNALTRACEEVENTUID(name_prefix) INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__)
+
+// Implementation detail: internal macro to create static category.
+#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, category) \
+ static const unsigned char *INTERNALTRACEEVENTUID(catstatic) = 0; \
+ if (!INTERNALTRACEEVENTUID(catstatic)) \
+ INTERNALTRACEEVENTUID(catstatic) = TRACE_EVENT_API_GET_CATEGORY_ENABLED(platform, category);
+
+// Implementation detail: internal macro to create static category and add
+// event if the category is enabled.
+#define INTERNAL_TRACE_EVENT_ADD(platform, phase, category, name, flags, ...) \
+ do \
+ { \
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, category); \
+ if (*INTERNALTRACEEVENTUID(catstatic)) \
+ { \
+ gl::TraceEvent::addTraceEvent(platform, phase, INTERNALTRACEEVENTUID(catstatic), name, \
+ gl::TraceEvent::noEventId, flags, ##__VA_ARGS__); \
+ } \
+ } while (0)
+
+// Implementation detail: internal macro to create static category and add begin
+// event if the category is enabled. Also adds the end event when the scope
+// ends.
+#define INTERNAL_TRACE_EVENT_ADD_SCOPED(platform, category, name, ...) \
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, category); \
+ gl::TraceEvent::TraceEndOnScopeClose INTERNALTRACEEVENTUID(profileScope); \
+ if (*INTERNALTRACEEVENTUID(catstatic)) \
+ { \
+ gl::TraceEvent::addTraceEvent( \
+ platform, TRACE_EVENT_PHASE_BEGIN, INTERNALTRACEEVENTUID(catstatic), name, \
+ gl::TraceEvent::noEventId, TRACE_EVENT_FLAG_NONE, ##__VA_ARGS__); \
+ INTERNALTRACEEVENTUID(profileScope) \
+ .initialize(platform, INTERNALTRACEEVENTUID(catstatic), name); \
+ }
+
+// Implementation detail: internal macro to create static category and add
+// event if the category is enabled.
+#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(platform, phase, category, name, id, flags, ...) \
+ do \
+ { \
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(platform, category); \
+ if (*INTERNALTRACEEVENTUID(catstatic)) \
+ { \
+ unsigned char traceEventFlags = flags | TRACE_EVENT_FLAG_HAS_ID; \
+ gl::TraceEvent::TraceID traceEventTraceID(id, &traceEventFlags); \
+ gl::TraceEvent::addTraceEvent(platform, phase, INTERNALTRACEEVENTUID(catstatic), name, \
+ traceEventTraceID.data(), traceEventFlags, \
+ ##__VA_ARGS__); \
+ } \
+ } while (0)
+
+// Notes regarding the following definitions:
+// New values can be added and propagated to third party libraries, but existing
+// definitions must never be changed, because third party libraries may use old
+// definitions.
+
+// Phase indicates the nature of an event entry. E.g. part of a begin/end pair.
+#define TRACE_EVENT_PHASE_BEGIN ('B')
+#define TRACE_EVENT_PHASE_END ('E')
+#define TRACE_EVENT_PHASE_INSTANT ('I')
+#define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S')
+#define TRACE_EVENT_PHASE_ASYNC_STEP ('T')
+#define TRACE_EVENT_PHASE_ASYNC_END ('F')
+#define TRACE_EVENT_PHASE_METADATA ('M')
+#define TRACE_EVENT_PHASE_COUNTER ('C')
+#define TRACE_EVENT_PHASE_SAMPLE ('P')
+
+// Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT.
+#define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0))
+#define TRACE_EVENT_FLAG_COPY (static_cast<unsigned char>(1 << 0))
+#define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned char>(1 << 1))
+#define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned char>(1 << 2))
+
+// Type values for identifying types in the TraceValue union.
+#define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1))
+#define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2))
+#define TRACE_VALUE_TYPE_INT (static_cast<unsigned char>(3))
+#define TRACE_VALUE_TYPE_DOUBLE (static_cast<unsigned char>(4))
+#define TRACE_VALUE_TYPE_POINTER (static_cast<unsigned char>(5))
+#define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6))
+#define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7))
+
+namespace gl
+{
+
+namespace TraceEvent
+{
+
+// Specify these values when the corresponding argument of addTraceEvent is not
+// used.
+const int zeroNumArgs = 0;
+const unsigned long long noEventId = 0;
+
+// TraceID encapsulates an ID that can either be an integer or pointer. Pointers
+// are mangled with the Process ID so that they are unlikely to collide when the
+// same pointer is used on different processes.
+class TraceID
+{
+ public:
+ explicit TraceID(const void *id, unsigned char *flags)
+ : m_data(static_cast<unsigned long long>(reinterpret_cast<uintptr_t>(id)))
+ {
+ *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
+ }
+ explicit TraceID(unsigned long long id, unsigned char *flags) : m_data(id) { (void)flags; }
+ explicit TraceID(unsigned long id, unsigned char *flags) : m_data(id) { (void)flags; }
+ explicit TraceID(unsigned int id, unsigned char *flags) : m_data(id) { (void)flags; }
+ explicit TraceID(unsigned short id, unsigned char *flags) : m_data(id) { (void)flags; }
+ explicit TraceID(unsigned char id, unsigned char *flags) : m_data(id) { (void)flags; }
+ explicit TraceID(long long id, unsigned char *flags)
+ : m_data(static_cast<unsigned long long>(id))
+ {
+ (void)flags;
+ }
+ explicit TraceID(long id, unsigned char *flags) : m_data(static_cast<unsigned long long>(id))
+ {
+ (void)flags;
+ }
+ explicit TraceID(int id, unsigned char *flags) : m_data(static_cast<unsigned long long>(id))
+ {
+ (void)flags;
+ }
+ explicit TraceID(short id, unsigned char *flags) : m_data(static_cast<unsigned long long>(id))
+ {
+ (void)flags;
+ }
+ explicit TraceID(signed char id, unsigned char *flags)
+ : m_data(static_cast<unsigned long long>(id))
+ {
+ (void)flags;
+ }
+
+ unsigned long long data() const { return m_data; }
+
+ private:
+ unsigned long long m_data;
+};
+
+// Simple union to store various types as unsigned long long.
+union TraceValueUnion
+{
+ bool m_bool;
+ unsigned long long m_uint;
+ long long m_int;
+ double m_double;
+ const void *m_pointer;
+ const char *m_string;
+};
+
+// Simple container for const char* that should be copied instead of retained.
+class TraceStringWithCopy
+{
+ public:
+ explicit TraceStringWithCopy(const char *str) : m_str(str) {}
+ operator const char *() const { return m_str; }
+
+ private:
+ const char *m_str;
+};
+
+// Define setTraceValue for each allowed type. It stores the type and
+// value in the return arguments. This allows this API to avoid declaring any
+// structures so that it is portable to third_party libraries.
+#define INTERNAL_DECLARE_SET_TRACE_VALUE(actual_type, union_member, value_type_id) \
+ static inline void setTraceValue(actual_type arg, unsigned char *type, \
+ unsigned long long *value) \
+ { \
+ TraceValueUnion typeValue; \
+ typeValue.union_member = arg; \
+ *type = value_type_id; \
+ *value = typeValue.m_uint; \
+ }
+// Simpler form for int types that can be safely casted.
+#define INTERNAL_DECLARE_SET_TRACE_VALUE_INT(actual_type, value_type_id) \
+ static inline void setTraceValue(actual_type arg, unsigned char *type, \
+ unsigned long long *value) \
+ { \
+ *type = value_type_id; \
+ *value = static_cast<unsigned long long>(arg); \
+ }
+
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned long long, TRACE_VALUE_TYPE_UINT)
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned int, TRACE_VALUE_TYPE_UINT)
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned short, TRACE_VALUE_TYPE_UINT)
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(unsigned char, TRACE_VALUE_TYPE_UINT)
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(long long, TRACE_VALUE_TYPE_INT)
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(int, TRACE_VALUE_TYPE_INT)
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(short, TRACE_VALUE_TYPE_INT)
+INTERNAL_DECLARE_SET_TRACE_VALUE_INT(signed char, TRACE_VALUE_TYPE_INT)
+INTERNAL_DECLARE_SET_TRACE_VALUE(bool, m_bool, TRACE_VALUE_TYPE_BOOL)
+INTERNAL_DECLARE_SET_TRACE_VALUE(double, m_double, TRACE_VALUE_TYPE_DOUBLE)
+INTERNAL_DECLARE_SET_TRACE_VALUE(const void *, m_pointer, TRACE_VALUE_TYPE_POINTER)
+INTERNAL_DECLARE_SET_TRACE_VALUE(const char *, m_string, TRACE_VALUE_TYPE_STRING)
+INTERNAL_DECLARE_SET_TRACE_VALUE(const TraceStringWithCopy &,
+ m_string,
+ TRACE_VALUE_TYPE_COPY_STRING)
+
+#undef INTERNAL_DECLARE_SET_TRACE_VALUE
+#undef INTERNAL_DECLARE_SET_TRACE_VALUE_INT
+
+static inline void setTraceValue(const std::string &arg,
+ unsigned char *type,
+ unsigned long long *value)
+{
+ TraceValueUnion typeValue;
+ typeValue.m_string = arg.data();
+ *type = TRACE_VALUE_TYPE_COPY_STRING;
+ *value = typeValue.m_uint;
+}
+
+// These addTraceEvent template functions are defined here instead of in the
+// macro, because the arg values could be temporary string objects. In order to
+// store pointers to the internal c_str and pass through to the tracing API, the
+// arg values must live throughout these procedures.
+
+static inline angle::TraceEventHandle addTraceEvent(angle::PlatformMethods *platform,
+ char phase,
+ const unsigned char *categoryEnabled,
+ const char *name,
+ unsigned long long id,
+ unsigned char flags)
+{
+ return TRACE_EVENT_API_ADD_TRACE_EVENT(platform, phase, categoryEnabled, name, id, zeroNumArgs,
+ 0, 0, 0, flags);
+}
+
+template <class ARG1_TYPE>
+static inline angle::TraceEventHandle addTraceEvent(angle::PlatformMethods *platform,
+ char phase,
+ const unsigned char *categoryEnabled,
+ const char *name,
+ unsigned long long id,
+ unsigned char flags,
+ const char *arg1Name,
+ const ARG1_TYPE &arg1Val)
+{
+ const int numArgs = 1;
+ unsigned char argTypes[1];
+ unsigned long long argValues[1];
+ setTraceValue(arg1Val, &argTypes[0], &argValues[0]);
+ return TRACE_EVENT_API_ADD_TRACE_EVENT(platform, phase, categoryEnabled, name, id, numArgs,
+ &arg1Name, argTypes, argValues, flags);
+}
+
+template <class ARG1_TYPE, class ARG2_TYPE>
+static inline angle::TraceEventHandle addTraceEvent(angle::PlatformMethods *platform,
+ char phase,
+ const unsigned char *categoryEnabled,
+ const char *name,
+ unsigned long long id,
+ unsigned char flags,
+ const char *arg1Name,
+ const ARG1_TYPE &arg1Val,
+ const char *arg2Name,
+ const ARG2_TYPE &arg2Val)
+{
+ const int numArgs = 2;
+ const char *argNames[2] = {arg1Name, arg2Name};
+ unsigned char argTypes[2];
+ unsigned long long argValues[2];
+ setTraceValue(arg1Val, &argTypes[0], &argValues[0]);
+ setTraceValue(arg2Val, &argTypes[1], &argValues[1]);
+ return TRACE_EVENT_API_ADD_TRACE_EVENT(platform, phase, categoryEnabled, name, id, numArgs,
+ argNames, argTypes, argValues, flags);
+}
+
+// Used by TRACE_EVENTx macro. Do not use directly.
+class TraceEndOnScopeClose
+{
+ public:
+ // Note: members of m_data intentionally left uninitialized. See initialize.
+ TraceEndOnScopeClose() : m_pdata(0) {}
+ ~TraceEndOnScopeClose()
+ {
+ if (m_pdata)
+ addEventIfEnabled();
+ }
+
+ void initialize(angle::PlatformMethods *platform,
+ const unsigned char *categoryEnabled,
+ const char *name)
+ {
+ m_data.platform = platform;
+ m_data.categoryEnabled = categoryEnabled;
+ m_data.name = name;
+ m_pdata = &m_data;
+ }
+
+ private:
+ // Add the end event if the category is still enabled.
+ void addEventIfEnabled()
+ {
+ // Only called when m_pdata is non-null.
+ if (*m_pdata->categoryEnabled)
+ {
+ TRACE_EVENT_API_ADD_TRACE_EVENT(m_pdata->platform, TRACE_EVENT_PHASE_END,
+ m_pdata->categoryEnabled, m_pdata->name, noEventId,
+ zeroNumArgs, 0, 0, 0, TRACE_EVENT_FLAG_NONE);
+ }
+ }
+
+ // This Data struct workaround is to avoid initializing all the members
+ // in Data during construction of this object, since this object is always
+ // constructed, even when tracing is disabled. If the members of Data were
+ // members of this class instead, compiler warnings occur about potential
+ // uninitialized accesses.
+ struct Data
+ {
+ angle::PlatformMethods *platform;
+ const unsigned char *categoryEnabled;
+ const char *name;
+ };
+ Data *m_pdata;
+ Data m_data;
+};
+
+} // namespace TraceEvent
+
+} // namespace gl
+
+#endif
diff --git a/gfx/angle/cherry_picks.txt b/gfx/angle/cherry_picks.txt
new file mode 100644
index 0000000000..b5df62cdbe
--- /dev/null
+++ b/gfx/angle/cherry_picks.txt
@@ -0,0 +1,210 @@
+commit fa5e0bac2b3b087e14a06b468e354fc6a54b264a
+Author: Geoff Lang <geofflang@chromium.org>
+Date: Wed Sep 18 16:42:28 2019 -0400
+
+ Fix depth pitch calculations for compressed textures.
+
+ Depth pitch computations were not taking into account the block size
+ and simply multiplying the row pitch with the pixel height. This caused
+ our load functions to use a very high depth pitch, reading past the end
+ of the user-supplied buffer.
+
+ BUG=angleproject:3190
+ BUG=angleproject:3920
+
+ Change-Id: I4ef4763b542735993568c51ae4b5a235659b9094
+ Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1811837
+ Reviewed-by: Tim Van Patten <timvp@google.com>
+ Reviewed-by: Ian Elliott <ianelliott@google.com>
+ Commit-Queue: Geoff Lang <geofflang@chromium.org>
+
+commit 3a998d51928fb5856be5299fc189434d2da2e946
+Author: Jeff Muizelaar <jrmuizel@gmail.com>
+Date: Mon Nov 9 17:09:12 2020 -0500
+
+ Bug 1620075. Add a feature flag to allow ES3 on 10.0 devices. (#26)
+
+ This lets us run WebRender on devices that only support D3D 10.0
+
+commit cf6c1604e64084b97bc42d271a0abd9abcfc97a8
+Author: Geoff Lang <geofflang@chromium.org>
+Date: Wed May 13 18:50:51 2020 -0400
+
+ Unset the ActiveTextureCache entry if the program does not reference it
+
+ When changing uniforms of a program, State::onActiveTextureChange is
+ called to update the ActiveTextureCache. If the sampler uniform type
+ changes to TextureType::InvalidEnum, the entry in ActiveTextureCache was
+ not cleared. This causes stale entries in ActiveTextureCache because the
+ cache no longer matches what textures are bound and the cache does not
+ add references to the textures in it.
+
+ BUG=chromium:1078375
+ BUG=chromium:1072406
+ BUG=chromium:1078866
+
+ Change-Id: If9719dcd4fc865b2301db450eb8115e7cfe46c4a
+ Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2199654
+ Reviewed-by: Tim Van Patten <timvp@google.com>
+ Commit-Queue: Geoff Lang <geofflang@chromium.org>
+
+commit eabf2a79aac36223b5ab5c5b0810d5522095f0bc
+Author: Jeff Muizelaar <jrmuizel@gmail.com>
+Date: Mon May 11 13:01:46 2020 -0400
+
+ Use deviceContext instead of deviceContext1 (#24)
+
+ Sometimes we don't have a deviceContext1 (on Win7) and would crash. We
+ on't have any need to use it so just use deviceContext.
+
+commit 19f1bef071c32df60d9d62a7907c42270d0a3dd7
+Author: Jeff Muizelaar <jrmuizel@gmail.com>
+Date: Fri May 8 15:08:24 2020 -0400
+
+ Handle a null blend state. (#23)
+
+ Null is used as the default blend state so we have to check for it.
+
+commit 8df54289d717eb0624a0ee16fd681c73a9472af4
+Author: Jeff Muizelaar <jrmuizel@gmail.com>
+Date: Wed May 6 14:04:42 2020 -0400
+
+ Don't use ClearView if we previously used dual source blending on Intel gen6. (#22)
+
+ Doing a ClearView after a dual source blend seems to cause a TDR on
+ Intel SandyBridge. Presumeably this is because the ClearView is
+ implemented as a regular draw and the driver doesn't properly set up the
+ state.
+
+ If we detect that this is going to happen we fall back to the manual
+ draw call path. This lets us use ClearView most of the time still.
+
+commit 3885ee272685941f6dfb6cd941d550b107f033d2
+Author: Jeff Gilbert <jgilbert@mozilla.com>
+Date: Wed Jan 22 18:42:56 2020 -0800
+
+ Validate `context` before use in ValidateStreamConsumerGLTextureExternalAttribsNV.
+
+ Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1608235
+
+ Bug: angleproject:4333
+ Change-Id: I957b6412f7c744e4bbaa7d8084b3c81ee58d45ca
+
+commit 5eaf76b0bfd1f149d7b03393500c6e49a393c167
+Author: Jeff Gilbert <jgilbert@mozilla.com>
+Date: Thu Dec 26 20:58:48 2019 -0800
+
+ Lost no-error context should gracefully handle GetProgramiv.
+
+ Includes test that a lost no-error context doesn't crash on getProgramiv.
+ Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1601703
+
+ Bug: angleproject:4244
+ Change-Id: Iaf86cabd0e70d644d5b0e9ef2f51e9edeee5d020
+
+commit 85f04c65943e0a7070a1419fffa246e5ec39d1a1
+Author: Jeff Gilbert <jgilbert@mozilla.com>
+Date: Thu Dec 26 17:43:41 2019 -0800
+
+ clang-format
+
+ Change-Id: Iadf327c12bc43d7daedcd80fc08683c55c182ccc
+
+commit f75ca830a4276c1b757f866aba3ab2429a27f69c
+Author: Dzmitry Malyshau <dmalyshau@mozilla.com>
+Date: Thu Dec 5 13:02:14 2019 -0500
+
+ Restrict the slow texture upload workaround to 128bit formats. (#21)
+
+ The workaround is slow for having a CPU-visible mirror of the texture, but that mirror is not properly recycled with regards to GPU usage, thus causing a CPU stall on update.
+
+ Original reports were related to WebRender vertex texture updates that are RGBA32F and RGBA32U formats. Limiting the workaround to these formats would allow the affected platforms to upload regular texture data faster without stalls.
+
+commit 6bbe8f55d3e4b3b44394af323c5842296938ceab
+Author: Lee Salzman <lsalzman@mozilla.com>
+Date: Fri Aug 2 07:11:16 2019 +1000
+
+ Use image upload workaround for Intel Ivy Bridge with D3D11 renderer.
+
+ Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1578910
+
+ Bug: angleproject:3980
+ Change-Id: Ia14c5afd989365975bc57b303e59b4ef7669d522
+ Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1845664
+ Reviewed-by: Geoff Lang <geofflang@chromium.org>
+ Commit-Queue: Geoff Lang <geofflang@chromium.org>
+
+commit fe53e2b60af2314d7fe7040915c1499ef3bb7274
+Author: Miko Mynttinen <mikokm@gmail.com>
+Date: Fri Nov 1 17:23:03 2019 +0100
+
+ Remove static_assert for global mutex
+
+commit 7d5a10ac34cac9f629d0080302f1a754e902c66e
+Author: Miko Mynttinen <mikokm@gmail.com>
+Date: Thu Sep 5 18:04:32 2019 +0200
+
+ Do not override symbol visibility attribute on non-windows builds
+
+commit 0f5a52939b91442075a787523fcf394bdccd4d54
+Author: Miko Mynttinen <mikokm@gmail.com>
+Date: Tue Sep 3 18:54:54 2019 +0200
+
+ Disable debug layers
+
+commit fea78b079b9e778e240b06a0b8deadf57fe6d75a
+Author: Miko Mynttinen <mikokm@gmail.com>
+Date: Tue Sep 3 20:04:28 2019 +0200
+
+ Fix MinGW include
+
+commit 811d7beadb57fdd4c999d0702fb48085b770c078
+Author: Jeff Gilbert <jgilbert@mozilla.com>
+Date: Wed Mar 27 13:52:04 2019 -0700
+
+ Don't clamp in glBlendColor if context supports renderable [half-]float.
+
+ Add test for glBlendColor >1.0, skipped on D3D9 since it's unsupportable
+ there.
+
+ Bug: angleproject:3323
+ Change-Id: I3fcf867dae96bdadf8a0183269d8f27b659d0baf
+
+commit ea4db0f4e0c1b70dbe6e204e6afe77b23b8ea256
+Author: Glenn Watson <39062770+gw3583@users.noreply.github.com>
+Date: Fri Aug 2 07:11:16 2019 +1000
+
+ Fix occasional corruption of vertex textures in HD4600 GPUs. (#19)
+
+ This appears to be caused by the UpdateSubResource call,
+ which is worked around by enabling the other image upload
+ path that ANGLE supports.
+
+ The workaround doesn't include a driver version, since the
+ bug is occurring in the most recent driver that is currently
+ available (15.40.42.5063, released 19th Mar 2019).
+
+Cherries picked
+================================================================================
+Merge base from: origin/chromium/3865
+
+commit 08b97da894b278c10e70b6888ac65e3972a13b31
+Author: Shahbaz Youssefi <syoussefi@chromium.org>
+Date: Tue Jul 23 12:07:13 2019 -0400
+
+ Vulkan: Fix staging buffer alignment for pixel sizes > 4
+
+ Previously, all non-compressed formats were satisfied with a 4-byte
+ alignment. The introduction of float formats changes this.
+
+ This change calculates the necessary alignment using the same code path
+ as compressed formats.
+
+ Also fixes RGB9E5's pixelByte being calculated as 3 instead of 4.
+
+ Bug: angleproject:3731
+ Change-Id: I6abfd1c294e7f863eb99d2468eaac09e5d714039
+ Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1715205
+ Reviewed-by: Mohan Maiya <m.maiya@samsung.com>
+ Reviewed-by: Jamie Madill <jmadill@chromium.org>
+ Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/gfx/angle/moz.build b/gfx/angle/moz.build
new file mode 100644
index 0000000000..08c5b40380
--- /dev/null
+++ b/gfx/angle/moz.build
@@ -0,0 +1,16 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += ["targets/translator"]
+
+# Only build libEGL/libGLESv2 on Windows
+if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
+ DIRS += ["targets/libEGL", "targets/libGLESv2"]
+
+if CONFIG["MOZ_ANGLE_RENDERER"] and CONFIG["MOZ_D3DCOMPILER_VISTA_DLL_PATH"]:
+ FINAL_TARGET_FILES += [
+ "%" + CONFIG["MOZ_D3DCOMPILER_VISTA_DLL_PATH"],
+ ]
diff --git a/gfx/angle/moz.build.common b/gfx/angle/moz.build.common
new file mode 100644
index 0000000000..fa906ac78a
--- /dev/null
+++ b/gfx/angle/moz.build.common
@@ -0,0 +1,13 @@
+AllowCompilerWarnings()
+if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
+ CXXFLAGS += [
+ '-Wno-final-dtor-non-final-class',
+ '-Wno-implicit-const-int-float-conversion',
+ '-Wno-range-loop-construct',
+ ]
+
+if CONFIG['INTEL_ARCHITECTURE']:
+ CXXFLAGS += CONFIG['SSE2_FLAGS']
+DEFINES['__NDK_FPABI__'] = ''
+DEFINES['ANGLE_SKIP_DXGI_1_2_CHECK'] = True
+DEFINES['ANGLE_ENABLE_KEYEDMUTEX'] = True
diff --git a/gfx/angle/targets/angle_common/moz.build b/gfx/angle/targets/angle_common/moz.build
new file mode 100644
index 0000000000..17e6f40067
--- /dev/null
+++ b/gfx/angle/targets/angle_common/moz.build
@@ -0,0 +1,206 @@
+# Generated by update-angle.py
+
+include("../../moz.build.common")
+
+# DEFINES["ANGLE_IS_64_BIT_CPU"] = True
+# DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+# DEFINES["CHROMIUM_BUILD"] = True
+DEFINES["CR_CLANG_REVISION"] = '"357692-1"'
+DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+# DEFINES["FULL_SAFE_BROWSING"] = True
+# DEFINES["NDEBUG"] = True
+DEFINES["NOMINMAX"] = True
+# DEFINES["NO_TCMALLOC"] = True
+DEFINES["NTDDI_VERSION"] = "NTDDI_WIN10_RS2"
+# DEFINES["NVALGRIND"] = True
+# DEFINES["PSAPI_VERSION"] = "2"
+# DEFINES["SAFE_BROWSING_CSD"] = True
+# DEFINES["SAFE_BROWSING_DB_LOCAL"] = True
+DEFINES["UNICODE"] = True
+# DEFINES["USE_AURA"] = "1"
+# DEFINES["WIN32"] = True
+# DEFINES["WIN32_LEAN_AND_MEAN"] = True
+# DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+DEFINES["WINVER"] = "0x0A00"
+DEFINES["_ATL_NO_OPENGL"] = True
+DEFINES["_CRT_RAND_S"] = True
+DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+DEFINES["_HAS_EXCEPTIONS"] = "0"
+# DEFINES["_HAS_NODISCARD"] = True
+DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+DEFINES["_SECURE_ATL"] = True
+DEFINES["_UNICODE"] = True
+# DEFINES["_USING_V110_SDK71_"] = True
+# DEFINES["_WIN32_WINNT"] = "0x0A00"
+# DEFINES["_WINDOWS"] = True
+# DEFINES["__STD_C"] = True
+
+LOCAL_INCLUDES += [
+ "../../checkout/include/",
+ "../../checkout/out/gen/angle/",
+ "../../checkout/src/",
+ "../../checkout/src/common/third_party/base/",
+]
+
+# CXXFLAGS += [
+# "-D__DATE__=",
+# "-D__TIME__=",
+# "-D__TIMESTAMP__=",
+# "-fcolor-diagnostics",
+# "-fcomplete-member-pointers",
+# "-fcrash-diagnostics-dir=../tools/clang/crashreports",
+# "-fdebug-compilation-dir",
+# "-fmerge-all-constants",
+# "-fmsc-version=1911",
+# "-fno-standalone-debug",
+# "-gcodeview-ghash",
+# "-instcombine-lower-dbg-declare=0",
+# "-m64",
+# "-mllvm",
+# "-no-canonical-prefixes",
+# "-Wextra-semi",
+# "-Wheader-hygiene",
+# "-Wimplicit-fallthrough",
+# "-Wno-builtin-macro-redefined",
+# "-Wno-c++11-narrowing",
+# "-Wno-ignored-pragma-optimize",
+# "-Wno-missing-field-initializers",
+# "-Wno-nonportable-include-path",
+# "-Wno-undefined-var-template",
+# "-Wno-unneeded-internal-declaration",
+# "-Wno-unused-parameter",
+# "-Wnon-virtual-dtor",
+# "-Wstring-conversion",
+# "-Wtautological-overlap-compare",
+# "-Wthread-safety",
+# "-Wunneeded-internal-declaration",
+# "-Xclang",
+# ".",
+# "/bigobj",
+# "/Brepro",
+# "/FS",
+# "/GR-",
+# "/guard:cf,nochecks",
+# "/Gw",
+# "/Gy",
+# "/MT",
+# "/O1",
+# "/Ob2",
+# "/Oi",
+# "/Oy-",
+# "/TP",
+# "/utf-8",
+# "/W4",
+# "/wd4091",
+# "/wd4100",
+# "/wd4121",
+# "/wd4127",
+# "/wd4200",
+# "/wd4201",
+# "/wd4204",
+# "/wd4221",
+# "/wd4244",
+# "/wd4245",
+# "/wd4251",
+# "/wd4267",
+# "/wd4275",
+# "/wd4305",
+# "/wd4312",
+# "/wd4324",
+# "/wd4351",
+# "/wd4355",
+# "/wd4389",
+# "/wd4456",
+# "/wd4457",
+# "/wd4458",
+# "/wd4459",
+# "/wd4503",
+# "/wd4505",
+# "/wd4510",
+# "/wd4512",
+# "/wd4577",
+# "/wd4589",
+# "/wd4610",
+# "/wd4611",
+# "/wd4661",
+# "/wd4701",
+# "/wd4702",
+# "/wd4703",
+# "/wd4706",
+# "/wd4715",
+# "/wd4838",
+# "/wd4995",
+# "/wd4996",
+# "/we4244",
+# "/we4456",
+# "/we4458",
+# "/we4715",
+# "/we4800",
+# "/we4838",
+# "/WX",
+# "/X",
+# "/Z7",
+# "/Zc:inline",
+# "/Zc:sizedDealloc-",
+# ]
+
+SOURCES += [
+ "../../checkout/src/common/aligned_memory.cpp",
+ "../../checkout/src/common/android_util.cpp",
+ "../../checkout/src/common/angleutils.cpp",
+ "../../checkout/src/common/debug.cpp",
+ "../../checkout/src/common/event_tracer.cpp",
+ "../../checkout/src/common/Float16ToFloat32.cpp",
+ "../../checkout/src/common/mathutil.cpp",
+ "../../checkout/src/common/matrix_utils.cpp",
+ "../../checkout/src/common/MemoryBuffer.cpp",
+ "../../checkout/src/common/PackedEGLEnums_autogen.cpp",
+ "../../checkout/src/common/PackedEnums.cpp",
+ "../../checkout/src/common/PackedGLEnums_autogen.cpp",
+ "../../checkout/src/common/PoolAlloc.cpp",
+ "../../checkout/src/common/string_utils.cpp",
+ "../../checkout/src/common/system_utils.cpp",
+ "../../checkout/src/common/third_party/base/anglebase/sha1.cc",
+ "../../checkout/src/common/third_party/smhasher/src/PMurHash.cpp",
+ "../../checkout/src/common/third_party/xxhash/xxhash.c",
+ "../../checkout/src/common/tls.cpp",
+ "../../checkout/src/common/uniform_type_info_autogen.cpp",
+ "../../checkout/src/common/utilities.cpp",
+]
+
+if CONFIG["OS_ARCH"] != "WINNT":
+ SOURCES += [
+ "../../checkout/src/common/system_utils_posix.cpp",
+ ]
+
+if CONFIG["OS_ARCH"] == "Darwin":
+ SOURCES += [
+ "../../checkout/src/common/system_utils_mac.cpp",
+ ]
+
+if CONFIG["OS_ARCH"] == "WINNT":
+ SOURCES += [
+ "../../checkout/src/common/system_utils_win.cpp",
+ ]
+
+if CONFIG["OS_ARCH"] not in ("Darwin", "WINNT"):
+ SOURCES += [
+ "../../checkout/src/common/system_utils_linux.cpp",
+ ]
+
+# LDFLAGS += [
+# "--color-diagnostics",
+# "/DEBUG:GHASH",
+# "/FIXED:NO",
+# "/INCREMENTAL:NO",
+# "/OPT:ICF",
+# "/OPT:NOLLDTAILMERGE",
+# "/OPT:REF",
+# "/pdbaltpath:%_PDB%",
+# "/PDBSourcePath:C:/dev/angle/out",
+# "/PROFILE",
+# "/TIMESTAMP:1554613200",
+# "/WX",
+# ]
+
+Library("angle_common")
diff --git a/gfx/angle/targets/angle_gpu_info_util/moz.build b/gfx/angle/targets/angle_gpu_info_util/moz.build
new file mode 100644
index 0000000000..c7ad4e1113
--- /dev/null
+++ b/gfx/angle/targets/angle_gpu_info_util/moz.build
@@ -0,0 +1,186 @@
+# Generated by update-angle.py
+
+include("../../moz.build.common")
+
+DEFINES["ANGLE_ENABLE_D3D11"] = True
+DEFINES["ANGLE_ENABLE_D3D9"] = True
+# DEFINES["ANGLE_IS_64_BIT_CPU"] = True
+# DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+# DEFINES["CHROMIUM_BUILD"] = True
+DEFINES["CR_CLANG_REVISION"] = '"357692-1"'
+DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+# DEFINES["FULL_SAFE_BROWSING"] = True
+# DEFINES["NDEBUG"] = True
+DEFINES["NOMINMAX"] = True
+# DEFINES["NO_TCMALLOC"] = True
+DEFINES["NTDDI_VERSION"] = "NTDDI_WIN10_RS2"
+# DEFINES["NVALGRIND"] = True
+# DEFINES["PSAPI_VERSION"] = "2"
+# DEFINES["SAFE_BROWSING_CSD"] = True
+# DEFINES["SAFE_BROWSING_DB_LOCAL"] = True
+DEFINES["UNICODE"] = True
+# DEFINES["USE_AURA"] = "1"
+# DEFINES["WIN32"] = True
+# DEFINES["WIN32_LEAN_AND_MEAN"] = True
+# DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+DEFINES["WINVER"] = "0x0A00"
+DEFINES["_ATL_NO_OPENGL"] = True
+DEFINES["_CRT_RAND_S"] = True
+DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+DEFINES["_HAS_EXCEPTIONS"] = "0"
+# DEFINES["_HAS_NODISCARD"] = True
+DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+DEFINES["_SECURE_ATL"] = True
+DEFINES["_UNICODE"] = True
+# DEFINES["_USING_V110_SDK71_"] = True
+# DEFINES["_WIN32_WINNT"] = "0x0A00"
+# DEFINES["_WINDOWS"] = True
+# DEFINES["__STD_C"] = True
+
+LOCAL_INCLUDES += [
+ "../../checkout/include/",
+ "../../checkout/out/gen/angle/",
+ "../../checkout/src/",
+ "../../checkout/src/common/third_party/base/",
+]
+
+# CXXFLAGS += [
+# "-D__DATE__=",
+# "-D__TIME__=",
+# "-D__TIMESTAMP__=",
+# "-fcolor-diagnostics",
+# "-fcomplete-member-pointers",
+# "-fcrash-diagnostics-dir=../tools/clang/crashreports",
+# "-fdebug-compilation-dir",
+# "-fmerge-all-constants",
+# "-fmsc-version=1911",
+# "-fno-standalone-debug",
+# "-gcodeview-ghash",
+# "-instcombine-lower-dbg-declare=0",
+# "-m64",
+# "-mllvm",
+# "-no-canonical-prefixes",
+# "-Wextra-semi",
+# "-Wheader-hygiene",
+# "-Wimplicit-fallthrough",
+# "-Wno-builtin-macro-redefined",
+# "-Wno-c++11-narrowing",
+# "-Wno-ignored-pragma-optimize",
+# "-Wno-missing-field-initializers",
+# "-Wno-nonportable-include-path",
+# "-Wno-undefined-var-template",
+# "-Wno-unneeded-internal-declaration",
+# "-Wno-unused-parameter",
+# "-Wnon-virtual-dtor",
+# "-Wstring-conversion",
+# "-Wtautological-overlap-compare",
+# "-Wthread-safety",
+# "-Wunneeded-internal-declaration",
+# "-Xclang",
+# ".",
+# "/bigobj",
+# "/Brepro",
+# "/FS",
+# "/GR-",
+# "/guard:cf,nochecks",
+# "/Gw",
+# "/Gy",
+# "/MT",
+# "/O1",
+# "/Ob2",
+# "/Oi",
+# "/Oy-",
+# "/TP",
+# "/utf-8",
+# "/W4",
+# "/wd4091",
+# "/wd4100",
+# "/wd4121",
+# "/wd4127",
+# "/wd4200",
+# "/wd4201",
+# "/wd4204",
+# "/wd4221",
+# "/wd4244",
+# "/wd4245",
+# "/wd4251",
+# "/wd4267",
+# "/wd4275",
+# "/wd4305",
+# "/wd4312",
+# "/wd4324",
+# "/wd4351",
+# "/wd4355",
+# "/wd4389",
+# "/wd4456",
+# "/wd4457",
+# "/wd4458",
+# "/wd4459",
+# "/wd4503",
+# "/wd4505",
+# "/wd4510",
+# "/wd4512",
+# "/wd4577",
+# "/wd4589",
+# "/wd4610",
+# "/wd4611",
+# "/wd4661",
+# "/wd4701",
+# "/wd4702",
+# "/wd4703",
+# "/wd4706",
+# "/wd4715",
+# "/wd4838",
+# "/wd4995",
+# "/wd4996",
+# "/we4244",
+# "/we4456",
+# "/we4458",
+# "/we4715",
+# "/we4800",
+# "/we4838",
+# "/WX",
+# "/X",
+# "/Z7",
+# "/Zc:inline",
+# "/Zc:sizedDealloc-",
+# ]
+
+SOURCES += [
+ "../../checkout/src/gpu_info_util/SystemInfo.cpp",
+]
+
+if CONFIG["OS_ARCH"] == "WINNT":
+ SOURCES += [
+ "../../checkout/src/gpu_info_util/SystemInfo_win.cpp",
+ ]
+
+USE_LIBS += [
+ "angle_common",
+]
+
+DIRS += [
+ "../angle_common",
+]
+
+OS_LIBS += [
+ "dxgi",
+ "setupapi",
+]
+
+# LDFLAGS += [
+# "--color-diagnostics",
+# "/DEBUG:GHASH",
+# "/FIXED:NO",
+# "/INCREMENTAL:NO",
+# "/OPT:ICF",
+# "/OPT:NOLLDTAILMERGE",
+# "/OPT:REF",
+# "/pdbaltpath:%_PDB%",
+# "/PDBSourcePath:C:/dev/angle/out",
+# "/PROFILE",
+# "/TIMESTAMP:1554613200",
+# "/WX",
+# ]
+
+Library("angle_gpu_info_util")
diff --git a/gfx/angle/targets/angle_image_util/moz.build b/gfx/angle/targets/angle_image_util/moz.build
new file mode 100644
index 0000000000..7d9ffe9083
--- /dev/null
+++ b/gfx/angle/targets/angle_image_util/moz.build
@@ -0,0 +1,177 @@
+# Generated by update-angle.py
+
+include("../../moz.build.common")
+
+# DEFINES["ANGLE_IS_64_BIT_CPU"] = True
+# DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+# DEFINES["CHROMIUM_BUILD"] = True
+DEFINES["CR_CLANG_REVISION"] = '"357692-1"'
+DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+# DEFINES["FULL_SAFE_BROWSING"] = True
+# DEFINES["NDEBUG"] = True
+DEFINES["NOMINMAX"] = True
+# DEFINES["NO_TCMALLOC"] = True
+DEFINES["NTDDI_VERSION"] = "NTDDI_WIN10_RS2"
+# DEFINES["NVALGRIND"] = True
+# DEFINES["PSAPI_VERSION"] = "2"
+# DEFINES["SAFE_BROWSING_CSD"] = True
+# DEFINES["SAFE_BROWSING_DB_LOCAL"] = True
+DEFINES["UNICODE"] = True
+# DEFINES["USE_AURA"] = "1"
+# DEFINES["WIN32"] = True
+# DEFINES["WIN32_LEAN_AND_MEAN"] = True
+# DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+DEFINES["WINVER"] = "0x0A00"
+DEFINES["_ATL_NO_OPENGL"] = True
+DEFINES["_CRT_RAND_S"] = True
+DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+DEFINES["_HAS_EXCEPTIONS"] = "0"
+# DEFINES["_HAS_NODISCARD"] = True
+DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+DEFINES["_SECURE_ATL"] = True
+DEFINES["_UNICODE"] = True
+# DEFINES["_USING_V110_SDK71_"] = True
+# DEFINES["_WIN32_WINNT"] = "0x0A00"
+# DEFINES["_WINDOWS"] = True
+# DEFINES["__STD_C"] = True
+
+LOCAL_INCLUDES += [
+ "../../checkout/include/",
+ "../../checkout/out/gen/angle/",
+ "../../checkout/src/",
+ "../../checkout/src/common/third_party/base/",
+]
+
+# CXXFLAGS += [
+# "-D__DATE__=",
+# "-D__TIME__=",
+# "-D__TIMESTAMP__=",
+# "-fcolor-diagnostics",
+# "-fcomplete-member-pointers",
+# "-fcrash-diagnostics-dir=../tools/clang/crashreports",
+# "-fdebug-compilation-dir",
+# "-fmerge-all-constants",
+# "-fmsc-version=1911",
+# "-fno-standalone-debug",
+# "-gcodeview-ghash",
+# "-instcombine-lower-dbg-declare=0",
+# "-m64",
+# "-mllvm",
+# "-no-canonical-prefixes",
+# "-Wextra-semi",
+# "-Wheader-hygiene",
+# "-Wimplicit-fallthrough",
+# "-Wno-builtin-macro-redefined",
+# "-Wno-c++11-narrowing",
+# "-Wno-ignored-pragma-optimize",
+# "-Wno-missing-field-initializers",
+# "-Wno-nonportable-include-path",
+# "-Wno-undefined-var-template",
+# "-Wno-unneeded-internal-declaration",
+# "-Wno-unused-parameter",
+# "-Wnon-virtual-dtor",
+# "-Wstring-conversion",
+# "-Wtautological-overlap-compare",
+# "-Wthread-safety",
+# "-Wunneeded-internal-declaration",
+# "-Xclang",
+# ".",
+# "/bigobj",
+# "/Brepro",
+# "/FS",
+# "/GR-",
+# "/guard:cf,nochecks",
+# "/Gw",
+# "/Gy",
+# "/MT",
+# "/O1",
+# "/Ob2",
+# "/Oi",
+# "/Oy-",
+# "/TP",
+# "/utf-8",
+# "/W4",
+# "/wd4091",
+# "/wd4100",
+# "/wd4121",
+# "/wd4127",
+# "/wd4200",
+# "/wd4201",
+# "/wd4204",
+# "/wd4221",
+# "/wd4244",
+# "/wd4245",
+# "/wd4251",
+# "/wd4267",
+# "/wd4275",
+# "/wd4305",
+# "/wd4312",
+# "/wd4324",
+# "/wd4351",
+# "/wd4355",
+# "/wd4389",
+# "/wd4456",
+# "/wd4457",
+# "/wd4458",
+# "/wd4459",
+# "/wd4503",
+# "/wd4505",
+# "/wd4510",
+# "/wd4512",
+# "/wd4577",
+# "/wd4589",
+# "/wd4610",
+# "/wd4611",
+# "/wd4661",
+# "/wd4701",
+# "/wd4702",
+# "/wd4703",
+# "/wd4706",
+# "/wd4715",
+# "/wd4838",
+# "/wd4995",
+# "/wd4996",
+# "/we4244",
+# "/we4456",
+# "/we4458",
+# "/we4715",
+# "/we4800",
+# "/we4838",
+# "/WX",
+# "/X",
+# "/Z7",
+# "/Zc:inline",
+# "/Zc:sizedDealloc-",
+# ]
+
+SOURCES += [
+ "../../checkout/src/image_util/copyimage.cpp",
+ "../../checkout/src/image_util/imageformats.cpp",
+ "../../checkout/src/image_util/loadimage.cpp",
+ "../../checkout/src/image_util/loadimage_etc.cpp",
+]
+
+USE_LIBS += [
+ "angle_common",
+]
+
+DIRS += [
+ "../angle_common",
+]
+
+# LDFLAGS += [
+# "--color-diagnostics",
+# "/DEBUG:GHASH",
+# "/FIXED:NO",
+# "/INCREMENTAL:NO",
+# "/OPT:ICF",
+# "/OPT:NOLLDTAILMERGE",
+# "/OPT:REF",
+# "/pdbaltpath:%_PDB%",
+# "/PDBSourcePath:C:/dev/angle/out",
+# "/PROFILE",
+# "/TIMESTAMP:1554613200",
+# "/WX",
+# ]
+
+Library("angle_image_util")
diff --git a/gfx/angle/targets/libEGL/moz.build b/gfx/angle/targets/libEGL/moz.build
new file mode 100644
index 0000000000..cdfb7d4b65
--- /dev/null
+++ b/gfx/angle/targets/libEGL/moz.build
@@ -0,0 +1,222 @@
+# Generated by update-angle.py
+
+include("../../moz.build.common")
+
+# DEFINES["ANGLE_EGL_LIBRARY_NAME"] = '"libEGL"'
+DEFINES["ANGLE_GLESV2_LIBRARY_NAME"] = '"libGLESv2"'
+# DEFINES["ANGLE_IS_64_BIT_CPU"] = True
+DEFINES["ANGLE_USE_EGL_LOADER"] = True
+# DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+# DEFINES["CHROMIUM_BUILD"] = True
+DEFINES["CR_CLANG_REVISION"] = '"357692-1"'
+DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+DEFINES["EGLAPI"] = ""
+DEFINES["EGL_EGLEXT_PROTOTYPES"] = True
+DEFINES["EGL_EGL_PROTOTYPES"] = "1"
+# DEFINES["FULL_SAFE_BROWSING"] = True
+DEFINES["GL_GLES_PROTOTYPES"] = "1"
+DEFINES["GL_GLEXT_PROTOTYPES"] = True
+DEFINES["LIBEGL_IMPLEMENTATION"] = True
+# DEFINES["NDEBUG"] = True
+DEFINES["NOMINMAX"] = True
+# DEFINES["NO_TCMALLOC"] = True
+DEFINES["NTDDI_VERSION"] = "NTDDI_WIN10_RS2"
+# DEFINES["NVALGRIND"] = True
+# DEFINES["PSAPI_VERSION"] = "2"
+# DEFINES["SAFE_BROWSING_CSD"] = True
+# DEFINES["SAFE_BROWSING_DB_LOCAL"] = True
+DEFINES["UNICODE"] = True
+# DEFINES["USE_AURA"] = "1"
+# DEFINES["WIN32"] = True
+# DEFINES["WIN32_LEAN_AND_MEAN"] = True
+# DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+DEFINES["WINVER"] = "0x0A00"
+DEFINES["_ATL_NO_OPENGL"] = True
+DEFINES["_CRT_RAND_S"] = True
+DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+DEFINES["_HAS_EXCEPTIONS"] = "0"
+# DEFINES["_HAS_NODISCARD"] = True
+DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+DEFINES["_SECURE_ATL"] = True
+DEFINES["_UNICODE"] = True
+# DEFINES["_USING_V110_SDK71_"] = True
+# DEFINES["_WIN32_WINNT"] = "0x0A00"
+# DEFINES["_WINDOWS"] = True
+# DEFINES["__STD_C"] = True
+
+LOCAL_INCLUDES += [
+ "../../checkout/include/",
+ "../../checkout/out/gen/angle/",
+ "../../checkout/src/",
+]
+
+# CXXFLAGS += [
+# "-D__DATE__=",
+# "-D__TIME__=",
+# "-D__TIMESTAMP__=",
+# "-fcolor-diagnostics",
+# "-fcomplete-member-pointers",
+# "-fcrash-diagnostics-dir=../tools/clang/crashreports",
+# "-fdebug-compilation-dir",
+# "-fmerge-all-constants",
+# "-fmsc-version=1911",
+# "-fno-standalone-debug",
+# "-gcodeview-ghash",
+# "-instcombine-lower-dbg-declare=0",
+# "-m64",
+# "-mllvm",
+# "-no-canonical-prefixes",
+# "-Wextra-semi",
+# "-Wheader-hygiene",
+# "-Wimplicit-fallthrough",
+# "-Wno-builtin-macro-redefined",
+# "-Wno-c++11-narrowing",
+# "-Wno-ignored-pragma-optimize",
+# "-Wno-missing-field-initializers",
+# "-Wno-nonportable-include-path",
+# "-Wno-undefined-var-template",
+# "-Wno-unneeded-internal-declaration",
+# "-Wno-unused-parameter",
+# "-Wnon-virtual-dtor",
+# "-Wstring-conversion",
+# "-Wtautological-overlap-compare",
+# "-Wthread-safety",
+# "-Wunneeded-internal-declaration",
+# "-Xclang",
+# ".",
+# "/bigobj",
+# "/Brepro",
+# "/FS",
+# "/GR-",
+# "/guard:cf,nochecks",
+# "/Gw",
+# "/Gy",
+# "/MT",
+# "/O1",
+# "/Ob2",
+# "/Oi",
+# "/Oy-",
+# "/TP",
+# "/utf-8",
+# "/W4",
+# "/wd4091",
+# "/wd4100",
+# "/wd4121",
+# "/wd4127",
+# "/wd4200",
+# "/wd4201",
+# "/wd4204",
+# "/wd4221",
+# "/wd4244",
+# "/wd4245",
+# "/wd4251",
+# "/wd4267",
+# "/wd4275",
+# "/wd4305",
+# "/wd4312",
+# "/wd4324",
+# "/wd4351",
+# "/wd4355",
+# "/wd4389",
+# "/wd4456",
+# "/wd4457",
+# "/wd4458",
+# "/wd4459",
+# "/wd4503",
+# "/wd4505",
+# "/wd4510",
+# "/wd4512",
+# "/wd4577",
+# "/wd4589",
+# "/wd4610",
+# "/wd4611",
+# "/wd4661",
+# "/wd4701",
+# "/wd4702",
+# "/wd4703",
+# "/wd4706",
+# "/wd4715",
+# "/wd4838",
+# "/wd4995",
+# "/wd4996",
+# "/we4244",
+# "/we4456",
+# "/we4458",
+# "/we4715",
+# "/we4800",
+# "/we4838",
+# "/WX",
+# "/X",
+# "/Z7",
+# "/Zc:inline",
+# "/Zc:sizedDealloc-",
+# ]
+
+SOURCES += [
+ "../../checkout/src/common/system_utils.cpp",
+ "../../checkout/src/libEGL/egl_loader_autogen.cpp",
+ "../../checkout/src/libEGL/libEGL.cpp",
+]
+
+if CONFIG["OS_ARCH"] == "WINNT":
+ SOURCES += [
+ "../../checkout/src/common/system_utils_win.cpp",
+ ]
+
+USE_LIBS += [
+ "libGLESv2",
+]
+
+DIRS += [
+ "../libGLESv2",
+]
+
+OS_LIBS += [
+ "advapi32",
+ "comdlg32",
+ "dbghelp",
+ "delayimp",
+ "dnsapi",
+ "gdi32",
+ "kernel32",
+ "msimg32",
+ "odbc32",
+ "odbccp32",
+ "ole32",
+ "oleaut32",
+ "shell32",
+ "shlwapi",
+ "user32",
+ "usp10",
+ "uuid",
+ "version",
+ "wininet",
+ "winmm",
+ "winspool",
+ "ws2_32",
+]
+
+# LDFLAGS += [
+# "--color-diagnostics",
+# "/DEBUG:GHASH",
+# "/DYNAMICBASE",
+# "/FIXED:NO",
+# "/ignore:4199",
+# "/ignore:4221",
+# "/INCREMENTAL:NO",
+# "/MACHINE:X64",
+# "/NXCOMPAT",
+# "/OPT:ICF",
+# "/OPT:NOLLDTAILMERGE",
+# "/OPT:REF",
+# "/pdbaltpath:%_PDB%",
+# "/PDBSourcePath:C:/dev/angle/out",
+# "/PROFILE",
+# "/SUBSYSTEM:CONSOLE,5.02",
+# "/TIMESTAMP:1554613200",
+# "/WX",
+# ]
+
+DEFFILE = "../../checkout/src/libEGL/libEGL.def"
+RCFILE = "../../checkout/src/libEGL/libEGL.rc"
+GeckoSharedLibrary("libEGL", linkage=None)
diff --git a/gfx/angle/targets/libGLESv2/moz.build b/gfx/angle/targets/libGLESv2/moz.build
new file mode 100644
index 0000000000..96d1c6f56f
--- /dev/null
+++ b/gfx/angle/targets/libGLESv2/moz.build
@@ -0,0 +1,413 @@
+# Generated by update-angle.py
+
+include("../../moz.build.common")
+
+DEFINES["ANGLE_CAPTURE_ENABLED"] = "0"
+DEFINES["ANGLE_ENABLE_D3D11"] = True
+DEFINES["ANGLE_ENABLE_D3D9"] = True
+# DEFINES["ANGLE_IS_64_BIT_CPU"] = True
+# DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+# DEFINES["CHROMIUM_BUILD"] = True
+DEFINES["CR_CLANG_REVISION"] = '"357692-1"'
+DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+DEFINES["EGL_EGLEXT_PROTOTYPES"] = True
+DEFINES["EGL_EGL_PROTOTYPES"] = "1"
+# DEFINES["FULL_SAFE_BROWSING"] = True
+DEFINES["GL_API"] = ""
+DEFINES["GL_APICALL"] = ""
+DEFINES["GL_GLES_PROTOTYPES"] = "1"
+DEFINES["GL_GLEXT_PROTOTYPES"] = True
+DEFINES["LIBANGLE_IMPLEMENTATION"] = True
+DEFINES["LIBGLESV2_IMPLEMENTATION"] = True
+# DEFINES["NDEBUG"] = True
+DEFINES["NOMINMAX"] = True
+# DEFINES["NO_TCMALLOC"] = True
+DEFINES["NTDDI_VERSION"] = "NTDDI_WIN10_RS2"
+# DEFINES["NVALGRIND"] = True
+# DEFINES["PSAPI_VERSION"] = "2"
+# DEFINES["SAFE_BROWSING_CSD"] = True
+# DEFINES["SAFE_BROWSING_DB_LOCAL"] = True
+DEFINES["UNICODE"] = True
+# DEFINES["USE_AURA"] = "1"
+# DEFINES["WIN32"] = True
+# DEFINES["WIN32_LEAN_AND_MEAN"] = True
+# DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+DEFINES["WINVER"] = "0x0A00"
+DEFINES["_ATL_NO_OPENGL"] = True
+DEFINES["_CRT_RAND_S"] = True
+DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+DEFINES["_HAS_EXCEPTIONS"] = "0"
+# DEFINES["_HAS_NODISCARD"] = True
+DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+DEFINES["_SECURE_ATL"] = True
+DEFINES["_UNICODE"] = True
+# DEFINES["_USING_V110_SDK71_"] = True
+# DEFINES["_WIN32_WINNT"] = "0x0A00"
+# DEFINES["_WINDOWS"] = True
+# DEFINES["__STD_C"] = True
+
+LOCAL_INCLUDES += [
+ "../../checkout/include/",
+ "../../checkout/out/gen/angle/",
+ "../../checkout/src/",
+ "../../checkout/src/common/third_party/base/",
+]
+
+# CXXFLAGS += [
+# "-D__DATE__=",
+# "-D__TIME__=",
+# "-D__TIMESTAMP__=",
+# "-fcolor-diagnostics",
+# "-fcomplete-member-pointers",
+# "-fcrash-diagnostics-dir=../tools/clang/crashreports",
+# "-fdebug-compilation-dir",
+# "-fmerge-all-constants",
+# "-fmsc-version=1911",
+# "-fno-standalone-debug",
+# "-gcodeview-ghash",
+# "-instcombine-lower-dbg-declare=0",
+# "-m64",
+# "-mllvm",
+# "-no-canonical-prefixes",
+# "-Wextra-semi",
+# "-Wheader-hygiene",
+# "-Wimplicit-fallthrough",
+# "-Wno-builtin-macro-redefined",
+# "-Wno-c++11-narrowing",
+# "-Wno-ignored-pragma-optimize",
+# "-Wno-missing-field-initializers",
+# "-Wno-nonportable-include-path",
+# "-Wno-undefined-var-template",
+# "-Wno-unneeded-internal-declaration",
+# "-Wno-unused-parameter",
+# "-Wnon-virtual-dtor",
+# "-Wstring-conversion",
+# "-Wtautological-overlap-compare",
+# "-Wthread-safety",
+# "-Wunneeded-internal-declaration",
+# "-Xclang",
+# ".",
+# "/bigobj",
+# "/Brepro",
+# "/FS",
+# "/GR-",
+# "/guard:cf,nochecks",
+# "/Gw",
+# "/Gy",
+# "/MT",
+# "/O1",
+# "/Ob2",
+# "/Oi",
+# "/Oy-",
+# "/TP",
+# "/utf-8",
+# "/W4",
+# "/wd4091",
+# "/wd4100",
+# "/wd4121",
+# "/wd4127",
+# "/wd4200",
+# "/wd4201",
+# "/wd4204",
+# "/wd4221",
+# "/wd4244",
+# "/wd4245",
+# "/wd4251",
+# "/wd4267",
+# "/wd4275",
+# "/wd4305",
+# "/wd4312",
+# "/wd4324",
+# "/wd4351",
+# "/wd4355",
+# "/wd4389",
+# "/wd4456",
+# "/wd4457",
+# "/wd4458",
+# "/wd4459",
+# "/wd4503",
+# "/wd4505",
+# "/wd4510",
+# "/wd4512",
+# "/wd4530",
+# "/wd4577",
+# "/wd4589",
+# "/wd4610",
+# "/wd4611",
+# "/wd4661",
+# "/wd4701",
+# "/wd4702",
+# "/wd4703",
+# "/wd4706",
+# "/wd4715",
+# "/wd4838",
+# "/wd4995",
+# "/wd4996",
+# "/we4244",
+# "/we4456",
+# "/we4458",
+# "/we4715",
+# "/we4800",
+# "/we4838",
+# "/WX",
+# "/X",
+# "/Z7",
+# "/Zc:inline",
+# "/Zc:sizedDealloc-",
+# ]
+
+SOURCES += [
+ "../../checkout/src/libANGLE/angletypes.cpp",
+ "../../checkout/src/libANGLE/AttributeMap.cpp",
+ "../../checkout/src/libANGLE/BlobCache.cpp",
+ "../../checkout/src/libANGLE/Buffer.cpp",
+ "../../checkout/src/libANGLE/Caps.cpp",
+ "../../checkout/src/libANGLE/Compiler.cpp",
+ "../../checkout/src/libANGLE/Config.cpp",
+ "../../checkout/src/libANGLE/Context.cpp",
+ "../../checkout/src/libANGLE/Context_gl.cpp",
+ "../../checkout/src/libANGLE/Context_gles_1_0.cpp",
+ "../../checkout/src/libANGLE/Debug.cpp",
+ "../../checkout/src/libANGLE/Device.cpp",
+ "../../checkout/src/libANGLE/Display.cpp",
+ "../../checkout/src/libANGLE/EGLSync.cpp",
+ "../../checkout/src/libANGLE/Error.cpp",
+ "../../checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp",
+ "../../checkout/src/libANGLE/Fence.cpp",
+ "../../checkout/src/libANGLE/format_map_autogen.cpp",
+ "../../checkout/src/libANGLE/formatutils.cpp",
+ "../../checkout/src/libANGLE/Framebuffer.cpp",
+ "../../checkout/src/libANGLE/FramebufferAttachment.cpp",
+ "../../checkout/src/libANGLE/GLES1Renderer.cpp",
+ "../../checkout/src/libANGLE/GLES1State.cpp",
+ "../../checkout/src/libANGLE/HandleAllocator.cpp",
+ "../../checkout/src/libANGLE/HandleRangeAllocator.cpp",
+ "../../checkout/src/libANGLE/Image.cpp",
+ "../../checkout/src/libANGLE/ImageIndex.cpp",
+ "../../checkout/src/libANGLE/IndexRangeCache.cpp",
+ "../../checkout/src/libANGLE/LoggingAnnotator.cpp",
+ "../../checkout/src/libANGLE/MemoryObject.cpp",
+ "../../checkout/src/libANGLE/MemoryProgramCache.cpp",
+ "../../checkout/src/libANGLE/Observer.cpp",
+ "../../checkout/src/libANGLE/Path.cpp",
+ "../../checkout/src/libANGLE/Platform.cpp",
+ "../../checkout/src/libANGLE/Program.cpp",
+ "../../checkout/src/libANGLE/ProgramLinkedResources.cpp",
+ "../../checkout/src/libANGLE/ProgramPipeline.cpp",
+ "../../checkout/src/libANGLE/Query.cpp",
+ "../../checkout/src/libANGLE/queryconversions.cpp",
+ "../../checkout/src/libANGLE/queryutils.cpp",
+ "../../checkout/src/libANGLE/Renderbuffer.cpp",
+ "../../checkout/src/libANGLE/renderer/ContextImpl.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/CompilerD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table_autogen.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Program11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/ProgramPipeline11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Query11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/ResourceManager11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/StreamProducerD3DTexture.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/NativeWindow9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Query9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/DeviceD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/DisplayD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/DynamicImage2DHLSL.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/HLSLCompiler.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/IndexBuffer.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/NativeWindowD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/SurfaceD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/SwapChainD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp",
+ "../../checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp",
+ "../../checkout/src/libANGLE/renderer/DeviceImpl.cpp",
+ "../../checkout/src/libANGLE/renderer/DisplayImpl.cpp",
+ "../../checkout/src/libANGLE/renderer/driver_utils.cpp",
+ "../../checkout/src/libANGLE/renderer/Format_table_autogen.cpp",
+ "../../checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp",
+ "../../checkout/src/libANGLE/renderer/QueryImpl.cpp",
+ "../../checkout/src/libANGLE/renderer/renderer_utils.cpp",
+ "../../checkout/src/libANGLE/renderer/ShaderImpl.cpp",
+ "../../checkout/src/libANGLE/renderer/SurfaceImpl.cpp",
+ "../../checkout/src/libANGLE/renderer/TextureImpl.cpp",
+ "../../checkout/src/libANGLE/ResourceManager.cpp",
+ "../../checkout/src/libANGLE/Sampler.cpp",
+ "../../checkout/src/libANGLE/Semaphore.cpp",
+ "../../checkout/src/libANGLE/Shader.cpp",
+ "../../checkout/src/libANGLE/State.cpp",
+ "../../checkout/src/libANGLE/Stream.cpp",
+ "../../checkout/src/libANGLE/Surface.cpp",
+ "../../checkout/src/libANGLE/Texture.cpp",
+ "../../checkout/src/libANGLE/Thread.cpp",
+ "../../checkout/src/libANGLE/TransformFeedback.cpp",
+ "../../checkout/src/libANGLE/Uniform.cpp",
+ "../../checkout/src/libANGLE/validationEGL.cpp",
+ "../../checkout/src/libANGLE/validationES.cpp",
+ "../../checkout/src/libANGLE/validationES1.cpp",
+ "../../checkout/src/libANGLE/validationES2.cpp",
+ "../../checkout/src/libANGLE/validationES3.cpp",
+ "../../checkout/src/libANGLE/validationES31.cpp",
+ "../../checkout/src/libANGLE/validationGL1.cpp",
+ "../../checkout/src/libANGLE/validationGL11.cpp",
+ "../../checkout/src/libANGLE/validationGL12.cpp",
+ "../../checkout/src/libANGLE/validationGL13.cpp",
+ "../../checkout/src/libANGLE/validationGL14.cpp",
+ "../../checkout/src/libANGLE/validationGL15.cpp",
+ "../../checkout/src/libANGLE/validationGL2.cpp",
+ "../../checkout/src/libANGLE/validationGL21.cpp",
+ "../../checkout/src/libANGLE/validationGL3.cpp",
+ "../../checkout/src/libANGLE/validationGL31.cpp",
+ "../../checkout/src/libANGLE/validationGL32.cpp",
+ "../../checkout/src/libANGLE/validationGL33.cpp",
+ "../../checkout/src/libANGLE/validationGL4.cpp",
+ "../../checkout/src/libANGLE/validationGL41.cpp",
+ "../../checkout/src/libANGLE/validationGL42.cpp",
+ "../../checkout/src/libANGLE/validationGL43.cpp",
+ "../../checkout/src/libANGLE/validationGL44.cpp",
+ "../../checkout/src/libANGLE/validationGL45.cpp",
+ "../../checkout/src/libANGLE/validationGL46.cpp",
+ "../../checkout/src/libANGLE/VaryingPacking.cpp",
+ "../../checkout/src/libANGLE/VertexArray.cpp",
+ "../../checkout/src/libANGLE/VertexAttribute.cpp",
+ "../../checkout/src/libANGLE/WorkerThread.cpp",
+ "../../checkout/src/libGLESv2/entry_points_egl.cpp",
+ "../../checkout/src/libGLESv2/entry_points_egl_ext.cpp",
+ "../../checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp",
+ "../../checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp",
+ "../../checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp",
+ "../../checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp",
+ "../../checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp",
+ "../../checkout/src/libGLESv2/global_state.cpp",
+ "../../checkout/src/libGLESv2/libGLESv2_autogen.cpp",
+ "../../checkout/src/libGLESv2/proc_table_egl_autogen.cpp",
+ "../../checkout/src/third_party/systeminfo/SystemInfo.cpp",
+]
+
+USE_LIBS += [
+ "angle_common",
+ "angle_gpu_info_util",
+ "angle_image_util",
+ "translator",
+]
+
+DIRS += [
+ "../angle_common",
+ "../angle_gpu_info_util",
+ "../angle_image_util",
+ "../translator",
+]
+
+OS_LIBS += [
+ "advapi32",
+ "comdlg32",
+ "d3d9",
+ "dbghelp",
+ "delayimp",
+ "dnsapi",
+ "dxgi",
+ "dxguid",
+ "gdi32",
+ "kernel32",
+ "msimg32",
+ "odbc32",
+ "odbccp32",
+ "ole32",
+ "oleaut32",
+ "setupapi",
+ "shell32",
+ "shlwapi",
+ "user32",
+ "usp10",
+ "uuid",
+ "version",
+ "wininet",
+ "winmm",
+ "winspool",
+ "ws2_32",
+]
+
+# LDFLAGS += [
+# "--color-diagnostics",
+# "/DEBUG:GHASH",
+# "/DELAYLOAD:d3d9.dll",
+# "/DYNAMICBASE",
+# "/FIXED:NO",
+# "/ignore:4199",
+# "/ignore:4221",
+# "/INCREMENTAL:NO",
+# "/MACHINE:X64",
+# "/NXCOMPAT",
+# "/OPT:ICF",
+# "/OPT:NOLLDTAILMERGE",
+# "/OPT:REF",
+# "/pdbaltpath:%_PDB%",
+# "/PDBSourcePath:C:/dev/angle/out",
+# "/PROFILE",
+# "/SUBSYSTEM:CONSOLE,5.02",
+# "/TIMESTAMP:1554613200",
+# "/WX",
+# ]
+
+DEFFILE = "../../checkout/src/libGLESv2/libGLESv2_autogen.def"
+RCFILE = "../../checkout/src/libGLESv2/libGLESv2.rc"
+GeckoSharedLibrary("libGLESv2", linkage=None)
diff --git a/gfx/angle/targets/preprocessor/moz.build b/gfx/angle/targets/preprocessor/moz.build
new file mode 100644
index 0000000000..faf1390258
--- /dev/null
+++ b/gfx/angle/targets/preprocessor/moz.build
@@ -0,0 +1,184 @@
+# Generated by update-angle.py
+
+include("../../moz.build.common")
+
+# DEFINES["ANGLE_IS_64_BIT_CPU"] = True
+# DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+# DEFINES["CHROMIUM_BUILD"] = True
+DEFINES["CR_CLANG_REVISION"] = '"357692-1"'
+DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+# DEFINES["FULL_SAFE_BROWSING"] = True
+# DEFINES["NDEBUG"] = True
+DEFINES["NOMINMAX"] = True
+# DEFINES["NO_TCMALLOC"] = True
+DEFINES["NTDDI_VERSION"] = "NTDDI_WIN10_RS2"
+# DEFINES["NVALGRIND"] = True
+# DEFINES["PSAPI_VERSION"] = "2"
+# DEFINES["SAFE_BROWSING_CSD"] = True
+# DEFINES["SAFE_BROWSING_DB_LOCAL"] = True
+DEFINES["UNICODE"] = True
+# DEFINES["USE_AURA"] = "1"
+# DEFINES["WIN32"] = True
+# DEFINES["WIN32_LEAN_AND_MEAN"] = True
+# DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+DEFINES["WINVER"] = "0x0A00"
+DEFINES["_ATL_NO_OPENGL"] = True
+DEFINES["_CRT_RAND_S"] = True
+DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+DEFINES["_HAS_EXCEPTIONS"] = "0"
+# DEFINES["_HAS_NODISCARD"] = True
+DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+DEFINES["_SECURE_ATL"] = True
+DEFINES["_UNICODE"] = True
+# DEFINES["_USING_V110_SDK71_"] = True
+# DEFINES["_WIN32_WINNT"] = "0x0A00"
+# DEFINES["_WINDOWS"] = True
+# DEFINES["__STD_C"] = True
+
+LOCAL_INCLUDES += [
+ "../../checkout/include/",
+ "../../checkout/out/gen/angle/",
+ "../../checkout/src/",
+ "../../checkout/src/common/third_party/base/",
+]
+
+# CXXFLAGS += [
+# "-D__DATE__=",
+# "-D__TIME__=",
+# "-D__TIMESTAMP__=",
+# "-fcolor-diagnostics",
+# "-fcomplete-member-pointers",
+# "-fcrash-diagnostics-dir=../tools/clang/crashreports",
+# "-fdebug-compilation-dir",
+# "-fmerge-all-constants",
+# "-fmsc-version=1911",
+# "-fno-standalone-debug",
+# "-gcodeview-ghash",
+# "-instcombine-lower-dbg-declare=0",
+# "-m64",
+# "-mllvm",
+# "-no-canonical-prefixes",
+# "-Wextra-semi",
+# "-Wheader-hygiene",
+# "-Wimplicit-fallthrough",
+# "-Wno-builtin-macro-redefined",
+# "-Wno-c++11-narrowing",
+# "-Wno-ignored-pragma-optimize",
+# "-Wno-missing-field-initializers",
+# "-Wno-nonportable-include-path",
+# "-Wno-undefined-var-template",
+# "-Wno-unneeded-internal-declaration",
+# "-Wno-unused-parameter",
+# "-Wnon-virtual-dtor",
+# "-Wstring-conversion",
+# "-Wtautological-overlap-compare",
+# "-Wthread-safety",
+# "-Wunneeded-internal-declaration",
+# "-Xclang",
+# ".",
+# "/bigobj",
+# "/Brepro",
+# "/FS",
+# "/GR-",
+# "/guard:cf,nochecks",
+# "/Gw",
+# "/Gy",
+# "/MT",
+# "/O1",
+# "/Ob2",
+# "/Oi",
+# "/Oy-",
+# "/TP",
+# "/utf-8",
+# "/W4",
+# "/wd4091",
+# "/wd4100",
+# "/wd4121",
+# "/wd4127",
+# "/wd4200",
+# "/wd4201",
+# "/wd4204",
+# "/wd4221",
+# "/wd4244",
+# "/wd4245",
+# "/wd4251",
+# "/wd4267",
+# "/wd4275",
+# "/wd4305",
+# "/wd4312",
+# "/wd4324",
+# "/wd4351",
+# "/wd4355",
+# "/wd4389",
+# "/wd4456",
+# "/wd4457",
+# "/wd4458",
+# "/wd4459",
+# "/wd4503",
+# "/wd4505",
+# "/wd4510",
+# "/wd4512",
+# "/wd4577",
+# "/wd4589",
+# "/wd4610",
+# "/wd4611",
+# "/wd4661",
+# "/wd4701",
+# "/wd4702",
+# "/wd4703",
+# "/wd4706",
+# "/wd4715",
+# "/wd4838",
+# "/wd4995",
+# "/wd4996",
+# "/we4244",
+# "/we4456",
+# "/we4458",
+# "/we4715",
+# "/we4800",
+# "/we4838",
+# "/WX",
+# "/X",
+# "/Z7",
+# "/Zc:inline",
+# "/Zc:sizedDealloc-",
+# ]
+
+SOURCES += [
+ "../../checkout/src/compiler/preprocessor/DiagnosticsBase.cpp",
+ "../../checkout/src/compiler/preprocessor/DirectiveHandlerBase.cpp",
+ "../../checkout/src/compiler/preprocessor/DirectiveParser.cpp",
+ "../../checkout/src/compiler/preprocessor/ExpressionParser.cpp",
+ "../../checkout/src/compiler/preprocessor/Input.cpp",
+ "../../checkout/src/compiler/preprocessor/Lexer.cpp",
+ "../../checkout/src/compiler/preprocessor/Macro.cpp",
+ "../../checkout/src/compiler/preprocessor/MacroExpander.cpp",
+ "../../checkout/src/compiler/preprocessor/Preprocessor.cpp",
+ "../../checkout/src/compiler/preprocessor/Token.cpp",
+ "../../checkout/src/compiler/preprocessor/Tokenizer.cpp",
+]
+
+USE_LIBS += [
+ "angle_common",
+]
+
+DIRS += [
+ "../angle_common",
+]
+
+# LDFLAGS += [
+# "--color-diagnostics",
+# "/DEBUG:GHASH",
+# "/FIXED:NO",
+# "/INCREMENTAL:NO",
+# "/OPT:ICF",
+# "/OPT:NOLLDTAILMERGE",
+# "/OPT:REF",
+# "/pdbaltpath:%_PDB%",
+# "/PDBSourcePath:C:/dev/angle/out",
+# "/PROFILE",
+# "/TIMESTAMP:1554613200",
+# "/WX",
+# ]
+
+Library("preprocessor")
diff --git a/gfx/angle/targets/translator/moz.build b/gfx/angle/targets/translator/moz.build
new file mode 100644
index 0000000000..bece34fa5d
--- /dev/null
+++ b/gfx/angle/targets/translator/moz.build
@@ -0,0 +1,303 @@
+# Generated by update-angle.py
+
+include("../../moz.build.common")
+
+DEFINES["ANGLE_ENABLE_ESSL"] = True
+DEFINES["ANGLE_ENABLE_GLSL"] = True
+DEFINES["ANGLE_ENABLE_HLSL"] = True
+# DEFINES["ANGLE_IS_64_BIT_CPU"] = True
+# DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True
+# DEFINES["CHROMIUM_BUILD"] = True
+DEFINES["CR_CLANG_REVISION"] = '"357692-1"'
+DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+# DEFINES["FULL_SAFE_BROWSING"] = True
+# DEFINES["NDEBUG"] = True
+DEFINES["NOMINMAX"] = True
+# DEFINES["NO_TCMALLOC"] = True
+DEFINES["NTDDI_VERSION"] = "NTDDI_WIN10_RS2"
+# DEFINES["NVALGRIND"] = True
+# DEFINES["PSAPI_VERSION"] = "2"
+# DEFINES["SAFE_BROWSING_CSD"] = True
+# DEFINES["SAFE_BROWSING_DB_LOCAL"] = True
+DEFINES["UNICODE"] = True
+# DEFINES["USE_AURA"] = "1"
+# DEFINES["WIN32"] = True
+# DEFINES["WIN32_LEAN_AND_MEAN"] = True
+# DEFINES["WINAPI_FAMILY"] = "WINAPI_FAMILY_DESKTOP_APP"
+DEFINES["WINVER"] = "0x0A00"
+DEFINES["_ATL_NO_OPENGL"] = True
+DEFINES["_CRT_RAND_S"] = True
+DEFINES["_CRT_SECURE_NO_DEPRECATE"] = True
+DEFINES["_HAS_EXCEPTIONS"] = "0"
+# DEFINES["_HAS_NODISCARD"] = True
+DEFINES["_SCL_SECURE_NO_DEPRECATE"] = True
+DEFINES["_SECURE_ATL"] = True
+DEFINES["_UNICODE"] = True
+# DEFINES["_USING_V110_SDK71_"] = True
+# DEFINES["_WIN32_WINNT"] = "0x0A00"
+# DEFINES["_WINDOWS"] = True
+# DEFINES["__STD_C"] = True
+
+LOCAL_INCLUDES += [
+ "../../checkout/include/",
+ "../../checkout/out/gen/angle/",
+ "../../checkout/src/",
+ "../../checkout/src/common/third_party/base/",
+]
+
+# CXXFLAGS += [
+# "-D__DATE__=",
+# "-D__TIME__=",
+# "-D__TIMESTAMP__=",
+# "-fcolor-diagnostics",
+# "-fcomplete-member-pointers",
+# "-fcrash-diagnostics-dir=../tools/clang/crashreports",
+# "-fdebug-compilation-dir",
+# "-fmerge-all-constants",
+# "-fmsc-version=1911",
+# "-fno-standalone-debug",
+# "-gcodeview-ghash",
+# "-instcombine-lower-dbg-declare=0",
+# "-m64",
+# "-mllvm",
+# "-no-canonical-prefixes",
+# "-Wextra-semi",
+# "-Wheader-hygiene",
+# "-Wimplicit-fallthrough",
+# "-Wno-builtin-macro-redefined",
+# "-Wno-c++11-narrowing",
+# "-Wno-ignored-pragma-optimize",
+# "-Wno-missing-field-initializers",
+# "-Wno-nonportable-include-path",
+# "-Wno-undefined-var-template",
+# "-Wno-unneeded-internal-declaration",
+# "-Wno-unused-parameter",
+# "-Wnon-virtual-dtor",
+# "-Wstring-conversion",
+# "-Wtautological-overlap-compare",
+# "-Wthread-safety",
+# "-Wunneeded-internal-declaration",
+# "-Xclang",
+# ".",
+# "/bigobj",
+# "/Brepro",
+# "/FS",
+# "/GR-",
+# "/guard:cf,nochecks",
+# "/Gw",
+# "/Gy",
+# "/MT",
+# "/O1",
+# "/Ob2",
+# "/Oi",
+# "/Oy-",
+# "/TP",
+# "/utf-8",
+# "/W4",
+# "/wd4091",
+# "/wd4100",
+# "/wd4121",
+# "/wd4127",
+# "/wd4200",
+# "/wd4201",
+# "/wd4204",
+# "/wd4221",
+# "/wd4244",
+# "/wd4245",
+# "/wd4251",
+# "/wd4267",
+# "/wd4275",
+# "/wd4305",
+# "/wd4312",
+# "/wd4324",
+# "/wd4351",
+# "/wd4355",
+# "/wd4389",
+# "/wd4456",
+# "/wd4457",
+# "/wd4458",
+# "/wd4459",
+# "/wd4503",
+# "/wd4505",
+# "/wd4510",
+# "/wd4512",
+# "/wd4577",
+# "/wd4589",
+# "/wd4610",
+# "/wd4611",
+# "/wd4661",
+# "/wd4701",
+# "/wd4702",
+# "/wd4703",
+# "/wd4706",
+# "/wd4715",
+# "/wd4718",
+# "/wd4838",
+# "/wd4995",
+# "/wd4996",
+# "/we4244",
+# "/we4456",
+# "/we4458",
+# "/we4715",
+# "/we4800",
+# "/we4838",
+# "/WX",
+# "/X",
+# "/Z7",
+# "/Zc:inline",
+# "/Zc:sizedDealloc-",
+# ]
+
+SOURCES += [
+ "../../checkout/src/compiler/translator/ASTMetadataHLSL.cpp",
+ "../../checkout/src/compiler/translator/AtomicCounterFunctionHLSL.cpp",
+ "../../checkout/src/compiler/translator/blocklayout.cpp",
+ "../../checkout/src/compiler/translator/blocklayoutHLSL.cpp",
+ "../../checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp",
+ "../../checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp",
+ "../../checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp",
+ "../../checkout/src/compiler/translator/CallDAG.cpp",
+ "../../checkout/src/compiler/translator/CodeGen.cpp",
+ "../../checkout/src/compiler/translator/CollectVariables.cpp",
+ "../../checkout/src/compiler/translator/Compiler.cpp",
+ "../../checkout/src/compiler/translator/ConstantUnion.cpp",
+ "../../checkout/src/compiler/translator/Declarator.cpp",
+ "../../checkout/src/compiler/translator/Diagnostics.cpp",
+ "../../checkout/src/compiler/translator/DirectiveHandler.cpp",
+ "../../checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp",
+ "../../checkout/src/compiler/translator/ExtensionBehavior.cpp",
+ "../../checkout/src/compiler/translator/ExtensionGLSL.cpp",
+ "../../checkout/src/compiler/translator/FlagStd140Structs.cpp",
+ "../../checkout/src/compiler/translator/FunctionLookup.cpp",
+ "../../checkout/src/compiler/translator/glslang_lex.cpp",
+ "../../checkout/src/compiler/translator/glslang_tab.cpp",
+ "../../checkout/src/compiler/translator/HashNames.cpp",
+ "../../checkout/src/compiler/translator/ImageFunctionHLSL.cpp",
+ "../../checkout/src/compiler/translator/ImmutableString.cpp",
+ "../../checkout/src/compiler/translator/ImmutableStringBuilder.cpp",
+ "../../checkout/src/compiler/translator/InfoSink.cpp",
+ "../../checkout/src/compiler/translator/Initialize.cpp",
+ "../../checkout/src/compiler/translator/InitializeDll.cpp",
+ "../../checkout/src/compiler/translator/IntermNode.cpp",
+ "../../checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp",
+ "../../checkout/src/compiler/translator/Operator.cpp",
+ "../../checkout/src/compiler/translator/OutputESSL.cpp",
+ "../../checkout/src/compiler/translator/OutputGLSL.cpp",
+ "../../checkout/src/compiler/translator/OutputGLSLBase.cpp",
+ "../../checkout/src/compiler/translator/OutputHLSL.cpp",
+ "../../checkout/src/compiler/translator/OutputTree.cpp",
+ "../../checkout/src/compiler/translator/ParseContext.cpp",
+ "../../checkout/src/compiler/translator/PoolAlloc.cpp",
+ "../../checkout/src/compiler/translator/QualifierTypes.cpp",
+ "../../checkout/src/compiler/translator/ResourcesHLSL.cpp",
+ "../../checkout/src/compiler/translator/ShaderLang.cpp",
+ "../../checkout/src/compiler/translator/ShaderStorageBlockFunctionHLSL.cpp",
+ "../../checkout/src/compiler/translator/ShaderStorageBlockOutputHLSL.cpp",
+ "../../checkout/src/compiler/translator/ShaderVars.cpp",
+ "../../checkout/src/compiler/translator/StructureHLSL.cpp",
+ "../../checkout/src/compiler/translator/Symbol.cpp",
+ "../../checkout/src/compiler/translator/SymbolTable.cpp",
+ "../../checkout/src/compiler/translator/SymbolTable_autogen.cpp",
+ "../../checkout/src/compiler/translator/SymbolUniqueId.cpp",
+ "../../checkout/src/compiler/translator/TextureFunctionHLSL.cpp",
+ "../../checkout/src/compiler/translator/TranslatorESSL.cpp",
+ "../../checkout/src/compiler/translator/TranslatorGLSL.cpp",
+ "../../checkout/src/compiler/translator/TranslatorHLSL.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/EmulateMultiDrawShaderBuiltins.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/NameEmbeddedUniformStructs.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RemovePow.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteAtomicCounters.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteDfdy.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteExpressionsWithShaderStorageBlock.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteRepeatedAssignToSwizzled.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteStructSamplers.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp",
+ "../../checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp",
+ "../../checkout/src/compiler/translator/tree_util/FindFunction.cpp",
+ "../../checkout/src/compiler/translator/tree_util/FindMain.cpp",
+ "../../checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp",
+ "../../checkout/src/compiler/translator/tree_util/IntermNode_util.cpp",
+ "../../checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp",
+ "../../checkout/src/compiler/translator/tree_util/IntermTraverse.cpp",
+ "../../checkout/src/compiler/translator/tree_util/ReplaceShadowingVariables.cpp",
+ "../../checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp",
+ "../../checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp",
+ "../../checkout/src/compiler/translator/Types.cpp",
+ "../../checkout/src/compiler/translator/util.cpp",
+ "../../checkout/src/compiler/translator/UtilsHLSL.cpp",
+ "../../checkout/src/compiler/translator/ValidateAST.cpp",
+ "../../checkout/src/compiler/translator/ValidateGlobalInitializer.cpp",
+ "../../checkout/src/compiler/translator/ValidateLimitations.cpp",
+ "../../checkout/src/compiler/translator/ValidateMaxParameters.cpp",
+ "../../checkout/src/compiler/translator/ValidateOutputs.cpp",
+ "../../checkout/src/compiler/translator/ValidateSwitch.cpp",
+ "../../checkout/src/compiler/translator/ValidateVaryingLocations.cpp",
+ "../../checkout/src/compiler/translator/VariablePacker.cpp",
+ "../../checkout/src/compiler/translator/VersionGLSL.cpp",
+ "../../checkout/src/third_party/compiler/ArrayBoundsClamper.cpp",
+]
+
+USE_LIBS += [
+ "angle_common",
+ "preprocessor",
+]
+
+DIRS += [
+ "../angle_common",
+ "../preprocessor",
+]
+
+# LDFLAGS += [
+# "--color-diagnostics",
+# "/DEBUG:GHASH",
+# "/FIXED:NO",
+# "/INCREMENTAL:NO",
+# "/OPT:ICF",
+# "/OPT:NOLLDTAILMERGE",
+# "/OPT:REF",
+# "/pdbaltpath:%_PDB%",
+# "/PDBSourcePath:C:/dev/angle/out",
+# "/PROFILE",
+# "/TIMESTAMP:1554613200",
+# "/WX",
+# ]
+
+Library("translator")
diff --git a/gfx/angle/update-angle.py b/gfx/angle/update-angle.py
new file mode 100755
index 0000000000..85639ba6b9
--- /dev/null
+++ b/gfx/angle/update-angle.py
@@ -0,0 +1,648 @@
+#! /usr/bin/env python3
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+assert __name__ == "__main__"
+
+"""
+To update ANGLE in Gecko, use Windows with git-bash, and setup depot_tools, python2, and
+python3. Because depot_tools expects `python` to be `python2` (shame!), python2 must come
+before python3 in your path.
+
+Upstream: https://chromium.googlesource.com/angle/angle
+
+Our repo: https://github.com/mozilla/angle
+It has branches like 'firefox-60' which is the branch we use for pulling into
+Gecko with this script.
+
+This script leaves a record of the merge-base and cherry-picks that we pull into
+Gecko. (gfx/angle/cherries.log)
+
+ANGLE<->Chrome version mappings are here: https://omahaproxy.appspot.com/
+An easy choice is to grab Chrome's Beta's ANGLE branch.
+
+## Usage
+
+Prepare your env:
+
+~~~
+export PATH="$PATH:/path/to/depot_tools"
+~~~
+
+If this is a new repo, don't forget:
+
+~~~
+# In the angle repo:
+./scripts/bootstrap.py
+gclient sync
+~~~
+
+Update: (in the angle repo)
+
+~~~
+# In the angle repo:
+/path/to/gecko/gfx/angle/update-angle.py origin/chromium/XXXX
+git push moz # Push the firefox-XX branch to github.com/mozilla/angle
+~~~~
+
+"""
+
+import json
+import os
+import pathlib
+import re
+import shutil
+import subprocess
+import sys
+from typing import * # mypy annotations
+
+REPO_DIR = pathlib.Path.cwd()
+GECKO_ANGLE_DIR = pathlib.Path(__file__).parent
+
+OUT_DIR = pathlib.Path("out")
+
+COMMON_HEADER = [
+ "# Generated by update-angle.py",
+ "",
+ 'include("../../moz.build.common")',
+]
+
+ROOTS = ["//:translator", "//:libEGL", "//:libGLESv2"]
+
+CHECK_ONLY = False
+args = sys.argv[1:]
+while True:
+ arg = args.pop(0)
+ if arg == "--check":
+ CHECK_ONLY = True
+ continue
+ args.insert(0, arg)
+ break
+
+GN_ENV = dict(os.environ)
+GN_ENV["DEPOT_TOOLS_WIN_TOOLCHAIN"] = "0"
+
+(GIT_REMOTE,) = args # Not always 'origin'!
+
+# ------------------------------------------------------------------------------
+
+
+def run_checked(*args, **kwargs):
+ print(" ", args)
+ sys.stdout.flush()
+ return subprocess.run(args, check=True, **kwargs)
+
+
+def sorted_items(x):
+ for k in sorted(x.keys()):
+ yield (k, x[k])
+
+
+def collapse_dotdots(path):
+ split = path.split("/")
+
+ ret = []
+ for x in split:
+ if x == ".." and ret:
+ ret.pop()
+ continue
+ ret.append(x)
+ continue
+
+ return "/".join(ret)
+
+
+def dag_traverse(root_keys: Sequence[str], pre_recurse_func: Callable[[str], list]):
+ visited_keys: Set[str] = set()
+
+ def recurse(key):
+ if key in visited_keys:
+ return
+ visited_keys.add(key)
+
+ t = pre_recurse_func(key)
+ try:
+ (next_keys, post_recurse_func) = t
+ except ValueError:
+ (next_keys,) = t
+ post_recurse_func = None
+
+ for x in next_keys:
+ recurse(x)
+
+ if post_recurse_func:
+ post_recurse_func(key)
+ return
+
+ for x in root_keys:
+ recurse(x)
+ return
+
+
+# ------------------------------------------------------------------------------
+
+print("Importing graph")
+
+# shutil.rmtree(str(OUT_DIR), True)
+OUT_DIR.mkdir(exist_ok=True)
+
+GN_ARGS = b"""
+# Build arguments go here.
+# See "gn args <out_dir> --list" for available build arguments.
+is_clang = true
+is_debug = false
+angle_enable_gl = false
+angle_enable_gl_null = false
+angle_enable_null = false
+angle_enable_vulkan = false
+"""[
+ 1:
+]
+args_gn_path = OUT_DIR / "args.gn"
+args_gn_path.write_bytes(GN_ARGS)
+
+try:
+ run_checked("gn", "gen", str(OUT_DIR), shell=True, env=GN_ENV)
+except subprocess.CalledProcessError:
+ sys.stderr.buffer.write(b"`gn` failed. Is depot_tools in your PATH?\n")
+ exit(1)
+
+p = run_checked(
+ "gn",
+ "desc",
+ "--format=json",
+ str(OUT_DIR),
+ "*",
+ stdout=subprocess.PIPE,
+ shell=True,
+ env=GN_ENV,
+)
+
+# -
+
+print("\nProcessing graph")
+descs = json.loads(p.stdout.decode())
+
+# -
+# HACKHACKHACK: Inject linux/mac sources instead of trying to merge graphs of different
+# platforms.
+descs["//:angle_common"]["sources"] += [
+ "//src/common/system_utils_linux.cpp",
+ "//src/common/system_utils_mac.cpp",
+ "//src/common/system_utils_posix.cpp",
+]
+
+# Ready to traverse
+# ------------------------------------------------------------------------------
+
+LIBRARY_TYPES = ("shared_library", "static_library")
+
+
+def flattened_target(target_name: str, descs: dict, stop_at_lib: bool = True) -> dict:
+ flattened = dict(descs[target_name])
+
+ EXPECTED_TYPES = LIBRARY_TYPES + ("source_set", "group", "action")
+
+ def pre(k):
+ dep = descs[k]
+
+ dep_type = dep["type"]
+ deps = dep["deps"]
+ if stop_at_lib and dep_type in LIBRARY_TYPES:
+ return ((),)
+
+ if dep_type == "copy":
+ assert not deps, (target_name, dep["deps"])
+ else:
+ assert dep_type in EXPECTED_TYPES, (k, dep_type)
+ for (k, v) in dep.items():
+ if type(v) in (list, tuple):
+ flattened[k] = flattened.get(k, []) + v
+ else:
+ # flattened.setdefault(k, v)
+ pass
+ return (deps,)
+
+ dag_traverse(descs[target_name]["deps"], pre)
+ return flattened
+
+
+# ------------------------------------------------------------------------------
+# Check that includes are valid. (gn's version of this check doesn't seem to work!)
+
+INCLUDE_REGEX = re.compile(b'(?:^|\\n) *# *include +([<"])([^>"]+)[>"]')
+assert INCLUDE_REGEX.match(b'#include "foo"')
+assert INCLUDE_REGEX.match(b'\n#include "foo"')
+
+IGNORED_INCLUDES = {
+ b"compiler/translator/TranslatorVulkan.h",
+ b"libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h",
+ b"libANGLE/renderer/gl/glx/DisplayGLX.h",
+ b"libANGLE/renderer/gl/cgl/DisplayCGL.h",
+ b"libANGLE/renderer/gl/egl/ozone/DisplayOzone.h",
+ b"libANGLE/renderer/gl/egl/android/DisplayAndroid.h",
+ b"libANGLE/renderer/gl/wgl/DisplayWGL.h",
+ b"libANGLE/renderer/null/DisplayNULL.h",
+ b"libANGLE/renderer/vulkan/android/DisplayVkAndroid.h",
+ b"libANGLE/renderer/vulkan/fuchsia/DisplayVkFuchsia.h",
+ b"libANGLE/renderer/vulkan/win32/DisplayVkWin32.h",
+ b"libANGLE/renderer/vulkan/xcb/DisplayVkXcb.h",
+ b"kernel/image.h",
+}
+
+IGNORED_INCLUDE_PREFIXES = {
+ b"android",
+ b"Carbon",
+ b"CoreFoundation",
+ b"CoreServices",
+ b"IOSurface",
+ b"mach",
+ b"mach-o",
+ b"OpenGL",
+ b"pci",
+ b"sys",
+ b"wrl",
+ b"X11",
+}
+
+
+def has_all_includes(target_name: str, descs: dict) -> bool:
+ flat = flattened_target(target_name, descs, stop_at_lib=False)
+ acceptable_sources = flat.get("sources", []) + flat.get("outputs", [])
+ acceptable_sources = (x.rsplit("/", 1)[-1].encode() for x in acceptable_sources)
+ acceptable_sources = set(acceptable_sources)
+
+ ret = True
+ desc = descs[target_name]
+ for cur_file in desc.get("sources", []):
+ assert cur_file.startswith("/"), cur_file
+ if not cur_file.startswith("//"):
+ continue
+ cur_file = pathlib.Path(cur_file[2:])
+ text = cur_file.read_bytes()
+ for m in INCLUDE_REGEX.finditer(text):
+ if m.group(1) == b"<":
+ continue
+ include = m.group(2)
+ if include in IGNORED_INCLUDES:
+ continue
+ try:
+ (prefix, _) = include.split(b"/", 1)
+ if prefix in IGNORED_INCLUDE_PREFIXES:
+ continue
+ except ValueError:
+ pass
+
+ include_file = include.rsplit(b"/", 1)[-1]
+ if include_file not in acceptable_sources:
+ # print(' acceptable_sources:')
+ # for x in sorted(acceptable_sources):
+ # print(' ', x)
+ print(
+ "Warning in {}: {}: Invalid include: {}".format(
+ target_name, cur_file, include
+ )
+ )
+ ret = False
+ # print('Looks valid:', m.group())
+ continue
+
+ return ret
+
+
+# -
+# Gather real targets:
+
+
+def gather_libraries(roots: Sequence[str], descs: dict) -> Set[str]:
+ libraries = set()
+
+ def fn(target_name):
+ cur = descs[target_name]
+ print(" " + cur["type"], target_name)
+ assert has_all_includes(target_name, descs), target_name
+
+ if cur["type"] in ("shared_library", "static_library"):
+ libraries.add(target_name)
+ return (cur["deps"],)
+
+ dag_traverse(roots, fn)
+ return libraries
+
+
+# -
+
+libraries = gather_libraries(ROOTS, descs)
+print(f"\n{len(libraries)} libraries:")
+for k in libraries:
+ print(" ", k)
+
+if CHECK_ONLY:
+ print("\n--check complete.")
+ exit(0)
+
+# ------------------------------------------------------------------------------
+# Output to moz.builds
+
+import vendor_from_git
+
+print("")
+vendor_from_git.record_cherry_picks(GECKO_ANGLE_DIR, GIT_REMOTE)
+
+# --
+
+
+def sortedi(x):
+ return sorted(x, key=str.lower)
+
+
+def append_arr(dest, name, vals, indent=0):
+ if not vals:
+ return
+
+ dest.append("{}{} += [".format(" " * 4 * indent, name))
+ for x in sortedi(vals):
+ dest.append('{}"{}",'.format(" " * 4 * (indent + 1), x))
+ dest.append("{}]".format(" " * 4 * indent))
+ dest.append("")
+ return
+
+
+REGISTERED_DEFINES = {
+ "ANGLE_CAPTURE_ENABLED": True,
+ "ANGLE_EGL_LIBRARY_NAME": False,
+ "ANGLE_ENABLE_D3D11": True,
+ "ANGLE_ENABLE_D3D9": True,
+ "ANGLE_ENABLE_DEBUG_ANNOTATIONS": True,
+ "ANGLE_ENABLE_NULL": False,
+ "ANGLE_ENABLE_OPENGL": False,
+ "ANGLE_ENABLE_OPENGL_NULL": False,
+ "ANGLE_ENABLE_ESSL": True,
+ "ANGLE_ENABLE_GLSL": True,
+ "ANGLE_ENABLE_HLSL": True,
+ "ANGLE_GENERATE_SHADER_DEBUG_INFO": True,
+ "ANGLE_GLESV2_LIBRARY_NAME": True,
+ "ANGLE_IS_64_BIT_CPU": False,
+ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES": False,
+ "ANGLE_USE_EGL_LOADER": True,
+ "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS": False,
+ "CHROMIUM_BUILD": False,
+ "COMPONENT_BUILD": False,
+ "DYNAMIC_ANNOTATIONS_ENABLED": True,
+ "EGL_EGL_PROTOTYPES": True,
+ "EGL_EGLEXT_PROTOTYPES": True,
+ "EGLAPI": True,
+ "FIELDTRIAL_TESTING_ENABLED": False,
+ "FULL_SAFE_BROWSING": False,
+ "GL_API": True,
+ "GL_APICALL": True,
+ "GL_GLES_PROTOTYPES": True,
+ "GL_GLEXT_PROTOTYPES": True,
+ "GPU_INFO_USE_SETUPAPI": True,
+ "LIBANGLE_IMPLEMENTATION": True,
+ "LIBEGL_IMPLEMENTATION": True,
+ "LIBGLESV2_IMPLEMENTATION": True,
+ "NOMINMAX": True,
+ "NO_TCMALLOC": False,
+ # Else: gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp(89): error C2787: 'IDCompositionDevice': no GUID has been associated with this object
+ "NTDDI_VERSION": True,
+ "PSAPI_VERSION": False,
+ "SAFE_BROWSING_CSD": False,
+ "SAFE_BROWSING_DB_LOCAL": False,
+ "UNICODE": True,
+ "USE_AURA": False,
+ "V8_DEPRECATION_WARNINGS": False,
+ "WIN32": False,
+ "WIN32_LEAN_AND_MEAN": False,
+ "WINAPI_FAMILY": False,
+ "WINVER": True,
+ # Otherwise:
+ # gfx/angle/targets/libANGLE
+ # In file included from c:/dev/mozilla/gecko4/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp:10:
+ # In file included from c:/dev/mozilla/gecko4/gfx/angle/checkout/src\libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h:17:
+ # C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt\Windows.ui.composition.interop.h(103,20): error: unknown type name 'POINTER_INFO'
+ # _In_ const POINTER_INFO& pointerInfo
+ # ^
+ "WTF_USE_DYNAMIC_ANNOTATIONS": False,
+ "_ATL_NO_OPENGL": True,
+ "_CRT_RAND_S": True,
+ "_CRT_SECURE_NO_DEPRECATE": True,
+ "_DEBUG": False,
+ "_HAS_EXCEPTIONS": True,
+ "_HAS_ITERATOR_DEBUGGING": False,
+ "_SCL_SECURE_NO_DEPRECATE": True,
+ "_SECURE_ATL": True,
+ "_UNICODE": True,
+ "_USING_V110_SDK71_": False,
+ "_WIN32_WINNT": False,
+ "_WINDOWS": False,
+ "__STD_C": False,
+ # clang specific
+ "CR_CLANG_REVISION": True,
+ "NDEBUG": False,
+ "NVALGRIND": False,
+ "_HAS_NODISCARD": False,
+}
+
+# -
+
+print("\nRun actions")
+required_files: Set[str] = set()
+
+run_checked("ninja", "-C", str(OUT_DIR), ":commit_id")
+required_files |= set(descs["//:commit_id"]["outputs"])
+
+# -
+
+# Export our targets
+print("\nExport targets")
+
+# Clear our dest directories
+targets_dir = pathlib.Path(GECKO_ANGLE_DIR, "targets")
+checkout_dir = pathlib.Path(GECKO_ANGLE_DIR, "checkout")
+
+shutil.rmtree(targets_dir, True)
+shutil.rmtree(checkout_dir, True)
+targets_dir.mkdir(exist_ok=True)
+checkout_dir.mkdir(exist_ok=True)
+
+# -
+
+
+def export_target(target_name) -> Set[str]:
+ # print(' ', target_name)
+ desc = descs[target_name]
+ flat = flattened_target(target_name, descs)
+ assert target_name.startswith("//:"), target_name
+ name = target_name[3:]
+
+ required_files: Set[str] = set(flat["sources"])
+
+ # Create our manifest lines
+ target_dir = targets_dir / name
+ target_dir.mkdir(exist_ok=True)
+
+ lines = list(COMMON_HEADER)
+ lines.append("")
+
+ for x in sorted(set(desc["defines"])):
+ try:
+ (k, v) = x.split("=", 1)
+ if v.startswith('"'):
+ v = f"'{v}'"
+ else:
+ v = f'"{v}"'
+ except ValueError:
+ (k, v) = (x, "True")
+ try:
+ line = f'DEFINES["{k}"] = {v}'
+ if REGISTERED_DEFINES[k] == False:
+ line = "# " + line
+ lines.append(line)
+ except KeyError:
+ print(f"[{name}] Unrecognized define: {k}")
+ lines.append("")
+
+ cxxflags = set(desc["cflags"] + desc["cflags_cc"])
+
+ def fixup_paths(listt):
+ for x in set(listt):
+ assert x.startswith("//"), x
+ yield "../../checkout/" + x[2:]
+
+ sources_by_config: Dict[str, List[str]] = {}
+ extras: Dict[str, str] = dict()
+ for x in fixup_paths(flat["sources"]):
+ # print(' '*5, x)
+ (b, e) = x.rsplit(".", 1)
+ if e in ["h", "y", "l", "inc", "inl"]:
+ continue
+ elif e in ["cpp", "cc", "c"]:
+ if b.endswith("_win"):
+ config = 'CONFIG["OS_ARCH"] == "WINNT"'
+ elif b.endswith("_linux"):
+ # Include these on BSDs too.
+ config = 'CONFIG["OS_ARCH"] not in ("Darwin", "WINNT")'
+ elif b.endswith("_mac"):
+ config = 'CONFIG["OS_ARCH"] == "Darwin"'
+ elif b.endswith("_posix"):
+ config = 'CONFIG["OS_ARCH"] != "WINNT"'
+ else:
+ config = "" # None can't compare against str.
+
+ sources_by_config.setdefault(config, []).append(x)
+ continue
+ elif e == "rc":
+ assert "RCFILE" not in extras, (target_name, extras["RCFILE"], x)
+ extras["RCFILE"] = f'"{x}"'
+ continue
+ elif e == "def":
+ assert "DEFFILE" not in extras, (target_name, extras["DEFFILE"], x)
+ extras["DEFFILE"] = f'"{x}"'
+ continue
+ else:
+ assert False, ("Unhandled ext:", x)
+
+ ldflags = set(desc["ldflags"])
+ DEF_PREFIX = "/DEF:"
+ for x in set(ldflags):
+ if x.startswith(DEF_PREFIX):
+ def_path = x[len(DEF_PREFIX) :]
+ required_files.add(def_path)
+ assert "DEFFILE" not in extras
+ ldflags.remove(x)
+
+ def_path = str(OUT_DIR) + "/" + def_path
+ def_path = "//" + collapse_dotdots(def_path)
+
+ def_rel_path = list(fixup_paths([def_path]))[0]
+ extras["DEFFILE"] = '"{}"'.format(def_rel_path)
+
+ os_libs = list(map(lambda x: x[: -len(".lib")], set(desc.get("libs", []))))
+
+ def append_arr_commented(dest, name, src):
+ lines = []
+ append_arr(lines, name, src)
+
+ def comment(x):
+ if x:
+ x = "# " + x
+ return x
+
+ lines = map(comment, lines)
+ dest += lines
+
+ append_arr(lines, "LOCAL_INCLUDES", fixup_paths(desc["include_dirs"]))
+ append_arr_commented(lines, "CXXFLAGS", cxxflags)
+
+ for (config, v) in sorted_items(sources_by_config):
+ indent = 0
+ if config:
+ lines.append("if {}:".format(config))
+ indent = 1
+ append_arr(lines, "SOURCES", v, indent=indent)
+
+ dep_libs: Set[str] = set()
+ for dep_name in set(flat["deps"]):
+ dep = descs[dep_name]
+ if dep["type"] in LIBRARY_TYPES:
+ assert dep_name.startswith("//:"), dep_name
+ dep_libs.add(dep_name[3:])
+
+ append_arr(lines, "USE_LIBS", dep_libs)
+ append_arr(lines, "DIRS", ["../" + x for x in dep_libs])
+ append_arr(lines, "OS_LIBS", os_libs)
+ append_arr_commented(lines, "LDFLAGS", ldflags)
+
+ for (k, v) in sorted(extras.items()):
+ lines.append("{} = {}".format(k, v))
+
+ lib_type = desc["type"]
+ if lib_type == "shared_library":
+ lines.append(f'GeckoSharedLibrary("{name}", linkage=None)')
+ elif lib_type == "static_library":
+ lines.append(f'Library("{name}")')
+ else:
+ assert False, lib_type
+
+ lines.append("")
+ # EOF newline
+
+ # Write it out
+
+ mozbuild = target_dir / "moz.build"
+ print(" ", " ", f"Writing {mozbuild}")
+ data = b"\n".join((x.encode() for x in lines))
+ mozbuild.write_bytes(data)
+
+ return required_files
+
+
+# -
+
+for target_name in libraries:
+ reqs = export_target(target_name)
+ required_files |= reqs
+
+# Copy all the files
+
+print("\nMigrate required files")
+
+i = 0
+for x in required_files:
+ i += 1
+ sys.stdout.write(f"\r Copying {i}/{len(required_files)}")
+ sys.stdout.flush()
+ assert x.startswith("//"), x
+ x = x[2:]
+
+ src = REPO_DIR / x
+ dest = checkout_dir / x
+
+ dest.parent.mkdir(parents=True, exist_ok=True)
+ data = src.read_bytes()
+ data = data.replace(b"\r\n", b"\n")
+ dest.write_bytes(data)
+
+print("\n\nDone")
diff --git a/gfx/angle/vendor_from_git.py b/gfx/angle/vendor_from_git.py
new file mode 100644
index 0000000000..a227bbbe38
--- /dev/null
+++ b/gfx/angle/vendor_from_git.py
@@ -0,0 +1,67 @@
+#! /usr/bin/env python3
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+assert __name__ != "__main__"
+
+"""
+Any time we vendor[1] from an external git repo, we want to keep a record of the csets
+we're pulling from.
+
+This script leaves a record of the merge-base reference tip and cherry-picks that we pull
+into Gecko. (such as gfx/angle/cherry_picks.txt)
+"""
+
+from pathlib import *
+import subprocess
+import sys
+
+# --
+
+
+def print_now(*args):
+ print(*args)
+ sys.stdout.flush()
+
+
+def run_checked(*args, **kwargs):
+ print(" ", args)
+ sys.stdout.flush()
+ return subprocess.run(args, check=True, **kwargs)
+
+
+# --
+
+
+def record_cherry_picks(dir_in_gecko, merge_base_origin):
+ # merge_base_origin is not always 'origin'!
+ merge_base_from = Path(dir_in_gecko, "MERGE_BASE").read_text().split("\n")[0]
+ merge_base_from = merge_base_origin + "/" + merge_base_from
+
+ assert "/" in merge_base_from, "Please specify a reference tip from a remote."
+ log_path = Path(dir_in_gecko, "cherry_picks.txt")
+ print_now("Logging cherry picks to {}.".format(log_path))
+
+ merge_base = (
+ run_checked(
+ "git", "merge-base", "HEAD", merge_base_from, stdout=subprocess.PIPE
+ )
+ .stdout.decode()
+ .strip()
+ )
+
+ mb_info = run_checked(
+ "git", "log", "{}~1..{}".format(merge_base, merge_base), stdout=subprocess.PIPE
+ ).stdout
+ cherries = run_checked(
+ "git", "log", merge_base + "..", stdout=subprocess.PIPE
+ ).stdout
+
+ with open(log_path, "wb") as f:
+ f.write(cherries)
+ f.write(b"\nCherries picked")
+ f.write(b"\n" + (b"=" * 80))
+ f.write(b"\nMerge base from: " + merge_base_from.encode())
+ f.write(b"\n\n")
+ f.write(mb_info)